@bento-core/paginated-table 0.2.0 → 0.3.0

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.
@@ -46,7 +46,10 @@ const PaginatedTable = _ref => {
46
46
  * 1. provide table state to other component (wrapper comp -> Add file button)
47
47
  * 2. provide table dispatch action to other component (wrapper comp)
48
48
  */
49
- tableContext.setContext(_objectSpread(_objectSpread({}, table), {}, {
49
+ const {
50
+ setContext
51
+ } = tableContext;
52
+ setContext(_objectSpread(_objectSpread({}, table), {}, {
50
53
  dispatch
51
54
  }));
52
55
  }, [table]);
@@ -131,7 +131,7 @@ const CustomLayout = props => {
131
131
  * return child/table component
132
132
  */
133
133
  if (container.paginatedTable) {
134
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " ", children, " ");
134
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ' ', children, ' ');
135
135
  }
136
136
  /**
137
137
  * return other wrapper components
@@ -8,7 +8,8 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactRedux = require("react-redux");
9
9
  var _clsx = _interopRequireDefault(require("clsx"));
10
10
  var _cart = require("@bento-core/cart");
11
- var _paginatedTable = require("@bento-core/paginated-table");
11
+ var _ContextProvider = require("../../../table/ContextProvider");
12
+ var _Actions = require("../../../table/state/Actions");
12
13
  var _AddSelectedFilesView = _interopRequireDefault(require("./AddSelectedFilesView"));
13
14
  var _WrapperService = require("../../WrapperService");
14
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -27,11 +28,14 @@ const AddSelectedFilesController = props => {
27
28
  setAlterDisplay,
28
29
  client
29
30
  } = props;
30
- const tableContext = (0, _react.useContext)(_paginatedTable.TableContext);
31
+ const tableContext = (0, _react.useContext)(_ContextProvider.TableContext);
32
+ const {
33
+ context
34
+ } = tableContext;
31
35
  const {
32
36
  selectedRows = [],
33
37
  dispatch
34
- } = tableContext.context;
38
+ } = context;
35
39
  const variables = {};
36
40
  variables[dataKey] = selectedRows;
37
41
  // add selected files id
@@ -49,7 +53,7 @@ const AddSelectedFilesController = props => {
49
53
  } else {
50
54
  addFiles(ids);
51
55
  setOpenSnackbar(true);
52
- dispatch((0, _paginatedTable.onRowSeclect)([]));
56
+ dispatch((0, _Actions.onRowSeclect)([]));
53
57
  }
54
58
  });
55
59
  };
@@ -27,9 +27,12 @@ const DownloadManifestView = props => {
27
27
  * get cart state
28
28
  */
29
29
  const cartContext = (0, _react.useContext)(_cart.CartContext);
30
+ const {
31
+ context
32
+ } = cartContext;
30
33
  const {
31
34
  cart
32
- } = cartContext.context;
35
+ } = context;
33
36
  const getQueryVeriables = queryVariables => {
34
37
  const variables = _objectSpread({}, queryVariables);
35
38
  variables.offset = 0;
@@ -15,9 +15,12 @@ const TextFieldView = _ref => {
15
15
  } = _ref;
16
16
  const [text, setText] = (0, _react.useState)('');
17
17
  const cartContext = (0, _react.useContext)(_cart.CartContext);
18
+ const {
19
+ context
20
+ } = cartContext;
18
21
  const {
19
22
  dispatch
20
- } = cartContext.context;
23
+ } = context;
21
24
  (0, _react.useEffect)(() => {
22
25
  dispatch((0, _cart.onCommentChange)(text));
23
26
  }, [text]);
package/package.json CHANGED
@@ -1,28 +1,32 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "build": "rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
8
- "test": "echo \"Error: no test specified\" && exit 1"
7
+ "build": "npm run lint && rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "lint": "eslint src"
9
10
  },
10
11
  "repository": "https://github.com/CBIIT/bento-frontend",
11
12
  "publishConfig": {
12
13
  "access": "public"
13
14
  },
14
15
  "dependencies": {
15
- "@bento-core/table": "^0.2.0",
16
- "@bento-core/tool-tip": "^0.2.0",
17
- "@material-ui/core": "^4.12.4"
16
+ "@bento-core/cart": "^0.3.0",
17
+ "@bento-core/table": "^0.3.0",
18
+ "@bento-core/tool-tip": "^0.3.0",
19
+ "@bento-core/util": "^0.3.0"
18
20
  },
