vben
2021-11-10 3fcfac1f37c2aeabbb2af4897ada6ba8c225c667
提交 | 用户 | age
d8ff30 1 import type { TreeDataItem, CheckEvent as CheckEventOrigin } from 'ant-design-vue/es/tree/Tree';
3fcfac 2
adff78 3 import { ContextMenuItem } from '/@/hooks/web/useContextMenu';
3fcfac 4
2f6253 5 export interface ActionItem {
8b62fa 6   render: (record: Recordable) => any;
V 7   show?: boolean | ((record: Recordable) => boolean);
2f6253 8 }
9
72b42d 10 export interface TreeItem extends TreeDataItem {
2f6253 11   icon?: any;
12 }
13
14 export interface ReplaceFields {
15   children?: string;
16   title?: string;
17   key?: string;
18 }
19
e69608 20 export type Keys = (string | number)[];
2f6253 21 export type CheckKeys =
e69608 22   | (string | number)[]
V 23   | { checked: (string | number)[]; halfChecked: (string | number)[] };
2f6253 24
25 export interface TreeActionType {
cd8e92 26   checkAll: (checkAll: boolean) => void;
V 27   expandAll: (expandAll: boolean) => void;
2f6253 28   setExpandedKeys: (keys: Keys) => void;
29   getExpandedKeys: () => Keys;
30   setSelectedKeys: (keys: Keys) => void;
31   getSelectedKeys: () => Keys;
32   setCheckedKeys: (keys: CheckKeys) => void;
33   getCheckedKeys: () => CheckKeys;
34   filterByLevel: (level: number) => void;
35   insertNodeByKey: (opt: InsertNodeParams) => void;
d97aa9 36   insertNodesByKey: (opt: InsertNodeParams) => void;
2f6253 37   deleteNodeByKey: (key: string) => void;
72b42d 38   updateNodeByKey: (key: string, node: Omit<TreeDataItem, 'key'>) => void;
60577d 39   setSearchValue: (value: string) => void;
40   getSearchValue: () => string;
2f6253 41 }
42
43 export interface InsertNodeParams {
44   parentKey: string | null;
72b42d 45   node: TreeDataItem;
V 46   list?: TreeDataItem[];
2f6253 47   push?: 'push' | 'unshift';
48 }
adff78 49
N 50 export interface ContextMenuOptions {
51   icon?: string;
52   styles?: any;
53   items?: ContextMenuItem[];
54 }
d8ff30 55
N 56 export type CheckEvent = CheckEventOrigin;