@carbon/ibm-products 1.12.0 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. package/css/components/Datagrid/styles/addons/CustomizeColumnsModal.css +47 -0
  2. package/css/components/Datagrid/styles/addons/CustomizeColumnsModal.css.map +1 -0
  3. package/css/components/Datagrid/styles/addons/RowSizeDropdown.css +20 -0
  4. package/css/components/Datagrid/styles/addons/RowSizeDropdown.css.map +1 -0
  5. package/css/components/Datagrid/styles/datagrid.css +264 -0
  6. package/css/components/Datagrid/styles/datagrid.css.map +1 -0
  7. package/css/components/Datagrid/styles/index.css +509 -0
  8. package/css/components/Datagrid/styles/index.css.map +1 -0
  9. package/css/components/Datagrid/styles/useActionsColumn.css +23 -0
  10. package/css/components/Datagrid/styles/useActionsColumn.css.map +1 -0
  11. package/css/components/Datagrid/styles/useColumnRightAlign.css +28 -0
  12. package/css/components/Datagrid/styles/useColumnRightAlign.css.map +1 -0
  13. package/css/components/Datagrid/styles/useNestedRows.css +15 -0
  14. package/css/components/Datagrid/styles/useNestedRows.css.map +1 -0
  15. package/css/components/Datagrid/styles/useNestedTable.css +25 -0
  16. package/css/components/Datagrid/styles/useNestedTable.css.map +1 -0
  17. package/css/components/Datagrid/styles/useSelectAllToggle.css +28 -0
  18. package/css/components/Datagrid/styles/useSelectAllToggle.css.map +1 -0
  19. package/css/components/Datagrid/styles/useSortableColumns.css +50 -0
  20. package/css/components/Datagrid/styles/useSortableColumns.css.map +1 -0
  21. package/css/components/Datagrid/styles/useStickyColumn.css +35 -0
  22. package/css/components/Datagrid/styles/useStickyColumn.css.map +1 -0
  23. package/css/index-full-carbon.css +653 -21
  24. package/css/index-full-carbon.css.map +1 -1
  25. package/css/index-full-carbon.min.css +6 -6
  26. package/css/index-full-carbon.min.css.map +1 -1
  27. package/css/index-without-carbon-released-only.css +21 -10
  28. package/css/index-without-carbon-released-only.css.map +1 -1
  29. package/css/index-without-carbon-released-only.min.css +2 -2
  30. package/css/index-without-carbon-released-only.min.css.map +1 -1
  31. package/css/index-without-carbon.css +653 -21
  32. package/css/index-without-carbon.css.map +1 -1
  33. package/css/index-without-carbon.min.css +5 -5
  34. package/css/index-without-carbon.min.css.map +1 -1
  35. package/css/index.css +653 -21
  36. package/css/index.css.map +1 -1
  37. package/css/index.min.css +6 -6
  38. package/css/index.min.css.map +1 -1
  39. package/es/components/ActionBar/ActionBar.js +3 -1
  40. package/es/components/ActionBar/ActionBarOverflowItems.js +5 -3
  41. package/es/components/AddSelect/AddSelect.js +98 -40
  42. package/es/components/AddSelect/AddSelectFilter.js +129 -0
  43. package/es/components/AddSelect/AddSelectList.js +27 -1
  44. package/es/components/AddSelect/AddSelectSidebar.js +15 -5
  45. package/es/components/AddSelect/add-select-utils.js +30 -0
  46. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -0
  47. package/es/components/DataSpreadsheet/DataSpreadsheet.js +269 -142
  48. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +122 -39
  49. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +46 -17
  50. package/es/components/DataSpreadsheet/hooks/index.js +11 -0
  51. package/es/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +139 -0
  52. package/es/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +2 -4
  53. package/es/components/DataSpreadsheet/hooks/useSpreadsheetEdit.js +68 -0
  54. package/es/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +6 -6
  55. package/es/components/DataSpreadsheet/utils/createCellSelectionArea.js +20 -8
  56. package/es/components/DataSpreadsheet/utils/getSelectionAreaPoints.js +18 -0
  57. package/es/components/DataSpreadsheet/utils/handleActiveCellInSelectionEnter.js +121 -0
  58. package/es/components/DataSpreadsheet/utils/handleActiveCellInSelectionTab.js +108 -0
  59. package/es/components/DataSpreadsheet/utils/handleEditSubmit.js +87 -0
  60. package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +42 -8
  61. package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +225 -13
  62. package/es/components/DataSpreadsheet/utils/selectAllCells.js +53 -0
  63. package/es/components/Datagrid/Datagrid/Datagrid.js +70 -0
  64. package/es/components/Datagrid/Datagrid/DatagridBody.js +36 -0
  65. package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +19 -0
  66. package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +26 -0
  67. package/es/components/Datagrid/Datagrid/DatagridHead.js +31 -0
  68. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +57 -0
  69. package/es/components/Datagrid/Datagrid/DatagridRefBody.js +37 -0
  70. package/es/components/Datagrid/Datagrid/DatagridRow.js +50 -0
  71. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +50 -0
  72. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +122 -0
  73. package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +36 -0
  74. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +22 -0
  75. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +87 -0
  76. package/es/components/Datagrid/Datagrid/DraggableElement.js +188 -0
  77. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +78 -0
  78. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +51 -0
  79. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +140 -0
  80. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +157 -0
  81. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +62 -0
  82. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +13 -0
  83. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +9 -0
  84. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +62 -0
  85. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +139 -0
  86. package/es/components/Datagrid/Datagrid/addons/RowSize/index.js +8 -0
  87. package/es/components/Datagrid/Datagrid/index.js +8 -0
  88. package/es/components/Datagrid/Datagrid.stories/CustomizeColumnStory.js +6 -0
  89. package/es/components/Datagrid/Datagrid.stories/LeftPanelStory.js +6 -0
  90. package/es/components/Datagrid/Datagrid.stories/RowSizeDropdownStory.js +6 -0
  91. package/es/components/Datagrid/Datagrid.stories/SelectAllWithToggleStory.js +6 -0
  92. package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +92 -0
  93. package/es/components/Datagrid/Datagrid.stories/common.js +199 -0
  94. package/es/components/Datagrid/Datagrid.stories/index.js +5 -0
  95. package/es/components/Datagrid/common-column-ids.js +8 -0
  96. package/es/components/Datagrid/index.js +22 -0
  97. package/es/components/Datagrid/useActionsColumn.js +86 -0
  98. package/es/components/Datagrid/useColumnRightAlign.js +52 -0
  99. package/es/components/Datagrid/useCustomizeColumns.js +45 -0
  100. package/es/components/Datagrid/useDatagrid.js +44 -0
  101. package/es/components/Datagrid/useDefaultStringRenderer.js +48 -0
  102. package/es/components/Datagrid/useDisableSelectRows.js +84 -0
  103. package/es/components/Datagrid/useExpandedRow.js +52 -0
  104. package/es/components/Datagrid/useFlexResize.js +51 -0
  105. package/es/components/Datagrid/useFloatingScroll.js +88 -0
  106. package/es/components/Datagrid/useInfiniteScroll.js +54 -0
  107. package/es/components/Datagrid/useNestedRows.js +53 -0
  108. package/es/components/Datagrid/useOnRowClick.js +37 -0
  109. package/es/components/Datagrid/useParentDimensions.js +65 -0
  110. package/es/components/Datagrid/useResizeTable.js +40 -0
  111. package/es/components/Datagrid/useRowExpander.js +34 -0
  112. package/es/components/Datagrid/useRowIsMouseOver.js +61 -0
  113. package/es/components/Datagrid/useRowRenderer.js +30 -0
  114. package/es/components/Datagrid/useRowSize.js +56 -0
  115. package/es/components/Datagrid/useSelectAllToggle.js +74 -0
  116. package/es/components/Datagrid/useSelectRows.js +107 -0
  117. package/es/components/Datagrid/useSkeletonRows.js +32 -0
  118. package/es/components/Datagrid/useSortableColumns.js +110 -0
  119. package/es/components/Datagrid/useStickyColumn.js +183 -0
  120. package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +2 -3
  121. package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +2 -3
  122. package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +2 -3
  123. package/es/components/MultiAddSelect/MultiAddSelect.js +150 -3
  124. package/es/components/PageHeader/PageHeader.js +3 -1
  125. package/es/components/SingleAddSelect/SingleAddSelect.js +90 -4
  126. package/es/components/TagSet/TagSet.js +22 -6
  127. package/es/components/Tearsheet/TearsheetShell.js +34 -10
  128. package/es/components/UserProfileImage/UserProfileImage.js +37 -9
  129. package/es/components/index.js +2 -1
  130. package/es/global/js/package-settings.js +4 -2
  131. package/lib/components/ActionBar/ActionBar.js +3 -1
  132. package/lib/components/ActionBar/ActionBarOverflowItems.js +5 -3
  133. package/lib/components/AddSelect/AddSelect.js +97 -38
  134. package/lib/components/AddSelect/AddSelectFilter.js +147 -0
  135. package/lib/components/AddSelect/AddSelectList.js +28 -1
  136. package/lib/components/AddSelect/AddSelectSidebar.js +15 -11
  137. package/lib/components/AddSelect/add-select-utils.js +35 -2
  138. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -0
  139. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +279 -145
  140. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +121 -45
  141. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +47 -17
  142. package/lib/components/DataSpreadsheet/hooks/index.js +45 -0
  143. package/lib/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +151 -0
  144. package/lib/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +2 -4
  145. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetEdit.js +79 -0
  146. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +6 -5
  147. package/lib/components/DataSpreadsheet/utils/createCellSelectionArea.js +21 -8
  148. package/lib/components/DataSpreadsheet/utils/getSelectionAreaPoints.js +27 -0
  149. package/lib/components/DataSpreadsheet/utils/handleActiveCellInSelectionEnter.js +127 -0
  150. package/lib/components/DataSpreadsheet/utils/handleActiveCellInSelectionTab.js +118 -0
  151. package/lib/components/DataSpreadsheet/utils/handleEditSubmit.js +94 -0
  152. package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +44 -8
  153. package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +235 -20
  154. package/lib/components/DataSpreadsheet/utils/selectAllCells.js +60 -0
  155. package/lib/components/Datagrid/Datagrid/Datagrid.js +86 -0
  156. package/lib/components/Datagrid/Datagrid/DatagridBody.js +50 -0
  157. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +31 -0
  158. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +38 -0
  159. package/lib/components/Datagrid/Datagrid/DatagridHead.js +43 -0
  160. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +73 -0
  161. package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +44 -0
  162. package/lib/components/Datagrid/Datagrid/DatagridRow.js +56 -0
  163. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +55 -0
  164. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +139 -0
  165. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +44 -0
  166. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +35 -0
  167. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +101 -0
  168. package/lib/components/Datagrid/Datagrid/DraggableElement.js +210 -0
  169. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +92 -0
  170. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +65 -0
  171. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +166 -0
  172. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +173 -0
  173. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +73 -0
  174. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +25 -0
  175. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +23 -0
  176. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +80 -0
  177. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +160 -0
  178. package/lib/components/Datagrid/Datagrid/addons/RowSize/index.js +15 -0
  179. package/lib/components/Datagrid/Datagrid/index.js +15 -0
  180. package/lib/components/Datagrid/Datagrid.stories/CustomizeColumnStory.js +13 -0
  181. package/lib/components/Datagrid/Datagrid.stories/LeftPanelStory.js +13 -0
  182. package/lib/components/Datagrid/Datagrid.stories/RowSizeDropdownStory.js +13 -0
  183. package/lib/components/Datagrid/Datagrid.stories/SelectAllWithToggleStory.js +13 -0
  184. package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +112 -0
  185. package/lib/components/Datagrid/Datagrid.stories/common.js +215 -0
  186. package/lib/components/Datagrid/Datagrid.stories/index.js +47 -0
  187. package/lib/components/Datagrid/common-column-ids.js +16 -0
  188. package/lib/components/Datagrid/index.js +127 -0
  189. package/lib/components/Datagrid/useActionsColumn.js +94 -0
  190. package/lib/components/Datagrid/useColumnRightAlign.js +59 -0
  191. package/lib/components/Datagrid/useCustomizeColumns.js +55 -0
  192. package/lib/components/Datagrid/useDatagrid.js +58 -0
  193. package/lib/components/Datagrid/useDefaultStringRenderer.js +54 -0
  194. package/lib/components/Datagrid/useDisableSelectRows.js +92 -0
  195. package/lib/components/Datagrid/useExpandedRow.js +58 -0
  196. package/lib/components/Datagrid/useFlexResize.js +61 -0
  197. package/lib/components/Datagrid/useFloatingScroll.js +101 -0
  198. package/lib/components/Datagrid/useInfiniteScroll.js +67 -0
  199. package/lib/components/Datagrid/useNestedRows.js +65 -0
  200. package/lib/components/Datagrid/useOnRowClick.js +45 -0
  201. package/lib/components/Datagrid/useParentDimensions.js +75 -0
  202. package/lib/components/Datagrid/useResizeTable.js +48 -0
  203. package/lib/components/Datagrid/useRowExpander.js +45 -0
  204. package/lib/components/Datagrid/useRowIsMouseOver.js +66 -0
  205. package/lib/components/Datagrid/useRowRenderer.js +40 -0
  206. package/lib/components/Datagrid/useRowSize.js +67 -0
  207. package/lib/components/Datagrid/useSelectAllToggle.js +88 -0
  208. package/lib/components/Datagrid/useSelectRows.js +119 -0
  209. package/lib/components/Datagrid/useSkeletonRows.js +42 -0
  210. package/lib/components/Datagrid/useSortableColumns.js +117 -0
  211. package/lib/components/Datagrid/useStickyColumn.js +190 -0
  212. package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +2 -3
  213. package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +2 -3
  214. package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +2 -3
  215. package/lib/components/MultiAddSelect/MultiAddSelect.js +150 -2
  216. package/lib/components/PageHeader/PageHeader.js +3 -1
  217. package/lib/components/SingleAddSelect/SingleAddSelect.js +91 -3
  218. package/lib/components/TagSet/TagSet.js +22 -6
  219. package/lib/components/Tearsheet/TearsheetShell.js +36 -10
  220. package/lib/components/UserProfileImage/UserProfileImage.js +37 -9
  221. package/lib/components/index.js +9 -1
  222. package/lib/global/js/package-settings.js +4 -2
  223. package/package.json +20 -16
  224. package/scss/components/AboutModal/_about-modal.scss +4 -0
  225. package/scss/components/AddSelect/_add-select.scss +51 -2
  226. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +72 -9
  227. package/scss/components/Datagrid/_datagrid.scss +66 -0
  228. package/scss/components/Datagrid/_index.scss +8 -0
  229. package/scss/components/Datagrid/_storybook-styles.scss +26 -0
  230. package/scss/components/Datagrid/styles/_variables.scss +9 -0
  231. package/scss/components/Datagrid/styles/addons/CustomizeColumnsModal.scss +48 -0
  232. package/scss/components/Datagrid/styles/addons/RowSizeDropdown.scss +23 -0
  233. package/scss/components/Datagrid/styles/datagrid.scss +318 -0
  234. package/scss/components/Datagrid/styles/index.scss +17 -0
  235. package/scss/components/Datagrid/styles/useActionsColumn.scss +24 -0
  236. package/scss/components/Datagrid/styles/useColumnRightAlign.scss +29 -0
  237. package/scss/components/Datagrid/styles/useNestedRows.scss +17 -0
  238. package/scss/components/Datagrid/styles/useNestedTable.scss +28 -0
  239. package/scss/components/Datagrid/styles/useSelectAllToggle.scss +28 -0
  240. package/scss/components/Datagrid/styles/useSortableColumns.scss +55 -0
  241. package/scss/components/Datagrid/styles/useStickyColumn.scss +38 -0
  242. package/scss/components/ExportModal/_export-modal.scss +0 -4
  243. package/scss/components/HTTPErrors/_http-errors.scss +16 -16
  244. package/scss/components/PageHeader/_page-header.scss +4 -0
  245. package/scss/components/Tearsheet/_tearsheet.scss +4 -0
  246. package/scss/components/_index.scss +1 -0
