@esportsplus/ui 0.3.5 → 0.3.6
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.
|
@@ -2,7 +2,7 @@ import { effect, reactive } from '@esportsplus/reactivity';
|
|
|
2
2
|
import { html } from '@esportsplus/template';
|
|
3
3
|
let formatters = {};
|
|
4
4
|
export default ({ currency, delay, max, value }) => {
|
|
5
|
-
let api = reactive({ value: -1 }), formatter = formatters[currency || 'USD'] ??= new Intl.NumberFormat('en-US', {
|
|
5
|
+
let api = reactive({ value: -1 }), formatter = currency === 'IGNORE' ? undefined : formatters[currency || 'USD'] ??= new Intl.NumberFormat('en-US', {
|
|
6
6
|
style: 'currency',
|
|
7
7
|
currency: currency || 'USD'
|
|
8
8
|
}), rendering = true, state = reactive({
|
|
@@ -13,7 +13,11 @@ export default ({ currency, delay, max, value }) => {
|
|
|
13
13
|
if (api.value !== -1) {
|
|
14
14
|
value = api.value;
|
|
15
15
|
}
|
|
16
|
-
let padding = (max || value).toFixed(2).toString().length - value.toString().length, values =
|
|
16
|
+
let padding = (max || value).toFixed(2).toString().length - value.toString().length, values = value.toString().padStart(value.toString().length + padding, '1');
|
|
17
|
+
if (formatter) {
|
|
18
|
+
values = formatter.format(values);
|
|
19
|
+
}
|
|
20
|
+
values = values.split('');
|
|
17
21
|
state.length = values.length;
|
|
18
22
|
for (let i = 0, n = values.length; i < n; i++) {
|
|
19
23
|
let value = values[i];
|
package/package.json
CHANGED
|
@@ -5,9 +5,9 @@ import { html } from '@esportsplus/template';
|
|
|
5
5
|
let formatters: Record<string, Intl.NumberFormat> = {};
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
export default ({ currency, delay, max, value }: { currency?: 'EUR' | 'GBP' | 'USD', delay?: number, max?: number, value: number }) => {
|
|
8
|
+
export default ({ currency, delay, max, value }: { currency?: 'IGNORE' | 'EUR' | 'GBP' | 'USD', delay?: number, max?: number, value: number }) => {
|
|
9
9
|
let api = reactive({ value: -1 }),
|
|
10
|
-
formatter = formatters[currency || 'USD'] ??= new Intl.NumberFormat('en-US', {
|
|
10
|
+
formatter = currency === 'IGNORE' ? undefined : formatters[currency || 'USD'] ??= new Intl.NumberFormat('en-US', {
|
|
11
11
|
style: 'currency',
|
|
12
12
|
currency: currency || 'USD'
|
|
13
13
|
}),
|
|
@@ -23,9 +23,13 @@ export default ({ currency, delay, max, value }: { currency?: 'EUR' | 'GBP' | 'U
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
let padding = (max || value).toFixed(2).toString().length - value.toString().length,
|
|
26
|
-
values =
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
values = value.toString().padStart( value.toString().length + padding, '1') as any;
|
|
27
|
+
|
|
28
|
+
if (formatter) {
|
|
29
|
+
values = formatter.format(values);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
values = values.split('');
|
|
29
33
|
|
|
30
34
|
state.length = values.length;
|
|
31
35
|
|