x-next 1.10.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/AI_USAGE.md +4 -2
  2. package/CHANGELOG.md +13 -1
  3. package/dist/components/_components/select-view/select-view.d.ts +9 -0
  4. package/dist/components/form-select/Select.d.ts +18 -5
  5. package/dist/components/form-select/SelectOptionGroup.vue.d.ts +1 -0
  6. package/dist/components/form-select/hooks/use-options.d.ts +1 -1
  7. package/dist/components/form-select/hooks/use-select.d.ts +1 -1
  8. package/dist/components/form-select/index.d.ts +42 -11
  9. package/dist/components/form-select/interface.d.ts +8 -0
  10. package/dist/components/pagination/page-options.vue.d.ts +60 -32
  11. package/dist/components/trigger/interface.d.ts +2 -0
  12. package/dist/es/components/_components/select-view/select-view.js +89 -78
  13. package/dist/es/components/button/Button.js +1 -1
  14. package/dist/es/components/form-input-tag/InputTag.js +1 -1
  15. package/dist/es/components/form-select/Select.js +348 -300
  16. package/dist/es/components/form-select/SelectOption.vue.js +5 -3
  17. package/dist/es/components/form-select/SelectOption.vue2.js +54 -49
  18. package/dist/es/components/form-select/SelectOptionGroup.vue.js +17 -13
  19. package/dist/es/components/form-select/SelectOptionGroup.vue2.js +8 -5
  20. package/dist/es/components/form-select/hooks/use-options.js +40 -40
  21. package/dist/es/components/form-select/hooks/use-select.js +76 -71
  22. package/dist/es/style.css +1 -1
  23. package/dist/index.cjs +3 -3
  24. package/dist/index.umd.js +3 -3
  25. package/dist/style/base.css +1 -1
  26. package/dist/style/button.css +1 -1
  27. package/dist/style/form-select.css +1 -1
  28. package/dist/style.css +1 -1
  29. package/package.json +1 -1
