@vuu-ui/vuu-utils 3.5.16 → 3.5.17

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.5.16",
2
+ "version": "3.5.17",
3
3
  "author": "heswell",
4
4
  "main": "./src/index.js",
5
5
  "license": "Apache-2.0",
@@ -15,14 +15,14 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@dnd-kit/react": "^0.1.21",
18
- "@vuu-ui/vuu-data-types": "3.5.16",
19
- "@vuu-ui/vuu-table-types": "3.5.16",
20
- "@vuu-ui/vuu-filter-types": "3.5.16",
21
- "@vuu-ui/vuu-protocol-types": "3.5.16"
18
+ "@vuu-ui/vuu-data-types": "3.5.17",
19
+ "@vuu-ui/vuu-table-types": "3.5.17",
20
+ "@vuu-ui/vuu-filter-types": "3.5.17",
21
+ "@vuu-ui/vuu-protocol-types": "3.5.17"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@internationalized/date": "^3.0.0",
25
- "@vuu-ui/vuu-filter-parser": "3.5.16",
25
+ "@vuu-ui/vuu-filter-parser": "3.5.17",
26
26
  "clsx": "^2.0.0",
27
27
  "react": "^19.2.3",
28
28
  "react-dom": "^19.2.3"
@@ -1,6 +1,7 @@
1
1
  const PUNCTUATION_STR = String.fromCharCode(8200);
2
2
  const DIGIT_STR = String.fromCharCode(8199);
3
3
  const DECIMALS_AUTO = -1;
4
+ const integerFormat = new Intl.NumberFormat();
4
5
  const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER.toString();
5
6
  const MAX_INTEGER_DIGITS = MAX_SAFE_INTEGER.length;
6
7
  const exceedsMaxSafeInteger = (value)=>value.length > MAX_INTEGER_DIGITS || value.length === MAX_INTEGER_DIGITS && value > MAX_SAFE_INTEGER;
@@ -70,7 +71,7 @@ function roundDecimal(value, align = Align.Right, decimals = 4, zeroPad, alignOn
70
71
  const [whole, part2 = ""] = value.toString().split(".");
71
72
  const part1 = carriesIntoIntegral(part2, decimals, roundingRule) ? incrementIntegral(whole) : whole;
72
73
  const actualDecimals = part2.length;
73
- integral = "-0" === part1 ? "-0" : useLocaleString ? parseFloat(part1).toLocaleString() : parseFloat(part1).toString();
74
+ integral = "-0" === part1 ? "-0" : useLocaleString ? integerFormat.format(parseFloat(part1)) : parseFloat(part1).toString();
74
75
  if (align === Align.Left && alignOnDecimals) integral = padLeft(integral);
75
76
  fraction = decimals === DECIMALS_AUTO || actualDecimals === decimals ? part2 : actualDecimals > decimals ? "round" === roundingRule ? parseFloat("0." + part2).toFixed(decimals).slice(2) : part2.slice(0, decimals) : (Pad = zeroPad ? Zero : alignOnDecimals && align !== Align.Left ? Space : null) ? 0 === actualDecimals ? Pad.FULL_PADDING[decimals] ?? "" : pad(part2, decimals, Pad) : part2;
76
77
  return integral + (fraction ? "." + fraction : "");
@@ -83,7 +84,7 @@ function roundScaledDecimal(value, align = Align.Right, decimals = 4, zeroPad, a
83
84
  const [whole, part2 = ""] = value.split(".");
84
85
  const part1 = carriesIntoIntegral(part2, decimals, roundingRule) ? incrementIntegral(whole) : whole;
85
86
  const actualDecimals = part2.length;
86
- integral = "" === part1 ? "0" : "-0" === part1 ? "-0" : useLocaleString ? exceedsMaxSafeInteger(value) ? BigInt(part1).toLocaleString() : parseFloat(part1).toLocaleString() : part1;
87
+ integral = "" === part1 ? "0" : "-0" === part1 ? "-0" : useLocaleString ? exceedsMaxSafeInteger(value) ? integerFormat.format(BigInt(part1)) : integerFormat.format(parseFloat(part1)) : part1;
87
88
  if (align === Align.Left && alignOnDecimals) integral = padLeft(integral);
88
89
  fraction = decimals === DECIMALS_AUTO || actualDecimals === decimals ? part2 : actualDecimals > decimals ? "round" === roundingRule ? parseFloat("0." + part2).toFixed(decimals).slice(2) : part2.slice(0, decimals) : (Pad = zeroPad ? Zero : alignOnDecimals && align !== Align.Left ? Space : null) ? 0 === actualDecimals ? Pad.FULL_PADDING[decimals] ?? "" : pad(part2, decimals, Pad) : part2;
89
90
  return integral + (fraction ? "." + fraction : "");