@bento-core/table 1.0.1-ccdihub.9 → 1.0.1-ccdihub.91
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/DefaultThemConfig.js +1 -1
- package/dist/ExtendedView.js +25 -14
- package/dist/TableView.js +79 -7
- package/dist/body/CustomTblBody.js +5 -2
- package/dist/body/DisplayBodyCell.js +17 -3
- package/dist/body/components/CPIModal.js +363 -0
- package/dist/body/components/CPIView.js +117 -0
- package/dist/body/components/ModalStyle.js +121 -0
- package/dist/body/components/assets/CPI_icon.svg +22 -0
- package/dist/body/components/assets/Cart_Icon.svg +3 -0
- package/dist/body/components/assets/Question_Icon.svg +4 -0
- package/dist/header/ActionHeaderCell.js +2 -1
- package/dist/header/CustomCell.js +11 -3
- package/dist/header/CustomTblHeader.js +4 -1
- package/dist/header/components/CheckBoxView.js +3 -2
- package/dist/index.js +6 -0
- package/dist/pagination/CustomPagination.js +11 -2
- package/dist/toolbar/DownloadButtonView.js +173 -7
- package/dist/toolbar/ManageColumnView.js +115 -25
- package/dist/toolbar/assets/Hidden_Column.svg +4 -0
- package/dist/toolbar/assets/View_Columns.svg +6 -0
- package/dist/util/Dataformat.js +41 -1
- package/dist/util/Types.js +22 -2
- package/dist/util/downloadTable.js +196 -0
- package/dist/wrapper/WrapperService.js +36 -0
- package/dist/wrapper/components/AddFiles.js +63 -0
- package/dist/wrapper/components/AddToCartDialog/AddToCartDialogAlertView.js +35 -0
- package/dist/wrapper/components/AddToCartDialog/AddToCartDialogController.js +36 -0
- package/dist/wrapper/components/AddToCartDialog/AddToCartDialogView.js +43 -0
- package/dist/wrapper/components/CPIFilesView/CPIFilesView.js +178 -0
- package/dist/wrapper/components/ReduxAddFile.js +27 -0
- package/dist/wrapper/components/Snackbar/Snackbar.js +40 -0
- package/dist/wrapper/components/Snackbar/SnackbarRedux.js +16 -0
- package/dist/wrapper/components/Snackbar/SuccessOutlined.js +17 -0
- package/dist/wrapper/components/TextFieldView.js +37 -0
- package/dist/wrapper/components/TooltipView.js +40 -0
- package/package.json +11 -1
- package/src/DefaultThemConfig.js +1 -1
- package/src/ExtendedView.js +36 -21
- package/src/TableView.js +124 -52
- package/src/body/CustomTblBody.js +3 -0
- package/src/body/DisplayBodyCell.js +16 -0
- package/src/body/components/CPIModal.js +414 -0
- package/src/body/components/CPIView.js +135 -0
- package/src/body/components/ModalStyle.js +115 -0
- package/src/body/components/assets/CPI_icon.svg +22 -0
- package/src/body/components/assets/Cart_Icon.svg +3 -0
- package/src/body/components/assets/Question_Icon.svg +4 -0
- package/src/header/ActionHeaderCell.js +1 -1
- package/src/header/CustomCell.js +13 -0
- package/src/header/CustomTblHeader.js +1 -0
- package/src/header/components/CheckBoxView.js +2 -1
- package/src/index.js +1 -0
- package/src/pagination/CustomPagination.js +4 -1
- package/src/toolbar/DownloadButtonView.js +181 -10
- package/src/toolbar/ManageColumnView.js +114 -27
- package/src/toolbar/assets/Hidden_Column.svg +4 -0
- package/src/toolbar/assets/View_Columns.svg +6 -0
- package/src/util/Dataformat.js +25 -0
- package/src/util/Types.js +15 -0
- package/src/util/downloadTable.js +138 -0
- package/src/wrapper/WrapperService.js +25 -0
- package/src/wrapper/components/AddFiles.js +62 -0
- package/src/wrapper/components/AddToCartDialog/AddToCartDialogAlertView.js +37 -0
- package/src/wrapper/components/AddToCartDialog/AddToCartDialogController.js +32 -0
- package/src/wrapper/components/AddToCartDialog/AddToCartDialogView.js +57 -0
- package/src/wrapper/components/CPIFilesView/CPIFilesView.js +190 -0
- package/src/wrapper/components/ReduxAddFile.js +20 -0
- package/src/wrapper/components/Snackbar/Snackbar.js +43 -0
- package/src/wrapper/components/Snackbar/SnackbarRedux.js +11 -0
- package/src/wrapper/components/Snackbar/SuccessOutlined.js +10 -0
- package/src/wrapper/components/TextFieldView.js +32 -0
- package/src/wrapper/components/TooltipView.js +35 -0
package/src/TableView.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Paper,
|
|
4
4
|
Table,
|
|
@@ -12,19 +12,46 @@ import CustomTableBody from './body/CustomTblBody';
|
|
|
12
12
|
import CustomToolbar from './toolbar/CustomToolbar';
|
|
13
13
|
import DisplayErrMsg from './errMsg/DisplayErrMsg';
|
|
14
14
|
import ExtendedView from './ExtendedView';
|
|
15
|
+
import DownloadButton from './toolbar/DownloadButtonView';
|
|
16
|
+
import ManageColumnView from './toolbar/ManageColumnView';
|
|
15
17
|
|
|
16
18
|
const CustomTableContainer = (props) => {
|
|
17
19
|
const { children, customTheme } = props;
|
|
18
20
|
const themeConfig = createTheme({ overrides: { ...customTheme } });
|
|
19
21
|
return (
|
|
20
22
|
<ThemeProvider theme={themeConfig}>
|
|
21
|
-
<TableContainer component={Paper}>
|
|
23
|
+
<TableContainer id="tableContainer" component={Paper}>
|
|
22
24
|
{children}
|
|
23
25
|
</TableContainer>
|
|
24
26
|
</ThemeProvider>
|
|
25
27
|
);
|
|
26
28
|
};
|
|
27
29
|
|
|
30
|
+
const downloadAreaStyle = {
|
|
31
|
+
display: 'flex',
|
|
32
|
+
borderTop: '1px solid #8A7F7C',
|
|
33
|
+
borderBottom: '1px solid #8A7F7C',
|
|
34
|
+
paddingRight: '41px',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const cartDownloadAreaStyle = {
|
|
38
|
+
display: 'flex',
|
|
39
|
+
borderTop: '5px solid #e7e5e5',
|
|
40
|
+
borderBottom: '3px solid #e7e5e5',
|
|
41
|
+
paddingRight: '40px',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const addScrollContainerStyle = {
|
|
45
|
+
overflowX: 'auto',
|
|
46
|
+
overflowY: 'hidden',
|
|
47
|
+
width: '100%',
|
|
48
|
+
height: '14px',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const addScrollStyle = {
|
|
52
|
+
height: '14px',
|
|
53
|
+
};
|
|
54
|
+
|
|
28
55
|
const TableView = ({
|
|
29
56
|
tableRows = [],
|
|
30
57
|
table,
|
|
@@ -35,60 +62,105 @@ const TableView = ({
|
|
|
35
62
|
totalRowCount,
|
|
36
63
|
onSortByColumn,
|
|
37
64
|
onColumnViewChange,
|
|
65
|
+
onAllColumnViewChange,
|
|
38
66
|
themeConfig = {},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
queryVariables,
|
|
68
|
+
navigation,
|
|
69
|
+
}) => {
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const tableContainer = document.getElementById('tableContainer');
|
|
72
|
+
const addScrollContainer = document.getElementById('addScrollContainer');
|
|
73
|
+
const targetTable = tableContainer.firstChild;
|
|
74
|
+
const addScroll = addScrollContainer.firstChild;
|
|
75
|
+
const tableWidth = targetTable.clientWidth;
|
|
76
|
+
addScroll.style.width = `${tableWidth}px`;
|
|
77
|
+
tableContainer.onscroll = () => {
|
|
78
|
+
addScrollContainer.scrollLeft = tableContainer.scrollLeft;
|
|
79
|
+
};
|
|
80
|
+
addScrollContainer.onscroll = () => {
|
|
81
|
+
tableContainer.scrollLeft = addScrollContainer.scrollLeft;
|
|
82
|
+
};
|
|
83
|
+
if (!(tableWidth > tableContainer.clientWidth)) {
|
|
84
|
+
addScrollContainer.style.height = '0px';
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const { extendedViewConfig } = table;
|
|
88
|
+
const {
|
|
89
|
+
manageViewColumns = false,
|
|
90
|
+
} = extendedViewConfig;
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<ExtendedView
|
|
94
|
+
table={table}
|
|
95
|
+
onColumnViewChange={onColumnViewChange}
|
|
96
|
+
onAllColumnViewChange={onAllColumnViewChange}
|
|
97
|
+
onRowsPerPageChange={onRowsPerPageChange}
|
|
98
|
+
onPageChange={onPageChange}
|
|
99
|
+
numSelected={table?.selectedRows?.length || 0}
|
|
100
|
+
customTheme={themeConfig.extendedView}
|
|
101
|
+
queryVariables={queryVariables}
|
|
102
|
+
/>
|
|
103
|
+
<CustomToolbar
|
|
104
|
+
numSelected={table?.selectedRows?.length || 0}
|
|
105
|
+
table={table}
|
|
106
|
+
onColumnViewChange={onColumnViewChange}
|
|
107
|
+
customTheme={themeConfig.toolbar}
|
|
108
|
+
/>
|
|
109
|
+
<CustomTableContainer
|
|
110
|
+
customTheme={themeConfig.tblContainer || {}}
|
|
111
|
+
>
|
|
112
|
+
<Table>
|
|
113
|
+
<TableHeader
|
|
114
|
+
customTheme={themeConfig.tblHeader}
|
|
115
|
+
table={table}
|
|
116
|
+
rows={tableRows}
|
|
117
|
+
count={totalRowCount}
|
|
118
|
+
toggleSelectAll={onToggleSelectAll}
|
|
119
|
+
sortByColumn={onSortByColumn}
|
|
120
|
+
/>
|
|
121
|
+
<CustomTableBody
|
|
122
|
+
customTheme={themeConfig.tblBody}
|
|
123
|
+
rows={tableRows}
|
|
124
|
+
table={table}
|
|
125
|
+
onRowSelectChange={onRowSelectChange}
|
|
126
|
+
navigation={navigation}
|
|
127
|
+
/>
|
|
128
|
+
</Table>
|
|
129
|
+
</CustomTableContainer>
|
|
130
|
+
<div id="addScrollContainer" style={addScrollContainerStyle}>
|
|
131
|
+
<div style={addScrollStyle} />
|
|
132
|
+
</div>
|
|
133
|
+
{tableRows.length === 0 && (
|
|
134
|
+
<DisplayErrMsg
|
|
135
|
+
customTheme={themeConfig.displayErr}
|
|
61
136
|
table={table}
|
|
62
|
-
rows={tableRows}
|
|
63
|
-
count={totalRowCount}
|
|
64
|
-
toggleSelectAll={onToggleSelectAll}
|
|
65
|
-
sortByColumn={onSortByColumn}
|
|
66
137
|
/>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
138
|
+
)}
|
|
139
|
+
<div className="downloadArea" style={table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : downloadAreaStyle}>
|
|
140
|
+
<CustomPagination
|
|
141
|
+
customTheme={themeConfig.tblPgn}
|
|
142
|
+
rowsPerPageOptions={[10, 25, 50, 100]}
|
|
143
|
+
component="div"
|
|
144
|
+
count={table.totalRowCount || 0}
|
|
145
|
+
rowsPerPage={table.rowsPerPage || 10}
|
|
146
|
+
page={table.page || 0}
|
|
147
|
+
onPageChange={onPageChange}
|
|
148
|
+
onRowsPerPageChange={onRowsPerPageChange}
|
|
149
|
+
/>
|
|
150
|
+
<ManageColumnView
|
|
70
151
|
table={table}
|
|
71
|
-
|
|
152
|
+
manageViewColumns={manageViewColumns}
|
|
153
|
+
onColumnViewChange={onColumnViewChange}
|
|
154
|
+
onAllColumnViewChange={onAllColumnViewChange}
|
|
72
155
|
/>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
customTheme={themeConfig.tblPgn}
|
|
83
|
-
rowsPerPageOptions={[10, 25, 50, 100]}
|
|
84
|
-
component="div"
|
|
85
|
-
count={table.totalRowCount || 0}
|
|
86
|
-
rowsPerPage={table.rowsPerPage || 10}
|
|
87
|
-
page={table.page || 0}
|
|
88
|
-
onPageChange={onPageChange}
|
|
89
|
-
onRowsPerPageChange={onRowsPerPageChange}
|
|
90
|
-
/>
|
|
91
|
-
</>
|
|
92
|
-
);
|
|
156
|
+
<DownloadButton
|
|
157
|
+
count={table.totalRowCount || 0}
|
|
158
|
+
queryVariables={queryVariables}
|
|
159
|
+
table={table}
|
|
160
|
+
/>
|
|
161
|
+
</div>
|
|
162
|
+
</>
|
|
163
|
+
);
|
|
164
|
+
};
|
|
93
165
|
|
|
94
166
|
export default TableView;
|
|
@@ -22,6 +22,7 @@ const CustomTableBody = ({
|
|
|
22
22
|
table,
|
|
23
23
|
onRowSelectChange,
|
|
24
24
|
customTheme = {},
|
|
25
|
+
navigation,
|
|
25
26
|
}) => {
|
|
26
27
|
const { columns } = table;
|
|
27
28
|
const displayColunms = columns.filter((col) => col.display);
|
|
@@ -50,6 +51,8 @@ const CustomTableBody = ({
|
|
|
50
51
|
<DisplayCell
|
|
51
52
|
column={column}
|
|
52
53
|
row={row}
|
|
54
|
+
themeConfig={themeConfig}
|
|
55
|
+
navigation={navigation}
|
|
53
56
|
/>
|
|
54
57
|
);
|
|
55
58
|
})
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
import { cellTypes } from '../util/Types';
|
|
7
7
|
import CustomLinkView from './components/CustomLinkView';
|
|
8
8
|
import DataFormatView from './components/DataFormatView';
|
|
9
|
+
import CPIView from './components/CPIView';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Custom Column reneder
|
|
@@ -29,6 +30,8 @@ const CustomComponent = ({
|
|
|
29
30
|
const ViewCell = ({
|
|
30
31
|
column,
|
|
31
32
|
row,
|
|
33
|
+
themeConfig,
|
|
34
|
+
navigation,
|
|
32
35
|
}) => {
|
|
33
36
|
const { cellType } = column;
|
|
34
37
|
switch (cellType) {
|
|
@@ -53,6 +56,15 @@ const ViewCell = ({
|
|
|
53
56
|
column={column}
|
|
54
57
|
/>
|
|
55
58
|
);
|
|
59
|
+
case cellTypes.CPI:
|
|
60
|
+
return (
|
|
61
|
+
<CPIView
|
|
62
|
+
row={row}
|
|
63
|
+
column={column}
|
|
64
|
+
themeConfig={themeConfig}
|
|
65
|
+
navigation={navigation}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
56
68
|
default:
|
|
57
69
|
return (
|
|
58
70
|
<Typography>
|
|
@@ -65,11 +77,15 @@ const ViewCell = ({
|
|
|
65
77
|
const DisplayCell = ({
|
|
66
78
|
row,
|
|
67
79
|
column,
|
|
80
|
+
themeConfig,
|
|
81
|
+
navigation,
|
|
68
82
|
}) => (
|
|
69
83
|
<TableCell className={column.dataField}>
|
|
70
84
|
<ViewCell
|
|
71
85
|
row={row}
|
|
72
86
|
column={column}
|
|
87
|
+
themeConfig={themeConfig}
|
|
88
|
+
navigation={navigation}
|
|
73
89
|
/>
|
|
74
90
|
</TableCell>
|
|
75
91
|
);
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { NavLink } from 'react-router-dom';
|
|
3
|
+
import {
|
|
4
|
+
Box,
|
|
5
|
+
Checkbox,
|
|
6
|
+
Modal,
|
|
7
|
+
Typography,
|
|
8
|
+
IconButton,
|
|
9
|
+
Paper,
|
|
10
|
+
Table,
|
|
11
|
+
TableContainer,
|
|
12
|
+
ThemeProvider,
|
|
13
|
+
TableHead,
|
|
14
|
+
TableRow,
|
|
15
|
+
TableCell,
|
|
16
|
+
TableBody,
|
|
17
|
+
Button,
|
|
18
|
+
} from '@material-ui/core';
|
|
19
|
+
// import CustomTableBody from '../../body/CustomTblBody';
|
|
20
|
+
import CloseIcon from '@material-ui/icons/Close';
|
|
21
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
22
|
+
import styles from './ModalStyle';
|
|
23
|
+
// import TableHeader from '../../header/CustomTblHeader';
|
|
24
|
+
import HeaderCell from '../../header/CustomCell';
|
|
25
|
+
import AddFileButtonView from '../../wrapper/components/ReduxAddFile';
|
|
26
|
+
import questionIcon from './assets/Question_Icon.svg';
|
|
27
|
+
import cartIcon from './assets/Cart_Icon.svg';
|
|
28
|
+
|
|
29
|
+
const tooltipContentAddAll = {
|
|
30
|
+
tooltipText: 'Click button to add all Hub files associated with this participant to the cart.',
|
|
31
|
+
icon: questionIcon,
|
|
32
|
+
alt: 'tooltipIcon',
|
|
33
|
+
Participants: 'Click button to add all files associated with the filtered row(s).',
|
|
34
|
+
arrow: true,
|
|
35
|
+
styles: {
|
|
36
|
+
border: '#03A383 1px solid',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const tooltipContent = {
|
|
41
|
+
tooltipText: 'Click button to add all selected files associated with this participant to the cart.',
|
|
42
|
+
icon: questionIcon,
|
|
43
|
+
alt: 'tooltipIcon',
|
|
44
|
+
Participants: 'Click button to add files associated with the selected row(s).',
|
|
45
|
+
arrow: true,
|
|
46
|
+
styles: {
|
|
47
|
+
border: '#03A383 1px solid',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const CustomTableContainer = (props) => {
|
|
52
|
+
const { children, themeConfig, className } = props;
|
|
53
|
+
const tableStyle = {
|
|
54
|
+
height: '470px',
|
|
55
|
+
overflowX: 'hidden',
|
|
56
|
+
};
|
|
57
|
+
return (
|
|
58
|
+
<ThemeProvider theme={themeConfig}>
|
|
59
|
+
<TableContainer className={className} id="tableContainer" component={Paper} style={tableStyle}>
|
|
60
|
+
{children}
|
|
61
|
+
</TableContainer>
|
|
62
|
+
</ThemeProvider>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const CPIModal = ({
|
|
67
|
+
classes,
|
|
68
|
+
open,
|
|
69
|
+
onClose,
|
|
70
|
+
row,
|
|
71
|
+
themeConfig = {},
|
|
72
|
+
}) => {
|
|
73
|
+
const [sortBy, setSortBy] = useState('associated_id');
|
|
74
|
+
const [sortOrder, setSortOrder] = useState('asc');
|
|
75
|
+
const [data, setData] = useState(() => {
|
|
76
|
+
const result = row.cpi_data;
|
|
77
|
+
return result;
|
|
78
|
+
});
|
|
79
|
+
const [selectedIds, setIds] = useState([]);
|
|
80
|
+
const [selectAll, setSelectAll] = useState(false);
|
|
81
|
+
|
|
82
|
+
const wrapperConfig = {
|
|
83
|
+
container: 'buttons',
|
|
84
|
+
size: 'xl',
|
|
85
|
+
clsName: 'container_header',
|
|
86
|
+
items: [
|
|
87
|
+
{
|
|
88
|
+
participantIds: data,
|
|
89
|
+
title: 'ADD ALL FILES FOR PARTICIPANT',
|
|
90
|
+
clsName: 'add_all_button',
|
|
91
|
+
role: 'ADD_ALL_FILES',
|
|
92
|
+
btnType: 'ADD_ALL_FILES',
|
|
93
|
+
tooltipCofig: tooltipContentAddAll,
|
|
94
|
+
conditional: false,
|
|
95
|
+
alertMessage: 'The cart is limited to 200,000 files. Please narrow the search criteria or remove some files from the cart to add more.',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
participantIds: selectedIds,
|
|
99
|
+
title: 'ADD SELECTED FILES FOR PARTICIPANT',
|
|
100
|
+
clsName: 'add_selected_button',
|
|
101
|
+
role: 'ADD_SELECTED_FILES',
|
|
102
|
+
btnType: 'ADD_SELECTED_FILES',
|
|
103
|
+
tooltipCofig: tooltipContent,
|
|
104
|
+
conditional: true,
|
|
105
|
+
alertMessage: 'The cart is limited to 200,000 files. Please narrow the search criteria or remove some files from the cart to add more.',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const sortingData = (column, newOrder) => {
|
|
111
|
+
const sortedData = data.sort((a, b) => a[column].localeCompare(b[column]));
|
|
112
|
+
|
|
113
|
+
if (newOrder === 'desc') {
|
|
114
|
+
return sortedData.reverse();
|
|
115
|
+
}
|
|
116
|
+
return sortedData;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const handleSelectAll = () => {
|
|
120
|
+
if (selectAll) {
|
|
121
|
+
setSelectAll(false);
|
|
122
|
+
setIds([]);
|
|
123
|
+
} else {
|
|
124
|
+
setSelectAll(true);
|
|
125
|
+
let toAdd = [];
|
|
126
|
+
|
|
127
|
+
data.forEach((e) => {
|
|
128
|
+
if (e.data_type === 'internal' && e.p_id) {
|
|
129
|
+
toAdd = toAdd.concat(e.p_id);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
setIds(toAdd);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const handleSelect = (id) => {
|
|
137
|
+
if (selectedIds.indexOf(id) !== -1) {
|
|
138
|
+
setIds(selectedIds.filter((e) => e !== id));
|
|
139
|
+
} else {
|
|
140
|
+
const toAdd = selectedIds.concat(id);
|
|
141
|
+
setIds(toAdd);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const handleSortByColumn = (column, order) => {
|
|
146
|
+
const newOrder = (order === 'asc' && sortBy === column) ? 'desc' : 'asc';
|
|
147
|
+
const newData = sortingData(column, newOrder);
|
|
148
|
+
setData(newData);
|
|
149
|
+
setSortBy(column);
|
|
150
|
+
setSortOrder(newOrder);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const buttonContainer = {
|
|
154
|
+
display: 'flex',
|
|
155
|
+
justifyContent: 'center',
|
|
156
|
+
padding: '10px',
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const addAllFilesButton = {
|
|
160
|
+
width: '174px',
|
|
161
|
+
height: '41px',
|
|
162
|
+
borderRadius: '5px',
|
|
163
|
+
backgroundColor: '#536D70',
|
|
164
|
+
fontFamily: 'Poppins',
|
|
165
|
+
fontWeight: '600',
|
|
166
|
+
fontSize: '12px',
|
|
167
|
+
color: 'white',
|
|
168
|
+
lineHeight: '14px',
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const addSelectedFilesButton = {
|
|
172
|
+
width: '174px',
|
|
173
|
+
height: '41px',
|
|
174
|
+
borderRadius: '5px',
|
|
175
|
+
backgroundColor: selectedIds.length ? '#2A6E93' : '#B3D6EA',
|
|
176
|
+
fontFamily: 'Poppins',
|
|
177
|
+
fontWeight: '600',
|
|
178
|
+
fontSize: '12px',
|
|
179
|
+
color: 'white',
|
|
180
|
+
lineHeight: '14px',
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const goToCartButton = {
|
|
184
|
+
width: '174px',
|
|
185
|
+
height: '41px',
|
|
186
|
+
borderRadius: '5px',
|
|
187
|
+
backgroundColor: '#5666BD',
|
|
188
|
+
fontFamily: 'Poppins',
|
|
189
|
+
fontWeight: '600',
|
|
190
|
+
fontSize: '12px',
|
|
191
|
+
color: 'white',
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const modalBody = {
|
|
195
|
+
position: 'absolute',
|
|
196
|
+
top: '5%',
|
|
197
|
+
left: '25%',
|
|
198
|
+
width: '840px',
|
|
199
|
+
height: '671px',
|
|
200
|
+
background: '#FFFFFF',
|
|
201
|
+
border: '1px solid #505050',
|
|
202
|
+
borderRadius: '40px',
|
|
203
|
+
overflow: 'hidden',
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const header = {
|
|
207
|
+
display: 'flex',
|
|
208
|
+
justifyContent: 'center',
|
|
209
|
+
alignItems: 'center',
|
|
210
|
+
height: '55px',
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const cell = {
|
|
214
|
+
paddingLeft: '3px',
|
|
215
|
+
paddingRight: '5px',
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const cellLast = {
|
|
219
|
+
paddingLeft: '3px',
|
|
220
|
+
paddingRight: '10px',
|
|
221
|
+
wordBreak: 'break-word',
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const footer = {
|
|
225
|
+
display: 'flex',
|
|
226
|
+
justifyContent: 'center',
|
|
227
|
+
alignItems: 'center',
|
|
228
|
+
height: '55px',
|
|
229
|
+
color: '#7D267E',
|
|
230
|
+
fontFamily: 'Nunito',
|
|
231
|
+
fontSize: '16px',
|
|
232
|
+
fontWeight: '400',
|
|
233
|
+
padding: '45px',
|
|
234
|
+
paddingLeft: '35px',
|
|
235
|
+
paddingRight: '20px',
|
|
236
|
+
borderTop: '1px solid #505050',
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const link = {
|
|
240
|
+
color: '#7D267E',
|
|
241
|
+
fontFamily: 'Nunito',
|
|
242
|
+
fontSize: '16px',
|
|
243
|
+
fontWeight: '700',
|
|
244
|
+
position: 'relative',
|
|
245
|
+
top: '11.5px',
|
|
246
|
+
right: '39px',
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
const modalTitle = {
|
|
250
|
+
fontFamily: 'Poppins',
|
|
251
|
+
fontSize: '19px',
|
|
252
|
+
fontWeight: '400',
|
|
253
|
+
lineHeight: '21px',
|
|
254
|
+
letterSpacing: '0.02em',
|
|
255
|
+
textAlign: 'center',
|
|
256
|
+
color: '#000000',
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
const closeButton = {
|
|
260
|
+
marginLeft: '769px',
|
|
261
|
+
position: 'absolute',
|
|
262
|
+
backgroundColor: 'transparent',
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const countContainer = {
|
|
266
|
+
display: 'flex',
|
|
267
|
+
justifyContent: 'left',
|
|
268
|
+
alignItems: 'center',
|
|
269
|
+
borderTop: '3px solid #939393',
|
|
270
|
+
borderBottom: '3px solid #939393',
|
|
271
|
+
height: '51px',
|
|
272
|
+
paddingLeft: '16px',
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
const participantId = row.participant_id;
|
|
276
|
+
const displayColumns = [
|
|
277
|
+
{
|
|
278
|
+
dataField: 'associated_id',
|
|
279
|
+
header: 'Participant ID',
|
|
280
|
+
tooltipText: 'sort',
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
dataField: 'repository_of_synonym_id',
|
|
284
|
+
header: 'Name',
|
|
285
|
+
tooltipText: 'sort',
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
dataField: 'domain_description',
|
|
289
|
+
header: 'Description',
|
|
290
|
+
tooltipText: 'sort',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
dataField: 'domain_category',
|
|
294
|
+
header: 'Category',
|
|
295
|
+
tooltipText: 'sort',
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
dataField: 'data_location',
|
|
299
|
+
header: 'Location',
|
|
300
|
+
tooltipText: 'sort',
|
|
301
|
+
},
|
|
302
|
+
];
|
|
303
|
+
|
|
304
|
+
return (
|
|
305
|
+
<Modal
|
|
306
|
+
open={open}
|
|
307
|
+
onClose={onClose}
|
|
308
|
+
aria-labelledby={`${row.id}-modal`}
|
|
309
|
+
>
|
|
310
|
+
<Box className={classes.modalBody} style={modalBody}>
|
|
311
|
+
<div className="header" style={header}>
|
|
312
|
+
<Typography id="modal-modal-title" className="modalTitle" style={modalTitle}>
|
|
313
|
+
{`Participant ID ${participantId} : CPI Mappings`}
|
|
314
|
+
</Typography>
|
|
315
|
+
<IconButton
|
|
316
|
+
aria-label="close"
|
|
317
|
+
onClick={onClose}
|
|
318
|
+
className="closeButton"
|
|
319
|
+
style={closeButton}
|
|
320
|
+
>
|
|
321
|
+
<CloseIcon fontSize="small" />
|
|
322
|
+
</IconButton>
|
|
323
|
+
</div>
|
|
324
|
+
<div className="container" style={countContainer}>
|
|
325
|
+
{`${data.length} mapped identifiers`}
|
|
326
|
+
</div>
|
|
327
|
+
<CustomTableContainer
|
|
328
|
+
className={classes.tableContainer}
|
|
329
|
+
themeConfig={themeConfig}
|
|
330
|
+
>
|
|
331
|
+
<Table>
|
|
332
|
+
<TableHead>
|
|
333
|
+
<TableRow>
|
|
334
|
+
<TableCell padding="checkbox">
|
|
335
|
+
<span style={{ display: 'none' }}>Select all</span>
|
|
336
|
+
<Checkbox
|
|
337
|
+
color="primary"
|
|
338
|
+
checked={selectAll}
|
|
339
|
+
onChange={() => handleSelectAll()}
|
|
340
|
+
/>
|
|
341
|
+
</TableCell>
|
|
342
|
+
{
|
|
343
|
+
displayColumns.map((column) => (
|
|
344
|
+
<HeaderCell
|
|
345
|
+
column={column}
|
|
346
|
+
sortBy={sortBy}
|
|
347
|
+
sortOrder={sortOrder}
|
|
348
|
+
toggleSort={() => handleSortByColumn(column.dataField, sortOrder)}
|
|
349
|
+
style={{ paddingLeft: '3px', paddingRight: '3px', fontWeight: '700' }}
|
|
350
|
+
/>
|
|
351
|
+
))
|
|
352
|
+
}
|
|
353
|
+
</TableRow>
|
|
354
|
+
</TableHead>
|
|
355
|
+
<TableBody style={{ borderBottom: '3px solid rgb(147, 147, 147)' }}>
|
|
356
|
+
{
|
|
357
|
+
data.map((currRow) => (
|
|
358
|
+
<TableRow>
|
|
359
|
+
<TableCell padding="checkbox">
|
|
360
|
+
<Checkbox
|
|
361
|
+
color="#2A6E93"
|
|
362
|
+
checked={selectedIds.includes(currRow.p_id)}
|
|
363
|
+
disabled={currRow.data_type === 'external'}
|
|
364
|
+
onChange={() => handleSelect(currRow.p_id)}
|
|
365
|
+
/>
|
|
366
|
+
</TableCell>
|
|
367
|
+
{
|
|
368
|
+
displayColumns.map((column) => (
|
|
369
|
+
(
|
|
370
|
+
column.dataField !== 'data_location'
|
|
371
|
+
? <TableCell style={cell}>{currRow[column.dataField]}</TableCell>
|
|
372
|
+
: <TableCell style={cellLast}><a href={currRow[column.dataField]} target="_blank" rel="noopener noreferrer">{currRow[column.dataField]}</a></TableCell>
|
|
373
|
+
)
|
|
374
|
+
))
|
|
375
|
+
}
|
|
376
|
+
</TableRow>
|
|
377
|
+
))
|
|
378
|
+
}
|
|
379
|
+
</TableBody>
|
|
380
|
+
</Table>
|
|
381
|
+
</CustomTableContainer>
|
|
382
|
+
<div style={buttonContainer}>
|
|
383
|
+
<AddFileButtonView
|
|
384
|
+
{...wrapperConfig.items[0]}
|
|
385
|
+
buttonStyle={addAllFilesButton}
|
|
386
|
+
rowID={row.id}
|
|
387
|
+
/>
|
|
388
|
+
<AddFileButtonView
|
|
389
|
+
{...wrapperConfig.items[1]}
|
|
390
|
+
buttonStyle={addSelectedFilesButton}
|
|
391
|
+
rowID={row.id}
|
|
392
|
+
/>
|
|
393
|
+
<NavLink to="/fileCentricCart">
|
|
394
|
+
<Button
|
|
395
|
+
style={goToCartButton}
|
|
396
|
+
>
|
|
397
|
+
GO TO CART
|
|
398
|
+
<img src={cartIcon} alt="cart" style={{ paddingLeft: '30px' }} />
|
|
399
|
+
</Button>
|
|
400
|
+
</NavLink>
|
|
401
|
+
</div>
|
|
402
|
+
<div className="footer" style={footer}>
|
|
403
|
+
All CPI mappings for a given study can be found in the "synonyms"
|
|
404
|
+
tab of the downloadable manifest,
|
|
405
|
+
available under the "Studies" tab in the Explore Dashboard.
|
|
406
|
+
For more information about CPI, click
|
|
407
|
+
<a style={link} href="https://participantindex-docs.ccdi.cancer.gov/" target="_blank" rel="noopener noreferrer">here</a>
|
|
408
|
+
</div>
|
|
409
|
+
</Box>
|
|
410
|
+
</Modal>
|
|
411
|
+
);
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
export default withStyles(styles)(CPIModal);
|