@lblod/ember-rdfa-editor-lblod-plugins 35.1.1 → 35.1.2-dev.74d2740e8a4ac8d0366e3fb6f4cf39ecf9cde87f
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/.changeset/cold-crabs-shop.md +5 -0
- package/.changeset/shaggy-elephants-raise.md +5 -0
- package/CHANGELOG.md +6 -0
- package/addon/components/besluit-topic-plugin/besluit-topic-select.ts +2 -0
- package/addon/components/location-plugin/map.gts +73 -8
- package/addon/helpers/set.ts +15 -0
- package/app/styles/location-plugin.scss +9 -0
- package/declarations/addon/components/besluit-topic-plugin/besluit-topic-select.d.ts +2 -0
- package/declarations/addon/components/location-plugin/map.d.ts +6 -0
- package/declarations/addon/helpers/set.d.ts +2 -0
- package/package.json +1 -1
- package/translations/en-US.yaml +1 -0
- package/translations/nl-BE.yaml +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 35.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#634](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/634) [`7f89a0f`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/7f89a0f010d4f843407390621cdab4f0966deb02) Thanks [@kobemertens](https://github.com/kobemertens)! - Change the default tile server of location plugin to GBR and add OSM as an option
|
|
8
|
+
|
|
3
9
|
## 35.1.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -6,6 +6,8 @@ import { BesluitTopic } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/bes
|
|
|
6
6
|
|
|
7
7
|
type Args = {
|
|
8
8
|
besluitTopics: BesluitTopic[];
|
|
9
|
+
selected?: BesluitTopic[];
|
|
10
|
+
onchange: (topic: BesluitTopic[]) => void;
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export default class BesluitTopicSelectComponent extends Component<Args> {
|
|
@@ -20,6 +20,10 @@ import {
|
|
|
20
20
|
GeoPos,
|
|
21
21
|
type GlobalCoordinates,
|
|
22
22
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/geo-helpers';
|
|
23
|
+
import AuToggleSwitch from '@appuniversum/ember-appuniversum/components/au-toggle-switch';
|
|
24
|
+
import AuCard from '@appuniversum/ember-appuniversum/components/au-card';
|
|
25
|
+
import { on } from '@ember/modifier';
|
|
26
|
+
import set from '@lblod/ember-rdfa-editor-lblod-plugins/helpers/set';
|
|
23
27
|
|
|
24
28
|
// Taken from Leaflet's default icon, with the viewbox tweaked (from 0 0 500 820), so that the icon
|
|
25
29
|
// is a whole number of pixels in size, to make positioning the point easy.
|
|
@@ -56,16 +60,26 @@ const MARKER_ICON = Leaflet.divIcon({
|
|
|
56
60
|
export const SUPPORTED_LOCATION_TYPES = ['address', 'place', 'area'] as const;
|
|
57
61
|
export type LocationType = (typeof SUPPORTED_LOCATION_TYPES)[number];
|
|
58
62
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
const TILE_PROVIDER_CONSTANTS = {
|
|
64
|
+
OPEN_STREET_MAP: {
|
|
65
|
+
ATTRIBUTION:
|
|
66
|
+
'© <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
|
67
|
+
URL: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
68
|
+
},
|
|
69
|
+
GRB: {
|
|
70
|
+
ATTRIBUTION:
|
|
71
|
+
'Bron: Grootschalig Referentie Bestand Vlaanderen, Digitaal Vlaanderen',
|
|
72
|
+
URL: 'https://geo.api.vlaanderen.be/GRB/wmts?layer=grb_bsk&style=GRB-Basiskaart&tilematrixset=GoogleMapsVL&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&TileMatrix={z}&TileCol={x}&TileRow={y}',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
62
76
|
const COORD_SYSTEM_CENTER: GlobalCoordinates = {
|
|
63
77
|
lng: 4.450822554431,
|
|
64
78
|
lat: 50.50526730529,
|
|
65
79
|
};
|
|
66
80
|
const COORD_SYSTEM_START = {
|
|
67
81
|
center: COORD_SYSTEM_CENTER,
|
|
68
|
-
zoom:
|
|
82
|
+
zoom: 8,
|
|
69
83
|
};
|
|
70
84
|
|
|
71
85
|
function isLast(array: unknown[], index: number) {
|
|
@@ -216,6 +230,7 @@ class MapWrapper extends Component<MapWrapperSig> {
|
|
|
216
230
|
|
|
217
231
|
export default class LocationPluginMapComponent extends Component<Signature> {
|
|
218
232
|
@tracked vertices: GlobalCoordinates[] = [];
|
|
233
|
+
@tracked useGRB = true;
|
|
219
234
|
|
|
220
235
|
// Use untracked properties as otherwise the map jumps to any area or location we pick
|
|
221
236
|
existingAreaBounds = generateBoundsFromShape(this.args.existingArea);
|
|
@@ -259,6 +274,14 @@ export default class LocationPluginMapComponent extends Component<Signature> {
|
|
|
259
274
|
return 'center' in this.mapLocation ? this.mapLocation.center : false;
|
|
260
275
|
}
|
|
261
276
|
|
|
277
|
+
get tileProvider() {
|
|
278
|
+
if (!this.useGRB) {
|
|
279
|
+
return TILE_PROVIDER_CONSTANTS.OPEN_STREET_MAP;
|
|
280
|
+
} else {
|
|
281
|
+
return TILE_PROVIDER_CONSTANTS.GRB;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
262
285
|
@action
|
|
263
286
|
onMapClick(event: LeafletMouseEvent) {
|
|
264
287
|
if (this.args.locationType === 'place') {
|
|
@@ -280,6 +303,11 @@ export default class LocationPluginMapComponent extends Component<Signature> {
|
|
|
280
303
|
}
|
|
281
304
|
}
|
|
282
305
|
|
|
306
|
+
@action
|
|
307
|
+
stopEventPropagation(event: MouseEvent) {
|
|
308
|
+
event.stopPropagation();
|
|
309
|
+
}
|
|
310
|
+
|
|
283
311
|
<template>
|
|
284
312
|
<div
|
|
285
313
|
class='map-wrapper
|
|
@@ -291,10 +319,47 @@ export default class LocationPluginMapComponent extends Component<Signature> {
|
|
|
291
319
|
@onClick={{this.onMapClick}}
|
|
292
320
|
as |layers|
|
|
293
321
|
>
|
|
294
|
-
<
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
322
|
+
<div
|
|
323
|
+
{{! template-lint-disable no-invalid-interactive }}
|
|
324
|
+
{{on 'click' this.stopEventPropagation}}
|
|
325
|
+
class='tile-provider-selector'
|
|
326
|
+
>
|
|
327
|
+
<AuCard
|
|
328
|
+
class='au-u-padding-tiny'
|
|
329
|
+
@size='flush'
|
|
330
|
+
@textCenter={{true}}
|
|
331
|
+
as |c|
|
|
332
|
+
>
|
|
333
|
+
<c.content>
|
|
334
|
+
<AuToggleSwitch
|
|
335
|
+
@checked={{this.useGRB}}
|
|
336
|
+
@onChange={{set this 'useGRB'}}
|
|
337
|
+
>
|
|
338
|
+
<p class='au-u-para-tiny'>{{t 'location-plugin.use-grb'}}</p>
|
|
339
|
+
</AuToggleSwitch>
|
|
340
|
+
</c.content>
|
|
341
|
+
</AuCard>
|
|
342
|
+
</div>
|
|
343
|
+
{{! Don't change: I know the last component from each leg can be lifted out of the condition but cycling the OSM button does not work anymore then}}
|
|
344
|
+
{{#if (eq this.tileProvider.URL TILE_PROVIDER_CONSTANTS.GRB.URL)}}
|
|
345
|
+
<layers.tile
|
|
346
|
+
@url={{TILE_PROVIDER_CONSTANTS.OPEN_STREET_MAP.URL}}
|
|
347
|
+
@minZoom={{8}}
|
|
348
|
+
@maxNativeZoom={{12}}
|
|
349
|
+
/>
|
|
350
|
+
<layers.tile
|
|
351
|
+
@url={{this.tileProvider.URL}}
|
|
352
|
+
@attribution={{this.tileProvider.ATTRIBUTION}}
|
|
353
|
+
@minZoom={{8}}
|
|
354
|
+
/>
|
|
355
|
+
{{else}}
|
|
356
|
+
<layers.tile
|
|
357
|
+
@url={{this.tileProvider.URL}}
|
|
358
|
+
@attribution={{this.tileProvider.ATTRIBUTION}}
|
|
359
|
+
@minZoom={{8}}
|
|
360
|
+
/>
|
|
361
|
+
{{/if}}
|
|
362
|
+
|
|
298
363
|
{{#if (and @address (eq @locationType 'address') this.foundAddress)}}
|
|
299
364
|
<layers.marker
|
|
300
365
|
@location={{this.foundAddress}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default <T extends string, U>(
|
|
2
|
+
obj: Record<T, U>,
|
|
3
|
+
propName: T,
|
|
4
|
+
value?: U,
|
|
5
|
+
) => {
|
|
6
|
+
if (value === undefined) {
|
|
7
|
+
return (innerValue: U) => {
|
|
8
|
+
obj[propName] = innerValue;
|
|
9
|
+
};
|
|
10
|
+
} else {
|
|
11
|
+
return () => {
|
|
12
|
+
obj[propName] = value;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
.map-wrapper {
|
|
21
21
|
height: 100%;
|
|
22
|
+
position: relative;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
// Override the 'grab' cursor to 'pointer' so we can accurately pick points
|
|
@@ -28,5 +29,13 @@
|
|
|
28
29
|
|
|
29
30
|
.leaflet-container {
|
|
30
31
|
height: 100%;
|
|
32
|
+
font-family: var(--au-font);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.leaflet-container .tile-provider-selector {
|
|
36
|
+
position: absolute;
|
|
37
|
+
bottom: 0.6em;
|
|
38
|
+
left: 0.6em;
|
|
39
|
+
z-index: 1000;
|
|
31
40
|
}
|
|
32
41
|
}
|
|
@@ -2,6 +2,8 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { BesluitTopic } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-topic-plugin/utils/fetchBesluitTopics';
|
|
3
3
|
type Args = {
|
|
4
4
|
besluitTopics: BesluitTopic[];
|
|
5
|
+
selected?: BesluitTopic[];
|
|
6
|
+
onchange: (topic: BesluitTopic[]) => void;
|
|
5
7
|
};
|
|
6
8
|
export default class BesluitTopicSelectComponent extends Component<Args> {
|
|
7
9
|
AlertTriangleIcon: import("@ember/component/template-only").TOC<import("@appuniversum/ember-appuniversum/components/icons/alert-triangle").AlertTriangleIconSignature>;
|
|
@@ -20,11 +20,17 @@ interface Signature {
|
|
|
20
20
|
}
|
|
21
21
|
export default class LocationPluginMapComponent extends Component<Signature> {
|
|
22
22
|
vertices: GlobalCoordinates[];
|
|
23
|
+
useGRB: boolean;
|
|
23
24
|
existingAreaBounds: LatLngBoundsExpression | undefined;
|
|
24
25
|
existingLocationCoords: GlobalCoordinates | undefined;
|
|
25
26
|
mapLocation: LeafletMapStart;
|
|
26
27
|
get foundAddress(): false | import("leaflet").LatLngTuple | import("leaflet").LatLngLiteral;
|
|
28
|
+
get tileProvider(): {
|
|
29
|
+
ATTRIBUTION: string;
|
|
30
|
+
URL: string;
|
|
31
|
+
};
|
|
27
32
|
onMapClick(event: LeafletMouseEvent): void;
|
|
28
33
|
onVertexClick(index: number): void;
|
|
34
|
+
stopEventPropagation(event: MouseEvent): void;
|
|
29
35
|
}
|
|
30
36
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "35.1.
|
|
3
|
+
"version": "35.1.2-dev.74d2740e8a4ac8d0366e3fb6f4cf39ecf9cde87f",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
package/translations/en-US.yaml
CHANGED