@bento-core/table 1.0.1-ccdihub.98 → 1.0.1-ccdiintegrated.1
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.
- package/dist/ExtendedView.js +134 -7
- package/dist/TableView.js +23 -7
- package/dist/body/CustomTblBody.js +2 -1
- package/dist/body/DisplayBodyCell.js +18 -0
- package/dist/body/components/CPIMappingView.js +221 -0
- package/dist/body/components/CPIModal.js +436 -95
- package/dist/body/components/CPIView.js +64 -10
- package/dist/body/components/StudiesDataAvailabilityView.js +125 -0
- package/dist/body/components/assets/CPI_Icon_Dataset.svg +6 -0
- package/dist/body/components/assets/CPI_Icon_Multi.svg +6 -0
- package/dist/body/components/assets/CPI_Icon_Single.svg +4 -0
- package/dist/body/components/assets/CPI_Icon_Study.svg +11 -0
- package/dist/body/components/assets/Participant_Files.svg +17 -0
- package/dist/body/components/assets/Publications.svg +15 -0
- package/dist/body/components/assets/Sample_Files.svg +16 -0
- package/dist/body/components/assets/Study_Files.svg +21 -0
- package/dist/body/components/assets/download.svg +3 -0
- package/dist/header/CustomCell.js +4 -3
- package/dist/header/CustomTblHeader.js +16 -3
- package/dist/index.js +7 -0
- package/dist/toolbar/DownloadButtonView.js +30 -4
- package/dist/toolbar/SearchBar.js +92 -0
- package/dist/toolbar/assets/Search_Icon.svg +3 -0
- package/dist/util/Types.js +16 -4
- package/dist/wrapper/components/AddToCart/AddToCartView.js +126 -0
- package/dist/wrapper/components/AddToCart/ReduxAddToCart.js +27 -0
- package/dist/wrapper/components/Snackbar/Snackbar.js +5 -0
- package/package.json +25 -24
- package/src/ExtendedView.js +146 -7
- package/src/TableView.js +27 -8
- package/src/body/CustomTblBody.js +2 -1
- package/src/body/DisplayBodyCell.js +22 -0
- package/src/body/components/CPIMappingView.js +260 -0
- package/src/body/components/CPIModal.js +467 -103
- package/src/body/components/CPIView.js +75 -22
- package/src/body/components/StudiesDataAvailabilityView.js +121 -0
- package/src/body/components/assets/CPI_Icon_Dataset.svg +6 -0
- package/src/body/components/assets/CPI_Icon_Multi.svg +6 -0
- package/src/body/components/assets/CPI_Icon_Single.svg +4 -0
- package/src/body/components/assets/CPI_Icon_Study.svg +11 -0
- package/src/body/components/assets/Participant_Files.svg +17 -0
- package/src/body/components/assets/Publications.svg +15 -0
- package/src/body/components/assets/Sample_Files.svg +16 -0
- package/src/body/components/assets/Study_Files.svg +21 -0
- package/src/body/components/assets/download.svg +3 -0
- package/src/header/CustomCell.js +4 -3
- package/src/header/CustomTblHeader.js +13 -1
- package/src/index.js +1 -0
- package/src/toolbar/DownloadButtonView.js +20 -4
- package/src/toolbar/SearchBar.js +90 -0
- package/src/toolbar/assets/Search_Icon.svg +3 -0
- package/src/util/Types.js +10 -1
- package/src/wrapper/components/AddToCart/AddToCartView.js +132 -0
- package/src/wrapper/components/AddToCart/ReduxAddToCart.js +20 -0
- 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>
|
package/dist/util/Types.js
CHANGED
|
@@ -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;
|
|
@@ -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,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/table",
|
|
3
|
-
"version": "1.0.1-
|
|
3
|
+
"version": "1.0.1-ccdiintegrated.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"homepage": "https://github.com/CBIIT/bento-frontend#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/CBIIT/bento-frontend/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/CBIIT/bento-frontend.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"author": "CTOS Bento Team",
|
|
15
|
+
"type": "commonjs",
|
|
4
16
|
"main": "dist/index.js",
|
|
5
17
|
"scripts": {
|
|
6
18
|
"build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
|
7
19
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
20
|
"lint": "eslint src"
|
|
9
21
|
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@apollo/client": "^3.8.3",
|
|
24
|
+
"@bento-core/cart": "1.0.1-ccdiintegrated.1",
|
|
25
|
+
"@bento-core/tool-tip": "1.0.1-ccdiintegrated.1",
|
|
26
|
+
"@bento-core/util": "1.0.1-ccdiintegrated.1",
|
|
27
|
+
"clsx": "^2.1.1",
|
|
28
|
+
"graphql-tag": "^2.12.6",
|
|
29
|
+
"react-router-dom": "^5.1.2"
|
|
16
30
|
},
|
|
31
|
+
"devDependencies": {},
|
|
17
32
|
"peerDependencies": {
|
|
18
33
|
"@material-ui/core": "^4.12.4",
|
|
19
34
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -22,21 +37,7 @@
|
|
|
22
37
|
"react-dom": "^17.0.0",
|
|
23
38
|
"react-redux": "^7.2.1"
|
|
24
39
|
},
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
},
|
|
40
|
-
"devDependencies": {},
|
|
41
|
-
"description": ""
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
}
|
|
42
43
|
}
|
package/src/ExtendedView.js
CHANGED
|
@@ -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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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,7 @@ const downloadAreaStyle = {
|
|
|
31
31
|
display: 'flex',
|
|
32
32
|
borderTop: '1px solid #8A7F7C',
|
|
33
33
|
borderBottom: '1px solid #8A7F7C',
|
|
34
|
-
paddingRight: '
|
|
34
|
+
paddingRight: '48px',
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
const cartDownloadAreaStyle = {
|
|
@@ -52,6 +52,18 @@ const addScrollStyle = {
|
|
|
52
52
|
height: '14px',
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
const getPaginationStyle = (table, hasExport) => {
|
|
56
|
+
if (table.paginationAPIField === 'filesInList') {
|
|
57
|
+
return cartDownloadAreaStyle;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!hasExport) {
|
|
61
|
+
return { ...downloadAreaStyle, paddingRight: '0px' };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return downloadAreaStyle;
|
|
65
|
+
};
|
|
66
|
+
|
|
55
67
|
const TableView = ({
|
|
56
68
|
tableRows = [],
|
|
57
69
|
table,
|
|
@@ -66,6 +78,8 @@ const TableView = ({
|
|
|
66
78
|
themeConfig = {},
|
|
67
79
|
queryVariables,
|
|
68
80
|
navigation,
|
|
81
|
+
onSearch,
|
|
82
|
+
searchValue,
|
|
69
83
|
}) => {
|
|
70
84
|
useEffect(() => {
|
|
71
85
|
const tableContainer = document.getElementById('tableContainer');
|
|
@@ -87,6 +101,7 @@ const TableView = ({
|
|
|
87
101
|
const { extendedViewConfig } = table;
|
|
88
102
|
const {
|
|
89
103
|
manageViewColumns = false,
|
|
104
|
+
hasExport = true,
|
|
90
105
|
} = extendedViewConfig;
|
|
91
106
|
return (
|
|
92
107
|
<>
|
|
@@ -99,6 +114,8 @@ const TableView = ({
|
|
|
99
114
|
numSelected={table?.selectedRows?.length || 0}
|
|
100
115
|
customTheme={themeConfig.extendedView}
|
|
101
116
|
queryVariables={queryVariables}
|
|
117
|
+
onSearch={onSearch}
|
|
118
|
+
initialSearchValue={searchValue}
|
|
102
119
|
/>
|
|
103
120
|
<CustomToolbar
|
|
104
121
|
numSelected={table?.selectedRows?.length || 0}
|
|
@@ -136,10 +153,10 @@ const TableView = ({
|
|
|
136
153
|
table={table}
|
|
137
154
|
/>
|
|
138
155
|
)}
|
|
139
|
-
<div className="downloadArea" style={table
|
|
156
|
+
<div className="downloadArea" style={getPaginationStyle(table, hasExport)}>
|
|
140
157
|
<CustomPagination
|
|
141
158
|
customTheme={themeConfig.tblPgn}
|
|
142
|
-
rowsPerPageOptions={[10, 25, 50, 100]}
|
|
159
|
+
rowsPerPageOptions={table.rowsPerPageOptions || [10, 25, 50, 100]}
|
|
143
160
|
component="div"
|
|
144
161
|
count={table.totalRowCount || 0}
|
|
145
162
|
rowsPerPage={table.rowsPerPage || 10}
|
|
@@ -153,11 +170,13 @@ const TableView = ({
|
|
|
153
170
|
onColumnViewChange={onColumnViewChange}
|
|
154
171
|
onAllColumnViewChange={onAllColumnViewChange}
|
|
155
172
|
/>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
173
|
+
{hasExport && (
|
|
174
|
+
<DownloadButton
|
|
175
|
+
count={table.totalRowCount || 0}
|
|
176
|
+
queryVariables={queryVariables}
|
|
177
|
+
table={table}
|
|
178
|
+
/>
|
|
179
|
+
)}
|
|
161
180
|
</div>
|
|
162
181
|
</>
|
|
163
182
|
);
|