@bento-core/paginated-table 1.0.1-ins.9 → 1.0.1-popsci.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.
@@ -24,10 +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
30
  tblRows = [],
30
- paginationOptions = {}
31
+ paginationOptions = {},
32
+ customTableHeader
31
33
  } = _ref;
32
34
  /**
33
35
  * Initailize useReducer state
@@ -54,6 +56,11 @@ const PaginatedTable = _ref => {
54
56
  dispatch
55
57
  }));
56
58
  }, [table]);
59
+ (0, _react.useEffect)(() => {
60
+ if (checkedItemReset) {
61
+ dispatch((0, _Actions.onRowSeclect)([]));
62
+ }
63
+ }, [checkedItemReset]);
57
64
 
58
65
  /**
59
66
  * update state to props change
@@ -172,7 +179,8 @@ const PaginatedTable = _ref => {
172
179
  onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
173
180
  onSortByColumn: customizeSortByColumn || handleSortByColumn,
174
181
  onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
175
- themeConfig: themeConfig
182
+ themeConfig: themeConfig,
183
+ customTableHeader: customTableHeader
176
184
  }));
177
185
  }
178
186
 
@@ -197,7 +205,8 @@ const PaginatedTable = _ref => {
197
205
  onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
198
206
  onSortByColumn: customizeSortByColumn || handleSortByColumn,
199
207
  onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
200
- themeConfig: themeConfig
208
+ themeConfig: themeConfig,
209
+ customTableHeader: customTableHeader
201
210
  }));
202
211
  };
203
212
  var _default = PaginatedTable;
@@ -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
  ```
@@ -8,8 +8,6 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _core = require("@material-ui/core");
9
9
  var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- // eslint-disable-next-line import/no-unresolved
12
-
13
11
  /**
14
12
  * customize tooltips based on tooltipContent
15
13
  * defined on dashboardTabData (tooltipContent)
@@ -26,11 +26,12 @@ function AddToCartDialogView(props) {
26
26
  onClose: () => onNoClick()
27
27
  });
28
28
  }
29
+ const CustomDialog = DisplayCustomText && DisplayCustomText.component;
29
30
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Dialog, {
30
31
  open: open,
31
32
  "aria-labelledby": "alert-dialog-title",
32
33
  "aria-describedby": "alert-dialog-description"
33
- }, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, DisplayCustomText ? /*#__PURE__*/_react.default.createElement(DisplayCustomText, {
34
+ }, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, DisplayCustomText ? /*#__PURE__*/_react.default.createElement(CustomDialog, {
34
35
  onYesClick: onYesClick,
35
36
  onNoClick: onNoClick,
36
37
  activeFilters: activeFilters
@@ -38,13 +39,16 @@ function AddToCartDialogView(props) {
38
39
  id: "alert-dialog-description"
39
40
  }, "Are you sure to add All Files", ' ', numberOfFilesSelected, ' ', "to cart")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, {
40
41
  className: "dialog_actions"
41
- }, /*#__PURE__*/_react.default.createElement(_core.Button, {
42
- className: "yesBtn",
43
- onClick: () => onYesClick()
44
- }, "Yes"), /*#__PURE__*/_react.default.createElement(_core.Button, {
45
- className: "noBtn",
46
- onClick: () => onNoClick()
47
- }, "No"))));
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)))));
48
52
  }
49
53
  var _default = AddToCartDialogView;
50
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,6 +20,7 @@ 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
26
  title,
@@ -40,6 +42,9 @@ const DownloadManifestView = props => {
40
42
  const {
41
43
  cart
42
44
  } = context;
45
+ const {
46
+ comment
47
+ } = cart;
43
48
  const getQueryVeriables = queryVariables => {
44
49
  const variables = _objectSpread({}, queryVariables);
45
50
  variables.offset = 0;
@@ -58,7 +63,7 @@ const DownloadManifestView = props => {
58
63
  }).then(result => table.objectKey ? result.data[table.objectKey] : result.data.filesInList);
59
64
  return fetchResult;
60
65
  }
