Skip to content

Commit 10a5fb2

Browse files
authored
chore: fix tree type (#3598)
1 parent 94aedea commit 10a5fb2

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

components/tree/Tree.tsx

+25-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, inject, VNode, PropType } from 'vue';
1+
import { defineComponent, inject, VNode, PropType, CSSProperties } from 'vue';
22
import classNames from '../_util/classNames';
33
import LoadingOutlined from '@ant-design/icons-vue/LoadingOutlined';
44
import FileOutlined from '@ant-design/icons-vue/FileOutlined';
@@ -24,22 +24,22 @@ export interface TreeDataItem {
2424
disableCheckbox?: boolean;
2525
disabled?: boolean;
2626
class?: string;
27-
style?: any;
27+
style?: CSSProperties;
2828
checkable?: boolean;
29-
icon?: any;
30-
slots?: any;
31-
switcherIcon?: any;
29+
icon?: VNode;
30+
slots?: Record<string, string>;
31+
switcherIcon?: VNode;
3232
}
3333

3434
interface DefaultEvent {
3535
nativeEvent: MouseEvent;
36-
node: any;
36+
node: Record<string, any>;
3737
}
3838

3939
export interface CheckEvent extends DefaultEvent {
4040
checked: boolean;
41-
checkedNodes: VNode[];
42-
checkedNodesPositions: { node: VNode; pos: string | number }[];
41+
checkedNodes: Array<Record<string, any>>;
42+
checkedNodesPositions: { node: Record<string, any>; pos: string | number }[];
4343
event: string;
4444
halfCheckedKeys: (string | number)[];
4545
}
@@ -51,7 +51,22 @@ export interface ExpendEvent extends DefaultEvent {
5151
export interface SelectEvent extends DefaultEvent {
5252
event: string;
5353
selected: boolean;
54-
selectedNodes: VNode[];
54+
selectedNodes: Array<Record<string, any>>;
55+
}
56+
57+
export interface TreeDragEvent {
58+
event: DragEvent;
59+
expandedKeys: (string | number)[];
60+
node: Record<string, any>;
61+
}
62+
63+
export interface DropEvent {
64+
dragNode: Record<string, any>;
65+
dragNodesKeys: (string | number)[];
66+
dropPosition: number;
67+
dropToGap: boolean;
68+
event: DragEvent;
69+
node: Record<string, any>;
5570
}
5671

5772
function TreeProps() {
@@ -263,7 +278,7 @@ export default defineComponent({
263278
onCheck: this.handleCheck,
264279
onExpand: this.handleExpand,
265280
onSelect: this.handleSelect,
266-
} as any;
281+
} as Record<string, any>;
267282
if (treeData) {
268283
vcTreeProps.treeData = treeData;
269284
}

0 commit comments

Comments
 (0)