@fabriquerdemain/map-react 1.0.0 → 1.0.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.
- package/dist/components/Filters.d.ts +6 -2
- package/dist/components/Filters.d.ts.map +1 -1
- package/dist/components/Map.d.ts.map +1 -1
- package/dist/hooks/useMapFilters.d.ts +5 -1
- package/dist/hooks/useMapFilters.d.ts.map +1 -1
- package/dist/repcartes-map-react.js +16 -5
- package/dist/repcartes-map-react.js.map +1 -1
- package/dist/repcartes-map-react.umd.cjs +16 -5
- package/dist/repcartes-map-react.umd.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -11584,6 +11584,7 @@
|
|
|
11584
11584
|
const markersLayerRef = react.useRef(null);
|
|
11585
11585
|
const markerMapRef = react.useRef(new globalThis.Map());
|
|
11586
11586
|
const tileLayerRef = react.useRef(null);
|
|
11587
|
+
const hasFitBoundsRef = react.useRef(false);
|
|
11587
11588
|
const [currentTileSource, setCurrentTileSource] = react.useState(
|
|
11588
11589
|
"ign"
|
|
11589
11590
|
);
|
|
@@ -11733,11 +11734,12 @@
|
|
|
11733
11734
|
markersLayerRef.current.addLayer(marker);
|
|
11734
11735
|
markerMapRef.current.set(markerData.id, marker);
|
|
11735
11736
|
});
|
|
11736
|
-
if (config.fitBoundsOnLoad && markers.length > 0) {
|
|
11737
|
+
if (config.fitBoundsOnLoad && markers.length > 0 && !hasFitBoundsRef.current) {
|
|
11737
11738
|
const group = L$1.featureGroup(
|
|
11738
11739
|
markers.map((m) => L$1.marker([m.lat, m.lng]))
|
|
11739
11740
|
);
|
|
11740
11741
|
(_a = mapRef.current) == null ? void 0 : _a.fitBounds(group.getBounds(), { padding: [50, 50] });
|
|
11742
|
+
hasFitBoundsRef.current = true;
|
|
11741
11743
|
}
|
|
11742
11744
|
}, [
|
|
11743
11745
|
markers,
|
|
@@ -12078,7 +12080,12 @@
|
|
|
12078
12080
|
value: key,
|
|
12079
12081
|
label: dt.label,
|
|
12080
12082
|
color: dt.color
|
|
12081
|
-
})) : types.map((t) =>
|
|
12083
|
+
})) : types.map((t) => {
|
|
12084
|
+
if (typeof t === "string") {
|
|
12085
|
+
return { value: t, label: t };
|
|
12086
|
+
}
|
|
12087
|
+
return t;
|
|
12088
|
+
});
|
|
12082
12089
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12083
12090
|
"div",
|
|
12084
12091
|
{
|
|
@@ -12255,13 +12262,17 @@
|
|
|
12255
12262
|
return Array.from(cities).sort();
|
|
12256
12263
|
}, [markers]);
|
|
12257
12264
|
const availableTypes = react.useMemo(() => {
|
|
12258
|
-
const
|
|
12265
|
+
const typesMap = /* @__PURE__ */ new Map();
|
|
12259
12266
|
markers.forEach((m) => {
|
|
12260
12267
|
if (m.type) {
|
|
12261
|
-
|
|
12268
|
+
typesMap.set(m.type, {
|
|
12269
|
+
value: m.type,
|
|
12270
|
+
label: m.typeLabel || m.type,
|
|
12271
|
+
color: m.typeColor
|
|
12272
|
+
});
|
|
12262
12273
|
}
|
|
12263
12274
|
});
|
|
12264
|
-
return Array.from(
|
|
12275
|
+
return Array.from(typesMap.values()).sort((a, b) => a.label.localeCompare(b.label));
|
|
12265
12276
|
}, [markers]);
|
|
12266
12277
|
const totalCount = markers.length;
|
|
12267
12278
|
const filteredCount = filteredMarkers.length;
|