19
21
  "peerDependencies": {
20
- "@bento-core/util": "*",
22
+ "@apollo/client": "^3.6.9",
23
+ "@material-ui/core": "^4.12.4",
24
+ "clsx": "^1.2.1",
21
25
  "react": "^17.0.2",
22
26
  "react-dom": "^17.0.0",
23
27
  "react-redux": "^7.2.1"
24
28
  },
25
29
  "author": "CTOS Bento Team",
26
30
  "license": "ISC",
27
- "gitHead": "10ee9deeae6dd0f139ecb7a70afc4c96a4e33d74"
31
+ "gitHead": "9b75062e5092b403db02b167870ea4331361c26f"
28
32
  }
@@ -41,7 +41,8 @@ const PaginatedTable = ({
41
41
  * 1. provide table state to other component (wrapper comp -> Add file button)
42
42
  * 2. provide table dispatch action to other component (wrapper comp)
43
43
  */
44
- tableContext.setContext({ ...table, dispatch });
44
+ const { setContext } = tableContext;
45
+ setContext({ ...table, dispatch });
45
46
  }, [table]);
46
47
 
47
48
  /**
@@ -67,8 +68,7 @@ const PaginatedTable = ({
67
68
 
68
69
  const handleChangeRowsPerPage = (event) => {
69
70
  const noOfRows = parseInt(event.target.value, 10);
70
-
71
- dispatch(onRowsPerPageChange({ rowsPerPage: noOfRows, page:0}));
71
+ dispatch(onRowsPerPageChange({ rowsPerPage: noOfRows, page: 0 }));
72
72
  };
73
73
 
74
74
  const handleChangePage = (event, newPage) => {
@@ -50,7 +50,7 @@ export const getTableData = ({ queryVariables, table }) => {
50
50
  rowsPerPage,
51
51
  sortOrder,
52
52
  query,
53
- sortBy
53
+ sortBy,
54
54
  } = table;
55
55
  async function getData() {
56
56
  const paginatedqueryVariable = getPaginatedQueryVariables(queryVariables, table);
@@ -109,7 +109,13 @@ const CustomLayout = (props) => {
109
109
  * return child/table component
110
110
  */
111
111
  if (container.paginatedTable) {
112
- return <> {children} </>;
112
+ return (
113
+ <>
114
+ {' '}
115
+ {children}
116
+ {' '}
117
+ </>
118
+ );
113
119
  }
114
120
  /**
115
121
  * return other wrapper components
@@ -128,7 +134,8 @@ const CustomLayout = (props) => {
128
134
  ))}
129
135
  </Container>
130
136
  </ThemeProvider>
131
- )})
137
+ );
138
+ })
132
139
  }
133
140
  </>
134
141
  );
@@ -2,10 +2,8 @@ import React, { useContext } from 'react';
2
2
  import { connect } from 'react-redux';
3
3
  import clsx from 'clsx';
4
4
  import { onAddCartFiles } from '@bento-core/cart';
5
- import {
6
- TableContext,
7
- onRowSeclect,
8
- } from '@bento-core/paginated-table';
5
+ import { TableContext } from '../../../table/ContextProvider';
6
+ import { onRowSeclect } from '../../../table/state/Actions';
9
7
  import AddSelectedFileComponent from './AddSelectedFilesView';
10
8
  import { getFilesID } from '../../WrapperService';
11
9
 
@@ -23,10 +21,11 @@ const AddSelectedFilesController = (props) => {
23
21
  } = props;
24
22
 
25
23
  const tableContext = useContext(TableContext);
24
+ const { context } = tableContext;
26
25
  const {
27
26
  selectedRows = [],
28
27
  dispatch,
29
- } = tableContext.context;
28
+ } = context;
30
29
  const variables = {};
31
30
  variables[dataKey] = selectedRows;
32
31
  // add selected files id
@@ -17,9 +17,10 @@ const DownloadManifestView = (props) => {
17
17
  * get cart state
18
18
  */
19
19
  const cartContext = useContext(CartContext);
20
+ const { context } = cartContext;
20
21
  const {
21
22
  cart,
22
- } = cartContext.context;
23
+ } = context;
23
24
 
24
25
  const getQueryVeriables = (queryVariables) => {
25
26
  const variables = { ...queryVariables };
@@ -10,9 +10,10 @@ const TextFieldView = ({
10
10
  }) => {
11
11
  const [text, setText] = useState('');
12
12
  const cartContext = useContext(CartContext);
13
+ const { context } = cartContext;
13
14
  const {
14
15
  dispatch,
15
- } = cartContext.context;
16
+ } = context;
16
17
  useEffect(() => {
17
18
  dispatch(onCommentChange(text));
18
19
  }, [text]);