@dative-gpi/foundation-shared-components 1.0.158 → 1.0.159-foldertile

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.
@@ -389,8 +389,6 @@ export default defineComponent({
389
389
  if(!map.value || !props.bounds) {
390
390
  return;
391
391
  }
392
-
393
- //console.log("Bounds changed", props.bounds);
394
392
  fitBounds(props.bounds, { maxZoom: 14 });
395
393
  });
396
394
 
@@ -3,11 +3,13 @@
3
3
  </template>
4
4
 
5
5
  <script lang="ts">
6
- import { inject, type PropType, type Ref, watch, ref, onUnmounted, onMounted } from 'vue';
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, type LeafletMouseEvent } from 'leaflet';
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
- if(!map) {
85
- throw new Error('FSMapTileLayer must be used inside a FSMap component');
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
- if(!map.value) {
89
- throw new Error('FSMapTileLayer must be used inside a FSMap component with a map');
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
- onMounted(() => {
122
- actualMarker.value.on('click', (event: LeafletMouseEvent) => {
123
- emit('click', event);
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) {
@@ -6,15 +6,80 @@
6
6
  :iconBorder="false"
7
7
  :icon="$props.icon"
8
8
  v-bind="$attrs"
9
- />
9
+ >
10
+ <template
11
+ #append-info
12
+ >
13
+ <FSCol
14
+ gap="6px"
15
+ >
16
+ <FSRow
17
+ align="center-left"
18
+ >
19
+ <FSColor
20
+ height="24px"
21
+ width="24px"
22
+ :color="ColorEnum.Primary"
23
+ :border="false"
24
+ >
25
+ <FSRow
26
+ align="center-center"
27
+ >
28
+ <FSSpan
29
+ font="text-overline"
30
+ >
31
+ {{ foldersBadgeContent }}
32
+ </FSSpan>
33
+ </FSRow>
34
+ </FSColor>
35
+ <FSSpan
36
+ font="text-overline"
37
+ >
38
+ {{ $tr("ui.common.folders", "Folder(s)") }}
39
+ </FSSpan>
40
+ </FSRow>
41
+ <FSRow
42
+ align="center-left"
43
+ >
44
+ <FSColor
45
+ height="24px"
46
+ width="24px"
47
+ :color="ColorEnum.Success"
48
+ :border="false"
49
+ >
50
+ <FSRow
51
+ align="center-center"
52
+ >
53
+ <FSSpan
54
+ font="text-overline"
55
+ >
56
+ {{ dashboardsBadgeContent }}
57
+ </FSSpan>
58
+ </FSRow>
59
+ </FSColor>
60
+ <FSSpan
61
+ font="text-overline"
62
+ >
63
+ {{ $tr("ui.common.dashboards", "Dashboard(s)") }}
64
+ </FSSpan>
65
+ </FSRow>
66
+ </FSCol>
67
+ </template>
68
+ </FSSimpleTileUI>
10
69
  </template>
11
70
 
12
71
  <script lang="ts">
13
72
  import { computed, defineComponent, type PropType } from "vue";
14
73
 
74
+ import { capNumberToString } from '@dative-gpi/foundation-shared-components/utils';
75
+
15
76
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
16
77
 
17
78
  import FSSimpleTileUI from "./FSSimpleTileUI.vue";
79
+ import FSColor from "../FSColor.vue";
80
+ import FSSpan from "../FSSpan.vue";
81
+ import FSCol from "../FSCol.vue";
82
+ import FSRow from "../FSRow.vue";
18
83
 
19
84
  export default defineComponent({
20
85
  name: "FSFolderTileUI",
@@ -28,10 +93,24 @@ export default defineComponent({
28
93
  type: String,
29
94
  required: false,
30
95
  default: "mdi-folder-outline"
31
- }
96
+ },
97
+ recursiveFoldersIds: {
98
+ type: Array as PropType<string[]>,
99
+ required: false,
100
+ default: () => []
101
+ },
102
+ recursiveDashboardsIds: {
103
+ type: Array as PropType<string[]>,
104
+ required: false,
105
+ default: () => []
106
+ },
32
107
  },
33
108
  components: {
34
- FSSimpleTileUI
109
+ FSSimpleTileUI,
110
+ FSColor,
111
+ FSSpan,
112
+ FSCol,
113
+ FSRow
35
114
  },
36
115
  setup(props){
37
116
  const color = computed(() => {
@@ -41,8 +120,15 @@ export default defineComponent({
41
120
  return props.bottomColor;
42
121
  });
43
122
 
123
+ const foldersBadgeContent = computed(() => capNumberToString(props.recursiveFoldersIds.length));
124
+
125
+ const dashboardsBadgeContent = computed(() => capNumberToString(props.recursiveDashboardsIds.length));
126
+
44
127
  return {
45
- color
128
+ color,
129
+ ColorEnum,
130
+ foldersBadgeContent,
131
+ dashboardsBadgeContent,
46
132
  };
47
133
  }
48
134
  });
@@ -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("../../assets/images/map/map.png", import.meta.url).href,
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("../../assets/images/map/imagery.png", import.meta.url).href,
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("../../assets/images/map/snow.png", import.meta.url).href,
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.158",
4
+ "version": "1.0.159-foldertile",
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.158",
14
- "@dative-gpi/foundation-shared-services": "1.0.158"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.159-foldertile",
14
+ "@dative-gpi/foundation-shared-services": "1.0.159-foldertile"
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": "8e284ac045b19fef0565f6ab8026702da3dc12e6"
38
+ "gitHead": "1ed519396d5f588d59a91444d2fa5c1f32d76382"
39
39
  }
@@ -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('ui.common.information', 'Information');
80
+ default: return $tr("ui.common.none", "None");
80
81
  }
81
82
  },
82
83
  statusColor(status: AlertStatus): ColorEnum {