@octostar/map-component 0.1.16 → 0.1.19

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.
Files changed (51) hide show
  1. package/dist/index.cjs +61 -35
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.mjs +62 -36
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/types/components/action-panel.d.ts +8 -0
  6. package/dist/types/components/action-panel.d.ts.map +1 -0
  7. package/dist/types/components/cluster-pie-chart.d.ts +16 -0
  8. package/dist/types/components/cluster-pie-chart.d.ts.map +1 -0
  9. package/dist/types/components/color-picker-popover.d.ts +9 -0
  10. package/dist/types/components/color-picker-popover.d.ts.map +1 -0
  11. package/dist/types/components/debug-sidebar.d.ts +14 -0
  12. package/dist/types/components/debug-sidebar.d.ts.map +1 -0
  13. package/dist/types/components/demos/feature-editor-demo.d.ts +2 -0
  14. package/dist/types/components/demos/feature-editor-demo.d.ts.map +1 -0
  15. package/dist/types/components/demos/point-editor-demo.d.ts +2 -0
  16. package/dist/types/components/demos/point-editor-demo.d.ts.map +1 -0
  17. package/dist/types/components/demos/search-filter-demo.d.ts +2 -0
  18. package/dist/types/components/demos/search-filter-demo.d.ts.map +1 -0
  19. package/dist/types/components/demos/standalone-demo.d.ts +2 -0
  20. package/dist/types/components/demos/standalone-demo.d.ts.map +1 -0
  21. package/dist/types/components/drawing-toolbar.d.ts +57 -0
  22. package/dist/types/components/drawing-toolbar.d.ts.map +1 -0
  23. package/dist/types/components/icon-picker.d.ts +20 -0
  24. package/dist/types/components/icon-picker.d.ts.map +1 -0
  25. package/dist/types/components/layers-panel.d.ts +124 -0
  26. package/dist/types/components/layers-panel.d.ts.map +1 -0
  27. package/dist/types/components/map-drop-zone.d.ts +7 -0
  28. package/dist/types/components/map-drop-zone.d.ts.map +1 -0
  29. package/dist/types/components/map-editor-canvas.d.ts +5 -0
  30. package/dist/types/components/map-editor-canvas.d.ts.map +1 -0
  31. package/dist/types/components/properties-panel.d.ts +32 -0
  32. package/dist/types/components/properties-panel.d.ts.map +1 -0
  33. package/dist/types/components/status-indicator.d.ts +10 -0
  34. package/dist/types/components/status-indicator.d.ts.map +1 -0
  35. package/dist/types/components/timebar.d.ts +15 -0
  36. package/dist/types/components/timebar.d.ts.map +1 -0
  37. package/dist/types/hooks/toast-context.d.ts +7 -0
  38. package/dist/types/hooks/toast-context.d.ts.map +1 -0
  39. package/dist/types/hooks/use-toast.d.ts +5 -0
  40. package/dist/types/hooks/use-toast.d.ts.map +1 -0
  41. package/dist/types/index.d.ts +28 -0
  42. package/dist/types/index.d.ts.map +1 -0
  43. package/dist/types/lib/map-editor-api.d.ts +547 -0
  44. package/dist/types/lib/map-editor-api.d.ts.map +1 -0
  45. package/dist/types/lib/queryClient.d.ts +9 -0
  46. package/dist/types/lib/queryClient.d.ts.map +1 -0
  47. package/dist/types/lib/timeline-store.d.ts +37 -0
  48. package/dist/types/lib/timeline-store.d.ts.map +1 -0
  49. package/dist/types/lib/utils.d.ts +3 -0
  50. package/dist/types/lib/utils.d.ts.map +1 -0
  51. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -131,6 +131,7 @@ function DrawingToolbar({
131
131
  onGoTo,
132
132
  onDropPoint,
133
133
  showGoToButton = false,
134
+ onFitToFeatures,
134
135
  isSelectionToolActive = true,
135
136
  onSelectionToolActiveChange,
136
137
  showClearFilter = false,
@@ -627,28 +628,45 @@ function DrawingToolbar({
627
628
  ),
628
629
  /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-0.5 !min-w-0" })
629
630
  ] }),
