tdesign-vue
Version:
106 lines (105 loc) • 3.87 kB
TypeScript
import { InputProps } from '../input';
import { PopupProps } from '../popup';
import { SelectInputProps, SelectInputBlurContext, SelectInputValueChangeContext } from '../select-input';
import { TagProps } from '../tag';
import { TreeProps, TreeNodeModel } from '../tree';
import { PopupTriggerEvent, PopupTriggerSource } from '../popup';
import { TNode, TreeOptionData, TreeKeysType } from '../common';
export interface TdTreeSelectProps<DataOption extends TreeOptionData = TreeOptionData, TreeValueType extends TreeSelectValue = TreeSelectValue> {
autoWidth?: boolean;
autofocus?: boolean;
borderless?: boolean;
clearable?: boolean;
collapsedItems?: TNode<{
value: DataOption[];
collapsedSelectedItems: DataOption[];
count: number;
onClose: (context: {
index: number;
e?: MouseEvent;
}) => void;
}>;
data?: Array<DataOption>;
disabled?: boolean;
empty?: string | TNode;
filter?: (filterWords: string, option: DataOption) => boolean;
filterable?: boolean;
inputProps?: InputProps;
inputValue?: string;
defaultInputValue?: string;
keys?: TreeKeysType;
label?: string | TNode;
loading?: boolean;
loadingText?: string | TNode;
max?: number;
minCollapsedNum?: number;
multiple?: boolean;
panelBottomContent?: string | TNode;
panelTopContent?: string | TNode;
placeholder?: string;
popupProps?: PopupProps;
popupVisible?: boolean;
defaultPopupVisible?: boolean;
prefixIcon?: TNode;
readonly?: boolean;
reserveKeyword?: boolean;
selectInputProps?: SelectInputProps;
size?: 'small' | 'medium' | 'large';
status?: 'default' | 'success' | 'warning' | 'error';
suffix?: string | TNode;
suffixIcon?: TNode;
tagProps?: TagProps;
tips?: string | TNode;
treeProps?: TreeProps;
value?: TreeValueType;
defaultValue?: TreeValueType;
valueDisplay?: string | TNode<{
value: TreeOptionData | TreeOptionData[];
onClose: (index: number) => void;
}>;
valueType?: 'value' | 'object';
onBlur?: (context: SelectInputBlurContext & {
value: TreeSelectValue;
}) => void;
onChange?: (value: TreeValueType, context: TreeSelectChangeContext<DataOption>) => void;
onClear?: (context: {
e: MouseEvent;
}) => void;
onEnter?: (context: {
inputValue: string;
e: KeyboardEvent;
value: TreeValueType;
}) => void;
onFocus?: (context: {
value: TreeSelectValue;
e: FocusEvent;
}) => void;
onInputChange?: (value: string, context: SelectInputValueChangeContext) => void;
onPopupVisibleChange?: (visible: boolean, context: TreeSelectPopupVisibleContext<DataOption>) => void;
onRemove?: (options: RemoveOptions<DataOption, TreeValueType>) => void;
onSearch?: (filterWords: string, context: {
e: KeyboardEvent | SelectInputValueChangeContext['e'];
}) => void;
}
export declare type TreeSelectValue = string | number | TreeOptionData | Array<string | number | TreeOptionData>;
export interface TreeSelectChangeContext<DataOption> {
node: TreeNodeModel<DataOption>;
data: DataOption;
index?: number;
trigger: TreeSelectValueChangeTrigger;
e?: MouseEvent | KeyboardEvent | Event;
}
export declare type TreeSelectValueChangeTrigger = 'clear' | 'tag-remove' | 'backspace' | 'check' | 'uncheck';
export interface TreeSelectPopupVisibleContext<T> {
e?: PopupTriggerEvent | Event;
node?: TreeNodeModel<T>;
trigger?: PopupTriggerSource | 'clear';
}
export interface RemoveOptions<T extends TreeOptionData = TreeOptionData, N extends TreeSelectValue = TreeSelectValue> {
value: N;
data: T;
index: number;
node: TreeNodeModel<T>;
e?: MouseEvent | KeyboardEvent;
trigger: 'tag-remove' | 'backspace';
}