vue-geojson-view-ts 1.3.15 → 1.3.17
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/dist/components/MapSearchAddress.vue.d.ts +1 -1
- package/dist/components/MapView.vue.d.ts +64 -0
- package/dist/style.css +1 -1
- package/dist/vue-geojson-view-ts.js +11962 -13264
- package/dist/vue-geojson-view-ts.umd.cjs +49 -65
- package/package.json +1 -1
- package/src/components/MapView.vue +42 -4
package/package.json
CHANGED
|
@@ -453,11 +453,20 @@ export default defineComponent({
|
|
|
453
453
|
pointToLayer: this.getPointToLayer.bind(this),
|
|
454
454
|
onEachFeature: function (feature, layer) {
|
|
455
455
|
featureGroup.addLayer(layer);
|
|
456
|
-
// Mostrar popup
|
|
456
|
+
// Mostrar popup para Point
|
|
457
457
|
if (feature.geometry.type === "Point") {
|
|
458
458
|
var popupContent = self.getPopupContent(feature);
|
|
459
459
|
layer.bindPopup(popupContent);
|
|
460
460
|
}
|
|
461
|
+
// Mostrar popup para Polygon y MultiPolygon al hacer clic
|
|
462
|
+
else if (
|
|
463
|
+
feature.geometry.type === "Polygon" ||
|
|
464
|
+
feature.geometry.type === "MultiPolygon"
|
|
465
|
+
) {
|
|
466
|
+
var tooltipContent =
|
|
467
|
+
self.getPolygonTooltipContent(feature);
|
|
468
|
+
layer.bindPopup(tooltipContent);
|
|
469
|
+
}
|
|
461
470
|
},
|
|
462
471
|
});
|
|
463
472
|
}
|
|
@@ -475,11 +484,19 @@ export default defineComponent({
|
|
|
475
484
|
L.geoJson(item, {
|
|
476
485
|
onEachFeature: function (feature, layer) {
|
|
477
486
|
featureGroup.addLayer(layer);
|
|
478
|
-
// Mostrar popup
|
|
487
|
+
// Mostrar popup para Point
|
|
479
488
|
if (feature.geometry.type === "Point") {
|
|
480
489
|
var popupContent = self.getPopupContent(feature);
|
|
481
490
|
layer.bindPopup(popupContent);
|
|
482
491
|
}
|
|
492
|
+
// Mostrar popup para Polygon y MultiPolygon al hacer clic
|
|
493
|
+
else if (
|
|
494
|
+
feature.geometry.type === "Polygon" ||
|
|
495
|
+
feature.geometry.type === "MultiPolygon"
|
|
496
|
+
) {
|
|
497
|
+
var tooltipContent = self.getPolygonTooltipContent(feature);
|
|
498
|
+
layer.bindPopup(tooltipContent);
|
|
499
|
+
}
|
|
483
500
|
},
|
|
484
501
|
});
|
|
485
502
|
}
|
|
@@ -638,16 +655,31 @@ export default defineComponent({
|
|
|
638
655
|
// url de la foto
|
|
639
656
|
const fotoId = props.fotoId || "";
|
|
640
657
|
|
|
658
|
+
const formatIsoPreserve = (iso: string): string => {
|
|
659
|
+
const d = new Date(iso);
|
|
660
|
+
if (isNaN(d.getTime())) return iso; // fallback: devolver la cadena original si no es válida
|
|
661
|
+
const pad = (n: number) => n.toString().padStart(2, "0");
|
|
662
|
+
// Usar métodos UTC para evitar que el navegador convierta a la zona local
|
|
663
|
+
const day = pad(d.getUTCDate());
|
|
664
|
+
const month = pad(d.getUTCMonth() + 1);
|
|
665
|
+
const year = d.getUTCFullYear();
|
|
666
|
+
const hours = pad(d.getUTCHours());
|
|
667
|
+
const minutes = pad(d.getUTCMinutes());
|
|
668
|
+
const seconds = pad(d.getUTCSeconds());
|
|
669
|
+
return `${day}-${month}-${year} ${hours}:${minutes}:${seconds}`;
|
|
670
|
+
};
|
|
671
|
+
|
|
641
672
|
// Formatear fecha a dd-MM-yyyy hh:mm:ss
|
|
642
673
|
let fechaFormateada = "";
|
|
643
674
|
if (fechaHoraLlegada) {
|
|
644
|
-
const fecha = new Date(fechaHoraLlegada);
|
|
675
|
+
/* const fecha = new Date(fechaHoraLlegada);
|
|
645
676
|
const pad = (n: number) => n.toString().padStart(2, "0");
|
|
646
677
|
fechaFormateada = `${pad(fecha.getDate())}-${pad(
|
|
647
678
|
fecha.getMonth() + 1
|
|
648
679
|
)}-${fecha.getFullYear()} ${pad(fecha.getHours())}:${pad(
|
|
649
680
|
fecha.getMinutes()
|
|
650
|
-
)}:${pad(fecha.getSeconds())}`;
|
|
681
|
+
)}:${pad(fecha.getSeconds())}`; */
|
|
682
|
+
fechaFormateada = formatIsoPreserve(fechaHoraLlegada);
|
|
651
683
|
}
|
|
652
684
|
let html = "<div>";
|
|
653
685
|
if (fotoId) {
|
|
@@ -660,6 +692,12 @@ export default defineComponent({
|
|
|
660
692
|
html += "</div>";
|
|
661
693
|
return html;
|
|
662
694
|
},
|
|
695
|
+
getPolygonTooltipContent(feature: any): string {
|
|
696
|
+
const props = feature.properties || {};
|
|
697
|
+
const descripcion = props.descripcion || props.name || "Sin descripción";
|
|
698
|
+
|
|
699
|
+
return `<div style="font-weight: bold; padding: 5px;">${descripcion}</div>`;
|
|
700
|
+
},
|
|
663
701
|
},
|
|
664
702
|
watch: {
|
|
665
703
|
coordinatesMap(newVal) {
|