@extclp/vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
968 lines (967 loc) • 30.8 kB
JavaScript
import { defineComponent as qt, useSlots as Ut, toRef as b, ref as L, reactive as ee, computed as P, nextTick as Gt, watchEffect as Se, watch as Ke, provide as qe, onMounted as Jt, openBlock as G, createBlock as se, unref as i, normalizeClass as ce, normalizeStyle as Ue, withCtx as v, createElementVNode as Ee, createElementBlock as Ge, Fragment as Qt, renderList as Wt, mergeProps as $, createSlots as Je, renderSlot as F, createVNode as T, normalizeProps as te, guardReactiveProps as ae, createTextVNode as Xt, toDisplayString as Zt, withDirectives as ea, vShow as ta, createCommentVNode as aa } from "vue";
import "../collapse-transition/index.mjs";
import "../renderer/index.mjs";
import "../virtual-list/index.mjs";
import "./tree-node.vue.mjs";
import { useProps as la, createIconProp as na, useNameHelper as ra, useLocale as da, emitEvent as w } from "@vexip-ui/config";
import { useSetTimeout as ia, useMounted as oa } from "@vexip-ui/hooks";
import { debounce as sa, queryAll as ca, flatTree as Qe, getGlobalCount as fa, isNull as le, walkTree as Ie, getLast as We, transformTree as ua, isPromise as pa, removeArrayItem as ha, mapTree as ga, filterTree as ba } from "@vexip-ui/utils";
import { treeProps as va } from "./props.mjs";
import { useCascadedChecked as ya } from "./hooks.mjs";
import { defaultKeyConfig as xa, TREE_STATE as ma, TREE_NODE_STATE as ka, DropType as J } from "./symbol.mjs";
import Na from "../virtual-list/virtual-list.mjs";
import Da from "../collapse/collapse-transition.mjs";
import Xe from "./tree-node.vue2.mjs";
import S from "../renderer/renderer.mjs";
const Ha = /* @__PURE__ */ qt({
name: "Tree",
__name: "tree",
props: va,
setup(Ze, { expose: et }) {
const l = la("tree", Ze, {
arrow: {
default: "auto",
validator: (e) => typeof e == "boolean" || e === "auto"
},
data: {
default: () => [],
static: !0
},
noBuildTree: !1,
emptyText: null,
disabled: !1,
readonly: !1,
checkbox: !1,
suffixCheckbox: !1,
renderer: {
default: null,
isFunc: !0
},
prefixRenderer: {
default: null,
isFunc: !0
},
suffixRenderer: {
default: null,
isFunc: !0
},
multiple: !1,
indent: "16px",
accordion: !1,
draggable: !1,
appear: !1,
floorSelect: !1,
onAsyncLoad: {
default: null,
isFunc: !0
},
cacheNode: !1,
rootId: null,
keyConfig: () => ({}),
noCascaded: !1,
filter: "",
ignoreCase: !1,
nodeProps: null,
linkLine: !1,
postCreate: {
default: null,
isFunc: !0
},
virtual: !1,
nodeMinHeight: {
default: 26,
validator: (e) => e > 0
},
useYBar: !1,
noTransition: !1,
arrowIcon: na(),
blockEffect: !1,
filterLeaf: !1,
slots: () => ({})
}), K = Ut(), E = ra("tree"), tt = da("tree", b(l, "locale")), h = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), x = L([]), u = L([]), ne = L(!1), fe = L(!1), m = ee({ ...xa }), at = ee(/* @__PURE__ */ new Map()), Q = L(!1), Me = L([]), ue = L(/* @__PURE__ */ new Set()), { timer: Re } = ia(), { isMounted: lt } = oa(), re = L(), de = L(), W = L(), H = P(() => {
var e;
return (e = re.value) == null ? void 0 : e.wrapper;
});
let I = [];
const nt = {
visible: !0,
selected: !1,
expanded: !1,
disabled: !1,
checked: !1,
loading: !1,
loaded: !1,
loadFail: !1,
readonly: !1,
arrow: "auto",
// will follow checkbox prop of tree when not set (be null)
checkbox: null,
selectDisabled: !1,
expandDisabled: !1,
checkDisabled: !1,
isLeaf: "auto"
}, pe = P(() => typeof l.onAsyncLoad == "function"), Be = P(() => l.linkLine === !0 ? "dashed" : l.linkLine === "none" ? !1 : l.linkLine), rt = P(() => ({
[E.cv("indent-width")]: typeof l.indent == "number" ? `${l.indent}px` : l.indent,
[E.cv("link-line-type")]: Be.value || void 0
})), dt = P(() => ye(x.value)), it = P(() => Q.value ? Me.value : dt.value), _e = P(() => typeof l.nodeProps == "function" ? l.nodeProps : () => l.nodeProps);
function ot(e) {
const t = l.ignoreCase ? String(e).toLocaleLowerCase() : e;
return (n) => {
const r = n[m.label];
return l.ignoreCase ? String(r).toLocaleLowerCase().includes(t) : String(r).includes(t);
};
}
const z = sa(() => {
H.value && (I = ca(`.${E.be("node")}`, H.value));
}, 300);
let he = !1;
function st() {
he = !0, Gt(() => {
he = !1;
});
}
Se(() => {
const e = u.value;
if (st(), l.filter) {
const t = typeof l.filter == "function" ? l.filter : ot(l.filter), a = l.filterLeaf;
for (let n = 0, r = e.length; n < r; ++n) {
const d = e[n];
if (a && !ve(d)) {
d.matched = !1, d.childMatched = !1, d.upperMatched = !1;
continue;
}
const s = d.parent ? h.get(d.parent) : void 0;
if (d.matched = t(d.data, d), d.childMatched = !1, d.upperMatched = !!s && (s.matched || s.upperMatched), d.matched) {
let c = s;
for (; c && !c.childMatched; )
c.childMatched = !0, c.expanded = !0, c = c.parent ? h.get(c.parent) : void 0;
}
}
} else
for (let t = 0, a = e.length; t < a; ++t) {
const n = e[t];
n.matched = !0, n.childMatched = !1, n.upperMatched = !1;
}
V();
}), Se(() => Object.assign(m, l.keyConfig)), Se(() => {
const e = ue.value, t = /* @__PURE__ */ new Set();
let a = !1;
for (const n of u.value)
n.expanded && (t.add(n.id), !a && !e.has(n.id) && (a = !0));
(a || t.size !== e.size) && (ue.value = t);
}), Ke(
[
() => l.data,
() => l.data.length,
() => m.id,
() => m.children,
() => m.parent,
() => l.rootId
],
He,
{ immediate: !0 }
), Ke(
[x, () => l.rootId],
() => {
u.value = Qe(x.value, {
keyField: "id",
parentField: "parent",
childField: "children",
rootId: l.rootId,
injectId: !1,
depthFirst: !0
});
},
{ immediate: !0 }
), Ke(ue, (e, t) => {
var M, j, Y, q;
if (l.noTransition && z(), l.noTransition || he || !H.value) return;
let a, n;
for (const N of e)
if (!t.has(N)) {
if (a != null) return;
a = N;
}
for (const N of t)
if (!e.has(N)) {
if (n != null) return;
n = N;
}
if (a == null && n == null || a && !((j = (M = h.get(a)) == null ? void 0 : M.children) != null && j.length) || n && !((q = (Y = h.get(n)) == null ? void 0 : Y.children) != null && q.length))
return;
clearTimeout(Re.expand), ie.value = !1, Q.value = !0;
let r;
a != null && (r = t), n != null && (r ? (r = new Set(r), r.delete(n)) : r = e);
const d = ye(x.value, r), s = l.virtual, c = H.value.offsetHeight, p = l.nodeMinHeight || 1, f = Math.ceil(c / p) + 1, k = [
a != null && { id: a, type: "expand" },
n != null && { id: n, type: "reduce" }
];
for (const N of k) {
if (!N) continue;
const { id: Z, type: U } = N, o = d.findIndex((y) => y.id === Z);
if (~o) {
const y = d[o].children;
if (y != null && y.length) {
const D = ye(y, e);
d.splice(o + 1, 0, {
id: Symbol("TreeNodePlaceholder"),
collapse: !0,
type: U,
height: s ? D.length * p : void 0,
nodes: s ? D.slice(0, f) : D
});
}
}
}
Me.value = d;
}), qe(
ma,
ee({
arrow: b(l, "arrow"),
checkbox: b(l, "checkbox"),
suffixCheckbox: b(l, "suffixCheckbox"),
noCascaded: b(l, "noCascaded"),
linkLine: Be,
virtual: b(l, "virtual"),
labelKey: b(m, "label"),
draggable: b(l, "draggable"),
floorSelect: b(l, "floorSelect"),
renderer: b(l, "renderer"),
prefixRenderer: b(l, "prefixRenderer"),
suffixRenderer: b(l, "suffixRenderer"),
arrowIcon: b(l, "arrowIcon"),
blockEffect: b(l, "blockEffect"),
dragging: ne,
boundAsyncLoad: pe,
nodeStates: at,
expanding: Q,
getParentNode: C,
updateVisibleNodeEls: z,
computeCheckedState: pt,
handleNodeClick: ht,
handleNodeSelect: bt,
handleNodeCancel: vt,
handleNodeExpand: yt,
handleNodeReduce: xt,
handleAsyncLoad: mt,
handleNodeDragStart: kt,
handleNodeDragOver: Nt,
handleNodeDrop: wt,
handleNodeDragEnd: Ct,
handleHittingChange: Lt,
handleNodeHitting: Ft,
handleLabelClick: gt
})
), qe(
ka,
ee({
depth: -1,
disabled: b(l, "disabled"),
readonly: b(l, "readonly")
})
), et({
treeNodes: x,
flattedNodes: u,
dragging: ne,
expanding: Q,
virtualList: re,
trap: de,
indicator: W,
refreshScroll: Kt,
isLeafNode: ve,
parseAndTransformData: He,
forceUpdateData: ft,
syncNodeStateIntoData: ut,
getCheckedNodes: ze,
getCheckedNodeData: It,
getSelectedNodes: Oe,
getSelectedNodeData: Mt,
getExpandedNodes: Rt,
getDisabledNodes: Bt,
getParentNode: C,
getNodeChildren: _t,
getSiblingNodes: Ve,
getPrevSiblingNode: At,
getNextSiblingNode: Pt,
getNodeByData: X,
expandNodeByData: $t,
selectNodeByData: Ht,
checkNodeByData: zt,
toggleNodeLoadingByData: Ot,
toggleAllExpanded: Vt,
getTreeData: jt,
getFlattedData: Yt,
updateVisibleNodeEls: z
}), Jt(z);
const { updateCheckedUpward: ge, updateCheckedDown: be } = ya({
getNode: (e) => h.get(e),
disableNode: (e) => e.disabled
});
function Ae() {
return `__vxp-tree-key-${fa()}`;
}
function ve(e) {
var r;
const t = e.isLeaf;
let a = "auto", n = !1;
return le(t) || t === "auto" ? (a = "auto", n = pe.value) : a = t, a === "auto" ? !((r = e.children) != null && r.length || n && !e.loaded) : !!a;
}
function ye(e, t) {
const a = new Set(e);
return Qe(e, {
keyField: "id",
parentField: "parent",
childField: "children",
injectId: !1,
depthFirst: !0,
cascaded: !0,
filter: (n) => {
if (a.has(n))
return n.matched || n.childMatched || n.upperMatched;
const r = C(n);
return n.visible && (n.matched || n.childMatched || n.upperMatched) && (!r || (t ? t.has(r.id) : r.expanded));
}
});
}
function ct(e) {
return e.collapse;
}
function Pe() {
Ie(x.value, (e, t) => {
if (e.depth = t, e.lineIndexes = [0], e.parent && h.has(e.parent)) {
const a = h.get(e.parent);
e.last = We(a.children) === e, e.upstreamLast = [a.last, ...a.upstreamLast];
} else
e.last = We(x.value) === e, e.upstreamLast = [];
for (let a = 1; a < t; ++a)
e.upstreamLast[a - 1] || e.lineIndexes.push(a);
});
}
function $e(e) {
x.value = ua(e, {
keyField: "id",
parentField: "parent",
childField: "children",
rootId: l.rootId
}), Pe();
}
function He() {
const e = m.id, t = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
for (const r of h.values())
t.set(r.data, r), a.set(r.data[e], r);
h.clear(), A.clear();
const n = [];
if (l.noBuildTree)
Ie(
l.data,
(r, d, s) => {
var k;
const c = t.get(r), p = (c == null ? void 0 : c.id) ?? Ae(), f = l.cacheNode ? c ?? O(r) : O(r, c);
f.id = p, f.parent = s ? (k = A.get(s)) == null ? void 0 : k.id : void 0, h.set(f.id, f), n.push(f), A.set(r, f);
},
{ childField: m.children, depthFirst: !0 }
);
else {
const r = l.data;
for (let d = 0, s = r.length; d < s; ++d) {
const c = r[d], p = t.get(c) ?? a.get(c[e]), f = l.cacheNode ? p ?? O(c) : O(c, p);
h.set(f.id, f), n.push(f), A.set(c, f);
}
}
if ($e(n), !l.noCascaded) {
const r = u.value.filter((d) => d.checked);
for (let d = 0, s = r.length; d < s; ++d) {
const c = r[d], p = c.parent;
be(c.id), p && h.has(p) && (h.get(p).checked || ge(c.id));
}
}
V();
}
function ft() {
const e = [], {
id: t,
visible: a,
selected: n,
expanded: r,
disabled: d,
checked: s,
loading: c,
loaded: p,
loadFail: f,
readonly: k,
arrow: M,
checkbox: j,
selectDisabled: Y,
expandDisabled: q,
checkDisabled: N,
isLeaf: Z
} = m, U = (o, y) => {
const {
[a]: D = o.visible,
[n]: g = o.selected,
[r]: R = o.expanded,
[d]: B = o.disabled,
[s]: xe = o.checked,
[c]: me = o.loading,
[p]: ke = o.loaded,
[f]: Ne = o.loadFail,
[k]: De = o.readonly,
[M]: we = o.arrow,
[j]: Ce = o.checkbox,
[Y]: Le = o.selectDisabled,
[q]: Fe = o.expandDisabled,
[N]: Te = o.checkDisabled,
[Z]: oe = o.isLeaf
} = y;
o.visible = D, o.selected = g, o.expanded = R, o.disabled = B, o.checked = xe, o.loading = me, o.loaded = ke, o.loadFail = Ne, o.readonly = De, o.arrow = we, o.checkbox = Ce, o.selectDisabled = Le, o.expandDisabled = Fe, o.checkDisabled = Te, o.isLeaf = oe;
};
if (l.noBuildTree)
Ie(
l.data,
(o, y, D) => {
var R;
let g = A.get(o);
g ? U(g, o) : (g = O(o), g.id = Ae(), g.parent = D ? (R = A.get(D)) == null ? void 0 : R.id : void 0, h.set(g.id, g), A.set(o, g)), e.push(g);
},
{ childField: m.children, depthFirst: !0 }
);
else {
const o = l.data;
for (let y = 0, D = o.length; y < D; ++y) {
const g = o[y], R = g[t];
let B = h.get(R);
B ? U(B, g) : (B = O(g), h.set(R, B)), e.push(B);
}
}
$e(e), V();
}
function ut() {
u.value.forEach((e) => {
if (!e.data) return;
const { data: t, visible: a, selected: n, expanded: r, disabled: d, checked: s, loading: c, readonly: p } = e;
t.visible = a, t.selected = n, t.expanded = r, t.disabled = d, t.checked = s, t.loading = c, t.readonly = p;
}), V();
}
function O(e, t = nt) {
const {
id: a,
parent: n,
visible: r,
selected: d,
expanded: s,
disabled: c,
checked: p,
loading: f,
loaded: k,
loadFail: M,
readonly: j,
arrow: Y,
checkbox: q,
selectDisabled: N,
expandDisabled: Z,
checkDisabled: U,
isLeaf: o
} = m, {
[r]: y = t.visible,
[d]: D = t.selected,
[s]: g = t.expanded,
[c]: R = t.disabled,
[p]: B = t.checked,
[f]: xe = t.loading,
[k]: me = t.loaded,
[M]: ke = t.loadFail,
[j]: Ne = t.readonly,
[Y]: De = t.arrow,
[q]: we = t.checkbox,
[N]: Ce = t.selectDisabled,
[Z]: Le = t.expandDisabled,
[U]: Fe = t.checkDisabled,
[o]: Te = t.isLeaf
} = e, oe = l.noBuildTree ? null : e[a], je = l.noBuildTree ? null : e[n], Ye = {
id: oe,
parent: je,
data: e,
visible: y,
selected: D,
expanded: g,
disabled: R,
checked: B,
loading: xe,
loaded: me,
loadFail: ke,
readonly: Ne,
arrow: De,
checkbox: we,
selectDisabled: Ce,
expandDisabled: Le,
checkDisabled: Fe,
isLeaf: Te
};
return typeof l.postCreate == "function" && l.postCreate(Ye), ee({
...Ye,
id: oe,
parent: je,
children: [],
partial: !1,
matched: !1,
childMatched: !1,
upperMatched: !1,
depth: -1,
last: !1,
// inLastCount: 0,
upstreamLast: [],
lineIndexes: []
});
}
function pt(e, t) {
if (!l.noCascaded) {
const a = [e].concat(
// 需要包含被禁用且被勾选的节点
u.value.filter((n) => (n.disabled || n.checkDisabled) && n.checked)
);
for (let n = 0, r = a.length; n < r; ++n) {
const d = a[n];
ge(d.id), be(d.id);
}
}
w(l.onNodeChange, e.data, e, t);
}
function ht(e) {
w(l.onNodeClick, e.data, e);
}
function gt(e) {
w(l.onLabelClick, e.data, e);
}
function bt(e) {
const t = u.value.filter((a) => a.selected);
if (l.multiple)
w(
l.onNodeSelect,
t.map((a) => a.data),
t
);
else {
const a = e.id;
for (let n = 0, r = t.length; n < r; ++n) {
const d = t[n];
d.selected = d.id === a;
}
w(l.onNodeSelect, e.data, e);
}
}
function vt(e) {
w(l.onNodeCancel, e.data, e);
}
function yt(e) {
if (l.accordion) {
const t = Ve(e);
for (let a = 0, n = t.length; a < n; ++a)
t[a].expanded = !1;
}
w(l.onNodeExpand, e.data, e);
}
function xt(e) {
w(l.onNodeReduce, e.data, e);
}
async function mt(e) {
if (!pe.value) return !1;
let t = l.onAsyncLoad(e.data, e);
return pa(t) && (t = await t), t !== !1;
}
let _ = null;
function kt(e) {
H.value && (_ = {
draggingNode: e.node,
treeRect: H.value.getBoundingClientRect(),
willDropNode: null,
dropType: J.BEFORE
}, ne.value = !0, w(l.onDragStart, e.node.data, e.node));
}
function Nt(e, t) {
if (!_ || !e.el || !e.arrow) return;
const a = e.el.getBoundingClientRect(), n = _.treeRect, r = e.arrow.getBoundingClientRect(), d = 0.25, s = 0.75, c = t.clientY - a.top, p = r.height;
let f, k = -9999, M = !0;
c < p * d ? (f = J.BEFORE, k = r.top - n.top) : c > p * s ? (f = J.AFTER, k = r.bottom - n.top) : (f = J.INNER, M = !1), W.value && (W.value.style.top = `${k}px`, W.value.style.insetInlineStart = `${r.right - n.left}px`), _.willDropNode = e.node, _.dropType = f, fe.value = M, w(l.onDragOver, e.node.data, e.node);
}
function Dt(e, t) {
if (!e || !t) return !0;
for (; e; ) {
if (e === t || e.id === t.id)
return !0;
e = C(e);
}
return !1;
}
function wt(e) {
if (!_) return;
const { draggingNode: t, willDropNode: a, dropType: n } = _;
if (!a || Dt(a, t)) return;
let r, d;
if (t && (d = C(t), d || (d = {
children: x.value
}), r = t.id, ha(d.children, (s) => s.id === r)), n === J.INNER) {
Array.isArray(a.children) || (a.children = []);
const s = Array.from(a.children);
s.push(t), a.children = s, t.parent = a.id;
} else {
d = C(a), d || (d = {
parent: void 0,
children: x.value
}), r = a.id;
const s = d.children.findIndex((c) => c.id === r);
~s && (d.children.splice(+(n === J.AFTER) + s, 0, t), t.parent = d.id);
}
Pe(), w(l.onDrop, e.node.data, e.node, n);
}
function Ct(e) {
ne.value = !0, fe.value = !1, _ = null, w(l.onDragEnd, e.node.data, e.node);
}
function Lt(e) {
var n;
const t = document.activeElement;
if (!I.length || !t) return;
const a = I.findIndex((r) => r === t);
~a && ((n = I[(a + (e === "up" ? -1 : 1) + I.length) % I.length]) == null || n.focus());
}
function Ft(e) {
!e || !I.length || I.includes(e) && e.focus();
}
function Tt() {
z();
}
function St(e) {
const t = e.target;
!I.length || !t || !de.value || t === de.value && I[0].focus();
}
function Kt() {
var e;
(e = re.value) == null || e.refresh();
}
function V() {
Q.value = !1, lt.value && z();
}
function Et() {
if (l.virtual) {
V();
return;
}
ie.value = !0, requestAnimationFrame(() => {
V(), Re.expand = setTimeout(() => {
ie.value = !1;
}, 300);
});
}
function ze(e = !1) {
return u.value.filter((t) => t.checked || e && t.partial);
}
function It(e = !1) {
return ze(e).map((t) => t.data);
}
function Oe() {
return u.value.filter((e) => e.selected);
}
function Mt() {
return Oe().map((e) => e.data);
}
function Rt() {
return u.value.filter((e) => e.expanded);
}
function Bt() {
return u.value.filter((e) => e.disabled);
}
function C(e) {
return e.parent ? h.get(e.parent) ?? null : null;
}
function _t(e) {
return e.children;
}
function Ve(e, t = !1) {
const a = C(e), n = e.id, r = a ? a.id : null;
return u.value.filter((d) => {
const s = r === null ? !d.parent : d.parent === r;
return s && !t ? d.id !== n : s;
});
}
function At(e) {
const t = C(e);
if (!t) return null;
const a = e.id, n = t.id, r = u.value.filter((d) => d.parent === n);
if (r && r.length) {
const d = r.findIndex((s) => s.id === a);
if (d > 0)
return r[d - 1];
}
return null;
}
function Pt(e) {
const t = C(e);
if (!t) return null;
const a = e.id, n = t.id, r = u.value.filter((d) => d.parent === n);
if (r && r.length) {
const d = r.findIndex((s) => s.id === a);
if (!~d && d < r.length - 1)
return r[d + 1];
}
return null;
}
function X(e) {
if (l.noBuildTree)
return u.value.find((a) => a.data === e) ?? null;
const t = m.id;
return u.value.find(
(a) => a.data === e || a.data[t] === e[t]
) ?? null;
}
function $t(e, t, a = !1) {
const n = X(e);
if (n && (n.expanded = le(t) ? !n.expanded : !!t, a)) {
let r = C(n);
for (; r; )
r.expanded = n.expanded, r = C(r);
}
}
function Ht(e, t) {
const a = X(e);
a && (a.selected = le(t) ? !a.selected : !!t);
}
function zt(e, t) {
const a = X(e);
if (a && (a.checked = le(t) ? !a.checked : !!t, !l.noCascaded)) {
const n = [a].concat(
u.value.filter((r) => r.disabled && r.checked)
);
for (let r = 0, d = n.length; r < d; ++r) {
const s = n[r];
ge(s.id), be(s.id);
}
}
}
function Ot(e, t) {
const a = X(e);
a && (a.checked = le(t) ? !a.loading : !!t);
}
function Vt(e) {
var t;
for (const a of u.value)
!a.disabled && !a.expandDisabled && !a.loading && ((t = a.children) != null && t.length) && (a.expanded = e);
}
function jt(e = !1) {
return ga(
e ? ba(x.value, (t) => t.matched, {
childField: "children",
leafOnly: l.filterLeaf,
isLeaf: ve
}) : x.value,
(t) => ({ ...t.data })
);
}
function Yt(e = !1) {
return (e ? u.value.filter((t) => t.matched || t.childMatched || t.upperMatched) : u.value).map((t) => ({ ...t.data }));
}
const ie = L(!1);
return (e, t) => (G(), se(i(Na), {
ref_key: "virtualList",
ref: re,
class: ce([i(E).b(), i(E).bs("vars"), i(l).inherit && i(E).bm("inherit")]),
inherit: i(l).inherit,
items: it.value,
"item-size": i(l).nodeMinHeight,
"items-tag": "ul",
"items-attrs": { class: i(E).be("list") },
"hide-bar": !i(l).useYBar,
"ignore-resize": ie.value,
disabled: !i(l).virtual,
role: "tree",
tabindex: "-1",
"aria-disabled": i(l).disabled,
"aria-readonly": i(l).readonly,
style: Ue(rt.value),
onScroll: Tt
}, {
"prefix-trap": v(() => [
Ee("div", {
ref_key: "trap",
ref: de,
tabindex: "0",
role: "none",
style: { width: "0", height: "0", overflow: "hidden", outline: "none" },
onFocus: St
}, null, 544)
]),
default: v(({ item: a }) => [
ct(a) ? (G(), se(i(Da), {
key: 0,
appear: "",
reverse: a.type === "reduce",
onAfterEnter: Et
}, {
default: v(() => [
Ee("div", {
class: ce(i(E).be("collapse")),
style: Ue({ height: `${a.height}px` })
}, [
(G(!0), Ge(Qt, null, Wt(a.nodes, (n, r) => (G(), se(Xe, $({
key: n.id ?? r,
ref_for: !0
}, _e.value(n.data, n), { node: n }), Je({ _: 2 }, [
K.node || i(l).slots.node ? {
name: "default",
fn: v((d) => [
F(e.$slots, "node", $({ ref_for: !0 }, d), () => [
T(i(S), {
renderer: i(l).slots.node,
data: d
}, null, 8, ["renderer", "data"])
])
]),
key: "0"
} : void 0,
K.arrow || i(l).slots.arrow ? {
name: "arrow",
fn: v((d) => [
F(e.$slots, "arrow", $({ ref_for: !0 }, d), () => [
T(i(S), {
renderer: i(l).slots.arrow,
data: d
}, null, 8, ["renderer", "data"])
])
]),
key: "1"
} : void 0,
K.label || i(l).slots.label ? {
name: "label",
fn: v((d) => [
F(e.$slots, "label", $({ ref_for: !0 }, d), () => [
T(i(S), {
renderer: i(l).slots.label,
data: d
}, null, 8, ["renderer", "data"])
])
]),
key: "2"
} : void 0,
K.prefix || i(l).slots.prefix ? {
name: "prefix",
fn: v((d) => [
F(e.$slots, "prefix", $({ ref_for: !0 }, d), () => [
T(i(S), {
renderer: i(l).slots.prefix,
data: d
}, null, 8, ["renderer", "data"])
])
]),
key: "3"
} : void 0,
K.suffix || i(l).slots.suffix ? {
name: "suffix",
fn: v((d) => [
F(e.$slots, "suffix", $({ ref_for: !0 }, d), () => [
T(i(S), {
renderer: i(l).slots.suffix,
data: d
}, null, 8, ["renderer", "data"])
])
]),
key: "4"
} : void 0
]), 1040, ["node"]))), 128))
], 6)
]),
_: 2
}, 1032, ["reverse"])) : (G(), se(Xe, $({ key: 1 }, _e.value(a.data, a), { node: a }), Je({ _: 2 }, [
K.node || i(l).slots.node ? {
name: "default",
fn: v((n) => [
F(e.$slots, "node", te(ae(n)), () => [
T(i(S), {
renderer: i(l).slots.node,
data: n
}, null, 8, ["renderer", "data"])
])
]),
key: "0"
} : void 0,
K.arrow || i(l).slots.arrow ? {
name: "arrow",
fn: v((n) => [
F(e.$slots, "arrow", te(ae(n)), () => [
T(i(S), {
renderer: i(l).slots.arrow,
data: n
}, null, 8, ["renderer", "data"])
])
]),
key: "1"
} : void 0,
K.label || i(l).slots.label ? {
name: "label",
fn: v((n) => [
F(e.$slots, "label", te(ae(n)), () => [
T(i(S), {
renderer: i(l).slots.label,
data: n
}, null, 8, ["renderer", "data"])
])
]),
key: "2"
} : void 0,
K.prefix || i(l).slots.prefix ? {
name: "prefix",
fn: v((n) => [
F(e.$slots, "prefix", te(ae(n)), () => [
T(i(S), {
renderer: i(l).slots.prefix,
data: n
}, null, 8, ["renderer", "data"])
])
]),
key: "3"
} : void 0,
K.suffix || i(l).slots.suffix ? {
name: "suffix",
fn: v((n) => [
F(e.$slots, "suffix", te(ae(n)), () => [
T(i(S), {
renderer: i(l).slots.suffix,
data: n
}, null, 8, ["renderer", "data"])
])
]),
key: "4"
} : void 0
]), 1040, ["node"]))
]),
empty: v(() => [
Ee("div", {
class: ce(i(E).be("empty-tip"))
}, [
F(e.$slots, "empty", {}, () => [
T(i(S), {
renderer: i(l).slots.empty
}, {
default: v(() => [
Xt(Zt(i(l).emptyText ?? i(tt).empty), 1)
]),
_: 1
}, 8, ["renderer"])
])
], 2)
]),
"suffix-trap": v(() => [
i(l).draggable ? ea((G(), Ge("div", {
key: 0,
ref_key: "indicator",
ref: W,
class: ce(i(E).be("indicator"))
}, null, 2)), [
[ta, fe.value]
]) : aa("", !0)
]),
_: 3
}, 8, ["class", "inherit", "items", "item-size", "items-attrs", "hide-bar", "ignore-resize", "disabled", "aria-disabled", "aria-readonly", "style"]));
}
});
export {
Ha as default
};
//# sourceMappingURL=tree.vue2.mjs.map