@dative-gpi/foundation-shared-components 0.1.120 → 1.0.0
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/assets/images/map/imagery.png +0 -0
- package/assets/images/map/map.png +0 -0
- package/components/FSAccordion.vue +2 -1
- package/components/FSAccordionPanel.vue +20 -1
- package/components/FSBadge.vue +7 -3
- package/components/FSBreadcrumbs.vue +4 -2
- package/components/FSButton.vue +15 -8
- package/components/FSCalendar.vue +5 -2
- package/components/FSCalendarTwin.vue +6 -3
- package/components/FSCard.vue +4 -2
- package/components/FSCardPlaceholder.vue +80 -0
- package/components/FSCheckbox.vue +10 -7
- package/components/FSChip.vue +4 -2
- package/components/FSClickable.vue +5 -3
- package/components/FSClock.vue +18 -4
- package/components/FSCol.vue +12 -5
- package/components/FSColor.vue +4 -2
- package/components/FSColorIcon.vue +5 -3
- package/components/FSDialog.vue +28 -87
- package/components/FSDialogContent.vue +133 -0
- package/components/FSDialogForm.vue +25 -236
- package/components/FSDialogFormBody.vue +273 -0
- package/components/FSDialogMenu.vue +5 -2
- package/components/FSDialogMultiForm.vue +21 -197
- package/components/FSDialogMultiFormBody.vue +231 -0
- package/components/FSDialogSubmit.vue +4 -2
- package/components/FSDivider.vue +6 -4
- package/components/FSEditImage.vue +16 -9
- package/components/FSErrorToast.vue +2 -1
- package/components/FSFadeOut.vue +1 -1
- package/components/FSForm.vue +7 -7
- package/components/FSGrid.vue +4 -2
- package/components/FSGridMosaic.vue +3 -2
- package/components/FSIcon.vue +3 -2
- package/components/FSIconCard.vue +10 -3
- package/components/FSIconCheck.vue +2 -1
- package/components/FSIconFlag.vue +2 -1
- package/components/FSImage.vue +2 -1
- package/components/FSImageCard.vue +72 -0
- package/components/FSLabel.vue +4 -2
- package/components/FSLink.vue +5 -3
- package/components/FSLoader.vue +2 -1
- package/components/FSOptionGroup.vue +28 -20
- package/components/FSOptionItem.vue +8 -18
- package/components/FSPagination.vue +4 -2
- package/components/FSRadio.vue +23 -11
- package/components/FSRadioGroup.vue +23 -10
- package/components/FSRow.vue +8 -1
- package/components/FSSlideGroup.vue +27 -6
- package/components/FSSlider.vue +4 -2
- package/components/FSSpan.vue +2 -1
- package/components/FSSwitch.vue +13 -10
- package/components/FSTab.vue +4 -2
- package/components/FSTabs.vue +5 -14
- package/components/FSTag.vue +11 -4
- package/components/FSTagGroup.vue +4 -2
- package/components/FSText.vue +4 -2
- package/components/FSToggleSet.vue +30 -17
- package/components/FSTooltip.vue +15 -4
- package/components/FSWindow.vue +2 -2
- package/components/FSWrapGroup.vue +2 -1
- package/components/autocompletes/FSAutoCompleteAddress.vue +104 -0
- package/components/autocompletes/FSAutocompleteLanguage.vue +18 -26
- package/components/autocompletes/FSAutocompleteTag.vue +138 -0
- package/components/autocompletes/FSAutocompleteTimeZone.vue +19 -30
- package/components/buttons/FSButtonAdd.vue +28 -0
- package/components/buttons/FSButtonAddIcon.vue +28 -0
- package/components/buttons/FSButtonAddLabel.vue +27 -0
- package/components/buttons/FSButtonAddMini.vue +27 -0
- package/components/buttons/FSButtonFile.vue +4 -4
- package/components/buttons/FSButtonFileIcon.vue +4 -4
- package/components/buttons/FSButtonFileLabel.vue +4 -4
- package/components/buttons/FSButtonFileMini.vue +4 -4
- package/components/deviceOrganisations/FSConnectivity.vue +3 -2
- package/components/deviceOrganisations/FSConnectivityCard.vue +3 -2
- package/components/deviceOrganisations/FSStatus.vue +3 -2
- package/components/deviceOrganisations/FSStatusCard.vue +3 -2
- package/components/deviceOrganisations/FSStatusesCarousel.vue +3 -2
- package/components/deviceOrganisations/FSStatusesRow.vue +3 -2
- package/components/deviceOrganisations/FSWorstAlert.vue +5 -4
- package/components/deviceOrganisations/FSWorstAlertCard.vue +4 -2
- package/components/fields/FSAutocompleteField.vue +210 -97
- package/components/fields/FSBaseField.vue +2 -1
- package/components/fields/FSColorField.vue +65 -94
- package/components/fields/FSDateField.vue +12 -25
- package/components/fields/FSDateRangeField.vue +15 -27
- package/components/fields/FSDateTimeField.vue +22 -32
- package/components/fields/FSDateTimeRangeField.vue +43 -51
- package/components/fields/FSGradientField.vue +143 -0
- package/components/fields/FSIconField.vue +9 -6
- package/components/fields/FSMagicConfigField.vue +154 -0
- package/components/fields/FSMagicField.vue +185 -0
- package/components/fields/FSNumberField.vue +3 -1
- package/components/fields/FSPasswordField.vue +10 -10
- package/components/fields/FSRichTextField.vue +136 -50
- package/components/fields/FSSearchField.vue +41 -62
- package/components/fields/FSSelectField.vue +148 -53
- package/components/fields/FSTagField.vue +19 -16
- package/components/fields/FSTermField.vue +192 -186
- package/components/fields/FSTextArea.vue +4 -4
- package/components/fields/FSTextField.vue +29 -6
- package/components/fields/FSTimeField.vue +55 -20
- package/components/fields/FSTimeSlotField.vue +6 -5
- package/components/fields/FSTranslateField.vue +234 -0
- package/components/fields/FSTranslateRichTextField.vue +185 -0
- package/components/fields/FSTreeViewField.vue +520 -0
- package/components/lists/FSDataIteratorItem.vue +18 -3
- package/components/lists/FSDataTableUI.vue +138 -51
- package/components/lists/FSFilterButton.vue +4 -2
- package/components/lists/FSHiddenButton.vue +4 -2
- package/components/map/FSMap.vue +598 -0
- package/components/map/FSMapEditPointAddressOverlay.vue +164 -0
- package/components/map/FSMapLayerButton.vue +77 -0
- package/components/map/FSMapOverlay.vue +150 -0
- package/components/selects/FSSelectAutoRefresh.vue +62 -0
- package/components/selects/FSSelectDashboardVariableType.vue +47 -0
- package/components/selects/FSSelectDateSetting.vue +39 -37
- package/components/selects/FSSelectDays.vue +62 -0
- package/components/tiles/FSDashboardOrganisationTileUI.vue +7 -5
- package/components/tiles/FSDashboardOrganisationTypeTileUI.vue +7 -5
- package/components/tiles/FSDashboardShallowTileUI.vue +7 -5
- package/components/tiles/FSDeviceOrganisationTileUI.vue +11 -12
- package/components/tiles/FSFolderTileUI.vue +8 -6
- package/components/tiles/FSGroupTileUI.vue +13 -15
- package/components/tiles/{FSSimpleIconTileUI.vue → FSSimpleTileUI.vue} +29 -15
- package/components/tiles/FSTile.vue +5 -11
- package/components/tiles/FSUserOrganisationTileUI.vue +2 -1
- package/components/toggleSets/FSToggleSetPosition.vue +61 -0
- package/composables/index.ts +5 -1
- package/composables/useAddress.ts +158 -0
- package/composables/useAutocomplete.ts +4 -3
- package/composables/useColors.ts +8 -25
- package/composables/useDebounce.ts +2 -1
- package/composables/useMagicFieldProvider.ts +22 -0
- package/composables/useRules.ts +4 -12
- package/composables/useSlots.ts +46 -26
- package/composables/useTables.ts +29 -0
- package/composables/useTreeView.ts +48 -0
- package/elements/FSFormElement.ts +2 -1
- package/icons/flags/France.vue +21 -5
- package/icons/flags/Germany.vue +16 -4
- package/icons/flags/GreatBritain.vue +25 -6
- package/icons/flags/Italy.vue +21 -5
- package/icons/flags/Portugal.vue +225 -51
- package/icons/flags/Spain.vue +2781 -543
- package/icons/flags/UnitedStates.vue +31 -7
- package/icons/widgetTemplates/DevicesWidget.vue +189 -189
- package/icons/widgetTemplates/ProfileWidget.vue +9 -9
- package/icons/widgetTemplates/TextWidget.vue +6 -6
- package/models/breadcrumbs.ts +1 -1
- package/models/deviceAlerts.ts +1 -1
- package/models/deviceConnectivities.ts +1 -1
- package/models/index.ts +2 -0
- package/models/magicFields.ts +9 -0
- package/models/map.ts +18 -0
- package/models/richTextVariable.ts +5 -0
- package/models/rules.ts +11 -2
- package/models/tables.ts +30 -21
- package/models/variableNode.ts +104 -0
- package/package.json +21 -18
- package/plugins/colorPlugin.ts +2 -2
- package/plugins/index.ts +2 -1
- package/plugins/mapsPlugin.ts +37 -0
- package/shims-plugin.d.ts +2 -2
- package/shims-window.d.ts +3 -0
- package/styles/components/fs_button.scss +5 -0
- package/styles/components/fs_card.scss +0 -1
- package/styles/components/fs_col.scss +1 -0
- package/styles/components/fs_color_field.scss +12 -2
- package/styles/components/fs_data_iterator_item.scss +19 -6
- package/styles/components/fs_dialog.scss +12 -22
- package/styles/components/fs_gradient_field.scss +16 -0
- package/styles/components/fs_image_card.scss +18 -0
- package/styles/components/fs_magic_config_field.scss +13 -0
- package/styles/components/fs_map.scss +129 -0
- package/styles/components/fs_map_overlay.scss +38 -0
- package/styles/components/fs_meta_field.scss +6 -0
- package/styles/components/fs_option_group.scss +1 -0
- package/styles/components/fs_radio.scss +1 -1
- package/styles/components/fs_rich_text_field.scss +17 -5
- package/styles/components/fs_row.scss +1 -1
- package/styles/components/fs_select_field.scss +9 -14
- package/styles/components/fs_text.scss +1 -1
- package/styles/components/fs_time_field.scss +0 -4
- package/styles/components/fs_translate_field.scss +3 -0
- package/styles/components/fs_tree_view_field.scss +53 -0
- package/styles/components/index.scss +8 -1
- package/styles/globals/overrides.scss +54 -8
- package/styles/globals/scrollbars.scss +2 -2
- package/themes/default.ts +1 -1
- package/utils/gradient.ts +1601 -0
- package/utils/index.ts +3 -1
- package/utils/leafletMarkers.ts +23 -0
- package/utils/lexical.ts +3 -1
- package/components/selects/FSSelectTimeZone.vue +0 -67
- package/styles/components/fs_date_field.scss +0 -8
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template
|
|
3
|
+
v-if="!$props.validation"
|
|
4
|
+
>
|
|
5
|
+
<FSForm
|
|
6
|
+
ref="formRef"
|
|
7
|
+
:variant="$props.variant"
|
|
8
|
+
@submit="onSubmit"
|
|
9
|
+
v-model="valid"
|
|
10
|
+
>
|
|
11
|
+
<FSCol
|
|
12
|
+
gap="24px"
|
|
13
|
+
>
|
|
14
|
+
<FSFadeOut
|
|
15
|
+
:height="height"
|
|
16
|
+
padding="0 8px 0 0"
|
|
17
|
+
>
|
|
18
|
+
<slot
|
|
19
|
+
name="body"
|
|
20
|
+
/>
|
|
21
|
+
</FSFadeOut>
|
|
22
|
+
<FSRow
|
|
23
|
+
padding="0 16px 0 0"
|
|
24
|
+
>
|
|
25
|
+
<slot
|
|
26
|
+
name="left-footer"
|
|
27
|
+
/>
|
|
28
|
+
<FSRow
|
|
29
|
+
class="fs-dialog-actions"
|
|
30
|
+
align="top-right"
|
|
31
|
+
:wrap="false"
|
|
32
|
+
>
|
|
33
|
+
<FSButton
|
|
34
|
+
:prependIcon="$props.cancelButtonPrependIcon"
|
|
35
|
+
:appendIcon="$props.cancelButtonAppendIcon"
|
|
36
|
+
:variant="$props.cancelButtonVariant"
|
|
37
|
+
:color="$props.cancelButtonColor"
|
|
38
|
+
:label="cancelLabel"
|
|
39
|
+
@click="() => $emit('click:cancelButton', false)"
|
|
40
|
+
/>
|
|
41
|
+
<FSButton
|
|
42
|
+
type="submit"
|
|
43
|
+
:prependIcon="$props.submitButtonPrependIcon"
|
|
44
|
+
:appendIcon="$props.submitButtonAppendIcon"
|
|
45
|
+
:variant="$props.submitButtonVariant"
|
|
46
|
+
:color="$props.submitButtonColor"
|
|
47
|
+
:editable="$props.editable"
|
|
48
|
+
:label="submitLabel"
|
|
49
|
+
:load="$props.load"
|
|
50
|
+
/>
|
|
51
|
+
</FSRow>
|
|
52
|
+
</FSRow>
|
|
53
|
+
</FSCol>
|
|
54
|
+
</FSForm>
|
|
55
|
+
</template>
|
|
56
|
+
<template
|
|
57
|
+
v-else
|
|
58
|
+
>
|
|
59
|
+
<FSCol
|
|
60
|
+
gap="24px"
|
|
61
|
+
>
|
|
62
|
+
<FSFadeOut
|
|
63
|
+
:height="height"
|
|
64
|
+
padding="0 8px 0 0"
|
|
65
|
+
>
|
|
66
|
+
<slot
|
|
67
|
+
name="validation"
|
|
68
|
+
/>
|
|
69
|
+
</FSFadeOut>
|
|
70
|
+
<FSRow
|
|
71
|
+
padding="0 16px 0 0"
|
|
72
|
+
>
|
|
73
|
+
<slot
|
|
74
|
+
name="left-footer"
|
|
75
|
+
/>
|
|
76
|
+
<FSRow
|
|
77
|
+
class="fs-dialog-actions"
|
|
78
|
+
align="top-right"
|
|
79
|
+
:wrap="false"
|
|
80
|
+
>
|
|
81
|
+
<FSButton
|
|
82
|
+
:prependIcon="$props.validateButtonPrependIcon"
|
|
83
|
+
:appendIcon="$props.validateButtonAppendIcon"
|
|
84
|
+
:variant="$props.validateButtonVariant"
|
|
85
|
+
:color="$props.validateButtonColor"
|
|
86
|
+
:label="validateLabel"
|
|
87
|
+
@click="onValidate"
|
|
88
|
+
/>
|
|
89
|
+
</FSRow>
|
|
90
|
+
</FSRow>
|
|
91
|
+
</FSCol>
|
|
92
|
+
</template>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script lang="ts">
|
|
96
|
+
import { computed, defineComponent, type PropType, ref } from "vue";
|
|
97
|
+
|
|
98
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
99
|
+
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
100
|
+
import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
101
|
+
|
|
102
|
+
import FSFadeOut from "./FSFadeOut.vue";
|
|
103
|
+
import FSButton from "./FSButton.vue";
|
|
104
|
+
import FSForm from "./FSForm.vue";
|
|
105
|
+
import FSRow from "./FSRow.vue";
|
|
106
|
+
|
|
107
|
+
export default defineComponent({
|
|
108
|
+
name: "FSDialogFormBody",
|
|
109
|
+
components: {
|
|
110
|
+
FSFadeOut,
|
|
111
|
+
FSButton,
|
|
112
|
+
FSForm,
|
|
113
|
+
FSRow
|
|
114
|
+
},
|
|
115
|
+
props: {
|
|
116
|
+
variant: {
|
|
117
|
+
type: String as PropType<"standard" | "submit">,
|
|
118
|
+
required: false,
|
|
119
|
+
default: "submit"
|
|
120
|
+
},
|
|
121
|
+
modelValue: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
required: false,
|
|
124
|
+
default: false
|
|
125
|
+
},
|
|
126
|
+
subtitle: {
|
|
127
|
+
type: String as PropType<string | null>,
|
|
128
|
+
required: false,
|
|
129
|
+
default: null
|
|
130
|
+
},
|
|
131
|
+
cancelButtonPrependIcon: {
|
|
132
|
+
type: String as PropType<string | null>,
|
|
133
|
+
required: false,
|
|
134
|
+
default: null
|
|
135
|
+
},
|
|
136
|
+
cancelButtonLabel: {
|
|
137
|
+
type: String as PropType<string | null>,
|
|
138
|
+
required: false,
|
|
139
|
+
default: null
|
|
140
|
+
},
|
|
141
|
+
cancelButtonAppendIcon: {
|
|
142
|
+
type: String as PropType<string | null>,
|
|
143
|
+
required: false,
|
|
144
|
+
default: null
|
|
145
|
+
},
|
|
146
|
+
cancelButtonVariant: {
|
|
147
|
+
type: String as PropType<"standard" | "full" | "icon">,
|
|
148
|
+
required: false,
|
|
149
|
+
default: "standard"
|
|
150
|
+
},
|
|
151
|
+
cancelButtonColor: {
|
|
152
|
+
type: String as PropType<ColorBase>,
|
|
153
|
+
required: false,
|
|
154
|
+
default: ColorEnum.Light
|
|
155
|
+
},
|
|
156
|
+
submitButtonPrependIcon: {
|
|
157
|
+
type: String as PropType<string | null>,
|
|
158
|
+
required: false,
|
|
159
|
+
default: null
|
|
160
|
+
},
|
|
161
|
+
submitButtonLabel: {
|
|
162
|
+
type: String as PropType<string | null>,
|
|
163
|
+
required: false,
|
|
164
|
+
default: null
|
|
165
|
+
},
|
|
166
|
+
submitButtonAppendIcon: {
|
|
167
|
+
type: String as PropType<string | null>,
|
|
168
|
+
required: false,
|
|
169
|
+
default: null
|
|
170
|
+
},
|
|
171
|
+
submitButtonVariant: {
|
|
172
|
+
type: String as PropType<"standard" | "full" | "icon">,
|
|
173
|
+
required: false,
|
|
174
|
+
default: "full"
|
|
175
|
+
},
|
|
176
|
+
submitButtonColor: {
|
|
177
|
+
type: String as PropType<ColorBase>,
|
|
178
|
+
required: false,
|
|
179
|
+
default: ColorEnum.Primary
|
|
180
|
+
},
|
|
181
|
+
validateButtonPrependIcon: {
|
|
182
|
+
type: String as PropType<string | null>,
|
|
183
|
+
required: false,
|
|
184
|
+
default: null
|
|
185
|
+
},
|
|
186
|
+
validateButtonLabel: {
|
|
187
|
+
type: String as PropType<string | null>,
|
|
188
|
+
required: false,
|
|
189
|
+
default: null
|
|
190
|
+
},
|
|
191
|
+
validateButtonAppendIcon: {
|
|
192
|
+
type: String as PropType<string | null>,
|
|
193
|
+
required: false,
|
|
194
|
+
default: null
|
|
195
|
+
},
|
|
196
|
+
validateButtonVariant: {
|
|
197
|
+
type: String as PropType<"standard" | "full" | "icon">,
|
|
198
|
+
required: false,
|
|
199
|
+
default: "standard"
|
|
200
|
+
},
|
|
201
|
+
validateButtonColor: {
|
|
202
|
+
type: String as PropType<ColorBase>,
|
|
203
|
+
required: false,
|
|
204
|
+
default: ColorEnum.Light
|
|
205
|
+
},
|
|
206
|
+
validation: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
required: false,
|
|
209
|
+
default: false
|
|
210
|
+
},
|
|
211
|
+
load: {
|
|
212
|
+
type: Boolean,
|
|
213
|
+
required: false,
|
|
214
|
+
default: false
|
|
215
|
+
},
|
|
216
|
+
editable: {
|
|
217
|
+
type: Boolean,
|
|
218
|
+
required: false,
|
|
219
|
+
default: true
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
emits: ["click:cancelButton", "click:submitButton", "click:validateButton"],
|
|
223
|
+
setup(props, { emit }) {
|
|
224
|
+
const { isMobileSized } = useBreakpoints();
|
|
225
|
+
const { $tr } = useTranslationsProvider();
|
|
226
|
+
|
|
227
|
+
const formRef = ref<HTMLElement | null>(null);
|
|
228
|
+
const valid = ref(false);
|
|
229
|
+
|
|
230
|
+
const height = computed(() => {
|
|
231
|
+
const other = 24 + 24 // Paddings
|
|
232
|
+
+ (isMobileSized.value ? 24 : 32) + 24 // Title
|
|
233
|
+
+ (props.subtitle ? (isMobileSized.value ? 14 : 16) + 8 : 0) // Subtitle
|
|
234
|
+
+ (isMobileSized.value ? 36 : 40) + 24; // Footer
|
|
235
|
+
return `calc(100vh - 40px - ${other}px)`;
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
const cancelLabel = computed(() => {
|
|
239
|
+
return props.cancelButtonLabel ?? $tr("ui.button.cancel", "Cancel");
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
const submitLabel = computed(() => {
|
|
243
|
+
return props.submitButtonLabel ?? $tr("ui.button.submit", "Submit");
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
const validateLabel = computed(() => {
|
|
247
|
+
return props.validateButtonLabel ?? $tr("ui.button.validate", "Done");
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
const onSubmit = () => {
|
|
251
|
+
if (valid.value) {
|
|
252
|
+
emit("click:submitButton");
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const onValidate = () => {
|
|
257
|
+
emit("click:validateButton");
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
return {
|
|
261
|
+
validateLabel,
|
|
262
|
+
cancelLabel,
|
|
263
|
+
submitLabel,
|
|
264
|
+
ColorEnum,
|
|
265
|
+
formRef,
|
|
266
|
+
height,
|
|
267
|
+
valid,
|
|
268
|
+
onValidate,
|
|
269
|
+
onSubmit
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
</script>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
v-bind="$attrs"
|
|
6
6
|
>
|
|
7
7
|
<FSCard
|
|
8
|
+
width="calc(100vw - 48px)"
|
|
8
9
|
padding="8px"
|
|
9
10
|
gap="24px"
|
|
10
11
|
:color="$props.color"
|
|
@@ -24,9 +25,11 @@
|
|
|
24
25
|
</template>
|
|
25
26
|
|
|
26
27
|
<script lang="ts">
|
|
27
|
-
import {
|
|
28
|
+
import type { PropType } from "vue";
|
|
29
|
+
import { computed, defineComponent } from "vue";
|
|
28
30
|
|
|
29
|
-
import { ColorBase
|
|
31
|
+
import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
|
|
32
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
30
33
|
import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
31
34
|
|
|
32
35
|
import FSCard from "./FSCard.vue";
|
|
@@ -10,87 +10,39 @@
|
|
|
10
10
|
<template
|
|
11
11
|
#body
|
|
12
12
|
>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
:
|
|
13
|
+
<FSDialogMultiFormBody
|
|
14
|
+
:subtitle="$props.subtitle"
|
|
15
|
+
:steps="$props.steps"
|
|
16
|
+
@click:submitButton="$emit('click:submitButton')"
|
|
17
|
+
@click:cancelButton="$emit('update:modelValue', false)"
|
|
18
|
+
v-bind="$attrs"
|
|
16
19
|
>
|
|
17
|
-
<
|
|
18
|
-
v-for="(
|
|
19
|
-
:
|
|
20
|
-
:key="index"
|
|
21
|
-
@submit="onSubmit"
|
|
22
|
-
v-model="valid"
|
|
20
|
+
<template
|
|
21
|
+
v-for="(_, name) in $slots"
|
|
22
|
+
v-slot:[name]="slotData"
|
|
23
23
|
>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
>
|
|
31
|
-
<slot
|
|
32
|
-
:name="`step-${step}`"
|
|
33
|
-
/>
|
|
34
|
-
</FSFadeOut>
|
|
35
|
-
<FSRow
|
|
36
|
-
padding="0 16px 0 0"
|
|
37
|
-
>
|
|
38
|
-
<slot
|
|
39
|
-
name="left-footer"
|
|
40
|
-
/>
|
|
41
|
-
<FSRow
|
|
42
|
-
class="fs-dialog-actions"
|
|
43
|
-
align="top-right"
|
|
44
|
-
:wrap="false"
|
|
45
|
-
>
|
|
46
|
-
<FSButton
|
|
47
|
-
:prependIcon="$props.cancelButtonPrependIcon"
|
|
48
|
-
:appendIcon="$props.cancelButtonAppendIcon"
|
|
49
|
-
:variant="$props.cancelButtonVariant"
|
|
50
|
-
:color="$props.cancelButtonColor"
|
|
51
|
-
:label="previousButtonLabel"
|
|
52
|
-
@click="onPrevious()"
|
|
53
|
-
/>
|
|
54
|
-
<FSButton
|
|
55
|
-
type="submit"
|
|
56
|
-
:prependIcon="$props.submitButtonPrependIcon"
|
|
57
|
-
:appendIcon="$props.submitButtonAppendIcon"
|
|
58
|
-
:color="$props.submitButtonColor"
|
|
59
|
-
:variant="nextButtonVariant"
|
|
60
|
-
:editable="$props.editable"
|
|
61
|
-
:label="nextButtonLabel"
|
|
62
|
-
:load="$props.load"
|
|
63
|
-
/>
|
|
64
|
-
</FSRow>
|
|
65
|
-
</FSRow>
|
|
66
|
-
</FSCol>
|
|
67
|
-
</FSForm>
|
|
68
|
-
</FSWindow>
|
|
24
|
+
<slot
|
|
25
|
+
:name="name"
|
|
26
|
+
v-bind="slotData"
|
|
27
|
+
/>
|
|
28
|
+
</template>
|
|
29
|
+
</FSDialogMultiFormBody>
|
|
69
30
|
</template>
|
|
70
31
|
</FSDialog>
|
|
71
32
|
</template>
|
|
72
33
|
|
|
73
34
|
<script lang="ts">
|
|
74
|
-
import {
|
|
35
|
+
import type { PropType} from "vue";
|
|
36
|
+
import { defineComponent } from "vue";
|
|
75
37
|
|
|
76
|
-
import
|
|
77
|
-
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
78
|
-
import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
79
|
-
|
|
80
|
-
import FSFadeOut from "./FSFadeOut.vue";
|
|
81
|
-
import FSButton from "./FSButton.vue";
|
|
38
|
+
import FSDialogMultiFormBody from "./FSDialogMultiFormBody.vue";
|
|
82
39
|
import FSDialog from "./FSDialog.vue";
|
|
83
|
-
import FSForm from "./FSForm.vue";
|
|
84
|
-
import FSRow from "./FSRow.vue";
|
|
85
40
|
|
|
86
41
|
export default defineComponent({
|
|
87
42
|
name: "FSDialogMultiForm",
|
|
88
43
|
components: {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
FSDialog,
|
|
92
|
-
FSForm,
|
|
93
|
-
FSRow
|
|
44
|
+
FSDialogMultiFormBody,
|
|
45
|
+
FSDialog
|
|
94
46
|
},
|
|
95
47
|
props: {
|
|
96
48
|
title: {
|
|
@@ -108,11 +60,6 @@ export default defineComponent({
|
|
|
108
60
|
required: false,
|
|
109
61
|
default: "auto"
|
|
110
62
|
},
|
|
111
|
-
variant: {
|
|
112
|
-
type: String as PropType<"standard" | "lazy" | "submit">,
|
|
113
|
-
required: false,
|
|
114
|
-
default: "submit"
|
|
115
|
-
},
|
|
116
63
|
modelValue: {
|
|
117
64
|
type: Boolean,
|
|
118
65
|
required: false,
|
|
@@ -122,134 +69,11 @@ export default defineComponent({
|
|
|
122
69
|
type: Number,
|
|
123
70
|
required: true
|
|
124
71
|
},
|
|
125
|
-
cancelButtonPrependIcon: {
|
|
126
|
-
type: String as PropType<string | null>,
|
|
127
|
-
required: false,
|
|
128
|
-
default: null
|
|
129
|
-
},
|
|
130
|
-
cancelButtonLabel: {
|
|
131
|
-
type: String as PropType<string | null>,
|
|
132
|
-
required: false,
|
|
133
|
-
default: null
|
|
134
|
-
},
|
|
135
|
-
cancelButtonAppendIcon: {
|
|
136
|
-
type: String as PropType<string | null>,
|
|
137
|
-
required: false,
|
|
138
|
-
default: null
|
|
139
|
-
},
|
|
140
|
-
cancelButtonVariant: {
|
|
141
|
-
type: String as PropType<"standard" | "full" | "icon">,
|
|
142
|
-
required: false,
|
|
143
|
-
default: "standard"
|
|
144
|
-
},
|
|
145
|
-
cancelButtonColor: {
|
|
146
|
-
type: String as PropType<ColorBase>,
|
|
147
|
-
required: false,
|
|
148
|
-
default: ColorEnum.Light
|
|
149
|
-
},
|
|
150
|
-
submitButtonPrependIcon: {
|
|
151
|
-
type: String as PropType<string | null>,
|
|
152
|
-
required: false,
|
|
153
|
-
default: null
|
|
154
|
-
},
|
|
155
|
-
submitButtonLabel: {
|
|
156
|
-
type: String as PropType<string | null>,
|
|
157
|
-
required: false,
|
|
158
|
-
default: null
|
|
159
|
-
},
|
|
160
|
-
submitButtonAppendIcon: {
|
|
161
|
-
type: String as PropType<string | null>,
|
|
162
|
-
required: false,
|
|
163
|
-
default: null
|
|
164
|
-
},
|
|
165
|
-
submitButtonVariant: {
|
|
166
|
-
type: String as PropType<"standard" | "full" | "icon">,
|
|
167
|
-
required: false,
|
|
168
|
-
default: "full"
|
|
169
|
-
},
|
|
170
|
-
submitButtonColor: {
|
|
171
|
-
type: String as PropType<ColorBase>,
|
|
172
|
-
required: false,
|
|
173
|
-
default: ColorEnum.Primary
|
|
174
|
-
},
|
|
175
|
-
load: {
|
|
176
|
-
type: Boolean,
|
|
177
|
-
required: false,
|
|
178
|
-
default: false
|
|
179
|
-
},
|
|
180
|
-
editable: {
|
|
181
|
-
type: Boolean,
|
|
182
|
-
required: false,
|
|
183
|
-
default: true
|
|
184
|
-
}
|
|
185
72
|
},
|
|
186
73
|
emits: ["update:modelValue", "click:submitButton"],
|
|
187
|
-
setup(
|
|
188
|
-
const { isMobileSized } = useBreakpoints();
|
|
189
|
-
const { $tr } = useTranslationsProvider();
|
|
190
|
-
|
|
191
|
-
const currentStep = ref(1);
|
|
192
|
-
const valid = ref(false);
|
|
193
|
-
const valids = ref(Array.from({ length: props.steps }, () => false));
|
|
194
|
-
|
|
195
|
-
const height = computed(() => {
|
|
196
|
-
const other = 24 + 24 // Paddings
|
|
197
|
-
+ (isMobileSized.value ? 24 : 32) + 24 // Title
|
|
198
|
-
+ (props.subtitle ? (isMobileSized.value ? 14 : 16) + 8 : 0) // Subtitle
|
|
199
|
-
+ (isMobileSized.value ? 36 : 40) + 24; // Footer
|
|
200
|
-
return `calc(100vh - 40px - ${other}px)`;
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
const previousButtonLabel = computed(() => {
|
|
204
|
-
return currentStep.value == 1
|
|
205
|
-
? props.cancelButtonLabel ?? $tr("ui.button.cancel", "Cancel")
|
|
206
|
-
: $tr("ui.button.back", "Back");
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
const nextButtonLabel = computed(() => {
|
|
210
|
-
return currentStep.value == props.steps
|
|
211
|
-
? props.submitButtonLabel ?? $tr("ui.button.validate", "Validate")
|
|
212
|
-
: $tr("ui.button.next", "Next");
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
const nextButtonVariant = computed(() => {
|
|
216
|
-
return currentStep.value == props.steps
|
|
217
|
-
? props.submitButtonVariant ?? "full" : "standard";
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
const onPrevious = () => {
|
|
221
|
-
if (currentStep.value > 1) {
|
|
222
|
-
currentStep.value--;
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
emit("update:modelValue", false);
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const onSubmit = () => {
|
|
230
|
-
if (valid.value) {
|
|
231
|
-
switch (currentStep.value) {
|
|
232
|
-
case props.steps:
|
|
233
|
-
emit("click:submitButton");
|
|
234
|
-
break;
|
|
235
|
-
default:
|
|
236
|
-
currentStep.value++;
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
};
|
|
74
|
+
setup() {
|
|
241
75
|
|
|
242
76
|
return {
|
|
243
|
-
previousButtonLabel,
|
|
244
|
-
nextButtonVariant,
|
|
245
|
-
nextButtonLabel,
|
|
246
|
-
currentStep,
|
|
247
|
-
ColorEnum,
|
|
248
|
-
height,
|
|
249
|
-
valids,
|
|
250
|
-
valid,
|
|
251
|
-
onPrevious,
|
|
252
|
-
onSubmit
|
|
253
77
|
};
|
|
254
78
|
}
|
|
255
79
|
});
|