@carbon/ibm-products 2.43.2-canary.2 → 2.43.2-canary.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. package/css/index-full-carbon.css +35 -3
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css.map +1 -1
  6. package/css/index-without-carbon-released-only.min.css.map +1 -1
  7. package/css/index-without-carbon.css +35 -3
  8. package/css/index-without-carbon.css.map +1 -1
  9. package/css/index-without-carbon.min.css +1 -1
  10. package/css/index-without-carbon.min.css.map +1 -1
  11. package/css/index.css +35 -3
  12. package/css/index.css.map +1 -1
  13. package/css/index.min.css +1 -1
  14. package/css/index.min.css.map +1 -1
  15. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
  16. package/es/components/ConditionBuilder/ConditionBuilder.js +67 -20
  17. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
  18. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +129 -0
  19. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -4
  20. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
  21. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
  22. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
  23. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
  24. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
  25. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
  26. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
  27. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
  28. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
  29. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
  30. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
  31. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
  32. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
  33. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +24 -16
  34. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +19 -4
  35. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
  36. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +109 -0
  37. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
  38. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +58 -33
  39. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
  40. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -5
  41. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
  42. package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
  43. package/es/components/ConditionBuilder/utils/util.js +16 -1
  44. package/es/components/DataSpreadsheet/DataSpreadsheet.js +29 -16
  45. package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +9 -1
  46. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +18 -2
  47. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
  48. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +17 -6
  49. package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
  50. package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.d.ts +3 -1
  51. package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.js +15 -3
  52. package/es/components/DataSpreadsheet/types/index.d.ts +1 -1
  53. package/es/components/DataSpreadsheet/utils/moveColumnIndicatorLine.js +34 -2
  54. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +21 -3
  55. package/es/components/Datagrid/types/index.d.ts +18 -4
  56. package/es/components/Datagrid/useActionsColumn.d.ts +8 -1
  57. package/es/components/Datagrid/useActionsColumn.js +7 -6
  58. package/es/components/Datagrid/useColumnRightAlign.d.ts +8 -1
  59. package/es/components/Datagrid/useColumnRightAlign.js +4 -3
  60. package/es/components/Datagrid/useInlineEdit.d.ts +8 -1
  61. package/es/components/Datagrid/useInlineEdit.js +13 -3
  62. package/es/components/Datagrid/useNestedRows.js +27 -9
  63. package/es/components/Decorator/Decorator.js +2 -1
  64. package/es/components/DecoratorBase/DecoratorBase.js +3 -5
  65. package/es/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
  66. package/es/components/DecoratorLink/DecoratorLink.js +2 -1
  67. package/es/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
  68. package/es/components/Tearsheet/Tearsheet.d.ts +8 -1
  69. package/es/components/Tearsheet/Tearsheet.js +9 -1
  70. package/es/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
  71. package/es/components/Tearsheet/TearsheetNarrow.js +12 -0
  72. package/es/components/Tearsheet/TearsheetShell.d.ts +10 -0
  73. package/es/components/Tearsheet/TearsheetShell.js +17 -3
  74. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
  75. package/lib/components/ConditionBuilder/ConditionBuilder.js +67 -20
  76. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
  77. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +137 -0
  78. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -3
  79. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
  80. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
  81. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
  82. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
  83. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
  84. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
  85. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
  86. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
  87. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
  88. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
  89. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
  90. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
  91. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
  92. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +23 -15
  93. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +20 -5
  94. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
  95. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +117 -0
  96. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
  97. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +56 -31
  98. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
  99. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -4
  100. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
  101. package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
  102. package/lib/components/ConditionBuilder/utils/util.js +17 -0
  103. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +29 -16
  104. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +9 -1
  105. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +18 -2
  106. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
  107. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +17 -6
  108. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
  109. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.d.ts +3 -1
  110. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.js +15 -3
  111. package/lib/components/DataSpreadsheet/types/index.d.ts +1 -1
  112. package/lib/components/DataSpreadsheet/utils/moveColumnIndicatorLine.js +34 -2
  113. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +21 -3
  114. package/lib/components/Datagrid/types/index.d.ts +18 -4
  115. package/lib/components/Datagrid/useActionsColumn.d.ts +8 -1
  116. package/lib/components/Datagrid/useActionsColumn.js +7 -6
  117. package/lib/components/Datagrid/useColumnRightAlign.d.ts +8 -1
  118. package/lib/components/Datagrid/useColumnRightAlign.js +4 -3
  119. package/lib/components/Datagrid/useInlineEdit.d.ts +8 -1
  120. package/lib/components/Datagrid/useInlineEdit.js +13 -3
  121. package/lib/components/Datagrid/useNestedRows.js +27 -9
  122. package/lib/components/Decorator/Decorator.js +2 -1
  123. package/lib/components/DecoratorBase/DecoratorBase.js +3 -5
  124. package/lib/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
  125. package/lib/components/DecoratorLink/DecoratorLink.js +2 -1
  126. package/lib/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
  127. package/lib/components/Tearsheet/Tearsheet.d.ts +8 -1
  128. package/lib/components/Tearsheet/Tearsheet.js +9 -1
  129. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
  130. package/lib/components/Tearsheet/TearsheetNarrow.js +12 -0
  131. package/lib/components/Tearsheet/TearsheetShell.d.ts +10 -0
  132. package/lib/components/Tearsheet/TearsheetShell.js +16 -2
  133. package/package.json +4 -4
  134. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +9 -1
  135. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +26 -1
  136. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +1 -0
  137. package/scss/components/StatusIcon/_status-icon.scss +4 -4
  138. package/scss/components/StringFormatter/_string-formatter.scss +2 -2
  139. package/scss/components/UserProfileImage/_user-profile-image.scss +6 -2
  140. package/telemetry.yml +1 -0
  141. package/es/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +0 -1
  142. package/es/components/ConditionBuilder/utils/checkForHoldingKey.js +0 -16
  143. package/lib/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +0 -1
  144. package/lib/components/ConditionBuilder/utils/checkForHoldingKey.js +0 -20
