@carbon/ibm-products 1.11.2 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (238) hide show
  1. package/README.md +0 -3
  2. package/css/components/Datagrid/styles/addons/CustomizeColumnsModal.css +47 -0
  3. package/css/components/Datagrid/styles/addons/CustomizeColumnsModal.css.map +1 -0
  4. package/css/components/Datagrid/styles/addons/RowSizeDropdown.css +20 -0
  5. package/css/components/Datagrid/styles/addons/RowSizeDropdown.css.map +1 -0
  6. package/css/components/Datagrid/styles/datagrid.css +264 -0
  7. package/css/components/Datagrid/styles/datagrid.css.map +1 -0
  8. package/css/components/Datagrid/styles/index.css +509 -0
  9. package/css/components/Datagrid/styles/index.css.map +1 -0
  10. package/css/components/Datagrid/styles/useActionsColumn.css +23 -0
  11. package/css/components/Datagrid/styles/useActionsColumn.css.map +1 -0
  12. package/css/components/Datagrid/styles/useColumnRightAlign.css +28 -0
  13. package/css/components/Datagrid/styles/useColumnRightAlign.css.map +1 -0
  14. package/css/components/Datagrid/styles/useNestedRows.css +15 -0
  15. package/css/components/Datagrid/styles/useNestedRows.css.map +1 -0
  16. package/css/components/Datagrid/styles/useNestedTable.css +25 -0
  17. package/css/components/Datagrid/styles/useNestedTable.css.map +1 -0
  18. package/css/components/Datagrid/styles/useSelectAllToggle.css +28 -0
  19. package/css/components/Datagrid/styles/useSelectAllToggle.css.map +1 -0
  20. package/css/components/Datagrid/styles/useSortableColumns.css +50 -0
  21. package/css/components/Datagrid/styles/useSortableColumns.css.map +1 -0
  22. package/css/components/Datagrid/styles/useStickyColumn.css +35 -0
  23. package/css/components/Datagrid/styles/useStickyColumn.css.map +1 -0
  24. package/css/index-full-carbon.css +2019 -376
  25. package/css/index-full-carbon.css.map +1 -1
  26. package/css/index-full-carbon.min.css +6 -6
  27. package/css/index-full-carbon.min.css.map +1 -1
  28. package/css/index-without-carbon-released-only.css +18 -6
  29. package/css/index-without-carbon-released-only.css.map +1 -1
  30. package/css/index-without-carbon-released-only.min.css +2 -2
  31. package/css/index-without-carbon-released-only.min.css.map +1 -1
  32. package/css/index-without-carbon.css +679 -19
  33. package/css/index-without-carbon.css.map +1 -1
  34. package/css/index-without-carbon.min.css +5 -5
  35. package/css/index-without-carbon.min.css.map +1 -1
  36. package/css/index.css +679 -19
  37. package/css/index.css.map +1 -1
  38. package/css/index.min.css +6 -6
  39. package/css/index.min.css.map +1 -1
  40. package/es/components/ActionBar/ActionBar.js +3 -1
  41. package/es/components/ActionBar/ActionBarOverflowItems.js +5 -3
  42. package/es/components/AddSelect/AddSelect.js +133 -30
  43. package/es/components/AddSelect/AddSelectColumn.js +0 -1
  44. package/es/components/AddSelect/AddSelectFilter.js +129 -0
  45. package/es/components/AddSelect/AddSelectList.js +59 -13
  46. package/es/components/AddSelect/AddSelectSidebar.js +15 -5
  47. package/es/components/AddSelect/add-select-utils.js +30 -0
  48. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -0
  49. package/es/components/DataSpreadsheet/DataSpreadsheet.js +262 -164
  50. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +191 -51
  51. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +65 -13
  52. package/es/components/DataSpreadsheet/hooks/index.js +10 -0
  53. package/es/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +111 -0
  54. package/es/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +2 -4
  55. package/es/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +6 -6
  56. package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +3 -1
  57. package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +80 -6
  58. package/es/components/Datagrid/Datagrid/Datagrid.js +70 -0
  59. package/es/components/Datagrid/Datagrid/DatagridBody.js +36 -0
  60. package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +19 -0
  61. package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +26 -0
  62. package/es/components/Datagrid/Datagrid/DatagridHead.js +31 -0
  63. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +57 -0
  64. package/es/components/Datagrid/Datagrid/DatagridRefBody.js +37 -0
  65. package/es/components/Datagrid/Datagrid/DatagridRow.js +50 -0
  66. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +50 -0
  67. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +122 -0
  68. package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +36 -0
  69. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +22 -0
  70. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +87 -0
  71. package/es/components/Datagrid/Datagrid/DraggableElement.js +188 -0
  72. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +78 -0
  73. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +51 -0
  74. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +140 -0
  75. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +157 -0
  76. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +62 -0
  77. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +13 -0
  78. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +9 -0
  79. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +62 -0
  80. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +139 -0
  81. package/es/components/Datagrid/Datagrid/addons/RowSize/index.js +8 -0
  82. package/es/components/Datagrid/Datagrid/index.js +8 -0
  83. package/es/components/Datagrid/Datagrid.stories/CustomizeColumnStory.js +6 -0
  84. package/es/components/Datagrid/Datagrid.stories/LeftPanelStory.js +6 -0
  85. package/es/components/Datagrid/Datagrid.stories/RowSizeDropdownStory.js +6 -0
  86. package/es/components/Datagrid/Datagrid.stories/SelectAllWithToggleStory.js +6 -0
  87. package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +92 -0
  88. package/es/components/Datagrid/Datagrid.stories/common.js +199 -0
  89. package/es/components/Datagrid/Datagrid.stories/index.js +5 -0
  90. package/es/components/Datagrid/common-column-ids.js +8 -0
  91. package/es/components/Datagrid/index.js +22 -0
  92. package/es/components/Datagrid/useActionsColumn.js +86 -0
  93. package/es/components/Datagrid/useColumnRightAlign.js +52 -0
  94. package/es/components/Datagrid/useCustomizeColumns.js +45 -0
  95. package/es/components/Datagrid/useDatagrid.js +44 -0
  96. package/es/components/Datagrid/useDefaultStringRenderer.js +48 -0
  97. package/es/components/Datagrid/useDisableSelectRows.js +84 -0
  98. package/es/components/Datagrid/useExpandedRow.js +52 -0
  99. package/es/components/Datagrid/useFlexResize.js +51 -0
  100. package/es/components/Datagrid/useFloatingScroll.js +88 -0
  101. package/es/components/Datagrid/useInfiniteScroll.js +54 -0
  102. package/es/components/Datagrid/useNestedRows.js +53 -0
  103. package/es/components/Datagrid/useOnRowClick.js +37 -0
  104. package/es/components/Datagrid/useParentDimensions.js +65 -0
  105. package/es/components/Datagrid/useResizeTable.js +40 -0
  106. package/es/components/Datagrid/useRowExpander.js +34 -0
  107. package/es/components/Datagrid/useRowIsMouseOver.js +61 -0
  108. package/es/components/Datagrid/useRowRenderer.js +30 -0
  109. package/es/components/Datagrid/useRowSize.js +56 -0
  110. package/es/components/Datagrid/useSelectAllToggle.js +74 -0
  111. package/es/components/Datagrid/useSelectRows.js +107 -0
  112. package/es/components/Datagrid/useSkeletonRows.js +32 -0
  113. package/es/components/Datagrid/useSortableColumns.js +110 -0
  114. package/es/components/Datagrid/useStickyColumn.js +183 -0
  115. package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +2 -3
  116. package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +2 -3
  117. package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +2 -3
  118. package/es/components/ImportModal/ImportModal.js +2 -2
  119. package/es/components/TagSet/TagSet.js +12 -3
  120. package/es/components/UserProfileImage/UserProfileImage.js +38 -10
  121. package/es/components/index.js +2 -1
  122. package/es/global/js/package-settings.js +2 -1
  123. package/lib/components/ActionBar/ActionBar.js +3 -1
  124. package/lib/components/ActionBar/ActionBarOverflowItems.js +5 -3
  125. package/lib/components/AddSelect/AddSelect.js +132 -28
  126. package/lib/components/AddSelect/AddSelectColumn.js +0 -1
  127. package/lib/components/AddSelect/AddSelectFilter.js +147 -0
  128. package/lib/components/AddSelect/AddSelectList.js +61 -12
  129. package/lib/components/AddSelect/AddSelectSidebar.js +15 -11
  130. package/lib/components/AddSelect/add-select-utils.js +35 -2
  131. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -0
  132. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +267 -168
  133. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +191 -57
  134. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +67 -18
  135. package/lib/components/DataSpreadsheet/hooks/index.js +37 -0
  136. package/lib/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +123 -0
  137. package/lib/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +2 -4
  138. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +6 -5
  139. package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +3 -1
  140. package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +83 -7
  141. package/lib/components/Datagrid/Datagrid/Datagrid.js +86 -0
  142. package/lib/components/Datagrid/Datagrid/DatagridBody.js +50 -0
  143. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +31 -0
  144. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +38 -0
  145. package/lib/components/Datagrid/Datagrid/DatagridHead.js +43 -0
  146. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +73 -0
  147. package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +44 -0
  148. package/lib/components/Datagrid/Datagrid/DatagridRow.js +56 -0
  149. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +55 -0
  150. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +139 -0
  151. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +44 -0
  152. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +35 -0
  153. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +101 -0
  154. package/lib/components/Datagrid/Datagrid/DraggableElement.js +210 -0
  155. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +92 -0
  156. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +65 -0
  157. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +166 -0
  158. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +173 -0
  159. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +73 -0
  160. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +25 -0
  161. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +23 -0
  162. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +80 -0
  163. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +160 -0
  164. package/lib/components/Datagrid/Datagrid/addons/RowSize/index.js +15 -0
  165. package/lib/components/Datagrid/Datagrid/index.js +15 -0
  166. package/lib/components/Datagrid/Datagrid.stories/CustomizeColumnStory.js +13 -0
  167. package/lib/components/Datagrid/Datagrid.stories/LeftPanelStory.js +13 -0
  168. package/lib/components/Datagrid/Datagrid.stories/RowSizeDropdownStory.js +13 -0
  169. package/lib/components/Datagrid/Datagrid.stories/SelectAllWithToggleStory.js +13 -0
  170. package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +112 -0
  171. package/lib/components/Datagrid/Datagrid.stories/common.js +215 -0
  172. package/lib/components/Datagrid/Datagrid.stories/index.js +47 -0
  173. package/lib/components/Datagrid/common-column-ids.js +16 -0
  174. package/lib/components/Datagrid/index.js +127 -0
  175. package/lib/components/Datagrid/useActionsColumn.js +94 -0
  176. package/lib/components/Datagrid/useColumnRightAlign.js +59 -0
  177. package/lib/components/Datagrid/useCustomizeColumns.js +55 -0
  178. package/lib/components/Datagrid/useDatagrid.js +58 -0
  179. package/lib/components/Datagrid/useDefaultStringRenderer.js +54 -0
  180. package/lib/components/Datagrid/useDisableSelectRows.js +92 -0
  181. package/lib/components/Datagrid/useExpandedRow.js +58 -0
  182. package/lib/components/Datagrid/useFlexResize.js +61 -0
  183. package/lib/components/Datagrid/useFloatingScroll.js +101 -0
  184. package/lib/components/Datagrid/useInfiniteScroll.js +67 -0
  185. package/lib/components/Datagrid/useNestedRows.js +65 -0
  186. package/lib/components/Datagrid/useOnRowClick.js +45 -0
  187. package/lib/components/Datagrid/useParentDimensions.js +75 -0
  188. package/lib/components/Datagrid/useResizeTable.js +48 -0
  189. package/lib/components/Datagrid/useRowExpander.js +45 -0
  190. package/lib/components/Datagrid/useRowIsMouseOver.js +66 -0
  191. package/lib/components/Datagrid/useRowRenderer.js +40 -0
  192. package/lib/components/Datagrid/useRowSize.js +67 -0
  193. package/lib/components/Datagrid/useSelectAllToggle.js +88 -0
  194. package/lib/components/Datagrid/useSelectRows.js +119 -0
  195. package/lib/components/Datagrid/useSkeletonRows.js +42 -0
  196. package/lib/components/Datagrid/useSortableColumns.js +117 -0
  197. package/lib/components/Datagrid/useStickyColumn.js +190 -0
  198. package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +2 -3
  199. package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +2 -3
  200. package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +2 -3
  201. package/lib/components/ImportModal/ImportModal.js +1 -1
  202. package/lib/components/TagSet/TagSet.js +12 -3
  203. package/lib/components/UserProfileImage/UserProfileImage.js +38 -10
  204. package/lib/components/index.js +9 -1
  205. package/lib/global/js/package-settings.js +2 -1
  206. package/package.json +19 -15
  207. package/scss/components/AboutModal/_about-modal.scss +2 -2
  208. package/scss/components/ActionSet/_action-set.scss +3 -1
  209. package/scss/components/AddSelect/_add-select.scss +87 -3
  210. package/scss/components/CreateModal/_create-modal.scss +7 -5
  211. package/scss/components/CreateModal/_storybook-styles.scss +8 -7
  212. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +70 -10
  213. package/scss/components/Datagrid/_datagrid.scss +66 -0
  214. package/scss/components/Datagrid/_index.scss +8 -0
  215. package/scss/components/Datagrid/_storybook-styles.scss +26 -0
  216. package/scss/components/Datagrid/styles/_variables.scss +9 -0
  217. package/scss/components/Datagrid/styles/addons/CustomizeColumnsModal.scss +48 -0
  218. package/scss/components/Datagrid/styles/addons/RowSizeDropdown.scss +23 -0
  219. package/scss/components/Datagrid/styles/datagrid.scss +318 -0
  220. package/scss/components/Datagrid/styles/index.scss +17 -0
  221. package/scss/components/Datagrid/styles/useActionsColumn.scss +24 -0
  222. package/scss/components/Datagrid/styles/useColumnRightAlign.scss +29 -0
  223. package/scss/components/Datagrid/styles/useNestedRows.scss +17 -0
  224. package/scss/components/Datagrid/styles/useNestedTable.scss +28 -0
  225. package/scss/components/Datagrid/styles/useSelectAllToggle.scss +28 -0
  226. package/scss/components/Datagrid/styles/useSortableColumns.scss +55 -0
  227. package/scss/components/Datagrid/styles/useStickyColumn.scss +38 -0
  228. package/scss/components/ExportModal/_export-modal.scss +3 -3
  229. package/scss/components/HTTPErrors/_http-errors.scss +16 -16
  230. package/scss/components/InlineEdit/_inline-edit.scss +0 -1
  231. package/scss/components/ModifiedTabs/_modified-tabs.scss +0 -10
  232. package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -3
  233. package/scss/components/OptionsTile/_options-tile.scss +0 -1
  234. package/scss/components/PageHeader/_page-header.scss +4 -0
  235. package/scss/components/RemoveModal/_remove-modal.scss +3 -3
  236. package/scss/components/TagSet/_tag-set.scss +2 -1
  237. package/scss/components/Tearsheet/_tearsheet.scss +5 -2
  238. package/scss/components/_index.scss +1 -0
