@geotrekce/geotrek-rando-widget 0.36.0 → 0.36.1

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.
Files changed (39) hide show
  1. package/dist/cjs/grw-common-button_23.cjs.entry.js +28 -23
  2. package/dist/cjs/grw-common-button_23.cjs.entry.js.br +0 -0
  3. package/dist/cjs/grw-common-button_23.cjs.entry.js.gz +0 -0
  4. package/dist/cjs/grw-common-button_23.cjs.entry.js.map +1 -1
  5. package/dist/collection/components/grw-map/grw-map.js +28 -24
  6. package/dist/collection/components/grw-map/grw-map.js.br +0 -0
  7. package/dist/collection/components/grw-map/grw-map.js.gz +0 -0
  8. package/dist/collection/components/grw-map/grw-map.js.map +1 -1
  9. package/dist/esm/grw-common-button_23.entry.js +28 -23
  10. package/dist/esm/grw-common-button_23.entry.js.br +0 -0
  11. package/dist/esm/grw-common-button_23.entry.js.gz +0 -0
  12. package/dist/esm/grw-common-button_23.entry.js.map +1 -1
  13. package/dist/esm-es5/grw-common-button_23.entry.js +1 -1
  14. package/dist/esm-es5/grw-common-button_23.entry.js.br +0 -0
  15. package/dist/esm-es5/grw-common-button_23.entry.js.gz +0 -0
  16. package/dist/esm-es5/grw-common-button_23.entry.js.map +1 -1
  17. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  18. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js.br +0 -0
  19. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js.gz +0 -0
  20. package/dist/geotrek-rando-widget/p-5c4f86fd.system.entry.js +4 -0
  21. package/dist/geotrek-rando-widget/p-5c4f86fd.system.entry.js.br +0 -0
  22. package/dist/geotrek-rando-widget/p-5c4f86fd.system.entry.js.gz +0 -0
  23. package/dist/geotrek-rando-widget/p-5c4f86fd.system.entry.js.map +1 -0
  24. package/dist/geotrek-rando-widget/p-SrqKQbd3.system.js +1 -1
  25. package/dist/geotrek-rando-widget/p-SrqKQbd3.system.js.br +0 -0
  26. package/dist/geotrek-rando-widget/p-SrqKQbd3.system.js.gz +0 -0
  27. package/dist/geotrek-rando-widget/p-b1e1106e.entry.js +4 -0
  28. package/dist/geotrek-rando-widget/p-b1e1106e.entry.js.br +0 -0
  29. package/dist/geotrek-rando-widget/p-b1e1106e.entry.js.gz +0 -0
  30. package/dist/geotrek-rando-widget/p-b1e1106e.entry.js.map +1 -0
  31. package/package.json +1 -1
  32. package/dist/geotrek-rando-widget/p-310d109e.entry.js +0 -4
  33. package/dist/geotrek-rando-widget/p-310d109e.entry.js.br +0 -0
  34. package/dist/geotrek-rando-widget/p-310d109e.entry.js.gz +0 -0
  35. package/dist/geotrek-rando-widget/p-310d109e.entry.js.map +0 -1
  36. package/dist/geotrek-rando-widget/p-bea8d184.system.entry.js +0 -4
  37. package/dist/geotrek-rando-widget/p-bea8d184.system.entry.js.br +0 -0
  38. package/dist/geotrek-rando-widget/p-bea8d184.system.entry.js.gz +0 -0
  39. package/dist/geotrek-rando-widget/p-bea8d184.system.entry.js.map +0 -1
