@postxl/ui-components 1.5.3 → 1.5.4

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/index.d.ts CHANGED
@@ -791,6 +791,8 @@ type Cell = {
791
791
  prefix?: string | ((row: unknown, value: number | null) => React$36.ReactNode);
792
792
  suffix?: string | ((row: unknown, value: number | null) => React$36.ReactNode);
793
793
  fallbackValue?: string;
794
+ /** Optional formatter for display mode. Takes a number and returns a formatted string. */
795
+ formatter?: (value: number) => string;
794
796
  } | ({
795
797
  variant: 'select';
796
798
  hasSearch?: boolean;
package/dist/index.js CHANGED
@@ -5086,7 +5086,7 @@ function NumberCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isS
5086
5086
  return typeof v === "function" ? v : () => Boolean(v);
5087
5087
  }, [colMeta?.editable]);
5088
5088
  const isEditable = editableResolver(cell.row.original);
5089
- const { min, max, step, prefix, suffix, fallbackValue = "" } = cellOptions?.variant === "number" ? cellOptions : {};
5089
+ const { min, max, step, prefix, suffix, fallbackValue = "", formatter } = cellOptions?.variant === "number" ? cellOptions : {};
5090
5090
  const resolvedPrefix = React$28.useMemo(() => {
5091
5091
  if (typeof prefix === "function") return prefix(cell.row.original, initialValue);
5092
5092
  return prefix ?? null;
@@ -5218,7 +5218,7 @@ function NumberCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isS
5218
5218
  className: cn("tabular-nums", colMeta?.align ?? "text-right"),
5219
5219
  children: initialValue === null || initialValue === void 0 ? fallbackValue : /* @__PURE__ */ jsxs(Fragment, { children: [
5220
5220
  resolvedPrefix,
5221
- initialValue.toLocaleString(),
5221
+ formatter ? formatter(initialValue) : initialValue.toLocaleString(),
5222
5222
  resolvedSuffix
5223
5223
  ] })
5224
5224
  })