@bento-core/table 1.0.0-c3dc.31 → 1.0.0-c3dc.33

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.
@@ -24,7 +24,13 @@ const defaultTheme = () => ({
24
24
  MuiList: {
25
25
  root: {
26
26
  '&.viewColumnList': {
27
- padding: '8px 20px 8px 10px',
27
+ paddingLeft: '19.5px',
28
+ },
29
+ },
30
+ padding: {
31
+ '&.viewColumnList': {
32
+ paddingTop: '0px',
33
+ paddingBottom: '0px',
28
34
  },
29
35
  },
30
36
  },
@@ -52,8 +58,11 @@ const defaultTheme = () => ({
52
58
  },
53
59
  MuiSvgIcon: {
54
60
  root: {
55
- '&.checkBoxIcon': {
56
- color: '#0B3556',
61
+ '&.checkBox': {
62
+ padding: '0px 5px 0px 0px',
63
+ position: 'absolute',
64
+ top: '0px',
65
+ left: '-10px',
57
66
  },
58
67
  },
59
68
  },
@@ -11,15 +11,15 @@ import DownloadButton from './toolbar/DownloadButtonView';
11
11
  const downloadAreaStyle = {
12
12
  display: 'flex',
13
13
  borderTop: '1px solid #8A7F7C',
14
- paddingRight: '41px',
14
+ paddingRight: '48px',
15
15
  };
16
16
 
17
17
  const ExtendedView = ({
18
18
  table,
19
19
  onColumnViewChange,
20
+ onAllColumnViewChange,
20
21
  onRowsPerPageChange,
21
22
  onPageChange,
22
- numSelected = 0,
23
23
  customTheme,
24
24
  queryVariables,
25
25
  }) => {
@@ -37,15 +37,6 @@ const ExtendedView = ({
37
37
  const themeConfig = createTheme({ overrides: { ...defaultTheme(), ...customTheme } });
38
38
  return (
39
39
  <ThemeProvider theme={themeConfig}>
40
- {(numSelected === 0 && (download || manageViewColumns)) && (
41
-
42
- <ManageColumnView
43
- table={table}
44
- manageViewColumns={manageViewColumns}
45
- onColumnViewChange={onColumnViewChange}
46
- />
47
-
48
- )}
49
40
  {
50
41
  (pagination) && (
51
42
  <div className="downloadArea" style={(table.paginationCustomStyle && table.paginationCustomStyle.topPagination) ? table.paginationCustomStyle.topPagination : downloadAreaStyle}>
@@ -66,15 +57,28 @@ const ExtendedView = ({
66
57
  queryVariables={queryVariables}
67
58
  table={table}
68
59
  />
69
- {table.showDownloadIcon !== false
70
- && (
71
- <DownloadButton
72
- count={table.totalRowCount || 0}
73
- queryVariables={queryVariables}
74
- table={table}
75
- buttonConfig={downloadButtonConfig}
76
- />
77
- )}
60
+ {
61
+ (manageViewColumns)
62
+ && (
63
+ <ManageColumnView
64
+ table={table}
65
+ manageViewColumns={manageViewColumns}
66
+ onColumnViewChange={onColumnViewChange}
67
+ onAllColumnViewChange={onAllColumnViewChange}
68
+ />
69
+ )
70
+ }
71
+ {
72
+ (download)
73
+ && (
74
+ <DownloadButton
75
+ count={table.totalRowCount || 0}
76
+ queryVariables={queryVariables}
77
+ table={table}
78
+ buttonConfig={downloadButtonConfig}
79
+ />
80
+ )
81
+ }
78
82
 
79
83
  </div>
80
84
  )
package/src/TableView.js CHANGED
@@ -11,8 +11,10 @@ import CustomPagination from './pagination/CustomPagination';
11
11
  import CustomTableBody from './body/CustomTblBody';
12
12
  import CustomToolbar from './toolbar/CustomToolbar';
13
13
  import DownloadButton from './toolbar/DownloadButtonView';
14
+ import ManageColumnView from './toolbar/ManageColumnView';
14
15
  import DisplayErrMsg from './errMsg/DisplayErrMsg';
15
16
  import ExtendedView from './ExtendedView';
17
+ import defaultTheme from './DefaultThemConfig';
16
18
 
17
19
  const CustomTableContainer = (props) => {
18
20
  const { children, customTheme } = props;
@@ -29,7 +31,7 @@ const CustomTableContainer = (props) => {
29
31
  const downloadAreaStyle = {
30
32
  display: 'flex',
31
33
  borderTop: '1px solid #8A7F7C',
32
- paddingRight: '41px',
34
+ paddingRight: '48px',
33
35
  };
34
36
 
35
37
  const cartDownloadAreaStyle = {
@@ -49,73 +51,97 @@ const TableView = ({
49
51
  totalRowCount,
50
52
  onSortByColumn,
51
53
  onColumnViewChange,
54
+ onAllColumnViewChange,
52
55
  themeConfig = {},
53
56
  queryVariables,
54
- }) => (
55
- <>
56
- <ExtendedView
57
- table={table}
58
- onColumnViewChange={onColumnViewChange}
59
- onRowsPerPageChange={onRowsPerPageChange}
60
- onPageChange={onPageChange}
61
- numSelected={table?.selectedRows?.length || 0}
62
- customTheme={themeConfig.extendedView}
63
- queryVariables={queryVariables}
64
- />
65
- <CustomToolbar
66
- numSelected={table?.selectedRows?.length || 0}
67
- table={table}
68
- onColumnViewChange={onColumnViewChange}
69
- customTheme={themeConfig.toolbar}
70
- />
71
- <CustomTableContainer
72
- customTheme={themeConfig.tblContainer || {}}
73
- >
74
- <Table>
75
- <TableHeader
76
- customTheme={themeConfig.tblHeader}
77
- table={table}
78
- rows={tableRows}
79
- count={totalRowCount}
80
- toggleSelectAll={onToggleSelectAll}
81
- sortByColumn={onSortByColumn}
82
- />
83
- <CustomTableBody
84
- customTheme={themeConfig.tblBody}
85
- rows={tableRows}
86
- table={table}
87
- onRowSelectChange={onRowSelectChange}
88
- />
89
- </Table>
90
- </CustomTableContainer>
91
- {tableRows.length === 0 && (
92
- <DisplayErrMsg
93
- customTheme={themeConfig.displayErr}
57
+ }) => {
58
+ const { extendedViewConfig } = table;
59
+ const {
60
+ manageViewColumns = false,
61
+ download = false,
62
+ downloadButtonConfig,
63
+ } = extendedViewConfig;
64
+ return (
65
+ <>
66
+ <ExtendedView
94
67
  table={table}
95
- />
96
- )}
97
- <div className="downloadArea" style={table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : (table.paginationCustomStyle && table.paginationCustomStyle.bottomPagination) ? table.paginationCustomStyle.bottomPagination : downloadAreaStyle}>
98
- <CustomPagination
99
- customTheme={themeConfig.tblPgn}
100
- rowsPerPageOptions={[10, 25, 50, 100]}
101
- component="div"
102
- count={table.totalRowCount || 0}
103
- rowsPerPage={table.rowsPerPage || 10}
104
- page={table.page || 0}
105
- onPageChange={onPageChange}
68
+ onColumnViewChange={onColumnViewChange}
69
+ onAllColumnViewChange={onAllColumnViewChange}
106
70
  onRowsPerPageChange={onRowsPerPageChange}
71
+ onPageChange={onPageChange}
72
+ customTheme={themeConfig.extendedView}
73
+ queryVariables={queryVariables}
74
+ />
75
+ <CustomToolbar
76
+ numSelected={table?.selectedRows?.length || 0}
77
+ table={table}
78
+ onColumnViewChange={onColumnViewChange}
79
+ customTheme={themeConfig.toolbar}
107
80
  />
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
- )}
117
- </div>
118
- </>
119
- );
81
+ <CustomTableContainer
82
+ customTheme={themeConfig.tblContainer || {}}
83
+ >
84
+ <Table>
85
+ <TableHeader
86
+ customTheme={themeConfig.tblHeader}
87
+ table={table}
88
+ rows={tableRows}
89
+ count={totalRowCount}
90
+ toggleSelectAll={onToggleSelectAll}
91
+ sortByColumn={onSortByColumn}
92
+ />
93
+ <CustomTableBody
94
+ customTheme={themeConfig.tblBody}
95
+ rows={tableRows}
96
+ table={table}
97
+ onRowSelectChange={onRowSelectChange}
98
+ />
99
+ </Table>
100
+ </CustomTableContainer>
101
+ {tableRows.length === 0 && (
102
+ <DisplayErrMsg
103
+ customTheme={themeConfig.displayErr}
104
+ table={table}
105
+ />
106
+ )}
107
+ <ThemeProvider theme={createTheme({ overrides: { ...defaultTheme(), ...themeConfig.extendedView } })}>
108
+ <div className="downloadArea" style={table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : (table.paginationCustomStyle && table.paginationCustomStyle.bottomPagination) ? table.paginationCustomStyle.bottomPagination : downloadAreaStyle}>
109
+ <CustomPagination
110
+ customTheme={themeConfig.tblPgn}
111
+ rowsPerPageOptions={[10, 25, 50, 100]}
112
+ component="div"
113
+ count={table.totalRowCount || 0}
114
+ rowsPerPage={table.rowsPerPage || 10}
115
+ page={table.page || 0}
116
+ onPageChange={onPageChange}
117
+ onRowsPerPageChange={onRowsPerPageChange}
118
+ />
119
+ {
120
+ manageViewColumns
121
+ && (
122
+ <ManageColumnView
123
+ table={table}
124
+ manageViewColumns={manageViewColumns}
125
+ onColumnViewChange={onColumnViewChange}
126
+ onAllColumnViewChange={onAllColumnViewChange}
127
+ />
128
+ )
129
+ }
130
+ {
131
+ download
132
+ && (
133
+ <DownloadButton
134
+ count={table.totalRowCount || 0}
135
+ queryVariables={queryVariables}
136
+ table={table}
137
+ buttonConfig={downloadButtonConfig}
138
+ />
139
+ )
140
+ }
141
+ </div>
142
+ </ThemeProvider>
143
+ </>
144
+ );
145
+ };
120
146
 
121
147
  export default TableView;
@@ -31,7 +31,7 @@ const DownloadButton = ({
31
31
  const useOutsideAlerter = (ref) => {
32
32
  useEffect(() => {
33
33
  function handleClickOutside(event) {
34
- if (!(event.target.getAttribute('id') && event.target.getAttribute('id').includes('dropdownListItem'))) {
34
+ if (ref.current && !ref.current.contains(event.target)) {
35
35
  setListDisplay('none');
36
36
  }
37
37
  }
@@ -39,7 +39,7 @@ const DownloadButton = ({
39
39
  return () => {
40
40
  document.removeEventListener('mousedown', handleClickOutside);
41
41
  };
42
- }, [ref]);
42
+ }, []);
43
43
  };
44
44
  useOutsideAlerter(dropdownSelection);
45
45
 
@@ -210,25 +210,24 @@ const DownloadButton = ({
210
210
 
211
211
  const useStyles = makeStyles({
212
212
  dropdown: {
213
- width: '60px',
214
- height: '25px',
215
- marginTop: '8px',
213
+ width: '48px',
214
+ height: '36px',
216
215
  paddingLeft: '5px',
217
- border: '0.75px solid #606060',
216
+ border: listDisplay === 'none' ? '0.75px solid #606060' : '1.5px solid #5666BD',
218
217
  borderRadius: '5px',
219
218
  display: 'inline-block',
220
219
  position: 'relative',
221
- alignSelf: 'center',
220
+ margin: '5px 0px',
222
221
  },
223
222
  dropdownList: {
224
223
  display: 'block',
225
224
  position: 'absolute',
226
225
  width: '60px',
227
- marginTop: '3px',
228
- marginLeft: '-5px',
226
+ top: '38px',
227
+ left: '-13.5px',
229
228
  overflow: 'auto',
230
- zIndex: '20',
231
- border: '1.5px solid #41545E',
229
+ zIndex: '11',
230
+ border: '1.5px solid #5666BD',
232
231
  borderRadius: '5px',
233
232
  background: '#ffffff',
234
233
  },
@@ -239,36 +238,41 @@ const DownloadButton = ({
239
238
  fontWeight: 400,
240
239
  lineHeight: '21px',
241
240
  '&:hover': {
242
- background: '#D7D7D7',
241
+ background: '#C9CFF4',
243
242
  cursor: 'pointer',
244
243
  },
245
244
  },
246
245
  arrowdownIcon: {
247
- marginLeft: '5px',
248
246
  fill: '#606060',
247
+ marginTop: '2px',
248
+ width: '20px',
249
+ height: '20px',
249
250
  },
250
251
  arrowdownIconDisabled: {
251
252
  marginLeft: '5px',
252
253
  fill: '#00000042',
253
254
  },
255
+ tooltip: {
256
+ marginTop: '5px',
257
+ },
254
258
  });
255
259
 
256
260
  const classes = useStyles();
257
261
 
258
262
  return (
259
- <div className={classes.dropdown} style={isDownloading ? { cursor: 'wait' } : {}}>
263
+ <div ref={dropdownSelection} className={classes.dropdown} style={isDownloading ? { cursor: 'wait' } : {}}>
260
264
 
261
- <Tooltip title={isDownloading ? 'Download in progress...' : (table.downloadButtonTooltipText || 'Download filtered results')}>
265
+ <Tooltip title={isDownloading ? 'Download in progress...' : (table.downloadButtonTooltipText || 'Download filtered results')} className={classes.tooltip}>
262
266
  {
263
267
  count !== 0
264
268
  ? (
265
- <IconButton onClick={handleClickButton} style={{ padding: '0' }} disabled={isDownloading}>
269
+ <IconButton onClick={handleClickButton} style={{ padding: '0', backgroundColor: 'transparent' }} disabled={isDownloading}>
266
270
  <CloudDownload />
267
271
  <KeyboardArrowDownOutlinedIcon className={classes.arrowdownIcon} />
268
272
  </IconButton>
269
273
  )
270
274
  : (
271
- <IconButton disabled>
275
+ <IconButton disabled style={{ backgroundColor: 'transparent' }}>
272
276
  <CloudDownload />
273
277
  <KeyboardArrowDownOutlinedIcon className={classes.arrowdownIconDisabled} />
274
278
  </IconButton>