@dative-gpi/foundation-shared-components 0.0.196 → 0.0.198

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.
@@ -96,9 +96,8 @@
96
96
  <script lang="ts">
97
97
  import { computed, defineComponent, onMounted, type PropType, ref, watch } from "vue";
98
98
 
99
- import * as L from "leaflet";
99
+ import type * as L from "leaflet";
100
100
  import "leaflet.markercluster";
101
- import { MarkerClusterGroup } from "leaflet";
102
101
 
103
102
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
104
103
 
@@ -197,6 +196,8 @@ export default defineComponent({
197
196
  const { getColors } = useColors();
198
197
  const { $tr } = useTranslationsProvider();
199
198
 
199
+ const LL = window.L;
200
+
200
201
  const innerSelectedLayer = ref(props.selectedLayer);
201
202
  const innerModelValue = ref(props.modelValue);
202
203
  const editingLocation = ref(false);
@@ -205,23 +206,23 @@ export default defineComponent({
205
206
  const defaultZoom = 15;
206
207
  const markers: { [key: string]: L.Marker } = {};
207
208
  const sites: { [key: string]: L.Polygon } = {};
208
- const siteLayerGroup = new L.FeatureGroup();
209
- const baseLayerGroup = new L.LayerGroup();
210
- const myLocationLayerGroup = new L.LayerGroup();
209
+ const siteLayerGroup = new LL.FeatureGroup();
210
+ const baseLayerGroup = new LL.LayerGroup();
211
+ const myLocationLayerGroup = new LL.LayerGroup();
211
212
 
212
213
  let map: L.Map;
213
- let markerLayerGroup: L.FeatureGroup | MarkerClusterGroup;
214
+ let markerLayerGroup: L.FeatureGroup | any;
214
215
 
215
216
  if (props.editable) {
216
- markerLayerGroup = new L.FeatureGroup();
217
+ markerLayerGroup = new LL.FeatureGroup();
217
218
  }
218
219
  else {
219
- markerLayerGroup = new MarkerClusterGroup({
220
+ markerLayerGroup = new LL.MarkerClusterGroup({
220
221
  spiderfyOnMaxZoom: false,
221
222
  showCoverageOnHover: false,
222
223
  disableClusteringAtZoom: 17,
223
224
  iconCreateFunction: function (cluster: any) {
224
- return L.divIcon({
225
+ return LL.divIcon({
225
226
  html: `<div>
226
227
  <span>${cluster.getChildCount()}</span>
227
228
  </div>`,
@@ -236,7 +237,7 @@ export default defineComponent({
236
237
  {
237
238
  name: "osm",
238
239
  label: $tr("ui.map.layer.osm", "Map"),
239
- layer: L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
240
+ layer: LL.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
240
241
  maxZoom: 20,
241
242
  attribution: '© OpenStreetMap'
242
243
  })
@@ -244,7 +245,7 @@ export default defineComponent({
244
245
  {
245
246
  name: "imagery",
246
247
  label: $tr("ui.map.layer.imagery", "Imagery"),
247
- layer: L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
248
+ layer: LL.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
248
249
  attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
249
250
  maxZoom: 19
250
251
  }),
@@ -264,13 +265,13 @@ export default defineComponent({
264
265
  markerLayerGroup.clearLayers();
265
266
  innerModelValue.value.forEach((location) => {
266
267
  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>`;
267
- const icon = L.divIcon({
268
+ const icon = LL.divIcon({
268
269
  html: iconHtml,
269
270
  className: 'fs-map-location',
270
271
  iconSize: [36, 36],
271
272
  iconAnchor: [18, 18],
272
273
  });
273
- const marker = L.marker([location.address.latitude, location.address.longitude], { icon }).addTo(markerLayerGroup);
274
+ const marker = LL.marker([location.address.latitude, location.address.longitude], { icon }).addTo(markerLayerGroup);
274
275
  markers[location.id] = marker;
275
276
  marker.on('click', () => emit('update:selectedLocationId', location.id));
276
277
 
@@ -280,7 +281,7 @@ export default defineComponent({
280
281
  const displaySites = () => {
281
282
  siteLayerGroup.clearLayers();
282
283
  props.sites.forEach((site) => {
283
- const sitePolygon = L.polygon(site.coordinates.map((coord) => [coord.latitude, coord.longitude]), {
284
+ const sitePolygon = LL.polygon(site.coordinates.map((coord) => [coord.latitude, coord.longitude]), {
284
285
  color: site.color,
285
286
  fillColor: site.color + "50",
286
287
  fillOpacity: 0.5,
@@ -311,12 +312,12 @@ export default defineComponent({
311
312
  zoomControl: false,
312
313
  scrollWheelZoom: false,
313
314
  minZoom: 2,
314
- maxBounds: L.latLngBounds(L.latLng(-90, -180), L.latLng(90, 180)),
315
+ maxBounds: LL.latLngBounds(LL.latLng(-90, -180), LL.latLng(90, 180)),
315
316
  maxBoundsViscosity: 1.0
316
317
  };
317
- map = L.map(mapId, mapOptions).setView([props.center[0], props.center[1]], defaultZoom);
318
+ map = LL.map(mapId, mapOptions).setView([props.center[0], props.center[1]], defaultZoom);
318
319
  map.attributionControl.remove();
319
- L.control.attribution({ position: 'bottomleft' }).addTo(map);
320
+ LL.control.attribution({ position: 'bottomleft' }).addTo(map);
320
321
 
321
322
  baseLayerGroup.addTo(map);
322
323
  siteLayerGroup.addTo(map);
@@ -375,14 +376,14 @@ export default defineComponent({
375
376
  map?.on('locationfound', (e: L.LocationEvent) => {
376
377
  map?.flyTo(e.latlng, map?.getZoom() ?? defaultZoom);
377
378
  const iconHtml = `<div class="fs-map-mylocation-pin"></div>`;
378
- const icon = L.divIcon({
379
+ const icon = LL.divIcon({
379
380
  html: iconHtml,
380
381
  className: 'fs-map-mylocation',
381
382
  iconSize: [16, 16],
382
383
  iconAnchor: [8, 8],
383
384
  });
384
385
  myLocationLayerGroup.clearLayers();
385
- L.marker(e.latlng, { icon }).addTo(myLocationLayerGroup);
386
+ LL.marker(e.latlng, { icon }).addTo(myLocationLayerGroup);
386
387
  });
387
388
  };
388
389
 
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.196",
4
+ "version": "0.0.198",
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.196",
14
- "@dative-gpi/foundation-shared-services": "0.0.196",
13
+ "@dative-gpi/foundation-shared-domain": "0.0.198",
14
+ "@dative-gpi/foundation-shared-services": "0.0.198",
15
15
  "leaflet": "1.9.4",
16
16
  "leaflet.markercluster": "1.5.3"
17
17
  },
@@ -35,5 +35,5 @@
35
35
  "sass": "1.71.1",
36
36
  "sass-loader": "13.3.2"
37
37
  },
38
- "gitHead": "ca582d1a902c182973377dd0cae44181088f932f"
38
+ "gitHead": "0144f9154fe11cd6f311cb8c73e9eea17a90e229"
39
39
  }