@@ -23,12 +23,16 @@ var _reactWindow = require("react-window");
23
23
 
24
24
  var _classnames = _interopRequireDefault(require("classnames"));
25
25
 
26
+ var _layout = require("@carbon/layout");
27
+
26
28
  var _settings = require("../../settings");
27
29
 
28
30
  var _deepCloneObject = require("../../global/js/utils/deepCloneObject");
29
31
 
30
32
  var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
31
33
 
34
+ var _hooks = require("../../global/js/hooks");
35
+
32
36
  var _removeCellSelections = require("./utils/removeCellSelections");
33
37
 
34
38
  var _createCellSelectionArea = require("./utils/createCellSelectionArea");
@@ -41,21 +45,24 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
41
45
 
42
46
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
43
47
 
44
- /**
45
- * Copyright IBM Corp. 2022, 2022
46
- *
47
- * This source code is licensed under the Apache-2.0 license found in the
48
- * LICENSE file in the root directory of this source tree.
49
- */
48
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
49
+
50
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
51
+
50
52
  var blockClass = "".concat(_settings.pkg.prefix, "--data-spreadsheet");
51
53
  var DataSpreadsheetBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
52
54
  var columns = _ref.columns,
53
55
  activeCellCoordinates = _ref.activeCellCoordinates,
