Skip to content

Commit 473b47d

Browse files
committed
fix: linter and coding style
fix: linter
1 parent ccd0863 commit 473b47d

File tree

9 files changed

+136
-16
lines changed

9 files changed

+136
-16
lines changed

src/Autocomplete/assets/dist/controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1515
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1616
PERFORMANCE OF THIS SOFTWARE.
1717
***************************************************************************** */
18-
/* global Reflect, Promise, SuppressedError, Symbol */
18+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1919

2020

2121
function __classPrivateFieldGet(receiver, state, kind, f) {

src/Map/assets/src/abstract_map_controller.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ export default abstract class<
175175
return infoWindow;
176176
}
177177

178-
179178
protected abstract doCreateInfoWindow({
180179
definition,
181180
element,
@@ -189,8 +188,8 @@ export default abstract class<
189188
element: Polygon;
190189
}
191190
| {
192-
definition: PolylineDefinition<PolylineOptions, InfoWindowOptions>['infoWindow'];
193-
element: Polyline;
191+
definition: PolylineDefinition<PolylineOptions, InfoWindowOptions>['infoWindow'];
192+
element: Polyline;
194193
}): InfoWindow;
195194

196195
protected abstract doFitBoundsToMarkers(): void;

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

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,68 @@
1-
import AbstractMapController from '@symfony/ux-map';
1+
import { Controller } from '@hotwired/stimulus';
22
import { Loader } from '@googlemaps/js-api-loader';
33

