@esportsplus/ui 0.3.6 → 0.3.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.
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
declare const _default: ({ currency, delay, max, value }: {
|
|
1
|
+
declare const _default: ({ currency, delay, max, suffix, value }: {
|
|
2
2
|
currency?: "IGNORE" | "EUR" | "GBP" | "USD";
|
|
3
3
|
delay?: number;
|
|
4
4
|
max?: number;
|
|
5
|
+
suffix?: string;
|
|
5
6
|
value: number;
|
|
6
7
|
}) => {
|
|
7
8
|
html: import("@esportsplus/template/build/types").RenderableTemplate;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { effect, reactive } from '@esportsplus/reactivity';
|
|
2
2
|
import { html } from '@esportsplus/template';
|
|
3
3
|
let formatters = {};
|
|
4
|
-
export default ({ currency, delay, max, value }) => {
|
|
4
|
+
export default ({ currency, delay, max, suffix, value }) => {
|
|
5
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'
|
|
@@ -17,7 +17,13 @@ export default ({ currency, delay, max, value }) => {
|
|
|
17
17
|
if (formatter) {
|
|
18
18
|
values = formatter.format(values);
|
|
19
19
|
}
|
|
20
|
+
else {
|
|
21
|
+
values = values.toLocaleString();
|
|
22
|
+
}
|
|
20
23
|
values = values.split('');
|
|
24
|
+
if (suffix) {
|
|
25
|
+
values.push(' ', ...suffix.split(''));
|
|
26
|
+
}
|
|
21
27
|
state.length = values.length;
|
|
22
28
|
for (let i = 0, n = values.length; i < n; i++) {
|
|
23
29
|
let value = values[i];
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ 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?: 'IGNORE' | 'EUR' | 'GBP' | 'USD', delay?: number, max?: number, value: number }) => {
|
|
8
|
+
export default ({ currency, delay, max, suffix, value }: { currency?: 'IGNORE' | 'EUR' | 'GBP' | 'USD', delay?: number, max?: number, suffix?: string, value: number }) => {
|
|
9
9
|
let api = reactive({ value: -1 }),
|
|
10
10
|
formatter = currency === 'IGNORE' ? undefined : formatters[currency || 'USD'] ??= new Intl.NumberFormat('en-US', {
|
|
11
11
|
style: 'currency',
|
|
@@ -28,9 +28,16 @@ export default ({ currency, delay, max, value }: { currency?: 'IGNORE' | 'EUR' |
|
|
|
28
28
|
if (formatter) {
|
|
29
29
|
values = formatter.format(values);
|
|
30
30
|
}
|
|
31
|
+
else {
|
|
32
|
+
values = values.toLocaleString();
|
|
33
|
+
}
|
|
31
34
|
|
|
32
35
|
values = values.split('');
|
|
33
36
|
|
|
37
|
+
if (suffix) {
|
|
38
|
+
values.push(' ', ...suffix.split(''));
|
|
39
|
+
}
|
|
40
|
+
|
|
34
41
|
state.length = values.length;
|
|
35
42
|
|
|
36
43
|
for (let i = 0, n = values.length; i < n; i++) {
|