import { ITreeProps } from './composable'; import { CSSProperties, VNode } from 'vue'; import { TCdsIconsName } from '@central-design-system/icons'; export declare namespace NTree { type TKey = string | number; type TNodeElement = VNode; type TGetCheckDisabled = (record: RecordType) => boolean; type TExpandAction = false | 'click' | 'doubleclick' | 'dblclick'; type TDraggableFn = (node: IDataNode) => boolean; type TAllowDrop = (options: IAllowDropOptions) => boolean; type TEventHandler = (...args: any[]) => void; type TDragNodeEvent = { key: TKey; eventData: IEventDataNode; eventKey: TKey; selectHandle: HTMLSpanElement; pos: string; }; type TNodeMouseEventHandler = (event: MouseEvent, node: IEventDataNode) => void; type TNodeMouseEventParams = { event: MouseEvent; node: IEventDataNode; }; type TNodeDragEventParams = { event: DragEvent; node: IEventDataNode; }; type TNodeDragEventHandler = (event: DragEvent, node: TDragNodeEvent | null, outsideTree?: boolean) => void; type TIconType = any; type DraggableFn = (node: IDataNode) => boolean; type TDraggableConfig = { icon?: TCdsIconsName | boolean; nodeDraggable?: DraggableFn; }; interface IBasicDataNode { checkable?: boolean; selectable?: boolean; disabled?: boolean; disableCheckbox?: boolean; icon?: any; isLeaf?: boolean; switcherIcon?: TIconType; /** Set style of TreeNode. This is not recommend if you don't have any force requirement */ class?: string; style?: CSSProperties; slots?: Record; [key: string]: any; } interface IDataNode extends IBasicDataNode { children?: IDataNode[]; key?: string | number; title?: any; } interface IEntity { node: TNodeElement; index?: number; key: TKey; pos: string; parent?: IEntity; children?: IEntity[]; } interface IEventDataNode extends IDataNode { expanded?: boolean; selected?: boolean; checked: boolean; loaded?: boolean; loading?: boolean; halfChecked?: boolean; dragOver?: boolean; dragOverGapTop?: boolean; dragOverGapBottom?: boolean; pos?: string; active?: boolean; dataRef?: IDataNode; parent?: IDataNode; eventKey?: TKey; } interface IDataEntity extends Omit { node: TreeDataType; nodes: TreeDataType[]; parent?: IDataEntity; children?: IDataEntity[]; level?: number; } interface IFieldNames { title?: string; /** @private Internal usage, safe to remove if no need */ _title?: string[]; key?: string; children?: string; } interface IAllowDropOptions { dragNode: IEventDataNode; dropNode: TreeDataType; dropPosition: -1 | 0 | 1; } interface ICheckInfo { event: 'check'; node: IEventDataNode; checked: boolean; nativeEvent: MouseEvent; checkedNodes: IDataNode[]; checkedNodesPositions?: { node: IDataNode; pos: string; }[]; halfCheckedKeys?: TKey[]; } interface IFlattenNode { parent: IFlattenNode | null; children: IFlattenNode[] | null; pos: string; data: IDataNode; title: any; key: TKey; isStart: boolean[]; isEnd: boolean[]; } interface ITreeNodeRequiredProps { expandedKeysSet: Set; selectedKeysSet: Set; loadedKeysSet: Set; loadingKeysSet: Set; checkedKeysSet: Set; halfCheckedKeysSet: Set; dragOverNodeKey: TKey | null; dropPosition: number | null; keyEntities: Record>; } interface IDragState { draggingNodeKey: TKey | null; dragChildrenKeys: TKey[]; dropTargetKey: TKey | null; dropPosition: IAllowDropOptions['dropPosition'] | null; dropContainerKey: TKey | null; dropLevelOffset: number | null; dropTargetPos: string | null; dropAllowed: boolean; dragOverNodeKey: TKey | null; } interface ITreeNodeAttribute { eventKey: string; prefixCls: string; class: string; expanded: boolean; selected: boolean; checked: boolean; halfChecked: boolean; children: any; title: any; pos: string; dragOver: boolean; dragOverGapTop: boolean; dragOverGapBottom: boolean; isLeaf: boolean; selectable: boolean; disabled: boolean; disableCheckbox: boolean; } }