Merge branch 'pass-through'

pull/3841/head
Tuğçe Küçükoğlu 2023-03-30 12:09:09 +03:00
commit 99b59580fa
44 changed files with 1198 additions and 73 deletions

View File

@ -24,7 +24,7 @@ app.options.addReader(new TypeDoc.TypeDocReader());
app.bootstrap({ app.bootstrap({
// typedoc options here // typedoc options here
name: 'PrimeVue', name: 'PrimeVue',
entryPoints: [`components/lib`], entryPoints: [`components/lib/`],
entryPointStrategy: 'expand', entryPointStrategy: 'expand',
hideGenerator: true, hideGenerator: true,
excludeExternals: true, excludeExternals: true,
@ -441,6 +441,24 @@ if (project) {
}); });
let values = event.type.toString(); 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; const declaration = event.type.declaration;
if (declaration) { if (declaration) {

View File

@ -40,6 +40,12 @@ const AccordionProps = [
type: 'boolean', type: 'boolean',
default: 'false', default: 'false',
description: 'When enabled, the focused tab is activated.' 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.'
} }
]; ];

View File

@ -52,6 +52,23 @@ const AccordionTabProps = [
type: 'boolean', type: 'boolean',
default: 'false', default: 'false',
description: 'Whether the tab is disabled.' 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: { accordiontab: {
name: 'AccordionTab', name: 'AccordionTab',
description: 'Accordion element consists of one or more AccordionTab elements.', description: 'Accordion element consists of one or more AccordionTab elements.',
props: AccordionTabProps props: AccordionTabProps,
slots: AccordionTabSlots
} }
}; };

View File

@ -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 = [ const DeferredContentEvents = [
{ {
name: 'load', name: 'load',
@ -16,6 +25,7 @@ module.exports = {
deferredcontent: { deferredcontent: {
name: 'DeferredContent', name: 'DeferredContent',
description: 'DeferredContent postpones the loading the content that is initially not in the viewport until it becomes visible on scroll.', description: 'DeferredContent postpones the loading the content that is initially not in the viewport until it becomes visible on scroll.',
props: DeferredContentProps,
events: DeferredContentEvents events: DeferredContentEvents
} }
}; };

View File

@ -16,6 +16,12 @@ const DividerProps = [
type: 'string', type: 'string',
default: 'solid', default: 'solid',
description: 'Border style type, default is "solid" and other options are "dashed" and "dotted".' 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.'
} }
]; ];

View File

@ -22,6 +22,12 @@ const FieldsetProps = [
type: 'string', type: 'string',
default: 'null', default: 'null',
description: 'Uses to pass the custom value to read for the AnchorHTMLAttributes inside the component.' 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 = [ const FieldsetSlots = [
{ {
name: 'legend', name: 'legend',
description: "Custom content for the component's header" description: 'Custom legend template.'
},
{
name: 'togglericon',
description: 'Custom toggler icon template.'
} }
]; ];

View File

@ -22,6 +22,12 @@ const PanelProps = [
type: 'string', type: 'string',
default: 'null', default: 'null',
description: 'Uses to pass the custom value to read for the anchor inside the component.' 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', name: 'icons',
description: "Custom content for the header's icon" description: "Custom content for the header's icon"
},
{
name: 'headericon',
description: 'Custom header icon template of panel'
} }
]; ];

View File

@ -4,6 +4,12 @@ const ScrollPanelProps = [
type: 'number', type: 'number',
default: '5', default: '5',
description: 'Step factor to scroll the content while pressing the arrow keys.' 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.'
} }
]; ];

View File

@ -28,6 +28,12 @@ const SplitterProps = [
type: 'number', type: 'number',
default: '5', default: '5',
description: 'Step factor to increment/decrement the size of the panels while pressing the arrow keys.' 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.'
} }
]; ];

View File

@ -10,6 +10,12 @@ const SplitterPanelProps = [
type: 'number', type: 'number',
default: 'null', default: 'null',
description: 'Minimum size of the element relative to 100%.' 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.'
} }
]; ];

View File

@ -52,6 +52,12 @@ const TabPanelProps = [
type: 'boolean', type: 'boolean',
default: 'null', default: 'null',
description: 'Whether the tab is disabled.' description: 'Whether the tab is disabled.'
},
{
name: 'pt',
type: 'any',
default: 'null',
description: 'Uses to pass attributes to DOM elements inside the component.'
} }
]; ];

View File

@ -40,6 +40,12 @@ const TabViewProps = [
type: 'any', type: 'any',
default: 'null', default: 'null',
description: 'Uses to pass all properties of the HTMLButtonElement to the next button.' 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 = { module.exports = {
tabview: { tabview: {
name: 'TabView', name: 'TabView',
description: 'TabView is a container component to group content with tabs.', description: 'TabView is a container component to group content with tabs.',
props: TabViewProps, props: TabViewProps,
event: TabViewEvents event: TabViewEvents,
slots: TabViewSlots
} }
}; };

View File

@ -4,6 +4,12 @@ const ToolbarProps = [
type: 'string', type: 'string',
default: 'null', default: 'null',
description: 'Defines a string value that labels an interactive element.' 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.'
} }
]; ];

View File

