@everymatrix/helper-pagination 1.55.0 → 1.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/cjs/helper-pagination.cjs.entry.js +135 -41
  2. package/dist/cjs/helper-pagination.cjs.js +3 -3
  3. package/dist/cjs/{index-502d881b.js → index-5d7ac0d5.js} +203 -71
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/components/helper-pagination/helper-pagination.js +127 -44
  7. package/dist/esm/helper-pagination.entry.js +135 -41
  8. package/dist/esm/helper-pagination.js +4 -4
  9. package/dist/esm/{index-79ce7f1f.js → index-49bd7818.js} +203 -71
  10. package/dist/esm/loader.js +3 -3
  11. package/dist/helper-pagination/helper-pagination.esm.js +1 -1
  12. package/dist/helper-pagination/p-645aa72c.entry.js +1 -0
  13. package/dist/helper-pagination/p-d28f6456.js +2 -0
  14. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/helper-pagination/.stencil/packages/stencil/helper-pagination/stencil.config.d.ts +2 -0
  15. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/helper-pagination/.stencil/packages/stencil/helper-pagination/stencil.config.dev.d.ts +2 -0
  16. package/dist/types/components/helper-pagination/helper-pagination.d.ts +10 -5
  17. package/dist/types/components.d.ts +10 -2
  18. package/package.json +1 -1
  19. package/dist/helper-pagination/p-a3272d7a.entry.js +0 -1
  20. package/dist/helper-pagination/p-ddd49f2d.js +0 -2
  21. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/helper-pagination/.stencil/packages/stencil/helper-pagination/stencil.config.d.ts +0 -2
  22. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/helper-pagination/.stencil/packages/stencil/helper-pagination/stencil.config.dev.d.ts +0 -2
  23. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/helper-pagination/.stencil/tools/plugins/index.d.ts +0 -0
  24. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/helper-pagination/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  25. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/helper-pagination/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  26. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/helper-pagination/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
@@ -2,7 +2,64 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-502d881b.js');
5
+ const index = require('./index-5d7ac0d5.js');
6
+
7
+ /**
8
+ * @name setClientStyling
9
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
10
+ * @param {HTMLElement} stylingContainer The reference element of the widget
11
+ * @param {string} clientStyling The style content
12
+ */
13
+ function setClientStyling(stylingContainer, clientStyling) {
14
+ if (stylingContainer) {
15
+ const sheet = document.createElement('style');
16
+ sheet.innerHTML = clientStyling;
17
+ stylingContainer.appendChild(sheet);
18
+ }
19
+ }
20
+
21
+ /**
22
+ * @name setClientStylingURL
23
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
24
+ * @param {HTMLElement} stylingContainer The reference element of the widget
25
+ * @param {string} clientStylingUrl The URL of the style content
26
+ */
27
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
28
+ const url = new URL(clientStylingUrl);
29
+
30
+ fetch(url.href)
31
+ .then((res) => res.text())
32
+ .then((data) => {
33
+ const cssFile = document.createElement('style');
34
+ cssFile.innerHTML = data;
35
+ if (stylingContainer) {
36
+ stylingContainer.appendChild(cssFile);
37
+ }
38
+ })
39
+ .catch((err) => {
40
+ console.error('There was an error while trying to load client styling from URL', err);
41
+ });
42
+ }
43
+
44
+ /**
45
+ * @name setStreamLibrary
46
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
47
+ * @param {HTMLElement} stylingContainer The highest element of the widget
48
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
49
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
50
+ */
51
+ function setStreamStyling(stylingContainer, domain, subscription) {
52
+ if (window.emMessageBus) {
53
+ const sheet = document.createElement('style');
54
+
55
+ window.emMessageBus.subscribe(domain, (data) => {
56
+ sheet.innerHTML = data;
57
+ if (stylingContainer) {
58
+ stylingContainer.appendChild(sheet);
59
+ }
60
+ });
61
+ }
62
+ }
6
63
 
7
64
  /**
8
65
  * @name isMobile
@@ -68,6 +125,54 @@ const HelperPagination = class {
68
125
  constructor(hostRef) {
69
126
  index.registerInstance(this, hostRef);
70
127
  this.hpPageChange = index.createEvent(this, "hpPageChange", 7);
128
+ /**
129
+ * Next page string value - determines if the next page is disabled or active
130
+ */
131
+ this.nextPage = '';
132
+ /**
133
+ * Previous page string value - determines if the previous page is disabled or active
134
+ */
135
+ this.prevPage = '';
136
+ /**
137
+ * The received offset
138
+ */
139
+ this.offset = 0;
140
+ /**
141
+ * The received limit for the number of pages
142
+ */
143
+ this.limit = 1;
144
+ /**
145
+ * The received total number of pages
146
+ */
147
+ this.total = 1;
148
+ /**
149
+ * Language
150
+ */
151
+ this.language = 'en';
152
+ /**
153
+ * Client custom styling via string
154
+ */
155
+ this.clientStyling = '';
156
+ /**
157
+ * Client custom styling via url content
158
+ */
159
+ this.clientStylingUrl = '';
160
+ /**
161
+ * Component working variable for last page
162
+ */
163
+ this.lastPage = false;
164
+ /**
165
+ * Component working variable for prvious page
166
+ */
167
+ this.previousPage = false;
168
+ /**
169
+ * In component working variable for the array of pages
170
+ */
171
+ this.pagesArray = [];
172
+ /**
173
+ * In component working variable for last page
174
+ */
175
+ this.endInt = 0;
71
176
  this.userAgent = window.navigator.userAgent;
