hys-ui 0.3.0 → 0.5.0
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/CHANGELOG.md +27 -0
- package/README.md +68 -73
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +467 -2
- package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.js +7 -0
- package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas2.vue.js +166 -0
- package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.js +7 -0
- package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits2.vue.js +105 -0
- package/dist/components/HysAnimatedNumber/animation/digital.js +186 -0
- package/dist/components/HysAnimatedNumber/animation/morph.js +110 -0
- package/dist/components/HysAnimatedNumber/animation/paint.js +34 -0
- package/dist/components/HysAnimatedNumber/animation/particles.js +51 -0
- package/dist/components/HysAnimatedNumber/animation/paths.js +165 -0
- package/dist/components/HysAnimatedNumber/animation/physics.js +66 -0
- package/dist/components/HysAnimatedNumber/animation/render.js +89 -0
- package/dist/components/HysAnimatedNumber/animation/reveal.js +125 -0
- package/dist/components/HysAnimatedNumber/animation/rolling.js +66 -0
- package/dist/components/HysAnimatedNumber/animation/scenarios.js +217 -0
- package/dist/components/HysAnimatedNumber/animation/spatial.js +112 -0
- package/dist/components/HysAnimatedNumber/useNumberCountdown.js +58 -0
- package/dist/components/HysAnimatedNumber/useNumberVisuals.js +60 -0
- package/dist/components/HysButton/HysButton.vue.js +2 -2
- package/dist/components/HysButton/HysButton2.vue.js +227 -60
- package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
- package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
- package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
- package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
- package/dist/components/HysInput/HysInput.vue.js +2 -2
- package/dist/components/HysInput/HysInput2.vue.js +327 -274
- package/dist/components/HysMention/HysMention.vue.js +1 -1
- package/dist/components/HysMention/HysMention2.vue.js +1092 -154
- package/dist/components/HysModal/HysModal.vue.js +3 -3
- package/dist/components/HysModal/HysModal2.vue.js +81 -80
- package/dist/components/HysPagination/HysPagination.vue.js +2 -2
- package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
- package/dist/components/HysSearch/HysSearch.vue.js +5 -82
- package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
- package/dist/components/HysSelect/HysSelect.vue.js +2 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +472 -443
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
- package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +1418 -1150
- package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
- package/dist/components/HysTour/HysTour.vue.js +291 -67
- package/dist/components/HysTour/HysTour3.vue.js +5 -0
- package/dist/composables/animatedNumberDigits.js +106 -0
- package/dist/composables/animatedNumberFormat.js +222 -0
- package/dist/composables/animatedNumberTiming.js +66 -0
- package/dist/composables/buttonGroup.js +12 -0
- package/dist/composables/floatingPosition.js +18 -0
- package/dist/composables/mentionDocument.js +79 -0
- package/dist/composables/mentionEditor.js +58 -0
- package/dist/composables/numberAnimation.js +72 -0
- package/dist/composables/numberAnimationCatalog.js +301 -0
- package/dist/composables/numberAnimationSequence.js +45 -0
- package/dist/composables/selectOptions.js +44 -38
- package/dist/composables/splitPaneSizes.js +58 -0
- package/dist/composables/table.js +128 -105
- package/dist/composables/textInput.js +23 -14
- package/dist/composables/useDialog.js +50 -50
- package/dist/composables/useFloating.js +107 -103
- package/dist/composables/useHysAnimatedNumber.js +264 -0
- package/dist/composables/useHysNumberAnimationGroup.js +23 -0
- package/dist/composables/useMentionCaret.js +81 -0
- package/dist/composables/useMentionList.js +81 -0
- package/dist/composables/useMentionModel.js +90 -0
- package/dist/composables/useMentionOptions.js +421 -0
- package/dist/composables/useSplitPaneDrag.js +52 -0
- package/dist/composables/useSplitPaneStorage.js +38 -0
- package/dist/composables/useTable.js +344 -312
- package/dist/composables/useTableSticky.js +79 -0
- package/dist/composables/useTextareaSize.js +62 -46
- package/dist/composables/useTourLayout.js +129 -0
- package/dist/config.js +11 -11
- package/dist/index.js +183 -152
- package/dist/internal/MultiSplitPane.vue.js +305 -0
- package/dist/internal/MultiSplitPane2.vue.js +4 -0
- package/dist/style.css +1 -1
- package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +99 -6
- package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
- package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
- package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
- package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
- package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
- package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
- package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
- package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
- package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
- package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +12 -3
- package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
- package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
- package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
- package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
- package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
- package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +3 -3
- package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +3 -3
- package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +2 -2
- package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +6 -6
- package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +2 -2
- package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
- package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
- package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -40
- package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
- package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
- package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
- package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
- package/dist/types/components/HysSearch/HysSearch.vue.d.ts +46 -8
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +6 -1
- package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
- package/dist/types/components/HysTable/HysTable.vue.d.ts +1740 -3
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
- package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
- package/dist/types/components/HysToast/HysToast.vue.d.ts +1 -1
- package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
- package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -9
- package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +3 -3
- package/dist/types/components/HysUpload/HysUpload.vue.d.ts +2 -2
- package/dist/types/composables/animatedNumber.d.ts +220 -0
- package/dist/types/composables/animatedNumberDigits.d.ts +32 -0
- package/dist/types/composables/animatedNumberFormat.d.ts +16 -0
- package/dist/types/composables/animatedNumberTiming.d.ts +21 -0
- package/dist/types/composables/buttonGroup.d.ts +9 -0
- package/dist/types/composables/drawer.d.ts +1 -1
- package/dist/types/composables/floatingPosition.d.ts +14 -0
- package/dist/types/composables/mention.d.ts +284 -0
- package/dist/types/composables/mentionDocument.d.ts +15 -0
- package/dist/types/composables/mentionEditor.d.ts +7 -0
- package/dist/types/composables/modal.d.ts +2 -0
- package/dist/types/composables/numberAnimation.d.ts +29 -0
- package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
- package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
- package/dist/types/composables/selectOptions.d.ts +5 -0
- package/dist/types/composables/splitPaneSizes.d.ts +11 -0
- package/dist/types/composables/table.d.ts +116 -6
- package/dist/types/composables/textInput.d.ts +39 -4
- package/dist/types/composables/tour.d.ts +68 -0
- package/dist/types/composables/useFloating.d.ts +1 -1
- package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
- package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
- package/dist/types/composables/useMentionCaret.d.ts +6 -0
- package/dist/types/composables/useMentionList.d.ts +23 -0
- package/dist/types/composables/useMentionModel.d.ts +14 -0
- package/dist/types/composables/useMentionOptions.d.ts +26 -0
- package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
- package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
- package/dist/types/composables/useTable.d.ts +7 -3
- package/dist/types/composables/useTableSticky.d.ts +22 -0
- package/dist/types/composables/useTextareaSize.d.ts +5 -2
- package/dist/types/composables/useTourLayout.d.ts +33 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/index.d.ts +46 -1
- package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
- package/package.json +3 -2
- package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
- package/dist/components/HysTour/HysTour2.vue.js +0 -4
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { X as Tt, LoaderCircle as
|
|
4
|
-
import { fieldKey as
|
|
5
|
-
import { useHysRootAttrs as
|
|
6
|
-
import { useFloating as
|
|
7
|
-
import { normalizeSelectOptions as
|
|
8
|
-
const
|
|
1
|
+
import { defineComponent as Ut, useAttrs as Qt, inject as Yt, ref as L, useId as Xt, shallowRef as he, computed as c, watch as X, nextTick as z, onMounted as Gt, onUpdated as Jt, onActivated as Zt, onDeactivated as _t, onBeforeUnmount as el, openBlock as v, createElementBlock as h, mergeProps as Qe, unref as s, createElementVNode as $, withModifiers as Ee, renderSlot as T, Fragment as ie, renderList as Ye, toDisplayString as M, createVNode as ye, createCommentVNode as E, createTextVNode as _, normalizeClass as St, createBlock as Xe, Teleport as tl, withCtx as ll, normalizeStyle as me } from "vue";
|
|
2
|
+
import al from "../../motion/PopupMotion.js";
|
|
3
|
+
import { X as Tt, LoaderCircle as ol, ChevronDown as il, Plus as ul, Check as nl } from "lucide-vue-next";
|
|
4
|
+
import { fieldKey as sl, useHysControlState as rl, formValue as cl } from "../../composables/formContext.js";
|
|
5
|
+
import { useHysRootAttrs as dl } from "../../config.js";
|
|
6
|
+
import { useFloating as vl } from "../../composables/useFloating.js";
|
|
7
|
+
import { isSelectLabeledValue as Ct, normalizeSelectOptions as fl, selectKeyFactory as pl } from "../../composables/selectOptions.js";
|
|
8
|
+
const hl = ["disabled"], yl = ["id", "tabindex", "aria-label", "aria-expanded", "aria-disabled", "aria-readonly", "aria-required", "aria-invalid", "aria-describedby", "aria-controls", "aria-activedescendant"], ml = { class: "hys-ui-select-label" }, bl = ["title"], gl = ["disabled", "aria-label", "onClick"], kl = ["title"], xl = ["title"], Al = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "hys-ui-select-suffix"
|
|
11
|
-
},
|
|
11
|
+
}, Sl = ["name", "value", "disabled"], Tl = ["data-size", "data-placement"], Cl = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "hys-ui-select-header"
|
|
14
|
-
},
|
|
14
|
+
}, wl = ["value", "aria-controls", "aria-activedescendant"], Ml = {
|
|
15
15
|
key: 2,
|
|
16
16
|
class: "hys-ui-select-bulk",
|
|
17
17
|
role: "group",
|
|
18
18
|
"aria-label": "批量选择"
|
|
19
|
-
},
|
|
19
|
+
}, Bl = ["title"], Vl = ["disabled", "aria-label"], Ll = ["disabled", "aria-label"], Ol = ["id", "aria-label", "aria-multiselectable", "aria-busy"], zl = {
|
|
20
20
|
key: 0,
|
|
21
21
|
class: "hys-ui-floating-empty",
|
|
22
22
|
role: "status"
|
|
23
|
-
},
|
|
23
|
+
}, $l = {
|
|
24
24
|
key: 1,
|
|
25
25
|
class: "hys-ui-floating-empty",
|
|
26
26
|
role: "status"
|
|
27
|
-
},
|
|
27
|
+
}, El = ["id", "data-active", "aria-label", "aria-description", "aria-selected", "aria-setsize", "aria-posinset", "disabled", "onPointerenter", "onClick"], Fl = ["title"], Hl = {
|
|
28
28
|
key: 0,
|
|
29
29
|
class: "hys-ui-select-create-label"
|
|
30
|
-
},
|
|
30
|
+
}, jl = {
|
|
31
31
|
key: 3,
|
|
32
32
|
class: "hys-ui-floating-empty"
|
|
33
|
-
},
|
|
33
|
+
}, Il = {
|
|
34
34
|
key: 3,
|
|
35
35
|
class: "hys-ui-select-footer"
|
|
36
|
-
},
|
|
36
|
+
}, wt = 'a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[tabindex]:not([tabindex="-1"])', Ul = /* @__PURE__ */ Ut({
|
|
37
37
|
inheritAttrs: !1,
|
|
38
38
|
__name: "HysSelect",
|
|
39
39
|
props: {
|
|
@@ -56,7 +56,8 @@ const cl = ["disabled"], dl = ["id", "tabindex", "aria-label", "aria-expanded",
|
|
|
56
56
|
filterable: { type: Boolean },
|
|
57
57
|
clearable: { type: Boolean },
|
|
58
58
|
emptyValues: { default: () => ["", null, void 0] },
|
|
59
|
-
clearValue: { type: [String, Number, Boolean, Object, null], default: "" },
|
|
59
|
+
clearValue: { type: [String, Number, Boolean, Object, null, Function], default: "" },
|
|
60
|
+
labelInValue: { type: Boolean },
|
|
60
61
|
fallbackOption: { type: [Boolean, Function] },
|
|
61
62
|
multipleLimit: { default: 0 },
|
|
62
63
|
maxTagCount: { default: 3 },
|
|
@@ -79,6 +80,7 @@ const cl = ["disabled"], dl = ["id", "tabindex", "aria-label", "aria-expanded",
|
|
|
79
80
|
showOnFocus: { type: Boolean },
|
|
80
81
|
retainSearch: { type: Boolean },
|
|
81
82
|
defaultActiveFirst: { type: Boolean, default: !0 },
|
|
83
|
+
firstActiveValue: { type: [String, Number, Boolean, Object] },
|
|
82
84
|
keyboard: { type: Boolean, default: !0 },
|
|
83
85
|
popupMatchWidth: { type: Boolean },
|
|
84
86
|
popupWidth: {},
|
|
@@ -102,54 +104,64 @@ const cl = ["disabled"], dl = ["id", "tabindex", "aria-label", "aria-expanded",
|
|
|
102
104
|
name: {}
|
|
103
105
|
},
|
|
104
106
|
emits: ["update:modelValue", "change", "clear", "selectAll", "deselectAll", "update:open", "visibleChange", "update:searchValue", "search", "select", "deselect", "removeTag", "create", "reject", "searchError", "focus", "blur", "popupScroll", "reachEnd"],
|
|
105
|
-
setup(r, { expose:
|
|
106
|
-
const a = r, p =
|
|
107
|
+
setup(r, { expose: Mt, emit: Bt }) {
|
|
108
|
+
const a = r, p = Bt, Vt = Qt(), Ge = dl(), W = Yt(sl, void 0), {
|
|
107
109
|
disabled: b,
|
|
108
110
|
size: F,
|
|
109
|
-
label:
|
|
110
|
-
} =
|
|
111
|
-
function
|
|
112
|
-
var
|
|
113
|
-
const e = (
|
|
111
|
+
label: Je
|
|
112
|
+
} = rl(a), m = L(), C = L(), H = L(), ee = L(), ue = Xt(), Fe = L("");
|
|
113
|
+
function Ze() {
|
|
114
|
+
var o;
|
|
115
|
+
const e = (o = m.value) == null ? void 0 : o.closest("label");
|
|
114
116
|
if (!e) {
|
|
115
117
|
Fe.value = "";
|
|
116
118
|
return;
|
|
117
119
|
}
|
|
118
120
|
const t = e.cloneNode(!0);
|
|
119
|
-
t.querySelectorAll(".hys-ui-select-wrap").forEach((
|
|
121
|
+
t.querySelectorAll(".hys-ui-select-wrap").forEach((u) => u.remove()), Fe.value = (t.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
122
|
+
}
|
|
123
|
+
const _e = he(a.defaultValue ?? null), He = c(
|
|
124
|
+
() => a.modelValue !== void 0 ? a.modelValue : _e.value
|
|
125
|
+
), O = c(() => a.multiple || Array.isArray(He.value)), n = pl(() => a.valueKey);
|
|
126
|
+
function et(e) {
|
|
127
|
+
return Array.isArray(e) ? e.filter((t) => t != null) : e == null || a.emptyValues.some((t) => Object.is(t, e)) ? [] : [e];
|
|
120
128
|
}
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const o = s(i);
|
|
127
|
-
return t.has(o) ? !1 : (t.add(o), !0);
|
|
129
|
+
const je = c(() => et(He.value)), g = c(() => {
|
|
130
|
+
const e = a.labelInValue ? je.value.map((o) => Ct(o) ? o.value : o) : je.value, t = /* @__PURE__ */ new Set();
|
|
131
|
+
return e.filter((o) => {
|
|
132
|
+
const u = n(o);
|
|
133
|
+
return t.has(u) ? !1 : (t.add(u), !0);
|
|
128
134
|
});
|
|
129
|
-
}),
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
}), Lt = c(() => {
|
|
136
|
+
const e = /* @__PURE__ */ new Map();
|
|
137
|
+
if (a.labelInValue)
|
|
138
|
+
for (const t of je.value)
|
|
139
|
+
Ct(t) && e.set(n(t.value), t.label);
|
|
140
|
+
return e;
|
|
141
|
+
}), j = c(() => new Set(g.value.map(n))), q = he([]), N = he(/* @__PURE__ */ new Map()), be = he(), ge = L(!1), te = he(), tt = L(""), ke = L(a.searchValue ?? ""), xe = L(!1), k = c(() => a.searchValue ?? tt.value), ne = c(() => a.filterable || a.allowCreate), lt = c(
|
|
142
|
+
() => fl(
|
|
143
|
+
be.value ?? a.options,
|
|
132
144
|
a.fieldNames,
|
|
133
|
-
|
|
145
|
+
n
|
|
134
146
|
)
|
|
135
|
-
),
|
|
136
|
-
() =>
|
|
147
|
+
), le = c(
|
|
148
|
+
() => lt.value.flatMap((e) => e.option ? [e.option] : [])
|
|
137
149
|
);
|
|
138
150
|
X(
|
|
139
|
-
[
|
|
151
|
+
[le, g, q],
|
|
140
152
|
() => {
|
|
141
|
-
const e =
|
|
142
|
-
for (const
|
|
143
|
-
t.set(
|
|
144
|
-
for (const
|
|
145
|
-
const
|
|
146
|
-
!t.has(
|
|
153
|
+
const e = N.value, t = /* @__PURE__ */ new Map();
|
|
154
|
+
for (const o of [...q.value, ...le.value])
|
|
155
|
+
t.set(n(o.value), o);
|
|
156
|
+
for (const o of g.value) {
|
|
157
|
+
const u = n(o);
|
|
158
|
+
!t.has(u) && e.has(u) && t.set(u, e.get(u));
|
|
147
159
|
}
|
|
148
|
-
|
|
160
|
+
N.value = t;
|
|
149
161
|
},
|
|
150
162
|
{ immediate: !0 }
|
|
151
163
|
);
|
|
152
|
-
function
|
|
164
|
+
function Ot(e) {
|
|
153
165
|
if (a.fallbackOption !== !1)
|
|
154
166
|
return typeof a.fallbackOption == "function" ? a.fallbackOption(e) : {
|
|
155
167
|
value: e,
|
|
@@ -158,139 +170,143 @@ const cl = ["disabled"], dl = ["id", "tabindex", "aria-label", "aria-expanded",
|
|
|
158
170
|
)
|
|
159
171
|
};
|
|
160
172
|
}
|
|
173
|
+
function Ae(e) {
|
|
174
|
+
const t = n(e), o = Lt.value.get(t);
|
|
175
|
+
return N.value.get(t) ?? (o === void 0 ? Ot(e) : { value: e, label: o });
|
|
176
|
+
}
|
|
161
177
|
const B = c(
|
|
162
178
|
() => g.value.flatMap((e) => {
|
|
163
|
-
const t =
|
|
179
|
+
const t = Ae(e);
|
|
164
180
|
return t ? [t] : [];
|
|
165
181
|
})
|
|
166
|
-
),
|
|
182
|
+
), at = c(
|
|
167
183
|
() => B.value.slice(
|
|
168
184
|
0,
|
|
169
185
|
a.maxTagCount === void 0 ? void 0 : Math.max(0, a.maxTagCount)
|
|
170
186
|
)
|
|
171
187
|
), Se = c(
|
|
172
|
-
() => B.value.slice(
|
|
173
|
-
),
|
|
174
|
-
() =>
|
|
188
|
+
() => B.value.slice(at.value.length)
|
|
189
|
+
), D = c(() => a.loading || ge.value), Te = c(
|
|
190
|
+
() => O.value && a.multipleLimit > 0 && g.value.length >= a.multipleLimit
|
|
175
191
|
), Ce = c(
|
|
176
192
|
() => {
|
|
177
193
|
var e, t;
|
|
178
|
-
return a.status ?? ((e =
|
|
194
|
+
return a.status ?? ((e = W == null ? void 0 : W.invalid) != null && e.value ? "error" : (t = W == null ? void 0 : W.status) == null ? void 0 : t.value);
|
|
179
195
|
}
|
|
180
|
-
),
|
|
196
|
+
), ae = c(
|
|
181
197
|
() => F.value === "sm" ? 14 : F.value === "lg" ? 18 : 16
|
|
182
|
-
),
|
|
198
|
+
), R = c(
|
|
183
199
|
() => Math.max(
|
|
184
200
|
24,
|
|
185
201
|
a.itemHeight ?? (F.value === "sm" ? 34 : F.value === "lg" ? 50 : 42)
|
|
186
202
|
)
|
|
187
|
-
),
|
|
203
|
+
), Ie = c(() => {
|
|
188
204
|
const e = k.value.trim();
|
|
189
|
-
if (!(!a.allowCreate || !e || [...
|
|
190
|
-
(t) => t.label === e ||
|
|
205
|
+
if (!(!a.allowCreate || !e || [...le.value, ...q.value].some(
|
|
206
|
+
(t) => t.label === e || n(t.value) === n(e)
|
|
191
207
|
)))
|
|
192
208
|
return { value: e, label: e };
|
|
193
209
|
}), S = c(() => {
|
|
194
|
-
let e =
|
|
195
|
-
|
|
196
|
-
(
|
|
197
|
-
(l) =>
|
|
210
|
+
let e = lt.value.filter((i) => i.option).concat(
|
|
211
|
+
q.value.filter(
|
|
212
|
+
(i) => !le.value.some(
|
|
213
|
+
(l) => n(l.value) === n(i.value)
|
|
198
214
|
)
|
|
199
|
-
).map((
|
|
215
|
+
).map((i) => ({ key: n(i.value), option: i, index: -1 }))
|
|
200
216
|
);
|
|
201
217
|
!a.remote && !a.remoteMethod && (e = e.filter(
|
|
202
|
-
(
|
|
218
|
+
(i) => !k.value || (a.filterMethod ? a.filterMethod(k.value, i.option) : i.option.label.toLocaleLowerCase().includes(k.value.toLocaleLowerCase()))
|
|
203
219
|
)), a.filterSort && (e = [...e].sort(
|
|
204
|
-
(
|
|
205
|
-
)),
|
|
220
|
+
(i, l) => a.filterSort(i.option, l.option)
|
|
221
|
+
)), Ie.value && (e = [
|
|
206
222
|
{
|
|
207
|
-
key: "create:" +
|
|
208
|
-
option:
|
|
223
|
+
key: "create:" + n(Ie.value.value),
|
|
224
|
+
option: Ie.value,
|
|
209
225
|
created: !0,
|
|
210
226
|
index: -1
|
|
211
227
|
},
|
|
212
228
|
...e
|
|
213
229
|
]);
|
|
214
230
|
const t = [];
|
|
215
|
-
let
|
|
216
|
-
for (const
|
|
217
|
-
|
|
231
|
+
let o, u = 0;
|
|
232
|
+
for (const i of e)
|
|
233
|
+
i.group !== o && (o = i.group, o && t.push({ key: "group:" + o + ":" + u, index: -1, group: o })), t.push({ ...i, index: u++ });
|
|
218
234
|
return t;
|
|
219
|
-
}), we = c(() =>
|
|
220
|
-
const e = a.selectAllScope === "all" ? [...
|
|
221
|
-
(
|
|
235
|
+
}), we = c(() => O.value && a.showSelectAll), Ke = c(() => {
|
|
236
|
+
const e = a.selectAllScope === "all" ? [...le.value, ...q.value] : S.value.flatMap(
|
|
237
|
+
(o) => o.option && !o.created ? [o.option] : []
|
|
222
238
|
), t = /* @__PURE__ */ new Set();
|
|
223
|
-
return e.filter((
|
|
224
|
-
const
|
|
225
|
-
return t.has(
|
|
239
|
+
return e.filter((o) => {
|
|
240
|
+
const u = n(o.value);
|
|
241
|
+
return t.has(u) ? !1 : (t.add(u), !o.disabled);
|
|
226
242
|
});
|
|
227
243
|
}), Me = c(
|
|
228
|
-
() => b.value || a.readonly ||
|
|
229
|
-
),
|
|
244
|
+
() => b.value || a.readonly || D.value || !!te.value
|
|
245
|
+
), zt = c(
|
|
230
246
|
() => Ke.value.some(
|
|
231
|
-
(e) => !j.value.has(
|
|
247
|
+
(e) => !j.value.has(n(e.value))
|
|
232
248
|
)
|
|
233
|
-
),
|
|
249
|
+
), ot = c(() => {
|
|
234
250
|
const e = new Set(
|
|
235
|
-
Ke.value.map((t) =>
|
|
251
|
+
Ke.value.map((t) => n(t.value))
|
|
236
252
|
);
|
|
237
253
|
return g.value.filter((t) => {
|
|
238
|
-
const
|
|
239
|
-
return !(
|
|
254
|
+
const o = N.value.get(n(t));
|
|
255
|
+
return !(o != null && o.disabled) && (a.selectAllScope === "all" || e.has(n(t)));
|
|
240
256
|
});
|
|
241
|
-
}),
|
|
257
|
+
}), $t = c(
|
|
242
258
|
() => S.value.filter((e) => e.option).length
|
|
243
|
-
),
|
|
259
|
+
), V = L(), Be = L(0), We = L(0), I = c(
|
|
244
260
|
() => a.virtual && S.value.length > 100
|
|
245
|
-
),
|
|
261
|
+
), se = c(
|
|
246
262
|
() => Math.min(
|
|
247
263
|
800,
|
|
248
264
|
Math.max(80, Number.isFinite(a.listHeight) ? a.listHeight : 240)
|
|
249
265
|
)
|
|
250
|
-
),
|
|
251
|
-
() =>
|
|
266
|
+
), it = c(() => Math.max(1, Math.min(30, a.overscan))), qe = c(
|
|
267
|
+
() => I.value ? Math.max(
|
|
252
268
|
0,
|
|
253
269
|
Math.min(
|
|
254
270
|
Math.max(0, S.value.length - 1),
|
|
255
|
-
Math.floor(Be.value /
|
|
271
|
+
Math.floor(Be.value / R.value) - it.value
|
|
256
272
|
)
|
|
257
273
|
) : 0
|
|
258
|
-
),
|
|
259
|
-
() =>
|
|
274
|
+
), ut = c(
|
|
275
|
+
() => I.value ? S.value.slice(
|
|
260
276
|
qe.value,
|
|
261
|
-
qe.value + Math.ceil(
|
|
277
|
+
qe.value + Math.ceil(se.value / R.value) + it.value * 2
|
|
262
278
|
) : S.value
|
|
263
|
-
),
|
|
264
|
-
() => S.value.find((e) => e.key ===
|
|
265
|
-
),
|
|
279
|
+
), re = c(
|
|
280
|
+
() => S.value.find((e) => e.key === V.value)
|
|
281
|
+
), nt = c(
|
|
266
282
|
() => {
|
|
267
283
|
var e;
|
|
268
|
-
return !
|
|
284
|
+
return !D.value && ((e = re.value) != null && e.option) && (!I.value || ut.value.some((t) => t.key === V.value)) ? ue + "-" + re.value.index : void 0;
|
|
269
285
|
}
|
|
270
|
-
),
|
|
271
|
-
var
|
|
272
|
-
if (!
|
|
286
|
+
), Et = c(() => {
|
|
287
|
+
var o;
|
|
288
|
+
if (!I.value || a.popupMatchWidth || a.popupWidth !== void 0)
|
|
273
289
|
return a.popupWidth;
|
|
274
290
|
const e = F.value === "sm" ? 12 : F.value === "lg" ? 15 : 14;
|
|
275
291
|
let t = 0;
|
|
276
|
-
for (const
|
|
277
|
-
const
|
|
292
|
+
for (const u of S.value) {
|
|
293
|
+
const i = ((o = u.option) == null ? void 0 : o.label) ?? u.group ?? "";
|
|
278
294
|
let l = 0;
|
|
279
|
-
for (const
|
|
295
|
+
for (const d of i) l += d.charCodeAt(0) > 255 ? 1 : 0.58;
|
|
280
296
|
t = Math.max(t, l * e);
|
|
281
297
|
}
|
|
282
298
|
return Math.max(We.value, t + 52);
|
|
283
299
|
});
|
|
284
|
-
let U = !0,
|
|
300
|
+
let U = !0, ce = !1, de = 0, oe, De, G, Re = 0, Ve, Le = "";
|
|
285
301
|
const {
|
|
286
302
|
open: y,
|
|
287
|
-
style:
|
|
288
|
-
placement:
|
|
289
|
-
show:
|
|
303
|
+
style: Ft,
|
|
304
|
+
placement: st,
|
|
305
|
+
show: Ht,
|
|
290
306
|
close: w,
|
|
291
|
-
update:
|
|
292
|
-
restoringFocus:
|
|
293
|
-
} =
|
|
307
|
+
update: Oe,
|
|
308
|
+
restoringFocus: jt
|
|
309
|
+
} = vl(m, C, {
|
|
294
310
|
get placement() {
|
|
295
311
|
return a.placement;
|
|
296
312
|
},
|
|
@@ -298,121 +314,134 @@ const cl = ["disabled"], dl = ["id", "tabindex", "aria-label", "aria-expanded",
|
|
|
298
314
|
return !we.value;
|
|
299
315
|
},
|
|
300
316
|
matchWidth: () => a.popupMatchWidth ? !0 : "min",
|
|
301
|
-
width: () =>
|
|
317
|
+
width: () => Et.value,
|
|
302
318
|
requestOpen: (e) => (p("update:open", e), a.open === void 0 ? void 0 : !1)
|
|
303
|
-
}),
|
|
319
|
+
}), It = c(() => ({
|
|
304
320
|
...a.popupStyle,
|
|
305
|
-
...
|
|
321
|
+
...Ft.value,
|
|
306
322
|
maxHeight: "min(60dvh, calc(100dvh - 20px))",
|
|
307
323
|
overflowY: "hidden",
|
|
308
|
-
"--hys-ui-select-stride":
|
|
309
|
-
"--hys-ui-select-list-height":
|
|
310
|
-
})),
|
|
311
|
-
Object.entries(
|
|
312
|
-
), J = (e) => !!e.disabled || a.readonly ||
|
|
313
|
-
function
|
|
324
|
+
"--hys-ui-select-stride": R.value + "px",
|
|
325
|
+
"--hys-ui-select-list-height": se.value + "px"
|
|
326
|
+
})), Kt = () => Object.fromEntries(
|
|
327
|
+
Object.entries(Vt).filter(([e]) => !["class", "style"].includes(e))
|
|
328
|
+
), J = (e) => !!e.disabled || a.readonly || D.value || b.value || Te.value && !j.value.has(n(e.value));
|
|
329
|
+
function rt() {
|
|
314
330
|
return S.value.filter((e) => e.option && !J(e.option));
|
|
315
331
|
}
|
|
316
|
-
function
|
|
317
|
-
var
|
|
318
|
-
const t =
|
|
319
|
-
(
|
|
320
|
-
);
|
|
321
|
-
|
|
332
|
+
function ze(e = !1) {
|
|
333
|
+
var i;
|
|
334
|
+
const t = rt(), o = t.find(
|
|
335
|
+
(l) => j.value.has(n(l.option.value))
|
|
336
|
+
), u = !e && a.firstActiveValue !== void 0 ? t.find((l) => n(l.option.value) === n(a.firstActiveValue)) : void 0;
|
|
337
|
+
V.value = (i = o ?? u ?? (a.defaultActiveFirst ? e ? t.at(-1) : t[0] : void 0)) == null ? void 0 : i.key;
|
|
322
338
|
}
|
|
323
339
|
async function Z() {
|
|
324
|
-
var t,
|
|
340
|
+
var t, o;
|
|
325
341
|
const e = S.value.findIndex(
|
|
326
|
-
(
|
|
342
|
+
(u) => u.key === V.value
|
|
327
343
|
);
|
|
328
344
|
if (!(e < 0)) {
|
|
329
|
-
if (
|
|
330
|
-
const
|
|
331
|
-
|
|
345
|
+
if (I.value && H.value) {
|
|
346
|
+
const u = e * R.value, i = u + R.value, l = H.value.clientHeight || se.value;
|
|
347
|
+
u < H.value.scrollTop ? H.value.scrollTop = u : i > H.value.scrollTop + l && (H.value.scrollTop = i - l), Be.value = H.value.scrollTop;
|
|
332
348
|
}
|
|
333
|
-
await
|
|
349
|
+
await z(), I.value || (o = (t = C.value) == null ? void 0 : t.querySelector('[data-active="true"]')) == null || o.scrollIntoView({ block: "nearest" });
|
|
334
350
|
}
|
|
335
351
|
}
|
|
336
352
|
function Q(e) {
|
|
337
|
-
const t =
|
|
338
|
-
if (t.length === g.value.length && t.every((
|
|
339
|
-
return;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
|
|
353
|
+
const t = et(e);
|
|
354
|
+
if (t.length === g.value.length && t.every((i, l) => n(i) === n(g.value[l])))
|
|
355
|
+
return He.value;
|
|
356
|
+
let o = e;
|
|
357
|
+
if (a.labelInValue && (Array.isArray(e) || t.length)) {
|
|
358
|
+
const i = t.map((l) => {
|
|
359
|
+
var d;
|
|
360
|
+
return {
|
|
361
|
+
value: l,
|
|
362
|
+
label: ((d = Ae(l)) == null ? void 0 : d.label) ?? String(l)
|
|
363
|
+
};
|
|
364
|
+
});
|
|
365
|
+
o = Array.isArray(e) ? i : i[0];
|
|
366
|
+
}
|
|
367
|
+
a.modelValue === void 0 && (_e.value = o);
|
|
368
|
+
const u = t.flatMap((i) => {
|
|
369
|
+
const l = Ae(i);
|
|
370
|
+
return l ? [l] : [];
|
|
344
371
|
});
|
|
345
|
-
p("update:modelValue",
|
|
372
|
+
return p("update:modelValue", o), p("change", o, O.value ? u : u[0]), o;
|
|
346
373
|
}
|
|
347
|
-
function
|
|
374
|
+
function ct() {
|
|
348
375
|
const e = document.activeElement;
|
|
349
|
-
|
|
350
|
-
var t,
|
|
351
|
-
e && ((t = C.value) != null && t.contains(e)) && e.disabled && ((
|
|
376
|
+
z(() => {
|
|
377
|
+
var t, o;
|
|
378
|
+
e && ((t = C.value) != null && t.contains(e)) && e.disabled && ((o = ft()[0] ?? m.value) == null || o.focus());
|
|
352
379
|
});
|
|
353
380
|
}
|
|
354
|
-
function
|
|
355
|
-
if (!
|
|
356
|
-
const e = [...g.value], t = [],
|
|
357
|
-
for (const
|
|
358
|
-
const
|
|
359
|
-
if (!
|
|
360
|
-
if (e.length >=
|
|
361
|
-
|
|
381
|
+
function dt() {
|
|
382
|
+
if (!O.value || Me.value) return 0;
|
|
383
|
+
const e = [...g.value], t = [], o = new Set(j.value), u = a.multipleLimit > 0 ? a.multipleLimit : 1 / 0;
|
|
384
|
+
for (const l of Ke.value) {
|
|
385
|
+
const d = n(l.value);
|
|
386
|
+
if (!o.has(d)) {
|
|
387
|
+
if (e.length >= u) break;
|
|
388
|
+
o.add(d), e.push(l.value), t.push(l);
|
|
362
389
|
}
|
|
363
390
|
}
|
|
364
|
-
|
|
391
|
+
if (!t.length) return 0;
|
|
392
|
+
const i = Q(e);
|
|
393
|
+
return ct(), p("selectAll", i, t), t.length;
|
|
365
394
|
}
|
|
366
|
-
function
|
|
367
|
-
if (!
|
|
368
|
-
const e = new Set(
|
|
395
|
+
function vt() {
|
|
396
|
+
if (!O.value || Me.value) return 0;
|
|
397
|
+
const e = new Set(ot.value.map(n));
|
|
369
398
|
if (!e.size) return 0;
|
|
370
|
-
const t = g.value.filter((
|
|
371
|
-
(
|
|
372
|
-
);
|
|
373
|
-
return
|
|
399
|
+
const t = g.value.filter((i) => !e.has(n(i))), o = g.value.filter((i) => e.has(n(i))).map(
|
|
400
|
+
(i) => Ae(i) ?? { value: i, label: String(i) }
|
|
401
|
+
), u = Q(t);
|
|
402
|
+
return ct(), p("deselectAll", u, o), e.size;
|
|
374
403
|
}
|
|
375
|
-
function
|
|
404
|
+
function ft() {
|
|
376
405
|
var e;
|
|
377
406
|
return Array.from(
|
|
378
|
-
((e = C.value) == null ? void 0 : e.querySelectorAll(
|
|
407
|
+
((e = C.value) == null ? void 0 : e.querySelectorAll(wt)) ?? []
|
|
379
408
|
).filter(
|
|
380
409
|
(t) => t.tabIndex >= 0 && t.getClientRects().length && !t.closest("[inert]")
|
|
381
410
|
);
|
|
382
411
|
}
|
|
383
|
-
function
|
|
384
|
-
var l,
|
|
385
|
-
const t =
|
|
386
|
-
if (
|
|
387
|
-
e.preventDefault(),
|
|
412
|
+
function Wt(e) {
|
|
413
|
+
var l, d;
|
|
414
|
+
const t = ft(), o = document.activeElement, u = t.indexOf(o), i = o === m.value ? e.shiftKey ? void 0 : t[0] : t[u + (e.shiftKey ? -1 : 1)];
|
|
415
|
+
if (i) {
|
|
416
|
+
e.preventDefault(), i.focus();
|
|
388
417
|
return;
|
|
389
418
|
}
|
|
390
|
-
if ((l = C.value) != null && l.contains(
|
|
419
|
+
if ((l = C.value) != null && l.contains(o)) {
|
|
391
420
|
e.preventDefault();
|
|
392
421
|
const f = Array.from(
|
|
393
|
-
document.querySelectorAll(
|
|
422
|
+
document.querySelectorAll(wt)
|
|
394
423
|
).filter(
|
|
395
|
-
(
|
|
424
|
+
(A) => {
|
|
396
425
|
var Y;
|
|
397
|
-
return !((Y = C.value) != null && Y.contains(
|
|
426
|
+
return !((Y = C.value) != null && Y.contains(A)) && A.tabIndex >= 0 && A.getClientRects().length && !A.closest("[inert]");
|
|
398
427
|
}
|
|
399
|
-
), x = f.indexOf(m.value),
|
|
400
|
-
var Y,
|
|
401
|
-
return !((
|
|
428
|
+
), x = f.indexOf(m.value), K = f.slice(x + 1).find((A) => {
|
|
429
|
+
var Y, pe;
|
|
430
|
+
return !((pe = (Y = m.value) == null ? void 0 : Y.parentElement) != null && pe.contains(A));
|
|
402
431
|
});
|
|
403
|
-
w(), (
|
|
432
|
+
w(), (d = e.shiftKey ? m.value : K ?? m.value) == null || d.focus();
|
|
404
433
|
} else w();
|
|
405
434
|
}
|
|
406
|
-
function
|
|
407
|
-
|
|
435
|
+
function ve(e) {
|
|
436
|
+
ke.value = e, a.searchValue === void 0 && (tt.value = e), p("update:searchValue", e);
|
|
408
437
|
}
|
|
409
|
-
function
|
|
410
|
-
|
|
411
|
-
|
|
438
|
+
function pt(e) {
|
|
439
|
+
N.value.has(n(e.value)) || (q.value = [...q.value, e], N.value = new Map(N.value).set(
|
|
440
|
+
n(e.value),
|
|
412
441
|
e
|
|
413
442
|
), p("create", e));
|
|
414
443
|
}
|
|
415
|
-
function
|
|
444
|
+
function ht(e) {
|
|
416
445
|
try {
|
|
417
446
|
const t = a.createOption ? a.createOption(e) : { label: e, value: e };
|
|
418
447
|
return t ? { ...t, label: String(t.label) } : void 0;
|
|
@@ -421,203 +450,203 @@ const cl = ["disabled"], dl = ["id", "tabindex", "aria-label", "aria-expanded",
|
|
|
421
450
|
return;
|
|
422
451
|
}
|
|
423
452
|
}
|
|
424
|
-
async function
|
|
425
|
-
var
|
|
453
|
+
async function yt(e) {
|
|
454
|
+
var i;
|
|
426
455
|
if (!(e != null && e.option) || J(e.option)) return;
|
|
427
456
|
let t = e.option;
|
|
428
457
|
if (e.created) {
|
|
429
|
-
const l =
|
|
458
|
+
const l = ht(t.label);
|
|
430
459
|
if (!l) return;
|
|
431
|
-
if (t =
|
|
460
|
+
if (t = N.value.get(n(l.value)) ?? l, Te.value && !j.value.has(n(t.value))) {
|
|
432
461
|
p("reject", t.value, "limit");
|
|
433
462
|
return;
|
|
434
463
|
}
|
|
435
|
-
|
|
464
|
+
pt(t);
|
|
436
465
|
}
|
|
437
|
-
const
|
|
438
|
-
if (
|
|
439
|
-
if (
|
|
440
|
-
Q(g.value.filter((l) =>
|
|
466
|
+
const o = n(t.value), u = j.value.has(o);
|
|
467
|
+
if (O.value) {
|
|
468
|
+
if (u)
|
|
469
|
+
Q(g.value.filter((l) => n(l) !== o)), p("deselect", t.value, t);
|
|
441
470
|
else {
|
|
442
|
-
if (
|
|
471
|
+
if (Te.value) {
|
|
443
472
|
p("reject", t.value, "limit");
|
|
444
473
|
return;
|
|
445
474
|
}
|
|
446
475
|
Q([...g.value, t.value]), p("select", t.value, t);
|
|
447
476
|
}
|
|
448
|
-
a.clearSearchAfterSelect &&
|
|
477
|
+
a.clearSearchAfterSelect && ve(""), await z(), y.value && ne.value && ((i = ee.value) == null || i.focus());
|
|
449
478
|
} else
|
|
450
479
|
Q(t.value), p("select", t.value, t), w(!0);
|
|
451
480
|
}
|
|
452
481
|
function Pe(e) {
|
|
453
482
|
var t;
|
|
454
|
-
b.value || a.readonly || e.disabled || !a.removable || (Q(g.value.filter((
|
|
483
|
+
b.value || a.readonly || e.disabled || !a.removable || (Q(g.value.filter((o) => n(o) !== n(e.value))), p("removeTag", e.value, e), p("deselect", e.value, e), (t = m.value) == null || t.focus());
|
|
455
484
|
}
|
|
456
|
-
function
|
|
485
|
+
function qt() {
|
|
457
486
|
var e, t;
|
|
458
|
-
b.value || a.readonly || (
|
|
487
|
+
b.value || a.readonly || (fe(), Q(O.value ? [] : typeof a.clearValue == "function" ? a.clearValue() : a.clearValue), a.clearCreatedOnClear && (q.value = []), ve(""), p("clear"), y.value && ne.value ? (e = ee.value) == null || e.focus() : (t = m.value) == null || t.focus());
|
|
459
488
|
}
|
|
460
|
-
async function
|
|
461
|
-
var
|
|
462
|
-
!U || b.value || (!a.retainSearch && !a.searchValue &&
|
|
489
|
+
async function P(e = !1, t = !1) {
|
|
490
|
+
var o;
|
|
491
|
+
!U || b.value || (!a.retainSearch && !a.searchValue && ve(""), ze(e), await Ht(t), await z(), y.value && (ne.value && ((o = ee.value) == null || o.focus()), await Z()));
|
|
463
492
|
}
|
|
464
|
-
function
|
|
465
|
-
y.value ? w() :
|
|
493
|
+
function mt() {
|
|
494
|
+
y.value ? w() : P();
|
|
466
495
|
}
|
|
467
|
-
function
|
|
468
|
-
|
|
496
|
+
function fe() {
|
|
497
|
+
de++, clearTimeout(De), De = void 0, oe == null || oe.abort(), oe = void 0, ge.value = !1;
|
|
469
498
|
}
|
|
470
499
|
function $e(e, t = !1) {
|
|
471
|
-
if (
|
|
500
|
+
if (fe(), !a.remoteMethod || !y.value || !U || b.value)
|
|
472
501
|
return;
|
|
473
|
-
const
|
|
474
|
-
oe =
|
|
475
|
-
const
|
|
502
|
+
const o = de, u = new AbortController();
|
|
503
|
+
oe = u, ge.value = !0, te.value = void 0;
|
|
504
|
+
const i = async () => {
|
|
476
505
|
try {
|
|
477
506
|
const l = await a.remoteMethod(e, {
|
|
478
|
-
signal:
|
|
507
|
+
signal: u.signal
|
|
479
508
|
});
|
|
480
|
-
if (!U ||
|
|
509
|
+
if (!U || u.signal.aborted || o !== de || !y.value)
|
|
481
510
|
return;
|
|
482
|
-
Array.isArray(l) && (
|
|
511
|
+
Array.isArray(l) && (be.value = l);
|
|
483
512
|
} catch (l) {
|
|
484
|
-
if (
|
|
485
|
-
|
|
513
|
+
if (u.signal.aborted || o !== de || !U) return;
|
|
514
|
+
te.value = l, be.value = [], p("searchError", l, e);
|
|
486
515
|
} finally {
|
|
487
|
-
|
|
516
|
+
o === de && (ge.value = !1, oe = void 0, await z(), y.value && (ze(), Oe(), Z()));
|
|
488
517
|
}
|
|
489
518
|
};
|
|
490
|
-
t || a.debounce <= 0 ?
|
|
519
|
+
t || a.debounce <= 0 ? i() : De = setTimeout(i, a.debounce);
|
|
491
520
|
}
|
|
492
|
-
function
|
|
521
|
+
function Ne() {
|
|
493
522
|
$e(k.value, !0);
|
|
494
523
|
}
|
|
495
|
-
function
|
|
524
|
+
function Dt(e) {
|
|
496
525
|
var f;
|
|
497
|
-
if (b.value || a.readonly ||
|
|
526
|
+
if (b.value || a.readonly || D.value || !O.value || !a.allowCreate || !((f = a.tokenSeparators) != null && f.length))
|
|
498
527
|
return !1;
|
|
499
|
-
let t = [e],
|
|
528
|
+
let t = [e], o = !1;
|
|
500
529
|
for (const x of a.tokenSeparators)
|
|
501
|
-
x && (t.some((
|
|
502
|
-
if (!
|
|
503
|
-
const
|
|
504
|
-
let
|
|
505
|
-
for (const x of t.map((
|
|
506
|
-
const
|
|
507
|
-
(
|
|
508
|
-
),
|
|
509
|
-
if (!
|
|
510
|
-
const Y =
|
|
511
|
-
if (!(l.has(Y) ||
|
|
512
|
-
if (a.multipleLimit > 0 &&
|
|
513
|
-
p("reject",
|
|
530
|
+
x && (t.some((K) => K.includes(x)) && (o = !0), t = t.flatMap((K) => K.split(x)));
|
|
531
|
+
if (!o) return !1;
|
|
532
|
+
const u = t.pop() ?? "", i = [...g.value], l = new Set(i.map(n));
|
|
533
|
+
let d = !1;
|
|
534
|
+
for (const x of t.map((K) => K.trim()).filter(Boolean)) {
|
|
535
|
+
const K = [...le.value, ...q.value].find(
|
|
536
|
+
(pe) => pe.label === x || n(pe.value) === n(x)
|
|
537
|
+
), A = K ?? ht(x);
|
|
538
|
+
if (!A) continue;
|
|
539
|
+
const Y = n(A.value);
|
|
540
|
+
if (!(l.has(Y) || A.disabled)) {
|
|
541
|
+
if (a.multipleLimit > 0 && i.length >= a.multipleLimit) {
|
|
542
|
+
p("reject", A.value, "limit");
|
|
514
543
|
continue;
|
|
515
544
|
}
|
|
516
|
-
|
|
545
|
+
K || pt(A), l.add(Y), i.push(A.value), d = !0, p("select", A.value, A);
|
|
517
546
|
}
|
|
518
547
|
}
|
|
519
|
-
return
|
|
548
|
+
return d && Q(i), ve(u), !0;
|
|
520
549
|
}
|
|
521
|
-
function
|
|
550
|
+
function bt(e) {
|
|
522
551
|
if (b.value) return;
|
|
523
552
|
const t = e.target.value;
|
|
524
|
-
|
|
553
|
+
ke.value = t, !xe.value && (Dt(t) || ve(t));
|
|
525
554
|
}
|
|
526
|
-
function
|
|
527
|
-
|
|
555
|
+
function Rt(e) {
|
|
556
|
+
xe.value = !1, bt(e);
|
|
528
557
|
}
|
|
529
|
-
async function
|
|
530
|
-
var
|
|
531
|
-
if (b.value || !a.keyboard || e.isComposing ||
|
|
558
|
+
async function gt(e) {
|
|
559
|
+
var u, i;
|
|
560
|
+
if (b.value || !a.keyboard || e.isComposing || xe.value || e.keyCode === 229)
|
|
532
561
|
return;
|
|
533
562
|
if (e.key === "Tab" && y.value && we.value) {
|
|
534
|
-
|
|
563
|
+
Wt(e);
|
|
535
564
|
return;
|
|
536
565
|
}
|
|
537
566
|
if (e.target.closest(
|
|
538
567
|
".hys-ui-select-tag button,.hys-ui-select-clear"
|
|
539
568
|
))
|
|
540
569
|
return;
|
|
541
|
-
const t = e.target === ee.value,
|
|
542
|
-
if (!(
|
|
570
|
+
const t = e.target === ee.value, o = e.target;
|
|
571
|
+
if (!(o !== m.value && !t && !o.matches('[role="option"]') && o.closest(
|
|
543
572
|
'button,input,textarea,select,a,[role="button"],[contenteditable="true"]'
|
|
544
573
|
))) {
|
|
545
574
|
if (["ArrowDown", "ArrowUp", "Home", "End", "PageDown", "PageUp"].includes(
|
|
546
575
|
e.key
|
|
547
576
|
)) {
|
|
548
577
|
if (e.preventDefault(), !y.value)
|
|
549
|
-
await
|
|
578
|
+
await P(e.key === "ArrowUp" || e.key === "End");
|
|
550
579
|
else {
|
|
551
|
-
const l = S.value,
|
|
552
|
-
let f = e.key === "Home" ? -1 : e.key === "End" ? l.length : l.findIndex((x) => x.key ===
|
|
580
|
+
const l = S.value, d = ["ArrowUp", "End", "PageUp"].includes(e.key) ? -1 : 1;
|
|
581
|
+
let f = e.key === "Home" ? -1 : e.key === "End" ? l.length : l.findIndex((x) => x.key === V.value);
|
|
553
582
|
e.key.startsWith("Page") && (f = Math.max(
|
|
554
583
|
-1,
|
|
555
584
|
Math.min(
|
|
556
585
|
l.length,
|
|
557
|
-
f +
|
|
586
|
+
f + d * (Math.max(1, Math.floor(se.value / R.value)) - 1)
|
|
558
587
|
)
|
|
559
588
|
));
|
|
560
589
|
for (let x = 0; x < l.length; x++)
|
|
561
|
-
if (f = (f +
|
|
562
|
-
|
|
590
|
+
if (f = (f + d + l.length) % l.length, l[f].option && !J(l[f].option)) {
|
|
591
|
+
V.value = l[f].key;
|
|
563
592
|
break;
|
|
564
593
|
}
|
|
565
594
|
}
|
|
566
595
|
await Z();
|
|
567
596
|
} else if (e.key === "Enter" || e.key === " " && !t)
|
|
568
|
-
e.preventDefault(), y.value ? await
|
|
597
|
+
e.preventDefault(), y.value ? await yt(re.value) : await P();
|
|
569
598
|
else if (e.key === "Tab")
|
|
570
|
-
w(!!((
|
|
571
|
-
else if (e.key === "Backspace" &&
|
|
572
|
-
const l = [...B.value].reverse().find((
|
|
573
|
-
l && a.removable && (e.preventDefault(), Pe(l), t && (await
|
|
599
|
+
w(!!((u = C.value) != null && u.contains(document.activeElement)));
|
|
600
|
+
else if (e.key === "Backspace" && O.value && !k.value) {
|
|
601
|
+
const l = [...B.value].reverse().find((d) => !d.disabled);
|
|
602
|
+
l && a.removable && (e.preventDefault(), Pe(l), t && (await z(), (i = ee.value) == null || i.focus()));
|
|
574
603
|
} else if (!ne.value && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
575
|
-
Le += e.key.toLocaleLowerCase(), clearTimeout(
|
|
604
|
+
Le += e.key.toLocaleLowerCase(), clearTimeout(Ve), Ve = setTimeout(() => {
|
|
576
605
|
Le = "";
|
|
577
|
-
}, 600), y.value || await
|
|
578
|
-
const l =
|
|
579
|
-
(
|
|
606
|
+
}, 600), y.value || await P();
|
|
607
|
+
const l = rt().find(
|
|
608
|
+
(d) => d.option.label.toLocaleLowerCase().startsWith(Le)
|
|
580
609
|
);
|
|
581
|
-
l && (
|
|
610
|
+
l && (V.value = l.key, await Z());
|
|
582
611
|
}
|
|
583
612
|
}
|
|
584
613
|
}
|
|
585
|
-
function
|
|
586
|
-
|
|
614
|
+
function kt(e) {
|
|
615
|
+
ce || (ce = !0, p("focus", e)), a.showOnFocus && !y.value && !jt.value && e.target === m.value && P();
|
|
587
616
|
}
|
|
588
|
-
function
|
|
589
|
-
var
|
|
617
|
+
function xt(e) {
|
|
618
|
+
var o, u;
|
|
590
619
|
const t = e.relatedTarget;
|
|
591
|
-
t && ((
|
|
592
|
-
var l,
|
|
593
|
-
const
|
|
594
|
-
|
|
620
|
+
t && ((o = m.value) != null && o.contains(t) || (u = C.value) != null && u.contains(t)) || z(() => {
|
|
621
|
+
var l, d;
|
|
622
|
+
const i = document.activeElement;
|
|
623
|
+
ce && !((l = m.value) != null && l.contains(i)) && !((d = C.value) != null && d.contains(i)) && (ce = !1, we.value && w(), p("blur", e));
|
|
595
624
|
});
|
|
596
625
|
}
|
|
597
|
-
function
|
|
626
|
+
function Pt(e) {
|
|
598
627
|
const t = e.target;
|
|
599
628
|
Be.value = t.scrollTop, p("popupScroll", e), t.scrollTop + t.clientHeight >= t.scrollHeight - 2 && p("reachEnd");
|
|
600
629
|
}
|
|
601
|
-
function
|
|
630
|
+
function Ue() {
|
|
602
631
|
G == null || G.disconnect(), G = void 0, cancelAnimationFrame(Re);
|
|
603
632
|
}
|
|
604
|
-
function
|
|
605
|
-
if (
|
|
633
|
+
function Nt() {
|
|
634
|
+
if (Ue(), !y.value || !U) return;
|
|
606
635
|
const e = () => {
|
|
607
636
|
cancelAnimationFrame(Re), Re = requestAnimationFrame(() => {
|
|
608
637
|
var t;
|
|
609
|
-
We.value = ((t = m.value) == null ? void 0 : t.clientWidth) ?? 0,
|
|
638
|
+
We.value = ((t = m.value) == null ? void 0 : t.clientWidth) ?? 0, Oe();
|
|
610
639
|
});
|
|
611
640
|
};
|
|
612
641
|
typeof ResizeObserver < "u" && (G = new ResizeObserver(e), m.value && G.observe(m.value), C.value && G.observe(C.value));
|
|
613
642
|
}
|
|
614
643
|
X(k, (e) => {
|
|
615
|
-
|
|
644
|
+
ke.value = e, V.value = void 0, Be.value = 0, H.value && (H.value.scrollTop = 0), ze(), p("search", e), $e(e), y.value && z(Z);
|
|
616
645
|
}), X(S, () => {
|
|
617
646
|
var t;
|
|
618
|
-
const e = !((t =
|
|
619
|
-
e &&
|
|
620
|
-
|
|
647
|
+
const e = !((t = re.value) != null && t.option) || J(re.value.option);
|
|
648
|
+
e && ze(), y.value && z(() => {
|
|
649
|
+
Oe(), e && Z();
|
|
621
650
|
});
|
|
622
651
|
}), X(
|
|
623
652
|
[
|
|
@@ -628,61 +657,61 @@ const cl = ["disabled"], dl = ["id", "tabindex", "aria-label", "aria-expanded",
|
|
|
628
657
|
() => a.placement
|
|
629
658
|
],
|
|
630
659
|
() => {
|
|
631
|
-
y.value &&
|
|
660
|
+
y.value && z(Oe);
|
|
632
661
|
}
|
|
633
662
|
), X(y, (e) => {
|
|
634
663
|
var t;
|
|
635
|
-
p("visibleChange", e), e ? (We.value = ((t = m.value) == null ? void 0 : t.clientWidth) ?? 0,
|
|
664
|
+
p("visibleChange", e), e ? (We.value = ((t = m.value) == null ? void 0 : t.clientWidth) ?? 0, z(Nt), $e(k.value)) : (Ue(), fe(), clearTimeout(Ve), Le = "");
|
|
636
665
|
}), X(
|
|
637
666
|
() => a.open,
|
|
638
667
|
(e) => {
|
|
639
|
-
U && (e ?
|
|
668
|
+
U && (e ? P(!1, !0) : e === !1 && w(!1, !0));
|
|
640
669
|
}
|
|
641
670
|
), X(
|
|
642
671
|
b,
|
|
643
672
|
(e) => {
|
|
644
|
-
e && (w(!1, !0),
|
|
673
|
+
e && (w(!1, !0), fe(), p("update:open", !1));
|
|
645
674
|
},
|
|
646
675
|
{ flush: "sync" }
|
|
647
676
|
), X(
|
|
648
677
|
() => a.remoteMethod,
|
|
649
678
|
() => {
|
|
650
|
-
|
|
679
|
+
be.value = void 0, te.value = void 0, y.value && $e(k.value);
|
|
651
680
|
}
|
|
652
681
|
);
|
|
653
|
-
function
|
|
654
|
-
U = !1, w(!1, !0),
|
|
682
|
+
function At() {
|
|
683
|
+
U = !1, w(!1, !0), Ue(), fe(), clearTimeout(Ve), ce = !1;
|
|
655
684
|
}
|
|
656
|
-
return
|
|
685
|
+
return Gt(() => {
|
|
657
686
|
var e;
|
|
658
|
-
|
|
659
|
-
}),
|
|
660
|
-
U = !0, a.open &&
|
|
661
|
-
}),
|
|
687
|
+
Ze(), a.autofocus && !b.value && ((e = m.value) == null || e.focus()), (a.open ?? a.defaultOpen) && P(!1, !0);
|
|
688
|
+
}), Jt(Ze), Zt(() => {
|
|
689
|
+
U = !0, a.open && P(!1, !0);
|
|
690
|
+
}), _t(At), el(At), Mt({
|
|
662
691
|
focus: () => {
|
|
663
692
|
var e;
|
|
664
693
|
b.value || (e = m.value) == null || e.focus();
|
|
665
694
|
},
|
|
666
695
|
blur: () => {
|
|
667
|
-
var t,
|
|
696
|
+
var t, o;
|
|
668
697
|
const e = document.activeElement;
|
|
669
|
-
e && ((t = m.value) != null && t.contains(e) || (
|
|
698
|
+
e && ((t = m.value) != null && t.contains(e) || (o = C.value) != null && o.contains(e)) && e.blur(), w();
|
|
670
699
|
},
|
|
671
|
-
open: () =>
|
|
700
|
+
open: () => P(),
|
|
672
701
|
close: () => w(),
|
|
673
702
|
scrollTo: (e) => {
|
|
674
|
-
|
|
703
|
+
V.value = n(e), Z();
|
|
675
704
|
},
|
|
676
|
-
retry:
|
|
677
|
-
selectAll:
|
|
678
|
-
deselectAll:
|
|
705
|
+
retry: Ne,
|
|
706
|
+
selectAll: dt,
|
|
707
|
+
deselectAll: vt,
|
|
679
708
|
selected: B,
|
|
680
709
|
query: k,
|
|
681
710
|
isOpen: y
|
|
682
711
|
}), (e, t) => {
|
|
683
|
-
var
|
|
684
|
-
return
|
|
685
|
-
class: ["hys-ui-select-wrap", [e.$attrs.class, "hys-ui-select-" +
|
|
712
|
+
var o, u, i;
|
|
713
|
+
return v(), h("div", Qe(s(Ge), {
|
|
714
|
+
class: ["hys-ui-select-wrap", [e.$attrs.class, "hys-ui-select-" + s(F)]],
|
|
686
715
|
style: e.$attrs.style
|
|
687
716
|
}), [
|
|
688
717
|
$("button", {
|
|
@@ -690,314 +719,314 @@ const cl = ["disabled"], dl = ["id", "tabindex", "aria-label", "aria-expanded",
|
|
|
690
719
|
type: "button",
|
|
691
720
|
tabindex: "-1",
|
|
692
721
|
"aria-hidden": "true",
|
|
693
|
-
disabled:
|
|
722
|
+
disabled: s(b),
|
|
694
723
|
onClick: t[0] || (t[0] = Ee((l) => {
|
|
695
|
-
var
|
|
696
|
-
(
|
|
724
|
+
var d;
|
|
725
|
+
(d = m.value) == null || d.focus(), mt();
|
|
697
726
|
}, ["prevent"]))
|
|
698
|
-
}, null, 8,
|
|
699
|
-
$("div",
|
|
727
|
+
}, null, 8, hl),
|
|
728
|
+
$("div", Qe({
|
|
700
729
|
ref_key: "trigger",
|
|
701
730
|
ref: m
|
|
702
|
-
},
|
|
731
|
+
}, Kt(), {
|
|
703
732
|
class: ["hys-ui-select", {
|
|
704
|
-
"hys-ui-select-disabled":
|
|
733
|
+
"hys-ui-select-disabled": s(b),
|
|
705
734
|
"hys-ui-select-borderless": !r.bordered,
|
|
706
735
|
"hys-ui-select-error": Ce.value === "error",
|
|
707
736
|
"hys-ui-select-warning": Ce.value === "warning",
|
|
708
737
|
"hys-ui-select-success": Ce.value === "success"
|
|
709
738
|
}],
|
|
710
|
-
id: e.$attrs.id || ((
|
|
739
|
+
id: e.$attrs.id || ((o = s(W)) == null ? void 0 : o.id.value) || void 0,
|
|
711
740
|
"data-hys-ui-field-managed": "",
|
|
712
741
|
role: "combobox",
|
|
713
|
-
tabindex:
|
|
714
|
-
"aria-label": r.ariaLabel ||
|
|
742
|
+
tabindex: s(b) ? -1 : 0,
|
|
743
|
+
"aria-label": r.ariaLabel || s(Je) || Fe.value || B.value.map((l) => l.label).join("、") || r.placeholder,
|
|
715
744
|
"aria-haspopup": "listbox",
|
|
716
|
-
"aria-expanded":
|
|
717
|
-
"aria-disabled":
|
|
745
|
+
"aria-expanded": s(y),
|
|
746
|
+
"aria-disabled": s(b) || void 0,
|
|
718
747
|
"aria-readonly": r.readonly || void 0,
|
|
719
|
-
"aria-required": ((
|
|
748
|
+
"aria-required": ((u = s(W)) == null ? void 0 : u.required.value) || void 0,
|
|
720
749
|
"aria-invalid": Ce.value === "error" || !1,
|
|
721
|
-
"aria-describedby": [e.$attrs["aria-describedby"], (
|
|
722
|
-
"aria-controls":
|
|
723
|
-
"aria-activedescendant":
|
|
724
|
-
onClick: t[1] || (t[1] = Ee((l) => !l.target.closest("button") &&
|
|
725
|
-
onKeydown:
|
|
726
|
-
onFocusin:
|
|
727
|
-
onFocusout:
|
|
750
|
+
"aria-describedby": [e.$attrs["aria-describedby"], (i = s(W)) == null ? void 0 : i.describedBy.value].filter(Boolean).join(" ") || void 0,
|
|
751
|
+
"aria-controls": s(y) ? s(ue) : void 0,
|
|
752
|
+
"aria-activedescendant": s(y) ? nt.value : void 0,
|
|
753
|
+
onClick: t[1] || (t[1] = Ee((l) => !l.target.closest("button") && mt(), ["prevent"])),
|
|
754
|
+
onKeydown: gt,
|
|
755
|
+
onFocusin: kt,
|
|
756
|
+
onFocusout: xt
|
|
728
757
|
}), [
|
|
729
|
-
$("span",
|
|
730
|
-
|
|
731
|
-
var l,
|
|
758
|
+
$("span", ml, [
|
|
759
|
+
T(e.$slots, "label", { selected: B.value }, () => {
|
|
760
|
+
var l, d;
|
|
732
761
|
return [
|
|
733
|
-
|
|
734
|
-
(
|
|
735
|
-
key: n
|
|
762
|
+
O.value && B.value.length ? (v(), h(ie, { key: 0 }, [
|
|
763
|
+
(v(!0), h(ie, null, Ye(at.value, (f) => (v(), h("span", {
|
|
764
|
+
key: s(n)(f.value),
|
|
736
765
|
class: "hys-ui-select-tag"
|
|
737
766
|
}, [
|
|
738
|
-
|
|
767
|
+
T(e.$slots, "tag", {
|
|
739
768
|
option: f,
|
|
740
769
|
remove: () => Pe(f),
|
|
741
|
-
disabled:
|
|
770
|
+
disabled: s(b) || r.readonly || f.disabled
|
|
742
771
|
}, () => [
|
|
743
772
|
$("span", {
|
|
744
773
|
class: "hys-ui-select-tag-text",
|
|
745
774
|
title: f.label
|
|
746
|
-
}, M(r.maxTagTextLength && f.label.length > r.maxTagTextLength ? f.label.slice(0, r.maxTagTextLength) + "…" : f.label), 9,
|
|
747
|
-
r.removable && !r.readonly && !f.disabled ? (
|
|
775
|
+
}, M(r.maxTagTextLength && f.label.length > r.maxTagTextLength ? f.label.slice(0, r.maxTagTextLength) + "…" : f.label), 9, bl),
|
|
776
|
+
r.removable && !r.readonly && !f.disabled ? (v(), h("button", {
|
|
748
777
|
key: 0,
|
|
749
778
|
type: "button",
|
|
750
|
-
disabled:
|
|
779
|
+
disabled: s(b),
|
|
751
780
|
"aria-label": "移除 " + f.label,
|
|
752
781
|
onClick: Ee((x) => Pe(f), ["stop"])
|
|
753
782
|
}, [
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
size:
|
|
783
|
+
T(e.$slots, "remove-icon", {}, () => [
|
|
784
|
+
ye(s(Tt), {
|
|
785
|
+
size: ae.value - 3
|
|
757
786
|
}, null, 8, ["size"])
|
|
758
787
|
], !0)
|
|
759
|
-
], 8,
|
|
788
|
+
], 8, gl)) : E("", !0)
|
|
760
789
|
], !0)
|
|
761
790
|
]))), 128)),
|
|
762
|
-
Se.value.length ? (
|
|
791
|
+
Se.value.length ? (v(), h("span", {
|
|
763
792
|
key: 0,
|
|
764
793
|
class: "hys-ui-select-tag hys-ui-select-more",
|
|
765
794
|
title: Se.value.map((f) => f.label).join("、")
|
|
766
795
|
}, [
|
|
767
|
-
|
|
796
|
+
T(e.$slots, "max-tag", { omitted: Se.value }, () => [
|
|
768
797
|
_("+" + M(Se.value.length), 1)
|
|
769
798
|
], !0)
|
|
770
|
-
], 8,
|
|
771
|
-
], 64)) : (
|
|
799
|
+
], 8, kl)) : E("", !0)
|
|
800
|
+
], 64)) : (v(), h("span", {
|
|
772
801
|
key: 1,
|
|
773
|
-
class:
|
|
802
|
+
class: St(["hys-ui-select-single-label", { "hys-ui-select-placeholder": !B.value.length }]),
|
|
774
803
|
title: (l = B.value[0]) == null ? void 0 : l.label
|
|
775
|
-
}, M(((
|
|
804
|
+
}, M(((d = B.value[0]) == null ? void 0 : d.label) ?? r.placeholder), 11, xl))
|
|
776
805
|
];
|
|
777
806
|
}, !0)
|
|
778
807
|
]),
|
|
779
|
-
r.showArrow ||
|
|
780
|
-
|
|
781
|
-
open:
|
|
782
|
-
loading:
|
|
808
|
+
r.showArrow || D.value ? (v(), h("span", Al, [
|
|
809
|
+
T(e.$slots, "suffix", {
|
|
810
|
+
open: s(y),
|
|
811
|
+
loading: D.value
|
|
783
812
|
}, () => [
|
|
784
|
-
|
|
813
|
+
D.value ? (v(), Xe(s(ol), {
|
|
785
814
|
key: 0,
|
|
786
815
|
class: "hys-ui-icon-spin",
|
|
787
|
-
size:
|
|
788
|
-
}, null, 8, ["size"])) : (
|
|
816
|
+
size: ae.value
|
|
817
|
+
}, null, 8, ["size"])) : (v(), Xe(s(il), {
|
|
789
818
|
key: 1,
|
|
790
819
|
class: "hys-ui-select-chevron",
|
|
791
|
-
size:
|
|
820
|
+
size: ae.value,
|
|
792
821
|
"aria-hidden": "true"
|
|
793
822
|
}, null, 8, ["size"]))
|
|
794
823
|
], !0)
|
|
795
824
|
])) : E("", !0)
|
|
796
|
-
], 16,
|
|
797
|
-
r.clearable && g.value.length && !
|
|
825
|
+
], 16, yl),
|
|
826
|
+
r.clearable && g.value.length && !s(b) && !r.readonly ? (v(), h("button", {
|
|
798
827
|
key: 0,
|
|
799
828
|
type: "button",
|
|
800
829
|
class: "hys-ui-select-clear",
|
|
801
830
|
"aria-label": "清空选择",
|
|
802
|
-
onClick: Ee(
|
|
831
|
+
onClick: Ee(qt, ["stop"])
|
|
803
832
|
}, [
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
size:
|
|
833
|
+
T(e.$slots, "clear-icon", {}, () => [
|
|
834
|
+
ye(s(Tt), {
|
|
835
|
+
size: ae.value - 2
|
|
807
836
|
}, null, 8, ["size"])
|
|
808
837
|
], !0)
|
|
809
838
|
])) : E("", !0),
|
|
810
|
-
r.name ? (
|
|
811
|
-
key:
|
|
839
|
+
r.name ? (v(!0), h(ie, { key: 1 }, Ye(g.value, (l, d) => (v(), h("input", {
|
|
840
|
+
key: d,
|
|
812
841
|
type: "hidden",
|
|
813
842
|
name: r.name,
|
|
814
|
-
value: String(typeof l == "object" ?
|
|
815
|
-
disabled:
|
|
816
|
-
}, null, 8,
|
|
817
|
-
(
|
|
843
|
+
value: String(typeof l == "object" ? s(cl)(l, r.valueKey) ?? "" : l),
|
|
844
|
+
disabled: s(b)
|
|
845
|
+
}, null, 8, Sl))), 128)) : E("", !0),
|
|
846
|
+
(v(), Xe(tl, {
|
|
818
847
|
to: r.appendTo === !1 ? "body" : r.appendTo,
|
|
819
848
|
disabled: r.appendTo === !1
|
|
820
849
|
}, [
|
|
821
|
-
|
|
850
|
+
ye(s(al), {
|
|
822
851
|
"popup-transition": a.popupTransition,
|
|
823
852
|
"popup-transition-duration": a.popupTransitionDuration,
|
|
824
|
-
placement:
|
|
853
|
+
placement: s(st)
|
|
825
854
|
}, {
|
|
826
|
-
default:
|
|
827
|
-
|
|
855
|
+
default: ll(() => [
|
|
856
|
+
s(y) ? (v(), h("div", Qe({
|
|
828
857
|
key: 0,
|
|
829
858
|
ref_key: "panel",
|
|
830
859
|
ref: C
|
|
831
|
-
},
|
|
832
|
-
class: ["hys-ui-select-options hys-ui-floating-surface", ["hys-ui-select-popup-" +
|
|
833
|
-
"data-size":
|
|
834
|
-
"data-placement":
|
|
835
|
-
style:
|
|
836
|
-
onKeydown:
|
|
837
|
-
onFocusin:
|
|
838
|
-
onFocusout:
|
|
860
|
+
}, s(Ge), {
|
|
861
|
+
class: ["hys-ui-select-options hys-ui-floating-surface", ["hys-ui-select-popup-" + s(F), r.popupClass]],
|
|
862
|
+
"data-size": s(F),
|
|
863
|
+
"data-placement": s(st),
|
|
864
|
+
style: It.value,
|
|
865
|
+
onKeydown: gt,
|
|
866
|
+
onFocusin: kt,
|
|
867
|
+
onFocusout: xt
|
|
839
868
|
}), [
|
|
840
|
-
e.$slots.header ? (
|
|
841
|
-
|
|
869
|
+
e.$slots.header ? (v(), h("div", Cl, [
|
|
870
|
+
T(e.$slots, "header", {
|
|
842
871
|
query: k.value,
|
|
843
872
|
selected: B.value,
|
|
844
|
-
close: () =>
|
|
873
|
+
close: () => s(w)()
|
|
845
874
|
}, void 0, !0)
|
|
846
875
|
])) : E("", !0),
|
|
847
|
-
ne.value ? (
|
|
876
|
+
ne.value ? (v(), h("input", {
|
|
848
877
|
key: 1,
|
|
849
878
|
ref_key: "searchInput",
|
|
850
879
|
ref: ee,
|
|
851
|
-
value:
|
|
880
|
+
value: ke.value,
|
|
852
881
|
class: "hys-ui-select-search",
|
|
853
882
|
placeholder: "搜索选项…",
|
|
854
883
|
"aria-label": "搜索选项",
|
|
855
|
-
"aria-controls":
|
|
856
|
-
"aria-activedescendant":
|
|
884
|
+
"aria-controls": s(ue),
|
|
885
|
+
"aria-activedescendant": nt.value,
|
|
857
886
|
"aria-autocomplete": "list",
|
|
858
|
-
onInput:
|
|
859
|
-
onCompositionstart: t[2] || (t[2] = (l) =>
|
|
860
|
-
onCompositionend:
|
|
861
|
-
}, null, 40,
|
|
862
|
-
we.value ? (
|
|
887
|
+
onInput: bt,
|
|
888
|
+
onCompositionstart: t[2] || (t[2] = (l) => xe.value = !0),
|
|
889
|
+
onCompositionend: Rt
|
|
890
|
+
}, null, 40, wl)) : E("", !0),
|
|
891
|
+
we.value ? (v(), h("div", Ml, [
|
|
863
892
|
$("span", {
|
|
864
893
|
class: "hys-ui-select-bulk-count",
|
|
865
894
|
"aria-live": "polite",
|
|
866
895
|
title: r.selectAllScope === "filtered" ? "批量操作仅作用于当前结果;禁用项保持不变" : "批量操作所有已加载选项;禁用项保持不变"
|
|
867
|
-
}, M(r.selectAllScope === "filtered" && k.value ? "当前结果 · " : "") + "已选 " + M(g.value.length) + M(r.multipleLimit > 0 ? " / " + r.multipleLimit : ""), 9,
|
|
896
|
+
}, M(r.selectAllScope === "filtered" && k.value ? "当前结果 · " : "") + "已选 " + M(g.value.length) + M(r.multipleLimit > 0 ? " / " + r.multipleLimit : ""), 9, Bl),
|
|
868
897
|
$("button", {
|
|
869
898
|
type: "button",
|
|
870
899
|
class: "hys-ui-select-bulk-action",
|
|
871
|
-
disabled: Me.value || !
|
|
900
|
+
disabled: Me.value || !zt.value || Te.value,
|
|
872
901
|
"aria-label": r.selectAllText + (r.selectAllScope === "filtered" ? "当前结果" : "全部选项"),
|
|
873
|
-
onClick:
|
|
874
|
-
}, M(r.selectAllText), 9,
|
|
902
|
+
onClick: dt
|
|
903
|
+
}, M(r.selectAllText), 9, Vl),
|
|
875
904
|
$("button", {
|
|
876
905
|
type: "button",
|
|
877
906
|
class: "hys-ui-select-bulk-action",
|
|
878
|
-
disabled: Me.value || !
|
|
907
|
+
disabled: Me.value || !ot.value.length,
|
|
879
908
|
"aria-label": r.deselectAllText + (r.selectAllScope === "filtered" ? "当前结果" : "全部选项"),
|
|
880
|
-
onClick:
|
|
881
|
-
}, M(r.deselectAllText), 9,
|
|
909
|
+
onClick: vt
|
|
910
|
+
}, M(r.deselectAllText), 9, Ll)
|
|
882
911
|
])) : E("", !0),
|
|
883
912
|
$("div", {
|
|
884
|
-
id:
|
|
913
|
+
id: s(ue),
|
|
885
914
|
ref_key: "viewport",
|
|
886
915
|
ref: H,
|
|
887
916
|
role: "listbox",
|
|
888
|
-
"aria-label": r.ariaLabel ||
|
|
889
|
-
"aria-multiselectable":
|
|
890
|
-
"aria-busy":
|
|
917
|
+
"aria-label": r.ariaLabel || s(Je) || "可选项",
|
|
918
|
+
"aria-multiselectable": O.value || void 0,
|
|
919
|
+
"aria-busy": D.value || void 0,
|
|
891
920
|
class: "hys-ui-select-list",
|
|
892
|
-
style:
|
|
893
|
-
maxHeight: "min(" +
|
|
921
|
+
style: me({
|
|
922
|
+
maxHeight: "min(" + se.value + "px, 45dvh)"
|
|
894
923
|
}),
|
|
895
|
-
onScroll:
|
|
924
|
+
onScroll: Pt
|
|
896
925
|
}, [
|
|
897
|
-
|
|
898
|
-
|
|
926
|
+
D.value ? (v(), h("p", zl, [
|
|
927
|
+
T(e.$slots, "loading", {}, () => [
|
|
899
928
|
_(M(r.loadingText), 1)
|
|
900
929
|
], !0)
|
|
901
|
-
])) :
|
|
902
|
-
|
|
903
|
-
error:
|
|
904
|
-
retry:
|
|
930
|
+
])) : te.value ? (v(), h("div", $l, [
|
|
931
|
+
T(e.$slots, "error", {
|
|
932
|
+
error: te.value,
|
|
933
|
+
retry: Ne
|
|
905
934
|
}, () => [
|
|
906
935
|
t[3] || (t[3] = _("加载失败,", -1)),
|
|
907
936
|
$("button", {
|
|
908
937
|
type: "button",
|
|
909
938
|
class: "hys-ui-select-retry",
|
|
910
|
-
onClick:
|
|
939
|
+
onClick: Ne
|
|
911
940
|
}, " 重试 ")
|
|
912
941
|
], !0)
|
|
913
|
-
])) : S.value.length ? (
|
|
942
|
+
])) : S.value.length ? (v(), h("div", {
|
|
914
943
|
key: 2,
|
|
915
|
-
style:
|
|
916
|
-
|
|
917
|
-
height: S.value.length *
|
|
944
|
+
style: me(
|
|
945
|
+
I.value ? {
|
|
946
|
+
height: S.value.length * R.value + "px",
|
|
918
947
|
position: "relative"
|
|
919
948
|
} : void 0
|
|
920
949
|
),
|
|
921
950
|
role: "presentation"
|
|
922
951
|
}, [
|
|
923
952
|
$("div", {
|
|
924
|
-
style:
|
|
925
|
-
|
|
953
|
+
style: me(
|
|
954
|
+
I.value ? {
|
|
926
955
|
position: "absolute",
|
|
927
956
|
top: 0,
|
|
928
957
|
left: 0,
|
|
929
958
|
right: 0,
|
|
930
|
-
transform: "translateY(" + qe.value *
|
|
959
|
+
transform: "translateY(" + qe.value * R.value + "px)"
|
|
931
960
|
} : void 0
|
|
932
961
|
),
|
|
933
962
|
role: "presentation"
|
|
934
963
|
}, [
|
|
935
|
-
(
|
|
964
|
+
(v(!0), h(ie, null, Ye(ut.value, (l) => (v(), h(ie, {
|
|
936
965
|
key: l.key
|
|
937
966
|
}, [
|
|
938
|
-
l.option ? (
|
|
967
|
+
l.option ? (v(), h("button", {
|
|
939
968
|
key: 1,
|
|
940
|
-
id:
|
|
969
|
+
id: s(ue) + "-" + l.index,
|
|
941
970
|
type: "button",
|
|
942
971
|
role: "option",
|
|
943
972
|
tabindex: "-1",
|
|
944
|
-
class:
|
|
973
|
+
class: St(["hys-ui-select-option", {
|
|
945
974
|
"hys-ui-selected": j.value.has(
|
|
946
|
-
n
|
|
975
|
+
s(n)(l.option.value)
|
|
947
976
|
),
|
|
948
|
-
"hys-ui-active":
|
|
977
|
+
"hys-ui-active": V.value === l.key && !J(l.option),
|
|
949
978
|
"hys-ui-select-created": l.created
|
|
950
979
|
}]),
|
|
951
|
-
style:
|
|
952
|
-
|
|
980
|
+
style: me(
|
|
981
|
+
I.value ? {
|
|
953
982
|
height: "calc(var(--hys-ui-select-stride) - var(--hys-ui-select-option-gap))",
|
|
954
983
|
minHeight: 0
|
|
955
984
|
} : void 0
|
|
956
985
|
),
|
|
957
|
-
"data-active":
|
|
986
|
+
"data-active": V.value === l.key,
|
|
958
987
|
"aria-label": l.created ? "创建 " + l.option.label : l.option.label,
|
|
959
988
|
"aria-description": l.group,
|
|
960
|
-
"aria-selected": j.value.has(n
|
|
961
|
-
"aria-setsize":
|
|
989
|
+
"aria-selected": j.value.has(s(n)(l.option.value)),
|
|
990
|
+
"aria-setsize": $t.value,
|
|
962
991
|
"aria-posinset": l.index + 1,
|
|
963
992
|
disabled: J(l.option),
|
|
964
|
-
onPointerenter: (
|
|
965
|
-
onClick: (
|
|
993
|
+
onPointerenter: (d) => !J(l.option) && (V.value = l.key),
|
|
994
|
+
onClick: (d) => yt(l)
|
|
966
995
|
}, [
|
|
967
996
|
$("span", {
|
|
968
997
|
class: "hys-ui-select-option-label",
|
|
969
998
|
title: l.option.label
|
|
970
999
|
}, [
|
|
971
|
-
|
|
1000
|
+
T(e.$slots, "option", {
|
|
972
1001
|
option: l.option,
|
|
973
|
-
selected: j.value.has(n
|
|
1002
|
+
selected: j.value.has(s(n)(l.option.value)),
|
|
974
1003
|
created: !!l.created
|
|
975
1004
|
}, () => [
|
|
976
|
-
l.created ? (
|
|
977
|
-
|
|
1005
|
+
l.created ? (v(), h("span", Hl, [
|
|
1006
|
+
ye(s(ul), { size: ae.value }, null, 8, ["size"]),
|
|
978
1007
|
_("创建 " + M(l.option.label), 1)
|
|
979
|
-
])) : (
|
|
1008
|
+
])) : (v(), h(ie, { key: 1 }, [
|
|
980
1009
|
_(M(l.option.label), 1)
|
|
981
1010
|
], 64))
|
|
982
1011
|
], !0)
|
|
983
|
-
], 8,
|
|
984
|
-
r.showCheckmark && j.value.has(n
|
|
1012
|
+
], 8, Fl),
|
|
1013
|
+
r.showCheckmark && j.value.has(s(n)(l.option.value)) ? T(e.$slots, "selected-icon", {
|
|
985
1014
|
option: l.option
|
|
986
1015
|
}, () => [
|
|
987
|
-
|
|
988
|
-
size:
|
|
1016
|
+
ye(s(nl), {
|
|
1017
|
+
size: ae.value - 1,
|
|
989
1018
|
"aria-hidden": "true"
|
|
990
1019
|
}, null, 8, ["size"])
|
|
991
1020
|
], !0, 0) : E("", !0)
|
|
992
|
-
], 46,
|
|
1021
|
+
], 46, El)) : (v(), h("div", {
|
|
993
1022
|
key: 0,
|
|
994
1023
|
class: "hys-ui-select-group",
|
|
995
|
-
style:
|
|
996
|
-
|
|
1024
|
+
style: me(
|
|
1025
|
+
I.value ? { height: R.value + "px" } : void 0
|
|
997
1026
|
),
|
|
998
1027
|
role: "presentation"
|
|
999
1028
|
}, [
|
|
1000
|
-
|
|
1029
|
+
T(e.$slots, "group", {
|
|
1001
1030
|
label: l.group
|
|
1002
1031
|
}, () => [
|
|
1003
1032
|
_(M(l.group), 1)
|
|
@@ -1005,20 +1034,20 @@ const cl = ["disabled"], dl = ["id", "tabindex", "aria-label", "aria-expanded",
|
|
|
1005
1034
|
], 4))
|
|
1006
1035
|
], 64))), 128))
|
|
1007
1036
|
], 4)
|
|
1008
|
-
], 4)) : (
|
|
1009
|
-
|
|
1037
|
+
], 4)) : (v(), h("p", jl, [
|
|
1038
|
+
T(e.$slots, "empty", { query: k.value }, () => [
|
|
1010
1039
|
_(M(k.value ? r.noMatchText : r.emptyText), 1)
|
|
1011
1040
|
], !0)
|
|
1012
1041
|
]))
|
|
1013
|
-
], 44,
|
|
1014
|
-
e.$slots.footer ? (
|
|
1015
|
-
|
|
1042
|
+
], 44, Ol),
|
|
1043
|
+
e.$slots.footer ? (v(), h("div", Il, [
|
|
1044
|
+
T(e.$slots, "footer", {
|
|
1016
1045
|
query: k.value,
|
|
1017
1046
|
selected: B.value,
|
|
1018
|
-
close: () =>
|
|
1047
|
+
close: () => s(w)()
|
|
1019
1048
|
}, void 0, !0)
|
|
1020
1049
|
])) : E("", !0)
|
|
1021
|
-
], 16,
|
|
1050
|
+
], 16, Tl)) : E("", !0)
|
|
1022
1051
|
]),
|
|
1023
1052
|
_: 3
|
|
1024
1053
|
}, 8, ["popup-transition", "popup-transition-duration", "placement"])
|
|
@@ -1028,5 +1057,5 @@ const cl = ["disabled"], dl = ["id", "tabindex", "aria-label", "aria-expanded",
|
|
|
1028
1057
|
}
|
|
1029
1058
|
});
|
|
1030
1059
|
export {
|
|
1031
|
-
|
|
1060
|
+
Ul as default
|
|
1032
1061
|
};
|