@everymatrix/blog-articles-grid 1.44.0 → 1.45.2

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.
Files changed (51) hide show
  1. package/dist/blog-articles-grid/blog-articles-grid.esm.js +1 -1
  2. package/dist/blog-articles-grid/p-786304d4.js +2 -0
  3. package/dist/blog-articles-grid/p-dde0107e.entry.js +1 -0
  4. package/dist/blog-articles-grid/p-e1255160.js +1 -0
  5. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  6. package/dist/cjs/blog-articles-grid.cjs.js +17 -11
  7. package/dist/cjs/blog-articles-grid_2.cjs.entry.js +504 -567
  8. package/dist/cjs/index-fad8e671.js +1332 -0
  9. package/dist/cjs/loader.cjs.js +7 -13
  10. package/dist/collection/collection-manifest.json +3 -3
  11. package/dist/collection/components/blog-articles-grid/blog-articles-grid.js +676 -717
  12. package/dist/collection/components/blog-articles-grid/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +34 -34
  14. package/dist/collection/utils/utils.js +52 -52
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/blog-articles-grid.js +14 -11
  17. package/dist/esm/blog-articles-grid_2.entry.js +504 -567
  18. package/dist/esm/index-2c19cd94.js +1305 -0
  19. package/dist/esm/loader.js +7 -13
  20. package/dist/stencil.config.dev.js +17 -0
  21. package/dist/stencil.config.js +14 -19
  22. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/blog-articles-grid/.stencil/packages/stencil/blog-articles-grid/stencil.config.d.ts +2 -0
  23. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/blog-articles-grid/.stencil/packages/stencil/blog-articles-grid/stencil.config.dev.d.ts +2 -0
  24. package/dist/types/components/blog-articles-grid/blog-articles-grid.d.ts +114 -114
  25. package/dist/types/components/blog-articles-grid/index.d.ts +1 -0
  26. package/dist/types/components.d.ts +16 -1
  27. package/dist/types/stencil-public-runtime.d.ts +142 -33
  28. package/loader/cdn.js +1 -3
  29. package/loader/index.cjs.js +1 -3
  30. package/loader/index.d.ts +13 -1
  31. package/loader/index.es2017.js +1 -3
  32. package/loader/index.js +1 -3
  33. package/loader/package.json +1 -0
  34. package/package.json +9 -3
  35. package/dist/blog-articles-grid/p-cb7acb6b.js +0 -1
  36. package/dist/blog-articles-grid/p-cbc63da6.entry.js +0 -1
  37. package/dist/cjs/index-159efcd2.js +0 -1355
  38. package/dist/components/blog-articles-grid.d.ts +0 -11
  39. package/dist/components/blog-articles-grid.js +0 -485
  40. package/dist/components/helper-pagination.js +0 -6
  41. package/dist/components/helper-pagination2.js +0 -287
  42. package/dist/components/index.d.ts +0 -26
  43. package/dist/components/index.js +0 -1
  44. package/dist/esm/index-6c1af2f1.js +0 -1329
  45. package/dist/esm/polyfills/core-js.js +0 -11
  46. package/dist/esm/polyfills/css-shim.js +0 -1
  47. package/dist/esm/polyfills/dom.js +0 -79
  48. package/dist/esm/polyfills/es5-html-element.js +0 -1
  49. package/dist/esm/polyfills/index.js +0 -34
  50. package/dist/esm/polyfills/system.js +0 -6
  51. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/blog-articles-grid/.stencil/packages/blog-articles-grid/stencil.config.d.ts +0 -2
