@octostar/map-component 0.5.0 → 0.6.1
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/README.md +1 -0
- package/dist/index.mjs +182 -87
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +16 -22
- package/dist/types/components/drawing-toolbar.d.ts.map +1 -1
- package/dist/types/components/feature-date-picker.d.ts +10 -0
- package/dist/types/components/feature-date-picker.d.ts.map +1 -0
- 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/hooks/use-antd-prefix.d.ts +7 -0
- package/dist/types/hooks/use-antd-prefix.d.ts.map +1 -0
- package/dist/types/hooks/use-confirm.d.ts +9 -0
- package/dist/types/hooks/use-confirm.d.ts.map +1 -0
- package/dist/types/hooks/use-toast.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/map-editor-api.d.ts +2 -0
- package/dist/types/lib/map-editor-api.d.ts.map +1 -1
- package/dist/types/lib/utils.d.ts +2 -0
- package/dist/types/lib/utils.d.ts.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -99,6 +99,7 @@ Host requirements:
|
|
|
99
99
|
- maplibre-gl 6 needs WebGL2. A browser without it shows no map.
|
|
100
100
|
- maplibre's worker is inlined in this package and starts from a `blob:` URL, so a Content-Security-Policy needs `worker-src blob:`.
|
|
101
101
|
- Don't override or dedupe `maplibre-gl` in the host: the inlined worker must match the exact version this package pins, and a mismatch logs an error and breaks rendering. Take maplibre fixes by upgrading this package.
|
|
102
|
+
- `antd` 6.1 or later is a peer dependency: the host installs it, and the component renders through the host's `ConfigProvider` (class prefix, theme, CSS variables) and `App` (confirm dialogs, toasts). It never bundles an antd of its own, so a host needs no override to keep a single antd instance.
|
|
102
103
|
|
|
103
104
|
## Main Components
|
|
104
105
|
|
package/dist/index.mjs
CHANGED
|
@@ -7,15 +7,14 @@ import * as turf from "@turf/turf";
|
|
|
7
7
|
import { distance as distance$1, point } from "@turf/turf";
|
|
8
8
|
import * as THREE from "three";
|
|
9
9
|
import proj4 from "proj4";
|
|
10
|
-
import { Button, Modal, Input, App, message, Tooltip, Dropdown, Divider, Popover, Switch, Slider, Tag, Select, Segmented, Collapse, ColorPicker, Tabs, Card, Table
|
|
10
|
+
import { Button, Modal, Input, App, message, ConfigProvider, Tooltip, Dropdown, Divider, Popover, Switch, Slider, Tag, Select, Segmented, DatePicker, Collapse, ColorPicker, Tabs, Card, Table } from "antd";
|
|
11
11
|
import { clsx } from "clsx";
|
|
12
12
|
import { twMerge } from "tailwind-merge";
|
|
13
13
|
import { MousePointer2, Square, Hexagon, Circle, MoreVertical, ChevronDown, Filter, X, Move, Ruler, Search, Scan, Pencil, Database, MapPin, Minus, Pentagon, Type, MoveRight, Undo2, Redo2, Trash2, Navigation, Loader2, Map as Map$1, Satellite, FolderOpen, Upload, Download, MoreHorizontal, Focus, Box, Layers, Plus, ChevronRight, Eye, EyeOff, Lock, Smile, Package, Copy, FolderInput, Save, Calendar, Palette, Blend, RefreshCw, ExternalLink, Info, ChevronLeft, SkipBack, Pause, Play, Clock, AlertTriangle, TestTube, Users, GripVertical, Plane, FileJson, Check, Phone, Car, AlertCircle } from "lucide-react";
|
|
14
14
|
import { createPortal } from "react-dom";
|
|
15
|
-
import
|
|
15
|
+
import dayjs from "dayjs";
|
|
16
16
|
import { createStore, useStore } from "zustand";
|
|
17
17
|
import Flatbush from "flatbush";
|
|
18
|
-
import dayjs from "dayjs";
|
|
19
18
|
import * as toGeoJSON from "@mapbox/togeojson";
|
|
20
19
|
function detectSourceCRS(geojson) {
|
|
21
20
|
var _a, _b;
|
|
@@ -2738,6 +2737,16 @@ function cn(...inputs) {
|
|
|
2738
2737
|
function pushAll(target, items) {
|
|
2739
2738
|
for (const item of items) target.push(item);
|
|
2740
2739
|
}
|
|
2740
|
+
const HTML_ESCAPES = {
|
|
2741
|
+
"&": "&",
|
|
2742
|
+
"<": "<",
|
|
2743
|
+
">": ">",
|
|
2744
|
+
'"': """,
|
|
2745
|
+
"'": "'"
|
|
2746
|
+
};
|
|
2747
|
+
function escapeHtml(value) {
|
|
2748
|
+
return String(value).replace(/[&<>"']/g, (ch) => HTML_ESCAPES[ch]);
|
|
2749
|
+
}
|
|
2741
2750
|
function downloadBlob(blob, filename) {
|
|
2742
2751
|
const url = URL.createObjectURL(blob);
|
|
2743
2752
|
const anchor = document.createElement("a");
|
|
@@ -2789,18 +2798,13 @@ function stripInternalPropertiesFromFeature(feature, keep) {
|
|
|
2789
2798
|
const ToastContext = createContext(null);
|
|
2790
2799
|
function useToast() {
|
|
2791
2800
|
const externalToast = useContext(ToastContext);
|
|
2801
|
+
const { message: message$1 } = App.useApp();
|
|
2792
2802
|
if (externalToast) {
|
|
2793
2803
|
return { toast: externalToast };
|
|
2794
2804
|
}
|
|
2795
|
-
let message$1 = null;
|
|
2796
|
-
try {
|
|
2797
|
-
const app = App.useApp();
|
|
2798
|
-
message$1 = app.message;
|
|
2799
|
-
} catch {
|
|
2800
|
-
}
|
|
2801
2805
|
const toast = ({ title, description, variant }) => {
|
|
2802
2806
|
const content = description ? `${title ? title + ": " : ""}${description}` : title;
|
|
2803
|
-
const msg = message$1
|
|
2807
|
+
const msg = typeof message$1.success === "function" ? message$1 : message;
|
|
2804
2808
|
if (variant === "destructive") {
|
|
2805
2809
|
msg.error(content);
|
|
2806
2810
|
} else {
|
|
@@ -2809,6 +2813,19 @@ function useToast() {
|
|
|
2809
2813
|
};
|
|
2810
2814
|
return { toast };
|
|
2811
2815
|
}
|
|
2816
|
+
const POPUP_COMPONENTS = ["dropdown", "select-dropdown", "modal-root", "popover", "tooltip", "slider", "color-picker"];
|
|
2817
|
+
function useAntdPopupSelector() {
|
|
2818
|
+
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
2819
|
+
return useMemo(() => POPUP_COMPONENTS.map((c) => `.${getPrefixCls(c)}`).join(", "), [getPrefixCls]);
|
|
2820
|
+
}
|
|
2821
|
+
function useConfirm() {
|
|
2822
|
+
const { modal } = App.useApp();
|
|
2823
|
+
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
2824
|
+
return useMemo(() => {
|
|
2825
|
+
const confirm = typeof modal.confirm === "function" ? modal.confirm : Modal.confirm;
|
|
2826
|
+
return (props) => confirm({ prefixCls: getPrefixCls("modal"), ...props });
|
|
2827
|
+
}, [modal, getPrefixCls]);
|
|
2828
|
+
}
|
|
2812
2829
|
const DEFAULT_ENDPOINTS = {
|
|
2813
2830
|
streetsStyle: "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",
|
|
2814
2831
|
darkStyle: "https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",
|
|
@@ -3035,6 +3052,8 @@ function DrawingToolbar({
|
|
|
3035
3052
|
showUndoRedo = false
|
|
3036
3053
|
}) {
|
|
3037
3054
|
const { toast } = useToast();
|
|
3055
|
+
const confirm = useConfirm();
|
|
3056
|
+
const antdPopupSelector = useAntdPopupSelector();
|
|
3038
3057
|
const [goToLat, setGoToLat] = useState("");
|
|
3039
3058
|
const [goToLng, setGoToLng] = useState("");
|
|
3040
3059
|
const [goToAddress, setGoToAddress] = useState("");
|
|
@@ -3062,14 +3081,14 @@ function DrawingToolbar({
|
|
|
3062
3081
|
if (!featureSearchOpen) return;
|
|
3063
3082
|
const handlePointerDown = (e) => {
|
|
3064
3083
|
const target = e.target;
|
|
3065
|
-
if (target.closest('[data-testid="toolbar-drawing"]') || target.closest('[data-testid="search-panel"]') || target.closest(
|
|
3084
|
+
if (target.closest('[data-testid="toolbar-drawing"]') || target.closest('[data-testid="search-panel"]') || target.closest(antdPopupSelector)) {
|
|
3066
3085
|
return;
|
|
3067
3086
|
}
|
|
3068
3087
|
setFeatureSearchOpen(false);
|
|
3069
3088
|
};
|
|
3070
3089
|
document.addEventListener("pointerdown", handlePointerDown);
|
|
3071
3090
|
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
3072
|
-
}, [featureSearchOpen]);
|
|
3091
|
+
}, [featureSearchOpen, antdPopupSelector]);
|
|
3073
3092
|
const getFeatureLabel = (f) => {
|
|
3074
3093
|
var _a;
|
|
3075
3094
|
const p = f.properties || {};
|
|
@@ -3204,7 +3223,7 @@ function DrawingToolbar({
|
|
|
3204
3223
|
}
|
|
3205
3224
|
};
|
|
3206
3225
|
const handleClearAll = () => {
|
|
3207
|
-
|
|
3226
|
+
confirm({
|
|
3208
3227
|
title: "Clear all features?",
|
|
3209
3228
|
content: `This will remove all ${featureCount} feature${featureCount !== 1 ? "s" : ""} from the map. This action cannot be undone.`,
|
|
3210
3229
|
okText: "Clear all",
|
|
@@ -4122,7 +4141,7 @@ function ColorPickerPopover({ value, onChange, testId }) {
|
|
|
4122
4141
|
content: popoverContent,
|
|
4123
4142
|
trigger: "click",
|
|
4124
4143
|
placement: "bottomLeft",
|
|
4125
|
-
|
|
4144
|
+
classNames: { root: "z-[10001]" },
|
|
4126
4145
|
children: /* @__PURE__ */ jsx(
|
|
4127
4146
|
Button,
|
|
4128
4147
|
{
|
|
@@ -4313,6 +4332,7 @@ function LayersPanel({
|
|
|
4313
4332
|
layerBadgeProvider,
|
|
4314
4333
|
featureCountProvider
|
|
4315
4334
|
}) {
|
|
4335
|
+
const confirm = useConfirm();
|
|
4316
4336
|
const [editingLayerId, setEditingLayerId] = useState(null);
|
|
4317
4337
|
const [editingName, setEditingName] = useState("");
|
|
4318
4338
|
const [expandedLayers, setExpandedLayers] = useState(/* @__PURE__ */ new Set());
|
|
@@ -4392,7 +4412,7 @@ function LayersPanel({
|
|
|
4392
4412
|
});
|
|
4393
4413
|
}, [selectedFeatureIds, onMoveFeatureToLayer]);
|
|
4394
4414
|
const handleDeleteLayer = useCallback((layer) => {
|
|
4395
|
-
|
|
4415
|
+
confirm({
|
|
4396
4416
|
title: `Delete layer "${layer.name}"?`,
|
|
4397
4417
|
content: "This will delete the layer and all its features.",
|
|
4398
4418
|
okText: "Delete",
|
|
@@ -4400,7 +4420,7 @@ function LayersPanel({
|
|
|
4400
4420
|
cancelText: "Cancel",
|
|
4401
4421
|
onOk: () => onRemoveLayer(layer.id)
|
|
4402
4422
|
});
|
|
4403
|
-
}, [onRemoveLayer]);
|
|
4423
|
+
}, [confirm, onRemoveLayer]);
|
|
4404
4424
|
const renderLayerItem = (layer) => {
|
|
4405
4425
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa;
|
|
4406
4426
|
const customCount = featureCountProvider == null ? void 0 : featureCountProvider(layer.id);
|
|
@@ -5474,6 +5494,121 @@ function LayersPanel({
|
|
|
5474
5494
|
}
|
|
5475
5495
|
);
|
|
5476
5496
|
}
|
|
5497
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
5498
|
+
function getDefaultExportFromCjs(x) {
|
|
5499
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
5500
|
+
}
|
|
5501
|
+
var localeData$1 = { exports: {} };
|
|
5502
|
+
(function(module, exports$1) {
|
|
5503
|
+
!(function(n, e) {
|
|
5504
|
+
module.exports = e();
|
|
5505
|
+
})(commonjsGlobal, (function() {
|
|
5506
|
+
return function(n, e, t) {
|
|
5507
|
+
var r = e.prototype, o = function(n2) {
|
|
5508
|
+
return n2 && (n2.indexOf ? n2 : n2.s);
|
|
5509
|
+
}, u = function(n2, e2, t2, r2, u2) {
|
|
5510
|
+
var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map((function(n3) {
|
|
5511
|
+
return n3.slice(0, r2);
|
|
5512
|
+
}));
|
|
5513
|
+
if (!u2) return f;
|
|
5514
|
+
var d = i2.weekStart;
|
|
5515
|
+
return f.map((function(n3, e3) {
|
|
5516
|
+
return f[(e3 + (d || 0)) % 7];
|
|
5517
|
+
}));
|
|
5518
|
+
}, i = function() {
|
|
5519
|
+
return t.Ls[t.locale()];
|
|
5520
|
+
}, a = function(n2, e2) {
|
|
5521
|
+
return n2.formats[e2] || (function(n3) {
|
|
5522
|
+
return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(n4, e3, t2) {
|
|
5523
|
+
return e3 || t2.slice(1);
|
|
5524
|
+
}));
|
|
5525
|
+
})(n2.formats[e2.toUpperCase()]);
|
|
5526
|
+
}, s = function() {
|
|
5527
|
+
var n2 = this;
|
|
5528
|
+
return { months: function(e2) {
|
|
5529
|
+
return e2 ? e2.format("MMMM") : u(n2, "months");
|
|
5530
|
+
}, monthsShort: function(e2) {
|
|
5531
|
+
return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
|
|
5532
|
+
}, firstDayOfWeek: function() {
|
|
5533
|
+
return n2.$locale().weekStart || 0;
|
|
5534
|
+
}, weekdays: function(e2) {
|
|
5535
|
+
return e2 ? e2.format("dddd") : u(n2, "weekdays");
|
|
5536
|
+
}, weekdaysMin: function(e2) {
|
|
5537
|
+
return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
|
|
5538
|
+
}, weekdaysShort: function(e2) {
|
|
5539
|
+
return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
|
|
5540
|
+
}, longDateFormat: function(e2) {
|
|
5541
|
+
return a(n2.$locale(), e2);
|
|
5542
|
+
}, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
|
|
5543
|
+
};
|
|
5544
|
+
r.localeData = function() {
|
|
5545
|
+
return s.bind(this)();
|
|
5546
|
+
}, t.localeData = function() {
|
|
5547
|
+
var n2 = i();
|
|
5548
|
+
return { firstDayOfWeek: function() {
|
|
5549
|
+
return n2.weekStart || 0;
|
|
5550
|
+
}, weekdays: function() {
|
|
5551
|
+
return t.weekdays();
|
|
5552
|
+
}, weekdaysShort: function() {
|
|
5553
|
+
return t.weekdaysShort();
|
|
5554
|
+
}, weekdaysMin: function() {
|
|
5555
|
+
return t.weekdaysMin();
|
|
5556
|
+
}, months: function() {
|
|
5557
|
+
return t.months();
|
|
5558
|
+
}, monthsShort: function() {
|
|
5559
|
+
return t.monthsShort();
|
|
5560
|
+
}, longDateFormat: function(e2) {
|
|
5561
|
+
return a(n2, e2);
|
|
5562
|
+
}, meridiem: n2.meridiem, ordinal: n2.ordinal };
|
|
5563
|
+
}, t.months = function() {
|
|
5564
|
+
return u(i(), "months");
|
|
5565
|
+
}, t.monthsShort = function() {
|
|
5566
|
+
return u(i(), "monthsShort", "months", 3);
|
|
5567
|
+
}, t.weekdays = function(n2) {
|
|
5568
|
+
return u(i(), "weekdays", null, null, n2);
|
|
5569
|
+
}, t.weekdaysShort = function(n2) {
|
|
5570
|
+
return u(i(), "weekdaysShort", "weekdays", 3, n2);
|
|
5571
|
+
}, t.weekdaysMin = function(n2) {
|
|
5572
|
+
return u(i(), "weekdaysMin", "weekdays", 2, n2);
|
|
5573
|
+
};
|
|
5574
|
+
};
|
|
5575
|
+
}));
|
|
5576
|
+
})(localeData$1);
|
|
5577
|
+
var localeDataExports = localeData$1.exports;
|
|
5578
|
+
const localeData = /* @__PURE__ */ getDefaultExportFromCjs(localeDataExports);
|
|
5579
|
+
var weekday$1 = { exports: {} };
|
|
5580
|
+
(function(module, exports$1) {
|
|
5581
|
+
!(function(e, t) {
|
|
5582
|
+
module.exports = t();
|
|
5583
|
+
})(commonjsGlobal, (function() {
|
|
5584
|
+
return function(e, t) {
|
|
5585
|
+
t.prototype.weekday = function(e2) {
|
|
5586
|
+
var t2 = this.$locale().weekStart || 0, i = this.$W, n = (i < t2 ? i + 7 : i) - t2;
|
|
5587
|
+
return this.$utils().u(e2) ? n : this.subtract(n, "day").add(e2, "day");
|
|
5588
|
+
};
|
|
5589
|
+
};
|
|
5590
|
+
}));
|
|
5591
|
+
})(weekday$1);
|
|
5592
|
+
var weekdayExports = weekday$1.exports;
|
|
5593
|
+
const weekday = /* @__PURE__ */ getDefaultExportFromCjs(weekdayExports);
|
|
5594
|
+
dayjs.extend(weekday);
|
|
5595
|
+
dayjs.extend(localeData);
|
|
5596
|
+
function FeatureDatePicker({ value, onChange, disabled, "data-testid": testId }) {
|
|
5597
|
+
const date = useMemo(() => value ? dayjs(value) : null, [value]);
|
|
5598
|
+
return /* @__PURE__ */ jsx(
|
|
5599
|
+
DatePicker,
|
|
5600
|
+
{
|
|
5601
|
+
showTime: true,
|
|
5602
|
+
format: "YYYY-MM-DD HH:mm",
|
|
5603
|
+
size: "small",
|
|
5604
|
+
value: date,
|
|
5605
|
+
onChange: (picked) => onChange(picked ? picked.startOf("minute").toISOString() : ""),
|
|
5606
|
+
disabled,
|
|
5607
|
+
className: "!h-6 flex-1",
|
|
5608
|
+
"data-testid": testId
|
|
5609
|
+
}
|
|
5610
|
+
);
|
|
5611
|
+
}
|
|
5477
5612
|
function deepClone(value) {
|
|
5478
5613
|
try {
|
|
5479
5614
|
return structuredClone(value);
|
|
@@ -5846,6 +5981,7 @@ function parseRecordFields(feature) {
|
|
|
5846
5981
|
return [];
|
|
5847
5982
|
}
|
|
5848
5983
|
}
|
|
5984
|
+
const FLUSH_COLLAPSE = { header: "!px-0 !py-1", body: "!px-0 !py-1" };
|
|
5849
5985
|
function RecordFieldsSection({ feature }) {
|
|
5850
5986
|
const fields = parseRecordFields(feature);
|
|
5851
5987
|
if (fields.length === 0) return null;
|
|
@@ -5855,7 +5991,7 @@ function RecordFieldsSection({ feature }) {
|
|
|
5855
5991
|
size: "small",
|
|
5856
5992
|
defaultActiveKey: [],
|
|
5857
5993
|
ghost: true,
|
|
5858
|
-
|
|
5994
|
+
classNames: FLUSH_COLLAPSE,
|
|
5859
5995
|
items: [{
|
|
5860
5996
|
key: "record-fields",
|
|
5861
5997
|
label: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
@@ -6112,8 +6248,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
6112
6248
|
...feature.properties,
|
|
6113
6249
|
name: name || void 0,
|
|
6114
6250
|
description: description || void 0,
|
|
6115
|
-
startDate: startDate || void 0,
|
|
6116
|
-
endDate: endDate || void 0,
|
|
6251
|
+
startDate: ((overrides == null ? void 0 : overrides.startDate) ?? startDate) || void 0,
|
|
6252
|
+
endDate: ((overrides == null ? void 0 : overrides.endDate) ?? endDate) || void 0,
|
|
6117
6253
|
"stroke": (overrides == null ? void 0 : overrides.strokeColor) ?? strokeColor,
|
|
6118
6254
|
"stroke-width": (overrides == null ? void 0 : overrides.strokeWidth) ?? strokeWidth,
|
|
6119
6255
|
"stroke-opacity": (overrides == null ? void 0 : overrides.strokeOpacity) ?? strokeOpacity,
|
|
@@ -6460,7 +6596,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
6460
6596
|
size: "small",
|
|
6461
6597
|
defaultActiveKey: startDate || endDate ? ["temporal"] : [],
|
|
6462
6598
|
ghost: true,
|
|
6463
|
-
|
|
6599
|
+
classNames: FLUSH_COLLAPSE,
|
|
6464
6600
|
items: [{
|
|
6465
6601
|
key: "temporal",
|
|
6466
6602
|
label: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
@@ -6476,75 +6612,31 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
6476
6612
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6477
6613
|
/* @__PURE__ */ jsx("label", { className: "text-[13px] text-muted-foreground w-8 shrink-0", children: "Start" }),
|
|
6478
6614
|
/* @__PURE__ */ jsx(
|
|
6479
|
-
|
|
6615
|
+
FeatureDatePicker,
|
|
6480
6616
|
{
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
if (val) {
|
|
6486
|
-
const newDate = new Date(val).toISOString();
|
|
6487
|
-
setStartDate(newDate);
|
|
6488
|
-
setTimeout(() => handleSave(), 0);
|
|
6489
|
-
} else {
|
|
6490
|
-
setStartDate("");
|
|
6491
|
-
setTimeout(() => handleSave(), 0);
|
|
6492
|
-
}
|
|
6617
|
+
value: startDate,
|
|
6618
|
+
onChange: (iso) => {
|
|
6619
|
+
setStartDate(iso);
|
|
6620
|
+
handleSave({ startDate: iso });
|
|
6493
6621
|
},
|
|
6494
|
-
className: "flex-1 h-6 text-[13px] px-2 rounded-md border border-input bg-background",
|
|
6495
6622
|
disabled: !isEditMode,
|
|
6496
6623
|
"data-testid": "input-feature-start-date"
|
|
6497
6624
|
}
|
|
6498
|
-
),
|
|
6499
|
-
startDate && isEditMode && /* @__PURE__ */ jsx(
|
|
6500
|
-
Button,
|
|
6501
|
-
{
|
|
6502
|
-
type: "text",
|
|
6503
|
-
icon: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" }),
|
|
6504
|
-
onClick: () => {
|
|
6505
|
-
setStartDate("");
|
|
6506
|
-
setTimeout(() => handleSave(), 0);
|
|
6507
|
-
},
|
|
6508
|
-
className: "!w-6 !h-6 !min-w-0 !p-0 shrink-0",
|
|
6509
|
-
"data-testid": "button-clear-start-date"
|
|
6510
|
-
}
|
|
6511
6625
|
)
|
|
6512
6626
|
] }),
|
|
6513
6627
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6514
6628
|
/* @__PURE__ */ jsx("label", { className: "text-[13px] text-muted-foreground w-8 shrink-0", children: "End" }),
|
|
6515
6629
|
/* @__PURE__ */ jsx(
|
|
6516
|
-
|
|
6630
|
+
FeatureDatePicker,
|
|
6517
6631
|
{
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
if (val) {
|
|
6523
|
-
const newDate = new Date(val).toISOString();
|
|
6524
|
-
setEndDate(newDate);
|
|
6525
|
-
setTimeout(() => handleSave(), 0);
|
|
6526
|
-
} else {
|
|
6527
|
-
setEndDate("");
|
|
6528
|
-
setTimeout(() => handleSave(), 0);
|
|
6529
|
-
}
|
|
6632
|
+
value: endDate,
|
|
6633
|
+
onChange: (iso) => {
|
|
6634
|
+
setEndDate(iso);
|
|
6635
|
+
handleSave({ endDate: iso });
|
|
6530
6636
|
},
|
|
6531
|
-
className: "flex-1 h-6 text-[13px] px-2 rounded-md border border-input bg-background",
|
|
6532
6637
|
disabled: !isEditMode,
|
|
6533
6638
|
"data-testid": "input-feature-end-date"
|
|
6534
6639
|
}
|
|
6535
|
-
),
|
|
6536
|
-
endDate && isEditMode && /* @__PURE__ */ jsx(
|
|
6537
|
-
Button,
|
|
6538
|
-
{
|
|
6539
|
-
type: "text",
|
|
6540
|
-
icon: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" }),
|
|
6541
|
-
onClick: () => {
|
|
6542
|
-
setEndDate("");
|
|
6543
|
-
setTimeout(() => handleSave(), 0);
|
|
6544
|
-
},
|
|
6545
|
-
className: "!w-6 !h-6 !min-w-0 !p-0 shrink-0",
|
|
6546
|
-
"data-testid": "button-clear-end-date"
|
|
6547
|
-
}
|
|
6548
6640
|
)
|
|
6549
6641
|
] })
|
|
6550
6642
|
] })
|
|
@@ -7019,7 +7111,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
7019
7111
|
size: "small",
|
|
7020
7112
|
defaultActiveKey: ["inline-entity-card"],
|
|
7021
7113
|
ghost: true,
|
|
7022
|
-
|
|
7114
|
+
classNames: FLUSH_COLLAPSE,
|
|
7023
7115
|
items: [{
|
|
7024
7116
|
key: "inline-entity-card",
|
|
7025
7117
|
label: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
@@ -7179,7 +7271,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
|
|
|
7179
7271
|
onChange: handleTabChange,
|
|
7180
7272
|
onTabClick: handleTabClick,
|
|
7181
7273
|
size: "small",
|
|
7182
|
-
className: "flex-1 min-h-0 flex flex-col
|
|
7274
|
+
className: "flex-1 min-h-0 flex flex-col tabs-fill-column",
|
|
7275
|
+
classNames: { header: "!px-2 !mb-0 shrink-0" },
|
|
7183
7276
|
items: [
|
|
7184
7277
|
{
|
|
7185
7278
|
key: "cards",
|
|
@@ -11465,13 +11558,13 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
11465
11558
|
const displayProps = Object.entries(props).filter(([key, value]) => !TOOLTIP_EXCLUDED_KEYS.includes(key) && !key.startsWith("_") && !key.startsWith("isHidden") && !key.startsWith("isTrace") && !key.startsWith("isTimeline") && !key.startsWith("trace") && value != null && value !== "").slice(0, 5);
|
|
11466
11559
|
const name = props.name;
|
|
11467
11560
|
let html = '<div class="text-sm space-y-0.5">';
|
|
11468
|
-
if (name) html += `<div class="font-medium">${name}</div>`;
|
|
11469
|
-
if (featureId) html += `<div class="text-xs text-muted-foreground"><span class="opacity-70">ID:</span> ${
|
|
11561
|
+
if (name) html += `<div class="font-medium">${escapeHtml(name)}</div>`;
|
|
11562
|
+
if (featureId) html += `<div class="text-xs text-muted-foreground"><span class="opacity-70">ID:</span> ${escapeHtml(featureId.slice(0, 30))}</div>`;
|
|
11470
11563
|
const otherProps = displayProps.filter(([k]) => k !== "name" && k !== "id");
|
|
11471
11564
|
if (otherProps.length > 0) {
|
|
11472
11565
|
html += '<div class="text-xs text-muted-foreground space-y-0.5">';
|
|
11473
11566
|
otherProps.forEach(([key, value]) => {
|
|
11474
|
-
html += `<div><span class="opacity-70">${key}:</span> ${String(value).slice(0, 30)}</div>`;
|
|
11567
|
+
html += `<div><span class="opacity-70">${escapeHtml(key)}:</span> ${escapeHtml(String(value).slice(0, 30))}</div>`;
|
|
11475
11568
|
});
|
|
11476
11569
|
html += "</div>";
|
|
11477
11570
|
}
|
|
@@ -11479,7 +11572,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
11479
11572
|
html += '<div class="text-xs border-t border-border/50 mt-1 pt-1 space-y-0.5">';
|
|
11480
11573
|
highlightFields.forEach((fieldName) => {
|
|
11481
11574
|
const value = props[fieldName];
|
|
11482
|
-
if (value != null && value !== "") html += `<div class="flex justify-between gap-2"><span class="opacity-70">${fieldName}:</span> <span class="font-medium">${String(value).slice(0, 20)}</span></div>`;
|
|
11575
|
+
if (value != null && value !== "") html += `<div class="flex justify-between gap-2"><span class="opacity-70">${escapeHtml(fieldName)}:</span> <span class="font-medium">${escapeHtml(String(value).slice(0, 20))}</span></div>`;
|
|
11483
11576
|
});
|
|
11484
11577
|
html += "</div>";
|
|
11485
11578
|
}
|
|
@@ -11696,15 +11789,15 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
11696
11789
|
const toName = props.toName || "";
|
|
11697
11790
|
let html = '<div class="text-sm space-y-1">';
|
|
11698
11791
|
if (fromName || toName) {
|
|
11699
|
-
html += `<div class="font-medium text-xs text-muted-foreground">${fromName || "?"} → ${toName || "?"}</div>`;
|
|
11792
|
+
html += `<div class="font-medium text-xs text-muted-foreground">${escapeHtml(fromName || "?")} → ${escapeHtml(toName || "?")}</div>`;
|
|
11700
11793
|
}
|
|
11701
11794
|
html += '<div class="space-y-0.5">';
|
|
11702
|
-
html += `<div><span class="text-muted-foreground">Duration:</span> <span class="font-medium">${duration}</span></div>`;
|
|
11703
|
-
html += `<div><span class="text-muted-foreground">Distance:</span> <span class="font-medium">${distance2}</span></div>`;
|
|
11704
|
-
html += `<div><span class="text-muted-foreground">Avg Speed:</span> <span class="font-medium">${avgSpeed}</span></div>`;
|
|
11795
|
+
html += `<div><span class="text-muted-foreground">Duration:</span> <span class="font-medium">${escapeHtml(duration)}</span></div>`;
|
|
11796
|
+
html += `<div><span class="text-muted-foreground">Distance:</span> <span class="font-medium">${escapeHtml(distance2)}</span></div>`;
|
|
11797
|
+
html += `<div><span class="text-muted-foreground">Avg Speed:</span> <span class="font-medium">${escapeHtml(avgSpeed)}</span></div>`;
|
|
11705
11798
|
html += "</div>";
|
|
11706
11799
|
if (group) {
|
|
11707
|
-
html += `<div class="text-xs text-muted-foreground border-t border-border/50 mt-1 pt-1">Group: ${group}</div>`;
|
|
11800
|
+
html += `<div class="text-xs text-muted-foreground border-t border-border/50 mt-1 pt-1">Group: ${escapeHtml(group)}</div>`;
|
|
11708
11801
|
}
|
|
11709
11802
|
html += "</div>";
|
|
11710
11803
|
if (!tracePopupRef.current) {
|
|
@@ -13237,18 +13330,19 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
13237
13330
|
const handleToggleLayers = useCallback(() => {
|
|
13238
13331
|
setShowLayers((prev) => !prev);
|
|
13239
13332
|
}, []);
|
|
13333
|
+
const antdPopupSelector = useAntdPopupSelector();
|
|
13240
13334
|
useEffect(() => {
|
|
13241
13335
|
if (!showLayers) return;
|
|
13242
13336
|
const handlePointerDown = (e) => {
|
|
13243
13337
|
const target = e.target;
|
|
13244
|
-
if (target.closest('[data-testid="panel-layers"]') || target.closest('[data-testid="button-toggle-layers"]') || target.closest(
|
|
13338
|
+
if (target.closest('[data-testid="panel-layers"]') || target.closest('[data-testid="button-toggle-layers"]') || target.closest(antdPopupSelector)) {
|
|
13245
13339
|
return;
|
|
13246
13340
|
}
|
|
13247
13341
|
setShowLayers(false);
|
|
13248
13342
|
};
|
|
13249
13343
|
document.addEventListener("pointerdown", handlePointerDown);
|
|
13250
13344
|
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
13251
|
-
}, [showLayers]);
|
|
13345
|
+
}, [showLayers, antdPopupSelector]);
|
|
13252
13346
|
useEffect(() => {
|
|
13253
13347
|
if (!isMapLoaded || !enableKeyboardShortcuts || !mapContainer.current) return;
|
|
13254
13348
|
const container = mapContainer.current;
|
|
@@ -18174,6 +18268,7 @@ export {
|
|
|
18174
18268
|
cn,
|
|
18175
18269
|
createClusterPieManager,
|
|
18176
18270
|
createTimelineStore,
|
|
18271
|
+
escapeHtml,
|
|
18177
18272
|
featureCollectionBlobPartsAsync,
|
|
18178
18273
|
getIconEmoji,
|
|
18179
18274
|
isFeatureInRange,
|