@everymatrix/helper-pagination 1.99.44 → 1.99.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/helper-pagination.cjs.entry.js +2 -2
- package/dist/collection/components/helper-pagination/helper-pagination.css +57 -35
- package/dist/collection/components/helper-pagination/helper-pagination.js +1 -1
- package/dist/esm/helper-pagination.entry.js +2 -2
- package/dist/helper-pagination/helper-pagination.entry.js +1 -1
- package/package.json +1 -1
|
@@ -179,7 +179,7 @@ const translate = (key, customLang) => {
|
|
|
179
179
|
return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
const helperPaginationCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}#PaginationContainer{width:100%;margin:20px 0;display:inline-flex;justify-content:
|
|
182
|
+
const helperPaginationCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}#PaginationContainer{width:100%;margin:20px 0;display:inline-flex;justify-content:center;align-items:center;gap:4px}.LeftItems .PaginationControl,.RightItems .PaginationControl{position:relative;width:24px;height:28px;padding:0;border:0;border-radius:0;background:transparent;color:#009993;}.LeftItems .PaginationControl[aria-disabled=true],.RightItems .PaginationControl[aria-disabled=true]{background:transparent;color:#009993;opacity:0.35}.LeftItems .PaginationControl .NavigationButton,.RightItems .PaginationControl .NavigationButton{display:none}.LeftItems .PaginationControl .NavigationIcon::before,.LeftItems .PaginationControl .NavigationIcon::after,.RightItems .PaginationControl .NavigationIcon::before,.RightItems .PaginationControl .NavigationIcon::after{content:\"\";position:absolute;top:50%;left:50%;box-sizing:border-box;width:8px;height:8px;border:solid currentColor;border-width:2px 2px 0 0}.LeftItems .PaginationControl .NavigationIcon::after,.RightItems .PaginationControl .NavigationIcon::after{display:none}.LeftItems .PaginationControl[data-nav=nextPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=nextPage] .NavigationIcon::before{transform:translate(-70%, -50%) rotate(45deg)}.LeftItems .PaginationControl[data-nav=previousPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=previousPage] .NavigationIcon::before{transform:translate(-30%, -50%) rotate(-135deg)}.LeftItems .PaginationControl[data-nav=lastPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=lastPage] .NavigationIcon::before{transform:translate(-110%, -50%) rotate(45deg)}.LeftItems .PaginationControl[data-nav=lastPage] .NavigationIcon::after,.RightItems .PaginationControl[data-nav=lastPage] .NavigationIcon::after{display:block;transform:translate(-30%, -50%) rotate(45deg)}.LeftItems .PaginationControl[data-nav=firstPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=firstPage] .NavigationIcon::before{transform:translate(-70%, -50%) rotate(-135deg)}.LeftItems .PaginationControl[data-nav=firstPage] .NavigationIcon::after,.RightItems .PaginationControl[data-nav=firstPage] .NavigationIcon::after{display:block;transform:translate(10%, -50%) rotate(-135deg)}.PaginationArea{display:inline-flex;gap:10px;list-style:none;margin:0;padding:0}.PaginationArea li{margin:0;padding:0}.PaginationArea li a{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 a{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem a[aria-disabled=true]{pointer-events:none;cursor:not-allowed}.PaginationItem a:hover,.PaginationItem a:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}a,.PaginationControl{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-decoration:none;width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:background-color 0.1s linear, border-color 0.1s linear, color 0.1s linear, opacity 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}a:hover,a:active{background:#004D4A;border-color:#004D4A}a[aria-disabled=true],.PaginationControl[aria-disabled=true]{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 480px){a,.PaginationControl{width:70px;font-size:14px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){a,.PaginationControl{width:58px;font-size:12px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem a:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem a:hover{background:#009993;border-color:#009993;color:#fff}}";
|
|
183
183
|
const HelperPaginationStyle0 = helperPaginationCss;
|
|
184
184
|
|
|
185
185
|
const HelperPagination = class {
|
|
@@ -339,7 +339,7 @@ const HelperPagination = class {
|
|
|
339
339
|
renderNavigationButton(page, navigation, enabled, rel) {
|
|
340
340
|
const Tag = enabled ? 'a' : 'span';
|
|
341
341
|
const label = translate(navigation, this.language);
|
|
342
|
-
return (index.h(Tag, { class: "PaginationControl", href: enabled ? this.pageHref(page) : undefined, rel: enabled ? rel : undefined, "aria-label": label, "aria-disabled": !enabled ? 'true' : undefined, onClick: enabled ? event => {
|
|
342
|
+
return (index.h(Tag, { class: "PaginationControl", "data-nav": navigation, href: enabled ? this.pageHref(page) : undefined, rel: enabled ? rel : undefined, "aria-label": label, "aria-disabled": !enabled ? 'true' : undefined, onClick: enabled ? event => {
|
|
343
343
|
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
344
344
|
return;
|
|
345
345
|
event.preventDefault();
|
|
@@ -8,24 +8,74 @@
|
|
|
8
8
|
width: 100%;
|
|
9
9
|
margin: 20px 0;
|
|
10
10
|
display: inline-flex;
|
|
11
|
-
justify-content:
|
|
11
|
+
justify-content: center;
|
|
12
12
|
align-items: center;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.LeftItems .PaginationControl:not(:first-child), .RightItems .PaginationControl:not(:last-child) {
|
|
16
|
-
margin: 0 10px;
|
|
13
|
+
gap: 4px;
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
.LeftItems .PaginationControl, .RightItems .PaginationControl {
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 24px;
|
|
19
|
+
height: 28px;
|
|
20
20
|
padding: 0;
|
|
21
|
-
|
|
22
|
-
border-
|
|
21
|
+
border: 0;
|
|
22
|
+
border-radius: 0;
|
|
23
|
+
background: transparent;
|
|
24
|
+
color: #009993;
|
|
25
|
+
/* icon-only: the text label stays available through the control's aria-label */
|
|
26
|
+
/* the second chevron is only used by first / last */
|
|
27
|
+
}
|
|
28
|
+
.LeftItems .PaginationControl[aria-disabled=true], .RightItems .PaginationControl[aria-disabled=true] {
|
|
29
|
+
background: transparent;
|
|
30
|
+
color: #009993;
|
|
31
|
+
opacity: 0.35;
|
|
32
|
+
}
|
|
33
|
+
.LeftItems .PaginationControl .NavigationButton, .RightItems .PaginationControl .NavigationButton {
|
|
34
|
+
display: none;
|
|
35
|
+
}
|
|
36
|
+
.LeftItems .PaginationControl .NavigationIcon::before,
|
|
37
|
+
.LeftItems .PaginationControl .NavigationIcon::after, .RightItems .PaginationControl .NavigationIcon::before,
|
|
38
|
+
.RightItems .PaginationControl .NavigationIcon::after {
|
|
39
|
+
content: "";
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 50%;
|
|
42
|
+
left: 50%;
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
width: 8px;
|
|
45
|
+
height: 8px;
|
|
46
|
+
border: solid currentColor;
|
|
47
|
+
border-width: 2px 2px 0 0;
|
|
48
|
+
}
|
|
49
|
+
.LeftItems .PaginationControl .NavigationIcon::after, .RightItems .PaginationControl .NavigationIcon::after {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
.LeftItems .PaginationControl[data-nav=nextPage] .NavigationIcon::before, .RightItems .PaginationControl[data-nav=nextPage] .NavigationIcon::before {
|
|
53
|
+
transform: translate(-70%, -50%) rotate(45deg);
|
|
54
|
+
}
|
|
55
|
+
.LeftItems .PaginationControl[data-nav=previousPage] .NavigationIcon::before, .RightItems .PaginationControl[data-nav=previousPage] .NavigationIcon::before {
|
|
56
|
+
transform: translate(-30%, -50%) rotate(-135deg);
|
|
57
|
+
}
|
|
58
|
+
.LeftItems .PaginationControl[data-nav=lastPage] .NavigationIcon::before, .RightItems .PaginationControl[data-nav=lastPage] .NavigationIcon::before {
|
|
59
|
+
transform: translate(-110%, -50%) rotate(45deg);
|
|
60
|
+
}
|
|
61
|
+
.LeftItems .PaginationControl[data-nav=lastPage] .NavigationIcon::after, .RightItems .PaginationControl[data-nav=lastPage] .NavigationIcon::after {
|
|
62
|
+
display: block;
|
|
63
|
+
transform: translate(-30%, -50%) rotate(45deg);
|
|
64
|
+
}
|
|
65
|
+
.LeftItems .PaginationControl[data-nav=firstPage] .NavigationIcon::before, .RightItems .PaginationControl[data-nav=firstPage] .NavigationIcon::before {
|
|
66
|
+
transform: translate(-70%, -50%) rotate(-135deg);
|
|
67
|
+
}
|
|
68
|
+
.LeftItems .PaginationControl[data-nav=firstPage] .NavigationIcon::after, .RightItems .PaginationControl[data-nav=firstPage] .NavigationIcon::after {
|
|
69
|
+
display: block;
|
|
70
|
+
transform: translate(10%, -50%) rotate(-135deg);
|
|
23
71
|
}
|
|
24
72
|
|
|
25
73
|
.PaginationArea {
|
|
26
74
|
display: inline-flex;
|
|
27
75
|
gap: 10px;
|
|
28
76
|
list-style: none;
|
|
77
|
+
margin: 0;
|
|
78
|
+
padding: 0;
|
|
29
79
|
}
|
|
30
80
|
|
|
31
81
|
.PaginationArea li {
|
|
@@ -100,34 +150,6 @@ a[aria-disabled=true], .PaginationControl[aria-disabled=true] {
|
|
|
100
150
|
cursor: not-allowed;
|
|
101
151
|
}
|
|
102
152
|
|
|
103
|
-
@media screen and (max-width: 720px) {
|
|
104
|
-
#PaginationContainer {
|
|
105
|
-
flex-wrap: wrap;
|
|
106
|
-
row-gap: 10px;
|
|
107
|
-
}
|
|
108
|
-
#PaginationContainer .LeftItems, #PaginationContainer .RightItems {
|
|
109
|
-
display: flex;
|
|
110
|
-
flex-direction: column;
|
|
111
|
-
gap: 10px;
|
|
112
|
-
}
|
|
113
|
-
#PaginationContainer .RightItems {
|
|
114
|
-
flex-direction: column-reverse;
|
|
115
|
-
}
|
|
116
|
-
#PaginationContainer .PaginationControl {
|
|
117
|
-
margin: 0;
|
|
118
|
-
}
|
|
119
|
-
#PaginationContainer .PaginationArea {
|
|
120
|
-
order: 1;
|
|
121
|
-
flex-basis: 100%;
|
|
122
|
-
justify-content: center;
|
|
123
|
-
margin: 0;
|
|
124
|
-
padding: 0;
|
|
125
|
-
}
|
|
126
|
-
a, .PaginationControl {
|
|
127
|
-
width: 90px;
|
|
128
|
-
font-size: 14px;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
153
|
@media screen and (max-width: 480px) {
|
|
132
154
|
a, .PaginationControl {
|
|
133
155
|
width: 70px;
|
|
@@ -157,7 +157,7 @@ export class HelperPagination {
|
|
|
157
157
|
renderNavigationButton(page, navigation, enabled, rel) {
|
|
158
158
|
const Tag = enabled ? 'a' : 'span';
|
|
159
159
|
const label = translate(navigation, this.language);
|
|
160
|
-
return (h(Tag, { class: "PaginationControl", href: enabled ? this.pageHref(page) : undefined, rel: enabled ? rel : undefined, "aria-label": label, "aria-disabled": !enabled ? 'true' : undefined, onClick: enabled ? event => {
|
|
160
|
+
return (h(Tag, { class: "PaginationControl", "data-nav": navigation, href: enabled ? this.pageHref(page) : undefined, rel: enabled ? rel : undefined, "aria-label": label, "aria-disabled": !enabled ? 'true' : undefined, onClick: enabled ? event => {
|
|
161
161
|
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
162
162
|
return;
|
|
163
163
|
event.preventDefault();
|
|
@@ -175,7 +175,7 @@ const translate = (key, customLang) => {
|
|
|
175
175
|
return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
176
176
|
};
|
|
177
177
|
|
|
178
|
-
const helperPaginationCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}#PaginationContainer{width:100%;margin:20px 0;display:inline-flex;justify-content:
|
|
178
|
+
const helperPaginationCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}#PaginationContainer{width:100%;margin:20px 0;display:inline-flex;justify-content:center;align-items:center;gap:4px}.LeftItems .PaginationControl,.RightItems .PaginationControl{position:relative;width:24px;height:28px;padding:0;border:0;border-radius:0;background:transparent;color:#009993;}.LeftItems .PaginationControl[aria-disabled=true],.RightItems .PaginationControl[aria-disabled=true]{background:transparent;color:#009993;opacity:0.35}.LeftItems .PaginationControl .NavigationButton,.RightItems .PaginationControl .NavigationButton{display:none}.LeftItems .PaginationControl .NavigationIcon::before,.LeftItems .PaginationControl .NavigationIcon::after,.RightItems .PaginationControl .NavigationIcon::before,.RightItems .PaginationControl .NavigationIcon::after{content:\"\";position:absolute;top:50%;left:50%;box-sizing:border-box;width:8px;height:8px;border:solid currentColor;border-width:2px 2px 0 0}.LeftItems .PaginationControl .NavigationIcon::after,.RightItems .PaginationControl .NavigationIcon::after{display:none}.LeftItems .PaginationControl[data-nav=nextPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=nextPage] .NavigationIcon::before{transform:translate(-70%, -50%) rotate(45deg)}.LeftItems .PaginationControl[data-nav=previousPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=previousPage] .NavigationIcon::before{transform:translate(-30%, -50%) rotate(-135deg)}.LeftItems .PaginationControl[data-nav=lastPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=lastPage] .NavigationIcon::before{transform:translate(-110%, -50%) rotate(45deg)}.LeftItems .PaginationControl[data-nav=lastPage] .NavigationIcon::after,.RightItems .PaginationControl[data-nav=lastPage] .NavigationIcon::after{display:block;transform:translate(-30%, -50%) rotate(45deg)}.LeftItems .PaginationControl[data-nav=firstPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=firstPage] .NavigationIcon::before{transform:translate(-70%, -50%) rotate(-135deg)}.LeftItems .PaginationControl[data-nav=firstPage] .NavigationIcon::after,.RightItems .PaginationControl[data-nav=firstPage] .NavigationIcon::after{display:block;transform:translate(10%, -50%) rotate(-135deg)}.PaginationArea{display:inline-flex;gap:10px;list-style:none;margin:0;padding:0}.PaginationArea li{margin:0;padding:0}.PaginationArea li a{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 a{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem a[aria-disabled=true]{pointer-events:none;cursor:not-allowed}.PaginationItem a:hover,.PaginationItem a:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}a,.PaginationControl{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-decoration:none;width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:background-color 0.1s linear, border-color 0.1s linear, color 0.1s linear, opacity 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}a:hover,a:active{background:#004D4A;border-color:#004D4A}a[aria-disabled=true],.PaginationControl[aria-disabled=true]{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 480px){a,.PaginationControl{width:70px;font-size:14px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){a,.PaginationControl{width:58px;font-size:12px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem a:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem a:hover{background:#009993;border-color:#009993;color:#fff}}";
|
|
179
179
|
const HelperPaginationStyle0 = helperPaginationCss;
|
|
180
180
|
|
|
181
181
|
const HelperPagination = class {
|
|
@@ -335,7 +335,7 @@ const HelperPagination = class {
|
|
|
335
335
|
renderNavigationButton(page, navigation, enabled, rel) {
|
|
336
336
|
const Tag = enabled ? 'a' : 'span';
|
|
337
337
|
const label = translate(navigation, this.language);
|
|
338
|
-
return (h(Tag, { class: "PaginationControl", href: enabled ? this.pageHref(page) : undefined, rel: enabled ? rel : undefined, "aria-label": label, "aria-disabled": !enabled ? 'true' : undefined, onClick: enabled ? event => {
|
|
338
|
+
return (h(Tag, { class: "PaginationControl", "data-nav": navigation, href: enabled ? this.pageHref(page) : undefined, rel: enabled ? rel : undefined, "aria-label": label, "aria-disabled": !enabled ? 'true' : undefined, onClick: enabled ? event => {
|
|
339
339
|
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
340
340
|
return;
|
|
341
341
|
event.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as e}from"./index-4984476a.js";const s="__WIDGET_GLOBAL_STYLE_CACHE__";function n(t,i){if(t){const e=document.createElement("style");e.innerHTML=i,t.appendChild(e)}}function a(t,i){if(!t||!i)return;const e=new URL(i);fetch(e.href).then((t=>t.text())).then((i=>{const e=document.createElement("style");e.innerHTML=i,t&&t.appendChild(e)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const o={en:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ro:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},fr:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ar:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},hu:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},hr:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"}},r=class{constructor(e){t(this,e),this.hpPageChange=i(this,"hpPageChange",7),this.userAgent=window.navigator.userAgent,this.currentPage=1,this.navigateTo=t=>{var i;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,null===(i=this.hpPageChange)||void 0===i||i.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.paginationNavigation=(t,i)=>{var e;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,null===(e=this.hpPageChange)||void 0===e||e.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.nextPage="",this.prevPage="",this.offset=0,this.limit=1,this.total=1,this.language="en",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.arrowsActive=!0,this.secondaryArrowsActive=!1,this.numberedNavActive=!1,this.pageQueryParam=void 0,this.page=1,this.offsetInt=0,this.lastPage=!1,this.previousPage=!1,this.limitInt=0,this.totalInt=0,this.pagesArray=[],this.endInt=0}handleClientStylingChange(t,i){t!==i&&n(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!==i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}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),this.endInt<4?this.pagesArray=Array.from({length:this.endInt+1},((t,i)=>i+1)):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("..."))}handleClientStyling(){void 0===window.emMessageBus?(this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)):this.stylingSubscription=function(t,i,e,n=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!n)return function(t,i){const e=document.createElement("style");return window.emMessageBus.subscribe(i,(i=>{t&&(e.innerHTML=i,t.appendChild(e))}))}(t,i);window[s]||(window[s]={});const a=(e=function(t,i){return window.emMessageBus.subscribe(i,(e=>{if(!t)return;const n=t.getRootNode(),a=window[s];let o=a[i]&&a[i].sheet;o?a[i].refCount=a[i].refCount+1:(o=new CSSStyleSheet,o.replaceSync(e),a[i]={sheet:o,refCount:1});const r=n.adoptedStyleSheets||[];r.includes(o)||(n.adoptedStyleSheets=[...r,o])}))}(t,i)).unsubscribe.bind(e);return e.unsubscribe=()=>{if(window[s][i]){const t=window[s][i];t.refCount>1?t.refCount=t.refCount-1:delete window[s][i]}a()},e}(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription,!0)}componentDidLoad(){this.handleClientStyling()}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}pageHref(t){if(!this.pageQueryParam)return"#";const i=new URL(window.location.href),e=t+this.page-1;return 1===e?i.searchParams.delete(this.pageQueryParam):i.searchParams.set(this.pageQueryParam,String(e)),`${i.pathname}${i.search}${i.hash}`}renderNavigationButton(t,i,s,n){const a=o[void 0!==(r=this.language)&&r in o?r:"en"][i];var r;return e(s?"a":"span",{class:"PaginationControl",href:s?this.pageHref(t):void 0,rel:s?n:void 0,"aria-label":a,"aria-disabled":s?void 0:"true",onClick:s?t=>{0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),this.navigateTo(i))}:void 0},e("span",{class:"NavigationButton"},a),e("span",{class:"NavigationIcon"}))}render(){let t=e("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>{const s="number"==typeof t?t:0===i?Math.max(1,this.currentPage-5):Math.min(this.endInt+1,this.currentPage+5);return e("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(n=this.userAgent,n.toLowerCase().match(/android/i)||n.toLowerCase().match(/blackberry|bb/i)||n.toLowerCase().match(/iphone|ipad|ipod/i)||n.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)?"MobileButtons":"")},e("a",{href:this.pageHref(s),"aria-current":t===this.currentPage?"page":void 0,"aria-disabled":t===this.currentPage?"true":void 0,tabIndex:t===this.currentPage?-1:void 0,onClick:e=>{0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),t!==this.currentPage&&this.paginationNavigation(t,i))}},e("span",null,t)));var n})));const i=e("div",{class:"LeftItems"},this.secondaryArrowsActive&&this.renderNavigationButton(1,"firstPage",Boolean(this.prevPage)),this.renderNavigationButton(this.currentPage-1,"previousPage",Boolean(this.prevPage),"prev")),s=e("div",{class:"RightItems"},this.renderNavigationButton(this.currentPage+1,"nextPage",Boolean(this.nextPage),"next"),this.secondaryArrowsActive&&this.renderNavigationButton(this.endInt+1,"lastPage",Boolean(this.nextPage)));return e("nav",{id:"PaginationContainer",class:"PaginationContainer","aria-label":"Blog pagination",ref:t=>this.stylingContainer=t},this.arrowsActive&&i,this.numberedNavActive&&t,this.arrowsActive&&s)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};r.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 .PaginationControl:not(:first-child),.RightItems .PaginationControl:not(:last-child){margin:0 10px}.LeftItems .PaginationControl,.RightItems .PaginationControl{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 a{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 a{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem a[aria-disabled=true]{pointer-events:none;cursor:not-allowed}.PaginationItem a:hover,.PaginationItem a:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}a,.PaginationControl{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-decoration:none;width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:background-color 0.1s linear, border-color 0.1s linear, color 0.1s linear, opacity 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}a:hover,a:active{background:#004D4A;border-color:#004D4A}a[aria-disabled=true],.PaginationControl[aria-disabled=true]{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 720px){#PaginationContainer{flex-wrap:wrap;row-gap:10px}#PaginationContainer .LeftItems,#PaginationContainer .RightItems{display:flex;flex-direction:column;gap:10px}#PaginationContainer .RightItems{flex-direction:column-reverse}#PaginationContainer .PaginationControl{margin:0}#PaginationContainer .PaginationArea{order:1;flex-basis:100%;justify-content:center;margin:0;padding:0}a,.PaginationControl{width:90px;font-size:14px}}@media screen and (max-width: 480px){a,.PaginationControl{width:70px;font-size:14px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){a,.PaginationControl{width:58px;font-size:12px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem a:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem a:hover{background:#009993;border-color:#009993;color:#fff}}';export{r as helper_pagination}
|
|
1
|
+
import{r as t,c as i,h as a}from"./index-4984476a.js";const e="__WIDGET_GLOBAL_STYLE_CACHE__";function n(t,i){if(t){const a=document.createElement("style");a.innerHTML=i,t.appendChild(a)}}function o(t,i){if(!t||!i)return;const a=new URL(i);fetch(a.href).then((t=>t.text())).then((i=>{const a=document.createElement("style");a.innerHTML=i,t&&t.appendChild(a)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const s={en:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ro:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},fr:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ar:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},hu:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},hr:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"}},r=class{constructor(a){t(this,a),this.hpPageChange=i(this,"hpPageChange",7),this.userAgent=window.navigator.userAgent,this.currentPage=1,this.navigateTo=t=>{var i;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,null===(i=this.hpPageChange)||void 0===i||i.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.paginationNavigation=(t,i)=>{var a;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,null===(a=this.hpPageChange)||void 0===a||a.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.nextPage="",this.prevPage="",this.offset=0,this.limit=1,this.total=1,this.language="en",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.arrowsActive=!0,this.secondaryArrowsActive=!1,this.numberedNavActive=!1,this.pageQueryParam=void 0,this.page=1,this.offsetInt=0,this.lastPage=!1,this.previousPage=!1,this.limitInt=0,this.totalInt=0,this.pagesArray=[],this.endInt=0}handleClientStylingChange(t,i){t!==i&&n(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!==i&&this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl)}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),this.endInt<4?this.pagesArray=Array.from({length:this.endInt+1},((t,i)=>i+1)):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("..."))}handleClientStyling(){void 0===window.emMessageBus?(this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl)):this.stylingSubscription=function(t,i,a,n=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!n)return function(t,i){const a=document.createElement("style");return window.emMessageBus.subscribe(i,(i=>{t&&(a.innerHTML=i,t.appendChild(a))}))}(t,i);window[e]||(window[e]={});const o=(a=function(t,i){return window.emMessageBus.subscribe(i,(a=>{if(!t)return;const n=t.getRootNode(),o=window[e];let s=o[i]&&o[i].sheet;s?o[i].refCount=o[i].refCount+1:(s=new CSSStyleSheet,s.replaceSync(a),o[i]={sheet:s,refCount:1});const r=n.adoptedStyleSheets||[];r.includes(s)||(n.adoptedStyleSheets=[...r,s])}))}(t,i)).unsubscribe.bind(a);return a.unsubscribe=()=>{if(window[e][i]){const t=window[e][i];t.refCount>1?t.refCount=t.refCount-1:delete window[e][i]}o()},a}(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription,!0)}componentDidLoad(){this.handleClientStyling()}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}pageHref(t){if(!this.pageQueryParam)return"#";const i=new URL(window.location.href),a=t+this.page-1;return 1===a?i.searchParams.delete(this.pageQueryParam):i.searchParams.set(this.pageQueryParam,String(a)),`${i.pathname}${i.search}${i.hash}`}renderNavigationButton(t,i,e,n){const o=s[void 0!==(r=this.language)&&r in s?r:"en"][i];var r;return a(e?"a":"span",{class:"PaginationControl","data-nav":i,href:e?this.pageHref(t):void 0,rel:e?n:void 0,"aria-label":o,"aria-disabled":e?void 0:"true",onClick:e?t=>{0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),this.navigateTo(i))}:void 0},a("span",{class:"NavigationButton"},o),a("span",{class:"NavigationIcon"}))}render(){let t=a("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>{const e="number"==typeof t?t:0===i?Math.max(1,this.currentPage-5):Math.min(this.endInt+1,this.currentPage+5);return a("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(n=this.userAgent,n.toLowerCase().match(/android/i)||n.toLowerCase().match(/blackberry|bb/i)||n.toLowerCase().match(/iphone|ipad|ipod/i)||n.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)?"MobileButtons":"")},a("a",{href:this.pageHref(e),"aria-current":t===this.currentPage?"page":void 0,"aria-disabled":t===this.currentPage?"true":void 0,tabIndex:t===this.currentPage?-1:void 0,onClick:a=>{0!==a.button||a.metaKey||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),t!==this.currentPage&&this.paginationNavigation(t,i))}},a("span",null,t)));var n})));const i=a("div",{class:"LeftItems"},this.secondaryArrowsActive&&this.renderNavigationButton(1,"firstPage",Boolean(this.prevPage)),this.renderNavigationButton(this.currentPage-1,"previousPage",Boolean(this.prevPage),"prev")),e=a("div",{class:"RightItems"},this.renderNavigationButton(this.currentPage+1,"nextPage",Boolean(this.nextPage),"next"),this.secondaryArrowsActive&&this.renderNavigationButton(this.endInt+1,"lastPage",Boolean(this.nextPage)));return a("nav",{id:"PaginationContainer",class:"PaginationContainer","aria-label":"Blog pagination",ref:t=>this.stylingContainer=t},this.arrowsActive&&i,this.numberedNavActive&&t,this.arrowsActive&&e)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};r.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:center;align-items:center;gap:4px}.LeftItems .PaginationControl,.RightItems .PaginationControl{position:relative;width:24px;height:28px;padding:0;border:0;border-radius:0;background:transparent;color:#009993;}.LeftItems .PaginationControl[aria-disabled=true],.RightItems .PaginationControl[aria-disabled=true]{background:transparent;color:#009993;opacity:0.35}.LeftItems .PaginationControl .NavigationButton,.RightItems .PaginationControl .NavigationButton{display:none}.LeftItems .PaginationControl .NavigationIcon::before,.LeftItems .PaginationControl .NavigationIcon::after,.RightItems .PaginationControl .NavigationIcon::before,.RightItems .PaginationControl .NavigationIcon::after{content:"";position:absolute;top:50%;left:50%;box-sizing:border-box;width:8px;height:8px;border:solid currentColor;border-width:2px 2px 0 0}.LeftItems .PaginationControl .NavigationIcon::after,.RightItems .PaginationControl .NavigationIcon::after{display:none}.LeftItems .PaginationControl[data-nav=nextPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=nextPage] .NavigationIcon::before{transform:translate(-70%, -50%) rotate(45deg)}.LeftItems .PaginationControl[data-nav=previousPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=previousPage] .NavigationIcon::before{transform:translate(-30%, -50%) rotate(-135deg)}.LeftItems .PaginationControl[data-nav=lastPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=lastPage] .NavigationIcon::before{transform:translate(-110%, -50%) rotate(45deg)}.LeftItems .PaginationControl[data-nav=lastPage] .NavigationIcon::after,.RightItems .PaginationControl[data-nav=lastPage] .NavigationIcon::after{display:block;transform:translate(-30%, -50%) rotate(45deg)}.LeftItems .PaginationControl[data-nav=firstPage] .NavigationIcon::before,.RightItems .PaginationControl[data-nav=firstPage] .NavigationIcon::before{transform:translate(-70%, -50%) rotate(-135deg)}.LeftItems .PaginationControl[data-nav=firstPage] .NavigationIcon::after,.RightItems .PaginationControl[data-nav=firstPage] .NavigationIcon::after{display:block;transform:translate(10%, -50%) rotate(-135deg)}.PaginationArea{display:inline-flex;gap:10px;list-style:none;margin:0;padding:0}.PaginationArea li{margin:0;padding:0}.PaginationArea li a{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 a{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem a[aria-disabled=true]{pointer-events:none;cursor:not-allowed}.PaginationItem a:hover,.PaginationItem a:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}a,.PaginationControl{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-decoration:none;width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:background-color 0.1s linear, border-color 0.1s linear, color 0.1s linear, opacity 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}a:hover,a:active{background:#004D4A;border-color:#004D4A}a[aria-disabled=true],.PaginationControl[aria-disabled=true]{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 480px){a,.PaginationControl{width:70px;font-size:14px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){a,.PaginationControl{width:58px;font-size:12px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem a:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem a:hover{background:#009993;border-color:#009993;color:#fff}}';export{r as helper_pagination}
|