630
- onGoTo && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
631
- /* @__PURE__ */ jsxRuntime.jsx(
632
- antd.Tooltip,
633
- {
634
- title: "Go To",
635
- placement: "right",
636
- children: /* @__PURE__ */ jsxRuntime.jsx(
637
- antd.Button,
638
- {
639
- type: "text",
640
- onClick: () => setGoToDialogOpen(true),
641
- disabled,
642
- className: "relative transition-all duration-150 flex items-center justify-center !w-9 !h-9 !min-w-0 !p-0",
643
- "aria-label": "Go To",
644
- "data-testid": "button-goto-address",
645
- icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Navigation, { className: "w-5 h-5" })
646
- }
647
- )
648
- }
649
- ),
650
- !enableMeasurement && /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-0.5 !min-w-0" })
651
- ] }),
631
+ onGoTo && /* @__PURE__ */ jsxRuntime.jsx(
632
+ antd.Tooltip,
633
+ {
634
+ title: "Go To",
635
+ placement: "right",
636
+ children: /* @__PURE__ */ jsxRuntime.jsx(
637
+ antd.Button,
638
+ {
639
+ type: "text",
640
+ onClick: () => setGoToDialogOpen(true),
641
+ disabled,
642
+ className: "relative transition-all duration-150 flex items-center justify-center !w-9 !h-9 !min-w-0 !p-0",
643
+ "aria-label": "Go To",
644
+ "data-testid": "button-goto-address",
645
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Navigation, { className: "w-5 h-5" })
646
+ }
647
+ )
648
+ }
649
+ ),
650
+ onFitToFeatures && /* @__PURE__ */ jsxRuntime.jsx(
651
+ antd.Tooltip,
652
+ {
653
+ title: "Fit to Data",
654
+ placement: "right",
655
+ children: /* @__PURE__ */ jsxRuntime.jsx(
656
+ antd.Button,
657
+ {
658
+ type: "text",
659
+ onClick: onFitToFeatures,
660
+ disabled,
661
+ className: "relative transition-all duration-150 flex items-center justify-center !w-9 !h-9 !min-w-0 !p-0",
662
+ "aria-label": "Fit to Data",
663
+ "data-testid": "button-fit-to-data",
664
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Scan, { className: "w-5 h-5" })
665
+ }
666
+ )
667
+ }
668
+ ),
669
+ (onGoTo || onFitToFeatures) && !enableMeasurement && /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-0.5 !min-w-0" }),
652
670
  !selectionOnly && /* @__PURE__ */ jsxRuntime.jsx(
653
671
  antd.Tooltip,
654
672
  {
@@ -9239,18 +9257,24 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9239
9257
  }
9240
9258
  }, [onWorkspaceSave, toast]);
9241
9259
  const handleFitToFeatures = react.useCallback(() => {
9242
- if (!map.current || !draw.current) return;
9260
+ if (!map.current) return;
9243
9261
  const allFeatures = [];
9244
- layers.forEach((layer) => {
9245
- if (layer.visible) {
9246
- layer.featureIds.forEach((id) => {
9247
- const f = draw.current.get(id);
9248
- if (f) allFeatures.push(f);
9249
- });
9250
- } else {
9251
- const hidden = hiddenFeatures.current.get(layer.id) || [];
9252
- allFeatures.push(...hidden);
9253
- }
9262
+ if (draw.current) {
9263
+ layers.forEach((layer) => {
9264
+ if (layer.visible) {
9265
+ layer.featureIds.forEach((id) => {
9266
+ const f = draw.current.get(id);
9267
+ if (f) allFeatures.push(f);
9268
+ });
9269
+ } else {
9270
+ const hidden = hiddenFeatures.current.get(layer.id) || [];
9271
+ allFeatures.push(...hidden);
9272
+ }
9273
+ });
9274
+ }
9275
+ readOnlyFeatures.current.forEach((features, lid) => {
9276
+ const layer = layersRef.current.find((l) => l.id === lid);
9277
+ if (!layer || layer.visible) allFeatures.push(...features);
9254
9278
  });
9255
9279
  if (allFeatures.length === 0) {
9256
9280
  toast({
@@ -9266,7 +9290,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9266
9290
  const bbox = turf__namespace.bbox(fc);
9267
9291
  map.current.fitBounds([[bbox[0], bbox[1]], [bbox[2], bbox[3]]], {
9268
9292
  padding: 80,
9269
- maxZoom: 16
9293
+ maxZoom: 16,
9294
+ duration: 1e3
9270
9295
  });
9271
9296
  }, [layers, toast]);
9272
9297
  const handleFileChange = react.useCallback((e) => {
@@ -10118,7 +10143,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10118
10143
  onGoTo: (coords, zoom) => {
10119
10144
  if (map.current) {
10120
10145
  const currentZoom = map.current.getZoom();
10121
- map.current.flyTo({ center: coords, zoom: zoom ?? Math.max(currentZoom, 14), duration: 2e3 });
10146
+ map.current.flyTo({ center: coords, zoom: zoom ?? Math.max(currentZoom, 20), duration: 2e3 });
10122
10147
  }
10123
10148
  },
10124
10149
  showClearFilter,
@@ -10127,6 +10152,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10127
10152
  filterActiveRef.current = active;
10128
10153
  },
10129
10154
  showGoToButton,
10155
+ onFitToFeatures: handleFitToFeatures,
10130
10156
  onDropPoint,
10131
10157
  geocodingUrl,
10132
10158
  geocoderProvider,