54
56
  defaultColumn = _ref.defaultColumn,
57
+ defaultEmptyRowCount = _ref.defaultEmptyRowCount,
55
58
  getTableBodyProps = _ref.getTableBodyProps,
59
+ headerGroups = _ref.headerGroups,
56
60
  id = _ref.id,
61
+ onDataUpdate = _ref.onDataUpdate,
57
62
  prepareRow = _ref.prepareRow,
58
63
  rows = _ref.rows,
64
+ selectionAreaData = _ref.selectionAreaData,
65
+ setSelectionAreaData = _ref.setSelectionAreaData,
59
66
  setActiveCellCoordinates = _ref.setActiveCellCoordinates,
60
67
  selectionAreas = _ref.selectionAreas,
61
68
  setContainerHasFocus = _ref.setContainerHasFocus,
@@ -65,24 +72,64 @@ var DataSpreadsheetBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
65
72
  clickAndHoldActive = _ref.clickAndHoldActive,
66
73
  setClickAndHoldActive = _ref.setClickAndHoldActive,
67
74
  currentMatcher = _ref.currentMatcher,
68
- setCurrentMatcher = _ref.setCurrentMatcher;
69
- // Create cell selection areas based on selectionAreas array
75
+ setCurrentMatcher = _ref.setCurrentMatcher,
76
+ onSelectionAreaChange = _ref.onSelectionAreaChange;
77
+ var previousState = (0, _hooks.usePreviousValue)({
78
+ selectionAreaData: selectionAreaData,
79
+ clickAndHoldActive: clickAndHoldActive
80
+ }); // Set custom css property containing the spreadsheet total width
81
+
82
+ (0, _react.useEffect)(function () {
83
+ ref === null || ref === void 0 ? void 0 : ref.current.style.setProperty("--".concat(blockClass, "--total-width"), (0, _layout.px)(totalColumnsWidth + scrollBarSize));
84
+ }, [ref, scrollBarSize, totalColumnsWidth]); // Call the `onSelectionAreaChange` handler to send selection area data
85
+ // back to the consumer
86
+
87
+ (0, _react.useEffect)(function () {
88
+ if (selectionAreaData.length) {
89
+ var _previousState$select;
90
+
91
+ if (!clickAndHoldActive && previousState !== null && previousState !== void 0 && previousState.clickAndHoldActive || (previousState === null || previousState === void 0 ? 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)) {
92
+ onSelectionAreaChange(selectionAreaData);
93
+ }
94
+ }
95
+ }, [previousState === null || previousState === void 0 ? void 0 : previousState.selectionAreaData, selectionAreaData, onSelectionAreaChange, clickAndHoldActive, previousState === null || previousState === void 0 ? void 0 : previousState.clickAndHoldActive]); // Create cell selection areas based on selectionAreas array
96
+
70
97
  (0, _react.useEffect)(function () {
71
98
  if (selectionAreas && selectionAreas.length) {
72
99
  selectionAreas.map(function (area) {
73
- if (!area.areaCreated && area.point1 && area.point2 && area.matcher) {
74
- // Do not create a cell selection area if point1 and point2 have the same values
75
- // Cell selections must have two distinctly different points for an area to be created
76
- if (area.point1.row === area.point2.row && area.point1.column === area.point2.column) {
77
- var selectionAreasClone = (0, _deepCloneObject.deepCloneObject)(selectionAreas);
78
- var indexOfCurrentArea = selectionAreasClone.findIndex(function (item) {
79
- return item.matcher === area.matcher;
100
+ // Setup selection area data that will be sent back to consumer via onSelectionAreaChange prop
101
+ if (area.areaCreated) {
102
+ var rowStart = Math.min(area.point1.row, area.point2.row);
103
+ var rowEnd = Math.max(area.point1.row, area.point2.row);
104
+ var columnStart = Math.min(area.point1.column, area.point2.column);
105
+ var columnEnd = Math.max(area.point1.column, area.point2.column);
106
+ var selectionData = {
107
+ rows: {
108
+ start: rowStart,
109
+ end: rowEnd
110
+ },
111
+ columns: {
112
+ start: columnStart,
113
+ end: columnEnd
114
+ },
115
+ cells: populateSelectionAreaCellData({
116
+ rowStart: rowStart,
117
+ rowEnd: rowEnd,
118
+ columnStart: columnStart,
119
+ columnEnd: columnEnd
120
+ }),
121
+ selectionId: area.matcher
122
+ };
123
+ setSelectionAreaData(function (prev) {
124
+ var prevValues = (0, _deepCloneObject.deepCloneObject)(prev);
125
+ var newAreaData = prevValues.filter(function (item) {
126
+ return item.selectionId !== area.matcher;
80
127
  });
81
- selectionAreasClone[indexOfCurrentArea].areaCreated = false;
82
- selectionAreasClone[indexOfCurrentArea].point2 = null;
83
- return setSelectionAreas(selectionAreasClone);
84
- }
128
+ return [].concat((0, _toConsumableArray2.default)(newAreaData), [selectionData]);
129
+ });
130
+ }
85
131
 
132
+ if (!area.areaCreated && area.point1 && area.point2 && area.matcher) {
86
133
  (0, _createCellSelectionArea.createCellSelectionArea)({
87
134
  area: area,
88
135
  blockClass: blockClass,
@@ -95,7 +142,24 @@ var DataSpreadsheetBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
95
142
  return;
96
143
  });
97
144
  }
98
- }, [selectionAreas, setSelectionAreas, defaultColumn]); // Mouse up
145
+ }, [selectionAreas, setSelectionAreas, defaultColumn, onSelectionAreaChange, setSelectionAreaData]);
146
+
147
+ var populateSelectionAreaCellData = function populateSelectionAreaCellData(_ref2) {
148
+ var rowStart = _ref2.rowStart,
149
+ rowEnd = _ref2.rowEnd,
150
+ columnStart = _ref2.columnStart,
151
+ columnEnd = _ref2.columnEnd;
152
+ var cellContainer = [];
153
+
154
+ for (var rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {
155
+ for (var columnIndex = columnStart; columnIndex <= columnEnd; columnIndex++) {
156
+ cellContainer.push([rowIndex, columnIndex]);
157
+ }
158
+ }
159
+
160
+ return cellContainer;
161
+ }; // Mouse up
162
+
99
163
 
100
164
  (0, _react.useEffect)(function () {
101
165
  var handleMouseUp = function handleMouseUp(event) {
@@ -196,9 +260,10 @@ var DataSpreadsheetBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
196
260
  matcher: tempMatcher
197
261
  }]);
198
262
  setCurrentMatcher(tempMatcher);
263
+ setSelectionAreaData([]);
199
264
  }
200
265
  };
201
- }, [currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref]);
266
+ }, [currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData]);
202
267
  var handleBodyCellHover = (0, _react.useCallback)(function (cell, columnIndex) {
203
268
  return function () {
204
269
  if (clickAndHoldActive) {
@@ -241,45 +306,84 @@ var DataSpreadsheetBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
241
306
  setCurrentMatcher: setCurrentMatcher,
242
307
  setSelectionAreas: setSelectionAreas,
243
308
  spreadsheetRef: ref,
244
- index: index
309
+ index: index,
310
+ setSelectionAreaData: setSelectionAreaData
245
311
  });
246
312
  };
247
- }, [columns, ref, setSelectionAreas, setCurrentMatcher, setActiveCellCoordinates, activeCellCoordinates, rows]); // Renders each row/cell in the spreadsheet body
313
+ }, [columns, ref, setSelectionAreas, setCurrentMatcher, setActiveCellCoordinates, activeCellCoordinates, rows, setSelectionAreaData]); // Builds the empty rows and calls `onDataUpdate` to set the new empty rows
314
+ // using defaultEmptyRowCount to determine how many empty rows are created.
315
+
316
+ (0, _react.useEffect)(function () {
317
+ if (!(rows !== null && rows !== void 0 && rows.length)) {
318
+ var buildEmptyRows = function buildEmptyRows() {
319
+ var emptyRowData = [];
320
+ (0, _toConsumableArray2.default)(Array(defaultEmptyRowCount)).map(function () {
321
+ var _headerGroups$;
322
+
323
+ var emptyCell = {};
324
+ (_headerGroups$ = headerGroups[0]) === null || _headerGroups$ === void 0 ? void 0 : _headerGroups$.headers.map(function (header) {
325
+ emptyCell[header.id] = null;
326
+ });
327
+ emptyRowData.push(emptyCell);
328
+ });
329
+ onDataUpdate(emptyRowData);
330
+ };
248
331
 
249
- var RenderRow = (0, _react.useCallback)(function (_ref2) {
250
- var index = _ref2.index,
251
- style = _ref2.style;
332
+ buildEmptyRows();
333
+ }
334
+ }, [rows, headerGroups, defaultEmptyRowCount, onDataUpdate]);
335
+
336
+ var RenderEmptyRows = function RenderEmptyRows() {
337
+ return /*#__PURE__*/_react.default.createElement("div", null);
338
+ }; // Renders each row/cell in the spreadsheet body
339
+
340
+
341
+ var RenderRow = (0, _react.useCallback)(function (_ref3) {
342
+ var index = _ref3.index,
343
+ style = _ref3.style;
252
344
  var row = rows[index];
253
- prepareRow(row);
254
- return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, row.getRowProps({
255
- style: style
256
- }), {
257
- className: (0, _classnames.default)("".concat(blockClass, "__tr")),
258
- "data-row-index": index
259
- }), /*#__PURE__*/_react.default.createElement("button", {
260
- tabIndex: -1,
261
- "data-row-index": index,
262
- "data-column-index": "header",
263
- type: "button",
264
- onClick: handleRowHeaderClick(index),
265
- className: (0, _classnames.default)("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__td-th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || (0, _checkActiveHeaderCell.checkActiveHeaderCell)(index, selectionAreas, 'row'))),
266
- style: {
267
- width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
268
- }
269
- }, index + 1), row.cells.map(function (cell, index) {
270
- return /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({
345
+
346
+ if (rows && rows.length) {
347
+ prepareRow(row);
348
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, row.getRowProps({
349
+ style: style
350
+ }), {
351
+ className: (0, _classnames.default)("".concat(blockClass, "__tr")),
352
+ "data-row-index": index,
353
+ "aria-rowindex": index
354
+ }), /*#__PURE__*/_react.default.createElement("div", {
355
+ role: "rowheader"
356
+ }, /*#__PURE__*/_react.default.createElement("button", {
271
357
  tabIndex: -1,
272
- "data-row-index": cell.row.index,
273
- "data-column-index": index
274
- }, cell.getCellProps(), {
275
- className: (0, _classnames.default)("".concat(blockClass, "__td"), "".concat(blockClass, "__body--td"), "".concat(blockClass, "--interactive-cell-element")),
276
- key: "cell_".concat(index),
277
- onMouseDown: handleBodyCellClick(cell, index),
278
- onMouseOver: handleBodyCellHover(cell, index),
279
- onFocus: function onFocus() {},
280
- type: "button"
281
- }), cell.render('Cell'));
282
- }));
358
+ "data-row-index": index,
359
+ "data-column-index": "header",
360
+ type: "button",
361
+ onClick: handleRowHeaderClick(index),
362
+ className: (0, _classnames.default)("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__td-th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || (0, _checkActiveHeaderCell.checkActiveHeaderCell)(index, selectionAreas, 'row'))),
363
+ style: {
364
+ width: (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth) - 4
365
+ }
366
+ }, index + 1)), row.cells.map(function (cell, index) {
367
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
368
+ key: "cell_".concat(index),
369
+ "aria-colindex": index
370
+ }, cell.getCellProps(), {
371
+ role: "gridcell",
372
+ style: _objectSpread(_objectSpread({}, cell.getCellProps().style), {}, {
373
+ display: 'grid'
374
+ })
375
+ }), /*#__PURE__*/_react.default.createElement("button", {
376
+ tabIndex: -1,
377
+ "data-row-index": cell.row.index,
378
+ "data-column-index": index,
379
+ className: (0, _classnames.default)("".concat(blockClass, "__td"), "".concat(blockClass, "__body--td"), "".concat(blockClass, "--interactive-cell-element")),
380
+ onMouseDown: handleBodyCellClick(cell, index),
381
+ onMouseOver: handleBodyCellHover(cell, index),
382
+ onFocus: function onFocus() {},
383
+ type: "button"
384
+ }, cell.render('Cell')));
385
+ }));
386
+ }
283
387
  }, [prepareRow, rows, defaultColumn.rowHeaderWidth, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClick, handleBodyCellClick, handleBodyCellHover]);