61
- async function DocumentDownload() {
66
+ async function DocumentDownload(commentD, header) {
62
67
  const {
63
68
  table,
64
69
  queryVariables
@@ -68,15 +73,35 @@ const DownloadManifestView = props => {
68
73
  table
69
74
  });
70
75
  return (0, _cart.downloadJson)(_objectSpread(_objectSpread({}, cart), {}, {
71
- tableData
76
+ tableData,
77
+ commentD,
78
+ header
72
79
  }));
73
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
+ };
74
89
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
75
90
  className: clsName,
76
91
  disableRipple: true,
77
- onClick: () => DocumentDownload(),
92
+ onClick: () => {
93
+ onDownloadClick();
94
+ },
78
95
  disabled: totalRowCount === 0
79
- }, title), tooltipCofig && !tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), tooltipCofig && tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
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, {
80
105
  arrow: arrow,
81
106
  interactive: true,
82
107
  title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipCofig.customToolTipComponent),
@@ -9,8 +9,6 @@ var _reactRedux = require("react-redux");
9
9
  var _cart = require("@bento-core/cart");
10
10
  var _AddFiles = _interopRequireDefault(require("./AddFiles"));
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- // eslint-disable-next-line import/no-unresolved
13
-
14
12
  const AddFilesRedux = props => /*#__PURE__*/_react.default.createElement(_AddFiles.default, props);
15
13
 
16
14
  /**
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- // eslint-disable-next-line import/no-unresolved
11
-
12
10
  /**
13
11
  * customize tooltips based on tooltipContent
14
12
  * defined on dashboardTabData (tooltipContent)
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _styles = require("@material-ui/core/styles");
9
+ var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));
10
+ var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
11
+ var _core = require("@material-ui/core");
12
+ var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
13
+ var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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); }
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; }
17
+ const useStyles = (0, _styles.makeStyles)({
18
+ dialogContainer: {
19
+ borderRadius: '0px !important',
20
+ textAlign: 'center',
21
+ width: '700px !important',
22
+ height: 'auto !important',
23
+ backgroundColor: 'white !important',
24
+ border: '2px solid white'
25
+ },
26
+ contentText: {
27
+ display: 'flex',
28
+ justifyContent: 'center',
29
+ textAlign: 'justify',
30
+ fontFamily: 'Nunito',
31
+ fontStyle: 'normal',
32
+ fontWeight: 300,
33
+ fontSize: '14px',
34
+ color: '#000'
35
+ },
36
+ textArea: {
37
+ width: '100%',
38
+ height: '100%',
39
+ border: '3px solid #B2C0C6',
40
+ borderRadius: '12px',
41
+ backgroundColor: '#ECF3F7',
42
+ '& .MuiInputBase-input': {
43
+ // height: '215px !important',
44
+ border: '0px !important'
45
+ }
46
+ },
47
+ downloadFileManifestBtn: {
48
+ width: 'fit-content',
49
+ marginTop: '23px'
50
+ },
51
+ dialogHeaderSection: {
52
+ display: 'flex',
53
+ alignItems: 'center',
54
+ paddingRight: '46px'
55
+ },
56
+ closeBtn: {
57
+ color: '#0d71a3'
58
+ },
59
+ dialogTitle: {
60
+ fontFamily: 'Lato',
61
+ fontStyle: 'normal',
62
+ fontWeight: 700,
63
+ width: '100%',
64
+ fontSize: '18px',
65
+ color: '#7896A9',
66
+ display: 'flex',
67
+ justifyContent: 'space-between'
68
+ }
69
+ });
70
+ const CustomDialogContent = (0, _core.withStyles)(() => ({
71
+ root: {
72
+ backgroundColor: '#fff',
73
+ margin: '10px',
74
+ overflowY: 'initial',
75
+ display: 'flex',
76
+ flexDirection: 'column',
77
+ alignItems: 'center'
78
+ }
79
+ }))(props => /*#__PURE__*/_react.default.createElement(_core.DialogContent, props));
80
+ const DownloadFileManifestDialog = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
81
+ let {
82
+ onClose,
83
+ open,
84
+ downloadSCSVFile
85
+ } = _ref;
86
+ const [comment, setComment] = (0, _react.useState)('');
87
+ // eslint-disable-next-line no-unused-vars
88
+ const classes = useStyles();
89
+ _react.default.useImperativeHandle(ref, () => ({
90
+ getValue() {
91
+ return comment;
92
+ }
93
+ }));
94
+ const handleTextFieldChange = event => {
95
+ setComment(event.target.value);
96
+ };
97
+ return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
98
+ onClose: onClose,
99
+ "aria-labelledby": "simple-dialog-title",
100
+ open: open,
101
+ classes: {
102
+ paper: classes.dialogContainer
103
+ }
104
+ }, /*#__PURE__*/_react.default.createElement("div", {
105
+ className: classes.dialogHeaderSection
106
+ }, /*#__PURE__*/_react.default.createElement(_DialogTitle.default, {
107
+ id: "simple-dialog-title",
108
+ classes: {
109
+ root: classes.dialogTitle
110
+ }
111
+ }, "Optional User Comments"), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
112
+ className: classes.closBtnContainer,
113
+ onClick: onClose
114
+ }, /*#__PURE__*/_react.default.createElement(_Close.default, {
115
+ fontSize: "small",
116
+ className: classes.closeBtn
117
+ }))), /*#__PURE__*/_react.default.createElement(CustomDialogContent, null, /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
118
+ classes: {
119
+ root: classes.contentText
120
+ }
121
+ }, "If you wish to annotate the file manifest with comments regarding the files included, enter them here. Comments will be saved as part of the file manifest."), /*#__PURE__*/_react.default.createElement(_TextField.default, {
122
+ multiline: true,
123
+ value: comment,
124
+ onChange: handleTextFieldChange,
125
+ variant: "outlined",
126
+ minRows: 4,
127
+ classes: {
128
+ root: classes.textArea,
129
+ input: classes.input
130
+ }
131
+ }), /*#__PURE__*/_react.default.createElement(_core.Button, {
132
+ onClick: () => {
133
+ downloadSCSVFile(comment);
134
+ },
135
+ classes: {
136
+ root: classes.downloadFileManifestBtn
137
+ }
138
+ }, "Continue to Download File Manifest")));
139
+ });
140
+ var _default = DownloadFileManifestDialog;
141
+ exports.default = _default;
package/package.json CHANGED
@@ -1,24 +1,23 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "1.0.1-ins.9",
3
+ "version": "1.0.1-popsci.1",
4
+ "description": "",
4
5
  "main": "dist/index.js",
