carbon-addons-iot-react 2.149.0-next.21 → 2.149.0-next.22
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/CHANGELOG.md +12 -0
- package/es/components/Table/StatefulTable.js +5 -1
- package/es/utils/componentUtilityFunctions.js +21 -24
- package/lib/components/Table/StatefulTable.js +5 -1
- package/lib/utils/componentUtilityFunctions.js +21 -24
- package/package.json +2 -2
- package/umd/carbon-addons-iot-react.js +1031 -1030
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.149.0-next.22](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.149.0-next.21...v2.149.0-next.22) (2022-03-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **table:** add onapplytoolbaraction to statefultable ([e8249e1](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/e8249e101b1b8bdbeeb00066d0fa82e991f6b315))
|
|
12
|
+
* **utilityfunctions:** fix generatecsv and update test ([57315d5](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/57315d500aeffab8eb74818a19cf58b467b02ad4)), closes [#3363](https://github.com/carbon-design-system/carbon-addons-iot-react/issues/3363)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
# [2.149.0-next.21](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.149.0-next.20...v2.149.0-next.21) (2022-03-07)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package carbon-addons-iot-react
|
|
@@ -128,7 +128,8 @@ var StatefulTable = function StatefulTable(_ref) {
|
|
|
128
128
|
_onApplyAdvancedFilter = _ref3.onApplyAdvancedFilter,
|
|
129
129
|
_onCancelAdvancedFilter = _ref3.onCancelAdvancedFilter,
|
|
130
130
|
_onCreateAdvancedFilter = _ref3.onCreateAdvancedFilter,
|
|
131
|
-
_onToggleAggregations = _ref3.onToggleAggregations
|
|
131
|
+
_onToggleAggregations = _ref3.onToggleAggregations,
|
|
132
|
+
_onApplyToolbarAction = _ref3.onApplyToolbarAction;
|
|
132
133
|
|
|
133
134
|
var _ref4 = table || {},
|
|
134
135
|
_onChangeSort = _ref4.onChangeSort,
|
|
@@ -214,6 +215,9 @@ var StatefulTable = function StatefulTable(_ref) {
|
|
|
214
215
|
dispatch(tableToggleAggregations());
|
|
215
216
|
callbackParent(_onToggleAggregations);
|
|
216
217
|
},
|
|
218
|
+
onApplyToolbarAction: function onApplyToolbarAction(action) {
|
|
219
|
+
callbackParent(_onApplyToolbarAction, action);
|
|
220
|
+
},
|
|
217
221
|
onDownloadCSV: onDownloadCSV
|
|
218
222
|
},
|
|
219
223
|
table: {
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import 'core-js/modules/es.symbol.js';
|
|
2
2
|
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
3
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
3
4
|
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
4
5
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
5
6
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
6
7
|
import isNil from '../packages/react/node_modules/lodash-es/isNil.js';
|
|
7
8
|
import delay from '../packages/react/node_modules/lodash-es/delay.js';
|
|
8
|
-
import 'core-js/modules/
|
|
9
|
+
import 'core-js/modules/es.object.assign.js';
|
|
9
10
|
import 'core-js/modules/es.array.concat.js';
|
|
10
|
-
import 'core-js/modules/es.
|
|
11
|
+
import 'core-js/modules/es.array.map.js';
|
|
11
12
|
import 'core-js/modules/es.array.iterator.js';
|
|
12
13
|
import 'core-js/modules/es.object.to-string.js';
|
|
13
14
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
14
|
-
import 'core-js/modules/es.
|
|
15
|
-
import 'core-js/modules/es.string.iterator.js';
|
|
15
|
+
import 'core-js/modules/es.object.keys.js';
|
|
16
16
|
import 'core-js/modules/es.array.join.js';
|
|
17
|
+
import 'core-js/modules/es.array.slice.js';
|
|
18
|
+
import 'core-js/modules/es.array.reduce.js';
|
|
17
19
|
import 'core-js/modules/es.number.constructor.js';
|
|
18
|
-
import 'core-js/modules/es.array.map.js';
|
|
19
20
|
import 'core-js/modules/es.array.fill.js';
|
|
20
21
|
import 'core-js/modules/es.array.filter.js';
|
|
21
22
|
import 'core-js/modules/es.array.find.js';
|
|
@@ -24,7 +25,6 @@ import 'core-js/modules/es.string.includes.js';
|
|
|
24
25
|
import 'core-js/modules/es.regexp.constructor.js';
|
|
25
26
|
import 'core-js/modules/es.regexp.exec.js';
|
|
26
27
|
import 'core-js/modules/es.regexp.to-string.js';
|
|
27
|
-
import 'core-js/modules/es.array.reduce.js';
|
|
28
28
|
import 'core-js/modules/es.number.is-integer.js';
|
|
29
29
|
import { sortStates } from '../node_modules/carbon-components-react/es/components/DataTable/state/sortStates.js';
|
|
30
30
|
import fileDownload from 'js-file-download';
|
|
@@ -41,28 +41,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
41
41
|
* Helper function to generate a CSV from an array of table cell data
|
|
42
42
|
* Retrieve the column headers, then match and join the cell values
|
|
43
43
|
* with each header
|
|
44
|
-
* @param {Array<string | number>} data from table cells
|
|
44
|
+
* @param {Array<string | number | boolean>} data from table cells
|
|
45
45
|
* @return {string} generated csv
|
|
46
46
|
*/
|
|
47
47
|
|
|
48
48
|
var generateCsv = function generateCsv(data) {
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
csv += "\n";
|
|
64
|
-
});
|
|
65
|
-
return csv;
|
|
49
|
+
var allHeadersObj = Object.assign.apply(Object, [{}].concat(_toConsumableArray(data.map(function (row) {
|
|
50
|
+
return row.values;
|
|
51
|
+
}))));
|
|
52
|
+
var columnHeaders = Object.keys(allHeadersObj);
|
|
53
|
+
var headerRow = "".concat(columnHeaders.join(','), "\n");
|
|
54
|
+
var lastColumnId = columnHeaders.slice(-1)[0];
|
|
55
|
+
return data.reduce(function (previousCsv, row) {
|
|
56
|
+
return columnHeaders.reduce(function (previousNestedCsv, headerId) {
|
|
57
|
+
var _row$values$headerId;
|
|
58
|
+
|
|
59
|
+
var separator = headerId === lastColumnId ? '\n' : ',';
|
|
60
|
+
return "".concat(previousNestedCsv).concat((_row$values$headerId = row.values[headerId]) !== null && _row$values$headerId !== void 0 ? _row$values$headerId : '').concat(separator);
|
|
61
|
+
}, previousCsv);
|
|
62
|
+
}, headerRow);
|
|
66
63
|
};
|
|
67
64
|
/**
|
|
68
65
|
* Helper function to support downloading data as CSV
|
|
@@ -142,7 +142,8 @@ var StatefulTable = function StatefulTable(_ref) {
|
|
|
142
142
|
_onApplyAdvancedFilter = _ref3.onApplyAdvancedFilter,
|
|
143
143
|
_onCancelAdvancedFilter = _ref3.onCancelAdvancedFilter,
|
|
144
144
|
_onCreateAdvancedFilter = _ref3.onCreateAdvancedFilter,
|
|
145
|
-
_onToggleAggregations = _ref3.onToggleAggregations
|
|
145
|
+
_onToggleAggregations = _ref3.onToggleAggregations,
|
|
146
|
+
_onApplyToolbarAction = _ref3.onApplyToolbarAction;
|
|
146
147
|
|
|
147
148
|
var _ref4 = table || {},
|
|
148
149
|
_onChangeSort = _ref4.onChangeSort,
|
|
@@ -228,6 +229,9 @@ var StatefulTable = function StatefulTable(_ref) {
|
|
|
228
229
|
dispatch(tableActionCreators.tableToggleAggregations());
|
|
229
230
|
callbackParent(_onToggleAggregations);
|
|
230
231
|
},
|
|
232
|
+
onApplyToolbarAction: function onApplyToolbarAction(action) {
|
|
233
|
+
callbackParent(_onApplyToolbarAction, action);
|
|
234
|
+
},
|
|
231
235
|
onDownloadCSV: onDownloadCSV
|
|
232
236
|
},
|
|
233
237
|
table: {
|
|
@@ -4,22 +4,23 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
require('core-js/modules/es.symbol.js');
|
|
6
6
|
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
7
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
7
8
|
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
8
9
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
9
10
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
10
11
|
var isNil = require('../packages/react/node_modules/lodash-es/isNil.js');
|
|
11
12
|
var delay = require('../packages/react/node_modules/lodash-es/delay.js');
|
|
12
|
-
require('core-js/modules/
|
|
13
|
+
require('core-js/modules/es.object.assign.js');
|
|
13
14
|
require('core-js/modules/es.array.concat.js');
|
|
14
|
-
require('core-js/modules/es.
|
|
15
|
+
require('core-js/modules/es.array.map.js');
|
|
15
16
|
require('core-js/modules/es.array.iterator.js');
|
|
16
17
|
require('core-js/modules/es.object.to-string.js');
|
|
17
18
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
18
|
-
require('core-js/modules/es.
|
|
19
|
-
require('core-js/modules/es.string.iterator.js');
|
|
19
|
+
require('core-js/modules/es.object.keys.js');
|
|
20
20
|
require('core-js/modules/es.array.join.js');
|
|
21
|
+
require('core-js/modules/es.array.slice.js');
|
|
22
|
+
require('core-js/modules/es.array.reduce.js');
|
|
21
23
|
require('core-js/modules/es.number.constructor.js');
|
|
22
|
-
require('core-js/modules/es.array.map.js');
|
|
23
24
|
require('core-js/modules/es.array.fill.js');
|
|
24
25
|
require('core-js/modules/es.array.filter.js');
|
|
25
26
|
require('core-js/modules/es.array.find.js');
|
|
@@ -28,7 +29,6 @@ require('core-js/modules/es.string.includes.js');
|
|
|
28
29
|
require('core-js/modules/es.regexp.constructor.js');
|
|
29
30
|
require('core-js/modules/es.regexp.exec.js');
|
|
30
31
|
require('core-js/modules/es.regexp.to-string.js');
|
|
31
|
-
require('core-js/modules/es.array.reduce.js');
|
|
32
32
|
require('core-js/modules/es.number.is-integer.js');
|
|
33
33
|
var sortStates = require('../node_modules/carbon-components-react/es/components/DataTable/state/sortStates.js');
|
|
34
34
|
var fileDownload = require('js-file-download');
|
|
@@ -52,28 +52,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
52
52
|
* Helper function to generate a CSV from an array of table cell data
|
|
53
53
|
* Retrieve the column headers, then match and join the cell values
|
|
54
54
|
* with each header
|
|
55
|
-
* @param {Array<string | number>} data from table cells
|
|
55
|
+
* @param {Array<string | number | boolean>} data from table cells
|
|
56
56
|
* @return {string} generated csv
|
|
57
57
|
*/
|
|
58
58
|
|
|
59
59
|
var generateCsv = function generateCsv(data) {
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
csv += "\n";
|
|
75
|
-
});
|
|
76
|
-
return csv;
|
|
60
|
+
var allHeadersObj = Object.assign.apply(Object, [{}].concat(_toConsumableArray__default['default'](data.map(function (row) {
|
|
61
|
+
return row.values;
|
|
62
|
+
}))));
|
|
63
|
+
var columnHeaders = Object.keys(allHeadersObj);
|
|
64
|
+
var headerRow = "".concat(columnHeaders.join(','), "\n");
|
|
65
|
+
var lastColumnId = columnHeaders.slice(-1)[0];
|
|
66
|
+
return data.reduce(function (previousCsv, row) {
|
|
67
|
+
return columnHeaders.reduce(function (previousNestedCsv, headerId) {
|
|
68
|
+
var _row$values$headerId;
|
|
69
|
+
|
|
70
|
+
var separator = headerId === lastColumnId ? '\n' : ',';
|
|
71
|
+
return "".concat(previousNestedCsv).concat((_row$values$headerId = row.values[headerId]) !== null && _row$values$headerId !== void 0 ? _row$values$headerId : '').concat(separator);
|
|
72
|
+
}, previousCsv);
|
|
73
|
+
}, headerRow);
|
|
77
74
|
};
|
|
78
75
|
/**
|
|
79
76
|
* Helper function to support downloading data as CSV
|
package/package.json
CHANGED
|
@@ -340,10 +340,10 @@
|
|
|
340
340
|
"whatwg-fetch": "^3.0.0"
|
|
341
341
|
},
|
|
342
342
|
"sideEffects": false,
|
|
343
|
-
"version": "2.149.0-next.
|
|
343
|
+
"version": "2.149.0-next.22",
|
|
344
344
|
"resolutions": {
|
|
345
345
|
"chokidar": "3.3.1",
|
|
346
346
|
"react-grid-layout": "1.2.2"
|
|
347
347
|
},
|
|
348
|
-
"gitHead": "
|
|
348
|
+
"gitHead": "398bcdc081337bfbc453133ef145512f86cdb2f1"
|
|
349
349
|
}
|