@bento-core/paginated-table 1.0.0-c3dc.27 → 1.0.0-c3dc.28
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 +0 -13
- package/dist/table/ClientController.js +0 -1
- package/dist/table/PaginatedTable.js +53 -65
- package/dist/table/README.md +253 -0
- package/dist/table/TableService.js +2 -5
- package/dist/table/state/Actions.js +11 -18
- package/dist/table/state/Reducer.js +7 -10
- package/dist/wrapper/Wrapper.js +10 -8
- package/dist/wrapper/WrapperService.js +1 -1
- package/dist/wrapper/components/AddAllFiles/AddAllView.js +76 -47
- package/dist/wrapper/components/AddFiles.js +6 -3
- package/dist/wrapper/components/AddSelectedFiles/AddSelectedFilesController.js +36 -47
- package/dist/wrapper/components/AddSelectedFiles/AddSelectedFilesView.js +4 -29
- package/dist/wrapper/components/AddToCartDialog/AddToCartDialogAlertView.js +1 -0
- package/dist/wrapper/components/AddToCartDialog/AddToCartDialogView.js +5 -15
- package/dist/wrapper/components/ButtonView.js +3 -5
- package/dist/wrapper/components/DownloadManifestBtn.js +5 -19
- package/dist/wrapper/components/ReduxAddFile.js +2 -1
- package/dist/wrapper/components/ReduxDownloadManifestBtn.js +16 -0
- package/dist/wrapper/components/Snackbar/Snackbar.js +1 -1
- package/dist/wrapper/components/TextFieldView.js +1 -3
- package/package.json +1 -1
- package/dist/wrapper/components/ButtonStyle.js +0 -17
- package/dist/wrapper/components/util.js +0 -33
package/dist/index.js
CHANGED
|
@@ -3,12 +3,6 @@
|
|
|
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
|
-
});
|
|
12
6
|
Object.defineProperty(exports, "TableContext", {
|
|
13
7
|
enumerable: true,
|
|
14
8
|
get: function get() {
|
|
@@ -39,12 +33,6 @@ Object.defineProperty(exports, "btnTypes", {
|
|
|
39
33
|
return _AddFiles.btnTypes;
|
|
40
34
|
}
|
|
41
35
|
});
|
|
42
|
-
Object.defineProperty(exports, "customPaginationAction", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _Actions.customPaginationAction;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
36
|
Object.defineProperty(exports, "getQueryVariables", {
|
|
49
37
|
enumerable: true,
|
|
50
38
|
get: function get() {
|
|
@@ -111,7 +99,6 @@ var _Actions = require("./table/state/Actions");
|
|
|
111
99
|
var _Wrapper = _interopRequireWildcard(require("./wrapper/Wrapper"));
|
|
112
100
|
var _AddFiles = require("./wrapper/components/AddFiles");
|
|
113
101
|
var _WrapperService = require("./wrapper/WrapperService");
|
|
114
|
-
var _ButtonView = _interopRequireDefault(require("./wrapper/components/ButtonView"));
|
|
115
102
|
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); }
|
|
116
103
|
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; }
|
|
117
104
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -57,7 +57,6 @@ 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,
|
|
61
60
|
tableRows: displayRows
|
|
62
61
|
})));
|
|
63
62
|
};
|
|
@@ -26,8 +26,7 @@ const PaginatedTable = _ref => {
|
|
|
26
26
|
initState,
|
|
27
27
|
activeTab = true,
|
|
28
28
|
server = true,
|
|
29
|
-
tblRows = []
|
|
30
|
-
paginationOptions = {}
|
|
29
|
+
tblRows = []
|
|
31
30
|
} = _ref;
|
|
32
31
|
/**
|
|
33
32
|
* Initailize useReducer state
|
|
@@ -36,6 +35,9 @@ const PaginatedTable = _ref => {
|
|
|
36
35
|
* 3. Add all btn / Add file button also dispatch action to update table state
|
|
37
36
|
*/
|
|
38
37
|
const [table, dispatch] = (0, _react.useReducer)(_Reducer.default, {}, initState);
|
|
38
|
+
(0, _react.useEffect)(() => {
|
|
39
|
+
dispatch((0, _Actions.unselectAllRows)());
|
|
40
|
+
}, [queryVariables]);
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* use context to provide table state to wrapper component
|
|
@@ -90,17 +92,6 @@ const PaginatedTable = _ref => {
|
|
|
90
92
|
pageNumb: newPage
|
|
91
93
|
}));
|
|
92
94
|
};
|
|
93
|
-
// custonize pagination behavior
|
|
94
|
-
const {
|
|
95
|
-
customizeOnRowSelect,
|
|
96
|
-
customizeToggleSelectAll,
|
|
97
|
-
customizeSortByColumn,
|
|
98
|
-
customizeChangePage,
|
|
99
|
-
customizeChangeRowsPerPage,
|
|
100
|
-
customizeColumnViewChange,
|
|
101
|
-
customizeDeleteRow,
|
|
102
|
-
customizeDeleteAllRows
|
|
103
|
-
} = paginationOptions;
|
|
104
95
|
|
|
105
96
|
/**
|
|
106
97
|
* update selected Ids
|
|
@@ -110,9 +101,19 @@ const PaginatedTable = _ref => {
|
|
|
110
101
|
const onRowSelectHandler = (event, row) => {
|
|
111
102
|
event.stopPropagation();
|
|
112
103
|
let selectedIds = [...table.selectedRows];
|
|
104
|
+
let hiddenSelectedRows = [...table.hiddenSelectedRows];
|
|
113
105
|
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);
|
|
116
117
|
} else {
|
|
117
118
|
selectedIds = selectedIds.reduce((acc, id) => {
|
|
118
119
|
if (selectedId !== id) {
|
|
@@ -120,10 +121,35 @@ const PaginatedTable = _ref => {
|
|
|
120
121
|
}
|
|
121
122
|
return acc;
|
|
122
123
|
}, []);
|
|
124
|
+
hiddenSelectedRows = hiddenSelectedRows.reduce((acc, hiddenObject) => {
|
|
125
|
+
if (JSON.stringify(hiddenNewObject) !== JSON.stringify(hiddenObject)) {
|
|
126
|
+
acc.push(hiddenObject);
|
|
127
|
+
}
|
|
128
|
+
return acc;
|
|
129
|
+
}, []);
|
|
123
130
|
}
|
|
124
131
|
dispatch((0, _Actions.onRowSeclect)(selectedIds));
|
|
132
|
+
dispatch((0, _Actions.onRowSelectHidden)(hiddenSelectedRows));
|
|
125
133
|
};
|
|
126
|
-
const handleToggleSelectAll = (event, Ids, includeIds) => {
|
|
134
|
+
const handleToggleSelectAll = (event, Ids, includeIds, rows) => {
|
|
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
|
+
}
|
|
127
153
|
if (event.target.checked && !includeIds) {
|
|
128
154
|
const selecedIds = Ids.concat(table.selectedRows);
|
|
129
155
|
dispatch((0, _Actions.onRowSeclect)(selecedIds));
|
|
@@ -150,7 +176,7 @@ const PaginatedTable = _ref => {
|
|
|
150
176
|
const handleColumnViewChange = column => {
|
|
151
177
|
const columns = table.columns.map(col => {
|
|
152
178
|
const updateColumnView = _objectSpread({}, col);
|
|
153
|
-
if (col.dataField
|
|
179
|
+
if (col.dataField === column.dataField) {
|
|
154
180
|
updateColumnView.display = !column.display;
|
|
155
181
|
}
|
|
156
182
|
return updateColumnView;
|
|
@@ -159,39 +185,6 @@ const PaginatedTable = _ref => {
|
|
|
159
185
|
columns
|
|
160
186
|
})));
|
|
161
187
|
};
|
|
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
|
-
|
|
195
188
|
/**
|
|
196
189
|
* A. client table
|
|
197
190
|
* table data provide by bento app (tblRows)
|
|
@@ -201,14 +194,12 @@ const PaginatedTable = _ref => {
|
|
|
201
194
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ClientController.default, {
|
|
202
195
|
tblRows: tblRows,
|
|
203
196
|
table: table,
|
|
204
|
-
onRowsPerPageChange:
|
|
205
|
-
onPageChange:
|
|
206
|
-
onRowSelectChange:
|
|
207
|
-
onToggleSelectAll:
|
|
208
|
-
onSortByColumn:
|
|
209
|
-
onColumnViewChange:
|
|
210
|
-
onDeleteRow: customizeDeleteRow || onDeleteRow,
|
|
211
|
-
onDeleteAllFiles: customizeDeleteAllRows || onDeleteAllRows,
|
|
197
|
+
onRowsPerPageChange: handleChangeRowsPerPage,
|
|
198
|
+
onPageChange: handleChangePage,
|
|
199
|
+
onRowSelectChange: onRowSelectHandler,
|
|
200
|
+
onToggleSelectAll: handleToggleSelectAll,
|
|
201
|
+
onSortByColumn: handleSortByColumn,
|
|
202
|
+
onColumnViewChange: handleColumnViewChange,
|
|
212
203
|
themeConfig: themeConfig
|
|
213
204
|
}));
|
|
214
205
|
}
|
|
@@ -227,15 +218,12 @@ const PaginatedTable = _ref => {
|
|
|
227
218
|
queryVariables: queryVariables,
|
|
228
219
|
totalRowCount: totalRowCount,
|
|
229
220
|
table: table,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
|
|
237
|
-
onDeleteRow: customizeDeleteRow || onDeleteRow,
|
|
238
|
-
onDeleteAllFiles: customizeDeleteAllRows || onDeleteAllRows,
|
|
221
|
+
onRowsPerPageChange: handleChangeRowsPerPage,
|
|
222
|
+
onPageChange: handleChangePage,
|
|
223
|
+
onRowSelectChange: onRowSelectHandler,
|
|
224
|
+
onToggleSelectAll: handleToggleSelectAll,
|
|
225
|
+
onSortByColumn: handleSortByColumn,
|
|
226
|
+
onColumnViewChange: handleColumnViewChange,
|
|
239
227
|
themeConfig: themeConfig
|
|
240
228
|
}));
|
|
241
229
|
};
|
|
@@ -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
|
+
|
|
@@ -22,13 +22,10 @@ const setSelectedRows = function setSelectedRows() {
|
|
|
22
22
|
let table = arguments.length > 1 ? arguments[1] : undefined;
|
|
23
23
|
const {
|
|
24
24
|
selectedRows,
|
|
25
|
-
dataKey
|
|
26
|
-
deletedRow
|
|
25
|
+
dataKey
|
|
27
26
|
} = table;
|
|
28
|
-
// checked selected row if deleted
|
|
29
|
-
const checkedRows = deletedRow !== null && deletedRow !== void 0 && deletedRow.isChecked ? [...selectedRows, deletedRow[dataKey]] : selectedRows;
|
|
30
27
|
const updateRows = [...rows].map(row => {
|
|
31
|
-
const isChecked = dataKey ?
|
|
28
|
+
const isChecked = dataKey ? selectedRows.indexOf(row[dataKey]) !== -1 : false;
|
|
32
29
|
return _objectSpread(_objectSpread({}, row), {}, {
|
|
33
30
|
isChecked
|
|
34
31
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setTotalRowCount = exports.onRowsPerPageChange = exports.
|
|
6
|
+
exports.unselectAllRows = exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSelectHidden = exports.onRowSeclect = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onChangeSortDirection = 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,11 +11,10 @@ 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',
|
|
14
15
|
SET_TOTAL_ROW_COUNT: 'SET_TOTAL_ROW_COUNT',
|
|
15
16
|
ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE',
|
|
16
|
-
|
|
17
|
-
ON_ROWS_DELETE: 'ON_ROWS_DELETE',
|
|
18
|
-
ON_ROW_DELETE: 'ON_ROW_DELETE'
|
|
17
|
+
UNSELECT_ALL_ROWS: 'UNSELECT_ALL_ROWS'
|
|
19
18
|
};
|
|
20
19
|
exports.actionTypes = actionTypes;
|
|
21
20
|
const onColumnViewChange = columns => ({
|
|
@@ -53,23 +52,17 @@ const onRowSeclect = rows => ({
|
|
|
53
52
|
payload: rows
|
|
54
53
|
});
|
|
55
54
|
exports.onRowSeclect = onRowSeclect;
|
|
55
|
+
const onRowSelectHidden = rows => ({
|
|
56
|
+
type: actionTypes.ON_ROW_SELECT_HIDDEN,
|
|
57
|
+
payload: rows
|
|
58
|
+
});
|
|
59
|
+
exports.onRowSelectHidden = onRowSelectHidden;
|
|
56
60
|
const setTotalRowCount = count => ({
|
|
57
61
|
type: actionTypes.SET_TOTAL_ROW_COUNT,
|
|
58
62
|
payload: count
|
|
59
63
|
});
|
|
60
64
|
exports.setTotalRowCount = setTotalRowCount;
|
|
61
|
-
const
|
|
62
|
-
type: actionTypes.
|
|
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
|
|
65
|
+
const unselectAllRows = () => ({
|
|
66
|
+
type: actionTypes.UNSELECT_ALL_ROWS
|
|
74
67
|
});
|
|
75
|
-
exports.
|
|
68
|
+
exports.unselectAllRows = unselectAllRows;
|
|
@@ -16,8 +16,6 @@ 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);
|
|
21
19
|
case _Actions.actionTypes.ON_COLUMN_SORT:
|
|
22
20
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
23
21
|
sortOrder: payload.sort,
|
|
@@ -38,6 +36,10 @@ const reducer = (state, action) => {
|
|
|
38
36
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
39
37
|
selectedRows: payload
|
|
40
38
|
});
|
|
39
|
+
case _Actions.actionTypes.ON_ROW_SELECT_HIDDEN:
|
|
40
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
41
|
+
hiddenSelectedRows: payload
|
|
42
|
+
});
|
|
41
43
|
case _Actions.actionTypes.ON_PAGE_AND_TOTAL_COUNT_CHANGE:
|
|
42
44
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
43
45
|
totalRowCount: payload.totalRowCount,
|
|
@@ -47,15 +49,10 @@ const reducer = (state, action) => {
|
|
|
47
49
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
48
50
|
totalRowCount: payload
|
|
49
51
|
});
|
|
50
|
-
case _Actions.actionTypes.
|
|
51
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
52
|
-
deletedRow: payload.deletedRow,
|
|
53
|
-
selectedRows: payload.selectedRows
|
|
54
|
-
});
|
|
55
|
-
case _Actions.actionTypes.ON_ROWS_DELETE:
|
|
52
|
+
case _Actions.actionTypes.UNSELECT_ALL_ROWS:
|
|
56
53
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
selectedRows: [],
|
|
55
|
+
hiddenSelectedRows: []
|
|
59
56
|
});
|
|
60
57
|
default:
|
|
61
58
|
return state;
|
package/dist/wrapper/Wrapper.js
CHANGED
|
@@ -8,6 +8,7 @@ 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"));
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
13
|
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
14
|
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; }
|
|
@@ -61,11 +62,9 @@ const Text = _ref2 => {
|
|
|
61
62
|
text,
|
|
62
63
|
clsName,
|
|
63
64
|
tag,
|
|
64
|
-
component = 'span',
|
|
65
65
|
Component
|
|
66
66
|
} = _ref2;
|
|
67
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
68
|
-
component: component,
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
69
68
|
className: clsName,
|
|
70
69
|
type: tag
|
|
71
70
|
}, text, Component && /*#__PURE__*/_react.default.createElement(Component, null));
|
|
@@ -79,7 +78,8 @@ const Text = _ref2 => {
|
|
|
79
78
|
const ViewComponent = props => {
|
|
80
79
|
const {
|
|
81
80
|
type,
|
|
82
|
-
|
|
81
|
+
CustomViewElem,
|
|
82
|
+
tooltipCofig
|
|
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 /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(CustomViewElem, null), tooltipCofig && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props));
|
|
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.items.map(item => /*#__PURE__*/_react.default.createElement(ViewComponent, _extends({}, item, props)))));
|
|
146
|
+
}, container.text && /*#__PURE__*/_react.default.createElement("p", null, /*#__PURE__*/_react.default.createElement("span", null, container.textTitle), container.text), container.items.map(item => /*#__PURE__*/_react.default.createElement(ViewComponent, _extends({}, item, props)))));
|
|
147
147
|
}));
|
|
148
148
|
};
|
|
149
149
|
const CustomWrapper = props => {
|
|
@@ -154,7 +154,8 @@ const CustomWrapper = props => {
|
|
|
154
154
|
section,
|
|
155
155
|
classes,
|
|
156
156
|
activeFilters,
|
|
157
|
-
tblDispatch
|
|
157
|
+
tblDispatch,
|
|
158
|
+
fileCount
|
|
158
159
|
} = props;
|
|
159
160
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(CustomLayout, {
|
|
160
161
|
configs: wrapConfig,
|
|
@@ -162,7 +163,8 @@ const CustomWrapper = props => {
|
|
|
162
163
|
section: section,
|
|
163
164
|
classes: classes,
|
|
164
165
|
activeFilters: activeFilters,
|
|
165
|
-
tblDispatch: tblDispatch
|
|
166
|
+
tblDispatch: tblDispatch,
|
|
167
|
+
fileCount: fileCount
|
|
166
168
|
}, children));
|
|
167
169
|
};
|
|
168
170
|
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 = 100000;
|
|
18
18
|
return queryVariables;
|
|
19
19
|
};
|
|
20
20
|
exports.getQueryVariables = getQueryVariables;
|
|
@@ -3,27 +3,57 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.ToolTipView = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
|
|
8
9
|
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"];
|
|
16
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
14
|
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); }
|
|
18
15
|
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; }
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const ToolTipView = props => {
|
|
17
|
+
const {
|
|
18
|
+
section,
|
|
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
|
+
};
|
|
22
53
|
const AddAllFilesComponent = props => {
|
|
23
54
|
const {
|
|
24
55
|
title,
|
|
25
56
|
clsName,
|
|
26
|
-
classes,
|
|
27
57
|
section,
|
|
28
58
|
addFileQuery,
|
|
29
59
|
responseKeys,
|
|
@@ -33,15 +63,9 @@ const AddAllFilesComponent = props => {
|
|
|
33
63
|
setOpenSnackbar,
|
|
34
64
|
client,
|
|
35
65
|
tooltipCofig,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
DisplayCustomText
|
|
66
|
+
fileCount,
|
|
67
|
+
cartFiles
|
|
39
68
|
} = props;
|
|
40
|
-
const _ref = buttonTooltipConfig || {},
|
|
41
|
-
{
|
|
42
|
-
title: tooltipTitle
|
|
43
|
-
} = _ref,
|
|
44
|
-
tooltipProps = _objectWithoutProperties(_ref, _excluded);
|
|
45
69
|
/**
|
|
46
70
|
* conditionally display dialog view
|
|
47
71
|
*/
|
|
@@ -58,26 +82,39 @@ const AddAllFilesComponent = props => {
|
|
|
58
82
|
variables: activeFilters,
|
|
59
83
|
query: addFileQuery
|
|
60
84
|
});
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
const cartCount = cartFiles.length;
|
|
86
|
+
if (fileCount <= 6000 && cartCount < 6000) {
|
|
87
|
+
fileIds().then(response => {
|
|
88
|
+
const data = response[responseKeys[0]];
|
|
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
|
+
}
|
|
75
112
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
113
|
+
return [];
|
|
114
|
+
});
|
|
115
|
+
} else {
|
|
116
|
+
setAlterDisplay(true);
|
|
117
|
+
}
|
|
81
118
|
};
|
|
82
119
|
|
|
83
120
|
/**
|
|
@@ -88,22 +125,14 @@ const AddAllFilesComponent = props => {
|
|
|
88
125
|
toggleOpen();
|
|
89
126
|
setOpenSnackbar(true);
|
|
90
127
|
};
|
|
91
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
92
|
-
title: tooltipTitle || '',
|
|
93
|
-
classes: {
|
|
94
|
-
tooltip: classes.customTooltip,
|
|
95
|
-
arrow: classes.customArrow
|
|
96
|
-
}
|
|
97
|
-
}, tooltipProps), /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
128
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
98
129
|
onClick: addAllFiles,
|
|
99
130
|
className: (0, _clsx.default)(clsName, "".concat(clsName, "_").concat(section)),
|
|
100
131
|
disableRipple: true
|
|
101
|
-
}, title)
|
|
132
|
+
}, title), tooltipCofig && /*#__PURE__*/_react.default.createElement(ToolTipView, props), /*#__PURE__*/_react.default.createElement(_AddToCartDialogView.default, {
|
|
102
133
|
open: openAddDialog,
|
|
103
134
|
onYesClick: addFilesToCart,
|
|
104
|
-
onNoClick: toggleOpen
|
|
105
|
-
DisplayCustomText: DisplayCustomText,
|
|
106
|
-
activeFilters: activeFilters
|
|
135
|
+
onNoClick: toggleOpen
|
|
107
136
|
}));
|
|
108
137
|
};
|
|
109
138
|
var _default = AddAllFilesComponent;
|
|
@@ -28,7 +28,8 @@ const AddFilesView = props => {
|
|
|
28
28
|
const {
|
|
29
29
|
btnType,
|
|
30
30
|
count,
|
|
31
|
-
alertMessage
|
|
31
|
+
alertMessage,
|
|
32
|
+
cartFiles
|
|
32
33
|
} = props;
|
|
33
34
|
/**
|
|
34
35
|
* snackbar state
|
|
@@ -46,11 +47,13 @@ const AddFilesView = props => {
|
|
|
46
47
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, btnTypes.ADD_SELECTED_FILES === btnType && /*#__PURE__*/_react.default.createElement(_AddSelectedFilesController.default, _extends({}, props, {
|
|
47
48
|
client: client,
|
|
48
49
|
setAlterDisplay: setAlterDisplay,
|
|
49
|
-
setOpenSnackbar: setOpenSnackbar
|
|
50
|
+
setOpenSnackbar: setOpenSnackbar,
|
|
51
|
+
cartFiles: cartFiles
|
|
50
52
|
})), btnTypes.ADD_ALL_FILES === btnType && /*#__PURE__*/_react.default.createElement(_AddAllView.default, _extends({}, props, {
|
|
51
53
|
client: client,
|
|
52
54
|
setAlterDisplay: setAlterDisplay,
|
|
53
|
-
setOpenSnackbar: setOpenSnackbar
|
|
55
|
+
setOpenSnackbar: setOpenSnackbar,
|
|
56
|
+
cartFiles: cartFiles
|
|
54
57
|
})), /*#__PURE__*/_react.default.createElement(_Snackbar.default, {
|
|
55
58
|
open: openSnackbar,
|
|
56
59
|
count: count,
|
|
@@ -12,16 +12,19 @@ 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"));
|
|
16
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
16
|
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); }
|
|
18
17
|
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; }
|
|
19
18
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const checkDuplicate = (cartFiles, ids) => {
|
|
20
|
+
let duplicateCount = 0;
|
|
21
|
+
for (let i = 0; i < cartFiles.length; i += 1) {
|
|
22
|
+
if (ids.includes(cartFiles[i])) {
|
|
23
|
+
duplicateCount += 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return duplicateCount;
|
|
27
|
+
};
|
|
25
28
|
const AddSelectedFilesController = props => {
|
|
26
29
|
const {
|
|
27
30
|
clsName,
|
|
@@ -33,9 +36,7 @@ const AddSelectedFilesController = props => {
|
|
|
33
36
|
setOpenSnackbar,
|
|
34
37
|
setAlterDisplay,
|
|
35
38
|
client,
|
|
36
|
-
|
|
37
|
-
applyActiveFilter = false,
|
|
38
|
-
activeFilters = {}
|
|
39
|
+
cartFiles
|
|
39
40
|
} = props;
|
|
40
41
|
const tableContext = (0, _react.useContext)(_ContextProvider.TableContext);
|
|
41
42
|
const {
|
|
@@ -45,52 +46,40 @@ const AddSelectedFilesController = props => {
|
|
|
45
46
|
selectedRows = [],
|
|
46
47
|
dispatch
|
|
47
48
|
} = context;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
first: 10000
|
|
51
|
-
}, activeFilterItems), {}, {
|
|
52
|
-
[dataKey]: selectedRows
|
|
53
|
-
});
|
|
54
|
-
|
|
49
|
+
const variables = {};
|
|
50
|
+
variables[dataKey] = selectedRows;
|
|
55
51
|
// add selected files id
|
|
56
52
|
const addSelectedFiles = () => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const ids = (0, _util.default)(response, responseKeys);
|
|
71
|
-
if (ids.length + filesInCart >= maxFileLimit) {
|
|
72
|
-
setAlterDisplay(true);
|
|
73
|
-
} else {
|
|
53
|
+
const fileIds = (0, _WrapperService.getFilesID)({
|
|
54
|
+
client,
|
|
55
|
+
variables,
|
|
56
|
+
fileIds: selectedRows,
|
|
57
|
+
query: addFileQuery
|
|
58
|
+
});
|
|
59
|
+
const cartCount = cartFiles.length;
|
|
60
|
+
fileIds().then(response => {
|
|
61
|
+
const idsInitial = response[responseKeys[0]] || [];
|
|
62
|
+
const ids = [...new Set(idsInitial)];
|
|
63
|
+
const fileCount = ids.length;
|
|
64
|
+
if (fileCount <= 6000 && cartCount < 6000) {
|
|
65
|
+
if (cartCount + fileCount <= 6000) {
|
|
74
66
|
addFiles(ids);
|
|
75
67
|
setOpenSnackbar(true);
|
|
76
68
|
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
|
+
}
|
|
77
78
|
}
|
|
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) {
|
|
87
|
-
setAlterDisplay(true);
|
|
88
79
|
} else {
|
|
89
|
-
|
|
90
|
-
setOpenSnackbar(true);
|
|
91
|
-
dispatch((0, _Actions.onRowSeclect)([]));
|
|
80
|
+
setAlterDisplay(true);
|
|
92
81
|
}
|
|
93
|
-
}
|
|
82
|
+
});
|
|
94
83
|
};
|
|
95
84
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_AddSelectedFilesView.default, _extends({}, props, {
|
|
96
85
|
eventHandler: addSelectedFiles,
|
|
@@ -7,11 +7,7 @@ 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"];
|
|
11
10
|
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; }
|
|
15
11
|
/**
|
|
16
12
|
* customize tooltips based on tooltipContent
|
|
17
13
|
* defined on dashboardTabData (tooltipContent)
|
|
@@ -39,7 +35,6 @@ const ToolTipView = props => {
|
|
|
39
35
|
arrow: classes.customArrow
|
|
40
36
|
}
|
|
41
37
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
42
|
-
className: "add_selected_file_tooltip_icon",
|
|
43
38
|
src: icon || src,
|
|
44
39
|
alt: alt
|
|
45
40
|
}));
|
|
@@ -50,38 +45,18 @@ const AddSelectedFileComponent = props => {
|
|
|
50
45
|
eventHandler,
|
|
51
46
|
title,
|
|
52
47
|
clsName,
|
|
53
|
-
classes,
|
|
54
48
|
disabled,
|
|
55
|
-
tooltipCofig
|
|
56
|
-
buttonTooltipConfig
|
|
49
|
+
tooltipCofig
|
|
57
50
|
} = props;
|
|
58
|
-
const _ref = buttonTooltipConfig || {},
|
|
59
|
-
{
|
|
60
|
-
title: tooltipTitle
|
|
61
|
-
} = _ref,
|
|
62
|
-
tooltipProps = _objectWithoutProperties(_ref, _excluded);
|
|
63
51
|
const addFiles = () => {
|
|
64
52
|
eventHandler();
|
|
65
53
|
};
|
|
66
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
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, {
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
75
55
|
onClick: addFiles,
|
|
76
56
|
className: clsName,
|
|
77
57
|
disableRipple: true,
|
|
78
|
-
disabled: disabled
|
|
79
|
-
|
|
80
|
-
margin: '0px'
|
|
81
|
-
}
|
|
82
|
-
}, title))), tooltipCofig && /*#__PURE__*/_react.default.createElement(ToolTipView, _extends({
|
|
83
|
-
classes: classes
|
|
84
|
-
}, props)));
|
|
58
|
+
disabled: disabled
|
|
59
|
+
}, title), tooltipCofig && /*#__PURE__*/_react.default.createElement(ToolTipView, props));
|
|
85
60
|
};
|
|
86
61
|
var _default = AddSelectedFileComponent;
|
|
87
62
|
exports.default = _default;
|
|
@@ -16,6 +16,7 @@ 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",
|
|
19
20
|
"aria-describedby": "alert-dialog-description"
|
|
20
21
|
}, /*#__PURE__*/_react.default.createElement(_core.DialogContent, {
|
|
21
22
|
className: "alter-content"
|
|
@@ -15,9 +15,7 @@ function AddToCartDialogView(props) {
|
|
|
15
15
|
onYesClick,
|
|
16
16
|
onNoClick,
|
|
17
17
|
cartWillFull = false,
|
|
18
|
-
alertMessage
|
|
19
|
-
DisplayCustomText,
|
|
20
|
-
activeFilters
|
|
18
|
+
alertMessage
|
|
21
19
|
} = props;
|
|
22
20
|
if (cartWillFull) {
|
|
23
21
|
return /*#__PURE__*/_react.default.createElement(_AddToCartDialogAlertView.default, {
|
|
@@ -28,19 +26,11 @@ function AddToCartDialogView(props) {
|
|
|
28
26
|
}
|
|
29
27
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Dialog, {
|
|
30
28
|
open: open,
|
|
29
|
+
"aria-labelledby": "alert-dialog-title",
|
|
31
30
|
"aria-describedby": "alert-dialog-description"
|
|
32
|
-
}, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null,
|
|
33
|
-
|
|
34
|
-
|
|
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, {
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
|
|
32
|
+
id: "alert-dialog-description"
|
|
33
|
+
}, "Are you sure to add All Files", ' ', numberOfFilesSelected, ' ', "to cart")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
44
34
|
className: "yesBtn",
|
|
45
35
|
onClick: () => onYesClick()
|
|
46
36
|
}, "Yes"), /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
@@ -5,20 +5,18 @@ 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");
|
|
9
8
|
var _AddFiles = require("./AddFiles");
|
|
10
9
|
var _ReduxAddFile = _interopRequireDefault(require("./ReduxAddFile"));
|
|
11
|
-
var
|
|
12
|
-
var _ButtonStyle = _interopRequireDefault(require("./ButtonStyle"));
|
|
10
|
+
var _ReduxDownloadManifestBtn = _interopRequireDefault(require("./ReduxDownloadManifestBtn"));
|
|
13
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
12
|
const ButtonView = props => {
|
|
15
13
|
const {
|
|
16
14
|
btnType
|
|
17
15
|
} = props;
|
|
18
16
|
if (_AddFiles.btnTypes.DOWNLOAD_MANIFEST === btnType) {
|
|
19
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_ReduxDownloadManifestBtn.default, props);
|
|
20
18
|
}
|
|
21
19
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ReduxAddFile.default, props));
|
|
22
20
|
};
|
|
23
|
-
var _default =
|
|
21
|
+
var _default = ButtonView;
|
|
24
22
|
exports.default = _default;
|
|
@@ -21,7 +21,8 @@ const DownloadManifestView = props => {
|
|
|
21
21
|
const {
|
|
22
22
|
tooltipCofig,
|
|
23
23
|
clsName,
|
|
24
|
-
title
|
|
24
|
+
title,
|
|
25
|
+
cartFiles
|
|
25
26
|
} = props;
|
|
26
27
|
/**
|
|
27
28
|
* get cart state
|
|
@@ -39,13 +40,6 @@ const DownloadManifestView = props => {
|
|
|
39
40
|
variables.first = 10000;
|
|
40
41
|
return variables;
|
|
41
42
|
};
|
|
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
|
-
});
|
|
49
43
|
const client = (0, _client.useApolloClient)();
|
|
50
44
|
async function fetchData(_ref) {
|
|
51
45
|
let {
|
|
@@ -53,18 +47,9 @@ const DownloadManifestView = props => {
|
|
|
53
47
|
table
|
|
54
48
|
} = _ref;
|
|
55
49
|
const fetchResult = await client.query({
|
|
56
|
-
query: table.
|
|
50
|
+
query: table.api,
|
|
57
51
|
variables: _objectSpread({}, getQueryVeriables(queryVariables))
|
|
58
|
-
}).then(result => result.data.filesInList)
|
|
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
|
-
});
|
|
52
|
+
}).then(result => result.data.filesInList);
|
|
68
53
|
return fetchResult;
|
|
69
54
|
}
|
|
70
55
|
async function DocumentDownload() {
|
|
@@ -83,6 +68,7 @@ const DownloadManifestView = props => {
|
|
|
83
68
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
84
69
|
className: clsName,
|
|
85
70
|
disableRipple: true,
|
|
71
|
+
disabled: cartFiles.length === 0,
|
|
86
72
|
onClick: () => DocumentDownload()
|
|
87
73
|
}, title), tooltipCofig && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props));
|
|
88
74
|
};
|
|
@@ -15,7 +15,8 @@ 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
|
|
18
|
+
count: state.cartReducer && state.cartReducer.count,
|
|
19
|
+
cartFiles: state.cartReducer && state.cartReducer.filesId
|
|
19
20
|
});
|
|
20
21
|
const mapDispatchToProps = dispatch => ({
|
|
21
22
|
addFiles: files => {
|
|
@@ -0,0 +1,16 @@
|
|
|
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;
|
|
@@ -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 your cart"))
|
|
37
37
|
}));
|
|
38
38
|
};
|
|
39
39
|
var _default = SnackbarView;
|
|
@@ -11,8 +11,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
11
11
|
const TextFieldView = _ref => {
|
|
12
12
|
let {
|
|
13
13
|
clsName,
|
|
14
|
-
placeholder
|
|
15
|
-
ariaLabel
|
|
14
|
+
placeholder
|
|
16
15
|
} = _ref;
|
|
17
16
|
const [text, setText] = (0, _react.useState)('');
|
|
18
17
|
const cartContext = (0, _react.useContext)(_cart.CartContext);
|
|
@@ -31,7 +30,6 @@ const TextFieldView = _ref => {
|
|
|
31
30
|
},
|
|
32
31
|
className: clsName,
|
|
33
32
|
placeholder: placeholder,
|
|
34
|
-
"aria-label": ariaLabel,
|
|
35
33
|
id: "multiline-user-coments"
|
|
36
34
|
});
|
|
37
35
|
};
|
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.28",
|
|
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",
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1,33 +0,0 @@
|
|
|
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;
|