ant-design-vue/components/tree/Tree.tsx

350 lines
12 KiB
Vue
Raw Normal View History

2021-08-17 14:52:28 +00:00
import type { VNode, PropType, DefineComponent, ExtractPropTypes, CSSProperties } from 'vue';
2021-08-17 14:05:24 +00:00
import { ref } from 'vue';
2021-08-17 14:03:49 +00:00
import { defineComponent } from 'vue';
2020-08-31 08:53:19 +00:00
import classNames from '../_util/classNames';
2021-08-17 14:03:49 +00:00
import VcTree, { TreeNode } from '../vc-tree';
2019-01-12 03:33:27 +00:00
import animation from '../_util/openAnimation';
import PropTypes from '../_util/vue-types';
2021-08-17 14:03:49 +00:00
import { filterEmpty } from '../_util/props-util';
2020-10-22 06:25:02 +00:00
import initDefaultProps from '../_util/props-util/initDefaultProps';
2021-08-17 14:05:24 +00:00
import type { DataNode, FieldNames, Key } from '../vc-tree/interface';
2021-08-17 14:03:49 +00:00
import { treeProps as vcTreeProps } from '../vc-tree/props';
import useConfigInject from '../_util/hooks/useConfigInject';
import renderSwitcherIcon from './utils/iconUtil';
import dropIndicatorRender from './utils/dropIndicator';
2018-09-26 14:57:01 +00:00
2021-08-17 14:03:49 +00:00
export interface AntdTreeNodeAttribute {
eventKey: string;
prefixCls: string;
2021-08-17 14:52:28 +00:00
class: string;
2021-08-17 14:03:49 +00:00
expanded: boolean;
selected: boolean;
checked: boolean;
halfChecked: boolean;
children: any;
title: any;
pos: string;
dragOver: boolean;
dragOverGapTop: boolean;
dragOverGapBottom: boolean;
isLeaf: boolean;
selectable: boolean;
disabled: boolean;
disableCheckbox: boolean;
}
2021-08-17 14:03:49 +00:00
export interface AntTreeNodeProps {
className?: string;
checkable?: boolean;
disabled?: boolean;
disableCheckbox?: boolean;
title?: string | any;
key?: Key;
eventKey?: string;
isLeaf?: boolean;
2021-08-17 14:03:49 +00:00
checked?: boolean;
expanded?: boolean;
loading?: boolean;
selected?: boolean;
selectable?: boolean;
2021-08-17 14:03:49 +00:00
icon?: ((treeNode: AntdTreeNodeAttribute) => any) | VNode;
children?: any;
[customProp: string]: any;
}
2021-08-17 14:05:24 +00:00
export type AntTreeNode = DefineComponent<AntTreeNodeProps, {}>;
2021-08-17 14:03:49 +00:00
export interface AntTreeNodeBaseEvent {
node: AntTreeNode;
nativeEvent: MouseEvent;
}
2021-08-17 14:03:49 +00:00
export interface AntTreeNodeCheckedEvent extends AntTreeNodeBaseEvent {
event: 'check';
checked?: boolean;
checkedNodes?: AntTreeNode[];
}
2021-08-17 14:03:49 +00:00
export interface AntTreeNodeSelectedEvent extends AntTreeNodeBaseEvent {
event: 'select';
selected?: boolean;
selectedNodes?: DataNode[];
}
2021-08-17 14:03:49 +00:00
export interface AntTreeNodeExpandedEvent extends AntTreeNodeBaseEvent {
expanded?: boolean;
2021-01-26 15:48:48 +00:00
}
2021-08-17 14:03:49 +00:00
export interface AntTreeNodeMouseEvent {
node: AntTreeNode;
2021-01-26 15:48:48 +00:00
event: DragEvent;
}
2021-08-17 14:03:49 +00:00
export interface AntTreeNodeDragEnterEvent extends AntTreeNodeMouseEvent {
expandedKeys: Key[];
}
export interface AntTreeNodeDropEvent {
node: AntTreeNode;
dragNode: AntTreeNode;
dragNodesKeys: Key[];
2021-01-26 15:48:48 +00:00
dropPosition: number;
2021-08-17 14:03:49 +00:00
dropToGap?: boolean;
event: MouseEvent;
}
2021-08-17 14:03:49 +00:00
// [Legacy] Compatible for v2
export type TreeDataItem = DataNode;
export const treeProps = () => {
2018-09-26 14:57:01 +00:00
return {
2021-08-17 14:03:49 +00:00
...vcTreeProps(),
showLine: { type: Boolean, default: undefined },
2018-09-26 14:57:01 +00:00
/** 是否支持多选 */
2021-08-17 14:03:49 +00:00
multiple: { type: Boolean, default: undefined },
2018-09-26 14:57:01 +00:00
/** 是否自动展开父节点 */
2021-08-17 14:03:49 +00:00
autoExpandParent: { type: Boolean, default: undefined },
2018-09-26 14:57:01 +00:00
/** checkable状态下节点选择完全受控父子节点选中状态不再关联*/
2021-08-17 14:03:49 +00:00
checkStrictly: { type: Boolean, default: undefined },
2018-09-26 14:57:01 +00:00
/** 是否支持选中 */
2021-08-17 14:03:49 +00:00
checkable: { type: Boolean, default: undefined },
2018-09-26 14:57:01 +00:00
/** 是否禁用树 */
2021-08-17 14:03:49 +00:00
disabled: { type: Boolean, default: undefined },
2018-09-26 14:57:01 +00:00
/** 默认展开所有树节点 */
2021-08-17 14:03:49 +00:00
defaultExpandAll: { type: Boolean, default: undefined },
2018-09-26 14:57:01 +00:00
/** 默认展开对应树节点 */
2021-08-17 14:03:49 +00:00
defaultExpandParent: { type: Boolean, default: undefined },
2018-09-26 14:57:01 +00:00
/** 默认展开指定的树节点 */
2021-08-17 14:03:49 +00:00
defaultExpandedKeys: { type: Array as PropType<Key[]> },
2018-09-26 14:57:01 +00:00
/** (受控)展开指定的树节点 */
2021-08-17 14:03:49 +00:00
expandedKeys: { type: Array as PropType<Key[]> },
2018-09-26 14:57:01 +00:00
/** (受控)选中复选框的树节点 */
2021-08-17 14:03:49 +00:00
checkedKeys: {
type: [Array, Object] as PropType<Key[] | { checked: Key[]; halfChecked: Key[] }>,
},
2018-09-26 14:57:01 +00:00
/** 默认选中复选框的树节点 */
2021-08-17 14:03:49 +00:00
defaultCheckedKeys: { type: Array as PropType<Key[]> },
2018-09-26 14:57:01 +00:00
/** (受控)设置选中的树节点 */
2021-08-17 14:03:49 +00:00
selectedKeys: { type: Array as PropType<Key[]> },
2018-09-26 14:57:01 +00:00
/** 默认选中的树节点 */
2021-08-17 14:03:49 +00:00
defaultSelectedKeys: { type: Array as PropType<Key[]> },
selectable: { type: Boolean, default: undefined },
2020-08-12 10:07:41 +00:00
2018-09-26 14:57:01 +00:00
/** filter some AntTreeNodes as you need. it should return true */
2021-08-17 14:03:49 +00:00
filterAntTreeNode: { type: Function as PropType<(node: AntTreeNode) => boolean> },
loadedKeys: { type: Array as PropType<Key[]> },
draggable: { type: Boolean, default: undefined },
showIcon: { type: Boolean, default: undefined },
icon: { type: Function as PropType<(nodeProps: AntdTreeNodeAttribute) => any> },
2019-04-10 05:28:07 +00:00
switcherIcon: PropTypes.any,
2018-09-26 14:57:01 +00:00
prefixCls: PropTypes.string,
/**
* @default{title,key,children}
2021-08-17 14:03:49 +00:00
* deprecated, please use `fieldNames` instead
* 替换treeNode中 title,key,children字段为treeData中对应的字段
*/
2021-08-17 14:03:49 +00:00
replaceFields: { type: Object as PropType<FieldNames> },
blockNode: { type: Boolean, default: undefined },
2019-01-12 03:33:27 +00:00
};
2021-08-17 14:03:49 +00:00
};
2018-09-26 14:57:01 +00:00
2021-08-17 14:03:49 +00:00
export type TreeProps = Partial<ExtractPropTypes<ReturnType<typeof treeProps>>>;
2018-09-26 14:57:01 +00:00
2020-10-22 06:25:02 +00:00
export default defineComponent({
2018-09-26 14:57:01 +00:00
name: 'ATree',
2020-07-16 10:31:20 +00:00
inheritAttrs: false,
2021-08-17 14:03:49 +00:00
props: initDefaultProps(treeProps(), {
2018-09-26 14:57:01 +00:00
checkable: false,
2021-08-17 14:03:49 +00:00
selectable: true,
2018-09-26 14:57:01 +00:00
showIcon: false,
openAnimation: {
2020-07-16 10:31:20 +00:00
...animation,
2021-08-17 14:03:49 +00:00
appear: false,
2018-09-26 14:57:01 +00:00
},
Feat 1.5.0 (#1853) * feat: add Result component * fix: update md template tag html>tpl - fix `result` typo - update jest `result` snapshots * refactor: svg file to functional component icon - update jest snapshot * feat: add result * Feat descriptions (#1251) * feat: add descriptions * fix: add descriptions types and fix docs * fix: lint change code * fix: demo warning * fix: update demo, snapshot and remove classnames * test: add descriptions test * fix: descriptions demo (#1498) * feat: add page header (#1250) * feat: add page-header component * update site: page-header * ts definition update: page-header * get page-header props with getComponentFromProp func * optimize page-header * doc: add page-header actions.md responsive.md * breadcrumb itemRender add pure function support * style: format code * feat: update style to 3.23.6 from 2.13.6 * feat: update style to 3.26.8 from 3.23.6 * chore: update util * chore: update util * feat: update affix * feat: update alert * feat: update anchor * feat: update auto-complete * feat: update avatar * feat: update back-top * feat: update badge * feat: update button * feat: update breadcrumb * feat: update ts * docs: update doc * feat: update calendat * feat: update card * feat: update carousel * feat: update carousel * feat: update checkbox * feat: update comment * feat: update config-provider * docs: update doc * feat: update collapse * feat: update locale * feat: update date-picker * feat: update divider * feat: update drawer * feat: update dropdown * feat: update rc-trigger * feat: update dropdown * feat: update empty * test: add empty test * feat: update form * feat: update form * feat: update spin * feat: update grid * docs: update grid doc * feat: update icon * feat: update slider * feat: update textarea * feat: update input-number * feat: update layout * feat: update list * feat: update menu * feat: meaage add key for update content * feat: modal add closeIcon support * feat: update notification * feat: add pagination disabled support * feat: popconfirm add disabled support * test: update popover * feat: progress support custom line-gradiend * feat: update radio * test: update radio test * docs: update rate demo * feat: skeleton add avatar support number type * test: add switch test * test: update statistic test * fix: input clear icon event * feat: steps add type、 v-model、subTitle * feat: delete typography component * feat: delete Typography style * perf: update select * feat: add download transformFile previewFile actio * docs: update upload * feat: update tree-select * docs: update tree-select * feat: tree add blockNode selectable * docs: add tree demo * test: update snap * docs: updatedoc * feat: update tag * docs: update ad doc * feat: update tooltip * feat: update timeline * feat: time-picker add clearIcon * docs: update tabs * feat: transfer support custom children * test: update transfer test * feat: update table * test: update table test * test: update test * feat: calendar update locale * test: update test snap * feat: add mentions (#1790) * feat: mentions style * feat: theme default * feat: add mentions component * feat: mentions API * feat: add unit test for mentions * feat: update mentions demo * perf: model and inheritAttrs for mentions * perf: use getComponentFromProp instead of this.$props * perf: mentions rm defaultProps * feat: rm rows in mentionsProps * fix: mentions keyDown didn't work * docs: update mentions api * perf: mentions code * feat: update mentions * bump 1.5.0-alpha.1 * feat: pageheader add ghost prop * docs: update descriptions demo * chore: page-header add ghost type * fix: color error * feat: update to 3.26.12 * fix: some prop default value * fix(typo): form, carousel, upload. duplicate identifier (#1848) * Add Mentions Type (#1845) * feat: add mentions type * feat: add mentions in ant-design-vue.d.ts * docs: update doc * docs: add changelog * fix: mentions getPopupCotainer value (#1850) * docs: update doc * docs: uptate demo * docs: update demo * docs: delete demo * docs: delete doc * test: update snapshots * style: format code * chore: update travis * docs: update demo Co-authored-by: Sendya <18x@loacg.com> Co-authored-by: zkwolf <chenhao5866@gmail.com> Co-authored-by: drafish <xwlyy1991@163.com> Co-authored-by: Amour1688 <31695475+Amour1688@users.noreply.github.com>
2020-03-07 11:45:13 +00:00
blockNode: false,
2018-09-26 14:57:01 +00:00
}),
2021-08-17 14:03:49 +00:00
slots: ['icon', 'title', 'switcherIcon'],
emits: [
'update:selectedKeys',
'update:checkedKeys',
'update:expandedKeys',
'expand',
'select',
'check',
],
2018-09-26 14:57:01 +00:00
TreeNode,
2021-08-17 14:03:49 +00:00
setup(props, { attrs, expose, emit, slots }) {
const { prefixCls, direction, virtual } = useConfigInject('tree', props);
const tree = ref();
expose({
tree,
});
const handleCheck: TreeProps['onCheck'] = (checkedObjOrKeys, eventObj) => {
emit('update:checkedKeys', checkedObjOrKeys);
emit('check', checkedObjOrKeys, eventObj);
};
const handleExpand: TreeProps['onExpand'] = (expandedKeys, eventObj) => {
emit('update:expandedKeys', expandedKeys);
emit('expand', expandedKeys, eventObj);
};
const handleSelect: TreeProps['onSelect'] = (selectedKeys, eventObj) => {
emit('update:selectedKeys', selectedKeys);
emit('select', selectedKeys, eventObj);
};
return () => {
const {
showIcon,
showLine,
switcherIcon = slots.switcherIcon?.(),
icon = slots.icon,
blockNode,
checkable,
selectable,
fieldNames,
replaceFields,
} = props;
const newProps = {
...attrs,
...props,
showLine: Boolean(showLine),
dropIndicatorRender,
fieldNames: fieldNames || (replaceFields as FieldNames),
icon,
};
Feat 1.5.0 (#1853) * feat: add Result component * fix: update md template tag html>tpl - fix `result` typo - update jest `result` snapshots * refactor: svg file to functional component icon - update jest snapshot * feat: add result * Feat descriptions (#1251) * feat: add descriptions * fix: add descriptions types and fix docs * fix: lint change code * fix: demo warning * fix: update demo, snapshot and remove classnames * test: add descriptions test * fix: descriptions demo (#1498) * feat: add page header (#1250) * feat: add page-header component * update site: page-header * ts definition update: page-header * get page-header props with getComponentFromProp func * optimize page-header * doc: add page-header actions.md responsive.md * breadcrumb itemRender add pure function support * style: format code * feat: update style to 3.23.6 from 2.13.6 * feat: update style to 3.26.8 from 3.23.6 * chore: update util * chore: update util * feat: update affix * feat: update alert * feat: update anchor * feat: update auto-complete * feat: update avatar * feat: update back-top * feat: update badge * feat: update button * feat: update breadcrumb * feat: update ts * docs: update doc * feat: update calendat * feat: update card * feat: update carousel * feat: update carousel * feat: update checkbox * feat: update comment * feat: update config-provider * docs: update doc * feat: update collapse * feat: update locale * feat: update date-picker * feat: update divider * feat: update drawer * feat: update dropdown * feat: update rc-trigger * feat: update dropdown * feat: update empty * test: add empty test * feat: update form * feat: update form * feat: update spin * feat: update grid * docs: update grid doc * feat: update icon * feat: update slider * feat: update textarea * feat: update input-number * feat: update layout * feat: update list * feat: update menu * feat: meaage add key for update content * feat: modal add closeIcon support * feat: update notification * feat: add pagination disabled support * feat: popconfirm add disabled support * test: update popover * feat: progress support custom line-gradiend * feat: update radio * test: update radio test * docs: update rate demo * feat: skeleton add avatar support number type * test: add switch test * test: update statistic test * fix: input clear icon event * feat: steps add type、 v-model、subTitle * feat: delete typography component * feat: delete Typography style * perf: update select * feat: add download transformFile previewFile actio * docs: update upload * feat: update tree-select * docs: update tree-select * feat: tree add blockNode selectable * docs: add tree demo * test: update snap * docs: updatedoc * feat: update tag * docs: update ad doc * feat: update tooltip * feat: update timeline * feat: time-picker add clearIcon * docs: update tabs * feat: transfer support custom children * test: update transfer test * feat: update table * test: update table test * test: update test * feat: calendar update locale * test: update test snap * feat: add mentions (#1790) * feat: mentions style * feat: theme default * feat: add mentions component * feat: mentions API * feat: add unit test for mentions * feat: update mentions demo * perf: model and inheritAttrs for mentions * perf: use getComponentFromProp instead of this.$props * perf: mentions rm defaultProps * feat: rm rows in mentionsProps * fix: mentions keyDown didn't work * docs: update mentions api * perf: mentions code * feat: update mentions * bump 1.5.0-alpha.1 * feat: pageheader add ghost prop * docs: update descriptions demo * chore: page-header add ghost type * fix: color error * feat: update to 3.26.12 * fix: some prop default value * fix(typo): form, carousel, upload. duplicate identifier (#1848) * Add Mentions Type (#1845) * feat: add mentions type * feat: add mentions in ant-design-vue.d.ts * docs: update doc * docs: add changelog * fix: mentions getPopupCotainer value (#1850) * docs: update doc * docs: uptate demo * docs: update demo * docs: delete demo * docs: delete doc * test: update snapshots * style: format code * chore: update travis * docs: update demo Co-authored-by: Sendya <18x@loacg.com> Co-authored-by: zkwolf <chenhao5866@gmail.com> Co-authored-by: drafish <xwlyy1991@163.com> Co-authored-by: Amour1688 <31695475+Amour1688@users.noreply.github.com>
2020-03-07 11:45:13 +00:00
2021-08-17 14:03:49 +00:00
return (
<VcTree
itemHeight={20}
virtual={virtual.value}
{...newProps}
ref={tree}
prefixCls={prefixCls.value}
class={classNames(
{
[`${prefixCls.value}-icon-hide`]: !showIcon,
[`${prefixCls.value}-block-node`]: blockNode,
[`${prefixCls.value}-unselectable`]: !selectable,
[`${prefixCls.value}-rtl`]: direction.value === 'rtl',
},
attrs.class,
)}
direction={direction.value}
checkable={checkable}
selectable={selectable}
switcherIcon={(nodeProps: AntTreeNodeProps) =>
renderSwitcherIcon(prefixCls.value, switcherIcon, showLine, nodeProps)
}
onCheck={handleCheck}
onExpand={handleExpand}
onSelect={handleSelect}
v-slots={{
2021-08-17 14:52:28 +00:00
...slots,
2021-08-17 14:03:49 +00:00
checkable: () => <span class={`${prefixCls.value}-checkbox-inner`} />,
}}
children={filterEmpty(slots.default?.())}
></VcTree>
Feat 1.5.0 (#1853) * feat: add Result component * fix: update md template tag html>tpl - fix `result` typo - update jest `result` snapshots * refactor: svg file to functional component icon - update jest snapshot * feat: add result * Feat descriptions (#1251) * feat: add descriptions * fix: add descriptions types and fix docs * fix: lint change code * fix: demo warning * fix: update demo, snapshot and remove classnames * test: add descriptions test * fix: descriptions demo (#1498) * feat: add page header (#1250) * feat: add page-header component * update site: page-header * ts definition update: page-header * get page-header props with getComponentFromProp func * optimize page-header * doc: add page-header actions.md responsive.md * breadcrumb itemRender add pure function support * style: format code * feat: update style to 3.23.6 from 2.13.6 * feat: update style to 3.26.8 from 3.23.6 * chore: update util * chore: update util * feat: update affix * feat: update alert * feat: update anchor * feat: update auto-complete * feat: update avatar * feat: update back-top * feat: update badge * feat: update button * feat: update breadcrumb * feat: update ts * docs: update doc * feat: update calendat * feat: update card * feat: update carousel * feat: update carousel * feat: update checkbox * feat: update comment * feat: update config-provider * docs: update doc * feat: update collapse * feat: update locale * feat: update date-picker * feat: update divider * feat: update drawer * feat: update dropdown * feat: update rc-trigger * feat: update dropdown * feat: update empty * test: add empty test * feat: update form * feat: update form * feat: update spin * feat: update grid * docs: update grid doc * feat: update icon * feat: update slider * feat: update textarea * feat: update input-number * feat: update layout * feat: update list * feat: update menu * feat: meaage add key for update content * feat: modal add closeIcon support * feat: update notification * feat: add pagination disabled support * feat: popconfirm add disabled support * test: update popover * feat: progress support custom line-gradiend * feat: update radio * test: update radio test * docs: update rate demo * feat: skeleton add avatar support number type * test: add switch test * test: update statistic test * fix: input clear icon event * feat: steps add type、 v-model、subTitle * feat: delete typography component * feat: delete Typography style * perf: update select * feat: add download transformFile previewFile actio * docs: update upload * feat: update tree-select * docs: update tree-select * feat: tree add blockNode selectable * docs: add tree demo * test: update snap * docs: updatedoc * feat: update tag * docs: update ad doc * feat: update tooltip * feat: update timeline * feat: time-picker add clearIcon * docs: update tabs * feat: transfer support custom children * test: update transfer test * feat: update table * test: update table test * test: update test * feat: calendar update locale * test: update test snap * feat: add mentions (#1790) * feat: mentions style * feat: theme default * feat: add mentions component * feat: mentions API * feat: add unit test for mentions * feat: update mentions demo * perf: model and inheritAttrs for mentions * perf: use getComponentFromProp instead of this.$props * perf: mentions rm defaultProps * feat: rm rows in mentionsProps * fix: mentions keyDown didn't work * docs: update mentions api * perf: mentions code * feat: update mentions * bump 1.5.0-alpha.1 * feat: pageheader add ghost prop * docs: update descriptions demo * chore: page-header add ghost type * fix: color error * feat: update to 3.26.12 * fix: some prop default value * fix(typo): form, carousel, upload. duplicate identifier (#1848) * Add Mentions Type (#1845) * feat: add mentions type * feat: add mentions in ant-design-vue.d.ts * docs: update doc * docs: add changelog * fix: mentions getPopupCotainer value (#1850) * docs: update doc * docs: uptate demo * docs: update demo * docs: delete demo * docs: delete doc * test: update snapshots * style: format code * chore: update travis * docs: update demo Co-authored-by: Sendya <18x@loacg.com> Co-authored-by: zkwolf <chenhao5866@gmail.com> Co-authored-by: drafish <xwlyy1991@163.com> Co-authored-by: Amour1688 <31695475+Amour1688@users.noreply.github.com>
2020-03-07 11:45:13 +00:00
);
2021-08-17 14:03:49 +00:00
};
2018-09-26 14:57:01 +00:00
},
2021-08-17 14:03:49 +00:00
// methods: {
// renderSwitcherIcon(prefixCls: string, switcherIcon: VNode, { isLeaf, loading, expanded }) {
// const { showLine } = this.$props;
// if (loading) {
// return <LoadingOutlined class={`${prefixCls}-switcher-loading-icon`} />;
// }
// if (isLeaf) {
// return showLine ? <FileOutlined class={`${prefixCls}-switcher-line-icon`} /> : null;
// }
// const switcherCls = `${prefixCls}-switcher-icon`;
// if (switcherIcon) {
// return cloneElement(switcherIcon, {
// class: switcherCls,
// });
// }
// return showLine ? (
// expanded ? (
// <MinusSquareOutlined class={`${prefixCls}-switcher-line-icon`} />
// ) : (
// <PlusSquareOutlined class={`${prefixCls}-switcher-line-icon`} />
// )
// ) : (
// <CaretDownFilled class={switcherCls} />
// );
// },
// updateTreeData(treeData: TreeDataItem[]) {
// const { $slots } = this;
// const defaultFields = { children: 'children', title: 'title', key: 'key' };
// const replaceFields = { ...defaultFields, ...this.$props.replaceFields };
// return treeData.map(item => {
// const key = item[replaceFields.key];
// const children = item[replaceFields.children];
// const { slots = {}, class: cls, style, ...restProps } = item;
// const treeNodeProps = {
// ...restProps,
// icon: $slots[slots.icon] || restProps.icon,
// switcherIcon: $slots[slots.switcherIcon] || restProps.switcherIcon,
// title: $slots[slots.title] || $slots.title || restProps[replaceFields.title],
// dataRef: item,
// key,
// class: cls,
// style,
// };
// if (children) {
// return { ...treeNodeProps, children: this.updateTreeData(children) };
// }
// return treeNodeProps;
// });
// },
// setTreeRef(node: VNode) {
// this.tree = node;
// },
// handleCheck(checkedObj: (number | string)[], eventObj: CheckEvent) {
// this.$emit('update:checkedKeys', checkedObj);
// this.$emit('check', checkedObj, eventObj);
// },
// handleExpand(expandedKeys: (number | string)[], eventObj: ExpendEvent) {
// this.$emit('update:expandedKeys', expandedKeys);
// this.$emit('expand', expandedKeys, eventObj);
// },
// handleSelect(selectedKeys: (number | string)[], eventObj: SelectEvent) {
// this.$emit('update:selectedKeys', selectedKeys);
// this.$emit('select', selectedKeys, eventObj);
// },
// },
// render() {
// const props = getOptionProps(this);
// const { prefixCls: customizePrefixCls, showIcon, treeNodes, blockNode } = props;
// const getPrefixCls = this.configProvider.getPrefixCls;
// const prefixCls = getPrefixCls('tree', customizePrefixCls);
// const switcherIcon = getComponent(this, 'switcherIcon');
// const checkable = props.checkable;
// let treeData = props.treeData || treeNodes;
// if (treeData) {
// treeData = this.updateTreeData(treeData);
// }
// const { class: className, ...restAttrs } = this.$attrs;
// const vcTreeProps = {
// ...props,
// prefixCls,
// checkable: checkable ? <span class={`${prefixCls}-checkbox-inner`} /> : checkable,
// children: getSlot(this),
// switcherIcon: nodeProps => this.renderSwitcherIcon(prefixCls, switcherIcon, nodeProps),
// ref: this.setTreeRef,
// ...restAttrs,
// class: classNames(className, {
// [`${prefixCls}-icon-hide`]: !showIcon,
// [`${prefixCls}-block-node`]: blockNode,
// }),
// onCheck: this.handleCheck,
// onExpand: this.handleExpand,
// onSelect: this.handleSelect,
// } as Record<string, any>;
// if (treeData) {
// vcTreeProps.treeData = treeData;
// }
// return <VcTree {...vcTreeProps} />;
// },
2020-10-22 06:25:02 +00:00
});