primevue-mirror/packages/primevue/scripts/components/tree.js

176 lines
4.8 KiB
JavaScript
Raw Normal View History

const TreeProps = [
{
2022-09-14 14:26:41 +00:00
name: 'value',
type: 'any',
default: 'null',
description: 'An array of treenodes.'
},
{
2022-09-14 14:26:41 +00:00
name: 'expandedKeys',
type: 'array',
default: 'null',
description: 'A map of keys to represent the expansion state in controlled mode.'
},
{
2022-09-14 14:26:41 +00:00
name: 'selectionMode',
type: 'string',
default: 'null',
description: 'Defines the selection mode, valid values "single", "multiple", and "checkbox".'
},
{
2022-09-14 14:26:41 +00:00
name: 'selectionKeys',
type: 'any',
default: 'null',
description: 'A map of keys to control the selection state.'
},
{
2022-09-14 14:26:41 +00:00
name: 'metaKeySelection',
type: 'boolean',
default: 'true',
description:
'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.'
},
{
2022-09-14 14:26:41 +00:00
name: 'loading',
type: 'boolean',
default: 'false',
description: 'Whether to display loading indicator.'
},
{
2022-09-14 14:26:41 +00:00
name: 'loadingIcon',
type: 'string',
default: 'pi pi-spin',
description: 'Icon to display when tree is loading.'
},
{
2022-09-14 14:26:41 +00:00
name: 'filter',
type: 'boolean',
default: 'false',
description: 'When specified, displays an input field to filter the items.'
},
{
2022-09-14 14:26:41 +00:00
name: 'filterBy',
2024-09-09 20:56:48 +00:00
type: 'string | ((node: TreeNode) => string)',
2022-09-14 14:26:41 +00:00
default: 'label',
2024-09-09 20:56:48 +00:00
description: 'When filtering is enabled, filterBy decides which field or fields (comma separated) to search against. A callable taking a TreeNode can be provided instead of a list of field names.'
},
{
2022-09-14 14:26:41 +00:00
name: 'filterMode',
type: 'string',
default: 'lenient',
description: 'Mode for filtering valid values are "lenient" and "strict". Default is lenient.'
},
{
2022-09-14 14:26:41 +00:00
name: 'filterPlaceholder',
type: 'string',
default: 'null',
description: 'Placeholder text to show when filter input is empty.'
},
{
2022-09-14 14:26:41 +00:00
name: 'filterLocale',
type: 'string',
default: 'undefined',
description: "Locale to use in filtering. The default locale is the host environment's current locale."
},
2024-01-18 13:11:07 +00:00
{
name: 'highlightOnSelect',
type: 'boolean',
default: 'false',
description: 'Highlights automatically the first item.'
},
{
2022-09-14 14:26:41 +00:00
name: 'scrollHeight',
type: 'string',
default: 'null',
description: 'Height of the scroll viewport in fixed units or the "flex" keyword for a dynamic size.'
2023-05-07 19:21:37 +00:00
},
{
name: 'pt',
type: 'any',
default: 'null',
2023-08-01 14:01:12 +00:00
description: 'Used to pass attributes to DOM elements inside the component.'
2023-07-06 13:20:37 +00:00
},
{
name: 'unstyled',
type: 'boolean',
default: 'false',
description: 'When enabled, it removes component related styles in the core.'
}
];
const TreeEvents = [
{
2022-09-14 14:26:41 +00:00
name: 'node-select',
description: 'Callback to invoke when a node is selected.',
arguments: [
{
2022-09-14 14:26:41 +00:00
name: 'node',
type: 'object',
description: 'Node instance'
}
]
},
{
2022-09-14 14:26:41 +00:00
name: 'node-unselect',
description: 'Callback to invoke when a node is unselected.',
arguments: [
{
2022-09-14 14:26:41 +00:00
name: 'node',
type: 'object',
description: 'Node instance'
}
]
},
{
2022-09-14 14:26:41 +00:00
name: 'node-expand',
description: 'Callback to invoke when a node is expanded.',
arguments: [
{
2022-09-14 14:26:41 +00:00
name: 'node',
type: 'object',
description: 'Node instance'
}
]
},
{
2022-09-14 14:26:41 +00:00
name: 'node-collapse',
description: 'Callback to invoke when a node is collapsed.',
arguments: [
{
2022-09-14 14:26:41 +00:00
name: 'node',
type: 'object',
description: 'Node instance'
}
]
}
];
const TreeSlots = [
{
name: 'loadingicon',
description: 'Custom loading icon template.'
},
{
name: 'searchicon',
description: 'Custom search icon template.'
},
{
2024-05-27 09:24:31 +00:00
name: 'toggleicon',
description: 'Custom toggler icon template.'
},
{
name: 'checkboxicon',
description: 'Custom checkbox icon template.'
}
];
module.exports = {
tree: {
2022-09-14 14:26:41 +00:00
name: 'Tree',
description: 'Tree is used to display hierarchical data.',
props: TreeProps,
events: TreeEvents,
slots: TreeSlots
}
};