@bento-core/table 1.0.1-ccdihub.99 → 1.0.1-ccdiintegrated.10

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.
Files changed (75) hide show
  1. package/dist/ExtendedView.js +135 -8
  2. package/dist/TableView.js +25 -7
  3. package/dist/body/CustomTblBody.js +2 -1
  4. package/dist/body/DefaultThemConfig.js +1 -1
  5. package/dist/body/DisplayBodyCell.js +24 -2
  6. package/dist/body/components/CPIMappingView.js +221 -0
  7. package/dist/body/components/CPIModal.js +440 -94
  8. package/dist/body/components/CPIView.js +64 -10
  9. package/dist/body/components/CustomLinkView.js +2 -1
  10. package/dist/body/components/DataFormatView.js +1 -1
  11. package/dist/body/components/StudiesDataAvailabilityView.js +125 -0
  12. package/dist/body/components/assets/CPI_Icon_Dataset.svg +6 -0
  13. package/dist/body/components/assets/CPI_Icon_Multi.svg +6 -0
  14. package/dist/body/components/assets/CPI_Icon_Single.svg +4 -0
  15. package/dist/body/components/assets/CPI_Icon_Study.svg +11 -0
  16. package/dist/body/components/assets/Participant_Files.svg +17 -0
  17. package/dist/body/components/assets/Publications.svg +15 -0
  18. package/dist/body/components/assets/Sample_Files.svg +16 -0
  19. package/dist/body/components/assets/Study_Files.svg +21 -0
  20. package/dist/body/components/assets/download.svg +3 -0
  21. package/dist/header/CustomCell.js +4 -3
  22. package/dist/header/CustomTblHeader.js +16 -3
  23. package/dist/index.js +25 -0
  24. package/dist/toolbar/DownloadButtonView.js +30 -4
  25. package/dist/toolbar/SearchBar.js +92 -0
  26. package/dist/toolbar/assets/Search_Icon.svg +3 -0
  27. package/dist/util/Dataformat.js +50 -2
  28. package/dist/util/Types.js +16 -4
  29. package/dist/util/downloadTable.js +77 -53
  30. package/dist/wrapper/components/AddFiles.js +6 -14
  31. package/dist/wrapper/components/AddToCart/AddToCartView.js +128 -0
  32. package/dist/wrapper/components/AddToCart/ReduxAddToCart.js +28 -0
  33. package/dist/wrapper/components/CPIFilesView/CPIFilesView.js +12 -6
  34. package/dist/wrapper/components/ReduxAddFile.js +1 -0
  35. package/dist/wrapper/components/Snackbar/CartToast.js +96 -0
  36. package/dist/wrapper/components/Snackbar/Snackbar.js +12 -1
  37. package/dist/wrapper/components/Snackbar/SnackbarRedux.js +2 -1
  38. package/package.json +23 -22
  39. package/src/ExtendedView.js +147 -8
  40. package/src/TableView.js +29 -8
  41. package/src/body/CustomTblBody.js +2 -1
  42. package/src/body/DefaultThemConfig.js +1 -1
  43. package/src/body/DisplayBodyCell.js +40 -2
  44. package/src/body/components/CPIMappingView.js +260 -0
  45. package/src/body/components/CPIModal.js +468 -101
  46. package/src/body/components/CPIView.js +75 -22
  47. package/src/body/components/CustomLinkView.js +4 -1
  48. package/src/body/components/DataFormatView.js +4 -2
  49. package/src/body/components/StudiesDataAvailabilityView.js +121 -0
  50. package/src/body/components/assets/CPI_Icon_Dataset.svg +6 -0
  51. package/src/body/components/assets/CPI_Icon_Multi.svg +6 -0
  52. package/src/body/components/assets/CPI_Icon_Single.svg +4 -0
  53. package/src/body/components/assets/CPI_Icon_Study.svg +11 -0
  54. package/src/body/components/assets/Participant_Files.svg +17 -0
  55. package/src/body/components/assets/Publications.svg +15 -0
  56. package/src/body/components/assets/Sample_Files.svg +16 -0
  57. package/src/body/components/assets/Study_Files.svg +21 -0
  58. package/src/body/components/assets/download.svg +3 -0
  59. package/src/header/CustomCell.js +4 -3
  60. package/src/header/CustomTblHeader.js +13 -1
  61. package/src/index.js +7 -1
  62. package/src/toolbar/DownloadButtonView.js +20 -4
  63. package/src/toolbar/SearchBar.js +90 -0
  64. package/src/toolbar/assets/Search_Icon.svg +3 -0
  65. package/src/util/Dataformat.js +47 -0
  66. package/src/util/Types.js +10 -1
  67. package/src/util/downloadTable.js +75 -34
  68. package/src/wrapper/components/AddFiles.js +7 -14
  69. package/src/wrapper/components/AddToCart/AddToCartView.js +134 -0
  70. package/src/wrapper/components/AddToCart/ReduxAddToCart.js +21 -0
  71. package/src/wrapper/components/CPIFilesView/CPIFilesView.js +15 -9
  72. package/src/wrapper/components/ReduxAddFile.js +1 -0
  73. package/src/wrapper/components/Snackbar/CartToast.js +99 -0
  74. package/src/wrapper/components/Snackbar/Snackbar.js +8 -3
  75. package/src/wrapper/components/Snackbar/SnackbarRedux.js +2 -1
