@bento-core/table 1.0.1-ccdihub.56 → 1.0.1-ccdihub.58

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.
@@ -33,7 +33,7 @@ const DownloadButton = _ref => {
33
33
  const useOutsideAlerter = ref => {
34
34
  (0, _react.useEffect)(() => {
35
35
  function handleClickOutside(event) {
36
- if (!event.target.getAttribute('class').includes('dropdownListItem')) {
36
+ if (!(event.target.getAttribute('id') && event.target.getAttribute('id').includes('dropdownListItem'))) {
37
37
  setListDisplay('none');
38
38
  }
39
39
  }
@@ -63,7 +63,9 @@ const DownloadButton = _ref => {
63
63
  query,
64
64
  variables: _objectSpread(_objectSpread({}, queryVariables), {}, {
65
65
  page: 0,
66
- first: 10000
66
+ first: 10000,
67
+ order_by: table.sortBy,
68
+ sort_direction: table.sortOrder
67
69
  })
68
70
  }).then(response => {
69
71
  if (paginationAPIField && response && response.data) {
@@ -82,7 +84,9 @@ const DownloadButton = _ref => {
82
84
  query,
83
85
  variables: _objectSpread(_objectSpread({}, queryVariables), {}, {
84
86
  page: 0,
85
- first: 10000
87
+ first: 10000,
88
+ order_by: table.sortBy,
89
+ sort_direction: table.sortOrder
86
90
  })
87
91
  }).then(response => {
88
92
  if (paginationAPIField && response && response.data) {
@@ -94,12 +98,10 @@ const DownloadButton = _ref => {
94
98
  }
95
99
  const downloadTableCSV = (0, _react.useCallback)(() => {
96
100
  downloadSCSVFile();
97
- setListDisplay('none');
98
- }, [queryVariables]);
101
+ }, [queryVariables, table]);
99
102
  const downloadTableJson = (0, _react.useCallback)(() => {
100
103
  downloadJsonFile();
101
- setListDisplay('none');
102
- }, [queryVariables]);
104
+ }, [queryVariables, table]);
103
105
  const handleClickButton = () => {
104
106
  if (listDisplay === 'none') {
105
107
  setListDisplay('block');
@@ -161,9 +163,11 @@ const DownloadButton = _ref => {
161
163
  display: listDisplay
162
164
  }
163
165
  }, /*#__PURE__*/_react.default.createElement("div", {
166
+ id: "dropdownListItemCSV",
164
167
  className: classes.dropdownListItem,
165
168
  onClick: downloadTableCSV
166
169
  }, "CSV"), /*#__PURE__*/_react.default.createElement("div", {
170
+ id: "dropdownListItemJSON",
167
171
  className: classes.dropdownListItem,
168
172
  onClick: downloadTableJson
169
173
  }, "JSON")));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-ccdihub.56",
3
+ "version": "1.0.1-ccdihub.58",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
@@ -29,7 +29,7 @@ const DownloadButton = ({
29
29
  const useOutsideAlerter = (ref) => {
30
30
  useEffect(() => {
31
31
  function handleClickOutside(event) {
32
- if (!event.target.getAttribute('class').includes('dropdownListItem')) {
32
+ if (!(event.target.getAttribute('id') && event.target.getAttribute('id').includes('dropdownListItem'))) {
33
33
  setListDisplay('none');
34
34
  }
35
35
  }
@@ -62,6 +62,8 @@ const DownloadButton = ({
62
62
  ...queryVariables,
63
63
  page: 0,
64
64
  first: 10000,
65
+ order_by: table.sortBy,
66
+ sort_direction: table.sortOrder,
65
67
  },
66
68
  })
67
69
  .then((response) => {
@@ -85,6 +87,8 @@ const DownloadButton = ({
85
87
  ...queryVariables,
86
88
  page: 0,
87
89
  first: 10000,
90
+ order_by: table.sortBy,
91
+ sort_direction: table.sortOrder,
88
92
  },
89
93
  })
90
94
  .then((response) => {
@@ -98,13 +102,11 @@ const DownloadButton = ({
98
102
 
99
103
  const downloadTableCSV = useCallback(() => {
100
104
  downloadSCSVFile();
101
- setListDisplay('none');
102
- }, [queryVariables]);
105
+ }, [queryVariables, table]);
103
106
 
104
107
  const downloadTableJson = useCallback(() => {
105
108
  downloadJsonFile();
106
- setListDisplay('none');
107
- }, [queryVariables]);
109
+ }, [queryVariables, table]);
108
110
 
109
111
  const handleClickButton = () => {
110
112
  if (listDisplay === 'none') {
@@ -167,8 +169,8 @@ const DownloadButton = ({
167
169
  </IconButton>
168
170
  </Tooltip>
169
171
  <div className={classes.dropdownList} style={{ display: listDisplay }}>
170
- <div className={classes.dropdownListItem} onClick={downloadTableCSV}>CSV</div>
171
- <div className={classes.dropdownListItem} onClick={downloadTableJson}>JSON</div>
172
+ <div id="dropdownListItemCSV" className={classes.dropdownListItem} onClick={downloadTableCSV}>CSV</div>
173
+ <div id="dropdownListItemJSON" className={classes.dropdownListItem} onClick={downloadTableJson}>JSON</div>
172
174
  </div>
173
175
  </div>
174
176
  );