carbon-addons-iot-react 2.147.0-next.78 → 2.147.0-next.82
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 +34 -0
- package/es/components/Header/Header.js +20 -4
- package/es/components/Table/Table.js +9 -4
- package/es/components/Table/TableBody/RowActionsCell/RowActionsCell.js +41 -4
- package/es/components/Table/TableBody/TableBody.js +39 -4
- package/es/components/Table/TableBody/TableBodyRow/TableBodyRow.js +39 -4
- package/es/components/Table/TableToolbar/TableToolbar.js +9 -5
- package/es/components/Table/TableViewDropdown/TableViewDropdown.js +20 -6
- package/lib/components/Header/Header.js +20 -4
- package/lib/components/Table/Table.js +9 -4
- package/lib/components/Table/TableBody/RowActionsCell/RowActionsCell.js +41 -4
- package/lib/components/Table/TableBody/TableBody.js +39 -4
- package/lib/components/Table/TableBody/TableBodyRow/TableBodyRow.js +39 -4
- package/lib/components/Table/TableToolbar/TableToolbar.js +9 -5
- package/lib/components/Table/TableViewDropdown/TableViewDropdown.js +20 -5
- package/lib/scss/components/DataTable/_data-table.scss +1 -1
- package/package.json +2 -2
- package/scss/components/DataTable/_data-table.scss +1 -1
- package/umd/carbon-addons-iot-react.js +195 -52
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
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.147.0-next.82](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.147.0-next.81...v2.147.0-next.82) (2021-12-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **header:** add isSideNavExpanded prop to fix aria-label for button ([156c301](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/156c3016c5639c61097f85780c047a2f9e32f6de))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [2.147.0-next.81](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.147.0-next.80...v2.147.0-next.81) (2021-12-13)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **table:** pass size to overflow menu in row actions ([9535a7c](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/9535a7c2518f4536d755f10e4da9d5700b9346f3))
|
|
23
|
+
* **table-view-dropdown:** fix [Object object] showing in title ([73a5efb](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/73a5efb02cb7cd6b85e9e671bf51f6ba228b5303))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# [2.147.0-next.79](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.147.0-next.78...v2.147.0-next.79) (2021-12-08)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* **table:** add search onBlur when hasFastSearch:false ([2db93b2](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/2db93b21b6ac8455a0cbac8a2f26ccdfcd94cc7c))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
6
40
|
# [2.147.0-next.78](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.147.0-next.77...v2.147.0-next.78) (2021-12-08)
|
|
7
41
|
|
|
8
42
|
|
|
@@ -68,7 +68,10 @@ var propTypes = {
|
|
|
68
68
|
testId: PropTypes.string,
|
|
69
69
|
|
|
70
70
|
/** Returns true, if the icon should be shown. (actionItem) => {} */
|
|
71
|
-
isActionItemVisible: PropTypes.func
|
|
71
|
+
isActionItemVisible: PropTypes.func,
|
|
72
|
+
|
|
73
|
+
/** allows setting aria-label on side-nav menu button correctly */
|
|
74
|
+
isSideNavExpanded: PropTypes.bool
|
|
72
75
|
};
|
|
73
76
|
var defaultProps = {
|
|
74
77
|
onClickSideNavExpand: null,
|
|
@@ -88,7 +91,8 @@ var defaultProps = {
|
|
|
88
91
|
testId: 'header',
|
|
89
92
|
isActionItemVisible: function isActionItemVisible() {
|
|
90
93
|
return true;
|
|
91
|
-
}
|
|
94
|
+
},
|
|
95
|
+
isSideNavExpanded: false
|
|
92
96
|
};
|
|
93
97
|
/**
|
|
94
98
|
* UI header with multiple side panels functionality and dropdowns
|
|
@@ -109,7 +113,8 @@ var Header = function Header(_ref) {
|
|
|
109
113
|
appSwitcherLabel = _ref.appSwitcherLabel,
|
|
110
114
|
i18n = _ref.i18n,
|
|
111
115
|
testId = _ref.testId,
|
|
112
|
-
isActionItemVisible = _ref.isActionItemVisible
|
|
116
|
+
isActionItemVisible = _ref.isActionItemVisible,
|
|
117
|
+
isSideNavExpanded = _ref.isSideNavExpanded;
|
|
113
118
|
|
|
114
119
|
var mergedI18n = _objectSpread(_objectSpread({}, defaultProps.i18n), i18n);
|
|
115
120
|
|
|
@@ -138,7 +143,7 @@ var Header = function Header(_ref) {
|
|
|
138
143
|
href: skipto
|
|
139
144
|
}), hasSideNav && /*#__PURE__*/React__default.createElement(HeaderMenuButton, {
|
|
140
145
|
"data-testid": "".concat(testId, "-menu-button"),
|
|
141
|
-
"aria-label": mergedI18n.openMenu,
|
|
146
|
+
"aria-label": isSideNavExpanded ? mergedI18n.closeMenu : mergedI18n.openMenu,
|
|
142
147
|
onClick: onClickSideNavExpand
|
|
143
148
|
}), /*#__PURE__*/React__default.createElement(HeaderName, {
|
|
144
149
|
"data-testid": "".concat(testId, "-name"),
|
|
@@ -316,6 +321,17 @@ Header.__docgenInfo = {
|
|
|
316
321
|
"required": false,
|
|
317
322
|
"description": "Returns true, if the icon should be shown. (actionItem) => {}"
|
|
318
323
|
},
|
|
324
|
+
"isSideNavExpanded": {
|
|
325
|
+
"defaultValue": {
|
|
326
|
+
"value": "false",
|
|
327
|
+
"computed": false
|
|
328
|
+
},
|
|
329
|
+
"type": {
|
|
330
|
+
"name": "bool"
|
|
331
|
+
},
|
|
332
|
+
"required": false,
|
|
333
|
+
"description": "allows setting aria-label on side-nav menu button correctly"
|
|
334
|
+
},
|
|
319
335
|
"appName": {
|
|
320
336
|
"type": {
|
|
321
337
|
"name": "string"
|
|
@@ -626,7 +626,8 @@ var Table = function Table(props) {
|
|
|
626
626
|
tooltip = _merge2.tooltip,
|
|
627
627
|
error = _merge2.error,
|
|
628
628
|
testId = _merge2.testId,
|
|
629
|
-
|
|
629
|
+
size = _merge2.size,
|
|
630
|
+
others = _objectWithoutProperties(_merge2, ["id", "columns", "columnGroups", "data", "expandedData", "locale", "view", "actions", "actions", "options", "lightweight", "className", "style", "i18n", "secondaryTitle", "tooltip", "error", "testId", "size"]); // There is no way to access the current search value in the Table
|
|
630
631
|
// so we need to track that for the save view functionality.
|
|
631
632
|
|
|
632
633
|
|
|
@@ -901,8 +902,11 @@ var Table = function Table(props) {
|
|
|
901
902
|
id: id // TODO: remove id in v3
|
|
902
903
|
,
|
|
903
904
|
"data-testid": id || testId,
|
|
904
|
-
className: classnames((_classnames2 = {}, _defineProperty(_classnames2, "".concat(iotPrefix, "--data-table--column-groups"), columnGroups.length), _defineProperty(_classnames2, "".concat(iotPrefix, "--data-table--column-groups--min-size-large"), columnGroups.length && minHeaderSizeIsLarge), _defineProperty(_classnames2, "".concat(iotPrefix, "--data-table--resize"), options.hasResize), _defineProperty(_classnames2, "".concat(iotPrefix, "--data-table--fixed"), options.hasResize && !options.useAutoTableLayoutForResize), _defineProperty(_classnames2, "".concat(iotPrefix, "--data-table--row-actions"), options.hasRowActions), _classnames2))
|
|
905
|
-
|
|
905
|
+
className: classnames((_classnames2 = {}, _defineProperty(_classnames2, "".concat(iotPrefix, "--data-table--column-groups"), columnGroups.length), _defineProperty(_classnames2, "".concat(iotPrefix, "--data-table--column-groups--min-size-large"), columnGroups.length && minHeaderSizeIsLarge), _defineProperty(_classnames2, "".concat(iotPrefix, "--data-table--resize"), options.hasResize), _defineProperty(_classnames2, "".concat(iotPrefix, "--data-table--fixed"), options.hasResize && !options.useAutoTableLayoutForResize), _defineProperty(_classnames2, "".concat(iotPrefix, "--data-table--row-actions"), options.hasRowActions), _classnames2)),
|
|
906
|
+
size: size
|
|
907
|
+
}, others), columns.length ? /*#__PURE__*/React__default.createElement(TableHead, _extends({
|
|
908
|
+
size: size
|
|
909
|
+
}, others, {
|
|
906
910
|
i18n: i18n,
|
|
907
911
|
lightweight: lightweight,
|
|
908
912
|
options: _objectSpread(_objectSpread({}, pick(options, 'hasAggregations', 'hasColumnSelectionConfig', 'hasResize', 'hasRowActions', 'hasRowNesting', 'hasSingleRowEdit', 'hasRowSelection', 'useAutoTableLayoutForResize', 'hasMultiSort', 'preserveColumnWidths')), {}, {
|
|
@@ -978,7 +982,8 @@ var Table = function Table(props) {
|
|
|
978
982
|
actions: pick(actions.table, 'onRowSelected', 'onApplyRowAction', 'onClearRowError', 'onRowExpanded', 'onRowClicked', 'onRowLoadMore') // TODO: remove 'id' in v3.
|
|
979
983
|
,
|
|
980
984
|
testId: "".concat(id || testId, "-table-body"),
|
|
981
|
-
showExpanderColumn: showExpanderColumn
|
|
985
|
+
showExpanderColumn: showExpanderColumn,
|
|
986
|
+
size: size
|
|
982
987
|
})) : /*#__PURE__*/React__default.createElement(EmptyTable, {
|
|
983
988
|
id: id,
|
|
984
989
|
totalColumns: totalColumns,
|
|
@@ -13,6 +13,7 @@ import 'core-js/modules/es.array.concat.js';
|
|
|
13
13
|
import 'core-js/modules/es.array.filter.js';
|
|
14
14
|
import 'core-js/modules/es.array.find-index.js';
|
|
15
15
|
import 'core-js/modules/es.array.map.js';
|
|
16
|
+
import 'core-js/modules/es.array.includes.js';
|
|
16
17
|
import React__default, { Fragment } from 'react';
|
|
17
18
|
import PropTypes from 'prop-types';
|
|
18
19
|
import { DataTable, Loading, OverflowMenuItem } from 'carbon-components-react';
|
|
@@ -80,7 +81,12 @@ var propTypes = {
|
|
|
80
81
|
/**
|
|
81
82
|
* Direction of document. Passed in at Table
|
|
82
83
|
*/
|
|
83
|
-
langDir: PropTypes.oneOf(['ltr', 'rtl'])
|
|
84
|
+
langDir: PropTypes.oneOf(['ltr', 'rtl']),
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* the size passed to the table to set row height
|
|
88
|
+
*/
|
|
89
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl'])
|
|
84
90
|
};
|
|
85
91
|
var defaultProps = {
|
|
86
92
|
actions: null,
|
|
@@ -93,7 +99,8 @@ var defaultProps = {
|
|
|
93
99
|
isDelete: false,
|
|
94
100
|
showSingleRowEditButtons: false,
|
|
95
101
|
singleRowEditButtons: null,
|
|
96
|
-
langDir: 'ltr'
|
|
102
|
+
langDir: 'ltr',
|
|
103
|
+
size: undefined
|
|
97
104
|
};
|
|
98
105
|
|
|
99
106
|
var RowActionsCell = /*#__PURE__*/function (_React$Component) {
|
|
@@ -167,7 +174,8 @@ var RowActionsCell = /*#__PURE__*/function (_React$Component) {
|
|
|
167
174
|
inProgressText = _this$props.inProgressText,
|
|
168
175
|
showSingleRowEditButtons = _this$props.showSingleRowEditButtons,
|
|
169
176
|
singleRowEditButtons = _this$props.singleRowEditButtons,
|
|
170
|
-
langDir = _this$props.langDir
|
|
177
|
+
langDir = _this$props.langDir,
|
|
178
|
+
size = _this$props.size;
|
|
171
179
|
var isOpen = this.state.isOpen;
|
|
172
180
|
var overflowActions = actions ? actions.filter(function (action) {
|
|
173
181
|
return action.isOverflow;
|
|
@@ -230,7 +238,9 @@ var RowActionsCell = /*#__PURE__*/function (_React$Component) {
|
|
|
230
238
|
},
|
|
231
239
|
iconDescription: overflowMenuAria,
|
|
232
240
|
onOpen: this.handleOpen,
|
|
233
|
-
onClose: this.handleClose,
|
|
241
|
+
onClose: this.handleClose // compact or xs rows need the `sm` overflow menu, everything else is default (md)
|
|
242
|
+
,
|
|
243
|
+
size: ['compact', 'xs'].includes(size) ? 'sm' : undefined,
|
|
234
244
|
className: "".concat(iotPrefix, "--row-actions-cell--overflow-menu"),
|
|
235
245
|
selectorPrimaryFocus: ".".concat(iotPrefix, "--action-overflow-item--initialFocus"),
|
|
236
246
|
useAutoPositioning: true
|
|
@@ -425,6 +435,33 @@ RowActionsCell.__docgenInfo = {
|
|
|
425
435
|
"required": false,
|
|
426
436
|
"description": "Direction of document. Passed in at Table"
|
|
427
437
|
},
|
|
438
|
+
"size": {
|
|
439
|
+
"defaultValue": {
|
|
440
|
+
"value": "undefined",
|
|
441
|
+
"computed": true
|
|
442
|
+
},
|
|
443
|
+
"type": {
|
|
444
|
+
"name": "enum",
|
|
445
|
+
"value": [{
|
|
446
|
+
"value": "'xs'",
|
|
447
|
+
"computed": false
|
|
448
|
+
}, {
|
|
449
|
+
"value": "'sm'",
|
|
450
|
+
"computed": false
|
|
451
|
+
}, {
|
|
452
|
+
"value": "'md'",
|
|
453
|
+
"computed": false
|
|
454
|
+
}, {
|
|
455
|
+
"value": "'lg'",
|
|
456
|
+
"computed": false
|
|
457
|
+
}, {
|
|
458
|
+
"value": "'xl'",
|
|
459
|
+
"computed": false
|
|
460
|
+
}]
|
|
461
|
+
},
|
|
462
|
+
"required": false,
|
|
463
|
+
"description": "the size passed to the table to set row height"
|
|
464
|
+
},
|
|
428
465
|
"id": {
|
|
429
466
|
"type": {
|
|
430
467
|
"name": "string"
|
|
@@ -119,7 +119,12 @@ var propTypes = {
|
|
|
119
119
|
loadingMoreIds: PropTypes.arrayOf(PropTypes.string),
|
|
120
120
|
|
|
121
121
|
/** use white-space: pre; css when true */
|
|
122
|
-
preserveCellWhiteSpace: PropTypes.bool
|
|
122
|
+
preserveCellWhiteSpace: PropTypes.bool,
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* the size passed to the table to set row height
|
|
126
|
+
*/
|
|
127
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl'])
|
|
123
128
|
};
|
|
124
129
|
var defaultProps = {
|
|
125
130
|
expandedIds: [],
|
|
@@ -151,7 +156,8 @@ var defaultProps = {
|
|
|
151
156
|
learnMoreText: 'Learn more',
|
|
152
157
|
inProgressText: 'In progress',
|
|
153
158
|
dismissText: 'Dismiss',
|
|
154
|
-
actionFailedText: 'Action failed'
|
|
159
|
+
actionFailedText: 'Action failed',
|
|
160
|
+
size: undefined
|
|
155
161
|
};
|
|
156
162
|
|
|
157
163
|
var TableBody = function TableBody(_ref) {
|
|
@@ -190,7 +196,8 @@ var TableBody = function TableBody(_ref) {
|
|
|
190
196
|
testID = _ref.testID,
|
|
191
197
|
testId = _ref.testId,
|
|
192
198
|
showExpanderColumn = _ref.showExpanderColumn,
|
|
193
|
-
preserveCellWhiteSpace = _ref.preserveCellWhiteSpace
|
|
199
|
+
preserveCellWhiteSpace = _ref.preserveCellWhiteSpace,
|
|
200
|
+
size = _ref.size;
|
|
194
201
|
// Need to merge the ordering and the columns since the columns have the renderer function
|
|
195
202
|
var orderingMap = useMemo(function () {
|
|
196
203
|
return ordering.map(function (col) {
|
|
@@ -354,7 +361,8 @@ var TableBody = function TableBody(_ref) {
|
|
|
354
361
|
}),
|
|
355
362
|
rowActions: row.rowActions,
|
|
356
363
|
values: row.values,
|
|
357
|
-
showExpanderColumn: showExpanderColumn
|
|
364
|
+
showExpanderColumn: showExpanderColumn,
|
|
365
|
+
size: size
|
|
358
366
|
}) : /*#__PURE__*/React__default.createElement(TableBodyLoadMoreRow, {
|
|
359
367
|
id: row.id,
|
|
360
368
|
key: "".concat(row.id, "--load-more"),
|
|
@@ -767,6 +775,33 @@ TableBody.__docgenInfo = {
|
|
|
767
775
|
"required": false,
|
|
768
776
|
"description": "I18N label for action failed"
|
|
769
777
|
},
|
|
778
|
+
"size": {
|
|
779
|
+
"defaultValue": {
|
|
780
|
+
"value": "undefined",
|
|
781
|
+
"computed": true
|
|
782
|
+
},
|
|
783
|
+
"type": {
|
|
784
|
+
"name": "enum",
|
|
785
|
+
"value": [{
|
|
786
|
+
"value": "'xs'",
|
|
787
|
+
"computed": false
|
|
788
|
+
}, {
|
|
789
|
+
"value": "'sm'",
|
|
790
|
+
"computed": false
|
|
791
|
+
}, {
|
|
792
|
+
"value": "'md'",
|
|
793
|
+
"computed": false
|
|
794
|
+
}, {
|
|
795
|
+
"value": "'lg'",
|
|
796
|
+
"computed": false
|
|
797
|
+
}, {
|
|
798
|
+
"value": "'xl'",
|
|
799
|
+
"computed": false
|
|
800
|
+
}]
|
|
801
|
+
},
|
|
802
|
+
"required": false,
|
|
803
|
+
"description": "the size passed to the table to set row height"
|
|
804
|
+
},
|
|
770
805
|
"tableId": {
|
|
771
806
|
"type": {
|
|
772
807
|
"name": "string"
|
|
@@ -146,7 +146,12 @@ var propTypes = {
|
|
|
146
146
|
langDir: PropTypes.oneOf(['ltr', 'rtl']),
|
|
147
147
|
|
|
148
148
|
/** shows an additional column that can expand/shrink as the table is resized */
|
|
149
|
-
showExpanderColumn: PropTypes.bool
|
|
149
|
+
showExpanderColumn: PropTypes.bool,
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* the size passed to the table to set row height
|
|
153
|
+
*/
|
|
154
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl'])
|
|
150
155
|
};
|
|
151
156
|
var defaultProps = {
|
|
152
157
|
isSelected: false,
|
|
@@ -173,7 +178,8 @@ var defaultProps = {
|
|
|
173
178
|
showExpanderColumn: false,
|
|
174
179
|
langDir: 'ltr',
|
|
175
180
|
locale: 'en',
|
|
176
|
-
isSelectable: undefined
|
|
181
|
+
isSelectable: undefined,
|
|
182
|
+
size: undefined
|
|
177
183
|
};
|
|
178
184
|
var StyledTableRow = styled(function (_ref) {
|
|
179
185
|
_ref.isSelectable;
|
|
@@ -298,7 +304,8 @@ var TableBodyRow = function TableBodyRow(_ref6) {
|
|
|
298
304
|
rowEditMode = _ref6.rowEditMode,
|
|
299
305
|
singleRowEditMode = _ref6.singleRowEditMode,
|
|
300
306
|
singleRowEditButtons = _ref6.singleRowEditButtons,
|
|
301
|
-
showExpanderColumn = _ref6.showExpanderColumn
|
|
307
|
+
showExpanderColumn = _ref6.showExpanderColumn,
|
|
308
|
+
size = _ref6.size;
|
|
302
309
|
var isEditMode = rowEditMode || singleRowEditMode;
|
|
303
310
|
var singleSelectionIndicatorWidth = hasRowSelection === 'single' ? 0 : 5; // if this a single hierarchy (i.e. only 1 level of nested children), do NOT show the gray offset
|
|
304
311
|
|
|
@@ -390,7 +397,8 @@ var TableBodyRow = function TableBodyRow(_ref6) {
|
|
|
390
397
|
rowActionsError: rowActionsError,
|
|
391
398
|
onClearError: onClearRowError ? function () {
|
|
392
399
|
return onClearRowError(id);
|
|
393
|
-
} : null
|
|
400
|
+
} : null,
|
|
401
|
+
size: size
|
|
394
402
|
}) : nestingLevel > 0 && hasRowActions ? /*#__PURE__*/React__default.createElement(TableCell, {
|
|
395
403
|
key: "".concat(tableId, "-").concat(id, "-row-actions-cell")
|
|
396
404
|
}) : undefined);
|
|
@@ -837,6 +845,33 @@ TableBodyRow.__docgenInfo = {
|
|
|
837
845
|
"required": false,
|
|
838
846
|
"description": ""
|
|
839
847
|
},
|
|
848
|
+
"size": {
|
|
849
|
+
"defaultValue": {
|
|
850
|
+
"value": "undefined",
|
|
851
|
+
"computed": true
|
|
852
|
+
},
|
|
853
|
+
"type": {
|
|
854
|
+
"name": "enum",
|
|
855
|
+
"value": [{
|
|
856
|
+
"value": "'xs'",
|
|
857
|
+
"computed": false
|
|
858
|
+
}, {
|
|
859
|
+
"value": "'sm'",
|
|
860
|
+
"computed": false
|
|
861
|
+
}, {
|
|
862
|
+
"value": "'md'",
|
|
863
|
+
"computed": false
|
|
864
|
+
}, {
|
|
865
|
+
"value": "'lg'",
|
|
866
|
+
"computed": false
|
|
867
|
+
}, {
|
|
868
|
+
"value": "'xl'",
|
|
869
|
+
"computed": false
|
|
870
|
+
}]
|
|
871
|
+
},
|
|
872
|
+
"required": false,
|
|
873
|
+
"description": "the size passed to the table to set row height"
|
|
874
|
+
},
|
|
840
875
|
"ordering": {
|
|
841
876
|
"type": {
|
|
842
877
|
"name": "arrayOf",
|
|
@@ -355,11 +355,15 @@ var TableToolbar = function TableToolbar(_ref) {
|
|
|
355
355
|
}),
|
|
356
356
|
onClear: function onClear() {
|
|
357
357
|
return onApplySearch('');
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
358
|
+
},
|
|
359
|
+
onBlur: !hasFastSearch ? function (e, handleExpand) {
|
|
360
|
+
var value = e.target.value;
|
|
361
|
+
onApplySearch(value);
|
|
362
|
+
|
|
363
|
+
if (!value) {
|
|
364
|
+
handleExpand(e, false);
|
|
365
|
+
}
|
|
366
|
+
} : undefined,
|
|
363
367
|
disabled: isDisabled // TODO: remove deprecated 'testID' in v3
|
|
364
368
|
,
|
|
365
369
|
"data-testid": "".concat(testID || testId, "-search")
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
3
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
4
|
import 'core-js/modules/es.array.concat.js';
|
|
4
5
|
import 'core-js/modules/es.array.find.js';
|
|
5
|
-
import React__default, { useMemo } from 'react';
|
|
6
|
+
import React__default, { useMemo, useEffect } from 'react';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
8
|
import { Dropdown } from 'carbon-components-react';
|
|
8
9
|
import { Settings16 } from '@carbon/icons-react';
|
|
9
10
|
import withSize from 'react-sizeme';
|
|
10
11
|
import { settings } from '../../../constants/Settings.js';
|
|
11
12
|
import { OverridePropTypes } from '../../../constants/SharedPropTypes.js';
|
|
13
|
+
import { useDropdownTitleFixer } from '../../IconDropdown/dropdownHooks.js';
|
|
12
14
|
import TableViewItemPropType from './TableViewItemPropTypes.js';
|
|
13
15
|
import TableViewDropdownItem from './TableViewDropdownItem.js';
|
|
14
16
|
|
|
15
17
|
var iotPrefix = settings.iotPrefix;
|
|
16
18
|
var propTypes = {
|
|
17
|
-
/** Set to true if the user has
|
|
19
|
+
/** Set to true if the user has modified filters etc since the view was loaded */
|
|
18
20
|
selectedViewEdited: PropTypes.bool,
|
|
19
21
|
|
|
20
22
|
/** The id of the view that is currently selected */
|
|
@@ -47,7 +49,7 @@ var propTypes = {
|
|
|
47
49
|
onChangeView: PropTypes.func
|
|
48
50
|
}).isRequired,
|
|
49
51
|
|
|
50
|
-
/** Used to
|
|
52
|
+
/** Used to override the internal components and props of the TableViewDropdown */
|
|
51
53
|
overrides: PropTypes.shape({
|
|
52
54
|
dropdown: OverridePropTypes,
|
|
53
55
|
dropdownItem: OverridePropTypes
|
|
@@ -112,7 +114,7 @@ var TableViewDropdown = function TableViewDropdown(_ref) {
|
|
|
112
114
|
customAction: onManageViews,
|
|
113
115
|
icon: Settings16
|
|
114
116
|
}; // Save changes button show only appear if the view has been edited and the current view is not 'View all'
|
|
115
|
-
// 'View all' is equivalent to a "default view", which would not be able to get
|
|
117
|
+
// 'View all' is equivalent to a "default view", which would not be able to get re-saved. The user should supply
|
|
116
118
|
// their own default views that can be changed if they would like that functionality
|
|
117
119
|
|
|
118
120
|
var dialogItems = selectedViewEdited && selectedViewId && selectedViewId !== 'view-all' ? [saveAsNewItem, saveItem, manageViewsItem] : [saveAsNewItem, manageViewsItem]; // move the action / dialog items to the top so that they are always easily accessible in the case that there are
|
|
@@ -126,6 +128,17 @@ var TableViewDropdown = function TableViewDropdown(_ref) {
|
|
|
126
128
|
var MyDropDown = (overrides === null || overrides === void 0 ? void 0 : (_overrides$dropdown = overrides.dropdown) === null || _overrides$dropdown === void 0 ? void 0 : _overrides$dropdown.component) || Dropdown;
|
|
127
129
|
var MyTableViewDropDownItem = (overrides === null || overrides === void 0 ? void 0 : (_overrides$dropdownIt = overrides.dropdownItem) === null || _overrides$dropdownIt === void 0 ? void 0 : _overrides$dropdownIt.component) || TableViewDropdownItem;
|
|
128
130
|
|
|
131
|
+
var _useDropdownTitleFixe = useDropdownTitleFixer(),
|
|
132
|
+
_useDropdownTitleFixe2 = _slicedToArray(_useDropdownTitleFixe, 2),
|
|
133
|
+
dropdownRef = _useDropdownTitleFixe2[0],
|
|
134
|
+
updateTitle = _useDropdownTitleFixe2[1];
|
|
135
|
+
|
|
136
|
+
useEffect(function () {
|
|
137
|
+
if (mySelectedItem !== null && mySelectedItem !== void 0 && mySelectedItem.text && dropdownRef !== null && dropdownRef !== void 0 && dropdownRef.current) {
|
|
138
|
+
updateTitle(selectedViewEdited ? "".concat(mySelectedItem.text, " - ").concat(i18n.edited) : mySelectedItem.text);
|
|
139
|
+
}
|
|
140
|
+
}, [dropdownRef, i18n.edited, mySelectedItem, selectedViewEdited, updateTitle]);
|
|
141
|
+
|
|
129
142
|
var onSelectionChange = function onSelectionChange(change) {
|
|
130
143
|
var item = change.selectedItem;
|
|
131
144
|
|
|
@@ -146,6 +159,7 @@ var TableViewDropdown = function TableViewDropdown(_ref) {
|
|
|
146
159
|
className: "".concat(iotPrefix, "--view-dropdown__container"),
|
|
147
160
|
style: style
|
|
148
161
|
}, /*#__PURE__*/React__default.createElement(MyDropDown, _extends({
|
|
162
|
+
ref: dropdownRef,
|
|
149
163
|
label: i18n.tableViewMenu,
|
|
150
164
|
"data-testid": testID,
|
|
151
165
|
selectedItem: mySelectedItem,
|
|
@@ -261,7 +275,7 @@ TableViewDropdown.__docgenInfo = {
|
|
|
261
275
|
"name": "bool"
|
|
262
276
|
},
|
|
263
277
|
"required": false,
|
|
264
|
-
"description": "Set to true if the user has
|
|
278
|
+
"description": "Set to true if the user has modified filters etc since the view was loaded"
|
|
265
279
|
},
|
|
266
280
|
"disabled": {
|
|
267
281
|
"defaultValue": {
|
|
@@ -295,7 +309,7 @@ TableViewDropdown.__docgenInfo = {
|
|
|
295
309
|
}
|
|
296
310
|
},
|
|
297
311
|
"required": false,
|
|
298
|
-
"description": "Used to
|
|
312
|
+
"description": "Used to override the internal components and props of the TableViewDropdown"
|
|
299
313
|
},
|
|
300
314
|
"style": {
|
|
301
315
|
"defaultValue": {
|
|
@@ -77,7 +77,10 @@ var propTypes = {
|
|
|
77
77
|
testId: PropTypes__default['default'].string,
|
|
78
78
|
|
|
79
79
|
/** Returns true, if the icon should be shown. (actionItem) => {} */
|
|
80
|
-
isActionItemVisible: PropTypes__default['default'].func
|
|
80
|
+
isActionItemVisible: PropTypes__default['default'].func,
|
|
81
|
+
|
|
82
|
+
/** allows setting aria-label on side-nav menu button correctly */
|
|
83
|
+
isSideNavExpanded: PropTypes__default['default'].bool
|
|
81
84
|
};
|
|
82
85
|
var defaultProps = {
|
|
83
86
|
onClickSideNavExpand: null,
|
|
@@ -97,7 +100,8 @@ var defaultProps = {
|
|
|
97
100
|
testId: 'header',
|
|
98
101
|
isActionItemVisible: function isActionItemVisible() {
|
|
99
102
|
return true;
|
|
100
|
-
}
|
|
103
|
+
},
|
|
104
|
+
isSideNavExpanded: false
|
|
101
105
|
};
|
|
102
106
|
/**
|
|
103
107
|
* UI header with multiple side panels functionality and dropdowns
|
|
@@ -118,7 +122,8 @@ var Header = function Header(_ref) {
|
|
|
118
122
|
appSwitcherLabel = _ref.appSwitcherLabel,
|
|
119
123
|
i18n = _ref.i18n,
|
|
120
124
|
testId = _ref.testId,
|
|
121
|
-
isActionItemVisible = _ref.isActionItemVisible
|
|
125
|
+
isActionItemVisible = _ref.isActionItemVisible,
|
|
126
|
+
isSideNavExpanded = _ref.isSideNavExpanded;
|
|
122
127
|
|
|
123
128
|
var mergedI18n = _objectSpread(_objectSpread({}, defaultProps.i18n), i18n);
|
|
124
129
|
|
|
@@ -147,7 +152,7 @@ var Header = function Header(_ref) {
|
|
|
147
152
|
href: skipto
|
|
148
153
|
}), hasSideNav && /*#__PURE__*/React__default['default'].createElement(HeaderMenuButton, {
|
|
149
154
|
"data-testid": "".concat(testId, "-menu-button"),
|
|
150
|
-
"aria-label": mergedI18n.openMenu,
|
|
155
|
+
"aria-label": isSideNavExpanded ? mergedI18n.closeMenu : mergedI18n.openMenu,
|
|
151
156
|
onClick: onClickSideNavExpand
|
|
152
157
|
}), /*#__PURE__*/React__default['default'].createElement(HeaderName, {
|
|
153
158
|
"data-testid": "".concat(testId, "-name"),
|
|
@@ -325,6 +330,17 @@ Header.__docgenInfo = {
|
|
|
325
330
|
"required": false,
|
|
326
331
|
"description": "Returns true, if the icon should be shown. (actionItem) => {}"
|
|
327
332
|
},
|
|
333
|
+
"isSideNavExpanded": {
|
|
334
|
+
"defaultValue": {
|
|
335
|
+
"value": "false",
|
|
336
|
+
"computed": false
|
|
337
|
+
},
|
|
338
|
+
"type": {
|
|
339
|
+
"name": "bool"
|
|
340
|
+
},
|
|
341
|
+
"required": false,
|
|
342
|
+
"description": "allows setting aria-label on side-nav menu button correctly"
|
|
343
|
+
},
|
|
328
344
|
"appName": {
|
|
329
345
|
"type": {
|
|
330
346
|
"name": "string"
|
|
@@ -643,7 +643,8 @@ var Table = function Table(props) {
|
|
|
643
643
|
tooltip = _merge2.tooltip,
|
|
644
644
|
error = _merge2.error,
|
|
645
645
|
testId = _merge2.testId,
|
|
646
|
-
|
|
646
|
+
size = _merge2.size,
|
|
647
|
+
others = _objectWithoutProperties__default['default'](_merge2, ["id", "columns", "columnGroups", "data", "expandedData", "locale", "view", "actions", "actions", "options", "lightweight", "className", "style", "i18n", "secondaryTitle", "tooltip", "error", "testId", "size"]); // There is no way to access the current search value in the Table
|
|
647
648
|
// so we need to track that for the save view functionality.
|
|
648
649
|
|
|
649
650
|
|
|
@@ -918,8 +919,11 @@ var Table = function Table(props) {
|
|
|
918
919
|
id: id // TODO: remove id in v3
|
|
919
920
|
,
|
|
920
921
|
"data-testid": id || testId,
|
|
921
|
-
className: classnames__default['default']((_classnames2 = {}, _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--data-table--column-groups"), columnGroups.length), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--data-table--column-groups--min-size-large"), columnGroups.length && minHeaderSizeIsLarge), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--data-table--resize"), options.hasResize), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--data-table--fixed"), options.hasResize && !options.useAutoTableLayoutForResize), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--data-table--row-actions"), options.hasRowActions), _classnames2))
|
|
922
|
-
|
|
922
|
+
className: classnames__default['default']((_classnames2 = {}, _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--data-table--column-groups"), columnGroups.length), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--data-table--column-groups--min-size-large"), columnGroups.length && minHeaderSizeIsLarge), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--data-table--resize"), options.hasResize), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--data-table--fixed"), options.hasResize && !options.useAutoTableLayoutForResize), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--data-table--row-actions"), options.hasRowActions), _classnames2)),
|
|
923
|
+
size: size
|
|
924
|
+
}, others), columns.length ? /*#__PURE__*/React__default['default'].createElement(TableHead, _extends__default['default']({
|
|
925
|
+
size: size
|
|
926
|
+
}, others, {
|
|
923
927
|
i18n: i18n,
|
|
924
928
|
lightweight: lightweight,
|
|
925
929
|
options: _objectSpread(_objectSpread({}, pick(options, 'hasAggregations', 'hasColumnSelectionConfig', 'hasResize', 'hasRowActions', 'hasRowNesting', 'hasSingleRowEdit', 'hasRowSelection', 'useAutoTableLayoutForResize', 'hasMultiSort', 'preserveColumnWidths')), {}, {
|
|
@@ -995,7 +999,8 @@ var Table = function Table(props) {
|
|
|
995
999
|
actions: pick(actions.table, 'onRowSelected', 'onApplyRowAction', 'onClearRowError', 'onRowExpanded', 'onRowClicked', 'onRowLoadMore') // TODO: remove 'id' in v3.
|
|
996
1000
|
,
|
|
997
1001
|
testId: "".concat(id || testId, "-table-body"),
|
|
998
|
-
showExpanderColumn: showExpanderColumn
|
|
1002
|
+
showExpanderColumn: showExpanderColumn,
|
|
1003
|
+
size: size
|
|
999
1004
|
})) : /*#__PURE__*/React__default['default'].createElement(EmptyTable, {
|
|
1000
1005
|
id: id,
|
|
1001
1006
|
totalColumns: totalColumns,
|
|
@@ -15,6 +15,7 @@ require('core-js/modules/es.array.concat.js');
|
|
|
15
15
|
require('core-js/modules/es.array.filter.js');
|
|
16
16
|
require('core-js/modules/es.array.find-index.js');
|
|
17
17
|
require('core-js/modules/es.array.map.js');
|
|
18
|
+
require('core-js/modules/es.array.includes.js');
|
|
18
19
|
var React = require('react');
|
|
19
20
|
var PropTypes = require('prop-types');
|
|
20
21
|
var carbonComponentsReact = require('carbon-components-react');
|
|
@@ -97,7 +98,12 @@ var propTypes = {
|
|
|
97
98
|
/**
|
|
98
99
|
* Direction of document. Passed in at Table
|
|
99
100
|
*/
|
|
100
|
-
langDir: PropTypes__default['default'].oneOf(['ltr', 'rtl'])
|
|
101
|
+
langDir: PropTypes__default['default'].oneOf(['ltr', 'rtl']),
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* the size passed to the table to set row height
|
|
105
|
+
*/
|
|
106
|
+
size: PropTypes__default['default'].oneOf(['xs', 'sm', 'md', 'lg', 'xl'])
|
|
101
107
|
};
|
|
102
108
|
var defaultProps = {
|
|
103
109
|
actions: null,
|
|
@@ -110,7 +116,8 @@ var defaultProps = {
|
|
|
110
116
|
isDelete: false,
|
|
111
117
|
showSingleRowEditButtons: false,
|
|
112
118
|
singleRowEditButtons: null,
|
|
113
|
-
langDir: 'ltr'
|
|
119
|
+
langDir: 'ltr',
|
|
120
|
+
size: undefined
|
|
114
121
|
};
|
|
115
122
|
|
|
116
123
|
var RowActionsCell = /*#__PURE__*/function (_React$Component) {
|
|
@@ -184,7 +191,8 @@ var RowActionsCell = /*#__PURE__*/function (_React$Component) {
|
|
|
184
191
|
inProgressText = _this$props.inProgressText,
|
|
185
192
|
showSingleRowEditButtons = _this$props.showSingleRowEditButtons,
|
|
186
193
|
singleRowEditButtons = _this$props.singleRowEditButtons,
|
|
187
|
-
langDir = _this$props.langDir
|
|
194
|
+
langDir = _this$props.langDir,
|
|
195
|
+
size = _this$props.size;
|
|
188
196
|
var isOpen = this.state.isOpen;
|
|
189
197
|
var overflowActions = actions ? actions.filter(function (action) {
|
|
190
198
|
return action.isOverflow;
|
|
@@ -247,7 +255,9 @@ var RowActionsCell = /*#__PURE__*/function (_React$Component) {
|
|
|
247
255
|
},
|
|
248
256
|
iconDescription: overflowMenuAria,
|
|
249
257
|
onOpen: this.handleOpen,
|
|
250
|
-
onClose: this.handleClose,
|
|
258
|
+
onClose: this.handleClose // compact or xs rows need the `sm` overflow menu, everything else is default (md)
|
|
259
|
+
,
|
|
260
|
+
size: ['compact', 'xs'].includes(size) ? 'sm' : undefined,
|
|
251
261
|
className: "".concat(iotPrefix, "--row-actions-cell--overflow-menu"),
|
|
252
262
|
selectorPrimaryFocus: ".".concat(iotPrefix, "--action-overflow-item--initialFocus"),
|
|
253
263
|
useAutoPositioning: true
|
|
@@ -442,6 +452,33 @@ RowActionsCell.__docgenInfo = {
|
|
|
442
452
|
"required": false,
|
|
443
453
|
"description": "Direction of document. Passed in at Table"
|
|
444
454
|
},
|
|
455
|
+
"size": {
|
|
456
|
+
"defaultValue": {
|
|
457
|
+
"value": "undefined",
|
|
458
|
+
"computed": true
|
|
459
|
+
},
|
|
460
|
+
"type": {
|
|
461
|
+
"name": "enum",
|
|
462
|
+
"value": [{
|
|
463
|
+
"value": "'xs'",
|
|
464
|
+
"computed": false
|
|
465
|
+
}, {
|
|
466
|
+
"value": "'sm'",
|
|
467
|
+
"computed": false
|
|
468
|
+
}, {
|
|
469
|
+
"value": "'md'",
|
|
470
|
+
"computed": false
|
|
471
|
+
}, {
|
|
472
|
+
"value": "'lg'",
|
|
473
|
+
"computed": false
|
|
474
|
+
}, {
|
|
475
|
+
"value": "'xl'",
|
|
476
|
+
"computed": false
|
|
477
|
+
}]
|
|
478
|
+
},
|
|
479
|
+
"required": false,
|
|
480
|
+
"description": "the size passed to the table to set row height"
|
|
481
|
+
},
|
|
445
482
|
"id": {
|
|
446
483
|
"type": {
|
|
447
484
|
"name": "string"
|