@bento-core/paginated-table 1.0.1-popsci.0 → 1.0.1-popsci.2
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 +36 -16
- package/dist/table/README.md +2 -0
- 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 -13
- 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 +48 -6
- package/dist/wrapper/components/Snackbar/Snackbar.js +1 -1
- package/dist/wrapper/components/downloadFileManifestDialog.js +141 -0
- package/dist/wrapper/components/util.js +33 -0
- package/package.json +6 -5
- package/src/index.js +4 -0
- package/src/table/ClientController.js +1 -0
- package/src/table/PaginatedTable.js +34 -13
- package/src/table/README.md +2 -0
- 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 +10 -10
- 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 +54 -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
|
};
|
|
@@ -24,9 +24,12 @@ const PaginatedTable = _ref => {
|
|
|
24
24
|
themeConfig = {},
|
|
25
25
|
totalRowCount = 0,
|
|
26
26
|
initState,
|
|
27
|
+
checkedItemReset,
|
|
27
28
|
activeTab = true,
|
|
28
29
|
server = true,
|
|
29
|
-
tblRows = []
|
|
30
|
+
tblRows = [],
|
|
31
|
+
paginationOptions = {},
|
|
32
|
+
customTableHeader
|
|
30
33
|
} = _ref;
|
|
31
34
|
/**
|
|
32
35
|
* Initailize useReducer state
|
|
@@ -53,6 +56,11 @@ const PaginatedTable = _ref => {
|
|
|
53
56
|
dispatch
|
|
54
57
|
}));
|
|
55
58
|
}, [table]);
|
|
59
|
+
(0, _react.useEffect)(() => {
|
|
60
|
+
if (checkedItemReset) {
|
|
61
|
+
dispatch((0, _Actions.onRowSeclect)([]));
|
|
62
|
+
}
|
|
63
|
+
}, [checkedItemReset]);
|
|
56
64
|
|
|
57
65
|
/**
|
|
58
66
|
* update state to props change
|
|
@@ -89,6 +97,15 @@ const PaginatedTable = _ref => {
|
|
|
89
97
|
pageNumb: newPage
|
|
90
98
|
}));
|
|
91
99
|
};
|
|
100
|
+
// custonize pagination behavior
|
|
101
|
+
const {
|
|
102
|
+
customizeOnRowSelect,
|
|
103
|
+
customizeToggleSelectAll,
|
|
104
|
+
customizeSortByColumn,
|
|
105
|
+
customizeChangePage,
|
|
106
|
+
customizeChangeRowsPerPage,
|
|
107
|
+
customizeColumnViewChange
|
|
108
|
+
} = paginationOptions;
|
|
92
109
|
|
|
93
110
|
/**
|
|
94
111
|
* update selected Ids
|
|
@@ -138,7 +155,7 @@ const PaginatedTable = _ref => {
|
|
|
138
155
|
const handleColumnViewChange = column => {
|
|
139
156
|
const columns = table.columns.map(col => {
|
|
140
157
|
const updateColumnView = _objectSpread({}, col);
|
|
141
|
-
if (col.dataField === column.dataField) {
|
|
158
|
+
if (col.dataField && col.dataField === column.dataField) {
|
|
142
159
|
updateColumnView.display = !column.display;
|
|
143
160
|
}
|
|
144
161
|
return updateColumnView;
|
|
@@ -156,13 +173,14 @@ const PaginatedTable = _ref => {
|
|
|
156
173
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ClientController.default, {
|
|
157
174
|
tblRows: tblRows,
|
|
158
175
|
table: table,
|
|
159
|
-
onRowsPerPageChange: handleChangeRowsPerPage,
|
|
160
|
-
onPageChange: handleChangePage,
|
|
161
|
-
onRowSelectChange: onRowSelectHandler,
|
|
162
|
-
onToggleSelectAll: handleToggleSelectAll,
|
|
163
|
-
onSortByColumn: handleSortByColumn,
|
|
164
|
-
onColumnViewChange: handleColumnViewChange,
|
|
165
|
-
themeConfig: themeConfig
|
|
176
|
+
onRowsPerPageChange: customizeChangeRowsPerPage || handleChangeRowsPerPage,
|
|
177
|
+
onPageChange: customizeChangePage || handleChangePage,
|
|
178
|
+
onRowSelectChange: customizeOnRowSelect || onRowSelectHandler,
|
|
179
|
+
onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
|
|
180
|
+
onSortByColumn: customizeSortByColumn || handleSortByColumn,
|
|
181
|
+
onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
|
|
182
|
+
themeConfig: themeConfig,
|
|
183
|
+
customTableHeader: customTableHeader
|
|
166
184
|
}));
|
|
167
185
|
}
|
|
168
186
|
|
|
@@ -180,13 +198,15 @@ const PaginatedTable = _ref => {
|
|
|
180
198
|
queryVariables: queryVariables,
|
|
181
199
|
totalRowCount: totalRowCount,
|
|
182
200
|
table: table,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
201
|
+
server: server,
|
|
202
|
+
onRowsPerPageChange: customizeChangeRowsPerPage || handleChangeRowsPerPage,
|
|
203
|
+
onPageChange: customizeChangePage || handleChangePage,
|
|
204
|
+
onRowSelectChange: customizeOnRowSelect || onRowSelectHandler,
|
|
205
|
+
onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
|
|
206
|
+
onSortByColumn: customizeSortByColumn || handleSortByColumn,
|
|
207
|
+
onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
|
|
208
|
+
themeConfig: themeConfig,
|
|
209
|
+
customTableHeader: customTableHeader
|
|
190
210
|
}));
|
|
191
211
|
};
|
|
192
212
|
var _default = PaginatedTable;
|
package/dist/table/README.md
CHANGED
|
@@ -58,6 +58,7 @@ import TableView from 'bento-core/PaginationTable/PaginatedTable';
|
|
|
58
58
|
activeFilters={activeFilters}
|
|
59
59
|
totalRowCount={dashboardStats[config.count]}
|
|
60
60
|
activeTab={activeTab}
|
|
61
|
+
customTableHeader={CustomTableHeader}
|
|
61
62
|
/>
|
|
62
63
|
```
|
|
63
64
|
|
|
@@ -69,6 +70,7 @@ import TableView from 'bento-core/PaginationTable/PaginatedTable';
|
|
|
69
70
|
| themeConfig | FALSE | override style with themeprovider use ClassName provided by bento-core table to apply style (refer to class name table) | |
|
|
70
71
|
| totalRowCount | TRUE | Total row cound for (Cases, Samples, Files), update based on filter event | |
|
|
71
72
|
| activeTab | TRUE | prevents http call for inactive tabs (dashboard) /set true to myFile cart | |
|
|
73
|
+
| customTableHeader | FALSE | Customizable table header that replaces the default `TableHeader` | |
|
|
72
74
|
|
|
73
75
|
## 3 Table component themeConfig Configuration
|
|
74
76
|
```
|
|
@@ -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;
|
|
@@ -9,6 +9,8 @@ var _core = require("@material-ui/core");
|
|
|
9
9
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _WrapperService = require("../../WrapperService");
|
|
11
11
|
var _AddToCartDialogView = _interopRequireDefault(require("../AddToCartDialog/AddToCartDialogView"));
|
|
12
|
+
var _TooltipView = _interopRequireDefault(require("../TooltipView"));
|
|
13
|
+
var _util = _interopRequireDefault(require("../util"));
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
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); }
|
|
14
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; }
|
|
@@ -23,7 +25,10 @@ const AddAllFilesComponent = props => {
|
|
|
23
25
|
addFiles,
|
|
24
26
|
setAlterDisplay,
|
|
25
27
|
setOpenSnackbar,
|
|
26
|
-
client
|
|
28
|
+
client,
|
|
29
|
+
tooltipCofig,
|
|
30
|
+
maxFileLimit = 1000,
|
|
31
|
+
DisplayCustomText
|
|
27
32
|
} = props;
|
|
28
33
|
/**
|
|
29
34
|
* conditionally display dialog view
|
|
@@ -44,16 +49,8 @@ const AddAllFilesComponent = props => {
|
|
|
44
49
|
fileIds().then(response => {
|
|
45
50
|
const data = response[responseKeys[0]];
|
|
46
51
|
if (data && data.length > 0) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
if (id && id[responseKeys[1]]) {
|
|
50
|
-
// if object convert to array
|
|
51
|
-
const items = isArray ? id[responseKeys[1]] : [id[responseKeys[1]]];
|
|
52
|
-
acc.push(...items);
|
|
53
|
-
}
|
|
54
|
-
return acc;
|
|
55
|
-
}, []);
|
|
56
|
-
if (ids.length > 1000) {
|
|
52
|
+
const ids = (0, _util.default)(response, responseKeys);
|
|
53
|
+
if (ids.length > maxFileLimit) {
|
|
57
54
|
setAlterDisplay(true);
|
|
58
55
|
} else {
|
|
59
56
|
setOpen(true);
|
|
@@ -78,10 +75,12 @@ const AddAllFilesComponent = props => {
|
|
|
78
75
|
onClick: addAllFiles,
|
|
79
76
|
className: (0, _clsx.default)(clsName, "".concat(clsName, "_").concat(section)),
|
|
80
77
|
disableRipple: true
|
|
81
|
-
}, title), /*#__PURE__*/_react.default.createElement(_AddToCartDialogView.default, {
|
|
78
|
+
}, title), tooltipCofig && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), /*#__PURE__*/_react.default.createElement(_AddToCartDialogView.default, {
|
|
82
79
|
open: openAddDialog,
|
|
83
80
|
onYesClick: addFilesToCart,
|
|
84
|
-
onNoClick: toggleOpen
|
|
81
|
+
onNoClick: toggleOpen,
|
|
82
|
+
DisplayCustomText: DisplayCustomText,
|
|
83
|
+
activeFilters: activeFilters
|
|
85
84
|
}));
|
|
86
85
|
};
|
|
87
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 && 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 && DisplayCustomText.actions && 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;
|
|
@@ -9,6 +9,7 @@ var _core = require("@material-ui/core");
|
|
|
9
9
|
var _client = require("@apollo/client");
|
|
10
10
|
var _cart = require("@bento-core/cart");
|
|
11
11
|
var _TooltipView = _interopRequireDefault(require("./TooltipView"));
|
|
12
|
+
var _downloadFileManifestDialog = _interopRequireDefault(require("./downloadFileManifestDialog"));
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
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); }
|
|
14
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,10 +20,18 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
19
20
|
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); }
|
|
20
21
|
const DownloadManifestView = props => {
|
|
21
22
|
const {
|
|
23
|
+
usePopup,
|
|
22
24
|
tooltipCofig,
|
|
23
25
|
clsName,
|
|
24
|
-
title
|
|
26
|
+
title,
|
|
27
|
+
totalRowCount
|
|
25
28
|
} = props;
|
|
29
|
+
const {
|
|
30
|
+
icon,
|
|
31
|
+
alt,
|
|
32
|
+
arrow = false,
|
|
33
|
+
clsName: toolTipClsName
|
|
34
|
+
} = tooltipCofig;
|
|
26
35
|
/**
|
|
27
36
|
* get cart state
|
|
28
37
|
*/
|
|
@@ -33,6 +42,9 @@ const DownloadManifestView = props => {
|
|
|
33
42
|
const {
|
|
34
43
|
cart
|
|
35
44
|
} = context;
|
|
45
|
+
const {
|
|
46
|
+
comment
|
|
47
|
+
} = cart;
|
|
36
48
|
const getQueryVeriables = queryVariables => {
|
|
37
49
|
const variables = _objectSpread({}, queryVariables);
|
|
38
50
|
variables.offset = 0;
|
|
@@ -48,10 +60,10 @@ const DownloadManifestView = props => {
|
|
|
48
60
|
const fetchResult = await client.query({
|
|
49
61
|
query: table.api,
|
|
50
62
|
variables: _objectSpread({}, getQueryVeriables(queryVariables))
|
|
51
|
-
}).then(result => result.data.filesInList);
|
|
63
|
+
}).then(result => table.objectKey ? result.data[table.objectKey] : result.data.filesInList);
|
|
52
64
|
return fetchResult;
|
|
53
65
|
}
|
|
54
|
-
async function DocumentDownload() {
|
|
66
|
+
async function DocumentDownload(commentD, header) {
|
|
55
67
|
const {
|
|
56
68
|
table,
|
|
57
69
|
queryVariables
|
|
@@ -61,14 +73,44 @@ const DownloadManifestView = props => {
|
|
|
61
73
|
table
|
|
62
74
|
});
|
|
63
75
|
return (0, _cart.downloadJson)(_objectSpread(_objectSpread({}, cart), {}, {
|
|
64
|
-
tableData
|
|
76
|
+
tableData,
|
|
77
|
+
commentD,
|
|
78
|
+
header
|
|
65
79
|
}));
|
|
66
80
|
}
|
|
81
|
+
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
82
|
+
const onDownloadClick = () => {
|
|
83
|
+
if (usePopup) {
|
|
84
|
+
setIsOpen(true);
|
|
85
|
+
} else {
|
|
86
|
+
DocumentDownload(comment, 'User_Comment');
|
|
87
|
+
}
|
|
88
|
+
};
|
|
67
89
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
68
90
|
className: clsName,
|
|
69
91
|
disableRipple: true,
|
|
70
|
-
onClick: () =>
|
|
71
|
-
|
|
92
|
+
onClick: () => {
|
|
93
|
+
onDownloadClick();
|
|
94
|
+
},
|
|
95
|
+
disabled: totalRowCount === 0
|
|
96
|
+
}, title), /*#__PURE__*/_react.default.createElement(_downloadFileManifestDialog.default, {
|
|
97
|
+
open: isOpen,
|
|
98
|
+
onClose: () => {
|
|
99
|
+
setIsOpen(false);
|
|
100
|
+
},
|
|
101
|
+
downloadSCSVFile: commentPopup => {
|
|
102
|
+
DocumentDownload(commentPopup, 'User_Comment');
|
|
103
|
+
}
|
|
104
|
+
}), tooltipCofig && !tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), tooltipCofig && tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
105
|
+
arrow: arrow,
|
|
106
|
+
interactive: true,
|
|
107
|
+
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipCofig.customToolTipComponent),
|
|
108
|
+
placement: "bottom"
|
|
109
|
+
}, icon && /*#__PURE__*/_react.default.createElement("img", {
|
|
110
|
+
src: icon,
|
|
111
|
+
alt: alt,
|
|
112
|
+
className: toolTipClsName
|
|
113
|
+
})));
|
|
72
114
|
};
|
|
73
115
|
var _default = DownloadManifestView;
|
|
74
116
|
exports.default = _default;
|