@carbon/ibm-products 2.49.1-rc.0 → 2.50.0-rc.0

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 (116) hide show
  1. package/css/index-full-carbon.css +1180 -1148
  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 +3 -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 +5 -0
  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 +27 -20
  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/AboutModal/AboutModal.js +23 -6
  18. package/es/components/ActionBar/ActionBar.d.ts +5 -1
  19. package/es/components/ActionBar/ActionBar.js +13 -3
  20. package/es/components/ActionBar/ActionBarOverflowItems.d.ts +12 -3
  21. package/es/components/ActionBar/ActionBarOverflowItems.js +13 -3
  22. package/es/components/Carousel/Carousel.js +1 -2
  23. package/es/components/Coachmark/CoachmarkDragbar.js +0 -1
  24. package/es/components/Coachmark/CoachmarkHeader.js +0 -1
  25. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +0 -1
  26. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +0 -1
  27. package/es/components/CoachmarkStack/CoachmarkStackHome.js +1 -2
  28. package/es/components/ConditionBuilder/ConditionBuilder.js +1 -3
  29. package/es/components/CreateTearsheet/CreateTearsheet.d.ts +6 -0
  30. package/es/components/CreateTearsheet/CreateTearsheet.js +13 -1
  31. package/es/components/CreateTearsheet/CreateTearsheetStep.d.ts +18 -0
  32. package/es/components/CreateTearsheet/CreateTearsheetStep.js +30 -3
  33. package/es/components/Datagrid/Datagrid/DatagridContent.js +4 -1
  34. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -21
  35. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +7 -2
  36. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -3
  37. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +4 -1
  38. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +3 -1
  39. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -1
  40. package/es/components/Datagrid/Datagrid/addons/stateReducer.d.ts +7 -0
  41. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +99 -41
  42. package/es/components/Datagrid/types/index.d.ts +2 -0
  43. package/es/components/Datagrid/useDisableSelectRows.js +18 -3
  44. package/es/components/Datagrid/useFlexResize.d.ts +0 -6
  45. package/es/components/Datagrid/useFlexResize.js +33 -17
  46. package/es/components/Datagrid/useSortableColumns.js +2 -1
  47. package/es/components/EditUpdateCards/EditUpdateCards.d.ts +1 -1
  48. package/es/components/EditUpdateCards/EditUpdateCards.js +1 -2
  49. package/es/components/PageHeader/PageHeader.js +12 -2
  50. package/es/components/PageHeader/PageHeaderUtils.js +0 -5
  51. package/es/components/SidePanel/SidePanel.js +6 -6
  52. package/es/components/TagOverflow/TagOverflow.d.ts +1 -1
  53. package/es/components/TagOverflow/TagOverflow.js +1 -2
  54. package/es/components/TagSet/TagSet.d.ts +8 -6
  55. package/es/components/TagSet/TagSet.js +38 -30
  56. package/es/components/TagSet/TagSetOverflow.d.ts +4 -0
  57. package/es/components/TagSet/TagSetOverflow.js +8 -2
  58. package/es/components/Tearsheet/Tearsheet.d.ts +1 -1
  59. package/es/components/Tearsheet/TearsheetNarrow.d.ts +1 -1
  60. package/es/components/Tearsheet/TearsheetShell.d.ts +1 -1
  61. package/es/components/Tearsheet/TearsheetShell.js +2 -1
  62. package/es/global/js/hooks/useCreateComponentStepChange.d.ts +3 -1
  63. package/es/global/js/hooks/useCreateComponentStepChange.js +18 -2
  64. package/es/global/js/utils/Wrap.d.ts +4 -0
  65. package/lib/components/AboutModal/AboutModal.js +22 -5
  66. package/lib/components/ActionBar/ActionBar.d.ts +5 -1
  67. package/lib/components/ActionBar/ActionBar.js +13 -3
  68. package/lib/components/ActionBar/ActionBarOverflowItems.d.ts +12 -3
  69. package/lib/components/ActionBar/ActionBarOverflowItems.js +13 -3
  70. package/lib/components/Carousel/Carousel.js +1 -2
  71. package/lib/components/Coachmark/CoachmarkDragbar.js +0 -1
  72. package/lib/components/Coachmark/CoachmarkHeader.js +0 -1
  73. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +0 -1
  74. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +0 -1
  75. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +1 -2
  76. package/lib/components/ConditionBuilder/ConditionBuilder.js +1 -3
  77. package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +6 -0
  78. package/lib/components/CreateTearsheet/CreateTearsheet.js +13 -1
  79. package/lib/components/CreateTearsheet/CreateTearsheetStep.d.ts +18 -0
  80. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +29 -2
  81. package/lib/components/Datagrid/Datagrid/DatagridContent.js +4 -1
  82. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +3 -20
  83. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +7 -2
  84. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -3
  85. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +4 -1
  86. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +3 -1
  87. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -1
  88. package/lib/components/Datagrid/Datagrid/addons/stateReducer.d.ts +7 -0
  89. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +99 -40
  90. package/lib/components/Datagrid/types/index.d.ts +2 -0
  91. package/lib/components/Datagrid/useDisableSelectRows.js +18 -3
  92. package/lib/components/Datagrid/useFlexResize.d.ts +0 -6
  93. package/lib/components/Datagrid/useFlexResize.js +32 -16
  94. package/lib/components/Datagrid/useSortableColumns.js +2 -1
  95. package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +1 -1
  96. package/lib/components/EditUpdateCards/EditUpdateCards.js +1 -2
  97. package/lib/components/PageHeader/PageHeader.js +11 -1
  98. package/lib/components/PageHeader/PageHeaderUtils.js +0 -5
  99. package/lib/components/SidePanel/SidePanel.js +6 -6
  100. package/lib/components/TagOverflow/TagOverflow.d.ts +1 -1
  101. package/lib/components/TagOverflow/TagOverflow.js +1 -2
  102. package/lib/components/TagSet/TagSet.d.ts +8 -6
  103. package/lib/components/TagSet/TagSet.js +38 -30
  104. package/lib/components/TagSet/TagSetOverflow.d.ts +4 -0
  105. package/lib/components/TagSet/TagSetOverflow.js +8 -2
  106. package/lib/components/Tearsheet/Tearsheet.d.ts +1 -1
  107. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +1 -1
  108. package/lib/components/Tearsheet/TearsheetShell.d.ts +1 -1
  109. package/lib/components/Tearsheet/TearsheetShell.js +2 -1
  110. package/lib/global/js/hooks/useCreateComponentStepChange.d.ts +3 -1
  111. package/lib/global/js/hooks/useCreateComponentStepChange.js +18 -2
  112. package/lib/global/js/utils/Wrap.d.ts +4 -0
  113. package/package.json +12 -12
  114. package/scss/components/Datagrid/styles/_useSortableColumns.scss +1 -0
  115. package/scss/components/Tearsheet/_tearsheet.scss +2 -0
  116. package/telemetry.yml +6 -0
