@everymatrix/lottery-draw-results 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/{index-62f030ff.js → index-43800d3c.js} +17 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/lottery-bullet_3.cjs.entry.js +214 -17
- package/dist/cjs/lottery-draw-results.cjs.js +2 -2
- package/dist/collection/components/lottery-draw-results/lottery-draw-results.css +36 -13
- package/dist/collection/components/lottery-draw-results/lottery-draw-results.js +261 -100
- package/dist/collection/utils/locale.utils.js +38 -4
- package/dist/components/lottery-bullet2.js +37 -2
- package/dist/components/lottery-draw-results.js +152 -15
- package/dist/components/lottery-grid2.js +43 -3
- package/dist/esm/{index-98326ddd.js → index-9547eb6c.js} +17 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/lottery-bullet_3.entry.js +214 -17
- package/dist/esm/lottery-draw-results.js +2 -2
- package/dist/lottery-draw-results/lottery-draw-results.esm.js +1 -1
- package/dist/lottery-draw-results/p-ca51c2b4.entry.js +1 -0
- package/dist/lottery-draw-results/p-e1cb3144.js +1 -0
- package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/stencil/widgets-stencil/packages/lottery-draw-results/.stencil/packages/lottery-draw-results/stencil.config.d.ts +2 -0
- package/dist/types/components/lottery-draw-results/lottery-draw-results.d.ts +27 -3
- package/dist/types/components.d.ts +32 -0
- package/package.json +4 -1
- package/dist/lottery-draw-results/p-bb429486.js +0 -1
- package/dist/lottery-draw-results/p-d653e278.entry.js +0 -1
- package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/lottery-draw-results/.stencil/packages/lottery-draw-results/stencil.config.d.ts +0 -2
|
@@ -10,8 +10,8 @@ const TRANSLATIONS = {
|
|
|
10
10
|
drawId: 'Draw ID',
|
|
11
11
|
drawName: 'Game name',
|
|
12
12
|
drawDate: 'Draw Date',
|
|
13
|
-
drawNumbersGridDraw: 'Draw numbers Grid
|
|
14
|
-
drawNumbersGridTicket: 'Draw numbers Grid
|
|
13
|
+
drawNumbersGridDraw: 'Draw numbers Grid ',
|
|
14
|
+
drawNumbersGridTicket: 'Draw numbers Grid ',
|
|
15
15
|
ticketResult: 'Ticket result',
|
|
16
16
|
amountWon: 'Amount won',
|
|
17
17
|
numberOfDraws: 'Number of draws',
|
|
@@ -27,8 +27,8 @@ const TRANSLATIONS = {
|
|
|
27
27
|
drawId: 'Id extragere',
|
|
28
28
|
drawName: 'Numele jocului',
|
|
29
29
|
drawDate: 'Data extragerii',
|
|
30
|
-
drawNumbersGridDraw: 'Numerele extrase Grid
|
|
31
|
-
drawNumbersGridTicket: 'Numerele extrase Grid
|
|
30
|
+
drawNumbersGridDraw: 'Numerele extrase Grid',
|
|
31
|
+
drawNumbersGridTicket: 'Numerele extrase Grid',
|
|
32
32
|
ticketResult: 'Rezultatul biletului',
|
|
33
33
|
amountWon: 'Suma castigata',
|
|
34
34
|
numberOfDraws: 'Numarul de extrageri',
|
|
@@ -39,13 +39,47 @@ const TRANSLATIONS = {
|
|
|
39
39
|
ticketAmount: 'Valoarea biletului',
|
|
40
40
|
winUpTo: 'Poti castiga'
|
|
41
41
|
},
|
|
42
|
+
fr: {
|
|
43
|
+
drawResultsHeader: 'Résultats du dernier tirage',
|
|
44
|
+
drawId: 'ID de tirage',
|
|
45
|
+
drawName: 'Nom du jeu',
|
|
46
|
+
drawDate: 'Date du tirage',
|
|
47
|
+
drawNumbersGridDraw: 'Tirage des numéros Grille',
|
|
48
|
+
drawNumbersGridTicket: 'Tirage des numéros Grille',
|
|
49
|
+
ticketResult: 'Résultat du ticket',
|
|
50
|
+
amountWon: 'Montant gagné',
|
|
51
|
+
numberOfDraws: 'Nombre de tirages',
|
|
52
|
+
multiplier: 'Multiplicateur',
|
|
53
|
+
ticketPurchaseDate: 'Date d\'achat du billet',
|
|
54
|
+
ticketStatus: 'Statut du ticket',
|
|
55
|
+
ticketId: 'ID de billets',
|
|
56
|
+
ticketAmount: 'Montant du billet',
|
|
57
|
+
winUpTo: 'Gagnez jusqu\'à'
|
|
58
|
+
},
|
|
59
|
+
ar: {
|
|
60
|
+
drawResultsHeader: 'نتائج آخر سحب',
|
|
61
|
+
drawId: 'معرّف السحب',
|
|
62
|
+
drawName: 'اسم اللعبة',
|
|
63
|
+
drawDate: 'تاريخ السحب',
|
|
64
|
+
drawNumbersGridDraw: 'شبكة أرقام السحب',
|
|
65
|
+
drawNumbersGridTicket: 'شبكة أرقام السحب',
|
|
66
|
+
ticketResult: 'نتيجة التذكرة',
|
|
67
|
+
amountWon: 'المبلغ الذي تم ربحه',
|
|
68
|
+
numberOfDraws: 'عدد السحوبات',
|
|
69
|
+
multiplier: 'مضاعف',
|
|
70
|
+
ticketPurchaseDate: 'تاريخ شراء التذكرة',
|
|
71
|
+
ticketStatus: 'حالة التذكرة',
|
|
72
|
+
ticketId: 'معرّف التذكرة',
|
|
73
|
+
ticketAmount: 'مبلغ التذكرة',
|
|
74
|
+
winUpTo: 'ربح يصل إلى'
|
|
75
|
+
}
|
|
42
76
|
};
|
|
43
77
|
const translate = (key, customLang) => {
|
|
44
78
|
const lang = customLang;
|
|
45
79
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
46
80
|
};
|
|
47
81
|
|
|
48
|
-
const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsArea{margin-top:15px}.DrawResultsSection{max-width:600px;margin:0px auto;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px;border-radius:4px 4px 0 0}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0;padding-top:15px}.
|
|
82
|
+
const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsArea{margin-top:15px}.DrawResultsArea.TicketDraws .Content{padding:0;border:0}.DrawResultsArea.TicketDraws .DrawResultsBody{padding:0;margin-bottom:5px;border-radius:0;border:0}.DrawResultsSection{max-width:600px;margin:0px auto;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px;border-radius:4px 4px 0 0}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0;padding-top:15px}.DrawResultsBody{padding:20px;margin-bottom:5px;border-radius:0 0 4px 4px;border:1px solid #009993}.DrawResultsBody>div{margin:10px 0}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.DrawNumbersGrid{margin-bottom:15px}.DrawNumbersGrid label{display:block;margin-bottom:10px}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;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%, #eee 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:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{position:relative}.DrawTicketsContainer{display:flex;flex-direction:column;margin:20px auto 0}.DrawMultipler{margin-top:15px}.ExpandableBoxes{position:relative;display:flex;flex-direction:column}.ExpandableBox{line-height:12px;font-weight:lighter;width:100%;height:100%;max-height:80px;float:left;margin:0 0 20px 0;border:1px solid #009993;background:#fff;border-radius:4px;padding:10px;box-sizing:border-box;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden;box-shadow:rgba(99, 99, 99, 0.2) 0px 2px 8px 0px}.ExpandableBox:last-of-type{margin-bottom:0}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}";
|
|
49
83
|
|
|
50
84
|
const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
51
85
|
constructor() {
|
|
@@ -92,13 +126,75 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
92
126
|
* The ticket draw count
|
|
93
127
|
*/
|
|
94
128
|
this.ticketDrawCount = 0;
|
|
129
|
+
/**
|
|
130
|
+
* The ticket winning numbers
|
|
131
|
+
*/
|
|
132
|
+
this.ticketNumbers = '';
|
|
133
|
+
/**
|
|
134
|
+
* The session id
|
|
135
|
+
*/
|
|
136
|
+
this.sessionId = '';
|
|
137
|
+
/**
|
|
138
|
+
* Client custom styling via string
|
|
139
|
+
*/
|
|
140
|
+
this.clientStyling = '';
|
|
141
|
+
/**
|
|
142
|
+
* Client custom styling via url content
|
|
143
|
+
*/
|
|
144
|
+
this.clientStylingUrlContent = '';
|
|
95
145
|
this.multiplier = 3;
|
|
96
146
|
this.isLoading = true;
|
|
97
|
-
this.drawResults = [];
|
|
98
147
|
this.rules = {};
|
|
99
148
|
this.toggleDrawer = [false];
|
|
100
149
|
this.hasErrors = false;
|
|
101
150
|
this.errorText = '';
|
|
151
|
+
this.ticketData = [];
|
|
152
|
+
this.ticketDataLoaded = false;
|
|
153
|
+
this.ticketDraws = [];
|
|
154
|
+
this.hasDrawNumbers = false;
|
|
155
|
+
this.limitStylingAppends = false;
|
|
156
|
+
this.getTicketsData = () => {
|
|
157
|
+
let url = new URL(`${this.endpoint}/tickets`);
|
|
158
|
+
let drawOptions = {
|
|
159
|
+
method: "GET",
|
|
160
|
+
headers: {
|
|
161
|
+
'Content-Type': "application/json",
|
|
162
|
+
'Accept': 'application/json',
|
|
163
|
+
'Authorization': `Bearer ${this.sessionId}`
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
fetch(url.href, drawOptions)
|
|
167
|
+
.then((response) => {
|
|
168
|
+
return response.json();
|
|
169
|
+
})
|
|
170
|
+
.then((data) => {
|
|
171
|
+
if (data) {
|
|
172
|
+
this.ticketData = data;
|
|
173
|
+
this.ticketDataLoaded = true;
|
|
174
|
+
}
|
|
175
|
+
return this.ticketData;
|
|
176
|
+
}).then((response) => {
|
|
177
|
+
response.forEach(ticket => {
|
|
178
|
+
if (ticket.drawResults.length) {
|
|
179
|
+
ticket.drawResults.forEach(draw => {
|
|
180
|
+
fetch(`${this.endpoint}/games/${this.gameId}/draws/${draw.drawId}`)
|
|
181
|
+
.then((response) => {
|
|
182
|
+
return response.json();
|
|
183
|
+
})
|
|
184
|
+
.then((data) => {
|
|
185
|
+
// check if draw id is unique
|
|
186
|
+
if (!this.ticketDraws.some(el => el.drawId === draw.drawId)) {
|
|
187
|
+
this.ticketDraws.push({ drawId: draw.drawId, drawNumbers: data.winningNumbers });
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return this.ticketDraws;
|
|
193
|
+
});
|
|
194
|
+
}).then(() => {
|
|
195
|
+
this.hasDrawNumbers = true;
|
|
196
|
+
});
|
|
197
|
+
};
|
|
102
198
|
this.changeBox = (index) => {
|
|
103
199
|
this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
|
|
104
200
|
if (itemIndex == index) {
|
|
@@ -110,6 +206,18 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
110
206
|
this.toggleDrawer.push(true);
|
|
111
207
|
}
|
|
112
208
|
};
|
|
209
|
+
this.setClientStyling = () => {
|
|
210
|
+
let sheet = document.createElement('style');
|
|
211
|
+
sheet.innerHTML = this.clientStyling;
|
|
212
|
+
this.stylingContainer.prepend(sheet);
|
|
213
|
+
};
|
|
214
|
+
this.setClientStylingURL = () => {
|
|
215
|
+
let cssFile = document.createElement('style');
|
|
216
|
+
setTimeout(() => {
|
|
217
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
218
|
+
this.stylingContainer.prepend(cssFile);
|
|
219
|
+
}, 1);
|
|
220
|
+
};
|
|
113
221
|
}
|
|
114
222
|
connectedCallback() {
|
|
115
223
|
let promises = [];
|
|
@@ -117,14 +225,28 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
117
225
|
if (this.drawId) {
|
|
118
226
|
promises.push(this.getDrawData());
|
|
119
227
|
}
|
|
228
|
+
if (!this.drawMode) {
|
|
229
|
+
this.getTicketsData();
|
|
230
|
+
}
|
|
120
231
|
Promise.all(promises)
|
|
121
232
|
.then(() => {
|
|
122
233
|
this.isLoading = false;
|
|
123
234
|
});
|
|
124
235
|
}
|
|
125
|
-
|
|
236
|
+
componentDidRender() {
|
|
237
|
+
// start custom styling area
|
|
238
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
239
|
+
if (this.clientStyling)
|
|
240
|
+
this.setClientStyling();
|
|
241
|
+
if (this.clientStylingUrlContent)
|
|
242
|
+
this.setClientStylingURL();
|
|
243
|
+
this.limitStylingAppends = true;
|
|
244
|
+
}
|
|
245
|
+
// end custom styling area
|
|
246
|
+
}
|
|
247
|
+
getDrawData(drawID) {
|
|
126
248
|
return new Promise((resolve, reject) => {
|
|
127
|
-
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);
|
|
249
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${drawID ? drawID : this.drawId}`);
|
|
128
250
|
fetch(url.href)
|
|
129
251
|
.then((response) => {
|
|
130
252
|
// @TODO EXCEPTIONS
|
|
@@ -134,6 +256,9 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
134
256
|
this.drawData = data;
|
|
135
257
|
resolve(true);
|
|
136
258
|
this.isLoading = false;
|
|
259
|
+
if (drawID) {
|
|
260
|
+
return this.drawData.winningNumbers;
|
|
261
|
+
}
|
|
137
262
|
})
|
|
138
263
|
.catch((err) => {
|
|
139
264
|
reject(err);
|
|
@@ -173,12 +298,16 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
173
298
|
h("p", null, this.errorText);
|
|
174
299
|
}
|
|
175
300
|
else {
|
|
176
|
-
return (h("section", { class: "DrawResultsSection" },
|
|
177
|
-
h("div", { class: "DrawResultsArea" },
|
|
178
|
-
h("div", { class: "
|
|
301
|
+
return (h("section", { class: "DrawResultsSection", ref: el => this.stylingContainer = el }, this.drawMode ?
|
|
302
|
+
h("div", { class: "DrawResultsArea" }, this.drawData &&
|
|
303
|
+
h("div", null, h("div", { class: "DrawResultsHeader" }, h("span", null, translate('drawId', this.language), ": ", this.drawData.id), h("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), h("div", { class: "DrawResultsBody" }, h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridDraw', this.language), "0:"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('multiplier', this.language), " ", this.multiplier))))))
|
|
179
304
|
:
|
|
180
|
-
h("div", { class: "DrawResultsArea" }, this.
|
|
181
|
-
h("div", null,
|
|
305
|
+
h("div", { class: "DrawResultsArea TicketDraws" }, h("div", { class: "DrawResultsBody" }, h("div", { class: "TicketIdContainer" }, h("label", { class: "Label" }, translate('ticketId', this.language), ": ", h("span", null, this.ticketId))), h("div", { class: "TicketAmountContainer" }, h("label", { class: "Label" }, translate('ticketAmount', this.language), " ", h("span", null, this.ticketAmount))), h("div", { class: "DrawNumbersGrid" }, h("label", { class: "Label" }, translate('drawNumbersGridTicket', this.language), "0:"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": JSON.parse(this.ticketNumbers).join(','), selectable: false, "display-selected": true, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('multiplier', this.language), " ", JSON.stringify(this.ticketMultiplier))), h("div", { class: "NumberOfDrawsContainer" }, h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": ", this.ticketDrawCount), h("div", { class: "DrawTicketsContainer" }, this.ticketData.map((ticket) => h("div", { class: "ExpandableBoxes" }, ticket.drawResults.length ?
|
|
306
|
+
h("div", null, ticket.id == this.ticketId && ticket.drawResults.map((item, index) => h("div", { class: this.toggleDrawer[index] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index) }, h("div", { class: "TicketResultContainer" }, h("p", null, translate('ticketResult', this.language), ": ", item.state)), item.state == 'won' &&
|
|
307
|
+
h("div", { class: "AmountWonContainer" }, h("p", null, translate('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), h("div", { class: "DrawIdContainer" }, h("p", null, translate('drawId', this.language), ": ", item.drawId)), h("div", { class: "DrawDateContainer" }, h("p", null, translate('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), h("div", { class: "DrawNumbersGrid" }, this.hasDrawNumbers && this.ticketDraws.map((ticketDraw) => item.drawId && item.drawId === ticketDraw.drawId &&
|
|
308
|
+
h("div", null, h("label", { class: "Label" }, translate('drawNumbersGridDraw', this.language), "A:"), h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": ticketDraw.drawNumbers.join(','), selectable: false, "display-selected": true, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })))), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('multiplier', this.language), " ", item.multiplier)))))
|
|
309
|
+
:
|
|
310
|
+
h("span", null)))))))));
|
|
182
311
|
}
|
|
183
312
|
}
|
|
184
313
|
static get style() { return lotteryDrawResultsCss; }
|
|
@@ -196,13 +325,21 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
196
325
|
"ticketAmount": [1, "ticket-amount"],
|
|
197
326
|
"ticketMultiplier": [4, "ticket-multiplier"],
|
|
198
327
|
"ticketDrawCount": [2, "ticket-draw-count"],
|
|
328
|
+
"ticketNumbers": [1, "ticket-numbers"],
|
|
329
|
+
"sessionId": [1, "session-id"],
|
|
330
|
+
"clientStyling": [1, "client-styling"],
|
|
331
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
199
332
|
"multiplier": [32],
|
|
200
333
|
"isLoading": [32],
|
|
201
|
-
"drawResults": [32],
|
|
202
334
|
"rules": [32],
|
|
203
335
|
"toggleDrawer": [32],
|
|
204
336
|
"hasErrors": [32],
|
|
205
|
-
"errorText": [32]
|
|
337
|
+
"errorText": [32],
|
|
338
|
+
"ticketData": [32],
|
|
339
|
+
"ticketDataLoaded": [32],
|
|
340
|
+
"ticketDraws": [32],
|
|
341
|
+
"hasDrawNumbers": [32],
|
|
342
|
+
"limitStylingAppends": [32]
|
|
206
343
|
}]);
|
|
207
344
|
function defineCustomElement$1() {
|
|
208
345
|
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") {
|
|
@@ -246,6 +246,12 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
246
246
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
247
247
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
248
248
|
}
|
|
249
|
+
else if (memberName === 'ref') {
|
|
250
|
+
// minifier will clean this up
|
|
251
|
+
if (newValue) {
|
|
252
|
+
newValue(elm);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
249
255
|
else if ((!isProp ) &&
|
|
250
256
|
memberName[0] === 'o' &&
|
|
251
257
|
memberName[1] === 'n') {
|
|
@@ -402,6 +408,7 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
402
408
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
403
409
|
if ((vnode = vnodes[startIdx])) {
|
|
404
410
|
elm = vnode.$elm$;
|
|
411
|
+
callNodeRefs(vnode);
|
|
405
412
|
// remove the vnode's element from the dom
|
|
406
413
|
elm.remove();
|
|
407
414
|
}
|
|
@@ -520,6 +527,12 @@ const patch = (oldVNode, newVNode) => {
|
|
|
520
527
|
elm.data = text;
|
|
521
528
|
}
|
|
522
529
|
};
|
|
530
|
+
const callNodeRefs = (vNode) => {
|
|
531
|
+
{
|
|
532
|
+
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
533
|
+
vNode.$children$ && vNode.$children$.map(callNodeRefs);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
523
536
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
524
537
|
const hostElm = hostRef.$hostElement$;
|
|
525
538
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
@@ -661,7 +674,11 @@ const postUpdateComponent = (hostRef) => {
|
|
|
661
674
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
662
675
|
const elm = hostRef.$hostElement$;
|
|
663
676
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
677
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
664
678
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
679
|
+
{
|
|
680
|
+
safeCall(instance, 'componentDidRender');
|
|
681
|
+
}
|
|
665
682
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
666
683
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
667
684
|
{
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-9547eb6c.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["lottery-bullet_3",[[1,"lottery-draw-results",{"endpoint":[1],"gameId":[1,"game-id"],"language":[1],"playerId":[1,"player-id"],"drawMode":[4,"draw-mode"],"drawId":[1,"draw-id"],"gameName":[1,"game-name"],"ticketDate":[1,"ticket-date"],"ticketStatus":[1,"ticket-status"],"ticketId":[1,"ticket-id"],"ticketAmount":[1,"ticket-amount"],"ticketMultiplier":[4,"ticket-multiplier"],"ticketDrawCount":[2,"ticket-draw-count"],"
|
|
13
|
+
return bootstrapLazy([["lottery-bullet_3",[[1,"lottery-draw-results",{"endpoint":[1],"gameId":[1,"game-id"],"language":[1],"playerId":[1,"player-id"],"drawMode":[4,"draw-mode"],"drawId":[1,"draw-id"],"gameName":[1,"game-name"],"ticketDate":[1,"ticket-date"],"ticketStatus":[1,"ticket-status"],"ticketId":[1,"ticket-id"],"ticketAmount":[1,"ticket-amount"],"ticketMultiplier":[4,"ticket-multiplier"],"ticketDrawCount":[2,"ticket-draw-count"],"ticketNumbers":[1,"ticket-numbers"],"sessionId":[1,"session-id"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"multiplier":[32],"isLoading":[32],"rules":[32],"toggleDrawer":[32],"hasErrors":[32],"errorText":[32],"ticketData":[32],"ticketDataLoaded":[32],"ticketDraws":[32],"hasDrawNumbers":[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);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|