@bento-core/paginated-table 1.0.1-ctdc.0 → 1.0.1-ctdc.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.
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.1",
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",
16
+ "@bento-core/cart": "1.0.1-ctdc.1",
17
17
  "@bento-core/table": "1.0.1-ctdc.0",
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;