You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
32 KiB
1 lines
32 KiB
{"ast":null,"code":"import { defineComponent, inject, ref, computed, watch, provide, getCurrentInstance, resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createBlock, renderSlot, createElementVNode, toDisplayString, createCommentVNode, withDirectives, vShow } from 'vue';\nimport { selectKey } from '../../select/src/token.mjs';\nimport TreeStore from './model/tree-store.mjs';\nimport { getNodeKey, handleCurrentChange } from './model/util.mjs';\nimport ElTreeNode from './tree-node.mjs';\nimport { useNodeExpandEventBroadcast } from './model/useNodeExpandEventBroadcast.mjs';\nimport { useDragNodeHandler } from './model/useDragNode.mjs';\nimport { useKeydown } from './model/useKeydown.mjs';\nimport _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';\nimport { iconPropType } from '../../../utils/vue/icon.mjs';\nimport { useLocale } from '../../../hooks/use-locale/index.mjs';\nimport { useNamespace } from '../../../hooks/use-namespace/index.mjs';\nimport { formItemContextKey } from '../../form/src/constants.mjs';\nconst _sfc_main = defineComponent({\n name: \"ElTree\",\n components: {\n ElTreeNode\n },\n props: {\n data: {\n type: Array,\n default: () => []\n },\n emptyText: {\n type: String\n },\n renderAfterExpand: {\n type: Boolean,\n default: true\n },\n nodeKey: String,\n checkStrictly: Boolean,\n defaultExpandAll: Boolean,\n expandOnClickNode: {\n type: Boolean,\n default: true\n },\n checkOnClickNode: Boolean,\n checkDescendants: {\n type: Boolean,\n default: false\n },\n autoExpandParent: {\n type: Boolean,\n default: true\n },\n defaultCheckedKeys: Array,\n defaultExpandedKeys: Array,\n currentNodeKey: [String, Number],\n renderContent: Function,\n showCheckbox: {\n type: Boolean,\n default: false\n },\n draggable: {\n type: Boolean,\n default: false\n },\n allowDrag: Function,\n allowDrop: Function,\n props: {\n type: Object,\n default: () => ({\n children: \"children\",\n label: \"label\",\n disabled: \"disabled\"\n })\n },\n lazy: {\n type: Boolean,\n default: false\n },\n highlightCurrent: Boolean,\n load: Function,\n filterNodeMethod: Function,\n accordion: Boolean,\n indent: {\n type: Number,\n default: 18\n },\n icon: {\n type: iconPropType\n }\n },\n emits: [\"check-change\", \"current-change\", \"node-click\", \"node-contextmenu\", \"node-collapse\", \"node-expand\", \"check\", \"node-drag-start\", \"node-drag-end\", \"node-drop\", \"node-drag-leave\", \"node-drag-enter\", \"node-drag-over\"],\n setup(props, ctx) {\n const {\n t\n } = useLocale();\n const ns = useNamespace(\"tree\");\n const selectInfo = inject(selectKey, null);\n const store = ref(new TreeStore({\n key: props.nodeKey,\n data: props.data,\n lazy: props.lazy,\n props: props.props,\n load: props.load,\n currentNodeKey: props.currentNodeKey,\n checkStrictly: props.checkStrictly,\n checkDescendants: props.checkDescendants,\n defaultCheckedKeys: props.defaultCheckedKeys,\n defaultExpandedKeys: props.defaultExpandedKeys,\n autoExpandParent: props.autoExpandParent,\n defaultExpandAll: props.defaultExpandAll,\n filterNodeMethod: props.filterNodeMethod\n }));\n store.value.initialize();\n const root = ref(store.value.root);\n const currentNode = ref(null);\n const el$ = ref(null);\n const dropIndicator$ = ref(null);\n const {\n broadcastExpanded\n } = useNodeExpandEventBroadcast(props);\n const {\n dragState\n } = useDragNodeHandler({\n props,\n ctx,\n el$,\n dropIndicator$,\n store\n });\n useKeydown({\n el$\n }, store);\n const isEmpty = computed(() => {\n const {\n childNodes\n } = root.value;\n const hasFilteredOptions = selectInfo ? selectInfo.hasFilteredOptions !== 0 : false;\n return (!childNodes || childNodes.length === 0 || childNodes.every(({\n visible\n }) => !visible)) && !hasFilteredOptions;\n });\n watch(() => props.currentNodeKey, newVal => {\n store.value.setCurrentNodeKey(newVal);\n });\n watch(() => props.defaultCheckedKeys, newVal => {\n store.value.setDefaultCheckedKey(newVal);\n });\n watch(() => props.defaultExpandedKeys, newVal => {\n store.value.setDefaultExpandedKeys(newVal);\n });\n watch(() => props.data, newVal => {\n store.value.setData(newVal);\n }, {\n deep: true\n });\n watch(() => props.checkStrictly, newVal => {\n store.value.checkStrictly = newVal;\n });\n const filter = value => {\n if (!props.filterNodeMethod) throw new Error(\"[Tree] filterNodeMethod is required when filter\");\n store.value.filter(value);\n };\n const getNodeKey$1 = node => {\n return getNodeKey(props.nodeKey, node.data);\n };\n const getNodePath = data => {\n if (!props.nodeKey) throw new Error(\"[Tree] nodeKey is required in getNodePath\");\n const node = store.value.getNode(data);\n if (!node) return [];\n const path = [node.data];\n let parent = node.parent;\n while (parent && parent !== root.value) {\n path.push(parent.data);\n parent = parent.parent;\n }\n return path.reverse();\n };\n const getCheckedNodes = (leafOnly, includeHalfChecked) => {\n return store.value.getCheckedNodes(leafOnly, includeHalfChecked);\n };\n const getCheckedKeys = leafOnly => {\n return store.value.getCheckedKeys(leafOnly);\n };\n const getCurrentNode = () => {\n const currentNode2 = store.value.getCurrentNode();\n return currentNode2 ? currentNode2.data : null;\n };\n const getCurrentKey = () => {\n if (!props.nodeKey) throw new Error(\"[Tree] nodeKey is required in getCurrentKey\");\n const currentNode2 = getCurrentNode();\n return currentNode2 ? currentNode2[props.nodeKey] : null;\n };\n const setCheckedNodes = (nodes, leafOnly) => {\n if (!props.nodeKey) throw new Error(\"[Tree] nodeKey is required in setCheckedNodes\");\n store.value.setCheckedNodes(nodes, leafOnly);\n };\n const setCheckedKeys = (keys, leafOnly) => {\n if (!props.nodeKey) throw new Error(\"[Tree] nodeKey is required in setCheckedKeys\");\n store.value.setCheckedKeys(keys, leafOnly);\n };\n const setChecked = (data, checked, deep) => {\n store.value.setChecked(data, checked, deep);\n };\n const getHalfCheckedNodes = () => {\n return store.value.getHalfCheckedNodes();\n };\n const getHalfCheckedKeys = () => {\n return store.value.getHalfCheckedKeys();\n };\n const setCurrentNode = (node, shouldAutoExpandParent = true) => {\n if (!props.nodeKey) throw new Error(\"[Tree] nodeKey is required in setCurrentNode\");\n handleCurrentChange(store, ctx.emit, () => {\n broadcastExpanded(node);\n store.value.setUserCurrentNode(node, shouldAutoExpandParent);\n });\n };\n const setCurrentKey = (key, shouldAutoExpandParent = true) => {\n if (!props.nodeKey) throw new Error(\"[Tree] nodeKey is required in setCurrentKey\");\n handleCurrentChange(store, ctx.emit, () => {\n broadcastExpanded();\n store.value.setCurrentNodeKey(key, shouldAutoExpandParent);\n });\n };\n const getNode = data => {\n return store.value.getNode(data);\n };\n const remove = data => {\n store.value.remove(data);\n };\n const append = (data, parentNode) => {\n store.value.append(data, parentNode);\n };\n const insertBefore = (data, refNode) => {\n store.value.insertBefore(data, refNode);\n };\n const insertAfter = (data, refNode) => {\n store.value.insertAfter(data, refNode);\n };\n const handleNodeExpand = (nodeData, node, instance) => {\n broadcastExpanded(node);\n ctx.emit(\"node-expand\", nodeData, node, instance);\n };\n const updateKeyChildren = (key, data) => {\n if (!props.nodeKey) throw new Error(\"[Tree] nodeKey is required in updateKeyChild\");\n store.value.updateChildren(key, data);\n };\n provide(\"RootTree\", {\n ctx,\n props,\n store,\n root,\n currentNode,\n instance: getCurrentInstance()\n });\n provide(formItemContextKey, void 0);\n return {\n ns,\n store,\n root,\n currentNode,\n dragState,\n el$,\n dropIndicator$,\n isEmpty,\n filter,\n getNodeKey: getNodeKey$1,\n getNodePath,\n getCheckedNodes,\n getCheckedKeys,\n getCurrentNode,\n getCurrentKey,\n setCheckedNodes,\n setCheckedKeys,\n setChecked,\n getHalfCheckedNodes,\n getHalfCheckedKeys,\n setCurrentNode,\n setCurrentKey,\n t,\n getNode,\n remove,\n append,\n insertBefore,\n insertAfter,\n handleNodeExpand,\n updateKeyChildren\n };\n }\n});\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_el_tree_node = resolveComponent(\"el-tree-node\");\n return openBlock(), createElementBlock(\"div\", {\n ref: \"el$\",\n class: normalizeClass([_ctx.ns.b(), _ctx.ns.is(\"dragging\", !!_ctx.dragState.draggingNode), _ctx.ns.is(\"drop-not-allow\", !_ctx.dragState.allowDrop), _ctx.ns.is(\"drop-inner\", _ctx.dragState.dropType === \"inner\"), {\n [_ctx.ns.m(\"highlight-current\")]: _ctx.highlightCurrent\n }]),\n role: \"tree\"\n }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.root.childNodes, child => {\n return openBlock(), createBlock(_component_el_tree_node, {\n key: _ctx.getNodeKey(child),\n node: child,\n props: _ctx.props,\n accordion: _ctx.accordion,\n \"render-after-expand\": _ctx.renderAfterExpand,\n \"show-checkbox\": _ctx.showCheckbox,\n \"render-content\": _ctx.renderContent,\n onNodeExpand: _ctx.handleNodeExpand\n }, null, 8, [\"node\", \"props\", \"accordion\", \"render-after-expand\", \"show-checkbox\", \"render-content\", \"onNodeExpand\"]);\n }), 128)), _ctx.isEmpty ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: normalizeClass(_ctx.ns.e(\"empty-block\"))\n }, [renderSlot(_ctx.$slots, \"empty\", {}, () => {\n var _a;\n return [createElementVNode(\"span\", {\n class: normalizeClass(_ctx.ns.e(\"empty-text\"))\n }, toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t(\"el.tree.emptyText\")), 3)];\n })], 2)) : createCommentVNode(\"v-if\", true), withDirectives(createElementVNode(\"div\", {\n ref: \"dropIndicator$\",\n class: normalizeClass(_ctx.ns.e(\"drop-indicator\"))\n }, null, 2), [[vShow, _ctx.dragState.showDropIndicator]])], 2);\n}\nvar Tree = /* @__PURE__ */_export_sfc(_sfc_main, [[\"render\", _sfc_render], [\"__file\", \"tree.vue\"]]);\nexport { Tree as default };","map":{"version":3,"names":["_sfc_main","defineComponent","name","components","ElTreeNode","props","data","type","Array","default","emptyText","String","renderAfterExpand","Boolean","nodeKey","checkStrictly","defaultExpandAll","expandOnClickNode","checkOnClickNode","checkDescendants","autoExpandParent","defaultCheckedKeys","defaultExpandedKeys","currentNodeKey","Number","renderContent","Function","showCheckbox","draggable","allowDrag","allowDrop","Object","children","label","disabled","lazy","highlightCurrent","load","filterNodeMethod","accordion","indent","icon","iconPropType","emits","setup","ctx","t","useLocale","ns","useNamespace","selectInfo","inject","selectKey","store","ref","TreeStore","key","value","initialize","root","currentNode","el$","dropIndicator$","broadcastExpanded","useNodeExpandEventBroadcast","dragState","useDragNodeHandler","useKeydown","isEmpty","computed","childNodes","hasFilteredOptions","length","every","visible","watch","newVal","setCurrentNodeKey","setDefaultCheckedKey","setDefaultExpandedKeys","setData","deep","filter","Error","getNodeKey$1","node","getNodeKey","getNodePath","getNode","path","parent","push","reverse","getCheckedNodes","leafOnly","includeHalfChecked","getCheckedKeys","getCurrentNode","currentNode2","getCurrentKey","setCheckedNodes","nodes","setCheckedKeys","keys","setChecked","checked","getHalfCheckedNodes","getHalfCheckedKeys","setCurrentNode","shouldAutoExpandParent","handleCurrentChange","emit","setUserCurrentNode","setCurrentKey","remove","append","parentNode","insertBefore","refNode","insertAfter","handleNodeExpand","nodeData","instance","updateKeyChildren","updateChildren","provide","getCurrentInstance","formItemContextKey","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","_component_el_tree_node","resolveComponent","openBlock","createElementBlock","class","normalizeClass","b","is","draggingNode","dropType","m","role","Fragment","renderList","child","createBlock","onNodeExpand","e","renderSlot","$slots","_a","createElementVNode","toDisplayString","createCommentVNode","withDirectives","vShow","showDropIndicator","Tree","_export_sfc"],"sources":["../../../../../../packages/components/tree/src/tree.vue"],"sourcesContent":["<template>\n <div\n ref=\"el$\"\n :class=\"[\n ns.b(),\n ns.is('dragging', !!dragState.draggingNode),\n ns.is('drop-not-allow', !dragState.allowDrop),\n ns.is('drop-inner', dragState.dropType === 'inner'),\n { [ns.m('highlight-current')]: highlightCurrent },\n ]\"\n role=\"tree\"\n >\n <el-tree-node\n v-for=\"child in root.childNodes\"\n :key=\"getNodeKey(child)\"\n :node=\"child\"\n :props=\"props\"\n :accordion=\"accordion\"\n :render-after-expand=\"renderAfterExpand\"\n :show-checkbox=\"showCheckbox\"\n :render-content=\"renderContent\"\n @node-expand=\"handleNodeExpand\"\n />\n <div v-if=\"isEmpty\" :class=\"ns.e('empty-block')\">\n <slot name=\"empty\">\n <span :class=\"ns.e('empty-text')\">\n {{ emptyText ?? t('el.tree.emptyText') }}\n </span>\n </slot>\n </div>\n <div\n v-show=\"dragState.showDropIndicator\"\n ref=\"dropIndicator$\"\n :class=\"ns.e('drop-indicator')\"\n />\n </div>\n</template>\n<script lang=\"ts\">\n// @ts-nocheck\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n inject,\n provide,\n ref,\n watch,\n} from 'vue'\nimport { iconPropType } from '@element-plus/utils'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { formItemContextKey } from '@element-plus/components/form'\nimport { selectKey } from '@element-plus/components/select/src/token'\nimport TreeStore from './model/tree-store'\nimport { getNodeKey as getNodeKeyUtil, handleCurrentChange } from './model/util'\nimport ElTreeNode from './tree-node.vue'\nimport { useNodeExpandEventBroadcast } from './model/useNodeExpandEventBroadcast'\nimport { useDragNodeHandler } from './model/useDragNode'\nimport { useKeydown } from './model/useKeydown'\nimport type Node from './model/node'\n\nimport type { ComponentInternalInstance, PropType } from 'vue'\nimport type { Nullable } from '@element-plus/utils'\nimport type {\n TreeComponentProps,\n TreeData,\n TreeKey,\n TreeNodeData,\n} from './tree.type'\n\nexport default defineComponent({\n name: 'ElTree',\n components: { ElTreeNode },\n props: {\n data: {\n type: Array,\n default: () => [],\n },\n emptyText: {\n type: String,\n },\n renderAfterExpand: {\n type: Boolean,\n default: true,\n },\n nodeKey: String,\n checkStrictly: Boolean,\n defaultExpandAll: Boolean,\n expandOnClickNode: {\n type: Boolean,\n default: true,\n },\n checkOnClickNode: Boolean,\n checkDescendants: {\n type: Boolean,\n default: false,\n },\n autoExpandParent: {\n type: Boolean,\n default: true,\n },\n defaultCheckedKeys: Array as PropType<\n TreeComponentProps['defaultCheckedKeys']\n >,\n defaultExpandedKeys: Array as PropType<\n TreeComponentProps['defaultExpandedKeys']\n >,\n currentNodeKey: [String, Number] as PropType<string | number>,\n renderContent: Function,\n showCheckbox: {\n type: Boolean,\n default: false,\n },\n draggable: {\n type: Boolean,\n default: false,\n },\n allowDrag: Function,\n allowDrop: Function,\n props: {\n type: Object as PropType<TreeComponentProps['props']>,\n default: () => ({\n children: 'children',\n label: 'label',\n disabled: 'disabled',\n }),\n },\n lazy: {\n type: Boolean,\n default: false,\n },\n highlightCurrent: Boolean,\n load: Function as PropType<TreeComponentProps['load']>,\n filterNodeMethod: Function as PropType<\n TreeComponentProps['filterNodeMethod']\n >,\n accordion: Boolean,\n indent: {\n type: Number,\n default: 18,\n },\n icon: {\n type: iconPropType,\n },\n },\n emits: [\n 'check-change',\n 'current-change',\n 'node-click',\n 'node-contextmenu',\n 'node-collapse',\n 'node-expand',\n 'check',\n 'node-drag-start',\n 'node-drag-end',\n 'node-drop',\n 'node-drag-leave',\n 'node-drag-enter',\n 'node-drag-over',\n ],\n setup(props, ctx) {\n const { t } = useLocale()\n const ns = useNamespace('tree')\n const selectInfo = inject(selectKey, null)\n\n const store = ref<TreeStore>(\n new TreeStore({\n key: props.nodeKey,\n data: props.data,\n lazy: props.lazy,\n props: props.props,\n load: props.load,\n currentNodeKey: props.currentNodeKey,\n checkStrictly: props.checkStrictly,\n checkDescendants: props.checkDescendants,\n defaultCheckedKeys: props.defaultCheckedKeys,\n defaultExpandedKeys: props.defaultExpandedKeys,\n autoExpandParent: props.autoExpandParent,\n defaultExpandAll: props.defaultExpandAll,\n filterNodeMethod: props.filterNodeMethod,\n })\n )\n\n store.value.initialize()\n\n const root = ref<Node>(store.value.root)\n const currentNode = ref<Node>(null)\n const el$ = ref<Nullable<HTMLElement>>(null)\n const dropIndicator$ = ref<Nullable<HTMLElement>>(null)\n\n const { broadcastExpanded } = useNodeExpandEventBroadcast(props)\n\n const { dragState } = useDragNodeHandler({\n props,\n ctx,\n el$,\n dropIndicator$,\n store,\n })\n\n useKeydown({ el$ }, store)\n\n const isEmpty = computed(() => {\n const { childNodes } = root.value\n const hasFilteredOptions = selectInfo\n ? selectInfo.hasFilteredOptions !== 0\n : false\n return (\n (!childNodes ||\n childNodes.length === 0 ||\n childNodes.every(({ visible }) => !visible)) &&\n !hasFilteredOptions\n )\n })\n\n watch(\n () => props.currentNodeKey,\n (newVal) => {\n store.value.setCurrentNodeKey(newVal)\n }\n )\n\n watch(\n () => props.defaultCheckedKeys,\n (newVal) => {\n store.value.setDefaultCheckedKey(newVal)\n }\n )\n\n watch(\n () => props.defaultExpandedKeys,\n (newVal) => {\n store.value.setDefaultExpandedKeys(newVal)\n }\n )\n\n watch(\n () => props.data,\n (newVal) => {\n store.value.setData(newVal)\n },\n { deep: true }\n )\n\n watch(\n () => props.checkStrictly,\n (newVal) => {\n store.value.checkStrictly = newVal\n }\n )\n\n const filter = (value) => {\n if (!props.filterNodeMethod)\n throw new Error('[Tree] filterNodeMethod is required when filter')\n store.value.filter(value)\n }\n\n const getNodeKey = (node: Node) => {\n return getNodeKeyUtil(props.nodeKey, node.data)\n }\n\n const getNodePath = (data: TreeKey | TreeNodeData) => {\n if (!props.nodeKey)\n throw new Error('[Tree] nodeKey is required in getNodePath')\n const node = store.value.getNode(data)\n if (!node) return []\n const path = [node.data]\n let parent = node.parent\n while (parent && parent !== root.value) {\n path.push(parent.data)\n parent = parent.parent\n }\n return path.reverse()\n }\n\n const getCheckedNodes = (\n leafOnly?: boolean,\n includeHalfChecked?: boolean\n ): TreeNodeData[] => {\n return store.value.getCheckedNodes(leafOnly, includeHalfChecked)\n }\n\n const getCheckedKeys = (leafOnly?: boolean): TreeKey[] => {\n return store.value.getCheckedKeys(leafOnly)\n }\n\n const getCurrentNode = (): TreeNodeData => {\n const currentNode = store.value.getCurrentNode()\n return currentNode ? currentNode.data : null\n }\n\n const getCurrentKey = (): any => {\n if (!props.nodeKey)\n throw new Error('[Tree] nodeKey is required in getCurrentKey')\n const currentNode = getCurrentNode()\n return currentNode ? currentNode[props.nodeKey] : null\n }\n\n const setCheckedNodes = (nodes: Node[], leafOnly?: boolean) => {\n if (!props.nodeKey)\n throw new Error('[Tree] nodeKey is required in setCheckedNodes')\n store.value.setCheckedNodes(nodes, leafOnly)\n }\n\n const setCheckedKeys = (keys: TreeKey[], leafOnly?: boolean) => {\n if (!props.nodeKey)\n throw new Error('[Tree] nodeKey is required in setCheckedKeys')\n store.value.setCheckedKeys(keys, leafOnly)\n }\n\n const setChecked = (\n data: TreeKey | TreeNodeData,\n checked: boolean,\n deep: boolean\n ) => {\n store.value.setChecked(data, checked, deep)\n }\n\n const getHalfCheckedNodes = (): TreeNodeData[] => {\n return store.value.getHalfCheckedNodes()\n }\n\n const getHalfCheckedKeys = (): TreeKey[] => {\n return store.value.getHalfCheckedKeys()\n }\n\n const setCurrentNode = (node: Node, shouldAutoExpandParent = true) => {\n if (!props.nodeKey)\n throw new Error('[Tree] nodeKey is required in setCurrentNode')\n\n handleCurrentChange(store, ctx.emit, () => {\n broadcastExpanded(node)\n store.value.setUserCurrentNode(node, shouldAutoExpandParent)\n })\n }\n\n const setCurrentKey = (key?: TreeKey, shouldAutoExpandParent = true) => {\n if (!props.nodeKey)\n throw new Error('[Tree] nodeKey is required in setCurrentKey')\n\n handleCurrentChange(store, ctx.emit, () => {\n broadcastExpanded()\n store.value.setCurrentNodeKey(key, shouldAutoExpandParent)\n })\n }\n\n const getNode = (data: TreeKey | TreeNodeData): Node => {\n return store.value.getNode(data)\n }\n\n const remove = (data: TreeNodeData | Node) => {\n store.value.remove(data)\n }\n\n const append = (\n data: TreeNodeData,\n parentNode: TreeNodeData | TreeKey | Node\n ) => {\n store.value.append(data, parentNode)\n }\n\n const insertBefore = (\n data: TreeNodeData,\n refNode: TreeKey | TreeNodeData | Node\n ) => {\n store.value.insertBefore(data, refNode)\n }\n\n const insertAfter = (\n data: TreeNodeData,\n refNode: TreeKey | TreeNodeData | Node\n ) => {\n store.value.insertAfter(data, refNode)\n }\n\n const handleNodeExpand = (\n nodeData: TreeNodeData,\n node: Node,\n instance: ComponentInternalInstance\n ) => {\n broadcastExpanded(node)\n ctx.emit('node-expand', nodeData, node, instance)\n }\n\n const updateKeyChildren = (key: TreeKey, data: TreeData) => {\n if (!props.nodeKey)\n throw new Error('[Tree] nodeKey is required in updateKeyChild')\n store.value.updateChildren(key, data)\n }\n\n provide('RootTree', {\n ctx,\n props,\n store,\n root,\n currentNode,\n instance: getCurrentInstance(),\n } as any)\n\n provide(formItemContextKey, undefined)\n\n return {\n ns,\n // ref\n store,\n root,\n currentNode,\n dragState,\n el$,\n dropIndicator$,\n\n // computed\n isEmpty,\n\n // methods\n filter,\n getNodeKey,\n getNodePath,\n getCheckedNodes,\n getCheckedKeys,\n getCurrentNode,\n getCurrentKey,\n setCheckedNodes,\n setCheckedKeys,\n setChecked,\n getHalfCheckedNodes,\n getHalfCheckedKeys,\n setCurrentNode,\n setCurrentKey,\n t,\n getNode,\n remove,\n append,\n insertBefore,\n insertAfter,\n handleNodeExpand,\n updateKeyChildren,\n }\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;AAqEA,MAAKA,SAAA,GAAaC,eAAa;EAC7BC,IAAM;EACNC,UAAA,EAAY;IAAEC;EAAW;EACzBC,KAAO;IACLC,IAAM;MACJC,IAAM,EAAAC,KAAA;MACNC,OAAA,EAASA,CAAA,KAAM;IAAC,CAClB;IACAC,SAAW;MACTH,IAAM,EAAAI;IAAA,CACR;IACAC,iBAAmB;MACjBL,IAAM,EAAAM,OAAA;MACNJ,OAAS;IAAA,CACX;IACAK,OAAS,EAAAH,MAAA;IACTI,aAAe,EAAAF,OAAA;IACfG,gBAAkB,EAAAH,OAAA;IAClBI,iBAAmB;MACjBV,IAAM,EAAAM,OAAA;MACNJ,OAAS;IAAA,CACX;IACAS,gBAAkB,EAAAL,OAAA;IAClBM,gBAAkB;MAChBZ,IAAM,EAAAM,OAAA;MACNJ,OAAS;IAAA,CACX;IACAW,gBAAkB;MAChBb,IAAM,EAAAM,OAAA;MACNJ,OAAS;IAAA,CACX;IACAY,kBAAoB,EAAAb,KAAA;IAGpBc,mBAAqB,EAAAd,KAAA;IAGrBe,cAAA,EAAgB,CAACZ,MAAA,EAAQa,MAAM;IA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