@element-editor/ui 0.0.0-stage → 0.2.0
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/AGENTS.md +65 -0
- package/LICENSE +21 -0
- package/README.md +46 -2
- package/dist/BooleanOperations-WXcmW9Vy.cjs +1 -0
- package/dist/BooleanOperations-oF0WybQP.js +111 -0
- package/dist/DataTable-CNfB01y2.cjs +2 -0
- package/dist/DataTable-DNmjUwka.js +510 -0
- package/dist/DataTablePanel-BknCxC1K.cjs +1 -0
- package/dist/DataTablePanel-rWdaQubk.js +208 -0
- package/dist/EditToolbarBtn-SZIsnIn3.js +378 -0
- package/dist/EditToolbarBtn-dpCmKnzk.cjs +3 -0
- package/dist/FeatureEditModal-BF-fGhVD.js +77 -0
- package/dist/FeatureEditModal-CM6BObUO.cjs +1 -0
- package/dist/FeatureList-CQb2kTrV.js +520 -0
- package/dist/FeatureList-Csr-anLA.cjs +1 -0
- package/dist/FeatureRowContextMenu-BLt7VlUU.js +130 -0
- package/dist/FeatureRowContextMenu-Gwq3OMEA.cjs +1 -0
- package/dist/GeoJSONModal-BPFWeaLZ.js +886 -0
- package/dist/GeoJSONModal-iwUcvrg7.cjs +9 -0
- package/dist/SchemaEditor-BEsKUe2p.js +293 -0
- package/dist/SchemaEditor-qkoYMg0C.cjs +1 -0
- package/dist/SchemaModal-9nNrgorr.js +95 -0
- package/dist/SchemaModal-GrtgA7cH.cjs +1 -0
- package/dist/SettingsModal-6_qmRyCi.cjs +1 -0
- package/dist/SettingsModal-DTP0Xx_Z.js +237 -0
- package/dist/ShortcutsModal-CdyQlrqK.cjs +1 -0
- package/dist/ShortcutsModal-DwxZu71W.js +299 -0
- package/dist/components/ActiveDrawingToolbar.d.cts +1 -0
- package/dist/components/ActiveDrawingToolbar.d.ts +1 -0
- package/dist/components/BasemapPicker.d.cts +26 -0
- package/dist/components/BasemapPicker.d.ts +26 -0
- package/dist/components/BooleanOperations.d.cts +1 -0
- package/dist/components/BooleanOperations.d.ts +1 -0
- package/dist/components/BufferPanel.d.cts +1 -0
- package/dist/components/BufferPanel.d.ts +1 -0
- package/dist/components/DataTable.d.cts +9 -0
- package/dist/components/DataTable.d.ts +9 -0
- package/dist/components/DataTablePanel.d.cts +10 -0
- package/dist/components/DataTablePanel.d.ts +10 -0
- package/dist/components/EditingToolbar.d.cts +1 -0
- package/dist/components/EditingToolbar.d.ts +1 -0
- package/dist/components/ElementEditorErrorBoundary.d.cts +28 -0
- package/dist/components/ElementEditorErrorBoundary.d.ts +28 -0
- package/dist/components/ElementEditorUIProvider.d.cts +50 -0
- package/dist/components/ElementEditorUIProvider.d.ts +50 -0
- package/dist/components/FeatureMapContextMenu.d.cts +23 -0
- package/dist/components/FeatureMapContextMenu.d.ts +23 -0
- package/dist/components/FitBoundsButton.d.cts +6 -0
- package/dist/components/FitBoundsButton.d.ts +6 -0
- package/dist/components/FloatingToolbar.d.cts +3 -0
- package/dist/components/FloatingToolbar.d.ts +3 -0
- package/dist/components/LocateButton.d.cts +11 -0
- package/dist/components/LocateButton.d.ts +11 -0
- package/dist/components/ReadonlyBanner.d.cts +1 -0
- package/dist/components/ReadonlyBanner.d.ts +1 -0
- package/dist/components/ShortcutsModal.d.cts +1 -0
- package/dist/components/ShortcutsModal.d.ts +1 -0
- package/dist/components/SimplifyPanel.d.cts +1 -0
- package/dist/components/SimplifyPanel.d.ts +1 -0
- package/dist/components/SmoothPanel.d.cts +1 -0
- package/dist/components/SmoothPanel.d.ts +1 -0
- package/dist/components/UndoRedoToolbar.d.cts +20 -0
- package/dist/components/UndoRedoToolbar.d.ts +20 -0
- package/dist/components/VertexSelectionBar.d.cts +12 -0
- package/dist/components/VertexSelectionBar.d.ts +12 -0
- package/dist/components/ZoomIndicator.d.cts +15 -0
- package/dist/components/ZoomIndicator.d.ts +15 -0
- package/dist/components/dialogs/DynamicFieldRenderer.d.cts +11 -0
- package/dist/components/dialogs/DynamicFieldRenderer.d.ts +11 -0
- package/dist/components/dialogs/SettingsModal.d.cts +1 -0
- package/dist/components/dialogs/SettingsModal.d.ts +1 -0
- package/dist/components/lazyParts.d.cts +12 -0
- package/dist/components/lazyParts.d.ts +12 -0
- package/dist/components/sidebar/FeatureEditModal.d.cts +6 -0
- package/dist/components/sidebar/FeatureEditModal.d.ts +6 -0
- package/dist/components/sidebar/FeatureList.d.cts +4 -0
- package/dist/components/sidebar/FeatureList.d.ts +4 -0
- package/dist/components/sidebar/FeatureRow.d.cts +38 -0
- package/dist/components/sidebar/FeatureRow.d.ts +38 -0
- package/dist/components/sidebar/FeatureRowContextMenu.d.cts +12 -0
- package/dist/components/sidebar/FeatureRowContextMenu.d.ts +12 -0
- package/dist/components/sidebar/FeatureSidePanel.d.cts +8 -0
- package/dist/components/sidebar/FeatureSidePanel.d.ts +8 -0
- package/dist/components/sidebar/GeoJSONModal.d.cts +5 -0
- package/dist/components/sidebar/GeoJSONModal.d.ts +5 -0
- package/dist/components/sidebar/GroupRow.d.cts +21 -0
- package/dist/components/sidebar/GroupRow.d.ts +21 -0
- package/dist/components/sidebar/HideLayersToggle.d.cts +2 -0
- package/dist/components/sidebar/HideLayersToggle.d.ts +2 -0
- package/dist/components/sidebar/LayersPanel.d.cts +5 -0
- package/dist/components/sidebar/LayersPanel.d.ts +5 -0
- package/dist/components/sidebar/PartSubRow.d.cts +9 -0
- package/dist/components/sidebar/PartSubRow.d.ts +9 -0
- package/dist/components/sidebar/SchemaEditor.d.cts +4 -0
- package/dist/components/sidebar/SchemaEditor.d.ts +4 -0
- package/dist/components/sidebar/SchemaModal.d.cts +5 -0
- package/dist/components/sidebar/SchemaModal.d.ts +5 -0
- package/dist/components/sidebar/codeDock.d.cts +21 -0
- package/dist/components/sidebar/codeDock.d.ts +21 -0
- package/dist/components/ui/Button.d.cts +9 -0
- package/dist/components/ui/Button.d.ts +9 -0
- package/dist/components/ui/CloseButton.d.cts +6 -0
- package/dist/components/ui/CloseButton.d.ts +6 -0
- package/dist/components/ui/ContextMenu.d.cts +28 -0
- package/dist/components/ui/ContextMenu.d.ts +28 -0
- package/dist/components/ui/EditToolbarBtn.d.cts +13 -0
- package/dist/components/ui/EditToolbarBtn.d.ts +13 -0
- package/dist/components/ui/ElementToaster.d.cts +3 -0
- package/dist/components/ui/ElementToaster.d.ts +3 -0
- package/dist/components/ui/GeometryTypeIcon.d.cts +7 -0
- package/dist/components/ui/GeometryTypeIcon.d.ts +7 -0
- package/dist/components/ui/IconButton.d.cts +28 -0
- package/dist/components/ui/IconButton.d.ts +28 -0
- package/dist/components/ui/Input.d.cts +14 -0
- package/dist/components/ui/Input.d.ts +14 -0
- package/dist/components/ui/JsonCode.d.cts +4 -0
- package/dist/components/ui/JsonCode.d.ts +4 -0
- package/dist/components/ui/Kbd.d.cts +16 -0
- package/dist/components/ui/Kbd.d.ts +16 -0
- package/dist/components/ui/NoFeaturesEmptyState.d.cts +1 -0
- package/dist/components/ui/NoFeaturesEmptyState.d.ts +1 -0
- package/dist/components/ui/SearchDropdown.d.cts +28 -0
- package/dist/components/ui/SearchDropdown.d.ts +28 -0
- package/dist/components/ui/ToolButton.d.cts +19 -0
- package/dist/components/ui/ToolButton.d.ts +19 -0
- package/dist/components/ui/Tooltip.d.cts +12 -0
- package/dist/components/ui/Tooltip.d.ts +12 -0
- package/dist/components/ui/panelHeader.d.cts +2 -0
- package/dist/components/ui/panelHeader.d.ts +2 -0
- package/dist/components/ui/resizeEdge.d.cts +4 -0
- package/dist/components/ui/resizeEdge.d.ts +4 -0
- package/dist/contexts/ElementEditorConfigContext.d.cts +351 -0
- package/dist/contexts/ElementEditorConfigContext.d.ts +351 -0
- package/dist/contexts/EventContext.d.cts +69 -0
- package/dist/contexts/EventContext.d.ts +69 -0
- package/dist/contexts/MapControllerContext.d.cts +24 -0
- package/dist/contexts/MapControllerContext.d.ts +24 -0
- package/dist/contexts/ShortcutConfigContext.d.cts +16 -0
- package/dist/contexts/ShortcutConfigContext.d.ts +16 -0
- package/dist/contexts/ThemeContext.d.cts +12 -0
- package/dist/contexts/ThemeContext.d.ts +12 -0
- package/dist/element-editor-ui.cjs +1 -0
- package/dist/element-editor-ui.es.js +102 -0
- package/dist/geometryWorker-CCwg4tNC.cjs +1 -0
- package/dist/geometryWorker-DgQCFSmD.js +25 -0
- package/dist/hooks/dragShield.d.cts +7 -0
- package/dist/hooks/dragShield.d.ts +7 -0
- package/dist/hooks/themeInputs.d.cts +14 -0
- package/dist/hooks/themeInputs.d.ts +14 -0
- package/dist/hooks/useAccentPalette.d.cts +15 -0
- package/dist/hooks/useAccentPalette.d.ts +15 -0
- package/dist/hooks/useAccentStyle.d.cts +39 -0
- package/dist/hooks/useAccentStyle.d.ts +39 -0
- package/dist/hooks/useAdapterControls.d.cts +280 -0
- package/dist/hooks/useAdapterControls.d.ts +280 -0
- package/dist/hooks/useBalancedWrap.d.cts +8 -0
- package/dist/hooks/useBalancedWrap.d.ts +8 -0
- package/dist/hooks/useContextMenu.d.cts +11 -0
- package/dist/hooks/useContextMenu.d.ts +11 -0
- package/dist/hooks/useDataChangeSubscription.d.cts +9 -0
- package/dist/hooks/useDataChangeSubscription.d.ts +9 -0
- package/dist/hooks/useDragWindow.d.cts +9 -0
- package/dist/hooks/useDragWindow.d.ts +9 -0
- package/dist/hooks/useFocusTrap.d.cts +7 -0
- package/dist/hooks/useFocusTrap.d.ts +7 -0
- package/dist/hooks/useGeoJSONDrop.d.cts +40 -0
- package/dist/hooks/useGeoJSONDrop.d.ts +40 -0
- package/dist/hooks/useGeoJSONExport.d.cts +69 -0
- package/dist/hooks/useGeoJSONExport.d.ts +69 -0
- package/dist/hooks/useGeoJSONFileImport.d.cts +24 -0
- package/dist/hooks/useGeoJSONFileImport.d.ts +24 -0
- package/dist/hooks/useInlineRename.d.cts +26 -0
- package/dist/hooks/useInlineRename.d.ts +26 -0
- package/dist/hooks/useJumpToFeature.d.cts +3 -0
- package/dist/hooks/useJumpToFeature.d.ts +3 -0
- package/dist/hooks/useKeyboardShortcuts.d.cts +9 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +9 -0
- package/dist/hooks/useNominatim.d.cts +24 -0
- package/dist/hooks/useNominatim.d.ts +24 -0
- package/dist/hooks/usePanelOffset.d.cts +14 -0
- package/dist/hooks/usePanelOffset.d.ts +14 -0
- package/dist/hooks/useResizablePanel.d.cts +4 -0
- package/dist/hooks/useResizablePanel.d.ts +4 -0
- package/dist/hooks/useRootTokens.d.cts +27 -0
- package/dist/hooks/useRootTokens.d.ts +27 -0
- package/dist/hooks/useSearchState.d.cts +23 -0
- package/dist/hooks/useSearchState.d.ts +23 -0
- package/dist/hooks/useServiceAttribution.d.cts +13 -0
- package/dist/hooks/useServiceAttribution.d.ts +13 -0
- package/dist/hooks/useWindowEscape.d.cts +25 -0
- package/dist/hooks/useWindowEscape.d.ts +25 -0
- package/dist/hooks/useWindowFocus.d.cts +4 -0
- package/dist/hooks/useWindowFocus.d.ts +4 -0
- package/dist/hooks/useWorkerGeometryPreview.d.cts +22 -0
- package/dist/hooks/useWorkerGeometryPreview.d.ts +22 -0
- package/dist/index-BKdDZ4Y9.cjs +1 -0
- package/dist/index-CtZterPc.js +3165 -0
- package/dist/index.d.cts +89 -0
- package/dist/index.d.ts +89 -0
- package/dist/internal.cjs +1 -0
- package/dist/internal.d.cts +16 -0
- package/dist/internal.d.ts +16 -0
- package/dist/internal.es.js +42 -0
- package/dist/primitives.cjs +1 -0
- package/dist/primitives.d.cts +19 -0
- package/dist/primitives.d.ts +19 -0
- package/dist/primitives.es.js +17 -0
- package/dist/store/StoreContext.d.cts +17 -0
- package/dist/store/StoreContext.d.ts +17 -0
- package/dist/types/events.d.cts +95 -0
- package/dist/types/events.d.ts +95 -0
- package/dist/useAccentStyle-CPo2XqAn.js +412 -0
- package/dist/useAccentStyle-hsGvyHZc.cjs +1 -0
- package/dist/useAdapterControls-BBObhzVX.cjs +1 -0
- package/dist/useAdapterControls-DVjkwRZ_.js +691 -0
- package/dist/useContextMenu-DJ2Cti85.js +10 -0
- package/dist/useContextMenu-DbxMvb1s.cjs +1 -0
- package/dist/useFocusTrap-BBjPCfDR.cjs +1 -0
- package/dist/useFocusTrap-CKxKT8De.js +25 -0
- package/dist/useJumpToFeature-Bdz2hqOC.js +16 -0
- package/dist/useJumpToFeature-LwjxGzfy.cjs +1 -0
- package/dist/useWindowFocus-D-_yEm_V.cjs +1 -0
- package/dist/useWindowFocus-DGAWA1au.js +80 -0
- package/dist/utils/booleanValue.d.cts +4 -0
- package/dist/utils/booleanValue.d.ts +4 -0
- package/dist/utils/clipboardError.d.cts +3 -0
- package/dist/utils/clipboardError.d.ts +3 -0
- package/dist/utils/download.d.cts +42 -0
- package/dist/utils/download.d.ts +42 -0
- package/dist/utils/geojsonDocument.d.cts +168 -0
- package/dist/utils/geojsonDocument.d.ts +168 -0
- package/dist/utils/geometryWorkerClient.d.cts +6 -0
- package/dist/utils/geometryWorkerClient.d.ts +6 -0
- package/dist/utils/layerOrder.d.cts +9 -0
- package/dist/utils/layerOrder.d.ts +9 -0
- package/dist/utils/lazyWithPreload.d.cts +24 -0
- package/dist/utils/lazyWithPreload.d.ts +24 -0
- package/dist/utils/lineSmooth.d.cts +7 -0
- package/dist/utils/lineSmooth.d.ts +7 -0
- package/dist/utils/platform.d.cts +2 -0
- package/dist/utils/platform.d.ts +2 -0
- package/dist/workers/geometryWorker.d.cts +1 -0
- package/dist/workers/geometryWorker.d.ts +1 -0
- package/package.json +133 -3
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
import { jsxs as v, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as oe, useState as le, useMemo as g, useCallback as se, useEffect as U } from "react";
|
|
3
|
+
import { SelectColumn as ie, DataGrid as ce } from "react-data-grid";
|
|
4
|
+
import { CaretDown as Z, Trash as V, ArrowUp as de, ArrowDown as ue } from "@phosphor-icons/react";
|
|
5
|
+
import { f as k, u as me, g as pe, d as fe, e as he, h as ye } from "./useAdapterControls-DVjkwRZ_.js";
|
|
6
|
+
import { useShallow as ge } from "zustand/react/shallow";
|
|
7
|
+
import { getGeometryBBox as be } from "@element-editor/core";
|
|
8
|
+
import { withXY as xe } from "@element-editor/core/internal";
|
|
9
|
+
import { f as q } from "./EditToolbarBtn-SZIsnIn3.js";
|
|
10
|
+
import { F as ke } from "./FeatureRowContextMenu-BLt7VlUU.js";
|
|
11
|
+
import { u as ve } from "./useContextMenu-DJ2Cti85.js";
|
|
12
|
+
import { f as E, h as _e, j as Ce, k as Ne } from "./index-CtZterPc.js";
|
|
13
|
+
const Se = new Intl.Collator(void 0, { numeric: !0 }), we = /* @__PURE__ */ new Set(["_id", "_type", "_size", "_schemaId", "_schemaName", "_lat", "_lng"]);
|
|
14
|
+
function O(a) {
|
|
15
|
+
const c = /* @__PURE__ */ new Set(), d = [];
|
|
16
|
+
for (const i of a)
|
|
17
|
+
for (const u of i.fields)
|
|
18
|
+
c.has(u.key) || (c.add(u.key), d.push(u));
|
|
19
|
+
return d;
|
|
20
|
+
}
|
|
21
|
+
function Ie(a) {
|
|
22
|
+
const c = (i) => `${i} point${i === 1 ? "" : "s"}`, d = (i, u) => `${i} part${i === 1 ? "" : "s"} · ${c(u)}`;
|
|
23
|
+
switch (a.type) {
|
|
24
|
+
case "Point":
|
|
25
|
+
return "";
|
|
26
|
+
case "MultiPoint":
|
|
27
|
+
return c(a.coordinates.length);
|
|
28
|
+
case "LineString":
|
|
29
|
+
return c(a.coordinates.length);
|
|
30
|
+
// Rings repeat their first position at the end: count it once.
|
|
31
|
+
case "Polygon":
|
|
32
|
+
return c(a.coordinates[0].length - 1);
|
|
33
|
+
case "MultiLineString":
|
|
34
|
+
return d(a.coordinates.length, a.coordinates.reduce((i, u) => i + u.length, 0));
|
|
35
|
+
case "MultiPolygon":
|
|
36
|
+
return d(a.coordinates.length, a.coordinates.reduce((i, u) => i + u[0].length - 1, 0));
|
|
37
|
+
case "GeometryCollection":
|
|
38
|
+
return `${a.geometries.length} part${a.geometries.length === 1 ? "" : "s"}`;
|
|
39
|
+
default:
|
|
40
|
+
return "";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function ze({ type: a }) {
|
|
44
|
+
return /* @__PURE__ */ v("span", { className: "flex items-center gap-1.5 flex-shrink-0 text-elm-text-secondary", children: [
|
|
45
|
+
/* @__PURE__ */ l("span", { className: "text-(--elm-text-subtle,var(--color-gray-400)) flex-shrink-0", children: /* @__PURE__ */ l(Ce, { type: a, size: 16 }) }),
|
|
46
|
+
/* @__PURE__ */ l("span", { className: "text-sm", children: Ne(a) })
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
function J({
|
|
50
|
+
row: a,
|
|
51
|
+
column: c,
|
|
52
|
+
onRowChange: d,
|
|
53
|
+
onClose: i
|
|
54
|
+
}) {
|
|
55
|
+
return /* @__PURE__ */ l(
|
|
56
|
+
"input",
|
|
57
|
+
{
|
|
58
|
+
autoFocus: !0,
|
|
59
|
+
type: "number",
|
|
60
|
+
step: "any",
|
|
61
|
+
className: "rdg-text-editor w-full h-full border-0 outline-none px-2 text-sm font-elm-mono bg-transparent text-inherit caret-primary-500",
|
|
62
|
+
value: String(a[c.key] ?? ""),
|
|
63
|
+
onChange: (u) => d({ ...a, [c.key]: u.target.value }),
|
|
64
|
+
onBlur: () => i(!0)
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function H({ checked: a, label: c, disabled: d, onToggle: i, autoFocus: u }) {
|
|
69
|
+
return /* @__PURE__ */ l("span", { className: "flex h-full items-center px-0.5", children: /* @__PURE__ */ l(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
type: "button",
|
|
73
|
+
role: "switch",
|
|
74
|
+
"aria-checked": a,
|
|
75
|
+
"aria-label": c,
|
|
76
|
+
tabIndex: -1,
|
|
77
|
+
autoFocus: u,
|
|
78
|
+
disabled: d,
|
|
79
|
+
onClick: (f) => {
|
|
80
|
+
f.stopPropagation(), i();
|
|
81
|
+
},
|
|
82
|
+
className: `relative inline-flex h-4 w-7 flex-shrink-0 items-center rounded-full outline-none disabled:cursor-default enabled:cursor-pointer
|
|
83
|
+
${a ? "bg-primary-500" : "bg-elm-border"} ${d ? "opacity-50" : "opacity-90 enabled:hover:opacity-100"}`,
|
|
84
|
+
children: /* @__PURE__ */ l(
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
"aria-hidden": !0,
|
|
88
|
+
className: `absolute left-[2px] top-[2px] h-3 w-3 rounded-full border bg-white ${a ? "border-white" : "border-(--elm-border-strong,var(--color-gray-300))"}`,
|
|
89
|
+
style: { transform: a ? "translateX(12px)" : void 0 }
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
) });
|
|
94
|
+
}
|
|
95
|
+
function Q(a) {
|
|
96
|
+
return function({
|
|
97
|
+
row: d,
|
|
98
|
+
column: i,
|
|
99
|
+
onRowChange: u,
|
|
100
|
+
onClose: f
|
|
101
|
+
}) {
|
|
102
|
+
const N = String(d[i.key] ?? "");
|
|
103
|
+
if (a.type === "boolean") {
|
|
104
|
+
const h = E(d[i.key]);
|
|
105
|
+
return /* @__PURE__ */ l("div", { className: "w-full h-full px-2", onBlur: () => f(!0), children: /* @__PURE__ */ l(H, { autoFocus: !0, checked: h, label: a.label, onToggle: () => u({ ...d, [i.key]: !h }) }) });
|
|
106
|
+
}
|
|
107
|
+
if (a.type === "select" && a.options)
|
|
108
|
+
return /* @__PURE__ */ v("div", { className: "relative w-full h-full", children: [
|
|
109
|
+
/* @__PURE__ */ v(
|
|
110
|
+
"select",
|
|
111
|
+
{
|
|
112
|
+
autoFocus: !0,
|
|
113
|
+
className: "rdg-text-editor w-full h-full border-0 outline-none pl-2 pr-7 text-sm bg-transparent text-inherit appearance-none",
|
|
114
|
+
value: N,
|
|
115
|
+
onChange: (h) => u({ ...d, [i.key]: h.target.value }),
|
|
116
|
+
onBlur: () => f(!0),
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ l("option", { value: "", children: "—" }),
|
|
119
|
+
a.options.map((h) => /* @__PURE__ */ l("option", { value: h, children: h }, h))
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
/* @__PURE__ */ l(Z, { size: 12, "aria-hidden": !0, className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 opacity-60" })
|
|
124
|
+
] });
|
|
125
|
+
const m = a.type === "number" ? "number" : a.type === "date" ? "date" : a.type === "url" ? "url" : "text";
|
|
126
|
+
return /* @__PURE__ */ l(
|
|
127
|
+
"input",
|
|
128
|
+
{
|
|
129
|
+
autoFocus: !0,
|
|
130
|
+
type: m,
|
|
131
|
+
className: "rdg-text-editor w-full h-full border-0 outline-none px-2 text-sm bg-transparent text-inherit caret-primary-500",
|
|
132
|
+
value: N,
|
|
133
|
+
onChange: (h) => u({ ...d, [i.key]: h.target.value }),
|
|
134
|
+
onBlur: () => f(!0)
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function C(a) {
|
|
140
|
+
return /* @__PURE__ */ l("span", { className: "block w-0 min-w-full truncate", children: a });
|
|
141
|
+
}
|
|
142
|
+
function De({ sortDirection: a, priority: c }) {
|
|
143
|
+
return a ? /* @__PURE__ */ v("span", { className: "flex h-full items-center gap-0.5 pl-1", children: [
|
|
144
|
+
/* @__PURE__ */ l(a === "ASC" ? de : ue, { size: 12, className: "shrink-0", "aria-hidden": !0 }),
|
|
145
|
+
c !== void 0 && c > 1 && /* @__PURE__ */ l("span", { className: "text-[10px] leading-none opacity-60", children: c })
|
|
146
|
+
] }) : null;
|
|
147
|
+
}
|
|
148
|
+
function We({ schemaFilter: a, focusRowId: c, onFocusRowHandled: d, selectedRows: i, onSelectedRowsChange: u }) {
|
|
149
|
+
const f = k((e) => e.features), N = k((e) => e.groups), m = k(ge((e) => e.getVisibleSchemas())), h = k((e) => e.selectFeature), M = k((e) => e.updateFeature), B = k((e) => e.deleteFeature), b = me((e) => e.readonly), z = k((e) => e.selectedIds), { panTo: F, fitBounds: T } = pe(), K = fe(), G = oe(null), { dataStore: _ } = he(), j = ye(), x = ve(), [D, R] = le([]), S = g(() => {
|
|
150
|
+
if (a === "all") return O(m);
|
|
151
|
+
const e = m.find((t) => t.id === a);
|
|
152
|
+
return e ? e.fields : O(m);
|
|
153
|
+
}, [m, a]), A = g(() => {
|
|
154
|
+
const e = {};
|
|
155
|
+
for (const t of m) e[t.id] = t.name;
|
|
156
|
+
return e;
|
|
157
|
+
}, [m]), W = g(() => {
|
|
158
|
+
var o;
|
|
159
|
+
const e = /* @__PURE__ */ new Map(), t = [];
|
|
160
|
+
for (const s of f) {
|
|
161
|
+
if (!s.groupId) {
|
|
162
|
+
t.push(s);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const p = e.get(s.groupId);
|
|
166
|
+
p ? p.push(s) : e.set(s.groupId, [s]);
|
|
167
|
+
}
|
|
168
|
+
const r = [
|
|
169
|
+
...N.flatMap((s) => e.get(s.id) ?? []),
|
|
170
|
+
...t
|
|
171
|
+
];
|
|
172
|
+
if (a === "all") return r;
|
|
173
|
+
const n = (o = m[0]) == null ? void 0 : o.id;
|
|
174
|
+
return r.filter((s) => (s.schemaId ?? n) === a);
|
|
175
|
+
}, [f, N, m, a]), w = g(
|
|
176
|
+
() => W.map((e) => {
|
|
177
|
+
var o, s;
|
|
178
|
+
let t = "", r = "";
|
|
179
|
+
if (e.geometry.type === "Point") {
|
|
180
|
+
const [p, y] = e.geometry.coordinates;
|
|
181
|
+
t = String(y), r = String(p);
|
|
182
|
+
}
|
|
183
|
+
const n = e.schemaId ?? ((o = m[0]) == null ? void 0 : o.id) ?? "";
|
|
184
|
+
return {
|
|
185
|
+
_id: e.id,
|
|
186
|
+
_type: e.geometry.type,
|
|
187
|
+
_size: Ie(e.geometry),
|
|
188
|
+
_schemaId: n,
|
|
189
|
+
_schemaName: A[n] ?? ((s = m[0]) == null ? void 0 : s.name) ?? "",
|
|
190
|
+
_lat: t,
|
|
191
|
+
_lng: r,
|
|
192
|
+
...e.properties
|
|
193
|
+
};
|
|
194
|
+
}),
|
|
195
|
+
[W, A, m]
|
|
196
|
+
), P = g(() => new Set(S.filter((e) => e.type === "boolean").map((e) => e.key)), [S]), $ = g(() => {
|
|
197
|
+
if (D.length === 0) return w;
|
|
198
|
+
const e = (t, r) => P.has(r) ? E(t[r]) ? "1" : "0" : String(t[r] ?? "");
|
|
199
|
+
return [...w].sort((t, r) => {
|
|
200
|
+
for (const n of D) {
|
|
201
|
+
const o = e(t, n.columnKey), s = e(r, n.columnKey), p = Se.compare(o, s);
|
|
202
|
+
if (p !== 0) return n.direction === "ASC" ? p : -p;
|
|
203
|
+
}
|
|
204
|
+
return 0;
|
|
205
|
+
});
|
|
206
|
+
}, [w, D, P]), X = g(() => w.some((e) => e._type === "Point"), [w]), L = se((e, t) => {
|
|
207
|
+
var o;
|
|
208
|
+
if (b) return;
|
|
209
|
+
const r = _.getState(), n = r.features.find((s) => s.id === e);
|
|
210
|
+
n && r.updateFeatures([{ id: e, patch: { properties: { ...n.properties, [t]: !E((o = n.properties) == null ? void 0 : o[t]) } } }]);
|
|
211
|
+
}, [_, b]), Y = g(() => {
|
|
212
|
+
const e = [
|
|
213
|
+
ie,
|
|
214
|
+
{
|
|
215
|
+
key: "_type",
|
|
216
|
+
name: C("Type"),
|
|
217
|
+
width: 150,
|
|
218
|
+
resizable: !0,
|
|
219
|
+
sortable: !0,
|
|
220
|
+
renderCell: ({ row: t }) => /* @__PURE__ */ v("span", { className: "flex items-center gap-2 min-w-0", children: [
|
|
221
|
+
/* @__PURE__ */ l(ze, { type: t._type }),
|
|
222
|
+
t._size && /* @__PURE__ */ l("span", { className: "truncate text-xs text-elm-text-muted", children: t._size })
|
|
223
|
+
] })
|
|
224
|
+
}
|
|
225
|
+
];
|
|
226
|
+
m.length > 1 && e.push({
|
|
227
|
+
key: "_schemaName",
|
|
228
|
+
name: C("Schema"),
|
|
229
|
+
width: 100,
|
|
230
|
+
resizable: !0,
|
|
231
|
+
sortable: !0,
|
|
232
|
+
editable: !0,
|
|
233
|
+
renderCell: ({ row: t }) => /* @__PURE__ */ l("span", { className: "inline-block px-1.5 py-0.5 rounded-elm-chip bg-elm-surface-hover text-(--elm-text-secondary,var(--color-gray-600)) dark:text-(--elm-text-secondary,var(--color-gray-300)) text-[10px] font-medium", children: t._schemaName }),
|
|
234
|
+
renderEditCell: ({ row: t, onRowChange: r, onClose: n }) => /* @__PURE__ */ v("div", { className: "relative w-full h-full", children: [
|
|
235
|
+
/* @__PURE__ */ l(
|
|
236
|
+
"select",
|
|
237
|
+
{
|
|
238
|
+
autoFocus: !0,
|
|
239
|
+
className: "rdg-text-editor w-full h-full border-0 outline-none pl-2 pr-7 text-sm appearance-none",
|
|
240
|
+
value: t._schemaId,
|
|
241
|
+
onChange: (o) => {
|
|
242
|
+
const s = m.find((p) => p.id === o.target.value);
|
|
243
|
+
s && r({ ...t, _schemaId: s.id, _schemaName: s.name });
|
|
244
|
+
},
|
|
245
|
+
onBlur: () => n(!0),
|
|
246
|
+
children: m.map((o) => /* @__PURE__ */ l("option", { value: o.id, children: o.name }, o.id))
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
/* @__PURE__ */ l(Z, { size: 12, "aria-hidden": !0, className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 opacity-60" })
|
|
250
|
+
] })
|
|
251
|
+
}), X && e.push(
|
|
252
|
+
{
|
|
253
|
+
key: "_lat",
|
|
254
|
+
name: C("Lat"),
|
|
255
|
+
width: 110,
|
|
256
|
+
resizable: !0,
|
|
257
|
+
sortable: !0,
|
|
258
|
+
editable: (t) => t._type === "Point",
|
|
259
|
+
renderCell: ({ row: t }) => /* @__PURE__ */ l("span", { className: "font-elm-mono text-xs text-(--elm-text-secondary,var(--color-gray-600)) dark:text-(--elm-text-secondary,var(--color-gray-300))", children: t._lat }),
|
|
260
|
+
renderEditCell: J
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
key: "_lng",
|
|
264
|
+
name: C("Lng"),
|
|
265
|
+
width: 110,
|
|
266
|
+
resizable: !0,
|
|
267
|
+
sortable: !0,
|
|
268
|
+
editable: (t) => t._type === "Point",
|
|
269
|
+
renderCell: ({ row: t }) => /* @__PURE__ */ l("span", { className: "font-elm-mono text-xs text-(--elm-text-secondary,var(--color-gray-600)) dark:text-(--elm-text-secondary,var(--color-gray-300))", children: t._lng }),
|
|
270
|
+
renderEditCell: J
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
for (const t of S) {
|
|
274
|
+
if (t.type === "boolean") {
|
|
275
|
+
e.push({
|
|
276
|
+
key: t.key,
|
|
277
|
+
name: C(t.label),
|
|
278
|
+
minWidth: 80,
|
|
279
|
+
resizable: !0,
|
|
280
|
+
sortable: !0,
|
|
281
|
+
// Editable so rdg routes paste here (it also needs a renderEditCell); keys and
|
|
282
|
+
// double-click toggle instead of opening the editor (onCellKeyDown / onCellDoubleClick).
|
|
283
|
+
editable: !0,
|
|
284
|
+
renderCell: ({ row: r }) => /* @__PURE__ */ l(
|
|
285
|
+
H,
|
|
286
|
+
{
|
|
287
|
+
checked: E(r[t.key]),
|
|
288
|
+
label: t.label,
|
|
289
|
+
disabled: b,
|
|
290
|
+
onToggle: () => L(r._id, t.key)
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
renderEditCell: Q(t)
|
|
294
|
+
});
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
e.push({
|
|
298
|
+
key: t.key,
|
|
299
|
+
name: C(t.label),
|
|
300
|
+
// Room for a typical name; other fields size to their content (resizable).
|
|
301
|
+
...t.key === "name" && { width: 200 },
|
|
302
|
+
minWidth: 80,
|
|
303
|
+
resizable: !0,
|
|
304
|
+
sortable: !0,
|
|
305
|
+
editable: !0,
|
|
306
|
+
renderEditCell: Q(t)
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
return e.push({
|
|
310
|
+
key: "_spacer",
|
|
311
|
+
name: "",
|
|
312
|
+
minWidth: 0,
|
|
313
|
+
width: "minmax(0, 1fr)",
|
|
314
|
+
resizable: !1,
|
|
315
|
+
sortable: !1,
|
|
316
|
+
renderCell: () => null
|
|
317
|
+
}), e.push({
|
|
318
|
+
key: "_delete",
|
|
319
|
+
name: "",
|
|
320
|
+
width: 36,
|
|
321
|
+
resizable: !1,
|
|
322
|
+
sortable: !1,
|
|
323
|
+
// With rows checked, the delete column's header deletes them all —
|
|
324
|
+
// same spot as the per-row delete buttons. One undo step. (The selected
|
|
325
|
+
// count is shown in the panel toolbar next to the feature count.)
|
|
326
|
+
renderHeaderCell: () => i.size > 0 ? /* @__PURE__ */ l("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ l(q, { content: `Delete ${i.size} selected`, children: /* @__PURE__ */ l(
|
|
327
|
+
"button",
|
|
328
|
+
{
|
|
329
|
+
"aria-label": `Delete ${i.size} selected`,
|
|
330
|
+
onMouseDown: (t) => t.stopPropagation(),
|
|
331
|
+
onClick: (t) => {
|
|
332
|
+
t.stopPropagation();
|
|
333
|
+
const r = _.getState(), n = i.size;
|
|
334
|
+
r.setSelection([...i]), r.deleteSelection(), u(/* @__PURE__ */ new Set()), j({ type: "features:deleted", count: n, undo: () => _.getState().undo() });
|
|
335
|
+
},
|
|
336
|
+
className: "w-7 h-7 rounded-elm-control flex items-center justify-center text-(--elm-text-secondary,var(--color-gray-600)) dark:text-(--elm-text-secondary,var(--color-gray-300)) hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) hover:text-(--elm-text-secondary,var(--color-gray-700)) dark:hover:text-(--elm-text-secondary,var(--color-gray-200)) transition-colors",
|
|
337
|
+
children: /* @__PURE__ */ l(V, { size: 16 })
|
|
338
|
+
}
|
|
339
|
+
) }) }) : null,
|
|
340
|
+
renderCell: ({ row: t }) => /* @__PURE__ */ l("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ l(q, { content: "Delete row", children: /* @__PURE__ */ l(
|
|
341
|
+
"button",
|
|
342
|
+
{
|
|
343
|
+
onMouseDown: (r) => r.stopPropagation(),
|
|
344
|
+
onClick: (r) => {
|
|
345
|
+
r.stopPropagation(), B(t._id);
|
|
346
|
+
},
|
|
347
|
+
className: "w-7 h-7 rounded-elm-control flex items-center justify-center text-elm-text hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) transition-colors",
|
|
348
|
+
children: /* @__PURE__ */ l(V, { size: 16 })
|
|
349
|
+
}
|
|
350
|
+
) }) })
|
|
351
|
+
}), b ? e.filter((t) => t.key !== "_delete").map((t) => ({ ...t, editable: !1 })) : e;
|
|
352
|
+
}, [S, m.length, X, B, i, u, _, j, b, L]);
|
|
353
|
+
U(() => {
|
|
354
|
+
if (!c) return;
|
|
355
|
+
const e = $.findIndex((r) => r._id === c);
|
|
356
|
+
if (e === -1) return;
|
|
357
|
+
const t = Y.findIndex((r) => r.key === "_lat");
|
|
358
|
+
t !== -1 && requestAnimationFrame(() => {
|
|
359
|
+
var r;
|
|
360
|
+
(r = G.current) == null || r.selectCell({ rowIdx: e, idx: t }, { enableEditor: !0 }), d == null || d();
|
|
361
|
+
});
|
|
362
|
+
}, [c]), U(() => {
|
|
363
|
+
var t;
|
|
364
|
+
if (z.length === 0) return;
|
|
365
|
+
const e = $.findIndex((r) => r._id === z[0]);
|
|
366
|
+
e !== -1 && ((t = G.current) == null || t.scrollToCell({ rowIdx: e }));
|
|
367
|
+
}, [z]);
|
|
368
|
+
function ee(e, { indexes: t }) {
|
|
369
|
+
var p;
|
|
370
|
+
if (b) return;
|
|
371
|
+
const r = e[t[0]], n = {};
|
|
372
|
+
for (const [y, I] of Object.entries(r))
|
|
373
|
+
we.has(y) || (n[y] = I);
|
|
374
|
+
const o = f.find((y) => y.id === r._id), s = (o == null ? void 0 : o.schemaId) ?? ((p = m[0]) == null ? void 0 : p.id) ?? "";
|
|
375
|
+
if (r._schemaId !== s) {
|
|
376
|
+
M(r._id, { schemaId: r._schemaId, properties: n });
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if ((o == null ? void 0 : o.geometry.type) === "Point") {
|
|
380
|
+
const y = parseFloat(r._lat), I = parseFloat(r._lng), [ne, ae] = o.geometry.coordinates;
|
|
381
|
+
if (!isNaN(y) && !isNaN(I) && (y !== ae || I !== ne)) {
|
|
382
|
+
_.getState().takeSnapshot(), M(r._id, {
|
|
383
|
+
geometry: { type: "Point", coordinates: xe(o.geometry.coordinates, [I, y]) },
|
|
384
|
+
properties: n
|
|
385
|
+
});
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
M(r._id, { properties: n });
|
|
390
|
+
}
|
|
391
|
+
function te({ row: e, column: t }, r) {
|
|
392
|
+
const n = r.clipboardData.getData("text/plain").split(/\r?\n/)[0].split(" ")[0].trim();
|
|
393
|
+
if (!n || b) return e;
|
|
394
|
+
if (t.key === "_schemaName") {
|
|
395
|
+
const s = m.find((p) => p.name === n || p.id === n);
|
|
396
|
+
return s ? { ...e, _schemaId: s.id, _schemaName: s.name } : e;
|
|
397
|
+
}
|
|
398
|
+
if (t.key === "_lat" || t.key === "_lng")
|
|
399
|
+
return Number.isFinite(Number(n)) ? { ...e, [t.key]: n } : e;
|
|
400
|
+
const o = S.find((s) => s.key === t.key);
|
|
401
|
+
if ((o == null ? void 0 : o.type) === "boolean") {
|
|
402
|
+
const s = _e(n);
|
|
403
|
+
return s === null ? e : { ...e, [t.key]: s };
|
|
404
|
+
}
|
|
405
|
+
return (o == null ? void 0 : o.type) === "number" ? Number.isFinite(Number(n)) ? { ...e, [t.key]: n } : e : (o == null ? void 0 : o.type) === "select" && o.options && !o.options.includes(n) ? e : { ...e, [t.key]: n };
|
|
406
|
+
}
|
|
407
|
+
function re(e) {
|
|
408
|
+
if (u(e), e.size !== 1) return;
|
|
409
|
+
const t = [...e][0];
|
|
410
|
+
h(t);
|
|
411
|
+
const r = f.find((n) => n.id === t);
|
|
412
|
+
if (r)
|
|
413
|
+
if (r.geometry.type === "Point") {
|
|
414
|
+
const [n, o] = r.geometry.coordinates;
|
|
415
|
+
F == null || F([o, n]);
|
|
416
|
+
} else
|
|
417
|
+
T == null || T(r.bbox || be(r.geometry));
|
|
418
|
+
}
|
|
419
|
+
return (
|
|
420
|
+
// Prevent the browser's native text-selection that fires on double-click
|
|
421
|
+
// (mousedown with detail>=2). react-data-grid's own click/dblclick handlers
|
|
422
|
+
// are unaffected — they fire as separate events after mousedown. We exempt
|
|
423
|
+
// inputs/selects so text selection inside edit cells still works normally.
|
|
424
|
+
/* @__PURE__ */ v(
|
|
425
|
+
"div",
|
|
426
|
+
{
|
|
427
|
+
className: "contents",
|
|
428
|
+
onMouseDown: (e) => {
|
|
429
|
+
e.detail >= 2 && !e.target.closest("input, select, textarea") && e.preventDefault();
|
|
430
|
+
},
|
|
431
|
+
children: [
|
|
432
|
+
/* @__PURE__ */ l(
|
|
433
|
+
ce,
|
|
434
|
+
{
|
|
435
|
+
ref: G,
|
|
436
|
+
columns: Y,
|
|
437
|
+
rows: $,
|
|
438
|
+
rowKeyGetter: (e) => e._id,
|
|
439
|
+
rowClass: (e) => z.includes(e._id) ? "elm-row-active" : void 0,
|
|
440
|
+
onRowsChange: ee,
|
|
441
|
+
renderers: { renderSortStatus: De },
|
|
442
|
+
sortColumns: D,
|
|
443
|
+
onSortColumnsChange: R,
|
|
444
|
+
selectedRows: i,
|
|
445
|
+
onSelectedRowsChange: re,
|
|
446
|
+
onCellPaste: te,
|
|
447
|
+
onCellKeyDown: ({ mode: e, row: t, column: r }, n) => {
|
|
448
|
+
e !== "SELECT" || !P.has(r.key) || n.key === " " && n.shiftKey || (n.key === " " || n.key === "Enter" ? (n.preventGridDefault(), n.preventDefault(), L(t._id, r.key)) : n.key.length === 1 && !n.ctrlKey && !n.metaKey && !n.altKey && n.preventGridDefault());
|
|
449
|
+
},
|
|
450
|
+
onCellDoubleClick: ({ column: e }, t) => {
|
|
451
|
+
P.has(e.key) && t.preventGridDefault();
|
|
452
|
+
},
|
|
453
|
+
onCellContextMenu: ({ row: e }, t) => {
|
|
454
|
+
const r = f.find((n) => n.id === e._id);
|
|
455
|
+
r && (t.preventGridDefault(), t.preventDefault(), x.open(t.clientX, t.clientY, r));
|
|
456
|
+
},
|
|
457
|
+
className: K === "dark" ? "rdg-dark" : "rdg-light",
|
|
458
|
+
style: (
|
|
459
|
+
// Cells are transparent so the surrounding DataTablePanel's
|
|
460
|
+
// `bg-elm-surface/95 backdrop-blur-md` shows through —
|
|
461
|
+
// matches the LayersPanel chrome exactly. Sticky cells (last-column
|
|
462
|
+
// row-delete + header) need a SOLID bg to mask horizontally-scrolling
|
|
463
|
+
// content underneath, so they get a panel-matching OPAQUE colour via
|
|
464
|
+
// `--elm-rdg-sticky-bg` (used by sticky rules in index.css) — the header
|
|
465
|
+
// row is sticky on scroll too, so it uses the same colour instead of
|
|
466
|
+
// transparent (rows showed through it). 95% would still leak. Hover /
|
|
467
|
+
// selected stay solid because they need to be readable on top of the
|
|
468
|
+
// panel.
|
|
469
|
+
{
|
|
470
|
+
// Design tokens; the fallbacks are react-data-grid's own text/border
|
|
471
|
+
// colours we used before (#000 / #ddd light, #e5e5e5 / #404040 dark).
|
|
472
|
+
...K === "dark" ? {
|
|
473
|
+
"--rdg-color": "var(--elm-text, #e5e5e5)",
|
|
474
|
+
"--rdg-border-color": "var(--elm-border, #404040)",
|
|
475
|
+
"--rdg-selection-color": "var(--color-primary-400)"
|
|
476
|
+
} : {
|
|
477
|
+
"--rdg-color": "var(--elm-text, #000)",
|
|
478
|
+
"--rdg-border-color": "var(--elm-border, #ddd)",
|
|
479
|
+
"--rdg-selection-color": "var(--color-primary-500)"
|
|
480
|
+
},
|
|
481
|
+
"--rdg-background-color": "transparent",
|
|
482
|
+
"--rdg-header-background-color": "var(--elm-surface, var(--_elm-surface))",
|
|
483
|
+
"--elm-rdg-sticky-bg": "var(--elm-surface, var(--_elm-surface))",
|
|
484
|
+
blockSize: "100%",
|
|
485
|
+
// Row states share the per-theme --elm-row-* tokens with FeatureRow (index.css).
|
|
486
|
+
"--rdg-row-hover-background-color": "var(--elm-row-hover)",
|
|
487
|
+
"--rdg-row-selected-background-color": "var(--elm-row-checked)",
|
|
488
|
+
"--rdg-row-selected-hover-background-color": "var(--elm-row-checked-hover)"
|
|
489
|
+
}
|
|
490
|
+
)
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
x.state && /* @__PURE__ */ l(
|
|
494
|
+
ke,
|
|
495
|
+
{
|
|
496
|
+
x: x.state.x,
|
|
497
|
+
y: x.state.y,
|
|
498
|
+
feature: f.find((e) => e.id === x.state.data.id) ?? x.state.data,
|
|
499
|
+
onClose: x.close,
|
|
500
|
+
showGrouping: !1
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
]
|
|
504
|
+
}
|
|
505
|
+
)
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
export {
|
|
509
|
+
We as default
|
|
510
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("./useAdapterControls-BBObhzVX.cjs"),d=require("./index-BKdDZ4Y9.cjs"),r=require("react"),R=require("clsx"),S=require("@phosphor-icons/react"),Z=require("zustand/react/shallow"),ee=require("@element-editor/core/internal"),te=require("./useAccentStyle-hsGvyHZc.cjs"),E=require("./EditToolbarBtn-dpCmKnzk.cjs"),re=160,se=80;try{CSS.registerProperty({name:"--elm-table-offset",syntax:"<length>",inherits:!0,initialValue:"0px"})}catch{}const M="px-2.5 py-1 rounded-elm-control text-xs font-medium bg-elm-surface text-elm-text ring-1 ring-primary-400 outline-none";function ne({initialValue:a,onCommit:m,onCancel:v}){const[s,f]=r.useState(a),y=r.useRef(null),[h,w]=r.useState(void 0);return r.useLayoutEffect(()=>{const n=y.current;n&&w(n.offsetWidth+4)},[s]),t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:y,"aria-hidden":!0,className:`${M} absolute invisible pointer-events-none whitespace-pre left-[-9999px] top-[-9999px]`,children:s||" "}),t.jsx("input",{autoFocus:!0,value:s,onFocus:n=>n.currentTarget.select(),onChange:n=>f(n.target.value),onBlur:()=>m(s.trim()),onKeyDown:n=>{n.key==="Enter"&&n.currentTarget.blur(),n.key==="Escape"&&(v(),n.preventDefault())},style:{width:h},className:M})]})}const B=`flex ${d.panelHeaderIconBtn.replace("hover:bg-(--elm-surface-hover,var(--color-gray-100))","hover:bg-(--elm-surface-hover,var(--color-gray-200))")}`;function oe({embedded:a=!1}={}){const{dataStore:m}=o.useGeoStore(),v=te.useElementEditorConfig(),s=o.useUIStore(e=>e.tableOpen),f=o.useUIStore(e=>e.readonly),y=o.useUIStore(e=>e.toggleTable),h=o.useUIStore(e=>e.setTableFullscreen),w=o.useUIStore(ee.sidebarTakesSpace),n=o.useUIStore(e=>e.sidebarWidth),$=o.useUIStore(e=>e.codeDockWidth),V=v.ui.layerList&&w,j=o.useDataStore(e=>e.features.length),F=o.useDataStore(Z.useShallow(e=>e.getVisibleSchemas())),{getCenter:I}=o.useMapController(),[g,W]=r.useState(()=>typeof window>"u"?360:Math.round(window.innerHeight*.42)),[x,L]=r.useState("all"),[i,O]=r.useState(!1);r.useEffect(()=>(h(i),()=>h(!1)),[i,h]);const[_,N]=r.useState(null),[C,G]=r.useState(new Set),[X,T]=r.useState(null),H=r.useRef(!1);(s||a)&&(H.current=!0);const[D,P]=r.useState(!s);r.useEffect(()=>{if(s){P(!1);return}const e=setTimeout(()=>P(!0),200);return()=>clearTimeout(e)},[s]);const u=r.useRef(null),K=r.useCallback(e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),u.current=d.startDragShield("row-resize",e.currentTarget))},[]),Y=r.useCallback(e=>{if(!u.current)return;const c=Math.round(window.innerHeight*se/100),l=Math.min(c,Math.max(re,window.innerHeight-e.clientY));W(l)},[]),A=r.useCallback(()=>{var e;(e=u.current)==null||e.call(u),u.current=null},[]),q=r.useRef(null);r.useEffect(()=>{var l;if(a)return;const e=(l=q.current)==null?void 0:l.closest("[data-elm-theme]");if(!e)return;const c=s?i?e.clientHeight:g:0;return e.style.setProperty("--elm-table-offset",`${c}px`),e.style.transition||requestAnimationFrame(()=>{e.style.transition="--elm-table-offset 200ms ease"}),()=>{e.style.setProperty("--elm-table-offset","0px")}},[a,s,i,g]);const J=a?"absolute inset-0 bg-elm-surface flex flex-col":R.clsx("absolute left-0 z-20 bg-elm-surface border-t border-elm-border/80 flex flex-col transition-[right] duration-200 ease-[ease]",!s&&D&&"invisible"),Q=a?void 0:i?{top:0,bottom:0,right:0,height:"100%"}:{height:g,bottom:`calc(min(var(--elm-table-offset, 0px), ${g}px) - ${g}px)`,right:(V?n:0)+$};return t.jsxs("div",{ref:q,className:J,style:Q,children:[!a&&!i&&t.jsx("div",{className:d.resizeEdgeTop,onPointerDown:K,onPointerMove:Y,onPointerUp:A,onLostPointerCapture:A}),t.jsxs("div",{className:`${d.panelHeaderBar} gap-3 px-4`,children:[!f&&t.jsx(E.Tooltip,{content:"Add new entry",children:t.jsxs(E.Button,{variant:"primary",size:"sm",onClick:()=>{const e=(I==null?void 0:I())??[0,0],{schemas:c,getDefaultSchema:l}=m.getState(),k=x!=="all"&&c.find(b=>b.id===x)?x:l().id,p=c.find(b=>b.id===k)??l(),U={};for(const b of p.fields)U[b.key]="";const z=crypto.randomUUID();m.getState().addFeature({type:"Feature",id:z,schemaId:k,geometry:{type:"Point",coordinates:e},properties:U})&&N(z)},children:[t.jsx(S.Plus,{size:11,weight:"bold"}),"Add new"]})}),t.jsxs("span",{className:"text-xs text-elm-text-muted",children:[j," feature",j!==1?"s":"",C.size>0&&`, ${C.size} selected`]}),F.length>1&&t.jsx("div",{role:"tablist","aria-label":"Filter by schema",className:"ml-1 flex items-center gap-0.5 text-xs",children:[{id:"all",name:"All"},...F].map(e=>{const c=x===e.id,l=e.id==="all";return X===e.id?t.jsx(ne,{initialValue:e.name,onCommit:p=>{p&&p!==e.name&&m.getState().updateSchema(e.id,{name:p}),T(null)},onCancel:()=>T(null)},e.id):t.jsx("button",{type:"button",role:"tab","aria-selected":c,onClick:()=>L(e.id),onDoubleClick:()=>{!l&&!f&&T(e.id)},title:l||f?void 0:"Double-click to rename",className:R.clsx("px-2.5 py-1 rounded-elm-control transition-colors whitespace-nowrap",c?"bg-elm-surface hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-800)) text-elm-text font-medium shadow-sm ring-1 ring-(--elm-border,var(--color-gray-200)) dark:ring-(--elm-border,var(--color-gray-700))":"text-(--elm-text-secondary,var(--color-gray-600)) dark:text-(--elm-text-secondary,var(--color-gray-300)) hover:bg-(--elm-surface-hover,var(--color-gray-200)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700))"),children:e.name},e.id)})}),!a&&t.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[t.jsx(E.Tooltip,{content:i?"Exit fullscreen":"Fullscreen",children:t.jsx("button",{type:"button",onClick:()=>O(e=>!e),"aria-label":i?"Exit fullscreen":"Fullscreen",className:B,children:i?t.jsx(S.ArrowsInSimple,{size:16}):t.jsx(S.ArrowsOutSimple,{size:16})})}),t.jsx("button",{type:"button",onClick:y,"aria-label":"Close data table",className:B,children:t.jsx(S.X,{size:16})})]})]}),t.jsx("div",{className:R.clsx("flex-1 min-h-0 overflow-hidden",!a&&!s&&D&&"hidden"),children:j===0?t.jsx(d.NoFeaturesEmptyState,{}):H.current&&t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-(--elm-text-subtle,var(--color-gray-400))",children:"Loading grid..."}),children:t.jsx(d.DataTable,{schemaFilter:x,focusRowId:_,onFocusRowHandled:()=>N(null),selectedRows:C,onSelectedRowsChange:G})})})]})}exports.default=oe;
|