@bento-core/table 1.0.0-c3dc.3 → 1.0.0-c3dc.30

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 (41) hide show
  1. package/dist/ExtendedView.js +9 -11
  2. package/dist/TableView.js +7 -4
  3. package/dist/assets/cpi_icon.svg +22 -0
  4. package/dist/assets/downArrow.svg +3 -0
  5. package/dist/assets/leftArrow.svg +3 -0
  6. package/dist/assets/rightArrow.svg +3 -0
  7. package/dist/body/CustomTblBody.js +9 -4
  8. package/dist/body/DisplayBodyCell.js +18 -3
  9. package/dist/body/components/CPIModal.js +210 -0
  10. package/dist/body/components/CPIView.js +115 -0
  11. package/dist/body/components/CustomLinkView.js +1 -1
  12. package/dist/body/components/ModalStyle.js +121 -0
  13. package/dist/header/ActionHeaderCell.js +2 -1
  14. package/dist/header/CustomCell.js +8 -5
  15. package/dist/header/CustomTblHeader.js +3 -1
  16. package/dist/header/components/CheckBoxView.js +3 -2
  17. package/dist/pagination/CustomPagination.js +84 -28
  18. package/dist/toolbar/DownloadButtonView.js +152 -45
  19. package/dist/util/Types.js +8 -2
  20. package/dist/util/downloadTable.js +72 -37
  21. package/package.json +2 -2
  22. package/src/ExtendedView.js +34 -33
  23. package/src/TableView.js +11 -8
  24. package/src/assets/cpi_icon.svg +22 -0
  25. package/src/assets/downArrow.svg +3 -0
  26. package/src/assets/leftArrow.svg +3 -0
  27. package/src/assets/rightArrow.svg +3 -0
  28. package/src/body/CustomTblBody.js +6 -1
  29. package/src/body/DisplayBodyCell.js +23 -0
  30. package/src/body/components/CPIModal.js +245 -0
  31. package/src/body/components/CPIView.js +133 -0
  32. package/src/body/components/CustomLinkView.js +1 -1
  33. package/src/body/components/ModalStyle.js +115 -0
  34. package/src/header/ActionHeaderCell.js +1 -0
  35. package/src/header/CustomCell.js +6 -3
  36. package/src/header/CustomTblHeader.js +3 -1
  37. package/src/header/components/CheckBoxView.js +2 -1
  38. package/src/pagination/CustomPagination.js +97 -40
  39. package/src/toolbar/DownloadButtonView.js +168 -55
  40. package/src/util/Types.js +4 -0
  41. package/src/util/downloadTable.js +51 -17
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import {
3
3
  ThemeProvider,
4
- Toolbar,
5
4
  createTheme,
6
5
  } from '@material-ui/core';
7
6
  import CustomPagination from './pagination/CustomPagination';
