ublo-lib 1.41.0 → 1.41.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.
Files changed (53) hide show
  1. package/es/common/components/editable-map/color-picker.d.ts +6 -0
  2. package/es/common/components/editable-map/color-picker.d.ts.map +1 -0
  3. package/es/common/components/editable-map/color-picker.js +27 -0
  4. package/es/common/components/editable-map/color-picker.module.css +66 -0
  5. package/es/common/components/editable-map/edit-form.d.ts.map +1 -1
  6. package/es/common/components/editable-map/edit-form.js +16 -11
  7. package/es/common/components/editable-map/edit-form.module.css +38 -2
  8. package/es/common/components/editable-map/editable-map.d.ts.map +1 -1
  9. package/es/common/components/editable-map/editable-map.js +133 -14
  10. package/es/common/components/editable-map/editable-map.module.css +65 -20
  11. package/es/common/components/editable-map/full-screen-button.d.ts +2 -1
  12. package/es/common/components/editable-map/full-screen-button.d.ts.map +1 -1
  13. package/es/common/components/editable-map/full-screen-button.js +6 -2
  14. package/es/common/components/editable-map/full-screen-button.module.css +6 -2
  15. package/es/common/components/editable-map/geoman.d.ts +8 -0
  16. package/es/common/components/editable-map/geoman.d.ts.map +1 -0
  17. package/es/common/components/editable-map/geoman.js +181 -0
  18. package/es/common/components/editable-map/icon-picker.d.ts.map +1 -1
  19. package/es/common/components/editable-map/icon-picker.js +2 -2
  20. package/es/common/components/editable-map/icon-picker.module.css +6 -1
  21. package/es/common/components/editable-map/icons/ui.d.ts +2 -0
  22. package/es/common/components/editable-map/icons/ui.d.ts.map +1 -0
  23. package/es/common/components/editable-map/icons/ui.js +7 -0
  24. package/es/common/components/editable-map/initial-marker-form.d.ts +4 -0
  25. package/es/common/components/editable-map/initial-marker-form.d.ts.map +1 -0
  26. package/es/common/components/editable-map/initial-marker-form.js +17 -0
  27. package/es/common/components/editable-map/initial-marker-form.module.css +25 -0
  28. package/es/common/components/editable-map/map-events.d.ts +1 -14
  29. package/es/common/components/editable-map/map-events.d.ts.map +1 -1
  30. package/es/common/components/editable-map/map-events.js +1 -24
  31. package/es/common/components/editable-map/marker-list.d.ts +7 -1
  32. package/es/common/components/editable-map/marker-list.d.ts.map +1 -1
  33. package/es/common/components/editable-map/marker-list.js +33 -11
  34. package/es/common/components/editable-map/marker-list.module.css +29 -21
  35. package/es/common/components/editable-map/markers.js +2 -19
  36. package/es/common/components/editable-map/popup-data.d.ts.map +1 -1
  37. package/es/common/components/editable-map/popup-data.js +2 -2
  38. package/es/common/components/editable-map/popup-data.module.css +15 -0
  39. package/es/common/components/editable-map/slopes-toggle.module.css +1 -0
  40. package/es/common/components/editable-map/utils/file-manager.d.ts +2 -0
  41. package/es/common/components/editable-map/utils/file-manager.d.ts.map +1 -0
  42. package/es/common/components/editable-map/utils/file-manager.js +29 -0
  43. package/es/common/utils/file-manager.d.ts +1 -0
  44. package/es/common/utils/file-manager.d.ts.map +1 -1
  45. package/package.json +1 -1
  46. package/es/common/components/editable-map/helper.d.ts +0 -2
  47. package/es/common/components/editable-map/helper.d.ts.map +0 -1
  48. package/es/common/components/editable-map/helper.js +0 -7
  49. package/es/common/components/editable-map/helper.module.css +0 -62
  50. package/es/common/components/editable-map/input-marker.d.ts +0 -4
  51. package/es/common/components/editable-map/input-marker.d.ts.map +0 -1
  52. package/es/common/components/editable-map/input-marker.js +0 -16
  53. package/es/common/components/editable-map/input-marker.module.css +0 -17
