primevue-mirror/components/lib/treeselect/TreeSelect.d.ts

463 lines
12 KiB
TypeScript
Raw Normal View History

2023-03-01 08:51:09 +00:00
/**
*
* TreeSelect is a form component to choose from hierarchical data.
*
* [Live Demo](https://www.primevue.org/treeselect/)
*
* @module treeselect
*
*/
2023-08-02 14:07:22 +00:00
import { InputHTMLAttributes, TransitionProps, VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
2024-04-08 12:21:07 +00:00
import { ChipPassThroughOptions } from '../chip';
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough';
2023-12-05 09:41:04 +00:00
import { TreeExpandedKeys, TreePassThroughOptions } from '../tree';
2023-11-23 14:00:44 +00:00
import { TreeNode } from '../treenode';
import { ClassComponent, DesignToken, GlobalComponentConstructor, HintedString, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type TreeSelectPassThroughOptionType = TreeSelectPassThroughAttributes | ((options: TreeSelectPassThroughMethodOptions) => TreeSelectPassThroughAttributes | string) | string | null | undefined;
2023-05-07 19:51:06 +00:00
2023-08-02 14:07:22 +00:00
export declare type TreeSelectPassThroughTransitionType = TransitionProps | ((options: TreeSelectPassThroughMethodOptions) => TransitionProps) | undefined;
2023-05-07 19:51:06 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface TreeSelectPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-05-07 19:51:06 +00:00
props: TreeSelectProps;
/**
* Defines current inline state.
*/
2023-05-07 19:51:06 +00:00
state: TreeSelectState;
/**
* Defines valid attributes.
*/
attrs: any;
/**
* Defines parent options.
*/
parent: any;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-05-07 19:51:06 +00:00
}
/**
* Custom shared passthrough(pt) option method.
*/
export interface TreeSelectSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: TreeSelectProps;
/**
* Defines current inline state.
*/
state: TreeSelectState;
}
2023-05-07 19:51:06 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link TreeSelectProps.pt}
*/
export interface TreeSelectPassThroughOptions {
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the roots DOM element.
2023-05-07 19:51:06 +00:00
*/
root?: TreeSelectPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the label containers DOM element.
2023-05-07 19:51:06 +00:00
*/
labelContainer?: TreeSelectPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the labels DOM element.
2023-05-07 19:51:06 +00:00
*/
label?: TreeSelectPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the chips DOM element.
2023-05-07 19:51:06 +00:00
*/
2024-05-15 07:35:36 +00:00
chipItem?: TreeSelectPassThroughOptionType;
2023-05-07 19:51:06 +00:00
/**
2024-04-08 12:21:07 +00:00
* Used to pass attributes to the Chip.
* @see {@link ChipPassThroughOptions}
2023-05-07 19:51:06 +00:00
*/
2024-05-15 07:35:36 +00:00
pcChip?: ChipPassThroughOptions<TreeSelectSharedPassThroughMethodOptions>;
2023-05-07 19:51:06 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the dropdowns DOM element.
2023-05-07 19:51:06 +00:00
*/
dropdown?: TreeSelectPassThroughOptionType;
2023-05-07 19:51:06 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the dropdown icons DOM element.
2023-05-07 19:51:06 +00:00
*/
dropdownIcon?: TreeSelectPassThroughOptionType;
2023-05-07 19:51:06 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the panels DOM element.
2023-05-07 19:51:06 +00:00
*/
panel?: TreeSelectPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the tree containers DOM element.
2023-05-07 19:51:06 +00:00
*/
2024-05-06 13:10:13 +00:00
treeContainer?: TreeSelectPassThroughOptionType;
2023-05-07 19:51:06 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to Tree component.
2023-12-05 09:41:04 +00:00
* @see {@link TreePassThroughOptions}
2023-05-07 19:51:06 +00:00
*/
2024-05-06 15:23:01 +00:00
pcTree?: TreePassThroughOptions<TreeSelectSharedPassThroughMethodOptions>;
2023-05-07 19:51:06 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the empty messages DOM element.
2023-05-07 19:51:06 +00:00
*/
emptyMessage?: TreeSelectPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the hidden input containers DOM element.
2023-05-07 19:51:06 +00:00
*/
2024-05-06 15:32:04 +00:00
hiddenInputContainer?: TreeSelectPassThroughOptionType;
2023-05-07 19:51:06 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the hidden inputs DOM element.
2023-05-07 19:51:06 +00:00
*/
hiddenInput?: TreeSelectPassThroughOptionType;
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-08-02 12:03:08 +00:00
/**
* Used to control Vue Transition API.
*/
2023-08-02 14:07:22 +00:00
transition?: TreeSelectPassThroughTransitionType;
2023-05-07 19:51:06 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface TreeSelectPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in TreeSelect component.
*/
export interface TreeSelectState {
/**
2023-05-08 07:13:02 +00:00
* Current focused state as a boolean.
2023-05-07 19:51:06 +00:00
* @defaultValue false
*/
2023-05-08 07:13:02 +00:00
focused: boolean;
/**
* Current overlay visible state as a boolean.
* @defaultValue false
*/
overlayVisible: boolean;
/**
* Current expanded keys state.
*/
expandedKeys: TreeExpandedKeys;
2023-05-07 19:51:06 +00:00
}
2023-03-01 08:51:09 +00:00
/**
* Defines valid properties in TreeSelect component.
*/
2022-09-06 12:03:37 +00:00
export interface TreeSelectProps {
/**
* Value of the component.
*/
modelValue?: TreeNode | any;
/**
* An array of treenodes.
*/
options?: TreeNode[] | undefined;
/**
* Height of the viewport, a scrollbar is defined if height of list exceeds this value.
2024-03-26 14:21:39 +00:00
* @defaultValue 14rem
2022-09-06 12:03:37 +00:00
*/
scrollHeight?: string | undefined;
/**
* Label to display when there are no selections.
*/
placeholder?: string | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
2022-09-06 12:03:37 +00:00
/**
* When present, it specifies that the component should be disabled.
2023-03-01 08:51:09 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
disabled?: boolean | undefined;
2024-01-31 08:02:53 +00:00
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Index of the element in tabbing order.
*/
tabindex?: string | undefined;
/**
* Defines the selection mode.
*/
2023-03-01 08:51:09 +00:00
selectionMode?: 'single' | 'multiple' | 'checkbox' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Style class of the overlay panel.
*/
panelClass?: any;
/**
2023-03-01 08:51:09 +00:00
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
2023-03-08 10:51:52 +00:00
* @defaultValue body
2022-09-06 12:03:37 +00:00
*/
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
2022-09-06 12:03:37 +00:00
/**
* Text to display when there are no options available. Defaults to value from PrimeVue locale configuration.
2023-03-08 10:51:52 +00:00
* @defaultValue No results found
2022-09-06 12:03:37 +00:00
*/
emptyMessage?: string | undefined;
/**
* Defines how the selected items are displayed.
2023-03-08 10:51:52 +00:00
* @defaultValue comma
2022-09-06 12:03:37 +00:00
*/
2023-03-01 08:51:09 +00:00
display?: 'comma' | 'chip' | 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;
/**
* Identifier of the underlying input element.
*/
inputId?: string | undefined;
/**
* Style class of the input field.
*/
inputClass?: string | object | undefined;
2022-09-06 12:03:37 +00:00
/**
* Inline style of the input field.
*/
inputStyle?: object | undefined;
2022-09-06 12:03:37 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLInputElement to the focusable input element inside the component.
2022-09-06 12:03:37 +00:00
*/
2023-03-01 08:51:09 +00:00
inputProps?: InputHTMLAttributes | undefined;
2022-09-06 12:03:37 +00:00
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
*/
2023-11-24 12:21:54 +00:00
ariaLabelledby?: string | undefined;
2022-09-06 12:03:37 +00:00
/**
2022-09-14 11:26:01 +00:00
* Establishes a string value that labels the component.
*/
2023-11-24 12:21:54 +00:00
ariaLabel?: string | undefined;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
2023-05-07 19:51:06 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-05-07 19:51:06 +00:00
* @type {TreeSelectPassThroughOptions}
*/
pt?: PassThrough<TreeSelectPassThroughOptions>;
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:58:40 +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 08:51:09 +00:00
/**
* Defines valid slots in TreeSelect component.
*/
2022-09-06 12:03:37 +00:00
export interface TreeSelectSlots {
/**
* Custom value template.
* @param {Object} scope - value slot's params.
*/
2023-03-01 08:51:09 +00:00
value(scope: {
2022-09-06 12:03:37 +00:00
/**
* Selected value
*/
value: TreeNode | any;
/**
* Placeholder
*/
placeholder: string;
2023-03-01 08:51:09 +00:00
}): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom header template.
* @param {Object} scope - header slot's params.
*/
2023-03-01 08:51:09 +00:00
header(scope: {
2022-09-06 12:03:37 +00:00
/**
* Selected value
*/
value: TreeNode | any;
/**
* An array of treenodes.
*/
options: TreeNode[];
2023-03-01 08:51:09 +00:00
}): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom footer template.
* @param {Object} scope - footer slot's params.
*/
2023-03-01 08:51:09 +00:00
footer(scope: {
2022-09-06 12:03:37 +00:00
/**
* Selected value
*/
value: TreeNode | any;
/**
* An array of treenodes.
*/
options: TreeNode[];
2023-03-01 08:51:09 +00:00
}): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom empty template.
*/
2023-03-01 08:51:09 +00:00
empty(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* @deprecated since v4.0. use 'dropdownicon' slot instead.
2022-09-06 12:03:37 +00:00
* Custom indicator template.
* @param {Object} scope - dropdownicon slot's params.
2022-09-06 12:03:37 +00:00
*/
triggericon(scope: {
/**
* Style class of the icon.
*/
class: string;
}): VNode[];
/**
* Custom indicator template.
* @param {Object} scope - dropdownicon slot's params.
*/
dropdownicon(scope: {
2023-05-26 11:58:40 +00:00
/**
* Style class of the icon.
*/
class: string;
}): VNode[];
/**
* Custom item toggler icon template.
* @param {Object} scope - item toggler icon slot's params.
*/
itemtogglericon(scope: {
/**
* Node instance
*/
node: TreeNode | any;
/**
* Expanded state of the node
*/
expanded: TreeNode[];
}): VNode[];
/**
* Custom item checkbox icon template.
* @param {Object} scope - item checkbox icon slot's params.
*/
itemcheckboxicon(scope: {
/**
* Check state of the node
*/
checked: boolean;
/**
* Partial check state of the node
*/
partialChecked: boolean;
}): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 08:51:09 +00:00
/**
* Defines valid emits in TreeSelect component.
*/
export interface TreeSelectEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the value changes.
* @param {*} value - New value.
*/
2023-03-01 08:51:09 +00:00
'update:modelValue'(value: any): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke on value change.
* @param {*} value - Selected node keys
*/
2023-03-01 08:51:09 +00:00
change(value: string[]): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke before the overlay is shown.
*/
2023-03-01 08:51:09 +00:00
'before-show'(): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke before the overlay is hidden.
*/
2023-03-01 08:51:09 +00:00
'before-hide'(): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when the overlay is shown.
*/
2023-03-01 08:51:09 +00:00
show(): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when the overlay is hidden.
*/
2023-03-01 08:51:09 +00:00
hide(): 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 08:51:09 +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 08:51:09 +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 08:51:09 +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 08:51:09 +00:00
'node-collapse'(node: TreeNode): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 08:51:09 +00:00
/**
* **PrimeVue - TreeSelect**
*
* _TreeSelect is a form component to choose from hierarchical data._
*
* [Live Demo](https://www.primevue.org/treeselect/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*/
2023-03-01 14:48:23 +00:00
declare class TreeSelect extends ClassComponent<TreeSelectProps, TreeSelectSlots, TreeSelectEmits> {
2022-09-06 12:03:37 +00:00
/**
* Shows the overlay.
*
* @memberof TreeSelect
*/
show: () => void;
/**
* Hides the overlay.
*
* @memberof TreeSelect
*/
hide: () => void;
}
declare module 'vue' {
export interface GlobalComponents {
2022-09-14 11:26:01 +00:00
TreeSelect: GlobalComponentConstructor<TreeSelect>;
2022-09-06 12:03:37 +00:00
}
}
export default TreeSelect;