@dative-gpi/foundation-shared-components 1.0.40 → 1.0.42
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/FSCalendar.vue +2 -2
- package/components/FSCalendarTwin.vue +2 -2
- package/components/FSClock.vue +2 -2
- package/components/deviceOrganisations/FSConnectivityCard.vue +2 -2
- package/components/deviceOrganisations/FSStatusCard.vue +2 -2
- package/components/deviceOrganisations/FSWorstAlertCard.vue +2 -2
- package/components/fields/FSDateField.vue +2 -2
- package/components/fields/FSDateRangeField.vue +2 -2
- package/components/fields/FSDateTimeField.vue +4 -3
- package/components/fields/FSDateTimeRangeField.vue +7 -6
- package/components/fields/FSGradientField.vue +22 -28
- package/components/fields/FSMagicField.vue +2 -2
- package/components/fields/FSTermField.vue +17 -8
- package/components/map/FSMap.vue +23 -9
- package/components/map/FSMapFeatureGroup.vue +2 -2
- package/components/map/FSMapMarker.vue +3 -3
- package/components/map/FSMapMarkerClusterGroup.vue +8 -3
- package/components/map/FSMapOverlay.vue +1 -1
- package/components/map/FSMapPolygon.vue +3 -3
- package/components/map/FSMapTileLayer.vue +2 -2
- package/components/map/keys.ts +3 -3
- package/components/selects/FSSelectDateSetting.vue +1 -0
- package/models/rules.ts +2 -2
- package/package.json +4 -4
- package/styles/components/fs_gradient_field.scss +3 -1
- package/styles/components/fs_select_date_settings.scss +3 -0
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
<script lang="ts">
|
|
68
68
|
import { computed, defineComponent, onMounted, type PropType, ref, type StyleValue } from "vue";
|
|
69
69
|
|
|
70
|
-
import {
|
|
70
|
+
import { useDateFormat, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
|
|
71
71
|
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
72
72
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
73
73
|
|
|
@@ -108,7 +108,7 @@ export default defineComponent({
|
|
|
108
108
|
},
|
|
109
109
|
emits: ["update:modelValue"],
|
|
110
110
|
setup(props, { emit }) {
|
|
111
|
-
const { epochToPicker, pickerToEpoch, todayToEpoch } =
|
|
111
|
+
const { epochToPicker, pickerToEpoch, todayToEpoch } = useDateFormat();
|
|
112
112
|
const { languageCode } = useAppLanguageCode();
|
|
113
113
|
const { getColors } = useColors();
|
|
114
114
|
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
<script lang="ts">
|
|
115
115
|
import { computed, defineComponent, onMounted, type PropType, ref, type StyleValue } from "vue";
|
|
116
116
|
|
|
117
|
-
import {
|
|
117
|
+
import { useDateFormat, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
|
|
118
118
|
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
119
119
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
120
120
|
|
|
@@ -155,7 +155,7 @@ export default defineComponent({
|
|
|
155
155
|
},
|
|
156
156
|
emits: ["update:modelValue"],
|
|
157
157
|
setup(props, { emit }) {
|
|
158
|
-
const { epochToPicker, epochToPickerHeader, pickerToEpoch, todayToEpoch } =
|
|
158
|
+
const { epochToPicker, epochToPickerHeader, pickerToEpoch, todayToEpoch } = useDateFormat();
|
|
159
159
|
const { languageCode } = useAppLanguageCode();
|
|
160
160
|
const { getColors } = useColors();
|
|
161
161
|
|
package/components/FSClock.vue
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
import { computed, defineComponent, type PropType, ref, type StyleValue, watch } from "vue";
|
|
56
56
|
|
|
57
57
|
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
58
|
-
import {
|
|
58
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
59
59
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
60
60
|
|
|
61
61
|
import FSSlider from "./FSSlider.vue";
|
|
@@ -98,7 +98,7 @@ export default defineComponent({
|
|
|
98
98
|
},
|
|
99
99
|
emits: ["update:modelValue"],
|
|
100
100
|
setup(props, { emit }) {
|
|
101
|
-
const { epochToLongDateFormat } =
|
|
101
|
+
const { epochToLongDateFormat } = useDateFormat();
|
|
102
102
|
const { getColors } = useColors();
|
|
103
103
|
|
|
104
104
|
const colors = computed(() => getColors(props.color));
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
import { computed, defineComponent, type PropType } from "vue";
|
|
59
59
|
|
|
60
60
|
import type { FSDeviceConnectivity } from "@dative-gpi/foundation-shared-components/models";
|
|
61
|
-
import {
|
|
61
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
62
62
|
|
|
63
63
|
import { connectivityLabel } from "../../utils";
|
|
64
64
|
|
|
@@ -89,7 +89,7 @@ export default defineComponent({
|
|
|
89
89
|
},
|
|
90
90
|
emit: ["close"],
|
|
91
91
|
setup(props) {
|
|
92
|
-
const { epochToLongTimeFormat } =
|
|
92
|
+
const { epochToLongTimeFormat } = useDateFormat();
|
|
93
93
|
|
|
94
94
|
const deviceTimestamp = computed((): string => {
|
|
95
95
|
if (props.deviceConnectivity.sourceTimestamp) {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
import { computed, defineComponent, type PropType } from "vue";
|
|
72
72
|
|
|
73
73
|
import type { FSDeviceStatusGroup, FSModelStatus } from "@dative-gpi/foundation-shared-components/models";
|
|
74
|
-
import {
|
|
74
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
75
75
|
|
|
76
76
|
import FSButton from "../FSButton.vue";
|
|
77
77
|
import FSCard from "../FSCard.vue";
|
|
@@ -108,7 +108,7 @@ export default defineComponent({
|
|
|
108
108
|
},
|
|
109
109
|
emits: ["close"],
|
|
110
110
|
setup(props) {
|
|
111
|
-
const { epochToLongTimeFormat } =
|
|
111
|
+
const { epochToLongTimeFormat } = useDateFormat();
|
|
112
112
|
|
|
113
113
|
const statusLabel = computed((): string => {
|
|
114
114
|
return props.statusGroup.label || props.modelStatus.label;
|
|
@@ -61,7 +61,7 @@ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui
|
|
|
61
61
|
import type { FSDeviceAlert} from "@dative-gpi/foundation-shared-components/models";
|
|
62
62
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
63
63
|
import { AlertStatus, Criticity } from "@dative-gpi/foundation-shared-domain/models";
|
|
64
|
-
import {
|
|
64
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
65
65
|
|
|
66
66
|
import FSButton from "../FSButton.vue";
|
|
67
67
|
import FSCard from "../FSCard.vue";
|
|
@@ -90,7 +90,7 @@ export default defineComponent({
|
|
|
90
90
|
},
|
|
91
91
|
emits: ["close"],
|
|
92
92
|
setup(props) {
|
|
93
|
-
const { epochToLongTimeFormat } =
|
|
93
|
+
const { epochToLongTimeFormat } = useDateFormat();
|
|
94
94
|
const { $tr } = useTranslationsProvider();
|
|
95
95
|
|
|
96
96
|
const criticityColor = computed(() => {
|
|
@@ -152,7 +152,7 @@ import _ from "lodash";
|
|
|
152
152
|
|
|
153
153
|
import { useBreakpoints, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
154
154
|
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
155
|
-
import {
|
|
155
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
156
156
|
|
|
157
157
|
import FSDialogMenu from "../FSDialogMenu.vue";
|
|
158
158
|
import FSTextField from "./FSTextField.vue";
|
|
@@ -215,7 +215,7 @@ export default defineComponent({
|
|
|
215
215
|
},
|
|
216
216
|
emits: ["update:modelValue"],
|
|
217
217
|
setup(props, { emit }) {
|
|
218
|
-
const { epochToLongDateFormat } =
|
|
218
|
+
const { epochToLongDateFormat } = useDateFormat();
|
|
219
219
|
const { validateOn, getMessages} = useRules();
|
|
220
220
|
const { isExtraSmall } = useBreakpoints();
|
|
221
221
|
|
|
@@ -62,7 +62,7 @@ import { computed, defineComponent, type PropType, ref, watch } from "vue";
|
|
|
62
62
|
import _ from "lodash";
|
|
63
63
|
|
|
64
64
|
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
65
|
-
import {
|
|
65
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
66
66
|
import { useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
67
67
|
|
|
68
68
|
import FSDialogSubmit from "../FSDialogSubmit.vue";
|
|
@@ -123,7 +123,7 @@ export default defineComponent({
|
|
|
123
123
|
emits: ["update:modelValue"],
|
|
124
124
|
setup(props, { emit }) {
|
|
125
125
|
const { validateOn, getMessages } = useRules();
|
|
126
|
-
const { epochToShortDateFormat } =
|
|
126
|
+
const { epochToShortDateFormat } = useDateFormat();
|
|
127
127
|
|
|
128
128
|
const dialog = ref(false);
|
|
129
129
|
|
|
@@ -197,7 +197,7 @@ import { computed, defineComponent, type PropType, ref, watch } from "vue";
|
|
|
197
197
|
|
|
198
198
|
import { useBreakpoints, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
199
199
|
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
200
|
-
import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
200
|
+
import { useAppTimeZone, useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
201
201
|
|
|
202
202
|
import FSDialogMenu from "../FSDialogMenu.vue";
|
|
203
203
|
import FSTextField from "./FSTextField.vue";
|
|
@@ -264,7 +264,8 @@ export default defineComponent({
|
|
|
264
264
|
},
|
|
265
265
|
emits: ["update:modelValue"],
|
|
266
266
|
setup(props, { emit }) {
|
|
267
|
-
const {
|
|
267
|
+
const { getUserOffset } = useAppTimeZone();
|
|
268
|
+
const { epochToLongTimeFormat } = useDateFormat();
|
|
268
269
|
const { validateOn, getMessages } = useRules();
|
|
269
270
|
const { isExtraSmall } = useBreakpoints();
|
|
270
271
|
|
|
@@ -300,7 +301,7 @@ export default defineComponent({
|
|
|
300
301
|
if (props.modelValue) {
|
|
301
302
|
// FSClock just gives two numbers without consideration for the time zone
|
|
302
303
|
// We must adjust the time to the user's time zone
|
|
303
|
-
innerTime.value = Math.floor((props.modelValue +
|
|
304
|
+
innerTime.value = Math.floor((props.modelValue + getUserOffset()) % (24 * 60 * 60 * 1000));
|
|
304
305
|
innerDate.value = props.modelValue - innerTime.value;
|
|
305
306
|
}
|
|
306
307
|
else {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
import { computed, defineComponent, type PropType, ref, watch } from "vue";
|
|
80
80
|
|
|
81
81
|
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
82
|
-
import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
82
|
+
import { useAppTimeZone, useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
83
83
|
import { useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
84
84
|
|
|
85
85
|
import FSDialogSubmit from "../FSDialogSubmit.vue";
|
|
@@ -115,7 +115,7 @@ export default defineComponent({
|
|
|
115
115
|
modelValue: {
|
|
116
116
|
type: Array as PropType<number[] | null>,
|
|
117
117
|
required: false,
|
|
118
|
-
default: null
|
|
118
|
+
default: () => null
|
|
119
119
|
},
|
|
120
120
|
color: {
|
|
121
121
|
type: String as PropType<ColorBase>,
|
|
@@ -145,7 +145,8 @@ export default defineComponent({
|
|
|
145
145
|
},
|
|
146
146
|
emits: ["update:modelValue"],
|
|
147
147
|
setup(props, { emit }) {
|
|
148
|
-
const {
|
|
148
|
+
const { getUserOffset } = useAppTimeZone();
|
|
149
|
+
const { epochToShortTimeFormat } = useDateFormat();
|
|
149
150
|
const { validateOn, getMessages } = useRules();
|
|
150
151
|
|
|
151
152
|
const dialog = ref(false);
|
|
@@ -206,13 +207,13 @@ export default defineComponent({
|
|
|
206
207
|
break;
|
|
207
208
|
}
|
|
208
209
|
case 1: {
|
|
209
|
-
innerTimeLeft.value = Math.floor((props.modelValue[0] +
|
|
210
|
+
innerTimeLeft.value = Math.floor((props.modelValue[0] + getUserOffset()) % (24 * 60 * 60 * 1000));
|
|
210
211
|
innerDateRange.value = [props.modelValue[0] - innerTimeLeft.value];
|
|
211
212
|
break;
|
|
212
213
|
}
|
|
213
214
|
default: {
|
|
214
|
-
innerTimeLeft.value = Math.floor((props.modelValue[0] +
|
|
215
|
-
innerTimeRight.value = Math.floor((props.modelValue[1] +
|
|
215
|
+
innerTimeLeft.value = Math.floor((props.modelValue[0] + getUserOffset()) % (24 * 60 * 60 * 1000));
|
|
216
|
+
innerTimeRight.value = Math.floor((props.modelValue[1] + getUserOffset()) % (24 * 60 * 60 * 1000));
|
|
216
217
|
innerDateRange.value = [props.modelValue[0] - innerTimeLeft.value, props.modelValue[1] - innerTimeRight.value];
|
|
217
218
|
break;
|
|
218
219
|
}
|
|
@@ -25,48 +25,29 @@
|
|
|
25
25
|
:clearable="false"
|
|
26
26
|
:editable="$props.editable"
|
|
27
27
|
:items="items"
|
|
28
|
-
|
|
29
|
-
@update:modelValue="$emit('update:modelValue',
|
|
28
|
+
modelValue="custom"
|
|
29
|
+
@update:modelValue="$emit('update:modelValue', allGradients[$event])"
|
|
30
30
|
>
|
|
31
31
|
<template
|
|
32
|
-
|
|
32
|
+
#item-append="{ item }"
|
|
33
33
|
>
|
|
34
34
|
<FSRow
|
|
35
35
|
class="fs-gradient-field-preview"
|
|
36
|
-
height="
|
|
36
|
+
height="20px"
|
|
37
37
|
width="100%"
|
|
38
|
-
|
|
38
|
+
align="center-center"
|
|
39
|
+
:style="{ '--fs-gradient-field-background': `linear-gradient(to right, ${encodeGradientCssColors(allGradients[item.id])})` }"
|
|
39
40
|
>
|
|
40
41
|
<span />
|
|
41
42
|
</FSRow>
|
|
42
43
|
</template>
|
|
43
|
-
<template
|
|
44
|
-
v-slot:item="{ item, props }"
|
|
45
|
-
>
|
|
46
|
-
<v-list-item
|
|
47
|
-
v-bind="props"
|
|
48
|
-
>
|
|
49
|
-
<template
|
|
50
|
-
#title
|
|
51
|
-
>
|
|
52
|
-
<FSRow
|
|
53
|
-
class="fs-gradient-field-preview"
|
|
54
|
-
height="fill"
|
|
55
|
-
width="100%"
|
|
56
|
-
:style="{ '--fs-gradient-field-background': `linear-gradient(to right, ${encodeGradientCssColors(presetGradients[item.value])})` }"
|
|
57
|
-
>
|
|
58
|
-
<span />
|
|
59
|
-
</FSRow>
|
|
60
|
-
</template>
|
|
61
|
-
</v-list-item>
|
|
62
|
-
</template>
|
|
63
44
|
</FSSelectField>
|
|
64
45
|
</FSBaseField>
|
|
65
46
|
</FSCol>
|
|
66
47
|
</template>
|
|
67
48
|
|
|
68
49
|
<script lang="ts">
|
|
69
|
-
import { type PropType, defineComponent } from "vue";
|
|
50
|
+
import { type PropType, defineComponent, computed } from "vue";
|
|
70
51
|
|
|
71
52
|
import { groupedGradients } from "../../utils";
|
|
72
53
|
import { useColors } from "../../composables";
|
|
@@ -127,14 +108,27 @@ export default defineComponent({
|
|
|
127
108
|
const { getColors } = useColors();
|
|
128
109
|
|
|
129
110
|
const presetGradients = groupedGradients[props.colorCount];
|
|
130
|
-
|
|
111
|
+
|
|
112
|
+
const allGradients = computed<Record<string, string[]>>(() => {
|
|
113
|
+
return {
|
|
114
|
+
'custom': [
|
|
115
|
+
...props.modelValue
|
|
116
|
+
],
|
|
117
|
+
...presetGradients
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const items = Object.keys(allGradients.value).map((key) => ({
|
|
122
|
+
id: key,
|
|
123
|
+
label: null
|
|
124
|
+
}));
|
|
131
125
|
|
|
132
126
|
const encodeGradientCssColors = (colors: string[]) => {
|
|
133
127
|
return colors.map((color) => getColors(color).base).join(", ");
|
|
134
128
|
};
|
|
135
129
|
|
|
136
130
|
return {
|
|
137
|
-
|
|
131
|
+
allGradients,
|
|
138
132
|
items,
|
|
139
133
|
encodeGradientCssColors
|
|
140
134
|
};
|
|
@@ -62,7 +62,7 @@ import { computed, defineComponent, type PropType } from "vue";
|
|
|
62
62
|
|
|
63
63
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
64
64
|
|
|
65
|
-
import {
|
|
65
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
66
66
|
|
|
67
67
|
import { useMagicFieldProvider } from "../../composables";
|
|
68
68
|
import { MagicFieldType } from "../../models/magicFields";
|
|
@@ -105,7 +105,7 @@ export default defineComponent({
|
|
|
105
105
|
},
|
|
106
106
|
emits: ["update:modelValue"],
|
|
107
107
|
setup(props, { emit }) {
|
|
108
|
-
const { epochToShortTimeFormat } =
|
|
108
|
+
const { epochToShortTimeFormat } = useDateFormat();
|
|
109
109
|
const { $tr } = useTranslationsProvider();
|
|
110
110
|
const { get } = useMagicFieldProvider();
|
|
111
111
|
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
:rules="[DateRules.required()]"
|
|
69
69
|
:editable="$props.editable"
|
|
70
70
|
:hideHeader="true"
|
|
71
|
-
:modelValue="
|
|
71
|
+
:modelValue="actualValue"
|
|
72
72
|
@update:modelValue="onPickDates"
|
|
73
73
|
/>
|
|
74
74
|
</FSRow>
|
|
@@ -81,7 +81,7 @@ import { computed, defineComponent, type PropType, ref, watch } from "vue";
|
|
|
81
81
|
import _ from "lodash";
|
|
82
82
|
|
|
83
83
|
import { DateRules, NumberRules, TextRules } from "@dative-gpi/foundation-shared-components/models";
|
|
84
|
-
import {
|
|
84
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
85
85
|
import { useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
86
86
|
import { DateSetting } from "@dative-gpi/foundation-shared-domain/models";
|
|
87
87
|
|
|
@@ -163,7 +163,7 @@ export default defineComponent({
|
|
|
163
163
|
},
|
|
164
164
|
emits: ["update:startDate", "update:endDate"],
|
|
165
165
|
setup(props, { emit }) {
|
|
166
|
-
const { parseForPicker,
|
|
166
|
+
const { parseForPicker, epochToISO, todayToPicker, yesterdayToPicker } = useDateFormat();
|
|
167
167
|
const { getMessages } = useRules();
|
|
168
168
|
|
|
169
169
|
const innerDateSetting = ref<DateSetting>(DateSetting.PastDays);
|
|
@@ -181,6 +181,14 @@ export default defineComponent({
|
|
|
181
181
|
];
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
+
const actualValue = computed(() => {
|
|
185
|
+
const dates = [parseForPicker(innerStartDate.value), parseForPicker(innerEndDate.value)]
|
|
186
|
+
if(dates.some(d => d == null)) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
return dates as [number, number];
|
|
190
|
+
})
|
|
191
|
+
|
|
184
192
|
const messages = computed((): string[] => {
|
|
185
193
|
return props.messages ??
|
|
186
194
|
getMessages(props.startDate, props.rules).concat(getMessages(props.endDate, props.rules));
|
|
@@ -418,14 +426,14 @@ export default defineComponent({
|
|
|
418
426
|
}
|
|
419
427
|
else {
|
|
420
428
|
console.log(value[0], value[1]);
|
|
421
|
-
if (value && value[0] != null &&
|
|
422
|
-
innerStartDate.value =
|
|
429
|
+
if (value && value[0] != null && epochToISO(value[0]) !== innerStartDate.value) {
|
|
430
|
+
innerStartDate.value = epochToISO(value[0]);
|
|
423
431
|
if (valid.value) {
|
|
424
432
|
emit("update:startDate", innerStartDate.value);
|
|
425
433
|
}
|
|
426
434
|
}
|
|
427
|
-
if (value && value[1] != null &&
|
|
428
|
-
innerEndDate.value =
|
|
435
|
+
if (value && value[1] != null && epochToISO(value[1]) !== innerEndDate.value) {
|
|
436
|
+
innerEndDate.value = epochToISO(value[1]);
|
|
429
437
|
if (valid.value) {
|
|
430
438
|
emit("update:endDate", innerEndDate.value);
|
|
431
439
|
}
|
|
@@ -619,7 +627,7 @@ export default defineComponent({
|
|
|
619
627
|
}
|
|
620
628
|
}
|
|
621
629
|
|
|
622
|
-
if (parseForPicker(props.endDate) != null && parseForPicker(props.startDate) != null) {
|
|
630
|
+
if (props.endDate && parseForPicker(props.endDate) != null && props.startDate && parseForPicker(props.startDate) != null) {
|
|
623
631
|
innerDateSetting.value = DateSetting.Pick;
|
|
624
632
|
innerDateValue.value = 1;
|
|
625
633
|
return;
|
|
@@ -643,6 +651,7 @@ export default defineComponent({
|
|
|
643
651
|
innerDateValue,
|
|
644
652
|
innerStartDate,
|
|
645
653
|
innerEndDate,
|
|
654
|
+
actualValue,
|
|
646
655
|
pastSettings,
|
|
647
656
|
DateSetting,
|
|
648
657
|
NumberRules,
|
package/components/map/FSMap.vue
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
<FSMapMarkerClusterGroup
|
|
41
41
|
v-if="$props.locations"
|
|
42
42
|
:expected-layers="$props.locations.length"
|
|
43
|
+
:disableClusteringAtZoom="defaultZoom"
|
|
43
44
|
@update:bounds="(bounds) => locationGroupBounds = bounds"
|
|
44
45
|
>
|
|
45
46
|
<FSMapMarker
|
|
@@ -116,7 +117,7 @@
|
|
|
116
117
|
</template>
|
|
117
118
|
|
|
118
119
|
<script lang="ts">
|
|
119
|
-
import { computed, defineComponent, onMounted, type Ref, provide, type PropType, ref, type StyleValue, watch } from "vue";
|
|
120
|
+
import { computed, defineComponent, onMounted, type Ref, provide, type PropType, ref, type StyleValue, watch, onUnmounted } from "vue";
|
|
120
121
|
|
|
121
122
|
import type {} from "leaflet.markercluster";
|
|
122
123
|
import { map as createMap, control, tileLayer, latLngBounds, latLng, type LatLng, LatLngBounds, type FitBoundsOptions } from "leaflet";
|
|
@@ -240,10 +241,16 @@ export default defineComponent({
|
|
|
240
241
|
const overlayHeight = ref<number>();
|
|
241
242
|
const overlayWidth = ref<number>();
|
|
242
243
|
|
|
243
|
-
const defaultZoom = 15;
|
|
244
|
-
|
|
245
244
|
provide('map', map);
|
|
246
245
|
|
|
246
|
+
const defaultZoom = 16;
|
|
247
|
+
const mapResizeObserver = new ResizeObserver(() => {
|
|
248
|
+
if(!map.value) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
map.value.invalidateSize();
|
|
252
|
+
});
|
|
253
|
+
|
|
247
254
|
const mapLayers: MapLayer[] = [
|
|
248
255
|
{
|
|
249
256
|
name: "map",
|
|
@@ -306,20 +313,20 @@ export default defineComponent({
|
|
|
306
313
|
return bounds as LatLngBounds;
|
|
307
314
|
});
|
|
308
315
|
|
|
309
|
-
const calculateTargetPosition = (target: L.LatLng) => {
|
|
316
|
+
const calculateTargetPosition = (target: L.LatLng, zoom?: number) => {
|
|
310
317
|
if(!map.value) {
|
|
311
318
|
return target;
|
|
312
319
|
}
|
|
313
|
-
|
|
320
|
+
zoom = zoom ?? map.value.getZoom();
|
|
314
321
|
const targetPoint = map.value.project(target, zoom).subtract([leftOffset.value / 2, -bottomOffset.value / 2]);
|
|
315
322
|
return map.value.unproject(targetPoint, zoom);
|
|
316
323
|
}
|
|
317
324
|
|
|
318
|
-
const
|
|
325
|
+
const flyTo = (lat: number, lng: number, zoom: number = defaultZoom) => {
|
|
319
326
|
if(!map.value) {
|
|
320
327
|
return;
|
|
321
328
|
}
|
|
322
|
-
map.value.
|
|
329
|
+
map.value.flyTo(calculateTargetPosition(latLng(lat, lng), zoom), zoom);
|
|
323
330
|
}
|
|
324
331
|
|
|
325
332
|
const setView = (lat: number, lng: number, zoom: number) => {
|
|
@@ -376,8 +383,14 @@ export default defineComponent({
|
|
|
376
383
|
return;
|
|
377
384
|
}
|
|
378
385
|
|
|
379
|
-
|
|
386
|
+
flyTo(e.latlng.lat, e.latlng.lng);
|
|
380
387
|
});
|
|
388
|
+
|
|
389
|
+
mapResizeObserver.observe(leafletContainer.value);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
onUnmounted(() => {
|
|
393
|
+
mapResizeObserver.disconnect();
|
|
381
394
|
});
|
|
382
395
|
|
|
383
396
|
watch (() => props.center, (center) => {
|
|
@@ -395,7 +408,7 @@ export default defineComponent({
|
|
|
395
408
|
if(!selectedLocation) {
|
|
396
409
|
return;
|
|
397
410
|
}
|
|
398
|
-
|
|
411
|
+
flyTo(selectedLocation?.address.latitude, selectedLocation?.address.longitude);
|
|
399
412
|
}, { immediate: true });
|
|
400
413
|
|
|
401
414
|
watch(() => props.selectedAreaId, (selectedAreaId) => {
|
|
@@ -419,6 +432,7 @@ export default defineComponent({
|
|
|
419
432
|
|
|
420
433
|
return {
|
|
421
434
|
ColorEnum,
|
|
435
|
+
defaultZoom,
|
|
422
436
|
leafletContainer,
|
|
423
437
|
locationGroupBounds,
|
|
424
438
|
overlayHeight,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { inject, provide, ref, type Ref } from 'vue';
|
|
7
7
|
|
|
8
8
|
import { type Map, FeatureGroup } from 'leaflet';
|
|
9
|
-
import {
|
|
9
|
+
import { MAP } from './keys';
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
name: 'FSMapFeatureGroup',
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
setup(props, { emit }) {
|
|
21
|
-
const map = inject<Ref<Map | null>>(
|
|
21
|
+
const map = inject<Ref<Map | null>>(MAP);
|
|
22
22
|
let added = false;
|
|
23
23
|
|
|
24
24
|
if(!map) {
|
|
@@ -10,7 +10,7 @@ import { type Map, type DivIcon, divIcon, type LatLng, marker, type Marker, type
|
|
|
10
10
|
import { useColors } from "../../composables";
|
|
11
11
|
|
|
12
12
|
import { gpsMarkerHtml, locationMarkerHtml, pinMarkerHtml } from '../../utils/leafletMarkers';
|
|
13
|
-
import {
|
|
13
|
+
import { MAP, MARKERCLUSTERGROUP } from './keys';
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
16
|
name: 'FSMapMarker',
|
|
@@ -41,8 +41,8 @@ export default {
|
|
|
41
41
|
},
|
|
42
42
|
emits: ['click'],
|
|
43
43
|
setup(props, { emit }) {
|
|
44
|
-
const map = inject<Ref<Map | null>>(
|
|
45
|
-
const markerClusterGroup = inject<Ref<MarkerClusterGroup | null>>(
|
|
44
|
+
const map = inject<Ref<Map | null>>(MAP);
|
|
45
|
+
const markerClusterGroup = inject<Ref<MarkerClusterGroup | null>>(MARKERCLUSTERGROUP, ref(null));
|
|
46
46
|
|
|
47
47
|
const { getColors } = useColors();
|
|
48
48
|
|
|
@@ -8,7 +8,7 @@ import { inject, provide, ref, type Ref } from 'vue';
|
|
|
8
8
|
import { type Map, MarkerClusterGroup, divIcon } from 'leaflet';
|
|
9
9
|
|
|
10
10
|
import { clusterMarkerHtml } from '../../utils/leafletMarkers';
|
|
11
|
-
import {
|
|
11
|
+
import { MAP } from './keys';
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
name: 'FSMapMarkerClusterGroup',
|
|
@@ -17,10 +17,15 @@ export default {
|
|
|
17
17
|
type: Number,
|
|
18
18
|
default: 0,
|
|
19
19
|
required: false
|
|
20
|
+
},
|
|
21
|
+
disableClusteringAtZoom: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 17,
|
|
24
|
+
required: false
|
|
20
25
|
}
|
|
21
26
|
},
|
|
22
27
|
setup(props, { emit }) {
|
|
23
|
-
const map = inject<Ref<Map | null>>(
|
|
28
|
+
const map = inject<Ref<Map | null>>(MAP);
|
|
24
29
|
let added = false;
|
|
25
30
|
|
|
26
31
|
if(!map) {
|
|
@@ -34,7 +39,7 @@ export default {
|
|
|
34
39
|
const markerClusterGroup = ref<MarkerClusterGroup>(new MarkerClusterGroup({
|
|
35
40
|
spiderfyOnMaxZoom: false,
|
|
36
41
|
showCoverageOnHover: false,
|
|
37
|
-
disableClusteringAtZoom:
|
|
42
|
+
disableClusteringAtZoom: props.disableClusteringAtZoom,
|
|
38
43
|
iconCreateFunction: function (cluster: any) {
|
|
39
44
|
const size = 36;
|
|
40
45
|
|
|
@@ -8,7 +8,7 @@ import { inject, type PropType, onMounted, type Ref, watch, ref } from 'vue';
|
|
|
8
8
|
import { type Map, type LatLng, type Polygon, type FeatureGroup, polygon } from 'leaflet';
|
|
9
9
|
|
|
10
10
|
import { useColors } from "../../composables";
|
|
11
|
-
import {
|
|
11
|
+
import { FEATUREGROUP, MAP } from './keys';
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
name: 'FSMapPolygon',
|
|
@@ -25,8 +25,8 @@ export default {
|
|
|
25
25
|
},
|
|
26
26
|
emits: ['click'],
|
|
27
27
|
setup(props, { emit }) {
|
|
28
|
-
const map = inject<Ref<Map | null>>(
|
|
29
|
-
const featureGroup = inject<Ref<FeatureGroup | null>>(
|
|
28
|
+
const map = inject<Ref<Map | null>>(MAP);
|
|
29
|
+
const featureGroup = inject<Ref<FeatureGroup | null>>(FEATUREGROUP, ref(null));
|
|
30
30
|
|
|
31
31
|
const { getColors } = useColors();
|
|
32
32
|
|
|
@@ -7,7 +7,7 @@ import { inject, type PropType, onMounted, type Ref, watch } from 'vue';
|
|
|
7
7
|
|
|
8
8
|
import type { Map, Layer } from 'leaflet';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { MAP } from './keys';
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
13
|
name: 'FSMapTileLayer',
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
setup(props) {
|
|
21
|
-
const map = inject<Ref<Map | null>>(
|
|
21
|
+
const map = inject<Ref<Map | null>>(MAP);
|
|
22
22
|
|
|
23
23
|
const lastLayer = props.layer;
|
|
24
24
|
|
package/components/map/keys.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const
|
|
3
|
-
export const
|
|
1
|
+
export const FEATUREGROUP = 'featureGroup';
|
|
2
|
+
export const MAP = 'map';
|
|
3
|
+
export const MARKERCLUSTERGROUP = 'markerClusterGroup';
|
|
4
4
|
|
package/models/rules.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
2
|
-
import {
|
|
2
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
3
3
|
import { validateExpression } from "@dative-gpi/foundation-shared-domain/tools";
|
|
4
4
|
|
|
5
5
|
import { getTimeBestString } from "../utils";
|
|
6
6
|
import type { TimeUnit } from "@/shared/foundation-shared-domain";
|
|
7
7
|
|
|
8
|
-
const { epochToLongDateFormat } =
|
|
8
|
+
const { epochToLongDateFormat } = useDateFormat()!;
|
|
9
9
|
const { $tr } = useTranslationsProvider();
|
|
10
10
|
|
|
11
11
|
export const TextRules = {
|
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.42",
|
|
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.42",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "1.0.42"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@dative-gpi/bones-ui": "^0.0.75",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"sass": "1.71.1",
|
|
36
36
|
"sass-loader": "13.3.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "0c0ad1947f4b469307f0e9a5c636b4d5df11c589"
|
|
39
39
|
}
|