mig-schema-table 3.0.76 → 3.0.78

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.
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from "react";
3
3
  import { SELECT_ALL_COLUMN_NAME } from "../constants";
4
4
  import { localeFormatInTimeZone, timeZone } from "../../inc/date";
5
- import { DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, } from "../../inc/constant";
5
+ import { DEFAULT_DATE_TIME_FORMAT, } from "../../inc/constant";
6
6
  import { t } from "../../inc/string";
7
7
  function Td({ checkedIndexes, disabledCheckedIndexes, columnIndex, data, getRowClassName, getRowSelected, onCheckedIndexesChange, onRowClick, onRowDoubleClick, propConfig, propName, propSchema, rowHeight, rowIndex, sortedRenderData, style, }) {
8
8
  const onTdClick = React.useCallback((e) => {
@@ -34,7 +34,7 @@ function Td({ checkedIndexes, disabledCheckedIndexes, columnIndex, data, getRowC
34
34
  }
35
35
  let title = propName === SELECT_ALL_COLUMN_NAME ? null : row[propName];
36
36
  if ((propSchema === null || propSchema === void 0 ? void 0 : propSchema.format) &&
37
- propSchema.format.startsWith("date") &&
37
+ propSchema.format === "date-time" &&
38
38
  (propConfig === null || propConfig === void 0 ? void 0 : propConfig.showTimezones) !== false) {
39
39
  // @ts-ignore
40
40
  const dateString = data[row._index][propName];
@@ -43,9 +43,7 @@ function Td({ checkedIndexes, disabledCheckedIndexes, columnIndex, data, getRowC
43
43
  ? "Asia/Jakarta"
44
44
  : "Europe/Amsterdam";
45
45
  if (date) {
46
- title = `${localeFormatInTimeZone(date, alternativeTimeZone, propSchema.format === "date"
47
- ? DEFAULT_DATE_FORMAT
48
- : DEFAULT_DATE_TIME_FORMAT)} (${t(alternativeTimeZone)})`;
46
+ title = `${localeFormatInTimeZone(date, alternativeTimeZone, DEFAULT_DATE_TIME_FORMAT)} (${t(alternativeTimeZone)})`;
49
47
  }
50
48
  }
51
49
  const classNames = [
@@ -23,7 +23,11 @@ import ThMenu from "./ThMenu";
23
23
  import { saveAs } from "file-saver";
24
24
  import { unparse } from "papaparse";
25
25
  const startOfTheWorldDate = new Date("1000-01-01 00:00:00Z");
26
- const intFormatter = new Intl.NumberFormat("nl-NL");
26
+ const numberFormatter = new Intl.NumberFormat("nl-NL");
27
+ const currencyFormatter = new Intl.NumberFormat("nl-NL", {
28
+ style: "currency",
29
+ currency: "EUR",
30
+ });
27
31
  function getSortByValue(propSchema, propConfig) {
28
32
  var _a;
29
33
  if ((propConfig === null || propConfig === void 0 ? void 0 : propConfig.sortByValue) !== undefined) {
@@ -149,10 +153,16 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
149
153
  case "boolean":
150
154
  prev[propName] = rawValue ? "✓" : "✕";
151
155
  return prev;
156
+ case "number":
152
157
  case "integer":
153
- prev[propName] = [undefined, null].includes(rawValue)
154
- ? ""
155
- : intFormatter.format(rawValue);
158
+ if (rawValue === undefined) {
159
+ prev[propName] = "";
160
+ return prev;
161
+ }
162
+ prev[propName] =
163
+ schema.format === "currency"
164
+ ? currencyFormatter.format(rawValue)
165
+ : numberFormatter.format(rawValue);
156
166
  return prev;
157
167
  // @ts-ignore
158
168
  case "string":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mig-schema-table",
3
- "version": "3.0.76",
3
+ "version": "3.0.78",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/"