@megha-ui/react 1.2.187 → 1.2.188
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,21 @@
|
|
|
1
1
|
import { isValidDateFormat } from "../components/grid/utils/regexUtils";
|
|
2
2
|
// Function to format numbers
|
|
3
3
|
const formatNumber = (value, locale = "sv-SE", options) => {
|
|
4
|
-
|
|
4
|
+
var _a;
|
|
5
|
+
const { compactDisplay, notation, signDisplay, unit, unitDisplay, currencySign, minimumFractionDigits, maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits, } = options !== null && options !== void 0 ? options : {};
|
|
6
|
+
const formatter = new Intl.NumberFormat(locale, {
|
|
7
|
+
style: (_a = options.Numberstyle) !== null && _a !== void 0 ? _a : "decimal",
|
|
8
|
+
compactDisplay,
|
|
9
|
+
notation,
|
|
10
|
+
signDisplay,
|
|
11
|
+
unit,
|
|
12
|
+
unitDisplay,
|
|
13
|
+
currencySign,
|
|
14
|
+
minimumFractionDigits,
|
|
15
|
+
maximumFractionDigits,
|
|
16
|
+
minimumSignificantDigits,
|
|
17
|
+
maximumSignificantDigits,
|
|
18
|
+
});
|
|
5
19
|
return formatter.format(value);
|
|
6
20
|
};
|
|
7
21
|
// ISO-like string including local time (no timezone)
|
|
@@ -150,7 +164,10 @@ const formatCurrency = (value, locale = "sv-SE", currency = "SEK", options) => {
|
|
|
150
164
|
}
|
|
151
165
|
catch (_a) {
|
|
152
166
|
// 3) Final fallback: minimal currency formatting
|
|
153
|
-
const fmt = new Intl.NumberFormat(locale, {
|
|
167
|
+
const fmt = new Intl.NumberFormat(locale, {
|
|
168
|
+
style: "currency",
|
|
169
|
+
currency: code,
|
|
170
|
+
});
|
|
154
171
|
return fmt.format(value);
|
|
155
172
|
}
|
|
156
173
|
}
|
package/package.json
CHANGED