@bento-core/table 1.0.1-ccdihub.8 → 1.0.1-ccdihub.80

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 (37) hide show
  1. package/dist/ExtendedView.js +23 -14
  2. package/dist/TableView.js +73 -6
  3. package/dist/body/CustomTblBody.js +2 -1
  4. package/dist/body/DisplayBodyCell.js +13 -3
  5. package/dist/body/components/CPIModal.js +187 -0
  6. package/dist/body/components/CPIView.js +115 -0
  7. package/dist/body/components/ModalStyle.js +107 -0
  8. package/dist/body/components/assets/CPI_icon.svg +22 -0
  9. package/dist/header/ActionHeaderCell.js +2 -1
  10. package/dist/header/CustomCell.js +8 -6
  11. package/dist/header/components/CheckBoxView.js +8 -3
  12. package/dist/index.js +6 -0
  13. package/dist/pagination/CustomPagination.js +11 -2
  14. package/dist/toolbar/DownloadButtonView.js +169 -7
  15. package/dist/toolbar/ManageColumnView.js +11 -3
  16. package/dist/util/Dataformat.js +41 -1
  17. package/dist/util/Types.js +22 -2
  18. package/dist/util/downloadTable.js +196 -0
  19. package/package.json +4 -1
  20. package/src/ExtendedView.js +34 -21
  21. package/src/TableView.js +119 -52
  22. package/src/body/CustomTblBody.js +1 -0
  23. package/src/body/DisplayBodyCell.js +12 -0
  24. package/src/body/components/CPIModal.js +227 -0
  25. package/src/body/components/CPIView.js +133 -0
  26. package/src/body/components/ModalStyle.js +101 -0
  27. package/src/body/components/assets/CPI_icon.svg +22 -0
  28. package/src/header/ActionHeaderCell.js +1 -1
  29. package/src/header/CustomCell.js +11 -1
  30. package/src/header/components/CheckBoxView.js +3 -1
  31. package/src/index.js +1 -0
  32. package/src/pagination/CustomPagination.js +4 -1
  33. package/src/toolbar/DownloadButtonView.js +178 -10
  34. package/src/toolbar/ManageColumnView.js +3 -3
  35. package/src/util/Dataformat.js +25 -0
  36. package/src/util/Types.js +15 -0
  37. package/src/util/downloadTable.js +138 -0