@@ -1,34 +1,32 @@
1
- import { defineComponent as Ne, toRefs as Re, useId as je, computed as i, ref as p, watch as U, nextTick as De, watchEffect as Te, createVNode as m, mergeProps as L, isVNode as _e } from "vue";
2
- import { isObject as N, isFunction as y, isArray as Ie, isNumber as Ke, isString as $e, isBoolean as ze, isUndefined as C, isNull as He, isEmptyObject as Me } from "../../_utils/is.js";
3
- import { getKeyFromValue as G, isGroupOptionInfo as Ue, isValidOption as Ge, hasEmptyStringKey as We } from "./utils.js";
4
- import { Trigger as W } from "../trigger/index.js";
5
- import Y from "../_components/select-view/select-view.js";
6
- import Ye from "./SelectDropdown.vue.js";
7
- import qe from "./SelectOption.vue.js";
8
- import Je from "./SelectOptionGroup.vue.js";
9
- import Qe from "../virtual-list-v2/virtual-list.vue.js";
10
- import { useSelect as Xe } from "./hooks/use-select.js";
11
- import { useTrigger as Ze } from "../../_hooks/use-trigger.js";
12
- import { useFormItem as et } from "../../_hooks/use-form-item.js";
13
- import { useLocale as tt } from "../../locale/index.js";
14
- import { debounce as at } from "../../_utils/debounce.js";
15
- import { getClassNameMixin as lt } from "../../_utils/config.js";
16
- import { omit as ot } from "../../_utils/omit.js";
17
- import nt from "../../_utils/pick.js";
18
- function ut(t) {
19
- return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !_e(t);
1
+ import { defineComponent as He, toRefs as Ge, useId as We, computed as r, ref as m, watch as I, onBeforeUnmount as qe, watchEffect as ae, createVNode as y, mergeProps as M, isVNode as Je } from "vue";
2
+ import { isObject as U, isFunction as h, isArray as Qe, isNumber as Xe, isString as Ye, isBoolean as Ze, isUndefined as N, isNull as ea, isEmptyObject as aa } from "../../_utils/is.js";
3
+ import { getKeyFromValue as te, isGroupOptionInfo as le, isValidOption as ta, hasEmptyStringKey as la } from "./utils.js";
4
+ import { Trigger as ue } from "../trigger/index.js";
5
+ import ne from "../_components/select-view/select-view.js";
6
+ import ua from "./SelectDropdown.vue.js";
7
+ import na from "./SelectOption.vue.js";
8
+ import oa from "./SelectOptionGroup.vue.js";
9
+ import ra from "../virtual-list-v2/virtual-list.vue.js";
10
+ import { useSelect as ia } from "./hooks/use-select.js";
11
+ import { useTrigger as ca } from "../../_hooks/use-trigger.js";
12
+ import { useFormItem as da } from "../../_hooks/use-form-item.js";
13
+ import { useLocale as sa } from "../../locale/index.js";
14
+ import { getClassNameMixin as fa } from "../../_utils/config.js";
15
+ import { omit as va } from "../../_utils/omit.js";
16
+ function ma(a) {
17
+ return typeof a == "function" || Object.prototype.toString.call(a) === "[object Object]" && !Je(a);
20
18
  }
21
- const q = ["id", "aria-label", "aria-labelledby", "aria-describedby"], rt = {
19
+ const pa = /* @__PURE__ */ new Set(["id", "name", "form", "tabindex", "tabIndex", "autofocus", "autoFocus", "autocomplete", "autoComplete"]), oe = (a) => pa.has(a) || a.startsWith("aria-"), ba = {
22
20
  value: "value",
23
21
  label: "label",
24
22
  disabled: "disabled",
25
23
  tagProps: "tagProps",
26
24
  render: "render"
27
- }, Bt = /* @__PURE__ */ Ne({
25
+ }, Pa = /* @__PURE__ */ He({
28
26
  name: "Select",
29
27
  components: {
30
- Trigger: W,
31
- SelectView: Y
28
+ Trigger: ue,
29
+ SelectView: ne
32
30
  },
33
31
  inheritAttrs: !1,
34
32
  props: {
@@ -55,7 +53,7 @@ const q = ["id", "aria-label", "aria-labelledby", "aria-describedby"], rt = {
55
53
  */
56
54
  defaultValue: {
57
55
  type: [String, Number, Boolean, Object, Array],
58
- default: (t) => t.multiple ? [] : ""
56
+ default: (a) => a.multiple ? [] : ""
59
57
  },
60
58
  /**
61
59
  * @zh 输入框的值
@@ -126,7 +124,7 @@ const q = ["id", "aria-label", "aria-labelledby", "aria-describedby"], rt = {
126
124
  */
127
125
  allowSearch: {
128
126
  type: [Boolean, Object],
129
- default: (t) => !!t.multiple
127
+ default: (a) => !!a.multiple
130
128
  },
131
129
  /**
132
130
  * @zh 是否允许创建
@@ -321,54 +319,56 @@ const q = ["id", "aria-label", "aria-labelledby", "aria-describedby"], rt = {
321
319
  }
322
320
  },
323
321
  emits: {
324
- "update:modelValue": (t) => !0,
325
- "update:inputValue": (t) => !0,
326
- "update:popupVisible": (t) => !0,
322
+ focus: (a) => !0,
323
+ blur: (a) => !0,
324
+ "update:modelValue": (a) => !0,
325
+ "update:inputValue": (a) => !0,
326
+ "update:popupVisible": (a) => !0,
327
327
  /**
328
328
  * @zh 值发生改变时触发
329
329
  * @en Triggered when the value changes
330
- * @param { string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[] } value
330
+ * @param { string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[] | undefined } value
331
331
  */
332
- change: (t) => !0,
332
+ change: (a) => !0,
333
333
  /**
334
334
  * @zh 输入框的值发生改变时触发
335
335
  * @en Triggered when the value of the input changes
336
336
  * @param {string} inputValue
337
337
  */
338
- inputValueChange: (t) => !0,
338
+ inputValueChange: (a) => !0,
339
339
  /**
340
340
  * @zh 下拉框的显示状态改变时触发
341
341
  * @en Triggered when the display state of the drop-down box changes
342
342
  * @param {boolean} visible
343
343
  */
344
- popupVisibleChange: (t) => !0,
344
+ popupVisibleChange: (a) => !0,
345
345
  /**
346
346
  * @zh 点击清除按钮时触发
347
347
  * @en Triggered when the clear button is clicked
348
348
  */
349
- clear: (t) => !0,
349
+ clear: (a) => !0,
350
350
  /**
351
351
  * @zh 点击标签的删除按钮时触发
352
352
  * @en Triggered when the delete button of the label is clicked
353
353
  * @param {string | number | boolean | Record<string, any> | undefined} removed
354
354
  */
355
- remove: (t) => !0,
355
+ remove: (a) => !0,
356
356
  /**
357
357
  * @zh 用户搜索时触发
358
358
  * @en Triggered when the user searches
359
359
  * @param {string} inputValue
360
360
  */
361
- search: (t) => !0,
361
+ search: (a) => !0,
362
362
  /**
363
363
  * @zh 下拉菜单发生滚动时触发
364
364
  * @en Triggered when the drop-down scrolls
365
365
  */
366
- dropdownScroll: (t) => !0,
366
+ dropdownScroll: (a) => !0,
367
367
  /**
368
368
  * @zh 下拉菜单滚动到底部时触发
369
369
  * @en Triggered when the drop-down menu is scrolled to the bottom
370
370
  */
371
- dropdownReachBottom: (t) => !0,
371
+ dropdownReachBottom: (a) => !0,
372
372
  /**
373
373
  * @zh 多选超出限制时触发
374
374
  * @en Triggered when multiple selection exceeds the limit
@@ -376,7 +376,7 @@ const q = ["id", "aria-label", "aria-labelledby", "aria-describedby"], rt = {
376
376
  * @param {Event} ev
377
377
  * @version 2.18.0
378
378
  */
379
- exceedLimit: (t, n) => !0
379
+ exceedLimit: (a, n) => !0
380
380
  },
381
381
  /**
382
382
  * @zh 选项为空时的显示内容
@@ -436,249 +436,291 @@ const q = ["id", "aria-label", "aria-labelledby", "aria-describedby"], rt = {
436
436
  * @slot trigger
437
437
  * @version 2.22.0
438
438
  */
439
- setup(t, {
439
+ setup(a, {
440
440
  slots: n,
441
- emit: r,
442
- attrs: B
441
+ emit: i,
442
+ attrs: x,
443
+ expose: re
443
444
  }) {
444
445
  const {
445
- size: J,
446
- disabled: Q,
447
- error: X,
448
- options: Z,
449
- filterOption: h,
450
- valueKey: f,
451
- multiple: R,
452
- popupVisible: ee,
453
- defaultPopupVisible: te,
454
- showExtraOptions: ae,
455
- modelValue: le,
456
- fieldNames: V,
457
- loading: oe,
458
- defaultActiveFirstOption: ne
459
- } = Re(t), ue = lt("select"), j = je(), x = `${j}-listbox`, F = (e) => `${j}-option-${encodeURIComponent(e)}`, {
460
- formItemCtx: re,
461
- mergedSize: ie,
462
- mergedDisabled: w,
463
- mergedError: ce,
464
- eventHandlers: de
465
- } = et({
466
- size: J,
467
- disabled: Q,
468
- error: X
446
+ size: ie,
447
+ disabled: ce,
448
+ error: de,
449
+ options: se,
450
+ filterOption: F,
451
+ valueKey: p,
452
+ multiple: $,
453
+ popupVisible: fe,
454
+ defaultPopupVisible: ve,
455
+ showExtraOptions: me,
456
+ modelValue: pe,
457
+ fieldNames: A,
458
+ loading: be,
459
+ defaultActiveFirstOption: ge
460
+ } = Ge(a), ye = fa("select"), z = We(), P = `${z}-listbox`, k = (e) => `${z}-option-${encodeURIComponent(e)}`, {
461
+ formItemCtx: he,
462
+ mergedSize: we,
463
+ mergedDisabled: c,
464
+ mergedError: Oe,
465
+ eventHandlers: Ve
466
+ } = da({
467
+ size: ie,
468
+ disabled: ce,
469
+ error: de
469
470
  }), {
470
- t: se
471
- } = tt(), fe = i(() => t.virtualListProps ? "div" : "li"), P = i(() => N(t.allowSearch) && !!t.allowSearch.retainInputValue);
472
- i(() => {
473
- if (y(t.formatLabel))
471
+ t: Se
472
+ } = sa(), H = r(() => !!a.virtualListProps && !n.default), Ce = r(() => H.value ? "div" : "li"), L = r(() => U(a.allowSearch) && !!a.allowSearch.retainInputValue);
473
+ r(() => {
474
+ if (h(a.formatLabel))
474
475
  return (e) => {
475
- const l = u.get(e.value);
476
- return t.formatLabel(l);
476
+ const l = o.get(e.value);
477
+ return a.formatLabel(l);
477
478
  };
478
479
  });
479
- const D = p(), T = p({}), _ = p(), {
480
- computedPopupVisible: c,
481
- handlePopupVisibleChange: O
482
- } = Ze({
483
- popupVisible: ee,
484
- defaultPopupVisible: te,
485
- emit: r
486
- }), k = p(t.defaultValue), A = i(() => {
487
- const e = t.modelValue ?? k.value;
488
- return (Ie(e) ? e : e || Ke(e) || $e(e) || ze(e) ? [e] : []).map((a) => ({
489
- value: a,
490
- key: G(a, t.valueKey)
480
+ const G = m(), R = m(), T = m({}), W = m();
481
+ re({
482
+ focus: () => {
483
+ var e;
484
+ return (e = R.value) == null ? void 0 : e.focus();
485
+ },
486
+ blur: () => {
487
+ var e;
488
+ return (e = R.value) == null ? void 0 : e.blur();
489
+ }
490
+ });
491
+ const {
492
+ computedPopupVisible: d,
493
+ handlePopupVisibleChange: w
494
+ } = ca({
495
+ popupVisible: fe,
496
+ defaultPopupVisible: ve,
497
+ emit: i
498
+ }), D = m(a.defaultValue), O = r(() => {
499
+ const e = a.modelValue ?? D.value;
500
+ return (Qe(e) ? e : e || Xe(e) || Ye(e) || Ze(e) ? [e] : []).map((t) => ({
501
+ value: t,
502
+ key: te(t, a.valueKey)
491
503
  }));
492
504
  });
493
- U(le, (e) => {
494
- (C(e) || He(e)) && (k.value = R.value ? [] : e);
505
+ I(pe, (e) => {
506
+ (N(e) || ea(e)) && (D.value = $.value ? [] : e);
495
507
  });
496
- const d = i(() => A.value.map((e) => e.key)), I = i(() => ({
497
- ...rt,
498
- ...V == null ? void 0 : V.value
499
- })), K = p(), pe = (e) => {
508
+ const s = r(() => O.value.map((e) => e.key)), E = r(() => ({
509
+ ...ba,
510
+ ...A == null ? void 0 : A.value
511
+ })), b = m({}), Be = (e) => {
500
512
  const l = {};
501
- return e.forEach((a) => {
502
- l[a] = u.get(a);
513
+ return e.forEach((t) => {
514
+ l[t] = o.get(t) ?? b.value[t];
503
515
  }), l;
504
- }, me = (e) => {
505
- K.value = pe(e);
506
- }, ve = (e) => y(t.fallbackOption) ? t.fallbackOption(e) : {
507
- [I.value.value]: e,
508
- [I.value.label]: String(N(e) ? e[f == null ? void 0 : f.value] : e)
509
- }, be = () => {
516
+ }, xe = (e) => {
517
+ b.value = Be(e);
518
+ }, K = (e) => o.get(e) ?? b.value[e], Fe = (e) => h(a.fallbackOption) ? a.fallbackOption(e) : {
519
+ [E.value.value]: e,
520
+ [E.value.label]: String(U(e) ? e[p == null ? void 0 : p.value] : e)
521
+ }, Ae = () => {
510
522
  const e = [], l = [];
511
- if (t.allowCreate || t.fallbackOption) {
512
- for (const a of A.value)
513
- if (!l.includes(a.key) && a.value !== "") {
514
- const o = u.get(a.key);
515
- (!o || o.origin === "extraOptions") && (e.push(a), l.push(a.key));
523
+ if (a.allowCreate || a.fallbackOption) {
524
+ for (const t of O.value)
525
+ if (!l.includes(t.key) && t.value !== "") {
526
+ const u = o.get(t.key);
527
+ (!u || u.origin === "extraOptions") && (e.push(t), l.push(t.key));
516
528
  }
517
529
  }
518
- if (t.allowCreate && s.value) {
519
- const a = G(s.value);
520
- if (!l.includes(a)) {
521
- const o = u.get(a);
522
- (!o || o.origin === "extraOptions") && e.push({
523
- value: s.value,
524
- key: a
530
+ if (a.allowCreate && f.value) {
531
+ const t = te(f.value);
532
+ if (!l.includes(t)) {
533
+ const u = o.get(t);
534
+ (!u || u.origin === "extraOptions") && e.push({
535
+ value: f.value,
536
+ key: t
525
537
  });
526
538
  }
527
539
  }
528
540
  return e;
529
- }, v = p([]), ge = i(() => v.value.map((e) => {
530
- var o;
531
- let l = ve(e.value);
532
- const a = (o = K.value) == null ? void 0 : o[e.key];
533
- return !C(a) && !Me(a) && (l = {
541
+ }, V = m([]), Ee = r(() => V.value.map((e) => {
542
+ var u;
543
+ let l = Fe(e.value);
544
+ const t = (u = b.value) == null ? void 0 : u[e.key];
545
+ return !N(t) && !aa(t) && (l = h(a.fallbackOption) ? {
546
+ ...t.raw,
547
+ ...l
548
+ } : {
534
549
  ...l,
535
- ...a
550
+ ...t.raw,
551
+ [E.value.value]: e.value,
552
+ [E.value.label]: t.label
536
553
  }), l;
537
- }));
538
- De(() => {
539
- Te(() => {
540
- var l;
541
- const e = be();
542
- if (e.length !== v.value.length)
543
- v.value = e;
544
- else if (e.length > 0) {
545
- for (let a = 0; a < e.length; a++)
546
- if (e[a].key !== ((l = v.value[a]) == null ? void 0 : l.key)) {
547
- v.value = e;
548
- break;
549
- }
550
- }
551
- });
552
- });
553
- const $ = p(t.defaultInputValue), s = i(() => t.inputValue ?? $.value);
554
- U(c, (e) => {
555
- !e && !P.value && s.value && g("");
554
+ })), q = m(a.defaultInputValue), f = r(() => a.inputValue ?? q.value);
555
+ let S;
556
+ const g = () => {
557
+ S !== void 0 && clearTimeout(S), S = void 0;
558
+ };
559
+ qe(g), I(d, (e) => {
560
+ e || g(), !e && !L.value && f.value && B("");
561
+ }), I(c, (e) => {
562
+ e && (g(), w(!1));
556
563
  });
557
- const ye = (e) => {
564
+ const je = (e) => {
558
565
  var l;
559
- return t.multiple ? e.map((a) => {
560
- var o;
561
- return ((o = u.get(a)) == null ? void 0 : o.value) ?? "";
562
- }) : ((l = u.get(e[0])) == null ? void 0 : l.value) ?? (We(u) ? void 0 : "");
563
- }, b = (e) => {
564
- var a, o;
565
- const l = ye(e);
566
- k.value = l, r("update:modelValue", l), r("change", l), (o = (a = de.value) == null ? void 0 : a.onChange) == null || o.call(a), me(e);
567
- }, g = (e) => {
568
- $.value = e, r("update:inputValue", e), r("inputValueChange", e);
569
- }, he = (e, l) => {
570
- if (t.multiple) {
571
- if (d.value.includes(e)) {
572
- const a = d.value.filter((o) => o !== e);
573
- b(a);
574
- } else if (Be.value.includes(e))
575
- if (t.limit > 0 && d.value.length >= t.limit) {
576
- const a = u.get(e);
577
- r("exceedLimit", a == null ? void 0 : a.value, l);
578
- } else {
579
- const a = d.value.concat(e);
580
- b(a);
566
+ return a.multiple ? e.map((t) => {
567
+ var u, v;
568
+ return ((u = o.get(t)) == null ? void 0 : u.value) ?? ((v = O.value.find((ze) => ze.key === t)) == null ? void 0 : v.value) ?? "";
569
+ }) : ((l = o.get(e[0])) == null ? void 0 : l.value) ?? (la(o) ? void 0 : "");
570
+ }, C = (e) => {
571
+ var t, u;
572
+ const l = je(e);
573
+ D.value = l, i("update:modelValue", l), i("change", l), (u = (t = Ve.value) == null ? void 0 : t.onChange) == null || u.call(t), xe(e);
574
+ }, B = (e) => {
575
+ q.value = e, i("update:inputValue", e), i("inputValueChange", e);
576
+ }, Ne = (e, l) => {
577
+ if (!(c.value || a.loading || !Y.value.includes(e)))
578
+ if (g(), a.multiple) {
579
+ if (s.value.includes(e)) {
580
+ const t = s.value.filter((u) => u !== e);
581
+ C(t);
582
+ } else if (Y.value.includes(e))
583
+ if (a.limit > 0 && s.value.length >= a.limit) {
584
+ const t = o.get(e);
585
+ i("exceedLimit", t == null ? void 0 : t.value, l);
586
+ } else {
587
+ const t = s.value.concat(e);
588
+ C(t);
589
+ }
590
+ L.value || B("");
591
+ } else {
592
+ if (e !== s.value[0] && C([e]), L.value) {
593
+ const t = o.get(e);
594
+ t && B(t.label);
581
595
  }
582
- P.value || g("");
583
- } else {
584
- if (e !== d.value[0] && b([e]), P.value) {
585
- const a = u.get(e);
586
- a && g(a.label);
596
+ w(!1);
587
597
  }
588
- O(!1);
589
- }
590
- }, Ve = at((e) => {
591
- r("search", e);
592
- }, t.searchDelay), we = (e) => {
593
- e !== s.value && (c.value || O(!0), g(e), t.allowSearch && Ve(e));
594
- }, Oe = (e) => {
595
- const l = u.get(e), a = d.value.filter((o) => o !== e);
596
- b(a), r("remove", l == null ? void 0 : l.value);
597
- }, Se = (e) => {
598
- e == null || e.stopPropagation();
599
- const l = d.value.filter((a) => {
600
- var o;
601
- return (o = u.get(a)) == null ? void 0 : o.disabled;
598
+ }, Pe = (e) => {
599
+ g(), S = setTimeout(() => {
600
+ S = void 0, !c.value && a.allowSearch && e === f.value && i("search", e);
601
+ }, Math.max(0, a.searchDelay));
602
+ }, ke = (e) => {
603
+ c.value || e !== f.value && (d.value || w(!0), B(e), a.allowSearch && Pe(e));
604
+ }, Le = (e) => {
605
+ const l = K(e);
606
+ if (c.value || a.loading || l != null && l.disabled) return;
607
+ g();
608
+ const t = s.value.filter((u) => u !== e);
609
+ C(t), i("remove", l == null ? void 0 : l.value);
610
+ }, Re = (e) => {
611
+ if (e == null || e.stopPropagation(), c.value || a.loading || !a.allowClear || !ee.value) return;
612
+ g();
613
+ const l = s.value.filter((t) => {
614
+ var u;
615
+ return (u = K(t)) == null ? void 0 : u.disabled;
602
616
  });
603
- b(l), g(""), r("clear", e);
604
- }, z = (e) => {
605
- r("dropdownScroll", e);
606
- }, H = (e) => {
607
- r("dropdownReachBottom", e);
617
+ C(l), B(""), i("clear", e);
618
+ }, J = (e) => {
619
+ i("dropdownScroll", e);
620
+ }, Q = (e) => {
621
+ i("dropdownReachBottom", e);
608
622
  }, {
609
- validOptions: M,
610
- optionInfoMap: u,
611
- validOptionInfos: Ce,
612
- enabledOptionKeys: Be,
613
- activeKey: S,
614
- handleKeyDown: xe
615
- } = Xe({
616
- multiple: R,
617
- options: Z,
618
- extraOptions: ge,
619
- inputValue: s,
620
- filterOption: h,
621
- showExtraOptions: ae,
622
- component: fe,
623
- valueKey: f,
624
- fieldNames: V,
625
- loading: oe,
626
- disabled: w,
627
- popupVisible: c,
628
- valueKeys: d,
629
- dropdownRef: D,
623
+ validOptions: X,
624
+ optionInfoMap: o,
625
+ validOptionInfos: Te,
626
+ enabledOptionKeys: Y,
627
+ activeKey: j,
628
+ handleKeyDown: Z
629
+ } = ia({
630
+ multiple: $,
631
+ options: se,
632
+ extraOptions: Ee,
633
+ inputValue: f,
634
+ filterOption: F,
635
+ showExtraOptions: me,
636
+ component: Ce,
637
+ valueKey: p,
638
+ fieldNames: A,
639
+ loading: be,
640
+ disabled: c,
641
+ popupVisible: d,
642
+ valueKeys: s,
643
+ dropdownRef: G,
630
644
  optionRefs: T,
631
- virtualListRef: _,
632
- defaultActiveFirstOption: ne,
633
- onSelect: he,
634
- onPopupVisibleChange: O,
635
- getOptionId: F
636
- }), Fe = i(() => ot(B, [...q])), Pe = i(() => ({
637
- ...nt(B, [...q]),
645
+ virtualListRef: W,
646
+ defaultActiveFirstOption: ge,
647
+ onSelect: Ne,
648
+ onPopupVisibleChange: w,
649
+ getOptionId: k
650
+ });
651
+ ae(() => {
652
+ const e = {};
653
+ for (const t of s.value) {
654
+ const u = o.get(t), v = u && u.origin !== "extraOptions" ? u : b.value[t];
655
+ v && (e[t] = v);
656
+ }
657
+ const l = b.value;
658
+ (Object.keys(l).length !== Object.keys(e).length || Object.keys(e).some((t) => l[t] !== e[t])) && (b.value = e);
659
+ }), ae(() => {
660
+ const e = Ae();
661
+ (e.length !== V.value.length || e.some((l, t) => {
662
+ var u, v;
663
+ return l.key !== ((u = V.value[t]) == null ? void 0 : u.key) || l.value !== ((v = V.value[t]) == null ? void 0 : v.value);
664
+ })) && (V.value = e);
665
+ });
666
+ const De = r(() => {
667
+ const e = (l) => l.flatMap((t) => le(t) ? [{
668
+ ...t,
669
+ options: []
670
+ }, ...e(t.options)] : [t]);
671
+ return e(X.value);
672
+ }), Ke = r(() => va(x, Object.keys(x).filter(oe))), _e = r(() => ({
673
+ ...Object.fromEntries(Object.entries(x).filter(([e]) => oe(e))),
638
674
  role: "combobox",
639
675
  "aria-haspopup": "listbox",
640
- "aria-expanded": String(c.value),
641
- "aria-controls": x,
642
- "aria-activedescendant": c.value && !C(S.value) ? F(S.value) : void 0,
643
- "aria-autocomplete": t.allowSearch || t.allowCreate ? "list" : "none",
644
- "aria-label": B["aria-label"] ?? (re.labelId ? void 0 : t.placeholder ?? se("common.select"))
645
- })), ke = i(() => {
676
+ "aria-expanded": String(d.value),
677
+ "aria-controls": P,
678
+ "aria-activedescendant": d.value && !a.loading && !N(j.value) ? k(j.value) : void 0,
679
+ "aria-autocomplete": a.allowSearch || a.allowCreate ? "list" : "none",
680
+ "aria-label": x["aria-label"] ?? (he.labelId ? void 0 : a.placeholder ?? Se("common.select"))
681
+ })), Ie = r(() => {
646
682
  const e = [];
647
- for (const l of A.value) {
648
- const a = u.get(l.key);
649
- a && e.push({
650
- ...a,
683
+ for (const l of O.value) {
684
+ const t = o.get(l.key);
685
+ t && e.push({
686
+ ...t,
651
687
  value: l.key,
652
- label: (a == null ? void 0 : a.label) ?? String(N(l.value) ? l.value[f == null ? void 0 : f.value] : l.value),
653
- closable: !(a != null && a.disabled),
654
- tagProps: a == null ? void 0 : a.tagProps
688
+ label: (t == null ? void 0 : t.label) ?? String(U(l.value) ? l.value[p == null ? void 0 : p.value] : l.value),
689
+ closable: !(t != null && t.disabled),
690
+ tagProps: t == null ? void 0 : t.tagProps
655
691
  });
656
692
  }
657
693
  return e;
658
- }), Ae = (e) => {
659
- if (y(n.option)) {
694
+ }), ee = r(() => O.value.some(({
695
+ key: e,
696
+ value: l
697
+ }) => {
698
+ var t;
699
+ return (l !== "" || o.has(e)) && !((t = K(e)) != null && t.disabled);
700
+ })), Me = (e) => {
701
+ if (h(n.option)) {
660
702
  const l = n.option;
661
703
  return () => l({
662
704
  data: e.raw
663
705
  });
664
706
  }
665
- return y(e.render) ? e.render : () => e.label;
666
- }, E = (e) => {
667
- if (Ue(e)) {
707
+ return h(e.render) ? e.render : () => e.label;
708
+ }, _ = (e) => {
709
+ if (le(e)) {
668
710
  let l;
669
- return m(Je, {
711
+ return y(oa, {
670
712
  key: e.key,
671
713
  label: e.label
672
- }, ut(l = e.options.map((a) => E(a))) ? l : {
714
+ }, ma(l = e.options.map((t) => _(t))) ? l : {
673
715
  default: () => [l]
674
716
  });
675
717
  }
676
- return Ge(e, {
677
- inputValue: s.value,
678
- filterOption: h == null ? void 0 : h.value
679
- }) ? m(qe, {
718
+ return ta(e, {
719
+ inputValue: f.value,
720
+ filterOption: F == null ? void 0 : F.value
721
+ }) ? y(na, {
680
722
  ref: (l) => {
681
- l != null && l.$el && (T.value[e.key] = l.$el);
723
+ l != null && l.$el ? T.value[e.key] = l.$el : delete T.value[e.key];
682
724
  },
683
725
  key: e.key,
684
726
  value: e.value,
@@ -686,35 +728,36 @@ const q = ["id", "aria-label", "aria-labelledby", "aria-describedby"], rt = {
686
728
  disabled: e.disabled,
687
729
  internal: !0
688
730
  }, {
689
- default: Ae(e)
731
+ default: Me(e)
690
732
  }) : null;
691
- }, Ee = () => m(Ye, {
692
- ref: D,
693
- id: x,
694
- multiple: t.multiple,
695
- loading: t.loading,
696
- empty: Ce.value.length === 0,
697
- virtualList: !!t.virtualListProps,
698
- scrollbar: t.scrollbar,
699
- showHeaderOnEmpty: t.showHeaderOnEmpty,
700
- showFooterOnEmpty: t.showFooterOnEmpty,
701
- onScroll: z,
702
- onReachBottom: H
733
+ }, Ue = () => y(ua, {
734
+ ref: G,
735
+ id: P,
736
+ multiple: a.multiple,
737
+ loading: a.loading,
738
+ empty: Te.value.length === 0,
739
+ virtualList: H.value,
740
+ scrollbar: a.scrollbar,
741
+ showHeaderOnEmpty: a.showHeaderOnEmpty,
742
+ showFooterOnEmpty: a.showFooterOnEmpty,
743
+ onScroll: J,
744
+ onReachBottom: Q
703
745
  }, {
704
746
  default: () => {
705
747
  var e;
706
- return [...((e = n.default) == null ? void 0 : e.call(n)) ?? [], ...M.value.map(E)];
748
+ return [...((e = n.default) == null ? void 0 : e.call(n)) ?? [], ...X.value.map(_)];
707
749
  },
708
- "virtual-list": () => m(Qe, L(t.virtualListProps, {
709
- ref: _,
710
- data: M.value,
711
- scrollbar: t.scrollbar,
712
- onScroll: z,
713
- onReachBottom: H
750
+ "virtual-list": () => y(ra, M(a.virtualListProps, {
751
+ ref: W,
752
+ data: De.value,
753
+ itemKey: "key",
754
+ scrollbar: a.scrollbar,
755
+ onScroll: J,
756
+ onReachBottom: Q
714
757
  }), {
715
758
  item: ({
716
759
  item: e
717
- }) => E(e)
760
+ }) => _(e)
718
761
  }),
719
762
  // 仅在用户真的提供了插槽时才透传,否则 v-slots 对象里的空 key
720
763
  // 会让 SelectDropdown 的 $slots.empty 判定为真,从而跳过默认空态
@@ -727,20 +770,20 @@ const q = ["id", "aria-label", "aria-labelledby", "aria-describedby"], rt = {
727
770
  ...n.footer ? {
728
771
  footer: n.footer
729
772
  } : {}
730
- }), Le = ({
773
+ }), $e = ({
731
774
  data: e
732
775
  }) => {
733
- var l, a;
734
- if ((n.label || y(t.formatLabel)) && e) {
735
- const o = u.get(e.value);
736
- if (o != null && o.raw)
776
+ var l, t;
777
+ if ((n.label || h(a.formatLabel)) && e) {
778
+ const u = o.get(e.value);
779
+ if (u != null && u.raw)
737
780
  return ((l = n.label) == null ? void 0 : l.call(n, {
738
- data: o.raw
739
- })) ?? ((a = t.formatLabel) == null ? void 0 : a.call(t, o.raw));
781
+ data: u.raw
782
+ })) ?? ((t = a.formatLabel) == null ? void 0 : t.call(a, u.raw));
740
783
  }
741
784
  return (e == null ? void 0 : e.label) ?? "";
742
785
  };
743
- return () => m(W, L({
786
+ return () => y(ue, M({
744
787
  trigger: "click",
745
788
  position: "bl",
746
789
  popupOffset: 4,
@@ -749,56 +792,61 @@ const q = ["id", "aria-label", "aria-labelledby", "aria-describedby"], rt = {
749
792
  preventFocus: !0,
750
793
  autoFitPopupWidth: !0,
751
794
  autoFitTransformOrigin: !0,
752
- disabled: w.value,
753
- popupVisible: c.value,
754
- unmountOnClose: t.unmountOnClose,
755
- clickToClose: !(t.allowSearch || t.allowCreate),
756
- popupContainer: t.popupContainer,
757
- onPopupVisibleChange: O,
795
+ disabled: c.value,
796
+ popupVisible: d.value,
797
+ unmountOnClose: a.unmountOnClose,
798
+ clickToClose: !(a.allowSearch || a.allowCreate),
799
+ popupContainer: a.popupContainer,
800
+ onPopupVisibleChange: w,
758
801
  updateAtScroll: !0
759
- }, t.triggerProps), {
802
+ }, a.triggerProps), {
760
803
  default: () => {
761
804
  var e;
762
805
  return [((e = n.trigger) == null ? void 0 : e.call(n, {
763
- popupVisible: c.value,
764
- disabled: w.value,
765
- listboxId: x,
766
- activeDescendant: c.value && !C(S.value) ? F(S.value) : void 0
767
- })) ?? m(Y, L({
768
- class: ue.block,
769
- modelValue: ke.value,
770
- inputValue: s.value,
771
- multiple: t.multiple,
772
- disabled: w.value,
773
- error: ce.value,
774
- loading: t.loading,
775
- allowClear: t.allowClear,
776
- allowCreate: t.allowCreate,
777
- allowSearch: !!t.allowSearch,
778
- opened: c.value,
779
- maxTagCount: t.maxTagCount,
780
- placeholder: t.placeholder,
781
- bordered: t.bordered,
782
- size: ie.value,
783
- tagNowrap: t.tagNowrap,
784
- inputAttrs: Pe.value
785
- }, Fe.value, {
786
- onInputValueChange: we,
787
- onRemove: Oe,
788
- onClear: Se,
789
- onKeydown: xe
806
+ popupVisible: d.value,
807
+ disabled: c.value,
808
+ listboxId: P,
809
+ activeDescendant: d.value && !a.loading && !N(j.value) ? k(j.value) : void 0,
810
+ onKeydown: Z
811
+ })) ?? y(ne, M({
812
+ ref: R,
813
+ class: ye.block,
814
+ modelValue: Ie.value,
815
+ inputValue: f.value,
816
+ multiple: a.multiple,
817
+ disabled: c.value,
818
+ error: Oe.value,
819
+ loading: a.loading,
820
+ allowClear: a.allowClear,
821
+ clearable: ee.value,
822
+ allowCreate: a.allowCreate,
823
+ allowSearch: !!a.allowSearch,
824
+ opened: d.value,
825
+ maxTagCount: a.maxTagCount,
826
+ placeholder: a.placeholder,
827
+ bordered: a.bordered,
828
+ size: we.value,
829
+ tagNowrap: a.tagNowrap,
830
+ inputAttrs: _e.value
831
+ }, Ke.value, {
832
+ onInputValueChange: ke,
833
+ onRemove: Le,
834
+ onClear: Re,
835
+ onKeydown: Z,
836
+ onFocus: (l) => i("focus", l),
837
+ onBlur: (l) => i("blur", l)
790
838
  }), {
791
- label: Le,
839
+ label: $e,
792
840
  prefix: n.prefix,
793
841
  "arrow-icon": n["arrow-icon"],
794
842
  "loading-icon": n["loading-icon"],
795
843
  "search-icon": n["search-icon"]
796
844
  })];
797
845
  },
798
- content: Ee
846
+ content: Ue
799
847
  });
800
848
  }
801
849
  });
802
850
  export {
803
- Bt as default
851
+ Pa as default
804
852
  };