vue-geojson-view-ts 1.3.11 → 1.3.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-geojson-view-ts",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -312,10 +312,16 @@ export default defineComponent({
312
312
  feature.geometry.type === "MultiLineString" ||
313
313
  feature.geometry.type === "Point"
314
314
  ) {
315
+ const self = this;
315
316
  L.geoJson(feature, {
316
317
  pointToLayer: this.getPointToLayer.bind(this),
317
318
  onEachFeature: function (feature, layer) {
318
319
  featureGroup.addLayer(layer);
320
+ // Mostrar popup solo para Point
321
+ if (feature.geometry.type === "Point") {
322
+ var popupContent = self.getPopupContent(feature);
323
+ layer.bindPopup(popupContent);
324
+ }
319
325
  },
320
326
  });
321
327
  }
@@ -481,6 +487,32 @@ export default defineComponent({
481
487
  this.mapRender.panTo(newCenter, { animate: true, duration: 0.5 });
482
488
  }
483
489
  },
490
+ getPopupContent(feature: any): string {
491
+ // Puedes personalizar el contenido del popup aquí
492
+ const props = feature.properties || {};
493
+ // Solo toma en cuenta descripcion y fechaHoraLlegada
494
+ const descripcion = props.descripcion || "";
495
+ const fechaHoraLlegada = props.fechaHoraLlegada || "";
496
+
497
+ // Formatear fecha a dd-MM-yyyy hh:mm:ss
498
+ let fechaFormateada = "";
499
+ if (fechaHoraLlegada) {
500
+ const fecha = new Date(fechaHoraLlegada);
501
+ const pad = (n: number) => n.toString().padStart(2, "0");
502
+ fechaFormateada = `${pad(fecha.getDate())}-${pad(
503
+ fecha.getMonth() + 1
504
+ )}-${fecha.getFullYear()} ${pad(fecha.getHours())}:${pad(
505
+ fecha.getMinutes()
506
+ )}:${pad(fecha.getSeconds())}`;
507
+ }
508
+ let html = "<div>";
509
+ html += `<b>Descripción:</b> ${descripcion}<br>`;
510
+ if (fechaFormateada) {
511
+ html += `<b>Fecha Hora Llegada:</b> ${fechaFormateada}<br>`;
512
+ }
513
+ html += "</div>";
514
+ return html;
515
+ },
484
516
  },
485
517
  watch: {
486
518
  coordinatesMap(newVal) {