@@ -0,0 +1,181 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import * as ReactDOM from "react-dom/server";
4
+ import * as L from "leaflet";
5
+ import { useLeafletContext } from "@react-leaflet/core";
6
+ import * as Icons from "./icons";
7
+ import css from "./markers.module.css";
8
+ import "@geoman-io/leaflet-geoman-free";
9
+ import "@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css";
10
+ const createCustomDivIcon = (iconSet, icon, id) => {
11
+ const Icon = Icons[iconSet][icon] || Icons[iconSet].Location;
12
+ return L.divIcon({
13
+ className: css.markerIcon,
14
+ html: ReactDOM.renderToString(_jsx(Icon, { "data-id": id })),
15
+ });
16
+ };
17
+ const Geoman = ({ setMarkers, iconSet, setShapes, color }) => {
18
+ const context = useLeafletContext();
19
+ const leafletContainer = context.layerContainer || context.map;
20
+ const colorRef = React.useRef(color);
21
+ const dragShape = React.useCallback((e) => {
22
+ const customId = e.layer.options?.id || e.layer._customId;
23
+ const position = e.layer.getLatLngs
24
+ ? e.layer.getLatLngs()
25
+ : e.layer.getLatLng();
26
+ if (e.shape === "Marker" || e.shape === "customMarker") {
27
+ setMarkers((prevMarkers) => prevMarkers.map((marker) => marker.id === customId ? { ...marker, position } : marker));
28
+ }
29
+ else {
30
+ setShapes((prevShapes) => prevShapes.map((shape) => shape.id === customId ? { ...shape, latlngs: position } : shape));
31
+ }
32
+ }, [setMarkers, setShapes]);
33
+ const editShape = React.useCallback((e) => {
34
+ if (e.layer.options?.id || e.shape === "Text")
35
+ return;
36
+ const customId = e.layer._customId;
37
+ const shapeType = e.shape;
38
+ const position = e.layer.getLatLngs
39
+ ? e.layer.getLatLngs()
40
+ : e.layer.getLatLng();
41
+ let updatedShape = {
42
+ latlngs: position,
43
+ };
44
+ if (shapeType === "Circle") {
45
+ updatedShape = {
46
+ ...updatedShape,
47
+ radius: e.layer.getRadius(),
48
+ };
49
+ }
50
+ setShapes((prevShapes) => prevShapes.map((shape) => shape.id === customId ? { ...shape, ...updatedShape } : shape));
51
+ }, [setShapes]);
52
+ const removeShape = React.useCallback((e) => {
53
+ const isText = e.layer.options?.shape === "Text" || e.shape === "Text";
54
+ if (e.layer instanceof L.Marker && !isText) {
55
+ setMarkers((prevMarkers) => {
56
+ return prevMarkers.filter((marker) => marker.id !== e.layer.options.id);
57
+ });
58
+ }
59
+ else {
60
+ setShapes((prevShapes) => prevShapes.filter((shape) => shape.id !== e.layer._customId));
61
+ }
62
+ }, [setMarkers, setShapes]);
63
+ React.useEffect(() => {
64
+ colorRef.current = color;
65
+ leafletContainer.pm.setGlobalOptions({
66
+ templineStyle: { color },
67
+ hintlineStyle: { color },
68
+ pathOptions: {
69
+ color,
70
+ fillOpacity: 0.1,
71
+ },
72
+ });
73
+ }, [color, leafletContainer.pm]);
74
+ React.useEffect(() => {
75
+ leafletContainer.pm.setLang("fr");
76
+ leafletContainer.pm.addControls({
77
+ drawMarker: false,
78
+ drawPolyline: true,
79
+ drawRectangle: true,
80
+ drawCircle: true,
81
+ drawCircleMarker: false,
82
+ drawPolygon: true,
83
+ cutPolygon: false,
84
+ rotateMode: false,
85
+ });
86
+ leafletContainer.on("layeradd", (e) => {
87
+ const layer = e.layer;
88
+ layer.on("pm:dragend", dragShape);
89
+ });
90
+ if (!leafletContainer.pm.Toolbar.getButtons().customMarker) {
91
+ const previewMarkerIcon = createCustomDivIcon(iconSet, "Location", Date.now());
92
+ const customMarkerControl = leafletContainer.pm.Toolbar.copyDrawControl("drawMarker", {
93
+ name: "customMarker",
94
+ block: "custom",
95
+ });
96
+ customMarkerControl.drawInstance.setOptions({
97
+ markerStyle: {
98
+ icon: previewMarkerIcon,
99
+ },
100
+ });
101
+ }
102
+ leafletContainer.pm.Toolbar.changeControlOrder([
103
+ "customMarker",
104
+ "drawPolyline",
105
+ "drawRectangle",
106
+ "drawCircle",
107
+ "drawCircleMarker",
108
+ "drawPolygon",
109
+ "drawText",
110
+ ]);
111
+ const createShape = (e) => {
112
+ const currentColor = colorRef.current;
113
+ const id = e.layer._leaflet_id;
114
+ e.layer._customId = id;
115
+ if (e.shape === "customMarker") {
116
+ const newMarker = {
117
+ id,
118
+ position: e.layer.getLatLng(),
119
+ icon: "Location",
120
+ title: "Nouveau point d'intérêt",
121
+ description: "",
122
+ url: "",
123
+ label: "",
124
+ tooltipOpened: false,
125
+ };
126
+ setMarkers((prevMarkers) => [...prevMarkers, newMarker]);
127
+ e.layer.remove();
128
+ }
129
+ else if (e.shape === "Text") {
130
+ const textLayer = e.layer;
131
+ textLayer.on("pm:dragend", dragShape);
132
+ textLayer.on("pm:textchange", (event) => {
133
+ const updatedText = event.text;
134
+ setShapes((prevShapes) => prevShapes.map((shape) => shape.id === textLayer._leaflet_id
135
+ ? { ...shape, content: updatedText }
136
+ : shape));
137
+ });
138
+ const newShape = {
139
+ id,
140
+ shape: e.shape,
141
+ latlngs: textLayer.getLatLng(),
142
+ content: e.layer.options.text || "",
143
+ };
144
+ setShapes((prevShapes) => [...prevShapes, newShape]);
145
+ }
146
+ else {
147
+ e.layer.on("pm:dragend", dragShape);
148
+ e.layer.on("pm:edit", editShape);
149
+ const newShape = {
150
+ id,
151
+ shape: e.shape,
152
+ latlngs: e.layer.getLatLngs
153
+ ? e.layer.getLatLngs()
154
+ : e.layer.getLatLng(),
155
+ radius: e.shape === "Circle" ? e.layer.getRadius() : null,
156
+ content: e.layer._text ? e.layer._text : null,
157
+ color: currentColor,
158
+ };
159
+ setShapes((prevShapes) => [...prevShapes, newShape]);
160
+ }
161
+ };
162
+ leafletContainer.on("pm:create", createShape);
163
+ leafletContainer.on("pm:remove", removeShape);
164
+ return () => {
165
+ leafletContainer.pm.removeControls();
166
+ leafletContainer.pm.setGlobalOptions({ pmIgnore: true });
167
+ leafletContainer.off("pm:create", createShape);
168
+ leafletContainer.off("pm:remove", removeShape);
169
+ };
170
+ }, [
171
+ dragShape,
172
+ editShape,
173
+ iconSet,
174
+ leafletContainer,
175
+ removeShape,
176
+ setMarkers,
177
+ setShapes,
178
+ ]);
179
+ return null;
180
+ };
181
+ export default Geoman;
@@ -1 +1 @@
1
- {"version":3,"file":"icon-picker.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-map/icon-picker.js"],"names":[],"mappings":"AAMA;;;;4CA2DC"}
1
+ {"version":3,"file":"icon-picker.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-map/icon-picker.js"],"names":[],"mappings":"AAMA;;;;4CA6DC"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import Button from "dt-design-system/es/button";
4
4
  import * as DSIcons from "dt-design-system/es/icons";
