@carbon/ibm-products 2.38.0 → 2.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. package/css/index-full-carbon.css +236 -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 +5 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +236 -3
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +236 -3
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/AddSelect/AddSelect.d.ts +44 -2
  18. package/es/components/AddSelect/AddSelect.js +8 -4
  19. package/es/components/AddSelect/AddSelectBody.d.ts +44 -2
  20. package/es/components/AddSelect/AddSelectBody.js +10 -12
  21. package/es/components/AddSelect/AddSelectSort.d.ts +16 -17
  22. package/es/components/AddSelect/AddSelectSort.js +5 -5
  23. package/es/components/AddSelect/types/index.d.ts +44 -0
  24. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +5 -1
  25. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +12 -6
  26. package/es/components/Card/Card.js +50 -9
  27. package/es/components/Card/CardFooter.d.ts +5 -1
  28. package/es/components/Card/CardFooter.js +11 -1
  29. package/es/components/Carousel/Carousel.d.ts +6 -2
  30. package/es/components/Checklist/Checklist.d.ts +100 -2
  31. package/es/components/Checklist/Checklist.js +9 -5
  32. package/es/components/Checklist/Checklist.types.d.ts +19 -0
  33. package/es/components/Checklist/Checklist.types.js +22 -0
  34. package/es/components/Checklist/ChecklistChart.d.ts +5 -1
  35. package/es/components/Checklist/ChecklistChart.js +9 -4
  36. package/es/components/Checklist/ChecklistIcon.d.ts +5 -1
  37. package/es/components/Checklist/ChecklistIcon.js +9 -4
  38. package/es/components/CoachmarkButton/CoachmarkButton.d.ts +19 -2
  39. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +46 -2
  40. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +5 -4
  41. package/es/components/CreateInfluencer/CreateInfluencer.d.ts +55 -17
  42. package/es/components/CreateInfluencer/CreateInfluencer.js +1 -1
  43. package/es/components/CreateTearsheet/CreateTearsheetStep.d.ts +95 -2
  44. package/es/components/CreateTearsheet/CreateTearsheetStep.js +7 -5
  45. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +67 -2
  46. package/es/components/DataSpreadsheet/DataSpreadsheet.js +50 -28
  47. package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +139 -2
  48. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +46 -31
  49. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +89 -2
  50. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +39 -25
  51. package/es/components/DataSpreadsheet/types/index.d.ts +30 -0
  52. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
  53. package/es/components/ExpressiveCard/ExpressiveCard.d.ts +2 -1
  54. package/es/components/GetStartedCard/GetStartedCard.d.ts +5 -0
  55. package/es/components/GetStartedCard/GetStartedCard.js +82 -0
  56. package/es/components/GetStartedCard/index.d.ts +1 -0
  57. package/es/components/Guidebanner/Guidebanner.d.ts +62 -2
  58. package/es/components/Guidebanner/Guidebanner.js +6 -5
  59. package/es/components/Guidebanner/GuidebannerElement.d.ts +30 -17
  60. package/es/components/Guidebanner/GuidebannerElement.js +4 -4
  61. package/es/components/Guidebanner/GuidebannerElementButton.d.ts +29 -15
  62. package/es/components/Guidebanner/GuidebannerElementButton.js +10 -4
  63. package/es/components/Guidebanner/GuidebannerElementLink.d.ts +20 -13
  64. package/es/components/Guidebanner/GuidebannerElementLink.js +3 -3
  65. package/es/components/InterstitialScreen/InterstitialScreen.js +3 -1
  66. package/es/components/MultiAddSelect/MultiAddSelect.d.ts +134 -2
  67. package/es/components/MultiAddSelect/MultiAddSelect.js +2 -1
  68. package/es/components/NotificationsPanel/NotificationsPanel.d.ts +162 -1
  69. package/es/components/NotificationsPanel/NotificationsPanel.js +10 -11
  70. package/es/components/PageHeader/PageHeader.d.ts +298 -5
  71. package/es/components/PageHeader/PageHeader.js +98 -47
  72. package/es/components/PageHeader/PageHeaderUtils.d.ts +1 -1
  73. package/es/components/PageHeader/PageHeaderUtils.js +4 -1
  74. package/es/components/SidePanel/SidePanel.d.ts +6 -2
  75. package/es/components/SidePanel/SidePanel.js +18 -3
  76. package/es/components/SidePanel/constants.d.ts +1 -0
  77. package/es/components/SidePanel/constants.js +1 -0
  78. package/es/components/SingleAddSelect/SingleAddSelect.d.ts +69 -2
  79. package/es/components/SingleAddSelect/SingleAddSelect.js +2 -1
  80. package/es/components/TagOverflow/TagOverflow.d.ts +5 -0
  81. package/es/components/TagOverflow/TagOverflow.js +153 -29
  82. package/es/components/TagOverflow/TagOverflowModal.d.ts +29 -0
  83. package/es/components/TagOverflow/TagOverflowModal.js +112 -0
  84. package/es/components/TagOverflow/TagOverflowPopover.d.ts +2 -0
  85. package/es/components/TagOverflow/TagOverflowPopover.js +135 -0
  86. package/es/components/Tearsheet/Tearsheet.d.ts +132 -6
  87. package/es/components/Tearsheet/Tearsheet.js +25 -13
  88. package/es/components/Tearsheet/TearsheetShell.d.ts +5 -1
  89. package/es/components/Tearsheet/TearsheetShell.js +26 -4
  90. package/es/components/WebTerminal/WebTerminal.d.ts +4 -0
  91. package/es/components/WebTerminal/WebTerminal.js +11 -3
  92. package/es/components/index.d.ts +1 -0
  93. package/es/global/js/hooks/useFocus.d.ts +3 -1
  94. package/es/global/js/hooks/useFocus.js +6 -3
  95. package/es/global/js/hooks/useRetrieveStepData.d.ts +1 -1
  96. package/es/global/js/hooks/useRetrieveStepData.js +1 -1
  97. package/es/global/js/package-settings.d.ts +1 -0
  98. package/es/global/js/package-settings.js +1 -0
  99. package/es/index.js +1 -0
  100. package/es/settings.d.ts +1 -0
  101. package/lib/components/AddSelect/AddSelect.d.ts +44 -2
  102. package/lib/components/AddSelect/AddSelect.js +7 -3
  103. package/lib/components/AddSelect/AddSelectBody.d.ts +44 -2
  104. package/lib/components/AddSelect/AddSelectBody.js +10 -12
  105. package/lib/components/AddSelect/AddSelectSort.d.ts +16 -17
  106. package/lib/components/AddSelect/AddSelectSort.js +5 -5
  107. package/lib/components/AddSelect/types/index.d.ts +44 -0
  108. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +5 -1
  109. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +12 -6
  110. package/lib/components/Card/Card.js +50 -9
  111. package/lib/components/Card/CardFooter.d.ts +5 -1
  112. package/lib/components/Card/CardFooter.js +11 -1
  113. package/lib/components/Carousel/Carousel.d.ts +6 -2
  114. package/lib/components/Checklist/Checklist.d.ts +100 -2
  115. package/lib/components/Checklist/Checklist.js +9 -5
  116. package/lib/components/Checklist/Checklist.types.d.ts +19 -0
  117. package/lib/components/Checklist/Checklist.types.js +27 -0
  118. package/lib/components/Checklist/ChecklistChart.d.ts +5 -1
  119. package/lib/components/Checklist/ChecklistChart.js +14 -9
  120. package/lib/components/Checklist/ChecklistIcon.d.ts +5 -1
  121. package/lib/components/Checklist/ChecklistIcon.js +9 -4
  122. package/lib/components/CoachmarkButton/CoachmarkButton.d.ts +19 -2
  123. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +46 -2
  124. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +5 -4
  125. package/lib/components/CreateInfluencer/CreateInfluencer.d.ts +55 -17
  126. package/lib/components/CreateInfluencer/CreateInfluencer.js +1 -1
  127. package/lib/components/CreateTearsheet/CreateTearsheetStep.d.ts +95 -2
  128. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +7 -5
  129. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +67 -2
  130. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +50 -28
  131. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +139 -2
  132. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +46 -31
  133. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +89 -2
  134. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +39 -25
  135. package/lib/components/DataSpreadsheet/types/index.d.ts +30 -0
  136. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
  137. package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +2 -1
  138. package/lib/components/GetStartedCard/GetStartedCard.d.ts +5 -0
  139. package/lib/components/GetStartedCard/GetStartedCard.js +88 -0
  140. package/lib/components/GetStartedCard/index.d.ts +1 -0
  141. package/lib/components/Guidebanner/Guidebanner.d.ts +62 -2
  142. package/lib/components/Guidebanner/Guidebanner.js +6 -5
  143. package/lib/components/Guidebanner/GuidebannerElement.d.ts +30 -17
  144. package/lib/components/Guidebanner/GuidebannerElement.js +4 -4
  145. package/lib/components/Guidebanner/GuidebannerElementButton.d.ts +29 -15
  146. package/lib/components/Guidebanner/GuidebannerElementButton.js +10 -4
  147. package/lib/components/Guidebanner/GuidebannerElementLink.d.ts +20 -13
  148. package/lib/components/Guidebanner/GuidebannerElementLink.js +3 -3
  149. package/lib/components/InterstitialScreen/InterstitialScreen.js +3 -1
  150. package/lib/components/MultiAddSelect/MultiAddSelect.d.ts +134 -2
  151. package/lib/components/MultiAddSelect/MultiAddSelect.js +2 -1
  152. package/lib/components/NotificationsPanel/NotificationsPanel.d.ts +162 -1
  153. package/lib/components/NotificationsPanel/NotificationsPanel.js +10 -11
  154. package/lib/components/PageHeader/PageHeader.d.ts +298 -5
  155. package/lib/components/PageHeader/PageHeader.js +98 -47
  156. package/lib/components/PageHeader/PageHeaderUtils.d.ts +1 -1
  157. package/lib/components/PageHeader/PageHeaderUtils.js +4 -1
  158. package/lib/components/SidePanel/SidePanel.d.ts +6 -2
  159. package/lib/components/SidePanel/SidePanel.js +18 -3
  160. package/lib/components/SidePanel/constants.d.ts +1 -0
  161. package/lib/components/SidePanel/constants.js +1 -0
  162. package/lib/components/SingleAddSelect/SingleAddSelect.d.ts +69 -2
  163. package/lib/components/SingleAddSelect/SingleAddSelect.js +2 -1
  164. package/lib/components/TagOverflow/TagOverflow.d.ts +5 -0
  165. package/lib/components/TagOverflow/TagOverflow.js +154 -28
  166. package/lib/components/TagOverflow/TagOverflowModal.d.ts +29 -0
  167. package/lib/components/TagOverflow/TagOverflowModal.js +121 -0
  168. package/lib/components/TagOverflow/TagOverflowPopover.d.ts +2 -0
  169. package/lib/components/TagOverflow/TagOverflowPopover.js +144 -0
  170. package/lib/components/Tearsheet/Tearsheet.d.ts +132 -6
  171. package/lib/components/Tearsheet/Tearsheet.js +25 -13
  172. package/lib/components/Tearsheet/TearsheetShell.d.ts +5 -1
  173. package/lib/components/Tearsheet/TearsheetShell.js +26 -4
  174. package/lib/components/WebTerminal/WebTerminal.d.ts +4 -0
  175. package/lib/components/WebTerminal/WebTerminal.js +11 -3
  176. package/lib/components/index.d.ts +1 -0
  177. package/lib/global/js/hooks/useFocus.d.ts +3 -1
  178. package/lib/global/js/hooks/useFocus.js +6 -3
  179. package/lib/global/js/hooks/useRetrieveStepData.d.ts +1 -1
  180. package/lib/global/js/hooks/useRetrieveStepData.js +1 -1
  181. package/lib/global/js/package-settings.d.ts +1 -0
  182. package/lib/global/js/package-settings.js +1 -0
  183. package/lib/index.js +5 -0
  184. package/lib/settings.d.ts +1 -0
  185. package/package.json +3 -3
  186. package/scss/components/CoachmarkStack/_coachmark-stack.scss +4 -2
  187. package/scss/components/GetStartedCard/_carbon-imports.scss +9 -0
  188. package/scss/components/GetStartedCard/_get-started-card.scss +135 -0
  189. package/scss/components/GetStartedCard/_index-with-carbon.scss +9 -0
  190. package/scss/components/GetStartedCard/_index.scss +8 -0
  191. package/scss/components/SidePanel/_side-panel-variables.scss +1 -0
  192. package/scss/components/StringFormatter/_string-formatter.scss +1 -1
  193. package/scss/components/TagOverflow/_tag-overflow.scss +157 -0
  194. package/scss/components/_index-with-carbon.scss +1 -0
  195. package/scss/components/_index.scss +1 -0
  196. package/telemetry.yml +25 -16
