sprintify-ui 0.0.174 → 0.0.176

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.
@@ -1,7 +1,7 @@
1
1
  import { Country } from '@/types/Country';
2
2
  import { Region } from '@/types/Region';
3
3
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
- modelValue: Record<string, string | number | null | undefined>;
4
+ modelValue: Record<string, string | number | null | undefined> | null | undefined;
5
5
  prefix: string | null;
6
6
  countries?: Country[] | undefined;
7
7
  regions?: Region[] | undefined;
@@ -11,7 +11,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
11
11
  countries(): never[];
12
12
  regions(): never[];
13
13
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:model-value"[], "update:model-value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
14
- modelValue: Record<string, string | number | null | undefined>;
14
+ modelValue: Record<string, string | number | null | undefined> | null | undefined;
15
15
  prefix: string | null;
16
16
  countries?: Country[] | undefined;
17
17
  regions?: Region[] | undefined;
@@ -23,7 +23,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
23
23
  }>>> & {
24
24
  "onUpdate:model-value"?: ((...args: any[]) => any) | undefined;
25
25
  }, {
26
- modelValue: Record<string, string | number | null | undefined>;
26
+ modelValue: Record<string, string | number | null | undefined> | null | undefined;
27
27
  prefix: string | null;
28
28
  countries: Country[];
29
29
  regions: Region[];
@@ -9,7 +9,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
9
9
  name?: string | undefined;
10
10
  inline?: boolean | undefined;
11
11
  enableTime?: boolean | undefined;
12
- format?: string | undefined;
13
12
  mode?: "time" | "multiple" | "single" | "range" | undefined;
14
13
  noCalendar?: boolean | undefined;
15
14
  disableDates?: string[] | Date[] | undefined;
@@ -23,7 +22,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
23
22
  name: undefined;
24
23
  inline: boolean;
25
24
  enableTime: boolean;
26
- format: string;
27
25
  mode: string;
28
26
  noCalendar: boolean;
29
27
  disableDates(): never[];
@@ -37,7 +35,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
37
35
  name?: string | undefined;
38
36
  inline?: boolean | undefined;
39
37
  enableTime?: boolean | undefined;
40
- format?: string | undefined;
41
38
  mode?: "time" | "multiple" | "single" | "range" | undefined;
42
39
  noCalendar?: boolean | undefined;
43
40
  disableDates?: string[] | Date[] | undefined;
@@ -51,7 +48,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
51
48
  name: undefined;
52
49
  inline: boolean;
53
50
  enableTime: boolean;
54
- format: string;
55
51
  mode: string;
56
52
  noCalendar: boolean;
57
53
  disableDates(): never[];
@@ -68,7 +64,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
68
64
  minDate: string | Date | null;
69
65
  maxDate: string | Date | null;
70
66
  enableTime: boolean;
71
- format: string;
72
67
  noCalendar: boolean;
73
68
  disableDates: string[] | Date[];
74
69
  }>;
@@ -106,9 +106,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
106
106
  onError?: ((...args: any[]) => any) | undefined;
107
107
  onSuccess?: ((...args: any[]) => any) | undefined;
108
108
  }, {
109
- format: DataFormat;
110
109
  errorHandler: (error: AxiosError) => void;
111
110
  axiosInstance: AxiosInstance | null;
111
+ format: DataFormat;
112
112
  beforeSubmit: (next: () => void) => void;
113
113
  successHandler: (response: any) => void;
114
114
  loadingMaskClass: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.174",
3
+ "version": "0.0.176",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -100,9 +100,11 @@ import BaseInput from './BaseInput.vue';
100
100
  import BaseSelect from './BaseSelect.vue';
101
101
  import { config } from '..';
102
102
 
103
+ type Address = Record<string, string | number | null | undefined>;
104
+
103
105
  const props = withDefaults(
104
106
  defineProps<{
105
- modelValue: Record<string, string | number | null | undefined>;
107
+ modelValue: undefined | null | Address;
106
108
  prefix: string | null;
107
109
  countries?: Country[];
108
110
  regions?: Region[];
@@ -123,18 +125,16 @@ const props = withDefaults(
123
125
 
124
126
  const emit = defineEmits(['update:model-value']);
125
127
 
126
- const normalizedModelValue = computed(
127
- (): Record<string, string | number | null | undefined> => {
128
- const form = cloneDeep(props.modelValue ?? {});
129
- form.address_1 = form.address_1 ?? '';
130
- form.address_2 = form.address_2 ?? '';
131
- form.city = form.city ?? '';
132
- form.postal_code = form.postal_code ?? '';
133
- form.country = form.country ?? '';
134
- form.region = form.region ?? '';
135
- return form;
136
- }
137
- );
128
+ const normalizedModelValue = computed((): Address => {
129
+ const form = cloneDeep(props.modelValue ?? {});
130
+ form.address_1 = form.address_1 ?? '';
131
+ form.address_2 = form.address_2 ?? '';
132
+ form.city = form.city ?? '';
133
+ form.postal_code = form.postal_code ?? '';
134
+ form.country = form.country ?? '';
135
+ form.region = form.region ?? '';
136
+ return form;
137
+ });
138
138
 
139
139
  const countries = computed((): Country[] => {
140
140
  if (props.countries && isArray(props.countries) && props.countries.length) {
@@ -211,7 +211,7 @@ function fillAddress() {
211
211
  let postcode = '';
212
212
  let region = '';
213
213
 
214
- const newForm = cloneDeep(props.modelValue);
214
+ const newForm = cloneDeep(props.modelValue ?? {});
215
215
 
216
216
  if (!place.address_components) {
217
217
  return;
@@ -67,7 +67,6 @@ Multiple.args = {
67
67
  export const DateAndTime = Template.bind({});
68
68
  DateAndTime.args = {
69
69
  enableTime: true,
70
- format: 'Y-m-d H:i',
71
70
  };
72
71
 
73
72
  export const DisableDates = Template.bind({});
@@ -56,7 +56,6 @@ const props = withDefaults(
56
56
  name?: string;
57
57
  inline?: boolean;
58
58
  enableTime?: boolean;
59
- format?: string;
60
59
  mode?: 'single' | 'multiple' | 'range' | 'time';
61
60
  noCalendar?: boolean;
62
61
  disableDates?: string[] | Date[];
@@ -71,7 +70,6 @@ const props = withDefaults(
71
70
  name: undefined,
72
71
  inline: false,
73
72
  enableTime: false,
74
- format: 'Y-m-d',
75
73
  mode: 'single',
76
74
  noCalendar: false,
77
75
  disableDates() {
@@ -84,6 +82,14 @@ const i18n = useI18n();
84
82
 
85
83
  const emit = defineEmits(['update:modelValue']);
86
84
 
85
+ const formatInternal = computed(() => {
86
+ if (props.enableTime) {
87
+ return 'Y-m-d H:i';
88
+ }
89
+
90
+ return 'Y-m-d';
91
+ });
92
+
87
93
  const { hasErrorInternal, emitUpdate } = useField({
88
94
  name: computed(() => props.name),
89
95
  required: computed(() => props.required),
@@ -148,7 +154,7 @@ let picker = null as Instance | null;
148
154
  const flatpickrConfig = computed(() => {
149
155
  return {
150
156
  enableTime: props.enableTime,
151
- dateFormat: props.format,
157
+ dateFormat: formatInternal.value,
152
158
  mode: props.mode,
153
159
  locale: locale.value,
154
160
  minDate: props.minDate ?? undefined,