carbon-addons-iot-react 5.5.2 → 5.6.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.
@@ -7,6 +7,7 @@ import 'core-js/modules/es.array.concat.js';
7
7
  import 'core-js/modules/es.array.filter.js';
8
8
  import 'core-js/modules/es.array.find.js';
9
9
  import 'core-js/modules/es.array.find-index.js';
10
+ import 'core-js/modules/es.array.map.js';
10
11
  import 'core-js/modules/es.array.slice.js';
11
12
  import 'core-js/modules/es.array.sort.js';
12
13
  import 'core-js/modules/es.number.constructor.js';
@@ -312,9 +313,20 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
312
313
  });
313
314
  var initialAggregation = matchedDataItem === null || matchedDataItem === void 0 ? void 0 : matchedDataItem.aggregationMethod;
314
315
  var initialGrain = matchedDataItem === null || matchedDataItem === void 0 ? void 0 : matchedDataItem.grain;
315
- var selectedDimensionFilter = editDataItem.dataFilter ? Object.keys(editDataItem.dataFilter)[0] : '';
316
+ var selectedDimensionFilter = useMemo(function () {
317
+ return editDataItem.dataFilter ? Object.keys(editDataItem.dataFilter)[0] : '';
318
+ }, [editDataItem.dataFilter]);
319
+ var availableDimensionsItems = useMemo(function () {
320
+ var _availableDimensions$;
321
+ return selectedDimensionFilter && ((_availableDimensions$ = availableDimensions[selectedDimensionFilter]) === null || _availableDimensions$ === void 0 ? void 0 : _availableDimensions$.sort().map(function (item) {
322
+ return {
323
+ id: item,
324
+ text: item.toString()
325
+ };
326
+ })) || [];
327
+ }, [availableDimensions, selectedDimensionFilter]);
316
328
  var DataEditorContent = useMemo(function () {
317
- var _editDataItem$aggrega, _editDataItem$aggrega2, _editDataItem$precisi, _availableDimensions$;
329
+ var _editDataItem$aggrega, _editDataItem$aggrega2, _editDataItem$precisi;
318
330
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, hasAggregationsDropDown && hasAggregationsDropDown(editDataItem) && /*#__PURE__*/React__default.createElement("div", {
319
331
  className: "".concat(baseClassName, "--input-group")
320
332
  }, !initialAggregation || !isSummaryDashboard ?
@@ -494,19 +506,22 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
494
506
  autoAlign: true
495
507
  })), /*#__PURE__*/React__default.createElement("div", {
496
508
  className: "".concat(baseClassName, "--input-group--item")
497
- }, !isEmpty(editDataItem.dataFilter) && availableDimensions[selectedDimensionFilter] && /*#__PURE__*/React__default.createElement(Dropdown, {
509
+ }, !isEmpty(editDataItem.dataFilter) && (availableDimensionsItems === null || availableDimensionsItems === void 0 ? void 0 : availableDimensionsItems.length) > 0 && /*#__PURE__*/React__default.createElement(Dropdown, {
498
510
  id: "".concat(id, "_data-filter-value"),
499
511
  label: "",
500
512
  direction: "bottom",
501
- items: (_availableDimensions$ = availableDimensions[selectedDimensionFilter]) === null || _availableDimensions$ === void 0 ? void 0 : _availableDimensions$.sort(),
513
+ items: availableDimensionsItems,
502
514
  light: true,
503
515
  itemToString: function itemToString(item) {
504
- return item === null || item === void 0 ? void 0 : item.toString();
516
+ return item ? item.text : '';
505
517
  },
506
- selectedItem: editDataItem.dataFilter ? editDataItem.dataFilter[selectedDimensionFilter] : undefined,
518
+ selectedItem: availableDimensionsItems.find(function (item) {
519
+ var _editDataItem$dataFil;
520
+ return item.id === ((_editDataItem$dataFil = editDataItem.dataFilter) === null || _editDataItem$dataFil === void 0 ? void 0 : _editDataItem$dataFil[selectedDimensionFilter]);
521
+ }),
507
522
  onChange: function onChange(_ref9) {
508
523
  var selectedItem = _ref9.selectedItem;
509
- var dataFilter = _defineProperty({}, selectedDimensionFilter, selectedItem);
524
+ var dataFilter = _defineProperty({}, selectedDimensionFilter, selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id);
510
525
  setEditDataItem(_objectSpread(_objectSpread({}, editDataItem), {}, {
511
526
  dataFilter: dataFilter
512
527
  }));
@@ -536,7 +551,7 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
536
551
  },
537
552
  columnType: editDataItem.columnType || editDataItem.type
538
553
  }));
539
- }, [availableDimensions, availableGrains, baseClassName, cardConfig, editDataItem, handleTranslation, hasAggregationsDropDown, hasColorDropdown, hasDataFilterDropdown, hasDecimalPlacesDropdown, hasGrainsDropDown, hasThresholds, hasTooltip, hasUnit, id, initialAggregation, initialGrain, isSummaryDashboard, isTimeBasedCard$1, mergedI18n, selectedDimensionFilter, setEditDataItem, type]);
554
+ }, [availableDimensions, availableDimensionsItems, availableGrains, baseClassName, cardConfig, editDataItem, handleTranslation, hasAggregationsDropDown, hasColorDropdown, hasDataFilterDropdown, hasDecimalPlacesDropdown, hasGrainsDropDown, hasThresholds, hasTooltip, hasUnit, id, initialAggregation, initialGrain, isSummaryDashboard, isTimeBasedCard$1, mergedI18n, selectedDimensionFilter, setEditDataItem, type]);
540
555
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showEditor && /*#__PURE__*/React__default.createElement("div", {
541
556
  className: "".concat(baseClassName, "--modal-wrapper")
542
557
  }, /*#__PURE__*/React__default.createElement(ComposedModal, {
@@ -62,7 +62,11 @@ var propTypes = {
62
62
  /** Toggle side panel busy state */
63
63
  isBusy: PropTypes.bool,
64
64
  /** should the footer primary button be disabled */
65
- isPrimaryButtonDisabled: PropTypes.bool
65
+ isPrimaryButtonDisabled: PropTypes.bool,
66
+ /** Custom width in pixels for the side panel (e.g., 400, '400px', or '25rem') */
67
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
68
+ /** Custom background color for the side panel (e.g., '#f4f4f4', 'gray', or any valid CSS color) */
69
+ backgroundColor: PropTypes.string
66
70
  };
67
71
  var defaultProps = {
68
72
  isOpen: false,
@@ -84,7 +88,9 @@ var defaultProps = {
84
88
  onPrimaryButtonClick: undefined,
85
89
  onSecondaryButtonClick: undefined,
86
90
  isBusy: false,
87
- isPrimaryButtonDisabled: false
91
+ isPrimaryButtonDisabled: false,
92
+ width: undefined,
93
+ backgroundColor: undefined
88
94
  };
89
95
  var baseClass = "".concat(iotPrefix, "--sidepanel");
90
96
  var SidePanel = function SidePanel(_ref) {
@@ -104,7 +110,9 @@ var SidePanel = function SidePanel(_ref) {
104
110
  children = _ref.children,
105
111
  style = _ref.style,
106
112
  isBusy = _ref.isBusy,
107
- isPrimaryButtonDisabled = _ref.isPrimaryButtonDisabled;
113
+ isPrimaryButtonDisabled = _ref.isPrimaryButtonDisabled,
114
+ width = _ref.width,
115
+ backgroundColor = _ref.backgroundColor;
108
116
  var titleRef = useRef();
109
117
  var subtitleRef = useRef();
110
118
  var contentRef = useRef();
@@ -192,11 +200,24 @@ var SidePanel = function SidePanel(_ref) {
192
200
  }
193
201
  return "".concat(str.substring(0, length), "...");
194
202
  };
203
+ var panelWidth = useMemo(function () {
204
+ if (width !== undefined) {
205
+ return typeof width === 'number' ? "".concat(width, "px") : width;
206
+ }
207
+ return undefined;
208
+ }, [width]);
209
+ var panelStyle = useMemo(function () {
210
+ return _objectSpread(_objectSpread(_objectSpread({}, style), panelWidth && {
211
+ width: panelWidth
212
+ }), backgroundColor && {
213
+ backgroundColor: backgroundColor
214
+ });
215
+ }, [style, panelWidth, backgroundColor]);
195
216
  return /*#__PURE__*/React__default.createElement("div", {
196
217
  key: "sidePanel--".concat(subtitle),
197
218
  "data-testid": testId,
198
219
  className: classnames("".concat(baseClass), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(baseClass, "--closed"), !isOpen), "".concat(baseClass, "--full-width"), isFullWidth), "".concat(baseClass, "--start"), direction === 'left'), "".concat(baseClass, "--inline"), type === 'inline'), "".concat(baseClass, "--slide-over"), type === 'over'), "".concat(baseClass, "--condensed"), isCondensed || isScrolled)),
199
- style: style
220
+ style: panelStyle
200
221
  }, onToggle && (isOpen || type === 'inline') ? /*#__PURE__*/React__default.createElement(Button, {
201
222
  testId: "".concat(testId, "-toggle-button"),
202
223
  hasIconOnly: true,
@@ -490,6 +511,33 @@ SidePanel.__docgenInfo = {
490
511
  "name": "bool"
491
512
  },
492
513
  "required": false
514
+ },
515
+ "width": {
516
+ "defaultValue": {
517
+ "value": "undefined",
518
+ "computed": true
519
+ },
520
+ "description": "Custom width in pixels for the side panel (e.g., 400, '400px', or '25rem')",
521
+ "type": {
522
+ "name": "union",
523
+ "value": [{
524
+ "name": "number"
525
+ }, {
526
+ "name": "string"
527
+ }]
528
+ },
529
+ "required": false
530
+ },
531
+ "backgroundColor": {
532
+ "defaultValue": {
533
+ "value": "undefined",
534
+ "computed": true
535
+ },
536
+ "description": "Custom background color for the side panel (e.g., '#f4f4f4', 'gray', or any valid CSS color)",
537
+ "type": {
538
+ "name": "string"
539
+ },
540
+ "required": false
493
541
  }
494
542
  }
