ant-design-vue/components/vc-tree/interface.tsx

90 lines
2.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import type { CSSProperties, VNode } from 'vue';
import type { TreeNodeProps } from './props';
export type { ScrollTo } from '../vc-virtual-list/List';
export interface DataNode {
checkable?: boolean;
children?: DataNode[];
disabled?: boolean;
disableCheckbox?: boolean;
icon?: IconType;
isLeaf?: boolean;
key: string | number;
title?: any;
selectable?: boolean;
switcherIcon?: IconType;
/** Set style of TreeNode. This is not recommend if you don't have any force requirement */
class?: string;
style?: CSSProperties;
slots?: Record<string, string>;
}
export interface EventDataNode extends DataNode {
expanded?: boolean;
selected?: boolean;
checked: boolean;
loaded?: boolean;
loading?: boolean;
halfChecked?: boolean;
dragOver?: boolean;
dragOverGapTop?: boolean;
dragOverGapBottom?: boolean;
pos?: string;
active?: boolean;
dataRef?: DataNode;
eventKey?: Key; // 兼容 v2 推荐直接用 key
}
export type IconType = any;
export type Key = string | number;
export type NodeElement = VNode<TreeNodeProps>;
export type DragNodeEvent = {
key: Key;
eventData: EventDataNode;
eventKey: Key;
selectHandle: HTMLSpanElement;
pos: string;
};
export interface Entity {
node: NodeElement;
index: number;
key: Key;
pos: string;
parent?: Entity;
children?: Entity[];
}
export interface DataEntity extends Omit<Entity, 'node' | 'parent' | 'children'> {
node: DataNode;
parent?: DataEntity;
children?: DataEntity[];
level: number;
}
export interface FlattenNode {
parent: FlattenNode | null;
children: FlattenNode[];
pos: string;
data: DataNode;
title: any;
key: Key;
isStart: boolean[];
isEnd: boolean[];
}
export type GetKey<RecordType> = (record: RecordType, index?: number) => Key;
export type GetCheckDisabled<RecordType> = (record: RecordType) => boolean;
export type Direction = 'ltr' | 'rtl' | undefined;
export interface FieldNames {
title?: string;
key?: string;
children?: string;
}