@dative-gpi/foundation-shared-components 0.0.12 → 0.0.14
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/components/FSButton.vue +1 -1
- package/components/FSCalendarTwin.vue +2 -0
- package/components/FSCheckbox.vue +3 -3
- package/components/FSClock.vue +47 -40
- package/components/FSCol.vue +2 -2
- package/components/FSDivider.vue +46 -7
- package/components/FSForm.vue +52 -0
- package/components/FSImage.vue +41 -32
- package/components/FSLabel.vue +105 -0
- package/components/FSPagination.vue +25 -9
- package/components/FSPermissions.vue +0 -0
- package/components/FSRadio.vue +3 -3
- package/components/FSSlideGroup.vue +10 -11
- package/components/FSSubmitDialog.vue +1 -1
- package/components/FSSwitch.vue +3 -3
- package/components/FSText.vue +1 -1
- package/components/FSWrapGroup.vue +10 -11
- package/components/{FSAutocompleteField.vue → fields/FSAutocompleteField.vue} +26 -19
- package/components/fields/FSColorField.vue +205 -0
- package/components/{FSDateField.vue → fields/FSDateField.vue} +15 -50
- package/components/{FSDateRangeField.vue → fields/FSDateRangeField.vue} +17 -67
- package/components/{FSDateTimeField.vue → fields/FSDateTimeField.vue} +17 -52
- package/components/{FSDateTimeRangeField.vue → fields/FSDateTimeRangeField.vue} +45 -81
- package/components/{FSIconField.vue → fields/FSIconField.vue} +16 -55
- package/components/{FSNumberField.vue → fields/FSNumberField.vue} +17 -27
- package/components/{FSPasswordField.vue → fields/FSPasswordField.vue} +5 -29
- package/components/{FSRichTextField.vue → fields/FSRichTextField.vue} +13 -11
- package/components/{FSSearchField.vue → fields/FSSearchField.vue} +1 -1
- package/components/{FSSelectField.vue → fields/FSSelectField.vue} +17 -21
- package/components/{FSTagField.vue → fields/FSTagField.vue} +18 -53
- package/components/{FSTextArea.vue → fields/FSTextArea.vue} +26 -26
- package/components/{FSTextField.vue → fields/FSTextField.vue} +18 -18
- package/components/fields/FSTimeField.vue +202 -0
- package/components/fields/FSTimeSlotField.vue +269 -0
- package/components/lists/FSDataTableUI.vue +10 -12
- package/components/lists/FSFilterButton.vue +1 -1
- package/components/tiles/FSDeviceOrganisationTileUI.vue +4 -9
- package/components/tiles/FSGroupTileUI.vue +4 -9
- package/composables/index.ts +1 -0
- package/composables/useBreakpoints.ts +7 -5
- package/composables/useRules.ts +72 -0
- package/elements/FSFormElement.ts +17 -0
- package/icons/flags/France.vue +9 -0
- package/icons/flags/Germany.vue +7 -0
- package/icons/flags/GreatBritain.vue +9 -0
- package/icons/flags/Italy.vue +9 -0
- package/icons/flags/Portugal.vue +59 -0
- package/icons/flags/Spain.vue +546 -0
- package/icons/flags/UnitedStates.vue +12 -0
- package/icons/sets.ts +17 -0
- package/models/rules.ts +8 -0
- package/package.json +4 -4
- package/styles/components/fs_autocomplete_field.scss +3 -60
- package/styles/components/fs_clock.scss +4 -0
- package/styles/components/fs_color_field.scss +21 -0
- package/styles/components/fs_data_table.scss +7 -2
- package/styles/components/fs_divider.scss +5 -0
- package/styles/components/fs_image.scss +12 -1
- package/styles/components/fs_label.scss +86 -0
- package/styles/components/fs_pagination.scss +3 -3
- package/styles/components/fs_rich_text_field.scss +1 -1
- package/styles/components/fs_select_field.scss +3 -4
- package/styles/components/fs_switch.scss +4 -4
- package/styles/components/fs_text_area.scss +2 -0
- package/styles/components/fs_text_field.scss +1 -0
- package/styles/components/fs_time_field.scss +16 -0
- package/styles/components/fs_timeslot_field.scss +12 -0
- package/styles/components/index.scss +4 -0
- package/styles/globals/overrides.scss +8 -6
- package/styles/globals/text_fonts.scss +18 -0
- package/utils/color.ts +7 -0
- package/utils/css.ts +2 -1
- package/utils/icons.ts +88 -2
- package/utils/index.ts +3 -1
- package/utils/time.ts +29 -0
- package/components/FSHeaderButton.vue +0 -17
- package/components/lists/FSDataIteratorGroup.vue +0 -7
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol>
|
|
3
|
+
<slot v-if="!$props.hideHeader" name="label">
|
|
4
|
+
<FSRow :wrap="false">
|
|
5
|
+
<FSSpan
|
|
6
|
+
v-if="$props.label"
|
|
7
|
+
class="fs-time-slot-field-label"
|
|
8
|
+
font="text-overline"
|
|
9
|
+
:style="style"
|
|
10
|
+
>
|
|
11
|
+
{{ $props.label }}
|
|
12
|
+
</FSSpan>
|
|
13
|
+
<FSSpan
|
|
14
|
+
v-if="$props.label && $props.required"
|
|
15
|
+
class="fs-time-slot-field-label"
|
|
16
|
+
style="margin-left: -8px;"
|
|
17
|
+
font="text-overline"
|
|
18
|
+
:ellipsis="false"
|
|
19
|
+
:style="style"
|
|
20
|
+
>
|
|
21
|
+
*
|
|
22
|
+
</FSSpan>
|
|
23
|
+
<v-spacer style="min-width: 40px;" />
|
|
24
|
+
<FSSpan
|
|
25
|
+
v-if="messages.length > 0"
|
|
26
|
+
class="fs-time-slot-field-messages"
|
|
27
|
+
font="text-overline"
|
|
28
|
+
:style="style"
|
|
29
|
+
>
|
|
30
|
+
{{ messages.join(", ") }}
|
|
31
|
+
</FSSpan>
|
|
32
|
+
</FSRow>
|
|
33
|
+
</slot>
|
|
34
|
+
<FSRow>
|
|
35
|
+
<FSRow
|
|
36
|
+
:wrap="false"
|
|
37
|
+
>
|
|
38
|
+
<FSSelectField
|
|
39
|
+
:editable="$props.editable"
|
|
40
|
+
:items="daysObject"
|
|
41
|
+
:hideHeader="true"
|
|
42
|
+
:clearable="false"
|
|
43
|
+
:style="style"
|
|
44
|
+
:rules="$props.rules"
|
|
45
|
+
:messages="messages"
|
|
46
|
+
:validateOn="validateOn"
|
|
47
|
+
:validationValue="$props.modelValue"
|
|
48
|
+
:modelValue="dayStart"
|
|
49
|
+
@update:modelValue="onChangeDayStart"
|
|
50
|
+
>
|
|
51
|
+
<template v-for="(_, name) in slots" v-slot:[name]="slotData">
|
|
52
|
+
<slot :name="name" v-bind="slotData" />
|
|
53
|
+
</template>
|
|
54
|
+
</FSSelectField>
|
|
55
|
+
<FSClock
|
|
56
|
+
class="fs-time-slot-field-number"
|
|
57
|
+
:editable="$props.editable"
|
|
58
|
+
:color="ColorEnum.Light"
|
|
59
|
+
:reminder="false"
|
|
60
|
+
:slider="false"
|
|
61
|
+
:style="style"
|
|
62
|
+
:modelValue="$props.modelValue[0][1]"
|
|
63
|
+
@update:modelValue="onChangeHourStart"
|
|
64
|
+
/>
|
|
65
|
+
</FSRow>
|
|
66
|
+
<FSRow
|
|
67
|
+
:wrap="false"
|
|
68
|
+
>
|
|
69
|
+
<FSSelectField
|
|
70
|
+
class="fs-time-slot-field-select"
|
|
71
|
+
:editable="$props.editable"
|
|
72
|
+
:items="daysObject"
|
|
73
|
+
:hideHeader="true"
|
|
74
|
+
:clearable="false"
|
|
75
|
+
:style="style"
|
|
76
|
+
:modelValue="dayEnd"
|
|
77
|
+
@update:modelValue="onChangeDayEnd"
|
|
78
|
+
/>
|
|
79
|
+
<FSClock
|
|
80
|
+
class="fs-time-slot-field-number"
|
|
81
|
+
:editable="$props.editable"
|
|
82
|
+
:color="ColorEnum.Light"
|
|
83
|
+
:reminder="false"
|
|
84
|
+
:slider="false"
|
|
85
|
+
:style="style"
|
|
86
|
+
:modelValue="$props.modelValue[1][1]"
|
|
87
|
+
@update:modelValue="onChangeHourEnd"
|
|
88
|
+
/>
|
|
89
|
+
</FSRow>
|
|
90
|
+
</FSRow>
|
|
91
|
+
<slot name="description">
|
|
92
|
+
<FSSpan
|
|
93
|
+
v-if="$props.description"
|
|
94
|
+
class="fs-time-slot-field-description"
|
|
95
|
+
font="text-underline"
|
|
96
|
+
:style="style"
|
|
97
|
+
>
|
|
98
|
+
{{ $props.description }}
|
|
99
|
+
</FSSpan>
|
|
100
|
+
</slot>
|
|
101
|
+
</FSCol>
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<script lang="ts">
|
|
105
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
106
|
+
|
|
107
|
+
import { useColors, useRules, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
108
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
109
|
+
import { Days } from "@dative-gpi/foundation-shared-domain/models";
|
|
110
|
+
|
|
111
|
+
import FSSelectField from "./FSSelectField.vue";
|
|
112
|
+
import FSClock from "../FSClock.vue";
|
|
113
|
+
import FSSpan from "../FSSpan.vue";
|
|
114
|
+
import FSCol from "../FSCol.vue";
|
|
115
|
+
import FSRow from "../FSRow.vue";
|
|
116
|
+
|
|
117
|
+
export default defineComponent({
|
|
118
|
+
name: "FSTimeSlotField",
|
|
119
|
+
components: {
|
|
120
|
+
FSSelectField,
|
|
121
|
+
FSClock,
|
|
122
|
+
FSSpan,
|
|
123
|
+
FSCol,
|
|
124
|
+
FSRow
|
|
125
|
+
},
|
|
126
|
+
props: {
|
|
127
|
+
label: {
|
|
128
|
+
type: String,
|
|
129
|
+
required: false,
|
|
130
|
+
default: null
|
|
131
|
+
},
|
|
132
|
+
description: {
|
|
133
|
+
type: String,
|
|
134
|
+
required: false,
|
|
135
|
+
default: null
|
|
136
|
+
},
|
|
137
|
+
modelValue: {
|
|
138
|
+
type: Array as PropType<number[][]>,
|
|
139
|
+
required: true,
|
|
140
|
+
default: null
|
|
141
|
+
},
|
|
142
|
+
hideHeader: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
required: false,
|
|
145
|
+
default: false
|
|
146
|
+
},
|
|
147
|
+
required: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
required: false,
|
|
150
|
+
default: false
|
|
151
|
+
},
|
|
152
|
+
rules: {
|
|
153
|
+
type: Array as PropType<Function[]>,
|
|
154
|
+
required: false,
|
|
155
|
+
default: () => []
|
|
156
|
+
},
|
|
157
|
+
messages: {
|
|
158
|
+
type: Array as PropType<string[]>,
|
|
159
|
+
required: false,
|
|
160
|
+
default: null
|
|
161
|
+
},
|
|
162
|
+
editable: {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
required: false,
|
|
165
|
+
default: true
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
emits: ["update:modelValue"],
|
|
169
|
+
setup(props, { emit }) {
|
|
170
|
+
const { validateOn, blurred, getMessages } = useRules();
|
|
171
|
+
const { getColors } = useColors();
|
|
172
|
+
const { slots } = useSlots();
|
|
173
|
+
|
|
174
|
+
delete slots.label;
|
|
175
|
+
delete slots.description;
|
|
176
|
+
|
|
177
|
+
const errors = getColors(ColorEnum.Error);
|
|
178
|
+
const lights = getColors(ColorEnum.Light);
|
|
179
|
+
const darks = getColors(ColorEnum.Dark);
|
|
180
|
+
|
|
181
|
+
const daysObject: { id: number; label: string }[] = Object.keys(Days).reduce((acc, key) => {
|
|
182
|
+
if(isNaN(Number(key))){
|
|
183
|
+
acc.push({
|
|
184
|
+
id: Days[key],
|
|
185
|
+
label: key
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return acc;
|
|
189
|
+
}, []);
|
|
190
|
+
|
|
191
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
192
|
+
if (!props.editable) {
|
|
193
|
+
return {
|
|
194
|
+
"--fs-time-slot-field-cursor" : "default",
|
|
195
|
+
"--fs-time-slot-field-border-color" : lights.base,
|
|
196
|
+
"--fs-time-slot-field-color" : lights.dark,
|
|
197
|
+
"--fs-time-slot-field-active-border-color": lights.base
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
"--fs-time-slot-field-cursor" : "text",
|
|
202
|
+
"--fs-time-slot-field-border-color" : lights.dark,
|
|
203
|
+
"--fs-time-slot-field-color" : darks.base,
|
|
204
|
+
"--fs-time-slot-field-active-border-color": darks.dark,
|
|
205
|
+
"--fs-time-slot-field-error-color" : errors.base,
|
|
206
|
+
"--fs-time-slot-field-error-border-color" : errors.base
|
|
207
|
+
};
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
const dayStart = computed((): number => {
|
|
211
|
+
return props.modelValue[1][0] === 7 ? 7 : props.modelValue[0][0];
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
const dayEnd = computed((): number => {
|
|
215
|
+
return props.modelValue[0][0] === 7 ? 7 : props.modelValue[1][0];
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
|
|
219
|
+
|
|
220
|
+
const onChangeDayStart = (value: number) => {
|
|
221
|
+
if (value === 7) {
|
|
222
|
+
emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (props.modelValue[1][0] === 7) {
|
|
226
|
+
emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
emit("update:modelValue", [[value, props.modelValue[0][1]], props.modelValue[1]]);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const onChangeHourStart = (value: number) => {
|
|
233
|
+
emit("update:modelValue", [[props.modelValue[0][0], value], props.modelValue[1]]);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const onChangeDayEnd = (value: number) => {
|
|
237
|
+
if (value === 7) {
|
|
238
|
+
emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (props.modelValue[0][0] === 7) {
|
|
242
|
+
emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
emit("update:modelValue", [props.modelValue[0], [value, props.modelValue[1][1]]]);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const onChangeHourEnd = (value: number) => {
|
|
249
|
+
emit("update:modelValue", [props.modelValue[0], [props.modelValue[1][0], value]]);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
return {
|
|
253
|
+
daysObject,
|
|
254
|
+
validateOn,
|
|
255
|
+
ColorEnum,
|
|
256
|
+
dayStart,
|
|
257
|
+
messages,
|
|
258
|
+
blurred,
|
|
259
|
+
dayEnd,
|
|
260
|
+
slots,
|
|
261
|
+
style,
|
|
262
|
+
onChangeHourStart,
|
|
263
|
+
onChangeDayStart,
|
|
264
|
+
onChangeHourEnd,
|
|
265
|
+
onChangeDayEnd
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
</script>
|
|
@@ -222,6 +222,7 @@
|
|
|
222
222
|
<v-spacer />
|
|
223
223
|
<FSRow
|
|
224
224
|
align="center-right"
|
|
225
|
+
width="hug"
|
|
225
226
|
:wrap="false"
|
|
226
227
|
>
|
|
227
228
|
<FSText
|
|
@@ -229,16 +230,13 @@
|
|
|
229
230
|
>
|
|
230
231
|
{{ $tr("ui.data-table.rows-per-page", "Rows per page") }}
|
|
231
232
|
</FSText>
|
|
232
|
-
<
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
v-model="innerRowsPerPage"
|
|
240
|
-
/>
|
|
241
|
-
</FSRow>
|
|
233
|
+
<FSSelectField
|
|
234
|
+
class="fs-data-table-rows-per-page"
|
|
235
|
+
:clearable="false"
|
|
236
|
+
:hideHeader="true"
|
|
237
|
+
:items="rowsPerPageOptions"
|
|
238
|
+
v-model="innerRowsPerPage"
|
|
239
|
+
/>
|
|
242
240
|
</FSRow>
|
|
243
241
|
<FSToggleSet
|
|
244
242
|
v-if="innerRowsPerPage !== -1"
|
|
@@ -415,11 +413,11 @@ import { useBreakpoints, useColors, useSlots } from "@dative-gpi/foundation-shar
|
|
|
415
413
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
416
414
|
|
|
417
415
|
import FSDataIteratorItem from "./FSDataIteratorItem.vue";
|
|
416
|
+
import FSSearchField from "../fields/FSSearchField.vue";
|
|
417
|
+
import FSSelectField from "../fields/FSSelectField.vue";
|
|
418
418
|
import FSFilterButton from "./FSFilterButton.vue";
|
|
419
419
|
import FSHiddenButton from "./FSHiddenButton.vue";
|
|
420
420
|
import FSHeaderButton from "./FSHeaderButton.vue";
|
|
421
|
-
import FSSearchField from "../FSSearchField.vue";
|
|
422
|
-
import FSSelectField from "../FSSelectField.vue";
|
|
423
421
|
import FSContainer from "../FSContainer.vue";
|
|
424
422
|
import FSToggleSet from "../FSToggleSet.vue";
|
|
425
423
|
import FSCheckbox from "../FSCheckbox.vue";
|
|
@@ -73,7 +73,7 @@ import { computed, defineComponent, PropType, ref } from "vue";
|
|
|
73
73
|
import { ColorBase, ColorEnum, FSDataTableColumn, FSDataTableFilter } from "@dative-gpi/foundation-shared-components/models";
|
|
74
74
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
75
75
|
|
|
76
|
-
import FSSearchField from "../FSSearchField.vue";
|
|
76
|
+
import FSSearchField from "../fields/FSSearchField.vue";
|
|
77
77
|
import FSFadeOut from "../FSFadeOut.vue";
|
|
78
78
|
import FSCard from "../FSCard.vue";
|
|
79
79
|
import FSChip from "../FSChip.vue";
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
align="center-center"
|
|
14
14
|
gap="24px"
|
|
15
15
|
:wrap="false"
|
|
16
|
-
:height="
|
|
16
|
+
:height="imageSize"
|
|
17
17
|
>
|
|
18
18
|
<FSCol
|
|
19
19
|
gap="12px"
|
|
@@ -205,16 +205,12 @@ export default defineComponent({
|
|
|
205
205
|
return isMobileSized.value ? 90 : 100;
|
|
206
206
|
});
|
|
207
207
|
|
|
208
|
-
const infoWidth = computed(():
|
|
208
|
+
const infoWidth = computed((): number => {
|
|
209
209
|
let width = isMobileSized.value ? 288 : 304;
|
|
210
210
|
if (props.imageId) {
|
|
211
211
|
width -= imageSize.value;
|
|
212
212
|
}
|
|
213
|
-
return
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
const infoHeight = computed((): string => {
|
|
217
|
-
return `${imageSize.value}px`;
|
|
213
|
+
return width;
|
|
218
214
|
});
|
|
219
215
|
|
|
220
216
|
return {
|
|
@@ -224,8 +220,7 @@ export default defineComponent({
|
|
|
224
220
|
carouselModelStatuses,
|
|
225
221
|
carouselDeviceStatuses,
|
|
226
222
|
imageSize,
|
|
227
|
-
infoWidth
|
|
228
|
-
infoHeight
|
|
223
|
+
infoWidth
|
|
229
224
|
};
|
|
230
225
|
}
|
|
231
226
|
});
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
align="center-center"
|
|
14
14
|
gap="24px"
|
|
15
15
|
:wrap="false"
|
|
16
|
-
:height="
|
|
16
|
+
:height="imageSize"
|
|
17
17
|
>
|
|
18
18
|
<FSCol
|
|
19
19
|
gap="12px"
|
|
@@ -167,16 +167,12 @@ export default defineComponent({
|
|
|
167
167
|
return isMobileSized.value ? 90 : 100;
|
|
168
168
|
});
|
|
169
169
|
|
|
170
|
-
const infoWidth = computed(():
|
|
170
|
+
const infoWidth = computed((): number => {
|
|
171
171
|
let width = isMobileSized.value ? 288 : 304;
|
|
172
172
|
if (props.imageId) {
|
|
173
173
|
width -= imageSize.value;
|
|
174
174
|
}
|
|
175
|
-
return
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
const infoHeight = computed((): string => {
|
|
179
|
-
return `${imageSize.value}px`;
|
|
175
|
+
return width;
|
|
180
176
|
});
|
|
181
177
|
|
|
182
178
|
return {
|
|
@@ -184,8 +180,7 @@ export default defineComponent({
|
|
|
184
180
|
groupsLabel,
|
|
185
181
|
deviceOrganisationsLabel,
|
|
186
182
|
imageSize,
|
|
187
|
-
infoWidth
|
|
188
|
-
infoHeight
|
|
183
|
+
infoWidth
|
|
189
184
|
};
|
|
190
185
|
}
|
|
191
186
|
});
|
package/composables/index.ts
CHANGED
|
@@ -3,19 +3,21 @@ import { computed, onMounted, onUnmounted, ref } from "vue";
|
|
|
3
3
|
export const useBreakpoints = () => {
|
|
4
4
|
const windowWidth = ref(window.innerWidth);
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const onSizeChange = (): void => {
|
|
7
|
+
windowWidth.value = window.innerWidth;
|
|
8
|
+
};
|
|
7
9
|
|
|
8
10
|
onMounted(() => {
|
|
9
|
-
window.addEventListener("resize",
|
|
11
|
+
window.addEventListener("resize", onSizeChange);
|
|
10
12
|
});
|
|
11
13
|
|
|
12
14
|
onUnmounted(() => {
|
|
13
|
-
window.removeEventListener("resize",
|
|
15
|
+
window.removeEventListener("resize", onSizeChange);
|
|
14
16
|
});
|
|
15
17
|
|
|
16
|
-
const isTouchScreenEnabled = (): boolean => {
|
|
18
|
+
const isTouchScreenEnabled = computed((): boolean => {
|
|
17
19
|
return navigator.maxTouchPoints > 0;
|
|
18
|
-
};
|
|
20
|
+
});
|
|
19
21
|
|
|
20
22
|
const isMobileSized = computed((): boolean => {
|
|
21
23
|
return windowWidth.value < 1264;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { computed, inject, ref } from "vue";
|
|
2
|
+
|
|
3
|
+
export const useRules = () => {
|
|
4
|
+
const innerValidateOn = inject<"submit" | "blur" | "input">("validateOn", 'input');
|
|
5
|
+
const submitted = inject<boolean>("submitted", false);
|
|
6
|
+
|
|
7
|
+
const blurred = ref(false);
|
|
8
|
+
|
|
9
|
+
const validateOn = computed((): string => {
|
|
10
|
+
switch (innerValidateOn) {
|
|
11
|
+
case "submit": return submitted ? "input" : "submit";
|
|
12
|
+
case "blur": return blurred.value ? "input" : "blur";
|
|
13
|
+
case "input": return "input";
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const getMessages = (modelValue: any, rules: any[], checkArray: boolean = false): string[] => {
|
|
18
|
+
if (!rules || !rules.length) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
switch (validateOn.value) {
|
|
22
|
+
case "submit":
|
|
23
|
+
if (!submitted) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
case "blur":
|
|
28
|
+
if (!blurred.value) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
break;
|
|
32
|
+
case "input":
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
const messages: string[] = [];
|
|
36
|
+
if (checkArray) {
|
|
37
|
+
if (modelValue && Array.isArray(modelValue)) {
|
|
38
|
+
for (const value of modelValue) {
|
|
39
|
+
for (const rule of rules) {
|
|
40
|
+
const message = rule(value);
|
|
41
|
+
if (typeof(message) === "string") {
|
|
42
|
+
messages.push(message);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
for (const rule of rules) {
|
|
49
|
+
const message = rule(modelValue ?? "");
|
|
50
|
+
if (typeof(message) === "string") {
|
|
51
|
+
messages.push(message);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
for (const rule of rules) {
|
|
58
|
+
const message = rule(modelValue ?? "");
|
|
59
|
+
if (typeof(message) === "string") {
|
|
60
|
+
messages.push(message);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return [...new Set(messages)];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
validateOn,
|
|
69
|
+
blurred,
|
|
70
|
+
getMessages
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineCustomElement, PropType } from "vue";
|
|
2
|
+
|
|
3
|
+
export default defineCustomElement({
|
|
4
|
+
name: "FSFormElement",
|
|
5
|
+
props: {
|
|
6
|
+
modelValue: {
|
|
7
|
+
type: Boolean,
|
|
8
|
+
required: false,
|
|
9
|
+
default: null
|
|
10
|
+
},
|
|
11
|
+
variant: {
|
|
12
|
+
type: String as PropType<"standard" | "instant">,
|
|
13
|
+
required: false,
|
|
14
|
+
default: "standard"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-fr" viewBox="0 0 640 480">
|
|
3
|
+
<g fill-rule="evenodd" stroke-width="1pt">
|
|
4
|
+
<path fill="#fff" d="M0 0h640v480H0z"/>
|
|
5
|
+
<path fill="#00267f" d="M0 0h213.3v480H0z"/>
|
|
6
|
+
<path fill="#f31830" d="M426.7 0H640v480H426.7z"/>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
9
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-gb" viewBox="0 0 640 480">
|
|
3
|
+
<path fill="#012169" d="M0 0h640v480H0z"/>
|
|
4
|
+
<path fill="#FFF" d="m75 0 244 181L562 0h78v62L400 241l240 178v61h-80L320 301 81 480H0v-60l239-178L0 64V0h75z"/>
|
|
5
|
+
<path fill="#C8102E" d="m424 281 216 159v40L369 281h55zm-184 20 6 35L54 480H0l240-179zM640 0v3L391 191l2-44L590 0h50zM0 0l239 176h-60L0 42V0z"/>
|
|
6
|
+
<path fill="#FFF" d="M241 0v480h160V0H241zM0 160v160h640V160H0z"/>
|
|
7
|
+
<path fill="#C8102E" d="M0 193v96h640v-96H0zM273 0v480h96V0h-96z"/>
|
|
8
|
+
</svg>
|
|
9
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-it" viewBox="0 0 640 480">
|
|
3
|
+
<g fill-rule="evenodd" stroke-width="1pt">
|
|
4
|
+
<path fill="#fff" d="M0 0h640v480H0z"/>
|
|
5
|
+
<path fill="#009246" d="M0 0h213.3v480H0z"/>
|
|
6
|
+
<path fill="#ce2b37" d="M426.7 0H640v480H426.7z"/>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
9
|
+
</template>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="flag-icons-pt" viewBox="0 0 640 480">
|
|
3
|
+
<path fill="red" d="M256 0h384v480H256z"/>
|
|
4
|
+
<path fill="#060" d="M0 0h256v480H0z"/>
|
|
5
|
+
<g fill="#ff0" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width=".6">
|
|
6
|
+
<path d="M339.5 306.2c-32.3-1-180-93.2-181-108l8.1-13.5c14.7 21.3 165.7 111 180.6 107.8l-7.7 13.7"/>
|
|
7
|
+
<path d="M164.9 182.8c-2.9 7.8 38.6 33.4 88.4 63.8 49.9 30.3 92.9 49 96 46.4l1.5-2.8c-.6 1-2 1.3-4.3.6-13.5-3.9-48.6-20-92.1-46.4-43.6-26.4-81.4-50.7-87.3-61a6.3 6.3 0 0 1-.6-3.1h-.2l-1.2 2.2-.2.3zm175.3 123.8c-.5 1-1.6 1-3.5.8-12-1.3-48.6-19.1-91.9-45-50.4-30.2-92-57.6-87.4-64.8l1.2-2.2.2.1c-4 12.2 82.1 61.4 87.2 64.6 49.8 30.8 91.8 48.9 95.5 44.2l-1.3 2.3z"/>
|
|
8
|
+
<path d="M256.2 207.2c32.2-.3 72-4.4 95-13.6l-5-8c-13.5 7.5-53.5 12.5-90.3 13.2-43.4-.4-74.1-4.5-89.5-14.8l-4.6 8.6c28.2 12 57.2 14.5 94.4 14.6"/>
|
|
9
|
+
<path d="M352.5 193.8c-.8 1.3-15.8 6.4-37.8 10.2a381.2 381.2 0 0 1-58.6 4.3 416.1 416.1 0 0 1-56.2-3.6c-23.1-3.6-35-8.6-39.5-10.4l1.1-2.2c12.7 5 24.7 8 38.7 10.2A411.5 411.5 0 0 0 256 206a391.8 391.8 0 0 0 58.3-4.3c22.5-3.7 34.8-8.4 36.6-10.5l1.6 2.7zm-4.4-8.1c-2.4 2-14.6 6.3-36 9.7a388.2 388.2 0 0 1-55.8 4c-22 0-40.1-1.6-53.8-3.6-21.8-2.8-33.4-8-37.6-9.4l1.3-2.2c3.3 1.7 14.4 6.2 36.5 9.3a385 385 0 0 0 53.6 3.4 384 384 0 0 0 55.4-4c21.5-3 33.1-8.4 34.9-9.8l1.5 2.6zM150.3 246c19.8 10.7 63.9 16 105.6 16.4 38 .1 87.4-5.8 105.9-15.6l-.5-10.7c-5.8 9-58.8 17.7-105.8 17.4-47-.4-90.7-7.6-105.3-17v9.5"/>
|
|
10
|
+
<path d="M362.8 244.5v2.5c-2.8 3.4-20.2 8.4-42 12a434 434 0 0 1-65.4 4.4 400 400 0 0 1-62-4.3 155 155 0 0 1-44.4-12v-2.9c9.7 6.4 35.9 11.2 44.7 12.6 15.8 2.4 36.1 4.2 61.7 4.2 26.9 0 48.4-1.9 65-4.4 15.7-2.3 38-8.2 42.4-12.1zm0-9v2.5c-2.8 3.3-20.2 8.3-42 11.9a434 434 0 0 1-65.4 4.5 414 414 0 0 1-62-4.3 155 155 0 0 1-44.4-12v-3c9.7 6.5 36 11.2 44.7 12.6a408 408 0 0 0 61.7 4.3c26.9 0 48.5-2 65-4.5 15.7-2.2 38-8.1 42.4-12zm-107 68.8c-45.6-.2-84.7-12.4-93-14.4l6 9.4a249.8 249.8 0 0 0 87.4 14.3c34.7-1 65-3.7 86.3-14.1l6.2-9.8c-14.5 6.9-64 14.6-93 14.6"/>
|
|
11
|
+
<path d="M344.9 297.3a143 143 0 0 1-2.8 4c-10 3.6-26 7.4-32.6 8.4a295.5 295.5 0 0 1-53.7 5c-40.4-.6-73.5-8.5-89-15.3l-1.3-2.1.2-.4 2.1.9a286.5 286.5 0 0 0 88.2 14.5c18.8 0 37.5-2.1 52.6-4.8 23.2-4.7 32.6-8.2 35.5-9.8l.7-.4zm5.3-8.8a287.2 287.2 0 0 1-2 3.5c-5.4 2-20 6.2-41.3 9.2-14 1.9-22.7 3.8-50.6 4.3a347.4 347.4 0 0 1-94.2-14L161 289a390 390 0 0 0 95.4 14c25.5-.5 36.4-2.4 50.3-4.3 24.8-3.8 37.3-8 41-9.1a2.9 2.9 0 0 0 0-.2l2.6-1z"/>
|
|
12
|
+
<path d="M350.8 237.6c.1 30-15.3 57-27.6 68.8a99.3 99.3 0 0 1-67.8 28.2c-30.3.5-58.8-19.2-66.5-27.9a101 101 0 0 1-27.5-67.4c1.8-32.8 14.7-55.6 33.3-71.3a99.6 99.6 0 0 1 64.2-22.7 98.2 98.2 0 0 1 71 35.6c12.5 15.2 18 31.7 20.9 56.7zM255.6 135a106 106 0 0 1 106 105.2 105.6 105.6 0 1 1-211.4 0c-.1-58 47.3-105.2 105.4-105.2"/>
|
|
13
|
+
<path d="M255.9 134.5c58.2 0 105.6 47.4 105.6 105.6S314.1 345.7 256 345.7s-105.6-47.4-105.6-105.6c0-58.2 47.4-105.6 105.6-105.6zM152.6 240c0 56.8 46.7 103.3 103.3 103.3 56.6 0 103.3-46.5 103.3-103.3s-46.7-103.3-103.3-103.3S152.6 183.2 152.6 240z"/>
|
|
14
|
+
<path d="M256 143.3a97 97 0 0 1 96.7 96.7 97.1 97.1 0 0 1-96.7 96.8c-53 0-96.7-43.6-96.7-96.8a97.1 97.1 0 0 1 96.7-96.7zM161.6 240c0 52 42.6 94.4 94.4 94.4s94.4-42.5 94.4-94.4c0-52-42.6-94.4-94.4-94.4a94.8 94.8 0 0 0-94.4 94.4z"/>
|
|
15
|
+
<path d="M260.3 134h-9.1v212.3h9z"/>
|
|
16
|
+
<path d="M259.3 132.8h2.3v214.7h-2.2V132.8zm-9 0h2.4v214.7h-2.3V132.8z"/>
|
|
17
|
+
<path d="M361.6 244.2v-7.8l-6.4-6-36.3-9.6-52.2-5.3-63 3.2-44.8 10.6-9 6.7v7.9l22.9-10.3 54.4-8.5h52.3l38.4 4.2 26.6 6.4z"/>
|
|
18
|
+
<path d="M256 223.8c24.9 0 49 2.3 68.3 6 19.8 4 33.7 9 38.5 14.5v2.8c-5.8-7-24.5-12-39-15-19-3.6-43-6-67.9-6-26.1 0-50.5 2.6-69.3 6.2-15 3-35.1 9-37.6 14.8v-2.9c1.3-4 16.3-10 37.3-14.3 18.9-3.7 43.3-6.1 69.6-6.1zm0-9.1a383 383 0 0 1 68.3 6c19.8 4 33.7 9 38.5 14.6v2.7c-5.8-6.9-24.5-12-39-14.9-19-3.7-43-6-67.9-6a376 376 0 0 0-69.2 6.2c-14.5 2.7-35.4 8.9-37.7 14.7v-2.8c1.4-4 16.6-10.3 37.3-14.3 19-3.7 43.3-6.2 69.7-6.2zm-.6-46.2c39.3-.2 73.6 5.5 89.3 13.5l5.7 10c-13.6-7.4-50.6-15-94.9-14-36.1.3-74.7 4-94 14.4l6.8-11.4c15.9-8.3 53.3-12.5 87.1-12.5"/>
|
|
19
|
+
<path d="M256 176.7a354 354 0 0 1 61.3 4.3c16 3 31.3 7.4 33.5 9.8l1.7 3c-5.3-3.4-18.6-7.3-35.6-10.5s-38.7-4.3-61-4.2c-25.3-.1-45 1.2-61.8 4.2a108.9 108.9 0 0 0-33.3 10.3l1.7-3.1c6-3 15.3-6.7 31.1-9.6 17.5-3.2 37.4-4.1 62.4-4.2zm0-9c21.4-.2 42.6 1 59.1 4a96 96 0 0 1 30.6 10l2.5 4c-4.2-4.7-20-9.2-34.1-11.6-16.4-2.9-36.7-4-58.1-4.2a361 361 0 0 0-59.5 4.4 97.3 97.3 0 0 0-29.6 9.1l2.2-3.3c5.8-3 15.2-5.8 27-8.1a357 357 0 0 1 59.9-4.4zM308.4 284a276.4 276.4 0 0 0-52.5-4c-65.5.8-86.6 13.5-89.2 17.3l-5-8c16.8-12 52.4-18.8 94.6-18.2 21.9.4 40.8 1.9 56.6 5l-4.5 8"/>
|
|
20
|
+
<path d="M255.6 278.9c18.2.3 36 1 53.3 4.2l-1.2 2.2c-16-3-33.2-4-52-4-24.3-.2-48.7 2.1-70 8.2-6.7 1.9-17.8 6.2-19 9.8l-1.2-2c.4-2.2 7-6.6 19.6-10 24.4-7 47.2-8.3 70.5-8.4zm.8-9.2a327 327 0 0 1 57.3 5l-1.3 2.3a299 299 0 0 0-56-4.9c-24.2 0-49.9 1.8-73.3 8.6-7.5 2.2-20.6 7-21 10.7l-1.2-2.2c.2-3.4 11.5-7.9 21.7-10.8 23.5-6.9 49.3-8.6 73.8-8.7z"/>
|
|
21
|
+
<path d="m349.4 290.5-7.8 12.3-22.7-20.1-58.6-39.5-66.2-36.3-34.3-11.7 7.3-13.6 2.5-1.3 21.3 5.3 70.4 36.3 40.6 25.6L336 272l13.9 16z"/>
|
|
22
|
+
<path d="M158.6 195.5c6-4 50.2 15.6 96.6 43.6 46.1 28 90.3 59.6 86.3 65.5l-1.3 2.1-.6.5c.1-.1.8-1 0-3.1-2-6.5-33.4-31.5-85.3-62.9-50.7-30.1-92.9-48.3-97-43.1l1.3-2.6zM351 290.4c3.8-7.6-37.2-38.5-88.1-68.6-52-29.5-89.6-46.9-96.5-41.7L165 183c0 .1 0-.2.4-.5 1.2-1 3.3-1 4.2-1 11.8.2 45.5 15.7 92.8 42.8 20.8 12 87.6 55 87.3 67 0 1 .1 1.2-.3 1.8l1.7-2.6z"/>
|
|
23
|
+
</g>
|
|
24
|
+
<g transform="translate(0 26.7) scale(1.06667)">
|
|
25
|
+
<path fill="#fff" stroke="#000" stroke-width=".7" d="M180.6 211a58.7 58.7 0 0 0 17.5 41.7 59 59 0 0 0 41.8 17.6 59.4 59.4 0 0 0 42-17.4 59 59 0 0 0 17.4-41.8v-79.2l-118.7-.2V211z"/>
|
|
26
|
+
<path fill="red" stroke="#000" stroke-width=".5" d="M182.8 211.1a56.4 56.4 0 0 0 16.8 40 57 57 0 0 0 40.2 16.8 56.9 56.9 0 0 0 40.2-16.6 56.4 56.4 0 0 0 16.7-40v-77H183v76.8m91-53.7v48.9l-.1 5.1a33.2 33.2 0 0 1-10 24 34 34 0 0 1-24 10c-9.4 0-17.7-4-23.9-10.2a34 34 0 0 1-10-24v-54l68 .2z"/>
|
|
27
|
+
<g id="e">
|
|
28
|
+
<g id="d" fill="#ff0" stroke="#000" stroke-width=".5">
|
|
29
|
+
<path stroke="none" d="M190.2 154.4c.1-5.5 4-6.8 4-6.8.1 0 4.3 1.4 4.3 6.9h-8.3"/>
|
|
30
|
+
<path d="m186.8 147.7-.7 6.3h4.2c0-5.2 4-6 4-6 .1 0 4 1.1 4.1 6h4.2l-.8-6.4h-15zm-1 6.4h17c.3 0 .6.3.6.7 0 .5-.3.8-.6.8h-17c-.3 0-.6-.3-.6-.8 0-.4.3-.7.7-.7z"/>
|
|
31
|
+
<path d="M192 154c0-3.3 2.3-4.2 2.3-4.2s2.3 1 2.3 4.2H192m-5.8-9h16.3c.3 0 .6.4.6.8 0 .3-.3.6-.6.6h-16.3c-.3 0-.6-.3-.6-.7 0-.3.3-.6.6-.6zm.4 1.5H202c.3 0 .6.3.6.7 0 .4-.3.7-.6.7h-15.5c-.4 0-.6-.3-.6-.7 0-.4.2-.7.6-.7zm5-10.6h1.2v.8h.9v-.8h1.3v.9h.9v-1h1.2v2c0 .4-.2.6-.5.6h-4.4c-.3 0-.6-.2-.6-.5v-2zm4.6 2.7.3 6.4h-4.3l.3-6.5h3.7"/>
|
|
32
|
+
<path id="a" d="M191 141.6v3.4h-4v-3.4h4z"/>
|
|
33
|
+
<use xlink:href="#a" width="100%" height="100%" x="10.6"/>
|
|
34
|
+
<path id="b" d="M186.3 139h1.2v1h.9v-1h1.2v1h.9v-1h1.2v2c0 .4-.2.6-.5.6h-4.3a.6.6 0 0 1-.6-.6v-2z"/>
|
|
35
|
+
<use xlink:href="#b" width="100%" height="100%" x="10.6"/>
|
|
36
|
+
<path fill="#000" stroke="none" d="M193.9 140.6c0-.6.9-.6.9 0v1.6h-.9v-1.6"/>
|
|
37
|
+
<path id="c" fill="#000" stroke="none" d="M188.6 142.8c0-.6.8-.6.8 0v1.2h-.8v-1.2"/>
|
|
38
|
+
<use xlink:href="#c" width="100%" height="100%" x="10.6"/>
|
|
39
|
+
</g>
|
|
40
|
+
<use xlink:href="#d" width="100%" height="100%" y="46.3"/>
|
|
41
|
+
<use xlink:href="#d" width="100%" height="100%" transform="rotate(-45.2 312.8 180)"/>
|
|
42
|
+
</g>
|
|
43
|
+
<use xlink:href="#d" width="100%" height="100%" x="45.7"/>
|
|
44
|
+
<use xlink:href="#e" width="100%" height="100%" transform="matrix(-1 0 0 1 479.8 0)"/>
|
|
45
|
+
<g id="f" fill="#fff">
|
|
46
|
+
<path fill="#039" d="M232.6 202.4a8.3 8.3 0 0 0 2.2 5.7 7.2 7.2 0 0 0 5.3 2.4c2.1 0 4-1 5.3-2.4a8.3 8.3 0 0 0 2.2-5.7v-10.8h-15v10.8"/>
|
|
47
|
+
<circle cx="236.1" cy="195.7" r="1.5"/>
|
|
48
|
+
<circle cx="244.4" cy="195.7" r="1.5"/>
|
|
49
|
+
<circle cx="240.2" cy="199.7" r="1.5"/>
|
|
50
|
+
<circle cx="236.1" cy="203.9" r="1.5"/>
|
|
51
|
+
<circle cx="244.4" cy="203.9" r="1.5"/>
|
|
52
|
+
</g>
|
|
53
|
+
<use xlink:href="#f" width="100%" height="100%" y="-26"/>
|
|
54
|
+
<use xlink:href="#f" width="100%" height="100%" x="-20.8"/>
|
|
55
|
+
<use xlink:href="#f" width="100%" height="100%" x="20.8"/>
|
|
56
|
+
<use xlink:href="#f" width="100%" height="100%" y="25.8"/>
|
|
57
|
+
</g>
|
|
58
|
+
</svg>
|
|
59
|
+
</template>
|