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