@bento-core/table 1.0.1-ins.8 → 1.0.1-popsci.0

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.
@@ -16,20 +16,16 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
16
16
  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; }
17
17
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
18
  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); }
19
- const downloadAreaStyle = {
20
- display: 'flex',
21
- paddingRight: '41px',
22
- float: 'right'
23
- };
24
19
  const ExtendedView = _ref => {
25
20
  let {
26
21
  table,
22
+ rows,
27
23
  onColumnViewChange,
28
24
  onRowsPerPageChange,
29
25
  onPageChange,
30
- numSelected = 0,
31
26
  customTheme,
32
- queryVariables
27
+ queryVariables,
28
+ server
33
29
  } = _ref;
34
30
  const {
35
31
  extendedViewConfig
@@ -47,16 +43,19 @@ const ExtendedView = _ref => {
47
43
  });
48
44
  return /*#__PURE__*/_react.default.createElement(_core.ThemeProvider, {
49
45
  theme: themeConfig
50
- }, numSelected === 0 && (download || manageViewColumns) && /*#__PURE__*/_react.default.createElement(_core.Toolbar, {
51
- className: "downloadColumnView"
52
- }, /*#__PURE__*/_react.default.createElement(_ManageColumnView.default, {
46
+ }, (download || manageViewColumns) && /*#__PURE__*/_react.default.createElement(_core.Toolbar, {
47
+ className: "downloadAndColumnView"
48
+ }, /*#__PURE__*/_react.default.createElement(_DownloadButtonView.default, {
49
+ download: download,
50
+ rows: rows,
51
+ server: server,
52
+ table: table,
53
+ queryVariables: queryVariables
54
+ }), /*#__PURE__*/_react.default.createElement(_ManageColumnView.default, {
53
55
  table: table,
54
56
  manageViewColumns: manageViewColumns,
55
57
  onColumnViewChange: onColumnViewChange
56
- })), pagination && /*#__PURE__*/_react.default.createElement("div", {
57
- className: "downloadArea",
58
- style: downloadAreaStyle
59
- }, /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
58
+ })), pagination && /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
60
59
  customTheme: customTheme.tblTopPgn,
61
60
  rowsPerPageOptions: [10, 25, 50, 100],
62
61
  component: "div",
@@ -64,14 +63,8 @@ const ExtendedView = _ref => {
64
63
  rowsPerPage: table.rowsPerPage || 10,
65
64
  page: table.page || 0,
66
65
  onPageChange: onPageChange,
67
- onRowsPerPageChange: onRowsPerPageChange,
68
- queryVariables: queryVariables,
69
- table: table
70
- }), /*#__PURE__*/_react.default.createElement(_DownloadButtonView.default, {
71
- count: table.totalRowCount || 0,
72
- queryVariables: queryVariables,
73
- table: table
74
- })));
66
+ onRowsPerPageChange: onRowsPerPageChange
67
+ }));
75
68
  };
76
69
  var _default = ExtendedView;
77
70
  exports.default = _default;
package/dist/TableView.js CHANGED
@@ -12,7 +12,6 @@ var _CustomTblBody = _interopRequireDefault(require("./body/CustomTblBody"));
12
12
  var _CustomToolbar = _interopRequireDefault(require("./toolbar/CustomToolbar"));
13
13
  var _DisplayErrMsg = _interopRequireDefault(require("./errMsg/DisplayErrMsg"));
14
14
  var _ExtendedView = _interopRequireDefault(require("./ExtendedView"));
15
- var _DownloadButtonView = _interopRequireDefault(require("./toolbar/DownloadButtonView"));
16
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -33,15 +32,11 @@ const CustomTableContainer = props => {
33
32
  component: _core.Paper
34
33
  }, children));
35
34
  };
36
- const downloadAreaStyle = {
37
- display: 'flex',
38
- paddingRight: '41px',
39
- float: 'right'
40
- };
41
35
  const TableView = _ref => {
42
36
  var _table$selectedRows, _table$selectedRows2;
43
37
  let {
44
38
  tableRows = [],
39
+ totalRows = [],
45
40
  table,
46
41
  onRowsPerPageChange,
47
42
  onPageChange,
@@ -51,10 +46,14 @@ const TableView = _ref => {
51
46
  onSortByColumn,
52
47
  onColumnViewChange,
53
48
  themeConfig = {},
54
- queryVariables
49
+ queryVariables,
50
+ server,
51
+ customTableHeader: CustomTableHeader = _CustomTblHeader.default
55
52
  } = _ref;
56
53
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ExtendedView.default, {
57
54
  table: table,
55
+ rows: totalRows,
56
+ server: server,
58
57
  onColumnViewChange: onColumnViewChange,
59
58
  onRowsPerPageChange: onRowsPerPageChange,
60
59
  onPageChange: onPageChange,
@@ -68,7 +67,14 @@ const TableView = _ref => {
68
67
  customTheme: themeConfig.toolbar
69
68
  }), /*#__PURE__*/_react.default.createElement(CustomTableContainer, {
70
69
  customTheme: themeConfig.tblContainer || {}
71
- }, /*#__PURE__*/_react.default.createElement(_core.Table, null, /*#__PURE__*/_react.default.createElement(_CustomTblHeader.default, {
70
+ }, /*#__PURE__*/_react.default.createElement(_core.Table, null, CustomTableHeader ? /*#__PURE__*/_react.default.createElement(CustomTableHeader, {
71
+ customTheme: themeConfig.tblHeader,
72
+ table: table,
73
+ rows: tableRows,
74
+ count: totalRowCount,
75
+ toggleSelectAll: onToggleSelectAll,
76
+ sortByColumn: onSortByColumn
77
+ }) : /*#__PURE__*/_react.default.createElement(_CustomTblHeader.default, {
72
78
  customTheme: themeConfig.tblHeader,
73
79
  table: table,
74
80
  rows: tableRows,
@@ -83,10 +89,7 @@ const TableView = _ref => {
83
89
  }))), tableRows.length === 0 && /*#__PURE__*/_react.default.createElement(_DisplayErrMsg.default, {
84
90
  customTheme: themeConfig.displayErr,
85
91
  table: table
86
- }), /*#__PURE__*/_react.default.createElement("div", {
87
- className: "downloadArea",
88
- style: downloadAreaStyle
89
- }, /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
92
+ }), /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
90
93
  customTheme: themeConfig.tblPgn,
91
94
  rowsPerPageOptions: [10, 25, 50, 100],
92
95
  component: "div",
@@ -95,11 +98,7 @@ const TableView = _ref => {
95
98
  page: table.page || 0,
96
99
  onPageChange: onPageChange,
97
100
  onRowsPerPageChange: onRowsPerPageChange
98
- }), /*#__PURE__*/_react.default.createElement(_DownloadButtonView.default, {
99
- count: table.totalRowCount || 0,
100
- queryVariables: queryVariables,
101
- table: table
102
- })));
101
+ }));
103
102
  };