@@ -1787,7 +1787,7 @@ const GrwMap = class {
1787
1787
  else if (store.state.touristicEvents) {
1788
1788
  this.addTouristicEvents();
1789
1789
  }
1790
- else if (store.state.outdoorSites) {
1790
+ else if (store.state.currentOutdoorSites || store.state.outdoorSites) {
1791
1791
  this.addOutdoorSites();
1792
1792
  }
1793
1793
  store.onChange('currentTreks', () => {
@@ -3319,7 +3319,7 @@ const GrwMap = class {
3319
3319
  }
3320
3320
  }
3321
3321
  async addOutdoorSites(resetBounds = false) {
3322
- var _a, _b;
3322
+ var _a, _b, _c;
3323
3323
  (_a = this.addOutdoorSitesController) === null || _a === void 0 ? void 0 : _a.abort();
3324
3324
  this.addOutdoorSitesController = new AbortController();
3325
3325
  const { signal } = this.addOutdoorSitesController;
@@ -3331,26 +3331,31 @@ const GrwMap = class {
3331
3331
  };
3332
3332
  if (store.state.currentOutdoorSites) {
3333
3333
  for (const currentOutdoorSite of store.state.currentOutdoorSites) {
3334
- outdoorSitesFeatureCollection.features.push({
3335
- type: 'Feature',
3336
- geometry: { type: 'Point', coordinates: pointOnFeature(currentOutdoorSite.geometry).geometry.coordinates },
3337
- properties: {
3338
- id: currentOutdoorSite.id,
3339
- name: currentOutdoorSite.name,
3340
- practice: (_b = store.state.outdoorPractices.find(practice => practice.id === currentOutdoorSite.practice)) === null || _b === void 0 ? void 0 : _b.pictogram,
3341
- imgSrc: currentOutdoorSite.attachments && currentOutdoorSite.attachments.filter(attachment => attachment.type === 'image').length > 0
3342
- ? currentOutdoorSite.attachments[0].thumbnail !== ''
3343
- ? currentOutdoorSite.attachments[0].thumbnail
3344
- : currentOutdoorSite.attachments[0].url
3345
- : null,
3346
- },
3347
- });
3334
+ if (currentOutdoorSite.geometry) {
3335
+ const outdoorSiteCoordinates = pointOnFeature(currentOutdoorSite.geometry).geometry.coordinates;
3336
+ outdoorSitesCurrentCoordinates.push(outdoorSiteCoordinates);
3337
+ outdoorSitesFeatureCollection.features.push({
3338
+ type: 'Feature',
3339
+ geometry: { type: 'Point', coordinates: outdoorSiteCoordinates },
3340
+ properties: {
3341
+ id: currentOutdoorSite.id,
3342
+ name: currentOutdoorSite.name,
3343
+ practice: (_c = (_b = store.state.outdoorPractices) === null || _b === void 0 ? void 0 : _b.find(practice => practice.id === currentOutdoorSite.practice)) === null || _c === void 0 ? void 0 : _c.pictogram,
3344
+ imgSrc: currentOutdoorSite.attachments && currentOutdoorSite.attachments.filter(attachment => attachment.type === 'image').length > 0
3345
+ ? currentOutdoorSite.attachments[0].thumbnail !== ''
3346
+ ? currentOutdoorSite.attachments[0].thumbnail
3347
+ : currentOutdoorSite.attachments[0].url
3348
+ : null,
3349
+ },
3350
+ });
3351
+ }
3348
3352
  }
3349
3353
  }
3350
3354
  if (!this.outdoorSitesLayer) {
3351
3355
  if ((outdoorSitesCurrentCoordinates.length > 0 && !store.state.currentMapBounds) || resetBounds) {
3352
- const outdoorSitesBbox = bbox(outdoorSitesFeatureCollection);
3353
- this.bounds = grwDb_service.L.latLngBounds([outdoorSitesBbox[1], outdoorSitesBbox[0]], [outdoorSitesBbox[3], outdoorSitesBbox[2]]);
3356
+ if (outdoorSitesCurrentCoordinates.length > 0) {
3357
+ this.bounds = grwDb_service.L.latLngBounds(outdoorSitesCurrentCoordinates.map(outdoorSiteCoordinate => [outdoorSiteCoordinate[1], outdoorSiteCoordinate[0]]));
3358
+ }
3354
3359
  }
3355
3360
  else {
3356
3361
  if (store.state.currentMapBounds) {
@@ -3423,7 +3428,7 @@ const GrwMap = class {
3423
3428
  }
3424
3429
  else {
3425
3430
  if (outdoorSitesCurrentCoordinates.length > 0) {
3426
- this.bounds = grwDb_service.L.latLngBounds(outdoorSitesCurrentCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
3431
+ this.bounds = grwDb_service.L.latLngBounds(outdoorSitesCurrentCoordinates.map(outdoorSiteCoordinate => [outdoorSiteCoordinate[1], outdoorSiteCoordinate[0]]));
3427
3432
  }
3428
3433
  else {
3429
3434
  this.map.fire('moveend');
@@ -3434,7 +3439,7 @@ const GrwMap = class {
3434
3439
  this.outdoorSitesMarkerClusterGroup.addLayer(this.outdoorSitesLayer);
3435
3440
  }
3436
3441
  this.map.invalidateSize();
3437
- this.bounds && this.map.fitBounds(this.bounds);
3442
+ this.bounds && this.bounds._northEast && this.bounds._southWest && this.map.fitBounds(this.bounds);
3438
3443
  !this.mapIsReady && (this.mapIsReady = !this.mapIsReady);
3439
3444
  this.map.on('moveend', this.handleOutdoorSitesWithinBoundsBind);
3440
3445
  }
@@ -4364,7 +4369,7 @@ const GrwMap = class {
4364
4369
  render() {
4365
4370
  const layersImageSrc = index.getAssetPath(`${index.Build.isDev ? '/' : ''}assets/layers.svg`);
4366
4371
  const contractImageSrc = index.getAssetPath(`${index.Build.isDev ? '/' : ''}assets/contract.svg`);
4367
- return (index.h(index.Host, { key: '660af447b3f031bc5e28147435b3477044fc6b83', ref: el => (this.hostElement = el), style: {
4372
+ return (index.h(index.Host, { key: 'ece878d1fd0697f0a3b74fb258efc72536374e00', ref: el => (this.hostElement = el), style: {
4368
4373
  '--font-family': this.fontFamily,
4369
4374
  '--color-primary-app': this.colorPrimaryApp,
4370
4375
  '--color-on-surface': this.colorOnSurface,
@@ -4379,13 +4384,13 @@ const GrwMap = class {
4379
4384
  '--elevation-height': (this.mapElement.getBoundingClientRect().width >= this.largeViewSize / 2 ? this.elevationHeight : this.mobileElevationHeight)
4380
4385
  .toString()
4381
4386
  .concat('px'),
4382
- } }, index.h("div", { key: 'cf62392e32fd128af6d90d60e39247bd95c653e0', id: "map", part: "map", class: (store.state.currentTouristicContent || store.state.currentTouristicEvent || store.state.currentOutdoorSite || store.state.currentOutdoorCourse) && this.grwApp
4387
+ } }, index.h("div", { key: 'f1a333b0c25f58f307f1694805fd17f8aed14568', id: "map", part: "map", class: (store.state.currentTouristicContent || store.state.currentTouristicEvent || store.state.currentOutdoorSite || store.state.currentOutdoorCourse) && this.grwApp
4383
4388
  ? 'common-map'
4384
4389
  : store.state.currentTrek && this.elevationControl && this.elevationControl.eleDiv.style.display === 'block'
4385
4390
  ? 'trek-map-and-elevation'
4386
4391
  : store.state.currentTrek
4387
4392
  ? 'trek-map'
4388
- : 'treks-map', ref: el => (this.mapRef = el) }, this.layerDataIsLoading && (index.h("div", { key: '3f20fc7d5f622b3ce15ca1fba82b3a5b7e95d65a', class: "layer-loader-container" }, index.h("div", { key: '0a10f25e641a5359beeddc4151c786f2963cfcfd', class: "layer-loader" }))), store.state.currentTrek && (index.h("div", { key: '60af870cccbd54af4a17d41cb077323dafb526e9', class: "grw-elevation-visibility-button-container" }, index.h("grw-fab", { key: '7cba9eab5058e5527cafa8d5b6b6b894c20cfc85', exportparts: "fab-visibility-button,fab-visibility-button-icon,fab-visibility-button-label", "font-family": this.fontFamily, action: () => this.handleElevation(), icon: () => (this.elevationControl && this.elevationControl.eleDiv.style.display === 'block' ? 'show-elevation' : 'hide-elevation'), showTitle: i18n.translate[store.state.language].showElevation, hideTitle: i18n.translate[store.state.language].hideElevation, "fab-background-color": this.fabBackgroundColor, "fab-color": this.fabColor })))), !this.mapIsReady && (index.h("div", { key: '87b498ff66ad70a05c0c38d64f8cf1e70ce9f182', part: "map-loader-container", class: "map-loader-container" }, index.h("span", { key: '3fe8256f8b71c82a50280faa442318b4b791670c', part: "loader", class: "loader" })))));
4393
+ : 'treks-map', ref: el => (this.mapRef = el) }, this.layerDataIsLoading && (index.h("div", { key: '4734cb32cfbfbb5f7c56da5297060c66818e11d2', class: "layer-loader-container" }, index.h("div", { key: 'a66acd9e1b56fb0bf10ad6c2640f848e4e4c9067', class: "layer-loader" }))), store.state.currentTrek && (index.h("div", { key: '3ea2af00520108e355fa3fb9ca1992f3ac0b965f', class: "grw-elevation-visibility-button-container" }, index.h("grw-fab", { key: '67b58eacab9ce933d733c37900266ba52af69283', exportparts: "fab-visibility-button,fab-visibility-button-icon,fab-visibility-button-label", "font-family": this.fontFamily, action: () => this.handleElevation(), icon: () => (this.elevationControl && this.elevationControl.eleDiv.style.display === 'block' ? 'show-elevation' : 'hide-elevation'), showTitle: i18n.translate[store.state.language].showElevation, hideTitle: i18n.translate[store.state.language].hideElevation, "fab-background-color": this.fabBackgroundColor, "fab-color": this.fabColor })))), !this.mapIsReady && (index.h("div", { key: 'dea2998507605538cbf3eab317539c1e09891b13', part: "map-loader-container", class: "map-loader-container" }, index.h("span", { key: '4b65479e862fea15d3a724b36e0b2da6c499a9e1', part: "loader", class: "loader" })))));
4389
4394
  }
4390
4395
  get mapElement() { return index.getElement(this); }
4391
4396
  };