UNPKG

vue-tree-polyfill

Version:

A vue tree component using virtual list.

1,585 lines 80 kB
var It = Object.defineProperty; var Vt = (s, d, t) => d in s ? It(s, d, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[d] = t; var W = (s, d, t) => (Vt(s, typeof d != "symbol" ? d + "" : d, t), t); import { defineComponent as Ne, openBlock as U, createElementBlock as J, createElementVNode as E, computed as C, ref as _, h as Ht, getCurrentInstance as Be, normalizeClass as F, unref as y, Fragment as Ce, renderList as ve, normalizeStyle as Fe, createCommentVNode as ye, mergeProps as he, toHandlers as me, withDirectives as _e, vShow as De, createBlock as Ee, renderSlot as le, resolveDynamicComponent as Ut, createTextVNode as Qe, toDisplayString as Ae, onMounted as Ie, onBeforeUnmount as it, nextTick as Je, mergeDefaults as Ge, watch as $e, reactive as Ze, toRefs as Pt, withModifiers as rt, withCtx as be, createVNode as Ke, Transition as dt, vModelText as Wt, createSlots as ct, normalizeProps as Le, guardReactiveProps as Te } from "vue"; const Rt = [ "_level", "_filterVisible", "_parent", "_loading", "_loaded", "_remote", "_keyField", "children", "setChildren" ]; class ge { //#endregion Properties constructor(d, t = null, e = "id", a = !1) { /** 节点层级 */ W(this, "_level", 0); /** 多选是否选中 */ W(this, "checked", !1); /** 单选是否选中 */ W(this, "selected", !1); /** 是否半选状态 */ W(this, "indeterminate", !1); /** 是否禁用 */ W(this, "disabled", !1); /** 是否展开 */ W(this, "expand", !1); /** 是否可见 */ W(this, "visible", !0); /** 过滤后是否可见,如果为 false 则在其他可见情况下也是不可见的 */ W(this, "_filterVisible", !0); /** 父节点 */ W(this, "_parent", null); /** 子节点 */ W(this, "children", []); /** 是否是子节点 */ W(this, "isLeaf", !1); /** 节点是否正在加载 */ W(this, "_loading", !1); /** 子节点是否已加载 */ W(this, "_loaded", !1); this._keyField = e, this._remote = a; for (let l in d) Rt.indexOf(l) === -1 && (this[l] = d[l]); this[e] == null && (this[e] = Math.random().toString(36).substring(2)), this._parent = t, this._parent && (this._level = this._parent._level + 1), this.visible = this._parent === null || this._parent.expand && this._parent.visible, Array.isArray(d.children) && this.setChildren(d.children), this.children.length && (this._loaded = !0), this._remote || (this.isLeaf = !this.children.length); } /** * 设置子节点 * @param children 子节点数据数组 */ setChildren(d) { this.children = d.map((t) => new ge( Object.assign({}, t), this, this._keyField, this._remote )); } } var Oe = /* @__PURE__ */ ((s) => (s.none = "none", s.parents = "parents", s.children = "children", s))(Oe || {}); const ht = [ "setData", "setChecked", "setCheckedKeys", "checkAll", "clearChecked", "setSelected", "clearSelected", "setExpand", "setExpandKeys", "setExpandAll", "getCheckedNodes", "getCheckedKeys", "getIndeterminateNodes", "getSelectedNode", "getSelectedKey", "getExpandNodes", "getExpandKeys", "getCurrentVisibleNodes", "getNode", "getTreeData", "getFlatData", "getNodesCount", "insertBefore", "insertAfter", "append", "prepend", "remove", "filter", "showCheckedNodes", "loadRootNodes", "updateNode", "updateNodes", "scrollTo" ], jt = [...ht, "clearKeyword", "getKeyword", "search"]; var ut = /* @__PURE__ */ ((s) => (s["bottom-start"] = "bottom-start", s["bottom-end"] = "bottom-end", s.bottom = "bottom", s["top-start"] = "top-start", s["top-end"] = "top-end", s.top = "top", s))(ut || {}), Me = /* @__PURE__ */ ((s) => (s.top = "top", s.center = "center", s.bottom = "bottom", s))(Me || {}), ue = /* @__PURE__ */ ((s) => (s.before = "before", s.body = "body", s.after = "after", s))(ue || {}), qe = /* @__PURE__ */ ((s) => (s.dashed = "dashed", s.solid = "solid", s))(qe || {}); class Xt { constructor() { /** 事件 listeners */ W(this, "listenersMap", {}); } on(d, t) { this.listenersMap[d] || (this.listenersMap[d] = []); let e = []; Array.isArray(t) ? e = t : e = [t], e.forEach((a) => { this.listenersMap[d].indexOf(a) === -1 && this.listenersMap[d].push(a); }); } off(d, t) { if (this.listenersMap[d]) if (!t) this.listenersMap[d] = []; else { const e = this.listenersMap[d].indexOf(t); e > -1 && this.listenersMap[d].splice(e, 1); } } emit(d, ...t) { if (!this.listenersMap[d]) return; const e = this.listenersMap[d].length; for (let a = 0; a < e; a++) this.listenersMap[d][a](...t); } disposeListeners() { for (const d in this.listenersMap) this.listenersMap[d] = []; } } class Yt extends Xt { //#endregion Properties constructor(t) { super(); //#region Properties /** 树数据 */ W(this, "data", []); /** 扁平化的树数据 */ W(this, "flatData", []); /** 树数据 map */ W(this, "mapData", /* @__PURE__ */ Object.create(null)); /** 未加载但已选中的节点 key ,每次 flattenData 的时候进行检查,将加载的节点从此数组中剔除 */ W(this, "unloadCheckedKeys", []); /** 未加载但选中的单选节点 key */ W(this, "unloadSelectedKey", null); /** 当前单选选中节点 key */ W(this, "currentSelectedKey", null); this.options = t; } /** * Use this function to insert nodes into flatData to avoid 'maximun call stack size exceeded' error * @param insertIndex The index to insert, the same usage as `this.flatData.splice(insertIndex, 0, insertNodes)` * @param insertNodes Tree nodes to insert */ insertIntoFlatData(t, e) { this.flatData = this.flatData.slice(0, t).concat(e, this.flatData.slice(t)); } setData(t, e = null, a = null) { this.data = t.map( (l) => new ge(l, null, this.options.keyField, !!this.options.load) ); for (let l in this.mapData) delete this.mapData[l]; this.currentSelectedKey = null, this.flatData = this.flattenData(this.data), this.setUnloadCheckedKeys(a || []), e && (this.currentSelectedKey = null, this.setUnloadSelectedKey(e)), this.emit("visible-data-change"), this.emit("set-data"); } //#region Set api /** * 设置单个节点多选选中 * @param key 设置的节点 key * @param value 是否选中 * @param triggerEvent 是否触发事件 * @param triggerDataChange 是否触发 `data-change` 事件以通知外部刷新视图 * @param filtering 是否正在过滤,如果是,则考虑 `filteredNodeCheckable` Prop,用于判断是否是用户点击节点触发的勾选 */ setChecked(t, e, a = !0, l = !0, o = !1) { const n = this.mapData[t]; if (!n) return this.setUnloadChecked(t, e, a, l); n.disabled || n.checked && e || !n.checked && !n.indeterminate && !e || (this.options.cascade ? (this.checkNodeDownward(n, e, o), this.checkNodeUpward(n)) : n.checked = e, a && (n.checked ? this.emit("check", n) : this.emit("uncheck", n)), this.triggerCheckedChange(a, l)); } /** * 设置单个未加载节点选中,不公开此 API */ setUnloadChecked(t, e, a = !0, l = !0) { const o = this.findIndex(t, this.unloadCheckedKeys); e ? o === -1 && this.unloadCheckedKeys.push(t) : o !== -1 && this.unloadCheckedKeys.splice(o, 1), this.triggerCheckedChange(a, l); } /** * 批量选中/取消多选选中节点 * @param keys 选中的节点 key 数组 * @param value 是否选中 * @param triggerEvent 是否触发事件 */ setCheckedKeys(t, e, a = !0, l = !0) { t.forEach((o) => { this.setChecked(o, e, !1, !1); }), this.triggerCheckedChange(a, l); } /** * 多选勾选全部节点 * @param triggerEvent 是否触发事件 * @param triggerDataChange 是否触发视图刷新 */ checkAll(t = !0, e = !0) { if (this.options.cascade) { const a = (l) => { l.forEach((o) => { o.disabled ? a(o.children) : this.setChecked(o[this.options.keyField], !0, !1, !1); }); }; a(this.data); } else { const a = this.flatData.length; for (let l = 0; l < a; l++) { const o = this.flatData[l]; this.setChecked(o[this.options.keyField], !0, !1, !1); } } this.triggerCheckedChange(t, e); } /** * 清除所有多选已选 * @param triggerEvent 是否触发事件 * @param triggerDataChange 是否触发视图刷新 */ clearChecked(t = !0, e = !0) { this.getCheckedNodes().forEach((l) => { this.setChecked(l[this.options.keyField], !1, !1, !1); }), this.unloadCheckedKeys = [], this.triggerCheckedChange(t, e); } /** * 触发 checked-change 的快捷方法 * @param triggerEvent 是否触发事件 * @param triggerDataChange 是否触发视图刷新 */ triggerCheckedChange(t = !0, e = !0) { t && this.emit("checked-change", this.getCheckedNodes(), this.getCheckedKeys()), e && this.emit("render-data-change"); } /** * 触发 selected-change 的快捷方法 * @param triggerEvent 是否触发事件 * @param triggerDataChange 是否触发视图刷新 */ triggerSelectedChange(t = !0, e = !0) { t && this.emit("selected-change", this.getSelectedNode(), this.getSelectedKey()), e && this.emit("render-data-change"); } /** * 设置单选选中 * @param key 选中节点 key * @param value 是否选中 * @param triggerEvent 是否触发事件 */ setSelected(t, e, a = !0, l = !0) { const o = this.mapData[t]; if (!o) return this.setUnloadSelected(t, e, a, l); o.disabled || o.selected !== e && (t === this.currentSelectedKey ? e || (o.selected = e, this.currentSelectedKey = null) : e && (this.currentSelectedKey !== null && this.mapData[this.currentSelectedKey] && (this.mapData[this.currentSelectedKey].selected = !1), o.selected = e, this.currentSelectedKey = o[this.options.keyField], this.unloadSelectedKey = null), a && (o.selected ? this.emit("select", o) : this.emit("unselect", o)), this.triggerSelectedChange(a, l)); } /** * 设置未加载单选选中节点,不公开此 API */ setUnloadSelected(t, e, a = !0, l = !0) { e ? (this.currentSelectedKey = null, this.unloadSelectedKey = t) : this.unloadSelectedKey === t && (this.unloadSelectedKey = null), this.triggerSelectedChange(a, l); } /** * 清除当前单选选中 * @param triggerEvent 是否触发事件 * @param triggerDataChange 是否触发视图刷新 */ clearSelected(t = !0, e = !0) { this.currentSelectedKey && this.mapData[this.currentSelectedKey] ? this.setSelected( this.currentSelectedKey, !1, t, e ) : this.unloadSelectedKey !== null && (this.unloadSelectedKey = null, this.triggerSelectedChange(t, e)); } /** * 设置节点展开 * @param key 节点 key * @param value 是否展开 * @param expandParent 展开节点时是否同时展开父节点 * @param triggerEvent 是否触发事件 * @param triggerDataChange 是否触发 `data-change` 事件以通知外部刷新视图 */ setExpand(t, e, a = !1, l = !0, o = !0) { const n = this.mapData[t]; if (!(!n || !a && n.isLeaf) && n.expand !== e) { if (!n.isLeaf) { if (typeof this.options.load == "function") { if (!n._loaded && !n._loading && e) { n._loading = !0, o && this.emit("visible-data-change"), new Promise((c, f) => { const v = this.options.load; v(n, c, f); }).then((c) => { Array.isArray(c) && (this.loadChildren(n, c, e), this.emit("set-data")); }).catch((c) => { let f = c; c instanceof Error || (f = new Error(c)), console.error("[VTree] load tree nodes error.", f); }).then(() => { n._loading = !1, l && this.emit("expand", n), o && this.emit("visible-data-change"); }); return; } else if (n._loading) return; } n.expand = e; let r = n.children.concat(); for (; r.length; ) { const c = r.pop(); c && (c.expand && c.children.length && (r = c.children.concat(r)), c._filterVisible === !1 ? c.visible = !1 : c.visible = c._parent === null || c._parent.expand && c._parent.visible); } l && this.emit("expand", n), o && this.emit("visible-data-change"); } a && n._parent && e && this.setExpand( n._parent[this.options.keyField], e, a, !1, o ); } } /** * 批量设置节点展开/折叠 * @param keys 展开的节点 key 数组 * @param value 是否展开 */ setExpandKeys(t, e, a = !0) { t.forEach((l) => { this.setExpand(l, e, !1, !1, !1); }), a && this.emit("visible-data-change"); } setExpandAll(t, e = !0) { this.flatData.forEach((a) => { (!this.options.load || a._loaded) && this.setExpand(a[this.options.keyField], t, !1, !1, !1); }), e && this.emit("visible-data-change"); } isChildrenChanged(t, e) { var a; return "children" in e && (!!t.children.length || !!((a = e.children) != null && a.length)); } updateNode(t, e, a = !0, l = !0) { var T; const o = this.mapData[t]; if (!o) return; const n = {}, r = [ this.options.keyField, "indeterminate", "visible", "isLeaf" ]; Object.keys(e).forEach((D) => { !D.startsWith("_") && !r.includes(D) && (n[D] = e[D]); }); const c = this.getCheckedKeys(), f = this.getSelectedKey(); let v = this.isChildrenChanged(o, n); "children" in n && (o.children.length || (T = n.children) != null && T.length) && (this.removeChildren(t, !1, !1), Array.isArray(n.children) && this.loadChildren(o, n.children, o.expand), delete n.children), "checked" in n && (this.setChecked(t, n.checked, !1, !1), delete n.checked), "selected" in n && (this.setSelected(t, n.selected, !1, !1), delete n.selected), "expand" in n && (this.setExpand(t, n.expand, !1, !1, !1), delete n.expand), Object.keys(n).forEach((D) => { o[D] = n[D]; }); const b = this.getCheckedKeys(), V = this.getSelectedKey(); a && (JSON.stringify(b.sort()) !== JSON.stringify(c.sort()) && this.triggerCheckedChange(!0, !1), V !== f && this.triggerSelectedChange(!0, !1)), l && (v && this.emit("set-data"), this.emit("visible-data-change")); } updateNodes(t) { const e = t.filter((c) => c[this.options.keyField] != null); if (!e.length) return; const a = this.getCheckedKeys(), l = this.getSelectedKey(); let o = !1; e.forEach((c) => { const f = c[this.options.keyField], v = this.mapData[f]; v && (o = o || this.isChildrenChanged(v, c), this.updateNode(f, c, !1, !1)); }); const n = this.getCheckedKeys(), r = this.getSelectedKey(); JSON.stringify(n.sort()) !== JSON.stringify(a.sort()) && this.triggerCheckedChange(!0, !1), r !== l && this.triggerSelectedChange(!0, !1), o && this.emit("set-data"), this.emit("visible-data-change"); } //#endregion Set api //#region Get api /** * 获取多选选中节点 * @param ignoreMode 忽略模式,可选择忽略父节点或子节点,默认值是 VTree 的 ignoreMode Prop */ getCheckedNodes(t = this.options.ignoreMode) { if (t === Oe.children) { const e = [], a = (l) => { l.forEach((o) => { o.checked ? e.push(o) : !o.isLeaf && o.indeterminate && a(o.children); }); }; return a(this.data), e; } else return this.flatData.filter((e) => t === Oe.parents ? e.checked && e.isLeaf : e.checked); } /** * 获取多选选中的节点 key ,包括未加载的 key * @param ignoreMode 忽略模式,同 `getCheckedNodes` */ getCheckedKeys(t = this.options.ignoreMode) { return this.getCheckedNodes(t).map((e) => e[this.options.keyField]).concat(this.unloadCheckedKeys); } /** * 获取多选半选状态节点 */ getIndeterminateNodes() { return this.flatData.filter((t) => t.indeterminate); } /** * 获取当前单选选中节点 */ getSelectedNode() { return this.currentSelectedKey === null ? null : this.mapData[this.currentSelectedKey] || null; } /** * 获取当前单选选中节点 key ,有可能是未加载的选中项 */ getSelectedKey() { return this.currentSelectedKey || this.unloadSelectedKey || null; } /** * 获取未加载但多选选中的节点 */ getUnloadCheckedKeys() { return this.unloadCheckedKeys; } /** * 获取展开节点 */ getExpandNodes() { return this.flatData.filter((t) => !t.isLeaf && t.expand); } /** * 获取展开节点 keys */ getExpandKeys() { return this.getExpandNodes().map((t) => t[this.options.keyField]); } /** * 根据节点 key 获取节点 * @param key 节点 key */ getNode(t) { return this.mapData[t] || null; } //#endregion Get api //#region Node transfer api // 这边的 referenceKey 都是被执行的节点,比如 insertBefore ,在这里 referenceKey 就是指要插入到 referenceKey 节点前面 insertBefore(t, e, a = !0, l = !0) { const o = this.getInsertedNode(t, e); if (!o) return null; this.remove(o[this.options.keyField], !1, !1); const r = this.mapData[e]._parent, c = this.findIndex( e, r && r.children ), f = this.findIndex(e), v = r && -1 || this.findIndex(e, this.data); return this.insertIntoStore(o, r, c, f, v, a, l), l && this.emit("visible-data-change"), o; } insertAfter(t, e, a = !0, l = !0) { const o = this.getInsertedNode(t, e); if (!o) return null; this.remove(o[this.options.keyField], !1, !1); const n = this.mapData[e], r = n._parent, c = this.findIndex(e, r && r.children) + 1, f = this.flatData.length, v = this.findIndex(e); let b = v + 1; for (let T = v + 1; T <= f; T++) { if (T === f) { b = T; break; } if (this.flatData[T]._level <= n._level) { b = T; break; } } const V = r && -1 || this.findIndex(e, this.data) + 1; return this.insertIntoStore(o, r, c, b, V, a, l), l && this.emit("visible-data-change"), o; } append(t, e, a = !0, l = !0) { const o = this.mapData[e]; if (!o.isLeaf) { const c = o.children.length; return this.insertAfter( t, o.children[c - 1][this.options.keyField], a, l ); } const n = this.getInsertedNode(t, e, !0); if (!n) return null; this.remove(n[this.options.keyField], !1, !1); const r = this.findIndex(e) + 1; return this.insertIntoStore(n, o, 0, r, void 0, a, l), l && this.emit("visible-data-change"), n; } prepend(t, e, a = !0, l = !0) { const o = this.mapData[e]; if (!o.isLeaf) return this.insertBefore( t, o.children[0][this.options.keyField], a, l ); const n = this.getInsertedNode(t, e, !0); if (!n) return null; this.remove(n[this.options.keyField], !1, !1); const r = this.findIndex(e) + 1; return this.insertIntoStore(n, o, 0, r, void 0, a, l), l && this.emit("visible-data-change"), n; } /** * 删除节点 * @param removedKey 要删除的节点 key */ remove(t, e = !0, a = !0) { const l = this.mapData[t]; if (!l) return null; const o = this.findIndex(l); if (o === -1) return null; let n = 1; const r = this.flatData.length; for (let f = o + 1; f < r && this.flatData[f]._level > l._level; f++) n++; this.flatData.splice(o, n); const c = (f) => { const v = this.mapData[f]; delete this.mapData[f], v.children.forEach((b) => c(b[this.options.keyField])); }; if (c(t), !l._parent) { const f = this.findIndex(l, this.data); f > -1 && this.data.splice(f, 1); } if (l._parent) { const f = this.findIndex(l, l._parent.children); f !== -1 && l._parent.children.splice(f, 1), l._parent.isLeaf = !l._parent.children.length, l._parent.isLeaf && (l._parent.expand = !1, l._parent.indeterminate = !1), this.updateMovingNodeStatus(l, e, a); } return a && this.emit("visible-data-change"), l; } removeChildren(t, e = !0, a = !0) { const l = this.mapData[t]; if (!l || !l.children.length) return null; let n = l.children[0]; const r = this.findIndex(l); if (r === -1) return null; let c = 0; const f = this.flatData.length; for (let v = r + 1; v < f && this.flatData[v]._level > l._level; v++) delete this.mapData[this.flatData[v][this.options.keyField]], c++, this.flatData[v].selected && (n = this.flatData[v]); return this.flatData.splice(r + 1, c), l.children.splice(0, l.children.length), l.isLeaf = !0, l.indeterminate = !1, this.updateMovingNodeStatus(n, e, a), a && this.emit("visible-data-change"), l; } loadChildren(t, e, a) { const l = this.findIndex(t); if (l === -1) return; t._loaded = !0, t.expand = a, t.setChildren(e), t.isLeaf = !t.children.length; const o = this.getCheckedKeys(), n = this.flattenData( t.children, this.getSelectedKey() === null ); this.insertIntoFlatData(l + 1, n), this.setUnloadCheckedKeys(o), this.unloadSelectedKey !== null && this.setUnloadSelectedKey(this.unloadSelectedKey), this.checkNodeUpward(t, !0); } getInsertedNode(t, e, a = !1) { const l = this.mapData[e]; if (!l) return null; const o = a ? l : l._parent; if (t instanceof ge) return t[this.options.keyField] === e ? null : t; if (typeof t == "object") { if (t[this.options.keyField] === e) return null; const n = this.mapData[t[this.options.keyField]]; return n || new ge( t, o, this.options.keyField, !!this.options.load ); } else return !this.mapData[t] || t === e ? null : this.mapData[t]; } /** * 将一个节点插入 store 记录中 * @param node 要插入的节点 * @param parentNode 要插入节点的父节点 * @param childIndex 如果有父节点,则需提供要插入的节点在同级节点中的顺序 * @param flatIndex 在 flatData 中的索引 * @param dataIndex 如果没有父节点,需要提供节点在 data 中的索引 */ insertIntoStore(t, e, a, l, o, n = !0, r = !0) { if (l === -1) return; a !== -1 && e && e.children.splice(a, 0, t), t._parent = e, e ? (e.isLeaf = !1, this.setExpand( e[this.options.keyField], !0, !1, !1, !1 )) : typeof o == "number" && o > -1 && this.data.splice(o, 0, t); const c = this.flattenData([t]); t._level = e ? e._level + 1 : 0, c.forEach( (f) => f._level = f._parent ? f._parent._level + 1 : 0 ), this.insertIntoFlatData(l, c), this.updateMovingNodeStatus(t, n, r); } updateMovingNodeStatus(t, e = !0, a = !0) { this.checkNodeUpward(t), this.triggerCheckedChange(e, a), t.selected && this.setSelected(t[this.options.keyField], !0, e, a); } //#endregion Node transfer api /** * 过滤本地节点数据 * @param keyword 过滤关键词 * @param filterMethod 过滤方法 */ filter(t, e) { const a = []; this.flatData.forEach((l) => { l._filterVisible = l._parent && l._parent._filterVisible || e(t, l), l.visible = l._filterVisible, l._filterVisible && a.push(l); }), a.forEach((l) => { const o = []; let n = l._parent; for (; n; ) o.unshift(n), n = n._parent; o.forEach((r) => { r._filterVisible = !0, r.visible = (r._parent === null || r._parent.expand && r._parent.visible) && r._filterVisible, this.options.expandOnFilter && this.setExpand( r[this.options.keyField], !0, !1, !1, !1 ); }), l.visible = l._parent === null || l._parent.expand && l._parent.visible; }), this.emit("visible-data-change"); } /** * 过滤未加载多选节点,对比最终勾选节点是否有变化并触发 checked-change 事件 * @param keys 全量选中节点 key 数组,包括加载与未加载选中节点 */ setUnloadCheckedKeys(t) { this.unloadCheckedKeys = t; const e = t.concat(), a = this.unloadCheckedKeys.length; for (let o = a - 1; o >= 0; o--) { const n = this.unloadCheckedKeys[o]; this.mapData[n] && (this.setChecked(n, !0, !1, !1), this.unloadCheckedKeys.splice(o, 1)); } const l = this.getCheckedKeys(); l.length === e.length && l.every( (o) => e.some((n) => n === o) ) || this.emit("checked-change", this.getCheckedNodes(), l); } /** * 过滤未加载单选选中节点,对比是否有变化并触发 selected-change 事件 * @param key 节点 key */ setUnloadSelectedKey(t) { const e = this.getSelectedKey(); this.mapData[t] ? (this.setSelected(t, !0, !1), this.unloadSelectedKey = null) : (this.currentSelectedKey && this.setSelected(this.currentSelectedKey, !1, !1), this.unloadSelectedKey = t); const a = this.getSelectedKey(); a !== e && this.emit("selected-change", this.getSelectedNode(), a); } /** * 保存扁平化的节点数据 `flatData` 与节点数据 Map `mapData` * @param nodes 树状节点数据 * @param overrideSelected 是否根据数据设置 `selected` */ flattenData(t, e = !0, a = []) { const l = t.length; for (let o = 0; o < l; o++) { const n = t[o], r = n[this.options.keyField]; if (a.push(n), this.mapData[r]) throw new Error("[VTree] Duplicate tree node key."); this.mapData[r] = n, n.checked && this.options.cascade && this.checkNodeDownward(n, !0), n.selected && e && (this.clearSelected(!1, !1), this.currentSelectedKey = n[this.options.keyField], this.emit("selected-change", n, this.currentSelectedKey)), (this.options.defaultExpandAll || n.expand) && !this.options.load && !n.isLeaf && (n.expand = !1, this.setExpand(n[this.options.keyField], !0, !1, !1, !1)), n.children.length && this.flattenData(n.children, e, a); } return this.options.cascade && l && this.checkNodeUpward(t[0]), a; } //#region Check nodes /** * 向下勾选/取消勾选节点,包括自身 * @param node 需要向下勾选的节点 * @param value 勾选或取消勾选 * @param filtering 是否正在过滤,如果是,则考虑 `filteredNodeCheckable` Prop */ checkNodeDownward(t, e, a = !1) { if (t.children.forEach((l) => { this.checkNodeDownward(l, e, a); }), t.isLeaf || this.options.load && !t.children.length) { if (!t.disabled) { if (a && !this.options.filteredNodeCheckable && !t._filterVisible) return; t.checked = e, t.indeterminate = !1; } } else this.checkParentNode(t); } /** * 向上勾选/取消勾选父节点,不包括自身 * @param node 需要勾选的节点 * @param fromCurrentNode 是否从当前节点开始处理 */ checkNodeUpward(t, e = !1) { let a = e ? t : t._parent; for (; a; ) this.checkParentNode(a), a = a._parent; } /** * 根据子节点的勾选状态更新当前父节点的勾选状态 * @param node 需要勾选的节点 */ checkParentNode(t) { const e = t.children.length; if (!e) return; let a = !1, l = !1, o = !1; for (let n = 0; n < e; n++) { const r = t.children[n]; if (r.checked ? a = !0 : l = !0, a && l || r.indeterminate) { o = !0, t.checked = !1, t.indeterminate = !0; break; } } o || (t.checked = a, t.indeterminate = !1); } //#endregion Check nodes //#region Utils /** * 搜索节点在指定数组中的位置 */ findIndex(t, e = this.flatData) { if (e !== null) { let a = t instanceof ge ? t[this.options.keyField] : t; const l = e.length; for (let o = 0; o < l; o++) if (e[0] instanceof ge) { if (a === e[o][this.options.keyField]) return o; } else if (a === e[o]) return o; } return -1; } //#endregion Utils } const zt = Ne({ name: "CLoadingIcon" }), Jt = (s, d) => { const t = s.__vccOpts || s; for (const [e, a] of d) t[e] = a; return t; }, qt = { viewBox: "0 0 50 50" }, Qt = /* @__PURE__ */ E("circle", { class: "vtree-loading-icon__circle", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5", "stroke-miterlimit": "10" }, null, -1), Gt = [ Qt ]; function Zt(s, d, t, e, a, l) { return U(), J("svg", qt, Gt); } const ft = /* @__PURE__ */ Jt(zt, [["render", Zt]]), et = [ "expand", "check", "click", "select", "node-dblclick", "node-right-click", "node-dragstart", "node-dragenter", "node-dragover", "node-dragleave", "node-drop" ], pt = [ "expand", "select", "unselect", "selected-change", "check", "uncheck", "checked-change", "set-data" ], tt = [...et, ...pt], lt = ["search", ...tt], el = [ "clear", "dropdown-visible-change", ...lt ], B = "vtree-tree-node", tl = (s, d) => { const { dragoverBody: t, dragoverBefore: e, dragoverAfter: a } = d, l = C(() => [ `${B}__indent-wrapper` ]), o = C(() => { var D, H, R, A, $; return [ `${B}__wrapper`, { [`${B}__wrapper_is-leaf`]: (D = s.data) == null ? void 0 : D.isLeaf, [`${B}_disabled`]: s.disableAll || ((H = s.data) == null ? void 0 : H.disabled) }, // 复选 { [`${B}_checked`]: s.checkable && ((R = s.data) == null ? void 0 : R.checked), [`${B}_indeterminate`]: s.checkable && ((A = s.data) == null ? void 0 : A.indeterminate) }, // 单选 { [`${B}_selected`]: ($ = s.data) == null ? void 0 : $.selected } ]; }), n = C(() => [ `${B}__node-body`, { [`${B}__drop_active`]: t.value } ]), r = C(() => [ `${B}__drop`, { [`${B}__drop_active`]: e.value } ]), c = C(() => [ `${B}__drop`, { [`${B}__drop_active`]: a.value } ]), f = C(() => [`${B}__square`, `${B}__checkbox_wrapper`]), v = C(() => { var D; return [ `${B}__square`, `${B}__expand`, { [`${B}__expand_active`]: (D = s.data) == null ? void 0 : D.expand } ]; }), b = C(() => [`${B}__loading-icon`]), V = C(() => { var D, H, R; return [ `${B}__checkbox`, { [`${B}__checkbox_checked`]: (D = s.data) == null ? void 0 : D.checked, [`${B}__checkbox_indeterminate`]: (H = s.data) == null ? void 0 : H.indeterminate, [`${B}__checkbox_disabled`]: s.disableAll || ((R = s.data) == null ? void 0 : R.disabled) } ]; }), T = C(() => { var D, H; return [ `${B}__title`, { [`${B}__title_selected`]: (D = s.data) == null ? void 0 : D.selected, [`${B}__title_disabled`]: s.disableAll || ((H = s.data) == null ? void 0 : H.disabled) } ]; }); return { indentWrapperCls: l, wrapperCls: o, nodeBodyCls: n, dropBeforeCls: r, dropAfterCls: c, checkboxWrapperCls: f, expandCls: v, loadingIconCls: b, checkboxCls: V, titleCls: T }; }, ll = ["d", "stroke-width", "stroke", "stroke-dasharray"], nl = ["draggable"], ze = /* @__PURE__ */ Ne({ name: "VTreeNode", __name: "TreeNode", props: { titleField: {}, keyField: {}, checkable: { type: Boolean }, selectable: { type: Boolean }, unselectOnClick: { type: Boolean }, disableAll: { type: Boolean }, draggable: { type: Boolean }, droppable: { type: Boolean }, nodeIndent: {}, expandOnClickNode: { type: Boolean }, render: { type: Function }, showLine: { type: [Boolean, Object] }, data: {}, getNode: { type: Function }, noSiblingNodeMap: {} }, emits: [...et], setup(s, { emit: d }) { var h; const t = s, e = d, a = _(!1), l = _(!1), o = _(!1), n = C(() => { const i = { width: 1, type: qe.solid, color: "#D3D3D3", polyline: !1, dashDensity: 3 }; let m = i; if (typeof t.showLine == "object") { let O = i.dashDensity; typeof t.showLine.dashDensity == "number" && t.showLine.dashDensity >= 1 && t.showLine.dashDensity <= 10 && (O = t.showLine.dashDensity), m = { width: t.showLine.width ?? i.width, type: t.showLine.type ?? i.type, color: t.showLine.color ?? i.color, polyline: t.showLine.polyline ?? i.polyline, dashDensity: O }; } return m; }), r = C(() => n.value.width * 100 / t.nodeIndent), c = C(() => { switch (n.value.type) { case qe.dashed: return 100 / (n.value.dashDensity * 2); } return "none"; }), f = (i) => { var O; if (!n.value.polyline || !i) return "M50,0 L50,100"; const m = (O = t.getNode(t.data[t.keyField])) == null ? void 0 : O._parent; return m && t.noSiblingNodeMap[m[t.keyField]] && t.noSiblingNodeMap[t.data[t.keyField]] ? "M50,0 L50,50 M100,50 L50,50" : "M50,0 L50,100 M100,50 L50,50"; }, { indentWrapperCls: v, wrapperCls: b, nodeBodyCls: V, dropBeforeCls: T, dropAfterCls: D, checkboxWrapperCls: H, expandCls: R, loadingIconCls: A, checkboxCls: $, titleCls: M } = tl(t, { dragoverBody: a, dragoverBefore: l, dragoverAfter: o }), x = C(() => t.getNode(t.data ? t.data[t.keyField] : "") || t.data || {}), I = C(() => t.checkable), Y = ((h = t.data) == null ? void 0 : h.render) || t.render || null, G = C(() => Ne({ name: "Render", functional: !0, render() { return typeof Y != "function" ? Ht("div") : Y(x.value); } })), z = C(() => { var m; let i = {}; return t.draggable && !t.disableAll && !((m = t.data) != null && m.disabled) && (i = { dragstart: N }), i; }), j = C(() => { let i = {}; return t.droppable && (i = { dragenter: K.bind(Be()), dragover: Z.bind(Be()), dragleave: P.bind(Be()), drop: Q.bind(Be()) }), i; }); function ne() { var i; (i = t.data) != null && i.isLeaf || e("expand", x.value); } function ie() { var i; t.disableAll || (i = t.data) != null && i.disabled || !t.checkable || e("check", x.value); } const re = q((i) => { var m, O; if (e("click", x.value, i), t.selectable) { if (t.disableAll || (m = t.data) != null && m.disabled || (O = t.data) != null && O.selected && !t.unselectOnClick) return; e("select", x.value); } else t.checkable ? ie() : t.expandOnClickNode && ne(); }); function se(i) { e("node-dblclick", x.value, i); } function p(i) { e("node-right-click", x.value, i); } const g = _(); function L(i) { const m = g.value.getBoundingClientRect(), O = m.height, X = i.clientY - m.top; return X <= O * 0.3 ? ue.before : X <= O * (0.3 + 0.4) ? ue.body : ue.after; } function q(i, m = 200) { let O, X = 0; return (...de) => { X++, clearTimeout(O), O = setTimeout(() => { X === 1 && i(...de), X = 0; }, m); }; } function k(i, m = !1) { l.value = !1, a.value = !1, o.value = !1, m || (i === ue.before ? l.value = !0 : i === ue.body ? a.value = !0 : i === ue.after && (o.value = !0)); } function N(i) { var m; i.dataTransfer && i.dataTransfer.setData("node", JSON.stringify(t.data)), (m = t.data) != null && m.expand && ne(), e("node-dragstart", x.value, i); } function K(i) { i.preventDefault(); const m = L(i); k(m), e("node-dragenter", x.value, i, m); } function Z(i) { i.preventDefault(); const m = L(i); k(m), e("node-dragover", x.value, i, m); } function P(i) { const m = L(i); k(m, !0), e("node-dragleave", x.value, i, m); } function Q(i) { const m = L(i); k(m, !0), e("node-drop", x.value, i, m); } return (i, m) => { var O, X, de, oe; return U(), J("div", { class: F(y(v)) }, [ i.showLine ? (U(!0), J(Ce, { key: 0 }, ve(i.data._level, (fe, Ve) => (U(), J("svg", { key: fe, viewBox: "0 0 100 100", preserveAspectRatio: "none", style: Fe({ alignSelf: "stretch", width: `${i.nodeIndent}px` }) }, [ E("path", { fill: "none", d: f(Ve === i.data._level - 1), "stroke-width": r.value, stroke: n.value.color, "stroke-dasharray": c.value }, null, 8, ll) ], 4))), 128)) : ye("", !0), E("div", { class: F(y(b)), style: Fe({ paddingLeft: i.showLine ? "none" : `${i.data._level * i.nodeIndent}px` }) }, [ E("div", { class: F(y(T)) }, null, 2), E("div", he({ ref_key: "nodeBody", ref: g, class: y(V) }, me(j.value, !0)), [ E("div", { class: F(y(R)) }, [ _e(E("i", { onClick: ne }, null, 512), [ [De, !((O = i.data) != null && O.isLeaf) && !((X = i.data) != null && X._loading)] ]), (de = i.data) != null && de._loading ? (U(), Ee(ft, { key: 0, class: F(y(A)) }, null, 8, ["class"])) : ye("", !0) ], 2), I.value ? (U(), J("div", { key: 0, class: F(y(H)) }, [ E("div", { class: F(y($)), onClick: ie }, null, 2) ], 2)) : ye("", !0), E("div", he({ class: y(M), onClick: m[0] || (m[0] = //@ts-ignore (...fe) => y(re) && y(re)(...fe)), onDblclick: se, onContextmenu: p }, me(z.value, !0), { draggable: i.draggable && !i.disableAll && !((oe = i.data) != null && oe.disabled) }), [ le(i.$slots, "default", { node: x.value }, () => [ y(Y) ? (U(), Ee(Ut(G.value), { key: 0 })) : (U(), J(Ce, { key: 1 }, [ Qe(Ae(i.data ? i.data[i.titleField] : ""), 1) ], 64)) ]) ], 16, nl) ], 16), E("div", { class: F(y(D)) }, null, 2) ], 6) ], 2); }; } }), pe = "vtree-tree", al = () => { const s = C(() => [`${pe}__wrapper`]), d = C(() => [`${pe}__scroll-area`]), t = C(() => [`${pe}__block-area`]), e = C(() => [`${pe}__empty`]), a = C(() => [`${pe}__empty-text_default`]), l = C(() => [`${pe}__loading`]), o = C(() => [`${pe}__loading-wrapper`]), n = C(() => [`${pe}__loading-icon`]), r = C(() => [`${pe}__iframe`]); return { wrapperCls: s, scrollAreaCls: d, blockAreaCls: t, emptyCls: e, emptyTextDefaultCls: a, loadingCls: l, loadingWrapperCls: o, loadingIconCls: n, iframeCls: r }; }, sl = (s, d) => { const t = _(), e = _([]), a = _(0), l = _(0), o = _(0), n = _(0), r = _(0), c = _(0), f = _(0), v = _(0), b = _(void 0), V = () => { o.value = 0, n.value = 0, t.value && (t.value.scrollTop = 0); }, T = () => { const x = t.value.clientHeight; r.value = Math.max( d.renderNodeAmount, Math.ceil(x / d.nodeMinHeight) + d.bufferNodeAmount ); }, D = (x = !1) => { if (a.value > r.value) { const I = Math.max(t.value.scrollTop, 0), Y = Math.floor(I / d.nodeMinHeight); f.value = Math.floor(Y / d.bufferNodeAmount) * d.bufferNodeAmount; } else f.value = 0; x && c.value === r.value && v.value === f.value || (e.value = s.blockNodes.slice(f.value, f.value + r.value).map((I) => Object.assign({}, I, { _parent: null, children: [] })), o.value = f.value * d.nodeMinHeight, n.value = l.value - (o.value + e.value.length * d.nodeMinHeight)); }, H = () => { T(), D(); }, R = () => { s.blockNodes = s.store.flatData.filter( (x) => x.visible ), A(), H(); }, A = () => { a.value = s.blockNodes.length, l.value = d.nodeMinHeight * a.value; }; return { scrollArea: t, renderNodes: e, blockLength: a, blockAreaHeight: l, topSpaceHeight: o, bottomSpaceHeight: n, renderAmount: r, renderAmountCache: c, renderStart: f, renderStartCache: v, resetSpaceHeights: V, updateRenderAmount: T, updateRenderNodes: D, updateRender: H, updateBlockNodes: R, updateBlockData: A, handleTreeScroll: () => { b.value && window.cancelAnimationFrame(b.value), c.value = r.value, v.value = f.value, b.value = window.requestAnimationFrame( D.bind(null, !0) ); }, scrollTo: (x, I = Me.top) => { const Y = s.store.mapData[x]; if (!Y || !Y.visible) return; let G = -1; for (let j = 0; j < a.value; j++) if (s.blockNodes[j][d.keyField] === x) { G = j; break; } if (G === -1) return; let z = G * d.nodeMinHeight; if (I === Me.center) { const j = t.value.clientHeight; z = z - (j - d.nodeMinHeight) / 2; } else if (I === Me.bottom) { const j = t.value.clientHeight; z = z - (j - d.nodeMinHeight); } else typeof I == "number" && (z = z - I); t.value && (t.value.scrollTop = z); } }; }, ol = (s) => { const d = _(); Ie(() => { const t = d.value; t != null && t.contentWindow && t.contentWindow.addEventListener("resize", s); }), it(() => { const t = d.value; t != null && t.contentWindow && t.contentWindow.removeEventListener("resize", s); }); }, il = (s, d, t) => { const { resetSpaceHeights: e, updateExpandedKeys: a, updateBlockData: l, updateRender: o } = t, n = _([]), r = _(!1); function c(h) { e(); let i = null, m = null; d.checkable ? Array.isArray(d.modelValue) ? i = d.modelValue.concat() : typeof d.modelValue == "string" && (i = d.modelValue === "" ? [] : d.modelValue.split(d.separator)) : d.selectable && !Array.isArray(d.modelValue) && (m = d.modelValue), s.store.setData( h, m, i ), a(); } function f(h, i) { s.store.setChecked(h, i); } function v(h, i) { s.store.setCheckedKeys(h, i); } function b() { s.store.checkAll(); } function V() { s.store.clearChecked(); } function T(h, i) { s.store.setSelected(h, i); } function D() { s.store.clearSelected(); } function H(h, i, m = !0) { s.store.setExpand(h, i, m); } function R(h, i) { s.store.setExpandKeys(h, i); } function A(h) { s.store.setExpandAll(h); } function $(h) { return h = h || d.ignoreMode, s.store.getCheckedNodes(h); } function M(h) { return h = h || d.ignoreMode, s.store.getCheckedKeys(h); } function x() { return s.store.getIndeterminateNodes(); } function I() { return s.store.getSelectedNode(); } function Y() { return s.store.getSelectedKey(); } function G() { return s.store.getExpandNodes(); } function z() { return s.store.getExpandKeys(); } function j() { return s.store.flatData.filter((h) => h._filterVisible); } function ne(h) { return s.store.getNode(h); } function ie() { return s.store.data; } function re() { return s.store.flatData; } function se() { return s.store.flatData.length; } function p(h, i) { return s.store.insertBefore(h, i); } function g(h, i) { return s.store.insertAfter(h, i); } function L(h, i) { return s.store.append(h, i); } function q(h, i) { return s.store.prepend(h, i); } function k(h) { return s.store.remove(h); } function N(h, i) { const m = (X, de) => { const oe = de[d.titleField]; return oe == null || !oe.toString ? !1 : oe.toString().toLowerCase().indexOf(X.toLowerCase()) > -1; }, O = i || d.filterMethod || m; s.store.filter(h, O); } function K(h) { if (!d.checkable) return; h = h ?? d.showUnloadCheckedNodes; const i = s.store.getCheckedNodes(); if (s.store.filter("", (O, X) => X.checked), !h) return; const m = s.store.getUnloadCheckedKeys(); if (m.length) { const O = m.map((X) => { const de = d.unloadDataList.concat(i); let oe = X; return de.some((fe) => fe[d.keyField] === X && fe[d.titleField] != null ? (oe = fe[d.titleField], !0) : !1), new ge( { [d.keyField]: X, [d.titleField]: oe, checked: !0, isLeaf: !0 }, null, d.keyField, !!d.load ); }); n.value = O, s.blockNodes = s.blockNodes.concat(O), l(), o(); } } function Z() { return r.value = !0, new Promise((h, i) => { d.load && d.load(null, h, i); }).then((h) => { Array.isArray(h) && c(h); }).catch(() => { }).then(() => { r.value = !1; }); } function P(h, i) { return s.store.updateNode(h, i); } function Q(h) { return s.store.updateNodes(h); } return { unloadCheckedNodes: n, isRootLoading: r, setData: c, setChecked: f, setCheckedKeys: v, checkAll: b, clearChecked: V, setSelected: T, clearSelected: D, setExpand: H, setExpandKeys: R, setExpandAll: A, getCheckedNodes: $, getCheckedKeys: M, getIndeterminateNodes: x, getSelectedNode: I, getSelectedKey: Y, getExpandNodes: G, getExpandKeys: z, getCurrentVisibleNodes: j, getNode: ne, getTreeData: ie, getFlatData: re, getNodesCount: se, insertBefore: p, insertAfter: g, append: L, prepend: q, remove: k, filter: N, showCheckedNodes: K, loadRootNodes: Z, updateNode: P, updateNodes: Q }; }, yt = (s, d) => s.reduce((t, e) => { const a = (...l) => { var n; const o = (n = d.value) == null ? void 0 : n[e]; if (typeof o == "function") return o(...l); }; return t[e] = a, t; }, {}), rl = (s, ...d) => { const t = {}; return d.forEach((e) => { s.hasOwnProperty(e) && (t[e] = s[e]); }), t; }, dl = (s, d, t) => { const e = _(!1), a = _(!1), l = _(-1), o = _(-1), n = _(!1), r = _(!1), c = _(0), f = _([]), v = _([]), b = _([]), V = () => { e.value = !1, a.value = !1, l.value = -1, o.value = -1, c.value = 0, f.value = [], v.value = [], b.value = []; }, T = () => { const A = o.value, $ = [], M = s.value.length, x = d.value - c.value; for (let I = l.value - x + 1; I < M && s.value[I]._level > A; I++) $.push(s.value[I]); v.value = $; }; return { ready: a, currentExpandState: n, topNodes: f, middleNodes: v, bottomNodes: b, updateBeforeExpand: (A) => { if (!t.animation) return; V(); const $ = A[t.keyField], M = s.value.findIndex((x) => x[t.keyField] === $); M > -1 && (l.value = M, o.value = A._level, e.value = !0, n.value = A.expand, r.value = !A.expand, c.value = d.value, r.value ? b.value = s.value.slice(l.value + 1) : T()); }, updateAfterExpand: () => { if (t.animation) { if (!e.value) { e.value = !1; return; } l.value !== -1 && Je(() => { const A = d.value - c.value; f.value = s.value.slice(0, l.value - A + 1), r.value ? T() : b.value = s.value.slice(l.value - A + 1), a.value = !0, Je(() => { n.value = !n.value; }); }); } }, onExpandAnimationFinish: () => { V(); } }; }, cl = { style: { display: "grid" } }, hl = { style: { overflow: "hidden" } }, kt = { data: () => [], unloadDataList: () => [], showUnloadCheckedNodes: !0, emptyText: "暂无数据", titleField: "title", keyField: "id", separator: ",", checkable: !1, selectable: !1, filteredNodeCheckable: !1, cascade: !0, enableLeafOnly: !1, disableAll: !1, defaultExpandAll: !1, defaultExpandedKeys: () => [], expandedKeys: () => [], draggable: !1, droppable: !1, beforeDropMethod: () => () => !0, ignoreMode: Oe.none, autoLoad: !0, expandOnFilter: !0, unselectOnClick: !0, loading: !1, nodeMinHeight: 30, nodeIndent: 20, renderNodeAmount: 100, bufferNodeAmount: 20, expandOnClickNode: !0 }, ul = /* @__PURE__ */ Ne({ name: "VTree", inheritAttrs: !1, __name: "Tree", props: /* @__PURE__ */ Ge({ data: {}, emptyText: {}, modelValue: {}, selectable: { type: Boolean }, checkable: { type: Boolean }, separator: {}, ignoreMode: {}, titleField: {}, keyField: {}, filterMethod: { type: Function }, showUnloadCheckedNodes: { type: Boolean }, unloadDataList: {}, load: { type: Function }, filteredNodeCheckable: { type: Boolean }, cascade: { type: Boolean }, enableLeafOnly: { type: Boolean }, disableAll: { type: Boolean }, defaultExpandAll: { type: Boolean }, defaultExpandedKeys: {}, expandedKeys: {}, draggable: { type: Boolean }, droppable: { type: Boolean }, beforeDropMethod: { type: Function }, autoLoad: { type: Boolean }, render: { type: Function }, expandOnFilter: { type: Boolean }, unselectOnClick: { type: Boolean }, loading: { type: Boolean }, nodeClassName: { type: [String, Object, Array, Function] }, showLine: { type: [Boolean, Object] }, animation: { type: Boolean }, nodeIndent: {}, renderNodeAmount: {}, nodeMinHeight: {}, bufferNodeAmount: {}, expandOnClickNode: { type: Boolean } }, kt), emits: ["update:modelValue", ...tt], setup(s, { expose: d, emit: t }) { const e = s, a = t, l = ["node-drop", "check", "select", "expand"], o = et.reduce((u, S) => (l.indexOf(S) < 0 && (u[S] = (...w) => { a(S, ...w); }), u), {}), n = () => ({ store: new Yt({ keyField: e.keyField, ignoreMode: e.ignoreMode, filteredNodeCheckable: e.filteredNodeCheckable, cascade: e.cascade, defaultExpandAll: e.defaultExpandAll, load: e.load, expandOnFilter: e.expandOnFilter }), blockNodes: [] }); let r = n(); (() => { pt.forEach((u) => { r.store.on(u, (...S) => { a(u, ...S); }); }); })(); const f = () => { e.expandedKeys.length && (r.store.setExpandAll(!1, !1), r.store.setExpandKeys(e.expandedKeys, !0)); }, { wrapperCls: v, scrollAreaCls: b, blockAreaCls: V, emptyCls: T, emptyTextDefaultCls: D, loadingCls: H, loadingWrapperCls: R, loadingIconCls: A, iframeCls: $ } = al(), { scrollArea: M, renderNodes: x, blockLength: I, topSpaceHeight: Y, bottomSpaceHeight: G, renderStart: z, resetSpaceHeights: j, updateRender: ne, updateBlockNodes: ie, updateBlockData: re, handleTreeScroll: se, scrollTo: p } = sl(r, e), g = dl(x, z, e), { unloadCheckedNodes: L, isRootLoading: q, setData: k, setChecked: N, setCheckedKeys: K, checkAll: Z, clearChecked: P, setSelected: Q, clearSelected: h, setExpand: i, setExpandKeys: m, setExpandAll: O, getCheckedNodes: X, getCheckedKeys: de, getIndeterminateNodes: oe, getSelectedNode: fe, getSelectedKey: Ve, getExpandNodes: Ct, getExpandKeys: bt, getCurrentVisibleNodes: mt, getNode: Se, getTreeData: vt, getFlatData: _t, getNodesCount: Nt, insertBefo