@vuu-ui/vuu-utils 3.5.19 → 3.5.21

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.19",
2
+ "version": "3.5.21",
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.19",
19
- "@vuu-ui/vuu-table-types": "3.5.19",
20
- "@vuu-ui/vuu-filter-types": "3.5.19",
21
- "@vuu-ui/vuu-protocol-types": "3.5.19"
18
+ "@vuu-ui/vuu-data-types": "3.5.21",
19
+ "@vuu-ui/vuu-table-types": "3.5.21",
20
+ "@vuu-ui/vuu-filter-types": "3.5.21",
21
+ "@vuu-ui/vuu-protocol-types": "3.5.21"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@internationalized/date": "^3.0.0",
25
- "@vuu-ui/vuu-filter-parser": "3.5.19",
25
+ "@vuu-ui/vuu-filter-parser": "3.5.21",
26
26
  "clsx": "^2.0.0",
27
27
  "react": "^19.2.3",
28
28
  "react-dom": "^19.2.3"
@@ -52,8 +52,8 @@ const numericFormatter = ({ align = "right", serverDataType, type })=>{
52
52
  {
53
53
  const { alignOnDecimals = false, decimals, roundingRule, useLocaleString, zeroPad = false } = type.formatting ?? DEFAULT_NUMERIC_FORMAT;
54
54
  return (value)=>{
55
- if (serverDataType?.startsWith("scaleddecimal")) if (null == value) return "";
56
- else if ("string" == typeof value) return roundScaledDecimal(value, align, decimals, zeroPad, alignOnDecimals, useLocaleString, roundingRule);
55
+ if ("long" === serverDataType || serverDataType?.startsWith("scaleddecimal")) if (null == value) return "";
56
+ else if ("string" == typeof value || "long" === serverDataType && "number" == typeof value) return roundScaledDecimal("number" == typeof value ? value.toString() : value, align, decimals, zeroPad, alignOnDecimals, useLocaleString, roundingRule);
57
57
  else throw Error(`[formatting-utils] numericFormatter, invalid data for ${serverDataType}: '${value}'`);
58
58
  if ("string" == typeof value && (value.startsWith("Σ") || value.startsWith("["))) return value;
59
59
  const number = "number" == typeof value ? value : "string" == typeof value ? parseFloat(value) : void 0;
@@ -4,7 +4,10 @@ const DECIMALS_AUTO = -1;
4
4
  const integerFormat = new Intl.NumberFormat();
5
5
  const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER.toString();
6
6
  const MAX_INTEGER_DIGITS = MAX_SAFE_INTEGER.length;
7
- const exceedsMaxSafeInteger = (value)=>value.length > MAX_INTEGER_DIGITS || value.length === MAX_INTEGER_DIGITS && value > MAX_SAFE_INTEGER;
7
+ const exceedsMaxSafeInteger = (value)=>{
8
+ const digits = value.startsWith("-") ? value.slice(1) : value;
9
+ return digits.length > MAX_INTEGER_DIGITS || digits.length === MAX_INTEGER_DIGITS && digits > MAX_SAFE_INTEGER;
10
+ };
8
11
  const roundFraction = (fraction, decimals)=>{
9
12
  const kept = fraction.slice(0, decimals);
10
13
  if (fraction.length <= decimals || fraction[decimals] < "5") return [