sprintify-ui 0.8.68 → 0.8.70

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.
@@ -453,6 +453,7 @@ function updateFilterQueryValue(key: string, value: any) {
453
453
  let newQuery = cloneDeep(query.value);
454
454
  newQuery = set(newQuery, key, value);
455
455
  newQuery = set(newQuery, 'page', 1);
456
+
456
457
  updateQuery(newQuery);
457
458
  }
458
459
 
@@ -635,6 +636,22 @@ function onRouteChange() {
635
636
  |--------------------------------------------------------------------------
636
637
  */
637
638
 
639
+ const fullQuery = computed(() => {
640
+
641
+ const urlSplit = (url.value + '').split(/[?#]/);
642
+ const urlQueryString = urlSplit[1] ?? null;
643
+ const urlQuery = config.parseQueryString(urlQueryString);
644
+
645
+ // Ordered by priority
646
+ const allParams = merge(
647
+ cloneDeep(query.value),
648
+ cloneDeep(props.urlQuery),
649
+ cloneDeep(urlQuery)
650
+ );
651
+
652
+ return allParams;
653
+ });
654
+
638
655
  function fetchWithLoading(force = false) {
639
656
  fetch(force, true);
640
657
  }
@@ -653,22 +670,12 @@ function fetch(force = false, showLoading = true) {
653
670
  return;
654
671
  }
655
672
 
656
- const urlSplit = url.value.split(/[?#]/);
673
+ const fullQueryInternal = fullQuery.value;
674
+ const fullQueryString = config.formatQueryString(fullQueryInternal);
657
675
 
676
+ const urlSplit = url.value.split(/[?#]/);
658
677
  const baseUrl = urlSplit[0];
659
- const urlQueryString = urlSplit[1] ?? null;
660
- const urlQuery = config.parseQueryString(urlQueryString);
661
-
662
- // Ordered by priority
663
- const allParams = merge(
664
- cloneDeep(query.value),
665
- cloneDeep(props.urlQuery),
666
- cloneDeep(urlQuery)
667
- );
668
-
669
- const queryString = config.formatQueryString(allParams);
670
-
671
- const fullUrl = baseUrl + '?' + queryString;
678
+ const fullUrl = baseUrl + '?' + fullQueryString;
672
679
 
673
680
  if (lastUrl == fullUrl && !force) {
674
681
  return;
@@ -956,7 +963,7 @@ defineExpose({
956
963
  fetchWithLoading: () => fetchWithLoading(true),
957
964
  fetchWithoutLoading: () => fetchWithoutLoading(true),
958
965
  scrollIntoView: scrollIntoViewAction,
959
- query,
966
+ query: computed(() => fullQuery.value),
960
967
  data: computed(() => dataInternal.value),
961
968
  });
962
969
  </script>
@@ -40,26 +40,34 @@ onMounted(() => {
40
40
  handle: props.handle,
41
41
  disabled: props.disabled,
42
42
  onEnd: (event) => {
43
- if (event.oldIndex !== undefined && event.newIndex !== undefined) {
44
- const modelValue = cloneDeep(props.modelValue);
45
43
 
46
- const modelValueUpdated = arrayMove(
47
- modelValue,
48
- event.oldIndex,
49
- event.newIndex
50
- );
44
+ if (event.oldIndex === undefined || event.newIndex === undefined) {
45
+ return;
46
+ }
47
+
48
+ const modelValue = props.modelValue;
49
+
50
+ const modelValueUpdated = arrayMove(
51
+ modelValue,
52
+ event.oldIndex,
53
+ event.newIndex
54
+ );
51
55
 
56
+ nextTick(() => {
52
57
  emit('update:modelValue', modelValueUpdated);
53
- }
58
+ });
54
59
  },
55
60
  });
56
61
  });
57
62
 
58
63
  function arrayMove(array: any[], fromIndex: number, toIndex: number): any[] {
59
- const element = array[fromIndex];
60
- array.splice(fromIndex, 1);
61
- array.splice(toIndex, 0, element);
62
- return array;
64
+ // without mutating the original array
65
+
66
+ const newArray = [...array];
67
+ const item = newArray.splice(fromIndex, 1)[0];
68
+ newArray.splice(toIndex, 0, item);
69
+
70
+ return newArray;
63
71
  }
64
72
 
65
73
  onBeforeUnmount(() => {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  ref="targetRef"
4
- :class="props.class"
4
+ :class="classInternal"
5
5
  >
6
6
  <slot />
7
7
  </div>
@@ -77,4 +77,11 @@ const tooltipRef = ref<HTMLElement | null>(null)
77
77
 
78
78
  const { floatingStyles, showTooltip } = useTooltip(targetInternal, tooltipRef, props.interactive, props.floatingOptions);
79
79
 
80
+ const classInternal = computed(() => {
81
+ return [
82
+ 'relative',
83
+ props.class,
84
+ ];
85
+ });
86
+
80
87
  </script>