@@ -79,7 +79,15 @@ interface DataSpreadsheetBodyProps {
79
79
  /**
80
80
  * Array of selection area data
81
81
  */
82
- selectionAreaData?: object[];
82
+ selectionAreaData?: any[];
83
+ /**
84
+ * Header reordering is active
85
+ */
86
+ selectedHeaderReorderActive?: boolean;
87
+ /**
88
+ * Set header reordering active or not
89
+ */
90
+ setSelectedHeaderReorderActive?: Dispatch<SetStateAction<boolean>>;
83
91
  /**
84
92
  * Array of selection areas
85
93
  */
@@ -49,6 +49,8 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
49
49
  selectionAreaData = _ref.selectionAreaData,
50
50
  setSelectionAreaData = _ref.setSelectionAreaData,
51
51
  setActiveCellCoordinates = _ref.setActiveCellCoordinates,
52
+ selectedHeaderReorderActive = _ref.selectedHeaderReorderActive,
53
+ setSelectedHeaderReorderActive = _ref.setSelectedHeaderReorderActive,
52
54
  selectionAreas = _ref.selectionAreas,
53
55
  setContainerHasFocus = _ref.setContainerHasFocus,
54
56
  setSelectionAreas = _ref.setSelectionAreas,
@@ -84,8 +86,12 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
84
86
  // back to the consumer
85
87
  React.useEffect(function () {
86
88
  if (selectionAreaData !== null && selectionAreaData !== void 0 && selectionAreaData.length) {
87
- var _previousState$select;
88
- if (!clickAndHoldActive && previousState !== null && previousState !== void 0 && previousState.clickAndHoldActive || (previousState === null || previousState === void 0 || (_previousState$select = previousState.selectionAreaData) === null || _previousState$select === void 0 ? void 0 : _previousState$select.length) !== (selectionAreaData === null || selectionAreaData === void 0 ? void 0 : selectionAreaData.length)) {
89
+ var _previousState$select, _selectionAreaData$, _previousState$select2;
90
+ var selectionChanged = false;
91
+ if ((previousState === null || previousState === void 0 || (_previousState$select = previousState.selectionAreaData) === null || _previousState$select === void 0 ? void 0 : _previousState$select.length) !== (selectionAreaData === null || selectionAreaData === void 0 ? void 0 : selectionAreaData.length) || (selectionAreaData === null || selectionAreaData === void 0 || (_selectionAreaData$ = selectionAreaData[0]) === null || _selectionAreaData$ === void 0 ? void 0 : _selectionAreaData$.cells.length) !== (previousState === null || previousState === void 0 || (_previousState$select2 = previousState.selectionAreaData) === null || _previousState$select2 === void 0 || (_previousState$select2 = _previousState$select2[0]) === null || _previousState$select2 === void 0 ? void 0 : _previousState$select2.cells.length)) {
92
+ selectionChanged = true;
93
+ }
94
+ if (!clickAndHoldActive && previousState !== null && previousState !== void 0 && previousState.clickAndHoldActive || selectionChanged) {
89
95
  onSelectionAreaChange === null || onSelectionAreaChange === void 0 || onSelectionAreaChange(selectionAreaData);
90
96
  }
91
97
  }
@@ -160,6 +166,8 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
160
166
  setClickAndHoldActive: setClickAndHoldActive,
161
167
  setSelectionAreas: setSelectionAreas,
162
168
  setValidStartingPoint: setValidStartingPoint,
169
+ selectedHeaderReorderActive: selectedHeaderReorderActive,
170
+ setSelectedHeaderReorderActive: setSelectedHeaderReorderActive,
163
171
  validStartingPoint: validStartingPoint,
164
172
  ref: ref,
165
173
  setHeaderCellHoldActive: setHeaderCellHoldActive,
@@ -466,6 +474,10 @@ DataSpreadsheetBody.propTypes = {
466
474
  * The scrollbar width
467
475
  */
468
476
  scrollBarSize: index["default"].number,
477
+ /**
478
+ * Header reordering is active
479
+ */
480
+ selectedHeaderReorderActive: index["default"].bool,
469
481
  /**
470
482
  * Array of selection area data
471
483
  */
@@ -502,6 +514,10 @@ DataSpreadsheetBody.propTypes = {
502
514
  * Setter fn for header cell hold active value
503
515
  */
504
516
  setHeaderCellHoldActive: index["default"].func,
517
+ /**
518
+ * Set header reordering active or not
519
+ */
520
+ setSelectedHeaderReorderActive: index["default"].func,
505
521
  /**
506
522
  * Setter fn for selectionAreaData state value
507
523
  */
@@ -56,6 +56,14 @@ interface DataSpreadsheetHeaderProps {
56
56
  * Setter fn for activeCellCoordinates value
57
57
  */
58
58
  setActiveCellCoordinates?: Dispatch<SetStateAction<ActiveCellCoordinates | null>>;
59
+ /**
60
+ * Header reordering is active
61
+ */
62
+ selectedHeaderReorderActive?: boolean;
63
+ /**
64
+ * Set header reordering active or not
65
+ */
66
+ setSelectedHeaderReorderActive?: Dispatch<SetStateAction<boolean>>;
59
67
  /**
60
68
  * Setter fn for currentMatcher value
61
69
  */
@@ -40,6 +40,8 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
40
40
  headerGroups = _ref.headerGroups,
41
41
  scrollBarSize = _ref.scrollBarSize,
42
42
  selectionAreas = _ref.selectionAreas,
43
+ selectedHeaderReorderActive = _ref.selectedHeaderReorderActive,
44
+ setSelectedHeaderReorderActive = _ref.setSelectedHeaderReorderActive,
43
45
  setActiveCellCoordinates = _ref.setActiveCellCoordinates,
44
46
  setCurrentMatcher = _ref.setCurrentMatcher,
45
47
  setSelectionAreas = _ref.setSelectionAreas,
@@ -55,10 +57,6 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
55
57
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
56
58
  scrollBarSizeValue = _useState2[0],
57
59
  setScrollBarSizeValue = _useState2[1];
58
- var _useState3 = React.useState(false),
59
- _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
60
- selectedHeaderReorderActive = _useState4[0],
61
- setSelectedHeaderReorderActive = _useState4[1];
62
60
  var previousState = usePreviousValue.usePreviousValue({
63
61
  cellSize: cellSize
64
62
  }) || {};
@@ -116,11 +114,16 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
116
114
  // Remove columns, need to call handleHeaderCellSelection
117
115
  return;
118
116
  }
119
- setSelectedHeaderReorderActive(true);
120
117
  var selectionAreaToClone = selectionAreas === null || selectionAreas === void 0 ? void 0 : selectionAreas.filter(function (item) {
121
118
  return (item === null || item === void 0 ? void 0 : item.matcher) === currentMatcher;
122
119
  });
123
120
  var selectionAreaElement = ref.current.querySelector("[data-matcher-id=\"".concat(selectionAreaToClone === null || selectionAreaToClone === void 0 || (_selectionAreaToClone = selectionAreaToClone[0]) === null || _selectionAreaToClone === void 0 ? void 0 : _selectionAreaToClone.matcher, "\"]"));
121
+ if (selectionAreaElement) {
122
+ selectionAreaElement.classList.add("".concat(blockClass, "__selection-area--element"));
123
+ }
124
+ if (typeof setSelectedHeaderReorderActive === 'function') {
125
+ setSelectedHeaderReorderActive(true);
126
+ }
124
127
  var clickXPosition = event.clientX;
125
128
  var headerButtonCoords = event.target.getBoundingClientRect();
126
129
  var headerIndex = event.target.getAttribute('data-column-index');
@@ -198,7 +201,7 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
198
201
  "data-column-index": index,
199
202
  tabIndex: -1,
200
203
  onMouseDown: selectedHeader ? handleHeaderMouseDown(index) : undefined,
201
- onMouseUp: selectedHeader ? function () {
204
+ onMouseUp: selectedHeader && typeof setSelectedHeaderReorderActive === 'function' ? function () {
202
205
  return setSelectedHeaderReorderActive(false);
203
206
  } : undefined,
204
207
  onClick: !selectedHeader ? handleColumnHeaderClick(index) : undefined,
@@ -263,6 +266,10 @@ DataSpreadsheetHeader.propTypes = {
263
266
  * The aria label applied to the Select all button
264
267
  */
265
268
  selectAllAriaLabel: index["default"].string.isRequired,
269
+ /**
270
+ * Header reordering is active
271
+ */
272
+ selectedHeaderReorderActive: index["default"].bool,
266
273
  /**
267
274
  * All of the cell selection area items
268
275
  */
@@ -280,6 +287,10 @@ DataSpreadsheetHeader.propTypes = {
280
287
  * Setter fn for header cell hold active value
281
288
  */
282
289
  setHeaderCellHoldActive: index["default"].func,
290
+ /**
291
+ * Set header reordering active or not
292
+ */
293
+ setSelectedHeaderReorderActive: index["default"].func,
283
294
  /**
284
295
  * Setter fn for selectionAreaData state value
285
296
  */
@@ -44,9 +44,12 @@ var useSpreadsheetMouseMove = function useSpreadsheetMouseMove(_ref) {
44
44
  var totalSpreadsheetScrollingWidth = listContainer.scrollWidth;
45
45
  var clonedSelectionWidth = clonedSelectionElement.offsetWidth;
46
46
  var clonePlacement = Math.max(xPositionRelativeToSpreadsheet - offsetXValue, defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth);
47
+ var leftPosition = totalSpreadsheetScrollingWidth - clonedSelectionWidth >= clonePlacement ? clonePlacement + scrollAmount : totalSpreadsheetScrollingWidth - clonedSelectionWidth;
47
48
  // Moves the position of the cloned selection area to follow mouse, and
48
49
  // add the amount horizontally scrolled
49
- clonedSelectionElement.style.left = layout.px(totalSpreadsheetScrollingWidth - clonedSelectionWidth >= clonePlacement ? clonePlacement + scrollAmount : totalSpreadsheetScrollingWidth - clonedSelectionWidth);
50
+ if (leftPosition < spreadsheetCoords.right - 40) {
51
+ clonedSelectionElement.style.left = layout.px(leftPosition);
52
+ }
50
53
  };
51
54
  if (headerCellHoldActive) {
52
55
  ref.current.addEventListener('mousemove', handleMouseMove);
@@ -1,6 +1,8 @@
1
- export function useSpreadsheetMouseUp({ currentMatcher, setSelectionAreas, setClickAndHoldActive, setValidStartingPoint, validStartingPoint, blockClass, ref, setHeaderCellHoldActive, setColumnOrder, visibleColumns, setActiveCellCoordinates, activeCellCoordinates, rows, defaultColumn, selectionAreas, }: {
1
+ export function useSpreadsheetMouseUp({ currentMatcher, setSelectionAreas, selectedHeaderReorderActive, setSelectedHeaderReorderActive, setClickAndHoldActive, setValidStartingPoint, validStartingPoint, blockClass, ref, setHeaderCellHoldActive, setColumnOrder, visibleColumns, setActiveCellCoordinates, activeCellCoordinates, rows, defaultColumn, selectionAreas, }: {
2
2
  currentMatcher: any;
3
3
  setSelectionAreas: any;
4
+ selectedHeaderReorderActive: any;
5
+ setSelectedHeaderReorderActive: any;
4
6
  setClickAndHoldActive: any;
5
7
  setValidStartingPoint: any;
6
8
  validStartingPoint: any;
@@ -18,6 +18,8 @@ var deepCloneObject = require('../../../global/js/utils/deepCloneObject.js');
18
18
  var useSpreadsheetMouseUp = function useSpreadsheetMouseUp(_ref) {
19
19
  var currentMatcher = _ref.currentMatcher,
20
20
  setSelectionAreas = _ref.setSelectionAreas,
21
+ selectedHeaderReorderActive = _ref.selectedHeaderReorderActive,
22
+ setSelectedHeaderReorderActive = _ref.setSelectedHeaderReorderActive,
21
23
  setClickAndHoldActive = _ref.setClickAndHoldActive,
22
24
  setValidStartingPoint = _ref.setValidStartingPoint,
23
25
  validStartingPoint = _ref.validStartingPoint,
@@ -34,15 +36,22 @@ var useSpreadsheetMouseUp = function useSpreadsheetMouseUp(_ref) {
34
36
  selectionAreas = _ref.selectionAreas;
35
37
  React.useEffect(function () {
36
38
  var handleMouseUp = function handleMouseUp(event) {
39
+ var _selectionAreas$;
40
+ var isHoldingColumn = false;
41
+ if (selectionAreas !== null && selectionAreas !== void 0 && (_selectionAreas$ = selectionAreas[0]) !== null && _selectionAreas$ !== void 0 && _selectionAreas$.header && selectionAreas[0].header.type === 'column') {
42
+ isHoldingColumn = true;
43
+ }
37
44
  // Remove the cloned selection area on mouse up
38
- if (!validStartingPoint) {
45
+ if (!validStartingPoint && isHoldingColumn) {
39
46
  setHeaderCellHoldActive(false);
47
+ var selectionAreaElement = ref.current.querySelector(".".concat(blockClass, "__selection-area--element"));
40
48
  var selectionAreaCloneElement = ref.current.querySelector(".".concat(blockClass, "__selection-area--element-cloned"));
41
49
  if (!selectionAreaCloneElement) {
42
50
  return;
43
51
  }
44
52
  // Mouse up while a cloned selection area exists/a column is being reordered
45
53
  if (selectionAreaCloneElement) {
54
+ var _selectionAreaElement;
46
55
  var closestCell = event.target.closest(".".concat(blockClass, "--interactive-cell-element"));
47
56
  var newColumnIndex = parseInt === null || parseInt === void 0 ? void 0 : parseInt(closestCell === null || closestCell === void 0 ? void 0 : closestCell.getAttribute('data-column-index'));
48
57
  var originalColumnIndex = parseInt === null || parseInt === void 0 ? void 0 : parseInt(selectionAreaCloneElement === null || selectionAreaCloneElement === void 0 ? void 0 : selectionAreaCloneElement.getAttribute('data-column-index-original'));
@@ -85,6 +94,7 @@ var useSpreadsheetMouseUp = function useSpreadsheetMouseUp(_ref) {
85
94
  selectionAreaClone[indexOfItemToUpdate].point1.column = Math.min.apply(Math, _rollupPluginBabelHelpers.toConsumableArray(newIndexArray));
86
95
  selectionAreaClone[indexOfItemToUpdate].point2.column = Math.max.apply(Math, _rollupPluginBabelHelpers.toConsumableArray(newIndexArray));
87
96
  }
97
+ selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
88
98
  return selectionAreaClone;
89
99
  });
90
100
  // Only reorder columns if the new index is _not_ part of the
@@ -129,11 +139,13 @@ var useSpreadsheetMouseUp = function useSpreadsheetMouseUp(_ref) {
129
139
  var indicatorLineElement = ref.current.querySelector(".".concat(blockClass, "__reorder-indicator-line"));
130
140
  indicatorLineElement === null || indicatorLineElement === void 0 || indicatorLineElement.remove();
131
141
  selectionAreaCloneElement === null || selectionAreaCloneElement === void 0 || selectionAreaCloneElement.remove();
142
+ selectionAreaElement === null || selectionAreaElement === void 0 || (_selectionAreaElement = selectionAreaElement.classList) === null || _selectionAreaElement === void 0 || _selectionAreaElement.remove("".concat(blockClass, "__selection-area--element"));
143
+ setSelectedHeaderReorderActive(false);
132
144
  }
133
145
  }
134
146
  // Mouse up was on a spreadsheet body cell which is a valid
135
147
  // start/end point for creating a selection area
136
- if (validStartingPoint) {
148
+ if (validStartingPoint || event.type === 'mouseup') {
137
149
  setClickAndHoldActive(false);
138
150
  setValidStartingPoint(false);
139
151
  var cellButton = event.target.closest(".".concat(blockClass, "__body--td"));
@@ -162,7 +174,7 @@ var useSpreadsheetMouseUp = function useSpreadsheetMouseUp(_ref) {
162
174
  return function () {
163
175
  document.removeEventListener('mouseup', handleMouseUp);
164
176
  };
165
- }, [blockClass, currentMatcher, setSelectionAreas, setClickAndHoldActive, setValidStartingPoint, validStartingPoint, ref, setHeaderCellHoldActive, setColumnOrder, visibleColumns, setActiveCellCoordinates, activeCellCoordinates, rows, defaultColumn, selectionAreas]);
177
+ }, [blockClass, currentMatcher, setSelectionAreas, setClickAndHoldActive, setValidStartingPoint, validStartingPoint, selectedHeaderReorderActive, setSelectedHeaderReorderActive, ref, setHeaderCellHoldActive, setColumnOrder, visibleColumns, setActiveCellCoordinates, activeCellCoordinates, rows, defaultColumn, selectionAreas]);
166
178
  };
167
179
 
168
180
  exports.useSpreadsheetMouseUp = useSpreadsheetMouseUp;
@@ -13,7 +13,7 @@ export interface PrevState {
13
13
  cellEditorValue?: string;
14
14
  activeCellCoordinates?: ActiveCellCoordinates;
15
15
  isEditing?: boolean;
16
- selectionAreaData?: object[];
16
+ selectionAreaData?: any[];
17
17
  clickAndHoldActive?: boolean;
18
18
  rowHeight?: number;
19
19
  cellSize?: Size;
@@ -26,11 +26,43 @@ var moveColumnIndicatorLine = function moveColumnIndicatorLine(_ref) {
26
26
  var indicatorLineElement = ref.current.querySelector(".".concat(blockClass, "__reorder-indicator-line"));
27
27
  var matcherId = clonedSelectionElement === null || clonedSelectionElement === void 0 ? void 0 : clonedSelectionElement.getAttribute('data-matcher-id');
28
28
  var selectionAreaOrigin = ref.current.querySelector("[data-matcher-id=\"".concat(matcherId, "\"]"));
29
+ var listContainer = ref.current.querySelector(".".concat(blockClass, "__list--container"));
30
+ var scrollSpeed = 10; // Scrolling speed
31
+ var leftEdgeThreshold = 120; // Distance from the left edge to start scrolling
32
+ var rightEdgeThreshold = 100; // Distance from the right edge to start scrolling
33
+
34
+ var _event = event,
35
+ clientX = _event.clientX;
36
+ var _listContainer$getBou = listContainer.getBoundingClientRect(),
37
+ left = _listContainer$getBou.left,
38
+ right = _listContainer$getBou.right;
39
+
40
+ // Is near left side of viewport
41
+ if (clientX < leftEdgeThreshold) {
42
+ window.scrollBy(-scrollSpeed, 0);
43
+ }
44
+
45
+ // Is near right side of viewport
46
+ if (clientX > window.innerWidth - rightEdgeThreshold) {
47
+ window.scrollBy(scrollSpeed, 0);
48
+ }
49
+
50
+ // Is near left edge of table
51
+ if (clientX > left && clientX < left + leftEdgeThreshold) {
52
+ listContainer.scrollBy(-scrollSpeed, 0);
53
+ }
54
+
55
+ // Is near right edge of table
56
+ if (clientX < right && clientX > right - rightEdgeThreshold) {
57
+ listContainer.scrollBy(scrollSpeed, 0);
58
+ }
29
59
  if (Number(newColumnIndex) > Number(originalColumnIndex)) {
30
- indicatorLineElement.style.left = layout.px(closestCellCoords.left - spreadsheetCoords.left + closestCell.offsetWidth - 2 + leftScrollAmount);
60
+ var leftPosition = closestCellCoords.left - spreadsheetCoords.left + closestCell.offsetWidth - 2 + leftScrollAmount;
61
+ indicatorLineElement.style.left = layout.px(leftPosition);
31
62
  }
32
63
  if (Number(newColumnIndex) < Number(originalColumnIndex)) {
33
- indicatorLineElement.style.left = layout.px(closestCellCoords.left - spreadsheetCoords.left + leftScrollAmount);
64
+ var _leftPosition = closestCellCoords.left - spreadsheetCoords.left + leftScrollAmount;
65
+ indicatorLineElement.style.left = layout.px(_leftPosition);
34
66
  }
35
67
  if (Number(newColumnIndex) === Number(originalColumnIndex)) {
36
68
  indicatorLineElement.style.left = selectionAreaOrigin.style.left;
@@ -28,7 +28,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
28
28
 
29
29
  var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
30
30
  var InlineEditCell = function InlineEditCell(_ref) {
31
- var _config$validator, _value$text;
31
+ var _config$validator;
32
32
  var cell = _ref.cell,
33
33
  config = _ref.config,
34
34
  _ref$disabledCell = _ref.disabledCell,
@@ -456,6 +456,24 @@ var InlineEditCell = function InlineEditCell(_ref) {
456
456
  ref: textInputRef
457
457
  }));
458
458
  };
459
+ var getLabel = function getLabel() {
460
+ var _value$text, _checkStaticCell;
461
+ var checkStaticCell = function checkStaticCell(val) {
462
+ if (_rollupPluginBabelHelpers["typeof"](val) === 'object' && val !== null && val !== void 0 && val.isStaticCell) {
463
+ return val === null || val === void 0 ? void 0 : val.value;
464
+ }
465
+ };
466
+ switch (type) {
467
+ case 'selection':
468
+ checkStaticCell(value);
469
+ return (_value$text = value === null || value === void 0 ? void 0 : value.text) !== null && _value$text !== void 0 ? _value$text : value;
470
+ case 'date':
471
+ checkStaticCell(value);
472
+ return buildDate(value);
473
+ default:
474
+ return (_checkStaticCell = checkStaticCell(value)) !== null && _checkStaticCell !== void 0 ? _checkStaticCell : value;
475
+ }
476
+ };
459
477
  return (
460
478
  /*#__PURE__*/
461
479
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
@@ -464,7 +482,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
464
482
  "data-cell-id": cellId,
465
483
  "data-column-index": columnIndex,
466
484
  "data-row-index": cell.row.index,
467
- "data-disabled": disabledCell,
485
+ "data-disabled": disabledCell || nonEditCell,
468
486
  "data-inline-type": type,
469
487
  onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
470
488
  onKeyDown: !nonEditCell ? handleKeyDown : null,
@@ -472,7 +490,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
472
490
  }, !nonEditCell && !disabledCell && renderRegularCell(), (!inEditMode || disabledCell) && /*#__PURE__*/React__default["default"].createElement(InlineEditButton.InlineEditButton, {
473
491
  isActiveCell: cellId === activeCellId,
474
492
  renderIcon: setRenderIcon(),
475
- label: type === 'selection' ? (_value$text = value === null || value === void 0 ? void 0 : value.text) !== null && _value$text !== void 0 ? _value$text : value : type === 'date' ? buildDate(value) : value,
493
+ label: getLabel(),
476
494
  disabledCell: disabledCell,
477
495
  labelIcon: (value === null || value === void 0 ? void 0 : value.icon) || null,
478
496
  placeholder: placeholder,
@@ -5,10 +5,10 @@ import { RadioButtonProps } from '@carbon/react/lib/components/RadioButton/Radio
5
5
  import { RadioButtonGroupProps } from '@carbon/react/lib/components/RadioButtonGroup/RadioButtonGroup';
6
6
  import { CheckboxProps } from '@carbon/react/lib/components/Checkbox';
7
7
  import { NumberInputProps } from '@carbon/react/lib/components/NumberInput/NumberInput';
8
- import { CSSProperties, JSXElementConstructor, MutableRefObject, ReactNode, TouchEventHandler } from 'react';
9
- import { Cell, Column, ColumnInstance, FilterValue, Filters, HeaderGroup, Meta, Row, TableCommonProps, TableDispatch, TableInstance, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseTableHooks } from 'react-table';
8
+ import React, { CSSProperties, ComponentType, FunctionComponent, JSXElementConstructor, MutableRefObject, ReactNode, TouchEventHandler } from 'react';
9
+ import { Cell, Column, ColumnInstance, FilterValue, Filters, HeaderGroup, Meta, Row, TableCommonProps, TableDispatch, TableInstance, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseSortByOptions, UseTableHooks } from 'react-table';
10
10
  import { CarbonIconType } from '@carbon/react/icons';
11
- import { type ButtonProps } from '@carbon/react';
11
+ import { IconButton, type ButtonProps } from '@carbon/react';
12
12
  import { TableBatchActionsProps } from '@carbon/react/lib/components/DataTable/TableBatchActions';
13
13
  export type Size = 'xs' | 'sm' | 'md' | 'lg';
14
14
  export interface ResizerProps {
@@ -85,9 +85,10 @@ export interface DataGridToggleAllRowsProps extends TableToggleAllRowsSelectedPr
85
85
  }
86
86
  export interface DatagridTableHooks<T extends object = any> extends UseTableHooks<T> {
87
87
  }
88
- export interface DatagridColumn<T extends object = any> extends ColumnInstance<T> {
88
+ export interface DatagridColumn<T extends object = any> extends ColumnInstance<T>, UseSortByOptions<T> {
89
89
  sticky?: 'left' | 'right';
90
90
  className?: string;
91
+ rightAlignedColumn?: boolean;
91
92
  disableSortBy?: boolean;
92
93
  centerAlignedColumn?: boolean;
93
94
  }
@@ -100,6 +101,7 @@ export interface DatagridRow<T extends object = any> extends Omit<Row<T>, 'cells
100
101
  RowExpansionRenderer?: (state?: DataGridState) => void;
101
102
  cells: Array<DataGridCell>;
102
103
  isSkeleton?: boolean;
104
+ hasExpanded?: boolean;
103
105
  }
104
106
  export interface DataGridHeader<T extends object = any> extends ColumnInstance, UseResizeColumnsColumnProps<T>, UseSortByColumnProps<T> {
105
107
  className(className: any, arg1: {
@@ -120,6 +122,16 @@ interface DataGridTableState extends UseResizeColumnsState<any>, UseRowSelectSta
120
122
  }
121
123
  export interface DataGridTableInstance<T extends object = any> extends TableInstance<T> {
122
124
  }
125
+ export interface RowAction {
126
+ id?: string;
127
+ itemText?: string;
128
+ icon?: ComponentType | FunctionComponent;
129
+ align?: React.ComponentProps<typeof IconButton>['align'];
130
+ shouldHideMenuItem?: (...args: any[]) => void;
131
+ shouldDisableMenuItem?: (...args: any[]) => void;
132
+ disabled?: boolean;
133
+ onClick?: (...args: any[]) => void;
134
+ }
123
135
  export interface DataGridState<T extends object = any> extends TableCommonProps, UsePaginationInstanceProps<T>, Omit<TableInstance<T>, 'state' | 'headers' | 'rows' | 'columns'>, Omit<UseFiltersInstanceProps<T>, 'rows'>, UseRowSelectInstanceProps<T>, Pick<UseRowSelectInstanceProps<T>, 'toggleAllRowsSelected'> {
124
136
  withVirtualScroll?: boolean;
125
137
  DatagridPagination?: JSXElementConstructor<any>;
@@ -142,6 +154,7 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
142
154
  batchActions?: boolean;
143
155
  row: DatagridRow;
144
156
  rows: Array<DatagridRow<any>>;
157
+ rowActions?: RowAction[];
145
158
  columns: Array<DatagridColumn>;
146
159
  key?: any;
147
160
  rowSize?: Size;
@@ -217,4 +230,5 @@ export interface ResizeHeaderProps {
217
230
  isFetching?: boolean;
218
231
  }
219
232
  export type VisibleColumns<T extends object = {}> = (allColumns: Array<ColumnInstance<T>>, meta: Meta<T>) => Array<Column<T>>;
233
+ export type NodeFuncType = (props: any) => ReactNode;
220
234
  export {};
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2021, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useActionsColumn: (hooks: Hooks) => void;
1
9
  export default useActionsColumn;
2
- declare function useActionsColumn(hooks: any): void;
@@ -26,9 +26,10 @@ var _excluded = ["align", "id", "itemText", "onClick", "icon", "shouldHideMenuIt
26
26
  var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
27
27
  var useActionsColumn = function useActionsColumn(hooks) {
28
28
  var useAttachActionsOnInstance = function useAttachActionsOnInstance(instance) {
29
- var rowActions = instance.rowActions,
30
- isFetching = instance.isFetching,
31
- selectedRowIds = instance.state.selectedRowIds;
29
+ var _ref = instance,
30
+ rowActions = _ref.rowActions,
31
+ isFetching = _ref.isFetching,
32
+ selectedRowIds = _ref.state.selectedRowIds;
32
33
  var getDisabledState = function getDisabledState(rowIndex) {
33
34
  var selectedRowIndexes = Object.keys(selectedRowIds).map(function (n) {
34
35
  return Number(n);
@@ -88,10 +89,10 @@ var useActionsColumn = function useActionsColumn(hooks) {
88
89
  return;
89
90
  }
90
91
  e.stopPropagation();
91
- _onClick(id, row, e);
92
+ _onClick === null || _onClick === void 0 || _onClick(id, row, e);
92
93
  },
93
94
  disabled: isDisabledByRow
94
- }), /*#__PURE__*/React__default["default"].createElement(Icon, null)));
95
+ }), Icon && /*#__PURE__*/React__default["default"].createElement(Icon, null)));
95
96
  })), !isFetching && (rowActions.length > 2 || isColumnSticky) && /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(react.OverflowMenu, {
96
97
  align: "left",
97
98
  size: "sm",
@@ -117,7 +118,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
117
118
  disabled: isDisabledByRow,
118
119
  onClick: function onClick(e) {
119
120
  e.stopPropagation();
120
- _onClick2(id, row, e);
121
+ _onClick2 === null || _onClick2 === void 0 || _onClick2(id, row, e);
121
122
  },
122
123
  key: id
123
124
  }));
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useColumnRightAlign: (hooks: Hooks) => void;
1
9
  export default useColumnRightAlign;
2
- declare function useColumnRightAlign(hooks: any): void;
@@ -22,16 +22,17 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
22
22
  var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
23
23
  var useColumnRightAlign = function useColumnRightAlign(hooks) {
24
24
  var RightAlignRenderer = function RightAlignRenderer(tableProps, column) {
25
+ var _tableProps$column, _column$Cell;
25
26
  return /*#__PURE__*/React__default["default"].createElement("div", {
26
27
  className: cx__default["default"]("".concat(blockClass, "__right-align-cell-renderer"), {
27
- sortDisabled: !tableProps.isTableSortable || tableProps.column.disableSortBy === true
28
+ sortDisabled: !tableProps.isTableSortable || (tableProps === null || tableProps === void 0 || (_tableProps$column = tableProps.column) === null || _tableProps$column === void 0 ? void 0 : _tableProps$column.disableSortBy) === true
28
29
  })
29
- }, column.Cell(tableProps));
30
+ }, column === null || column === void 0 || (_column$Cell = column.Cell) === null || _column$Cell === void 0 ? void 0 : _column$Cell.call(column, tableProps));
30
31
  };
31
32
  var RightAlignHeader = function RightAlignHeader(headerProp, column) {
32
33
  return /*#__PURE__*/React__default["default"].createElement("div", {
33
34
  className: "".concat(blockClass, "__right-align-header")
34
- }, typeof column.Header === 'function' ? column.Header(headerProp) : column.Header);
35
+ }, typeof column.Header === 'function' ? (column === null || column === void 0 ? void 0 : column.Header.bind(column))(headerProp) : column.Header);
35
36
  };
36
37
  var rightAlignedColumns = function rightAlignedColumns(columns) {
37
38
  var columnsWithDefaultCells = columns.map(function (column) {
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useInlineEdit: (hooks: Hooks) => void;
1
9
  export default useInlineEdit;
2
- declare function useInlineEdit(hooks: any): void;
@@ -9,6 +9,7 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
12
13
  var React = require('react');
13
14
  var settings = require('../../settings.js');
14
15
  var cx = require('classnames');
@@ -22,19 +23,20 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
22
23
  var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
23
24
  var useInlineEdit = function useInlineEdit(hooks) {
24
25
  var addInlineEdit = function addInlineEdit(props, _ref) {
25
- var _cell$column, _cell$column2;
26
+ var _cell$column, _cell$column2, _cell$value, _cell$value2, _cell$value3;
26
27
  var cell = _ref.cell,
27
28
  instance = _ref.instance;
28
29
  var columnInlineEditConfig = cell.column.inlineEdit;
29
30
  var inlineEditType = (_cell$column = cell.column) === null || _cell$column === void 0 || (_cell$column = _cell$column.inlineEdit) === null || _cell$column === void 0 ? void 0 : _cell$column.type;
30
31
  var isDisabled = (_cell$column2 = cell.column) === null || _cell$column2 === void 0 ? void 0 : _cell$column2.isDisabled;
32
+ var staticCell = _rollupPluginBabelHelpers["typeof"](cell.value) === 'object' && cell.column.id === ((_cell$value = cell.value) === null || _cell$value === void 0 ? void 0 : _cell$value.columnId) && ((_cell$value2 = cell.value) === null || _cell$value2 === void 0 ? void 0 : _cell$value2.isStaticCell);
31
33
  var renderInlineEditComponent = function renderInlineEditComponent(type) {
32
34
  return /*#__PURE__*/React__default["default"].createElement(InlineEditCell.InlineEditCell, {
33
35
  config: columnInlineEditConfig,
34
36
  tabIndex: -1,
35
37
  value: cell.value,
36
38
  cell: cell,
37
- isDisabled: isDisabled,
39
+ disabledCell: isDisabled,
38
40
  instance: instance,
39
41
  type: type
40
42
  });
@@ -47,7 +49,15 @@ var useInlineEdit = function useInlineEdit(hooks) {
47
49
  return [props, {
48
50
  className: cx__default["default"]("".concat(blockClass, "__cell"), "".concat(blockClass, "__cell-inline-edit")),
49
51
  role: 'gridcell',
50
- children: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, inlineEditType === 'text' && renderInlineEditComponent(inlineEditType), inlineEditType === 'number' && renderInlineEditComponent(inlineEditType), inlineEditType === 'selection' && renderInlineEditComponent(inlineEditType), inlineEditType === 'date' && renderInlineEditComponent(inlineEditType), !inlineEditType && /*#__PURE__*/React__default["default"].createElement(InlineEditCell.InlineEditCell, {
52
+ children: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !staticCell && inlineEditType === 'text' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'number' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'selection' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'date' && renderInlineEditComponent(inlineEditType), staticCell && /*#__PURE__*/React__default["default"].createElement(InlineEditCell.InlineEditCell, {
53
+ config: columnInlineEditConfig,
54
+ tabIndex: -1,
55
+ value: (_cell$value3 = cell.value) === null || _cell$value3 === void 0 ? void 0 : _cell$value3.value,
56
+ cell: cell,
57
+ instance: instance,
58
+ nonEditCell: true,
59
+ type: "text"
60
+ }), !inlineEditType && /*#__PURE__*/React__default["default"].createElement(InlineEditCell.InlineEditCell, {
51
61
  config: columnInlineEditConfig,
52
62
  tabIndex: -1,
53
63
  value: cell.value,
@@ -23,12 +23,30 @@ var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
23
23
  var useNestedRows = function useNestedRows(hooks) {
24
24
  useNestedRowExpander["default"](hooks);
25
25
  var useInstance = function useInstance(instance) {
26
+ React.useEffect(function () {
27
+ var _ref = instance,
28
+ rows = _ref.rows;
29
+ var defaultExpandedRows = rows.filter(function (row) {
30
+ var _row$original;
31
+ return row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.defaultExpanded;
32
+ });
33
+ if (defaultExpandedRows !== null && defaultExpandedRows !== void 0 && defaultExpandedRows.length) {
34
+ defaultExpandedRows.map(function (defaultExpandedRow) {
35
+ if (!(defaultExpandedRow !== null && defaultExpandedRow !== void 0 && defaultExpandedRow.isExpanded) && !(defaultExpandedRow !== null && defaultExpandedRow !== void 0 && defaultExpandedRow.hasExpanded)) {
36
+ var _defaultExpandedRow$t;
37
+ defaultExpandedRow === null || defaultExpandedRow === void 0 || (_defaultExpandedRow$t = defaultExpandedRow.toggleRowExpanded) === null || _defaultExpandedRow$t === void 0 || _defaultExpandedRow$t.call(defaultExpandedRow);
38
+ defaultExpandedRow.hasExpanded = true;
39
+ return;
40
+ }
41
+ });
42
+ }
43
+ }, [instance, instance.rows]);
26
44
  // This useEffect will expand rows if they exist in the initialState obj
27
45
  React.useEffect(function () {
28
46
  var rows = instance.rows,
29
47
  initialState = instance.initialState;
30
- var _ref = initialState,
31
- expandedRowIds = _ref.expandedRowIds;
48
+ var _ref2 = initialState,
49
+ expandedRowIds = _ref2.expandedRowIds;
32
50
  if (expandedRowIds) {
33
51
  Object.keys(expandedRowIds).forEach(function (key) {
34
52
  var row = rows.filter(function (r) {
@@ -42,14 +60,14 @@ var useNestedRows = function useNestedRows(hooks) {
42
60
  }
43
61
  }, [instance]);
44
62
  var marginLeft = 24;
45
- var getRowProps = function getRowProps(props, _ref2) {
46
- var row = _ref2.row;
63
+ var getRowProps = function getRowProps(props, _ref3) {
64
+ var row = _ref3.row;
47
65
  return [props, {
48
66
  className: cx__default["default"](_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__carbon-nested-row"), row.depth > 0), "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded))
49
67
  }];
50
68
  };
51
- var getRowStyles = function getRowStyles(props, _ref3) {
52
- var row = _ref3.row;
69
+ var getRowStyles = function getRowStyles(props, _ref4) {
70
+ var row = _ref4.row;
53
71
  return [props, {
54
72
  style: {
55
73
  paddingLeft: "".concat(row.depth > 1 ? marginLeft * 2 + (row.depth - 1) * (marginLeft + marginLeft / 3) : row.depth === 1 ? marginLeft * 2 : 0, "px")
@@ -59,9 +77,9 @@ var useNestedRows = function useNestedRows(hooks) {
59
77
  var getIndentation = function getIndentation(depth) {
60
78
  return 32 * depth + 16;
61
79
  }; // row indentation padding
62
- var getCellProps = function getCellProps(props, _ref4) {
63
- var cell = _ref4.cell,
64
- instance = _ref4.instance;
80
+ var getCellProps = function getCellProps(props, _ref5) {
81
+ var cell = _ref5.cell,
82
+ instance = _ref5.instance;
65
83
  // we add a dynamic -ve margin right only if the cell is resized below minimum width i.e 50px, else we set the width based on indentation at different levels
66
84
  var isFirstCell = instance.columns.findIndex(function (c) {
67
85
  return c.id === cell.column.id;