5
6
  "scripts": {
6
7
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
7
8
  "test": "echo \"Error: no test specified\" && exit 1",
8
9
  "lint": "eslint src"
9
10
  },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/CBIIT/bento-frontend.git"
13
- },
11
+ "repository": "https://github.com/CBIIT/bento-frontend",
14
12
  "publishConfig": {
15
13
  "access": "public"
16
14
  },
17
15
  "dependencies": {
18
- "@bento-core/cart": "^1.0.0",
19
- "@bento-core/table": "1.0.1-ins.9",
16
+ "@bento-core/cart": "1.0.1-ctdc.3",
17
+ "@bento-core/table": "1.0.1-popsci.0",
20
18
  "@bento-core/tool-tip": "^1.0.0",
21
- "@bento-core/util": "1.0.1-ins.0"
19
+ "@bento-core/util": "^1.0.0",
20
+ "@material-ui/icons": "^4.11.3"
22
21
  },
23
22
  "peerDependencies": {
24
23
  "@apollo/client": "^3.6.9",
@@ -30,10 +29,5 @@
30
29
  },
31
30
  "author": "CTOS Bento Team",
32
31
  "license": "ISC",
33
- "bugs": {
34
- "url": "https://github.com/CBIIT/bento-frontend/issues"
35
- },
36
- "homepage": "https://github.com/CBIIT/bento-frontend#readme",
37
- "devDependencies": {},
38
- "description": ""
32
+ "gitHead": "71e61be4a91ce6fc1c30e53c3645016537dd86d6"
39
33
  }
