@geotrekce/geotrek-rando-widget 0.0.8 → 0.0.11
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/grw-app.cjs.entry.js +1 -1
- package/dist/cjs/grw-filter_6.cjs.entry.js +35 -11
- package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +1 -1
- package/dist/cjs/grw-trek-card.cjs.entry.js +1 -1
- package/dist/cjs/{store-b4c3c507.js → store-4d75c7a8.js} +1 -0
- package/dist/collection/components/grw-map/grw-map.js +10 -5
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +1 -1
- package/dist/collection/components/grw-treks-list/grw-treks-list.js +18 -3
- package/dist/collection/store/grw-trek-provider.js +6 -2
- package/dist/collection/store/store.js +1 -0
- package/dist/components/grw-map2.js +10 -5
- package/dist/components/grw-trek-provider2.js +6 -2
- package/dist/components/grw-treks-list2.js +18 -3
- package/dist/components/store.js +1 -0
- package/dist/esm/grw-app.entry.js +1 -1
- package/dist/esm/grw-filter_6.entry.js +35 -11
- package/dist/esm/grw-information-desk-detail_3.entry.js +1 -1
- package/dist/esm/grw-trek-card.entry.js +1 -1
- package/dist/esm/{store-a5f523fd.js → store-ab2dacd4.js} +1 -0
- package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
- package/dist/geotrek-rando-widget/{p-94f0db4d.entry.js → p-7694955c.entry.js} +1 -1
- package/dist/geotrek-rando-widget/{p-9a25f817.entry.js → p-84bb45be.entry.js} +1 -1
- package/dist/geotrek-rando-widget/{p-500436f1.entry.js → p-973a44cb.entry.js} +1 -1
- package/dist/geotrek-rando-widget/{p-0510e16b.entry.js → p-ee0db5c4.entry.js} +1 -1
- package/dist/geotrek-rando-widget/{p-22562f4d.js → p-fb36dda2.js} +1 -1
- package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +2 -0
- package/dist/types/store/store.d.ts +3 -1
- package/dist/types/types/types.d.ts +6 -5
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-4c76daa3.js');
|
|
6
|
-
const store = require('./store-
|
|
6
|
+
const store = require('./store-4d75c7a8.js');
|
|
7
7
|
|
|
8
8
|
const arrowBackImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><polyline points="244 400 100 256 244 112" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/><line x1="120" y1="256" x2="412" y2="256" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/></svg>`;
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-4c76daa3.js');
|
|
6
|
-
const store = require('./store-
|
|
6
|
+
const store = require('./store-4d75c7a8.js');
|
|
7
7
|
const length = require('./length-d315d156.js');
|
|
8
8
|
|
|
9
9
|
const grwFilterCss = ".filter-name{margin-left:8px;color:var(--color-primary);font-size:24px;font-weight:bold}.filter-button-container{display:flex;flex-direction:row;flex-wrap:wrap}.filter-button-container .filter-button,.filter-button-container .selected-filter-button{user-select:none;cursor:pointer;border:1px var(--color-primary) solid;border-radius:8px;margin:8px 0px 0px 8px;padding:8px}.filter-button-container .filter-button{color:var(--color-primary);background-color:#ffffff}.filter-button-container .selected-filter-button{color:#ffffff;background-color:var(--color-primary)}";
|
|
@@ -14254,9 +14254,11 @@ const GrwMap = class {
|
|
|
14254
14254
|
}
|
|
14255
14255
|
store.onChange('currentTreks', () => {
|
|
14256
14256
|
if (store.state.currentTrek) {
|
|
14257
|
+
this.removeTreks();
|
|
14257
14258
|
this.addTrek();
|
|
14258
14259
|
}
|
|
14259
14260
|
else if (store.state.currentTreks) {
|
|
14261
|
+
this.removeTrek();
|
|
14260
14262
|
this.addTreks();
|
|
14261
14263
|
}
|
|
14262
14264
|
});
|
|
@@ -14266,8 +14268,8 @@ const GrwMap = class {
|
|
|
14266
14268
|
this.addTrek();
|
|
14267
14269
|
}
|
|
14268
14270
|
else {
|
|
14269
|
-
this.addTreks();
|
|
14270
14271
|
this.removeTrek();
|
|
14272
|
+
this.addTreks();
|
|
14271
14273
|
}
|
|
14272
14274
|
});
|
|
14273
14275
|
}
|
|
@@ -14355,9 +14357,12 @@ const GrwMap = class {
|
|
|
14355
14357
|
}
|
|
14356
14358
|
}
|
|
14357
14359
|
handleTreksWithinBounds() {
|
|
14358
|
-
store.state.
|
|
14360
|
+
if (!store.state.currentMapTreksBounds || store.state.currentMapTreksBounds.toBBoxString() !== this.map.getBounds().toBBoxString()) {
|
|
14361
|
+
store.state.treksWithinBounds = store.state.currentTreks.filter(trek => this.map.getBounds().contains(leafletSrc.latLng(trek.departure_geom[1], trek.departure_geom[0])));
|
|
14362
|
+
}
|
|
14359
14363
|
}
|
|
14360
14364
|
addTrek() {
|
|
14365
|
+
var _a;
|
|
14361
14366
|
const currentTrekFeature = {
|
|
14362
14367
|
type: 'Feature',
|
|
14363
14368
|
geometry: store.state.currentTrek.geometry,
|
|
@@ -14480,14 +14485,14 @@ const GrwMap = class {
|
|
|
14480
14485
|
for (const currentPoi of store.state.currentPois) {
|
|
14481
14486
|
currentPoisFeatureCollection.features.push({
|
|
14482
14487
|
type: 'Feature',
|
|
14483
|
-
properties: { name: currentPoi.name, type_pictogram: currentPoi.
|
|
14488
|
+
properties: { name: currentPoi.name, type_pictogram: (_a = store.state.poiTypes.find(poiType => poiType.id === currentPoi.type)) === null || _a === void 0 ? void 0 : _a.pictogram },
|
|
14484
14489
|
geometry: currentPoi.geometry,
|
|
14485
14490
|
});
|
|
14486
14491
|
}
|
|
14487
14492
|
this.currentPoisLayer = leafletSrc.geoJSON(currentPoisFeatureCollection, {
|
|
14488
14493
|
pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
|
|
14489
14494
|
icon: leafletSrc.divIcon({
|
|
14490
|
-
html: geoJsonPoint.properties.type_pictogram
|
|
14495
|
+
html: geoJsonPoint.properties.type_pictogram ? `<img src=${geoJsonPoint.properties.type_pictogram} />` : `<img />`,
|
|
14491
14496
|
className: 'poi-icon',
|
|
14492
14497
|
iconSize: 48,
|
|
14493
14498
|
}),
|
|
@@ -14521,7 +14526,7 @@ const GrwMap = class {
|
|
|
14521
14526
|
this.currentInformationDesksLayer = leafletSrc.geoJSON(currentInformationDesksFeatureCollection, {
|
|
14522
14527
|
pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
|
|
14523
14528
|
icon: leafletSrc.divIcon({
|
|
14524
|
-
html: geoJsonPoint.properties.type_pictogram
|
|
14529
|
+
html: geoJsonPoint.properties.type_pictogram ? `<img src=${geoJsonPoint.properties.type_pictogram} />` : `<img />`,
|
|
14525
14530
|
className: 'information-desks-icon',
|
|
14526
14531
|
iconSize: 48,
|
|
14527
14532
|
}),
|
|
@@ -14696,12 +14701,15 @@ const GrwTrekProvider = class {
|
|
|
14696
14701
|
fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`, { signal: this.signal }),
|
|
14697
14702
|
fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
|
|
14698
14703
|
fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`, { signal: this.signal }).catch(() => new Response('null')),
|
|
14699
|
-
fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,
|
|
14704
|
+
fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,geometry&page_size=999`, {
|
|
14705
|
+
signal: this.signal,
|
|
14706
|
+
}),
|
|
14707
|
+
fetch(`${this.api}poi_type/?language=${this.language}&fields=id,pictogram`, { signal: this.signal }),
|
|
14700
14708
|
fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`, { signal: this.signal }),
|
|
14701
14709
|
fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,geometry,gpx,kml,pdf,parking_location,departure,arrival,altimetric_profile,ambiance,access,public_transport,advice,advised_parking,gear,labels,source,points_reference,disabled_infrastructure,accessibility_level,accessibility_slope,accessibility_width,accessibility_signage,accessibility_covering,accessibility_exposure,accessibility_advice,accessibilities`, { signal: this.signal }),
|
|
14702
14710
|
])
|
|
14703
14711
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
14704
|
-
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
|
|
14712
|
+
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, poiTypes, informationDesks, trek]) => {
|
|
14705
14713
|
store.state.trekNetworkError = false;
|
|
14706
14714
|
if (difficulties) {
|
|
14707
14715
|
store.state.difficulties = difficulties.results;
|
|
@@ -14725,6 +14733,7 @@ const GrwTrekProvider = class {
|
|
|
14725
14733
|
store.state.accessibilitiesLevel = accessibilitiesLevel.results;
|
|
14726
14734
|
}
|
|
14727
14735
|
store.state.currentPois = pois.results;
|
|
14736
|
+
store.state.poiTypes = poiTypes.results;
|
|
14728
14737
|
store.state.currentInformationDesks = informationDesks.results;
|
|
14729
14738
|
store.state.currentTrek = trek;
|
|
14730
14739
|
})
|
|
@@ -14753,19 +14762,22 @@ const GrwTreksList = class {
|
|
|
14753
14762
|
this.isLargeView = false;
|
|
14754
14763
|
this.step = 10;
|
|
14755
14764
|
this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
|
|
14765
|
+
this.shouldAddInfiniteScrollEvent = true;
|
|
14756
14766
|
}
|
|
14757
14767
|
connectedCallback() {
|
|
14758
|
-
this.
|
|
14768
|
+
this.handleInfiniteScrollEvent(true);
|
|
14759
14769
|
if (store.state.currentTreks) {
|
|
14760
14770
|
this.treksToDisplay = [...store.state.currentTreks.slice(0, this.step)];
|
|
14761
14771
|
}
|
|
14762
14772
|
store.onChange('currentTreks', () => {
|
|
14773
|
+
this.handleInfiniteScrollEvent(true);
|
|
14763
14774
|
this.element.scroll({ top: 0 });
|
|
14764
14775
|
if (store.state.currentTreks) {
|
|
14765
14776
|
this.treksToDisplay = [...store.state.currentTreks.slice(0, this.step)];
|
|
14766
14777
|
}
|
|
14767
14778
|
});
|
|
14768
14779
|
store.onChange('treksWithinBounds', () => {
|
|
14780
|
+
this.handleInfiniteScrollEvent(true);
|
|
14769
14781
|
this.element.scroll({ top: 0 });
|
|
14770
14782
|
if (store.state.treksWithinBounds) {
|
|
14771
14783
|
this.treksToDisplay = [...store.state.treksWithinBounds.slice(0, this.step)];
|
|
@@ -14778,12 +14790,24 @@ const GrwTreksList = class {
|
|
|
14778
14790
|
this.treksToDisplay = store.state.treksWithinBounds.slice(0, this.treksToDisplay.length + this.step >= store.state.treksWithinBounds.length ? store.state.treksWithinBounds.length : this.treksToDisplay.length + this.step);
|
|
14779
14791
|
}
|
|
14780
14792
|
else {
|
|
14781
|
-
this.
|
|
14793
|
+
this.handleInfiniteScrollEvent(false);
|
|
14794
|
+
}
|
|
14795
|
+
}
|
|
14796
|
+
}
|
|
14797
|
+
handleInfiniteScrollEvent(shouldAddInfiniteScrollEvent) {
|
|
14798
|
+
if (shouldAddInfiniteScrollEvent) {
|
|
14799
|
+
if (this.shouldAddInfiniteScrollEvent) {
|
|
14800
|
+
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
14801
|
+
this.shouldAddInfiniteScrollEvent = !shouldAddInfiniteScrollEvent;
|
|
14782
14802
|
}
|
|
14783
14803
|
}
|
|
14804
|
+
else {
|
|
14805
|
+
this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
|
|
14806
|
+
this.shouldAddInfiniteScrollEvent = !shouldAddInfiniteScrollEvent;
|
|
14807
|
+
}
|
|
14784
14808
|
}
|
|
14785
14809
|
disconnectedCallback() {
|
|
14786
|
-
this.
|
|
14810
|
+
this.handleInfiniteScrollEvent(false);
|
|
14787
14811
|
}
|
|
14788
14812
|
render() {
|
|
14789
14813
|
return (index.h(index.Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.treksToDisplay.map(trek => (index.h("grw-trek-card", { key: `trek-${trek.id}`, trek: trek, "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })))));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-4c76daa3.js');
|
|
6
|
-
const store = require('./store-
|
|
6
|
+
const store = require('./store-4d75c7a8.js');
|
|
7
7
|
|
|
8
8
|
const grwInformationDeskDetailCss = ":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.information-desk-img{width:180px}.information-desk-img img{width:180px;border-radius:8px}.information-desk-sub-container{display:flex;flex-direction:column}.information-desk-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.information-desk-description{font-size:16px}";
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-4c76daa3.js');
|
|
6
|
-
const store = require('./store-
|
|
6
|
+
const store = require('./store-4d75c7a8.js');
|
|
7
7
|
const length = require('./length-d315d156.js');
|
|
8
8
|
|
|
9
9
|
const grwTrekCardCss = ".trek-card-container,.trek-card-large-view-container{font-family:\"Roboto\";border-radius:8px;box-shadow:4px 8px 24px rgba(0, 0, 0, 0.25);cursor:pointer}.trek-card-container .image,.trek-card-large-view-container .image{object-fit:cover}.trek-card-container .sub-container,.trek-card-large-view-container .sub-container{display:flex;flex-direction:column;justify-content:center;padding:12px}.trek-card-container .sub-container .name,.trek-card-large-view-container .sub-container .name{color:var(--color-primary);font-size:24px;font-weight:bold;margin-bottom:8px}.trek-card-container .sub-container .departure,.trek-card-large-view-container .sub-container .departure{color:rgba(0, 0, 0, 0.7);font-size:16px;margin:4px 0px}.trek-card-container .sub-container .themes-container,.trek-card-large-view-container .sub-container .themes-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-card-container .sub-container .themes-container .theme,.trek-card-large-view-container .sub-container .themes-container .theme{background-color:var(--color-primary-tint);color:#ffffff;border-radius:8px;padding:8px;margin:0px 8px 8px 0px}.trek-card-container .sub-container .icons-labels-container,.trek-card-large-view-container .sub-container .icons-labels-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-card-container .sub-container .icons-labels-container .row,.trek-card-large-view-container .sub-container .icons-labels-container .row{display:flex;justify-content:space-between;align-items:center;width:100%}.trek-card-container .sub-container .icons-labels-container .row:not(:last-child),.trek-card-large-view-container .sub-container .icons-labels-container .row:not(:last-child){margin-bottom:12px}.trek-card-container .sub-container .icons-labels-container .row .icon-label,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label{display:flex;align-items:center;width:50%}.trek-card-container .sub-container .icons-labels-container .row .icon-label:nth-child(2),.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label:nth-child(2){margin:0px 4px}.trek-card-container .sub-container .icons-labels-container .row .icon-label img,.trek-card-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label img,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg{width:24px;height:auto;margin-right:8px}.trek-card-container .sub-container .icons-labels-container .row .practice img,.trek-card-large-view-container .sub-container .icons-labels-container .row .practice img{background-color:var(--color-primary)}.trek-card-container{width:350px;height:auto}.trek-card-container .image{width:100%}.trek-card-large-view-container{height:auto;display:flex;flex-direction:row}.trek-card-large-view-container .image{width:250px}";
|
|
@@ -34,9 +34,11 @@ export class GrwMap {
|
|
|
34
34
|
}
|
|
35
35
|
onChange('currentTreks', () => {
|
|
36
36
|
if (state.currentTrek) {
|
|
37
|
+
this.removeTreks();
|
|
37
38
|
this.addTrek();
|
|
38
39
|
}
|
|
39
40
|
else if (state.currentTreks) {
|
|
41
|
+
this.removeTrek();
|
|
40
42
|
this.addTreks();
|
|
41
43
|
}
|
|
42
44
|
});
|
|
@@ -46,8 +48,8 @@ export class GrwMap {
|
|
|
46
48
|
this.addTrek();
|
|
47
49
|
}
|
|
48
50
|
else {
|
|
49
|
-
this.addTreks();
|
|
50
51
|
this.removeTrek();
|
|
52
|
+
this.addTreks();
|
|
51
53
|
}
|
|
52
54
|
});
|
|
53
55
|
}
|
|
@@ -135,9 +137,12 @@ export class GrwMap {
|
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
handleTreksWithinBounds() {
|
|
138
|
-
state.
|
|
140
|
+
if (!state.currentMapTreksBounds || state.currentMapTreksBounds.toBBoxString() !== this.map.getBounds().toBBoxString()) {
|
|
141
|
+
state.treksWithinBounds = state.currentTreks.filter(trek => this.map.getBounds().contains(L.latLng(trek.departure_geom[1], trek.departure_geom[0])));
|
|
142
|
+
}
|
|
139
143
|
}
|
|
140
144
|
addTrek() {
|
|
145
|
+
var _a;
|
|
141
146
|
const currentTrekFeature = {
|
|
142
147
|
type: 'Feature',
|
|
143
148
|
geometry: state.currentTrek.geometry,
|
|
@@ -260,14 +265,14 @@ export class GrwMap {
|
|
|
260
265
|
for (const currentPoi of state.currentPois) {
|
|
261
266
|
currentPoisFeatureCollection.features.push({
|
|
262
267
|
type: 'Feature',
|
|
263
|
-
properties: { name: currentPoi.name, type_pictogram: currentPoi.
|
|
268
|
+
properties: { name: currentPoi.name, type_pictogram: (_a = state.poiTypes.find(poiType => poiType.id === currentPoi.type)) === null || _a === void 0 ? void 0 : _a.pictogram },
|
|
264
269
|
geometry: currentPoi.geometry,
|
|
265
270
|
});
|
|
266
271
|
}
|
|
267
272
|
this.currentPoisLayer = L.geoJSON(currentPoisFeatureCollection, {
|
|
268
273
|
pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
|
|
269
274
|
icon: L.divIcon({
|
|
270
|
-
html: geoJsonPoint.properties.type_pictogram
|
|
275
|
+
html: geoJsonPoint.properties.type_pictogram ? `<img src=${geoJsonPoint.properties.type_pictogram} />` : `<img />`,
|
|
271
276
|
className: 'poi-icon',
|
|
272
277
|
iconSize: 48,
|
|
273
278
|
}),
|
|
@@ -301,7 +306,7 @@ export class GrwMap {
|
|
|
301
306
|
this.currentInformationDesksLayer = L.geoJSON(currentInformationDesksFeatureCollection, {
|
|
302
307
|
pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
|
|
303
308
|
icon: L.divIcon({
|
|
304
|
-
html: geoJsonPoint.properties.type_pictogram
|
|
309
|
+
html: geoJsonPoint.properties.type_pictogram ? `<img src=${geoJsonPoint.properties.type_pictogram} />` : `<img />`,
|
|
305
310
|
className: 'information-desks-icon',
|
|
306
311
|
iconSize: 48,
|
|
307
312
|
}),
|
|
@@ -22,7 +22,7 @@ export class GrwPoiDetail {
|
|
|
22
22
|
"mutable": false,
|
|
23
23
|
"complexType": {
|
|
24
24
|
"original": "Poi",
|
|
25
|
-
"resolved": "{ id: number; name: string; description: string; attachments: Attachments; type:
|
|
25
|
+
"resolved": "{ id: number; name: string; description: string; attachments: Attachments; type: number; geometry: Geometry; }",
|
|
26
26
|
"references": {
|
|
27
27
|
"Poi": {
|
|
28
28
|
"location": "import",
|
|
@@ -8,19 +8,22 @@ export class GrwTreksList {
|
|
|
8
8
|
this.isLargeView = false;
|
|
9
9
|
this.step = 10;
|
|
10
10
|
this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
|
|
11
|
+
this.shouldAddInfiniteScrollEvent = true;
|
|
11
12
|
}
|
|
12
13
|
connectedCallback() {
|
|
13
|
-
this.
|
|
14
|
+
this.handleInfiniteScrollEvent(true);
|
|
14
15
|
if (state.currentTreks) {
|
|
15
16
|
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
16
17
|
}
|
|
17
18
|
onChange('currentTreks', () => {
|
|
19
|
+
this.handleInfiniteScrollEvent(true);
|
|
18
20
|
this.element.scroll({ top: 0 });
|
|
19
21
|
if (state.currentTreks) {
|
|
20
22
|
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
21
23
|
}
|
|
22
24
|
});
|
|
23
25
|
onChange('treksWithinBounds', () => {
|
|
26
|
+
this.handleInfiniteScrollEvent(true);
|
|
24
27
|
this.element.scroll({ top: 0 });
|
|
25
28
|
if (state.treksWithinBounds) {
|
|
26
29
|
this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
|
|
@@ -33,12 +36,24 @@ export class GrwTreksList {
|
|
|
33
36
|
this.treksToDisplay = state.treksWithinBounds.slice(0, this.treksToDisplay.length + this.step >= state.treksWithinBounds.length ? state.treksWithinBounds.length : this.treksToDisplay.length + this.step);
|
|
34
37
|
}
|
|
35
38
|
else {
|
|
36
|
-
this.
|
|
39
|
+
this.handleInfiniteScrollEvent(false);
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
}
|
|
43
|
+
handleInfiniteScrollEvent(shouldAddInfiniteScrollEvent) {
|
|
44
|
+
if (shouldAddInfiniteScrollEvent) {
|
|
45
|
+
if (this.shouldAddInfiniteScrollEvent) {
|
|
46
|
+
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
47
|
+
this.shouldAddInfiniteScrollEvent = !shouldAddInfiniteScrollEvent;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
|
|
52
|
+
this.shouldAddInfiniteScrollEvent = !shouldAddInfiniteScrollEvent;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
40
55
|
disconnectedCallback() {
|
|
41
|
-
this.
|
|
56
|
+
this.handleInfiniteScrollEvent(false);
|
|
42
57
|
}
|
|
43
58
|
render() {
|
|
44
59
|
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.treksToDisplay.map(trek => (h("grw-trek-card", { key: `trek-${trek.id}`, trek: trek, "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })))));
|
|
@@ -23,12 +23,15 @@ export class GrwTrekProvider {
|
|
|
23
23
|
fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`, { signal: this.signal }),
|
|
24
24
|
fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
|
|
25
25
|
fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`, { signal: this.signal }).catch(() => new Response('null')),
|
|
26
|
-
fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,
|
|
26
|
+
fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,geometry&page_size=999`, {
|
|
27
|
+
signal: this.signal,
|
|
28
|
+
}),
|
|
29
|
+
fetch(`${this.api}poi_type/?language=${this.language}&fields=id,pictogram`, { signal: this.signal }),
|
|
27
30
|
fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`, { signal: this.signal }),
|
|
28
31
|
fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,geometry,gpx,kml,pdf,parking_location,departure,arrival,altimetric_profile,ambiance,access,public_transport,advice,advised_parking,gear,labels,source,points_reference,disabled_infrastructure,accessibility_level,accessibility_slope,accessibility_width,accessibility_signage,accessibility_covering,accessibility_exposure,accessibility_advice,accessibilities`, { signal: this.signal }),
|
|
29
32
|
])
|
|
30
33
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
31
|
-
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
|
|
34
|
+
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, poiTypes, informationDesks, trek]) => {
|
|
32
35
|
state.trekNetworkError = false;
|
|
33
36
|
if (difficulties) {
|
|
34
37
|
state.difficulties = difficulties.results;
|
|
@@ -52,6 +55,7 @@ export class GrwTrekProvider {
|
|
|
52
55
|
state.accessibilitiesLevel = accessibilitiesLevel.results;
|
|
53
56
|
}
|
|
54
57
|
state.currentPois = pois.results;
|
|
58
|
+
state.poiTypes = poiTypes.results;
|
|
55
59
|
state.currentInformationDesks = informationDesks.results;
|
|
56
60
|
state.currentTrek = trek;
|
|
57
61
|
})
|
|
@@ -14179,9 +14179,11 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14179
14179
|
}
|
|
14180
14180
|
onChange('currentTreks', () => {
|
|
14181
14181
|
if (state.currentTrek) {
|
|
14182
|
+
this.removeTreks();
|
|
14182
14183
|
this.addTrek();
|
|
14183
14184
|
}
|
|
14184
14185
|
else if (state.currentTreks) {
|
|
14186
|
+
this.removeTrek();
|
|
14185
14187
|
this.addTreks();
|
|
14186
14188
|
}
|
|
14187
14189
|
});
|
|
@@ -14191,8 +14193,8 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14191
14193
|
this.addTrek();
|
|
14192
14194
|
}
|
|
14193
14195
|
else {
|
|
14194
|
-
this.addTreks();
|
|
14195
14196
|
this.removeTrek();
|
|
14197
|
+
this.addTreks();
|
|
14196
14198
|
}
|
|
14197
14199
|
});
|
|
14198
14200
|
}
|
|
@@ -14280,9 +14282,12 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14280
14282
|
}
|
|
14281
14283
|
}
|
|
14282
14284
|
handleTreksWithinBounds() {
|
|
14283
|
-
state.
|
|
14285
|
+
if (!state.currentMapTreksBounds || state.currentMapTreksBounds.toBBoxString() !== this.map.getBounds().toBBoxString()) {
|
|
14286
|
+
state.treksWithinBounds = state.currentTreks.filter(trek => this.map.getBounds().contains(leafletSrc.latLng(trek.departure_geom[1], trek.departure_geom[0])));
|
|
14287
|
+
}
|
|
14284
14288
|
}
|
|
14285
14289
|
addTrek() {
|
|
14290
|
+
var _a;
|
|
14286
14291
|
const currentTrekFeature = {
|
|
14287
14292
|
type: 'Feature',
|
|
14288
14293
|
geometry: state.currentTrek.geometry,
|
|
@@ -14405,14 +14410,14 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14405
14410
|
for (const currentPoi of state.currentPois) {
|
|
14406
14411
|
currentPoisFeatureCollection.features.push({
|
|
14407
14412
|
type: 'Feature',
|
|
14408
|
-
properties: { name: currentPoi.name, type_pictogram: currentPoi.
|
|
14413
|
+
properties: { name: currentPoi.name, type_pictogram: (_a = state.poiTypes.find(poiType => poiType.id === currentPoi.type)) === null || _a === void 0 ? void 0 : _a.pictogram },
|
|
14409
14414
|
geometry: currentPoi.geometry,
|
|
14410
14415
|
});
|
|
14411
14416
|
}
|
|
14412
14417
|
this.currentPoisLayer = leafletSrc.geoJSON(currentPoisFeatureCollection, {
|
|
14413
14418
|
pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
|
|
14414
14419
|
icon: leafletSrc.divIcon({
|
|
14415
|
-
html: geoJsonPoint.properties.type_pictogram
|
|
14420
|
+
html: geoJsonPoint.properties.type_pictogram ? `<img src=${geoJsonPoint.properties.type_pictogram} />` : `<img />`,
|
|
14416
14421
|
className: 'poi-icon',
|
|
14417
14422
|
iconSize: 48,
|
|
14418
14423
|
}),
|
|
@@ -14446,7 +14451,7 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14446
14451
|
this.currentInformationDesksLayer = leafletSrc.geoJSON(currentInformationDesksFeatureCollection, {
|
|
14447
14452
|
pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
|
|
14448
14453
|
icon: leafletSrc.divIcon({
|
|
14449
|
-
html: geoJsonPoint.properties.type_pictogram
|
|
14454
|
+
html: geoJsonPoint.properties.type_pictogram ? `<img src=${geoJsonPoint.properties.type_pictogram} />` : `<img />`,
|
|
14450
14455
|
className: 'information-desks-icon',
|
|
14451
14456
|
iconSize: 48,
|
|
14452
14457
|
}),
|
|
@@ -27,12 +27,15 @@ const GrwTrekProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
27
27
|
fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`, { signal: this.signal }),
|
|
28
28
|
fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
|
|
29
29
|
fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`, { signal: this.signal }).catch(() => new Response('null')),
|
|
30
|
-
fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,
|
|
30
|
+
fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,geometry&page_size=999`, {
|
|
31
|
+
signal: this.signal,
|
|
32
|
+
}),
|
|
33
|
+
fetch(`${this.api}poi_type/?language=${this.language}&fields=id,pictogram`, { signal: this.signal }),
|
|
31
34
|
fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`, { signal: this.signal }),
|
|
32
35
|
fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,geometry,gpx,kml,pdf,parking_location,departure,arrival,altimetric_profile,ambiance,access,public_transport,advice,advised_parking,gear,labels,source,points_reference,disabled_infrastructure,accessibility_level,accessibility_slope,accessibility_width,accessibility_signage,accessibility_covering,accessibility_exposure,accessibility_advice,accessibilities`, { signal: this.signal }),
|
|
33
36
|
])
|
|
34
37
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
35
|
-
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
|
|
38
|
+
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, poiTypes, informationDesks, trek]) => {
|
|
36
39
|
state.trekNetworkError = false;
|
|
37
40
|
if (difficulties) {
|
|
38
41
|
state.difficulties = difficulties.results;
|
|
@@ -56,6 +59,7 @@ const GrwTrekProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
56
59
|
state.accessibilitiesLevel = accessibilitiesLevel.results;
|
|
57
60
|
}
|
|
58
61
|
state.currentPois = pois.results;
|
|
62
|
+
state.poiTypes = poiTypes.results;
|
|
59
63
|
state.currentInformationDesks = informationDesks.results;
|
|
60
64
|
state.currentTrek = trek;
|
|
61
65
|
})
|
|
@@ -15,19 +15,22 @@ const GrwTreksList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
15
15
|
this.isLargeView = false;
|
|
16
16
|
this.step = 10;
|
|
17
17
|
this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
|
|
18
|
+
this.shouldAddInfiniteScrollEvent = true;
|
|
18
19
|
}
|
|
19
20
|
connectedCallback() {
|
|
20
|
-
this.
|
|
21
|
+
this.handleInfiniteScrollEvent(true);
|
|
21
22
|
if (state.currentTreks) {
|
|
22
23
|
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
23
24
|
}
|
|
24
25
|
onChange('currentTreks', () => {
|
|
26
|
+
this.handleInfiniteScrollEvent(true);
|
|
25
27
|
this.element.scroll({ top: 0 });
|
|
26
28
|
if (state.currentTreks) {
|
|
27
29
|
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
28
30
|
}
|
|
29
31
|
});
|
|
30
32
|
onChange('treksWithinBounds', () => {
|
|
33
|
+
this.handleInfiniteScrollEvent(true);
|
|
31
34
|
this.element.scroll({ top: 0 });
|
|
32
35
|
if (state.treksWithinBounds) {
|
|
33
36
|
this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
|
|
@@ -40,12 +43,24 @@ const GrwTreksList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
40
43
|
this.treksToDisplay = state.treksWithinBounds.slice(0, this.treksToDisplay.length + this.step >= state.treksWithinBounds.length ? state.treksWithinBounds.length : this.treksToDisplay.length + this.step);
|
|
41
44
|
}
|
|
42
45
|
else {
|
|
43
|
-
this.
|
|
46
|
+
this.handleInfiniteScrollEvent(false);
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
}
|
|
50
|
+
handleInfiniteScrollEvent(shouldAddInfiniteScrollEvent) {
|
|
51
|
+
if (shouldAddInfiniteScrollEvent) {
|
|
52
|
+
if (this.shouldAddInfiniteScrollEvent) {
|
|
53
|
+
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
54
|
+
this.shouldAddInfiniteScrollEvent = !shouldAddInfiniteScrollEvent;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
|
|
59
|
+
this.shouldAddInfiniteScrollEvent = !shouldAddInfiniteScrollEvent;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
47
62
|
disconnectedCallback() {
|
|
48
|
-
this.
|
|
63
|
+
this.handleInfiniteScrollEvent(false);
|
|
49
64
|
}
|
|
50
65
|
render() {
|
|
51
66
|
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.treksToDisplay.map(trek => (h("grw-trek-card", { key: `trek-${trek.id}`, trek: trek, "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })))));
|
package/dist/components/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement } from './index-ee473772.js';
|
|
2
|
-
import { o as onChange, s as state } from './store-
|
|
2
|
+
import { o as onChange, s as state } from './store-ab2dacd4.js';
|
|
3
3
|
|
|
4
4
|
const arrowBackImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><polyline points="244 400 100 256 244 112" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/><line x1="120" y1="256" x2="412" y2="256" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/></svg>`;
|
|
5
5
|
|