@carbon/ibm-products 2.43.2-canary.9 → 2.44.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/css/index-full-carbon.css +51 -3
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +12 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +51 -3
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +51 -3
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
  18. package/es/components/ConditionBuilder/ConditionBuilder.js +67 -20
  19. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
  20. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +129 -0
  21. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -4
  22. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
  23. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
  24. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
  25. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
  26. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
  27. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
  28. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
  29. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
  30. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
  31. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
  32. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
  33. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
  34. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
  35. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +24 -16
  36. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +19 -4
  37. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
  38. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +109 -0
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
  40. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +58 -33
  41. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
  42. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -5
  43. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
  44. package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
  45. package/es/components/ConditionBuilder/utils/util.js +16 -1
  46. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +12 -0
  47. package/es/components/DataSpreadsheet/DataSpreadsheet.js +29 -7
  48. package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +12 -0
  49. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +22 -6
  50. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +3 -0
  51. package/es/components/Datagrid/Datagrid/Datagrid.js +2 -1
  52. package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  53. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +11 -1
  54. package/es/components/Datagrid/Datagrid/DatagridRow.js +13 -2
  55. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -1
  56. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -1
  57. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.d.ts +3 -1
  58. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +6 -3
  59. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.d.ts +1 -1
  60. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +21 -16
  61. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -1
  62. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +74 -11
  63. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +10 -2
  64. package/es/components/Datagrid/types/index.d.ts +18 -4
  65. package/es/components/Datagrid/useActionsColumn.d.ts +8 -1
  66. package/es/components/Datagrid/useActionsColumn.js +7 -6
  67. package/es/components/Datagrid/useColumnRightAlign.d.ts +8 -1
  68. package/es/components/Datagrid/useColumnRightAlign.js +4 -3
  69. package/es/components/Datagrid/useInlineEdit.js +12 -2
  70. package/es/components/Datagrid/useNestedRows.js +32 -13
  71. package/es/components/Decorator/Decorator.js +2 -1
  72. package/es/components/DecoratorBase/DecoratorBase.js +3 -5
  73. package/es/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
  74. package/es/components/DecoratorLink/DecoratorLink.js +2 -1
  75. package/es/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
  76. package/es/components/EditTearsheet/EditTearsheet.d.ts +5 -1
  77. package/es/components/EditTearsheet/EditTearsheet.js +0 -1
  78. package/es/components/EditTearsheet/EditTearsheetForm.d.ts +45 -2
  79. package/es/components/EditTearsheet/EditTearsheetForm.js +3 -0
  80. package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
  81. package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
  82. package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
  83. package/es/components/RemoveModal/RemoveModal.d.ts +4 -0
  84. package/es/components/RemoveModal/RemoveModal.js +7 -1
  85. package/es/components/StatusIndicator/StatusIndicatorStep.js +87 -0
  86. package/es/components/Tearsheet/Tearsheet.d.ts +8 -1
  87. package/es/components/Tearsheet/Tearsheet.js +9 -1
  88. package/es/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
  89. package/es/components/Tearsheet/TearsheetNarrow.js +12 -0
  90. package/es/components/Tearsheet/TearsheetShell.d.ts +10 -0
  91. package/es/components/Tearsheet/TearsheetShell.js +17 -3
  92. package/es/components/Toolbar/ToolbarButton.js +1 -1
  93. package/es/components/index.d.ts +1 -1
  94. package/es/index.js +1 -0
  95. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
  96. package/lib/components/ConditionBuilder/ConditionBuilder.js +67 -20
  97. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
  98. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +137 -0
  99. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -3
  100. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
  101. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
  102. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
  103. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
  104. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
  105. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
  106. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
  107. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
  108. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
  109. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
  110. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
  111. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
  112. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
  113. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +23 -15
  114. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +20 -5
  115. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
  116. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +117 -0
  117. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
  118. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +56 -31
  119. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
  120. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -4
  121. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
  122. package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
  123. package/lib/components/ConditionBuilder/utils/util.js +17 -0
  124. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +12 -0
  125. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +29 -7
  126. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +12 -0
  127. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +22 -6
  128. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +3 -0
  129. package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -1
  130. package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  131. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +11 -1
  132. package/lib/components/Datagrid/Datagrid/DatagridRow.js +13 -2
  133. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -1
  134. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -1
  135. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.d.ts +3 -1
  136. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +6 -3
  137. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.d.ts +1 -1
  138. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +21 -16
  139. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -1
  140. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +73 -10
  141. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +10 -2
  142. package/lib/components/Datagrid/types/index.d.ts +18 -4
  143. package/lib/components/Datagrid/useActionsColumn.d.ts +8 -1
  144. package/lib/components/Datagrid/useActionsColumn.js +7 -6
  145. package/lib/components/Datagrid/useColumnRightAlign.d.ts +8 -1
  146. package/lib/components/Datagrid/useColumnRightAlign.js +4 -3
  147. package/lib/components/Datagrid/useInlineEdit.js +12 -2
  148. package/lib/components/Datagrid/useNestedRows.js +32 -13
  149. package/lib/components/Decorator/Decorator.js +2 -1
  150. package/lib/components/DecoratorBase/DecoratorBase.js +3 -5
  151. package/lib/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
  152. package/lib/components/DecoratorLink/DecoratorLink.js +2 -1
  153. package/lib/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
  154. package/lib/components/EditTearsheet/EditTearsheet.d.ts +5 -1
  155. package/lib/components/EditTearsheet/EditTearsheet.js +0 -1
  156. package/lib/components/EditTearsheet/EditTearsheetForm.d.ts +45 -2
  157. package/lib/components/EditTearsheet/EditTearsheetForm.js +3 -0
  158. package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
  159. package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
  160. package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
  161. package/lib/components/RemoveModal/RemoveModal.d.ts +4 -0
  162. package/lib/components/RemoveModal/RemoveModal.js +7 -1
  163. package/lib/components/StatusIndicator/StatusIndicatorStep.js +94 -0
  164. package/lib/components/Tearsheet/Tearsheet.d.ts +8 -1
  165. package/lib/components/Tearsheet/Tearsheet.js +9 -1
  166. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
  167. package/lib/components/Tearsheet/TearsheetNarrow.js +12 -0
  168. package/lib/components/Tearsheet/TearsheetShell.d.ts +10 -0
  169. package/lib/components/Tearsheet/TearsheetShell.js +16 -2
  170. package/lib/components/Toolbar/ToolbarButton.js +1 -1
  171. package/lib/components/index.d.ts +1 -1
  172. package/lib/index.js +5 -0
  173. package/package.json +7 -6
  174. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +9 -1
  175. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +26 -1
  176. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +7 -0
  177. package/scss/components/Datagrid/styles/_useInlineEdit.scss +13 -0
  178. package/scss/components/StatusIcon/_status-icon.scss +4 -4
  179. package/scss/components/StringFormatter/_string-formatter.scss +2 -2
  180. package/scss/components/UserProfileImage/_user-profile-image.scss +6 -2
  181. package/telemetry.yml +15 -3
  182. package/es/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +0 -1
  183. package/es/components/ConditionBuilder/utils/checkForHoldingKey.js +0 -16
  184. package/lib/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +0 -1
  185. package/lib/components/ConditionBuilder/utils/checkForHoldingKey.js +0 -20