72
177
  this.currentPage = 1;
73
178
  /**
@@ -126,37 +231,17 @@ const HelperPagination = class {
126
231
  }
127
232
  this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
128
233
  };
129
- this.setClientStyling = () => {
130
- let sheet = document.createElement('style');
131
- sheet.innerHTML = this.clientStyling;
132
- this.stylingContainer.prepend(sheet);
133
- };
134
- this.setClientStylingURL = () => {
135
- let cssFile = document.createElement('style');
136
- setTimeout(() => {
137
- cssFile.innerHTML = this.clientStylingUrlContent;
138
- this.stylingContainer.prepend(cssFile);
139
- }, 1);
140
- };
141
- this.nextPage = '';
142
- this.prevPage = '';
143
- this.offset = 0;
144
- this.limit = 1;
145
- this.total = 1;
146
- this.language = 'en';
147
- this.clientStyling = '';
148
- this.clientStylingUrlContent = '';
149
- this.arrowsActive = undefined;
150
- this.secondaryArrowsActive = undefined;
151
- this.numberedNavActive = undefined;
152
- this.offsetInt = undefined;
153
- this.lastPage = false;
154
- this.previousPage = false;
155
- this.limitInt = undefined;
156
- this.totalInt = undefined;
157
- this.pagesArray = [];
158
- this.endInt = 0;
159
- this.limitStylingAppends = false;
234
+ }
235
+ handleClientStylingChange(newValue, oldValue) {
236
+ if (newValue != oldValue) {
237
+ setClientStyling(this.stylingContainer, this.clientStyling);
238
+ }
239
+ }
240
+ handleClientStylingChangeURL(newValue, oldValue) {
241
+ if (newValue != oldValue) {
242
+ if (this.clientStylingUrl)
243
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
244
+ }
160
245
  }
161
246
  componentWillRender() {
162
247
  this.offsetInt = this.offset;
@@ -183,16 +268,21 @@ const HelperPagination = class {
183
268
  this.pagesArray.unshift('...');
184
269
  }
185
270
  }
186
- componentDidRender() {
187
- // start custom styling area
188
- if (!this.limitStylingAppends && this.stylingContainer) {
189
- if (this.clientStyling)
190
- this.setClientStyling();
191
- if (this.clientStylingUrlContent)
192
- this.setClientStylingURL();
193
- this.limitStylingAppends = true;
271
+ componentDidLoad() {
272
+ if (this.stylingContainer) {
273
+ if (window.emMessageBus != undefined) {
274
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
275
+ }
276
+ else {
277
+ if (this.clientStyling)
278
+ setClientStyling(this.stylingContainer, this.clientStyling);
279
+ if (this.clientStylingUrl)
280
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
281
+ }
194
282
  }
195
- // end custom styling area
283
+ }
284
+ disconnectedCallback() {
285
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
196
286
  }
197
287
  render() {
198
288
  /**
@@ -221,6 +311,10 @@ const HelperPagination = class {
221
311
  }
222
312
  return (index.h("div", { id: "PaginationContainer", ref: el => this.stylingContainer = el }, this.arrowsActive && buttonsLeftSide, this.numberedNavActive && navigationArea, this.arrowsActive && buttonsRightSide));
223
313
  }
314
+ static get watchers() { return {
315
+ "clientStyling": ["handleClientStylingChange"],
316
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
317
+ }; }
224
318
  };
225
319
  HelperPagination.style = HelperPaginationStyle0;
226
320
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-502d881b.js');
5
+ const index = require('./index-5d7ac0d5.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
9
- Stencil Client Patch Browser v4.22.3 | MIT Licensed | https://stenciljs.com
9
+ Stencil Client Patch Browser v4.26.0 | MIT Licensed | https://stenciljs.com
10
10
  */
11
11
  var patchBrowser = () => {
12
12
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('helper-pagination.cjs.js', document.baseURI).href));
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["helper-pagination.cjs",[[1,"helper-pagination",{"nextPage":[1537,"next-page"],"prevPage":[1537,"prev-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[1537],"clientStyling":[1537,"client-styling"],"clientStylingUrlContent":[1537,"client-styling-url-content"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"numberedNavActive":[1540,"numbered-nav-active"],"offsetInt":[32],"lastPage":[32],"previousPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32],"limitStylingAppends":[32]}]]]], options);
22
+ return index.bootstrapLazy([["helper-pagination.cjs",[[1,"helper-pagination",{"nextPage":[1537,"next-page"],"prevPage":[1537,"prev-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[1537],"mbSource":[1,"mb-source"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[1537,"client-styling-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"numberedNavActive":[1540,"numbered-nav-active"],"offsetInt":[32],"lastPage":[32],"previousPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;