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

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 (57) hide show
  1. package/dist/ExtendedView.js +134 -7
  2. package/dist/TableView.js +23 -7
  3. package/dist/body/CustomTblBody.js +2 -1
  4. package/dist/body/DisplayBodyCell.js +18 -0
  5. package/dist/body/components/CPIMappingView.js +221 -0
  6. package/dist/body/components/CPIModal.js +434 -93
  7. package/dist/body/components/CPIView.js +64 -10
  8. package/dist/body/components/StudiesDataAvailabilityView.js +125 -0
  9. package/dist/body/components/assets/CPI_Icon_Dataset.svg +6 -0
  10. package/dist/body/components/assets/CPI_Icon_Multi.svg +6 -0
  11. package/dist/body/components/assets/CPI_Icon_Single.svg +4 -0
  12. package/dist/body/components/assets/CPI_Icon_Study.svg +11 -0
  13. package/dist/body/components/assets/Participant_Files.svg +17 -0
  14. package/dist/body/components/assets/Publications.svg +15 -0
  15. package/dist/body/components/assets/Sample_Files.svg +16 -0
  16. package/dist/body/components/assets/Study_Files.svg +21 -0
  17. package/dist/body/components/assets/download.svg +3 -0
  18. package/dist/header/CustomCell.js +4 -3
  19. package/dist/header/CustomTblHeader.js +16 -3
  20. package/dist/index.js +7 -0
  21. package/dist/toolbar/DownloadButtonView.js +30 -4
  22. package/dist/toolbar/SearchBar.js +92 -0
  23. package/dist/toolbar/assets/Search_Icon.svg +3 -0
  24. package/dist/util/Types.js +16 -4
  25. package/dist/util/downloadTable.js +36 -1
  26. package/dist/wrapper/components/AddToCart/AddToCartView.js +126 -0
  27. package/dist/wrapper/components/AddToCart/ReduxAddToCart.js +27 -0
  28. package/dist/wrapper/components/Snackbar/Snackbar.js +5 -0
  29. package/package.json +23 -22
  30. package/src/ExtendedView.js +146 -7
  31. package/src/TableView.js +27 -8
  32. package/src/body/CustomTblBody.js +2 -1
  33. package/src/body/DisplayBodyCell.js +22 -0
  34. package/src/body/components/CPIMappingView.js +260 -0
  35. package/src/body/components/CPIModal.js +464 -101
  36. package/src/body/components/CPIView.js +75 -22
  37. package/src/body/components/StudiesDataAvailabilityView.js +121 -0
  38. package/src/body/components/assets/CPI_Icon_Dataset.svg +6 -0
  39. package/src/body/components/assets/CPI_Icon_Multi.svg +6 -0
  40. package/src/body/components/assets/CPI_Icon_Single.svg +4 -0
  41. package/src/body/components/assets/CPI_Icon_Study.svg +11 -0
  42. package/src/body/components/assets/Participant_Files.svg +17 -0
  43. package/src/body/components/assets/Publications.svg +15 -0
  44. package/src/body/components/assets/Sample_Files.svg +16 -0
  45. package/src/body/components/assets/Study_Files.svg +21 -0
  46. package/src/body/components/assets/download.svg +3 -0
  47. package/src/header/CustomCell.js +4 -3
  48. package/src/header/CustomTblHeader.js +13 -1
  49. package/src/index.js +1 -0
  50. package/src/toolbar/DownloadButtonView.js +20 -4
  51. package/src/toolbar/SearchBar.js +90 -0
  52. package/src/toolbar/assets/Search_Icon.svg +3 -0
  53. package/src/util/Types.js +10 -1
  54. package/src/util/downloadTable.js +37 -1
  55. package/src/wrapper/components/AddToCart/AddToCartView.js +132 -0
  56. package/src/wrapper/components/AddToCart/ReduxAddToCart.js +20 -0
  57. package/src/wrapper/components/Snackbar/Snackbar.js +1 -0