495
543
  };
@@ -58,7 +58,7 @@ import ErrorTable from './ErrorTable/ErrorTable.js';
58
58
  import { PIN_COLUMN } from './tableUtilities.js';
59
59
  import { FilterEdit } from '@carbon/icons-react';
60
60
 
61
- var _excluded = ["id", "columns", "enablePercentageColumnWidth", "columnGroups", "data", "expandedData", "locale", "view", "actions", "actions", "options", "lightweight", "className", "style", "i18n", "secondaryTitle", "tooltip", "error", "testId", "size", "zIndex", "emptyStateIcon"],
61
+ var _excluded = ["id", "columns", "enablePercentageColumnWidth", "columnGroups", "data", "expandedData", "locale", "view", "actions", "actions", "options", "lightweight", "className", "style", "i18n", "secondaryTitle", "tooltip", "error", "testId", "size", "zIndex", "emptyStateIcon", "deletedAttribute"],
62
62
  _excluded2 = ["renderIcon"],
63
63
  _excluded3 = ["error"],
64
64
  _excluded4 = ["maxPages"];
@@ -393,7 +393,9 @@ var propTypes = {
393
393
  /** Specify the error message that need to be displayed by default.
394
394
  * Incase we use view.table.errorState property then the error state will be displayed instead of error message */
395
395
  error: PropTypes.string,
396
- testId: PropTypes.string
396
+ testId: PropTypes.string,
397
+ /** Attribute name to identify deleted rows */
398
+ deletedAttribute: PropTypes.string
397
399
  };
