@volverjs/ui-vue 0.0.10-beta.44 → 0.0.10-beta.45

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.
@@ -4668,15 +4668,15 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4668
4668
  const localModelValue = computed({
4669
4669
  get: () => {
4670
4670
  if (Array.isArray(props.modelValue)) {
4671
- return new Set(props.modelValue);
4671
+ return props.modelValue;
4672
4672
  }
4673
- return props.modelValue !== void 0 && props.modelValue !== null ? /* @__PURE__ */ new Set([props.modelValue]) : /* @__PURE__ */ new Set();
4673
+ return props.modelValue !== void 0 && props.modelValue !== null ? [props.modelValue] : [];
4674
4674
  },
4675
4675
  set: (value) => {
4676
- emit("update:modelValue", props.multiple || Array.isArray(props.modelValue) ? [...value] : [...value].pop());
4676
+ emit("update:modelValue", props.multiple || Array.isArray(props.modelValue) ? value : value.pop());
4677
4677
  }
4678
4678
  });
4679
- const sizeOfModelValue = computed(() => localModelValue.value.size);
4679
+ const sizeOfModelValue = computed(() => localModelValue.value.length);
4680
4680
  const isDirty = computed(() => sizeOfModelValue.value > 0);
4681
4681
  const hasMaxValues = computed(() => {
4682
4682
  if (!props.multiple) {
@@ -4694,7 +4694,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4694
4694
  if (!props.unselectable) {
4695
4695
  return false;
4696
4696
  }
4697
- return sizeOfModelValue.value > Number(props.minValues);
4697
+ return Number(props.minValues) === 0 || sizeOfModelValue.value > Number(props.minValues);
4698
4698
  });
4699
4699
  const isSelectable = computed(() => {
4700
4700
  if (isDisabledOrReadonly.value) {
@@ -4752,7 +4752,16 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4752
4752
  });
4753
4753
  });
4754
4754
  function isOptionSelected(option) {
4755
- return localModelValue.value.has(getOptionValue(option));
4755
+ const optionValue = getOptionValue(option);
4756
+ if (typeof optionValue === "object") {
4757
+ return localModelValue.value.some((item) => {
4758
+ if (typeof item === "object") {
4759
+ return JSON.stringify(item) === JSON.stringify(optionValue);
4760
+ }
4761
+ return false;
4762
+ });
4763
+ }
4764
+ return localModelValue.value.includes(optionValue);
4756
4765
  }
4757
4766
  const selectedOptions = computed(() => {
4758
4767
  const options = props.options.reduce(
@@ -4776,15 +4785,20 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4776
4785
  }
4777
4786
  function onInput(option) {
4778
4787
  const isSelected = isOptionSelected(option);
4788
+ const optionValue = getOptionValue(option);
4779
4789
  if (isSelected && isUnselectable.value) {
4780
- localModelValue.value.delete(getOptionValue(option));
4790
+ localModelValue.value = localModelValue.value.filter((item) => {
4791
+ if (typeof optionValue === "object" && typeof item === "object") {
4792
+ return JSON.stringify(item) !== JSON.stringify(optionValue);
4793
+ }
4794
+ return item !== optionValue;
4795
+ });
4781
4796
  } else if (!isSelected && isSelectable.value) {
4782
4797
  if (!props.multiple) {
4783
- localModelValue.value.clear();
4798
+ localModelValue.value = [];
4784
4799
  }
4785
- localModelValue.value.add(getOptionValue(option));
4800
+ localModelValue.value = [...localModelValue.value, optionValue];
4786
4801
  }
4787
- localModelValue.value = new Set(localModelValue.value);
4788
4802
  if (!props.multiple && !props.keepOpen) {
4789
4803
  collapse();
4790
4804
  }