@dative-gpi/foundation-shared-components 0.0.7 → 0.0.9
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/{models/FSButtons.ts → aliases/FSButton.ts} +24 -21
- package/aliases/index.ts +1 -0
- package/components/FSAutocompleteField.vue +207 -0
- package/components/FSBadge.vue +38 -0
- package/components/FSBreadcrumbs.vue +49 -55
- package/components/FSButton.vue +116 -101
- package/components/FSCalendar.vue +184 -0
- package/components/FSCalendarTwin.vue +412 -0
- package/components/FSCard.vue +77 -0
- package/components/FSCarousel.vue +63 -0
- package/components/FSCheckbox.vue +111 -104
- package/components/FSChip.vue +140 -0
- package/components/FSClock.vue +172 -0
- package/components/FSCol.vue +104 -98
- package/components/FSColor.vue +61 -64
- package/components/FSColorIcon.vue +67 -0
- package/components/FSContainer.vue +64 -0
- package/components/FSDateField.vue +211 -0
- package/components/FSDateRangeField.vue +225 -0
- package/components/FSDateTimeField.vue +257 -0
- package/components/FSDateTimeRangeField.vue +286 -0
- package/components/FSDialog.vue +103 -0
- package/components/FSDivider.vue +39 -0
- package/components/FSFadeOut.vue +49 -59
- package/components/FSFileButton.vue +245 -0
- package/components/FSHeaderButton.vue +17 -0
- package/components/FSIcon.vue +23 -23
- package/components/FSIconField.vue +232 -0
- package/components/FSImage.vue +142 -0
- package/components/FSLoadTile.vue +93 -0
- package/components/FSNumberField.vue +51 -53
- package/components/FSPasswordField.vue +99 -99
- package/components/FSRadio.vue +107 -110
- package/components/FSRadioGroup.vue +55 -57
- package/components/FSRemoveDialog.vue +123 -0
- package/components/FSRichTextField.vue +551 -0
- package/components/FSRow.vue +110 -104
- package/components/FSSearchField.vue +114 -105
- package/components/FSSelectField.vue +188 -0
- package/components/FSSlideGroup.vue +45 -49
- package/components/FSSlider.vue +130 -0
- package/components/FSSpan.vue +53 -37
- package/components/FSSubmitDialog.vue +165 -0
- package/components/FSSwitch.vue +110 -109
- package/components/FSTab.vue +61 -61
- package/components/FSTabs.vue +53 -55
- package/components/FSTag.vue +88 -84
- package/components/FSTagField.vue +183 -128
- package/components/FSTagGroup.vue +38 -45
- package/components/FSText.vue +74 -64
- package/components/FSTextArea.vue +209 -0
- package/components/FSTextField.vue +152 -149
- package/components/FSTile.vue +90 -0
- package/components/FSToggleSet.vue +282 -0
- package/components/FSTooltip.vue +21 -0
- package/components/FSWindow.vue +26 -16
- package/components/FSWrapGroup.vue +44 -47
- package/components/deviceOrganisations/FSConnectivity.vue +114 -0
- package/components/deviceOrganisations/FSStatus.vue +117 -0
- package/components/deviceOrganisations/FSStatusesCarousel.vue +105 -0
- package/components/deviceOrganisations/FSStatusesRow.vue +66 -0
- package/components/deviceOrganisations/FSWorstAlert.vue +165 -0
- package/components/lists/FSDataIteratorGroup.vue +7 -0
- package/components/lists/FSDataIteratorItem.vue +103 -0
- package/components/lists/FSDataTable.vue +964 -0
- package/components/lists/FSFilterButton.vue +176 -0
- package/components/lists/FSHeaderButton.vue +99 -0
- package/components/lists/FSHiddenButton.vue +79 -0
- package/components/tiles/FSDeviceOrganisationTileUI.vue +232 -0
- package/components/tiles/FSGroupTileUI.vue +192 -0
- package/composables/index.ts +2 -1
- package/composables/useBreakpoints.ts +33 -0
- package/composables/useColors.ts +53 -23
- package/composables/useSlots.ts +43 -0
- package/index.ts +6 -0
- package/models/breadcrumbs.ts +8 -0
- package/models/colors.ts +17 -0
- package/models/deviceAlerts.ts +10 -0
- package/models/deviceConnectivities.ts +11 -0
- package/models/deviceStatuses.ts +16 -0
- package/models/dispositions.ts +33 -0
- package/models/index.ts +9 -0
- package/models/modelStatuses.ts +11 -0
- package/models/rules.ts +50 -0
- package/models/toggleSets.ts +7 -0
- package/package.json +13 -4
- package/plugins/colorPlugin.ts +2 -2
- package/shims-plugin.d.ts +1 -1
- package/styles/components/fs_autocomplete_field.scss +123 -0
- package/styles/components/fs_button.scss +4 -14
- package/styles/components/fs_calendar.scss +138 -0
- package/styles/components/fs_card.scss +4 -0
- package/styles/components/fs_carousel.scss +4 -0
- package/styles/components/fs_chip.scss +33 -0
- package/styles/components/fs_clock.scss +43 -0
- package/styles/components/fs_col.scss +2 -0
- package/styles/components/fs_color_icon.scss +37 -0
- package/styles/components/fs_container.scss +16 -0
- package/styles/components/fs_data_iterator_item.scss +19 -0
- package/styles/components/fs_data_table.scss +97 -0
- package/styles/components/fs_date_field.scss +8 -0
- package/styles/components/fs_dialog.scss +30 -0
- package/styles/components/fs_divider.scss +5 -0
- package/styles/components/fs_fade_out.scss +10 -2
- package/styles/components/fs_filter_button.scss +12 -0
- package/styles/components/fs_header_button.scss +4 -0
- package/styles/components/fs_icon.scss +14 -4
- package/styles/components/fs_icon_field.scss +12 -0
- package/styles/components/fs_image.scss +7 -0
- package/styles/components/fs_load_tile.scss +49 -0
- package/styles/components/fs_password_field.scss +2 -2
- package/styles/components/fs_rich_text_field.scss +67 -0
- package/styles/components/fs_row.scss +4 -1
- package/styles/components/fs_select_field.scss +71 -0
- package/styles/components/fs_slide_group.scss +6 -0
- package/styles/components/fs_slider.scss +40 -0
- package/styles/components/fs_span.scss +8 -0
- package/styles/components/fs_submit_dialog.scss +9 -0
- package/styles/components/fs_tabs.scss +4 -0
- package/styles/components/fs_tag_field.scss +6 -8
- package/styles/components/fs_text_area.scss +105 -0
- package/styles/components/fs_text_field.scss +23 -15
- package/styles/components/fs_tile.scss +33 -0
- package/styles/components/fs_tooltip.scss +5 -0
- package/styles/components/fs_wrap_group.scss +7 -8
- package/styles/components/index.scss +26 -0
- package/styles/globals/breakpoints.scss +7 -0
- package/styles/globals/overrides.scss +20 -7
- package/styles/globals/text_fonts.scss +8 -8
- package/themes/default.ts +1 -11
- package/utils/css.ts +11 -0
- package/utils/icons.ts +75416 -0
- package/utils/index.ts +5 -0
- package/utils/levenshtein.ts +97 -0
- package/utils/lexical.ts +27 -0
- package/utils/sort.ts +9 -0
- package/composables/useTouch.ts +0 -9
- package/models/FSTags.ts +0 -8
- package/models/FSTextFields.ts +0 -17
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol>
|
|
3
|
+
<FSRow>
|
|
4
|
+
<FSSpan
|
|
5
|
+
v-if="$props.label"
|
|
6
|
+
class="fs-calendar-label"
|
|
7
|
+
font="text-overline"
|
|
8
|
+
>
|
|
9
|
+
{{ $props.label }}
|
|
10
|
+
</FSSpan>
|
|
11
|
+
</FSRow>
|
|
12
|
+
<FSRow
|
|
13
|
+
class="fs-calendar-twin"
|
|
14
|
+
:style="style"
|
|
15
|
+
>
|
|
16
|
+
<FSCol
|
|
17
|
+
:class="leftClasses"
|
|
18
|
+
:style="style"
|
|
19
|
+
>
|
|
20
|
+
<FSRow
|
|
21
|
+
class="fs-calendar-header"
|
|
22
|
+
align="center-center"
|
|
23
|
+
>
|
|
24
|
+
<FSButton
|
|
25
|
+
size="l"
|
|
26
|
+
variant="icon"
|
|
27
|
+
icon="mdi-chevron-left"
|
|
28
|
+
:color="ColorEnum.Dark"
|
|
29
|
+
@click="onClickPrevious"
|
|
30
|
+
/>
|
|
31
|
+
<FSSpan
|
|
32
|
+
class="fs-calendar-text"
|
|
33
|
+
font="text-h3"
|
|
34
|
+
>
|
|
35
|
+
{{ leftText }}
|
|
36
|
+
</FSSpan>
|
|
37
|
+
<div />
|
|
38
|
+
</FSRow>
|
|
39
|
+
<div
|
|
40
|
+
class="fs-calendar-divider"
|
|
41
|
+
:style="style"
|
|
42
|
+
/>
|
|
43
|
+
<v-locale-provider :locale="languageCode">
|
|
44
|
+
<v-date-picker-month
|
|
45
|
+
:month="innerLeftMonth"
|
|
46
|
+
:year="innerLeftYear"
|
|
47
|
+
:multiple="true"
|
|
48
|
+
:allowedDates="allowedDates"
|
|
49
|
+
:modelValue="innerLeftValue.map(epochToPicker)"
|
|
50
|
+
@update:modelValue="onClickLeft"
|
|
51
|
+
@update:month="null"
|
|
52
|
+
@update:year="null"
|
|
53
|
+
/>
|
|
54
|
+
</v-locale-provider>
|
|
55
|
+
</FSCol>
|
|
56
|
+
<FSCol
|
|
57
|
+
:class="rightClasses"
|
|
58
|
+
:style="style"
|
|
59
|
+
>
|
|
60
|
+
<FSRow
|
|
61
|
+
class="fs-calendar-header"
|
|
62
|
+
align="center-center"
|
|
63
|
+
>
|
|
64
|
+
<div />
|
|
65
|
+
<FSSpan
|
|
66
|
+
class="fs-calendar-text"
|
|
67
|
+
font="text-h3"
|
|
68
|
+
>
|
|
69
|
+
{{ rightText }}
|
|
70
|
+
</FSSpan>
|
|
71
|
+
<FSButton
|
|
72
|
+
size="l"
|
|
73
|
+
variant="icon"
|
|
74
|
+
icon="mdi-chevron-right"
|
|
75
|
+
:color="ColorEnum.Dark"
|
|
76
|
+
@click="onClickNext"
|
|
77
|
+
/>
|
|
78
|
+
</FSRow>
|
|
79
|
+
<div
|
|
80
|
+
class="fs-calendar-divider"
|
|
81
|
+
:style="style"
|
|
82
|
+
/>
|
|
83
|
+
<v-locale-provider :locale="languageCode">
|
|
84
|
+
<v-date-picker-month
|
|
85
|
+
:month="innerRightMonth"
|
|
86
|
+
:year="innerRightYear"
|
|
87
|
+
:multiple="true"
|
|
88
|
+
:allowedDates="allowedDates"
|
|
89
|
+
:modelValue="innerRightValue.map(epochToPicker)"
|
|
90
|
+
@update:modelValue="onClickRight"
|
|
91
|
+
@update:month="null"
|
|
92
|
+
@update:year="null"
|
|
93
|
+
/>
|
|
94
|
+
</v-locale-provider>
|
|
95
|
+
</FSCol>
|
|
96
|
+
</FSRow>
|
|
97
|
+
</FSCol>
|
|
98
|
+
</template>
|
|
99
|
+
|
|
100
|
+
<script lang="ts">
|
|
101
|
+
import { computed, defineComponent, onMounted, PropType, ref } from "vue";
|
|
102
|
+
|
|
103
|
+
import { useTimeZone, useLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
|
|
104
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
105
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
106
|
+
|
|
107
|
+
import FSButton from "./FSButton.vue";
|
|
108
|
+
import FSSpan from "./FSSpan.vue";
|
|
109
|
+
import FSCol from "./FSCol.vue";
|
|
110
|
+
import FSRow from "./FSRow.vue";
|
|
111
|
+
|
|
112
|
+
export default defineComponent({
|
|
113
|
+
name: "FSCalendarTwin",
|
|
114
|
+
components: {
|
|
115
|
+
FSButton,
|
|
116
|
+
FSSpan,
|
|
117
|
+
FSCol,
|
|
118
|
+
FSRow
|
|
119
|
+
},
|
|
120
|
+
props: {
|
|
121
|
+
label: {
|
|
122
|
+
type: String,
|
|
123
|
+
required: false,
|
|
124
|
+
default: null
|
|
125
|
+
},
|
|
126
|
+
modelValue: {
|
|
127
|
+
type: Array as PropType<number[]>,
|
|
128
|
+
required: false,
|
|
129
|
+
default: null
|
|
130
|
+
},
|
|
131
|
+
color: {
|
|
132
|
+
type: String as PropType<ColorBase>,
|
|
133
|
+
required: false,
|
|
134
|
+
default: ColorEnum.Dark
|
|
135
|
+
},
|
|
136
|
+
limit: {
|
|
137
|
+
type: String as PropType<"none" | "past" | "future">,
|
|
138
|
+
required: false,
|
|
139
|
+
default: "none"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
emits: ["update:modelValue"],
|
|
143
|
+
setup(props, { emit }) {
|
|
144
|
+
const { epochToPicker, epochToPickerHeader, pickerToEpoch, todayToEpoch } = useTimeZone();
|
|
145
|
+
const { languageCode } = useLanguageCode();
|
|
146
|
+
|
|
147
|
+
const colors = computed(() => useColors().getColors(props.color));
|
|
148
|
+
const backgrounds = useColors().getColors(ColorEnum.Background);
|
|
149
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
150
|
+
|
|
151
|
+
const innerLeftMonth = ref(new Date().getMonth());
|
|
152
|
+
const innerLeftYear = ref(new Date().getFullYear());
|
|
153
|
+
|
|
154
|
+
const innerRightMonth = ref(new Date().getMonth());
|
|
155
|
+
const innerRightYear = ref(new Date().getFullYear());
|
|
156
|
+
|
|
157
|
+
const toggle = ref((props.modelValue?.length ?? 0) % 2);
|
|
158
|
+
|
|
159
|
+
onMounted((): void => {
|
|
160
|
+
if (!props.modelValue || !props.modelValue.length) {
|
|
161
|
+
innerLeftMonth.value = new Date().getMonth();
|
|
162
|
+
innerLeftYear.value = new Date().getFullYear();
|
|
163
|
+
if (innerLeftMonth.value < 11) {
|
|
164
|
+
innerRightMonth.value = innerLeftMonth.value + 1;
|
|
165
|
+
innerRightYear.value = innerLeftYear.value;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
innerRightMonth.value = 0;
|
|
169
|
+
innerRightYear.value = innerLeftYear.value + 1;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
innerLeftMonth.value = epochToPickerHeader(props.modelValue[0]).m;
|
|
174
|
+
innerLeftYear.value = epochToPickerHeader(props.modelValue[0]).y;
|
|
175
|
+
if (innerLeftMonth.value < 11) {
|
|
176
|
+
innerRightMonth.value = innerLeftMonth.value + 1;
|
|
177
|
+
innerRightYear.value = innerLeftYear.value;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
innerRightMonth.value = 0;
|
|
181
|
+
innerRightYear.value = innerLeftYear.value + 1;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const compare = (operator: "before" | "during" | "after", side: "left" | "right", date: { d: number, m: number, y: number }): boolean => {
|
|
187
|
+
switch (operator) {
|
|
188
|
+
case "before":
|
|
189
|
+
switch (side) {
|
|
190
|
+
case "left":
|
|
191
|
+
return innerLeftYear.value > date.y || (innerLeftYear.value === date.y && innerLeftMonth.value > date.m);
|
|
192
|
+
case "right":
|
|
193
|
+
return innerRightYear.value > date.y || (innerRightYear.value === date.y && innerRightMonth.value > date.m);
|
|
194
|
+
}
|
|
195
|
+
case "during":
|
|
196
|
+
switch (side) {
|
|
197
|
+
case "left":
|
|
198
|
+
return innerLeftYear.value === date.y && innerLeftMonth.value === date.m;
|
|
199
|
+
case "right":
|
|
200
|
+
return innerRightYear.value === date.y && innerRightMonth.value === date.m;
|
|
201
|
+
}
|
|
202
|
+
case "after":
|
|
203
|
+
switch (side) {
|
|
204
|
+
case "left":
|
|
205
|
+
return innerLeftYear.value < date.y || (innerLeftYear.value === date.y && innerLeftMonth.value < date.m);
|
|
206
|
+
case "right":
|
|
207
|
+
return innerRightYear.value < date.y || (innerRightYear.value === date.y && innerRightMonth.value < date.m);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
213
|
+
return {
|
|
214
|
+
"--fs-calendar-background-color" : backgrounds.base,
|
|
215
|
+
"--fs-calendar-hover-background-color" : colors.value.light,
|
|
216
|
+
"--fs-calendar-active-background-color": colors.value.base,
|
|
217
|
+
"--fs-calendar-border-color" : darks.base,
|
|
218
|
+
"--fs-calendar-hover-border-color" : colors.value.base,
|
|
219
|
+
"--fs-calendar-active-border-color" : colors.value.base,
|
|
220
|
+
"--fs-calendar-color" : darks.base,
|
|
221
|
+
"--fs-calendar-hover-color" : colors.value.base,
|
|
222
|
+
"--fs-calendar-active-color" : colors.value.light
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
const innerLeftValue = computed((): number[] => {
|
|
227
|
+
if (!props.modelValue || !props.modelValue.length) {
|
|
228
|
+
return [];
|
|
229
|
+
}
|
|
230
|
+
return props.modelValue.filter(value =>
|
|
231
|
+
compare("during", "left", epochToPickerHeader(value)) || compare("before", "left", epochToPickerHeader(value))
|
|
232
|
+
);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
const innerRightValue = computed((): number[] => {
|
|
236
|
+
if (!props.modelValue || !props.modelValue.length) {
|
|
237
|
+
return [];
|
|
238
|
+
}
|
|
239
|
+
return props.modelValue.filter(value =>
|
|
240
|
+
compare("during", "right", epochToPickerHeader(value)) || compare("after", "right", epochToPickerHeader(value))
|
|
241
|
+
);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const leftText = computed(() => {
|
|
245
|
+
const date = new Date(0);
|
|
246
|
+
date.setMonth(innerLeftMonth.value);
|
|
247
|
+
date.setFullYear(innerLeftYear.value);
|
|
248
|
+
return new Intl.DateTimeFormat(languageCode.value, { month: "long", year: "numeric" }).format(date);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
const rightText = computed(() => {
|
|
252
|
+
const date = new Date(0);
|
|
253
|
+
date.setMonth(innerRightMonth.value);
|
|
254
|
+
date.setFullYear(innerRightYear.value);
|
|
255
|
+
return new Intl.DateTimeFormat(languageCode.value, { month: "long", year: "numeric" }).format(date);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
const leftClasses = computed((): string[] => {
|
|
259
|
+
const classNames = ["fs-calendar-half", "fs-calendar-left"];
|
|
260
|
+
if (props.modelValue && props.modelValue.length > 1) {
|
|
261
|
+
const first = epochToPickerHeader(props.modelValue[0]);
|
|
262
|
+
const last = epochToPickerHeader(props.modelValue[1]);
|
|
263
|
+
if (compare("before", "left", first) && compare("after", "left", last)) {
|
|
264
|
+
classNames.push("fs-calendar-full");
|
|
265
|
+
}
|
|
266
|
+
else if (compare("during", "left", first) && compare("during", "left", last)) {
|
|
267
|
+
if (first.d !== last.d) {
|
|
268
|
+
classNames.push("fs-calendar-part");
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
else if (compare("during", "left", first)) {
|
|
272
|
+
classNames.push("fs-calendar-start");
|
|
273
|
+
}
|
|
274
|
+
else if (compare("during", "left", last)) {
|
|
275
|
+
classNames.push("fs-calendar-end");
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return classNames;
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
const rightClasses = computed((): string[] => {
|
|
282
|
+
const classNames = ["fs-calendar-half", "fs-calendar-right"];
|
|
283
|
+
if (props.modelValue && props.modelValue.length > 1) {
|
|
284
|
+
const first = epochToPickerHeader(props.modelValue[0]);
|
|
285
|
+
const last = epochToPickerHeader(props.modelValue[1]);
|
|
286
|
+
if (compare("before", "right", first) && compare("after", "right", last)) {
|
|
287
|
+
classNames.push("fs-calendar-full");
|
|
288
|
+
}
|
|
289
|
+
else if (compare("during", "right", first) && compare("during", "right", last)) {
|
|
290
|
+
if (first.d !== last.d) {
|
|
291
|
+
classNames.push("fs-calendar-part");
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
else if (compare("during", "right", first)) {
|
|
295
|
+
classNames.push("fs-calendar-start");
|
|
296
|
+
}
|
|
297
|
+
else if (compare("during", "right", last)) {
|
|
298
|
+
classNames.push("fs-calendar-end");
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return classNames;
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
const onClickPrevious = (): void => {
|
|
305
|
+
if (innerLeftMonth.value === 11) {
|
|
306
|
+
innerLeftMonth.value--;
|
|
307
|
+
innerRightMonth.value = 11;
|
|
308
|
+
innerRightYear.value--;
|
|
309
|
+
}
|
|
310
|
+
else if (innerLeftMonth.value === 0) {
|
|
311
|
+
innerLeftYear.value--;
|
|
312
|
+
innerLeftMonth.value = 11;
|
|
313
|
+
innerRightMonth.value--;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
innerLeftMonth.value--;
|
|
317
|
+
innerRightMonth.value--;
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const onClickNext = (): void => {
|
|
322
|
+
if (innerRightMonth.value === 11) {
|
|
323
|
+
innerRightMonth.value = 0;
|
|
324
|
+
innerRightYear.value++;
|
|
325
|
+
innerLeftMonth.value++;
|
|
326
|
+
}
|
|
327
|
+
else if (innerRightMonth.value === 0) {
|
|
328
|
+
innerRightMonth.value++;
|
|
329
|
+
innerLeftMonth.value = 0;
|
|
330
|
+
innerLeftYear.value++;
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
innerRightMonth.value++;
|
|
334
|
+
innerLeftMonth.value++;
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
const onClickLeft = (value: Date[]): void => {
|
|
339
|
+
const clicked = pickerToEpoch(value[value.length - 1]);
|
|
340
|
+
if (!props.modelValue || !props.modelValue.length) {
|
|
341
|
+
emit("update:modelValue", [clicked, clicked]);
|
|
342
|
+
}
|
|
343
|
+
else if (props.modelValue.length === 1) {
|
|
344
|
+
emit("update:modelValue", [props.modelValue[0], clicked].sort());
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
if (innerLeftValue.value.length === 0) {
|
|
348
|
+
emit("update:modelValue", [clicked, props.modelValue[1]]);
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
emit("update:modelValue", [clicked, props.modelValue[toggle.value]].sort());
|
|
352
|
+
toggle.value = (++toggle.value) % 2;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
const onClickRight = (value: Date[]): void => {
|
|
358
|
+
const clicked = pickerToEpoch(value[value.length - 1]);
|
|
359
|
+
if (!props.modelValue || !props.modelValue.length) {
|
|
360
|
+
emit("update:modelValue", [clicked, clicked]);
|
|
361
|
+
}
|
|
362
|
+
else if (props.modelValue.length === 1) {
|
|
363
|
+
emit("update:modelValue", [props.modelValue[0], clicked].sort());
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
if (innerRightValue.value.length === 0) {
|
|
367
|
+
emit("update:modelValue", [props.modelValue[0], clicked]);
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
emit("update:modelValue", [clicked, props.modelValue[toggle.value]].sort());
|
|
371
|
+
toggle.value = (++toggle.value) % 2;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
toggle.value = (++toggle.value) % 2;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
const allowedDates = (value: Date): boolean => {
|
|
378
|
+
const valueEpoch = pickerToEpoch(value);
|
|
379
|
+
switch (props.limit) {
|
|
380
|
+
case "past":
|
|
381
|
+
return valueEpoch <= todayToEpoch(true);
|
|
382
|
+
case "future":
|
|
383
|
+
return valueEpoch >= todayToEpoch(true);
|
|
384
|
+
default:
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
return {
|
|
390
|
+
ColorEnum,
|
|
391
|
+
languageCode,
|
|
392
|
+
style,
|
|
393
|
+
leftClasses,
|
|
394
|
+
leftText,
|
|
395
|
+
innerLeftMonth,
|
|
396
|
+
innerLeftYear,
|
|
397
|
+
innerLeftValue,
|
|
398
|
+
rightClasses,
|
|
399
|
+
rightText,
|
|
400
|
+
innerRightMonth,
|
|
401
|
+
innerRightYear,
|
|
402
|
+
innerRightValue,
|
|
403
|
+
epochToPicker,
|
|
404
|
+
onClickPrevious,
|
|
405
|
+
onClickNext,
|
|
406
|
+
onClickLeft,
|
|
407
|
+
onClickRight,
|
|
408
|
+
allowedDates
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
</script>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSContainer
|
|
3
|
+
class="fs-card"
|
|
4
|
+
:style="style"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>
|
|
7
|
+
<slot>
|
|
8
|
+
<FSCol
|
|
9
|
+
:gap="$props.gap"
|
|
10
|
+
>
|
|
11
|
+
<FSRow
|
|
12
|
+
v-if="$slots.header"
|
|
13
|
+
>
|
|
14
|
+
<slot name="header" />
|
|
15
|
+
</FSRow>
|
|
16
|
+
<FSRow
|
|
17
|
+
v-if="$slots.body"
|
|
18
|
+
>
|
|
19
|
+
<slot name="body" />
|
|
20
|
+
</FSRow>
|
|
21
|
+
<FSRow
|
|
22
|
+
v-if="$slots.footer"
|
|
23
|
+
>
|
|
24
|
+
<slot name="footer" />
|
|
25
|
+
</FSRow>
|
|
26
|
+
</FSCol>
|
|
27
|
+
</slot>
|
|
28
|
+
</FSContainer>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script lang="ts">
|
|
32
|
+
import { computed, defineComponent } from "vue";
|
|
33
|
+
|
|
34
|
+
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
35
|
+
|
|
36
|
+
import FSContainer from "./FSContainer.vue";
|
|
37
|
+
import FSCol from "./FSCol.vue";
|
|
38
|
+
import FSRow from "./FSRow.vue";
|
|
39
|
+
|
|
40
|
+
export default defineComponent({
|
|
41
|
+
name: "FSCard",
|
|
42
|
+
components: {
|
|
43
|
+
FSContainer,
|
|
44
|
+
FSCol,
|
|
45
|
+
FSRow
|
|
46
|
+
},
|
|
47
|
+
props: {
|
|
48
|
+
width: {
|
|
49
|
+
type: [String, Number],
|
|
50
|
+
required: false,
|
|
51
|
+
default: null
|
|
52
|
+
},
|
|
53
|
+
height: {
|
|
54
|
+
type: [String, Number],
|
|
55
|
+
required: false,
|
|
56
|
+
default: null
|
|
57
|
+
},
|
|
58
|
+
gap: {
|
|
59
|
+
type: [String, Number],
|
|
60
|
+
required: false,
|
|
61
|
+
default: 8
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
setup(props) {
|
|
65
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
66
|
+
return {
|
|
67
|
+
"--fs-card-width" : sizeToVar(props.width),
|
|
68
|
+
"--fs-card-height": sizeToVar(props.height)
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
style
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
</script>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-carousel
|
|
3
|
+
class="fs-carousel"
|
|
4
|
+
:hideDelimiters="true"
|
|
5
|
+
:style="style"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
>
|
|
8
|
+
<template v-for="(_, name) in slots" v-slot:[name]="slotData">
|
|
9
|
+
<slot :name="name" v-bind="slotData" />
|
|
10
|
+
</template>
|
|
11
|
+
<v-carousel-item
|
|
12
|
+
v-for="(component, index) in getChildren('default')"
|
|
13
|
+
:value="value(component, index)"
|
|
14
|
+
:key="index"
|
|
15
|
+
>
|
|
16
|
+
<component
|
|
17
|
+
:is="component"
|
|
18
|
+
/>
|
|
19
|
+
</v-carousel-item>
|
|
20
|
+
</v-carousel>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
import { computed, defineComponent, VNode } from "vue";
|
|
25
|
+
|
|
26
|
+
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
27
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
28
|
+
|
|
29
|
+
export default defineComponent({
|
|
30
|
+
name: "FSCarousel",
|
|
31
|
+
props: {
|
|
32
|
+
height: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
required: false,
|
|
35
|
+
default: "100%"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
setup(props) {
|
|
39
|
+
const { slots, getChildren } = useSlots();
|
|
40
|
+
delete slots.default;
|
|
41
|
+
|
|
42
|
+
const backgrounds = useColors().getColors(ColorEnum.Background);
|
|
43
|
+
|
|
44
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
45
|
+
return {
|
|
46
|
+
"--fs-carousel-height" : typeof(props.height) === "string" ? props.height : `${props.height}px`,
|
|
47
|
+
"--fs-carousel-background-color": backgrounds.base
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const value = (component: VNode, index: number): any => {
|
|
52
|
+
return component?.props?.value ?? index;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
getChildren,
|
|
57
|
+
slots,
|
|
58
|
+
style,
|
|
59
|
+
value
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
</script>
|