@bento-core/paginated-table 1.0.0-c3dc.26 → 1.0.0-c3dc.27
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/index.js +13 -0
- package/dist/table/ClientController.js +1 -0
- package/dist/table/PaginatedTable.js +65 -53
- package/dist/table/TableService.js +5 -2
- package/dist/table/state/Actions.js +18 -11
- package/dist/table/state/Reducer.js +10 -7
- package/dist/wrapper/Wrapper.js +8 -10
- package/dist/wrapper/WrapperService.js +1 -1
- package/dist/wrapper/components/AddAllFiles/AddAllView.js +47 -76
- package/dist/wrapper/components/AddFiles.js +3 -6
- package/dist/wrapper/components/AddSelectedFiles/AddSelectedFilesController.js +47 -36
- package/dist/wrapper/components/AddSelectedFiles/AddSelectedFilesView.js +29 -4
- package/dist/wrapper/components/AddToCartDialog/AddToCartDialogAlertView.js +0 -1
- package/dist/wrapper/components/AddToCartDialog/AddToCartDialogView.js +15 -5
- package/dist/wrapper/components/ButtonStyle.js +17 -0
- package/dist/wrapper/components/ButtonView.js +5 -3
- package/dist/wrapper/components/DownloadManifestBtn.js +19 -5
- package/dist/wrapper/components/ReduxAddFile.js +1 -2
- package/dist/wrapper/components/Snackbar/Snackbar.js +1 -1
- package/dist/wrapper/components/TextFieldView.js +3 -1
- package/dist/wrapper/components/util.js +33 -0
- package/package.json +2 -2
- package/dist/table/README.md +0 -253
- package/dist/wrapper/components/ReduxDownloadManifestBtn.js +0 -16
package/dist/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "ButtonView", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _ButtonView.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "TableContext", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
|
@@ -33,6 +39,12 @@ Object.defineProperty(exports, "btnTypes", {
|
|
|
33
39
|
return _AddFiles.btnTypes;
|
|
34
40
|
}
|
|
35
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "customPaginationAction", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _Actions.customPaginationAction;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
36
48
|
Object.defineProperty(exports, "getQueryVariables", {
|
|
37
49
|
enumerable: true,
|
|
38
50
|
get: function get() {
|
|
@@ -99,6 +111,7 @@ var _Actions = require("./table/state/Actions");
|
|
|
99
111
|
var _Wrapper = _interopRequireWildcard(require("./wrapper/Wrapper"));
|
|
100
112
|
var _AddFiles = require("./wrapper/components/AddFiles");
|
|
101
113
|
var _WrapperService = require("./wrapper/WrapperService");
|
|
114
|
+
var _ButtonView = _interopRequireDefault(require("./wrapper/components/ButtonView"));
|
|
102
115
|
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); }
|
|
103
116
|
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; }
|
|
104
117
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -57,6 +57,7 @@ const TableController = props => {
|
|
|
57
57
|
const endIndex = startIndex + rowsPerPage;
|
|
58
58
|
const displayRows = [...sortedRows].slice(startIndex, endIndex);
|
|
59
59
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_table.TableView, _extends({}, props, {
|
|
60
|
+
totalRows: tblRows,
|
|
60
61
|
tableRows: displayRows
|
|
61
62
|
})));
|
|
62
63
|
};
|
|
@@ -26,7 +26,8 @@ const PaginatedTable = _ref => {
|
|
|
26
26
|
initState,
|
|
27
27
|
activeTab = true,
|
|
28
28
|
server = true,
|
|
29
|
-
tblRows = []
|
|
29
|
+
tblRows = [],
|
|
30
|
+
paginationOptions = {}
|
|
30
31
|
} = _ref;
|
|
31
32
|
/**
|
|
32
33
|
* Initailize useReducer state
|
|
@@ -35,9 +36,6 @@ const PaginatedTable = _ref => {
|
|
|
35
36
|
* 3. Add all btn / Add file button also dispatch action to update table state
|
|
36
37
|
*/
|
|
37
38
|
const [table, dispatch] = (0, _react.useReducer)(_Reducer.default, {}, initState);
|
|
38
|
-
(0, _react.useEffect)(() => {
|
|
39
|
-
dispatch((0, _Actions.unselectAllRows)());
|
|
40
|
-
}, [queryVariables]);
|
|
41
39
|
|
|
42
40
|
/**
|
|
43
41
|
* use context to provide table state to wrapper component
|
|
@@ -92,6 +90,17 @@ const PaginatedTable = _ref => {
|
|
|
92
90
|
pageNumb: newPage
|
|
93
91
|
}));
|
|
94
92
|
};
|
|
93
|
+
// custonize pagination behavior
|
|
94
|
+
const {
|
|
95
|
+
customizeOnRowSelect,
|
|
96
|
+
customizeToggleSelectAll,
|
|
97
|
+
customizeSortByColumn,
|
|
98
|
+
customizeChangePage,
|
|
99
|
+
customizeChangeRowsPerPage,
|
|
100
|
+
customizeColumnViewChange,
|
|
101
|
+
customizeDeleteRow,
|
|
102
|
+
customizeDeleteAllRows
|
|
103
|
+
} = paginationOptions;
|
|
95
104
|
|
|
96
105
|
/**
|
|
97
106
|
* update selected Ids
|
|
@@ -101,19 +110,9 @@ const PaginatedTable = _ref => {
|
|
|
101
110
|
const onRowSelectHandler = (event, row) => {
|
|
102
111
|
event.stopPropagation();
|
|
103
112
|
let selectedIds = [...table.selectedRows];
|
|
104
|
-
let hiddenSelectedRows = [...table.hiddenSelectedRows];
|
|
105
113
|
const selectedId = row[table.dataKey];
|
|
106
|
-
let hiddenNewObject = {};
|
|
107
|
-
if (table.hiddenDataKeys && table.hiddenDataKeys.length > 0) {
|
|
108
|
-
table.hiddenDataKeys.forEach(dataK => {
|
|
109
|
-
hiddenNewObject = _objectSpread(_objectSpread({}, hiddenNewObject), {}, {
|
|
110
|
-
[dataK]: row[dataK]
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
114
|
if (!row.isChecked) {
|
|
115
115
|
selectedIds.push(selectedId);
|
|
116
|
-
hiddenSelectedRows.push(hiddenNewObject);
|
|
117
116
|
} else {
|
|
118
117
|
selectedIds = selectedIds.reduce((acc, id) => {
|
|
119
118
|
if (selectedId !== id) {
|
|
@@ -121,35 +120,10 @@ const PaginatedTable = _ref => {
|
|
|
121
120
|
}
|
|
122
121
|
return acc;
|
|
123
122
|
}, []);
|
|
124
|
-
hiddenSelectedRows = hiddenSelectedRows.reduce((acc, hiddenObject) => {
|
|
125
|
-
if (JSON.stringify(hiddenNewObject) !== JSON.stringify(hiddenObject)) {
|
|
126
|
-
acc.push(hiddenObject);
|
|
127
|
-
}
|
|
128
|
-
return acc;
|
|
129
|
-
}, []);
|
|
130
123
|
}
|
|
131
124
|
dispatch((0, _Actions.onRowSeclect)(selectedIds));
|
|
132
|
-
dispatch((0, _Actions.onRowSelectHidden)(hiddenSelectedRows));
|
|
133
125
|
};
|
|
134
|
-
const handleToggleSelectAll = (event, Ids, includeIds
|
|
135
|
-
if (event.target.checked) {
|
|
136
|
-
const filteredRows = [];
|
|
137
|
-
let hiddenNewObject = {};
|
|
138
|
-
rows.forEach(row => {
|
|
139
|
-
hiddenNewObject = {};
|
|
140
|
-
table.hiddenDataKeys.forEach(dataK => {
|
|
141
|
-
hiddenNewObject = _objectSpread(_objectSpread({}, hiddenNewObject), {}, {
|
|
142
|
-
[dataK]: row[dataK]
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
filteredRows.push(hiddenNewObject);
|
|
146
|
-
});
|
|
147
|
-
const finalHiddenRowData = [...table.hiddenSelectedRows, ...filteredRows];
|
|
148
|
-
dispatch((0, _Actions.onRowSelectHidden)(finalHiddenRowData));
|
|
149
|
-
} else {
|
|
150
|
-
const filteredHiddenRows = table.hiddenSelectedRows.filter(hiddenRow => !rows.some(row => table.hiddenDataKeys.every(dataK => hiddenRow[dataK] === row[dataK])));
|
|
151
|
-
dispatch((0, _Actions.onRowSelectHidden)(filteredHiddenRows));
|
|
152
|
-
}
|
|
126
|
+
const handleToggleSelectAll = (event, Ids, includeIds) => {
|
|
153
127
|
if (event.target.checked && !includeIds) {
|
|
154
128
|
const selecedIds = Ids.concat(table.selectedRows);
|
|
155
129
|
dispatch((0, _Actions.onRowSeclect)(selecedIds));
|
|
@@ -176,7 +150,7 @@ const PaginatedTable = _ref => {
|
|
|
176
150
|
const handleColumnViewChange = column => {
|
|
177
151
|
const columns = table.columns.map(col => {
|
|
178
152
|
const updateColumnView = _objectSpread({}, col);
|
|
179
|
-
if (col.dataField === column.dataField) {
|
|
153
|
+
if (col.dataField && col.dataField === column.dataField) {
|
|
180
154
|
updateColumnView.display = !column.display;
|
|
181
155
|
}
|
|
182
156
|
return updateColumnView;
|
|
@@ -185,6 +159,39 @@ const PaginatedTable = _ref => {
|
|
|
185
159
|
columns
|
|
186
160
|
})));
|
|
187
161
|
};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* handle delete row from table
|
|
165
|
+
* remove selected rows
|
|
166
|
+
*/
|
|
167
|
+
const onDeleteRow = row => {
|
|
168
|
+
let selectedIds = table.selectedRows;
|
|
169
|
+
// if del row is selected remove from selected rows
|
|
170
|
+
if (row.isChecked) {
|
|
171
|
+
const delId = row[table.dataKey];
|
|
172
|
+
selectedIds = table.selectedRows.reduce((acc, id) => {
|
|
173
|
+
if (delId !== id) {
|
|
174
|
+
acc.push(id);
|
|
175
|
+
}
|
|
176
|
+
return acc;
|
|
177
|
+
}, []);
|
|
178
|
+
}
|
|
179
|
+
dispatch((0, _Actions.onRowDelete)({
|
|
180
|
+
deletedRow: row,
|
|
181
|
+
selectedRows: selectedIds
|
|
182
|
+
}));
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* clear selected rows when all files are removed from myCart/ My file
|
|
187
|
+
*/
|
|
188
|
+
const onDeleteAllRows = () => {
|
|
189
|
+
dispatch((0, _Actions.onClearCart)({
|
|
190
|
+
deletedRows: table.selectedRows,
|
|
191
|
+
selectedRows: []
|
|
192
|
+
}));
|
|
193
|
+
};
|
|
194
|
+
|
|
188
195
|
/**
|
|
189
196
|
* A. client table
|
|
190
197
|
* table data provide by bento app (tblRows)
|
|
@@ -194,12 +201,14 @@ const PaginatedTable = _ref => {
|
|
|
194
201
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ClientController.default, {
|
|
195
202
|
tblRows: tblRows,
|
|
196
203
|
table: table,
|
|
197
|
-
onRowsPerPageChange: handleChangeRowsPerPage,
|
|
198
|
-
onPageChange: handleChangePage,
|
|
199
|
-
onRowSelectChange: onRowSelectHandler,
|
|
200
|
-
onToggleSelectAll: handleToggleSelectAll,
|
|
201
|
-
onSortByColumn: handleSortByColumn,
|
|
202
|
-
onColumnViewChange: handleColumnViewChange,
|
|
204
|
+
onRowsPerPageChange: customizeChangeRowsPerPage || handleChangeRowsPerPage,
|
|
205
|
+
onPageChange: customizeChangePage || handleChangePage,
|
|
206
|
+
onRowSelectChange: customizeOnRowSelect || onRowSelectHandler,
|
|
207
|
+
onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
|
|
208
|
+
onSortByColumn: customizeSortByColumn || handleSortByColumn,
|
|
209
|
+
onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
|
|
210
|
+
onDeleteRow: customizeDeleteRow || onDeleteRow,
|
|
211
|
+
onDeleteAllFiles: customizeDeleteAllRows || onDeleteAllRows,
|
|
203
212
|
themeConfig: themeConfig
|
|
204
213
|
}));
|
|
205
214
|
}
|
|
@@ -218,12 +227,15 @@ const PaginatedTable = _ref => {
|
|
|
218
227
|
queryVariables: queryVariables,
|
|
219
228
|
totalRowCount: totalRowCount,
|
|
220
229
|
table: table,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
230
|
+
server: server,
|
|
231
|
+
onRowsPerPageChange: customizeChangeRowsPerPage || handleChangeRowsPerPage,
|
|
232
|
+
onPageChange: customizeChangePage || handleChangePage,
|
|
233
|
+
onRowSelectChange: customizeOnRowSelect || onRowSelectHandler,
|
|
234
|
+
onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
|
|
235
|
+
onSortByColumn: customizeSortByColumn || handleSortByColumn,
|
|
236
|
+
onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
|
|
237
|
+
onDeleteRow: customizeDeleteRow || onDeleteRow,
|
|
238
|
+
onDeleteAllFiles: customizeDeleteAllRows || onDeleteAllRows,
|
|
227
239
|
themeConfig: themeConfig
|
|
228
240
|
}));
|
|
229
241
|
};
|
|
@@ -22,10 +22,13 @@ const setSelectedRows = function setSelectedRows() {
|
|
|
22
22
|
let table = arguments.length > 1 ? arguments[1] : undefined;
|
|
23
23
|
const {
|
|
24
24
|
selectedRows,
|
|
25
|
-
dataKey
|
|
25
|
+
dataKey,
|
|
26
|
+
deletedRow
|
|
26
27
|
} = table;
|
|
28
|
+
// checked selected row if deleted
|
|
29
|
+
const checkedRows = deletedRow !== null && deletedRow !== void 0 && deletedRow.isChecked ? [...selectedRows, deletedRow[dataKey]] : selectedRows;
|
|
27
30
|
const updateRows = [...rows].map(row => {
|
|
28
|
-
const isChecked = dataKey ?
|
|
31
|
+
const isChecked = dataKey ? checkedRows.indexOf(row[dataKey]) !== -1 : false;
|
|
29
32
|
return _objectSpread(_objectSpread({}, row), {}, {
|
|
30
33
|
isChecked
|
|
31
34
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSeclect = exports.onRowDelete = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onClearCart = 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',
|
|
@@ -11,10 +11,11 @@ const actionTypes = {
|
|
|
11
11
|
ON_ROWS_PER_PAGE_CHANGE: 'ON_ROWS_PER_PAGE_CHANGE',
|
|
12
12
|
ON_PAGE_CHANGE: 'ON_PAGE_CHANGE',
|
|
13
13
|
ON_ROW_SELECT: 'ON_ROW_SELECT',
|
|
14
|
-
ON_ROW_SELECT_HIDDEN: 'ON_ROW_SELECT_HIDDEN',
|
|
15
14
|
SET_TOTAL_ROW_COUNT: 'SET_TOTAL_ROW_COUNT',
|
|
16
15
|
ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE',
|
|
17
|
-
|
|
16
|
+
CUSTOMIZE_PAGINATION_ACTION: 'CUSTOMIZE_PAGINATION_ACTION',
|
|
17
|
+
ON_ROWS_DELETE: 'ON_ROWS_DELETE',
|
|
18
|
+
ON_ROW_DELETE: 'ON_ROW_DELETE'
|
|
18
19
|
};
|
|
19
20
|
exports.actionTypes = actionTypes;
|
|
20
21
|
const onColumnViewChange = columns => ({
|
|
@@ -52,17 +53,23 @@ const onRowSeclect = rows => ({
|
|
|
52
53
|
payload: rows
|
|
53
54
|
});
|
|
54
55
|
exports.onRowSeclect = onRowSeclect;
|
|
55
|
-
const onRowSelectHidden = rows => ({
|
|
56
|
-
type: actionTypes.ON_ROW_SELECT_HIDDEN,
|
|
57
|
-
payload: rows
|
|
58
|
-
});
|
|
59
|
-
exports.onRowSelectHidden = onRowSelectHidden;
|
|
60
56
|
const setTotalRowCount = count => ({
|
|
61
57
|
type: actionTypes.SET_TOTAL_ROW_COUNT,
|
|
62
58
|
payload: count
|
|
63
59
|
});
|
|
64
60
|
exports.setTotalRowCount = setTotalRowCount;
|
|
65
|
-
const
|
|
66
|
-
type: actionTypes.
|
|
61
|
+
const customPaginationAction = value => ({
|
|
62
|
+
type: actionTypes.CUSTOMIZE_PAGINATION_ACTION,
|
|
63
|
+
payload: value
|
|
64
|
+
});
|
|
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
|
|
67
74
|
});
|
|
68
|
-
exports.
|
|
75
|
+
exports.onRowDelete = onRowDelete;
|
|
@@ -16,6 +16,8 @@ const reducer = (state, action) => {
|
|
|
16
16
|
payload
|
|
17
17
|
} = action;
|
|
18
18
|
switch (type) {
|
|
19
|
+
case _Actions.actionTypes.CUSTOMIZE_PAGINATION_ACTION:
|
|
20
|
+
return _objectSpread(_objectSpread({}, state), payload);
|
|
19
21
|
case _Actions.actionTypes.ON_COLUMN_SORT:
|
|
20
22
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
21
23
|
sortOrder: payload.sort,
|
|
@@ -36,10 +38,6 @@ const reducer = (state, action) => {
|
|
|
36
38
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
37
39
|
selectedRows: payload
|
|
38
40
|
});
|
|
39
|
-
case _Actions.actionTypes.ON_ROW_SELECT_HIDDEN:
|
|
40
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
41
|
-
hiddenSelectedRows: payload
|
|
42
|
-
});
|
|
43
41
|
case _Actions.actionTypes.ON_PAGE_AND_TOTAL_COUNT_CHANGE:
|
|
44
42
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
45
43
|
totalRowCount: payload.totalRowCount,
|
|
@@ -49,10 +47,15 @@ const reducer = (state, action) => {
|
|
|
49
47
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
50
48
|
totalRowCount: payload
|
|
51
49
|
});
|
|
52
|
-
case _Actions.actionTypes.
|
|
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:
|
|
53
56
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
deletedRows: payload.deleteRows,
|
|
58
|
+
selectedRows: payload.selectedRows
|
|
56
59
|
});
|
|
57
60
|
default:
|
|
58
61
|
return state;
|
package/dist/wrapper/Wrapper.js
CHANGED
|
@@ -8,7 +8,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _core = require("@material-ui/core");
|
|
9
9
|
var _ButtonView = _interopRequireDefault(require("./components/ButtonView"));
|
|
10
10
|
var _TextFieldView = _interopRequireDefault(require("./components/TextFieldView"));
|
|
11
|
-
var _TooltipView = _interopRequireDefault(require("./components/TooltipView"));
|
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
12
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -62,9 +61,11 @@ const Text = _ref2 => {
|
|
|
62
61
|
text,
|
|
63
62
|
clsName,
|
|
64
63
|
tag,
|
|
64
|
+
component = 'span',
|
|
65
65
|
Component
|
|
66
66
|
} = _ref2;
|
|
67
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement(_core.Box, {
|
|
68
|
+
component: component,
|
|
68
69
|
className: clsName,
|
|
69
70
|
type: tag
|
|
70
71
|
}, text, Component && /*#__PURE__*/_react.default.createElement(Component, null));
|
|
@@ -78,8 +79,7 @@ const Text = _ref2 => {
|
|
|
78
79
|
const ViewComponent = props => {
|
|
79
80
|
const {
|
|
80
81
|
type,
|
|
81
|
-
|
|
82
|
-
tooltipCofig
|
|
82
|
+
customViewElem
|
|
83
83
|
} = props;
|
|
84
84
|
switch (type) {
|
|
85
85
|
case types.BUTTON:
|
|
@@ -93,7 +93,7 @@ const ViewComponent = props => {
|
|
|
93
93
|
case types.TEXT_INPUT:
|
|
94
94
|
return /*#__PURE__*/_react.default.createElement(_TextFieldView.default, props);
|
|
95
95
|
case types.CUSTOM_ELEM:
|
|
96
|
-
return
|
|
96
|
+
return customViewElem();
|
|
97
97
|
default:
|
|
98
98
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
99
99
|
}
|
|
@@ -143,7 +143,7 @@ const CustomLayout = props => {
|
|
|
143
143
|
}, /*#__PURE__*/_react.default.createElement(_core.Container, {
|
|
144
144
|
maxWidth: container.size,
|
|
145
145
|
className: container.clsName
|
|
146
|
-
}, container.
|
|
146
|
+
}, container.items.map(item => /*#__PURE__*/_react.default.createElement(ViewComponent, _extends({}, item, props)))));
|
|
147
147
|
}));
|
|
148
148
|
};
|
|
149
149
|
const CustomWrapper = props => {
|
|
@@ -154,8 +154,7 @@ const CustomWrapper = props => {
|
|
|
154
154
|
section,
|
|
155
155
|
classes,
|
|
156
156
|
activeFilters,
|
|
157
|
-
tblDispatch
|
|
158
|
-
fileCount
|
|
157
|
+
tblDispatch
|
|
159
158
|
} = props;
|
|
160
159
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(CustomLayout, {
|
|
161
160
|
configs: wrapConfig,
|
|
@@ -163,8 +162,7 @@ const CustomWrapper = props => {
|
|
|
163
162
|
section: section,
|
|
164
163
|
classes: classes,
|
|
165
164
|
activeFilters: activeFilters,
|
|
166
|
-
tblDispatch: tblDispatch
|
|
167
|
-
fileCount: fileCount
|
|
165
|
+
tblDispatch: tblDispatch
|
|
168
166
|
}, children));
|
|
169
167
|
};
|
|
170
168
|
var _default = CustomWrapper;
|
|
@@ -14,7 +14,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
14
14
|
*/
|
|
15
15
|
const getQueryVariables = variables => {
|
|
16
16
|
const queryVariables = _objectSpread({}, variables);
|
|
17
|
-
queryVariables.first =
|
|
17
|
+
queryVariables.first = 10000;
|
|
18
18
|
return queryVariables;
|
|
19
19
|
};
|
|
20
20
|
exports.getQueryVariables = getQueryVariables;
|
|
@@ -3,57 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
|
|
9
8
|
var _core = require("@material-ui/core");
|
|
9
|
+
var _ToolTip = _interopRequireDefault(require("@bento-core/tool-tip/src/ToolTip"));
|
|
10
10
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
11
|
var _WrapperService = require("../../WrapperService");
|
|
12
12
|
var _AddToCartDialogView = _interopRequireDefault(require("../AddToCartDialog/AddToCartDialogView"));
|
|
13
|
+
var _TooltipView = _interopRequireDefault(require("../TooltipView"));
|
|
14
|
+
var _util = _interopRequireDefault(require("../util"));
|
|
15
|
+
const _excluded = ["title"];
|
|
13
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
17
|
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); }
|
|
15
18
|
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; }
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
tooltipCofig,
|
|
20
|
-
classes
|
|
21
|
-
} = props;
|
|
22
|
-
const {
|
|
23
|
-
icon,
|
|
24
|
-
src,
|
|
25
|
-
alt,
|
|
26
|
-
arrow = false,
|
|
27
|
-
tooltipText,
|
|
28
|
-
placement
|
|
29
|
-
} = tooltipCofig;
|
|
30
|
-
return /*#__PURE__*/_react.default.createElement(_toolTip.default, {
|
|
31
|
-
placement: placement,
|
|
32
|
-
title: tooltipText || "".concat(tooltipCofig[section]),
|
|
33
|
-
arrow: arrow,
|
|
34
|
-
classes: {
|
|
35
|
-
tooltip: classes.customTooltip,
|
|
36
|
-
arrow: classes.customArrow
|
|
37
|
-
}
|
|
38
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
39
|
-
src: icon || src,
|
|
40
|
-
alt: alt
|
|
41
|
-
}));
|
|
42
|
-
};
|
|
43
|
-
exports.ToolTipView = ToolTipView;
|
|
44
|
-
const checkDuplicate = (cartFiles, ids) => {
|
|
45
|
-
let duplicateCount = 0;
|
|
46
|
-
for (let i = 0; i < cartFiles.length; i += 1) {
|
|
47
|
-
if (ids.includes(cartFiles[i])) {
|
|
48
|
-
duplicateCount += 1;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return duplicateCount;
|
|
52
|
-
};
|
|
19
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
53
22
|
const AddAllFilesComponent = props => {
|
|
54
23
|
const {
|
|
55
24
|
title,
|
|
56
25
|
clsName,
|
|
26
|
+
classes,
|
|
57
27
|
section,
|
|
58
28
|
addFileQuery,
|
|
59
29
|
responseKeys,
|
|
@@ -63,9 +33,15 @@ const AddAllFilesComponent = props => {
|
|
|
63
33
|
setOpenSnackbar,
|
|
64
34
|
client,
|
|
65
35
|
tooltipCofig,
|
|
66
|
-
|
|
67
|
-
|
|
36
|
+
buttonTooltipConfig,
|
|
37
|
+
maxFileLimit = 1000,
|
|
38
|
+
DisplayCustomText
|
|
68
39
|
} = props;
|
|
40
|
+
const _ref = buttonTooltipConfig || {},
|
|
41
|
+
{
|
|
42
|
+
title: tooltipTitle
|
|
43
|
+
} = _ref,
|
|
44
|
+
tooltipProps = _objectWithoutProperties(_ref, _excluded);
|
|
69
45
|
/**
|
|
70
46
|
* conditionally display dialog view
|
|
71
47
|
*/
|
|
@@ -82,39 +58,26 @@ const AddAllFilesComponent = props => {
|
|
|
82
58
|
variables: activeFilters,
|
|
83
59
|
query: addFileQuery
|
|
84
60
|
});
|
|
85
|
-
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (data && data.length > 0) {
|
|
90
|
-
const isArray = Array.isArray(data[0][responseKeys[1]]);
|
|
91
|
-
const idsInitial = data.reduce((acc, id) => {
|
|
92
|
-
if (id && id[responseKeys[1]]) {
|
|
93
|
-
// if object convert to array
|
|
94
|
-
const items = isArray ? id[responseKeys[1]] : [id[responseKeys[1]]];
|
|
95
|
-
acc.push(...items);
|
|
96
|
-
}
|
|
97
|
-
return acc;
|
|
98
|
-
}, []);
|
|
99
|
-
const ids = [...new Set(idsInitial)];
|
|
100
|
-
if (cartCount + ids.length <= 6000) {
|
|
101
|
-
setOpen(true);
|
|
102
|
-
setAddFilesId(ids);
|
|
103
|
-
} else {
|
|
104
|
-
const duplicate = checkDuplicate(cartFiles, ids);
|
|
105
|
-
if (cartCount + ids.length - duplicate <= 6000) {
|
|
106
|
-
setOpen(true);
|
|
107
|
-
setAddFilesId(ids);
|
|
108
|
-
} else {
|
|
109
|
-
setAlterDisplay(true);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return [];
|
|
114
|
-
});
|
|
115
|
-
} else {
|
|
116
|
-
setAlterDisplay(true);
|
|
61
|
+
let filesInCart = 0;
|
|
62
|
+
if (localStorage.getItem('CartFileIds')) {
|
|
63
|
+
const filesId = JSON.parse(localStorage.getItem('CartFileIds')) || [];
|
|
64
|
+
filesInCart = filesId.length;
|
|
117
65
|
}
|
|
66
|
+
fileIds().then(response => {
|
|
67
|
+
const data = response[responseKeys[0]];
|
|
68
|
+
if (data && data.length > 0) {
|
|
69
|
+
const ids = (0, _util.default)(response, responseKeys);
|
|
70
|
+
if (ids.length + filesInCart > maxFileLimit) {
|
|
71
|
+
setAlterDisplay(true);
|
|
72
|
+
} else {
|
|
73
|
+
setOpen(true);
|
|
74
|
+
setAddFilesId(ids);
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
setOpen(true);
|
|
78
|
+
}
|
|
79
|
+
return [];
|
|
80
|
+
});
|
|
118
81
|
};
|
|
119
82
|
|
|
120
83
|
/**
|
|
@@ -125,14 +88,22 @@ const AddAllFilesComponent = props => {
|
|
|
125
88
|
toggleOpen();
|
|
126
89
|
setOpenSnackbar(true);
|
|
127
90
|
};
|
|
128
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ToolTip.default, _extends({
|
|
92
|
+
title: tooltipTitle || '',
|
|
93
|
+
classes: {
|
|
94
|
+
tooltip: classes.customTooltip,
|
|
95
|
+
arrow: classes.customArrow
|
|
96
|
+
}
|
|
97
|
+
}, tooltipProps), /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
129
98
|
onClick: addAllFiles,
|
|
130
99
|
className: (0, _clsx.default)(clsName, "".concat(clsName, "_").concat(section)),
|
|
131
100
|
disableRipple: true
|
|
132
|
-
}, title), tooltipCofig && /*#__PURE__*/_react.default.createElement(
|
|
101
|
+
}, title)), tooltipCofig && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), /*#__PURE__*/_react.default.createElement(_AddToCartDialogView.default, {
|
|
133
102
|
open: openAddDialog,
|
|
134
103
|
onYesClick: addFilesToCart,
|
|
135
|
-
onNoClick: toggleOpen
|
|
104
|
+
onNoClick: toggleOpen,
|
|
105
|
+
DisplayCustomText: DisplayCustomText,
|
|
106
|
+
activeFilters: activeFilters
|
|
136
107
|
}));
|
|
137
108
|
};
|
|
138
109
|
var _default = AddAllFilesComponent;
|
|
@@ -28,8 +28,7 @@ const AddFilesView = props => {
|
|
|
28
28
|
const {
|
|
29
29
|
btnType,
|
|
30
30
|
count,
|
|
31
|
-
alertMessage
|
|
32
|
-
cartFiles
|
|
31
|
+
alertMessage
|
|
33
32
|
} = props;
|
|
34
33
|
/**
|
|
35
34
|
* snackbar state
|
|
@@ -47,13 +46,11 @@ const AddFilesView = props => {
|
|
|
47
46
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, btnTypes.ADD_SELECTED_FILES === btnType && /*#__PURE__*/_react.default.createElement(_AddSelectedFilesController.default, _extends({}, props, {
|
|
48
47
|
client: client,
|
|
49
48
|
setAlterDisplay: setAlterDisplay,
|
|
50
|
-
setOpenSnackbar: setOpenSnackbar
|
|
51
|
-
cartFiles: cartFiles
|
|
49
|
+
setOpenSnackbar: setOpenSnackbar
|
|
52
50
|
})), btnTypes.ADD_ALL_FILES === btnType && /*#__PURE__*/_react.default.createElement(_AddAllView.default, _extends({}, props, {
|
|
53
51
|
client: client,
|
|
54
52
|
setAlterDisplay: setAlterDisplay,
|
|
55
|
-
setOpenSnackbar: setOpenSnackbar
|
|
56
|
-
cartFiles: cartFiles
|
|
53
|
+
setOpenSnackbar: setOpenSnackbar
|
|
57
54
|
})), /*#__PURE__*/_react.default.createElement(_Snackbar.default, {
|
|
58
55
|
open: openSnackbar,
|
|
59
56
|
count: count,
|
|
@@ -12,19 +12,16 @@ var _ContextProvider = require("../../../table/ContextProvider");
|
|
|
12
12
|
var _Actions = require("../../../table/state/Actions");
|
|
13
13
|
var _AddSelectedFilesView = _interopRequireDefault(require("./AddSelectedFilesView"));
|
|
14
14
|
var _WrapperService = require("../../WrapperService");
|
|
15
|
+
var _util = _interopRequireDefault(require("../util"));
|
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
17
|
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); }
|
|
17
18
|
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; }
|
|
18
19
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return duplicateCount;
|
|
27
|
-
};
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
24
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
28
25
|
const AddSelectedFilesController = props => {
|
|
29
26
|
const {
|
|
30
27
|
clsName,
|
|
@@ -36,7 +33,9 @@ const AddSelectedFilesController = props => {
|
|
|
36
33
|
setOpenSnackbar,
|
|
37
34
|
setAlterDisplay,
|
|
38
35
|
client,
|
|
39
|
-
|
|
36
|
+
maxFileLimit = 1000,
|
|
37
|
+
applyActiveFilter = false,
|
|
38
|
+
activeFilters = {}
|
|
40
39
|
} = props;
|
|
41
40
|
const tableContext = (0, _react.useContext)(_ContextProvider.TableContext);
|
|
42
41
|
const {
|
|
@@ -46,40 +45,52 @@ const AddSelectedFilesController = props => {
|
|
|
46
45
|
selectedRows = [],
|
|
47
46
|
dispatch
|
|
48
47
|
} = context;
|
|
49
|
-
const
|
|
50
|
-
variables
|
|
48
|
+
const activeFilterItems = applyActiveFilter ? activeFilters : {};
|
|
49
|
+
const variables = _objectSpread(_objectSpread({
|
|
50
|
+
first: 10000
|
|
51
|
+
}, activeFilterItems), {}, {
|
|
52
|
+
[dataKey]: selectedRows
|
|
53
|
+
});
|
|
54
|
+
|
|
51
55
|
// add selected files id
|
|
52
56
|
const addSelectedFiles = () => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
if (addFileQuery) {
|
|
58
|
+
const fileIds = (0, _WrapperService.getFilesID)({
|
|
59
|
+
client,
|
|
60
|
+
variables,
|
|
61
|
+
fileIds: selectedRows,
|
|
62
|
+
query: addFileQuery
|
|
63
|
+
});
|
|
64
|
+
let filesInCart = 0;
|
|
65
|
+
if (localStorage.getItem('CartFileIds')) {
|
|
66
|
+
const filesId = JSON.parse(localStorage.getItem('CartFileIds')) || [];
|
|
67
|
+
filesInCart = filesId.length;
|
|
68
|
+
}
|
|
69
|
+
fileIds().then(response => {
|
|
70
|
+
const ids = (0, _util.default)(response, responseKeys);
|
|
71
|
+
if (ids.length + filesInCart >= maxFileLimit) {
|
|
72
|
+
setAlterDisplay(true);
|
|
73
|
+
} else {
|
|
66
74
|
addFiles(ids);
|
|
67
75
|
setOpenSnackbar(true);
|
|
68
76
|
dispatch((0, _Actions.onRowSeclect)([]));
|
|
69
|
-
} else {
|
|
70
|
-
const duplicate = checkDuplicate(cartFiles, ids);
|
|
71
|
-
if (cartCount + fileCount - duplicate <= 6000) {
|
|
72
|
-
addFiles(ids);
|
|
73
|
-
setOpenSnackbar(true);
|
|
74
|
-
dispatch((0, _Actions.onRowSeclect)([]));
|
|
75
|
-
} else {
|
|
76
|
-
setAlterDisplay(true);
|
|
77
|
-
}
|
|
78
77
|
}
|
|
79
|
-
}
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
const ids = variables[dataKey];
|
|
81
|
+
let filesInCart = 0;
|
|
82
|
+
if (localStorage.getItem('CartFileIds')) {
|
|
83
|
+
const filesId = JSON.parse(localStorage.getItem('CartFileIds')) || [];
|
|
84
|
+
filesInCart = filesId.length;
|
|
85
|
+
}
|
|
86
|
+
if (ids.length + filesInCart >= maxFileLimit) {
|
|
80
87
|
setAlterDisplay(true);
|
|
88
|
+
} else {
|
|
89
|
+
addFiles(ids);
|
|
90
|
+
setOpenSnackbar(true);
|
|
91
|
+
dispatch((0, _Actions.onRowSeclect)([]));
|
|
81
92
|
}
|
|
82
|
-
}
|
|
93
|
+
}
|
|
83
94
|
};
|
|
84
95
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_AddSelectedFilesView.default, _extends({}, props, {
|
|
85
96
|
eventHandler: addSelectedFiles,
|
|
@@ -7,7 +7,11 @@ exports.default = exports.ToolTipView = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _core = require("@material-ui/core");
|
|
9
9
|
var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
|
|
10
|
+
const _excluded = ["title"];
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
15
|
/**
|
|
12
16
|
* customize tooltips based on tooltipContent
|
|
13
17
|
* defined on dashboardTabData (tooltipContent)
|
|
@@ -35,6 +39,7 @@ const ToolTipView = props => {
|
|
|
35
39
|
arrow: classes.customArrow
|
|
36
40
|
}
|
|
37
41
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
42
|
+
className: "add_selected_file_tooltip_icon",
|
|
38
43
|
src: icon || src,
|
|
39
44
|
alt: alt
|
|
40
45
|
}));
|
|
@@ -45,18 +50,38 @@ const AddSelectedFileComponent = props => {
|
|
|
45
50
|
eventHandler,
|
|
46
51
|
title,
|
|
47
52
|
clsName,
|
|
53
|
+
classes,
|
|
48
54
|
disabled,
|
|
49
|
-
tooltipCofig
|
|
55
|
+
tooltipCofig,
|
|
56
|
+
buttonTooltipConfig
|
|
50
57
|
} = props;
|
|
58
|
+
const _ref = buttonTooltipConfig || {},
|
|
59
|
+
{
|
|
60
|
+
title: tooltipTitle
|
|
61
|
+
} = _ref,
|
|
62
|
+
tooltipProps = _objectWithoutProperties(_ref, _excluded);
|
|
51
63
|
const addFiles = () => {
|
|
52
64
|
eventHandler();
|
|
53
65
|
};
|
|
54
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_toolTip.default, _extends({
|
|
67
|
+
title: tooltipTitle || '',
|
|
68
|
+
classes: {
|
|
69
|
+
tooltip: classes.customTooltip,
|
|
70
|
+
arrow: classes.customArrow
|
|
71
|
+
}
|
|
72
|
+
}, tooltipProps), /*#__PURE__*/_react.default.createElement("span", {
|
|
73
|
+
className: classes.customTooltipSpan
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
55
75
|
onClick: addFiles,
|
|
56
76
|
className: clsName,
|
|
57
77
|
disableRipple: true,
|
|
58
|
-
disabled: disabled
|
|
59
|
-
|
|
78
|
+
disabled: disabled,
|
|
79
|
+
style: {
|
|
80
|
+
margin: '0px'
|
|
81
|
+
}
|
|
82
|
+
}, title))), tooltipCofig && /*#__PURE__*/_react.default.createElement(ToolTipView, _extends({
|
|
83
|
+
classes: classes
|
|
84
|
+
}, props)));
|
|
60
85
|
};
|
|
61
86
|
var _default = AddSelectedFileComponent;
|
|
62
87
|
exports.default = _default;
|
|
@@ -16,7 +16,6 @@ function AddToCartDialogAlertView(props) {
|
|
|
16
16
|
const closeAlertModelTimer = 4000;
|
|
17
17
|
const AlertDialog = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Dialog, {
|
|
18
18
|
open: open,
|
|
19
|
-
"aria-labelledby": "alert-dialog-title",
|
|
20
19
|
"aria-describedby": "alert-dialog-description"
|
|
21
20
|
}, /*#__PURE__*/_react.default.createElement(_core.DialogContent, {
|
|
22
21
|
className: "alter-content"
|
|
@@ -15,7 +15,9 @@ function AddToCartDialogView(props) {
|
|
|
15
15
|
onYesClick,
|
|
16
16
|
onNoClick,
|
|
17
17
|
cartWillFull = false,
|
|
18
|
-
alertMessage
|
|
18
|
+
alertMessage,
|
|
19
|
+
DisplayCustomText,
|
|
20
|
+
activeFilters
|
|
19
21
|
} = props;
|
|
20
22
|
if (cartWillFull) {
|
|
21
23
|
return /*#__PURE__*/_react.default.createElement(_AddToCartDialogAlertView.default, {
|
|
@@ -26,11 +28,19 @@ function AddToCartDialogView(props) {
|
|
|
26
28
|
}
|
|
27
29
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Dialog, {
|
|
28
30
|
open: open,
|
|
29
|
-
"aria-labelledby": "alert-dialog-title",
|
|
30
31
|
"aria-describedby": "alert-dialog-description"
|
|
31
|
-
}, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, /*#__PURE__*/_react.default.createElement(
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, DisplayCustomText ? /*#__PURE__*/_react.default.createElement(DisplayCustomText, {
|
|
33
|
+
onYesClick: onYesClick,
|
|
34
|
+
onNoClick: onNoClick,
|
|
35
|
+
activeFilters: activeFilters
|
|
36
|
+
}) : /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
|
|
37
|
+
id: "alert-dialog-description",
|
|
38
|
+
style: {
|
|
39
|
+
color: 'black'
|
|
40
|
+
}
|
|
41
|
+
}, "Are you sure to add All Files", ' ', numberOfFilesSelected, ' ', "to cart")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, {
|
|
42
|
+
className: "dialog_actions"
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
34
44
|
className: "yesBtn",
|
|
35
45
|
onClick: () => onYesClick()
|
|
36
46
|
}, "Yes"), /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = () => ({
|
|
8
|
+
customTooltip: {
|
|
9
|
+
border: '#03A383 1px solid'
|
|
10
|
+
},
|
|
11
|
+
customArrow: {
|
|
12
|
+
'&::before': {
|
|
13
|
+
border: '#03A383 1px solid'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
exports.default = _default;
|
|
@@ -5,18 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _core = require("@material-ui/core");
|
|
8
9
|
var _AddFiles = require("./AddFiles");
|
|
9
10
|
var _ReduxAddFile = _interopRequireDefault(require("./ReduxAddFile"));
|
|
10
|
-
var
|
|
11
|
+
var _DownloadManifestBtn = _interopRequireDefault(require("./DownloadManifestBtn"));
|
|
12
|
+
var _ButtonStyle = _interopRequireDefault(require("./ButtonStyle"));
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
const ButtonView = props => {
|
|
13
15
|
const {
|
|
14
16
|
btnType
|
|
15
17
|
} = props;
|
|
16
18
|
if (_AddFiles.btnTypes.DOWNLOAD_MANIFEST === btnType) {
|
|
17
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_DownloadManifestBtn.default, props);
|
|
18
20
|
}
|
|
19
21
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ReduxAddFile.default, props));
|
|
20
22
|
};
|
|
21
|
-
var _default = ButtonView;
|
|
23
|
+
var _default = (0, _core.withStyles)(_ButtonStyle.default)(ButtonView);
|
|
22
24
|
exports.default = _default;
|
|
@@ -21,8 +21,7 @@ const DownloadManifestView = props => {
|
|
|
21
21
|
const {
|
|
22
22
|
tooltipCofig,
|
|
23
23
|
clsName,
|
|
24
|
-
title
|
|
25
|
-
cartFiles
|
|
24
|
+
title
|
|
26
25
|
} = props;
|
|
27
26
|
/**
|
|
28
27
|
* get cart state
|
|
@@ -40,6 +39,13 @@ const DownloadManifestView = props => {
|
|
|
40
39
|
variables.first = 10000;
|
|
41
40
|
return variables;
|
|
42
41
|
};
|
|
42
|
+
const appendStringsToRecord = (records, columnsToAppendString) => records.map(record => {
|
|
43
|
+
const updatedRecord = record;
|
|
44
|
+
columnsToAppendString.forEach(columnConfigObject => {
|
|
45
|
+
updatedRecord[columnConfigObject.dataField] = columnConfigObject.appendString + updatedRecord[columnConfigObject.dataField];
|
|
46
|
+
});
|
|
47
|
+
return updatedRecord;
|
|
48
|
+
});
|
|
43
49
|
const client = (0, _client.useApolloClient)();
|
|
44
50
|
async function fetchData(_ref) {
|
|
45
51
|
let {
|
|
@@ -47,9 +53,18 @@ const DownloadManifestView = props => {
|
|
|
47
53
|
table
|
|
48
54
|
} = _ref;
|
|
49
55
|
const fetchResult = await client.query({
|
|
50
|
-
query: table.api,
|
|
56
|
+
query: table.manifestAPI ? table.manifestAPI : table.api,
|
|
51
57
|
variables: _objectSpread({}, getQueryVeriables(queryVariables))
|
|
52
|
-
}).then(result => result.data.filesInList)
|
|
58
|
+
}).then(result => result.data.filesInList).then(result => {
|
|
59
|
+
const {
|
|
60
|
+
columns
|
|
61
|
+
} = table;
|
|
62
|
+
const columnsToAppendString = columns.filter(colum => colum.appendString);
|
|
63
|
+
if (Object.keys(columnsToAppendString).length > 0) {
|
|
64
|
+
return appendStringsToRecord(result, columnsToAppendString);
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
});
|
|
53
68
|
return fetchResult;
|
|
54
69
|
}
|
|
55
70
|
async function DocumentDownload() {
|
|
@@ -68,7 +83,6 @@ const DownloadManifestView = props => {
|
|
|
68
83
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
69
84
|
className: clsName,
|
|
70
85
|
disableRipple: true,
|
|
71
|
-
disabled: cartFiles.length === 0,
|
|
72
86
|
onClick: () => DocumentDownload()
|
|
73
87
|
}, title), tooltipCofig && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props));
|
|
74
88
|
};
|
|
@@ -15,8 +15,7 @@ const AddFilesRedux = props => /*#__PURE__*/_react.default.createElement(_AddFil
|
|
|
15
15
|
* create query variable with actie filters
|
|
16
16
|
*/
|
|
17
17
|
const mapStateToProps = state => ({
|
|
18
|
-
count: state.cartReducer && state.cartReducer.count
|
|
19
|
-
cartFiles: state.cartReducer && state.cartReducer.filesId
|
|
18
|
+
count: state.cartReducer && state.cartReducer.count
|
|
20
19
|
});
|
|
21
20
|
const mapDispatchToProps = dispatch => ({
|
|
22
21
|
addFiles: files => {
|
|
@@ -33,7 +33,7 @@ const SnackbarView = props => {
|
|
|
33
33
|
className: "snackBarMessageIcon"
|
|
34
34
|
}, /*#__PURE__*/_react.default.createElement(_SuccessOutlined.default, null), ' '), /*#__PURE__*/_react.default.createElement("span", {
|
|
35
35
|
className: "snackBarText"
|
|
36
|
-
}, count, ' ', "File(s) successfully added to
|
|
36
|
+
}, count, ' ', "File(s) successfully added to My Files."))
|
|
37
37
|
}));
|
|
38
38
|
};
|
|
39
39
|
var _default = SnackbarView;
|
|
@@ -11,7 +11,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
11
11
|
const TextFieldView = _ref => {
|
|
12
12
|
let {
|
|
13
13
|
clsName,
|
|
14
|
-
placeholder
|
|
14
|
+
placeholder,
|
|
15
|
+
ariaLabel
|
|
15
16
|
} = _ref;
|
|
16
17
|
const [text, setText] = (0, _react.useState)('');
|
|
17
18
|
const cartContext = (0, _react.useContext)(_cart.CartContext);
|
|
@@ -30,6 +31,7 @@ const TextFieldView = _ref => {
|
|
|
30
31
|
},
|
|
31
32
|
className: clsName,
|
|
32
33
|
placeholder: placeholder,
|
|
34
|
+
"aria-label": ariaLabel,
|
|
33
35
|
id: "multiline-user-coments"
|
|
34
36
|
});
|
|
35
37
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* max two response keys
|
|
9
|
+
* add file query response handler
|
|
10
|
+
* return - list of files name/id
|
|
11
|
+
*/
|
|
12
|
+
const addFilesResponseHandler = function addFilesResponseHandler(response) {
|
|
13
|
+
let responseKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
14
|
+
if (responseKeys.length === 2) {
|
|
15
|
+
const data = response[responseKeys[0]];
|
|
16
|
+
if (data && data.length > 0) {
|
|
17
|
+
const isArray = Array.isArray(data[0][responseKeys[1]]);
|
|
18
|
+
const ids = data.reduce((acc, id) => {
|
|
19
|
+
if (id && id[responseKeys[1]]) {
|
|
20
|
+
// if object convert to array
|
|
21
|
+
const items = isArray ? id[responseKeys[1]] : [id[responseKeys[1]]];
|
|
22
|
+
acc.push(...items);
|
|
23
|
+
}
|
|
24
|
+
return acc;
|
|
25
|
+
}, []);
|
|
26
|
+
return [...new Set(ids)];
|
|
27
|
+
}
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
return response[responseKeys[0]] || [];
|
|
31
|
+
};
|
|
32
|
+
var _default = addFilesResponseHandler;
|
|
33
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/paginated-table",
|
|
3
|
-
"version": "1.0.0-c3dc.
|
|
3
|
+
"version": "1.0.0-c3dc.27",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@bento-core/cart": "1.0.1-ccdihub.7",
|
|
19
|
-
"@bento-core/table": "^1.0.0-c3dc.
|
|
19
|
+
"@bento-core/table": "^1.0.0-c3dc.25",
|
|
20
20
|
"@bento-core/tool-tip": "^1.0.0",
|
|
21
21
|
"@bento-core/util": "^1.0.0"
|
|
22
22
|
},
|
package/dist/table/README.md
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactRedux = require("react-redux");
|
|
9
|
-
var _DownloadManifestBtn = _interopRequireDefault(require("./DownloadManifestBtn"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
const DownloadManifestRedux = props => /*#__PURE__*/_react.default.createElement(_DownloadManifestBtn.default, props);
|
|
12
|
-
const mapStateToProps = state => ({
|
|
13
|
-
cartFiles: state.cartReducer && state.cartReducer.filesId
|
|
14
|
-
});
|
|
15
|
-
var _default = (0, _reactRedux.connect)(mapStateToProps)(DownloadManifestRedux);
|
|
16
|
-
exports.default = _default;
|