104
103
  var _default = TableView;
105
104
  exports.default = _default;
@@ -44,7 +44,7 @@ const defaultTheme = () => ({
44
44
  MuiLink: {
45
45
  root: {
46
46
  textDecoration: 'none',
47
- color: '#7747ff'
47
+ color: '#0083c6'
48
48
  }
49
49
  },
50
50
  MuiCheckbox: {
@@ -8,7 +8,6 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _core = require("@material-ui/core");
9
9
  var _Types = require("../util/Types");
10
10
  var _CustomLinkView = _interopRequireDefault(require("./components/CustomLinkView"));
11
- var _ExternalLinkView = _interopRequireDefault(require("./components/ExternalLinkView"));
12
11
  var _DataFormatView = _interopRequireDefault(require("./components/DataFormatView"));
13
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -56,11 +55,6 @@ const ViewCell = _ref2 => {
56
55
  row: row,
57
56
  column: column
58
57
  });
59
- case _Types.cellTypes.EXTERNAL_LINK:
60
- return /*#__PURE__*/_react.default.createElement(_ExternalLinkView.default, {
61
- row: row,
62
- column: column
63
- });
64
58
  case _Types.cellTypes.CUSTOM_ELEM:
65
59
  return /*#__PURE__*/_react.default.createElement(CustomComponent, {
66
60
  row: row,
@@ -17,7 +17,10 @@ const CheckboxView = _ref => {
17
17
  }, /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
18
18
  disableRipple: true,
19
19
  onClick: event => onRowSelectChange(event, row),
20
- checked: row.isChecked
20
+ checked: row.isChecked,
21
+ inputProps: {
22
+ 'aria-label': 'Select this row'
23
+ }
21
24
  }));
22
25
  };
23
26
  var _default = CheckboxView;
@@ -69,13 +69,13 @@ const defaultTheme = () => ({
69
69
  width: '133px',
70
70
  height: '45px',
71
71
  cursor: 'pointer',
72
- background: '#98a19e'
72
+ background: '#3E74B6'
73
73
  },
74
74
  '&.cancelBtn': {
75
75
  width: '133px',
76
76
  height: '45px',
77
77
  cursor: 'pointer',
78
- background: '#42779a'
78
+ background: '#4F5D69'
79
79
  }
80
80
  }
81
81
  },
@@ -21,7 +21,8 @@ const CheckboxView = _ref => {
21
21
  indeterminate: includeSelectedIds,
22
22
  checked: includeSelectedIds,
23
23
  onChange: event => toggleSelectAll(event, Ids, includeSelectedIds)
24
- })
24
+ }),
25
+ "aria-label": "Select all rows"
25
26
  }));
26
27
  };
27
28
  var _default = CheckboxView;
@@ -26,7 +26,9 @@ const DeleteCellView = _ref => {
26
26
  };
27
27
  const {
28
28
  customColHeaderRender,
29
- customModalMessage
29
+ customModalMessage,
30
+ cancelText,
31
+ okText
30
32
  } = column;
31
33
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.TableCell, {
32
34
  scope: "col",
@@ -49,7 +51,9 @@ const DeleteCellView = _ref => {
49
51
  removeAllFiles: column.headerEventHandler,
50
52
  count: count,
51
53
  toggleDisplay: toggleDialogDisplay,
52
- customModalMessage: customModalMessage
54
+ customModalMessage: customModalMessage,
55
+ cancelText: cancelText,
56
+ okText: okText
53
57
  })));
54
58
  };
55
59
  var _default = DeleteCellView;
@@ -13,7 +13,9 @@ function RemoveAllDialogView(props) {
13
13
  toggleDisplay,
14
14
  count,
15
15
  removeAllFiles,
16
- customModalMessage
16
+ customModalMessage,
17
+ cancelText = 'No',
18
+ okText = 'Yes'
17
19
  } = props;
18
20
  const deleteAllFiles = () => {
19
21
  removeAllFiles();
@@ -31,13 +33,15 @@ function RemoveAllDialogView(props) {
31
33
  "aria-describedby": "alert-dialog-description"
32
34
  }, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
33
35
  id: "alert-dialog-description"
34
- }, generateModalMessage(count))), /*#__PURE__*/_react.default.createElement(_core.DialogActions, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
36
+ }, generateModalMessage(count))), /*#__PURE__*/_react.default.createElement(_core.DialogActions, {
37
+ className: "actionsWrapper"
38
+ }, /*#__PURE__*/_react.default.createElement(_core.Button, {
35
39
  className: "okBtn",
36
40
  onClick: deleteAllFiles
37
- }, "Ok"), /*#__PURE__*/_react.default.createElement(_core.Button, {
41
+ }, okText), /*#__PURE__*/_react.default.createElement(_core.Button, {
38
42
  className: "cancelBtn",
39
43
  onClick: () => toggleDisplay()
40
- }, "Cancel"))));
44
+ }, cancelText))));
41
45
  }
