1 | import {
|
2 | LocalizeController
|
3 | } from "./chunk.6WMYSCDC.js";
|
4 | import {
|
5 | e,
|
6 | n
|
7 | } from "./chunk.VKNZYXSO.js";
|
8 | import {
|
9 | s
|
10 | } from "./chunk.WWAD5WF4.js";
|
11 | import {
|
12 | __decorateClass
|
13 | } from "./chunk.K2NRSETB.js";
|
14 |
|
15 |
|
16 | var SlFormatNumber = class extends s {
|
17 | constructor() {
|
18 | super(...arguments);
|
19 | this.localize = new LocalizeController(this);
|
20 | this.value = 0;
|
21 | this.type = "decimal";
|
22 | this.noGrouping = false;
|
23 | this.currency = "USD";
|
24 | this.currencyDisplay = "symbol";
|
25 | }
|
26 | render() {
|
27 | if (isNaN(this.value)) {
|
28 | return "";
|
29 | }
|
30 | return this.localize.number(this.value, {
|
31 | style: this.type,
|
32 | currency: this.currency,
|
33 | currencyDisplay: this.currencyDisplay,
|
34 | useGrouping: !this.noGrouping,
|
35 | minimumIntegerDigits: this.minimumIntegerDigits,
|
36 | minimumFractionDigits: this.minimumFractionDigits,
|
37 | maximumFractionDigits: this.maximumFractionDigits,
|
38 | minimumSignificantDigits: this.minimumSignificantDigits,
|
39 | maximumSignificantDigits: this.maximumSignificantDigits
|
40 | });
|
41 | }
|
42 | };
|
43 | __decorateClass([
|
44 | e({ type: Number })
|
45 | ], SlFormatNumber.prototype, "value", 2);
|
46 | __decorateClass([
|
47 | e()
|
48 | ], SlFormatNumber.prototype, "lang", 2);
|
49 | __decorateClass([
|
50 | e()
|
51 | ], SlFormatNumber.prototype, "type", 2);
|
52 | __decorateClass([
|
53 | e({ attribute: "no-grouping", type: Boolean })
|
54 | ], SlFormatNumber.prototype, "noGrouping", 2);
|
55 | __decorateClass([
|
56 | e()
|
57 | ], SlFormatNumber.prototype, "currency", 2);
|
58 | __decorateClass([
|
59 | e({ attribute: "currency-display" })
|
60 | ], SlFormatNumber.prototype, "currencyDisplay", 2);
|
61 | __decorateClass([
|
62 | e({ attribute: "minimum-integer-digits", type: Number })
|
63 | ], SlFormatNumber.prototype, "minimumIntegerDigits", 2);
|
64 | __decorateClass([
|
65 | e({ attribute: "minimum-fraction-digits", type: Number })
|
66 | ], SlFormatNumber.prototype, "minimumFractionDigits", 2);
|
67 | __decorateClass([
|
68 | e({ attribute: "maximum-fraction-digits", type: Number })
|
69 | ], SlFormatNumber.prototype, "maximumFractionDigits", 2);
|
70 | __decorateClass([
|
71 | e({ attribute: "minimum-significant-digits", type: Number })
|
72 | ], SlFormatNumber.prototype, "minimumSignificantDigits", 2);
|
73 | __decorateClass([
|
74 | e({ attribute: "maximum-significant-digits", type: Number })
|
75 | ], SlFormatNumber.prototype, "maximumSignificantDigits", 2);
|
76 | SlFormatNumber = __decorateClass([
|
77 | n("sl-format-number")
|
78 | ], SlFormatNumber);
|
79 |
|
80 | export {
|
81 | SlFormatNumber
|
82 | };
|