@@ -18,10 +18,12 @@ const PaginatedTable = ({
18
18
  themeConfig = {},
19
19
  totalRowCount = 0,
20
20
  initState,
21
+ checkedItemReset,
21
22
  activeTab = true,
22
23
  server = true,
23
24
  tblRows = [],
24
25
  paginationOptions = {},
26
+ customTableHeader,
25
27
  }) => {
26
28
  /**
27
29
  * Initailize useReducer state
@@ -46,6 +48,12 @@ const PaginatedTable = ({
46
48
  setContext({ ...table, dispatch });
47
49
  }, [table]);
48
50
 
51
+ useEffect(() => {
52
+ if (checkedItemReset) {
53
+ dispatch(onRowSeclect([]));
54
+ }
55
+ }, [checkedItemReset]);
56
+
49
57
  /**
50
58
  * update state to props change
51
59
  */
@@ -158,6 +166,7 @@ const PaginatedTable = ({
158
166
  onSortByColumn={customizeSortByColumn || handleSortByColumn}
159
167
  onColumnViewChange={customizeColumnViewChange || handleColumnViewChange}
160
168
  themeConfig={themeConfig}
169
+ customTableHeader={customTableHeader}
161
170
  />
162
171
  </>
163
172
  );
@@ -188,6 +197,7 @@ const PaginatedTable = ({
188
197
  onSortByColumn={customizeSortByColumn || handleSortByColumn}
189
198
  onColumnViewChange={customizeColumnViewChange || handleColumnViewChange}
190
199
  themeConfig={themeConfig}
200
+ customTableHeader={customTableHeader}
191
201
  />
192
202
  </>
193
203
  );
@@ -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
  ```
@@ -1,7 +1,6 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { connect } from 'react-redux';
3
3
  import clsx from 'clsx';
4
- // eslint-disable-next-line import/no-unresolved
5
4
  import { onAddCartFiles } from '@bento-core/cart';
6
5
  import { TableContext } from '../../../table/ContextProvider';
7
6
  import { onRowSeclect } from '../../../table/state/Actions';
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { Button } from '@material-ui/core';
3
- // eslint-disable-next-line import/no-unresolved
4
3
  import ToolTip from '@bento-core/tool-tip';
5
4
 
6
5
  /**
@@ -26,6 +26,8 @@ function AddToCartDialogView(props) {
26
26
  );
27
27
  }
28
28
 
29
+ const CustomDialog = DisplayCustomText && DisplayCustomText.component;
30
+
29
31
  return (
30
32
  <>
31
33
  <Dialog
@@ -36,7 +38,7 @@ function AddToCartDialogView(props) {
36
38
  <DialogContent>
37
39
  {
38
40
  DisplayCustomText ? (
39
- <DisplayCustomText
41
+ <CustomDialog
40
42
  onYesClick={onYesClick}
41
43
  onNoClick={onNoClick}
42
44
  activeFilters={activeFilters}
@@ -53,12 +55,21 @@ function AddToCartDialogView(props) {
53
55
  }
54
56
  </DialogContent>
55
57
  <DialogActions className="dialog_actions">
56
- <Button className="yesBtn" onClick={() => onYesClick()}>
57
- Yes
58
- </Button>
59
- <Button className="noBtn" onClick={() => onNoClick()}>
60
- No
61
- </Button>
58
+ { DisplayCustomText && DisplayCustomText.actions && DisplayCustomText.actions.map((a) => (
59
+ <Button
60
+ className={a.className}
61
+ onClick={() => {
62
+ if (a.type === 'Positive') {
63
+ onYesClick();
64
+ } else {
65
+ onNoClick();
66
+ }
67
+ }}
68
+ >
69
+
70
+ {a.label}
71
+ </Button>
72
+ ))}
62
73
  </DialogActions>
63
74
  </Dialog>
64
75
  </>
@@ -1,15 +1,16 @@
1
- import React, { useContext } from 'react';
1
+ import React, { useContext, useState } from 'react';
2
2
  import { Button, Tooltip } from '@material-ui/core';
3
3
  import { useApolloClient } from '@apollo/client';
4
4
  import {
5
5
  downloadJson,
6
6
  CartContext,
7
- // eslint-disable-next-line import/no-unresolved
8
7
  } from '@bento-core/cart';
9
8
  import ToolTipView from './TooltipView';
9
+ import DownloadFileManifestDialog from './downloadFileManifestDialog';
10
10
 
11
11
  const DownloadManifestView = (props) => {
12
12
  const {
13
+ usePopup,
13
14
  tooltipCofig,
14
15
  clsName,
15
16
  title,
@@ -30,6 +31,7 @@ const DownloadManifestView = (props) => {
30
31
  const {
31
32
  cart,
32
33
  } = context;
34
+ const { comment } = cart;
33
35
 
34
36
  const getQueryVeriables = (queryVariables) => {
35
37
  const variables = { ...queryVariables };
@@ -51,22 +53,42 @@ const DownloadManifestView = (props) => {
51
53
  return fetchResult;
52
54
  }
53
55
 
54
- async function DocumentDownload() {
56
+ async function DocumentDownload(commentD, header) {
55
57
  const { table, queryVariables } = cart;
56
58
  const tableData = await fetchData({ queryVariables, table });
57
- return downloadJson({ ...cart, tableData });
59
+ return downloadJson({
60
+ ...cart,
61
+ tableData,
62
+ commentD,
63
+ header,
64
+ });
58
65
  }
59
66
 
67
+ const [isOpen, setIsOpen] = useState(false);
68
+
69
+ const onDownloadClick = () => {
70
+ if (usePopup) {
71
+ setIsOpen(true);
72
+ } else {
73
+ DocumentDownload(comment, 'User_Comment');
74
+ }
75
+ };
76
+
60
77
  return (
61
78
  <>
62
79
  <Button
63
80
  className={clsName}
64
81
  disableRipple
65
- onClick={() => DocumentDownload()}
82
+ onClick={() => { onDownloadClick(); }}
66
83
  disabled={totalRowCount === 0}
67
84
  >
68
85
  {title}
69
86
  </Button>
87
+ <DownloadFileManifestDialog
88
+ open={isOpen}
89
+ onClose={() => { setIsOpen(false); }}
90
+ downloadSCSVFile={(commentPopup) => { DocumentDownload(commentPopup, 'User_Comment'); }}
91
+ />
70
92
  {(tooltipCofig && !tooltipCofig.customToolTipComponent) && (<ToolTipView {...props} />)}
71
93
  {(tooltipCofig && tooltipCofig.customToolTipComponent) && (
72
94
  <Tooltip
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { connect } from 'react-redux';
3
- // eslint-disable-next-line import/no-unresolved
4
3
  import { onAddCartFiles } from '@bento-core/cart';
5
4
  import AddFiles from './AddFiles';
6
5
 
@@ -2,7 +2,6 @@ import React, { useContext, useEffect, useState } from 'react';
2
2
  import {
3
3
  CartContext,
4
4
  onCommentChange,
5
- // eslint-disable-next-line import/no-unresolved
6
5
  } from '@bento-core/cart';
7
6
 
8
7
  const TextFieldView = ({
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- // eslint-disable-next-line import/no-unresolved
3
2
  import ToolTip from '@bento-core/tool-tip';
4
3
 
5
4
  /**
@@ -0,0 +1,138 @@
1
+ import React, { useState } from 'react';
2
+ import { makeStyles } from '@material-ui/core/styles';
3
+ import DialogTitle from '@material-ui/core/DialogTitle';
4
+ import Dialog from '@material-ui/core/Dialog';
5
+ import {
6
+ Button,
7
+ IconButton,
8
+ DialogContent, DialogContentText, withStyles,
9
+ } from '@material-ui/core';
10
+ import TextField from '@material-ui/core/TextField';
11
+ import CloseIcon from '@material-ui/icons/Close';
12
+
13
+ const useStyles = makeStyles({
14
+ dialogContainer: {
15
+ borderRadius: '0px !important',
16
+ textAlign: 'center',
17
+ width: '700px !important',
18
+ height: 'auto !important',
19
+ backgroundColor: 'white !important',
20
+ border: '2px solid white',
21
+ },
22
+ contentText: {
23
+ display: 'flex',
24
+ justifyContent: 'center',
25
+ textAlign: 'justify',
26
+ fontFamily: 'Nunito',
27
+ fontStyle: 'normal',
28
+ fontWeight: 300,
29
+ fontSize: '14px',
30
+ color: '#000',
31
+ },
32
+ textArea: {
33
+ width: '100%',
34
+ height: '100%',
35
+ border: '3px solid #B2C0C6',
36
+ borderRadius: '12px',
37
+ backgroundColor: '#ECF3F7',
38
+ '& .MuiInputBase-input': {
39
+ // height: '215px !important',
40
+ border: '0px !important',
41
+ },
42
+ },
43
+ downloadFileManifestBtn: {
44
+ width: 'fit-content',
45
+ marginTop: '23px',
46
+ },
47
+ dialogHeaderSection: {
48
+ display: 'flex',
49
+ alignItems: 'center',
50
+ paddingRight: '46px',
51
+ },
52
+ closeBtn: {
53
+ color: '#0d71a3',
54
+ },
55
+ dialogTitle: {
56
+ fontFamily: 'Lato',
57
+ fontStyle: 'normal',
58
+ fontWeight: 700,
59
+ width: '100%',
60
+ fontSize: '18px',
61
+ color: '#7896A9',
62
+ display: 'flex',
63
+ justifyContent: 'space-between',
64
+ },
65
+ });
66
+
67
+ const CustomDialogContent = withStyles(() => ({
68
+ root: {
69
+ backgroundColor: '#fff',
70
+ margin: '10px',
71
+ overflowY: 'initial',
72
+ display: 'flex',
73
+ flexDirection: 'column',
74
+ alignItems: 'center',
75
+ },
76
+ }))((props) => (
77
+ <DialogContent {...props} />
78
+ ));
79
+
80
+ const DownloadFileManifestDialog = React.forwardRef(({
81
+ onClose, open, downloadSCSVFile,
82
+ }, ref) => {
83
+ const [comment, setComment] = useState('');
84
+ // eslint-disable-next-line no-unused-vars
85
+ const classes = useStyles();
86
+
87
+ React.useImperativeHandle(ref, () => ({
88
+ getValue() {
89
+ return comment;
90
+ },
91
+ }));
92
+
93
+ const handleTextFieldChange = (event) => {
94
+ setComment(event.target.value);
95
+ };
96
+
97
+ return (
98
+ <Dialog onClose={onClose} aria-labelledby="simple-dialog-title" open={open} classes={{ paper: classes.dialogContainer }}>
99
+ <div className={classes.dialogHeaderSection}>
100
+ <DialogTitle id="simple-dialog-title" classes={{ root: classes.dialogTitle }}>
101
+ Optional User Comments
102
+ </DialogTitle>
103
+ <IconButton
104
+ className={classes.closBtnContainer}
105
+ onClick={onClose}
106
+ >
107
+ <CloseIcon
108
+ fontSize="small"
109
+ className={classes.closeBtn}
110
+ />
111
+ </IconButton>
112
+ </div>
113
+
114
+ <CustomDialogContent>
115
+ <DialogContentText classes={{ root: classes.contentText }}>
116
+ {/* eslint-disable-next-line max-len */}
117
+ If you wish to annotate the file manifest with comments regarding the files included, enter them here. Comments will be saved as part of the file manifest.
118
+ </DialogContentText>
119
+ <TextField
120
+ multiline
121
+ value={comment}
122
+ onChange={handleTextFieldChange}
123
+ variant="outlined"
124
+ minRows={4}
125
+ classes={{ root: classes.textArea, input: classes.input }}
126
+ />
127
+ <Button
128
+ onClick={() => { downloadSCSVFile(comment); }}
129
+ classes={{ root: classes.downloadFileManifestBtn }}
130
+ >
131
+ Continue to Download File Manifest
132
+ </Button>
133
+ </CustomDialogContent>
134
+ </Dialog>
135
+ );
136
+ });
137
+
138
+ export default DownloadFileManifestDialog;