@@ -33,14 +33,12 @@ import { useMoveActiveCell } from './hooks/useMoveActiveCell.js';
33
33
  import { useSpreadsheetEdit } from './hooks/useSpreadsheetEdit.js';
34
34
 
35
35
  var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
36
-
37
36
  // The block part of our conventional BEM class names (blockClass__E--M).
38
37
  var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
39
38
  var componentName = 'DataSpreadsheet';
40
39
 
41
40
  // Default values for props
42
41
  var defaults = {
43
- cellSize: 'sm',
44
42
  columns: Object.freeze([]),
45
43
  data: Object.freeze([]),
46
44
  defaultEmptyRowCount: 16,
@@ -49,13 +47,12 @@ var defaults = {
49
47
  onSelectionAreaChange: Object.freeze(function () {}),
50
48
  theme: 'light'
51
49
  };
52
-
53
50
  /**
54
51
  * DataSpreadsheet: used to organize and display large amounts of structured data, separated by columns and rows in a grid-like format.
55
52
  */
56
53
  var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
57
54
  var _ref$cellSize = _ref.cellSize,
58
- cellSize = _ref$cellSize === void 0 ? defaults.cellSize : _ref$cellSize,
55
+ cellSize = _ref$cellSize === void 0 ? 'sm' : _ref$cellSize,
59
56
  className = _ref.className,
60
57
  _ref$columns = _ref.columns,
61
58
  columns = _ref$columns === void 0 ? defaults.columns : _ref$columns,
@@ -75,7 +72,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
75
72
  theme = _ref.theme,
76
73
  totalVisibleColumns = _ref.totalVisibleColumns,
77
74
  rest = _objectWithoutProperties(_ref, _excluded);
78
- var multiKeyTrackingRef = useRef();
75
+ var multiKeyTrackingRef = useRef(null);
79
76
  var localRef = useRef();
80
77
  var spreadsheetRef = ref || localRef;
81
78
  var focusedElement = useActiveElement();
@@ -115,7 +112,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
115
112
  _useState18 = _slicedToArray(_useState17, 2),
116
113
  headerCellHoldActive = _useState18[0],
117
114
  setHeaderCellHoldActive = _useState18[1];
118
- var _useState19 = useState(null),
115
+ var _useState19 = useState(false),
119
116
  _useState20 = _slicedToArray(_useState19, 2),
120
117
  isActiveHeaderCellChanged = _useState20[0],
121
118
  setIsActiveHeaderCellChanged = _useState20[1];
@@ -126,10 +123,10 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
126
123
  var previousState = usePreviousValue({
127
124
  activeCellCoordinates: activeCellCoordinates,
128
125
  isEditing: isEditing
129
- });
126
+ }) || {};
130
127
  var cellSizeValue = getCellSize(cellSize);
