sprintify-ui 0.6.63 → 0.6.65
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.
|
@@ -47,6 +47,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
47
47
|
type: import("vue").PropType<boolean>;
|
|
48
48
|
default: boolean;
|
|
49
49
|
};
|
|
50
|
+
requiredFields: {
|
|
51
|
+
type: import("vue").PropType<(keyof Address)[]>;
|
|
52
|
+
default: () => string[];
|
|
53
|
+
};
|
|
50
54
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
51
55
|
"update:model-value": (...args: any[]) => void;
|
|
52
56
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -87,6 +91,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
87
91
|
type: import("vue").PropType<boolean>;
|
|
88
92
|
default: boolean;
|
|
89
93
|
};
|
|
94
|
+
requiredFields: {
|
|
95
|
+
type: import("vue").PropType<(keyof Address)[]>;
|
|
96
|
+
default: () => string[];
|
|
97
|
+
};
|
|
90
98
|
}>> & {
|
|
91
99
|
"onUpdate:model-value"?: ((...args: any[]) => any) | undefined;
|
|
92
100
|
}, {
|
|
@@ -98,5 +106,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
98
106
|
restrictCountry: boolean;
|
|
99
107
|
hideRegion: boolean;
|
|
100
108
|
hideCountry: boolean;
|
|
109
|
+
requiredFields: (keyof Address)[];
|
|
101
110
|
}, {}>;
|
|
102
111
|
export default _default;
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
:label="t('sui.address')"
|
|
9
9
|
:name="`${namePrefix}address_1`"
|
|
10
10
|
class="col-span-2"
|
|
11
|
-
:required="
|
|
11
|
+
:required="isRequired('address_1')"
|
|
12
12
|
:size="size"
|
|
13
13
|
>
|
|
14
14
|
<BaseInput
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<BaseField
|
|
27
27
|
:name="`${namePrefix}address_2`"
|
|
28
28
|
class="col-span-2"
|
|
29
|
-
:required="
|
|
29
|
+
:required="isRequired('address_2')"
|
|
30
30
|
:size="size"
|
|
31
31
|
>
|
|
32
32
|
<BaseInput
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
<BaseField
|
|
42
42
|
:label="t('sui.city')"
|
|
43
|
-
:required="
|
|
43
|
+
:required="isRequired('city')"
|
|
44
44
|
:name="`${namePrefix}city`"
|
|
45
45
|
class="col-span-2 || sm:col-span-1"
|
|
46
46
|
:size="size"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
<BaseField
|
|
56
56
|
:label="t('sui.postal_code_zip_code')"
|
|
57
|
-
:required="
|
|
57
|
+
:required="isRequired('postal_code')"
|
|
58
58
|
:name="`${namePrefix}postal_code`"
|
|
59
59
|
class="col-span-2 || sm:col-span-1"
|
|
60
60
|
:size="size"
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
v-if="!props.hideCountry"
|
|
71
71
|
:label="t('sui.country')"
|
|
72
72
|
:name="`${namePrefix}country`"
|
|
73
|
-
:required="
|
|
73
|
+
:required="isRequired('country') && !props.restrictCountry"
|
|
74
74
|
class="col-span-2 || sm:col-span-1"
|
|
75
75
|
:size="size"
|
|
76
76
|
>
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
v-if="!props.hideRegion"
|
|
90
90
|
:label="t('sui.region')"
|
|
91
91
|
:name="`${namePrefix}region`"
|
|
92
|
-
:required="
|
|
92
|
+
:required="isRequired('region')"
|
|
93
93
|
class="col-span-2 || sm:col-span-1"
|
|
94
94
|
:size="size"
|
|
95
95
|
>
|
|
@@ -141,6 +141,7 @@ const props = withDefaults(
|
|
|
141
141
|
size?: Size;
|
|
142
142
|
hideRegion?: boolean;
|
|
143
143
|
hideCountry?: boolean;
|
|
144
|
+
requiredFields?: (keyof Address)[];
|
|
144
145
|
}>(),
|
|
145
146
|
{
|
|
146
147
|
modelValue() {
|
|
@@ -157,6 +158,9 @@ const props = withDefaults(
|
|
|
157
158
|
size: undefined,
|
|
158
159
|
hideRegion: false,
|
|
159
160
|
hideCountry: false,
|
|
161
|
+
requiredFields() {
|
|
162
|
+
return ['address_1', 'city', 'postal_code', 'country', 'region'];
|
|
163
|
+
}
|
|
160
164
|
}
|
|
161
165
|
);
|
|
162
166
|
|
|
@@ -218,6 +222,10 @@ function update(field: keyof Address, value: string) {
|
|
|
218
222
|
emit('update:model-value', newForm);
|
|
219
223
|
}
|
|
220
224
|
|
|
225
|
+
function isRequired(field: keyof Address): boolean {
|
|
226
|
+
return props.requiredFields.includes(field) && props.required;
|
|
227
|
+
}
|
|
228
|
+
|
|
221
229
|
// Autocomplete
|
|
222
230
|
|
|
223
231
|
const address1Ref = ref<InstanceType<typeof BaseInput> | null>(null);
|