qbs-react-grid 1.1.12 → 1.1.14

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.
@@ -73,7 +73,7 @@ export var ExpandCell = /*#__PURE__*/React.memo(function (_ref3) {
73
73
  }) ? '-' : '+'));
74
74
  });
75
75
  export var CustomTableCell = /*#__PURE__*/React.memo(function (_ref4) {
76
- var _renderCell, _renderCell2, _renderCell3;
76
+ var _renderCell, _path, _renderCell2, _renderCell3;
77
77
  var rowData = _ref4.rowData,
78
78
  renderCell = _ref4.renderCell,
79
79
  toolTip = _ref4.toolTip,
@@ -92,7 +92,7 @@ export var CustomTableCell = /*#__PURE__*/React.memo(function (_ref4) {
92
92
  },
93
93
  className: "qbs-table-row-link"
94
94
  }, renderCell ? (_renderCell = renderCell(rowData)) === null || _renderCell === void 0 ? void 0 : _renderCell.cell : handleCellFormat(rowData[dataKey], type)) : path ? /*#__PURE__*/React.createElement(Link, {
95
- to: path,
95
+ to: (_path = path === null || path === void 0 ? void 0 : path(rowData)) != null ? _path : '',
96
96
  className: "qbs-table-row-link"
97
97
  }, renderCell ? (_renderCell2 = renderCell(rowData)) === null || _renderCell2 === void 0 ? void 0 : _renderCell2.cell : handleCellFormat(rowData[dataKey], type)) : /*#__PURE__*/React.createElement(React.Fragment, null, renderCell ? (_renderCell3 = renderCell(rowData)) === null || _renderCell3 === void 0 ? void 0 : _renderCell3.cell : handleCellFormat(rowData[dataKey], type))));
98
98
  });
@@ -311,7 +311,7 @@ var QbsTable = function QbsTable(_ref) {
311
311
  renderCell = _ref3.renderCell,
312
312
  isVisible = _ref3.isVisible,
313
313
  link = _ref3.link,
314
- path = _ref3.path,
314
+ getPath = _ref3.getPath,
315
315
  rowClick = _ref3.rowClick,
316
316
  sortKey = _ref3.sortKey,
317
317
  type = _ref3.type;
@@ -341,7 +341,7 @@ var QbsTable = function QbsTable(_ref) {
341
341
  dataKey: child.field,
342
342
  dataTheme: dataTheme,
343
343
  type: child.type,
344
- path: child.path,
344
+ path: child.getPath,
345
345
  link: child.link
346
346
  }) : /*#__PURE__*/React.createElement(Cell, {
347
347
  className: " " + classes.cellClass,
@@ -366,7 +366,7 @@ var QbsTable = function QbsTable(_ref) {
366
366
  dataKey: field,
367
367
  rowClick: rowClick,
368
368
  type: type,
369
- path: path,
369
+ path: getPath,
370
370
  dataTheme: dataTheme,
371
371
  link: link
372
372
  }) : /*#__PURE__*/React.createElement(Cell, {
@@ -458,7 +458,7 @@ var QbsTable = function QbsTable(_ref) {
458
458
  className: "" + classes.tableCheckBoxClass,
459
459
  onChange: handleCheck,
460
460
  dataTheme: dataTheme
461
- })), columnsRendered, actionProps && (actionProps === null || actionProps === void 0 ? void 0 : actionProps.length) > 0 && /*#__PURE__*/React.createElement(Column, {
461
+ })), columnsRendered, (actionProps && (actionProps === null || actionProps === void 0 ? void 0 : actionProps.length) > 0 || columnToggle) && /*#__PURE__*/React.createElement(Column, {
462
462
  width: 40,
463
463
  fixed: "right"
464
464
  }, /*#__PURE__*/React.createElement(HeaderCell, {
@@ -472,7 +472,7 @@ var QbsTable = function QbsTable(_ref) {
472
472
  isOpen: isOpen,
473
473
  setIsOpen: setIsOpen,
474
474
  handleResetColumns: handleResetColumns
475
- })), /*#__PURE__*/React.createElement(ActionCell, {
475
+ })), actionProps && (actionProps === null || actionProps === void 0 ? void 0 : actionProps.length) > 0 && /*#__PURE__*/React.createElement(ActionCell, {
476
476
  actionProps: actionProps,
477
477
  className: classes.cellClass + " " + classes.actionCellClass,
478
478
  handleMenuActions: handleMenuActions,
@@ -18,7 +18,7 @@ export interface ColumnBase {
18
18
  rowClick?: (rowData: any) => void;
19
19
  sortKey?: string;
20
20
  type?: string;
21
- path?: string;
21
+ getPath?: (data: any) => string;
22
22
  }
23
23
  export interface QbsColumnProps extends ColumnBase {
24
24
  grouped?: boolean;
@@ -81,7 +81,7 @@ var ExpandCell = /*#__PURE__*/_react["default"].memo(function (_ref3) {
81
81
  });
82
82
  exports.ExpandCell = ExpandCell;
83
83
  var CustomTableCell = /*#__PURE__*/_react["default"].memo(function (_ref4) {
84
- var _renderCell, _renderCell2, _renderCell3;
84
+ var _renderCell, _path, _renderCell2, _renderCell3;
85
85
  var rowData = _ref4.rowData,
86
86
  renderCell = _ref4.renderCell,
87
87
  toolTip = _ref4.toolTip,
@@ -100,7 +100,7 @@ var CustomTableCell = /*#__PURE__*/_react["default"].memo(function (_ref4) {
100
100
  },
101
101
  className: "qbs-table-row-link"
102
102
  }, renderCell ? (_renderCell = renderCell(rowData)) === null || _renderCell === void 0 ? void 0 : _renderCell.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type)) : path ? /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
103
- to: path,
103
+ to: (_path = path === null || path === void 0 ? void 0 : path(rowData)) != null ? _path : '',
104
104
  className: "qbs-table-row-link"
105
105
  }, renderCell ? (_renderCell2 = renderCell(rowData)) === null || _renderCell2 === void 0 ? void 0 : _renderCell2.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, renderCell ? (_renderCell3 = renderCell(rowData)) === null || _renderCell3 === void 0 ? void 0 : _renderCell3.cell : (0, _handleFormatCell.handleCellFormat)(rowData[dataKey], type))));
