@bento-core/table 1.0.0-c3dc.30 → 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/body/components/CPIModal.js +5 -5
- package/dist/toolbar/DownloadButtonView.js +158 -52
- 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/body/components/CPIModal.js +6 -8
- package/src/toolbar/DownloadButtonView.js +138 -63
- 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
|
@@ -7,77 +7,287 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _core = require("@material-ui/core");
|
|
9
9
|
var _icons = require("@material-ui/icons");
|
|
10
|
+
var _KeyboardArrowDownOutlined = _interopRequireDefault(require("@material-ui/icons/KeyboardArrowDownOutlined"));
|
|
10
11
|
var _Types = require("../util/Types");
|
|
12
|
+
var _View_Columns = _interopRequireDefault(require("./assets/View_Columns.svg"));
|
|
13
|
+
var _Hidden_Column = _interopRequireDefault(require("./assets/Hidden_Column.svg"));
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
17
|
const ManageColumnView = _ref => {
|
|
14
18
|
let {
|
|
15
19
|
table,
|
|
16
20
|
onColumnViewChange,
|
|
17
|
-
|
|
21
|
+
onAllColumnViewChange,
|
|
22
|
+
manageViewColumns,
|
|
23
|
+
classes
|
|
18
24
|
} = _ref;
|
|
19
25
|
if (!manageViewColumns) {
|
|
20
26
|
return null;
|
|
21
27
|
}
|
|
22
|
-
const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
|
|
23
|
-
const handleClick = event => {
|
|
24
|
-
setAnchorEl(event.currentTarget);
|
|
25
|
-
};
|
|
26
|
-
const handleClose = () => setAnchorEl(null);
|
|
27
|
-
const open = Boolean(anchorEl);
|
|
28
28
|
const {
|
|
29
29
|
columns
|
|
30
30
|
} = table;
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const [listDisplay, setListDisplay] = (0, _react.useState)('none');
|
|
32
|
+
const [selectAll, setSelectAll] = (0, _react.useState)(false);
|
|
33
|
+
const viewColumns = columns.filter(col => col.role === _Types.cellTypes.DISPLAY && col.disableInManageView !== true);
|
|
34
|
+
const dropdownSelection = (0, _react.useRef)(null);
|
|
35
|
+
const handleClose = () => {
|
|
36
|
+
setListDisplay('none');
|
|
37
|
+
};
|
|
38
|
+
const handleClickButton = () => {
|
|
39
|
+
if (listDisplay === 'none') {
|
|
40
|
+
setListDisplay('block');
|
|
41
|
+
} else {
|
|
42
|
+
setListDisplay('none');
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const useOutsideAlerter = ref => {
|
|
46
|
+
(0, _react.useEffect)(() => {
|
|
47
|
+
function handleClickOutside(event) {
|
|
48
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
49
|
+
setListDisplay('none');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
53
|
+
return () => {
|
|
54
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
55
|
+
};
|
|
56
|
+
}, []);
|
|
57
|
+
};
|
|
58
|
+
useOutsideAlerter(dropdownSelection);
|
|
59
|
+
const handleSelectAll = () => {
|
|
60
|
+
setSelectAll(!selectAll);
|
|
61
|
+
onAllColumnViewChange(!selectAll);
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
64
|
+
ref: dropdownSelection,
|
|
65
|
+
className: listDisplay === 'none' ? classes.columnDropdown : classes.columnDropdownActive
|
|
66
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
67
|
+
title: "Columns may be hidden"
|
|
68
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
69
|
+
src: _Hidden_Column.default,
|
|
70
|
+
alt: "hiddenColumnsIcon",
|
|
71
|
+
className: classes.displayColumnIcon
|
|
72
|
+
})), /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
33
73
|
title: manageViewColumns.title
|
|
34
74
|
}, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
35
75
|
variant: "contained",
|
|
36
|
-
onClick:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
76
|
+
onClick: handleClickButton,
|
|
77
|
+
className: classes.viewColumnsButton
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
79
|
+
src: _View_Columns.default,
|
|
80
|
+
alt: "viewColumnsIcon"
|
|
81
|
+
}), /*#__PURE__*/_react.default.createElement(_KeyboardArrowDownOutlined.default, {
|
|
82
|
+
className: classes.arrowDownIcon
|
|
83
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
84
|
+
className: listDisplay === 'none' ? classes.dropdownListHidden : classes.dropdownListVisible
|
|
45
85
|
}, /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
46
86
|
variant: "caption",
|
|
47
|
-
className:
|
|
87
|
+
className: classes.titleText
|
|
48
88
|
}, manageViewColumns.title), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
49
89
|
onClick: handleClose,
|
|
50
|
-
className:
|
|
90
|
+
className: classes.closeIconButton
|
|
51
91
|
}, /*#__PURE__*/_react.default.createElement(_icons.Close, null)), /*#__PURE__*/_react.default.createElement(_core.List, {
|
|
52
|
-
className: "viewColumnList"
|
|
53
|
-
|
|
92
|
+
className: "viewColumnList",
|
|
93
|
+
id: "dropdownListItemTitle"
|
|
94
|
+
}, viewColumns.map((column, index) => /*#__PURE__*/_react.default.createElement(_core.ListItem, {
|
|
54
95
|
width: 1,
|
|
55
|
-
className: "viewColumnListItem"
|
|
56
|
-
|
|
57
|
-
|
|
96
|
+
className: "viewColumnListItem",
|
|
97
|
+
id: "dropdownListItem-".concat(index)
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement(_core.FormControlLabel, {
|
|
99
|
+
control: /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
|
|
100
|
+
icon: /*#__PURE__*/_react.default.createElement(_icons.CheckBoxOutlineBlank, {
|
|
101
|
+
style: {
|
|
102
|
+
fontSize: 18
|
|
103
|
+
},
|
|
104
|
+
className: "checkBoxIcon"
|
|
105
|
+
}),
|
|
106
|
+
onClick: () => onColumnViewChange(column),
|
|
107
|
+
checked: column.display,
|
|
108
|
+
id: "dropdownListItemCheckbox-".concat(index),
|
|
109
|
+
checkedIcon: /*#__PURE__*/_react.default.createElement(_icons.CheckBox, {
|
|
110
|
+
style: {
|
|
111
|
+
fontSize: 18,
|
|
112
|
+
color: column.hideable ? 'rgba(109, 95, 91, 1)' : 'rgba(109, 95, 91, 0.38)'
|
|
113
|
+
},
|
|
114
|
+
className: "checkBoxIcon"
|
|
115
|
+
}),
|
|
116
|
+
disableRipple: true,
|
|
117
|
+
color: "secondary",
|
|
118
|
+
className: "checkBox",
|
|
119
|
+
disabled: !column.hideable,
|
|
58
120
|
style: {
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
className: "checkBoxIcon"
|
|
121
|
+
paddingTop: 0
|
|
122
|
+
}
|
|
62
123
|
}),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
124
|
+
disabled: !column.hideable,
|
|
125
|
+
label: /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
126
|
+
id: "dropdownListItemLabel-".concat(index),
|
|
127
|
+
className: classes.textStyle
|
|
128
|
+
}, column.header),
|
|
129
|
+
id: "dropdownListItem-".concat(index, "-label"),
|
|
130
|
+
className: "formControlLabel",
|
|
131
|
+
style: {
|
|
132
|
+
marginLeft: '13px',
|
|
133
|
+
alignItems: 'flex-start'
|
|
134
|
+
}
|
|
135
|
+
}))), /*#__PURE__*/_react.default.createElement(_core.Divider, {
|
|
136
|
+
className: classes.dividerStyle
|
|
137
|
+
}), /*#__PURE__*/_react.default.createElement(_core.ListItem, {
|
|
138
|
+
width: 1,
|
|
139
|
+
className: "viewColumnListItem",
|
|
140
|
+
style: {
|
|
141
|
+
height: '20px'
|
|
142
|
+
}
|
|
143
|
+
}, /*#__PURE__*/_react.default.createElement(_core.FormControlLabel, {
|
|
144
|
+
control: /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
|
|
145
|
+
icon: /*#__PURE__*/_react.default.createElement(_icons.CheckBoxOutlineBlank, {
|
|
146
|
+
style: {
|
|
147
|
+
fontSize: 18
|
|
148
|
+
},
|
|
149
|
+
className: "checkBoxIcon"
|
|
150
|
+
}),
|
|
151
|
+
onClick: () => handleSelectAll(),
|
|
152
|
+
checked: selectAll,
|
|
153
|
+
id: "dropdownListItem-all",
|
|
154
|
+
checkedIcon: /*#__PURE__*/_react.default.createElement(_icons.CheckBox, {
|
|
155
|
+
style: {
|
|
156
|
+
fontSize: 18,
|
|
157
|
+
color: 'rgba(109, 95, 91, 1)'
|
|
158
|
+
},
|
|
159
|
+
className: "checkBoxIcon"
|
|
160
|
+
}),
|
|
161
|
+
disableRipple: true,
|
|
162
|
+
color: "secondary",
|
|
163
|
+
className: "checkBox",
|
|
66
164
|
style: {
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
className: "checkBoxIcon"
|
|
165
|
+
paddingTop: 0
|
|
166
|
+
}
|
|
70
167
|
}),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
168
|
+
label: /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
169
|
+
id: "dropdownListItem-all-label",
|
|
170
|
+
className: classes.textStyle
|
|
171
|
+
}, selectAll ? 'Deselect All' : 'Select All'),
|
|
172
|
+
id: "dropdownListItem-all-label",
|
|
173
|
+
style: {
|
|
174
|
+
marginLeft: '13px',
|
|
175
|
+
alignItems: 'flex-start',
|
|
176
|
+
paddingTop: 7
|
|
177
|
+
}
|
|
178
|
+
})))));
|
|
75
179
|
};
|
|
76
180
|
const styles = () => ({
|
|
77
181
|
root: {
|
|
78
182
|
padding: '16px 24px 16px 24px',
|
|
79
183
|
fontFamily: 'Roboto'
|
|
80
184
|
},
|
|
185
|
+
displayColumnIcon: {
|
|
186
|
+
position: 'absolute',
|
|
187
|
+
right: '35px',
|
|
188
|
+
bottom: '23px'
|
|
189
|
+
},
|
|
190
|
+
columnDropdown: {
|
|
191
|
+
width: '48px',
|
|
192
|
+
height: '36px',
|
|
193
|
+
paddingLeft: '5px',
|
|
194
|
+
border: '0.5px solid #606060',
|
|
195
|
+
borderRadius: '5px',
|
|
196
|
+
display: 'inline-flex',
|
|
197
|
+
position: 'relative',
|
|
198
|
+
padding: '0px 0px 0px 5px',
|
|
199
|
+
margin: '5px 11px 5px 1px'
|
|
200
|
+
},
|
|
201
|
+
columnDropdownActive: {
|
|
202
|
+
width: '48px',
|
|
203
|
+
height: '36px',
|
|
204
|
+
border: '1.5px solid #5666BD',
|
|
205
|
+
borderRadius: '5px',
|
|
206
|
+
display: 'inline-flex',
|
|
207
|
+
position: 'relative',
|
|
208
|
+
padding: '0px 0px 0px 5px',
|
|
209
|
+
margin: '5px 10px 5px 0px'
|
|
210
|
+
},
|
|
211
|
+
viewColumnsButton: {
|
|
212
|
+
marginTop: '6px',
|
|
213
|
+
height: '24px',
|
|
214
|
+
backgroundColor: 'transparent'
|
|
215
|
+
},
|
|
216
|
+
arrowDownIcon: {
|
|
217
|
+
fill: '#606060',
|
|
218
|
+
width: '20px',
|
|
219
|
+
height: '20px'
|
|
220
|
+
},
|
|
221
|
+
dropdownListHidden: {
|
|
222
|
+
position: 'absolute',
|
|
223
|
+
width: '230px',
|
|
224
|
+
marginTop: '38px',
|
|
225
|
+
marginLeft: '-188px',
|
|
226
|
+
zIndex: '11',
|
|
227
|
+
border: '1.5px solid #5666BD',
|
|
228
|
+
borderRadius: '5px',
|
|
229
|
+
background: '#ffffff',
|
|
230
|
+
display: 'none'
|
|
231
|
+
},
|
|
232
|
+
dropdownListVisible: {
|
|
233
|
+
position: 'absolute',
|
|
234
|
+
width: '230px',
|
|
235
|
+
marginTop: '38px',
|
|
236
|
+
marginLeft: '-188px',
|
|
237
|
+
zIndex: '11',
|
|
238
|
+
border: '1.5px solid #5666BD',
|
|
239
|
+
borderRadius: '5px',
|
|
240
|
+
background: '#ffffff',
|
|
241
|
+
display: 'block',
|
|
242
|
+
maxHeight: '300px',
|
|
243
|
+
overflowY: 'auto',
|
|
244
|
+
overflowX: 'hidden',
|
|
245
|
+
'&::-webkit-scrollbar': {
|
|
246
|
+
width: '6px' // Width of the scrollbar
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
'&::-webkit-scrollbar-track': {
|
|
250
|
+
background: '#CECECE',
|
|
251
|
+
// Track color
|
|
252
|
+
borderRadius: '5px'
|
|
253
|
+
},
|
|
254
|
+
'&::-webkit-scrollbar-thumb': {
|
|
255
|
+
backgroundColor: '#8B98AF',
|
|
256
|
+
// Thumb color
|
|
257
|
+
borderRadius: '5px'
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
titleText: {
|
|
261
|
+
fontFamily: 'Poppins',
|
|
262
|
+
fontWeight: '400',
|
|
263
|
+
fontSize: '14px',
|
|
264
|
+
display: 'flex',
|
|
265
|
+
position: 'relative',
|
|
266
|
+
top: '15px',
|
|
267
|
+
left: '34px',
|
|
268
|
+
color: '#000000'
|
|
269
|
+
},
|
|
270
|
+
closeIconButton: {
|
|
271
|
+
float: 'right',
|
|
272
|
+
bottom: '20px',
|
|
273
|
+
scale: '0.75'
|
|
274
|
+
},
|
|
275
|
+
textStyle: {
|
|
276
|
+
fontFamily: 'Poppins',
|
|
277
|
+
fontSize: '14px',
|
|
278
|
+
fontWeight: '400',
|
|
279
|
+
margin: '2px 0px',
|
|
280
|
+
lineHeight: '15px'
|
|
281
|
+
},
|
|
282
|
+
dividerStyle: {
|
|
283
|
+
backgroundColor: '#375F9A',
|
|
284
|
+
marginTop: '5px',
|
|
285
|
+
marginBottom: '5px',
|
|
286
|
+
width: 'calc(100% + 20px)',
|
|
287
|
+
position: 'relative',
|
|
288
|
+
left: '-10px',
|
|
289
|
+
height: '0.5px'
|
|
290
|
+
},
|
|
81
291
|
title: {
|
|
82
292
|
marginRight: '24px',
|
|
83
293
|
fontSize: '14px',
|
|
@@ -103,6 +313,13 @@ const styles = () => ({
|
|
|
103
313
|
label: {
|
|
104
314
|
fontSize: '15px',
|
|
105
315
|
marginLeft: '8px'
|
|
316
|
+
},
|
|
317
|
+
viewColumnListItem: {
|
|
318
|
+
height: '18px'
|
|
319
|
+
},
|
|
320
|
+
formControlLabel: {
|
|
321
|
+
marginLeft: '13px',
|
|
322
|
+
position: 'relative'
|
|
106
323
|
}
|
|
107
324
|
});
|
|
108
325
|
var _default = (0, _core.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>
|
package/package.json
CHANGED
package/src/DefaultThemConfig.js
CHANGED
|
@@ -24,7 +24,8 @@ const defaultTheme = () => ({
|
|
|
24
24
|
MuiList: {
|
|
25
25
|
root: {
|
|
26
26
|
'&.viewColumnList': {
|
|
27
|
-
padding: '8px 20px 8px
|
|
27
|
+
padding: '8px 20px 8px 20px',
|
|
28
|
+
bottom: '5px',
|
|
28
29
|
},
|
|
29
30
|
},
|
|
30
31
|
},
|
|
@@ -52,8 +53,11 @@ const defaultTheme = () => ({
|
|
|
52
53
|
},
|
|
53
54
|
MuiSvgIcon: {
|
|
54
55
|
root: {
|
|
55
|
-
'&.
|
|
56
|
-
|
|
56
|
+
'&.checkBox': {
|
|
57
|
+
padding: '0px 5px 0px 0px',
|
|
58
|
+
position: 'absolute',
|
|
59
|
+
top: '0px',
|
|
60
|
+
left: '-10px',
|
|
57
61
|
},
|
|
58
62
|
},
|
|
59
63
|
},
|
package/src/ExtendedView.js
CHANGED
|
@@ -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: '
|
|
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
|
-
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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: '
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Box,
|
|
4
4
|
Modal,
|
|
@@ -44,15 +44,13 @@ const CPIModal = ({
|
|
|
44
44
|
}) => {
|
|
45
45
|
const [sortBy, setSortBy] = useState('associated_id');
|
|
46
46
|
const [sortOrder, setSortOrder] = useState('asc');
|
|
47
|
-
const [data, setData] = useState(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, [row]);
|
|
52
|
-
|
|
47
|
+
const [data, setData] = useState(() => {
|
|
48
|
+
const result = row.cpi_data;
|
|
49
|
+
return result;
|
|
50
|
+
});
|
|
53
51
|
|
|
54
52
|
const sortingData = (column, newOrder) => {
|
|
55
|
-
const sortedData =
|
|
53
|
+
const sortedData = data.sort((a, b) => a[column].localeCompare(b[column]));
|
|
56
54
|
|
|
57
55
|
if (newOrder === 'desc') {
|
|
58
56
|
return sortedData.reverse();
|