From 6851e76415ecc55b1acc1bc172c02ffdd60728ae Mon Sep 17 00:00:00 2001 From: Danny van Wijk Date: Wed, 28 May 2025 13:33:59 +0200 Subject: [PATCH] [Map][Leaflet] Add options `attributionControl`, `attributionControlOptions`, `zoomControl` and `zoomControlOptions` --- src/Map/src/Bridge/Leaflet/CHANGELOG.md | 7 ++ src/Map/src/Bridge/Leaflet/README.md | 7 ++ .../Leaflet/assets/dist/map_controller.d.ts | 15 +++- .../Leaflet/assets/dist/map_controller.js | 8 +++ .../Leaflet/assets/src/map_controller.ts | 21 +++++- .../src/Bridge/Leaflet/src/LeafletOptions.php | 68 +++++++++++++++++-- .../src/Option/AttributionControlOptions.php | 48 +++++++++++++ .../Leaflet/src/Option/ControlPosition.php | 23 +++++++ .../Leaflet/src/Option/ZoomControlOptions.php | 55 +++++++++++++++ .../Leaflet/tests/LeafletOptionsTest.php | 51 ++++++++++++++ .../Option/AttributionControlOptionsTest.php | 42 ++++++++++++ .../tests/Option/ZoomControlOptionsTest.php | 34 ++++++++++ ...ap with data set markers with icons__1.txt | 2 +- ...tRenderMap with data set simple map__1.txt | 2 +- ...h data set with all markers removed__1.txt | 2 +- ...ith data set with custom attributes__1.txt | 2 +- ...th marker remove and new ones added__1.txt | 2 +- ...ta set with markers and infoWindows__1.txt | 2 +- ...a set with polygons and infoWindows__1.txt | 2 +- ... set with polylines and infoWindows__1.txt | 2 +- 20 files changed, 380 insertions(+), 15 deletions(-) create mode 100644 src/Map/src/Bridge/Leaflet/src/Option/AttributionControlOptions.php create mode 100644 src/Map/src/Bridge/Leaflet/src/Option/ControlPosition.php create mode 100644 src/Map/src/Bridge/Leaflet/src/Option/ZoomControlOptions.php create mode 100644 src/Map/src/Bridge/Leaflet/tests/Option/AttributionControlOptionsTest.php create mode 100644 src/Map/src/Bridge/Leaflet/tests/Option/ZoomControlOptionsTest.php diff --git a/src/Map/src/Bridge/Leaflet/CHANGELOG.md b/src/Map/src/Bridge/Leaflet/CHANGELOG.md index 62c9e93e09c..a9e17804201 100644 --- a/src/Map/src/Bridge/Leaflet/CHANGELOG.md +++ b/src/Map/src/Bridge/Leaflet/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## 2.27 + +- Add `attributionControl` and `attributionControlOptions` to `LeafletOptions`, + to configure [attribution control](https://leafletjs.com/reference.html#map-attributioncontrol) and its options +- Add `zoomControl` and `zoomControlOptions` to `LeafletOptions`, + to configure [zoom control](https://leafletjs.com/reference.html#map-zoomcontrol) and its options + ## 2.26 - Using `new LeafletOptions(tileLayer: false)` will now disable the default `TileLayer`. diff --git a/src/Map/src/Bridge/Leaflet/README.md b/src/Map/src/Bridge/Leaflet/README.md index a6d0501e770..e6e1732088a 100644 --- a/src/Map/src/Bridge/Leaflet/README.md +++ b/src/Map/src/Bridge/Leaflet/README.md @@ -33,7 +33,10 @@ You can use the `LeafletOptions` class to configure your `Map`:: ```php use Symfony\UX\Map\Bridge\Leaflet\LeafletOptions; +use Symfony\UX\Map\Bridge\Leaflet\Option\AttributionControlOptions; +use Symfony\UX\Map\Bridge\Leaflet\Option\ControlPosition; use Symfony\UX\Map\Bridge\Leaflet\Option\TileLayer; +use Symfony\UX\Map\Bridge\Leaflet\Option\ZoomControlOptions; use Symfony\UX\Map\Point; use Symfony\UX\Map\Map; @@ -50,6 +53,10 @@ $leafletOptions = (new LeafletOptions()) 'maxZoom' => 10, ] )) + ->attributionControl(false) + ->attributionControlOptions(new AttributionControlOptions(ControlPosition::BOTTOM_LEFT)) + ->zoomControl(false) + ->zoomControlOptions(new ZoomControlOptions(ControlPosition::TOP_LEFT)) ; // Add the custom options to the map diff --git a/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.d.ts b/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.d.ts index f0d9085f83c..c7c80e91b7e 100644 --- a/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.d.ts +++ b/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.d.ts @@ -2,8 +2,19 @@ import AbstractMapController from '@symfony/ux-map'; import type { Icon, InfoWindowWithoutPositionDefinition, MarkerDefinition, Point, PolygonDefinition, PolylineDefinition } from '@symfony/ux-map'; import 'leaflet/dist/leaflet.min.css'; import * as L from 'leaflet'; -import type { MapOptions as LeafletMapOptions, MarkerOptions, PolylineOptions as PolygonOptions, PolylineOptions, PopupOptions } from 'leaflet'; -type MapOptions = Pick & { +import type { ControlPosition, MapOptions as LeafletMapOptions, MarkerOptions, PolylineOptions as PolygonOptions, PolylineOptions, PopupOptions } from 'leaflet'; +type MapOptions = Pick & { + attributionControlOptions?: { + position: ControlPosition; + prefix: string | false; + }; + zoomControlOptions?: { + position: ControlPosition; + zoomInText: string; + zoomInTitle: string; + zoomOutText: string; + zoomOutTitle: string; + }; tileLayer: { url: string; attribution: string; diff --git a/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.js b/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.js index 5529e713951..747d858e4f1 100644 --- a/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.js +++ b/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.js @@ -144,6 +144,8 @@ class map_controller extends default_1 { ...options, center: center === null ? undefined : center, zoom: zoom === null ? undefined : zoom, + attributionControl: false, + zoomControl: false, }); if (options.tileLayer) { L.tileLayer(options.tileLayer.url, { @@ -151,6 +153,12 @@ class map_controller extends default_1 { ...options.tileLayer.options, }).addTo(map); } + if (typeof options.attributionControlOptions !== 'undefined') { + L.control.attribution({ ...options.attributionControlOptions }).addTo(map); + } + if (typeof options.zoomControlOptions !== 'undefined') { + L.control.zoom({ ...options.zoomControlOptions }).addTo(map); + } return map; } doCreateMarker({ definition }) { diff --git a/src/Map/src/Bridge/Leaflet/assets/src/map_controller.ts b/src/Map/src/Bridge/Leaflet/assets/src/map_controller.ts index dbc733b96c9..21845d0f24c 100644 --- a/src/Map/src/Bridge/Leaflet/assets/src/map_controller.ts +++ b/src/Map/src/Bridge/Leaflet/assets/src/map_controller.ts @@ -10,6 +10,7 @@ import type { import 'leaflet/dist/leaflet.min.css'; import * as L from 'leaflet'; import type { + ControlPosition, LatLngBoundsExpression, MapOptions as LeafletMapOptions, MarkerOptions, @@ -18,7 +19,15 @@ import type { PopupOptions, } from 'leaflet'; -type MapOptions = Pick & { +type MapOptions = Pick & { + attributionControlOptions?: { position: ControlPosition; prefix: string | false }; + zoomControlOptions?: { + position: ControlPosition; + zoomInText: string; + zoomInTitle: string; + zoomOutText: string; + zoomOutTitle: string; + }; tileLayer: { url: string; attribution: string; options: Record } | false; }; @@ -79,6 +88,8 @@ export default class extends AbstractMapController< ...options, center: center === null ? undefined : center, zoom: zoom === null ? undefined : zoom, + attributionControl: false, + zoomControl: false, }); if (options.tileLayer) { @@ -88,6 +99,14 @@ export default class extends AbstractMapController< }).addTo(map); } + if (typeof options.attributionControlOptions !== 'undefined') { + L.control.attribution({ ...options.attributionControlOptions }).addTo(map); + } + + if (typeof options.zoomControlOptions !== 'undefined') { + L.control.zoom({ ...options.zoomControlOptions }).addTo(map); + } + return map; } diff --git a/src/Map/src/Bridge/Leaflet/src/LeafletOptions.php b/src/Map/src/Bridge/Leaflet/src/LeafletOptions.php index 4edcdca23ff..2b55d8e50e0 100644 --- a/src/Map/src/Bridge/Leaflet/src/LeafletOptions.php +++ b/src/Map/src/Bridge/Leaflet/src/LeafletOptions.php @@ -11,7 +11,9 @@ namespace Symfony\UX\Map\Bridge\Leaflet; +use Symfony\UX\Map\Bridge\Leaflet\Option\AttributionControlOptions; use Symfony\UX\Map\Bridge\Leaflet\Option\TileLayer; +use Symfony\UX\Map\Bridge\Leaflet\Option\ZoomControlOptions; use Symfony\UX\Map\MapOptionsInterface; /** @@ -24,6 +26,10 @@ public function __construct( url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', attribution: '© OpenStreetMap', ), + private bool $attributionControl = true, + private AttributionControlOptions $attributionControlOptions = new AttributionControlOptions(), + private bool $zoomControl = true, + private ZoomControlOptions $zoomControlOptions = new ZoomControlOptions(), ) { } @@ -34,14 +40,58 @@ public function tileLayer(TileLayer|false $tileLayer): self return $this; } + public function attributionControl(bool $enable = true): self + { + $this->attributionControl = $enable; + + return $this; + } + + public function attributionControlOptions(AttributionControlOptions $attributionControlOptions): self + { + $this->attributionControl = true; + $this->attributionControlOptions = $attributionControlOptions; + + return $this; + } + + public function zoomControl(bool $enable = true): self + { + $this->zoomControl = $enable; + + return $this; + } + + public function zoomControlOptions(ZoomControlOptions $zoomControlOptions): self + { + $this->zoomControl = true; + $this->zoomControlOptions = $zoomControlOptions; + + return $this; + } + /** * @internal */ public static function fromArray(array $array): MapOptionsInterface { - return new self( - tileLayer: $array['tileLayer'] ? TileLayer::fromArray($array['tileLayer']) : false, - ); + $array += ['attributionControl' => false, 'zoomControl' => false, 'tileLayer' => false]; + + if ($array['tileLayer']) { + $array['tileLayer'] = TileLayer::fromArray($array['tileLayer']); + } + + if (isset($array['attributionControlOptions'])) { + $array['attributionControl'] = true; + $array['attributionControlOptions'] = AttributionControlOptions::fromArray($array['attributionControlOptions']); + } + + if (isset($array['zoomControlOptions'])) { + $array['zoomControl'] = true; + $array['zoomControlOptions'] = ZoomControlOptions::fromArray($array['zoomControlOptions']); + } + + return new self(...$array); } /** @@ -49,8 +99,18 @@ public static function fromArray(array $array): MapOptionsInterface */ public function toArray(): array { - return [ + $array = [ 'tileLayer' => $this->tileLayer ? $this->tileLayer->toArray() : false, ]; + + if ($this->attributionControl) { + $array['attributionControlOptions'] = $this->attributionControlOptions->toArray(); + } + + if ($this->zoomControl) { + $array['zoomControlOptions'] = $this->zoomControlOptions->toArray(); + } + + return $array; } } diff --git a/src/Map/src/Bridge/Leaflet/src/Option/AttributionControlOptions.php b/src/Map/src/Bridge/Leaflet/src/Option/AttributionControlOptions.php new file mode 100644 index 00000000000..6c5947274a3 --- /dev/null +++ b/src/Map/src/Bridge/Leaflet/src/Option/AttributionControlOptions.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\UX\Map\Bridge\Leaflet\Option; + +/** + * Options for the rendering of the attribution control. + * + * @see https://leafletjs.com/reference.html#control-zoom + */ +final class AttributionControlOptions +{ + public function __construct( + private readonly ControlPosition $position = ControlPosition::BOTTOM_RIGHT, + private readonly string|false $prefix = 'Leaflet', + ) { + } + + /** + * @internal + */ + public static function fromArray(array $array): self + { + return new self( + position: ControlPosition::from($array['position']), + prefix: $array['prefix'], + ); + } + + /** + * @internal + */ + public function toArray(): array + { + return [ + 'position' => $this->position->value, + 'prefix' => $this->prefix, + ]; + } +} diff --git a/src/Map/src/Bridge/Leaflet/src/Option/ControlPosition.php b/src/Map/src/Bridge/Leaflet/src/Option/ControlPosition.php new file mode 100644 index 00000000000..ae9ecda22a2 --- /dev/null +++ b/src/Map/src/Bridge/Leaflet/src/Option/ControlPosition.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\UX\Map\Bridge\Leaflet\Option; + +/** + * @see https://leafletjs.com/reference.html#control-position + */ +enum ControlPosition: string +{ + case TOP_LEFT = 'topleft'; + case TOP_RIGHT = 'topright'; + case BOTTOM_LEFT = 'bottomleft'; + case BOTTOM_RIGHT = 'bottomright'; +} diff --git a/src/Map/src/Bridge/Leaflet/src/Option/ZoomControlOptions.php b/src/Map/src/Bridge/Leaflet/src/Option/ZoomControlOptions.php new file mode 100644 index 00000000000..f2f916f82c2 --- /dev/null +++ b/src/Map/src/Bridge/Leaflet/src/Option/ZoomControlOptions.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\UX\Map\Bridge\Leaflet\Option; + +/** + * Options for the rendering of the zoom control. + * + * @see https://leafletjs.com/reference.html#control-zoom + */ +final class ZoomControlOptions +{ + public function __construct( + private readonly ControlPosition $position = ControlPosition::TOP_LEFT, + private readonly string $zoomInText = '', + private readonly string $zoomInTitle = 'Zoom in', + private readonly string $zoomOutText = '', + private readonly string $zoomOutTitle = 'Zoom out', + ) { + } + + /** + * @internal + */ + public static function fromArray(array $array): self + { + if (isset($array['position'])) { + $array['position'] = ControlPosition::from($array['position']); + } + + return new self(...$array); + } + + /** + * @internal + */ + public function toArray(): array + { + return [ + 'position' => $this->position->value, + 'zoomInText' => $this->zoomInText, + 'zoomInTitle' => $this->zoomInTitle, + 'zoomOutText' => $this->zoomOutText, + 'zoomOutTitle' => $this->zoomOutTitle, + ]; + } +} diff --git a/src/Map/src/Bridge/Leaflet/tests/LeafletOptionsTest.php b/src/Map/src/Bridge/Leaflet/tests/LeafletOptionsTest.php index 5559133649d..14a5822ff1d 100644 --- a/src/Map/src/Bridge/Leaflet/tests/LeafletOptionsTest.php +++ b/src/Map/src/Bridge/Leaflet/tests/LeafletOptionsTest.php @@ -27,6 +27,17 @@ public function testWithMinimalConfiguration(): void 'attribution' => '© OpenStreetMap', 'options' => [], ], + 'attributionControlOptions' => [ + 'position' => 'bottomright', + 'prefix' => 'Leaflet', + ], + 'zoomControlOptions' => [ + 'position' => 'topleft', + 'zoomInText' => '', + 'zoomInTitle' => 'Zoom in', + 'zoomOutText' => '', + 'zoomOutTitle' => 'Zoom out', + ], ], $leafletOptions->toArray()); self::assertEquals($leafletOptions, LeafletOptions::fromArray($leafletOptions->toArray())); @@ -58,6 +69,17 @@ public function testWithMaximumConfiguration(): void 'zoomOffset' => 0, ], ], + 'attributionControlOptions' => [ + 'position' => 'bottomright', + 'prefix' => 'Leaflet', + ], + 'zoomControlOptions' => [ + 'position' => 'topleft', + 'zoomInText' => '', + 'zoomInTitle' => 'Zoom in', + 'zoomOutText' => '', + 'zoomOutTitle' => 'Zoom out', + ], ], $leafletOptions->toArray()); self::assertEquals($leafletOptions, LeafletOptions::fromArray($leafletOptions->toArray())); @@ -69,6 +91,35 @@ public function testWithTileLayerFalse(): void self::assertSame([ 'tileLayer' => false, + 'attributionControlOptions' => [ + 'position' => 'bottomright', + 'prefix' => 'Leaflet', + ], + 'zoomControlOptions' => [ + 'position' => 'topleft', + 'zoomInText' => '', + 'zoomInTitle' => 'Zoom in', + 'zoomOutText' => '', + 'zoomOutTitle' => 'Zoom out', + ], + ], $leafletOptions->toArray()); + + self::assertEquals($leafletOptions, LeafletOptions::fromArray($leafletOptions->toArray())); + } + + public function testWithoutControls(): void + { + $leafletOptions = new LeafletOptions( + attributionControl: false, + zoomControl: false, + ); + + self::assertSame([ + 'tileLayer' => [ + 'url' => 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + 'attribution' => '© OpenStreetMap', + 'options' => [], + ], ], $leafletOptions->toArray()); self::assertEquals($leafletOptions, LeafletOptions::fromArray($leafletOptions->toArray())); diff --git a/src/Map/src/Bridge/Leaflet/tests/Option/AttributionControlOptionsTest.php b/src/Map/src/Bridge/Leaflet/tests/Option/AttributionControlOptionsTest.php new file mode 100644 index 00000000000..05b914deacc --- /dev/null +++ b/src/Map/src/Bridge/Leaflet/tests/Option/AttributionControlOptionsTest.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\UX\Map\Bridge\Leaflet\Tests\Option; + +use PHPUnit\Framework\TestCase; +use Symfony\UX\Map\Bridge\Leaflet\Option\AttributionControlOptions; +use Symfony\UX\Map\Bridge\Leaflet\Option\ControlPosition; + +class AttributionControlOptionsTest extends TestCase +{ + public function testToArray(): void + { + $options = new AttributionControlOptions(); + + self::assertSame([ + 'position' => ControlPosition::BOTTOM_RIGHT->value, + 'prefix' => 'Leaflet', + ], $options->toArray()); + } + + public function testToArrayWithDifferentConfiguration(): void + { + $options = new AttributionControlOptions( + position: ControlPosition::BOTTOM_LEFT, + prefix: 'Leaflet prefix', + ); + + self::assertSame([ + 'position' => ControlPosition::BOTTOM_LEFT->value, + 'prefix' => 'Leaflet prefix', + ], $options->toArray()); + } +} diff --git a/src/Map/src/Bridge/Leaflet/tests/Option/ZoomControlOptionsTest.php b/src/Map/src/Bridge/Leaflet/tests/Option/ZoomControlOptionsTest.php new file mode 100644 index 00000000000..e21ac360ffd --- /dev/null +++ b/src/Map/src/Bridge/Leaflet/tests/Option/ZoomControlOptionsTest.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\UX\Map\Bridge\Leaflet\Tests\Option; + +use PHPUnit\Framework\TestCase; +use Symfony\UX\Map\Bridge\Leaflet\Option\ControlPosition; +use Symfony\UX\Map\Bridge\Leaflet\Option\ZoomControlOptions; + +class ZoomControlOptionsTest extends TestCase +{ + public function testToArray(): void + { + $options = new ZoomControlOptions( + position: ControlPosition::TOP_LEFT, + ); + + self::assertSame([ + 'position' => ControlPosition::TOP_LEFT->value, + 'zoomInText' => '', + 'zoomInTitle' => 'Zoom in', + 'zoomOutText' => '', + 'zoomOutTitle' => 'Zoom out', + ], $options->toArray()); + } +} diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set markers with icons__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set markers with icons__1.txt index 4aa53a326da..a30fe285064 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set markers with icons__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set markers with icons__1.txt @@ -6,7 +6,7 @@ data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}" data-symfony--ux-leaflet-map--map-zoom-value="12" data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false" - data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"@provider":"leaflet"}" + data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}" data-symfony--ux-leaflet-map--map-markers-value="[{"position":{"lat":48.8566,"lng":2.3522},"title":"Paris","infoWindow":null,"icon":{"type":"url","width":32,"height":32,"url":"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap-icons@1.11.3\/icons\/geo-alt.svg"},"extra":[],"id":null,"@id":"217fa57668ad8e64"},{"position":{"lat":45.764,"lng":4.8357},"title":"Lyon","infoWindow":null,"icon":{"type":"ux-icon","width":32,"height":32,"name":"fa:map-marker","_generated_html":"<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\">...<\/svg>"},"extra":[],"id":null,"@id":"255b208136900fc0"},{"position":{"lat":45.8566,"lng":2.3522},"title":"Dijon","infoWindow":null,"icon":{"type":"svg","width":24,"height":24,"html":"<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\">...<\/svg>"},"extra":[],"id":null,"@id":"1a410e92214f770c"}]" data-symfony--ux-leaflet-map--map-polygons-value="[]" data-symfony--ux-leaflet-map--map-polylines-value="[]" diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set simple map__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set simple map__1.txt index 2a39e666909..0e99279fcb5 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set simple map__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set simple map__1.txt @@ -6,7 +6,7 @@ data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}" data-symfony--ux-leaflet-map--map-zoom-value="12" data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false" - data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"@provider":"leaflet"}" + data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}" data-symfony--ux-leaflet-map--map-markers-value="[]" data-symfony--ux-leaflet-map--map-polygons-value="[]" data-symfony--ux-leaflet-map--map-polylines-value="[]" diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with all markers removed__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with all markers removed__1.txt index 2a39e666909..0e99279fcb5 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with all markers removed__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with all markers removed__1.txt @@ -6,7 +6,7 @@ data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}" data-symfony--ux-leaflet-map--map-zoom-value="12" data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false" - data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"@provider":"leaflet"}" + data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}" data-symfony--ux-leaflet-map--map-markers-value="[]" data-symfony--ux-leaflet-map--map-polygons-value="[]" data-symfony--ux-leaflet-map--map-polylines-value="[]" diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with custom attributes__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with custom attributes__1.txt index 0c4ece6a8fa..b4b78c96372 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with custom attributes__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with custom attributes__1.txt @@ -6,7 +6,7 @@ data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}" data-symfony--ux-leaflet-map--map-zoom-value="12" data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false" - data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"@provider":"leaflet"}" + data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}" data-symfony--ux-leaflet-map--map-markers-value="[]" data-symfony--ux-leaflet-map--map-polygons-value="[]" data-symfony--ux-leaflet-map--map-polylines-value="[]" diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with marker remove and new ones added__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with marker remove and new ones added__1.txt index 04afe48ecc9..65e01c12fe5 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with marker remove and new ones added__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with marker remove and new ones added__1.txt @@ -6,7 +6,7 @@ data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}" data-symfony--ux-leaflet-map--map-zoom-value="12" data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false" - data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"@provider":"leaflet"}" + data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}" data-symfony--ux-leaflet-map--map-markers-value="[{"position":{"lat":48.8566,"lng":2.3522},"title":"Paris","infoWindow":null,"icon":null,"extra":[],"id":"marker1","@id":"872feba9ebf3905d"},{"position":{"lat":48.8566,"lng":2.3522},"title":"Lyon","infoWindow":{"headerContent":null,"content":"Lyon","position":null,"opened":false,"autoClose":true,"extra":[]},"icon":null,"extra":[],"id":"marker2","@id":"6028bf5e41f644ab"}]" data-symfony--ux-leaflet-map--map-polygons-value="[]" data-symfony--ux-leaflet-map--map-polylines-value="[]" diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with markers and infoWindows__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with markers and infoWindows__1.txt index 64f60cc82c5..d8bc48d5eb1 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with markers and infoWindows__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with markers and infoWindows__1.txt @@ -6,7 +6,7 @@ data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}" data-symfony--ux-leaflet-map--map-zoom-value="12" data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false" - data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"@provider":"leaflet"}" + data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}" data-symfony--ux-leaflet-map--map-markers-value="[{"position":{"lat":48.8566,"lng":2.3522},"title":"Paris","infoWindow":null,"icon":null,"extra":[],"id":"marker1","@id":"872feba9ebf3905d"},{"position":{"lat":48.8566,"lng":2.3522},"title":"Lyon","infoWindow":{"headerContent":null,"content":"Lyon","position":null,"opened":false,"autoClose":true,"extra":[]},"icon":null,"extra":[],"id":null,"@id":"bce206d73dc5c164"}]" data-symfony--ux-leaflet-map--map-polygons-value="[]" data-symfony--ux-leaflet-map--map-polylines-value="[]" diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt index e5439223b31..7b6ae68b194 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt @@ -6,7 +6,7 @@ data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}" data-symfony--ux-leaflet-map--map-zoom-value="12" data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false" - data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"@provider":"leaflet"}" + data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}" data-symfony--ux-leaflet-map--map-markers-value="[]" data-symfony--ux-leaflet-map--map-polygons-value="[{"points":[{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522}],"title":null,"infoWindow":null,"extra":[],"id":"polygon1","@id":"35bfa920335b849d"},{"points":[{"lat":1.1,"lng":2.2},{"lat":3.3,"lng":4.4},{"lat":5.5,"lng":6.6}],"title":null,"infoWindow":{"headerContent":null,"content":"Polygon","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":"polygon2","@id":"7be1fe9f10489d73"}]" data-symfony--ux-leaflet-map--map-polylines-value="[]" diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt index be6a8953c44..eebd057985a 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt @@ -6,7 +6,7 @@ data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}" data-symfony--ux-leaflet-map--map-zoom-value="12" data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false" - data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"@provider":"leaflet"}" + data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}" data-symfony--ux-leaflet-map--map-markers-value="[]" data-symfony--ux-leaflet-map--map-polygons-value="[]" data-symfony--ux-leaflet-map--map-polylines-value="[{"points":[{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522}],"title":null,"infoWindow":null,"extra":[],"id":"polyline1","@id":"823f6ee5acdb5db3"},{"points":[{"lat":1.1,"lng":2.2},{"lat":3.3,"lng":4.4},{"lat":5.5,"lng":6.6}],"title":null,"infoWindow":{"headerContent":null,"content":"Polyline","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":"polyline2","@id":"77fb0e390b5e91f1"}]"