@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,6 +1,10 @@
|
|
|
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$
|
|
3
|
+
import { d as defineCustomElement$b } from './grw-filter2.js';
|
|
4
|
+
import { d as defineCustomElement$a } from './grw-information-desk-detail2.js';
|
|
5
|
+
import { d as defineCustomElement$9 } from './grw-map2.js';
|
|
6
|
+
import { d as defineCustomElement$8 } from './grw-poi-detail2.js';
|
|
7
|
+
import { d as defineCustomElement$7 } from './grw-sensitive-area-detail2.js';
|
|
4
8
|
import { d as defineCustomElement$6 } from './grw-trek-card2.js';
|
|
5
9
|
import { d as defineCustomElement$5 } from './grw-trek-detail2.js';
|
|
6
10
|
import { d as defineCustomElement$4 } from './grw-trek-provider2.js';
|
|
@@ -9,7 +13,7 @@ import { d as defineCustomElement$2 } from './grw-treks-provider2.js';
|
|
|
9
13
|
|
|
10
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>`;
|
|
11
15
|
|
|
12
|
-
const grwAppCss = ".app-container{position:relative;height:100%;max-height:100vh}.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%}";
|
|
13
17
|
|
|
14
18
|
const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
15
19
|
constructor() {
|
|
@@ -17,19 +21,28 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
17
21
|
this.__registerHost();
|
|
18
22
|
this.__attachShadow();
|
|
19
23
|
this.showTrek = false;
|
|
20
|
-
this.
|
|
24
|
+
this.showTreksMap = false;
|
|
25
|
+
this.showTrekMap = false;
|
|
26
|
+
this.showFilters = false;
|
|
21
27
|
this.isLargeView = false;
|
|
22
|
-
this.
|
|
28
|
+
this.language = 'fr';
|
|
23
29
|
this.colorPrimary = '#6b0030';
|
|
24
|
-
this.
|
|
30
|
+
this.colorPrimaryShade = '#4a0021';
|
|
31
|
+
this.colorPrimaryTint = '#974c6e';
|
|
25
32
|
this.colorTrekLine = '#6b0030';
|
|
26
33
|
this.colorDepartureIcon = '#006b3b';
|
|
27
34
|
this.colorArrivalIcon = '#85003b';
|
|
28
|
-
this.
|
|
35
|
+
this.colorSensitiveArea = '#4974a5';
|
|
36
|
+
this.colorPoiIcon = '#974c6e';
|
|
37
|
+
this.handlePopStateBind = this.handlePopState.bind(this);
|
|
38
|
+
this.largeViewSize = 1024;
|
|
29
39
|
}
|
|
30
40
|
onTrekCardPress(event) {
|
|
31
41
|
this.currentTrekId = event.detail;
|
|
32
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);
|
|
33
46
|
}
|
|
34
47
|
onWindowResize() {
|
|
35
48
|
this.handleView();
|
|
@@ -39,17 +52,44 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
39
52
|
}
|
|
40
53
|
componentDidLoad() {
|
|
41
54
|
this.handleView();
|
|
55
|
+
window.addEventListener('popstate', this.handlePopStateBind, false);
|
|
42
56
|
}
|
|
43
57
|
onTrekDetailsClose() {
|
|
58
|
+
this.forwardTrekId = this.currentTrekId;
|
|
44
59
|
this.currentTrekId = null;
|
|
45
60
|
this.showTrek = !this.showTrek;
|
|
46
61
|
}
|
|
47
62
|
handleView() {
|
|
48
63
|
this.isLargeView = this.element.getBoundingClientRect().width >= this.largeViewSize;
|
|
49
|
-
this.
|
|
64
|
+
this.showTreksMap = this.isLargeView;
|
|
65
|
+
this.showTrekMap = this.isLargeView;
|
|
66
|
+
}
|
|
67
|
+
handleFilters() {
|
|
68
|
+
this.showFilters = !this.showFilters;
|
|
69
|
+
}
|
|
70
|
+
handlePopState() {
|
|
71
|
+
if (this.showTrek) {
|
|
72
|
+
this.onTrekDetailsClose();
|
|
73
|
+
}
|
|
74
|
+
else if (this.forwardTrekId) {
|
|
75
|
+
this.currentTrekId = this.forwardTrekId;
|
|
76
|
+
this.forwardTrekId = null;
|
|
77
|
+
this.showTrek = !this.showTrek;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
handleShowMap() {
|
|
81
|
+
if (this.currentTrekId) {
|
|
82
|
+
this.showTrekMap = !this.showTrekMap;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.showTreksMap = !this.showTreksMap;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
disconnectedCallback() {
|
|
89
|
+
window.removeEventListener('popstate', this.handlePopStateBind);
|
|
50
90
|
}
|
|
51
91
|
render() {
|
|
52
|
-
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, h("grw-treks-provider", { api: this.api, "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, "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: () =>
|
|
92
|
+
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: () => window.history.back(), 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')))));
|
|
53
93
|
}
|
|
54
94
|
get element() { return this; }
|
|
55
95
|
static get watchers() { return {
|
|
@@ -58,6 +98,7 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
58
98
|
static get style() { return grwAppCss; }
|
|
59
99
|
}, [1, "grw-app", {
|
|
60
100
|
"api": [1],
|
|
101
|
+
"language": [1],
|
|
61
102
|
"inBbox": [1, "in-bbox"],
|
|
62
103
|
"cities": [1],
|
|
63
104
|
"districts": [1],
|
|
@@ -66,18 +107,22 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
66
107
|
"portals": [1],
|
|
67
108
|
"routes": [1],
|
|
68
109
|
"practices": [1],
|
|
69
|
-
"appName": [1, "app-name"],
|
|
70
110
|
"urlLayer": [1, "url-layer"],
|
|
71
111
|
"center": [1],
|
|
72
112
|
"zoom": [8],
|
|
73
113
|
"attribution": [1],
|
|
74
114
|
"colorPrimary": [1, "color-primary"],
|
|
115
|
+
"colorPrimaryShade": [1, "color-primary-shade"],
|
|
75
116
|
"colorPrimaryTint": [1, "color-primary-tint"],
|
|
76
117
|
"colorTrekLine": [1, "color-trek-line"],
|
|
77
118
|
"colorDepartureIcon": [1, "color-departure-icon"],
|
|
78
119
|
"colorArrivalIcon": [1, "color-arrival-icon"],
|
|
120
|
+
"colorSensitiveArea": [1, "color-sensitive-area"],
|
|
121
|
+
"colorPoiIcon": [1, "color-poi-icon"],
|
|
79
122
|
"showTrek": [32],
|
|
80
|
-
"
|
|
123
|
+
"showTreksMap": [32],
|
|
124
|
+
"showTrekMap": [32],
|
|
125
|
+
"showFilters": [32],
|
|
81
126
|
"isLargeView": [32],
|
|
82
127
|
"currentTrekId": [32]
|
|
83
128
|
}, [[0, "trekCardPress", "onTrekCardPress"], [9, "resize", "onWindowResize"]]]);
|
|
@@ -85,14 +130,34 @@ function defineCustomElement$1() {
|
|
|
85
130
|
if (typeof customElements === "undefined") {
|
|
86
131
|
return;
|
|
87
132
|
}
|
|
88
|
-
const components = ["grw-app", "grw-map", "grw-trek-card", "grw-trek-detail", "grw-trek-provider", "grw-treks-list", "grw-treks-provider"];
|
|
133
|
+
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"];
|
|
89
134
|
components.forEach(tagName => { switch (tagName) {
|
|
90
135
|
case "grw-app":
|
|
91
136
|
if (!customElements.get(tagName)) {
|
|
92
137
|
customElements.define(tagName, GrwApp$1);
|
|
93
138
|
}
|
|
94
139
|
break;
|
|
140
|
+
case "grw-filter":
|
|
141
|
+
if (!customElements.get(tagName)) {
|
|
142
|
+
defineCustomElement$b();
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
case "grw-information-desk-detail":
|
|
146
|
+
if (!customElements.get(tagName)) {
|
|
147
|
+
defineCustomElement$a();
|
|
148
|
+
}
|
|
149
|
+
break;
|
|
95
150
|
case "grw-map":
|
|
151
|
+
if (!customElements.get(tagName)) {
|
|
152
|
+
defineCustomElement$9();
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
case "grw-poi-detail":
|
|
156
|
+
if (!customElements.get(tagName)) {
|
|
157
|
+
defineCustomElement$8();
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
case "grw-sensitive-area-detail":
|
|
96
161
|
if (!customElements.get(tagName)) {
|
|
97
162
|
defineCustomElement$7();
|
|
98
163
|
}
|
|
@@ -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 };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface GrwInformationDeskDetail extends Components.GrwInformationDeskDetail, HTMLElement {}
|
|
4
|
+
export const GrwInformationDeskDetail: {
|
|
5
|
+
prototype: GrwInformationDeskDetail;
|
|
6
|
+
new (): GrwInformationDeskDetail;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { G as GrwInformationDeskDetail$1, d as defineCustomElement$1 } from './grw-information-desk-detail2.js';
|
|
2
|
+
|
|
3
|
+
const GrwInformationDeskDetail = GrwInformationDeskDetail$1;
|
|
4
|
+
const defineCustomElement = defineCustomElement$1;
|
|
5
|
+
|
|
6
|
+
export { GrwInformationDeskDetail, defineCustomElement };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
const GrwInformationDeskDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
}
|
|
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-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
|
+
this.informationDesk.municipality ||
|
|
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
|
+
}
|
|
16
|
+
static get style() { return grwInformationDeskDetailCss; }
|
|
17
|
+
}, [1, "grw-information-desk-detail", {
|
|
18
|
+
"informationDesk": [16]
|
|
19
|
+
}]);
|
|
20
|
+
function defineCustomElement() {
|
|
21
|
+
if (typeof customElements === "undefined") {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const components = ["grw-information-desk-detail"];
|
|
25
|
+
components.forEach(tagName => { switch (tagName) {
|
|
26
|
+
case "grw-information-desk-detail":
|
|
27
|
+
if (!customElements.get(tagName)) {
|
|
28
|
+
customElements.define(tagName, GrwInformationDeskDetail);
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
} });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { GrwInformationDeskDetail as G, defineCustomElement as d };
|