@everymatrix/casino-tournament-duration 1.20.1 → 1.20.7
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/casino-tournament-duration/casino-tournament-duration.esm.js +1 -1
- package/dist/casino-tournament-duration/p-29bd34e3.entry.js +1 -0
- package/dist/cjs/casino-tournament-duration.cjs.entry.js +36 -20
- package/dist/cjs/casino-tournament-duration.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.js +55 -38
- package/dist/components/casino-tournament-duration.js +40 -23
- package/dist/esm/casino-tournament-duration.entry.js +36 -20
- package/dist/esm/casino-tournament-duration.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/casino-tournament-duration/casino-tournament-duration.d.ts +29 -10
- package/dist/types/components.d.ts +44 -8
- package/package.json +1 -1
- package/dist/casino-tournament-duration/p-05f4af89.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,b as n}from"./p-efeaf265.js";(()=>{const n=import.meta.url,
|
|
1
|
+
import{p as t,b as n}from"./p-efeaf265.js";(()=>{const n=import.meta.url,e={};return""!==n&&(e.resourcesUrl=new URL(".",n).href),t(e)})().then((t=>n([["p-29bd34e3",[[1,"casino-tournament-duration",{startTime:[1,"start-time"],endTime:[1,"end-time"],status:[1],language:[1],clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],tournamentUntilStartDays:[32],tournamentLeftDays:[32],showRemain:[32],limitStylingAppends:[32],stylingContainer:[32],durationInterval:[32]}]]]],t)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as s}from"./p-efeaf265.js";const i=["ro","en","zh-hk","fr","hu","tr","el","es","pt"],e={en:{finished:"Finished",starting:"Starting in ",left:"left",minutes:"minutes",hours:"hours",days:"days"},"zh-hk":{finished:"完成的",starting:"開始於",left:"剩下",minutes:"分鐘",hours:"小時",days:"天"},fr:{finished:"Fini",starting:"Début dans ",left:"restant",minutes:"minutes",hours:"heures",days:"jours"},ro:{finished:"Finalizat",starting:"Începe în",left:"rămase",minutes:"minute",hours:"ore",days:"zile"},tr:{finished:"Sona ermiş",starting:"Başlamasına ",left:"kaldı",minutes:"dakika",hours:"saat",days:"gün"},el:{finished:"Ολοκληρωμένα",starting:"Αρχίζει σε ",left:"απομένουν",minutes:"λεπτά",hours:"ώρες",days:"ημέρες"},es:{finished:"Finalizado",starting:"Iniciando en ",left:"izquierda",minutes:"minutos",hours:"horas",days:"días"},hu:{finished:"Befejezve",starting:"Kezdésig",left:"bal",minutes:"perc",hours:"óra",days:"nap"},pt:{finished:"Finalizado",starting:"Começando em",left:"Abandonou",minutes:"Minutos",hours:"Horas",days:"Dias"}},r=(t,s)=>{const r=s;return e[void 0!==r&&i.includes(r)?r:"en"][t]},n=class{constructor(s){t(this,s),this.clientStyling="",this.clientStylingUrl="",this.limitStylingAppends=!1}getDateTimeDiff(t,s){return(new Date(s).getTime()-new Date(t).getTime())/6e4}getDuration(){const t=new Date;this.tournamentLeftDays=this.getDateTimeDiff(t,this.endTime),this.tournamentUntilStartDays=this.getDateTimeDiff(t,this.startTime),this.showRemain=this.getTextByDiff(this.tournamentLeftDays)}formatDate(t){let s=new Date(t),i=new Intl.DateTimeFormat(this.language,{month:"long"}).format(s);return`${s.getDate()} ${i}, ${s.toLocaleString("en-GB",{hour:"numeric",minute:"numeric"})}, ${s.getUTCFullYear()}`}getTextByDiff(t){if(t<1440){const s=t%60;return[t/60,s,60*(s-Math.floor(s))].map((t=>(t=>{const s=Math.floor(t);return s<10?`0${s}`:`${s}`})(t))).join(":")}return Math.ceil(t/1440)+" "+r("days")}getProgress(){if(this.tournamentLeftDays<=0)return 100;const t=this.getDateTimeDiff(this.startTime,this.endTime);return Math.floor(100/t*(t-this.tournamentLeftDays))}componentWillLoad(){this.startTime&&this.endTime&&(this.getDuration(),this.getTextByDiff(this.tournamentLeftDays)),this.tournamentLeftDays<1440&&this.tournamentLeftDays>0?this.durationInterval=window.setInterval((()=>{this.startTime&&this.endTime&&this.getDuration()}),1e3):clearInterval(this.durationInterval)}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}setClientStyling(){let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)}setClientStylingURL(){let t=document.createElement("style");setTimeout((()=>{t.innerHTML=this.clientStylingUrl,this.stylingContainer.prepend(t)}),1)}render(){if(this.startTime&&this.endTime)return s("div",{ref:t=>this.stylingContainer=t},s("div",{class:"TournamentDuration"},s("div",{class:"TournamentDates"},s("div",{class:"StartDate",part:"StartDate"},this.formatDate(this.startTime)),s("div",{class:"EndDate",part:"EndDate"},this.formatDate(this.endTime))),s("div",{class:"ProgressBarWrapper"},s("div",{class:"ProgressBar",part:"ProgressBar"},"Finished"==this.status||"Closing"==this.status||"Closed"==this.status?s("div",null,s("div",{class:"ProgressBarFillEnd",part:"ProgressBarFillEnd"}),s("div",{class:"Finished",part:"Finished"},r("finished",this.language))):this.tournamentUntilStartDays>0?s("div",null,s("div",{class:"ProgressBarFillStarting",part:"ProgressBarFillStarting"}),s("div",{class:"Remaining",part:"Remaining"},r("starting",this.language)," ",this.getTextByDiff(this.tournamentUntilStartDays))):s("div",null,s("div",{class:"ProgressBarFill",part:"ProgressBarFill",style:{width:`${this.getProgress()}%`}}),this.tournamentLeftDays>0&&s("div",{class:"Remaining",part:"Remaining"},this.showRemain," ",r("left",this.language)))))))}};n.style=":host{display:block}.TournamentDates{display:flex;justify-content:space-between}.StartDate{font-size:10px;font-weight:700;color:var(--emfe-w-color-gray-300, #58586B)}.EndDate{font-size:10px;font-weight:700;align-content:flex-end;color:var(--emfe-w-color-gray-300, #58586B)}.ProgressBar{margin:5px 0;height:8px;background:var(--emfe-w-color-white, #FFFFFF)}.ProgressBarInactive{margin:5px 20px 10px 20px;height:8px;background:var(--emfe-w-color-gray-100, #E6E6E6)}.ProgressBarFill{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillEnd{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillStarting{background-color:var(--emfe-w-color-gray-300, #58586B);height:8px}.Remaining,.Finished{font-size:10px;font-weight:700;padding-top:6px;text-align:right;text-transform:uppercase}.Finished{color:var(--emfe-w-color-green, #48952a)}";export{n as casino_tournament_duration}
|
|
@@ -90,29 +90,23 @@ const casinoTournamentDurationCss = ":host{display:block}.TournamentDates{displa
|
|
|
90
90
|
const CasinoTournamentDuration = class {
|
|
91
91
|
constructor(hostRef) {
|
|
92
92
|
index.registerInstance(this, hostRef);
|
|
93
|
+
/**
|
|
94
|
+
* Client custom styling via inline styles
|
|
95
|
+
*/
|
|
93
96
|
this.clientStyling = '';
|
|
97
|
+
/**
|
|
98
|
+
* Client custom styling via url
|
|
99
|
+
*/
|
|
94
100
|
this.clientStylingUrl = '';
|
|
95
101
|
this.limitStylingAppends = false;
|
|
96
|
-
this.setClientStyling = () => {
|
|
97
|
-
let sheet = document.createElement('style');
|
|
98
|
-
sheet.innerHTML = this.clientStyling;
|
|
99
|
-
this.stylingContainer.prepend(sheet);
|
|
100
|
-
};
|
|
101
|
-
this.setClientStylingURL = () => {
|
|
102
|
-
let cssFile = document.createElement('style');
|
|
103
|
-
setTimeout(() => {
|
|
104
|
-
cssFile.innerHTML = this.clientStylingUrl;
|
|
105
|
-
this.stylingContainer.prepend(cssFile);
|
|
106
|
-
}, 1);
|
|
107
|
-
};
|
|
108
102
|
}
|
|
109
103
|
getDateTimeDiff(dateString1, dateString2) {
|
|
110
104
|
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
111
105
|
}
|
|
112
106
|
getDuration() {
|
|
113
107
|
const dateNow = new Date();
|
|
114
|
-
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.
|
|
115
|
-
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.
|
|
108
|
+
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
|
|
109
|
+
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
|
|
116
110
|
this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
|
|
117
111
|
}
|
|
118
112
|
formatDate(date) {
|
|
@@ -144,16 +138,26 @@ const CasinoTournamentDuration = class {
|
|
|
144
138
|
getProgress() {
|
|
145
139
|
if (this.tournamentLeftDays <= 0)
|
|
146
140
|
return 100;
|
|
147
|
-
const tournamentDuration = this.getDateTimeDiff(this.
|
|
141
|
+
const tournamentDuration = this.getDateTimeDiff(this.startTime, this.endTime);
|
|
148
142
|
const step = 100 / tournamentDuration;
|
|
149
143
|
const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
|
|
150
144
|
return width;
|
|
151
145
|
}
|
|
152
146
|
componentWillLoad() {
|
|
153
|
-
if (this.
|
|
147
|
+
if (this.startTime && this.endTime) {
|
|
154
148
|
this.getDuration();
|
|
155
149
|
this.getTextByDiff(this.tournamentLeftDays);
|
|
156
150
|
}
|
|
151
|
+
if (this.tournamentLeftDays < 1440 && this.tournamentLeftDays > 0) {
|
|
152
|
+
this.durationInterval = window.setInterval(() => {
|
|
153
|
+
if (this.startTime && this.endTime) {
|
|
154
|
+
this.getDuration();
|
|
155
|
+
}
|
|
156
|
+
}, 1000);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
clearInterval(this.durationInterval);
|
|
160
|
+
}
|
|
157
161
|
}
|
|
158
162
|
componentDidRender() {
|
|
159
163
|
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
@@ -164,12 +168,24 @@ const CasinoTournamentDuration = class {
|
|
|
164
168
|
this.limitStylingAppends = true;
|
|
165
169
|
}
|
|
166
170
|
}
|
|
171
|
+
setClientStyling() {
|
|
172
|
+
let sheet = document.createElement('style');
|
|
173
|
+
sheet.innerHTML = this.clientStyling;
|
|
174
|
+
this.stylingContainer.prepend(sheet);
|
|
175
|
+
}
|
|
176
|
+
setClientStylingURL() {
|
|
177
|
+
let cssFile = document.createElement('style');
|
|
178
|
+
setTimeout(() => {
|
|
179
|
+
cssFile.innerHTML = this.clientStylingUrl;
|
|
180
|
+
this.stylingContainer.prepend(cssFile);
|
|
181
|
+
}, 1);
|
|
182
|
+
}
|
|
167
183
|
render() {
|
|
168
|
-
if (this.
|
|
169
|
-
return index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "TournamentDuration" }, index.h("div", { class: "TournamentDates" }, index.h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.
|
|
170
|
-
index.h("div", null, index.h("div", { class: "ProgressBarFillEnd" }), index.h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
184
|
+
if (this.startTime && this.endTime) {
|
|
185
|
+
return index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "TournamentDuration" }, index.h("div", { class: "TournamentDates" }, index.h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startTime)), index.h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endTime))), index.h("div", { class: "ProgressBarWrapper" }, index.h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
|
|
186
|
+
index.h("div", null, index.h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }), index.h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
171
187
|
this.tournamentUntilStartDays > 0 ?
|
|
172
|
-
index.h("div", null, index.h("div", { class: "ProgressBarFillStarting" }), index.h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
|
|
188
|
+
index.h("div", null, index.h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }), index.h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
|
|
173
189
|
index.h("div", null, index.h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
|
|
174
190
|
index.h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
|
|
175
191
|
}
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["casino-tournament-duration.cjs",[[1,"casino-tournament-duration",{"
|
|
18
|
+
return index.bootstrapLazy([["casino-tournament-duration.cjs",[[1,"casino-tournament-duration",{"startTime":[1,"start-time"],"endTime":[1,"end-time"],"status":[1],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"tournamentUntilStartDays":[32],"tournamentLeftDays":[32],"showRemain":[32],"limitStylingAppends":[32],"stylingContainer":[32],"durationInterval":[32]}]]]], options);
|
|
19
19
|
});
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -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([["casino-tournament-duration.cjs",[[1,"casino-tournament-duration",{"
|
|
17
|
+
return index.bootstrapLazy([["casino-tournament-duration.cjs",[[1,"casino-tournament-duration",{"startTime":[1,"start-time"],"endTime":[1,"end-time"],"status":[1],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"tournamentUntilStartDays":[32],"tournamentLeftDays":[32],"showRemain":[32],"limitStylingAppends":[32],"stylingContainer":[32],"durationInterval":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -2,29 +2,23 @@ import { Component, Prop, h, State } from '@stencil/core';
|
|
|
2
2
|
import { translate } from '../../utils/locale.utils';
|
|
3
3
|
export class CasinoTournamentDuration {
|
|
4
4
|
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Client custom styling via inline styles
|
|
7
|
+
*/
|
|
5
8
|
this.clientStyling = '';
|
|
9
|
+
/**
|
|
10
|
+
* Client custom styling via url
|
|
11
|
+
*/
|
|
6
12
|
this.clientStylingUrl = '';
|
|
7
13
|
this.limitStylingAppends = false;
|
|
8
|
-
this.setClientStyling = () => {
|
|
9
|
-
let sheet = document.createElement('style');
|
|
10
|
-
sheet.innerHTML = this.clientStyling;
|
|
11
|
-
this.stylingContainer.prepend(sheet);
|
|
12
|
-
};
|
|
13
|
-
this.setClientStylingURL = () => {
|
|
14
|
-
let cssFile = document.createElement('style');
|
|
15
|
-
setTimeout(() => {
|
|
16
|
-
cssFile.innerHTML = this.clientStylingUrl;
|
|
17
|
-
this.stylingContainer.prepend(cssFile);
|
|
18
|
-
}, 1);
|
|
19
|
-
};
|
|
20
14
|
}
|
|
21
15
|
getDateTimeDiff(dateString1, dateString2) {
|
|
22
16
|
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
23
17
|
}
|
|
24
18
|
getDuration() {
|
|
25
19
|
const dateNow = new Date();
|
|
26
|
-
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.
|
|
27
|
-
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.
|
|
20
|
+
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
|
|
21
|
+
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
|
|
28
22
|
this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
|
|
29
23
|
}
|
|
30
24
|
formatDate(date) {
|
|
@@ -56,16 +50,26 @@ export class CasinoTournamentDuration {
|
|
|
56
50
|
getProgress() {
|
|
57
51
|
if (this.tournamentLeftDays <= 0)
|
|
58
52
|
return 100;
|
|
59
|
-
const tournamentDuration = this.getDateTimeDiff(this.
|
|
53
|
+
const tournamentDuration = this.getDateTimeDiff(this.startTime, this.endTime);
|
|
60
54
|
const step = 100 / tournamentDuration;
|
|
61
55
|
const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
|
|
62
56
|
return width;
|
|
63
57
|
}
|
|
64
58
|
componentWillLoad() {
|
|
65
|
-
if (this.
|
|
59
|
+
if (this.startTime && this.endTime) {
|
|
66
60
|
this.getDuration();
|
|
67
61
|
this.getTextByDiff(this.tournamentLeftDays);
|
|
68
62
|
}
|
|
63
|
+
if (this.tournamentLeftDays < 1440 && this.tournamentLeftDays > 0) {
|
|
64
|
+
this.durationInterval = window.setInterval(() => {
|
|
65
|
+
if (this.startTime && this.endTime) {
|
|
66
|
+
this.getDuration();
|
|
67
|
+
}
|
|
68
|
+
}, 1000);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
clearInterval(this.durationInterval);
|
|
72
|
+
}
|
|
69
73
|
}
|
|
70
74
|
componentDidRender() {
|
|
71
75
|
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
@@ -76,21 +80,33 @@ export class CasinoTournamentDuration {
|
|
|
76
80
|
this.limitStylingAppends = true;
|
|
77
81
|
}
|
|
78
82
|
}
|
|
83
|
+
setClientStyling() {
|
|
84
|
+
let sheet = document.createElement('style');
|
|
85
|
+
sheet.innerHTML = this.clientStyling;
|
|
86
|
+
this.stylingContainer.prepend(sheet);
|
|
87
|
+
}
|
|
88
|
+
setClientStylingURL() {
|
|
89
|
+
let cssFile = document.createElement('style');
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
cssFile.innerHTML = this.clientStylingUrl;
|
|
92
|
+
this.stylingContainer.prepend(cssFile);
|
|
93
|
+
}, 1);
|
|
94
|
+
}
|
|
79
95
|
render() {
|
|
80
|
-
if (this.
|
|
96
|
+
if (this.startTime && this.endTime) {
|
|
81
97
|
return h("div", { ref: el => this.stylingContainer = el },
|
|
82
98
|
h("div", { class: "TournamentDuration" },
|
|
83
99
|
h("div", { class: "TournamentDates" },
|
|
84
|
-
h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.
|
|
85
|
-
h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.
|
|
100
|
+
h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startTime)),
|
|
101
|
+
h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endTime))),
|
|
86
102
|
h("div", { class: "ProgressBarWrapper" },
|
|
87
103
|
h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
|
|
88
104
|
h("div", null,
|
|
89
|
-
h("div", { class: "ProgressBarFillEnd" }),
|
|
105
|
+
h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }),
|
|
90
106
|
h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
91
107
|
this.tournamentUntilStartDays > 0 ?
|
|
92
108
|
h("div", null,
|
|
93
|
-
h("div", { class: "ProgressBarFillStarting" }),
|
|
109
|
+
h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }),
|
|
94
110
|
h("div", { class: "Remaining", part: "Remaining" },
|
|
95
111
|
translate('starting', this.language),
|
|
96
112
|
" ",
|
|
@@ -113,7 +129,7 @@ export class CasinoTournamentDuration {
|
|
|
113
129
|
"$": ["casino-tournament-duration.css"]
|
|
114
130
|
}; }
|
|
115
131
|
static get properties() { return {
|
|
116
|
-
"
|
|
132
|
+
"startTime": {
|
|
117
133
|
"type": "string",
|
|
118
134
|
"mutable": false,
|
|
119
135
|
"complexType": {
|
|
@@ -122,15 +138,15 @@ export class CasinoTournamentDuration {
|
|
|
122
138
|
"references": {}
|
|
123
139
|
},
|
|
124
140
|
"required": false,
|
|
125
|
-
"optional":
|
|
141
|
+
"optional": true,
|
|
126
142
|
"docs": {
|
|
127
143
|
"tags": [],
|
|
128
|
-
"text": ""
|
|
144
|
+
"text": "Tournament start time"
|
|
129
145
|
},
|
|
130
|
-
"attribute": "start-
|
|
146
|
+
"attribute": "start-time",
|
|
131
147
|
"reflect": false
|
|
132
148
|
},
|
|
133
|
-
"
|
|
149
|
+
"endTime": {
|
|
134
150
|
"type": "string",
|
|
135
151
|
"mutable": false,
|
|
136
152
|
"complexType": {
|
|
@@ -139,12 +155,12 @@ export class CasinoTournamentDuration {
|
|
|
139
155
|
"references": {}
|
|
140
156
|
},
|
|
141
157
|
"required": false,
|
|
142
|
-
"optional":
|
|
158
|
+
"optional": true,
|
|
143
159
|
"docs": {
|
|
144
160
|
"tags": [],
|
|
145
|
-
"text": ""
|
|
161
|
+
"text": "Tournament end time"
|
|
146
162
|
},
|
|
147
|
-
"attribute": "end-
|
|
163
|
+
"attribute": "end-time",
|
|
148
164
|
"reflect": false
|
|
149
165
|
},
|
|
150
166
|
"status": {
|
|
@@ -156,10 +172,10 @@ export class CasinoTournamentDuration {
|
|
|
156
172
|
"references": {}
|
|
157
173
|
},
|
|
158
174
|
"required": false,
|
|
159
|
-
"optional":
|
|
175
|
+
"optional": true,
|
|
160
176
|
"docs": {
|
|
161
177
|
"tags": [],
|
|
162
|
-
"text": ""
|
|
178
|
+
"text": "Tournament status"
|
|
163
179
|
},
|
|
164
180
|
"attribute": "status",
|
|
165
181
|
"reflect": false
|
|
@@ -172,11 +188,11 @@ export class CasinoTournamentDuration {
|
|
|
172
188
|
"resolved": "string",
|
|
173
189
|
"references": {}
|
|
174
190
|
},
|
|
175
|
-
"required":
|
|
191
|
+
"required": true,
|
|
176
192
|
"optional": false,
|
|
177
193
|
"docs": {
|
|
178
194
|
"tags": [],
|
|
179
|
-
"text": ""
|
|
195
|
+
"text": "Widget language to show"
|
|
180
196
|
},
|
|
181
197
|
"attribute": "language",
|
|
182
198
|
"reflect": false
|
|
@@ -190,10 +206,10 @@ export class CasinoTournamentDuration {
|
|
|
190
206
|
"references": {}
|
|
191
207
|
},
|
|
192
208
|
"required": false,
|
|
193
|
-
"optional":
|
|
209
|
+
"optional": true,
|
|
194
210
|
"docs": {
|
|
195
211
|
"tags": [],
|
|
196
|
-
"text": ""
|
|
212
|
+
"text": "Client custom styling via inline styles"
|
|
197
213
|
},
|
|
198
214
|
"attribute": "client-styling",
|
|
199
215
|
"reflect": false,
|
|
@@ -208,10 +224,10 @@ export class CasinoTournamentDuration {
|
|
|
208
224
|
"references": {}
|
|
209
225
|
},
|
|
210
226
|
"required": false,
|
|
211
|
-
"optional":
|
|
227
|
+
"optional": true,
|
|
212
228
|
"docs": {
|
|
213
229
|
"tags": [],
|
|
214
|
-
"text": ""
|
|
230
|
+
"text": "Client custom styling via url"
|
|
215
231
|
},
|
|
216
232
|
"attribute": "client-styling-url",
|
|
217
233
|
"reflect": false,
|
|
@@ -223,6 +239,7 @@ export class CasinoTournamentDuration {
|
|
|
223
239
|
"tournamentLeftDays": {},
|
|
224
240
|
"showRemain": {},
|
|
225
241
|
"limitStylingAppends": {},
|
|
226
|
-
"stylingContainer": {}
|
|
242
|
+
"stylingContainer": {},
|
|
243
|
+
"durationInterval": {}
|
|
227
244
|
}; }
|
|
228
245
|
}
|
|
@@ -88,29 +88,23 @@ const CasinoTournamentDuration$1 = /*@__PURE__*/ proxyCustomElement(class extend
|
|
|
88
88
|
super();
|
|
89
89
|
this.__registerHost();
|
|
90
90
|
this.__attachShadow();
|
|
91
|
+
/**
|
|
92
|
+
* Client custom styling via inline styles
|
|
93
|
+
*/
|
|
91
94
|
this.clientStyling = '';
|
|
95
|
+
/**
|
|
96
|
+
* Client custom styling via url
|
|
97
|
+
*/
|
|
92
98
|
this.clientStylingUrl = '';
|
|
93
99
|
this.limitStylingAppends = false;
|
|
94
|
-
this.setClientStyling = () => {
|
|
95
|
-
let sheet = document.createElement('style');
|
|
96
|
-
sheet.innerHTML = this.clientStyling;
|
|
97
|
-
this.stylingContainer.prepend(sheet);
|
|
98
|
-
};
|
|
99
|
-
this.setClientStylingURL = () => {
|
|
100
|
-
let cssFile = document.createElement('style');
|
|
101
|
-
setTimeout(() => {
|
|
102
|
-
cssFile.innerHTML = this.clientStylingUrl;
|
|
103
|
-
this.stylingContainer.prepend(cssFile);
|
|
104
|
-
}, 1);
|
|
105
|
-
};
|
|
106
100
|
}
|
|
107
101
|
getDateTimeDiff(dateString1, dateString2) {
|
|
108
102
|
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
109
103
|
}
|
|
110
104
|
getDuration() {
|
|
111
105
|
const dateNow = new Date();
|
|
112
|
-
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.
|
|
113
|
-
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.
|
|
106
|
+
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
|
|
107
|
+
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
|
|
114
108
|
this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
|
|
115
109
|
}
|
|
116
110
|
formatDate(date) {
|
|
@@ -142,16 +136,26 @@ const CasinoTournamentDuration$1 = /*@__PURE__*/ proxyCustomElement(class extend
|
|
|
142
136
|
getProgress() {
|
|
143
137
|
if (this.tournamentLeftDays <= 0)
|
|
144
138
|
return 100;
|
|
145
|
-
const tournamentDuration = this.getDateTimeDiff(this.
|
|
139
|
+
const tournamentDuration = this.getDateTimeDiff(this.startTime, this.endTime);
|
|
146
140
|
const step = 100 / tournamentDuration;
|
|
147
141
|
const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
|
|
148
142
|
return width;
|
|
149
143
|
}
|
|
150
144
|
componentWillLoad() {
|
|
151
|
-
if (this.
|
|
145
|
+
if (this.startTime && this.endTime) {
|
|
152
146
|
this.getDuration();
|
|
153
147
|
this.getTextByDiff(this.tournamentLeftDays);
|
|
154
148
|
}
|
|
149
|
+
if (this.tournamentLeftDays < 1440 && this.tournamentLeftDays > 0) {
|
|
150
|
+
this.durationInterval = window.setInterval(() => {
|
|
151
|
+
if (this.startTime && this.endTime) {
|
|
152
|
+
this.getDuration();
|
|
153
|
+
}
|
|
154
|
+
}, 1000);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
clearInterval(this.durationInterval);
|
|
158
|
+
}
|
|
155
159
|
}
|
|
156
160
|
componentDidRender() {
|
|
157
161
|
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
@@ -162,20 +166,32 @@ const CasinoTournamentDuration$1 = /*@__PURE__*/ proxyCustomElement(class extend
|
|
|
162
166
|
this.limitStylingAppends = true;
|
|
163
167
|
}
|
|
164
168
|
}
|
|
169
|
+
setClientStyling() {
|
|
170
|
+
let sheet = document.createElement('style');
|
|
171
|
+
sheet.innerHTML = this.clientStyling;
|
|
172
|
+
this.stylingContainer.prepend(sheet);
|
|
173
|
+
}
|
|
174
|
+
setClientStylingURL() {
|
|
175
|
+
let cssFile = document.createElement('style');
|
|
176
|
+
setTimeout(() => {
|
|
177
|
+
cssFile.innerHTML = this.clientStylingUrl;
|
|
178
|
+
this.stylingContainer.prepend(cssFile);
|
|
179
|
+
}, 1);
|
|
180
|
+
}
|
|
165
181
|
render() {
|
|
166
|
-
if (this.
|
|
167
|
-
return h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TournamentDuration" }, h("div", { class: "TournamentDates" }, h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.
|
|
168
|
-
h("div", null, h("div", { class: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
182
|
+
if (this.startTime && this.endTime) {
|
|
183
|
+
return h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TournamentDuration" }, h("div", { class: "TournamentDates" }, h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startTime)), h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endTime))), h("div", { class: "ProgressBarWrapper" }, h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
|
|
184
|
+
h("div", null, h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
169
185
|
this.tournamentUntilStartDays > 0 ?
|
|
170
|
-
h("div", null, h("div", { class: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
|
|
186
|
+
h("div", null, h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
|
|
171
187
|
h("div", null, h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
|
|
172
188
|
h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
|
|
173
189
|
}
|
|
174
190
|
}
|
|
175
191
|
static get style() { return casinoTournamentDurationCss; }
|
|
176
192
|
}, [1, "casino-tournament-duration", {
|
|
177
|
-
"
|
|
178
|
-
"
|
|
193
|
+
"startTime": [1, "start-time"],
|
|
194
|
+
"endTime": [1, "end-time"],
|
|
179
195
|
"status": [1],
|
|
180
196
|
"language": [1],
|
|
181
197
|
"clientStyling": [1, "client-styling"],
|
|
@@ -184,7 +200,8 @@ const CasinoTournamentDuration$1 = /*@__PURE__*/ proxyCustomElement(class extend
|
|
|
184
200
|
"tournamentLeftDays": [32],
|
|
185
201
|
"showRemain": [32],
|
|
186
202
|
"limitStylingAppends": [32],
|
|
187
|
-
"stylingContainer": [32]
|
|
203
|
+
"stylingContainer": [32],
|
|
204
|
+
"durationInterval": [32]
|
|
188
205
|
}]);
|
|
189
206
|
function defineCustomElement$1() {
|
|
190
207
|
if (typeof customElements === "undefined") {
|
|
@@ -86,29 +86,23 @@ const casinoTournamentDurationCss = ":host{display:block}.TournamentDates{displa
|
|
|
86
86
|
const CasinoTournamentDuration = class {
|
|
87
87
|
constructor(hostRef) {
|
|
88
88
|
registerInstance(this, hostRef);
|
|
89
|
+
/**
|
|
90
|
+
* Client custom styling via inline styles
|
|
91
|
+
*/
|
|
89
92
|
this.clientStyling = '';
|
|
93
|
+
/**
|
|
94
|
+
* Client custom styling via url
|
|
95
|
+
*/
|
|
90
96
|
this.clientStylingUrl = '';
|
|
91
97
|
this.limitStylingAppends = false;
|
|
92
|
-
this.setClientStyling = () => {
|
|
93
|
-
let sheet = document.createElement('style');
|
|
94
|
-
sheet.innerHTML = this.clientStyling;
|
|
95
|
-
this.stylingContainer.prepend(sheet);
|
|
96
|
-
};
|
|
97
|
-
this.setClientStylingURL = () => {
|
|
98
|
-
let cssFile = document.createElement('style');
|
|
99
|
-
setTimeout(() => {
|
|
100
|
-
cssFile.innerHTML = this.clientStylingUrl;
|
|
101
|
-
this.stylingContainer.prepend(cssFile);
|
|
102
|
-
}, 1);
|
|
103
|
-
};
|
|
104
98
|
}
|
|
105
99
|
getDateTimeDiff(dateString1, dateString2) {
|
|
106
100
|
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
107
101
|
}
|
|
108
102
|
getDuration() {
|
|
109
103
|
const dateNow = new Date();
|
|
110
|
-
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.
|
|
111
|
-
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.
|
|
104
|
+
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
|
|
105
|
+
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
|
|
112
106
|
this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
|
|
113
107
|
}
|
|
114
108
|
formatDate(date) {
|
|
@@ -140,16 +134,26 @@ const CasinoTournamentDuration = class {
|
|
|
140
134
|
getProgress() {
|
|
141
135
|
if (this.tournamentLeftDays <= 0)
|
|
142
136
|
return 100;
|
|
143
|
-
const tournamentDuration = this.getDateTimeDiff(this.
|
|
137
|
+
const tournamentDuration = this.getDateTimeDiff(this.startTime, this.endTime);
|
|
144
138
|
const step = 100 / tournamentDuration;
|
|
145
139
|
const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
|
|
146
140
|
return width;
|
|
147
141
|
}
|
|
148
142
|
componentWillLoad() {
|
|
149
|
-
if (this.
|
|
143
|
+
if (this.startTime && this.endTime) {
|
|
150
144
|
this.getDuration();
|
|
151
145
|
this.getTextByDiff(this.tournamentLeftDays);
|
|
152
146
|
}
|
|
147
|
+
if (this.tournamentLeftDays < 1440 && this.tournamentLeftDays > 0) {
|
|
148
|
+
this.durationInterval = window.setInterval(() => {
|
|
149
|
+
if (this.startTime && this.endTime) {
|
|
150
|
+
this.getDuration();
|
|
151
|
+
}
|
|
152
|
+
}, 1000);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
clearInterval(this.durationInterval);
|
|
156
|
+
}
|
|
153
157
|
}
|
|
154
158
|
componentDidRender() {
|
|
155
159
|
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
@@ -160,12 +164,24 @@ const CasinoTournamentDuration = class {
|
|
|
160
164
|
this.limitStylingAppends = true;
|
|
161
165
|
}
|
|
162
166
|
}
|
|
167
|
+
setClientStyling() {
|
|
168
|
+
let sheet = document.createElement('style');
|
|
169
|
+
sheet.innerHTML = this.clientStyling;
|
|
170
|
+
this.stylingContainer.prepend(sheet);
|
|
171
|
+
}
|
|
172
|
+
setClientStylingURL() {
|
|
173
|
+
let cssFile = document.createElement('style');
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
cssFile.innerHTML = this.clientStylingUrl;
|
|
176
|
+
this.stylingContainer.prepend(cssFile);
|
|
177
|
+
}, 1);
|
|
178
|
+
}
|
|
163
179
|
render() {
|
|
164
|
-
if (this.
|
|
165
|
-
return h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TournamentDuration" }, h("div", { class: "TournamentDates" }, h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.
|
|
166
|
-
h("div", null, h("div", { class: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
180
|
+
if (this.startTime && this.endTime) {
|
|
181
|
+
return h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TournamentDuration" }, h("div", { class: "TournamentDates" }, h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startTime)), h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endTime))), h("div", { class: "ProgressBarWrapper" }, h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
|
|
182
|
+
h("div", null, h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
167
183
|
this.tournamentUntilStartDays > 0 ?
|
|
168
|
-
h("div", null, h("div", { class: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
|
|
184
|
+
h("div", null, h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
|
|
169
185
|
h("div", null, h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
|
|
170
186
|
h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
|
|
171
187
|
}
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["casino-tournament-duration",[[1,"casino-tournament-duration",{"
|
|
16
|
+
return bootstrapLazy([["casino-tournament-duration",[[1,"casino-tournament-duration",{"startTime":[1,"start-time"],"endTime":[1,"end-time"],"status":[1],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"tournamentUntilStartDays":[32],"tournamentLeftDays":[32],"showRemain":[32],"limitStylingAppends":[32],"stylingContainer":[32],"durationInterval":[32]}]]]], options);
|
|
17
17
|
});
|
package/dist/esm/loader.js
CHANGED
|
@@ -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([["casino-tournament-duration",[[1,"casino-tournament-duration",{"
|
|
13
|
+
return bootstrapLazy([["casino-tournament-duration",[[1,"casino-tournament-duration",{"startTime":[1,"start-time"],"endTime":[1,"end-time"],"status":[1],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"tournamentUntilStartDays":[32],"tournamentLeftDays":[32],"showRemain":[32],"limitStylingAppends":[32],"stylingContainer":[32],"durationInterval":[32]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1,23 +1,42 @@
|
|
|
1
1
|
export declare class CasinoTournamentDuration {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Tournament start time
|
|
4
|
+
*/
|
|
5
|
+
startTime?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Tournament end time
|
|
8
|
+
*/
|
|
9
|
+
endTime?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Tournament status
|
|
12
|
+
*/
|
|
13
|
+
status?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Widget language to show
|
|
16
|
+
*/
|
|
5
17
|
language: string;
|
|
6
|
-
|
|
7
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Client custom styling via inline styles
|
|
20
|
+
*/
|
|
21
|
+
clientStyling?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Client custom styling via url
|
|
24
|
+
*/
|
|
25
|
+
clientStylingUrl?: string;
|
|
8
26
|
tournamentUntilStartDays: number;
|
|
9
27
|
tournamentLeftDays: number;
|
|
10
28
|
showRemain: string;
|
|
11
29
|
limitStylingAppends: boolean;
|
|
12
30
|
stylingContainer: HTMLElement;
|
|
13
|
-
|
|
31
|
+
durationInterval: number;
|
|
32
|
+
getDateTimeDiff(dateString1: any, dateString2: string): number;
|
|
14
33
|
getDuration(): void;
|
|
15
|
-
formatDate(date:
|
|
16
|
-
getTextByDiff(diff:
|
|
34
|
+
formatDate(date: string): string;
|
|
35
|
+
getTextByDiff(diff: number): any;
|
|
17
36
|
getProgress(): number;
|
|
18
37
|
componentWillLoad(): void;
|
|
19
38
|
componentDidRender(): void;
|
|
20
|
-
setClientStyling
|
|
21
|
-
setClientStylingURL
|
|
39
|
+
setClientStyling(): void;
|
|
40
|
+
setClientStylingURL(): void;
|
|
22
41
|
render(): any;
|
|
23
42
|
}
|
|
@@ -7,12 +7,30 @@
|
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
export namespace Components {
|
|
9
9
|
interface CasinoTournamentDuration {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Client custom styling via inline styles
|
|
12
|
+
*/
|
|
13
|
+
"clientStyling"?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Client custom styling via url
|
|
16
|
+
*/
|
|
17
|
+
"clientStylingUrl"?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Tournament end time
|
|
20
|
+
*/
|
|
21
|
+
"endTime"?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Widget language to show
|
|
24
|
+
*/
|
|
13
25
|
"language": string;
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Tournament start time
|
|
28
|
+
*/
|
|
29
|
+
"startTime"?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Tournament status
|
|
32
|
+
*/
|
|
33
|
+
"status"?: string;
|
|
16
34
|
}
|
|
17
35
|
}
|
|
18
36
|
declare global {
|
|
@@ -28,11 +46,29 @@ declare global {
|
|
|
28
46
|
}
|
|
29
47
|
declare namespace LocalJSX {
|
|
30
48
|
interface CasinoTournamentDuration {
|
|
49
|
+
/**
|
|
50
|
+
* Client custom styling via inline styles
|
|
51
|
+
*/
|
|
31
52
|
"clientStyling"?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Client custom styling via url
|
|
55
|
+
*/
|
|
32
56
|
"clientStylingUrl"?: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Tournament end time
|
|
59
|
+
*/
|
|
60
|
+
"endTime"?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Widget language to show
|
|
63
|
+
*/
|
|
64
|
+
"language": string;
|
|
65
|
+
/**
|
|
66
|
+
* Tournament start time
|
|
67
|
+
*/
|
|
68
|
+
"startTime"?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Tournament status
|
|
71
|
+
*/
|
|
36
72
|
"status"?: string;
|
|
37
73
|
}
|
|
38
74
|
interface IntrinsicElements {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s}from"./p-efeaf265.js";const i=["ro","en","zh-hk","fr","hu","tr","el","es","pt"],e={en:{finished:"Finished",starting:"Starting in ",left:"left",minutes:"minutes",hours:"hours",days:"days"},"zh-hk":{finished:"完成的",starting:"開始於",left:"剩下",minutes:"分鐘",hours:"小時",days:"天"},fr:{finished:"Fini",starting:"Début dans ",left:"restant",minutes:"minutes",hours:"heures",days:"jours"},ro:{finished:"Finalizat",starting:"Începe în",left:"rămase",minutes:"minute",hours:"ore",days:"zile"},tr:{finished:"Sona ermiş",starting:"Başlamasına ",left:"kaldı",minutes:"dakika",hours:"saat",days:"gün"},el:{finished:"Ολοκληρωμένα",starting:"Αρχίζει σε ",left:"απομένουν",minutes:"λεπτά",hours:"ώρες",days:"ημέρες"},es:{finished:"Finalizado",starting:"Iniciando en ",left:"izquierda",minutes:"minutos",hours:"horas",days:"días"},hu:{finished:"Befejezve",starting:"Kezdésig",left:"bal",minutes:"perc",hours:"óra",days:"nap"},pt:{finished:"Finalizado",starting:"Começando em",left:"Abandonou",minutes:"Minutos",hours:"Horas",days:"Dias"}},r=(t,s)=>{const r=s;return e[void 0!==r&&i.includes(r)?r:"en"][t]},n=class{constructor(s){t(this,s),this.clientStyling="",this.clientStylingUrl="",this.limitStylingAppends=!1,this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=document.createElement("style");setTimeout((()=>{t.innerHTML=this.clientStylingUrl,this.stylingContainer.prepend(t)}),1)}}getDateTimeDiff(t,s){return(new Date(s).getTime()-new Date(t).getTime())/6e4}getDuration(){const t=new Date;this.tournamentLeftDays=this.getDateTimeDiff(t,this.endDate),this.tournamentUntilStartDays=this.getDateTimeDiff(t,this.startDate),this.showRemain=this.getTextByDiff(this.tournamentLeftDays)}formatDate(t){let s=new Date(t),i=new Intl.DateTimeFormat(this.language,{month:"long"}).format(s);return`${s.getDate()} ${i}, ${s.toLocaleString("en-GB",{hour:"numeric",minute:"numeric"})}, ${s.getUTCFullYear()}`}getTextByDiff(t){if(t<1440){const s=t%60;return[t/60,s,60*(s-Math.floor(s))].map((t=>(t=>{const s=Math.floor(t);return s<10?`0${s}`:`${s}`})(t))).join(":")}return Math.ceil(t/1440)+" "+r("days")}getProgress(){if(this.tournamentLeftDays<=0)return 100;const t=this.getDateTimeDiff(this.startDate,this.endDate);return Math.floor(100/t*(t-this.tournamentLeftDays))}componentWillLoad(){this.startDate&&this.endDate&&(this.getDuration(),this.getTextByDiff(this.tournamentLeftDays))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){if(this.startDate&&this.endDate)return s("div",{ref:t=>this.stylingContainer=t},s("div",{class:"TournamentDuration"},s("div",{class:"TournamentDates"},s("div",{class:"StartDate",part:"StartDate"},this.formatDate(this.startDate)),s("div",{class:"EndDate",part:"EndDate"},this.formatDate(this.endDate))),s("div",{class:"ProgressBarWrapper"},s("div",{class:"ProgressBar",part:"ProgressBar"},"Finished"==this.status||"Closing"==this.status||"Closed"==this.status?s("div",null,s("div",{class:"ProgressBarFillEnd"}),s("div",{class:"Finished",part:"Finished"},r("finished",this.language))):this.tournamentUntilStartDays>0?s("div",null,s("div",{class:"ProgressBarFillStarting"}),s("div",{class:"Remaining",part:"Remaining"},r("starting",this.language)," ",this.getTextByDiff(this.tournamentUntilStartDays))):s("div",null,s("div",{class:"ProgressBarFill",part:"ProgressBarFill",style:{width:`${this.getProgress()}%`}}),this.tournamentLeftDays>0&&s("div",{class:"Remaining",part:"Remaining"},this.showRemain," ",r("left",this.language)))))))}};n.style=":host{display:block}.TournamentDates{display:flex;justify-content:space-between}.StartDate{font-size:10px;font-weight:700;color:var(--emfe-w-color-gray-300, #58586B)}.EndDate{font-size:10px;font-weight:700;align-content:flex-end;color:var(--emfe-w-color-gray-300, #58586B)}.ProgressBar{margin:5px 0;height:8px;background:var(--emfe-w-color-white, #FFFFFF)}.ProgressBarInactive{margin:5px 20px 10px 20px;height:8px;background:var(--emfe-w-color-gray-100, #E6E6E6)}.ProgressBarFill{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillEnd{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillStarting{background-color:var(--emfe-w-color-gray-300, #58586B);height:8px}.Remaining,.Finished{font-size:10px;font-weight:700;padding-top:6px;text-align:right;text-transform:uppercase}.Finished{color:var(--emfe-w-color-green, #48952a)}";export{n as casino_tournament_duration}
|