@@ -19,7 +19,7 @@ export default function IconPicker({ selectedIcon, callback, iconSet }) {
19
19
  e.stopPropagation();
20
20
  setOpened(false);
21
21
  };
22
- return (_jsxs("div", { className: css.picker, children: [_jsx(Button, { variant: "secondary", onClick: togglePicker, children: _jsx(Icon, { className: css.selectedIcon }) }), opened && (_jsxs("div", { className: css.list, children: [_jsxs(Button, { variant: "link", className: css.back, onClick: closePicker, compact: true, children: [_jsx(DSIcons.ArrowLeft, {}), "Retour"] }), keys.map((key) => {
22
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: css.picker, children: _jsx(Button, { variant: "secondary", onClick: togglePicker, children: _jsx(Icon, { className: css.selectedIcon }) }) }), opened && (_jsxs("div", { className: css.list, children: [_jsxs(Button, { variant: "link", className: css.back, onClick: closePicker, compact: true, children: [_jsx(DSIcons.ArrowLeft, {}), "Retour"] }), keys.map((key) => {
23
23
  const updateSelected = (e) => {
24
24
  e.stopPropagation();
25
25
  callback(key);
@@ -1,3 +1,7 @@
1
+ .picker {
2
+ flex: 0 0 auto;
3
+ }
4
+
1
5
  svg.selectedIcon {
2
6
  flex: 0 0 44px;
3
7
  width: 44px;
@@ -21,7 +25,8 @@ svg.selectedIcon {
21
25
  border-radius: var(--ds-radius-100, 6px);
22
26
  overflow: auto;
23
27
  overscroll-behavior: contain;
24
- z-index: 1;
28
+ scrollbar-width: thin;
29
+ z-index: 2;
25
30
  }
26
31
 
27
32
  .back {
@@ -0,0 +1,2 @@
1
+ export function ColorPalette(props: any): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/editable-map/icons/ui.js"],"names":[],"mappings":"AAAA,kFAMC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function ColorPalette(props) {
3
+ return (_jsx(Icon, { ...props, children: _jsx("path", { d: "M12 24A12.2 12.2 0 0 1 0 12 12.2 12.2 0 0 1 12.2 0a12.4 12.4 0 0 1 8.3 3.1c1 1 2 2.1 2.6 3.5a10 10 0 0 1 .9 4.3c0 2.3-.7 4-2.1 5.3a7.5 7.5 0 0 1-5.1 1.8h-2.2l-.4.1-.1.4.5 1c.3.5.4 1 .4 1.6 0 1-.3 1.7-.8 2.2-.6.5-1.3.7-2.2.7ZM5.4 13.2a1.7 1.7 0 0 0 1.8-1.8 1.7 1.7 0 0 0-1.8-1.8 1.7 1.7 0 0 0-1.8 1.8 1.7 1.7 0 0 0 1.8 1.8ZM9 8.4a1.7 1.7 0 0 0 1.8-1.8A1.7 1.7 0 0 0 9 4.8a1.7 1.7 0 0 0-1.8 1.8A1.7 1.7 0 0 0 9 8.4Zm6 0a1.7 1.7 0 0 0 1.8-1.8A1.7 1.7 0 0 0 15 4.8a1.7 1.7 0 0 0-1.8 1.8A1.7 1.7 0 0 0 15 8.4Zm3.6 4.8a1.7 1.7 0 0 0 1.8-1.8 1.7 1.7 0 0 0-1.8-1.8 1.7 1.7 0 0 0-1.8 1.8 1.7 1.7 0 0 0 1.8 1.8ZM12 21.6c.2 0 .3 0 .4-.2l.2-.3c0-.3-.2-.7-.4-1-.3-.4-.5-1-.5-1.7 0-.9.3-1.5.9-2 .6-.5 1.3-.8 2.1-.8h2.1c1.3 0 2.4-.4 3.4-1.2 1-.7 1.4-2 1.4-3.5 0-2.5-1-4.5-2.8-6a9.7 9.7 0 0 0-6.6-2.5c-2.7 0-5 1-7 2.8A9.1 9.1 0 0 0 2.5 12c0 2.7 1 5 2.8 6.8a9.3 9.3 0 0 0 6.8 2.8Z" }) }, "39"));
4
+ }
5
+ function Icon({ width = 24, height = 24, ...props }) {
6
+ return (_jsx("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, ...props, children: props.children }));
7
+ }
@@ -0,0 +1,4 @@
1
+ export default function InitialMarkerForm({ callback }: {
2
+ callback: any;
3
+ }): import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=initial-marker-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initial-marker-form.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-map/initial-marker-form.js"],"names":[],"mappings":"AAIA;;4CAuCC"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Input from "dt-design-system/es/input";
3
+ import Button from "dt-design-system/es/button";
4
+ import styles from "./initial-marker-form.module.css";
5
+ export default function InitialMarkerForm({ callback }) {
6
+ const addMarker = (event) => {
7
+ event.preventDefault();
8
+ const form = event.target;
9
+ const formData = new FormData(form);
10
+ const lat = formData.get("latitude");
11
+ const lng = formData.get("longitude");
12
+ if (lat && lng) {
13
+ callback({ lat, lng });
14
+ }
15
+ };
16
+ return (_jsxs("form", { className: styles.form, onSubmit: addMarker, children: [_jsx("div", { className: styles.title, children: "Ajouter un point d'int\u00E9r\u00EAt" }), _jsx(Input, { label: "Latitude", name: "latitude", placeholder: "48.132", type: "number", step: "any", compact: true, required: true }), _jsx(Input, { label: "Longitude", name: "longitude", placeholder: "3.524", type: "number", step: "any", compact: true, required: true }), _jsx(Button, { variant: "success", className: styles.button, type: "submit", children: "Confirmer" })] }));
17
+ }
@@ -0,0 +1,25 @@
1
+ .form {
2
+ position: absolute;
3
+ top: 10px;
4
+ left: 54px;
5
+ width: 220px;
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: 5px;
9
+ padding: 10px;
10
+ background-color: var(--ds-grey-000, #fff);
11
+ border: 1px solid var(--ds-grey-200, #ededed);
12
+ border-radius: var(--ds-radius-200, 8px);
13
+ box-shadow: var(--ds-shadow-100, 0px 3px 6px rgba(0, 0, 0, 0.12));
14
+ }
15
+
16
+ .title {
17
+ margin-left: 3px;
18
+ font-weight: 700;
19
+ font-size: 15px;
20
+ }
21
+
22
+ .button {
23
+ margin-top: 5px;
24
+ margin-left: auto;
25
+ }
@@ -1,18 +1,5 @@
1
- export default function MapEvents({ mapRef, markers, setMarkers, setCenter, setZoom, isEditing, element, }: {
2
- mapRef: any;
3
- markers: any;
4
- setMarkers: any;
1
+ export default function MapEvents({ setCenter, setZoom }: {
5
2
  setCenter: any;
6
3
  setZoom: any;
7
- isEditing: any;
8
- element: any;
9
4
  }): any;
10
- export namespace DEFAULT_MARKER_DATA {
11
- let icon: string;
12
- let title: string;
13
- let description: string;
14
- let url: string;
15
- let label: string;
16
- let tooltipOpened: boolean;
17
- }
18
5
  //# sourceMappingURL=map-events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"map-events.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-map/map-events.js"],"names":[],"mappings":"AAWA;;;;;;;;QAqCC"}
1
+ {"version":3,"file":"map-events.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-map/map-events.js"],"names":[],"mappings":"AAEA;;;QAWC"}
@@ -1,25 +1,5 @@
1
1
  import { useMapEvents } from "react-leaflet";
2
- export const DEFAULT_MARKER_DATA = {
3
- icon: "Location",
4
- title: "Nouveau point d'intérêt",
5
- description: "",
6
- url: "",
7
- label: "",
8
- tooltipOpened: false,
9
- };
10
- export default function MapEvents({ mapRef, markers, setMarkers, setCenter, setZoom, isEditing, element, }) {
11
- const ids = markers.map((m) => m.id);
12
- const newId = ids.length ? Math.max(...ids) + 1 : 1;
13
- const addMarker = (e) => {
14
- const hasAnOpenedPopup = Boolean(mapRef.current?.getContainer().querySelector(".leaflet-popup"));
15
- const isFocused = Boolean(element.querySelector("cms-section-ui"));
16
- if (!isEditing || !isFocused || hasAnOpenedPopup)
17
- return;
18
- setMarkers([
19
- ...markers,
20
- { id: newId, ...DEFAULT_MARKER_DATA, position: e.latlng },
21
- ]);
22
- };
2
+ export default function MapEvents({ setCenter, setZoom }) {
23
3
  useMapEvents({
24
4
  dragend(e) {
25
5
  setCenter(e.target.getCenter());
@@ -27,9 +7,6 @@ export default function MapEvents({ mapRef, markers, setMarkers, setCenter, setZ
27
7
  zoomend(e) {
28
8
  setZoom(e.target.getZoom());
29
9
  },
30
- click(e) {
31
- addMarker(e);
32
- },
33
10
  });
34
11
  return null;
35
12
  }
@@ -1,6 +1,12 @@
1
- export default function MarkerList({ isInDialog, markers, mapRef, iconSet }: {
1
+ export default function MarkerList({ cmsMode, opened, setOpened, isInDialog, markers, setMarkers, isSorted, setIsSorted, mapRef, iconSet, }: {
2
+ cmsMode: any;
3
+ opened: any;
4
+ setOpened: any;
2
5
  isInDialog: any;
3
6
  markers: any;
7
+ setMarkers: any;
8
+ isSorted: any;
9
+ setIsSorted: any;
4
10
  mapRef: any;
5
11
  iconSet: any;
6
12
  }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"marker-list.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-map/marker-list.js"],"names":[],"mappings":"AAUA;;;;;4CAoFC"}
1
+ {"version":3,"file":"marker-list.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-map/marker-list.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;4CAwIC"}
@@ -7,13 +7,35 @@ import * as DTIcons from "dt-design-system/es/icons";
7
7
  import useWindowSizes from "../../hooks/use-window-sizes";
8
8
  import * as Icons from "./icons";
9
9
  import css from "./marker-list.module.css";
10
- export default function MarkerList({ isInDialog, markers, mapRef, iconSet }) {
11
- const [opened, setOpened] = React.useState(true);
12
- const importantMarkers = markers.filter((marker) => marker.important);
13
- const otherMarkers = markers.filter((marker) => !marker.important);
14
- const sortedImportantMarkers = importantMarkers.sort(alphaNumSortByTitle);
15
- const sortedOtherMarkers = otherMarkers.sort(alphaNumSortByTitle);
16
- const allMarkers = [...sortedImportantMarkers, ...sortedOtherMarkers];
10
+ export default function MarkerList({ cmsMode, opened, setOpened, isInDialog, markers, setMarkers, isSorted, setIsSorted, mapRef, iconSet, }) {
11
+ const sortedMarkers = isSorted ? markers : markers.sort(alphaNumSortByTitle);
12
+ const moveMarker = (e, id, direction) => {
13
+ e.stopPropagation();
14
+ e.preventDefault();
15
+ if (!isSorted)
16
+ setIsSorted(true);
17
+ setMarkers((prevMarkers) => {
18
+ const index = prevMarkers.findIndex((marker) => marker.id === id);
19
+ const newMarkers = [...prevMarkers];
20
+ const condition = direction === "up" ? index > 0 : index !== markers.length - 1;
21
+ if (condition) {
22
+ if (direction === "up") {
23
+ [newMarkers[index - 1], newMarkers[index]] = [
24
+ newMarkers[index],
25
+ newMarkers[index - 1],
26
+ ];
27
+ }
28
+ else {
29
+ [newMarkers[index + 1], newMarkers[index]] = [
30
+ newMarkers[index],
31
+ newMarkers[index + 1],
32
+ ];
33
+ }
34
+ return newMarkers;
35
+ }
36
+ return prevMarkers;
37
+ });
38
+ };
17
39
  const toggleList = (e) => {
18
40
  e.preventDefault();
19
41
  e.stopPropagation();
@@ -23,12 +45,12 @@ export default function MarkerList({ isInDialog, markers, mapRef, iconSet }) {
23
45
  const ToggleIcon = opened ? DTIcons.ChevronRight : DTIcons.Menu;
24
46
  React.useEffect(() => {
25
47
  setOpened(width > 992);
26
- }, [width]);
48
+ }, [setOpened, width]);
27
49
  const classes = classNames(css.list, {
28
50
  [css.listOpened]: opened,
29
51
  [css.listIsInDialog]: isInDialog,
30
52
  });
31
- return (_jsxs("div", { className: classes, children: [opened && (_jsx("div", { className: css.inner, children: allMarkers.map(({ id, icon, title, position, important }) => {
53
+ return (_jsxs("div", { className: classes, children: [opened && (_jsx("div", { className: css.inner, children: sortedMarkers.map(({ id, icon, title, position, important }) => {
32
54
  const focusMarker = (e) => {
33
55
  e.stopPropagation();
34
56
  e.preventDefault();
@@ -53,8 +75,8 @@ export default function MarkerList({ isInDialog, markers, mapRef, iconSet }) {
53
75
  const classes = classNames(css.button, {
54
76
  [css.buttonImportant]: important,
55
77
  });
56
- return (_jsxs("a", { href: "", className: classes, onClick: focusMarker, children: [_jsx(Icon, { className: css.icon }), _jsx("span", { children: title })] }, id));
57
- }) })), _jsx(Button, { type: "button", variant: "secondary", className: css.toggle, onClick: toggleList, children: _jsx(ToggleIcon, {}) })] }));
78
+ return (_jsxs("a", { href: "", className: classes, onClick: focusMarker, children: [_jsx(Icon, { className: css.icon }), _jsx("span", { children: title }), _jsxs("div", { className: css.movements, children: [_jsx(Button, { variant: "transparent", className: css.move, onClick: (e) => moveMarker(e, id, "up"), children: _jsx(DTIcons.ChevronUp, { className: css.moveIcon }) }), _jsx(Button, { variant: "transparent", className: css.move, onClick: (e) => moveMarker(e, id, "down"), children: _jsx(DTIcons.ChevronDown, { className: css.moveIcon }) })] })] }, id));
79
+ }) })), !cmsMode && (_jsx(Button, { type: "button", variant: "secondary", className: css.toggle, onClick: toggleList, children: _jsx(ToggleIcon, {}) }))] }));
58
80
  }
59
81
  function alphaNumSortByTitle(a, b) {
60
82
  return a.title.localeCompare(b.title, undefined, {
@@ -7,26 +7,14 @@
7
7
  display: flex;
8
8
  flex-direction: column;
9
9
  gap: 4px;
10
+ background-color: var(--ds-grey-000, #fff);
10
11
  border-left: 1px solid var(--ds-grey-200, #ededed);
12
+ border: 1px solid var(--ds-grey-200, #ededed);
11
13
  border-radius: 0 var(--ds-radius-100, 6px) var(--ds-radius-100, 6px) 0;
12
- backdrop-filter: brightness(110%) contrast(90%)
13
- blur(calc(var(--ds-blur, 5px) * 3));
14
14
  transition: background-color 160ms
15
15
  var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
16
16
  }
17
17
 
18
- .list::before {
19
- content: "";
20
- position: absolute;
21
- top: 0;
22
- left: 0;
23
- width: 100%;
24
- height: 100%;
25
- background-color: var(--ds-grey-100, #f8f8f8);
26
- border-radius: inherit;
27
- opacity: 0.75;
28
- }
29
-
30
18
  button.toggle {
31
19
  position: absolute;
32
20
  bottom: 8px;
@@ -45,18 +33,16 @@ button.toggle:hover {
45
33
  flex: 1 1 100%;
46
34
  display: flex;
47
35
  flex-direction: column;
48
- gap: 4px;
49
- padding: 0 8px;
50
- padding-top: 8px;
36
+ gap: 2px;
37
+ padding: 8px;
51
38
  overflow: auto;
52
39
  animation: marker-list-inner-appearance 160ms
53
40
  var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
54
41
  background: linear-gradient(
55
- var(--ds-grey-100, #f8f8f8) 30%,
42
+ var(--ds-grey-000, #fff) 30%,
56
43
  hsla(0, 0%, 100%, 0)
57
44
  ),
58
- linear-gradient(hsla(0, 0%, 100%, 0), var(--ds-grey-100, #f8f8f8) 70%) 0
59
- 100%,
45
+ linear-gradient(hsla(0, 0%, 100%, 0), var(--ds-grey-000, #fff) 70%) 0 100%,
60
46
  radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.25), transparent),
61
47
  radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.25), transparent)
62
48
  0 100%;
@@ -76,7 +62,7 @@ button.toggle:hover {
76
62
  display: flex;
77
63
  align-items: center;
78
64
  gap: 1ch;
79
- padding: 6px;
65
+ padding: 4px 6px;
80
66
  color: inherit;
81
67
  font-size: 14px;
82
68
  text-align: left;
@@ -109,6 +95,28 @@ button.toggle:hover {
109
95
  var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
110
96
  }
111
97
 
98
+ .movements {
99
+ display: flex;
100
+ flex-direction: column;
101
+ opacity: 0;
102
+ touch-action: none;
103
+ margin-left: auto;
104
+ }
105
+
106
+ .move {
107
+ --ds-button-hover-background: var(--ds-grey-000, #fff);
108
+ }
109
+
110
+ svg.moveIcon {
111
+ --size: 12px;
112
+ fill: var(--ds-grey-800, #000);
113
+ }
114
+
112
115
  .button:is(:hover, :focus) .icon {
113
116
  transform: scale(1.08);
114
117
  }
118
+
119
+ :global(.cms--editing) .button:is(:hover, :focus) .movements {
120
+ opacity: 1;
121
+ touch-action: auto;
122
+ }
@@ -4,9 +4,9 @@ import * as ReactDOM from "react-dom/server";
4
4
  import * as L from "leaflet";
5
5
  import { Marker as LeafletMarker, Popup, Tooltip } from "react-leaflet";
6
6
  import EditForm from "./edit-form";
7
+ import PopupData from "./popup-data";
7
8
  import * as Icons from "./icons";
8
9
  import css from "./markers.module.css";
9
- import PopupData from "./popup-data";
10
10
  export default function Markers({ markers, setMarkers, iconSet, isEditing }) {
11
11
  return markers.map((marker, i) => {
12
12
  return (_jsx(Marker, { marker: marker, setMarkers: setMarkers, iconSet: iconSet, isEditing: isEditing }, i));
@@ -17,27 +17,10 @@ function Marker({ marker, setMarkers, iconSet, isEditing }) {
17
17
  const popupRef = React.useRef();
18
18
  const { id, icon, title, position, tooltipOpened } = marker;
19
19
  const Icon = Icons[iconSet][icon] || Icons[iconSet].Location;
20
- const updatePosition = (e) => {
21
- setMarkers((currents) => {
22
- return currents.map((marker) => {
23
- if (marker.id === id) {
24
- return { ...marker, position: e.target.getLatLng() };
25
- }
26
- return marker;
27
- });
28
- });
29
- };
30
20
  const tooltipProps = tooltipOpened
31
21
  ? { direction: "right", permanent: true, offset: [6, -12] }
32
22
  : { direction: "right", offset: [6, -12] };
33
- return (_jsxs(LeafletMarker, { ref: markerRef, draggable: isEditing, eventHandlers: {
34
- dragend(e) {
35
- updatePosition(e);
36
- },
37
- click(e) {
38
- e.originalEvent.stopPropagation();
39
- },
40
- }, position: position, icon: L.divIcon({
23
+ return (_jsxs(LeafletMarker, { id: id, ref: markerRef, draggable: false, position: position, icon: L.divIcon({
41
24
  className: css.markerIcon,
42
25
  html: ReactDOM.renderToString(_jsx(Icon, { "data-id": id })),
43
26
  }), children: [!isEditing && _jsx(Tooltip, { ...tooltipProps, children: title }), _jsx(Popup, { ref: popupRef, offset: [0, -24], children: isEditing ? (_jsx(EditForm, { popupRef: popupRef, marker: marker, setMarkers: setMarkers, iconSet: iconSet })) : (_jsx(PopupData, { marker: marker })) })] }, id));
@@ -1 +1 @@
1
- {"version":3,"file":"popup-data.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-map/popup-data.js"],"names":[],"mappings":"AAIA;;4CA8BC"}
1
+ {"version":3,"file":"popup-data.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-map/popup-data.js"],"names":[],"mappings":"AAIA;;4CAiCC"}
@@ -3,10 +3,10 @@ import * as React from "react";
3
3
  import Button from "dt-design-system/es/button";
4
4
  import css from "./popup-data.module.css";
5
5
  export default function PopupData({ marker }) {
6
- const { title, description, url, label } = marker;
6
+ const { title, image, description, url, label } = marker;
7
7
  const isExternalUrl = /^((http|https):\/\/)/.test(url);
8
8
  const target = isExternalUrl ? "_blank" : undefined;
9
9
  const rel = isExternalUrl ? "noopener" : undefined;
10
10
  const formattedDescription = description.replace(/\n/g, "<br />");
11
- return (_jsxs("div", { className: css.data, children: [_jsx("div", { className: css.title, children: title }), formattedDescription && (_jsx("div", { className: css.description, dangerouslySetInnerHTML: { __html: formattedDescription } })), url?.trim() && (_jsx(Button, { tag: "a", href: url.trim(), className: css.link, target: target, rel: rel, children: label || "En savoir plus" }))] }));
11
+ return (_jsxs("div", { className: css.data, children: [image && _jsx("img", { className: css.image, src: image, alt: "" }), _jsxs("div", { className: css.inner, children: [_jsx("div", { className: css.title, children: title }), formattedDescription && (_jsx("div", { className: css.description, dangerouslySetInnerHTML: { __html: formattedDescription } })), url?.trim() && (_jsx(Button, { tag: "a", href: url.trim(), className: css.link, target: target, rel: rel, children: label || "En savoir plus" }))] })] }));
12
12
  }
@@ -6,6 +6,21 @@
6
6
  flex-direction: column;
7
7
  gap: 6px;
8
8
  overflow: auto;
9
+ border-radius: 12px;
10
+ }
11
+
12
+ .image {
13
+ /* position: absolute;
14
+ top: 0;
15
+ left: 0; */
16
+ height: 150px;
17
+ width: 100%;
18
+ }
19
+
20
+ .inner {
21
+ display: flex;
22
+ flex-direction: column;
23
+ padding: 13px 24px 13px 20px;
9
24
  }
10
25
 
11
26
  .title {
@@ -5,6 +5,7 @@
5
5
  width: fit-content;
6
6
  padding: 10px;
7
7
  background-color: var(--ds-grey-000, #fff);
8
+ border: 1px solid var(--ds-grey-200, #ededed);
8
9
  border-radius: var(--ds-radius-200, 10px);
9
10
  box-shadow: var(--ds-shadow-100, 0px 3px 6px rgba(0, 0, 0, 0.12));
10
11
  }
@@ -0,0 +1,2 @@
1
+ export declare function load(changed: (path: string) => void, width: number, height: number): Promise<void>;
2
+ //# sourceMappingURL=file-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-manager.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/editable-map/utils/file-manager.ts"],"names":[],"mappings":"AAGA,wBAAsB,IAAI,CACxB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAC/B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,iBAaf"}