4+
let default_1$1 = class default_1 extends Controller {
5+
constructor() {
6+
super(...arguments);
7+
this.markers = [];
8+
this.infoWindows = [];
9+
this.polygons = [];
10+
this.polylines = [];
11+
}
12+
connect() {
13+
const { center, zoom, options, markers, polygons, polylines, fitBoundsToMarkers } = this.viewValue;
14+
this.dispatchEvent('pre-connect', { options });
15+
this.map = this.doCreateMap({ center, zoom, options });
16+
markers.forEach((marker) => this.createMarker(marker));
17+
polygons.forEach((polygon) => this.createPolygon(polygon));
18+
polylines.forEach((polyline) => this.createPolyline(polyline));
19+
if (fitBoundsToMarkers) {
20+
this.doFitBoundsToMarkers();
21+
}
22+
this.dispatchEvent('connect', {
23+
map: this.map,
24+
markers: this.markers,
25+
polygons: this.polygons,
26+
polylines: this.polylines,
27+
infoWindows: this.infoWindows,
28+
});
29+
}
30+
createMarker(definition) {
31+
this.dispatchEvent('marker:before-create', { definition });
32+
const marker = this.doCreateMarker(definition);
33+
this.dispatchEvent('marker:after-create', { marker });
34+
this.markers.push(marker);
35+
return marker;
36+
}
37+
createPolygon(definition) {
38+
this.dispatchEvent('polygon:before-create', { definition });
39+
const polygon = this.doCreatePolygon(definition);
40+
this.dispatchEvent('polygon:after-create', { polygon });
41+
this.polygons.push(polygon);
42+
return polygon;
43+
}
44+
createPolyline(definition) {
45+
this.dispatchEvent('polyline:before-create', { definition });
46+
const polyline = this.doCreatePolyline(definition);
47+
this.dispatchEvent('polyline:after-create', { polyline });
48+
this.polylines.push(polyline);
49+
return polyline;
50+
}
51+
createInfoWindow({ definition, element, }) {
52+
this.dispatchEvent('info-window:before-create', { definition, element });
53+
const infoWindow = this.doCreateInfoWindow({ definition, element });
54+
this.dispatchEvent('info-window:after-create', { infoWindow, element });
55+
this.infoWindows.push(infoWindow);
56+
return infoWindow;
57+
}
58+
};
59+
default_1$1.values = {
60+
providerOptions: Object,
61+
view: Object,
62+
};
63+
464
let _google;
5-
class default_1 extends AbstractMapController {
65+
class default_1 extends default_1$1 {
666
async connect() {
767
if (!_google) {
868
_google = { maps: {} };

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

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,68 @@
1-
import AbstractMapController from '@symfony/ux-map';
1+
import { Controller } from '@hotwired/stimulus';
22
import 'leaflet/dist/leaflet.min.css';
33
import * as L from 'leaflet';
44

5-
class map_controller extends AbstractMapController {
5+
class default_1 extends Controller {
6+
constructor() {
7+
super(...arguments);
8+
this.markers = [];
9+
this.infoWindows = [];
10+
this.polygons = [];
11+
this.polylines = [];
12+
}
13+
connect() {
14+
const { center, zoom, options, markers, polygons, polylines, fitBoundsToMarkers } = this.viewValue;
15+
this.dispatchEvent('pre-connect', { options });
16+
this.map = this.doCreateMap({ center, zoom, options });
17+
markers.forEach((marker) => this.createMarker(marker));
18+
polygons.forEach((polygon) => this.createPolygon(polygon));
19+
polylines.forEach((polyline) => this.createPolyline(polyline));
20+
if (fitBoundsToMarkers) {
21+
this.doFitBoundsToMarkers();
22+
}
23+
this.dispatchEvent('connect', {
24+
map: this.map,
25+
markers: this.markers,
26+
polygons: this.polygons,
27+
polylines: this.polylines,
28+
infoWindows: this.infoWindows,
29+
});
30+
}
31+
createMarker(definition) {
32+
this.dispatchEvent('marker:before-create', { definition });
33+
const marker = this.doCreateMarker(definition);
34+
this.dispatchEvent('marker:after-create', { marker });
35+
this.markers.push(marker);
36+
return marker;
37+
}
38+
createPolygon(definition) {
39+
this.dispatchEvent('polygon:before-create', { definition });
40+
const polygon = this.doCreatePolygon(definition);
41+
this.dispatchEvent('polygon:after-create', { polygon });
42+
this.polygons.push(polygon);
43+
return polygon;
44+
}
45+
createPolyline(definition) {
46+
this.dispatchEvent('polyline:before-create', { definition });
47+
const polyline = this.doCreatePolyline(definition);
48+
this.dispatchEvent('polyline:after-create', { polyline });
49+
this.polylines.push(polyline);
50+
return polyline;
51+
}
52+
createInfoWindow({ definition, element, }) {
53+
this.dispatchEvent('info-window:before-create', { definition, element });
54+
const infoWindow = this.doCreateInfoWindow({ definition, element });
55+
this.dispatchEvent('info-window:after-create', { infoWindow, element });
56+
this.infoWindows.push(infoWindow);
57+
return infoWindow;
58+
}
59+
}
60+
default_1.values = {
61+
providerOptions: Object,
62+
view: Object,
63+
};
64+
65+
class map_controller extends default_1 {
666
connect() {
767
L.Marker.prototype.options.icon = L.divIcon({
868
html: '<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" fill-rule="evenodd" stroke-linecap="round" clip-rule="evenodd" viewBox="0 0 500 820"><defs><linearGradient id="__sf_ux_map_gradient_marker_fill" x1="0" x2="1" y1="0" y2="0" gradientTransform="matrix(0 -37.57 37.57 0 416.45 541)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#126FC6"/><stop offset="1" stop-color="#4C9CD1"/></linearGradient><linearGradient id="__sf_ux_map_gradient_marker_border" x1="0" x2="1" y1="0" y2="0" gradientTransform="matrix(0 -19.05 19.05 0 414.48 522.49)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#2E6C97"/><stop offset="1" stop-color="#3883B7"/></linearGradient></defs><circle cx="252.31" cy="266.24" r="83.99" fill="#fff"/><path fill="url(#__sf_ux_map_gradient_marker_fill)" stroke="url(#__sf_ux_map_gradient_marker_border)" stroke-width="1.1" d="M416.54 503.61c-6.57 0-12.04 5.7-12.04 11.87 0 2.78 1.56 6.3 2.7 8.74l9.3 17.88 9.26-17.88c1.13-2.43 2.74-5.79 2.74-8.74 0-6.18-5.38-11.87-11.96-11.87Zm0 7.16a4.69 4.69 0 1 1-.02 9.4 4.69 4.69 0 0 1 .02-9.4Z" transform="translate(-7889.1 -9807.44) scale(19.54)"/></svg>',

src/Map/src/Bridge/Leaflet/tests/LeafletRendererTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,3 @@ public function provideTestRenderMap(): iterable
4949
];
5050
}
5151
}
52-
53-

src/Map/src/Map.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public function __construct(
4040
* @var array<Polyline>
4141
*/
4242
private array $polylines = [],
43-
) {}
43+
) {
44+
}
4445

4546
public function getRendererName(): ?string
4647
{
@@ -98,7 +99,7 @@ public function addPolygon(Polygon $polygon): self
9899

99100
return $this;
100101
}
101-
102+
102103
public function addPolyline(Polyline $polyline): self
103104
{
104105
$this->polylines[] = $polyline;
@@ -123,9 +124,9 @@ public function toArray(): array
123124
'zoom' => $this->zoom,
124125
'fitBoundsToMarkers' => $this->fitBoundsToMarkers,
125126
'options' => (object) ($this->options?->toArray() ?? []),
126-
'markers' => array_map(static fn(Marker $marker) => $marker->toArray(), $this->markers),
127-
'polygons' => array_map(static fn(Polygon $polygon) => $polygon->toArray(), $this->polygons),
128-
'polylines' => array_map(static fn(Polyline $polyline) => $polyline->toArray(), $this->polylines),
127+
'markers' => array_map(static fn (Marker $marker) => $marker->toArray(), $this->markers),
128+
'polygons' => array_map(static fn (Polygon $polygon) => $polygon->toArray(), $this->polygons),
129+
'polylines' => array_map(static fn (Polyline $polyline) => $polyline->toArray(), $this->polylines),
129130
];
130131
}
131132

src/Map/src/Polygon.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function __construct(
3333

3434
/**
3535
* Convert the polygon to an array representation.
36+
*
3637
* @return array{
3738
* points: array<array{lat: float, lng: float}>,
3839
* title: string|null,

src/Map/src/Polyline.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function __construct(
3333

3434
/**
3535
* Convert the polyline to an array representation.
36+
*
3637
* @return array{
3738
* points: array<array{lat: float, lng: float}>,
3839
* title: string|null,

src/Map/src/Twig/UXMapComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final class UXMapComponent
3636
* @var Polygon[]
3737
*/
3838
public array $polygons;
39-
39+
4040
/**
4141
* @var Polyline[]
4242
*/

0 commit comments

Comments
 (0)