@@ -0,0 +1,92 @@
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 _core = require("@material-ui/core");
9
+ var _Search_Icon = _interopRequireDefault(require("./assets/Search_Icon.svg"));
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
+ const SearchBar = _ref => {
14
+ let {
15
+ onSearch
16
+ } = _ref;
17
+ const [searchValue, setSearchValue] = (0, _react.useState)('');
18
+ const handleSearchClick = () => {
19
+ if (onSearch) {
20
+ onSearch(searchValue);
21
+ }
22
+ };
23
+ const handleKeyPress = event => {
24
+ if (event.key === 'Enter') {
25
+ handleSearchClick();
26
+ }
27
+ };
28
+ const handleChange = event => {
29
+ setSearchValue(event.target.value);
30
+ };
31
+ const useStyles = (0, _core.makeStyles)({
32
+ searchContainer: {
33
+ display: 'flex',
34
+ alignItems: 'center',
35
+ border: '0.75px solid #606060',
36
+ borderRadius: '5px',
37
+ backgroundColor: '#ffffff',
38
+ height: '36px',
39
+ width: '300px',
40
+ paddingLeft: '12px',
41
+ paddingRight: '4px',
42
+ marginTop: '8px',
43
+ marginBottom: '8px',
44
+ marginLeft: '-28px',
45
+ float: 'left'
46
+ },
47
+ inputBase: {
48
+ flex: 1,
49
+ fontFamily: 'Poppins',
50
+ fontSize: '14px',
51
+ color: '#000000',
52
+ '& input::placeholder': {
53
+ color: '#9B9B9B',
54
+ opacity: 1
55
+ }
56
+ },
57
+ searchButton: {
58
+ padding: '6px',
59
+ backgroundColor: 'transparent',
60
+ '&:hover': {
61
+ backgroundColor: 'rgba(0, 0, 0, 0.04)'
62
+ }
63
+ },
64
+ searchIcon: {
65
+ width: '15px',
66
+ height: '15px'
67
+ }
68
+ });
69
+ const classes = useStyles();
70
+ return /*#__PURE__*/_react.default.createElement("div", {
71
+ className: classes.searchContainer
72
+ }, /*#__PURE__*/_react.default.createElement(_core.InputBase, {
73
+ className: classes.inputBase,
74
+ placeholder: "Search...",
75
+ value: searchValue,
76
+ onChange: handleChange,
77
+ onKeyPress: handleKeyPress,
78
+ inputProps: {
79
+ 'aria-label': 'search'
80
+ }
81
+ }), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
82
+ className: classes.searchButton,
83
+ onClick: handleSearchClick,
84
+ "aria-label": "search"
85
+ }, /*#__PURE__*/_react.default.createElement("img", {
86
+ src: _Search_Icon.default,
87
+ alt: "search",
88
+ className: classes.searchIcon
89
+ })));
90
+ };
91
+ var _default = SearchBar;
92
+ exports.default = _default;
@@ -0,0 +1,3 @@
1
+ <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M6.4134 1C3.43007 1 1 3.43007 1 6.4134C1 9.39672 3.43007 11.8268 6.4134 11.8268C7.71072 11.8268 8.90214 11.3661 9.83589 10.6014L13.0681 13.8336C13.118 13.8855 13.1777 13.927 13.2438 13.9556C13.3099 13.9841 13.3811 13.9992 13.4531 14C13.5251 14.0007 13.5966 13.9871 13.6632 13.9598C13.7299 13.9326 13.7905 13.8924 13.8414 13.8414C13.8924 13.7905 13.9326 13.7299 13.9598 13.6632C13.9871 13.5966 14.0007 13.5251 14 13.4531C13.9992 13.3811 13.9841 13.3099 13.9556 13.2438C13.927 13.1777 13.8855 13.118 13.8336 13.0681L10.6014 9.83589C11.3661 8.90214 11.8268 7.71072 11.8268 6.4134C11.8268 3.43007 9.39672 1 6.4134 1ZM6.4134 2.08268C8.8116 2.08268 10.7441 4.0152 10.7441 6.4134C10.7441 8.8116 8.8116 10.7441 6.4134 10.7441C4.0152 10.7441 2.08268 8.8116 2.08268 6.4134C2.08268 4.0152 4.0152 2.08268 6.4134 2.08268Z" fill="#4D889E" stroke="#4D889E"/>
3
+ </svg>
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.notIncludedCellStyle = exports.headerTypes = exports.dataFormatTypes = exports.cellTypes = exports.cellStyles = exports.actionCellTypes = exports.TRANSFORM = exports.STUDY_DOWNLOAD = exports.LINK = exports.FORMAT_DATA_CELLS = exports.FORMAT_DATA = exports.FORMAT_BYTES = exports.EXPAND = exports.DISPLAY = exports.DELETE = exports.DEFAULT = exports.DBGAP = exports.ComponentTypes = exports.CUSTOM_ELEM = exports.CPI = exports.CHECKBOX = void 0;
6
+ exports.notIncludedCellStyle = exports.headerTypes = exports.dataFormatTypes = exports.cellTypes = exports.cellStyles = exports.actionCellTypes = exports.TRANSFORM = exports.STUDY_DOWNLOAD = exports.STUDIES = exports.MODAL = exports.LINK = exports.FORMAT_DATA_CELLS = exports.FORMAT_DATA = exports.FORMAT_BYTES = exports.EXPAND = exports.EXCLUDE_FROM_DOWNLOAD = exports.DISPLAY = exports.DELETE = exports.DEFAULT = exports.DBGAP = exports.ComponentTypes = exports.CUSTOM_ELEM = exports.CPI_MAPPING = exports.CPI = exports.CHECKBOX = void 0;
7
7
  const CHECKBOX = 'CHECKBOX';
