@everymatrix/bonus-pagination-limits 1.32.4 → 1.33.1
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/bonus-pagination-limits/bonus-pagination-limits.esm.js +1 -0
- package/dist/bonus-pagination-limits/index.esm.js +0 -0
- package/dist/bonus-pagination-limits/p-3dce25c5.js +1 -0
- package/dist/bonus-pagination-limits/p-d1bfd361.entry.js +1 -0
- package/dist/cjs/bonus-pagination-limits.cjs.entry.js +88 -0
- package/dist/cjs/bonus-pagination-limits.cjs.js +19 -0
- package/dist/cjs/index-b47e4aa8.js +1127 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/bonus-pagination-limits/bonus-pagination-limits.css +42 -0
- package/dist/collection/components/bonus-pagination-limits/bonus-pagination-limits.js +160 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +38 -0
- package/dist/components/bonus-pagination-limits.d.ts +11 -0
- package/dist/components/bonus-pagination-limits.js +107 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/bonus-pagination-limits.entry.js +84 -0
- package/dist/esm/bonus-pagination-limits.js +17 -0
- package/dist/esm/index-689c38fd.js +1101 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/bonus-pagination-limits/.stencil/packages/bonus-pagination-limits/stencil.config.d.ts +2 -0
- package/dist/types/components/bonus-pagination-limits/bonus-pagination-limits.d.ts +25 -0
- package/dist/types/components.d.ts +70 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +14 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +2 -3
- package/LICENSE +0 -21
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-b47e4aa8.js');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
const patchEsm = () => {
|
|
11
|
+
return index.promiseResolve();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const defineCustomElements = (win, options) => {
|
|
15
|
+
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
|
+
return patchEsm().then(() => {
|
|
17
|
+
return index.bootstrapLazy([["bonus-pagination-limits.cjs",[[0,"bonus-pagination-limits",{"language":[513],"translationUrl":[513,"translation-url"],"pageLimitOptions":[513,"page-limit-options"],"limit":[1538],"pageLimits":[32]}]]]], options);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.NoOfItemsToDisplayMessage {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
margin: 0.1rem;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
text-overflow: ellipsis;
|
|
11
|
+
color: var(--emfe-w-color-primary, #191a19);
|
|
12
|
+
line-height: 1.8;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.PaginationWrapper {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ul.PaginationArea {
|
|
21
|
+
margin-block: 5px;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
padding: 0px;
|
|
25
|
+
}
|
|
26
|
+
ul.PaginationArea li.Item.Active:hover {
|
|
27
|
+
color: var(--emfe-w-color-primary, #eaefea);
|
|
28
|
+
background-color: var(--emfe-w-color-secondary, #191a19);
|
|
29
|
+
}
|
|
30
|
+
ul.PaginationArea li.Item.Active, ul.PaginationArea li.Item:hover {
|
|
31
|
+
background-color: var(--emfe-w-color-primary, rgba(169, 171, 169, 0.7));
|
|
32
|
+
font-weight: bold;
|
|
33
|
+
border-radius: 0.3rem;
|
|
34
|
+
}
|
|
35
|
+
ul.PaginationArea li.Item {
|
|
36
|
+
padding-inline-start: 0px;
|
|
37
|
+
list-style: none;
|
|
38
|
+
padding: 5px 6px;
|
|
39
|
+
margin: 2px;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
display: inline-block;
|
|
42
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { Component, h, Prop, Event, State } from '@stencil/core';
|
|
2
|
+
import { translate, TRANSLATIONS } from "../../utils/locale.utils";
|
|
3
|
+
export class BonusPaginationLimits {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Language of the widget
|
|
7
|
+
*/
|
|
8
|
+
this.language = 'en';
|
|
9
|
+
/**
|
|
10
|
+
* Translation via url
|
|
11
|
+
*/
|
|
12
|
+
this.translationUrl = '';
|
|
13
|
+
/**
|
|
14
|
+
* Default limit for per page, default: 10
|
|
15
|
+
*/
|
|
16
|
+
this.limit = 10;
|
|
17
|
+
this.pageLimits = [10, 25, 50];
|
|
18
|
+
}
|
|
19
|
+
onPageLimitClicked(pageLimit) {
|
|
20
|
+
this.limit = pageLimit;
|
|
21
|
+
this.pageLimitChanged.emit({ limit: this.limit });
|
|
22
|
+
}
|
|
23
|
+
componentWillLoad() {
|
|
24
|
+
if (!this.pageLimitOptions) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
this.pageLimits = this.pageLimitOptions.split(',').map((item) => {
|
|
29
|
+
return parseInt(item);
|
|
30
|
+
});
|
|
31
|
+
// if there is an array of custom limits provided (string to array - e.g. [5, 10, 15])
|
|
32
|
+
// and the value for the custom set limit (e.g. 8) isn't part of the provided array,
|
|
33
|
+
// then ignore the set the custom set limit and make the limit equal to the first value of the array
|
|
34
|
+
// (as part of the example so far, this would be 5)
|
|
35
|
+
if (!this.pageLimits.includes(this.limit)) {
|
|
36
|
+
this.limit = this.pageLimits[0];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.error('Error when parse PageLimitOptions', e);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
renderStylingWrapper() {
|
|
44
|
+
return h("general-styling-wrapper", { targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl });
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
return h("div", { class: 'PaginationWrapper' },
|
|
48
|
+
h("span", { class: 'NoOfItemsToDisplayMessage' }, translate('pageLimitLabel', this.language)),
|
|
49
|
+
h("ul", { class: 'PaginationArea' }, this.pageLimits.map((pageLimit) => {
|
|
50
|
+
return (h("li", { class: `${this.limit == pageLimit ? 'Active' : ''} PageSize Item`, onClick: () => {
|
|
51
|
+
this.onPageLimitClicked(pageLimit);
|
|
52
|
+
} }, pageLimit));
|
|
53
|
+
})),
|
|
54
|
+
h("general-styling-wrapper", { targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl }),
|
|
55
|
+
this.renderStylingWrapper());
|
|
56
|
+
}
|
|
57
|
+
static get is() { return "bonus-pagination-limits"; }
|
|
58
|
+
static get originalStyleUrls() { return {
|
|
59
|
+
"$": ["bonus-pagination-limits.scss"]
|
|
60
|
+
}; }
|
|
61
|
+
static get styleUrls() { return {
|
|
62
|
+
"$": ["bonus-pagination-limits.css"]
|
|
63
|
+
}; }
|
|
64
|
+
static get properties() { return {
|
|
65
|
+
"language": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"mutable": false,
|
|
68
|
+
"complexType": {
|
|
69
|
+
"original": "string",
|
|
70
|
+
"resolved": "string",
|
|
71
|
+
"references": {}
|
|
72
|
+
},
|
|
73
|
+
"required": false,
|
|
74
|
+
"optional": false,
|
|
75
|
+
"docs": {
|
|
76
|
+
"tags": [],
|
|
77
|
+
"text": "Language of the widget"
|
|
78
|
+
},
|
|
79
|
+
"attribute": "language",
|
|
80
|
+
"reflect": true,
|
|
81
|
+
"defaultValue": "'en'"
|
|
82
|
+
},
|
|
83
|
+
"translationUrl": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"mutable": false,
|
|
86
|
+
"complexType": {
|
|
87
|
+
"original": "string",
|
|
88
|
+
"resolved": "string",
|
|
89
|
+
"references": {}
|
|
90
|
+
},
|
|
91
|
+
"required": false,
|
|
92
|
+
"optional": false,
|
|
93
|
+
"docs": {
|
|
94
|
+
"tags": [],
|
|
95
|
+
"text": "Translation via url"
|
|
96
|
+
},
|
|
97
|
+
"attribute": "translation-url",
|
|
98
|
+
"reflect": true,
|
|
99
|
+
"defaultValue": "''"
|
|
100
|
+
},
|
|
101
|
+
"pageLimitOptions": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"complexType": {
|
|
105
|
+
"original": "string",
|
|
106
|
+
"resolved": "string",
|
|
107
|
+
"references": {}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": "Limits list string split with coma,default: `10,25,50`;"
|
|
114
|
+
},
|
|
115
|
+
"attribute": "page-limit-options",
|
|
116
|
+
"reflect": true
|
|
117
|
+
},
|
|
118
|
+
"limit": {
|
|
119
|
+
"type": "number",
|
|
120
|
+
"mutable": true,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "number",
|
|
123
|
+
"resolved": "number",
|
|
124
|
+
"references": {}
|
|
125
|
+
},
|
|
126
|
+
"required": false,
|
|
127
|
+
"optional": false,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": "Default limit for per page, default: 10"
|
|
131
|
+
},
|
|
132
|
+
"attribute": "limit",
|
|
133
|
+
"reflect": true,
|
|
134
|
+
"defaultValue": "10"
|
|
135
|
+
}
|
|
136
|
+
}; }
|
|
137
|
+
static get states() { return {
|
|
138
|
+
"pageLimits": {}
|
|
139
|
+
}; }
|
|
140
|
+
static get events() { return [{
|
|
141
|
+
"method": "pageLimitChanged",
|
|
142
|
+
"name": "pageLimitChanged",
|
|
143
|
+
"bubbles": true,
|
|
144
|
+
"cancelable": true,
|
|
145
|
+
"composed": true,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": ""
|
|
149
|
+
},
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "Object",
|
|
152
|
+
"resolved": "Object",
|
|
153
|
+
"references": {
|
|
154
|
+
"Object": {
|
|
155
|
+
"location": "global"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}]; }
|
|
160
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['pt-br', 'en', 'es-mx', 'hu', 'hr'];
|
|
3
|
+
export const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
"pageLimitLabel": 'Show',
|
|
6
|
+
},
|
|
7
|
+
hu: {
|
|
8
|
+
"pageLimitLabel": 'Show',
|
|
9
|
+
},
|
|
10
|
+
hr: {
|
|
11
|
+
"pageLimitLabel": 'Show',
|
|
12
|
+
},
|
|
13
|
+
"pt-br": {
|
|
14
|
+
"pageLimitLabel": 'Show',
|
|
15
|
+
},
|
|
16
|
+
"es-mx": {
|
|
17
|
+
"pageLimitLabel": 'Show',
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export const translate = (key, customLang) => {
|
|
21
|
+
const lang = customLang;
|
|
22
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
23
|
+
};
|
|
24
|
+
export const getTranslations = (url) => {
|
|
25
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
26
|
+
return new Promise((resolve) => {
|
|
27
|
+
fetch(url)
|
|
28
|
+
.then((res) => res.json())
|
|
29
|
+
.then((data) => {
|
|
30
|
+
Object.keys(data).forEach((item) => {
|
|
31
|
+
for (let key in data[item]) {
|
|
32
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
resolve(true);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BonusPaginationLimits extends Components.BonusPaginationLimits, HTMLElement {}
|
|
4
|
+
export const BonusPaginationLimits: {
|
|
5
|
+
prototype: BonusPaginationLimits;
|
|
6
|
+
new (): BonusPaginationLimits;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
4
|
+
const SUPPORTED_LANGUAGES = ['pt-br', 'en', 'es-mx', 'hu', 'hr'];
|
|
5
|
+
const TRANSLATIONS = {
|
|
6
|
+
en: {
|
|
7
|
+
"pageLimitLabel": 'Show',
|
|
8
|
+
},
|
|
9
|
+
hu: {
|
|
10
|
+
"pageLimitLabel": 'Show',
|
|
11
|
+
},
|
|
12
|
+
hr: {
|
|
13
|
+
"pageLimitLabel": 'Show',
|
|
14
|
+
},
|
|
15
|
+
"pt-br": {
|
|
16
|
+
"pageLimitLabel": 'Show',
|
|
17
|
+
},
|
|
18
|
+
"es-mx": {
|
|
19
|
+
"pageLimitLabel": 'Show',
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const translate = (key, customLang) => {
|
|
23
|
+
const lang = customLang;
|
|
24
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const bonusPaginationLimitsCss = ":host{display:block}.NoOfItemsToDisplayMessage{display:inline-block;margin:0.1rem;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--emfe-w-color-primary, #191a19);line-height:1.8}.PaginationWrapper{display:flex;flex-direction:row}ul.PaginationArea{margin-block:5px;display:flex;flex-direction:row;padding:0px}ul.PaginationArea li.Item.Active:hover{color:var(--emfe-w-color-primary, #eaefea);background-color:var(--emfe-w-color-secondary, #191a19)}ul.PaginationArea li.Item.Active,ul.PaginationArea li.Item:hover{background-color:var(--emfe-w-color-primary, rgba(169, 171, 169, 0.7));font-weight:bold;border-radius:0.3rem}ul.PaginationArea li.Item{padding-inline-start:0px;list-style:none;padding:5px 6px;margin:2px;cursor:pointer;display:inline-block}";
|
|
28
|
+
|
|
29
|
+
const BonusPaginationLimits$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
this.__registerHost();
|
|
33
|
+
this.pageLimitChanged = createEvent(this, "pageLimitChanged", 7);
|
|
34
|
+
/**
|
|
35
|
+
* Language of the widget
|
|
36
|
+
*/
|
|
37
|
+
this.language = 'en';
|
|
38
|
+
/**
|
|
39
|
+
* Translation via url
|
|
40
|
+
*/
|
|
41
|
+
this.translationUrl = '';
|
|
42
|
+
/**
|
|
43
|
+
* Default limit for per page, default: 10
|
|
44
|
+
*/
|
|
45
|
+
this.limit = 10;
|
|
46
|
+
this.pageLimits = [10, 25, 50];
|
|
47
|
+
}
|
|
48
|
+
onPageLimitClicked(pageLimit) {
|
|
49
|
+
this.limit = pageLimit;
|
|
50
|
+
this.pageLimitChanged.emit({ limit: this.limit });
|
|
51
|
+
}
|
|
52
|
+
componentWillLoad() {
|
|
53
|
+
if (!this.pageLimitOptions) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
this.pageLimits = this.pageLimitOptions.split(',').map((item) => {
|
|
58
|
+
return parseInt(item);
|
|
59
|
+
});
|
|
60
|
+
// if there is an array of custom limits provided (string to array - e.g. [5, 10, 15])
|
|
61
|
+
// and the value for the custom set limit (e.g. 8) isn't part of the provided array,
|
|
62
|
+
// then ignore the set the custom set limit and make the limit equal to the first value of the array
|
|
63
|
+
// (as part of the example so far, this would be 5)
|
|
64
|
+
if (!this.pageLimits.includes(this.limit)) {
|
|
65
|
+
this.limit = this.pageLimits[0];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
console.error('Error when parse PageLimitOptions', e);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
renderStylingWrapper() {
|
|
73
|
+
return h("general-styling-wrapper", { targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl });
|
|
74
|
+
}
|
|
75
|
+
render() {
|
|
76
|
+
return h("div", { class: 'PaginationWrapper' }, h("span", { class: 'NoOfItemsToDisplayMessage' }, translate('pageLimitLabel', this.language)), h("ul", { class: 'PaginationArea' }, this.pageLimits.map((pageLimit) => {
|
|
77
|
+
return (h("li", { class: `${this.limit == pageLimit ? 'Active' : ''} PageSize Item`, onClick: () => {
|
|
78
|
+
this.onPageLimitClicked(pageLimit);
|
|
79
|
+
} }, pageLimit));
|
|
80
|
+
})), h("general-styling-wrapper", { targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl }), this.renderStylingWrapper());
|
|
81
|
+
}
|
|
82
|
+
static get style() { return bonusPaginationLimitsCss; }
|
|
83
|
+
}, [0, "bonus-pagination-limits", {
|
|
84
|
+
"language": [513],
|
|
85
|
+
"translationUrl": [513, "translation-url"],
|
|
86
|
+
"pageLimitOptions": [513, "page-limit-options"],
|
|
87
|
+
"limit": [1538],
|
|
88
|
+
"pageLimits": [32]
|
|
89
|
+
}]);
|
|
90
|
+
function defineCustomElement$1() {
|
|
91
|
+
if (typeof customElements === "undefined") {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const components = ["bonus-pagination-limits"];
|
|
95
|
+
components.forEach(tagName => { switch (tagName) {
|
|
96
|
+
case "bonus-pagination-limits":
|
|
97
|
+
if (!customElements.get(tagName)) {
|
|
98
|
+
customElements.define(tagName, BonusPaginationLimits$1);
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
} });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const BonusPaginationLimits = BonusPaginationLimits$1;
|
|
105
|
+
const defineCustomElement = defineCustomElement$1;
|
|
106
|
+
|
|
107
|
+
export { BonusPaginationLimits, defineCustomElement };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* BonusPaginationLimits 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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-689c38fd.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
4
|
+
const SUPPORTED_LANGUAGES = ['pt-br', 'en', 'es-mx', 'hu', 'hr'];
|
|
5
|
+
const TRANSLATIONS = {
|
|
6
|
+
en: {
|
|
7
|
+
"pageLimitLabel": 'Show',
|
|
8
|
+
},
|
|
9
|
+
hu: {
|
|
10
|
+
"pageLimitLabel": 'Show',
|
|
11
|
+
},
|
|
12
|
+
hr: {
|
|
13
|
+
"pageLimitLabel": 'Show',
|
|
14
|
+
},
|
|
15
|
+
"pt-br": {
|
|
16
|
+
"pageLimitLabel": 'Show',
|
|
17
|
+
},
|
|
18
|
+
"es-mx": {
|
|
19
|
+
"pageLimitLabel": 'Show',
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const translate = (key, customLang) => {
|
|
23
|
+
const lang = customLang;
|
|
24
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const bonusPaginationLimitsCss = ":host{display:block}.NoOfItemsToDisplayMessage{display:inline-block;margin:0.1rem;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--emfe-w-color-primary, #191a19);line-height:1.8}.PaginationWrapper{display:flex;flex-direction:row}ul.PaginationArea{margin-block:5px;display:flex;flex-direction:row;padding:0px}ul.PaginationArea li.Item.Active:hover{color:var(--emfe-w-color-primary, #eaefea);background-color:var(--emfe-w-color-secondary, #191a19)}ul.PaginationArea li.Item.Active,ul.PaginationArea li.Item:hover{background-color:var(--emfe-w-color-primary, rgba(169, 171, 169, 0.7));font-weight:bold;border-radius:0.3rem}ul.PaginationArea li.Item{padding-inline-start:0px;list-style:none;padding:5px 6px;margin:2px;cursor:pointer;display:inline-block}";
|
|
28
|
+
|
|
29
|
+
const BonusPaginationLimits = class {
|
|
30
|
+
constructor(hostRef) {
|
|
31
|
+
registerInstance(this, hostRef);
|
|
32
|
+
this.pageLimitChanged = createEvent(this, "pageLimitChanged", 7);
|
|
33
|
+
/**
|
|
34
|
+
* Language of the widget
|
|
35
|
+
*/
|
|
36
|
+
this.language = 'en';
|
|
37
|
+
/**
|
|
38
|
+
* Translation via url
|
|
39
|
+
*/
|
|
40
|
+
this.translationUrl = '';
|
|
41
|
+
/**
|
|
42
|
+
* Default limit for per page, default: 10
|
|
43
|
+
*/
|
|
44
|
+
this.limit = 10;
|
|
45
|
+
this.pageLimits = [10, 25, 50];
|
|
46
|
+
}
|
|
47
|
+
onPageLimitClicked(pageLimit) {
|
|
48
|
+
this.limit = pageLimit;
|
|
49
|
+
this.pageLimitChanged.emit({ limit: this.limit });
|
|
50
|
+
}
|
|
51
|
+
componentWillLoad() {
|
|
52
|
+
if (!this.pageLimitOptions) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
this.pageLimits = this.pageLimitOptions.split(',').map((item) => {
|
|
57
|
+
return parseInt(item);
|
|
58
|
+
});
|
|
59
|
+
// if there is an array of custom limits provided (string to array - e.g. [5, 10, 15])
|
|
60
|
+
// and the value for the custom set limit (e.g. 8) isn't part of the provided array,
|
|
61
|
+
// then ignore the set the custom set limit and make the limit equal to the first value of the array
|
|
62
|
+
// (as part of the example so far, this would be 5)
|
|
63
|
+
if (!this.pageLimits.includes(this.limit)) {
|
|
64
|
+
this.limit = this.pageLimits[0];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
console.error('Error when parse PageLimitOptions', e);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
renderStylingWrapper() {
|
|
72
|
+
return h("general-styling-wrapper", { targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl });
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
return h("div", { class: 'PaginationWrapper' }, h("span", { class: 'NoOfItemsToDisplayMessage' }, translate('pageLimitLabel', this.language)), h("ul", { class: 'PaginationArea' }, this.pageLimits.map((pageLimit) => {
|
|
76
|
+
return (h("li", { class: `${this.limit == pageLimit ? 'Active' : ''} PageSize Item`, onClick: () => {
|
|
77
|
+
this.onPageLimitClicked(pageLimit);
|
|
78
|
+
} }, pageLimit));
|
|
79
|
+
})), h("general-styling-wrapper", { targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl }), this.renderStylingWrapper());
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
BonusPaginationLimits.style = bonusPaginationLimitsCss;
|
|
83
|
+
|
|
84
|
+
export { BonusPaginationLimits as bonus_pagination_limits };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-689c38fd.js';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
5
|
+
*/
|
|
6
|
+
const patchBrowser = () => {
|
|
7
|
+
const importMeta = import.meta.url;
|
|
8
|
+
const opts = {};
|
|
9
|
+
if (importMeta !== '') {
|
|
10
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
11
|
+
}
|
|
12
|
+
return promiseResolve(opts);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
patchBrowser().then(options => {
|
|
16
|
+
return bootstrapLazy([["bonus-pagination-limits",[[0,"bonus-pagination-limits",{"language":[513],"translationUrl":[513,"translation-url"],"pageLimitOptions":[513,"page-limit-options"],"limit":[1538],"pageLimits":[32]}]]]], options);
|
|
17
|
+
});
|