@bento-core/table 1.0.0-c3dc.3 → 1.0.0-c3dc.5

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.
@@ -61,7 +61,7 @@ const ExtendedView = _ref => {
61
61
  onColumnViewChange: onColumnViewChange
62
62
  })), pagination && /*#__PURE__*/_react.default.createElement("div", {
63
63
  className: "downloadArea",
64
- style: downloadAreaStyle
64
+ style: table.paginationCustomStyle && table.paginationCustomStyle.topPagination ? table.paginationCustomStyle.topPagination : downloadAreaStyle
65
65
  }, /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
66
66
  customTheme: customTheme.tblTopPgn,
67
67
  rowsPerPageOptions: [10, 25, 50, 100],
package/dist/TableView.js CHANGED
@@ -18,8 +18,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
18
18
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
19
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
20
20
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
21
- // import DownloadButton from './toolbar/DownloadButtonView';
22
-
23
21
  const CustomTableContainer = props => {
24
22
  const {
25
23
  children,
@@ -93,7 +91,7 @@ const TableView = _ref => {
93
91
  table: table
94
92
  }), /*#__PURE__*/_react.default.createElement("div", {
95
93
  className: "downloadArea",
96
- style: table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : downloadAreaStyle
94
+ style: table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : table.paginationCustomStyle && table.paginationCustomStyle.bottomPagination ? table.paginationCustomStyle.bottomPagination : downloadAreaStyle
97
95
  }, /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
98
96
  customTheme: themeConfig.tblPgn,
99
97
  rowsPerPageOptions: [10, 25, 50, 100],
@@ -44,6 +44,9 @@ const ViewCell = _ref2 => {
44
44
  const {
45
45
  cellType
46
46
  } = column;
47
+ function isNumeric(value) {
48
+ return /^-?\d+\.?\d*$/.test(value);
49
+ }
47
50
  switch (cellType) {
48
51
  case _Types.cellTypes.FORMAT_DATA:
49
52
  return /*#__PURE__*/_react.default.createElement(_DataFormatView.default, {
@@ -60,6 +63,8 @@ const ViewCell = _ref2 => {
60
63
  row: row,
61
64
  column: column
62
65
  });
66
+ case _Types.cellTypes.COMMA:
67
+ return /*#__PURE__*/_react.default.createElement(_core.Typography, null, isNumeric(row[column.dataField]) ? Number(row[column.dataField]).toLocaleString() : row[column.dataField]);
63
68
  default:
64
69
  return /*#__PURE__*/_react.default.createElement(_core.Typography, null, row[column.dataField]);
65
70
  }
@@ -20,7 +20,7 @@ const CustomLinkView = _ref => {
20
20
  rootPath,
21
21
  pathParams
22
22
  } = column === null || column === void 0 ? void 0 : column.linkAttr;
23
- const url = pathParams.map(attr => "#".concat(rootPath, "/").concat(row[attr]));
23
+ const url = pathParams.map(attr => "".concat(rootPath, "/").concat(row[attr]));
24
24
  return /*#__PURE__*/_react.default.createElement(_core.Link, {
25
25
  href: url,
26
26
  className: _Types.cellTypes.LINK
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.headerTypes = exports.dataFormatTypes = exports.cellTypes = exports.cellStyles = exports.actionCellTypes = exports.TRANSFORM = exports.LINK = exports.FORMAT_DATA_CELLS = exports.FORMAT_DATA = exports.FORMAT_BYTES = exports.EXPAND = exports.DISPLAY = exports.DELETE = exports.DEFAULT = exports.ComponentTypes = exports.CUSTOM_ELEM = exports.CHECKBOX = void 0;
6
+ exports.headerTypes = exports.dataFormatTypes = exports.cellTypes = exports.cellStyles = exports.actionCellTypes = exports.TRANSFORM = exports.LINK = exports.FORMAT_DATA_CELLS = exports.FORMAT_DATA = exports.FORMAT_BYTES = exports.EXPAND = exports.DISPLAY = exports.DELETE = exports.DEFAULT = exports.ComponentTypes = exports.CUSTOM_ELEM = exports.COMMA = exports.CHECKBOX = void 0;
7
7
  const CHECKBOX = 'CHECKBOX';
8
8
  exports.CHECKBOX = CHECKBOX;
9
9
  const DELETE = 'DELETE';
@@ -24,6 +24,8 @@ const TRANSFORM = 'TRANSFORM';
24
24
  exports.TRANSFORM = TRANSFORM;
25
25
  const EXPAND = 'EXPAND';
26
26
  exports.EXPAND = EXPAND;
27
+ const COMMA = 'COMMA';
28
+ exports.COMMA = COMMA;
27
29
  const cellTypes = {
28
30
  CUSTOM_ELEM,
29
31
  LINK,
@@ -31,7 +33,8 @@ const cellTypes = {
31
33
  CHECKBOX,
32
34
  DELETE,
33
35
  DEFAULT,
34
- FORMAT_DATA
36
+ FORMAT_DATA,
37
+ COMMA
35
38
  };
36
39
  exports.cellTypes = cellTypes;
37
40
  const cellStyles = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.0-c3dc.3",
3
+ "version": "1.0.0-c3dc.5",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
@@ -55,7 +55,7 @@ const ExtendedView = ({
55
55
  )}
56
56
  {
57
57
  (pagination) && (
58
- <div className="downloadArea" style={downloadAreaStyle}>
58
+ <div className="downloadArea" style={(table.paginationCustomStyle && table.paginationCustomStyle.topPagination) ? table.paginationCustomStyle.topPagination : downloadAreaStyle}>
59
59
  <CustomPagination
60
60
  customTheme={customTheme.tblTopPgn}
61
61
  rowsPerPageOptions={[10, 25, 50, 100]}
package/src/TableView.js CHANGED
@@ -12,7 +12,6 @@ import CustomTableBody from './body/CustomTblBody';
12
12
  import CustomToolbar from './toolbar/CustomToolbar';
13
13
  import DisplayErrMsg from './errMsg/DisplayErrMsg';
14
14
  import ExtendedView from './ExtendedView';
15
- // import DownloadButton from './toolbar/DownloadButtonView';
16
15
 
17
16
  const CustomTableContainer = (props) => {
18
17
  const { children, customTheme } = props;
@@ -95,7 +94,7 @@ const TableView = ({
95
94
  table={table}
96
95
  />
97
96
  )}
98
- <div className="downloadArea" style={table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : downloadAreaStyle}>
97
+ <div className="downloadArea" style={table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : (table.paginationCustomStyle && table.paginationCustomStyle.bottomPagination) ? table.paginationCustomStyle.bottomPagination : downloadAreaStyle}>
99
98
  <CustomPagination
100
99
  customTheme={themeConfig.tblPgn}
101
100
  rowsPerPageOptions={[10, 25, 50, 100]}
@@ -106,11 +105,6 @@ const TableView = ({
106
105
  onPageChange={onPageChange}
107
106
  onRowsPerPageChange={onRowsPerPageChange}
108
107
  />
109
- {/* <DownloadButton
110
- count={table.totalRowCount || 0}
111
- queryVariables={queryVariables}
112
- table={table}
113
- /> */}
114
108
  </div>
115
109
  </>
116
110
  );
@@ -31,6 +31,9 @@ const ViewCell = ({
31
31
  row,
32
32
  }) => {
33
33
  const { cellType } = column;
34
+ function isNumeric(value) {
35
+ return /^-?\d+\.?\d*$/.test(value);
36
+ }
34
37
  switch (cellType) {
35
38
  case cellTypes.FORMAT_DATA:
36
39
  return (
@@ -53,6 +56,14 @@ const ViewCell = ({
53
56
  column={column}
54
57
  />
55
58
  );
59
+ case cellTypes.COMMA:
60
+ return (
61
+ <Typography>
62
+ {isNumeric(row[column.dataField])
63
+ ? Number(row[column.dataField]).toLocaleString()
64
+ : row[column.dataField]}
65
+ </Typography>
66
+ );
56
67
  default:
57
68
  return (
58
69
  <Typography>
@@ -12,7 +12,7 @@ const CustomLinkView = ({
12
12
  row,
13
13
  }) => {
14
14
  const { rootPath, pathParams } = column?.linkAttr;
15
- const url = pathParams.map((attr) => `#${rootPath}/`.concat(row[attr]));
15
+ const url = pathParams.map((attr) => `${rootPath}/`.concat(row[attr]));
16
16
  return (
17
17
  <Link href={url} className={cellTypes.LINK}>
18
18
  <Typography>
package/src/util/Types.js CHANGED
@@ -8,6 +8,7 @@ export const FORMAT_DATA = 'FORMAT_DATA';
8
8
  export const FORMAT_BYTES = 'FORMAT_BYTES';
9
9
  export const TRANSFORM = 'TRANSFORM';
10
10
  export const EXPAND = 'EXPAND';
11
+ export const COMMA = 'COMMA';
11
12
 
12
13
  export const cellTypes = {
13
14
  CUSTOM_ELEM,
@@ -17,6 +18,7 @@ export const cellTypes = {
17
18
  DELETE,
18
19
  DEFAULT,
19
20
  FORMAT_DATA,
21
+ COMMA,
20
22
  };
21
23
 
22
24
  export const cellStyles = {