@bento-core/paginated-table 1.0.0-c3dc.24 → 1.0.0-c3dc.26
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.
|
@@ -35,6 +35,9 @@ const PaginatedTable = _ref => {
|
|
|
35
35
|
* 3. Add all btn / Add file button also dispatch action to update table state
|
|
36
36
|
*/
|
|
37
37
|
const [table, dispatch] = (0, _react.useReducer)(_Reducer.default, {}, initState);
|
|
38
|
+
(0, _react.useEffect)(() => {
|
|
39
|
+
dispatch((0, _Actions.unselectAllRows)());
|
|
40
|
+
}, [queryVariables]);
|
|
38
41
|
|
|
39
42
|
/**
|
|
40
43
|
* use context to provide table state to wrapper component
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSelectHidden = exports.onRowSeclect = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onChangeSortDirection = exports.actionTypes = void 0;
|
|
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',
|
|
@@ -13,7 +13,8 @@ const actionTypes = {
|
|
|
13
13
|
ON_ROW_SELECT: 'ON_ROW_SELECT',
|
|
14
14
|
ON_ROW_SELECT_HIDDEN: 'ON_ROW_SELECT_HIDDEN',
|
|
15
15
|
SET_TOTAL_ROW_COUNT: 'SET_TOTAL_ROW_COUNT',
|
|
16
|
-
ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE'
|
|
16
|
+
ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE',
|
|
17
|
+
UNSELECT_ALL_ROWS: 'UNSELECT_ALL_ROWS'
|
|
17
18
|
};
|
|
18
19
|
exports.actionTypes = actionTypes;
|
|
19
20
|
const onColumnViewChange = columns => ({
|
|
@@ -60,4 +61,8 @@ const setTotalRowCount = count => ({
|
|
|
60
61
|
type: actionTypes.SET_TOTAL_ROW_COUNT,
|
|
61
62
|
payload: count
|
|
62
63
|
});
|
|
63
|
-
exports.setTotalRowCount = setTotalRowCount;
|
|
64
|
+
exports.setTotalRowCount = setTotalRowCount;
|
|
65
|
+
const unselectAllRows = () => ({
|
|
66
|
+
type: actionTypes.UNSELECT_ALL_ROWS
|
|
67
|
+
});
|
|
68
|
+
exports.unselectAllRows = unselectAllRows;
|
|
@@ -49,6 +49,11 @@ const reducer = (state, action) => {
|
|
|
49
49
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
50
50
|
totalRowCount: payload
|
|
51
51
|
});
|
|
52
|
+
case _Actions.actionTypes.UNSELECT_ALL_ROWS:
|
|
53
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
54
|
+
selectedRows: [],
|
|
55
|
+
hiddenSelectedRows: []
|
|
56
|
+
});
|
|
52
57
|
default:
|
|
53
58
|
return state;
|
|
54
59
|
}
|
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.26",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@bento-core/cart": "1.0.1-ccdihub.7",
|
|
19
|
-
"@bento-core/table": "^1.0.0-c3dc.
|
|
19
|
+
"@bento-core/table": "^1.0.0-c3dc.24",
|
|
20
20
|
"@bento-core/tool-tip": "^1.0.0",
|
|
21
21
|
"@bento-core/util": "^1.0.0"
|
|
22
22
|
},
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
onPageAndTotalCountChange,
|
|
11
11
|
onColumnViewChange,
|
|
12
12
|
onRowSelectHidden,
|
|
13
|
+
unselectAllRows,
|
|
13
14
|
} from './state/Actions';
|
|
14
15
|
import { TableContext } from './ContextProvider';
|
|
15
16
|
import reducer from './state/Reducer';
|
|
@@ -30,6 +31,9 @@ const PaginatedTable = ({
|
|
|
30
31
|
* 3. Add all btn / Add file button also dispatch action to update table state
|
|
31
32
|
*/
|
|
32
33
|
const [table, dispatch] = useReducer(reducer, {}, initState);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
dispatch(unselectAllRows());
|
|
36
|
+
}, [queryVariables]);
|
|
33
37
|
|
|
34
38
|
/**
|
|
35
39
|
* use context to provide table state to wrapper component
|
|
@@ -8,6 +8,7 @@ export const actionTypes = {
|
|
|
8
8
|
ON_ROW_SELECT_HIDDEN: 'ON_ROW_SELECT_HIDDEN',
|
|
9
9
|
SET_TOTAL_ROW_COUNT: 'SET_TOTAL_ROW_COUNT',
|
|
10
10
|
ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE',
|
|
11
|
+
UNSELECT_ALL_ROWS: 'UNSELECT_ALL_ROWS',
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export const onColumnViewChange = (columns) => ({
|
|
@@ -54,3 +55,7 @@ export const setTotalRowCount = (count) => ({
|
|
|
54
55
|
type: actionTypes.SET_TOTAL_ROW_COUNT,
|
|
55
56
|
payload: count,
|
|
56
57
|
});
|
|
58
|
+
|
|
59
|
+
export const unselectAllRows = () => ({
|
|
60
|
+
type: actionTypes.UNSELECT_ALL_ROWS,
|
|
61
|
+
});
|