284
388
  var spreadsheetBodyRef = (0, _react.useRef)();
285
389
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
@@ -288,10 +392,10 @@ var DataSpreadsheetBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
288
392
  }, getTableBodyProps()), /*#__PURE__*/_react.default.createElement(_reactWindow.FixedSizeList, {
289
393
  className: (0, _classnames.default)("".concat(blockClass, "__list--container"), "".concat(blockClass, "__list--container--").concat(id)),
290
394
  height: 400,
291
- itemCount: rows.length,
395
+ itemCount: rows.length || defaultEmptyRowCount,
292
396
  itemSize: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight,
293
397
  width: totalColumnsWidth + scrollBarSize
294
- }, RenderRow));
398
+ }, rows !== null && rows !== void 0 && rows.length ? RenderRow : RenderEmptyRows));
295
399
  });
296
400
  exports.DataSpreadsheetBody = DataSpreadsheetBody;
297
401
  DataSpreadsheetBody.propTypes = {
@@ -327,11 +431,21 @@ DataSpreadsheetBody.propTypes = {
327
431
  width: _propTypes.default.number
328
432
  }),
329
433
 
434
+ /**
435
+ * Sets the number of empty rows to be created when there is no data provided
436
+ */
437
+ defaultEmptyRowCount: _propTypes.default.number,
438
+
330
439
  /**
331
440
  * Function to set table body prop values
332
441
  */