131
128
  var cellEditorRef = useRef();
132
- var _useState23 = useState(),
129
+ var _useState23 = useState(null),
133
130
  _useState24 = _slicedToArray(_useState23, 2),
134
131
  activeCellContent = _useState24[0],
135
132
  setActiveCellContent = _useState24[1];
@@ -180,13 +177,18 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
180
177
 
181
178
  // Removes the active cell element
182
179
  var removeActiveCell = useCallback(function () {
183
- var activeCellHighlight = spreadsheetRef.current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
184
- activeCellHighlight.style.display = 'none';
180
+ var _current;
181
+ var activeCellHighlight = spreadsheetRef === null || spreadsheetRef === void 0 || (_current = spreadsheetRef.current) === null || _current === void 0 ? void 0 : _current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
182
+ if (activeCellHighlight) {
183
+ activeCellHighlight.style.display = 'none';
184
+ }
185
185
  }, [spreadsheetRef]);
186
186
  var removeCellEditor = useCallback(function () {
187
187
  setCellEditorValue('');
188
188
  setIsEditing(false);
189
- cellEditorRef.current.style.display = 'none';
189
+ if (cellEditorRef !== null && cellEditorRef !== void 0 && cellEditorRef.current) {
190
+ cellEditorRef.current.style.display = 'none';
191
+ }
190
192
  }, []);