42
46
  var _default = RemoveAllDialogView;
43
47
  exports.default = _default;
package/dist/index.js CHANGED
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "TableView", {
15
15
  return _TableView.default;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "actionCellTypes", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _Types.actionCellTypes;
22
+ }
23
+ });
18
24
  Object.defineProperty(exports, "cellTypes", {
19
25
  enumerable: true,
20
26
  get: function get() {
@@ -7,71 +7,12 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _core = require("@material-ui/core");
10
- var _styles = require("@material-ui/core/styles");
11
- var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
12
- var _FirstPage = _interopRequireDefault(require("@material-ui/icons/FirstPage"));
13
- var _KeyboardArrowLeft = _interopRequireDefault(require("@material-ui/icons/KeyboardArrowLeft"));
14
- var _KeyboardArrowRight = _interopRequireDefault(require("@material-ui/icons/KeyboardArrowRight"));
15
- var _LastPage = _interopRequireDefault(require("@material-ui/icons/LastPage"));
16
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
11
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
12
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
13
  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; }
20
14
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21
15
  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); }
22
- const useStyles1 = (0, _styles.makeStyles)(theme => ({
23
- root: {
24
- flexShrink: 0,
25
- marginLeft: theme.spacing(2.5)
26
- }
27
- }));
28
- function TablePaginationActions(props) {
29
- const classes = useStyles1();
30
- const theme = (0, _styles.useTheme)();
31
- const {
32
- count,
33
- page,
34
- rowsPerPage,
35
- onPageChange
36
- } = props;
37
- const handleFirstPageButtonClick = event => {
38
- onPageChange(event, 0);
39
- };
40
- const handleBackButtonClick = event => {
41
- onPageChange(event, page - 1);
42
- };
43
- const handleNextButtonClick = event => {
44
- onPageChange(event, page + 1);
45
- };
46
- const handleLastPageButtonClick = event => {
47
- onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
48
- };
49
- return /*#__PURE__*/_react.default.createElement("div", {
50
- className: classes.root
51
- }, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
52
- onClick: handleFirstPageButtonClick,
53
- disabled: page === 0,
54
- "aria-label": "first page"
55
- }, theme.direction === 'rtl' ? /*#__PURE__*/_react.default.createElement(_LastPage.default, null) : /*#__PURE__*/_react.default.createElement(_FirstPage.default, null)), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
56
- onClick: handleBackButtonClick,
57
- disabled: page === 0,
58
- "aria-label": "previous page"
59
- }, theme.direction === 'rtl' ? /*#__PURE__*/_react.default.createElement(_KeyboardArrowRight.default, null) : /*#__PURE__*/_react.default.createElement(_KeyboardArrowLeft.default, null)), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
60
- onClick: handleNextButtonClick,
61
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
62
- "aria-label": "next page"
63
- }, theme.direction === 'rtl' ? /*#__PURE__*/_react.default.createElement(_KeyboardArrowLeft.default, null) : /*#__PURE__*/_react.default.createElement(_KeyboardArrowRight.default, null)), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
64
- onClick: handleLastPageButtonClick,
65
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
66
- "aria-label": "last page"
67
- }, theme.direction === 'rtl' ? /*#__PURE__*/_react.default.createElement(_FirstPage.default, null) : /*#__PURE__*/_react.default.createElement(_LastPage.default, null)));
68
- }
69
- TablePaginationActions.propTypes = {
70
- count: _propTypes.default.number.isRequired,
71
- onPageChange: _propTypes.default.func.isRequired,
72
- page: _propTypes.default.number.isRequired,
73
- rowsPerPage: _propTypes.default.number.isRequired
74
- };
75
16
  const defaultTheme = {
76
17
  MuiTablePagination: {
77
18
  root: {
@@ -97,10 +38,6 @@ const defaultTheme = {
97
38
  }
98
39
  }
99
40
  };
100
- const downloadAreaStyle = {
101
- display: 'flex',
102
- paddingRight: '41px'
103
- };
104
41
  const CustomPagination = _ref => {
105
42
  let {
106
43
  rowsPerPageOptions,
@@ -115,9 +52,6 @@ const CustomPagination = _ref => {
115
52
  theme: (0, _core.createTheme)({
116
53
  overrides: _objectSpread(_objectSpread({}, defaultTheme), customTheme)
117
54
  })
118
- }, /*#__PURE__*/_react.default.createElement("div", {
119
- className: "downloadArea",
120
- style: downloadAreaStyle
121
55
  }, /*#__PURE__*/_react.default.createElement(_core.TablePagination, {
122
56
  rowsPerPageOptions: rowsPerPageOptions,
123
57
  component: "div",
@@ -126,8 +60,14 @@ const CustomPagination = _ref => {
126
60
  page: page,
127
61
  onPageChange: onPageChange,
128
62
  onRowsPerPageChange: onRowsPerPageChange,
129
- ActionsComponent: TablePaginationActions
130
- })));
63
+ SelectProps: {
64
+ inputProps: {
65
+ 'aria-label': 'Select number of rows per page',
66
+ 'aria-labelledby': 'rowsPerPageLabel'
67
+ },
68
+ id: 'rowsPerPageLabel'
69
+ }
70
+ }));
131
71
  };
