@geotrekce/geotrek-rando-widget 0.0.1 → 0.0.4
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_7.cjs.entry.js → grw-app_11.cjs.entry.js} +513 -89
- package/dist/cjs/{index-31255e29.js → index-c2c4531d.js} +82 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/assets/departure-arrival.svg +1 -1
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/grw-app/grw-app.css +127 -39
- package/dist/collection/components/grw-app/grw-app.js +375 -18
- 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 +30 -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 +117 -0
- package/dist/collection/components/grw-map/grw-map.js +409 -40
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +30 -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 +16 -0
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +38 -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 +112 -33
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +36 -1
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +122 -33
- package/dist/collection/components/grw-treks-list/grw-treks-list.css +17 -12
- package/dist/collection/components/grw-treks-list/grw-treks-list.js +70 -6
- package/dist/collection/store/grw-trek-provider.js +50 -8
- package/dist/collection/store/grw-treks-provider.js +166 -11
- package/dist/collection/store/store.js +6 -0
- package/dist/collection/stories/App.js +39 -3
- package/dist/collection/stories/App.stories.js +30 -5
- package/dist/collection/stories/TrekCard.js +9 -3
- package/dist/collection/stories/TrekCard.stories.js +5 -2
- package/dist/collection/stories/TrekDetail.js +10 -3
- package/dist/collection/stories/TrekDetail.stories.js +6 -2
- package/dist/collection/stories/TrekMap.js +15 -6
- package/dist/collection/stories/TrekMap.stories.js +21 -6
- package/dist/collection/stories/TreksList.js +17 -3
- package/dist/collection/stories/TreksList.stories.js +13 -2
- package/dist/collection/stories/TreksMap.js +12 -3
- package/dist/collection/stories/TreksMap.stories.js +18 -3
- package/dist/collection/utils/utils.js +2 -2
- package/dist/components/grw-app.js +79 -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-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 +260 -43
- 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 +32 -0
- package/dist/components/grw-trek-card2.js +33 -10
- package/dist/components/grw-trek-detail2.js +47 -9
- package/dist/components/grw-trek-provider2.js +32 -9
- package/dist/components/grw-treks-list2.js +15 -6
- package/dist/components/grw-treks-provider2.js +37 -13
- package/dist/components/length.js +2 -2
- package/dist/components/store.js +6 -0
- package/dist/esm/geotrek-rando-widget.js +2 -2
- package/dist/esm/{grw-app_7.entry.js → grw-app_11.entry.js} +510 -90
- package/dist/esm/{index-b36f38f5.js → index-fe16e7b6.js} +82 -1
- package/dist/esm/loader.js +2 -2
- 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-8c206aec.js +2 -0
- package/dist/geotrek-rando-widget/p-ed8706fb.entry.js +1 -0
- package/dist/types/components/grw-app/grw-app.d.ts +27 -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 +19 -2
- 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 -2
- package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +3 -0
- package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +3 -0
- package/dist/types/components.d.ts +158 -1
- package/dist/types/store/grw-trek-provider.d.ts +1 -0
- package/dist/types/store/grw-treks-provider.d.ts +8 -0
- package/dist/types/store/store.d.ts +13 -1
- package/dist/types/types/types.d.ts +69 -3
- package/package.json +5 -7
- package/readme.md +19 -1
- package/dist/geotrek-rando-widget/p-f721481d.js +0 -2
- package/dist/geotrek-rando-widget/p-fe788eaa.entry.js +0 -1
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
export const createTreksList = ({ api }) => {
|
|
1
|
+
export const createTreksList = ({ api, language, inBbox, cities, districts, structures, themes, portals, routes, practices, colorPrimary, colorPrimaryTint }) => {
|
|
2
|
+
const container = document.createElement('div');
|
|
2
3
|
const treks = document.createElement('grw-treks-provider');
|
|
3
4
|
treks.setAttribute('api', api);
|
|
4
|
-
treks.
|
|
5
|
-
|
|
5
|
+
treks.setAttribute('language', language);
|
|
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
|
+
container.appendChild(treks);
|
|
15
|
+
const list = document.createElement('grw-treks-list');
|
|
16
|
+
list.setAttribute('color-primary', colorPrimary);
|
|
17
|
+
list.setAttribute('color-primary-tint', colorPrimaryTint);
|
|
18
|
+
container.appendChild(list);
|
|
19
|
+
return container;
|
|
6
20
|
};
|
|
@@ -5,13 +5,24 @@ export default {
|
|
|
5
5
|
argTypes: {},
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
const Template = ({
|
|
9
|
-
return createTreksList({
|
|
8
|
+
const Template = ({ ...args }) => {
|
|
9
|
+
return createTreksList({ ...args });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const TreksList = Template.bind({});
|
|
13
13
|
|
|
14
14
|
TreksList.args = {
|
|
15
15
|
api: 'https://randoadmin.parc-haut-jura.fr/api/v2/',
|
|
16
|
+
language: 'fr',
|
|
17
|
+
inBbox: '',
|
|
18
|
+
cities: '',
|
|
19
|
+
districts: '',
|
|
20
|
+
structures: '',
|
|
21
|
+
themes: '',
|
|
22
|
+
portals: '',
|
|
23
|
+
routes: '',
|
|
24
|
+
practices: '',
|
|
25
|
+
colorPrimary: '#6b0030',
|
|
26
|
+
colorPrimaryTint: '#974c6e',
|
|
16
27
|
};
|
|
17
28
|
TreksList.storyName = 'Treks list';
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
export const createTreksMap = ({ api }) => {
|
|
1
|
+
export const createTreksMap = ({ api, urlLayer, center, zoom, attribution, colorPrimary, colorPrimaryTint }) => {
|
|
2
|
+
const container = document.createElement('div');
|
|
3
|
+
container.style = 'height: 100%';
|
|
2
4
|
const treks = document.createElement('grw-treks-provider');
|
|
3
5
|
treks.setAttribute('api', api);
|
|
6
|
+
container.appendChild(treks);
|
|
4
7
|
const treksMap = document.createElement('grw-map');
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
treksMap.setAttribute('url-layer', urlLayer);
|
|
9
|
+
treksMap.setAttribute('center', center);
|
|
10
|
+
treksMap.setAttribute('zoom', zoom);
|
|
11
|
+
treksMap.setAttribute('attribution', attribution);
|
|
12
|
+
treksMap.setAttribute('color-primary', colorPrimary);
|
|
13
|
+
treksMap.setAttribute('color-primary-tint', colorPrimaryTint);
|
|
14
|
+
container.appendChild(treksMap);
|
|
15
|
+
return container;
|
|
7
16
|
};
|
|
@@ -2,16 +2,31 @@ import { createTreksMap } from './TreksMap';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Geotrek Rando Widget',
|
|
5
|
-
argTypes: {
|
|
5
|
+
argTypes: {
|
|
6
|
+
urlLayer: {
|
|
7
|
+
control: 'select',
|
|
8
|
+
options: ['openstreetmap', 'planignv2'],
|
|
9
|
+
mapping: {
|
|
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}',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
6
15
|
};
|
|
7
16
|
|
|
8
|
-
const Template = ({
|
|
9
|
-
return createTreksMap({
|
|
17
|
+
const Template = ({ ...args }) => {
|
|
18
|
+
return createTreksMap({ ...args });
|
|
10
19
|
};
|
|
11
20
|
|
|
12
21
|
export const TreksMap = Template.bind({});
|
|
13
22
|
|
|
14
23
|
TreksMap.args = {
|
|
15
24
|
api: 'https://randoadmin.parc-haut-jura.fr/api/v2/',
|
|
25
|
+
urlLayer: 'openstreetmap',
|
|
26
|
+
center: '46.50761080179829, 5.927117067721017',
|
|
27
|
+
zoom: 8,
|
|
28
|
+
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors',
|
|
29
|
+
colorPrimary: '#6b0030',
|
|
30
|
+
colorPrimaryTint: '#974c6e',
|
|
16
31
|
};
|
|
17
32
|
TreksMap.storyName = 'Treks map';
|
|
@@ -12,8 +12,8 @@ export function formatDuration(duration) {
|
|
|
12
12
|
return formattedDuration;
|
|
13
13
|
}
|
|
14
14
|
export function formatLength(length) {
|
|
15
|
-
return `${Math.round(length / 1000)}
|
|
15
|
+
return `${Math.round(length / 1000)}km`;
|
|
16
16
|
}
|
|
17
17
|
export function formatAscent(ascent) {
|
|
18
|
-
return `${ascent}
|
|
18
|
+
return `${ascent}m`;
|
|
19
19
|
}
|
|
@@ -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,57 +13,123 @@ 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 = ".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() {
|
|
16
20
|
super();
|
|
17
21
|
this.__registerHost();
|
|
18
22
|
this.__attachShadow();
|
|
23
|
+
this.showTrek = false;
|
|
24
|
+
this.showMap = false;
|
|
25
|
+
this.showFilters = false;
|
|
26
|
+
this.isLargeView = false;
|
|
27
|
+
this.language = 'fr';
|
|
19
28
|
this.appName = 'Geotrek Rando Widget';
|
|
20
29
|
this.colorPrimary = '#6b0030';
|
|
21
|
-
this.
|
|
30
|
+
this.colorPrimaryShade = '#4a0021';
|
|
31
|
+
this.colorPrimaryTint = '#974c6e';
|
|
32
|
+
this.colorTrekLine = '#6b0030';
|
|
33
|
+
this.colorDepartureIcon = '#006b3b';
|
|
34
|
+
this.colorArrivalIcon = '#85003b';
|
|
35
|
+
this.colorSensitiveArea = '#4974a5';
|
|
36
|
+
this.colorPoiIcon = '#974c6e';
|
|
37
|
+
this.largeViewSize = 1024;
|
|
22
38
|
}
|
|
23
39
|
onTrekCardPress(event) {
|
|
24
40
|
this.currentTrekId = event.detail;
|
|
25
41
|
this.showTrek = !this.showTrek;
|
|
26
42
|
}
|
|
27
|
-
onWindowResize(
|
|
28
|
-
this.
|
|
43
|
+
onWindowResize() {
|
|
44
|
+
this.handleView();
|
|
45
|
+
}
|
|
46
|
+
watchPropHandler() {
|
|
47
|
+
window.dispatchEvent(new window.Event('resize'));
|
|
48
|
+
}
|
|
49
|
+
componentDidLoad() {
|
|
50
|
+
this.handleView();
|
|
29
51
|
}
|
|
30
52
|
onTrekDetailsClose() {
|
|
31
53
|
this.currentTrekId = null;
|
|
32
54
|
this.showTrek = !this.showTrek;
|
|
33
55
|
}
|
|
34
|
-
|
|
35
|
-
this.
|
|
56
|
+
handleView() {
|
|
57
|
+
this.isLargeView = this.element.getBoundingClientRect().width >= this.largeViewSize;
|
|
58
|
+
this.showMap = this.isLargeView;
|
|
59
|
+
}
|
|
60
|
+
handleFilters() {
|
|
61
|
+
this.showFilters = !this.showFilters;
|
|
36
62
|
}
|
|
37
63
|
render() {
|
|
38
|
-
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, h("grw-treks-provider", { api: this.api, portals: this.portals }, h("div", { class: "
|
|
64
|
+
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.onTrekDetailsClose(), 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.showMap ? '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.showMap = !this.showMap) }, this.showMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
|
|
39
65
|
}
|
|
66
|
+
get element() { return this; }
|
|
67
|
+
static get watchers() { return {
|
|
68
|
+
"isLargeView": ["watchPropHandler"]
|
|
69
|
+
}; }
|
|
40
70
|
static get style() { return grwAppCss; }
|
|
41
71
|
}, [1, "grw-app", {
|
|
42
72
|
"api": [1],
|
|
73
|
+
"language": [1],
|
|
74
|
+
"inBbox": [1, "in-bbox"],
|
|
75
|
+
"cities": [1],
|
|
76
|
+
"districts": [1],
|
|
77
|
+
"structures": [1],
|
|
78
|
+
"themes": [1],
|
|
43
79
|
"portals": [1],
|
|
80
|
+
"routes": [1],
|
|
81
|
+
"practices": [1],
|
|
44
82
|
"appName": [1, "app-name"],
|
|
83
|
+
"urlLayer": [1, "url-layer"],
|
|
84
|
+
"center": [1],
|
|
85
|
+
"zoom": [8],
|
|
86
|
+
"attribution": [1],
|
|
45
87
|
"colorPrimary": [1, "color-primary"],
|
|
88
|
+
"colorPrimaryShade": [1, "color-primary-shade"],
|
|
46
89
|
"colorPrimaryTint": [1, "color-primary-tint"],
|
|
90
|
+
"colorTrekLine": [1, "color-trek-line"],
|
|
91
|
+
"colorDepartureIcon": [1, "color-departure-icon"],
|
|
92
|
+
"colorArrivalIcon": [1, "color-arrival-icon"],
|
|
93
|
+
"colorSensitiveArea": [1, "color-sensitive-area"],
|
|
94
|
+
"colorPoiIcon": [1, "color-poi-icon"],
|
|
47
95
|
"showTrek": [32],
|
|
48
96
|
"showMap": [32],
|
|
97
|
+
"showFilters": [32],
|
|
98
|
+
"isLargeView": [32],
|
|
49
99
|
"currentTrekId": [32]
|
|
50
100
|
}, [[0, "trekCardPress", "onTrekCardPress"], [9, "resize", "onWindowResize"]]]);
|
|
51
101
|
function defineCustomElement$1() {
|
|
52
102
|
if (typeof customElements === "undefined") {
|
|
53
103
|
return;
|
|
54
104
|
}
|
|
55
|
-
const components = ["grw-app", "grw-map", "grw-trek-card", "grw-trek-detail", "grw-trek-provider", "grw-treks-list", "grw-treks-provider"];
|
|
105
|
+
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"];
|
|
56
106
|
components.forEach(tagName => { switch (tagName) {
|
|
57
107
|
case "grw-app":
|
|
58
108
|
if (!customElements.get(tagName)) {
|
|
59
109
|
customElements.define(tagName, GrwApp$1);
|
|
60
110
|
}
|
|
61
111
|
break;
|
|
112
|
+
case "grw-filter":
|
|
113
|
+
if (!customElements.get(tagName)) {
|
|
114
|
+
defineCustomElement$b();
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
case "grw-information-desk-detail":
|
|
118
|
+
if (!customElements.get(tagName)) {
|
|
119
|
+
defineCustomElement$a();
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
62
122
|
case "grw-map":
|
|
123
|
+
if (!customElements.get(tagName)) {
|
|
124
|
+
defineCustomElement$9();
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
case "grw-poi-detail":
|
|
128
|
+
if (!customElements.get(tagName)) {
|
|
129
|
+
defineCustomElement$8();
|
|
130
|
+
}
|
|
131
|
+
break;
|
|
132
|
+
case "grw-sensitive-area-detail":
|
|
63
133
|
if (!customElements.get(tagName)) {
|
|
64
134
|
defineCustomElement$7();
|
|
65
135
|
}
|
|
@@ -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;padding:0px 8px 8px 8px}.information-desk-img{width:180px}.information-desk-img img{width:180px;border-radius:8px}.information-desk-right-container{display:flex;flex-direction:column;padding:8px}.information-desk-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:0px 0px 8px 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-right-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 };
|