@everymatrix/lottery-ticket-controller 0.1.7 → 0.1.21
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/cjs/helper-accordion_5.cjs.entry.js +236 -25
- package/dist/cjs/{index-95915aab.js → index-dd94b8db.js} +17 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/lottery-ticket-controller.cjs.js +2 -2
- package/dist/collection/components/lottery-ticket-controller/lottery-ticket-controller.js +76 -4
- package/dist/collection/utils/locale.utils.js +20 -0
- package/dist/components/helper-accordion2.js +44 -3
- package/dist/components/lottery-bullet2.js +37 -2
- package/dist/components/lottery-grid2.js +43 -3
- package/dist/components/lottery-ticket-controller.js +58 -2
- package/dist/components/lottery-ticket2.js +58 -3
- package/dist/esm/helper-accordion_5.entry.js +236 -25
- package/dist/esm/{index-e3877ca0.js → index-74cef6d4.js} +17 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/lottery-ticket-controller.js +2 -2
- package/dist/lottery-ticket-controller/lottery-ticket-controller.esm.js +1 -1
- package/dist/lottery-ticket-controller/p-72e48800.js +1 -0
- package/dist/lottery-ticket-controller/p-9a5da031.entry.js +1 -0
- package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/stencil/widgets-stencil/packages/lottery-ticket-controller/.stencil/packages/lottery-ticket-controller/stencil.config.d.ts +2 -0
- package/dist/types/components/lottery-ticket-controller/lottery-ticket-controller.d.ts +13 -0
- package/dist/types/components.d.ts +16 -0
- package/dist/types/utils/locale.utils.d.ts +1 -0
- package/package.json +5 -1
- package/dist/lottery-ticket-controller/p-3971b8e6.js +0 -1
- package/dist/lottery-ticket-controller/p-95406ad0.entry.js +0 -1
- package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/lottery-ticket-controller/.stencil/packages/lottery-ticket-controller/stencil.config.d.ts +0 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
|
|
3
|
+
const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
ticket: 'Ticket',
|
|
6
|
+
},
|
|
7
|
+
ro: {
|
|
8
|
+
ticket: 'Bilet',
|
|
9
|
+
},
|
|
10
|
+
fr: {
|
|
11
|
+
ticket: 'Billet'
|
|
12
|
+
},
|
|
13
|
+
ar: {
|
|
14
|
+
ticket: 'تذكرة',
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export const translate = (key, customLang) => {
|
|
18
|
+
const lang = customLang;
|
|
19
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
20
|
+
};
|
|
@@ -9,13 +9,19 @@ const TRANSLATIONS = {
|
|
|
9
9
|
ro: {
|
|
10
10
|
deleteTicket: 'Sterge biletul'
|
|
11
11
|
},
|
|
12
|
+
fr: {
|
|
13
|
+
deleteTicket: 'Supprimer le billet'
|
|
14
|
+
},
|
|
15
|
+
ar: {
|
|
16
|
+
deleteTicket: 'حذف التذكرة'
|
|
17
|
+
}
|
|
12
18
|
};
|
|
13
19
|
const translate = (key, customLang) => {
|
|
14
20
|
const lang = customLang;
|
|
15
21
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
16
22
|
};
|
|
17
23
|
|
|
18
|
-
const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:
|
|
24
|
+
const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:5px;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:1px}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff;text-transform:capitalize}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
|
|
19
25
|
|
|
20
26
|
const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
21
27
|
constructor() {
|
|
@@ -63,11 +69,43 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
63
69
|
* Language
|
|
64
70
|
*/
|
|
65
71
|
this.language = 'en';
|
|
72
|
+
/**
|
|
73
|
+
* Client custom styling via string
|
|
74
|
+
*/
|
|
75
|
+
this.clientStyling = '';
|
|
76
|
+
/**
|
|
77
|
+
* Client custom styling via url content
|
|
78
|
+
*/
|
|
79
|
+
this.clientStylingUrlContent = '';
|
|
80
|
+
this.limitStylingAppends = false;
|
|
81
|
+
this.setClientStyling = () => {
|
|
82
|
+
let sheet = document.createElement('style');
|
|
83
|
+
sheet.innerHTML = this.clientStyling;
|
|
84
|
+
this.stylingContainer.prepend(sheet);
|
|
85
|
+
};
|
|
86
|
+
this.setClientStylingURL = () => {
|
|
87
|
+
let cssFile = document.createElement('style');
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
90
|
+
this.stylingContainer.prepend(cssFile);
|
|
91
|
+
}, 1);
|
|
92
|
+
};
|
|
66
93
|
}
|
|
67
94
|
// @TODO fix the `any` type :)
|
|
68
95
|
connectedCallback() {
|
|
69
96
|
this.showContent = !this.collapsed;
|
|
70
97
|
}
|
|
98
|
+
componentDidRender() {
|
|
99
|
+
// start custom styling area
|
|
100
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
101
|
+
if (this.clientStyling)
|
|
102
|
+
this.setClientStyling();
|
|
103
|
+
if (this.clientStylingUrlContent)
|
|
104
|
+
this.setClientStylingURL();
|
|
105
|
+
this.limitStylingAppends = true;
|
|
106
|
+
}
|
|
107
|
+
// end custom styling area
|
|
108
|
+
}
|
|
71
109
|
toggleContent() {
|
|
72
110
|
this.showContent = !this.showContent;
|
|
73
111
|
}
|
|
@@ -79,7 +117,7 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
79
117
|
this.accordionEvent.emit();
|
|
80
118
|
}
|
|
81
119
|
render() {
|
|
82
|
-
return (h("div", { class: "Wrapper" }, h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle" }, this.description), h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
|
|
120
|
+
return (h("div", { class: "Wrapper", ref: el => this.stylingContainer = el }, h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle Description" }, this.description), h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
|
|
83
121
|
h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
|
|
84
122
|
h("div", null, this.deleteTab &&
|
|
85
123
|
h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
|
|
@@ -96,7 +134,10 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
96
134
|
"eventName": [1, "event-name"],
|
|
97
135
|
"collapsed": [4],
|
|
98
136
|
"language": [1],
|
|
99
|
-
"
|
|
137
|
+
"clientStyling": [1, "client-styling"],
|
|
138
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
139
|
+
"showContent": [32],
|
|
140
|
+
"limitStylingAppends": [32]
|
|
100
141
|
}]);
|
|
101
142
|
function defineCustomElement() {
|
|
102
143
|
if (typeof customElements === "undefined") {
|
|
@@ -20,6 +20,15 @@ const LotteryBullet = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
20
20
|
* Marks if the bullet should be selected
|
|
21
21
|
*/
|
|
22
22
|
this.isSelected = false;
|
|
23
|
+
/**
|
|
24
|
+
* Client custom styling via string
|
|
25
|
+
*/
|
|
26
|
+
this.clientStyling = '';
|
|
27
|
+
/**
|
|
28
|
+
* Client custom styling via url content
|
|
29
|
+
*/
|
|
30
|
+
this.clientStylingUrlContent = '';
|
|
31
|
+
this.limitStylingAppends = false;
|
|
23
32
|
this.select = () => {
|
|
24
33
|
if (this.selectable) {
|
|
25
34
|
this.isSelected = !this.isSelected;
|
|
@@ -29,15 +38,41 @@ const LotteryBullet = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
29
38
|
});
|
|
30
39
|
}
|
|
31
40
|
};
|
|
41
|
+
this.setClientStyling = () => {
|
|
42
|
+
let sheet = document.createElement('style');
|
|
43
|
+
sheet.innerHTML = this.clientStyling;
|
|
44
|
+
this.stylingContainer.prepend(sheet);
|
|
45
|
+
};
|
|
46
|
+
this.setClientStylingURL = () => {
|
|
47
|
+
let cssFile = document.createElement('style');
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
50
|
+
this.stylingContainer.prepend(cssFile);
|
|
51
|
+
}, 1);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
componentDidRender() {
|
|
55
|
+
// start custom styling area
|
|
56
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
57
|
+
if (this.clientStyling)
|
|
58
|
+
this.setClientStyling();
|
|
59
|
+
if (this.clientStylingUrlContent)
|
|
60
|
+
this.setClientStylingURL();
|
|
61
|
+
this.limitStylingAppends = true;
|
|
62
|
+
}
|
|
63
|
+
// end custom styling area
|
|
32
64
|
}
|
|
33
65
|
render() {
|
|
34
|
-
return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
|
|
66
|
+
return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
|
|
35
67
|
}
|
|
36
68
|
static get style() { return lotteryBulletCss; }
|
|
37
69
|
}, [1, "lottery-bullet", {
|
|
38
70
|
"value": [1],
|
|
39
71
|
"selectable": [4],
|
|
40
|
-
"isSelected": [4, "is-selected"]
|
|
72
|
+
"isSelected": [4, "is-selected"],
|
|
73
|
+
"clientStyling": [1, "client-styling"],
|
|
74
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
75
|
+
"limitStylingAppends": [32]
|
|
41
76
|
}]);
|
|
42
77
|
function defineCustomElement() {
|
|
43
78
|
if (typeof customElements === "undefined") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$1 } from './lottery-bullet2.js';
|
|
3
3
|
|
|
4
|
-
const lotteryGridCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridContainer{display:flex;flex-direction:column;max-width:1200px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:
|
|
4
|
+
const lotteryGridCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridContainer{display:flex;flex-direction:column;max-width:1200px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:20px}.Grid.TicketGrid{gap:5px}";
|
|
5
5
|
|
|
6
6
|
const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -38,8 +38,33 @@ const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
38
38
|
* Language
|
|
39
39
|
*/
|
|
40
40
|
this.language = 'en';
|
|
41
|
+
/**
|
|
42
|
+
* Personalize grid for ticket
|
|
43
|
+
*/
|
|
44
|
+
this.gridType = '';
|
|
45
|
+
/**
|
|
46
|
+
* Client custom styling via string
|
|
47
|
+
*/
|
|
48
|
+
this.clientStyling = '';
|
|
49
|
+
/**
|
|
50
|
+
* Client custom styling via url content
|
|
51
|
+
*/
|
|
52
|
+
this.clientStylingUrlContent = '';
|
|
41
53
|
this.numbers = [];
|
|
54
|
+
this.limitStylingAppends = false;
|
|
42
55
|
this.selectedCounter = 0;
|
|
56
|
+
this.setClientStyling = () => {
|
|
57
|
+
let sheet = document.createElement('style');
|
|
58
|
+
sheet.innerHTML = this.clientStyling;
|
|
59
|
+
this.stylingContainer.prepend(sheet);
|
|
60
|
+
};
|
|
61
|
+
this.setClientStylingURL = () => {
|
|
62
|
+
let cssFile = document.createElement('style');
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
65
|
+
this.stylingContainer.prepend(cssFile);
|
|
66
|
+
}, 1);
|
|
67
|
+
};
|
|
43
68
|
}
|
|
44
69
|
connectedCallback() {
|
|
45
70
|
let selected = [];
|
|
@@ -68,6 +93,17 @@ const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
68
93
|
});
|
|
69
94
|
}
|
|
70
95
|
}
|
|
96
|
+
componentDidRender() {
|
|
97
|
+
// start custom styling area
|
|
98
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
99
|
+
if (this.clientStyling)
|
|
100
|
+
this.setClientStyling();
|
|
101
|
+
if (this.clientStylingUrlContent)
|
|
102
|
+
this.setClientStylingURL();
|
|
103
|
+
this.limitStylingAppends = true;
|
|
104
|
+
}
|
|
105
|
+
// end custom styling area
|
|
106
|
+
}
|
|
71
107
|
lotteryBulletSelectionHandler(event) {
|
|
72
108
|
this.numbers = this.numbers.map((item) => {
|
|
73
109
|
if (item.number == event.detail.value) {
|
|
@@ -158,7 +194,7 @@ const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
158
194
|
}
|
|
159
195
|
}
|
|
160
196
|
render() {
|
|
161
|
-
return (h("div", { class: "GridContainer" }, h("div", { class:
|
|
197
|
+
return (h("div", { class: "GridContainer", ref: el => this.stylingContainer = el }, h("div", { class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => h("div", null, h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
|
|
162
198
|
}
|
|
163
199
|
static get style() { return lotteryGridCss; }
|
|
164
200
|
}, [1, "lottery-grid", {
|
|
@@ -172,7 +208,11 @@ const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
172
208
|
"displaySelected": [4, "display-selected"],
|
|
173
209
|
"language": [1],
|
|
174
210
|
"gridIndex": [2, "grid-index"],
|
|
175
|
-
"
|
|
211
|
+
"gridType": [1, "grid-type"],
|
|
212
|
+
"clientStyling": [1, "client-styling"],
|
|
213
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
214
|
+
"numbers": [32],
|
|
215
|
+
"limitStylingAppends": [32]
|
|
176
216
|
}, [[0, "lotteryBulletSelection", "lotteryBulletSelectionHandler"], [4, "resetSelection", "resetSelectionHandler"], [4, "autoSelection", "autoSelectionHandler"]]]);
|
|
177
217
|
function defineCustomElement() {
|
|
178
218
|
if (typeof customElements === "undefined") {
|
|
@@ -4,6 +4,27 @@ import { d as defineCustomElement$4 } from './lottery-bullet2.js';
|
|
|
4
4
|
import { d as defineCustomElement$3 } from './lottery-grid2.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './lottery-ticket2.js';
|
|
6
6
|
|
|
7
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
|
|
9
|
+
const TRANSLATIONS = {
|
|
10
|
+
en: {
|
|
11
|
+
ticket: 'Ticket',
|
|
12
|
+
},
|
|
13
|
+
ro: {
|
|
14
|
+
ticket: 'Bilet',
|
|
15
|
+
},
|
|
16
|
+
fr: {
|
|
17
|
+
ticket: 'Billet'
|
|
18
|
+
},
|
|
19
|
+
ar: {
|
|
20
|
+
ticket: 'تذكرة',
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const translate = (key, customLang) => {
|
|
24
|
+
const lang = customLang;
|
|
25
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
26
|
+
};
|
|
27
|
+
|
|
7
28
|
const lotteryTicketControllerCss = ":host{display:block}";
|
|
8
29
|
|
|
9
30
|
const LotteryTicketController$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -52,6 +73,27 @@ const LotteryTicketController$1 = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
52
73
|
* Shows the reset button
|
|
53
74
|
*/
|
|
54
75
|
this.resetButton = false;
|
|
76
|
+
/**
|
|
77
|
+
* Client custom styling via string
|
|
78
|
+
*/
|
|
79
|
+
this.clientStyling = '';
|
|
80
|
+
/**
|
|
81
|
+
* Client custom styling via url content
|
|
82
|
+
*/
|
|
83
|
+
this.clientStylingUrlContent = '';
|
|
84
|
+
this.limitStylingAppends = false;
|
|
85
|
+
this.setClientStyling = () => {
|
|
86
|
+
let sheet = document.createElement('style');
|
|
87
|
+
sheet.innerHTML = this.clientStyling;
|
|
88
|
+
this.stylingContainer.prepend(sheet);
|
|
89
|
+
};
|
|
90
|
+
this.setClientStylingURL = () => {
|
|
91
|
+
let cssFile = document.createElement('style');
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
94
|
+
this.stylingContainer.prepend(cssFile);
|
|
95
|
+
}, 1);
|
|
96
|
+
};
|
|
55
97
|
}
|
|
56
98
|
// @TODO fix the `any` type
|
|
57
99
|
helperAccordionActionHandler() {
|
|
@@ -62,8 +104,19 @@ const LotteryTicketController$1 = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
62
104
|
ticketId: this.ticketId
|
|
63
105
|
});
|
|
64
106
|
}
|
|
107
|
+
componentDidRender() {
|
|
108
|
+
// start custom styling area
|
|
109
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
110
|
+
if (this.clientStyling)
|
|
111
|
+
this.setClientStyling();
|
|
112
|
+
if (this.clientStylingUrlContent)
|
|
113
|
+
this.setClientStylingURL();
|
|
114
|
+
this.limitStylingAppends = true;
|
|
115
|
+
}
|
|
116
|
+
// end custom styling area
|
|
117
|
+
}
|
|
65
118
|
render() {
|
|
66
|
-
return (h("div",
|
|
119
|
+
return (h("div", { class: "LotteryTicketControllerContainer", ref: el => this.stylingContainer = el }, h("helper-accordion", { "header-title": `${translate('ticket', this.language)} ${this.ticketId}`, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }, h("div", { slot: "accordionContent" }, h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })))));
|
|
67
120
|
}
|
|
68
121
|
static get style() { return lotteryTicketControllerCss; }
|
|
69
122
|
}, [1, "lottery-ticket-controller", {
|
|
@@ -78,7 +131,10 @@ const LotteryTicketController$1 = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
78
131
|
"last": [4],
|
|
79
132
|
"language": [1],
|
|
80
133
|
"autoPick": [4, "auto-pick"],
|
|
81
|
-
"resetButton": [4, "reset-button"]
|
|
134
|
+
"resetButton": [4, "reset-button"],
|
|
135
|
+
"clientStyling": [1, "client-styling"],
|
|
136
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
137
|
+
"limitStylingAppends": [32]
|
|
82
138
|
}, [[0, "helperAccordionAction", "helperAccordionActionHandler"]]]);
|
|
83
139
|
function defineCustomElement$1() {
|
|
84
140
|
if (typeof customElements === "undefined") {
|
|
@@ -25,6 +25,26 @@ const TRANSLATIONS = {
|
|
|
25
25
|
resetButton: 'Reseteaza',
|
|
26
26
|
autoButton: 'Ma simt norocos'
|
|
27
27
|
},
|
|
28
|
+
fr: {
|
|
29
|
+
loading: 'Loading, please wait ...',
|
|
30
|
+
error: 'It was an error while trying to fetch the data',
|
|
31
|
+
grid: 'Grid',
|
|
32
|
+
multiplier: 'Multiplier',
|
|
33
|
+
numberOfDraws: 'Number of draws',
|
|
34
|
+
wagerPerDraw: 'Wager per draw',
|
|
35
|
+
resetButton: 'Reset',
|
|
36
|
+
autoButton: 'I feel lucky'
|
|
37
|
+
},
|
|
38
|
+
ar: {
|
|
39
|
+
loading: 'Loading, please wait ...',
|
|
40
|
+
error: 'It was an error while trying to fetch the data',
|
|
41
|
+
grid: 'Grid',
|
|
42
|
+
multiplier: 'Multiplier',
|
|
43
|
+
numberOfDraws: 'Number of draws',
|
|
44
|
+
wagerPerDraw: 'Wager per draw',
|
|
45
|
+
resetButton: 'Reset',
|
|
46
|
+
autoButton: 'I feel lucky'
|
|
47
|
+
}
|
|
28
48
|
};
|
|
29
49
|
const translate = (key, customLang) => {
|
|
30
50
|
const lang = customLang;
|
|
@@ -63,6 +83,14 @@ const LotteryTicket = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
63
83
|
* Language
|
|
64
84
|
*/
|
|
65
85
|
this.language = 'en';
|
|
86
|
+
/**
|
|
87
|
+
* Client custom styling via string
|
|
88
|
+
*/
|
|
89
|
+
this.clientStyling = '';
|
|
90
|
+
/**
|
|
91
|
+
* Client custom styling via url content
|
|
92
|
+
*/
|
|
93
|
+
this.clientStylingUrlContent = '';
|
|
66
94
|
this.multiplier = false;
|
|
67
95
|
this.numberOfDraws = 1;
|
|
68
96
|
this.isLoading = true;
|
|
@@ -70,6 +98,19 @@ const LotteryTicket = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
70
98
|
this.ticketDone = false;
|
|
71
99
|
this.isCustomSelect = false;
|
|
72
100
|
this.amountInfo = {};
|
|
101
|
+
this.limitStylingAppends = false;
|
|
102
|
+
this.setClientStyling = () => {
|
|
103
|
+
let sheet = document.createElement('style');
|
|
104
|
+
sheet.innerHTML = this.clientStyling;
|
|
105
|
+
this.stylingContainer.prepend(sheet);
|
|
106
|
+
};
|
|
107
|
+
this.setClientStylingURL = () => {
|
|
108
|
+
let cssFile = document.createElement('style');
|
|
109
|
+
setTimeout(() => {
|
|
110
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
111
|
+
this.stylingContainer.prepend(cssFile);
|
|
112
|
+
}, 1);
|
|
113
|
+
};
|
|
73
114
|
}
|
|
74
115
|
/**
|
|
75
116
|
* @TODO find a better way to implement click outside the custom select, so that we don't have to use the 'data-cluster' attribute on each element
|
|
@@ -103,6 +144,17 @@ const LotteryTicket = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
103
144
|
console.error('Error!', err);
|
|
104
145
|
});
|
|
105
146
|
}
|
|
147
|
+
componentDidRender() {
|
|
148
|
+
// start custom styling area
|
|
149
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
150
|
+
if (this.clientStyling)
|
|
151
|
+
this.setClientStyling();
|
|
152
|
+
if (this.clientStylingUrlContent)
|
|
153
|
+
this.setClientStylingURL();
|
|
154
|
+
this.limitStylingAppends = true;
|
|
155
|
+
}
|
|
156
|
+
// end custom styling area
|
|
157
|
+
}
|
|
106
158
|
multiplierChangeHandler(e) {
|
|
107
159
|
this.multiplier = e.target ? e.target.checked : false;
|
|
108
160
|
this.multiplierChange.emit(this.multiplier);
|
|
@@ -151,9 +203,9 @@ const LotteryTicket = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
151
203
|
}
|
|
152
204
|
else {
|
|
153
205
|
const { rules } = this.gameData;
|
|
154
|
-
return (h("div", { class: "TicketContainer" }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
|
|
206
|
+
return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
|
|
155
207
|
h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
|
|
156
|
-
h("div", { class: "ButtonContainer" }, h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((item, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), h("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language }))), rules.multiplier &&
|
|
208
|
+
h("div", { class: "ButtonContainer" }, h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((item, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), h("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), rules.multiplier &&
|
|
157
209
|
h("div", null, h("label", { class: "Toggle" }, h("label", { class: "Label" }, translate('multiplier', this.language), ": "), h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
|
|
158
210
|
h("div", { class: "TicketDraws" }, h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), h("div", { class: "NumberInput" }, h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), h("div", null, h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
|
|
159
211
|
(h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.amount, " ", this.amountInfo.currency), h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, rules.stakes.map((item) => h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.amount == item.amount ? 'SelectedValue' : '', value: item.amount, onClick: () => this.setDropdownItem(item) }, item.amount, " ", item.currency)))))) : (h("div", null, h("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }), h("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))))));
|
|
@@ -173,13 +225,16 @@ const LotteryTicket = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
173
225
|
"resetButton": [4, "reset-button"],
|
|
174
226
|
"autoPick": [4, "auto-pick"],
|
|
175
227
|
"language": [1],
|
|
228
|
+
"clientStyling": [1, "client-styling"],
|
|
229
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
176
230
|
"multiplier": [32],
|
|
177
231
|
"numberOfDraws": [32],
|
|
178
232
|
"isLoading": [32],
|
|
179
233
|
"hasErrors": [32],
|
|
180
234
|
"ticketDone": [32],
|
|
181
235
|
"isCustomSelect": [32],
|
|
182
|
-
"amountInfo": [32]
|
|
236
|
+
"amountInfo": [32],
|
|
237
|
+
"limitStylingAppends": [32]
|
|
183
238
|
}, [[8, "click", "checkForClickOutside"], [0, "gridFilled", "gridFilledHandler"]]]);
|
|
184
239
|
function defineCustomElement() {
|
|
185
240
|
if (typeof customElements === "undefined") {
|