@@ -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-end"
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;
@@ -0,0 +1,101 @@
1
+ export default () => ({
2
+ header: {
3
+ display: 'flex',
4
+ justifyContent: 'center',
5
+ alignItems: 'center',
6
+ height: '55px',
7
+ },
8
+ closeButton: {
9
+ marginLeft: '769px',
10
+ position: 'absolute',
11
+ },
12
+ resetIcon: {
13
+ marginLeft: '10px',
14
+ minWidth: '5px',
15
+ width: '5px',
16
+ borderRadius: '9px',
17
+ height: '30px',
18
+ },
19
+ modalTitle: {
20
+ fontFamily: 'Poppins',
21
+ fontSize: '19px',
22
+ fontWeight: '400',
23
+ lineHeight: '21px',
24
+ letterSpacing: '0.02em',
25
+ textAlign: 'center',
26
+ color: '#000000',
27
+ },
28
+ modalBody: {
29
+ position: 'absolute',
30
+ top: '5%',
31
+ left: '25%',
32
+ width: '836px',
33
+ height: '671px',
34
+ background: '#FFFFFF',
35
+ border: '1px solid #505050',
36
+ borderRadius: '40px',
37
+ overflow: 'hidden',
38
+ },
39
+ searchContainer: {
40
+ display: 'flex',
41
+ justifyContent: 'center',
42
+ alignItems: 'center',
43
+ borderTop: '3px solid #939393',
44
+ borderBottom: '3px solid #939393',
45
+ height: '51px',
46
+ },
47
+ searchInputbox: {
48
+ marginRight: '10px',
49
+ fontFamily: 'Poppins',
50
+ fontSize: '18px',
51
+ fontWeight: '600',
52
+ lineHeight: '27px',
53
+ letterSpacing: '-0.02em',
54
+ textAlign: 'left',
55
+ color: '#7A437A',
56
+ },
57
+ highlight: {
58
+ color: '#b2c6d6',
59
+ },
60
+ sortGroup: {
61
+ paddingTop: '10px',
62
+ marginBottom: '5px',
63
+ borderTop: '1px solid #B1B1B1',
64
+ textAlign: 'left',
65
+ marginLeft: '-5px',
66
+ },
67
+ sortGroupIcon: {
68
+ cursor: 'pointer',
69
+ fontFamily: 'Nunito',
70
+ fontSize: '10px',
71
+ marginRight: '12px',
72
+ marginLeft: '24px',
73
+ },
74
+ sortGroupItem: {
75
+ cursor: 'pointer',
76
+ fontFamily: 'Nunito',
77
+ fontSize: '10px',
78
+ marginRight: '32px',
79
+ },
80
+ NonSortGroup: {
81
+ marginBottom: '5px',
82
+ borderTop: '1px solid #B1B1B1',
83
+ textAlign: 'left',
84
+ paddingLeft: '10px',
85
+ },
86
+ NonSortGroupItem: {
87
+ fontFamily: 'Nunito',
88
+ fontSize: '10px',
89
+ marginRight: '32px',
90
+ },
91
+ sortGroupItemCounts: {
92
+ cursor: 'pointer',
93
+ fontFamily: 'Nunito',
94
+ fontSize: '10px',
95
+ float: 'right',
96
+ marginRight: '10px',
97
+ marginTop: '5px',
98
+ },
99
+ itemContainer: {
100
+ },
101
+ });
@@ -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="#07679C"/>
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="#07679C"/>
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="#07679C"/>
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="#07679C"/>
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="#07679C"/>
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="#07679C"/>
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>
@@ -12,13 +12,13 @@ const ActionHeaderCell = ({
12
12
  column,
13
13
  }) => {
14
14
  const { cellType } = column;
15
-
16
15
  if (cellTypes.CHECKBOX === cellType) {
17
16
  return (
18
17
  <CheckboxView
19
18
  includeSelectedIds={includeSelectedIds}
20
19
  toggleSelectAll={toggleSelectAll}
21
20
  Ids={Ids}
21
+ rows={rows}
22
22
  />
23
23
  );
24
24
  }
@@ -21,6 +21,7 @@ const CustomHeaderCell = ({
21
21
  header,
22
22
  headerType,
23
23
  customColHeaderRender,
24
+ sortable,
24
25
  } = column;
25
26
 
26
27
  const Tooltip = useCallback(({ children }) => {
@@ -45,13 +46,22 @@ const CustomHeaderCell = ({
45
46
  return <>{children}</>;
46
47
  }, []);
47
48
 
49
+ if (sortable !== undefined && !sortable) {
50
+ return (
51
+ <TableCell
52
+ scope="col"
53
+ >
54
+ {header}
55
+ </TableCell>
56
+ );
57
+ }
58
+
48
59
  return (
49
60
  <TableCell
50
61
  scope="col"
51
62
  active={sortBy === dataField}
52
63
  direction={sortOrder}
53
64
  >
54
- <span style={{ display: 'none' }}>Select all</span>
55
65
  <Tooltip>
56
66
  <TableSortLabel
57
67
  active={sortBy === dataField}
@@ -10,14 +10,16 @@ const CheckboxView = ({
10
10
  includeSelectedIds,
11
11
  toggleSelectAll,
12
12
  Ids,
13
+ rows,
13
14
  }) => (
14
15
  <TableCell padding="checkbox">
16
+ <span style={{ display: 'none' }}>Select all</span>
15
17
  <Checkbox
16
18
  {...label}
17
19
  color="primary"
18
20
  indeterminate={includeSelectedIds}
19
21
  checked={includeSelectedIds}
20
- onChange={(event) => toggleSelectAll(event, Ids, includeSelectedIds)}
22
+ onChange={(event) => toggleSelectAll(event, Ids, includeSelectedIds, rows)}
21
23
  />
22
24
  </TableCell>
23
25
  );
package/src/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as TableView } from './TableView';
2
2
  export {
3
3
  cellTypes,
4
+ cellStyles,
4
5
  headerTypes,
5
6
  ComponentTypes,
6
7
  dataFormatTypes,
@@ -5,6 +5,7 @@ import {
5
5
  TablePagination,
6
6
  ThemeProvider,
7
7
  } from '@material-ui/core';
8
+ import KeyboardArrowDownOutlinedIcon from '@material-ui/icons/KeyboardArrowDownOutlined';
8
9
 
9
10
  const defaultTheme = {
10
11
  MuiTablePagination: {
@@ -43,6 +44,7 @@ const CustomPagination = ({
43
44
  }) => (
44
45
  <ThemeProvider theme={createTheme({ overrides: { ...defaultTheme, ...customTheme } })}>
45
46
  <TablePagination
47
+ labelRowsPerPage="Results per Page:"
46
48
  rowsPerPageOptions={rowsPerPageOptions}
47
49
  component="div"
48
50
  count={count}
@@ -50,9 +52,10 @@ const CustomPagination = ({
50
52
  page={page}
51
53
  onPageChange={onPageChange}
52
54
  onRowsPerPageChange={onRowsPerPageChange}
55
+ labelDisplayedRows={({ from, to }) => `${from.toLocaleString()}-${to.toLocaleString()} of ${count.toLocaleString()}`}
53
56
  SelectProps={{
57
+ IconComponent: KeyboardArrowDownOutlinedIcon,
54
58
  inputProps: { 'aria-label': 'Selection dropdown for displaying the number of results per page' },
55
- native: true,
56
59
  }}
57
60
  />
58
61
  </ThemeProvider>
@@ -1,25 +1,193 @@
1
- import React from 'react';
1
+ import React, {
2
+ useState,
3
+ useEffect,
4
+ useRef,
5
+ useCallback,
6
+ } from 'react';
7
+ import { useApolloClient } from '@apollo/client';
2
8
  import {
3
9
  IconButton,
4
10
  Tooltip,
11
+ makeStyles,
5
12
  } from '@material-ui/core';
13
+ import KeyboardArrowDownOutlinedIcon from '@material-ui/icons/KeyboardArrowDownOutlined';
6
14
  import { CloudDownload } from '@material-ui/icons';
15
+ import { downloadCSV, downloadJson } from '../util/downloadTable';
16
+
17
+ // const downloadButtonStyle = {
18
+ // color: '#d1d2d3',
19
+ // marginTop: '7px',
20
+ // };
7
21
 
8
22
  const DownloadButton = ({
9
- download,
23
+ count,
24
+ queryVariables,
25
+ table,
10
26
  }) => {
11
- if (!download) {
12
- return null;
27
+ const [listDisplay, setListDisplay] = useState('none');
28
+ const dropdownSelection = useRef(null);
29
+ const useOutsideAlerter = (ref) => {
30
+ useEffect(() => {
31
+ function handleClickOutside(event) {
32
+ if (!(event.target.getAttribute('id') && event.target.getAttribute('id').includes('dropdownListItem'))) {
33
+ setListDisplay('none');
34
+ }
35
+ }
36
+ document.addEventListener('mousedown', handleClickOutside);
37
+ return () => {
38
+ document.removeEventListener('mousedown', handleClickOutside);
39
+ };
40
+ }, [ref]);
41
+ };
42
+ useOutsideAlerter(dropdownSelection);
43
+
44
+ if (table.paginationAPIField === 'filesInList') {
45
+ return <></>;
46
+ }
47
+ // if (count === 0) {
48
+ // return <CloudDownload className="disableButton" style={downloadButtonStyle} />;
49
+ // }
50
+
51
+ const client = useApolloClient();
52
+
53
+ async function downloadSCSVFile() {
54
+ const {
55
+ query,
56
+ paginationAPIField,
57
+ } = table;
58
+
59
+ const result = await client.query({
60
+ query,
61
+ variables: {
62
+ ...queryVariables,
63
+ page: 0,
64
+ first: 200000,
65
+ order_by: table.sortBy,
66
+ sort_direction: table.sortOrder,
67
+ },
68
+ })
69
+ .then((response) => {
70
+ if (paginationAPIField && response && response.data) {
71
+ return response.data[paginationAPIField];
72
+ }
73
+ return response.data;
74
+ });
75
+ downloadCSV(result, table, table.downloadFileName);
76
+ }
77
+
78
+ async function downloadJsonFile() {
79
+ const {
80
+ query,
81
+ paginationAPIField,
82
+ } = table;
83
+
84
+ const result = await client.query({
85
+ query,
86
+ variables: {
87
+ ...queryVariables,
88
+ page: 0,
89
+ first: 200000,
90
+ order_by: table.sortBy,
91
+ sort_direction: table.sortOrder,
92
+ },
93
+ })
94
+ .then((response) => {
95
+ if (paginationAPIField && response && response.data) {
96
+ return response.data[paginationAPIField];
97
+ }
98
+ return response.data;
99
+ });
100
+ downloadJson(result, table, table.downloadFileName);
13
101
  }
14
102
 
103
+ const downloadTableCSV = useCallback(() => {
104
+ downloadSCSVFile();
105
+ setListDisplay('none');
106
+ }, [queryVariables, table]);
107
+
108
+ const downloadTableJson = useCallback(() => {
109
+ downloadJsonFile();
110
+ setListDisplay('none');
111
+ }, [queryVariables, table]);
112
+
113
+ const handleClickButton = () => {
114
+ if (listDisplay === 'none') {
115
+ setListDisplay('block');
116
+ } else {
117
+ setListDisplay('none');
118
+ }
119
+ };
120
+
121
+ const useStyles = makeStyles({
122
+ dropdown: {
123
+ width: '60px',
124
+ height: '25px',
125
+ marginTop: '8px',
126
+ paddingLeft: '5px',
127
+ border: '0.75px solid #606060',
128
+ borderRadius: '5px',
129
+ display: 'inline-block',
130
+ position: 'relative',
131
+ },
132
+ dropdownList: {
133
+ display: 'block',
134
+ position: 'absolute',
135
+ width: '60px',
136
+ marginTop: '3px',
137
+ marginLeft: '-5px',
138
+ overflow: 'auto',
139
+ zIndex: '5',
140
+ border: '1.5px solid #41545E',
141
+ borderRadius: '5px',
142
+ background: '#ffffff',
143
+ },
144
+ dropdownListItem: {
145
+ padding: '2px 4px',
146
+ font: 'Poppins',
147
+ fontSize: '14px',
148
+ fontWeight: 400,
149
+ lineHeight: '21px',
150
+ '&:hover': {
151
+ background: '#D7D7D7',
152
+ cursor: 'pointer',
153
+ },
154
+ },
155
+ arrowdownIcon: {
156
+ marginLeft: '5px',
157
+ fill: '#606060',
158
+ },
159
+ arrowdownIconDisabled: {
160
+ marginLeft: '5px',
161
+ fill: '#00000042',
162
+ },
163
+ });
164
+
165
+ const classes = useStyles();
166
+
15
167
  return (
16
- <>
17
- <Tooltip title={download.downloadCsv}>
18
- <IconButton>
19
- <CloudDownload />
20
- </IconButton>
168
+ <div className={classes.dropdown}>
169
+ <Tooltip title="Download filtered results">
170
+ {
171
+ count !== 0
172
+ ? (
173
+ <IconButton onClick={handleClickButton}>
174
+ <CloudDownload />
175
+ <KeyboardArrowDownOutlinedIcon className={classes.arrowdownIcon} />
176
+ </IconButton>
177
+ )
178
+ : (
179
+ <IconButton disabled>
180
+ <CloudDownload />
181
+ <KeyboardArrowDownOutlinedIcon className={classes.arrowdownIconDisabled} />
182
+ </IconButton>
183
+ )
184
+ }
21
185
  </Tooltip>
22
- </>
186
+ <div className={classes.dropdownList} style={{ display: listDisplay }}>
187
+ <div id="dropdownListItemCSV" className={classes.dropdownListItem} onClick={downloadTableCSV}>CSV</div>
188
+ <div id="dropdownListItemJSON" className={classes.dropdownListItem} onClick={downloadTableJson}>JSON</div>
189
+ </div>
190
+ </div>
23
191
  );
24
192
  };
25
193
 
@@ -34,12 +34,11 @@ const ManageColumnView = ({
34
34
 
35
35
  const open = Boolean(anchorEl);
36
36
  const { columns } = table;
37
- const viewColumns = columns.filter((col) => col.role === cellTypes.DISPLAY);
38
-
37
+ const viewColumns = columns.filter((col) => col.role === cellTypes.DISPLAY && col.hideable);
39
38
  return (
40
39
  <>
41
40
  <Tooltip title={manageViewColumns.title}>
42
- <IconButton variant="contained" onClick={handleClick}>
41
+ <IconButton variant="contained" onClick={handleClick} style={{ marginLeft: '10px', marginTop: '9px', height: '24px' }}>
43
42
  <ViewColumn />
44
43
  </IconButton>
45
44
  </Tooltip>
@@ -58,6 +57,7 @@ const ManageColumnView = ({
58
57
  <IconButton
59
58
  onClick={handleClose}
60
59
  className="closeIcon"
60
+ style={{ float: 'right' }}
61
61
  >
62
62
  <Close />
63
63
  </IconButton>
@@ -6,3 +6,28 @@ export function formatBytes(bytes, decimals = 2) {
6
6
  const i = Math.floor(Math.log(bytes) / Math.log(1024));
7
7
  return `${parseFloat((bytes / (1024 ** i)).toFixed(dm))} ${sizes[i]}`;
8
8
  }
9
+
10
+ /**
11
+ * convert zero (0) value to custom val
12
+ * @param {*} columns
13
+ * @param {*} data
14
+ * @returns
15
+ */
16
+ export const formatColumnValues = (columns, data) => {
17
+ const formatColumns = columns.filter(({ columnDefaultValues }) => columnDefaultValues);
18
+ if (formatColumns.length > 0) {
19
+ const formatCoumnData = [...data].reduce((acc, item) => {
20
+ const updateRow = { ...item };
21
+ formatColumns.forEach((col) => {
22
+ const { columnDefaultValues, dataField } = col;
23
+ if (columnDefaultValues[item[dataField]]) {
24
+ updateRow[dataField] = columnDefaultValues[item[dataField]];
25
+ }
26
+ });
27
+ acc.push(updateRow);
28
+ return acc;
29
+ }, []);
30
+ return formatCoumnData;
31
+ }
32
+ return data;
33
+ };
package/src/util/Types.js CHANGED
@@ -5,7 +5,12 @@ export const LINK = 'LINK';
5
5
  export const DISPLAY = 'DISPLAY';
6
6
  export const DEFAULT = 'DEFAULT';
7
7
  export const FORMAT_DATA = 'FORMAT_DATA';
8
+ export const CPI = 'CPI';
8
9
  export const FORMAT_BYTES = 'FORMAT_BYTES';
10
+ export const TRANSFORM = 'TRANSFORM';
11
+ export const STUDY_DOWNLOAD = 'STUDY_DOWNLOAD';
12
+ export const EXPAND = 'EXPAND';
13
+ export const DBGAP = 'DBGAP';
9
14
 
10
15
  export const cellTypes = {
11
16
  CUSTOM_ELEM,
@@ -15,10 +20,20 @@ export const cellTypes = {
15
20
  DELETE,
16
21
  DEFAULT,
17
22
  FORMAT_DATA,
23
+ CPI,
24
+ };
25
+
26
+ export const cellStyles = {
27
+ TRANSFORM,
28
+ EXPAND,
29
+ DBGAP,
30
+ STUDY_DOWNLOAD,
18
31
  };
19
32
 
20
33
  export const actionCellTypes = [CHECKBOX, DELETE];
21
34
 
35
+ export const notIncludedCellStyle = [STUDY_DOWNLOAD];
36
+
22
37
  export const FORMAT_DATA_CELLS = [FORMAT_BYTES];
23
38
 
24
39
  export const dataFormatTypes = {