@@ -39,45 +38,47 @@ const ExtendedView = ({
39
38
  return (
40
39
  <ThemeProvider theme={themeConfig}>
41
40
  {(numSelected === 0 && (download || manageViewColumns)) && (
42
- <Toolbar className="downloadColumnView">
43
- <DownloadButton
44
- count={table.totalRowCount || 0}
45
- queryVariables={queryVariables}
46
- table={table}
47
- buttonConfig={downloadButtonConfig}
48
- />
41
+
49
42
  <ManageColumnView
50
43
  table={table}
51
44
  manageViewColumns={manageViewColumns}
52
45
  onColumnViewChange={onColumnViewChange}
53
46
  />
54
- </Toolbar>
47
+
55
48
  )}
56
49
  {
57
- (pagination) && (
58
- <div className="downloadArea" style={downloadAreaStyle}>
59
- <CustomPagination
60
- customTheme={customTheme.tblTopPgn}
61
- rowsPerPageOptions={[10, 25, 50, 100]}
62
- component="div"
63
- count={table.totalRowCount || 0}
64
- rowsPerPage={table.rowsPerPage || 10}
65
- page={table.page || 0}
66
- onPageChange={onPageChange}
67
- onRowsPerPageChange={onRowsPerPageChange}
68
- queryVariables={queryVariables}
69
- table={table}
70
- />
71
- {/* TODO: Commented out this section, Make this options configrable on Bento. */}
72
- {/* <DownloadButton
73
- count={table.totalRowCount || 0}
74
- queryVariables={queryVariables}
75
- table={table}
76
- isIcon={false}
77
- /> */}
78
- </div>
79
- )
80
- }
50
+ (pagination) && (
51
+ <div className="downloadArea" style={(table.paginationCustomStyle && table.paginationCustomStyle.topPagination) ? table.paginationCustomStyle.topPagination : downloadAreaStyle}>
52
+ {
53
+ (table.showSearchBox) && (
54
+ <table.SearchBox />
55
+ )
56
+ }
57
+ <CustomPagination
58
+ customTheme={customTheme.tblTopPgn}
59
+ rowsPerPageOptions={[10, 25, 50, 100]}
60
+ component="div"
61
+ count={table.totalRowCount || 0}
62
+ rowsPerPage={table.rowsPerPage || 10}
63
+ page={table.page || 0}
64
+ onPageChange={onPageChange}
65
+ onRowsPerPageChange={onRowsPerPageChange}
66
+ queryVariables={queryVariables}
67
+ table={table}
68
+ />
69
+ {table.showDownloadIcon !== false
70
+ && (
71
+ <DownloadButton
72
+ count={table.totalRowCount || 0}
73
+ queryVariables={queryVariables}
74
+ table={table}
75
+ buttonConfig={downloadButtonConfig}
76
+ />
77
+ )}
78
+
79
+ </div>
80
+ )
81
+ }
81
82
  </ThemeProvider>
82
83
  );
83
84
  };
package/src/TableView.js CHANGED
@@ -10,9 +10,9 @@ import TableHeader from './header/CustomTblHeader';
10
10
  import CustomPagination from './pagination/CustomPagination';
11
11
  import CustomTableBody from './body/CustomTblBody';
12
12
  import CustomToolbar from './toolbar/CustomToolbar';
13
+ import DownloadButton from './toolbar/DownloadButtonView';
13
14
  import DisplayErrMsg from './errMsg/DisplayErrMsg';
14
15
  import ExtendedView from './ExtendedView';
15
- // import DownloadButton from './toolbar/DownloadButtonView';
16
16
 