191
193
 
192
194
  // Remove cell editor if the active cell coordinates change and save with new cell data, this will
@@ -196,13 +198,16 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
196
198
  if (((prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) || (prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column)) && isEditing) {
197
199
  var cellProps = rows[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row].cells[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column];
198
200
  removeCellEditor();
199
- updateData(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row, cellProps.column.id);
200
- cellEditorRulerRef.current.textContent = '';
201
+ updateData(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row, cellProps.column.id, undefined);
202
+ if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
203
+ cellEditorRulerRef.current.textContent = '';
204
+ }
201
205
  }
202
206
  if ((prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) || (prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column)) {
203
207
  if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) !== 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header') {
208
+ var _activeCellFullData$r;
204
209
  var activeCellFullData = typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'number' && typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'number' ? rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row].cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
205
- setActiveCellContent(activeCellFullData.render('Cell'));
210
+ setActiveCellContent((_activeCellFullData$r = activeCellFullData === null || activeCellFullData === void 0 ? void 0 : activeCellFullData.render('Cell')) !== null && _activeCellFullData$r !== void 0 ? _activeCellFullData$r : null);
206
211
  }
207
212
  if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
208
213
  setActiveCellContent(null);
@@ -242,7 +247,6 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
242
247
  setActiveCellCoordinates: setActiveCellCoordinates,
243
248
  setSelectionAreas: setSelectionAreas,
244
249
  removeActiveCell: removeActiveCell,
245
- removeCellSelections: removeCellSelections,
246
250
  setContainerHasFocus: setContainerHasFocus,
247
251
  removeCellEditor: removeCellEditor
248
252
  });
@@ -297,6 +301,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
297
301
  }
298
302
  });
299
303
  removeCellSelections({
304
+ matcher: undefined,
300
305
  spreadsheetRef: spreadsheetRef
301
306
  });
302
307
  }, [activeCellCoordinates, updateActiveCellCoordinates, spreadsheetRef, columns.length]);
@@ -304,7 +309,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
304
309
  return isEditing || key === 'Meta' || key === 'Control';
305
310
  }, [isEditing]);
306
311
  var handleArrowKeyPress = useCallback(function (arrowKey) {
307
- event.preventDefault();
312
+ var _event;
313
+ (_event = event) === null || _event === void 0 || _event.preventDefault();
308
314
  handleInitialArrowPress();
309
315
  var coordinatesClone = _objectSpread2({}, activeCellCoordinates);
310
316
  var updatedValue;
@@ -407,18 +413,28 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
407
413
  setIsEditing(true);
408
414
  setClickAndHoldActive(false);
409
415
  var activeCellFullData = typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'number' && typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'number' ? rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row].cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
410
- var activeCellValue = activeCellFullData ? activeCellFullData.row.cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column].value : null;
416
+ var activeCellValue;
417
+ if (activeCellFullData && activeCellCoordinates !== null && activeCellCoordinates !== void 0 && activeCellCoordinates.column) {
418
+ var _activeCellFullData$r2;
419
+ activeCellValue = activeCellFullData ? (_activeCellFullData$r2 = activeCellFullData.row.cells) === null || _activeCellFullData$r2 === void 0 || (_activeCellFullData$r2 = _activeCellFullData$r2[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column]) === null || _activeCellFullData$r2 === void 0 ? void 0 : _activeCellFullData$r2.value : null;
420
+ }
411
421
  setCellEditorValue(activeCellValue || '');
412
- cellEditorRulerRef.current.textContent = activeCellValue;
413
- cellEditorRef.current.style.width = activeCellRef === null || activeCellRef === void 0 ? void 0 : activeCellRef.current.style.width;
422
+ if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
423
+ cellEditorRulerRef.current.textContent = activeCellValue;
424
+ }
425
+ if (cellEditorRef !== null && cellEditorRef !== void 0 && cellEditorRef.current && activeCellRef !== null && activeCellRef !== void 0 && activeCellRef.current) {
426
+ var _activeCellRef$curren;
427
+ cellEditorRef.current.style.width = activeCellRef === null || activeCellRef === void 0 || (_activeCellRef$curren = activeCellRef.current) === null || _activeCellRef$curren === void 0 || (_activeCellRef$curren = _activeCellRef$curren.style) === null || _activeCellRef$curren === void 0 ? void 0 : _activeCellRef$curren.width;
428
+ }
414
429
  };
415
430
 
416
431
  // Sets the initial placement of the cell editor cursor at the end of the text area
417
432
  // this is not done for us by default in Safari
