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