@ -10,6 +10,15 @@
import { VNode } from 'vue'; import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; 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. * Custom tab open event.
* @see {@link AccordionEmits.tab-open} * @see {@link AccordionEmits.tab-open}
@ -40,6 +49,38 @@ export interface AccordionTabCloseEvent extends AccordionTabOpenEvent {}
*/ */
export interface AccordionClickEvent 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. * Defines valid properties in Accordion component.
*/ */
@ -79,6 +120,11 @@ export interface AccordionProps {
* @defaultValue false * @defaultValue false
*/ */
selectOnFocus?: boolean | undefined; selectOnFocus?: boolean | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {AccordionPassThroughOptions}
*/
pt?: AccordionPassThroughOptions;
} }
/** /**

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="p-accordion p-component"> <div class="p-accordion p-component" v-bind="ptm('root')">
<div v-for="(tab, i) of tabs" :key="getKey(tab, i)" :class="getTabClass(i)" :data-index="i"> <div v-for="(tab, i) of tabs" :key="getKey(tab, i)" :class="getTabClass(i)" :data-index="i" v-bind="getTabPT(tab, 'root')">
<div :style="getTabProp(tab, 'headerStyle')" :class="getTabHeaderClass(tab, i)" v-bind="getTabProp(tab, 'headerProps')"> <div :style="getTabProp(tab, 'headerStyle')" :class="getTabHeaderClass(tab, i)" v-bind="{ ...getTabProp(tab, 'headerProps'), ...getTabPT(tab, 'header') }">
<a <a
:id="getTabHeaderActionId(i)" :id="getTabHeaderActionId(i)"
class="p-accordion-header-link p-accordion-header-action" class="p-accordion-header-link p-accordion-header-action"
@ -12,10 +12,11 @@
:aria-controls="getTabContentId(i)" :aria-controls="getTabContentId(i)"
@click="onTabClick($event, tab, i)" @click="onTabClick($event, tab, i)"
@keydown="onTabKeyDown($event, tab, i)" @keydown="onTabKeyDown($event, tab, i)"
v-bind="getTabProp(tab, 'headerActionProps')" v-bind="{ ...getTabProp(tab, 'headeractionprops'), ...getTabPT(tab, 'headeraction') }"
> >
<span :class="getTabHeaderIconClass(i)" aria-hidden="true"></span> <component v-if="tab.children && tab.children.headericon" :is="tab.children.headericon" :isTabActive="isTabActive(i)" :index="i"></component>
<span v-if="tab.props && tab.props.header" class="p-accordion-header-text">{{ tab.props.header }}</span> <span v-else :class="getTabHeaderIconClass(i)" aria-hidden="true" v-bind="getTabPT(tab, 'headericon')"></span>
<span v-if="tab.props && tab.props.header" class="p-accordion-header-text" v-bind="getTabPT(tab, 'headertitle')">{{ tab.props.header }}</span>
<component v-if="tab.children && tab.children.header" :is="tab.children.header"></component> <component v-if="tab.children && tab.children.header" :is="tab.children.header"></component>
</a> </a>
</div> </div>
@ -28,9 +29,9 @@
:class="getTabContentClass(tab)" :class="getTabContentClass(tab)"
role="region" role="region"
:aria-labelledby="getTabHeaderActionId(i)" :aria-labelledby="getTabHeaderActionId(i)"
v-bind="getTabProp(tab, 'contentProps')" v-bind="{ ...getTabProp(tab, 'contentProps'), ...getTabPT(tab, 'toggleablecontent') }"
> >
<div class="p-accordion-content"> <div class="p-accordion-content" v-bind="getTabPT(tab, 'content')">
<component :is="tab"></component> <component :is="tab"></component>
</div> </div>
</div> </div>
@ -40,11 +41,13 @@
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
import Ripple from 'primevue/ripple'; import Ripple from 'primevue/ripple';
import { DomHandler, UniqueComponentId } from 'primevue/utils'; import { DomHandler, UniqueComponentId } from 'primevue/utils';
export default { export default {
name: 'Accordion', name: 'Accordion',
extends: ComponentBase,
emits: ['update:activeIndex', 'tab-open', 'tab-close', 'tab-click'], emits: ['update:activeIndex', 'tab-open', 'tab-close', 'tab-click'],
props: { props: {
multiple: { multiple: {
@ -112,6 +115,15 @@ export default {
getTabContentId(index) { getTabContentId(index) {
return `${this.id}_${index}_content`; return `${this.id}_${index}_content`;
}, },
getTabPT(tab, key) {
return this.ptmo(this.getTabProp(tab, 'pt'), key, {
props: tab.props,
parent: {
props: this.$props,
state: this.$data
}
});
},
onTabClick(event, tab, index) { onTabClick(event, tab, index) {
this.changeActiveIndex(event, tab, index); this.changeActiveIndex(event, tab, index);
this.$emit('tab-click', { originalEvent: event, index }); this.$emit('tab-click', { originalEvent: event, index });

View File

@ -8,8 +8,61 @@
* *
*/ */
import { AnchorHTMLAttributes, HTMLAttributes, VNode } from 'vue'; import { AnchorHTMLAttributes, HTMLAttributes, VNode } from 'vue';
import { AccordionPassThroughOptions } from '../accordion';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type AccordionTabPassThroughOptionType = AccordionTabPassThroughAttributes | ((options: AccordionTabPassThroughMethodOptions) => AccordionTabPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface AccordionTabPassThroughMethodOptions {
props: AccordionTabProps;
parent: AccordionPassThroughOptions;
}
/**
* Custom passthrough(pt) options.
* @see {@link AccordionTabProps.pt}
*/
export interface AccordionTabPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: AccordionTabPassThroughOptionType;
/**
* Uses to pass attributes to the header's DOM element.
*/
header?: AccordionTabPassThroughOptionType;
/**
* Uses to pass attributes to the headeraction's DOM element.
*/
headeraction?: AccordionTabPassThroughOptionType;
/**
* Uses to pass attributes to the headericon's DOM element.
*/
headericon?: AccordionTabPassThroughOptionType;
/**
* Uses to pass attributes to the headertitle's DOM element.
*/
headertitle?: AccordionTabPassThroughOptionType;
/**
* Uses to pass attributes to the toggleablecontent's DOM element.
*/
toggleablecontent?: AccordionTabPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: AccordionTabPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface AccordionTabPassThroughAttributes {
[key: string]: any;
}
/** /**
* Defines valid properties in AccordionTab component. * Defines valid properties in AccordionTab component.
*/ */
@ -28,10 +81,12 @@ export interface AccordionTabProps {
headerClass?: any; headerClass?: any;
/** /**
* Uses to pass all properties of the HTMLDivElement to the tab header. * Uses to pass all properties of the HTMLDivElement to the tab header.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
headerProps?: HTMLAttributes | undefined; headerProps?: HTMLAttributes | undefined;
/** /**
* Uses to pass all properties of the HTMLAnchorElement to the focusable anchor element inside the tab header. * Uses to pass all properties of the HTMLAnchorElement to the focusable anchor element inside the tab header.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
headerActionProps?: AnchorHTMLAttributes | undefined; headerActionProps?: AnchorHTMLAttributes | undefined;
/** /**
@ -44,6 +99,7 @@ export interface AccordionTabProps {
contentClass?: any; contentClass?: any;
/** /**
* Uses to pass all properties of the HTMLDivElement to the tab content. * Uses to pass all properties of the HTMLDivElement to the tab content.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
contentProps?: HTMLAttributes | undefined; contentProps?: HTMLAttributes | undefined;
/** /**
@ -51,6 +107,11 @@ export interface AccordionTabProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {AccordionTabPassThroughOptions}
*/
pt?: AccordionTabPassThroughOptions;
} }
/** /**
@ -62,9 +123,23 @@ export interface AccordionTabSlots {
*/ */
default(): VNode[]; default(): VNode[];
/** /**
* Custom content for the title section of a panel is defined using the header template. * Custom content for the title section of a AccordionTab is defined using the header template.
*/ */
header(): VNode[]; header(): VNode[];
/**
* Custom icon for the header section of a AccordionTab is defined using the headericon template.
* @param {Object} scope - header slot's params.
*/
headericon(scope: {
/**
* Index of the tab
*/
index: number;
/**
* Whether the tab is active
*/
isTabActive(i: number): void;
}): VNode[];
} }
/** /**

View File

@ -3,8 +3,11 @@
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
export default { export default {
name: 'AccordionTab', name: 'AccordionTab',
extends: ComponentBase,
props: { props: {
header: null, header: null,
headerStyle: null, headerStyle: null,

View File

@ -0,0 +1,21 @@
<script>
import { ObjectUtils } from 'primevue/utils';
export default {
name: 'ComponentBase',
props: {
pt: {
type: Object,
value: {}
}
},
methods: {
ptm(key = '', params = {}) {
return ObjectUtils.getItemValue((this.pt || {})[key.toLowerCase()], { props: this.$props, state: this.$data, ...params });
},
ptmo(obj = {}, key = '', params = {}) {
return ObjectUtils.getItemValue(obj[key.toLowerCase()], params);
}
}
};
</script>

View File

@ -0,0 +1,8 @@
{
"main": "./componentbase.cjs.js",
"module": "./componentbase.esm.js",
"unpkg": "./componentbase.min.js",
"browser": {
"./sfc": "./ComponentBase.vue"
}
}

View File

@ -10,10 +10,56 @@
import { VNode } from 'vue'; import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; 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. * 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. * Defines valid slots in Card component.

View File

@ -1,15 +1,19 @@
<template> <template>
<div class="p-card p-component"> <div class="p-card p-component" v-bind="ptm('root')">
<div v-if="$slots.header" class="p-card-header"> <div v-if="$slots.header" class="p-card-header" v-bind="ptm('header')">
<slot name="header"></slot> <slot name="header"></slot>
</div> </div>
<div class="p-card-body"> <div class="p-card-body" v-bind="ptm('body')">
<div v-if="$slots.title" class="p-card-title"><slot name="title"></slot></div> <div v-if="$slots.title" class="p-card-title" v-bind="ptm('title')">
<div v-if="$slots.subtitle" class="p-card-subtitle"><slot name="subtitle"></slot></div> <slot name="title"></slot>
<div class="p-card-content"> </div>
<div v-if="$slots.subtitle" class="p-card-subtitle" v-bind="ptm('subtitle')">
<slot name="subtitle"></slot>
</div>
<div class="p-card-content" v-bind="ptm('content')">
<slot name="content"></slot> <slot name="content"></slot>
</div> </div>
<div v-if="$slots.footer" class="p-card-footer"> <div v-if="$slots.footer" class="p-card-footer" v-bind="ptm('footer')">
<slot name="footer"></slot> <slot name="footer"></slot>
</div> </div>
</div> </div>
@ -17,13 +21,10 @@
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
export default { export default {
name: 'Card' name: 'Card',
extends: ComponentBase
}; };
</script> </script>
<style>
.p-card-header img {
width: 100%;
}
</style>

View File

@ -10,7 +10,55 @@
import { VNode } from 'vue'; import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; 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. * Defines valid slots in DeferredContent component.

View File

@ -1,12 +1,15 @@
<template> <template>
<div ref="container"> <div ref="container" v-bind="ptm('root')">
<slot v-if="loaded"></slot> <slot v-if="loaded"></slot>
</div> </div>
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
export default { export default {
name: 'DeferredContent', name: 'DeferredContent',
extends: ComponentBase,
emits: ['load'], emits: ['load'],
data() { data() {
return { return {

View File

@ -10,6 +10,37 @@
import { VNode } from 'vue'; import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type DividerPassThroughOptionType = DividerPassThroughAttributes | ((options: DividerPassThroughMethodOptions) => DividerPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface DividerPassThroughMethodOptions {
props: DividerProps;
}
/**
* Custom passthrough(pt) options.
* @see {@link DividerProps.pt}
*/
export interface DividerPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: DividerPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: DividerPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface DividerPassThroughAttributes {
[key: string]: any;
}
/** /**
* Defines valid properties in Divider component. * Defines valid properties in Divider component.
*/ */
@ -28,6 +59,11 @@ export interface DividerProps {
* @defaultValue solid * @defaultValue solid
*/ */
type?: 'solid' | 'dashed' | 'dotted' | undefined; type?: 'solid' | 'dashed' | 'dotted' | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {DividerPassThroughOptions}
*/
pt?: DividerPassThroughOptions;
} }
/** /**

View File

@ -1,14 +1,16 @@
<template> <template>
<div :class="containerClass" role="separator" :aria-orientation="layout"> <div :class="containerClass" role="separator" :aria-orientation="layout" v-bind="ptm('root')">
<div v-if="$slots.default" class="p-divider-content"> <div v-if="$slots.default" class="p-divider-content" v-bind="ptm('content')">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
export default { export default {
name: 'Divider', name: 'Divider',
extends: ComponentBase,
props: { props: {
align: { align: {
type: String, type: String,

View File

@ -10,6 +10,16 @@
import { AnchorHTMLAttributes, VNode } from 'vue'; import { AnchorHTMLAttributes, VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type FieldsetPassThroughOptionType = FieldsetPassThroughAttributes | ((options: FieldsetPassThroughMethodOptions) => FieldsetPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface FieldsetPassThroughMethodOptions {
props: FieldsetProps;
state: FieldsetState;
}
/** /**
* Custom toggle event. * Custom toggle event.
* @see {@link FieldsetEmits.toggle} * @see {@link FieldsetEmits.toggle}
@ -25,6 +35,59 @@ export interface FieldsetToggleEvent {
value: boolean; value: boolean;
} }
/**
* Custom passthrough(pt) options.
* @see {@link FieldsetProps.pt}
*/
export interface FieldsetPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the legend's DOM element.
*/
legend?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the legend title's DOM element.
*/
legendtitle?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the toggler's DOM element.
*/
toggler?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the toggler icon's DOM element.
*/
togglericon?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the toggleable content's DOM element.
*/
toggleablecontent?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: FieldsetPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface FieldsetPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Fieldset component.
*/
export interface FieldsetState {
/**
* Current collapsed state as a boolean.
* @defaultValue false
*/
d_collapsed: boolean;
}
/** /**
* Defines valid properties in Fieldset component. * Defines valid properties in Fieldset component.
*/ */
@ -45,8 +108,14 @@ export interface FieldsetProps {
collapsed?: boolean | undefined; collapsed?: boolean | undefined;
/** /**
* Uses to pass the custom value to read for the AnchorHTMLAttributes inside the component. * Uses to pass the custom value to read for the AnchorHTMLAttributes inside the component.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
toggleButtonProps?: AnchorHTMLAttributes | undefined; toggleButtonProps?: AnchorHTMLAttributes | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {FieldsetPassThroughOptions}
*/
pt?: FieldsetPassThroughOptions;
} }
/** /**
@ -61,6 +130,10 @@ export interface FieldsetSlots {
* Custom legend template. * Custom legend template.
*/ */
legend: () => VNode[]; legend: () => VNode[];
/**
* Custom toggler icon template.
*/
togglericon: () => VNode[];
} }
/** /**

View File

@ -1,8 +1,8 @@
<template> <template>
<fieldset :class="['p-fieldset p-component', { 'p-fieldset-toggleable': toggleable }]"> <fieldset :class="['p-fieldset p-component', { 'p-fieldset-toggleable': toggleable }]" v-bind="ptm('root')">
<legend class="p-fieldset-legend"> <legend class="p-fieldset-legend" v-bind="ptm('legend')">
<slot v-if="!toggleable" name="legend"> <slot v-if="!toggleable" name="legend">
<span :id="ariaId + '_header'" class="p-fieldset-legend-text">{{ legend }}</span> <span :id="ariaId + '_header'" class="p-fieldset-legend-text" v-bind="ptm('legendtitle')">{{ legend }}</span>
</slot> </slot>
<a <a
v-if="toggleable" v-if="toggleable"
@ -15,17 +15,19 @@
:aria-label="buttonAriaLabel" :aria-label="buttonAriaLabel"
@click="toggle" @click="toggle"
@keydown="onKeyDown" @keydown="onKeyDown"
v-bind="toggleButtonProps" v-bind="{ ...toggleButtonProps, ...ptm('toggler') }"
> >
<span :class="iconClass"></span> <slot name="togglericon" :collapsed="d_collapsed">
<span :class="iconClass" v-bind="ptm('togglericon')"></span>
</slot>
<slot name="legend"> <slot name="legend">
<span class="p-fieldset-legend-text">{{ legend }}</span> <span class="p-fieldset-legend-text" v-bind="ptm('legendtitle')">{{ legend }}</span>
</slot> </slot>
</a> </a>
</legend> </legend>
<transition name="p-toggleable-content"> <transition name="p-toggleable-content">
<div v-show="!d_collapsed" :id="ariaId + '_content'" class="p-toggleable-content" role="region" :aria-labelledby="ariaId + '_header'"> <div v-show="!d_collapsed" :id="ariaId + '_content'" class="p-toggleable-content" role="region" :aria-labelledby="ariaId + '_header'" v-bind="ptm('toggleablecontent')">
<div class="p-fieldset-content"> <div class="p-fieldset-content" v-bind="ptm('content')">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
@ -34,11 +36,13 @@
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
import Ripple from 'primevue/ripple'; import Ripple from 'primevue/ripple';
import { UniqueComponentId } from 'primevue/utils'; import { UniqueComponentId } from 'primevue/utils';
export default { export default {
name: 'Fieldset', name: 'Fieldset',
extends: ComponentBase,
emits: ['update:collapsed', 'toggle'], emits: ['update:collapsed', 'toggle'],
props: { props: {
legend: String, legend: String,

View File

@ -10,6 +10,16 @@
import { ButtonHTMLAttributes, VNode } from 'vue'; import { ButtonHTMLAttributes, VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type PanelPassThroughOptionType = PanelPassThroughAttributes | ((options: PanelPassThroughMethodOptions) => PanelPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface PanelPassThroughMethodOptions {
props: PanelProps;
state: PanelState;
}
/** /**
* Custom toggle event. * Custom toggle event.
* @see {@link PanelEmits.toggle} * @see {@link PanelEmits.toggle}
@ -25,6 +35,63 @@ export interface PanelToggleEvent {
value: boolean; value: boolean;
} }
/**
* Custom passthrough(pt) options.
* @see {@link PanelProps.pt}
*/
export interface PanelPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: PanelPassThroughOptionType;
/**
* Uses to pass attributes to the header's DOM element.
*/
header?: PanelPassThroughOptionType;
/**
* Uses to pass attributes to the title's DOM element.
*/
title?: PanelPassThroughOptionType;
/**
* Uses to pass attributes to the title's DOM element.
*/
icons?: PanelPassThroughOptionType;
/**
* Uses to pass attributes to the toggler's DOM element.
*/
toggler?: PanelPassThroughOptionType;
/**
* Uses to pass attributes to the headericon's DOM element.
*/
headericon?: PanelPassThroughOptionType;
/**
* Uses to pass attributes to the toggleablecontent's DOM element.
*/
toggleablecontent?: PanelPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: PanelPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface PanelPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Panel component.
*/
export interface PanelState {
/**
* Current collapsed state as a boolean.
* @defaultValue false
*/
d_collapsed: boolean;
}
/** /**
* Defines valid properties in Panel component. * Defines valid properties in Panel component.
*/ */
@ -45,8 +112,14 @@ export interface PanelProps {
collapsed?: boolean; collapsed?: boolean;
/** /**
* Uses to pass the custom value to read for the button inside the component. * Uses to pass the custom value to read for the button inside the component.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
toggleButtonProps?: ButtonHTMLAttributes | undefined; toggleButtonProps?: ButtonHTMLAttributes | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {PanelPassThroughOptions}
*/
pt?: PanelPassThroughOptions;
} }
/** /**
@ -65,6 +138,16 @@ export interface PanelSlots {
* Custom icons template. * Custom icons template.
*/ */
icons(): VNode[]; icons(): VNode[];
/**
* Custom header icon template of panel.
* @param {Object} scope - header icon slot's params.
*/
headericon(scope: {
/**
* Collapsed state as a boolean
*/
collapsed: boolean;
}): VNode[];
} }
/** /**

View File

@ -1,10 +1,10 @@
<template> <template>
<div :class="containerClass"> <div :class="containerClass" v-bind="ptm('root')">
<div class="p-panel-header"> <div class="p-panel-header" v-bind="ptm('header')">
<slot name="header"> <slot name="header">
<span v-if="header" :id="ariaId + '_header'" class="p-panel-title">{{ header }}</span> <span v-if="header" :id="ariaId + '_header'" class="p-panel-title" v-bind="ptm('title')">{{ header }}</span>
</slot> </slot>
<div class="p-panel-icons"> <div class="p-panel-icons" v-bind="ptm('icons')">
<slot name="icons"></slot> <slot name="icons"></slot>
<button <button
v-if="toggleable" v-if="toggleable"
@ -18,15 +18,17 @@
:aria-expanded="!d_collapsed" :aria-expanded="!d_collapsed"
@click="toggle" @click="toggle"
@keydown="onKeyDown" @keydown="onKeyDown"
v-bind="toggleButtonProps" v-bind="{ ...toggleButtonProps, ...ptm('toggler') }"
> >
<span :class="{ 'pi pi-minus': !d_collapsed, 'pi pi-plus': d_collapsed }"></span> <slot name="headericon" :collapsed="d_collapsed">
<span :class="{ 'pi pi-minus': !d_collapsed, 'pi pi-plus': d_collapsed }" v-bind="ptm('headericon')"></span>
</slot>
</button> </button>
</div> </div>
</div> </div>
<transition name="p-toggleable-content"> <transition name="p-toggleable-content">
<div v-show="!d_collapsed" :id="ariaId + '_content'" class="p-toggleable-content" role="region" :aria-labelledby="ariaId + '_header'"> <div v-show="!d_collapsed" :id="ariaId + '_content'" class="p-toggleable-content" role="region" :aria-labelledby="ariaId + '_header'" v-bind="ptm('toggleablecontent')">
<div class="p-panel-content"> <div class="p-panel-content" v-bind="ptm('content')">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
@ -35,11 +37,13 @@
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
import Ripple from 'primevue/ripple'; import Ripple from 'primevue/ripple';
import { UniqueComponentId } from 'primevue/utils'; import { UniqueComponentId } from 'primevue/utils';
export default { export default {
name: 'Panel', name: 'Panel',
extends: ComponentBase,
emits: ['update:collapsed', 'toggle'], emits: ['update:collapsed', 'toggle'],
props: { props: {
header: String, header: String,

View File

@ -10,6 +10,75 @@
import { VNode } from 'vue'; import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type ScrollPanelPassThroughOptionType = ScrollPanelPassThroughAttributes | ((options: ScrollPanelPassThroughMethodOptions) => ScrollPanelPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface ScrollPanelPassThroughMethodOptions {
props: ScrollPanelProps;
state: ScrollPanelState;
}
/**
* Custom passthrough(pt) options.
* @see {@link ScrollPanelProps.pt}
*/
export interface ScrollPanelPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: ScrollPanelPassThroughOptionType;
/**
* Uses to pass attributes to the wrapper's DOM element.
*/
wrapper?: ScrollPanelPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: ScrollPanelPassThroughOptionType;
/**
* Uses to pass attributes to the horizontal panel's DOM element.
*/
barx?: ScrollPanelPassThroughOptionType;
/**
* Uses to pass attributes to the vertical panel's DOM element.
*/
bary?: ScrollPanelPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface ScrollPanelPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Panel component.
*/
export interface ScrollPanelState {
/**
* Current id state as a string.
*/
id: string;
/**
* Current scrollpanel orientation.
* @defaultValue vertical
*/
orientation: string;
/**
* Latest scroll top position.
* @defaultValue 0
*/
lastScrollTop: number;
/**
* Latest scroll left position.
* @defaultValue 0
*/
lastScrollLeft: number;
}
/** /**
* Defines valid properties in ScrollPanel component. * Defines valid properties in ScrollPanel component.
*/ */
@ -19,6 +88,11 @@ export interface ScrollPanelProps {
* @defaultValue 5 * @defaultValue 5
*/ */
step?: number | undefined; step?: number | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {ScrollPanelPassThroughOptions}
*/
pt?: ScrollPanelPassThroughOptions;
} }
/** /**

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="p-scrollpanel p-component"> <div class="p-scrollpanel p-component" v-bind="ptm('root')">
<div class="p-scrollpanel-wrapper"> <div class="p-scrollpanel-wrapper" v-bind="ptm('wrapper')">
<div ref="content" class="p-scrollpanel-content" @scroll="onScroll" @mouseenter="moveBar"> <div ref="content" class="p-scrollpanel-content" @scroll="onScroll" @mouseenter="moveBar" v-bind="ptm('content')">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
@ -17,6 +17,7 @@
@keyup="onKeyUp" @keyup="onKeyUp"
@focus="onFocus" @focus="onFocus"
@blur="onBlur" @blur="onBlur"
v-bind="ptm('barx')"
></div> ></div>
<div <div
ref="yBar" ref="yBar"
@ -29,15 +30,18 @@
@keydown="onKeyDown($event)" @keydown="onKeyDown($event)"
@keyup="onKeyUp" @keyup="onKeyUp"
@focus="onFocus" @focus="onFocus"
v-bind="ptm('bary')"
></div> ></div>
</div> </div>
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
import { DomHandler, UniqueComponentId } from 'primevue/utils'; import { DomHandler, UniqueComponentId } from 'primevue/utils';
export default { export default {
name: 'ScrollPanel', name: 'ScrollPanel',
extends: ComponentBase,
props: { props: {
step: { step: {
type: Number, type: Number,

View File

@ -10,6 +10,16 @@
import { VNode } from 'vue'; import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type SplitterPassThroughOptionType = SplitterPassThroughAttributes | ((options: SplitterPassThroughMethodOptions) => SplitterPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface SplitterPassThroughMethodOptions {
props: SplitterProps;
state: SplitterState;
}
/** /**
* Custom resize start event. * Custom resize start event.
* @see {@link SplitterEmits.resizestar} * @see {@link SplitterEmits.resizestar}
@ -40,6 +50,42 @@ export interface SplitterResizeEndEvent {
sizes: number[]; sizes: number[];
} }
/**
* Custom passthrough(pt) options.
* @see {@link SplitterProps.pt}
*/
export interface SplitterPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: SplitterPassThroughOptionType;
/**
* Uses to pass attributes to the gutter's DOM element.
*/
gutter?: SplitterPassThroughOptionType;
/**
* Uses to pass attributes to the gutter handler's DOM element.
*/
gutterhandler?: SplitterPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface SplitterPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Panel component.
*/
export interface SplitterState {
/**
* Previous size state as a number.
*/
prevSize: number;
}
/** /**
* Defines valid properties in Splitter component. * Defines valid properties in Splitter component.
*/ */
@ -68,6 +114,11 @@ export interface SplitterProps {
* @defaultValue 1 * @defaultValue 1
*/ */
step?: number | undefined; step?: number | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {SplitterPassThroughOptions}
*/
pt?: SplitterPassThroughOptions;
} }
/** /**

View File

@ -1,19 +1,31 @@
<template> <template>
<div :class="containerClass"> <div :class="containerClass" v-bind="ptm('root')">
<template v-for="(panel, i) of panels" :key="i"> <template v-for="(panel, i) of panels" :key="i">
<component :is="panel" tabindex="-1"></component> <component :is="panel" tabindex="-1"></component>
<div v-if="i !== panels.length - 1" class="p-splitter-gutter" @mousedown="onGutterMouseDown($event, i)" @touchstart="onGutterTouchStart($event, i)" @touchmove="onGutterTouchMove($event, i)" @touchend="onGutterTouchEnd($event, i)"> <div
<div class="p-splitter-gutter-handle" tabindex="0" :style="gutterStyle" role="separator" :aria-orientation="layout" :aria-valuenow="prevSize" @keyup="onGutterKeyUp" @keydown="onGutterKeyDown($event, i)"></div> v-if="i !== panels.length - 1"
class="p-splitter-gutter"
role="separator"
tabindex="-1"
@mousedown="onGutterMouseDown($event, i)"
@touchstart="onGutterTouchStart($event, i)"
@touchmove="onGutterTouchMove($event, i)"
@touchend="onGutterTouchEnd($event, i)"
v-bind="ptm('gutter')"
>
<div class="p-splitter-gutter-handle" tabindex="0" :style="gutterStyle" :aria-orientation="layout" :aria-valuenow="prevSize" @keyup="onGutterKeyUp" @keydown="onGutterKeyDown($event, i)" v-bind="ptm('gutterhandler')"></div>
</div> </div>
</template> </template>
</div> </div>
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
import { DomHandler, ObjectUtils } from 'primevue/utils'; import { DomHandler, ObjectUtils } from 'primevue/utils';
export default { export default {
name: 'Splitter', name: 'Splitter',
extends: ComponentBase,
emits: ['resizestart', 'resizeend'], emits: ['resizestart', 'resizeend'],
props: { props: {
layout: { layout: {

View File

@ -10,6 +10,33 @@
import { VNode } from 'vue'; import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type SplitterPanelPassThroughOptionType = SplitterPanelPassThroughAttributes | ((options: SplitterPanelPassThroughMethodOptions) => SplitterPanelPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface SplitterPanelPassThroughMethodOptions {
props: SplitterPanelProps;
}
/**
* Custom passthrough(pt) options.
* @see {@link PanelProps.pt}
*/
export interface SplitterPanelPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: SplitterPanelPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface SplitterPanelPassThroughAttributes {
[key: string]: any;
}
/** /**
* Defines valid properties in SplitterPanel component. * Defines valid properties in SplitterPanel component.
*/ */
@ -22,6 +49,11 @@ export interface SplitterPanelProps {
* Minimum size of the element relative to 100%. * Minimum size of the element relative to 100%.
*/ */
minSize?: number | undefined; minSize?: number | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {SplitterPanelPassThroughOptions}
*/
pt?: SplitterPanelPassThroughOptions;
} }
/** /**

View File

@ -1,12 +1,15 @@
<template> <template>
<div ref="container" :class="containerClass"> <div ref="container" :class="containerClass" v-bind="ptm('root')">
<slot></slot> <slot></slot>
</div> </div>
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
export default { export default {
name: 'SplitterPanel', name: 'SplitterPanel',
extends: ComponentBase,
props: { props: {
size: { size: {
type: Number, type: Number,

View File

@ -8,8 +8,50 @@
* *
*/ */
import { AnchorHTMLAttributes, HTMLAttributes, LiHTMLAttributes, VNode } from 'vue'; import { AnchorHTMLAttributes, HTMLAttributes, LiHTMLAttributes, VNode } from 'vue';
import { TabViewPassThroughOptions } from '../tabview';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type TabPanelPassThroughOptionType = TabPanelPassThroughAttributes | ((options: TabPanelPassThroughMethodOptions) => TabPanelPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface TabPanelPassThroughMethodOptions {
props: TabPanelProps;
parent: TabViewPassThroughOptions;
}
/**
* Custom passthrough(pt) options.
* @see {@link TabPanelProps.pt}
*/
export interface TabPanelPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: TabPanelPassThroughOptionType;
/**
* Uses to pass attributes to the header's DOM element.
*/
header?: TabPanelPassThroughOptionType;
/**
* Uses to pass attributes to the header action's DOM element.
*/
headeraction?: TabPanelPassThroughOptionType;
/**
* Uses to pass attributes to the title's DOM element.
*/
headertitle?: TabPanelPassThroughOptionType;
/**
* Uses to pass attributes to the list's DOM element.
*/
content?: TabPanelPassThroughOptionType;
}
export interface TabPanelPassThroughAttributes {
[key: string]: any;
}
/** /**
* Defines valid properties in TabPanel component. * Defines valid properties in TabPanel component.
*/ */
@ -20,30 +62,37 @@ export interface TabPanelProps {
header?: string | undefined; header?: string | undefined;
/** /**
* Inline style of the tab header. * Inline style of the tab header.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
headerStyle?: any; headerStyle?: any;
/** /**
* Style class of the tab header. * Style class of the tab header.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
headerClass?: any; headerClass?: any;
/** /**
* Uses to pass all properties of the HTMLLiElement to the tab header. * Uses to pass all properties of the HTMLLiElement to the tab header.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
headerProps?: LiHTMLAttributes | undefined; headerProps?: LiHTMLAttributes | undefined;
/** /**
* Uses to pass all properties of the HTMLAnchorElement to the focusable anchor element inside the tab header. * Uses to pass all properties of the HTMLAnchorElement to the focusable anchor element inside the tab header.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
headerActionProps?: AnchorHTMLAttributes | undefined; headerActionProps?: AnchorHTMLAttributes | undefined;
/** /**
* Inline style of the tab content. * Inline style of the tab content.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
contentStyle?: any; contentStyle?: any;
/** /**
* Style class of the tab content. * Style class of the tab content.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
contentClass?: any; contentClass?: any;
/** /**
* Uses to pass all properties of the HTMLDivElement to the tab content. * Uses to pass all properties of the HTMLDivElement to the tab content.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
contentProps?: HTMLAttributes | undefined; contentProps?: HTMLAttributes | undefined;
/** /**
@ -51,6 +100,11 @@ export interface TabPanelProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {TabPanelPassThroughOptions}
*/
pt?: TabPanelPassThroughOptions;
} }
/** /**
* Defines valid slots in TabPanel slots. * Defines valid slots in TabPanel slots.

View File

@ -3,8 +3,10 @@
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
export default { export default {
name: 'TabPanel', name: 'TabPanel',
extends: ComponentBase,
props: { props: {
header: null, header: null,
headerStyle: null, headerStyle: null,

View File

@ -10,6 +10,8 @@
import { ButtonHTMLAttributes, VNode } from 'vue'; import { ButtonHTMLAttributes, VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type TabViewPassThroughOptionType = TabViewPassThroughAttributes | ((options: { props: TabViewProps; state: TabViewState }) => TabViewPassThroughAttributes) | null | undefined;
/** /**
* Custom tab change event. * Custom tab change event.
* @see {@link TabViewEmits['tab-change']} * @see {@link TabViewEmits['tab-change']}
@ -32,6 +34,88 @@ export interface TabViewChangeEvent {
*/ */
export interface TabViewClickEvent extends TabViewChangeEvent {} export interface TabViewClickEvent extends TabViewChangeEvent {}
/**
* Custom passthrough(pt) options.
* @see {@link TabViewProps.pt}
*/
export interface TabViewPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the nav container's DOM element.
*/
navcontainer?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the nav content's DOM element.
*/
navcontent?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the list's DOM element.
*/
nav?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the list items' DOM element.
*/
tabheader?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the inkbar's DOM element.
*/
inkbar?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the previous button's DOM element.
*/
prevbutton?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the previous button icon's DOM element.
*/
previcon?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the nex button's DOM element.
*/
nextbutton?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the next button icon's DOM element.
*/
nexticon?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the panel's DOM element.
*/
panelcontainer?: TabViewPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface TabViewPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in TabView component.
*/
export interface TabViewState {
/**
* Current active index state.
*/
d_activeIndex: number;
/**
* Unique id for the TabView component.
*/
id: string;
/**
* Current state of previous button.
* @defaultValue true
*/
isPrevButtonDisabled: boolean;
/**
* Current state of the next button.
* @defaultValue false
*/
isNextButtonDisabled: boolean;
}
/** /**
* Defines valid properties in TabView component. * Defines valid properties in TabView component.
*/ */
@ -63,12 +147,19 @@ export interface TabViewProps {
selectOnFocus?: boolean | undefined; selectOnFocus?: boolean | undefined;
/** /**
* Uses to pass all properties of the HTMLButtonElement to the previous button. * Uses to pass all properties of the HTMLButtonElement to the previous button.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
previousButtonProps?: ButtonHTMLAttributes | undefined; previousButtonProps?: ButtonHTMLAttributes | undefined;
/** /**
* Uses to pass all properties of the HTMLButtonElement to the next button. * Uses to pass all properties of the HTMLButtonElement to the next button.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
nextButtonProps?: ButtonHTMLAttributes | undefined; nextButtonProps?: ButtonHTMLAttributes | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {TabViewPassThroughOptions}
*/
pt?: TabViewPassThroughOptions;
} }
/** /**
@ -79,6 +170,14 @@ export interface TabViewSlots {
* Default slot to detect TabPanel components. * Default slot to detect TabPanel components.
*/ */
default(): VNode[]; default(): VNode[];
/**
* Previous button icon template for the scrollable component.
*/
previcon(): VNode[];
/**
* Next button icon template for the scrollable component.
*/
nexticon(): VNode[];
} }
/** /**

View File

@ -1,6 +1,6 @@
<template> <template>
<div :class="contentClasses"> <div :class="contentClasses" v-bind="ptm('root')">
<div class="p-tabview-nav-container"> <div class="p-tabview-nav-container" v-bind="ptm('navcontainer')">
<button <button
v-if="scrollable && !isPrevButtonDisabled" v-if="scrollable && !isPrevButtonDisabled"
ref="prevBtn" ref="prevBtn"
@ -10,13 +10,23 @@
:tabindex="tabindex" :tabindex="tabindex"
:aria-label="prevButtonAriaLabel" :aria-label="prevButtonAriaLabel"
@click="onPrevButtonClick" @click="onPrevButtonClick"
v-bind="previousButtonProps" v-bind="{ ...previousButtonProps, ...ptm('prevbutton') }"
> >
<span class="pi pi-chevron-left" aria-hidden="true"></span> <slot name="previcon">
<span class="pi pi-chevron-left" aria-hidden="true" v-bind="ptm('previcon')"></span>
</slot>
</button> </button>
<div ref="content" class="p-tabview-nav-content" @scroll="onScroll"> <div ref="content" class="p-tabview-nav-content" @scroll="onScroll" v-bind="ptm('navcontent')">
<ul ref="nav" class="p-tabview-nav" role="tablist"> <ul ref="nav" class="p-tabview-nav" role="tablist" v-bind="ptm('nav')">
<li v-for="(tab, i) of tabs" :key="getKey(tab, i)" :style="getTabProp(tab, 'headerStyle')" :class="getTabHeaderClass(tab, i)" role="presentation" :data-index="i" v-bind="getTabProp(tab, 'headerProps')"> <li
v-for="(tab, i) of tabs"
:key="getKey(tab, i)"
:style="getTabProp(tab, 'headerStyle')"
:class="getTabHeaderClass(tab, i)"
role="presentation"
:data-index="i"
v-bind="{ ...getTabProp(tab, 'headerProps'), ...getTabPT(tab, 'root'), ...getTabPT(tab, 'header') }"
>
<a <a
:id="getTabHeaderActionId(i)" :id="getTabHeaderActionId(i)"
v-ripple v-ripple
@ -28,13 +38,13 @@
:aria-controls="getTabContentId(i)" :aria-controls="getTabContentId(i)"
@click="onTabClick($event, tab, i)" @click="onTabClick($event, tab, i)"
@keydown="onTabKeyDown($event, tab, i)" @keydown="onTabKeyDown($event, tab, i)"
v-bind="getTabProp(tab, 'headerActionProps')" v-bind="{ ...getTabProp(tab, 'headerActionProps'), ...getTabPT(tab, 'headeraction') }"
> >
<span v-if="tab.props && tab.props.header" class="p-tabview-title">{{ tab.props.header }}</span> <span v-if="tab.props && tab.props.header" class="p-tabview-title" v-bind="getTabPT(tab, 'headertitle')">{{ tab.props.header }}</span>
<component v-if="tab.children && tab.children.header" :is="tab.children.header"></component> <component v-if="tab.children && tab.children.header" :is="tab.children.header"></component>
</a> </a>
</li> </li>
<li ref="inkbar" class="p-tabview-ink-bar" role="presentation" aria-hidden="true"></li> <li ref="inkbar" class="p-tabview-ink-bar" role="presentation" aria-hidden="true" v-bind="ptm('inkbar')"></li>
</ul> </ul>
</div> </div>
<button <button
@ -46,12 +56,14 @@
:tabindex="tabindex" :tabindex="tabindex"
:aria-label="nextButtonAriaLabel" :aria-label="nextButtonAriaLabel"
@click="onNextButtonClick" @click="onNextButtonClick"
v-bind="nextButtonProps" v-bind="{ ...nextButtonProps, ...ptm('nextbutton') }"
> >
<span class="pi pi-chevron-right" aria-hidden="true"></span> <slot name="nexticon">
<span class="pi pi-chevron-right" aria-hidden="true" v-bind="ptm('nexticon')"></span>
</slot>
</button> </button>
</div> </div>
<div class="p-tabview-panels"> <div class="p-tabview-panels" v-bind="ptm('panelcontainer')">
<template v-for="(tab, i) of tabs" :key="getKey(tab, i)"> <template v-for="(tab, i) of tabs" :key="getKey(tab, i)">
<div <div
v-if="lazy ? isTabActive(i) : true" v-if="lazy ? isTabActive(i) : true"
@ -60,7 +72,7 @@
:class="getTabContentClass(tab)" :class="getTabContentClass(tab)"
role="tabpanel" role="tabpanel"
:aria-labelledby="getTabHeaderActionId(i)" :aria-labelledby="getTabHeaderActionId(i)"
v-bind="getTabProp(tab, 'contentProps')" v-bind="{ ...getTabProp(tab, 'contentProps'), ...getTabPT(tab, 'root'), ...getTabPT(tab, 'content') }"
> >
<component :is="tab"></component> <component :is="tab"></component>
</div> </div>
@ -70,11 +82,13 @@
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
import Ripple from 'primevue/ripple'; import Ripple from 'primevue/ripple';
import { DomHandler, UniqueComponentId } from 'primevue/utils'; import { DomHandler, UniqueComponentId } from 'primevue/utils';
export default { export default {
name: 'TabView', name: 'TabView',
extends: ComponentBase,
emits: ['update:activeIndex', 'tab-change', 'tab-click'], emits: ['update:activeIndex', 'tab-change', 'tab-click'],
props: { props: {
activeIndex: { activeIndex: {
@ -152,6 +166,15 @@ export default {
getTabContentId(index) { getTabContentId(index) {
return `${this.id}_${index}_content`; return `${this.id}_${index}_content`;
}, },
getTabPT(tab, key) {
return this.ptmo(this.getTabProp(tab, 'pt'), key, {
props: tab.props,
parent: {
props: this.$props,
state: this.$data
}
});
},
onScroll(event) { onScroll(event) {
this.scrollable && this.updateButtonState(); this.scrollable && this.updateButtonState();

View File

@ -10,6 +10,45 @@
import { VNode } from 'vue'; import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type ToolbarPassThroughOptionType = ToolbarPassThroughAttributes | ((options: ToolbarPassThroughMethodOptions) => ToolbarPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface ToolbarPassThroughMethodOptions {
props: ToolbarProps;
}
/**
* Custom passthrough(pt) options.
* @see {@link ToolbarProps.pt}
*/
export interface ToolbarPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: ToolbarPassThroughOptionType;
/**
* Uses to pass attributes to the groupleft's DOM element.
*/
groupleft?: ToolbarPassThroughOptionType;
/**
* Uses to pass attributes to the groupcenter's DOM element.
*/
groupcenter?: ToolbarPassThroughOptionType;
/**
* Uses to pass attributes to the groupright's DOM element.
*/
groupright?: ToolbarPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface ToolbarPassThroughAttributes {
[key: string]: any;
}
/** /**
* Defines valid properties in Toolbar component. * Defines valid properties in Toolbar component.
*/ */
@ -18,6 +57,11 @@ export interface ToolbarProps {
* Defines a string value that labels an interactive element. * Defines a string value that labels an interactive element.
*/ */
'aria-labelledby'?: string | undefined; 'aria-labelledby'?: string | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {ToolbarPassThroughOptions}
*/
pt?: ToolbarPassThroughOptions;
} }
/** /**

View File

@ -1,20 +1,22 @@
<template> <template>
<div class="p-toolbar p-component" role="toolbar" :aria-labelledby="ariaLabelledby"> <div class="p-toolbar p-component" role="toolbar" :aria-labelledby="ariaLabelledby" v-bind="ptm('root')">
<div class="p-toolbar-group-start p-toolbar-group-left"> <div class="p-toolbar-group-start p-toolbar-group-left" v-bind="ptm('groupleft')">
<slot name="start"></slot> <slot name="start"></slot>
</div> </div>
<div class="p-toolbar-group-center"> <div class="p-toolbar-group-center" v-bind="ptm('groupcenter')">
<slot name="center"></slot> <slot name="center"></slot>
</div> </div>
<div class="p-toolbar-group-end p-toolbar-group-right"> <div class="p-toolbar-group-end p-toolbar-group-right" v-bind="ptm('groupright')">
<slot name="end"></slot> <slot name="end"></slot>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
export default { export default {
name: 'Toolbar', name: 'Toolbar',
extends: ComponentBase,
props: { props: {
'aria-labelledby': { 'aria-labelledby': {
type: String, type: String,

View File

@ -17407,6 +17407,90 @@
} }
] ]
}, },
"PanelPassThroughAttributes": {
"description": "Custom passthrough attributes for each DOM elements",
"relatedProp": "",
"props": [
{
"name": "[key: string]",
"optional": false,
"readonly": false,
"type": "any"
}
],
"methods": []
},
"PanelPassThroughOptions": {
"description": "Custom passthrough(pt) options.",
"relatedProp": "PanelProps.pt",
"props": [
{
"name": "content",
"optional": true,
"readonly": false,
"type": "PanelPassThroughOptionType",
"default": "",
"description": "Uses to pass attributes to the content's DOM element."
},
{
"name": "header",
"optional": true,
"readonly": false,
"type": "PanelPassThroughOptionType",
"default": "",
"description": "Uses to pass attributes to the header's DOM element."
},
{
"name": "headericon",
"optional": true,
"readonly": false,
"type": "PanelPassThroughOptionType",
"default": "",
"description": "Uses to pass attributes to the headericon's DOM element."
},
{
"name": "icons",
"optional": true,
"readonly": false,
"type": "PanelPassThroughOptionType",
"default": "",
"description": "Uses to pass attributes to the title's DOM element."
},
{
"name": "root",
"optional": true,
"readonly": false,
"type": "PanelPassThroughOptionType",
"default": "",
"description": "Uses to pass attributes to the root's DOM element."
},
{
"name": "title",
"optional": true,
"readonly": false,
"type": "PanelPassThroughOptionType",
"default": "",
"description": "Uses to pass attributes to the title's DOM element."
},
{
"name": "toggleablecontent",
"optional": true,
"readonly": false,
"type": "PanelPassThroughOptionType",
"default": "",
"description": "Uses to pass attributes to the toggleablecontent's DOM element."
},
{
"name": "toggler",
"optional": true,
"readonly": false,
"type": "PanelPassThroughOptionType",
"default": "",
"description": "Uses to pass attributes to the toggler's DOM element."
}
],
"methods": []
},
"PanelProps": { "PanelProps": {
"description": "Defines valid properties in Panel component.", "description": "Defines valid properties in Panel component.",
"relatedProp": "", "relatedProp": "",
@ -17427,6 +17511,14 @@
"default": "", "default": "",
"description": "Header text of the panel." "description": "Header text of the panel."
}, },
{
"name": "pt",
"optional": true,
"readonly": false,
"type": "PanelPassThroughOptions",
"default": "",
"description": "Uses to pass attributes to DOM elements inside the component."
},
{ {
"name": "toggleButtonProps", "name": "toggleButtonProps",
"optional": true, "optional": true,
@ -17463,6 +17555,19 @@
"returnType": "VNode<RendererNode, RendererElement, Object>[]", "returnType": "VNode<RendererNode, RendererElement, Object>[]",
"description": "Custom header template." "description": "Custom header template."
}, },
{
"name": "headericon",
"parameters": [
{
"name": "scope",
"optional": false,
"type": "{\n \t <b>collapsed</b>: boolean, // Collapsed state as a boolean\n }",
"description": "header icon slot's params."
}
],
"returnType": "VNode<RendererNode, RendererElement, Object>[]",
"description": "Custom header icon template of panel."
},
{ {
"name": "icons", "name": "icons",
"parameters": [], "parameters": [],
@ -17471,6 +17576,21 @@
} }
] ]
}, },
"PanelState": {
"description": "Defines current inline states in Panel component.",
"relatedProp": "",
"props": [
{
"name": "d_collapsed",
"optional": false,
"readonly": false,
"type": "boolean",
"default": "",
"description": "Current collapsed state as a boolean"
}
],
"methods": []
},
"PanelToggleEvent": { "PanelToggleEvent": {
"description": "Custom toggle event.", "description": "Custom toggle event.",
"relatedProp": "PanelEmits.toggle", "relatedProp": "PanelEmits.toggle",
@ -17495,6 +17615,14 @@
"methods": [] "methods": []
} }
} }
},
"types": {
"description": "Defines the custom types used by the module.",
"values": {
"PanelPassThroughOptionType": {
"values": "PanelPassThroughAttributes | Function | null | undefined"
}
}
} }
}, },
"panelmenu": { "panelmenu": {

View File

@ -85,6 +85,7 @@ export default defineNuxtConfig({
'primevue/utils': path.resolve(__dirname, './components/lib/utils/Utils.js'), 'primevue/utils': path.resolve(__dirname, './components/lib/utils/Utils.js'),
'primevue/api': path.resolve(__dirname, './components/lib/api/Api.js'), 'primevue/api': path.resolve(__dirname, './components/lib/api/Api.js'),
'primevue/portal': path.resolve(__dirname, './components/lib/portal/Portal.vue'), 'primevue/portal': path.resolve(__dirname, './components/lib/portal/Portal.vue'),
'primevue/base': path.resolve(__dirname, './components/lib/base/ComponentBase.vue'),
'primevue/button': path.resolve(__dirname, './components/lib/button/Button.vue'), 'primevue/button': path.resolve(__dirname, './components/lib/button/Button.vue'),
'primevue/inputtext': path.resolve(__dirname, './components/lib/inputtext/InputText.vue'), 'primevue/inputtext': path.resolve(__dirname, './components/lib/inputtext/InputText.vue'),
'primevue/dialog': path.resolve(__dirname, './components/lib/dialog/Dialog.vue'), 'primevue/dialog': path.resolve(__dirname, './components/lib/dialog/Dialog.vue'),

View File

@ -23,6 +23,7 @@ export default {
'primevue/utils': path.resolve(__dirname, './components/lib/utils/Utils.js'), 'primevue/utils': path.resolve(__dirname, './components/lib/utils/Utils.js'),
'primevue/api': path.resolve(__dirname, './components/lib/api/Api.js'), 'primevue/api': path.resolve(__dirname, './components/lib/api/Api.js'),
'primevue/portal': path.resolve(__dirname, './components/lib/portal/Portal.vue'), 'primevue/portal': path.resolve(__dirname, './components/lib/portal/Portal.vue'),
'primevue/base': path.resolve(__dirname, './components/lib/base/ComponentBase.vue'),
'primevue/button': path.resolve(__dirname, './components/lib/button/Button.vue'), 'primevue/button': path.resolve(__dirname, './components/lib/button/Button.vue'),
'primevue/inputtext': path.resolve(__dirname, './components/lib/inputtext/InputText.vue'), 'primevue/inputtext': path.resolve(__dirname, './components/lib/inputtext/InputText.vue'),
'primevue/dialog': path.resolve(__dirname, './components/lib/dialog/Dialog.vue'), 'primevue/dialog': path.resolve(__dirname, './components/lib/dialog/Dialog.vue'),