132
72
  CustomPagination.propTypes = {
133
73
  rowsPerPageOptions: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
@@ -16,30 +16,28 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
16
16
  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; }
17
17
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
18
  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); }
19
- const downloadButtonStyle = {
20
- color: '#d1d2d3',
21
- marginTop: '7px'
22
- };
23
19
  const DownloadButton = _ref => {
24
20
  let {
25
- count,
21
+ download,
22
+ rows,
23
+ table,
26
24
  queryVariables,
27
- table
25
+ server
28
26
  } = _ref;
29
- if (count === 0) {
30
- return /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, {
31
- className: "disableButton",
32
- style: downloadButtonStyle
33
- });
27
+ if (!download) {
28
+ return null;
34
29
  }
30
+ const {
31
+ downloadCsv = 'download',
32
+ downloadTable,
33
+ downloadFileName
34
+ } = download;
35
35
  const client = (0, _client.useApolloClient)();
36
- const downloadFile = 'INS ';
37
36
  async function downloadSCSVFile() {
38
37
  const {
39
38
  query,
40
39
  paginationAPIField
41
40
  } = table;
42
- const downloadFileName = downloadFile.concat(paginationAPIField.replace('OverView', ''), ' download');
43
41
  const result = await client.query({
44
42
  query,
45
43
  variables: _objectSpread(_objectSpread({}, queryVariables), {}, {
@@ -55,13 +53,20 @@ const DownloadButton = _ref => {
55
53
  (0, _downloadTable.downloadJson)(result, table, downloadFileName);
56
54
  }
57
55
  const downloadTableCSV = (0, _react.useCallback)(() => {
58
- downloadSCSVFile();
56
+ if (downloadTable) {
57
+ downloadTable();
58
+ } else if (!downloadTable && !server) {
59
+ (0, _downloadTable.downloadJson)(rows, table, downloadFileName);
60
+ } else {
61
+ downloadSCSVFile();
62
+ }
59
63
  }, [queryVariables]);
60
- return /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
61
- title: "Download Full Table As CSV"
64
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
65
+ title: downloadCsv,
66
+ className: "download-icon"
62
67
  }, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
63
68
  onClick: downloadTableCSV
64
- }, /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, null)));
69
+ }, /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, null))));
65
70
  };
66
71
  var _default = DownloadButton;
67
72
  exports.default = _default;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.headerTypes = exports.dataFormatTypes = exports.cellTypes = exports.actionCellTypes = exports.LINK = exports.FORMAT_DATA_CELLS = exports.FORMAT_DATA = exports.FORMAT_BYTES = exports.EXTERNAL_LINK = exports.DISPLAY = exports.DELETE = exports.DEFAULT = exports.ComponentTypes = exports.CUSTOM_ELEM = exports.CHECKBOX = void 0;
6
+ exports.headerTypes = exports.dataFormatTypes = exports.cellTypes = exports.actionCellTypes = exports.LINK = exports.FORMAT_DATA_CELLS = exports.FORMAT_DATA = exports.FORMAT_BYTES = exports.DISPLAY = exports.DELETE = exports.DEFAULT = exports.ComponentTypes = exports.CUSTOM_ELEM = exports.CHECKBOX = void 0;
7
7
  const CHECKBOX = 'CHECKBOX';
8
8
  exports.CHECKBOX = CHECKBOX;
9
9
  const DELETE = 'DELETE';
@@ -12,8 +12,6 @@ const CUSTOM_ELEM = 'CUSTOM_ELEM';
12
12
  exports.CUSTOM_ELEM = CUSTOM_ELEM;
13
13
  const LINK = 'LINK';
14
14
  exports.LINK = LINK;
15
- const EXTERNAL_LINK = 'EXTERNAL_LINK';
16
- exports.EXTERNAL_LINK = EXTERNAL_LINK;
17
15
  const DISPLAY = 'DISPLAY';
18
16
  exports.DISPLAY = DISPLAY;
19
17
  const DEFAULT = 'DEFAULT';
@@ -25,7 +23,6 @@ exports.FORMAT_BYTES = FORMAT_BYTES;
25
23
  const cellTypes = {
26
24
  CUSTOM_ELEM,
27
25
  LINK,
28
- EXTERNAL_LINK,
29
26
  DISPLAY,
30
27
  CHECKBOX,
31
28
  DELETE,
package/package.json CHANGED
@@ -1,38 +1,31 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-ins.8",
3
+ "version": "1.0.1-popsci.0",
4
+ "description": "",
4
5
  "main": "dist/index.js",
5
6
  "scripts": {
6
7
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
7
8
  "test": "echo \"Error: no test specified\" && exit 1",
8
9
  "lint": "eslint src"
9
10
  },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/CBIIT/bento-frontend.git"
13
- },
11
+ "repository": "https://github.com/CBIIT/bento-frontend",
14
12
  "publishConfig": {
15
13
  "access": "public"
16
14
  },
17
15
  "dependencies": {
18
- "@bento-core/util": "1.0.1-ins.0"
16
+ "@bento-core/util": "^1.0.0"
19
17
  },
20
18
  "peerDependencies": {
19
+ "@apollo/client": "^3.6.9",
21
20
  "@material-ui/core": "^4.12.4",
22
21
  "@material-ui/icons": "^4.9.1",
22
+ "clsx": "^1.2.1",
23
23
  "prop-types": "^15.7.2",
24
24
  "react": "^17.0.2",
25
25
  "react-dom": "^17.0.0",
26
- "react-redux": "^7.2.1",
27
- "@apollo/client": "^3.6.9",
28
- "clsx": "^1.2.1"
26
+ "react-redux": "^7.2.1"
29
27
  },
30
28
  "author": "CTOS Bento Team",
31
29
  "license": "ISC",
