@everymatrix/lottery-ticket-controller 0.1.7 → 0.1.20
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 +171 -24
- 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 +14 -0
- package/dist/components/helper-accordion2.js +38 -3
- package/dist/components/lottery-bullet2.js +37 -2
- package/dist/components/lottery-grid2.js +43 -3
- package/dist/components/lottery-ticket-controller.js +52 -2
- package/dist/esm/helper-accordion_5.entry.js +171 -24
- 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-88036907.entry.js +1 -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
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-dd94b8db.js');
|
|
6
6
|
|
|
7
|
-
const DEFAULT_LANGUAGE$
|
|
8
|
-
const SUPPORTED_LANGUAGES$
|
|
9
|
-
const TRANSLATIONS$
|
|
7
|
+
const DEFAULT_LANGUAGE$2 = 'en';
|
|
8
|
+
const SUPPORTED_LANGUAGES$2 = ['ro', 'en'];
|
|
9
|
+
const TRANSLATIONS$2 = {
|
|
10
10
|
en: {
|
|
11
11
|
deleteTicket: 'Delete ticket'
|
|
12
12
|
},
|
|
@@ -14,12 +14,12 @@ const TRANSLATIONS$1 = {
|
|
|
14
14
|
deleteTicket: 'Sterge biletul'
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
|
-
const translate$
|
|
17
|
+
const translate$2 = (key, customLang) => {
|
|
18
18
|
const lang = customLang;
|
|
19
|
-
return TRANSLATIONS$
|
|
19
|
+
return TRANSLATIONS$2[lang !== undefined && SUPPORTED_LANGUAGES$2.includes(lang) ? lang : DEFAULT_LANGUAGE$2][key];
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
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:
|
|
22
|
+
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}";
|
|
23
23
|
|
|
24
24
|
const Accordion = class {
|
|
25
25
|
constructor(hostRef) {
|
|
@@ -65,11 +65,43 @@ const Accordion = class {
|
|
|
65
65
|
* Language
|
|
66
66
|
*/
|
|
67
67
|
this.language = 'en';
|
|
68
|
+
/**
|
|
69
|
+
* Client custom styling via string
|
|
70
|
+
*/
|
|
71
|
+
this.clientStyling = '';
|
|
72
|
+
/**
|
|
73
|
+
* Client custom styling via url content
|
|
74
|
+
*/
|
|
75
|
+
this.clientStylingUrlContent = '';
|
|
76
|
+
this.limitStylingAppends = false;
|
|
77
|
+
this.setClientStyling = () => {
|
|
78
|
+
let sheet = document.createElement('style');
|
|
79
|
+
sheet.innerHTML = this.clientStyling;
|
|
80
|
+
this.stylingContainer.prepend(sheet);
|
|
81
|
+
};
|
|
82
|
+
this.setClientStylingURL = () => {
|
|
83
|
+
let cssFile = document.createElement('style');
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
86
|
+
this.stylingContainer.prepend(cssFile);
|
|
87
|
+
}, 1);
|
|
88
|
+
};
|
|
68
89
|
}
|
|
69
90
|
// @TODO fix the `any` type :)
|
|
70
91
|
connectedCallback() {
|
|
71
92
|
this.showContent = !this.collapsed;
|
|
72
93
|
}
|
|
94
|
+
componentDidRender() {
|
|
95
|
+
// start custom styling area
|
|
96
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
97
|
+
if (this.clientStyling)
|
|
98
|
+
this.setClientStyling();
|
|
99
|
+
if (this.clientStylingUrlContent)
|
|
100
|
+
this.setClientStylingURL();
|
|
101
|
+
this.limitStylingAppends = true;
|
|
102
|
+
}
|
|
103
|
+
// end custom styling area
|
|
104
|
+
}
|
|
73
105
|
toggleContent() {
|
|
74
106
|
this.showContent = !this.showContent;
|
|
75
107
|
}
|
|
@@ -81,10 +113,10 @@ const Accordion = class {
|
|
|
81
113
|
this.accordionEvent.emit();
|
|
82
114
|
}
|
|
83
115
|
render() {
|
|
84
|
-
return (index.h("div", { class: "Wrapper" }, index.h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, index.h("p", { class: "Title" }, this.headerTitle), index.h("p", { class: "Subtitle" }, this.headerSubtitle), index.h("p", { class: "Subtitle" }, this.description), index.h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
|
|
116
|
+
return (index.h("div", { class: "Wrapper", ref: el => this.stylingContainer = el }, index.h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, index.h("p", { class: "Title" }, this.headerTitle), index.h("p", { class: "Subtitle" }, this.headerSubtitle), index.h("p", { class: "Subtitle Description" }, this.description), index.h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
|
|
85
117
|
index.h("div", null, index.h("div", { class: "Content" }, index.h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
|
|
86
118
|
index.h("div", null, this.deleteTab &&
|
|
87
|
-
index.h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate$
|
|
119
|
+
index.h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate$2('deleteTicket', this.language)))))));
|
|
88
120
|
}
|
|
89
121
|
};
|
|
90
122
|
Accordion.style = helperAccordionCss;
|
|
@@ -107,6 +139,15 @@ const LotteryBullet = class {
|
|
|
107
139
|
* Marks if the bullet should be selected
|
|
108
140
|
*/
|
|
109
141
|
this.isSelected = false;
|
|
142
|
+
/**
|
|
143
|
+
* Client custom styling via string
|
|
144
|
+
*/
|
|
145
|
+
this.clientStyling = '';
|
|
146
|
+
/**
|
|
147
|
+
* Client custom styling via url content
|
|
148
|
+
*/
|
|
149
|
+
this.clientStylingUrlContent = '';
|
|
150
|
+
this.limitStylingAppends = false;
|
|
110
151
|
this.select = () => {
|
|
111
152
|
if (this.selectable) {
|
|
112
153
|
this.isSelected = !this.isSelected;
|
|
@@ -116,14 +157,37 @@ const LotteryBullet = class {
|
|
|
116
157
|
});
|
|
117
158
|
}
|
|
118
159
|
};
|
|
160
|
+
this.setClientStyling = () => {
|
|
161
|
+
let sheet = document.createElement('style');
|
|
162
|
+
sheet.innerHTML = this.clientStyling;
|
|
163
|
+
this.stylingContainer.prepend(sheet);
|
|
164
|
+
};
|
|
165
|
+
this.setClientStylingURL = () => {
|
|
166
|
+
let cssFile = document.createElement('style');
|
|
167
|
+
setTimeout(() => {
|
|
168
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
169
|
+
this.stylingContainer.prepend(cssFile);
|
|
170
|
+
}, 1);
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
componentDidRender() {
|
|
174
|
+
// start custom styling area
|
|
175
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
176
|
+
if (this.clientStyling)
|
|
177
|
+
this.setClientStyling();
|
|
178
|
+
if (this.clientStylingUrlContent)
|
|
179
|
+
this.setClientStylingURL();
|
|
180
|
+
this.limitStylingAppends = true;
|
|
181
|
+
}
|
|
182
|
+
// end custom styling area
|
|
119
183
|
}
|
|
120
184
|
render() {
|
|
121
|
-
return (index.h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
|
|
185
|
+
return (index.h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
|
|
122
186
|
}
|
|
123
187
|
};
|
|
124
188
|
LotteryBullet.style = lotteryBulletCss;
|
|
125
189
|
|
|
126
|
-
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:
|
|
190
|
+
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}";
|
|
127
191
|
|
|
128
192
|
const LotteryGrid = class {
|
|
129
193
|
constructor(hostRef) {
|
|
@@ -158,8 +222,33 @@ const LotteryGrid = class {
|
|
|
158
222
|
* Language
|
|
159
223
|
*/
|
|
160
224
|
this.language = 'en';
|
|
225
|
+
/**
|
|
226
|
+
* Personalize grid for ticket
|
|
227
|
+
*/
|
|
228
|
+
this.gridType = '';
|
|
229
|
+
/**
|
|
230
|
+
* Client custom styling via string
|
|
231
|
+
*/
|
|
232
|
+
this.clientStyling = '';
|
|
233
|
+
/**
|
|
234
|
+
* Client custom styling via url content
|
|
235
|
+
*/
|
|
236
|
+
this.clientStylingUrlContent = '';
|
|
161
237
|
this.numbers = [];
|
|
238
|
+
this.limitStylingAppends = false;
|
|
162
239
|
this.selectedCounter = 0;
|
|
240
|
+
this.setClientStyling = () => {
|
|
241
|
+
let sheet = document.createElement('style');
|
|
242
|
+
sheet.innerHTML = this.clientStyling;
|
|
243
|
+
this.stylingContainer.prepend(sheet);
|
|
244
|
+
};
|
|
245
|
+
this.setClientStylingURL = () => {
|
|
246
|
+
let cssFile = document.createElement('style');
|
|
247
|
+
setTimeout(() => {
|
|
248
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
249
|
+
this.stylingContainer.prepend(cssFile);
|
|
250
|
+
}, 1);
|
|
251
|
+
};
|
|
163
252
|
}
|
|
164
253
|
connectedCallback() {
|
|
165
254
|
let selected = [];
|
|
@@ -188,6 +277,17 @@ const LotteryGrid = class {
|
|
|
188
277
|
});
|
|
189
278
|
}
|
|
190
279
|
}
|
|
280
|
+
componentDidRender() {
|
|
281
|
+
// start custom styling area
|
|
282
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
283
|
+
if (this.clientStyling)
|
|
284
|
+
this.setClientStyling();
|
|
285
|
+
if (this.clientStylingUrlContent)
|
|
286
|
+
this.setClientStylingURL();
|
|
287
|
+
this.limitStylingAppends = true;
|
|
288
|
+
}
|
|
289
|
+
// end custom styling area
|
|
290
|
+
}
|
|
191
291
|
lotteryBulletSelectionHandler(event) {
|
|
192
292
|
this.numbers = this.numbers.map((item) => {
|
|
193
293
|
if (item.number == event.detail.value) {
|
|
@@ -278,14 +378,14 @@ const LotteryGrid = class {
|
|
|
278
378
|
}
|
|
279
379
|
}
|
|
280
380
|
render() {
|
|
281
|
-
return (index.h("div", { class: "GridContainer" }, index.h("div", { class:
|
|
381
|
+
return (index.h("div", { class: "GridContainer", ref: el => this.stylingContainer = el }, index.h("div", { class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => index.h("div", null, index.h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
|
|
282
382
|
}
|
|
283
383
|
};
|
|
284
384
|
LotteryGrid.style = lotteryGridCss;
|
|
285
385
|
|
|
286
|
-
const DEFAULT_LANGUAGE = 'en';
|
|
287
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
288
|
-
const TRANSLATIONS = {
|
|
386
|
+
const DEFAULT_LANGUAGE$1 = 'en';
|
|
387
|
+
const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
|
|
388
|
+
const TRANSLATIONS$1 = {
|
|
289
389
|
en: {
|
|
290
390
|
loading: 'Loading, please wait ...',
|
|
291
391
|
error: 'It was an error while trying to fetch the data',
|
|
@@ -307,9 +407,9 @@ const TRANSLATIONS = {
|
|
|
307
407
|
autoButton: 'Ma simt norocos'
|
|
308
408
|
},
|
|
309
409
|
};
|
|
310
|
-
const translate = (key, customLang) => {
|
|
410
|
+
const translate$1 = (key, customLang) => {
|
|
311
411
|
const lang = customLang;
|
|
312
|
-
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
412
|
+
return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
|
|
313
413
|
};
|
|
314
414
|
|
|
315
415
|
const lotteryTicketCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketTitle{font-size:16px;font-weight:bold}.ButtonContainer{display:flex;justify-content:flex-end}.Toggle{cursor:pointer;margin-top:20px;display:inline-block}.ToggleSwitch{display:inline-block;background:#707070;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #F1F1F1 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#00ABA4}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px;font-size:14px;font-weight:lighter;color:#000}input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}.NumberInput,.WagerInput{margin-top:10px;display:inline-flex;align-items:center}.NumberInput,.NumberInput *{box-sizing:border-box}.NumberInput button{cursor:pointer;outline:none;-webkit-appearance:none;border:none;align-items:center;justify-content:center;height:20px;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);align-items:center;text-align:center}.NumberInput button.Plus:after{transform:translate(-50%, -50%) rotate(0deg);width:30px;display:inline-flex;align-items:center;text-align:center}.NumberInput input[type=number],.WagerInput input[type=number]{max-width:50px;display:inline-flex;align-items:center;padding:4px 10px;text-align:center}.NumberInput input[type=number] .WagerInputTitle,.WagerInput input[type=number] .WagerInputTitle{font-size:14px;color:#000;padding:10px}.InputDefault{background-color:#F1F1F1;border-radius:4px;padding:5px;border:solid 1px #D4D4D4;color:#707070}.AutoButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.AutoButton:active{background:#00958f;color:#FFF}.ResetButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ResetButton:hover{background:#FF6536;border:1px solid #FF3D00}.TicketGridBullets{background:#f1f1f1;border-radius:4px;padding:20px;margin-top:5px}.TicketGridBullets .TicketGridTitle{margin-top:0px}.Minus{border-radius:4px;width:30px;height:24px !important;margin-right:10px;color:#FFF;background:#009993}.Plus{border-radius:4px;width:30px;height:24px !important;margin-left:10px;color:#FFF;background:#009993}.SelectWrapper{width:auto;padding:5px;margin:0 auto;border:1px solid #ccc;border-radius:5px;position:relative}.SelectButton,.SelectOptions li{display:flex;align-items:center;cursor:pointer}.SelectButton{display:flex;padding:0 5px;border-radius:7px;align-items:center;justify-content:space-between;font-size:14px}.SelectButton span:first-child{padding-right:10px}.SelectExpand{transition:transform 0.3s linear;font-size:12px}.SelectActive .SelectExpand{transform:rotate(180deg)}.SelectContent{display:none;padding:5px;border-radius:7px}.SelectWrapper.SelectActive .SelectContent{width:100%;display:block;position:absolute;left:0;top:32px;padding:0;border:1px solid #ccc;overflow:hidden;background:#fff}.SelectContent .SelectOptions{max-height:100px;margin:0;overflow-y:auto;padding:0}.SelectContent .SelectOptions .SelectedValue{background-color:#009993;color:#fff}.SelectOptions::-webkit-scrollbar{width:7px}.SelectOptions::-webkit-scrollbar-track{background:#f1f1f1;border-radius:25px}.SelectOptions::-webkit-scrollbar-thumb{background:#ccc;border-radius:25px}.SelectOptions li{height:20px;padding:0 13px;font-size:14px}.SelectOptions li:hover{background:#f2f2f2}";
|
|
@@ -422,19 +522,19 @@ const LotteryTicket = class {
|
|
|
422
522
|
}
|
|
423
523
|
render() {
|
|
424
524
|
if (this.isLoading) {
|
|
425
|
-
return (index.h("div", null, index.h("p", null, translate('loading', this.language))));
|
|
525
|
+
return (index.h("div", null, index.h("p", null, translate$1('loading', this.language))));
|
|
426
526
|
}
|
|
427
527
|
else {
|
|
428
528
|
if (this.hasErrors) {
|
|
429
|
-
return (index.h("div", null, index.h("p", null, translate('error', this.language))));
|
|
529
|
+
return (index.h("div", null, index.h("p", null, translate$1('error', this.language))));
|
|
430
530
|
}
|
|
431
531
|
else {
|
|
432
532
|
const { rules } = this.gameData;
|
|
433
533
|
return (index.h("div", { class: "TicketContainer" }, index.h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
|
|
434
|
-
index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
|
|
435
|
-
index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((item, index$1) => index.h("div", { class: "TicketGridBullets" }, index.h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), index.h("lottery-grid", { "grid-index": index$1, "maximum-allowed": rules.boards[index$1].maximumAllowed, "minimum-allowed": rules.boards[index$1].minimumAllowed, "total-numbers": rules.boards[index$1].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language }))), rules.multiplier &&
|
|
436
|
-
index.h("div", null, index.h("label", { class: "Toggle" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), ": "), index.h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), index.h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
|
|
437
|
-
index.h("div", { class: "TicketDraws" }, index.h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), index.h("div", { class: "NumberInput" }, index.h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), index.h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), index.h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), index.h("div", null, index.h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), index.h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
|
|
534
|
+
index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate$1('resetButton', this.language))), this.autoPick && !this.ticketDone &&
|
|
535
|
+
index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate$1('autoButton', this.language))), this.grids.map((item, index$1) => index.h("div", { class: "TicketGridBullets" }, index.h("p", { class: "TicketGridTitle" }, translate$1('grid', this.language), " ", item), index.h("lottery-grid", { "grid-index": index$1, "maximum-allowed": rules.boards[index$1].maximumAllowed, "minimum-allowed": rules.boards[index$1].minimumAllowed, "total-numbers": rules.boards[index$1].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language }))), rules.multiplier &&
|
|
536
|
+
index.h("div", null, index.h("label", { class: "Toggle" }, index.h("label", { class: "Label" }, translate$1('multiplier', this.language), ": "), index.h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), index.h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
|
|
537
|
+
index.h("div", { class: "TicketDraws" }, index.h("label", { class: "Label" }, translate$1('numberOfDraws', this.language), ": "), index.h("div", { class: "NumberInput" }, index.h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), index.h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), index.h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), index.h("div", null, index.h("label", { class: "Label" }, translate$1('wagerPerDraw', this.language), ": "), index.h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
|
|
438
538
|
(index.h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, index.h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, index.h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.amount, " ", this.amountInfo.currency), index.h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), index.h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, index.h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, rules.stakes.map((item) => index.h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.amount == item.amount ? 'SelectedValue' : '', value: item.amount, onClick: () => this.setDropdownItem(item) }, item.amount, " ", item.currency)))))) : (index.h("div", null, index.h("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }), index.h("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))))));
|
|
439
539
|
}
|
|
440
540
|
}
|
|
@@ -445,6 +545,21 @@ const LotteryTicket = class {
|
|
|
445
545
|
};
|
|
446
546
|
LotteryTicket.style = lotteryTicketCss;
|
|
447
547
|
|
|
548
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
549
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
550
|
+
const TRANSLATIONS = {
|
|
551
|
+
en: {
|
|
552
|
+
ticket: 'Ticket',
|
|
553
|
+
},
|
|
554
|
+
ro: {
|
|
555
|
+
ticket: 'Bilet',
|
|
556
|
+
},
|
|
557
|
+
};
|
|
558
|
+
const translate = (key, customLang) => {
|
|
559
|
+
const lang = customLang;
|
|
560
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
561
|
+
};
|
|
562
|
+
|
|
448
563
|
const lotteryTicketControllerCss = ":host{display:block}";
|
|
449
564
|
|
|
450
565
|
const LotteryTicketController = class {
|
|
@@ -491,6 +606,27 @@ const LotteryTicketController = class {
|
|
|
491
606
|
* Shows the reset button
|
|
492
607
|
*/
|
|
493
608
|
this.resetButton = false;
|
|
609
|
+
/**
|
|
610
|
+
* Client custom styling via string
|
|
611
|
+
*/
|
|
612
|
+
this.clientStyling = '';
|
|
613
|
+
/**
|
|
614
|
+
* Client custom styling via url content
|
|
615
|
+
*/
|
|
616
|
+
this.clientStylingUrlContent = '';
|
|
617
|
+
this.limitStylingAppends = false;
|
|
618
|
+
this.setClientStyling = () => {
|
|
619
|
+
let sheet = document.createElement('style');
|
|
620
|
+
sheet.innerHTML = this.clientStyling;
|
|
621
|
+
this.stylingContainer.prepend(sheet);
|
|
622
|
+
};
|
|
623
|
+
this.setClientStylingURL = () => {
|
|
624
|
+
let cssFile = document.createElement('style');
|
|
625
|
+
setTimeout(() => {
|
|
626
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
627
|
+
this.stylingContainer.prepend(cssFile);
|
|
628
|
+
}, 1);
|
|
629
|
+
};
|
|
494
630
|
}
|
|
495
631
|
// @TODO fix the `any` type
|
|
496
632
|
helperAccordionActionHandler() {
|
|
@@ -501,8 +637,19 @@ const LotteryTicketController = class {
|
|
|
501
637
|
ticketId: this.ticketId
|
|
502
638
|
});
|
|
503
639
|
}
|
|
640
|
+
componentDidRender() {
|
|
641
|
+
// start custom styling area
|
|
642
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
643
|
+
if (this.clientStyling)
|
|
644
|
+
this.setClientStyling();
|
|
645
|
+
if (this.clientStylingUrlContent)
|
|
646
|
+
this.setClientStylingURL();
|
|
647
|
+
this.limitStylingAppends = true;
|
|
648
|
+
}
|
|
649
|
+
// end custom styling area
|
|
650
|
+
}
|
|
504
651
|
render() {
|
|
505
|
-
return (index.h("div",
|
|
652
|
+
return (index.h("div", { class: "LotteryTicketControllerContainer", ref: el => this.stylingContainer = el }, index.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 }, index.h("div", { slot: "accordionContent" }, index.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 })))));
|
|
506
653
|
}
|
|
507
654
|
};
|
|
508
655
|
LotteryTicketController.style = lotteryTicketControllerCss;
|
|
@@ -270,6 +270,12 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
270
270
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
271
271
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
272
272
|
}
|
|
273
|
+
else if (memberName === 'ref') {
|
|
274
|
+
// minifier will clean this up
|
|
275
|
+
if (newValue) {
|
|
276
|
+
newValue(elm);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
273
279
|
else if ((!isProp ) &&
|
|
274
280
|
memberName[0] === 'o' &&
|
|
275
281
|
memberName[1] === 'n') {
|
|
@@ -426,6 +432,7 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
426
432
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
427
433
|
if ((vnode = vnodes[startIdx])) {
|
|
428
434
|
elm = vnode.$elm$;
|
|
435
|
+
callNodeRefs(vnode);
|
|
429
436
|
// remove the vnode's element from the dom
|
|
430
437
|
elm.remove();
|
|
431
438
|
}
|
|
@@ -547,6 +554,12 @@ const patch = (oldVNode, newVNode) => {
|
|
|
547
554
|
elm.data = text;
|
|
548
555
|
}
|
|
549
556
|
};
|
|
557
|
+
const callNodeRefs = (vNode) => {
|
|
558
|
+
{
|
|
559
|
+
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
560
|
+
vNode.$children$ && vNode.$children$.map(callNodeRefs);
|
|
561
|
+
}
|
|
562
|
+
};
|
|
550
563
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
551
564
|
const hostElm = hostRef.$hostElement$;
|
|
552
565
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
@@ -688,7 +701,11 @@ const postUpdateComponent = (hostRef) => {
|
|
|
688
701
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
689
702
|
const elm = hostRef.$hostElement$;
|
|
690
703
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
704
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
691
705
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
706
|
+
{
|
|
707
|
+
safeCall(instance, 'componentDidRender');
|
|
708
|
+
}
|
|
692
709
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
693
710
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
694
711
|
{
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-dd94b8db.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["helper-accordion_5.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[1,"lottery-ticket",{"endpoint":[1],"gameId":[1,"game-id"],"numberOfGrids":[2,"number-of-grids"],"multipleDraws":[4,"multiple-draws"],"ticketId":[2,"ticket-id"],"resetButton":[4,"reset-button"],"autoPick":[4,"auto-pick"],"language":[1],"multiplier":[32],"numberOfDraws":[32],"isLoading":[32],"hasErrors":[32],"ticketDone":[32],"isCustomSelect":[32],"amountInfo":[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]],[1,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"showContent":[32]}],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"numbers":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"]}]]]], options);
|
|
17
|
+
return index.bootstrapLazy([["helper-accordion_5.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[1,"lottery-ticket",{"endpoint":[1],"gameId":[1,"game-id"],"numberOfGrids":[2,"number-of-grids"],"multipleDraws":[4,"multiple-draws"],"ticketId":[2,"ticket-id"],"resetButton":[4,"reset-button"],"autoPick":[4,"auto-pick"],"language":[1],"multiplier":[32],"numberOfDraws":[32],"isLoading":[32],"hasErrors":[32],"ticketDone":[32],"isCustomSelect":[32],"amountInfo":[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]],[1,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"showContent":[32],"limitStylingAppends":[32]}],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"gridType":[1,"grid-type"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-dd94b8db.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["helper-accordion_5.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[1,"lottery-ticket",{"endpoint":[1],"gameId":[1,"game-id"],"numberOfGrids":[2,"number-of-grids"],"multipleDraws":[4,"multiple-draws"],"ticketId":[2,"ticket-id"],"resetButton":[4,"reset-button"],"autoPick":[4,"auto-pick"],"language":[1],"multiplier":[32],"numberOfDraws":[32],"isLoading":[32],"hasErrors":[32],"ticketDone":[32],"isCustomSelect":[32],"amountInfo":[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]],[1,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"showContent":[32]}],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"numbers":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"]}]]]], options);
|
|
18
|
+
return index.bootstrapLazy([["helper-accordion_5.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[1,"lottery-ticket",{"endpoint":[1],"gameId":[1,"game-id"],"numberOfGrids":[2,"number-of-grids"],"multipleDraws":[4,"multiple-draws"],"ticketId":[2,"ticket-id"],"resetButton":[4,"reset-button"],"autoPick":[4,"auto-pick"],"language":[1],"multiplier":[32],"numberOfDraws":[32],"isLoading":[32],"hasErrors":[32],"ticketDone":[32],"isCustomSelect":[32],"amountInfo":[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]],[1,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"showContent":[32],"limitStylingAppends":[32]}],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"gridType":[1,"grid-type"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
|
|
19
19
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Component, h, Listen, Prop, Event } from '@stencil/core';
|
|
1
|
+
import { Component, h, Listen, Prop, Event, State } from '@stencil/core';
|
|
2
2
|
import '@everymatrix/helper-accordion';
|
|
3
3
|
import '@everymatrix/lottery-ticket';
|
|
4
|
+
import { translate } from '../../utils/locale.utils';
|
|
4
5
|
export class LotteryTicketController {
|
|
5
6
|
constructor() {
|
|
6
7
|
/**
|
|
@@ -43,6 +44,27 @@ export class LotteryTicketController {
|
|
|
43
44
|
* Shows the reset button
|
|
44
45
|
*/
|
|
45
46
|
this.resetButton = false;
|
|
47
|
+
/**
|
|
48
|
+
* Client custom styling via string
|
|
49
|
+
*/
|
|
50
|
+
this.clientStyling = '';
|
|
51
|
+
/**
|
|
52
|
+
* Client custom styling via url content
|
|
53
|
+
*/
|
|
54
|
+
this.clientStylingUrlContent = '';
|
|
55
|
+
this.limitStylingAppends = false;
|
|
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
|
+
};
|
|
46
68
|
}
|
|
47
69
|
// @TODO fix the `any` type
|
|
48
70
|
helperAccordionActionHandler() {
|
|
@@ -53,11 +75,22 @@ export class LotteryTicketController {
|
|
|
53
75
|
ticketId: this.ticketId
|
|
54
76
|
});
|
|
55
77
|
}
|
|
78
|
+
componentDidRender() {
|
|
79
|
+
// start custom styling area
|
|
80
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
81
|
+
if (this.clientStyling)
|
|
82
|
+
this.setClientStyling();
|
|
83
|
+
if (this.clientStylingUrlContent)
|
|
84
|
+
this.setClientStylingURL();
|
|
85
|
+
this.limitStylingAppends = true;
|
|
86
|
+
}
|
|
87
|
+
// end custom styling area
|
|
88
|
+
}
|
|
56
89
|
render() {
|
|
57
|
-
return (h("div",
|
|
58
|
-
h("helper-accordion", { "header-title": '
|
|
90
|
+
return (h("div", { class: "LotteryTicketControllerContainer", ref: el => this.stylingContainer = el },
|
|
91
|
+
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 },
|
|
59
92
|
h("div", { slot: "accordionContent" },
|
|
60
|
-
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 })))));
|
|
93
|
+
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 })))));
|
|
61
94
|
}
|
|
62
95
|
static get is() { return "lottery-ticket-controller"; }
|
|
63
96
|
static get encapsulation() { return "shadow"; }
|
|
@@ -281,8 +314,47 @@ export class LotteryTicketController {
|
|
|
281
314
|
"attribute": "reset-button",
|
|
282
315
|
"reflect": false,
|
|
283
316
|
"defaultValue": "false"
|
|
317
|
+
},
|
|
318
|
+
"clientStyling": {
|
|
319
|
+
"type": "string",
|
|
320
|
+
"mutable": false,
|
|
321
|
+
"complexType": {
|
|
322
|
+
"original": "string",
|
|
323
|
+
"resolved": "string",
|
|
324
|
+
"references": {}
|
|
325
|
+
},
|
|
326
|
+
"required": false,
|
|
327
|
+
"optional": false,
|
|
328
|
+
"docs": {
|
|
329
|
+
"tags": [],
|
|
330
|
+
"text": "Client custom styling via string"
|
|
331
|
+
},
|
|
332
|
+
"attribute": "client-styling",
|
|
333
|
+
"reflect": false,
|
|
334
|
+
"defaultValue": "''"
|
|
335
|
+
},
|
|
336
|
+
"clientStylingUrlContent": {
|
|
337
|
+
"type": "string",
|
|
338
|
+
"mutable": false,
|
|
339
|
+
"complexType": {
|
|
340
|
+
"original": "string",
|
|
341
|
+
"resolved": "string",
|
|
342
|
+
"references": {}
|
|
343
|
+
},
|
|
344
|
+
"required": false,
|
|
345
|
+
"optional": false,
|
|
346
|
+
"docs": {
|
|
347
|
+
"tags": [],
|
|
348
|
+
"text": "Client custom styling via url content"
|
|
349
|
+
},
|
|
350
|
+
"attribute": "client-styling-url-content",
|
|
351
|
+
"reflect": false,
|
|
352
|
+
"defaultValue": "''"
|
|
284
353
|
}
|
|
285
354
|
}; }
|
|
355
|
+
static get states() { return {
|
|
356
|
+
"limitStylingAppends": {}
|
|
357
|
+
}; }
|
|
286
358
|
static get events() { return [{
|
|
287
359
|
"method": "deleteTicketEvent",
|
|
288
360
|
"name": "deleteTicket",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
3
|
+
const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
ticket: 'Ticket',
|
|
6
|
+
},
|
|
7
|
+
ro: {
|
|
8
|
+
ticket: 'Bilet',
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export const translate = (key, customLang) => {
|
|
12
|
+
const lang = customLang;
|
|
13
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
14
|
+
};
|
|
@@ -15,7 +15,7 @@ const translate = (key, customLang) => {
|
|
|
15
15
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
16
16
|
};
|
|
17
17
|
|
|
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:
|
|
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: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
19
|
|
|
20
20
|
const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
21
21
|
constructor() {
|
|
@@ -63,11 +63,43 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
63
63
|
* Language
|
|
64
64
|
*/
|
|
65
65
|
this.language = 'en';
|
|
66
|
+
/**
|
|
67
|
+
* Client custom styling via string
|
|
68
|
+
*/
|
|
69
|
+
this.clientStyling = '';
|
|
70
|
+
/**
|
|
71
|
+
* Client custom styling via url content
|
|
72
|
+
*/
|
|
73
|
+
this.clientStylingUrlContent = '';
|
|
74
|
+
this.limitStylingAppends = false;
|
|
75
|
+
this.setClientStyling = () => {
|
|
76
|
+
let sheet = document.createElement('style');
|
|
77
|
+
sheet.innerHTML = this.clientStyling;
|
|
78
|
+
this.stylingContainer.prepend(sheet);
|
|
79
|
+
};
|
|
80
|
+
this.setClientStylingURL = () => {
|
|
81
|
+
let cssFile = document.createElement('style');
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
84
|
+
this.stylingContainer.prepend(cssFile);
|
|
85
|
+
}, 1);
|
|
86
|
+
};
|
|
66
87
|
}
|
|
67
88
|
// @TODO fix the `any` type :)
|
|
68
89
|
connectedCallback() {
|
|
69
90
|
this.showContent = !this.collapsed;
|
|
70
91
|
}
|
|
92
|
+
componentDidRender() {
|
|
93
|
+
// start custom styling area
|
|
94
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
95
|
+
if (this.clientStyling)
|
|
96
|
+
this.setClientStyling();
|
|
97
|
+
if (this.clientStylingUrlContent)
|
|
98
|
+
this.setClientStylingURL();
|
|
99
|
+
this.limitStylingAppends = true;
|
|
100
|
+
}
|
|
101
|
+
// end custom styling area
|
|
102
|
+
}
|
|
71
103
|
toggleContent() {
|
|
72
104
|
this.showContent = !this.showContent;
|
|
73
105
|
}
|
|
@@ -79,7 +111,7 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
79
111
|
this.accordionEvent.emit();
|
|
80
112
|
}
|
|
81
113
|
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 &&
|
|
114
|
+
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
115
|
h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
|
|
84
116
|
h("div", null, this.deleteTab &&
|
|
85
117
|
h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
|
|
@@ -96,7 +128,10 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
96
128
|
"eventName": [1, "event-name"],
|
|
97
129
|
"collapsed": [4],
|
|
98
130
|
"language": [1],
|
|
99
|
-
"
|
|
131
|
+
"clientStyling": [1, "client-styling"],
|
|
132
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
133
|
+
"showContent": [32],
|
|
134
|
+
"limitStylingAppends": [32]
|
|
100
135
|
}]);
|
|
101
136
|
function defineCustomElement() {
|
|
102
137
|
if (typeof customElements === "undefined") {
|