398
400
  var defaultProps = function defaultProps(baseProps) {
399
401
  return {
@@ -592,6 +594,7 @@ var defaultProps = function defaultProps(baseProps) {
592
594
  multiSortDescending: 'Descending',
593
595
  multiSortOverflowItem: 'Multi-sort',
594
596
  multiSortDragHandle: 'Drag handle',
597
+ dragHandleTooltip: 'Click and drag to new location',
595
598
  // table error state
596
599
  tableErrorStateTitle: 'Unable to load the page',
597
600
  buttonLabelOnTableError: 'Refresh the page',
@@ -612,7 +615,8 @@ var defaultProps = function defaultProps(baseProps) {
612
615
  // previously used as testId.
613
616
  testId: null,
614
617
  enablePercentageColumnWidth: false,
615
- emptyStateIcon: ''
618
+ emptyStateIcon: '',
619
+ deletedAttribute: undefined
616
620
  };
617
621
  };
618
622
  var Table = function Table(props) {
@@ -640,6 +644,7 @@ var Table = function Table(props) {
640
644
  size = _merge2.size,
641
645
  zIndex = _merge2.zIndex,
642
646
  emptyStateIcon = _merge2.emptyStateIcon,
647
+ deletedAttribute = _merge2.deletedAttribute,
643
648
  others = _objectWithoutProperties(_merge2, _excluded);
644
649
 
645
650
  // There is no way to access the current search value in the Table
@@ -1005,7 +1010,7 @@ var Table = function Table(props) {
1005
1010
  selectedIds: view.table.selectedIds,
1006
1011
  loadingMoreIds: view.table.loadingMoreIds,
1007
1012
  zIndex: zIndex
1008
- }, _pick(i18n, 'overflowMenuAria', 'clickToExpandAria', 'clickToCollapseAria', 'inProgressText', 'actionFailedText', 'learnMoreText', 'dismissText', 'selectRowAria', 'loadMoreText'), {
1013
+ }, _pick(i18n, 'overflowMenuAria', 'clickToExpandAria', 'clickToCollapseAria', 'inProgressText', 'actionFailedText', 'learnMoreText', 'dismissText', 'selectRowAria', 'loadMoreText', 'dragHandleTooltip'), {
1009
1014
  totalColumns: totalColumns
1010
1015
  }, _pick(options, 'hasRowSelection', 'hasRowActions', 'hasRowNesting', 'shouldExpandOnRowClick', 'shouldLazyRender', 'preserveCellWhiteSpace', 'useRadioButtonSingleSelect', 'hasDragAndDrop', 'hasBreadcrumbDrop'), {
1011
1016
  hideDragHandles: hideDragHandles,
@@ -1020,7 +1025,8 @@ var Table = function Table(props) {
1020
1025
  testId: "".concat(id || testId, "-table-body"),
1021
1026
  showExpanderColumn: showExpanderColumn,
1022
1027
  size: size,
1023
- pinColumn: options.pinColumn
1028
+ pinColumn: options.pinColumn,
1029
+ deletedAttribute: deletedAttribute
1024
1030
  })) : /*#__PURE__*/React__default.createElement(EmptyTable, {
1025
1031
  id: id,
1026
1032
  totalColumns: totalColumns,
@@ -2027,6 +2033,13 @@ Table.__docgenInfo = {
2027
2033
  "name": "string"
2028
2034
  },
2029
2035
  "required": false
2036
+ },
2037
+ "deletedAttribute": {
2038
+ "description": "Attribute name to identify deleted rows",
2039
+ "type": {
2040
+ "name": "string"
2041
+ },
2042
+ "required": false
2030
2043
  }
2031
2044
  }
2032
2045
  };
@@ -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]),
@@ -118,7 +120,9 @@ var propTypes = {
118
120
  /** Optional base z-index for the drag image. See details on Table component. */
119
121
  zIndex: PropTypes.number,
120
122
  /** column to pin in the table */
121
- pinColumn: PinColumnPropTypes
123
+ pinColumn: PinColumnPropTypes,
124
+ /** Attribute name to identify deleted rows */
125
+ deletedAttribute: PropTypes.string
122
126
  };
