import { computed as y, shallowRef as Te, ref as X, watchEffect as ie, provide as We, inject as je, watch as be, createVNode as T, defineComponent as xe, onMounted as He, toRef as pe, toRefs as Be, openBlock as ze, createElementBlock as Xe, unref as Ue } from "vue"; import { _ as k, w as qe, i as Ge, c as Se, u as Ye, K as Y, a as Z, b as De, d as oe, o as we, e as Je, P as ye, g as Qe, t as Ze, f as et, h as tt, j as nt, k as lt, l as at, m as ot, L as st, R as it, n as rt, p as Ve, q as ct } from "./index2.js"; import { u as Ie, a as ut, B as dt, b as vt, c as pt, g as ht } from "./index3.js"; import { u as ke } from "./useMergedState.js"; import { c as ft, u as mt, a as Ce, g as gt } from "./index4.js"; import "./index5.js"; import { g as Ct, a as St } from "./statusUtils.js"; import { u as yt, F as bt } from "./FormItemContext.js"; const Pe = "__RC_CASCADER_SPLIT__", $e = "SHOW_PARENT", Ne = "SHOW_CHILD"; function ee(e) { return e.join(Pe); } function se(e) { return e.map(ee); } function xt(e) { return e.split(Pe); } function wt(e) { const { label: a, value: t, children: n } = e || {}, l = t || "value"; return { label: a || "label", value: l, key: l, children: n || "children" }; } function ce(e, a) { var t, n; return (t = e.isLeaf) !== null && t !== void 0 ? t : !(!((n = e[a.children]) === null || n === void 0) && n.length); } function It(e) { const a = e.parentElement; if (!a) return; const t = e.offsetTop - a.offsetTop; t - a.scrollTop < 0 ? a.scrollTo({ top: t }) : t + e.offsetHeight - a.scrollTop > a.offsetHeight && a.scrollTo({ top: t + e.offsetHeight - a.offsetHeight }); } const Pt = (e, a) => y(() => ft(e.value, { fieldNames: a.value, initWrapper: (n) => k(k({}, n), { pathKeyEntities: {} }), processEntity: (n, l) => { const i = n.nodes.map((r) => r[a.value.value]).join(Pe); l.pathKeyEntities[i] = n, n.key = i; } }).pathKeyEntities); function Ot(e) { const a = Te(!1), t = X({}); return ie(() => { if (!e.value) { a.value = !1, t.value = {}; return; } let n = { matchInputWidth: !0, limit: 50 }; e.value && typeof e.value == "object" && (n = k(k({}, n), e.value)), n.limit <= 0 && (delete n.limit, process.env.NODE_ENV !== "production" && qe(!1, "'limit' of showSearch should be positive number or false.")), a.value = !0, t.value = n; }), { showSearch: a, searchConfig: t }; } const ue = "__rc_cascader_search_mark__", Vt = (e, a, t) => { let { label: n } = t; return a.some((l) => String(l[n]).toLowerCase().includes(e.toLowerCase())); }, kt = (e) => { let { path: a, fieldNames: t } = e; return a.map((n) => n[t.label]).join(" / "); }, _t = (e, a, t, n, l, i) => y(() => { const { filter: r = Vt, render: d = kt, limit: v = 50, sort: c } = l.value, o = []; if (!e.value) return []; function C(P, b) { P.forEach((D) => { if (!c && v > 0 && o.length >= v) return; const m = [...b, D], x = D[t.value.children]; // If is leaf option (!x || x.length === 0 || // If is changeOnSelect i.value) && r(e.value, m, { label: t.value.label }) && o.push(k(k({}, D), { [t.value.label]: d({ inputValue: e.value, path: m, prefixCls: n.value, fieldNames: t.value }), [ue]: m })), x && C(D[t.value.children], m); }); } return C(a.value, []), c && o.sort((P, b) => c(P[ue], b[ue], e.value, t.value)), v > 0 ? o.slice(0, v) : o; }); function _e(e, a, t) { const n = new Set(e); return e.filter((l) => { const i = a[l], r = i ? i.parent : null, d = i ? i.children : null; return t === Ne ? !(d && d.some((v) => v.key && n.has(v.key))) : !(r && !r.node.disabled && n.has(r.key)); }); } function de(e, a, t) { let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1; var l; let i = a; const r = []; for (let d = 0; d < e.length; d += 1) { const v = e[d], c = i == null ? void 0 : i.findIndex((C) => { const P = C[t.value]; return n ? String(P) === String(v) : P === v; }), o = c !== -1 ? i == null ? void 0 : i[c] : null; r.push({ value: (l = o == null ? void 0 : o[t.value]) !== null && l !== void 0 ? l : v, index: c, option: o }), i = o == null ? void 0 : o[t.children]; } return r; } const At = (e, a, t) => y(() => { const n = [], l = []; return t.value.forEach((i) => { de(i, e.value, a.value).every((d) => d.option) ? l.push(i) : n.push(i); }), [l, n]; }), Et = (e, a, t, n, l) => y(() => { const i = l.value || // Default displayRender ((r) => { let { labels: d } = r; const v = n.value ? d.slice(-1) : d, c = " / "; return v.every((o) => ["string", "number"].includes(typeof o)) ? v.join(c) : v.reduce((o, C, P) => { const b = Ge(C) ? Se(C, { key: P }) : C; return P === 0 ? [b] : [...o, c, b]; }, []); }); return e.value.map((r) => { const d = de(r, a.value, t.value), v = i({ labels: d.map((o) => { let { option: C, value: P } = o; var b; return (b = C == null ? void 0 : C[t.value.label]) !== null && b !== void 0 ? b : P; }), selectedOptions: d.map((o) => { let { option: C } = o; return C; }) }), c = ee(r); return { label: v, value: c, key: c, valueCells: r }; }); }), Re = Symbol("CascaderContextKey"), Tt = (e) => { We(Re, e); }, he = () => je(Re), Dt = () => { const e = Ie(), { values: a } = he(), [t, n] = Ye([]); return be(() => e.open, () => { if (e.open && !e.multiple) { const l = a.value[0]; n(l || []); } }, { immediate: !0 }), [t, n]; }, $t = (e, a, t, n, l, i) => { const r = Ie(), d = y(() => r.direction === "rtl"), [v, c, o] = [X([]), X(), X([])]; ie(() => { let m = -1, x = a.value; const p = [], w = [], E = n.value.length; for (let _ = 0; _ < E && x; _ += 1) { const N = x.findIndex(($) => $[t.value.value] === n.value[_]); if (N === -1) break; m = N, p.push(m), w.push(n.value[_]), x = x[m][t.value.children]; } let O = a.value; for (let _ = 0; _ < p.length - 1; _ += 1) O = O[p[_]][t.value.children]; [v.value, c.value, o.value] = [w, m, O]; }); const C = (m) => { l(m); }, P = (m) => { const x = o.value.length; let p = c.value; p === -1 && m < 0 && (p = x); for (let w = 0; w < x; w += 1) { p = (p + m + x) % x; const E = o.value[p]; if (E && !E.disabled) { const O = E[t.value.value], _ = v.value.slice(0, -1).concat(O); C(_); return; } } }, b = () => { if (v.value.length > 1) { const m = v.value.slice(0, -1); C(m); } else r.toggleOpen(!1); }, D = () => { var m; const p = (((m = o.value[c.value]) === null || m === void 0 ? void 0 : m[t.value.children]) || []).find((w) => !w.disabled); if (p) { const w = [...v.value, p[t.value.value]]; C(w); } }; e.expose({ // scrollTo: treeRef.current?.scrollTo, onKeydown: (m) => { const { which: x } = m; switch (x) { case Y.UP: case Y.DOWN: { let p = 0; x === Y.UP ? p = -1 : x === Y.DOWN && (p = 1), p !== 0 && P(p); break; } case Y.LEFT: { d.value ? D() : b(); break; } case Y.RIGHT: { d.value ? b() : D(); break; } case Y.BACKSPACE: { r.searchValue || b(); break; } case Y.ENTER: { if (v.value.length) { const p = o.value[c.value], w = (p == null ? void 0 : p[ue]) || []; w.length ? i(w.map((E) => E[t.value.value]), w[w.length - 1]) : i(v.value, p); } break; } case Y.ESC: r.toggleOpen(!1), open && m.stopPropagation(); } }, onKeyup: () => { } }); }; function fe(e) { let { prefixCls: a, checked: t, halfChecked: n, disabled: l, onClick: i } = e; const { customSlots: r, checkable: d } = he(), v = d.value !== !1 ? r.value.checkable : d.value, c = typeof v == "function" ? v() : typeof v == "boolean" ? null : v; return T("span", { class: { [a]: !0, [`${a}-checked`]: t, [`${a}-indeterminate`]: !t && n, [`${a}-disabled`]: l }, onClick: i }, [c]); } fe.props = ["prefixCls", "checked", "halfChecked", "disabled", "onClick"]; fe.displayName = "Checkbox"; fe.inheritAttrs = !1; const Le = "__cascader_fix_label__"; function me(e) { let { prefixCls: a, multiple: t, options: n, activeValue: l, prevValuePath: i, onToggleOpen: r, onSelect: d, onActive: v, checkedSet: c, halfCheckedSet: o, loadingKeys: C, isSelectable: P } = e; var b, D, m, x, p, w; const E = `${a}-menu`, O = `${a}-menu-item`, { fieldNames: _, changeOnSelect: N, expandTrigger: $, expandIcon: U, loadingIcon: J, dropdownMenuColumnStyle: q, customSlots: M } = he(), F = (b = U.value) !== null && b !== void 0 ? b : (m = (D = M.value).expandIcon) === null || m === void 0 ? void 0 : m.call(D), W = (x = J.value) !== null && x !== void 0 ? x : (w = (p = M.value).loadingIcon) === null || w === void 0 ? void 0 : w.call(p), te = $.value === "hover"; return T("ul", { class: E, role: "menu" }, [n.map((R) => { var h; const { disabled: I } = R, s = R[ue], S = (h = R[Le]) !== null && h !== void 0 ? h : R[_.value.label], g = R[_.value.value], V = ce(R, _.value), K = s ? s.map((u) => u[_.value.value]) : [...i, g], j = ee(K), H = C.includes(j), Q = c.has(j), ne = o.has(j), le = () => { !I && (!te || !V) && v(K); }, B = () => { P(R) && d(K, V); }; let G; return typeof R.title == "string" ? G = R.title : typeof S == "string" && (G = S), T("li", { key: j, class: [O, { [`${O}-expand`]: !V, [`${O}-active`]: l === g, [`${O}-disabled`]: I, [`${O}-loading`]: H }], style: q.value, role: "menuitemcheckbox", title: G, "aria-checked": Q, "data-path-key": j, onClick: () => { le(), (!t || V) && B(); }, onDblclick: () => { N.value && r(!1); }, onMouseenter: () => { te && le(); }, onMousedown: (u) => { u.preventDefault(); } }, [t && T(fe, { prefixCls: `${a}-checkbox`, checked: Q, halfChecked: ne, disabled: I, onClick: (u) => { u.stopPropagation(), B(); } }, null), T("div", { class: `${O}-content` }, [S]), !H && F && !V && T("div", { class: `${O}-expand-icon` }, [Se(F)]), H && W && T("div", { class: `${O}-loading-icon` }, [Se(W)])]); })]); } me.props = ["prefixCls", "multiple", "options", "activeValue", "prevValuePath", "onToggleOpen", "onSelect", "onActive", "checkedSet", "halfCheckedSet", "loadingKeys", "isSelectable"]; me.displayName = "Column"; me.inheritAttrs = !1; const Nt = xe({ compatConfig: { MODE: 3 }, name: "OptionList", inheritAttrs: !1, setup(e, a) { const { attrs: t, slots: n } = a, l = Ie(), i = X(), r = y(() => l.direction === "rtl"), { options: d, values: v, halfValues: c, fieldNames: o, changeOnSelect: C, onSelect: P, searchOptions: b, dropdownPrefixCls: D, loadData: m, expandTrigger: x, customSlots: p } = he(), w = y(() => D.value || l.prefixCls), E = Te([]), O = (h) => { if (!m.value || l.searchValue) return; const s = de(h, d.value, o.value).map((g) => { let { option: V } = g; return V; }), S = s[s.length - 1]; if (S && !ce(S, o.value)) { const g = ee(h); E.value = [...E.value, g], m.value(s); } }; ie(() => { E.value.length && E.value.forEach((h) => { const I = xt(h), s = de(I, d.value, o.value, !0).map((g) => { let { option: V } = g; return V; }), S = s[s.length - 1]; (!S || S[o.value.children] || ce(S, o.value)) && (E.value = E.value.filter((g) => g !== h)); }); }); const _ = y(() => new Set(se(v.value))), N = y(() => new Set(se(c.value))), [$, U] = Dt(), J = (h) => { U(h), O(h); }, q = (h) => { const { disabled: I } = h, s = ce(h, o.value); return !I && (s || C.value || l.multiple); }, M = function(h, I) { let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; P(h), !l.multiple && (I || C.value && (x.value === "hover" || s)) && l.toggleOpen(!1); }, F = y(() => l.searchValue ? b.value : d.value), W = y(() => { const h = [{ options: F.value }]; let I = F.value; for (let s = 0; s < $.value.length; s += 1) { const S = $.value[s], g = I.find((K) => K[o.value.value] === S), V = g == null ? void 0 : g[o.value.children]; if (!(V != null && V.length)) break; I = V, h.push({ options: V }); } return h; }); $t(a, F, o, $, J, (h, I) => { q(I) && M(h, ce(I, o.value), !0); }); const R = (h) => { h.preventDefault(); }; return He(() => { be($, (h) => { var I; for (let s = 0; s < h.length; s += 1) { const S = h.slice(0, s + 1), g = ee(S), V = (I = i.value) === null || I === void 0 ? void 0 : I.querySelector(`li[data-path-key="${g.replace(/\\{0,2}"/g, '\\"')}"]`); V && It(V); } }, { flush: "post", immediate: !0 }); }), () => { var h, I, s, S, g; const { notFoundContent: V = ((h = n.notFoundContent) === null || h === void 0 ? void 0 : h.call(n)) || ((s = (I = p.value).notFoundContent) === null || s === void 0 ? void 0 : s.call(I)), multiple: K, toggleOpen: j } = l, H = !(!((g = (S = W.value[0]) === null || S === void 0 ? void 0 : S.options) === null || g === void 0) && g.length), Q = [{ [o.value.value]: "__EMPTY__", [Le]: V, disabled: !0 }], ne = k(k({}, t), { multiple: !H && K, onSelect: M, onActive: J, onToggleOpen: j, checkedSet: _.value, halfCheckedSet: N.value, loadingKeys: E.value, isSelectable: q }), B = (H ? [{ options: Q }] : W.value).map((G, u) => { const f = $.value.slice(0, u), A = $.value[u]; return T(me, Z(Z({ key: u }, ne), {}, { prefixCls: w.value, options: G.options, prevValuePath: f, activeValue: A }), null); }); return T("div", { class: [`${w.value}-menus`, { [`${w.value}-menu-empty`]: H, [`${w.value}-rtl`]: r.value }], onMousedown: R, ref: i }, [B]); }; } }); function Rt() { return k(k({}, we(vt(), ["tokenSeparators", "mode", "showSearch"])), { // MISC id: String, prefixCls: String, fieldNames: Je(), children: Array, // Value value: { type: [String, Number, Array] }, defaultValue: { type: [String, Number, Array] }, changeOnSelect: { type: Boolean, default: void 0 }, displayRender: Function, checkable: { type: Boolean, default: void 0 }, showCheckedStrategy: { type: String, default: $e }, // Search showSearch: { type: [Boolean, Object], default: void 0 }, searchValue: String, onSearch: Function, // Trigger expandTrigger: String, // Options options: Array, /** @private Internal usage. Do not use in your production. */ dropdownPrefixCls: String, loadData: Function, // Open /** @deprecated Use `open` instead */ popupVisible: { type: Boolean, default: void 0 }, dropdownClassName: String, dropdownMenuColumnStyle: { type: Object, default: void 0 }, /** @deprecated Use `dropdownStyle` instead */ popupStyle: { type: Object, default: void 0 }, dropdownStyle: { type: Object, default: void 0 }, /** @deprecated Use `placement` instead */ popupPlacement: String, placement: String, /** @deprecated Use `onDropdownVisibleChange` instead */ onPopupVisibleChange: Function, onDropdownVisibleChange: Function, // Icon expandIcon: ye.any, loadingIcon: ye.any }); } function Ke() { return k(k({}, Rt()), { onChange: Function, customSlots: Object }); } function Lt(e) { return Array.isArray(e) && Array.isArray(e[0]); } function Ae(e) { return e ? Lt(e) ? e : (e.length === 0 ? [] : [e]).map((a) => Array.isArray(a) ? a : [a]) : []; } const Kt = xe({ compatConfig: { MODE: 3 }, name: "Cascader", inheritAttrs: !1, props: De(Ke(), {}), setup(e, a) { let { attrs: t, expose: n, slots: l } = a; const i = ut(pe(e, "id")), r = y(() => !!e.checkable), [d, v] = ke(e.defaultValue, { value: y(() => e.value), postState: Ae }), c = y(() => wt(e.fieldNames)), o = y(() => e.options || []), C = Pt(o, c), P = (u) => { const f = C.value; return u.map((A) => { const { nodes: L } = f[A]; return L.map((z) => z[c.value.value]); }); }, [b, D] = ke("", { value: y(() => e.searchValue), postState: (u) => u || "" }), m = (u, f) => { D(u), f.source !== "blur" && e.onSearch && e.onSearch(u); }, { showSearch: x, searchConfig: p } = Ot(pe(e, "showSearch")), w = _t(b, o, c, y(() => e.dropdownPrefixCls || e.prefixCls), p, pe(e, "changeOnSelect")), E = At(o, c, d), [O, _, N] = [X([]), X([]), X([])], { maxLevel: $, levelEntities: U } = mt(C); ie(() => { const [u, f] = E.value; if (!r.value || !d.value.length) { [O.value, _.value, N.value] = [u, [], f]; return; } const A = se(u), L = C.value, { checkedKeys: z, halfCheckedKeys: re } = Ce(A, !0, L, $.value, U.value); [O.value, _.value, N.value] = [P(z), P(re), f]; }); const J = y(() => { const u = se(O.value), f = _e(u, C.value, e.showCheckedStrategy); return [...N.value, ...P(f)]; }), q = Et(J, o, c, r, pe(e, "displayRender")), M = (u) => { if (v(u), e.onChange) { const f = Ae(u), A = f.map((re) => de(re, o.value, c.value).map((ve) => ve.option)), L = r.value ? f : f[0], z = r.value ? A : A[0]; e.onChange(L, z); } }, F = (u) => { if (D(""), !r.value) M(u); else { const f = ee(u), A = se(O.value), L = se(_.value), z = A.includes(f), re = N.value.some((ae) => ee(ae) === f); let ve = O.value, Oe = N.value; if (re && !z) Oe = N.value.filter((ae) => ee(ae) !== f); else { const ae = z ? A.filter((Fe) => Fe !== f) : [...A, f]; let ge; z ? { checkedKeys: ge } = Ce(ae, { checked: !1, halfCheckedKeys: L }, C.value, $.value, U.value) : { checkedKeys: ge } = Ce(ae, !0, C.value, $.value, U.value); const Me = _e(ge, C.value, e.showCheckedStrategy); ve = P(Me); } M([...Oe, ...ve]); } }, W = (u, f) => { if (f.type === "clear") { M([]); return; } const { valueCells: A } = f.values[0]; F(A); }; process.env.NODE_ENV !== "production" && ie(() => { oe(!e.onPopupVisibleChange, "Cascader", "`popupVisibleChange` is deprecated. Please use `dropdownVisibleChange` instead."), oe(e.popupVisible === void 0, "Cascader", "`popupVisible` is deprecated. Please use `open` instead."), oe(e.popupPlacement === void 0, "Cascader", "`popupPlacement` is deprecated. Please use `placement` instead."), oe(e.popupStyle === void 0, "Cascader", "`popupStyle` is deprecated. Please use `dropdownStyle` instead."); }); const te = y(() => e.open !== void 0 ? e.open : e.popupVisible), R = y(() => e.dropdownStyle || e.popupStyle || {}), h = y(() => e.placement || e.popupPlacement), I = (u) => { var f, A; (f = e.onDropdownVisibleChange) === null || f === void 0 || f.call(e, u), (A = e.onPopupVisibleChange) === null || A === void 0 || A.call(e, u); }, { changeOnSelect: s, checkable: S, dropdownPrefixCls: g, loadData: V, expandTrigger: K, expandIcon: j, loadingIcon: H, dropdownMenuColumnStyle: Q, customSlots: ne, dropdownClassName: le } = Be(e); Tt({ options: o, fieldNames: c, values: O, halfValues: _, changeOnSelect: s, onSelect: F, checkable: S, searchOptions: w, dropdownPrefixCls: g, loadData: V, expandTrigger: K, expandIcon: j, loadingIcon: H, dropdownMenuColumnStyle: Q, customSlots: ne }); const B = X(); n({ focus() { var u; (u = B.value) === null || u === void 0 || u.focus(); }, blur() { var u; (u = B.value) === null || u === void 0 || u.blur(); }, scrollTo(u) { var f; (f = B.value) === null || f === void 0 || f.scrollTo(u); } }); const G = y(() => we(e, [ "id", "prefixCls", "fieldNames", // Value "defaultValue", "value", "changeOnSelect", "onChange", "displayRender", "checkable", // Search "searchValue", "onSearch", "showSearch", // Trigger "expandTrigger", // Options "options", "dropdownPrefixCls", "loadData", // Open "popupVisible", "open", "dropdownClassName", "dropdownMenuColumnStyle", "popupPlacement", "placement", "onDropdownVisibleChange", "onPopupVisibleChange", // Icon "expandIcon", "loadingIcon", "customSlots", "showCheckedStrategy", // Children "children" ])); return () => { const u = !(b.value ? w.value : o.value).length, { dropdownMatchSelectWidth: f = !1 } = e, A = ( // Search to match width b.value && p.value.matchInputWidth || // Empty keep the width u ? {} : { minWidth: "auto" } ); return T(dt, Z(Z(Z({}, G.value), t), {}, { ref: B, id: i, prefixCls: e.prefixCls, dropdownMatchSelectWidth: f, dropdownStyle: k(k({}, R.value), A), displayValues: q.value, onDisplayValuesChange: W, mode: r.value ? "multiple" : void 0, searchValue: b.value, onSearch: m, showSearch: x.value, OptionList: Nt, emptyOptions: u, open: te.value, dropdownClassName: le.value, placement: h.value, onDropdownVisibleChange: I, getRawInputElement: () => { var L; return (L = l.default) === null || L === void 0 ? void 0 : L.call(l); } }), l); }; } }), Mt = (e) => { const { prefixCls: a, componentCls: t, antCls: n } = e, l = `${t}-menu-item`, i = ` &${l}-expand ${l}-expand-icon, ${l}-loading-icon `, r = Math.round((e.controlHeight - e.fontSize * e.lineHeight) / 2); return [ // ===================================================== // == Control == // ===================================================== { [t]: { width: e.controlWidth } }, // ===================================================== // == Popup == // ===================================================== { [`${t}-dropdown`]: [ // ==================== Checkbox ==================== gt(`${a}-checkbox`, e), { [`&${n}-select-dropdown`]: { padding: 0 } }, { [t]: { // ================== Checkbox ================== "&-checkbox": { top: 0, marginInlineEnd: e.paddingXS }, // ==================== Menu ==================== // >>> Menus "&-menus": { display: "flex", flexWrap: "nowrap", alignItems: "flex-start", [`&${t}-menu-empty`]: { [`${t}-menu`]: { width: "100%", height: "auto", [l]: { color: e.colorTextDisabled } } } }, // >>> Menu "&-menu": { flexGrow: 1, minWidth: e.controlItemWidth, height: e.dropdownHeight, margin: 0, padding: e.paddingXXS, overflow: "auto", verticalAlign: "top", listStyle: "none", "-ms-overflow-style": "-ms-autohiding-scrollbar", "&:not(:last-child)": { borderInlineEnd: `${e.lineWidth}px ${e.lineType} ${e.colorSplit}` }, "&-item": k(k({}, Ze), { display: "flex", flexWrap: "nowrap", alignItems: "center", padding: `${r}px ${e.paddingSM}px`, lineHeight: e.lineHeight, cursor: "pointer", transition: `all ${e.motionDurationMid}`, borderRadius: e.borderRadiusSM, "&:hover": { background: e.controlItemBgHover }, "&-disabled": { color: e.colorTextDisabled, cursor: "not-allowed", "&:hover": { background: "transparent" }, [i]: { color: e.colorTextDisabled } }, [`&-active:not(${l}-disabled)`]: { "&, &:hover": { fontWeight: e.fontWeightStrong, backgroundColor: e.controlItemBgActive } }, "&-content": { flex: "auto" }, [i]: { marginInlineStart: e.paddingXXS, color: e.colorTextDescription, fontSize: e.fontSizeIcon }, "&-keyword": { color: e.colorHighlight } }) } } } ] }, // ===================================================== // == RTL == // ===================================================== { [`${t}-dropdown-rtl`]: { direction: "rtl" } }, // ===================================================== // == Space Compact == // ===================================================== et(e) ]; }, Ft = Qe("Cascader", (e) => [Mt(e)], { controlWidth: 184, controlItemWidth: 111, dropdownHeight: 180 }); var Wt = function(e, a) { var t = {}; for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && a.indexOf(n) < 0 && (t[n] = e[n]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, n = Object.getOwnPropertySymbols(e); l < n.length; l++) a.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[l]) && (t[n[l]] = e[n[l]]); return t; }; function jt(e, a, t) { const n = e.toLowerCase().split(a).reduce((r, d, v) => v === 0 ? [d] : [...r, a, d], []), l = []; let i = 0; return n.forEach((r, d) => { const v = i + r.length; let c = e.slice(i, v); i = v, d % 2 === 1 && (c = T("span", { class: `${t}-menu-item-keyword`, key: "seperator" }, [c])), l.push(c); }), l; } const Ht = (e) => { let { inputValue: a, path: t, prefixCls: n, fieldNames: l } = e; const i = [], r = a.toLowerCase(); return t.forEach((d, v) => { v !== 0 && i.push(" / "); let c = d[l.label]; const o = typeof c; (o === "string" || o === "number") && (c = jt(String(c), r, n)), i.push(c); }), i; }; function Bt() { return k(k({}, we(Ke(), ["customSlots", "checkable", "options"])), { multiple: { type: Boolean, default: void 0 }, size: String, bordered: { type: Boolean, default: void 0 }, placement: { type: String }, suffixIcon: ye.any, status: String, options: Array, popupClassName: String, /** @deprecated Please use `popupClassName` instead */ dropdownClassName: String, "onUpdate:value": Function }); } const zt = xe({ compatConfig: { MODE: 3 }, name: "ACascader", inheritAttrs: !1, props: De(Bt(), { bordered: !0, choiceTransitionName: "", allowClear: !0 }), setup(e, a) { let { attrs: t, expose: n, slots: l, emit: i } = a; process.env.NODE_ENV !== "production" && oe(!e.dropdownClassName, "Cascader", "`dropdownClassName` is deprecated. Please use `popupClassName` instead."); const r = yt(), d = bt.useInject(), v = y(() => Ct(d.status, e.status)), { prefixCls: c, rootPrefixCls: o, getPrefixCls: C, direction: P, getPopupContainer: b, renderEmpty: D, size: m, disabled: x } = nt("cascader", e), p = y(() => C("select", e.prefixCls)), { compactSize: w, compactItemClassnames: E } = lt(p, P), O = y(() => w.value || m.value), _ = at(), N = y(() => { var s; return (s = x.value) !== null && s !== void 0 ? s : _.value; }), [$, U] = pt(p), [J] = Ft(c), q = y(() => P.value === "rtl"); process.env.NODE_ENV !== "production" && ie(() => { oe(!e.multiple || !e.displayRender || !l.displayRender, "Cascader", "`displayRender` not work on `multiple`. Please use `tagRender` instead."); }); const M = y(() => { if (!e.showSearch) return e.showSearch; let s = { render: Ht }; return typeof e.showSearch == "object" && (s = k(k({}, s), e.showSearch)), s; }), F = y(() => ot(e.popupClassName || e.dropdownClassName, `${c.value}-dropdown`, { [`${c.value}-dropdown-rtl`]: q.value }, U.value)), W = X(); n({ focus() { var s; (s = W.value) === null || s === void 0 || s.focus(); }, blur() { var s; (s = W.value) === null || s === void 0 || s.blur(); } }); const te = function() { for (var s = arguments.length, S = new Array(s), g = 0; g < s; g++) S[g] = arguments[g]; i("update:value", S[0]), i("change", ...S), r.onFieldChange(); }, R = function() { for (var s = arguments.length, S = new Array(s), g = 0; g < s; g++) S[g] = arguments[g]; i("blur", ...S), r.onFieldBlur(); }, h = y(() => e.showArrow !== void 0 ? e.showArrow : e.loading || !e.multiple), I = y(() => e.placement !== void 0 ? e.placement : P.value === "rtl" ? "bottomRight" : "bottomLeft"); return () => { var s, S; const { notFoundContent: g = (s = l.notFoundContent) === null || s === void 0 ? void 0 : s.call(l), expandIcon: V = (S = l.expandIcon) === null || S === void 0 ? void 0 : S.call(l), multiple: K, bordered: j, allowClear: H, choiceTransitionName: Q, transitionName: ne, id: le = r.id.value } = e, B = Wt(e, ["notFoundContent", "expandIcon", "multiple", "bordered", "allowClear", "choiceTransitionName", "transitionName", "id"]), G = g || D("Cascader"); let u = V; V || (u = q.value ? T(st, null, null) : T(it, null, null)); const f = T("span", { class: `${p.value}-menu-item-loading-icon` }, [T(rt, { spin: !0 }, null)]), { suffixIcon: A, removeIcon: L, clearIcon: z } = ht(k(k({}, e), { hasFeedback: d.hasFeedback, feedbackIcon: d.feedbackIcon, multiple: K, prefixCls: p.value, showArrow: h.value }), l); return J($(T(Kt, Z(Z(Z({}, B), t), {}, { id: le, prefixCls: p.value, class: [c.value, { [`${p.value}-lg`]: O.value === "large", [`${p.value}-sm`]: O.value === "small", [`${p.value}-rtl`]: q.value, [`${p.value}-borderless`]: !j, [`${p.value}-in-form-item`]: d.isFormItemInput }, St(p.value, v.value, d.hasFeedback), E.value, t.class, U.value], disabled: N.value, direction: P.value, placement: I.value, notFoundContent: G, allowClear: H, showSearch: M.value, expandIcon: u, inputIcon: A, removeIcon: L, clearIcon: z, loadingIcon: f, checkable: !!K, dropdownClassName: F.value, dropdownPrefixCls: c.value, choiceTransitionName: Ve(o.value, "", Q), transitionName: Ve(o.value, ct(I.value), ne), getPopupContainer: b == null ? void 0 : b.value, customSlots: k(k({}, l), { checkable: () => T("span", { class: `${c.value}-checkbox-inner` }, null) }), tagRender: e.tagRender || l.tagRender, displayRender: e.displayRender || l.displayRender, maxTagPlaceholder: e.maxTagPlaceholder || l.maxTagPlaceholder, showArrow: d.hasFeedback || e.showArrow, onChange: te, onBlur: R, ref: W }), l))); }; } }), Ee = tt(k(zt, { SHOW_CHILD: Ne, SHOW_PARENT: $e })), Xt = { class: "s-cascader-common" }, tn = { __name: "SCascader", props: { // 支持清空 clear: { type: Boolean, default: !0 }, // 默认选中项,支持 v-model 双向绑定 modelValue: { type: [String, Array], default() { return ""; } }, // 占位符 - 文案提示 placeholder: { type: String, default: "请选择" }, // 树节点数据 options: { type: Array, default() { return []; } }, // 禁用 disabled: { type: Boolean, default: !1 }, // 菜单展开方式 expandTrigger: { type: String, default: "click" }, // options 配字段置项 fieldNames: { type: Object, default() { return { label: "name", value: "value", children: "children" }; } }, // 显示数量 maxTagCount: { type: Number, default: 1 }, // 多选 multiple: { type: Boolean, default: !0 } }, setup(e) { const a = e, t = X(""); return be(() => a.modelValue, (n) => { n != null && n.length && (t.value = n); }, { immediate: !0 }), (n, l) => { const i = Ee; return ze(), Xe("div", Xt, [ T(i, { options: e.options, allowClear: e.clear, disabled: e.disabled, multiple: e.multiple, fieldNames: e.fieldNames, maxTagCount: e.maxTagCount, placeholder: e.placeholder, value: t.value, "onUpdate:value": l[0] || (l[0] = (r) => t.value = r), expandTrigger: e.expandTrigger, showCheckedStrategy: Ue(Ee).SHOW_CHILD, style: { width: "100%" } }, null, 8, ["options", "allowClear", "disabled", "multiple", "fieldNames", "maxTagCount", "placeholder", "value", "expandTrigger", "showCheckedStrategy"]) ]); }; } }; export { tn as default };