@@ -44,6 +44,9 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
44
44
  headerGroups = _ref.headerGroups,
45
45
  id = _ref.id,
46
46
  onDataUpdate = _ref.onDataUpdate,
47
+ renderRowHeader = _ref.renderRowHeader,
48
+ renderRowHeaderDirection = _ref.renderRowHeaderDirection,
49
+ hasCustomRowHeader = _ref.hasCustomRowHeader,
47
50
  prepareRow = _ref.prepareRow,
48
51
  rows = _ref.rows,
49
52
  selectionAreaData = _ref.selectionAreaData,
@@ -147,7 +150,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
147
150
  return;
148
151
  });
149
152
  }
150
- }, [selectionAreas, setSelectionAreas, defaultColumn, onSelectionAreaChange, setSelectionAreaData, ref, activeCellCoordinates, setActiveCellInsideSelectionArea, visibleColumns]);
153
+ }, [selectionAreas, setSelectionAreas, defaultColumn, onSelectionAreaChange, setSelectionAreaData, ref, activeCellCoordinates, setActiveCellInsideSelectionArea, visibleColumns, hasCustomRowHeader]);
151
154
  var populateSelectionAreaCellData = function populateSelectionAreaCellData(_ref2) {
152
155
  var rowStart = _ref2.rowStart,
153
156
  rowEnd = _ref2.rowEnd,
@@ -221,7 +224,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
221
224
  });
222
225
  }
223
226
  }
224
- }, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns]);
227
+ }, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns, hasCustomRowHeader]);
225
228
 
226
229
  //this method will check for any duplicate selection area and remove.
227
230
  //same selections are those have the same height, width, top, left styles. These inline styles are being set in createCellSelection util.
@@ -347,11 +350,12 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
347
350
  "data-column-index": "header",
348
351
  type: "button",
349
352
  onClick: handleRowHeaderClickEvent(index),
350
- className: cx__default["default"]("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__td-th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || checkActiveHeaderCell.checkActiveHeaderCell(index, selectionAreas, 'row')), "".concat(blockClass, "__td-th--selected-header"), checkSelectedHeaderCell.checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
353
+ className: cx__default["default"]("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__td_custom"), hasCustomRowHeader ? true : false), "".concat(blockClass, "__td-th--active-header"), !hasCustomRowHeader && ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || checkActiveHeaderCell.checkActiveHeaderCell(index, selectionAreas, 'row'))), "".concat(blockClass, "__td-th--selected-header"), !hasCustomRowHeader && checkSelectedHeaderCell.checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
351
354
  style: {
352
- width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
355
+ width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth,
356
+ flexDirection: hasCustomRowHeader ? renderRowHeaderDirection === 'Left' ? 'row-reverse' : row : undefined
353
357
  }
354
- }, index + 1)), row.cells.map(function (cell, index) {
358
+ }, index + 1, hasCustomRowHeader && typeof renderRowHeader === 'function' && renderRowHeader(index))), row.cells.map(function (cell, index) {
355
359
  var _cell$column;
356
360
  var cellProps = propsHelper.prepareProps(cell.getCellProps(), 'key');
357
361
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
@@ -376,7 +380,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
376
380
  }, cell.render('Cell')));
377
381
  }));
378
382
  }