@@ -1,36 +1,87 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports.handleMultipleKeys = void 0;
8
+ exports.includesShift = exports.includesResourceKey = exports.handleMultipleKeys = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
11
 
8
12
  var _deepCloneObject = require("../../../global/js/utils/deepCloneObject");
9
13
 
10
- /**
11
- * Copyright IBM Corp. 2022, 2022
12
- *
13
- * This source code is licensed under the Apache-2.0 license found in the
14
- * LICENSE file in the root directory of this source tree.
15
- */
14
+ var _uuidv = _interopRequireDefault(require("../../../global/js/utils/uuidv4"));
15
+
16
+ var _selectAllCells = require("./selectAllCells");
17
+
18
+ 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; }
19
+
20
+ 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; }
21
+
22
+ var includesResourceKey = function includesResourceKey(arr, usingMac) {
23
+ if (usingMac) {
24
+ return includesMeta(arr);
25
+ }
26
+
27
+ if (!usingMac) {
28
+ return includesControl(arr);
29
+ }
30
+ };
31
+
32
+ exports.includesResourceKey = includesResourceKey;
33
+
34
+ var includesShift = function includesShift(arr) {
35
+ if (arr.includes('ShiftLeft') || arr.includes('ShiftRight')) {
36
+ return true;
37
+ }
38
+
39
+ return false;
40
+ };
41
+
42
+ exports.includesShift = includesShift;
43
+
44
+ var includesMeta = function includesMeta(arr) {
45
+ if (arr.includes('MetaLeft') || arr.includes('MetaRight')) {
46
+ return true;
47
+ }
48
+
49
+ return false;
50
+ };
51
+
52
+ var includesControl = function includesControl(arr) {
53
+ if (arr.includes('ControlLeft') || arr.includes('ControlRight')) {
54
+ return true;
55
+ }
56
+
57
+ return false;
58
+ };
59
+
16
60
  var handleMultipleKeys = function handleMultipleKeys(_ref) {
17
- var _selectionAreasClone$;
61
+ var _selectionAreasClone$, _selectionAreasClone$2, _selectionAreasClone$3;
18
62
 
19
- var activeKeys = _ref.activeKeys,
63
+ var activeCellCoordinates = _ref.activeCellCoordinates,
64
+ event = _ref.event,
65
+ keysPressedList = _ref.keysPressedList,
20
66
  selectionAreas = _ref.selectionAreas,
21
67
  currentMatcher = _ref.currentMatcher,
22
68
  rows = _ref.rows,
23
69
  setSelectionAreas = _ref.setSelectionAreas,
24
- columns = _ref.columns;
25
- var activeKeyValues = activeKeys.current;
70
+ columns = _ref.columns,
71
+ updateActiveCellCoordinates = _ref.updateActiveCellCoordinates,
72
+ spreadsheetRef = _ref.spreadsheetRef,
73
+ removeCellSelections = _ref.removeCellSelections,
74
+ blockClass = _ref.blockClass,
75
+ setCurrentMatcher = _ref.setCurrentMatcher,
76
+ usingMac = _ref.usingMac;
26
77
  var selectionAreasClone = (0, _deepCloneObject.deepCloneObject)(selectionAreas);
27
78
  var indexOfCurrentArea = selectionAreasClone.findIndex(function (item) {
28
79
  return item.matcher === currentMatcher;
29
80
  });
30
- var pointToUpdate = (_selectionAreasClone$ = selectionAreasClone[indexOfCurrentArea]) !== null && _selectionAreasClone$ !== void 0 && _selectionAreasClone$.point2 ? selectionAreasClone[indexOfCurrentArea].point2 : selectionAreasClone[indexOfCurrentArea].point1; // Down + Shift
81
+ var pointToUpdate = (_selectionAreasClone$ = selectionAreasClone[indexOfCurrentArea]) !== null && _selectionAreasClone$ !== void 0 && _selectionAreasClone$.point2 ? (_selectionAreasClone$2 = selectionAreasClone[indexOfCurrentArea]) === null || _selectionAreasClone$2 === void 0 ? void 0 : _selectionAreasClone$2.point2 : (_selectionAreasClone$3 = selectionAreasClone[indexOfCurrentArea]) === null || _selectionAreasClone$3 === void 0 ? void 0 : _selectionAreasClone$3.point1; // Down + Shift
31
82
 
32
- if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowDown')) {
33
- if (rows.length - 1 === pointToUpdate.row) {
83
+ if (includesShift(keysPressedList) && keysPressedList.includes('ArrowDown') && keysPressedList.length === 2) {
84
+ if (rows.length - 1 === (pointToUpdate === null || pointToUpdate === void 0 ? void 0 : pointToUpdate.row) || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
34
85
  return;
35
86
  }
36
87
 
@@ -44,8 +95,8 @@ var handleMultipleKeys = function handleMultipleKeys(_ref) {
44
95
  } // Right + Shift
45
96
 
46
97
 
47
- if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowRight')) {
48
- if (columns.length - 1 === pointToUpdate.column) {
98
+ if (includesShift(keysPressedList) && keysPressedList.includes('ArrowRight') && keysPressedList.length === 2) {
99
+ if (columns.length - 1 === (pointToUpdate === null || pointToUpdate === void 0 ? void 0 : pointToUpdate.column) || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
49
100
  return;
50
101
  }
51
102
 
@@ -59,8 +110,8 @@ var handleMultipleKeys = function handleMultipleKeys(_ref) {
59
110
  } // Up + Shift
60
111
 
61
112
 
62
- if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowUp')) {
63
- if (pointToUpdate.row === 0) {
113
+ if (includesShift(keysPressedList) && keysPressedList.includes('ArrowUp') && keysPressedList.length === 2) {
114
+ if ((pointToUpdate === null || pointToUpdate === void 0 ? void 0 : pointToUpdate.row) === 0 || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
64
115
  return;
65
116
  }
66
117
 
@@ -74,8 +125,8 @@ var handleMultipleKeys = function handleMultipleKeys(_ref) {
74
125
  } // Left + Shift
75
126
 
76
127
 
77
- if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowLeft')) {
78
- if (pointToUpdate.column === 0) {
128
+ if (includesShift(keysPressedList) && keysPressedList.includes('ArrowLeft') && keysPressedList.length === 2) {
129
+ if ((pointToUpdate === null || pointToUpdate === void 0 ? void 0 : pointToUpdate.column) === 0 || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
79
130
  return;
80
131
  }
81
132
 
@@ -86,6 +137,170 @@ var handleMultipleKeys = function handleMultipleKeys(_ref) {
86
137
  selectionAreasClone[indexOfCurrentArea].point2 = _newPoint3;
87
138
  selectionAreasClone[indexOfCurrentArea].areaCreated = false;
88
139
  setSelectionAreas(selectionAreasClone);
140
+ } // CMD + a (select all)
141
+
142
+
143
+ if (includesResourceKey(keysPressedList, usingMac) && keysPressedList.includes('KeyA')) {
144
+ event.preventDefault();
145
+ var selectionPoint1 = {
146
+ row: 0,
147
+ column: 0
148
+ };
149
+ var selectionPoint2 = {
150
+ row: rows.length - 1,
151
+ column: columns.length - 1
152
+ }; // If indexOfCurrentArea is -1, it means the active cell is in a cell header position
153
+
154
+ if (indexOfCurrentArea === -1) {
155
+ (0, _selectAllCells.selectAllCells)({
156
+ ref: spreadsheetRef,
157
+ setCurrentMatcher: setCurrentMatcher,
158
+ setSelectionAreas: setSelectionAreas,
159
+ rows: rows,
160
+ columns: columns,
161
+ activeCellCoordinates: activeCellCoordinates,
162
+ updateActiveCellCoordinates: updateActiveCellCoordinates
163
+ });
164
+ }
165
+
166
+ selectionAreasClone[indexOfCurrentArea].point1 = selectionPoint1;
167
+ selectionAreasClone[indexOfCurrentArea].point2 = selectionPoint2;
168
+ selectionAreasClone[indexOfCurrentArea].areaCreated = false;
169
+ setSelectionAreas(selectionAreasClone);
170
+ } // CONTROL + SPACE (Select current column)
171
+
172
+
173
+ if (includesControl(keysPressedList) && keysPressedList.includes('Space')) {
174
+ var _selectionPoint = {
175
+ row: 0,
176
+ column: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column
177
+ };
178
+ var _selectionPoint2 = {
179
+ row: rows.length - 1,
180
+ column: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column
181
+ }; // If indexOfCurrentArea is -1, it means the active cell is in a cell header position
182
+
183
+ if (indexOfCurrentArea === -1) {
184
+ var tempMatcher = (0, _uuidv.default)();
185
+ var newSelectionArea = {
186
+ point1: _selectionPoint,
187
+ point2: _selectionPoint2,
188
+ areaCreated: false,
189
+ matcher: tempMatcher
190
+ };
191
+
192
+ var coordinatesClone = _objectSpread({}, activeCellCoordinates);
193
+
194
+ updateActiveCellCoordinates({
195
+ coords: coordinatesClone,
196
+ updatedValue: {
197
+ column: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column,
198
+ row: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row
199
+ }
200
+ });
201
+ setCurrentMatcher(tempMatcher);
202
+ return setSelectionAreas([newSelectionArea]);
203
+ }
204
+
205
+ selectionAreasClone[indexOfCurrentArea].point1 = _selectionPoint;
206
+ selectionAreasClone[indexOfCurrentArea].point2 = _selectionPoint2;
207
+ selectionAreasClone[indexOfCurrentArea].areaCreated = false;
208
+ setSelectionAreas(selectionAreasClone);
209
+ } // Shift + SPACE (Select current row)
210
+
211
+
212
+ if (includesShift(keysPressedList) && keysPressedList.includes('Space')) {
213
+ var _selectionPoint3 = {
214
+ row: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row,
215
+ column: 0
216
+ };
217
+ var _selectionPoint4 = {
218
+ row: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row,
219
+ column: columns.length - 1
220
+ }; // If indexOfCurrentArea is -1, it means the active cell is in a cell header position
221
+
222
+ if (indexOfCurrentArea === -1) {
223
+ var _tempMatcher = (0, _uuidv.default)();
224
+
225
+ var _newSelectionArea = {
226
+ point1: _selectionPoint3,
227
+ point2: _selectionPoint4,
228
+ areaCreated: false,
229
+ matcher: _tempMatcher
230
+ };
231
+
232
+ var _coordinatesClone = _objectSpread({}, activeCellCoordinates);
233
+
234
+ updateActiveCellCoordinates({
235
+ coords: _coordinatesClone,
236
+ updatedValue: {
237
+ column: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column,
238
+ row: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row
239
+ }
240
+ });
241
+ setCurrentMatcher(_tempMatcher);
242
+ return setSelectionAreas([_newSelectionArea]);
243
+ }
244
+
245
+ selectionAreasClone[indexOfCurrentArea].point1 = _selectionPoint3;
246
+ selectionAreasClone[indexOfCurrentArea].point2 = _selectionPoint4;
247
+ selectionAreasClone[indexOfCurrentArea].areaCreated = false;
248
+ setSelectionAreas(selectionAreasClone);
249
+ } // CMD + HOME (Selects first cell in first row)
250
+
251
+
252
+ if (includesResourceKey(keysPressedList, usingMac) && keysPressedList.includes('Home')) {
253
+ var scrollElement = spreadsheetRef.current.querySelector(".".concat(blockClass, "__list--container"));
254
+ scrollElement.scrollTop = 0;
255
+
256
+ var _coordinatesClone2 = _objectSpread({}, activeCellCoordinates);
257
+
258
+ removeCellSelections({
259
+ spreadsheetRef: spreadsheetRef
260
+ });
261
+ updateActiveCellCoordinates({
262
+ coords: _coordinatesClone2,
263
+ updatedValue: {
264
+ column: 0,
265
+ row: 0
266
+ }
267
+ });
268
+ } // CMD + END (Selects last cell in last row)
269
+
270
+
271
+ if (includesResourceKey(keysPressedList, usingMac) && keysPressedList.includes('End')) {
272
+ var _scrollElement = spreadsheetRef.current.querySelector(".".concat(blockClass, "__list--container"));
273
+
274
+ _scrollElement.scrollTop = _scrollElement.scrollHeight;
275
+
276
+ var _coordinatesClone3 = _objectSpread({}, activeCellCoordinates);
277
+
278
+ removeCellSelections({
279
+ spreadsheetRef: spreadsheetRef
280
+ });
281
+ var lastCellExists = !!rows[(rows === null || rows === void 0 ? void 0 : rows.length) - 1].cells[(columns === null || columns === void 0 ? void 0 : columns.length) - 1];
282
+
283
+ var updateToLastCell = function updateToLastCell() {
284
+ updateActiveCellCoordinates({
285
+ coords: _coordinatesClone3,
286
+ updatedValue: {
287
+ column: columns.length - 1,
288
+ row: rows.length - 1
289
+ }
290
+ });
291
+ }; // With the spreadsheet supporting virtualized data, it's possible that the last cell
292
+ // has never been rendered yet, if that's the case we scroll to the bottom of the spreadsheet
293
+ // and add a timeout to wait for the last row to render to the DOM before updating the active cell coordinates.
294
+ // If we're able to verify that the last row has been rendered, no timeout is used.
295
+
296
+
297
+ if (lastCellExists) {
298
+ updateToLastCell();
299
+ } else {
300
+ setTimeout(function () {
301
+ updateToLastCell();
302
+ }, 1);
303
+ }
89
304
  }
90
305
  };
91
306
 
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.selectAllCells = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _removeCellSelections = require("./removeCellSelections");
13
+
14
+ var _uuidv = _interopRequireDefault(require("../../../global/js/utils/uuidv4"));
15
+
16
+ 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; }
17
+
18
+ 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; }
19
+
20
+ var selectAllCells = function selectAllCells(_ref) {
21
+ var activeCellCoordinates = _ref.activeCellCoordinates,
22
+ columns = _ref.columns,
23
+ setCurrentMatcher = _ref.setCurrentMatcher,
24
+ setSelectionAreas = _ref.setSelectionAreas,
25
+ ref = _ref.ref,
26
+ rows = _ref.rows,
27
+ updateActiveCellCoordinates = _ref.updateActiveCellCoordinates;
28
+ (0, _removeCellSelections.removeCellSelections)({
29
+ spreadsheetRef: ref
30
+ });
31
+ var selectionPoint1 = {
32
+ row: 0,
33
+ column: 0
34
+ };
35
+ var selectionPoint2 = {
36
+ row: rows.length - 1,
37
+ column: columns.length - 1
38
+ };
39
+ var tempMatcher = (0, _uuidv.default)();
40
+ var newSelectionArea = {
41
+ point1: selectionPoint1,
42
+ point2: selectionPoint2,
43
+ areaCreated: false,
44
+ matcher: tempMatcher
45
+ };
46
+
47
+ var coordinatesClone = _objectSpread({}, activeCellCoordinates);
48
+
49
+ updateActiveCellCoordinates({
50
+ coords: coordinatesClone,
51
+ updatedValue: {
52
+ column: 0,
53
+ row: 0
54
+ }
55
+ });
56
+ setCurrentMatcher(tempMatcher);
57
+ return setSelectionAreas([newSelectionArea]);
58
+ };
59
+
60
+ exports.selectAllCells = selectAllCells;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
+
16
+ var _react = _interopRequireDefault(require("react"));
17
+
18
+ var _carbonComponentsReact = require("carbon-components-react");
19
+
20
+ var _classnames = _interopRequireDefault(require("classnames"));
21
+
22
+ var _DatagridHead = _interopRequireDefault(require("./DatagridHead"));
23
+
24
+ var _DatagridBody = _interopRequireDefault(require("./DatagridBody"));
25
+
26
+ var _DatagridToolbar = _interopRequireDefault(require("./DatagridToolbar"));
27
+
28
+ var _devtools = require("../../../global/js/utils/devtools");
29
+
30
+ var _settings = require("../../../settings");
31
+
32
+ var _excluded = ["getTableProps", "withVirtualScroll", "DatagridPagination", "isFetching", "tableId", "CustomizeColumnsModal", "leftPanel", "fullHeightDatagrid", "verticalAlign", "variableRowHeight", "className"];
33
+ var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
34
+ var componentName = 'Datagrid';
35
+ var TableContainer = _carbonComponentsReact.DataTable.TableContainer,
36
+ Table = _carbonComponentsReact.DataTable.Table;
37
+
38
+ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (datagridState, ref) {
39
+ var _getTableProps;
40
+
41
+ var _datagridState$getTab = datagridState.getTableProps,
42
+ getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
43
+ withVirtualScroll = datagridState.withVirtualScroll,
44
+ DatagridPagination = datagridState.DatagridPagination,
45
+ isFetching = datagridState.isFetching,
46
+ tableId = datagridState.tableId,
47
+ CustomizeColumnsModal = datagridState.CustomizeColumnsModal,
48
+ leftPanel = datagridState.leftPanel,
49
+ fullHeightDatagrid = datagridState.fullHeightDatagrid,
50
+ _datagridState$vertic = datagridState.verticalAlign,
51
+ verticalAlign = _datagridState$vertic === void 0 ? 'center' : _datagridState$vertic,
52
+ variableRowHeight = datagridState.variableRowHeight,
53
+ className = datagridState.className,
54
+ rest = (0, _objectWithoutProperties2.default)(datagridState, _excluded);
55
+ var rows = DatagridPagination && datagridState.page || datagridState.rows;
56
+
57
+ var dataGrid = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TableContainer, {
58
+ className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '')
59
+ }, /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
60
+ className: (0, _classnames.default)(DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className)
61
+ }), /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
62
+ rows: rows
63
+ })))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/_react.default.createElement(CustomizeColumnsModal, {
64
+ instance: datagridState
65
+ }));
66
+
67
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
68
+ id: tableId,
69
+ ref: ref,
70
+ className: (0, _classnames.default)(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"))
71
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_DatagridToolbar.default, datagridState), leftPanel && /*#__PURE__*/_react.default.createElement("div", {
72
+ className: "".concat(blockClass, "__grid-container ").concat(blockClass, "__displayFlex")
73
+ }, leftPanel && leftPanel.isOpen && /*#__PURE__*/_react.default.createElement("div", {
74
+ className: "".concat(blockClass, "__datagridLeftPanel")
75
+ }, leftPanel.panelContent), /*#__PURE__*/_react.default.createElement("div", {
76
+ className: "".concat(blockClass, "__datagridWithPanel")
77
+ }, dataGrid)), leftPanel === undefined && dataGrid);
78
+ }); // Return a placeholder if not released and not enabled by feature flag
79
+
80
+
81
+ Datagrid = _settings.pkg.checkComponentEnabled(Datagrid, componentName); // The display name of the component, used by React. Note that displayName
82
+ // is used in preference to relying on function.name.
83
+
84
+ Datagrid.displayName = componentName;
85
+ var _default = Datagrid;
86
+ exports.default = _default;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _DatagridEmptyBody = _interopRequireDefault(require("./DatagridEmptyBody"));
13
+
14
+ var _DatagridVirtualBody = _interopRequireDefault(require("./DatagridVirtualBody"));
15
+
16
+ var _DatagridSimpleBody = _interopRequireDefault(require("./DatagridSimpleBody"));
17
+
18
+ var _DatagridRefBody = _interopRequireDefault(require("./DatagridRefBody"));
19
+
20
+ /*
21
+ * Licensed Materials - Property of IBM
22
+ * 5724-Q36
23
+ * (c) Copyright IBM Corp. 2021
24
+ * US Government Users Restricted Rights - Use, duplication or disclosure
25
+ * restricted by GSA ADP Schedule Contract with IBM Corp.
26
+ */
27
+ var DatagridBody = function DatagridBody(datagridState) {
28
+ var isFetching = datagridState.isFetching,
29
+ _datagridState$rows = datagridState.rows,
30
+ rows = _datagridState$rows === void 0 ? [] : _datagridState$rows,
31
+ withVirtualScroll = datagridState.withVirtualScroll,
32
+ withStickyColumn = datagridState.withStickyColumn;
33
+
34
+ if (!isFetching && rows.length === 0) {
35
+ return /*#__PURE__*/_react.default.createElement(_DatagridEmptyBody.default, datagridState);
36
+ }
37
+
38
+ if (withVirtualScroll) {
39
+ return /*#__PURE__*/_react.default.createElement(_DatagridVirtualBody.default, datagridState);
40
+ }
41
+
42
+ if (withStickyColumn) {
43
+ return /*#__PURE__*/_react.default.createElement(_DatagridRefBody.default, datagridState);
44
+ }
45
+
46
+ return /*#__PURE__*/_react.default.createElement(_DatagridSimpleBody.default, datagridState);
47
+ };
48
+
49
+ var _default = DatagridBody;
50
+ exports.default = _default;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _settings = require("../../../settings");
13
+
14
+ /*
15
+ * Licensed Materials - Property of IBM
16
+ * 5724-Q36
17
+ * (c) Copyright IBM Corp. 2020
18
+ * US Government Users Restricted Rights - Use, duplication or disclosure
19
+ * restricted by GSA ADP Schedule Contract with IBM Corp.
20
+ */
21
+ var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
22
+
23
+ var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
24
+ var EmptyState = datagridState.EmptyState;
25
+ return /*#__PURE__*/_react.default.createElement("div", {
26
+ className: "".concat(blockClass, "__empty-state-body")
27
+ }, EmptyState);
28
+ };
29
+
30
+ var _default = DatagridEmptyBody;
31
+ exports.default = _default;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _settings = require("../../../settings");
13
+
14
+ /*
15
+ * Licensed Materials - Property of IBM
16
+ * 5724-Q36
17
+ * (c) Copyright IBM Corp. 2020
18
+ * US Government Users Restricted Rights - Use, duplication or disclosure
19
+ * restricted by GSA ADP Schedule Contract with IBM Corp.
20
+ */
21
+ var blockClass = "".concat(_settings.pkg.prefix, "--datagrid"); // eslint-disable-next-line react/prop-types
22
+
23
+ var DatagridExpandedRow = function DatagridExpandedRow(PreviousRowRenderer, ExpandedRowContentComponent) {
24
+ return function (datagridState) {
25
+ var row = datagridState.row;
26
+
27
+ if (!row.isExpanded) {
28
+ return PreviousRowRenderer(datagridState);
29
+ }
30
+
31
+ return /*#__PURE__*/_react.default.createElement("div", {
32
+ className: "".concat(blockClass, "__expanded-row")
33
+ }, PreviousRowRenderer(datagridState), ExpandedRowContentComponent(datagridState));
34
+ };
35
+ };
36
+
37
+ var _default = DatagridExpandedRow;
38
+ exports.default = _default;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _carbonComponentsReact = require("carbon-components-react");
15
+
16
+ /*
17
+ * Licensed Materials - Property of IBM
18
+ * 5724-Q36
19
+ * (c) Copyright IBM Corp. 2020, 2021
20
+ * US Government Users Restricted Rights - Use, duplication or disclosure
21
+ * restricted by GSA ADP Schedule Contract with IBM Corp.
22
+ */
23
+ var TableHead = _carbonComponentsReact.DataTable.TableHead;
24
+
25
+ var DatagridHead = function DatagridHead(datagridState) {
26
+ var _datagridState$header = datagridState.headerGroups,
27
+ headerGroups = _datagridState$header === void 0 ? [] : _datagridState$header,
28
+ headRef = datagridState.headRef,
29
+ HeaderRow = datagridState.HeaderRow;
30
+ return /*#__PURE__*/_react.default.createElement(TableHead, null, headerGroups.map(function (headerGroup, index) {
31
+ return (
32
+ /*#__PURE__*/
33
+ // doesn't support header grouping.
34
+ _react.default.createElement("div", (0, _extends2.default)({}, headerGroup.getHeaderGroupProps(), {
35
+ ref: headRef,
36
+ key: "header_".concat(index)
37
+ }), HeaderRow(datagridState))
38
+ );
39
+ }));
40
+ };
41
+
42
+ var _default = DatagridHead;
43
+ exports.default = _default;