@bento-core/paginated-table 1.0.1-ctdc.0 → 1.0.1-ctdc.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.
@@ -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; }
@@ -58,7 +59,7 @@ const DownloadManifestView = props => {
58
59
  }).then(result => table.objectKey ? result.data[table.objectKey] : result.data.filesInList);
59
60
  return fetchResult;
60
61
  }
61
- async function DocumentDownload() {
62
+ async function DocumentDownload(comment, header) {
62
63
  const {
63
64
  table,
64
65
  queryVariables
@@ -68,15 +69,26 @@ const DownloadManifestView = props => {
68
69
  table
69
70
  });
70
71
  return (0, _cart.downloadJson)(_objectSpread(_objectSpread({}, cart), {}, {
71
- tableData
72
+ tableData,
73
+ comment,
74
+ header
72
75
  }));
73
76
  }
77
+ const [isOpen, setIsOpen] = (0, _react.useState)(false);
74
78
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
75
79
  className: clsName,
76
80
  disableRipple: true,
77
- onClick: () => DocumentDownload(),
81
+ onClick: () => {
82
+ setIsOpen(true);
83
+ },
78
84
  disabled: totalRowCount === 0
79
- }, title), tooltipCofig && !tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), tooltipCofig && tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
85
+ }, title), /*#__PURE__*/_react.default.createElement(_downloadFileManifestDialog.default, {
86
+ open: isOpen,
87
+ onClose: () => {
88
+ setIsOpen(false);
89
+ },
90
+ downloadSCSVFile: comment => DocumentDownload(comment, 'User_Comment')
91
+ }), tooltipCofig && !tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), tooltipCofig && tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
80
92
  arrow: arrow,
81
93
  interactive: true,
82
94
  title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipCofig.customToolTipComponent),
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "1.0.1-ctdc.0",
3
+ "version": "1.0.1-ctdc.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -13,10 +13,11 @@
13
13
  "access": "public"
14
14
  },
15
15
  "dependencies": {
16
- "@bento-core/cart": "^1.0.0",
17
- "@bento-core/table": "1.0.1-ctdc.0",
16
+ "@bento-core/cart": "1.0.1-ctdc.1",
17
+ "@bento-core/table": "1.0.1-ctdc.1",
18
18
  "@bento-core/tool-tip": "^1.0.0",
19
- "@bento-core/util": "^1.0.0"
19
+ "@bento-core/util": "^1.0.0",
20
+ "@material-ui/icons": "^4.11.3"
20
21
  },
21
22
  "peerDependencies": {
22
23
  "@apollo/client": "^3.6.9",
@@ -1,4 +1,4 @@
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 {
@@ -6,6 +6,7 @@ import {
6
6
  CartContext,
7
7
  } from '@bento-core/cart';
8
8
  import ToolTipView from './TooltipView';
9
+ import DownloadFileManifestDialog from './downloadFileManifestDialog';
9
10
 
10
11
  const DownloadManifestView = (props) => {
11
12
  const {
@@ -50,22 +51,34 @@ const DownloadManifestView = (props) => {
50
51
  return fetchResult;
51
52
  }
52
53
 
53
- async function DocumentDownload() {
54
+ async function DocumentDownload(comment, header) {
54
55
  const { table, queryVariables } = cart;
55
56
  const tableData = await fetchData({ queryVariables, table });
56
- return downloadJson({ ...cart, tableData });
57
+ return downloadJson({
58
+ ...cart,
59
+ tableData,
60
+ comment,
61
+ header,
62
+ });
57
63
  }
58
64
 
65
+ const [isOpen, setIsOpen] = useState(false);
66
+
59
67
  return (
60
68
  <>
61
69
  <Button
62
70
  className={clsName}
63
71
  disableRipple
64
- onClick={() => DocumentDownload()}
72
+ onClick={() => { setIsOpen(true); }}
65
73
  disabled={totalRowCount === 0}
66
74
  >
67
75
  {title}
68
76
  </Button>
77
+ <DownloadFileManifestDialog
78
+ open={isOpen}
79
+ onClose={() => { setIsOpen(false); }}
80
+ downloadSCSVFile={(comment) => DocumentDownload(comment, 'User_Comment')}
81
+ />
69
82
  {(tooltipCofig && !tooltipCofig.customToolTipComponent) && (<ToolTipView {...props} />)}
70
83
  {(tooltipCofig && tooltipCofig.customToolTipComponent) && (
71
84
  <Tooltip
@@ -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;