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

240 lines
6.1 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
*
*/
import { InputHTMLAttributes, VNode } from 'vue';
2022-09-06 12:03:37 +00:00
import { TreeNode } from '../tree';
2023-03-01 08:51:09 +00:00
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
2022-09-06 12:03:37 +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.
2023-03-08 10:51:52 +00:00
* @defaultValue 200px
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 be disabled.
2023-03-01 08:51:09 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
disabled?: boolean | undefined;
/**
* 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
*/
2023-03-01 08:51:09 +00:00
appendTo?: 'body' | 'self' | string | 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-03-01 08:51:09 +00:00
* @defaultValue true
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-03-01 08:51:09 +00:00
* Uses 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.
*/
'aria-labelledby'?: string | undefined;
/**
2022-09-14 11:26:01 +00:00
* Establishes a string value that labels the component.
*/
2022-09-06 12:03:37 +00:00
'aria-label'?: string | undefined;
}
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
/**
* Custom indicator template.
*/
2023-03-01 08:51:09 +00:00
indicator(): 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/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
TreeSelect: GlobalComponentConstructor<TreeSelect>;
2022-09-06 12:03:37 +00:00
}
}
export default TreeSelect;