@@ -2,174 +2,108 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-159efcd2.js');
5
+ const index = require('./index-fad8e671.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE$1 = 'en';
8
8
  const TRANSLATIONS$1 = {
9
- en: {
10
- error: 'Error',
11
- readmore: 'Read more',
12
- },
13
- ro: {
14
- error: 'Eroare',
15
- readmore: 'Read more',
16
- },
17
- fr: {
18
- error: 'Error',
19
- readmore: 'Read more',
20
- },
21
- ar: {
22
- error: 'خطأ',
23
- readmore: 'Read more',
24
- },
25
- hu: {
26
- error: 'خطأ',
27
- readmore: 'Tovább olvasom',
28
- },
29
- hr: {
30
- error: 'Greška',
31
- readmore: 'Pročitaj više'
32
- },
33
- 'pt-br': {
34
- error: 'Erro',
35
- readmore: 'Ler mais'
36
- },
37
- 'es-mx': {
38
- error: 'Error',
39
- readmore: 'Leer más'
40
- }
9
+ en: {
10
+ error: 'Error',
11
+ readmore: 'Read more',
12
+ },
13
+ ro: {
14
+ error: 'Eroare',
15
+ readmore: 'Read more',
16
+ },
17
+ fr: {
18
+ error: 'Error',
19
+ readmore: 'Read more',
20
+ },
21
+ ar: {
22
+ error: 'خطأ',
23
+ readmore: 'Read more',
24
+ },
25
+ hu: {
26
+ error: 'خطأ',
27
+ readmore: 'Tovább olvasom',
28
+ },
29
+ hr: {
30
+ error: 'Greška',
31
+ readmore: 'Pročitaj više'
32
+ },
33
+ 'pt-br': {
34
+ error: 'Erro',
35
+ readmore: 'Ler mais'
36
+ },
37
+ 'es-mx': {
38
+ error: 'Error',
39
+ readmore: 'Leer más'
40
+ }
41
41
  };
42
42
  const translate$1 = (key, customLang) => {
43
- const lang = customLang;
44
- return TRANSLATIONS$1[(lang !== undefined) && (lang in TRANSLATIONS$1) ? lang : DEFAULT_LANGUAGE$1][key];
43
+ const lang = customLang;
44
+ return TRANSLATIONS$1[(lang !== undefined) && (lang in TRANSLATIONS$1) ? lang : DEFAULT_LANGUAGE$1][key];
45
45
  };
46
46
 
47
47
  function checkCustomDeviceWidth() {
48
- const width = screen.availWidth;
49
- if (width < 600) {
50
- return 'mobile';
51
- }
52
- else if (width >= 600 && width < 1100) {
53
- return 'tablet';
54
- }
48
+ const width = screen.availWidth;
49
+ if (width < 600) {
50
+ return 'mobile';
51
+ }
52
+ else if (width >= 600 && width < 1100) {
53
+ return 'tablet';
54
+ }
55
55
  }
56
56
  function isIpad() {
57
- const userAgent = navigator.userAgent.toLowerCase();
58
- // Traditional iPad user agent
59
- if (userAgent.includes('ipad')) {
60
- return true;
61
- }
62
- return userAgent.indexOf('macintosh') > -1 && navigator.maxTouchPoints && navigator.maxTouchPoints > 2;
57
+ const userAgent = navigator.userAgent.toLowerCase();
58
+ // Traditional iPad user agent
59
+ if (userAgent.includes('ipad')) {
60
+ return true;
61
+ }
62
+ return userAgent.indexOf('macintosh') > -1 && navigator.maxTouchPoints && navigator.maxTouchPoints > 2;
63
63
  }
64
64
  function getDeviceCustom() {
65
- const userAgent = navigator.userAgent.toLowerCase();
66
- let source = '';
67
- source = (userAgent.includes('android') || userAgent.includes('iphone') || isIpad()) ? checkCustomDeviceWidth() : 'desktop';
68
- return source;
65
+ const userAgent = navigator.userAgent.toLowerCase();
66
+ let source = '';
67
+ source = (userAgent.includes('android') || userAgent.includes('iphone') || isIpad()) ? checkCustomDeviceWidth() : 'desktop';
68
+ return source;
69
69
  }
70
70
  const getDevice = () => {
71
- let userAgent = window.navigator.userAgent;
72
- if (userAgent.toLowerCase().match(/android/i)) {
73
- return 'Android';
74
- }
75
- if (userAgent.toLowerCase().match(/iphone/i)) {
76
- return 'iPhone';
77
- }
78
- if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
79
- return 'iPad';
80
- }
81
- return 'PC';
82
- };
83
- const getDevicePlatform = () => {
84
- const device = getDevice();
85
- if (device) {
86
- if (device === 'PC') {
87
- return 'dk';
71
+ let userAgent = window.navigator.userAgent;
72
+ if (userAgent.toLowerCase().match(/android/i)) {
73
+ return 'Android';
88
74
  }
89
- else if (device === 'iPad' || device === 'iPhone') {
90
- return 'mtWeb';
75
+ if (userAgent.toLowerCase().match(/iphone/i)) {
76
+ return 'iPhone';
91
77
  }
92
- else {
93
- return 'mtWeb';
78
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
79
+ return 'iPad';
80
+ }
81
+ return 'PC';
82
+ };
83
+ const getDevicePlatform = () => {
84
+ const device = getDevice();
85
+ if (device) {
86
+ if (device === 'PC') {
87
+ return 'dk';
88
+ }
89
+ else if (device === 'iPad' || device === 'iPhone') {
90
+ return 'mtWeb';
91
+ }
92
+ else {
93
+ return 'mtWeb';
94
+ }
94
95
  }
95
- }
96
96
  };
97
97
 
98
98
  const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.BlogPageContainer {\n background: #0A0A17;\n padding: 20px;\n}\n\n.GridContainerWrapper {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n}\n\n.BlogPage-0 .GridContainer.FeaturedPost:first-child {\n width: 100%;\n flex-basis: auto;\n}\n\n.GridContainer {\n container-type: inline-size;\n container-name: article;\n border-radius: 15px;\n color: #000;\n overflow: hidden;\n}\n.GridContainer.FeaturedPost:first-child {\n grid-column: 1/-1;\n width: 100%;\n}\n.GridContainer .GridWrapper {\n display: flex;\n flex-direction: row;\n height: 280px;\n background: var(--emfe-w-color-white, #FFFFFF);\n}\n.GridContainer .GridSector {\n flex-basis: 50%;\n position: relative;\n}\n.GridContainer .GridSector:first-of-type {\n height: 280px;\n display: flex;\n}\n.GridContainer .GridSector:last-of-type {\n padding: 20px 40px;\n display: flex;\n flex-direction: column;\n}\n.GridContainer .VisualContent {\n width: 100%;\n}\n.GridContainer .BlogDate {\n position: absolute;\n bottom: 0px;\n left: 30px;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: var(--emfe-w-color-white, #FFFFFF);\n background-color: #CD0B5E;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #000;\n padding-bottom: 10px;\n}\n.GridContainer .BlogContent {\n display: -webkit-box;\n font-size: 14px;\n line-height: 1.2em;\n -webkit-line-clamp: 6;\n color: #000;\n -webkit-box-orient: vertical;\n box-sizing: border-box;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.GridContainer .BlogLink {\n color: #000;\n position: absolute;\n bottom: 16px;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #D0046C;\n cursor: pointer;\n}\n\n@container article (max-width: 550px) {\n .GridContainer .GridWrapper {\n height: 380px;\n flex-direction: column;\n }\n .GridContainer .GridWrapper .GridSector:first-of-type {\n height: 120px;\n flex-shrink: 0;\n flex-basis: 150px;\n }\n .GridContainer .GridWrapper .GridSector:last-of-type {\n padding: 20px 20px 40px;\n }\n}\n.LoadingImage {\n width: 100%;\n height: 100%;\n background-color: var(--emfe-w-color-gray-100, #E6E6E6);\n}\n\n.LoadingStripe {\n border: 1px solid var(--emfe-w-color-white, #FFFFFF);\n height: 20%;\n background-color: var(--emfe-w-color-gray-100, #E6E6E6);\n margin-bottom: 5px;\n}\n\n.LoadingSmallStripe {\n width: 40%;\n}\n\n.LoadingMediumStripe {\n width: 70%;\n}\n\n.BlogLink.LoadingLongStripe {\n position: static;\n width: 100%;\n}\n\n.GridContainerWrapper.LoadingGrid .GridSector {\n justify-content: space-around;\n}\n\n.GridContainerWrapper.LoadingGrid .LoadingImage, .GridContainerWrapper.LoadingGrid .LoadingStripe {\n animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n -webkit-animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n}\n\n@keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\n@-webkit-keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}";
99
+ const BlogArticlesGridStyle0 = blogArticlesGridCss;
99
100
 
100
101
  const BlogArticlesGrid = class {
101
- constructor(hostRef) {
102
- index.registerInstance(this, hostRef);
103
- this.ArticleActionButton = index.createEvent(this, "ArticleActionButton", 7);
104
- /**
105
- * Language of the widget
106
- */
107
- this.language = 'en';
108
- /**
109
- * User roles
110
- */
111
- this.userRoles = 'everyone';
112
- /**
113
- * CMS Endpoint stage
114
- */
115
- this.cmsEnv = 'stage';
116
- /**
117
- * Client custom styling via string
118
- */
119
- this.clientStyling = '';
120
- /**
121
- * Client custom styling via url
122
- */
123
- this.clientStylingUrl = '';
124
- /**
125
- * Property used to display the publishing date
126
- */
127
- this.showPublishingDate = true;
128
- /**
129
- * Property used to display the image
130
- */
131
- this.showImage = true;
132
- /**
133
- * Property used to display the image
134
- */
135
- this.showTitle = true;
136
- /**
137
- * Property used to display the description
138
- */
139
- this.showContent = true;
140
- /**
141
- * Property used to display the button
142
- */
143
- this.showButton = true;
144
- /**
145
- * Event name to be sent when the button is clicked
146
- */
147
- this.postMessageEvent = '';
148
- /**
149
- * Customize pagination: Activate pagination numbered navigation
150
- */
151
- this.blogsLimit = '0';
152
- /**
153
- * Intl date format
154
- */
155
- this.intlDateTimeFormat = '';
156
- /**
157
- * Page to particularly be opened on start
158
- */
159
- this.page = '1';
160
- this.paginationBlogList = {
161
- offset: 0
162
- };
163
- this.currentPage = 0;
164
- this.hasErrors = false;
165
- this.isLoading = true;
166
- this.bannerMatrixReady = false;
167
- this.nextPage = '';
168
- this.previousPage = '';
169
- this.device = '';
170
- this.totalBlogs = 0;
171
- this.clientStylingContent = '';
172
- this.defaultStyling = `
102
+ constructor(hostRef) {
103
+ index.registerInstance(this, hostRef);
104
+ this.articleActionButton = index.createEvent(this, "articleActionButton", 7);
105
+ this.clientStylingContent = '';
106
+ this.defaultStyling = `
173
107
  div#PaginationContainer {
174
108
  justify-content: right;
175
109
  }
@@ -218,218 +152,250 @@ const BlogArticlesGrid = class {
218
152
  padding: 12px 0 12px 12px;
219
153
  font-weight: 700;
220
154
  }`;
221
- this.setClientStyling = () => {
222
- this.clientStylingContent += this.clientStyling;
223
- const sheet = document.createElement('style');
224
- sheet.innerHTML = this.clientStylingContent;
225
- this.stylingContainer.prepend(sheet);
226
- };
227
- this.setImage = (image) => {
228
- let source = '';
229
- switch (this.device) {
230
- case 'mobile':
231
- source = image.sources[0].pictureSource;
232
- break;
233
- case 'tablet':
234
- source = image.sources[1].pictureSource;
235
- break;
236
- case 'desktop':
237
- source = image.sources[2].pictureSource;
238
- break;
239
- }
240
- return source;
241
- };
242
- this.renderContentConditionally = (content) => {
243
- if (!content)
244
- return;
245
- const hasBanner = content.indexOf('<bannermatrix-banner') !== -1;
246
- if (!hasBanner) {
247
- return index.h("div", { class: "BlogContent", innerHTML: content });
248
- }
249
- if (this.bannerMatrixReady) {
250
- return index.h("div", { class: "BlogContent", innerHTML: content });
251
- }
252
- return null;
253
- };
254
- }
255
- getArticleId(postId, slug, customPath) {
256
- if (this.usePostmessage) {
257
- window.postMessage({ type: this.postMessageEvent, postId, slug, customPath });
155
+ this.setClientStyling = () => {
156
+ this.clientStylingContent += this.clientStyling;
157
+ const sheet = document.createElement('style');
158
+ sheet.innerHTML = this.clientStylingContent;
159
+ this.stylingContainer.prepend(sheet);
160
+ };
161
+ this.setImage = (image) => {
162
+ let source = '';
163
+ switch (this.device) {
164
+ case 'mobile':
165
+ source = image.sources[0].pictureSource;
166
+ break;
167
+ case 'tablet':
168
+ source = image.sources[1].pictureSource;
169
+ break;
170
+ case 'desktop':
171
+ source = image.sources[2].pictureSource;
172
+ break;
173
+ }
174
+ return source;
175
+ };
176
+ this.renderContentConditionally = (content) => {
177
+ if (!content)
178
+ return;
179
+ const hasBanner = content.indexOf('<bannermatrix-banner') !== -1;
180
+ if (!hasBanner) {
181
+ return index.h("div", { class: "BlogContent", innerHTML: content });
182
+ }
183
+ if (this.bannerMatrixReady) {
184
+ return index.h("div", { class: "BlogContent", innerHTML: content });
185
+ }
186
+ return null;
187
+ };
188
+ this.cmsEndpoint = undefined;
189
+ this.language = 'en';
190
+ this.userRoles = 'everyone';
191
+ this.cmsEnv = 'stage';
192
+ this.clientStyling = '';
193
+ this.clientStylingUrl = '';
194
+ this.showPublishingDate = true;
195
+ this.showImage = true;
196
+ this.showTitle = true;
197
+ this.showContent = true;
198
+ this.showButton = true;
199
+ this.usePostmessage = undefined;
200
+ this.postMessageEvent = '';
201
+ this.blogsLimit = '0';
202
+ this.paginationActive = undefined;
203
+ this.arrowsActive = undefined;
204
+ this.secondaryArrowsActive = undefined;
205
+ this.numberedNavActive = undefined;
206
+ this.intlDateTimeFormat = '';
207
+ this.page = '1';
208
+ this.paginationBlogList = {
209
+ offset: 0
210
+ };
211
+ this.currentPage = 0;
212
+ this.hasErrors = false;
213
+ this.isLoading = true;
214
+ this.bannerMatrixReady = false;
215
+ this.nextPage = '';
216
+ this.previousPage = '';
217
+ this.device = '';
218
+ this.blogData = undefined;
219
+ this.totalBlogs = 0;
258
220
  }
259
- else {
260
- this.ArticleActionButton.emit({ postId, slug, customPath });
221
+ getArticleId(postId, slug, customPath) {
222
+ if (this.usePostmessage) {
223
+ window.postMessage({ type: this.postMessageEvent, postId, slug, customPath });
224
+ }
225
+ else {
226
+ this.articleActionButton.emit({ postId, slug, customPath });
227
+ }
261
228
  }
262
- }
263
- // Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
264
- handleBannerReady() {
265
- this.bannerMatrixReady = true;
266
- }
267
- watchEndpoint(newValue, oldValue) {
268
- this.currentPage = parseInt(this.page) - 1;
269
- if (newValue && newValue != oldValue && this.cmsEndpoint && this.language) {
270
- this.getBlogArticleGrid();
229
+ // Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
230
+ handleBannerReady() {
231
+ this.bannerMatrixReady = true;
271
232
  }
272
- }
273
- handleStylingChange(newValue, oldValue) {
274
- if (newValue !== oldValue) {
275
- this.fetchClientStyling().then(_ => this.setClientStyling());
233
+ watchEndpoint(newValue, oldValue) {
234
+ this.currentPage = parseInt(this.page) - 1;
235
+ if (newValue && newValue != oldValue && this.cmsEndpoint && this.language) {
236
+ this.getBlogArticleGrid();
237
+ }
276
238
  }
277
- }
278
- hpPageChange(event) {
279
- var _a, _b;
280
- this.paginationBlogList = event.detail;
281
- this.currentPage = Math.floor(((_a = this.paginationBlogList) === null || _a === void 0 ? void 0 : _a.offset) / ((_b = this.paginationBlogList) === null || _b === void 0 ? void 0 : _b.limit));
282
- if (this.page) {
283
- this.currentPage = this.currentPage + +this.page - 1;
239
+ handleStylingChange(newValue, oldValue) {
240
+ if (newValue !== oldValue) {
241
+ this.fetchClientStyling().then(_ => this.setClientStyling());
242
+ }
284
243
  }
285
- if (this.currentPage + 1 > this.lastPage) {
286
- this.nextPage = null;
287
- return;
244
+ hpPageChange(event) {
245
+ var _a, _b;
246
+ this.paginationBlogList = event.detail;
247
+ this.currentPage = Math.floor(((_a = this.paginationBlogList) === null || _a === void 0 ? void 0 : _a.offset) / ((_b = this.paginationBlogList) === null || _b === void 0 ? void 0 : _b.limit));
248
+ if (this.page) {
249
+ this.currentPage = this.currentPage + +this.page - 1;
250
+ }
251
+ if (this.currentPage + 1 > this.lastPage) {
252
+ this.nextPage = null;
253
+ return;
254
+ }
255
+ if (this.currentPage < 0) {
256
+ this.previousPage = null;
257
+ return;
258
+ }
259
+ window.postMessage({ type: 'BlogArticlesGridActivePagination', currentPage: this.currentPage }, window.location.href);
260
+ this.getBlogArticleGrid();
288
261
  }
289
- if (this.currentPage < 0) {
290
- this.previousPage = null;
291
- return;
262
+ sortArticlesByDate(arr) {
263
+ arr.sort((a, b) => {
264
+ if (a.publishingDate > b.publishingDate)
265
+ return -1;
266
+ if (a.publishingDate < b.publishingDate)
267
+ return 1;
268
+ return 0;
269
+ });
270
+ return arr;
292
271
  }
293
- window.postMessage({ type: 'BlogArticlesGridActivePagination', currentPage: this.currentPage }, window.location.href);
294
- this.getBlogArticleGrid();
295
- }
296
- sortArticlesByDate(arr) {
297
- arr.sort((a, b) => {
298
- if (a.publishingDate > b.publishingDate)
299
- return -1;
300
- if (a.publishingDate < b.publishingDate)
301
- return 1;
302
- return 0;
303
- });
304
- return arr;
305
- }
306
- findLatestFeatured(array) {
307
- let featuredItems = array.filter(item => item.isFeaturedPost);
308
- if (featuredItems.length === 0) {
309
- return null;
272
+ findLatestFeatured(array) {
273
+ let featuredItems = array.filter(item => item.isFeaturedPost);
274
+ if (featuredItems.length === 0) {
275
+ return null;
276
+ }
277
+ featuredItems = this.sortArticlesByDate(featuredItems);
278
+ return featuredItems[0];
310
279
  }
311
- featuredItems = this.sortArticlesByDate(featuredItems);
312
- return featuredItems[0];
313
- }
314
- moveLatestFeatureToStart(articlesArray, latestFeatured) {
315
- const index = articlesArray.indexOf(latestFeatured);
316
- if (index !== -1) {
317
- articlesArray.splice(index, 1);
318
- articlesArray.unshift(latestFeatured);
280
+ moveLatestFeatureToStart(articlesArray, latestFeatured) {
281
+ const index = articlesArray.indexOf(latestFeatured);
282
+ if (index !== -1) {
283
+ articlesArray.splice(index, 1);
284
+ articlesArray.unshift(latestFeatured);
285
+ }
286
+ return articlesArray;
319
287
  }
320
- return articlesArray;
321
- }
322
- getBlogArticleGrid(page) {
323
- this.isLoading = true;
324
- let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
325
- url.searchParams.append('per_page', this.blogsLimit);
326
- url.searchParams.append('page', JSON.stringify(page ? page : this.currentPage + 1));
327
- url.searchParams.append('env', this.cmsEnv);
328
- url.searchParams.append('userRoles', this.userRoles);
329
- url.searchParams.append('device', getDevicePlatform());
330
- fetch(url.href)
331
- .then((res) => {
332
- if (res.status >= 300) {
333
- this.hasErrors = true;
334
- throw new Error('There was an error while fetching the data');
335
- }
336
- return res.json();
337
- })
338
- .then((blogContent) => {
339
- this.lastPage = +blogContent.pages.last.match(/&page=(\d+)/)[1];
340
- let blogItems = blogContent.items;
341
- this.nextPage = blogContent.pages.next;
342
- this.previousPage = blogContent.pages.previous;
343
- this.totalBlogs = blogContent.total;
344
- const latestFeatured = this.findLatestFeatured(blogItems);
345
- this.blogData = this.sortArticlesByDate(blogItems);
346
- this.blogData = this.moveLatestFeatureToStart(blogItems, latestFeatured);
347
- this.blogData.items = blogItems.map((item) => {
348
- return Object.assign(Object.assign({}, item), { publishingDate: new Date(item.publishingDate).toLocaleDateString() });
349
- });
350
- this.isLoading = false;
351
- this.hasErrors = false;
352
- })
353
- .catch((err) => {
354
- this.hasErrors = true;
355
- console.log('Error', err);
356
- })
357
- .finally(() => this.isLoading = false);
358
- }
359
- connectedCallback() {
360
- if (this.cmsEndpoint && this.language && this.blogsLimit) {
361
- if (this.page) {
362
- this.currentPage = this.currentPage + +this.page - 1;
363
- this.getBlogArticleGrid(+this.page);
364
- }
365
- else {
366
- this.getBlogArticleGrid();
367
- }
288
+ getBlogArticleGrid(page) {
289
+ this.isLoading = true;
290
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
291
+ url.searchParams.append('per_page', this.blogsLimit);
292
+ url.searchParams.append('page', JSON.stringify(page ? page : this.currentPage + 1));
293
+ url.searchParams.append('env', this.cmsEnv);
294
+ url.searchParams.append('userRoles', this.userRoles);
295
+ url.searchParams.append('device', getDevicePlatform());
296
+ fetch(url.href)
297
+ .then((res) => {
298
+ if (res.status >= 300) {
299
+ this.hasErrors = true;
300
+ throw new Error('There was an error while fetching the data');
301
+ }
302
+ return res.json();
303
+ })
304
+ .then((blogContent) => {
305
+ this.lastPage = +blogContent.pages.last.match(/&page=(\d+)/)[1];
306
+ let blogItems = blogContent.items;
307
+ this.nextPage = blogContent.pages.next;
308
+ this.previousPage = blogContent.pages.previous;
309
+ this.totalBlogs = blogContent.total;
310
+ const latestFeatured = this.findLatestFeatured(blogItems);
311
+ this.blogData = this.sortArticlesByDate(blogItems);
312
+ this.blogData = this.moveLatestFeatureToStart(blogItems, latestFeatured);
313
+ this.blogData.items = blogItems.map((item) => {
314
+ return Object.assign(Object.assign({}, item), { publishingDate: new Date(item.publishingDate).toLocaleDateString() });
315
+ });
316
+ this.isLoading = false;
317
+ this.hasErrors = false;
318
+ })
319
+ .catch((err) => {
320
+ this.hasErrors = true;
321
+ console.log('Error', err);
322
+ })
323
+ .finally(() => this.isLoading = false);
368
324
  }
369
- }
370
- componentWillLoad() {
371
- if (this.clientStylingUrl)
372
- return this.fetchClientStyling();
373
- }
374
- componentDidLoad() {
375
- if (this.clientStyling || this.clientStylingUrl)
376
- this.setClientStyling();
377
- window.postMessage({ type: 'BlogArticlesGridLoaded' }, window.location.href);
378
- this.device = getDeviceCustom();
379
- }
380
- fetchClientStyling() {
381
- if (!this.clientStylingUrl)
382
- return;
383
- return new Promise(resolve => {
384
- fetch(this.clientStylingUrl)
385
- .then((res) => res.text())
386
- .then((data) => {
387
- resolve(data);
388
- this.clientStylingContent += data;
389
- })
390
- .catch((err) => {
391
- console.error('Error fetching Client Styling:', err);
392
- });
393
- });
394
- }
395
- formatDate(dateString) {
396
- return new Intl.DateTimeFormat(this.intlDateTimeFormat).format(new Date(dateString));
397
- }
398
- render() {
399
- var _a, _b;
400
- if (this.hasErrors) {
401
- return (index.h("div", { class: "BlogsContainer" }, index.h("div", { class: "ErrorMessage" }, translate$1('error', this.language))));
325
+ connectedCallback() {
326
+ if (this.cmsEndpoint && this.language && this.blogsLimit) {
327
+ if (this.page) {
328
+ this.currentPage = this.currentPage + +this.page - 1;
329
+ this.getBlogArticleGrid(+this.page);
330
+ }
331
+ else {
332
+ this.getBlogArticleGrid();
333
+ }
334
+ }
335
+ }
336
+ componentWillLoad() {
337
+ if (this.clientStylingUrl)
338
+ return this.fetchClientStyling();
402
339
  }
403
- // Create an array to store the placeholder elements for each card
404
- const placeholderCards = [];
405
- // Loop through the blogsLimit in order to generate the desired number of cards
406
- for (let i = 0; i < parseInt(this.blogsLimit); i++) {
407
- placeholderCards.push(index.h("div", { class: "GridContainer FeaturedPost Skeleton" }, index.h("div", { class: "GridWrapper" }, index.h("div", { class: "GridSector" }, index.h("div", { class: "VisualContent LoadingImage" })), index.h("div", { class: "GridSector" }, index.h("div", { class: "BlogTitle LoadingStripe LoadingSmallStripe" }), index.h("div", { class: "BlogDetails LoadingStripe LoadingMediumStripe" }), index.h("div", { class: "BlogLink LoadingStripe LoadingLongStripe" })))));
340
+ componentDidLoad() {
341
+ if (this.clientStyling || this.clientStylingUrl)
342
+ this.setClientStyling();
343
+ window.postMessage({ type: 'BlogArticlesGridLoaded' }, window.location.href);
344
+ this.device = getDeviceCustom();
408
345
  }
409
- return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "BlogPageContainer" }, index.h("div", { class: "BlogGridPaginationWrapper" }, this.paginationActive == true && this.totalBlogs > +this.blogsLimit && index.h("helper-pagination", { "next-page": this.nextPage, "prev-page": this.previousPage, offset: this.paginationBlogList.offset, limit: this.blogsLimit, total: (_b = (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.length, language: this.language, "client-styling": this.clientStyling || this.defaultStyling, "arrows-active": this.arrowsActive || true, "secondary-arrows-active": this.secondaryArrowsActive || false, "numbered-nav-active": this.numberedNavActive || false })), (!this.isLoading) &&
410
- index.h("div", { class: `GridContainerWrapper BlogPage-${this.currentPage}` }, this.blogData && this.blogData.map((data) => {
346
+ fetchClientStyling() {
347
+ if (!this.clientStylingUrl)
348
+ return;
349
+ return new Promise(resolve => {
350
+ fetch(this.clientStylingUrl)
351
+ .then((res) => res.text())
352
+ .then((data) => {
353
+ resolve(data);
354
+ this.clientStylingContent += data;
355
+ })
356
+ .catch((err) => {
357
+ console.error('Error fetching Client Styling:', err);
358
+ });
359
+ });
360
+ }
361
+ formatDate(dateString) {
362
+ return new Intl.DateTimeFormat(this.intlDateTimeFormat).format(new Date(dateString));
363
+ }
364
+ render() {
411
365
  var _a, _b;
412
- return index.h("div", { key: data.postID, class: data.isFeaturedPost ? 'GridContainer FeaturedPost' : 'GridContainer' }, index.h("div", { class: "GridWrapper" }, index.h("div", { class: "GridSector" }, this.showPublishingDate &&
413
- index.h("div", { class: "BlogDate" }, this.formatDate(data === null || data === void 0 ? void 0 : data.publishingDate)), this.showImage && ((_a = data.image) === null || _a === void 0 ? void 0 : _a.src) ? (index.h("div", { class: "VisualContent", style: { background: `url(${this.setImage(data.image)}) no-repeat center center / cover` } })) : (((_b = data.video) === null || _b === void 0 ? void 0 : _b.sources[this.device]) ? (index.h("video", { class: "VisualContent", src: data.video.sources[this.device], controls: true })) : (index.h("h1", { class: "VisualContent", style: { color: "#fff" } }, "No Image")))), index.h("div", { class: "GridSector" }, this.showTitle &&
414
- index.h("div", { class: "BlogTitle" }, data === null || data === void 0 ? void 0 : data.title), this.showContent &&
415
- this.renderContentConditionally(data === null || data === void 0 ? void 0 : data.descriptionPreview), this.showButton &&
416
- index.h("div", { class: "BlogLink" }, index.h("button", { onClick: () => this.getArticleId(data === null || data === void 0 ? void 0 : data.postID, data === null || data === void 0 ? void 0 : data.slug, data === null || data === void 0 ? void 0 : data.customPath) }, translate$1('readmore', this.language))))));
417
- })), (this.isLoading) &&
418
- index.h("div", { class: "GridContainerWrapper LoadingGrid" }, placeholderCards))));
419
- }
420
- static get watchers() { return {
421
- "page": ["watchEndpoint"],
422
- "hasErrors": ["watchEndpoint"],
423
- "cmsEndpoint": ["watchEndpoint"],
424
- "language": ["watchEndpoint"],
425
- "cmsEnv": ["watchEndpoint"],
426
- "userRoles": ["watchEndpoint"],
427
- "blogsLimit": ["watchEndpoint"],
428
- "clientStyling": ["handleStylingChange"],
429
- "clientStylingUrl": ["handleStylingChange"]
430
- }; }
366
+ if (this.hasErrors) {
367
+ return (index.h("div", { class: "BlogsContainer" }, index.h("div", { class: "ErrorMessage" }, translate$1('error', this.language))));
368
+ }
369
+ // Create an array to store the placeholder elements for each card
370
+ const placeholderCards = [];
371
+ // Loop through the blogsLimit in order to generate the desired number of cards
372
+ for (let i = 0; i < parseInt(this.blogsLimit); i++) {
373
+ placeholderCards.push(index.h("div", { class: "GridContainer FeaturedPost Skeleton" }, index.h("div", { class: "GridWrapper" }, index.h("div", { class: "GridSector" }, index.h("div", { class: "VisualContent LoadingImage" })), index.h("div", { class: "GridSector" }, index.h("div", { class: "BlogTitle LoadingStripe LoadingSmallStripe" }), index.h("div", { class: "BlogDetails LoadingStripe LoadingMediumStripe" }), index.h("div", { class: "BlogLink LoadingStripe LoadingLongStripe" })))));
374
+ }
375
+ return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "BlogPageContainer" }, index.h("div", { class: "BlogGridPaginationWrapper" }, this.paginationActive == true && this.totalBlogs > +this.blogsLimit && index.h("helper-pagination", { "next-page": this.nextPage, "prev-page": this.previousPage, offset: this.paginationBlogList.offset, limit: parseInt(this.blogsLimit, 10), total: (_b = (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.length, language: this.language, "client-styling": this.clientStyling || this.defaultStyling, "arrows-active": this.arrowsActive || true, "secondary-arrows-active": this.secondaryArrowsActive || false, "numbered-nav-active": this.numberedNavActive || false })), (!this.isLoading) &&
376
+ index.h("div", { class: `GridContainerWrapper BlogPage-${this.currentPage}` }, this.blogData && this.blogData.map((data) => {
377
+ var _a, _b;
378
+ return index.h("div", { key: data.postID, class: data.isFeaturedPost ? 'GridContainer FeaturedPost' : 'GridContainer' }, index.h("div", { class: "GridWrapper" }, index.h("div", { class: "GridSector" }, this.showPublishingDate &&
379
+ index.h("div", { class: "BlogDate" }, this.formatDate(data === null || data === void 0 ? void 0 : data.publishingDate)), this.showImage && ((_a = data.image) === null || _a === void 0 ? void 0 : _a.src) ? (index.h("div", { class: "VisualContent", style: { background: `url(${this.setImage(data.image)}) no-repeat center center / cover` } })) : (((_b = data.video) === null || _b === void 0 ? void 0 : _b.sources[this.device]) ? (index.h("video", { class: "VisualContent", src: data.video.sources[this.device], controls: true })) : (index.h("h1", { class: "VisualContent", style: { color: "#fff" } }, "No Image")))), index.h("div", { class: "GridSector" }, this.showTitle &&
380
+ index.h("div", { class: "BlogTitle" }, data === null || data === void 0 ? void 0 : data.title), this.showContent &&
381
+ this.renderContentConditionally(data === null || data === void 0 ? void 0 : data.descriptionPreview), this.showButton &&
382
+ index.h("div", { class: "BlogLink" }, index.h("button", { onClick: () => this.getArticleId(data === null || data === void 0 ? void 0 : data.postID, data === null || data === void 0 ? void 0 : data.slug, data === null || data === void 0 ? void 0 : data.customPath) }, translate$1('readmore', this.language))))));
383
+ })), (this.isLoading) &&
384
+ index.h("div", { class: "GridContainerWrapper LoadingGrid" }, placeholderCards))));
385
+ }
386
+ static get watchers() { return {
387
+ "page": ["watchEndpoint"],
388
+ "hasErrors": ["watchEndpoint"],
389
+ "cmsEndpoint": ["watchEndpoint"],
390
+ "language": ["watchEndpoint"],
391
+ "cmsEnv": ["watchEndpoint"],
392
+ "userRoles": ["watchEndpoint"],
393
+ "blogsLimit": ["watchEndpoint"],
394
+ "clientStyling": ["handleStylingChange"],
395
+ "clientStylingUrl": ["handleStylingChange"]
396
+ }; }
431
397
  };
432
- BlogArticlesGrid.style = blogArticlesGridCss;
398
+ BlogArticlesGrid.style = BlogArticlesGridStyle0;
433
399
 
434
400
  /**
435
401
  * @name isMobile
@@ -438,247 +404,218 @@ BlogArticlesGrid.style = blogArticlesGridCss;
438
404
  * @returns {Boolean} true or false
439
405
  */
440
406
  const isMobile = (userAgent) => {
441
- return !!(userAgent.toLowerCase().match(/android/i) ||
442
- userAgent.toLowerCase().match(/blackberry|bb/i) ||
443
- userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
444
- userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
407
+ return !!(userAgent.toLowerCase().match(/android/i) ||
408
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
409
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
410
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
445
411
  };
446
412
 
447
413
  const DEFAULT_LANGUAGE = 'en';
448
414
  const TRANSLATIONS = {
449
- en: {
450
- firstPage: 'First',
451
- previousPage: 'Previous',
452
- nextPage: 'Next',
453
- lastPage: 'Last'
454
- },
455
- ro: {
456
- firstPage: 'Prima',
457
- previousPage: 'Anterior',
458
- nextPage: 'Urmatoarea',
459
- lastPage: 'Ultima'
460
- },
461
- fr: {
462
- firstPage: 'First',
463
- previousPage: 'Previous',
464
- nextPage: 'Next',
465
- lastPage: 'Last'
466
- },
467
- ar: {
468
- firstPage: 'First',
469
- previousPage: 'Previous',
470
- nextPage: 'Next',
471
- lastPage: 'Last'
472
- },
473
- hu: {
474
- firstPage: 'First',
475
- previousPage: 'Previous',
476
- nextPage: 'Következő',
477
- lastPage: 'Last'
478
- },
479
- hr: {
480
- firstPage: 'Prva',
481
- previousPage: 'Prethodna',
482
- nextPage: 'Slijedeća',
483
- lastPage: 'Zadnja'
484
- }
415
+ en: {
416
+ firstPage: 'First',
417
+ previousPage: 'Previous',
418
+ nextPage: 'Next',
419
+ lastPage: 'Last'
420
+ },
421
+ ro: {
422
+ firstPage: 'Prima',
423
+ previousPage: 'Anterior',
424
+ nextPage: 'Urmatoarea',
425
+ lastPage: 'Ultima'
426
+ },
427
+ fr: {
428
+ firstPage: 'First',
429
+ previousPage: 'Previous',
430
+ nextPage: 'Next',
431
+ lastPage: 'Last'
432
+ },
433
+ ar: {
434
+ firstPage: 'First',
435
+ previousPage: 'Previous',
436
+ nextPage: 'Next',
437
+ lastPage: 'Last'
438
+ },
439
+ hu: {
440
+ firstPage: 'First',
441
+ previousPage: 'Previous',
442
+ nextPage: 'Következő',
443
+ lastPage: 'Last'
444
+ },
445
+ hr: {
446
+ firstPage: 'Prva',
447
+ previousPage: 'Prethodna',
448
+ nextPage: 'Slijedeća',
449
+ lastPage: 'Zadnja'
450
+ }
485
451
  };
486
452
  const translate = (key, customLang) => {
487
- const lang = customLang;
488
- return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
453
+ const lang = customLang;
454
+ return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
489
455
  };
490
456
 
491
457
  const helperPaginationCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}#PaginationContainer{width:100%;margin:20px 0;display:inline-flex;justify-content:space-between;align-items:center}.LeftItems button:not(:first-child),.RightItems button:not(:last-child){margin:0 10px}.LeftItems button,.RightItems button{padding:0;background-color:#009993;border-color:#009993}.PaginationArea{display:inline-flex;gap:10px;list-style:none}.PaginationArea li{margin:0;padding:0}.PaginationArea li button{width:24px;height:24px;display:flex;border:0;padding:0;justify-content:center;align-items:center;background-color:transparent;color:#000;cursor:pointer;pointer-events:all}.PaginationItem.ActiveItem button{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem button:disabled{pointer-events:none;cursor:not-allowed}.PaginationItem button:hover,.PaginationItem button:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}button{width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:all 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}button:hover,button:active{background:#004D4A;border-color:#004D4A}button:disabled{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 720px){button{width:90px;font-size:14px}}@media screen and (max-width: 480px){button{width:70px;font-size:14px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:12px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem button:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem button:hover{background:#009993;border-color:#009993;color:#fff}}";
458
+ const HelperPaginationStyle0 = helperPaginationCss;
492
459
 
493
460
  const HelperPagination = class {
494
- constructor(hostRef) {
495
- index.registerInstance(this, hostRef);
496
- this.hpPageChange = index.createEvent(this, "hpPageChange", 7);
497
- /**
498
- * Next page string value - determines if the next page is disabled or active
499
- */
500
- this.nextPage = '';
501
- /**
502
- * Previous page string value - determines if the previous page is disabled or active
503
- */
504
- this.prevPage = '';
505
- /**
506
- * The received offset
507
- */
508
- this.offset = 0;
509
- /**
510
- * The received limit for the number of pages
511
- */
512
- this.limit = 1;
513
- /**
514
- * The received total number of pages
515
- */
516
- this.total = 1;
517
- /**
518
- * Language
519
- */
520
- this.language = 'en';
521
- /**
522
- * Client custom styling via string
523
- */
524
- this.clientStyling = '';
525
- /**
526
- * Client custom styling via url content
527
- */
528
- this.clientStylingUrlContent = '';
529
- /**
530
- * Component working variable for last page
531
- */
532
- this.lastPage = false;
533
- /**
534
- * Component working variable for prvious page
535
- */
536
- this.previousPage = false;
537
- /**
538
- * In component working variable for the array of pages
539
- */
540
- this.pagesArray = [];
541
- /**
542
- * In component working variable for last page
543
- */
544
- this.endInt = 0;
545
- this.userAgent = window.navigator.userAgent;
546
- this.currentPage = 1;
547
- this.limitStylingAppends = false;
548
- /**
549
- * Navigation logic
550
- */
551
- this.navigateTo = (navigationPage) => {
552
- switch (navigationPage) {
553
- case 'firstPage':
554
- this.offsetInt = 0;
555
- break;
556
- case 'lastPage':
557
- this.offsetInt = this.endInt * this.limitInt;
558
- break;
559
- case 'previousPage':
560
- this.offsetInt -= this.limitInt;
561
- break;
562
- case 'nextPage':
563
- this.offsetInt += this.limitInt;
564
- break;
565
- case 'fivePagesBack':
566
- this.offsetInt -= this.limitInt * 5;
567
- this.offsetInt = this.offsetInt <= 0 ? 0 : this.offsetInt;
568
- break;
569
- case 'fivePagesForward':
570
- this.offsetInt += this.limitInt * 5;
571
- this.offsetInt = this.offsetInt / this.limitInt >= this.endInt ? this.endInt * this.limitInt : this.offsetInt;
572
- break;
573
- }
574
- this.previousPage = !this.offsetInt ? false : true;
575
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
576
- };
577
- /**
578
- * Handle navigation from here
579
- */
580
- this.paginationNavigation = (pageNumber, index) => {
581
- this.previousPage = true;
582
- if (!isNaN(pageNumber)) {
583
- if (pageNumber === 1) {
584
- this.offsetInt = pageNumber - 1;
585
- this.previousPage = false;
586
- }
587
- else {
588
- this.offsetInt = (pageNumber - 1) * this.limitInt;
589
- }
590
- }
591
- else {
592
- if (index === 0 && this.currentPage <= 4) {
593
- this.navigateTo('firstPage');
461
+ constructor(hostRef) {
462
+ index.registerInstance(this, hostRef);
463
+ this.hpPageChange = index.createEvent(this, "hpPageChange", 7);
464
+ this.userAgent = window.navigator.userAgent;
465
+ this.currentPage = 1;
466
+ /**
467
+ * Navigation logic
468
+ */
469
+ this.navigateTo = (navigationPage) => {
470
+ switch (navigationPage) {
471
+ case 'firstPage':
472
+ this.offsetInt = 0;
473
+ break;
474
+ case 'lastPage':
475
+ this.offsetInt = this.endInt * this.limitInt;
476
+ break;
477
+ case 'previousPage':
478
+ this.offsetInt -= this.limitInt;
479
+ break;
480
+ case 'nextPage':
481
+ this.offsetInt += this.limitInt;
482
+ break;
483
+ case 'fivePagesBack':
484
+ this.offsetInt -= this.limitInt * 5;
485
+ this.offsetInt = this.offsetInt <= 0 ? 0 : this.offsetInt;
486
+ break;
487
+ case 'fivePagesForward':
488
+ this.offsetInt += this.limitInt * 5;
489
+ this.offsetInt = this.offsetInt / this.limitInt >= this.endInt ? this.endInt * this.limitInt : this.offsetInt;
490
+ break;
491
+ }
492
+ this.previousPage = !this.offsetInt ? false : true;
493
+ this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
494
+ };
495
+ /**
496
+ * Handle navigation from here
497
+ */
498
+ this.paginationNavigation = (pageNumber, index) => {
499
+ this.previousPage = true;
500
+ if (!isNaN(pageNumber)) {
501
+ if (pageNumber === 1) {
502
+ this.offsetInt = pageNumber - 1;
503
+ this.previousPage = false;
504
+ }
505
+ else {
506
+ this.offsetInt = (pageNumber - 1) * this.limitInt;
507
+ }
508
+ }
509
+ else {
510
+ if (index === 0 && this.currentPage <= 4) {
511
+ this.navigateTo('firstPage');
512
+ }
513
+ else if (index === 0 && this.currentPage > 4) {
514
+ this.navigateTo('fivePagesBack');
515
+ }
516
+ else if (index === 4 && this.endInt - this.currentPage >= 2) {
517
+ this.navigateTo('fivePagesForward');
518
+ }
519
+ }
520
+ this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
521
+ };
522
+ this.setClientStyling = () => {
523
+ let sheet = document.createElement('style');
524
+ sheet.innerHTML = this.clientStyling;
525
+ this.stylingContainer.prepend(sheet);
526
+ };
527
+ this.setClientStylingURL = () => {
528
+ let cssFile = document.createElement('style');
529
+ setTimeout(() => {
530
+ cssFile.innerHTML = this.clientStylingUrlContent;
531
+ this.stylingContainer.prepend(cssFile);
532
+ }, 1);
533
+ };
534
+ this.nextPage = '';
535
+ this.prevPage = '';
536
+ this.offset = 0;
537
+ this.limit = 1;
538
+ this.total = 1;
539
+ this.language = 'en';
540
+ this.clientStyling = '';
541
+ this.clientStylingUrlContent = '';
542
+ this.arrowsActive = undefined;
543
+ this.secondaryArrowsActive = undefined;
544
+ this.numberedNavActive = undefined;
545
+ this.offsetInt = undefined;
546
+ this.lastPage = false;
547
+ this.previousPage = false;
548
+ this.limitInt = undefined;
549
+ this.totalInt = undefined;
550
+ this.pagesArray = [];
551
+ this.endInt = 0;
552
+ this.limitStylingAppends = false;
553
+ }
554
+ componentWillRender() {
555
+ this.offsetInt = this.offset;
556
+ this.limitInt = this.limit;
557
+ this.currentPage = (this.offsetInt / this.limitInt) + 1;
558
+ this.limitInt = this.limit;
559
+ this.totalInt = this.total;
560
+ this.endInt = (Math.ceil(this.totalInt / this.limitInt) - 1);
561
+ this.lastPage = (this.offsetInt >= this.endInt * this.limitInt) ? false : true;
562
+ /**
563
+ * Construct numbered navigation area based on current page position
564
+ */
565
+ if (this.currentPage == 1 || this.currentPage == 2) {
566
+ this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
567
+ this.pagesArray.push('...');
594
568
  }
595
- else if (index === 0 && this.currentPage > 4) {
596
- this.navigateTo('fivePagesBack');
569
+ else if (this.currentPage >= 3 && ((this.endInt - this.currentPage) >= 2)) {
570
+ this.pagesArray = Array.from({ length: 3 }, (_, i) => this.currentPage + i - 1);
571
+ this.pagesArray.push('...');
572
+ this.pagesArray.unshift('...');
597
573
  }
598
- else if (index === 4 && this.endInt - this.currentPage >= 2) {
599
- this.navigateTo('fivePagesForward');
574
+ else if ((this.endInt - this.currentPage) < 3) {
575
+ this.pagesArray = Array.from({ length: 4 }, (_, i) => this.endInt - 2 + i);
576
+ this.pagesArray.unshift('...');
600
577
  }
601
- }
602
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
603
- };
604
- this.setClientStyling = () => {
605
- let sheet = document.createElement('style');
606
- sheet.innerHTML = this.clientStyling;
607
- this.stylingContainer.prepend(sheet);
608
- };
609
- this.setClientStylingURL = () => {
610
- let cssFile = document.createElement('style');
611
- setTimeout(() => {
612
- cssFile.innerHTML = this.clientStylingUrlContent;
613
- this.stylingContainer.prepend(cssFile);
614
- }, 1);
615
- };
616
- }
617
- componentWillRender() {
618
- this.offsetInt = this.offset;
619
- this.limitInt = this.limit;
620
- this.currentPage = (this.offsetInt / this.limitInt) + 1;
621
- this.limitInt = this.limit;
622
- this.totalInt = this.total;
623
- this.endInt = (Math.ceil(this.totalInt / this.limitInt) - 1);
624
- this.lastPage = (this.offsetInt >= this.endInt * this.limitInt) ? false : true;
625
- /**
626
- * Construct numbered navigation area based on current page position
627
- */
628
- if (this.currentPage == 1 || this.currentPage == 2) {
629
- this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
630
- this.pagesArray.push('...');
631
578
  }
632
- else if (this.currentPage >= 3 && ((this.endInt - this.currentPage) >= 2)) {
633
- this.pagesArray = Array.from({ length: 3 }, (_, i) => this.currentPage + i - 1);
634
- this.pagesArray.push('...');
635
- this.pagesArray.unshift('...');
636
- }
637
- else if ((this.endInt - this.currentPage) < 3) {
638
- this.pagesArray = Array.from({ length: 4 }, (_, i) => this.endInt - 2 + i);
639
- this.pagesArray.unshift('...');
640
- }
641
- }
642
- componentDidRender() {
643
- // start custom styling area
644
- if (!this.limitStylingAppends && this.stylingContainer) {
645
- if (this.clientStyling)
646
- this.setClientStyling();
647
- if (this.clientStylingUrlContent)
648
- this.setClientStylingURL();
649
- this.limitStylingAppends = true;
650
- }
651
- // end custom styling area
652
- }
653
- render() {
654
- /**
655
- * Center navigation area
656
- */
657
- let navigationArea = index.h("ul", { class: "PaginationArea" }, this.pagesArray.map((item, index$1) => {
658
- return (index.h("li", { class: 'PaginationItem' + (item === this.currentPage ? ' ActiveItem' : ' ') + ' ' + (isMobile(this.userAgent) ? 'MobileButtons' : '') }, index.h("button", { disabled: item === this.currentPage ? true : false, onClick: this.paginationNavigation.bind(this, item, index$1) }, index.h("span", null, item))));
659
- }));
660
- /**
661
- * Left navigation area
662
- */
663
- let buttonSecondaryLeftSide = index.h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'firstPage') }, index.h("span", { class: "NavigationButton" }, translate('firstPage', this.language)), index.h("span", { class: "NavigationIcon" }));
664
- let buttonsLeftSide = index.h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, index.h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'previousPage') }, index.h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), index.h("span", { class: "NavigationIcon" })));
665
- if (isMobile(this.userAgent)) {
666
- buttonsLeftSide =
667
- index.h("div", { class: "LeftItems" }, index.h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'previousPage') }, index.h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), index.h("span", { class: "NavigationIcon" })));
579
+ componentDidRender() {
580
+ // start custom styling area
581
+ if (!this.limitStylingAppends && this.stylingContainer) {
582
+ if (this.clientStyling)
583
+ this.setClientStyling();
584
+ if (this.clientStylingUrlContent)
585
+ this.setClientStylingURL();
586
+ this.limitStylingAppends = true;
587
+ }
588
+ // end custom styling area
668
589
  }
669
- /**
670
- * Right navigation area
671
- */
672
- let buttonSecondaryRightSide = index.h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'lastPage') }, index.h("span", { class: "NavigationButton" }, translate('lastPage', this.language)), index.h("span", { class: "NavigationIcon" }));
673
- let buttonsRightSide = index.h("div", { class: "RightItems" }, index.h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'nextPage') }, index.h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), index.h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
674
- if (isMobile(this.userAgent)) {
675
- buttonsRightSide =
676
- index.h("div", { class: "RightItems" }, index.h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'nextPage') }, index.h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), index.h("span", { class: "NavigationIcon" })));
590
+ render() {
591
+ /**
592
+ * Center navigation area
593
+ */
594
+ let navigationArea = index.h("ul", { class: "PaginationArea" }, this.pagesArray.map((item, index$1) => {
595
+ return (index.h("li", { class: 'PaginationItem' + (item === this.currentPage ? ' ActiveItem' : ' ') + ' ' + (isMobile(this.userAgent) ? 'MobileButtons' : '') }, index.h("button", { disabled: item === this.currentPage ? true : false, onClick: this.paginationNavigation.bind(this, item, index$1) }, index.h("span", null, item))));
596
+ }));
597
+ /**
598
+ * Left navigation area
599
+ */
600
+ let buttonSecondaryLeftSide = index.h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'firstPage') }, index.h("span", { class: "NavigationButton" }, translate('firstPage', this.language)), index.h("span", { class: "NavigationIcon" }));
601
+ let buttonsLeftSide = index.h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, index.h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'previousPage') }, index.h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), index.h("span", { class: "NavigationIcon" })));
602
+ if (isMobile(this.userAgent)) {
603
+ buttonsLeftSide =
604
+ index.h("div", { class: "LeftItems" }, index.h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'previousPage') }, index.h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), index.h("span", { class: "NavigationIcon" })));
605
+ }
606
+ /**
607
+ * Right navigation area
608
+ */
609
+ let buttonSecondaryRightSide = index.h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'lastPage') }, index.h("span", { class: "NavigationButton" }, translate('lastPage', this.language)), index.h("span", { class: "NavigationIcon" }));
610
+ let buttonsRightSide = index.h("div", { class: "RightItems" }, index.h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'nextPage') }, index.h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), index.h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
611
+ if (isMobile(this.userAgent)) {
612
+ buttonsRightSide =
613
+ index.h("div", { class: "RightItems" }, index.h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'nextPage') }, index.h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), index.h("span", { class: "NavigationIcon" })));
614
+ }
615
+ return (index.h("div", { id: "PaginationContainer", ref: el => this.stylingContainer = el }, this.arrowsActive && buttonsLeftSide, this.numberedNavActive && navigationArea, this.arrowsActive && buttonsRightSide));
677
616
  }
678
- return (index.h("div", { id: "PaginationContainer", ref: el => this.stylingContainer = el }, this.arrowsActive && buttonsLeftSide, this.numberedNavActive && navigationArea, this.arrowsActive && buttonsRightSide));
679
- }
680
617
  };
681
- HelperPagination.style = helperPaginationCss;
618
+ HelperPagination.style = HelperPaginationStyle0;
682
619
 
683
620
  exports.blog_articles_grid = BlogArticlesGrid;
684
621
  exports.helper_pagination = HelperPagination;