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