@dative-gpi/foundation-shared-components 1.1.23-fs-chart → 1.1.24-unit-formatter
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/FSAccordionPanel.vue +0 -2
- package/components/FSButton.vue +87 -43
- package/components/FSCard.vue +100 -208
- package/components/FSCardPlaceholder.vue +25 -29
- package/components/FSChip.vue +127 -54
- package/components/FSChipGroup.vue +23 -141
- package/components/FSClickable.vue +326 -24
- package/components/FSColor.vue +3 -3
- package/components/FSColorIcon.vue +0 -1
- package/components/FSDialogContent.vue +28 -39
- package/components/FSDialogFormBody.vue +0 -2
- package/components/FSDialogMenu.vue +1 -8
- package/components/FSDialogMultiFormBody.vue +5 -6
- package/components/FSDivider.vue +1 -5
- package/components/FSEditImageUI.vue +30 -21
- package/components/FSGridMosaic.vue +0 -2
- package/components/FSIconCard.vue +1 -3
- package/components/FSIconCheck.vue +0 -8
- package/components/FSImageCard.vue +4 -4
- package/components/FSInstantPicker.vue +0 -2
- package/components/FSLink.vue +13 -1
- package/components/FSOptionItem.vue +4 -4
- package/components/FSOptionsMenu.vue +6 -6
- package/components/FSPlayButtons.vue +9 -11
- package/components/FSProgressBar.vue +28 -142
- package/components/FSRangePicker.vue +0 -2
- package/components/FSRouterLink.vue +14 -84
- package/components/FSSlideGroup.vue +1 -5
- package/components/FSWindow.vue +0 -2
- package/components/agenda/FSAgendaHorizontalEvent.vue +4 -4
- package/components/agenda/FSAgendaVerticalEvent.vue +4 -4
- package/components/deviceOrganisations/FSStatusRichCard.vue +7 -4
- package/components/fields/FSAutocompleteField.vue +0 -1
- package/components/fields/FSEntityFieldUI.vue +0 -12
- package/components/fields/FSRichTextField.vue +0 -2
- package/components/lists/FSDataIteratorItem.vue +0 -2
- package/components/lists/FSDataTableUI.vue +0 -12
- package/components/lists/FSFilterButton.vue +23 -34
- package/components/lists/FSHeaderButton.vue +3 -6
- package/components/lists/FSTileList.vue +6 -23
- package/components/map/FSMap.vue +1 -1
- package/components/map/FSMapMarker.vue +3 -4
- package/components/selects/FSSelectMapLayer.vue +0 -5
- package/components/tiles/FSChartTileUI.vue +0 -2
- package/components/tiles/FSFolderTileUI.vue +2 -2
- package/components/tiles/FSLocationTileUI.vue +0 -2
- package/components/tiles/FSServiceAccountOrganisationTileUI.vue +0 -2
- package/components/tiles/FSTile.vue +64 -32
- package/components/tiles/FSUserOrganisationTileUI.vue +0 -2
- package/components/toggleSets/FSToggleSetPosition.vue +0 -5
- package/composables/useMapLayers.ts +0 -12
- package/models/index.ts +1 -2
- package/models/map.ts +1 -2
- package/models/tables.ts +0 -1
- package/package.json +4 -4
- package/styles/components/fs_button.scss +7 -1
- package/styles/components/fs_card.scss +4 -75
- package/styles/components/fs_chip.scss +29 -0
- package/styles/components/fs_clickable.scss +69 -0
- package/styles/components/fs_color_icon.scss +3 -0
- package/styles/components/fs_filter_button.scss +1 -6
- package/styles/components/fs_map.scss +1 -7
- package/styles/components/fs_progress_bar.scss +6 -62
- package/styles/components/index.scss +2 -1
- package/styles/globals/overrides.scss +1 -1
- package/assets/images/map/open-street-map.png +0 -0
- package/components/FSGroupingChip.vue +0 -115
- package/components/FSSnackbar.vue +0 -146
- package/components/FSSubgroupingChip.vue +0 -138
- package/components/fields/FSDurationField.vue +0 -184
- package/components/tiles/FSPlaylistTileUI.vue +0 -149
- package/components/tiles/FSSubgroupingTileUI.vue +0 -97
- package/models/variants.ts +0 -33
- package/styles/components/fs_snackbar.scss +0 -7
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FSChip
|
|
3
|
-
:height="$props.height"
|
|
4
|
-
:width="$props.width"
|
|
5
|
-
:variant="$props.variant"
|
|
6
|
-
:color="chipColor"
|
|
7
|
-
:disableHoverStyle="$props.disableHoverStyle"
|
|
8
|
-
>
|
|
9
|
-
<FSRow
|
|
10
|
-
align="center-center"
|
|
11
|
-
width="hug"
|
|
12
|
-
:wrap="false"
|
|
13
|
-
>
|
|
14
|
-
<FSRow
|
|
15
|
-
align="center-center"
|
|
16
|
-
width="hug"
|
|
17
|
-
gap="6px"
|
|
18
|
-
:wrap="false"
|
|
19
|
-
>
|
|
20
|
-
<FSIcon
|
|
21
|
-
:color="$props.iconColor"
|
|
22
|
-
:size="$props.iconSize"
|
|
23
|
-
>
|
|
24
|
-
{{ $props.icon }}
|
|
25
|
-
</FSIcon>
|
|
26
|
-
<FSText
|
|
27
|
-
font="text-overline"
|
|
28
|
-
:color="textColor"
|
|
29
|
-
>
|
|
30
|
-
{{ $props.label }}
|
|
31
|
-
</FSText>
|
|
32
|
-
</FSRow>
|
|
33
|
-
</FSRow>
|
|
34
|
-
</FSChip>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<script lang="ts">
|
|
38
|
-
import { defineComponent, type PropType } from "vue";
|
|
39
|
-
|
|
40
|
-
import { type CardVariant, CardVariants, type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
41
|
-
|
|
42
|
-
import FSIcon from "./FSIcon.vue";
|
|
43
|
-
import FSText from "./FSText.vue";
|
|
44
|
-
import FSChip from "./FSChip.vue";
|
|
45
|
-
import FSRow from "./FSRow.vue";
|
|
46
|
-
|
|
47
|
-
import { useColors } from "../composables";
|
|
48
|
-
|
|
49
|
-
export default defineComponent({
|
|
50
|
-
name: "FSSubgroupingChip",
|
|
51
|
-
components: {
|
|
52
|
-
FSChip,
|
|
53
|
-
FSIcon,
|
|
54
|
-
FSText,
|
|
55
|
-
FSRow
|
|
56
|
-
},
|
|
57
|
-
props: {
|
|
58
|
-
label: {
|
|
59
|
-
type: String as PropType<string>,
|
|
60
|
-
required: true
|
|
61
|
-
},
|
|
62
|
-
icon: {
|
|
63
|
-
type: String as PropType<string>,
|
|
64
|
-
required: true
|
|
65
|
-
},
|
|
66
|
-
iconColor: {
|
|
67
|
-
type: String as PropType<ColorBase>,
|
|
68
|
-
required: false,
|
|
69
|
-
default: ColorEnum.Dark
|
|
70
|
-
},
|
|
71
|
-
height: {
|
|
72
|
-
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
73
|
-
required: false,
|
|
74
|
-
default: () => [24, 20]
|
|
75
|
-
},
|
|
76
|
-
width: {
|
|
77
|
-
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
78
|
-
required: false,
|
|
79
|
-
default: "hug"
|
|
80
|
-
},
|
|
81
|
-
color: {
|
|
82
|
-
type: String as PropType<ColorBase>,
|
|
83
|
-
required: false,
|
|
84
|
-
default: ColorEnum.Light
|
|
85
|
-
},
|
|
86
|
-
variant: {
|
|
87
|
-
type: String as PropType<CardVariant>,
|
|
88
|
-
required: false,
|
|
89
|
-
default: CardVariants.Background
|
|
90
|
-
},
|
|
91
|
-
iconSize: {
|
|
92
|
-
type: [Array, String, Number] as PropType<"s" | "m" | "l" | string[] | number[] | string | number | null>,
|
|
93
|
-
required: false,
|
|
94
|
-
default: "18px"
|
|
95
|
-
},
|
|
96
|
-
disableHoverStyle: {
|
|
97
|
-
type: Boolean,
|
|
98
|
-
required: false,
|
|
99
|
-
default: true
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
setup(props) {
|
|
103
|
-
const { getColors } = useColors();
|
|
104
|
-
|
|
105
|
-
const chipColor = getColors(props.color).dark;
|
|
106
|
-
const textColor = getColors(ColorEnum.Dark).dark;
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
chipColor,
|
|
110
|
-
textColor,
|
|
111
|
-
ColorEnum
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
</script>
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-snackbar
|
|
3
|
-
class="fs-snackbar"
|
|
4
|
-
:modelValue="$props.modelValue"
|
|
5
|
-
@update:modelValue="$emit('update:modelValue', $event)"
|
|
6
|
-
:multi-line="$props.multiLine"
|
|
7
|
-
:location="$props.location"
|
|
8
|
-
:timeout="$props.timeout"
|
|
9
|
-
:style="style"
|
|
10
|
-
>
|
|
11
|
-
<slot>
|
|
12
|
-
<FSRow
|
|
13
|
-
align="center-left"
|
|
14
|
-
:wrap="false"
|
|
15
|
-
gap="12px"
|
|
16
|
-
>
|
|
17
|
-
<FSIcon
|
|
18
|
-
v-if="$props.icon"
|
|
19
|
-
>
|
|
20
|
-
{{ $props.icon }}
|
|
21
|
-
</FSIcon>
|
|
22
|
-
<FSSpan
|
|
23
|
-
v-if="$props.text"
|
|
24
|
-
:ellipsis="!$props.multiLine"
|
|
25
|
-
>
|
|
26
|
-
{{ $props.text }}
|
|
27
|
-
</FSSpan>
|
|
28
|
-
</FSRow>
|
|
29
|
-
</slot>
|
|
30
|
-
<template
|
|
31
|
-
v-if="$slots.actions || $props.closeButton"
|
|
32
|
-
#actions
|
|
33
|
-
>
|
|
34
|
-
<slot
|
|
35
|
-
name="actions"
|
|
36
|
-
>
|
|
37
|
-
<FSButton
|
|
38
|
-
v-if="$props.closeButton"
|
|
39
|
-
icon="mdi-close"
|
|
40
|
-
variant="icon"
|
|
41
|
-
@click="$emit('update:modelValue', false)"
|
|
42
|
-
/>
|
|
43
|
-
</slot>
|
|
44
|
-
</template>
|
|
45
|
-
</v-snackbar>
|
|
46
|
-
</template>
|
|
47
|
-
|
|
48
|
-
<script lang="ts">
|
|
49
|
-
import { computed, defineComponent, type PropType, type StyleValue } from "vue";
|
|
50
|
-
|
|
51
|
-
import { type ColorBase, ColorEnum, type SnackbarVariant, SnackbarVariants } from "@dative-gpi/foundation-shared-components/models";
|
|
52
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
53
|
-
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
54
|
-
|
|
55
|
-
import FSButton from "./FSButton.vue";
|
|
56
|
-
import FSIcon from "./FSIcon.vue";
|
|
57
|
-
import FSSpan from "./FSSpan.vue";
|
|
58
|
-
import FSRow from "./FSRow.vue";
|
|
59
|
-
|
|
60
|
-
export default defineComponent({
|
|
61
|
-
name: "FSSnackbar",
|
|
62
|
-
components: {
|
|
63
|
-
FSButton,
|
|
64
|
-
FSIcon,
|
|
65
|
-
FSSpan,
|
|
66
|
-
FSRow
|
|
67
|
-
},
|
|
68
|
-
props: {
|
|
69
|
-
modelValue: {
|
|
70
|
-
type: Boolean,
|
|
71
|
-
required: false,
|
|
72
|
-
default: false
|
|
73
|
-
},
|
|
74
|
-
text: {
|
|
75
|
-
type: String as PropType<string | null>,
|
|
76
|
-
required: false,
|
|
77
|
-
default: null
|
|
78
|
-
},
|
|
79
|
-
icon: {
|
|
80
|
-
type: String as PropType<string | null>,
|
|
81
|
-
required: false,
|
|
82
|
-
default: null
|
|
83
|
-
},
|
|
84
|
-
color: {
|
|
85
|
-
type: String as PropType<ColorBase>,
|
|
86
|
-
required: false,
|
|
87
|
-
default: ColorEnum.Dark
|
|
88
|
-
},
|
|
89
|
-
timeout: {
|
|
90
|
-
type: Number,
|
|
91
|
-
required: false,
|
|
92
|
-
default: 5000
|
|
93
|
-
},
|
|
94
|
-
location: {
|
|
95
|
-
type: String as PropType<"top" | "bottom" | "left" | "right" | "top left" | "top right" | "bottom left" | "bottom right">,
|
|
96
|
-
required: false,
|
|
97
|
-
default: "bottom"
|
|
98
|
-
},
|
|
99
|
-
multiLine: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
required: false,
|
|
102
|
-
default: false
|
|
103
|
-
},
|
|
104
|
-
closeButton: {
|
|
105
|
-
type: Boolean,
|
|
106
|
-
required: false,
|
|
107
|
-
default: false
|
|
108
|
-
},
|
|
109
|
-
variant: {
|
|
110
|
-
type: String as PropType<SnackbarVariant>,
|
|
111
|
-
required: false,
|
|
112
|
-
default: SnackbarVariants.Full
|
|
113
|
-
},
|
|
114
|
-
borderRadius: {
|
|
115
|
-
type: [String, Number],
|
|
116
|
-
required: false,
|
|
117
|
-
default: "4px"
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
emits: ["update:modelValue"],
|
|
121
|
-
setup(props) {
|
|
122
|
-
const { getColors } = useColors();
|
|
123
|
-
|
|
124
|
-
const colors = computed(() => getColors(props.color));
|
|
125
|
-
|
|
126
|
-
const style = computed((): StyleValue => {
|
|
127
|
-
switch (props.variant) {
|
|
128
|
-
case "standard": return {
|
|
129
|
-
"--fs-snackbar-border-radius": sizeToVar(props.borderRadius),
|
|
130
|
-
"--fs-snackbar-background-color": colors.value.light,
|
|
131
|
-
"--fs-snackbar-color": colors.value.dark
|
|
132
|
-
};
|
|
133
|
-
default: return {
|
|
134
|
-
"--fs-snackbar-border-radius": sizeToVar(props.borderRadius),
|
|
135
|
-
"--fs-snackbar-background-color": colors.value.base,
|
|
136
|
-
"--fs-snackbar-color": colors.value.light
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
style
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
</script>
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FSChip
|
|
3
|
-
:color="chipColor"
|
|
4
|
-
:width="$props.width"
|
|
5
|
-
:height="$props.height"
|
|
6
|
-
:variant="$props.variant"
|
|
7
|
-
:disableHoverStyle="$props.disableHoverStyle"
|
|
8
|
-
:title="`${$props.groupingLabel} - ${$props.label}`"
|
|
9
|
-
>
|
|
10
|
-
<FSRow
|
|
11
|
-
align="center-left"
|
|
12
|
-
width="fill"
|
|
13
|
-
:wrap="false"
|
|
14
|
-
>
|
|
15
|
-
<FSRow
|
|
16
|
-
align="center-center"
|
|
17
|
-
width="hug"
|
|
18
|
-
gap="6px"
|
|
19
|
-
:wrap="false"
|
|
20
|
-
>
|
|
21
|
-
<FSIcon
|
|
22
|
-
:color="$props.groupingColor"
|
|
23
|
-
:size="$props.iconSize"
|
|
24
|
-
>
|
|
25
|
-
{{ $props.groupingIcon }}
|
|
26
|
-
</FSIcon>
|
|
27
|
-
<FSSpan
|
|
28
|
-
font="text-overline"
|
|
29
|
-
>
|
|
30
|
-
{{ $props.groupingLabel }}
|
|
31
|
-
</FSSpan>
|
|
32
|
-
</FSRow>
|
|
33
|
-
<FSRow
|
|
34
|
-
align="center-center"
|
|
35
|
-
width="hug"
|
|
36
|
-
gap="6px"
|
|
37
|
-
:wrap="false"
|
|
38
|
-
>
|
|
39
|
-
<FSIcon
|
|
40
|
-
:size="$props.iconSize"
|
|
41
|
-
>
|
|
42
|
-
{{ $props.icon }}
|
|
43
|
-
</FSIcon>
|
|
44
|
-
<FSSpan
|
|
45
|
-
font="text-overline"
|
|
46
|
-
>
|
|
47
|
-
{{ $props.label }}
|
|
48
|
-
</FSSpan>
|
|
49
|
-
</FSRow>
|
|
50
|
-
</FSRow>
|
|
51
|
-
</FSChip>
|
|
52
|
-
</template>
|
|
53
|
-
|
|
54
|
-
<script lang="ts">
|
|
55
|
-
import { defineComponent, type PropType } from "vue";
|
|
56
|
-
|
|
57
|
-
import { type CardVariant, CardVariants, type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
58
|
-
|
|
59
|
-
import FSIcon from "./FSIcon.vue";
|
|
60
|
-
import FSSpan from "./FSSpan.vue";
|
|
61
|
-
import FSChip from "./FSChip.vue";
|
|
62
|
-
import FSRow from "./FSRow.vue";
|
|
63
|
-
|
|
64
|
-
import { useColors } from "../composables";
|
|
65
|
-
|
|
66
|
-
export default defineComponent({
|
|
67
|
-
name: "FSSubgroupingChip",
|
|
68
|
-
components: {
|
|
69
|
-
FSChip,
|
|
70
|
-
FSIcon,
|
|
71
|
-
FSSpan,
|
|
72
|
-
FSRow
|
|
73
|
-
},
|
|
74
|
-
props: {
|
|
75
|
-
groupingLabel: {
|
|
76
|
-
type: String as PropType<string>,
|
|
77
|
-
required: true
|
|
78
|
-
},
|
|
79
|
-
groupingIcon: {
|
|
80
|
-
type: String as PropType<string>,
|
|
81
|
-
required: true
|
|
82
|
-
},
|
|
83
|
-
groupingColor: {
|
|
84
|
-
type: String as PropType<ColorBase>,
|
|
85
|
-
required: false,
|
|
86
|
-
default: ColorEnum.Dark
|
|
87
|
-
},
|
|
88
|
-
label: {
|
|
89
|
-
type: String as PropType<string>,
|
|
90
|
-
required: true
|
|
91
|
-
},
|
|
92
|
-
icon: {
|
|
93
|
-
type: String as PropType<string>,
|
|
94
|
-
required: true
|
|
95
|
-
},
|
|
96
|
-
height: {
|
|
97
|
-
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
98
|
-
required: false,
|
|
99
|
-
default: () => [24, 20]
|
|
100
|
-
},
|
|
101
|
-
width: {
|
|
102
|
-
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
103
|
-
required: false,
|
|
104
|
-
default: "hug"
|
|
105
|
-
},
|
|
106
|
-
variant: {
|
|
107
|
-
type: String as PropType<CardVariant>,
|
|
108
|
-
required: false,
|
|
109
|
-
default: CardVariants.Background
|
|
110
|
-
},
|
|
111
|
-
color: {
|
|
112
|
-
type: String as PropType<ColorBase>,
|
|
113
|
-
required: false,
|
|
114
|
-
default: ColorEnum.Light
|
|
115
|
-
},
|
|
116
|
-
iconSize: {
|
|
117
|
-
type: [Array, String, Number] as PropType<"s" | "m" | "l" | string[] | number[] | string | number | null>,
|
|
118
|
-
required: false,
|
|
119
|
-
default: "18px"
|
|
120
|
-
},
|
|
121
|
-
disableHoverStyle: {
|
|
122
|
-
type: Boolean,
|
|
123
|
-
required: false,
|
|
124
|
-
default: true
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
setup(props) {
|
|
128
|
-
const { getColors } = useColors();
|
|
129
|
-
|
|
130
|
-
const chipColor = getColors(props.color).dark;
|
|
131
|
-
|
|
132
|
-
return {
|
|
133
|
-
chipColor,
|
|
134
|
-
ColorEnum
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
</script>
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FSBaseField
|
|
3
|
-
:description="$props.description"
|
|
4
|
-
:hideHeader="$props.hideHeader"
|
|
5
|
-
:required="$props.required"
|
|
6
|
-
:disabled="$props.disabled"
|
|
7
|
-
:label="$props.label"
|
|
8
|
-
:messages="messages"
|
|
9
|
-
>
|
|
10
|
-
<FSRow
|
|
11
|
-
:wrap="false"
|
|
12
|
-
align="center-left"
|
|
13
|
-
>
|
|
14
|
-
<FSNumberField
|
|
15
|
-
suffix="h"
|
|
16
|
-
:hideHeader="true"
|
|
17
|
-
:modelValue="innerHours"
|
|
18
|
-
:disabled="$props.disabled"
|
|
19
|
-
:rules="[() => messages.length === 0 || '']"
|
|
20
|
-
@update:modelValue="onChangeHours"
|
|
21
|
-
/>
|
|
22
|
-
<FSSpan>:</FSSpan>
|
|
23
|
-
<FSNumberField
|
|
24
|
-
suffix="min"
|
|
25
|
-
:hideHeader="true"
|
|
26
|
-
:disabled="$props.disabled"
|
|
27
|
-
:rules="[() => messages.length === 0 || '']"
|
|
28
|
-
:modelValue="innerMinutes"
|
|
29
|
-
@update:modelValue="onChangeMinutes"
|
|
30
|
-
/>
|
|
31
|
-
</FSRow>
|
|
32
|
-
</FSBaseField>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<script lang="ts">
|
|
36
|
-
import { computed, defineComponent, type PropType, ref, watch } from "vue";
|
|
37
|
-
|
|
38
|
-
import { NumberRules } from "@dative-gpi/foundation-shared-components/models";
|
|
39
|
-
import { useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
40
|
-
|
|
41
|
-
import FSNumberField from "./FSNumberField.vue";
|
|
42
|
-
import FSBaseField from "./FSBaseField.vue";
|
|
43
|
-
import FSSpan from "../FSSpan.vue";
|
|
44
|
-
import FSRow from "../FSRow.vue";
|
|
45
|
-
|
|
46
|
-
export default defineComponent({
|
|
47
|
-
name: "FSDurationField",
|
|
48
|
-
components: {
|
|
49
|
-
FSNumberField,
|
|
50
|
-
FSBaseField,
|
|
51
|
-
FSSpan,
|
|
52
|
-
FSRow
|
|
53
|
-
},
|
|
54
|
-
props: {
|
|
55
|
-
label: {
|
|
56
|
-
type: String as PropType<string | null>,
|
|
57
|
-
required: false,
|
|
58
|
-
default: null
|
|
59
|
-
},
|
|
60
|
-
description: {
|
|
61
|
-
type: String as PropType<string | null>,
|
|
62
|
-
required: false,
|
|
63
|
-
default: null
|
|
64
|
-
},
|
|
65
|
-
modelValue: {
|
|
66
|
-
type: Number as PropType<number | null>,
|
|
67
|
-
required: false,
|
|
68
|
-
default: null
|
|
69
|
-
},
|
|
70
|
-
maxDuration: {
|
|
71
|
-
type: Number as PropType<number | null>,
|
|
72
|
-
required: false,
|
|
73
|
-
default: null
|
|
74
|
-
},
|
|
75
|
-
minDuration: {
|
|
76
|
-
type: Number as PropType<number | null>,
|
|
77
|
-
required: false,
|
|
78
|
-
default: null
|
|
79
|
-
},
|
|
80
|
-
hideHeader: {
|
|
81
|
-
type: Boolean,
|
|
82
|
-
required: false,
|
|
83
|
-
default: false
|
|
84
|
-
},
|
|
85
|
-
required: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
required: false,
|
|
88
|
-
default: false
|
|
89
|
-
},
|
|
90
|
-
rules: {
|
|
91
|
-
type: Array as PropType<any[]>,
|
|
92
|
-
required: false,
|
|
93
|
-
default: () => []
|
|
94
|
-
},
|
|
95
|
-
messages: {
|
|
96
|
-
type: Array as PropType<string[]>,
|
|
97
|
-
required: false,
|
|
98
|
-
default: null
|
|
99
|
-
},
|
|
100
|
-
disabled: {
|
|
101
|
-
type: Boolean,
|
|
102
|
-
required: false,
|
|
103
|
-
default: false
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
emits: ["update:modelValue"],
|
|
107
|
-
setup(props, { emit }) {
|
|
108
|
-
const { getMessages } = useRules();
|
|
109
|
-
const MS_PER_MINUTE = 60 * 1000;
|
|
110
|
-
const MS_PER_HOUR = 60 * MS_PER_MINUTE;
|
|
111
|
-
|
|
112
|
-
const innerHours = ref<number | null>(null);
|
|
113
|
-
const innerMinutes = ref<number | null>(null);
|
|
114
|
-
|
|
115
|
-
const durationRules = computed(() => {
|
|
116
|
-
const rules: any[] = [...props.rules];
|
|
117
|
-
if (props.required) {
|
|
118
|
-
rules.push(NumberRules.required());
|
|
119
|
-
}
|
|
120
|
-
if (props.minDuration != null) {
|
|
121
|
-
const minHours = Math.floor(props.minDuration / MS_PER_HOUR);
|
|
122
|
-
const minMinutes = Math.floor((props.minDuration % MS_PER_HOUR) / MS_PER_MINUTE);
|
|
123
|
-
const label = minHours > 0 ? `${minHours}h${minMinutes.toString().padStart(2, '0')}` : `${minMinutes}min`;
|
|
124
|
-
rules.push((v: any) => (v != null && v >= props.minDuration!) || `Min. ${label}`);
|
|
125
|
-
}
|
|
126
|
-
if (props.maxDuration != null) {
|
|
127
|
-
const maxHours = Math.floor(props.maxDuration / MS_PER_HOUR);
|
|
128
|
-
const maxMinutes = Math.floor((props.maxDuration % MS_PER_HOUR) / MS_PER_MINUTE);
|
|
129
|
-
const label = maxHours > 0 ? `${maxHours}h${maxMinutes.toString().padStart(2, '0')}` : `${maxMinutes}min`;
|
|
130
|
-
rules.push((v: any) => (v != null && v <= props.maxDuration!) || `Max. ${label}`);
|
|
131
|
-
}
|
|
132
|
-
return rules;
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, durationRules.value));
|
|
136
|
-
|
|
137
|
-
const reset = (): void => {
|
|
138
|
-
if (props.modelValue == null) {
|
|
139
|
-
innerHours.value = null;
|
|
140
|
-
innerMinutes.value = null;
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
innerHours.value = Math.floor(props.modelValue / MS_PER_HOUR);
|
|
144
|
-
innerMinutes.value = Math.floor((props.modelValue % MS_PER_HOUR) / MS_PER_MINUTE);
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const emitValue = (): void => {
|
|
148
|
-
const hours = innerHours.value ?? 0;
|
|
149
|
-
const minutes = innerMinutes.value ?? 0;
|
|
150
|
-
emit("update:modelValue", (hours * MS_PER_HOUR) + (minutes * MS_PER_MINUTE));
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const onChangeHours = (value: number | null): void => {
|
|
154
|
-
innerHours.value = value;
|
|
155
|
-
emitValue();
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const onChangeMinutes = (value: number | null): void => {
|
|
159
|
-
value = Math.min(59, Math.max(0, value ?? 0));
|
|
160
|
-
innerMinutes.value = value;
|
|
161
|
-
emitValue();
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
watch(() => props.modelValue, () => {
|
|
165
|
-
const currentHours = innerHours.value ?? 0;
|
|
166
|
-
const currentMinutes = innerMinutes.value ?? 0;
|
|
167
|
-
const currentTotal = (currentHours * MS_PER_HOUR) + (currentMinutes * MS_PER_MINUTE);
|
|
168
|
-
if (currentTotal !== (props.modelValue ?? 0)) {
|
|
169
|
-
reset();
|
|
170
|
-
}
|
|
171
|
-
}, { immediate: true });
|
|
172
|
-
|
|
173
|
-
return {
|
|
174
|
-
NumberRules,
|
|
175
|
-
innerHours,
|
|
176
|
-
innerMinutes,
|
|
177
|
-
durationRules,
|
|
178
|
-
messages,
|
|
179
|
-
onChangeHours,
|
|
180
|
-
onChangeMinutes
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
</script>
|