energy-components 1.0.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/LICENSE +21 -0
- package/README.md +94 -0
- package/dist/.empty +0 -0
- package/dist/components/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/components/accordion.es.js +121 -0
- package/dist/components/accordionGroup.es.js +32 -0
- package/dist/components/actionButton.es.js +64 -0
- package/dist/components/breadcrumbs.es.js +90 -0
- package/dist/components/button.es.js +144 -0
- package/dist/components/checkbox.es.js +130 -0
- package/dist/components/divider.es.js +35 -0
- package/dist/components/dropdown.es.js +331 -0
- package/dist/components/floatingActionButton.es.js +97 -0
- package/dist/components/functions-DIHwdgF0.js +18 -0
- package/dist/components/icon-svg-Cpx09myr.js +10818 -0
- package/dist/components/iconList.es.js +49 -0
- package/dist/components/iconSvg.es.js +5 -0
- package/dist/components/index.es.js +81 -0
- package/dist/components/indicator.es.js +175 -0
- package/dist/components/link.es.js +147 -0
- package/dist/components/multiselect.es.js +1039 -0
- package/dist/components/pagination.es.js +138 -0
- package/dist/components/radioButton.es.js +111 -0
- package/dist/components/style/accordion.css +1 -0
- package/dist/components/style/accordionGroup.css +1 -0
- package/dist/components/style/actionButton.css +1 -0
- package/dist/components/style/breadcrumbs.css +1 -0
- package/dist/components/style/button.css +1 -0
- package/dist/components/style/checkbox.css +1 -0
- package/dist/components/style/divider.css +1 -0
- package/dist/components/style/dropdown.css +1 -0
- package/dist/components/style/floatingActionButton.css +1 -0
- package/dist/components/style/icon-svg.css +1 -0
- package/dist/components/style/iconList.css +1 -0
- package/dist/components/style/indicator.css +1 -0
- package/dist/components/style/link.css +1 -0
- package/dist/components/style/multiselect.css +1 -0
- package/dist/components/style/pagination.css +1 -0
- package/dist/components/style/radioButton.css +1 -0
- package/dist/components/style/switch.css +1 -0
- package/dist/components/style/tabBar.css +1 -0
- package/dist/components/style/tag.css +1 -0
- package/dist/components/style/textArea.css +1 -0
- package/dist/components/style/textField.css +1 -0
- package/dist/components/style/tooltip.css +1 -0
- package/dist/components/switch.es.js +96 -0
- package/dist/components/tabBar.es.js +181 -0
- package/dist/components/tag.es.js +91 -0
- package/dist/components/textArea.es.js +259 -0
- package/dist/components/textField.es.js +254 -0
- package/dist/components/tooltip.es.js +1082 -0
- package/dist/energy-components.es.js +15368 -0
- package/dist/energy-components.umd.js +1 -0
- package/dist/style.css +1 -0
- package/dist/types/src/components/buttons/action-button/action-button.vue.d.ts +100 -0
- package/dist/types/src/components/buttons/button/button.vue.d.ts +196 -0
- package/dist/types/src/components/buttons/constants/buttonDocs.d.ts +1 -0
- package/dist/types/src/components/buttons/constants/buttonPosition.d.ts +1 -0
- package/dist/types/src/components/buttons/constants/socialMedia.d.ts +1 -0
- package/dist/types/src/components/buttons/floating-action-button/floating-action-button.vue.d.ts +136 -0
- package/dist/types/src/components/content/accordion/accordion.vue.d.ts +122 -0
- package/dist/types/src/components/content/acordion-group/accordion-group.d.ts +6 -0
- package/dist/types/src/components/content/acordion-group/accordion-group.vue.d.ts +33 -0
- package/dist/types/src/components/content/divider/divider.vue.d.ts +35 -0
- package/dist/types/src/components/content/tag/tag.vue.d.ts +105 -0
- package/dist/types/src/components/feedback/indicator/indicator.vue.d.ts +100 -0
- package/dist/types/src/components/icon-svg/icon-list.d.ts +11 -0
- package/dist/types/src/components/icon-svg/icon-list.vue.d.ts +2 -0
- package/dist/types/src/components/icon-svg/icon-svg.vue.d.ts +68 -0
- package/dist/types/src/components/index.d.ts +20 -0
- package/dist/types/src/components/input/checkbox/checkbox.vue.d.ts +151 -0
- package/dist/types/src/components/input/dropdown/Multiselect/Multiselect.vue.d.ts +2 -0
- package/dist/types/src/components/input/dropdown/dropdown.vue.d.ts +270 -0
- package/dist/types/src/components/input/radio-button/radio-button.vue.d.ts +114 -0
- package/dist/types/src/components/input/switch/switch.vue.d.ts +104 -0
- package/dist/types/src/components/input/text-area/text-area.vue.d.ts +281 -0
- package/dist/types/src/components/input/text-field/text-field.vue.d.ts +271 -0
- package/dist/types/src/components/navigation/breadcrumbs/breadcrumbs.vue.d.ts +63 -0
- package/dist/types/src/components/navigation/link/link.types.d.ts +15 -0
- package/dist/types/src/components/navigation/link/link.vue.d.ts +175 -0
- package/dist/types/src/components/navigation/pagination/pagination.vue.d.ts +67 -0
- package/dist/types/src/components/navigation/tab-bar/tab-bar.vue.d.ts +132 -0
- package/dist/types/src/components/overlay/tooltip/tooltip.vue.d.ts +118 -0
- package/dist/types/src/helpers/functions.d.ts +3 -0
- package/dist/types/src/helpers/stories.helpers.d.ts +1 -0
- package/dist/types/src/helpers/validation.d.ts +1 -0
- package/dist/types/src/index.d.ts +8 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +156 -0
|
@@ -0,0 +1,1039 @@
|
|
|
1
|
+
import { openBlock as d, createElementBlock as p, normalizeClass as V, withKeys as f, withModifiers as r, renderSlot as u, createElementVNode as o, withDirectives as b, Fragment as L, renderList as $, toDisplayString as g, vShow as y, createCommentVNode as c, createVNode as B, Transition as k, withCtx as D, normalizeStyle as S, createTextVNode as v } from "vue";
|
|
2
|
+
import { _ as A } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
3
|
+
import './style/multiselect.css';function O(e) {
|
|
4
|
+
return e === 0 ? !1 : Array.isArray(e) && e.length === 0 ? !0 : !e;
|
|
5
|
+
}
|
|
6
|
+
function M(e) {
|
|
7
|
+
return (...t) => !e(...t);
|
|
8
|
+
}
|
|
9
|
+
function P(e, t) {
|
|
10
|
+
return e === void 0 && (e = "undefined"), e === null && (e = "null"), e === !1 && (e = "false"), e.toString().toLowerCase().indexOf(t.trim()) !== -1;
|
|
11
|
+
}
|
|
12
|
+
function T(e, t, i, l) {
|
|
13
|
+
return t ? e.filter((a) => P(l(a, i), t)).sort((a, n) => l(a, i).length - l(n, i).length) : e;
|
|
14
|
+
}
|
|
15
|
+
function H(e) {
|
|
16
|
+
return e.filter((t) => !t.$isLabel);
|
|
17
|
+
}
|
|
18
|
+
function w(e, t) {
|
|
19
|
+
return (i) => i.reduce((l, a) => a[e] && a[e].length ? (l.push({
|
|
20
|
+
$groupLabel: a[t],
|
|
21
|
+
$isLabel: !0
|
|
22
|
+
}), l.concat(a[e])) : l, []);
|
|
23
|
+
}
|
|
24
|
+
function G(e, t, i, l, a) {
|
|
25
|
+
return (n) => n.map((s) => {
|
|
26
|
+
if (!s[i])
|
|
27
|
+
return console.warn("Options passed to vue-multiselect do not contain groups, despite the config."), [];
|
|
28
|
+
const h = T(s[i], e, t, a);
|
|
29
|
+
return h.length ? {
|
|
30
|
+
[l]: s[l],
|
|
31
|
+
[i]: h
|
|
32
|
+
} : [];
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const E = (...e) => (t) => e.reduce((i, l) => l(i), t), C = {
|
|
36
|
+
data() {
|
|
37
|
+
return {
|
|
38
|
+
search: "",
|
|
39
|
+
isOpen: !1,
|
|
40
|
+
preferredOpenDirection: "below",
|
|
41
|
+
optimizedHeight: this.maxHeight
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
props: {
|
|
45
|
+
/**
|
|
46
|
+
* Decide whether to filter the results based on search query.
|
|
47
|
+
* Useful for async filtering, where we search through more complex data.
|
|
48
|
+
* @type {Boolean}
|
|
49
|
+
*/
|
|
50
|
+
internalSearch: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: !0
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Array of available options: Objects, Strings or Integers.
|
|
56
|
+
* If array of objects, visible label will default to option.label.
|
|
57
|
+
* If `labal` prop is passed, label will equal option['label']
|
|
58
|
+
* @type {Array}
|
|
59
|
+
*/
|
|
60
|
+
options: {
|
|
61
|
+
type: Array,
|
|
62
|
+
required: !0
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* Equivalent to the `multiple` attribute on a `<select>` input.
|
|
66
|
+
* @default false
|
|
67
|
+
* @type {Boolean}
|
|
68
|
+
*/
|
|
69
|
+
multiple: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: !1
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* Key to compare objects
|
|
75
|
+
* @default 'id'
|
|
76
|
+
* @type {String}
|
|
77
|
+
*/
|
|
78
|
+
trackBy: {
|
|
79
|
+
type: String
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* Label to look for in option Object
|
|
83
|
+
* @default 'label'
|
|
84
|
+
* @type {String}
|
|
85
|
+
*/
|
|
86
|
+
label: {
|
|
87
|
+
type: String
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* Enable/disable search in options
|
|
91
|
+
* @default true
|
|
92
|
+
* @type {Boolean}
|
|
93
|
+
*/
|
|
94
|
+
searchable: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: !0
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Clear the search input after `)
|
|
100
|
+
* @default true
|
|
101
|
+
* @type {Boolean}
|
|
102
|
+
*/
|
|
103
|
+
clearOnSelect: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: !0
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* Hide already selected options
|
|
109
|
+
* @default false
|
|
110
|
+
* @type {Boolean}
|
|
111
|
+
*/
|
|
112
|
+
hideSelected: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
default: !1
|
|
115
|
+
},
|
|
116
|
+
/**
|
|
117
|
+
* Equivalent to the `placeholder` attribute on a `<select>` input.
|
|
118
|
+
* @default 'Select option'
|
|
119
|
+
* @type {String}
|
|
120
|
+
*/
|
|
121
|
+
placeholder: {
|
|
122
|
+
type: String,
|
|
123
|
+
default: "Select option"
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* Allow to remove all selected values
|
|
127
|
+
* @default true
|
|
128
|
+
* @type {Boolean}
|
|
129
|
+
*/
|
|
130
|
+
allowEmpty: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: !0
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* Reset this.internalValue, this.search after this.internalValue changes.
|
|
136
|
+
* Useful if want to create a stateless dropdown.
|
|
137
|
+
* @default false
|
|
138
|
+
* @type {Boolean}
|
|
139
|
+
*/
|
|
140
|
+
resetAfter: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: !1
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* Enable/disable closing after selecting an option
|
|
146
|
+
* @default true
|
|
147
|
+
* @type {Boolean}
|
|
148
|
+
*/
|
|
149
|
+
closeOnSelect: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: !0
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* Function to interpolate the custom label
|
|
155
|
+
* @default false
|
|
156
|
+
* @type {Function}
|
|
157
|
+
*/
|
|
158
|
+
customLabel: {
|
|
159
|
+
type: Function,
|
|
160
|
+
default(e, t) {
|
|
161
|
+
return O(e) ? "" : t ? e[t] : e;
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
* Disable / Enable tagging
|
|
166
|
+
* @default false
|
|
167
|
+
* @type {Boolean}
|
|
168
|
+
*/
|
|
169
|
+
taggable: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
default: !1
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* String to show when highlighting a potential tag
|
|
175
|
+
* @default 'Press enter to create a tag'
|
|
176
|
+
* @type {String}
|
|
177
|
+
*/
|
|
178
|
+
tagPlaceholder: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: "Press enter to create a tag"
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* By default new tags will appear above the search results.
|
|
184
|
+
* Changing to 'bottom' will revert this behaviour
|
|
185
|
+
* and will proritize the search results
|
|
186
|
+
* @default 'top'
|
|
187
|
+
* @type {String}
|
|
188
|
+
*/
|
|
189
|
+
tagPosition: {
|
|
190
|
+
type: String,
|
|
191
|
+
default: "top"
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* Number of allowed selected options. No limit if 0.
|
|
195
|
+
* @default 0
|
|
196
|
+
* @type {Number}
|
|
197
|
+
*/
|
|
198
|
+
max: {
|
|
199
|
+
type: [Number, Boolean],
|
|
200
|
+
default: !1
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* Will be passed with all events as second param.
|
|
204
|
+
* Useful for identifying events origin.
|
|
205
|
+
* @default null
|
|
206
|
+
* @type {String|Integer}
|
|
207
|
+
*/
|
|
208
|
+
id: {
|
|
209
|
+
default: null
|
|
210
|
+
},
|
|
211
|
+
/**
|
|
212
|
+
* Limits the options displayed in the dropdown
|
|
213
|
+
* to the first X options.
|
|
214
|
+
* @default 1000
|
|
215
|
+
* @type {Integer}
|
|
216
|
+
*/
|
|
217
|
+
optionsLimit: {
|
|
218
|
+
type: Number,
|
|
219
|
+
default: 1e3
|
|
220
|
+
},
|
|
221
|
+
/**
|
|
222
|
+
* Name of the property containing
|
|
223
|
+
* the group values
|
|
224
|
+
* @default 1000
|
|
225
|
+
* @type {String}
|
|
226
|
+
*/
|
|
227
|
+
groupValues: {
|
|
228
|
+
type: String
|
|
229
|
+
},
|
|
230
|
+
/**
|
|
231
|
+
* Name of the property containing
|
|
232
|
+
* the group label
|
|
233
|
+
* @default 1000
|
|
234
|
+
* @type {String}
|
|
235
|
+
*/
|
|
236
|
+
groupLabel: {
|
|
237
|
+
type: String
|
|
238
|
+
},
|
|
239
|
+
/**
|
|
240
|
+
* Allow to select all group values
|
|
241
|
+
* by selecting the group label
|
|
242
|
+
* @default false
|
|
243
|
+
* @type {Boolean}
|
|
244
|
+
*/
|
|
245
|
+
groupSelect: {
|
|
246
|
+
type: Boolean,
|
|
247
|
+
default: !1
|
|
248
|
+
},
|
|
249
|
+
/**
|
|
250
|
+
* Array of keyboard keys to block
|
|
251
|
+
* when selecting
|
|
252
|
+
* @default 1000
|
|
253
|
+
* @type {String}
|
|
254
|
+
*/
|
|
255
|
+
blockKeys: {
|
|
256
|
+
type: Array,
|
|
257
|
+
default() {
|
|
258
|
+
return [];
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
/**
|
|
262
|
+
* Prevent from wiping up the search value
|
|
263
|
+
* @default false
|
|
264
|
+
* @type {Boolean}
|
|
265
|
+
*/
|
|
266
|
+
preserveSearch: {
|
|
267
|
+
type: Boolean,
|
|
268
|
+
default: !1
|
|
269
|
+
},
|
|
270
|
+
/**
|
|
271
|
+
* Select 1st options if value is empty
|
|
272
|
+
* @default false
|
|
273
|
+
* @type {Boolean}
|
|
274
|
+
*/
|
|
275
|
+
preselectFirst: {
|
|
276
|
+
type: Boolean,
|
|
277
|
+
default: !1
|
|
278
|
+
},
|
|
279
|
+
/**
|
|
280
|
+
* Prevent autofocus
|
|
281
|
+
* @default false
|
|
282
|
+
* @type {Boolean}
|
|
283
|
+
*/
|
|
284
|
+
preventAutofocus: {
|
|
285
|
+
type: Boolean,
|
|
286
|
+
default: !1
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
mounted() {
|
|
290
|
+
!this.multiple && this.max && console.warn("[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false."), this.preselectFirst && !this.internalValue.length && this.options.length && this.select(this.filteredOptions[0]);
|
|
291
|
+
},
|
|
292
|
+
computed: {
|
|
293
|
+
internalValue() {
|
|
294
|
+
return this.modelValue || this.modelValue === 0 ? Array.isArray(this.modelValue) ? this.modelValue : [this.modelValue] : [];
|
|
295
|
+
},
|
|
296
|
+
filteredOptions() {
|
|
297
|
+
const e = this.search || "", t = e.toLowerCase().trim();
|
|
298
|
+
let i = this.options.concat();
|
|
299
|
+
return this.internalSearch ? i = this.groupValues ? this.filterAndFlat(i, t, this.label) : T(i, t, this.label, this.customLabel) : i = this.groupValues ? w(this.groupValues, this.groupLabel)(i) : i, i = this.hideSelected ? i.filter(M(this.isSelected)) : i, this.taggable && t.length && !this.isExistingOption(t) && (this.tagPosition === "bottom" ? i.push({ isTag: !0, label: e }) : i.unshift({ isTag: !0, label: e })), i.slice(0, this.optionsLimit);
|
|
300
|
+
},
|
|
301
|
+
valueKeys() {
|
|
302
|
+
return this.trackBy ? this.internalValue.map((e) => e[this.trackBy]) : this.internalValue;
|
|
303
|
+
},
|
|
304
|
+
optionKeys() {
|
|
305
|
+
return (this.groupValues ? this.flatAndStrip(this.options) : this.options).map((t) => this.customLabel(t, this.label).toString().toLowerCase());
|
|
306
|
+
},
|
|
307
|
+
currentOptionLabel() {
|
|
308
|
+
return this.multiple ? this.searchable ? "" : this.placeholder : this.internalValue.length ? this.getOptionLabel(this.internalValue[0]) : this.searchable ? "" : this.placeholder;
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
watch: {
|
|
312
|
+
internalValue: {
|
|
313
|
+
handler() {
|
|
314
|
+
this.resetAfter && this.internalValue.length && (this.search = "", this.$emit("update:modelValue", this.multiple ? [] : null));
|
|
315
|
+
},
|
|
316
|
+
deep: !0
|
|
317
|
+
},
|
|
318
|
+
search() {
|
|
319
|
+
this.$emit("search-change", this.search);
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
emits: ["open", "search-change", "close", "select", "update:modelValue", "remove", "tag"],
|
|
323
|
+
methods: {
|
|
324
|
+
/**
|
|
325
|
+
* Returns the internalValue in a way it can be emited to the parent
|
|
326
|
+
* @returns {Object||Array||String||Integer}
|
|
327
|
+
*/
|
|
328
|
+
getValue() {
|
|
329
|
+
return this.multiple ? this.internalValue : this.internalValue.length === 0 ? null : this.internalValue[0];
|
|
330
|
+
},
|
|
331
|
+
/**
|
|
332
|
+
* Filters and then flattens the options list
|
|
333
|
+
* @param {Array}
|
|
334
|
+
* @return {Array} returns a filtered and flat options list
|
|
335
|
+
*/
|
|
336
|
+
filterAndFlat(e, t, i) {
|
|
337
|
+
return E(
|
|
338
|
+
G(t, i, this.groupValues, this.groupLabel, this.customLabel),
|
|
339
|
+
w(this.groupValues, this.groupLabel)
|
|
340
|
+
)(e);
|
|
341
|
+
},
|
|
342
|
+
/**
|
|
343
|
+
* Flattens and then strips the group labels from the options list
|
|
344
|
+
* @param {Array}
|
|
345
|
+
* @return {Array} returns a flat options list without group labels
|
|
346
|
+
*/
|
|
347
|
+
flatAndStrip(e) {
|
|
348
|
+
return E(
|
|
349
|
+
w(this.groupValues, this.groupLabel),
|
|
350
|
+
H
|
|
351
|
+
)(e);
|
|
352
|
+
},
|
|
353
|
+
/**
|
|
354
|
+
* Updates the search value
|
|
355
|
+
* @param {String}
|
|
356
|
+
*/
|
|
357
|
+
updateSearch(e) {
|
|
358
|
+
this.search = e;
|
|
359
|
+
},
|
|
360
|
+
/**
|
|
361
|
+
* Finds out if the given query is already present
|
|
362
|
+
* in the available options
|
|
363
|
+
* @param {String}
|
|
364
|
+
* @return {Boolean} returns true if element is available
|
|
365
|
+
*/
|
|
366
|
+
isExistingOption(e) {
|
|
367
|
+
return this.options ? this.optionKeys.indexOf(e) > -1 : !1;
|
|
368
|
+
},
|
|
369
|
+
/**
|
|
370
|
+
* Finds out if the given element is already present
|
|
371
|
+
* in the result value
|
|
372
|
+
* @param {Object||String||Integer} option passed element to check
|
|
373
|
+
* @returns {Boolean} returns true if element is selected
|
|
374
|
+
*/
|
|
375
|
+
isSelected(e) {
|
|
376
|
+
const t = this.trackBy ? e[this.trackBy] : e;
|
|
377
|
+
return this.valueKeys.indexOf(t) > -1;
|
|
378
|
+
},
|
|
379
|
+
/**
|
|
380
|
+
* Finds out if the given option is disabled
|
|
381
|
+
* @param {Object||String||Integer} option passed element to check
|
|
382
|
+
* @returns {Boolean} returns true if element is disabled
|
|
383
|
+
*/
|
|
384
|
+
isOptionDisabled(e) {
|
|
385
|
+
return !!e.$isDisabled;
|
|
386
|
+
},
|
|
387
|
+
/**
|
|
388
|
+
* Returns empty string when options is null/undefined
|
|
389
|
+
* Returns tag query if option is tag.
|
|
390
|
+
* Returns the customLabel() results and casts it to string.
|
|
391
|
+
*
|
|
392
|
+
* @param {Object||String||Integer} Passed option
|
|
393
|
+
* @returns {Object||String}
|
|
394
|
+
*/
|
|
395
|
+
getOptionLabel(e) {
|
|
396
|
+
if (O(e)) return "";
|
|
397
|
+
if (e.isTag) return e.label;
|
|
398
|
+
if (e.$isLabel) return e.$groupLabel;
|
|
399
|
+
const t = this.customLabel(e, this.label);
|
|
400
|
+
return O(t) ? "" : t;
|
|
401
|
+
},
|
|
402
|
+
/**
|
|
403
|
+
* Add the given option to the list of selected options
|
|
404
|
+
* or sets the option as the selected option.
|
|
405
|
+
* If option is already selected -> remove it from the results.
|
|
406
|
+
*
|
|
407
|
+
* @param {Object||String||Integer} option to select/deselect
|
|
408
|
+
* @param {Boolean} block removing
|
|
409
|
+
*/
|
|
410
|
+
select(e, t) {
|
|
411
|
+
if (e.$isLabel && this.groupSelect) {
|
|
412
|
+
this.selectGroup(e);
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (!(this.blockKeys.indexOf(t) !== -1 || this.disabled || e.$isDisabled || e.$isLabel) && !(this.max && this.multiple && this.internalValue.length === this.max) && !(t === "Tab" && !this.pointerDirty)) {
|
|
416
|
+
if (e.isTag)
|
|
417
|
+
this.$emit("tag", e.label, this.id), this.search = "", this.closeOnSelect && !this.multiple && this.deactivate();
|
|
418
|
+
else {
|
|
419
|
+
if (this.isSelected(e)) {
|
|
420
|
+
t !== "Tab" && this.removeElement(e);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
this.multiple ? this.$emit("update:modelValue", this.internalValue.concat([e])) : this.$emit("update:modelValue", e), this.$emit("select", e, this.id), this.clearOnSelect && (this.search = "");
|
|
424
|
+
}
|
|
425
|
+
this.closeOnSelect && this.deactivate();
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
/**
|
|
429
|
+
* Add the given group options to the list of selected options
|
|
430
|
+
* If all group optiona are already selected -> remove it from the results.
|
|
431
|
+
*
|
|
432
|
+
* @param {Object||String||Integer} group to select/deselect
|
|
433
|
+
*/
|
|
434
|
+
selectGroup(e) {
|
|
435
|
+
const t = this.options.find((i) => i[this.groupLabel] === e.$groupLabel);
|
|
436
|
+
if (t) {
|
|
437
|
+
if (this.wholeGroupSelected(t)) {
|
|
438
|
+
this.$emit("remove", t[this.groupValues], this.id);
|
|
439
|
+
const i = this.trackBy ? t[this.groupValues].map((a) => a[this.trackBy]) : t[this.groupValues], l = this.internalValue.filter(
|
|
440
|
+
(a) => i.indexOf(this.trackBy ? a[this.trackBy] : a) === -1
|
|
441
|
+
);
|
|
442
|
+
this.$emit("update:modelValue", l);
|
|
443
|
+
} else {
|
|
444
|
+
let i = t[this.groupValues].filter(
|
|
445
|
+
(l) => !(this.isOptionDisabled(l) || this.isSelected(l))
|
|
446
|
+
);
|
|
447
|
+
this.max && i.splice(this.max - this.internalValue.length), this.$emit("select", i, this.id), this.$emit(
|
|
448
|
+
"update:modelValue",
|
|
449
|
+
this.internalValue.concat(i)
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
this.closeOnSelect && this.deactivate();
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
/**
|
|
456
|
+
* Helper to identify if all values in a group are selected
|
|
457
|
+
*
|
|
458
|
+
* @param {Object} group to validated selected values against
|
|
459
|
+
*/
|
|
460
|
+
wholeGroupSelected(e) {
|
|
461
|
+
return e[this.groupValues].every(
|
|
462
|
+
(t) => this.isSelected(t) || this.isOptionDisabled(t)
|
|
463
|
+
);
|
|
464
|
+
},
|
|
465
|
+
/**
|
|
466
|
+
* Helper to identify if all values in a group are disabled
|
|
467
|
+
*
|
|
468
|
+
* @param {Object} group to check for disabled values
|
|
469
|
+
*/
|
|
470
|
+
wholeGroupDisabled(e) {
|
|
471
|
+
return e[this.groupValues].every(this.isOptionDisabled);
|
|
472
|
+
},
|
|
473
|
+
/**
|
|
474
|
+
* Removes the given option from the selected options.
|
|
475
|
+
* Additionally checks this.allowEmpty prop if option can be removed when
|
|
476
|
+
* it is the last selected option.
|
|
477
|
+
*
|
|
478
|
+
* @param {type} option description
|
|
479
|
+
* @return {type} description
|
|
480
|
+
*/
|
|
481
|
+
removeElement(e, t = !0) {
|
|
482
|
+
if (this.disabled || e.$isDisabled) return;
|
|
483
|
+
if (!this.allowEmpty && this.internalValue.length <= 1) {
|
|
484
|
+
this.deactivate();
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
const i = typeof e == "object" ? this.valueKeys.indexOf(e[this.trackBy]) : this.valueKeys.indexOf(e);
|
|
488
|
+
if (this.multiple) {
|
|
489
|
+
const l = this.internalValue.slice(0, i).concat(this.internalValue.slice(i + 1));
|
|
490
|
+
this.$emit("update:modelValue", l);
|
|
491
|
+
} else
|
|
492
|
+
this.$emit("update:modelValue", null);
|
|
493
|
+
this.$emit("remove", e, this.id), this.closeOnSelect && t && this.deactivate();
|
|
494
|
+
},
|
|
495
|
+
/**
|
|
496
|
+
* Calls this.removeElement() with the last element
|
|
497
|
+
* from this.internalValue (selected element Array)
|
|
498
|
+
*
|
|
499
|
+
* @fires this#removeElement
|
|
500
|
+
*/
|
|
501
|
+
removeLastElement() {
|
|
502
|
+
this.blockKeys.indexOf("Delete") === -1 && this.search.length === 0 && Array.isArray(this.internalValue) && this.internalValue.length && this.removeElement(this.internalValue[this.internalValue.length - 1], !1);
|
|
503
|
+
},
|
|
504
|
+
/**
|
|
505
|
+
* Opens the multiselect’s dropdown.
|
|
506
|
+
* Sets this.isOpen to TRUE
|
|
507
|
+
*/
|
|
508
|
+
activate() {
|
|
509
|
+
this.isOpen || this.disabled || (this.adjustPosition(), this.groupValues && this.pointer === 0 && this.filteredOptions.length && (this.pointer = 1), this.isOpen = !0, this.searchable ? (this.preserveSearch || (this.search = ""), this.preventAutofocus || this.$nextTick(() => this.$refs.search && this.$refs.search.focus())) : this.preventAutofocus || typeof this.$el < "u" && this.$el.focus(), this.$emit("open", this.id));
|
|
510
|
+
},
|
|
511
|
+
/**
|
|
512
|
+
* Closes the multiselect’s dropdown.
|
|
513
|
+
* Sets this.isOpen to FALSE
|
|
514
|
+
*/
|
|
515
|
+
deactivate() {
|
|
516
|
+
this.isOpen && (this.isOpen = !1, this.searchable ? this.$refs.search !== null && typeof this.$refs.search < "u" && this.$refs.search.blur() : typeof this.$el < "u" && this.$el.blur(), this.preserveSearch || (this.search = ""), this.$emit("close", this.getValue(), this.id));
|
|
517
|
+
},
|
|
518
|
+
/**
|
|
519
|
+
* Call this.activate() or this.deactivate()
|
|
520
|
+
* depending on this.isOpen value.
|
|
521
|
+
*
|
|
522
|
+
* @fires this#activate || this#deactivate
|
|
523
|
+
* @property {Boolean} isOpen indicates if dropdown is open
|
|
524
|
+
*/
|
|
525
|
+
toggle() {
|
|
526
|
+
this.isOpen ? this.deactivate() : this.activate();
|
|
527
|
+
},
|
|
528
|
+
/**
|
|
529
|
+
* Updates the hasEnoughSpace variable used for
|
|
530
|
+
* detecting where to expand the dropdown
|
|
531
|
+
*/
|
|
532
|
+
adjustPosition() {
|
|
533
|
+
if (typeof window > "u") return;
|
|
534
|
+
const e = this.$el.getBoundingClientRect().top, t = window.innerHeight - this.$el.getBoundingClientRect().bottom;
|
|
535
|
+
t > this.maxHeight || t > e || this.openDirection === "below" || this.openDirection === "bottom" ? (this.preferredOpenDirection = "below", this.optimizedHeight = Math.min(t - 40, this.maxHeight)) : (this.preferredOpenDirection = "above", this.optimizedHeight = Math.min(e - 40, this.maxHeight));
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}, K = {
|
|
539
|
+
data() {
|
|
540
|
+
return {
|
|
541
|
+
pointer: 0,
|
|
542
|
+
pointerDirty: !1
|
|
543
|
+
};
|
|
544
|
+
},
|
|
545
|
+
props: {
|
|
546
|
+
/**
|
|
547
|
+
* Enable/disable highlighting of the pointed value.
|
|
548
|
+
* @type {Boolean}
|
|
549
|
+
* @default true
|
|
550
|
+
*/
|
|
551
|
+
showPointer: {
|
|
552
|
+
type: Boolean,
|
|
553
|
+
default: !0
|
|
554
|
+
},
|
|
555
|
+
optionHeight: {
|
|
556
|
+
type: Number,
|
|
557
|
+
default: 40
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
computed: {
|
|
561
|
+
pointerPosition() {
|
|
562
|
+
return this.pointer * this.optionHeight;
|
|
563
|
+
},
|
|
564
|
+
visibleElements() {
|
|
565
|
+
return this.optimizedHeight / this.optionHeight;
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
watch: {
|
|
569
|
+
filteredOptions() {
|
|
570
|
+
this.pointerAdjust();
|
|
571
|
+
},
|
|
572
|
+
isOpen() {
|
|
573
|
+
this.pointerDirty = !1;
|
|
574
|
+
},
|
|
575
|
+
pointer() {
|
|
576
|
+
this.$refs.search && this.$refs.search.setAttribute("aria-activedescendant", this.id + "-" + this.pointer.toString());
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
methods: {
|
|
580
|
+
optionHighlight(e, t) {
|
|
581
|
+
return {
|
|
582
|
+
"multiselect__option--highlight": e === this.pointer && this.showPointer,
|
|
583
|
+
"multiselect__option--selected": this.isSelected(t)
|
|
584
|
+
};
|
|
585
|
+
},
|
|
586
|
+
groupHighlight(e, t) {
|
|
587
|
+
if (!this.groupSelect)
|
|
588
|
+
return [
|
|
589
|
+
"multiselect__option--disabled",
|
|
590
|
+
{ "multiselect__option--group": t.$isLabel }
|
|
591
|
+
];
|
|
592
|
+
const i = this.options.find((l) => l[this.groupLabel] === t.$groupLabel);
|
|
593
|
+
return i && !this.wholeGroupDisabled(i) ? [
|
|
594
|
+
"multiselect__option--group",
|
|
595
|
+
{ "multiselect__option--highlight": e === this.pointer && this.showPointer },
|
|
596
|
+
{ "multiselect__option--group-selected": this.wholeGroupSelected(i) }
|
|
597
|
+
] : "multiselect__option--disabled";
|
|
598
|
+
},
|
|
599
|
+
addPointerElement({ key: e } = "Enter") {
|
|
600
|
+
this.filteredOptions.length > 0 && this.select(this.filteredOptions[this.pointer], e), this.pointerReset();
|
|
601
|
+
},
|
|
602
|
+
pointerForward() {
|
|
603
|
+
this.pointer < this.filteredOptions.length - 1 && (this.pointer++, this.$refs.list.scrollTop <= this.pointerPosition - (this.visibleElements - 1) * this.optionHeight && (this.$refs.list.scrollTop = this.pointerPosition - (this.visibleElements - 1) * this.optionHeight), this.filteredOptions[this.pointer] && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerForward()), this.pointerDirty = !0;
|
|
604
|
+
},
|
|
605
|
+
pointerBackward() {
|
|
606
|
+
this.pointer > 0 ? (this.pointer--, this.$refs.list.scrollTop >= this.pointerPosition && (this.$refs.list.scrollTop = this.pointerPosition), this.filteredOptions[this.pointer] && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerBackward()) : this.filteredOptions[this.pointer] && this.filteredOptions[0].$isLabel && !this.groupSelect && this.pointerForward(), this.pointerDirty = !0;
|
|
607
|
+
},
|
|
608
|
+
pointerReset() {
|
|
609
|
+
this.closeOnSelect && (this.pointer = 0, this.$refs.list && (this.$refs.list.scrollTop = 0));
|
|
610
|
+
},
|
|
611
|
+
pointerAdjust() {
|
|
612
|
+
this.pointer >= this.filteredOptions.length - 1 && (this.pointer = this.filteredOptions.length ? this.filteredOptions.length - 1 : 0), this.filteredOptions.length > 0 && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerForward();
|
|
613
|
+
},
|
|
614
|
+
pointerSet(e) {
|
|
615
|
+
this.pointer = e, this.pointerDirty = !0;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}, F = {
|
|
619
|
+
name: "vue-multiselect",
|
|
620
|
+
mixins: [C, K],
|
|
621
|
+
compatConfig: {
|
|
622
|
+
MODE: 3,
|
|
623
|
+
ATTR_ENUMERATED_COERCION: !1
|
|
624
|
+
},
|
|
625
|
+
props: {
|
|
626
|
+
/**
|
|
627
|
+
* name attribute to match optional label element
|
|
628
|
+
* @default ''
|
|
629
|
+
* @type {String}
|
|
630
|
+
*/
|
|
631
|
+
name: {
|
|
632
|
+
type: String,
|
|
633
|
+
default: ""
|
|
634
|
+
},
|
|
635
|
+
/**
|
|
636
|
+
* Presets the selected options value.
|
|
637
|
+
* @type Object || Array || String || Integer
|
|
638
|
+
*/
|
|
639
|
+
modelValue: {
|
|
640
|
+
type: null,
|
|
641
|
+
default() {
|
|
642
|
+
return [];
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
/**
|
|
646
|
+
* String to show when pointing to an option
|
|
647
|
+
* @default 'Press enter to select'
|
|
648
|
+
* @type {String}
|
|
649
|
+
*/
|
|
650
|
+
selectLabel: {
|
|
651
|
+
type: String,
|
|
652
|
+
default: "Press enter to select"
|
|
653
|
+
},
|
|
654
|
+
/**
|
|
655
|
+
* String to show when pointing to an option
|
|
656
|
+
* @default 'Press enter to select'
|
|
657
|
+
* @type {String}
|
|
658
|
+
*/
|
|
659
|
+
selectGroupLabel: {
|
|
660
|
+
type: String,
|
|
661
|
+
default: "Press enter to select group"
|
|
662
|
+
},
|
|
663
|
+
/**
|
|
664
|
+
* String to show next to selected option
|
|
665
|
+
* @default 'Selected'
|
|
666
|
+
* @type {String}
|
|
667
|
+
*/
|
|
668
|
+
selectedLabel: {
|
|
669
|
+
type: String,
|
|
670
|
+
default: "Selected"
|
|
671
|
+
},
|
|
672
|
+
/**
|
|
673
|
+
* String to show when pointing to an already selected option
|
|
674
|
+
* @default 'Press enter to remove'
|
|
675
|
+
* @type {String}
|
|
676
|
+
*/
|
|
677
|
+
deselectLabel: {
|
|
678
|
+
type: String,
|
|
679
|
+
default: "Press enter to remove"
|
|
680
|
+
},
|
|
681
|
+
/**
|
|
682
|
+
* String to show when pointing to an already selected option
|
|
683
|
+
* @default 'Press enter to remove'
|
|
684
|
+
* @type {String}
|
|
685
|
+
*/
|
|
686
|
+
deselectGroupLabel: {
|
|
687
|
+
type: String,
|
|
688
|
+
default: "Press enter to deselect group"
|
|
689
|
+
},
|
|
690
|
+
/**
|
|
691
|
+
* Decide whether to show pointer labels
|
|
692
|
+
* @default true
|
|
693
|
+
* @type {Boolean}
|
|
694
|
+
*/
|
|
695
|
+
showLabels: {
|
|
696
|
+
type: Boolean,
|
|
697
|
+
default: !0
|
|
698
|
+
},
|
|
699
|
+
/**
|
|
700
|
+
* Limit the display of selected options. The rest will be hidden within the limitText string.
|
|
701
|
+
* @default 99999
|
|
702
|
+
* @type {Integer}
|
|
703
|
+
*/
|
|
704
|
+
limit: {
|
|
705
|
+
type: Number,
|
|
706
|
+
default: 99999
|
|
707
|
+
},
|
|
708
|
+
/**
|
|
709
|
+
* Sets maxHeight style value of the dropdown
|
|
710
|
+
* @default 300
|
|
711
|
+
* @type {Integer}
|
|
712
|
+
*/
|
|
713
|
+
maxHeight: {
|
|
714
|
+
type: Number,
|
|
715
|
+
default: 300
|
|
716
|
+
},
|
|
717
|
+
/**
|
|
718
|
+
* Function that process the message shown when selected
|
|
719
|
+
* elements pass the defined limit.
|
|
720
|
+
* @default 'and * more'
|
|
721
|
+
* @param {Int} count Number of elements more than limit
|
|
722
|
+
* @type {Function}
|
|
723
|
+
*/
|
|
724
|
+
limitText: {
|
|
725
|
+
type: Function,
|
|
726
|
+
default: (e) => `and ${e} more`
|
|
727
|
+
},
|
|
728
|
+
/**
|
|
729
|
+
* Set true to trigger the loading spinner.
|
|
730
|
+
* @default False
|
|
731
|
+
* @type {Boolean}
|
|
732
|
+
*/
|
|
733
|
+
loading: {
|
|
734
|
+
type: Boolean,
|
|
735
|
+
default: !1
|
|
736
|
+
},
|
|
737
|
+
/**
|
|
738
|
+
* Disables the multiselect if true.
|
|
739
|
+
* @default false
|
|
740
|
+
* @type {Boolean}
|
|
741
|
+
*/
|
|
742
|
+
disabled: {
|
|
743
|
+
type: Boolean,
|
|
744
|
+
default: !1
|
|
745
|
+
},
|
|
746
|
+
/**
|
|
747
|
+
* Enables search input's spellcheck if true.
|
|
748
|
+
* @default false
|
|
749
|
+
* @type {Boolean}
|
|
750
|
+
*/
|
|
751
|
+
spellcheck: {
|
|
752
|
+
type: Boolean,
|
|
753
|
+
default: !1
|
|
754
|
+
},
|
|
755
|
+
/**
|
|
756
|
+
* Fixed opening direction
|
|
757
|
+
* @default ''
|
|
758
|
+
* @type {String}
|
|
759
|
+
*/
|
|
760
|
+
openDirection: {
|
|
761
|
+
type: String,
|
|
762
|
+
default: ""
|
|
763
|
+
},
|
|
764
|
+
/**
|
|
765
|
+
* Shows slot with message about empty options
|
|
766
|
+
* @default true
|
|
767
|
+
* @type {Boolean}
|
|
768
|
+
*/
|
|
769
|
+
showNoOptions: {
|
|
770
|
+
type: Boolean,
|
|
771
|
+
default: !0
|
|
772
|
+
},
|
|
773
|
+
showNoResults: {
|
|
774
|
+
type: Boolean,
|
|
775
|
+
default: !0
|
|
776
|
+
},
|
|
777
|
+
tabindex: {
|
|
778
|
+
type: Number,
|
|
779
|
+
default: 0
|
|
780
|
+
},
|
|
781
|
+
required: {
|
|
782
|
+
type: Boolean,
|
|
783
|
+
default: !1
|
|
784
|
+
}
|
|
785
|
+
},
|
|
786
|
+
computed: {
|
|
787
|
+
hasOptionGroup() {
|
|
788
|
+
return this.groupValues && this.groupLabel && this.groupSelect;
|
|
789
|
+
},
|
|
790
|
+
isSingleLabelVisible() {
|
|
791
|
+
return (this.singleValue || this.singleValue === 0) && (!this.isOpen || !this.searchable) && !this.visibleValues.length;
|
|
792
|
+
},
|
|
793
|
+
visibleValues() {
|
|
794
|
+
return this.multiple ? this.internalValue.slice(0, this.limit) : [];
|
|
795
|
+
},
|
|
796
|
+
singleValue() {
|
|
797
|
+
return this.internalValue[0];
|
|
798
|
+
},
|
|
799
|
+
deselectLabelText() {
|
|
800
|
+
return this.showLabels ? this.deselectLabel : "";
|
|
801
|
+
},
|
|
802
|
+
deselectGroupLabelText() {
|
|
803
|
+
return this.showLabels ? this.deselectGroupLabel : "";
|
|
804
|
+
},
|
|
805
|
+
selectLabelText() {
|
|
806
|
+
return this.showLabels ? this.selectLabel : "";
|
|
807
|
+
},
|
|
808
|
+
selectGroupLabelText() {
|
|
809
|
+
return this.showLabels ? this.selectGroupLabel : "";
|
|
810
|
+
},
|
|
811
|
+
selectedLabelText() {
|
|
812
|
+
return this.showLabels ? this.selectedLabel : "";
|
|
813
|
+
},
|
|
814
|
+
inputStyle() {
|
|
815
|
+
return this.searchable || this.multiple && this.modelValue && this.modelValue.length ? this.isOpen ? { width: "100%" } : { width: "0", position: "absolute", padding: "0" } : "";
|
|
816
|
+
},
|
|
817
|
+
contentStyle() {
|
|
818
|
+
return this.options.length ? { display: "inline-block" } : { display: "block" };
|
|
819
|
+
},
|
|
820
|
+
isAbove() {
|
|
821
|
+
return this.openDirection === "above" || this.openDirection === "top" ? !0 : this.openDirection === "below" || this.openDirection === "bottom" ? !1 : this.preferredOpenDirection === "above";
|
|
822
|
+
},
|
|
823
|
+
showSearchInput() {
|
|
824
|
+
return this.searchable && (this.hasSingleSelectedSlot && (this.visibleSingleValue || this.visibleSingleValue === 0) ? this.isOpen : !0);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}, N = ["tabindex", "aria-owns"], R = {
|
|
828
|
+
ref: "tags",
|
|
829
|
+
class: "multiselect__tags"
|
|
830
|
+
}, z = { class: "multiselect__tags-wrap" }, q = ["textContent"], j = ["onKeypress", "onMousedown"], I = ["textContent"], U = { class: "multiselect__spinner" }, J = ["name", "id", "spellcheck", "placeholder", "required", "value", "disabled", "tabindex", "aria-controls"], Q = ["id", "aria-multiselectable"], W = { key: 0 }, X = { class: "multiselect__option" }, Y = ["aria-selected", "id", "role"], Z = ["onClick", "onMouseenter", "data-select", "data-selected", "data-deselect"], x = ["data-select", "data-deselect", "onMouseenter", "onMousedown"], _ = { class: "multiselect__option" }, ee = { class: "multiselect__option" };
|
|
831
|
+
function te(e, t, i, l, a, n) {
|
|
832
|
+
return d(), p("div", {
|
|
833
|
+
tabindex: e.searchable ? -1 : i.tabindex,
|
|
834
|
+
class: V([{ "multiselect--active": e.isOpen, "multiselect--disabled": i.disabled, "multiselect--above": n.isAbove, "multiselect--has-options-group": n.hasOptionGroup }, "multiselect"]),
|
|
835
|
+
onFocus: t[13] || (t[13] = (s) => e.activate()),
|
|
836
|
+
onBlur: t[14] || (t[14] = (s) => e.searchable ? !1 : e.deactivate()),
|
|
837
|
+
onKeydown: [
|
|
838
|
+
t[15] || (t[15] = f(r((s) => e.pointerForward(), ["self", "prevent"]), ["down"])),
|
|
839
|
+
t[16] || (t[16] = f(r((s) => e.pointerBackward(), ["self", "prevent"]), ["up"]))
|
|
840
|
+
],
|
|
841
|
+
onKeypress: t[17] || (t[17] = f(r((s) => e.addPointerElement(s), ["stop", "self"]), ["enter", "tab"])),
|
|
842
|
+
onKeyup: t[18] || (t[18] = f((s) => e.deactivate(), ["esc"])),
|
|
843
|
+
role: "combobox",
|
|
844
|
+
"aria-owns": "listbox-" + e.id
|
|
845
|
+
}, [
|
|
846
|
+
u(e.$slots, "caret", { toggle: e.toggle }, () => [
|
|
847
|
+
o("div", {
|
|
848
|
+
onMousedown: t[0] || (t[0] = r((s) => e.toggle(), ["prevent", "stop"])),
|
|
849
|
+
class: "multiselect__select"
|
|
850
|
+
}, null, 32)
|
|
851
|
+
], !0),
|
|
852
|
+
u(e.$slots, "clear", { search: e.search }, void 0, !0),
|
|
853
|
+
o("div", R, [
|
|
854
|
+
u(e.$slots, "selection", {
|
|
855
|
+
search: e.search,
|
|
856
|
+
remove: e.removeElement,
|
|
857
|
+
values: n.visibleValues,
|
|
858
|
+
isOpen: e.isOpen
|
|
859
|
+
}, () => [
|
|
860
|
+
b(o("div", z, [
|
|
861
|
+
(d(!0), p(L, null, $(n.visibleValues, (s, h) => u(e.$slots, "tag", {
|
|
862
|
+
option: s,
|
|
863
|
+
search: e.search,
|
|
864
|
+
remove: e.removeElement
|
|
865
|
+
}, () => [
|
|
866
|
+
(d(), p("span", {
|
|
867
|
+
class: "multiselect__tag",
|
|
868
|
+
key: h
|
|
869
|
+
}, [
|
|
870
|
+
o("span", {
|
|
871
|
+
textContent: g(e.getOptionLabel(s))
|
|
872
|
+
}, null, 8, q),
|
|
873
|
+
o("i", {
|
|
874
|
+
tabindex: "1",
|
|
875
|
+
onKeypress: f(r((m) => e.removeElement(s), ["prevent"]), ["enter"]),
|
|
876
|
+
onMousedown: r((m) => e.removeElement(s), ["prevent"]),
|
|
877
|
+
class: "multiselect__tag-icon"
|
|
878
|
+
}, null, 40, j)
|
|
879
|
+
]))
|
|
880
|
+
], !0)), 256))
|
|
881
|
+
], 512), [
|
|
882
|
+
[y, n.visibleValues.length > 0]
|
|
883
|
+
]),
|
|
884
|
+
e.internalValue && e.internalValue.length > i.limit ? u(e.$slots, "limit", { key: 0 }, () => [
|
|
885
|
+
o("strong", {
|
|
886
|
+
class: "multiselect__strong",
|
|
887
|
+
textContent: g(i.limitText(e.internalValue.length - i.limit))
|
|
888
|
+
}, null, 8, I)
|
|
889
|
+
], !0) : c("", !0)
|
|
890
|
+
], !0),
|
|
891
|
+
B(k, { name: "multiselect__loading" }, {
|
|
892
|
+
default: D(() => [
|
|
893
|
+
u(e.$slots, "loading", {}, () => [
|
|
894
|
+
b(o("div", U, null, 512), [
|
|
895
|
+
[y, i.loading]
|
|
896
|
+
])
|
|
897
|
+
], !0)
|
|
898
|
+
]),
|
|
899
|
+
_: 3
|
|
900
|
+
}),
|
|
901
|
+
e.searchable ? (d(), p("input", {
|
|
902
|
+
key: 0,
|
|
903
|
+
ref: "search",
|
|
904
|
+
name: i.name,
|
|
905
|
+
id: e.id,
|
|
906
|
+
type: "text",
|
|
907
|
+
autocomplete: "off",
|
|
908
|
+
spellcheck: i.spellcheck,
|
|
909
|
+
placeholder: e.placeholder,
|
|
910
|
+
required: i.required,
|
|
911
|
+
style: S({
|
|
912
|
+
...n.inputStyle
|
|
913
|
+
}),
|
|
914
|
+
value: e.search,
|
|
915
|
+
disabled: i.disabled,
|
|
916
|
+
tabindex: i.tabindex,
|
|
917
|
+
onInput: t[1] || (t[1] = (s) => e.updateSearch(s.target.value)),
|
|
918
|
+
onFocus: t[2] || (t[2] = r((s) => e.activate(), ["prevent"])),
|
|
919
|
+
onBlur: t[3] || (t[3] = r((s) => e.deactivate(), ["prevent"])),
|
|
920
|
+
onKeyup: t[4] || (t[4] = f((s) => e.deactivate(), ["esc"])),
|
|
921
|
+
onKeydown: [
|
|
922
|
+
t[5] || (t[5] = f(r((s) => e.pointerForward(), ["prevent"]), ["down"])),
|
|
923
|
+
t[6] || (t[6] = f(r((s) => e.pointerBackward(), ["prevent"]), ["up"])),
|
|
924
|
+
t[8] || (t[8] = f(r((s) => e.removeLastElement(), ["stop"]), ["delete"]))
|
|
925
|
+
],
|
|
926
|
+
onKeypress: t[7] || (t[7] = f(r((s) => e.addPointerElement(s), ["prevent", "stop", "self"]), ["enter"])),
|
|
927
|
+
class: "multiselect__input",
|
|
928
|
+
"aria-controls": "listbox-" + e.id
|
|
929
|
+
}, null, 44, J)) : c("", !0),
|
|
930
|
+
n.isSingleLabelVisible ? (d(), p("span", {
|
|
931
|
+
key: 1,
|
|
932
|
+
class: "multiselect__single",
|
|
933
|
+
onMousedown: t[9] || (t[9] = r((...s) => e.toggle && e.toggle(...s), ["prevent"]))
|
|
934
|
+
}, [
|
|
935
|
+
u(e.$slots, "singleLabel", { option: n.singleValue }, () => [
|
|
936
|
+
v(g(e.currentOptionLabel), 1)
|
|
937
|
+
], !0)
|
|
938
|
+
], 32)) : c("", !0),
|
|
939
|
+
c("", !0)
|
|
940
|
+
], 512),
|
|
941
|
+
B(k, { name: "multiselect" }, {
|
|
942
|
+
default: D(() => [
|
|
943
|
+
b(o("div", {
|
|
944
|
+
class: "multiselect__content-wrapper",
|
|
945
|
+
onFocus: t[11] || (t[11] = (...s) => e.activate && e.activate(...s)),
|
|
946
|
+
tabindex: "-1",
|
|
947
|
+
onMousedown: t[12] || (t[12] = r(() => {
|
|
948
|
+
}, ["prevent"])),
|
|
949
|
+
style: S({ maxHeight: e.optimizedHeight + "px" }),
|
|
950
|
+
ref: "list"
|
|
951
|
+
}, [
|
|
952
|
+
o("ul", {
|
|
953
|
+
class: "multiselect__content",
|
|
954
|
+
style: S(n.contentStyle),
|
|
955
|
+
role: "listbox",
|
|
956
|
+
id: "listbox-" + e.id,
|
|
957
|
+
"aria-multiselectable": e.multiple
|
|
958
|
+
}, [
|
|
959
|
+
u(e.$slots, "beforeList", {}, void 0, !0),
|
|
960
|
+
e.multiple && e.max === e.internalValue.length ? (d(), p("li", W, [
|
|
961
|
+
o("span", X, [
|
|
962
|
+
u(e.$slots, "maxElements", {}, () => [
|
|
963
|
+
v("Maximum of " + g(e.max) + " options selected. First remove a selected option to select another.", 1)
|
|
964
|
+
], !0)
|
|
965
|
+
])
|
|
966
|
+
])) : c("", !0),
|
|
967
|
+
!e.max || e.internalValue.length < e.max ? (d(!0), p(L, { key: 1 }, $(e.filteredOptions, (s, h) => (d(), p("li", {
|
|
968
|
+
class: "multiselect__element",
|
|
969
|
+
key: h,
|
|
970
|
+
"aria-selected": e.isSelected(s),
|
|
971
|
+
id: e.id + "-" + h,
|
|
972
|
+
role: s && (s.$isLabel || s.$isDisabled) ? null : "option"
|
|
973
|
+
}, [
|
|
974
|
+
s && (s.$isLabel || s.$isDisabled) ? c("", !0) : (d(), p("span", {
|
|
975
|
+
key: 0,
|
|
976
|
+
class: V([e.optionHighlight(h, s), "multiselect__option"]),
|
|
977
|
+
onClick: r((m) => e.select(s), ["stop"]),
|
|
978
|
+
onMouseenter: r((m) => e.pointerSet(h), ["self"]),
|
|
979
|
+
"data-select": s && s.isTag ? e.tagPlaceholder : n.selectLabelText,
|
|
980
|
+
"data-selected": n.selectedLabelText,
|
|
981
|
+
"data-deselect": n.deselectLabelText
|
|
982
|
+
}, [
|
|
983
|
+
u(e.$slots, "option", {
|
|
984
|
+
option: s,
|
|
985
|
+
search: e.search,
|
|
986
|
+
index: h
|
|
987
|
+
}, () => [
|
|
988
|
+
o("span", null, g(e.getOptionLabel(s)), 1)
|
|
989
|
+
], !0)
|
|
990
|
+
], 42, Z)),
|
|
991
|
+
s && (s.$isLabel || s.$isDisabled) ? (d(), p("span", {
|
|
992
|
+
key: 1,
|
|
993
|
+
"data-select": e.groupSelect && n.selectGroupLabelText,
|
|
994
|
+
"data-deselect": e.groupSelect && n.deselectGroupLabelText,
|
|
995
|
+
class: V([e.groupHighlight(h, s), "multiselect__option"]),
|
|
996
|
+
onMouseenter: r((m) => e.groupSelect && e.pointerSet(h), ["self"]),
|
|
997
|
+
onMousedown: r((m) => e.selectGroup(s), ["prevent"])
|
|
998
|
+
}, [
|
|
999
|
+
u(e.$slots, "option", {
|
|
1000
|
+
option: s,
|
|
1001
|
+
search: e.search,
|
|
1002
|
+
index: h
|
|
1003
|
+
}, () => [
|
|
1004
|
+
o("span", null, g(e.getOptionLabel(s)), 1)
|
|
1005
|
+
], !0)
|
|
1006
|
+
], 42, x)) : c("", !0)
|
|
1007
|
+
], 8, Y))), 128)) : c("", !0),
|
|
1008
|
+
b(o("li", null, [
|
|
1009
|
+
o("span", _, [
|
|
1010
|
+
u(e.$slots, "noResult", { search: e.search }, () => [
|
|
1011
|
+
v("No elements found. Consider changing the search query.")
|
|
1012
|
+
], !0)
|
|
1013
|
+
])
|
|
1014
|
+
], 512), [
|
|
1015
|
+
[y, i.showNoResults && e.filteredOptions.length === 0 && e.search && !i.loading]
|
|
1016
|
+
]),
|
|
1017
|
+
b(o("li", null, [
|
|
1018
|
+
o("span", ee, [
|
|
1019
|
+
u(e.$slots, "noOptions", {}, () => [
|
|
1020
|
+
v("List is empty.")
|
|
1021
|
+
], !0)
|
|
1022
|
+
])
|
|
1023
|
+
], 512), [
|
|
1024
|
+
[y, i.showNoOptions && (e.options.length === 0 || n.hasOptionGroup === !0 && e.filteredOptions.length === 0) && !e.search && !i.loading]
|
|
1025
|
+
]),
|
|
1026
|
+
u(e.$slots, "afterList", {}, void 0, !0)
|
|
1027
|
+
], 12, Q)
|
|
1028
|
+
], 36), [
|
|
1029
|
+
[y, e.isOpen]
|
|
1030
|
+
])
|
|
1031
|
+
]),
|
|
1032
|
+
_: 3
|
|
1033
|
+
})
|
|
1034
|
+
], 42, N);
|
|
1035
|
+
}
|
|
1036
|
+
const le = /* @__PURE__ */ A(F, [["render", te], ["__scopeId", "data-v-ac9e4515"]]);
|
|
1037
|
+
export {
|
|
1038
|
+
le as default
|
|
1039
|
+
};
|