@everymatrix/lottery-game-page 0.1.1 → 0.1.2
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.cjs.entry.js +88 -0
- package/dist/cjs/helper-filters_2.cjs.entry.js +22490 -0
- package/dist/cjs/helper-modal.cjs.entry.js +1 -1
- package/dist/cjs/helper-pagination.cjs.entry.js +188 -0
- package/dist/cjs/helper-tab.cjs.entry.js +33 -0
- package/dist/cjs/helper-tabs.cjs.entry.js +38 -0
- package/dist/cjs/{index-614098f4.js → index-e5770ba2.js} +41 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/lottery-bullet_2.cjs.entry.js +202 -0
- package/dist/cjs/lottery-draw-results-history.cjs.entry.js +124 -0
- package/dist/cjs/lottery-game-details.cjs.entry.js +19 -0
- package/dist/cjs/lottery-game-page.cjs.entry.js +13 -53
- package/dist/cjs/lottery-game-page.cjs.js +2 -2
- package/dist/cjs/lottery-ticket-controller.cjs.entry.js +69 -0
- package/dist/cjs/lottery-ticket.cjs.entry.js +146 -0
- package/dist/collection/collection-manifest.json +61 -0
- package/dist/collection/components/lottery-game-page/lottery-game-page.css +7 -27
- package/dist/collection/components/lottery-game-page/lottery-game-page.js +5 -22
- package/dist/collection/utils/locale.utils.js +6 -33
- package/dist/components/helper-accordion.js +6 -0
- package/dist/components/helper-accordion2.js +111 -0
- package/dist/components/helper-filters.js +6 -0
- package/dist/components/helper-filters2.js +22348 -0
- package/dist/components/helper-pagination.js +216 -0
- package/dist/components/helper-tab.js +6 -0
- package/dist/components/helper-tab2.js +48 -0
- package/dist/components/helper-tabs.js +6 -0
- package/dist/components/helper-tabs2.js +63 -0
- package/dist/components/lottery-bullet.js +6 -0
- package/dist/components/lottery-bullet2.js +57 -0
- package/dist/components/lottery-draw-results-history.js +6 -0
- package/dist/components/lottery-draw-results-history2.js +175 -0
- package/dist/components/lottery-draw-results2.js +59 -62
- package/dist/components/lottery-game-details.js +6 -0
- package/dist/components/lottery-game-details2.js +49 -0
- package/dist/components/lottery-game-page.js +77 -59
- package/dist/components/lottery-grid.js +6 -0
- package/dist/components/lottery-grid2.js +197 -0
- package/dist/components/lottery-ticket-controller.js +6 -0
- package/dist/components/lottery-ticket-controller2.js +118 -0
- package/dist/components/lottery-ticket.js +6 -0
- package/dist/components/lottery-ticket2.js +184 -0
- package/dist/esm/helper-accordion.entry.js +84 -0
- package/dist/esm/helper-filters_2.entry.js +22485 -0
- package/dist/esm/helper-modal.entry.js +1 -1
- package/dist/esm/helper-pagination.entry.js +184 -0
- package/dist/esm/helper-tab.entry.js +29 -0
- package/dist/esm/helper-tabs.entry.js +34 -0
- package/dist/esm/{index-0fa076cd.js → index-8f308493.js} +41 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/lottery-bullet_2.entry.js +197 -0
- package/dist/esm/lottery-draw-results-history.entry.js +120 -0
- package/dist/esm/lottery-game-details.entry.js +15 -0
- package/dist/esm/lottery-game-page.entry.js +13 -53
- package/dist/esm/lottery-game-page.js +2 -2
- package/dist/esm/lottery-ticket-controller.entry.js +65 -0
- package/dist/esm/lottery-ticket.entry.js +142 -0
- package/dist/lottery-game-page/lottery-game-page.esm.js +1 -1
- package/dist/lottery-game-page/p-037dd940.js +1 -0
- package/dist/lottery-game-page/p-12251772.entry.js +1 -0
- package/dist/lottery-game-page/p-324c7edd.entry.js +2849 -0
- package/dist/lottery-game-page/p-43400250.entry.js +1 -0
- package/dist/lottery-game-page/p-43f7fac4.entry.js +1 -0
- package/dist/lottery-game-page/p-55338096.entry.js +1 -0
- package/dist/lottery-game-page/p-581bdfc2.entry.js +1 -0
- package/dist/lottery-game-page/p-6977f833.entry.js +1 -0
- package/dist/lottery-game-page/p-85f4e95b.entry.js +1 -0
- package/dist/lottery-game-page/p-99a61a44.entry.js +1 -0
- package/dist/lottery-game-page/{p-6183a920.entry.js → p-af9a2dde.entry.js} +1 -1
- package/dist/lottery-game-page/p-bf66e969.entry.js +1 -0
- package/dist/lottery-game-page/p-d1b9da94.entry.js +1 -0
- package/dist/types/components/lottery-game-page/lottery-game-page.d.ts +0 -3
- package/package.json +1 -1
- package/dist/cjs/lottery-draw-results.cjs.entry.js +0 -188
- package/dist/esm/lottery-draw-results.entry.js +0 -184
- package/dist/lottery-game-page/p-2d7ccc96.js +0 -1
- package/dist/lottery-game-page/p-9ca649d9.entry.js +0 -1
- package/dist/lottery-game-page/p-e98ee83a.entry.js +0 -1
|
@@ -8,17 +8,78 @@
|
|
|
8
8
|
"typescriptVersion": "4.5.4"
|
|
9
9
|
},
|
|
10
10
|
"collections": [
|
|
11
|
+
{
|
|
12
|
+
"name": "@everymatrix/helper-accordion",
|
|
13
|
+
"tags": [
|
|
14
|
+
"helper-accordion"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "@everymatrix/helper-filters",
|
|
19
|
+
"tags": [
|
|
20
|
+
"helper-filters"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
11
23
|
{
|
|
12
24
|
"name": "@everymatrix/helper-modal",
|
|
13
25
|
"tags": [
|
|
14
26
|
"helper-modal"
|
|
15
27
|
]
|
|
16
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"name": "@everymatrix/helper-pagination",
|
|
31
|
+
"tags": [
|
|
32
|
+
"helper-pagination"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "@everymatrix/helper-tabs",
|
|
37
|
+
"tags": [
|
|
38
|
+
"helper-tab",
|
|
39
|
+
"helper-tabs"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "@everymatrix/lottery-bullet",
|
|
44
|
+
"tags": [
|
|
45
|
+
"lottery-bullet"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
17
48
|
{
|
|
18
49
|
"name": "@everymatrix/lottery-draw-results",
|
|
19
50
|
"tags": [
|
|
20
51
|
"lottery-draw-results"
|
|
21
52
|
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "@everymatrix/lottery-draw-results-history",
|
|
56
|
+
"tags": [
|
|
57
|
+
"lottery-draw-results-history"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "@everymatrix/lottery-game-details",
|
|
62
|
+
"tags": [
|
|
63
|
+
"lottery-game-details"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "@everymatrix/lottery-grid",
|
|
68
|
+
"tags": [
|
|
69
|
+
"lottery-grid"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "@everymatrix/lottery-ticket",
|
|
74
|
+
"tags": [
|
|
75
|
+
"lottery-ticket"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "@everymatrix/lottery-ticket-controller",
|
|
80
|
+
"tags": [
|
|
81
|
+
"lottery-ticket-controller"
|
|
82
|
+
]
|
|
22
83
|
}
|
|
23
84
|
],
|
|
24
85
|
"bundles": [
|
|
@@ -36,17 +36,16 @@
|
|
|
36
36
|
align-items: center;
|
|
37
37
|
}
|
|
38
38
|
.GamePage .TotalWinnings {
|
|
39
|
-
color: #
|
|
39
|
+
color: #00958f;
|
|
40
40
|
font-size: 18px;
|
|
41
41
|
display: flex;
|
|
42
|
-
flex-direction:
|
|
42
|
+
flex-direction: column;
|
|
43
43
|
justify-content: center;
|
|
44
44
|
align-items: center;
|
|
45
45
|
gap: 10px;
|
|
46
|
-
text-transform: uppercase;
|
|
47
46
|
}
|
|
48
47
|
.GamePage .TotalWinnings span {
|
|
49
|
-
font-size:
|
|
48
|
+
font-size: 22px;
|
|
50
49
|
font-weight: 700;
|
|
51
50
|
}
|
|
52
51
|
.GamePage .NextDraw {
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
font-weight: 600;
|
|
56
55
|
margin: 0 auto;
|
|
57
56
|
text-align: center;
|
|
58
|
-
text-transform:
|
|
57
|
+
text-transform: capitalize;
|
|
59
58
|
display: flex;
|
|
60
59
|
justify-content: center;
|
|
61
60
|
align-items: center;
|
|
@@ -64,9 +63,6 @@
|
|
|
64
63
|
.GamePage .NextDraw .BannerText {
|
|
65
64
|
font-weight: 400;
|
|
66
65
|
font-size: 18px;
|
|
67
|
-
text-transform: uppercase;
|
|
68
|
-
padding: 0;
|
|
69
|
-
margin: 15px 0 0 0;
|
|
70
66
|
}
|
|
71
67
|
.GamePage .NextDraw .BannerCountdown {
|
|
72
68
|
font-size: 22px;
|
|
@@ -99,21 +95,9 @@
|
|
|
99
95
|
color: #FFF;
|
|
100
96
|
}
|
|
101
97
|
|
|
102
|
-
.LastDrawResultsTitle {
|
|
103
|
-
color: #009993;
|
|
104
|
-
padding: 25px 0 10px 0;
|
|
105
|
-
text-align: center;
|
|
106
|
-
border-radius: 4px;
|
|
107
|
-
text-transform: uppercase;
|
|
108
|
-
font-size: 16px;
|
|
109
|
-
font-weight: 600;
|
|
110
|
-
margin: 0;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
98
|
.NextDrawWrapper {
|
|
114
99
|
padding: 10px 15px;
|
|
115
|
-
background: #
|
|
116
|
-
background: linear-gradient(0deg, #f1f1f1 0%, rgba(253, 187, 45, 0) 100%);
|
|
100
|
+
background: #fff;
|
|
117
101
|
}
|
|
118
102
|
.NextDrawWrapper .BannerText {
|
|
119
103
|
font-size: 16px;
|
|
@@ -130,7 +114,7 @@
|
|
|
130
114
|
}
|
|
131
115
|
|
|
132
116
|
.GamePageContent {
|
|
133
|
-
padding: 15px;
|
|
117
|
+
padding: 10px 15px;
|
|
134
118
|
max-width: 1200px;
|
|
135
119
|
margin: 0 auto;
|
|
136
120
|
}
|
|
@@ -138,6 +122,7 @@
|
|
|
138
122
|
.GameDetails {
|
|
139
123
|
padding-bottom: 10px;
|
|
140
124
|
margin-bottom: 20px;
|
|
125
|
+
border-bottom: 1px solid #e9e9e9;
|
|
141
126
|
}
|
|
142
127
|
|
|
143
128
|
.CreateNewTicket {
|
|
@@ -236,11 +221,6 @@
|
|
|
236
221
|
.ButtonWrapper .Button:hover {
|
|
237
222
|
background: #00ABA4;
|
|
238
223
|
}
|
|
239
|
-
.ButtonWrapper .Button.ButtonDisabled {
|
|
240
|
-
pointer-events: none;
|
|
241
|
-
background: #ccc;
|
|
242
|
-
border: 1px solid #ccc;
|
|
243
|
-
}
|
|
244
224
|
|
|
245
225
|
.SubmitModalSuccess {
|
|
246
226
|
text-align: center;
|
|
@@ -28,8 +28,6 @@ export class LotteryGamePage {
|
|
|
28
28
|
this.deleteVisible = false;
|
|
29
29
|
this.latestDraw = {};
|
|
30
30
|
this.totalWinningsAmount = 0;
|
|
31
|
-
this.isLoggedIn = false;
|
|
32
|
-
this.loginModalVisible = false;
|
|
33
31
|
this.multiplier = false;
|
|
34
32
|
this.quickPick = false;
|
|
35
33
|
}
|
|
@@ -37,10 +35,6 @@ export class LotteryGamePage {
|
|
|
37
35
|
connectedCallback() {
|
|
38
36
|
this.getGameDetails();
|
|
39
37
|
this.getDraws();
|
|
40
|
-
console.log(this.language);
|
|
41
|
-
if (this.sessionId) {
|
|
42
|
-
this.isLoggedIn = true;
|
|
43
|
-
}
|
|
44
38
|
}
|
|
45
39
|
countdownLogic(date) {
|
|
46
40
|
this.interval = setInterval(() => {
|
|
@@ -67,6 +61,7 @@ export class LotteryGamePage {
|
|
|
67
61
|
this.gameData = data;
|
|
68
62
|
this.basicStake = this.gameData.rules.stakes[0].amount;
|
|
69
63
|
let draws = this.gameData.draws.filter((item) => !item.winningNumbers);
|
|
64
|
+
console.log('draws', draws);
|
|
70
65
|
this.nextDraw = draws[0].id;
|
|
71
66
|
this.createNewTicket();
|
|
72
67
|
})
|
|
@@ -129,7 +124,6 @@ export class LotteryGamePage {
|
|
|
129
124
|
}
|
|
130
125
|
modalCloseEvent() {
|
|
131
126
|
this.deleteVisible = false;
|
|
132
|
-
this.loginModalVisible = false;
|
|
133
127
|
}
|
|
134
128
|
stakeChangeHandler(event) {
|
|
135
129
|
const { ticketId, stake } = event.detail;
|
|
@@ -191,9 +185,6 @@ export class LotteryGamePage {
|
|
|
191
185
|
{ gameId: this.gameId, ticketId: this.tickets.length + 1, completed: false, amount: 1, stake: this.basicStake, grids: [] }
|
|
192
186
|
];
|
|
193
187
|
}
|
|
194
|
-
showLoginModal() {
|
|
195
|
-
this.loginModalVisible = true;
|
|
196
|
-
}
|
|
197
188
|
submitTickets() {
|
|
198
189
|
let url = new URL(`${this.endpoint}/tickets`);
|
|
199
190
|
// @TODO Body TS type
|
|
@@ -201,6 +192,7 @@ export class LotteryGamePage {
|
|
|
201
192
|
gameId: this.gameId,
|
|
202
193
|
tickets: []
|
|
203
194
|
};
|
|
195
|
+
console.log('body', body);
|
|
204
196
|
this.tickets.forEach((item) => {
|
|
205
197
|
body.tickets.push({
|
|
206
198
|
startingDrawId: this.nextDraw,
|
|
@@ -244,7 +236,7 @@ export class LotteryGamePage {
|
|
|
244
236
|
}
|
|
245
237
|
return (
|
|
246
238
|
/* Game details */
|
|
247
|
-
h("div", { class: "GamePage"
|
|
239
|
+
h("div", { class: "GamePage" },
|
|
248
240
|
h("div", { class: "GridBanner" },
|
|
249
241
|
h("div", { class: "BannerButtonsWrapper" },
|
|
250
242
|
h("button", { class: "BannerBackButton" },
|
|
@@ -299,16 +291,9 @@ export class LotteryGamePage {
|
|
|
299
291
|
" ",
|
|
300
292
|
this.currency)),
|
|
301
293
|
h("div", { class: "ButtonWrapper" },
|
|
302
|
-
this.
|
|
303
|
-
h("span", { class: "Button", onClick: () => this.submitTickets() }, translate('orderSummarySubmit', this.language)),
|
|
304
|
-
!this.isLoggedIn &&
|
|
305
|
-
h("div", null,
|
|
306
|
-
h("span", { class: "Button", onClick: () => this.showLoginModal() }, translate('orderSummarySubmit', this.language)),
|
|
307
|
-
h("helper-modal", { "title-modal": "Success", visible: this.loginModalVisible },
|
|
308
|
-
h("p", { class: "SubmitModalSuccess" }, translate('modalLogin', this.language))))))),
|
|
294
|
+
h("span", { class: "Button", onClick: () => this.submitTickets() }, translate('orderSummarySubmit', this.language))))),
|
|
309
295
|
this.tabIndex == 1 &&
|
|
310
296
|
h("div", null,
|
|
311
|
-
h("h4", { class: "LastDrawResultsTitle" }, translate('lastDrawResultsTitle', this.language)),
|
|
312
297
|
h("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language, "draw-id": this.lastDrawId, "draw-mode": true }),
|
|
313
298
|
h("lottery-draw-results-history", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language })),
|
|
314
299
|
h("helper-modal", { "title-modal": "Success", visible: this.successVisible },
|
|
@@ -468,9 +453,7 @@ export class LotteryGamePage {
|
|
|
468
453
|
"secondsRemaining": {},
|
|
469
454
|
"latestDraw": {},
|
|
470
455
|
"totalWinningsAmount": {},
|
|
471
|
-
"nextDate": {}
|
|
472
|
-
"isLoggedIn": {},
|
|
473
|
-
"loginModalVisible": {}
|
|
456
|
+
"nextDate": {}
|
|
474
457
|
}; }
|
|
475
458
|
static get elementRef() { return "element"; }
|
|
476
459
|
static get listeners() { return [{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en'
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
3
3
|
const TRANSLATIONS = {
|
|
4
4
|
en: {
|
|
5
5
|
error: 'Error',
|
|
@@ -12,7 +12,7 @@ const TRANSLATIONS = {
|
|
|
12
12
|
buy: 'Buy tickets',
|
|
13
13
|
viewLatest: 'View latest results',
|
|
14
14
|
createTicket: 'Create Ticket',
|
|
15
|
-
modalSuccess: 'Purchase
|
|
15
|
+
modalSuccess: 'Purchase will be successfull soon!',
|
|
16
16
|
deleteTicketModalTitle: 'Delete Ticket',
|
|
17
17
|
deleteTicketModalText: 'Are you sure you want to delete this ticket?',
|
|
18
18
|
deleteTicketModalCancel: 'Cancel',
|
|
@@ -20,9 +20,7 @@ const TRANSLATIONS = {
|
|
|
20
20
|
orderSummaryTitle: 'Order Summary',
|
|
21
21
|
orderSummaryTickets: 'Ticket',
|
|
22
22
|
orderSummaryTotal: 'Total',
|
|
23
|
-
orderSummarySubmit: 'Submit'
|
|
24
|
-
lastDrawResultsTitle: 'Last Draw Results',
|
|
25
|
-
modalLogin: 'Please login to submit a ticket',
|
|
23
|
+
orderSummarySubmit: 'Submit'
|
|
26
24
|
},
|
|
27
25
|
ro: {
|
|
28
26
|
error: 'Eroare',
|
|
@@ -31,11 +29,11 @@ const TRANSLATIONS = {
|
|
|
31
29
|
lobbyButton: 'Lobby',
|
|
32
30
|
prize: 'MARELE JACKPOT OMG',
|
|
33
31
|
winUpTo: 'Castiga pana la',
|
|
34
|
-
nextDraw: '
|
|
32
|
+
nextDraw: 'In cat timp devii milionar daca cumperi acum!!!',
|
|
35
33
|
buy: 'Cumpara bilet',
|
|
36
34
|
viewLatest: 'Ultimile extrageri',
|
|
37
35
|
createTicket: 'Creeaza bilet',
|
|
38
|
-
modalSuccess: '
|
|
36
|
+
modalSuccess: 'Achiziția va avea succes în curând!',
|
|
39
37
|
deleteTicketModalTitle: 'Sterge biletul',
|
|
40
38
|
deleteTicketModalText: 'Esti sigur ca vrei sa stergi acest bilet?',
|
|
41
39
|
deleteTicketModalCancel: 'Anuleaza',
|
|
@@ -43,32 +41,7 @@ const TRANSLATIONS = {
|
|
|
43
41
|
orderSummaryTitle: 'Rezumat comanda',
|
|
44
42
|
orderSummaryTickets: 'Bilet',
|
|
45
43
|
orderSummaryTotal: 'Total',
|
|
46
|
-
orderSummarySubmit: 'Trimite'
|
|
47
|
-
lastDrawResultsTitle: 'Cele mai recente extrageri',
|
|
48
|
-
modalLogin: 'Please login to submit a ticket',
|
|
49
|
-
},
|
|
50
|
-
ar: {
|
|
51
|
-
error: 'خطأ',
|
|
52
|
-
title: 'كرونو',
|
|
53
|
-
backButton: 'خلف',
|
|
54
|
-
lobbyButton: 'ردهة',
|
|
55
|
-
prize: 'جائزة',
|
|
56
|
-
winUpTo: 'الفوز بما يصل الى',
|
|
57
|
-
nextDraw: 'السحب التالي:',
|
|
58
|
-
buy: 'اشتري تذاكر',
|
|
59
|
-
viewLatest: 'عرض أحدث النتائج',
|
|
60
|
-
createTicket: 'إنشاء تذكرة',
|
|
61
|
-
modalSuccess: '!سيتم الشراء بنجاح قريبًا',
|
|
62
|
-
deleteTicketModalTitle: 'حذف التذكرة',
|
|
63
|
-
deleteTicketModalText: 'هل أنت متأكد أنك تريد حذف هذه التذكرة؟',
|
|
64
|
-
deleteTicketModalCancel: 'يلغي',
|
|
65
|
-
deleteTicketModalConfirm: 'حذف',
|
|
66
|
-
orderSummaryTitle: 'ملخص الطلب',
|
|
67
|
-
orderSummaryTickets: 'تذكرة',
|
|
68
|
-
orderSummaryTotal: 'المجموع',
|
|
69
|
-
orderSummarySubmit: 'يُقدِّم',
|
|
70
|
-
lastDrawResultsTitle: 'Cele mai recente extrageri',
|
|
71
|
-
modalLogin: 'الرجاء تسجيل الدخول لتقديم تذكرة'
|
|
44
|
+
orderSummarySubmit: 'Trimite'
|
|
72
45
|
},
|
|
73
46
|
};
|
|
74
47
|
export const translate = (key, customLang) => {
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
4
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
5
|
+
const TRANSLATIONS = {
|
|
6
|
+
en: {
|
|
7
|
+
deleteTicket: 'Delete ticket'
|
|
8
|
+
},
|
|
9
|
+
ro: {
|
|
10
|
+
deleteTicket: 'Sterge biletul'
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
const translate = (key, customLang) => {
|
|
14
|
+
const lang = customLang;
|
|
15
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
16
|
+
};
|
|
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:4px;margin-bottom:1px;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.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}.Content{border-radius:4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{border-radius:4px;margin-top:10px;cursor:pointer;text-transform:capitalize;display:block;font-size:12px;text-align:center;padding:8px 20px;width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
|
|
19
|
+
|
|
20
|
+
const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
this.__registerHost();
|
|
24
|
+
this.__attachShadow();
|
|
25
|
+
this.accordionEvent = createEvent(this, "helperAccordionAction", 7);
|
|
26
|
+
/**
|
|
27
|
+
* Title (top header)
|
|
28
|
+
*/
|
|
29
|
+
this.headerTitle = '';
|
|
30
|
+
/**
|
|
31
|
+
* SubTitle (top header)
|
|
32
|
+
*/
|
|
33
|
+
this.headerSubtitle = '';
|
|
34
|
+
/**
|
|
35
|
+
* Description
|
|
36
|
+
*/
|
|
37
|
+
this.description = '';
|
|
38
|
+
/**
|
|
39
|
+
* Enables footer content
|
|
40
|
+
*/
|
|
41
|
+
this.footer = false;
|
|
42
|
+
/**
|
|
43
|
+
* Enables footer button for tab deletion
|
|
44
|
+
*/
|
|
45
|
+
this.deleteTab = false;
|
|
46
|
+
/**
|
|
47
|
+
* Activates postMessages as events for actions from the widget
|
|
48
|
+
*/
|
|
49
|
+
this.postMessage = false;
|
|
50
|
+
/**
|
|
51
|
+
* Name of the event emitter by the action button
|
|
52
|
+
*/
|
|
53
|
+
this.eventName = 'helperAccordionAction';
|
|
54
|
+
/**
|
|
55
|
+
* Collapsed
|
|
56
|
+
*/
|
|
57
|
+
this.collapsed = true;
|
|
58
|
+
/**
|
|
59
|
+
* Language
|
|
60
|
+
*/
|
|
61
|
+
this.language = 'en';
|
|
62
|
+
}
|
|
63
|
+
// @TODO fix the `any` type :)
|
|
64
|
+
connectedCallback() {
|
|
65
|
+
this.showContent = !this.collapsed;
|
|
66
|
+
}
|
|
67
|
+
toggleContent() {
|
|
68
|
+
this.showContent = !this.showContent;
|
|
69
|
+
}
|
|
70
|
+
deleteAction() {
|
|
71
|
+
if (this.postMessage) {
|
|
72
|
+
// @TODO maybe change the name type, this one sucks
|
|
73
|
+
window.postMessage({ type: this.eventName }, window.location.href);
|
|
74
|
+
}
|
|
75
|
+
this.accordionEvent.emit();
|
|
76
|
+
}
|
|
77
|
+
render() {
|
|
78
|
+
return (h("div", { class: "Wrapper" }, h("div", { class: "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 &&
|
|
79
|
+
h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
|
|
80
|
+
h("div", null, this.deleteTab &&
|
|
81
|
+
h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
|
|
82
|
+
}
|
|
83
|
+
static get style() { return helperAccordionCss; }
|
|
84
|
+
}, [1, "helper-accordion", {
|
|
85
|
+
"headerTitle": [1, "header-title"],
|
|
86
|
+
"headerSubtitle": [1, "header-subtitle"],
|
|
87
|
+
"description": [1],
|
|
88
|
+
"footer": [4],
|
|
89
|
+
"deleteTab": [4, "delete-tab"],
|
|
90
|
+
"postMessage": [4, "post-message"],
|
|
91
|
+
"eventName": [1, "event-name"],
|
|
92
|
+
"collapsed": [4],
|
|
93
|
+
"language": [1],
|
|
94
|
+
"showContent": [32]
|
|
95
|
+
}]);
|
|
96
|
+
function defineCustomElement() {
|
|
97
|
+
if (typeof customElements === "undefined") {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const components = ["helper-accordion"];
|
|
101
|
+
components.forEach(tagName => { switch (tagName) {
|
|
102
|
+
case "helper-accordion":
|
|
103
|
+
if (!customElements.get(tagName)) {
|
|
104
|
+
customElements.define(tagName, Accordion);
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
} });
|
|
108
|
+
}
|
|
109
|
+
defineCustomElement();
|
|
110
|
+
|
|
111
|
+
export { Accordion as A, defineCustomElement as d };
|