@everymatrix/general-slider-navigation 1.32.4 → 1.33.0
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/general-slider-navigation.cjs.entry.js +369 -0
- package/dist/cjs/general-slider-navigation.cjs.js +19 -0
- package/dist/cjs/index-3420513e.js +1282 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/general-slider-navigation/general-slider-navigation.css +282 -0
- package/dist/collection/components/general-slider-navigation/general-slider-navigation.js +547 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +40 -0
- package/dist/collection/utils/utils.js +56 -0
- package/dist/components/general-slider-navigation.d.ts +11 -0
- package/dist/components/general-slider-navigation.js +403 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/general-slider-navigation.entry.js +365 -0
- package/dist/esm/general-slider-navigation.js +17 -0
- package/dist/esm/index-22e4ccbc.js +1256 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/general-slider-navigation/general-slider-navigation.esm.js +1 -0
- package/dist/general-slider-navigation/index.esm.js +0 -0
- package/dist/general-slider-navigation/p-2f9afaa5.entry.js +1 -0
- package/dist/general-slider-navigation/p-b72fe935.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-slider-navigation/.stencil/packages/general-slider-navigation/stencil.config.d.ts +2 -0
- package/dist/types/components/general-slider-navigation/general-slider-navigation.d.ts +92 -0
- package/dist/types/components.d.ts +141 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +10 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +2 -3
- package/LICENSE +0 -21
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-3420513e.js');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu', 'hr'];
|
|
9
|
+
const TRANSLATIONS = {
|
|
10
|
+
en: {
|
|
11
|
+
error: 'Error',
|
|
12
|
+
noResults: 'Loading, please wait ...',
|
|
13
|
+
},
|
|
14
|
+
hu: {
|
|
15
|
+
error: 'Error',
|
|
16
|
+
noResults: 'Loading, please wait ...',
|
|
17
|
+
},
|
|
18
|
+
ro: {
|
|
19
|
+
error: 'Eroare',
|
|
20
|
+
noResults: 'Loading, please wait ...',
|
|
21
|
+
},
|
|
22
|
+
fr: {
|
|
23
|
+
error: 'Error',
|
|
24
|
+
noResults: 'Loading, please wait ...',
|
|
25
|
+
},
|
|
26
|
+
ar: {
|
|
27
|
+
error: 'خطأ',
|
|
28
|
+
noResults: 'Loading, please wait ...',
|
|
29
|
+
},
|
|
30
|
+
hr: {
|
|
31
|
+
error: 'Greška',
|
|
32
|
+
noResults: 'Učitavanje, molimo pričekajte ...',
|
|
33
|
+
},
|
|
34
|
+
'pt-br': {
|
|
35
|
+
'error': 'Erro',
|
|
36
|
+
'noResults': 'Carregando, espere por favor…'
|
|
37
|
+
},
|
|
38
|
+
'es-mx': {
|
|
39
|
+
'error': 'Error',
|
|
40
|
+
'noResults': 'Cargando, espere por favor…'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const translate = (key, customLang) => {
|
|
44
|
+
const lang = customLang;
|
|
45
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @name isMobile
|
|
50
|
+
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
|
51
|
+
* @param {String} userAgent window.navigator.userAgent
|
|
52
|
+
* @returns {Boolean} true or false
|
|
53
|
+
*/
|
|
54
|
+
const isMobile = (userAgent) => {
|
|
55
|
+
return !!(userAgent.toLowerCase().match(/android/i) ||
|
|
56
|
+
userAgent.toLowerCase().match(/blackberry|bb/i) ||
|
|
57
|
+
userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
|
|
58
|
+
userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
|
|
59
|
+
};
|
|
60
|
+
const getDevice = () => {
|
|
61
|
+
let userAgent = window.navigator.userAgent;
|
|
62
|
+
if (userAgent.toLowerCase().match(/android/i)) {
|
|
63
|
+
return 'Android';
|
|
64
|
+
}
|
|
65
|
+
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
66
|
+
return 'iPhone';
|
|
67
|
+
}
|
|
68
|
+
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
69
|
+
return 'iPad';
|
|
70
|
+
}
|
|
71
|
+
return 'PC';
|
|
72
|
+
};
|
|
73
|
+
const getDevicePlatform = () => {
|
|
74
|
+
const device = getDevice();
|
|
75
|
+
if (device) {
|
|
76
|
+
if (device === 'PC') {
|
|
77
|
+
return 'dk';
|
|
78
|
+
}
|
|
79
|
+
else if (device === 'iPad' || device === 'iPhone') {
|
|
80
|
+
return 'ios';
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return 'mtWeb';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
function checkDeviceType() {
|
|
88
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
89
|
+
const width = screen.availWidth;
|
|
90
|
+
const height = screen.availHeight;
|
|
91
|
+
if (userAgent.includes('iphone')) {
|
|
92
|
+
return 'mobile';
|
|
93
|
+
}
|
|
94
|
+
if (userAgent.includes('android')) {
|
|
95
|
+
if (height > width && width < 800) {
|
|
96
|
+
return 'mobile';
|
|
97
|
+
}
|
|
98
|
+
if (width > height && height < 800) {
|
|
99
|
+
return 'tablet';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return 'desktop';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const generalSliderNavigationCss = ":host {\n display: block;\n}\n\n.PageError {\n display: flex;\n justify-content: center;\n flex-direction: column;\n}\n.PageError.TitleError {\n color: red;\n}\n\nmain {\n width: 100%;\n overflow: hidden;\n}\n\n.SliderItemsWrapper {\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n\n.SliderWrapperContent {\n display: flex;\n justify-content: center;\n flex-direction: row;\n width: 100%;\n}\n\n.SliderItems {\n display: flex;\n transition: transform 0.4s ease-in-out;\n transform: translateX(0px);\n}\n\n.SliderItem {\n flex: 0 0 auto;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n border-radius: 5px;\n user-select: none;\n}\n\n.GridContainer {\n display: grid;\n grid-template-columns: 1fr;\n grid-template-rows: 1fr 1fr;\n gap: 0px 0px;\n margin: auto;\n width: 220px;\n height: 320px;\n border-radius: 5px;\n margin-bottom: 20px;\n background: var(--emfe-w-color-secondary, #FD2839);\n cursor: pointer;\n}\n.GridContainer .SliderImage {\n grid-area: 1/1/2/2;\n}\n.GridContainer .SliderImage img {\n object-fit: cover;\n height: 320px;\n width: 220px;\n border-radius: 5px;\n}\n.GridContainer .SliderContent {\n grid-area: 1/1/3/2;\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n justify-content: flex-end;\n align-items: baseline;\n gap: 5px;\n margin-left: 20px;\n margin-bottom: 20px;\n}\n.GridContainer .SliderContent .DividerElement {\n background: var(--emfe-w-color-secondary, #FD2839);\n height: 3px;\n width: 60px;\n}\n.GridContainer .SliderContent .Title {\n font-size: 22px;\n font-weight: 400;\n text-transform: uppercase;\n color: var(--emfe-w-color-white, #FFFFFF);\n}\n\n.GridItems {\n display: grid;\n grid-template-columns: 49vw 49vw;\n grid-template-rows: auto auto;\n place-content: unset;\n gap: 2vw;\n margin: 0;\n width: 100vw;\n}\n\n.GridContainerMobile {\n display: grid;\n grid-template-columns: 1fr;\n grid-template-rows: 1fr 1fr;\n gap: 0px 0px;\n margin: auto;\n width: 49vw;\n height: 240px;\n border-radius: 15px;\n background: var(--emfe-w-color-secondary, #FD2839);\n cursor: pointer;\n}\n.GridContainerMobile .SliderImage {\n grid-area: 1/1/2/2;\n}\n.GridContainerMobile .SliderImage img {\n width: 49vw;\n object-fit: cover;\n height: 240px;\n border-radius: 5px;\n}\n.GridContainerMobile .SliderContent {\n grid-area: 1/1/3/2;\n display: flex;\n flex-flow: column;\n justify-content: flex-end;\n align-items: baseline;\n gap: 5px;\n margin-left: 20px;\n margin-bottom: 20px;\n}\n.GridContainerMobile .SliderContent .DividerElement {\n background: var(--emfe-w-color-secondary, #FD2839);\n height: 3px;\n width: 60px;\n}\n.GridContainerMobile .SliderContent .Title {\n font-size: 22px;\n font-weight: 400;\n text-transform: uppercase;\n color: var(--emfe-w-color-white, #FFFFFF);\n}\n\n.GridContainerMobile:nth-last-child(1):nth-child(odd) {\n display: grid;\n gap: 0px 0px;\n margin: auto;\n width: 100vw;\n}\n.GridContainerMobile:nth-last-child(1):nth-child(odd) .SliderImage {\n grid-area: 1/1/2/2;\n}\n.GridContainerMobile:nth-last-child(1):nth-child(odd) .SliderImage img {\n width: 100vw;\n object-fit: cover;\n height: 240px;\n border-radius: 5px;\n}\n\n.SliderNavButton {\n border: 0px;\n width: 45px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.SliderNavButton svg {\n width: 40px;\n stroke: var(--emfe-w-color-secondary, #FD2839);\n}\n\n.DisabledArrow svg {\n opacity: 0.2;\n stroke: var(--emfe-w-color-secondary, #FD2839);\n pointer-events: none;\n}\n\n@container (max-width: 475px) {\n .SliderItem {\n display: grid;\n grid-template-columns: repeat(auto-fill, max(250px, 1fr));\n color: var(--emfe-w-color-secondary, #FD2839);\n border-radius: 5px;\n user-select: none;\n }\n\n .GridContainer {\n display: grid;\n grid-template-columns: repeat(auto-fill, max(250px, 1fr));\n gap: 10px;\n margin: auto;\n width: 90%;\n height: 220px;\n border-radius: 5px;\n background: var(--emfe-w-color-secondary, #FD2839);\n cursor: pointer;\n }\n .GridContainer .SliderImage {\n grid-area: 1/1/2/2;\n }\n .GridContainer .SliderImage img {\n object-fit: cover;\n height: 220px;\n width: 100%;\n border-radius: 5px;\n }\n .GridContainer .SliderContent {\n grid-area: 1/1/3/2;\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n justify-content: flex-end;\n align-items: baseline;\n gap: 5px;\n margin-left: 20px;\n margin-bottom: 40px;\n }\n .GridContainer .SliderContent .DividerElement {\n background: var(--emfe-w-color-secondary, #FD2839);\n height: 3px;\n width: 60px;\n }\n .GridContainer .SliderContent .Title {\n font-size: 16px;\n font-weight: 400;\n text-transform: uppercase;\n color: var(--emfe-w-color-white, #FFFFFF);\n }\n\n .GridItems {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-template-rows: auto auto auto auto;\n gap: 2cqw;\n width: 100cqw;\n justify-items: stretch;\n }\n\n .GridContainerMobile {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-template-rows: 1fr 1fr;\n gap: 0px 0px;\n margin: auto;\n height: 200px;\n border-radius: 15px;\n background: white;\n cursor: pointer;\n }\n .GridContainerMobile .SliderImage {\n grid-area: 1/1/2/2;\n }\n .GridContainerMobile .SliderImage img {\n object-fit: cover;\n height: 200px;\n border-radius: 5px;\n }\n .GridContainerMobile .SliderContent {\n grid-area: 1/1/3/2;\n display: flex;\n flex-flow: column;\n justify-content: flex-end;\n align-items: baseline;\n gap: 5px;\n margin-left: 20px;\n margin-bottom: 20px;\n }\n .GridContainerMobile .SliderContent .DividerElement {\n background: var(--emfe-w-color-secondary, #FD2839);\n height: 3px;\n width: 60px;\n }\n .GridContainerMobile .SliderContent .Title {\n font-size: 22px;\n font-weight: 400;\n text-transform: uppercase;\n color: var(--emfe-w-color-white, #FFFFFF);\n }\n}";
|
|
106
|
+
|
|
107
|
+
const GeneralSliderNavigation = class {
|
|
108
|
+
constructor(hostRef) {
|
|
109
|
+
index.registerInstance(this, hostRef);
|
|
110
|
+
/**
|
|
111
|
+
* Client custom styling via inline style
|
|
112
|
+
*/
|
|
113
|
+
this.clientStyling = '';
|
|
114
|
+
/**
|
|
115
|
+
* Client custom styling via url
|
|
116
|
+
*/
|
|
117
|
+
this.clientStylingUrl = '';
|
|
118
|
+
/**
|
|
119
|
+
* CMS Endpoint stage
|
|
120
|
+
*/
|
|
121
|
+
this.cmsEnv = 'stage';
|
|
122
|
+
/**
|
|
123
|
+
* Language of the widget
|
|
124
|
+
*/
|
|
125
|
+
this.language = 'en';
|
|
126
|
+
/**
|
|
127
|
+
* User roles
|
|
128
|
+
*/
|
|
129
|
+
this.userRoles = 'everyone';
|
|
130
|
+
/**
|
|
131
|
+
* Show slider navigate arrows
|
|
132
|
+
*/
|
|
133
|
+
this.showSliderArrows = true;
|
|
134
|
+
/**
|
|
135
|
+
* Show slider navigate arrows on mobile
|
|
136
|
+
*/
|
|
137
|
+
this.showSliderArrowsMobile = true;
|
|
138
|
+
/**
|
|
139
|
+
* You will see a fixed grid without a slider when using a mobile device.
|
|
140
|
+
*/
|
|
141
|
+
this.showMobileGrid = false;
|
|
142
|
+
/**
|
|
143
|
+
* Set if you want to have a slider on mobile device.
|
|
144
|
+
*/
|
|
145
|
+
this.showNavigationSliderMobile = true;
|
|
146
|
+
/**
|
|
147
|
+
* Set if you want to have a slider on desktop.
|
|
148
|
+
*/
|
|
149
|
+
this.showNavigationSliderDesktop = true;
|
|
150
|
+
/**
|
|
151
|
+
* Specify the number of items you would like to be displayed on desktop.
|
|
152
|
+
*/
|
|
153
|
+
this.itemsPerPageDesktop = 3;
|
|
154
|
+
/**
|
|
155
|
+
* Specify the number of items you would like to be displayed on mobile devices.
|
|
156
|
+
*/
|
|
157
|
+
this.itemsPerPageMobile = 2;
|
|
158
|
+
this.isLoading = true;
|
|
159
|
+
this.limitStylingAppends = false;
|
|
160
|
+
this.hasErrors = false;
|
|
161
|
+
this.device = '';
|
|
162
|
+
this.activeIndex = 0;
|
|
163
|
+
this.sliderMenuElementWidth = 0;
|
|
164
|
+
this.userAgent = window.navigator.userAgent;
|
|
165
|
+
this.isMobile = isMobile(this.userAgent);
|
|
166
|
+
this.allElementsWidth = 0;
|
|
167
|
+
this.xDown = null;
|
|
168
|
+
this.yDown = null;
|
|
169
|
+
this.resizeHandler = () => {
|
|
170
|
+
this.calculateSliderWidth();
|
|
171
|
+
};
|
|
172
|
+
this.orientationChangeHandler = () => {
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
this.calculateSliderWidth();
|
|
175
|
+
}, 10);
|
|
176
|
+
};
|
|
177
|
+
this.navigationTo = (url, target, isExternal) => {
|
|
178
|
+
window.postMessage({ type: 'NavigateTo', path: url, target: target || null, externalLink: isExternal || false }, window.location.href);
|
|
179
|
+
};
|
|
180
|
+
this.setImage = (image) => {
|
|
181
|
+
let source = '';
|
|
182
|
+
this.device = checkDeviceType();
|
|
183
|
+
switch (this.device) {
|
|
184
|
+
case 'mobile':
|
|
185
|
+
source = image.srcMobile;
|
|
186
|
+
break;
|
|
187
|
+
case 'tablet':
|
|
188
|
+
source = image.srcTablet;
|
|
189
|
+
break;
|
|
190
|
+
case 'desktop':
|
|
191
|
+
source = image.srcDesktop;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
return source;
|
|
195
|
+
};
|
|
196
|
+
this.setClientStyling = () => {
|
|
197
|
+
let sheet = document.createElement('style');
|
|
198
|
+
sheet.innerHTML = this.clientStyling;
|
|
199
|
+
this.stylingContainer.prepend(sheet);
|
|
200
|
+
};
|
|
201
|
+
this.setClientStylingURL = () => {
|
|
202
|
+
let url = new URL(this.clientStylingUrl);
|
|
203
|
+
let cssFile = document.createElement('style');
|
|
204
|
+
fetch(url.href)
|
|
205
|
+
.then((res) => res.text())
|
|
206
|
+
.then((data) => {
|
|
207
|
+
cssFile.innerHTML = data;
|
|
208
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
209
|
+
})
|
|
210
|
+
.catch((err) => {
|
|
211
|
+
console.log('error ', err);
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
watchEndpoint(newValue, oldValue) {
|
|
216
|
+
if (newValue && newValue != oldValue && this.cmsEndpoint) {
|
|
217
|
+
this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
|
|
218
|
+
this.sliderData = GeneralSliderNavigation;
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
connectedCallback() {
|
|
223
|
+
window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
|
|
224
|
+
}
|
|
225
|
+
componentWillLoad() {
|
|
226
|
+
if (this.cmsEndpoint && this.language) {
|
|
227
|
+
return this.getGeneralSliderNavigation().then((GeneralSliderNavigation) => {
|
|
228
|
+
this.sliderData = GeneralSliderNavigation;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
componentDidLoad() {
|
|
233
|
+
window.addEventListener('resize', this.resizeHandler);
|
|
234
|
+
}
|
|
235
|
+
componentDidRender() {
|
|
236
|
+
this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
|
|
237
|
+
this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
|
|
238
|
+
// start custom styling area
|
|
239
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
240
|
+
if (this.clientStyling)
|
|
241
|
+
this.setClientStyling();
|
|
242
|
+
this.limitStylingAppends = true;
|
|
243
|
+
}
|
|
244
|
+
// end custom styling area
|
|
245
|
+
}
|
|
246
|
+
componentDidUpdate() {
|
|
247
|
+
this.calculateSliderWidth();
|
|
248
|
+
}
|
|
249
|
+
disconnectedCallback() {
|
|
250
|
+
this.el.removeEventListener('touchstart', this.handleTouchStart);
|
|
251
|
+
this.el.removeEventListener('touchmove', this.handleTouchMove);
|
|
252
|
+
window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
|
|
253
|
+
window.removeEventListener('resize', this.resizeHandler);
|
|
254
|
+
}
|
|
255
|
+
getGeneralSliderNavigation() {
|
|
256
|
+
let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
|
|
257
|
+
url.searchParams.append('env', this.cmsEnv);
|
|
258
|
+
url.searchParams.append('userRoles', this.userRoles);
|
|
259
|
+
url.searchParams.append('device', getDevicePlatform());
|
|
260
|
+
return new Promise((resolve, reject) => {
|
|
261
|
+
this.isLoading = true;
|
|
262
|
+
fetch(url.href)
|
|
263
|
+
.then((res) => res.json())
|
|
264
|
+
.then((menuSliderData) => {
|
|
265
|
+
resolve(menuSliderData.banners);
|
|
266
|
+
})
|
|
267
|
+
.catch((err) => {
|
|
268
|
+
console.error(err);
|
|
269
|
+
this.hasErrors = true;
|
|
270
|
+
reject(err);
|
|
271
|
+
}).finally(() => {
|
|
272
|
+
this.isLoading = false;
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
handleTouchStart(evt) {
|
|
277
|
+
const firstTouch = this.getTouches(evt)[0];
|
|
278
|
+
this.xDown = firstTouch.clientX;
|
|
279
|
+
this.yDown = firstTouch.clientY;
|
|
280
|
+
}
|
|
281
|
+
handleTouchMove(evt) {
|
|
282
|
+
if (!this.xDown || !this.yDown)
|
|
283
|
+
return;
|
|
284
|
+
let xUp = evt.touches[0].clientX;
|
|
285
|
+
let yUp = evt.touches[0].clientY;
|
|
286
|
+
let xDiff = this.xDown - xUp;
|
|
287
|
+
let yDiff = this.yDown - yUp;
|
|
288
|
+
if (Math.abs(xDiff) > Math.abs(yDiff)) {
|
|
289
|
+
if (xDiff > 0) {
|
|
290
|
+
this.move(1);
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
this.move(-1);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
this.xDown = null;
|
|
297
|
+
this.yDown = null;
|
|
298
|
+
}
|
|
299
|
+
;
|
|
300
|
+
calculateSliderWidth() {
|
|
301
|
+
if (!this.sliderMenuElement)
|
|
302
|
+
return;
|
|
303
|
+
this.sliderMenuElementWidth = this.sliderMenuElement.clientWidth;
|
|
304
|
+
}
|
|
305
|
+
;
|
|
306
|
+
getTouches(evt) {
|
|
307
|
+
return evt.touches || evt.originalEvent.touches;
|
|
308
|
+
}
|
|
309
|
+
setActive(index) {
|
|
310
|
+
const maxLength = Math.ceil(this.sliderData.length / (!this.isMobile ? this.itemsPerPageDesktop : this.itemsPerPageMobile));
|
|
311
|
+
if (index >= 0) {
|
|
312
|
+
if (index >= maxLength - 1) {
|
|
313
|
+
this.activeIndex = maxLength - 1;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
this.activeIndex = index;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
this.activeIndex = 0;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
move(direction) {
|
|
324
|
+
this.setActive(this.activeIndex + direction);
|
|
325
|
+
}
|
|
326
|
+
;
|
|
327
|
+
goTo(index) {
|
|
328
|
+
let diff = this.activeIndex - index;
|
|
329
|
+
if (diff > 0) {
|
|
330
|
+
for (let i = 0; i < diff; i++) {
|
|
331
|
+
this.move(-1);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
for (let i = 0; i > diff; i--) {
|
|
336
|
+
this.move(1);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
render() {
|
|
341
|
+
const styles = {
|
|
342
|
+
transform: `translate(${(+this.sliderMenuElementWidth * this.activeIndex) * -1}px, 0px)`
|
|
343
|
+
};
|
|
344
|
+
const itemStyleDesktop = {
|
|
345
|
+
width: `${this.sliderMenuElementWidth / Math.ceil(this.itemsPerPageDesktop)}px`
|
|
346
|
+
};
|
|
347
|
+
const itemStyleMobile = {
|
|
348
|
+
width: `${this.sliderMenuElementWidth / this.itemsPerPageMobile}px`
|
|
349
|
+
};
|
|
350
|
+
if (this.hasErrors) {
|
|
351
|
+
return (index.h("div", { class: "PageError" }, index.h("div", { class: "TitleError" }, translate('error', this.language))));
|
|
352
|
+
}
|
|
353
|
+
if (!this.isLoading) {
|
|
354
|
+
return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "SliderWrapper" }, index.h("div", { class: "SliderWrapperContent", ref: (el) => this.slider = el }, ((this.showSliderArrows && !this.isMobile) || (this.showSliderArrowsMobile && this.isMobile)) &&
|
|
355
|
+
index.h("div", { class: this.activeIndex === 0 ? 'SliderNavButton DisabledArrow' : 'SliderNavButton', onClick: () => this.move(-1) }, index.h("svg", { fill: "none", stroke: "var(--emfe-w-color-secondary, #FD2839)", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))), this.showNavigationSliderMobile && this.isMobile ? (index.h("main", null, index.h("div", { style: styles, ref: (el) => this.sliderMenuElement = el, class: "SliderItems" }, this.sliderData.map((data) => index.h("div", { class: "SliderItem", style: itemStyleMobile }, index.h("div", { class: "GridContainer", onClick: () => data.externalLink ? this.navigationTo(data.url, data.targetType, data.externalLink) : this.navigationTo(data.url, data.targetType, false) }, index.h("div", { class: "SliderImage" }, index.h("img", { src: this.setImage(data.image), alt: data.title })), index.h("div", { class: "SliderContent" }, index.h("div", { class: "DividerElement" }), index.h("div", { class: "Title" }, data.title)))))))) : (this.showNavigationSliderDesktop && !this.isMobile &&
|
|
356
|
+
index.h("main", null, index.h("div", { class: "SliderItems", style: styles, ref: (el) => this.sliderMenuElement = el }, index.h("div", { class: "SliderItemsWrapper" }, this.sliderData.map((data) => index.h("div", { class: "SliderItem", style: itemStyleDesktop }, index.h("div", { class: "GridContainer", onClick: () => data.externalLink ? this.navigationTo(data.url, data.targetType, data.externalLink) : this.navigationTo(data.url, data.targetType, false) }, index.h("div", { class: "SliderImage" }, index.h("img", { src: this.setImage(data.image), alt: data.title })), index.h("div", { class: "SliderContent" }, index.h("div", { class: "DividerElement" }), index.h("div", { class: "Title" }, data.title))))))))), ((this.showSliderArrows && !this.isMobile) || (this.showSliderArrowsMobile && this.isMobile)) &&
|
|
357
|
+
index.h("div", { class: this.activeIndex === Math.ceil(this.sliderData.length / (!this.isMobile ? this.itemsPerPageDesktop : this.itemsPerPageMobile)) - 1 ? ' SliderNavButton DisabledArrow disabled' : 'SliderNavButton', onClick: () => this.move(1) }, index.h("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" }))))), (this.showMobileGrid && this.isMobile) &&
|
|
358
|
+
index.h("main", { class: "GridItems GridMobile" }, this.sliderData.map((dataMobile) => index.h("div", { class: "GridContainerMobile", onClick: () => dataMobile.externalLink ? this.navigationTo(dataMobile.url, dataMobile.targetType, dataMobile.externalLink) : this.navigationTo(dataMobile.url, dataMobile.targetType, false) }, index.h("div", { class: "SliderImage" }, index.h("img", { src: this.setImage(dataMobile.image), alt: dataMobile.title })), index.h("div", { class: "SliderContent" }, index.h("div", { class: "DividerElement" }), index.h("div", { class: "Title" }, dataMobile.title)))))));
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
get el() { return index.getElement(this); }
|
|
362
|
+
static get watchers() { return {
|
|
363
|
+
"cmsEndpoint": ["watchEndpoint"],
|
|
364
|
+
"language": ["watchEndpoint"]
|
|
365
|
+
}; }
|
|
366
|
+
};
|
|
367
|
+
GeneralSliderNavigation.style = generalSliderNavigationCss;
|
|
368
|
+
|
|
369
|
+
exports.general_slider_navigation = GeneralSliderNavigation;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-3420513e.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('general-slider-navigation.cjs.js', document.baseURI).href));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
return index.bootstrapLazy([["general-slider-navigation.cjs",[[1,"general-slider-navigation",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"showMobileGrid":[516,"show-mobile-grid"],"showNavigationSliderMobile":[516,"show-navigation-slider-mobile"],"showNavigationSliderDesktop":[516,"show-navigation-slider-desktop"],"itemsPerPageDesktop":[514,"items-per-page-desktop"],"itemsPerPageMobile":[514,"items-per-page-mobile"],"isLoading":[32],"limitStylingAppends":[32],"hasErrors":[32],"device":[32],"activeIndex":[32],"sliderMenuElementWidth":[32]}]]]], options);
|
|
19
|
+
});
|