2023-03-01 12:02:31 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Tree is used to display hierarchical data.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/tree/)
|
|
|
|
*
|
|
|
|
* @module tree
|
|
|
|
*
|
|
|
|
*/
|
2023-03-07 13:40:44 +00:00
|
|
|
import { VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2024-05-09 06:35:19 +00:00
|
|
|
import { IconFieldPassThroughOptions } from '../iconfield';
|
|
|
|
import { InputIconPassThroughOptions } from '../inputicon';
|
2024-03-22 15:53:01 +00:00
|
|
|
import { InputTextPassThroughOptions } from '../inputtext';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2023-11-23 14:00:44 +00:00
|
|
|
import { TreeNode } from '../treenode';
|
2024-05-16 10:50:43 +00:00
|
|
|
import { DefineComponent, DesignToken, EmitFn, GlobalComponentConstructor, HintedString, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-12-05 07:06:55 +00:00
|
|
|
export declare type TreePassThroughOptionType<T = any> = TreePassThroughAttributes | ((options: TreePassThroughMethodOptions<T>) => TreePassThroughAttributes | string) | string | null | undefined;
|
2023-05-07 19:21:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
export interface TreePassThroughMethodOptions<T = any> {
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines instance.
|
|
|
|
*/
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
2023-05-07 19:21:37 +00:00
|
|
|
props: TreeProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-05-07 19:21:37 +00:00
|
|
|
state: TreeState;
|
2023-12-05 07:06:55 +00:00
|
|
|
/**
|
|
|
|
* Defines parent instance.
|
|
|
|
*/
|
|
|
|
parent: T;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current options.
|
|
|
|
*/
|
2023-05-07 19:25:05 +00:00
|
|
|
context: TreeContext;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
2023-05-07 19:21:37 +00:00
|
|
|
}
|
|
|
|
|
2024-03-22 15:53:01 +00:00
|
|
|
/**
|
|
|
|
* Custom shared passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface TreeSharedPassThroughMethodOptions {
|
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
|
|
|
props: TreeProps;
|
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
|
|
|
state: TreeState;
|
|
|
|
}
|
|
|
|
|
2023-03-01 12:02:31 +00:00
|
|
|
/**
|
|
|
|
* Custom expanded keys metadata.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface TreeExpandedKeys {
|
|
|
|
/**
|
|
|
|
* Optional
|
|
|
|
*/
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
2023-03-01 12:02:31 +00:00
|
|
|
/**
|
|
|
|
* Custom selection keys metadata.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface TreeSelectionKeys {
|
|
|
|
/**
|
|
|
|
* Optional
|
|
|
|
*/
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
2023-11-23 15:48:14 +00:00
|
|
|
/**
|
|
|
|
* Custom filter event.
|
2024-05-16 14:05:43 +00:00
|
|
|
* @see {@link TreeEmitsOptions.filter}
|
2023-11-23 15:48:14 +00:00
|
|
|
*/
|
|
|
|
export interface TreeFilterEvent {
|
|
|
|
/**
|
|
|
|
* Original event
|
|
|
|
*/
|
|
|
|
originalEvent: Event;
|
|
|
|
/**
|
|
|
|
* Filter value
|
|
|
|
*/
|
|
|
|
value: string;
|
|
|
|
}
|
|
|
|
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link TreeProps.pt}
|
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
export interface TreePassThroughOptions<T = any> {
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
root?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-09 06:35:19 +00:00
|
|
|
* Used to pass attributes to the IconField component.
|
|
|
|
* @see {@link IconFieldPassThroughOptions}
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2024-05-09 06:35:19 +00:00
|
|
|
pcFilterContainer?: IconFieldPassThroughOptions<TreeSharedPassThroughMethodOptions>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-09 06:35:19 +00:00
|
|
|
* Used to pass attributes to the InputText component.
|
2024-03-22 15:53:01 +00:00
|
|
|
* @see {@link InputTextPassThroughOptions}
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2024-05-09 06:35:19 +00:00
|
|
|
pcFilter?: InputTextPassThroughOptions<TreeSharedPassThroughMethodOptions>;
|
|
|
|
/**
|
|
|
|
* Used to pass attributes to the InputIcon component.
|
|
|
|
* @see {@link InputIconPassThroughOptions}
|
|
|
|
*/
|
|
|
|
pcFilterIconContainer?: InputIconPassThroughOptions<TreeSharedPassThroughMethodOptions>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the filter icon's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2024-05-03 11:46:02 +00:00
|
|
|
filterIcon?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the wrapper's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
wrapper?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the root children's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2024-05-03 11:46:02 +00:00
|
|
|
rootChildren?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the node's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
node?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the node content's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2024-05-03 11:46:02 +00:00
|
|
|
nodeContent?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the node toggle button's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2024-05-03 11:46:02 +00:00
|
|
|
nodeToggleButton?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the node toggle icon's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2024-05-03 11:46:02 +00:00
|
|
|
nodeToggleIcon?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the checkbox's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2024-01-14 13:38:51 +00:00
|
|
|
nodeCheckbox?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the node icon's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
nodeIcon?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the node label's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2024-05-03 11:46:02 +00:00
|
|
|
nodeLabel?: TreePassThroughOptionType<T>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the node children's DOM element.
|
2023-05-07 19:21:37 +00:00
|
|
|
*/
|
2024-05-03 11:46:02 +00:00
|
|
|
nodeChildren?: TreePassThroughOptionType<T>;
|
2023-06-13 14:24:45 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the mask's DOM element.
|
2023-06-13 14:24:45 +00:00
|
|
|
*/
|
2024-05-03 11:46:02 +00:00
|
|
|
mask?: TreePassThroughOptionType<T>;
|
2023-06-13 14:24:45 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the loading icon's DOM element.
|
2023-06-13 14:24:45 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
loadingIcon?: TreePassThroughOptionType<T>;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
2023-11-07 06:16:39 +00:00
|
|
|
* Used to manage all lifecycle hooks.
|
2023-07-06 11:09:01 +00:00
|
|
|
* @see {@link BaseComponent.ComponentHooks}
|
|
|
|
*/
|
|
|
|
hooks?: ComponentHooks;
|
2023-05-07 19:21:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
|
2023-05-07 19:25:05 +00:00
|
|
|
/**
|
|
|
|
* Defines current options in Tree component.
|
|
|
|
*/
|
|
|
|
export interface TreeContext {
|
2023-07-19 12:57:15 +00:00
|
|
|
/**
|
|
|
|
* Index of the node.
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-05-07 19:25:05 +00:00
|
|
|
/**
|
|
|
|
* Current expanded state of the node as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
expanded: boolean;
|
|
|
|
/**
|
|
|
|
* Current selected state of the node as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
selected: boolean;
|
|
|
|
/**
|
|
|
|
* Current checked state of the node as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
checked: boolean;
|
2023-07-19 12:57:15 +00:00
|
|
|
/**
|
|
|
|
* Current leaf state of the node as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
leaf: boolean;
|
2023-05-07 19:25:05 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 12:02:31 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in Tree component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface TreeProps {
|
|
|
|
/**
|
|
|
|
* An array of treenodes.
|
|
|
|
*/
|
|
|
|
value?: TreeNode[] | undefined;
|
|
|
|
/**
|
|
|
|
* A map of keys to represent the expansion state in controlled mode.
|
|
|
|
*/
|
|
|
|
expandedKeys?: TreeExpandedKeys;
|
|
|
|
/**
|
|
|
|
* A map of keys to control the selection state.
|
|
|
|
*/
|
|
|
|
selectionKeys?: TreeSelectionKeys;
|
|
|
|
/**
|
|
|
|
* Defines the selection mode.
|
|
|
|
*/
|
2023-03-01 12:02:31 +00:00
|
|
|
selectionMode?: 'single' | 'multiple' | 'checkbox' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Defines how multiple items can be selected, when true metaKey needs to be pressed to select or unselect an item and when set to false selection of each item can be toggled individually.
|
|
|
|
* On touch enabled devices, metaKeySelection is turned off automatically.
|
2023-12-20 10:35:18 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
metaKeySelection?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to display loading indicator.
|
2023-03-01 12:02:31 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
loading?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display when tree is loading.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'loadingicon' slot.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
loadingIcon?: string | undefined;
|
2023-11-28 08:46:39 +00:00
|
|
|
/**
|
|
|
|
* Loading mode display.
|
|
|
|
* @defaultValue mask
|
|
|
|
*/
|
|
|
|
loadingMode?: 'mask' | 'icon' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* When specified, displays an input field to filter the items.
|
2023-03-10 14:00:58 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
filter?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* When filtering is enabled, filterBy decides which field or fields (comma separated) to search against.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue label
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
filterBy?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Mode for filtering.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue lenient
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 12:02:31 +00:00
|
|
|
filterMode?: 'lenient' | 'strict' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Placeholder text to show when filter input is empty.
|
|
|
|
*/
|
|
|
|
filterPlaceholder?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Locale to use in filtering. The default locale is the host environment's current locale.
|
|
|
|
*/
|
|
|
|
filterLocale?: string | undefined;
|
2024-01-18 13:11:07 +00:00
|
|
|
/**
|
|
|
|
* Highlights automatically the first item.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
highlightOnSelect?: boolean | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Height of the scroll viewport in fixed units or the 'flex' keyword for a dynamic size.
|
|
|
|
*/
|
2024-02-23 08:38:50 +00:00
|
|
|
scrollHeight?: HintedString<'flex'> | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Defines a string value that labels an interactive element.
|
|
|
|
*/
|
2023-11-24 12:21:54 +00:00
|
|
|
ariaLabel?: string | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Identifier of the underlying menu element.
|
|
|
|
*/
|
2023-11-24 12:21:54 +00:00
|
|
|
ariaLabelledby?: string | undefined;
|
2024-04-02 08:24:31 +00:00
|
|
|
/**
|
|
|
|
* It generates scoped CSS variables using design tokens for the component.
|
|
|
|
*/
|
|
|
|
dt?: DesignToken<any>;
|
2023-05-07 19:21:37 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-05-07 19:21:37 +00:00
|
|
|
* @type {TreePassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<TreePassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-05-26 11:22:08 +00:00
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 12:02:31 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in Tree component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface TreeSlots {
|
2023-10-11 08:59:22 +00:00
|
|
|
/**
|
|
|
|
* Default content slot.
|
|
|
|
*/
|
2023-10-13 12:24:54 +00:00
|
|
|
default(scope: {
|
|
|
|
/**
|
|
|
|
* Tree node instance
|
|
|
|
*/
|
|
|
|
node: TreeNode;
|
2024-05-30 10:50:51 +00:00
|
|
|
/**
|
|
|
|
* Selection state
|
|
|
|
*/
|
|
|
|
selected: boolean;
|
2023-10-13 12:24:54 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2023-04-07 06:49:49 +00:00
|
|
|
* Custom loading icon template.
|
2023-08-17 07:16:25 +00:00
|
|
|
* @param {Object} scope - loadingicon slot's params.
|
2023-04-07 06:49:49 +00:00
|
|
|
*/
|
2023-05-26 11:22:08 +00:00
|
|
|
loadingicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2023-04-07 06:49:49 +00:00
|
|
|
/**
|
2024-05-03 11:46:02 +00:00
|
|
|
* @deprecated since v4.0. Use 'filtericon' slot instead.
|
2023-04-07 06:49:49 +00:00
|
|
|
* Custom search icon template.
|
2023-08-17 07:16:25 +00:00
|
|
|
* @param {Object} scope - searchicon slot's params.
|
2023-04-07 06:49:49 +00:00
|
|
|
*/
|
2023-05-26 11:22:08 +00:00
|
|
|
searchicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2024-05-03 11:46:02 +00:00
|
|
|
/**
|
|
|
|
* Custom search icon template.
|
|
|
|
* @param {Object} scope - filtericon slot's params.
|
|
|
|
*/
|
|
|
|
filtericon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2023-04-07 06:49:49 +00:00
|
|
|
/**
|
2024-05-27 09:24:31 +00:00
|
|
|
* @deprecated since v4.0. Use 'nodetoggleicon' slot instead.
|
|
|
|
* Custom toggle icon template.
|
|
|
|
* @param {Object} scope - toggleicon slot's params.
|
2023-03-01 12:02:31 +00:00
|
|
|
*/
|
2023-04-07 06:49:49 +00:00
|
|
|
togglericon(scope: {
|
2023-03-07 13:40:44 +00:00
|
|
|
/**
|
|
|
|
* Tree node instance
|
|
|
|
*/
|
|
|
|
node: TreeNode;
|
2023-04-07 06:49:49 +00:00
|
|
|
/**
|
|
|
|
* Expanded state of the node
|
|
|
|
*/
|
|
|
|
expanded: boolean;
|
|
|
|
}): VNode[];
|
2024-05-27 09:24:31 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0. Use 'nodetoggleicon' slot instead.
|
|
|
|
* Custom node toggle icon template.
|
|
|
|
* @param {Object} scope - toggleicon slot's params.
|
|
|
|
*/
|
|
|
|
nodetogglericon(scope: {
|
|
|
|
/**
|
|
|
|
* Tree node instance
|
|
|
|
*/
|
|
|
|
node: TreeNode;
|
|
|
|
/**
|
|
|
|
* Expanded state of the node
|
|
|
|
*/
|
|
|
|
expanded: boolean;
|
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom node toggle icon template.
|
|
|
|
* @param {Object} scope - toggleicon slot's params.
|
|
|
|
*/
|
|
|
|
nodetoggleicon(scope: {
|
|
|
|
/**
|
|
|
|
* Tree node instance
|
|
|
|
*/
|
|
|
|
node: TreeNode;
|
|
|
|
/**
|
|
|
|
* Expanded state of the node
|
|
|
|
*/
|
|
|
|
expanded: boolean;
|
|
|
|
}): VNode[];
|
2024-02-26 11:52:36 +00:00
|
|
|
/**
|
|
|
|
* Custom node icon template.
|
2024-03-15 16:56:50 +00:00
|
|
|
* @param {Object} scope - nodeicon slot's params.
|
2024-02-26 11:52:36 +00:00
|
|
|
*/
|
2024-03-13 13:12:26 +00:00
|
|
|
nodeicon(scope: {
|
2024-02-26 11:52:36 +00:00
|
|
|
/**
|
|
|
|
* Tree node instance
|
|
|
|
*/
|
|
|
|
node: TreeNode;
|
2024-03-21 09:10:04 +00:00
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
2024-02-26 11:52:36 +00:00
|
|
|
}): VNode[];
|
2023-04-07 06:49:49 +00:00
|
|
|
/**
|
|
|
|
* Custom checkbox icon
|
2023-08-17 07:16:25 +00:00
|
|
|
* @param {Object} scope - checkboxicon slot's params.
|
2023-04-07 06:49:49 +00:00
|
|
|
*/
|
|
|
|
checkboxicon(scope: {
|
|
|
|
/**
|
|
|
|
* Check state of the node
|
|
|
|
*/
|
|
|
|
checked: boolean;
|
|
|
|
/**
|
|
|
|
* Partial check state of the node
|
|
|
|
*/
|
|
|
|
partialChecked: boolean;
|
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* Optional slots.
|
|
|
|
* @todo
|
|
|
|
*/
|
|
|
|
[key: string]: (node: any) => VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 12:02:31 +00:00
|
|
|
/**
|
2023-10-11 08:59:22 +00:00
|
|
|
* Defines valid emits in Tree component.
|
2023-03-01 12:02:31 +00:00
|
|
|
*/
|
2024-05-16 14:05:43 +00:00
|
|
|
export interface TreeEmitsOptions {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the expanded keys change.
|
|
|
|
* @param {TreeNode} value - New expanded keys.
|
|
|
|
*/
|
2023-03-01 12:02:31 +00:00
|
|
|
'update:expandedKeys'(value: TreeExpandedKeys): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2022-09-14 11:26:01 +00:00
|
|
|
* Emitted when the selection keys change.
|
|
|
|
* @param {TreeSelectionKeys} value - New selection keys.
|
|
|
|
*/
|
2023-11-23 15:48:14 +00:00
|
|
|
'update:selectionKeys'(value: TreeSelectionKeys): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when a node is selected.
|
|
|
|
* @param {TreeNode} node - Node instance.
|
|
|
|
*/
|
2023-03-01 12:02:31 +00:00
|
|
|
'node-select'(node: TreeNode): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when a node is unselected.
|
|
|
|
* @param {TreeNode} node - Node instance.
|
|
|
|
*/
|
2023-03-01 12:02:31 +00:00
|
|
|
'node-unselect'(node: TreeNode): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when a node is expanded.
|
|
|
|
* @param {TreeNode} node - Node instance.
|
|
|
|
*/
|
2023-03-01 12:02:31 +00:00
|
|
|
'node-expand'(node: TreeNode): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when a node is collapsed.
|
|
|
|
* @param {TreeNode} node - Node instance.
|
|
|
|
*/
|
2023-03-01 12:02:31 +00:00
|
|
|
'node-collapse'(node: TreeNode): void;
|
2023-11-23 15:48:14 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke on filter input.
|
|
|
|
* @param {TreeFilterEvent} event - Custom filter event.
|
|
|
|
*/
|
|
|
|
'filter'(event: TreeFilterEvent): void;
|
2023-03-01 12:02:31 +00:00
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2024-05-16 10:50:43 +00:00
|
|
|
export declare type TreeEmits = EmitFn<TreeEmitsOptions>;
|
|
|
|
|
2023-03-01 12:02:31 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Tree**
|
|
|
|
*
|
|
|
|
* _Tree is used to display hierarchical data._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/tree/)
|
|
|
|
* --- ---
|
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
|
|
|
*
|
|
|
|
* @group Component
|
2024-05-16 10:50:43 +00:00
|
|
|
*
|
2023-03-01 12:02:31 +00:00
|
|
|
*/
|
2024-05-16 10:50:43 +00:00
|
|
|
declare const Tree: DefineComponent<TreeProps, TreeSlots, TreeEmits>;
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2024-03-14 22:58:11 +00:00
|
|
|
declare module 'vue' {
|
|
|
|
export interface GlobalComponents {
|
2024-05-16 10:50:43 +00:00
|
|
|
Tree: GlobalComponentConstructor<TreeProps, TreeSlots, TreeEmits>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Tree;
|