| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884 |
- import { c as pe, o as be, _ as W, n as he, K, J as Be, a8 as ze, d as E, bz as Q, bA as _e, i as Me, q as Ne, P as ue, j as Ge, u as Ke, x as We, y as Ue, B as Xe, C as qe, bB as Je, M as Qe, Q as fe, O as Ye, N as Pe } from "./index2.js";
- import { provide as Ze, inject as et, defineComponent as Oe, computed as S, reactive as tt, watch as ye, toRaw as ke, nextTick as Ae, createVNode as $, Fragment as nt, shallowRef as se, watchEffect as me, toRef as Z, ref as Te } from "vue";
- import { u as lt, T as ot, i as Le, d as Se, a as at, f as it, e as st, t as ut, B as rt, b as ct, c as dt, g as ft } from "./index4.js";
- import { c as vt } from "./createRef.js";
- import { L as mt } from "./List.js";
- import { u as pt } from "./useMemo.js";
- import { u as Ee } from "./useMergedState.js";
- import { u as ht, F as bt } from "./FormItemContext.js";
- import { g as gt, a as yt } from "./statusUtils.js";
- function St() {
- return /(mac\sos|macintosh)/i.test(navigator.appVersion);
- }
- const Re = Symbol("SelectContextKey");
- function Ot(e) {
- return Ze(Re, e);
- }
- function wt() {
- return et(Re, {});
- }
- var Ct = function(e, d) {
- var b = {};
- for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && d.indexOf(o) < 0 && (b[o] = e[o]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, o = Object.getOwnPropertySymbols(e); n < o.length; n++)
- d.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[n]) && (b[o[n]] = e[o[n]]);
- return b;
- };
- function Fe(e) {
- return typeof e == "string" || typeof e == "number";
- }
- const It = Oe({
- compatConfig: {
- MODE: 3
- },
- name: "OptionList",
- inheritAttrs: !1,
- setup(e, d) {
- let {
- expose: b,
- slots: o
- } = d;
- const n = lt(), u = wt(), m = S(() => `${n.prefixCls}-item`), f = pt(() => u.flattenOptions, [() => n.open, () => u.flattenOptions], (l) => l[0]), p = vt(), g = (l) => {
- l.preventDefault();
- }, h = (l) => {
- p.current && p.current.scrollTo(typeof l == "number" ? {
- index: l
- } : l);
- }, O = function(l) {
- let y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
- const _ = f.value.length;
- for (let v = 0; v < _; v += 1) {
- const N = (l + v * y + _) % _, {
- group: j,
- data: H
- } = f.value[N];
- if (!j && !H.disabled)
- return N;
- }
- return -1;
- }, F = tt({
- activeIndex: O(0)
- }), I = function(l) {
- let y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
- F.activeIndex = l;
- const _ = {
- source: y ? "keyboard" : "mouse"
- }, v = f.value[l];
- if (!v) {
- u.onActiveValue(null, -1, _);
- return;
- }
- u.onActiveValue(v.value, l, _);
- };
- ye([() => f.value.length, () => n.searchValue], () => {
- I(u.defaultActiveFirstOption !== !1 ? O(0) : -1);
- }, {
- immediate: !0
- });
- const w = (l) => u.rawValues.has(l) && n.mode !== "combobox";
- ye([() => n.open, () => n.searchValue], () => {
- if (!n.multiple && n.open && u.rawValues.size === 1) {
- const l = Array.from(u.rawValues)[0], y = ke(f.value).findIndex((_) => {
- let {
- data: v
- } = _;
- return v[u.fieldNames.value] === l;
- });
- y !== -1 && (I(y), Ae(() => {
- h(y);
- }));
- }
- n.open && Ae(() => {
- var l;
- (l = p.current) === null || l === void 0 || l.scrollTo(void 0);
- });
- }, {
- immediate: !0,
- flush: "post"
- });
- const C = (l) => {
- l !== void 0 && u.onSelect(l, {
- selected: !u.rawValues.has(l)
- }), n.multiple || n.toggleOpen(!1);
- }, V = (l) => typeof l.label == "function" ? l.label() : l.label;
- function k(l) {
- const y = f.value[l];
- if (!y) return null;
- const _ = y.data || {}, {
- value: v
- } = _, {
- group: N
- } = y, j = Be(_, !0), H = V(y);
- return y ? $("div", W(W({
- "aria-label": typeof H == "string" && !N ? H : null
- }, j), {}, {
- key: l,
- role: N ? "presentation" : "option",
- id: `${n.id}_list_${l}`,
- "aria-selected": w(v)
- }), [v]) : null;
- }
- return b({
- onKeydown: (l) => {
- const {
- which: y,
- ctrlKey: _
- } = l;
- switch (y) {
- case K.N:
- case K.P:
- case K.UP:
- case K.DOWN: {
- let v = 0;
- if (y === K.UP ? v = -1 : y === K.DOWN ? v = 1 : St() && _ && (y === K.N ? v = 1 : y === K.P && (v = -1)), v !== 0) {
- const N = O(F.activeIndex + v, v);
- h(N), I(N, !0);
- }
- break;
- }
- case K.ENTER: {
- const v = f.value[F.activeIndex];
- v && !v.data.disabled ? C(v.value) : C(void 0), n.open && l.preventDefault();
- break;
- }
- case K.ESC:
- n.toggleOpen(!1), n.open && l.stopPropagation();
- }
- },
- onKeyup: () => {
- },
- scrollTo: (l) => {
- h(l);
- }
- }), () => {
- const {
- id: l,
- notFoundContent: y,
- onPopupScroll: _
- } = n, {
- menuItemSelectedIcon: v,
- fieldNames: N,
- virtual: j,
- listHeight: H,
- listItemHeight: oe
- } = u, X = o.option, {
- activeIndex: L
- } = F, re = Object.keys(N).map((T) => N[T]);
- return f.value.length === 0 ? $("div", {
- role: "listbox",
- id: `${l}_list`,
- class: `${m.value}-empty`,
- onMousedown: g
- }, [y]) : $(nt, null, [$("div", {
- role: "listbox",
- id: `${l}_list`,
- style: {
- height: 0,
- width: 0,
- overflow: "hidden"
- }
- }, [k(L - 1), k(L), k(L + 1)]), $(mt, {
- itemKey: "key",
- ref: p,
- data: f.value,
- height: H,
- itemHeight: oe,
- fullHeight: !1,
- onMousedown: g,
- onScroll: _,
- virtual: j
- }, {
- default: (T, ee) => {
- var te;
- const {
- group: ae,
- groupOption: ce,
- data: r,
- value: D
- } = T, {
- key: R
- } = r, z = typeof T.label == "function" ? T.label() : T.label;
- if (ae) {
- const le = (te = r.title) !== null && te !== void 0 ? te : Fe(z) && z;
- return $("div", {
- class: pe(m.value, `${m.value}-group`),
- title: le
- }, [X ? X(r) : z !== void 0 ? z : R]);
- }
- const {
- disabled: q,
- title: ie,
- children: ne,
- style: de,
- class: t,
- className: a
- } = r, i = Ct(r, ["disabled", "title", "children", "style", "class", "className"]), c = be(i, re), s = w(D), A = `${m.value}-option`, J = pe(m.value, A, t, a, {
- [`${A}-grouped`]: ce,
- [`${A}-active`]: L === ee && !q,
- [`${A}-disabled`]: q,
- [`${A}-selected`]: s
- }), B = V(T), G = !v || typeof v == "function" || s, M = typeof B == "number" ? B : B || D;
- let ve = Fe(M) ? M.toString() : void 0;
- return ie !== void 0 && (ve = ie), $("div", W(W({}, c), {}, {
- "aria-selected": s,
- class: J,
- title: ve,
- onMousemove: (le) => {
- i.onMousemove && i.onMousemove(le), !(L === ee || q) && I(ee);
- },
- onClick: (le) => {
- q || C(D), i.onClick && i.onClick(le);
- },
- style: de
- }), [$("div", {
- class: `${A}-content`
- }, [X ? X(r) : M]), he(v) || s, G && $(ot, {
- class: `${m.value}-option-state`,
- customizeIcon: v,
- customizeIconProps: {
- isSelected: s
- }
- }, {
- default: () => [s ? "✓" : null]
- })]);
- }
- })]);
- };
- }
- });
- var Vt = function(e, d) {
- var b = {};
- for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && d.indexOf(o) < 0 && (b[o] = e[o]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, o = Object.getOwnPropertySymbols(e); n < o.length; n++)
- d.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[n]) && (b[o[n]] = e[o[n]]);
- return b;
- };
- function xt(e) {
- const d = e, {
- key: b,
- children: o
- } = d, n = d.props, {
- value: u,
- disabled: m
- } = n, f = Vt(n, ["value", "disabled"]), p = o == null ? void 0 : o.default;
- return E({
- key: b,
- value: u !== void 0 ? u : b,
- children: p,
- disabled: m || m === ""
- }, f);
- }
- function we(e) {
- let d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
- return ze(e).map((o, n) => {
- var u;
- if (!he(o) || !o.type)
- return null;
- const {
- type: {
- isSelectOptGroup: m
- },
- key: f,
- children: p,
- props: g
- } = o;
- if (d || !m)
- return xt(o);
- const h = p && p.default ? p.default() : void 0, O = (g == null ? void 0 : g.label) || ((u = p.label) === null || u === void 0 ? void 0 : u.call(p)) || f;
- return E(E({
- key: `__RC_SELECT_GRP__${f === null ? n : String(f)}__`
- }, g), {
- label: O,
- options: we(h || [])
- });
- }).filter((o) => o);
- }
- function _t(e, d, b) {
- const o = se(), n = se(), u = se(), m = se([]);
- return ye([e, d], () => {
- e.value ? m.value = ke(e.value).slice() : m.value = we(d.value);
- }, {
- immediate: !0,
- deep: !0
- }), me(() => {
- const f = m.value, p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), h = b.value;
- function O(F) {
- let I = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
- for (let w = 0; w < F.length; w += 1) {
- const C = F[w];
- !C[h.options] || I ? (p.set(C[h.value], C), g.set(C[h.label], C)) : O(C[h.options], !0);
- }
- }
- O(f), o.value = f, n.value = p, u.value = g;
- }), {
- options: o,
- valueOptions: n,
- labelOptions: u
- };
- }
- function Ce(e) {
- return Array.isArray(e) ? e : e !== void 0 ? [e] : [];
- }
- const Nt = typeof window != "undefined" && window.document && window.document.documentElement;
- process.env.NODE_ENV;
- function Pt(e) {
- const {
- mode: d,
- options: b,
- children: o,
- backfill: n,
- allowClear: u,
- placeholder: m,
- getInputElement: f,
- showSearch: p,
- onSearch: g,
- defaultOpen: h,
- autofocus: O,
- labelInValue: F,
- value: I,
- inputValue: w,
- optionLabelProp: C
- } = e, V = Le(d), k = p !== void 0 ? p : V || d === "combobox", U = b || we(o);
- if (Q(d !== "tags" || U.every((P) => !P.disabled), "Please avoid setting option to disabled in tags mode since user can always type text as tag."), Q(d !== "combobox" || !C, "`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."), Q(d === "combobox" || !n, "`backfill` only works with `combobox` mode."), Q(d === "combobox" || !f, "`getInputElement` only work with `combobox` mode."), _e(d !== "combobox" || !f || !u || !m, "Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."), g && !k && d !== "combobox" && d !== "tags" && Q(!1, "`onSearch` should work with `showSearch` instead of use alone."), _e(!h || O, "`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autofocus` if needed."), I != null) {
- const P = Ce(I);
- Q(!F || P.every((x) => typeof x == "object" && ("key" in x || "value" in x)), "`value` should in shape of `{ value: string | number, label?: any }` when you set `labelInValue` to `true`"), Q(!V || Array.isArray(I), "`value` should be array when `mode` is `multiple` or `tags`");
- }
- if (o) {
- let P = null;
- o.some((x) => {
- var l;
- if (!he(x) || !x.type)
- return !1;
- const {
- type: y
- } = x;
- return y.isSelectOption ? !1 : y.isSelectOptGroup ? !(((l = x.children) === null || l === void 0 ? void 0 : l.default()) || []).every((N) => !he(N) || !x.type || N.type.isSelectOption ? !0 : (P = N.type, !1)) : (P = y, !0);
- }), P && Q(!1, `\`children\` should be \`Select.Option\` or \`Select.OptGroup\` instead of \`${P.displayName || P.name || P}\`.`), Q(w === void 0, "`inputValue` is deprecated, please use `searchValue` instead.");
- }
- }
- function ge(e, d) {
- return Ce(e).join("").toUpperCase().includes(d);
- }
- const At = (e, d, b, o, n) => S(() => {
- const u = b.value, m = n == null ? void 0 : n.value, f = o == null ? void 0 : o.value;
- if (!u || f === !1)
- return e.value;
- const {
- options: p,
- label: g,
- value: h
- } = d.value, O = [], F = typeof f == "function", I = u.toUpperCase(), w = F ? f : (V, k) => m ? ge(k[m], I) : k[p] ? ge(k[g !== "children" ? g : "label"], I) : ge(k[h], I), C = F ? (V) => Se(V) : (V) => V;
- return e.value.forEach((V) => {
- if (V[p]) {
- if (w(u, C(V)))
- O.push(V);
- else {
- const U = V[p].filter((P) => w(u, C(P)));
- U.length && O.push(E(E({}, V), {
- [p]: U
- }));
- }
- return;
- }
- w(u, C(V)) && O.push(V);
- }), O;
- }), Et = (e, d) => {
- const b = se({
- values: /* @__PURE__ */ new Map(),
- options: /* @__PURE__ */ new Map()
- });
- return [S(() => {
- const {
- values: u,
- options: m
- } = b.value, f = e.value.map((h) => {
- var O;
- return h.label === void 0 ? E(E({}, h), {
- label: (O = u.get(h.value)) === null || O === void 0 ? void 0 : O.label
- }) : h;
- }), p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
- return f.forEach((h) => {
- p.set(h.value, h), g.set(h.value, d.value.get(h.value) || m.get(h.value));
- }), b.value.values = p, b.value.options = g, f;
- }), (u) => d.value.get(u) || b.value.options.get(u)];
- }, Ft = ["inputValue"];
- function $e() {
- return E(E({}, ct()), {
- prefixCls: String,
- id: String,
- backfill: {
- type: Boolean,
- default: void 0
- },
- // >>> Field Names
- fieldNames: Object,
- // >>> Search
- /** @deprecated Use `searchValue` instead */
- inputValue: String,
- searchValue: String,
- onSearch: Function,
- autoClearSearchValue: {
- type: Boolean,
- default: void 0
- },
- // >>> Select
- onSelect: Function,
- onDeselect: Function,
- // >>> Options
- /**
- * In Select, `false` means do nothing.
- * In TreeSelect, `false` will highlight match item.
- * It's by design.
- */
- filterOption: {
- type: [Boolean, Function],
- default: void 0
- },
- filterSort: Function,
- optionFilterProp: String,
- optionLabelProp: String,
- options: Array,
- defaultActiveFirstOption: {
- type: Boolean,
- default: void 0
- },
- virtual: {
- type: Boolean,
- default: void 0
- },
- listHeight: Number,
- listItemHeight: Number,
- // >>> Icon
- menuItemSelectedIcon: ue.any,
- mode: String,
- labelInValue: {
- type: Boolean,
- default: void 0
- },
- value: ue.any,
- defaultValue: ue.any,
- onChange: Function,
- children: Array
- });
- }
- function Dt(e) {
- return !e || typeof e != "object";
- }
- const Mt = Oe({
- compatConfig: {
- MODE: 3
- },
- name: "VcSelect",
- inheritAttrs: !1,
- props: Me($e(), {
- prefixCls: "vc-select",
- autoClearSearchValue: !0,
- listHeight: 200,
- listItemHeight: 20,
- dropdownMatchSelectWidth: !0
- }),
- setup(e, d) {
- let {
- expose: b,
- attrs: o,
- slots: n
- } = d;
- const u = at(Z(e, "id")), m = S(() => Le(e.mode)), f = S(() => !!(!e.options && e.children)), p = S(() => e.filterOption === void 0 && e.mode === "combobox" ? !1 : e.filterOption), g = S(() => it(e.fieldNames, f.value)), [h, O] = Ee("", {
- value: S(() => e.searchValue !== void 0 ? e.searchValue : e.inputValue),
- postState: (t) => t || ""
- }), F = _t(Z(e, "options"), Z(e, "children"), g), {
- valueOptions: I,
- labelOptions: w,
- options: C
- } = F, V = (t) => Ce(t).map((i) => {
- var c, s;
- let A, J, B, G;
- Dt(i) ? A = i : (B = i.key, J = i.label, A = (c = i.value) !== null && c !== void 0 ? c : B);
- const M = I.value.get(A);
- return M && (J === void 0 && (J = M == null ? void 0 : M[e.optionLabelProp || g.value.label]), B === void 0 && (B = (s = M == null ? void 0 : M.key) !== null && s !== void 0 ? s : A), G = M == null ? void 0 : M.disabled), {
- label: J,
- value: A,
- key: B,
- disabled: G,
- option: M
- };
- }), [k, U] = Ee(e.defaultValue, {
- value: Z(e, "value")
- }), P = S(() => {
- var t;
- const a = V(k.value);
- return e.mode === "combobox" && !(!((t = a[0]) === null || t === void 0) && t.value) ? [] : a;
- }), [x, l] = Et(P, I), y = S(() => {
- if (!e.mode && x.value.length === 1) {
- const t = x.value[0];
- if (t.value === null && (t.label === null || t.label === void 0))
- return [];
- }
- return x.value.map((t) => {
- var a;
- return E(E({}, t), {
- label: (a = typeof t.label == "function" ? t.label() : t.label) !== null && a !== void 0 ? a : t.value
- });
- });
- }), _ = S(() => new Set(x.value.map((t) => t.value)));
- me(() => {
- var t;
- if (e.mode === "combobox") {
- const a = (t = x.value[0]) === null || t === void 0 ? void 0 : t.value;
- a != null && O(String(a));
- }
- }, {
- flush: "post"
- });
- const v = (t, a) => {
- const i = a != null ? a : t;
- return {
- [g.value.value]: t,
- [g.value.label]: i
- };
- }, N = se();
- me(() => {
- if (e.mode !== "tags") {
- N.value = C.value;
- return;
- }
- const t = C.value.slice(), a = (i) => I.value.has(i);
- [...x.value].sort((i, c) => i.value < c.value ? -1 : 1).forEach((i) => {
- const c = i.value;
- a(c) || t.push(v(c, i.label));
- }), N.value = t;
- });
- const j = At(N, g, h, p, Z(e, "optionFilterProp")), H = S(() => e.mode !== "tags" || !h.value || j.value.some((t) => t[e.optionFilterProp || "value"] === h.value) ? j.value : [v(h.value), ...j.value]), oe = S(() => e.filterSort ? [...H.value].sort((t, a) => e.filterSort(t, a)) : H.value), X = S(() => st(oe.value, {
- fieldNames: g.value,
- childrenAsData: f.value
- })), L = (t) => {
- const a = V(t);
- if (U(a), e.onChange && // Trigger event only when value changed
- (a.length !== x.value.length || a.some((i, c) => {
- var s;
- return ((s = x.value[c]) === null || s === void 0 ? void 0 : s.value) !== (i == null ? void 0 : i.value);
- }))) {
- const i = e.labelInValue ? a.map((s) => E(E({}, s), {
- originLabel: s.label,
- label: typeof s.label == "function" ? s.label() : s.label
- })) : a.map((s) => s.value), c = a.map((s) => Se(l(s.value)));
- e.onChange(
- // Value
- m.value ? i : i[0],
- // Option
- m.value ? c : c[0]
- );
- }
- }, [re, T] = Ne(null), [ee, te] = Ne(0), ae = S(() => e.defaultActiveFirstOption !== void 0 ? e.defaultActiveFirstOption : e.mode !== "combobox"), ce = function(t, a) {
- let {
- source: i = "keyboard"
- } = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
- te(a), e.backfill && e.mode === "combobox" && t !== null && i === "keyboard" && T(String(t));
- }, r = (t, a) => {
- const i = () => {
- var c;
- const s = l(t), A = s == null ? void 0 : s[g.value.label];
- return [e.labelInValue ? {
- label: typeof A == "function" ? A() : A,
- originLabel: A,
- value: t,
- key: (c = s == null ? void 0 : s.key) !== null && c !== void 0 ? c : t
- } : t, Se(s)];
- };
- if (a && e.onSelect) {
- const [c, s] = i();
- e.onSelect(c, s);
- } else if (!a && e.onDeselect) {
- const [c, s] = i();
- e.onDeselect(c, s);
- }
- }, D = (t, a) => {
- let i;
- const c = m.value ? a.selected : !0;
- c ? i = m.value ? [...x.value, t] : [t] : i = x.value.filter((s) => s.value !== t), L(i), r(t, c), e.mode === "combobox" ? T("") : (!m.value || e.autoClearSearchValue) && (O(""), T(""));
- }, R = (t, a) => {
- L(t), (a.type === "remove" || a.type === "clear") && a.values.forEach((i) => {
- r(i.value, !1);
- });
- }, z = (t, a) => {
- var i;
- if (O(t), T(null), a.source === "submit") {
- const c = (t || "").trim();
- if (c) {
- const s = Array.from(/* @__PURE__ */ new Set([..._.value, c]));
- L(s), r(c, !0), O("");
- }
- return;
- }
- a.source !== "blur" && (e.mode === "combobox" && L(t), (i = e.onSearch) === null || i === void 0 || i.call(e, t));
- }, q = (t) => {
- let a = t;
- e.mode !== "tags" && (a = t.map((c) => {
- const s = w.value.get(c);
- return s == null ? void 0 : s.value;
- }).filter((c) => c !== void 0));
- const i = Array.from(/* @__PURE__ */ new Set([..._.value, ...a]));
- L(i), i.forEach((c) => {
- r(c, !0);
- });
- }, ie = S(() => e.virtual !== !1 && e.dropdownMatchSelectWidth !== !1);
- Ot(ut(E(E({}, F), {
- flattenOptions: X,
- onActiveValue: ce,
- defaultActiveFirstOption: ae,
- onSelect: D,
- menuItemSelectedIcon: Z(e, "menuItemSelectedIcon"),
- rawValues: _,
- fieldNames: g,
- virtual: ie,
- listHeight: Z(e, "listHeight"),
- listItemHeight: Z(e, "listItemHeight"),
- childrenAsData: f
- }))), process.env.NODE_ENV !== "production" && me(() => {
- Pt(e);
- }, {
- flush: "post"
- });
- const ne = Te();
- b({
- focus() {
- var t;
- (t = ne.value) === null || t === void 0 || t.focus();
- },
- blur() {
- var t;
- (t = ne.value) === null || t === void 0 || t.blur();
- },
- scrollTo(t) {
- var a;
- (a = ne.value) === null || a === void 0 || a.scrollTo(t);
- }
- });
- const de = S(() => be(e, [
- "id",
- "mode",
- "prefixCls",
- "backfill",
- "fieldNames",
- // Search
- "inputValue",
- "searchValue",
- "onSearch",
- "autoClearSearchValue",
- // Select
- "onSelect",
- "onDeselect",
- "dropdownMatchSelectWidth",
- // Options
- "filterOption",
- "filterSort",
- "optionFilterProp",
- "optionLabelProp",
- "options",
- "children",
- "defaultActiveFirstOption",
- "menuItemSelectedIcon",
- "virtual",
- "listHeight",
- "listItemHeight",
- // Value
- "value",
- "defaultValue",
- "labelInValue",
- "onChange"
- ]));
- return () => $(rt, W(W(W({}, de.value), o), {}, {
- id: u,
- prefixCls: e.prefixCls,
- ref: ne,
- omitDomProps: Ft,
- mode: e.mode,
- displayValues: y.value,
- onDisplayValuesChange: R,
- searchValue: h.value,
- onSearch: z,
- onSearchSplit: q,
- dropdownMatchSelectWidth: e.dropdownMatchSelectWidth,
- OptionList: It,
- emptyOptions: !X.value.length,
- activeValue: re.value,
- activeDescendantId: `${u}_list_${ee.value}`
- }), n);
- }
- }), Ie = () => null;
- Ie.isSelectOption = !0;
- Ie.displayName = "ASelectOption";
- const Ve = () => null;
- Ve.isSelectOptGroup = !0;
- Ve.displayName = "ASelectOptGroup";
- const kt = () => E(E({}, be($e(), ["inputIcon", "mode", "getInputElement", "getRawInputElement", "backfill"])), {
- value: Pe([Array, Object, String, Number]),
- defaultValue: Pe([Array, Object, String, Number]),
- notFoundContent: ue.any,
- suffixIcon: ue.any,
- itemIcon: ue.any,
- size: fe(),
- mode: fe(),
- bordered: Ye(!0),
- transitionName: String,
- choiceTransitionName: fe(""),
- popupClassName: String,
- /** @deprecated Please use `popupClassName` instead */
- dropdownClassName: String,
- placement: fe(),
- status: fe(),
- "onUpdate:value": Qe()
- }), De = "SECRET_COMBOBOX_MODE_DO_NOT_USE", Y = Oe({
- compatConfig: {
- MODE: 3
- },
- name: "ASelect",
- Option: Ie,
- OptGroup: Ve,
- inheritAttrs: !1,
- props: Me(kt(), {
- listHeight: 256,
- listItemHeight: 24
- }),
- SECRET_COMBOBOX_MODE_DO_NOT_USE: De,
- slots: Object,
- setup(e, d) {
- let {
- attrs: b,
- emit: o,
- slots: n,
- expose: u
- } = d;
- const m = Te(), f = ht(), p = bt.useInject(), g = S(() => gt(p.status, e.status)), h = () => {
- var r;
- (r = m.value) === null || r === void 0 || r.focus();
- }, O = () => {
- var r;
- (r = m.value) === null || r === void 0 || r.blur();
- }, F = (r) => {
- var D;
- (D = m.value) === null || D === void 0 || D.scrollTo(r);
- }, I = S(() => {
- const {
- mode: r
- } = e;
- if (r !== "combobox")
- return r === De ? "combobox" : r;
- });
- process.env.NODE_ENV !== "production" && Ge(!e.dropdownClassName, "Select", "`dropdownClassName` is deprecated. Please use `popupClassName` instead.");
- const {
- prefixCls: w,
- direction: C,
- renderEmpty: V,
- size: k,
- getPrefixCls: U,
- getPopupContainer: P,
- disabled: x,
- select: l
- } = Ke("select", e), {
- compactSize: y,
- compactItemClassnames: _
- } = We(w, C), v = S(() => y.value || k.value), N = Ue(), j = S(() => {
- var r;
- return (r = x.value) !== null && r !== void 0 ? r : N.value;
- }), [H, oe] = dt(w), X = S(() => U()), L = S(() => e.placement !== void 0 ? e.placement : C.value === "rtl" ? "bottomRight" : "bottomLeft"), re = S(() => Xe(X.value, qe(L.value), e.transitionName)), T = S(() => pe({
- [`${w.value}-lg`]: v.value === "large",
- [`${w.value}-sm`]: v.value === "small",
- [`${w.value}-rtl`]: C.value === "rtl",
- [`${w.value}-borderless`]: !e.bordered,
- [`${w.value}-in-form-item`]: p.isFormItemInput
- }, yt(w.value, g.value, p.hasFeedback), _.value, oe.value)), ee = function() {
- for (var r = arguments.length, D = new Array(r), R = 0; R < r; R++)
- D[R] = arguments[R];
- o("update:value", D[0]), o("change", ...D), f.onFieldChange();
- }, te = (r) => {
- o("blur", r), f.onFieldBlur();
- };
- u({
- blur: O,
- focus: h,
- scrollTo: F
- });
- const ae = S(() => I.value === "multiple" || I.value === "tags"), ce = S(() => e.showArrow !== void 0 ? e.showArrow : e.loading || !(ae.value || I.value === "combobox"));
- return () => {
- var r, D, R, z;
- const {
- notFoundContent: q,
- listHeight: ie = 256,
- listItemHeight: ne = 24,
- popupClassName: de,
- dropdownClassName: t,
- virtual: a,
- dropdownMatchSelectWidth: i,
- id: c = f.id.value,
- placeholder: s = (r = n.placeholder) === null || r === void 0 ? void 0 : r.call(n),
- showArrow: A
- } = e, {
- hasFeedback: J,
- feedbackIcon: B
- } = p;
- let G;
- q !== void 0 ? G = q : n.notFoundContent ? G = n.notFoundContent() : I.value === "combobox" ? G = null : G = (V == null ? void 0 : V("Select")) || $(Je, {
- componentName: "Select"
- }, null);
- const {
- suffixIcon: M,
- itemIcon: ve,
- removeIcon: le,
- clearIcon: je
- } = ft(E(E({}, e), {
- multiple: ae.value,
- prefixCls: w.value,
- hasFeedback: J,
- feedbackIcon: B,
- showArrow: ce.value
- }), n), xe = be(e, ["prefixCls", "suffixIcon", "itemIcon", "removeIcon", "clearIcon", "size", "bordered", "status"]), He = pe(de || t, {
- [`${w.value}-dropdown-${C.value}`]: C.value === "rtl"
- }, oe.value);
- return H($(Mt, W(W(W({
- ref: m,
- virtual: a,
- dropdownMatchSelectWidth: i
- }, xe), b), {}, {
- showSearch: (D = e.showSearch) !== null && D !== void 0 ? D : (R = l == null ? void 0 : l.value) === null || R === void 0 ? void 0 : R.showSearch,
- placeholder: s,
- listHeight: ie,
- listItemHeight: ne,
- mode: I.value,
- prefixCls: w.value,
- direction: C.value,
- inputIcon: M,
- menuItemSelectedIcon: ve,
- removeIcon: le,
- clearIcon: je,
- notFoundContent: G,
- class: [T.value, b.class],
- getPopupContainer: P == null ? void 0 : P.value,
- dropdownClassName: He,
- onChange: ee,
- onBlur: te,
- id: c,
- dropdownRender: xe.dropdownRender || n.dropdownRender,
- transitionName: re.value,
- children: (z = n.default) === null || z === void 0 ? void 0 : z.call(n),
- tagRender: e.tagRender || n.tagRender,
- optionLabelRender: n.optionLabel,
- maxTagPlaceholder: e.maxTagPlaceholder || n.maxTagPlaceholder,
- showArrow: J || A,
- disabled: j.value
- }), {
- option: n.option
- }));
- };
- }
- });
- Y.install = function(e) {
- return e.component(Y.name, Y), e.component(Y.Option.displayName, Y.Option), e.component(Y.OptGroup.displayName, Y.OptGroup), e;
- };
- const Kt = Y.Option;
- Y.OptGroup;
- export {
- Y as S,
- Kt as a,
- kt as s
- };
|