8
8
  exports.CHECKBOX = CHECKBOX;
9
9
  const DELETE = 'DELETE';
@@ -20,6 +20,8 @@ const FORMAT_DATA = 'FORMAT_DATA';
20
20
  exports.FORMAT_DATA = FORMAT_DATA;
21
21
  const CPI = 'CPI';
22
22
  exports.CPI = CPI;
23
+ const CPI_MAPPING = 'CPI_MAPPING';
24
+ exports.CPI_MAPPING = CPI_MAPPING;
23
25
  const FORMAT_BYTES = 'FORMAT_BYTES';
24
26
  exports.FORMAT_BYTES = FORMAT_BYTES;
25
27
  const TRANSFORM = 'TRANSFORM';
@@ -30,6 +32,12 @@ const EXPAND = 'EXPAND';
30
32
  exports.EXPAND = EXPAND;
31
33
  const DBGAP = 'DBGAP';
32
34
  exports.DBGAP = DBGAP;
35
+ const MODAL = 'MODAL';
36
+ exports.MODAL = MODAL;
37
+ const EXCLUDE_FROM_DOWNLOAD = 'EXCLUDE_FROM_DOWNLOAD';
38
+ exports.EXCLUDE_FROM_DOWNLOAD = EXCLUDE_FROM_DOWNLOAD;
39
+ const STUDIES = 'STUDIES';
40
+ exports.STUDIES = STUDIES;
33
41
  const cellTypes = {
34
42
  CUSTOM_ELEM,
35
43
  LINK,
@@ -38,19 +46,23 @@ const cellTypes = {
38
46
  DELETE,
39
47
  DEFAULT,
40
48
  FORMAT_DATA,
41
- CPI
49
+ CPI,
50
+ CPI_MAPPING,
51
+ STUDIES
42
52
  };
43
53
  exports.cellTypes = cellTypes;
44
54
  const cellStyles = {
45
55
  TRANSFORM,
46
56
  EXPAND,
47
57
  DBGAP,
48
- STUDY_DOWNLOAD
58
+ STUDY_DOWNLOAD,
59
+ MODAL,
60
+ EXCLUDE_FROM_DOWNLOAD
49
61
  };
50
62
  exports.cellStyles = cellStyles;
51
63
  const actionCellTypes = [CHECKBOX, DELETE];
52
64
  exports.actionCellTypes = actionCellTypes;
53
- const notIncludedCellStyle = [STUDY_DOWNLOAD];
65
+ const notIncludedCellStyle = [STUDY_DOWNLOAD, EXCLUDE_FROM_DOWNLOAD];
54
66
  exports.notIncludedCellStyle = notIncludedCellStyle;
55
67
  const FORMAT_DATA_CELLS = [FORMAT_BYTES];
56
68
  exports.FORMAT_DATA_CELLS = FORMAT_DATA_CELLS;
@@ -60,7 +60,7 @@ function convertToCSV(jsonse, keysToInclude, header) {
60
60
  } else {
61
61
  line += entry[keyName] !== null ? "\"".concat(entry[keyName], "\"") : ' ';
62
62
  }
63
- } else if (keyName === 'last_known_survival_status' || keyName === 'sample_id' || keyName === 'data_category') {
63
+ } else if (keyName === 'last_known_survival_status' || keyName === 'sample_id' || keyName === 'data_category' || keyName === 'participant_id' || keyName === 'anatomic_site' || keyName === 'participant_age_at_collection' || keyName === 'sample_description' || keyName === 'percent_tumor' || keyName === 'percent_necrosis' || keyName === 'consent_codes') {
64
64
  if (!entry[keyName] || entry[keyName] === '[]') {
65
65
  line += '';
66
66
  } else if (entry[keyName].toString().charAt(0) === '[' && entry[keyName].toString().charAt(entry[keyName].toString().length - 1) === ']') {
@@ -162,6 +162,13 @@ function downloadJson(tableData, table, downloadFileName) {
162
162
  let survivalStatus = entry.last_known_survival_status;
163
163
  let sampleId = entry.sample_id;
164
164
  let dataCategory = entry.data_category;
165
+ let participantId = entry.participant_id;
166
+ let anatomicSite = entry.anatomic_site;
167
+ let ageAtCollection = entry.participant_age_at_collection;
168
+ let sampleDescription = entry.sample_description;
169
+ let percentTumor = entry.percent_tumor;
170
+ let percentNecrosis = entry.percent_necrosis;
171
+ let consentCodes = entry.consent_codes;
165
172
  const toReturn = _objectSpread({}, entry);
166
173
  if (survivalStatus && survivalStatus.toString().charAt(0) === '[' && survivalStatus.toString().charAt(survivalStatus.toString().length - 1) === ']') {
167
174
  survivalStatus = survivalStatus.toString().substring(1, survivalStatus.length - 1);
@@ -175,6 +182,34 @@ function downloadJson(tableData, table, downloadFileName) {
175
182
  dataCategory = dataCategory.toString().substring(1, dataCategory.length - 1);
176
183
  toReturn['Data Category'] = dataCategory;
177
184
  }
185
+ if (participantId && participantId.toString().charAt(0) === '[' && participantId.toString().charAt(participantId.toString().length - 1) === ']') {
186
+ participantId = participantId.toString().substring(1, participantId.length - 1);
187
+ toReturn['Participant ID'] = participantId;
188
+ }
189
+ if (anatomicSite && anatomicSite.toString().charAt(0) === '[' && anatomicSite.toString().charAt(anatomicSite.toString().length - 1) === ']') {
190
+ anatomicSite = anatomicSite.toString().substring(1, anatomicSite.length - 1);
191
+ toReturn['Anatomic Site'] = anatomicSite;
192
+ }
193
+ if (ageAtCollection && ageAtCollection.toString().charAt(0) === '[' && ageAtCollection.toString().charAt(ageAtCollection.toString().length - 1) === ']') {
194
+ ageAtCollection = ageAtCollection.toString().substring(1, ageAtCollection.length - 1);
195
+ toReturn['Age at Collection'] = ageAtCollection;
196
+ }
197
+ if (sampleDescription && sampleDescription.toString().charAt(0) === '[' && sampleDescription.toString().charAt(sampleDescription.toString().length - 1) === ']') {
198
+ sampleDescription = sampleDescription.toString().substring(1, sampleDescription.length - 1);
199
+ toReturn['Sample Description'] = sampleDescription;
200
+ }
201
+ if (percentTumor && percentTumor.toString().charAt(0) === '[' && percentTumor.toString().charAt(percentTumor.toString().length - 1) === ']') {
202
+ percentTumor = percentTumor.toString().substring(1, percentTumor.length - 1);
203
+ toReturn['Percent Tumor'] = percentTumor;
204
+ }
205
+ if (percentNecrosis && percentNecrosis.toString().charAt(0) === '[' && percentNecrosis.toString().charAt(percentNecrosis.toString().length - 1) === ']') {
206
+ percentNecrosis = percentNecrosis.toString().substring(1, percentNecrosis.length - 1);
207
+ toReturn['Percent Necrosis'] = percentNecrosis;
208
+ }
209
+ if (consentCodes && consentCodes.toString().charAt(0) === '[' && consentCodes.toString().charAt(consentCodes.toString().length - 1) === ']') {
210
+ consentCodes = consentCodes.toString().substring(1, consentCodes.length - 1);
211
+ toReturn['Consent Codes'] = consentCodes;
212
+ }
178
213
  toDelete.forEach(column => delete toReturn[column.dataField]);
179
214
  return toReturn;
180
215
  });
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.ToolTipView = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
9
+ var _core = require("@material-ui/core");
10
+ var _Snackbar = _interopRequireDefault(require("../Snackbar/Snackbar"));
11
+ var _AddToCartDialogAlertView = _interopRequireDefault(require("../AddToCartDialog/AddToCartDialogAlertView"));
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ 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); }
14
+ 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; }
15
+ const customTooltip = {
16
+ border: '#03A383 1px solid'
17
+ };
18
+ const customArrow = {
19
+ '&::before': {
20
+ border: '#03A383 1px solid'
21
+ }
22
+ };
23
+ const iconStyle = {
24
+ paddingRight: '20px',
25
+ paddingBottom: '20px',
26
+ paddingLeft: '5px'
27
+ };
28
+ const ToolTipView = props => {
29
+ const {
30
+ section,
31
+ tooltipCofig
32
+ } = props;
33
+ const {
34
+ icon,
35
+ src,
36
+ alt,
37
+ arrow = false,
38
+ tooltipText
39
+ } = tooltipCofig;
40
+ return /*#__PURE__*/_react.default.createElement(_toolTip.default, {
41
+ placement: "top",
42
+ title: tooltipText || "".concat(tooltipCofig[section]),
43
+ arrow: arrow,
44
+ classes: {
45
+ tooltip: customTooltip,
46
+ arrow: customArrow
47
+ }
48
+ }, /*#__PURE__*/_react.default.createElement("img", {
49
+ src: icon || src,
50
+ alt: alt,
51
+ style: iconStyle
52
+ }));
53
+ };
54
+
55
+ // const checkDuplicate = (cartFiles, ids) => {
56
+ // const newIds = [];
57
+ // for (let i = 0; i < ids.length; i += 1) {
58
+ // if (!cartFiles.includes(ids[i])) {
59
+ // newIds.push(ids[i]);
60
+ // }
61
+ // }
62
+ // return newIds;
63
+ // };
64
+ exports.ToolTipView = ToolTipView;
65
+ const checkDuplicate = (cartFiles, ids) => ids.filter(id => !cartFiles[id]);
66
+ const AddToCartView = props => {
67
+ const {
68
+ cartFiles,
69
+ fileId,
70
+ buttonStyle,
71
+ addFiles,
72
+ count
73
+ } = props;
74
+
75
+ // const [isDataloading, setIsDataloading] = useState(false);
76
+ const [openSnackbar, setOpenSnackbar] = (0, _react.useState)(false);
77
+ const [displayAlter, setAlterDisplay] = (0, _react.useState)(false);
78
+ const cartFilesDict = {};
79
+ cartFiles.forEach(file => {
80
+ cartFilesDict[file] = true;
81
+ });
82
+
83
+ // const backdropCls = {
84
+ // width: '100%',
85
+ // zIndex: 99999,
86
+ // background: 'rgba(0, 0, 0, 0.1)',
87
+ // };
88
+ /**
89
+ * verify and set file ids
90
+ */
91
+ const addAllFiles = () => {
92
+ const idsInitial = fileId || [];
93
+ const ids = [idsInitial];
94
+ const fileCount = ids.length;
95
+ const upperLimit = 200000;
96
+ const cartCount = cartFiles.length;
97
+ if (fileCount <= upperLimit && cartCount < upperLimit) {
98
+ const newIds = checkDuplicate(cartFiles, ids);
99
+ if (cartCount + newIds.length <= upperLimit) {
100
+ addFiles(newIds);
101
+ setOpenSnackbar(true);
102
+ } else {
103
+ setAlterDisplay(true);
104
+ }
105
+ } else {
106
+ setAlterDisplay(true);
107
+ }
108
+ };
109
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
110
+ variant: "outlined",
111
+ onClick: addAllFiles,
112
+ disableRipple: true,
113
+ style: buttonStyle,
114
+ disabled: false
115
+ }, "ADD TO CART"), /*#__PURE__*/_react.default.createElement(_Snackbar.default, {
116
+ open: openSnackbar,
117
+ count: count,
118
+ onClose: () => setOpenSnackbar(false)
119
+ }), displayAlter && /*#__PURE__*/_react.default.createElement(_AddToCartDialogAlertView.default, {
120
+ alertMessage: "The cart is limited to 200,000 files. Please narrow the search criteria or remove some files from the cart to add more.",
121
+ open: displayAlter,
122
+ onClose: () => setAlterDisplay(false)
123
+ }));
124
+ };
125
+ var _default = AddToCartView;
126
+ exports.default = _default;
@@ -0,0 +1,27 @@
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 _reactRedux = require("react-redux");
9
+ var _cart = require("@bento-core/cart");
10
+ var _AddToCartView = _interopRequireDefault(require("./AddToCartView"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ const AddToCartRedux = props => /*#__PURE__*/_react.default.createElement(_AddToCartView.default, props);
13
+
14
+ /**
15
+ * create query variable with actie filters
16
+ */
17
+ const mapStateToProps = state => ({
18
+ count: state.cartReducer && state.cartReducer.count,
19
+ cartFiles: state.cartReducer && state.cartReducer.filesId
20
+ });
21
+ const mapDispatchToProps = dispatch => ({
22
+ addFiles: files => {
23
+ dispatch((0, _cart.onAddCartFiles)(files));
24
+ }
25
+ });
26
+ var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(AddToCartRedux);
27
+ exports.default = _default;
@@ -27,6 +27,11 @@ const SnackbarView = props => {
27
27
  vertical: 'bottom',
28
28
  horizontal: 'right'
29
29
  },
30
+ style: {
31
+ bottom: '-45%',
32
+ zIndex: '-10000',
33
+ pointerEvents: 'none'
34
+ },
30
35
  message: /*#__PURE__*/_react.default.createElement("div", {
31
36
  className: "snackBarMessage"
32
37
  }, /*#__PURE__*/_react.default.createElement("span", {
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.2",
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.1",
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',
16
+ justifyContent: 'space-between',
17
+ alignItems: 'center',
13
18
  borderTop: '1px 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: '18px',
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
  }