@volverjs/ui-vue 0.0.10-beta.23 → 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.
Files changed (89) hide show
  1. package/dist/components/VvAccordion/VvAccordion.es.js +119 -79
  2. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  3. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +18 -4
  4. package/dist/components/VvAccordion/index.d.ts +4 -8
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +250 -119
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +18 -6
  8. package/dist/components/VvAccordionGroup/index.d.ts +3 -1
  9. package/dist/components/VvAction/VvAction.vue.d.ts +1 -1
  10. package/dist/components/VvAlert/VvAlert.vue.d.ts +1 -1
  11. package/dist/components/VvButton/VvButton.es.js +92 -98
  12. package/dist/components/VvButton/VvButton.umd.js +1 -1
  13. package/dist/components/VvButton/VvButton.vue.d.ts +7 -7
  14. package/dist/components/VvButton/index.d.ts +11 -11
  15. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -13
  16. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  17. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +3 -3
  18. package/dist/components/VvCheckbox/VvCheckbox.es.js +81 -87
  19. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  20. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +6 -6
  21. package/dist/components/VvCheckbox/index.d.ts +2 -2
  22. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +15 -29
  23. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  24. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +5 -5
  25. package/dist/components/VvCombobox/VvCombobox.es.js +13 -16
  26. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  27. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +11 -11
  28. package/dist/components/VvCombobox/index.d.ts +1 -1
  29. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +5 -5
  30. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +1 -1
  31. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +1 -1
  32. package/dist/components/VvDropdown/index.d.ts +1 -1
  33. package/dist/components/VvInputFile/VvInputFile.es.js +183 -168
  34. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  35. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +16 -9
  36. package/dist/components/VvInputFile/index.d.ts +12 -3
  37. package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
  38. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  39. package/dist/components/VvInputText/VvInputText.vue.d.ts +6 -6
  40. package/dist/components/VvProgress/VvProgress.vue.d.ts +1 -1
  41. package/dist/components/VvRadio/VvRadio.es.js +64 -70
  42. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  43. package/dist/components/VvRadio/VvRadio.vue.d.ts +6 -6
  44. package/dist/components/VvRadio/index.d.ts +6 -6
  45. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +15 -29
  46. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  47. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +5 -5
  48. package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
  49. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +5 -5
  50. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +3 -3
  51. package/dist/components/VvTooltip/index.d.ts +1 -1
  52. package/dist/components/index.es.js +462 -323
  53. package/dist/components/index.umd.js +1 -1
  54. package/dist/composables/alert/useInjectAlert.d.ts +1 -6
  55. package/dist/composables/group/useInjectedGroupState.d.ts +4 -5
  56. package/dist/composables/group/useProvideGroupState.d.ts +3 -3
  57. package/dist/constants.d.ts +6 -10
  58. package/dist/icons.es.js +3 -3
  59. package/dist/icons.umd.js +1 -1
  60. package/dist/index.es.js +3 -2
  61. package/dist/index.umd.js +1 -1
  62. package/dist/props/index.d.ts +1 -1
  63. package/dist/resolvers/unplugin.es.js +3 -2
  64. package/dist/resolvers/unplugin.umd.js +1 -1
  65. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +38 -14
  66. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +259 -101
  67. package/dist/types/group.d.ts +37 -15
  68. package/package.json +37 -36
  69. package/src/assets/icons/detailed.json +1 -1
  70. package/src/assets/icons/normal.json +1 -1
  71. package/src/assets/icons/simple.json +1 -1
  72. package/src/components/VvAccordion/VvAccordion.vue +119 -56
  73. package/src/components/VvAccordion/index.ts +8 -23
  74. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +140 -41
  75. package/src/components/VvAccordionGroup/index.ts +3 -1
  76. package/src/components/VvButton/index.ts +7 -12
  77. package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -2
  78. package/src/components/VvCheckbox/index.ts +2 -2
  79. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +1 -2
  80. package/src/components/VvInputFile/VvInputFile.vue +71 -47
  81. package/src/components/VvInputFile/index.ts +5 -4
  82. package/src/components/VvRadio/index.ts +5 -5
  83. package/src/components/VvRadioGroup/VvRadioGroup.vue +1 -2
  84. package/src/composables/group/useInjectedGroupState.ts +20 -16
  85. package/src/composables/group/useProvideGroupState.ts +10 -15
  86. package/src/constants.ts +19 -14
  87. package/src/stories/AccordionGroup/AccordionGroup.test.ts +15 -9
  88. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +1 -1
  89. 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<"left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end">;
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<"left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end">;
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: "left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end";
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<"left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end">;
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<"left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end">;
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<"left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end">;
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: "left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end";
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<"left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end">;
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, renderList, createVNode, guardReactiveProps, createSlots } from "vue";
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("buttonGroup");
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(() => !isEmpty(group));
646
+ const isInGroup = computed(() => group !== void 0);
729
647
  function getGroupOrLocalRef(propName, props, emit) {
730
- if (group == null ? void 0 : group.value) {
731
- const groupPropValue = unref(group.value)[propName];
648
+ const groupPropValue = group == null ? void 0 : group[propName];
649
+ if (groupPropValue) {
732
650
  return computed({
733
651
  get() {
734
- return groupPropValue == null ? void 0 : groupPropValue.value;
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
- "unselectable",
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.value.modifiers.value;
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
@@ -1224,6 +1218,10 @@ const VvInputFileProps = {
1224
1218
  * Show drop area
1225
1219
  */
1226
1220
  dropArea: { type: Boolean, default: false },
1221
+ /**
1222
+ * Enable sorting
1223
+ */
1224
+ sortable: { type: Boolean, default: false },
1227
1225
  /**
1228
1226
  * Label for add button
1229
1227
  */
@@ -1336,12 +1334,11 @@ const _hoisted_3 = ["src", "alt"];
1336
1334
  const _hoisted_4 = { class: "vv-input-file__wrapper" };
1337
1335
  const _hoisted_5 = ["id", "readonly", "placeholder", "aria-describedby", "aria-invalid", "aria-errormessage", "multiple", "accept", "capture", "name"];
1338
1336
  const _hoisted_6 = ["value"];
1339
- const _hoisted_7 = { class: "vv-input-file__list" };
1340
- const _hoisted_8 = ["onClick"];
1341
- const _hoisted_9 = ["title", "onClick"];
1342
- const _hoisted_10 = { class: "vv-input-file__item-name" };
1343
- const _hoisted_11 = { class: "vv-input-file__item-info" };
1344
- 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"];
1345
1342
  const __default__ = {
1346
1343
  name: "VvInputFile"
1347
1344
  };
@@ -1390,12 +1387,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1390
1387
  hintSlotScope
1391
1388
  } = HintSlotFactory(propsDefaults, slots);
1392
1389
  const localModelValue = useVModel(props, "modelValue", emit);
1393
- const files = computed(() => {
1394
- var _a;
1395
- if (!localModelValue.value || !Array.isArray(localModelValue.value) && !((_a = localModelValue.value) == null ? void 0 : _a.name)) {
1396
- return [];
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];
1397
1404
  }
1398
- return Array.isArray(localModelValue.value) ? localModelValue.value : [localModelValue.value];
1399
1405
  });
1400
1406
  const hasMax = computed(() => {
1401
1407
  return typeof props.max === "string" ? parseInt(props.max) : props.max;
@@ -1549,6 +1555,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1549
1555
  }
1550
1556
  return props.iconReplace;
1551
1557
  });
1558
+ const onSortEnd = ({ newIndex }) => {
1559
+ if (newIndex !== null) {
1560
+ selectedFileIndex.value = newIndex;
1561
+ }
1562
+ };
1552
1563
  return (_ctx, _cache) => {
1553
1564
  return openBlock(), createElementBlock(
1554
1565
  "div",
@@ -1635,60 +1646,64 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1635
1646
  /* FULL_PROPS */
1636
1647
  )) : createCommentVNode("v-if", true)
1637
1648
  ]),
1638
- createElementVNode("ul", _hoisted_7, [
1639
- (openBlock(true), createElementBlock(
1640
- Fragment,
1641
- null,
1642
- renderList(files.value, (file, index) => {
1643
- return openBlock(), createElementBlock("li", {
1644
- key: index,
1645
- class: normalizeClass(["vv-input-file__item", {
1646
- active: index === selectedFileIndex.value && hasDropArea.value && files.value.length > 1
1647
- }]),
1648
- onClick: withModifiers(($event) => onClickSelectFile(index), ["stop"])
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"])
1649
1672
  }, [
1650
- unref(hasIconDownload) ? (openBlock(), createElementBlock("button", {
1651
- key: 0,
1652
- type: "button",
1653
- class: "vv-input-file__item-action",
1654
- title: _ctx.labelDownload,
1655
- onClick: withModifiers(($event) => onClickDownloadFile(file), ["stop"])
1656
- }, [
1657
- createVNode(
1658
- _sfc_main$3,
1659
- normalizeProps(guardReactiveProps(unref(hasIconDownload))),
1660
- null,
1661
- 16
1662
- /* FULL_PROPS */
1663
- )
1664
- ], 8, _hoisted_9)) : createCommentVNode("v-if", true),
1665
- createElementVNode(
1666
- "div",
1667
- _hoisted_10,
1668
- toDisplayString(file.name),
1669
- 1
1670
- /* TEXT */
1671
- ),
1672
- createElementVNode(
1673
- "small",
1674
- _hoisted_11,
1675
- toDisplayString(sizeInKiB(file.size)) + " KB ",
1676
- 1
1677
- /* TEXT */
1678
- ),
1679
- !unref(readonly) ? (openBlock(), createElementBlock("button", {
1680
- key: 1,
1681
- type: "button",
1682
- class: "vv-input-file__item-remove",
1683
- title: _ctx.labelRemove,
1684
- onClick: withModifiers(($event) => onClickRemoveFile(index), ["stop"])
1685
- }, null, 8, _hoisted_12)) : createCommentVNode("v-if", true)
1686
- ], 10, _hoisted_8);
1687
- }),
1688
- 128
1689
- /* KEYED_FRAGMENT */
1690
- ))
1691
- ]),
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"]),
1692
1707
  createVNode(unref(HintSlot), {
1693
1708
  id: hasHintId.value,
1694
1709
  class: "vv-input-file__hint"