@everymatrix/blog-articles-grid 1.13.5 → 1.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blog-articles-grid/blog-articles-grid.esm.js +1 -1
- package/dist/blog-articles-grid/p-ff2d058a.entry.js +1 -0
- package/dist/cjs/blog-articles-grid.cjs.js +1 -1
- package/dist/cjs/blog-articles-grid_2.cjs.entry.js +39 -34
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/blog-articles-grid/blog-articles-grid.js +29 -19
- package/dist/components/blog-articles-grid.js +21 -11
- package/dist/components/helper-pagination2.js +21 -29
- package/dist/esm/blog-articles-grid.js +1 -1
- package/dist/esm/blog-articles-grid_2.entry.js +39 -34
- package/dist/esm/loader.js +1 -1
- package/package.json +1 -1
- package/dist/blog-articles-grid/p-5f1404bf.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import{p as t,b as e}from"./p-f0d2badc.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),t(n)})().then((t=>e([["p-ff2d058a",[[1,"blog-articles-grid",{cmsEndpoint:[1,"cms-endpoint"],language:[1],handleClick:[1,"handle-click"],clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],showPublishingDate:[4,"show-publishing-date"],showImage:[4,"show-image"],showTitle:[4,"show-title"],showContent:[4,"show-content"],showButton:[4,"show-button"],usePostmessage:[4,"use-postmessage"],postMessageEvent:[1,"post-message-event"],blogsLimit:[514,"blogs-limit"],paginationActive:[516,"pagination-active"],arrowsActive:[516,"arrows-active"],secondaryArrowsActive:[516,"secondary-arrows-active"],numberedNavActive:[516,"numbered-nav-active"],paginationBlogList:[32],currentPage:[32],hasErrors:[32],limitStylingAppends:[32],isLoading:[32],bannerMatrixReady:[32]},[[8,"WebComponentsReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{firstPage:[1540,"first-page"],previousPage:[1540,"previous-page"],offset:[1538],limit:[1538],total:[1538],language:[513],clientStyling:[513,"client-styling"],clientStylingUrlContent:[513,"client-styling-url-content"],offsetInt:[32],lastPage:[32],limitInt:[32],totalInt:[32],pagesArray:[32],endInt:[32],limitStylingAppends:[32]}]]]],t)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as n}from"./p-f0d2badc.js";const e=["ro","en","fr","ar"],o={en:{error:"Error",readmore:"Read more"},ro:{error:"Eroare",readmore:"Read more"},fr:{error:"Error",readmore:"Read more"},ar:{error:"خطأ",readmore:"Read more"}},s=(t,i)=>{const n=i;return o[void 0!==n&&e.includes(n)?n:"en"][t]},r=class{constructor(e){t(this,e),this.articleActionButton=i(this,"articleActionButton",7),this.language="en",this.clientStyling="",this.clientStylingUrl="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.showButton=!0,this.postMessageEvent="articleActionButton",this.paginationBlogList={offset:0},this.currentPage=0,this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.blogsLists=[],this.defaultStyling="\n div#PaginationContainer {\n justify-content: right;\n }\n .LeftItems button .NavigationButton {\n display: none;\n }\n .LeftItems button:after, .RightItems button:after {\n padding: 7px 12px;\n font-size: 18px;\n font-weight: 700;\n line-height: 46px;\n }\n .LeftItems button:after {\n 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\");\n }\n .RightItems button:after {\n 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\");\n display: block;\n height: 38px;\n }\n div.LeftItems button, div.RightItems button {\n width: unset;\n height: 40px;\n background-color: #fff;\n color: #000;\n border: 1px solid #000;\n overflow: hidden;\n &:disabled {\n background-color: #989898;\n }\n }\n div.LeftItems button {\n min-width: 60px;\n border-radius: 20px 0 0 20px;\n border-right: 0;\n }\n div.RightItems button {\n display: flex;\n min-width: 100px;\n justify-content: space-evenly;\n align-items: center;\n border-radius: 0 20px 20px 0;\n text-transform: none;\n }\n .RightItems button .NavigationButton {\n padding: 12px 0 12px 12px;\n font-weight: 700;\n }",this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(i)}),1)})).catch((t=>{console.log("error ",t)}))},this.renderContentConditionally=t=>{if(t)return-1!==t.indexOf("<bannermatrix-banner")?this.bannerMatrixReady?n("div",{class:"BlogContent",innerHTML:this.blogData.content}):null:n("div",{class:"BlogContent",innerHTML:this.blogData.content})}}getArticleId(t){this.articleActionButton.emit({postId:t}),this.usePostmessage&&window.postMessage({type:this.postMessageEvent,postId:t})}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getBlogArticleGrid()}hpPageChange(t){var i,n;this.paginationBlogList=t.detail,this.currentPage=Math.floor((null===(i=this.paginationBlogList)||void 0===i?void 0:i.offset)/(null===(n=this.paginationBlogList)||void 0===n?void 0:n.limit))}handleAction(t){this.getArticleId(t)}connectedCallback(){this.cmsEndpoint&&this.language&&this.getBlogArticleGrid()}componentDidLoad(){window.postMessage({type:"BlogArticlesGridLoaded"},window.location.href)}getBlogArticleGrid(){this.isLoading=!0;let t=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);fetch(t.href).then((t=>{if(t.status>=300)throw this.hasErrors=!0,new Error("There was an error while fetching the data");return t.json()})).then((t=>{if(this.blogData=t.map((t=>Object.assign(Object.assign({},t),{publishingDate:new Date(t.publishingDate).toLocaleDateString()}))),1==this.paginationActive){const t=this.blogData.map((t=>Object.assign({},t)));t.forEach((()=>{this.blogsLists.push(t.splice(0,this.blogsLimit))})),t.length&&this.blogsLists.push(t.splice(0,this.blogsLimit))}this.isLoading=!1})).catch((t=>{this.hasErrors=!0,console.log("Error",t)})).finally((()=>this.isLoading=!1))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){return this.hasErrors?n("div",{class:"BlogArticleDetails"},n("div",{class:"Title"},s("error",this.language))):this.isLoading?void 0:n("div",{ref:t=>this.stylingContainer=t},n("div",{class:"TicketsHistoryPaginationWrapper"},this.blogData.length>this.blogsLimit-1&&1==this.paginationActive&&n("helper-pagination",{"first-page":!1,"previous-page":!1,offset:this.paginationBlogList.offset,limit:this.blogsLimit,total:this.blogData.length,language:this.language,"client-styling":this.clientStyling||this.defaultStyling,"arrows-active":this.arrowsActive||!1,"secondary-arrows-active":this.secondaryArrowsActive||!1,"numbered-nav-active":this.numberedNavActive||!1})),n("div",{class:"GridContainerWrapper"},(this.paginationActive?this.blogsLists[this.currentPage]:this.blogData).map((t=>{var i;return n("div",{class:"GridContainer"},this.showPublishingDate&&n("div",{class:"BlogDate"},null==t?void 0:t.publishingDate),this.showImage&&n("div",{class:"BlogBanner"},n("img",{src:null===(i=null==t?void 0:t.image)||void 0===i?void 0:i.src,alt:null==t?void 0:t.title})),this.showTitle&&n("div",{class:"BlogTitle"},null==t?void 0:t.title),this.showContent&&this.renderContentConditionally(null==t?void 0:t.content),this.showButton&&n("div",{class:"BlogLink"},n("button",{onClick:()=>this.handleAction(null==t?void 0:t.postID)},s("readmore",this.language))))}))))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};r.style=":host {\n display: block;\n}\n\n.GridContainerWrapper {\n display: grid;\n}\n\n.GridContainer {\n margin: auto;\n width: 100%;\n height: 280px;\n border-radius: 15px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n gap: 30px;\n grid-template-rows: 1fr 4fr 1fr 1fr;\n grid-template-columns: 30px 1fr 1fr 30px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/3;\n grid-row: 1/5;\n}\n.GridContainer .BlogBanner img {\n border-radius: 5px 0 0 5px;\n width: 100%;\n height: 280px;\n}\n.GridContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n grid-column: 2/2;\n grid-row: 4/4;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #FFF;\n margin-top: 20px;\n grid-column: 3/5;\n}\n.GridContainer .BlogContent {\n font-size: 14px;\n color: #FFF;\n width: 90%;\n max-height: 80px;\n overflow: hidden;\n text-overflow: ellipsis;\n grid-column: 3/5;\n}\n.GridContainer .BlogLink {\n grid-column: 3/5;\n color: #FFF;\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 (max-width: 475px) {\n .GridContainerWrapper {\n display: grid;\n }\n\n .GridContainer {\n margin: auto;\n width: 100%;\n min-height: 400px;\n gap: 10%;\n padding-bottom: 30px;\n border-radius: 5px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n grid-template-rows: repeat(auto-fit, minmax(50px, 1fr));\n grid-template-rows: auto auto auto 50px;\n grid-template-columns: 15px auto auto 15px;\n gap: 10px;\n }\n .GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n margin: 0;\n }\n .GridContainer .BlogBanner img {\n width: 100%;\n height: 232px;\n border-radius: 5px 5px 0 0;\n }\n .GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n z-index: 1;\n }\n .GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n }\n .GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n }\n .GridContainer .BlogLink {\n grid-column: 2/4;\n color: #FFF;\n cursor: pointer;\n }\n .GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n background: none;\n color: #D0046C;\n cursor: pointer;\n }\n}";const a=t=>!!(t.toLowerCase().match(/android/i)||t.toLowerCase().match(/blackberry|bb/i)||t.toLowerCase().match(/iphone|ipad|ipod/i)||t.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),h=["ro","en"],d={en:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ro:{firstPage:"Prima",previousPage:"Anterior",nextPage:"Urmatoarea",lastPage:"Ultima"},fr:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ar:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"}},l=(t,i)=>{const n=i;return d[void 0!==n&&h.includes(n)?n:"en"][t]},c=class{constructor(n){t(this,n),this.hpPageChange=i(this,"hpPageChange",7),this.firstPage=!1,this.previousPage=!1,this.offset=0,this.limit=1,this.total=1,this.language="en",this.clientStyling="",this.clientStylingUrlContent="",this.pagesArray=[],this.endInt=0,this.userAgent=window.navigator.userAgent,this.currentPage=1,this.limitStylingAppends=!1,this.navigateTo=t=>{switch(t){case"firstPage":this.offsetInt=0;break;case"lastPage":this.offsetInt=this.endInt*this.limitInt;break;case"previousPage":this.offsetInt-=10;break;case"nextPage":this.offsetInt+=10;break;case"fivePagesBack":this.offsetInt-=30,this.offsetInt=this.offsetInt<0?0:this.offsetInt;break;case"fivePagesForward":this.offsetInt+=30,this.offsetInt=this.offsetInt/10>=this.endInt?10*this.endInt:this.offsetInt}this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.paginationNavigation=(t,i)=>{isNaN(t)?0===i&&this.currentPage<=4?this.navigateTo("firstPage"):0===i&&this.currentPage>4?this.navigateTo("fivePagesBack"):4===i&&this.endInt-this.currentPage>=2&&this.navigateTo("fivePagesForward"):this.offsetInt=1===t?t-1:10*(t-1),this.currentPage=this.offsetInt,this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=document.createElement("style");setTimeout((()=>{t.innerHTML=this.clientStylingUrlContent,this.stylingContainer.prepend(t)}),1)}}componentWillRender(){this.offsetInt=this.offset,this.currentPage=this.offsetInt/this.limitInt+1,this.limitInt=this.limit,this.totalInt=this.total,this.endInt=Math.ceil(this.totalInt/this.limitInt)-1,this.lastPage=!(this.offsetInt>=this.endInt*this.limitInt),1===this.currentPage||2===this.currentPage?(this.pagesArray=Array.from({length:4},((t,i)=>i+1)),this.pagesArray.push("...")):this.currentPage>=3&&this.endInt-this.currentPage>=2?(this.pagesArray=Array.from({length:3},((t,i)=>this.currentPage+i-1)),this.pagesArray.push("..."),this.pagesArray.unshift("...")):this.endInt-this.currentPage<3&&(this.pagesArray=Array.from({length:4},((t,i)=>this.endInt-2+i)),this.pagesArray.unshift("..."))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrlContent&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){let t=n("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>n("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(a(this.userAgent)?"MobileButtons":"")},n("button",{disabled:t===this.currentPage,onClick:this.paginationNavigation.bind(this,t,i)},n("span",null,t)))))),i=n("div",{class:"LeftItems"},n("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"firstPage")},l("firstPage",this.language)),n("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"previousPage")},l("previousPage",this.language)));a(this.userAgent)&&(i=n("div",{class:"LeftItems"},n("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"previousPage")},l("previousPage",this.language))));let e=n("div",{class:"RightItems"},n("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"nextPage")},l("nextPage",this.language)),n("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"lastPage")},l("lastPage",this.language)));return a(this.userAgent)&&(e=n("div",{class:"RightItems"},n("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"nextPage")},l("nextPage",this.language)))),n("div",{id:"PaginationContainer"},i,t,e)}};c.style='@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-top:20px;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:12px}}@media screen and (max-width: 480px){button{width:70px;font-size:10px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:10px}.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}}';export{r as blog_articles_grid,c as helper_pagination}
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["blog-articles-grid_2.cjs",[[1,"blog-articles-grid",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"showButton":[4,"show-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[
|
|
18
|
+
return index.bootstrapLazy([["blog-articles-grid_2.cjs",[[1,"blog-articles-grid",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"showButton":[4,"show-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"offsetInt":[32],"lastPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32],"limitStylingAppends":[32]}]]]], options);
|
|
19
19
|
});
|
|
@@ -148,6 +148,8 @@ const BlogArticlesGrid = class {
|
|
|
148
148
|
});
|
|
149
149
|
};
|
|
150
150
|
this.renderContentConditionally = (content) => {
|
|
151
|
+
if (!content)
|
|
152
|
+
return;
|
|
151
153
|
const hasBanner = content.indexOf('<bannermatrix-banner') !== -1;
|
|
152
154
|
if (!hasBanner) {
|
|
153
155
|
return index.h("div", { class: "BlogContent", innerHTML: this.blogData.content });
|
|
@@ -204,12 +206,17 @@ const BlogArticlesGrid = class {
|
|
|
204
206
|
this.blogData = blogContent.map((item) => {
|
|
205
207
|
return Object.assign(Object.assign({}, item), { publishingDate: new Date(item.publishingDate).toLocaleDateString() });
|
|
206
208
|
});
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
if (this.paginationActive == true) {
|
|
210
|
+
// start api call mock structure for pagination
|
|
211
|
+
const newArray = this.blogData.map(a => (Object.assign({}, a)));
|
|
212
|
+
newArray.forEach((_) => {
|
|
213
|
+
this.blogsLists.push(newArray.splice(0, this.blogsLimit));
|
|
214
|
+
});
|
|
215
|
+
if (newArray.length) {
|
|
216
|
+
this.blogsLists.push(newArray.splice(0, this.blogsLimit)); // add the rest of the remaining elements in order to simulate the last blog page
|
|
217
|
+
}
|
|
218
|
+
// end api call mock structure for pagination
|
|
211
219
|
}
|
|
212
|
-
// end api call mock structure for pagination
|
|
213
220
|
this.isLoading = false;
|
|
214
221
|
})
|
|
215
222
|
.catch((err) => {
|
|
@@ -234,12 +241,15 @@ const BlogArticlesGrid = class {
|
|
|
234
241
|
return (index.h("div", { class: "BlogArticleDetails" }, index.h("div", { class: "Title" }, translate$1('error', this.language))));
|
|
235
242
|
}
|
|
236
243
|
if (!this.isLoading) {
|
|
237
|
-
return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "TicketsHistoryPaginationWrapper" }, (this.blogData.length > this.blogsLimit - 1) && this.paginationActive && index.h("helper-pagination", { "first-page": false, "previous-page": false, offset: this.paginationBlogList.offset, limit: this.blogsLimit, total: this.blogData.length, language: this.language, "client-styling": this.clientStyling || this.defaultStyling, "arrows-active": this.arrowsActive || false, "secondary-arrows-active": this.secondaryArrowsActive || false, "numbered-nav-active": this.numberedNavActive || false })), index.h("div", { class: "GridContainerWrapper" }, this.blogsLists[this.currentPage].map((data) =>
|
|
238
|
-
|
|
239
|
-
index.h("div", { class: "
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
244
|
+
return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "TicketsHistoryPaginationWrapper" }, (this.blogData.length > this.blogsLimit - 1) && this.paginationActive == true && index.h("helper-pagination", { "first-page": false, "previous-page": false, offset: this.paginationBlogList.offset, limit: this.blogsLimit, total: this.blogData.length, language: this.language, "client-styling": this.clientStyling || this.defaultStyling, "arrows-active": this.arrowsActive || false, "secondary-arrows-active": this.secondaryArrowsActive || false, "numbered-nav-active": this.numberedNavActive || false })), index.h("div", { class: "GridContainerWrapper" }, (this.paginationActive ? this.blogsLists[this.currentPage] : this.blogData).map((data) => {
|
|
245
|
+
var _a;
|
|
246
|
+
return index.h("div", { class: "GridContainer" }, this.showPublishingDate &&
|
|
247
|
+
index.h("div", { class: "BlogDate" }, data === null || data === void 0 ? void 0 : data.publishingDate), this.showImage &&
|
|
248
|
+
index.h("div", { class: "BlogBanner" }, index.h("img", { src: (_a = data === null || data === void 0 ? void 0 : data.image) === null || _a === void 0 ? void 0 : _a.src, alt: data === null || data === void 0 ? void 0 : data.title })), this.showTitle &&
|
|
249
|
+
index.h("div", { class: "BlogTitle" }, data === null || data === void 0 ? void 0 : data.title), this.showContent &&
|
|
250
|
+
this.renderContentConditionally(data === null || data === void 0 ? void 0 : data.content), this.showButton &&
|
|
251
|
+
index.h("div", { class: "BlogLink" }, index.h("button", { onClick: () => this.handleAction(data === null || data === void 0 ? void 0 : data.postID) }, translate$1('readmore', this.language))));
|
|
252
|
+
}))));
|
|
243
253
|
}
|
|
244
254
|
}
|
|
245
255
|
static get watchers() { return {
|
|
@@ -295,7 +305,7 @@ const translate = (key, customLang) => {
|
|
|
295
305
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
296
306
|
};
|
|
297
307
|
|
|
298
|
-
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
|
|
308
|
+
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-top:20px;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:12px}}@media screen and (max-width: 480px){button{width:70px;font-size:10px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:10px}.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}}";
|
|
299
309
|
|
|
300
310
|
const HelperPagination = class {
|
|
301
311
|
constructor(hostRef) {
|
|
@@ -326,8 +336,8 @@ const HelperPagination = class {
|
|
|
326
336
|
*/
|
|
327
337
|
this.language = 'en';
|
|
328
338
|
/**
|
|
329
|
-
|
|
330
|
-
|
|
339
|
+
* Client custom styling via string
|
|
340
|
+
*/
|
|
331
341
|
this.clientStyling = '';
|
|
332
342
|
/**
|
|
333
343
|
* Client custom styling via url content
|
|
@@ -356,35 +366,32 @@ const HelperPagination = class {
|
|
|
356
366
|
this.offsetInt = this.endInt * this.limitInt;
|
|
357
367
|
break;
|
|
358
368
|
case 'previousPage':
|
|
359
|
-
this.offsetInt -=
|
|
369
|
+
this.offsetInt -= 10;
|
|
360
370
|
break;
|
|
361
371
|
case 'nextPage':
|
|
362
|
-
this.offsetInt +=
|
|
372
|
+
this.offsetInt += 10;
|
|
363
373
|
break;
|
|
364
374
|
case 'fivePagesBack':
|
|
365
|
-
this.offsetInt -=
|
|
366
|
-
this.offsetInt = this.offsetInt
|
|
375
|
+
this.offsetInt -= 30;
|
|
376
|
+
this.offsetInt = this.offsetInt < 0 ? 0 : this.offsetInt;
|
|
367
377
|
break;
|
|
368
378
|
case 'fivePagesForward':
|
|
369
|
-
this.offsetInt +=
|
|
370
|
-
this.offsetInt = this.offsetInt /
|
|
379
|
+
this.offsetInt += 30;
|
|
380
|
+
this.offsetInt = this.offsetInt / 10 >= this.endInt ? this.endInt * 10 : this.offsetInt;
|
|
371
381
|
break;
|
|
372
382
|
}
|
|
373
|
-
this.previousPage = !this.offsetInt ? false : true;
|
|
374
383
|
this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
|
|
375
384
|
};
|
|
376
385
|
/**
|
|
377
386
|
* Handle navigation from here
|
|
378
387
|
*/
|
|
379
388
|
this.paginationNavigation = (pageNumber, index) => {
|
|
380
|
-
this.previousPage = true;
|
|
381
389
|
if (!isNaN(pageNumber)) {
|
|
382
390
|
if (pageNumber === 1) {
|
|
383
391
|
this.offsetInt = pageNumber - 1;
|
|
384
|
-
this.previousPage = false;
|
|
385
392
|
}
|
|
386
393
|
else {
|
|
387
|
-
this.offsetInt = (pageNumber - 1) *
|
|
394
|
+
this.offsetInt = (pageNumber - 1) * 10;
|
|
388
395
|
}
|
|
389
396
|
}
|
|
390
397
|
else {
|
|
@@ -398,6 +405,7 @@ const HelperPagination = class {
|
|
|
398
405
|
this.navigateTo('fivePagesForward');
|
|
399
406
|
}
|
|
400
407
|
}
|
|
408
|
+
this.currentPage = this.offsetInt;
|
|
401
409
|
this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
|
|
402
410
|
};
|
|
403
411
|
this.setClientStyling = () => {
|
|
@@ -415,8 +423,7 @@ const HelperPagination = class {
|
|
|
415
423
|
}
|
|
416
424
|
componentWillRender() {
|
|
417
425
|
this.offsetInt = this.offset;
|
|
418
|
-
this.
|
|
419
|
-
this.currentPage = (this.offsetInt / this.limitInt) + 1;
|
|
426
|
+
this.currentPage = this.offsetInt / this.limitInt + 1;
|
|
420
427
|
this.limitInt = this.limit;
|
|
421
428
|
this.totalInt = this.total;
|
|
422
429
|
this.endInt = (Math.ceil(this.totalInt / this.limitInt) - 1);
|
|
@@ -424,7 +431,7 @@ const HelperPagination = class {
|
|
|
424
431
|
/**
|
|
425
432
|
* Construct numbered navigation area based on current page position
|
|
426
433
|
*/
|
|
427
|
-
if (this.currentPage
|
|
434
|
+
if (this.currentPage === 1 || this.currentPage === 2) {
|
|
428
435
|
this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
|
|
429
436
|
this.pagesArray.push('...');
|
|
430
437
|
}
|
|
@@ -459,22 +466,20 @@ const HelperPagination = class {
|
|
|
459
466
|
/**
|
|
460
467
|
* Left navigation area
|
|
461
468
|
*/
|
|
462
|
-
let
|
|
463
|
-
let buttonsLeftSide = index.h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, index.h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, index.h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), index.h("span", { class: "NavigationIcon" })));
|
|
469
|
+
let buttonsLeftSide = index.h("div", { class: "LeftItems" }, index.h("button", { disabled: !this.previousPage, onClick: this.navigateTo.bind(this, 'firstPage') }, translate('firstPage', this.language)), index.h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, translate('previousPage', this.language)));
|
|
464
470
|
if (isMobile(this.userAgent)) {
|
|
465
471
|
buttonsLeftSide =
|
|
466
|
-
index.h("div", { class: "LeftItems" }, index.h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') },
|
|
472
|
+
index.h("div", { class: "LeftItems" }, index.h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, translate('previousPage', this.language)));
|
|
467
473
|
}
|
|
468
474
|
/**
|
|
469
475
|
* Right navigation area
|
|
470
476
|
*/
|
|
471
|
-
let
|
|
472
|
-
let buttonsRightSide = index.h("div", { class: "RightItems" }, index.h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, index.h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), index.h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
|
|
477
|
+
let buttonsRightSide = index.h("div", { class: "RightItems" }, index.h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, translate('nextPage', this.language)), index.h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'lastPage') }, translate('lastPage', this.language)));
|
|
473
478
|
if (isMobile(this.userAgent)) {
|
|
474
479
|
buttonsRightSide =
|
|
475
|
-
index.h("div", { class: "RightItems" }, index.h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') },
|
|
480
|
+
index.h("div", { class: "RightItems" }, index.h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, translate('nextPage', this.language)));
|
|
476
481
|
}
|
|
477
|
-
return (index.h("div", { id: "PaginationContainer"
|
|
482
|
+
return (index.h("div", { id: "PaginationContainer" }, buttonsLeftSide, navigationArea, buttonsRightSide));
|
|
478
483
|
}
|
|
479
484
|
};
|
|
480
485
|
HelperPagination.style = helperPaginationCss;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["blog-articles-grid_2.cjs",[[1,"blog-articles-grid",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"showButton":[4,"show-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[
|
|
17
|
+
return index.bootstrapLazy([["blog-articles-grid_2.cjs",[[1,"blog-articles-grid",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"showButton":[4,"show-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"offsetInt":[32],"lastPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32],"limitStylingAppends":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -116,6 +116,8 @@ export class BlogArticlesGrid {
|
|
|
116
116
|
});
|
|
117
117
|
};
|
|
118
118
|
this.renderContentConditionally = (content) => {
|
|
119
|
+
if (!content)
|
|
120
|
+
return;
|
|
119
121
|
const hasBanner = content.indexOf('<bannermatrix-banner') !== -1;
|
|
120
122
|
if (!hasBanner) {
|
|
121
123
|
return h("div", { class: "BlogContent", innerHTML: this.blogData.content });
|
|
@@ -172,12 +174,17 @@ export class BlogArticlesGrid {
|
|
|
172
174
|
this.blogData = blogContent.map((item) => {
|
|
173
175
|
return Object.assign(Object.assign({}, item), { publishingDate: new Date(item.publishingDate).toLocaleDateString() });
|
|
174
176
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
if (this.paginationActive == true) {
|
|
178
|
+
// start api call mock structure for pagination
|
|
179
|
+
const newArray = this.blogData.map(a => (Object.assign({}, a)));
|
|
180
|
+
newArray.forEach((_) => {
|
|
181
|
+
this.blogsLists.push(newArray.splice(0, this.blogsLimit));
|
|
182
|
+
});
|
|
183
|
+
if (newArray.length) {
|
|
184
|
+
this.blogsLists.push(newArray.splice(0, this.blogsLimit)); // add the rest of the remaining elements in order to simulate the last blog page
|
|
185
|
+
}
|
|
186
|
+
// end api call mock structure for pagination
|
|
179
187
|
}
|
|
180
|
-
// end api call mock structure for pagination
|
|
181
188
|
this.isLoading = false;
|
|
182
189
|
})
|
|
183
190
|
.catch((err) => {
|
|
@@ -204,20 +211,23 @@ export class BlogArticlesGrid {
|
|
|
204
211
|
}
|
|
205
212
|
if (!this.isLoading) {
|
|
206
213
|
return (h("div", { ref: el => this.stylingContainer = el },
|
|
207
|
-
h("div", { class: "TicketsHistoryPaginationWrapper" }, (this.blogData.length > this.blogsLimit - 1) && this.paginationActive && h("helper-pagination", { "first-page": false, "previous-page": false, offset: this.paginationBlogList.offset, limit: this.blogsLimit, total: this.blogData.length, language: this.language, "client-styling": this.clientStyling || this.defaultStyling, "arrows-active": this.arrowsActive || false, "secondary-arrows-active": this.secondaryArrowsActive || false, "numbered-nav-active": this.numberedNavActive || false })),
|
|
208
|
-
h("div", { class: "GridContainerWrapper" }, this.blogsLists[this.currentPage].map((data) =>
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
214
|
+
h("div", { class: "TicketsHistoryPaginationWrapper" }, (this.blogData.length > this.blogsLimit - 1) && this.paginationActive == true && h("helper-pagination", { "first-page": false, "previous-page": false, offset: this.paginationBlogList.offset, limit: this.blogsLimit, total: this.blogData.length, language: this.language, "client-styling": this.clientStyling || this.defaultStyling, "arrows-active": this.arrowsActive || false, "secondary-arrows-active": this.secondaryArrowsActive || false, "numbered-nav-active": this.numberedNavActive || false })),
|
|
215
|
+
h("div", { class: "GridContainerWrapper" }, (this.paginationActive ? this.blogsLists[this.currentPage] : this.blogData).map((data) => {
|
|
216
|
+
var _a;
|
|
217
|
+
return h("div", { class: "GridContainer" },
|
|
218
|
+
this.showPublishingDate &&
|
|
219
|
+
h("div", { class: "BlogDate" }, data === null || data === void 0 ? void 0 : data.publishingDate),
|
|
220
|
+
this.showImage &&
|
|
221
|
+
h("div", { class: "BlogBanner" },
|
|
222
|
+
h("img", { src: (_a = data === null || data === void 0 ? void 0 : data.image) === null || _a === void 0 ? void 0 : _a.src, alt: data === null || data === void 0 ? void 0 : data.title })),
|
|
223
|
+
this.showTitle &&
|
|
224
|
+
h("div", { class: "BlogTitle" }, data === null || data === void 0 ? void 0 : data.title),
|
|
225
|
+
this.showContent &&
|
|
226
|
+
this.renderContentConditionally(data === null || data === void 0 ? void 0 : data.content),
|
|
227
|
+
this.showButton &&
|
|
228
|
+
h("div", { class: "BlogLink" },
|
|
229
|
+
h("button", { onClick: () => this.handleAction(data === null || data === void 0 ? void 0 : data.postID) }, translate('readmore', this.language))));
|
|
230
|
+
}))));
|
|
221
231
|
}
|
|
222
232
|
}
|
|
223
233
|
static get is() { return "blog-articles-grid"; }
|
|
@@ -147,6 +147,8 @@ const BlogArticlesGrid$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
147
147
|
});
|
|
148
148
|
};
|
|
149
149
|
this.renderContentConditionally = (content) => {
|
|
150
|
+
if (!content)
|
|
151
|
+
return;
|
|
150
152
|
const hasBanner = content.indexOf('<bannermatrix-banner') !== -1;
|
|
151
153
|
if (!hasBanner) {
|
|
152
154
|
return h("div", { class: "BlogContent", innerHTML: this.blogData.content });
|
|
@@ -203,12 +205,17 @@ const BlogArticlesGrid$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
203
205
|
this.blogData = blogContent.map((item) => {
|
|
204
206
|
return Object.assign(Object.assign({}, item), { publishingDate: new Date(item.publishingDate).toLocaleDateString() });
|
|
205
207
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
if (this.paginationActive == true) {
|
|
209
|
+
// start api call mock structure for pagination
|
|
210
|
+
const newArray = this.blogData.map(a => (Object.assign({}, a)));
|
|
211
|
+
newArray.forEach((_) => {
|
|
212
|
+
this.blogsLists.push(newArray.splice(0, this.blogsLimit));
|
|
213
|
+
});
|
|
214
|
+
if (newArray.length) {
|
|
215
|
+
this.blogsLists.push(newArray.splice(0, this.blogsLimit)); // add the rest of the remaining elements in order to simulate the last blog page
|
|
216
|
+
}
|
|
217
|
+
// end api call mock structure for pagination
|
|
210
218
|
}
|
|
211
|
-
// end api call mock structure for pagination
|
|
212
219
|
this.isLoading = false;
|
|
213
220
|
})
|
|
214
221
|
.catch((err) => {
|
|
@@ -233,12 +240,15 @@ const BlogArticlesGrid$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
233
240
|
return (h("div", { class: "BlogArticleDetails" }, h("div", { class: "Title" }, translate('error', this.language))));
|
|
234
241
|
}
|
|
235
242
|
if (!this.isLoading) {
|
|
236
|
-
return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TicketsHistoryPaginationWrapper" }, (this.blogData.length > this.blogsLimit - 1) && this.paginationActive && h("helper-pagination", { "first-page": false, "previous-page": false, offset: this.paginationBlogList.offset, limit: this.blogsLimit, total: this.blogData.length, language: this.language, "client-styling": this.clientStyling || this.defaultStyling, "arrows-active": this.arrowsActive || false, "secondary-arrows-active": this.secondaryArrowsActive || false, "numbered-nav-active": this.numberedNavActive || false })), h("div", { class: "GridContainerWrapper" }, this.blogsLists[this.currentPage].map((data) =>
|
|
237
|
-
|
|
238
|
-
h("div", { class: "
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
243
|
+
return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TicketsHistoryPaginationWrapper" }, (this.blogData.length > this.blogsLimit - 1) && this.paginationActive == true && h("helper-pagination", { "first-page": false, "previous-page": false, offset: this.paginationBlogList.offset, limit: this.blogsLimit, total: this.blogData.length, language: this.language, "client-styling": this.clientStyling || this.defaultStyling, "arrows-active": this.arrowsActive || false, "secondary-arrows-active": this.secondaryArrowsActive || false, "numbered-nav-active": this.numberedNavActive || false })), h("div", { class: "GridContainerWrapper" }, (this.paginationActive ? this.blogsLists[this.currentPage] : this.blogData).map((data) => {
|
|
244
|
+
var _a;
|
|
245
|
+
return h("div", { class: "GridContainer" }, this.showPublishingDate &&
|
|
246
|
+
h("div", { class: "BlogDate" }, data === null || data === void 0 ? void 0 : data.publishingDate), this.showImage &&
|
|
247
|
+
h("div", { class: "BlogBanner" }, h("img", { src: (_a = data === null || data === void 0 ? void 0 : data.image) === null || _a === void 0 ? void 0 : _a.src, alt: data === null || data === void 0 ? void 0 : data.title })), this.showTitle &&
|
|
248
|
+
h("div", { class: "BlogTitle" }, data === null || data === void 0 ? void 0 : data.title), this.showContent &&
|
|
249
|
+
this.renderContentConditionally(data === null || data === void 0 ? void 0 : data.content), this.showButton &&
|
|
250
|
+
h("div", { class: "BlogLink" }, h("button", { onClick: () => this.handleAction(data === null || data === void 0 ? void 0 : data.postID) }, translate('readmore', this.language))));
|
|
251
|
+
}))));
|
|
242
252
|
}
|
|
243
253
|
}
|
|
244
254
|
static get watchers() { return {
|
|
@@ -46,7 +46,7 @@ const translate = (key, customLang) => {
|
|
|
46
46
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
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
|
|
49
|
+
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-top:20px;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:12px}}@media screen and (max-width: 480px){button{width:70px;font-size:10px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:10px}.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}}";
|
|
50
50
|
|
|
51
51
|
const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
52
52
|
constructor() {
|
|
@@ -79,8 +79,8 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
79
79
|
*/
|
|
80
80
|
this.language = 'en';
|
|
81
81
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
* Client custom styling via string
|
|
83
|
+
*/
|
|
84
84
|
this.clientStyling = '';
|
|
85
85
|
/**
|
|
86
86
|
* Client custom styling via url content
|
|
@@ -109,35 +109,32 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
109
109
|
this.offsetInt = this.endInt * this.limitInt;
|
|
110
110
|
break;
|
|
111
111
|
case 'previousPage':
|
|
112
|
-
this.offsetInt -=
|
|
112
|
+
this.offsetInt -= 10;
|
|
113
113
|
break;
|
|
114
114
|
case 'nextPage':
|
|
115
|
-
this.offsetInt +=
|
|
115
|
+
this.offsetInt += 10;
|
|
116
116
|
break;
|
|
117
117
|
case 'fivePagesBack':
|
|
118
|
-
this.offsetInt -=
|
|
119
|
-
this.offsetInt = this.offsetInt
|
|
118
|
+
this.offsetInt -= 30;
|
|
119
|
+
this.offsetInt = this.offsetInt < 0 ? 0 : this.offsetInt;
|
|
120
120
|
break;
|
|
121
121
|
case 'fivePagesForward':
|
|
122
|
-
this.offsetInt +=
|
|
123
|
-
this.offsetInt = this.offsetInt /
|
|
122
|
+
this.offsetInt += 30;
|
|
123
|
+
this.offsetInt = this.offsetInt / 10 >= this.endInt ? this.endInt * 10 : this.offsetInt;
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
|
-
this.previousPage = !this.offsetInt ? false : true;
|
|
127
126
|
this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
|
|
128
127
|
};
|
|
129
128
|
/**
|
|
130
129
|
* Handle navigation from here
|
|
131
130
|
*/
|
|
132
131
|
this.paginationNavigation = (pageNumber, index) => {
|
|
133
|
-
this.previousPage = true;
|
|
134
132
|
if (!isNaN(pageNumber)) {
|
|
135
133
|
if (pageNumber === 1) {
|
|
136
134
|
this.offsetInt = pageNumber - 1;
|
|
137
|
-
this.previousPage = false;
|
|
138
135
|
}
|
|
139
136
|
else {
|
|
140
|
-
this.offsetInt = (pageNumber - 1) *
|
|
137
|
+
this.offsetInt = (pageNumber - 1) * 10;
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
140
|
else {
|
|
@@ -151,6 +148,7 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
151
148
|
this.navigateTo('fivePagesForward');
|
|
152
149
|
}
|
|
153
150
|
}
|
|
151
|
+
this.currentPage = this.offsetInt;
|
|
154
152
|
this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
|
|
155
153
|
};
|
|
156
154
|
this.setClientStyling = () => {
|
|
@@ -168,8 +166,7 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
168
166
|
}
|
|
169
167
|
componentWillRender() {
|
|
170
168
|
this.offsetInt = this.offset;
|
|
171
|
-
this.
|
|
172
|
-
this.currentPage = (this.offsetInt / this.limitInt) + 1;
|
|
169
|
+
this.currentPage = this.offsetInt / this.limitInt + 1;
|
|
173
170
|
this.limitInt = this.limit;
|
|
174
171
|
this.totalInt = this.total;
|
|
175
172
|
this.endInt = (Math.ceil(this.totalInt / this.limitInt) - 1);
|
|
@@ -177,7 +174,7 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
177
174
|
/**
|
|
178
175
|
* Construct numbered navigation area based on current page position
|
|
179
176
|
*/
|
|
180
|
-
if (this.currentPage
|
|
177
|
+
if (this.currentPage === 1 || this.currentPage === 2) {
|
|
181
178
|
this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
|
|
182
179
|
this.pagesArray.push('...');
|
|
183
180
|
}
|
|
@@ -212,22 +209,20 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
212
209
|
/**
|
|
213
210
|
* Left navigation area
|
|
214
211
|
*/
|
|
215
|
-
let
|
|
216
|
-
let buttonsLeftSide = h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
|
|
212
|
+
let buttonsLeftSide = h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage, onClick: this.navigateTo.bind(this, 'firstPage') }, translate('firstPage', this.language)), h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, translate('previousPage', this.language)));
|
|
217
213
|
if (isMobile(this.userAgent)) {
|
|
218
214
|
buttonsLeftSide =
|
|
219
|
-
h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') },
|
|
215
|
+
h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, translate('previousPage', this.language)));
|
|
220
216
|
}
|
|
221
217
|
/**
|
|
222
218
|
* Right navigation area
|
|
223
219
|
*/
|
|
224
|
-
let
|
|
225
|
-
let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
|
|
220
|
+
let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, translate('nextPage', this.language)), h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'lastPage') }, translate('lastPage', this.language)));
|
|
226
221
|
if (isMobile(this.userAgent)) {
|
|
227
222
|
buttonsRightSide =
|
|
228
|
-
h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') },
|
|
223
|
+
h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, translate('nextPage', this.language)));
|
|
229
224
|
}
|
|
230
|
-
return (h("div", { id: "PaginationContainer"
|
|
225
|
+
return (h("div", { id: "PaginationContainer" }, buttonsLeftSide, navigationArea, buttonsRightSide));
|
|
231
226
|
}
|
|
232
227
|
static get style() { return helperPaginationCss; }
|
|
233
228
|
}, [1, "helper-pagination", {
|
|
@@ -236,12 +231,9 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
236
231
|
"offset": [1538],
|
|
237
232
|
"limit": [1538],
|
|
238
233
|
"total": [1538],
|
|
239
|
-
"language": [
|
|
240
|
-
"clientStyling": [
|
|
241
|
-
"clientStylingUrlContent": [
|
|
242
|
-
"arrowsActive": [1540, "arrows-active"],
|
|
243
|
-
"secondaryArrowsActive": [1540, "secondary-arrows-active"],
|
|
244
|
-
"numberedNavActive": [1540, "numbered-nav-active"],
|
|
234
|
+
"language": [513],
|
|
235
|
+
"clientStyling": [513, "client-styling"],
|
|
236
|
+
"clientStylingUrlContent": [513, "client-styling-url-content"],
|
|
245
237
|
"offsetInt": [32],
|
|
246
238
|
"lastPage": [32],
|
|
247
239
|
"limitInt": [32],
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["blog-articles-grid_2",[[1,"blog-articles-grid",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"showButton":[4,"show-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[
|
|
16
|
+
return bootstrapLazy([["blog-articles-grid_2",[[1,"blog-articles-grid",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"showButton":[4,"show-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"offsetInt":[32],"lastPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32],"limitStylingAppends":[32]}]]]], options);
|
|
17
17
|
});
|
|
@@ -144,6 +144,8 @@ const BlogArticlesGrid = class {
|
|
|
144
144
|
});
|
|
145
145
|
};
|
|
146
146
|
this.renderContentConditionally = (content) => {
|
|
147
|
+
if (!content)
|
|
148
|
+
return;
|
|
147
149
|
const hasBanner = content.indexOf('<bannermatrix-banner') !== -1;
|
|
148
150
|
if (!hasBanner) {
|
|
149
151
|
return h("div", { class: "BlogContent", innerHTML: this.blogData.content });
|
|
@@ -200,12 +202,17 @@ const BlogArticlesGrid = class {
|
|
|
200
202
|
this.blogData = blogContent.map((item) => {
|
|
201
203
|
return Object.assign(Object.assign({}, item), { publishingDate: new Date(item.publishingDate).toLocaleDateString() });
|
|
202
204
|
});
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
if (this.paginationActive == true) {
|
|
206
|
+
// start api call mock structure for pagination
|
|
207
|
+
const newArray = this.blogData.map(a => (Object.assign({}, a)));
|
|
208
|
+
newArray.forEach((_) => {
|
|
209
|
+
this.blogsLists.push(newArray.splice(0, this.blogsLimit));
|
|
210
|
+
});
|
|
211
|
+
if (newArray.length) {
|
|
212
|
+
this.blogsLists.push(newArray.splice(0, this.blogsLimit)); // add the rest of the remaining elements in order to simulate the last blog page
|
|
213
|
+
}
|
|
214
|
+
// end api call mock structure for pagination
|
|
207
215
|
}
|
|
208
|
-
// end api call mock structure for pagination
|
|
209
216
|
this.isLoading = false;
|
|
210
217
|
})
|
|
211
218
|
.catch((err) => {
|
|
@@ -230,12 +237,15 @@ const BlogArticlesGrid = class {
|
|
|
230
237
|
return (h("div", { class: "BlogArticleDetails" }, h("div", { class: "Title" }, translate$1('error', this.language))));
|
|
231
238
|
}
|
|
232
239
|
if (!this.isLoading) {
|
|
233
|
-
return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TicketsHistoryPaginationWrapper" }, (this.blogData.length > this.blogsLimit - 1) && this.paginationActive && h("helper-pagination", { "first-page": false, "previous-page": false, offset: this.paginationBlogList.offset, limit: this.blogsLimit, total: this.blogData.length, language: this.language, "client-styling": this.clientStyling || this.defaultStyling, "arrows-active": this.arrowsActive || false, "secondary-arrows-active": this.secondaryArrowsActive || false, "numbered-nav-active": this.numberedNavActive || false })), h("div", { class: "GridContainerWrapper" }, this.blogsLists[this.currentPage].map((data) =>
|
|
234
|
-
|
|
235
|
-
h("div", { class: "
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
240
|
+
return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TicketsHistoryPaginationWrapper" }, (this.blogData.length > this.blogsLimit - 1) && this.paginationActive == true && h("helper-pagination", { "first-page": false, "previous-page": false, offset: this.paginationBlogList.offset, limit: this.blogsLimit, total: this.blogData.length, language: this.language, "client-styling": this.clientStyling || this.defaultStyling, "arrows-active": this.arrowsActive || false, "secondary-arrows-active": this.secondaryArrowsActive || false, "numbered-nav-active": this.numberedNavActive || false })), h("div", { class: "GridContainerWrapper" }, (this.paginationActive ? this.blogsLists[this.currentPage] : this.blogData).map((data) => {
|
|
241
|
+
var _a;
|
|
242
|
+
return h("div", { class: "GridContainer" }, this.showPublishingDate &&
|
|
243
|
+
h("div", { class: "BlogDate" }, data === null || data === void 0 ? void 0 : data.publishingDate), this.showImage &&
|
|
244
|
+
h("div", { class: "BlogBanner" }, h("img", { src: (_a = data === null || data === void 0 ? void 0 : data.image) === null || _a === void 0 ? void 0 : _a.src, alt: data === null || data === void 0 ? void 0 : data.title })), this.showTitle &&
|
|
245
|
+
h("div", { class: "BlogTitle" }, data === null || data === void 0 ? void 0 : data.title), this.showContent &&
|
|
246
|
+
this.renderContentConditionally(data === null || data === void 0 ? void 0 : data.content), this.showButton &&
|
|
247
|
+
h("div", { class: "BlogLink" }, h("button", { onClick: () => this.handleAction(data === null || data === void 0 ? void 0 : data.postID) }, translate$1('readmore', this.language))));
|
|
248
|
+
}))));
|
|
239
249
|
}
|
|
240
250
|
}
|
|
241
251
|
static get watchers() { return {
|
|
@@ -291,7 +301,7 @@ const translate = (key, customLang) => {
|
|
|
291
301
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
292
302
|
};
|
|
293
303
|
|
|
294
|
-
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
|
|
304
|
+
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-top:20px;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:12px}}@media screen and (max-width: 480px){button{width:70px;font-size:10px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:10px}.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}}";
|
|
295
305
|
|
|
296
306
|
const HelperPagination = class {
|
|
297
307
|
constructor(hostRef) {
|
|
@@ -322,8 +332,8 @@ const HelperPagination = class {
|
|
|
322
332
|
*/
|
|
323
333
|
this.language = 'en';
|
|
324
334
|
/**
|
|
325
|
-
|
|
326
|
-
|
|
335
|
+
* Client custom styling via string
|
|
336
|
+
*/
|
|
327
337
|
this.clientStyling = '';
|
|
328
338
|
/**
|
|
329
339
|
* Client custom styling via url content
|
|
@@ -352,35 +362,32 @@ const HelperPagination = class {
|
|
|
352
362
|
this.offsetInt = this.endInt * this.limitInt;
|
|
353
363
|
break;
|
|
354
364
|
case 'previousPage':
|
|
355
|
-
this.offsetInt -=
|
|
365
|
+
this.offsetInt -= 10;
|
|
356
366
|
break;
|
|
357
367
|
case 'nextPage':
|
|
358
|
-
this.offsetInt +=
|
|
368
|
+
this.offsetInt += 10;
|
|
359
369
|
break;
|
|
360
370
|
case 'fivePagesBack':
|
|
361
|
-
this.offsetInt -=
|
|
362
|
-
this.offsetInt = this.offsetInt
|
|
371
|
+
this.offsetInt -= 30;
|
|
372
|
+
this.offsetInt = this.offsetInt < 0 ? 0 : this.offsetInt;
|
|
363
373
|
break;
|
|
364
374
|
case 'fivePagesForward':
|
|
365
|
-
this.offsetInt +=
|
|
366
|
-
this.offsetInt = this.offsetInt /
|
|
375
|
+
this.offsetInt += 30;
|
|
376
|
+
this.offsetInt = this.offsetInt / 10 >= this.endInt ? this.endInt * 10 : this.offsetInt;
|
|
367
377
|
break;
|
|
368
378
|
}
|
|
369
|
-
this.previousPage = !this.offsetInt ? false : true;
|
|
370
379
|
this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
|
|
371
380
|
};
|
|
372
381
|
/**
|
|
373
382
|
* Handle navigation from here
|
|
374
383
|
*/
|
|
375
384
|
this.paginationNavigation = (pageNumber, index) => {
|
|
376
|
-
this.previousPage = true;
|
|
377
385
|
if (!isNaN(pageNumber)) {
|
|
378
386
|
if (pageNumber === 1) {
|
|
379
387
|
this.offsetInt = pageNumber - 1;
|
|
380
|
-
this.previousPage = false;
|
|
381
388
|
}
|
|
382
389
|
else {
|
|
383
|
-
this.offsetInt = (pageNumber - 1) *
|
|
390
|
+
this.offsetInt = (pageNumber - 1) * 10;
|
|
384
391
|
}
|
|
385
392
|
}
|
|
386
393
|
else {
|
|
@@ -394,6 +401,7 @@ const HelperPagination = class {
|
|
|
394
401
|
this.navigateTo('fivePagesForward');
|
|
395
402
|
}
|
|
396
403
|
}
|
|
404
|
+
this.currentPage = this.offsetInt;
|
|
397
405
|
this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
|
|
398
406
|
};
|
|
399
407
|
this.setClientStyling = () => {
|
|
@@ -411,8 +419,7 @@ const HelperPagination = class {
|
|
|
411
419
|
}
|
|
412
420
|
componentWillRender() {
|
|
413
421
|
this.offsetInt = this.offset;
|
|
414
|
-
this.
|
|
415
|
-
this.currentPage = (this.offsetInt / this.limitInt) + 1;
|
|
422
|
+
this.currentPage = this.offsetInt / this.limitInt + 1;
|
|
416
423
|
this.limitInt = this.limit;
|
|
417
424
|
this.totalInt = this.total;
|
|
418
425
|
this.endInt = (Math.ceil(this.totalInt / this.limitInt) - 1);
|
|
@@ -420,7 +427,7 @@ const HelperPagination = class {
|
|
|
420
427
|
/**
|
|
421
428
|
* Construct numbered navigation area based on current page position
|
|
422
429
|
*/
|
|
423
|
-
if (this.currentPage
|
|
430
|
+
if (this.currentPage === 1 || this.currentPage === 2) {
|
|
424
431
|
this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
|
|
425
432
|
this.pagesArray.push('...');
|
|
426
433
|
}
|
|
@@ -455,22 +462,20 @@ const HelperPagination = class {
|
|
|
455
462
|
/**
|
|
456
463
|
* Left navigation area
|
|
457
464
|
*/
|
|
458
|
-
let
|
|
459
|
-
let buttonsLeftSide = h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
|
|
465
|
+
let buttonsLeftSide = h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage, onClick: this.navigateTo.bind(this, 'firstPage') }, translate('firstPage', this.language)), h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, translate('previousPage', this.language)));
|
|
460
466
|
if (isMobile(this.userAgent)) {
|
|
461
467
|
buttonsLeftSide =
|
|
462
|
-
h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') },
|
|
468
|
+
h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, translate('previousPage', this.language)));
|
|
463
469
|
}
|
|
464
470
|
/**
|
|
465
471
|
* Right navigation area
|
|
466
472
|
*/
|
|
467
|
-
let
|
|
468
|
-
let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
|
|
473
|
+
let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, translate('nextPage', this.language)), h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'lastPage') }, translate('lastPage', this.language)));
|
|
469
474
|
if (isMobile(this.userAgent)) {
|
|
470
475
|
buttonsRightSide =
|
|
471
|
-
h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') },
|
|
476
|
+
h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, translate('nextPage', this.language)));
|
|
472
477
|
}
|
|
473
|
-
return (h("div", { id: "PaginationContainer"
|
|
478
|
+
return (h("div", { id: "PaginationContainer" }, buttonsLeftSide, navigationArea, buttonsRightSide));
|
|
474
479
|
}
|
|
475
480
|
};
|
|
476
481
|
HelperPagination.style = helperPaginationCss;
|
package/dist/esm/loader.js
CHANGED
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["blog-articles-grid_2",[[1,"blog-articles-grid",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"showButton":[4,"show-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[
|
|
13
|
+
return bootstrapLazy([["blog-articles-grid_2",[[1,"blog-articles-grid",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"showButton":[4,"show-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"offsetInt":[32],"lastPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32],"limitStylingAppends":[32]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as n}from"./p-f0d2badc.js";const s=["ro","en","fr","ar"],e={en:{error:"Error",readmore:"Read more"},ro:{error:"Eroare",readmore:"Read more"},fr:{error:"Error",readmore:"Read more"},ar:{error:"خطأ",readmore:"Read more"}},o=(t,i)=>{const n=i;return e[void 0!==n&&s.includes(n)?n:"en"][t]},r=class{constructor(s){t(this,s),this.articleActionButton=i(this,"articleActionButton",7),this.language="en",this.clientStyling="",this.clientStylingUrl="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.showButton=!0,this.postMessageEvent="articleActionButton",this.paginationBlogList={offset:0},this.currentPage=0,this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.blogsLists=[],this.defaultStyling="\n div#PaginationContainer {\n justify-content: right;\n }\n .LeftItems button .NavigationButton {\n display: none;\n }\n .LeftItems button:after, .RightItems button:after {\n padding: 7px 12px;\n font-size: 18px;\n font-weight: 700;\n line-height: 46px;\n }\n .LeftItems button:after {\n 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\");\n }\n .RightItems button:after {\n 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\");\n display: block;\n height: 38px;\n }\n div.LeftItems button, div.RightItems button {\n width: unset;\n height: 40px;\n background-color: #fff;\n color: #000;\n border: 1px solid #000;\n overflow: hidden;\n &:disabled {\n background-color: #989898;\n }\n }\n div.LeftItems button {\n min-width: 60px;\n border-radius: 20px 0 0 20px;\n border-right: 0;\n }\n div.RightItems button {\n display: flex;\n min-width: 100px;\n justify-content: space-evenly;\n align-items: center;\n border-radius: 0 20px 20px 0;\n text-transform: none;\n }\n .RightItems button .NavigationButton {\n padding: 12px 0 12px 12px;\n font-weight: 700;\n }",this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(i)}),1)})).catch((t=>{console.log("error ",t)}))},this.renderContentConditionally=t=>-1!==t.indexOf("<bannermatrix-banner")?this.bannerMatrixReady?n("div",{class:"BlogContent",innerHTML:this.blogData.content}):null:n("div",{class:"BlogContent",innerHTML:this.blogData.content})}getArticleId(t){this.articleActionButton.emit({postId:t}),this.usePostmessage&&window.postMessage({type:this.postMessageEvent,postId:t})}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getBlogArticleGrid()}hpPageChange(t){var i,n;this.paginationBlogList=t.detail,this.currentPage=Math.floor((null===(i=this.paginationBlogList)||void 0===i?void 0:i.offset)/(null===(n=this.paginationBlogList)||void 0===n?void 0:n.limit))}handleAction(t){this.getArticleId(t)}connectedCallback(){this.cmsEndpoint&&this.language&&this.getBlogArticleGrid()}componentDidLoad(){window.postMessage({type:"BlogArticlesGridLoaded"},window.location.href)}getBlogArticleGrid(){this.isLoading=!0;let t=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);fetch(t.href).then((t=>{if(t.status>=300)throw this.hasErrors=!0,new Error("There was an error while fetching the data");return t.json()})).then((t=>{this.blogData=t.map((t=>Object.assign(Object.assign({},t),{publishingDate:new Date(t.publishingDate).toLocaleDateString()})));const i=this.blogData.map((t=>Object.assign({},t)));for(;i.length>0;)this.blogsLists.push(i.splice(0,this.blogsLimit));this.isLoading=!1})).catch((t=>{this.hasErrors=!0,console.log("Error",t)})).finally((()=>this.isLoading=!1))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){return this.hasErrors?n("div",{class:"BlogArticleDetails"},n("div",{class:"Title"},o("error",this.language))):this.isLoading?void 0:n("div",{ref:t=>this.stylingContainer=t},n("div",{class:"TicketsHistoryPaginationWrapper"},this.blogData.length>this.blogsLimit-1&&this.paginationActive&&n("helper-pagination",{"first-page":!1,"previous-page":!1,offset:this.paginationBlogList.offset,limit:this.blogsLimit,total:this.blogData.length,language:this.language,"client-styling":this.clientStyling||this.defaultStyling,"arrows-active":this.arrowsActive||!1,"secondary-arrows-active":this.secondaryArrowsActive||!1,"numbered-nav-active":this.numberedNavActive||!1})),n("div",{class:"GridContainerWrapper"},this.blogsLists[this.currentPage].map((t=>n("div",{class:"GridContainer"},this.showPublishingDate&&n("div",{class:"BlogDate"},t.publishingDate),this.showImage&&n("div",{class:"BlogBanner"},n("img",{src:t.image.src,alt:t.title})),this.showTitle&&n("div",{class:"BlogTitle"},t.title),this.showContent&&this.renderContentConditionally(t.content),this.showButton&&n("div",{class:"BlogLink"},n("button",{onClick:()=>this.handleAction(t.postID)},o("readmore",this.language))))))))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};r.style=":host {\n display: block;\n}\n\n.GridContainerWrapper {\n display: grid;\n}\n\n.GridContainer {\n margin: auto;\n width: 100%;\n height: 280px;\n border-radius: 15px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n gap: 30px;\n grid-template-rows: 1fr 4fr 1fr 1fr;\n grid-template-columns: 30px 1fr 1fr 30px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/3;\n grid-row: 1/5;\n}\n.GridContainer .BlogBanner img {\n border-radius: 5px 0 0 5px;\n width: 100%;\n height: 280px;\n}\n.GridContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n grid-column: 2/2;\n grid-row: 4/4;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #FFF;\n margin-top: 20px;\n grid-column: 3/5;\n}\n.GridContainer .BlogContent {\n font-size: 14px;\n color: #FFF;\n width: 90%;\n max-height: 80px;\n overflow: hidden;\n text-overflow: ellipsis;\n grid-column: 3/5;\n}\n.GridContainer .BlogLink {\n grid-column: 3/5;\n color: #FFF;\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 (max-width: 475px) {\n .GridContainerWrapper {\n display: grid;\n }\n\n .GridContainer {\n margin: auto;\n width: 100%;\n min-height: 400px;\n gap: 10%;\n padding-bottom: 30px;\n border-radius: 5px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n grid-template-rows: repeat(auto-fit, minmax(50px, 1fr));\n grid-template-rows: auto auto auto 50px;\n grid-template-columns: 15px auto auto 15px;\n gap: 10px;\n }\n .GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n margin: 0;\n }\n .GridContainer .BlogBanner img {\n width: 100%;\n height: 232px;\n border-radius: 5px 5px 0 0;\n }\n .GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n z-index: 1;\n }\n .GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n }\n .GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n }\n .GridContainer .BlogLink {\n grid-column: 2/4;\n color: #FFF;\n cursor: pointer;\n }\n .GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n background: none;\n color: #D0046C;\n cursor: pointer;\n }\n}";const a=t=>!!(t.toLowerCase().match(/android/i)||t.toLowerCase().match(/blackberry|bb/i)||t.toLowerCase().match(/iphone|ipad|ipod/i)||t.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),h=["ro","en"],d={en:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ro:{firstPage:"Prima",previousPage:"Anterior",nextPage:"Urmatoarea",lastPage:"Ultima"},fr:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ar:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"}},l=(t,i)=>{const n=i;return d[void 0!==n&&h.includes(n)?n:"en"][t]},c=class{constructor(n){t(this,n),this.hpPageChange=i(this,"hpPageChange",7),this.firstPage=!1,this.previousPage=!1,this.offset=0,this.limit=1,this.total=1,this.language="en",this.clientStyling="",this.clientStylingUrlContent="",this.pagesArray=[],this.endInt=0,this.userAgent=window.navigator.userAgent,this.currentPage=1,this.limitStylingAppends=!1,this.navigateTo=t=>{switch(t){case"firstPage":this.offsetInt=0;break;case"lastPage":this.offsetInt=this.endInt*this.limitInt;break;case"previousPage":this.offsetInt-=this.limitInt;break;case"nextPage":this.offsetInt+=this.limitInt;break;case"fivePagesBack":this.offsetInt-=5*this.limitInt,this.offsetInt=this.offsetInt<=0?0:this.offsetInt;break;case"fivePagesForward":this.offsetInt+=5*this.limitInt,this.offsetInt=this.offsetInt/this.limitInt>=this.endInt?this.endInt*this.limitInt:this.offsetInt}this.previousPage=!!this.offsetInt,this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.paginationNavigation=(t,i)=>{this.previousPage=!0,isNaN(t)?0===i&&this.currentPage<=4?this.navigateTo("firstPage"):0===i&&this.currentPage>4?this.navigateTo("fivePagesBack"):4===i&&this.endInt-this.currentPage>=2&&this.navigateTo("fivePagesForward"):1===t?(this.offsetInt=t-1,this.previousPage=!1):this.offsetInt=(t-1)*this.limitInt,this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=document.createElement("style");setTimeout((()=>{t.innerHTML=this.clientStylingUrlContent,this.stylingContainer.prepend(t)}),1)}}componentWillRender(){this.offsetInt=this.offset,this.limitInt=this.limit,this.currentPage=this.offsetInt/this.limitInt+1,this.limitInt=this.limit,this.totalInt=this.total,this.endInt=Math.ceil(this.totalInt/this.limitInt)-1,this.lastPage=!(this.offsetInt>=this.endInt*this.limitInt),1==this.currentPage||2==this.currentPage?(this.pagesArray=Array.from({length:4},((t,i)=>i+1)),this.pagesArray.push("...")):this.currentPage>=3&&this.endInt-this.currentPage>=2?(this.pagesArray=Array.from({length:3},((t,i)=>this.currentPage+i-1)),this.pagesArray.push("..."),this.pagesArray.unshift("...")):this.endInt-this.currentPage<3&&(this.pagesArray=Array.from({length:4},((t,i)=>this.endInt-2+i)),this.pagesArray.unshift("..."))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrlContent&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){let t=n("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>n("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(a(this.userAgent)?"MobileButtons":"")},n("button",{disabled:t===this.currentPage,onClick:this.paginationNavigation.bind(this,t,i)},n("span",null,t)))))),i=n("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"firstPage")},n("span",{class:"NavigationButton"},l("firstPage",this.language)),n("span",{class:"NavigationIcon"})),s=n("div",{class:"LeftItems"},this.secondaryArrowsActive&&i,n("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"previousPage")},n("span",{class:"NavigationButton"},l("previousPage",this.language)),n("span",{class:"NavigationIcon"})));a(this.userAgent)&&(s=n("div",{class:"LeftItems"},n("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"previousPage")},n("span",{class:"NavigationButton"},l("previousPage",this.language)),n("span",{class:"NavigationIcon"}))));let e=n("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"lastPage")},n("span",{class:"NavigationButton"},l("lastPage",this.language)),n("span",{class:"NavigationIcon"})),o=n("div",{class:"RightItems"},n("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"nextPage")},n("span",{class:"NavigationButton"},l("nextPage",this.language)),n("span",{class:"NavigationIcon"})),this.secondaryArrowsActive&&e);return a(this.userAgent)&&(o=n("div",{class:"RightItems"},n("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"nextPage")},n("span",{class:"NavigationButton"},l("nextPage",this.language)),n("span",{class:"NavigationIcon"})))),n("div",{id:"PaginationContainer",ref:t=>this.stylingContainer=t},this.arrowsActive&&s,this.numberedNavActive&&t,this.arrowsActive&&o)}};c.style='@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}}';export{r as blog_articles_grid,c as helper_pagination}
|