zenit-sdk 0.0.7 → 0.0.8
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/{chunk-ITF7QCUZ.mjs → chunk-52CLFD4L.mjs} +230 -87
- package/dist/chunk-52CLFD4L.mjs.map +1 -0
- package/dist/index.js +229 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react/index.js +229 -86
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-ITF7QCUZ.mjs.map +0 -1
package/dist/index.mjs
CHANGED
package/dist/react/index.js
CHANGED
|
@@ -296,6 +296,7 @@ function getEffectiveLayerOpacity(baseOpacity, zoom, layerType, geometryType, op
|
|
|
296
296
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
297
297
|
var DEFAULT_CENTER = [0, 0];
|
|
298
298
|
var DEFAULT_ZOOM = 3;
|
|
299
|
+
var LABELS_PANE_NAME = "zenit-labels-pane";
|
|
299
300
|
function computeBBoxFromGeojson(geojson) {
|
|
300
301
|
if (!geojson) return null;
|
|
301
302
|
if (!Array.isArray(geojson.features) || geojson.features.length === 0) return null;
|
|
@@ -336,6 +337,23 @@ function mergeBBoxes(bboxes) {
|
|
|
336
337
|
{ ...first }
|
|
337
338
|
);
|
|
338
339
|
}
|
|
340
|
+
function isRecord(value) {
|
|
341
|
+
return typeof value === "object" && value !== null;
|
|
342
|
+
}
|
|
343
|
+
function isGeoJsonFeatureCollection(value) {
|
|
344
|
+
if (!isRecord(value)) return false;
|
|
345
|
+
const features = value.features;
|
|
346
|
+
if (!Array.isArray(features)) return false;
|
|
347
|
+
const type = value.type;
|
|
348
|
+
return type === void 0 || type === "FeatureCollection";
|
|
349
|
+
}
|
|
350
|
+
function extractGeoJsonFeatureCollection(value) {
|
|
351
|
+
if (isRecord(value) && "data" in value) {
|
|
352
|
+
const data = value.data;
|
|
353
|
+
return isGeoJsonFeatureCollection(data) ? data : null;
|
|
354
|
+
}
|
|
355
|
+
return isGeoJsonFeatureCollection(value) ? value : null;
|
|
356
|
+
}
|
|
339
357
|
function getFeatureLayerId(feature) {
|
|
340
358
|
const layerId = feature?.properties?.__zenit_layerId ?? feature?.properties?.layerId ?? feature?.properties?.layer_id;
|
|
341
359
|
if (layerId === void 0 || layerId === null) return null;
|
|
@@ -346,6 +364,7 @@ function escapeHtml(value) {
|
|
|
346
364
|
}
|
|
347
365
|
var DESCRIPTION_KEYS = /* @__PURE__ */ new Set(["descripcion", "description"]);
|
|
348
366
|
var POPUP_EXCLUDED_KEYS = /* @__PURE__ */ new Set(["geom", "geometry"]);
|
|
367
|
+
var POPUP_HEADER_KEYS = ["nombre", "name", "title", "titulo"];
|
|
349
368
|
var POPUP_STYLE_ID = "zenit-leaflet-popup-styles";
|
|
350
369
|
var DESKTOP_POPUP_DIMENSIONS = { maxWidth: 350, minWidth: 280, maxHeight: 480 };
|
|
351
370
|
var MOBILE_POPUP_DIMENSIONS = { maxWidth: 280, minWidth: 240, maxHeight: 380 };
|
|
@@ -372,6 +391,7 @@ var ZENIT_LEAFLET_POPUP_STYLES = `
|
|
|
372
391
|
line-height: 1.5;
|
|
373
392
|
color: #374151;
|
|
374
393
|
min-width: 100%;
|
|
394
|
+
max-height: min(70vh, 480px);
|
|
375
395
|
overflow-y: auto;
|
|
376
396
|
overflow-x: hidden;
|
|
377
397
|
scrollbar-width: thin;
|
|
@@ -422,6 +442,20 @@ var ZENIT_LEAFLET_POPUP_STYLES = `
|
|
|
422
442
|
padding: 16px;
|
|
423
443
|
}
|
|
424
444
|
|
|
445
|
+
.zenit-popup-header {
|
|
446
|
+
padding-bottom: 12px;
|
|
447
|
+
border-bottom: 1px solid #e5e7eb;
|
|
448
|
+
margin-bottom: 4px;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.zenit-popup-title {
|
|
452
|
+
font-size: 14px;
|
|
453
|
+
font-weight: 700;
|
|
454
|
+
color: #111827;
|
|
455
|
+
letter-spacing: 0.01em;
|
|
456
|
+
line-height: 1.4;
|
|
457
|
+
}
|
|
458
|
+
|
|
425
459
|
/* Individual row styling with subtle separator */
|
|
426
460
|
.zenit-popup-row {
|
|
427
461
|
display: flex;
|
|
@@ -460,6 +494,16 @@ var ZENIT_LEAFLET_POPUP_STYLES = `
|
|
|
460
494
|
line-height: 1.5;
|
|
461
495
|
}
|
|
462
496
|
|
|
497
|
+
.zenit-popup-link {
|
|
498
|
+
color: #2563eb;
|
|
499
|
+
text-decoration: underline;
|
|
500
|
+
font-weight: 500;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.zenit-popup-link:hover {
|
|
504
|
+
color: #1d4ed8;
|
|
505
|
+
}
|
|
506
|
+
|
|
463
507
|
/* Special styling for description field */
|
|
464
508
|
.zenit-popup-row.zenit-popup-description {
|
|
465
509
|
background-color: #f9fafb;
|
|
@@ -554,6 +598,18 @@ var ZENIT_LEAFLET_POPUP_STYLES = `
|
|
|
554
598
|
padding: 12px;
|
|
555
599
|
}
|
|
556
600
|
|
|
601
|
+
.zenit-leaflet-popup .leaflet-popup-content {
|
|
602
|
+
max-height: min(65vh, 380px);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.zenit-popup-header {
|
|
606
|
+
padding-bottom: 10px;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.zenit-popup-title {
|
|
610
|
+
font-size: 13px;
|
|
611
|
+
}
|
|
612
|
+
|
|
557
613
|
.zenit-popup-row {
|
|
558
614
|
padding: 8px 0;
|
|
559
615
|
}
|
|
@@ -602,6 +658,17 @@ var ZENIT_LEAFLET_POPUP_STYLES = `
|
|
|
602
658
|
.zenit-map-tooltip::before {
|
|
603
659
|
border-top-color: rgba(31, 41, 55, 0.95);
|
|
604
660
|
}
|
|
661
|
+
|
|
662
|
+
.polygon-label-tooltip {
|
|
663
|
+
z-index: 600 !important;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.zenit-map-shell.popup-open .zenit-label-marker,
|
|
667
|
+
.zenit-map-shell.popup-open .polygon-label-tooltip,
|
|
668
|
+
.zenit-map-shell.popup-open .click-for-detail-hint,
|
|
669
|
+
.zenit-map-shell.popup-open .zenit-map-tooltip {
|
|
670
|
+
display: none !important;
|
|
671
|
+
}
|
|
605
672
|
`;
|
|
606
673
|
function ensurePopupStyles() {
|
|
607
674
|
if (typeof document === "undefined") return;
|
|
@@ -648,6 +715,31 @@ function renderPopupValue(value) {
|
|
|
648
715
|
if (value === null || value === void 0) {
|
|
649
716
|
return '<span class="zenit-popup-empty">Sin datos</span>';
|
|
650
717
|
}
|
|
718
|
+
if (value instanceof Date) {
|
|
719
|
+
return `<span>${escapeHtml(value.toLocaleDateString("es-GT"))}</span>`;
|
|
720
|
+
}
|
|
721
|
+
if (typeof value === "number") {
|
|
722
|
+
return `<span>${escapeHtml(value.toLocaleString("es-GT"))}</span>`;
|
|
723
|
+
}
|
|
724
|
+
if (typeof value === "string") {
|
|
725
|
+
const trimmed = value.trim();
|
|
726
|
+
const isLikelyDate = /^\d{4}-\d{2}-\d{2}/.test(trimmed) || trimmed.includes("T");
|
|
727
|
+
if (isLikelyDate) {
|
|
728
|
+
const parsed = Date.parse(trimmed);
|
|
729
|
+
if (!Number.isNaN(parsed)) {
|
|
730
|
+
return `<span>${escapeHtml(new Date(parsed).toLocaleDateString("es-GT"))}</span>`;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
try {
|
|
734
|
+
const parsedUrl = new URL(trimmed);
|
|
735
|
+
if (parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:") {
|
|
736
|
+
const safeHref = escapeHtml(parsedUrl.toString());
|
|
737
|
+
return `<a class="zenit-popup-link" href="${safeHref}" target="_blank" rel="noopener noreferrer">${safeHref}</a>`;
|
|
738
|
+
}
|
|
739
|
+
} catch {
|
|
740
|
+
}
|
|
741
|
+
return `<span>${escapeHtml(trimmed || value)}</span>`;
|
|
742
|
+
}
|
|
651
743
|
if (typeof value === "object") {
|
|
652
744
|
const json = safeJsonStringify(value);
|
|
653
745
|
return `<pre class="zenit-popup-pre">${escapeHtml(json)}</pre>`;
|
|
@@ -668,13 +760,29 @@ function isDescriptionKey(key) {
|
|
|
668
760
|
const normalized = key.trim().toLowerCase();
|
|
669
761
|
return DESCRIPTION_KEYS.has(normalized);
|
|
670
762
|
}
|
|
763
|
+
function extractPopupHeader(properties) {
|
|
764
|
+
if (!properties) return null;
|
|
765
|
+
const entry = Object.entries(properties).find(
|
|
766
|
+
(candidate) => {
|
|
767
|
+
const [key, value] = candidate;
|
|
768
|
+
return POPUP_HEADER_KEYS.includes(key.trim().toLowerCase()) && typeof value === "string" && value.trim().length > 0;
|
|
769
|
+
}
|
|
770
|
+
);
|
|
771
|
+
if (!entry) return null;
|
|
772
|
+
return entry[1].trim();
|
|
773
|
+
}
|
|
671
774
|
function formatLabel(key) {
|
|
672
775
|
return key.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").trim();
|
|
673
776
|
}
|
|
674
777
|
function createPopupContent(properties) {
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
778
|
+
const headerText = extractPopupHeader(properties);
|
|
779
|
+
const entries = Object.entries(properties).filter(([key, value]) => {
|
|
780
|
+
if (!shouldIncludePopupEntry(key, value)) return false;
|
|
781
|
+
if (headerText && POPUP_HEADER_KEYS.includes(key.trim().toLowerCase())) {
|
|
782
|
+
return false;
|
|
783
|
+
}
|
|
784
|
+
return true;
|
|
785
|
+
});
|
|
678
786
|
if (entries.length === 0) {
|
|
679
787
|
return `<div class="zenit-popup-card"><div class="zenit-popup-empty">Sin datos disponibles</div></div>`;
|
|
680
788
|
}
|
|
@@ -702,7 +810,10 @@ function createPopupContent(properties) {
|
|
|
702
810
|
</div>
|
|
703
811
|
`;
|
|
704
812
|
}).join("");
|
|
705
|
-
|
|
813
|
+
const headerHtml = headerText ? `<div class="zenit-popup-header"><div class="zenit-popup-title">${escapeHtml(
|
|
814
|
+
headerText
|
|
815
|
+
)}</div></div>` : "";
|
|
816
|
+
return `<div class="zenit-popup-card">${headerHtml}${rowsHtml}</div>`;
|
|
706
817
|
}
|
|
707
818
|
function withAlpha(color, alpha) {
|
|
708
819
|
const trimmed = color.trim();
|
|
@@ -927,6 +1038,7 @@ var ZenitMap = (0, import_react.forwardRef)(({
|
|
|
927
1038
|
const [mapInstance, setMapInstance] = (0, import_react.useState)(null);
|
|
928
1039
|
const [panesReady, setPanesReady] = (0, import_react.useState)(false);
|
|
929
1040
|
const [currentZoom, setCurrentZoom] = (0, import_react.useState)(initialZoom ?? DEFAULT_ZOOM);
|
|
1041
|
+
const [isPopupOpen, setIsPopupOpen] = (0, import_react.useState)(false);
|
|
930
1042
|
const [isMobile, setIsMobile] = (0, import_react.useState)(() => {
|
|
931
1043
|
if (typeof window === "undefined") return false;
|
|
932
1044
|
return window.matchMedia("(max-width: 768px)").matches;
|
|
@@ -955,6 +1067,31 @@ var ZenitMap = (0, import_react.forwardRef)(({
|
|
|
955
1067
|
ensurePopupStyles();
|
|
956
1068
|
}
|
|
957
1069
|
}, [featureInfoMode]);
|
|
1070
|
+
(0, import_react.useEffect)(() => {
|
|
1071
|
+
if (featureInfoMode !== "popup") {
|
|
1072
|
+
setIsPopupOpen(false);
|
|
1073
|
+
}
|
|
1074
|
+
}, [featureInfoMode]);
|
|
1075
|
+
(0, import_react.useEffect)(() => {
|
|
1076
|
+
if (!mapInstance) return;
|
|
1077
|
+
const popupPane = mapInstance.getPane("popupPane");
|
|
1078
|
+
if (popupPane) {
|
|
1079
|
+
popupPane.style.zIndex = "800";
|
|
1080
|
+
}
|
|
1081
|
+
const labelsPane = mapInstance.getPane(LABELS_PANE_NAME) ?? mapInstance.createPane(LABELS_PANE_NAME);
|
|
1082
|
+
labelsPane.style.zIndex = "600";
|
|
1083
|
+
}, [mapInstance]);
|
|
1084
|
+
(0, import_react.useEffect)(() => {
|
|
1085
|
+
if (!mapInstance) return;
|
|
1086
|
+
const handlePopupOpen = () => setIsPopupOpen(true);
|
|
1087
|
+
const handlePopupClose = () => setIsPopupOpen(false);
|
|
1088
|
+
mapInstance.on("popupopen", handlePopupOpen);
|
|
1089
|
+
mapInstance.on("popupclose", handlePopupClose);
|
|
1090
|
+
return () => {
|
|
1091
|
+
mapInstance.off("popupopen", handlePopupOpen);
|
|
1092
|
+
mapInstance.off("popupclose", handlePopupClose);
|
|
1093
|
+
};
|
|
1094
|
+
}, [mapInstance]);
|
|
958
1095
|
const layerStyleIndex = (0, import_react.useMemo)(() => {
|
|
959
1096
|
const index = /* @__PURE__ */ new Map();
|
|
960
1097
|
(map?.mapLayers ?? []).forEach((entry) => {
|
|
@@ -1246,15 +1383,13 @@ var ZenitMap = (0, import_react.forwardRef)(({
|
|
|
1246
1383
|
const baseZIndex = 400;
|
|
1247
1384
|
targetLayers.forEach((layer) => {
|
|
1248
1385
|
const order = Number.isFinite(layer.displayOrder) ? layer.displayOrder : 0;
|
|
1386
|
+
const orderOffset = Math.max(0, Math.min(order, 150));
|
|
1249
1387
|
const fillPaneName = `zenit-layer-${layer.layerId}-fill`;
|
|
1250
1388
|
const pointPaneName = `zenit-layer-${layer.layerId}-points`;
|
|
1251
|
-
const labelPaneName = `zenit-layer-${layer.layerId}-labels`;
|
|
1252
1389
|
const fillPane = targetMap.getPane(fillPaneName) ?? targetMap.createPane(fillPaneName);
|
|
1253
1390
|
const pointPane = targetMap.getPane(pointPaneName) ?? targetMap.createPane(pointPaneName);
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
pointPane.style.zIndex = String(baseZIndex + order + 1e3);
|
|
1257
|
-
labelPane.style.zIndex = String(baseZIndex + order + 2e3);
|
|
1391
|
+
fillPane.style.zIndex = String(baseZIndex + orderOffset);
|
|
1392
|
+
pointPane.style.zIndex = String(baseZIndex + orderOffset + 100);
|
|
1258
1393
|
});
|
|
1259
1394
|
},
|
|
1260
1395
|
[]
|
|
@@ -1281,8 +1416,9 @@ var ZenitMap = (0, import_react.forwardRef)(({
|
|
|
1281
1416
|
}));
|
|
1282
1417
|
ensureLayerPanes(mapInstance, layerTargets);
|
|
1283
1418
|
const first = layerTargets[0];
|
|
1284
|
-
const testPane = mapInstance.getPane(`zenit-layer-${first.layerId}-
|
|
1285
|
-
|
|
1419
|
+
const testPane = mapInstance.getPane(`zenit-layer-${first.layerId}-fill`);
|
|
1420
|
+
const labelsPane = mapInstance.getPane(LABELS_PANE_NAME);
|
|
1421
|
+
if (testPane && labelsPane) {
|
|
1286
1422
|
setPanesReady(true);
|
|
1287
1423
|
}
|
|
1288
1424
|
}, [mapInstance, orderedLayers, ensureLayerPanes]);
|
|
@@ -1307,7 +1443,7 @@ var ZenitMap = (0, import_react.forwardRef)(({
|
|
|
1307
1443
|
maxWidth,
|
|
1308
1444
|
minWidth,
|
|
1309
1445
|
maxHeight,
|
|
1310
|
-
className: "zenit-leaflet-popup",
|
|
1446
|
+
className: "zenit-leaflet-popup custom-leaflet-popup",
|
|
1311
1447
|
autoPan: true,
|
|
1312
1448
|
closeButton: true,
|
|
1313
1449
|
keepInView: true,
|
|
@@ -1332,7 +1468,8 @@ var ZenitMap = (0, import_react.forwardRef)(({
|
|
|
1332
1468
|
id: layerId,
|
|
1333
1469
|
geometry: feature.geometry
|
|
1334
1470
|
}).then((response) => {
|
|
1335
|
-
const
|
|
1471
|
+
const geo = extractGeoJsonFeatureCollection(response);
|
|
1472
|
+
const candidates = geo?.features ?? [];
|
|
1336
1473
|
const resolved = pickIntersectFeature(feature, candidates);
|
|
1337
1474
|
if (!resolved?.properties) return;
|
|
1338
1475
|
const mergedProperties = {
|
|
@@ -1535,87 +1672,93 @@ var ZenitMap = (0, import_react.forwardRef)(({
|
|
|
1535
1672
|
boxSizing: "border-box"
|
|
1536
1673
|
},
|
|
1537
1674
|
children: [
|
|
1538
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1539
|
-
|
|
1675
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1676
|
+
"div",
|
|
1540
1677
|
{
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_leaflet.ZoomControl, { position: "topright" }),
|
|
1555
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapInstanceBridge, { onReady: handleMapReady }),
|
|
1556
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FitToBounds, { bbox: explicitZoomBBox ?? void 0 }),
|
|
1557
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoFitToBounds, { bbox: autoZoomBBox ?? void 0, enabled: !explicitZoomBBox }),
|
|
1558
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ZoomBasedOpacityHandler, { onZoomChange: handleZoomChange }),
|
|
1559
|
-
orderedLayers.map((layerState) => {
|
|
1560
|
-
const baseOpacity = layerState.effective?.baseOpacity ?? layerState.effective?.opacity ?? 1;
|
|
1561
|
-
const fillPaneName = `zenit-layer-${layerState.mapLayer.layerId}-fill`;
|
|
1562
|
-
const pointsPaneName = `zenit-layer-${layerState.mapLayer.layerId}-points`;
|
|
1563
|
-
const labelPaneName = `zenit-layer-${layerState.mapLayer.layerId}-labels`;
|
|
1564
|
-
const layerType = layerState.layer?.layerType ?? layerState.mapLayer.layerType ?? void 0;
|
|
1565
|
-
const data = layerState.data?.features ?? [];
|
|
1566
|
-
const fillFeatures = data.filter(isNonPointGeometry);
|
|
1567
|
-
const pointFeatures = data.filter(isPointGeometry);
|
|
1568
|
-
const fillData = fillFeatures.length > 0 ? buildFeatureCollection(fillFeatures) : null;
|
|
1569
|
-
const pointsData = pointFeatures.length > 0 ? buildFeatureCollection(pointFeatures) : null;
|
|
1570
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, { children: [
|
|
1571
|
-
fillData && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1572
|
-
import_react_leaflet.GeoJSON,
|
|
1678
|
+
className: `zenit-map-shell${isPopupOpen ? " popup-open" : ""}`,
|
|
1679
|
+
style: { flex: 1, position: "relative" },
|
|
1680
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1681
|
+
import_react_leaflet.MapContainer,
|
|
1682
|
+
{
|
|
1683
|
+
center,
|
|
1684
|
+
zoom,
|
|
1685
|
+
style: { height: "100%", width: "100%" },
|
|
1686
|
+
scrollWheelZoom: true,
|
|
1687
|
+
zoomControl: false,
|
|
1688
|
+
children: [
|
|
1689
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1690
|
+
import_react_leaflet.TileLayer,
|
|
1573
1691
|
{
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
style: (feature) => buildLayerStyle(layerState.mapLayer.layerId, baseOpacity, feature, layerType),
|
|
1577
|
-
onEachFeature: overlayOnEachFeature
|
|
1692
|
+
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
1693
|
+
attribution: "\xA9 OpenStreetMap contributors"
|
|
1578
1694
|
}
|
|
1579
1695
|
),
|
|
1580
|
-
|
|
1696
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_leaflet.ZoomControl, { position: "topright" }),
|
|
1697
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapInstanceBridge, { onReady: handleMapReady }),
|
|
1698
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FitToBounds, { bbox: explicitZoomBBox ?? void 0 }),
|
|
1699
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoFitToBounds, { bbox: autoZoomBBox ?? void 0, enabled: !explicitZoomBBox }),
|
|
1700
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ZoomBasedOpacityHandler, { onZoomChange: handleZoomChange }),
|
|
1701
|
+
orderedLayers.map((layerState) => {
|
|
1702
|
+
const baseOpacity = layerState.effective?.baseOpacity ?? layerState.effective?.opacity ?? 1;
|
|
1703
|
+
const fillPaneName = `zenit-layer-${layerState.mapLayer.layerId}-fill`;
|
|
1704
|
+
const pointsPaneName = `zenit-layer-${layerState.mapLayer.layerId}-points`;
|
|
1705
|
+
const layerType = layerState.layer?.layerType ?? layerState.mapLayer.layerType ?? void 0;
|
|
1706
|
+
const data = layerState.data?.features ?? [];
|
|
1707
|
+
const fillFeatures = data.filter(isNonPointGeometry);
|
|
1708
|
+
const pointFeatures = data.filter(isPointGeometry);
|
|
1709
|
+
const fillData = fillFeatures.length > 0 ? buildFeatureCollection(fillFeatures) : null;
|
|
1710
|
+
const pointsData = pointFeatures.length > 0 ? buildFeatureCollection(pointFeatures) : null;
|
|
1711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, { children: [
|
|
1712
|
+
fillData && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1713
|
+
import_react_leaflet.GeoJSON,
|
|
1714
|
+
{
|
|
1715
|
+
data: fillData,
|
|
1716
|
+
pane: panesReady && mapInstance?.getPane(fillPaneName) ? fillPaneName : void 0,
|
|
1717
|
+
style: (feature) => buildLayerStyle(layerState.mapLayer.layerId, baseOpacity, feature, layerType),
|
|
1718
|
+
onEachFeature: overlayOnEachFeature
|
|
1719
|
+
}
|
|
1720
|
+
),
|
|
1721
|
+
pointsData && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1722
|
+
import_react_leaflet.GeoJSON,
|
|
1723
|
+
{
|
|
1724
|
+
data: pointsData,
|
|
1725
|
+
pane: panesReady && mapInstance?.getPane(pointsPaneName) ? pointsPaneName : void 0,
|
|
1726
|
+
pointToLayer: (feature, latlng) => import_leaflet.default.circleMarker(latlng, {
|
|
1727
|
+
radius: isMobile ? 8 : 6,
|
|
1728
|
+
...buildLayerStyle(layerState.mapLayer.layerId, baseOpacity, feature, layerType)
|
|
1729
|
+
}),
|
|
1730
|
+
onEachFeature: overlayOnEachFeature
|
|
1731
|
+
}
|
|
1732
|
+
),
|
|
1733
|
+
panesReady && mapInstance?.getPane(LABELS_PANE_NAME) ? labelMarkers.filter(
|
|
1734
|
+
(marker) => String(marker.layerId) === String(layerState.mapLayer.layerId)
|
|
1735
|
+
).map((marker) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1736
|
+
import_react_leaflet.Marker,
|
|
1737
|
+
{
|
|
1738
|
+
position: marker.position,
|
|
1739
|
+
icon: buildLabelIcon(marker.label, marker.opacity, marker.color),
|
|
1740
|
+
interactive: false,
|
|
1741
|
+
pane: LABELS_PANE_NAME
|
|
1742
|
+
},
|
|
1743
|
+
marker.key
|
|
1744
|
+
)) : null
|
|
1745
|
+
] }, layerState.mapLayer.layerId.toString());
|
|
1746
|
+
}),
|
|
1747
|
+
overlayGeojson && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1581
1748
|
import_react_leaflet.GeoJSON,
|
|
1582
1749
|
{
|
|
1583
|
-
data:
|
|
1584
|
-
|
|
1585
|
-
pointToLayer: (feature, latlng) => import_leaflet.default.circleMarker(latlng, {
|
|
1586
|
-
radius: isMobile ? 8 : 6,
|
|
1587
|
-
...buildLayerStyle(layerState.mapLayer.layerId, baseOpacity, feature, layerType)
|
|
1588
|
-
}),
|
|
1750
|
+
data: overlayGeojson,
|
|
1751
|
+
style: overlayStyleFunction,
|
|
1589
1752
|
onEachFeature: overlayOnEachFeature
|
|
1590
|
-
}
|
|
1591
|
-
),
|
|
1592
|
-
panesReady && mapInstance?.getPane(labelPaneName) ? labelMarkers.filter(
|
|
1593
|
-
(marker) => String(marker.layerId) === String(layerState.mapLayer.layerId)
|
|
1594
|
-
).map((marker) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1595
|
-
import_react_leaflet.Marker,
|
|
1596
|
-
{
|
|
1597
|
-
position: marker.position,
|
|
1598
|
-
icon: buildLabelIcon(marker.label, marker.opacity, marker.color),
|
|
1599
|
-
interactive: false,
|
|
1600
|
-
pane: labelPaneName
|
|
1601
1753
|
},
|
|
1602
|
-
|
|
1603
|
-
)
|
|
1604
|
-
]
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
style: overlayStyleFunction,
|
|
1611
|
-
onEachFeature: overlayOnEachFeature
|
|
1612
|
-
},
|
|
1613
|
-
"zenit-overlay-geojson"
|
|
1614
|
-
)
|
|
1615
|
-
]
|
|
1616
|
-
},
|
|
1617
|
-
String(mapId)
|
|
1618
|
-
) }),
|
|
1754
|
+
"zenit-overlay-geojson"
|
|
1755
|
+
)
|
|
1756
|
+
]
|
|
1757
|
+
},
|
|
1758
|
+
String(mapId)
|
|
1759
|
+
)
|
|
1760
|
+
}
|
|
1761
|
+
),
|
|
1619
1762
|
showLayerPanel && decoratedLayers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1620
1763
|
"div",
|
|
1621
1764
|
{
|