@symfony/ux-leaflet-map 2.34.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/map_controller.d.ts +0 -10
- package/dist/map_controller.js +12 -44
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ npm add @symfony/ux-leaflet-map@2.23.0
|
|
|
19
19
|
|
|
20
20
|
## Resources
|
|
21
21
|
|
|
22
|
-
- [Documentation](https://github.com/symfony/ux/tree/
|
|
22
|
+
- [Documentation](https://github.com/symfony/ux/tree/3.x/src/Map/src/Bridge/Google)
|
|
23
23
|
- [Report issues](https://github.com/symfony/ux/issues) and
|
|
24
24
|
[send Pull Requests](https://github.com/symfony/ux/pulls)
|
|
25
25
|
in the [main Symfony UX repository](https://github.com/symfony/ux)
|
package/dist/map_controller.d.ts
CHANGED
|
@@ -43,23 +43,18 @@ type MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions> = WithIdenti
|
|
|
43
43
|
title: string | null;
|
|
44
44
|
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
|
|
45
45
|
icon?: Icon;
|
|
46
|
-
rawOptions?: BridgeMarkerOptions;
|
|
47
46
|
bridgeOptions?: BridgeMarkerOptions;
|
|
48
47
|
extra: ExtraData;
|
|
49
48
|
}>;
|
|
50
49
|
type PolygonDefinition<BridgePolygonOptions, BridgeInfoWindowOptions> = WithIdentifier<{
|
|
51
50
|
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
|
|
52
51
|
points: Array<Point> | Array<Array<Point>>;
|
|
53
|
-
title: string | null;
|
|
54
|
-
rawOptions?: BridgePolygonOptions;
|
|
55
52
|
bridgeOptions?: BridgePolygonOptions;
|
|
56
53
|
extra: ExtraData;
|
|
57
54
|
}>;
|
|
58
55
|
type PolylineDefinition<BridgePolylineOptions, BridgeInfoWindowOptions> = WithIdentifier<{
|
|
59
56
|
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
|
|
60
57
|
points: Array<Point>;
|
|
61
|
-
title: string | null;
|
|
62
|
-
rawOptions?: BridgePolylineOptions;
|
|
63
58
|
bridgeOptions?: BridgePolylineOptions;
|
|
64
59
|
extra: ExtraData;
|
|
65
60
|
}>;
|
|
@@ -67,8 +62,6 @@ type CircleDefinition<BridgeCircleOptions, BridgeInfoWindowOptions> = WithIdenti
|
|
|
67
62
|
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
|
|
68
63
|
center: Point;
|
|
69
64
|
radius: number;
|
|
70
|
-
title: string | null;
|
|
71
|
-
rawOptions?: BridgeCircleOptions;
|
|
72
65
|
bridgeOptions?: BridgeCircleOptions;
|
|
73
66
|
extra: ExtraData;
|
|
74
67
|
}>;
|
|
@@ -76,8 +69,6 @@ type RectangleDefinition<BridgeRectangleOptions, BridgeInfoWindowOptions> = With
|
|
|
76
69
|
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
|
|
77
70
|
southWest: Point;
|
|
78
71
|
northEast: Point;
|
|
79
|
-
title: string | null;
|
|
80
|
-
rawOptions?: BridgeRectangleOptions;
|
|
81
72
|
bridgeOptions?: BridgeRectangleOptions;
|
|
82
73
|
extra: ExtraData;
|
|
83
74
|
}>;
|
|
@@ -87,7 +78,6 @@ type InfoWindowDefinition<BridgeInfoWindowOptions> = {
|
|
|
87
78
|
position: Point;
|
|
88
79
|
opened: boolean;
|
|
89
80
|
autoClose: boolean;
|
|
90
|
-
rawOptions?: BridgeInfoWindowOptions;
|
|
91
81
|
bridgeOptions?: BridgeInfoWindowOptions;
|
|
92
82
|
extra: ExtraData;
|
|
93
83
|
};
|
package/dist/map_controller.js
CHANGED
|
@@ -105,7 +105,6 @@ var _Class = class extends Controller {
|
|
|
105
105
|
const eventAfter = `${type}:after-create`;
|
|
106
106
|
return ({ definition }) => {
|
|
107
107
|
this.dispatchEvent(eventBefore, { definition });
|
|
108
|
-
if (typeof definition.rawOptions !== "undefined") console.warn(`[Symfony UX Map] The event "${eventBefore}" added a deprecated "rawOptions" property to the definition, it will be removed in a next major version, replace it with "bridgeOptions" instead.`, definition);
|
|
109
108
|
const drawing = factory({ definition });
|
|
110
109
|
this.dispatchEvent(eventAfter, {
|
|
111
110
|
[type]: drawing,
|
|
@@ -195,12 +194,11 @@ var map_controller_default = class extends _Class {
|
|
|
195
194
|
return map;
|
|
196
195
|
}
|
|
197
196
|
doCreateMarker({ definition }) {
|
|
198
|
-
const { "@id": _id, position, title, infoWindow, icon,
|
|
197
|
+
const { "@id": _id, position, title, infoWindow, icon, bridgeOptions = {} } = definition;
|
|
199
198
|
const marker = L.marker(position, {
|
|
200
199
|
title: title || void 0,
|
|
201
|
-
|
|
202
|
-
...bridgeOptions
|
|
203
|
-
riseOnHover: true
|
|
200
|
+
riseOnHover: true,
|
|
201
|
+
...bridgeOptions
|
|
204
202
|
}).addTo(this.map);
|
|
205
203
|
if (infoWindow) this.createInfoWindow({
|
|
206
204
|
definition: infoWindow,
|
|
@@ -208,7 +206,6 @@ var map_controller_default = class extends _Class {
|
|
|
208
206
|
});
|
|
209
207
|
if (icon) {
|
|
210
208
|
if (Object.prototype.hasOwnProperty.call(bridgeOptions, "icon")) console.warn("[Symfony UX Map] Defining \"bridgeOptions.icon\" for a marker with a custom icon is not supported and will be ignored.");
|
|
211
|
-
else if (Object.prototype.hasOwnProperty.call(rawOptions, "icon")) console.warn("[Symfony UX Map] Defining \"rawOptions.icon\" for a marker with a custom icon is not supported and will be ignored.");
|
|
212
209
|
this.doCreateIcon({
|
|
213
210
|
definition: icon,
|
|
214
211
|
element: marker
|
|
@@ -220,15 +217,8 @@ var map_controller_default = class extends _Class {
|
|
|
220
217
|
marker.remove();
|
|
221
218
|
}
|
|
222
219
|
doCreatePolygon({ definition }) {
|
|
223
|
-
const { "@id": _id, points,
|
|
224
|
-
const polygon = L.polygon(points, {
|
|
225
|
-
...rawOptions,
|
|
226
|
-
...bridgeOptions
|
|
227
|
-
}).addTo(this.map);
|
|
228
|
-
/**
|
|
229
|
-
* @deprecated since Symfony UX Map 2.29
|
|
230
|
-
*/
|
|
231
|
-
if (title) polygon.bindPopup(title);
|
|
220
|
+
const { "@id": _id, points, infoWindow, bridgeOptions = {} } = definition;
|
|
221
|
+
const polygon = L.polygon(points, { ...bridgeOptions }).addTo(this.map);
|
|
232
222
|
if (infoWindow) this.createInfoWindow({
|
|
233
223
|
definition: infoWindow,
|
|
234
224
|
element: polygon
|
|
@@ -239,15 +229,8 @@ var map_controller_default = class extends _Class {
|
|
|
239
229
|
polygon.remove();
|
|
240
230
|
}
|
|
241
231
|
doCreatePolyline({ definition }) {
|
|
242
|
-
const { "@id": _id, points,
|
|
243
|
-
const polyline = L.polyline(points, {
|
|
244
|
-
...rawOptions,
|
|
245
|
-
...bridgeOptions
|
|
246
|
-
}).addTo(this.map);
|
|
247
|
-
/**
|
|
248
|
-
* @deprecated since Symfony UX Map 2.29
|
|
249
|
-
*/
|
|
250
|
-
if (title) polyline.bindPopup(title);
|
|
232
|
+
const { "@id": _id, points, infoWindow, bridgeOptions = {} } = definition;
|
|
233
|
+
const polyline = L.polyline(points, { ...bridgeOptions }).addTo(this.map);
|
|
251
234
|
if (infoWindow) this.createInfoWindow({
|
|
252
235
|
definition: infoWindow,
|
|
253
236
|
element: polyline
|
|
@@ -258,16 +241,11 @@ var map_controller_default = class extends _Class {
|
|
|
258
241
|
polyline.remove();
|
|
259
242
|
}
|
|
260
243
|
doCreateCircle({ definition }) {
|
|
261
|
-
const { "@id": _id, center, radius,
|
|
244
|
+
const { "@id": _id, center, radius, infoWindow, bridgeOptions = {} } = definition;
|
|
262
245
|
const circle = L.circle(center, {
|
|
263
246
|
radius,
|
|
264
|
-
...rawOptions,
|
|
265
247
|
...bridgeOptions
|
|
266
248
|
}).addTo(this.map);
|
|
267
|
-
/**
|
|
268
|
-
* @deprecated since Symfony UX Map 2.29
|
|
269
|
-
*/
|
|
270
|
-
if (title) circle.bindPopup(title);
|
|
271
249
|
if (infoWindow) this.createInfoWindow({
|
|
272
250
|
definition: infoWindow,
|
|
273
251
|
element: circle
|
|
@@ -278,15 +256,8 @@ var map_controller_default = class extends _Class {
|
|
|
278
256
|
circle.remove();
|
|
279
257
|
}
|
|
280
258
|
doCreateRectangle({ definition }) {
|
|
281
|
-
const { "@id": _id, southWest, northEast,
|
|
282
|
-
const rectangle = L.rectangle([[southWest.lat, southWest.lng], [northEast.lat, northEast.lng]], {
|
|
283
|
-
...rawOptions,
|
|
284
|
-
...bridgeOptions
|
|
285
|
-
}).addTo(this.map);
|
|
286
|
-
/**
|
|
287
|
-
* @deprecated since Symfony UX Map 2.29
|
|
288
|
-
*/
|
|
289
|
-
if (title) rectangle.bindPopup(title);
|
|
259
|
+
const { "@id": _id, southWest, northEast, infoWindow, bridgeOptions = {} } = definition;
|
|
260
|
+
const rectangle = L.rectangle([[southWest.lat, southWest.lng], [northEast.lat, northEast.lng]], { ...bridgeOptions }).addTo(this.map);
|
|
290
261
|
if (infoWindow) this.createInfoWindow({
|
|
291
262
|
definition: infoWindow,
|
|
292
263
|
element: rectangle
|
|
@@ -297,11 +268,8 @@ var map_controller_default = class extends _Class {
|
|
|
297
268
|
rectangle.remove();
|
|
298
269
|
}
|
|
299
270
|
doCreateInfoWindow({ definition, element }) {
|
|
300
|
-
const { headerContent, content, opened, autoClose,
|
|
301
|
-
element.bindPopup([headerContent, content].filter((x) => x).join("<br>"), {
|
|
302
|
-
...rawOptions,
|
|
303
|
-
...bridgeOptions
|
|
304
|
-
});
|
|
271
|
+
const { headerContent, content, opened, autoClose, bridgeOptions = {} } = definition;
|
|
272
|
+
element.bindPopup([headerContent, content].filter((x) => x).join("<br>"), { ...bridgeOptions });
|
|
305
273
|
if (opened) {
|
|
306
274
|
if (autoClose) this.closePopups();
|
|
307
275
|
setTimeout(() => element.openPopup(), 0);
|
package/package.json
CHANGED