chore: fix tree type (#3598)

pull/3603/head
ajuner 2021-01-26 23:48:48 +08:00 committed by GitHub
parent 94aedeae0c
commit 10a5fb28cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 10 deletions

View File

@ -1,4 +1,4 @@
import { defineComponent, inject, VNode, PropType } from 'vue'; import { defineComponent, inject, VNode, PropType, CSSProperties } from 'vue';
import classNames from '../_util/classNames'; import classNames from '../_util/classNames';
import LoadingOutlined from '@ant-design/icons-vue/LoadingOutlined'; import LoadingOutlined from '@ant-design/icons-vue/LoadingOutlined';
import FileOutlined from '@ant-design/icons-vue/FileOutlined'; import FileOutlined from '@ant-design/icons-vue/FileOutlined';
@ -24,22 +24,22 @@ export interface TreeDataItem {
disableCheckbox?: boolean; disableCheckbox?: boolean;
disabled?: boolean; disabled?: boolean;
class?: string; class?: string;
style?: any; style?: CSSProperties;
checkable?: boolean; checkable?: boolean;
icon?: any; icon?: VNode;
slots?: any; slots?: Record<string, string>;
switcherIcon?: any; switcherIcon?: VNode;
} }
interface DefaultEvent { interface DefaultEvent {
nativeEvent: MouseEvent; nativeEvent: MouseEvent;
node: any; node: Record<string, any>;
} }
export interface CheckEvent extends DefaultEvent { export interface CheckEvent extends DefaultEvent {
checked: boolean; checked: boolean;
checkedNodes: VNode[]; checkedNodes: Array<Record<string, any>>;
checkedNodesPositions: { node: VNode; pos: string | number }[]; checkedNodesPositions: { node: Record<string, any>; pos: string | number }[];
event: string; event: string;
halfCheckedKeys: (string | number)[]; halfCheckedKeys: (string | number)[];
} }
@ -51,7 +51,22 @@ export interface ExpendEvent extends DefaultEvent {
export interface SelectEvent extends DefaultEvent { export interface SelectEvent extends DefaultEvent {
event: string; event: string;
selected: boolean; selected: boolean;
selectedNodes: VNode[]; selectedNodes: Array<Record<string, any>>;
}
export interface TreeDragEvent {
event: DragEvent;
expandedKeys: (string | number)[];
node: Record<string, any>;
}
export interface DropEvent {
dragNode: Record<string, any>;
dragNodesKeys: (string | number)[];
dropPosition: number;
dropToGap: boolean;
event: DragEvent;
node: Record<string, any>;
} }
function TreeProps() { function TreeProps() {
@ -263,7 +278,7 @@ export default defineComponent({
onCheck: this.handleCheck, onCheck: this.handleCheck,
onExpand: this.handleExpand, onExpand: this.handleExpand,
onSelect: this.handleSelect, onSelect: this.handleSelect,
} as any; } as Record<string, any>;
if (treeData) { if (treeData) {
vcTreeProps.treeData = treeData; vcTreeProps.treeData = treeData;
} }