@everymatrix/helper-pagination 1.94.9 → 1.94.15

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.
@@ -192,6 +192,7 @@ const HelperPagination = class {
192
192
  * Navigation logic
193
193
  */
194
194
  this.navigateTo = (navigationPage) => {
195
+ var _a;
195
196
  switch (navigationPage) {
196
197
  case 'firstPage':
197
198
  this.offsetInt = 0;
@@ -215,12 +216,13 @@ const HelperPagination = class {
215
216
  break;
216
217
  }
217
218
  this.previousPage = !this.offsetInt ? false : true;
218
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
219
+ (_a = this.hpPageChange) === null || _a === void 0 ? void 0 : _a.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
219
220
  };
220
221
  /**
221
222
  * Handle navigation from here
222
223
  */
223
224
  this.paginationNavigation = (pageNumber, index) => {
225
+ var _a;
224
226
  this.previousPage = true;
225
227
  if (!isNaN(pageNumber)) {
226
228
  if (pageNumber === 1) {
@@ -242,7 +244,7 @@ const HelperPagination = class {
242
244
  this.navigateTo('fivePagesForward');
243
245
  }
244
246
  }
245
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
247
+ (_a = this.hpPageChange) === null || _a === void 0 ? void 0 : _a.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
246
248
  };
247
249
  this.nextPage = '';
248
250
  this.prevPage = '';
@@ -253,24 +255,24 @@ const HelperPagination = class {
253
255
  this.mbSource = undefined;
254
256
  this.clientStyling = '';
255
257
  this.clientStylingUrl = '';
256
- this.arrowsActive = undefined;
257
- this.secondaryArrowsActive = undefined;
258
- this.numberedNavActive = undefined;
259
- this.offsetInt = undefined;
258
+ this.arrowsActive = true;
259
+ this.secondaryArrowsActive = false;
260
+ this.numberedNavActive = false;
261
+ this.offsetInt = 0;
260
262
  this.lastPage = false;
261
263
  this.previousPage = false;
262
- this.limitInt = undefined;
263
- this.totalInt = undefined;
264
+ this.limitInt = 0;
265
+ this.totalInt = 0;
264
266
  this.pagesArray = [];
265
267
  this.endInt = 0;
266
268
  }
267
269
  handleClientStylingChange(newValue, oldValue) {
268
- if (newValue != oldValue) {
270
+ if (newValue !== oldValue) {
269
271
  setClientStyling(this.stylingContainer, this.clientStyling);
270
272
  }
271
273
  }
272
274
  handleClientStylingChangeURL(newValue, oldValue) {
273
- if (newValue != oldValue) {
275
+ if (newValue !== oldValue) {
274
276
  if (this.clientStylingUrl)
275
277
  setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
276
278
  }
@@ -300,18 +302,18 @@ const HelperPagination = class {
300
302
  this.pagesArray.unshift('...');
301
303
  }
302
304
  }
303
- componentDidLoad() {
304
- if (this.stylingContainer) {
305
- if (window.emMessageBus != undefined) {
306
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
307
- }
308
- else {
309
- if (this.clientStyling)
310
- setClientStyling(this.stylingContainer, this.clientStyling);
311
- if (this.clientStylingUrl)
312
- setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
313
- }
305
+ handleClientStyling() {
306
+ if (window.emMessageBus !== undefined) {
307
+ this.stylingSubscription = setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription, true);
308
+ return;
314
309
  }
310
+ if (this.clientStyling)
311
+ setClientStyling(this.stylingContainer, this.clientStyling);
312
+ if (this.clientStylingUrl)
313
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
314
+ }
315
+ componentDidLoad() {
316
+ this.handleClientStyling();
315
317
  }
316
318
  disconnectedCallback() {
317
319
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
@@ -10,6 +10,7 @@ export class HelperPagination {
10
10
  * Navigation logic
11
11
  */
12
12
  this.navigateTo = (navigationPage) => {
13
+ var _a;
13
14
  switch (navigationPage) {
14
15
  case 'firstPage':
15
16
  this.offsetInt = 0;
@@ -33,12 +34,13 @@ export class HelperPagination {
33
34
  break;
34
35
  }
35
36
  this.previousPage = !this.offsetInt ? false : true;
36
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
37
+ (_a = this.hpPageChange) === null || _a === void 0 ? void 0 : _a.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
37
38
  };
38
39
  /**
39
40
  * Handle navigation from here
40
41
  */
41
42
  this.paginationNavigation = (pageNumber, index) => {
43
+ var _a;
42
44
  this.previousPage = true;
43
45
  if (!isNaN(pageNumber)) {
44
46
  if (pageNumber === 1) {
@@ -60,7 +62,7 @@ export class HelperPagination {
60
62
  this.navigateTo('fivePagesForward');
61
63
  }
62
64
  }
63
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
65
+ (_a = this.hpPageChange) === null || _a === void 0 ? void 0 : _a.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
64
66
  };
65
67
  this.nextPage = '';
66
68
  this.prevPage = '';
@@ -71,24 +73,24 @@ export class HelperPagination {
71
73
  this.mbSource = undefined;
72
74
  this.clientStyling = '';
73
75
  this.clientStylingUrl = '';
74
- this.arrowsActive = undefined;
75
- this.secondaryArrowsActive = undefined;
76
- this.numberedNavActive = undefined;
77
- this.offsetInt = undefined;
76
+ this.arrowsActive = true;
77
+ this.secondaryArrowsActive = false;
78
+ this.numberedNavActive = false;
79
+ this.offsetInt = 0;
78
80
  this.lastPage = false;
79
81
  this.previousPage = false;
80
- this.limitInt = undefined;
81
- this.totalInt = undefined;
82
+ this.limitInt = 0;
83
+ this.totalInt = 0;
82
84
  this.pagesArray = [];
83
85
  this.endInt = 0;
84
86
  }
85
87
  handleClientStylingChange(newValue, oldValue) {
86
- if (newValue != oldValue) {
88
+ if (newValue !== oldValue) {
87
89
  setClientStyling(this.stylingContainer, this.clientStyling);
88
90
  }
89
91
  }
90
92
  handleClientStylingChangeURL(newValue, oldValue) {
91
- if (newValue != oldValue) {
93
+ if (newValue !== oldValue) {
92
94
  if (this.clientStylingUrl)
93
95
  setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
94
96
  }
@@ -118,18 +120,18 @@ export class HelperPagination {
118
120
  this.pagesArray.unshift('...');
119
121
  }
120
122
  }
121
- componentDidLoad() {
122
- if (this.stylingContainer) {
123
- if (window.emMessageBus != undefined) {
124
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
125
- }
126
- else {
127
- if (this.clientStyling)
128
- setClientStyling(this.stylingContainer, this.clientStyling);
129
- if (this.clientStylingUrl)
130
- setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
131
- }
123
+ handleClientStyling() {
124
+ if (window.emMessageBus !== undefined) {
125
+ this.stylingSubscription = setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription, true);
126
+ return;
132
127
  }
128
+ if (this.clientStyling)
129
+ setClientStyling(this.stylingContainer, this.clientStyling);
130
+ if (this.clientStylingUrl)
131
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
132
+ }
133
+ componentDidLoad() {
134
+ this.handleClientStyling();
133
135
  }
134
136
  disconnectedCallback() {
135
137
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
@@ -292,7 +294,7 @@ export class HelperPagination {
292
294
  "references": {}
293
295
  },
294
296
  "required": false,
295
- "optional": false,
297
+ "optional": true,
296
298
  "docs": {
297
299
  "tags": [],
298
300
  "text": "Client custom styling via streamStyling"
@@ -309,7 +311,7 @@ export class HelperPagination {
309
311
  "references": {}
310
312
  },
311
313
  "required": false,
312
- "optional": false,
314
+ "optional": true,
313
315
  "docs": {
314
316
  "tags": [],
315
317
  "text": "Client custom styling via string"
@@ -327,7 +329,7 @@ export class HelperPagination {
327
329
  "references": {}
328
330
  },
329
331
  "required": false,
330
- "optional": false,
332
+ "optional": true,
331
333
  "docs": {
332
334
  "tags": [],
333
335
  "text": "Client custom styling via url content"
@@ -351,7 +353,8 @@ export class HelperPagination {
351
353
  "text": "Customize pagination: Activate pagination arrows"
352
354
  },
353
355
  "attribute": "arrows-active",
354
- "reflect": true
356
+ "reflect": true,
357
+ "defaultValue": "true"
355
358
  },
356
359
  "secondaryArrowsActive": {
357
360
  "type": "boolean",
@@ -368,7 +371,8 @@ export class HelperPagination {
368
371
  "text": "Customize pagination: Activate pagination secondary arrows"
369
372
  },
370
373
  "attribute": "secondary-arrows-active",
371
- "reflect": true
374
+ "reflect": true,
375
+ "defaultValue": "false"
372
376
  },
373
377
  "numberedNavActive": {
374
378
  "type": "boolean",
@@ -385,7 +389,8 @@ export class HelperPagination {
385
389
  "text": "Customize pagination: Activate pagination numbered navigation"
386
390
  },
387
391
  "attribute": "numbered-nav-active",
388
- "reflect": true
392
+ "reflect": true,
393
+ "defaultValue": "false"
389
394
  }
390
395
  };
391
396
  }
@@ -188,6 +188,7 @@ const HelperPagination = class {
188
188
  * Navigation logic
189
189
  */
190
190
  this.navigateTo = (navigationPage) => {
191
+ var _a;
191
192
  switch (navigationPage) {
192
193
  case 'firstPage':
193
194
  this.offsetInt = 0;
@@ -211,12 +212,13 @@ const HelperPagination = class {
211
212
  break;
212
213
  }
213
214
  this.previousPage = !this.offsetInt ? false : true;
214
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
215
+ (_a = this.hpPageChange) === null || _a === void 0 ? void 0 : _a.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
215
216
  };
216
217
  /**
217
218
  * Handle navigation from here
218
219
  */
219
220
  this.paginationNavigation = (pageNumber, index) => {
221
+ var _a;
220
222
  this.previousPage = true;
221
223
  if (!isNaN(pageNumber)) {
222
224
  if (pageNumber === 1) {
@@ -238,7 +240,7 @@ const HelperPagination = class {
238
240
  this.navigateTo('fivePagesForward');
239
241
  }
240
242
  }
241
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
243
+ (_a = this.hpPageChange) === null || _a === void 0 ? void 0 : _a.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
242
244
  };
243
245
  this.nextPage = '';
244
246
  this.prevPage = '';
@@ -249,24 +251,24 @@ const HelperPagination = class {
249
251
  this.mbSource = undefined;
250
252
  this.clientStyling = '';
251
253
  this.clientStylingUrl = '';
252
- this.arrowsActive = undefined;
253
- this.secondaryArrowsActive = undefined;
254
- this.numberedNavActive = undefined;
255
- this.offsetInt = undefined;
254
+ this.arrowsActive = true;
255
+ this.secondaryArrowsActive = false;
256
+ this.numberedNavActive = false;
257
+ this.offsetInt = 0;
256
258
  this.lastPage = false;
257
259
  this.previousPage = false;
258
- this.limitInt = undefined;
259
- this.totalInt = undefined;
260
+ this.limitInt = 0;
261
+ this.totalInt = 0;
260
262
  this.pagesArray = [];
261
263
  this.endInt = 0;
262
264
  }
263
265
  handleClientStylingChange(newValue, oldValue) {
264
- if (newValue != oldValue) {
266
+ if (newValue !== oldValue) {
265
267
  setClientStyling(this.stylingContainer, this.clientStyling);
266
268
  }
267
269
  }
268
270
  handleClientStylingChangeURL(newValue, oldValue) {
269
- if (newValue != oldValue) {
271
+ if (newValue !== oldValue) {
270
272
  if (this.clientStylingUrl)
271
273
  setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
272
274
  }
@@ -296,18 +298,18 @@ const HelperPagination = class {
296
298
  this.pagesArray.unshift('...');
297
299
  }
298
300
  }
299
- componentDidLoad() {
300
- if (this.stylingContainer) {
301
- if (window.emMessageBus != undefined) {
302
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
303
- }
304
- else {
305
- if (this.clientStyling)
306
- setClientStyling(this.stylingContainer, this.clientStyling);
307
- if (this.clientStylingUrl)
308
- setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
309
- }
301
+ handleClientStyling() {
302
+ if (window.emMessageBus !== undefined) {
303
+ this.stylingSubscription = setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription, true);
304
+ return;
310
305
  }
306
+ if (this.clientStyling)
307
+ setClientStyling(this.stylingContainer, this.clientStyling);
308
+ if (this.clientStylingUrl)
309
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
310
+ }
311
+ componentDidLoad() {
312
+ this.handleClientStyling();
311
313
  }
312
314
  disconnectedCallback() {
313
315
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
@@ -1 +1 @@
1
- import{r as t,c as i,h as s}from"./index-0483e183.js";const e="__WIDGET_GLOBAL_STYLE_CACHE__";function n(t,i){if(t){const s=document.createElement("style");s.innerHTML=i,t.appendChild(s)}}function a(t,i){if(!t||!i)return;const s=new URL(i);fetch(s.href).then((t=>t.text())).then((i=>{const s=document.createElement("style");s.innerHTML=i,t&&t.appendChild(s)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const o=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={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"},hu:{firstPage:"First",previousPage:"Previous",nextPage:"Következő",lastPage:"Last"},hr:{firstPage:"Prva",previousPage:"Prethodna",nextPage:"Slijedeća",lastPage:"Zadnja"}},r=(t,i)=>h[void 0!==i&&i in h?i:"en"][t],l=class{constructor(s){t(this,s),this.hpPageChange=i(this,"hpPageChange",7),this.userAgent=window.navigator.userAgent,this.currentPage=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.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=void 0,this.secondaryArrowsActive=void 0,this.numberedNavActive=void 0,this.offsetInt=void 0,this.lastPage=!1,this.previousPage=!1,this.limitInt=void 0,this.totalInt=void 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),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("..."))}componentDidLoad(){this.stylingContainer&&(null!=window.emMessageBus?function(t,i,s,n=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!n)return function(t,i){const s=document.createElement("style");return window.emMessageBus.subscribe(i,(i=>{t&&(s.innerHTML=i,t.appendChild(s))}))}(t,i);window[e]||(window[e]={});const a=(s=function(t,i){return window.emMessageBus.subscribe(i,(s=>{if(!t)return;const n=t.getRootNode(),a=window[e];let o=a[i]&&a[i].sheet;o?a[i].refCount=a[i].refCount+1:(o=new CSSStyleSheet,o.replaceSync(s),a[i]={sheet:o,refCount:1});const h=n.adoptedStyleSheets||[];h.includes(o)||(n.adoptedStyleSheets=[...h,o])}))}(t,i)).unsubscribe.bind(s);s.unsubscribe=()=>{if(window[e][i]){const t=window[e][i];t.refCount>1?t.refCount=t.refCount-1:delete window[e][i]}a()}}(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription):(this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){let t=s("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>s("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(o(this.userAgent)?"MobileButtons":"")},s("button",{disabled:t===this.currentPage,onClick:this.paginationNavigation.bind(this,t,i)},s("span",null,t)))))),i=s("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"firstPage")},s("span",{class:"NavigationButton"},r("firstPage",this.language)),s("span",{class:"NavigationIcon"})),e=s("div",{class:"LeftItems"},this.secondaryArrowsActive&&i,s("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"previousPage")},s("span",{class:"NavigationButton"},r("previousPage",this.language)),s("span",{class:"NavigationIcon"})));o(this.userAgent)&&(e=s("div",{class:"LeftItems"},s("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"previousPage")},s("span",{class:"NavigationButton"},r("previousPage",this.language)),s("span",{class:"NavigationIcon"}))));let n=s("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"lastPage")},s("span",{class:"NavigationButton"},r("lastPage",this.language)),s("span",{class:"NavigationIcon"})),a=s("div",{class:"RightItems"},s("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"nextPage")},s("span",{class:"NavigationButton"},r("nextPage",this.language)),s("span",{class:"NavigationIcon"})),this.secondaryArrowsActive&&n);return o(this.userAgent)&&(a=s("div",{class:"RightItems"},s("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"nextPage")},s("span",{class:"NavigationButton"},r("nextPage",this.language)),s("span",{class:"NavigationIcon"})))),s("div",{id:"PaginationContainer",ref:t=>this.stylingContainer=t},this.arrowsActive&&e,this.numberedNavActive&&t,this.arrowsActive&&a)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};l.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{l as helper_pagination}
1
+ import{r as t,c as i,h as s}from"./index-0483e183.js";const e="__WIDGET_GLOBAL_STYLE_CACHE__";function n(t,i){if(t){const s=document.createElement("style");s.innerHTML=i,t.appendChild(s)}}function a(t,i){if(!t||!i)return;const s=new URL(i);fetch(s.href).then((t=>t.text())).then((i=>{const s=document.createElement("style");s.innerHTML=i,t&&t.appendChild(s)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const o=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={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"},hu:{firstPage:"First",previousPage:"Previous",nextPage:"Következő",lastPage:"Last"},hr:{firstPage:"Prva",previousPage:"Prethodna",nextPage:"Slijedeća",lastPage:"Zadnja"}},r=(t,i)=>h[void 0!==i&&i in h?i:"en"][t],l=class{constructor(s){t(this,s),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 s;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===(s=this.hpPageChange)||void 0===s||s.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.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),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,s,n=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!n)return function(t,i){const s=document.createElement("style");return window.emMessageBus.subscribe(i,(i=>{t&&(s.innerHTML=i,t.appendChild(s))}))}(t,i);window[e]||(window[e]={});const a=(s=function(t,i){return window.emMessageBus.subscribe(i,(s=>{if(!t)return;const n=t.getRootNode(),a=window[e];let o=a[i]&&a[i].sheet;o?a[i].refCount=a[i].refCount+1:(o=new CSSStyleSheet,o.replaceSync(s),a[i]={sheet:o,refCount:1});const h=n.adoptedStyleSheets||[];h.includes(o)||(n.adoptedStyleSheets=[...h,o])}))}(t,i)).unsubscribe.bind(s);return s.unsubscribe=()=>{if(window[e][i]){const t=window[e][i];t.refCount>1?t.refCount=t.refCount-1:delete window[e][i]}a()},s}(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription,!0)}componentDidLoad(){this.handleClientStyling()}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){let t=s("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>s("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(o(this.userAgent)?"MobileButtons":"")},s("button",{disabled:t===this.currentPage,onClick:this.paginationNavigation.bind(this,t,i)},s("span",null,t)))))),i=s("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"firstPage")},s("span",{class:"NavigationButton"},r("firstPage",this.language)),s("span",{class:"NavigationIcon"})),e=s("div",{class:"LeftItems"},this.secondaryArrowsActive&&i,s("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"previousPage")},s("span",{class:"NavigationButton"},r("previousPage",this.language)),s("span",{class:"NavigationIcon"})));o(this.userAgent)&&(e=s("div",{class:"LeftItems"},s("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"previousPage")},s("span",{class:"NavigationButton"},r("previousPage",this.language)),s("span",{class:"NavigationIcon"}))));let n=s("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"lastPage")},s("span",{class:"NavigationButton"},r("lastPage",this.language)),s("span",{class:"NavigationIcon"})),a=s("div",{class:"RightItems"},s("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"nextPage")},s("span",{class:"NavigationButton"},r("nextPage",this.language)),s("span",{class:"NavigationIcon"})),this.secondaryArrowsActive&&n);return o(this.userAgent)&&(a=s("div",{class:"RightItems"},s("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"nextPage")},s("span",{class:"NavigationButton"},r("nextPage",this.language)),s("span",{class:"NavigationIcon"})))),s("div",{id:"PaginationContainer",ref:t=>this.stylingContainer=t},this.arrowsActive&&e,this.numberedNavActive&&t,this.arrowsActive&&a)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};l.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{l as helper_pagination}
@@ -27,15 +27,15 @@ export declare class HelperPagination {
27
27
  /**
28
28
  * Client custom styling via streamStyling
29
29
  */
30
- mbSource: string;
30
+ mbSource?: string;
31
31
  /**
32
32
  * Client custom styling via string
33
33
  */
34
- clientStyling: string;
34
+ clientStyling?: string;
35
35
  /**
36
36
  * Client custom styling via url content
37
37
  */
38
- clientStylingUrl: string;
38
+ clientStylingUrl?: string;
39
39
  /**
40
40
  * Customize pagination: Activate pagination arrows
41
41
  */
@@ -81,11 +81,11 @@ export declare class HelperPagination {
81
81
  /**
82
82
  * Event that handles the navigation, updating the offset, limit and total values
83
83
  */
84
- hpPageChange: EventEmitter<any>;
85
- private stylingContainer;
84
+ hpPageChange?: EventEmitter<any>;
85
+ private stylingContainer?;
86
86
  private stylingSubscription;
87
- handleClientStylingChange(newValue: any, oldValue: any): void;
88
- handleClientStylingChangeURL(newValue: any, oldValue: any): void;
87
+ handleClientStylingChange(newValue: string, oldValue: string): void;
88
+ handleClientStylingChangeURL(newValue: string, oldValue: string): void;
89
89
  /**
90
90
  * Navigation logic
91
91
  */
@@ -95,6 +95,7 @@ export declare class HelperPagination {
95
95
  */
96
96
  paginationNavigation: (pageNumber: number, index: any) => void;
97
97
  componentWillRender(): void;
98
+ handleClientStyling(): void;
98
99
  componentDidLoad(): void;
99
100
  disconnectedCallback(): void;
100
101
  render(): any;
@@ -14,11 +14,11 @@ export namespace Components {
14
14
  /**
15
15
  * Client custom styling via string
16
16
  */
17
- "clientStyling": string;
17
+ "clientStyling"?: string;
18
18
  /**
19
19
  * Client custom styling via url content
20
20
  */
21
- "clientStylingUrl": string;
21
+ "clientStylingUrl"?: string;
22
22
  /**
23
23
  * Language
24
24
  */
@@ -30,7 +30,7 @@ export namespace Components {
30
30
  /**
31
31
  * Client custom styling via streamStyling
32
32
  */
33
- "mbSource": string;
33
+ "mbSource"?: string;
34
34
  /**
35
35
  * Next page string value - determines if the next page is disabled or active
36
36
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/helper-pagination",
3
- "version": "1.94.9",
3
+ "version": "1.94.15",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",