UNPKG

@coderlt/form-designer

Version:

基于vue3的设计器,可视化开发页面表单

1,665 lines 134 kB
import { i as Q } from "./interopRequireDefault-40f894e3.js"; import { r as ee } from "./_vue_commonjs-external-eb7fec7f.js"; import { r as me, a as ze } from "./public_api-1267ff2a.js"; import { i as kn, d as De, b as Ke, s as eo, o as Do, a as Dt, r as Wt } from "./useConfigInject-d85d8c62.js"; import { r as Eo } from "./index-74b3b9ac.js"; import { r as Pe } from "./index-f96a976e.js"; import { r as Et } from "./KeyCode-5c436a1d.js"; import { r as to } from "./vnode-45aa23d5.js"; import { r as Fo, a as No } from "./SearchOutlined-00b6927b.js"; import { r as jt } from "./pickAttrs-8a877861.js"; import { r as qo } from "./index-9c0620ba.js"; import { r as Lo } from "./isMobile-e33eaeb7.js"; import { r as Bo } from "./index-bdab2b06.js"; import { r as Ft } from "./raf-dd6c1047.js"; import { b as no } from "./PortalWrapper-9d2c005f.js"; import { r as Ho } from "./useMemo-d0dca8cc.js"; import { r as oo } from "./omit-84b99e2b.js"; import { r as Ao } from "./useMergedState-8adea16c.js"; import { r as Uo } from "./useState-f730f903.js"; import { r as Wo } from "./DownOutlined-946f47d7.js"; import { r as jo } from "./LoadingOutlined-7a37e4f8.js"; import { r as zo } from "./CheckOutlined-7bbf15ee.js"; import { r as Ko } from "./CloseOutlined-ca523fbb.js"; import { r as Go } from "./CloseCircleFilled-9cec1aca.js"; import { r as Yo } from "./index-977e4f68.js"; import { a as Xo } from "./compact-item-020b9c99.js"; var Ut = {}, je = {}, Te = {}, He = {}, un; function zt() { if (un) return He; un = 1; var t = Q; Object.defineProperty(He, "__esModule", { value: !0 }), He.fillFieldNames = v, He.flattenOptions = b, He.getSeparatedContent = u, He.injectPropsWithOption = d; var e = t(me()), h = kn(); function p(n, l) { const { key: o } = n; let f; return "value" in n && ({ value: f } = n), o ?? (f !== void 0 ? f : `rc-index-key-${l}`); } function v(n, l) { const { label: o, value: f, options: r } = n || {}; return { label: o || (l ? "children" : "label"), value: f || "value", options: r || "options" }; } function b(n) { let { fieldNames: l, childrenAsData: o } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const f = [], { label: r, value: m, options: a } = v(l, !1); function i(w, I) { w.forEach((y) => { const F = y[r]; if (I || !(a in y)) { const A = y[m]; f.push({ key: p(y, f.length), groupOption: I, data: y, label: F, value: A }); } else { let A = F; A === void 0 && o && (A = y.label), f.push({ key: p(y, f.length), group: !0, data: y, label: A }), i(y[a], !0); } }); } return i(n, !1), f; } function d(n) { const l = (0, e.default)({}, n); return "props" in l || Object.defineProperty(l, "props", { get() { return (0, h.warning)(!1, "Return type is option instead of Option instance. Please read value directly instead of reading from `props`."), l; } }), l; } function u(n, l) { if (!l || !l.length) return null; let o = !1; function f(m, a) { let [i, ...w] = a; if (!i) return [m]; const I = m.split(i); return o = o || I.length > 1, I.reduce((y, F) => [...y, ...f(F, w)], []).filter((y) => y); } const r = f(n, l); return o ? r : null; } return He; } var Ye = {}, sn; function Qo() { if (sn) return Ye; sn = 1; var t = Q; Object.defineProperty(Ye, "__esModule", { value: !0 }), Ye.default = void 0; var e = ee, h = t(ze()), p = t(me()), v = t(Eo()), b = t(Pe()), d = t(De()), u = function(f, r) { var m = {}; for (var a in f) Object.prototype.hasOwnProperty.call(f, a) && r.indexOf(a) < 0 && (m[a] = f[a]); if (f != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, a = Object.getOwnPropertySymbols(f); i < a.length; i++) r.indexOf(a[i]) < 0 && Object.prototype.propertyIsEnumerable.call(f, a[i]) && (m[a[i]] = f[a[i]]); return m; }; const n = (f) => { const r = f === !0 ? 0 : 1; return { bottomLeft: { points: ["tl", "bl"], offset: [0, 4], overflow: { adjustX: r, adjustY: 1 } }, bottomRight: { points: ["tr", "br"], offset: [0, 4], overflow: { adjustX: r, adjustY: 1 } }, topLeft: { points: ["bl", "tl"], offset: [0, -4], overflow: { adjustX: r, adjustY: 1 } }, topRight: { points: ["br", "tr"], offset: [0, -4], overflow: { adjustX: r, adjustY: 1 } } }; }; var o = (0, e.defineComponent)({ name: "SelectTrigger", inheritAttrs: !1, props: { dropdownAlign: Object, visible: { type: Boolean, default: void 0 }, disabled: { type: Boolean, default: void 0 }, dropdownClassName: String, dropdownStyle: b.default.object, placement: String, empty: { type: Boolean, default: void 0 }, prefixCls: String, popupClassName: String, animation: String, transitionName: String, getPopupContainer: Function, dropdownRender: Function, containerWidth: Number, dropdownMatchSelectWidth: b.default.oneOfType([Number, Boolean]).def(!0), popupElement: b.default.any, direction: String, getTriggerDOMNode: Function, onPopupVisibleChange: Function, onPopupMouseEnter: Function, onPopupFocusin: Function, onPopupFocusout: Function }, setup(f, r) { let { slots: m, attrs: a, expose: i } = r; const w = (0, e.computed)(() => { const { dropdownMatchSelectWidth: y } = f; return n(y); }), I = (0, e.ref)(); return i({ getPopupElement: () => I.value }), () => { const y = (0, p.default)((0, p.default)({}, f), a), { empty: F = !1 } = y, A = u(y, ["empty"]), { visible: R, dropdownAlign: D, prefixCls: O, popupElement: $, dropdownClassName: V, dropdownStyle: c, direction: L = "ltr", placement: s, dropdownMatchSelectWidth: _, containerWidth: C, dropdownRender: M, animation: q, transitionName: H, getPopupContainer: G, getTriggerDOMNode: K, onPopupVisibleChange: J, onPopupMouseEnter: te, onPopupFocusin: le, onPopupFocusout: ae } = A, S = `${O}-dropdown`; let E = $; M && (E = M({ menuNode: $, props: f })); const j = q ? `${S}-${q}` : H, B = (0, p.default)({ minWidth: `${C}px` }, c); return typeof _ == "number" ? B.width = `${_}px` : _ && (B.width = `${C}px`), (0, e.createVNode)(v.default, (0, h.default)((0, h.default)({}, f), {}, { showAction: J ? ["click"] : [], hideAction: J ? ["click"] : [], popupPlacement: s || (L === "rtl" ? "bottomRight" : "bottomLeft"), builtinPlacements: w.value, prefixCls: S, popupTransitionName: j, popupAlign: D, popupVisible: R, getPopupContainer: G, popupClassName: (0, d.default)(V, { [`${S}-empty`]: F }), popupStyle: B, getTriggerDOMNode: K, onPopupVisibleChange: J }), { default: m.default, popup: () => (0, e.createVNode)("div", { ref: I, onMouseenter: te, onFocusin: le, onFocusout: ae }, [E]) }); }; } }); return Ye.default = o, Ye; } var Xe = {}, Qe = {}, Ze = {}, cn; function Kt() { if (cn) return Ze; cn = 1; var t = Q; Object.defineProperty(Ze, "__esModule", { value: !0 }), Ze.default = void 0; var e = ee, h = t(Pe()); const p = (b, d) => { let { slots: u } = d; var n; const { class: l, customizeIcon: o, customizeIconProps: f, onMousedown: r, onClick: m } = b; let a; return typeof o == "function" ? a = o(f) : a = o, (0, e.createVNode)("span", { class: l, onMousedown: (i) => { i.preventDefault(), r && r(i); }, style: { userSelect: "none", WebkitUserSelect: "none" }, unselectable: "on", onClick: m, "aria-hidden": !0 }, [a !== void 0 ? a : (0, e.createVNode)("span", { class: l.split(/\s+/).map((i) => `${i}-icon`) }, [(n = u.default) === null || n === void 0 ? void 0 : n.call(u)])]); }; p.inheritAttrs = !1, p.displayName = "TransBtn", p.props = { class: String, customizeIcon: h.default.any, customizeIconProps: h.default.any, onMousedown: Function, onClick: Function }; var v = p; return Ze.default = v, Ze; } var Ae = {}, dn; function lo() { if (dn) return Ae; dn = 1; var t = Q; Object.defineProperty(Ae, "__esModule", { value: !0 }), Ae.inputProps = Ae.default = void 0; var e = ee, h = t(me()), p = to(), v = t(Pe()), b = t(Fo()), d = t(De()); const u = { inputRef: v.default.any, prefixCls: String, id: String, inputElement: v.default.VueNode, disabled: { type: Boolean, default: void 0 }, autofocus: { type: Boolean, default: void 0 }, autocomplete: String, editable: { type: Boolean, default: void 0 }, activeDescendantId: String, value: String, open: { type: Boolean, default: void 0 }, tabindex: v.default.oneOfType([v.default.number, v.default.string]), /** Pass accessibility props to input */ attrs: v.default.object, onKeydown: { type: Function }, onMousedown: { type: Function }, onChange: { type: Function }, onPaste: { type: Function }, onCompositionstart: { type: Function }, onCompositionend: { type: Function }, onFocus: { type: Function }, onBlur: { type: Function } }; Ae.inputProps = u; var l = (0, e.defineComponent)({ compatConfig: { MODE: 3 }, name: "SelectInput", inheritAttrs: !1, props: u, setup(o) { let f = null; const r = (0, e.inject)("VCSelectContainerEvent"); return () => { var m; const { prefixCls: a, id: i, inputElement: w, disabled: I, tabindex: y, autofocus: F, autocomplete: A, editable: R, activeDescendantId: D, value: O, onKeydown: $, onMousedown: V, onChange: c, onPaste: L, onCompositionstart: s, onCompositionend: _, onFocus: C, onBlur: M, open: q, inputRef: H, attrs: G } = o; let K = w || (0, e.withDirectives)((0, e.createVNode)("input", null, null), [[b.default]]); const J = K.props || {}, { onKeydown: te, onInput: le, onFocus: ae, onBlur: S, onMousedown: E, onCompositionstart: j, onCompositionend: B, style: ne } = J; return K = (0, p.cloneElement)(K, (0, h.default)((0, h.default)((0, h.default)((0, h.default)((0, h.default)({ type: "search" }, J), { id: i, ref: H, disabled: I, tabindex: y, autocomplete: A || "off", autofocus: F, class: (0, d.default)(`${a}-selection-search-input`, (m = K == null ? void 0 : K.props) === null || m === void 0 ? void 0 : m.class), role: "combobox", "aria-expanded": q, "aria-haspopup": "listbox", "aria-owns": `${i}_list`, "aria-autocomplete": "list", "aria-controls": `${i}_list`, "aria-activedescendant": D }), G), { value: R ? O : "", readonly: !R, unselectable: R ? null : "on", style: (0, h.default)((0, h.default)({}, ne), { opacity: R ? null : 0 }), onKeydown: (Y) => { $(Y), te && te(Y); }, onMousedown: (Y) => { V(Y), E && E(Y); }, onInput: (Y) => { c(Y), le && le(Y); }, onCompositionstart(Y) { s(Y), j && j(Y); }, onCompositionend(Y) { _(Y), B && B(Y); }, onPaste: L, onFocus: function() { clearTimeout(f), ae && ae(arguments.length <= 0 ? void 0 : arguments[0]), C && C(arguments.length <= 0 ? void 0 : arguments[0]), r == null || r.focus(arguments.length <= 0 ? void 0 : arguments[0]); }, onBlur: function() { for (var Y = arguments.length, Z = new Array(Y), he = 0; he < Y; he++) Z[he] = arguments[he]; f = setTimeout(() => { S && S(Z[0]), M && M(Z[0]), r == null || r.blur(Z[0]); }, 100); } }), K.type === "textarea" ? {} : { type: "search" }), !0, !0), K; }; } }); return Ae.default = l, Ae; } var Je = {}, fn; function Gt() { if (fn) return Je; fn = 1, Object.defineProperty(Je, "__esModule", { value: !0 }), Je.default = p, Je.useProvideLegacySelectContext = h; var t = ee; const e = Symbol("TreeSelectLegacyContextPropsKey"); function h(v) { return (0, t.provide)(e, v); } function p() { return (0, t.inject)(e, {}); } return Je; } var pn; function Zo() { if (pn) return Qe; pn = 1; var t = Q; Object.defineProperty(Qe, "__esModule", { value: !0 }), Qe.default = void 0; var e = ee, h = t(Kt()), p = t(lo()), v = t(De()), b = t(jt()), d = t(Pe()), u = t(qo()), n = t(Gt()); const l = { id: String, prefixCls: String, values: d.default.array, open: { type: Boolean, default: void 0 }, searchValue: String, inputRef: d.default.any, placeholder: d.default.any, disabled: { type: Boolean, default: void 0 }, mode: String, showSearch: { type: Boolean, default: void 0 }, autofocus: { type: Boolean, default: void 0 }, autocomplete: String, activeDescendantId: String, tabindex: d.default.oneOfType([d.default.number, d.default.string]), removeIcon: d.default.any, choiceTransitionName: String, maxTagCount: d.default.oneOfType([d.default.number, d.default.string]), maxTagTextLength: Number, maxTagPlaceholder: d.default.any.def(() => (m) => `+ ${m.length} ...`), tagRender: Function, onToggleOpen: { type: Function }, onRemove: Function, onInputChange: Function, onInputPaste: Function, onInputKeyDown: Function, onInputMouseDown: Function, onInputCompositionStart: Function, onInputCompositionEnd: Function }, o = (m) => { m.preventDefault(), m.stopPropagation(); }; var r = (0, e.defineComponent)({ name: "MultipleSelectSelector", inheritAttrs: !1, props: l, setup(m) { const a = (0, e.shallowRef)(), i = (0, e.shallowRef)(0), w = (0, e.shallowRef)(!1), I = (0, n.default)(), y = (0, e.computed)(() => `${m.prefixCls}-selection`), F = (0, e.computed)(() => m.open || m.mode === "tags" ? m.searchValue : ""), A = (0, e.computed)(() => m.mode === "tags" || m.showSearch && (m.open || w.value)); (0, e.onMounted)(() => { (0, e.watch)(F, () => { i.value = a.value.scrollWidth; }, { flush: "post", immediate: !0 }); }); function R(V, c, L, s, _) { return (0, e.createVNode)("span", { class: (0, v.default)(`${y.value}-item`, { [`${y.value}-item-disabled`]: L }), title: typeof V == "string" || typeof V == "number" ? V.toString() : void 0 }, [(0, e.createVNode)("span", { class: `${y.value}-item-content` }, [c]), s && (0, e.createVNode)(h.default, { class: `${y.value}-item-remove`, onMousedown: o, onClick: _, customizeIcon: m.removeIcon }, { default: () => [(0, e.createTextVNode)("×")] })]); } function D(V, c, L, s, _, C) { var M; const q = (G) => { o(G), m.onToggleOpen(!open); }; let H = C; return I.keyEntities && (H = ((M = I.keyEntities[V]) === null || M === void 0 ? void 0 : M.node) || {}), (0, e.createVNode)("span", { key: V, onMousedown: q }, [m.tagRender({ label: c, value: V, disabled: L, closable: s, onClose: _, option: H })]); } function O(V) { const { disabled: c, label: L, value: s, option: _ } = V, C = !m.disabled && !c; let M = L; if (typeof m.maxTagTextLength == "number" && (typeof L == "string" || typeof L == "number")) { const H = String(M); H.length > m.maxTagTextLength && (M = `${H.slice(0, m.maxTagTextLength)}...`); } const q = (H) => { var G; H && H.stopPropagation(), (G = m.onRemove) === null || G === void 0 || G.call(m, V); }; return typeof m.tagRender == "function" ? D(s, M, c, C, q, _) : R(L, M, c, C, q); } function $(V) { const { maxTagPlaceholder: c = (s) => `+ ${s.length} ...` } = m, L = typeof c == "function" ? c(V) : c; return R(L, L, !1); } return () => { const { id: V, prefixCls: c, values: L, open: s, inputRef: _, placeholder: C, disabled: M, autofocus: q, autocomplete: H, activeDescendantId: G, tabindex: K, onInputChange: J, onInputPaste: te, onInputKeyDown: le, onInputMouseDown: ae, onInputCompositionStart: S, onInputCompositionEnd: E } = m, j = (0, e.createVNode)("div", { class: `${y.value}-search`, style: { width: i.value + "px" }, key: "input" }, [(0, e.createVNode)(p.default, { inputRef: _, open: s, prefixCls: c, id: V, inputElement: null, disabled: M, autofocus: q, autocomplete: H, editable: A.value, activeDescendantId: G, value: F.value, onKeydown: le, onMousedown: ae, onChange: J, onPaste: te, onCompositionstart: S, onCompositionend: E, tabindex: K, attrs: (0, b.default)(m, !0), onFocus: () => w.value = !0, onBlur: () => w.value = !1 }, null), (0, e.createVNode)("span", { ref: a, class: `${y.value}-search-mirror`, "aria-hidden": !0 }, [F.value, (0, e.createTextVNode)(" ")])]), B = (0, e.createVNode)(u.default, { prefixCls: `${y.value}-overflow`, data: L, renderItem: O, renderRest: $, suffix: j, itemKey: "key", maxCount: m.maxTagCount, key: "overflow" }, null); return (0, e.createVNode)(e.Fragment, null, [B, !L.length && !F.value && (0, e.createVNode)("span", { class: `${y.value}-placeholder` }, [C])]); }; } }); return Qe.default = r, Qe; } var ke = {}, vn; function Jo() { if (vn) return ke; vn = 1; var t = Q; Object.defineProperty(ke, "__esModule", { value: !0 }), ke.default = void 0; var e = ee, h = t(jt()), p = t(lo()), v = t(Pe()), b = t(Gt()); const d = { inputElement: v.default.any, id: String, prefixCls: String, values: v.default.array, open: { type: Boolean, default: void 0 }, searchValue: String, inputRef: v.default.any, placeholder: v.default.any, disabled: { type: Boolean, default: void 0 }, mode: String, showSearch: { type: Boolean, default: void 0 }, autofocus: { type: Boolean, default: void 0 }, autocomplete: String, activeDescendantId: String, tabindex: v.default.oneOfType([v.default.number, v.default.string]), activeValue: String, backfill: { type: Boolean, default: void 0 }, optionLabelRender: Function, onInputChange: Function, onInputPaste: Function, onInputKeyDown: Function, onInputMouseDown: Function, onInputCompositionStart: Function, onInputCompositionEnd: Function }, u = (0, e.defineComponent)({ name: "SingleSelector", setup(l) { const o = (0, e.shallowRef)(!1), f = (0, e.computed)(() => l.mode === "combobox"), r = (0, e.computed)(() => f.value || l.showSearch), m = (0, e.computed)(() => { let y = l.searchValue || ""; return f.value && l.activeValue && !o.value && (y = l.activeValue), y; }), a = (0, b.default)(); (0, e.watch)([f, () => l.activeValue], () => { f.value && (o.value = !1); }, { immediate: !0 }); const i = (0, e.computed)(() => l.mode !== "combobox" && !l.open && !l.showSearch ? !1 : !!m.value), w = (0, e.computed)(() => { const y = l.values[0]; return y && (typeof y.label == "string" || typeof y.label == "number") ? y.label.toString() : void 0; }), I = () => { if (l.values[0]) return null; const y = i.value ? { visibility: "hidden" } : void 0; return (0, e.createVNode)("span", { class: `${l.prefixCls}-selection-placeholder`, style: y }, [l.placeholder]); }; return () => { var y, F, A, R; const { inputElement: D, prefixCls: O, id: $, values: V, inputRef: c, disabled: L, autofocus: s, autocomplete: _, activeDescendantId: C, open: M, tabindex: q, optionLabelRender: H, onInputKeyDown: G, onInputMouseDown: K, onInputChange: J, onInputPaste: te, onInputCompositionStart: le, onInputCompositionEnd: ae } = l, S = V[0]; let E = null; if (S && a.customSlots) { const j = (y = S.key) !== null && y !== void 0 ? y : S.value, B = ((F = a.keyEntities[j]) === null || F === void 0 ? void 0 : F.node) || {}; E = a.customSlots[(A = B.slots) === null || A === void 0 ? void 0 : A.title] || a.customSlots.title || S.label, typeof E == "function" && (E = E(B)); } else E = H && S ? H(S.option) : S == null ? void 0 : S.label; return (0, e.createVNode)(e.Fragment, null, [(0, e.createVNode)("span", { class: `${O}-selection-search` }, [(0, e.createVNode)(p.default, { inputRef: c, prefixCls: O, id: $, open: M, inputElement: D, disabled: L, autofocus: s, autocomplete: _, editable: r.value, activeDescendantId: C, value: m.value, onKeydown: G, onMousedown: K, onChange: (j) => { o.value = !0, J(j); }, onPaste: te, onCompositionstart: le, onCompositionend: ae, tabindex: q, attrs: (0, h.default)(l, !0) }, null)]), !f.value && S && !i.value && (0, e.createVNode)("span", { class: `${O}-selection-item`, title: w.value }, [(0, e.createVNode)(e.Fragment, { key: (R = S.key) !== null && R !== void 0 ? R : S.value }, [E])]), I()]); }; } }); u.props = d, u.inheritAttrs = !1; var n = u; return ke.default = n, ke; } var yt = {}, mn; function ko() { if (mn) return yt; mn = 1; var t = Q; Object.defineProperty(yt, "__esModule", { value: !0 }), yt.isValidateOpenKey = h; var e = t(Et()); function h(p) { return ![ // System function button e.default.ESC, e.default.SHIFT, e.default.BACKSPACE, e.default.TAB, e.default.WIN_KEY, e.default.ALT, e.default.META, e.default.WIN_KEY_RIGHT, e.default.CTRL, e.default.SEMICOLON, e.default.EQUALS, e.default.CAPS_LOCK, e.default.CONTEXT_MENU, // F1-F12 e.default.F1, e.default.F2, e.default.F3, e.default.F4, e.default.F5, e.default.F6, e.default.F7, e.default.F8, e.default.F9, e.default.F10, e.default.F11, e.default.F12 ].includes(p); } return yt; } var St = {}, hn; function ao() { if (hn) return St; hn = 1, Object.defineProperty(St, "__esModule", { value: !0 }), St.default = e; var t = ee; function e() { let h = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 250, p = null, v; (0, t.onBeforeUnmount)(() => { clearTimeout(v); }); function b(d) { (d || p === null) && (p = d), clearTimeout(v), v = setTimeout(() => { p = null; }, h); } return [() => p, b]; } return St; } var Ue = {}, gn; function Nt() { if (gn) return Ue; gn = 1, Object.defineProperty(Ue, "__esModule", { value: !0 }), Ue.composeRef = h, Ue.default = void 0, Ue.fillRef = e; function t() { const v = (b) => { v.current = b; }; return v; } function e(v, b) { typeof v == "function" ? v(b) : typeof v == "object" && v && "current" in v && (v.current = b); } function h() { for (var v = arguments.length, b = new Array(v), d = 0; d < v; d++) b[d] = arguments[d]; return (u) => { b.forEach((n) => { e(n, u); }); }; } var p = t; return Ue.default = p, Ue; } var bn; function el() { if (bn) return Xe; bn = 1; var t = Q; Object.defineProperty(Xe, "__esModule", { value: !0 }), Xe.default = void 0; var e = ee, h = t(ze()), p = t(Et()), v = t(Zo()), b = t(Jo()), d = ko(), u = t(ao()), n = t(Nt()), l = t(Pe()), f = (0, e.defineComponent)({ name: "Selector", inheritAttrs: !1, props: { id: String, prefixCls: String, showSearch: { type: Boolean, default: void 0 }, open: { type: Boolean, default: void 0 }, /** Display in the Selector value, it's not same as `value` prop */ values: l.default.array, multiple: { type: Boolean, default: void 0 }, mode: String, searchValue: String, activeValue: String, inputElement: l.default.any, autofocus: { type: Boolean, default: void 0 }, activeDescendantId: String, tabindex: l.default.oneOfType([l.default.number, l.default.string]), disabled: { type: Boolean, default: void 0 }, placeholder: l.default.any, removeIcon: l.default.any, // Tags maxTagCount: l.default.oneOfType([l.default.number, l.default.string]), maxTagTextLength: Number, maxTagPlaceholder: l.default.any, tagRender: Function, optionLabelRender: Function, /** Check if `tokenSeparators` contains `\n` or `\r\n` */ tokenWithEnter: { type: Boolean, default: void 0 }, // Motion choiceTransitionName: String, onToggleOpen: { type: Function }, /** `onSearch` returns go next step boolean to check if need do toggle open */ onSearch: Function, onSearchSubmit: Function, onRemove: Function, onInputKeyDown: { type: Function }, /** * @private get real dom for trigger align. * This may be removed after React provides replacement of `findDOMNode` */ domRef: Function }, setup(r, m) { let { expose: a } = m; const i = (0, n.default)(); let w = !1; const [I, y] = (0, u.default)(0), F = (_) => { const { which: C } = _; (C === p.default.UP || C === p.default.DOWN) && _.preventDefault(), r.onInputKeyDown && r.onInputKeyDown(_), C === p.default.ENTER && r.mode === "tags" && !w && !r.open && r.onSearchSubmit(_.target.value), (0, d.isValidateOpenKey)(C) && r.onToggleOpen(!0); }, A = () => { y(!0); }; let R = null; const D = (_) => { r.onSearch(_, !0, w) !== !1 && r.onToggleOpen(!0); }, O = () => { w = !0; }, $ = (_) => { w = !1, r.mode !== "combobox" && D(_.target.value); }, V = (_) => { let { target: { value: C } } = _; if (r.tokenWithEnter && R && /[\r\n]/.test(R)) { const M = R.replace(/[\r\n]+$/, "").replace(/\r\n/g, " ").replace(/[\r\n]/g, " "); C = C.replace(M, R); } R = null, D(C); }, c = (_) => { const { clipboardData: C } = _; R = C.getData("text"); }, L = (_) => { let { target: C } = _; C !== i.current && (document.body.style.msTouchAction !== void 0 ? setTimeout(() => { i.current.focus(); }) : i.current.focus()); }, s = (_) => { const C = I(); _.target !== i.current && !C && _.preventDefault(), (r.mode !== "combobox" && (!r.showSearch || !C) || !r.open) && (r.open && r.onSearch("", !0, !1), r.onToggleOpen()); }; return a({ focus: () => { i.current.focus(); }, blur: () => { i.current.blur(); } }), () => { const { prefixCls: _, domRef: C, mode: M } = r, q = { inputRef: i, onInputKeyDown: F, onInputMouseDown: A, onInputChange: V, onInputPaste: c, onInputCompositionStart: O, onInputCompositionEnd: $ }, H = M === "multiple" || M === "tags" ? (0, e.createVNode)(v.default, (0, h.default)((0, h.default)({}, r), q), null) : (0, e.createVNode)(b.default, (0, h.default)((0, h.default)({}, r), q), null); return (0, e.createVNode)("div", { ref: C, class: `${_}-selector`, onClick: L, onMousedown: s }, [H]); }; } }); return Xe.default = f, Xe; } var wt = {}, yn; function tl() { if (yn) return wt; yn = 1, Object.defineProperty(wt, "__esModule", { value: !0 }), wt.default = e; var t = ee; function e(h, p, v) { function b(d) { var u, n, l; let o = d.target; o.shadowRoot && d.composed && (o = d.composedPath()[0] || o); const f = [(u = h[0]) === null || u === void 0 ? void 0 : u.value, (l = (n = h[1]) === null || n === void 0 ? void 0 : n.value) === null || l === void 0 ? void 0 : l.getPopupElement()]; p.value && f.every((r) => r && !r.contains(o) && r !== o) && v(!1); } (0, t.onMounted)(() => { window.addEventListener("mousedown", b); }), (0, t.onBeforeUnmount)(() => { window.removeEventListener("mousedown", b); }); } return wt; } var _t = {}, Sn; function nl() { if (Sn) return _t; Sn = 1, Object.defineProperty(_t, "__esModule", { value: !0 }), _t.default = e; var t = ee; function e() { let h = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 10; const p = (0, t.shallowRef)(!1); let v; const b = () => { clearTimeout(v); }; return (0, t.onMounted)(() => { b(); }), [p, (u, n) => { b(), v = setTimeout(() => { p.value = u, n && n(); }, h); }, b]; } return _t; } var et = {}, wn; function Yt() { if (wn) return et; wn = 1, Object.defineProperty(et, "__esModule", { value: !0 }), et.default = p, et.useProvideBaseSelectProps = h; var t = ee; const e = Symbol("BaseSelectContextKey"); function h(v) { return (0, t.provide)(e, v); } function p() { return (0, t.inject)(e, {}); } return et; } var _n; function Xt() { if (_n) return Te; _n = 1; var t = Q; Object.defineProperty(Te, "__esModule", { value: !0 }), Te.default = Te.baseSelectPropsWithoutPrivate = void 0, Te.isMultiple = c; var e = ee, h = t(ze()), p = t(me()), v = zt(), b = t(Qo()), d = t(el()), u = t(tl()), n = t(nl()), l = t(Kt()), o = t(ao()), f = Yt(), r = t(Pe()), m = Ke(), a = t(Lo()), i = t(Et()), w = eo(), I = t(De()), y = t(Nt()), F = t(Gt()), A = to(), R = function(s, _) { var C = {}; for (var M in s) Object.prototype.hasOwnProperty.call(s, M) && _.indexOf(M) < 0 && (C[M] = s[M]); if (s != null && typeof Object.getOwnPropertySymbols == "function") for (var q = 0, M = Object.getOwnPropertySymbols(s); q < M.length; q++) _.indexOf(M[q]) < 0 && Object.prototype.propertyIsEnumerable.call(s, M[q]) && (C[M[q]] = s[M[q]]); return C; }; const D = ["value", "onChange", "removeIcon", "placeholder", "autofocus", "maxTagCount", "maxTagTextLength", "maxTagPlaceholder", "choiceTransitionName", "onInputKeyDown", "onPopupScroll", "tabindex", "OptionList", "notFoundContent"], O = () => ({ prefixCls: String, id: String, omitDomProps: Array, // >>> Value displayValues: Array, onDisplayValuesChange: Function, // >>> Active /** Current dropdown list active item string value */ activeValue: String, /** Link search input with target element */ activeDescendantId: String, onActiveValueChange: Function, // >>> Search searchValue: String, /** Trigger onSearch, return false to prevent trigger open event */ onSearch: Function, /** Trigger when search text match the `tokenSeparators`. Will provide split content */ onSearchSplit: Function, maxLength: Number, OptionList: r.default.any, /** Tell if provided `options` is empty */ emptyOptions: Boolean }), $ = () => ({ showSearch: { type: Boolean, default: void 0 }, tagRender: { type: Function }, optionLabelRender: { type: Function }, direction: { type: String }, // MISC tabindex: Number, autofocus: Boolean, notFoundContent: r.default.any, placeholder: r.default.any, onClear: Function, choiceTransitionName: String, // >>> Mode mode: String, // >>> Status disabled: { type: Boolean, default: void 0 }, loading: { type: Boolean, default: void 0 }, // >>> Open open: { type: Boolean, default: void 0 }, defaultOpen: { type: Boolean, default: void 0 }, onDropdownVisibleChange: { type: Function }, // >>> Customize Input /** @private Internal usage. Do not use in your production. */ getInputElement: { type: Function }, /** @private Internal usage. Do not use in your production. */ getRawInputElement: { type: Function }, // >>> Selector maxTagTextLength: Number, maxTagCount: { type: [String, Number] }, maxTagPlaceholder: r.default.any, // >>> Search tokenSeparators: { type: Array }, // >>> Icons allowClear: { type: Boolean, default: void 0 }, showArrow: { type: Boolean, default: void 0 }, inputIcon: r.default.any, /** Clear all icon */ clearIcon: r.default.any, /** Selector remove icon */ removeIcon: r.default.any, // >>> Dropdown animation: String, transitionName: String, dropdownStyle: { type: Object }, dropdownClassName: String, dropdownMatchSelectWidth: { type: [Boolean, Number], default: void 0 }, dropdownRender: { type: Function }, dropdownAlign: Object, placement: { type: String }, getPopupContainer: { type: Function }, // >>> Focus showAction: { type: Array }, onBlur: { type: Function }, onFocus: { type: Function }, // >>> Rest Events onKeyup: Function, onKeydown: Function, onMousedown: Function, onPopupScroll: Function, onInputKeyDown: Function, onMouseenter: Function, onMouseleave: Function, onClick: Function }); Te.baseSelectPropsWithoutPrivate = $; const V = () => (0, p.default)((0, p.default)({}, O()), $()); function c(s) { return s === "tags" || s === "multiple"; } var L = (0, e.defineComponent)({ compatConfig: { MODE: 3 }, name: "BaseSelect", inheritAttrs: !1, props: (0, m.initDefaultProps)(V(), { showAction: [], notFoundContent: "Not Found" }), setup(s, _) { let { attrs: C, expose: M, slots: q } = _; const H = (0, e.computed)(() => c(s.mode)), G = (0, e.computed)(() => s.showSearch !== void 0 ? s.showSearch : H.value || s.mode === "combobox"), K = (0, e.shallowRef)(!1); (0, e.onMounted)(() => { K.value = (0, a.default)(); }); const J = (0, F.default)(), te = (0, e.shallowRef)(null), le = (0, y.default)(), ae = (0, e.shallowRef)(null), S = (0, e.shallowRef)(null), E = (0, e.shallowRef)(null), j = (0, e.ref)(!1), [B, ne, Y] = (0, n.default)(); M({ focus: () => { var g; (g = S.value) === null || g === void 0 || g.focus(); }, blur: () => { var g; (g = S.value) === null || g === void 0 || g.blur(); }, scrollTo: (g) => { var T; return (T = E.value) === null || T === void 0 ? void 0 : T.scrollTo(g); } }); const ue = (0, e.computed)(() => { var g; if (s.mode !== "combobox") return s.searchValue; const T = (g = s.displayValues[0]) === null || g === void 0 ? void 0 : g.value; return typeof T == "string" || typeof T == "number" ? String(T) : ""; }), se = s.open !== void 0 ? s.open : s.defaultOpen, Se = (0, e.shallowRef)(se), X = (0, e.shallowRef)(se), ge = (g) => { Se.value = s.open !== void 0 ? s.open : g, X.value = Se.value; }; (0, e.watch)(() => s.open, () => { ge(s.open); }); const Oe = (0, e.computed)(() => !s.notFoundContent && s.emptyOptions); (0, e.watchEffect)(() => { X.value = Se.value, (s.disabled || Oe.value && X.value && s.mode === "combobox") && (X.value = !1); }); const xe = (0, e.computed)(() => Oe.value ? !1 : X.value), be = (g) => { const T = g !== void 0 ? g : !X.value; X.value !== T && !s.disabled && (ge(T), s.onDropdownVisibleChange && s.onDropdownVisibleChange(T)); }, P = (0, e.computed)(() => (s.tokenSeparators || []).some((g) => [` `, `\r `].includes(g))), W = (g, T, re) => { var ie, ve; let k = !0, Ce = g; (ie = s.onActiveValueChange) === null || ie === void 0 || ie.call(s, null); const ye = re ? null : (0, v.getSeparatedContent)(g, s.tokenSeparators); return s.mode !== "combobox" && ye && (Ce = "", (ve = s.onSearchSplit) === null || ve === void 0 || ve.call(s, ye), be(!1), k = !1), s.onSearch && ue.value !== Ce && s.onSearch(Ce, { source: T ? "typing" : "effect" }), k; }, oe = (g) => { var T; !g || !g.trim() || (T = s.onSearch) === null || T === void 0 || T.call(s, g, { source: "submit" }); }; (0, e.watch)(X, () => { !X.value && !H.value && s.mode !== "combobox" && W("", !1, !1); }, { immediate: !0, flush: "post" }), (0, e.watch)(() => s.disabled, () => { Se.value && s.disabled && ge(!1), s.disabled && !j.value && ne(!1); }, { immediate: !0 }); const [ce, we] = (0, o.default)(), $e = function(g) { var T; const re = ce(), { which: ie } = g; if (ie === i.default.ENTER && (s.mode !== "combobox" && g.preventDefault(), X.value || be(!0)), we(!!ue.value), ie === i.default.BACKSPACE && !re && H.value && !ue.value && s.displayValues.length) { const ye = [...s.displayValues]; let qe = null; for (let Re = ye.length - 1; Re >= 0; Re -= 1) { const Le = ye[Re]; if (!Le.disabled) { ye.splice(Re, 1), qe = Le; break; } } qe && s.onDisplayValuesChange(ye, { type: "remove", values: [qe] }); } for (var ve = arguments.length, k = new Array(ve > 1 ? ve - 1 : 0), Ce = 1; Ce < ve; Ce++) k[Ce - 1] = arguments[Ce]; X.value && E.value && E.value.onKeydown(g, ...k), (T = s.onKeydown) === null || T === void 0 || T.call(s, g, ...k); }, Ee = function(g) { for (var T = arguments.length, re = new Array(T > 1 ? T - 1 : 0), ie = 1; ie < T; ie++) re[ie - 1] = arguments[ie]; X.value && E.value && E.value.onKeyup(g, ...re), s.onKeyup && s.onKeyup(g, ...re); }, Ie = (g) => { const T = s.displayValues.filter((re) => re !== g); s.onDisplayValuesChange(T, { type: "remove", values: [g] }); }, Me = (0, e.shallowRef)(!1), Fe = function() { ne(!0), s.disabled || (s.onFocus && !Me.value && s.onFocus(...arguments), s.showAction && s.showAction.includes("focus") && be(!0)), Me.value = !0; }, de = (0, e.ref)(!1), Ne = function() { if (de.value || (j.value = !0, ne(!1, () => { Me.value = !1, j.value = !1, be(!1); }), s.disabled)) return; const g = ue.value; g && (s.mode === "tags" ? s.onSearch(g, { source: "submit" }) : s.mode === "multiple" && s.onSearch("", { source: "blur" })), s.onBlur && s.onBlur(...arguments); }, _e = () => { de.value = !0; }, fe = () => { de.value = !1; }; (0, e.provide)("VCSelectContainerEvent", { focus: Fe, blur: Ne }); const pe = []; (0, e.onMounted)(() => { pe.forEach((g) => clearTimeout(g)), pe.splice(0, pe.length); }), (0, e.onBeforeUnmount)(() => { pe.forEach((g) => clearTimeout(g)), pe.splice(0, pe.length); }); const x = function(g) { var T, re; const { target: ie } = g, ve = (T = ae.value) === null || T === void 0 ? void 0 : T.getPopupElement(); if (ve && ve.contains(ie)) { const qe = setTimeout(() => { var Re; const Le = pe.indexOf(qe); Le !== -1 && pe.splice(Le, 1), Y(), !K.value && !ve.contains(document.activeElement) && ((Re = S.value) === null || Re === void 0 || Re.focus()); }); pe.push(qe); } for (var k = arguments.length, Ce = new Array(k > 1 ? k - 1 : 0), ye = 1; ye < k; ye++) Ce[ye - 1] = arguments[ye]; (re = s.onMousedown) === null || re === void 0 || re.call(s, g, ...Ce); }, N = (0, e.shallowRef)(null), U = (0, e.getCurrentInstance)(), z = () => { U.update(); }; return (0, e.onMounted)(() => { (0, e.watch)(xe, () => { var g; if (xe.value) { const T = Math.ceil((g = te.value) === null || g === void 0 ? void 0 : g.offsetWidth); N.value !== T && !Number.isNaN(T) && (N.value = T); } }, { immediate: !0, flush: "post" }); }), (0, u.default)([te, ae], xe, be), (0, f.useProvideBaseSelectProps)((0, w.toReactive)((0, p.default)((0, p.default)({}, (0, e.toRefs)(s)), { open: X, triggerOpen: xe, showSearch: G, multiple: H, toggleOpen: be }))), () => { const g = (0, p.default)((0, p.default)({}, s), C), { prefixCls: T, id: re, open: ie, defaultOpen: ve, mode: k, // Search related showSearch: Ce, searchValue: ye, onSearch: qe, // Icons allowClear: Re, clearIcon: Le, showArrow: Zt, inputIcon: so, // Others disabled: qt, loading: gt, getInputElement: Jt, getPopupContainer: co, placement: fo, // Dropdown animation: po, transitionName: vo, dropdownStyle: mo, dropdownClassName: ho, dropdownMatchSelectWidth: go, dropdownRender: bo, dropdownAlign: yo, showAction: Il, direction: So, // Tags tokenSeparators: Rl, tagRender: wo, optionLabelRender: _o, // Events onPopupScroll: Ml, onDropdownVisibleChange: Pl, onFocus: $l, onBlur: Tl, onKeyup: Vl, onKeydown: Dl, onMousedown: El, onClear: Lt, omitDomProps: Bt, getRawInputElement: kt, displayValues: bt, onDisplayValuesChange: Co, emptyOptions: Oo, activeDescendantId: xo, activeValue: Io, OptionList: Ro } = g, Mo = R(g, ["prefixCls", "id", "open", "defaultOpen", "mode", "showSearch", "searchValue", "onSearch", "allowClear", "clearIcon", "showArrow", "inputIcon", "disabled", "loading", "getInputElement", "getPopupContainer", "placement", "animation", "transitionName", "dropdownStyle", "dropdownClassName", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "showAction", "direction", "tokenSeparators", "tagRender", "optionLabelRender", "onPopupScroll", "onDropdownVisibleChange", "onFocus", "onBlur", "onKeyup", "onKeydown", "onMousedown", "onClear", "omitDomProps", "getRawInputElement", "displayValues", "onDisplayValuesChange", "emptyOptions", "activeDescendantId", "activeValue", "OptionList"]), en = k === "combobox" && Jt && Jt() || null, Ge = typeof kt == "function" && kt(), Ht = (0, p.default)({}, Mo); let tn; Ge && (tn = (Be) => { be(Be); }), D.forEach((Be) => { delete Ht[Be]; }), Bt == null || Bt.forEach((Be) => { delete Ht[Be]; }); const nn = Zt !== void 0 ? Zt : gt || !H.value && k !== "combobox"; let on; nn && (on = (0, e.createVNode)(l.default, { class: (0, I.default)(`${T}-arrow`, { [`${T}-arrow-loading`]: gt }), customizeIcon: so, customizeIconProps: { loading: gt, searchValue: ue.value, open: X.value, focused: B.value, showSearch: G.value } }, null)); let ln; const Po = () => { Lt == null || Lt(), Co([], { type: "clear", values: bt }), W("", !1, !1); }; !qt && Re && (bt.length || ue.value) && (ln = (0, e.createVNode)(l.default, { class: `${T}-clear`, onMousedown: Po, customizeIcon: Le }, { default: () => [(0, e.createTextVNode)("×")] })); const $o = (0, e.createVNode)(Ro, { ref: E }, (0, p.default)((0, p.default)({}, J.customSlots), { option: q.option })), To = (0, I.default)(T, C.class, { [`${T}-focused`]: B.value, [`${T}-multiple`]: H.value, [`${T}-single`]: !H.value, [`${T}-allow-clear`]: Re, [`${T}-show-arrow`]: nn, [`${T}-disabled`]: qt, [`${T}-loading`]: gt, [`${T}-open`]: X.value, [`${T}-customize-input`]: en, [`${T}-show-search`]: G.value }), an = (0, e.createVNode)(b.default, { ref: ae, disabled: qt, prefixCls: T, visible: xe.value, popupElement: $o, containerWidth: N.value, animation: po, transitionName: vo, dropdownStyle: mo, dropdownClassName: ho, direction: So, dropdownMatchSelectWidth: go, dropdownRender: bo, dropdownAlign: yo, placement: fo, getPopupContainer: co, empty: Oo, getTriggerDOMNode: () => le.current, onPopupVisibleChange: tn, onPopupMouseEnter: z, onPopupFocusin: _e, onPopupFocusout: fe }, { default: () => Ge ? (0, m.isValidElement)(Ge) && (0, A.cloneElement)(Ge, { ref: le }, !1, !0) : (0, e.createVNode)(d.default, (0, h.default)((0, h.default)({}, s), {}, { domRef: le, prefixCls: T, inputElement: en, ref: S, id: re, showSearch: G.value, mode: k, activeDescendantId: xo, tagRender: wo, optionLabelRender: _o, values: bt, open: X.value, onToggleOpen: be, activeValue: Io, searchValue: ue.value, onSearch: W, onSearchSubmit: oe, onRemove: Ie, tokenWithEnter: P.value }), null) }); let At; return Ge ? At = an :