import type { ComponentClass, OptionsProp } from "@/types"; import type { InputProps } from "../input/props"; import type { CheckboxProps } from "../checkbox/props"; type ValueType = IsMultiple extends true ? T[] : T; export type TreeOptions = OptionsProp>; export type TreeProps = { /** Override existing theme classes completely */ override?: boolean; /** The selected item value, use v-model to make it two-way binding */ modelValue?: ValueType; /** Allows multiple selections - converts the `modelValue` into an array */ multiple?: IsMultiple; /** Tree options, unnecessary when default slot is used */ options?: TreeOptions; /** Same as native id. Also set the for label for o-field wrapper - default is an uuid. */ id?: string; /** If sub tree items are shown as a accordion */ collapsable?: boolean; // rename to Expandable /** Enables item selection */ selectable?: boolean; /** Enable a checkbox on the item element */ checkable?: boolean; /** Interaction will be disabled */ disabled?: boolean; /** Height of the tree, a scrollbar is defined if height of list exceeds this value */ scrollHeight?: string | number; /** A label which is displayed when no options are visible */ emptyLabel?: string; /** Enables client-side filtering of tree items */ filterable?: boolean; /** Disable client-side filtering and rely on parent logic */ backendFiltering?: boolean; /** Custom filter function to determine visibility */ filter?: (value: T, filterValue: string) => boolean; /** The icon to display in the filter input */ filterIcon?: string; /** Debounce delay for the filter input */ filterDebounce?: number; /** Placeholder for the filter input */ filterPlaceholder?: string; /** Accessibility label for the filter input */ ariaFilterLabel?: string; /** The chevron icon to for the toggle element before each item */ toggleIcon?: string; /** * Icon pack to use * @values mdi, fa, fas and any other custom icon pack */ iconPack?: string; /** * Icon size * @values small, medium, large */ iconSize?: string; /** Custom animation (transition name) */ animation?: string; /** Defines an accessible string value that labels an interactive element. */ ariaLabel?: string; /** Accessibility aria-labelledby to associate a label element with this component */ ariaLabelledby?: string; } & TreeClasses; // class props (will not be displayed in the docs) export type TreeClasses = Partial<{ /** Class of the root element */ rootClass: ComponentClass; /** Class of the root element when disabled */ disabledClass: ComponentClass; /** Class of the root element when selectable */ selectableClass: ComponentClass; /** Class of the root element when multiple */ multipleClass: ComponentClass; /** Class of the header slot wrapper element */ headerClass: ComponentClass; /** Class of the footer slot wrapper element */ footerClass: ComponentClass; /** Class of the empty slot wrapper element */ emptyClass: ComponentClass; /** Class of the filter wrapper element */ filterClass: ComponentClass; /** Class of the root element when filterable */ filterableClass: ComponentClass; /** Class of the tree list element */ listClass: ComponentClass; /** * Class configuration for the internal input component * @ignore */ inputAttrs: InputProps; }>; export type TreeItemProps = { /** Override existing theme classes completely */ override?: boolean; /** * Item value (it will be used as the v-model of the wrapper component) - default is an uuid * @type string|number|object */ value?: T; /** Subtree options, unnecessary when default slot is used */ options?: TreeOptions; /** Tree item label */ label?: string; // TODO: make required /** Override item selectable state */ selectable?: boolean; /** Tree item will be expanded */ expanded?: boolean; /** Item will be disabled */ disabled?: boolean; /** Define whether the item is visible or not */ hidden?: boolean; /** HTML element Id of the sub tree ol list element */ subtreeId?: string; /** Icon to be shown */ icon?: string; /** * Icon pack to use * @values mdi, fa, fas and any other custom icon pack */ iconPack?: string; /** * Icon size * @values small, medium, large */ iconSize?: string; /** Transition name to apply on tree list */ animation?: string; /** Defines an accessible string value that labels an interactive element. */ ariaLabel?: string; /** Accessibility aria-labelledby to associate a label element with this component */ ariaLabelledby?: string; } & TreeItemClasses; // class props (will not be displayed in the docs) export type TreeItemClasses = Partial<{ /** Class of the tree item root element */ itemClass: ComponentClass; /** Class of the item element when selectable */ itemSelectableClass: ComponentClass; /** Class of the tree item root element when selected */ itemSelectedClass: ComponentClass; /** Class of the tree item root element when focused */ itemFocusedClass: ComponentClass; /** Class of the tree item root element when disabled */ itemDisabledClass: ComponentClass; /** Class of the tree item toggle icon element */ itemToggleIconClass: ComponentClass; /** Class of the tree item icon element */ itemIconClass: ComponentClass; /** Class of the tree item label element element */ itemLabelClass: ComponentClass; /** Class for the HTML checkbox element when checkable */ checkboxClass: ComponentClass; /** Class of a subtree element of a tree item */ subtreeClass: ComponentClass; /** * Class configuration for the internal checkbox component * @ignore */ checkboxAttrs: CheckboxProps; }>;