diff --git a/api-generator/components/tree.js b/api-generator/components/tree.js index 433d4f39b..ddb7ddf4f 100644 --- a/api-generator/components/tree.js +++ b/api-generator/components/tree.js @@ -77,6 +77,12 @@ const TreeProps = [ type: 'string', default: 'null', description: 'Height of the scroll viewport in fixed units or the "flex" keyword for a dynamic size.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/config/PrimeVue.d.ts b/components/lib/config/PrimeVue.d.ts index f5ca10192..4d487458d 100644 --- a/components/lib/config/PrimeVue.d.ts +++ b/components/lib/config/PrimeVue.d.ts @@ -63,6 +63,7 @@ import { TextareaPassThroughOptions } from '../textarea'; import { TieredMenuPassThroughOptions } from '../tieredmenu'; import { ToastPassThroughOptions } from '../toast'; import { ToolbarPassThroughOptions } from '../toolbar'; +import { TreePassThroughOptions } from '../tree'; import { VirtualScrollerPassThroughOptions } from '../virtualscroller'; interface PrimeVueConfiguration { @@ -148,6 +149,7 @@ interface PrimeVuePTOptions { tieredmenu?: TieredMenuPassThroughOptions; toast?: ToastPassThroughOptions; toolbar?: ToolbarPassThroughOptions; + tree?: TreePassThroughOptions; virtualscroller?: VirtualScrollerPassThroughOptions; } diff --git a/components/lib/tree/Tree.d.ts b/components/lib/tree/Tree.d.ts index 621d1b6a1..e3ecda194 100755 --- a/components/lib/tree/Tree.d.ts +++ b/components/lib/tree/Tree.d.ts @@ -10,6 +10,16 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type TreePassThroughOptionType = TreePassThroughAttributes | ((options: TreePassThroughMethodOptions) => TreePassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface TreePassThroughMethodOptions { + props: TreeProps; + state: TreeState; +} + /** * Custom TreeNode metadata. */ @@ -90,6 +100,106 @@ export interface TreeSelectionKeys { [key: string]: any; } +/** + * Custom passthrough(pt) options. + * @see {@link TreeProps.pt} + */ +export interface TreePassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the loading overlay's DOM element. + */ + loadingOverlay?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the loading icon's DOM element. + */ + loadingIcon?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the filter container's DOM element. + */ + filterContainer?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the input's DOM element. + */ + input?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the search icon's DOM element. + */ + searchIcon?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the wrapper's DOM element. + */ + wrapper?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the container's DOM element. + */ + container?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the node's DOM element. + */ + node?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the content's DOM element. + */ + content?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the toggler's DOM element. + */ + toggler?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the toggler icon's DOM element. + */ + togglerIcon?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the checkbox container's DOM element. + */ + checkboxContainer?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the checkbox's DOM element. + */ + checkbox?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the checkbox icon's DOM element. + */ + checkboxIcon?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the node icon's DOM element. + */ + nodeIcon?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the label's DOM element. + */ + label?: TreePassThroughOptionType; + /** + * Uses to pass attributes to the subgroup's DOM element. + */ + subgroup?: TreePassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface TreePassThroughAttributes { + [key: string]: any; +} + +/** + * Defines current inline state in Tree component. + */ +export interface TreeState { + /** + * Current expanded keys state. + */ + d_expandedKeys: TreeExpandedKeys; + /** + * Current filter value state as a string. + */ + filterValue: string; +} + /** * Defines valid properties in Tree component. */ @@ -161,6 +271,11 @@ export interface TreeProps { * Identifier of the underlying menu element. */ 'aria-labelledby'?: string | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {TreePassThroughOptions} + */ + pt?: TreePassThroughOptions; } /** diff --git a/components/lib/tree/Tree.vue b/components/lib/tree/Tree.vue index 3ffebfb9c..2e38a789a 100755 --- a/components/lib/tree/Tree.vue +++ b/components/lib/tree/Tree.vue @@ -1,21 +1,21 @@