@volverjs/ui-vue 0.0.10-beta.50 → 0.0.10-beta.52
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/dist/components/VvCombobox/VvCombobox.es.js +450 -438
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +3 -1
- package/dist/components/VvCombobox/index.d.ts +8 -0
- package/dist/components/VvInputText/VvInputText.es.js +11 -4
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +8 -8
- package/dist/components/VvInputText/index.d.ts +4 -4
- package/dist/components/VvTextarea/VvTextarea.es.js +377 -371
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +8 -8
- package/dist/components/VvTextarea/index.d.ts +4 -4
- package/dist/components/index.es.js +188 -178
- package/dist/components/index.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +17 -11
- package/package.json +1 -1
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +4 -2
- package/src/components/VvCombobox/index.ts +2 -0
- package/src/components/VvInputText/VvInputText.vue +1 -0
- package/src/components/VvTextarea/VvTextarea.vue +1 -1
- package/src/props/index.ts +12 -5
|
@@ -79,6 +79,188 @@ const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for(
|
|
|
79
79
|
const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for(
|
|
80
80
|
"dropdownAction"
|
|
81
81
|
);
|
|
82
|
+
function equals(obj1, obj2, field) {
|
|
83
|
+
return deepEquals(obj1, obj2);
|
|
84
|
+
}
|
|
85
|
+
function deepEquals(a, b) {
|
|
86
|
+
if (a === b)
|
|
87
|
+
return true;
|
|
88
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
89
|
+
const arrA = Array.isArray(a);
|
|
90
|
+
const arrB = Array.isArray(b);
|
|
91
|
+
let i, length, key;
|
|
92
|
+
if (arrA && arrB) {
|
|
93
|
+
length = a.length;
|
|
94
|
+
if (length !== b.length)
|
|
95
|
+
return false;
|
|
96
|
+
for (i = length; i-- !== 0; ) {
|
|
97
|
+
if (!deepEquals(a[i], b[i]))
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
if (arrA !== arrB)
|
|
103
|
+
return false;
|
|
104
|
+
const dateA = a instanceof Date;
|
|
105
|
+
const dateB = b instanceof Date;
|
|
106
|
+
if (dateA !== dateB)
|
|
107
|
+
return false;
|
|
108
|
+
if (dateA && dateB)
|
|
109
|
+
return a.getTime() === b.getTime();
|
|
110
|
+
const regexpA = a instanceof RegExp;
|
|
111
|
+
const regexpB = b instanceof RegExp;
|
|
112
|
+
if (regexpA !== regexpB)
|
|
113
|
+
return false;
|
|
114
|
+
if (regexpA && regexpB)
|
|
115
|
+
return a.toString() === b.toString();
|
|
116
|
+
const keys = Object.keys(a);
|
|
117
|
+
length = keys.length;
|
|
118
|
+
if (length !== Object.keys(b).length)
|
|
119
|
+
return false;
|
|
120
|
+
for (i = length; i-- !== 0; ) {
|
|
121
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
for (i = length; i-- !== 0; ) {
|
|
125
|
+
key = keys[i];
|
|
126
|
+
if (!deepEquals(a[key], b[key]))
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
return Number.isNaN(a) && Number.isNaN(b);
|
|
132
|
+
}
|
|
133
|
+
function contains(value, list) {
|
|
134
|
+
if (value != null && list && list.length) {
|
|
135
|
+
for (const val of list) {
|
|
136
|
+
if (equals(value, val)) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
function isString(value) {
|
|
144
|
+
return typeof value === "string" || value instanceof String;
|
|
145
|
+
}
|
|
146
|
+
function joinLines(items) {
|
|
147
|
+
if (Array.isArray(items)) {
|
|
148
|
+
return items.filter((item) => isString(item)).join(" ");
|
|
149
|
+
}
|
|
150
|
+
return items;
|
|
151
|
+
}
|
|
152
|
+
function HintSlotFactory(propsOrRef, slots) {
|
|
153
|
+
const props = computed(() => {
|
|
154
|
+
if (isRef(propsOrRef)) {
|
|
155
|
+
return propsOrRef.value;
|
|
156
|
+
}
|
|
157
|
+
return propsOrRef;
|
|
158
|
+
});
|
|
159
|
+
const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
|
|
160
|
+
const validLabel = computed(() => joinLines(props.value.validLabel));
|
|
161
|
+
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
162
|
+
const hintLabel = computed(() => props.value.hintLabel);
|
|
163
|
+
const hasLoadingLabelOrSlot = computed(
|
|
164
|
+
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
165
|
+
);
|
|
166
|
+
const hasInvalidLabelOrSlot = computed(
|
|
167
|
+
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
168
|
+
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
169
|
+
)
|
|
170
|
+
);
|
|
171
|
+
const hasValidLabelOrSlot = computed(
|
|
172
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
|
|
173
|
+
);
|
|
174
|
+
const hasHintLabelOrSlot = computed(
|
|
175
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
176
|
+
);
|
|
177
|
+
const isVisible = computed(
|
|
178
|
+
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
179
|
+
);
|
|
180
|
+
const hintSlotScope = computed(() => ({
|
|
181
|
+
modelValue: props.value.modelValue,
|
|
182
|
+
valid: props.value.valid,
|
|
183
|
+
invalid: props.value.invalid,
|
|
184
|
+
loading: props.value.loading
|
|
185
|
+
}));
|
|
186
|
+
const HintSlot = defineComponent({
|
|
187
|
+
name: "HintSlot",
|
|
188
|
+
props: {
|
|
189
|
+
tag: {
|
|
190
|
+
type: String,
|
|
191
|
+
default: "small"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
setup() {
|
|
195
|
+
return {
|
|
196
|
+
isVisible,
|
|
197
|
+
invalidLabel,
|
|
198
|
+
validLabel,
|
|
199
|
+
loadingLabel,
|
|
200
|
+
hintLabel,
|
|
201
|
+
hasInvalidLabelOrSlot,
|
|
202
|
+
hasValidLabelOrSlot,
|
|
203
|
+
hasLoadingLabelOrSlot,
|
|
204
|
+
hasHintLabelOrSlot
|
|
205
|
+
};
|
|
206
|
+
},
|
|
207
|
+
render() {
|
|
208
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
209
|
+
if (this.isVisible) {
|
|
210
|
+
let role;
|
|
211
|
+
if (this.hasInvalidLabelOrSlot) {
|
|
212
|
+
role = "alert";
|
|
213
|
+
}
|
|
214
|
+
if (this.hasValidLabelOrSlot) {
|
|
215
|
+
role = "status";
|
|
216
|
+
}
|
|
217
|
+
if (this.hasLoadingLabelOrSlot) {
|
|
218
|
+
return h(
|
|
219
|
+
this.tag,
|
|
220
|
+
{
|
|
221
|
+
role
|
|
222
|
+
},
|
|
223
|
+
((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
if (this.hasInvalidLabelOrSlot) {
|
|
227
|
+
return h(
|
|
228
|
+
this.tag,
|
|
229
|
+
{
|
|
230
|
+
role
|
|
231
|
+
},
|
|
232
|
+
((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
if (this.hasValidLabelOrSlot) {
|
|
236
|
+
return h(
|
|
237
|
+
this.tag,
|
|
238
|
+
{
|
|
239
|
+
role
|
|
240
|
+
},
|
|
241
|
+
((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
return h(
|
|
245
|
+
this.tag,
|
|
246
|
+
{
|
|
247
|
+
role
|
|
248
|
+
},
|
|
249
|
+
((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
return {
|
|
256
|
+
hasInvalidLabelOrSlot,
|
|
257
|
+
hasHintLabelOrSlot,
|
|
258
|
+
hasValidLabelOrSlot,
|
|
259
|
+
hasLoadingLabelOrSlot,
|
|
260
|
+
hintSlotScope,
|
|
261
|
+
HintSlot
|
|
262
|
+
};
|
|
263
|
+
}
|
|
82
264
|
const LinkProps = {
|
|
83
265
|
/**
|
|
84
266
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
@@ -151,6 +333,15 @@ const DisabledProps = {
|
|
|
151
333
|
default: false
|
|
152
334
|
}
|
|
153
335
|
};
|
|
336
|
+
const RequiredProps = {
|
|
337
|
+
/**
|
|
338
|
+
* Whether the form control is required
|
|
339
|
+
*/
|
|
340
|
+
required: {
|
|
341
|
+
type: Boolean,
|
|
342
|
+
default: false
|
|
343
|
+
}
|
|
344
|
+
};
|
|
154
345
|
const SelectedProps = {
|
|
155
346
|
/**
|
|
156
347
|
* Whether the item is selected
|
|
@@ -361,444 +552,88 @@ const DropdownProps = {
|
|
|
361
552
|
* Keep open dropdown on click outside
|
|
362
553
|
*/
|
|
363
554
|
keepOpen: {
|
|
364
|
-
type: Boolean,
|
|
365
|
-
default: false
|
|
366
|
-
},
|
|
367
|
-
/**
|
|
368
|
-
* Autofocus first item on dropdown open
|
|
369
|
-
*/
|
|
370
|
-
autofocusFirst: {
|
|
371
|
-
type: Boolean,
|
|
372
|
-
default: true
|
|
373
|
-
},
|
|
374
|
-
/**
|
|
375
|
-
* Set dropdown width to the same as the trigger
|
|
376
|
-
*/
|
|
377
|
-
triggerWidth: {
|
|
378
|
-
type: Boolean,
|
|
379
|
-
default: false
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
const IdNameProps = {
|
|
383
|
-
...IdProps,
|
|
384
|
-
/**
|
|
385
|
-
* Input / Textarea name
|
|
386
|
-
* Name of the form control. Submitted with the form as part of a name/value pair
|
|
387
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
|
|
388
|
-
*/
|
|
389
|
-
name: { type: String, required: true }
|
|
390
|
-
};
|
|
391
|
-
const AutofocusProps = {
|
|
392
|
-
/**
|
|
393
|
-
* Global attribute autofocus
|
|
394
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
395
|
-
*/
|
|
396
|
-
autofocus: {
|
|
397
|
-
type: Boolean,
|
|
398
|
-
default: false
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
const AutocompleteProps = {
|
|
402
|
-
/**
|
|
403
|
-
* Global attribute autocomplete
|
|
404
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
|
|
405
|
-
*/
|
|
406
|
-
autocomplete: { type: String, default: "off" }
|
|
407
|
-
};
|
|
408
|
-
const ActionProps = {
|
|
409
|
-
...DisabledProps,
|
|
410
|
-
...LabelProps,
|
|
411
|
-
...PressedProps,
|
|
412
|
-
...ActiveProps,
|
|
413
|
-
...CurrentProps,
|
|
414
|
-
...LinkProps,
|
|
415
|
-
/**
|
|
416
|
-
* Button type
|
|
417
|
-
*/
|
|
418
|
-
type: {
|
|
419
|
-
type: String,
|
|
420
|
-
default: ButtonType.button,
|
|
421
|
-
validator: (value) => Object.values(ButtonType).includes(value)
|
|
422
|
-
},
|
|
423
|
-
/**
|
|
424
|
-
* Button aria-label
|
|
425
|
-
*/
|
|
426
|
-
ariaLabel: {
|
|
427
|
-
type: String,
|
|
428
|
-
default: void 0
|
|
429
|
-
},
|
|
430
|
-
/**
|
|
431
|
-
* Default tag for the action
|
|
432
|
-
*/
|
|
433
|
-
defaultTag: {
|
|
434
|
-
type: String,
|
|
435
|
-
default: ActionTag.button
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
({
|
|
439
|
-
storageType: {
|
|
440
|
-
type: String,
|
|
441
|
-
default: StorageType.local,
|
|
442
|
-
validator: (value) => Object.values(StorageType).includes(value)
|
|
443
|
-
},
|
|
444
|
-
storageKey: String
|
|
445
|
-
});
|
|
446
|
-
const VvComboboxProps = {
|
|
447
|
-
...IdNameProps,
|
|
448
|
-
...TabindexProps,
|
|
449
|
-
...ValidProps,
|
|
450
|
-
...InvalidProps,
|
|
451
|
-
...HintProps,
|
|
452
|
-
...LoadingProps,
|
|
453
|
-
...DisabledProps,
|
|
454
|
-
...ReadonlyProps,
|
|
455
|
-
...ModifiersProps,
|
|
456
|
-
...OptionsProps,
|
|
457
|
-
...IconProps,
|
|
458
|
-
...FloatingLabelProps,
|
|
459
|
-
...DropdownProps,
|
|
460
|
-
...LabelProps,
|
|
461
|
-
/**
|
|
462
|
-
* Dropdown show / hide transition name
|
|
463
|
-
*/
|
|
464
|
-
transitionName: {
|
|
465
|
-
type: String,
|
|
466
|
-
default: "vv-dropdown--mobile-fade-block"
|
|
467
|
-
},
|
|
468
|
-
/**
|
|
469
|
-
* modelValue can be a string, number, boolean, object or array of string, number, boolean, object
|
|
470
|
-
*/
|
|
471
|
-
modelValue: {
|
|
472
|
-
type: [String, Number, Boolean, Object, Array],
|
|
473
|
-
default: void 0
|
|
474
|
-
},
|
|
475
|
-
/**
|
|
476
|
-
* Label for no search results
|
|
477
|
-
*/
|
|
478
|
-
noResultsLabel: { type: String, default: "No results" },
|
|
479
|
-
/**
|
|
480
|
-
* Label for no options available
|
|
481
|
-
*/
|
|
482
|
-
noOptionsLabel: { type: String, default: "No options available" },
|
|
483
|
-
/**
|
|
484
|
-
* Label for selected option hint
|
|
485
|
-
*/
|
|
486
|
-
selectedHintLabel: { type: String, default: "Selected" },
|
|
487
|
-
/**
|
|
488
|
-
* Label for deselect action button
|
|
489
|
-
*/
|
|
490
|
-
deselectActionLabel: { type: String, default: "Deselect" },
|
|
491
|
-
/**
|
|
492
|
-
* Label for select option hint
|
|
493
|
-
*/
|
|
494
|
-
selectHintLabel: { type: String, default: "Press enter to select" },
|
|
495
|
-
/**
|
|
496
|
-
* Label for deselected option hint
|
|
497
|
-
*/
|
|
498
|
-
deselectHintLabel: { type: String, default: "Press enter to remove" },
|
|
499
|
-
/**
|
|
500
|
-
* Label close button
|
|
501
|
-
*/
|
|
502
|
-
closeLabel: { type: String, default: "Close" },
|
|
503
|
-
/**
|
|
504
|
-
* Select input placeholder
|
|
505
|
-
*/
|
|
506
|
-
placeholder: String,
|
|
507
|
-
/**
|
|
508
|
-
* Use input text to search on options
|
|
509
|
-
*/
|
|
510
|
-
searchable: Boolean,
|
|
511
|
-
/**
|
|
512
|
-
* Search function to filter options
|
|
513
|
-
*/
|
|
514
|
-
searchFunction: {
|
|
515
|
-
type: Function,
|
|
516
|
-
default: void 0
|
|
517
|
-
},
|
|
518
|
-
/**
|
|
519
|
-
* On searchable select is the input search placeholder
|
|
520
|
-
*/
|
|
521
|
-
searchPlaceholder: {
|
|
522
|
-
type: String,
|
|
523
|
-
default: "Search..."
|
|
524
|
-
},
|
|
525
|
-
/**
|
|
526
|
-
* The input search debounce time in ms
|
|
527
|
-
*/
|
|
528
|
-
debounceSearch: {
|
|
529
|
-
type: [Number, String],
|
|
530
|
-
default: 0
|
|
531
|
-
},
|
|
532
|
-
/**
|
|
533
|
-
* Manage modelValue as string[] or object[]
|
|
534
|
-
*/
|
|
535
|
-
multiple: Boolean,
|
|
536
|
-
/**
|
|
537
|
-
* The min number of selected values
|
|
538
|
-
*/
|
|
539
|
-
minValues: {
|
|
540
|
-
type: [Number, String],
|
|
541
|
-
default: 0
|
|
542
|
-
},
|
|
543
|
-
/**
|
|
544
|
-
* The max number of selected values
|
|
545
|
-
*/
|
|
546
|
-
maxValues: [Number, String],
|
|
547
|
-
/**
|
|
548
|
-
* If true the input will be unselectable
|
|
549
|
-
* @deprecated use minValues instead
|
|
550
|
-
*/
|
|
551
|
-
unselectable: { type: Boolean, default: true },
|
|
552
|
-
/**
|
|
553
|
-
* The select label separator visible to the user
|
|
554
|
-
*/
|
|
555
|
-
separator: { type: String, default: ", " },
|
|
556
|
-
/**
|
|
557
|
-
* Show native select
|
|
558
|
-
*/
|
|
559
|
-
native: Boolean,
|
|
560
|
-
/**
|
|
561
|
-
* Show badges
|
|
562
|
-
*/
|
|
563
|
-
badges: Boolean,
|
|
564
|
-
/**
|
|
565
|
-
* Badge modifiers
|
|
566
|
-
*/
|
|
567
|
-
badgeModifiers: {
|
|
568
|
-
type: [String, Array],
|
|
569
|
-
default: "action sm"
|
|
570
|
-
},
|
|
571
|
-
/**
|
|
572
|
-
* Set dropdown width to the same as the trigger
|
|
573
|
-
*/
|
|
574
|
-
triggerWidth: {
|
|
575
|
-
...DropdownProps.triggerWidth,
|
|
576
|
-
default: true
|
|
577
|
-
},
|
|
578
|
-
/**
|
|
579
|
-
* Dropdown modifiers
|
|
580
|
-
*/
|
|
581
|
-
dropdownModifiers: {
|
|
582
|
-
type: [String, Array],
|
|
583
|
-
default: "mobile"
|
|
584
|
-
},
|
|
585
|
-
/**
|
|
586
|
-
* Open dropdown on focus
|
|
587
|
-
*/
|
|
588
|
-
autoOpen: {
|
|
589
|
-
type: Boolean,
|
|
590
|
-
default: false
|
|
591
|
-
},
|
|
592
|
-
/**
|
|
593
|
-
* Select first option automatically
|
|
594
|
-
*/
|
|
595
|
-
autoselectFirst: {
|
|
596
|
-
type: Boolean,
|
|
597
|
-
default: false
|
|
598
|
-
},
|
|
599
|
-
/**
|
|
600
|
-
* Keep open dropdown on single select
|
|
601
|
-
*/
|
|
602
|
-
keepOpen: {
|
|
603
|
-
type: Boolean,
|
|
604
|
-
default: false
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
function useVvComboboxProps() {
|
|
608
|
-
return {
|
|
609
|
-
...VvComboboxProps,
|
|
610
|
-
options: {
|
|
611
|
-
...VvComboboxProps.options,
|
|
612
|
-
type: Array
|
|
613
|
-
},
|
|
614
|
-
searchFunction: {
|
|
615
|
-
...VvComboboxProps.searchFunction,
|
|
616
|
-
type: Function
|
|
617
|
-
}
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
function equals(obj1, obj2, field) {
|
|
621
|
-
return deepEquals(obj1, obj2);
|
|
622
|
-
}
|
|
623
|
-
function deepEquals(a, b) {
|
|
624
|
-
if (a === b)
|
|
625
|
-
return true;
|
|
626
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
627
|
-
const arrA = Array.isArray(a);
|
|
628
|
-
const arrB = Array.isArray(b);
|
|
629
|
-
let i, length, key;
|
|
630
|
-
if (arrA && arrB) {
|
|
631
|
-
length = a.length;
|
|
632
|
-
if (length !== b.length)
|
|
633
|
-
return false;
|
|
634
|
-
for (i = length; i-- !== 0; ) {
|
|
635
|
-
if (!deepEquals(a[i], b[i]))
|
|
636
|
-
return false;
|
|
637
|
-
}
|
|
638
|
-
return true;
|
|
639
|
-
}
|
|
640
|
-
if (arrA !== arrB)
|
|
641
|
-
return false;
|
|
642
|
-
const dateA = a instanceof Date;
|
|
643
|
-
const dateB = b instanceof Date;
|
|
644
|
-
if (dateA !== dateB)
|
|
645
|
-
return false;
|
|
646
|
-
if (dateA && dateB)
|
|
647
|
-
return a.getTime() === b.getTime();
|
|
648
|
-
const regexpA = a instanceof RegExp;
|
|
649
|
-
const regexpB = b instanceof RegExp;
|
|
650
|
-
if (regexpA !== regexpB)
|
|
651
|
-
return false;
|
|
652
|
-
if (regexpA && regexpB)
|
|
653
|
-
return a.toString() === b.toString();
|
|
654
|
-
const keys = Object.keys(a);
|
|
655
|
-
length = keys.length;
|
|
656
|
-
if (length !== Object.keys(b).length)
|
|
657
|
-
return false;
|
|
658
|
-
for (i = length; i-- !== 0; ) {
|
|
659
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
660
|
-
return false;
|
|
661
|
-
}
|
|
662
|
-
for (i = length; i-- !== 0; ) {
|
|
663
|
-
key = keys[i];
|
|
664
|
-
if (!deepEquals(a[key], b[key]))
|
|
665
|
-
return false;
|
|
666
|
-
}
|
|
667
|
-
return true;
|
|
668
|
-
}
|
|
669
|
-
return Number.isNaN(a) && Number.isNaN(b);
|
|
670
|
-
}
|
|
671
|
-
function contains(value, list) {
|
|
672
|
-
if (value != null && list && list.length) {
|
|
673
|
-
for (const val of list) {
|
|
674
|
-
if (equals(value, val)) {
|
|
675
|
-
return true;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
return false;
|
|
680
|
-
}
|
|
681
|
-
function isString(value) {
|
|
682
|
-
return typeof value === "string" || value instanceof String;
|
|
683
|
-
}
|
|
684
|
-
function joinLines(items) {
|
|
685
|
-
if (Array.isArray(items)) {
|
|
686
|
-
return items.filter((item) => isString(item)).join(" ");
|
|
687
|
-
}
|
|
688
|
-
return items;
|
|
689
|
-
}
|
|
690
|
-
function HintSlotFactory(propsOrRef, slots) {
|
|
691
|
-
const props = computed(() => {
|
|
692
|
-
if (isRef(propsOrRef)) {
|
|
693
|
-
return propsOrRef.value;
|
|
694
|
-
}
|
|
695
|
-
return propsOrRef;
|
|
696
|
-
});
|
|
697
|
-
const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
|
|
698
|
-
const validLabel = computed(() => joinLines(props.value.validLabel));
|
|
699
|
-
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
700
|
-
const hintLabel = computed(() => props.value.hintLabel);
|
|
701
|
-
const hasLoadingLabelOrSlot = computed(
|
|
702
|
-
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
703
|
-
);
|
|
704
|
-
const hasInvalidLabelOrSlot = computed(
|
|
705
|
-
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
706
|
-
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
707
|
-
)
|
|
708
|
-
);
|
|
709
|
-
const hasValidLabelOrSlot = computed(
|
|
710
|
-
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
|
|
711
|
-
);
|
|
712
|
-
const hasHintLabelOrSlot = computed(
|
|
713
|
-
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
714
|
-
);
|
|
715
|
-
const isVisible = computed(
|
|
716
|
-
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
717
|
-
);
|
|
718
|
-
const hintSlotScope = computed(() => ({
|
|
719
|
-
modelValue: props.value.modelValue,
|
|
720
|
-
valid: props.value.valid,
|
|
721
|
-
invalid: props.value.invalid,
|
|
722
|
-
loading: props.value.loading
|
|
723
|
-
}));
|
|
724
|
-
const HintSlot = defineComponent({
|
|
725
|
-
name: "HintSlot",
|
|
726
|
-
props: {
|
|
727
|
-
tag: {
|
|
728
|
-
type: String,
|
|
729
|
-
default: "small"
|
|
730
|
-
}
|
|
731
|
-
},
|
|
732
|
-
setup() {
|
|
733
|
-
return {
|
|
734
|
-
isVisible,
|
|
735
|
-
invalidLabel,
|
|
736
|
-
validLabel,
|
|
737
|
-
loadingLabel,
|
|
738
|
-
hintLabel,
|
|
739
|
-
hasInvalidLabelOrSlot,
|
|
740
|
-
hasValidLabelOrSlot,
|
|
741
|
-
hasLoadingLabelOrSlot,
|
|
742
|
-
hasHintLabelOrSlot
|
|
743
|
-
};
|
|
744
|
-
},
|
|
745
|
-
render() {
|
|
746
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
747
|
-
if (this.isVisible) {
|
|
748
|
-
let role;
|
|
749
|
-
if (this.hasInvalidLabelOrSlot) {
|
|
750
|
-
role = "alert";
|
|
751
|
-
}
|
|
752
|
-
if (this.hasValidLabelOrSlot) {
|
|
753
|
-
role = "status";
|
|
754
|
-
}
|
|
755
|
-
if (this.hasLoadingLabelOrSlot) {
|
|
756
|
-
return h(
|
|
757
|
-
this.tag,
|
|
758
|
-
{
|
|
759
|
-
role
|
|
760
|
-
},
|
|
761
|
-
((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
|
|
762
|
-
);
|
|
763
|
-
}
|
|
764
|
-
if (this.hasInvalidLabelOrSlot) {
|
|
765
|
-
return h(
|
|
766
|
-
this.tag,
|
|
767
|
-
{
|
|
768
|
-
role
|
|
769
|
-
},
|
|
770
|
-
((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
|
|
771
|
-
);
|
|
772
|
-
}
|
|
773
|
-
if (this.hasValidLabelOrSlot) {
|
|
774
|
-
return h(
|
|
775
|
-
this.tag,
|
|
776
|
-
{
|
|
777
|
-
role
|
|
778
|
-
},
|
|
779
|
-
((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
|
|
780
|
-
);
|
|
781
|
-
}
|
|
782
|
-
return h(
|
|
783
|
-
this.tag,
|
|
784
|
-
{
|
|
785
|
-
role
|
|
786
|
-
},
|
|
787
|
-
((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
|
|
788
|
-
);
|
|
789
|
-
}
|
|
790
|
-
return null;
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
return {
|
|
794
|
-
hasInvalidLabelOrSlot,
|
|
795
|
-
hasHintLabelOrSlot,
|
|
796
|
-
hasValidLabelOrSlot,
|
|
797
|
-
hasLoadingLabelOrSlot,
|
|
798
|
-
hintSlotScope,
|
|
799
|
-
HintSlot
|
|
800
|
-
};
|
|
801
|
-
}
|
|
555
|
+
type: Boolean,
|
|
556
|
+
default: false
|
|
557
|
+
},
|
|
558
|
+
/**
|
|
559
|
+
* Autofocus first item on dropdown open
|
|
560
|
+
*/
|
|
561
|
+
autofocusFirst: {
|
|
562
|
+
type: Boolean,
|
|
563
|
+
default: true
|
|
564
|
+
},
|
|
565
|
+
/**
|
|
566
|
+
* Set dropdown width to the same as the trigger
|
|
567
|
+
*/
|
|
568
|
+
triggerWidth: {
|
|
569
|
+
type: Boolean,
|
|
570
|
+
default: false
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
const IdNameProps = {
|
|
574
|
+
...IdProps,
|
|
575
|
+
/**
|
|
576
|
+
* Input / Textarea name
|
|
577
|
+
* Name of the form control. Submitted with the form as part of a name/value pair
|
|
578
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
|
|
579
|
+
*/
|
|
580
|
+
name: { type: String, required: true }
|
|
581
|
+
};
|
|
582
|
+
const AutofocusProps = {
|
|
583
|
+
/**
|
|
584
|
+
* Global attribute autofocus
|
|
585
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
586
|
+
*/
|
|
587
|
+
autofocus: {
|
|
588
|
+
type: Boolean,
|
|
589
|
+
default: false
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
const AutocompleteProps = {
|
|
593
|
+
/**
|
|
594
|
+
* Global attribute autocomplete
|
|
595
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
|
|
596
|
+
*/
|
|
597
|
+
autocomplete: { type: String, default: "off" }
|
|
598
|
+
};
|
|
599
|
+
const ActionProps = {
|
|
600
|
+
...DisabledProps,
|
|
601
|
+
...LabelProps,
|
|
602
|
+
...PressedProps,
|
|
603
|
+
...ActiveProps,
|
|
604
|
+
...CurrentProps,
|
|
605
|
+
...LinkProps,
|
|
606
|
+
/**
|
|
607
|
+
* Button type
|
|
608
|
+
*/
|
|
609
|
+
type: {
|
|
610
|
+
type: String,
|
|
611
|
+
default: ButtonType.button,
|
|
612
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
613
|
+
},
|
|
614
|
+
/**
|
|
615
|
+
* Button aria-label
|
|
616
|
+
*/
|
|
617
|
+
ariaLabel: {
|
|
618
|
+
type: String,
|
|
619
|
+
default: void 0
|
|
620
|
+
},
|
|
621
|
+
/**
|
|
622
|
+
* Default tag for the action
|
|
623
|
+
*/
|
|
624
|
+
defaultTag: {
|
|
625
|
+
type: String,
|
|
626
|
+
default: ActionTag.button
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
({
|
|
630
|
+
storageType: {
|
|
631
|
+
type: String,
|
|
632
|
+
default: StorageType.local,
|
|
633
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
634
|
+
},
|
|
635
|
+
storageKey: String
|
|
636
|
+
});
|
|
802
637
|
const VvBadgeProps = {
|
|
803
638
|
...ModifiersProps,
|
|
804
639
|
value: [String, Number]
|
|
@@ -2572,6 +2407,181 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2572
2407
|
};
|
|
2573
2408
|
}
|
|
2574
2409
|
});
|
|
2410
|
+
const VvComboboxProps = {
|
|
2411
|
+
...IdNameProps,
|
|
2412
|
+
...TabindexProps,
|
|
2413
|
+
...ValidProps,
|
|
2414
|
+
...InvalidProps,
|
|
2415
|
+
...HintProps,
|
|
2416
|
+
...LoadingProps,
|
|
2417
|
+
...DisabledProps,
|
|
2418
|
+
...ReadonlyProps,
|
|
2419
|
+
...ModifiersProps,
|
|
2420
|
+
...OptionsProps,
|
|
2421
|
+
...IconProps,
|
|
2422
|
+
...FloatingLabelProps,
|
|
2423
|
+
...DropdownProps,
|
|
2424
|
+
...LabelProps,
|
|
2425
|
+
...RequiredProps,
|
|
2426
|
+
/**
|
|
2427
|
+
* Dropdown show / hide transition name
|
|
2428
|
+
*/
|
|
2429
|
+
transitionName: {
|
|
2430
|
+
type: String,
|
|
2431
|
+
default: "vv-dropdown--mobile-fade-block"
|
|
2432
|
+
},
|
|
2433
|
+
/**
|
|
2434
|
+
* modelValue can be a string, number, boolean, object or array of string, number, boolean, object
|
|
2435
|
+
*/
|
|
2436
|
+
modelValue: {
|
|
2437
|
+
type: [String, Number, Boolean, Object, Array],
|
|
2438
|
+
default: void 0
|
|
2439
|
+
},
|
|
2440
|
+
/**
|
|
2441
|
+
* Label for no search results
|
|
2442
|
+
*/
|
|
2443
|
+
noResultsLabel: { type: String, default: "No results" },
|
|
2444
|
+
/**
|
|
2445
|
+
* Label for no options available
|
|
2446
|
+
*/
|
|
2447
|
+
noOptionsLabel: { type: String, default: "No options available" },
|
|
2448
|
+
/**
|
|
2449
|
+
* Label for selected option hint
|
|
2450
|
+
*/
|
|
2451
|
+
selectedHintLabel: { type: String, default: "Selected" },
|
|
2452
|
+
/**
|
|
2453
|
+
* Label for deselect action button
|
|
2454
|
+
*/
|
|
2455
|
+
deselectActionLabel: { type: String, default: "Deselect" },
|
|
2456
|
+
/**
|
|
2457
|
+
* Label for select option hint
|
|
2458
|
+
*/
|
|
2459
|
+
selectHintLabel: { type: String, default: "Press enter to select" },
|
|
2460
|
+
/**
|
|
2461
|
+
* Label for deselected option hint
|
|
2462
|
+
*/
|
|
2463
|
+
deselectHintLabel: { type: String, default: "Press enter to remove" },
|
|
2464
|
+
/**
|
|
2465
|
+
* Label close button
|
|
2466
|
+
*/
|
|
2467
|
+
closeLabel: { type: String, default: "Close" },
|
|
2468
|
+
/**
|
|
2469
|
+
* Select input placeholder
|
|
2470
|
+
*/
|
|
2471
|
+
placeholder: String,
|
|
2472
|
+
/**
|
|
2473
|
+
* Use input text to search on options
|
|
2474
|
+
*/
|
|
2475
|
+
searchable: Boolean,
|
|
2476
|
+
/**
|
|
2477
|
+
* Search function to filter options
|
|
2478
|
+
*/
|
|
2479
|
+
searchFunction: {
|
|
2480
|
+
type: Function,
|
|
2481
|
+
default: void 0
|
|
2482
|
+
},
|
|
2483
|
+
/**
|
|
2484
|
+
* On searchable select is the input search placeholder
|
|
2485
|
+
*/
|
|
2486
|
+
searchPlaceholder: {
|
|
2487
|
+
type: String,
|
|
2488
|
+
default: "Search..."
|
|
2489
|
+
},
|
|
2490
|
+
/**
|
|
2491
|
+
* The input search debounce time in ms
|
|
2492
|
+
*/
|
|
2493
|
+
debounceSearch: {
|
|
2494
|
+
type: [Number, String],
|
|
2495
|
+
default: 0
|
|
2496
|
+
},
|
|
2497
|
+
/**
|
|
2498
|
+
* Manage modelValue as string[] or object[]
|
|
2499
|
+
*/
|
|
2500
|
+
multiple: Boolean,
|
|
2501
|
+
/**
|
|
2502
|
+
* The min number of selected values
|
|
2503
|
+
*/
|
|
2504
|
+
minValues: {
|
|
2505
|
+
type: [Number, String],
|
|
2506
|
+
default: 0
|
|
2507
|
+
},
|
|
2508
|
+
/**
|
|
2509
|
+
* The max number of selected values
|
|
2510
|
+
*/
|
|
2511
|
+
maxValues: [Number, String],
|
|
2512
|
+
/**
|
|
2513
|
+
* If true the input will be unselectable
|
|
2514
|
+
* @deprecated use minValues instead
|
|
2515
|
+
*/
|
|
2516
|
+
unselectable: { type: Boolean, default: true },
|
|
2517
|
+
/**
|
|
2518
|
+
* The select label separator visible to the user
|
|
2519
|
+
*/
|
|
2520
|
+
separator: { type: String, default: ", " },
|
|
2521
|
+
/**
|
|
2522
|
+
* Show native select
|
|
2523
|
+
*/
|
|
2524
|
+
native: Boolean,
|
|
2525
|
+
/**
|
|
2526
|
+
* Show badges
|
|
2527
|
+
*/
|
|
2528
|
+
badges: Boolean,
|
|
2529
|
+
/**
|
|
2530
|
+
* Badge modifiers
|
|
2531
|
+
*/
|
|
2532
|
+
badgeModifiers: {
|
|
2533
|
+
type: [String, Array],
|
|
2534
|
+
default: "action sm"
|
|
2535
|
+
},
|
|
2536
|
+
/**
|
|
2537
|
+
* Set dropdown width to the same as the trigger
|
|
2538
|
+
*/
|
|
2539
|
+
triggerWidth: {
|
|
2540
|
+
...DropdownProps.triggerWidth,
|
|
2541
|
+
default: true
|
|
2542
|
+
},
|
|
2543
|
+
/**
|
|
2544
|
+
* Dropdown modifiers
|
|
2545
|
+
*/
|
|
2546
|
+
dropdownModifiers: {
|
|
2547
|
+
type: [String, Array],
|
|
2548
|
+
default: "mobile"
|
|
2549
|
+
},
|
|
2550
|
+
/**
|
|
2551
|
+
* Open dropdown on focus
|
|
2552
|
+
*/
|
|
2553
|
+
autoOpen: {
|
|
2554
|
+
type: Boolean,
|
|
2555
|
+
default: false
|
|
2556
|
+
},
|
|
2557
|
+
/**
|
|
2558
|
+
* Select first option automatically
|
|
2559
|
+
*/
|
|
2560
|
+
autoselectFirst: {
|
|
2561
|
+
type: Boolean,
|
|
2562
|
+
default: false
|
|
2563
|
+
},
|
|
2564
|
+
/**
|
|
2565
|
+
* Keep open dropdown on single select
|
|
2566
|
+
*/
|
|
2567
|
+
keepOpen: {
|
|
2568
|
+
type: Boolean,
|
|
2569
|
+
default: false
|
|
2570
|
+
}
|
|
2571
|
+
};
|
|
2572
|
+
function useVvComboboxProps() {
|
|
2573
|
+
return {
|
|
2574
|
+
...VvComboboxProps,
|
|
2575
|
+
options: {
|
|
2576
|
+
...VvComboboxProps.options,
|
|
2577
|
+
type: Array
|
|
2578
|
+
},
|
|
2579
|
+
searchFunction: {
|
|
2580
|
+
...VvComboboxProps.searchFunction,
|
|
2581
|
+
type: Function
|
|
2582
|
+
}
|
|
2583
|
+
};
|
|
2584
|
+
}
|
|
2575
2585
|
const _hoisted_1 = ["id"];
|
|
2576
2586
|
const _hoisted_2 = ["id", "for"];
|
|
2577
2587
|
const _hoisted_3 = ["id", "aria-controls", "placeholder"];
|
|
@@ -2694,6 +2704,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2694
2704
|
iconPosition,
|
|
2695
2705
|
modifiers,
|
|
2696
2706
|
disabled,
|
|
2707
|
+
required,
|
|
2697
2708
|
readonly,
|
|
2698
2709
|
loading,
|
|
2699
2710
|
valid,
|
|
@@ -2757,6 +2768,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2757
2768
|
modifiers,
|
|
2758
2769
|
computed(() => ({
|
|
2759
2770
|
"disabled": disabled.value,
|
|
2771
|
+
"required": required.value,
|
|
2760
2772
|
"loading": isLoading.value,
|
|
2761
2773
|
"readonly": readonly.value,
|
|
2762
2774
|
"icon-before": hasIconBefore.value !== void 0,
|