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

View File

@ -1,4 +1,4 @@
import { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
export const offset = 4; 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 MinusSquareOutlined from '@ant-design/icons-vue/MinusSquareOutlined';
import PlusSquareOutlined from '@ant-design/icons-vue/PlusSquareOutlined'; import PlusSquareOutlined from '@ant-design/icons-vue/PlusSquareOutlined';
import CaretDownFilled from '@ant-design/icons-vue/CaretDownFilled'; 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 { isValidElement } from 'ant-design-vue/es/_util/props-util';
import { cloneVNode } from 'vue'; import { cloneVNode } from 'vue';

View File

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

View File

@ -1,8 +1,10 @@
import TreeNode from './TreeNode'; import TreeNode from './TreeNode';
import { FlattenNode } from './interface'; import type { FlattenNode } from './interface';
import { getTreeNodeProps, TreeNodeRequiredProps } from './utils/treeUtil'; import type { TreeNodeRequiredProps } from './utils/treeUtil';
import { getTreeNodeProps } from './utils/treeUtil';
import { useInjectTreeContext } from './contextTypes'; 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'; import { treeNodeProps } from './props';
export default defineComponent({ export default defineComponent({

View File

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

View File

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