var ht = Object.defineProperty; var Qe = Object.getOwnPropertySymbols; var pt = Object.prototype.hasOwnProperty, mt = Object.prototype.propertyIsEnumerable; var qe = (e, n, a) => n in e ? ht(e, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[n] = a, Je = (e, n) => { for (var a in n || (n = {})) pt.call(n, a) && qe(e, a, n[a]); if (Qe) for (var a of Qe(n)) mt.call(n, a) && qe(e, a, n[a]); return e; }; import { inject as gt, provide as yt, defineComponent as Xe, ref as B, computed as C, watch as Se, nextTick as St, shallowRef as R, toRaw as ae, createVNode as z, watchEffect as we, toRef as re, toRefs as bt, onMounted as Ct, createElementBlock as de, openBlock as fe, unref as Ze, isRef as wt, withCtx as xt, Fragment as et, renderList as kt, toDisplayString as He } from "vue"; import { K as ve, _ as Y, d as y, a1 as Tt, l as H, aS as It, i as ut, o as xe, P as he, g as Vt, m as it, j as Me, u as Nt, x as Et, y as Lt, C as Dt, c as tt, a8 as Pt, M as $e, Q as Be, e as At, N as Kt, O as Ot, k as _t } from "./index2.js"; import { u as Ft } from "./useMemo.js"; import { T as Ht, g as Mt, r as $t } from "./index20.js"; import { u as Bt, h as Rt, a as jt, j as Wt, t as lt, B as Ut, b as zt, c as Xt, g as Yt } from "./index4.js"; import { c as Gt, a as je, u as Qt } from "./useMaxLevel.js"; import { u as at } from "./useMergedState.js"; import { u as qt, F as Jt } from "./FormItemContext.js"; import { g as Zt, a as el } from "./statusUtils.js"; import { g as tl } from "./index6.js"; function ct(e) { return Array.isArray(e) ? e : e !== void 0 ? [e] : []; } function ll(e) { const { label: n, value: a, children: t } = e || {}, l = a || "value"; return { _title: n ? [n] : ["title", "label"], value: l, key: l, children: t || "children" }; } function We(e) { return e.disabled || e.disableCheckbox || e.checkable === !1; } function al(e, n) { const a = []; function t(l) { l.forEach((o) => { a.push(o[n.value]); const s = o[n.children]; s && t(s); }); } return t(e), a; } function Ue(e) { return e == null; } const dt = Symbol("TreeSelectContextPropsKey"); function nl(e) { return yt(dt, e); } function ol() { return gt(dt, {}); } const rl = { width: 0, height: 0, display: "flex", overflow: "hidden", opacity: 0, border: 0, padding: 0, margin: 0 }, sl = Xe({ compatConfig: { MODE: 3 }, name: "OptionList", inheritAttrs: !1, setup(e, n) { let { slots: a, expose: t } = n; const l = Bt(), o = Rt(), s = ol(), u = B(), c = Ft(() => s.treeData, [() => l.open, () => s.treeData], (v) => v[0]), r = C(() => { const { checkable: v, halfCheckedKeys: T, checkedKeys: K } = o; return v ? { checked: K, halfChecked: T } : null; }); Se(() => l.open, () => { St(() => { var v; l.open && !l.multiple && o.checkedKeys.length && ((v = u.value) === null || v === void 0 || v.scrollTo({ key: o.checkedKeys[0] })); }); }, { immediate: !0, flush: "post" }); const d = C(() => String(l.searchValue).toLowerCase()), g = (v) => d.value ? String(v[o.treeNodeFilterProp]).toLowerCase().includes(d.value) : !1, N = R(o.treeDefaultExpandedKeys), x = R(null); Se(() => l.searchValue, () => { l.searchValue && (x.value = al(ae(s.treeData), ae(s.fieldNames))); }, { immediate: !0 }); const I = C(() => o.treeExpandedKeys ? o.treeExpandedKeys.slice() : l.searchValue ? x.value : N.value), w = (v) => { var T; N.value = v, x.value = v, (T = o.onTreeExpand) === null || T === void 0 || T.call(o, v); }, f = (v) => { v.preventDefault(); }, S = (v, T) => { let { node: K } = T; var F, P; const { checkable: X, checkedKeys: G } = o; X && We(K) || ((F = s.onSelect) === null || F === void 0 || F.call(s, K.key, { selected: !G.includes(K.key) }), l.multiple || (P = l.toggleOpen) === null || P === void 0 || P.call(l, !1)); }, k = B(null), h = C(() => o.keyEntities[k.value]), D = (v) => { k.value = v; }; return t({ scrollTo: function() { for (var v, T, K = arguments.length, F = new Array(K), P = 0; P < K; P++) F[P] = arguments[P]; return (T = (v = u.value) === null || v === void 0 ? void 0 : v.scrollTo) === null || T === void 0 ? void 0 : T.call(v, ...F); }, onKeydown: (v) => { var T; const { which: K } = v; switch (K) { case ve.UP: case ve.DOWN: case ve.LEFT: case ve.RIGHT: (T = u.value) === null || T === void 0 || T.onKeydown(v); break; case ve.ENTER: { if (h.value) { const { selectable: F, value: P } = h.value.node || {}; F !== !1 && S(null, { node: { key: k.value }, selected: !o.checkedKeys.includes(P) }); } break; } case ve.ESC: l.toggleOpen(!1); } }, onKeyup: () => { } }), () => { var v; const { prefixCls: T, multiple: K, searchValue: F, open: P, notFoundContent: X = (v = a.notFoundContent) === null || v === void 0 ? void 0 : v.call(a) } = l, { listHeight: G, listItemHeight: j, virtual: ne, dropdownMatchSelectWidth: Q, treeExpandAction: se } = s, { checkable: ue, treeDefaultExpandAll: ie, treeIcon: oe, showTreeIcon: q, switcherIcon: me, treeLine: ge, loadData: ye, treeLoadedKeys: ce, treeMotion: b, onTreeLoad: O, checkedKeys: M } = o; if (c.value.length === 0) return z("div", { role: "listbox", class: `${T}-empty`, onMousedown: f }, [X]); const J = { fieldNames: s.fieldNames }; return ce && (J.loadedKeys = ce), I.value && (J.expandedKeys = I.value), z("div", { onMousedown: f }, [h.value && P && z("span", { style: rl, "aria-live": "assertive" }, [h.value.node.value]), z(Ht, Y(Y({ ref: u, focusable: !1, prefixCls: `${T}-tree`, treeData: c.value, height: G, itemHeight: j, virtual: ne !== !1 && Q !== !1, multiple: K, icon: oe, showIcon: q, switcherIcon: me, showLine: ge, loadData: F ? null : ye, motion: b, activeKey: k.value, checkable: ue, checkStrictly: !0, checkedKeys: r.value, selectedKeys: ue ? [] : M, defaultExpandAll: ie }, J), {}, { onActiveChange: D, onSelect: S, onCheck: S, onExpand: w, onLoad: O, filterTreeNode: g, expandAction: se }), y(y({}, a), { checkable: o.customSlots.treeCheckable }))]); }; } }), ul = "SHOW_ALL", ft = "SHOW_PARENT", Ye = "SHOW_CHILD"; function nt(e, n, a, t) { const l = new Set(e); return n === Ye ? e.filter((o) => { const s = a[o]; return !(s && s.children && s.children.some((u) => { let { node: c } = u; return l.has(c[t.value]); }) && s.children.every((u) => { let { node: c } = u; return We(c) || l.has(c[t.value]); })); }) : n === ft ? e.filter((o) => { const s = a[o], u = s ? s.parent : null; return !(u && !We(u.node) && l.has(u.key)); }) : e; } const pe = () => null; pe.inheritAttrs = !1; pe.displayName = "ATreeSelectNode"; pe.isTreeSelectNode = !0; var il = function(e, n) { var a = {}; for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (a[t] = e[t]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, t = Object.getOwnPropertySymbols(e); l < t.length; l++) n.indexOf(t[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[l]) && (a[t[l]] = e[t[l]]); return a; }; function cl(e) { return e && e.type && e.type.isTreeSelectNode; } function dl(e) { function n() { let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; return Tt(a).map((t) => { var l, o, s; if (!cl(t)) return H(!t, "TreeSelect/TreeSelectNode can only accept TreeSelectNode as children."), null; const u = t.children || {}, c = t.key, r = {}; for (const [K, F] of Object.entries(t.props)) r[It(K)] = F; const { isLeaf: d, checkable: g, selectable: N, disabled: x, disableCheckbox: I } = r, w = { isLeaf: d || d === "" || void 0, checkable: g || g === "" || void 0, selectable: N || N === "" || void 0, disabled: x || x === "" || void 0, disableCheckbox: I || I === "" || void 0 }, f = y(y({}, r), w), { title: S = (l = u.title) === null || l === void 0 ? void 0 : l.call(u, f), switcherIcon: k = (o = u.switcherIcon) === null || o === void 0 ? void 0 : o.call(u, f) } = r, h = il(r, ["title", "switcherIcon"]), D = (s = u.default) === null || s === void 0 ? void 0 : s.call(u), v = y(y(y({}, h), { title: S, switcherIcon: k, key: c, isLeaf: d }), w), T = n(D); return T.length && (v.children = T), v; }); } return n(e); } function ze(e) { if (!e) return e; const n = y({}, e); return "props" in n || Object.defineProperty(n, "props", { get() { return H(!1, "New `vc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."), n; } }), n; } function fl(e, n, a, t, l, o) { let s = null, u = null; function c() { function r(d) { let g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "0", N = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; return d.map((x, I) => { const w = `${g}-${I}`, f = x[o.value], S = a.includes(f), k = r(x[o.children] || [], w, S), h = z(pe, x, { default: () => [k.map((D) => D.node)] }); if (n === f && (s = h), S) { const D = { pos: w, node: h, children: k }; return N || u.push(D), D; } return null; }).filter((x) => x); } u || (u = [], r(t), u.sort((d, g) => { let { node: { props: { value: N } } } = d, { node: { props: { value: x } } } = g; const I = a.indexOf(N), w = a.indexOf(x); return I - w; })); } Object.defineProperty(e, "triggerNode", { get() { return H(!1, "`triggerNode` is deprecated. Please consider decoupling data with node."), c(), s; } }), Object.defineProperty(e, "allCheckedNodes", { get() { return H(!1, "`allCheckedNodes` is deprecated. Please consider decoupling data with node."), c(), l ? u : u.map((r) => { let { node: d } = r; return d; }); } }); } function vl(e, n) { let { id: a, pId: t, rootPId: l } = n; const o = {}, s = []; return e.map((c) => { const r = y({}, c), d = r[a]; return o[d] = r, r.key = r.key || d, r; }).forEach((c) => { const r = c[t], d = o[r]; d && (d.children = d.children || [], d.children.push(c)), (r === l || !d && l === null) && s.push(c); }), s; } function hl(e, n, a) { const t = R(); return Se([a, e, n], () => { const l = a.value; e.value ? t.value = a.value ? vl(ae(e.value), y({ id: "id", pId: "pId", rootPId: null }, l !== !0 ? l : {})) : ae(e.value).slice() : t.value = dl(ae(n.value)); }, { immediate: !0, deep: !0 }), t; } const pl = (e) => { const n = R({ valueLabels: /* @__PURE__ */ new Map() }), a = R(); return Se(e, () => { a.value = ae(e.value); }, { immediate: !0 }), [C(() => { const { valueLabels: l } = n.value, o = /* @__PURE__ */ new Map(), s = a.value.map((u) => { var c; const { value: r } = u, d = (c = u.label) !== null && c !== void 0 ? c : l.get(r); return o.set(r, d), y(y({}, u), { label: d }); }); return n.value.valueLabels = o, s; })]; }, ml = (e, n) => { const a = R(/* @__PURE__ */ new Map()), t = R({}); return we(() => { const l = n.value, o = Gt(e.value, { fieldNames: l, initWrapper: (s) => y(y({}, s), { valueEntities: /* @__PURE__ */ new Map() }), processEntity: (s, u) => { const c = s.node[l.value]; if (process.env.NODE_ENV !== "production") { const r = s.node.key; H(!Ue(c), "TreeNode `value` is invalidate: undefined"), H(!u.valueEntities.has(c), `Same \`value\` exist in the tree: ${c}`), H(!r || String(r) === String(c), `\`key\` or \`value\` with TreeNode must be the same or you can remove one of them. key: ${r}, value: ${c}.`); } u.valueEntities.set(c, s); } }); a.value = o.valueEntities, t.value = o.keyEntities; }), { valueEntities: a, keyEntities: t }; }, gl = (e, n, a, t, l, o) => { const s = R([]), u = R([]); return we(() => { let c = e.value.map((g) => { let { value: N } = g; return N; }), r = n.value.map((g) => { let { value: N } = g; return N; }); const d = c.filter((g) => !t.value[g]); a.value && ({ checkedKeys: c, halfCheckedKeys: r } = je(c, !0, t.value, l.value, o.value)), s.value = Array.from(/* @__PURE__ */ new Set([...d, ...c])), u.value = r; }), [s, u]; }, yl = (e, n, a) => { let { treeNodeFilterProp: t, filterTreeNode: l, fieldNames: o } = a; return C(() => { const { children: s } = o.value, u = n.value, c = t == null ? void 0 : t.value; if (!u || l.value === !1) return e.value; let r; if (typeof l.value == "function") r = l.value; else { const g = u.toUpperCase(); r = (N, x) => { const I = x[c]; return String(I).toUpperCase().includes(g); }; } function d(g) { let N = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1; const x = []; for (let I = 0, w = g.length; I < w; I++) { const f = g[I], S = f[s], k = N || r(u, ze(f)), h = d(S || [], k); (k || h.length) && x.push(y(y({}, f), { [s]: h })); } return x; } return d(e.value); }); }; function Sl(e) { const { searchPlaceholder: n, treeCheckStrictly: a, treeCheckable: t, labelInValue: l, value: o, multiple: s } = e; H(!n, "`searchPlaceholder` has been removed, please use `placeholder` instead"), a && l === !1 && H(!1, "`treeCheckStrictly` will force set `labelInValue` to `true`."), (l || a) && H(ct(o).every((u) => u && typeof u == "object" && "value" in u), "Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."), a || s || t ? H(!o || Array.isArray(o), "`value` should be an array when `TreeSelect` is checkable or multiple.") : H(!Array.isArray(o), "`value` should not be array when `TreeSelect` is single mode."); } function vt() { return y(y({}, xe(zt(), ["mode"])), { prefixCls: String, id: String, value: { type: [String, Number, Object, Array] }, defaultValue: { type: [String, Number, Object, Array] }, onChange: { type: Function }, searchValue: String, /** @deprecated Use `searchValue` instead */ inputValue: String, onSearch: { type: Function }, autoClearSearchValue: { type: Boolean, default: void 0 }, filterTreeNode: { type: [Boolean, Function], default: void 0 }, treeNodeFilterProp: String, // >>> Select onSelect: Function, onDeselect: Function, showCheckedStrategy: { type: String }, treeNodeLabelProp: String, fieldNames: { type: Object }, // >>> Mode multiple: { type: Boolean, default: void 0 }, treeCheckable: { type: Boolean, default: void 0 }, treeCheckStrictly: { type: Boolean, default: void 0 }, labelInValue: { type: Boolean, default: void 0 }, // >>> Data treeData: { type: Array }, treeDataSimpleMode: { type: [Boolean, Object], default: void 0 }, loadData: { type: Function }, treeLoadedKeys: { type: Array }, onTreeLoad: { type: Function }, // >>> Expanded treeDefaultExpandAll: { type: Boolean, default: void 0 }, treeExpandedKeys: { type: Array }, treeDefaultExpandedKeys: { type: Array }, onTreeExpand: { type: Function }, // >>> Options virtual: { type: Boolean, default: void 0 }, listHeight: Number, listItemHeight: Number, onDropdownVisibleChange: { type: Function }, // >>> Tree treeLine: { type: [Boolean, Object], default: void 0 }, treeIcon: he.any, showTreeIcon: { type: Boolean, default: void 0 }, switcherIcon: he.any, treeMotion: he.any, children: Array, treeExpandAction: String, showArrow: { type: Boolean, default: void 0 }, showSearch: { type: Boolean, default: void 0 }, open: { type: Boolean, default: void 0 }, defaultOpen: { type: Boolean, default: void 0 }, disabled: { type: Boolean, default: void 0 }, placeholder: he.any, maxTagPlaceholder: { type: Function }, dropdownPopupAlign: he.any, customSlots: Object }); } function bl(e) { return !e || typeof e != "object"; } const Cl = Xe({ compatConfig: { MODE: 3 }, name: "TreeSelect", inheritAttrs: !1, props: ut(vt(), { treeNodeFilterProp: "value", autoClearSearchValue: !0, showCheckedStrategy: Ye, listHeight: 200, listItemHeight: 20, prefixCls: "vc-tree-select" }), setup(e, n) { let { attrs: a, expose: t, slots: l } = n; const o = jt(re(e, "id")), s = C(() => e.treeCheckable && !e.treeCheckStrictly), u = C(() => e.treeCheckable || e.treeCheckStrictly), c = C(() => e.treeCheckStrictly || e.labelInValue), r = C(() => u.value || e.multiple); process.env.NODE_ENV !== "production" && we(() => { Sl(e); }); const d = C(() => ll(e.fieldNames)), [g, N] = at("", { value: C(() => e.searchValue !== void 0 ? e.searchValue : e.inputValue), postState: (i) => i || "" }), x = (i) => { var p; N(i), (p = e.onSearch) === null || p === void 0 || p.call(e, i); }, I = hl(re(e, "treeData"), re(e, "children"), re(e, "treeDataSimpleMode")), { keyEntities: w, valueEntities: f } = ml(I, d), S = (i) => { const p = [], m = []; return i.forEach((E) => { f.value.has(E) ? m.push(E) : p.push(E); }), { missingRawValues: p, existRawValues: m }; }, k = yl(I, g, { fieldNames: d, treeNodeFilterProp: re(e, "treeNodeFilterProp"), filterTreeNode: re(e, "filterTreeNode") }), h = (i) => { if (i) { if (e.treeNodeLabelProp) return i[e.treeNodeLabelProp]; const { _title: p } = d.value; for (let m = 0; m < p.length; m += 1) { const E = i[p[m]]; if (E !== void 0) return E; } } }, D = (i) => ct(i).map((m) => bl(m) ? { value: m } : m), v = (i) => D(i).map((m) => { let { label: E } = m; const { value: _, halfChecked: A } = m; let V; const L = f.value.get(_); return L && (E = E != null ? E : h(L.node), V = L.node.disabled), { label: E, value: _, halfChecked: A, disabled: V }; }), [T, K] = at(e.defaultValue, { value: re(e, "value") }), F = C(() => D(T.value)), P = R([]), X = R([]); we(() => { const i = [], p = []; F.value.forEach((m) => { m.halfChecked ? p.push(m) : i.push(m); }), P.value = i, X.value = p; }); const G = C(() => P.value.map((i) => i.value)), { maxLevel: j, levelEntities: ne } = Qt(w), [Q, se] = gl(P, X, s, w, j, ne), ue = C(() => { const m = nt(Q.value, e.showCheckedStrategy, w.value, d.value).map((A) => { var V, L, $; return ($ = (L = (V = w.value[A]) === null || V === void 0 ? void 0 : V.node) === null || L === void 0 ? void 0 : L[d.value.value]) !== null && $ !== void 0 ? $ : A; }).map((A) => { const V = P.value.find((L) => L.value === A); return { value: A, label: V == null ? void 0 : V.label }; }), E = v(m), _ = E[0]; return !r.value && _ && Ue(_.value) && Ue(_.label) ? [] : E.map((A) => { var V; return y(y({}, A), { label: (V = A.label) !== null && V !== void 0 ? V : A.value }); }); }), [ie] = pl(ue), oe = (i, p, m) => { const E = v(i); if (K(E), e.autoClearSearchValue && N(""), e.onChange) { let _ = i; s.value && (_ = nt(i, e.showCheckedStrategy, w.value, d.value).map((le) => { const Ce = f.value.get(le); return Ce ? Ce.node[d.value.value] : le; })); const { triggerValue: A, selected: V } = p || { triggerValue: void 0, selected: void 0 }; let L = _; if (e.treeCheckStrictly) { const U = X.value.filter((le) => !_.includes(le.value)); L = [...L, ...U]; } const $ = v(L), ee = { // [Legacy] Always return as array contains label & value preValue: P.value, triggerValue: A }; let te = !0; (e.treeCheckStrictly || m === "selection" && !V) && (te = !1), fl(ee, A, i, I.value, te, d.value), u.value ? ee.checked = V : ee.selected = V; const W = c.value ? $ : $.map((U) => U.value); e.onChange(r.value ? W : W[0], c.value ? null : $.map((U) => U.label), ee); } }, q = (i, p) => { let { selected: m, source: E } = p; var _, A, V; const L = ae(w.value), $ = ae(f.value), ee = L[i], te = ee == null ? void 0 : ee.node, W = (_ = te == null ? void 0 : te[d.value.value]) !== null && _ !== void 0 ? _ : i; if (!r.value) oe([W], { selected: !0, triggerValue: W }, "option"); else { let U = m ? [...G.value, W] : Q.value.filter((le) => le !== W); if (s.value) { const { missingRawValues: le, existRawValues: Ce } = S(U), Ge = Ce.map((Fe) => $.get(Fe).key); let _e; m ? { checkedKeys: _e } = je(Ge, !0, L, j.value, ne.value) : { checkedKeys: _e } = je(Ge, { halfCheckedKeys: se.value }, L, j.value, ne.value), U = [...le, ..._e.map((Fe) => L[Fe].node[d.value.value])]; } oe(U, { selected: m, triggerValue: W }, E || "option"); } m || !r.value ? (A = e.onSelect) === null || A === void 0 || A.call(e, W, ze(te)) : (V = e.onDeselect) === null || V === void 0 || V.call(e, W, ze(te)); }, me = (i) => { if (e.onDropdownVisibleChange) { const p = {}; Object.defineProperty(p, "documentClickClose", { get() { return H(!1, "Second param of `onDropdownVisibleChange` has been removed."), !1; } }), e.onDropdownVisibleChange(i, p); } }, ge = (i, p) => { const m = i.map((E) => E.value); if (p.type === "clear") { oe(m, {}, "selection"); return; } p.values.length && q(p.values[0].value, { selected: !1, source: "selection" }); }, { treeNodeFilterProp: ye, // Data loadData: ce, treeLoadedKeys: b, onTreeLoad: O, // Expanded treeDefaultExpandAll: M, treeExpandedKeys: J, treeDefaultExpandedKeys: ke, onTreeExpand: Te, // Options virtual: Ie, listHeight: Ve, listItemHeight: Ne, // Tree treeLine: Ee, treeIcon: be, showTreeIcon: Le, switcherIcon: De, treeMotion: Pe, customSlots: Ae, dropdownMatchSelectWidth: Ke, treeExpandAction: Oe } = bt(e); Wt(lt({ checkable: u, loadData: ce, treeLoadedKeys: b, onTreeLoad: O, checkedKeys: Q, halfCheckedKeys: se, treeDefaultExpandAll: M, treeExpandedKeys: J, treeDefaultExpandedKeys: ke, onTreeExpand: Te, treeIcon: be, treeMotion: Pe, showTreeIcon: Le, switcherIcon: De, treeLine: Ee, treeNodeFilterProp: ye, keyEntities: w, customSlots: Ae })), nl(lt({ virtual: Ie, listHeight: Ve, listItemHeight: Ne, treeData: k, fieldNames: d, onSelect: q, dropdownMatchSelectWidth: Ke, treeExpandAction: Oe })); const Z = B(); return t({ focus() { var i; (i = Z.value) === null || i === void 0 || i.focus(); }, blur() { var i; (i = Z.value) === null || i === void 0 || i.blur(); }, scrollTo(i) { var p; (p = Z.value) === null || p === void 0 || p.scrollTo(i); } }), () => { var i; const p = xe(e, [ "id", "prefixCls", "customSlots", // Value "value", "defaultValue", "onChange", "onSelect", "onDeselect", // Search "searchValue", "inputValue", "onSearch", "autoClearSearchValue", "filterTreeNode", "treeNodeFilterProp", // Selector "showCheckedStrategy", "treeNodeLabelProp", // Mode "multiple", "treeCheckable", "treeCheckStrictly", "labelInValue", // FieldNames "fieldNames", // Data "treeDataSimpleMode", "treeData", "children", "loadData", "treeLoadedKeys", "onTreeLoad", // Expanded "treeDefaultExpandAll", "treeExpandedKeys", "treeDefaultExpandedKeys", "onTreeExpand", // Options "virtual", "listHeight", "listItemHeight", "onDropdownVisibleChange", // Tree "treeLine", "treeIcon", "showTreeIcon", "switcherIcon", "treeMotion" ]); return z(Ut, Y(Y(Y({ ref: Z }, a), p), {}, { id: o, prefixCls: e.prefixCls, mode: r.value ? "multiple" : void 0, displayValues: ie.value, onDisplayValuesChange: ge, searchValue: g.value, onSearch: x, OptionList: sl, emptyOptions: !I.value.length, onDropdownVisibleChange: me, tagRender: e.tagRender || l.tagRender, dropdownMatchSelectWidth: (i = e.dropdownMatchSelectWidth) !== null && i !== void 0 ? i : !0 }), l); }; } }), wl = (e) => { const { componentCls: n, treePrefixCls: a, colorBgElevated: t } = e, l = `.${a}`; return [ // ====================================================== // == Dropdown == // ====================================================== { [`${n}-dropdown`]: [ { padding: `${e.paddingXS}px ${e.paddingXS / 2}px` }, // ====================== Tree ====================== Mt(a, it(e, { colorBgContainer: t })), { [l]: { borderRadius: 0, "&-list-holder-inner": { alignItems: "stretch", [`${l}-treenode`]: { [`${l}-node-content-wrapper`]: { flex: "auto" } } } } }, // ==================== Checkbox ==================== tl(`${a}-checkbox`, e), // ====================== RTL ======================= { "&-rtl": { direction: "rtl", [`${l}-switcher${l}-switcher_close`]: { [`${l}-switcher-icon svg`]: { transform: "rotate(90deg)" } } } } ] } ]; }; function xl(e, n) { return Vt("TreeSelect", (a) => { const t = it(a, { treePrefixCls: n.value }); return [wl(t)]; })(e); } const ot = (e, n, a) => a !== void 0 ? a : `${e}-${n}`; function kl() { return y(y({}, xe(vt(), ["showTreeIcon", "treeMotion", "inputIcon", "getInputElement", "treeLine", "customSlots"])), { suffixIcon: he.any, size: Be(), bordered: Ot(), treeLine: Kt([Boolean, Object]), replaceFields: At(), placement: Be(), status: Be(), popupClassName: String, /** @deprecated Please use `popupClassName` instead */ dropdownClassName: String, "onUpdate:value": $e(), "onUpdate:treeExpandedKeys": $e(), "onUpdate:searchValue": $e() }); } const Re = Xe({ compatConfig: { MODE: 3 }, name: "ATreeSelect", inheritAttrs: !1, props: ut(kl(), { choiceTransitionName: "", listHeight: 256, treeIcon: !1, listItemHeight: 26, bordered: !0 }), slots: Object, setup(e, n) { let { attrs: a, slots: t, expose: l, emit: o } = n; H(!(e.treeData === void 0 && t.default), "`children` of TreeSelect is deprecated. Please use `treeData` instead."), Me(e.multiple !== !1 || !e.treeCheckable, "TreeSelect", "`multiple` will always be `true` when `treeCheckable` is true"), Me(e.replaceFields === void 0, "TreeSelect", "`replaceFields` is deprecated, please use fieldNames instead"), Me(!e.dropdownClassName, "TreeSelect", "`dropdownClassName` is deprecated. Please use `popupClassName` instead."); const s = qt(), u = Jt.useInject(), c = C(() => Zt(u.status, e.status)), { prefixCls: r, renderEmpty: d, direction: g, virtual: N, dropdownMatchSelectWidth: x, size: I, getPopupContainer: w, getPrefixCls: f, disabled: S } = Nt("select", e), { compactSize: k, compactItemClassnames: h } = Et(r, g), D = C(() => k.value || I.value), v = Lt(), T = C(() => { var b; return (b = S.value) !== null && b !== void 0 ? b : v.value; }), K = C(() => f()), F = C(() => e.placement !== void 0 ? e.placement : g.value === "rtl" ? "bottomRight" : "bottomLeft"), P = C(() => ot(K.value, Dt(F.value), e.transitionName)), X = C(() => ot(K.value, "", e.choiceTransitionName)), G = C(() => f("select-tree", e.prefixCls)), j = C(() => f("tree-select", e.prefixCls)), [ne, Q] = Xt(r), [se] = xl(j, G), ue = C(() => tt(e.popupClassName || e.dropdownClassName, `${j.value}-dropdown`, { [`${j.value}-dropdown-rtl`]: g.value === "rtl" }, Q.value)), ie = C(() => !!(e.treeCheckable || e.multiple)), oe = C(() => e.showArrow !== void 0 ? e.showArrow : e.loading || !ie.value), q = B(); l({ focus() { var b, O; (O = (b = q.value).focus) === null || O === void 0 || O.call(b); }, blur() { var b, O; (O = (b = q.value).blur) === null || O === void 0 || O.call(b); } }); const me = function() { for (var b = arguments.length, O = new Array(b), M = 0; M < b; M++) O[M] = arguments[M]; o("update:value", O[0]), o("change", ...O), s.onFieldChange(); }, ge = (b) => { o("update:treeExpandedKeys", b), o("treeExpand", b); }, ye = (b) => { o("update:searchValue", b), o("search", b); }, ce = (b) => { o("blur", b), s.onFieldBlur(); }; return () => { var b, O, M; const { notFoundContent: J = (b = t.notFoundContent) === null || b === void 0 ? void 0 : b.call(t), prefixCls: ke, bordered: Te, listHeight: Ie, listItemHeight: Ve, multiple: Ne, treeIcon: Ee, treeLine: be, showArrow: Le, switcherIcon: De = (O = t.switcherIcon) === null || O === void 0 ? void 0 : O.call(t), fieldNames: Pe = e.replaceFields, id: Ae = s.id.value, placeholder: Ke = (M = t.placeholder) === null || M === void 0 ? void 0 : M.call(t) } = e, { isFormItemInput: Oe, hasFeedback: Z, feedbackIcon: i } = u, { suffixIcon: p, removeIcon: m, clearIcon: E } = Yt(y(y({}, e), { multiple: ie.value, showArrow: oe.value, hasFeedback: Z, feedbackIcon: i, prefixCls: r.value }), t); let _; J !== void 0 ? _ = J : _ = d("Select"); const A = xe(e, ["suffixIcon", "itemIcon", "removeIcon", "clearIcon", "switcherIcon", "bordered", "status", "onUpdate:value", "onUpdate:treeExpandedKeys", "onUpdate:searchValue"]), V = tt(!ke && j.value, { [`${r.value}-lg`]: D.value === "large", [`${r.value}-sm`]: D.value === "small", [`${r.value}-rtl`]: g.value === "rtl", [`${r.value}-borderless`]: !Te, [`${r.value}-in-form-item`]: Oe }, el(r.value, c.value, Z), h.value, a.class, Q.value), L = {}; return e.treeData === void 0 && t.default && (L.children = Pt(t.default())), ne(se(z(Cl, Y(Y(Y(Y({}, a), A), {}, { disabled: T.value, virtual: N.value, dropdownMatchSelectWidth: x.value, id: Ae, fieldNames: Pe, ref: q, prefixCls: r.value, class: V, listHeight: Ie, listItemHeight: Ve, treeLine: !!be, inputIcon: p, multiple: Ne, removeIcon: m, clearIcon: E, switcherIcon: ($) => $t(G.value, De, $, t.leafIcon, be), showTreeIcon: Ee, notFoundContent: _, getPopupContainer: w == null ? void 0 : w.value, treeMotion: null, dropdownClassName: ue.value, choiceTransitionName: X.value, onChange: me, onBlur: ce, onSearch: ye, onTreeExpand: ge }, L), {}, { transitionName: P.value, customSlots: y(y({}, t), { treeCheckable: () => z("span", { class: `${r.value}-tree-checkbox-inner` }, null) }), maxTagPlaceholder: e.maxTagPlaceholder || t.maxTagPlaceholder, placement: F.value, showArrow: Z || Le, placeholder: Ke }), y(y({}, t), { treeCheckable: () => z("span", { class: `${r.value}-tree-checkbox-inner` }, null) })))); }; } }), rt = pe, st = y(Re, { TreeNode: pe, SHOW_ALL: ul, SHOW_PARENT: ft, SHOW_CHILD: Ye, install: (e) => (e.component(Re.name, Re), e.component(rt.displayName, rt), e) }), Tl = { class: "s-tree-select-common" }, Il = ["title"], Vl = ["title"], Nl = ["title"], El = { __name: "STreeSelect", props: { // 过滤字段 - search为tree 时生效 filterField: { type: String, default: "name" }, // 树节点属性 props: { type: Object, default: () => ({ children: "children", label: "name", value: "value" }) }, // 是否支持查询 search: { type: Boolean, default: !0 }, // 是否支持清空 clear: { type: Boolean, default: !0 }, // 是否展开所有节点 expandAll: { type: Boolean, default: !1 }, // 占位符 - 文案提示 placeholder: { type: String, default() { return window.$l("请选择"); } }, // 默认值 - 默认选中项 // 默认为空字符串,表示不选中任何项,也可以是字符串数组,表示选中项的 value 值 // 默认选中项,支持 v-model 双向绑定 value: { type: [String, Array], default() { return ""; } }, // 获取数据 recursionChildren: { type: Function, default: () => [] }, // 是否添加全选节点 appendRootNodeAll: { type: Boolean, default: !1 }, // 多选 multiple: { type: Boolean, default: !1 }, // 显示数量 maxTagCount: { type: Number, default: 1 }, // listHeight: { type: Number, default: 232 } }, emits: ["change"], setup(e, { emit: n }) { const a = n, t = e, l = B(""), o = B([]), s = B([]), u = t.multiple ? B([]) : B(null), c = B([]), r = B(""); Se( () => t.value, (f) => { f && (u.value = f); }, { immediate: !0 } ); const d = (f) => { u.value = f, a("change", u.value); }, g = (f) => { f.value = f; }, N = () => { s.value = [], t.recursionChildren("", l.value).then((f) => { o.value = x(f), o.value && o.value.length > 0 && (t.value ? s.value = [t.value] : s.value = [o.value[0].id]); }); }, x = (f) => { if (t.appendRootNodeAll) { const S = { id: "all", key: "all", value: "all", label: "全选", name: "全选", title: "全选", type: "1", typeLabel: "组织", parent: { id: "0" }, children: null, isLeaf: !0 }; w(f, c.value, "children"), c.value && c.value.length && (c.value = c.value.map((k) => k.id)), f.unshift(S); } return f; }, I = (f, S) => S.name.toLowerCase().indexOf(f.toLowerCase()) >= 0, w = (f, S = [], k = "children") => { f && f.length > 0 && f.forEach((h) => { const D = Je({}, h); S.push(D), h[k] instanceof Array && h[k].length > 0 && w(h[k], S, k); }); }; return Ct(() => { N(); }), (f, S) => { const k = st; return fe(), de("div", Tl, [ z(k, { style: { width: "100%" }, multiple: e.multiple, "allow-clear": e.clear, "field-names": t, "show-search": e.search, "tree-data": o.value, listHeight: e.listHeight, maxTagCount: e.maxTagCount, placeholder: e.placeholder, value: Ze(u), "onUpdate:value": S[0] || (S[0] = (h) => wt(u) ? u.value = h : null), showCheckedStrategy: Ze(st).SHOW_ALL, searchValue: r.value, "onUpdate:searchValue": S[1] || (S[1] = (h) => r.value = h), "tree-node-filter-prop": e.filterField, "tree-default-expand-all": e.expandAll, treeExpandedKeys: s.value, "onUpdate:treeExpandedKeys": S[2] || (S[2] = (h) => s.value = h), filterTreeNode: I, onTreeExpand: g, onSelect: d }, { title: xt(({ name: h }) => [ r.value.length ? (fe(!0), de(et, { key: 0 }, kt(h.toString().split(new RegExp(`(?<=${r.value})|(?=${r.value})`, "i")), (D, v) => (fe(), de(et, { key: v }, [ D.toLowerCase() === r.value.toLowerCase() ? (fe(), de("span", { key: 0, title: h, class: "s-theme-color" }, He(D), 9, Il)) : (fe(), de("span", { key: 1, title: h }, He(D), 9, Vl)) ], 64))), 128)) : (fe(), de("div", { key: 1, title: h }, He(h.length > 15 ? h.slice(0, 15) + "..." : h), 9, Nl)) ]), _: 1 }, 8, ["multiple", "allow-clear", "field-names", "show-search", "tree-data", "listHeight", "maxTagCount", "placeholder", "value", "showCheckedStrategy", "searchValue", "tree-node-filter-prop", "tree-default-expand-all", "treeExpandedKeys"]) ]); }; } }, Bl = /* @__PURE__ */ _t(El, [["__scopeId", "data-v-1f380c9a"]]); export { Bl as default };