@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
|
@@ -1,44 +1,49 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
2
|
+
<FSCol
|
|
3
|
+
width="hug"
|
|
4
|
+
>
|
|
5
|
+
<FSRow
|
|
6
|
+
width="hug"
|
|
7
|
+
align="center-left"
|
|
8
|
+
>
|
|
9
|
+
<FSIcon
|
|
10
|
+
class="fs-checkbox"
|
|
11
|
+
size="l"
|
|
12
|
+
:style="style"
|
|
13
|
+
@click.stop="onToggle"
|
|
14
|
+
>
|
|
15
|
+
{{ icon }}
|
|
16
|
+
</FSIcon>
|
|
17
|
+
<slot>
|
|
18
|
+
<FSSpan
|
|
19
|
+
v-if="$props.label"
|
|
20
|
+
class="fs-checkbox-label"
|
|
21
|
+
:style="style"
|
|
22
|
+
:font="font"
|
|
23
|
+
@click.stop="onToggle"
|
|
24
|
+
>
|
|
25
|
+
{{ $props.label }}
|
|
26
|
+
</FSSpan>
|
|
27
|
+
</slot>
|
|
28
|
+
</FSRow>
|
|
29
|
+
<slot name="description">
|
|
30
|
+
<FSSpan
|
|
31
|
+
v-if="$props.description"
|
|
32
|
+
class="fs-checkbox-description"
|
|
33
|
+
font="text-underline"
|
|
34
|
+
:style="style"
|
|
35
|
+
>
|
|
36
|
+
{{ $props.description }}
|
|
37
|
+
</FSSpan>
|
|
38
|
+
</slot>
|
|
39
|
+
</FSCol>
|
|
35
40
|
</template>
|
|
36
41
|
|
|
37
42
|
<script lang="ts">
|
|
38
|
-
import { computed, defineComponent, PropType
|
|
43
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
39
44
|
|
|
45
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
40
46
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
41
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
42
47
|
|
|
43
48
|
import FSIcon from "./FSIcon.vue";
|
|
44
49
|
import FSSpan from "./FSSpan.vue";
|
|
@@ -46,81 +51,83 @@ import FSRow from "./FSRow.vue";
|
|
|
46
51
|
import FSCol from "./FSCol.vue";
|
|
47
52
|
|
|
48
53
|
export default defineComponent({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
name: "FSCheckbox",
|
|
55
|
+
components: {
|
|
56
|
+
FSIcon,
|
|
57
|
+
FSSpan,
|
|
58
|
+
FSRow,
|
|
59
|
+
FSCol
|
|
60
|
+
},
|
|
61
|
+
props: {
|
|
62
|
+
label: {
|
|
63
|
+
type: String,
|
|
64
|
+
required: false,
|
|
65
|
+
default: null
|
|
55
66
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
default: null
|
|
61
|
-
},
|
|
62
|
-
description: {
|
|
63
|
-
type: String,
|
|
64
|
-
required: false,
|
|
65
|
-
default: null
|
|
66
|
-
},
|
|
67
|
-
value: {
|
|
68
|
-
type: Boolean,
|
|
69
|
-
required: false,
|
|
70
|
-
default: false
|
|
71
|
-
},
|
|
72
|
-
color: {
|
|
73
|
-
type: String as PropType<ColorBase>,
|
|
74
|
-
required: false,
|
|
75
|
-
default: ColorBase.Primary
|
|
76
|
-
},
|
|
77
|
-
editable: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
required: false,
|
|
80
|
-
default: true
|
|
81
|
-
}
|
|
67
|
+
description: {
|
|
68
|
+
type: String,
|
|
69
|
+
required: false,
|
|
70
|
+
default: null
|
|
82
71
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
72
|
+
modelValue: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
required: false,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
color: {
|
|
78
|
+
type: String as PropType<ColorBase>,
|
|
79
|
+
required: false,
|
|
80
|
+
default: ColorEnum.Primary
|
|
81
|
+
},
|
|
82
|
+
indeterminate: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
required: false,
|
|
85
|
+
default: false
|
|
86
|
+
},
|
|
87
|
+
editable: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
required: false,
|
|
90
|
+
default: true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
emits: ["update:modelValue"],
|
|
94
|
+
setup(props, { emit }) {
|
|
95
|
+
const colors = computed(() => useColors().getColors(props.color));
|
|
96
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
97
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
91
98
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
100
|
+
if (!props.editable) {
|
|
101
|
+
return {
|
|
102
|
+
"--fs-checkbox-cursor" : "default",
|
|
103
|
+
"--fs-checkbox-checkbox-color": lights.dark,
|
|
104
|
+
"--fs-checkbox-color" : lights.dark
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
"--fs-checkbox-cursor" : "pointer",
|
|
109
|
+
"--fs-checkbox-checkbox-color": (props.modelValue || props.indeterminate) ? colors.value.base : darks.base,
|
|
110
|
+
"--fs-checkbox-color" : darks.base
|
|
111
|
+
}
|
|
112
|
+
});
|
|
106
113
|
|
|
107
|
-
|
|
114
|
+
const icon = computed((): string => props.modelValue ? "mdi-checkbox-marked" : props.indeterminate ? "mdi-minus-box" : "mdi-checkbox-blank-outline");
|
|
108
115
|
|
|
109
|
-
|
|
116
|
+
const font = computed((): string => props.modelValue ? "text-button" : "text-body");
|
|
110
117
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
const onToggle = (): void => {
|
|
119
|
+
if (!props.editable) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
emit("update:modelValue", !props.modelValue);
|
|
123
|
+
};
|
|
117
124
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
return {
|
|
126
|
+
style,
|
|
127
|
+
icon,
|
|
128
|
+
font,
|
|
129
|
+
onToggle
|
|
130
|
+
};
|
|
131
|
+
}
|
|
125
132
|
});
|
|
126
133
|
</script>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSRow
|
|
3
|
+
width="hug"
|
|
4
|
+
align="center-left"
|
|
5
|
+
:class="classes"
|
|
6
|
+
:style="style"
|
|
7
|
+
:wrap="false"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
>
|
|
10
|
+
<slot name="prepend" v-bind="{ color: $props.color, colors }">
|
|
11
|
+
<FSIcon
|
|
12
|
+
v-if="$props.prependIcon"
|
|
13
|
+
size="s"
|
|
14
|
+
>
|
|
15
|
+
{{ $props.prependIcon }}
|
|
16
|
+
</FSIcon>
|
|
17
|
+
</slot>
|
|
18
|
+
<slot v-bind="{ color: $props.color, colors }">
|
|
19
|
+
<FSSpan
|
|
20
|
+
v-if="$props.label"
|
|
21
|
+
font="text-overline"
|
|
22
|
+
class="fs-chip-label"
|
|
23
|
+
>
|
|
24
|
+
{{ $props.label }}
|
|
25
|
+
</FSSpan>
|
|
26
|
+
</slot>
|
|
27
|
+
<slot name="append" v-bind="{ color: $props.color, colors }">
|
|
28
|
+
<FSIcon
|
|
29
|
+
v-if="$props.appendIcon"
|
|
30
|
+
size="s"
|
|
31
|
+
>
|
|
32
|
+
{{ $props.appendIcon }}
|
|
33
|
+
</FSIcon>
|
|
34
|
+
</slot>
|
|
35
|
+
</FSRow>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
40
|
+
|
|
41
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
42
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
43
|
+
|
|
44
|
+
import FSIcon from "./FSIcon.vue";
|
|
45
|
+
import FSSpan from "./FSSpan.vue";
|
|
46
|
+
import FSRow from "./FSRow.vue";
|
|
47
|
+
|
|
48
|
+
export default defineComponent({
|
|
49
|
+
name: "FSChip",
|
|
50
|
+
components: {
|
|
51
|
+
FSIcon,
|
|
52
|
+
FSSpan,
|
|
53
|
+
FSRow
|
|
54
|
+
},
|
|
55
|
+
props: {
|
|
56
|
+
prependIcon: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: false,
|
|
59
|
+
default: null
|
|
60
|
+
},
|
|
61
|
+
label: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: false,
|
|
64
|
+
default: null
|
|
65
|
+
},
|
|
66
|
+
appendIcon: {
|
|
67
|
+
type: String,
|
|
68
|
+
required: false,
|
|
69
|
+
default: null
|
|
70
|
+
},
|
|
71
|
+
variant: {
|
|
72
|
+
type: String as PropType<"standard" | "full">,
|
|
73
|
+
required: false,
|
|
74
|
+
default: "full"
|
|
75
|
+
},
|
|
76
|
+
color: {
|
|
77
|
+
type: String as PropType<ColorBase>,
|
|
78
|
+
required: false,
|
|
79
|
+
default: ColorEnum.Primary
|
|
80
|
+
},
|
|
81
|
+
editable: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
required: false,
|
|
84
|
+
default: false
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
setup(props) {
|
|
88
|
+
const colors = computed(() => useColors().getColors(props.color));
|
|
89
|
+
const backgrounds = useColors().getColors(ColorEnum.Background);
|
|
90
|
+
|
|
91
|
+
const textColors = computed(() => {
|
|
92
|
+
switch (props.variant) {
|
|
93
|
+
case "standard": return colors.value;
|
|
94
|
+
case "full": return useColors().getContrasts(props.color);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
|
|
99
|
+
switch (props.variant) {
|
|
100
|
+
case "standard": return {
|
|
101
|
+
"--fs-chip-background-color" : backgrounds.base,
|
|
102
|
+
"--fs-chip-border-color" : colors.value.base,
|
|
103
|
+
"--fs-chip-color" : textColors.value.base,
|
|
104
|
+
"--fs-chip-hover-background-color" : backgrounds.base,
|
|
105
|
+
"--fs-chip-hover-border-color" : colors.value.base,
|
|
106
|
+
"--fs-chip-hover-color" : textColors.value.base,
|
|
107
|
+
"--fs-chip-active-background-color": backgrounds.base,
|
|
108
|
+
"--fs-chip-active-border-color" : colors.value.dark,
|
|
109
|
+
"--fs-chip-active-color" : textColors.value.dark
|
|
110
|
+
};
|
|
111
|
+
case "full": return {
|
|
112
|
+
"--fs-chip-background-color" : colors.value.base,
|
|
113
|
+
"--fs-chip-border-color" : colors.value.base,
|
|
114
|
+
"--fs-chip-color" : textColors.value.light,
|
|
115
|
+
"--fs-chip-hover-background-color" : colors.value.base,
|
|
116
|
+
"--fs-chip-hover-border-color" : colors.value.base,
|
|
117
|
+
"--fs-chip-hover-color" : textColors.value.light,
|
|
118
|
+
"--fs-chip-active-background-color": colors.value.dark,
|
|
119
|
+
"--fs-chip-active-border-color" : colors.value.dark,
|
|
120
|
+
"--fs-chip-active-color" : textColors.value.light
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const classes = computed((): string[] => {
|
|
126
|
+
const classNames: string[] = ["fs-chip"];
|
|
127
|
+
if (props.editable) {
|
|
128
|
+
classNames.push("fs-chip-editable");
|
|
129
|
+
}
|
|
130
|
+
return classNames;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
colors,
|
|
135
|
+
style,
|
|
136
|
+
classes
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
</script>
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol
|
|
3
|
+
width="fill"
|
|
4
|
+
gap="16px"
|
|
5
|
+
>
|
|
6
|
+
<FSRow
|
|
7
|
+
align="center-center"
|
|
8
|
+
>
|
|
9
|
+
<FSTextField
|
|
10
|
+
v-if="$props.reminder"
|
|
11
|
+
:readonly="true"
|
|
12
|
+
:hideHeader="true"
|
|
13
|
+
:modelValue="epochToLongDateFormat($props.date)"
|
|
14
|
+
/>
|
|
15
|
+
<v-text-field
|
|
16
|
+
class="fs-clock-field"
|
|
17
|
+
variant="outlined"
|
|
18
|
+
type="number"
|
|
19
|
+
hide-details
|
|
20
|
+
:style="style"
|
|
21
|
+
:readonly="!$props.editable"
|
|
22
|
+
:modelValue="innerHours.toString().padStart(2, '0')"
|
|
23
|
+
@update:modelValue="onChangeHours"
|
|
24
|
+
/>
|
|
25
|
+
:
|
|
26
|
+
<v-text-field
|
|
27
|
+
class="fs-clock-field"
|
|
28
|
+
variant="outlined"
|
|
29
|
+
type="number"
|
|
30
|
+
hide-details
|
|
31
|
+
:style="style"
|
|
32
|
+
:readonly="!$props.editable"
|
|
33
|
+
:modelValue="innerMinutes.toString().padStart(2, '0')"
|
|
34
|
+
@update:modelValue="onChangeMinutes"
|
|
35
|
+
/>
|
|
36
|
+
</FSRow>
|
|
37
|
+
<FSCol>
|
|
38
|
+
<FSSpan
|
|
39
|
+
font="text-overline"
|
|
40
|
+
>
|
|
41
|
+
{{ $tr("ui.clock.hours", "Hours") }}
|
|
42
|
+
</FSSpan>
|
|
43
|
+
<FSSlider
|
|
44
|
+
:readonly="!$props.editable"
|
|
45
|
+
:color="$props.color"
|
|
46
|
+
:step="1"
|
|
47
|
+
:max="23"
|
|
48
|
+
:min="0"
|
|
49
|
+
v-model="innerHours"
|
|
50
|
+
/>
|
|
51
|
+
</FSCol>
|
|
52
|
+
<FSCol>
|
|
53
|
+
<FSSpan
|
|
54
|
+
font="text-overline"
|
|
55
|
+
>
|
|
56
|
+
{{ $tr("ui.clock.minutes", "Minutes") }}
|
|
57
|
+
</FSSpan>
|
|
58
|
+
<FSSlider
|
|
59
|
+
:readonly="!$props.editable"
|
|
60
|
+
:color="$props.color"
|
|
61
|
+
:step="1"
|
|
62
|
+
:max="59"
|
|
63
|
+
:min="0"
|
|
64
|
+
v-model="innerMinutes"
|
|
65
|
+
/>
|
|
66
|
+
</FSCol>
|
|
67
|
+
</FSCol>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script lang="ts">
|
|
71
|
+
import { computed, defineComponent, PropType, ref, watch } from "vue";
|
|
72
|
+
|
|
73
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
74
|
+
import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
75
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
76
|
+
|
|
77
|
+
import FSTextField from "./FSTextField.vue";
|
|
78
|
+
import FSSlider from "./FSSlider.vue";
|
|
79
|
+
import FSCol from "./FSCol.vue";
|
|
80
|
+
import FSRow from "./FSRow.vue";
|
|
81
|
+
|
|
82
|
+
export default defineComponent({
|
|
83
|
+
name: "FSClock",
|
|
84
|
+
components: {
|
|
85
|
+
FSTextField,
|
|
86
|
+
FSSlider,
|
|
87
|
+
FSCol,
|
|
88
|
+
FSRow
|
|
89
|
+
},
|
|
90
|
+
props: {
|
|
91
|
+
modelValue: {
|
|
92
|
+
type: Number,
|
|
93
|
+
required: false,
|
|
94
|
+
default: null
|
|
95
|
+
},
|
|
96
|
+
color: {
|
|
97
|
+
type: String as PropType<ColorBase>,
|
|
98
|
+
required: false,
|
|
99
|
+
default: ColorEnum.Primary
|
|
100
|
+
},
|
|
101
|
+
date: {
|
|
102
|
+
type: Number,
|
|
103
|
+
required: false,
|
|
104
|
+
default: null
|
|
105
|
+
},
|
|
106
|
+
reminder: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
required: false,
|
|
109
|
+
default: false
|
|
110
|
+
},
|
|
111
|
+
editable: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
required: false,
|
|
114
|
+
default: true
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
emits: ["update:modelValue"],
|
|
118
|
+
setup(props, { emit }) {
|
|
119
|
+
const { epochToLongDateFormat } = useTimeZone();
|
|
120
|
+
|
|
121
|
+
const colors = computed(() => useColors().getColors(props.color));
|
|
122
|
+
const backgrounds = useColors().getColors(ColorEnum.Background);
|
|
123
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
124
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
125
|
+
|
|
126
|
+
const innerHours = ref(props.modelValue ? Math.floor(props.modelValue / (60 * 60 * 1000)) : 0);
|
|
127
|
+
const innerMinutes = ref(props.modelValue ? Math.floor((props.modelValue % (60 * 60 * 1000)) / (60 * 1000)) : 0);
|
|
128
|
+
|
|
129
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
130
|
+
if (!props.editable) {
|
|
131
|
+
return {
|
|
132
|
+
"--fs-clock-field-cursor" : "default",
|
|
133
|
+
"--fs-clock-field-background-color" : backgrounds.base,
|
|
134
|
+
"--fs-clock-field-border-color" : lights.base,
|
|
135
|
+
"--fs-clock-field-color" : lights.dark,
|
|
136
|
+
"--fs-clock-field-active-border-color": lights.base
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
"--fs-clock-field-cursor" : "text",
|
|
141
|
+
"--fs-clock-field-background-color" : colors.value.light,
|
|
142
|
+
"--fs-clock-field-border-color" : colors.value.base,
|
|
143
|
+
"--fs-clock-field-color" : darks.base,
|
|
144
|
+
"--fs-clock-field-active-border-color": colors.value.dark
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const onChangeHours = (value: number): void => {
|
|
149
|
+
value = Math.min(23, Math.max(0, value));
|
|
150
|
+
innerHours.value = value;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const onChangeMinutes = (value: number): void => {
|
|
154
|
+
value = Math.min(59, Math.max(0, value));
|
|
155
|
+
innerMinutes.value = value;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
watch([innerHours, innerMinutes], () => {
|
|
159
|
+
emit("update:modelValue", (innerHours.value * 60 * 60 * 1000) + (innerMinutes.value * 60 * 1000));
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
style,
|
|
164
|
+
innerHours,
|
|
165
|
+
innerMinutes,
|
|
166
|
+
onChangeHours,
|
|
167
|
+
onChangeMinutes,
|
|
168
|
+
epochToLongDateFormat
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
</script>
|