@@ -5,8 +5,10 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from 'react';
8
+ import { ExperimentalSecondarySubmit } from './CreateTearsheetStep';
8
9
  export interface StepsContextType {
9
10
  currentStep: number;
11
+ setExperimentalSecondarySubmit: Dispatch<SetStateAction<ExperimentalSecondarySubmit>>;
10
12
  setIsDisabled: Dispatch<SetStateAction<boolean>>;
11
13
  setOnPrevious: (fn: any) => void;
12
14
  setOnNext: (fn: any) => void;
@@ -32,6 +34,10 @@ export interface CreateTearsheetProps extends PropsWithChildren {
32
34
  * An optional class or classes to be added to the outermost element.
33
35
  */
34
36
  className?: string;
37
+ /**
38
+ * The experimentalSecondary submit button text
39
+ */
40
+ experimentalSecondarySubmitText?: string;
35
41
  /**
36
42
  * A description of the flow, displayed in the header area of the tearsheet.
37
43
  */
@@ -31,7 +31,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
31
31
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
32
32
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
33
33
 
34
- var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "description", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "firstFocusElement", "slug", "submitButtonText", "title", "verticalPosition"];
34
+ var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "experimentalSecondarySubmitText", "description", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "firstFocusElement", "slug", "submitButtonText", "title", "verticalPosition"];
35
35
  var componentName = 'CreateTearsheet';
36
36
  var blockClass = "".concat(settings.pkg.prefix, "--tearsheet-create");
37
37
 
@@ -49,6 +49,7 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
49
49
  cancelButtonText = _ref.cancelButtonText,
50
50
  children = _ref.children,
51
51
  className = _ref.className,
52
+ experimentalSecondarySubmitText = _ref.experimentalSecondarySubmitText,
52
53
  description = _ref.description,
53
54
  _ref$influencerWidth = _ref.influencerWidth,
54
55
  influencerWidth = _ref$influencerWidth === void 0 ? 'narrow' : _ref$influencerWidth,
@@ -113,6 +114,10 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
113
114
  _useState24 = _rollupPluginBabelHelpers.slicedToArray(_useState23, 2),
114
115
  lastIncludedStep = _useState24[0],
115
116
  setLastIncludedStep = _useState24[1];
117
+ var _useState25 = React.useState({}),
118
+ _useState26 = _rollupPluginBabelHelpers.slicedToArray(_useState25, 2),
119
+ experimentalSecondarySubmit = _useState26[0],
120
+ setExperimentalSecondarySubmit = _useState26[1];
116
121
  var previousState = usePreviousValue.usePreviousValue({
117
122
  currentStep: currentStep,
118
123
  open: open
@@ -179,6 +184,8 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
179
184
  nextButtonText: nextButtonText,
180
185
  isSubmitting: isSubmitting,
181
186
  componentBlockClass: blockClass,
187
+ experimentalSecondarySubmit: experimentalSecondarySubmit,
188
+ experimentalSecondarySubmitText: experimentalSecondarySubmit.labelText ? experimentalSecondarySubmit.labelText : experimentalSecondarySubmitText,
182
189
  setCreateComponentActions: setCreateTearsheetActions
183
190
  });
