@bento-core/table 1.0.0-c3dc.31 → 1.0.0-c3dc.32
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 +7 -3
- package/dist/ExtendedView.js +9 -8
- package/dist/TableView.js +28 -8
- package/dist/toolbar/DownloadButtonView.js +27 -17
- package/dist/toolbar/ManageColumnView.js +255 -38
- package/dist/toolbar/assets/Hidden_Column.svg +4 -0
- package/dist/toolbar/assets/Search_Icon.svg +3 -0
- package/dist/toolbar/assets/View_Columns.svg +6 -0
- package/package.json +1 -1
- package/src/DefaultThemConfig.js +7 -3
- package/src/ExtendedView.js +24 -20
- package/src/TableView.js +90 -64
- package/src/toolbar/DownloadButtonView.js +21 -17
- package/src/toolbar/ManageColumnView.js +243 -47
- package/src/toolbar/assets/Hidden_Column.svg +4 -0
- package/src/toolbar/assets/Search_Icon.svg +3 -0
- package/src/toolbar/assets/View_Columns.svg +6 -0
|
@@ -1,99 +1,185 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Checkbox,
|
|
4
|
+
FormControlLabel,
|
|
4
5
|
IconButton,
|
|
5
6
|
List,
|
|
6
7
|
ListItem,
|
|
7
|
-
Popover,
|
|
8
8
|
Tooltip,
|
|
9
9
|
Typography,
|
|
10
10
|
withStyles,
|
|
11
|
+
Divider,
|
|
11
12
|
} from '@material-ui/core';
|
|
12
13
|
import {
|
|
13
|
-
ViewColumn,
|
|
14
14
|
CheckBox as CheckBoxIcon,
|
|
15
15
|
CheckBoxOutlineBlank as CheckBoxBlankIcon,
|
|
16
16
|
Close,
|
|
17
17
|
} from '@material-ui/icons';
|
|
18
|
+
import KeyboardArrowDownOutlinedIcon from '@material-ui/icons/KeyboardArrowDownOutlined';
|
|
18
19
|
import { cellTypes } from '../util/Types';
|
|
20
|
+
import viewColumnsIcon from './assets/View_Columns.svg';
|
|
21
|
+
import hiddenColumnsIcon from './assets/Hidden_Column.svg';
|
|
19
22
|
|
|
20
23
|
const ManageColumnView = ({
|
|
21
24
|
table,
|
|
22
25
|
onColumnViewChange,
|
|
26
|
+
onAllColumnViewChange,
|
|
23
27
|
manageViewColumns,
|
|
28
|
+
classes,
|
|
24
29
|
}) => {
|
|
25
30
|
if (!manageViewColumns) {
|
|
26
31
|
return null;
|
|
27
32
|
}
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
33
|
+
const { columns } = table;
|
|
34
|
+
const [listDisplay, setListDisplay] = useState('none');
|
|
35
|
+
const [selectAll, setSelectAll] = useState(false);
|
|
36
|
+
|
|
37
|
+
const viewColumns = columns.filter((col) => col.role === cellTypes.DISPLAY
|
|
38
|
+
&& col.disableInManageView !== true);
|
|
39
|
+
|
|
40
|
+
const dropdownSelection = useRef(null);
|
|
41
|
+
|
|
42
|
+
const handleClose = () => {
|
|
43
|
+
setListDisplay('none');
|
|
31
44
|
};
|
|
32
45
|
|
|
33
|
-
const
|
|
46
|
+
const handleClickButton = () => {
|
|
47
|
+
if (listDisplay === 'none') {
|
|
48
|
+
setListDisplay('block');
|
|
49
|
+
} else {
|
|
50
|
+
setListDisplay('none');
|
|
51
|
+
}
|
|
52
|
+
};
|
|
34
53
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+
const useOutsideAlerter = (ref) => {
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
function handleClickOutside(event) {
|
|
57
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
58
|
+
setListDisplay('none');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
62
|
+
return () => {
|
|
63
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
66
|
+
};
|
|
67
|
+
useOutsideAlerter(dropdownSelection);
|
|
68
|
+
|
|
69
|
+
const handleSelectAll = () => {
|
|
70
|
+
setSelectAll(!selectAll);
|
|
71
|
+
onAllColumnViewChange(!selectAll);
|
|
72
|
+
};
|
|
38
73
|
|
|
39
74
|
return (
|
|
40
|
-
|
|
75
|
+
<div ref={dropdownSelection} className={listDisplay === 'none' ? classes.columnDropdown : classes.columnDropdownActive}>
|
|
76
|
+
<Tooltip title="Columns may be hidden">
|
|
77
|
+
<img src={hiddenColumnsIcon} alt="hiddenColumnsIcon" className={classes.displayColumnIcon} />
|
|
78
|
+
</Tooltip>
|
|
41
79
|
<Tooltip title={manageViewColumns.title}>
|
|
42
|
-
<IconButton variant="contained" onClick={
|
|
43
|
-
<
|
|
80
|
+
<IconButton variant="contained" onClick={handleClickButton} className={classes.viewColumnsButton}>
|
|
81
|
+
<img src={viewColumnsIcon} alt="viewColumnsIcon" />
|
|
82
|
+
<KeyboardArrowDownOutlinedIcon className={classes.arrowDownIcon} />
|
|
44
83
|
</IconButton>
|
|
45
84
|
</Tooltip>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
anchorEl={anchorEl}
|
|
49
|
-
onClose={handleClose}
|
|
50
|
-
anchorOrigin={{
|
|
51
|
-
vertical: 'bottom',
|
|
52
|
-
horizontal: 'left',
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
<Typography variant="caption" className="viewColumnText">
|
|
85
|
+
<div className={listDisplay === 'none' ? classes.dropdownListHidden : classes.dropdownListVisible}>
|
|
86
|
+
<Typography variant="caption" className={classes.titleText}>
|
|
56
87
|
{manageViewColumns.title}
|
|
57
88
|
</Typography>
|
|
58
89
|
<IconButton
|
|
59
90
|
onClick={handleClose}
|
|
60
|
-
className=
|
|
91
|
+
className={classes.closeIconButton}
|
|
61
92
|
>
|
|
62
93
|
<Close />
|
|
63
94
|
</IconButton>
|
|
64
|
-
<List className="viewColumnList">
|
|
65
|
-
{viewColumns.map((column) => (
|
|
95
|
+
<List className="viewColumnList" id="dropdownListItemTitle">
|
|
96
|
+
{viewColumns.map((column, index) => (
|
|
66
97
|
<ListItem
|
|
67
98
|
width={1}
|
|
68
99
|
className="viewColumnListItem"
|
|
100
|
+
id={`dropdownListItem-${index}`}
|
|
69
101
|
>
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
102
|
+
<FormControlLabel
|
|
103
|
+
control={(
|
|
104
|
+
<Checkbox
|
|
105
|
+
icon={(
|
|
106
|
+
<CheckBoxBlankIcon
|
|
107
|
+
style={{ fontSize: 18 }}
|
|
108
|
+
className="checkBoxIcon"
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
onClick={() => onColumnViewChange(column)}
|
|
112
|
+
checked={column.display}
|
|
113
|
+
id={`dropdownListItemCheckbox-${index}`}
|
|
114
|
+
checkedIcon={(
|
|
115
|
+
<CheckBoxIcon
|
|
116
|
+
style={{
|
|
117
|
+
fontSize: 18,
|
|
118
|
+
color: column.hideable ? 'rgba(109, 95, 91, 1)' : 'rgba(109, 95, 91, 0.38)',
|
|
119
|
+
}}
|
|
120
|
+
className="checkBoxIcon"
|
|
121
|
+
/>
|
|
122
|
+
)}
|
|
123
|
+
disableRipple
|
|
124
|
+
color="secondary"
|
|
125
|
+
className="checkBox"
|
|
126
|
+
disabled={!column.hideable}
|
|
127
|
+
style={{ paddingTop: 0 }}
|
|
85
128
|
/>
|
|
86
129
|
)}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
130
|
+
disabled={!column.hideable}
|
|
131
|
+
label={<Typography id={`dropdownListItemLabel-${index}`} className={classes.textStyle}>{column.header}</Typography>}
|
|
132
|
+
id={`dropdownListItem-${index}-label`}
|
|
133
|
+
className="formControlLabel"
|
|
134
|
+
style={{ marginLeft: '13px', alignItems: 'flex-start' }}
|
|
90
135
|
/>
|
|
91
|
-
<Typography>{column.header}</Typography>
|
|
92
136
|
</ListItem>
|
|
93
137
|
))}
|
|
138
|
+
<Divider className={classes.dividerStyle} />
|
|
139
|
+
<ListItem
|
|
140
|
+
width={1}
|
|
141
|
+
className="viewColumnListItem"
|
|
142
|
+
style={{ height: '20px' }}
|
|
143
|
+
>
|
|
144
|
+
<FormControlLabel
|
|
145
|
+
control={(
|
|
146
|
+
<Checkbox
|
|
147
|
+
icon={(
|
|
148
|
+
<CheckBoxBlankIcon
|
|
149
|
+
style={{ fontSize: 18 }}
|
|
150
|
+
className="checkBoxIcon"
|
|
151
|
+
/>
|
|
152
|
+
)}
|
|
153
|
+
onClick={() => handleSelectAll()}
|
|
154
|
+
checked={selectAll}
|
|
155
|
+
id="dropdownListItem-all"
|
|
156
|
+
checkedIcon={(
|
|
157
|
+
<CheckBoxIcon
|
|
158
|
+
style={{
|
|
159
|
+
fontSize: 18,
|
|
160
|
+
color: 'rgba(109, 95, 91, 1)',
|
|
161
|
+
}}
|
|
162
|
+
className="checkBoxIcon"
|
|
163
|
+
/>
|
|
164
|
+
)}
|
|
165
|
+
disableRipple
|
|
166
|
+
color="secondary"
|
|
167
|
+
className="checkBox"
|
|
168
|
+
style={{ paddingTop: 0 }}
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
171
|
+
label={(
|
|
172
|
+
<Typography id="dropdownListItem-all-label" className={classes.textStyle}>
|
|
173
|
+
{selectAll ? 'Deselect All' : 'Select All'}
|
|
174
|
+
</Typography>
|
|
175
|
+
)}
|
|
176
|
+
id="dropdownListItem-all-label"
|
|
177
|
+
style={{ marginLeft: '13px', alignItems: 'flex-start', paddingTop: 7 }}
|
|
178
|
+
/>
|
|
179
|
+
</ListItem>
|
|
94
180
|
</List>
|
|
95
|
-
</
|
|
96
|
-
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
97
183
|
);
|
|
98
184
|
};
|
|
99
185
|
|
|
@@ -102,6 +188,109 @@ const styles = () => ({
|
|
|
102
188
|
padding: '16px 24px 16px 24px',
|
|
103
189
|
fontFamily: 'Roboto',
|
|
104
190
|
},
|
|
191
|
+
displayColumnIcon: {
|
|
192
|
+
position: 'absolute',
|
|
193
|
+
right: '35px',
|
|
194
|
+
bottom: '23px',
|
|
195
|
+
},
|
|
196
|
+
columnDropdown: {
|
|
197
|
+
width: '48px',
|
|
198
|
+
height: '36px',
|
|
199
|
+
paddingLeft: '5px',
|
|
200
|
+
border: '0.5px solid #606060',
|
|
201
|
+
borderRadius: '5px',
|
|
202
|
+
display: 'inline-flex',
|
|
203
|
+
position: 'relative',
|
|
204
|
+
padding: '0px 0px 0px 5px',
|
|
205
|
+
margin: '5px 11px 5px 1px',
|
|
206
|
+
},
|
|
207
|
+
columnDropdownActive: {
|
|
208
|
+
width: '48px',
|
|
209
|
+
height: '36px',
|
|
210
|
+
border: '1.5px solid #5666BD',
|
|
211
|
+
borderRadius: '5px',
|
|
212
|
+
display: 'inline-flex',
|
|
213
|
+
position: 'relative',
|
|
214
|
+
padding: '0px 0px 0px 5px',
|
|
215
|
+
margin: '5px 10px 5px 0px',
|
|
216
|
+
},
|
|
217
|
+
viewColumnsButton: {
|
|
218
|
+
marginTop: '6px',
|
|
219
|
+
height: '24px',
|
|
220
|
+
backgroundColor: 'transparent',
|
|
221
|
+
},
|
|
222
|
+
arrowDownIcon: {
|
|
223
|
+
fill: '#606060',
|
|
224
|
+
width: '20px',
|
|
225
|
+
height: '20px',
|
|
226
|
+
},
|
|
227
|
+
dropdownListHidden: {
|
|
228
|
+
position: 'absolute',
|
|
229
|
+
width: '230px',
|
|
230
|
+
marginTop: '38px',
|
|
231
|
+
marginLeft: '-188px',
|
|
232
|
+
zIndex: '11',
|
|
233
|
+
border: '1.5px solid #5666BD',
|
|
234
|
+
borderRadius: '5px',
|
|
235
|
+
background: '#ffffff',
|
|
236
|
+
display: 'none',
|
|
237
|
+
},
|
|
238
|
+
dropdownListVisible: {
|
|
239
|
+
position: 'absolute',
|
|
240
|
+
width: '230px',
|
|
241
|
+
marginTop: '38px',
|
|
242
|
+
marginLeft: '-188px',
|
|
243
|
+
zIndex: '11',
|
|
244
|
+
border: '1.5px solid #5666BD',
|
|
245
|
+
borderRadius: '5px',
|
|
246
|
+
background: '#ffffff',
|
|
247
|
+
display: 'block',
|
|
248
|
+
maxHeight: '300px',
|
|
249
|
+
overflowY: 'auto',
|
|
250
|
+
overflowX: 'hidden',
|
|
251
|
+
'&::-webkit-scrollbar': {
|
|
252
|
+
width: '6px', // Width of the scrollbar
|
|
253
|
+
},
|
|
254
|
+
'&::-webkit-scrollbar-track': {
|
|
255
|
+
background: '#CECECE', // Track color
|
|
256
|
+
borderRadius: '5px',
|
|
257
|
+
},
|
|
258
|
+
'&::-webkit-scrollbar-thumb': {
|
|
259
|
+
backgroundColor: '#8B98AF', // Thumb color
|
|
260
|
+
borderRadius: '5px',
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
titleText: {
|
|
264
|
+
fontFamily: 'Poppins',
|
|
265
|
+
fontWeight: '400',
|
|
266
|
+
fontSize: '14px',
|
|
267
|
+
display: 'flex',
|
|
268
|
+
position: 'relative',
|
|
269
|
+
top: '15px',
|
|
270
|
+
left: '34px',
|
|
271
|
+
color: '#000000',
|
|
272
|
+
},
|
|
273
|
+
closeIconButton: {
|
|
274
|
+
float: 'right',
|
|
275
|
+
bottom: '20px',
|
|
276
|
+
scale: '0.75',
|
|
277
|
+
},
|
|
278
|
+
textStyle: {
|
|
279
|
+
fontFamily: 'Poppins',
|
|
280
|
+
fontSize: '14px',
|
|
281
|
+
fontWeight: '400',
|
|
282
|
+
margin: '2px 0px',
|
|
283
|
+
lineHeight: '15px',
|
|
284
|
+
},
|
|
285
|
+
dividerStyle: {
|
|
286
|
+
backgroundColor: '#375F9A',
|
|
287
|
+
marginTop: '5px',
|
|
288
|
+
marginBottom: '5px',
|
|
289
|
+
width: 'calc(100% + 20px)',
|
|
290
|
+
position: 'relative',
|
|
291
|
+
left: '-10px',
|
|
292
|
+
height: '0.5px',
|
|
293
|
+
},
|
|
105
294
|
title: {
|
|
106
295
|
marginRight: '24px',
|
|
107
296
|
fontSize: '14px',
|
|
@@ -128,6 +317,13 @@ const styles = () => ({
|
|
|
128
317
|
fontSize: '15px',
|
|
129
318
|
marginLeft: '8px',
|
|
130
319
|
},
|
|
320
|
+
viewColumnListItem: {
|
|
321
|
+
height: '18px',
|
|
322
|
+
},
|
|
323
|
+
formControlLabel: {
|
|
324
|
+
marginLeft: '13px',
|
|
325
|
+
position: 'relative',
|
|
326
|
+
},
|
|
131
327
|
});
|
|
132
328
|
|
|
133
329
|
export default withStyles(styles)(ManageColumnView);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="10" y="0.928786" width="12.2783" height="12.2783" rx="2.5" transform="rotate(45 10 0.928786)" fill="#FFEB13" stroke="black"/>
|
|
3
|
+
<path d="M9.99994 7.14529C9.74072 7.14529 9.52354 7.06575 9.3484 6.90667C9.18026 6.74068 9.09619 6.53664 9.09619 6.29457C9.09619 6.05249 9.18026 5.85192 9.3484 5.69284C9.52354 5.52684 9.74072 5.44385 9.99994 5.44385C10.2592 5.44385 10.4728 5.52684 10.641 5.69284C10.8161 5.85192 10.9037 6.05249 10.9037 6.29457C10.9037 6.53664 10.8161 6.74068 10.641 6.90667C10.4728 7.06575 10.2592 7.14529 9.99994 7.14529ZM10.725 7.83001V13.5776H9.25382V7.83001H10.725Z" fill="black"/>
|
|
4
|
+
</svg>
|
|
@@ -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>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="20" height="18" viewBox="0 0 20 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M2.88892 1.40607H17.1116C17.6636 1.40633 18.1116 1.85394 18.1116 2.40607V15.5936C18.1116 16.1457 17.6636 16.5933 17.1116 16.5936H2.88892C2.33663 16.5936 1.88892 16.1459 1.88892 15.5936V2.40607C1.88892 1.85378 2.33663 1.40607 2.88892 1.40607Z" fill="white" stroke="#606060" stroke-width="2"/>
|
|
3
|
+
<line x1="1.79956" y1="6.08969" x2="19.1106" y2="6.08969" stroke="#606060" stroke-width="2"/>
|
|
4
|
+
<line x1="13.2661" y1="7.09055" x2="13.2661" y2="17.5941" stroke="#606060" stroke-width="2"/>
|
|
5
|
+
<line x1="7.6936" y1="7.0903" x2="7.6936" y2="17.5939" stroke="#606060" stroke-width="2"/>
|
|
6
|
+
</svg>
|