@bento-core/paginated-table 1.0.1-ccdihub.9 → 1.0.1-ctdc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Add_ALL_Files__BLUE_ButtonREADME.md +86 -0
- package/Add_Selected_Files_Orange_button_README.md +79 -0
- package/dist/index.js +13 -0
- package/dist/table/ClientController.js +1 -0
- package/dist/table/PaginatedTable.js +25 -14
- package/dist/table/state/Actions.js +9 -3
- package/dist/table/state/Reducer.js +2 -0
- package/dist/wrapper/Wrapper.js +4 -2
- package/dist/wrapper/WrapperService.js +1 -1
- package/dist/wrapper/components/AddAllFiles/AddAllView.js +12 -43
- package/dist/wrapper/components/AddSelectedFiles/AddSelectedFilesController.js +18 -5
- package/dist/wrapper/components/AddSelectedFiles/AddSelectedFilesView.js +1 -0
- package/dist/wrapper/components/AddToCartDialog/AddToCartDialogView.js +21 -9
- package/dist/wrapper/components/DownloadManifestBtn.js +21 -4
- package/dist/wrapper/components/Snackbar/Snackbar.js +1 -1
- package/dist/wrapper/components/util.js +33 -0
- package/package.json +8 -14
- package/src/index.js +4 -0
- package/src/table/ClientController.js +1 -0
- package/src/table/PaginatedTable.js +24 -13
- package/src/table/state/Actions.js +6 -0
- package/src/table/state/Reducer.js +5 -0
- package/src/wrapper/Wrapper.js +2 -0
- package/src/wrapper/WrapperService.js +1 -1
- package/src/wrapper/components/AddAllFiles/AddAllView.js +8 -40
- package/src/wrapper/components/AddSelectedFiles/AddSelectedFilesController.js +16 -4
- package/src/wrapper/components/AddSelectedFiles/AddSelectedFilesView.js +1 -1
- package/src/wrapper/components/AddToCartDialog/AddToCartDialogView.js +37 -14
- package/src/wrapper/components/DownloadManifestBtn.js +44 -7
- package/src/wrapper/components/Snackbar/Snackbar.js +1 -1
- package/src/wrapper/components/downloadFileManifestDialog.js +138 -0
- package/src/wrapper/components/util.js +26 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
### 1 Use bento-core/paginated-table package version publish by ICDC
|
|
3
|
+
Alternative configuratoin for BLUE button
|
|
4
|
+
```
|
|
5
|
+
// 1.0.1-icdc.3
|
|
6
|
+
npm i @bento-core/paginated-table@1.0.1-icdc.3
|
|
7
|
+
|
|
8
|
+
or in package.json
|
|
9
|
+
{
|
|
10
|
+
@bento-core/paginated-table: '1.0.1-icdc.3'
|
|
11
|
+
}
|
|
12
|
+
```
|
|
13
|
+
**NOTE: Create a new dashboard page using bento-core components before removing old dashboard page**
|
|
14
|
+
<br>
|
|
15
|
+
<span style="color:red">
|
|
16
|
+
Assuming New Dashboard page have Filter component and table component from bento-core
|
|
17
|
+
</span>.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### 2 Configure Add_All_Button Or BLUE Button in Dashboard
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
import React, { useCallback } from 'react';
|
|
25
|
+
import { ButtonView, btnTypes } from '@bento-core/paginated-table';
|
|
26
|
+
|
|
27
|
+
const AddAllBlueButton = useCallback(() => (
|
|
28
|
+
<ButtonView
|
|
29
|
+
btnType={btnTypes.ADD_ALL_FILES}
|
|
30
|
+
title="Add All Files Btn"
|
|
31
|
+
clsName="add_all_button"
|
|
32
|
+
maxFileLimit={10000}
|
|
33
|
+
addFileQuery={GET_ALL_FILEIDS_CASESTAB_FOR_SELECT_ALL}
|
|
34
|
+
responseKeys={['caseOverview', 'files']}
|
|
35
|
+
activeFilters={activeFilters}
|
|
36
|
+
classes={classes}
|
|
37
|
+
section="toolTipText"
|
|
38
|
+
tooltipCofig={{
|
|
39
|
+
arrow: true,
|
|
40
|
+
clsName: 'addAllTooltip',
|
|
41
|
+
toolTipText: 'Add filtered files associated with all cases',
|
|
42
|
+
icon: 'https://raw.githubusercontent.com/CBIIT/datacommons-assets/main/icdc/images/svgs/Tooltip.SpeechBubble.svg',
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
), []);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Add All Button Component or Configuration Properties**
|
|
49
|
+
| Component Props | Required | description | Configuration |
|
|
50
|
+
| :--- | :----:| :----: | ----: |
|
|
51
|
+
| btnType | TRUE | Determines the role of the button, add all files (blue) or add selected files (orange) | btnTypes.ADD_ALL_FILES, btnTypes.ADD_SELECTED_FILES or btnTypes.DOWNLOAD_MANIFEST |
|
|
52
|
+
| title | TRUE | text for the button | 'Add all files' |
|
|
53
|
+
| clsName | TRUE | configure theme with themeprovider | |
|
|
54
|
+
| maxFileLimit | FALSE | limits no of files that can be added to myCart | 0 - 10000 (by default 1000) |
|
|
55
|
+
| addFileQuery | TRUE | query to retrive files or file ids | graphQL query |
|
|
56
|
+
| responseKeys | TRUE | Keys to access file_ids reponse provided by addFileQuery, provided as list to access the nested respose object or list (max depth upto 2) | ['caseOverview', 'files'] |
|
|
57
|
+
| section | TRUE | This key is used for accessing the tootip text provided in tooltipCofig | section="toolTipText" |
|
|
58
|
+
| classes | TRUE | provide class for toltips to override the style | tooltip: classes.customTooltip, arrow: classes.customArrow
|
|
59
|
+
| tooltipCofig | FALSE | displays tooltip if provided, configuration for arrow, clsName, icon, tooltipText | graphQL query |
|
|
60
|
+
| activeFilters | TRUE | filtes the case or sample based on the active filters | graphQL query |
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### 3 Configure Add_All_Button Or BLUE Button in Dashboard
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
const customTheme = {
|
|
67
|
+
MuiContainer: {
|
|
68
|
+
root: {
|
|
69
|
+
'& img': {
|
|
70
|
+
width: '17px',
|
|
71
|
+
'&.addAllTooltip': {
|
|
72
|
+
verticalAlign: 'top',
|
|
73
|
+
marginTop: '8px',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const btnTheme = createTheme({ overrides: { ...customTheme } });
|
|
81
|
+
<ThemeProvider theme={btnTheme}>
|
|
82
|
+
<Container>
|
|
83
|
+
<AddAllBlueButton /> // from step 2
|
|
84
|
+
</Container>
|
|
85
|
+
</ThemeProvider>
|
|
86
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
|
|
2
|
+
### 1 Use bento-core/paginated-table package version publish by ICDC
|
|
3
|
+
Alternative configuration for ORANGE button
|
|
4
|
+
```
|
|
5
|
+
// 1.0.1-icdc.3
|
|
6
|
+
npm i @bento-core/paginated-table@1.0.1-icdc.3
|
|
7
|
+
|
|
8
|
+
or in package.json
|
|
9
|
+
{
|
|
10
|
+
@bento-core/paginated-table: '1.0.1-icdc.3'
|
|
11
|
+
}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
<span style="color:red">
|
|
15
|
+
Assuming table component is imported from bento-core/paginated-table
|
|
16
|
+
</span>
|
|
17
|
+
|
|
18
|
+
### 2 Configure Add_All_Button Or BLUE Button in Dashboard
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
import React, { useCallback } from 'react';
|
|
22
|
+
import { ButtonView, btnTypes } from '@bento-core/paginated-table';
|
|
23
|
+
|
|
24
|
+
const AddSelectedFilesOrangeButton = useCallback(() => (
|
|
25
|
+
<ButtonView
|
|
26
|
+
btnType={btnTypes.ADD_SELECTED_FILES}
|
|
27
|
+
title="ADD SELECTED FILES Btn"
|
|
28
|
+
clsName="add_selected_button"
|
|
29
|
+
dataKey="case_ids"
|
|
30
|
+
addFileQuery={GET_ALL_FILEIDS_CASESTAB_FOR_SELECT_ALL}
|
|
31
|
+
responseKeys={['caseOverview', 'files']}
|
|
32
|
+
classes={classes}
|
|
33
|
+
tooltipCofig={{
|
|
34
|
+
arrow: true,
|
|
35
|
+
clsName: 'addSelectedFileTooltip',
|
|
36
|
+
tooltipText: 'Add files associated selected cases',
|
|
37
|
+
icon: 'https://raw.githubusercontent.com/CBIIT/datacommons-assets/main/icdc/images/svgs/Tooltip.SpeechBubble.svg',
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
), []);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Add All Button Component or Configuration Properties**
|
|
44
|
+
| Component Props | Required | description | Configuration |
|
|
45
|
+
| :--- | :----:| :----: | ----: |
|
|
46
|
+
| btnType | TRUE | Determines the role of the button, add all files (blue) or add selected files (orange) | btnTypes.ADD_ALL_FILES, btnTypes.ADD_SELECTED_FILES or btnTypes.DOWNLOAD_MANIFEST |
|
|
47
|
+
| title | TRUE | text for the button | 'Add Selected files' |
|
|
48
|
+
| clsName | TRUE | configure theme with themeprovider | |
|
|
49
|
+
| addFileQuery | TRUE | query to retrive files or file ids | graphQL query |
|
|
50
|
+
| responseKeys | TRUE | Keys to access file_ids reponse provided by addFileQuery, provided as list to access the nested respose object or list (max depth upto 2) | ['caseOverview', 'files'] |
|
|
51
|
+
| classes | TRUE | provide class for toltips to override the style | tooltip: classes.customTooltip, arrow: classes.customArrow
|
|
52
|
+
| tooltipCofig | FALSE | displays tooltip if provided, configuration for arrow, clsName, icon, tooltipText | graphQL query |
|
|
53
|
+
| dataKey | TRUE | Attribute used for getting selected rows in a table | case_id, file_name or any other column with distinct values |
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### 3 Configure Add_All_Button Or BLUE Button in Dashboard
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
const customTheme = {
|
|
60
|
+
MuiContainer: {
|
|
61
|
+
root: {
|
|
62
|
+
'& img': {
|
|
63
|
+
width: '17px',
|
|
64
|
+
'&.addAllTooltip': {
|
|
65
|
+
verticalAlign: 'top',
|
|
66
|
+
marginTop: '8px',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const btnTheme = createTheme({ overrides: { ...customTheme } });
|
|
74
|
+
<ThemeProvider theme={btnTheme}>
|
|
75
|
+
<Container>
|
|
76
|
+
<AddSelectedFilesOrangeButton /> // from step 2
|
|
77
|
+
</Container>
|
|
78
|
+
</ThemeProvider>
|
|
79
|
+
```
|
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
|
|
@@ -89,6 +90,15 @@ const PaginatedTable = _ref => {
|
|
|
89
90
|
pageNumb: newPage
|
|
90
91
|
}));
|
|
91
92
|
};
|
|
93
|
+
// custonize pagination behavior
|
|
94
|
+
const {
|
|
95
|
+
customizeOnRowSelect,
|
|
96
|
+
customizeToggleSelectAll,
|
|
97
|
+
customizeSortByColumn,
|
|
98
|
+
customizeChangePage,
|
|
99
|
+
customizeChangeRowsPerPage,
|
|
100
|
+
customizeColumnViewChange
|
|
101
|
+
} = paginationOptions;
|
|
92
102
|
|
|
93
103
|
/**
|
|
94
104
|
* update selected Ids
|
|
@@ -138,7 +148,7 @@ const PaginatedTable = _ref => {
|
|
|
138
148
|
const handleColumnViewChange = column => {
|
|
139
149
|
const columns = table.columns.map(col => {
|
|
140
150
|
const updateColumnView = _objectSpread({}, col);
|
|
141
|
-
if (col.dataField === column.dataField) {
|
|
151
|
+
if (col.dataField && col.dataField === column.dataField) {
|
|
142
152
|
updateColumnView.display = !column.display;
|
|
143
153
|
}
|
|
144
154
|
return updateColumnView;
|
|
@@ -156,12 +166,12 @@ const PaginatedTable = _ref => {
|
|
|
156
166
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ClientController.default, {
|
|
157
167
|
tblRows: tblRows,
|
|
158
168
|
table: table,
|
|
159
|
-
onRowsPerPageChange: handleChangeRowsPerPage,
|
|
160
|
-
onPageChange: handleChangePage,
|
|
161
|
-
onRowSelectChange: onRowSelectHandler,
|
|
162
|
-
onToggleSelectAll: handleToggleSelectAll,
|
|
163
|
-
onSortByColumn: handleSortByColumn,
|
|
164
|
-
onColumnViewChange: handleColumnViewChange,
|
|
169
|
+
onRowsPerPageChange: customizeChangeRowsPerPage || handleChangeRowsPerPage,
|
|
170
|
+
onPageChange: customizeChangePage || handleChangePage,
|
|
171
|
+
onRowSelectChange: customizeOnRowSelect || onRowSelectHandler,
|
|
172
|
+
onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
|
|
173
|
+
onSortByColumn: customizeSortByColumn || handleSortByColumn,
|
|
174
|
+
onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
|
|
165
175
|
themeConfig: themeConfig
|
|
166
176
|
}));
|
|
167
177
|
}
|
|
@@ -180,12 +190,13 @@ const PaginatedTable = _ref => {
|
|
|
180
190
|
queryVariables: queryVariables,
|
|
181
191
|
totalRowCount: totalRowCount,
|
|
182
192
|
table: table,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
193
|
+
server: server,
|
|
194
|
+
onRowsPerPageChange: customizeChangeRowsPerPage || handleChangeRowsPerPage,
|
|
195
|
+
onPageChange: customizeChangePage || handleChangePage,
|
|
196
|
+
onRowSelectChange: customizeOnRowSelect || onRowSelectHandler,
|
|
197
|
+
onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
|
|
198
|
+
onSortByColumn: customizeSortByColumn || handleSortByColumn,
|
|
199
|
+
onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
|
|
189
200
|
themeConfig: themeConfig
|
|
190
201
|
}));
|
|
191
202
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSeclect = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onChangeSortDirection = exports.actionTypes = void 0;
|
|
6
|
+
exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSeclect = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onChangeSortDirection = exports.customPaginationAction = exports.actionTypes = void 0;
|
|
7
7
|
const actionTypes = {
|
|
8
8
|
VIEW_COLUMN_CHANGE: 'VIEW_COLUMN_CHANGE',
|
|
9
9
|
ON_COLUMN_SORT: 'ON_COLUMN_SORT',
|
|
@@ -12,7 +12,8 @@ const actionTypes = {
|
|
|
12
12
|
ON_PAGE_CHANGE: 'ON_PAGE_CHANGE',
|
|
13
13
|
ON_ROW_SELECT: 'ON_ROW_SELECT',
|
|
14
14
|
SET_TOTAL_ROW_COUNT: 'SET_TOTAL_ROW_COUNT',
|
|
15
|
-
ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE'
|
|
15
|
+
ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE',
|
|
16
|
+
CUSTOMIZE_PAGINATION_ACTION: 'CUSTOMIZE_PAGINATION_ACTION'
|
|
16
17
|
};
|
|
17
18
|
exports.actionTypes = actionTypes;
|
|
18
19
|
const onColumnViewChange = columns => ({
|
|
@@ -54,4 +55,9 @@ const setTotalRowCount = count => ({
|
|
|
54
55
|
type: actionTypes.SET_TOTAL_ROW_COUNT,
|
|
55
56
|
payload: count
|
|
56
57
|
});
|
|
57
|
-
exports.setTotalRowCount = setTotalRowCount;
|
|
58
|
+
exports.setTotalRowCount = setTotalRowCount;
|
|
59
|
+
const customPaginationAction = value => ({
|
|
60
|
+
type: actionTypes.CUSTOMIZE_PAGINATION_ACTION,
|
|
61
|
+
payload: value
|
|
62
|
+
});
|
|
63
|
+
exports.customPaginationAction = customPaginationAction;
|
|
@@ -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,
|
package/dist/wrapper/Wrapper.js
CHANGED
|
@@ -152,7 +152,8 @@ const CustomWrapper = props => {
|
|
|
152
152
|
section,
|
|
153
153
|
classes,
|
|
154
154
|
activeFilters,
|
|
155
|
-
tblDispatch
|
|
155
|
+
tblDispatch,
|
|
156
|
+
totalRowCount
|
|
156
157
|
} = props;
|
|
157
158
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(CustomLayout, {
|
|
158
159
|
configs: wrapConfig,
|
|
@@ -160,7 +161,8 @@ const CustomWrapper = props => {
|
|
|
160
161
|
section: section,
|
|
161
162
|
classes: classes,
|
|
162
163
|
activeFilters: activeFilters,
|
|
163
|
-
tblDispatch: tblDispatch
|
|
164
|
+
tblDispatch: tblDispatch,
|
|
165
|
+
totalRowCount: totalRowCount
|
|
164
166
|
}, children));
|
|
165
167
|
};
|
|
166
168
|
var _default = CustomWrapper;
|
|
@@ -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,44 +3,17 @@
|
|
|
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");
|
|
10
9
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
10
|
var _WrapperService = require("../../WrapperService");
|
|
12
11
|
var _AddToCartDialogView = _interopRequireDefault(require("../AddToCartDialog/AddToCartDialogView"));
|
|
12
|
+
var _TooltipView = _interopRequireDefault(require("../TooltipView"));
|
|
13
|
+
var _util = _interopRequireDefault(require("../util"));
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
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
17
|
const AddAllFilesComponent = props => {
|
|
45
18
|
const {
|
|
46
19
|
title,
|
|
@@ -53,7 +26,9 @@ const AddAllFilesComponent = props => {
|
|
|
53
26
|
setAlterDisplay,
|
|
54
27
|
setOpenSnackbar,
|
|
55
28
|
client,
|
|
56
|
-
tooltipCofig
|
|
29
|
+
tooltipCofig,
|
|
30
|
+
maxFileLimit = 1000,
|
|
31
|
+
DisplayCustomText
|
|
57
32
|
} = props;
|
|
58
33
|
/**
|
|
59
34
|
* conditionally display dialog view
|
|
@@ -74,16 +49,8 @@ const AddAllFilesComponent = props => {
|
|
|
74
49
|
fileIds().then(response => {
|
|
75
50
|
const data = response[responseKeys[0]];
|
|
76
51
|
if (data && data.length > 0) {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
if (id && id[responseKeys[1]]) {
|
|
80
|
-
// if object convert to array
|
|
81
|
-
const items = isArray ? id[responseKeys[1]] : [id[responseKeys[1]]];
|
|
82
|
-
acc.push(...items);
|
|
83
|
-
}
|
|
84
|
-
return acc;
|
|
85
|
-
}, []);
|
|
86
|
-
if (ids.length > 1000) {
|
|
52
|
+
const ids = (0, _util.default)(response, responseKeys);
|
|
53
|
+
if (ids.length > maxFileLimit) {
|
|
87
54
|
setAlterDisplay(true);
|
|
88
55
|
} else {
|
|
89
56
|
setOpen(true);
|
|
@@ -108,10 +75,12 @@ const AddAllFilesComponent = props => {
|
|
|
108
75
|
onClick: addAllFiles,
|
|
109
76
|
className: (0, _clsx.default)(clsName, "".concat(clsName, "_").concat(section)),
|
|
110
77
|
disableRipple: true
|
|
111
|
-
}, title), tooltipCofig && /*#__PURE__*/_react.default.createElement(
|
|
78
|
+
}, title), tooltipCofig && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), /*#__PURE__*/_react.default.createElement(_AddToCartDialogView.default, {
|
|
112
79
|
open: openAddDialog,
|
|
113
80
|
onYesClick: addFilesToCart,
|
|
114
|
-
onNoClick: toggleOpen
|
|
81
|
+
onNoClick: toggleOpen,
|
|
82
|
+
DisplayCustomText: DisplayCustomText,
|
|
83
|
+
activeFilters: activeFilters
|
|
115
84
|
}));
|
|
116
85
|
};
|
|
117
86
|
var _default = AddAllFilesComponent;
|
|
@@ -12,10 +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); }
|
|
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); }
|
|
19
25
|
const AddSelectedFilesController = props => {
|
|
20
26
|
const {
|
|
21
27
|
clsName,
|
|
@@ -26,7 +32,10 @@ const AddSelectedFilesController = props => {
|
|
|
26
32
|
addFiles,
|
|
27
33
|
setOpenSnackbar,
|
|
28
34
|
setAlterDisplay,
|
|
29
|
-
client
|
|
35
|
+
client,
|
|
36
|
+
maxFileLimit = 1000,
|
|
37
|
+
applyActiveFilter = false,
|
|
38
|
+
activeFilters = {}
|
|
30
39
|
} = props;
|
|
31
40
|
const tableContext = (0, _react.useContext)(_ContextProvider.TableContext);
|
|
32
41
|
const {
|
|
@@ -36,8 +45,12 @@ const AddSelectedFilesController = props => {
|
|
|
36
45
|
selectedRows = [],
|
|
37
46
|
dispatch
|
|
38
47
|
} = context;
|
|
39
|
-
const
|
|
40
|
-
variables
|
|
48
|
+
const activeFilterItems = applyActiveFilter ? _objectSpread({}, activeFilters) : {};
|
|
49
|
+
const variables = _objectSpread(_objectSpread({
|
|
50
|
+
first: 10000
|
|
51
|
+
}, activeFilterItems), {}, {
|
|
52
|
+
[dataKey]: selectedRows
|
|
53
|
+
});
|
|
41
54
|
// add selected files id
|
|
42
55
|
const addSelectedFiles = () => {
|
|
43
56
|
const fileIds = (0, _WrapperService.getFilesID)({
|
|
@@ -47,8 +60,8 @@ const AddSelectedFilesController = props => {
|
|
|
47
60
|
query: addFileQuery
|
|
48
61
|
});
|
|
49
62
|
fileIds().then(response => {
|
|
50
|
-
const ids =
|
|
51
|
-
if (ids.length >=
|
|
63
|
+
const ids = (0, _util.default)(response, responseKeys);
|
|
64
|
+
if (ids.length >= maxFileLimit) {
|
|
52
65
|
setAlterDisplay(true);
|
|
53
66
|
} else {
|
|
54
67
|
addFiles(ids);
|
|
@@ -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, {
|
|
@@ -24,19 +26,29 @@ function AddToCartDialogView(props) {
|
|
|
24
26
|
onClose: () => onNoClick()
|
|
25
27
|
});
|
|
26
28
|
}
|
|
29
|
+
const CustomDialog = DisplayCustomText.component;
|
|
27
30
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Dialog, {
|
|
28
31
|
open: open,
|
|
29
32
|
"aria-labelledby": "alert-dialog-title",
|
|
30
33
|
"aria-describedby": "alert-dialog-description"
|
|
31
|
-
}, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, /*#__PURE__*/_react.default.createElement(
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, DisplayCustomText ? /*#__PURE__*/_react.default.createElement(CustomDialog, {
|
|
35
|
+
onYesClick: onYesClick,
|
|
36
|
+
onNoClick: onNoClick,
|
|
37
|
+
activeFilters: activeFilters
|
|
38
|
+
}) : /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
|
|
32
39
|
id: "alert-dialog-description"
|
|
33
|
-
}, "Are you sure to add All Files", ' ', numberOfFilesSelected, ' ', "to cart")), /*#__PURE__*/_react.default.createElement(_core.DialogActions,
|
|
34
|
-
className: "
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
}, "Are you sure to add All Files", ' ', numberOfFilesSelected, ' ', "to cart")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, {
|
|
41
|
+
className: "dialog_actions"
|
|
42
|
+
}, DisplayCustomText.actions.map(a => /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
43
|
+
className: a.className,
|
|
44
|
+
onClick: () => {
|
|
45
|
+
if (a.type === 'Positive') {
|
|
46
|
+
onYesClick();
|
|
47
|
+
} else {
|
|
48
|
+
onNoClick();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, a.label)))));
|
|
40
52
|
}
|
|
41
53
|
var _default = AddToCartDialogView;
|
|
42
54
|
exports.default = _default;
|
|
@@ -21,8 +21,15 @@ const DownloadManifestView = props => {
|
|
|
21
21
|
const {
|
|
22
22
|
tooltipCofig,
|
|
23
23
|
clsName,
|
|
24
|
-
title
|
|
24
|
+
title,
|
|
25
|
+
totalRowCount
|
|
25
26
|
} = props;
|
|
27
|
+
const {
|
|
28
|
+
icon,
|
|
29
|
+
alt,
|
|
30
|
+
arrow = false,
|
|
31
|
+
clsName: toolTipClsName
|
|
32
|
+
} = tooltipCofig;
|
|
26
33
|
/**
|
|
27
34
|
* get cart state
|
|
28
35
|
*/
|
|
@@ -48,7 +55,7 @@ const DownloadManifestView = props => {
|
|
|
48
55
|
const fetchResult = await client.query({
|
|
49
56
|
query: table.api,
|
|
50
57
|
variables: _objectSpread({}, getQueryVeriables(queryVariables))
|
|
51
|
-
}).then(result => result.data.filesInList);
|
|
58
|
+
}).then(result => table.objectKey ? result.data[table.objectKey] : result.data.filesInList);
|
|
52
59
|
return fetchResult;
|
|
53
60
|
}
|
|
54
61
|
async function DocumentDownload() {
|
|
@@ -67,8 +74,18 @@ const DownloadManifestView = props => {
|
|
|
67
74
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
68
75
|
className: clsName,
|
|
69
76
|
disableRipple: true,
|
|
70
|
-
onClick: () => DocumentDownload()
|
|
71
|
-
|
|
77
|
+
onClick: () => DocumentDownload(),
|
|
78
|
+
disabled: totalRowCount === 0
|
|
79
|
+
}, title), tooltipCofig && !tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), tooltipCofig && tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
80
|
+
arrow: arrow,
|
|
81
|
+
interactive: true,
|
|
82
|
+
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipCofig.customToolTipComponent),
|
|
83
|
+
placement: "bottom"
|
|
84
|
+
}, icon && /*#__PURE__*/_react.default.createElement("img", {
|
|
85
|
+
src: icon,
|
|
86
|
+
alt: alt,
|
|
87
|
+
className: toolTipClsName
|
|
88
|
+
})));
|
|
72
89
|
};
|
|
73
90
|
var _default = DownloadManifestView;
|
|
74
91
|
exports.default = _default;
|
|
@@ -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;
|
|
@@ -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 ids;
|
|
27
|
+
}
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
return response[responseKeys[0]] || [];
|
|
31
|
+
};
|
|
32
|
+
var _default = addFilesResponseHandler;
|
|
33
|
+
exports.default = _default;
|