diff --git a/api-generator/build-apidoc.js b/api-generator/build-apidoc.js index 0f5cfee7b..a33fa6a02 100644 --- a/api-generator/build-apidoc.js +++ b/api-generator/build-apidoc.js @@ -24,7 +24,7 @@ app.options.addReader(new TypeDoc.TypeDocReader()); app.bootstrap({ // typedoc options here name: 'PrimeVue', - entryPoints: [`components/lib`], + entryPoints: [`components/lib/`], entryPointStrategy: 'expand', hideGenerator: true, excludeExternals: true, @@ -441,6 +441,24 @@ if (project) { }); let values = event.type.toString(); + + if (values.includes('Function') && event.type.types) { + values = ''; + + for (const [i, type] of event.type.types.entries()) { + if (type.declaration && type.declaration.signatures) { + const signature = type.declaration.signatures[0]; + const parameters = signature.parameters.reduce((acc, { name, type }, index) => (index === 0 ? `${name}: ${type.name}` : `${acc}, ${name}: ${type.name}`), ''); + + values += i === 0 ? `(${parameters}) => ${signature.type?.name}` : ` | (${parameters}) => ${signature.type?.name}`; + } else { + const typeName = type.name || type.value; + + values += i === 0 ? `${typeName}` : ` | ${typeName}`; + } + } + } + const declaration = event.type.declaration; if (declaration) { diff --git a/api-generator/components/accordion.js b/api-generator/components/accordion.js index 7ebb08be3..baa34649c 100644 --- a/api-generator/components/accordion.js +++ b/api-generator/components/accordion.js @@ -40,6 +40,12 @@ const AccordionProps = [ type: 'boolean', default: 'false', description: 'When enabled, the focused tab is activated.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/api-generator/components/accordiontab.js b/api-generator/components/accordiontab.js index e29b3e708..b535a9fb3 100644 --- a/api-generator/components/accordiontab.js +++ b/api-generator/components/accordiontab.js @@ -52,6 +52,23 @@ const AccordionTabProps = [ type: 'boolean', default: 'false', description: 'Whether the tab is disabled.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' + } +]; + +const AccordionTabSlots = [ + { + name: 'header', + description: 'Custom content for the title section of a AccordionTab is defined using the header template.' + }, + { + name: 'headericon', + description: 'Custom icon for the header section of a AccordionTab is defined using the headericon template.' } ]; @@ -59,6 +76,7 @@ module.exports = { accordiontab: { name: 'AccordionTab', description: 'Accordion element consists of one or more AccordionTab elements.', - props: AccordionTabProps + props: AccordionTabProps, + slots: AccordionTabSlots } }; diff --git a/api-generator/components/deferredcontent.js b/api-generator/components/deferredcontent.js index 39ab834b6..72cc1279b 100644 --- a/api-generator/components/deferredcontent.js +++ b/api-generator/components/deferredcontent.js @@ -1,3 +1,12 @@ +const DeferredContentProps = [ + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' + } +]; + const DeferredContentEvents = [ { name: 'load', @@ -16,6 +25,7 @@ module.exports = { deferredcontent: { name: 'DeferredContent', description: 'DeferredContent postpones the loading the content that is initially not in the viewport until it becomes visible on scroll.', + props: DeferredContentProps, events: DeferredContentEvents } }; diff --git a/api-generator/components/divider.js b/api-generator/components/divider.js index 99e46a677..8d2686095 100644 --- a/api-generator/components/divider.js +++ b/api-generator/components/divider.js @@ -16,6 +16,12 @@ const DividerProps = [ type: 'string', default: 'solid', description: 'Border style type, default is "solid" and other options are "dashed" and "dotted".' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/api-generator/components/fieldset.js b/api-generator/components/fieldset.js index fc76bfaed..530e298fc 100644 --- a/api-generator/components/fieldset.js +++ b/api-generator/components/fieldset.js @@ -22,6 +22,12 @@ const FieldsetProps = [ type: 'string', default: 'null', description: 'Uses to pass the custom value to read for the AnchorHTMLAttributes inside the component.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; @@ -47,7 +53,11 @@ const FieldsetEvents = [ const FieldsetSlots = [ { name: 'legend', - description: "Custom content for the component's header" + description: 'Custom legend template.' + }, + { + name: 'togglericon', + description: 'Custom toggler icon template.' } ]; diff --git a/api-generator/components/panel.js b/api-generator/components/panel.js index 335043c8a..909ee3301 100644 --- a/api-generator/components/panel.js +++ b/api-generator/components/panel.js @@ -22,6 +22,12 @@ const PanelProps = [ type: 'string', default: 'null', description: 'Uses to pass the custom value to read for the anchor inside the component.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; @@ -52,6 +58,10 @@ const PanelSlots = [ { name: 'icons', description: "Custom content for the header's icon" + }, + { + name: 'headericon', + description: 'Custom header icon template of panel' } ]; diff --git a/api-generator/components/scrollpanel.js b/api-generator/components/scrollpanel.js index 3ff6c6ac1..fb8446b9f 100644 --- a/api-generator/components/scrollpanel.js +++ b/api-generator/components/scrollpanel.js @@ -4,6 +4,12 @@ const ScrollPanelProps = [ type: 'number', default: '5', description: 'Step factor to scroll the content while pressing the arrow keys.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/api-generator/components/splitter.js b/api-generator/components/splitter.js index a3a228257..0ba1b0060 100644 --- a/api-generator/components/splitter.js +++ b/api-generator/components/splitter.js @@ -28,6 +28,12 @@ const SplitterProps = [ type: 'number', default: '5', description: 'Step factor to increment/decrement the size of the panels while pressing the arrow keys.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/api-generator/components/splitterpanel.js b/api-generator/components/splitterpanel.js index 302674132..fa98e1225 100644 --- a/api-generator/components/splitterpanel.js +++ b/api-generator/components/splitterpanel.js @@ -10,6 +10,12 @@ const SplitterPanelProps = [ type: 'number', default: 'null', description: 'Minimum size of the element relative to 100%.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/api-generator/components/tabpanel.js b/api-generator/components/tabpanel.js index 32af2a89e..14f88357c 100644 --- a/api-generator/components/tabpanel.js +++ b/api-generator/components/tabpanel.js @@ -52,6 +52,12 @@ const TabPanelProps = [ type: 'boolean', default: 'null', description: 'Whether the tab is disabled.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/api-generator/components/tabview.js b/api-generator/components/tabview.js index 210f1d45a..a632fe72a 100644 --- a/api-generator/components/tabview.js +++ b/api-generator/components/tabview.js @@ -40,6 +40,12 @@ const TabViewProps = [ type: 'any', default: 'null', description: 'Uses to pass all properties of the HTMLButtonElement to the next button.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; @@ -78,11 +84,27 @@ const TabViewEvents = [ } ]; +const TabViewSlots = [ + { + name: 'default', + description: 'Default slot to detect TabPanel components.' + }, + { + name: 'previcon', + description: 'Previous button icon template for the scrollable component.' + }, + { + name: 'nexticon', + description: 'Next button icon template for the scrollable component.' + } +]; + module.exports = { tabview: { name: 'TabView', description: 'TabView is a container component to group content with tabs.', props: TabViewProps, - event: TabViewEvents + event: TabViewEvents, + slots: TabViewSlots } }; diff --git a/api-generator/components/toolbar.js b/api-generator/components/toolbar.js index b90edb988..40b5f6506 100644 --- a/api-generator/components/toolbar.js +++ b/api-generator/components/toolbar.js @@ -4,6 +4,12 @@ const ToolbarProps = [ type: 'string', default: 'null', description: 'Defines a string value that labels an interactive element.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/accordion/Accordion.d.ts b/components/lib/accordion/Accordion.d.ts index 8e5f117ce..a539869a3 100755 --- a/components/lib/accordion/Accordion.d.ts +++ b/components/lib/accordion/Accordion.d.ts @@ -10,6 +10,15 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type AccordionPassThroughOptionType = AccordionPassThroughAttributes | ((options: AccordionPassThroughMethodOptions) => AccordionPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface AccordionPassThroughMethodOptions { + props: AccordionProps; + state: AccordionState; +} /** * Custom tab open event. * @see {@link AccordionEmits.tab-open} @@ -40,6 +49,38 @@ export interface AccordionTabCloseEvent extends AccordionTabOpenEvent {} */ export interface AccordionClickEvent extends AccordionTabOpenEvent {} +/** + * Custom passthrough(pt) options. + * @see {@link AccordionProps.pt} + */ +export interface AccordionPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: AccordionPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface AccordionPassThroughAttributes { + [key: string]: any; +} + +/** + * Defines current inline state in Accordion component. + */ +export interface AccordionState { + /** + * Current id state as a string + */ + id: string; + /** + * Current active index state. + */ + d_activeIndex: number | number[]; +} + /** * Defines valid properties in Accordion component. */ @@ -79,6 +120,11 @@ export interface AccordionProps { * @defaultValue false */ selectOnFocus?: boolean | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {AccordionPassThroughOptions} + */ + pt?: AccordionPassThroughOptions; } /** diff --git a/components/lib/accordion/Accordion.vue b/components/lib/accordion/Accordion.vue index 443448ddb..37345e781 100755 --- a/components/lib/accordion/Accordion.vue +++ b/components/lib/accordion/Accordion.vue @@ -1,7 +1,7 @@ diff --git a/components/lib/base/package.json b/components/lib/base/package.json new file mode 100644 index 000000000..8605318c7 --- /dev/null +++ b/components/lib/base/package.json @@ -0,0 +1,8 @@ +{ + "main": "./componentbase.cjs.js", + "module": "./componentbase.esm.js", + "unpkg": "./componentbase.min.js", + "browser": { + "./sfc": "./ComponentBase.vue" + } +} \ No newline at end of file diff --git a/components/lib/card/Card.d.ts b/components/lib/card/Card.d.ts index d6d339818..2634c2966 100755 --- a/components/lib/card/Card.d.ts +++ b/components/lib/card/Card.d.ts @@ -10,10 +10,56 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type CardPassThroughOptionType = CardPassThroughAttributes | null | undefined; + +/** + * Custom passthrough(pt) options. + * @see {@link CardProps.pt} + */ +export interface CardPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: CardPassThroughOptionType; + /** + * Uses to pass attributes to the body's DOM element. + */ + body?: CardPassThroughOptionType; + /** + * Uses to pass attributes to the title's DOM element. + */ + title?: CardPassThroughOptionType; + /** + * Uses to pass attributes to the subtitle's DOM element. + */ + subtitle?: CardPassThroughOptionType; + /** + * Uses to pass attributes to the content's DOM element. + */ + content?: CardPassThroughOptionType; + /** + * Uses to pass attributes to the footer's DOM element. + */ + footer?: CardPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface CardPassThroughAttributes { + [key: string]: any; +} + /** * Defines valid properties in Card component. */ -export interface CardProps {} +export interface CardProps { + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {CardPassThroughOptions} + */ + pt?: CardPassThroughOptions; +} /** * Defines valid slots in Card component. diff --git a/components/lib/card/Card.vue b/components/lib/card/Card.vue index 6ffd8a3ed..13f6fb00b 100755 --- a/components/lib/card/Card.vue +++ b/components/lib/card/Card.vue @@ -1,15 +1,19 @@ - - diff --git a/components/lib/deferredcontent/DeferredContent.d.ts b/components/lib/deferredcontent/DeferredContent.d.ts index e1f5c59d2..74ee08c6c 100755 --- a/components/lib/deferredcontent/DeferredContent.d.ts +++ b/components/lib/deferredcontent/DeferredContent.d.ts @@ -10,7 +10,55 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; -export interface DeferredContentProps {} +export declare type DeferredContentPassThroughOptionType = DeferredContentPassThroughAttributes | ((options: DeferredContentPassThroughMethodOptions) => DeferredContentPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface DeferredContentPassThroughMethodOptions { + props: DeferredContentProps; + state: DeferredContentState; +} + +/** + * Custom passthrough(pt) options. + * @see {@link DeferredContentProps.pt} + */ +export interface DeferredContentPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: DeferredContentPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface DeferredContentPassThroughAttributes { + [key: string]: any; +} + +/** + * Defines current inline state in DeferredContent component. + */ +export interface DeferredContentState { + /** + * Current loaded state as a boolean. + * @defaultValue false + */ + loaded?: boolean; +} + +/** + * Defines valid props in DeferredContent component. + */ +export interface DeferredContentProps { + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {DeferredContentPassThroughOptions} + */ + pt?: DeferredContentPassThroughOptions; +} /** * Defines valid slots in DeferredContent component. diff --git a/components/lib/deferredcontent/DeferredContent.vue b/components/lib/deferredcontent/DeferredContent.vue index 538d2de3a..7688d7896 100755 --- a/components/lib/deferredcontent/DeferredContent.vue +++ b/components/lib/deferredcontent/DeferredContent.vue @@ -1,12 +1,15 @@