418
433
  useEffect(function () {
419
434
  if (isEditing && !(previousState !== null && previousState !== void 0 && previousState.isEditing)) {
420
- cellEditorRef.current.setSelectionRange(cellEditorRulerRef.current.textContent.length, cellEditorRulerRef.current.textContent.length);
421
- cellEditorRef.current.focus();
435
+ var _cellEditorRef$curren, _cellEditorRulerRef$c, _cellEditorRulerRef$c2, _cellEditorRef$curren2;
436
+ cellEditorRef === null || cellEditorRef === void 0 || (_cellEditorRef$curren = cellEditorRef.current) === null || _cellEditorRef$curren === void 0 || _cellEditorRef$curren.setSelectionRange(Number(cellEditorRulerRef === null || cellEditorRulerRef === void 0 || (_cellEditorRulerRef$c = cellEditorRulerRef.current) === null || _cellEditorRulerRef$c === void 0 || (_cellEditorRulerRef$c = _cellEditorRulerRef$c.textContent) === null || _cellEditorRulerRef$c === void 0 ? void 0 : _cellEditorRulerRef$c.length), Number(cellEditorRulerRef === null || cellEditorRulerRef === void 0 || (_cellEditorRulerRef$c2 = cellEditorRulerRef.current) === null || _cellEditorRulerRef$c2 === void 0 || (_cellEditorRulerRef$c2 = _cellEditorRulerRef$c2.textContent) === null || _cellEditorRulerRef$c2 === void 0 ? void 0 : _cellEditorRulerRef$c2.length));
437
+ cellEditorRef === null || cellEditorRef === void 0 || (_cellEditorRef$curren2 = cellEditorRef.current) === null || _cellEditorRef$curren2 === void 0 || _cellEditorRef$curren2.focus();
422
438
  }
423
439
  }, [isEditing, previousState === null || previousState === void 0 ? void 0 : previousState.isEditing]);
424
440
  var handleActiveCellClick = function handleActiveCellClick() {
@@ -429,7 +445,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
429
445
  }
430
446
  handleRowColumnHeaderClick({
431
447
  isKeyboard: false,
432
- index: indexValue
448
+ index: Number(indexValue)
433
449
  });
434
450
  }
435
451
  return;
@@ -446,6 +462,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
446
462
  var tempMatcher = uuidv4();
447
463
  setClickAndHoldActive(true);
448
464
  removeCellSelections({
465
+ matcher: null,
449
466
  spreadsheetRef: spreadsheetRef
450
467
  });