@@ -16,6 +16,7 @@ const AddFilesRedux = props => /*#__PURE__*/_react.default.createElement(_AddFil
16
16
  */
17
17
  const mapStateToProps = state => ({
18
18
  count: state.cartReducer && state.cartReducer.count,
19
+ alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount,
19
20
  cartFiles: state.cartReducer && state.cartReducer.filesId
20
21
  });
21
22
  const mapDispatchToProps = dispatch => ({
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactDom = _interopRequireDefault(require("react-dom"));
9
+ var _cart = require("@bento-core/cart");
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
+ /**
14
+ * Explore CPI cart toast.
15
+ * Body portal keeps it visible above the Explore Modal; styling matches the
16
+ * Global Search CPI MUI snackbar. Dropdown closes on option click so the toast
17
+ * does not need width hacks to avoid overlap.
18
+ */
19
+ const SuccessIcon = () => /*#__PURE__*/_react.default.createElement("svg", {
20
+ xmlns: "http://www.w3.org/2000/svg",
21
+ width: "24",
22
+ height: "24",
23
+ viewBox: "0 0 24 24",
24
+ "aria-hidden": "true",
25
+ focusable: "false",
26
+ style: {
27
+ display: 'block',
28
+ fill: 'currentColor'
29
+ }
30
+ }, /*#__PURE__*/_react.default.createElement("path", {
31
+ d: "M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"
32
+ }));
33
+ const CartToast = _ref => {
34
+ let {
35
+ open,
36
+ count,
37
+ alreadyInCartCount = 0,
38
+ onClose
39
+ } = _ref;
40
+ (0, _react.useEffect)(() => {
41
+ if (!open) {
42
+ return undefined;
43
+ }
44
+ const timer = setTimeout(() => {
45
+ onClose();
46
+ }, 3000);
47
+ return () => clearTimeout(timer);
48
+ }, [open, onClose]);
49
+ if (!open || typeof document === 'undefined') {
50
+ return null;
51
+ }
52
+ return /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement("div", {
53
+ className: "snackBar exploreCpiCartToast",
54
+ role: "status",
55
+ "aria-live": "polite",
56
+ style: {
57
+ position: 'fixed',
58
+ bottom: '20px',
59
+ right: '24px',
60
+ zIndex: 99999,
61
+ pointerEvents: 'none'
62
+ }
63
+ }, /*#__PURE__*/_react.default.createElement("div", {
64
+ className: "snackBarMessage",
65
+ style: {
66
+ display: 'flex',
67
+ alignItems: 'center',
68
+ backgroundColor: '#323232',
69
+ color: '#fff',
70
+ padding: '6px 16px',
71
+ borderRadius: '4px',
72
+ boxShadow: '0px 3px 5px -1px rgba(0,0,0,0.2), 0px 6px 10px 0px rgba(0,0,0,0.14), 0px 1px 18px 0px rgba(0,0,0,0.12)',
73
+ minWidth: 288,
74
+ maxWidth: 568,
75
+ boxSizing: 'border-box',
76
+ fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
77
+ fontWeight: 400,
78
+ fontSize: '0.875rem',
79
+ lineHeight: 1.43,
80
+ letterSpacing: '0.01071em'
81
+ }
82
+ }, /*#__PURE__*/_react.default.createElement("span", {
83
+ className: "snackBarMessageIcon",
84
+ style: {
85
+ display: 'inline-flex',
86
+ alignItems: 'center',
87
+ marginRight: 8,
88
+ color: '#fff',
89
+ flexShrink: 0
90
+ }
91
+ }, /*#__PURE__*/_react.default.createElement(SuccessIcon, null)), /*#__PURE__*/_react.default.createElement("span", {
92
+ className: "snackBarText"
93
+ }, (0, _cart.formatCartAddMessage)(count, alreadyInCartCount)))), document.body);
94
+ };
95
+ var _default = CartToast;
96
+ exports.default = _default;
@@ -6,11 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _core = require("@material-ui/core");
9
+ var _cart = require("@bento-core/cart");
9
10
  var _SuccessOutlined = _interopRequireDefault(require("./SuccessOutlined"));
10
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ /**
13
+ * Legacy MUI snackbar kept for non-CPI table cart actions.
14
+ * Explore CPI uses CartToast instead.
15
+ */
11
16
  const SnackbarView = props => {
12
17
  const {
13
18
  count,
19
+ alreadyInCartCount = 0,
14
20
  open,
15
21
  onClose
16
22
  } = props;
@@ -27,13 +33,18 @@ const SnackbarView = props => {
27
33
  vertical: 'bottom',
28
34
  horizontal: 'right'
29
35
  },
36
+ style: {
37
+ bottom: '-45%',
38
+ zIndex: 15000,
39
+ pointerEvents: 'none'
40
+ },
30
41
  message: /*#__PURE__*/_react.default.createElement("div", {
31
42
  className: "snackBarMessage"
32
43
  }, /*#__PURE__*/_react.default.createElement("span", {
33
44
  className: "snackBarMessageIcon"
34
45
  }, /*#__PURE__*/_react.default.createElement(_SuccessOutlined.default, null), ' '), /*#__PURE__*/_react.default.createElement("span", {
35
46
  className: "snackBarText"
36
- }, count, ' ', "File(s) successfully added to your cart"))
47
+ }, (0, _cart.formatCartAddMessage)(count, alreadyInCartCount)))
37
48
  }));
