morya-ui 0.3.1 → 0.3.2
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 +32 -0
- package/dist/Button-dMqRmoYa.js +222 -0
- package/dist/{Card-Dsmnzong.js → Card-B1CB9Trm.js} +3 -5
- package/dist/Empty-C5tndBOm.js +147 -0
- package/dist/Pagination-CqpC5EAs.js +166 -0
- package/dist/Select-CKGrSoaC.js +572 -0
- package/dist/Skeleton-DCYdXAH2.js +59 -0
- package/dist/accordion/style.css +16 -71
- package/dist/auto-complete/index.js +117 -119
- package/dist/auto-complete/style.css +6 -82
- package/dist/avatar/style.css +6 -67
- package/dist/badge/style.css +6 -68
- package/dist/block-ui/style.css +6 -68
- package/dist/breadcrumb/style.css +6 -61
- package/dist/button/index.js +1 -1
- package/dist/button/style.css +68 -78
- package/dist/card/index.js +1 -1
- package/dist/card/style.css +26 -67
- package/dist/carousel/style.css +6 -73
- package/dist/cascade-select/style.css +6 -75
- package/dist/checkbox/style.css +6 -61
- package/dist/chip/style.css +6 -67
- package/dist/command-menu/index.js +36 -38
- package/dist/command-menu/style.css +6 -75
- package/dist/components/Accordion/styles.css +10 -10
- package/dist/components/AutoComplete/AutoComplete.vue.d.ts.map +1 -1
- package/dist/components/AutoComplete/styles.css +0 -7
- package/dist/components/Badge/styles.css +0 -7
- package/dist/components/BlockUI/styles.css +0 -7
- package/dist/components/Button/Button.vue.d.ts +2 -0
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Button/styles.css +62 -11
- package/dist/components/Button/types.d.ts +4 -0
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/Card/Card.vue.d.ts +2 -2
- package/dist/components/Card/Card.vue.d.ts.map +1 -1
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Card/index.d.ts.map +1 -1
- package/dist/components/Card/styles.css +20 -6
- package/dist/components/Card/types.d.ts +4 -2
- package/dist/components/Card/types.d.ts.map +1 -1
- package/dist/components/Carousel/styles.css +0 -6
- package/dist/components/CommandMenu/CommandMenu.vue.d.ts.map +1 -1
- package/dist/components/ConfigProvider/ConfigProvider.vue.d.ts +2 -2
- package/dist/components/Dialog/styles.css +3 -46
- package/dist/components/Dock/styles.css +0 -10
- package/dist/components/Drawer/styles.css +2 -51
- package/dist/components/Fieldset/styles.css +0 -7
- package/dist/components/FileUpload/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/FileUpload/fileUtils.d.ts +8 -0
- package/dist/components/FileUpload/fileUtils.d.ts.map +1 -0
- package/dist/components/Gallery/styles.css +0 -8
- package/dist/components/Icon/styles.css +0 -6
- package/dist/components/Knob/styles.css +0 -6
- package/dist/components/Layout/styles.css +0 -12
- package/dist/components/Listbox/Listbox.vue.d.ts.map +1 -1
- package/dist/components/Loading/styles.css +0 -16
- package/dist/components/Menu/Menu.vue.d.ts.map +1 -1
- package/dist/components/Menu/styles.css +0 -7
- package/dist/components/Message/styles.css +0 -13
- package/dist/components/Page/PageContent.vue.d.ts +2 -1
- package/dist/components/Page/PageContent.vue.d.ts.map +1 -1
- package/dist/components/Page/PageFilterChips.vue.d.ts +16 -0
- package/dist/components/Page/PageFilterChips.vue.d.ts.map +1 -0
- package/dist/components/Page/PageFilters.vue.d.ts +15 -3
- package/dist/components/Page/PageFilters.vue.d.ts.map +1 -1
- package/dist/components/Page/PageHeader.vue.d.ts +8 -4
- package/dist/components/Page/PageHeader.vue.d.ts.map +1 -1
- package/dist/components/Page/PagePlaceholder.vue.d.ts +6 -2
- package/dist/components/Page/PagePlaceholder.vue.d.ts.map +1 -1
- package/dist/components/Page/PageSection.vue.d.ts +8 -2
- package/dist/components/Page/PageSection.vue.d.ts.map +1 -1
- package/dist/components/Page/PageStat.vue.d.ts +8 -3
- package/dist/components/Page/PageStat.vue.d.ts.map +1 -1
- package/dist/components/Page/index.d.ts +2 -1
- package/dist/components/Page/index.d.ts.map +1 -1
- package/dist/components/Page/styles.css +239 -44
- package/dist/components/Page/types.d.ts +40 -0
- package/dist/components/Page/types.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.vue.d.ts.map +1 -1
- package/dist/components/Pagination/styles.css +7 -10
- package/dist/components/Pagination/types.d.ts +1 -1
- package/dist/components/Pagination/types.d.ts.map +1 -1
- package/dist/components/Panel/styles.css +0 -7
- package/dist/components/Popover/styles.css +20 -17
- package/dist/components/ProgressBar/styles.css +0 -9
- package/dist/components/ProgressSpinner/styles.css +0 -7
- package/dist/components/ScrollTop/styles.css +0 -7
- package/dist/components/Scrollbar/styles.css +0 -8
- package/dist/components/Select/Select.vue.d.ts +1 -3
- package/dist/components/Select/Select.vue.d.ts.map +1 -1
- package/dist/components/Select/selectOptions.d.ts +46 -0
- package/dist/components/Select/selectOptions.d.ts.map +1 -0
- package/dist/components/Select/styles.css +5 -7
- package/dist/components/Sidebar/styles.css +0 -6
- package/dist/components/Skeleton/styles.css +0 -6
- package/dist/components/Status/styles.css +0 -7
- package/dist/components/Switch/styles.css +0 -7
- package/dist/components/Table/hooks/useExpandableRow.d.ts.map +1 -1
- package/dist/components/Table/hooks/useTotalItems.d.ts.map +1 -1
- package/dist/components/Table/styles.css +7 -10
- package/dist/components/Table/tableQuery.d.ts +30 -0
- package/dist/components/Table/tableQuery.d.ts.map +1 -0
- package/dist/components/Tree/Tree.vue.d.ts.map +1 -1
- package/dist/components/Tree/treeQuery.d.ts +31 -0
- package/dist/components/Tree/treeQuery.d.ts.map +1 -0
- package/dist/components/TreeSelect/TreeSelect.vue.d.ts.map +1 -1
- package/dist/config-provider/index.js +1 -1
- package/dist/config-provider/style.css +68 -72
- package/dist/confirm-dialog/index.js +1 -1
- package/dist/confirm-dialog/style.css +71 -124
- package/dist/confirm-popup/index.js +1 -1
- package/dist/confirm-popup/style.css +68 -78
- package/dist/context-menu/style.css +6 -75
- package/dist/data-view/index.js +1 -1
- package/dist/data-view/style.css +13 -87
- package/dist/date-picker/style.css +6 -67
- package/dist/dialog/index.js +1 -1
- package/dist/dialog/style.css +71 -124
- package/dist/divider/style.css +6 -61
- package/dist/dock/style.css +6 -77
- package/dist/drawer/style.css +8 -118
- package/dist/dropdown/style.css +6 -75
- package/dist/empty/index.js +5 -150
- package/dist/empty/style.css +6 -67
- package/dist/fieldset/style.css +6 -74
- package/dist/file-upload/index.js +147 -145
- package/dist/file-upload/style.css +6 -67
- package/dist/filterByQuery-Bczaxzih.js +17 -0
- package/dist/flex/style.css +6 -61
- package/dist/float-label/style.css +6 -61
- package/dist/fluid/style.css +6 -61
- package/dist/form/style.css +6 -61
- package/dist/gallery/style.css +6 -83
- package/dist/grid/style.css +6 -61
- package/dist/icon/style.css +6 -67
- package/dist/icon-field/style.css +6 -61
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9017 -8694
- package/dist/inplace/style.css +6 -61
- package/dist/input/style.css +6 -67
- package/dist/input-color/style.css +6 -61
- package/dist/input-group/style.css +6 -61
- package/dist/input-number/style.css +6 -67
- package/dist/input-otp/style.css +6 -61
- package/dist/input-password/style.css +6 -67
- package/dist/input-tags/style.css +6 -67
- package/dist/knob/style.css +6 -67
- package/dist/label/style.css +6 -61
- package/dist/layout/style.css +6 -87
- package/dist/listbox/index.js +30 -32
- package/dist/listbox/style.css +6 -69
- package/dist/loading/style.css +6 -77
- package/dist/mega-menu/style.css +6 -67
- package/dist/menu/index.js +263 -253
- package/dist/menu/style.css +26 -99
- package/dist/menubar/style.css +6 -75
- package/dist/message/style.css +6 -80
- package/dist/meter-group/style.css +6 -61
- package/dist/order-list/style.css +6 -67
- package/dist/page/index.js +228 -69
- package/dist/page/style.css +1182 -113
- package/dist/page/style.js +3 -0
- package/dist/pagination/index.js +1 -1
- package/dist/pagination/style.css +206 -77
- package/dist/pagination/style.js +1 -0
- package/dist/panel/style.css +6 -74
- package/dist/pick-list/style.css +6 -67
- package/dist/popover/style.css +26 -78
- package/dist/progress-bar/style.css +6 -70
- package/dist/progress-spinner/style.css +6 -68
- package/dist/radio/style.css +6 -61
- package/dist/rating/style.css +6 -67
- package/dist/resolver-map.d.ts.map +1 -1
- package/dist/resolver.js +1 -0
- package/dist/result/style.css +6 -67
- package/dist/scroll-top/style.css +6 -82
- package/dist/scrollbar/style.css +6 -69
- package/dist/select/index.js +2 -545
- package/dist/select/style.css +11 -82
- package/dist/select-button/style.css +6 -61
- package/dist/shared/config.d.ts +2 -2
- package/dist/shared/filterByQuery.d.ts +14 -0
- package/dist/shared/filterByQuery.d.ts.map +1 -0
- package/dist/shared/menu/expand.d.ts +38 -0
- package/dist/shared/menu/expand.d.ts.map +1 -0
- package/dist/shared/menu/index.d.ts +2 -0
- package/dist/shared/menu/index.d.ts.map +1 -1
- package/dist/sidebar/style.css +6 -73
- package/dist/skeleton/index.js +2 -59
- package/dist/skeleton/style.css +6 -67
- package/dist/slider/style.css +6 -61
- package/dist/space/style.css +6 -61
- package/dist/speed-dial/style.css +6 -67
- package/dist/split-button/style.css +68 -78
- package/dist/splitter/style.css +6 -61
- package/dist/status/style.css +6 -74
- package/dist/stepper/style.css +6 -67
- package/dist/styles/base.css +1 -50
- package/dist/styles.css +1 -1
- package/dist/switch/style.css +6 -68
- package/dist/table/index.js +341 -311
- package/dist/table/style.css +20 -111
- package/dist/tabs/style.css +6 -75
- package/dist/tag/style.css +6 -67
- package/dist/terminal/style.css +6 -61
- package/dist/textarea/style.css +6 -67
- package/dist/theme/styles.css +5 -11
- package/dist/theme/useMotion.d.ts +5 -1
- package/dist/theme/useMotion.d.ts.map +1 -1
- package/dist/tiered-menu/style.css +6 -75
- package/dist/timeline/style.css +6 -75
- package/dist/toast/style.css +6 -67
- package/dist/toggle-button/style.css +6 -67
- package/dist/toolbar/style.css +6 -61
- package/dist/tooltip/style.css +6 -61
- package/dist/tree/index.js +158 -172
- package/dist/tree/style.css +6 -67
- package/dist/tree-select/index.js +198 -212
- package/dist/tree-select/style.css +6 -75
- package/dist/tree-table/style.css +6 -67
- package/dist/treeQuery-CnHkyYOA.js +107 -0
- package/dist/virtual-scroller/style.css +6 -69
- package/package.json +1 -1
- package/dist/Button-smoDleh0.js +0 -156
- package/dist/Pagination-DrXmzcEy.js +0 -158
- package/dist/checkStrategy-CZzuUKDI.js +0 -63
package/dist/select/index.js
CHANGED
|
@@ -1,546 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../Icon-od9Ob-Ay.js";
|
|
3
|
-
import { t as n } from "../useMotionTransition-Bxnnb_9u.js";
|
|
4
|
-
import { n as r, t as ee } from "../overlay-oR-5MDuE.js";
|
|
5
|
-
import { t as te } from "../overlayPlacement-Cd20JTD_.js";
|
|
6
|
-
import { t as ne } from "../useFloatingViewportSync-DZdJ7W8n.js";
|
|
7
|
-
import { t as re } from "../useMId-BXFYayPP.js";
|
|
8
|
-
import { t as ie } from "../Scrollbar-DTeJ8P5b.js";
|
|
9
|
-
import { t as ae } from "../VirtualScroller-CHoFCmpP.js";
|
|
10
|
-
import { c as oe, i as se, o as ce } from "../config-CapALqt3.js";
|
|
11
|
-
import { n as le, t as ue } from "../locale-Bzm2nbEp.js";
|
|
1
|
+
import { t as e } from "../Select-CKGrSoaC.js";
|
|
12
2
|
import "./style.js";
|
|
13
|
-
|
|
14
|
-
//#region src/components/Select/Select.vue?vue&type=script&setup=true&lang.ts
|
|
15
|
-
var Te = ["for"], Ee = [
|
|
16
|
-
"id",
|
|
17
|
-
"tabindex",
|
|
18
|
-
"aria-expanded",
|
|
19
|
-
"aria-controls",
|
|
20
|
-
"aria-invalid",
|
|
21
|
-
"aria-describedby",
|
|
22
|
-
"aria-disabled",
|
|
23
|
-
"aria-busy",
|
|
24
|
-
"aria-multiselectable"
|
|
25
|
-
], De = {
|
|
26
|
-
key: 0,
|
|
27
|
-
class: "m-select__tags"
|
|
28
|
-
}, Oe = { class: "m-select__tag-label" }, ke = [
|
|
29
|
-
"aria-label",
|
|
30
|
-
"disabled",
|
|
31
|
-
"onClick"
|
|
32
|
-
], Ae = ["aria-label"], je = {
|
|
33
|
-
key: 1,
|
|
34
|
-
class: "m-select__value"
|
|
35
|
-
}, Me = {
|
|
36
|
-
key: 2,
|
|
37
|
-
class: "m-select__spinner",
|
|
38
|
-
"aria-hidden": "true"
|
|
39
|
-
}, Ne = { class: "m-select__suffix" }, Pe = ["aria-label"], Fe = [
|
|
40
|
-
"id",
|
|
41
|
-
"aria-multiselectable",
|
|
42
|
-
"aria-label"
|
|
43
|
-
], Ie = {
|
|
44
|
-
key: 0,
|
|
45
|
-
class: "m-select__header"
|
|
46
|
-
}, Le = ["placeholder", "aria-label"], Re = {
|
|
47
|
-
key: 0,
|
|
48
|
-
class: "m-select__group-label",
|
|
49
|
-
role: "presentation"
|
|
50
|
-
}, ze = [
|
|
51
|
-
"aria-selected",
|
|
52
|
-
"disabled",
|
|
53
|
-
"onMouseenter",
|
|
54
|
-
"onClick"
|
|
55
|
-
], Be = {
|
|
56
|
-
key: 0,
|
|
57
|
-
class: "m-select__empty",
|
|
58
|
-
role: "status"
|
|
59
|
-
}, Ve = {
|
|
60
|
-
key: 0,
|
|
61
|
-
class: "m-select__group-label",
|
|
62
|
-
role: "presentation"
|
|
63
|
-
}, He = [
|
|
64
|
-
"aria-selected",
|
|
65
|
-
"disabled",
|
|
66
|
-
"onMouseenter",
|
|
67
|
-
"onClick"
|
|
68
|
-
], Ue = {
|
|
69
|
-
key: 1,
|
|
70
|
-
class: "m-select__empty",
|
|
71
|
-
role: "status"
|
|
72
|
-
}, We = {
|
|
73
|
-
key: 4,
|
|
74
|
-
class: "m-select__empty",
|
|
75
|
-
role: "status"
|
|
76
|
-
}, Ge = {
|
|
77
|
-
key: 5,
|
|
78
|
-
class: "m-select__empty",
|
|
79
|
-
role: "status"
|
|
80
|
-
}, Ke = {
|
|
81
|
-
key: 6,
|
|
82
|
-
class: "m-select__footer"
|
|
83
|
-
}, qe = [
|
|
84
|
-
"name",
|
|
85
|
-
"required",
|
|
86
|
-
"value"
|
|
87
|
-
], Je = ["id", "role"], Ye = 80, Xe = /* @__PURE__ */ d({
|
|
88
|
-
inheritAttrs: !1,
|
|
89
|
-
__name: "Select",
|
|
90
|
-
props: {
|
|
91
|
-
modelValue: { default: void 0 },
|
|
92
|
-
options: {},
|
|
93
|
-
label: {},
|
|
94
|
-
helpText: {},
|
|
95
|
-
invalid: {
|
|
96
|
-
type: Boolean,
|
|
97
|
-
default: !1
|
|
98
|
-
},
|
|
99
|
-
errorMessage: {},
|
|
100
|
-
id: {},
|
|
101
|
-
disabled: {
|
|
102
|
-
type: Boolean,
|
|
103
|
-
default: !1
|
|
104
|
-
},
|
|
105
|
-
required: {
|
|
106
|
-
type: Boolean,
|
|
107
|
-
default: !1
|
|
108
|
-
},
|
|
109
|
-
size: {},
|
|
110
|
-
fluid: {
|
|
111
|
-
type: Boolean,
|
|
112
|
-
default: void 0
|
|
113
|
-
},
|
|
114
|
-
multiple: {
|
|
115
|
-
type: Boolean,
|
|
116
|
-
default: void 0
|
|
117
|
-
},
|
|
118
|
-
tag: {
|
|
119
|
-
type: Boolean,
|
|
120
|
-
default: void 0
|
|
121
|
-
},
|
|
122
|
-
remote: {
|
|
123
|
-
type: Boolean,
|
|
124
|
-
default: void 0
|
|
125
|
-
},
|
|
126
|
-
loading: {
|
|
127
|
-
type: Boolean,
|
|
128
|
-
default: void 0
|
|
129
|
-
},
|
|
130
|
-
maxTagCount: {},
|
|
131
|
-
showClear: {
|
|
132
|
-
type: Boolean,
|
|
133
|
-
default: void 0
|
|
134
|
-
},
|
|
135
|
-
clearable: {
|
|
136
|
-
type: Boolean,
|
|
137
|
-
default: void 0
|
|
138
|
-
},
|
|
139
|
-
emptyMessage: {},
|
|
140
|
-
filter: {
|
|
141
|
-
type: Boolean,
|
|
142
|
-
default: void 0
|
|
143
|
-
},
|
|
144
|
-
teleport: {
|
|
145
|
-
type: Boolean,
|
|
146
|
-
default: !0
|
|
147
|
-
},
|
|
148
|
-
appendTo: {},
|
|
149
|
-
placement: { default: "bottom-start" },
|
|
150
|
-
pt: {},
|
|
151
|
-
transition: {
|
|
152
|
-
type: [String, Boolean],
|
|
153
|
-
default: void 0
|
|
154
|
-
},
|
|
155
|
-
virtual: {
|
|
156
|
-
type: Boolean,
|
|
157
|
-
default: void 0
|
|
158
|
-
},
|
|
159
|
-
placeholder: {},
|
|
160
|
-
name: {}
|
|
161
|
-
},
|
|
162
|
-
emits: [
|
|
163
|
-
"update:modelValue",
|
|
164
|
-
"change",
|
|
165
|
-
"clear",
|
|
166
|
-
"show",
|
|
167
|
-
"hide",
|
|
168
|
-
"search",
|
|
169
|
-
"create"
|
|
170
|
-
],
|
|
171
|
-
setup(d, { emit: Xe }) {
|
|
172
|
-
let y = d, b = Xe;
|
|
173
|
-
function x(e) {
|
|
174
|
-
return Array.isArray(e.items);
|
|
175
|
-
}
|
|
176
|
-
let Ze = be(), Qe = ye(), { rootAttrs: $e, controlAttrs: et } = e(Qe, () => y.pt, { controlKey: "control" }), S = se("Select"), tt = oe(), { transitionName: nt, transitionCss: rt } = n({
|
|
177
|
-
role: "popup",
|
|
178
|
-
local: () => y.transition,
|
|
179
|
-
componentName: "Select",
|
|
180
|
-
fallback: "scale-fade"
|
|
181
|
-
}), C = le(), it = m(null), w = m(null), T = m(null), E = m(null), D = m(!1), O = m(""), k = m(-1), at = m({}), A = m([]), ot = re("m-select"), j = a(() => y.id ?? ot), st = a(() => y.emptyMessage ?? C.value.emptyOptions), M = a(() => y.multiple ?? S.value.multiple ?? !1), ct = a(() => y.tag ?? S.value.tag ?? !1), N = a(() => y.remote ?? S.value.remote ?? !1), P = a(() => y.loading ?? !1), lt = a(() => y.fluid ?? S.value.fluid ?? !1), ut = a(() => y.showClear ?? y.clearable ?? S.value.showClear ?? S.value.clearable ?? !1), F = a(() => y.filter ?? S.value.filter ?? !1), I = ce("Select", () => y.size), dt = a(() => r(y, tt.value.appendTo)), L = a(() => ee(y, tt.value.appendTo)), R = a(() => y.invalid || !!y.errorMessage), z = a(() => y.errorMessage || y.helpText), ft = a(() => !!y.errorMessage || R.value && !!y.helpText), B = a(() => M.value ? Array.isArray(y.modelValue) ? y.modelValue : y.modelValue == null ? [] : [y.modelValue] : y.modelValue == null || Array.isArray(y.modelValue) ? [] : [y.modelValue]), V = a(() => y.options.flatMap((e) => x(e) ? e.items : [e])), pt = a(() => {
|
|
182
|
-
let e = new Set(V.value.map((e) => String(e.value))), t = [];
|
|
183
|
-
for (let n of A.value) e.has(String(n.value)) || (t.push(n), e.add(String(n.value)));
|
|
184
|
-
for (let n of B.value) e.has(String(n)) || (t.push({
|
|
185
|
-
label: String(n),
|
|
186
|
-
value: n
|
|
187
|
-
}), e.add(String(n)));
|
|
188
|
-
return [...V.value, ...t];
|
|
189
|
-
});
|
|
190
|
-
function mt(e) {
|
|
191
|
-
return pt.value.find((t) => t.value === e);
|
|
192
|
-
}
|
|
193
|
-
let H = a(() => B.value.map((e) => mt(e) ?? {
|
|
194
|
-
label: String(e),
|
|
195
|
-
value: e
|
|
196
|
-
})), ht = a(() => {
|
|
197
|
-
let e = H.value;
|
|
198
|
-
return y.maxTagCount == null || e.length <= y.maxTagCount ? e : e.slice(0, y.maxTagCount);
|
|
199
|
-
}), gt = a(() => Math.max(0, H.value.length - ht.value.length)), _t = a(() => M.value ? void 0 : H.value[0]), vt = a(() => _t.value?.label ?? y.placeholder ?? C.value.selectPlaceholder), U = a(() => B.value.length > 0), yt = a(() => ut.value && U.value && !y.disabled), W = a(() => O.value.trim()), bt = a(() => !ct.value || !F.value || !W.value ? !1 : !pt.value.some((e) => e.label.toLowerCase() === W.value.toLowerCase() || String(e.value) === W.value)), xt = a(() => {
|
|
200
|
-
if (N.value) return y.options;
|
|
201
|
-
let e = new Set(V.value.map((e) => String(e.value))), t = [];
|
|
202
|
-
for (let n of A.value) e.has(String(n.value)) || (t.push(n), e.add(String(n.value)));
|
|
203
|
-
for (let n of B.value) e.has(String(n)) || (t.push({
|
|
204
|
-
label: String(n),
|
|
205
|
-
value: n
|
|
206
|
-
}), e.add(String(n)));
|
|
207
|
-
let n = [...y.options, ...t], r = W.value.toLowerCase();
|
|
208
|
-
return r ? n.flatMap((e) => {
|
|
209
|
-
if (x(e)) {
|
|
210
|
-
let t = e.items.filter((e) => e.label.toLowerCase().includes(r));
|
|
211
|
-
return t.length ? [{
|
|
212
|
-
...e,
|
|
213
|
-
items: t
|
|
214
|
-
}] : [];
|
|
215
|
-
}
|
|
216
|
-
return e.label.toLowerCase().includes(r) ? [e] : [];
|
|
217
|
-
}) : n;
|
|
218
|
-
}), G = a(() => {
|
|
219
|
-
let e = [];
|
|
220
|
-
return bt.value && e.push({
|
|
221
|
-
type: "option",
|
|
222
|
-
option: {
|
|
223
|
-
label: W.value,
|
|
224
|
-
value: W.value,
|
|
225
|
-
created: !0
|
|
226
|
-
},
|
|
227
|
-
key: `__create:${W.value}`
|
|
228
|
-
}), xt.value.forEach((t, n) => {
|
|
229
|
-
if (x(t)) {
|
|
230
|
-
e.push({
|
|
231
|
-
type: "group",
|
|
232
|
-
label: t.label,
|
|
233
|
-
key: `__group:${n}:${t.label}`
|
|
234
|
-
});
|
|
235
|
-
for (let n of t.items) e.push({
|
|
236
|
-
type: "option",
|
|
237
|
-
option: n,
|
|
238
|
-
key: String(n.value)
|
|
239
|
-
});
|
|
240
|
-
} else e.push({
|
|
241
|
-
type: "option",
|
|
242
|
-
option: t,
|
|
243
|
-
key: String(t.value)
|
|
244
|
-
});
|
|
245
|
-
}), e;
|
|
246
|
-
}), K = a(() => G.value.flatMap((e) => e.type === "option" ? [e.option] : [])), q = a(() => K.value.filter((e) => !e.disabled)), St = a(() => ue(C.value.createOption, { value: W.value })), Ct = a(() => ue(C.value.moreTags, { count: gt.value })), J = a(() => y.virtual === !1 ? !1 : y.virtual === !0 || G.value.length >= Ye), wt = a(() => I.value === "small" ? 28 : I.value === "large" ? 40 : 34), Tt = a(() => Math.min(240, Math.max(wt.value * 4, G.value.length * wt.value))), Et = m(null);
|
|
247
|
-
function Dt(e) {
|
|
248
|
-
return e;
|
|
249
|
-
}
|
|
250
|
-
function Ot(e) {
|
|
251
|
-
return e.label;
|
|
252
|
-
}
|
|
253
|
-
function Y(e) {
|
|
254
|
-
return e.option;
|
|
255
|
-
}
|
|
256
|
-
function X(e) {
|
|
257
|
-
return B.value.some((t) => t === e);
|
|
258
|
-
}
|
|
259
|
-
function Z(e) {
|
|
260
|
-
b("update:modelValue", e), b("change", e);
|
|
261
|
-
}
|
|
262
|
-
function kt() {
|
|
263
|
-
if (!L.value || !w.value) return;
|
|
264
|
-
let e = w.value.getBoundingClientRect();
|
|
265
|
-
at.value = te(e, y.placement === "bottom-end" ? "bottom-end" : "bottom-start", { minWidth: `${e.width}px` });
|
|
266
|
-
}
|
|
267
|
-
function Q(e, t = "none") {
|
|
268
|
-
if (!(y.disabled || D.value === e)) {
|
|
269
|
-
if (D.value = e, e) {
|
|
270
|
-
if (O.value = "", t === "none") k.value = -1;
|
|
271
|
-
else if (t === "last") k.value = Math.max(0, q.value.length - 1);
|
|
272
|
-
else {
|
|
273
|
-
let e = q.value.findIndex((e) => !e.created && X(e.value));
|
|
274
|
-
k.value = e >= 0 ? e : q.value.length ? 0 : -1;
|
|
275
|
-
}
|
|
276
|
-
b("show"), he(() => {
|
|
277
|
-
kt(), F.value ? E.value?.focus({ preventScroll: !0 }) : T.value?.focus({ preventScroll: !0 });
|
|
278
|
-
});
|
|
279
|
-
} else O.value = "", b("hide");
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
function $(e) {
|
|
283
|
-
if (!e.disabled) {
|
|
284
|
-
if (e.created) {
|
|
285
|
-
At();
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
if (M.value) {
|
|
289
|
-
Z(X(e.value) ? B.value.filter((t) => t !== e.value) : [...B.value, e.value]);
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
Z(e.value), Q(!1), w.value?.focus({ preventScroll: !0 });
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
function At() {
|
|
296
|
-
let e = W.value;
|
|
297
|
-
if (!e || !bt.value) return;
|
|
298
|
-
let t = {
|
|
299
|
-
label: e,
|
|
300
|
-
value: e
|
|
301
|
-
};
|
|
302
|
-
A.value.some((e) => e.value === t.value) || (A.value = [...A.value, t]), b("create", t), $({ ...t }), O.value = "";
|
|
303
|
-
}
|
|
304
|
-
function jt(e, t) {
|
|
305
|
-
t.stopPropagation(), t.preventDefault(), !(y.disabled || !M.value) && Z(B.value.filter((t) => t !== e));
|
|
306
|
-
}
|
|
307
|
-
function Mt(e) {
|
|
308
|
-
e?.stopPropagation(), e?.preventDefault(), !(y.disabled || !U.value) && (Z(M.value ? [] : void 0), b("clear"), w.value?.focus({ preventScroll: !0 }));
|
|
309
|
-
}
|
|
310
|
-
function Nt(e) {
|
|
311
|
-
y.disabled || [
|
|
312
|
-
"Enter",
|
|
313
|
-
" ",
|
|
314
|
-
"ArrowDown",
|
|
315
|
-
"ArrowUp"
|
|
316
|
-
].includes(e.key) && (e.preventDefault(), D.value || Q(!0, e.key === "ArrowUp" ? "last" : "selected"));
|
|
317
|
-
}
|
|
318
|
-
function Pt(e) {
|
|
319
|
-
if (e.key === "Escape") {
|
|
320
|
-
e.preventDefault(), Q(!1), w.value?.focus({ preventScroll: !0 });
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
let t = q.value.length;
|
|
324
|
-
if (t && ((e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), k.value < 0 ? k.value = e.key === "ArrowDown" ? 0 : t - 1 : k.value = (k.value + (e.key === "ArrowDown" ? 1 : -1) + t) % t), e.key === "Home" && (e.preventDefault(), k.value = 0), e.key === "End" && (e.preventDefault(), k.value = t - 1), e.key === "Enter" || e.key === " " && e.target !== E.value)) {
|
|
325
|
-
let t = q.value[k.value];
|
|
326
|
-
t && (e.preventDefault(), $(t));
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
function Ft(e) {
|
|
330
|
-
D.value && !it.value?.contains(e.target) && !T.value?.contains(e.target) && Q(!1);
|
|
331
|
-
}
|
|
332
|
-
function It() {
|
|
333
|
-
D.value && kt();
|
|
334
|
-
}
|
|
335
|
-
return ne(() => D.value && L.value, It), Se(k, (e) => {
|
|
336
|
-
if (!J.value || e < 0) return;
|
|
337
|
-
let t = q.value[e];
|
|
338
|
-
if (!t) return;
|
|
339
|
-
let n = G.value.findIndex((e) => e.type === "option" && e.option.value === t.value && !!e.option.created == !!t.created);
|
|
340
|
-
n >= 0 && Et.value?.scrollToIndex(n);
|
|
341
|
-
}), Se(O, (e) => {
|
|
342
|
-
k.value = q.value.length ? 0 : -1, D.value && (F.value || N.value) && b("search", e);
|
|
343
|
-
}), Se(D, (e) => {
|
|
344
|
-
e && N.value && b("search", O.value), e ? document.addEventListener("click", Ft) : document.removeEventListener("click", Ft);
|
|
345
|
-
}), _e(() => {
|
|
346
|
-
document.removeEventListener("click", Ft);
|
|
347
|
-
}), (e, n) => (p(), c("div", me({
|
|
348
|
-
ref_key: "root",
|
|
349
|
-
ref: it
|
|
350
|
-
}, _($e), { class: ["m-select-field", { "m-select-field--fluid": lt.value }] }), [
|
|
351
|
-
d.label ? (p(), c("label", {
|
|
352
|
-
key: 0,
|
|
353
|
-
class: "m-select-field__label",
|
|
354
|
-
for: j.value
|
|
355
|
-
}, g(d.label), 9, Te)) : s("", !0),
|
|
356
|
-
l("div", { class: f(["m-select__control", {
|
|
357
|
-
"m-select__control--clearable": yt.value,
|
|
358
|
-
"m-select__control--open": D.value
|
|
359
|
-
}]) }, [l("div", me(_(et), {
|
|
360
|
-
id: j.value,
|
|
361
|
-
ref_key: "trigger",
|
|
362
|
-
ref: w,
|
|
363
|
-
class: ["m-select", [`m-select--${_(I)}`, {
|
|
364
|
-
"m-select--invalid": R.value,
|
|
365
|
-
"m-select--open": D.value,
|
|
366
|
-
"m-select--placeholder": !U.value,
|
|
367
|
-
"m-select--fluid": lt.value,
|
|
368
|
-
"m-select--multiple": M.value,
|
|
369
|
-
"m-select--disabled": d.disabled,
|
|
370
|
-
"m-select--loading": P.value
|
|
371
|
-
}]],
|
|
372
|
-
role: "combobox",
|
|
373
|
-
tabindex: d.disabled ? -1 : 0,
|
|
374
|
-
"aria-expanded": D.value,
|
|
375
|
-
"aria-haspopup": "listbox",
|
|
376
|
-
"aria-controls": `${j.value}-listbox`,
|
|
377
|
-
"aria-invalid": R.value || void 0,
|
|
378
|
-
"aria-describedby": z.value ? `${j.value}-help` : void 0,
|
|
379
|
-
"aria-disabled": d.disabled || void 0,
|
|
380
|
-
"aria-busy": P.value || void 0,
|
|
381
|
-
"aria-multiselectable": M.value || void 0,
|
|
382
|
-
onClick: n[0] ||= (e) => Q(!D.value),
|
|
383
|
-
onKeydown: Nt
|
|
384
|
-
}), [M.value && U.value ? (p(), c("div", De, [(p(!0), c(i, null, ve(ht.value, (e) => (p(), c("span", {
|
|
385
|
-
key: String(e.value),
|
|
386
|
-
class: "m-select__tag"
|
|
387
|
-
}, [l("span", Oe, g(e.label), 1), l("button", {
|
|
388
|
-
class: "m-select__tag-remove",
|
|
389
|
-
type: "button",
|
|
390
|
-
"aria-label": _(C).removeTag,
|
|
391
|
-
disabled: d.disabled,
|
|
392
|
-
onClick: (t) => jt(e.value, t)
|
|
393
|
-
}, [u(t, {
|
|
394
|
-
name: "close",
|
|
395
|
-
size: "sm"
|
|
396
|
-
})], 8, ke)]))), 128)), gt.value ? (p(), c("span", {
|
|
397
|
-
key: 0,
|
|
398
|
-
class: "m-select__tag m-select__tag--more",
|
|
399
|
-
"aria-label": Ct.value
|
|
400
|
-
}, " +" + g(gt.value), 9, Ae)) : s("", !0)])) : (p(), c("span", je, [_(Ze).value && U.value && _t.value ? h(e.$slots, "value", { option: _t.value }, void 0, void 0, 0) : (p(), c(i, { key: 1 }, [pe(g(vt.value), 1)], 64))])), P.value ? (p(), c("span", Me)) : s("", !0)], 16, Ee), l("div", Ne, [yt.value ? (p(), c("button", {
|
|
401
|
-
key: 0,
|
|
402
|
-
class: "m-select__clear",
|
|
403
|
-
type: "button",
|
|
404
|
-
"aria-label": _(C).clear,
|
|
405
|
-
onClick: Mt
|
|
406
|
-
}, [u(t, {
|
|
407
|
-
name: "close",
|
|
408
|
-
class: "m-control-affix-icon"
|
|
409
|
-
})], 8, Pe)) : s("", !0), l("span", {
|
|
410
|
-
class: f(["m-select__indicator", { "m-select__indicator--open": D.value }]),
|
|
411
|
-
"aria-hidden": "true"
|
|
412
|
-
}, [u(t, {
|
|
413
|
-
name: "chevron-down",
|
|
414
|
-
class: "m-control-affix-icon"
|
|
415
|
-
})], 2)])], 2),
|
|
416
|
-
(p(), o(de, {
|
|
417
|
-
to: dt.value.to,
|
|
418
|
-
disabled: dt.value.disabled
|
|
419
|
-
}, [u(fe, {
|
|
420
|
-
name: _(nt),
|
|
421
|
-
css: _(rt)
|
|
422
|
-
}, {
|
|
423
|
-
default: v(() => [D.value ? (p(), c("div", {
|
|
424
|
-
key: 0,
|
|
425
|
-
id: `${j.value}-listbox`,
|
|
426
|
-
ref_key: "menu",
|
|
427
|
-
ref: T,
|
|
428
|
-
class: f(["m-select__menu", [`m-select__menu--${d.placement}`, { "m-select__menu--teleported": L.value }]]),
|
|
429
|
-
style: ge(L.value ? at.value : void 0),
|
|
430
|
-
role: "listbox",
|
|
431
|
-
tabindex: "-1",
|
|
432
|
-
"aria-multiselectable": M.value || void 0,
|
|
433
|
-
"aria-label": d.label ?? d.placeholder ?? _(C).selectOption,
|
|
434
|
-
onKeydown: Pt
|
|
435
|
-
}, [
|
|
436
|
-
e.$slots.header ? (p(), c("div", Ie, [h(e.$slots, "header")])) : s("", !0),
|
|
437
|
-
F.value ? Ce((p(), c("input", {
|
|
438
|
-
key: 1,
|
|
439
|
-
ref_key: "filterInput",
|
|
440
|
-
ref: E,
|
|
441
|
-
"onUpdate:modelValue": n[1] ||= (e) => O.value = e,
|
|
442
|
-
class: "m-select__filter",
|
|
443
|
-
type: "search",
|
|
444
|
-
size: "1",
|
|
445
|
-
placeholder: _(C).searchPlaceholder,
|
|
446
|
-
"aria-label": _(C).filterOptions,
|
|
447
|
-
onClick: n[2] ||= we(() => {}, ["stop"]),
|
|
448
|
-
onKeydown: we(Pt, ["stop"])
|
|
449
|
-
}, null, 40, Le)), [[xe, O.value]]) : s("", !0),
|
|
450
|
-
J.value && !P.value && K.value.length ? (p(), o(ae, {
|
|
451
|
-
key: 2,
|
|
452
|
-
id: `${j.value}-listbox`,
|
|
453
|
-
ref_key: "virtualList",
|
|
454
|
-
ref: Et,
|
|
455
|
-
class: "m-select__list m-select__list--virtual",
|
|
456
|
-
role: "listbox",
|
|
457
|
-
"aria-label": d.label ?? d.placeholder ?? _(C).selectOption,
|
|
458
|
-
items: G.value,
|
|
459
|
-
"item-size": wt.value,
|
|
460
|
-
height: Tt.value,
|
|
461
|
-
buffer: 4
|
|
462
|
-
}, {
|
|
463
|
-
item: v(({ item: n }) => [Dt(n).type === "group" ? (p(), c("div", Re, g(Ot(n)), 1)) : (p(), c("button", {
|
|
464
|
-
key: 1,
|
|
465
|
-
class: f(["m-select__option", {
|
|
466
|
-
"m-select__option--selected": !Y(n).created && X(Y(n).value),
|
|
467
|
-
"m-select__option--highlighted": q.value[k.value]?.value === Y(n).value && !!q.value[k.value]?.created == !!Y(n).created,
|
|
468
|
-
"m-select__option--create": Y(n).created
|
|
469
|
-
}]),
|
|
470
|
-
type: "button",
|
|
471
|
-
role: "option",
|
|
472
|
-
"aria-selected": Y(n).created ? void 0 : X(Y(n).value),
|
|
473
|
-
disabled: Y(n).disabled,
|
|
474
|
-
onMouseenter: (e) => !Y(n).disabled && (k.value = q.value.findIndex((e) => e.value === Y(n).value && !!e.created == !!Y(n).created)),
|
|
475
|
-
onClick: (e) => $(Y(n))
|
|
476
|
-
}, [h(e.$slots, "option", { option: Y(n) }, () => [l("span", null, g(Y(n).created ? St.value : Y(n).label), 1)]), !Y(n).created && X(Y(n).value) ? (p(), o(t, {
|
|
477
|
-
key: 0,
|
|
478
|
-
class: "m-select__check",
|
|
479
|
-
name: "check",
|
|
480
|
-
size: "sm"
|
|
481
|
-
})) : s("", !0)], 42, ze))]),
|
|
482
|
-
_: 3
|
|
483
|
-
}, 8, [
|
|
484
|
-
"id",
|
|
485
|
-
"aria-label",
|
|
486
|
-
"items",
|
|
487
|
-
"item-size",
|
|
488
|
-
"height"
|
|
489
|
-
])) : (p(), o(ie, {
|
|
490
|
-
key: 3,
|
|
491
|
-
id: `${j.value}-listbox`,
|
|
492
|
-
class: "m-select__list",
|
|
493
|
-
"fit-content": "",
|
|
494
|
-
"wrap-class": "m-select__list-wrap",
|
|
495
|
-
"view-class": "m-select__list-view"
|
|
496
|
-
}, {
|
|
497
|
-
default: v(() => [
|
|
498
|
-
P.value ? (p(), c("div", Be, g(_(C).loading), 1)) : s("", !0),
|
|
499
|
-
(p(!0), c(i, null, ve(G.value, (n) => (p(), c(i, { key: n.key }, [n.type === "group" ? (p(), c("div", Ve, g(n.label), 1)) : (p(), c("button", {
|
|
500
|
-
key: 1,
|
|
501
|
-
class: f(["m-select__option", {
|
|
502
|
-
"m-select__option--selected": !n.option.created && X(n.option.value),
|
|
503
|
-
"m-select__option--highlighted": q.value[k.value]?.value === n.option.value && !!q.value[k.value]?.created == !!n.option.created,
|
|
504
|
-
"m-select__option--create": n.option.created
|
|
505
|
-
}]),
|
|
506
|
-
type: "button",
|
|
507
|
-
role: "option",
|
|
508
|
-
"aria-selected": n.option.created ? void 0 : X(n.option.value),
|
|
509
|
-
disabled: n.option.disabled,
|
|
510
|
-
onMouseenter: (e) => !n.option.disabled && (k.value = q.value.findIndex((e) => e.value === n.option.value && !!e.created == !!n.option.created)),
|
|
511
|
-
onClick: (e) => $(n.option)
|
|
512
|
-
}, [h(e.$slots, "option", { option: n.option }, () => [l("span", null, g(n.option.created ? St.value : n.option.label), 1)]), !n.option.created && X(n.option.value) ? (p(), o(t, {
|
|
513
|
-
key: 0,
|
|
514
|
-
class: "m-select__check",
|
|
515
|
-
name: "check",
|
|
516
|
-
size: "sm"
|
|
517
|
-
})) : s("", !0)], 42, He))], 64))), 128)),
|
|
518
|
-
!K.value.length && !P.value ? (p(), c("div", Ue, g(st.value), 1)) : s("", !0)
|
|
519
|
-
]),
|
|
520
|
-
_: 3
|
|
521
|
-
}, 8, ["id"])),
|
|
522
|
-
J.value && P.value ? (p(), c("div", We, g(_(C).loading), 1)) : J.value && !K.value.length && !P.value ? (p(), c("div", Ge, g(st.value), 1)) : s("", !0),
|
|
523
|
-
e.$slots.footer ? (p(), c("div", Ke, [h(e.$slots, "footer")])) : s("", !0)
|
|
524
|
-
], 46, Fe)) : s("", !0)]),
|
|
525
|
-
_: 3
|
|
526
|
-
}, 8, ["name", "css"])], 8, ["to", "disabled"])),
|
|
527
|
-
d.required ? (p(), c("input", {
|
|
528
|
-
key: 1,
|
|
529
|
-
class: "m-select__required-input",
|
|
530
|
-
tabindex: "-1",
|
|
531
|
-
"aria-hidden": "true",
|
|
532
|
-
name: d.name,
|
|
533
|
-
required: !U.value,
|
|
534
|
-
value: M.value ? B.value.join(",") : B.value[0]
|
|
535
|
-
}, null, 8, qe)) : s("", !0),
|
|
536
|
-
z.value ? (p(), c("span", {
|
|
537
|
-
key: 2,
|
|
538
|
-
id: `${j.value}-help`,
|
|
539
|
-
class: f(["m-select-field__help", { "m-select-field__help--invalid": ft.value }]),
|
|
540
|
-
role: ft.value ? "alert" : void 0
|
|
541
|
-
}, g(z.value), 11, Je)) : s("", !0)
|
|
542
|
-
], 16));
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
|
-
//#endregion
|
|
546
|
-
export { Xe as MSelect };
|
|
3
|
+
export { e as MSelect };
|