@dative-gpi/foundation-shared-components 1.0.157 → 1.0.158-devices-latency-2
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/FSCol.vue +11 -5
- package/components/FSTagGroup.vue +3 -1
- package/components/fields/FSAutocompleteField.vue +8 -0
- package/components/fields/FSBaseField.vue +6 -0
- package/components/fields/FSIconField.vue +10 -2
- package/components/fields/FSSearchField.vue +1 -0
- package/components/fields/FSTimeRangeField.vue +6 -0
- package/components/lists/FSDataTableUI.vue +30 -24
- package/components/map/FSMap.vue +1 -3
- package/components/map/FSMapMarker.vue +52 -13
- package/components/tiles/FSEntityCountBadge.vue +83 -0
- package/components/tiles/FSFolderTileUI.vue +38 -4
- package/components/tiles/FSGroupTileUI.vue +15 -67
- package/components/tiles/FSGroupingTileUI.vue +52 -0
- package/components/tiles/FSLocationTileUI.vue +9 -28
- package/components/tiles/FSSimpleTileUI.vue +2 -2
- package/components/views/desktop/FSBaseDefaultDesktopView.vue +1 -1
- package/components/views/desktop/FSBaseEntityDesktopView.vue +6 -4
- package/components/views/mobile/FSBaseDefaultMobileView.vue +5 -5
- package/components/views/mobile/FSBaseEntityMobileView.vue +28 -21
- package/composables/index.ts +0 -1
- package/composables/useMapLayers.ts +60 -53
- package/models/index.ts +0 -1
- package/package.json +4 -4
- package/styles/components/fs_col.scss +1 -1
- package/tools/alertsTools.ts +2 -1
- package/tools/chartsTools.ts +14 -1
- package/components/fields/FSMagicConfigField.vue +0 -171
- package/components/fields/FSMagicField.vue +0 -198
- package/components/selects/chartSelectors/FSPlotPerSelector.vue +0 -52
- package/composables/useMagicFieldProvider.ts +0 -24
- package/models/magicFields.ts +0 -11
|
@@ -15,46 +15,25 @@
|
|
|
15
15
|
<FSCol
|
|
16
16
|
gap="8px"
|
|
17
17
|
>
|
|
18
|
-
<
|
|
19
|
-
v-if="$props.deviceCount"
|
|
20
|
-
:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
width="24px"
|
|
25
|
-
height="24px"
|
|
26
|
-
:color="ColorEnum.Primary"
|
|
27
|
-
:border="false"
|
|
28
|
-
>
|
|
29
|
-
<FSRow
|
|
30
|
-
align="center-center"
|
|
31
|
-
>
|
|
32
|
-
<FSSpan
|
|
33
|
-
font="text-overline"
|
|
34
|
-
>
|
|
35
|
-
{{ capNumberToString($props.deviceCount) }}
|
|
36
|
-
</FSSpan>
|
|
37
|
-
</FSRow>
|
|
38
|
-
</FSColor>
|
|
39
|
-
<FSSpan
|
|
40
|
-
font="text-overline"
|
|
41
|
-
>
|
|
42
|
-
{{ $tr("ui.common.devices", "Equipment(s)") }}
|
|
43
|
-
</FSSpan>
|
|
44
|
-
</FSRow>
|
|
18
|
+
<FSEntityCountBadge
|
|
19
|
+
v-if="$props.deviceCount !== undefined"
|
|
20
|
+
:label="$tr('ui.common.devices', 'Device(s)')"
|
|
21
|
+
:count="$props.deviceCount"
|
|
22
|
+
:color="ColorEnum.Primary"
|
|
23
|
+
/>
|
|
45
24
|
<FSRow
|
|
46
25
|
v-if="$props.address"
|
|
47
26
|
:wrap="false"
|
|
48
27
|
align="center-left"
|
|
49
28
|
>
|
|
50
29
|
<FSColor
|
|
51
|
-
width="24px"
|
|
52
30
|
height="24px"
|
|
53
31
|
:color="ColorEnum.Primary"
|
|
54
32
|
:border="false"
|
|
55
33
|
>
|
|
56
34
|
<FSRow
|
|
57
35
|
align="center-center"
|
|
36
|
+
width="24px"
|
|
58
37
|
>
|
|
59
38
|
<FSIcon
|
|
60
39
|
icon="mdi-map-marker-radius-outline"
|
|
@@ -79,6 +58,7 @@ import { defineComponent, type PropType } from "vue";
|
|
|
79
58
|
import { capNumberToString } from '@dative-gpi/foundation-shared-components/utils';
|
|
80
59
|
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
81
60
|
|
|
61
|
+
import FSEntityCountBadge from './FSEntityCountBadge.vue';
|
|
82
62
|
import FSSimpleTileUI from './FSSimpleTileUI.vue';
|
|
83
63
|
import FSColor from "../FSColor.vue";
|
|
84
64
|
import FSSpan from "../FSSpan.vue";
|
|
@@ -88,6 +68,7 @@ import FSRow from "../FSRow.vue";
|
|
|
88
68
|
export default defineComponent({
|
|
89
69
|
name: "FSLocationTileUI",
|
|
90
70
|
components: {
|
|
71
|
+
FSEntityCountBadge,
|
|
91
72
|
FSSimpleTileUI,
|
|
92
73
|
FSColor,
|
|
93
74
|
FSSpan,
|
|
@@ -128,7 +128,7 @@ export default defineComponent({
|
|
|
128
128
|
default: ColorEnum.Primary
|
|
129
129
|
},
|
|
130
130
|
bottomColor: {
|
|
131
|
-
type: [Array, String] as PropType<ColorBase | ColorBase[]>,
|
|
131
|
+
type: [Array, String] as PropType<ColorBase | ColorBase[] | null>,
|
|
132
132
|
required: false,
|
|
133
133
|
default: ColorEnum.Light
|
|
134
134
|
},
|
|
@@ -147,7 +147,7 @@ export default defineComponent({
|
|
|
147
147
|
const { isMobileSized } = useBreakpoints();
|
|
148
148
|
|
|
149
149
|
const iconBackgroundColor = computed((): ColorBase | ColorBase[] => {
|
|
150
|
-
return props.iconBackgroundColor
|
|
150
|
+
return props.iconBackgroundColor ?? ColorEnum.Background;
|
|
151
151
|
});
|
|
152
152
|
|
|
153
153
|
const imageSize = computed((): number => {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
>
|
|
10
10
|
<FSRow
|
|
11
11
|
gap="24px"
|
|
12
|
+
:height="actualImageSize"
|
|
12
13
|
:wrap="false"
|
|
13
14
|
>
|
|
14
15
|
<template
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
>
|
|
55
56
|
<slot
|
|
56
57
|
name="subtitle"
|
|
57
|
-
v-if="topOffset <
|
|
58
|
+
v-if="topOffset < 64"
|
|
58
59
|
>
|
|
59
60
|
<FSText
|
|
60
61
|
v-if="$props.subtitle"
|
|
@@ -65,10 +66,11 @@
|
|
|
65
66
|
</slot>
|
|
66
67
|
<slot
|
|
67
68
|
name="description"
|
|
68
|
-
v-if="topOffset <
|
|
69
|
+
v-if="topOffset < 24"
|
|
69
70
|
>
|
|
70
71
|
<FSText
|
|
71
72
|
v-if="$props.description"
|
|
73
|
+
:lineClamp="2"
|
|
72
74
|
font="text-body"
|
|
73
75
|
>
|
|
74
76
|
{{ $props.description }}
|
|
@@ -146,9 +148,9 @@ export default defineComponent({
|
|
|
146
148
|
default: () => ["124px", "96px", "80px"]
|
|
147
149
|
},
|
|
148
150
|
icon: {
|
|
149
|
-
type: String as PropType<string>,
|
|
151
|
+
type: String as PropType<string | null>,
|
|
150
152
|
required: false,
|
|
151
|
-
default:
|
|
153
|
+
default: null
|
|
152
154
|
},
|
|
153
155
|
iconColor: {
|
|
154
156
|
type: String as PropType<ColorBase>,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<FSRow
|
|
16
16
|
style="position: sticky; top: 0px; z-index: 3;"
|
|
17
17
|
:style="{ backgroundColor, marginTop: $props.stickyTitleTopOffset }"
|
|
18
|
-
:padding="`
|
|
18
|
+
:padding="`16px ${isTouchScreenEnabled ? '20px' : '12px'} 12px 12px`"
|
|
19
19
|
>
|
|
20
20
|
<slot
|
|
21
21
|
name="title"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
</FSRow>
|
|
30
30
|
<FSCol
|
|
31
31
|
v-if="$props.breadcrumbs && $props.breadcrumbs.length > 0"
|
|
32
|
-
:padding="$
|
|
32
|
+
:padding="`0px ${isTouchScreenEnabled ? '20px' : '12px'} 12px 12px`"
|
|
33
33
|
gap="16px"
|
|
34
34
|
>
|
|
35
35
|
<FSCol>
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
<FSRow
|
|
46
46
|
v-if="$slots.toolbar"
|
|
47
47
|
:style="stickyToolbar ? `position: sticky; top: ${$props.toolbarTopOffset}; z-index: 3; background-color: ${backgroundColor}` : undefined"
|
|
48
|
-
:padding="`0px ${isTouchScreenEnabled ? '
|
|
48
|
+
:padding="`0px ${isTouchScreenEnabled ? '20px' : '12px'} 12px 12px`"
|
|
49
49
|
>
|
|
50
50
|
<FSSlideGroup>
|
|
51
51
|
<slot
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
<FSCol
|
|
59
59
|
height="fill"
|
|
60
60
|
gap="0px"
|
|
61
|
-
:padding="
|
|
61
|
+
:padding="`0px ${isTouchScreenEnabled ? '20px' : '12px'} 16px 12px`"
|
|
62
62
|
>
|
|
63
63
|
<slot />
|
|
64
64
|
</FSCol>
|
|
@@ -108,7 +108,7 @@ export default defineComponent({
|
|
|
108
108
|
toolbarTopOffset: {
|
|
109
109
|
type: String,
|
|
110
110
|
required: false,
|
|
111
|
-
default: "
|
|
111
|
+
default: "52px"
|
|
112
112
|
},
|
|
113
113
|
stickyTitleTopOffset: {
|
|
114
114
|
type: String,
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
#title
|
|
9
9
|
>
|
|
10
10
|
<FSRow
|
|
11
|
-
gap="
|
|
11
|
+
gap="12px"
|
|
12
|
+
:height="actualImageSize"
|
|
12
13
|
:wrap="false"
|
|
13
14
|
>
|
|
14
15
|
<FSImage
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
style="min-width: 0"
|
|
32
33
|
align="center-left"
|
|
33
34
|
height="fill"
|
|
35
|
+
:gap="$props.subtitle && $props.description ? '6px' : '8px'"
|
|
34
36
|
>
|
|
35
37
|
<slot
|
|
36
38
|
name="title"
|
|
@@ -44,26 +46,31 @@
|
|
|
44
46
|
name="title-extra"
|
|
45
47
|
v-bind="{ topOffset }"
|
|
46
48
|
>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
+
<FSCol
|
|
50
|
+
gap="4px"
|
|
49
51
|
>
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
font="text-button"
|
|
52
|
+
<slot
|
|
53
|
+
name="subtitle"
|
|
53
54
|
>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
<FSText
|
|
56
|
+
v-if="$props.subtitle && topOffset < 48"
|
|
57
|
+
font="text-button"
|
|
58
|
+
>
|
|
59
|
+
{{ $props.subtitle }}
|
|
60
|
+
</FSText>
|
|
61
|
+
</slot>
|
|
62
|
+
<slot
|
|
63
|
+
name="description"
|
|
63
64
|
>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
<FSText
|
|
66
|
+
v-if="$props.description && topOffset < 8"
|
|
67
|
+
:lineClamp="2"
|
|
68
|
+
font="text-body"
|
|
69
|
+
>
|
|
70
|
+
{{ $props.description }}
|
|
71
|
+
</FSText>
|
|
72
|
+
</slot>
|
|
73
|
+
</FSCol>
|
|
67
74
|
</slot>
|
|
68
75
|
</slot>
|
|
69
76
|
</FSCol>
|
|
@@ -136,9 +143,9 @@ export default defineComponent({
|
|
|
136
143
|
default: () => ["124px", "96px", "80px"]
|
|
137
144
|
},
|
|
138
145
|
icon: {
|
|
139
|
-
type: String as PropType<string>,
|
|
146
|
+
type: String as PropType<string | null>,
|
|
140
147
|
required: false,
|
|
141
|
-
default:
|
|
148
|
+
default: null
|
|
142
149
|
},
|
|
143
150
|
iconColor: {
|
|
144
151
|
type: String as PropType<ColorBase>,
|
|
@@ -183,7 +190,7 @@ export default defineComponent({
|
|
|
183
190
|
const minSize = sizeToVar(props.minImageSize);
|
|
184
191
|
const actualMinSize = parseInt(minSize);
|
|
185
192
|
|
|
186
|
-
topOffset.value = Math.max(0, Math.min(actualScrollTop, actualMinSize + 16 +
|
|
193
|
+
topOffset.value = Math.max(0, Math.min(actualScrollTop, actualMinSize + 16 + 12));
|
|
187
194
|
}
|
|
188
195
|
|
|
189
196
|
delete slots.title;
|
package/composables/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from "./useAutocomplete";
|
|
|
3
3
|
export * from "./useBreakpoints";
|
|
4
4
|
export * from "./useColors";
|
|
5
5
|
export * from "./useDebounce";
|
|
6
|
-
export * from "./useMagicFieldProvider";
|
|
7
6
|
export * from "./useMapLayers";
|
|
8
7
|
export * from "./useRules";
|
|
9
8
|
export * from "./useSlots";
|
|
@@ -1,62 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ref, onMounted } from "vue";
|
|
3
2
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
4
|
-
|
|
5
3
|
import { MapLayers } from '@dative-gpi/foundation-shared-components/models';
|
|
6
4
|
|
|
7
5
|
export const useMapLayers = () => {
|
|
8
6
|
const { $tr } = useTranslationsProvider();
|
|
9
|
-
|
|
10
7
|
const apiKey = import.meta.env.VITE_GOOGLE_MAPS_API_KEY ?? "";
|
|
11
8
|
|
|
12
|
-
const layers = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
9
|
+
const layers = ref<any[]>([]);
|
|
10
|
+
|
|
11
|
+
onMounted(async () => {
|
|
12
|
+
try {
|
|
13
|
+
const leaflet = await import('leaflet');
|
|
14
|
+
const tileLayer = leaflet.tileLayer;
|
|
15
|
+
|
|
16
|
+
layers.value = [
|
|
17
|
+
{
|
|
18
|
+
name: MapLayers.Map,
|
|
19
|
+
label: $tr("ui.map-layer.map", "Map"),
|
|
20
|
+
image: new URL("../assets/images/map/map.png", import.meta.url).href,
|
|
21
|
+
layers: [
|
|
22
|
+
tileLayer(`https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key=${apiKey}`, {
|
|
23
|
+
maxZoom: 22,
|
|
24
|
+
subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
|
|
25
|
+
attribution: '© Google Map Data',
|
|
26
|
+
className: 'fs-map-tile-base-layer'
|
|
27
|
+
})
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: MapLayers.Imagery,
|
|
32
|
+
label: $tr("ui.map-layer.imagery", "Imagery"),
|
|
33
|
+
image: new URL("../assets/images/map/imagery.png", import.meta.url).href,
|
|
34
|
+
layers: [
|
|
35
|
+
tileLayer(`https://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}&key=${apiKey}`, {
|
|
36
|
+
maxZoom: 22,
|
|
37
|
+
subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
|
|
38
|
+
attribution: '© Google Map Data',
|
|
39
|
+
className: 'fs-map-tile-base-layer'
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: MapLayers.Snow,
|
|
45
|
+
label: $tr("ui.map-layer.snow", "Snow ski map"),
|
|
46
|
+
image: new URL("../assets/images/map/snow.png", import.meta.url).href,
|
|
47
|
+
layers: [
|
|
48
|
+
tileLayer(`https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key=${apiKey}`, {
|
|
49
|
+
maxZoom: 22,
|
|
50
|
+
subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
|
|
51
|
+
attribution: '© Google Map Data',
|
|
52
|
+
className: 'fs-map-tile-base-layer fs-map-tile-grayscale-layer'
|
|
53
|
+
}),
|
|
54
|
+
tileLayer(`https://tiles.opensnowmap.org/pistes/{z}/{x}/{y}.png`, {
|
|
55
|
+
maxZoom: 18,
|
|
56
|
+
attribution: 'Map data: © OpenStreetMap contributors & ODbL, CC-BY-SA',
|
|
57
|
+
className: 'fs-map-tile-base-layer'
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
} catch (err) {
|
|
63
|
+
console.error("Leaflet is not installed or failed to load.", err);
|
|
64
|
+
layers.value = [];
|
|
56
65
|
}
|
|
57
|
-
|
|
66
|
+
});
|
|
58
67
|
|
|
59
|
-
return {
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
}
|
|
68
|
+
return { layers };
|
|
69
|
+
};
|
package/models/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-components",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.158-devices-latency-2",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-shared-domain": "1.0.
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "1.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "1.0.158-devices-latency-2",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "1.0.158-devices-latency-2"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"sass": "1.71.1",
|
|
36
36
|
"sass-loader": "13.3.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "63914dedbe1ac988443cf07e471e2fa6120392f2"
|
|
39
39
|
}
|
package/tools/alertsTools.ts
CHANGED
|
@@ -74,9 +74,10 @@ export const AlertTools = {
|
|
|
74
74
|
},
|
|
75
75
|
criticityLabel(value: Criticity): string {
|
|
76
76
|
switch (value) {
|
|
77
|
+
case Criticity.Information: return $tr('ui.common.information', 'Information');
|
|
77
78
|
case Criticity.Warning: return $tr('ui.common.warning', 'Warning');
|
|
78
79
|
case Criticity.Error: return $tr('ui.common.error', 'Error');
|
|
79
|
-
default: return $tr(
|
|
80
|
+
default: return $tr("ui.common.none", "None");
|
|
80
81
|
}
|
|
81
82
|
},
|
|
82
83
|
statusColor(status: AlertStatus): ColorEnum {
|
package/tools/chartsTools.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxisType, ColorSets, SerieType, ChartType, TimeUnit, ChartOrigin, AggregationType, DisplayAs, FilterType, HeatmapRule, OperationOn, PlanningType, PlotPer } from "@dative-gpi/foundation-shared-domain/enums";
|
|
1
|
+
import { AxisType, ColorSets, SerieType, ChartType, TimeUnit, ChartOrigin, AggregationType, DisplayAs, FilterType, HeatmapRule, OperationOn, PlanningType, PlotPer, ApplicationScope } from "@dative-gpi/foundation-shared-domain/enums";
|
|
2
2
|
|
|
3
3
|
import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
|
|
4
4
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
@@ -14,6 +14,18 @@ export const chartOriginLabel = (type: ChartOrigin): string => {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
export const applicationScopeLabel = (type: ApplicationScope): string => {
|
|
18
|
+
switch (type) {
|
|
19
|
+
case ApplicationScope.None:
|
|
20
|
+
return $tr("ui.common.none", "None");
|
|
21
|
+
case ApplicationScope.Organisation:
|
|
22
|
+
return $tr("ui.common.custom", "Custom");
|
|
23
|
+
case ApplicationScope.OrganisationType:
|
|
24
|
+
return $tr("ui.common.shared", "Shared");
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
|
|
17
29
|
export const chartOriginColor = (type: ChartOrigin): ColorBase => {
|
|
18
30
|
switch (type) {
|
|
19
31
|
case ChartOrigin.None: return ColorEnum.Error;
|
|
@@ -166,6 +178,7 @@ export const plotPerLabel = (plotper: PlotPer | number): string => {
|
|
|
166
178
|
case PlotPer.Group: return $tr("ui.common.group", "Group");
|
|
167
179
|
case PlotPer.Location: return $tr("ui.common.location", "Location");
|
|
168
180
|
case PlotPer.Device: return $tr("ui.common.device", "Device");
|
|
181
|
+
case PlotPer.Grouping: return $tr("ui.plot-per.grouping", "Personalized");
|
|
169
182
|
default: return $tr("ui.common.none", "None");
|
|
170
183
|
}
|
|
171
184
|
};
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FSRow
|
|
3
|
-
class="fs-magic-config-field"
|
|
4
|
-
>
|
|
5
|
-
<component
|
|
6
|
-
v-if="$props.type"
|
|
7
|
-
class="fs-magic-config-field-value"
|
|
8
|
-
:is="get($props.type)"
|
|
9
|
-
:label="$tr('ui.common.value', 'Value')"
|
|
10
|
-
:disabled="$props.disabled"
|
|
11
|
-
:required="true"
|
|
12
|
-
:rules="rules"
|
|
13
|
-
:modelValue="valueToInput"
|
|
14
|
-
@update:modelValue="inputToValue"
|
|
15
|
-
/>
|
|
16
|
-
<FSRow
|
|
17
|
-
gap="24px"
|
|
18
|
-
>
|
|
19
|
-
<FSTranslateField
|
|
20
|
-
:label="$tr('entity.common.label', 'Label')"
|
|
21
|
-
:disabled="$props.disabled"
|
|
22
|
-
:modelValue="$props.labelDefault"
|
|
23
|
-
:translations="$props.translations"
|
|
24
|
-
@update:modelValue="$emit('update:labelDefault', $event)"
|
|
25
|
-
@update:translations="$emit('update:translations', $event)"
|
|
26
|
-
/>
|
|
27
|
-
<FSRow
|
|
28
|
-
class="fs-magic-config-field-actions"
|
|
29
|
-
width="hug"
|
|
30
|
-
:wrap="false"
|
|
31
|
-
>
|
|
32
|
-
<FSButtonRemoveIcon
|
|
33
|
-
@click="$emit('click:remove')"
|
|
34
|
-
/>
|
|
35
|
-
<FSButtonAddIcon
|
|
36
|
-
@click="$emit('click:add')"
|
|
37
|
-
/>
|
|
38
|
-
</FSRow>
|
|
39
|
-
</FSRow>
|
|
40
|
-
</FSRow>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<script lang="ts">
|
|
44
|
-
import { computed, defineComponent, type PropType } from "vue";
|
|
45
|
-
|
|
46
|
-
import { DateRules, IconRules, NumberRules, TextRules, TimeRules, TimeStepRules, AutocompleteRules } from "../../models";
|
|
47
|
-
import { useMagicFieldProvider } from "../../composables";
|
|
48
|
-
import { MagicFieldType } from "../../models/magicFields";
|
|
49
|
-
|
|
50
|
-
import FSButtonRemoveIcon from "../buttons/FSButtonRemoveIcon.vue";
|
|
51
|
-
import FSButtonAddIcon from "../buttons/FSButtonAddIcon.vue";
|
|
52
|
-
import FSTranslateField from "./FSTranslateField.vue";
|
|
53
|
-
import FSRow from "../FSRow.vue";
|
|
54
|
-
|
|
55
|
-
export default defineComponent({
|
|
56
|
-
name: "FSMagicConfigField",
|
|
57
|
-
components: {
|
|
58
|
-
FSButtonRemoveIcon,
|
|
59
|
-
FSTranslateField,
|
|
60
|
-
FSButtonAddIcon,
|
|
61
|
-
FSRow
|
|
62
|
-
},
|
|
63
|
-
props: {
|
|
64
|
-
type: {
|
|
65
|
-
type: Number as PropType<MagicFieldType>,
|
|
66
|
-
required: false,
|
|
67
|
-
default: MagicFieldType.TextField
|
|
68
|
-
},
|
|
69
|
-
labelDefault: {
|
|
70
|
-
type: String as PropType<string | null>,
|
|
71
|
-
required: false,
|
|
72
|
-
default: null
|
|
73
|
-
},
|
|
74
|
-
modelValue: {
|
|
75
|
-
type: String as PropType<string | null>,
|
|
76
|
-
required: false,
|
|
77
|
-
default: null
|
|
78
|
-
},
|
|
79
|
-
translations: {
|
|
80
|
-
type: Array as PropType<{ languageCode: string; label: string }[]>,
|
|
81
|
-
required: false,
|
|
82
|
-
default: () => []
|
|
83
|
-
},
|
|
84
|
-
disabled: {
|
|
85
|
-
type: Boolean,
|
|
86
|
-
required: false,
|
|
87
|
-
default: false
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
emits: ["click:remove", "click:add", "update:modelValue", "update:labelDefault", "update:translations"],
|
|
91
|
-
setup(props, { emit }) {
|
|
92
|
-
const { get } = useMagicFieldProvider();
|
|
93
|
-
|
|
94
|
-
const rules = computed((): Function[] => {
|
|
95
|
-
switch (props.type) {
|
|
96
|
-
case MagicFieldType.NumberField:
|
|
97
|
-
return [NumberRules.required()];
|
|
98
|
-
case MagicFieldType.TextField:
|
|
99
|
-
return [TextRules.required()];
|
|
100
|
-
case MagicFieldType.DateTimeField:
|
|
101
|
-
return [DateRules.required()];
|
|
102
|
-
case MagicFieldType.IconField:
|
|
103
|
-
return [IconRules.required()];
|
|
104
|
-
case MagicFieldType.TimeField:
|
|
105
|
-
return [TimeRules.required()];
|
|
106
|
-
case MagicFieldType.TimeStepField:
|
|
107
|
-
return [TimeStepRules.required()];
|
|
108
|
-
case MagicFieldType.PlotPerField:
|
|
109
|
-
return [AutocompleteRules.required()];
|
|
110
|
-
}
|
|
111
|
-
return [];
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
const valueToInput = computed((): any => {
|
|
115
|
-
if (!props.modelValue) {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
switch (props.type) {
|
|
120
|
-
case MagicFieldType.NumberField:
|
|
121
|
-
case MagicFieldType.DateTimeField:
|
|
122
|
-
case MagicFieldType.TimeField:
|
|
123
|
-
if (isNaN(parseFloat(props.modelValue))) {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
return parseFloat(props.modelValue);
|
|
127
|
-
case MagicFieldType.Switch:
|
|
128
|
-
return props.modelValue === "true";
|
|
129
|
-
case MagicFieldType.TimeStepField:
|
|
130
|
-
return JSON.parse(props.modelValue);
|
|
131
|
-
case MagicFieldType.PlotPerField:
|
|
132
|
-
return parseInt(props.modelValue);
|
|
133
|
-
default:
|
|
134
|
-
return props.modelValue;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
const inputToValue = (value: any) => {
|
|
139
|
-
if (!value) {
|
|
140
|
-
emit("update:modelValue", null);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
switch (props.type) {
|
|
144
|
-
case MagicFieldType.NumberField:
|
|
145
|
-
case MagicFieldType.Switch:
|
|
146
|
-
case MagicFieldType.DateTimeField:
|
|
147
|
-
case MagicFieldType.TimeField:
|
|
148
|
-
emit("update:modelValue", value.toString());
|
|
149
|
-
break;
|
|
150
|
-
case MagicFieldType.TimeStepField:
|
|
151
|
-
emit("update:modelValue", JSON.stringify(value));
|
|
152
|
-
break;
|
|
153
|
-
case MagicFieldType.PlotPerField:
|
|
154
|
-
emit("update:modelValue", value.toString());
|
|
155
|
-
break;
|
|
156
|
-
default:
|
|
157
|
-
emit("update:modelValue", value);
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
MagicFieldType,
|
|
164
|
-
valueToInput,
|
|
165
|
-
rules,
|
|
166
|
-
inputToValue,
|
|
167
|
-
get
|
|
168
|
-
};
|
|
169
|
-
},
|
|
170
|
-
});
|
|
171
|
-
</script>
|