@geotrekce/geotrek-rando-widget 0.0.2 → 0.0.5
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/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
- package/dist/cjs/grw-app.cjs.entry.js +93 -0
- package/dist/cjs/{grw-app_7.cjs.entry.js → grw-filter_6.cjs.entry.js} +424 -384
- package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +52 -0
- package/dist/cjs/grw-trek-card.cjs.entry.js +47 -0
- package/dist/cjs/{index-c6f73e30.js → index-c2c4531d.js} +46 -1
- package/dist/cjs/length-d315d156.js +34 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/store-972b8d2a.js +209 -0
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/grw-app/grw-app.css +70 -5
- package/dist/collection/components/grw-app/grw-app.js +139 -33
- package/dist/collection/components/grw-filter/grw-filter.css +29 -0
- package/dist/collection/components/grw-filter/grw-filter.js +132 -0
- package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.css +31 -0
- package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +53 -0
- package/dist/collection/components/grw-map/grw-map.css +99 -0
- package/dist/collection/components/grw-map/grw-map.js +315 -42
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +31 -0
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +41 -0
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +39 -0
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +52 -0
- package/dist/collection/components/grw-trek-card/grw-trek-card.css +67 -30
- package/dist/collection/components/grw-trek-card/grw-trek-card.js +37 -13
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +160 -1
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +123 -8
- package/dist/collection/components/grw-treks-list/grw-treks-list.css +17 -3
- package/dist/collection/components/grw-treks-list/grw-treks-list.js +29 -7
- package/dist/collection/store/grw-trek-provider.js +36 -8
- package/dist/collection/store/grw-treks-provider.js +16 -7
- package/dist/collection/store/store.js +10 -0
- package/dist/collection/stories/App.js +22 -16
- package/dist/collection/stories/App.stories.js +14 -9
- package/dist/collection/stories/TrekCard.js +2 -1
- package/dist/collection/stories/TrekCard.stories.js +4 -3
- package/dist/collection/stories/TrekDetail.js +3 -1
- package/dist/collection/stories/TrekDetail.stories.js +5 -3
- package/dist/collection/stories/TrekMap.js +6 -4
- package/dist/collection/stories/TrekMap.stories.js +10 -7
- package/dist/collection/stories/TreksList.js +10 -9
- package/dist/collection/stories/TreksList.stories.js +4 -3
- package/dist/collection/stories/TreksMap.stories.js +6 -5
- package/dist/collection/utils/utils.js +2 -2
- package/dist/components/grw-app.js +76 -11
- package/dist/components/grw-filter.d.ts +11 -0
- package/dist/components/grw-filter.js +6 -0
- package/dist/components/grw-filter2.js +95 -0
- package/dist/components/grw-information-desk-detail.d.ts +11 -0
- package/dist/components/grw-information-desk-detail.js +6 -0
- package/dist/components/grw-information-desk-detail2.js +34 -0
- package/dist/components/grw-map2.js +263 -39
- package/dist/components/grw-poi-detail.d.ts +11 -0
- package/dist/components/grw-poi-detail.js +6 -0
- package/dist/components/grw-poi-detail2.js +32 -0
- package/dist/components/grw-sensitive-area-detail.d.ts +11 -0
- package/dist/components/grw-sensitive-area-detail.js +6 -0
- package/dist/components/grw-sensitive-area-detail2.js +37 -0
- package/dist/components/grw-trek-card2.js +11 -6
- package/dist/components/grw-trek-detail2.js +40 -7
- package/dist/components/grw-trek-provider2.js +36 -8
- package/dist/components/grw-treks-list2.js +10 -7
- package/dist/components/grw-treks-provider2.js +16 -7
- package/dist/components/length.js +2 -2
- package/dist/components/store.js +10 -0
- package/dist/esm/geotrek-rando-widget.js +2 -2
- package/dist/esm/grw-app.entry.js +89 -0
- package/dist/esm/{grw-app_7.entry.js → grw-filter_6.entry.js} +398 -357
- package/dist/esm/grw-information-desk-detail_3.entry.js +46 -0
- package/dist/esm/grw-trek-card.entry.js +43 -0
- package/dist/esm/{index-7aa9e822.js → index-192d910f.js} +47 -2
- package/dist/esm/length-d82189db.js +27 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/store-5a42b5d8.js +206 -0
- package/dist/geotrek-rando-widget/geotrek-rando-widget.css +1 -1
- package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
- package/dist/geotrek-rando-widget/p-206a52d9.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-2d9ae918.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-6dce5e6c.js +2 -0
- package/dist/geotrek-rando-widget/p-8cfa03c0.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-d3aa9819.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-e63213a9.js +1 -0
- package/dist/geotrek-rando-widget/p-f3f7d6be.js +1 -0
- package/dist/types/components/grw-app/grw-app.d.ts +13 -2
- package/dist/types/components/grw-filter/grw-filter.d.ts +9 -0
- package/dist/types/components/grw-information-desk-detail/grw-information-desk-detail.d.ts +5 -0
- package/dist/types/components/grw-map/grw-map.d.ts +14 -4
- package/dist/types/components/grw-poi-detail/grw-poi-detail.d.ts +5 -0
- package/dist/types/components/grw-sensitive-area-detail/grw-sensitive-area-detail.d.ts +5 -0
- package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +6 -4
- package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +10 -4
- package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +1 -0
- package/dist/types/components.d.ts +88 -3
- package/dist/types/store/store.d.ts +21 -1
- package/dist/types/types/types.d.ts +119 -3
- package/package.json +9 -10
- package/readme.md +19 -1
- package/dist/geotrek-rando-widget/p-332ba9ab.js +0 -2
- package/dist/geotrek-rando-widget/p-b7c66d2d.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Host, h, Element, Prop, State } from '@stencil/core';
|
|
1
|
+
import { Component, Host, h, Element, Prop, State, Event } from '@stencil/core';
|
|
2
2
|
import L from 'leaflet';
|
|
3
3
|
import state, { onChange } from 'store/store';
|
|
4
4
|
import departureArrivalImage from '../../assets/departure-arrival.svg';
|
|
@@ -7,17 +7,20 @@ export class GrwMap {
|
|
|
7
7
|
this.mapIsReady = false;
|
|
8
8
|
this.center = '1, 1';
|
|
9
9
|
this.zoom = 10;
|
|
10
|
+
this.colorPrimary = '#6b0030';
|
|
11
|
+
this.colorPrimaryTint = '#974c6e';
|
|
10
12
|
this.colorTrekLine = '#6b0030';
|
|
11
13
|
this.colorDepartureIcon = '#006b3b';
|
|
12
14
|
this.colorArrivalIcon = '#85003b';
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
+
this.colorSensitiveArea = ' #4974a5';
|
|
16
|
+
this.colorPoiIcon = '#974c6e';
|
|
15
17
|
}
|
|
16
18
|
componentDidLoad() {
|
|
17
19
|
this.map = L.map(this.element, {
|
|
18
20
|
center: this.center.split(',').map(Number),
|
|
19
21
|
zoom: this.zoom,
|
|
20
22
|
});
|
|
23
|
+
L.control.scale().addTo(this.map);
|
|
21
24
|
L.tileLayer(this.urlLayer, {
|
|
22
25
|
maxZoom: 19,
|
|
23
26
|
attribution: this.attribution,
|
|
@@ -28,11 +31,11 @@ export class GrwMap {
|
|
|
28
31
|
else if (state.currentTrek) {
|
|
29
32
|
this.addTreks();
|
|
30
33
|
}
|
|
31
|
-
onChange('
|
|
34
|
+
onChange('currentTreks', () => {
|
|
32
35
|
if (state.currentTrek) {
|
|
33
36
|
this.addTrek();
|
|
34
37
|
}
|
|
35
|
-
else if (state.
|
|
38
|
+
else if (state.currentTreks) {
|
|
36
39
|
this.addTreks();
|
|
37
40
|
}
|
|
38
41
|
});
|
|
@@ -49,34 +52,63 @@ export class GrwMap {
|
|
|
49
52
|
}
|
|
50
53
|
addTreks() {
|
|
51
54
|
var _a;
|
|
52
|
-
const
|
|
55
|
+
const trekscurrentDepartureCoordinates = [];
|
|
53
56
|
const treksFeatureCollection = {
|
|
54
57
|
type: 'FeatureCollection',
|
|
55
58
|
features: [],
|
|
56
59
|
};
|
|
57
|
-
for (const trek of state.
|
|
58
|
-
|
|
60
|
+
for (const trek of state.currentTreks) {
|
|
61
|
+
trekscurrentDepartureCoordinates.push(trek.departure_geom);
|
|
59
62
|
treksFeatureCollection.features.push({
|
|
60
63
|
type: 'Feature',
|
|
61
|
-
properties: { practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram },
|
|
62
64
|
geometry: { type: 'Point', coordinates: trek.departure_geom },
|
|
65
|
+
properties: {
|
|
66
|
+
id: trek.id,
|
|
67
|
+
name: trek.name,
|
|
68
|
+
practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
|
|
69
|
+
imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
|
|
70
|
+
},
|
|
63
71
|
});
|
|
64
72
|
}
|
|
65
|
-
if (
|
|
66
|
-
const bounds = L.latLngBounds(
|
|
73
|
+
if (trekscurrentDepartureCoordinates.length > 0) {
|
|
74
|
+
const bounds = L.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
|
|
67
75
|
this.currentBounds = bounds;
|
|
68
76
|
this.map.fitBounds(this.currentBounds);
|
|
69
77
|
}
|
|
70
|
-
this.treksLayer
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
if (!this.treksLayer) {
|
|
79
|
+
this.treksLayer = L.geoJSON(treksFeatureCollection, {
|
|
80
|
+
pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
|
|
81
|
+
icon: L.divIcon({
|
|
82
|
+
html: geoJsonPoint.properties.practice && `<img src=${geoJsonPoint.properties.practice} />`,
|
|
83
|
+
className: 'trek-marker',
|
|
84
|
+
iconSize: 48,
|
|
85
|
+
}),
|
|
86
|
+
autoPanOnFocus: false,
|
|
76
87
|
}),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
onEachFeature: (geoJsonPoint, layer) => {
|
|
89
|
+
layer.once('click', () => {
|
|
90
|
+
const trekDeparturePopup = L.DomUtil.create('div');
|
|
91
|
+
trekDeparturePopup.className = 'trek-departure-popup';
|
|
92
|
+
trekDeparturePopup.onclick = () => this.trekCardPress.emit(geoJsonPoint.properties.id);
|
|
93
|
+
const trekName = L.DomUtil.create('div');
|
|
94
|
+
trekName.innerHTML = geoJsonPoint.properties.name;
|
|
95
|
+
trekName.className = 'trek-name';
|
|
96
|
+
if (geoJsonPoint.properties.imgSrc) {
|
|
97
|
+
trekName.className += ' trek-name-margin-top';
|
|
98
|
+
const trekImg = L.DomUtil.create('img');
|
|
99
|
+
trekImg.src = geoJsonPoint.properties.imgSrc;
|
|
100
|
+
trekDeparturePopup.appendChild(trekImg);
|
|
101
|
+
}
|
|
102
|
+
trekDeparturePopup.appendChild(trekName);
|
|
103
|
+
layer.bindPopup(trekDeparturePopup, { interactive: true, autoPan: false, closeButton: false }).openPopup();
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
}).addTo(this.map);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
this.treksLayer.clearLayers();
|
|
110
|
+
this.treksLayer.addData(treksFeatureCollection);
|
|
111
|
+
}
|
|
80
112
|
!this.mapIsReady && (this.mapIsReady = !this.mapIsReady);
|
|
81
113
|
}
|
|
82
114
|
removeTreks() {
|
|
@@ -86,39 +118,40 @@ export class GrwMap {
|
|
|
86
118
|
}
|
|
87
119
|
}
|
|
88
120
|
addTrek() {
|
|
89
|
-
const
|
|
121
|
+
const currentTrekFeature = {
|
|
90
122
|
type: 'Feature',
|
|
91
123
|
geometry: state.currentTrek.geometry,
|
|
92
124
|
properties: {},
|
|
93
125
|
};
|
|
94
|
-
this.
|
|
126
|
+
this.currentTrekLayer = L.geoJSON(currentTrekFeature, {
|
|
95
127
|
style: () => ({
|
|
96
128
|
color: this.colorTrekLine,
|
|
97
129
|
}),
|
|
130
|
+
interactive: false,
|
|
98
131
|
}).addTo(this.map);
|
|
99
132
|
const bounds = L.latLngBounds(state.currentTrek.geometry.coordinates.map(coordinate => [coordinate[1], coordinate[0]]));
|
|
100
133
|
this.currentBounds = bounds;
|
|
101
134
|
this.map.fitBounds(this.currentBounds);
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
const
|
|
135
|
+
const currentDepartureCoordinates = [state.currentTrek.geometry.coordinates.at(0)[0], state.currentTrek.geometry.coordinates.at(0)[1]];
|
|
136
|
+
const currentArrivalCoordinates = [state.currentTrek.geometry.coordinates.at(-1)[0], state.currentTrek.geometry.coordinates.at(-1)[1]];
|
|
137
|
+
const currentDepartureArrivalFeatureCollection = {
|
|
105
138
|
type: 'FeatureCollection',
|
|
106
139
|
features: [
|
|
107
140
|
{
|
|
108
141
|
type: 'Feature',
|
|
109
142
|
properties: { type: 'departure' },
|
|
110
|
-
geometry: { type: 'Point', coordinates:
|
|
143
|
+
geometry: { type: 'Point', coordinates: currentDepartureCoordinates },
|
|
111
144
|
},
|
|
112
145
|
],
|
|
113
146
|
};
|
|
114
|
-
if (
|
|
115
|
-
|
|
147
|
+
if (currentDepartureCoordinates[0] !== currentArrivalCoordinates[0] || currentDepartureCoordinates[1] !== currentArrivalCoordinates[1]) {
|
|
148
|
+
currentDepartureArrivalFeatureCollection.features.push({
|
|
116
149
|
type: 'Feature',
|
|
117
150
|
properties: { type: 'arrival' },
|
|
118
|
-
geometry: { type: 'Point', coordinates:
|
|
151
|
+
geometry: { type: 'Point', coordinates: currentArrivalCoordinates },
|
|
119
152
|
});
|
|
120
153
|
}
|
|
121
|
-
this.
|
|
154
|
+
this.currentDepartureArrivalLayer = L.geoJSON(currentDepartureArrivalFeatureCollection, {
|
|
122
155
|
pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
|
|
123
156
|
icon: L.divIcon({
|
|
124
157
|
html: departureArrivalImage,
|
|
@@ -127,18 +160,205 @@ export class GrwMap {
|
|
|
127
160
|
iconAnchor: [0, 48],
|
|
128
161
|
}),
|
|
129
162
|
autoPanOnFocus: false,
|
|
163
|
+
interactive: false,
|
|
130
164
|
}),
|
|
131
165
|
}).addTo(this.map);
|
|
166
|
+
if (state.currentTrek.parking_location) {
|
|
167
|
+
const currentParking = {
|
|
168
|
+
type: 'Feature',
|
|
169
|
+
properties: {},
|
|
170
|
+
geometry: { type: 'Point', coordinates: state.currentTrek.parking_location },
|
|
171
|
+
};
|
|
172
|
+
this.currentParkingLayer = L.geoJSON(currentParking, {
|
|
173
|
+
pointToLayer: (_geoJsonPoint, latlng) => L.marker(latlng, {
|
|
174
|
+
icon: L.divIcon({
|
|
175
|
+
html: '<div>P</div>',
|
|
176
|
+
className: 'parking-icon',
|
|
177
|
+
iconSize: 48,
|
|
178
|
+
iconAnchor: [0, 48],
|
|
179
|
+
}),
|
|
180
|
+
autoPanOnFocus: false,
|
|
181
|
+
interactive: false,
|
|
182
|
+
}),
|
|
183
|
+
}).addTo(this.map);
|
|
184
|
+
}
|
|
185
|
+
if (state.currentSensitiveAreas && state.currentSensitiveAreas.length > 0) {
|
|
186
|
+
const currentSensitiveAreasFeatureCollection = {
|
|
187
|
+
type: 'FeatureCollection',
|
|
188
|
+
features: [],
|
|
189
|
+
};
|
|
190
|
+
for (const sensitiveArea of state.currentSensitiveAreas) {
|
|
191
|
+
currentSensitiveAreasFeatureCollection.features.push({
|
|
192
|
+
type: 'Feature',
|
|
193
|
+
properties: { name: sensitiveArea.name },
|
|
194
|
+
geometry: sensitiveArea.geometry,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
this.currentSensitiveAreasLayer = L.geoJSON(currentSensitiveAreasFeatureCollection, {
|
|
198
|
+
onEachFeature: (geoJsonPoint, layer) => {
|
|
199
|
+
layer.once('mouseover', () => {
|
|
200
|
+
const sensitiveAreaTooltip = L.DomUtil.create('div');
|
|
201
|
+
sensitiveAreaTooltip.className = 'sensitive-area-tooltip';
|
|
202
|
+
const sensitiveAreaName = L.DomUtil.create('div');
|
|
203
|
+
sensitiveAreaName.innerHTML = geoJsonPoint.properties.name;
|
|
204
|
+
sensitiveAreaName.className = 'sensitive-area-name';
|
|
205
|
+
sensitiveAreaTooltip.appendChild(sensitiveAreaName);
|
|
206
|
+
layer.bindTooltip(sensitiveAreaTooltip).openTooltip();
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
style: () => ({ color: this.colorSensitiveArea }),
|
|
210
|
+
}).addTo(this.map);
|
|
211
|
+
L.Control.SensitiveAreasCheckboxContainer = L.Control.extend({
|
|
212
|
+
onAdd: () => {
|
|
213
|
+
const sensitiveAreasCheckboxContainer = L.DomUtil.create('div');
|
|
214
|
+
sensitiveAreasCheckboxContainer.className = 'sensitiveAreasCheckboxContainer';
|
|
215
|
+
const sensitiveAreasCheckbox = L.DomUtil.create('input');
|
|
216
|
+
sensitiveAreasCheckbox.setAttribute('id', 'sensitiveAreasCheckbox');
|
|
217
|
+
sensitiveAreasCheckbox.setAttribute('type', 'checkbox');
|
|
218
|
+
sensitiveAreasCheckbox.setAttribute('checked', 'true');
|
|
219
|
+
sensitiveAreasCheckbox.onclick = value => value.composedPath()[0].checked ? this.map.addLayer(this.currentSensitiveAreasLayer) : this.map.removeLayer(this.currentSensitiveAreasLayer);
|
|
220
|
+
const sensitiveAreasLabel = L.DomUtil.create('label');
|
|
221
|
+
sensitiveAreasLabel.setAttribute('for', 'sensitiveAreasCheckbox');
|
|
222
|
+
sensitiveAreasLabel.innerHTML =
|
|
223
|
+
currentSensitiveAreasFeatureCollection.features.length > 1 || currentSensitiveAreasFeatureCollection.features[0].geometry.type === 'MultiPolygon'
|
|
224
|
+
? 'Afficher les zones sensibles'
|
|
225
|
+
: 'Afficher la zone sensible';
|
|
226
|
+
sensitiveAreasCheckboxContainer.appendChild(sensitiveAreasCheckbox);
|
|
227
|
+
sensitiveAreasCheckboxContainer.appendChild(sensitiveAreasLabel);
|
|
228
|
+
return sensitiveAreasCheckboxContainer;
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
L.control.sensitiveAreasCheckboxContainer = () => {
|
|
232
|
+
return new L.Control.SensitiveAreasCheckboxContainer();
|
|
233
|
+
};
|
|
234
|
+
this.sensitiveAreasControl = L.control.sensitiveAreasCheckboxContainer({ position: 'topright' }).addTo(this.map);
|
|
235
|
+
}
|
|
236
|
+
if (state.currentPois && state.currentPois.length > 0) {
|
|
237
|
+
const currentPoisFeatureCollection = {
|
|
238
|
+
type: 'FeatureCollection',
|
|
239
|
+
features: [],
|
|
240
|
+
};
|
|
241
|
+
for (const currentPoi of state.currentPois) {
|
|
242
|
+
currentPoisFeatureCollection.features.push({
|
|
243
|
+
type: 'Feature',
|
|
244
|
+
properties: { name: currentPoi.name, type_pictogram: currentPoi.type_pictogram },
|
|
245
|
+
geometry: currentPoi.geometry,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
this.currentPoisLayer = L.geoJSON(currentPoisFeatureCollection, {
|
|
249
|
+
pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
|
|
250
|
+
icon: L.divIcon({
|
|
251
|
+
html: geoJsonPoint.properties.type_pictogram && `<img src=${geoJsonPoint.properties.type_pictogram} />`,
|
|
252
|
+
className: 'poi-icon',
|
|
253
|
+
iconSize: 48,
|
|
254
|
+
}),
|
|
255
|
+
autoPanOnFocus: false,
|
|
256
|
+
}),
|
|
257
|
+
onEachFeature: (geoJsonPoint, layer) => {
|
|
258
|
+
layer.once('mouseover', () => {
|
|
259
|
+
const poiTooltip = L.DomUtil.create('div');
|
|
260
|
+
poiTooltip.className = 'poi-tooltip';
|
|
261
|
+
const poiName = L.DomUtil.create('div');
|
|
262
|
+
poiName.innerHTML = geoJsonPoint.properties.name;
|
|
263
|
+
poiName.className = 'poi-name';
|
|
264
|
+
poiTooltip.appendChild(poiName);
|
|
265
|
+
layer.bindTooltip(poiTooltip).openTooltip();
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
}).addTo(this.map);
|
|
269
|
+
}
|
|
270
|
+
if (state.currentInformationDesks && state.currentInformationDesks.length > 0) {
|
|
271
|
+
const currentInformationDesksFeatureCollection = {
|
|
272
|
+
type: 'FeatureCollection',
|
|
273
|
+
features: [],
|
|
274
|
+
};
|
|
275
|
+
for (const currentInformationDesk of state.currentInformationDesks) {
|
|
276
|
+
currentInformationDesksFeatureCollection.features.push({
|
|
277
|
+
type: 'Feature',
|
|
278
|
+
properties: { name: currentInformationDesk.name, type_pictogram: currentInformationDesk.type.pictogram },
|
|
279
|
+
geometry: { type: 'Point', coordinates: [Number(currentInformationDesk.longitude), Number(currentInformationDesk.latitude)] },
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
this.currentInformationDesksLayer = L.geoJSON(currentInformationDesksFeatureCollection, {
|
|
283
|
+
pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
|
|
284
|
+
icon: L.divIcon({
|
|
285
|
+
html: geoJsonPoint.properties.type_pictogram && `<img src=${geoJsonPoint.properties.type_pictogram} />`,
|
|
286
|
+
className: 'information-desks-icon',
|
|
287
|
+
iconSize: 48,
|
|
288
|
+
}),
|
|
289
|
+
autoPanOnFocus: false,
|
|
290
|
+
}),
|
|
291
|
+
onEachFeature: (geoJsonPoint, layer) => {
|
|
292
|
+
layer.once('mouseover', () => {
|
|
293
|
+
const informationDesksTooltip = L.DomUtil.create('div');
|
|
294
|
+
informationDesksTooltip.className = 'information-desks-tooltip';
|
|
295
|
+
const informationDesksName = L.DomUtil.create('div');
|
|
296
|
+
informationDesksName.innerHTML = geoJsonPoint.properties.name;
|
|
297
|
+
informationDesksName.className = 'information-desks-name';
|
|
298
|
+
informationDesksTooltip.appendChild(informationDesksName);
|
|
299
|
+
layer.bindTooltip(informationDesksTooltip).openTooltip();
|
|
300
|
+
});
|
|
301
|
+
},
|
|
302
|
+
}).addTo(this.map);
|
|
303
|
+
}
|
|
304
|
+
if (state.currentTrek.points_reference) {
|
|
305
|
+
const currentPointsReferenceFeatureCollection = {
|
|
306
|
+
type: 'FeatureCollection',
|
|
307
|
+
features: [],
|
|
308
|
+
};
|
|
309
|
+
currentPointsReferenceFeatureCollection.features.push({
|
|
310
|
+
type: 'Feature',
|
|
311
|
+
properties: {},
|
|
312
|
+
geometry: state.currentTrek.points_reference,
|
|
313
|
+
});
|
|
314
|
+
let index = 0;
|
|
315
|
+
this.currentPointsReferenceLayer = L.geoJSON(currentPointsReferenceFeatureCollection, {
|
|
316
|
+
pointToLayer: (_geoJsonPoint, latlng) => {
|
|
317
|
+
index += 1;
|
|
318
|
+
return L.marker(latlng, {
|
|
319
|
+
icon: L.divIcon({
|
|
320
|
+
html: index,
|
|
321
|
+
className: 'point-reference-icon',
|
|
322
|
+
iconSize: 24,
|
|
323
|
+
}),
|
|
324
|
+
autoPanOnFocus: false,
|
|
325
|
+
interactive: false,
|
|
326
|
+
});
|
|
327
|
+
},
|
|
328
|
+
}).addTo(this.map);
|
|
329
|
+
}
|
|
132
330
|
!this.mapIsReady && (this.mapIsReady = !this.mapIsReady);
|
|
133
331
|
}
|
|
134
332
|
removeTrek() {
|
|
135
|
-
if (this.
|
|
136
|
-
this.map.removeLayer(this.
|
|
137
|
-
this.
|
|
333
|
+
if (this.currentTrekLayer) {
|
|
334
|
+
this.map.removeLayer(this.currentTrekLayer);
|
|
335
|
+
this.currentTrekLayer = null;
|
|
336
|
+
}
|
|
337
|
+
if (this.currentDepartureArrivalLayer) {
|
|
338
|
+
this.map.removeLayer(this.currentDepartureArrivalLayer);
|
|
339
|
+
this.currentDepartureArrivalLayer = null;
|
|
340
|
+
}
|
|
341
|
+
if (this.currentParkingLayer) {
|
|
342
|
+
this.map.removeLayer(this.currentParkingLayer);
|
|
343
|
+
this.currentParkingLayer = null;
|
|
344
|
+
}
|
|
345
|
+
if (this.currentSensitiveAreasLayer) {
|
|
346
|
+
this.map.removeLayer(this.currentSensitiveAreasLayer);
|
|
347
|
+
this.currentSensitiveAreasLayer = null;
|
|
348
|
+
this.map.removeControl(this.sensitiveAreasControl);
|
|
349
|
+
this.sensitiveAreasControl = null;
|
|
350
|
+
}
|
|
351
|
+
if (this.currentPoisLayer) {
|
|
352
|
+
this.map.removeLayer(this.currentPoisLayer);
|
|
353
|
+
this.currentPoisLayer = null;
|
|
354
|
+
}
|
|
355
|
+
if (this.currentInformationDesksLayer) {
|
|
356
|
+
this.map.removeLayer(this.currentInformationDesksLayer);
|
|
357
|
+
this.currentInformationDesksLayer = null;
|
|
138
358
|
}
|
|
139
|
-
if (this.
|
|
140
|
-
this.map.removeLayer(this.
|
|
141
|
-
this.
|
|
359
|
+
if (this.currentPointsReferenceLayer) {
|
|
360
|
+
this.map.removeLayer(this.currentPointsReferenceLayer);
|
|
361
|
+
this.currentPointsReferenceLayer = null;
|
|
142
362
|
}
|
|
143
363
|
}
|
|
144
364
|
render() {
|
|
@@ -147,6 +367,7 @@ export class GrwMap {
|
|
|
147
367
|
'--color-primary-tint': this.colorPrimaryTint,
|
|
148
368
|
'--color-departure-icon': this.colorDepartureIcon,
|
|
149
369
|
'--color-arrival-icon': this.colorArrivalIcon,
|
|
370
|
+
'--color-poi-icon': this.colorPoiIcon,
|
|
150
371
|
} }, !this.mapIsReady && (h("div", { class: "map-loader-container" },
|
|
151
372
|
h("span", { class: "loader" })))));
|
|
152
373
|
}
|
|
@@ -228,6 +449,42 @@ export class GrwMap {
|
|
|
228
449
|
"reflect": false,
|
|
229
450
|
"defaultValue": "10"
|
|
230
451
|
},
|
|
452
|
+
"colorPrimary": {
|
|
453
|
+
"type": "string",
|
|
454
|
+
"mutable": false,
|
|
455
|
+
"complexType": {
|
|
456
|
+
"original": "string",
|
|
457
|
+
"resolved": "string",
|
|
458
|
+
"references": {}
|
|
459
|
+
},
|
|
460
|
+
"required": false,
|
|
461
|
+
"optional": false,
|
|
462
|
+
"docs": {
|
|
463
|
+
"tags": [],
|
|
464
|
+
"text": ""
|
|
465
|
+
},
|
|
466
|
+
"attribute": "color-primary",
|
|
467
|
+
"reflect": false,
|
|
468
|
+
"defaultValue": "'#6b0030'"
|
|
469
|
+
},
|
|
470
|
+
"colorPrimaryTint": {
|
|
471
|
+
"type": "string",
|
|
472
|
+
"mutable": false,
|
|
473
|
+
"complexType": {
|
|
474
|
+
"original": "string",
|
|
475
|
+
"resolved": "string",
|
|
476
|
+
"references": {}
|
|
477
|
+
},
|
|
478
|
+
"required": false,
|
|
479
|
+
"optional": false,
|
|
480
|
+
"docs": {
|
|
481
|
+
"tags": [],
|
|
482
|
+
"text": ""
|
|
483
|
+
},
|
|
484
|
+
"attribute": "color-primary-tint",
|
|
485
|
+
"reflect": false,
|
|
486
|
+
"defaultValue": "'#974c6e'"
|
|
487
|
+
},
|
|
231
488
|
"colorTrekLine": {
|
|
232
489
|
"type": "string",
|
|
233
490
|
"mutable": false,
|
|
@@ -282,7 +539,7 @@ export class GrwMap {
|
|
|
282
539
|
"reflect": false,
|
|
283
540
|
"defaultValue": "'#85003b'"
|
|
284
541
|
},
|
|
285
|
-
"
|
|
542
|
+
"colorSensitiveArea": {
|
|
286
543
|
"type": "string",
|
|
287
544
|
"mutable": false,
|
|
288
545
|
"complexType": {
|
|
@@ -296,11 +553,11 @@ export class GrwMap {
|
|
|
296
553
|
"tags": [],
|
|
297
554
|
"text": ""
|
|
298
555
|
},
|
|
299
|
-
"attribute": "color-
|
|
556
|
+
"attribute": "color-sensitive-area",
|
|
300
557
|
"reflect": false,
|
|
301
|
-
"defaultValue": "'#
|
|
558
|
+
"defaultValue": "'\t#4974a5'"
|
|
302
559
|
},
|
|
303
|
-
"
|
|
560
|
+
"colorPoiIcon": {
|
|
304
561
|
"type": "string",
|
|
305
562
|
"mutable": false,
|
|
306
563
|
"complexType": {
|
|
@@ -314,13 +571,29 @@ export class GrwMap {
|
|
|
314
571
|
"tags": [],
|
|
315
572
|
"text": ""
|
|
316
573
|
},
|
|
317
|
-
"attribute": "color-
|
|
574
|
+
"attribute": "color-poi-icon",
|
|
318
575
|
"reflect": false,
|
|
319
|
-
"defaultValue": "'#
|
|
576
|
+
"defaultValue": "'#974c6e'"
|
|
320
577
|
}
|
|
321
578
|
}; }
|
|
322
579
|
static get states() { return {
|
|
323
580
|
"mapIsReady": {}
|
|
324
581
|
}; }
|
|
582
|
+
static get events() { return [{
|
|
583
|
+
"method": "trekCardPress",
|
|
584
|
+
"name": "trekCardPress",
|
|
585
|
+
"bubbles": true,
|
|
586
|
+
"cancelable": true,
|
|
587
|
+
"composed": true,
|
|
588
|
+
"docs": {
|
|
589
|
+
"tags": [],
|
|
590
|
+
"text": ""
|
|
591
|
+
},
|
|
592
|
+
"complexType": {
|
|
593
|
+
"original": "number",
|
|
594
|
+
"resolved": "number",
|
|
595
|
+
"references": {}
|
|
596
|
+
}
|
|
597
|
+
}]; }
|
|
325
598
|
static get elementRef() { return "element"; }
|
|
326
599
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
:host a {
|
|
6
|
+
color: var(--color-primary);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.poi-img {
|
|
10
|
+
width: 180px;
|
|
11
|
+
}
|
|
12
|
+
.poi-img img {
|
|
13
|
+
width: 180px;
|
|
14
|
+
border-radius: 8px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.poi-sub-container {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.poi-name {
|
|
23
|
+
color: var(--color-primary);
|
|
24
|
+
font-size: 24px;
|
|
25
|
+
font-weight: bold;
|
|
26
|
+
padding: 12px 0px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.poi-description {
|
|
30
|
+
font-size: 16px;
|
|
31
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Component, Host, h, Prop } from '@stencil/core';
|
|
2
|
+
export class GrwPoiDetail {
|
|
3
|
+
render() {
|
|
4
|
+
return (h(Host, null,
|
|
5
|
+
this.poi.attachments && this.poi.attachments[0] && this.poi.attachments[0].thumbnail && (h("div", { class: "poi-img" },
|
|
6
|
+
h("img", { src: this.poi.attachments[0].thumbnail, loading: "lazy" }))),
|
|
7
|
+
h("div", { class: "poi-sub-container" },
|
|
8
|
+
h("div", { class: "poi-name" }, this.poi.name),
|
|
9
|
+
h("div", { class: "poi-description", innerHTML: this.poi.description }))));
|
|
10
|
+
}
|
|
11
|
+
static get is() { return "grw-poi-detail"; }
|
|
12
|
+
static get encapsulation() { return "shadow"; }
|
|
13
|
+
static get originalStyleUrls() { return {
|
|
14
|
+
"$": ["grw-poi-detail.scss"]
|
|
15
|
+
}; }
|
|
16
|
+
static get styleUrls() { return {
|
|
17
|
+
"$": ["grw-poi-detail.css"]
|
|
18
|
+
}; }
|
|
19
|
+
static get properties() { return {
|
|
20
|
+
"poi": {
|
|
21
|
+
"type": "unknown",
|
|
22
|
+
"mutable": false,
|
|
23
|
+
"complexType": {
|
|
24
|
+
"original": "Poi",
|
|
25
|
+
"resolved": "{ id: number; name: string; description: string; attachments: Attachments; type: any; type_label: any; type_pictogram: any; url: string; published: boolean; geometry: Geometry; }",
|
|
26
|
+
"references": {
|
|
27
|
+
"Poi": {
|
|
28
|
+
"location": "import",
|
|
29
|
+
"path": "types/types"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"required": false,
|
|
34
|
+
"optional": false,
|
|
35
|
+
"docs": {
|
|
36
|
+
"tags": [],
|
|
37
|
+
"text": ""
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}; }
|
|
41
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
:host a {
|
|
6
|
+
color: var(--color-primary);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.sensitive-area-title {
|
|
10
|
+
color: var(--color-primary);
|
|
11
|
+
font-size: 24px;
|
|
12
|
+
padding: 12px 0px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.sensitive-area-description {
|
|
16
|
+
font-size: 16px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sensitive-area-period-container .sensitive-area-period-title,
|
|
20
|
+
.sensitive-area-period-container .sensitive-area-practice-title,
|
|
21
|
+
.sensitive-area-period-container .sensitive-area-contact-title,
|
|
22
|
+
.sensitive-area-practice-container .sensitive-area-period-title,
|
|
23
|
+
.sensitive-area-practice-container .sensitive-area-practice-title,
|
|
24
|
+
.sensitive-area-practice-container .sensitive-area-contact-title,
|
|
25
|
+
.sensitive-area-contact-container .sensitive-area-period-title,
|
|
26
|
+
.sensitive-area-contact-container .sensitive-area-practice-title,
|
|
27
|
+
.sensitive-area-contact-container .sensitive-area-contact-title {
|
|
28
|
+
color: var(--color-primary);
|
|
29
|
+
font-size: 24px;
|
|
30
|
+
padding: 12px 0px;
|
|
31
|
+
}
|
|
32
|
+
.sensitive-area-period-container .sensitive-area-period-values,
|
|
33
|
+
.sensitive-area-period-container .sensitive-area-practice-values,
|
|
34
|
+
.sensitive-area-practice-container .sensitive-area-period-values,
|
|
35
|
+
.sensitive-area-practice-container .sensitive-area-practice-values,
|
|
36
|
+
.sensitive-area-contact-container .sensitive-area-period-values,
|
|
37
|
+
.sensitive-area-contact-container .sensitive-area-practice-values {
|
|
38
|
+
display: flex;
|
|
39
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Component, Host, h, Prop } from '@stencil/core';
|
|
2
|
+
import state from 'store/store';
|
|
3
|
+
export class GrwSensitiveAreaDetail {
|
|
4
|
+
render() {
|
|
5
|
+
return (h(Host, null,
|
|
6
|
+
h("div", { class: "sensitive-area-title" }, this.sensitiveArea.name),
|
|
7
|
+
h("div", { class: "sensitive-area-description", innerHTML: this.sensitiveArea.description }),
|
|
8
|
+
this.sensitiveArea.practices && this.sensitiveArea.practices.length > 0 && (h("div", { class: "sensitive-area-practice-container" },
|
|
9
|
+
h("div", { class: "sensitive-area-practice-title" }, "Domaines d'activit\u00E9s concern\u00E9s :"),
|
|
10
|
+
h("div", { class: "sensitive-area-practice-values" }, this.sensitiveArea.practices.map((practice, index) => (h("div", { innerHTML: `${state.practices.find(statePractice => statePractice.id === practice).name.toUpperCase()}${index + 1 !== this.sensitiveArea.practices.length ? ' - ' : ''}` })))))),
|
|
11
|
+
this.sensitiveArea.period && this.sensitiveArea.period.length > 0 && (h("div", { class: "sensitive-area-period-container" },
|
|
12
|
+
h("div", { class: "sensitive-area-period-title" }, "P\u00E9riodes de sensibilit\u00E9"),
|
|
13
|
+
h("div", { class: "sensitive-area-period-values" }, this.sensitiveArea.period.map((month, index) => {
|
|
14
|
+
if (month) {
|
|
15
|
+
return (h("div", { innerHTML: `${new Date(0, index + 1, 0).toLocaleDateString('fr', { month: 'long' }).toUpperCase()}${this.sensitiveArea.period.slice(index + 1).find(month => month) ? ' - ' : ''}` }));
|
|
16
|
+
}
|
|
17
|
+
})))),
|
|
18
|
+
h("div", { class: "sensitive-area-contact-container" },
|
|
19
|
+
h("div", { class: "sensitive-area-contact-title" }, "Contact"),
|
|
20
|
+
h("div", { innerHTML: this.sensitiveArea.contact, class: "sensitive-area-contact-value" }))));
|
|
21
|
+
}
|
|
22
|
+
static get is() { return "grw-sensitive-area-detail"; }
|
|
23
|
+
static get encapsulation() { return "shadow"; }
|
|
24
|
+
static get originalStyleUrls() { return {
|
|
25
|
+
"$": ["grw-sensitive-area-detail.scss"]
|
|
26
|
+
}; }
|
|
27
|
+
static get styleUrls() { return {
|
|
28
|
+
"$": ["grw-sensitive-area-detail.css"]
|
|
29
|
+
}; }
|
|
30
|
+
static get properties() { return {
|
|
31
|
+
"sensitiveArea": {
|
|
32
|
+
"type": "unknown",
|
|
33
|
+
"mutable": false,
|
|
34
|
+
"complexType": {
|
|
35
|
+
"original": "SensitiveArea",
|
|
36
|
+
"resolved": "{ id: number; geometry: Geometry; name: string; description: string; contact: string; info_url: string; period: boolean[]; practices: number[]; }",
|
|
37
|
+
"references": {
|
|
38
|
+
"SensitiveArea": {
|
|
39
|
+
"location": "import",
|
|
40
|
+
"path": "types/types"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": false,
|
|
45
|
+
"optional": false,
|
|
46
|
+
"docs": {
|
|
47
|
+
"tags": [],
|
|
48
|
+
"text": ""
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}; }
|
|
52
|
+
}
|