@bento-core/paginated-table 1.0.1-icdc.9 → 1.0.1-ins.0
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/Add_Selected_Files_Orange_button_README.md +0 -2
- package/dist/table/PaginatedTable.js +1 -36
- package/{README.md → dist/table/README.md} +3 -124
- package/dist/table/state/Actions.js +3 -15
- package/dist/table/state/Reducer.js +0 -10
- package/dist/wrapper/Wrapper.js +4 -2
- package/dist/wrapper/components/AddSelectedFiles/AddSelectedFilesController.js +1 -2
- package/dist/wrapper/components/AddSelectedFiles/AddSelectedFilesView.js +2 -0
- package/dist/wrapper/components/DownloadManifestBtn.js +21 -4
- package/dist/wrapper/components/ReduxAddFile.js +2 -0
- package/dist/wrapper/components/TooltipView.js +2 -0
- package/package.json +14 -6
- package/src/table/PaginatedTable.js +1 -42
- package/src/table/README.md +253 -0
- package/src/table/state/Actions.js +0 -12
- package/src/table/state/Reducer.js +0 -12
- package/src/wrapper/Wrapper.js +2 -0
- package/src/wrapper/components/AddSelectedFiles/AddSelectedFilesController.js +4 -2
- package/src/wrapper/components/AddSelectedFiles/AddSelectedFilesView.js +1 -0
- package/src/wrapper/components/DownloadManifestBtn.js +28 -3
- package/src/wrapper/components/ReduxAddFile.js +1 -0
- package/src/wrapper/components/TextFieldView.js +1 -0
- package/src/wrapper/components/TooltipView.js +1 -0
|
@@ -30,7 +30,6 @@ const AddSelectedFilesOrangeButton = useCallback(() => (
|
|
|
30
30
|
addFileQuery={GET_ALL_FILEIDS_CASESTAB_FOR_SELECT_ALL}
|
|
31
31
|
responseKeys={['caseOverview', 'files']}
|
|
32
32
|
classes={classes}
|
|
33
|
-
applyActiveFilter={true}
|
|
34
33
|
tooltipCofig={{
|
|
35
34
|
arrow: true,
|
|
36
35
|
clsName: 'addSelectedFileTooltip',
|
|
@@ -52,7 +51,6 @@ const AddSelectedFilesOrangeButton = useCallback(() => (
|
|
|
52
51
|
| classes | TRUE | provide class for toltips to override the style | tooltip: classes.customTooltip, arrow: classes.customArrow
|
|
53
52
|
| tooltipCofig | FALSE | displays tooltip if provided, configuration for arrow, clsName, icon, tooltipText | graphQL query |
|
|
54
53
|
| dataKey | TRUE | Attribute used for getting selected rows in a table | case_id, file_name or any other column with distinct values |
|
|
55
|
-
| applyActiveFilter | FALSE | Only adds files of selected case or sample based on active filter | Bool |
|
|
56
54
|
|
|
57
55
|
|
|
58
56
|
### 3 Configure Add_All_Button Or BLUE Button in Dashboard
|
|
@@ -97,9 +97,7 @@ const PaginatedTable = _ref => {
|
|
|
97
97
|
customizeSortByColumn,
|
|
98
98
|
customizeChangePage,
|
|
99
99
|
customizeChangeRowsPerPage,
|
|
100
|
-
customizeColumnViewChange
|
|
101
|
-
customizeDeleteRow,
|
|
102
|
-
customizeDeleteAllRows
|
|
100
|
+
customizeColumnViewChange
|
|
103
101
|
} = paginationOptions;
|
|
104
102
|
|
|
105
103
|
/**
|
|
@@ -159,35 +157,6 @@ const PaginatedTable = _ref => {
|
|
|
159
157
|
columns
|
|
160
158
|
})));
|
|
161
159
|
};
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* handle delete row from table
|
|
165
|
-
* remove selected rows
|
|
166
|
-
*/
|
|
167
|
-
const onDeleteRow = row => {
|
|
168
|
-
const delId = row[table.dataKey];
|
|
169
|
-
const selectedIds = table.selectedRows.reduce((acc, id) => {
|
|
170
|
-
if (delId !== id) {
|
|
171
|
-
acc.push(id);
|
|
172
|
-
}
|
|
173
|
-
return acc;
|
|
174
|
-
}, []);
|
|
175
|
-
dispatch((0, _Actions.onRowDelete)({
|
|
176
|
-
deletedRow: delId,
|
|
177
|
-
selectedRows: selectedIds
|
|
178
|
-
}));
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* clear selected rows when all files are removed from myCart/ My file
|
|
183
|
-
*/
|
|
184
|
-
const onDeleteAllRows = () => {
|
|
185
|
-
dispatch((0, _Actions.onClearCart)({
|
|
186
|
-
deletedRows: table.selectedRows,
|
|
187
|
-
selectedRows: []
|
|
188
|
-
}));
|
|
189
|
-
};
|
|
190
|
-
|
|
191
160
|
/**
|
|
192
161
|
* A. client table
|
|
193
162
|
* table data provide by bento app (tblRows)
|
|
@@ -203,8 +172,6 @@ const PaginatedTable = _ref => {
|
|
|
203
172
|
onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
|
|
204
173
|
onSortByColumn: customizeSortByColumn || handleSortByColumn,
|
|
205
174
|
onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
|
|
206
|
-
onDeleteRow: customizeDeleteRow || onDeleteRow,
|
|
207
|
-
onDeleteAllFiles: customizeDeleteAllRows || onDeleteAllRows,
|
|
208
175
|
themeConfig: themeConfig
|
|
209
176
|
}));
|
|
210
177
|
}
|
|
@@ -230,8 +197,6 @@ const PaginatedTable = _ref => {
|
|
|
230
197
|
onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
|
|
231
198
|
onSortByColumn: customizeSortByColumn || handleSortByColumn,
|
|
232
199
|
onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
|
|
233
|
-
onDeleteRow: customizeDeleteRow || onDeleteRow,
|
|
234
|
-
onDeleteAllFiles: customizeDeleteAllRows || onDeleteAllRows,
|
|
235
200
|
themeConfig: themeConfig
|
|
236
201
|
}));
|
|
237
202
|
};
|
|
@@ -13,67 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
### Generate and integrate redux dispatch actions
|
|
15
15
|
```
|
|
16
|
-
const config = {
|
|
17
|
-
title: 'program',
|
|
18
|
-
dataField: 'studiesByProgram',
|
|
19
|
-
extendedViewConfig: { // display download button and manage view column
|
|
20
|
-
download: {
|
|
21
|
-
downloadFileName: 'ICDC_Studies_download',
|
|
22
|
-
downloadCsv: 'Download Table Contents As CSV',
|
|
23
|
-
},
|
|
24
|
-
manageViewColumns: {
|
|
25
|
-
title: 'View Columns',
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
columns: [
|
|
29
|
-
{
|
|
30
|
-
cellType: cellTypes.CHECKBOX,
|
|
31
|
-
display: true,
|
|
32
|
-
role: cellTypes.CHECKBOX,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
dataField: 'program_id',
|
|
36
|
-
header: 'Program',
|
|
37
|
-
cellType: cellTypes.LINK,
|
|
38
|
-
linkAttr: {
|
|
39
|
-
rootPath: '/program',
|
|
40
|
-
pathParams: ['program_id'],
|
|
41
|
-
},
|
|
42
|
-
role: cellTypes.DISPLAY,
|
|
43
|
-
display: true,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
dataField: 'clinical_study_name',
|
|
47
|
-
header: 'Study Name',
|
|
48
|
-
display: true,
|
|
49
|
-
tooltipText: 'sort',
|
|
50
|
-
role: cellTypes.DISPLAY, // to display column in managecolumn view
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
dataField: 'numberOfStudyFiles',
|
|
54
|
-
header: 'Study File(s)',
|
|
55
|
-
display: true,
|
|
56
|
-
columnDefaultValues: {
|
|
57
|
-
'0': 'Not Applicable', // replaces 0 with other text value in a column
|
|
58
|
-
},
|
|
59
|
-
role: cellTypes.DISPLAY,
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
columnGroups: {
|
|
63
|
-
{
|
|
64
|
-
clsName: 'col_group_1',
|
|
65
|
-
title: 'column group title',
|
|
66
|
-
columnIndexes: [startColIndex, endColIndex],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
clsName: 'col_group_2',
|
|
70
|
-
title: 'column group title',
|
|
71
|
-
customViewRender: () => <h2>'custom Text'</h2>, // customize element (takes priority over title)
|
|
72
|
-
columnIndexes: [startColIndex, endColIndex],
|
|
73
|
-
},
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
16
|
const initTblState = (initailState) => ({
|
|
78
17
|
...initailState,
|
|
79
18
|
title: config.name,
|
|
@@ -86,7 +25,6 @@ const initTblState = (initailState) => ({
|
|
|
86
25
|
paginationAPIField: config.paginationAPIField,
|
|
87
26
|
sortBy: config.defaultSortField,
|
|
88
27
|
sortOrder: config.defaultSortDirection,
|
|
89
|
-
columnGroups: config.columnGroups
|
|
90
28
|
rowsPerPage: 10,
|
|
91
29
|
page: 0,
|
|
92
30
|
});
|
|
@@ -107,9 +45,7 @@ const initTblState = (initailState) => ({
|
|
|
107
45
|
| sortOrder | FALSE | default sort column 'ASC' | ```defaultSortDirection: 'asc',```|
|
|
108
46
|
| rowsPerPage | FALSE | default 10 | |
|
|
109
47
|
| page | FALSE | 0 | |
|
|
110
|
-
| extendedViewConfig | FALSE | extended view of table header component | refer bento-frontend
|
|
111
|
-
| ColumnGroups | FALSE | ColumnGrouping Component | refer bento-icdc-frontend tabContainers, StudiesData.js |
|
|
112
|
-
|
|
48
|
+
| extendedViewConfig | FALSE | extended view of table header component | refer bento-frontend tabContainers, dashboardTabData.js |
|
|
113
49
|
|
|
114
50
|
|
|
115
51
|
### 2 Importing Component and Configuration
|
|
@@ -189,14 +125,13 @@ const initTblState = (initailState) => ({
|
|
|
189
125
|
sortBy: config.defaultSortField,
|
|
190
126
|
sortOrder: config.defaultSortDirection,
|
|
191
127
|
extendedViewConfig: config.extendedViewConfig,
|
|
192
|
-
columnGroups: config.columnGroups,
|
|
193
128
|
rowsPerPage: 10,
|
|
194
129
|
page: 0,
|
|
195
130
|
});
|
|
196
131
|
|
|
197
132
|
<TableContextProvider>
|
|
198
133
|
<Wrapper
|
|
199
|
-
wrapConfig={configWrapper(
|
|
134
|
+
wrapConfig={configWrapper(config, wrapperConfig)}
|
|
200
135
|
customTheme={customTheme}
|
|
201
136
|
classes={classes}
|
|
202
137
|
section={config.name}
|
|
@@ -209,7 +144,6 @@ const initTblState = (initailState) => ({
|
|
|
209
144
|
queryVariables={activeFilters}
|
|
210
145
|
totalRowCount={dashboardStats[config.count]}
|
|
211
146
|
activeTab={activeTab}
|
|
212
|
-
paginationOptions={paginationOptions}
|
|
213
147
|
/>
|
|
214
148
|
</Grid>
|
|
215
149
|
</Grid>
|
|
@@ -238,7 +172,7 @@ Wrapper component around table compnent.
|
|
|
238
172
|
* Configuration display component based on index
|
|
239
173
|
* CAUTION: If table is in wrapper component provide position of table component
|
|
240
174
|
*/
|
|
241
|
-
export const
|
|
175
|
+
export const wrapperConfig = [{
|
|
242
176
|
container: 'buttons',
|
|
243
177
|
size: 'xl',
|
|
244
178
|
clsName: 'container_header',
|
|
@@ -317,58 +251,3 @@ headerConfig - upper component on the table
|
|
|
317
251
|
| tooltipCofig | FALSE | appears on side of the refers button | dashboardTabData/ tooltipContent |
|
|
318
252
|
|
|
319
253
|
|
|
320
|
-
####
|
|
321
|
-
|
|
322
|
-
## 5 Pagination Configuration:
|
|
323
|
-
|
|
324
|
-
```
|
|
325
|
-
import {
|
|
326
|
-
TableContext,
|
|
327
|
-
onColumnViewChange, // dispact action
|
|
328
|
-
onColumnSort, // dispact action
|
|
329
|
-
onChangeSortDirection, // dispact action
|
|
330
|
-
onRowsPerPageChange, // dispact action
|
|
331
|
-
onPageAndTotalCountChange, // dispact action
|
|
332
|
-
onPageChange, // dispact action
|
|
333
|
-
onRowSeclect, // dispact action
|
|
334
|
-
setTotalRowCount, // dispact action
|
|
335
|
-
customPaginationAction, // dispact action
|
|
336
|
-
} from '@bento-core/paginated-table';
|
|
337
|
-
|
|
338
|
-
const tableContext = useContext(TableContext);
|
|
339
|
-
const { context } = tableContext;
|
|
340
|
-
const { dispatch } = context;
|
|
341
|
-
|
|
342
|
-
const paginationOptions = {
|
|
343
|
-
customizeOnRowSelect: (event, row) => {
|
|
344
|
-
const payload = {
|
|
345
|
-
page: 2,
|
|
346
|
-
rowPerPage: 10,
|
|
347
|
-
...
|
|
348
|
-
};
|
|
349
|
-
// updates table state,
|
|
350
|
-
dispatch(customPaginationAction(payload));
|
|
351
|
-
},
|
|
352
|
-
customizeToggleSelectAll: (event, Ids, includeIds) => {}, // Ids - selected ids
|
|
353
|
-
customizeSortByColumn: (column, order) => {},
|
|
354
|
-
customizeChangePage: (event, newPage) => {},
|
|
355
|
-
customizeChangeRowsPerPage: (event) => {},
|
|
356
|
-
customizeColumnViewChange: (column) => {},
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
<TableView
|
|
360
|
-
initState={initTblState}
|
|
361
|
-
themeConfig={themeConfig}
|
|
362
|
-
queryVariables={activeFilters}
|
|
363
|
-
totalRowCount={dashboardStats[config.count]}
|
|
364
|
-
activeTab={activeTab}
|
|
365
|
-
paginationOptions={paginationOptions}
|
|
366
|
-
/>
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
***More reference***
|
|
370
|
-
```
|
|
371
|
-
https://github.com/CBIIT/bento-icdc-frontend/tree/Bento-4.0/src/components/PaginatedTable
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
**Code for table view under bento-core/table - please refer to source code for more information**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSeclect = exports.
|
|
6
|
+
exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSeclect = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onChangeSortDirection = exports.customPaginationAction = exports.actionTypes = void 0;
|
|
7
7
|
const actionTypes = {
|
|
8
8
|
VIEW_COLUMN_CHANGE: 'VIEW_COLUMN_CHANGE',
|
|
9
9
|
ON_COLUMN_SORT: 'ON_COLUMN_SORT',
|
|
@@ -13,9 +13,7 @@ const actionTypes = {
|
|
|
13
13
|
ON_ROW_SELECT: 'ON_ROW_SELECT',
|
|
14
14
|
SET_TOTAL_ROW_COUNT: 'SET_TOTAL_ROW_COUNT',
|
|
15
15
|
ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE',
|
|
16
|
-
CUSTOMIZE_PAGINATION_ACTION: 'CUSTOMIZE_PAGINATION_ACTION'
|
|
17
|
-
ON_ROWS_DELETE: 'ON_ROWS_DELETE',
|
|
18
|
-
ON_ROW_DELETE: 'ON_ROW_DELETE'
|
|
16
|
+
CUSTOMIZE_PAGINATION_ACTION: 'CUSTOMIZE_PAGINATION_ACTION'
|
|
19
17
|
};
|
|
20
18
|
exports.actionTypes = actionTypes;
|
|
21
19
|
const onColumnViewChange = columns => ({
|
|
@@ -62,14 +60,4 @@ const customPaginationAction = value => ({
|
|
|
62
60
|
type: actionTypes.CUSTOMIZE_PAGINATION_ACTION,
|
|
63
61
|
payload: value
|
|
64
62
|
});
|
|
65
|
-
exports.customPaginationAction = customPaginationAction;
|
|
66
|
-
const onClearCart = value => ({
|
|
67
|
-
type: actionTypes.ON_ROWS_DELETE,
|
|
68
|
-
payload: value
|
|
69
|
-
});
|
|
70
|
-
exports.onClearCart = onClearCart;
|
|
71
|
-
const onRowDelete = value => ({
|
|
72
|
-
type: actionTypes.ON_ROW_DELETE,
|
|
73
|
-
payload: value
|
|
74
|
-
});
|
|
75
|
-
exports.onRowDelete = onRowDelete;
|
|
63
|
+
exports.customPaginationAction = customPaginationAction;
|
|
@@ -47,16 +47,6 @@ const reducer = (state, action) => {
|
|
|
47
47
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
48
48
|
totalRowCount: payload
|
|
49
49
|
});
|
|
50
|
-
case _Actions.actionTypes.ON_ROW_DELETE:
|
|
51
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
52
|
-
deletedRow: payload.deletedRow,
|
|
53
|
-
selectedRows: payload.selectedRows
|
|
54
|
-
});
|
|
55
|
-
case _Actions.actionTypes.ON_ROWS_DELETE:
|
|
56
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
57
|
-
deletedRows: payload.deleteRows,
|
|
58
|
-
selectedRows: payload.selectedRows
|
|
59
|
-
});
|
|
60
50
|
default:
|
|
61
51
|
return state;
|
|
62
52
|
}
|
package/dist/wrapper/Wrapper.js
CHANGED
|
@@ -152,7 +152,8 @@ const CustomWrapper = props => {
|
|
|
152
152
|
section,
|
|
153
153
|
classes,
|
|
154
154
|
activeFilters,
|
|
155
|
-
tblDispatch
|
|
155
|
+
tblDispatch,
|
|
156
|
+
totalRowCount
|
|
156
157
|
} = props;
|
|
157
158
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(CustomLayout, {
|
|
158
159
|
configs: wrapConfig,
|
|
@@ -160,7 +161,8 @@ const CustomWrapper = props => {
|
|
|
160
161
|
section: section,
|
|
161
162
|
classes: classes,
|
|
162
163
|
activeFilters: activeFilters,
|
|
163
|
-
tblDispatch: tblDispatch
|
|
164
|
+
tblDispatch: tblDispatch,
|
|
165
|
+
totalRowCount: totalRowCount
|
|
164
166
|
}, children));
|
|
165
167
|
};
|
|
166
168
|
var _default = CustomWrapper;
|
|
@@ -45,13 +45,12 @@ const AddSelectedFilesController = props => {
|
|
|
45
45
|
selectedRows = [],
|
|
46
46
|
dispatch
|
|
47
47
|
} = context;
|
|
48
|
-
const activeFilterItems = applyActiveFilter ? activeFilters : {};
|
|
48
|
+
const activeFilterItems = applyActiveFilter ? _objectSpread({}, activeFilters) : {};
|
|
49
49
|
const variables = _objectSpread(_objectSpread({
|
|
50
50
|
first: 10000
|
|
51
51
|
}, activeFilterItems), {}, {
|
|
52
52
|
[dataKey]: selectedRows
|
|
53
53
|
});
|
|
54
|
-
|
|
55
54
|
// add selected files id
|
|
56
55
|
const addSelectedFiles = () => {
|
|
57
56
|
const fileIds = (0, _WrapperService.getFilesID)({
|
|
@@ -8,6 +8,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _core = require("@material-ui/core");
|
|
9
9
|
var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
// eslint-disable-next-line import/no-unresolved
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* customize tooltips based on tooltipContent
|
|
13
15
|
* defined on dashboardTabData (tooltipContent)
|
|
@@ -21,8 +21,15 @@ const DownloadManifestView = props => {
|
|
|
21
21
|
const {
|
|
22
22
|
tooltipCofig,
|
|
23
23
|
clsName,
|
|
24
|
-
title
|
|
24
|
+
title,
|
|
25
|
+
totalRowCount
|
|
25
26
|
} = props;
|
|
27
|
+
const {
|
|
28
|
+
icon,
|
|
29
|
+
alt,
|
|
30
|
+
arrow = false,
|
|
31
|
+
clsName: toolTipClsName
|
|
32
|
+
} = tooltipCofig;
|
|
26
33
|
/**
|
|
27
34
|
* get cart state
|
|
28
35
|
*/
|
|
@@ -48,7 +55,7 @@ const DownloadManifestView = props => {
|
|
|
48
55
|
const fetchResult = await client.query({
|
|
49
56
|
query: table.api,
|
|
50
57
|
variables: _objectSpread({}, getQueryVeriables(queryVariables))
|
|
51
|
-
}).then(result => result.data.filesInList);
|
|
58
|
+
}).then(result => table.objectKey ? result.data[table.objectKey] : result.data.filesInList);
|
|
52
59
|
return fetchResult;
|
|
53
60
|
}
|
|
54
61
|
async function DocumentDownload() {
|
|
@@ -67,8 +74,18 @@ const DownloadManifestView = props => {
|
|
|
67
74
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
68
75
|
className: clsName,
|
|
69
76
|
disableRipple: true,
|
|
70
|
-
onClick: () => DocumentDownload()
|
|
71
|
-
|
|
77
|
+
onClick: () => DocumentDownload(),
|
|
78
|
+
disabled: totalRowCount === 0
|
|
79
|
+
}, title), tooltipCofig && !tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), tooltipCofig && tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
80
|
+
arrow: arrow,
|
|
81
|
+
interactive: true,
|
|
82
|
+
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipCofig.customToolTipComponent),
|
|
83
|
+
placement: "bottom"
|
|
84
|
+
}, icon && /*#__PURE__*/_react.default.createElement("img", {
|
|
85
|
+
src: icon,
|
|
86
|
+
alt: alt,
|
|
87
|
+
className: toolTipClsName
|
|
88
|
+
})));
|
|
72
89
|
};
|
|
73
90
|
var _default = DownloadManifestView;
|
|
74
91
|
exports.default = _default;
|
|
@@ -9,6 +9,8 @@ var _reactRedux = require("react-redux");
|
|
|
9
9
|
var _cart = require("@bento-core/cart");
|
|
10
10
|
var _AddFiles = _interopRequireDefault(require("./AddFiles"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
// eslint-disable-next-line import/no-unresolved
|
|
13
|
+
|
|
12
14
|
const AddFilesRedux = props => /*#__PURE__*/_react.default.createElement(_AddFiles.default, props);
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
// eslint-disable-next-line import/no-unresolved
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* customize tooltips based on tooltipContent
|
|
12
14
|
* defined on dashboardTabData (tooltipContent)
|
package/package.json
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/paginated-table",
|
|
3
|
-
"version": "1.0.1-
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.0.1-ins.0",
|
|
5
4
|
"main": "dist/index.js",
|
|
6
5
|
"scripts": {
|
|
7
6
|
"build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
|
8
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
8
|
"lint": "eslint src"
|
|
10
9
|
},
|
|
11
|
-
"repository":
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/CBIIT/bento-frontend.git"
|
|
13
|
+
},
|
|
12
14
|
"publishConfig": {
|
|
13
15
|
"access": "public"
|
|
14
16
|
},
|
|
15
17
|
"dependencies": {
|
|
16
18
|
"@bento-core/cart": "^1.0.0",
|
|
17
|
-
"@bento-core/table": "1.0.1-
|
|
19
|
+
"@bento-core/table": "1.0.1-ins.0",
|
|
18
20
|
"@bento-core/tool-tip": "^1.0.0",
|
|
19
|
-
"@bento-core/util": "
|
|
21
|
+
"@bento-core/util": "1.0.1-ins.0"
|
|
20
22
|
},
|
|
21
23
|
"peerDependencies": {
|
|
22
24
|
"@apollo/client": "^3.6.9",
|
|
@@ -27,5 +29,11 @@
|
|
|
27
29
|
"react-redux": "^7.2.1"
|
|
28
30
|
},
|
|
29
31
|
"author": "CTOS Bento Team",
|
|
30
|
-
"license": "ISC"
|
|
32
|
+
"license": "ISC",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/CBIIT/bento-frontend/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/CBIIT/bento-frontend#readme",
|
|
37
|
+
"devDependencies": {},
|
|
38
|
+
"description": ""
|
|
31
39
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useContext,
|
|
3
|
-
useEffect,
|
|
4
|
-
useReducer,
|
|
5
|
-
} from 'react';
|
|
1
|
+
import React, { useContext, useEffect, useReducer } from 'react';
|
|
6
2
|
import ServerTableView from './ServerController';
|
|
7
3
|
import ClientTableView from './ClientController';
|
|
8
4
|
import {
|
|
@@ -13,8 +9,6 @@ import {
|
|
|
13
9
|
onColumnSort,
|
|
14
10
|
onPageAndTotalCountChange,
|
|
15
11
|
onColumnViewChange,
|
|
16
|
-
onRowDelete,
|
|
17
|
-
onClearCart,
|
|
18
12
|
} from './state/Actions';
|
|
19
13
|
import { TableContext } from './ContextProvider';
|
|
20
14
|
import reducer from './state/Reducer';
|
|
@@ -89,8 +83,6 @@ const PaginatedTable = ({
|
|
|
89
83
|
customizeChangePage,
|
|
90
84
|
customizeChangeRowsPerPage,
|
|
91
85
|
customizeColumnViewChange,
|
|
92
|
-
customizeDeleteRow,
|
|
93
|
-
customizeDeleteAllRows,
|
|
94
86
|
} = paginationOptions;
|
|
95
87
|
|
|
96
88
|
/**
|
|
@@ -148,35 +140,6 @@ const PaginatedTable = ({
|
|
|
148
140
|
columns,
|
|
149
141
|
}));
|
|
150
142
|
};
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* handle delete row from table
|
|
154
|
-
* remove selected rows
|
|
155
|
-
*/
|
|
156
|
-
const onDeleteRow = (row) => {
|
|
157
|
-
const delId = row[table.dataKey];
|
|
158
|
-
const selectedIds = table.selectedRows.reduce((acc, id) => {
|
|
159
|
-
if (delId !== id) {
|
|
160
|
-
acc.push(id);
|
|
161
|
-
}
|
|
162
|
-
return acc;
|
|
163
|
-
}, []);
|
|
164
|
-
dispatch(onRowDelete({
|
|
165
|
-
deletedRow: delId,
|
|
166
|
-
selectedRows: selectedIds,
|
|
167
|
-
}));
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* clear selected rows when all files are removed from myCart/ My file
|
|
172
|
-
*/
|
|
173
|
-
const onDeleteAllRows = () => {
|
|
174
|
-
dispatch(onClearCart({
|
|
175
|
-
deletedRows: table.selectedRows,
|
|
176
|
-
selectedRows: [],
|
|
177
|
-
}));
|
|
178
|
-
};
|
|
179
|
-
|
|
180
143
|
/**
|
|
181
144
|
* A. client table
|
|
182
145
|
* table data provide by bento app (tblRows)
|
|
@@ -194,8 +157,6 @@ const PaginatedTable = ({
|
|
|
194
157
|
onToggleSelectAll={customizeToggleSelectAll || handleToggleSelectAll}
|
|
195
158
|
onSortByColumn={customizeSortByColumn || handleSortByColumn}
|
|
196
159
|
onColumnViewChange={customizeColumnViewChange || handleColumnViewChange}
|
|
197
|
-
onDeleteRow={customizeDeleteRow || onDeleteRow}
|
|
198
|
-
onDeleteAllFiles={customizeDeleteAllRows || onDeleteAllRows}
|
|
199
160
|
themeConfig={themeConfig}
|
|
200
161
|
/>
|
|
201
162
|
</>
|
|
@@ -226,8 +187,6 @@ const PaginatedTable = ({
|
|
|
226
187
|
onToggleSelectAll={customizeToggleSelectAll || handleToggleSelectAll}
|
|
227
188
|
onSortByColumn={customizeSortByColumn || handleSortByColumn}
|
|
228
189
|
onColumnViewChange={customizeColumnViewChange || handleColumnViewChange}
|
|
229
|
-
onDeleteRow={customizeDeleteRow || onDeleteRow}
|
|
230
|
-
onDeleteAllFiles={customizeDeleteAllRows || onDeleteAllRows}
|
|
231
190
|
themeConfig={themeConfig}
|
|
232
191
|
/>
|
|
233
192
|
</>
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# PAGINATED TABLE COMPONENT DESIGN
|
|
2
|
+
|
|
3
|
+
### Bento core paginated table design:
|
|
4
|
+
|
|
5
|
+
* Use of UseReducer to track table state and local state to display dialog component
|
|
6
|
+
* use of useContext to access table state
|
|
7
|
+
* Limit use of props drilling
|
|
8
|
+
* Core layout defined by Bento Core table component
|
|
9
|
+
* Build on top of Mui table (demo - https://mui.com/material-ui/react-table/#custom-pagination-actions)
|
|
10
|
+
* Apply SOLID principles in react (https://konstantinlebedev.com/solid-in-react/)
|
|
11
|
+
|
|
12
|
+
## 1 UseReducer configuration
|
|
13
|
+
|
|
14
|
+
### Generate and integrate redux dispatch actions
|
|
15
|
+
```
|
|
16
|
+
const initTblState = (initailState) => ({
|
|
17
|
+
...initailState,
|
|
18
|
+
title: config.name,
|
|
19
|
+
query: config.api,
|
|
20
|
+
dataKey: config.dataKey,
|
|
21
|
+
columns: configColumn(config.columns),
|
|
22
|
+
count: dashboardStats[config.count],
|
|
23
|
+
selectedRows: [],
|
|
24
|
+
tableMsg: config.tableMsg,
|
|
25
|
+
paginationAPIField: config.paginationAPIField,
|
|
26
|
+
sortBy: config.defaultSortField,
|
|
27
|
+
sortOrder: config.defaultSortDirection,
|
|
28
|
+
rowsPerPage: 10,
|
|
29
|
+
page: 0,
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
**Paginated Table Init State TABLE-1**
|
|
33
|
+
| Table State | Required | description | Configuration |
|
|
34
|
+
| :--- | :----:| :----: | ----: |
|
|
35
|
+
| title | TRUE | table name (Case, Sample, Files), required for class name | |
|
|
36
|
+
| query | TRUE | GraphQL Query for paginated Table (e.g. GET_CASES_OVERVIEW_QUERY) | api |
|
|
37
|
+
| dataKey | TRUE | Tracking selected rows (case - dataKey: 'subject_id') | dashboardTabData/tabContainers |
|
|
38
|
+
| columns | TRUE | columns defined by dashboardTabData (tabContainers) | add fucntion attribut customCellRender/customColHeaderRender to configure custom cell (see bento frontend) |
|
|
39
|
+
| count | TRUE | Total row cound for (Cases, Samples, Files), update based on filter event | |
|
|
40
|
+
| selectedRows | TRUE | Tracks selected Rows | |
|
|
41
|
+
| tableMsg | TRUE | Display noMatch Msg | dashboardTabData/tabContainers/tableMsg |
|
|
42
|
+
| theme | FALSE | override style with themeprovider use ClassName provided by bento-core table to apply style (refer to class name table) | |
|
|
43
|
+
| paginationAPIField | TRUE | Access http response data - defined by dashboardTabData (tabContainers) | ```paginationAPIField: 'subjectOverview'```|
|
|
44
|
+
| sortBy | TRUE | default sort column | defaultSortField: 'subject_id',|
|
|
45
|
+
| sortOrder | FALSE | default sort column 'ASC' | ```defaultSortDirection: 'asc',```|
|
|
46
|
+
| rowsPerPage | FALSE | default 10 | |
|
|
47
|
+
| page | FALSE | 0 | |
|
|
48
|
+
| extendedViewConfig | FALSE | extended view of table header component | refer bento-frontend tabContainers, dashboardTabData.js |
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### 2 Importing Component and Configuration
|
|
52
|
+
```
|
|
53
|
+
import TableView from 'bento-core/PaginationTable/PaginatedTable';
|
|
54
|
+
// active filter json structure
|
|
55
|
+
<TableView
|
|
56
|
+
initState={initTblState}
|
|
57
|
+
themeConfig={themeConfig}
|
|
58
|
+
activeFilters={activeFilters}
|
|
59
|
+
totalRowCount={dashboardStats[config.count]}
|
|
60
|
+
activeTab={activeTab}
|
|
61
|
+
/>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Paginated Table Props Config TABLE-2**
|
|
65
|
+
| Table | Required | description | Configuration |
|
|
66
|
+
| :--- | :----:| :----: | ----: |
|
|
67
|
+
| table state | TRUE | as describe on TABLE-1 | |
|
|
68
|
+
| viewConfig | FALSE | (Optional) table view config, set hide/diaply pagination above table header | |
|
|
69
|
+
| themeConfig | FALSE | override style with themeprovider use ClassName provided by bento-core table to apply style (refer to class name table) | |
|
|
70
|
+
| totalRowCount | TRUE | Total row cound for (Cases, Samples, Files), update based on filter event | |
|
|
71
|
+
| activeTab | TRUE | prevents http call for inactive tabs (dashboard) /set true to myFile cart | |
|
|
72
|
+
|
|
73
|
+
## 3 Table component themeConfig Configuration
|
|
74
|
+
```
|
|
75
|
+
export const tblHeader = {
|
|
76
|
+
MuiTableSortLabel: {
|
|
77
|
+
root: {
|
|
78
|
+
...define style
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const tblPgn = {
|
|
84
|
+
MuiTablePagination: {
|
|
85
|
+
root: {
|
|
86
|
+
paddingRight: '50px',
|
|
87
|
+
borderTop: '5px solid #e7e5e5',
|
|
88
|
+
borderBottom: '3px solid #e7e5e5',
|
|
89
|
+
},
|
|
90
|
+
toolbar: {
|
|
91
|
+
minHeight: '45px',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
// define mui styles for table component
|
|
96
|
+
export const themeConfig = {
|
|
97
|
+
tblHeader,
|
|
98
|
+
tblTopPgn,
|
|
99
|
+
tblPgn,
|
|
100
|
+
tblBody,
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## 3 Table state Context provider Configuration
|
|
105
|
+
```
|
|
106
|
+
Reference - TabPanel.js (bento-frontend)
|
|
107
|
+
|
|
108
|
+
import {
|
|
109
|
+
TableContextProvider,
|
|
110
|
+
TableView,
|
|
111
|
+
Wrapper,
|
|
112
|
+
} from '@bento-core/paginated-table';
|
|
113
|
+
|
|
114
|
+
const initTblState = (initailState) => ({
|
|
115
|
+
...initailState,
|
|
116
|
+
title: config.name,
|
|
117
|
+
query: config.api,
|
|
118
|
+
paginationAPIField: config.paginationAPIField,
|
|
119
|
+
dataKey: config.dataKey,
|
|
120
|
+
columns: configColumn(config.columns),
|
|
121
|
+
count: dashboardStats[config.count],
|
|
122
|
+
selectedRows: [],
|
|
123
|
+
enableRowSelection: config.enableRowSelection,
|
|
124
|
+
tableMsg: config.tableMsg,
|
|
125
|
+
sortBy: config.defaultSortField,
|
|
126
|
+
sortOrder: config.defaultSortDirection,
|
|
127
|
+
extendedViewConfig: config.extendedViewConfig,
|
|
128
|
+
rowsPerPage: 10,
|
|
129
|
+
page: 0,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
<TableContextProvider>
|
|
133
|
+
<Wrapper
|
|
134
|
+
wrapConfig={configWrapper(config, wrapperConfig)}
|
|
135
|
+
customTheme={customTheme}
|
|
136
|
+
classes={classes}
|
|
137
|
+
section={config.name}
|
|
138
|
+
>
|
|
139
|
+
<Grid container>
|
|
140
|
+
<Grid item xs={12} id={config.tableID}>
|
|
141
|
+
<TableView
|
|
142
|
+
initState={initTblState}
|
|
143
|
+
themeConfig={themeConfig}
|
|
144
|
+
queryVariables={activeFilters}
|
|
145
|
+
totalRowCount={dashboardStats[config.count]}
|
|
146
|
+
activeTab={activeTab}
|
|
147
|
+
/>
|
|
148
|
+
</Grid>
|
|
149
|
+
</Grid>
|
|
150
|
+
</Wrapper>
|
|
151
|
+
</TableContextProvider>
|
|
152
|
+
|
|
153
|
+
//child component
|
|
154
|
+
|
|
155
|
+
import { TableContext } from 'bento-core';
|
|
156
|
+
|
|
157
|
+
const tableContext = useContext(TableContext);
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
TableContextProvider provides table state to Wrapper Component or it can be used in higher parent component as needed.
|
|
161
|
+
|
|
162
|
+
####
|
|
163
|
+
|
|
164
|
+
## 4 Wrapper Configuration:
|
|
165
|
+
Wrapper component around table compnent.
|
|
166
|
+
1. ADD ALL FILES button
|
|
167
|
+
2. ADD SELECTED ROWS button
|
|
168
|
+
3. Go to My File link
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
/**
|
|
172
|
+
* Configuration display component based on index
|
|
173
|
+
* CAUTION: If table is in wrapper component provide position of table component
|
|
174
|
+
*/
|
|
175
|
+
export const wrapperConfig = [{
|
|
176
|
+
container: 'buttons',
|
|
177
|
+
size: 'xl',
|
|
178
|
+
clsName: 'container_header',
|
|
179
|
+
items: [
|
|
180
|
+
{
|
|
181
|
+
title: 'ADD ALL FILES',
|
|
182
|
+
clsName: 'add_all_button',
|
|
183
|
+
type: types.BUTTON,
|
|
184
|
+
role: btnTypes.ADD_ALL_FILES,
|
|
185
|
+
btnType: btnTypes.ADD_ALL_FILES,
|
|
186
|
+
conditional: false,
|
|
187
|
+
alertMessage,
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
title: 'ADD SELECTED FILES',
|
|
191
|
+
clsName: 'add_selected_button',
|
|
192
|
+
type: types.BUTTON,
|
|
193
|
+
role: btnTypes.ADD_SELECTED_FILES,
|
|
194
|
+
btnType: btnTypes.ADD_SELECTED_FILES,
|
|
195
|
+
tooltipCofig: tooltipContent,
|
|
196
|
+
conditional: true,
|
|
197
|
+
}],
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
container: 'paginatedTable',
|
|
201
|
+
paginatedTable: true,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
container: 'buttons',
|
|
205
|
+
size: 'xl',
|
|
206
|
+
clsName: 'container_footer',
|
|
207
|
+
items: [
|
|
208
|
+
{
|
|
209
|
+
title: 'ADD SELECTED FILES',
|
|
210
|
+
clsName: 'add_selected_button',
|
|
211
|
+
type: types.BUTTON,
|
|
212
|
+
role: btnTypes.ADD_SELECTED_FILES,
|
|
213
|
+
btnType: btnTypes.ADD_SELECTED_FILES,
|
|
214
|
+
tooltipCofig: tooltipContent,
|
|
215
|
+
conditional: true,
|
|
216
|
+
}],
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
container: 'buttons',
|
|
220
|
+
size: 'xl',
|
|
221
|
+
clsName: 'container_footer_link',
|
|
222
|
+
items: [
|
|
223
|
+
{
|
|
224
|
+
title: 'Go to Cart >',
|
|
225
|
+
clsName: 'go_to_cart',
|
|
226
|
+
url: '#/fileCentricCart',
|
|
227
|
+
type: types.LINK,
|
|
228
|
+
}],
|
|
229
|
+
},
|
|
230
|
+
];
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Each item in headerConfig and footerConfig represent container
|
|
234
|
+
**container Config TABLE-3**
|
|
235
|
+
headerConfig - upper component on the table
|
|
236
|
+
footerConfig - button component on the table
|
|
237
|
+
| Attris | Required | description | Configuration |
|
|
238
|
+
| :--- | :----:| :----: | ----: |
|
|
239
|
+
| container | TRUE | describe container | |
|
|
240
|
+
| size | TRUE | container size | xl, md, sm |
|
|
241
|
+
| clsName | TRUE | class name to apply style using themeprovider | |
|
|
242
|
+
| item | TRUE | number of button component ***(refer to table 4)*** | |
|
|
243
|
+
|
|
244
|
+
**Button component Config TABLE-4**
|
|
245
|
+
headerConfig - upper component on the table
|
|
246
|
+
| Attris | Required | description | Configuration |
|
|
247
|
+
| :--- | :----:| :----: | ----: |
|
|
248
|
+
| title | TRUE | button label | 'ADD SELECTED FILES' |
|
|
249
|
+
| clsName | TRUE | class name to apply style using themeprovider | |
|
|
250
|
+
| type | TRUE | add all files or add selected files| btnTypes.ADD_SELECTED_FILES |
|
|
251
|
+
| tooltipCofig | FALSE | appears on side of the refers button | dashboardTabData/ tooltipContent |
|
|
252
|
+
|
|
253
|
+
|
|
@@ -8,8 +8,6 @@ export const actionTypes = {
|
|
|
8
8
|
SET_TOTAL_ROW_COUNT: 'SET_TOTAL_ROW_COUNT',
|
|
9
9
|
ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE',
|
|
10
10
|
CUSTOMIZE_PAGINATION_ACTION: 'CUSTOMIZE_PAGINATION_ACTION',
|
|
11
|
-
ON_ROWS_DELETE: 'ON_ROWS_DELETE',
|
|
12
|
-
ON_ROW_DELETE: 'ON_ROW_DELETE',
|
|
13
11
|
};
|
|
14
12
|
|
|
15
13
|
export const onColumnViewChange = (columns) => ({
|
|
@@ -56,13 +54,3 @@ export const customPaginationAction = (value) => ({
|
|
|
56
54
|
type: actionTypes.CUSTOMIZE_PAGINATION_ACTION,
|
|
57
55
|
payload: value,
|
|
58
56
|
});
|
|
59
|
-
|
|
60
|
-
export const onClearCart = (value) => ({
|
|
61
|
-
type: actionTypes.ON_ROWS_DELETE,
|
|
62
|
-
payload: value,
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
export const onRowDelete = (value) => ({
|
|
66
|
-
type: actionTypes.ON_ROW_DELETE,
|
|
67
|
-
payload: value,
|
|
68
|
-
});
|
|
@@ -46,18 +46,6 @@ const reducer = (state, action) => {
|
|
|
46
46
|
...state,
|
|
47
47
|
totalRowCount: payload,
|
|
48
48
|
};
|
|
49
|
-
case actionTypes.ON_ROW_DELETE:
|
|
50
|
-
return {
|
|
51
|
-
...state,
|
|
52
|
-
deletedRow: payload.deletedRow,
|
|
53
|
-
selectedRows: payload.selectedRows,
|
|
54
|
-
};
|
|
55
|
-
case actionTypes.ON_ROWS_DELETE:
|
|
56
|
-
return {
|
|
57
|
-
...state,
|
|
58
|
-
deletedRows: payload.deleteRows,
|
|
59
|
-
selectedRows: payload.selectedRows,
|
|
60
|
-
};
|
|
61
49
|
default:
|
|
62
50
|
return state;
|
|
63
51
|
}
|
package/src/wrapper/Wrapper.js
CHANGED
|
@@ -150,6 +150,7 @@ const CustomWrapper = (props) => {
|
|
|
150
150
|
classes,
|
|
151
151
|
activeFilters,
|
|
152
152
|
tblDispatch,
|
|
153
|
+
totalRowCount,
|
|
153
154
|
} = props;
|
|
154
155
|
return (
|
|
155
156
|
<>
|
|
@@ -160,6 +161,7 @@ const CustomWrapper = (props) => {
|
|
|
160
161
|
classes={classes}
|
|
161
162
|
activeFilters={activeFilters}
|
|
162
163
|
tblDispatch={tblDispatch}
|
|
164
|
+
totalRowCount={totalRowCount}
|
|
163
165
|
>
|
|
164
166
|
{children}
|
|
165
167
|
</CustomLayout>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { connect } from 'react-redux';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
+
// eslint-disable-next-line import/no-unresolved
|
|
4
5
|
import { onAddCartFiles } from '@bento-core/cart';
|
|
5
6
|
import { TableContext } from '../../../table/ContextProvider';
|
|
6
7
|
import { onRowSeclect } from '../../../table/state/Actions';
|
|
@@ -31,14 +32,15 @@ const AddSelectedFilesController = (props) => {
|
|
|
31
32
|
dispatch,
|
|
32
33
|
} = context;
|
|
33
34
|
|
|
34
|
-
const activeFilterItems = applyActiveFilter ?
|
|
35
|
+
const activeFilterItems = applyActiveFilter ? {
|
|
36
|
+
...activeFilters,
|
|
37
|
+
} : {};
|
|
35
38
|
|
|
36
39
|
const variables = {
|
|
37
40
|
first: 10000,
|
|
38
41
|
...activeFilterItems,
|
|
39
42
|
[dataKey]: selectedRows,
|
|
40
43
|
};
|
|
41
|
-
|
|
42
44
|
// add selected files id
|
|
43
45
|
const addSelectedFiles = () => {
|
|
44
46
|
const fileIds = getFilesID({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { Button } from '@material-ui/core';
|
|
2
|
+
import { Button, Tooltip } from '@material-ui/core';
|
|
3
3
|
import { useApolloClient } from '@apollo/client';
|
|
4
4
|
import {
|
|
5
5
|
downloadJson,
|
|
6
6
|
CartContext,
|
|
7
|
+
// eslint-disable-next-line import/no-unresolved
|
|
7
8
|
} from '@bento-core/cart';
|
|
8
9
|
import ToolTipView from './TooltipView';
|
|
9
10
|
|
|
@@ -12,7 +13,15 @@ const DownloadManifestView = (props) => {
|
|
|
12
13
|
tooltipCofig,
|
|
13
14
|
clsName,
|
|
14
15
|
title,
|
|
16
|
+
totalRowCount,
|
|
15
17
|
} = props;
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
icon,
|
|
21
|
+
alt,
|
|
22
|
+
arrow = false,
|
|
23
|
+
clsName: toolTipClsName,
|
|
24
|
+
} = tooltipCofig;
|
|
16
25
|
/**
|
|
17
26
|
* get cart state
|
|
18
27
|
*/
|
|
@@ -38,7 +47,7 @@ const DownloadManifestView = (props) => {
|
|
|
38
47
|
...getQueryVeriables(queryVariables),
|
|
39
48
|
},
|
|
40
49
|
})
|
|
41
|
-
.then((result) => result.data.filesInList);
|
|
50
|
+
.then((result) => (table.objectKey ? result.data[table.objectKey] : result.data.filesInList));
|
|
42
51
|
return fetchResult;
|
|
43
52
|
}
|
|
44
53
|
|
|
@@ -54,10 +63,26 @@ const DownloadManifestView = (props) => {
|
|
|
54
63
|
className={clsName}
|
|
55
64
|
disableRipple
|
|
56
65
|
onClick={() => DocumentDownload()}
|
|
66
|
+
disabled={totalRowCount === 0}
|
|
57
67
|
>
|
|
58
68
|
{title}
|
|
59
69
|
</Button>
|
|
60
|
-
{tooltipCofig && (<ToolTipView {...props} />)}
|
|
70
|
+
{(tooltipCofig && !tooltipCofig.customToolTipComponent) && (<ToolTipView {...props} />)}
|
|
71
|
+
{(tooltipCofig && tooltipCofig.customToolTipComponent) && (
|
|
72
|
+
<Tooltip
|
|
73
|
+
arrow={arrow}
|
|
74
|
+
interactive
|
|
75
|
+
title={(
|
|
76
|
+
<>
|
|
77
|
+
{tooltipCofig.customToolTipComponent}
|
|
78
|
+
</>
|
|
79
|
+
)}
|
|
80
|
+
placement="bottom"
|
|
81
|
+
>
|
|
82
|
+
{icon && (<img src={icon} alt={alt} className={toolTipClsName} />)}
|
|
83
|
+
</Tooltip>
|
|
84
|
+
)}
|
|
85
|
+
|
|
61
86
|
</>
|
|
62
87
|
);
|
|
63
88
|
};
|