trotl-table 1.0.67 → 1.0.68

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/dist/Table.cjs.js CHANGED
@@ -10389,6 +10389,32 @@ function TableInner({
10389
10389
  });
10390
10390
  }
10391
10391
 
10392
+ // Number column type (format decimals) - default two decimals
10393
+ if (col && col.type === 'number') {
10394
+ if (isNoData) {
10395
+ return /*#__PURE__*/React.createElement("span", {
10396
+ title: translate("noData")
10397
+ }, "...");
10398
+ }
10399
+ const rawValue = Number(v);
10400
+ if (Number.isNaN(rawValue)) {
10401
+ return /*#__PURE__*/React.createElement("span", {
10402
+ title: String(v)
10403
+ }, String(v));
10404
+ }
10405
+ let precision = 2;
10406
+ if (col.numberFormat != null) {
10407
+ const nf = Number(col.numberFormat);
10408
+ if (!Number.isNaN(nf) && nf >= 0) {
10409
+ precision = nf;
10410
+ }
10411
+ }
10412
+ const formatted = rawValue.toFixed(precision);
10413
+ return /*#__PURE__*/React.createElement("span", {
10414
+ title: formatted
10415
+ }, formatted);
10416
+ }
10417
+
10392
10418
  // If column has dateFormat, format value as date/time
10393
10419
  if (col && col.dateFormat && v) {
10394
10420
  let dateObj = null;