ublo-lib 1.10.2 → 1.10.3
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.
|
@@ -3,7 +3,7 @@ import css from "./marker-list.module.css";
|
|
|
3
3
|
import Button from "dt-design-system/es/button";
|
|
4
4
|
import * as DTIcons from "dt-design-system/es/icons";
|
|
5
5
|
import * as Icons from "./icons";
|
|
6
|
-
import useWindowSizes from "
|
|
6
|
+
import useWindowSizes from "ublo-lib/es/common/hooks/use-window-sizes";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
export default function MarkerList({
|
|
@@ -38,6 +38,15 @@ export default function MarkerList({
|
|
|
38
38
|
}) => {
|
|
39
39
|
const focusMarker = () => {
|
|
40
40
|
mapRef.current.setView(position, 23);
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
const marker = mapRef.current?.getContainer()?.querySelector(`[data-id="${id}"]`)?.parentElement;
|
|
43
|
+
if (marker) {
|
|
44
|
+
marker.click();
|
|
45
|
+
}
|
|
46
|
+
}, 400);
|
|
47
|
+
if (width <= 992) {
|
|
48
|
+
setOpened(false);
|
|
49
|
+
}
|
|
41
50
|
};
|
|
42
51
|
const Icon = Icons[iconSet][icon] || Icons[iconSet].Location;
|
|
43
52
|
return _jsxs("button", {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
top: var(--offset);
|
|
6
6
|
right: var(--offset);
|
|
7
7
|
max-width: 220px;
|
|
8
|
-
max-height: calc(100% - (var(--offset)
|
|
8
|
+
max-height: calc(100% - (var(--offset) * 2));
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
}
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
gap: 1ch;
|
|
44
44
|
padding: 8px;
|
|
45
45
|
text-align: left;
|
|
46
|
-
font-weight: 700;
|
|
47
46
|
border-radius: var(--ds-radius-100, 6px);
|
|
48
47
|
cursor: pointer;
|
|
49
48
|
}
|
|
@@ -29,6 +29,7 @@ function Marker({
|
|
|
29
29
|
iconSet,
|
|
30
30
|
isEditing
|
|
31
31
|
}) {
|
|
32
|
+
const markerRef = React.useRef();
|
|
32
33
|
const popupRef = React.useRef();
|
|
33
34
|
const {
|
|
34
35
|
id,
|
|
@@ -51,14 +52,13 @@ function Marker({
|
|
|
51
52
|
});
|
|
52
53
|
});
|
|
53
54
|
};
|
|
54
|
-
const tooltipProps =
|
|
55
|
+
const tooltipProps = {
|
|
55
56
|
direction: "right",
|
|
56
57
|
permanent: true,
|
|
57
58
|
offset: [6, -14]
|
|
58
|
-
} : {
|
|
59
|
-
sticky: true
|
|
60
59
|
};
|
|
61
60
|
return _jsxs(LeafletMarker, {
|
|
61
|
+
ref: markerRef,
|
|
62
62
|
draggable: isEditing,
|
|
63
63
|
eventHandlers: {
|
|
64
64
|
dragend(e) {
|
|
@@ -68,9 +68,11 @@ function Marker({
|
|
|
68
68
|
position: position,
|
|
69
69
|
icon: L.divIcon({
|
|
70
70
|
className: css.markerIcon,
|
|
71
|
-
html: ReactDOM.renderToString(_jsx(Icon, {
|
|
71
|
+
html: ReactDOM.renderToString(_jsx(Icon, {
|
|
72
|
+
"data-id": id
|
|
73
|
+
}))
|
|
72
74
|
}),
|
|
73
|
-
children: [!isEditing && _jsx(Tooltip, {
|
|
75
|
+
children: [!isEditing && tooltipOpened && _jsx(Tooltip, {
|
|
74
76
|
...tooltipProps,
|
|
75
77
|
children: title
|
|
76
78
|
}), _jsx(Popup, {
|