carbon-addons-iot-react 5.6.3 → 5.6.5
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/es/components/Table/Table.js +2 -1
- package/es/components/Table/TableBody/TableBody.js +17 -0
- package/es/components/Table/TableBody/TableBodyRow/TableBodyRow.js +33 -1
- package/es/components/Table/TableBody/TableBodyRow/TableDragHandle.js +39 -3
- package/es/components/Table/TableBody/TableBodyRowRenderer.js +32 -0
- package/es/components/Table/TableToolbar/TableToolbar.js +73 -3
- package/lib/components/Table/Table.js +2 -1
- package/lib/components/Table/TableBody/TableBody.js +17 -0
- package/lib/components/Table/TableBody/TableBodyRow/TableBodyRow.js +33 -1
- package/lib/components/Table/TableBody/TableBodyRow/TableDragHandle.js +39 -3
- package/lib/components/Table/TableBody/TableBodyRowRenderer.js +32 -0
- package/lib/components/Table/TableToolbar/TableToolbar.js +73 -3
- package/package.json +1 -1
- package/umd/carbon-addons-iot-react.js +27905 -27722
|
@@ -594,6 +594,7 @@ var defaultProps = function defaultProps(baseProps) {
|
|
|
594
594
|
multiSortDescending: 'Descending',
|
|
595
595
|
multiSortOverflowItem: 'Multi-sort',
|
|
596
596
|
multiSortDragHandle: 'Drag handle',
|
|
597
|
+
dragHandleTooltip: 'Click and drag to new location',
|
|
597
598
|
// table error state
|
|
598
599
|
tableErrorStateTitle: 'Unable to load the page',
|
|
599
600
|
buttonLabelOnTableError: 'Refresh the page',
|
|
@@ -1009,7 +1010,7 @@ var Table = function Table(props) {
|
|
|
1009
1010
|
selectedIds: view.table.selectedIds,
|
|
1010
1011
|
loadingMoreIds: view.table.loadingMoreIds,
|
|
1011
1012
|
zIndex: zIndex
|
|
1012
|
-
}, _pick(i18n, 'overflowMenuAria', 'clickToExpandAria', 'clickToCollapseAria', 'inProgressText', 'actionFailedText', 'learnMoreText', 'dismissText', 'selectRowAria', 'loadMoreText'), {
|
|
1013
|
+
}, _pick(i18n, 'overflowMenuAria', 'clickToExpandAria', 'clickToCollapseAria', 'inProgressText', 'actionFailedText', 'learnMoreText', 'dismissText', 'selectRowAria', 'loadMoreText', 'dragHandleTooltip'), {
|
|
1013
1014
|
totalColumns: totalColumns
|
|
1014
1015
|
}, _pick(options, 'hasRowSelection', 'hasRowActions', 'hasRowNesting', 'shouldExpandOnRowClick', 'shouldLazyRender', 'preserveCellWhiteSpace', 'useRadioButtonSingleSelect', 'hasDragAndDrop', 'hasBreadcrumbDrop'), {
|
|
1015
1016
|
hideDragHandles: hideDragHandles,
|
|
@@ -57,6 +57,8 @@ var propTypes = {
|
|
|
57
57
|
dismissText: PropTypes.string,
|
|
58
58
|
/** I18N label for load more */
|
|
59
59
|
loadMoreText: PropTypes.string,
|
|
60
|
+
/** I18N label for drag handle tooltip */
|
|
61
|
+
dragHandleTooltip: PropTypes.string,
|
|
60
62
|
/** since some columns might not be currently visible */
|
|
61
63
|
totalColumns: PropTypes.number,
|
|
62
64
|
hasRowSelection: PropTypes.oneOf(['multi', 'single', false]),
|
|
@@ -154,6 +156,7 @@ var defaultProps = {
|
|
|
154
156
|
inProgressText: 'In progress',
|
|
155
157
|
dismissText: 'Dismiss',
|
|
156
158
|
actionFailedText: 'Action failed',
|
|
159
|
+
dragHandleTooltip: 'Click and drag to new location',
|
|
157
160
|
size: undefined,
|
|
158
161
|
hasDragAndDrop: false,
|
|
159
162
|
hasBreadcrumbDrop: false,
|
|
@@ -179,6 +182,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
179
182
|
dismissText = _ref.dismissText,
|
|
180
183
|
actionFailedText = _ref.actionFailedText,
|
|
181
184
|
loadMoreText = _ref.loadMoreText,
|
|
185
|
+
dragHandleTooltip = _ref.dragHandleTooltip,
|
|
182
186
|
totalColumns = _ref.totalColumns,
|
|
183
187
|
actions = _ref.actions,
|
|
184
188
|
rowActionsState = _ref.rowActionsState,
|
|
@@ -320,6 +324,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
320
324
|
clickToExpandAria: clickToExpandAria,
|
|
321
325
|
columns: columns,
|
|
322
326
|
dismissText: dismissText,
|
|
327
|
+
dragHandleTooltip: dragHandleTooltip,
|
|
323
328
|
expandedIds: expandedIds,
|
|
324
329
|
expandedRows: expandedRows,
|
|
325
330
|
hasRowActions: hasRowActions,
|
|
@@ -329,6 +334,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
329
334
|
useRadioButtonSingleSelect: useRadioButtonSingleSelect,
|
|
330
335
|
indeterminateSelectionIds: getIndeterminateRowSelectionIds(rows, selectedIds),
|
|
331
336
|
inProgressText: inProgressText,
|
|
337
|
+
isDragging: isDragging,
|
|
332
338
|
langDir: langDir,
|
|
333
339
|
learnMoreText: learnMoreText,
|
|
334
340
|
loadingMoreIds: loadingMoreIds,
|
|
@@ -756,6 +762,17 @@ TableBody.__docgenInfo = {
|
|
|
756
762
|
},
|
|
757
763
|
"required": false
|
|
758
764
|
},
|
|
765
|
+
"dragHandleTooltip": {
|
|
766
|
+
"defaultValue": {
|
|
767
|
+
"value": "'Click and drag to new location'",
|
|
768
|
+
"computed": false
|
|
769
|
+
},
|
|
770
|
+
"description": "I18N label for drag handle tooltip",
|
|
771
|
+
"type": {
|
|
772
|
+
"name": "string"
|
|
773
|
+
},
|
|
774
|
+
"required": false
|
|
775
|
+
},
|
|
759
776
|
"size": {
|
|
760
777
|
"defaultValue": {
|
|
761
778
|
"value": "undefined",
|
|
@@ -46,6 +46,8 @@ var propTypes = {
|
|
|
46
46
|
clickToExpandAria: PropTypes.string,
|
|
47
47
|
/** internationalized label */
|
|
48
48
|
clickToCollapseAria: PropTypes.string,
|
|
49
|
+
/** I18N label for drag handle tooltip */
|
|
50
|
+
dragHandleTooltip: PropTypes.string,
|
|
49
51
|
/** List of columns */
|
|
50
52
|
columns: TableColumnsPropTypes.isRequired,
|
|
51
53
|
/** table wide options */
|
|
@@ -137,6 +139,8 @@ var propTypes = {
|
|
|
137
139
|
isDraggable: PropTypes.bool,
|
|
138
140
|
/** If this row is being dragged. */
|
|
139
141
|
isDragRow: PropTypes.bool,
|
|
142
|
+
/** If a drag operation is currently in progress. */
|
|
143
|
+
isDragging: PropTypes.bool,
|
|
140
144
|
/** If all drag handles should be hidden. This happens when an undraggable row is in the selection. */
|
|
141
145
|
hideDragHandles: PropTypes.bool,
|
|
142
146
|
/** Attribute name to identify deleted rows */
|
|
@@ -150,6 +154,7 @@ var defaultProps = {
|
|
|
150
154
|
overflowMenuAria: 'More actions',
|
|
151
155
|
clickToExpandAria: 'Click to expand.',
|
|
152
156
|
clickToCollapseAria: 'Click to collapse.',
|
|
157
|
+
dragHandleTooltip: 'Click and drag to new location',
|
|
153
158
|
rowActions: null,
|
|
154
159
|
rowDetails: null,
|
|
155
160
|
nestingLevel: 0,
|
|
@@ -177,6 +182,7 @@ var defaultProps = {
|
|
|
177
182
|
onDragLeaveRow: null,
|
|
178
183
|
isDraggable: false,
|
|
179
184
|
isDragRow: false,
|
|
185
|
+
isDragging: false,
|
|
180
186
|
deletedAttribute: '_deleted'
|
|
181
187
|
};
|
|
182
188
|
var TableBodyRow = function TableBodyRow(_ref) {
|
|
@@ -210,6 +216,7 @@ var TableBodyRow = function TableBodyRow(_ref) {
|
|
|
210
216
|
overflowMenuAria = _ref.overflowMenuAria,
|
|
211
217
|
clickToExpandAria = _ref.clickToExpandAria,
|
|
212
218
|
clickToCollapseAria = _ref.clickToCollapseAria,
|
|
219
|
+
dragHandleTooltip = _ref.dragHandleTooltip,
|
|
213
220
|
inProgressText = _ref.inProgressText,
|
|
214
221
|
actionFailedText = _ref.actionFailedText,
|
|
215
222
|
learnMoreText = _ref.learnMoreText,
|
|
@@ -233,6 +240,7 @@ var TableBodyRow = function TableBodyRow(_ref) {
|
|
|
233
240
|
onDragLeaveRow = _ref.onDragLeaveRow,
|
|
234
241
|
isDragRow = _ref.isDragRow,
|
|
235
242
|
isDraggable = _ref.isDraggable,
|
|
243
|
+
isDragging = _ref.isDragging,
|
|
236
244
|
hasDragAndDrop = _ref.hasDragAndDrop,
|
|
237
245
|
hideDragHandles = _ref.hideDragHandles,
|
|
238
246
|
deletedAttribute = _ref.deletedAttribute;
|
|
@@ -289,7 +297,9 @@ var TableBodyRow = function TableBodyRow(_ref) {
|
|
|
289
297
|
className: "".concat(iotPrefix, "--table-grab-handle-cell")
|
|
290
298
|
}, !isDraggable || hideDragHandles ? null : /*#__PURE__*/React__default.createElement(TableDragHandle, {
|
|
291
299
|
onStartDrag: onStartDrag,
|
|
292
|
-
rowId: id
|
|
300
|
+
rowId: id,
|
|
301
|
+
isDragging: isDragging,
|
|
302
|
+
tooltipText: dragHandleTooltip
|
|
293
303
|
}));
|
|
294
304
|
var firstVisibleColIndex = ordering.findIndex(function (col) {
|
|
295
305
|
return !col.isHidden;
|
|
@@ -548,6 +558,17 @@ TableBodyRow.__docgenInfo = {
|
|
|
548
558
|
},
|
|
549
559
|
"required": false
|
|
550
560
|
},
|
|
561
|
+
"dragHandleTooltip": {
|
|
562
|
+
"defaultValue": {
|
|
563
|
+
"value": "'Click and drag to new location'",
|
|
564
|
+
"computed": false
|
|
565
|
+
},
|
|
566
|
+
"description": "I18N label for drag handle tooltip",
|
|
567
|
+
"type": {
|
|
568
|
+
"name": "string"
|
|
569
|
+
},
|
|
570
|
+
"required": false
|
|
571
|
+
},
|
|
551
572
|
"rowActions": {
|
|
552
573
|
"defaultValue": {
|
|
553
574
|
"value": "null",
|
|
@@ -937,6 +958,17 @@ TableBodyRow.__docgenInfo = {
|
|
|
937
958
|
},
|
|
938
959
|
"required": false
|
|
939
960
|
},
|
|
961
|
+
"isDragging": {
|
|
962
|
+
"defaultValue": {
|
|
963
|
+
"value": "false",
|
|
964
|
+
"computed": false
|
|
965
|
+
},
|
|
966
|
+
"description": "If a drag operation is currently in progress.",
|
|
967
|
+
"type": {
|
|
968
|
+
"name": "bool"
|
|
969
|
+
},
|
|
970
|
+
"required": false
|
|
971
|
+
},
|
|
940
972
|
"deletedAttribute": {
|
|
941
973
|
"defaultValue": {
|
|
942
974
|
"value": "'_deleted'",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React__default, { forwardRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { Tooltip } from '@carbon/react';
|
|
3
4
|
import { settings } from '../../../../constants/Settings.js';
|
|
4
5
|
import { Draggable } from '@carbon/icons-react';
|
|
5
6
|
|
|
@@ -13,7 +14,15 @@ var propTypes = {
|
|
|
13
14
|
/**
|
|
14
15
|
* The ID of the table row this handle is it. This is the row that will be dragged by this handle.
|
|
15
16
|
*/
|
|
16
|
-
rowId: PropTypes.string.isRequired
|
|
17
|
+
rowId: PropTypes.string.isRequired,
|
|
18
|
+
/**
|
|
19
|
+
* If a drag operation is currently in progress. When true, the tooltip is hidden.
|
|
20
|
+
*/
|
|
21
|
+
isDragging: PropTypes.bool.isRequired,
|
|
22
|
+
/**
|
|
23
|
+
* Tooltip text to display on hover.
|
|
24
|
+
*/
|
|
25
|
+
tooltipText: PropTypes.string.isRequired
|
|
17
26
|
};
|
|
18
27
|
|
|
19
28
|
/**
|
|
@@ -21,7 +30,9 @@ var propTypes = {
|
|
|
21
30
|
*/
|
|
22
31
|
var TableDragHandle = /*#__PURE__*/forwardRef(function TableDragHandle(_ref, ref) {
|
|
23
32
|
var onStartDrag = _ref.onStartDrag,
|
|
24
|
-
rowId = _ref.rowId
|
|
33
|
+
rowId = _ref.rowId,
|
|
34
|
+
isDragging = _ref.isDragging,
|
|
35
|
+
tooltipText = _ref.tooltipText;
|
|
25
36
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
26
37
|
className: "".concat(iotPrefix, "--table-drag-handle"),
|
|
27
38
|
ref: ref,
|
|
@@ -31,7 +42,18 @@ var TableDragHandle = /*#__PURE__*/forwardRef(function TableDragHandle(_ref, ref
|
|
|
31
42
|
e.stopPropagation();
|
|
32
43
|
onStartDrag(e, rowId);
|
|
33
44
|
}
|
|
34
|
-
},
|
|
45
|
+
}, isDragging ?
|
|
46
|
+
/*#__PURE__*/
|
|
47
|
+
// During drag, render icon without tooltip
|
|
48
|
+
React__default.createElement("div", {
|
|
49
|
+
className: "".concat(iotPrefix, "--table-drag-handle-icon")
|
|
50
|
+
}, /*#__PURE__*/React__default.createElement(Draggable, null)) :
|
|
51
|
+
/*#__PURE__*/
|
|
52
|
+
// When not dragging, render with tooltip
|
|
53
|
+
React__default.createElement(Tooltip, {
|
|
54
|
+
label: tooltipText,
|
|
55
|
+
autoAlign: true
|
|
56
|
+
}, /*#__PURE__*/React__default.createElement(Draggable, null)));
|
|
35
57
|
});
|
|
36
58
|
TableDragHandle.propTypes = propTypes;
|
|
37
59
|
TableDragHandle.__docgenInfo = {
|
|
@@ -52,6 +74,20 @@ TableDragHandle.__docgenInfo = {
|
|
|
52
74
|
"name": "string"
|
|
53
75
|
},
|
|
54
76
|
"required": true
|
|
77
|
+
},
|
|
78
|
+
"isDragging": {
|
|
79
|
+
"description": "If a drag operation is currently in progress. When true, the tooltip is hidden.",
|
|
80
|
+
"type": {
|
|
81
|
+
"name": "bool"
|
|
82
|
+
},
|
|
83
|
+
"required": true
|
|
84
|
+
},
|
|
85
|
+
"tooltipText": {
|
|
86
|
+
"description": "Tooltip text to display on hover.",
|
|
87
|
+
"type": {
|
|
88
|
+
"name": "string"
|
|
89
|
+
},
|
|
90
|
+
"required": true
|
|
55
91
|
}
|
|
56
92
|
}
|
|
57
93
|
};
|
|
@@ -54,6 +54,10 @@ var propTypes = {
|
|
|
54
54
|
dismissText: PropTypes.string,
|
|
55
55
|
/** I18N label for load more */
|
|
56
56
|
loadMoreText: PropTypes.string,
|
|
57
|
+
/** I18N label for drag handle tooltip */
|
|
58
|
+
dragHandleTooltip: PropTypes.string,
|
|
59
|
+
/** If a drag is currently in progress */
|
|
60
|
+
isDragging: PropTypes.bool,
|
|
57
61
|
/** since some columns might not be currently visible */
|
|
58
62
|
totalColumns: PropTypes.number,
|
|
59
63
|
hasRowSelection: PropTypes.oneOf(['multi', 'single', false]),
|
|
@@ -137,6 +141,7 @@ var defaultProps = {
|
|
|
137
141
|
clickToExpandAria: 'Click to expand.',
|
|
138
142
|
columns: [],
|
|
139
143
|
dismissText: 'Dismiss',
|
|
144
|
+
dragHandleTooltip: 'Click and drag to new location',
|
|
140
145
|
expandedIds: [],
|
|
141
146
|
expandedRows: [],
|
|
142
147
|
hasRowActions: false,
|
|
@@ -146,6 +151,7 @@ var defaultProps = {
|
|
|
146
151
|
useRadioButtonSingleSelect: false,
|
|
147
152
|
indeterminateSelectionIds: [],
|
|
148
153
|
inProgressText: 'In progress',
|
|
154
|
+
isDragging: false,
|
|
149
155
|
langDir: 'ltr',
|
|
150
156
|
learnMoreText: 'Learn more',
|
|
151
157
|
loadingMoreIds: [],
|
|
@@ -184,6 +190,7 @@ function TableBodyRowRenderer(props) {
|
|
|
184
190
|
clickToExpandAria = props.clickToExpandAria,
|
|
185
191
|
columns = props.columns,
|
|
186
192
|
dismissText = props.dismissText,
|
|
193
|
+
dragHandleTooltip = props.dragHandleTooltip,
|
|
187
194
|
expandedIds = props.expandedIds,
|
|
188
195
|
expandedRows = props.expandedRows,
|
|
189
196
|
hasRowActions = props.hasRowActions,
|
|
@@ -193,6 +200,7 @@ function TableBodyRowRenderer(props) {
|
|
|
193
200
|
useRadioButtonSingleSelect = props.useRadioButtonSingleSelect,
|
|
194
201
|
indeterminateSelectionIds = props.indeterminateSelectionIds,
|
|
195
202
|
inProgressText = props.inProgressText,
|
|
203
|
+
isDragging = props.isDragging,
|
|
196
204
|
langDir = props.langDir,
|
|
197
205
|
learnMoreText = props.learnMoreText,
|
|
198
206
|
loadingMoreIds = props.loadingMoreIds,
|
|
@@ -262,6 +270,8 @@ function TableBodyRowRenderer(props) {
|
|
|
262
270
|
onDragEnterRow: canDrop ? onDragEnterRow : null,
|
|
263
271
|
onDragLeaveRow: canDrop ? onDragLeaveRow : null,
|
|
264
272
|
isDragRow: dragRowIds.indexOf(row.id) !== -1,
|
|
273
|
+
isDragging: isDragging,
|
|
274
|
+
dragHandleTooltip: dragHandleTooltip,
|
|
265
275
|
langDir: langDir,
|
|
266
276
|
key: row.id,
|
|
267
277
|
isExpanded: isRowExpanded,
|
|
@@ -422,6 +432,17 @@ TableBodyRowRenderer.__docgenInfo = {
|
|
|
422
432
|
},
|
|
423
433
|
"required": false
|
|
424
434
|
},
|
|
435
|
+
"dragHandleTooltip": {
|
|
436
|
+
"defaultValue": {
|
|
437
|
+
"value": "'Click and drag to new location'",
|
|
438
|
+
"computed": false
|
|
439
|
+
},
|
|
440
|
+
"description": "I18N label for drag handle tooltip",
|
|
441
|
+
"type": {
|
|
442
|
+
"name": "string"
|
|
443
|
+
},
|
|
444
|
+
"required": false
|
|
445
|
+
},
|
|
425
446
|
"expandedIds": {
|
|
426
447
|
"defaultValue": {
|
|
427
448
|
"value": "[]",
|
|
@@ -550,6 +571,17 @@ TableBodyRowRenderer.__docgenInfo = {
|
|
|
550
571
|
},
|
|
551
572
|
"required": false
|
|
552
573
|
},
|
|
574
|
+
"isDragging": {
|
|
575
|
+
"defaultValue": {
|
|
576
|
+
"value": "false",
|
|
577
|
+
"computed": false
|
|
578
|
+
},
|
|
579
|
+
"description": "If a drag is currently in progress",
|
|
580
|
+
"type": {
|
|
581
|
+
"name": "bool"
|
|
582
|
+
},
|
|
583
|
+
"required": false
|
|
584
|
+
},
|
|
553
585
|
"langDir": {
|
|
554
586
|
"defaultValue": {
|
|
555
587
|
"value": "'ltr'",
|
|
@@ -7,13 +7,17 @@ import isNil from '../../../node_modules/lodash-es/isNil.js';
|
|
|
7
7
|
import 'core-js/modules/es.symbol.js';
|
|
8
8
|
import 'core-js/modules/es.array.concat.js';
|
|
9
9
|
import 'core-js/modules/es.array.filter.js';
|
|
10
|
+
import 'core-js/modules/es.array.includes.js';
|
|
10
11
|
import 'core-js/modules/es.array.map.js';
|
|
12
|
+
import 'core-js/modules/es.array.slice.js';
|
|
11
13
|
import 'core-js/modules/es.function.name.js';
|
|
12
14
|
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
13
15
|
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
14
16
|
import 'core-js/modules/es.object.keys.js';
|
|
15
17
|
import 'core-js/modules/es.object.to-string.js';
|
|
18
|
+
import 'core-js/modules/es.promise.js';
|
|
16
19
|
import 'core-js/modules/es.regexp.exec.js';
|
|
20
|
+
import 'core-js/modules/es.string.includes.js';
|
|
17
21
|
import 'core-js/modules/es.string.search.js';
|
|
18
22
|
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
19
23
|
import React__default, { useMemo } from 'react';
|
|
@@ -250,6 +254,72 @@ var TableToolbar = function TableToolbar(_ref) {
|
|
|
250
254
|
var visibleToolbarActions = actions.filter(function (action) {
|
|
251
255
|
return !action.isOverflow && action.hidden !== true;
|
|
252
256
|
});
|
|
257
|
+
|
|
258
|
+
// Extract TableViewDropdown from customToolbarContent
|
|
259
|
+
var _useMemo = useMemo(function () {
|
|
260
|
+
var _customToolbarContent;
|
|
261
|
+
if (!customToolbarContent) {
|
|
262
|
+
return {
|
|
263
|
+
tableViewDropdown: null,
|
|
264
|
+
otherToolbarContent: null
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Helper function to check if a child is TableViewDropdown
|
|
269
|
+
var isTableViewDropdown = function isTableViewDropdown(child) {
|
|
270
|
+
if (!child) return false;
|
|
271
|
+
|
|
272
|
+
// Check by key (most reliable for wrapped components)
|
|
273
|
+
if (child.key && typeof child.key === 'string' && child.key.includes('table-view-dropdown')) {
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Check by type properties
|
|
278
|
+
if (child.type) {
|
|
279
|
+
// Check by displayName
|
|
280
|
+
if (child.type.displayName === 'TableViewDropdown') return true;
|
|
281
|
+
|
|
282
|
+
// Check by function name
|
|
283
|
+
if (child.type.name === 'TableViewDropdown') return true;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Check by props (TableViewDropdown has specific props like 'views', 'selectedViewId')
|
|
287
|
+
if (child.props && (child.props.views !== undefined || child.props.selectedViewId !== undefined || child.props.selectedViewEdited !== undefined)) {
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
return false;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// Extract children from Fragment if present
|
|
294
|
+
var contentToProcess = customToolbarContent;
|
|
295
|
+
|
|
296
|
+
// Check if it's a Fragment (React.Fragment has type as Symbol or Fragment)
|
|
297
|
+
if (customToolbarContent.type === React__default.Fragment && (_customToolbarContent = customToolbarContent.props) !== null && _customToolbarContent !== void 0 && _customToolbarContent.children) {
|
|
298
|
+
contentToProcess = customToolbarContent.props.children;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Convert to array (handles both single element and multiple children)
|
|
302
|
+
var contentArray = React__default.Children.toArray(contentToProcess);
|
|
303
|
+
|
|
304
|
+
// Always check the first element
|
|
305
|
+
var firstElement = contentArray[0];
|
|
306
|
+
if (isTableViewDropdown(firstElement)) {
|
|
307
|
+
// First element is TableViewDropdown - extract it, rest is other content
|
|
308
|
+
var remainingContent = contentArray.slice(1);
|
|
309
|
+
return {
|
|
310
|
+
tableViewDropdown: firstElement,
|
|
311
|
+
otherToolbarContent: remainingContent.length > 0 ? remainingContent : null
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// First element is not TableViewDropdown - all content is other content
|
|
316
|
+
return {
|
|
317
|
+
tableViewDropdown: null,
|
|
318
|
+
otherToolbarContent: contentArray.length > 0 ? contentArray : null
|
|
319
|
+
};
|
|
320
|
+
}, [customToolbarContent]),
|
|
321
|
+
tableViewDropdown = _useMemo.tableViewDropdown,
|
|
322
|
+
otherToolbarContent = _useMemo.otherToolbarContent;
|
|
253
323
|
var visibleBatchActions = batchActions.filter(function (action) {
|
|
254
324
|
return !action.isOverflow && action.hidden !== true;
|
|
255
325
|
});
|
|
@@ -389,7 +459,7 @@ var TableToolbar = function TableToolbar(_ref) {
|
|
|
389
459
|
, {
|
|
390
460
|
"data-testid": "".concat(testID || testId, "-content"),
|
|
391
461
|
className: "".concat(iotPrefix, "--table-toolbar-content")
|
|
392
|
-
}, hasSearch ? /*#__PURE__*/React__default.createElement(TableToolbarSearch, {
|
|
462
|
+
}, tableViewDropdown || null, hasSearch ? /*#__PURE__*/React__default.createElement(TableToolbarSearch, {
|
|
393
463
|
tableId: tableId,
|
|
394
464
|
i18n: i18n,
|
|
395
465
|
options: {
|
|
@@ -532,8 +602,8 @@ var TableToolbar = function TableToolbar(_ref) {
|
|
|
532
602
|
itemText: "",
|
|
533
603
|
disabled: true
|
|
534
604
|
})) : null,
|
|
535
|
-
//
|
|
536
|
-
|
|
605
|
+
// Render other custom toolbar content
|
|
606
|
+
otherToolbarContent || null));
|
|
537
607
|
};
|
|
538
608
|
TableToolbar.propTypes = propTypes;
|
|
539
609
|
TableToolbar.defaultProps = defaultProps;
|
|
@@ -611,6 +611,7 @@ var defaultProps = function defaultProps(baseProps) {
|
|
|
611
611
|
multiSortDescending: 'Descending',
|
|
612
612
|
multiSortOverflowItem: 'Multi-sort',
|
|
613
613
|
multiSortDragHandle: 'Drag handle',
|
|
614
|
+
dragHandleTooltip: 'Click and drag to new location',
|
|
614
615
|
// table error state
|
|
615
616
|
tableErrorStateTitle: 'Unable to load the page',
|
|
616
617
|
buttonLabelOnTableError: 'Refresh the page',
|
|
@@ -1026,7 +1027,7 @@ var Table = function Table(props) {
|
|
|
1026
1027
|
selectedIds: view.table.selectedIds,
|
|
1027
1028
|
loadingMoreIds: view.table.loadingMoreIds,
|
|
1028
1029
|
zIndex: zIndex
|
|
1029
|
-
}, pick(i18n, 'overflowMenuAria', 'clickToExpandAria', 'clickToCollapseAria', 'inProgressText', 'actionFailedText', 'learnMoreText', 'dismissText', 'selectRowAria', 'loadMoreText'), {
|
|
1030
|
+
}, pick(i18n, 'overflowMenuAria', 'clickToExpandAria', 'clickToCollapseAria', 'inProgressText', 'actionFailedText', 'learnMoreText', 'dismissText', 'selectRowAria', 'loadMoreText', 'dragHandleTooltip'), {
|
|
1030
1031
|
totalColumns: totalColumns
|
|
1031
1032
|
}, pick(options, 'hasRowSelection', 'hasRowActions', 'hasRowNesting', 'shouldExpandOnRowClick', 'shouldLazyRender', 'preserveCellWhiteSpace', 'useRadioButtonSingleSelect', 'hasDragAndDrop', 'hasBreadcrumbDrop'), {
|
|
1032
1033
|
hideDragHandles: hideDragHandles,
|
|
@@ -67,6 +67,8 @@ var propTypes = {
|
|
|
67
67
|
dismissText: PropTypes__default.default.string,
|
|
68
68
|
/** I18N label for load more */
|
|
69
69
|
loadMoreText: PropTypes__default.default.string,
|
|
70
|
+
/** I18N label for drag handle tooltip */
|
|
71
|
+
dragHandleTooltip: PropTypes__default.default.string,
|
|
70
72
|
/** since some columns might not be currently visible */
|
|
71
73
|
totalColumns: PropTypes__default.default.number,
|
|
72
74
|
hasRowSelection: PropTypes__default.default.oneOf(['multi', 'single', false]),
|
|
@@ -164,6 +166,7 @@ var defaultProps = {
|
|
|
164
166
|
inProgressText: 'In progress',
|
|
165
167
|
dismissText: 'Dismiss',
|
|
166
168
|
actionFailedText: 'Action failed',
|
|
169
|
+
dragHandleTooltip: 'Click and drag to new location',
|
|
167
170
|
size: undefined,
|
|
168
171
|
hasDragAndDrop: false,
|
|
169
172
|
hasBreadcrumbDrop: false,
|
|
@@ -189,6 +192,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
189
192
|
dismissText = _ref.dismissText,
|
|
190
193
|
actionFailedText = _ref.actionFailedText,
|
|
191
194
|
loadMoreText = _ref.loadMoreText,
|
|
195
|
+
dragHandleTooltip = _ref.dragHandleTooltip,
|
|
192
196
|
totalColumns = _ref.totalColumns,
|
|
193
197
|
actions = _ref.actions,
|
|
194
198
|
rowActionsState = _ref.rowActionsState,
|
|
@@ -330,6 +334,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
330
334
|
clickToExpandAria: clickToExpandAria,
|
|
331
335
|
columns: columns,
|
|
332
336
|
dismissText: dismissText,
|
|
337
|
+
dragHandleTooltip: dragHandleTooltip,
|
|
333
338
|
expandedIds: expandedIds,
|
|
334
339
|
expandedRows: expandedRows,
|
|
335
340
|
hasRowActions: hasRowActions,
|
|
@@ -339,6 +344,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
339
344
|
useRadioButtonSingleSelect: useRadioButtonSingleSelect,
|
|
340
345
|
indeterminateSelectionIds: getIndeterminateRowSelectionIds(rows, selectedIds),
|
|
341
346
|
inProgressText: inProgressText,
|
|
347
|
+
isDragging: isDragging,
|
|
342
348
|
langDir: langDir,
|
|
343
349
|
learnMoreText: learnMoreText,
|
|
344
350
|
loadingMoreIds: loadingMoreIds,
|
|
@@ -766,6 +772,17 @@ TableBody.__docgenInfo = {
|
|
|
766
772
|
},
|
|
767
773
|
"required": false
|
|
768
774
|
},
|
|
775
|
+
"dragHandleTooltip": {
|
|
776
|
+
"defaultValue": {
|
|
777
|
+
"value": "'Click and drag to new location'",
|
|
778
|
+
"computed": false
|
|
779
|
+
},
|
|
780
|
+
"description": "I18N label for drag handle tooltip",
|
|
781
|
+
"type": {
|
|
782
|
+
"name": "string"
|
|
783
|
+
},
|
|
784
|
+
"required": false
|
|
785
|
+
},
|
|
769
786
|
"size": {
|
|
770
787
|
"defaultValue": {
|
|
771
788
|
"value": "undefined",
|
|
@@ -56,6 +56,8 @@ var propTypes = {
|
|
|
56
56
|
clickToExpandAria: PropTypes__default.default.string,
|
|
57
57
|
/** internationalized label */
|
|
58
58
|
clickToCollapseAria: PropTypes__default.default.string,
|
|
59
|
+
/** I18N label for drag handle tooltip */
|
|
60
|
+
dragHandleTooltip: PropTypes__default.default.string,
|
|
59
61
|
/** List of columns */
|
|
60
62
|
columns: TablePropTypes.TableColumnsPropTypes.isRequired,
|
|
61
63
|
/** table wide options */
|
|
@@ -147,6 +149,8 @@ var propTypes = {
|
|
|
147
149
|
isDraggable: PropTypes__default.default.bool,
|
|
148
150
|
/** If this row is being dragged. */
|
|
149
151
|
isDragRow: PropTypes__default.default.bool,
|
|
152
|
+
/** If a drag operation is currently in progress. */
|
|
153
|
+
isDragging: PropTypes__default.default.bool,
|
|
150
154
|
/** If all drag handles should be hidden. This happens when an undraggable row is in the selection. */
|
|
151
155
|
hideDragHandles: PropTypes__default.default.bool,
|
|
152
156
|
/** Attribute name to identify deleted rows */
|
|
@@ -160,6 +164,7 @@ var defaultProps = {
|
|
|
160
164
|
overflowMenuAria: 'More actions',
|
|
161
165
|
clickToExpandAria: 'Click to expand.',
|
|
162
166
|
clickToCollapseAria: 'Click to collapse.',
|
|
167
|
+
dragHandleTooltip: 'Click and drag to new location',
|
|
163
168
|
rowActions: null,
|
|
164
169
|
rowDetails: null,
|
|
165
170
|
nestingLevel: 0,
|
|
@@ -187,6 +192,7 @@ var defaultProps = {
|
|
|
187
192
|
onDragLeaveRow: null,
|
|
188
193
|
isDraggable: false,
|
|
189
194
|
isDragRow: false,
|
|
195
|
+
isDragging: false,
|
|
190
196
|
deletedAttribute: '_deleted'
|
|
191
197
|
};
|
|
192
198
|
var TableBodyRow = function TableBodyRow(_ref) {
|
|
@@ -220,6 +226,7 @@ var TableBodyRow = function TableBodyRow(_ref) {
|
|
|
220
226
|
overflowMenuAria = _ref.overflowMenuAria,
|
|
221
227
|
clickToExpandAria = _ref.clickToExpandAria,
|
|
222
228
|
clickToCollapseAria = _ref.clickToCollapseAria,
|
|
229
|
+
dragHandleTooltip = _ref.dragHandleTooltip,
|
|
223
230
|
inProgressText = _ref.inProgressText,
|
|
224
231
|
actionFailedText = _ref.actionFailedText,
|
|
225
232
|
learnMoreText = _ref.learnMoreText,
|
|
@@ -243,6 +250,7 @@ var TableBodyRow = function TableBodyRow(_ref) {
|
|
|
243
250
|
onDragLeaveRow = _ref.onDragLeaveRow,
|
|
244
251
|
isDragRow = _ref.isDragRow,
|
|
245
252
|
isDraggable = _ref.isDraggable,
|
|
253
|
+
isDragging = _ref.isDragging,
|
|
246
254
|
hasDragAndDrop = _ref.hasDragAndDrop,
|
|
247
255
|
hideDragHandles = _ref.hideDragHandles,
|
|
248
256
|
deletedAttribute = _ref.deletedAttribute;
|
|
@@ -299,7 +307,9 @@ var TableBodyRow = function TableBodyRow(_ref) {
|
|
|
299
307
|
className: "".concat(iotPrefix, "--table-grab-handle-cell")
|
|
300
308
|
}, !isDraggable || hideDragHandles ? null : /*#__PURE__*/React__default.default.createElement(TableDragHandle.TableDragHandle, {
|
|
301
309
|
onStartDrag: onStartDrag,
|
|
302
|
-
rowId: id
|
|
310
|
+
rowId: id,
|
|
311
|
+
isDragging: isDragging,
|
|
312
|
+
tooltipText: dragHandleTooltip
|
|
303
313
|
}));
|
|
304
314
|
var firstVisibleColIndex = ordering.findIndex(function (col) {
|
|
305
315
|
return !col.isHidden;
|
|
@@ -558,6 +568,17 @@ TableBodyRow.__docgenInfo = {
|
|
|
558
568
|
},
|
|
559
569
|
"required": false
|
|
560
570
|
},
|
|
571
|
+
"dragHandleTooltip": {
|
|
572
|
+
"defaultValue": {
|
|
573
|
+
"value": "'Click and drag to new location'",
|
|
574
|
+
"computed": false
|
|
575
|
+
},
|
|
576
|
+
"description": "I18N label for drag handle tooltip",
|
|
577
|
+
"type": {
|
|
578
|
+
"name": "string"
|
|
579
|
+
},
|
|
580
|
+
"required": false
|
|
581
|
+
},
|
|
561
582
|
"rowActions": {
|
|
562
583
|
"defaultValue": {
|
|
563
584
|
"value": "null",
|
|
@@ -947,6 +968,17 @@ TableBodyRow.__docgenInfo = {
|
|
|
947
968
|
},
|
|
948
969
|
"required": false
|
|
949
970
|
},
|
|
971
|
+
"isDragging": {
|
|
972
|
+
"defaultValue": {
|
|
973
|
+
"value": "false",
|
|
974
|
+
"computed": false
|
|
975
|
+
},
|
|
976
|
+
"description": "If a drag operation is currently in progress.",
|
|
977
|
+
"type": {
|
|
978
|
+
"name": "bool"
|
|
979
|
+
},
|
|
980
|
+
"required": false
|
|
981
|
+
},
|
|
950
982
|
"deletedAttribute": {
|
|
951
983
|
"defaultValue": {
|
|
952
984
|
"value": "'_deleted'",
|