123
127
  var defaultProps = {
124
128
  expandedIds: [],
@@ -152,12 +156,14 @@ var defaultProps = {
152
156
  inProgressText: 'In progress',
153
157
  dismissText: 'Dismiss',
154
158
  actionFailedText: 'Action failed',
159
+ dragHandleTooltip: 'Click and drag to new location',
155
160
  size: undefined,
156
161
  hasDragAndDrop: false,
157
162
  hasBreadcrumbDrop: false,
158
163
  hideDragHandles: false,
159
164
  zIndex: 0,
160
- pinColumn: PIN_COLUMN.NONE
165
+ pinColumn: PIN_COLUMN.NONE,
166
+ deletedAttribute: '_deleted'
161
167
  };
162
168
  var TableBody = function TableBody(_ref) {
163
169
  var tableId = _ref.tableId,
@@ -176,6 +182,7 @@ var TableBody = function TableBody(_ref) {
176
182
  dismissText = _ref.dismissText,
177
183
  actionFailedText = _ref.actionFailedText,
178
184
  loadMoreText = _ref.loadMoreText,
185
+ dragHandleTooltip = _ref.dragHandleTooltip,
179
186
  totalColumns = _ref.totalColumns,
180
187
  actions = _ref.actions,
181
188
  rowActionsState = _ref.rowActionsState,
@@ -202,7 +209,8 @@ var TableBody = function TableBody(_ref) {
202
209
  hasBreadcrumbDrop = _ref.hasBreadcrumbDrop,
203
210
  hideDragHandles = _ref.hideDragHandles,
204
211
  zIndex = _ref.zIndex,
205
- pinColumn = _ref.pinColumn;
212
+ pinColumn = _ref.pinColumn,
213
+ deletedAttribute = _ref.deletedAttribute;
206
214
  // Need to merge the ordering and the columns since the columns have the renderer function
207
215
  var orderingMap = useMemo(function () {
208
216
  return ordering.map(function (col) {
@@ -316,6 +324,7 @@ var TableBody = function TableBody(_ref) {
316
324
  clickToExpandAria: clickToExpandAria,
317
325
  columns: columns,
318
326
  dismissText: dismissText,
327
+ dragHandleTooltip: dragHandleTooltip,
319
328
  expandedIds: expandedIds,
320
329
  expandedRows: expandedRows,
321
330
  hasRowActions: hasRowActions,
@@ -325,6 +334,7 @@ var TableBody = function TableBody(_ref) {
325
334
  useRadioButtonSingleSelect: useRadioButtonSingleSelect,
326
335
  indeterminateSelectionIds: getIndeterminateRowSelectionIds(rows, selectedIds),
327
336
  inProgressText: inProgressText,
337
+ isDragging: isDragging,
328
338
  langDir: langDir,
329
339
  learnMoreText: learnMoreText,
330
340
  loadingMoreIds: loadingMoreIds,
@@ -357,7 +367,8 @@ var TableBody = function TableBody(_ref) {
357
367
  onDragEnterRow: isDragging ? handleEnterRow : null,
358
368
  onDragLeaveRow: isDragging ? handleLeaveRow : null,
359
369
  dragRowIds: dragRowIds,
360
- canDropRowIds: canDropRowIds
370
+ canDropRowIds: canDropRowIds,
371
+ deletedAttribute: deletedAttribute
361
372
  });
362
373
  })), dragPreview);
363
374
  };
@@ -751,6 +762,17 @@ TableBody.__docgenInfo = {
751
762
  },
752
763
  "required": false
753
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
+ },
754
776
  "size": {
755
777
  "defaultValue": {
756
778
  "value": "undefined",
@@ -834,6 +856,17 @@ TableBody.__docgenInfo = {
834
856
  },
835
857
  "required": false
836
858
  },
859
+ "deletedAttribute": {
860
+ "defaultValue": {
861
+ "value": "'_deleted'",
862
+ "computed": false
863
+ },
864
+ "description": "Attribute name to identify deleted rows",
865
+ "type": {
866
+ "name": "string"
867
+ },
868
+ "required": false
869
+ },
837
870
  "tableId": {
838
871
  "description": "The unique id of the table",
839
872
  "type": {
@@ -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,8 +139,12 @@ 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
- hideDragHandles: PropTypes.bool
145
+ hideDragHandles: PropTypes.bool,
146
+ /** Attribute name to identify deleted rows */
147
+ deletedAttribute: PropTypes.string
142
148
  };
143
149
  var defaultProps = {
144
150
  isSelected: false,
@@ -148,6 +154,7 @@ var defaultProps = {
148
154
  overflowMenuAria: 'More actions',
149
155
  clickToExpandAria: 'Click to expand.',
150
156
  clickToCollapseAria: 'Click to collapse.',
157
+ dragHandleTooltip: 'Click and drag to new location',
151
158
  rowActions: null,
152
159
  rowDetails: null,
153
160
  nestingLevel: 0,
@@ -174,7 +181,9 @@ var defaultProps = {
174
181
  onDragEnterRow: null,
175
182
  onDragLeaveRow: null,
176
183
  isDraggable: false,
177
- isDragRow: false
184
+ isDragRow: false,
185
+ isDragging: false,
186
+ deletedAttribute: '_deleted'
178
187
  };
179
188
  var TableBodyRow = function TableBodyRow(_ref) {
180
189
  var id = _ref.id,
@@ -207,6 +216,7 @@ var TableBodyRow = function TableBodyRow(_ref) {
207
216
  overflowMenuAria = _ref.overflowMenuAria,
208
217
  clickToExpandAria = _ref.clickToExpandAria,
209
218
  clickToCollapseAria = _ref.clickToCollapseAria,
219
+ dragHandleTooltip = _ref.dragHandleTooltip,
210
220
  inProgressText = _ref.inProgressText,
211
221
  actionFailedText = _ref.actionFailedText,
212
222
  learnMoreText = _ref.learnMoreText,
@@ -230,8 +240,10 @@ var TableBodyRow = function TableBodyRow(_ref) {
230
240
  onDragLeaveRow = _ref.onDragLeaveRow,
231
241
  isDragRow = _ref.isDragRow,
232
242
  isDraggable = _ref.isDraggable,
243
+ isDragging = _ref.isDragging,
233
244
  hasDragAndDrop = _ref.hasDragAndDrop,
234
- hideDragHandles = _ref.hideDragHandles;
245
+ hideDragHandles = _ref.hideDragHandles,
246
+ deletedAttribute = _ref.deletedAttribute;
235
247
  var isEditMode = rowEditMode || singleRowEditMode;
236
248
  var singleSelectionIndicatorWidth = hasRowSelection === 'single' ? 0 : 5;
237
249
  var nestingLevelPixels = nestingLevel * 32;
@@ -285,7 +297,9 @@ var TableBodyRow = function TableBodyRow(_ref) {
285
297
  className: "".concat(iotPrefix, "--table-grab-handle-cell")
286
298
  }, !isDraggable || hideDragHandles ? null : /*#__PURE__*/React__default.createElement(TableDragHandle, {
287
299
  onStartDrag: onStartDrag,
288
- rowId: id
300
+ rowId: id,
301
+ isDragging: isDragging,
302
+ tooltipText: dragHandleTooltip
289
303
  }));
290
304
  var firstVisibleColIndex = ordering.findIndex(function (col) {
291
305
  return !col.isHidden;
@@ -374,7 +388,7 @@ var TableBodyRow = function TableBodyRow(_ref) {
374
388
  key: id
375
389
  }, /*#__PURE__*/React__default.createElement(TableExpandRow, _extends({
376
390
  expandHeaderId: "".concat(tableId, "-expand"),
377
- className: classnames("".concat(iotPrefix, "--expandable-tablerow--expanded"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--expandable-tablerow--indented"), parseInt(nestingOffset, 10) > 0), "".concat(iotPrefix, "--expandable-tablerow--childless"), hasRowNesting && nestingChildCount === 0), "".concat(iotPrefix, "--table__row--dragging"), isDragRow), "".concat(iotPrefix, "--table__row--softdeleted"), values === null || values === void 0 ? void 0 : values._deleted)),
391
+ className: classnames("".concat(iotPrefix, "--expandable-tablerow--expanded"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--expandable-tablerow--indented"), parseInt(nestingOffset, 10) > 0), "".concat(iotPrefix, "--expandable-tablerow--childless"), hasRowNesting && nestingChildCount === 0), "".concat(iotPrefix, "--table__row--dragging"), isDragRow), "".concat(iotPrefix, "--table__row--softdeleted"), values === null || values === void 0 ? void 0 : values[deletedAttribute])),
378
392
  ariaLabel: clickToCollapseAria,
379
393
  expandIconDescription: clickToCollapseAria,
380
394
  isExpanded: true,
@@ -402,13 +416,13 @@ var TableBodyRow = function TableBodyRow(_ref) {
402
416
  rowId: id,
403
417
  langDir: langDir
404
418
  }, dragEnterLeaveHandlers), tableCells), !hasRowNesting && /*#__PURE__*/React__default.createElement(TableRow, _extends({
405
- className: classnames("".concat(iotPrefix, "--expanded-tablerow"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--expanded-tablerow--singly-selected"), hasRowSelection === 'single' && isSelected && !useRadioButtonSingleSelect), "".concat(iotPrefix, "--table__row--dragging"), isDragRow), "".concat(iotPrefix, "--table__row--softdeleted"), values === null || values === void 0 ? void 0 : values._deleted))
419
+ className: classnames("".concat(iotPrefix, "--expanded-tablerow"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--expanded-tablerow--singly-selected"), hasRowSelection === 'single' && isSelected && !useRadioButtonSingleSelect), "".concat(iotPrefix, "--table__row--dragging"), isDragRow), "".concat(iotPrefix, "--table__row--softdeleted"), values === null || values === void 0 ? void 0 : values[deletedAttribute]))
406
420
  }, dragEnterLeaveHandlers), /*#__PURE__*/React__default.createElement(TableCell, {
407
421
  colSpan: totalColumns
408
422
  }, rowDetails))) : /*#__PURE__*/React__default.createElement(TableExpandRow, _extends({
409
423
  key: id,
410
424
  expandHeaderId: "".concat(tableId, "-expand"),
411
- className: classnames("".concat(iotPrefix, "--expandable-tablerow"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--expandable-tablerow--parent"), hasRowNesting && (hasRowNesting === null || hasRowNesting === void 0 ? void 0 : hasRowNesting.hasSingleNestedHierarchy) && nestingChildCount > 0), "".concat(iotPrefix, "--expandable-tablerow--childless"), hasRowNesting && nestingChildCount === 0), "".concat(iotPrefix, "--expandable-tablerow--indented"), parseInt(nestingOffset, 10) > 0), "".concat(iotPrefix, "--expandable-tablerow--singly-selected"), hasRowSelection === 'single' && isSelected && !useRadioButtonSingleSelect), "".concat(iotPrefix, "--expandable-tablerow--last-child"), isLastChild), "".concat(iotPrefix, "--table__row--dragging"), isDragRow), "".concat(iotPrefix, "--table__row--softdeleted"), values === null || values === void 0 ? void 0 : values._deleted)),
425
+ className: classnames("".concat(iotPrefix, "--expandable-tablerow"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--expandable-tablerow--parent"), hasRowNesting && (hasRowNesting === null || hasRowNesting === void 0 ? void 0 : hasRowNesting.hasSingleNestedHierarchy) && nestingChildCount > 0), "".concat(iotPrefix, "--expandable-tablerow--childless"), hasRowNesting && nestingChildCount === 0), "".concat(iotPrefix, "--expandable-tablerow--indented"), parseInt(nestingOffset, 10) > 0), "".concat(iotPrefix, "--expandable-tablerow--singly-selected"), hasRowSelection === 'single' && isSelected && !useRadioButtonSingleSelect), "".concat(iotPrefix, "--expandable-tablerow--last-child"), isLastChild), "".concat(iotPrefix, "--table__row--dragging"), isDragRow), "".concat(iotPrefix, "--table__row--softdeleted"), values === null || values === void 0 ? void 0 : values[deletedAttribute])),
412
426
  "data-row-nesting": hasRowNesting,
413
427
  "data-child-count": nestingChildCount,
414
428
  "data-nesting-offset": nestingOffset,
@@ -437,7 +451,7 @@ var TableBodyRow = function TableBodyRow(_ref) {
437
451
  rowId: id,
438
452
  langDir: langDir
439
453
  }, dragEnterLeaveHandlers), tableCells) : hasRowSelection === 'single' && isSelected ? /*#__PURE__*/React__default.createElement(TableRow, _extends({
440
- className: classnames("".concat(iotPrefix, "--table__row"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--table__row--singly-selected"), isSelected && !useRadioButtonSingleSelect), "".concat(iotPrefix, "--table__row--background"), isSelected), "".concat(iotPrefix, "--table__row--softdeleted"), values === null || values === void 0 ? void 0 : values._deleted)),
454
+ className: classnames("".concat(iotPrefix, "--table__row"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--table__row--singly-selected"), isSelected && !useRadioButtonSingleSelect), "".concat(iotPrefix, "--table__row--background"), isSelected), "".concat(iotPrefix, "--table__row--softdeleted"), values === null || values === void 0 ? void 0 : values[deletedAttribute])),
441
455
  key: id,
442
456
  onClick: function onClick() {
443
457
  if (isSelectable !== false) {
@@ -448,7 +462,7 @@ var TableBodyRow = function TableBodyRow(_ref) {
448
462
  }
449
463
  }
450
464
  }, dragEnterLeaveHandlers), tableCells) : /*#__PURE__*/React__default.createElement(TableRow, _extends({
451
- className: classnames("".concat(iotPrefix, "--table__row"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--table__row--unselectable"), isSelectable === false), "".concat(iotPrefix, "--table__row--selectable"), isSelectable !== false), "".concat(iotPrefix, "--table__row--editing"), isEditMode), "".concat(iotPrefix, "--table__row--selected"), isSelected), "".concat(iotPrefix, "--table__row--dragging"), isDragRow), "".concat(iotPrefix, "--table__row--softdeleted"), values === null || values === void 0 ? void 0 : values._deleted)),
465
+ className: classnames("".concat(iotPrefix, "--table__row"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--table__row--unselectable"), isSelectable === false), "".concat(iotPrefix, "--table__row--selectable"), isSelectable !== false), "".concat(iotPrefix, "--table__row--editing"), isEditMode), "".concat(iotPrefix, "--table__row--selected"), isSelected), "".concat(iotPrefix, "--table__row--dragging"), isDragRow), "".concat(iotPrefix, "--table__row--softdeleted"), values === null || values === void 0 ? void 0 : values[deletedAttribute])),
452
466
  key: id,
453
467
  onClick: function onClick() {
454
468
  if (isSelectable !== false) {
@@ -544,6 +558,17 @@ TableBodyRow.__docgenInfo = {
544
558
  },
545
559
  "required": false
546
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
+ },
547
572
  "rowActions": {
548
573
  "defaultValue": {
549
574
  "value": "null",
@@ -933,6 +958,28 @@ TableBodyRow.__docgenInfo = {
933
958
  },
934
959
  "required": false
935
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
+ },
972
+ "deletedAttribute": {
973
+ "defaultValue": {
974
+ "value": "'_deleted'",
975
+ "computed": false
976
+ },
977
+ "description": "Attribute name to identify deleted rows",
978
+ "type": {
979
+ "name": "string"
980
+ },
981
+ "required": false
982
+ },
936
983
  "ordering": {
937
984
  "description": "What column ordering is currently applied to the table",
938
985
  "type": {
@@ -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
- }, /*#__PURE__*/React__default.createElement(Draggable, null));
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
  };