17
17
  const CustomTableContainer = (props) => {
18
18
  const { children, customTheme } = props;
@@ -29,7 +29,6 @@ const CustomTableContainer = (props) => {
29
29
  const downloadAreaStyle = {
30
30
  display: 'flex',
31
31
  borderTop: '1px solid #8A7F7C',
32
- borderBottom: '1px solid #8A7F7C',
33
32
  paddingRight: '41px',
34
33
  };
35
34
 
@@ -95,7 +94,7 @@ const TableView = ({
95
94
  table={table}
96
95
  />
97
96
  )}
98
- <div className="downloadArea" style={table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : downloadAreaStyle}>
97
+ <div className="downloadArea" style={table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : (table.paginationCustomStyle && table.paginationCustomStyle.bottomPagination) ? table.paginationCustomStyle.bottomPagination : downloadAreaStyle}>
99
98
  <CustomPagination
100
99
  customTheme={themeConfig.tblPgn}
101
100
  rowsPerPageOptions={[10, 25, 50, 100]}
@@ -106,11 +105,15 @@ const TableView = ({
106
105
  onPageChange={onPageChange}
107
106
  onRowsPerPageChange={onRowsPerPageChange}
108
107
  />
109
- {/* <DownloadButton
110
- count={table.totalRowCount || 0}
111
- queryVariables={queryVariables}
112
- table={table}
113
- /> */}
108
+ {table.showDownloadIcon !== false
109
+ && (
110
+ <DownloadButton
111
+ count={table.totalRowCount || 0}
112
+ queryVariables={queryVariables}
113
+ table={table}
114
+ buttonConfig={table.extendedViewConfig.downloadButtonConfig}
115
+ />
116
+ )}
114
117
  </div>
115
118
  </>
116
119
  );
@@ -0,0 +1,22 @@
1
+ <svg width="23" height="21" viewBox="0 0 23 21" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_12066_12050)">
3
+ <path d="M19.0973 13.2173C16.943 13.2173 15.1948 14.9585 15.1948 17.1042C15.1948 19.2499 16.943 20.9912 19.0973 20.9912C21.2516 20.9912 22.9998 19.2499 22.9998 17.1042C22.9998 14.9585 21.2516 13.2173 19.0973 13.2173Z" fill="#006A8F"/>
4
+ <path d="M19.389 18.8806L21.5609 16.4447C21.7905 16.1897 21.6051 15.7939 21.2696 15.7939H16.9256C16.5813 15.7939 16.4047 16.1985 16.6343 16.4447L18.8062 18.8806C18.9652 19.0565 19.2389 19.0565 19.3978 18.8806H19.389Z" fill="white"/>
5
+ <g clip-path="url(#clip1_12066_12050)">
6
+ <path d="M5.995 10.579C6.49826 10.579 6.96621 10.4734 7.4165 10.3239C6.15393 9.06641 5.36813 7.31641 5.36813 5.39933C5.36813 4.19455 5.67715 3.06013 6.21573 2.07521C6.1451 2.07521 6.07446 2.05762 6.00383 2.05762C3.63761 2.05762 1.72168 3.96591 1.72168 6.32269C1.72168 8.67948 3.63761 10.5878 6.00383 10.5878L5.995 10.579Z" fill="#006A8F"/>
7
+ <path d="M16.1916 9.19803C18.3053 7.09283 18.3053 3.67963 16.1916 1.57443C14.078 -0.530773 10.6511 -0.530773 8.53751 1.57443C6.42388 3.67963 6.42388 7.09283 8.53751 9.19803C10.6511 11.3032 14.078 11.3032 16.1916 9.19803Z" fill="#006A8F"/>
8
+ <path d="M13.6409 17.1395C13.6409 14.6948 15.3272 12.6458 17.5963 12.0742C17.1637 11.7312 16.6869 11.4498 16.166 11.2388C15.0712 11.9511 13.7645 12.3732 12.3518 12.3732C10.9391 12.3732 9.64124 11.9511 8.5376 11.2388C6.3303 12.1445 4.77637 14.2991 4.77637 16.8229V17.6848C4.77637 18.3267 5.22666 18.8807 5.86236 19.0038C7.67234 19.3468 9.86197 19.6194 12.3518 19.6194C13.0052 19.6194 13.6232 19.593 14.2324 19.5579C13.8528 18.8368 13.6409 18.0189 13.6409 17.1483V17.1395Z" fill="#006A8F"/>
9
+ <path d="M2.63109 11.0981C1.07716 11.8896 0 13.4901 0 15.3544V16.0404C0 16.5504 0.361996 16.9901 0.85643 17.0868C1.56276 17.2187 2.34856 17.3419 3.19616 17.4298V16.823C3.19616 15.0378 3.83186 13.3758 4.90019 12.0567C4.07025 11.8984 3.29328 11.573 2.62227 11.1069L2.63109 11.0981Z" fill="#006A8F"/>
10
+ <path d="M15.1948 17.1043C15.1948 19.25 16.943 20.9912 19.0973 20.9912C21.2516 20.9912 22.9998 19.25 22.9998 17.1043C22.9998 14.9585 21.2516 13.2173 19.0973 13.2173C16.943 13.2173 15.1948 14.9585 15.1948 17.1043Z" fill="#006A8F"/>
11
+ <path d="M20.8808 16.8143L18.4351 14.651C18.1791 14.4224 17.7817 14.607 17.7817 14.9412L17.7817 19.2678C17.7817 19.6108 18.1879 19.7867 18.4351 19.558L20.8808 17.3947C21.0574 17.2364 21.0574 16.9638 20.8808 16.8055L20.8808 16.8143Z" fill="white"/>
12
+ </g>
13
+ </g>
14
+ <defs>
15
+ <clipPath id="clip0_12066_12050">
16
+ <rect width="23" height="21" fill="white"/>
17
+ </clipPath>
18
+ <clipPath id="clip1_12066_12050">
19
+ <rect width="23" height="21" fill="white"/>
20
+ </clipPath>
21
+ </defs>
22
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="13" height="6" viewBox="0 0 13 6" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0.404297 0.937988L6.45817 5.93799L12.5121 0.937988H0.404297Z" fill="#CFCFCF"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="30" height="25" viewBox="0 0 30 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M19.4141 17.278L13.8687 12.688L19.4141 8.09799L17.7069 6.68799L10.4422 12.688L17.7069 18.688L19.4141 17.278Z" fill="#000"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="30" height="25" viewBox="0 0 30 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M11.323 17.278L16.8683 12.688L11.323 8.09799L13.0302 6.68799L20.2948 12.688L13.0302 18.688L11.323 17.278Z" fill="#323232"/>
3
+ </svg>
@@ -25,7 +25,11 @@ const CustomTableBody = ({
25
25
  }) => {
26
26
  const { columns } = table;
27
27
  const displayColunms = columns.filter((col) => col.display);
28
- const themeConfig = createTheme({ overrides: { ...defaultTheme(), ...customTheme } });
28
+
29
+ const MuiTableRow = { ...defaultTheme().MuiTableRow, ...customTheme.MuiTableRow };
30
+ const updatedTheme = { overrides: { ...defaultTheme(), ...customTheme, MuiTableRow } };
31
+
32
+ const themeConfig = createTheme(updatedTheme);
29
33
 
30
34
  return (
31
35
  <ThemeProvider theme={themeConfig}>
@@ -50,6 +54,7 @@ const CustomTableBody = ({
50
54
  <DisplayCell
51
55
  column={column}
52
56
  row={row}
57
+ themeConfig={themeConfig}
53
58
  />
54
59
  );
55
60
  })
@@ -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,8 +30,12 @@ const CustomComponent = ({
29
30
  const ViewCell = ({
30
31
  column,
31
32
  row,
33
+ themeConfig,
32
34
  }) => {
33
35
  const { cellType } = column;
36
+ function isNumeric(value) {
37
+ return /^-?\d+\.?\d*$/.test(value);
38
+ }
34
39
  switch (cellType) {
35
40
  case cellTypes.FORMAT_DATA:
36
41
  return (
@@ -53,6 +58,22 @@ const ViewCell = ({
53
58
  column={column}
54
59
  />
55
60
  );
61
+ case cellTypes.COMMA:
62
+ return (
63
+ <Typography>
64
+ {isNumeric(row[column.dataField])
65
+ ? Number(row[column.dataField]).toLocaleString()
66
+ : row[column.dataField]}
67
+ </Typography>
68
+ );
69
+ case cellTypes.CPI:
70
+ return (
71
+ <CPIView
72
+ row={row}
73
+ column={column}
74
+ themeConfig={themeConfig}
75
+ />
76
+ );
56
77
  default:
57
78
  return (
58
79
  <Typography>
@@ -65,11 +86,13 @@ const ViewCell = ({
65
86
  const DisplayCell = ({
66
87
  row,
67
88
  column,
89
+ themeConfig,
68
90
  }) => (
69
91
  <TableCell className={column.dataField}>
70
92
  <ViewCell
71
93
  row={row}
72
94
  column={column}
95
+ themeConfig={themeConfig}
73
96
  />
74
97
  </TableCell>
75
98
  );
@@ -0,0 +1,245 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import {
3
+ Box,
4
+ Modal,
5
+ Typography,
6
+ IconButton,
7
+ Paper,
8
+ Table,
9
+ TableContainer,
10
+ ThemeProvider,
11
+ TableHead,
12
+ TableRow,
13
+ TableCell,
14
+ TableBody,
15
+ } from '@material-ui/core';
16
+ // import CustomTableBody from '../../body/CustomTblBody';
17
+ import CloseIcon from '@material-ui/icons/Close';
18
+ import { withStyles } from '@material-ui/core/styles';
19
+ import styles from './ModalStyle';
20
+ // import TableHeader from '../../header/CustomTblHeader';
21
+ import HeaderCell from '../../header/CustomCell';
22
+
23
+ const CustomTableContainer = (props) => {
24
+ const { children, themeConfig, className } = props;
25
+ const tableStyle = {
26
+ height: '510px',
27
+ overflowX: 'hidden',
28
+ };
29
+ return (
30
+ <ThemeProvider theme={themeConfig}>
31
+ <TableContainer className={className} id="tableContainer" component={Paper} style={tableStyle}>
32
+ {children}
33
+ </TableContainer>
34
+ </ThemeProvider>
35
+ );
36
+ };
37
+
38
+ const CPIModal = ({
39
+ classes,
40
+ open,
41
+ onClose,
42
+ row,
43
+ themeConfig,
44
+ }) => {
45
+ const [sortBy, setSortBy] = useState('associated_id');
46
+ const [sortOrder, setSortOrder] = useState('asc');
47
+ const [data, setData] = useState(row.cpi_data);
48
+
49
+ useEffect(() => {
50
+ setData(row.cpi_data);
51
+ }, [row]);
52
+
53
+
54
+ const sortingData = (column, newOrder) => {
55
+ const sortedData = [...data].sort((a, b) => a[column].localeCompare(b[column]));
56
+
57
+ if (newOrder === 'desc') {
58
+ return sortedData.reverse();
59
+ }
60
+ return sortedData;
61
+ };
62
+
63
+ const handleSortByColumn = (column, order) => {
64
+ const newOrder = (order === 'asc' && sortBy === column) ? 'desc' : 'asc';
65
+ const newData = sortingData(column, newOrder);
66
+ setData(newData);
67
+ setSortBy(column);
68
+ setSortOrder(newOrder);
69
+ };
70
+
71
+ const modalBody = {
72
+ position: 'absolute',
73
+ top: '5%',
74
+ left: '25%',
75
+ width: '840px',
76
+ height: '671px',
77
+ background: '#FFFFFF',
78
+ border: '1px solid #505050',
79
+ borderRadius: '40px',
80
+ overflow: 'hidden',
81
+ };
82
+
83
+ const header = {
84
+ display: 'flex',
85
+ justifyContent: 'center',
86
+ alignItems: 'center',
87
+ height: '55px',
88
+ };
89
+
90
+ const cell = {
91
+ paddingLeft: '3px',
92
+ paddingRight: '5px',
93
+ };
94
+
95
+ const cellLast = {
96
+ paddingLeft: '3px',
97
+ paddingRight: '10px',
98
+ wordBreak: 'break-word',
99
+ };
100
+
101
+ const footer = {
102
+ display: 'flex',
103
+ justifyContent: 'center',
104
+ alignItems: 'center',
105
+ height: '55px',
106
+ color: '#7D267E',
107
+ fontFamily: 'Nunito',
108
+ fontSize: '16px',
109
+ fontWeight: '400',
110
+ };
111
+
112
+ const link = {
113
+ color: '#7D267E',
114
+ fontFamily: 'Nunito',
115
+ fontSize: '16px',
116
+ fontWeight: '700',
117
+ };
118
+
119
+ const modalTitle = {
120
+ fontFamily: 'Poppins',
121
+ fontSize: '19px',
122
+ fontWeight: '400',
123
+ lineHeight: '21px',
124
+ letterSpacing: '0.02em',
125
+ textAlign: 'center',
126
+ color: '#000000',
127
+ };
128
+
129
+ const closeButton = {
130
+ marginLeft: '769px',
131
+ position: 'absolute',
132
+ backgroundColor: 'transparent',
133
+ };
134
+
135
+ const countContainer = {
136
+ display: 'flex',
137
+ justifyContent: 'left',
138
+ alignItems: 'center',
139
+ borderTop: '3px solid #939393',
140
+ borderBottom: '3px solid #939393',
141
+ height: '51px',
142
+ paddingLeft: '16px',
143
+ };
144
+
145
+ const participantId = row.participant_id;
146
+ const displayColumns = [
147
+ {
148
+ dataField: 'associated_id',
149
+ header: 'Participant ID',
150
+ tooltipText: 'sort',
151
+ },
152
+ {
153
+ dataField: 'repository_of_synonym_id',
154
+ header: 'Name',
155
+ tooltipText: 'sort',
156
+ },
157
+ {
158
+ dataField: 'domain_description',
159
+ header: 'Description',
160
+ tooltipText: 'sort',
161
+ },
162
+ {
163
+ dataField: 'domain_category',
164
+ header: 'Category',
165
+ tooltipText: 'sort',
166
+ },
167
+ {
168
+ dataField: 'data_location',
169
+ header: 'Location',
170
+ tooltipText: 'sort',
171
+ },
172
+ ];
173
+
174
+ return (
175
+ <Modal
176
+ open={open}
177
+ onClose={onClose}
178
+ aria-labelledby={`${row.id}-modal`}
179
+ >
180
+ <Box className={classes.modalBody} style={modalBody}>
181
+ <div className="header" style={header}>
182
+ <Typography id="modal-modal-title" className="modalTitle" style={modalTitle}>
183
+ {`Participant ID ${participantId} : CPI Mappings`}
184
+ </Typography>
185
+ <IconButton
186
+ aria-label="close"
187
+ onClick={onClose}
188
+ className="closeButton"
189
+ style={closeButton}
190
+ >
191
+ <CloseIcon fontSize="small" />
192
+ </IconButton>
193
+ </div>
194
+ <div className="container" style={countContainer}>
195
+ {`${data.length} mapped identifiers`}
196
+ </div>
197
+ <CustomTableContainer
198
+ className={classes.tableContainer}
199
+ themeConfig={themeConfig}
200
+ >
201
+ <Table>
202
+ <TableHead>
203
+ <TableRow>
204
+ {
205
+ displayColumns.map((column) => (
206
+ <HeaderCell
207
+ column={column}
208
+ sortBy={sortBy}
209
+ sortOrder={sortOrder}
210
+ toggleSort={() => handleSortByColumn(column.dataField, sortOrder)}
211
+ style={{ paddingLeft: '3px', paddingRight: '3px', fontWeight: '700' }}
212
+ />
213
+ ))
214
+ }
215
+ </TableRow>
216
+ </TableHead>
217
+ <TableBody>
218
+ {
219
+ data.map((currRow) => (
220
+ <TableRow>
221
+ {
222
+ displayColumns.map((column) => (
223
+ (
224
+ column.dataField !== 'data_location'
225
+ ? <TableCell style={cell}>{currRow[column.dataField]}</TableCell>
226
+ : <TableCell style={cellLast}><a href={currRow[column.dataField]} target="_blank" rel="noopener noreferrer">{currRow[column.dataField]}</a></TableCell>
227
+ )
228
+ ))
229
+ }
230
+ </TableRow>
231
+ ))
232
+ }
233
+ </TableBody>
234
+ </Table>
235
+ </CustomTableContainer>
236
+ <div className="footer" style={footer}>
237
+ To learn more about CPI click&nbsp;
238
+ <a style={link} href="https://participantindex-docs.ccdi.cancer.gov/" target="_blank" rel="noopener noreferrer">here</a>
239
+ </div>
240
+ </Box>
241
+ </Modal>
242
+ );
243
+ };
244
+
245
+ export default withStyles(styles)(CPIModal);
@@ -0,0 +1,133 @@
1
+ import React, { useState } from 'react';
2
+ import {
3
+ Typography,
4
+ Tooltip,
5
+ makeStyles,
6
+ } from '@material-ui/core';
7
+ import { cellTypes } from '../../util/Types';
8
+ import cpiIcon from '../../assets/cpi_icon.svg';
9
+ import CPIModal from './CPIModal';
10
+
11
+ /**
12
+ * Custom Link component
13
+ */
14
+
15
+ const CPIView = ({
16
+ column,
17
+ row,
18
+ themeConfig,
19
+ }) => {
20
+ const useStyles = makeStyles(() => ({
21
+ arrow: {
22
+ '&:before': {
23
+ border: '1px solid black',
24
+ },
25
+ color: 'white',
26
+ },
27
+ tooltip: {
28
+ backgroundColor: 'white',
29
+ border: '1px solid black',
30
+ color: 'black',
31
+ font: 'Poppins',
32
+ fontWeight: 400,
33
+ fontSize: '13px',
34
+ lineHeight: '17.5px',
35
+ },
36
+ }));
37
+
38
+ const classes = useStyles();
39
+
40
+ const [modalOpen, setModalOpen] = useState(false);
41
+ const cpiData = row.cpi_data;
42
+ const internalData = cpiData.filter((e) => (e.data_type === 'internal'));
43
+ const externalData = cpiData.filter((e) => (e.data_type === 'external'));
44
+
45
+ const handleModalOpen = () => {
46
+ setModalOpen(true);
47
+ };
48
+
49
+ const handleModalClose = () => {
50
+ setModalOpen(false);
51
+ };
52
+
53
+ const button = {
54
+ color: '#07679C',
55
+ textDecoration: 'underline',
56
+ fontWeight: 700,
57
+ cursor: 'pointer',
58
+ padding: 0,
59
+ marginLeft: '3px',
60
+ };
61
+
62
+ const icon = {
63
+ marginLeft: '10px',
64
+ position: 'relative',
65
+ top: '5px',
66
+ cursor: 'pointer',
67
+ };
68
+
69
+ return (
70
+ <Typography className={cellTypes.CPI}>
71
+ {row[column?.dataField]}
72
+ {cpiData.length
73
+ ? (
74
+ <>
75
+ <CPIModal
76
+ row={row}
77
+ open={modalOpen}
78
+ onClose={handleModalClose}
79
+ themeConfig={themeConfig}
80
+ />
81
+ <Tooltip
82
+ interactive
83
+ placement="top"
84
+ arrow
85
+ disableFocusListener
86
+ disableTouchListener
87
+ style={{
88
+ pointerEvents: 'auto',
89
+ backgroundColor: 'transparent',
90
+ font: 'Poppins',
91
+ fontSize: '13px',
92
+ }}
93
+ classes={{ arrow: classes.arrow, tooltip: classes.tooltip }}
94
+ title={
95
+ (externalData.length && internalData.length === 0
96
+ ? (
97
+ <div>
98
+ All mapped identifiers in the CCDI Participant Index (CPI) are available
99
+ <span role="button" onClick={handleModalOpen} tabIndex={0} style={button}>here.</span>
100
+ </div>
101
+ )
102
+ : (
103
+ <div>
104
+ <div style={{ marginBottom: '3px' }}>Identifier mapped in CCDI Hub:</div>
105
+ {internalData.map((e) => (
106
+ <div>{`${e.associated_id}, ${e.repository_of_synonym_id}`}</div>
107
+ ))}
108
+ <p>
109
+ All mapped identifiers in the CCDI Participant Index (CPI) are available
110
+ <span role="button" onClick={handleModalOpen} tabIndex={0} style={button}>here.</span>
111
+ </p>
112
+ </div>
113
+ )
114
+ )
115
+ }
116
+ >
117
+ <span style={icon}>
118
+ <img
119
+ src={cpiIcon}
120
+ height={21}
121
+ width={23}
122
+ alt="cpi-icon"
123
+ />
124
+ </span>
125
+ </Tooltip>
126
+ </>
127
+ )
128
+ : <></>}
129
+ </Typography>
130
+ );
131
+ };
132
+
133
+ export default CPIView;
@@ -12,7 +12,7 @@ const CustomLinkView = ({
12
12
  row,
13
13
  }) => {
14
14
  const { rootPath, pathParams } = column?.linkAttr;
15
- const url = pathParams.map((attr) => `#${rootPath}/`.concat(row[attr]));
15
+ const url = pathParams.map((attr) => `${rootPath}/`.concat(row[attr]));
16
16
  return (
17
17
  <Link href={url} className={cellTypes.LINK}>
18
18
  <Typography>