sprintify-ui 0.4.8 → 0.4.10
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.
- package/dist/sprintify-ui.es.js +257 -268
- package/dist/types/src/components/BaseAddressForm.vue.d.ts +11 -0
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +0 -9
- package/dist/types/src/components/BaseBelongsToFetch.vue.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/BaseAddressForm.stories.js +5 -0
- package/src/components/BaseAddressForm.vue +8 -7
- package/src/components/BaseBelongsTo.vue +5 -15
- package/src/components/BaseDropdownAutocomplete.vue +1 -3
|
@@ -14,6 +14,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
14
14
|
required: true;
|
|
15
15
|
default: null;
|
|
16
16
|
};
|
|
17
|
+
required: {
|
|
18
|
+
type: import("vue").PropType<boolean>;
|
|
19
|
+
required: true;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
17
22
|
modelValue: {
|
|
18
23
|
type: import("vue").PropType<Address | null | undefined>;
|
|
19
24
|
required: true;
|
|
@@ -45,6 +50,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
45
50
|
required: true;
|
|
46
51
|
default: null;
|
|
47
52
|
};
|
|
53
|
+
required: {
|
|
54
|
+
type: import("vue").PropType<boolean>;
|
|
55
|
+
required: true;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
48
58
|
modelValue: {
|
|
49
59
|
type: import("vue").PropType<Address | null | undefined>;
|
|
50
60
|
required: true;
|
|
@@ -74,6 +84,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
74
84
|
"onUpdate:model-value"?: ((...args: any[]) => any) | undefined;
|
|
75
85
|
}, {
|
|
76
86
|
prefix: string | null;
|
|
87
|
+
required: boolean;
|
|
77
88
|
modelValue: Address | null | undefined;
|
|
78
89
|
countries: Country[];
|
|
79
90
|
regions: Region[];
|
|
@@ -33,10 +33,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
33
33
|
default: undefined;
|
|
34
34
|
type: StringConstructor;
|
|
35
35
|
};
|
|
36
|
-
currentModel: {
|
|
37
|
-
default: null;
|
|
38
|
-
type: PropType<Option | null>;
|
|
39
|
-
};
|
|
40
36
|
hasError: {
|
|
41
37
|
default: boolean;
|
|
42
38
|
type: BooleanConstructor;
|
|
@@ -112,10 +108,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
112
108
|
default: undefined;
|
|
113
109
|
type: StringConstructor;
|
|
114
110
|
};
|
|
115
|
-
currentModel: {
|
|
116
|
-
default: null;
|
|
117
|
-
type: PropType<Option | null>;
|
|
118
|
-
};
|
|
119
111
|
hasError: {
|
|
120
112
|
default: boolean;
|
|
121
113
|
type: BooleanConstructor;
|
|
@@ -170,7 +162,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
170
162
|
showEmptyOption: boolean;
|
|
171
163
|
emptyOptionLabel: string;
|
|
172
164
|
primaryKey: string;
|
|
173
|
-
currentModel: Option | null;
|
|
174
165
|
}, {}>, {
|
|
175
166
|
option?(_: {
|
|
176
167
|
focus: () => void;
|
|
@@ -178,8 +178,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
178
178
|
showEmptyOption: boolean;
|
|
179
179
|
emptyOptionLabel: string;
|
|
180
180
|
primaryKey: string;
|
|
181
|
-
currentModel: Option | null;
|
|
182
181
|
showRouteUrl: ((id: string | number) => string) | undefined;
|
|
182
|
+
currentModel: Option | null;
|
|
183
183
|
}, {}>, {
|
|
184
184
|
option?(_: {
|
|
185
185
|
focus: () => void;
|
package/package.json
CHANGED
|
@@ -52,6 +52,11 @@ const Template = (args) => ({
|
|
|
52
52
|
export const Demo = Template.bind({});
|
|
53
53
|
Demo.args = {};
|
|
54
54
|
|
|
55
|
+
export const Required = Template.bind({});
|
|
56
|
+
Required.args = {
|
|
57
|
+
required: true
|
|
58
|
+
};
|
|
59
|
+
|
|
55
60
|
const DefaultCountryTemplate = (args) => ({
|
|
56
61
|
components: { BaseAddressForm, ShowValue },
|
|
57
62
|
setup() {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
:label="t('sui.address')"
|
|
4
4
|
:name="`${namePrefix}address_1`"
|
|
5
5
|
class="mb-2"
|
|
6
|
-
required
|
|
6
|
+
:required="required"
|
|
7
7
|
>
|
|
8
8
|
<BaseInput
|
|
9
9
|
ref="address1Ref"
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
prevent-submit
|
|
14
14
|
name="address_search_field"
|
|
15
15
|
:autocomplete="false"
|
|
16
|
-
:required="false"
|
|
17
16
|
@update:model-value="update('address_1', $event)"
|
|
18
17
|
/>
|
|
19
18
|
</BaseField>
|
|
@@ -21,6 +20,7 @@
|
|
|
21
20
|
<BaseField
|
|
22
21
|
:name="`${namePrefix}address_2`"
|
|
23
22
|
class="mb-4"
|
|
23
|
+
:required="false"
|
|
24
24
|
>
|
|
25
25
|
<BaseInput
|
|
26
26
|
:model-value="normalizedModelValue.address_2 ?? ''"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<div class="sm:flex sm:space-x-3">
|
|
34
34
|
<BaseField
|
|
35
35
|
:label="t('sui.city')"
|
|
36
|
-
required
|
|
36
|
+
:required="required"
|
|
37
37
|
:name="`${namePrefix}city`"
|
|
38
38
|
class="mb-4 flex-1"
|
|
39
39
|
>
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
</BaseField>
|
|
46
46
|
<BaseField
|
|
47
47
|
:label="t('sui.postal_code_zip_code')"
|
|
48
|
-
required
|
|
48
|
+
:required="required"
|
|
49
49
|
:name="`${namePrefix}postal_code`"
|
|
50
50
|
class="mb-4 flex-1"
|
|
51
51
|
>
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
v-if="!props.hideCountry"
|
|
62
62
|
:label="t('sui.country')"
|
|
63
63
|
:name="`${namePrefix}country`"
|
|
64
|
-
required
|
|
64
|
+
:required="required"
|
|
65
65
|
class="mb-4 flex-1"
|
|
66
66
|
>
|
|
67
67
|
<BaseSelect
|
|
@@ -78,13 +78,12 @@
|
|
|
78
78
|
v-if="!props.hideRegion"
|
|
79
79
|
:label="t('sui.region')"
|
|
80
80
|
:name="`${namePrefix}region`"
|
|
81
|
-
required
|
|
81
|
+
:required="required"
|
|
82
82
|
class="mb-4 flex-1"
|
|
83
83
|
>
|
|
84
84
|
<BaseSelect
|
|
85
85
|
:model-value="normalizedModelValue.region ?? ''"
|
|
86
86
|
class="w-full"
|
|
87
|
-
required
|
|
88
87
|
:options="regions"
|
|
89
88
|
label-key="name"
|
|
90
89
|
value-key="id"
|
|
@@ -120,6 +119,7 @@ const props = withDefaults(
|
|
|
120
119
|
defineProps<{
|
|
121
120
|
modelValue: undefined | null | Address;
|
|
122
121
|
prefix: string | null;
|
|
122
|
+
required: boolean;
|
|
123
123
|
countries?: Country[];
|
|
124
124
|
regions?: Region[];
|
|
125
125
|
restrictCountry?: boolean;
|
|
@@ -127,6 +127,7 @@ const props = withDefaults(
|
|
|
127
127
|
hideCountry?: boolean;
|
|
128
128
|
}>(),
|
|
129
129
|
{
|
|
130
|
+
required: false,
|
|
130
131
|
modelValue() {
|
|
131
132
|
return {};
|
|
132
133
|
},
|
|
@@ -81,10 +81,6 @@ const props = defineProps({
|
|
|
81
81
|
default: undefined,
|
|
82
82
|
type: String,
|
|
83
83
|
},
|
|
84
|
-
currentModel: {
|
|
85
|
-
default: null,
|
|
86
|
-
type: [Object, null] as PropType<Option | null>,
|
|
87
|
-
},
|
|
88
84
|
hasError: {
|
|
89
85
|
default: false,
|
|
90
86
|
type: Boolean,
|
|
@@ -127,22 +123,16 @@ const emit = defineEmits(['update:modelValue']);
|
|
|
127
123
|
|
|
128
124
|
const autocomplete = ref<InstanceType<typeof BaseAutocomplete> | null>(null);
|
|
129
125
|
|
|
130
|
-
const model =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
model.value = newValue;
|
|
136
|
-
},
|
|
137
|
-
{ deep: true }
|
|
138
|
-
);
|
|
126
|
+
const model = computed(() => {
|
|
127
|
+
return props.modelValue
|
|
128
|
+
? props.options.find((option) => option[props.primaryKey] === props.modelValue)
|
|
129
|
+
: null;
|
|
130
|
+
});
|
|
139
131
|
|
|
140
132
|
function onUpdate(newModel: Option | null) {
|
|
141
133
|
if (!newModel) {
|
|
142
|
-
model.value = null;
|
|
143
134
|
emit('update:modelValue', null);
|
|
144
135
|
} else {
|
|
145
|
-
model.value = newModel;
|
|
146
136
|
emit('update:modelValue', newModel[props.primaryKey]);
|
|
147
137
|
}
|
|
148
138
|
}
|
|
@@ -47,9 +47,7 @@
|
|
|
47
47
|
</div>
|
|
48
48
|
<div class="shrink-0">
|
|
49
49
|
<BaseIcon
|
|
50
|
-
v-if="(optionProps.selected ?? false) ||
|
|
51
|
-
(optionProps.option[valueKey] == null && newValue == null)
|
|
52
|
-
"
|
|
50
|
+
v-if="(optionProps.selected ?? false) || (optionProps.option[valueKey] == null && newValue == null)"
|
|
53
51
|
icon="mdi:check-bold"
|
|
54
52
|
class="h-4 w-4 text-slate-500"
|
|
55
53
|
/>
|