@everymatrix/blog-articles-grid 1.34.2 → 1.34.3
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 +1 -1
- package/dist/blog-articles-grid/blog-articles-grid.esm.js +0 -1
- package/dist/blog-articles-grid/index.esm.js +0 -0
- package/dist/blog-articles-grid/p-13642dde.js +0 -1
- package/dist/blog-articles-grid/p-430e371b.entry.js +0 -1
- package/dist/cjs/blog-articles-grid.cjs.js +0 -19
- package/dist/cjs/blog-articles-grid_2.cjs.entry.js +0 -681
- package/dist/cjs/index-a88a1a42.js +0 -1352
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/collection/collection-manifest.json +0 -19
- package/dist/collection/components/blog-articles-grid/blog-articles-grid.css +0 -167
- package/dist/collection/components/blog-articles-grid/blog-articles-grid.js +0 -773
- package/dist/collection/index.js +0 -1
- package/dist/collection/utils/locale.utils.js +0 -40
- package/dist/collection/utils/utils.js +0 -67
- package/dist/components/blog-articles-grid.d.ts +0 -11
- package/dist/components/blog-articles-grid.js +0 -482
- package/dist/components/helper-pagination.js +0 -6
- package/dist/components/helper-pagination2.js +0 -288
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/esm/blog-articles-grid.js +0 -17
- package/dist/esm/blog-articles-grid_2.entry.js +0 -676
- package/dist/esm/index-3600ba1b.js +0 -1326
- 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/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/blog-articles-grid/.stencil/packages/blog-articles-grid/stencil.config.d.ts +0 -2
- package/dist/types/components/blog-articles-grid/blog-articles-grid.d.ts +0 -116
- package/dist/types/components.d.ts +0 -198
- 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 -4
- 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
package/dist/collection/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components';
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu', 'hr'];
|
|
3
|
-
const TRANSLATIONS = {
|
|
4
|
-
en: {
|
|
5
|
-
error: 'Error',
|
|
6
|
-
readmore: 'Read more',
|
|
7
|
-
},
|
|
8
|
-
ro: {
|
|
9
|
-
error: 'Eroare',
|
|
10
|
-
readmore: 'Read more',
|
|
11
|
-
},
|
|
12
|
-
fr: {
|
|
13
|
-
error: 'Error',
|
|
14
|
-
readmore: 'Read more',
|
|
15
|
-
},
|
|
16
|
-
ar: {
|
|
17
|
-
error: 'خطأ',
|
|
18
|
-
readmore: 'Read more',
|
|
19
|
-
},
|
|
20
|
-
hu: {
|
|
21
|
-
error: 'خطأ',
|
|
22
|
-
readmore: 'Tovább olvasom',
|
|
23
|
-
},
|
|
24
|
-
hr: {
|
|
25
|
-
error: 'Greška',
|
|
26
|
-
readmore: 'Pročitaj više'
|
|
27
|
-
},
|
|
28
|
-
'pt-br': {
|
|
29
|
-
error: 'Erro',
|
|
30
|
-
readmore: 'Ler mais'
|
|
31
|
-
},
|
|
32
|
-
'es-mx': {
|
|
33
|
-
error: 'Error',
|
|
34
|
-
readmore: 'Leer más'
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
export const translate = (key, customLang) => {
|
|
38
|
-
const lang = customLang;
|
|
39
|
-
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
40
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
export function checkDeviceType() {
|
|
2
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
3
|
-
const width = screen.availWidth;
|
|
4
|
-
const height = screen.availHeight;
|
|
5
|
-
if (userAgent.includes('iphone')) {
|
|
6
|
-
return 'mobile';
|
|
7
|
-
}
|
|
8
|
-
if (userAgent.includes('android')) {
|
|
9
|
-
if (height > width && width < 800) {
|
|
10
|
-
return 'mobile';
|
|
11
|
-
}
|
|
12
|
-
if (width > height && height < 800) {
|
|
13
|
-
return 'tablet';
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return 'desktop';
|
|
17
|
-
}
|
|
18
|
-
function checkCustomDeviceWidth() {
|
|
19
|
-
const width = screen.availWidth;
|
|
20
|
-
if (width < 600) {
|
|
21
|
-
return 'mobile';
|
|
22
|
-
}
|
|
23
|
-
else if (width >= 600 && width < 1100) {
|
|
24
|
-
return 'tablet';
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function isIpad() {
|
|
28
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
29
|
-
// Traditional iPad user agent
|
|
30
|
-
if (userAgent.includes('ipad')) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
return userAgent.indexOf('macintosh') > -1 && navigator.maxTouchPoints && navigator.maxTouchPoints > 2;
|
|
34
|
-
}
|
|
35
|
-
export function getDeviceCustom() {
|
|
36
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
37
|
-
let source = '';
|
|
38
|
-
source = (userAgent.includes('android') || userAgent.includes('iphone') || isIpad()) ? checkCustomDeviceWidth() : 'desktop';
|
|
39
|
-
return source;
|
|
40
|
-
}
|
|
41
|
-
export const getDevice = () => {
|
|
42
|
-
let userAgent = window.navigator.userAgent;
|
|
43
|
-
if (userAgent.toLowerCase().match(/android/i)) {
|
|
44
|
-
return 'Android';
|
|
45
|
-
}
|
|
46
|
-
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
47
|
-
return 'iPhone';
|
|
48
|
-
}
|
|
49
|
-
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
50
|
-
return 'iPad';
|
|
51
|
-
}
|
|
52
|
-
return 'PC';
|
|
53
|
-
};
|
|
54
|
-
export const getDevicePlatform = () => {
|
|
55
|
-
const device = getDevice();
|
|
56
|
-
if (device) {
|
|
57
|
-
if (device === 'PC') {
|
|
58
|
-
return 'dk';
|
|
59
|
-
}
|
|
60
|
-
else if (device === 'iPad' || device === 'iPhone') {
|
|
61
|
-
return 'mtWeb';
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
return 'mtWeb';
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface BlogArticlesGrid extends Components.BlogArticlesGrid, HTMLElement {}
|
|
4
|
-
export const BlogArticlesGrid: {
|
|
5
|
-
prototype: BlogArticlesGrid;
|
|
6
|
-
new (): BlogArticlesGrid;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,482 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { d as defineCustomElement$2 } from './helper-pagination2.js';
|
|
3
|
-
|
|
4
|
-
const DEFAULT_LANGUAGE = 'en';
|
|
5
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu', 'hr'];
|
|
6
|
-
const TRANSLATIONS = {
|
|
7
|
-
en: {
|
|
8
|
-
error: 'Error',
|
|
9
|
-
readmore: 'Read more',
|
|
10
|
-
},
|
|
11
|
-
ro: {
|
|
12
|
-
error: 'Eroare',
|
|
13
|
-
readmore: 'Read more',
|
|
14
|
-
},
|
|
15
|
-
fr: {
|
|
16
|
-
error: 'Error',
|
|
17
|
-
readmore: 'Read more',
|
|
18
|
-
},
|
|
19
|
-
ar: {
|
|
20
|
-
error: 'خطأ',
|
|
21
|
-
readmore: 'Read more',
|
|
22
|
-
},
|
|
23
|
-
hu: {
|
|
24
|
-
error: 'خطأ',
|
|
25
|
-
readmore: 'Tovább olvasom',
|
|
26
|
-
},
|
|
27
|
-
hr: {
|
|
28
|
-
error: 'Greška',
|
|
29
|
-
readmore: 'Pročitaj više'
|
|
30
|
-
},
|
|
31
|
-
'pt-br': {
|
|
32
|
-
error: 'Erro',
|
|
33
|
-
readmore: 'Ler mais'
|
|
34
|
-
},
|
|
35
|
-
'es-mx': {
|
|
36
|
-
error: 'Error',
|
|
37
|
-
readmore: 'Leer más'
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const translate = (key, customLang) => {
|
|
41
|
-
const lang = customLang;
|
|
42
|
-
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
function checkCustomDeviceWidth() {
|
|
46
|
-
const width = screen.availWidth;
|
|
47
|
-
if (width < 600) {
|
|
48
|
-
return 'mobile';
|
|
49
|
-
}
|
|
50
|
-
else if (width >= 600 && width < 1100) {
|
|
51
|
-
return 'tablet';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function isIpad() {
|
|
55
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
56
|
-
// Traditional iPad user agent
|
|
57
|
-
if (userAgent.includes('ipad')) {
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
return userAgent.indexOf('macintosh') > -1 && navigator.maxTouchPoints && navigator.maxTouchPoints > 2;
|
|
61
|
-
}
|
|
62
|
-
function getDeviceCustom() {
|
|
63
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
64
|
-
let source = '';
|
|
65
|
-
source = (userAgent.includes('android') || userAgent.includes('iphone') || isIpad()) ? checkCustomDeviceWidth() : 'desktop';
|
|
66
|
-
return source;
|
|
67
|
-
}
|
|
68
|
-
const getDevice = () => {
|
|
69
|
-
let userAgent = window.navigator.userAgent;
|
|
70
|
-
if (userAgent.toLowerCase().match(/android/i)) {
|
|
71
|
-
return 'Android';
|
|
72
|
-
}
|
|
73
|
-
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
74
|
-
return 'iPhone';
|
|
75
|
-
}
|
|
76
|
-
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
77
|
-
return 'iPad';
|
|
78
|
-
}
|
|
79
|
-
return 'PC';
|
|
80
|
-
};
|
|
81
|
-
const getDevicePlatform = () => {
|
|
82
|
-
const device = getDevice();
|
|
83
|
-
if (device) {
|
|
84
|
-
if (device === 'PC') {
|
|
85
|
-
return 'dk';
|
|
86
|
-
}
|
|
87
|
-
else if (device === 'iPad' || device === 'iPhone') {
|
|
88
|
-
return 'mtWeb';
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
return 'mtWeb';
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
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}";
|
|
97
|
-
|
|
98
|
-
const BlogArticlesGrid$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
99
|
-
constructor() {
|
|
100
|
-
super();
|
|
101
|
-
this.__registerHost();
|
|
102
|
-
this.__attachShadow();
|
|
103
|
-
this.ArticleActionButton = 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.limitStylingAppends = false;
|
|
166
|
-
this.isLoading = true;
|
|
167
|
-
this.bannerMatrixReady = false;
|
|
168
|
-
this.nextPage = '';
|
|
169
|
-
this.previousPage = '';
|
|
170
|
-
this.device = '';
|
|
171
|
-
this.totalBlogs = 0;
|
|
172
|
-
this.defaultStyling = `
|
|
173
|
-
div#PaginationContainer {
|
|
174
|
-
justify-content: right;
|
|
175
|
-
}
|
|
176
|
-
.LeftItems button .NavigationButton {
|
|
177
|
-
display: none;
|
|
178
|
-
}
|
|
179
|
-
.LeftItems button:after, .RightItems button:after {
|
|
180
|
-
padding: 7px 12px;
|
|
181
|
-
font-size: 18px;
|
|
182
|
-
font-weight: 700;
|
|
183
|
-
line-height: 46px;
|
|
184
|
-
}
|
|
185
|
-
.LeftItems button:after {
|
|
186
|
-
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1.2em' viewBox='0 0 320 512'%3E%3C!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z'/%3E%3C/svg%3E");
|
|
187
|
-
}
|
|
188
|
-
.RightItems button:after {
|
|
189
|
-
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1.2em' viewBox='0 0 320 512'%3E%3C!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z'/%3E%3C/svg%3E");
|
|
190
|
-
display: block;
|
|
191
|
-
height: 38px;
|
|
192
|
-
}
|
|
193
|
-
div.LeftItems button, div.RightItems button {
|
|
194
|
-
width: unset;
|
|
195
|
-
height: 40px;
|
|
196
|
-
background-color: #fff;
|
|
197
|
-
color: #000;
|
|
198
|
-
border: 1px solid #000;
|
|
199
|
-
overflow: hidden;
|
|
200
|
-
&:disabled {
|
|
201
|
-
background-color: #989898;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
div.LeftItems button {
|
|
205
|
-
min-width: 60px;
|
|
206
|
-
border-radius: 20px 0 0 20px;
|
|
207
|
-
border-right: 0;
|
|
208
|
-
}
|
|
209
|
-
div.RightItems button {
|
|
210
|
-
display: flex;
|
|
211
|
-
min-width: 100px;
|
|
212
|
-
justify-content: space-evenly;
|
|
213
|
-
align-items: center;
|
|
214
|
-
border-radius: 0 20px 20px 0;
|
|
215
|
-
text-transform: none;
|
|
216
|
-
}
|
|
217
|
-
.RightItems button .NavigationButton {
|
|
218
|
-
padding: 12px 0 12px 12px;
|
|
219
|
-
font-weight: 700;
|
|
220
|
-
}`;
|
|
221
|
-
this.setClientStyling = () => {
|
|
222
|
-
let sheet = document.createElement('style');
|
|
223
|
-
sheet.innerHTML = this.clientStyling;
|
|
224
|
-
this.stylingContainer.prepend(sheet);
|
|
225
|
-
};
|
|
226
|
-
this.setClientStylingURL = () => {
|
|
227
|
-
let url = new URL(this.clientStylingUrl);
|
|
228
|
-
let cssFile = document.createElement('style');
|
|
229
|
-
fetch(url.href)
|
|
230
|
-
.then((res) => res.text())
|
|
231
|
-
.then((data) => {
|
|
232
|
-
cssFile.innerHTML = data;
|
|
233
|
-
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
234
|
-
})
|
|
235
|
-
.catch((err) => {
|
|
236
|
-
console.log('Error ', err);
|
|
237
|
-
});
|
|
238
|
-
};
|
|
239
|
-
this.setImage = (image) => {
|
|
240
|
-
let source = '';
|
|
241
|
-
switch (this.device) {
|
|
242
|
-
case 'mobile':
|
|
243
|
-
source = image.sources[0].pictureSource;
|
|
244
|
-
break;
|
|
245
|
-
case 'tablet':
|
|
246
|
-
source = image.sources[1].pictureSource;
|
|
247
|
-
break;
|
|
248
|
-
case 'desktop':
|
|
249
|
-
source = image.sources[2].pictureSource;
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
return source;
|
|
253
|
-
};
|
|
254
|
-
this.renderContentConditionally = (content) => {
|
|
255
|
-
if (!content)
|
|
256
|
-
return;
|
|
257
|
-
const hasBanner = content.indexOf('<bannermatrix-banner') !== -1;
|
|
258
|
-
if (!hasBanner) {
|
|
259
|
-
return h("div", { class: "BlogContent", innerHTML: content });
|
|
260
|
-
}
|
|
261
|
-
if (this.bannerMatrixReady) {
|
|
262
|
-
return h("div", { class: "BlogContent", innerHTML: content });
|
|
263
|
-
}
|
|
264
|
-
return null;
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
getArticleId(postId, slug, customPath) {
|
|
268
|
-
if (this.usePostmessage) {
|
|
269
|
-
window.postMessage({ type: this.postMessageEvent, postId, slug, customPath });
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
this.ArticleActionButton.emit({ postId, slug, customPath });
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
// Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
|
|
276
|
-
handleBannerReady() {
|
|
277
|
-
this.bannerMatrixReady = true;
|
|
278
|
-
}
|
|
279
|
-
watchEndpoint(newValue, oldValue) {
|
|
280
|
-
this.currentPage = parseInt(this.page) - 1;
|
|
281
|
-
if (newValue && newValue != oldValue && this.cmsEndpoint && this.language) {
|
|
282
|
-
this.getBlogArticleGrid();
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
hpPageChange(event) {
|
|
286
|
-
var _a, _b;
|
|
287
|
-
this.paginationBlogList = event.detail;
|
|
288
|
-
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));
|
|
289
|
-
if (this.page) {
|
|
290
|
-
this.currentPage = this.currentPage + +this.page - 1;
|
|
291
|
-
}
|
|
292
|
-
if (this.currentPage + 1 > this.lastPage) {
|
|
293
|
-
this.nextPage = null;
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
if (this.currentPage < 0) {
|
|
297
|
-
this.previousPage = null;
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
window.postMessage({ type: 'BlogArticlesGridActivePagination', currentPage: this.currentPage }, window.location.href);
|
|
301
|
-
this.getBlogArticleGrid();
|
|
302
|
-
}
|
|
303
|
-
connectedCallback() {
|
|
304
|
-
if (this.cmsEndpoint && this.language && this.blogsLimit) {
|
|
305
|
-
if (this.page) {
|
|
306
|
-
this.currentPage = this.currentPage + +this.page - 1;
|
|
307
|
-
this.getBlogArticleGrid(+this.page);
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
310
|
-
this.getBlogArticleGrid();
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
componentDidLoad() {
|
|
315
|
-
window.postMessage({ type: 'BlogArticlesGridLoaded' }, window.location.href);
|
|
316
|
-
this.device = getDeviceCustom();
|
|
317
|
-
}
|
|
318
|
-
sortArticlesByDate(arr) {
|
|
319
|
-
arr.sort((a, b) => {
|
|
320
|
-
if (a.publishingDate > b.publishingDate)
|
|
321
|
-
return -1;
|
|
322
|
-
if (a.publishingDate < b.publishingDate)
|
|
323
|
-
return 1;
|
|
324
|
-
return 0;
|
|
325
|
-
});
|
|
326
|
-
return arr;
|
|
327
|
-
}
|
|
328
|
-
findLatestFeatured(array) {
|
|
329
|
-
let featuredItems = array.filter(item => item.isFeaturedPost);
|
|
330
|
-
if (featuredItems.length === 0) {
|
|
331
|
-
return null;
|
|
332
|
-
}
|
|
333
|
-
featuredItems = this.sortArticlesByDate(featuredItems);
|
|
334
|
-
return featuredItems[0];
|
|
335
|
-
}
|
|
336
|
-
moveLatestFeatureToStart(articlesArray, latestFeatured) {
|
|
337
|
-
const index = articlesArray.indexOf(latestFeatured);
|
|
338
|
-
if (index !== -1) {
|
|
339
|
-
articlesArray.splice(index, 1);
|
|
340
|
-
articlesArray.unshift(latestFeatured);
|
|
341
|
-
}
|
|
342
|
-
return articlesArray;
|
|
343
|
-
}
|
|
344
|
-
getBlogArticleGrid(page) {
|
|
345
|
-
this.isLoading = true;
|
|
346
|
-
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
|
|
347
|
-
url.searchParams.append('per_page', this.blogsLimit);
|
|
348
|
-
url.searchParams.append('page', JSON.stringify(page ? page : this.currentPage + 1));
|
|
349
|
-
url.searchParams.append('env', this.cmsEnv);
|
|
350
|
-
url.searchParams.append('userRoles', this.userRoles);
|
|
351
|
-
url.searchParams.append('device', getDevicePlatform());
|
|
352
|
-
fetch(url.href)
|
|
353
|
-
.then((res) => {
|
|
354
|
-
if (res.status >= 300) {
|
|
355
|
-
this.hasErrors = true;
|
|
356
|
-
throw new Error('There was an error while fetching the data');
|
|
357
|
-
}
|
|
358
|
-
return res.json();
|
|
359
|
-
})
|
|
360
|
-
.then((blogContent) => {
|
|
361
|
-
this.lastPage = +blogContent.pages.last.match(/&page=(\d+)/)[1];
|
|
362
|
-
let blogItems = blogContent.items;
|
|
363
|
-
this.nextPage = blogContent.pages.next;
|
|
364
|
-
this.previousPage = blogContent.pages.previous;
|
|
365
|
-
this.totalBlogs = blogContent.total;
|
|
366
|
-
const latestFeatured = this.findLatestFeatured(blogItems);
|
|
367
|
-
this.blogData = this.sortArticlesByDate(blogItems);
|
|
368
|
-
this.blogData = this.moveLatestFeatureToStart(blogItems, latestFeatured);
|
|
369
|
-
this.blogData.items = blogItems.map((item) => {
|
|
370
|
-
return Object.assign(Object.assign({}, item), { publishingDate: new Date(item.publishingDate).toLocaleDateString() });
|
|
371
|
-
});
|
|
372
|
-
this.isLoading = false;
|
|
373
|
-
this.hasErrors = false;
|
|
374
|
-
})
|
|
375
|
-
.catch((err) => {
|
|
376
|
-
this.hasErrors = true;
|
|
377
|
-
console.log('Error', err);
|
|
378
|
-
})
|
|
379
|
-
.finally(() => this.isLoading = false);
|
|
380
|
-
}
|
|
381
|
-
componentDidRender() {
|
|
382
|
-
// start custom styling area
|
|
383
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
384
|
-
if (this.clientStyling)
|
|
385
|
-
this.setClientStyling();
|
|
386
|
-
if (this.clientStylingUrl)
|
|
387
|
-
this.setClientStylingURL();
|
|
388
|
-
this.limitStylingAppends = true;
|
|
389
|
-
}
|
|
390
|
-
// end custom styling area
|
|
391
|
-
}
|
|
392
|
-
formatDate(dateString) {
|
|
393
|
-
return new Intl.DateTimeFormat(this.intlDateTimeFormat).format(new Date(dateString));
|
|
394
|
-
}
|
|
395
|
-
render() {
|
|
396
|
-
var _a, _b;
|
|
397
|
-
if (this.hasErrors) {
|
|
398
|
-
return (h("div", { class: "BlogsContainer" }, h("div", { class: "ErrorMessage" }, translate('error', this.language))));
|
|
399
|
-
}
|
|
400
|
-
// Create an array to store the placeholder elements for each card
|
|
401
|
-
const placeholderCards = [];
|
|
402
|
-
// Loop through the blogsLimit in order to generate the desired number of cards
|
|
403
|
-
for (let i = 0; i < parseInt(this.blogsLimit); i++) {
|
|
404
|
-
placeholderCards.push(h("div", { class: "GridContainer FeaturedPost" }, h("div", { class: "GridWrapper" }, h("div", { class: "GridSector" }, h("div", { class: "VisualContent LoadingImage" })), h("div", { class: "GridSector" }, h("div", { class: "BlogTitle LoadingStripe LoadingSmallStripe" }), h("div", { class: "BlogDetails LoadingStripe LoadingMediumStripe" }), h("div", { class: "BlogLink LoadingStripe LoadingLongStripe" })))));
|
|
405
|
-
}
|
|
406
|
-
return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "BlogPageContainer" }, h("div", { class: "BlogGridPaginationWrapper" }, this.paginationActive == true && this.totalBlogs > +this.blogsLimit && 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) &&
|
|
407
|
-
h("div", { class: `GridContainerWrapper BlogPage-${this.currentPage}` }, this.blogData && this.blogData.map((data) => {
|
|
408
|
-
var _a, _b;
|
|
409
|
-
return h("div", { key: data.postID, class: data.isFeaturedPost ? 'GridContainer FeaturedPost' : 'GridContainer' }, h("div", { class: "GridWrapper" }, h("div", { class: "GridSector" }, this.showPublishingDate &&
|
|
410
|
-
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) ? (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]) ? (h("video", { class: "VisualContent", src: data.video.sources[this.device], controls: true })) : (h("h1", { class: "VisualContent", style: { color: "#fff" } }, "No Image")))), h("div", { class: "GridSector" }, this.showTitle &&
|
|
411
|
-
h("div", { class: "BlogTitle" }, data === null || data === void 0 ? void 0 : data.title), this.showContent &&
|
|
412
|
-
this.renderContentConditionally(data === null || data === void 0 ? void 0 : data.descriptionPreview), this.showButton &&
|
|
413
|
-
h("div", { class: "BlogLink" }, 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('readmore', this.language))))));
|
|
414
|
-
})), (this.isLoading) &&
|
|
415
|
-
h("div", { class: "GridContainerWrapper LoadingGrid" }, placeholderCards))));
|
|
416
|
-
}
|
|
417
|
-
static get watchers() { return {
|
|
418
|
-
"page": ["watchEndpoint"],
|
|
419
|
-
"hasErrors": ["watchEndpoint"],
|
|
420
|
-
"cmsEndpoint": ["watchEndpoint"],
|
|
421
|
-
"language": ["watchEndpoint"],
|
|
422
|
-
"cmsEnv": ["watchEndpoint"],
|
|
423
|
-
"userRoles": ["watchEndpoint"],
|
|
424
|
-
"blogsLimit": ["watchEndpoint"]
|
|
425
|
-
}; }
|
|
426
|
-
static get style() { return blogArticlesGridCss; }
|
|
427
|
-
}, [1, "blog-articles-grid", {
|
|
428
|
-
"cmsEndpoint": [513, "cms-endpoint"],
|
|
429
|
-
"language": [513],
|
|
430
|
-
"userRoles": [513, "user-roles"],
|
|
431
|
-
"cmsEnv": [513, "cms-env"],
|
|
432
|
-
"clientStyling": [513, "client-styling"],
|
|
433
|
-
"clientStylingUrl": [513, "client-styling-url"],
|
|
434
|
-
"showPublishingDate": [516, "show-publishing-date"],
|
|
435
|
-
"showImage": [516, "show-image"],
|
|
436
|
-
"showTitle": [516, "show-title"],
|
|
437
|
-
"showContent": [516, "show-content"],
|
|
438
|
-
"showButton": [516, "show-button"],
|
|
439
|
-
"usePostmessage": [516, "use-postmessage"],
|
|
440
|
-
"postMessageEvent": [513, "post-message-event"],
|
|
441
|
-
"blogsLimit": [513, "blogs-limit"],
|
|
442
|
-
"paginationActive": [516, "pagination-active"],
|
|
443
|
-
"arrowsActive": [516, "arrows-active"],
|
|
444
|
-
"secondaryArrowsActive": [516, "secondary-arrows-active"],
|
|
445
|
-
"numberedNavActive": [516, "numbered-nav-active"],
|
|
446
|
-
"intlDateTimeFormat": [513, "intl-date-time-format"],
|
|
447
|
-
"page": [513],
|
|
448
|
-
"paginationBlogList": [32],
|
|
449
|
-
"currentPage": [32],
|
|
450
|
-
"hasErrors": [32],
|
|
451
|
-
"limitStylingAppends": [32],
|
|
452
|
-
"isLoading": [32],
|
|
453
|
-
"bannerMatrixReady": [32],
|
|
454
|
-
"nextPage": [32],
|
|
455
|
-
"previousPage": [32],
|
|
456
|
-
"device": [32],
|
|
457
|
-
"blogData": [32],
|
|
458
|
-
"totalBlogs": [32]
|
|
459
|
-
}, [[8, "BannerMatrixReady", "handleBannerReady"], [0, "hpPageChange", "hpPageChange"]]]);
|
|
460
|
-
function defineCustomElement$1() {
|
|
461
|
-
if (typeof customElements === "undefined") {
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
const components = ["blog-articles-grid", "helper-pagination"];
|
|
465
|
-
components.forEach(tagName => { switch (tagName) {
|
|
466
|
-
case "blog-articles-grid":
|
|
467
|
-
if (!customElements.get(tagName)) {
|
|
468
|
-
customElements.define(tagName, BlogArticlesGrid$1);
|
|
469
|
-
}
|
|
470
|
-
break;
|
|
471
|
-
case "helper-pagination":
|
|
472
|
-
if (!customElements.get(tagName)) {
|
|
473
|
-
defineCustomElement$2();
|
|
474
|
-
}
|
|
475
|
-
break;
|
|
476
|
-
} });
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
const BlogArticlesGrid = BlogArticlesGrid$1;
|
|
480
|
-
const defineCustomElement = defineCustomElement$1;
|
|
481
|
-
|
|
482
|
-
export { BlogArticlesGrid, defineCustomElement };
|