@octostar/map-component 0.1.28 → 0.1.29
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 +449 -248
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +449 -248
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +13 -3
- package/dist/types/components/layers-panel.d.ts +7 -2
- package/dist/types/components/layers-panel.d.ts.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/components/properties-panel.d.ts.map +1 -1
- package/dist/types/lib/map-editor-api.d.ts +62 -0
- package/dist/types/lib/map-editor-api.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1745,6 +1745,7 @@ function LayersPanel({
|
|
|
1745
1745
|
hideBasemapSwitcher = false,
|
|
1746
1746
|
externalPersistence = false,
|
|
1747
1747
|
customGlobalMenuItems,
|
|
1748
|
+
extraLayerToolbarButtons,
|
|
1748
1749
|
layerBadgeProvider,
|
|
1749
1750
|
featureCountProvider
|
|
1750
1751
|
}) {
|
|
@@ -2050,12 +2051,11 @@ function LayersPanel({
|
|
|
2050
2051
|
size: "small",
|
|
2051
2052
|
checked: ((_d = layer.heatmapConfig) == null ? void 0 : _d.enabled) ?? false,
|
|
2052
2053
|
onChange: (checked) => {
|
|
2053
|
-
var _a2, _b2
|
|
2054
|
+
var _a2, _b2;
|
|
2054
2055
|
return onUpdateHeatmapConfig(layer.id, {
|
|
2055
2056
|
enabled: checked,
|
|
2056
2057
|
intensity: ((_a2 = layer.heatmapConfig) == null ? void 0 : _a2.intensity) ?? 1,
|
|
2057
|
-
radius: ((_b2 = layer.heatmapConfig) == null ? void 0 : _b2.radius) ?? 20
|
|
2058
|
-
hideFeatures: ((_c2 = layer.heatmapConfig) == null ? void 0 : _c2.hideFeatures) ?? false
|
|
2058
|
+
radius: ((_b2 = layer.heatmapConfig) == null ? void 0 : _b2.radius) ?? 20
|
|
2059
2059
|
});
|
|
2060
2060
|
},
|
|
2061
2061
|
"data-testid": `switch-heatmap-${layer.id}`
|
|
@@ -2097,20 +2097,6 @@ function LayersPanel({
|
|
|
2097
2097
|
})
|
|
2098
2098
|
}
|
|
2099
2099
|
)
|
|
2100
|
-
] }),
|
|
2101
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
2102
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2103
|
-
antd.Switch,
|
|
2104
|
-
{
|
|
2105
|
-
size: "small",
|
|
2106
|
-
checked: layer.heatmapConfig.hideFeatures ?? false,
|
|
2107
|
-
onChange: (checked) => onUpdateHeatmapConfig(layer.id, {
|
|
2108
|
-
...layer.heatmapConfig,
|
|
2109
|
-
hideFeatures: checked
|
|
2110
|
-
})
|
|
2111
|
-
}
|
|
2112
|
-
),
|
|
2113
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px]", children: "Hide points" })
|
|
2114
2100
|
] })
|
|
2115
2101
|
] })
|
|
2116
2102
|
] }),
|
|
@@ -2536,6 +2522,7 @@ function LayersPanel({
|
|
|
2536
2522
|
) })
|
|
2537
2523
|
}
|
|
2538
2524
|
),
|
|
2525
|
+
extraLayerToolbarButtons,
|
|
2539
2526
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2540
2527
|
antd.Dropdown,
|
|
2541
2528
|
{
|
|
@@ -2818,6 +2805,56 @@ function getFeatureTypeIcon(geometryType, kind, size = "sm") {
|
|
|
2818
2805
|
return null;
|
|
2819
2806
|
}
|
|
2820
2807
|
}
|
|
2808
|
+
function colorPickerNoHexPanel(_panel, extra) {
|
|
2809
|
+
const { Picker, Presets } = extra.components;
|
|
2810
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 min-w-[220px]", children: [
|
|
2811
|
+
/* @__PURE__ */ jsxRuntime.jsx(Picker, {}),
|
|
2812
|
+
/* @__PURE__ */ jsxRuntime.jsx(Presets, {})
|
|
2813
|
+
] });
|
|
2814
|
+
}
|
|
2815
|
+
function LatLngFields(props) {
|
|
2816
|
+
const { latitude, longitude, isEditable, testIdPrefix } = props;
|
|
2817
|
+
if (!isEditable) {
|
|
2818
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2819
|
+
"div",
|
|
2820
|
+
{
|
|
2821
|
+
className: "flex items-center gap-2 text-[13px] font-mono text-foreground px-1 py-1",
|
|
2822
|
+
"data-testid": `${testIdPrefix}-display`,
|
|
2823
|
+
children: [
|
|
2824
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": `${testIdPrefix}-latitude-text`, children: latitude || "—" }),
|
|
2825
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "/" }),
|
|
2826
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": `${testIdPrefix}-longitude-text`, children: longitude || "—" })
|
|
2827
|
+
]
|
|
2828
|
+
}
|
|
2829
|
+
);
|
|
2830
|
+
}
|
|
2831
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
|
|
2832
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2833
|
+
antd.Input,
|
|
2834
|
+
{
|
|
2835
|
+
value: latitude,
|
|
2836
|
+
onChange: (e) => props.onLatChange(e.target.value),
|
|
2837
|
+
onFocus: props.onLatFocus,
|
|
2838
|
+
onBlur: props.onLatBlur,
|
|
2839
|
+
placeholder: "Latitude",
|
|
2840
|
+
className: "!h-6 text-[13px] flex-1",
|
|
2841
|
+
"data-testid": `${testIdPrefix}-latitude`
|
|
2842
|
+
}
|
|
2843
|
+
),
|
|
2844
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2845
|
+
antd.Input,
|
|
2846
|
+
{
|
|
2847
|
+
value: longitude,
|
|
2848
|
+
onChange: (e) => props.onLngChange(e.target.value),
|
|
2849
|
+
onFocus: props.onLngFocus,
|
|
2850
|
+
onBlur: props.onLngBlur,
|
|
2851
|
+
placeholder: "Longitude",
|
|
2852
|
+
className: "!h-6 text-[13px] flex-1",
|
|
2853
|
+
"data-testid": `${testIdPrefix}-longitude`
|
|
2854
|
+
}
|
|
2855
|
+
)
|
|
2856
|
+
] });
|
|
2857
|
+
}
|
|
2821
2858
|
function PointColorDot({ color, size = 20 }) {
|
|
2822
2859
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 20 20", className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "10", r: "7", fill: color, stroke: color, strokeWidth: "2", opacity: "0.9" }) });
|
|
2823
2860
|
}
|
|
@@ -2871,8 +2908,21 @@ const RECORD_EXCLUDE_KEYS = /* @__PURE__ */ new Set([
|
|
|
2871
2908
|
"entityType",
|
|
2872
2909
|
"startDate",
|
|
2873
2910
|
"endDate",
|
|
2874
|
-
|
|
2911
|
+
// The feature's color is already conveyed by the colored dot in the panel
|
|
2912
|
+
// header; showing it again as a property row (`#0C66E4`) is just noise.
|
|
2913
|
+
"color"
|
|
2914
|
+
// NOTE: 'description' intentionally NOT excluded — we surface it as a regular
|
|
2915
|
+
// property row instead of giving it its own labelled section.
|
|
2875
2916
|
]);
|
|
2917
|
+
function buildKeyExclusionPredicate(set) {
|
|
2918
|
+
const lowered = new Set(Array.from(set, (k) => k.toLowerCase()));
|
|
2919
|
+
return (key) => {
|
|
2920
|
+
if (set.has(key)) return true;
|
|
2921
|
+
const normalized = key.toLowerCase().replace(/^[^a-z0-9_-]+/, "");
|
|
2922
|
+
return lowered.has(normalized);
|
|
2923
|
+
};
|
|
2924
|
+
}
|
|
2925
|
+
const isExcludedRecordKey = buildKeyExclusionPredicate(RECORD_EXCLUDE_KEYS);
|
|
2876
2926
|
const RECORD_FIELDS_HIDDEN_PREFIXES = ["_", "os_"];
|
|
2877
2927
|
function parseRecordFields(feature) {
|
|
2878
2928
|
const raw = feature.properties._recordFields;
|
|
@@ -2899,14 +2949,14 @@ function RecordFieldsSection({ feature }) {
|
|
|
2899
2949
|
antd.Collapse,
|
|
2900
2950
|
{
|
|
2901
2951
|
size: "small",
|
|
2902
|
-
defaultActiveKey: [
|
|
2952
|
+
defaultActiveKey: [],
|
|
2903
2953
|
ghost: true,
|
|
2904
2954
|
className: "[&_.ant-collapse-header]:!px-0 [&_.ant-collapse-header]:!py-1 [&_.ant-collapse-content-box]:!px-0 [&_.ant-collapse-content-box]:!py-1",
|
|
2905
2955
|
items: [{
|
|
2906
2956
|
key: "record-fields",
|
|
2907
2957
|
label: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
2908
2958
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "w-3 h-3 text-foreground" }),
|
|
2909
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
2959
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Record Fields" }),
|
|
2910
2960
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] text-muted-foreground ml-1", children: [
|
|
2911
2961
|
"(",
|
|
2912
2962
|
fields.length,
|
|
@@ -3056,10 +3106,46 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3056
3106
|
setLatitude("");
|
|
3057
3107
|
}
|
|
3058
3108
|
}
|
|
3059
|
-
const reserved =
|
|
3109
|
+
const reserved = /* @__PURE__ */ new Set([
|
|
3110
|
+
"name",
|
|
3111
|
+
"description",
|
|
3112
|
+
"startDate",
|
|
3113
|
+
"endDate",
|
|
3114
|
+
"stroke",
|
|
3115
|
+
"stroke-width",
|
|
3116
|
+
"stroke-opacity",
|
|
3117
|
+
"fill",
|
|
3118
|
+
"fill-opacity",
|
|
3119
|
+
"kind",
|
|
3120
|
+
"label",
|
|
3121
|
+
"fontSize",
|
|
3122
|
+
"fontColor",
|
|
3123
|
+
"fontWeight",
|
|
3124
|
+
"arrowSize",
|
|
3125
|
+
"circleCenter",
|
|
3126
|
+
"circleRadius",
|
|
3127
|
+
"icon",
|
|
3128
|
+
"iconSize",
|
|
3129
|
+
"pointIcon",
|
|
3130
|
+
"pointIconSize",
|
|
3131
|
+
"entityType",
|
|
3132
|
+
"entity_id",
|
|
3133
|
+
"entity_type",
|
|
3134
|
+
"entity_label",
|
|
3135
|
+
"os_workspace",
|
|
3136
|
+
"workspace",
|
|
3137
|
+
"source_name",
|
|
3138
|
+
"id",
|
|
3139
|
+
"latitude",
|
|
3140
|
+
"longitude",
|
|
3141
|
+
// The marker color is shown via the colored dot in the panel header,
|
|
3142
|
+
// so we don't repeat it as an editable property row.
|
|
3143
|
+
"color"
|
|
3144
|
+
]);
|
|
3145
|
+
const isReservedKey = buildKeyExclusionPredicate(reserved);
|
|
3060
3146
|
const custom = [];
|
|
3061
3147
|
Object.entries(feature.properties).forEach(([key, value]) => {
|
|
3062
|
-
if (!
|
|
3148
|
+
if (!isReservedKey(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("os_") && !key.startsWith("isHidden")) {
|
|
3063
3149
|
custom.push({ key, value: String(value) });
|
|
3064
3150
|
}
|
|
3065
3151
|
});
|
|
@@ -3243,7 +3329,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3243
3329
|
handleRefresh(true);
|
|
3244
3330
|
}, [feature == null ? void 0 : feature.id, isRecord, featureRefreshProvider, feature, handleRefresh]);
|
|
3245
3331
|
const recordProperties = feature ? Object.entries(feature.properties).filter(
|
|
3246
|
-
([key, value]) => !
|
|
3332
|
+
([key, value]) => !isExcludedRecordKey(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("os_") && !key.startsWith("isHidden")
|
|
3247
3333
|
).map(([key, value]) => ({ key, value: String(value) })) : [];
|
|
3248
3334
|
const entityCardsContent = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 space-y-2", children: entityCardProvider ? selectedFeatures.map((f) => {
|
|
3249
3335
|
const geoFeature = {
|
|
@@ -3260,7 +3346,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3260
3346
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3261
3347
|
"div",
|
|
3262
3348
|
{
|
|
3263
|
-
className: "absolute top-4 right-4 z-10 w-
|
|
3349
|
+
className: "absolute top-4 right-4 z-10 w-80 bg-background/95 floating-panel rounded-lg shadow-lg border border-border",
|
|
3264
3350
|
"data-testid": "panel-properties",
|
|
3265
3351
|
children: [
|
|
3266
3352
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 px-2.5 py-2 border-b border-border", children: [
|
|
@@ -3296,21 +3382,20 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3296
3382
|
onMoveFeaturesToLayer && /* @__PURE__ */ jsxRuntime.jsx(antd.Dropdown, { menu: { items: buildLayerMenuItems("move") }, trigger: ["click"], placement: "bottomRight", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { title: "Move to layer", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FolderInput, { className: "w-3.5 h-3.5" }), className: "!w-5 !h-5 !min-w-0 !p-0", "data-testid": "button-move-to-layer-prop" }) }) })
|
|
3297
3383
|
] })
|
|
3298
3384
|
] }),
|
|
3299
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-
|
|
3300
|
-
isRecord ? /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "cyan", className: "!text-[
|
|
3301
|
-
isUnsaved && /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "orange", className: "!text-[
|
|
3385
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
3386
|
+
isRecord ? /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "cyan", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !m-0 !font-semibold", children: "Octostar record" }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "blue", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !m-0 !font-semibold", children: "Local map feature" }),
|
|
3387
|
+
isUnsaved && /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "orange", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !border-0 !m-0 !font-semibold", children: "Unsaved" }),
|
|
3302
3388
|
!isRecord && featureSaveProvider && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3303
3389
|
antd.Button,
|
|
3304
3390
|
{
|
|
3305
3391
|
type: "primary",
|
|
3306
|
-
size: "
|
|
3307
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "w-3 h-3" }),
|
|
3392
|
+
size: "middle",
|
|
3393
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "w-3.5 h-3.5" }),
|
|
3308
3394
|
loading: isSaving,
|
|
3309
3395
|
onClick: handleFeatureSave,
|
|
3310
|
-
className: "!h-
|
|
3311
|
-
style: { padding: "1px 6px" },
|
|
3396
|
+
className: "!h-7 !px-3 !text-[12px] !font-medium",
|
|
3312
3397
|
"data-testid": "button-save-feature",
|
|
3313
|
-
children: "Create entity
|
|
3398
|
+
children: "Create entity"
|
|
3314
3399
|
}
|
|
3315
3400
|
)
|
|
3316
3401
|
] })
|
|
@@ -3394,92 +3479,57 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3394
3479
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-xs text-muted-foreground", children: "Lat / Lng" }),
|
|
3395
3480
|
feature.geometry.type !== "Point" && /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { title: "Lat and Lng refer to the centroid of this feature", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] text-muted-foreground cursor-help", children: "*" }) })
|
|
3396
3481
|
] }),
|
|
3397
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3482
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3483
|
+
LatLngFields,
|
|
3484
|
+
{
|
|
3485
|
+
latitude,
|
|
3486
|
+
longitude,
|
|
3487
|
+
isEditable: feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer,
|
|
3488
|
+
testIdPrefix: "input-feature",
|
|
3489
|
+
onLatChange: setLatitude,
|
|
3490
|
+
onLngChange: setLongitude,
|
|
3491
|
+
onLatFocus: () => {
|
|
3492
|
+
latInputFocused.current = true;
|
|
3493
|
+
},
|
|
3494
|
+
onLngFocus: () => {
|
|
3495
|
+
lngInputFocused.current = true;
|
|
3496
|
+
},
|
|
3497
|
+
onLatBlur: () => {
|
|
3498
|
+
latInputFocused.current = false;
|
|
3499
|
+
if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
|
|
3500
|
+
const lat = parseFloat(latitude);
|
|
3501
|
+
const lng = parseFloat(longitude);
|
|
3502
|
+
const coords = feature.geometry.coordinates;
|
|
3503
|
+
if (isNaN(lat)) {
|
|
3504
|
+
toast({ title: "Invalid latitude", description: "Please enter a valid number", variant: "destructive" });
|
|
3505
|
+
setLatitude(coords[1].toFixed(6));
|
|
3506
|
+
} else if (lat < -90 || lat > 90) {
|
|
3507
|
+
toast({ title: "Invalid latitude", description: "Latitude must be between -90 and 90", variant: "destructive" });
|
|
3508
|
+
setLatitude(coords[1].toFixed(6));
|
|
3509
|
+
} else if (isNaN(lng) || lng < -180 || lng > 180) ;
|
|
3510
|
+
else {
|
|
3511
|
+
onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
|
|
3425
3512
|
}
|
|
3426
|
-
}
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
"
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
|
|
3444
|
-
const lat = parseFloat(latitude);
|
|
3445
|
-
const lng = parseFloat(longitude);
|
|
3446
|
-
const coords = feature.geometry.coordinates;
|
|
3447
|
-
if (isNaN(lng)) {
|
|
3448
|
-
toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
|
|
3449
|
-
setLongitude(coords[0].toFixed(6));
|
|
3450
|
-
} else if (lng < -180 || lng > 180) {
|
|
3451
|
-
toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
|
|
3452
|
-
setLongitude(coords[0].toFixed(6));
|
|
3453
|
-
} else if (isNaN(lat) || lat < -90 || lat > 90) ;
|
|
3454
|
-
else {
|
|
3455
|
-
onUpdateGeometry(feature.id, {
|
|
3456
|
-
type: "Point",
|
|
3457
|
-
coordinates: [lng, lat]
|
|
3458
|
-
});
|
|
3459
|
-
}
|
|
3513
|
+
}
|
|
3514
|
+
},
|
|
3515
|
+
onLngBlur: () => {
|
|
3516
|
+
lngInputFocused.current = false;
|
|
3517
|
+
if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
|
|
3518
|
+
const lat = parseFloat(latitude);
|
|
3519
|
+
const lng = parseFloat(longitude);
|
|
3520
|
+
const coords = feature.geometry.coordinates;
|
|
3521
|
+
if (isNaN(lng)) {
|
|
3522
|
+
toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
|
|
3523
|
+
setLongitude(coords[0].toFixed(6));
|
|
3524
|
+
} else if (lng < -180 || lng > 180) {
|
|
3525
|
+
toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
|
|
3526
|
+
setLongitude(coords[0].toFixed(6));
|
|
3527
|
+
} else if (isNaN(lat) || lat < -90 || lat > 90) ;
|
|
3528
|
+
else {
|
|
3529
|
+
onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
|
|
3460
3530
|
}
|
|
3461
|
-
}
|
|
3462
|
-
placeholder: "Longitude",
|
|
3463
|
-
readOnly: feature.geometry.type !== "Point" || !isEditMode || isReadOnlyLayer,
|
|
3464
|
-
className: "!h-6 text-[13px] flex-1",
|
|
3465
|
-
"data-testid": "input-feature-longitude"
|
|
3531
|
+
}
|
|
3466
3532
|
}
|
|
3467
|
-
)
|
|
3468
|
-
] })
|
|
3469
|
-
] }),
|
|
3470
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
|
|
3471
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "feature-description", className: "text-xs text-muted-foreground", children: "Description" }),
|
|
3472
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3473
|
-
TextArea,
|
|
3474
|
-
{
|
|
3475
|
-
id: "feature-description",
|
|
3476
|
-
value: description,
|
|
3477
|
-
onChange: (e) => setDescription(e.target.value),
|
|
3478
|
-
onBlur: () => handleSave(),
|
|
3479
|
-
placeholder: isEditMode ? "Add description..." : "No description",
|
|
3480
|
-
className: "!min-h-[50px] resize-none text-[13px]",
|
|
3481
|
-
readOnly: !isEditMode,
|
|
3482
|
-
"data-testid": "input-feature-description"
|
|
3483
3533
|
}
|
|
3484
3534
|
)
|
|
3485
3535
|
] }),
|
|
@@ -3495,7 +3545,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3495
3545
|
key: "temporal",
|
|
3496
3546
|
label: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
3497
3547
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "w-3 h-3 text-foreground" }),
|
|
3498
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
3548
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Temporal" }),
|
|
3499
3549
|
(startDate || endDate) && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] text-muted-foreground ml-1", children: [
|
|
3500
3550
|
"(",
|
|
3501
3551
|
startDate && endDate ? "2 dates" : "1 date",
|
|
@@ -3582,10 +3632,10 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3582
3632
|
}
|
|
3583
3633
|
),
|
|
3584
3634
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
|
|
3585
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
3635
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
3586
3636
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
3587
3637
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Palette, { className: "w-3 h-3 text-foreground" }),
|
|
3588
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
3638
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Style" })
|
|
3589
3639
|
] }),
|
|
3590
3640
|
feature.properties.kind === "text" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
3591
3641
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -3702,6 +3752,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3702
3752
|
disabled: !isEditMode,
|
|
3703
3753
|
size: "small",
|
|
3704
3754
|
showText: false,
|
|
3755
|
+
disabledAlpha: true,
|
|
3756
|
+
panelRender: colorPickerNoHexPanel,
|
|
3705
3757
|
"data-testid": "color-picker-stroke"
|
|
3706
3758
|
}
|
|
3707
3759
|
) }) }),
|
|
@@ -3776,6 +3828,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3776
3828
|
disabled: !isEditMode,
|
|
3777
3829
|
size: "small",
|
|
3778
3830
|
showText: false,
|
|
3831
|
+
disabledAlpha: true,
|
|
3832
|
+
panelRender: colorPickerNoHexPanel,
|
|
3779
3833
|
"data-testid": "color-picker-fill"
|
|
3780
3834
|
}
|
|
3781
3835
|
) }) }),
|
|
@@ -3832,49 +3886,67 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3832
3886
|
] })
|
|
3833
3887
|
] }),
|
|
3834
3888
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
|
|
3835
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
3836
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3889
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
3890
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Properties" }),
|
|
3891
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
3892
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-1", children: [
|
|
3893
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[13px] font-mono text-muted-foreground shrink-0 w-24 px-1 leading-6 select-none", children: "description" }),
|
|
3894
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3895
|
+
TextArea,
|
|
3896
|
+
{
|
|
3897
|
+
id: "feature-description",
|
|
3898
|
+
value: description,
|
|
3899
|
+
onChange: (e) => setDescription(e.target.value),
|
|
3900
|
+
onBlur: () => handleSave(),
|
|
3901
|
+
autoSize: { minRows: 1, maxRows: 5 },
|
|
3902
|
+
placeholder: isEditMode ? "—" : "",
|
|
3903
|
+
readOnly: !isEditMode,
|
|
3904
|
+
className: "flex-1 !text-[13px] !px-1.5 !py-0.5 resize-none",
|
|
3905
|
+
"data-testid": "input-feature-description"
|
|
3906
|
+
}
|
|
3907
|
+
)
|
|
3908
|
+
] }),
|
|
3909
|
+
customProperties.map((prop, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
3910
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3911
|
+
antd.Input,
|
|
3912
|
+
{
|
|
3913
|
+
value: prop.key,
|
|
3914
|
+
onChange: (e) => handlePropertyKeyChange(index, e.target.value),
|
|
3915
|
+
onBlur: () => handleSave(),
|
|
3916
|
+
placeholder: "Key",
|
|
3917
|
+
className: "shrink-0 w-24 text-[13px] font-mono !h-6 !px-1",
|
|
3918
|
+
readOnly: !isEditMode,
|
|
3919
|
+
"data-testid": `input-property-key-${index}`
|
|
3920
|
+
}
|
|
3921
|
+
),
|
|
3922
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3923
|
+
antd.Input,
|
|
3924
|
+
{
|
|
3925
|
+
value: prop.value,
|
|
3926
|
+
onChange: (e) => handlePropertyValueChange(index, e.target.value),
|
|
3927
|
+
onBlur: () => handleSave(),
|
|
3928
|
+
placeholder: "Value",
|
|
3929
|
+
className: "flex-1 text-[13px] !h-6 !px-1.5",
|
|
3930
|
+
readOnly: !isEditMode,
|
|
3931
|
+
"data-testid": `input-property-value-${index}`
|
|
3932
|
+
}
|
|
3933
|
+
),
|
|
3934
|
+
isEditMode && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3935
|
+
"button",
|
|
3936
|
+
{
|
|
3937
|
+
type: "button",
|
|
3938
|
+
onClick: () => {
|
|
3939
|
+
handleRemoveProperty(index);
|
|
3940
|
+
setTimeout(() => handleSave(), 0);
|
|
3941
|
+
},
|
|
3942
|
+
className: "text-destructive shrink-0 h-6 w-6 flex items-center justify-center rounded hover:bg-destructive/10 transition-colors",
|
|
3943
|
+
"data-testid": `button-remove-property-${index}`,
|
|
3944
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "w-3 h-3" })
|
|
3945
|
+
}
|
|
3946
|
+
)
|
|
3947
|
+
] }, index))
|
|
3948
|
+
] }),
|
|
3949
|
+
isEditMode && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 pt-0.5", children: [
|
|
3878
3950
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3879
3951
|
antd.Input,
|
|
3880
3952
|
{
|
|
@@ -3886,8 +3958,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3886
3958
|
handleAddProperty();
|
|
3887
3959
|
}
|
|
3888
3960
|
},
|
|
3889
|
-
placeholder: "New property
|
|
3890
|
-
className: "flex-1 text-[13px] !h-
|
|
3961
|
+
placeholder: "New property…",
|
|
3962
|
+
className: "flex-1 text-[13px] !h-6 !px-1.5",
|
|
3891
3963
|
"data-testid": "input-new-property-key"
|
|
3892
3964
|
}
|
|
3893
3965
|
),
|
|
@@ -3897,9 +3969,9 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3897
3969
|
type: "button",
|
|
3898
3970
|
onClick: handleAddProperty,
|
|
3899
3971
|
disabled: !newPropertyKey.trim(),
|
|
3900
|
-
className: "h-
|
|
3972
|
+
className: "h-6 w-6 flex items-center justify-center border border-border rounded disabled:opacity-50 hover:bg-muted transition-colors",
|
|
3901
3973
|
"data-testid": "button-add-property",
|
|
3902
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "w-
|
|
3974
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "w-3 h-3" })
|
|
3903
3975
|
}
|
|
3904
3976
|
)
|
|
3905
3977
|
] })
|
|
@@ -3919,7 +3991,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3919
3991
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] text-muted-foreground", children: "Layer:" }),
|
|
3920
3992
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] text-foreground truncate", children: layerName })
|
|
3921
3993
|
] }),
|
|
3922
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-
|
|
3994
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 flex-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "cyan", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !m-0 !font-semibold", children: "Octostar record" }) })
|
|
3923
3995
|
] }),
|
|
3924
3996
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
|
|
3925
3997
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -3940,93 +4012,73 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
3940
4012
|
) })
|
|
3941
4013
|
] }) }),
|
|
3942
4014
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
|
|
3943
|
-
feature.properties.description && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3944
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
|
|
3945
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-xs text-muted-foreground", children: "Description" }),
|
|
3946
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[13px] text-foreground whitespace-pre-wrap break-words m-0", children: String(feature.properties.description) })
|
|
3947
|
-
] }),
|
|
3948
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" })
|
|
3949
|
-
] }),
|
|
3950
4015
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
|
|
3951
4016
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
3952
4017
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.MapPin, { className: "w-3 h-3 text-muted-foreground" }),
|
|
3953
4018
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-xs text-muted-foreground", children: "Lat / Lng" }),
|
|
3954
4019
|
feature.geometry.type !== "Point" && /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { title: "Lat and Lng refer to the centroid of this feature", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] text-muted-foreground cursor-help", children: "*" }) })
|
|
3955
4020
|
] }),
|
|
3956
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
4021
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4022
|
+
LatLngFields,
|
|
4023
|
+
{
|
|
4024
|
+
latitude,
|
|
4025
|
+
longitude,
|
|
4026
|
+
isEditable: feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer,
|
|
4027
|
+
testIdPrefix: "input-record",
|
|
4028
|
+
onLatChange: setLatitude,
|
|
4029
|
+
onLngChange: setLongitude,
|
|
4030
|
+
onLatFocus: () => {
|
|
4031
|
+
latInputFocused.current = true;
|
|
4032
|
+
},
|
|
4033
|
+
onLngFocus: () => {
|
|
4034
|
+
lngInputFocused.current = true;
|
|
4035
|
+
},
|
|
4036
|
+
onLatBlur: () => {
|
|
4037
|
+
latInputFocused.current = false;
|
|
4038
|
+
if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
|
|
4039
|
+
const lat = parseFloat(latitude);
|
|
4040
|
+
const lng = parseFloat(longitude);
|
|
4041
|
+
const coords = feature.geometry.coordinates;
|
|
4042
|
+
if (isNaN(lat)) {
|
|
4043
|
+
toast({ title: "Invalid latitude", description: "Please enter a valid number", variant: "destructive" });
|
|
4044
|
+
setLatitude(coords[1].toFixed(6));
|
|
4045
|
+
} else if (lat < -90 || lat > 90) {
|
|
4046
|
+
toast({ title: "Invalid latitude", description: "Latitude must be between -90 and 90", variant: "destructive" });
|
|
4047
|
+
setLatitude(coords[1].toFixed(6));
|
|
4048
|
+
} else if (isNaN(lng) || lng < -180 || lng > 180) ;
|
|
4049
|
+
else {
|
|
4050
|
+
onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
|
|
3981
4051
|
}
|
|
3982
|
-
}
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
"
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
|
|
4000
|
-
const lat = parseFloat(latitude);
|
|
4001
|
-
const lng = parseFloat(longitude);
|
|
4002
|
-
const coords = feature.geometry.coordinates;
|
|
4003
|
-
if (isNaN(lng)) {
|
|
4004
|
-
toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
|
|
4005
|
-
setLongitude(coords[0].toFixed(6));
|
|
4006
|
-
} else if (lng < -180 || lng > 180) {
|
|
4007
|
-
toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
|
|
4008
|
-
setLongitude(coords[0].toFixed(6));
|
|
4009
|
-
} else if (isNaN(lat) || lat < -90 || lat > 90) ;
|
|
4010
|
-
else {
|
|
4011
|
-
onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
|
|
4012
|
-
}
|
|
4052
|
+
}
|
|
4053
|
+
},
|
|
4054
|
+
onLngBlur: () => {
|
|
4055
|
+
lngInputFocused.current = false;
|
|
4056
|
+
if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
|
|
4057
|
+
const lat = parseFloat(latitude);
|
|
4058
|
+
const lng = parseFloat(longitude);
|
|
4059
|
+
const coords = feature.geometry.coordinates;
|
|
4060
|
+
if (isNaN(lng)) {
|
|
4061
|
+
toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
|
|
4062
|
+
setLongitude(coords[0].toFixed(6));
|
|
4063
|
+
} else if (lng < -180 || lng > 180) {
|
|
4064
|
+
toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
|
|
4065
|
+
setLongitude(coords[0].toFixed(6));
|
|
4066
|
+
} else if (isNaN(lat) || lat < -90 || lat > 90) ;
|
|
4067
|
+
else {
|
|
4068
|
+
onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
|
|
4013
4069
|
}
|
|
4014
|
-
}
|
|
4015
|
-
placeholder: "Longitude",
|
|
4016
|
-
readOnly: feature.geometry.type !== "Point" || !isEditMode || isReadOnlyLayer,
|
|
4017
|
-
className: "!h-6 text-[13px] flex-1",
|
|
4018
|
-
"data-testid": "input-record-longitude"
|
|
4070
|
+
}
|
|
4019
4071
|
}
|
|
4020
|
-
|
|
4021
|
-
|
|
4072
|
+
}
|
|
4073
|
+
)
|
|
4022
4074
|
] }),
|
|
4023
4075
|
recordProperties.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4024
4076
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
|
|
4025
4077
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
4026
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
4078
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Properties" }),
|
|
4027
4079
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: recordProperties.map(({ key, value }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 py-0.5", children: [
|
|
4028
4080
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-muted-foreground shrink-0 pt-px min-w-[80px]", children: formatPropertyKey(key) }),
|
|
4029
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] text-foreground break-
|
|
4081
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] text-foreground whitespace-pre-wrap break-words", children: value })
|
|
4030
4082
|
] }, key)) })
|
|
4031
4083
|
] })
|
|
4032
4084
|
] }),
|
|
@@ -4046,7 +4098,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
4046
4098
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4047
4099
|
"div",
|
|
4048
4100
|
{
|
|
4049
|
-
className: "absolute top-4 right-4 z-10 w-
|
|
4101
|
+
className: "absolute top-4 right-4 z-10 w-80 bg-background/95 floating-panel rounded-lg shadow-lg border border-border flex flex-col overflow-hidden",
|
|
4050
4102
|
style: { maxHeight: "calc(100vh - 6rem)" },
|
|
4051
4103
|
"data-testid": "panel-properties",
|
|
4052
4104
|
children: [
|
|
@@ -4179,7 +4231,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
4179
4231
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4180
4232
|
"div",
|
|
4181
4233
|
{
|
|
4182
|
-
className: "absolute top-4 right-4 z-10 w-
|
|
4234
|
+
className: "absolute top-4 right-4 z-10 w-72 bg-background/95 floating-panel rounded-lg shadow-lg border border-border flex flex-col overflow-hidden",
|
|
4183
4235
|
style: { maxHeight: "calc(100vh - 6rem)" },
|
|
4184
4236
|
"data-testid": "panel-properties",
|
|
4185
4237
|
children: [
|
|
@@ -5713,6 +5765,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
5713
5765
|
enableProperties = true,
|
|
5714
5766
|
toastProvider,
|
|
5715
5767
|
customGlobalMenuItems,
|
|
5768
|
+
extraLayerToolbarButtons,
|
|
5716
5769
|
layerBadgeProvider,
|
|
5717
5770
|
featureCountProvider,
|
|
5718
5771
|
fitBoundsProvider,
|
|
@@ -5795,6 +5848,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
5795
5848
|
const [cursorCoords, setCursorCoords] = react.useState(null);
|
|
5796
5849
|
const [contextMenu, setContextMenu] = react.useState(null);
|
|
5797
5850
|
const timelineStore = useTimelineStore();
|
|
5851
|
+
react.useEffect(() => () => useTimelineStore.getState().reset(), []);
|
|
5798
5852
|
const { toast: internalToast } = useToast();
|
|
5799
5853
|
const toast = toastProvider ?? internalToast;
|
|
5800
5854
|
react.useEffect(() => {
|
|
@@ -6158,7 +6212,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6158
6212
|
const sourceData = {
|
|
6159
6213
|
type: "FeatureCollection",
|
|
6160
6214
|
features: allFeatures.map((f) => {
|
|
6161
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l
|
|
6215
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
6162
6216
|
const featureId = String(f.id);
|
|
6163
6217
|
const layer = featureToLayer.get(featureId);
|
|
6164
6218
|
const visualConfig = layer == null ? void 0 : layer.visualConfig;
|
|
@@ -6230,8 +6284,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6230
6284
|
featureIconSize = iconConfig.size ?? 24;
|
|
6231
6285
|
}
|
|
6232
6286
|
const isPoint = f.geometry.type === "Point";
|
|
6233
|
-
const hideByHeatmap = isPoint && ((_i = layer == null ? void 0 : layer.heatmapConfig) == null ? void 0 : _i.enabled)
|
|
6234
|
-
const hideByCluster = isPoint && ((
|
|
6287
|
+
const hideByHeatmap = isPoint && ((_i = layer == null ? void 0 : layer.heatmapConfig) == null ? void 0 : _i.enabled) === true;
|
|
6288
|
+
const hideByCluster = isPoint && ((_j = layer == null ? void 0 : layer.clusterConfig) == null ? void 0 : _j.enabled) === true && !((_k = layer == null ? void 0 : layer.clusterConfig) == null ? void 0 : _k.showPointDots);
|
|
6235
6289
|
const isSelected = selectedIds.includes(featureId);
|
|
6236
6290
|
const hideByTrace = false;
|
|
6237
6291
|
const isLine = f.geometry.type === "LineString" || f.geometry.type === "MultiLineString";
|
|
@@ -6273,7 +6327,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6273
6327
|
"stroke-width": strokeWidth,
|
|
6274
6328
|
"stroke-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? baseOpacity : 0,
|
|
6275
6329
|
fill: strokeColor,
|
|
6276
|
-
"fill-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? ((
|
|
6330
|
+
"fill-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? ((_l = f.properties) == null ? void 0 : _l["fill-opacity"]) ?? 0.2 : 0,
|
|
6277
6331
|
pointRadius,
|
|
6278
6332
|
isHiddenFor3DOnly: hideFlatFor3DOnly ? 1 : 0,
|
|
6279
6333
|
isTimelineHidden: isTimelineVisible ? 0 : 1
|
|
@@ -6659,8 +6713,15 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6659
6713
|
attributionControl: false,
|
|
6660
6714
|
boxZoom: false,
|
|
6661
6715
|
// Disable default box zoom - we use shift+drag for selection instead
|
|
6662
|
-
maxPitch: 80
|
|
6716
|
+
maxPitch: 80,
|
|
6663
6717
|
// Allow steep camera angles for 3D terrain viewing
|
|
6718
|
+
// Required for `getCanvas().toDataURL()` (used by `captureScreenshot()`
|
|
6719
|
+
// on the imperative handle) to return a populated image instead of a
|
|
6720
|
+
// blank one. In maplibre-gl v5 this lives under
|
|
6721
|
+
// `canvasContextAttributes`, not at the top level. Modern desktop GPUs
|
|
6722
|
+
// absorb the small extra cost without measurable impact on this
|
|
6723
|
+
// editor-grade map.
|
|
6724
|
+
canvasContextAttributes: { preserveDrawingBuffer: true }
|
|
6664
6725
|
});
|
|
6665
6726
|
const attrCtrl = new maplibregl.AttributionControl({
|
|
6666
6727
|
compact: true,
|
|
@@ -6937,7 +6998,26 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6937
6998
|
// Text features: center anchor; others: top anchor
|
|
6938
6999
|
"text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
|
|
6939
7000
|
"text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
|
|
6940
|
-
|
|
7001
|
+
// Collision behaviour for entity labels.
|
|
7002
|
+
//
|
|
7003
|
+
// `kind === 'text'` features are sticky-note style annotations
|
|
7004
|
+
// where the text IS the content (this layer has no icon-image,
|
|
7005
|
+
// and `text-optional` cannot fall back to anything). If we let
|
|
7006
|
+
// collision detection hide them, the user is left with a tiny
|
|
7007
|
+
// 5px circle and no visible note. Same for trace endpoint
|
|
7008
|
+
// labels — the label IS the meaningful marker.
|
|
7009
|
+
//
|
|
7010
|
+
// Plain entity-name labels are supplementary to the icon/dot,
|
|
7011
|
+
// so it's safe to let MapLibre thin them out in dense areas
|
|
7012
|
+
// (this is the "no more black mass of stacked labels" win).
|
|
7013
|
+
"text-allow-overlap": [
|
|
7014
|
+
"case",
|
|
7015
|
+
["==", ["get", "kind"], "text"],
|
|
7016
|
+
true,
|
|
7017
|
+
["==", ["get", "isTraceLabel"], true],
|
|
7018
|
+
true,
|
|
7019
|
+
false
|
|
7020
|
+
],
|
|
6941
7021
|
"text-ignore-placement": false,
|
|
6942
7022
|
"text-optional": true,
|
|
6943
7023
|
// Bold font for text features with fontWeight=bold, trace labels, others regular
|
|
@@ -7856,6 +7936,101 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
7856
7936
|
if (!map.current || !isMapLoadedRef.current) return;
|
|
7857
7937
|
map.current.flyTo({ center: coords, zoom: zoom ?? map.current.getZoom(), duration: (options == null ? void 0 : options.duration) ?? 2e3 });
|
|
7858
7938
|
},
|
|
7939
|
+
updateLayerConfig: (layerId, config) => {
|
|
7940
|
+
const idx = layersRef.current.findIndex((l) => l.id === layerId);
|
|
7941
|
+
if (idx < 0) return false;
|
|
7942
|
+
const current = layersRef.current[idx];
|
|
7943
|
+
const next = { ...current };
|
|
7944
|
+
if ("visible" in config) {
|
|
7945
|
+
const wantedVisible = config.visible ?? true;
|
|
7946
|
+
if (wantedVisible !== current.visible && !current.readOnly && draw.current) {
|
|
7947
|
+
if (wantedVisible) {
|
|
7948
|
+
const hidden = hiddenFeatures.current.get(layerId) || [];
|
|
7949
|
+
const newIds = [];
|
|
7950
|
+
isApiAddingRef.current = true;
|
|
7951
|
+
try {
|
|
7952
|
+
hidden.forEach((f) => {
|
|
7953
|
+
const ids = draw.current.add(f);
|
|
7954
|
+
newIds.push(ids[0]);
|
|
7955
|
+
});
|
|
7956
|
+
} finally {
|
|
7957
|
+
isApiAddingRef.current = false;
|
|
7958
|
+
}
|
|
7959
|
+
hiddenFeatures.current.delete(layerId);
|
|
7960
|
+
next.visible = true;
|
|
7961
|
+
next.featureIds = newIds;
|
|
7962
|
+
} else {
|
|
7963
|
+
const features = current.featureIds.map((id) => draw.current.get(id)).filter(Boolean);
|
|
7964
|
+
hiddenFeatures.current.set(layerId, features);
|
|
7965
|
+
current.featureIds.forEach((id) => {
|
|
7966
|
+
try {
|
|
7967
|
+
draw.current.delete(id);
|
|
7968
|
+
} catch {
|
|
7969
|
+
}
|
|
7970
|
+
});
|
|
7971
|
+
next.visible = false;
|
|
7972
|
+
next.featureIds = [];
|
|
7973
|
+
}
|
|
7974
|
+
} else {
|
|
7975
|
+
next.visible = wantedVisible;
|
|
7976
|
+
}
|
|
7977
|
+
}
|
|
7978
|
+
if ("visualConfig" in config) next.visualConfig = config.visualConfig;
|
|
7979
|
+
if ("traceConfig" in config) next.traceConfig = config.traceConfig;
|
|
7980
|
+
if ("heatmapConfig" in config) next.heatmapConfig = config.heatmapConfig;
|
|
7981
|
+
if ("clusterConfig" in config) next.clusterConfig = config.clusterConfig;
|
|
7982
|
+
if ("altitudeDisplayMode" in config) next.altitudeDisplayMode = config.altitudeDisplayMode;
|
|
7983
|
+
const updated = [...layersRef.current];
|
|
7984
|
+
updated[idx] = next;
|
|
7985
|
+
layersRef.current = updated;
|
|
7986
|
+
setLayers(updated);
|
|
7987
|
+
if ("visible" in config) {
|
|
7988
|
+
updateFeatureCount();
|
|
7989
|
+
scheduleTimelineUpdate();
|
|
7990
|
+
}
|
|
7991
|
+
requestAnimationFrame(() => syncRef.current());
|
|
7992
|
+
return true;
|
|
7993
|
+
},
|
|
7994
|
+
captureScreenshot: async (options) => {
|
|
7995
|
+
const m = map.current;
|
|
7996
|
+
if (!m || !isMapLoadedRef.current) {
|
|
7997
|
+
toast({
|
|
7998
|
+
title: "Screenshot failed",
|
|
7999
|
+
description: "Map is not ready yet.",
|
|
8000
|
+
variant: "destructive"
|
|
8001
|
+
});
|
|
8002
|
+
throw new Error("Map is not ready");
|
|
8003
|
+
}
|
|
8004
|
+
const SCREENSHOT_RENDER_TIMEOUT_MS = 1e4;
|
|
8005
|
+
try {
|
|
8006
|
+
await new Promise((resolve, reject) => {
|
|
8007
|
+
const onRender = () => {
|
|
8008
|
+
clearTimeout(timeoutId);
|
|
8009
|
+
resolve();
|
|
8010
|
+
};
|
|
8011
|
+
const timeoutId = setTimeout(() => {
|
|
8012
|
+
try {
|
|
8013
|
+
m.off("render", onRender);
|
|
8014
|
+
} catch {
|
|
8015
|
+
}
|
|
8016
|
+
reject(new Error("Screenshot timed out waiting for render (map may have been destroyed)"));
|
|
8017
|
+
}, SCREENSHOT_RENDER_TIMEOUT_MS);
|
|
8018
|
+
m.once("render", onRender);
|
|
8019
|
+
m.triggerRepaint();
|
|
8020
|
+
});
|
|
8021
|
+
} catch (err) {
|
|
8022
|
+
toast({
|
|
8023
|
+
title: "Screenshot failed",
|
|
8024
|
+
description: err instanceof Error ? err.message : "The map did not render in time. Please try again.",
|
|
8025
|
+
variant: "destructive"
|
|
8026
|
+
});
|
|
8027
|
+
throw err;
|
|
8028
|
+
}
|
|
8029
|
+
const canvas = m.getCanvas();
|
|
8030
|
+
const fmt = (options == null ? void 0 : options.format) === "jpeg" ? "image/jpeg" : "image/png";
|
|
8031
|
+
const dataUrl = fmt === "image/jpeg" ? canvas.toDataURL(fmt, options == null ? void 0 : options.quality) : canvas.toDataURL(fmt);
|
|
8032
|
+
return { dataUrl, width: canvas.width, height: canvas.height };
|
|
8033
|
+
},
|
|
7859
8034
|
fitToData: (layerIds) => {
|
|
7860
8035
|
if (!map.current || !isMapLoadedRef.current) return;
|
|
7861
8036
|
const drawFeatures = draw.current ? draw.current.getAll().features : [];
|
|
@@ -7894,11 +8069,25 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
7894
8069
|
const newLayer = {
|
|
7895
8070
|
id: layerId,
|
|
7896
8071
|
name,
|
|
7897
|
-
visible
|
|
8072
|
+
// Default to visible. The optional `visible` flag lets restore-flows
|
|
8073
|
+
// recreate a layer that the user had previously hidden, without
|
|
8074
|
+
// racing a follow-up `setLayerVisibility(id, false)` call (which
|
|
8075
|
+
// briefly flashes the layer on screen between addLayer and the
|
|
8076
|
+
// visibility toggle).
|
|
8077
|
+
visible: (options == null ? void 0 : options.visible) ?? true,
|
|
7898
8078
|
featureIds: [],
|
|
7899
8079
|
readOnly: options == null ? void 0 : options.readOnly,
|
|
7900
8080
|
group: options == null ? void 0 : options.group,
|
|
7901
|
-
metadata: options == null ? void 0 : options.metadata
|
|
8081
|
+
metadata: options == null ? void 0 : options.metadata,
|
|
8082
|
+
// Per-layer visual configs are passed through verbatim so that hosts
|
|
8083
|
+
// restoring a saved map (workspace auto-save, file merge, etc.) can
|
|
8084
|
+
// recreate heatmap / cluster / color-by-field / label / size / trace
|
|
8085
|
+
// settings without a follow-up "update visual config" round-trip.
|
|
8086
|
+
visualConfig: options == null ? void 0 : options.visualConfig,
|
|
8087
|
+
traceConfig: options == null ? void 0 : options.traceConfig,
|
|
8088
|
+
heatmapConfig: options == null ? void 0 : options.heatmapConfig,
|
|
8089
|
+
clusterConfig: options == null ? void 0 : options.clusterConfig,
|
|
8090
|
+
altitudeDisplayMode: options == null ? void 0 : options.altitudeDisplayMode
|
|
7902
8091
|
};
|
|
7903
8092
|
if (geojson) {
|
|
7904
8093
|
if (options == null ? void 0 : options.readOnly) {
|
|
@@ -7937,6 +8126,17 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
7937
8126
|
}
|
|
7938
8127
|
}
|
|
7939
8128
|
}
|
|
8129
|
+
if (newLayer.visible === false && !(options == null ? void 0 : options.readOnly) && draw.current && newLayer.featureIds.length > 0) {
|
|
8130
|
+
const features = newLayer.featureIds.map((id) => draw.current.get(id)).filter(Boolean);
|
|
8131
|
+
hiddenFeatures.current.set(layerId, features);
|
|
8132
|
+
newLayer.featureIds.forEach((id) => {
|
|
8133
|
+
try {
|
|
8134
|
+
draw.current.delete(id);
|
|
8135
|
+
} catch {
|
|
8136
|
+
}
|
|
8137
|
+
});
|
|
8138
|
+
newLayer.featureIds = [];
|
|
8139
|
+
}
|
|
7940
8140
|
const updatedLayers = [...layersRef.current, newLayer];
|
|
7941
8141
|
layersRef.current = updatedLayers;
|
|
7942
8142
|
setLayers(updatedLayers);
|
|
@@ -12179,6 +12379,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
12179
12379
|
hideBasemapSwitcher,
|
|
12180
12380
|
externalPersistence,
|
|
12181
12381
|
customGlobalMenuItems,
|
|
12382
|
+
extraLayerToolbarButtons,
|
|
12182
12383
|
layerBadgeProvider,
|
|
12183
12384
|
featureCountProvider
|
|
12184
12385
|
}
|