@everymatrix/helper-pagination 1.44.0 → 1.45.2

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 (50) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/helper-pagination.cjs.entry.js +195 -224
  3. package/dist/cjs/helper-pagination.cjs.js +16 -10
  4. package/dist/cjs/index-015efb63.js +1169 -0
  5. package/dist/cjs/loader.cjs.js +6 -12
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/helper-pagination/helper-pagination.css +0 -3
  8. package/dist/collection/components/helper-pagination/helper-pagination.js +386 -429
  9. package/dist/collection/components/helper-pagination/index.js +1 -0
  10. package/dist/collection/utils/locale.utils.js +38 -38
  11. package/dist/collection/utils/utils.js +5 -5
  12. package/dist/esm/app-globals-0f993ce5.js +3 -0
  13. package/dist/esm/helper-pagination.entry.js +195 -224
  14. package/dist/esm/helper-pagination.js +13 -10
  15. package/dist/esm/index-3d52300b.js +1142 -0
  16. package/dist/esm/loader.js +6 -12
  17. package/dist/helper-pagination/helper-pagination.esm.js +1 -1
  18. package/dist/helper-pagination/p-7b10b966.js +2 -0
  19. package/dist/helper-pagination/p-d1a681d7.entry.js +1 -0
  20. package/dist/helper-pagination/p-e1255160.js +1 -0
  21. package/dist/stencil.config.dev.js +17 -0
  22. package/dist/stencil.config.js +14 -19
  23. 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
  24. 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
  25. package/dist/types/components/helper-pagination/helper-pagination.d.ts +93 -93
  26. package/dist/types/components/helper-pagination/index.d.ts +1 -0
  27. package/dist/types/components.d.ts +16 -1
  28. package/dist/types/stencil-public-runtime.d.ts +142 -33
  29. package/loader/cdn.js +1 -3
  30. package/loader/index.cjs.js +1 -3
  31. package/loader/index.d.ts +13 -1
  32. package/loader/index.es2017.js +1 -3
  33. package/loader/index.js +1 -3
  34. package/loader/package.json +1 -0
  35. package/package.json +8 -1
  36. package/dist/cjs/index-7c071a78.js +0 -1185
  37. package/dist/components/helper-pagination.d.ts +0 -11
  38. package/dist/components/helper-pagination.js +0 -290
  39. package/dist/components/index.d.ts +0 -26
  40. package/dist/components/index.js +0 -1
  41. package/dist/esm/index-b281577e.js +0 -1159
  42. package/dist/esm/polyfills/core-js.js +0 -11
  43. package/dist/esm/polyfills/css-shim.js +0 -1
  44. package/dist/esm/polyfills/dom.js +0 -79
  45. package/dist/esm/polyfills/es5-html-element.js +0 -1
  46. package/dist/esm/polyfills/index.js +0 -34
  47. package/dist/esm/polyfills/system.js +0 -6
  48. package/dist/helper-pagination/p-5fa7b152.entry.js +0 -1
  49. package/dist/helper-pagination/p-eab215a1.js +0 -1
  50. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/helper-pagination/.stencil/packages/helper-pagination/stencil.config.d.ts +0 -2
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface HelperPagination extends Components.HelperPagination, HTMLElement {}
4
- export const HelperPagination: {
5
- prototype: HelperPagination;
6
- new (): HelperPagination;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,290 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
-
3
- /**
4
- * @name isMobile
5
- * @description A method that returns if the browser used to access the app is from a mobile device or not
6
- * @param {String} userAgent window.navigator.userAgent
7
- * @returns {Boolean} true or false
8
- */
9
- const isMobile = (userAgent) => {
10
- return !!(userAgent.toLowerCase().match(/android/i) ||
11
- userAgent.toLowerCase().match(/blackberry|bb/i) ||
12
- userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
13
- userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
14
- };
15
-
16
- const DEFAULT_LANGUAGE = 'en';
17
- const TRANSLATIONS = {
18
- en: {
19
- firstPage: 'First',
20
- previousPage: 'Previous',
21
- nextPage: 'Next',
22
- lastPage: 'Last'
23
- },
24
- ro: {
25
- firstPage: 'Prima',
26
- previousPage: 'Anterior',
27
- nextPage: 'Urmatoarea',
28
- lastPage: 'Ultima'
29
- },
30
- fr: {
31
- firstPage: 'First',
32
- previousPage: 'Previous',
33
- nextPage: 'Next',
34
- lastPage: 'Last'
35
- },
36
- ar: {
37
- firstPage: 'First',
38
- previousPage: 'Previous',
39
- nextPage: 'Next',
40
- lastPage: 'Last'
41
- },
42
- hu: {
43
- firstPage: 'First',
44
- previousPage: 'Previous',
45
- nextPage: 'Következő',
46
- lastPage: 'Last'
47
- },
48
- hr: {
49
- firstPage: 'Prva',
50
- previousPage: 'Prethodna',
51
- nextPage: 'Slijedeća',
52
- lastPage: 'Zadnja'
53
- }
54
- };
55
- const translate = (key, customLang) => {
56
- const lang = customLang;
57
- return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
58
- };
59
-
60
- 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: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}}";
61
-
62
- const HelperPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
63
- constructor() {
64
- super();
65
- this.__registerHost();
66
- this.__attachShadow();
67
- this.hpPageChange = createEvent(this, "hpPageChange", 7);
68
- /**
69
- * Next page string value - determines if the next page is disabled or active
70
- */
71
- this.nextPage = '';
72
- /**
73
- * Previous page string value - determines if the previous page is disabled or active
74
- */
75
- this.prevPage = '';
76
- /**
77
- * The received offset
78
- */
79
- this.offset = 0;
80
- /**
81
- * The received limit for the number of pages
82
- */
83
- this.limit = 1;
84
- /**
85
- * The received total number of pages
86
- */
87
- this.total = 1;
88
- /**
89
- * Language
90
- */
91
- this.language = 'en';
92
- /**
93
- * Client custom styling via string
94
- */
95
- this.clientStyling = '';
96
- /**
97
- * Client custom styling via url content
98
- */
99
- this.clientStylingUrlContent = '';
100
- /**
101
- * Component working variable for last page
102
- */
103
- this.lastPage = false;
104
- /**
105
- * Component working variable for prvious page
106
- */
107
- this.previousPage = false;
108
- /**
109
- * In component working variable for the array of pages
110
- */
111
- this.pagesArray = [];
112
- /**
113
- * In component working variable for last page
114
- */
115
- this.endInt = 0;
116
- this.userAgent = window.navigator.userAgent;
117
- this.currentPage = 1;
118
- this.limitStylingAppends = false;
119
- /**
120
- * Navigation logic
121
- */
122
- this.navigateTo = (navigationPage) => {
123
- switch (navigationPage) {
124
- case 'firstPage':
125
- this.offsetInt = 0;
126
- break;
127
- case 'lastPage':
128
- this.offsetInt = this.endInt * this.limitInt;
129
- break;
130
- case 'previousPage':
131
- this.offsetInt -= this.limitInt;
132
- break;
133
- case 'nextPage':
134
- this.offsetInt += this.limitInt;
135
- break;
136
- case 'fivePagesBack':
137
- this.offsetInt -= this.limitInt * 5;
138
- this.offsetInt = this.offsetInt <= 0 ? 0 : this.offsetInt;
139
- break;
140
- case 'fivePagesForward':
141
- this.offsetInt += this.limitInt * 5;
142
- this.offsetInt = this.offsetInt / this.limitInt >= this.endInt ? this.endInt * this.limitInt : this.offsetInt;
143
- break;
144
- }
145
- this.previousPage = !this.offsetInt ? false : true;
146
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
147
- };
148
- /**
149
- * Handle navigation from here
150
- */
151
- this.paginationNavigation = (pageNumber, index) => {
152
- this.previousPage = true;
153
- if (!isNaN(pageNumber)) {
154
- if (pageNumber === 1) {
155
- this.offsetInt = pageNumber - 1;
156
- this.previousPage = false;
157
- }
158
- else {
159
- this.offsetInt = (pageNumber - 1) * this.limitInt;
160
- }
161
- }
162
- else {
163
- if (index === 0 && this.currentPage <= 4) {
164
- this.navigateTo('firstPage');
165
- }
166
- else if (index === 0 && this.currentPage > 4) {
167
- this.navigateTo('fivePagesBack');
168
- }
169
- else if (index === 4 && this.endInt - this.currentPage >= 2) {
170
- this.navigateTo('fivePagesForward');
171
- }
172
- }
173
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
174
- };
175
- this.setClientStyling = () => {
176
- let sheet = document.createElement('style');
177
- sheet.innerHTML = this.clientStyling;
178
- this.stylingContainer.prepend(sheet);
179
- };
180
- this.setClientStylingURL = () => {
181
- let cssFile = document.createElement('style');
182
- setTimeout(() => {
183
- cssFile.innerHTML = this.clientStylingUrlContent;
184
- this.stylingContainer.prepend(cssFile);
185
- }, 1);
186
- };
187
- }
188
- componentWillRender() {
189
- this.offsetInt = this.offset;
190
- this.limitInt = this.limit;
191
- this.currentPage = (this.offsetInt / this.limitInt) + 1;
192
- this.limitInt = this.limit;
193
- this.totalInt = this.total;
194
- this.endInt = (Math.ceil(this.totalInt / this.limitInt) - 1);
195
- this.lastPage = (this.offsetInt >= this.endInt * this.limitInt) ? false : true;
196
- /**
197
- * Construct numbered navigation area based on current page position
198
- */
199
- if (this.currentPage == 1 || this.currentPage == 2) {
200
- this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
201
- this.pagesArray.push('...');
202
- }
203
- else if (this.currentPage >= 3 && ((this.endInt - this.currentPage) >= 2)) {
204
- this.pagesArray = Array.from({ length: 3 }, (_, i) => this.currentPage + i - 1);
205
- this.pagesArray.push('...');
206
- this.pagesArray.unshift('...');
207
- }
208
- else if ((this.endInt - this.currentPage) < 3) {
209
- this.pagesArray = Array.from({ length: 4 }, (_, i) => this.endInt - 2 + i);
210
- this.pagesArray.unshift('...');
211
- }
212
- }
213
- componentDidRender() {
214
- // start custom styling area
215
- if (!this.limitStylingAppends && this.stylingContainer) {
216
- if (this.clientStyling)
217
- this.setClientStyling();
218
- if (this.clientStylingUrlContent)
219
- this.setClientStylingURL();
220
- this.limitStylingAppends = true;
221
- }
222
- // end custom styling area
223
- }
224
- render() {
225
- /**
226
- * Center navigation area
227
- */
228
- let navigationArea = h("ul", { class: "PaginationArea" }, this.pagesArray.map((item, index) => {
229
- return (h("li", { class: 'PaginationItem' + (item === this.currentPage ? ' ActiveItem' : ' ') + ' ' + (isMobile(this.userAgent) ? 'MobileButtons' : '') }, h("button", { disabled: item === this.currentPage ? true : false, onClick: this.paginationNavigation.bind(this, item, index) }, h("span", null, item))));
230
- }));
231
- /**
232
- * Left navigation area
233
- */
234
- let buttonSecondaryLeftSide = h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'firstPage') }, h("span", { class: "NavigationButton" }, translate('firstPage', this.language)), h("span", { class: "NavigationIcon" }));
235
- let buttonsLeftSide = h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'previousPage') }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
236
- if (isMobile(this.userAgent)) {
237
- buttonsLeftSide =
238
- h("div", { class: "LeftItems" }, h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'previousPage') }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
239
- }
240
- /**
241
- * Right navigation area
242
- */
243
- let buttonSecondaryRightSide = h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'lastPage') }, h("span", { class: "NavigationButton" }, translate('lastPage', this.language)), h("span", { class: "NavigationIcon" }));
244
- let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'nextPage') }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
245
- if (isMobile(this.userAgent)) {
246
- buttonsRightSide =
247
- h("div", { class: "RightItems" }, h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'nextPage') }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })));
248
- }
249
- return (h("div", { id: "PaginationContainer", ref: el => this.stylingContainer = el }, this.arrowsActive && buttonsLeftSide, this.numberedNavActive && navigationArea, this.arrowsActive && buttonsRightSide));
250
- }
251
- static get style() { return helperPaginationCss; }
252
- }, [1, "helper-pagination", {
253
- "nextPage": [1537, "next-page"],
254
- "prevPage": [1537, "prev-page"],
255
- "offset": [1538],
256
- "limit": [1538],
257
- "total": [1538],
258
- "language": [1537],
259
- "clientStyling": [1537, "client-styling"],
260
- "clientStylingUrlContent": [1537, "client-styling-url-content"],
261
- "arrowsActive": [1540, "arrows-active"],
262
- "secondaryArrowsActive": [1540, "secondary-arrows-active"],
263
- "numberedNavActive": [1540, "numbered-nav-active"],
264
- "offsetInt": [32],
265
- "lastPage": [32],
266
- "previousPage": [32],
267
- "limitInt": [32],
268
- "totalInt": [32],
269
- "pagesArray": [32],
270
- "endInt": [32],
271
- "limitStylingAppends": [32]
272
- }]);
273
- function defineCustomElement$1() {
274
- if (typeof customElements === "undefined") {
275
- return;
276
- }
277
- const components = ["helper-pagination"];
278
- components.forEach(tagName => { switch (tagName) {
279
- case "helper-pagination":
280
- if (!customElements.get(tagName)) {
281
- customElements.define(tagName, HelperPagination$1);
282
- }
283
- break;
284
- } });
285
- }
286
-
287
- const HelperPagination = HelperPagination$1;
288
- const defineCustomElement = defineCustomElement$1;
289
-
290
- export { HelperPagination, defineCustomElement };
@@ -1,26 +0,0 @@
1
- /* HelperPagination custom elements */
2
-
3
- import type { Components, JSX } from "../types/components";
4
-
5
- /**
6
- * Used to manually set the base path where assets can be found.
7
- * If the script is used as "module", it's recommended to use "import.meta.url",
8
- * such as "setAssetPath(import.meta.url)". Other options include
9
- * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
10
- * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
11
- * But do note that this configuration depends on how your script is bundled, or lack of
12
- * bundling, and where your assets can be loaded from. Additionally custom bundling
13
- * will have to ensure the static assets are copied to its build directory.
14
- */
15
- export declare const setAssetPath: (path: string) => void;
16
-
17
- export interface SetPlatformOptions {
18
- raf?: (c: FrameRequestCallback) => number;
19
- ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
20
- rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
21
- }
22
- export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
23
-
24
- export type { Components, JSX };
25
-
26
- export * from '../types';
@@ -1 +0,0 @@
1
- export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';