@octostar/map-component 0.1.26 → 0.1.27

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/index.cjs CHANGED
@@ -7900,8 +7900,49 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7900
7900
  });
7901
7901
  },
7902
7902
  addFeatures: (layerId, features) => {
7903
+ var _a;
7903
7904
  const layer = layersRef.current.find((l) => l.id === layerId);
7904
- if (!layer || !draw.current || !isMapLoadedRef.current) return [];
7905
+ if (!layer || !isMapLoadedRef.current) return [];
7906
+ if (layer.readOnly) {
7907
+ const existing = readOnlyFeatures.current.get(layerId) || [];
7908
+ let layerHasTemporal = ((_a = layerTemporalCacheRef.current.get(layerId)) == null ? void 0 : _a.hasTemporal) ?? false;
7909
+ const newFeaturesWithIds = features.map((f) => {
7910
+ const id = f.id ? String(f.id) : crypto.randomUUID();
7911
+ const props = f.properties || {};
7912
+ if (!hasAnyTemporalValue(props)) {
7913
+ return { ...f, id };
7914
+ }
7915
+ const { startDate, endDate } = normalizeTemporalProperties(props);
7916
+ if (startDate || endDate) layerHasTemporal = true;
7917
+ return {
7918
+ ...f,
7919
+ id,
7920
+ properties: {
7921
+ ...props,
7922
+ startDate: (startDate == null ? void 0 : startDate.toISOString()) || null,
7923
+ endDate: (endDate == null ? void 0 : endDate.toISOString()) || null
7924
+ }
7925
+ };
7926
+ });
7927
+ const combined = [...existing, ...newFeaturesWithIds];
7928
+ readOnlyFeatures.current.set(layerId, combined);
7929
+ layerTemporalCacheRef.current.set(layerId, { featureCount: combined.length, hasTemporal: layerHasTemporal });
7930
+ const addedIds2 = newFeaturesWithIds.map((f) => String(f.id));
7931
+ const updatedLayers2 = layersRef.current.map(
7932
+ (l) => l.id === layerId ? { ...l, featureIds: [...l.featureIds, ...addedIds2] } : l
7933
+ );
7934
+ layersRef.current = updatedLayers2;
7935
+ setLayers(updatedLayers2);
7936
+ updateFeatureCount();
7937
+ if (layerHasTemporal) {
7938
+ scheduleTimelineUpdate();
7939
+ }
7940
+ requestAnimationFrame(() => {
7941
+ syncRef.current();
7942
+ });
7943
+ return addedIds2;
7944
+ }
7945
+ if (!draw.current) return [];
7905
7946
  const addedIds = [];
7906
7947
  isApiAddingRef.current = true;
7907
7948
  try {