@dative-gpi/foundation-shared-components 0.0.8 → 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 +52 -39
- package/components/FSCalendarTwin.vue +120 -102
- package/components/FSCard.vue +35 -21
- package/components/FSCarousel.vue +63 -0
- package/components/FSCheckbox.vue +111 -103
- package/components/FSChip.vue +140 -0
- package/components/FSClock.vue +149 -15
- 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 -101
- package/components/FSRadio.vue +107 -109
- package/components/FSRadioGroup.vue +55 -57
- package/components/FSRemoveDialog.vue +123 -0
- package/components/FSRichTextField.vue +26 -33
- package/components/FSRow.vue +110 -104
- package/components/FSSearchField.vue +35 -27
- package/components/FSSelectField.vue +188 -0
- package/components/FSSlideGroup.vue +45 -49
- package/components/FSSlider.vue +31 -33
- 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 +32 -36
- package/components/FSTagGroup.vue +38 -45
- package/components/FSText.vue +74 -64
- package/components/FSTextArea.vue +187 -185
- package/components/FSTextField.vue +18 -20
- 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 +1 -1
- package/composables/useBreakpoints.ts +23 -4
- 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 +5 -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 -6
- package/styles/components/fs_calendar.scss +24 -1
- package/styles/components/fs_card.scss +2 -5
- 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 +19 -3
- 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_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 +29 -9
- 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 +0 -11
- 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 +21 -1
- 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 -1
- package/utils/levenshtein.ts +97 -0
- package/utils/sort.ts +9 -0
- package/components/FSDatePicker.vue +0 -226
- package/composables/useDates.ts +0 -39
- package/models/FSTags.ts +0 -8
- package/models/FSTextFields.ts +0 -23
- package/styles/components/fs_date_picker.scss +0 -0
- /package/utils/{FSRichTextField.ts → lexical.ts} +0 -0
package/components/FSButton.vue
CHANGED
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-btn
|
|
3
|
-
v-if="!['icon'].includes($props.variant
|
|
3
|
+
v-if="!['icon'].includes($props.variant)"
|
|
4
4
|
:ripple="false"
|
|
5
5
|
:style="style"
|
|
6
6
|
:class="classes"
|
|
7
|
-
|
|
7
|
+
:disabled="!$props.editable"
|
|
8
8
|
v-bind="$attrs"
|
|
9
9
|
>
|
|
10
|
-
<FSRow
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
<FSRow
|
|
11
|
+
align="center-center"
|
|
12
|
+
width="hug"
|
|
13
|
+
:wrap="false"
|
|
14
|
+
>
|
|
15
|
+
<slot name="prepend" v-bind="{ color: $props.color, colors }">
|
|
16
|
+
<FSIcon
|
|
17
|
+
v-if="$props.prependIcon"
|
|
18
|
+
size="l"
|
|
19
|
+
>
|
|
13
20
|
{{ $props.prependIcon }}
|
|
14
21
|
</FSIcon>
|
|
15
22
|
</slot>
|
|
16
|
-
<slot
|
|
17
|
-
<FSSpan
|
|
23
|
+
<slot v-bind="{ color: $props.color, colors }">
|
|
24
|
+
<FSSpan
|
|
25
|
+
v-if="$props.label"
|
|
26
|
+
>
|
|
18
27
|
{{ $props.label }}
|
|
19
28
|
</FSSpan>
|
|
20
29
|
</slot>
|
|
21
|
-
<slot name="append" v-bind="{ color, colors }">
|
|
22
|
-
<FSIcon
|
|
30
|
+
<slot name="append" v-bind="{ color: $props.color, colors }">
|
|
31
|
+
<FSIcon
|
|
32
|
+
v-if="$props.appendIcon"
|
|
33
|
+
size="l"
|
|
34
|
+
>
|
|
23
35
|
{{ $props.appendIcon }}
|
|
24
36
|
</FSIcon>
|
|
25
37
|
</slot>
|
|
@@ -27,23 +39,31 @@
|
|
|
27
39
|
</v-btn>
|
|
28
40
|
<FSRow
|
|
29
41
|
v-else-if="$props.icon"
|
|
42
|
+
align="center-center"
|
|
30
43
|
width="hug"
|
|
31
44
|
:style="style"
|
|
32
45
|
:class="classes"
|
|
33
|
-
@click="onClick"
|
|
34
46
|
v-bind="$attrs"
|
|
35
47
|
>
|
|
36
|
-
<FSIcon
|
|
48
|
+
<FSIcon
|
|
49
|
+
size="l"
|
|
50
|
+
>
|
|
37
51
|
{{ $props.icon }}
|
|
38
52
|
</FSIcon>
|
|
53
|
+
<FSSpan
|
|
54
|
+
v-if="$props.label"
|
|
55
|
+
font="text-overline"
|
|
56
|
+
>
|
|
57
|
+
{{ $props.label }}
|
|
58
|
+
</FSSpan>
|
|
39
59
|
</FSRow>
|
|
40
60
|
</template>
|
|
41
61
|
|
|
42
62
|
<script lang="ts">
|
|
43
|
-
import { computed, defineComponent, PropType
|
|
63
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
44
64
|
|
|
45
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
46
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/
|
|
65
|
+
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
66
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
47
67
|
|
|
48
68
|
import FSSpan from "./FSSpan.vue";
|
|
49
69
|
import FSIcon from "./FSIcon.vue";
|
|
@@ -54,143 +74,138 @@ export default defineComponent({
|
|
|
54
74
|
components: {
|
|
55
75
|
FSSpan,
|
|
56
76
|
FSIcon,
|
|
57
|
-
FSRow
|
|
77
|
+
FSRow
|
|
58
78
|
},
|
|
59
79
|
props: {
|
|
60
80
|
prependIcon: {
|
|
61
81
|
type: String,
|
|
62
82
|
required: false,
|
|
63
|
-
default: null
|
|
83
|
+
default: null
|
|
64
84
|
},
|
|
65
85
|
label: {
|
|
66
86
|
type: String,
|
|
67
87
|
required: false,
|
|
68
|
-
default: null
|
|
88
|
+
default: null
|
|
69
89
|
},
|
|
70
90
|
appendIcon: {
|
|
71
91
|
type: String,
|
|
72
92
|
required: false,
|
|
73
|
-
default: null
|
|
93
|
+
default: null
|
|
74
94
|
},
|
|
75
95
|
icon: {
|
|
76
96
|
type: String,
|
|
77
97
|
required: false,
|
|
78
|
-
default: null
|
|
98
|
+
default: null
|
|
79
99
|
},
|
|
80
100
|
variant: {
|
|
81
101
|
type: String as PropType<"standard" | "full" | "icon">,
|
|
82
102
|
required: false,
|
|
83
|
-
default: "standard"
|
|
103
|
+
default: "standard"
|
|
84
104
|
},
|
|
85
105
|
color: {
|
|
86
106
|
type: String as PropType<ColorBase>,
|
|
87
107
|
required: false,
|
|
88
|
-
default:
|
|
108
|
+
default: ColorEnum.Primary
|
|
89
109
|
},
|
|
90
|
-
|
|
110
|
+
fullWidth: {
|
|
91
111
|
type: Boolean,
|
|
92
112
|
required: false,
|
|
93
|
-
default:
|
|
113
|
+
default: false
|
|
94
114
|
},
|
|
115
|
+
editable: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
required: false,
|
|
118
|
+
default: true
|
|
119
|
+
}
|
|
95
120
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
121
|
+
setup(props) {
|
|
122
|
+
const textColors = computed(() => useColors().getContrasts(props.color));
|
|
123
|
+
const colors = computed(() => useColors().getColors(props.color));
|
|
124
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
99
125
|
|
|
100
|
-
const
|
|
101
|
-
const colors = useColors().getColors(color.value);
|
|
102
|
-
const slots = useSlots();
|
|
103
|
-
|
|
104
|
-
const lights = useColors().getColors(ColorBase.Light);
|
|
126
|
+
const { slots } = useSlots();
|
|
105
127
|
|
|
106
128
|
const isEmpty = computed(() => {
|
|
107
|
-
return !slots.default && !label
|
|
129
|
+
return !slots.default && !props.label;
|
|
108
130
|
});
|
|
109
131
|
|
|
110
|
-
const style = computed(
|
|
111
|
-
()
|
|
112
|
-
|
|
113
|
-
switch (variant.value) {
|
|
114
|
-
case "standard":
|
|
115
|
-
case "full":
|
|
116
|
-
return {
|
|
117
|
-
"--fs-button-padding": !isEmpty.value ? "0 16px" : "0",
|
|
118
|
-
"--fs-button-background-color": lights.base,
|
|
119
|
-
"--fs-button-border-color": lights.dark,
|
|
120
|
-
"--fs-button-color": lights.dark,
|
|
121
|
-
};
|
|
122
|
-
case "icon":
|
|
123
|
-
return {
|
|
124
|
-
"--fs-button-color": lights.dark,
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
switch (variant.value) {
|
|
132
|
+
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
|
|
133
|
+
if (!props.editable) {
|
|
134
|
+
switch (props.variant) {
|
|
129
135
|
case "standard":
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
136
|
+
case "full": return {
|
|
137
|
+
"--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
|
|
138
|
+
"--fs-button-background-color": lights.base,
|
|
139
|
+
"--fs-button-border-color" : lights.dark,
|
|
140
|
+
"--fs-button-color" : lights.dark,
|
|
141
|
+
};
|
|
142
|
+
case "icon": return {
|
|
143
|
+
"--fs-button-color": lights.dark,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
switch (props.variant) {
|
|
148
|
+
case "standard": return {
|
|
149
|
+
"--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
|
|
150
|
+
"--fs-button-background-color" : colors.value.light,
|
|
151
|
+
"--fs-button-border-color" : colors.value.base,
|
|
152
|
+
"--fs-button-color" : textColors.value.base,
|
|
153
|
+
"--fs-button-hover-background-color" : colors.value.base,
|
|
154
|
+
"--fs-button-hover-border-color" : colors.value.base,
|
|
155
|
+
"--fs-button-hover-color" : textColors.value.light,
|
|
156
|
+
"--fs-button-active-background-color": colors.value.dark,
|
|
157
|
+
"--fs-button-active-border-color" : colors.value.dark,
|
|
158
|
+
"--fs-button-active-color" : textColors.value.light,
|
|
159
|
+
};
|
|
160
|
+
case "full": return {
|
|
161
|
+
"--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
|
|
162
|
+
"--fs-button-background-color" : colors.value.base,
|
|
163
|
+
"--fs-button-border-color" : colors.value.base,
|
|
164
|
+
"--fs-button-color" : textColors.value.light,
|
|
165
|
+
"--fs-button-hover-background-color" : colors.value.base,
|
|
166
|
+
"--fs-button-hover-border-color" : colors.value.base,
|
|
167
|
+
"--fs-button-hover-color" : textColors.value.light,
|
|
168
|
+
"--fs-button-active-background-color": colors.value.dark,
|
|
169
|
+
"--fs-button-active-border-color" : colors.value.dark,
|
|
170
|
+
"--fs-button-active-color" : textColors.value.light,
|
|
171
|
+
};
|
|
172
|
+
case "icon": switch (props.color) {
|
|
173
|
+
case ColorEnum.Dark: return {
|
|
174
|
+
"--fs-button-color" : colors.value.light,
|
|
175
|
+
"--fs-button-hover-color": colors.value.dark,
|
|
176
|
+
};
|
|
177
|
+
default: return {
|
|
178
|
+
"--fs-button-color" : colors.value.base,
|
|
179
|
+
"--fs-button-hover-color": colors.value.dark,
|
|
180
|
+
};
|
|
160
181
|
}
|
|
161
182
|
}
|
|
162
|
-
);
|
|
183
|
+
});
|
|
163
184
|
|
|
164
185
|
const classes = computed((): string[] => {
|
|
165
|
-
const
|
|
166
|
-
if (!editable
|
|
167
|
-
|
|
186
|
+
const classNames: string[] = [];
|
|
187
|
+
if (!props.editable) {
|
|
188
|
+
classNames.push("fs-button--disabled");
|
|
168
189
|
}
|
|
169
|
-
|
|
190
|
+
if (props.fullWidth) {
|
|
191
|
+
classNames.push("fs-button-full-width");
|
|
192
|
+
}
|
|
193
|
+
switch (props.variant) {
|
|
170
194
|
case "icon":
|
|
171
|
-
|
|
195
|
+
classNames.push("fs-button-icon");
|
|
172
196
|
break;
|
|
173
197
|
default:
|
|
174
|
-
|
|
198
|
+
classNames.push("fs-button");
|
|
175
199
|
break;
|
|
176
200
|
}
|
|
177
|
-
return
|
|
201
|
+
return classNames;
|
|
178
202
|
});
|
|
179
203
|
|
|
180
|
-
const onClick = () => {
|
|
181
|
-
if (!editable.value) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
emit("click");
|
|
185
|
-
};
|
|
186
|
-
|
|
187
204
|
return {
|
|
188
205
|
colors,
|
|
189
|
-
color,
|
|
190
206
|
style,
|
|
191
|
-
classes
|
|
192
|
-
onClick,
|
|
207
|
+
classes
|
|
193
208
|
};
|
|
194
|
-
}
|
|
209
|
+
}
|
|
195
210
|
});
|
|
196
|
-
</script>
|
|
211
|
+
</script>
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
size="l"
|
|
22
22
|
variant="icon"
|
|
23
23
|
icon="mdi-chevron-left"
|
|
24
|
+
:color="ColorEnum.Dark"
|
|
24
25
|
@click="onClickPrevious"
|
|
25
26
|
/>
|
|
26
27
|
<FSSpan
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
size="l"
|
|
34
35
|
variant="icon"
|
|
35
36
|
icon="mdi-chevron-right"
|
|
37
|
+
:color="ColorEnum.Dark"
|
|
36
38
|
@click="onClickNext"
|
|
37
39
|
/>
|
|
38
40
|
</FSRow>
|
|
@@ -46,8 +48,9 @@
|
|
|
46
48
|
:year="innerYear"
|
|
47
49
|
:multiple="false"
|
|
48
50
|
:showAdjacentMonths="true"
|
|
49
|
-
:
|
|
50
|
-
|
|
51
|
+
:allowedDates="allowedDates"
|
|
52
|
+
:modelValue="epochToPicker($props.modelValue)"
|
|
53
|
+
@update:modelValue="(value) => $emit('update:modelValue', pickerToEpoch(value[0]))"
|
|
51
54
|
@update:month="null"
|
|
52
55
|
@update:year="null"
|
|
53
56
|
/>
|
|
@@ -57,12 +60,11 @@
|
|
|
57
60
|
</template>
|
|
58
61
|
|
|
59
62
|
<script lang="ts">
|
|
60
|
-
import { computed, defineComponent, PropType, ref
|
|
61
|
-
import { useDate as useAdapter } from "vuetify/lib/composables/date/index.mjs";
|
|
63
|
+
import { computed, defineComponent, PropType, ref } from "vue";
|
|
62
64
|
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
65
|
+
import { useTimeZone, useLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
|
|
66
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
67
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
66
68
|
|
|
67
69
|
import FSButton from "./FSButton.vue";
|
|
68
70
|
import FSSpan from "./FSSpan.vue";
|
|
@@ -84,56 +86,52 @@ export default defineComponent({
|
|
|
84
86
|
default: null
|
|
85
87
|
},
|
|
86
88
|
modelValue: {
|
|
87
|
-
type:
|
|
89
|
+
type: Number,
|
|
88
90
|
required: false,
|
|
89
91
|
default: null
|
|
90
92
|
},
|
|
91
93
|
color: {
|
|
92
94
|
type: String as PropType<ColorBase>,
|
|
93
95
|
required: false,
|
|
94
|
-
default:
|
|
96
|
+
default: ColorEnum.Primary
|
|
95
97
|
},
|
|
96
|
-
|
|
97
|
-
type: String as PropType<
|
|
98
|
+
limit: {
|
|
99
|
+
type: String as PropType<"none" | "past" | "future">,
|
|
98
100
|
required: false,
|
|
99
|
-
default:
|
|
101
|
+
default: "none"
|
|
100
102
|
}
|
|
101
103
|
},
|
|
104
|
+
emits: ["update:modelValue"],
|
|
102
105
|
setup(props) {
|
|
103
|
-
const {
|
|
104
|
-
|
|
105
|
-
const languageCode = useLanguageCode().languageCode;
|
|
106
|
-
const datesTools = useDates();
|
|
107
|
-
const adapter = useAdapter();
|
|
108
|
-
|
|
109
|
-
const colors = useColors().getColors(color.value);
|
|
110
|
-
const buttonColors = useColors().getColors(buttonColor.value);
|
|
106
|
+
const { epochToPicker, pickerToEpoch, todayToEpoch } = useTimeZone();
|
|
107
|
+
const { languageCode } = useLanguageCode();
|
|
111
108
|
|
|
112
|
-
const
|
|
109
|
+
const colors = computed(() => useColors().getColors(props.color));
|
|
110
|
+
const backgrounds = useColors().getColors(ColorEnum.Background);
|
|
111
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
113
112
|
|
|
114
|
-
const innerMonth = ref(modelValue
|
|
115
|
-
const innerYear = ref(modelValue
|
|
113
|
+
const innerMonth = ref(props.modelValue ? epochToPicker(props.modelValue).getMonth() : new Date().getMonth());
|
|
114
|
+
const innerYear = ref(props.modelValue ? epochToPicker(props.modelValue).getFullYear() : new Date().getFullYear());
|
|
116
115
|
|
|
117
116
|
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
118
117
|
return {
|
|
119
118
|
"--fs-calendar-background-color" : backgrounds.base,
|
|
120
|
-
"--fs-calendar-hover-background-color" :
|
|
121
|
-
"--fs-calendar-active-background-color":
|
|
122
|
-
"--fs-calendar-border-color" :
|
|
123
|
-
"--fs-calendar-hover-border-color" :
|
|
124
|
-
"--fs-calendar-active-border-color" :
|
|
125
|
-
"--fs-calendar-color" :
|
|
126
|
-
"--fs-calendar-hover-color" :
|
|
127
|
-
"--fs-calendar-active-color" :
|
|
119
|
+
"--fs-calendar-hover-background-color" : colors.value.light,
|
|
120
|
+
"--fs-calendar-active-background-color": colors.value.base,
|
|
121
|
+
"--fs-calendar-border-color" : darks.base,
|
|
122
|
+
"--fs-calendar-hover-border-color" : colors.value.base,
|
|
123
|
+
"--fs-calendar-active-border-color" : colors.value.base,
|
|
124
|
+
"--fs-calendar-color" : darks.base,
|
|
125
|
+
"--fs-calendar-hover-color" : colors.value.base,
|
|
126
|
+
"--fs-calendar-active-color" : colors.value.light
|
|
128
127
|
};
|
|
129
128
|
});
|
|
130
129
|
|
|
131
|
-
const text = computed(() => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
);
|
|
130
|
+
const text = computed((): string => {
|
|
131
|
+
const date = new Date(0);
|
|
132
|
+
date.setMonth(innerMonth.value);
|
|
133
|
+
date.setFullYear(innerYear.value);
|
|
134
|
+
return new Intl.DateTimeFormat(languageCode.value, { month: "long", year: "numeric" }).format(date);
|
|
137
135
|
});
|
|
138
136
|
|
|
139
137
|
const onClickPrevious = (): void => {
|
|
@@ -156,15 +154,30 @@ export default defineComponent({
|
|
|
156
154
|
}
|
|
157
155
|
};
|
|
158
156
|
|
|
157
|
+
const allowedDates = (value: Date): boolean => {
|
|
158
|
+
const valueEpoch = pickerToEpoch(value);
|
|
159
|
+
switch (props.limit) {
|
|
160
|
+
case "past":
|
|
161
|
+
return valueEpoch <= todayToEpoch(true);
|
|
162
|
+
case "future":
|
|
163
|
+
return valueEpoch >= todayToEpoch(true);
|
|
164
|
+
default:
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
159
169
|
return {
|
|
170
|
+
ColorEnum,
|
|
160
171
|
languageCode,
|
|
161
172
|
style,
|
|
162
173
|
text,
|
|
163
174
|
innerMonth,
|
|
164
175
|
innerYear,
|
|
165
|
-
|
|
176
|
+
epochToPicker,
|
|
177
|
+
pickerToEpoch,
|
|
166
178
|
onClickPrevious,
|
|
167
|
-
onClickNext
|
|
179
|
+
onClickNext,
|
|
180
|
+
allowedDates
|
|
168
181
|
};
|
|
169
182
|
}
|
|
170
183
|
});
|