106
106
  });
@@ -318,7 +318,7 @@ var QbsTable = function QbsTable(_ref) {
318
318
  renderCell = _ref3.renderCell,
319
319
  isVisible = _ref3.isVisible,
320
320
  link = _ref3.link,
321
- path = _ref3.path,
321
+ getPath = _ref3.getPath,
322
322
  rowClick = _ref3.rowClick,
323
323
  sortKey = _ref3.sortKey,
324
324
  type = _ref3.type;
@@ -348,7 +348,7 @@ var QbsTable = function QbsTable(_ref) {
348
348
  dataKey: child.field,
349
349
  dataTheme: dataTheme,
350
350
  type: child.type,
351
- path: child.path,
351
+ path: child.getPath,
352
352
  link: child.link
353
353
  }) : /*#__PURE__*/_react["default"].createElement(_Cell["default"], {
354
354
  className: " " + classes.cellClass,
@@ -373,7 +373,7 @@ var QbsTable = function QbsTable(_ref) {
373
373
  dataKey: field,
374
374
  rowClick: rowClick,
375
375
  type: type,
376
- path: path,
376
+ path: getPath,
377
377
  dataTheme: dataTheme,
378
378
  link: link
379
379
  }) : /*#__PURE__*/_react["default"].createElement(_Cell["default"], {
@@ -465,7 +465,7 @@ var QbsTable = function QbsTable(_ref) {
465
465
  className: "" + classes.tableCheckBoxClass,
466
466
  onChange: handleCheck,
467
467
  dataTheme: dataTheme
468
- })), columnsRendered, actionProps && (actionProps === null || actionProps === void 0 ? void 0 : actionProps.length) > 0 && /*#__PURE__*/_react["default"].createElement(_Column["default"], {
468
+ })), columnsRendered, (actionProps && (actionProps === null || actionProps === void 0 ? void 0 : actionProps.length) > 0 || columnToggle) && /*#__PURE__*/_react["default"].createElement(_Column["default"], {
469
469
  width: 40,
470
470
  fixed: "right"
471
471
  }, /*#__PURE__*/_react["default"].createElement(_HeaderCell["default"], {
@@ -479,7 +479,7 @@ var QbsTable = function QbsTable(_ref) {
479
479
  isOpen: isOpen,
480
480
  setIsOpen: setIsOpen,
481
481
  handleResetColumns: handleResetColumns
482
- })), /*#__PURE__*/_react["default"].createElement(_CustomTableCell.ActionCell, {
482
+ })), actionProps && (actionProps === null || actionProps === void 0 ? void 0 : actionProps.length) > 0 && /*#__PURE__*/_react["default"].createElement(_CustomTableCell.ActionCell, {
483
483
  actionProps: actionProps,
484
484
  className: classes.cellClass + " " + classes.actionCellClass,
485
485
  handleMenuActions: handleMenuActions,
@@ -18,7 +18,7 @@ export interface ColumnBase {
18
18
  rowClick?: (rowData: any) => void;
19
19
  sortKey?: string;
20
20
  type?: string;
21
- path?: string;
21
+ getPath?: (data: any) => string;
22
22
  }
23
23
  export interface QbsColumnProps extends ColumnBase {
24
24
  grouped?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qbs-react-grid",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "A React table component",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -70,7 +70,7 @@ export const CustomTableCell: React.FC<any> = React.memo(
70
70
  {renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}
71
71
  </a>
72
72
  ) : path ? (
73
- <Link to={path} className="qbs-table-row-link">
73
+ <Link to={path?.(rowData) ?? ''} className="qbs-table-row-link">
74
74
  {renderCell ? renderCell(rowData)?.cell : handleCellFormat(rowData[dataKey], type)}
75
75
  </Link>
76
76
  ) : (
@@ -308,7 +308,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
308
308
  renderCell,
309
309
  isVisible,
310
310
  link,
311
- path,
311
+ getPath,
312
312
  rowClick,
313
313
  sortKey,
314
314
  type
@@ -349,7 +349,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
349
349
  dataKey={child.field}
350
350
  dataTheme={dataTheme}
351
351
  type={child.type}
352
- path={child.path}
352
+ path={child.getPath}
353
353
  link={child.link}
354
354
  />
355
355
  ) : (
@@ -387,7 +387,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
387
387
  dataKey={field}
388
388
  rowClick={rowClick}
389
389
  type={type}
390
- path={path}
390
+ path={getPath}
391
391
  dataTheme={dataTheme}
392
392
  link={link}
393
393
  />
@@ -498,7 +498,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
498
498
  )}
499
499
  {columnsRendered}
500
500
 
501
- {actionProps && actionProps?.length > 0 && (
501
+ {((actionProps && actionProps?.length > 0) || columnToggle) && (
502
502
  <Column width={40} fixed="right">
503
503
  <HeaderCell
504
504
  verticalAlign={findGrouped() ? 'middle' : undefined}
@@ -518,12 +518,14 @@ const QbsTable: React.FC<QbsTableProps> = ({
518
518
  />
519
519
  )}
520
520
  </HeaderCell>
521
- <ActionCell
522
- actionProps={actionProps}
523
- className={`${classes.cellClass} ${classes.actionCellClass}`}
524
- handleMenuActions={handleMenuActions}
525
- dataTheme={dataTheme}
526
- />
521
+ {actionProps && actionProps?.length > 0 && (
522
+ <ActionCell
523
+ actionProps={actionProps}
524
+ className={`${classes.cellClass} ${classes.actionCellClass}`}
525
+ handleMenuActions={handleMenuActions}
526
+ dataTheme={dataTheme}
527
+ />
528
+ )}
527
529
  </Column>
528
530
  )}
529
531
  </Table>
@@ -19,7 +19,7 @@ export interface ColumnBase {
19
19
  rowClick?: (rowData: any) => void;
20
20
  sortKey?: string;
21
21
  type?: string;
22
- path?: string;
22
+ getPath?: (data: any) => string;
23
23
  }
24
24
 
25
25
  export interface QbsColumnProps extends ColumnBase {