style: lint

pull/4577/head
tangjinzhou 2021-08-17 22:05:24 +08:00
parent a0f7e8d21f
commit 448788eaa5
9 changed files with 38 additions and 33 deletions

View File

@ -1,4 +1,5 @@
import { VNode, PropType, DefineComponent, ExtractPropTypes, ref } from 'vue';
import type { VNode, PropType, DefineComponent, ExtractPropTypes } from 'vue';
import { ref } from 'vue';
import { defineComponent } from 'vue';
import classNames from '../_util/classNames';
import VcTree, { TreeNode } from '../vc-tree';
@ -6,7 +7,7 @@ import animation from '../_util/openAnimation';
import PropTypes from '../_util/vue-types';
import { filterEmpty } from '../_util/props-util';
import initDefaultProps from '../_util/props-util/initDefaultProps';
import { DataNode, FieldNames, Key } from '../vc-tree/interface';
import type { DataNode, FieldNames, Key } from '../vc-tree/interface';
import { treeProps as vcTreeProps } from '../vc-tree/props';
import useConfigInject from '../_util/hooks/useConfigInject';
import renderSwitcherIcon from './utils/iconUtil';
@ -51,7 +52,7 @@ export interface AntTreeNodeProps {
[customProp: string]: any;
}
export interface AntTreeNode extends DefineComponent<AntTreeNodeProps, {}> {}
export type AntTreeNode = DefineComponent<AntTreeNodeProps, {}>;
export interface AntTreeNodeBaseEvent {
node: AntTreeNode;

View File

@ -1,4 +1,4 @@
import { CSSProperties } from 'vue';
import type { CSSProperties } from 'vue';
export const offset = 4;

View File

@ -3,7 +3,7 @@ import FileOutlined from '@ant-design/icons-vue/FileOutlined';
import MinusSquareOutlined from '@ant-design/icons-vue/MinusSquareOutlined';
import PlusSquareOutlined from '@ant-design/icons-vue/PlusSquareOutlined';
import CaretDownFilled from '@ant-design/icons-vue/CaretDownFilled';
import { AntTreeNodeProps } from '../Tree';
import type { AntTreeNodeProps } from '../Tree';
import { isValidElement } from 'ant-design-vue/es/_util/props-util';
import { cloneVNode } from 'vue';

View File

@ -1,4 +1,4 @@
import { CSSProperties } from 'vue';
import type { CSSProperties } from 'vue';
export default function DropIndicator({
dropPosition,

View File

@ -1,8 +1,10 @@
import TreeNode from './TreeNode';
import { FlattenNode } from './interface';
import { getTreeNodeProps, TreeNodeRequiredProps } from './utils/treeUtil';
import type { FlattenNode } from './interface';
import type { TreeNodeRequiredProps } from './utils/treeUtil';
import { getTreeNodeProps } from './utils/treeUtil';
import { useInjectTreeContext } from './contextTypes';
import { defineComponent, onBeforeUnmount, onMounted, PropType, ref, Transition, watch } from 'vue';
import type { PropType } from 'vue';
import { defineComponent, onBeforeUnmount, onMounted, ref, Transition, watch } from 'vue';
import { treeNodeProps } from './props';
export default defineComponent({

View File

@ -4,7 +4,7 @@
import { computed, defineComponent, ref, watch } from 'vue';
import VirtualList from '../vc-virtual-list';
import { FlattenNode, DataEntity, DataNode, ScrollTo } from './interface';
import type { FlattenNode, DataEntity, DataNode, ScrollTo } from './interface';
import MotionTreeNode from './MotionTreeNode';
import { nodeListProps } from './props';
import { findExpandedKeys, getExpandRange } from './utils/diffUtil';

View File

@ -1,4 +1,5 @@
import { TreeContext, NodeMouseEventHandler, NodeDragEventHandler } from './contextTypes';
import type { NodeMouseEventHandler, NodeDragEventHandler } from './contextTypes';
import { TreeContext } from './contextTypes';
import {
getDataAndAria,
getDragChildrenKeys,
@ -10,7 +11,7 @@ import {
arrDel,
posToArr,
} from './util';
import { Key, FlattenNode, EventDataNode, NodeInstance, ScrollTo } from './interface';
import type { Key, FlattenNode, EventDataNode, NodeInstance, ScrollTo } from './interface';
import {
flattenTreeData,
convertTreeToData,
@ -24,7 +25,8 @@ import { conductCheck } from './utils/conductUtil';
import DropIndicator from './DropIndicator';
import { computed, defineComponent, onMounted, onUnmounted, reactive, ref, watchEffect } from 'vue';
import initDefaultProps from '../_util/props-util/initDefaultProps';
import { CheckInfo, treeProps } from './props';
import type { CheckInfo } from './props';
import { treeProps } from './props';
import { warning } from '../vc-util/warning';
import KeyCode from '../_util/KeyCode';
import classNames from '../_util/classNames';
@ -185,7 +187,7 @@ export default defineComponent({
checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {};
} else if (!init && props.defaultCheckedKeys) {
checkedKeyEntity = parseCheckedKeys(props.defaultCheckedKeys) || {};
} else if (treeData) {
} else if (treeData.value) {
// If `treeData` changed, we also need check it
checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {
checkedKeys: checkedKeys.value,
@ -495,7 +497,7 @@ export default defineComponent({
onDragleave({ event, node: convertNodePropsToEventData(node.props) });
}
};
const onNodeDrop = (event: MouseEvent, _node, outsideTree: boolean = false) => {
const onNodeDrop = (event: MouseEvent, _node, outsideTree = false) => {
const { dragChildrenKeys, dropPosition, dropTargetKey, dropTargetPos, dropAllowed } =
dragState;
@ -1029,21 +1031,21 @@ export default defineComponent({
titleRender,
onNodeClick: onNodeClick,
onNodeDoubleClick: onNodeDoubleClick,
onNodeExpand: onNodeExpand,
onNodeSelect: onNodeSelect,
onNodeCheck: onNodeCheck,
onNodeLoad: onNodeLoad,
onNodeMouseEnter: onNodeMouseEnter,
onNodeMouseLeave: onNodeMouseLeave,
onNodeContextMenu: onNodeContextMenu,
onNodeDragStart: onNodeDragStart,
onNodeDragEnter: onNodeDragEnter,
onNodeDragOver: onNodeDragOver,
onNodeDragLeave: onNodeDragLeave,
onNodeDragEnd: onNodeDragEnd,
onNodeDrop: onNodeDrop,
onNodeClick,
onNodeDoubleClick,
onNodeExpand,
onNodeSelect,
onNodeCheck,
onNodeLoad,
onNodeMouseEnter,
onNodeMouseLeave,
onNodeContextMenu,
onNodeDragStart,
onNodeDragEnter,
onNodeDragOver,
onNodeDragLeave,
onNodeDragEnd,
onNodeDrop,
}}
>
<div

View File

@ -1,4 +1,4 @@
import { CSSProperties, VNode } from 'vue';
import type { CSSProperties, VNode } from 'vue';
export type { ScrollTo } from '../vc-virtual-list/List';
export interface DataNode {

View File

@ -4,7 +4,7 @@
*/
import TreeNode from './TreeNode';
import {
import type {
NodeElement,
Key,
DataNode,
@ -14,7 +14,7 @@ import {
Direction,
} from './interface';
import { warning } from '../vc-util/warning';
import { AllowDrop, TreeNodeProps, TreeProps } from './props';
import type { AllowDrop, TreeNodeProps, TreeProps } from './props';
export function arrDel(list: Key[], value: Key) {
const clone = list.slice();