333
442
  getTableBodyProps: _propTypes.default.func,
334
443
 
444
+ /**
445
+ * Headers provided from useTable hook
446
+ */
447
+ headerGroups: _propTypes.default.arrayOf(_propTypes.default.object),
448
+
335
449
  /**
336
450
  * The spreadsheet id
337
451
  */
@@ -342,6 +456,16 @@ DataSpreadsheetBody.propTypes = {
342
456
  */
343
457
  onActiveCellChange: _propTypes.default.func,
344
458
 
459
+ /**
460
+ * The event handler that is called to set the rows for the empty spreadsheet
461
+ */
462
+ onDataUpdate: _propTypes.default.func,
463
+
464
+ /**
465
+ * The event handler that is called when the selection areas change
466
+ */
467
+ onSelectionAreaChange: _propTypes.default.func,
468
+
345
469
  /**
346
470
  * Prepare row function from react-table
347
471
  */
@@ -357,6 +481,11 @@ DataSpreadsheetBody.propTypes = {
357
481
  */
358
482
  scrollBarSize: _propTypes.default.number,
359
483
 
484
+ /**
485
+ * Array of selection area data
486
+ */
487
+ selectionAreaData: _propTypes.default.array,
488
+
360
489
  /**
361
490
  * Array of selection areas
362
491
  */
@@ -382,6 +511,11 @@ DataSpreadsheetBody.propTypes = {
382
511
  */
383
512
  setCurrentMatcher: _propTypes.default.func,
384
513
 
514
+ /**
515
+ * Setter fn for selectionAreaData state value
516
+ */
517
+ setSelectionAreaData: _propTypes.default.func,
518
+
385
519
  /**
386
520
  * Setter fn for selectionAreas state value
387
521
  */
@@ -13,40 +13,66 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
13
13
 
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
 
16
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
+
16
18
  var _react = _interopRequireWildcard(require("react"));
17
19
 
18
20
  var _propTypes = _interopRequireDefault(require("prop-types"));
19
21
 
20
22
  var _classnames = _interopRequireDefault(require("classnames"));
21
23
 
24
+ var _layout = require("@carbon/layout");
25
+
22
26
  var _settings = require("../../settings");
23
27
 
24
28
  var _checkActiveHeaderCell = require("./utils/checkActiveHeaderCell");
25
29
 
26
30
  var _handleHeaderCellSelection = require("./utils/handleHeaderCellSelection");
27
31
 
32
+ var _hooks = require("../../global/js/hooks");
33
+
28
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
35
 
30
36
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
37
 
32
- /**
33
- * Copyright IBM Corp. 2022, 2022
34
- *
35
- * This source code is licensed under the Apache-2.0 license found in the
36
- * LICENSE file in the root directory of this source tree.
37
- */
38
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
39
+
40
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
41
+
38
42
  var blockClass = "".concat(_settings.pkg.prefix, "--data-spreadsheet");
39
43
  var DataSpreadsheetHeader = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
40
44
  var activeCellCoordinates = _ref.activeCellCoordinates,
45
+ cellSize = _ref.cellSize,
41
46
  columns = _ref.columns,
42
47
  defaultColumn = _ref.defaultColumn,
43
48
  headerGroups = _ref.headerGroups,
49
+ scrollBarSize = _ref.scrollBarSize,
44
50
  selectionAreas = _ref.selectionAreas,
45
51
  setActiveCellCoordinates = _ref.setActiveCellCoordinates,
46
52
  setCurrentMatcher = _ref.setCurrentMatcher,
47
53
  setSelectionAreas = _ref.setSelectionAreas,
54
+ setSelectionAreaData = _ref.setSelectionAreaData,
48
55
  rows = _ref.rows;
49
56
 
57
+ var _useState = (0, _react.useState)(0),
58
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
59
+ scrollBarSizeValue = _useState2[0],
60
+ setScrollBarSizeValue = _useState2[1];
61
+
62
+ var previousState = (0, _hooks.usePreviousValue)({
63
+ cellSize: cellSize
64
+ });
65
+ (0, _react.useEffect)(function () {
66
+ if ((previousState === null || previousState === void 0 ? void 0 : previousState.cellSize) !== cellSize) {
67
+ var _ref$current;
68
+
69
+ var scrollContainer = ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector(".".concat(blockClass, "__list--container"));
70
+ var hasScrollBar = (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.scrollHeight) > (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.clientHeight);
71
+ var scrollBarValue = hasScrollBar ? 0 : scrollBarSize;
72
+ setScrollBarSizeValue(scrollBarValue);
73
+ }
74
+ }, [cellSize, ref, scrollBarSize, previousState === null || previousState === void 0 ? void 0 : previousState.cellSize]);
75
+
50
76
  var handleColumnHeaderClick = function handleColumnHeaderClick(index) {
51
77
  return function () {
52
78
  (0, _handleHeaderCellSelection.handleHeaderCellSelection)({
@@ -58,7 +84,8 @@ var DataSpreadsheetHeader = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
58
84
  setCurrentMatcher: setCurrentMatcher,
59
85
  setSelectionAreas: setSelectionAreas,
60
86
  spreadsheetRef: ref,
61
- index: index
87
+ index: index,
88
+ setSelectionAreaData: setSelectionAreaData
62
89
  });
63
90
  };
64
91
  };
@@ -69,31 +96,38 @@ var DataSpreadsheetHeader = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
69
96
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
70
97
  key: "header_".concat(index)
71
98
  }, headerGroup.getHeaderGroupProps(), {
99
+ style: _objectSpread(_objectSpread({}, headerGroup.getHeaderGroupProps().style), {}, {
100
+ width: (0, _layout.px)(parseInt(headerGroup.getHeaderGroupProps().style.width) + scrollBarSizeValue)
101
+ }),
72
102
  className: "".concat(blockClass, "__tr")
73
- }), /*#__PURE__*/_react.default.createElement("button", {
103
+ }), /*#__PURE__*/_react.default.createElement("div", {
104
+ role: "columnheader",
105
+ style: {
106
+ width: (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth) - 4,
107
+ height: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight
108
+ }
109
+ }, /*#__PURE__*/_react.default.createElement("button", {
74
110
  "data-row-index": "header",
75
111
  "data-column-index": "header",
76
112
  type: "button",
77
113
  tabIndex: -1,
78
- className: (0, _classnames.default)("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header')),
79
- style: {
80
- width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth,
81
- height: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight
82
- }
83
- }, "\xA0"), headerGroup.headers.map(function (column, index) {
84
- return /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({
114
+ className: (0, _classnames.default)("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__th--select-all"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header'))
115
+ }, "\xA0")), headerGroup.headers.map(function (column, index) {
116
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
85
117
  key: "column_".concat(index),
118
+ role: "columnheader",
119
+ className: "".concat(blockClass, "__columnheader")
120
+ }, column.getHeaderProps()), /*#__PURE__*/_react.default.createElement("button", {
86
121
  "data-row-index": "header",
87
122
  "data-column-index": index,
88
123
  tabIndex: -1,
89
124
  onClick: handleColumnHeaderClick(index),
90
125
  style: {
91
126
  height: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight
92
- }
93
- }, column.getHeaderProps(), {
127
+ },
94
128
  className: (0, _classnames.default)("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === index || (0, _checkActiveHeaderCell.checkActiveHeaderCell)(index, selectionAreas, 'column'))),
95
129
  type: "button"
96
- }), column.render('Header'));
130
+ }, column.render('Header')));
97
131
  }));
