@bento-core/paginated-table 1.0.1-icdc.22 → 1.0.1-icdc.23

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 CHANGED
@@ -69,6 +69,12 @@ Object.defineProperty(exports, "onColumnViewChange", {
69
69
  return _Actions.onColumnViewChange;
70
70
  }
71
71
  });
72
+ Object.defineProperty(exports, "onInputSearchQueryChange", {
73
+ enumerable: true,
74
+ get: function get() {
75
+ return _Actions.onInputSearchQueryChange;
76
+ }
77
+ });
72
78
  Object.defineProperty(exports, "onPageAndTotalCountChange", {
73
79
  enumerable: true,
74
80
  get: function get() {
@@ -197,7 +197,7 @@ const PaginatedTable = _ref => {
197
197
  * Filter table rows based on Search query
198
198
  */
199
199
  const handleSeachQueryChange = value => {
200
- dispatch((0, _Actions.onSearchQueryChange)({
200
+ dispatch((0, _Actions.onInputSearchQueryChange)({
201
201
  searchQuery: value
202
202
  }));
203
203
  };
@@ -47,13 +47,15 @@ const getPaginatedQueryVariables = (queryVariables, table) => {
47
47
  page,
48
48
  rowsPerPage,
49
49
  sortBy,
50
- sortOrder
50
+ sortOrder,
51
+ searchQuery
51
52
  } = table;
52
53
  const offset = page * rowsPerPage;
53
54
  variables.offset = offset;
54
55
  variables.order_by = sortBy;
55
56
  variables.first = rowsPerPage;
56
57
  variables.sort_direction = sortOrder;
58
+ variables.search_query = searchQuery;
57
59
  return variables;
58
60
  };
59
61
 
@@ -74,7 +76,8 @@ const getTableData = _ref => {
74
76
  rowsPerPage,
75
77
  sortOrder,
76
78
  query,
77
- sortBy
79
+ sortBy,
80
+ searchQuery = ''
78
81
  } = table;
79
82
  async function getData() {
80
83
  const paginatedqueryVariable = getPaginatedQueryVariables(queryVariables, table);
@@ -98,7 +101,7 @@ const getTableData = _ref => {
98
101
  // cancel the request before component unmounts
99
102
  controller.abort();
100
103
  };
101
- }, [queryVariables, page, rowsPerPage, sortOrder, sortBy]);
104
+ }, [queryVariables, page, rowsPerPage, sortOrder, sortBy, searchQuery]);
102
105
  return {
103
106
  tableData
104
107
  };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setTotalRowCount = exports.onSearchQueryChange = exports.onRowsPerPageChange = exports.onRowSeclect = exports.onRowDelete = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onClearCart = exports.onChangeSortDirection = exports.customPaginationAction = exports.actionTypes = void 0;
6
+ exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSeclect = exports.onRowDelete = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onInputSearchQueryChange = exports.onColumnViewChange = exports.onColumnSort = exports.onClearCart = exports.onChangeSortDirection = exports.customPaginationAction = exports.actionTypes = void 0;
7
7
  const actionTypes = {
8
8
  VIEW_COLUMN_CHANGE: 'VIEW_COLUMN_CHANGE',
9
9
  ON_COLUMN_SORT: 'ON_COLUMN_SORT',
@@ -74,8 +74,8 @@ const onRowDelete = value => ({
74
74
  payload: value
75
75
  });
76
76
  exports.onRowDelete = onRowDelete;
77
- const onSearchQueryChange = value => ({
77
+ const onInputSearchQueryChange = value => ({
78
78
  type: actionTypes.ON_SEARCH_QUERY_CHANGE,
79
79
  payload: value
80
80
  });
81
- exports.onSearchQueryChange = onSearchQueryChange;
81
+ exports.onInputSearchQueryChange = onInputSearchQueryChange;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "1.0.1-icdc.22",
3
+ "version": "1.0.1-icdc.23",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -26,4 +26,4 @@
26
26
  },
27
27
  "author": "CTOS Bento Team",
28
28
  "license": "ISC"
29
- }
29
+ }
package/src/index.js CHANGED
@@ -13,6 +13,7 @@ export {
13
13
  onRowSeclect,
14
14
  setTotalRowCount,
15
15
  customPaginationAction,
16
+ onInputSearchQueryChange,
16
17
  } from './table/state/Actions';
17
18
  export { default as Wrapper, types } from './wrapper/Wrapper';
18
19
  export { btnTypes } from './wrapper/components/AddFiles';
@@ -15,7 +15,7 @@ import {
15
15
  onColumnViewChange,
16
16
  onRowDelete,
17
17
  onClearCart,
18
- onSearchQueryChange,
18
+ onInputSearchQueryChange,
19
19
  } from './state/Actions';
20
20
  import { TableContext } from './ContextProvider';
21
21
  import reducer from './state/Reducer';
@@ -187,7 +187,7 @@ const PaginatedTable = ({
187
187
  * Filter table rows based on Search query
188
188
  */
189
189
  const handleSeachQueryChange = (value) => {
190
- dispatch(onSearchQueryChange({
190
+ dispatch(onInputSearchQueryChange({
191
191
  searchQuery: value,
192
192
  }));
193
193
  };
@@ -31,12 +31,14 @@ const getPaginatedQueryVariables = (queryVariables, table) => {
31
31
  rowsPerPage,
32
32
  sortBy,
33
33
  sortOrder,
34
+ searchQuery,
34
35
  } = table;
35
36
  const offset = page * rowsPerPage;
36
37
  variables.offset = offset;
37
38
  variables.order_by = sortBy;
38
39
  variables.first = rowsPerPage;
39
40
  variables.sort_direction = sortOrder;
41
+ variables.search_query = searchQuery;
40
42
  return variables;
41
43
  };
42
44
 
@@ -54,6 +56,7 @@ export const getTableData = ({ queryVariables, table }) => {
54
56
  sortOrder,
55
57
  query,
56
58
  sortBy,
59
+ searchQuery = '',
57
60
  } = table;
58
61
  async function getData() {
59
62
  const paginatedqueryVariable = getPaginatedQueryVariables(queryVariables, table);
@@ -78,6 +81,6 @@ export const getTableData = ({ queryVariables, table }) => {
78
81
  // cancel the request before component unmounts
79
82
  controller.abort();
80
83
  };
81
- }, [queryVariables, page, rowsPerPage, sortOrder, sortBy]);
84
+ }, [queryVariables, page, rowsPerPage, sortOrder, sortBy, searchQuery]);
82
85
  return { tableData };
83
86
  };
@@ -68,7 +68,7 @@ export const onRowDelete = (value) => ({
68
68
  payload: value,
69
69
  });
70
70
 
71
- export const onSearchQueryChange = (value) => ({
71
+ export const onInputSearchQueryChange = (value) => ({
72
72
  type: actionTypes.ON_SEARCH_QUERY_CHANGE,
73
73
  payload: value,
74
74
  });