@octostar/map-component 0.1.31 → 0.1.32

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.mjs CHANGED
@@ -2952,7 +2952,7 @@ function RecordFieldsSection({ feature }) {
2952
2952
  );
2953
2953
  }
2954
2954
  let persistedTabPreference = "properties";
2955
- function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometry, onClose, isEditMode = true, isReadOnlyLayer = false, layerName, layerId, autoFocusLabel = false, entityCardProvider, typePickerProvider, featureSaveProvider, featureRefreshProvider, onFeatureSaved, onDeleteFeatures, onOpenInNewTab, onEntityContextMenu, layers, onMoveFeaturesToLayer, onCopyFeaturesToLayer, onCreateLayerAndMoveFeatures, onCreateLayerAndCopyFeatures, getFeatureColor, anchorEl }) {
2955
+ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometry, onClose, isEditMode = true, isReadOnlyLayer = false, layerName, layerId, autoFocusLabel = false, entityCardProvider, entityCardPlacement = "tab", inlineEntityCardLabel = "Point Detail", typePickerProvider, featureSaveProvider, featureRefreshProvider, onFeatureSaved, onDeleteFeatures, onOpenInNewTab, onEntityContextMenu, layers, onMoveFeaturesToLayer, onCopyFeaturesToLayer, onCreateLayerAndMoveFeatures, onCreateLayerAndCopyFeatures, getFeatureColor, anchorEl }) {
2956
2956
  var _a, _b, _c, _d, _e;
2957
2957
  const feature = selectedFeatures[0];
2958
2958
  const { toast } = useToast();
@@ -4084,6 +4084,35 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4084
4084
  ] }, key)) })
4085
4085
  ] })
4086
4086
  ] }),
4087
+ entityCardPlacement === "inline-above" && entityCardProvider && !hasMultipleSelection && (() => {
4088
+ const inlineCard = entityCardProvider({
4089
+ type: "Feature",
4090
+ id: feature.id,
4091
+ geometry: feature.geometry,
4092
+ properties: feature.properties
4093
+ });
4094
+ if (!inlineCard) return null;
4095
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4096
+ /* @__PURE__ */ jsx(Divider, { className: "!my-1.5" }),
4097
+ /* @__PURE__ */ jsx(
4098
+ Collapse,
4099
+ {
4100
+ size: "small",
4101
+ defaultActiveKey: ["inline-entity-card"],
4102
+ ghost: true,
4103
+ className: "[&_.ant-collapse-header]:!px-0 [&_.ant-collapse-header]:!py-1 [&_.ant-collapse-content-box]:!px-0 [&_.ant-collapse-content-box]:!py-1",
4104
+ items: [{
4105
+ key: "inline-entity-card",
4106
+ label: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
4107
+ /* @__PURE__ */ jsx(MapPin, { className: "w-3 h-3 text-foreground" }),
4108
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: inlineEntityCardLabel })
4109
+ ] }),
4110
+ children: inlineCard
4111
+ }]
4112
+ }
4113
+ )
4114
+ ] });
4115
+ })(),
4087
4116
  /* @__PURE__ */ jsx(Divider, { className: "!my-1.5" }),
4088
4117
  /* @__PURE__ */ jsx(RecordFieldsSection, { feature }),
4089
4118
  /* @__PURE__ */ jsx(Divider, { className: "!my-1.5" }),
@@ -4126,7 +4155,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4126
4155
  };
4127
4156
  };
4128
4157
  const portalIfAnchored = (jsx2) => anchorEl ? createPortal(jsx2, document.body) : jsx2;
4129
- if (entityCardProvider) {
4158
+ if (entityCardProvider && (entityCardPlacement !== "inline-above" || hasMultipleSelection)) {
4130
4159
  const cardsPositioned = computePanelPosition(320, "w-80");
4131
4160
  const cardsPanel = /* @__PURE__ */ jsxs(
4132
4161
  "div",
@@ -5784,6 +5813,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
5784
5813
  onMapStateLoaded,
5785
5814
  interceptGeoJSONFileLoad,
5786
5815
  entityCardProvider,
5816
+ entityCardPlacement,
5817
+ inlineEntityCardLabel,
5787
5818
  typePickerProvider,
5788
5819
  contextMenuProvider,
5789
5820
  featureSaveProvider,
@@ -7864,6 +7895,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7864
7895
  }
7865
7896
  });
7866
7897
  setSelectedFeatureIds(ids);
7898
+ selectedFeatureIdsRef.current = ids;
7867
7899
  setShowProperties(ids.length > 0);
7868
7900
  syncRef.current();
7869
7901
  onFeatureSelect == null ? void 0 : onFeatureSelect(e.features);
@@ -9307,13 +9339,22 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9307
9339
  } else {
9308
9340
  let updatedFeature;
9309
9341
  readOnlyFeatures.current.forEach((features, layerId) => {
9310
- var _a2;
9342
+ var _a2, _b2;
9311
9343
  const idx = features.findIndex((f) => String(f.id) === featureId);
9312
9344
  if (idx !== -1) {
9313
9345
  const f = features[idx];
9346
+ let hasRealChange = false;
9347
+ Object.entries(normalizedProperties).forEach(([key, value]) => {
9348
+ var _a3;
9349
+ const oldVal = (_a3 = f.properties) == null ? void 0 : _a3[key];
9350
+ if (JSON.stringify(oldVal) !== JSON.stringify(value)) hasRealChange = true;
9351
+ });
9352
+ const currentUnsaved = (_a2 = f.properties) == null ? void 0 : _a2._unsaved;
9314
9353
  f.properties = { ...f.properties, ...normalizedProperties };
9315
- if (!externalPersistence) f.properties._unsaved = true;
9316
- if (properties.kind === "text" || ((_a2 = f.properties) == null ? void 0 : _a2.kind) === "text") {
9354
+ if (!externalPersistence && hasRealChange && currentUnsaved !== false) {
9355
+ f.properties._unsaved = true;
9356
+ }
9357
+ if (properties.kind === "text" || ((_b2 = f.properties) == null ? void 0 : _b2.kind) === "text") {
9317
9358
  delete f.properties.text;
9318
9359
  }
9319
9360
  layerTemporalCacheRef.current.delete(layerId);
@@ -12527,6 +12568,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
12527
12568
  layerId,
12528
12569
  autoFocusLabel,
12529
12570
  entityCardProvider,
12571
+ entityCardPlacement,
12572
+ inlineEntityCardLabel,
12530
12573
  typePickerProvider,
12531
12574
  featureSaveProvider,
12532
12575
  featureRefreshProvider,