451
468
  setSelectionAreas([{
@@ -476,19 +493,21 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
476
493
  var handleRowColumnHeaderClick = function handleRowColumnHeaderClick(_ref5) {
477
494
  var isKeyboard = _ref5.isKeyboard,
478
495
  _ref5$index = _ref5.index,
479
- index = _ref5$index === void 0 ? null : _ref5$index;
496
+ index = _ref5$index === void 0 ? -1 : _ref5$index;
480
497
  var handleHeaderCellProps = {
481
498
  activeCellCoordinates: activeCellCoordinates,
482
499
  rows: rows,
483
500
  columns: columns,
501
+ currentMatcher: currentMatcher,
484
502
  setActiveCellCoordinates: setActiveCellCoordinates,
485
503
  setCurrentMatcher: setCurrentMatcher,
486
504
  setSelectionAreas: setSelectionAreas,
487
505
  spreadsheetRef: spreadsheetRef,
506
+ index: index,
488
507
  isKeyboard: isKeyboard,
489
508
  setSelectionAreaData: setSelectionAreaData,
490
- index: index,
491
- currentMatcher: currentMatcher
509
+ isHoldingCommandKey: null,
510
+ isHoldingShiftKey: null
492
511
  };
493
512
  // Select an entire column
494
513
  if ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header') {
@@ -612,7 +631,6 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
612
631
  setContainerHasFocus: setContainerHasFocus,
613
632
  selectionAreas: selectionAreas,
614
633
  setSelectionAreas: setSelectionAreas,
615
- cellSize: cellSize,
616
634
  headerGroups: headerGroups,
617
635
  defaultColumn: defaultColumn,
618
636
  getTableBodyProps: getTableBodyProps,
@@ -662,10 +680,12 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
662
680
  }),
663
681
  onChange: function onChange(event) {
664
682
  setCellEditorValue(event.target.value);
665
- cellEditorRulerRef.current.textContent = event.target.value;
683
+ if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
684
+ cellEditorRulerRef.current.textContent = event.target.value;
685
+ }
666
686
  },
667
687
  ref: cellEditorRef,
668
- "aria-labelledby": activeCellCoordinates ? "".concat(blockClass, "__cell--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) : null,
688
+ "aria-labelledby": activeCellCoordinates ? "".concat(blockClass, "__cell--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) : '',
669
689
  className: cx("".concat(blockClass, "__cell-editor"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__cell-editor--").concat(cellSize), _defineProperty({}, "".concat(blockClass, "__cell-editor--active"), isEditing))
670
690
  }), /*#__PURE__*/React__default.createElement("pre", {
671
691
  "aria-hidden": true,
@@ -696,6 +716,7 @@ DataSpreadsheet.propTypes = {
696
716
  /**
697
717
  * The data that will build the column headers
698
718
  */
719
+ /**@ts-ignore */
699
720
  columns: PropTypes.arrayOf(PropTypes.shape({
700
721
  Header: PropTypes.string,
701
722
  accessor: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
@@ -704,6 +725,7 @@ DataSpreadsheet.propTypes = {
704
725
  /**
705
726
  * The spreadsheet data that will be rendered in the body of the spreadsheet component
706
727
  */
728
+ /**@ts-ignore */
707
729
  data: PropTypes.arrayOf(PropTypes.shape),
708
730
  /**
709
731
  * Sets the number of empty rows to be created when there is no data provided
@@ -1,2 +1,139 @@
1
- export const DataSpreadsheetBody: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
- import React from 'react';
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2022
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 React, { Dispatch, SetStateAction, MutableRefObject } from 'react';
8
+ import { ActiveCellCoordinates, Column } from './types';
9
+ interface DataSpreadsheetBodyProps {
10
+ /**
11
+ * Object containing the active cell coordinates
12
+ */
13
+ activeCellCoordinates?: ActiveCellCoordinates | null;
14
+ /**
15
+ *This is the ref of the button input, which is the active cell element
16
+ */
17
+ activeCellRef?: MutableRefObject<HTMLElement | undefined>;
18
+ /**
19
+ * Is the user clicking and holding in the data spreadsheet body
20
+ */
21
+ clickAndHoldActive?: boolean;
22
+ /**
23
+ * All of the spreadsheet columns
24
+ */
25
+ columns?: readonly Column[];
26
+ /**
27
+ * This represents the id of the current cell selection area
28
+ */
29
+ currentMatcher?: string;
30
+ /**
31
+ * Default spreadsheet sizing values
32
+ */
33
+ defaultColumn?: Column;
34
+ /**
35
+ * Sets the number of empty rows to be created when there is no data provided
36
+ */
37
+ defaultEmptyRowCount?: number;
38
+ /**
39
+ * Function to set table body prop values
40
+ */
41
+ getTableBodyProps?: () => {
42
+ data: any;
43
+ };
44
+ /**
45
+ * Headers provided from useTable hook
46
+ */
47
+ headerGroups?: any[];
48
+ /**
49
+ * The spreadsheet id
50
+ */
51
+ id?: number | string;
52
+ /**
53
+ * The event handler that is called when the active cell changes
54
+ */
55
+ onActiveCellChange?: () => void;
56
+ /**
57
+ * The event handler that is called to set the rows for the empty spreadsheet
58
+ */
59
+ onDataUpdate?: ({ ...args }: {
60
+ [x: string]: any;
61
+ }) => void;
62
+ /**
63
+ * The event handler that is called when the selection areas change
64
+ */
65
+ onSelectionAreaChange?: ({ ...args }: {
66
+ [x: string]: any;
67
+ }) => void;
68
+ /**
69
+ * Prepare row function from react-table
70
+ */
71
+ prepareRow?: (...args: any[]) => void;
72
+ /**
73
+ * All of the spreadsheet row data
74
+ */
75
+ rows?: any[];
76
+ /**
77
+ * The scrollbar width
78
+ */
79
+ scrollBarSize?: number;
80
+ /**
81
+ * Array of selection area data
82
+ */
83
+ selectionAreaData?: object[];
84
+ /**
85
+ * Array of selection areas
86
+ */
87
+ selectionAreas?: any[];
88
+ /**
89
+ * Setter fn for activeCellCoordinates state value
90
+ */
91
+ setActiveCellCoordinates?: Dispatch<SetStateAction<ActiveCellCoordinates | null>>;
92
+ /**
93
+ * Setter fn for active cell inside of selection area
94
+ */
95
+ setActiveCellInsideSelectionArea?: Dispatch<SetStateAction<boolean>>;
96
+ /**
97
+ * Setter fn for clickAndHold state value
98
+ */
99
+ setClickAndHoldActive?: Dispatch<SetStateAction<boolean>>;
100
+ /**
101
+ * Setter fn for column ordering, provided from react-table
102
+ */
103
+ setColumnOrder?: () => void;
104
+ /**
105
+ * Setter fn for containerHasFocus state value
106
+ */
107
+ setContainerHasFocus?: Dispatch<SetStateAction<boolean>>;
108
+ /**
109
+ * Setter fn for currentMatcher state value
110
+ */
111
+ setCurrentMatcher?: Dispatch<SetStateAction<string>>;
112
+ /**
113
+ * Setter fn for header cell hold active value
114
+ */
115
+ setHeaderCellHoldActive?: Dispatch<SetStateAction<boolean>>;
116
+ /**
117
+ * Setter fn for selectionAreaData state value
118
+ */
119
+ setSelectionAreaData?: Dispatch<SetStateAction<object[]>>;
120
+ /**
121
+ * Setter fn for selectionAreas state value
122
+ */
123
+ setSelectionAreas?: Dispatch<SetStateAction<object[]>>;
124
+ /**
125
+ * The total columns width
126
+ */
127
+ totalColumnsWidth?: number;
128
+ /**
129
+ * The total number of columns to be initially visible, additional columns will be rendered and
130
+ * visible via horizontal scrollbar
131
+ */
132
+ totalVisibleColumns?: number;
133
+ /**
134
+ * Prop from react-table used to reorder columns
135
+ */
136
+ visibleColumns?: [];
137
+ }
138
+ export declare const DataSpreadsheetBody: React.ForwardRefExoticComponent<DataSpreadsheetBodyProps & React.RefAttributes<HTMLDivElement>>;
139
+ export {};
@@ -63,21 +63,21 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
63
63
  var previousState = usePreviousValue({
64
64
  selectionAreaData: selectionAreaData,
65
65
  clickAndHoldActive: clickAndHoldActive,
66
- rowHeight: defaultColumn.rowHeight
67
- });
66
+ rowHeight: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight
67
+ }) || {};
68
68
 
69
69
  // Set custom css property containing the spreadsheet total width
70
70
  useEffect(function () {
71
- ref === null || ref === void 0 || ref.current.style.setProperty("--".concat(blockClass, "--total-width"), px(totalColumnsWidth + scrollBarSize));
71
+ ref === null || ref === void 0 || ref.current.style.setProperty("--".concat(blockClass, "--total-width"), px((totalColumnsWidth || 0) + (scrollBarSize || 0)));
72
72
  }, [ref, scrollBarSize, totalColumnsWidth]);
73
73
 
74
74
  // Call the `onSelectionAreaChange` handler to send selection area data
75
75
  // back to the consumer
76
76
  useEffect(function () {
77
- if (selectionAreaData.length) {
77
+ if (selectionAreaData !== null && selectionAreaData !== void 0 && selectionAreaData.length) {
78
78
  var _previousState$select;
79
79
  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)) {
80
- onSelectionAreaChange(selectionAreaData);
80
+ onSelectionAreaChange === null || onSelectionAreaChange === void 0 || onSelectionAreaChange(selectionAreaData);
81
81
  }
82
82
  }
83
83
  }, [previousState === null || previousState === void 0 ? void 0 : previousState.selectionAreaData, selectionAreaData, onSelectionAreaChange, clickAndHoldActive, previousState === null || previousState === void 0 ? void 0 : previousState.clickAndHoldActive]);
@@ -109,7 +109,7 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
109
109
  }),
110
110
  selectionId: area.matcher
111
111
  };
112
- setSelectionAreaData(function (prev) {
112
+ setSelectionAreaData === null || setSelectionAreaData === void 0 || setSelectionAreaData(function (prev) {
113
113
  var prevValues = deepCloneObject(prev);
114
114
  var newAreaData = prevValues.filter(function (item) {
115
115
  return item.selectionId !== area.matcher;
@@ -167,19 +167,28 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
167
167
  // cell also gets updated with the new size and new top placement
168
168
  // value. All of the cell selections will be updated as well
169
169
  useEffect(function () {
170
- var listContainer = spreadsheetBodyRef === null || spreadsheetBodyRef === void 0 ? void 0 : spreadsheetBodyRef.current;
171
- var activeCellButton = listContainer.querySelector(".".concat(blockClass, "__active-cell--highlight"));
172
- if (activeCellButton && defaultColumn.rowHeight !== previousState.rowHeight) {
170
+ var listContainer;
171
+ var activeCellButton;
172
+ if (spreadsheetBodyRef !== null && spreadsheetBodyRef !== void 0 && spreadsheetBodyRef.current) {
173
+ var _listContainer;
174
+ listContainer = spreadsheetBodyRef === null || spreadsheetBodyRef === void 0 ? void 0 : spreadsheetBodyRef.current;
175
+ activeCellButton = (_listContainer = listContainer) === null || _listContainer === void 0 ? void 0 : _listContainer.querySelector(".".concat(blockClass, "__active-cell--highlight"));
176
+ }
177
+ if (activeCellButton && (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight) !== previousState.rowHeight) {
173
178
  activeCellButton.style.height = "".concat(defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight, "px");
174
179
  if (activeCellCoordinates) {
175
- var activeTargetElement = ref.current.querySelector("[data-row-index=\"".concat(activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates.column, "\"]"));
176
- var _listContainer = ref.current.querySelector(".".concat(blockClass, "__list--container"));
177
- var newActiveCellTopPosition = activeTargetElement.getBoundingClientRect().top - _listContainer.getBoundingClientRect().top;
180
+ var activeTargetElement = ref === null || ref === void 0 ? void 0 : ref.current.querySelector("[data-row-index=\"".concat(activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates.column, "\"]"));
181
+ var _listContainer2 = ref === null || ref === void 0 ? void 0 : ref.current.querySelector(".".concat(blockClass, "__list--container"));
182
+ var newActiveCellTopPosition;
183
+ if (activeTargetElement && _listContainer2) {
184
+ newActiveCellTopPosition = (activeTargetElement === null || activeTargetElement === void 0 ? void 0 : activeTargetElement.getBoundingClientRect().top) - _listContainer2.getBoundingClientRect().top;
185
+ }
178
186
  activeCellButton.style.top = px(newActiveCellTopPosition);
179
187
  removeCellSelections({
188
+ matcher: undefined,
180
189
  spreadsheetRef: ref
181
190
  });
182
- selectionAreas.map(function (area) {
191
+ selectionAreas === null || selectionAreas === void 0 || selectionAreas.map(function (area) {
183
192
  if (!area.areaCreated && area.point1 && area.point2 && area.matcher) {
184
193
  return createCellSelectionArea({
185
194
  ref: ref,
@@ -202,12 +211,12 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
202
211
  var removeDuplicateSelections = useCallback(function () {
203
212
  var uniqueAttrArray = [],
204
213
  removedSelectionAreaMatcherArr = [];
205
- ref.current.querySelectorAll(".".concat(blockClass, "__selection-area--element")).forEach(function (selectorEl) {
206
- var _selectorEl$style = selectorEl.style,
207
- top = _selectorEl$style.top,
208
- left = _selectorEl$style.left,
209
- height = _selectorEl$style.height,
210
- width = _selectorEl$style.width;
214
+ ref === null || ref === void 0 || ref.current.querySelectorAll(".".concat(blockClass, "__selection-area--element")).forEach(function (selectorEl) {
215
+ var _style = selectorEl.style,
216
+ top = _style.top,
217
+ left = _style.left,
218
+ height = _style.height,
219
+ width = _style.width;
211
220
  var uniqueAttrStr = "".concat(top).concat(left).concat(height).concat(width); // eg: 20px30px70px90px
212
221
  if (uniqueAttrArray.indexOf(uniqueAttrStr) == -1) {
213
222
  uniqueAttrArray.push(uniqueAttrStr);
@@ -219,13 +228,13 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
219
228
 
220
229
  //clean the duplicate selectionAreaData and selectionArea
221
230
  if (removedSelectionAreaMatcherArr.length) {
222
- setSelectionAreas(function (prev) {
231
+ setSelectionAreas === null || setSelectionAreas === void 0 || setSelectionAreas(function (prev) {
223
232
  var prevValues = deepCloneObject(prev);
224
233
  return prevValues.filter(function (item) {
225
234
  return !removedSelectionAreaMatcherArr.includes(item.matcher);
226
235
  });
227
236
  });
228
- setSelectionAreaData(function (prev) {
237
+ setSelectionAreaData === null || setSelectionAreaData === void 0 || setSelectionAreaData(function (prev) {
229
238
  var prevValues = deepCloneObject(prev);
230
239
  return prevValues.filter(function (item) {
231
240
  return !removedSelectionAreaMatcherArr.includes(item.selectionId);
@@ -248,14 +257,14 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
248
257
  };
249
258
  }, [currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea, activeCellRef]);
250
259
  var handleBodyScroll = function handleBodyScroll() {
251
- var headerRowElement = ref.current.querySelector("\n .".concat(blockClass, "__header--container .").concat(blockClass, "__tr"));
252
- headerRowElement.scrollLeft = contentScrollRef.current.scrollLeft;
260
+ var headerRowElement = ref.current.querySelector("\n .".concat(blockClass, "__header--container .").concat(blockClass, "__tr")) || new HTMLDivElement();
261
+ headerRowElement.scrollLeft = contentScrollRef === null || contentScrollRef === void 0 ? void 0 : contentScrollRef.current.scrollLeft;
253
262
  };
254
263
  useEffect(function () {
255
- contentScrollRef.current.addEventListener('scroll', function (event) {
264
+ contentScrollRef.current.addEventListener('scroll', function () {
256
265
  return handleBodyScroll();
257
266
  });
258
- var contentScrollElementRef = contentScrollRef.current;
267
+ var contentScrollElementRef = contentScrollRef.current || new HTMLElement();
259
268
  return function () {
260
269
  contentScrollElementRef.removeEventListener('scroll', handleBodyScroll);
261
270
  };
@@ -280,12 +289,12 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
280
289
  _toConsumableArray(Array(defaultEmptyRowCount)).map(function () {
281
290
  var _headerGroups$;
282
291
  var emptyCell = {};
283
- (_headerGroups$ = headerGroups[0]) === null || _headerGroups$ === void 0 || _headerGroups$.headers.map(function (header) {
292
+ headerGroups === null || headerGroups === void 0 || (_headerGroups$ = headerGroups[0]) === null || _headerGroups$ === void 0 || _headerGroups$.headers.map(function (header) {
284
293
  emptyCell[header.id] = null;
285
294
  });
286
295
  emptyRowData.push(emptyCell);
287
296
  });
288
- onDataUpdate(emptyRowData);
297
+ onDataUpdate === null || onDataUpdate === void 0 || onDataUpdate(emptyRowData);
289
298
  };
290
299
  buildEmptyRows();
291
300
  }
@@ -298,9 +307,9 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
298
307
  var RenderRow = useCallback(function (_ref3) {
299
308
  var index = _ref3.index,
300
309
  style = _ref3.style;
301
- var row = rows[index];
310
+ var row = rows === null || rows === void 0 ? void 0 : rows[index];
302
311
  if (rows && rows.length) {
303
- prepareRow(row);
312
+ prepareRow === null || prepareRow === void 0 || prepareRow(row);
304
313
  var rowProps = prepareProps(row.getRowProps({
305
314
  style: style
306
315
  }), 'key');
@@ -355,12 +364,14 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
355
364
  return /*#__PURE__*/React__default.createElement("div", _extends({
356
365
  ref: spreadsheetBodyRef,
357
366
  className: cx("".concat(blockClass, "__body--container"))
358
- }, getTableBodyProps()), /*#__PURE__*/React__default.createElement(FixedSizeList, {
367
+ }, getTableBodyProps === null || getTableBodyProps === void 0 ? void 0 : getTableBodyProps()), /*#__PURE__*/React__default.createElement(FixedSizeList, {
359
368
  className: cx("".concat(blockClass, "__list--container"), "".concat(blockClass, "__list--container--").concat(id)),
360
369
  height: 400,
361
- itemCount: rows.length || defaultEmptyRowCount,
370
+ itemCount: (rows === null || rows === void 0 ? void 0 : rows.length) || defaultEmptyRowCount,
362
371
  itemSize: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight,
363
372
  width: getSpreadsheetWidth({
373
+ headerGroup: undefined,
374
+ type: undefined,
364
375
  scrollBarSizeValue: scrollBarSize,
365
376
  totalVisibleColumns: totalVisibleColumns,
366
377
  defaultColumn: defaultColumn,
@@ -374,6 +385,7 @@ DataSpreadsheetBody.propTypes = {
374
385
  /**
375
386
  * Object containing the active cell coordinates
376
387
  */
388
+ /**@ts-ignore */
377
389
  activeCellCoordinates: PropTypes.shape({
378
390
  row: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
379
391
  column: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
@@ -381,6 +393,7 @@ DataSpreadsheetBody.propTypes = {
381
393
  /**
382
394
  *This is the ref of the button input, which is the active cell element
383
395
  */
396
+ /**@ts-ignore */
384
397
  activeCellRef: PropTypes.object,
385
398
  /**
386
399
  * Is the user clicking and holding in the data spreadsheet body
@@ -397,6 +410,7 @@ DataSpreadsheetBody.propTypes = {
397
410
  /**
398
411
  * Default spreadsheet sizing values
399
412
  */
413
+ /**@ts-ignore */
400
414
  defaultColumn: PropTypes.shape({
401
415
  rowHeight: PropTypes.number,
402
416
  rowHeaderWidth: PropTypes.number,
@@ -498,6 +512,7 @@ DataSpreadsheetBody.propTypes = {
498
512
  /**
499
513
  * Prop from react-table used to reorder columns
500
514
  */
515
+ /**@ts-ignore */
501
516
  visibleColumns: PropTypes.array
502
517
  };
503
518