@geotrekce/geotrek-rando-widget 0.0.3 → 0.0.6
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 +111 -0
- package/dist/cjs/{grw-app_10.cjs.entry.js → grw-filter_6.cjs.entry.js} +284 -446
- 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-fd04a216.js +211 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/grw-app/grw-app.css +69 -5
- package/dist/collection/components/grw-app/grw-app.js +76 -28
- 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 +5 -4
- package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +1 -1
- package/dist/collection/components/grw-map/grw-map.css +19 -1
- package/dist/collection/components/grw-map/grw-map.js +101 -40
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +5 -4
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +1 -1
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +27 -3
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +17 -3
- package/dist/collection/components/grw-trek-card/grw-trek-card.css +66 -32
- package/dist/collection/components/grw-trek-card/grw-trek-card.js +34 -10
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +134 -4
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +95 -6
- package/dist/collection/components/grw-treks-list/grw-treks-list.css +16 -3
- package/dist/collection/components/grw-treks-list/grw-treks-list.js +33 -6
- package/dist/collection/store/grw-trek-provider.js +32 -10
- package/dist/collection/store/grw-treks-provider.js +14 -4
- package/dist/collection/store/store.js +10 -1
- package/dist/collection/stories/App.js +8 -10
- package/dist/collection/stories/App.stories.js +4 -3
- package/dist/collection/stories/TrekMap.stories.js +3 -2
- package/dist/collection/stories/TreksList.js +8 -8
- package/dist/collection/stories/TreksMap.stories.js +3 -2
- package/dist/components/grw-app.js +66 -9
- 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-detail2.js +2 -2
- package/dist/components/grw-map2.js +102 -41
- package/dist/components/grw-poi-detail2.js +2 -2
- package/dist/components/grw-sensitive-area-detail2.js +7 -2
- package/dist/components/grw-trek-card2.js +10 -5
- package/dist/components/grw-trek-detail2.js +25 -4
- package/dist/components/grw-trek-provider2.js +32 -10
- package/dist/components/grw-treks-list2.js +15 -7
- package/dist/components/grw-treks-provider2.js +14 -4
- package/dist/components/store.js +10 -1
- package/dist/esm/geotrek-rando-widget.js +2 -2
- package/dist/esm/grw-app.entry.js +107 -0
- package/dist/esm/{grw-app_10.entry.js → grw-filter_6.entry.js} +246 -404
- 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-b2c76c0c.js +208 -0
- package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
- package/dist/geotrek-rando-widget/p-1b2ba86d.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-5f17d340.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-6716c635.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-6dce5e6c.js +2 -0
- package/dist/geotrek-rando-widget/p-7715153d.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-e6710c64.js +1 -0
- package/dist/geotrek-rando-widget/p-f3f7d6be.js +1 -0
- package/dist/types/components/grw-app/grw-app.d.ts +9 -2
- package/dist/types/components/grw-filter/grw-filter.d.ts +9 -0
- package/dist/types/components/grw-map/grw-map.d.ts +3 -1
- 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 +9 -4
- package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +1 -0
- package/dist/types/components.d.ts +23 -2
- package/dist/types/store/store.d.ts +22 -3
- package/dist/types/types/types.d.ts +74 -1
- package/package.json +5 -4
- package/readme.md +4 -5
- package/dist/geotrek-rando-widget/p-332ba9ab.js +0 -2
- package/dist/geotrek-rando-widget/p-73bc92fe.entry.js +0 -1
|
@@ -5,19 +5,26 @@ export class GrwTreksList {
|
|
|
5
5
|
this.treksToDisplay = [];
|
|
6
6
|
this.colorPrimary = '#6b0030';
|
|
7
7
|
this.colorPrimaryTint = '#974c6e';
|
|
8
|
+
this.isLargeView = false;
|
|
8
9
|
this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
|
|
9
10
|
this.step = 10;
|
|
10
11
|
}
|
|
11
12
|
componentWillLoad() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.
|
|
13
|
+
onChange('currentTreks', () => {
|
|
14
|
+
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
15
|
+
this.element.scroll({ top: 0 });
|
|
16
|
+
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
17
|
+
});
|
|
18
|
+
onChange('treksWithinBounds', () => {
|
|
19
|
+
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
20
|
+
this.element.scroll({ top: 0 });
|
|
21
|
+
this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
|
|
15
22
|
});
|
|
16
23
|
}
|
|
17
24
|
handleInfiniteScroll(event) {
|
|
18
25
|
if (event.composedPath()[0].scrollTop + event.composedPath()[0].scrollHeight / 2 >= event.composedPath()[0].scrollHeight) {
|
|
19
|
-
if (this.treksToDisplay.length < state.
|
|
20
|
-
this.treksToDisplay = state.
|
|
26
|
+
if (this.treksToDisplay.length < state.treksWithinBounds.length) {
|
|
27
|
+
this.treksToDisplay = state.treksWithinBounds.slice(0, this.treksToDisplay.length + this.step >= state.treksWithinBounds.length ? state.treksWithinBounds.length : this.treksToDisplay.length + this.step);
|
|
21
28
|
}
|
|
22
29
|
else {
|
|
23
30
|
this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
|
|
@@ -25,7 +32,9 @@ export class GrwTreksList {
|
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
render() {
|
|
28
|
-
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } },
|
|
35
|
+
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } },
|
|
36
|
+
h("div", { class: "current-treks-length" }, `${state.treksWithinBounds.length} résultat${state.treksWithinBounds.length > 1 ? 's' : ''}`),
|
|
37
|
+
h("div", { class: "current-treks-container" }, 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 }))))));
|
|
29
38
|
}
|
|
30
39
|
static get is() { return "grw-treks-list"; }
|
|
31
40
|
static get encapsulation() { return "shadow"; }
|
|
@@ -71,6 +80,24 @@ export class GrwTreksList {
|
|
|
71
80
|
"attribute": "color-primary-tint",
|
|
72
81
|
"reflect": false,
|
|
73
82
|
"defaultValue": "'#974c6e'"
|
|
83
|
+
},
|
|
84
|
+
"isLargeView": {
|
|
85
|
+
"type": "boolean",
|
|
86
|
+
"mutable": false,
|
|
87
|
+
"complexType": {
|
|
88
|
+
"original": "boolean",
|
|
89
|
+
"resolved": "boolean",
|
|
90
|
+
"references": {}
|
|
91
|
+
},
|
|
92
|
+
"required": false,
|
|
93
|
+
"optional": false,
|
|
94
|
+
"docs": {
|
|
95
|
+
"tags": [],
|
|
96
|
+
"text": ""
|
|
97
|
+
},
|
|
98
|
+
"attribute": "is-large-view",
|
|
99
|
+
"reflect": false,
|
|
100
|
+
"defaultValue": "false"
|
|
74
101
|
}
|
|
75
102
|
}; }
|
|
76
103
|
static get states() { return {
|
|
@@ -6,21 +6,43 @@ export class GrwTrekProvider {
|
|
|
6
6
|
}
|
|
7
7
|
componentWillLoad() {
|
|
8
8
|
state.api = this.api;
|
|
9
|
+
const requests = [];
|
|
10
|
+
requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
|
|
11
|
+
requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`) : new Response('null'));
|
|
12
|
+
requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`) : new Response('null'));
|
|
13
|
+
requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
|
|
9
14
|
return Promise.all([
|
|
10
|
-
|
|
11
|
-
fetch(`${this.api}
|
|
12
|
-
fetch(`${this.api}
|
|
13
|
-
fetch(`${this.api}
|
|
15
|
+
...requests,
|
|
16
|
+
fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices`).catch(() => new Response('null')),
|
|
17
|
+
fetch(`${this.api}label/?language=${this.language}&fields=id,name,advice,pictogram`),
|
|
18
|
+
fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`),
|
|
19
|
+
fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`),
|
|
20
|
+
fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`),
|
|
14
21
|
fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,type_label,type_pictogram,url,published,geometry&page_size=999`),
|
|
15
22
|
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`),
|
|
16
|
-
fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,route,geometry,gpx,kml,pdf,parking_location`),
|
|
23
|
+
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`),
|
|
17
24
|
])
|
|
18
25
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
19
|
-
.then(([difficulties, routes, practices, sensitiveAreas, pois, informationDesks, trek]) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
|
|
27
|
+
if (difficulties) {
|
|
28
|
+
state.difficulties = difficulties.results;
|
|
29
|
+
}
|
|
30
|
+
if (routes) {
|
|
31
|
+
state.routes = routes.results;
|
|
32
|
+
}
|
|
33
|
+
if (practices) {
|
|
34
|
+
state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
|
|
35
|
+
}
|
|
36
|
+
if (themes) {
|
|
37
|
+
state.themes = themes.results;
|
|
38
|
+
}
|
|
39
|
+
if (sensitiveAreas) {
|
|
40
|
+
state.currentSensitiveAreas = sensitiveAreas.results;
|
|
41
|
+
}
|
|
42
|
+
state.labels = labels.results;
|
|
43
|
+
state.sources = sources.results;
|
|
44
|
+
state.accessibilities = accessibilities.results;
|
|
45
|
+
state.accessibilitiesLevel = accessibilitiesLevel.results;
|
|
24
46
|
state.currentPois = pois.results;
|
|
25
47
|
state.currentInformationDesks = informationDesks.results;
|
|
26
48
|
state.currentTrek = trek;
|
|
@@ -6,7 +6,7 @@ export class GrwTreksProvider {
|
|
|
6
6
|
}
|
|
7
7
|
componentWillLoad() {
|
|
8
8
|
state.api = this.api;
|
|
9
|
-
let treksRequest = `${this.api}trek/?language=${this.language}`;
|
|
9
|
+
let treksRequest = `${this.api}trek/?language=${this.language}&published=true`;
|
|
10
10
|
this.inBbox && (treksRequest += `&in_bbox=${this.inBbox}`);
|
|
11
11
|
this.cities && (treksRequest += `&cities=${this.cities}`);
|
|
12
12
|
this.districts && (treksRequest += `&districts=${this.districts}`);
|
|
@@ -15,19 +15,29 @@ export class GrwTreksProvider {
|
|
|
15
15
|
this.portals && (treksRequest += `&portals=${this.portals}`);
|
|
16
16
|
this.routes && (treksRequest += `&routes=${this.routes}`);
|
|
17
17
|
this.practices && (treksRequest += `&practices=${this.practices}`);
|
|
18
|
-
treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,route,departure_geom&page_size=999`;
|
|
18
|
+
treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,departure,departure_geom&page_size=999`;
|
|
19
19
|
return Promise.all([
|
|
20
20
|
fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
|
|
21
21
|
fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
|
|
22
22
|
fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
|
|
23
|
+
fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`),
|
|
23
24
|
fetch(treksRequest),
|
|
24
25
|
])
|
|
25
26
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
26
|
-
.then(([difficulties, routes, practices, treks]) => {
|
|
27
|
+
.then(([difficulties, routes, practices, themes, treks]) => {
|
|
27
28
|
state.difficulties = difficulties.results;
|
|
28
29
|
state.routes = routes.results;
|
|
29
|
-
state.practices = practices.results;
|
|
30
|
+
state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
|
|
31
|
+
state.themes = themes.results;
|
|
32
|
+
state.durations = [
|
|
33
|
+
{ id: 1, name: '0 - 1h', minValue: 0, maxValue: 1, selected: false },
|
|
34
|
+
{ id: 2, name: '1 - 2h', minValue: 1, maxValue: 2, selected: false },
|
|
35
|
+
{ id: 3, name: '2 - 5h', minValue: 2, maxValue: 5, selected: false },
|
|
36
|
+
{ id: 4, name: '5 - 10h', minValue: 5, maxValue: 10, selected: false },
|
|
37
|
+
];
|
|
30
38
|
state.treks = treks.results;
|
|
39
|
+
state.currentTreks = treks.results;
|
|
40
|
+
state.treksWithinBounds = treks.results;
|
|
31
41
|
});
|
|
32
42
|
}
|
|
33
43
|
render() {
|
|
@@ -2,12 +2,21 @@ import { createStore } from '@stencil/store';
|
|
|
2
2
|
const { state, onChange } = createStore({
|
|
3
3
|
api: '',
|
|
4
4
|
treks: [],
|
|
5
|
+
currentTreks: [],
|
|
6
|
+
treksWithinBounds: [],
|
|
7
|
+
currentMapTreksBounds: null,
|
|
5
8
|
difficulties: [],
|
|
6
9
|
routes: [],
|
|
7
10
|
practices: [],
|
|
11
|
+
themes: [],
|
|
12
|
+
durations: [],
|
|
8
13
|
currentSensitiveAreas: null,
|
|
9
|
-
|
|
14
|
+
labels: null,
|
|
15
|
+
sources: null,
|
|
16
|
+
accessibilities: null,
|
|
17
|
+
accessibilitiesLevel: null,
|
|
10
18
|
currentTrek: null,
|
|
19
|
+
currentPois: null,
|
|
11
20
|
currentInformationDesks: null,
|
|
12
21
|
});
|
|
13
22
|
export { onChange };
|
|
@@ -9,7 +9,6 @@ export const createApp = ({
|
|
|
9
9
|
portals,
|
|
10
10
|
routes,
|
|
11
11
|
practices,
|
|
12
|
-
appName,
|
|
13
12
|
urlLayer,
|
|
14
13
|
attribution,
|
|
15
14
|
colorPrimary,
|
|
@@ -24,15 +23,14 @@ export const createApp = ({
|
|
|
24
23
|
const app = document.createElement('grw-app');
|
|
25
24
|
app.setAttribute('api', api);
|
|
26
25
|
app.setAttribute('language', language);
|
|
27
|
-
app.setAttribute('in-bbox', inBbox);
|
|
28
|
-
app.setAttribute('cities', cities);
|
|
29
|
-
app.setAttribute('districts', districts);
|
|
30
|
-
app.setAttribute('structures', structures);
|
|
31
|
-
app.setAttribute('themes', themes);
|
|
32
|
-
app.setAttribute('portals', portals);
|
|
33
|
-
app.setAttribute('routes', routes);
|
|
34
|
-
app.setAttribute('practices', practices);
|
|
35
|
-
app.setAttribute('app-name', appName);
|
|
26
|
+
inBbox && app.setAttribute('in-bbox', inBbox);
|
|
27
|
+
cities && app.setAttribute('cities', cities);
|
|
28
|
+
districts && app.setAttribute('districts', districts);
|
|
29
|
+
structures && app.setAttribute('structures', structures);
|
|
30
|
+
themes && app.setAttribute('themes', themes);
|
|
31
|
+
portals && app.setAttribute('portals', portals);
|
|
32
|
+
routes && app.setAttribute('routes', routes);
|
|
33
|
+
practices && app.setAttribute('practices', practices);
|
|
36
34
|
app.setAttribute('url-layer', urlLayer);
|
|
37
35
|
app.setAttribute('attribution', attribution);
|
|
38
36
|
app.setAttribute('color-primary', colorPrimary);
|
|
@@ -5,9 +5,11 @@ export default {
|
|
|
5
5
|
argTypes: {
|
|
6
6
|
urlLayer: {
|
|
7
7
|
control: 'select',
|
|
8
|
-
options: ['openstreetmap'],
|
|
8
|
+
options: ['openstreetmap', 'planignv2'],
|
|
9
9
|
mapping: {
|
|
10
10
|
openstreetmap: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
11
|
+
planignv2:
|
|
12
|
+
'https://wxs.ign.fr/cartes/geoportail/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
|
|
11
13
|
},
|
|
12
14
|
},
|
|
13
15
|
},
|
|
@@ -30,9 +32,8 @@ App.args = {
|
|
|
30
32
|
portals: '',
|
|
31
33
|
routes: '',
|
|
32
34
|
practices: '',
|
|
33
|
-
appName: 'Geotrek Rando Widget',
|
|
34
35
|
urlLayer: 'openstreetmap',
|
|
35
|
-
attribution: '© OpenStreetMap',
|
|
36
|
+
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors',
|
|
36
37
|
colorPrimary: '#6b0030',
|
|
37
38
|
colorPrimaryShade: '4a0021',
|
|
38
39
|
colorPrimaryTint: '#974c6e',
|
|
@@ -5,9 +5,10 @@ export default {
|
|
|
5
5
|
argTypes: {
|
|
6
6
|
urlLayer: {
|
|
7
7
|
control: 'select',
|
|
8
|
-
options: ['openstreetmap'],
|
|
8
|
+
options: ['openstreetmap', 'planignv2'],
|
|
9
9
|
mapping: {
|
|
10
10
|
openstreetmap: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
11
|
+
planignv2: 'https://wxs.ign.fr/cartes/geoportail/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
|
|
11
12
|
},
|
|
12
13
|
},
|
|
13
14
|
},
|
|
@@ -25,7 +26,7 @@ TrekMap.args = {
|
|
|
25
26
|
urlLayer: 'openstreetmap',
|
|
26
27
|
center: '46.50761080179829, 5.927117067721017',
|
|
27
28
|
zoom: 8,
|
|
28
|
-
attribution: '© OpenStreetMap',
|
|
29
|
+
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors',
|
|
29
30
|
colorTrekLine: '#6b0030',
|
|
30
31
|
colorDepartureIcon: '#006b3b',
|
|
31
32
|
colorArrivalIcon: '#85003b',
|
|
@@ -3,14 +3,14 @@ export const createTreksList = ({ api, language, inBbox, cities, districts, stru
|
|
|
3
3
|
const treks = document.createElement('grw-treks-provider');
|
|
4
4
|
treks.setAttribute('api', api);
|
|
5
5
|
treks.setAttribute('language', language);
|
|
6
|
-
treks.setAttribute('in-bbox', inBbox);
|
|
7
|
-
treks.setAttribute('cities', cities);
|
|
8
|
-
treks.setAttribute('districts', districts);
|
|
9
|
-
treks.setAttribute('structures', structures);
|
|
10
|
-
treks.setAttribute('themes', themes);
|
|
11
|
-
treks.setAttribute('portals', portals);
|
|
12
|
-
treks.setAttribute('routes', routes);
|
|
13
|
-
treks.setAttribute('practices', practices);
|
|
6
|
+
inBbox && treks.setAttribute('in-bbox', inBbox);
|
|
7
|
+
cities && treks.setAttribute('cities', cities);
|
|
8
|
+
districts && treks.setAttribute('districts', districts);
|
|
9
|
+
structures && treks.setAttribute('structures', structures);
|
|
10
|
+
themes && treks.setAttribute('themes', themes);
|
|
11
|
+
portals && treks.setAttribute('portals', portals);
|
|
12
|
+
routes && treks.setAttribute('routes', routes);
|
|
13
|
+
practices && treks.setAttribute('practices', practices);
|
|
14
14
|
container.appendChild(treks);
|
|
15
15
|
const list = document.createElement('grw-treks-list');
|
|
16
16
|
list.setAttribute('color-primary', colorPrimary);
|
|
@@ -5,9 +5,10 @@ export default {
|
|
|
5
5
|
argTypes: {
|
|
6
6
|
urlLayer: {
|
|
7
7
|
control: 'select',
|
|
8
|
-
options: ['openstreetmap'],
|
|
8
|
+
options: ['openstreetmap', 'planignv2'],
|
|
9
9
|
mapping: {
|
|
10
10
|
openstreetmap: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
11
|
+
planignv2: 'https://wxs.ign.fr/cartes/geoportail/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
|
|
11
12
|
},
|
|
12
13
|
},
|
|
13
14
|
},
|
|
@@ -24,7 +25,7 @@ TreksMap.args = {
|
|
|
24
25
|
urlLayer: 'openstreetmap',
|
|
25
26
|
center: '46.50761080179829, 5.927117067721017',
|
|
26
27
|
zoom: 8,
|
|
27
|
-
attribution: '© OpenStreetMap',
|
|
28
|
+
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors',
|
|
28
29
|
colorPrimary: '#6b0030',
|
|
29
30
|
colorPrimaryTint: '#974c6e',
|
|
30
31
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { s as state } from './store.js';
|
|
3
|
+
import { d as defineCustomElement$b } from './grw-filter2.js';
|
|
3
4
|
import { d as defineCustomElement$a } from './grw-information-desk-detail2.js';
|
|
4
5
|
import { d as defineCustomElement$9 } from './grw-map2.js';
|
|
5
6
|
import { d as defineCustomElement$8 } from './grw-poi-detail2.js';
|
|
@@ -12,7 +13,7 @@ import { d as defineCustomElement$2 } from './grw-treks-provider2.js';
|
|
|
12
13
|
|
|
13
14
|
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>`;
|
|
14
15
|
|
|
15
|
-
const grwAppCss = ".app-container{position:relative;height:100%;max-height:100vh;font-family:\"Roboto\"}.header-container,.large-view-header-container{display:flex;align-items:center;background-color:var(--color-primary);height:64px}.header-container .
|
|
16
|
+
const grwAppCss = ".app-container{position:relative;height:100%;max-height:100vh;font-family:\"Roboto\"}.header-container,.large-view-header-container{display:flex;align-items:center;background-color:var(--color-primary);height:64px}.header-container .arrow-back-icon,.large-view-header-container .arrow-back-icon{width:48px;height:auto;margin-left:24px}.header-container .arrow-back-icon svg,.large-view-header-container .arrow-back-icon svg{cursor:pointer;width:48px;height:auto}.header-container .handle-filters-button,.large-view-header-container .handle-filters-button{user-select:none;cursor:pointer;color:var(--color-primary);background-color:#ffffff;margin-left:36px;border-radius:8px;padding:8px}.header-container .attribution-container,.large-view-header-container .attribution-container{position:absolute;right:24px}.header-container .attribution-container a,.large-view-header-container .attribution-container a{color:#ffffff;text-decoration:none}.options-container{height:calc(100% - 64px);position:absolute;width:100%;z-index:1100;top:64px}.filters-container{position:absolute;width:100%;background-color:#ffffff;padding:36px 0px;z-index:1100}.filters-container .close-filters-button{cursor:pointer;font-weight:bold;position:absolute;top:12px;right:12px;padding:12px;border-radius:12px;color:var(--color-primary);border:1px var(--color-primary) solid}.filters-container .close-filters-button:hover{background-color:var(--color-primary);color:#ffffff}.filters-container .filter-margin-top{margin-top:24px}.filters-container .current-treks-length{margin:0px 0px 32px 8px;color:var(--color-primary);font-size:24px;font-weight:bold}.back-filters-container{background-color:rgba(0, 0, 0, 0.5);width:100%;height:calc(100% - 64px);position:absolute;z-index:1099;top:64px}.loader-container,.large-view-loader-container{display:flex;justify-content:center;align-items:center;height:100%}.loader-container .loader,.large-view-loader-container .loader{width:48px;height:48px;border:5px solid var(--color-primary-tint);border-bottom-color:var(--color-primary);border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.content-container{position:relative;display:flex;height:calc(100% - 64px)}.app-treks-list-container,.app-trek-detail-container,.large-view-app-treks-list-container,.large-view-app-trek-detail-container{height:100%}.app-map-container,.large-view-app-map-container{width:100%;height:100%}.map-visibility-button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:absolute;bottom:24px;width:100%;z-index:400;user-select:none}.map-visibility-button div{background-color:var(--color-primary);color:#ffffff;padding:12px;border-radius:24px;width:120px;text-align:center}.header-container .title{font-size:24px}.loader-container{position:absolute;width:100%}.app-treks-list-container,.app-trek-detail-container{width:100%}.app-map-container{position:relative;width:100%;position:absolute}.large-view-header-container .title{font-size:32px}.large-view-loader-container{position:relative;width:50%}.large-view-app-treks-list-container,.large-view-app-trek-detail-container{width:50%}.large-view-app-map-container{position:relative;width:50%}";
|
|
16
17
|
|
|
17
18
|
const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
18
19
|
constructor() {
|
|
@@ -20,10 +21,11 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
20
21
|
this.__registerHost();
|
|
21
22
|
this.__attachShadow();
|
|
22
23
|
this.showTrek = false;
|
|
23
|
-
this.
|
|
24
|
+
this.showTreksMap = false;
|
|
25
|
+
this.showTrekMap = false;
|
|
26
|
+
this.showFilters = false;
|
|
24
27
|
this.isLargeView = false;
|
|
25
28
|
this.language = 'fr';
|
|
26
|
-
this.appName = 'Geotrek Rando Widget';
|
|
27
29
|
this.colorPrimary = '#6b0030';
|
|
28
30
|
this.colorPrimaryShade = '#4a0021';
|
|
29
31
|
this.colorPrimaryTint = '#974c6e';
|
|
@@ -32,11 +34,15 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
32
34
|
this.colorArrivalIcon = '#85003b';
|
|
33
35
|
this.colorSensitiveArea = '#4974a5';
|
|
34
36
|
this.colorPoiIcon = '#974c6e';
|
|
35
|
-
this.
|
|
37
|
+
this.handlePopStateBind = this.handlePopState.bind(this);
|
|
38
|
+
this.largeViewSize = 1024;
|
|
36
39
|
}
|
|
37
40
|
onTrekCardPress(event) {
|
|
38
41
|
this.currentTrekId = event.detail;
|
|
39
42
|
this.showTrek = !this.showTrek;
|
|
43
|
+
const url = new URL(window.location.toString());
|
|
44
|
+
url.searchParams.set('trek', this.currentTrekId.toString());
|
|
45
|
+
window.history.pushState({}, '', url);
|
|
40
46
|
}
|
|
41
47
|
onWindowResize() {
|
|
42
48
|
this.handleView();
|
|
@@ -46,6 +52,14 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
46
52
|
}
|
|
47
53
|
componentDidLoad() {
|
|
48
54
|
this.handleView();
|
|
55
|
+
window.addEventListener('popstate', this.handlePopStateBind, false);
|
|
56
|
+
const url = new URL(window.location.toString());
|
|
57
|
+
const trekParam = url.searchParams.get('trek');
|
|
58
|
+
if (trekParam) {
|
|
59
|
+
window.history.replaceState({ isInitialHistoryWithTrek: true }, '', url);
|
|
60
|
+
this.currentTrekId = Number(trekParam);
|
|
61
|
+
this.showTrek = !this.showTrek;
|
|
62
|
+
}
|
|
49
63
|
}
|
|
50
64
|
onTrekDetailsClose() {
|
|
51
65
|
this.currentTrekId = null;
|
|
@@ -53,10 +67,47 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
53
67
|
}
|
|
54
68
|
handleView() {
|
|
55
69
|
this.isLargeView = this.element.getBoundingClientRect().width >= this.largeViewSize;
|
|
56
|
-
this.
|
|
70
|
+
this.showTreksMap = this.isLargeView;
|
|
71
|
+
this.showTrekMap = this.isLargeView;
|
|
72
|
+
}
|
|
73
|
+
handleFilters() {
|
|
74
|
+
this.showFilters = !this.showFilters;
|
|
75
|
+
}
|
|
76
|
+
handleBackButton() {
|
|
77
|
+
if (window.history.state.isInitialHistoryWithTrek) {
|
|
78
|
+
this.onTrekDetailsClose();
|
|
79
|
+
const url = new URL(window.location.toString());
|
|
80
|
+
url.searchParams.delete('trek');
|
|
81
|
+
window.history.pushState({}, '', url);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
window.history.back();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
handlePopState() {
|
|
88
|
+
const url = new URL(window.location.toString());
|
|
89
|
+
const trekParam = url.searchParams.get('trek');
|
|
90
|
+
if (trekParam) {
|
|
91
|
+
this.currentTrekId = Number(trekParam);
|
|
92
|
+
this.showTrek = !this.showTrek;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.onTrekDetailsClose();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
handleShowMap() {
|
|
99
|
+
if (this.currentTrekId) {
|
|
100
|
+
this.showTrekMap = !this.showTrekMap;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.showTreksMap = !this.showTreksMap;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
disconnectedCallback() {
|
|
107
|
+
window.removeEventListener('popstate', this.handlePopStateBind);
|
|
57
108
|
}
|
|
58
109
|
render() {
|
|
59
|
-
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, h("grw-treks-provider", { api: this.api, language: this.language, "in-bbox": this.inBbox, cities: this.cities, districts: this.districts, structures: this.structures, themes: this.themes, portals: this.portals, routes: this.routes, practices: this.practices }), this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }), h("div", { class: "app-container" }, h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? h("div", { onClick: () => this.
|
|
110
|
+
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } }, h("grw-treks-provider", { api: this.api, language: this.language, "in-bbox": this.inBbox, cities: this.cities, districts: this.districts, structures: this.structures, themes: this.themes, portals: this.portals, routes: this.routes, practices: this.practices }), this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }), h("div", { class: "app-container" }, h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? (h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")), !this.showTrek && this.showFilters && (h("div", { class: "options-container" }, h("div", { class: "filters-container" }, h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`), h("div", { onClick: () => this.handleFilters(), class: "close-filters-button" }, "X"), h("div", null, h("grw-filter", { filterName: "Pratique", filterType: "practices", filterNameProperty: "name" })), h("div", { class: "filter-margin-top" }, h("grw-filter", { filterName: "Difficult\u00E9", filterType: "difficulties", filterNameProperty: "label" })), h("div", { class: "filter-margin-top" }, h("grw-filter", { filterName: "Dur\u00E9e", filterType: "durations", filterNameProperty: "name" }))), h("div", { onClick: () => this.handleFilters(), class: "back-filters-container" }))), h("div", { class: "attribution-container" }, h("a", { target: "_blank", href: "https://geotrek.fr" }, "GEOTREK"))), h("div", { class: "content-container" }, h("div", { class: this.isLargeView ? 'large-view-app-treks-list-container' : 'app-treks-list-container', style: { display: this.showTrek ? 'none' : 'flex', position: this.showTrek ? 'absolute' : 'relative' } }, h("grw-treks-list", { "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, h("span", { class: "loader" }))), state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' }, h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))), h("grw-map", { class: this.isLargeView ? 'large-view-app-map-container' : 'app-map-container', style: { visibility: (this.showTreksMap && !this.showTrek) || (this.showTrekMap && this.showTrek) ? 'visible' : 'hidden' }, "url-layer": this.urlLayer, center: this.center, zoom: this.zoom, attribution: this.attribution, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint, "color-trek-line": this.colorTrekLine, "color-departure-icon": this.colorDepartureIcon, "color-arrival-icon": this.colorArrivalIcon, "color-sensitive-area": this.colorSensitiveArea, "color-poi-icon": this.colorPoiIcon })), h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } }, h("div", { onClick: () => this.handleShowMap() }, this.showTreksMap || this.showTrekMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
|
|
60
111
|
}
|
|
61
112
|
get element() { return this; }
|
|
62
113
|
static get watchers() { return {
|
|
@@ -74,7 +125,6 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
74
125
|
"portals": [1],
|
|
75
126
|
"routes": [1],
|
|
76
127
|
"practices": [1],
|
|
77
|
-
"appName": [1, "app-name"],
|
|
78
128
|
"urlLayer": [1, "url-layer"],
|
|
79
129
|
"center": [1],
|
|
80
130
|
"zoom": [8],
|
|
@@ -88,7 +138,9 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
88
138
|
"colorSensitiveArea": [1, "color-sensitive-area"],
|
|
89
139
|
"colorPoiIcon": [1, "color-poi-icon"],
|
|
90
140
|
"showTrek": [32],
|
|
91
|
-
"
|
|
141
|
+
"showTreksMap": [32],
|
|
142
|
+
"showTrekMap": [32],
|
|
143
|
+
"showFilters": [32],
|
|
92
144
|
"isLargeView": [32],
|
|
93
145
|
"currentTrekId": [32]
|
|
94
146
|
}, [[0, "trekCardPress", "onTrekCardPress"], [9, "resize", "onWindowResize"]]]);
|
|
@@ -96,13 +148,18 @@ function defineCustomElement$1() {
|
|
|
96
148
|
if (typeof customElements === "undefined") {
|
|
97
149
|
return;
|
|
98
150
|
}
|
|
99
|
-
const components = ["grw-app", "grw-information-desk-detail", "grw-map", "grw-poi-detail", "grw-sensitive-area-detail", "grw-trek-card", "grw-trek-detail", "grw-trek-provider", "grw-treks-list", "grw-treks-provider"];
|
|
151
|
+
const components = ["grw-app", "grw-filter", "grw-information-desk-detail", "grw-map", "grw-poi-detail", "grw-sensitive-area-detail", "grw-trek-card", "grw-trek-detail", "grw-trek-provider", "grw-treks-list", "grw-treks-provider"];
|
|
100
152
|
components.forEach(tagName => { switch (tagName) {
|
|
101
153
|
case "grw-app":
|
|
102
154
|
if (!customElements.get(tagName)) {
|
|
103
155
|
customElements.define(tagName, GrwApp$1);
|
|
104
156
|
}
|
|
105
157
|
break;
|
|
158
|
+
case "grw-filter":
|
|
159
|
+
if (!customElements.get(tagName)) {
|
|
160
|
+
defineCustomElement$b();
|
|
161
|
+
}
|
|
162
|
+
break;
|
|
106
163
|
case "grw-information-desk-detail":
|
|
107
164
|
if (!customElements.get(tagName)) {
|
|
108
165
|
defineCustomElement$a();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface GrwFilter extends Components.GrwFilter, HTMLElement {}
|
|
4
|
+
export const GrwFilter: {
|
|
5
|
+
prototype: GrwFilter;
|
|
6
|
+
new (): GrwFilter;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { s as state } from './store.js';
|
|
3
|
+
|
|
4
|
+
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)}";
|
|
5
|
+
|
|
6
|
+
const GrwFilter = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.filters = [
|
|
12
|
+
{ property: 'practices', trekProperty: 'practice', type: 'include' },
|
|
13
|
+
{ property: 'difficulties', trekProperty: 'difficulty', type: 'include' },
|
|
14
|
+
{ property: 'durations', trekProperty: 'duration', type: 'interval' },
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
handleFilter(_event, filterToHandle) {
|
|
18
|
+
const filterFromState = [...state[this.filterType]];
|
|
19
|
+
filterFromState.find(currentFilter => currentFilter.id === filterToHandle.id).selected = !filterFromState.find(currentFilter => currentFilter.id === filterToHandle.id)
|
|
20
|
+
.selected;
|
|
21
|
+
state[this.filterType] = filterFromState;
|
|
22
|
+
let isUsingFilter = false;
|
|
23
|
+
let filtersTreks = [];
|
|
24
|
+
for (const filter of this.filters) {
|
|
25
|
+
const currentFiltersId = state[filter.property].filter(currentFilter => currentFilter.selected).map(currentFilter => currentFilter.id);
|
|
26
|
+
if (currentFiltersId.length > 0) {
|
|
27
|
+
if (filtersTreks.length > 0) {
|
|
28
|
+
if (filter.type === 'include') {
|
|
29
|
+
filtersTreks = [...filtersTreks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
|
|
30
|
+
}
|
|
31
|
+
else if (filter.type === 'interval') {
|
|
32
|
+
let minValue;
|
|
33
|
+
let maxValue;
|
|
34
|
+
for (const currentFilterId of currentFiltersId) {
|
|
35
|
+
const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
|
|
36
|
+
if (isNaN(minValue) || currentFilter.minValue < minValue) {
|
|
37
|
+
minValue = currentFilter.minValue;
|
|
38
|
+
}
|
|
39
|
+
if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
|
|
40
|
+
maxValue = currentFilter.maxValue;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
filtersTreks = [...filtersTreks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
if (!isUsingFilter) {
|
|
48
|
+
isUsingFilter = true;
|
|
49
|
+
}
|
|
50
|
+
if (filter.type === 'include') {
|
|
51
|
+
filtersTreks = [...state.treks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
|
|
52
|
+
}
|
|
53
|
+
else if (filter.type === 'interval') {
|
|
54
|
+
let minValue;
|
|
55
|
+
let maxValue;
|
|
56
|
+
for (const currentFilterId of currentFiltersId) {
|
|
57
|
+
const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
|
|
58
|
+
if (isNaN(minValue) || currentFilter.minValue < minValue) {
|
|
59
|
+
minValue = currentFilter.minValue;
|
|
60
|
+
}
|
|
61
|
+
if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
|
|
62
|
+
maxValue = currentFilter.maxValue;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
filtersTreks = [...state.treks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
state.currentTreks = isUsingFilter ? filtersTreks : state.treks;
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
return (h(Host, null, h("div", { class: "filter-name" }, this.filterName), h("div", { class: "filter-button-container" }, state[this.filterType].map(currentFilter => (h("div", { onClick: event => this.handleFilter(event, currentFilter), class: currentFilter.selected ? 'selected-filter-button' : 'filter-button' }, currentFilter[this.filterNameProperty]))))));
|
|
74
|
+
}
|
|
75
|
+
static get style() { return grwFilterCss; }
|
|
76
|
+
}, [1, "grw-filter", {
|
|
77
|
+
"filterType": [1, "filter-type"],
|
|
78
|
+
"filterName": [1, "filter-name"],
|
|
79
|
+
"filterNameProperty": [1, "filter-name-property"]
|
|
80
|
+
}]);
|
|
81
|
+
function defineCustomElement() {
|
|
82
|
+
if (typeof customElements === "undefined") {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const components = ["grw-filter"];
|
|
86
|
+
components.forEach(tagName => { switch (tagName) {
|
|
87
|
+
case "grw-filter":
|
|
88
|
+
if (!customElements.get(tagName)) {
|
|
89
|
+
customElements.define(tagName, GrwFilter);
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
} });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { GrwFilter as G, defineCustomElement as d };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const grwInformationDeskDetailCss = ":host{display:flex;flex-direction:column
|
|
3
|
+
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}";
|
|
4
4
|
|
|
5
5
|
const GrwInformationDeskDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
@@ -9,7 +9,7 @@ const GrwInformationDeskDetail = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
9
9
|
this.__attachShadow();
|
|
10
10
|
}
|
|
11
11
|
render() {
|
|
12
|
-
return (h(Host, null, this.informationDesk.photo_url && (h("div", { class: "information-desk-img" }, h("img", { src: this.informationDesk.photo_url, loading: "lazy" }))), h("div", { class: "information-desk-
|
|
12
|
+
return (h(Host, null, this.informationDesk.photo_url && (h("div", { class: "information-desk-img" }, h("img", { src: this.informationDesk.photo_url, loading: "lazy" }))), h("div", { class: "information-desk-sub-container" }, this.informationDesk.name && h("div", { class: "information-desk-name" }, this.informationDesk.name), this.informationDesk.description && h("div", { class: "information-desk-description", innerHTML: this.informationDesk.description }), this.informationDesk.postal_code ||
|
|
13
13
|
this.informationDesk.municipality ||
|
|
14
14
|
(this.informationDesk.street && (h("div", null, this.informationDesk.postal_code, ` ${this.informationDesk.municipality}`, ` ${this.informationDesk.street}`))), this.informationDesk.phone && (h("div", null, h("a", { href: `tel:${this.informationDesk.phone}` }, this.informationDesk.phone))), this.informationDesk.email && (h("div", null, h("a", { href: `mailto:${this.informationDesk.email}` }, this.informationDesk.email))), this.informationDesk.website && (h("div", null, h("a", { href: `${this.informationDesk.website}` }, this.informationDesk.website))))));
|
|
15
15
|
}
|