@dative-gpi/foundation-shared-components 0.0.207 → 0.0.209

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.
@@ -11,15 +11,17 @@
11
11
  <FSCol
12
12
  v-if="$slots.leftoverlay"
13
13
  class="fs-map-overlay-left"
14
- height="calc(100% - 32px)"
15
14
  width="hug"
16
15
  gap="2px"
17
16
  >
18
17
  <FSCard
19
- height="100%"
18
+ padding="4px"
19
+ :elevation="true"
20
+ :border="false"
20
21
  >
21
22
  <FSFadeOut
22
- height="fill"
23
+ maskHeight="0"
24
+ :height="`calc(${$props.height} - 40px)`"
23
25
  >
24
26
  <slot
25
27
  name="leftoverlay"
@@ -134,7 +136,7 @@ import "leaflet.markercluster";
134
136
 
135
137
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
136
138
 
137
- import { type Address, type SiteInfos } from '@dative-gpi/foundation-shared-domain/models';
139
+ import { type Address, type FSArea } from '@dative-gpi/foundation-shared-domain/models';
138
140
 
139
141
  import { ColorEnum, type FSLocation, type MapLayer } from "../../models";
140
142
  import { useColors, useAddress } from "../../composables";
@@ -160,7 +162,7 @@ export default defineComponent({
160
162
  },
161
163
  props: {
162
164
  height: {
163
- type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
165
+ type: [String, Number] as PropType<string | number | null>,
164
166
  required: false,
165
167
  default: '400px'
166
168
  },
@@ -169,68 +171,68 @@ export default defineComponent({
169
171
  required: false,
170
172
  default: '100%'
171
173
  },
172
- sites: {
173
- type: Array as PropType<SiteInfos[]>,
174
+ grayscale: {
175
+ type: Boolean,
174
176
  required: false,
175
- default: () => [],
177
+ default: false
176
178
  },
177
- center: {
178
- type: Array as PropType<number[]>,
179
+ editable: {
180
+ type: Boolean,
179
181
  required: false,
180
- default: () => [45.71, 5.07]
182
+ default: false
181
183
  },
182
- selectedLayer: {
183
- type: String as PropType<"osm" | "imagery">,
184
+ showMyLocation: {
185
+ type: Boolean,
184
186
  required: false,
185
- default: "osm"
187
+ default: true
186
188
  },
187
- selectableLayers: {
188
- type: Array as PropType<string[]>,
189
+ showZoomButtons: {
190
+ type: Boolean,
189
191
  required: false,
190
- default: () => ["osm", "imagery"]
192
+ default: true
191
193
  },
192
- selectedLocationId: {
193
- type: String as PropType<string | null>,
194
+ showFullScreen: {
195
+ type: Boolean,
194
196
  required: false,
195
- default: null
197
+ default: false
196
198
  },
197
- selectedSiteId: {
198
- type: String as PropType<string | null>,
199
+ center: {
200
+ type: Array as PropType<number[]>,
199
201
  required: false,
200
- default: null
202
+ default: () => [45.71, 5.07]
201
203
  },
202
204
  modelValue: {
203
205
  type: Array as PropType<FSLocation[]>,
204
206
  required: false,
205
207
  default: () => [],
206
208
  },
207
- editable: {
208
- type: Boolean,
209
+ areas: {
210
+ type: Array as PropType<FSArea[]>,
209
211
  required: false,
210
- default: false
212
+ default: () => [],
211
213
  },
212
- showMyLocation: {
213
- type: Boolean,
214
+ selectedLayer: {
215
+ type: String as PropType<"osm" | "imagery">,
214
216
  required: false,
215
- default: true
217
+ default: "osm"
216
218
  },
217
- showZoomButtons: {
218
- type: Boolean,
219
+ selectableLayers: {
220
+ type: Array as PropType<string[]>,
219
221
  required: false,
220
- default: true
222
+ default: () => ["osm", "imagery"]
221
223
  },
222
- showFullScreen: {
223
- type: Boolean,
224
+ selectedLocationId: {
225
+ type: String as PropType<string | null>,
224
226
  required: false,
225
- default: false
227
+ default: null
226
228
  },
227
- grayscale: {
228
- type: Boolean,
229
+ selectedAreaId: {
230
+ type: String as PropType<string | null>,
229
231
  required: false,
230
- default: false
232
+ default: null
231
233
  }
232
234
  },
233
- emits: ["update:modelValue", "update:selectedLocationId", "update:selectedSiteId"],
235
+ emits: ["update:modelValue", "update:selectedLocationId", "update:selectedAreaId"],
234
236
  setup(props, { emit }) {
235
237
  const { reverseSearch } = useAddress();
236
238
  const { getColors } = useColors();
@@ -246,8 +248,8 @@ export default defineComponent({
246
248
  const mapId = `map-${Math.random().toString(36).substring(7)}`;
247
249
  const defaultZoom = 15;
248
250
  const markers: { [key: string]: L.Marker } = {};
249
- const sites: { [key: string]: L.Polygon } = {};
250
- const siteLayerGroup = new LL.FeatureGroup();
251
+ const areas: { [key: string]: L.Polygon } = {};
252
+ const areaLayerGroup = new LL.FeatureGroup();
251
253
  const baseLayerGroup = new LL.LayerGroup();
252
254
  const myLocationLayerGroup = new LL.LayerGroup();
253
255
 
@@ -291,7 +293,7 @@ export default defineComponent({
291
293
  layer: LL.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
292
294
  attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
293
295
  maxZoom: 19
294
- }),
296
+ })
295
297
  }
296
298
  ];
297
299
 
@@ -307,34 +309,38 @@ export default defineComponent({
307
309
  const displayLocations = () => {
308
310
  markerLayerGroup.clearLayers();
309
311
  innerModelValue.value.forEach((location) => {
310
- const iconHtml = `<div class="fs-map-location-pin"><i class="${location.icon} mdi v-icon notranslate v-theme--DefaultTheme fs-icon" aria-hidden="true" style="--fs-icon-font-size: 22px;" ></i></div>`;
312
+ const iconHtml = `
313
+ <div style="--fs-map-mylocation-pin-color-alpha:${getColors(location.color).base}50;--fs-map-location-pin-color: ${getColors(location.color).base}">
314
+ <div class="fs-map-location-pin">
315
+ <i class="${location.icon} mdi v-icon notranslate v-theme--DefaultTheme fs-icon" aria-hidden="true" style="--fs-icon-font-size: 22px;" ></i>
316
+ </div>
317
+ </div>`;
311
318
  const icon = LL.divIcon({
312
319
  html: iconHtml,
313
- className: 'fs-map-location',
314
320
  iconSize: [36, 36],
321
+ className: 'fs-map-location',
315
322
  iconAnchor: [18, 18],
316
323
  });
317
324
  const marker = LL.marker([location.address.latitude, location.address.longitude], { icon }).addTo(markerLayerGroup);
318
325
  markers[location.id] = marker;
319
326
  marker.on('click', () => emit('update:selectedLocationId', location.id));
320
-
321
327
  });
322
328
  };
323
329
 
324
- const displaySites = () => {
325
- siteLayerGroup.clearLayers();
326
- props.sites.forEach((site) => {
327
- const sitePolygon = LL.polygon(site.coordinates.map((coord) => [coord.latitude, coord.longitude]), {
328
- color: site.color,
329
- fillColor: site.color + "50",
330
+ const displayAreas = () => {
331
+ areaLayerGroup.clearLayers();
332
+ props.areas.forEach((area) => {
333
+ const areaPolygon = LL.polygon(area.coordinates.map((coord) => [coord.latitude, coord.longitude]), {
334
+ color: area.color,
335
+ fillColor: area.color + "50",
330
336
  fillOpacity: 0.5,
331
- className: 'fs-map-site',
332
- }).addTo(siteLayerGroup);
337
+ className: 'fs-map-area',
338
+ }).addTo(areaLayerGroup);
333
339
 
334
- sites[site.id] = sitePolygon;
335
- sitePolygon.on('click', () => emit('update:selectedSiteId', site.id));
340
+ areas[area.id] = areaPolygon;
341
+ areaPolygon.on('click', () => emit('update:selectedAreaId', area.id));
336
342
  });
337
- }
343
+ };
338
344
 
339
345
  const modifyLocationAddress = (locationId: string, newAddress: Address) => {
340
346
  const location = innerModelValue.value.find((loc) => loc.id === locationId);
@@ -363,10 +369,10 @@ export default defineComponent({
363
369
  LL.control.attribution({ position: 'bottomleft' }).addTo(map);
364
370
 
365
371
  baseLayerGroup.addTo(map);
366
- siteLayerGroup.addTo(map);
372
+ areaLayerGroup.addTo(map);
367
373
  myLocationLayerGroup.addTo(map);
368
374
  setMapBaseLayer(innerSelectedLayer.value);
369
- displaySites();
375
+ displayAreas();
370
376
  displayLocations();
371
377
  markerLayerGroup.addTo(map);
372
378
 
@@ -388,8 +394,9 @@ export default defineComponent({
388
394
  };
389
395
 
390
396
  const onNewAddressEntered = (address: Address) => {
391
- if (!map) {return;}
392
- if (!props.selectedLocationId) {return;}
397
+ if (!props.selectedLocationId || !map) {
398
+ return;
399
+ }
393
400
  modifyLocationAddress(props.selectedLocationId, address);
394
401
  map.panTo([address.latitude, address.longitude]);
395
402
  };
@@ -493,17 +500,17 @@ export default defineComponent({
493
500
  });
494
501
 
495
502
  const marker = markers[props.selectedLocationId];
496
- marker.getElement()?.classList.add('fs-map-location-selected');
497
503
  map.flyTo(marker.getLatLng(), 17, { animate: false });
504
+ marker.getElement()?.classList.add('fs-map-location-selected');
498
505
  })
499
506
 
500
- watch(() => props.selectedSiteId, () => {
501
- if (!props.selectedSiteId || !map) {
507
+ watch(() => props.selectedAreaId, () => {
508
+ if (!props.selectedAreaId || !map) {
502
509
  return;
503
510
  }
504
- const site = sites[props.selectedSiteId];
505
- if (site) {
506
- map.fitBounds(site.getBounds(), { maxZoom: 17 });
511
+ const area = areas[props.selectedAreaId];
512
+ if (area) {
513
+ map.fitBounds(area.getBounds(), { maxZoom: 17 });
507
514
  }
508
515
  });
509
516
 
@@ -3,6 +3,7 @@
3
3
  :bottomColor="ColorEnum.Primary"
4
4
  :editable="$props.editable"
5
5
  :modelValue="$props.modelValue"
6
+ :width="$props.width"
6
7
  v-bind="$attrs"
7
8
  >
8
9
  <FSCol
@@ -17,10 +18,10 @@
17
18
  >
18
19
  <FSCol
19
20
  gap="12px"
21
+ :width="`calc(100% - ${imageSize}px - 24px)`"
20
22
  >
21
23
  <FSCol
22
24
  gap="6px"
23
- :width="infoWidth"
24
25
  >
25
26
  <FSText
26
27
  font="text-button"
@@ -141,7 +142,12 @@ export default defineComponent({
141
142
  type: Boolean,
142
143
  required: false,
143
144
  default: true
144
- }
145
+ },
146
+ width: {
147
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
148
+ required: false,
149
+ default: () => [352, 336]
150
+ },
145
151
  },
146
152
  setup(props) {
147
153
  const { isMobileSized } = useBreakpoints();
@@ -190,13 +196,6 @@ export default defineComponent({
190
196
  return isMobileSized.value ? 90 : 100;
191
197
  });
192
198
 
193
- const infoWidth = computed((): number => {
194
- let width = isMobileSized.value ? 288 : 304;
195
- if (props.imageId) {
196
- width -= imageSize.value;
197
- }
198
- return width;
199
- });
200
199
 
201
200
  return {
202
201
  carouselDeviceStatuses,
@@ -205,7 +204,6 @@ export default defineComponent({
205
204
  singleModelStatuses,
206
205
  ColorEnum,
207
206
  imageSize,
208
- infoWidth
209
207
  };
210
208
  }
211
209
  });
@@ -3,6 +3,7 @@
3
3
  :bottomColor="ColorEnum.Error"
4
4
  :editable="$props.editable"
5
5
  :modelValue="$props.modelValue"
6
+ :width="$props.width"
6
7
  v-bind="$attrs"
7
8
  >
8
9
  <FSCol
@@ -17,10 +18,10 @@
17
18
  >
18
19
  <FSCol
19
20
  gap="12px"
21
+ :width="`calc(100% - ${imageSize}px - 24px)`"
20
22
  >
21
23
  <FSCol
22
24
  gap="6px"
23
- :width="infoWidth"
24
25
  >
25
26
  <FSText
26
27
  font="text-button"
@@ -158,7 +159,12 @@ export default defineComponent({
158
159
  type: Boolean,
159
160
  required: false,
160
161
  default: true
161
- }
162
+ },
163
+ width: {
164
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
165
+ required: false,
166
+ default: () => [352, 336]
167
+ },
162
168
  },
163
169
  setup(props) {
164
170
  const { isMobileSized } = useBreakpoints();
@@ -175,20 +181,11 @@ export default defineComponent({
175
181
  return isMobileSized.value ? 90 : 100;
176
182
  });
177
183
 
178
- const infoWidth = computed((): number => {
179
- let width = isMobileSized.value ? 288 : 304;
180
- if (props.imageId) {
181
- width -= imageSize.value;
182
- }
183
- return width;
184
- });
185
-
186
184
  return {
187
185
  ColorEnum,
188
186
  groupsLabel,
189
187
  deviceOrganisationsLabel,
190
- imageSize,
191
- infoWidth
188
+ imageSize
192
189
  };
193
190
  }
194
191
  });
@@ -3,6 +3,7 @@
3
3
  :bottomColor="$props.bottomColor"
4
4
  :editable="$props.editable"
5
5
  :modelValue="$props.modelValue"
6
+ :width="$props.width"
6
7
  v-bind="$attrs"
7
8
  >
8
9
  <FSCol
@@ -17,6 +18,7 @@
17
18
  >
18
19
  <FSCol
19
20
  gap="6px"
21
+ :width="`calc(100% - ${imageSize}px - 24px)`"
20
22
  >
21
23
  <FSText
22
24
  font="text-button"
@@ -113,7 +115,12 @@ export default defineComponent({
113
115
  type: Boolean,
114
116
  required: false,
115
117
  default: true
116
- }
118
+ },
119
+ width: {
120
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
121
+ required: false,
122
+ default: () => [352, 336]
123
+ },
117
124
  },
118
125
  setup(props) {
119
126
  const { isMobileSized } = useBreakpoints();
@@ -126,19 +133,10 @@ export default defineComponent({
126
133
  return isMobileSized.value ? 90 : 100;
127
134
  });
128
135
 
129
- const infoWidth = computed((): number => {
130
- let width = isMobileSized.value ? 288 : 304;
131
- if (props.icon) {
132
- width -= imageSize.value;
133
- }
134
- return width;
135
- });
136
-
137
136
  return {
138
137
  iconBackgroundColor,
139
138
  ColorEnum,
140
- imageSize,
141
- infoWidth
139
+ imageSize
142
140
  };
143
141
  }
144
142
  });
@@ -5,7 +5,6 @@
5
5
  class="fs-tile"
6
6
  padding="12px"
7
7
  :height="height"
8
- :width="width"
9
8
  :style="style"
10
9
  :href="$props.href"
11
10
  :to="$props.to"
@@ -33,7 +32,6 @@
33
32
  class="fs-tile"
34
33
  padding="12px"
35
34
  :style="style"
36
- :width="width"
37
35
  :height="height"
38
36
  v-bind="$attrs"
39
37
  >
@@ -118,17 +116,12 @@ export default defineComponent({
118
116
  return {};
119
117
  });
120
118
 
121
- const width = computed(() => {
122
- return isMobileSized.value ? 336 : 352;
123
- });
124
-
125
119
  const height = computed(() => {
126
120
  return isMobileSized.value ? 156 : 170;
127
121
  });
128
122
 
129
123
  return {
130
124
  height,
131
- width,
132
125
  style
133
126
  };
134
127
  }
package/models/map.ts CHANGED
@@ -14,4 +14,5 @@ export interface FSLocation {
14
14
  label: string;
15
15
  icon: string;
16
16
  address: Address;
17
+ color: string;
17
18
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "0.0.207",
4
+ "version": "0.0.209",
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": "0.0.207",
14
- "@dative-gpi/foundation-shared-services": "0.0.207"
13
+ "@dative-gpi/foundation-shared-domain": "0.0.209",
14
+ "@dative-gpi/foundation-shared-services": "0.0.209"
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": "1387dbf5d3b11c281c0e6183ab900e47c9622a9a"
38
+ "gitHead": "d966cd48ebb0041fd900b986977912114303f722"
39
39
  }
@@ -14,7 +14,7 @@
14
14
  top: 0;
15
15
  left: 0;
16
16
  z-index: 950;
17
- margin: 8px;
17
+ margin: 4px;
18
18
  }
19
19
 
20
20
  .fs-map-overlay-edit-button {
@@ -64,7 +64,6 @@
64
64
  }
65
65
 
66
66
  .fs-map-mylocation {
67
- background-color: var(--fs-map-location-pin-color);
68
67
  border: 3px solid white;
69
68
  border-radius: 100%;
70
69
  animation: fs-map-shadow 1.4s linear infinite;
@@ -84,8 +83,9 @@
84
83
  }
85
84
  }
86
85
 
87
- .fs-map-location {
86
+ .fs-map-location > div {
88
87
  display: flex;
88
+ height: 100%;
89
89
  color: var(--fs-map-location-pin-color);
90
90
  border-radius: 50%;
91
91
  background-color: white;
@@ -93,19 +93,6 @@
93
93
  align-items: center;
94
94
  justify-content: center;
95
95
 
96
- &.fs-map-location-full {
97
- background-color: var(--fs-map-location-pin-color);
98
- color: white;
99
- }
100
-
101
- >* {
102
- transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
103
- }
104
-
105
- .mdi-loading {
106
- animation: spin 1s linear infinite;
107
- }
108
-
109
96
  &:hover {
110
97
  filter: brightness(0.92) drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.4));
111
98
 
@@ -114,32 +101,27 @@
114
101
  transform: scale(1.15);
115
102
  }
116
103
  }
104
+ }
105
+
106
+ .fs-map-location-full > div {
107
+ background-color: var(--fs-map-location-pin-color);
108
+ color: white;
109
+ }
117
110
 
118
- @keyframes spin {
111
+ .fs-map-location-selected > div {
112
+ animation: fs-map-shadow 1.4s linear infinite;
113
+
114
+ @keyframes fs-map-shadow {
119
115
  0% {
120
- transform: rotate(0deg);
116
+ box-shadow: 0 0 0px 0px var(--fs-map-mylocation-pin-color-alpha);
121
117
  }
122
118
 
123
- 100% {
124
- transform: rotate(360deg);
119
+ 50% {
120
+ box-shadow: 0 0 0px 7px var(--fs-map-mylocation-pin-color-alpha);
125
121
  }
126
- }
127
-
128
- &.fs-map-location-selected {
129
- animation: fs-map-shadow 1.4s linear infinite;
130
-
131
- @keyframes fs-map-shadow {
132
- 0% {
133
- box-shadow: 0 0 0px 0px var(--fs-map-mylocation-pin-color-alpha);
134
- }
135
122
 
136
- 50% {
137
- box-shadow: 0 0 0px 7px var(--fs-map-mylocation-pin-color-alpha);
138
- }
139
-
140
- 100% {
141
- box-shadow: 0 0 0px 20px transparent;
142
- }
123
+ 100% {
124
+ box-shadow: 0 0 0px 20px transparent;
143
125
  }
144
126
  }
145
127
  }