@volverjs/ui-vue 0.0.10-beta.22 → 0.0.10-beta.24
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/VvAccordion/VvAccordion.es.js +119 -79
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +18 -4
- package/dist/components/VvAccordion/index.d.ts +4 -8
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +250 -119
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +18 -6
- package/dist/components/VvAccordionGroup/index.d.ts +3 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +92 -98
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +7 -7
- package/dist/components/VvButton/index.d.ts +11 -11
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -13
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +3 -3
- package/dist/components/VvCheckbox/VvCheckbox.es.js +81 -87
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +6 -6
- package/dist/components/VvCheckbox/index.d.ts +2 -2
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +15 -29
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +5 -5
- package/dist/components/VvCombobox/VvCombobox.es.js +13 -16
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +11 -11
- package/dist/components/VvCombobox/index.d.ts +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +5 -5
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +1 -1
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +1 -1
- package/dist/components/VvDropdown/index.d.ts +1 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +199 -169
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +55 -9
- package/dist/components/VvInputFile/index.d.ts +24 -3
- package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +6 -6
- package/dist/components/VvProgress/VvProgress.vue.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +64 -70
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +6 -6
- package/dist/components/VvRadio/index.d.ts +6 -6
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +15 -29
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +5 -5
- package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +5 -5
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +3 -3
- package/dist/components/VvTooltip/index.d.ts +1 -1
- package/dist/components/index.es.js +478 -324
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useInjectAlert.d.ts +1 -6
- package/dist/composables/group/useInjectedGroupState.d.ts +4 -5
- package/dist/composables/group/useProvideGroupState.d.ts +3 -3
- package/dist/constants.d.ts +6 -10
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +3 -2
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +1 -1
- package/dist/resolvers/unplugin.es.js +3 -2
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +38 -14
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +259 -101
- package/dist/types/group.d.ts +37 -15
- package/package.json +37 -36
- 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/VvAccordion/VvAccordion.vue +119 -56
- package/src/components/VvAccordion/index.ts +8 -23
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +140 -41
- package/src/components/VvAccordionGroup/index.ts +3 -1
- package/src/components/VvButton/index.ts +7 -12
- package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -2
- package/src/components/VvCheckbox/index.ts +2 -2
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +1 -2
- package/src/components/VvInputFile/VvInputFile.vue +72 -47
- package/src/components/VvInputFile/index.ts +22 -3
- package/src/components/VvRadio/index.ts +5 -5
- package/src/components/VvRadioGroup/VvRadioGroup.vue +1 -2
- package/src/composables/group/useInjectedGroupState.ts +20 -16
- package/src/composables/group/useProvideGroupState.ts +10 -15
- package/src/constants.ts +19 -14
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +15 -9
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +1 -1
- package/src/types/group.ts +22 -14
|
@@ -83,7 +83,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
83
83
|
default: undefined;
|
|
84
84
|
};
|
|
85
85
|
placement: {
|
|
86
|
-
type: globalThis.PropType<"
|
|
86
|
+
type: globalThis.PropType<"top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end">;
|
|
87
87
|
default: import("../../constants").Side;
|
|
88
88
|
validator: (value: never) => boolean;
|
|
89
89
|
};
|
|
@@ -401,7 +401,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
401
401
|
default: undefined;
|
|
402
402
|
};
|
|
403
403
|
placement: {
|
|
404
|
-
type: globalThis.PropType<"
|
|
404
|
+
type: globalThis.PropType<"top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end">;
|
|
405
405
|
default: import("../../constants").Side;
|
|
406
406
|
validator: (value: never) => boolean;
|
|
407
407
|
};
|
|
@@ -634,14 +634,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
634
634
|
};
|
|
635
635
|
id: (StringConstructor | NumberConstructor)[];
|
|
636
636
|
}>>, {
|
|
637
|
-
readonly: boolean;
|
|
638
|
-
disabled: boolean;
|
|
639
|
-
valid: boolean;
|
|
640
|
-
invalid: boolean;
|
|
641
|
-
modelValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
642
|
-
multiple: boolean;
|
|
643
|
-
unselectable: boolean;
|
|
644
|
-
modifiers: string | string[];
|
|
645
637
|
size: boolean | {
|
|
646
638
|
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
647
639
|
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
@@ -686,6 +678,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
686
678
|
floating: boolean;
|
|
687
679
|
options: (string | Option)[];
|
|
688
680
|
label: string | number;
|
|
681
|
+
disabled: boolean;
|
|
682
|
+
modelValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
683
|
+
modifiers: string | string[];
|
|
689
684
|
shift: boolean | {
|
|
690
685
|
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
691
686
|
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
@@ -741,14 +736,19 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
741
736
|
iconPosition: "before" | "after";
|
|
742
737
|
loading: boolean;
|
|
743
738
|
loadingLabel: string;
|
|
739
|
+
unselectable: boolean;
|
|
740
|
+
multiple: boolean;
|
|
741
|
+
readonly: boolean;
|
|
744
742
|
hintLabel: string;
|
|
743
|
+
invalid: boolean;
|
|
745
744
|
invalidLabel: string | unknown[];
|
|
745
|
+
valid: boolean;
|
|
746
746
|
validLabel: string | unknown[];
|
|
747
747
|
tabindex: string | number;
|
|
748
748
|
labelKey: string | Function;
|
|
749
749
|
valueKey: string | Function;
|
|
750
750
|
disabledKey: string | Function;
|
|
751
|
-
placement: "
|
|
751
|
+
placement: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end";
|
|
752
752
|
strategy: "absolute" | "fixed";
|
|
753
753
|
transitionName: string;
|
|
754
754
|
offset: string | import("@floating-ui/core").OffsetOptions | undefined;
|
|
@@ -157,7 +157,7 @@ export declare const VvComboboxProps: {
|
|
|
157
157
|
default: undefined;
|
|
158
158
|
};
|
|
159
159
|
placement: {
|
|
160
|
-
type: PropType<"
|
|
160
|
+
type: PropType<"top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end">;
|
|
161
161
|
default: import("../../constants").Side;
|
|
162
162
|
validator: (value: never) => boolean;
|
|
163
163
|
};
|
|
@@ -19,7 +19,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
19
19
|
default: undefined;
|
|
20
20
|
};
|
|
21
21
|
placement: {
|
|
22
|
-
type: globalThis.PropType<"
|
|
22
|
+
type: globalThis.PropType<"top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end">;
|
|
23
23
|
default: Side;
|
|
24
24
|
validator: (value: never) => boolean;
|
|
25
25
|
};
|
|
@@ -218,7 +218,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
218
218
|
default: undefined;
|
|
219
219
|
};
|
|
220
220
|
placement: {
|
|
221
|
-
type: globalThis.PropType<"
|
|
221
|
+
type: globalThis.PropType<"top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end">;
|
|
222
222
|
default: Side;
|
|
223
223
|
validator: (value: never) => boolean;
|
|
224
224
|
};
|
|
@@ -393,8 +393,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
393
393
|
onAfterExpand?: ((...args: any[]) => any) | undefined;
|
|
394
394
|
onAfterCollapse?: ((...args: any[]) => any) | undefined;
|
|
395
395
|
}, {
|
|
396
|
-
modelValue: boolean;
|
|
397
|
-
modifiers: string | string[];
|
|
398
396
|
size: boolean | {
|
|
399
397
|
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
400
398
|
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
@@ -437,6 +435,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
437
435
|
}) => void | Promise<void>) | undefined;
|
|
438
436
|
}> | undefined;
|
|
439
437
|
reference: HTMLElement | null;
|
|
438
|
+
modelValue: boolean;
|
|
439
|
+
modifiers: string | string[];
|
|
440
440
|
shift: boolean | {
|
|
441
441
|
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
442
442
|
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
@@ -488,7 +488,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
488
488
|
flipAlignment?: boolean | undefined;
|
|
489
489
|
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
490
490
|
}> | undefined;
|
|
491
|
-
placement: "
|
|
491
|
+
placement: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end";
|
|
492
492
|
strategy: "absolute" | "fixed";
|
|
493
493
|
transitionName: string;
|
|
494
494
|
offset: string | import("@floating-ui/core").OffsetOptions | undefined;
|
|
@@ -109,9 +109,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
109
109
|
default: boolean;
|
|
110
110
|
};
|
|
111
111
|
}>>, {
|
|
112
|
+
label: string | number;
|
|
112
113
|
disabled: boolean;
|
|
113
114
|
modifiers: string | string[];
|
|
114
|
-
label: string | number;
|
|
115
115
|
type: "button" | "submit" | "reset";
|
|
116
116
|
target: "_blank" | "_self" | "_parent" | "_top";
|
|
117
117
|
ariaLabel: string;
|
|
@@ -52,8 +52,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
52
52
|
};
|
|
53
53
|
}>>, {
|
|
54
54
|
disabled: boolean;
|
|
55
|
-
unselectable: boolean;
|
|
56
55
|
modifiers: string | string[];
|
|
56
|
+
unselectable: boolean;
|
|
57
57
|
selected: boolean;
|
|
58
58
|
}, {}>, {
|
|
59
59
|
default?(_: {}): any;
|
|
@@ -28,7 +28,7 @@ export declare const VvDropdownProps: {
|
|
|
28
28
|
default: undefined;
|
|
29
29
|
};
|
|
30
30
|
placement: {
|
|
31
|
-
type: PropType<"
|
|
31
|
+
type: PropType<"top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end">;
|
|
32
32
|
default: import("../../constants").Side;
|
|
33
33
|
validator: (value: never) => boolean;
|
|
34
34
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { inject, computed, unref, defineComponent, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, resolveDynamicComponent, withCtx, renderSlot, createTextVNode, toDisplayString, toRef, useAttrs, useSlots, createElementBlock, Fragment, isRef, h, onBeforeUnmount, normalizeClass, withModifiers, createElementVNode, normalizeProps,
|
|
1
|
+
import { inject, computed, unref, defineComponent, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, resolveDynamicComponent, withCtx, renderSlot, createTextVNode, toDisplayString, toRef, useAttrs, useSlots, createElementBlock, Fragment, isRef, h, onBeforeUnmount, normalizeClass, withModifiers, createElementVNode, normalizeProps, createVNode, guardReactiveProps, createSlots } from "vue";
|
|
2
2
|
import { useVModel } from "@vueuse/core";
|
|
3
3
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
4
4
|
import { uid } from "uid";
|
|
5
|
+
import Sortable from "vuedraggable";
|
|
5
6
|
const ACTION_ICONS = {
|
|
6
7
|
showPassword: "eye-on",
|
|
7
8
|
hidePassword: "eye-off",
|
|
@@ -67,7 +68,9 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
|
67
68
|
return AnchorTarget2;
|
|
68
69
|
})(AnchorTarget || {});
|
|
69
70
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
70
|
-
const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
|
|
71
|
+
const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
|
|
72
|
+
"buttonGroup"
|
|
73
|
+
);
|
|
71
74
|
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
|
|
72
75
|
"dropdownTrigger"
|
|
73
76
|
);
|
|
@@ -638,100 +641,15 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
638
641
|
};
|
|
639
642
|
}
|
|
640
643
|
});
|
|
641
|
-
function equals(obj1, obj2, field) {
|
|
642
|
-
if (field) {
|
|
643
|
-
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
644
|
-
}
|
|
645
|
-
return deepEquals(obj1, obj2);
|
|
646
|
-
}
|
|
647
|
-
function deepEquals(a, b) {
|
|
648
|
-
if (a === b)
|
|
649
|
-
return true;
|
|
650
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
651
|
-
const arrA = Array.isArray(a);
|
|
652
|
-
const arrB = Array.isArray(b);
|
|
653
|
-
let i, length, key;
|
|
654
|
-
if (arrA && arrB) {
|
|
655
|
-
length = a.length;
|
|
656
|
-
if (length != b.length)
|
|
657
|
-
return false;
|
|
658
|
-
for (i = length; i-- !== 0; )
|
|
659
|
-
if (!deepEquals(a[i], b[i]))
|
|
660
|
-
return false;
|
|
661
|
-
return true;
|
|
662
|
-
}
|
|
663
|
-
if (arrA != arrB)
|
|
664
|
-
return false;
|
|
665
|
-
const dateA = a instanceof Date, dateB = b instanceof Date;
|
|
666
|
-
if (dateA != dateB)
|
|
667
|
-
return false;
|
|
668
|
-
if (dateA && dateB)
|
|
669
|
-
return a.getTime() == b.getTime();
|
|
670
|
-
const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
|
|
671
|
-
if (regexpA != regexpB)
|
|
672
|
-
return false;
|
|
673
|
-
if (regexpA && regexpB)
|
|
674
|
-
return a.toString() == b.toString();
|
|
675
|
-
const keys = Object.keys(a);
|
|
676
|
-
length = keys.length;
|
|
677
|
-
if (length !== Object.keys(b).length)
|
|
678
|
-
return false;
|
|
679
|
-
for (i = length; i-- !== 0; )
|
|
680
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
681
|
-
return false;
|
|
682
|
-
for (i = length; i-- !== 0; ) {
|
|
683
|
-
key = keys[i];
|
|
684
|
-
if (!deepEquals(a[key], b[key]))
|
|
685
|
-
return false;
|
|
686
|
-
}
|
|
687
|
-
return true;
|
|
688
|
-
}
|
|
689
|
-
return a !== a && b !== b;
|
|
690
|
-
}
|
|
691
|
-
function resolveFieldData(data, field) {
|
|
692
|
-
if (data && Object.keys(data).length && field) {
|
|
693
|
-
if (field.indexOf(".") === -1) {
|
|
694
|
-
return data[field];
|
|
695
|
-
} else {
|
|
696
|
-
const fields = field.split(".");
|
|
697
|
-
let value = data;
|
|
698
|
-
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
699
|
-
if (data == null) {
|
|
700
|
-
return null;
|
|
701
|
-
}
|
|
702
|
-
value = value[fields[i]];
|
|
703
|
-
}
|
|
704
|
-
return value;
|
|
705
|
-
}
|
|
706
|
-
} else {
|
|
707
|
-
return null;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
function contains(value, list) {
|
|
711
|
-
if (value != null && list && list.length) {
|
|
712
|
-
for (const val of list) {
|
|
713
|
-
if (equals(value, val)) {
|
|
714
|
-
return true;
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
return false;
|
|
719
|
-
}
|
|
720
|
-
function isEmpty(value) {
|
|
721
|
-
return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
|
|
722
|
-
}
|
|
723
|
-
function isString(value) {
|
|
724
|
-
return typeof value === "string" || value instanceof String;
|
|
725
|
-
}
|
|
726
644
|
function useInjectedGroupState(groupKey) {
|
|
727
645
|
const group = inject(groupKey, void 0);
|
|
728
|
-
const isInGroup = computed(() =>
|
|
646
|
+
const isInGroup = computed(() => group !== void 0);
|
|
729
647
|
function getGroupOrLocalRef(propName, props, emit) {
|
|
730
|
-
|
|
731
|
-
|
|
648
|
+
const groupPropValue = group == null ? void 0 : group[propName];
|
|
649
|
+
if (groupPropValue) {
|
|
732
650
|
return computed({
|
|
733
651
|
get() {
|
|
734
|
-
return groupPropValue
|
|
652
|
+
return groupPropValue.value;
|
|
735
653
|
},
|
|
736
654
|
set(value) {
|
|
737
655
|
groupPropValue.value = value;
|
|
@@ -744,8 +662,9 @@ function useInjectedGroupState(groupKey) {
|
|
|
744
662
|
return propRef.value;
|
|
745
663
|
},
|
|
746
664
|
set(value) {
|
|
747
|
-
if (emit)
|
|
665
|
+
if (emit) {
|
|
748
666
|
emit(`update:${propName}`, value);
|
|
667
|
+
}
|
|
749
668
|
}
|
|
750
669
|
});
|
|
751
670
|
}
|
|
@@ -809,14 +728,11 @@ function useGroupProps(props, emit) {
|
|
|
809
728
|
const { id, iconPosition, icon, label, pressed } = toRefs(props);
|
|
810
729
|
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
811
730
|
const toggle = getGroupOrLocalRef("toggle", props);
|
|
812
|
-
const unselectable = getGroupOrLocalRef(
|
|
813
|
-
|
|
814
|
-
props
|
|
815
|
-
);
|
|
816
|
-
const multiple = computed(() => (group == null ? void 0 : group.value.multiple.value) ?? false);
|
|
731
|
+
const unselectable = getGroupOrLocalRef("unselectable", props);
|
|
732
|
+
const multiple = computed(() => (group == null ? void 0 : group.multiple.value) ?? false);
|
|
817
733
|
const modifiers = computed(() => {
|
|
818
734
|
let localModifiers = props.modifiers;
|
|
819
|
-
let groupModifiers = group == null ? void 0 : group.
|
|
735
|
+
let groupModifiers = group == null ? void 0 : group.modifiers.value;
|
|
820
736
|
const toReturn = /* @__PURE__ */ new Set();
|
|
821
737
|
if (localModifiers) {
|
|
822
738
|
if (!Array.isArray(localModifiers)) {
|
|
@@ -833,10 +749,7 @@ function useGroupProps(props, emit) {
|
|
|
833
749
|
return Array.from(toReturn);
|
|
834
750
|
});
|
|
835
751
|
const disabled = computed(
|
|
836
|
-
() =>
|
|
837
|
-
var _a;
|
|
838
|
-
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
839
|
-
}
|
|
752
|
+
() => Boolean(props.disabled || (group == null ? void 0 : group.disabled.value))
|
|
840
753
|
);
|
|
841
754
|
return {
|
|
842
755
|
// group props
|
|
@@ -857,6 +770,88 @@ function useGroupProps(props, emit) {
|
|
|
857
770
|
};
|
|
858
771
|
}
|
|
859
772
|
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
|
|
773
|
+
function equals(obj1, obj2, field) {
|
|
774
|
+
if (field) {
|
|
775
|
+
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
776
|
+
}
|
|
777
|
+
return deepEquals(obj1, obj2);
|
|
778
|
+
}
|
|
779
|
+
function deepEquals(a, b) {
|
|
780
|
+
if (a === b)
|
|
781
|
+
return true;
|
|
782
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
783
|
+
const arrA = Array.isArray(a);
|
|
784
|
+
const arrB = Array.isArray(b);
|
|
785
|
+
let i, length, key;
|
|
786
|
+
if (arrA && arrB) {
|
|
787
|
+
length = a.length;
|
|
788
|
+
if (length != b.length)
|
|
789
|
+
return false;
|
|
790
|
+
for (i = length; i-- !== 0; )
|
|
791
|
+
if (!deepEquals(a[i], b[i]))
|
|
792
|
+
return false;
|
|
793
|
+
return true;
|
|
794
|
+
}
|
|
795
|
+
if (arrA != arrB)
|
|
796
|
+
return false;
|
|
797
|
+
const dateA = a instanceof Date, dateB = b instanceof Date;
|
|
798
|
+
if (dateA != dateB)
|
|
799
|
+
return false;
|
|
800
|
+
if (dateA && dateB)
|
|
801
|
+
return a.getTime() == b.getTime();
|
|
802
|
+
const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
|
|
803
|
+
if (regexpA != regexpB)
|
|
804
|
+
return false;
|
|
805
|
+
if (regexpA && regexpB)
|
|
806
|
+
return a.toString() == b.toString();
|
|
807
|
+
const keys = Object.keys(a);
|
|
808
|
+
length = keys.length;
|
|
809
|
+
if (length !== Object.keys(b).length)
|
|
810
|
+
return false;
|
|
811
|
+
for (i = length; i-- !== 0; )
|
|
812
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
813
|
+
return false;
|
|
814
|
+
for (i = length; i-- !== 0; ) {
|
|
815
|
+
key = keys[i];
|
|
816
|
+
if (!deepEquals(a[key], b[key]))
|
|
817
|
+
return false;
|
|
818
|
+
}
|
|
819
|
+
return true;
|
|
820
|
+
}
|
|
821
|
+
return a !== a && b !== b;
|
|
822
|
+
}
|
|
823
|
+
function resolveFieldData(data, field) {
|
|
824
|
+
if (data && Object.keys(data).length && field) {
|
|
825
|
+
if (field.indexOf(".") === -1) {
|
|
826
|
+
return data[field];
|
|
827
|
+
} else {
|
|
828
|
+
const fields = field.split(".");
|
|
829
|
+
let value = data;
|
|
830
|
+
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
831
|
+
if (data == null) {
|
|
832
|
+
return null;
|
|
833
|
+
}
|
|
834
|
+
value = value[fields[i]];
|
|
835
|
+
}
|
|
836
|
+
return value;
|
|
837
|
+
}
|
|
838
|
+
} else {
|
|
839
|
+
return null;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
function contains(value, list) {
|
|
843
|
+
if (value != null && list && list.length) {
|
|
844
|
+
for (const val of list) {
|
|
845
|
+
if (equals(value, val)) {
|
|
846
|
+
return true;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return false;
|
|
851
|
+
}
|
|
852
|
+
function isString(value) {
|
|
853
|
+
return typeof value === "string" || value instanceof String;
|
|
854
|
+
}
|
|
860
855
|
function useComponentIcon(icon, iconPosition) {
|
|
861
856
|
const hasIcon = computed(() => {
|
|
862
857
|
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
@@ -1179,8 +1174,7 @@ const VvInputFileProps = {
|
|
|
1179
1174
|
* Input value
|
|
1180
1175
|
*/
|
|
1181
1176
|
modelValue: {
|
|
1182
|
-
type: Object
|
|
1183
|
-
required: true
|
|
1177
|
+
type: Object
|
|
1184
1178
|
},
|
|
1185
1179
|
/**
|
|
1186
1180
|
* Whether to show progress bar
|
|
@@ -1202,6 +1196,20 @@ const VvInputFileProps = {
|
|
|
1202
1196
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#multiple
|
|
1203
1197
|
*/
|
|
1204
1198
|
multiple: { type: Boolean, default: false },
|
|
1199
|
+
/**
|
|
1200
|
+
* Front or rear camera
|
|
1201
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture
|
|
1202
|
+
*/
|
|
1203
|
+
capture: {
|
|
1204
|
+
type: String,
|
|
1205
|
+
default: void 0,
|
|
1206
|
+
validation: (value) => {
|
|
1207
|
+
if (value === void 0) {
|
|
1208
|
+
return true;
|
|
1209
|
+
}
|
|
1210
|
+
return ["user", "environment"].includes(value);
|
|
1211
|
+
}
|
|
1212
|
+
},
|
|
1205
1213
|
/**
|
|
1206
1214
|
* Max number of files
|
|
1207
1215
|
*/
|
|
@@ -1210,6 +1218,10 @@ const VvInputFileProps = {
|
|
|
1210
1218
|
* Show drop area
|
|
1211
1219
|
*/
|
|
1212
1220
|
dropArea: { type: Boolean, default: false },
|
|
1221
|
+
/**
|
|
1222
|
+
* Enable sorting
|
|
1223
|
+
*/
|
|
1224
|
+
sortable: { type: Boolean, default: false },
|
|
1213
1225
|
/**
|
|
1214
1226
|
* Label for add button
|
|
1215
1227
|
*/
|
|
@@ -1320,14 +1332,13 @@ const _hoisted_1 = ["for"];
|
|
|
1320
1332
|
const _hoisted_2 = { class: "vv-input-file__preview" };
|
|
1321
1333
|
const _hoisted_3 = ["src", "alt"];
|
|
1322
1334
|
const _hoisted_4 = { class: "vv-input-file__wrapper" };
|
|
1323
|
-
const _hoisted_5 = ["id", "readonly", "placeholder", "aria-describedby", "aria-invalid", "aria-errormessage", "multiple", "accept", "name"];
|
|
1335
|
+
const _hoisted_5 = ["id", "readonly", "placeholder", "aria-describedby", "aria-invalid", "aria-errormessage", "multiple", "accept", "capture", "name"];
|
|
1324
1336
|
const _hoisted_6 = ["value"];
|
|
1325
|
-
const _hoisted_7 =
|
|
1326
|
-
const _hoisted_8 = ["onClick"];
|
|
1327
|
-
const _hoisted_9 =
|
|
1328
|
-
const _hoisted_10 = { class: "vv-input-file__item-
|
|
1329
|
-
const _hoisted_11 =
|
|
1330
|
-
const _hoisted_12 = ["title", "onClick"];
|
|
1337
|
+
const _hoisted_7 = ["onClick"];
|
|
1338
|
+
const _hoisted_8 = ["title", "onClick"];
|
|
1339
|
+
const _hoisted_9 = { class: "vv-input-file__item-name" };
|
|
1340
|
+
const _hoisted_10 = { class: "vv-input-file__item-info" };
|
|
1341
|
+
const _hoisted_11 = ["title", "onClick"];
|
|
1331
1342
|
const __default__ = {
|
|
1332
1343
|
name: "VvInputFile"
|
|
1333
1344
|
};
|
|
@@ -1376,12 +1387,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1376
1387
|
hintSlotScope
|
|
1377
1388
|
} = HintSlotFactory(propsDefaults, slots);
|
|
1378
1389
|
const localModelValue = useVModel(props, "modelValue", emit);
|
|
1379
|
-
const files = computed(
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1390
|
+
const files = computed({
|
|
1391
|
+
get: () => {
|
|
1392
|
+
var _a;
|
|
1393
|
+
if (!localModelValue.value || !Array.isArray(localModelValue.value) && !((_a = localModelValue.value) == null ? void 0 : _a.name)) {
|
|
1394
|
+
return [];
|
|
1395
|
+
}
|
|
1396
|
+
return Array.isArray(localModelValue.value) ? localModelValue.value : [localModelValue.value];
|
|
1397
|
+
},
|
|
1398
|
+
set: (value) => {
|
|
1399
|
+
if (isMultiple.value) {
|
|
1400
|
+
localModelValue.value = value;
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
localModelValue.value = value == null ? void 0 : value[0];
|
|
1383
1404
|
}
|
|
1384
|
-
return Array.isArray(localModelValue.value) ? localModelValue.value : [localModelValue.value];
|
|
1385
1405
|
});
|
|
1386
1406
|
const hasMax = computed(() => {
|
|
1387
1407
|
return typeof props.max === "string" ? parseInt(props.max) : props.max;
|
|
@@ -1535,6 +1555,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1535
1555
|
}
|
|
1536
1556
|
return props.iconReplace;
|
|
1537
1557
|
});
|
|
1558
|
+
const onSortEnd = ({ newIndex }) => {
|
|
1559
|
+
if (newIndex !== null) {
|
|
1560
|
+
selectedFileIndex.value = newIndex;
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1538
1563
|
return (_ctx, _cache) => {
|
|
1539
1564
|
return openBlock(), createElementBlock(
|
|
1540
1565
|
"div",
|
|
@@ -1603,6 +1628,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1603
1628
|
"aria-errormessage": unref(hasInvalidLabelOrSlot) ? hasHintId.value : void 0,
|
|
1604
1629
|
multiple: isMultiple.value,
|
|
1605
1630
|
accept: _ctx.accept,
|
|
1631
|
+
capture: _ctx.capture,
|
|
1606
1632
|
name: _ctx.name,
|
|
1607
1633
|
onChange
|
|
1608
1634
|
}, null, 40, _hoisted_5),
|
|
@@ -1620,60 +1646,64 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1620
1646
|
/* FULL_PROPS */
|
|
1621
1647
|
)) : createCommentVNode("v-if", true)
|
|
1622
1648
|
]),
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1649
|
+
createVNode(unref(Sortable), {
|
|
1650
|
+
modelValue: files.value,
|
|
1651
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => files.value = $event),
|
|
1652
|
+
tag: "ul",
|
|
1653
|
+
class: "vv-input-file__list",
|
|
1654
|
+
"item-key": "name",
|
|
1655
|
+
move: () => _ctx.sortable,
|
|
1656
|
+
onEnd: onSortEnd
|
|
1657
|
+
}, {
|
|
1658
|
+
item: withCtx(({ element: file, index }) => [
|
|
1659
|
+
createElementVNode("li", {
|
|
1660
|
+
class: normalizeClass(["vv-input-file__item", {
|
|
1661
|
+
active: index === selectedFileIndex.value && hasDropArea.value && files.value.length > 1,
|
|
1662
|
+
"cursor-move": _ctx.sortable
|
|
1663
|
+
}]),
|
|
1664
|
+
onClick: withModifiers(($event) => onClickSelectFile(index), ["stop"])
|
|
1665
|
+
}, [
|
|
1666
|
+
unref(hasIconDownload) ? (openBlock(), createElementBlock("button", {
|
|
1667
|
+
key: 0,
|
|
1668
|
+
type: "button",
|
|
1669
|
+
class: "vv-input-file__item-action",
|
|
1670
|
+
title: _ctx.labelDownload,
|
|
1671
|
+
onClick: withModifiers(($event) => onClickDownloadFile(file), ["stop"])
|
|
1634
1672
|
}, [
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
onClick: withModifiers(($event) => onClickRemoveFile(index), ["stop"])
|
|
1670
|
-
}, null, 8, _hoisted_12)) : createCommentVNode("v-if", true)
|
|
1671
|
-
], 10, _hoisted_8);
|
|
1672
|
-
}),
|
|
1673
|
-
128
|
|
1674
|
-
/* KEYED_FRAGMENT */
|
|
1675
|
-
))
|
|
1676
|
-
]),
|
|
1673
|
+
createVNode(
|
|
1674
|
+
_sfc_main$3,
|
|
1675
|
+
normalizeProps(guardReactiveProps(unref(hasIconDownload))),
|
|
1676
|
+
null,
|
|
1677
|
+
16
|
|
1678
|
+
/* FULL_PROPS */
|
|
1679
|
+
)
|
|
1680
|
+
], 8, _hoisted_8)) : createCommentVNode("v-if", true),
|
|
1681
|
+
createElementVNode(
|
|
1682
|
+
"div",
|
|
1683
|
+
_hoisted_9,
|
|
1684
|
+
toDisplayString(file.name),
|
|
1685
|
+
1
|
|
1686
|
+
/* TEXT */
|
|
1687
|
+
),
|
|
1688
|
+
createElementVNode(
|
|
1689
|
+
"small",
|
|
1690
|
+
_hoisted_10,
|
|
1691
|
+
toDisplayString(sizeInKiB(file.size)) + " KB ",
|
|
1692
|
+
1
|
|
1693
|
+
/* TEXT */
|
|
1694
|
+
),
|
|
1695
|
+
!unref(readonly) ? (openBlock(), createElementBlock("button", {
|
|
1696
|
+
key: 1,
|
|
1697
|
+
type: "button",
|
|
1698
|
+
class: "vv-input-file__item-remove",
|
|
1699
|
+
title: _ctx.labelRemove,
|
|
1700
|
+
onClick: withModifiers(($event) => onClickRemoveFile(index), ["stop"])
|
|
1701
|
+
}, null, 8, _hoisted_11)) : createCommentVNode("v-if", true)
|
|
1702
|
+
], 10, _hoisted_7)
|
|
1703
|
+
]),
|
|
1704
|
+
_: 1
|
|
1705
|
+
/* STABLE */
|
|
1706
|
+
}, 8, ["modelValue", "move"]),
|
|
1677
1707
|
createVNode(unref(HintSlot), {
|
|
1678
1708
|
id: hasHintId.value,
|
|
1679
1709
|
class: "vv-input-file__hint"
|