sprintify-ui 0.0.126 → 0.0.128

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.
@@ -48,9 +48,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
48
48
  type: BooleanConstructor;
49
49
  };
50
50
  }, {
51
- fetch: (force?: boolean, showLoading?: boolean) => void;
52
- fetchWithLoading: (force?: boolean) => void;
53
- fetchWithoutLoading: (force?: boolean) => void;
51
+ fetch: () => void;
52
+ fetchWithLoading: () => void;
53
+ fetchWithoutLoading: () => void;
54
54
  scrollIntoView: () => void;
55
55
  query: Ref<DataTableQuery>;
56
56
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "delete" | "checkAll" | "update:checked-rows" | "check" | "update:query")[], "click" | "delete" | "checkAll" | "update:checked-rows" | "check" | "update:query", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -2,7 +2,7 @@ import { PropType } from 'vue';
2
2
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
3
3
  modelValue: {
4
4
  default: boolean;
5
- type: PropType<boolean | null | undefined>;
5
+ type: PropType<string | number | boolean | null | undefined>;
6
6
  };
7
7
  name: {
8
8
  default: undefined;
@@ -27,7 +27,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
27
27
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
28
28
  modelValue: {
29
29
  default: boolean;
30
- type: PropType<boolean | null | undefined>;
30
+ type: PropType<string | number | boolean | null | undefined>;
31
31
  };
32
32
  name: {
33
33
  default: undefined;
@@ -56,7 +56,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
56
56
  name: string;
57
57
  color: "dark" | "light" | "danger" | "success" | "warning" | "info" | "primary";
58
58
  size: "base" | "xs" | "sm" | "lg" | "xl";
59
- modelValue: boolean | null | undefined;
59
+ modelValue: string | number | boolean | null | undefined;
60
60
  hasError: boolean;
61
61
  }>, {
62
62
  default: (_: {}) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.126",
3
+ "version": "0.0.128",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -712,9 +712,9 @@ onMounted(() => {
712
712
  */
713
713
 
714
714
  defineExpose({
715
- fetch,
716
- fetchWithLoading,
717
- fetchWithoutLoading,
715
+ fetch: () => fetch(true),
716
+ fetchWithLoading: () => fetchWithLoading(true),
717
+ fetchWithoutLoading: () => fetchWithoutLoading(true),
718
718
  scrollIntoView,
719
719
  query,
720
720
  });
@@ -481,16 +481,14 @@ function fetch() {
481
481
  if (!dataIterator.value) {
482
482
  return;
483
483
  }
484
- // Refetch even if URL is the same
485
- dataIterator.value.fetch(true);
484
+ dataIterator.value.fetch();
486
485
  }
487
486
 
488
487
  function fetchWithoutLoading() {
489
488
  if (!dataIterator.value) {
490
489
  return;
491
490
  }
492
- // Refetch even if URL is the same
493
- dataIterator.value.fetchWithoutLoading(true);
491
+ dataIterator.value.fetchWithoutLoading();
494
492
  }
495
493
 
496
494
  const dataIteratorQuery = computed((): DataTableQuery | null => {
@@ -2,7 +2,7 @@
2
2
  <SwitchGroup>
3
3
  <div class="inline-flex items-center space-x-3">
4
4
  <Switch
5
- :model-value="modelValue ?? false"
5
+ :model-value="normalizedModelValue"
6
6
  :class="[
7
7
  modelValue ? bg : 'bg-slate-200',
8
8
  'relative inline-flex shrink-0 cursor-pointer items-center rounded-full transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-offset-2 ',
@@ -34,12 +34,15 @@
34
34
  <script lang="ts" setup>
35
35
  import { useField } from '@/composables/field';
36
36
  import { Switch, SwitchGroup, SwitchLabel } from '@headlessui/vue';
37
+ import { isNumber, isString } from 'lodash';
37
38
  import { PropType } from 'vue';
38
39
 
39
40
  const props = defineProps({
40
41
  modelValue: {
41
42
  default: false,
42
- type: [Boolean, null, undefined] as PropType<boolean | null | undefined>,
43
+ type: [Boolean, String, Number, null, undefined] as PropType<
44
+ boolean | string | number | null | undefined
45
+ >,
43
46
  },
44
47
  name: {
45
48
  default: undefined,
@@ -74,6 +77,16 @@ const { emitUpdate } = useField({
74
77
  emit: emit,
75
78
  });
76
79
 
80
+ const normalizedModelValue = computed((): boolean => {
81
+ if (isString(props.modelValue)) {
82
+ return props.modelValue === 'true' || props.modelValue === '1';
83
+ }
84
+ if (isNumber(props.modelValue)) {
85
+ return props.modelValue === 1;
86
+ }
87
+ return props.modelValue ?? false;
88
+ });
89
+
77
90
  const bg = computed(() => {
78
91
  if (props.color == 'primary') {
79
92
  return 'bg-primary-500';