32
- "bugs": {
33
- "url": "https://github.com/CBIIT/bento-frontend/issues"
34
- },
35
- "homepage": "https://github.com/CBIIT/bento-frontend#readme",
36
- "devDependencies": {},
37
- "description": ""
30
+ "gitHead": "c8f3272107a251009045c9c0fdbebcc47c0c266a"
38
31
  }
@@ -9,25 +9,21 @@ import ManageColumnView from './toolbar/ManageColumnView';
9
9
  import defaultTheme from './DefaultThemConfig';
10
10
  import DownloadButton from './toolbar/DownloadButtonView';
11
11
 
12
- const downloadAreaStyle = {
13
- display: 'flex',
14
- paddingRight: '41px',
15
- float: 'right',
16
- };
17
-
18
12
  const ExtendedView = ({
19
13
  table,
14
+ rows,
20
15
  onColumnViewChange,
21
16
  onRowsPerPageChange,
22
17
  onPageChange,
23
- numSelected = 0,
24
18
  customTheme,
25
19
  queryVariables,
20
+ server,
26
21
  }) => {
27
22
  const { extendedViewConfig } = table;
28
23
  if (!extendedViewConfig) {
29
24
  return null;
30
25
  }
26
+
31
27
  const {
32
28
  download = false,
33
29
  manageViewColumns = false,
@@ -35,43 +31,41 @@ const ExtendedView = ({
35
31
  } = extendedViewConfig;
36
32
 
37
33
  const themeConfig = createTheme({ overrides: { ...defaultTheme(), ...customTheme } });
34
+
38
35
  return (
39
36
  <ThemeProvider theme={themeConfig}>
40
- {(numSelected === 0 && (download || manageViewColumns)) && (
41
- <Toolbar className="downloadColumnView">
42
- {/* <DownloadButton
43
- download={download}
44
- /> */}
45
- <ManageColumnView
46
- table={table}
47
- manageViewColumns={manageViewColumns}
48
- onColumnViewChange={onColumnViewChange}
49
- />
50
- </Toolbar>
37
+ {(download || manageViewColumns) && (
38
+ <Toolbar
39
+ className="downloadAndColumnView"
40
+ >
41
+ <DownloadButton
42
+ download={download}
43
+ rows={rows}
44
+ server={server}
45
+ table={table}
46
+ queryVariables={queryVariables}
47
+ />
48
+ <ManageColumnView
49
+ table={table}
50
+ manageViewColumns={manageViewColumns}
51
+ onColumnViewChange={onColumnViewChange}
52
+ />
53
+ </Toolbar>
51
54
  )}
52
55
  {
53
- (pagination) && (
54
- <div className="downloadArea" style={downloadAreaStyle}>
55
- <CustomPagination
56
- customTheme={customTheme.tblTopPgn}
57
- rowsPerPageOptions={[10, 25, 50, 100]}
58
- component="div"
59
- count={table.totalRowCount || 0}
60
- rowsPerPage={table.rowsPerPage || 10}
61
- page={table.page || 0}
62
- onPageChange={onPageChange}
63
- onRowsPerPageChange={onRowsPerPageChange}
64
- queryVariables={queryVariables}
65
- table={table}
66
- />
67
- <DownloadButton
68
- count={table.totalRowCount || 0}
69
- queryVariables={queryVariables}
70
- table={table}
71
- />
72
- </div>
73
- )
74
- }
56
+ (pagination) && (
57
+ <CustomPagination
58
+ customTheme={customTheme.tblTopPgn}
59
+ rowsPerPageOptions={[10, 25, 50, 100]}
60
+ component="div"
61
+ count={table.totalRowCount || 0}
62
+ rowsPerPage={table.rowsPerPage || 10}
63
+ page={table.page || 0}
64
+ onPageChange={onPageChange}
65
+ onRowsPerPageChange={onRowsPerPageChange}
66
+ />
67
+ )
68
+ }
75
69
  </ThemeProvider>
76
70
  );
77
71
  };
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;
@@ -26,14 +25,9 @@ const CustomTableContainer = (props) => {
26
25
  );
27
26
  };
28
27
 
29
- const downloadAreaStyle = {
30
- display: 'flex',
31
- paddingRight: '41px',
32
- float: 'right',
33
- };
34
-
35
28
  const TableView = ({
36
29
  tableRows = [],
30
+ totalRows = [],
37
31
  table,
38
32
  onRowsPerPageChange,
39
33
  onPageChange,
@@ -44,10 +38,14 @@ const TableView = ({
44
38
  onColumnViewChange,
45
39
  themeConfig = {},
46
40
  queryVariables,
41
+ server,
42
+ customTableHeader: CustomTableHeader = TableHeader,
47
43
  }) => (
48
44
  <>
49
45
  <ExtendedView
50
46
  table={table}
47
+ rows={totalRows}
48
+ server={server}
51
49
  onColumnViewChange={onColumnViewChange}
52
50
  onRowsPerPageChange={onRowsPerPageChange}
53
51
  onPageChange={onPageChange}
@@ -65,14 +63,27 @@ const TableView = ({
65
63
  customTheme={themeConfig.tblContainer || {}}
66
64
  >
67
65
  <Table>
68
- <TableHeader
69
- customTheme={themeConfig.tblHeader}
70
- table={table}
71
- rows={tableRows}
72
- count={totalRowCount}
73
- toggleSelectAll={onToggleSelectAll}
74
- sortByColumn={onSortByColumn}
75
- />
66
+ {
67
+ CustomTableHeader ? (
68
+ <CustomTableHeader
69
+ customTheme={themeConfig.tblHeader}
70
+ table={table}
71
+ rows={tableRows}
72
+ count={totalRowCount}
73
+ toggleSelectAll={onToggleSelectAll}
74
+ sortByColumn={onSortByColumn}
75
+ />
76
+ ) : (
77
+ <TableHeader
78
+ customTheme={themeConfig.tblHeader}
79
+ table={table}
80
+ rows={tableRows}
81
+ count={totalRowCount}
82
+ toggleSelectAll={onToggleSelectAll}
83
+ sortByColumn={onSortByColumn}
84
+ />
85
+ )
86
+ }
76
87
  <CustomTableBody
77
88
  customTheme={themeConfig.tblBody}
78
89
  rows={tableRows}
@@ -87,23 +98,16 @@ const TableView = ({
87
98
  table={table}
88
99
  />
89
100
  )}
90
- <div className="downloadArea" style={downloadAreaStyle}>
91
- <CustomPagination
92
- customTheme={themeConfig.tblPgn}
93
- rowsPerPageOptions={[10, 25, 50, 100]}
94
- component="div"
95
- count={table.totalRowCount || 0}
96
- rowsPerPage={table.rowsPerPage || 10}
97
- page={table.page || 0}
98
- onPageChange={onPageChange}
99
- onRowsPerPageChange={onRowsPerPageChange}
100
- />
101
- <DownloadButton
102
- count={table.totalRowCount || 0}
103
- queryVariables={queryVariables}
104
- table={table}
105
- />
106
- </div>
101
+ <CustomPagination
102
+ customTheme={themeConfig.tblPgn}
103
+ rowsPerPageOptions={[10, 25, 50, 100]}
104
+ component="div"
105
+ count={table.totalRowCount || 0}
106
+ rowsPerPage={table.rowsPerPage || 10}
107
+ page={table.page || 0}
108
+ onPageChange={onPageChange}
109
+ onRowsPerPageChange={onRowsPerPageChange}
110
+ />
107
111
  </>
108
112
  );
109
113
 
@@ -38,7 +38,7 @@ const defaultTheme = () => ({
38
38
  MuiLink: {
39
39
  root: {
40
40
  textDecoration: 'none',
41
- color: '#7747ff',
41
+ color: '#0083c6',
42
42
  },
43
43
  },
44
44
  MuiCheckbox: {
@@ -5,7 +5,6 @@ import {
5
5
  } from '@material-ui/core';
6
6
  import { cellTypes } from '../util/Types';
7
7
  import CustomLinkView from './components/CustomLinkView';
8
- import ExternalLinkView from './components/ExternalLinkView';
9
8
  import DataFormatView from './components/DataFormatView';
10
9
 
11
10
  /**
@@ -47,13 +46,6 @@ const ViewCell = ({
47
46
  column={column}
48
47
  />
49
48
  );
50
- case cellTypes.EXTERNAL_LINK:
51
- return (
52
- <ExternalLinkView
53
- row={row}
54
- column={column}
55
- />
56
- );
57
49
  case cellTypes.CUSTOM_ELEM:
58
50
  return (
59
51
  <CustomComponent
@@ -13,6 +13,7 @@ const CheckboxView = ({
13
13
  disableRipple
14
14
  onClick={(event) => onRowSelectChange(event, row)}
15
15
  checked={row.isChecked}
16
+ inputProps={{ 'aria-label': 'Select this row' }}
16
17
  />
17
18
  </TableCell>
18
19
  );
@@ -63,13 +63,13 @@ const defaultTheme = () => ({
63
63
  width: '133px',
64
64
  height: '45px',
65
65
  cursor: 'pointer',
66
- background: '#98a19e',
66
+ background: '#3E74B6',
67
67
  },
68
68
  '&.cancelBtn': {
69
69
  width: '133px',
70
70
  height: '45px',
71
71
  cursor: 'pointer',
72
- background: '#42779a',
72
+ background: '#4F5D69',
73
73
  },
74
74
  },
75
75
  },
@@ -20,6 +20,7 @@ const CheckboxView = ({
20
20
  onChange={(event) => toggleSelectAll(event, Ids, includeSelectedIds)}
21
21
  />
22
22
  )}
23
+ aria-label="Select all rows"
23
24
  />
24
25
  </TableCell>
25
26
  );
@@ -31,7 +31,13 @@ const DeleteCellView = ({
31
31
  const testTrigger = () => {
32
32
  setDisplay(true);
33
33
  };
34
- const { customColHeaderRender, customModalMessage } = column;
34
+ const {
35
+ customColHeaderRender,
36
+ customModalMessage,
37
+ cancelText,
38
+ okText,
39
+ } = column;
40
+
35
41
  return (
36
42
  <>
37
43
  <TableCell
@@ -70,6 +76,8 @@ const DeleteCellView = ({
70
76
  count={count}
71
77
  toggleDisplay={toggleDialogDisplay}
72
78
  customModalMessage={customModalMessage}
79
+ cancelText={cancelText}
80
+ okText={okText}
73
81
  />
74
82
  </TableCell>
75
83
  </>
@@ -14,6 +14,8 @@ function RemoveAllDialogView(props) {
14
14
  count,
15
15
  removeAllFiles,
16
16
  customModalMessage,
17
+ cancelText = 'No',
18
+ okText = 'Yes',
17
19
  } = props;
18
20
  const deleteAllFiles = () => {
19
21
  removeAllFiles();
@@ -38,6 +40,7 @@ function RemoveAllDialogView(props) {
38
40
  </>
39
41
  );
40
42
  };
43
+
41
44
  return (
42
45
  <>
43
46
  <Dialog
@@ -50,12 +53,12 @@ function RemoveAllDialogView(props) {
50
53
  {generateModalMessage(count)}
51
54
  </DialogContentText>
52
55
  </DialogContent>
53
- <DialogActions>
56
+ <DialogActions className="actionsWrapper">
54
57
  <Button className="okBtn" onClick={deleteAllFiles}>
55
- Ok
58
+ {okText}
56
59
  </Button>
57
60
  <Button className="cancelBtn" onClick={() => toggleDisplay()}>
58
- Cancel
61
+ {cancelText}
59
62
  </Button>
60
63
  </DialogActions>
61
64
  </Dialog>
package/src/index.js CHANGED
@@ -4,5 +4,6 @@ export {
4
4
  headerTypes,
5
5
  ComponentTypes,
6
6
  dataFormatTypes,
7
+ actionCellTypes,
7
8
  } from './util/Types';
8
9
  export { formatBytes } from './util/Dataformat';
@@ -5,79 +5,6 @@ import {
5
5
  TablePagination,
6
6
  ThemeProvider,
7
7
  } from '@material-ui/core';
8
- import { makeStyles, useTheme } from '@material-ui/core/styles';
9
- import IconButton from '@material-ui/core/IconButton';
10
- import FirstPageIcon from '@material-ui/icons/FirstPage';
11
- import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft';
12
- import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight';
13
- import LastPageIcon from '@material-ui/icons/LastPage';
14
-
15
- const useStyles1 = makeStyles((theme) => ({
16
- root: {
17
- flexShrink: 0,
18
- marginLeft: theme.spacing(2.5),
19
- },
20
- }));
21
-
22
- function TablePaginationActions(props) {
23
- const classes = useStyles1();
24
- const theme = useTheme();
25
- const {
26
- count, page, rowsPerPage, onPageChange,
27
- } = props;
28
-
29
- const handleFirstPageButtonClick = (event) => {
30
- onPageChange(event, 0);
31
- };
32
-
33
- const handleBackButtonClick = (event) => {
34
- onPageChange(event, page - 1);
35
- };
36
-
37
- const handleNextButtonClick = (event) => {
38
- onPageChange(event, page + 1);
39
- };
40
-
41
- const handleLastPageButtonClick = (event) => {
42
- onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
43
- };
44
-
45
- return (
46
- <div className={classes.root}>
47
- <IconButton
48
- onClick={handleFirstPageButtonClick}
49
- disabled={page === 0}
50
- aria-label="first page"
51
- >
52
- {theme.direction === 'rtl' ? <LastPageIcon /> : <FirstPageIcon />}
53
- </IconButton>
54
- <IconButton onClick={handleBackButtonClick} disabled={page === 0} aria-label="previous page">
55
- {theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
56
- </IconButton>
57
- <IconButton
58
- onClick={handleNextButtonClick}
59
- disabled={page >= Math.ceil(count / rowsPerPage) - 1}
60
- aria-label="next page"
61
- >
62
- {theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
63
- </IconButton>
64
- <IconButton
65
- onClick={handleLastPageButtonClick}
66
- disabled={page >= Math.ceil(count / rowsPerPage) - 1}
67
- aria-label="last page"
68
- >
69
- {theme.direction === 'rtl' ? <FirstPageIcon /> : <LastPageIcon />}
70
- </IconButton>
71
- </div>
72
- );
73
- }
74
-
75
- TablePaginationActions.propTypes = {
76
- count: PropTypes.number.isRequired,
77
- onPageChange: PropTypes.func.isRequired,
78
- page: PropTypes.number.isRequired,
79
- rowsPerPage: PropTypes.number.isRequired,
80
- };
81
8
 
82
9
  const defaultTheme = {
83
10
  MuiTablePagination: {
@@ -105,11 +32,6 @@ const defaultTheme = {
105
32
  },
106
33
  };
107
34
 
108
- const downloadAreaStyle = {
109
- display: 'flex',
110
- paddingRight: '41px',
111
- };
112
-
113
35
  const CustomPagination = ({
114
36
  rowsPerPageOptions,
115
37
  count,
@@ -120,18 +42,22 @@ const CustomPagination = ({
120
42
  customTheme = {},
121
43
  }) => (
122
44
  <ThemeProvider theme={createTheme({ overrides: { ...defaultTheme, ...customTheme } })}>
123
- <div className="downloadArea" style={downloadAreaStyle}>
124
- <TablePagination
125
- rowsPerPageOptions={rowsPerPageOptions}
126
- component="div"
127
- count={count}
128
- rowsPerPage={rowsPerPage}
129
- page={page}
130
- onPageChange={onPageChange}
131
- onRowsPerPageChange={onRowsPerPageChange}
132
- ActionsComponent={TablePaginationActions}
133
- />
134
- </div>
45
+ <TablePagination
46
+ rowsPerPageOptions={rowsPerPageOptions}
47
+ component="div"
48
+ count={count}
49
+ rowsPerPage={rowsPerPage}
50
+ page={page}
51
+ onPageChange={onPageChange}
52
+ onRowsPerPageChange={onRowsPerPageChange}
53
+ SelectProps={{
54
+ inputProps: {
55
+ 'aria-label': 'Select number of rows per page',
56
+ 'aria-labelledby': 'rowsPerPageLabel',
57
+ },
58
+ id: 'rowsPerPageLabel',
59
+ }}
60
+ />
135
61
  </ThemeProvider>
136
62
  );
137
63
 
@@ -7,32 +7,30 @@ import {
7
7
  import { CloudDownload } from '@material-ui/icons';
8
8
  import { downloadJson } from '../util/downloadTable';
9
9
 
10
- const downloadButtonStyle = {
11
- color: '#d1d2d3',
12
- marginTop: '7px',
13
- };
14
-
15
10
  const DownloadButton = ({
16
- count,
17
- queryVariables,
11
+ download,
12
+ rows,
18
13
  table,
14
+ queryVariables,
15
+ server,
19
16
  }) => {
20
- if (count === 0) {
21
- return <CloudDownload className="disableButton" style={downloadButtonStyle} />;
17
+ if (!download) {
18
+ return null;
22
19
  }
20
+ const {
21
+ downloadCsv = 'download',
22
+ downloadTable,
23
+ downloadFileName,
24
+ } = download;
23
25
 
24
26
  const client = useApolloClient();
25
27
 
26
- const downloadFile = 'INS ';
27
-
28
28
  async function downloadSCSVFile() {
29
29
  const {
30
30
  query,
31
31
  paginationAPIField,
32
32
  } = table;
33
33
 
34
- const downloadFileName = downloadFile.concat(paginationAPIField.replace('OverView', ''), ' download');
35
-
36
34
  const result = await client.query({
37
35
  query,
38
36
  variables: {
@@ -51,17 +49,28 @@ const DownloadButton = ({
51
49
  }
52
50
 
53
51
  const downloadTableCSV = useCallback(() => {
54
- downloadSCSVFile();
52
+ if (downloadTable) {
53
+ downloadTable();
54
+ } else if (!downloadTable && !server) {
55
+ downloadJson(rows, table, downloadFileName);
56
+ } else {
57
+ downloadSCSVFile();
58
+ }
55
59
  }, [queryVariables]);
56
60
 
57
61
  return (
58
- <Tooltip title="Download Full Table As CSV">
59
- <IconButton
60
- onClick={downloadTableCSV}
62
+ <>
63
+ <Tooltip
64
+ title={downloadCsv}
65
+ className="download-icon"
61
66
  >
62
- <CloudDownload />
63
- </IconButton>
64
- </Tooltip>
67
+ <IconButton
68
+ onClick={downloadTableCSV}
69
+ >
70
+ <CloudDownload />
71
+ </IconButton>
72
+ </Tooltip>
73
+ </>
65
74
  );
66
75
  };
67
76
 
package/src/util/Types.js CHANGED
@@ -2,7 +2,6 @@ export const CHECKBOX = 'CHECKBOX';
2
2
  export const DELETE = 'DELETE';
3
3
  export const CUSTOM_ELEM = 'CUSTOM_ELEM';
4
4
  export const LINK = 'LINK';
5
- export const EXTERNAL_LINK = 'EXTERNAL_LINK';
6
5
  export const DISPLAY = 'DISPLAY';
7
6
  export const DEFAULT = 'DEFAULT';
8
7
  export const FORMAT_DATA = 'FORMAT_DATA';
@@ -11,7 +10,6 @@ export const FORMAT_BYTES = 'FORMAT_BYTES';
11
10
  export const cellTypes = {
12
11
  CUSTOM_ELEM,
13
12
  LINK,
14
- EXTERNAL_LINK,
15
13
  DISPLAY,
16
14
  CHECKBOX,
17
15
  DELETE,
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _core = require("@material-ui/core");
9
- var _Types = require("../../util/Types");
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- /**
12
- * External Link component
13
- */
14
- const ExternalLinkView = _ref => {
15
- let {
16
- column,
17
- row
18
- } = _ref;
19
- const {
20
- rootPath,
21
- pathParams
22
- } = column === null || column === void 0 ? void 0 : column.linkAttr;
23
- const url = pathParams.map(attr => {
24
- if (!rootPath) {
25
- return row[attr];
26
- }
27
- return "".concat(rootPath, "/").concat(row[attr]);
28
- });
29
- const externalLinkIcon = {
30
- src: 'https://raw.githubusercontent.com/CBIIT/datacommons-assets/main/bento/images/icons/svgs/externalLinkIcon.svg',
31
- alt: 'External link icon'
32
- };
33
- return /*#__PURE__*/_react.default.createElement(_core.Link, {
34
- href: url,
35
- target: "_blank",
36
- rel: "noopener noreferrer",
37
- className: _Types.cellTypes.LINK
38
- }, /*#__PURE__*/_react.default.createElement(_core.Typography, null, row[column === null || column === void 0 ? void 0 : column.dataField], /*#__PURE__*/_react.default.createElement("img", {
39
- src: externalLinkIcon.src,
40
- alt: externalLinkIcon.alt,
41
- style: {
42
- width: '16px',
43
- verticalAlign: 'sub',
44
- marginLeft: '4px'
45
- }
46
- })));
47
- };
48
- var _default = ExternalLinkView;
49
- exports.default = _default;
@@ -1,39 +0,0 @@
1
- import React from 'react';
2
- import {
3
- Link, Typography,
4
- } from '@material-ui/core';
5
- import { cellTypes } from '../../util/Types';
6
-
7
- /**
8
- * External Link component
9
- */
10
- const ExternalLinkView = ({
11
- column,
12
- row,
13
- }) => {
14
- const { rootPath, pathParams } = column?.linkAttr;
15
- const url = pathParams.map((attr) => {
16
- if (!rootPath) {
17
- return row[attr];
18
- }
19
- return `${rootPath}/`.concat(row[attr]);
20
- });
21
- const externalLinkIcon = {
22
- src: 'https://raw.githubusercontent.com/CBIIT/datacommons-assets/main/bento/images/icons/svgs/externalLinkIcon.svg',
23
- alt: 'External link icon',
24
- };
25
- return (
26
- <Link href={url} target="_blank" rel="noopener noreferrer" className={cellTypes.LINK}>
27
- <Typography>
28
- {row[column?.dataField]}
29
- <img
30
- src={externalLinkIcon.src}
31
- alt={externalLinkIcon.alt}
32
- style={{ width: '16px', verticalAlign: 'sub', marginLeft: '4px' }}
33
- />
34
- </Typography>
35
- </Link>
36
- );
37
- };
38
-
39
- export default ExternalLinkView;