38
49
  };
39
50
  var _default = SnackbarView;
@@ -10,7 +10,8 @@ var _Snackbar = _interopRequireDefault(require("./Snackbar"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  const ReduxSnackbar = props => /*#__PURE__*/_react.default.createElement(_Snackbar.default, props);
12
12
  const mapStateToProps = state => ({
13
- count: state.cartReducer.count
13
+ count: state.cartReducer && state.cartReducer.count,
14
+ alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount
14
15
  });
15
16
  var _default = (0, _reactRedux.connect)(mapStateToProps, null)(ReduxSnackbar);
16
17
  exports.default = _default;
package/package.json CHANGED
@@ -1,19 +1,33 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-ccdihub.99",
3
+ "version": "1.0.1-ccdiintegrated.10",
4
+ "homepage": "https://github.com/CBIIT/bento-frontend#readme",
5
+ "bugs": {
6
+ "url": "https://github.com/CBIIT/bento-frontend/issues"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/CBIIT/bento-frontend.git"
11
+ },
12
+ "license": "ISC",
13
+ "author": "CTOS Bento Team",
14
+ "type": "commonjs",
4
15
  "main": "dist/index.js",
5
16
  "scripts": {
6
17
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
7
18
  "test": "echo \"Error: no test specified\" && exit 1",
8
19
  "lint": "eslint src"
9
20
  },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/CBIIT/bento-frontend.git"
13
- },
14
- "publishConfig": {
15
- "access": "public"
21
+ "dependencies": {
22
+ "@apollo/client": "^3.8.3",
23
+ "@bento-core/cart": "1.0.1-ccdiintegrated.2",
24
+ "@bento-core/tool-tip": "1.0.1-ccdiintegrated.1",
25
+ "@bento-core/util": "1.0.1-ccdiintegrated.1",
26
+ "clsx": "^2.1.1",
27
+ "graphql-tag": "^2.12.6",
28
+ "react-router-dom": "^5.1.2"
16
29
  },
30
+ "devDependencies": {},
17
31
  "peerDependencies": {
18
32
  "@material-ui/core": "^4.12.4",
19
33
  "@material-ui/icons": "^4.9.1",
@@ -22,21 +36,8 @@
22
36
  "react-dom": "^17.0.0",
23
37
  "react-redux": "^7.2.1"
24
38
  },
25
- "author": "CTOS Bento Team",
26
- "license": "ISC",
27
- "bugs": {
28
- "url": "https://github.com/CBIIT/bento-frontend/issues"
29
- },
30
- "homepage": "https://github.com/CBIIT/bento-frontend#readme",
31
- "dependencies": {
32
- "@apollo/client": "^3.8.3",
33
- "@bento-core/cart": "^1.0.1-ccdihub.9",
34
- "@bento-core/tool-tip": "^1.0.0",
35
- "@bento-core/util": "^1.0.1-ccdihub.1",
36
- "clsx": "^2.1.1",
37
- "graphql-tag": "^2.12.6",
38
- "react-router-dom": "^5.1.2"
39
+ "publishConfig": {
40
+ "access": "public"
39
41
  },
40
- "devDependencies": {},
41
42
  "description": ""
42
43
  }
@@ -1,8 +1,11 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import {
3
3
  ThemeProvider,
4
4
  createTheme,
5
+ InputBase,
6
+ IconButton,
5
7
  } from '@material-ui/core';
8
+ import CloseIcon from '@material-ui/icons/Close';
6
9
  import CustomPagination from './pagination/CustomPagination';
7
10
  import ManageColumnView from './toolbar/ManageColumnView';
8
11
  import defaultTheme from './DefaultThemConfig';
@@ -10,8 +13,54 @@ import DownloadButton from './toolbar/DownloadButtonView';
10
13
 
11
14
  const downloadAreaStyle = {
12
15
  display: 'flex',
13
- borderTop: '1px solid #8A7F7C',
16
+ justifyContent: 'space-between',
17
+ alignItems: 'center',
18
+ borderTop: '3px solid #8A7F7C',
14
19
  paddingRight: '48px',
20
+ paddingTop: '5px',
21
+ paddingBottom: '5px',
22
+ };
23
+
24
+ const searchBarContainerStyle = {
25
+ display: 'flex',
26
+ alignItems: 'center',
27
+ marginRight: 'auto',
28
+ paddingLeft: '20px',
29
+ };
30
+
31
+ const getSearchBarWrapperStyle = (isFocused) => ({
32
+ display: 'flex',
33
+ alignItems: 'center',
34
+ width: '337px',
35
+ height: '30px',
36
+ backgroundColor: '#EAF5F5',
37
+ borderRadius: '8px',
38
+ border: isFocused ? '2px solid #15968E' : '1px solid #CCCCCC',
39
+ paddingLeft: '12px',
40
+ paddingRight: '4px',
41
+ opacity: 1,
42
+ });
43
+
44
+ const searchInputStyle = {
45
+ flex: 1,
46
+ fontSize: '14px',
47
+ '&::placeholder': {
48
+ color: '#757575',
49
+ opacity: 1,
50
+ },
51
+ };
52
+
53
+ const clearIconButtonStyle = {
54
+ padding: '4px',
55
+ cursor: 'pointer',
56
+ color: '#15968E',
57
+ };
58
+
59
+ const noMatchTextStyle = {
60
+ marginLeft: '16px',
61
+ fontSize: '14px',
62
+ color: '#000000',
63
+ fontWeight: 400,
15
64
  };
16
65
 
17
66
  const ExtendedView = ({
@@ -22,7 +71,20 @@ const ExtendedView = ({
22
71
  onPageChange,
23
72
  customTheme,
24
73
  queryVariables,
74
+ onSearch,
75
+ initialSearchValue = '',
25
76
  }) => {
77
+ const [searchValue, setSearchValue] = useState(initialSearchValue);
78
+ const [isSearching, setIsSearching] = useState(!!initialSearchValue);
79
+ const [hasResults, setHasResults] = useState(true);
80
+ const [isFocused, setIsFocused] = useState(false);
81
+
82
+ // Update searchValue when initialSearchValue changes
83
+ React.useEffect(() => {
84
+ setSearchValue(initialSearchValue);
85
+ setIsSearching(!!initialSearchValue);
86
+ }, [initialSearchValue]);
87
+
26
88
  const { extendedViewConfig } = table;
27
89
  if (!extendedViewConfig) {
28
90
  return null;
@@ -30,8 +92,53 @@ const ExtendedView = ({
30
92
  const {
31
93
  manageViewColumns = false,
32
94
  pagination = false,
95
+ hasExport = true,
33
96
  } = extendedViewConfig;
34
97
 
98
+ // Check if this is the Files tab
99
+ const isFilesTab = table.paginationAPIField === 'fileOverview' || table.paginationAPIField === 'getFilenames';
100
+
101
+ // Handler for search functionality
102
+ const handleSearch = () => {
103
+ if (searchValue.trim()) {
104
+ setIsSearching(true);
105
+ if (onSearch) {
106
+ onSearch(searchValue.trim());
107
+ }
108
+ } else {
109
+ // Clear search
110
+ setIsSearching(false);
111
+ setHasResults(true);
112
+ if (onSearch) {
113
+ onSearch('');
114
+ }
115
+ }
116
+ };
117
+
118
+ // Handler for Enter key press
119
+ const handleKeyPress = (event) => {
120
+ if (event.key === 'Enter') {
121
+ handleSearch();
122
+ }
123
+ };
124
+
125
+ // Handler for clearing search
126
+ const handleClear = () => {
127
+ setSearchValue('');
128
+ setIsSearching(false);
129
+ setHasResults(true);
130
+ if (onSearch) {
131
+ onSearch('');
132
+ }
133
+ };
134
+
135
+ // Update hasResults based on table totalRowCount
136
+ React.useEffect(() => {
137
+ if (isSearching && table.totalRowCount !== undefined) {
138
+ setHasResults(table.totalRowCount > 0);
139
+ }
140
+ }, [table.totalRowCount, isSearching]);
141
+
35
142
  const themeConfig = createTheme({ overrides: { ...defaultTheme(), ...customTheme } });
36
143
  return (
37
144
  <ThemeProvider theme={themeConfig}>
@@ -45,9 +152,39 @@ const ExtendedView = ({
45
152
  {
46
153
  (pagination) && (
47
154
  <div className="downloadArea" style={downloadAreaStyle}>
155
+ {/* Search bar - only show for Files tab */}
156
+ {isFilesTab && (
157
+ <div style={searchBarContainerStyle}>
158
+ <div style={getSearchBarWrapperStyle(isFocused)}>
159
+ <InputBase
160
+ placeholder="Search Files"
161
+ value={searchValue}
162
+ onChange={(e) => setSearchValue(e.target.value)}
163
+ onKeyPress={handleKeyPress}
164
+ onFocus={() => setIsFocused(true)}
165
+ onBlur={() => setIsFocused(false)}
166
+ style={searchInputStyle}
167
+ inputProps={{ 'aria-label': 'search files' }}
168
+ />
169
+ {searchValue && (
170
+ <IconButton
171
+ onClick={handleClear}
172
+ style={clearIconButtonStyle}
173
+ size="small"
174
+ aria-label="clear search"
175
+ >
176
+ <CloseIcon style={{ fontSize: '18px' }} />
177
+ </IconButton>
178
+ )}
179
+ </div>
180
+ {isSearching && !hasResults && (
181
+ <span style={noMatchTextStyle}>No Matching Records Found</span>
182
+ )}
183
+ </div>
184
+ )}
48
185
  <CustomPagination
49
186
  customTheme={customTheme.tblTopPgn}
50
- rowsPerPageOptions={[10, 25, 50, 100]}
187
+ rowsPerPageOptions={table.rowsPerPageOptions || [10, 25, 50, 100]}
51
188
  component="div"
52
189
  count={table.totalRowCount || 0}
53
190
  rowsPerPage={table.rowsPerPage || 10}
@@ -63,11 +200,13 @@ const ExtendedView = ({
63
200
  onColumnViewChange={onColumnViewChange}
64
201
  onAllColumnViewChange={onAllColumnViewChange}
65
202
  />
66
- <DownloadButton
67
- count={table.totalRowCount || 0}
68
- queryVariables={queryVariables}
69
- table={table}
70
- />
203
+ {hasExport && (
204
+ <DownloadButton
205
+ count={table.totalRowCount || 0}
206
+ queryVariables={queryVariables}
207
+ table={table}
208
+ />
209
+ )}
71
210
  </div>
72
211
  )
73
212
  }
package/src/TableView.js CHANGED
@@ -31,7 +31,9 @@ const downloadAreaStyle = {
31
31
  display: 'flex',
32
32
  borderTop: '1px solid #8A7F7C',
33
33
  borderBottom: '1px solid #8A7F7C',
34
- paddingRight: '41px',
34
+ paddingRight: '48px',
35
+ paddingTop: '5px',
36
+ paddingBottom: '5px',
35
37
  };
36
38
 
37
39
  const cartDownloadAreaStyle = {
@@ -52,6 +54,18 @@ const addScrollStyle = {
52
54
  height: '14px',
53
55
  };
54
56
 
57
+ const getPaginationStyle = (table, hasExport) => {
58
+ if (table.paginationAPIField === 'filesInList') {
59
+ return cartDownloadAreaStyle;
60
+ }
61
+
62
+ if (!hasExport) {
63
+ return { ...downloadAreaStyle, paddingRight: '0px' };
64
+ }
65
+
66
+ return downloadAreaStyle;
67
+ };
68
+
55
69
  const TableView = ({
56
70
  tableRows = [],
57
71
  table,
@@ -66,6 +80,8 @@ const TableView = ({
66
80
  themeConfig = {},
67
81
  queryVariables,
68
82
  navigation,
83
+ onSearch,
84
+ searchValue,
69
85
  }) => {
70
86
  useEffect(() => {
71
87
  const tableContainer = document.getElementById('tableContainer');
@@ -87,6 +103,7 @@ const TableView = ({
87
103
  const { extendedViewConfig } = table;
88
104
  const {
89
105
  manageViewColumns = false,
106
+ hasExport = true,
90
107
  } = extendedViewConfig;
91
108
  return (
92
109
  <>
@@ -99,6 +116,8 @@ const TableView = ({
99
116
  numSelected={table?.selectedRows?.length || 0}
100
117
  customTheme={themeConfig.extendedView}
101
118
  queryVariables={queryVariables}
119
+ onSearch={onSearch}
120
+ initialSearchValue={searchValue}
102
121
  />
103
122
  <CustomToolbar
104
123
  numSelected={table?.selectedRows?.length || 0}
@@ -136,10 +155,10 @@ const TableView = ({
136
155
  table={table}
137
156
  />
138
157
  )}
139
- <div className="downloadArea" style={table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : downloadAreaStyle}>
158
+ <div className="downloadArea" style={getPaginationStyle(table, hasExport)}>
140
159
  <CustomPagination
141
160
  customTheme={themeConfig.tblPgn}
142
- rowsPerPageOptions={[10, 25, 50, 100]}
161
+ rowsPerPageOptions={table.rowsPerPageOptions || [10, 25, 50, 100]}
143
162
  component="div"
144
163
  count={table.totalRowCount || 0}
145
164
  rowsPerPage={table.rowsPerPage || 10}
@@ -153,11 +172,13 @@ const TableView = ({
153
172
  onColumnViewChange={onColumnViewChange}
154
173
  onAllColumnViewChange={onAllColumnViewChange}
155
174
  />
156
- <DownloadButton
157
- count={table.totalRowCount || 0}
158
- queryVariables={queryVariables}
159
- table={table}
160
- />
175
+ {hasExport && (
176
+ <DownloadButton
177
+ count={table.totalRowCount || 0}
178
+ queryVariables={queryVariables}
179
+ table={table}
180
+ />
181
+ )}
161
182
  </div>
162
183
  </>
163
184
  );
@@ -32,7 +32,7 @@ const CustomTableBody = ({
32
32
  <ThemeProvider theme={themeConfig}>
33
33
  <TableBody>
34
34
  {rows
35
- .map((row) => (
35
+ .map((row, rowIndex) => (
36
36
  <TableRow>
37
37
  {
38
38
  displayColunms.map((column) => {
@@ -51,6 +51,7 @@ const CustomTableBody = ({
51
51
  <DisplayCell
52
52
  column={column}
53
53
  row={row}
54
+ rowIndex={rowIndex}
54
55
  themeConfig={themeConfig}
55
56
  navigation={navigation}
56
57
  />
@@ -44,7 +44,7 @@ const defaultTheme = () => ({
44
44
  MuiCheckbox: {
45
45
  colorSecondary: {
46
46
  '&.Mui-checked': {
47
- color: '#8DCAFF',
47
+ color: '#6D5F5B',
48
48
  },
49
49
  },
50
50
  root: {
@@ -4,9 +4,16 @@ import {
4
4
  Typography,
5
5
  } from '@material-ui/core';
6
6
  import { cellTypes } from '../util/Types';
7
+ import {
8
+ formatValueForDisplay,
9
+ isBracketStripEnabled,
10
+ stripSurroundingBrackets,
11
+ } from '../util/Dataformat';
7
12
  import CustomLinkView from './components/CustomLinkView';
8
13
  import DataFormatView from './components/DataFormatView';
9
14
  import CPIView from './components/CPIView';
15
+ import CPIMappingView from './components/CPIMappingView';
16
+ import StudiesDataAvailabilityView from './components/StudiesDataAvailabilityView';
10
17
 
11
18
  /**
12
19
  * Custom Column reneder
@@ -16,9 +23,18 @@ const CustomComponent = ({
16
23
  column,
17
24
  }) => {
18
25
  const { dataField, customCellRender } = column;
26
+ const raw = row[dataField];
27
+ const value = isBracketStripEnabled(column)
28
+ ? stripSurroundingBrackets(raw)
29
+ : raw;
19
30
  return (
20
31
  <>
21
- {customCellRender({ ...row, ...column, label: row[dataField] })}
32
+ {customCellRender({
33
+ ...row,
34
+ ...column,
35
+ [dataField]: value,
36
+ label: value,
37
+ })}
22
38
  </>
23
39
  );
24
40
  };
@@ -30,6 +46,7 @@ const CustomComponent = ({
30
46
  const ViewCell = ({
31
47
  column,
32
48
  row,
49
+ rowIndex,
33
50
  themeConfig,
34
51
  navigation,
35
52
  }) => {
@@ -65,10 +82,29 @@ const ViewCell = ({
65
82
  navigation={navigation}
66
83
  />
67
84
  );
85
+ case cellTypes.CPI_MAPPING:
86
+ return (
87
+ <CPIMappingView
88
+ row={row}
89
+ column={column}
90
+ rowIndex={rowIndex}
91
+ themeConfig={themeConfig}
92
+ navigation={navigation}
93
+ />
94
+ );
95
+ case cellTypes.STUDIES:
96
+ return (
97
+ <StudiesDataAvailabilityView
98
+ row={row}
99
+ column={column}
100
+ />
101
+ );
68
102
  default:
69
103
  return (
70
104
  <Typography>
71
- {row[column.dataField]}
105
+ {isBracketStripEnabled(column)
106
+ ? formatValueForDisplay(row[column.dataField])
107
+ : row[column.dataField]}
72
108
  </Typography>
73
109
  );
74
110
  }
@@ -77,6 +113,7 @@ const ViewCell = ({
77
113
  const DisplayCell = ({
78
114
  row,
79
115
  column,
116
+ rowIndex,
80
117
  themeConfig,
81
118
  navigation,
82
119
  }) => (
@@ -84,6 +121,7 @@ const DisplayCell = ({
84
121
  <ViewCell
85
122
  row={row}
86
123
  column={column}
124
+ rowIndex={rowIndex}
87
125
  themeConfig={themeConfig}
88
126
  navigation={navigation}
89
127
  />