@dative-gpi/foundation-shared-components 1.0.158 → 1.0.159-notification
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/map/FSMap.vue
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
|
-
import { inject, type PropType, type Ref, watch, ref, onUnmounted,
|
|
6
|
+
import { inject, type PropType, type Ref, watch, ref, onUnmounted, computed } from 'vue';
|
|
7
|
+
import { type RouteLocation } from "vue-router";
|
|
7
8
|
|
|
8
|
-
import { type Map, divIcon, type LatLng, marker, type Marker, type MarkerClusterGroup
|
|
9
|
+
import { type Map, divIcon, type LatLng, marker, type Marker, type MarkerClusterGroup } from 'leaflet';
|
|
9
10
|
|
|
10
11
|
import { useColors } from "../../composables";
|
|
12
|
+
import { useRouting } from '@dative-gpi/foundation-shared-services/composables';
|
|
11
13
|
|
|
12
14
|
import { gpsMarkerHtml, locationMarkerHtml, pinMarkerHtml } from '../../utils/leafletMarkers';
|
|
13
15
|
import { MAP, MARKERCLUSTERGROUP } from './keys';
|
|
@@ -41,14 +43,28 @@ export default {
|
|
|
41
43
|
label: {
|
|
42
44
|
type: String,
|
|
43
45
|
required: false
|
|
46
|
+
},
|
|
47
|
+
to: {
|
|
48
|
+
type: Object as PropType<RouteLocation | null>,
|
|
49
|
+
required: false
|
|
44
50
|
}
|
|
45
51
|
},
|
|
46
|
-
emits: ['click'],
|
|
52
|
+
emits: ['click', 'auxclick'],
|
|
47
53
|
setup(props, { emit }) {
|
|
48
54
|
const map = inject<Ref<Map | null>>(MAP);
|
|
49
55
|
const markerClusterGroup = inject<Ref<MarkerClusterGroup | null>>(MARKERCLUSTERGROUP, ref(null));
|
|
50
|
-
|
|
56
|
+
|
|
51
57
|
const { getColors } = useColors();
|
|
58
|
+
const { handleRoutingEvent } = useRouting();
|
|
59
|
+
|
|
60
|
+
if(!map) {
|
|
61
|
+
throw new Error('FSMapTileLayer must be used inside a FSMap component');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if(!map.value) {
|
|
65
|
+
throw new Error('FSMapTileLayer must be used inside a FSMap component with a map');
|
|
66
|
+
}
|
|
67
|
+
|
|
52
68
|
const getMarkerIcon = () => {
|
|
53
69
|
if(props.variant === 'gps') {
|
|
54
70
|
const size = 16;
|
|
@@ -81,12 +97,32 @@ export default {
|
|
|
81
97
|
|
|
82
98
|
const actualMarker = ref(marker(props.latlng ?? [0, 0], { icon: getMarkerIcon() }));
|
|
83
99
|
|
|
84
|
-
|
|
85
|
-
|
|
100
|
+
const markerElement = computed(() => {
|
|
101
|
+
return actualMarker.value.getElement();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const onClick = (event: MouseEvent) => {
|
|
105
|
+
if(props.to) {
|
|
106
|
+
handleRoutingEvent(event, props.to, true);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
emit('click', {
|
|
111
|
+
...event,
|
|
112
|
+
latlng: props.latlng
|
|
113
|
+
});
|
|
86
114
|
}
|
|
87
115
|
|
|
88
|
-
|
|
89
|
-
|
|
116
|
+
const onAuxClick = (event: MouseEvent) => {
|
|
117
|
+
if(props.to) {
|
|
118
|
+
handleRoutingEvent(event, props.to);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
emit('auxclick', {
|
|
123
|
+
...event,
|
|
124
|
+
latlng: props.latlng
|
|
125
|
+
});
|
|
90
126
|
}
|
|
91
127
|
|
|
92
128
|
watch(map, () => {
|
|
@@ -118,11 +154,14 @@ export default {
|
|
|
118
154
|
actualMarker.value.setLatLng(props.latlng);
|
|
119
155
|
});
|
|
120
156
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
157
|
+
watch(markerElement, (newMarkerElement) => {
|
|
158
|
+
if(!newMarkerElement) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
newMarkerElement.addEventListener('click', onClick);
|
|
163
|
+
newMarkerElement.addEventListener('auxclick', onAuxClick);
|
|
164
|
+
}, { immediate: true });
|
|
126
165
|
|
|
127
166
|
onUnmounted(() => {
|
|
128
167
|
if(actualMarker.value && map.value) {
|
|
@@ -13,7 +13,7 @@ export const useMapLayers = () => {
|
|
|
13
13
|
{
|
|
14
14
|
name: MapLayers.Map,
|
|
15
15
|
label: $tr("ui.map-layer.map", "Map"),
|
|
16
|
-
image: new URL("
|
|
16
|
+
image: new URL("../assets/images/map/map.png", import.meta.url).href,
|
|
17
17
|
layers: [
|
|
18
18
|
tileLayer(`https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key=${apiKey}`, {
|
|
19
19
|
maxZoom: 22,
|
|
@@ -26,7 +26,7 @@ export const useMapLayers = () => {
|
|
|
26
26
|
{
|
|
27
27
|
name: MapLayers.Imagery,
|
|
28
28
|
label: $tr("ui.map-layer.imagery", "Imagery"),
|
|
29
|
-
image: new URL("
|
|
29
|
+
image: new URL("../assets/images/map/imagery.png", import.meta.url).href,
|
|
30
30
|
layers: [
|
|
31
31
|
tileLayer(`https://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}&key=${apiKey}`, {
|
|
32
32
|
maxZoom: 22,
|
|
@@ -39,7 +39,7 @@ export const useMapLayers = () => {
|
|
|
39
39
|
{
|
|
40
40
|
name: MapLayers.Snow,
|
|
41
41
|
label: $tr("ui.map-layer.snow", "Snow ski map"),
|
|
42
|
-
image: new URL("
|
|
42
|
+
image: new URL("../assets/images/map/snow.png", import.meta.url).href,
|
|
43
43
|
layers: [
|
|
44
44
|
tileLayer(`https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key=${apiKey}`, {
|
|
45
45
|
maxZoom: 22,
|
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.159-notification",
|
|
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.159-notification",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "1.0.159-notification"
|
|
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": "bd9f45c4be8554c7778b5388f3d60d25c9244054"
|
|
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 {
|