@everymatrix/helper-pagination 0.1.24 → 1.0.69

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 +197 -201
  3. package/dist/cjs/helper-pagination.cjs.js +17 -11
  4. package/dist/cjs/index-015efb63.js +1169 -0
  5. package/dist/cjs/loader.cjs.js +7 -13
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/helper-pagination/helper-pagination.css +4 -7
  8. package/dist/collection/components/helper-pagination/helper-pagination.js +386 -352
  9. package/dist/collection/components/helper-pagination/index.js +1 -0
  10. package/dist/collection/utils/locale.utils.js +39 -27
  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 +197 -201
  14. package/dist/esm/helper-pagination.js +14 -11
  15. package/dist/esm/index-3d52300b.js +1142 -0
  16. package/dist/esm/loader.js +7 -13
  17. package/dist/helper-pagination/helper-pagination.esm.js +1 -1
  18. package/dist/helper-pagination/p-083e9b0c.entry.js +1 -0
  19. package/dist/helper-pagination/p-7b10b966.js +2 -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/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/helper-pagination/.stencil/packages/stencil/helper-pagination/stencil.config.d.ts +2 -0
  24. package/dist/types/Users/raul.vasile/workspace/everymatrix/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 -77
  26. package/dist/types/components/helper-pagination/index.d.ts +1 -0
  27. package/dist/types/components.d.ts +52 -13
  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 +9 -2
  36. package/dist/cjs/index-4f0b2d1c.js +0 -1172
  37. package/dist/components/helper-pagination.d.ts +0 -11
  38. package/dist/components/helper-pagination.js +0 -262
  39. package/dist/components/index.d.ts +0 -26
  40. package/dist/components/index.js +0 -1
  41. package/dist/esm/index-fe031733.js +0 -1146
  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-68c68be2.js +0 -1
  49. package/dist/helper-pagination/p-8258fc5c.entry.js +0 -1
  50. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/stencil/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,262 +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 SUPPORTED_LANGUAGES = ['ro', 'en'];