184
191
  return /*#__PURE__*/React__default["default"].createElement(TearsheetShell.TearsheetShell, _rollupPluginBabelHelpers["extends"]({}, devtools.getDevtoolsProps(componentName), rest, {
@@ -207,6 +214,7 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
207
214
  }, /*#__PURE__*/React__default["default"].createElement(StepsContext.Provider, {
208
215
  value: {
209
216
  currentStep: currentStep,
217
+ setExperimentalSecondarySubmit: setExperimentalSecondarySubmit,
210
218
  setIsDisabled: setIsDisabled,
211
219
  setOnPrevious: function setOnPrevious(fn) {
212
220
  return _setOnPrevious(function () {
@@ -263,6 +271,10 @@ exports.CreateTearsheet.propTypes = {
263
271
  * A description of the flow, displayed in the header area of the tearsheet.
264
272
  */
265
273
  description: index["default"].node,
274
+ /**
275
+ * The experimentalSecondary submit button text
276
+ */
277
+ experimentalSecondarySubmitText: index["default"].string,
266
278
  /**
267
279
  * Specifies elements to focus on first on render.
268
280
  */
@@ -49,6 +49,10 @@ interface CreateTearsheetStepBaseProps extends PropsWithChildren {
49
49
  * This will conditionally disable the submit button in the multi step Tearsheet
50
50
  */
51
51
  disableSubmit?: boolean;
52
+ /**
53
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
54
+ */
55
+ experimentalSecondarySubmit?: ExperimentalSecondarySubmit;
52
56
  /**
53
57
  * This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
54
58
  * steps. If this value is `true` then the step will be included in the list of visible steps, as well as being included in the ProgressIndicator step list
@@ -91,5 +95,19 @@ interface CreateTearsheetStepBaseProps extends PropsWithChildren {
91
95
  title: React.ReactNode;
92
96
  }
93
97
  type CreateTearsheetStepProps = CreateTearsheetStepBaseProps & fieldsetLegendTextProps;
98
+ /**
99
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
100
+ *
101
+ * @property {string} [labelText] - Optional text to replace the default button text.
102
+ * @property {boolean} [disabled] - If true, the button will be disabled and not clickable.
103
+ * @property {boolean} [hideSecondarySubmit] - If true, the button will be hidden from view.
104
+ * @property {() => void} [onClick] - Optional click handler function to be executed when the button is clicked.
105
+ */
106
+ export type ExperimentalSecondarySubmit = {
107
+ labelText?: string;
108
+ disabled?: boolean;
109
+ hideSecondarySubmit?: boolean;
110
+ onClick?: () => void;
111
+ };
94
112
  export declare let CreateTearsheetStep: React.ForwardRefExoticComponent<CreateTearsheetStepProps & React.RefAttributes<unknown>>;
95
113
  export {};
@@ -25,7 +25,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
25
25
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
26
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
27
27
 
28
- var _excluded = ["children", "className", "description", "disableSubmit", "fieldsetLegendText", "hasFieldset", "includeStep", "introStep", "invalid", "onMount", "onNext", "onPrevious", "secondaryLabel", "subtitle", "title"];
28
+ var _excluded = ["children", "className", "description", "disableSubmit", "experimentalSecondarySubmit", "fieldsetLegendText", "hasFieldset", "includeStep", "introStep", "invalid", "onMount", "onNext", "onPrevious", "secondaryLabel", "subtitle", "title"];
29
29
  var componentName = 'CreateTearsheetStep';
30
30
  var blockClass = "".concat(settings.pkg.prefix, "--tearsheet-create__step");
31
31
 
@@ -34,11 +34,22 @@ var defaults = {
34
34
  hasFieldset: true,
35
35
  includeStep: true
36
36
  };
37
+
38
+ /**
39
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
40
+ *
41
+ * @property {string} [labelText] - Optional text to replace the default button text.
42
+ * @property {boolean} [disabled] - If true, the button will be disabled and not clickable.
43
+ * @property {boolean} [hideSecondarySubmit] - If true, the button will be hidden from view.
44
+ * @property {() => void} [onClick] - Optional click handler function to be executed when the button is clicked.
45
+ */
46
+
37
47
  exports.CreateTearsheetStep = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
38
48
  var children = _ref.children,
39
49
  className = _ref.className,
40
50
  description = _ref.description,
41
51
  disableSubmit = _ref.disableSubmit,
52
+ experimentalSecondarySubmit = _ref.experimentalSecondarySubmit,
42
53
  fieldsetLegendText = _ref.fieldsetLegendText,
43
54
  _ref$hasFieldset = _ref.hasFieldset,
44
55
  hasFieldset = _ref$hasFieldset === void 0 ? defaults.hasFieldset : _ref$hasFieldset,
@@ -80,8 +91,9 @@ exports.CreateTearsheetStep = /*#__PURE__*/React.forwardRef(function (_ref, ref)
80
91
  React.useEffect(function () {
81
92
  if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep) && (previousState === null || previousState === void 0 ? void 0 : previousState.currentStep) !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
82
93
  stepsContext === null || stepsContext === void 0 || stepsContext.setOnMount(onMount);
94
+ stepsContext === null || stepsContext === void 0 || stepsContext.setExperimentalSecondarySubmit(_rollupPluginBabelHelpers.objectSpread2({}, experimentalSecondarySubmit));
83
95
  }
84
- }, [onMount, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]);
96
+ }, [onMount, experimentalSecondarySubmit, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]);
85
97
 
86
98
  // Used to take the `includeStep` prop and use it as a local state value
87
99
  React.useEffect(function () {
@@ -172,6 +184,21 @@ exports.CreateTearsheetStep.propTypes = {
172
184
  * This will conditionally disable the submit button in the multi step Tearsheet
173
185
  */
174
186
  disableSubmit: index["default"].bool,
187
+ /**
188
+ * Configuration options for customizing the behavior of the experimentalSecondary submit button.
189
+ *
190
+ * @property {string} [labelText] - Optional text to replace the default button text.
191
+ * @property {boolean} [disabled] - If true, the button will be disabled and not clickable.
192
+ * @property {boolean} [hideSecondarySubmit] - If true, the button will be hidden from view.
193
+ * @property {() => void} [onClick] - Optional click handler function to be executed when the button is clicked.
194
+ */
195
+ /**@ts-ignore*/
196
+ experimentalSecondarySubmit: index["default"].shape({
197
+ labelText: index["default"].string,
198
+ disabled: index["default"].bool,
199
+ hideSecondarySubmit: index["default"].bool,
200
+ onClick: index["default"].func
201
+ }),
175
202
  /**
176
203
  * This is the required legend text that appears above a fieldset html element for accessibility purposes.
177
204
  * You can set the `hasFieldset` prop to false if you have multiple fieldset elements or want to control the children of your Full Page's step content.
@@ -168,7 +168,10 @@ var DatagridContent = function DatagridContent(_ref) {
168
168
  className: "".concat(blockClass, "__filter-summary"),
169
169
  filters: filterTags,
170
170
  clearFilters: function clearFilters() {
171
- return EventEmitter.dispatch(constants.CLEAR_FILTERS, tableId);
171
+ EventEmitter.dispatch(constants.CLEAR_FILTERS, tableId);
172
+ if (typeof (filterProps === null || filterProps === void 0 ? void 0 : filterProps.onClearFilters) === 'function') {
173
+ filterProps.onClearFilters();
174
+ }
172
175
  },
173
176
  renderLabel: filterProps === null || filterProps === void 0 ? void 0 : filterProps.renderLabel,
174
177
  overflowType: "tag"
@@ -54,7 +54,6 @@ var SelectAll = function SelectAll(datagridState) {
54
54
  dispatch = datagridState.dispatch,
55
55
  rows = datagridState.rows,
56
56
  getRowId = datagridState.getRowId,
57
- toggleAllRowsSelected = datagridState.toggleAllRowsSelected,
58
57
  onAllRowSelect = datagridState.onAllRowSelect;
59
58
  var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
60
59
  if (hideSelectAll || radio) {
@@ -68,24 +67,8 @@ var SelectAll = function SelectAll(datagridState) {
68
67
  onChange = _ref.onChange,
69
68
  selectProps = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
70
69
  var indeterminate = selectProps.indeterminate;
71
- var handleSelectAllChange = function handleSelectAllChange(event) {
72
- if (indeterminate) {
73
- stateReducer.handleSelectAllRowData({
74
- dispatch: dispatch,
75
- rows: rows,
76
- getRowId: getRowId,
77
- indeterminate: true,
78
- isChecked: undefined
79
- });
80
- toggleAllRowsSelected(false);
81
- onAllRowSelect === null || onAllRowSelect === void 0 || onAllRowSelect(rows, event);
82
- return onChange === null || onChange === void 0 ? void 0 : onChange({
83
- target: {
84
- checked: false
85
- }
86
- });
87
- }
88
- stateReducer.handleSelectAllRowData({
70
+ var handleOnPageSelectAllChange = function handleOnPageSelectAllChange(event) {
71
+ stateReducer.handleOnPageSelectAllRowData({
89
72
  dispatch: dispatch,
90
73
  rows: rows,
91
74
  getRowId: getRowId,
@@ -99,7 +82,7 @@ var SelectAll = function SelectAll(datagridState) {
99
82
  className: cx__default["default"]("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__checkbox-cell-sticky-left"), /* istanbul ignore next */
100
83
  isFirstColumnStickyLeft && Number(windowSize) > 671)),
101
84
  name: "".concat(tableId, "-select-all-checkbox-name"),
102
- onSelect: handleSelectAllChange,
85
+ onSelect: handleOnPageSelectAllChange,
103
86
  disabled: isFetching || (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled),
104
87
  id: "".concat(tableId, "-select-all-checkbox-id")
105
88
  }));
@@ -76,10 +76,15 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
76
76
 
77
77
  // Sync the scrollLeft position of the virtual body to the table header
78
78
  React.useEffect(function () {
79
+ var _document;
80
+ var headWrapEl = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap"));
81
+ var headEle = headWrapEl === null || headWrapEl === void 0 ? void 0 : headWrapEl.querySelector("thead");
82
+ if (headEle) {
83
+ headEle.style.display = 'flex';
84
+ } // scrollbar width to header column to fix header alignment
85
+
79
86
  function handleScroll(event) {
80
- var _document;
81
87
  var virtualBody = event.target;
82
- var headWrapEl = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap"));
83
88
  if (headWrapEl) {
84
89
  headWrapEl.scrollLeft = virtualBody === null || virtualBody === void 0 ? void 0 : virtualBody.scrollLeft;
85
90
  }
@@ -40,6 +40,9 @@ var defaults = {
40
40
  secondaryActionLabel: 'Cancel',
41
41
  align: 'bottom'
42
42
  };
43
+
44
+ // Use same empty array every time, for benefit of useEffect() etc. dependency checking.
45
+ var emptyArray = [];
43
46
  var FilterFlyout = function FilterFlyout(_ref) {
44
47
  var updateMethod = _ref.updateMethod,
45
48
  _ref$flyoutIconDescri = _ref.flyoutIconDescription,
@@ -47,7 +50,7 @@ var FilterFlyout = function FilterFlyout(_ref) {
47
50
  _ref$align = _ref.align,
48
51
  align = _ref$align === void 0 ? defaults.align : _ref$align,
49
52
  _ref$filters = _ref.filters,
50
- filters = _ref$filters === void 0 ? [] : _ref$filters,
53
+ filters = _ref$filters === void 0 ? emptyArray : _ref$filters,
51
54
  _ref$title = _ref.title,
52
55
  title = _ref$title === void 0 ? defaults.title : _ref$title,
53
56
  _ref$primaryActionLab = _ref.primaryActionLabel,
@@ -64,9 +67,9 @@ var FilterFlyout = function FilterFlyout(_ref) {
64
67
  secondaryActionLabel = _ref$secondaryActionL === void 0 ? defaults.secondaryActionLabel : _ref$secondaryActionL,
65
68
  setAllFilters = _ref.setAllFilters,
66
69
  _ref$data = _ref.data,
67
- data = _ref$data === void 0 ? [] : _ref$data,
70
+ data = _ref$data === void 0 ? emptyArray : _ref$data,
68
71
  _ref$reactTableFilter = _ref.reactTableFiltersState,
69
- reactTableFiltersState = _ref$reactTableFilter === void 0 ? [] : _ref$reactTableFilter;
72
+ reactTableFiltersState = _ref$reactTableFilter === void 0 ? emptyArray : _ref$reactTableFilter;
70
73
  /** State */
71
74
  var _useState = React.useState(false),
72
75
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
@@ -43,6 +43,9 @@ var defaults = {
43
43
  searchLabelText: 'Filter search',
44
44
  searchPlaceholder: 'Find filters'
45
45
  };
46
+
47
+ // Use same empty array every time, for benefit of useEffect() etc. dependency checking.
48
+ var emptyArray = [];
46
49
  var FilterPanel = function FilterPanel(_ref) {
47
50
  var _ref$title = _ref.title,
48
51
  title = _ref$title === void 0 ? defaults.title : _ref$title,
@@ -72,7 +75,7 @@ var FilterPanel = function FilterPanel(_ref) {
72
75
  _ref$searchPlaceholde = _ref.searchPlaceholder,
73
76
  searchPlaceholder = _ref$searchPlaceholde === void 0 ? defaults.searchPlaceholder : _ref$searchPlaceholde,
74
77
  _ref$reactTableFilter = _ref.reactTableFiltersState,
75
- reactTableFiltersState = _ref$reactTableFilter === void 0 ? [] : _ref$reactTableFilter,
78
+ reactTableFiltersState = _ref$reactTableFilter === void 0 ? emptyArray : _ref$reactTableFilter,
76
79
  _ref$autoHideFilters = _ref.autoHideFilters,
77
80
  autoHideFilters = _ref$autoHideFilters === void 0 ? false : _ref$autoHideFilters,
78
81
  _ref$isFetching = _ref.isFetching,
@@ -24,10 +24,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
24
24
 
25
25
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
26
 
27
+ // Use same empty array every time, for benefit of useEffect() etc. dependency checking.
28
+ var emptyArray = [];
27
29
  var useFilters = function useFilters(_ref) {
28
30
  var updateMethod = _ref.updateMethod,
29
31
  _ref$filters = _ref.filters,
30
- filters = _ref$filters === void 0 ? [] : _ref$filters,
32
+ filters = _ref$filters === void 0 ? emptyArray : _ref$filters,
31
33
  setAllFilters = _ref.setAllFilters,
32
34
  variation = _ref.variation,
33
35
  reactTableFiltersState = _ref.reactTableFiltersState,
@@ -41,7 +41,7 @@ var RowSizeRadioGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
41
41
  ref: ref
42
42
  }, /*#__PURE__*/React__default["default"].createElement(react.RadioButtonGroup, {
43
43
  legendText: legendText,
44
- name: "row-height-group",
44
+ name: "".concat(tableId, "--row-height-group"),
45
45
  orientation: "vertical",
46
46
  defaultSelected: getBackwardCompatibleRowSize(selectedOption),
47
47
  onChange: onChange
@@ -14,6 +14,13 @@ export function handleSelectAllRowData({ dispatch, rows, getRowId, indeterminate
14
14
  indeterminate: any;
15
15
  isChecked: any;
16
16
  }): any;
17
+ export function handleOnPageSelectAllRowData({ dispatch, rows, getRowId, indeterminate, isChecked, }: {
18
+ dispatch: any;
19
+ rows: any;
20
+ getRowId: any;
21
+ indeterminate: any;
22
+ isChecked: any;
23
+ }): any;
17
24
  export function handleDynamicRowCheck({ dispatch, status, rowId, depth, index, }: {
18
25
  dispatch: any;
19
26
  status: any;
@@ -16,8 +16,9 @@ var COLUMN_RESIZE_START = 'columnStartResizing';
16
16
  var COLUMN_RESIZING = 'columnResizing';
17
17
  var COLUMN_RESIZE_END = 'columnDoneResizing';
18
18
  var INIT = 'init';
19
- var TOGGLE_ROW_SELECTED = 'toggleRowSelected';
20
- var TOGGLE_ALL_ROWS_SELECTED = 'toggleAllRowsSelected';
19
+ var TOGGLE_ROW_SELECTED = 'toggleRowSelected'; // selects individual row
20
+ var TOGGLE_ALL_ROWS_SELECTED = 'toggleAllRowsSelected'; // selects all rows in entire table
21
+ var TOGGLE_ON_PAGE_ALL_ROWS_SELECTED = 'toggleAllRowsOnPageSelected'; // selects all rows in the current page
21
22
  var DYNAMIC_ROW_CHECK = 'dynamicRowCheck';
22
23
  var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
23
24
  var handleColumnResizeEndEvent = function handleColumnResizeEndEvent(dispatch, onColResizeEnd, headerId, isKeyEvent) {
@@ -82,12 +83,28 @@ var handleSelectAllRowData = function handleSelectAllRowData(_ref2) {
82
83
  }
83
84
  });
84
85
  };
85
- var handleDynamicRowCheck = function handleDynamicRowCheck(_ref3) {
86
+ var handleOnPageSelectAllRowData = function handleOnPageSelectAllRowData(_ref3) {
86
87
  var dispatch = _ref3.dispatch,
87
- status = _ref3.status,
88
- rowId = _ref3.rowId,
89
- depth = _ref3.depth,
90
- index = _ref3.index;
88
+ rows = _ref3.rows,
89
+ getRowId = _ref3.getRowId,
90
+ indeterminate = _ref3.indeterminate,
91
+ isChecked = _ref3.isChecked;
92
+ return dispatch({
93
+ type: TOGGLE_ON_PAGE_ALL_ROWS_SELECTED,
94
+ payload: {
95
+ rows: rows,
96
+ getRowId: getRowId,
97
+ indeterminate: indeterminate,
98
+ isChecked: isChecked
99
+ }
100
+ });
101
+ };
102
+ var handleDynamicRowCheck = function handleDynamicRowCheck(_ref4) {
103
+ var dispatch = _ref4.dispatch,
104
+ status = _ref4.status,
105
+ rowId = _ref4.rowId,
106
+ depth = _ref4.depth,
107
+ index = _ref4.index;
91
108
  return dispatch({
92
109
  type: DYNAMIC_ROW_CHECK,
93
110
  payload: {
@@ -128,18 +145,20 @@ var stateReducer = function stateReducer(newState, action) {
128
145
  }
129
146
  case TOGGLE_ALL_ROWS_SELECTED:
130
147
  {
131
- var _ref4 = action.payload || {},
132
- rows = _ref4.rows,
133
- getRowId = _ref4.getRowId,
134
- indeterminate = _ref4.indeterminate,
135
- isChecked = _ref4.isChecked;
148
+ var _ref5 = action.payload || {},
149
+ rows = _ref5.rows,
150
+ getRowId = _ref5.getRowId,
151
+ indeterminate = _ref5.indeterminate,
152
+ isChecked = _ref5.isChecked;
136
153
  var newSelectedRowIds = {};
137
154
  if (rows) {
155
+ var _rows$find, _rows$find$getRowProp;
138
156
  var newSelectedRowData = {};
157
+ var nonSelectableRows = ((_rows$find = rows.find(function (row) {
158
+ return row.getRowProps;
159
+ })) === null || _rows$find === void 0 || (_rows$find$getRowProp = _rows$find.getRowProps) === null || _rows$find$getRowProp === void 0 || (_rows$find$getRowProp = _rows$find$getRowProp.call(_rows$find)) === null || _rows$find$getRowProp === void 0 ? void 0 : _rows$find$getRowProp.nonselectablerows) || [];
139
160
  rows.forEach(function (row) {
140
- var _row$getRowProps;
141
- var props = (_row$getRowProps = row.getRowProps) === null || _row$getRowProps === void 0 ? void 0 : _row$getRowProps.call(row);
142
- if (props && props.disabled) {
161
+ if (nonSelectableRows.length > 0 && nonSelectableRows.includes(row.id)) {
143
162
  return;
144
163
  }
145
164
  newSelectedRowIds[getRowId(row.original, row.index)] = true;
@@ -152,26 +171,65 @@ var stateReducer = function stateReducer(newState, action) {
152
171
  }
153
172
  return _rollupPluginBabelHelpers.objectSpread2({}, newState);
154
173
  }
174
+ case TOGGLE_ON_PAGE_ALL_ROWS_SELECTED:
175
+ {
176
+ var _ref6 = action.payload || {},
177
+ _rows = _ref6.rows,
178
+ _getRowId = _ref6.getRowId,
179
+ _indeterminate = _ref6.indeterminate,
180
+ _isChecked = _ref6.isChecked;
181
+ var previousSelectedRowIds = newState.selectedRowIds || {};
182
+ var previousSelectedRowData = newState.selectedRowData || {};
183
+ var _newSelectedRowIds = {};
184
+ if (_rows) {
185
+ var _newSelectedRowData = {};
186
+ _rows.forEach(function (row) {
187
+ var _row$getRowProps;
188
+ var props = (_row$getRowProps = row.getRowProps) === null || _row$getRowProps === void 0 ? void 0 : _row$getRowProps.call(row);
189
+ if (props && props.disabled) {
190
+ return;
191
+ }
192
+ if (props) {
193
+ if (!_indeterminate && _isChecked) {
194
+ // adds selection to newly selected rows
195
+ _newSelectedRowIds[_getRowId(row.original, row.index)] = true;
196
+ _newSelectedRowData[_getRowId(row.original, row.index)] = row.original;
197
+ } else {
198
+ // removes selection from previously selected rows
199
+ delete previousSelectedRowIds[_getRowId(row.original, row.index)];
200
+ delete previousSelectedRowData[_getRowId(row.original, row.index)];
201
+ }
202
+ }
203
+ });
204
+ var finalSelectedRowIds = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, previousSelectedRowIds), _newSelectedRowIds);
205
+ var finalSelectedRowData = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, previousSelectedRowData), _newSelectedRowData);
206
+ return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, newState), {}, {
207
+ selectedRowIds: finalSelectedRowIds,
208
+ selectedRowData: finalSelectedRowData
209
+ });
210
+ }
211
+ return _rollupPluginBabelHelpers.objectSpread2({}, newState);
212
+ }
155
213
  case TOGGLE_ROW_SELECTED:
156
214
  {
157
- var _ref5 = action.payload || {},
158
- rowData = _ref5.rowData,
159
- _isChecked = _ref5.isChecked,
160
- _getRowId = _ref5.getRowId;
215
+ var _ref7 = action.payload || {},
216
+ rowData = _ref7.rowData,
217
+ _isChecked2 = _ref7.isChecked,
218
+ _getRowId2 = _ref7.getRowId;
161
219
  if (!rowData) {
162
220
  return;
163
221
  }
164
- if (_isChecked) {
222
+ if (_isChecked2) {
165
223
  return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, newState), {}, {
166
- selectedRowData: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, newState.selectedRowData), {}, _rollupPluginBabelHelpers.defineProperty({}, _getRowId(rowData.original, rowData.index), rowData.original))
224
+ selectedRowData: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, newState.selectedRowData), {}, _rollupPluginBabelHelpers.defineProperty({}, _getRowId2(rowData.original, rowData.index), rowData.original))
167
225
  });
168
226
  }
169
- if (rowData && !_isChecked) {
227
+ if (rowData && !_isChecked2) {
170
228
  var newData = _rollupPluginBabelHelpers.objectSpread2({}, newState.selectedRowData);
171
- var dataWithRemovedRow = Object.fromEntries(Object.entries(newData).filter(function (_ref6) {
172
- var _ref7 = _rollupPluginBabelHelpers.slicedToArray(_ref6, 1),
173
- key = _ref7[0];
174
- return parseInt(key) !== parseInt(_getRowId(rowData.original, rowData.index));
229
+ var dataWithRemovedRow = Object.fromEntries(Object.entries(newData).filter(function (_ref8) {
230
+ var _ref9 = _rollupPluginBabelHelpers.slicedToArray(_ref8, 1),
231
+ key = _ref9[0];
232
+ return parseInt(key) !== parseInt(_getRowId2(rowData.original, rowData.index));
175
233
  }));
176
234
  return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, newState), {}, {
177
235
  selectedRowData: dataWithRemovedRow
@@ -187,27 +245,27 @@ var stateReducer = function stateReducer(newState, action) {
187
245
  }
188
246
  case COLUMN_RESIZE_START:
189
247
  {
190
- var _ref8 = action.payload || {},
191
- headerId = _ref8.headerId;
248
+ var _ref10 = action.payload || {},
249
+ headerId = _ref10.headerId;
192
250
  return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, newState), {}, {
193
251
  isResizing: headerId
194
252
  });
195
253
  }
196
254
  case COLUMN_RESIZING:
197
255
  {
198
- var _ref9 = action.payload || {},
199
- _headerId = _ref9.headerId,
200
- newWidth = _ref9.newWidth,
201
- defaultWidth = _ref9.defaultWidth;
256
+ var _ref11 = action.payload || {},
257
+ _headerId = _ref11.headerId,
258
+ newWidth = _ref11.newWidth,
259
+ defaultWidth = _ref11.defaultWidth;
202
260
  var newColumnWidth = {};
203
261
  if (typeof _headerId === 'undefined') {
204
262
  return _rollupPluginBabelHelpers.objectSpread2({}, newState);
205
263
  }
206
264
  newColumnWidth[_headerId] = newWidth;
207
- var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (_ref10) {
208
- var _ref11 = _rollupPluginBabelHelpers.slicedToArray(_ref10, 2);
209
- _ref11[0];
210
- var value = _ref11[1];
265
+ var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (_ref12) {
266
+ var _ref13 = _rollupPluginBabelHelpers.slicedToArray(_ref12, 2);
267
+ _ref13[0];
268
+ var value = _ref13[1];
211
269
  return !isNaN(value);
212
270
  }));
213
271
  var headerIdArray = newState.columnResizing.headerIdWidths || [];
@@ -222,10 +280,10 @@ var stateReducer = function stateReducer(newState, action) {
222
280
  }
223
281
  case COLUMN_RESIZE_END:
224
282
  {
225
- var _ref12 = action.payload || {},
226
- onColResizeEnd = _ref12.onColResizeEnd,
227
- _headerId2 = _ref12.headerId,
228
- isKeyEvent = _ref12.isKeyEvent;
283
+ var _ref14 = action.payload || {},
284
+ onColResizeEnd = _ref14.onColResizeEnd,
285
+ _headerId2 = _ref14.headerId,
286
+ isKeyEvent = _ref14.isKeyEvent;
229
287
  var currentColumn = {};
230
288
  currentColumn[_headerId2] = newState.columnResizing.columnWidths[_headerId2];
231
289
  var allChangedColumns = newState.columnResizing.columnWidths;
@@ -254,6 +312,7 @@ var stateReducer = function stateReducer(newState, action) {
254
312
  exports.handleColumnResizeEndEvent = handleColumnResizeEndEvent;
255
313
  exports.handleColumnResizingEvent = handleColumnResizingEvent;
256
314
  exports.handleDynamicRowCheck = handleDynamicRowCheck;
315
+ exports.handleOnPageSelectAllRowData = handleOnPageSelectAllRowData;
257
316
  exports.handleSelectAllRowData = handleSelectAllRowData;
258
317
  exports.handleToggleRowSelected = handleToggleRowSelected;
259
318
  exports.stateReducer = stateReducer;
@@ -87,6 +87,7 @@ export interface FilterFlyoutProps {
87
87
  flyoutIconDescription?: string;
88
88
  onFlyoutClose?: () => void;
89
89
  onFlyoutOpen?: () => void;
90
+ onClearFilters?: () => void;
90
91
  panelIconDescription?: string;
91
92
  primaryActionLabel?: string;
92
93
  reactTableFiltersState?: ReactTableFiltersState[];
@@ -248,6 +249,7 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
248
249
  onRowExpand?: (row: DatagridRow, event: React.MouseEvent<HTMLElement>) => void;
249
250
  ExpandedRowContentComponent?: JSXElementConstructor<any>;
250
251
  getAsyncSubRows?: (row: DatagridRow) => void;
252
+ enableSpacerColumn?: boolean;
251
253
  }
252
254
  export interface DataGridData {
253
255
  instance?: DataGridTableInstance;
@@ -9,24 +9,39 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
+ var nonselectablerowsList = function nonselectablerowsList(instance) {
13
+ var _instance$rows;
14
+ var nonselectablerows = (instance === null || instance === void 0 || (_instance$rows = instance.rows) === null || _instance$rows === void 0 ? void 0 : _instance$rows.filter(function (row) {
15
+ return instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row);
16
+ }).map(function (row) {
17
+ return row.id;
18
+ })) || [];
19
+ return nonselectablerows;
20
+ };
12
21
  var useDisableSelectRows = function useDisableSelectRows(hooks) {
13
22
  updateSelectAll(hooks);
14
23
  updatePageSelectAll(hooks);
24
+ var nonselectablerows = [];
25
+ var useInstance = function useInstance(instance) {
26
+ nonselectablerows = nonselectablerowsList(instance);
27
+ };
28
+ hooks.useInstance.push(useInstance);
15
29
  var getRowProps = function getRowProps(props, _ref) {
16
30
  var _instance$shouldDisab;
17
31
  var row = _ref.row,
18
32
  instance = _ref.instance;
19
33
  return [props, {
20
- disabled: instance === null || instance === void 0 || (_instance$shouldDisab = instance.shouldDisableSelectRow) === null || _instance$shouldDisab === void 0 ? void 0 : _instance$shouldDisab.call(instance, row)
34
+ disabled: instance === null || instance === void 0 || (_instance$shouldDisab = instance.shouldDisableSelectRow) === null || _instance$shouldDisab === void 0 ? void 0 : _instance$shouldDisab.call(instance, row),
35
+ nonselectablerows: nonselectablerows
21
36
  }];
22
37
  };
23
38
  hooks.getRowProps.push(getRowProps);
24
39
  };
25
40
  var updateSelectAll = function updateSelectAll(hooks) {
26
41
  var getToggleAllRowsSelectedProps = function getToggleAllRowsSelectedProps(props, _ref2) {
27
- var _instance$rows, _instance$disableSele, _instance$state2;
42
+ var _instance$rows2, _instance$disableSele, _instance$state2;
28
43
  var instance = _ref2.instance;
29
- var selectableRows = (instance === null || instance === void 0 || (_instance$rows = instance.rows) === null || _instance$rows === void 0 ? void 0 : _instance$rows.filter(function (row) {
44
+ var selectableRows = (instance === null || instance === void 0 || (_instance$rows2 = instance.rows) === null || _instance$rows2 === void 0 ? void 0 : _instance$rows2.filter(function (row) {
30
45
  return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
31
46
  })) || [];
32
47
  var isAllRowsSelected = (selectableRows === null || selectableRows === void 0 ? void 0 : selectableRows.length) > 0 && selectableRows.every(function (_ref3) {
@@ -1,8 +1,2 @@
1
1
  export default useFlexResize;
2
- /**
3
- * Copyright IBM Corp. 2020, 2024
4
- *
5
- * This source code is licensed under the Apache-2.0 license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
2
  declare function useFlexResize(hooks: any): void;