379
- }, [prepareRow, rows, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
383
+ }, [prepareRow, renderRowHeader, renderRowHeaderDirection, rows, hasCustomRowHeader, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
380
384
  var spreadsheetBodyRef = React.useRef();
381
385
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
382
386
  ref: spreadsheetBodyRef,
@@ -442,6 +446,10 @@ DataSpreadsheetBody.propTypes = {
442
446
  */
443
447
  /**@ts-ignore */
444
448
  getTableBodyProps: index["default"].func,
449
+ /**
450
+ * Check if spreadsheet is using custom row header component attached
451
+ */
452
+ hasCustomRowHeader: index["default"].bool,
445
453
  /**
446
454
  * Headers provided from useTable hook
447
455
  */
@@ -466,6 +474,14 @@ DataSpreadsheetBody.propTypes = {
466
474
  * Prepare row function from react-table
467
475
  */
468
476
  prepareRow: index["default"].func,
477
+ /**
478
+ * Component next to numbering rows
479
+ */
480
+ renderRowHeader: index["default"].func,
481
+ /**
482
+ * Component next to numbering rows
483
+ */
484
+ renderRowHeaderDirection: index["default"].string,
469
485
  /**
470
486
  * All of the spreadsheet row data
471
487
  */
@@ -184,6 +184,9 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
184
184
  "data-row-index": "header",
185
185
  "data-column-index": "header",
186
186
  type: "button",
187
+ style: {
188
+ width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
189
+ },
187
190
  tabIndex: -1,
188
191
  "aria-label": selectAllAriaLabel,
189
192
  onClick: handleSelectAllClick,
@@ -55,7 +55,8 @@ exports.Datagrid = /*#__PURE__*/React__default["default"].forwardRef(function (_
55
55
  };
56
56
  return /*#__PURE__*/React__default["default"].createElement(FilterProvider.FilterProvider, {
57
57
  filters: state === null || state === void 0 ? void 0 : state.filters,
58
- filterProps: filterProps
58
+ filterProps: filterProps,
59
+ tableId: tableId
59
60
  }, /*#__PURE__*/React__default["default"].createElement(InlineEditContext.InlineEditProvider, null, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
60
61
  id: tableId,
61
62
  ref: ref,
@@ -167,7 +167,7 @@ var DatagridContent = function DatagridContent(_ref) {
167
167
  className: "".concat(blockClass, "__filter-summary"),
168
168
  filters: filterTags,
169
169
  clearFilters: function clearFilters() {
170
- return EventEmitter.dispatch(constants.CLEAR_FILTERS);
170
+ return EventEmitter.dispatch(constants.CLEAR_FILTERS, tableId);
171
171
  },
172
172
  renderLabel: filterProps === null || filterProps === void 0 ? void 0 : filterProps.renderLabel,
173
173
  overflowType: "tag"
@@ -99,7 +99,8 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
99
99
  var resizerAriaLabel = datagridState.resizerAriaLabel,
100
100
  isTableSortable = datagridState.isTableSortable,
101
101
  rows = datagridState.rows,
102
- isFetching = datagridState.isFetching;
102
+ isFetching = datagridState.isFetching,
103
+ headers = datagridState.headers;
103
104
  useInitialColumnSort.useInitialColumnSort(datagridState);
104
105
  // Used to measure the height of the table and uses that value
105
106
  // to display a vertical line to indicate the column you are resizing
@@ -161,6 +162,9 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
161
162
  });
162
163
  var key = headerGroupProps.key,
163
164
  rowProps = _rollupPluginBabelHelpers.objectWithoutProperties(headerGroupProps, _excluded2);
165
+ var withActionsColumn = headers ? !!headers.filter(function (header) {
166
+ return header.isAction;
167
+ }).length : false;
164
168
  return /*#__PURE__*/React__default["default"].createElement(react.TableRow, _rollupPluginBabelHelpers["extends"]({
165
169
  key: key
166
170
  }, rowProps, {
@@ -193,6 +197,12 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
193
197
  var _header$getHeaderProp = header.getHeaderProps(),
194
198
  headerProps = _rollupPluginBabelHelpers["extends"]({}, (_rollupPluginBabelHelpers.objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
195
199
  var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
200
+ var headerStyle = headerProps === null || headerProps === void 0 ? void 0 : headerProps.style;
201
+ var lastVisibleIndex = withActionsColumn ? 2 : 1;
202
+ var lastVisibleFlexStyle = index === visibleColumns.length - lastVisibleIndex ? '1 1 0' : '0 0 auto';
203
+ if (headerStyle) {
204
+ headerStyle.flex = lastVisibleFlexStyle;
205
+ }
196
206
  return /*#__PURE__*/React__default["default"].createElement(react.TableHeader, _rollupPluginBabelHelpers["extends"]({}, headerProps, {
197
207
  className: cx__default["default"](header === null || header === void 0 ? void 0 : header.className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default["default"].isValidElement(header === null || header === void 0 ? void 0 : header.slug)), headerProps.className),
198
208
  key: header.id,
@@ -25,7 +25,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
25
25
 
26
26
  var _SkeletonText;
27
27
  var _excluded = ["className"],
28
- _excluded2 = ["children"];
28
+ _excluded2 = ["style", "children"];
29
29
  var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
30
30
  var rowHeights = {
31
31
  xs: 24,
@@ -48,7 +48,8 @@ var DatagridRow = function DatagridRow(datagridState) {
48
48
  withExpandedRows = datagridState.withExpandedRows,
49
49
  withMouseHover = datagridState.withMouseHover,
50
50
  setMouseOverRowIndex = datagridState.setMouseOverRowIndex,
51
- headers = datagridState.headers;
51
+ headers = datagridState.headers,
52
+ visibleColumns = datagridState.visibleColumns;
52
53
  var getVisibleNestedRowCount = function getVisibleNestedRowCount(_ref) {
53
54
  var isExpanded = _ref.isExpanded,
54
55
  subRows = _ref.subRows;
@@ -124,6 +125,9 @@ var DatagridRow = function DatagridRow(datagridState) {
124
125
  return /*#__PURE__*/React.isValidElement(r === null || r === void 0 || (_r$original = r.original) === null || _r$original === void 0 ? void 0 : _r$original.slug);
125
126
  });
126
127
  var rowClassNames = cx__default["default"]("".concat(blockClass, "__carbon-row"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), "".concat(blockClass, "__carbon-row-expandable"), row.canExpand), "".concat(settings.carbon.prefix, "--data-table--selected"), row.isSelected), "".concat(blockClass, "__slug--row"), /*#__PURE__*/React.isValidElement(row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.slug)));
128
+ var withActionsColumn = headers ? !!headers.filter(function (header) {
129
+ return header.isAction;
130
+ }).length : false;
127
131
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
128
132
  key: key
129
133
  }, /*#__PURE__*/React__default["default"].createElement(react.TableRow, _rollupPluginBabelHelpers["extends"]({}, rowProps, {
@@ -145,6 +149,7 @@ var DatagridRow = function DatagridRow(datagridState) {
145
149
  var cellProps = cell.getCellProps();
146
150
  // eslint-disable-next-line no-unused-vars
147
151
  var _ref2 = cellProps,
152
+ style = _ref2.style,
148
153
  children = _ref2.children,
149
154
  restProps = _rollupPluginBabelHelpers.objectWithoutProperties(_ref2, _excluded2);
150
155
  var columnClassname = cell === null || cell === void 0 || (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : _cell$column.className;
@@ -159,9 +164,15 @@ var DatagridRow = function DatagridRow(datagridState) {
159
164
  var associatedHeader = headers === null || headers === void 0 ? void 0 : headers.filter(function (h) {
160
165
  return h.id === cell.column.id;
161
166
  });
167
+ var lastVisibleIndex = withActionsColumn ? 2 : 1;
168
+ var lastVisibleFlexStyle = index === visibleColumns.length - lastVisibleIndex ? '1 1 0' : '0 0 auto';
169
+ if (style) {
170
+ style.flex = lastVisibleFlexStyle;
171
+ }
162
172
  return /*#__PURE__*/React__default["default"].createElement(react.TableCell, _rollupPluginBabelHelpers["extends"]({
163
173
  className: cx__default["default"]("".concat(blockClass, "__cell"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__expandable-row-cell"), row.canExpand && index === 0), "".concat(blockClass, "__expandable-row-cell--is-expanded"), row.isExpanded && index === 0), "".concat(blockClass, "__slug--cell"), associatedHeader && associatedHeader.length && /*#__PURE__*/React.isValidElement((_associatedHeader$ = associatedHeader[0]) === null || _associatedHeader$ === void 0 ? void 0 : _associatedHeader$.slug)), columnClassname)
164
174
  }, restProps, {
175
+ style: style,
165
176
  key: cell.column.id,
166
177
  title: title
167
178
  }), content);
@@ -218,7 +218,12 @@ var FilterFlyout = function FilterFlyout(_ref) {
218
218
  closeFlyout();
219
219
  cancel();
220
220
  });
221
- useSubscribeToEventEmitter["default"](constants.CLEAR_FILTERS, reset);
221
+
222
+ // tableId is passed in from the event emitter from the FilterSummary component
223
+ // in DatagridContent
224
+ useSubscribeToEventEmitter["default"](constants.CLEAR_FILTERS, function (tableId) {
225
+ reset(tableId);
226
+ });
222
227
  React.useEffect(function reflectLastAppliedFiltersWhenReactTableUpdates() {
223
228
  lastAppliedFilters.current = JSON.stringify(reactTableFiltersState);
224
229
  }, [reactTableFiltersState, lastAppliedFilters]);
@@ -192,7 +192,12 @@ var FilterPanel = function FilterPanel(_ref) {
192
192
  var _filterPanelRef$curre;
193
193
  (_filterPanelRef$curre = filterPanelRef.current) === null || _filterPanelRef$curre === void 0 || _filterPanelRef$curre.style.setProperty('--filter-panel-min-height', layout.rem(filterPanelMinHeight));
194
194
  }, [filterPanelMinHeight]);
195
- useSubscribeToEventEmitter["default"](constants.CLEAR_FILTERS, reset);
195
+
196
+ // tableId is passed in from the event emitter from the FilterSummary component
197
+ // in DatagridContent
198
+ useSubscribeToEventEmitter["default"](constants.CLEAR_FILTERS, function (tableId) {
199
+ reset(tableId);
200
+ });
196
201
  var getScrollableContainerHeight = function getScrollableContainerHeight() {
197
202
  var _filterHeadingRef$cur, _filterSearchRef$curr, _actionSetRef$current;
198
203
  var filterHeadingHeight = (_filterHeadingRef$cur = filterHeadingRef.current) === null || _filterHeadingRef$cur === void 0 ? void 0 : _filterHeadingRef$cur.getBoundingClientRect().height;
@@ -3,16 +3,18 @@ export function clearSingleFilter({ key, value }: {
3
3
  key: any;
4
4
  value: any;
5
5
  }, setAllFilters: any, state: any): void;
6
- export function FilterProvider({ children, filters, filterProps }: {
6
+ export function FilterProvider({ children, filters, filterProps, tableId }: {
7
7
  children: any;
8
8
  filters: any;
9
9
  filterProps: any;
10
+ tableId: any;
10
11
  }): import("react/jsx-runtime").JSX.Element;
11
12
  export namespace FilterProvider {
12
13
  namespace propTypes {
13
14
  let children: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
14
15
  let filterProps: PropTypes.Requireable<object>;
15
16
  let filters: PropTypes.Validator<(object | null | undefined)[]>;
17
+ let tableId: PropTypes.Requireable<string>;
16
18
  }
17
19
  }
18
20
  import React from 'react';
@@ -164,7 +164,8 @@ var filteringReducer = function filteringReducer(state, action) {
164
164
  var FilterProvider = function FilterProvider(_ref4) {
165
165
  var children = _ref4.children,
166
166
  filters = _ref4.filters,
167
- filterProps = _ref4.filterProps;
167
+ filterProps = _ref4.filterProps,
168
+ tableId = _ref4.tableId;
168
169
  var _ref5 = filterProps || {},
169
170
  renderDateLabel = _ref5.renderDateLabel;
170
171
  var filterTags = prepareFiltersForTags(filters, renderDateLabel);
@@ -185,7 +186,8 @@ var FilterProvider = function FilterProvider(_ref4) {
185
186
  panelOpen: panelOpen,
186
187
  setPanelOpen: setPanelOpen,
187
188
  state: state,
188
- dispatch: dispatch
189
+ dispatch: dispatch,
190
+ tableId: tableId
189
191
  };
190
192
  return /*#__PURE__*/React__default["default"].createElement(FilterContext.Provider, {
191
193
  value: value
@@ -194,7 +196,8 @@ var FilterProvider = function FilterProvider(_ref4) {
194
196
  FilterProvider.propTypes = {
195
197
  children: index["default"].oneOfType([index["default"].arrayOf(index["default"].node), index["default"].node]).isRequired,
196
198
  filterProps: index["default"].object,
197
- filters: index["default"].arrayOf(index["default"].object).isRequired
199
+ filters: index["default"].arrayOf(index["default"].object).isRequired,
200
+ tableId: index["default"].string
198
201
  };
199
202
 
200
203
  exports.FilterContext = FilterContext;
@@ -15,7 +15,7 @@ declare function useFilters({ updateMethod, filters, setAllFilters, variation, r
15
15
  prevFiltersObjectArrayRef: React.MutableRefObject<string>;
16
16
  prevFiltersRef: React.MutableRefObject<string>;
17
17
  revertToPreviousFilters: () => void;
18
- reset: () => void;
18
+ reset: (tableId: any) => void;
19
19
  renderFilter: ({ type, column, props: components }: {
20
20
  type: any;
21
21
  column: any;
@@ -36,7 +36,8 @@ var useFilters = function useFilters(_ref) {
36
36
  isFetching = _ref.isFetching;
37
37
  var _useContext = React.useContext(FilterProvider.FilterContext),
38
38
  state = _useContext.state,
39
- localDispatch = _useContext.dispatch;
39
+ localDispatch = _useContext.dispatch,
40
+ contextTableId = _useContext.tableId;
40
41
  var savedFilters = state.savedFilters;
41
42
  /** State */
42
43
  var _useState = React.useState(utils.getInitialStateFromFilters(filters, variation, reactTableFiltersState)),
@@ -77,24 +78,28 @@ var useFilters = function useFilters(_ref) {
77
78
  holdingLastAppliedFiltersRef.current = JSON.parse(prevFiltersObjectArrayRef.current);
78
79
  holdingPrevFiltersObjectArrayRef.current = JSON.parse(lastAppliedFilters.current);
79
80
  }, [setAllFilters]);
80
- var reset = React.useCallback(function () {
81
- // When we reset we want the "initialFilters" to be an empty array
82
- var resetFiltersArray = [];
81
+ var reset = React.useCallback(function (tableId) {
82
+ // only reset filters if tableid of the datagrid that triggered "clear filters"
83
+ // matches the table id stored in its context instance
84
+ if (tableId === contextTableId) {
85
+ // When we reset we want the "initialFilters" to be an empty array
86
+ var resetFiltersArray = [];
83
87
 
84
- // Get the initial values for the filters
85
- var initialFiltersState = utils.getInitialStateFromFilters(filters, variation, resetFiltersArray);
86
- var initialFiltersObjectArray = [];
88
+ // Get the initial values for the filters
89
+ var initialFiltersState = utils.getInitialStateFromFilters(filters, variation, resetFiltersArray);
90
+ var initialFiltersObjectArray = [];
87
91
 
88
- // Set the state to the initial values
89
- setFiltersState(initialFiltersState);
90
- setFiltersObjectArray(initialFiltersObjectArray);
91
- setAllFilters([]);
92
+ // Set the state to the initial values
93
+ setFiltersState(initialFiltersState);
94
+ setFiltersObjectArray(initialFiltersObjectArray);
95
+ setAllFilters([]);
92
96
 
93
- // Update their respective refs so everything is in sync
94
- prevFiltersRef.current = JSON.stringify(initialFiltersState);
95
- prevFiltersObjectArrayRef.current = JSON.stringify(initialFiltersObjectArray);
96
- lastAppliedFilters.current = JSON.stringify([]);
97
- }, [filters, setAllFilters, variation]);
97
+ // Update their respective refs so everything is in sync
98
+ prevFiltersRef.current = JSON.stringify(initialFiltersState);
99
+ prevFiltersObjectArrayRef.current = JSON.stringify(initialFiltersObjectArray);
100
+ lastAppliedFilters.current = JSON.stringify([]);
101
+ }
102
+ }, [filters, setAllFilters, variation, contextTableId]);
98
103
  var applyFilters = function applyFilters(_ref2) {
99
104
  var column = _ref2.column,
100
105
  value = _ref2.value,
@@ -57,7 +57,7 @@ InlineEditButton.propTypes = {
57
57
  nonEditCell: index["default"].bool,
58
58
  placeholder: index["default"].string,
59
59
  renderIcon: index["default"].oneOfType([index["default"].func, index["default"].object]),
60
- type: index["default"].oneOf(['text', 'number', 'selection', 'date']),
60
+ type: index["default"].oneOf(['text', 'number', 'selection', 'date', 'checkbox']),
61
61
  value: index["default"].oneOfType([index["default"].string, index["default"].node])
62
62
  };
63
63
 
@@ -28,7 +28,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
28
28
 
29
29
  var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
30
30
  var InlineEditCell = function InlineEditCell(_ref) {
31
- var _config$validator, _value$text;
31
+ var _config$validator;
32
32
  var cell = _ref.cell,
33
33
  config = _ref.config,
34
34
  _ref$disabledCell = _ref.disabledCell,
@@ -75,6 +75,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
75
75
  var _ref2 = config || {},
76
76
  inputProps = _ref2.inputProps;
77
77
  var textInputRef = React.useRef();
78
+ var checkboxRef = React.useRef();
78
79
  var numberInputRef = React.useRef();
79
80
  var dropdownRef = React.useRef();
80
81
  var datePickerRef = React.useRef();
@@ -217,10 +218,36 @@ var InlineEditCell = function InlineEditCell(_ref) {
217
218
  var handleKeyDown = function handleKeyDown(event) {
218
219
  var key = event.key;
219
220
  switch (key) {
221
+ case 'ArrowRight':
222
+ case 'ArrowLeft':
223
+ case 'ArrowUp':
224
+ case 'ArrowDown':
225
+ if (inEditMode && event.target.type === 'checkbox') {
226
+ var newCellId = getNewCellId(key);
227
+ saveCellData(cellValue);
228
+ setInitialValue(cellValue);
229
+ dispatch({
230
+ type: 'EXIT_EDIT_MODE',
231
+ payload: newCellId
232
+ });
233
+ setInEditMode(false);
234
+ sendFocusBackToGrid();
235
+ }
236
+ break;
220
237
  // Save cell contents to data
221
238
  case 'Tab':
222
239
  case 'Enter':
223
240
  {
241
+ if (type === 'checkbox') {
242
+ // Since checkbox doesn't need to click into it to enter `inEditMode` we don't need to check for it
243
+ var _newCellId = getNewCellId(key);
244
+ dispatch({
245
+ type: 'EXIT_EDIT_MODE',
246
+ payload: _newCellId
247
+ });
248
+ setInEditMode(false);
249
+ sendFocusBackToGrid();
250
+ }
224
251
  if (inEditMode) {
225
252
  // Dropdown saves are handled in the Dropdown's/DatePicker's onChange prop
226
253
  if (type === 'selection' || type === 'date') {
@@ -234,12 +261,12 @@ var InlineEditCell = function InlineEditCell(_ref) {
234
261
  if (isInvalid) {
235
262
  return;
236
263
  }
237
- var newCellId = getNewCellId(key);
264
+ var _newCellId2 = getNewCellId(key);
238
265
  saveCellData(cellValue);
239
266
  setInitialValue(cellValue);
240
267
  dispatch({
241
268
  type: 'EXIT_EDIT_MODE',
242
- payload: newCellId
269
+ payload: _newCellId2
243
270
  });
244
271
  setInEditMode(false);
245
272
  sendFocusBackToGrid();
@@ -434,9 +461,27 @@ var InlineEditCell = function InlineEditCell(_ref) {
434
461
  ref: numberInputRef
435
462
  }));
436
463
  };
464
+ var renderCheckBoxCell = function renderCheckBoxCell() {
465
+ return /*#__PURE__*/React__default["default"].createElement(react.Checkbox, _rollupPluginBabelHelpers["extends"]({
466
+ labelText: cellLabel || 'Checkbox'
467
+ }, inputProps, {
468
+ className: cx__default["default"]("".concat(blockClass, "__inline-edit--outer-cell-checkbox"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-checkbox-focus"), activeCellId === cellId)),
469
+ id: cellId,
470
+ hideLabel: true,
471
+ checked: cellValue,
472
+ onChange: function onChange(event, _ref10) {
473
+ var checked = _ref10.checked;
474
+ setCellValue(checked);
475
+ if (inputProps.onChange) {
476
+ inputProps.onChange(checked);
477
+ }
478
+ },
479
+ ref: checkboxRef
480
+ }));
481
+ };
437
482
  var renderTextInput = function renderTextInput() {
438
- var _ref10 = config || {},
439
- validator = _ref10.validator;
483
+ var _ref11 = config || {},
484
+ validator = _ref11.validator;
440
485
  var isInvalid = validator === null || validator === void 0 ? void 0 : validator(cellValue);
441
486
  return /*#__PURE__*/React__default["default"].createElement(react.TextInput, _rollupPluginBabelHelpers["extends"]({
442
487
  labelText: cellLabel,
@@ -456,6 +501,24 @@ var InlineEditCell = function InlineEditCell(_ref) {
456
501
  ref: textInputRef
457
502
  }));
458
503
  };
504
+ var getLabel = function getLabel() {
505
+ var _value$text, _checkStaticCell;
506
+ var checkStaticCell = function checkStaticCell(val) {
507
+ if (_rollupPluginBabelHelpers["typeof"](val) === 'object' && val !== null && val !== void 0 && val.isStaticCell) {
508
+ return val === null || val === void 0 ? void 0 : val.value;
509
+ }
510
+ };
511
+ switch (type) {
512
+ case 'selection':
513
+ checkStaticCell(value);
514
+ return (_value$text = value === null || value === void 0 ? void 0 : value.text) !== null && _value$text !== void 0 ? _value$text : value;
515
+ case 'date':
516
+ checkStaticCell(value);
517
+ return buildDate(value);
518
+ default:
519
+ return (_checkStaticCell = checkStaticCell(value)) !== null && _checkStaticCell !== void 0 ? _checkStaticCell : value;
520
+ }
521
+ };
459
522
  return (
460
523
  /*#__PURE__*/
461
524
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
@@ -464,15 +527,15 @@ var InlineEditCell = function InlineEditCell(_ref) {
464
527
  "data-cell-id": cellId,
465
528
  "data-column-index": columnIndex,
466
529
  "data-row-index": cell.row.index,
467
- "data-disabled": disabledCell,
530
+ "data-disabled": disabledCell || nonEditCell,
468
531
  "data-inline-type": type,
469
532
  onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
470
533
  onKeyDown: !nonEditCell ? handleKeyDown : null,
471
534
  className: cx__default["default"]("".concat(blockClass, "__inline-edit--outer-cell-button"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), inEditMode && (config === null || config === void 0 || (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue))), "".concat(blockClass, "__static--outer-cell"), !disabledCell))
472
- }, !nonEditCell && !disabledCell && renderRegularCell(), (!inEditMode || disabledCell) && /*#__PURE__*/React__default["default"].createElement(InlineEditButton.InlineEditButton, {
535
+ }, !nonEditCell && !disabledCell && type !== 'checkbox' && renderRegularCell(), (!inEditMode || disabledCell) && type !== 'checkbox' && /*#__PURE__*/React__default["default"].createElement(InlineEditButton.InlineEditButton, {
473
536
  isActiveCell: cellId === activeCellId,
474
537
  renderIcon: setRenderIcon(),
475
- label: type === 'selection' ? (_value$text = value === null || value === void 0 ? void 0 : value.text) !== null && _value$text !== void 0 ? _value$text : value : type === 'date' ? buildDate(value) : value,
538
+ label: getLabel(),
476
539
  disabledCell: disabledCell,
477
540
  labelIcon: (value === null || value === void 0 ? void 0 : value.icon) || null,
478
541
  placeholder: placeholder,
@@ -480,7 +543,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
480
543
  nonEditCell: nonEditCell,
481
544
  columnConfig: cell.column,
482
545
  type: type
483
- }), !nonEditCell && inEditMode && cellId === activeCellId && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, type === 'text' && renderTextInput(), type === 'number' && renderNumberInput(), type === 'selection' && renderSelectCell(), type === 'date' && renderDateCell()))
546
+ }), type === 'checkbox' && renderCheckBoxCell(), !nonEditCell && inEditMode && cellId === activeCellId && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, type === 'text' && renderTextInput(), type === 'number' && renderNumberInput(), type === 'selection' && renderSelectCell(), type === 'date' && renderDateCell()))
484
547
  );
485
548
  };
486
549
  InlineEditCell.propTypes = {
@@ -498,7 +561,7 @@ InlineEditCell.propTypes = {
498
561
  nonEditCell: index["default"].bool,
499
562
  placeholder: index["default"].string,
500
563
  tabIndex: index["default"].number,
501
- type: index["default"].oneOf(['text', 'number', 'selection', 'date']),
564
+ type: index["default"].oneOf(['text', 'number', 'selection', 'date', 'checkbox']),
502
565
  value: index["default"].oneOfType([index["default"].string, index["default"].node, index["default"].object])
503
566
  };
504
567
 
@@ -78,7 +78,7 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
78
78
  };
79
79
 
80
80
  // Stop grid key listener when in edit mode
81
- var isEditing = document.activeElement.id === activeCellId && document.activeElement.id === editId || dropdownIsActive() || datePickerIsActive();
81
+ var isEditing = focusedCell.getAttribute('data-inline-type') !== 'checkbox' && document.activeElement.id === activeCellId && document.activeElement.id === editId || dropdownIsActive() || datePickerIsActive();
82
82
  if (isEditing || !gridActive) {
83
83
  return;
84
84
  }
@@ -91,6 +91,7 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
91
91
  event.preventDefault();
92
92
  }
93
93
  var isDisabledCell = focusedCell.getAttribute('data-disabled') === 'false' ? false : true;
94
+ var isEditableCell = !event.target.classList.contains("".concat(blockClass, "__inline-edit-button--non-edit"));
94
95
  var sharedUpdateParams = {
95
96
  oldId: activeCellId,
96
97
  instance: instance
@@ -198,7 +199,7 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
198
199
  case 'Enter':
199
200
  {
200
201
  // Disabled cells are not allowed to go into edit mode
201
- if (isDisabledCell) {
202
+ if (isDisabledCell || !isEditableCell) {
202
203
  return;
203
204
  }
204
205
  // Only go into edit mode if there is no editId, meaning that we're not already in edit mode
@@ -211,6 +212,13 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
211
212
  dropdownTrigger === null || dropdownTrigger === void 0 || dropdownTrigger.click();
212
213
  }, 1);
213
214
  }
215
+ if (focusedType === 'checkbox') {
216
+ setTimeout(function () {
217
+ var checkboxTrigger = focusedCell.querySelector('input');
218
+ checkboxTrigger === null || checkboxTrigger === void 0 || checkboxTrigger.click();
219
+ checkboxTrigger === null || checkboxTrigger === void 0 || checkboxTrigger.focus();
220
+ }, 1);
221
+ }
214
222
  if (focusedType === 'date') {
215
223
  setTimeout(function () {
216
224
  var dateInputTrigger = focusedCell.querySelector('input');
@@ -5,10 +5,10 @@ import { RadioButtonProps } from '@carbon/react/lib/components/RadioButton/Radio
5
5
  import { RadioButtonGroupProps } from '@carbon/react/lib/components/RadioButtonGroup/RadioButtonGroup';
6
6
  import { CheckboxProps } from '@carbon/react/lib/components/Checkbox';
7
7
  import { NumberInputProps } from '@carbon/react/lib/components/NumberInput/NumberInput';
8
- import { CSSProperties, JSXElementConstructor, MutableRefObject, ReactNode, TouchEventHandler } from 'react';
9
- import { Cell, Column, ColumnInstance, FilterValue, Filters, HeaderGroup, Meta, Row, TableCommonProps, TableDispatch, TableInstance, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseTableHooks } from 'react-table';
8
+ import React, { CSSProperties, ComponentType, FunctionComponent, JSXElementConstructor, MutableRefObject, ReactNode, TouchEventHandler } from 'react';
9
+ import { Cell, Column, ColumnInstance, FilterValue, Filters, HeaderGroup, Meta, Row, TableCommonProps, TableDispatch, TableInstance, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseSortByOptions, UseTableHooks } from 'react-table';
10
10
  import { CarbonIconType } from '@carbon/react/icons';
11
- import { type ButtonProps } from '@carbon/react';
11
+ import { IconButton, type ButtonProps } from '@carbon/react';
12
12
  import { TableBatchActionsProps } from '@carbon/react/lib/components/DataTable/TableBatchActions';
13
13
  export type Size = 'xs' | 'sm' | 'md' | 'lg';
14
14
  export interface ResizerProps {
@@ -85,9 +85,10 @@ export interface DataGridToggleAllRowsProps extends TableToggleAllRowsSelectedPr
85
85
  }
86
86
  export interface DatagridTableHooks<T extends object = any> extends UseTableHooks<T> {
87
87
  }
88
- export interface DatagridColumn<T extends object = any> extends ColumnInstance<T> {
88
+ export interface DatagridColumn<T extends object = any> extends ColumnInstance<T>, UseSortByOptions<T> {
89
89
  sticky?: 'left' | 'right';
90
90
  className?: string;
91
+ rightAlignedColumn?: boolean;
91
92
  disableSortBy?: boolean;
92
93
  centerAlignedColumn?: boolean;
93
94
  }
@@ -100,6 +101,7 @@ export interface DatagridRow<T extends object = any> extends Omit<Row<T>, 'cells
100
101
  RowExpansionRenderer?: (state?: DataGridState) => void;
101
102
  cells: Array<DataGridCell>;
102
103
  isSkeleton?: boolean;
104
+ hasExpanded?: boolean;
103
105
  }
104
106
  export interface DataGridHeader<T extends object = any> extends ColumnInstance, UseResizeColumnsColumnProps<T>, UseSortByColumnProps<T> {
105
107
  className(className: any, arg1: {
@@ -120,6 +122,16 @@ interface DataGridTableState extends UseResizeColumnsState<any>, UseRowSelectSta
120
122
  }
121
123
  export interface DataGridTableInstance<T extends object = any> extends TableInstance<T> {
122
124
  }
125
+ export interface RowAction {
126
+ id?: string;
127
+ itemText?: string;
128
+ icon?: ComponentType | FunctionComponent;
129
+ align?: React.ComponentProps<typeof IconButton>['align'];
130
+ shouldHideMenuItem?: (...args: any[]) => void;
131
+ shouldDisableMenuItem?: (...args: any[]) => void;
132
+ disabled?: boolean;
133
+ onClick?: (...args: any[]) => void;
134
+ }
123
135
  export interface DataGridState<T extends object = any> extends TableCommonProps, UsePaginationInstanceProps<T>, Omit<TableInstance<T>, 'state' | 'headers' | 'rows' | 'columns'>, Omit<UseFiltersInstanceProps<T>, 'rows'>, UseRowSelectInstanceProps<T>, Pick<UseRowSelectInstanceProps<T>, 'toggleAllRowsSelected'> {
124
136
  withVirtualScroll?: boolean;
125
137
  DatagridPagination?: JSXElementConstructor<any>;
@@ -142,6 +154,7 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
142
154
  batchActions?: boolean;
143
155
  row: DatagridRow;
144
156
  rows: Array<DatagridRow<any>>;
157
+ rowActions?: RowAction[];
145
158
  columns: Array<DatagridColumn>;
146
159
  key?: any;
147
160
  rowSize?: Size;
@@ -217,4 +230,5 @@ export interface ResizeHeaderProps {
217
230
  isFetching?: boolean;
218
231
  }
219
232
  export type VisibleColumns<T extends object = {}> = (allColumns: Array<ColumnInstance<T>>, meta: Meta<T>) => Array<Column<T>>;
233
+ export type NodeFuncType = (props: any) => ReactNode;
220
234
  export {};
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2021, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useActionsColumn: (hooks: Hooks) => void;
1
9
  export default useActionsColumn;
2
- declare function useActionsColumn(hooks: any): void;