bitboss-ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/bitboss-ui.es.js +2409 -0
- package/dist/bitboss-ui.umd.js +1 -0
- package/dist/default-theme.css +2811 -0
- package/package.json +50 -0
|
@@ -0,0 +1,2409 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { openBlock, createBlock, createVNode, defineComponent, createElementBlock, Fragment, renderList, toDisplayString, normalizeClass, unref, createCommentVNode, computed, renderSlot, toRefs, ref, onMounted, mergeProps, withModifiers, createTextVNode, createElementVNode, getCurrentInstance, watch, nextTick, withCtx, resolveComponent } from "vue";
|
|
21
|
+
function render$1(_ctx, _cache) {
|
|
22
|
+
return openBlock(), createBlock("svg", {
|
|
23
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24
|
+
viewBox: "0 0 20 20",
|
|
25
|
+
fill: "currentColor",
|
|
26
|
+
"aria-hidden": "true"
|
|
27
|
+
}, [
|
|
28
|
+
createVNode("path", {
|
|
29
|
+
"fill-rule": "evenodd",
|
|
30
|
+
d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
|
|
31
|
+
"clip-rule": "evenodd"
|
|
32
|
+
})
|
|
33
|
+
]);
|
|
34
|
+
}
|
|
35
|
+
const _hoisted_1$6 = { class: "bb-bredcrumbs-container" };
|
|
36
|
+
const _hoisted_2$1 = ["href"];
|
|
37
|
+
const _hoisted_3$1 = {
|
|
38
|
+
key: 1,
|
|
39
|
+
class: "bb-bredcrumbs-no-link"
|
|
40
|
+
};
|
|
41
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
42
|
+
__name: "BbBreadcrumbs",
|
|
43
|
+
props: {
|
|
44
|
+
breadcrumbs: null,
|
|
45
|
+
noLinks: { type: Boolean }
|
|
46
|
+
},
|
|
47
|
+
setup(__props) {
|
|
48
|
+
return (_ctx, _cache) => {
|
|
49
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
50
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.breadcrumbs, (b, i) => {
|
|
51
|
+
return openBlock(), createElementBlock("div", {
|
|
52
|
+
key: i,
|
|
53
|
+
class: "bb-bredcrumbs-item"
|
|
54
|
+
}, [
|
|
55
|
+
i < __props.breadcrumbs.length - 1 && !__props.noLinks ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
56
|
+
b.href ? (openBlock(), createElementBlock("a", {
|
|
57
|
+
key: 0,
|
|
58
|
+
href: b.href,
|
|
59
|
+
class: "bb-bredcrumbs-link"
|
|
60
|
+
}, toDisplayString(b.label), 9, _hoisted_2$1)) : (openBlock(), createElementBlock("div", _hoisted_3$1, toDisplayString(b.label), 1))
|
|
61
|
+
], 64)) : (openBlock(), createElementBlock("div", {
|
|
62
|
+
key: 1,
|
|
63
|
+
class: normalizeClass(["font-bold", {
|
|
64
|
+
"text-bb-primary": !__props.noLinks
|
|
65
|
+
}])
|
|
66
|
+
}, toDisplayString(b.label), 3)),
|
|
67
|
+
i < __props.breadcrumbs.length - 1 ? (openBlock(), createBlock(unref(render$1), {
|
|
68
|
+
key: 2,
|
|
69
|
+
class: "transform-gpu rotate-90 lg:rotate-0 h-4 text-bb-black-500"
|
|
70
|
+
})) : createCommentVNode("", true)
|
|
71
|
+
]);
|
|
72
|
+
}), 128))
|
|
73
|
+
]);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const _hoisted_1$5 = ["checked", "disabled"];
|
|
78
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
79
|
+
__name: "BbCheckbox",
|
|
80
|
+
props: {
|
|
81
|
+
modelValue: null,
|
|
82
|
+
checked: { type: [Boolean, Array] },
|
|
83
|
+
disabled: { type: Boolean }
|
|
84
|
+
},
|
|
85
|
+
emits: ["update:modelValue"],
|
|
86
|
+
setup(__props) {
|
|
87
|
+
const props = __props;
|
|
88
|
+
const proxyChecked = computed(() => {
|
|
89
|
+
if (props.modelValue)
|
|
90
|
+
return props.modelValue;
|
|
91
|
+
return props.checked;
|
|
92
|
+
});
|
|
93
|
+
return (_ctx, _cache) => {
|
|
94
|
+
return openBlock(), createElementBlock("input", {
|
|
95
|
+
type: "checkbox",
|
|
96
|
+
checked: unref(proxyChecked),
|
|
97
|
+
disabled: __props.disabled,
|
|
98
|
+
onInput: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event.target.checked)),
|
|
99
|
+
class: "bb-checkbox"
|
|
100
|
+
}, null, 40, _hoisted_1$5);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const _hoisted_1$4 = ["type"];
|
|
105
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
106
|
+
__name: "BbButton",
|
|
107
|
+
props: {
|
|
108
|
+
type: null,
|
|
109
|
+
secondary: { type: Boolean },
|
|
110
|
+
success: { type: Boolean },
|
|
111
|
+
warning: { type: Boolean },
|
|
112
|
+
danger: { type: Boolean },
|
|
113
|
+
light: { type: Boolean },
|
|
114
|
+
outline: { type: Boolean }
|
|
115
|
+
},
|
|
116
|
+
setup(__props) {
|
|
117
|
+
const props = __props;
|
|
118
|
+
const classes = computed(() => ({
|
|
119
|
+
"bb-btn-primary": !props.secondary && !props.warning && !props.danger && !props.light && !props.outline,
|
|
120
|
+
"bb-btn-primary-light": !props.secondary && !props.warning && !props.danger && props.light && !props.outline,
|
|
121
|
+
"bb-btn-primary-outline": !props.secondary && !props.warning && !props.danger && props.outline,
|
|
122
|
+
"bb-btn-secondary": props.secondary && !props.light && !props.outline,
|
|
123
|
+
"bb-btn-secondary-light": props.secondary && props.light && !props.outline,
|
|
124
|
+
"bb-btn-secondary-outline": props.secondary && props.outline,
|
|
125
|
+
"bb-btn-success": props.success && !props.light && !props.outline,
|
|
126
|
+
"bb-btn-success-light": props.success && props.light && !props.outline,
|
|
127
|
+
"bb-btn-success-outline": props.success && props.outline,
|
|
128
|
+
"bb-btn-warning": props.warning && !props.light && !props.outline,
|
|
129
|
+
"bb-btn-warning-light": props.warning && props.light && !props.outline,
|
|
130
|
+
"bb-btn-warning-outline": props.warning && props.outline,
|
|
131
|
+
"bb-btn-danger": props.danger && !props.light && !props.outline,
|
|
132
|
+
"bb-btn-danger-light": props.danger && props.light && !props.outline,
|
|
133
|
+
"bb-btn-danger-outline": props.danger && props.outline
|
|
134
|
+
}));
|
|
135
|
+
return (_ctx, _cache) => {
|
|
136
|
+
return openBlock(), createElementBlock("button", {
|
|
137
|
+
type: __props.type,
|
|
138
|
+
class: normalizeClass(unref(classes))
|
|
139
|
+
}, [
|
|
140
|
+
renderSlot(_ctx.$slots, "default")
|
|
141
|
+
], 10, _hoisted_1$4);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const _hoisted_1$3 = ["readonly", "value"];
|
|
146
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
147
|
+
__name: "BbInput",
|
|
148
|
+
props: {
|
|
149
|
+
modelValue: null,
|
|
150
|
+
readonly: { type: Boolean }
|
|
151
|
+
},
|
|
152
|
+
emits: ["update:modelValue"],
|
|
153
|
+
setup(__props, { emit }) {
|
|
154
|
+
const props = __props;
|
|
155
|
+
const { readonly } = toRefs(props);
|
|
156
|
+
const input = ref(null);
|
|
157
|
+
const type = ref("text");
|
|
158
|
+
onMounted(() => {
|
|
159
|
+
var _a;
|
|
160
|
+
type.value = (_a = input.value) == null ? void 0 : _a.type;
|
|
161
|
+
handleBlur();
|
|
162
|
+
});
|
|
163
|
+
function handleFocus() {
|
|
164
|
+
if (type.value == "date")
|
|
165
|
+
input.value.type = "date";
|
|
166
|
+
}
|
|
167
|
+
function handleBlur() {
|
|
168
|
+
var _a;
|
|
169
|
+
if (type.value == "date" && !((_a = input.value) == null ? void 0 : _a.value))
|
|
170
|
+
input.value.type = "text";
|
|
171
|
+
}
|
|
172
|
+
function emitValue(event) {
|
|
173
|
+
let val = event.target.value;
|
|
174
|
+
if (event.target.type == "number")
|
|
175
|
+
val = Number(val);
|
|
176
|
+
emit("update:modelValue", val);
|
|
177
|
+
}
|
|
178
|
+
return (_ctx, _cache) => {
|
|
179
|
+
return openBlock(), createElementBlock("input", {
|
|
180
|
+
class: normalizeClass(["bb-input", { readonly: unref(readonly) }]),
|
|
181
|
+
readonly: unref(readonly),
|
|
182
|
+
value: __props.modelValue,
|
|
183
|
+
onInput: emitValue,
|
|
184
|
+
onFocus: handleFocus,
|
|
185
|
+
onBlur: handleBlur,
|
|
186
|
+
ref_key: "input",
|
|
187
|
+
ref: input
|
|
188
|
+
}, null, 42, _hoisted_1$3);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
193
|
+
__name: "BbLink",
|
|
194
|
+
props: {
|
|
195
|
+
secondary: { type: Boolean },
|
|
196
|
+
success: { type: Boolean },
|
|
197
|
+
warning: { type: Boolean },
|
|
198
|
+
danger: { type: Boolean }
|
|
199
|
+
},
|
|
200
|
+
setup(__props) {
|
|
201
|
+
const props = __props;
|
|
202
|
+
const classes = {
|
|
203
|
+
"bb-link-primary": !props.secondary,
|
|
204
|
+
"bb-link-secondary": props.secondary,
|
|
205
|
+
"bb-link-success": props.success,
|
|
206
|
+
"bb-link-warning": props.warning,
|
|
207
|
+
"bb-link-danger": props.danger
|
|
208
|
+
};
|
|
209
|
+
return (_ctx, _cache) => {
|
|
210
|
+
return openBlock(), createElementBlock("a", {
|
|
211
|
+
class: normalizeClass(classes)
|
|
212
|
+
}, [
|
|
213
|
+
renderSlot(_ctx.$slots, "default")
|
|
214
|
+
]);
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
const _hoisted_1$2 = ["checked", "disabled"];
|
|
219
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
220
|
+
__name: "BbRadio",
|
|
221
|
+
props: {
|
|
222
|
+
modelValue: null,
|
|
223
|
+
checked: { type: [Boolean, Array] },
|
|
224
|
+
disabled: { type: Boolean }
|
|
225
|
+
},
|
|
226
|
+
emits: ["update:modelValue"],
|
|
227
|
+
setup(__props) {
|
|
228
|
+
const props = __props;
|
|
229
|
+
const proxyChecked = computed(() => {
|
|
230
|
+
if (props.modelValue)
|
|
231
|
+
return props.modelValue;
|
|
232
|
+
return props.checked;
|
|
233
|
+
});
|
|
234
|
+
return (_ctx, _cache) => {
|
|
235
|
+
return openBlock(), createElementBlock("input", {
|
|
236
|
+
type: "radio",
|
|
237
|
+
checked: unref(proxyChecked),
|
|
238
|
+
disabled: __props.disabled,
|
|
239
|
+
onInput: _cache[0] || (_cache[0] = ($event) => {
|
|
240
|
+
var _a;
|
|
241
|
+
return _ctx.$emit("update:modelValue", (_a = $event.target) == null ? void 0 : _a.checked);
|
|
242
|
+
}),
|
|
243
|
+
class: "bb-radio"
|
|
244
|
+
}, null, 40, _hoisted_1$2);
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
function isNullish(val) {
|
|
249
|
+
return [null, void 0].indexOf(val) !== -1;
|
|
250
|
+
}
|
|
251
|
+
function useData(props, context, dep) {
|
|
252
|
+
const { object, valueProp, mode } = toRefs(props);
|
|
253
|
+
const $this = getCurrentInstance().proxy;
|
|
254
|
+
const iv = dep.iv;
|
|
255
|
+
const update = (val) => {
|
|
256
|
+
iv.value = makeInternal(val);
|
|
257
|
+
const externalVal = makeExternal(val);
|
|
258
|
+
context.emit("change", externalVal, $this);
|
|
259
|
+
context.emit("input", externalVal);
|
|
260
|
+
context.emit("update:modelValue", externalVal);
|
|
261
|
+
};
|
|
262
|
+
const makeExternal = (val) => {
|
|
263
|
+
if (object.value) {
|
|
264
|
+
return val;
|
|
265
|
+
}
|
|
266
|
+
if (isNullish(val)) {
|
|
267
|
+
return val;
|
|
268
|
+
}
|
|
269
|
+
return !Array.isArray(val) ? val[valueProp.value] : val.map((v) => v[valueProp.value]);
|
|
270
|
+
};
|
|
271
|
+
const makeInternal = (val) => {
|
|
272
|
+
if (isNullish(val)) {
|
|
273
|
+
return mode.value === "single" ? {} : [];
|
|
274
|
+
}
|
|
275
|
+
return val;
|
|
276
|
+
};
|
|
277
|
+
return {
|
|
278
|
+
update
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function useValue(props, context) {
|
|
282
|
+
const { value, modelValue, mode, valueProp } = toRefs(props);
|
|
283
|
+
const iv = ref(mode.value !== "single" ? [] : {});
|
|
284
|
+
const ev = context.expose !== void 0 ? modelValue : value;
|
|
285
|
+
const plainValue = computed(() => {
|
|
286
|
+
return mode.value === "single" ? iv.value[valueProp.value] : iv.value.map((v) => v[valueProp.value]);
|
|
287
|
+
});
|
|
288
|
+
const textValue = computed(() => {
|
|
289
|
+
return mode.value !== "single" ? iv.value.map((v) => v[valueProp.value]).join(",") : iv.value[valueProp.value];
|
|
290
|
+
});
|
|
291
|
+
return {
|
|
292
|
+
iv,
|
|
293
|
+
internalValue: iv,
|
|
294
|
+
ev,
|
|
295
|
+
externalValue: ev,
|
|
296
|
+
textValue,
|
|
297
|
+
plainValue
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function useSearch(props, context, dep) {
|
|
301
|
+
const { regex } = toRefs(props);
|
|
302
|
+
const $this = getCurrentInstance().proxy;
|
|
303
|
+
const isOpen = dep.isOpen;
|
|
304
|
+
const open = dep.open;
|
|
305
|
+
const search = ref(null);
|
|
306
|
+
const input = ref(null);
|
|
307
|
+
const clearSearch = () => {
|
|
308
|
+
search.value = "";
|
|
309
|
+
};
|
|
310
|
+
const handleSearchInput = (e) => {
|
|
311
|
+
search.value = e.target.value;
|
|
312
|
+
};
|
|
313
|
+
const handleKeypress = (e) => {
|
|
314
|
+
if (regex && regex.value) {
|
|
315
|
+
let regexp = regex.value;
|
|
316
|
+
if (typeof regexp === "string") {
|
|
317
|
+
regexp = new RegExp(regexp);
|
|
318
|
+
}
|
|
319
|
+
if (!e.key.match(regexp)) {
|
|
320
|
+
e.preventDefault();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
const handlePaste = (e) => {
|
|
325
|
+
if (regex && regex.value) {
|
|
326
|
+
let clipboardData = e.clipboardData || window.clipboardData;
|
|
327
|
+
let pastedData = clipboardData.getData("Text");
|
|
328
|
+
let regexp = regex.value;
|
|
329
|
+
if (typeof regexp === "string") {
|
|
330
|
+
regexp = new RegExp(regexp);
|
|
331
|
+
}
|
|
332
|
+
if (!pastedData.split("").every((c) => !!c.match(regexp))) {
|
|
333
|
+
e.preventDefault();
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
context.emit("paste", e, $this);
|
|
337
|
+
};
|
|
338
|
+
watch(search, (val) => {
|
|
339
|
+
if (!isOpen.value && val) {
|
|
340
|
+
open();
|
|
341
|
+
}
|
|
342
|
+
context.emit("search-change", val, $this);
|
|
343
|
+
});
|
|
344
|
+
return {
|
|
345
|
+
search,
|
|
346
|
+
input,
|
|
347
|
+
clearSearch,
|
|
348
|
+
handleSearchInput,
|
|
349
|
+
handleKeypress,
|
|
350
|
+
handlePaste
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function usePointer$1(props, context, dep) {
|
|
354
|
+
const { groupSelect, mode, groups, disabledProp } = toRefs(props);
|
|
355
|
+
const pointer = ref(null);
|
|
356
|
+
const setPointer = (option) => {
|
|
357
|
+
if (option === void 0 || option !== null && option[disabledProp.value]) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (groups.value && option && option.group && (mode.value === "single" || !groupSelect.value)) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
pointer.value = option;
|
|
364
|
+
};
|
|
365
|
+
const clearPointer = () => {
|
|
366
|
+
setPointer(null);
|
|
367
|
+
};
|
|
368
|
+
return {
|
|
369
|
+
pointer,
|
|
370
|
+
setPointer,
|
|
371
|
+
clearPointer
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function normalize(str, strict = true) {
|
|
375
|
+
return strict ? String(str).toLowerCase().trim() : String(str).normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase().trim();
|
|
376
|
+
}
|
|
377
|
+
function isObject(variable) {
|
|
378
|
+
return Object.prototype.toString.call(variable) === "[object Object]";
|
|
379
|
+
}
|
|
380
|
+
function arraysEqual(array1, array2) {
|
|
381
|
+
const array2Sorted = array2.slice().sort();
|
|
382
|
+
return array1.length === array2.length && array1.slice().sort().every(function(value, index2) {
|
|
383
|
+
return value === array2Sorted[index2];
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
function useOptions(props, context, dep) {
|
|
387
|
+
const {
|
|
388
|
+
options,
|
|
389
|
+
mode,
|
|
390
|
+
trackBy: trackBy_,
|
|
391
|
+
limit,
|
|
392
|
+
hideSelected,
|
|
393
|
+
createTag,
|
|
394
|
+
createOption: createOption_,
|
|
395
|
+
label,
|
|
396
|
+
appendNewTag,
|
|
397
|
+
appendNewOption: appendNewOption_,
|
|
398
|
+
multipleLabel,
|
|
399
|
+
object,
|
|
400
|
+
loading,
|
|
401
|
+
delay,
|
|
402
|
+
resolveOnLoad,
|
|
403
|
+
minChars,
|
|
404
|
+
filterResults,
|
|
405
|
+
clearOnSearch,
|
|
406
|
+
clearOnSelect,
|
|
407
|
+
valueProp,
|
|
408
|
+
canDeselect,
|
|
409
|
+
max,
|
|
410
|
+
strict,
|
|
411
|
+
closeOnSelect,
|
|
412
|
+
groups: groupped,
|
|
413
|
+
reverse,
|
|
414
|
+
infinite,
|
|
415
|
+
groupOptions,
|
|
416
|
+
groupHideEmpty,
|
|
417
|
+
groupSelect,
|
|
418
|
+
onCreate,
|
|
419
|
+
disabledProp,
|
|
420
|
+
searchStart
|
|
421
|
+
} = toRefs(props);
|
|
422
|
+
const $this = getCurrentInstance().proxy;
|
|
423
|
+
const iv = dep.iv;
|
|
424
|
+
const ev = dep.ev;
|
|
425
|
+
const search = dep.search;
|
|
426
|
+
const clearSearch = dep.clearSearch;
|
|
427
|
+
const update = dep.update;
|
|
428
|
+
const pointer = dep.pointer;
|
|
429
|
+
const clearPointer = dep.clearPointer;
|
|
430
|
+
const focus = dep.focus;
|
|
431
|
+
const deactivate = dep.deactivate;
|
|
432
|
+
const close = dep.close;
|
|
433
|
+
const ap = ref([]);
|
|
434
|
+
const ro = ref([]);
|
|
435
|
+
const resolving = ref(false);
|
|
436
|
+
const searchWatcher = ref(null);
|
|
437
|
+
const offset = ref(infinite.value && limit.value === -1 ? 10 : limit.value);
|
|
438
|
+
const createOption = computed(() => {
|
|
439
|
+
return createTag.value || createOption_.value || false;
|
|
440
|
+
});
|
|
441
|
+
const appendNewOption = computed(() => {
|
|
442
|
+
if (appendNewTag.value !== void 0) {
|
|
443
|
+
return appendNewTag.value;
|
|
444
|
+
} else if (appendNewOption_.value !== void 0) {
|
|
445
|
+
return appendNewOption_.value;
|
|
446
|
+
}
|
|
447
|
+
return true;
|
|
448
|
+
});
|
|
449
|
+
const eo = computed(() => {
|
|
450
|
+
if (groupped.value) {
|
|
451
|
+
let groups = ro.value || [];
|
|
452
|
+
let eo2 = [];
|
|
453
|
+
groups.forEach((group) => {
|
|
454
|
+
optionsToArray(group[groupOptions.value]).forEach((option) => {
|
|
455
|
+
eo2.push(Object.assign({}, option, group[disabledProp.value] ? { [disabledProp.value]: true } : {}));
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
return eo2;
|
|
459
|
+
} else {
|
|
460
|
+
let eo2 = optionsToArray(ro.value || []);
|
|
461
|
+
if (ap.value.length) {
|
|
462
|
+
eo2 = eo2.concat(ap.value);
|
|
463
|
+
}
|
|
464
|
+
return eo2;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
const fg = computed(() => {
|
|
468
|
+
if (!groupped.value) {
|
|
469
|
+
return [];
|
|
470
|
+
}
|
|
471
|
+
return filterGroups((ro.value || []).map((group) => {
|
|
472
|
+
const arrayOptions = optionsToArray(group[groupOptions.value]);
|
|
473
|
+
return __spreadProps(__spreadValues({}, group), {
|
|
474
|
+
group: true,
|
|
475
|
+
[groupOptions.value]: filterOptions(arrayOptions, false).map((o) => Object.assign({}, o, group[disabledProp.value] ? { [disabledProp.value]: true } : {})),
|
|
476
|
+
__VISIBLE__: filterOptions(arrayOptions).map((o) => Object.assign({}, o, group[disabledProp.value] ? { [disabledProp.value]: true } : {}))
|
|
477
|
+
});
|
|
478
|
+
}));
|
|
479
|
+
});
|
|
480
|
+
const pfo = computed(() => {
|
|
481
|
+
let options2 = eo.value;
|
|
482
|
+
if (reverse.value) {
|
|
483
|
+
options2 = options2.reverse();
|
|
484
|
+
}
|
|
485
|
+
if (createdOption.value.length) {
|
|
486
|
+
options2 = createdOption.value.concat(options2);
|
|
487
|
+
}
|
|
488
|
+
return filterOptions(options2);
|
|
489
|
+
});
|
|
490
|
+
const fo = computed(() => {
|
|
491
|
+
let options2 = pfo.value;
|
|
492
|
+
if (offset.value > 0) {
|
|
493
|
+
options2 = options2.slice(0, offset.value);
|
|
494
|
+
}
|
|
495
|
+
return options2;
|
|
496
|
+
});
|
|
497
|
+
const hasSelected = computed(() => {
|
|
498
|
+
switch (mode.value) {
|
|
499
|
+
case "single":
|
|
500
|
+
return !isNullish(iv.value[valueProp.value]);
|
|
501
|
+
case "multiple":
|
|
502
|
+
case "tags":
|
|
503
|
+
return !isNullish(iv.value) && iv.value.length > 0;
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
const multipleLabelText = computed(() => {
|
|
507
|
+
return multipleLabel !== void 0 && multipleLabel.value !== void 0 ? multipleLabel.value(iv.value, $this) : iv.value && iv.value.length > 1 ? `${iv.value.length} options selected` : `1 option selected`;
|
|
508
|
+
});
|
|
509
|
+
const noOptions = computed(() => {
|
|
510
|
+
return !eo.value.length && !resolving.value && !createdOption.value.length;
|
|
511
|
+
});
|
|
512
|
+
const noResults = computed(() => {
|
|
513
|
+
return eo.value.length > 0 && fo.value.length == 0 && (search.value && groupped.value || !groupped.value);
|
|
514
|
+
});
|
|
515
|
+
const createdOption = computed(() => {
|
|
516
|
+
if (createOption.value === false || !search.value) {
|
|
517
|
+
return [];
|
|
518
|
+
}
|
|
519
|
+
return getOptionByTrackBy(search.value) !== -1 ? [] : [{
|
|
520
|
+
[valueProp.value]: search.value,
|
|
521
|
+
[label.value]: search.value,
|
|
522
|
+
[trackBy.value]: search.value,
|
|
523
|
+
__CREATE__: true
|
|
524
|
+
}];
|
|
525
|
+
});
|
|
526
|
+
const trackBy = computed(() => {
|
|
527
|
+
return trackBy_.value || label.value;
|
|
528
|
+
});
|
|
529
|
+
const nullValue = computed(() => {
|
|
530
|
+
switch (mode.value) {
|
|
531
|
+
case "single":
|
|
532
|
+
return null;
|
|
533
|
+
case "multiple":
|
|
534
|
+
case "tags":
|
|
535
|
+
return [];
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
const busy = computed(() => {
|
|
539
|
+
return loading.value || resolving.value;
|
|
540
|
+
});
|
|
541
|
+
const select = (option) => {
|
|
542
|
+
if (typeof option !== "object") {
|
|
543
|
+
option = getOption(option);
|
|
544
|
+
}
|
|
545
|
+
switch (mode.value) {
|
|
546
|
+
case "single":
|
|
547
|
+
update(option);
|
|
548
|
+
break;
|
|
549
|
+
case "multiple":
|
|
550
|
+
case "tags":
|
|
551
|
+
update(iv.value.concat(option));
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
context.emit("select", finalValue(option), option, $this);
|
|
555
|
+
};
|
|
556
|
+
const deselect = (option) => {
|
|
557
|
+
if (typeof option !== "object") {
|
|
558
|
+
option = getOption(option);
|
|
559
|
+
}
|
|
560
|
+
switch (mode.value) {
|
|
561
|
+
case "single":
|
|
562
|
+
clear();
|
|
563
|
+
break;
|
|
564
|
+
case "tags":
|
|
565
|
+
case "multiple":
|
|
566
|
+
update(Array.isArray(option) ? iv.value.filter((v) => option.map((o) => o[valueProp.value]).indexOf(v[valueProp.value]) === -1) : iv.value.filter((v) => v[valueProp.value] != option[valueProp.value]));
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
context.emit("deselect", finalValue(option), option, $this);
|
|
570
|
+
};
|
|
571
|
+
const finalValue = (option) => {
|
|
572
|
+
return object.value ? option : option[valueProp.value];
|
|
573
|
+
};
|
|
574
|
+
const remove = (option) => {
|
|
575
|
+
deselect(option);
|
|
576
|
+
};
|
|
577
|
+
const handleTagRemove = (option, e) => {
|
|
578
|
+
if (e.button !== 0) {
|
|
579
|
+
e.preventDefault();
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
remove(option);
|
|
583
|
+
};
|
|
584
|
+
const clear = () => {
|
|
585
|
+
context.emit("clear", $this);
|
|
586
|
+
update(nullValue.value);
|
|
587
|
+
};
|
|
588
|
+
const isSelected = (option) => {
|
|
589
|
+
if (option.group !== void 0) {
|
|
590
|
+
return mode.value === "single" ? false : areAllSelected(option[groupOptions.value]) && option[groupOptions.value].length;
|
|
591
|
+
}
|
|
592
|
+
switch (mode.value) {
|
|
593
|
+
case "single":
|
|
594
|
+
return !isNullish(iv.value) && iv.value[valueProp.value] == option[valueProp.value];
|
|
595
|
+
case "tags":
|
|
596
|
+
case "multiple":
|
|
597
|
+
return !isNullish(iv.value) && iv.value.map((o) => o[valueProp.value]).indexOf(option[valueProp.value]) !== -1;
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
const isDisabled = (option) => {
|
|
601
|
+
return option[disabledProp.value] === true;
|
|
602
|
+
};
|
|
603
|
+
const isMax = () => {
|
|
604
|
+
if (max === void 0 || max.value === -1 || !hasSelected.value && max.value > 0) {
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
return iv.value.length >= max.value;
|
|
608
|
+
};
|
|
609
|
+
const handleOptionClick = (option) => {
|
|
610
|
+
if (isDisabled(option)) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
if (onCreate && onCreate.value && !isSelected(option) && option.__CREATE__) {
|
|
614
|
+
option = __spreadValues({}, option);
|
|
615
|
+
delete option.__CREATE__;
|
|
616
|
+
option = onCreate.value(option, $this);
|
|
617
|
+
if (option instanceof Promise) {
|
|
618
|
+
resolving.value = true;
|
|
619
|
+
option.then((result) => {
|
|
620
|
+
resolving.value = false;
|
|
621
|
+
handleOptionSelect(result);
|
|
622
|
+
});
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
handleOptionSelect(option);
|
|
627
|
+
};
|
|
628
|
+
const handleOptionSelect = (option) => {
|
|
629
|
+
if (option.__CREATE__) {
|
|
630
|
+
option = __spreadValues({}, option);
|
|
631
|
+
delete option.__CREATE__;
|
|
632
|
+
}
|
|
633
|
+
switch (mode.value) {
|
|
634
|
+
case "single":
|
|
635
|
+
if (option && isSelected(option)) {
|
|
636
|
+
if (canDeselect.value) {
|
|
637
|
+
deselect(option);
|
|
638
|
+
}
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
if (option) {
|
|
642
|
+
handleOptionAppend(option);
|
|
643
|
+
}
|
|
644
|
+
if (clearOnSelect.value) {
|
|
645
|
+
clearSearch();
|
|
646
|
+
}
|
|
647
|
+
if (closeOnSelect.value) {
|
|
648
|
+
clearPointer();
|
|
649
|
+
close();
|
|
650
|
+
}
|
|
651
|
+
if (option) {
|
|
652
|
+
select(option);
|
|
653
|
+
}
|
|
654
|
+
break;
|
|
655
|
+
case "multiple":
|
|
656
|
+
if (option && isSelected(option)) {
|
|
657
|
+
deselect(option);
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
if (isMax()) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
if (option) {
|
|
664
|
+
handleOptionAppend(option);
|
|
665
|
+
select(option);
|
|
666
|
+
}
|
|
667
|
+
if (clearOnSelect.value) {
|
|
668
|
+
clearSearch();
|
|
669
|
+
}
|
|
670
|
+
if (hideSelected.value) {
|
|
671
|
+
clearPointer();
|
|
672
|
+
}
|
|
673
|
+
if (closeOnSelect.value) {
|
|
674
|
+
close();
|
|
675
|
+
}
|
|
676
|
+
break;
|
|
677
|
+
case "tags":
|
|
678
|
+
if (option && isSelected(option)) {
|
|
679
|
+
deselect(option);
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
if (isMax()) {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
if (option) {
|
|
686
|
+
handleOptionAppend(option);
|
|
687
|
+
}
|
|
688
|
+
if (clearOnSelect.value) {
|
|
689
|
+
clearSearch();
|
|
690
|
+
}
|
|
691
|
+
if (option) {
|
|
692
|
+
select(option);
|
|
693
|
+
}
|
|
694
|
+
if (hideSelected.value) {
|
|
695
|
+
clearPointer();
|
|
696
|
+
}
|
|
697
|
+
if (closeOnSelect.value) {
|
|
698
|
+
close();
|
|
699
|
+
}
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
if (!closeOnSelect.value) {
|
|
703
|
+
focus();
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
const handleGroupClick = (group) => {
|
|
707
|
+
if (isDisabled(group) || mode.value === "single" || !groupSelect.value) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
switch (mode.value) {
|
|
711
|
+
case "multiple":
|
|
712
|
+
case "tags":
|
|
713
|
+
if (areAllEnabledSelected(group[groupOptions.value])) {
|
|
714
|
+
deselect(group[groupOptions.value]);
|
|
715
|
+
} else {
|
|
716
|
+
select(group[groupOptions.value].filter((o) => iv.value.map((v) => v[valueProp.value]).indexOf(o[valueProp.value]) === -1).filter((o) => !o[disabledProp.value]).filter((o, k) => iv.value.length + 1 + k <= max.value || max.value === -1));
|
|
717
|
+
}
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
if (closeOnSelect.value) {
|
|
721
|
+
deactivate();
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
const handleOptionAppend = (option) => {
|
|
725
|
+
if (getOption(option[valueProp.value]) === void 0 && createOption.value) {
|
|
726
|
+
context.emit("tag", option[valueProp.value], $this);
|
|
727
|
+
context.emit("option", option[valueProp.value], $this);
|
|
728
|
+
if (appendNewOption.value) {
|
|
729
|
+
appendOption(option);
|
|
730
|
+
}
|
|
731
|
+
clearSearch();
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
const selectAll = () => {
|
|
735
|
+
if (mode.value === "single") {
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
select(fo.value);
|
|
739
|
+
};
|
|
740
|
+
const areAllEnabledSelected = (options2) => {
|
|
741
|
+
return options2.find((o) => !isSelected(o) && !o[disabledProp.value]) === void 0;
|
|
742
|
+
};
|
|
743
|
+
const areAllSelected = (options2) => {
|
|
744
|
+
return options2.find((o) => !isSelected(o)) === void 0;
|
|
745
|
+
};
|
|
746
|
+
const getOption = (val) => {
|
|
747
|
+
return eo.value[eo.value.map((o) => String(o[valueProp.value])).indexOf(String(val))];
|
|
748
|
+
};
|
|
749
|
+
const getOptionByTrackBy = (val, norm) => {
|
|
750
|
+
return eo.value.map((o) => parseInt(o[trackBy.value]) == o[trackBy.value] ? parseInt(o[trackBy.value]) : o[trackBy.value]).indexOf(parseInt(val) == val ? parseInt(val) : val);
|
|
751
|
+
};
|
|
752
|
+
const shouldHideOption = (option) => {
|
|
753
|
+
return ["tags", "multiple"].indexOf(mode.value) !== -1 && hideSelected.value && isSelected(option);
|
|
754
|
+
};
|
|
755
|
+
const appendOption = (option) => {
|
|
756
|
+
ap.value.push(option);
|
|
757
|
+
};
|
|
758
|
+
const filterGroups = (groups) => {
|
|
759
|
+
return groupHideEmpty.value ? groups.filter((g) => search.value ? g.__VISIBLE__.length : g[groupOptions.value].length) : groups.filter((g) => search.value ? g.__VISIBLE__.length : true);
|
|
760
|
+
};
|
|
761
|
+
const filterOptions = (options2, excludeHideSelected = true) => {
|
|
762
|
+
let fo2 = options2;
|
|
763
|
+
if (search.value && filterResults.value) {
|
|
764
|
+
fo2 = fo2.filter((option) => {
|
|
765
|
+
return searchStart.value ? normalize(option[trackBy.value], strict.value).startsWith(normalize(search.value, strict.value)) : normalize(option[trackBy.value], strict.value).indexOf(normalize(search.value, strict.value)) !== -1;
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
if (hideSelected.value && excludeHideSelected) {
|
|
769
|
+
fo2 = fo2.filter((option) => !shouldHideOption(option));
|
|
770
|
+
}
|
|
771
|
+
return fo2;
|
|
772
|
+
};
|
|
773
|
+
const optionsToArray = (options2) => {
|
|
774
|
+
let uo = options2;
|
|
775
|
+
if (isObject(uo)) {
|
|
776
|
+
uo = Object.keys(uo).map((key) => {
|
|
777
|
+
let val = uo[key];
|
|
778
|
+
return { [valueProp.value]: key, [trackBy.value]: val, [label.value]: val };
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
uo = uo.map((val) => {
|
|
782
|
+
return typeof val === "object" ? val : { [valueProp.value]: val, [trackBy.value]: val, [label.value]: val };
|
|
783
|
+
});
|
|
784
|
+
return uo;
|
|
785
|
+
};
|
|
786
|
+
const initInternalValue = () => {
|
|
787
|
+
if (!isNullish(ev.value)) {
|
|
788
|
+
iv.value = makeInternal(ev.value);
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
const resolveOptions = (callback) => {
|
|
792
|
+
resolving.value = true;
|
|
793
|
+
return new Promise((resolve, reject) => {
|
|
794
|
+
options.value(search.value, $this).then((response) => {
|
|
795
|
+
ro.value = response || [];
|
|
796
|
+
if (typeof callback == "function") {
|
|
797
|
+
callback(response);
|
|
798
|
+
}
|
|
799
|
+
resolving.value = false;
|
|
800
|
+
}).catch((e) => {
|
|
801
|
+
console.error(e);
|
|
802
|
+
ro.value = [];
|
|
803
|
+
resolving.value = false;
|
|
804
|
+
}).finally(() => {
|
|
805
|
+
resolve();
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
};
|
|
809
|
+
const refreshLabels = () => {
|
|
810
|
+
if (!hasSelected.value) {
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
if (mode.value === "single") {
|
|
814
|
+
let option = getOption(iv.value[valueProp.value]);
|
|
815
|
+
if (option !== void 0) {
|
|
816
|
+
let newLabel = option[label.value];
|
|
817
|
+
iv.value[label.value] = newLabel;
|
|
818
|
+
if (object.value) {
|
|
819
|
+
ev.value[label.value] = newLabel;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
} else {
|
|
823
|
+
iv.value.forEach((val, i) => {
|
|
824
|
+
let option = getOption(iv.value[i][valueProp.value]);
|
|
825
|
+
if (option !== void 0) {
|
|
826
|
+
let newLabel = option[label.value];
|
|
827
|
+
iv.value[i][label.value] = newLabel;
|
|
828
|
+
if (object.value) {
|
|
829
|
+
ev.value[i][label.value] = newLabel;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
const refreshOptions = (callback) => {
|
|
836
|
+
resolveOptions(callback);
|
|
837
|
+
};
|
|
838
|
+
const makeInternal = (val) => {
|
|
839
|
+
if (isNullish(val)) {
|
|
840
|
+
return mode.value === "single" ? {} : [];
|
|
841
|
+
}
|
|
842
|
+
if (object.value) {
|
|
843
|
+
return val;
|
|
844
|
+
}
|
|
845
|
+
return mode.value === "single" ? getOption(val) || {} : val.filter((v) => !!getOption(v)).map((v) => getOption(v));
|
|
846
|
+
};
|
|
847
|
+
const initSearchWatcher = () => {
|
|
848
|
+
searchWatcher.value = watch(search, (query) => {
|
|
849
|
+
if (query.length < minChars.value || !query && minChars.value !== 0) {
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
resolving.value = true;
|
|
853
|
+
if (clearOnSearch.value) {
|
|
854
|
+
ro.value = [];
|
|
855
|
+
}
|
|
856
|
+
setTimeout(() => {
|
|
857
|
+
if (query != search.value) {
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
options.value(search.value, $this).then((response) => {
|
|
861
|
+
if (query == search.value || !search.value) {
|
|
862
|
+
ro.value = response;
|
|
863
|
+
pointer.value = fo.value.filter((o) => o[disabledProp.value] !== true)[0] || null;
|
|
864
|
+
resolving.value = false;
|
|
865
|
+
}
|
|
866
|
+
}).catch((e) => {
|
|
867
|
+
console.error(e);
|
|
868
|
+
});
|
|
869
|
+
}, delay.value);
|
|
870
|
+
}, { flush: "sync" });
|
|
871
|
+
};
|
|
872
|
+
if (mode.value !== "single" && !isNullish(ev.value) && !Array.isArray(ev.value)) {
|
|
873
|
+
throw new Error(`v-model must be an array when using "${mode.value}" mode`);
|
|
874
|
+
}
|
|
875
|
+
if (options && typeof options.value == "function") {
|
|
876
|
+
if (resolveOnLoad.value) {
|
|
877
|
+
resolveOptions(initInternalValue);
|
|
878
|
+
} else if (object.value == true) {
|
|
879
|
+
initInternalValue();
|
|
880
|
+
}
|
|
881
|
+
} else {
|
|
882
|
+
ro.value = options.value;
|
|
883
|
+
initInternalValue();
|
|
884
|
+
}
|
|
885
|
+
if (delay.value > -1) {
|
|
886
|
+
initSearchWatcher();
|
|
887
|
+
}
|
|
888
|
+
watch(delay, (value, old) => {
|
|
889
|
+
if (searchWatcher.value) {
|
|
890
|
+
searchWatcher.value();
|
|
891
|
+
}
|
|
892
|
+
if (value >= 0) {
|
|
893
|
+
initSearchWatcher();
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
watch(ev, (newValue) => {
|
|
897
|
+
if (isNullish(newValue)) {
|
|
898
|
+
iv.value = makeInternal(newValue);
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
switch (mode.value) {
|
|
902
|
+
case "single":
|
|
903
|
+
if (object.value ? newValue[valueProp.value] != iv.value[valueProp.value] : newValue != iv.value[valueProp.value]) {
|
|
904
|
+
iv.value = makeInternal(newValue);
|
|
905
|
+
}
|
|
906
|
+
break;
|
|
907
|
+
case "multiple":
|
|
908
|
+
case "tags":
|
|
909
|
+
if (!arraysEqual(object.value ? newValue.map((o) => o[valueProp.value]) : newValue, iv.value.map((o) => o[valueProp.value]))) {
|
|
910
|
+
iv.value = makeInternal(newValue);
|
|
911
|
+
}
|
|
912
|
+
break;
|
|
913
|
+
}
|
|
914
|
+
}, { deep: true });
|
|
915
|
+
watch(options, (n, o) => {
|
|
916
|
+
if (typeof props.options === "function") {
|
|
917
|
+
if (resolveOnLoad.value) {
|
|
918
|
+
resolveOptions();
|
|
919
|
+
}
|
|
920
|
+
} else {
|
|
921
|
+
ro.value = props.options;
|
|
922
|
+
if (!Object.keys(iv.value).length) {
|
|
923
|
+
initInternalValue();
|
|
924
|
+
}
|
|
925
|
+
refreshLabels();
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
watch(label, refreshLabels);
|
|
929
|
+
return {
|
|
930
|
+
pfo,
|
|
931
|
+
fo,
|
|
932
|
+
filteredOptions: fo,
|
|
933
|
+
hasSelected,
|
|
934
|
+
multipleLabelText,
|
|
935
|
+
eo,
|
|
936
|
+
extendedOptions: eo,
|
|
937
|
+
fg,
|
|
938
|
+
filteredGroups: fg,
|
|
939
|
+
noOptions,
|
|
940
|
+
noResults,
|
|
941
|
+
resolving,
|
|
942
|
+
busy,
|
|
943
|
+
offset,
|
|
944
|
+
select,
|
|
945
|
+
deselect,
|
|
946
|
+
remove,
|
|
947
|
+
selectAll,
|
|
948
|
+
clear,
|
|
949
|
+
isSelected,
|
|
950
|
+
isDisabled,
|
|
951
|
+
isMax,
|
|
952
|
+
getOption,
|
|
953
|
+
handleOptionClick,
|
|
954
|
+
handleGroupClick,
|
|
955
|
+
handleTagRemove,
|
|
956
|
+
refreshOptions,
|
|
957
|
+
resolveOptions,
|
|
958
|
+
refreshLabels
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
function usePointer(props, context, dep) {
|
|
962
|
+
const {
|
|
963
|
+
valueProp,
|
|
964
|
+
showOptions,
|
|
965
|
+
searchable,
|
|
966
|
+
groupLabel,
|
|
967
|
+
groups: groupped,
|
|
968
|
+
mode,
|
|
969
|
+
groupSelect,
|
|
970
|
+
disabledProp
|
|
971
|
+
} = toRefs(props);
|
|
972
|
+
const fo = dep.fo;
|
|
973
|
+
const fg = dep.fg;
|
|
974
|
+
const handleOptionClick = dep.handleOptionClick;
|
|
975
|
+
const handleGroupClick = dep.handleGroupClick;
|
|
976
|
+
const search = dep.search;
|
|
977
|
+
const pointer = dep.pointer;
|
|
978
|
+
const setPointer = dep.setPointer;
|
|
979
|
+
const clearPointer = dep.clearPointer;
|
|
980
|
+
const multiselect = dep.multiselect;
|
|
981
|
+
const isOpen = dep.isOpen;
|
|
982
|
+
const options = computed(() => {
|
|
983
|
+
return fo.value.filter((o) => !o[disabledProp.value]);
|
|
984
|
+
});
|
|
985
|
+
const groups = computed(() => {
|
|
986
|
+
return fg.value.filter((o) => !o[disabledProp.value]);
|
|
987
|
+
});
|
|
988
|
+
const canPointGroups = computed(() => {
|
|
989
|
+
return mode.value !== "single" && groupSelect.value;
|
|
990
|
+
});
|
|
991
|
+
const isPointerGroup = computed(() => {
|
|
992
|
+
return pointer.value && pointer.value.group;
|
|
993
|
+
});
|
|
994
|
+
const currentGroup = computed(() => {
|
|
995
|
+
return getParentGroup(pointer.value);
|
|
996
|
+
});
|
|
997
|
+
const prevGroup = computed(() => {
|
|
998
|
+
const group = isPointerGroup.value ? pointer.value : getParentGroup(pointer.value);
|
|
999
|
+
const groupIndex = groups.value.map((g) => g[groupLabel.value]).indexOf(group[groupLabel.value]);
|
|
1000
|
+
let prevGroup2 = groups.value[groupIndex - 1];
|
|
1001
|
+
if (prevGroup2 === void 0) {
|
|
1002
|
+
prevGroup2 = lastGroup.value;
|
|
1003
|
+
}
|
|
1004
|
+
return prevGroup2;
|
|
1005
|
+
});
|
|
1006
|
+
const nextGroup = computed(() => {
|
|
1007
|
+
let nextIndex = groups.value.map((g) => g.label).indexOf(isPointerGroup.value ? pointer.value[groupLabel.value] : getParentGroup(pointer.value)[groupLabel.value]) + 1;
|
|
1008
|
+
if (groups.value.length <= nextIndex) {
|
|
1009
|
+
nextIndex = 0;
|
|
1010
|
+
}
|
|
1011
|
+
return groups.value[nextIndex];
|
|
1012
|
+
});
|
|
1013
|
+
const lastGroup = computed(() => {
|
|
1014
|
+
return [...groups.value].slice(-1)[0];
|
|
1015
|
+
});
|
|
1016
|
+
const currentGroupFirstEnabledOption = computed(() => {
|
|
1017
|
+
return pointer.value.__VISIBLE__.filter((o) => !o[disabledProp.value])[0];
|
|
1018
|
+
});
|
|
1019
|
+
const currentGroupPrevEnabledOption = computed(() => {
|
|
1020
|
+
const options2 = currentGroup.value.__VISIBLE__.filter((o) => !o[disabledProp.value]);
|
|
1021
|
+
return options2[options2.map((o) => o[valueProp.value]).indexOf(pointer.value[valueProp.value]) - 1];
|
|
1022
|
+
});
|
|
1023
|
+
const currentGroupNextEnabledOption = computed(() => {
|
|
1024
|
+
const options2 = getParentGroup(pointer.value).__VISIBLE__.filter((o) => !o[disabledProp.value]);
|
|
1025
|
+
return options2[options2.map((o) => o[valueProp.value]).indexOf(pointer.value[valueProp.value]) + 1];
|
|
1026
|
+
});
|
|
1027
|
+
const prevGroupLastEnabledOption = computed(() => {
|
|
1028
|
+
return [...prevGroup.value.__VISIBLE__.filter((o) => !o[disabledProp.value])].slice(-1)[0];
|
|
1029
|
+
});
|
|
1030
|
+
const lastGroupLastEnabledOption = computed(() => {
|
|
1031
|
+
return [...lastGroup.value.__VISIBLE__.filter((o) => !o[disabledProp.value])].slice(-1)[0];
|
|
1032
|
+
});
|
|
1033
|
+
const isPointed = (option) => {
|
|
1034
|
+
return !!pointer.value && (!option.group && pointer.value[valueProp.value] == option[valueProp.value] || option.group !== void 0 && pointer.value[groupLabel.value] == option[groupLabel.value]) ? true : void 0;
|
|
1035
|
+
};
|
|
1036
|
+
const setPointerFirst = () => {
|
|
1037
|
+
setPointer(options.value[0] || null);
|
|
1038
|
+
};
|
|
1039
|
+
const selectPointer = () => {
|
|
1040
|
+
if (!pointer.value || pointer.value[disabledProp.value] === true) {
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
if (isPointerGroup.value) {
|
|
1044
|
+
handleGroupClick(pointer.value);
|
|
1045
|
+
} else {
|
|
1046
|
+
handleOptionClick(pointer.value);
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
const forwardPointer = () => {
|
|
1050
|
+
if (pointer.value === null) {
|
|
1051
|
+
setPointer((groupped.value && canPointGroups.value ? groups.value[0] : options.value[0]) || null);
|
|
1052
|
+
} else if (groupped.value && canPointGroups.value) {
|
|
1053
|
+
let nextPointer = isPointerGroup.value ? currentGroupFirstEnabledOption.value : currentGroupNextEnabledOption.value;
|
|
1054
|
+
if (nextPointer === void 0) {
|
|
1055
|
+
nextPointer = nextGroup.value;
|
|
1056
|
+
}
|
|
1057
|
+
setPointer(nextPointer || null);
|
|
1058
|
+
} else {
|
|
1059
|
+
let next = options.value.map((o) => o[valueProp.value]).indexOf(pointer.value[valueProp.value]) + 1;
|
|
1060
|
+
if (options.value.length <= next) {
|
|
1061
|
+
next = 0;
|
|
1062
|
+
}
|
|
1063
|
+
setPointer(options.value[next] || null);
|
|
1064
|
+
}
|
|
1065
|
+
nextTick(() => {
|
|
1066
|
+
adjustWrapperScrollToPointer();
|
|
1067
|
+
});
|
|
1068
|
+
};
|
|
1069
|
+
const backwardPointer = () => {
|
|
1070
|
+
if (pointer.value === null) {
|
|
1071
|
+
let prevPointer = options.value[options.value.length - 1];
|
|
1072
|
+
if (groupped.value && canPointGroups.value) {
|
|
1073
|
+
prevPointer = lastGroupLastEnabledOption.value;
|
|
1074
|
+
if (prevPointer === void 0) {
|
|
1075
|
+
prevPointer = lastGroup.value;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
setPointer(prevPointer || null);
|
|
1079
|
+
} else if (groupped.value && canPointGroups.value) {
|
|
1080
|
+
let prevPointer = isPointerGroup.value ? prevGroupLastEnabledOption.value : currentGroupPrevEnabledOption.value;
|
|
1081
|
+
if (prevPointer === void 0) {
|
|
1082
|
+
prevPointer = isPointerGroup.value ? prevGroup.value : currentGroup.value;
|
|
1083
|
+
}
|
|
1084
|
+
setPointer(prevPointer || null);
|
|
1085
|
+
} else {
|
|
1086
|
+
let prevIndex = options.value.map((o) => o[valueProp.value]).indexOf(pointer.value[valueProp.value]) - 1;
|
|
1087
|
+
if (prevIndex < 0) {
|
|
1088
|
+
prevIndex = options.value.length - 1;
|
|
1089
|
+
}
|
|
1090
|
+
setPointer(options.value[prevIndex] || null);
|
|
1091
|
+
}
|
|
1092
|
+
nextTick(() => {
|
|
1093
|
+
adjustWrapperScrollToPointer();
|
|
1094
|
+
});
|
|
1095
|
+
};
|
|
1096
|
+
const getParentGroup = (option) => {
|
|
1097
|
+
return groups.value.find((group) => {
|
|
1098
|
+
return group.__VISIBLE__.map((o) => o[valueProp.value]).indexOf(option[valueProp.value]) !== -1;
|
|
1099
|
+
});
|
|
1100
|
+
};
|
|
1101
|
+
const adjustWrapperScrollToPointer = () => {
|
|
1102
|
+
let pointedOption = multiselect.value.querySelector(`[data-pointed]`);
|
|
1103
|
+
if (!pointedOption) {
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
let wrapper = pointedOption.parentElement.parentElement;
|
|
1107
|
+
if (groupped.value) {
|
|
1108
|
+
wrapper = isPointerGroup.value ? pointedOption.parentElement.parentElement.parentElement : pointedOption.parentElement.parentElement.parentElement.parentElement;
|
|
1109
|
+
}
|
|
1110
|
+
if (pointedOption.offsetTop + pointedOption.offsetHeight > wrapper.clientHeight + wrapper.scrollTop) {
|
|
1111
|
+
wrapper.scrollTop = pointedOption.offsetTop + pointedOption.offsetHeight - wrapper.clientHeight;
|
|
1112
|
+
}
|
|
1113
|
+
if (pointedOption.offsetTop < wrapper.scrollTop) {
|
|
1114
|
+
wrapper.scrollTop = pointedOption.offsetTop;
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
watch(search, (val) => {
|
|
1118
|
+
if (searchable.value) {
|
|
1119
|
+
if (val.length && showOptions.value) {
|
|
1120
|
+
setPointerFirst();
|
|
1121
|
+
} else {
|
|
1122
|
+
clearPointer();
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
watch(isOpen, (val) => {
|
|
1127
|
+
if (val) {
|
|
1128
|
+
let firstSelected = multiselect.value.querySelectorAll(`[data-selected]`)[0];
|
|
1129
|
+
if (!firstSelected) {
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
let wrapper = firstSelected.parentElement.parentElement;
|
|
1133
|
+
nextTick(() => {
|
|
1134
|
+
if (wrapper.scrollTop > 0) {
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
wrapper.scrollTop = firstSelected.offsetTop;
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
});
|
|
1141
|
+
return {
|
|
1142
|
+
pointer,
|
|
1143
|
+
canPointGroups,
|
|
1144
|
+
isPointed,
|
|
1145
|
+
setPointerFirst,
|
|
1146
|
+
selectPointer,
|
|
1147
|
+
forwardPointer,
|
|
1148
|
+
backwardPointer
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
function useDropdown(props, context, dep) {
|
|
1152
|
+
const { disabled } = toRefs(props);
|
|
1153
|
+
const $this = getCurrentInstance().proxy;
|
|
1154
|
+
const isOpen = ref(false);
|
|
1155
|
+
const open = () => {
|
|
1156
|
+
if (isOpen.value || disabled.value) {
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
isOpen.value = true;
|
|
1160
|
+
context.emit("open", $this);
|
|
1161
|
+
};
|
|
1162
|
+
const close = () => {
|
|
1163
|
+
if (!isOpen.value) {
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
isOpen.value = false;
|
|
1167
|
+
context.emit("close", $this);
|
|
1168
|
+
};
|
|
1169
|
+
return {
|
|
1170
|
+
isOpen,
|
|
1171
|
+
open,
|
|
1172
|
+
close
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
function useMultiselect(props, context, dep) {
|
|
1176
|
+
const { searchable, disabled } = toRefs(props);
|
|
1177
|
+
const input = dep.input;
|
|
1178
|
+
const open = dep.open;
|
|
1179
|
+
const close = dep.close;
|
|
1180
|
+
const clearSearch = dep.clearSearch;
|
|
1181
|
+
const isOpen = dep.isOpen;
|
|
1182
|
+
const multiselect = ref(null);
|
|
1183
|
+
const tags = ref(null);
|
|
1184
|
+
const isActive = ref(false);
|
|
1185
|
+
const tabindex = computed(() => {
|
|
1186
|
+
return searchable.value || disabled.value ? -1 : 0;
|
|
1187
|
+
});
|
|
1188
|
+
const blur = () => {
|
|
1189
|
+
if (searchable.value) {
|
|
1190
|
+
input.value.blur();
|
|
1191
|
+
}
|
|
1192
|
+
multiselect.value.blur();
|
|
1193
|
+
};
|
|
1194
|
+
const focus = () => {
|
|
1195
|
+
if (searchable.value && !disabled.value) {
|
|
1196
|
+
input.value.focus();
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1199
|
+
const handleFocus = () => {
|
|
1200
|
+
focus();
|
|
1201
|
+
};
|
|
1202
|
+
const activate = () => {
|
|
1203
|
+
if (disabled.value) {
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
isActive.value = true;
|
|
1207
|
+
open();
|
|
1208
|
+
};
|
|
1209
|
+
const deactivate = () => {
|
|
1210
|
+
isActive.value = false;
|
|
1211
|
+
setTimeout(() => {
|
|
1212
|
+
if (!isActive.value) {
|
|
1213
|
+
close();
|
|
1214
|
+
clearSearch();
|
|
1215
|
+
}
|
|
1216
|
+
}, 1);
|
|
1217
|
+
};
|
|
1218
|
+
const handleCaretClick = () => {
|
|
1219
|
+
deactivate();
|
|
1220
|
+
blur();
|
|
1221
|
+
};
|
|
1222
|
+
const handleMousedown = (e) => {
|
|
1223
|
+
if (isOpen.value && (e.target.isEqualNode(multiselect.value) || e.target.isEqualNode(tags.value))) {
|
|
1224
|
+
setTimeout(() => {
|
|
1225
|
+
deactivate();
|
|
1226
|
+
}, 0);
|
|
1227
|
+
} else if (document.activeElement.isEqualNode(multiselect.value) && !isOpen.value) {
|
|
1228
|
+
activate();
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
return {
|
|
1232
|
+
multiselect,
|
|
1233
|
+
tags,
|
|
1234
|
+
tabindex,
|
|
1235
|
+
isActive,
|
|
1236
|
+
blur,
|
|
1237
|
+
focus,
|
|
1238
|
+
handleFocus,
|
|
1239
|
+
activate,
|
|
1240
|
+
deactivate,
|
|
1241
|
+
handleCaretClick,
|
|
1242
|
+
handleMousedown
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
function useKeyboard(props, context, dep) {
|
|
1246
|
+
const {
|
|
1247
|
+
mode,
|
|
1248
|
+
addTagOn,
|
|
1249
|
+
openDirection,
|
|
1250
|
+
searchable,
|
|
1251
|
+
showOptions,
|
|
1252
|
+
valueProp,
|
|
1253
|
+
groups: groupped,
|
|
1254
|
+
addOptionOn: addOptionOn_,
|
|
1255
|
+
createTag,
|
|
1256
|
+
createOption: createOption_,
|
|
1257
|
+
reverse
|
|
1258
|
+
} = toRefs(props);
|
|
1259
|
+
const $this = getCurrentInstance().proxy;
|
|
1260
|
+
const iv = dep.iv;
|
|
1261
|
+
const update = dep.update;
|
|
1262
|
+
const search = dep.search;
|
|
1263
|
+
const setPointer = dep.setPointer;
|
|
1264
|
+
const selectPointer = dep.selectPointer;
|
|
1265
|
+
const backwardPointer = dep.backwardPointer;
|
|
1266
|
+
const forwardPointer = dep.forwardPointer;
|
|
1267
|
+
const isOpen = dep.isOpen;
|
|
1268
|
+
const open = dep.open;
|
|
1269
|
+
const blur = dep.blur;
|
|
1270
|
+
const fo = dep.fo;
|
|
1271
|
+
const createOption = computed(() => {
|
|
1272
|
+
return createTag.value || createOption_.value || false;
|
|
1273
|
+
});
|
|
1274
|
+
const addOptionOn = computed(() => {
|
|
1275
|
+
if (addTagOn.value !== void 0) {
|
|
1276
|
+
return addTagOn.value;
|
|
1277
|
+
} else if (addOptionOn_.value !== void 0) {
|
|
1278
|
+
return addOptionOn_.value;
|
|
1279
|
+
}
|
|
1280
|
+
return ["enter"];
|
|
1281
|
+
});
|
|
1282
|
+
const preparePointer = () => {
|
|
1283
|
+
if (mode.value === "tags" && !showOptions.value && createOption.value && searchable.value && !groupped.value) {
|
|
1284
|
+
setPointer(fo.value[fo.value.map((o) => o[valueProp.value]).indexOf(search.value)]);
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
const handleKeydown = (e) => {
|
|
1288
|
+
context.emit("keydown", e, $this);
|
|
1289
|
+
switch (e.key) {
|
|
1290
|
+
case "Backspace":
|
|
1291
|
+
if (mode.value === "single") {
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
if (searchable.value && [null, ""].indexOf(search.value) === -1) {
|
|
1295
|
+
return;
|
|
1296
|
+
}
|
|
1297
|
+
if (iv.value.length === 0) {
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
update([...iv.value].slice(0, -1));
|
|
1301
|
+
break;
|
|
1302
|
+
case "Enter":
|
|
1303
|
+
e.preventDefault();
|
|
1304
|
+
if (addOptionOn.value.indexOf("enter") === -1 && createOption.value) {
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
preparePointer();
|
|
1308
|
+
selectPointer();
|
|
1309
|
+
break;
|
|
1310
|
+
case " ":
|
|
1311
|
+
if (!createOption.value && !searchable.value) {
|
|
1312
|
+
e.preventDefault();
|
|
1313
|
+
preparePointer();
|
|
1314
|
+
selectPointer();
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
if (!createOption.value) {
|
|
1318
|
+
return false;
|
|
1319
|
+
}
|
|
1320
|
+
if (addOptionOn.value.indexOf("space") === -1 && createOption.value) {
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
e.preventDefault();
|
|
1324
|
+
preparePointer();
|
|
1325
|
+
selectPointer();
|
|
1326
|
+
break;
|
|
1327
|
+
case "Tab":
|
|
1328
|
+
case ";":
|
|
1329
|
+
case ",":
|
|
1330
|
+
if (addOptionOn.value.indexOf(e.key.toLowerCase()) === -1 || !createOption.value) {
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
preparePointer();
|
|
1334
|
+
selectPointer();
|
|
1335
|
+
e.preventDefault();
|
|
1336
|
+
break;
|
|
1337
|
+
case "Escape":
|
|
1338
|
+
blur();
|
|
1339
|
+
break;
|
|
1340
|
+
case "ArrowUp":
|
|
1341
|
+
e.preventDefault();
|
|
1342
|
+
if (!showOptions.value) {
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
if (!isOpen.value) {
|
|
1346
|
+
open();
|
|
1347
|
+
}
|
|
1348
|
+
backwardPointer();
|
|
1349
|
+
break;
|
|
1350
|
+
case "ArrowDown":
|
|
1351
|
+
e.preventDefault();
|
|
1352
|
+
if (!showOptions.value) {
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1355
|
+
if (!isOpen.value) {
|
|
1356
|
+
open();
|
|
1357
|
+
}
|
|
1358
|
+
forwardPointer();
|
|
1359
|
+
break;
|
|
1360
|
+
}
|
|
1361
|
+
};
|
|
1362
|
+
const handleKeyup = (e) => {
|
|
1363
|
+
context.emit("keyup", e, $this);
|
|
1364
|
+
};
|
|
1365
|
+
return {
|
|
1366
|
+
handleKeydown,
|
|
1367
|
+
handleKeyup,
|
|
1368
|
+
preparePointer
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
function useClasses(props, context, dependencies) {
|
|
1372
|
+
const {
|
|
1373
|
+
classes: classes_,
|
|
1374
|
+
disabled,
|
|
1375
|
+
openDirection,
|
|
1376
|
+
showOptions
|
|
1377
|
+
} = toRefs(props);
|
|
1378
|
+
const isOpen = dependencies.isOpen;
|
|
1379
|
+
const isPointed = dependencies.isPointed;
|
|
1380
|
+
const isSelected = dependencies.isSelected;
|
|
1381
|
+
const isDisabled = dependencies.isDisabled;
|
|
1382
|
+
const isActive = dependencies.isActive;
|
|
1383
|
+
const canPointGroups = dependencies.canPointGroups;
|
|
1384
|
+
const resolving = dependencies.resolving;
|
|
1385
|
+
const fo = dependencies.fo;
|
|
1386
|
+
const classes = computed(() => __spreadValues({
|
|
1387
|
+
container: "multiselect",
|
|
1388
|
+
containerDisabled: "is-disabled",
|
|
1389
|
+
containerOpen: "is-open",
|
|
1390
|
+
containerOpenTop: "is-open-top",
|
|
1391
|
+
containerActive: "is-active",
|
|
1392
|
+
singleLabel: "multiselect-single-label",
|
|
1393
|
+
singleLabelText: "multiselect-single-label-text",
|
|
1394
|
+
multipleLabel: "multiselect-multiple-label",
|
|
1395
|
+
search: "multiselect-search",
|
|
1396
|
+
tags: "multiselect-tags",
|
|
1397
|
+
tag: "multiselect-tag",
|
|
1398
|
+
tagDisabled: "is-disabled",
|
|
1399
|
+
tagRemove: "multiselect-tag-remove",
|
|
1400
|
+
tagRemoveIcon: "multiselect-tag-remove-icon",
|
|
1401
|
+
tagsSearchWrapper: "multiselect-tags-search-wrapper",
|
|
1402
|
+
tagsSearch: "multiselect-tags-search",
|
|
1403
|
+
tagsSearchCopy: "multiselect-tags-search-copy",
|
|
1404
|
+
placeholder: "multiselect-placeholder",
|
|
1405
|
+
caret: "multiselect-caret",
|
|
1406
|
+
caretOpen: "is-open",
|
|
1407
|
+
clear: "multiselect-clear",
|
|
1408
|
+
clearIcon: "multiselect-clear-icon",
|
|
1409
|
+
spinner: "multiselect-spinner",
|
|
1410
|
+
inifinite: "multiselect-inifite",
|
|
1411
|
+
inifiniteSpinner: "multiselect-inifite-spinner",
|
|
1412
|
+
dropdown: "multiselect-dropdown",
|
|
1413
|
+
dropdownTop: "is-top",
|
|
1414
|
+
dropdownHidden: "is-hidden",
|
|
1415
|
+
options: "multiselect-options",
|
|
1416
|
+
optionsTop: "is-top",
|
|
1417
|
+
group: "multiselect-group",
|
|
1418
|
+
groupLabel: "multiselect-group-label",
|
|
1419
|
+
groupLabelPointable: "is-pointable",
|
|
1420
|
+
groupLabelPointed: "is-pointed",
|
|
1421
|
+
groupLabelSelected: "is-selected",
|
|
1422
|
+
groupLabelDisabled: "is-disabled",
|
|
1423
|
+
groupLabelSelectedPointed: "is-selected is-pointed",
|
|
1424
|
+
groupLabelSelectedDisabled: "is-selected is-disabled",
|
|
1425
|
+
groupOptions: "multiselect-group-options",
|
|
1426
|
+
option: "multiselect-option",
|
|
1427
|
+
optionPointed: "is-pointed",
|
|
1428
|
+
optionSelected: "is-selected",
|
|
1429
|
+
optionDisabled: "is-disabled",
|
|
1430
|
+
optionSelectedPointed: "is-selected is-pointed",
|
|
1431
|
+
optionSelectedDisabled: "is-selected is-disabled",
|
|
1432
|
+
noOptions: "multiselect-no-options",
|
|
1433
|
+
noResults: "multiselect-no-results",
|
|
1434
|
+
fakeInput: "multiselect-fake-input",
|
|
1435
|
+
spacer: "multiselect-spacer"
|
|
1436
|
+
}, classes_.value));
|
|
1437
|
+
const showDropdown = computed(() => {
|
|
1438
|
+
return !!(isOpen.value && showOptions.value && (!resolving.value || resolving.value && fo.value.length));
|
|
1439
|
+
});
|
|
1440
|
+
const classList = computed(() => {
|
|
1441
|
+
const c = classes.value;
|
|
1442
|
+
return {
|
|
1443
|
+
container: [c.container].concat(disabled.value ? c.containerDisabled : []).concat(showDropdown.value && openDirection.value === "top" ? c.containerOpenTop : []).concat(showDropdown.value && openDirection.value !== "top" ? c.containerOpen : []).concat(isActive.value ? c.containerActive : []),
|
|
1444
|
+
spacer: c.spacer,
|
|
1445
|
+
singleLabel: c.singleLabel,
|
|
1446
|
+
singleLabelText: c.singleLabelText,
|
|
1447
|
+
multipleLabel: c.multipleLabel,
|
|
1448
|
+
search: c.search,
|
|
1449
|
+
tags: c.tags,
|
|
1450
|
+
tag: [c.tag].concat(disabled.value ? c.tagDisabled : []),
|
|
1451
|
+
tagRemove: c.tagRemove,
|
|
1452
|
+
tagRemoveIcon: c.tagRemoveIcon,
|
|
1453
|
+
tagsSearchWrapper: c.tagsSearchWrapper,
|
|
1454
|
+
tagsSearch: c.tagsSearch,
|
|
1455
|
+
tagsSearchCopy: c.tagsSearchCopy,
|
|
1456
|
+
placeholder: c.placeholder,
|
|
1457
|
+
caret: [c.caret].concat(isOpen.value ? c.caretOpen : []),
|
|
1458
|
+
clear: c.clear,
|
|
1459
|
+
clearIcon: c.clearIcon,
|
|
1460
|
+
spinner: c.spinner,
|
|
1461
|
+
inifinite: c.inifinite,
|
|
1462
|
+
inifiniteSpinner: c.inifiniteSpinner,
|
|
1463
|
+
dropdown: [c.dropdown].concat(openDirection.value === "top" ? c.dropdownTop : []).concat(!isOpen.value || !showOptions.value || !showDropdown.value ? c.dropdownHidden : []),
|
|
1464
|
+
options: [c.options].concat(openDirection.value === "top" ? c.optionsTop : []),
|
|
1465
|
+
group: c.group,
|
|
1466
|
+
groupLabel: (g) => {
|
|
1467
|
+
let groupLabel = [c.groupLabel];
|
|
1468
|
+
if (isPointed(g)) {
|
|
1469
|
+
groupLabel.push(isSelected(g) ? c.groupLabelSelectedPointed : c.groupLabelPointed);
|
|
1470
|
+
} else if (isSelected(g) && canPointGroups.value) {
|
|
1471
|
+
groupLabel.push(isDisabled(g) ? c.groupLabelSelectedDisabled : c.groupLabelSelected);
|
|
1472
|
+
} else if (isDisabled(g)) {
|
|
1473
|
+
groupLabel.push(c.groupLabelDisabled);
|
|
1474
|
+
}
|
|
1475
|
+
if (canPointGroups.value) {
|
|
1476
|
+
groupLabel.push(c.groupLabelPointable);
|
|
1477
|
+
}
|
|
1478
|
+
return groupLabel;
|
|
1479
|
+
},
|
|
1480
|
+
groupOptions: c.groupOptions,
|
|
1481
|
+
option: (o, g) => {
|
|
1482
|
+
let option = [c.option];
|
|
1483
|
+
if (isPointed(o)) {
|
|
1484
|
+
option.push(isSelected(o) ? c.optionSelectedPointed : c.optionPointed);
|
|
1485
|
+
} else if (isSelected(o)) {
|
|
1486
|
+
option.push(isDisabled(o) ? c.optionSelectedDisabled : c.optionSelected);
|
|
1487
|
+
} else if (isDisabled(o) || g && isDisabled(g)) {
|
|
1488
|
+
option.push(c.optionDisabled);
|
|
1489
|
+
}
|
|
1490
|
+
return option;
|
|
1491
|
+
},
|
|
1492
|
+
noOptions: c.noOptions,
|
|
1493
|
+
noResults: c.noResults,
|
|
1494
|
+
fakeInput: c.fakeInput
|
|
1495
|
+
};
|
|
1496
|
+
});
|
|
1497
|
+
return {
|
|
1498
|
+
classList,
|
|
1499
|
+
showDropdown
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
function useScroll$1(props, context, dep) {
|
|
1503
|
+
const {
|
|
1504
|
+
limit,
|
|
1505
|
+
infinite
|
|
1506
|
+
} = toRefs(props);
|
|
1507
|
+
const isOpen = dep.isOpen;
|
|
1508
|
+
const offset = dep.offset;
|
|
1509
|
+
const search = dep.search;
|
|
1510
|
+
const pfo = dep.pfo;
|
|
1511
|
+
const eo = dep.eo;
|
|
1512
|
+
const observer = ref(null);
|
|
1513
|
+
const infiniteLoader = ref(null);
|
|
1514
|
+
const hasMore = computed(() => {
|
|
1515
|
+
return offset.value < pfo.value.length;
|
|
1516
|
+
});
|
|
1517
|
+
const handleIntersectionObserver = (entries) => {
|
|
1518
|
+
const { isIntersecting, target } = entries[0];
|
|
1519
|
+
if (isIntersecting) {
|
|
1520
|
+
const parent = target.offsetParent;
|
|
1521
|
+
const scrollTop = parent.scrollTop;
|
|
1522
|
+
offset.value += limit.value == -1 ? 10 : limit.value;
|
|
1523
|
+
nextTick(() => {
|
|
1524
|
+
parent.scrollTop = scrollTop;
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
const observe = () => {
|
|
1529
|
+
if (isOpen.value && offset.value < pfo.value.length) {
|
|
1530
|
+
observer.value.observe(infiniteLoader.value);
|
|
1531
|
+
} else if (!isOpen.value && observer.value) {
|
|
1532
|
+
observer.value.disconnect();
|
|
1533
|
+
}
|
|
1534
|
+
};
|
|
1535
|
+
watch(isOpen, () => {
|
|
1536
|
+
if (!infinite.value) {
|
|
1537
|
+
return;
|
|
1538
|
+
}
|
|
1539
|
+
observe();
|
|
1540
|
+
});
|
|
1541
|
+
watch(search, () => {
|
|
1542
|
+
if (!infinite.value) {
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
offset.value = limit.value;
|
|
1546
|
+
observe();
|
|
1547
|
+
}, { flush: "post" });
|
|
1548
|
+
watch(eo, () => {
|
|
1549
|
+
if (!infinite.value) {
|
|
1550
|
+
return;
|
|
1551
|
+
}
|
|
1552
|
+
observe();
|
|
1553
|
+
}, { immediate: false, flush: "post" });
|
|
1554
|
+
onMounted(() => {
|
|
1555
|
+
if (window && window.IntersectionObserver) {
|
|
1556
|
+
observer.value = new IntersectionObserver(handleIntersectionObserver);
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
return {
|
|
1560
|
+
hasMore,
|
|
1561
|
+
infiniteLoader
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
function useScroll(props, context, dep) {
|
|
1565
|
+
const { placeholder, id, valueProp, label: labelProp, mode, groupLabel } = toRefs(props);
|
|
1566
|
+
const pointer = dep.pointer;
|
|
1567
|
+
const iv = dep.iv;
|
|
1568
|
+
const isSelected = dep.isSelected;
|
|
1569
|
+
const hasSelected = dep.hasSelected;
|
|
1570
|
+
const multipleLabelText = dep.multipleLabelText;
|
|
1571
|
+
const label = ref(null);
|
|
1572
|
+
const ariaOwns = computed(() => {
|
|
1573
|
+
let texts = [];
|
|
1574
|
+
if (id && id.value) {
|
|
1575
|
+
texts.push(id.value);
|
|
1576
|
+
}
|
|
1577
|
+
texts.push("multiselect-options");
|
|
1578
|
+
return texts.join("-");
|
|
1579
|
+
});
|
|
1580
|
+
const ariaActiveDescendant = computed(() => {
|
|
1581
|
+
let texts = [];
|
|
1582
|
+
if (id && id.value) {
|
|
1583
|
+
texts.push(id.value);
|
|
1584
|
+
}
|
|
1585
|
+
texts.push("multiselect-option");
|
|
1586
|
+
if (pointer.value && pointer.value[valueProp.value] !== void 0) {
|
|
1587
|
+
texts.push(pointer.value[valueProp.value]);
|
|
1588
|
+
return texts.join("-");
|
|
1589
|
+
}
|
|
1590
|
+
});
|
|
1591
|
+
const ariaLabel = computed(() => {
|
|
1592
|
+
let texts = [];
|
|
1593
|
+
if (label.value) {
|
|
1594
|
+
texts.push(label.value);
|
|
1595
|
+
}
|
|
1596
|
+
if (placeholder.value && !hasSelected.value) {
|
|
1597
|
+
texts.push(placeholder.value);
|
|
1598
|
+
}
|
|
1599
|
+
if (mode.value === "single" && iv.value && iv.value[labelProp.value] !== void 0) {
|
|
1600
|
+
texts.push(iv.value[labelProp.value]);
|
|
1601
|
+
}
|
|
1602
|
+
if (mode.value === "multiple" && hasSelected.value) {
|
|
1603
|
+
texts.push(multipleLabelText.value);
|
|
1604
|
+
}
|
|
1605
|
+
if (mode.value === "tags" && hasSelected.value) {
|
|
1606
|
+
texts.push(...iv.value.map((v) => v[labelProp.value]));
|
|
1607
|
+
}
|
|
1608
|
+
return texts.join(", ");
|
|
1609
|
+
});
|
|
1610
|
+
const ariaPlaceholder = computed(() => {
|
|
1611
|
+
return ariaLabel.value;
|
|
1612
|
+
});
|
|
1613
|
+
const ariaOptionId = (option) => {
|
|
1614
|
+
let texts = [];
|
|
1615
|
+
if (id && id.value) {
|
|
1616
|
+
texts.push(id.value);
|
|
1617
|
+
}
|
|
1618
|
+
texts.push("multiselect-option");
|
|
1619
|
+
texts.push(option[valueProp.value]);
|
|
1620
|
+
return texts.join("-");
|
|
1621
|
+
};
|
|
1622
|
+
const ariaOptionLabel = (option) => {
|
|
1623
|
+
let texts = [];
|
|
1624
|
+
if (isSelected(option)) {
|
|
1625
|
+
texts.push("\u2713");
|
|
1626
|
+
}
|
|
1627
|
+
texts.push(option[labelProp.value]);
|
|
1628
|
+
return texts.join(" ");
|
|
1629
|
+
};
|
|
1630
|
+
const ariaGroupLabel = (group) => {
|
|
1631
|
+
let texts = [];
|
|
1632
|
+
texts.push(group[groupLabel.value]);
|
|
1633
|
+
return texts.join(" ");
|
|
1634
|
+
};
|
|
1635
|
+
onMounted(() => {
|
|
1636
|
+
if (id && id.value && document && document.querySelector) {
|
|
1637
|
+
let forTag = document.querySelector(`[for="${id.value}"]`);
|
|
1638
|
+
label.value = forTag ? forTag.innerText : null;
|
|
1639
|
+
}
|
|
1640
|
+
});
|
|
1641
|
+
return {
|
|
1642
|
+
ariaOwns,
|
|
1643
|
+
ariaLabel,
|
|
1644
|
+
ariaPlaceholder,
|
|
1645
|
+
ariaActiveDescendant,
|
|
1646
|
+
ariaOptionId,
|
|
1647
|
+
ariaOptionLabel,
|
|
1648
|
+
ariaGroupLabel
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
function resolveDeps(props, context, features, deps = {}) {
|
|
1652
|
+
features.forEach((composable) => {
|
|
1653
|
+
if (composable) {
|
|
1654
|
+
deps = __spreadValues(__spreadValues({}, deps), composable(props, context, deps));
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
return deps;
|
|
1658
|
+
}
|
|
1659
|
+
var script = {
|
|
1660
|
+
name: "Multiselect",
|
|
1661
|
+
emits: [
|
|
1662
|
+
"paste",
|
|
1663
|
+
"open",
|
|
1664
|
+
"close",
|
|
1665
|
+
"select",
|
|
1666
|
+
"deselect",
|
|
1667
|
+
"input",
|
|
1668
|
+
"search-change",
|
|
1669
|
+
"tag",
|
|
1670
|
+
"option",
|
|
1671
|
+
"update:modelValue",
|
|
1672
|
+
"change",
|
|
1673
|
+
"clear",
|
|
1674
|
+
"keydown",
|
|
1675
|
+
"keyup"
|
|
1676
|
+
],
|
|
1677
|
+
props: {
|
|
1678
|
+
value: {
|
|
1679
|
+
required: false
|
|
1680
|
+
},
|
|
1681
|
+
modelValue: {
|
|
1682
|
+
required: false
|
|
1683
|
+
},
|
|
1684
|
+
options: {
|
|
1685
|
+
type: [Array, Object, Function],
|
|
1686
|
+
required: false,
|
|
1687
|
+
default: () => []
|
|
1688
|
+
},
|
|
1689
|
+
id: {
|
|
1690
|
+
type: [String, Number],
|
|
1691
|
+
required: false
|
|
1692
|
+
},
|
|
1693
|
+
name: {
|
|
1694
|
+
type: [String, Number],
|
|
1695
|
+
required: false,
|
|
1696
|
+
default: "multiselect"
|
|
1697
|
+
},
|
|
1698
|
+
disabled: {
|
|
1699
|
+
type: Boolean,
|
|
1700
|
+
required: false,
|
|
1701
|
+
default: false
|
|
1702
|
+
},
|
|
1703
|
+
label: {
|
|
1704
|
+
type: String,
|
|
1705
|
+
required: false,
|
|
1706
|
+
default: "label"
|
|
1707
|
+
},
|
|
1708
|
+
trackBy: {
|
|
1709
|
+
type: String,
|
|
1710
|
+
required: false,
|
|
1711
|
+
default: void 0
|
|
1712
|
+
},
|
|
1713
|
+
valueProp: {
|
|
1714
|
+
type: String,
|
|
1715
|
+
required: false,
|
|
1716
|
+
default: "value"
|
|
1717
|
+
},
|
|
1718
|
+
placeholder: {
|
|
1719
|
+
type: String,
|
|
1720
|
+
required: false,
|
|
1721
|
+
default: null
|
|
1722
|
+
},
|
|
1723
|
+
mode: {
|
|
1724
|
+
type: String,
|
|
1725
|
+
required: false,
|
|
1726
|
+
default: "single"
|
|
1727
|
+
},
|
|
1728
|
+
searchable: {
|
|
1729
|
+
type: Boolean,
|
|
1730
|
+
required: false,
|
|
1731
|
+
default: false
|
|
1732
|
+
},
|
|
1733
|
+
limit: {
|
|
1734
|
+
type: Number,
|
|
1735
|
+
required: false,
|
|
1736
|
+
default: -1
|
|
1737
|
+
},
|
|
1738
|
+
hideSelected: {
|
|
1739
|
+
type: Boolean,
|
|
1740
|
+
required: false,
|
|
1741
|
+
default: true
|
|
1742
|
+
},
|
|
1743
|
+
createTag: {
|
|
1744
|
+
type: Boolean,
|
|
1745
|
+
required: false,
|
|
1746
|
+
default: void 0
|
|
1747
|
+
},
|
|
1748
|
+
createOption: {
|
|
1749
|
+
type: Boolean,
|
|
1750
|
+
required: false,
|
|
1751
|
+
default: void 0
|
|
1752
|
+
},
|
|
1753
|
+
appendNewTag: {
|
|
1754
|
+
type: Boolean,
|
|
1755
|
+
required: false,
|
|
1756
|
+
default: void 0
|
|
1757
|
+
},
|
|
1758
|
+
appendNewOption: {
|
|
1759
|
+
type: Boolean,
|
|
1760
|
+
required: false,
|
|
1761
|
+
default: void 0
|
|
1762
|
+
},
|
|
1763
|
+
addTagOn: {
|
|
1764
|
+
type: Array,
|
|
1765
|
+
required: false,
|
|
1766
|
+
default: void 0
|
|
1767
|
+
},
|
|
1768
|
+
addOptionOn: {
|
|
1769
|
+
type: Array,
|
|
1770
|
+
required: false,
|
|
1771
|
+
default: void 0
|
|
1772
|
+
},
|
|
1773
|
+
caret: {
|
|
1774
|
+
type: Boolean,
|
|
1775
|
+
required: false,
|
|
1776
|
+
default: true
|
|
1777
|
+
},
|
|
1778
|
+
loading: {
|
|
1779
|
+
type: Boolean,
|
|
1780
|
+
required: false,
|
|
1781
|
+
default: false
|
|
1782
|
+
},
|
|
1783
|
+
noOptionsText: {
|
|
1784
|
+
type: String,
|
|
1785
|
+
required: false,
|
|
1786
|
+
default: "The list is empty"
|
|
1787
|
+
},
|
|
1788
|
+
noResultsText: {
|
|
1789
|
+
type: String,
|
|
1790
|
+
required: false,
|
|
1791
|
+
default: "No results found"
|
|
1792
|
+
},
|
|
1793
|
+
multipleLabel: {
|
|
1794
|
+
type: Function,
|
|
1795
|
+
required: false
|
|
1796
|
+
},
|
|
1797
|
+
object: {
|
|
1798
|
+
type: Boolean,
|
|
1799
|
+
required: false,
|
|
1800
|
+
default: false
|
|
1801
|
+
},
|
|
1802
|
+
delay: {
|
|
1803
|
+
type: Number,
|
|
1804
|
+
required: false,
|
|
1805
|
+
default: -1
|
|
1806
|
+
},
|
|
1807
|
+
minChars: {
|
|
1808
|
+
type: Number,
|
|
1809
|
+
required: false,
|
|
1810
|
+
default: 0
|
|
1811
|
+
},
|
|
1812
|
+
resolveOnLoad: {
|
|
1813
|
+
type: Boolean,
|
|
1814
|
+
required: false,
|
|
1815
|
+
default: true
|
|
1816
|
+
},
|
|
1817
|
+
filterResults: {
|
|
1818
|
+
type: Boolean,
|
|
1819
|
+
required: false,
|
|
1820
|
+
default: true
|
|
1821
|
+
},
|
|
1822
|
+
clearOnSearch: {
|
|
1823
|
+
type: Boolean,
|
|
1824
|
+
required: false,
|
|
1825
|
+
default: false
|
|
1826
|
+
},
|
|
1827
|
+
clearOnSelect: {
|
|
1828
|
+
type: Boolean,
|
|
1829
|
+
required: false,
|
|
1830
|
+
default: true
|
|
1831
|
+
},
|
|
1832
|
+
canDeselect: {
|
|
1833
|
+
type: Boolean,
|
|
1834
|
+
required: false,
|
|
1835
|
+
default: true
|
|
1836
|
+
},
|
|
1837
|
+
canClear: {
|
|
1838
|
+
type: Boolean,
|
|
1839
|
+
required: false,
|
|
1840
|
+
default: true
|
|
1841
|
+
},
|
|
1842
|
+
max: {
|
|
1843
|
+
type: Number,
|
|
1844
|
+
required: false,
|
|
1845
|
+
default: -1
|
|
1846
|
+
},
|
|
1847
|
+
showOptions: {
|
|
1848
|
+
type: Boolean,
|
|
1849
|
+
required: false,
|
|
1850
|
+
default: true
|
|
1851
|
+
},
|
|
1852
|
+
required: {
|
|
1853
|
+
type: Boolean,
|
|
1854
|
+
required: false,
|
|
1855
|
+
default: false
|
|
1856
|
+
},
|
|
1857
|
+
openDirection: {
|
|
1858
|
+
type: String,
|
|
1859
|
+
required: false,
|
|
1860
|
+
default: "bottom"
|
|
1861
|
+
},
|
|
1862
|
+
nativeSupport: {
|
|
1863
|
+
type: Boolean,
|
|
1864
|
+
required: false,
|
|
1865
|
+
default: false
|
|
1866
|
+
},
|
|
1867
|
+
classes: {
|
|
1868
|
+
type: Object,
|
|
1869
|
+
required: false,
|
|
1870
|
+
default: () => ({})
|
|
1871
|
+
},
|
|
1872
|
+
strict: {
|
|
1873
|
+
type: Boolean,
|
|
1874
|
+
required: false,
|
|
1875
|
+
default: true
|
|
1876
|
+
},
|
|
1877
|
+
closeOnSelect: {
|
|
1878
|
+
type: Boolean,
|
|
1879
|
+
required: false,
|
|
1880
|
+
default: true
|
|
1881
|
+
},
|
|
1882
|
+
autocomplete: {
|
|
1883
|
+
type: String,
|
|
1884
|
+
required: false
|
|
1885
|
+
},
|
|
1886
|
+
groups: {
|
|
1887
|
+
type: Boolean,
|
|
1888
|
+
required: false,
|
|
1889
|
+
default: false
|
|
1890
|
+
},
|
|
1891
|
+
groupLabel: {
|
|
1892
|
+
type: String,
|
|
1893
|
+
required: false,
|
|
1894
|
+
default: "label"
|
|
1895
|
+
},
|
|
1896
|
+
groupOptions: {
|
|
1897
|
+
type: String,
|
|
1898
|
+
required: false,
|
|
1899
|
+
default: "options"
|
|
1900
|
+
},
|
|
1901
|
+
groupHideEmpty: {
|
|
1902
|
+
type: Boolean,
|
|
1903
|
+
required: false,
|
|
1904
|
+
default: false
|
|
1905
|
+
},
|
|
1906
|
+
groupSelect: {
|
|
1907
|
+
type: Boolean,
|
|
1908
|
+
required: false,
|
|
1909
|
+
default: true
|
|
1910
|
+
},
|
|
1911
|
+
inputType: {
|
|
1912
|
+
type: String,
|
|
1913
|
+
required: false,
|
|
1914
|
+
default: "text"
|
|
1915
|
+
},
|
|
1916
|
+
attrs: {
|
|
1917
|
+
required: false,
|
|
1918
|
+
type: Object,
|
|
1919
|
+
default: () => ({})
|
|
1920
|
+
},
|
|
1921
|
+
onCreate: {
|
|
1922
|
+
required: false,
|
|
1923
|
+
type: Function
|
|
1924
|
+
},
|
|
1925
|
+
disabledProp: {
|
|
1926
|
+
type: String,
|
|
1927
|
+
required: false,
|
|
1928
|
+
default: "disabled"
|
|
1929
|
+
},
|
|
1930
|
+
searchStart: {
|
|
1931
|
+
type: Boolean,
|
|
1932
|
+
required: false,
|
|
1933
|
+
default: false
|
|
1934
|
+
},
|
|
1935
|
+
reverse: {
|
|
1936
|
+
type: Boolean,
|
|
1937
|
+
required: false,
|
|
1938
|
+
default: false
|
|
1939
|
+
},
|
|
1940
|
+
regex: {
|
|
1941
|
+
type: [Object, String, RegExp],
|
|
1942
|
+
required: false,
|
|
1943
|
+
default: void 0
|
|
1944
|
+
},
|
|
1945
|
+
rtl: {
|
|
1946
|
+
type: Boolean,
|
|
1947
|
+
required: false,
|
|
1948
|
+
default: false
|
|
1949
|
+
},
|
|
1950
|
+
infinite: {
|
|
1951
|
+
type: Boolean,
|
|
1952
|
+
required: false,
|
|
1953
|
+
default: false
|
|
1954
|
+
}
|
|
1955
|
+
},
|
|
1956
|
+
setup(props, context) {
|
|
1957
|
+
return resolveDeps(props, context, [
|
|
1958
|
+
useValue,
|
|
1959
|
+
usePointer$1,
|
|
1960
|
+
useDropdown,
|
|
1961
|
+
useSearch,
|
|
1962
|
+
useData,
|
|
1963
|
+
useMultiselect,
|
|
1964
|
+
useOptions,
|
|
1965
|
+
useScroll$1,
|
|
1966
|
+
usePointer,
|
|
1967
|
+
useKeyboard,
|
|
1968
|
+
useClasses,
|
|
1969
|
+
useScroll
|
|
1970
|
+
]);
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
const _hoisted_1$1 = ["tabindex", "id", "dir", "aria-owns", "aria-expanded", "aria-label", "aria-placeholder", "aria-activedescendant"];
|
|
1974
|
+
const _hoisted_2 = ["type", "modelValue", "value", "autocomplete", "id", "aria-owns", "aria-expanded", "aria-label", "aria-placeholder", "aria-activedescendant"];
|
|
1975
|
+
const _hoisted_3 = ["onClick"];
|
|
1976
|
+
const _hoisted_4 = ["type", "modelValue", "value", "id", "autocomplete", "aria-owns", "aria-expanded", "aria-label", "aria-placeholder", "aria-activedescendant"];
|
|
1977
|
+
const _hoisted_5 = ["innerHTML"];
|
|
1978
|
+
const _hoisted_6 = ["innerHTML"];
|
|
1979
|
+
const _hoisted_7 = ["id"];
|
|
1980
|
+
const _hoisted_8 = ["data-pointed", "onMouseenter", "onClick"];
|
|
1981
|
+
const _hoisted_9 = ["innerHTML"];
|
|
1982
|
+
const _hoisted_10 = ["aria-label"];
|
|
1983
|
+
const _hoisted_11 = ["data-pointed", "data-selected", "id", "aria-label", "onMouseenter", "onClick"];
|
|
1984
|
+
const _hoisted_12 = ["innerHTML"];
|
|
1985
|
+
const _hoisted_13 = ["id", "aria-label", "data-pointed", "data-selected", "onMouseenter", "onClick"];
|
|
1986
|
+
const _hoisted_14 = ["innerHTML"];
|
|
1987
|
+
const _hoisted_15 = ["innerHTML"];
|
|
1988
|
+
const _hoisted_16 = ["innerHTML"];
|
|
1989
|
+
const _hoisted_17 = ["value"];
|
|
1990
|
+
const _hoisted_18 = ["name", "value"];
|
|
1991
|
+
const _hoisted_19 = ["name", "value"];
|
|
1992
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1993
|
+
return openBlock(), createElementBlock("div", {
|
|
1994
|
+
ref: "multiselect",
|
|
1995
|
+
tabindex: _ctx.tabindex,
|
|
1996
|
+
class: normalizeClass(_ctx.classList.container),
|
|
1997
|
+
id: $props.searchable ? void 0 : $props.id,
|
|
1998
|
+
dir: $props.rtl ? "rtl" : void 0,
|
|
1999
|
+
"aria-owns": _ctx.ariaOwns,
|
|
2000
|
+
"aria-expanded": _ctx.isOpen,
|
|
2001
|
+
"aria-label": _ctx.ariaLabel,
|
|
2002
|
+
"aria-placeholder": _ctx.ariaPlaceholder,
|
|
2003
|
+
"aria-activedescendant": _ctx.ariaActiveDescendant,
|
|
2004
|
+
onFocusin: _cache[8] || (_cache[8] = (...args) => _ctx.activate && _ctx.activate(...args)),
|
|
2005
|
+
onFocusout: _cache[9] || (_cache[9] = (...args) => _ctx.deactivate && _ctx.deactivate(...args)),
|
|
2006
|
+
onKeydown: _cache[10] || (_cache[10] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args)),
|
|
2007
|
+
onKeyup: _cache[11] || (_cache[11] = (...args) => _ctx.handleKeyup && _ctx.handleKeyup(...args)),
|
|
2008
|
+
onFocus: _cache[12] || (_cache[12] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
|
|
2009
|
+
onMousedown: _cache[13] || (_cache[13] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
|
|
2010
|
+
role: "combobox"
|
|
2011
|
+
}, [
|
|
2012
|
+
createCommentVNode(" Search "),
|
|
2013
|
+
$props.mode !== "tags" && $props.searchable && !$props.disabled ? (openBlock(), createElementBlock("input", mergeProps({
|
|
2014
|
+
key: 0,
|
|
2015
|
+
type: $props.inputType,
|
|
2016
|
+
modelValue: _ctx.search,
|
|
2017
|
+
value: _ctx.search,
|
|
2018
|
+
class: _ctx.classList.search,
|
|
2019
|
+
autocomplete: $props.autocomplete,
|
|
2020
|
+
id: $props.searchable ? $props.id : void 0
|
|
2021
|
+
}, $props.attrs, {
|
|
2022
|
+
"aria-owns": _ctx.ariaOwns,
|
|
2023
|
+
"aria-expanded": _ctx.isOpen,
|
|
2024
|
+
"aria-label": _ctx.ariaLabel,
|
|
2025
|
+
"aria-placeholder": _ctx.ariaPlaceholder,
|
|
2026
|
+
"aria-activedescendant": _ctx.ariaActiveDescendant,
|
|
2027
|
+
onInput: _cache[0] || (_cache[0] = (...args) => _ctx.handleSearchInput && _ctx.handleSearchInput(...args)),
|
|
2028
|
+
onKeypress: _cache[1] || (_cache[1] = (...args) => _ctx.handleKeypress && _ctx.handleKeypress(...args)),
|
|
2029
|
+
onPaste: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.handlePaste && _ctx.handlePaste(...args), ["stop"])),
|
|
2030
|
+
ref: "input",
|
|
2031
|
+
role: "combobox"
|
|
2032
|
+
}), null, 16, _hoisted_2)) : createCommentVNode("v-if", true),
|
|
2033
|
+
createCommentVNode(" Tags (with search) "),
|
|
2034
|
+
$props.mode == "tags" ? (openBlock(), createElementBlock("div", {
|
|
2035
|
+
key: 1,
|
|
2036
|
+
class: normalizeClass(_ctx.classList.tags)
|
|
2037
|
+
}, [
|
|
2038
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.iv, (option, i, key) => {
|
|
2039
|
+
return renderSlot(_ctx.$slots, "tag", {
|
|
2040
|
+
option,
|
|
2041
|
+
handleTagRemove: _ctx.handleTagRemove,
|
|
2042
|
+
disabled: $props.disabled
|
|
2043
|
+
}, () => [
|
|
2044
|
+
(openBlock(), createElementBlock("span", {
|
|
2045
|
+
class: normalizeClass(_ctx.classList.tag),
|
|
2046
|
+
key
|
|
2047
|
+
}, [
|
|
2048
|
+
createTextVNode(toDisplayString(option[$props.label]) + " ", 1),
|
|
2049
|
+
!$props.disabled ? (openBlock(), createElementBlock("span", {
|
|
2050
|
+
key: 0,
|
|
2051
|
+
class: normalizeClass(_ctx.classList.tagRemove),
|
|
2052
|
+
onClick: ($event) => _ctx.handleTagRemove(option, $event)
|
|
2053
|
+
}, [
|
|
2054
|
+
createElementVNode("span", {
|
|
2055
|
+
class: normalizeClass(_ctx.classList.tagRemoveIcon)
|
|
2056
|
+
}, null, 2)
|
|
2057
|
+
], 10, _hoisted_3)) : createCommentVNode("v-if", true)
|
|
2058
|
+
], 2))
|
|
2059
|
+
]);
|
|
2060
|
+
}), 256)),
|
|
2061
|
+
createElementVNode("div", {
|
|
2062
|
+
class: normalizeClass(_ctx.classList.tagsSearchWrapper),
|
|
2063
|
+
ref: "tags"
|
|
2064
|
+
}, [
|
|
2065
|
+
createCommentVNode(" Used for measuring search width "),
|
|
2066
|
+
createElementVNode("span", {
|
|
2067
|
+
class: normalizeClass(_ctx.classList.tagsSearchCopy)
|
|
2068
|
+
}, toDisplayString(_ctx.search), 3),
|
|
2069
|
+
createCommentVNode(" Actual search input "),
|
|
2070
|
+
$props.searchable && !$props.disabled ? (openBlock(), createElementBlock("input", mergeProps({
|
|
2071
|
+
key: 0,
|
|
2072
|
+
type: $props.inputType,
|
|
2073
|
+
modelValue: _ctx.search,
|
|
2074
|
+
value: _ctx.search,
|
|
2075
|
+
class: _ctx.classList.tagsSearch,
|
|
2076
|
+
id: $props.searchable ? $props.id : void 0,
|
|
2077
|
+
autocomplete: $props.autocomplete
|
|
2078
|
+
}, $props.attrs, {
|
|
2079
|
+
"aria-owns": _ctx.ariaOwns,
|
|
2080
|
+
"aria-expanded": _ctx.isOpen,
|
|
2081
|
+
"aria-label": _ctx.ariaLabel,
|
|
2082
|
+
"aria-placeholder": _ctx.ariaPlaceholder,
|
|
2083
|
+
"aria-activedescendant": _ctx.ariaActiveDescendant,
|
|
2084
|
+
onInput: _cache[3] || (_cache[3] = (...args) => _ctx.handleSearchInput && _ctx.handleSearchInput(...args)),
|
|
2085
|
+
onKeypress: _cache[4] || (_cache[4] = (...args) => _ctx.handleKeypress && _ctx.handleKeypress(...args)),
|
|
2086
|
+
onPaste: _cache[5] || (_cache[5] = withModifiers((...args) => _ctx.handlePaste && _ctx.handlePaste(...args), ["stop"])),
|
|
2087
|
+
ref: "input",
|
|
2088
|
+
role: "combobox"
|
|
2089
|
+
}), null, 16, _hoisted_4)) : createCommentVNode("v-if", true)
|
|
2090
|
+
], 2)
|
|
2091
|
+
], 2)) : createCommentVNode("v-if", true),
|
|
2092
|
+
createCommentVNode(" Single label "),
|
|
2093
|
+
$props.mode == "single" && _ctx.hasSelected && !_ctx.search && _ctx.iv ? renderSlot(_ctx.$slots, "singlelabel", {
|
|
2094
|
+
key: 2,
|
|
2095
|
+
value: _ctx.iv
|
|
2096
|
+
}, () => [
|
|
2097
|
+
createElementVNode("div", {
|
|
2098
|
+
class: normalizeClass(_ctx.classList.singleLabel)
|
|
2099
|
+
}, [
|
|
2100
|
+
createElementVNode("span", {
|
|
2101
|
+
class: normalizeClass(_ctx.classList.singleLabelText),
|
|
2102
|
+
innerHTML: _ctx.iv[$props.label]
|
|
2103
|
+
}, null, 10, _hoisted_5)
|
|
2104
|
+
], 2)
|
|
2105
|
+
]) : createCommentVNode("v-if", true),
|
|
2106
|
+
createCommentVNode(" Multiple label "),
|
|
2107
|
+
$props.mode == "multiple" && _ctx.hasSelected && !_ctx.search ? renderSlot(_ctx.$slots, "multiplelabel", {
|
|
2108
|
+
key: 3,
|
|
2109
|
+
values: _ctx.iv
|
|
2110
|
+
}, () => [
|
|
2111
|
+
createElementVNode("div", {
|
|
2112
|
+
class: normalizeClass(_ctx.classList.multipleLabel),
|
|
2113
|
+
innerHTML: _ctx.multipleLabelText
|
|
2114
|
+
}, null, 10, _hoisted_6)
|
|
2115
|
+
]) : createCommentVNode("v-if", true),
|
|
2116
|
+
createCommentVNode(" Placeholder "),
|
|
2117
|
+
$props.placeholder && !_ctx.hasSelected && !_ctx.search ? renderSlot(_ctx.$slots, "placeholder", { key: 4 }, () => [
|
|
2118
|
+
createElementVNode("div", {
|
|
2119
|
+
class: normalizeClass(_ctx.classList.placeholder)
|
|
2120
|
+
}, toDisplayString($props.placeholder), 3)
|
|
2121
|
+
]) : createCommentVNode("v-if", true),
|
|
2122
|
+
createCommentVNode(" Spinner "),
|
|
2123
|
+
$props.loading || _ctx.resolving ? renderSlot(_ctx.$slots, "spinner", { key: 5 }, () => [
|
|
2124
|
+
createElementVNode("span", {
|
|
2125
|
+
class: normalizeClass(_ctx.classList.spinner)
|
|
2126
|
+
}, null, 2)
|
|
2127
|
+
]) : createCommentVNode("v-if", true),
|
|
2128
|
+
createCommentVNode(" Clear "),
|
|
2129
|
+
_ctx.hasSelected && !$props.disabled && $props.canClear && !_ctx.busy ? renderSlot(_ctx.$slots, "clear", {
|
|
2130
|
+
key: 6,
|
|
2131
|
+
clear: _ctx.clear
|
|
2132
|
+
}, () => [
|
|
2133
|
+
createElementVNode("span", {
|
|
2134
|
+
class: normalizeClass(_ctx.classList.clear),
|
|
2135
|
+
onClick: _cache[6] || (_cache[6] = (...args) => _ctx.clear && _ctx.clear(...args))
|
|
2136
|
+
}, [
|
|
2137
|
+
createElementVNode("span", {
|
|
2138
|
+
class: normalizeClass(_ctx.classList.clearIcon)
|
|
2139
|
+
}, null, 2)
|
|
2140
|
+
], 2)
|
|
2141
|
+
]) : createCommentVNode("v-if", true),
|
|
2142
|
+
createCommentVNode(" Caret "),
|
|
2143
|
+
$props.caret && $props.showOptions ? renderSlot(_ctx.$slots, "caret", { key: 7 }, () => [
|
|
2144
|
+
createElementVNode("span", {
|
|
2145
|
+
class: normalizeClass(_ctx.classList.caret),
|
|
2146
|
+
onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleCaretClick && _ctx.handleCaretClick(...args))
|
|
2147
|
+
}, null, 2)
|
|
2148
|
+
]) : createCommentVNode("v-if", true),
|
|
2149
|
+
createCommentVNode(" Options "),
|
|
2150
|
+
createElementVNode("div", {
|
|
2151
|
+
class: normalizeClass(_ctx.classList.dropdown),
|
|
2152
|
+
tabindex: "-1"
|
|
2153
|
+
}, [
|
|
2154
|
+
renderSlot(_ctx.$slots, "beforelist", { options: _ctx.fo }),
|
|
2155
|
+
createElementVNode("ul", {
|
|
2156
|
+
class: normalizeClass(_ctx.classList.options),
|
|
2157
|
+
id: _ctx.ariaOwns,
|
|
2158
|
+
role: "listbox"
|
|
2159
|
+
}, [
|
|
2160
|
+
$props.groups ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.fg, (group, i, key) => {
|
|
2161
|
+
return openBlock(), createElementBlock("li", {
|
|
2162
|
+
class: normalizeClass(_ctx.classList.group),
|
|
2163
|
+
key
|
|
2164
|
+
}, [
|
|
2165
|
+
createElementVNode("div", {
|
|
2166
|
+
class: normalizeClass(_ctx.classList.groupLabel(group)),
|
|
2167
|
+
"data-pointed": _ctx.isPointed(group),
|
|
2168
|
+
onMouseenter: ($event) => _ctx.setPointer(group),
|
|
2169
|
+
onClick: ($event) => _ctx.handleGroupClick(group),
|
|
2170
|
+
role: "none"
|
|
2171
|
+
}, [
|
|
2172
|
+
renderSlot(_ctx.$slots, "grouplabel", {
|
|
2173
|
+
group,
|
|
2174
|
+
isSelected: _ctx.isSelected,
|
|
2175
|
+
isPointed: _ctx.isPointed
|
|
2176
|
+
}, () => [
|
|
2177
|
+
createElementVNode("span", {
|
|
2178
|
+
innerHTML: group[$props.groupLabel]
|
|
2179
|
+
}, null, 8, _hoisted_9)
|
|
2180
|
+
])
|
|
2181
|
+
], 42, _hoisted_8),
|
|
2182
|
+
createElementVNode("ul", {
|
|
2183
|
+
class: normalizeClass(_ctx.classList.groupOptions),
|
|
2184
|
+
"aria-label": _ctx.ariaGroupLabel(group),
|
|
2185
|
+
role: "group"
|
|
2186
|
+
}, [
|
|
2187
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(group.__VISIBLE__, (option, i2, key2) => {
|
|
2188
|
+
return openBlock(), createElementBlock("li", {
|
|
2189
|
+
class: normalizeClass(_ctx.classList.option(option, group)),
|
|
2190
|
+
key: key2,
|
|
2191
|
+
"data-pointed": _ctx.isPointed(option),
|
|
2192
|
+
"data-selected": _ctx.isSelected(option) || void 0,
|
|
2193
|
+
id: _ctx.ariaOptionId(option),
|
|
2194
|
+
"aria-label": _ctx.ariaOptionLabel(option),
|
|
2195
|
+
onMouseenter: ($event) => _ctx.setPointer(option),
|
|
2196
|
+
onClick: ($event) => _ctx.handleOptionClick(option),
|
|
2197
|
+
role: "option"
|
|
2198
|
+
}, [
|
|
2199
|
+
renderSlot(_ctx.$slots, "option", {
|
|
2200
|
+
option,
|
|
2201
|
+
isSelected: _ctx.isSelected,
|
|
2202
|
+
isPointed: _ctx.isPointed,
|
|
2203
|
+
search: _ctx.search
|
|
2204
|
+
}, () => [
|
|
2205
|
+
createElementVNode("span", {
|
|
2206
|
+
innerHTML: option[$props.label]
|
|
2207
|
+
}, null, 8, _hoisted_12)
|
|
2208
|
+
])
|
|
2209
|
+
], 42, _hoisted_11);
|
|
2210
|
+
}), 128))
|
|
2211
|
+
], 10, _hoisted_10)
|
|
2212
|
+
], 2);
|
|
2213
|
+
}), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.fo, (option, i, key) => {
|
|
2214
|
+
return openBlock(), createElementBlock("li", {
|
|
2215
|
+
id: _ctx.ariaOptionId(option),
|
|
2216
|
+
"aria-label": _ctx.ariaOptionLabel(option),
|
|
2217
|
+
class: normalizeClass(_ctx.classList.option(option)),
|
|
2218
|
+
key,
|
|
2219
|
+
"data-pointed": _ctx.isPointed(option),
|
|
2220
|
+
"data-selected": _ctx.isSelected(option) || void 0,
|
|
2221
|
+
onMouseenter: ($event) => _ctx.setPointer(option),
|
|
2222
|
+
onClick: ($event) => _ctx.handleOptionClick(option),
|
|
2223
|
+
role: "option"
|
|
2224
|
+
}, [
|
|
2225
|
+
renderSlot(_ctx.$slots, "option", {
|
|
2226
|
+
option,
|
|
2227
|
+
isSelected: _ctx.isSelected,
|
|
2228
|
+
isPointed: _ctx.isPointed,
|
|
2229
|
+
search: _ctx.search
|
|
2230
|
+
}, () => [
|
|
2231
|
+
createElementVNode("span", {
|
|
2232
|
+
innerHTML: option[$props.label]
|
|
2233
|
+
}, null, 8, _hoisted_14)
|
|
2234
|
+
])
|
|
2235
|
+
], 42, _hoisted_13);
|
|
2236
|
+
}), 128))
|
|
2237
|
+
], 10, _hoisted_7),
|
|
2238
|
+
_ctx.noOptions ? renderSlot(_ctx.$slots, "nooptions", { key: 0 }, () => [
|
|
2239
|
+
createElementVNode("div", {
|
|
2240
|
+
class: normalizeClass(_ctx.classList.noOptions),
|
|
2241
|
+
innerHTML: $props.noOptionsText
|
|
2242
|
+
}, null, 10, _hoisted_15)
|
|
2243
|
+
]) : createCommentVNode("v-if", true),
|
|
2244
|
+
_ctx.noResults ? renderSlot(_ctx.$slots, "noresults", { key: 1 }, () => [
|
|
2245
|
+
createElementVNode("div", {
|
|
2246
|
+
class: normalizeClass(_ctx.classList.noResults),
|
|
2247
|
+
innerHTML: $props.noResultsText
|
|
2248
|
+
}, null, 10, _hoisted_16)
|
|
2249
|
+
]) : createCommentVNode("v-if", true),
|
|
2250
|
+
$props.infinite && _ctx.hasMore ? (openBlock(), createElementBlock("div", {
|
|
2251
|
+
key: 2,
|
|
2252
|
+
class: normalizeClass(_ctx.classList.inifinite),
|
|
2253
|
+
ref: "infiniteLoader"
|
|
2254
|
+
}, [
|
|
2255
|
+
renderSlot(_ctx.$slots, "infinite", {}, () => [
|
|
2256
|
+
createElementVNode("span", {
|
|
2257
|
+
class: normalizeClass(_ctx.classList.inifiniteSpinner)
|
|
2258
|
+
}, null, 2)
|
|
2259
|
+
])
|
|
2260
|
+
], 2)) : createCommentVNode("v-if", true),
|
|
2261
|
+
renderSlot(_ctx.$slots, "afterlist", { options: _ctx.fo })
|
|
2262
|
+
], 2),
|
|
2263
|
+
createCommentVNode(" Hacky input element to show HTML5 required warning "),
|
|
2264
|
+
$props.required ? (openBlock(), createElementBlock("input", {
|
|
2265
|
+
key: 8,
|
|
2266
|
+
class: normalizeClass(_ctx.classList.fakeInput),
|
|
2267
|
+
tabindex: "-1",
|
|
2268
|
+
value: _ctx.textValue,
|
|
2269
|
+
required: ""
|
|
2270
|
+
}, null, 10, _hoisted_17)) : createCommentVNode("v-if", true),
|
|
2271
|
+
createCommentVNode(" Native input support "),
|
|
2272
|
+
$props.nativeSupport ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
|
|
2273
|
+
$props.mode == "single" ? (openBlock(), createElementBlock("input", {
|
|
2274
|
+
key: 0,
|
|
2275
|
+
type: "hidden",
|
|
2276
|
+
name: $props.name,
|
|
2277
|
+
value: _ctx.plainValue !== void 0 ? _ctx.plainValue : ""
|
|
2278
|
+
}, null, 8, _hoisted_18)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.plainValue, (v, i) => {
|
|
2279
|
+
return openBlock(), createElementBlock("input", {
|
|
2280
|
+
type: "hidden",
|
|
2281
|
+
name: `${$props.name}[]`,
|
|
2282
|
+
value: v,
|
|
2283
|
+
key: i
|
|
2284
|
+
}, null, 8, _hoisted_19);
|
|
2285
|
+
}), 128))
|
|
2286
|
+
], 64)) : createCommentVNode("v-if", true),
|
|
2287
|
+
createCommentVNode(" Create height for empty input "),
|
|
2288
|
+
createElementVNode("div", {
|
|
2289
|
+
class: normalizeClass(_ctx.classList.spacer)
|
|
2290
|
+
}, null, 2)
|
|
2291
|
+
], 42, _hoisted_1$1);
|
|
2292
|
+
}
|
|
2293
|
+
script.render = render;
|
|
2294
|
+
script.__file = "src/Multiselect.vue";
|
|
2295
|
+
const _hoisted_1 = ["onClick"];
|
|
2296
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2297
|
+
__name: "BbSelect",
|
|
2298
|
+
props: {
|
|
2299
|
+
modelValue: null,
|
|
2300
|
+
disabled: { type: Boolean },
|
|
2301
|
+
noClear: { type: Boolean }
|
|
2302
|
+
},
|
|
2303
|
+
emits: ["update:modelValue"],
|
|
2304
|
+
setup(__props) {
|
|
2305
|
+
const props = __props;
|
|
2306
|
+
const modelValue = toRefs(props).modelValue;
|
|
2307
|
+
const inner = ref(modelValue.value);
|
|
2308
|
+
watch(modelValue, (v) => {
|
|
2309
|
+
inner.value = v;
|
|
2310
|
+
});
|
|
2311
|
+
const select = ref(null);
|
|
2312
|
+
function setFocus() {
|
|
2313
|
+
var _a;
|
|
2314
|
+
(_a = select.value) == null ? void 0 : _a.focus();
|
|
2315
|
+
}
|
|
2316
|
+
function clearSelection(event, nativeClear) {
|
|
2317
|
+
event.preventDefault();
|
|
2318
|
+
event.stopPropagation();
|
|
2319
|
+
nativeClear();
|
|
2320
|
+
}
|
|
2321
|
+
return (_ctx, _cache) => {
|
|
2322
|
+
return openBlock(), createBlock(unref(script), {
|
|
2323
|
+
class: "bb-select",
|
|
2324
|
+
value: unref(modelValue),
|
|
2325
|
+
disabled: __props.disabled,
|
|
2326
|
+
onChange: _cache[0] || (_cache[0] = (value) => _ctx.$emit("update:modelValue", value)),
|
|
2327
|
+
"onSearch:focus": setFocus,
|
|
2328
|
+
modelValue: inner.value,
|
|
2329
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inner.value = $event),
|
|
2330
|
+
ref_key: "select",
|
|
2331
|
+
ref: select
|
|
2332
|
+
}, {
|
|
2333
|
+
clear: withCtx(({ clear }) => [
|
|
2334
|
+
createElementVNode("span", {
|
|
2335
|
+
class: normalizeClass(["multiselect-clear", {
|
|
2336
|
+
hidden: __props.noClear
|
|
2337
|
+
}]),
|
|
2338
|
+
onClick: (event) => clearSelection(event, clear)
|
|
2339
|
+
}, null, 10, _hoisted_1)
|
|
2340
|
+
]),
|
|
2341
|
+
default: withCtx(() => [
|
|
2342
|
+
renderSlot(_ctx.$slots, "default")
|
|
2343
|
+
]),
|
|
2344
|
+
_: 3
|
|
2345
|
+
}, 8, ["value", "disabled", "modelValue"]);
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2348
|
+
});
|
|
2349
|
+
const Components$1 = {
|
|
2350
|
+
BbBreadcrumbs: _sfc_main$7,
|
|
2351
|
+
BbCheckbox: _sfc_main$6,
|
|
2352
|
+
BbButton: _sfc_main$5,
|
|
2353
|
+
BbInput: _sfc_main$4,
|
|
2354
|
+
BbLink: _sfc_main$3,
|
|
2355
|
+
BbRadio: _sfc_main$2,
|
|
2356
|
+
BbSelect: _sfc_main$1
|
|
2357
|
+
};
|
|
2358
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2359
|
+
__name: "InLink",
|
|
2360
|
+
props: {
|
|
2361
|
+
secondary: { type: Boolean },
|
|
2362
|
+
success: { type: Boolean },
|
|
2363
|
+
warning: { type: Boolean },
|
|
2364
|
+
danger: { type: Boolean }
|
|
2365
|
+
},
|
|
2366
|
+
setup(__props) {
|
|
2367
|
+
const props = __props;
|
|
2368
|
+
const classes = {
|
|
2369
|
+
"bb-link-primary": !props.secondary,
|
|
2370
|
+
"bb-link-secondary": props.secondary,
|
|
2371
|
+
"bb-link-success": props.success,
|
|
2372
|
+
"bb-link-warning": props.warning,
|
|
2373
|
+
"bb-link-danger": props.danger
|
|
2374
|
+
};
|
|
2375
|
+
return (_ctx, _cache) => {
|
|
2376
|
+
const _component_Link = resolveComponent("Link");
|
|
2377
|
+
return openBlock(), createBlock(_component_Link, {
|
|
2378
|
+
class: normalizeClass(classes)
|
|
2379
|
+
}, {
|
|
2380
|
+
default: withCtx(() => [
|
|
2381
|
+
renderSlot(_ctx.$slots, "default")
|
|
2382
|
+
]),
|
|
2383
|
+
_: 3
|
|
2384
|
+
});
|
|
2385
|
+
};
|
|
2386
|
+
}
|
|
2387
|
+
});
|
|
2388
|
+
const Components = {
|
|
2389
|
+
InLink: _sfc_main
|
|
2390
|
+
};
|
|
2391
|
+
var index = {
|
|
2392
|
+
install: (app, options) => {
|
|
2393
|
+
Object.keys(Components$1).forEach((componentName) => {
|
|
2394
|
+
var _a;
|
|
2395
|
+
if ((options == null ? void 0 : options.components) && !((_a = options == null ? void 0 : options.components) == null ? void 0 : _a.includes(componentName)))
|
|
2396
|
+
return;
|
|
2397
|
+
app.component(componentName, Components$1[componentName]);
|
|
2398
|
+
});
|
|
2399
|
+
if (options == null ? void 0 : options.inertia) {
|
|
2400
|
+
Object.keys(Components).forEach((componentName) => {
|
|
2401
|
+
var _a;
|
|
2402
|
+
if ((options == null ? void 0 : options.components) && !((_a = options == null ? void 0 : options.components) == null ? void 0 : _a.includes(componentName)))
|
|
2403
|
+
return;
|
|
2404
|
+
app.component(componentName, Components[componentName]);
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
export { index as default };
|