18
- const TRANSLATIONS = {
19
- en: {
20
- firstPage: 'First',
21
- previousPage: 'Previous',
22
- nextPage: 'Next',
23
- lastPage: 'Last'
24
- },
25
- ro: {
26
- firstPage: 'Prima',
27
- previousPage: 'Anterior',
28
- nextPage: 'Urmatoarea',
29
- lastPage: 'Ultima'
30
- },
31
- fr: {
32
- firstPage: 'First',
33
- previousPage: 'Previous',
34
- nextPage: 'Next',
35
- lastPage: 'Last'
36
- },
37
- ar: {
38
- firstPage: 'First',
39
- previousPage: 'Previous',
40
- nextPage: 'Next',
41
- lastPage: 'Last'
42
- }
43
- };
44
- const translate = (key, customLang) => {
45
- const lang = customLang;
46
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
47
- };
48
-
49
- const helperPaginationCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}#PaginationContainer{width:100%;margin-top:20px;display:inline-flex;justify-content:space-between;align-items:center}.LeftItems button:not(:first-child),.RightItems button:not(:last-child){margin:0 10px}.LeftItems button,.RightItems button{padding:0;background-color:#009993;border-color:#009993}.PaginationArea{display:inline-flex;gap:10px;list-style:none}.PaginationArea li{margin:0;padding:0}.PaginationArea li button{width:24px;height:24px;display:flex;border:0;padding:0;justify-content:center;align-items:center;background-color:transparent;color:#000;cursor:pointer;pointer-events:all}.PaginationItem.ActiveItem button{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem button:disabled{pointer-events:none;cursor:not-allowed}.PaginationItem button:hover,.PaginationItem button:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}button{width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:all 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}button:hover,button:active{background:#004D4A;border-color:#004D4A}button:disabled{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 720px){button{width:90px;font-size:12px}}@media screen and (max-width: 480px){button{width:70px;font-size:10px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:10px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem button:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem button:hover{background:#009993;border-color:#009993;color:#fff}}";
50
-
51
- const HelperPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
52
- constructor() {
53
- super();
54
- this.__registerHost();
55
- this.__attachShadow();
56
- this.hpPageChange = createEvent(this, "hpPageChange", 7);
57
- /**
58
- * First page boolean value - determines if the page is disabled or active
59
- */
60
- this.firstPage = false;
61
- /**
62
- * Previous page boolean value - determines if the page is disabled or active
63
- */
64
- this.previousPage = false;
65
- /**
66
- * The received offset
67
- */
68
- this.offset = 0;
69
- /**
70
- * The received limit for the number of pages
71
- */
72
- this.limit = 1;
73
- /**
74
- * The received total number of pages
75
- */
76
- this.total = 1;
77
- /**
78
- * Language
79
- */
80
- this.language = 'en';
81
- /**
82
- * Client custom styling via string
83
- */
84
- this.clientStyling = '';
85
- /**
86
- * Client custom styling via url content
87
- */
88
- this.clientStylingUrlContent = '';
89
- /**
90
- * In component working variable for the array of pages
91
- */
92
- this.pagesArray = [];
93
- /**
94
- * In component working variable for last page
95
- */
96
- this.endInt = 0;
97
- this.userAgent = window.navigator.userAgent;
98
- this.currentPage = 1;
99
- this.limitStylingAppends = false;
100
- /**
101
- * Navigation logic
102
- */
103
- this.navigateTo = (navigationPage) => {
104
- switch (navigationPage) {
105
- case 'firstPage':
106
- this.offsetInt = 0;
107
- break;
108
- case 'lastPage':
109
- this.offsetInt = this.endInt * this.limitInt;
110
- break;
111
- case 'previousPage':
112
- this.offsetInt -= 10;
113
- break;
114
- case 'nextPage':
115
- this.offsetInt += 10;
116
- break;
117
- case 'fivePagesBack':
118
- this.offsetInt -= 30;
119
- this.offsetInt = this.offsetInt < 0 ? 0 : this.offsetInt;
120
- break;
121
- case 'fivePagesForward':
122
- this.offsetInt += 30;
123
- this.offsetInt = this.offsetInt / 10 >= this.endInt ? this.endInt * 10 : this.offsetInt;
124
- break;
125
- }
126
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
127
- };
128
- /**
129
- * Handle navigation from here
130
- */
131
- this.paginationNavigation = (pageNumber, index) => {
132
- if (!isNaN(pageNumber)) {
133
- if (pageNumber === 1) {
134
- this.offsetInt = pageNumber - 1;
135
- }
136
- else {
137
- this.offsetInt = (pageNumber - 1) * 10;
138
- }
139
- }
140
- else {
141
- if (index === 0 && this.currentPage <= 4) {
142
- this.navigateTo('firstPage');
143
- }
144
- else if (index === 0 && this.currentPage > 4) {
145
- this.navigateTo('fivePagesBack');
146
- }
147
- else if (index === 4 && this.endInt - this.currentPage >= 2) {
148
- this.navigateTo('fivePagesForward');
149
- }
150
- }
151
- this.currentPage = this.offsetInt;
152
- this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
153
- };
154
- this.setClientStyling = () => {
155
- let sheet = document.createElement('style');
156
- sheet.innerHTML = this.clientStyling;
157
- this.stylingContainer.prepend(sheet);
158
- };
159
- this.setClientStylingURL = () => {
160
- let cssFile = document.createElement('style');
161
- setTimeout(() => {
162
- cssFile.innerHTML = this.clientStylingUrlContent;
163
- this.stylingContainer.prepend(cssFile);
164
- }, 1);
165
- };
166
- }
167
- componentWillRender() {
168
- this.offsetInt = this.offset;
169
- this.currentPage = this.offsetInt / this.limitInt + 1;
170
- this.limitInt = this.limit;
171
- this.totalInt = this.total;
172
- this.endInt = (Math.ceil(this.totalInt / this.limitInt) - 1);
173
- this.lastPage = (this.offsetInt >= this.endInt * this.limitInt) ? false : true;
174
- /**
175
- * Construct numbered navigation area based on current page position
176
- */
177
- if (this.currentPage === 1 || this.currentPage === 2) {
178
- this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
179
- this.pagesArray.push('...');
180
- }
181
- else if (this.currentPage >= 3 && ((this.endInt - this.currentPage) >= 2)) {
182
- this.pagesArray = Array.from({ length: 3 }, (_, i) => this.currentPage + i - 1);
183
- this.pagesArray.push('...');
184
- this.pagesArray.unshift('...');
185
- }
186
- else if ((this.endInt - this.currentPage) < 3) {
187
- this.pagesArray = Array.from({ length: 4 }, (_, i) => this.endInt - 2 + i);
188
- this.pagesArray.unshift('...');
189
- }
190
- }
191
- componentDidRender() {
192
- // start custom styling area
193
- if (!this.limitStylingAppends && this.stylingContainer) {
194
- if (this.clientStyling)
195
- this.setClientStyling();
196
- if (this.clientStylingUrlContent)
197
- this.setClientStylingURL();
198
- this.limitStylingAppends = true;
199
- }
200
- // end custom styling area
201
- }
202
- render() {
203
- /**
204
- * Center navigation area
205
- */
206
- let navigationArea = h("ul", { class: "PaginationArea" }, this.pagesArray.map((item, index) => {
207
- 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))));
208
- }));
209
- /**
210
- * Left navigation area
211
- */
212
- let buttonsLeftSide = h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage, onClick: this.navigateTo.bind(this, 'firstPage') }, translate('firstPage', this.language)), h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, translate('previousPage', this.language)));
213
- if (isMobile(this.userAgent)) {
214
- buttonsLeftSide =
215
- h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, translate('previousPage', this.language)));
216
- }
217
- /**
218
- * Right navigation area
219
- */
220
- let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, translate('nextPage', this.language)), h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'lastPage') }, translate('lastPage', this.language)));
221
- if (isMobile(this.userAgent)) {
222
- buttonsRightSide =
223
- h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, translate('nextPage', this.language)));
224
- }
225
- return (h("div", { id: "PaginationContainer" }, buttonsLeftSide, navigationArea, buttonsRightSide));
226
- }
227
- static get style() { return helperPaginationCss; }
228
- }, [1, "helper-pagination", {
229
- "firstPage": [1540, "first-page"],
230
- "previousPage": [1540, "previous-page"],
231
- "offset": [1538],
232
- "limit": [1538],
233
- "total": [1538],
234
- "language": [1],
235
- "clientStyling": [1, "client-styling"],
236
- "clientStylingUrlContent": [1, "client-styling-url-content"],
237
- "offsetInt": [32],
238
- "lastPage": [32],
239
- "limitInt": [32],
240
- "totalInt": [32],
241
- "pagesArray": [32],
242
- "endInt": [32],
243
- "limitStylingAppends": [32]
244
- }]);
245
- function defineCustomElement$1() {
246
- if (typeof customElements === "undefined") {
247
- return;
248
- }
249
- const components = ["helper-pagination"];
250
- components.forEach(tagName => { switch (tagName) {
251
- case "helper-pagination":
252
- if (!customElements.get(tagName)) {
253
- customElements.define(tagName, HelperPagination$1);
254
- }
255
- break;
256
- } });
257
- }
258
-
259
- const HelperPagination = HelperPagination$1;
260
- const defineCustomElement = defineCustomElement$1;
261
-
262
- 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';