Skip to content

Commit 2bc9934

Browse files
committed
update snapshot and add dist files
1 parent a9aebb0 commit 2bc9934

File tree

30 files changed

+151
-9
lines changed

30 files changed

+151
-9
lines changed

src/Map/assets/dist/abstract_map_controller.d.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ export type PolylineDefinition<PolylineOptions, InfoWindowOptions> = WithIdentif
4848
rawOptions?: PolylineOptions;
4949
extra: Record<string, unknown>;
5050
}>;
51+
export type CircleDefinition<CircleOptions, InfoWindowOptions> = WithIdentifier<{
52+
infoWindow?: InfoWindowWithoutPositionDefinition<InfoWindowOptions>;
53+
center: Point;
54+
radius: number;
55+
title: string | null;
56+
rawOptions?: CircleOptions;
57+
extra: Record<string, unknown>;
58+
}>;
5159
export type InfoWindowDefinition<InfoWindowOptions> = {
5260
headerContent: string | null;
5361
content: string | null;
@@ -58,7 +66,7 @@ export type InfoWindowDefinition<InfoWindowOptions> = {
5866
extra: Record<string, unknown>;
5967
};
6068
export type InfoWindowWithoutPositionDefinition<InfoWindowOptions> = Omit<InfoWindowDefinition<InfoWindowOptions>, 'position'>;
61-
export default abstract class<MapOptions, Map, MarkerOptions, Marker, InfoWindowOptions, InfoWindow, PolygonOptions, Polygon, PolylineOptions, Polyline> extends Controller<HTMLElement> {
69+
export default abstract class<MapOptions, Map, MarkerOptions, Marker, InfoWindowOptions, InfoWindow, PolygonOptions, Polygon, PolylineOptions, Polyline, CircleOptions, Circle> extends Controller<HTMLElement> {
6270
static values: {
6371
providerOptions: ObjectConstructor;
6472
center: ObjectConstructor;
@@ -67,6 +75,7 @@ export default abstract class<MapOptions, Map, MarkerOptions, Marker, InfoWindow
6775
markers: ArrayConstructor;
6876
polygons: ArrayConstructor;
6977
polylines: ArrayConstructor;
78+
circles: ArrayConstructor;
7079
options: ObjectConstructor;
7180
};
7281
centerValue: Point | null;
@@ -75,34 +84,39 @@ export default abstract class<MapOptions, Map, MarkerOptions, Marker, InfoWindow
7584
markersValue: Array<MarkerDefinition<MarkerOptions, InfoWindowOptions>>;
7685
polygonsValue: Array<PolygonDefinition<PolygonOptions, InfoWindowOptions>>;
7786
polylinesValue: Array<PolylineDefinition<PolylineOptions, InfoWindowOptions>>;
87+
circlesValue: Array<CircleDefinition<CircleOptions, InfoWindowOptions>>;
7888
optionsValue: MapOptions;
7989
hasCenterValue: boolean;
8090
hasZoomValue: boolean;
8191
hasFitBoundsToMarkersValue: boolean;
8292
hasMarkersValue: boolean;
8393
hasPolygonsValue: boolean;
8494
hasPolylinesValue: boolean;
95+
hasCirclesValue: boolean;
8596
hasOptionsValue: boolean;
8697
protected map: Map;
8798
protected markers: globalThis.Map<string, Marker>;
8899
protected polygons: globalThis.Map<string, Polygon>;
89100
protected polylines: globalThis.Map<string, Polyline>;
101+
protected circles: globalThis.Map<string, Circle>;
90102
protected infoWindows: Array<InfoWindow>;
91103
private isConnected;
92104
private createMarker;
93105
private createPolygon;
94106
private createPolyline;
107+
private createCircle;
95108
protected abstract dispatchEvent(name: string, payload: Record<string, unknown>): void;
96109
connect(): void;
97110
createInfoWindow({ definition, element, }: {
98111
definition: InfoWindowWithoutPositionDefinition<InfoWindowOptions>;
99-
element: Marker | Polygon | Polyline;
112+
element: Marker | Polygon | Polyline | Circle;
100113
}): InfoWindow;
101114
abstract centerValueChanged(): void;
102115
abstract zoomValueChanged(): void;
103116
markersValueChanged(): void;
104117
polygonsValueChanged(): void;
105118
polylinesValueChanged(): void;
119+
circlesValueChanged(): void;
106120
protected abstract doCreateMap({ center, zoom, options, }: {
107121
center: Point | null;
108122
zoom: number | null;
@@ -121,9 +135,13 @@ export default abstract class<MapOptions, Map, MarkerOptions, Marker, InfoWindow
121135
definition: PolylineDefinition<PolylineOptions, InfoWindowOptions>;
122136
}): Polyline;
123137
protected abstract doRemovePolyline(polyline: Polyline): void;
138+
protected abstract doCreateCircle({ definition, }: {
139+
definition: CircleDefinition<CircleOptions, InfoWindowOptions>;
140+
}): Circle;
141+
protected abstract doRemoveCircle(circle: Circle): void;
124142
protected abstract doCreateInfoWindow({ definition, element, }: {
125143
definition: InfoWindowWithoutPositionDefinition<InfoWindowOptions>;
126-
element: Marker | Polygon | Polyline;
144+
element: Marker | Polygon | Polyline | Circle;
127145
}): InfoWindow;
128146
protected abstract doCreateIcon({ definition, element, }: {
129147
definition: Icon;

src/Map/assets/dist/abstract_map_controller.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class default_1 extends Controller {
1111
this.markers = new Map();
1212
this.polygons = new Map();
1313
this.polylines = new Map();
14+
this.circles = new Map();
1415
this.infoWindows = [];
1516
this.isConnected = false;
1617
}
@@ -20,6 +21,7 @@ class default_1 extends Controller {
2021
this.createMarker = this.createDrawingFactory('marker', this.markers, this.doCreateMarker.bind(this));
2122
this.createPolygon = this.createDrawingFactory('polygon', this.polygons, this.doCreatePolygon.bind(this));
2223
this.createPolyline = this.createDrawingFactory('polyline', this.polylines, this.doCreatePolyline.bind(this));
24+
this.createCircle = this.createDrawingFactory('circle', this.circles, this.doCreateCircle.bind(this));
2325
this.map = this.doCreateMap({
2426
center: this.hasCenterValue ? this.centerValue : null,
2527
zoom: this.hasZoomValue ? this.zoomValue : null,
@@ -28,6 +30,7 @@ class default_1 extends Controller {
2830
this.markersValue.forEach((definition) => this.createMarker({ definition }));
2931
this.polygonsValue.forEach((definition) => this.createPolygon({ definition }));
3032
this.polylinesValue.forEach((definition) => this.createPolyline({ definition }));
33+
this.circlesValue.forEach((definition) => this.createCircle({ definition }));
3134
if (this.fitBoundsToMarkersValue) {
3235
this.doFitBoundsToMarkers();
3336
}
@@ -36,6 +39,7 @@ class default_1 extends Controller {
3639
markers: [...this.markers.values()],
3740
polygons: [...this.polygons.values()],
3841
polylines: [...this.polylines.values()],
42+
circles: [...this.circles.values()],
3943
infoWindows: this.infoWindows,
4044
});
4145
this.isConnected = true;
@@ -68,6 +72,12 @@ class default_1 extends Controller {
6872
}
6973
this.onDrawChanged(this.polylines, this.polylinesValue, this.createPolyline, this.doRemovePolyline);
7074
}
75+
circlesValueChanged() {
76+
if (!this.isConnected) {
77+
return;
78+
}
79+
this.onDrawChanged(this.circles, this.circlesValue, this.createCircle, this.doRemoveCircle);
80+
}
7181
createDrawingFactory(type, draws, factory) {
7282
const eventBefore = `${type}:before-create`;
7383
const eventAfter = `${type}:after-create`;
@@ -104,6 +114,7 @@ default_1.values = {
104114
markers: Array,
105115
polygons: Array,
106116
polylines: Array,
117+
circles: Array,
107118
options: Object,
108119
};
109120

src/Map/src/Bridge/Google/assets/dist/map_controller.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { LoaderOptions } from '@googlemaps/js-api-loader';
22
import AbstractMapController from '@symfony/ux-map';
3-
import type { Icon, InfoWindowWithoutPositionDefinition, MarkerDefinition, Point, PolygonDefinition, PolylineDefinition } from '@symfony/ux-map';
3+
import type { CircleDefinition, Icon, InfoWindowWithoutPositionDefinition, MarkerDefinition, Point, PolygonDefinition, PolylineDefinition } from '@symfony/ux-map';
44
type MapOptions = Pick<google.maps.MapOptions, 'mapId' | 'gestureHandling' | 'backgroundColor' | 'disableDoubleClickZoom' | 'zoomControl' | 'zoomControlOptions' | 'mapTypeControl' | 'mapTypeControlOptions' | 'streetViewControl' | 'streetViewControlOptions' | 'fullscreenControl' | 'fullscreenControlOptions'>;
5-
export default class extends AbstractMapController<MapOptions, google.maps.Map, google.maps.marker.AdvancedMarkerElementOptions, google.maps.marker.AdvancedMarkerElement, google.maps.InfoWindowOptions, google.maps.InfoWindow, google.maps.PolygonOptions, google.maps.Polygon, google.maps.PolylineOptions, google.maps.Polyline> {
5+
export default class extends AbstractMapController<MapOptions, google.maps.Map, google.maps.marker.AdvancedMarkerElementOptions, google.maps.marker.AdvancedMarkerElement, google.maps.InfoWindowOptions, google.maps.InfoWindow, google.maps.PolygonOptions, google.maps.Polygon, google.maps.PolylineOptions, google.maps.Polyline, google.maps.CircleOptions, google.maps.Circle> {
66
providerOptionsValue: Pick<LoaderOptions, 'apiKey' | 'id' | 'language' | 'region' | 'nonce' | 'retries' | 'url' | 'version' | 'libraries'>;
77
map: google.maps.Map;
88
parser: DOMParser;
@@ -27,6 +27,10 @@ export default class extends AbstractMapController<MapOptions, google.maps.Map,
2727
definition: PolylineDefinition<google.maps.PolylineOptions, google.maps.InfoWindowOptions>;
2828
}): google.maps.Polyline;
2929
protected doRemovePolyline(polyline: google.maps.Polyline): void;
30+
protected doCreateCircle({ definition, }: {
31+
definition: CircleDefinition<google.maps.CircleOptions, google.maps.InfoWindowOptions>;
32+
}): google.maps.Circle;
33+
protected doRemoveCircle(circle: google.maps.Circle): void;
3034
protected doCreateInfoWindow({ definition, element, }: {
3135
definition: InfoWindowWithoutPositionDefinition<google.maps.InfoWindowOptions>;
3236
element: google.maps.marker.AdvancedMarkerElement | google.maps.Polygon | google.maps.Polyline;

src/Map/src/Bridge/Google/assets/dist/map_controller.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class default_1 extends Controller {
1212
this.markers = new Map();
1313
this.polygons = new Map();
1414
this.polylines = new Map();
15+
this.circles = new Map();
1516
this.infoWindows = [];
1617
this.isConnected = false;
1718
}
@@ -21,6 +22,7 @@ class default_1 extends Controller {
2122
this.createMarker = this.createDrawingFactory('marker', this.markers, this.doCreateMarker.bind(this));
2223
this.createPolygon = this.createDrawingFactory('polygon', this.polygons, this.doCreatePolygon.bind(this));
2324
this.createPolyline = this.createDrawingFactory('polyline', this.polylines, this.doCreatePolyline.bind(this));
25+
this.createCircle = this.createDrawingFactory('circle', this.circles, this.doCreateCircle.bind(this));
2426
this.map = this.doCreateMap({
2527
center: this.hasCenterValue ? this.centerValue : null,
2628
zoom: this.hasZoomValue ? this.zoomValue : null,
@@ -29,6 +31,7 @@ class default_1 extends Controller {
2931
this.markersValue.forEach((definition) => this.createMarker({ definition }));
3032
this.polygonsValue.forEach((definition) => this.createPolygon({ definition }));
3133
this.polylinesValue.forEach((definition) => this.createPolyline({ definition }));
34+
this.circlesValue.forEach((definition) => this.createCircle({ definition }));
3235
if (this.fitBoundsToMarkersValue) {
3336
this.doFitBoundsToMarkers();
3437
}
@@ -37,6 +40,7 @@ class default_1 extends Controller {
3740
markers: [...this.markers.values()],
3841
polygons: [...this.polygons.values()],
3942
polylines: [...this.polylines.values()],
43+
circles: [...this.circles.values()],
4044
infoWindows: this.infoWindows,
4145
});
4246
this.isConnected = true;
@@ -69,6 +73,12 @@ class default_1 extends Controller {
6973
}
7074
this.onDrawChanged(this.polylines, this.polylinesValue, this.createPolyline, this.doRemovePolyline);
7175
}
76+
circlesValueChanged() {
77+
if (!this.isConnected) {
78+
return;
79+
}
80+
this.onDrawChanged(this.circles, this.circlesValue, this.createCircle, this.doRemoveCircle);
81+
}
7282
createDrawingFactory(type, draws, factory) {
7383
const eventBefore = `${type}:before-create`;
7484
const eventAfter = `${type}:after-create`;
@@ -105,6 +115,7 @@ default_1.values = {
105115
markers: Array,
106116
polygons: Array,
107117
polylines: Array,
118+
circles: Array,
108119
options: Object,
109120
};
110121

@@ -220,6 +231,25 @@ class map_controller extends default_1 {
220231
doRemovePolyline(polyline) {
221232
polyline.setMap(null);
222233
}
234+
doCreateCircle({ definition, }) {
235+
const { '@id': _id, center, radius, title, infoWindow, rawOptions = {} } = definition;
236+
const circle = new _google.maps.Circle({
237+
...rawOptions,
238+
center,
239+
radius,
240+
map: this.map,
241+
});
242+
if (title) {
243+
circle.set('title', title);
244+
}
245+
if (infoWindow) {
246+
this.createInfoWindow({ definition: infoWindow, element: circle });
247+
}
248+
return circle;
249+
}
250+
doRemoveCircle(circle) {
251+
circle.setMap(null);
252+
}
223253
doCreateInfoWindow({ definition, element, }) {
224254
const { headerContent, content, extra, rawOptions = {}, ...otherOptions } = definition;
225255
const infoWindow = new _google.maps.InfoWindow({

src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set markers with icons__1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
data-symfony--ux-google-map--map-markers-value="[{&quot;position&quot;:{&quot;lat&quot;:48.8566,&quot;lng&quot;:2.3522},&quot;title&quot;:&quot;Paris&quot;,&quot;infoWindow&quot;:null,&quot;icon&quot;:{&quot;type&quot;:&quot;url&quot;,&quot;width&quot;:32,&quot;height&quot;:32,&quot;url&quot;:&quot;https:\/\/cdn.jsdelivr.net\/npm\/[email protected]\/icons\/geo-alt.svg&quot;},&quot;extra&quot;:[],&quot;id&quot;:null,&quot;@id&quot;:&quot;217fa57668ad8e64&quot;},{&quot;position&quot;:{&quot;lat&quot;:45.764,&quot;lng&quot;:4.8357},&quot;title&quot;:&quot;Lyon&quot;,&quot;infoWindow&quot;:null,&quot;icon&quot;:{&quot;type&quot;:&quot;ux-icon&quot;,&quot;width&quot;:32,&quot;height&quot;:32,&quot;name&quot;:&quot;fa:map-marker&quot;,&quot;_generated_html&quot;:&quot;&lt;svg xmlns=\&quot;http:\/\/www.w3.org\/2000\/svg\&quot; width=\&quot;24\&quot; height=\&quot;24\&quot;&gt;...&lt;\/svg&gt;&quot;},&quot;extra&quot;:[],&quot;id&quot;:null,&quot;@id&quot;:&quot;255b208136900fc0&quot;},{&quot;position&quot;:{&quot;lat&quot;:45.8566,&quot;lng&quot;:2.3522},&quot;title&quot;:&quot;Dijon&quot;,&quot;infoWindow&quot;:null,&quot;icon&quot;:{&quot;type&quot;:&quot;svg&quot;,&quot;width&quot;:24,&quot;height&quot;:24,&quot;html&quot;:&quot;&lt;svg xmlns=\&quot;http:\/\/www.w3.org\/2000\/svg\&quot; width=\&quot;24\&quot; height=\&quot;24\&quot;&gt;...&lt;\/svg&gt;&quot;},&quot;extra&quot;:[],&quot;id&quot;:null,&quot;@id&quot;:&quot;1a410e92214f770c&quot;}]"
1111
data-symfony--ux-google-map--map-polygons-value="[]"
1212
data-symfony--ux-google-map--map-polylines-value="[]"
13+
data-symfony--ux-google-map--map-circles-value="[]"
1314
></div>

src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set simple map, with minimum options__1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
data-symfony--ux-google-map--map-markers-value="[]"
1111
data-symfony--ux-google-map--map-polygons-value="[]"
1212
data-symfony--ux-google-map--map-polylines-value="[]"
13+
data-symfony--ux-google-map--map-circles-value="[]"
1314
></div>

src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with all markers removed__1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
data-symfony--ux-google-map--map-markers-value="[]"
1111
data-symfony--ux-google-map--map-polygons-value="[]"
1212
data-symfony--ux-google-map--map-polylines-value="[]"
13+
data-symfony--ux-google-map--map-circles-value="[]"
1314
></div>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!-- This HTML has been prettified for testing purposes, and may not represent the actual HTML output.
2+
Run "php vendor/bin/phpunit -d --update-snapshots" to update the snapshot. -->
3+
<div
4+
data-controller="symfony--ux-google-map--map"
5+
data-symfony--ux-google-map--map-provider-options-value="{&quot;apiKey&quot;:&quot;api_key&quot;}"
6+
data-symfony--ux-google-map--map-center-value="{&quot;lat&quot;:48.8566,&quot;lng&quot;:2.3522}"
7+
data-symfony--ux-google-map--map-zoom-value="12"
8+
data-symfony--ux-google-map--map-fit-bounds-to-markers-value="false"
9+
data-symfony--ux-google-map--map-options-value="{&quot;mapId&quot;:null,&quot;gestureHandling&quot;:&quot;auto&quot;,&quot;backgroundColor&quot;:null,&quot;disableDoubleClickZoom&quot;:false,&quot;zoomControlOptions&quot;:{&quot;position&quot;:22},&quot;mapTypeControlOptions&quot;:{&quot;mapTypeIds&quot;:[],&quot;position&quot;:14,&quot;style&quot;:0},&quot;streetViewControlOptions&quot;:{&quot;position&quot;:22},&quot;fullscreenControlOptions&quot;:{&quot;position&quot;:20},&quot;@provider&quot;:&quot;google&quot;}"
10+
data-symfony--ux-google-map--map-markers-value="[]"
11+
data-symfony--ux-google-map--map-polygons-value="[]"
12+
data-symfony--ux-google-map--map-polylines-value="[]"
13+
data-symfony--ux-google-map--map-circles-value="[{&quot;center&quot;:{&quot;lat&quot;:48.8566,&quot;lng&quot;:2.3522},&quot;radius&quot;:500,&quot;title&quot;:null,&quot;infoWindow&quot;:{&quot;headerContent&quot;:null,&quot;content&quot;:&quot;Circle&quot;,&quot;position&quot;:null,&quot;opened&quot;:false,&quot;autoClose&quot;:true,&quot;extra&quot;:[]},&quot;extra&quot;:[],&quot;id&quot;:null},{&quot;center&quot;:{&quot;lat&quot;:1.1,&quot;lng&quot;:2.2},&quot;radius&quot;:1000,&quot;title&quot;:null,&quot;infoWindow&quot;:{&quot;headerContent&quot;:null,&quot;content&quot;:&quot;Circle&quot;,&quot;position&quot;:null,&quot;opened&quot;:false,&quot;autoClose&quot;:true,&quot;extra&quot;:[]},&quot;extra&quot;:[],&quot;id&quot;:null}]"
14+
></div>

src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with controls enabled__1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
data-symfony--ux-google-map--map-markers-value="[]"
1111
data-symfony--ux-google-map--map-polygons-value="[]"
1212
data-symfony--ux-google-map--map-polylines-value="[]"
13+
data-symfony--ux-google-map--map-circles-value="[]"
1314
></div>

src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with custom attributes__1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
data-symfony--ux-google-map--map-markers-value="[]"
1111
data-symfony--ux-google-map--map-polygons-value="[]"
1212
data-symfony--ux-google-map--map-polylines-value="[]"
13+
data-symfony--ux-google-map--map-circles-value="[]"
1314
class="map"
1415
></div>

0 commit comments

Comments
 (0)