@bento-core/paginated-table 1.0.1-ctdc.2 → 1.0.1-ctdc.4

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.
@@ -20,6 +20,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
20
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); }
21
21
  const DownloadManifestView = props => {
22
22
  const {
23
+ usePopup,
23
24
  tooltipCofig,
24
25
  clsName,
25
26
  title,
@@ -41,6 +42,9 @@ const DownloadManifestView = props => {
41
42
  const {
42
43
  cart
43
44
  } = context;
45
+ const {
46
+ comment
47
+ } = cart;
44
48
  const getQueryVeriables = queryVariables => {
45
49
  const variables = _objectSpread({}, queryVariables);
46
50
  variables.offset = 0;
@@ -59,7 +63,7 @@ const DownloadManifestView = props => {
59
63
  }).then(result => table.objectKey ? result.data[table.objectKey] : result.data.filesInList);
60
64
  return fetchResult;
61
65
  }
62
- async function DocumentDownload(comment, header) {
66
+ async function DocumentDownload(commentD, header) {
63
67
  const {
64
68
  table,
65
69
  queryVariables
@@ -70,16 +74,23 @@ const DownloadManifestView = props => {
70
74
  });
71
75
  return (0, _cart.downloadJson)(_objectSpread(_objectSpread({}, cart), {}, {
72
76
  tableData,
73
- comment,
77
+ commentD,
74
78
  header
75
79
  }));
76
80
  }
77
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
+ };
78
89
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
79
90
  className: clsName,
80
91
  disableRipple: true,
81
92
  onClick: () => {
82
- setIsOpen(true);
93
+ onDownloadClick();
83
94
  },
84
95
  disabled: totalRowCount === 0
85
96
  }, title), /*#__PURE__*/_react.default.createElement(_downloadFileManifestDialog.default, {
@@ -87,7 +98,9 @@ const DownloadManifestView = props => {
87
98
  onClose: () => {
88
99
  setIsOpen(false);
89
100
  },
90
- downloadSCSVFile: comment => DocumentDownload(comment, 'User_Comment')
101
+ downloadSCSVFile: commentPopup => {
102
+ DocumentDownload(commentPopup, 'User_Comment');
103
+ }
91
104
  }), tooltipCofig && !tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), tooltipCofig && tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
92
105
  arrow: arrow,
93
106
  interactive: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "1.0.1-ctdc.2",
3
+ "version": "1.0.1-ctdc.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -13,8 +13,8 @@
13
13
  "access": "public"
14
14
  },
15
15
  "dependencies": {
16
- "@bento-core/cart": "1.0.1-ctdc.1",
17
- "@bento-core/table": "1.0.1-ctdc.1",
16
+ "@bento-core/cart": "1.0.1-ctdc.3",
17
+ "@bento-core/table": "1.0.1-ctdc.3",
18
18
  "@bento-core/tool-tip": "^1.0.0",
19
19
  "@bento-core/util": "^1.0.0",
20
20
  "@material-ui/icons": "^4.11.3"
@@ -10,6 +10,7 @@ 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,25 +53,33 @@ const DownloadManifestView = (props) => {
51
53
  return fetchResult;
52
54
  }
53
55
 
54
- async function DocumentDownload(comment, header) {
56
+ async function DocumentDownload(commentD, header) {
55
57
  const { table, queryVariables } = cart;
56
58
  const tableData = await fetchData({ queryVariables, table });
57
59
  return downloadJson({
58
60
  ...cart,
59
61
  tableData,
60
- comment,
62
+ commentD,
61
63
  header,
62
64
  });
63
65
  }
64
66
 
65
67
  const [isOpen, setIsOpen] = useState(false);
66
68
 
69
+ const onDownloadClick = () => {
70
+ if (usePopup) {
71
+ setIsOpen(true);
72
+ } else {
73
+ DocumentDownload(comment, 'User_Comment');
74
+ }
75
+ };
76
+
67
77
  return (
68
78
  <>
69
79
  <Button
70
80
  className={clsName}
71
81
  disableRipple
72
- onClick={() => { setIsOpen(true); }}
82
+ onClick={() => { onDownloadClick(); }}
73
83
  disabled={totalRowCount === 0}
74
84
  >
75
85
  {title}
@@ -77,7 +87,7 @@ const DownloadManifestView = (props) => {
77
87
  <DownloadFileManifestDialog
78
88
  open={isOpen}
79
89
  onClose={() => { setIsOpen(false); }}
80
- downloadSCSVFile={(comment) => DocumentDownload(comment, 'User_Comment')}
90
+ downloadSCSVFile={(commentPopup) => { DocumentDownload(commentPopup, 'User_Comment'); }}
81
91
  />
82
92
  {(tooltipCofig && !tooltipCofig.customToolTipComponent) && (<ToolTipView {...props} />)}
83
93
  {(tooltipCofig && tooltipCofig.customToolTipComponent) && (