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.
- package/AI_USAGE.md +4 -2
- package/CHANGELOG.md +13 -1
- package/dist/components/_components/select-view/select-view.d.ts +9 -0
- package/dist/components/form-select/Select.d.ts +18 -5
- package/dist/components/form-select/SelectOptionGroup.vue.d.ts +1 -0
- package/dist/components/form-select/hooks/use-options.d.ts +1 -1
- package/dist/components/form-select/hooks/use-select.d.ts +1 -1
- package/dist/components/form-select/index.d.ts +42 -11
- package/dist/components/form-select/interface.d.ts +8 -0
- package/dist/components/pagination/page-options.vue.d.ts +60 -32
- package/dist/components/trigger/interface.d.ts +2 -0
- package/dist/es/components/_components/select-view/select-view.js +89 -78
- package/dist/es/components/button/Button.js +1 -1
- package/dist/es/components/form-input-tag/InputTag.js +1 -1
- package/dist/es/components/form-select/Select.js +348 -300
- package/dist/es/components/form-select/SelectOption.vue.js +5 -3
- package/dist/es/components/form-select/SelectOption.vue2.js +54 -49
- package/dist/es/components/form-select/SelectOptionGroup.vue.js +17 -13
- package/dist/es/components/form-select/SelectOptionGroup.vue2.js +8 -5
- package/dist/es/components/form-select/hooks/use-options.js +40 -40
- package/dist/es/components/form-select/hooks/use-select.js +76 -71
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style/base.css +1 -1
- package/dist/style/button.css +1 -1
- package/dist/style/form-select.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isObject as
|
|
3
|
-
import { getKeyFromValue as
|
|
4
|
-
import { Trigger as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { useSelect as
|
|
11
|
-
import { useTrigger as
|
|
12
|
-
import { useFormItem as
|
|
13
|
-
import { useLocale as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
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
|
-
},
|
|
25
|
+
}, Pa = /* @__PURE__ */ He({
|
|
28
26
|
name: "Select",
|
|
29
27
|
components: {
|
|
30
|
-
Trigger:
|
|
31
|
-
SelectView:
|
|
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: (
|
|
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: (
|
|
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
|
-
|
|
325
|
-
|
|
326
|
-
"update:
|
|
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: (
|
|
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: (
|
|
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: (
|
|
344
|
+
popupVisibleChange: (a) => !0,
|
|
345
345
|
/**
|
|
346
346
|
* @zh 点击清除按钮时触发
|
|
347
347
|
* @en Triggered when the clear button is clicked
|
|
348
348
|
*/
|
|
349
|
-
clear: (
|
|
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: (
|
|
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: (
|
|
361
|
+
search: (a) => !0,
|
|
362
362
|
/**
|
|
363
363
|
* @zh 下拉菜单发生滚动时触发
|
|
364
364
|
* @en Triggered when the drop-down scrolls
|
|
365
365
|
*/
|
|
366
|
-
dropdownScroll: (
|
|
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: (
|
|
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: (
|
|
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(
|
|
439
|
+
setup(a, {
|
|
440
440
|
slots: n,
|
|
441
|
-
emit:
|
|
442
|
-
attrs:
|
|
441
|
+
emit: i,
|
|
442
|
+
attrs: x,
|
|
443
|
+
expose: re
|
|
443
444
|
}) {
|
|
444
445
|
const {
|
|
445
|
-
size:
|
|
446
|
-
disabled:
|
|
447
|
-
error:
|
|
448
|
-
options:
|
|
449
|
-
filterOption:
|
|
450
|
-
valueKey:
|
|
451
|
-
multiple:
|
|
452
|
-
popupVisible:
|
|
453
|
-
defaultPopupVisible:
|
|
454
|
-
showExtraOptions:
|
|
455
|
-
modelValue:
|
|
456
|
-
fieldNames:
|
|
457
|
-
loading:
|
|
458
|
-
defaultActiveFirstOption:
|
|
459
|
-
} =
|
|
460
|
-
formItemCtx:
|
|
461
|
-
mergedSize:
|
|
462
|
-
mergedDisabled:
|
|
463
|
-
mergedError:
|
|
464
|
-
eventHandlers:
|
|
465
|
-
} =
|
|
466
|
-
size:
|
|
467
|
-
disabled:
|
|
468
|
-
error:
|
|
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:
|
|
471
|
-
} =
|
|
472
|
-
|
|
473
|
-
if (
|
|
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 =
|
|
476
|
-
return
|
|
476
|
+
const l = o.get(e.value);
|
|
477
|
+
return a.formatLabel(l);
|
|
477
478
|
};
|
|
478
479
|
});
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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
|
-
|
|
494
|
-
(
|
|
505
|
+
I(pe, (e) => {
|
|
506
|
+
(N(e) || ea(e)) && (D.value = $.value ? [] : e);
|
|
495
507
|
});
|
|
496
|
-
const
|
|
497
|
-
...
|
|
498
|
-
...
|
|
499
|
-
})),
|
|
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((
|
|
502
|
-
l[
|
|
513
|
+
return e.forEach((t) => {
|
|
514
|
+
l[t] = o.get(t) ?? b.value[t];
|
|
503
515
|
}), l;
|
|
504
|
-
},
|
|
505
|
-
|
|
506
|
-
},
|
|
507
|
-
[
|
|
508
|
-
[
|
|
509
|
-
},
|
|
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 (
|
|
512
|
-
for (const
|
|
513
|
-
if (!l.includes(
|
|
514
|
-
const
|
|
515
|
-
(!
|
|
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 (
|
|
519
|
-
const
|
|
520
|
-
if (!l.includes(
|
|
521
|
-
const
|
|
522
|
-
(!
|
|
523
|
-
value:
|
|
524
|
-
key:
|
|
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
|
-
},
|
|
530
|
-
var
|
|
531
|
-
let l =
|
|
532
|
-
const
|
|
533
|
-
return !
|
|
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
|
-
...
|
|
550
|
+
...t.raw,
|
|
551
|
+
[E.value.value]: e.value,
|
|
552
|
+
[E.value.label]: t.label
|
|
536
553
|
}), l;
|
|
537
|
-
}));
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
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
|
|
564
|
+
const je = (e) => {
|
|
558
565
|
var l;
|
|
559
|
-
return
|
|
560
|
-
var
|
|
561
|
-
return ((
|
|
562
|
-
}) : ((l =
|
|
563
|
-
},
|
|
564
|
-
var
|
|
565
|
-
const l =
|
|
566
|
-
|
|
567
|
-
},
|
|
568
|
-
|
|
569
|
-
},
|
|
570
|
-
if (
|
|
571
|
-
if (
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
if (
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
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
|
-
|
|
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
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
},
|
|
593
|
-
e !==
|
|
594
|
-
},
|
|
595
|
-
const l =
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
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
|
-
|
|
604
|
-
},
|
|
605
|
-
|
|
606
|
-
},
|
|
607
|
-
|
|
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:
|
|
610
|
-
optionInfoMap:
|
|
611
|
-
validOptionInfos:
|
|
612
|
-
enabledOptionKeys:
|
|
613
|
-
activeKey:
|
|
614
|
-
handleKeyDown:
|
|
615
|
-
} =
|
|
616
|
-
multiple:
|
|
617
|
-
options:
|
|
618
|
-
extraOptions:
|
|
619
|
-
inputValue:
|
|
620
|
-
filterOption:
|
|
621
|
-
showExtraOptions:
|
|
622
|
-
component:
|
|
623
|
-
valueKey:
|
|
624
|
-
fieldNames:
|
|
625
|
-
loading:
|
|
626
|
-
disabled:
|
|
627
|
-
popupVisible:
|
|
628
|
-
valueKeys:
|
|
629
|
-
dropdownRef:
|
|
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:
|
|
633
|
-
onSelect:
|
|
634
|
-
onPopupVisibleChange:
|
|
635
|
-
getOptionId:
|
|
636
|
-
})
|
|
637
|
-
|
|
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(
|
|
641
|
-
"aria-controls":
|
|
642
|
-
"aria-activedescendant":
|
|
643
|
-
"aria-autocomplete":
|
|
644
|
-
"aria-label":
|
|
645
|
-
})),
|
|
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
|
|
648
|
-
const
|
|
649
|
-
|
|
650
|
-
...
|
|
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: (
|
|
653
|
-
closable: !(
|
|
654
|
-
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
|
-
}),
|
|
659
|
-
|
|
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
|
|
666
|
-
},
|
|
667
|
-
if (
|
|
707
|
+
return h(e.render) ? e.render : () => e.label;
|
|
708
|
+
}, _ = (e) => {
|
|
709
|
+
if (le(e)) {
|
|
668
710
|
let l;
|
|
669
|
-
return
|
|
711
|
+
return y(oa, {
|
|
670
712
|
key: e.key,
|
|
671
713
|
label: e.label
|
|
672
|
-
},
|
|
714
|
+
}, ma(l = e.options.map((t) => _(t))) ? l : {
|
|
673
715
|
default: () => [l]
|
|
674
716
|
});
|
|
675
717
|
}
|
|
676
|
-
return
|
|
677
|
-
inputValue:
|
|
678
|
-
filterOption:
|
|
679
|
-
}) ?
|
|
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
|
|
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:
|
|
731
|
+
default: Me(e)
|
|
690
732
|
}) : null;
|
|
691
|
-
},
|
|
692
|
-
ref:
|
|
693
|
-
id:
|
|
694
|
-
multiple:
|
|
695
|
-
loading:
|
|
696
|
-
empty:
|
|
697
|
-
virtualList:
|
|
698
|
-
scrollbar:
|
|
699
|
-
showHeaderOnEmpty:
|
|
700
|
-
showFooterOnEmpty:
|
|
701
|
-
onScroll:
|
|
702
|
-
onReachBottom:
|
|
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)) ?? [], ...
|
|
748
|
+
return [...((e = n.default) == null ? void 0 : e.call(n)) ?? [], ...X.value.map(_)];
|
|
707
749
|
},
|
|
708
|
-
"virtual-list": () =>
|
|
709
|
-
ref:
|
|
710
|
-
data:
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
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
|
-
}) =>
|
|
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
|
-
}),
|
|
773
|
+
}), $e = ({
|
|
731
774
|
data: e
|
|
732
775
|
}) => {
|
|
733
|
-
var l,
|
|
734
|
-
if ((n.label ||
|
|
735
|
-
const
|
|
736
|
-
if (
|
|
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:
|
|
739
|
-
})) ?? ((
|
|
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 () =>
|
|
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:
|
|
753
|
-
popupVisible:
|
|
754
|
-
unmountOnClose:
|
|
755
|
-
clickToClose: !(
|
|
756
|
-
popupContainer:
|
|
757
|
-
onPopupVisibleChange:
|
|
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
|
-
},
|
|
802
|
+
}, a.triggerProps), {
|
|
760
803
|
default: () => {
|
|
761
804
|
var e;
|
|
762
805
|
return [((e = n.trigger) == null ? void 0 : e.call(n, {
|
|
763
|
-
popupVisible:
|
|
764
|
-
disabled:
|
|
765
|
-
listboxId:
|
|
766
|
-
activeDescendant:
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
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:
|
|
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:
|
|
846
|
+
content: Ue
|
|
799
847
|
});
|
|
800
848
|
}
|
|
801
849
|
});
|
|
802
850
|
export {
|
|
803
|
-
|
|
851
|
+
Pa as default
|
|
804
852
|
};
|