98
132
  }));
99
133
  });
@@ -107,6 +141,11 @@ DataSpreadsheetHeader.propTypes = {
107
141
  column: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
108
142
  }),
109
143
 
144
+ /**
145
+ * Specifies the cell height
146
+ */
147
+ cellSize: _propTypes.default.oneOf(['compact', 'standard', 'medium', 'large']),
148
+
110
149
  /**
111
150
  * All of the spreadsheet columns
112
151
  */
@@ -131,6 +170,11 @@ DataSpreadsheetHeader.propTypes = {
131
170
  */
132
171
  rows: _propTypes.default.arrayOf(_propTypes.default.object),
133
172
 
173
+ /**
174
+ * The scrollbar width
175
+ */
176
+ scrollBarSize: _propTypes.default.number,
177
+
134
178
  /**
135
179
  * All of the cell selection area items
136
180
  */
@@ -146,6 +190,11 @@ DataSpreadsheetHeader.propTypes = {
146
190
  */
147
191
  setCurrentMatcher: _propTypes.default.func,
148
192
 
193
+ /**
194
+ * Setter fn for selectionAreaData state value
195
+ */
196
+ setSelectionAreaData: _propTypes.default.func,
197
+
149
198
  /**
150
199
  * Setter fn for selectionAreas value
151
200
  */
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "useMoveActiveCell", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _useMoveActiveCell.useMoveActiveCell;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "useMultipleKeyTracking", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _useMultipleKeyTracking.useMultipleKeyTracking;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "useResetSpreadsheetFocus", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _useResetSpreadsheetFocus.useResetSpreadsheetFocus;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "useSpreadsheetOutsideClick", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _useSpreadsheetOutsideClick.useSpreadsheetOutsideClick;
28
+ }
29
+ });
30
+
31
+ var _useMoveActiveCell = require("./useMoveActiveCell");
32
+
33
+ var _useMultipleKeyTracking = require("./useMultipleKeyTracking");
34
+
35
+ var _useResetSpreadsheetFocus = require("./useResetSpreadsheetFocus");
36
+
37
+ var _useSpreadsheetOutsideClick = require("./useSpreadsheetOutsideClick");