@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,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>
package/src/util/Types.js CHANGED
@@ -6,11 +6,16 @@ export const DISPLAY = 'DISPLAY';
6
6
  export const DEFAULT = 'DEFAULT';
7
7
  export const FORMAT_DATA = 'FORMAT_DATA';
8
8
  export const CPI = 'CPI';
9
+ export const CPI_MAPPING = 'CPI_MAPPING';
9
10
  export const FORMAT_BYTES = 'FORMAT_BYTES';
10
11
  export const TRANSFORM = 'TRANSFORM';
11
12
  export const STUDY_DOWNLOAD = 'STUDY_DOWNLOAD';
12
13
  export const EXPAND = 'EXPAND';
13
14
  export const DBGAP = 'DBGAP';
15
+ export const MODAL = 'MODAL';
16
+ export const EXCLUDE_FROM_DOWNLOAD = 'EXCLUDE_FROM_DOWNLOAD';
17
+
18
+ export const STUDIES = 'STUDIES';
14
19
 
15
20
  export const cellTypes = {
16
21
  CUSTOM_ELEM,
@@ -21,6 +26,8 @@ export const cellTypes = {
21
26
  DEFAULT,
22
27
  FORMAT_DATA,
23
28
  CPI,
29
+ CPI_MAPPING,
30
+ STUDIES,
24
31
  };
25
32
 
26
33
  export const cellStyles = {
@@ -28,11 +35,13 @@ export const cellStyles = {
28
35
  EXPAND,
29
36
  DBGAP,
30
37
  STUDY_DOWNLOAD,
38
+ MODAL,
39
+ EXCLUDE_FROM_DOWNLOAD,
31
40
  };
32
41
 
33
42
  export const actionCellTypes = [CHECKBOX, DELETE];
34
43
 
35
- export const notIncludedCellStyle = [STUDY_DOWNLOAD];
44
+ export const notIncludedCellStyle = [STUDY_DOWNLOAD, EXCLUDE_FROM_DOWNLOAD];
36
45
 
37
46
  export const FORMAT_DATA_CELLS = [FORMAT_BYTES];
38
47
 
@@ -46,7 +46,7 @@ export function convertToCSV(jsonse, keysToInclude, header) {
46
46
  } else {
47
47
  line += entry[keyName] !== null ? `"${entry[keyName]}"` : ' ';
48
48
  }
49
- } else if (keyName === 'last_known_survival_status' || keyName === 'sample_id' || keyName === 'data_category') {
49
+ } 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') {
50
50
  if (!entry[keyName] || entry[keyName] === '[]') {
51
51
  line += '';
52
52
  } else if (entry[keyName].toString().charAt(0) === '[' && entry[keyName].toString().charAt(entry[keyName].toString().length - 1) === ']') {
@@ -103,6 +103,13 @@ export function downloadJson(tableData, table, downloadFileName) {
103
103
  let survivalStatus = entry.last_known_survival_status;
104
104
  let sampleId = entry.sample_id;
105
105
  let dataCategory = entry.data_category;
106
+ let participantId = entry.participant_id;
107
+ let anatomicSite = entry.anatomic_site;
108
+ let ageAtCollection = entry.participant_age_at_collection;
109
+ let sampleDescription = entry.sample_description;
110
+ let percentTumor = entry.percent_tumor;
111
+ let percentNecrosis = entry.percent_necrosis;
112
+ let consentCodes = entry.consent_codes;
106
113
  const toReturn = { ...entry };
107
114
 
108
115
  if (survivalStatus && survivalStatus.toString().charAt(0) === '[' && survivalStatus.toString().charAt(survivalStatus.toString().length - 1) === ']') {
@@ -117,6 +124,35 @@ export function downloadJson(tableData, table, downloadFileName) {
117
124
  dataCategory = dataCategory.toString().substring(1, dataCategory.length - 1);
118
125
  toReturn['Data Category'] = dataCategory;
119
126
  }
127
+ if (participantId && participantId.toString().charAt(0) === '[' && participantId.toString().charAt(participantId.toString().length - 1) === ']') {
128
+ participantId = participantId.toString().substring(1, participantId.length - 1);
129
+ toReturn['Participant ID'] = participantId;
130
+ }
131
+ if (anatomicSite && anatomicSite.toString().charAt(0) === '[' && anatomicSite.toString().charAt(anatomicSite.toString().length - 1) === ']') {
132
+ anatomicSite = anatomicSite.toString().substring(1, anatomicSite.length - 1);
133
+ toReturn['Anatomic Site'] = anatomicSite;
134
+ }
135
+ if (ageAtCollection && ageAtCollection.toString().charAt(0) === '[' && ageAtCollection.toString().charAt(ageAtCollection.toString().length - 1) === ']') {
136
+ ageAtCollection = ageAtCollection.toString().substring(1, ageAtCollection.length - 1);
137
+ toReturn['Age at Collection'] = ageAtCollection;
138
+ }
139
+ if (sampleDescription && sampleDescription.toString().charAt(0) === '[' && sampleDescription.toString().charAt(sampleDescription.toString().length - 1) === ']') {
140
+ sampleDescription = sampleDescription.toString().substring(1, sampleDescription.length - 1);
141
+ toReturn['Sample Description'] = sampleDescription;
142
+ }
143
+ if (percentTumor && percentTumor.toString().charAt(0) === '[' && percentTumor.toString().charAt(percentTumor.toString().length - 1) === ']') {
144
+ percentTumor = percentTumor.toString().substring(1, percentTumor.length - 1);
145
+ toReturn['Percent Tumor'] = percentTumor;
146
+ }
147
+ if (percentNecrosis && percentNecrosis.toString().charAt(0) === '[' && percentNecrosis.toString().charAt(percentNecrosis.toString().length - 1) === ']') {
148
+ percentNecrosis = percentNecrosis.toString().substring(1, percentNecrosis.length - 1);
149
+ toReturn['Percent Necrosis'] = percentNecrosis;
150
+ }
151
+ if (consentCodes && consentCodes.toString().charAt(0) === '[' && consentCodes.toString().charAt(consentCodes.toString().length - 1) === ']') {
152
+ consentCodes = consentCodes.toString().substring(1, consentCodes.length - 1);
153
+ toReturn['Consent Codes'] = consentCodes;
154
+ }
155
+
120
156
  toDelete.forEach((column) => delete toReturn[column.dataField]);
121
157
  return toReturn;
122
158
  });
@@ -0,0 +1,132 @@
1
+ import React, { useState } from 'react';
2
+ import ToolTip from '@bento-core/tool-tip';
3
+ import { Button } from '@material-ui/core';
4
+ import SnackbarView from '../Snackbar/Snackbar';
5
+ import AlertView from '../AddToCartDialog/AddToCartDialogAlertView';
6
+
7
+ const customTooltip = {
8
+ border: '#03A383 1px solid',
9
+ };
10
+
11
+ const customArrow = {
12
+ '&::before': {
13
+ border: '#03A383 1px solid',
14
+ },
15
+ };
16
+
17
+ const iconStyle = {
18
+ paddingRight: '20px',
19
+ paddingBottom: '20px',
20
+ paddingLeft: '5px',
21
+ };
22
+
23
+ export const ToolTipView = (props) => {
24
+ const {
25
+ section,
26
+ tooltipCofig,
27
+ } = props;
28
+ const {
29
+ icon,
30
+ src,
31
+ alt,
32
+ arrow = false,
33
+ tooltipText,
34
+ } = tooltipCofig;
35
+ return (
36
+ <ToolTip
37
+ placement="top"
38
+ title={tooltipText || `${tooltipCofig[section]}`}
39
+ arrow={arrow}
40
+ classes={{
41
+ tooltip: customTooltip,
42
+ arrow: customArrow,
43
+ }}
44
+ >
45
+ <img src={icon || src} alt={alt} style={iconStyle} />
46
+ </ToolTip>
47
+ );
48
+ };
49
+
50
+ // const checkDuplicate = (cartFiles, ids) => {
51
+ // const newIds = [];
52
+ // for (let i = 0; i < ids.length; i += 1) {
53
+ // if (!cartFiles.includes(ids[i])) {
54
+ // newIds.push(ids[i]);
55
+ // }
56
+ // }
57
+ // return newIds;
58
+ // };
59
+
60
+ const checkDuplicate = (cartFiles, ids) => (ids.filter((id) => !cartFiles[id]));
61
+
62
+ const AddToCartView = (props) => {
63
+ const {
64
+ cartFiles,
65
+ fileId,
66
+ buttonStyle,
67
+ addFiles,
68
+ count,
69
+ } = props;
70
+
71
+ // const [isDataloading, setIsDataloading] = useState(false);
72
+ const [openSnackbar, setOpenSnackbar] = useState(false);
73
+ const [displayAlter, setAlterDisplay] = useState(false);
74
+
75
+ const cartFilesDict = {};
76
+ cartFiles.forEach((file) => { cartFilesDict[file] = true; });
77
+
78
+ // const backdropCls = {
79
+ // width: '100%',
80
+ // zIndex: 99999,
81
+ // background: 'rgba(0, 0, 0, 0.1)',
82
+ // };
83
+ /**
84
+ * verify and set file ids
85
+ */
86
+ const addAllFiles = () => {
87
+ const idsInitial = fileId || [];
88
+ const ids = [idsInitial];
89
+ const fileCount = ids.length;
90
+ const upperLimit = 200000;
91
+ const cartCount = cartFiles.length;
92
+ if (fileCount <= upperLimit && cartCount < upperLimit) {
93
+ const newIds = checkDuplicate(cartFiles, ids);
94
+ if (cartCount + newIds.length <= upperLimit) {
95
+ addFiles(newIds);
96
+ setOpenSnackbar(true);
97
+ } else {
98
+ setAlterDisplay(true);
99
+ }
100
+ } else {
101
+ setAlterDisplay(true);
102
+ }
103
+ };
104
+
105
+ return (
106
+ <>
107
+ <Button
108
+ variant="outlined"
109
+ onClick={addAllFiles}
110
+ disableRipple
111
+ style={buttonStyle}
112
+ disabled={false}
113
+ >
114
+ ADD TO CART
115
+ </Button>
116
+ <SnackbarView
117
+ open={openSnackbar}
118
+ count={count}
119
+ onClose={() => setOpenSnackbar(false)}
120
+ />
121
+ {displayAlter && (
122
+ <AlertView
123
+ alertMessage="The cart is limited to 200,000 files. Please narrow the search criteria or remove some files from the cart to add more."
124
+ open={displayAlter}
125
+ onClose={() => setAlterDisplay(false)}
126
+ />
127
+ )}
128
+ </>
129
+ );
130
+ };
131
+
132
+ export default AddToCartView;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { connect } from 'react-redux';
3
+ import { onAddCartFiles } from '@bento-core/cart';
4
+ import AddToCartView from './AddToCartView';
5
+
6
+ const AddToCartRedux = (props) => <AddToCartView {...props} />;
7
+
8
+ /**
9
+ * create query variable with actie filters
10
+ */
11
+ const mapStateToProps = (state) => ({
12
+ count: state.cartReducer && state.cartReducer.count,
13
+ cartFiles: state.cartReducer && state.cartReducer.filesId,
14
+ });
15
+
16
+ const mapDispatchToProps = (dispatch) => ({
17
+ addFiles: (files) => { dispatch(onAddCartFiles(files)); },
18
+ });
19
+
20
+ export default connect(mapStateToProps, mapDispatchToProps)(AddToCartRedux);
@@ -22,6 +22,7 @@ const SnackbarView = (props) => {
22
22
  open={open}
23
23
  autoHideDuration={3000}
24
24
  anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
25
+ style={{ bottom: '-45%', zIndex: '-10000', pointerEvents: 'none' }}
25
26
  message={(
26
27
  <div className="snackBarMessage">
27
28
  <span className="snackBarMessageIcon">