@carbon/ibm-products 1.69.0 → 1.71.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. package/README.md +8 -4
  2. package/css/index-full-carbon.css +17 -12
  3. package/css/index-full-carbon.css.map +1 -1
  4. package/css/index-full-carbon.min.css +4 -4
  5. package/css/index-full-carbon.min.css.map +1 -1
  6. package/css/index-without-carbon-released-only.css +16 -12
  7. package/css/index-without-carbon-released-only.css.map +1 -1
  8. package/css/index-without-carbon-released-only.min.css +3 -3
  9. package/css/index-without-carbon-released-only.min.css.map +1 -1
  10. package/css/index-without-carbon.css +17 -12
  11. package/css/index-without-carbon.css.map +1 -1
  12. package/css/index-without-carbon.min.css +4 -4
  13. package/css/index-without-carbon.min.css.map +1 -1
  14. package/css/index.css +17 -12
  15. package/css/index.css.map +1 -1
  16. package/css/index.min.css +4 -4
  17. package/css/index.min.css.map +1 -1
  18. package/es/components/ButtonMenu/ButtonMenu.js +11 -1
  19. package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +6 -3
  20. package/es/components/Datagrid/Datagrid/DatagridContent.js +9 -8
  21. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -1
  22. package/es/components/Datagrid/Datagrid/DatagridRow.js +6 -1
  23. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +9 -4
  24. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +11 -4
  25. package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -1
  26. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  27. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
  28. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +18 -6
  29. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +21 -11
  30. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +34 -10
  31. package/es/components/Datagrid/Datagrid/addons/Filtering/constants.js +6 -2
  32. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js +7 -0
  33. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +42 -11
  34. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +3 -3
  35. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useSubscribeToEventEmitter.js +1 -0
  36. package/es/components/Datagrid/Datagrid/addons/Filtering/index.js +1 -0
  37. package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +2 -6
  38. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +4 -7
  39. package/es/components/Datagrid/useActionsColumn.js +18 -14
  40. package/es/components/Datagrid/useFiltering.js +3 -6
  41. package/es/components/Datagrid/useInfiniteScroll.js +7 -3
  42. package/es/components/Datagrid/useNestedRowExpander.js +2 -2
  43. package/es/components/Datagrid/useRowIsMouseOver.js +3 -1
  44. package/es/components/Datagrid/useSelectAllToggle.js +11 -10
  45. package/es/components/Datagrid/useSelectRows.js +2 -2
  46. package/es/components/Datagrid/utils/filterPropsForTesting.js +150 -0
  47. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +9 -3
  48. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
  49. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -3
  50. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -3
  51. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -3
  52. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -3
  53. package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -6
  54. package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -6
  55. package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -6
  56. package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -6
  57. package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -6
  58. package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -6
  59. package/es/components/FilterSummary/FilterSummary.js +19 -15
  60. package/es/components/InterstitialScreen/InterstitialScreen.js +8 -7
  61. package/es/components/Tearsheet/TearsheetShell.js +6 -4
  62. package/es/global/js/hooks/index.js +3 -2
  63. package/es/global/js/hooks/useFocus.js +72 -0
  64. package/es/global/js/hooks/useIsomorphicEffect.js +12 -0
  65. package/es/global/js/package-settings.js +0 -1
  66. package/lib/components/ButtonMenu/ButtonMenu.js +11 -1
  67. package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +6 -3
  68. package/lib/components/Datagrid/Datagrid/DatagridContent.js +9 -8
  69. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -1
  70. package/lib/components/Datagrid/Datagrid/DatagridRow.js +6 -1
  71. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +8 -3
  72. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +11 -4
  73. package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -1
  74. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  75. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
  76. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +18 -6
  77. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +21 -11
  78. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +30 -7
  79. package/lib/components/Datagrid/Datagrid/addons/Filtering/constants.js +8 -3
  80. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js +7 -0
  81. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +34 -3
  82. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +3 -3
  83. package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +2 -6
  84. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +4 -7
  85. package/lib/components/Datagrid/useActionsColumn.js +17 -13
  86. package/lib/components/Datagrid/useFiltering.js +1 -4
  87. package/lib/components/Datagrid/useInfiniteScroll.js +7 -3
  88. package/lib/components/Datagrid/useNestedRowExpander.js +1 -1
  89. package/lib/components/Datagrid/useRowIsMouseOver.js +3 -1
  90. package/lib/components/Datagrid/useSelectAllToggle.js +9 -9
  91. package/lib/components/Datagrid/useSelectRows.js +1 -1
  92. package/lib/components/Datagrid/utils/filterPropsForTesting.js +159 -0
  93. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +9 -3
  94. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
  95. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -3
  96. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -3
  97. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -3
  98. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -3
  99. package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -6
  100. package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -6
  101. package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -6
  102. package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -6
  103. package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -6
  104. package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -6
  105. package/lib/components/FilterSummary/FilterSummary.js +18 -14
  106. package/lib/components/InterstitialScreen/InterstitialScreen.js +8 -6
  107. package/lib/components/Tearsheet/TearsheetShell.js +6 -4
  108. package/lib/global/js/hooks/index.js +8 -1
  109. package/lib/global/js/hooks/useFocus.js +79 -0
  110. package/lib/global/js/hooks/useIsomorphicEffect.js +18 -0
  111. package/lib/global/js/package-settings.js +0 -1
  112. package/package.json +6 -5
  113. package/scss/components/Datagrid/_datagrid.scss +9 -1
  114. package/scss/components/Datagrid/styles/_datagrid.scss +10 -4
  115. package/scss/components/Datagrid/styles/addons/_FilterPanel.scss +6 -7
  116. package/scss/components/InterstitialScreen/_interstitial-screen.scss +1 -0
  117. package/scss/components/SidePanel/_side-panel.scss +5 -1
  118. package/telemetry.yml +816 -0
@@ -129,7 +129,8 @@ var MultiStepWithIntro = function MultiStepWithIntro(_ref) {
129
129
  }, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.RadioTile, {
130
130
  className: "".concat(_settings.pkg.prefix, "--tearsheet-create-multi-step--custom-tile"),
131
131
  value: "standard",
132
- id: "tile-1"
132
+ id: "tile-1",
133
+ tabIndex: selectedCategory === 'standard' ? 0 : -1
133
134
  }, /*#__PURE__*/_react.default.createElement(_NoDataIllustration.NoDataIllustration, {
134
135
  size: "lg"
135
136
  }), /*#__PURE__*/_react.default.createElement("span", {
@@ -137,7 +138,8 @@ var MultiStepWithIntro = function MultiStepWithIntro(_ref) {
137
138
  }, "Standard")), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.RadioTile, {
138
139
  className: "".concat(_settings.pkg.prefix, "--tearsheet-create-multi-step--custom-tile"),
139
140
  value: "premium",
140
- id: "tile-2"
141
+ id: "tile-2",
142
+ tabIndex: selectedCategory === 'premium' ? 0 : -1
141
143
  }, /*#__PURE__*/_react.default.createElement(_NoDataIllustration.NoDataIllustration, {
142
144
  size: "lg"
143
145
  }), /*#__PURE__*/_react.default.createElement("span", {
@@ -145,7 +147,8 @@ var MultiStepWithIntro = function MultiStepWithIntro(_ref) {
145
147
  }, "Premium")), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.RadioTile, {
146
148
  className: "".concat(_settings.pkg.prefix, "--tearsheet-create-multi-step--custom-tile"),
147
149
  value: "plus",
148
- id: "tile-3"
150
+ id: "tile-3",
151
+ tabIndex: selectedCategory === 'plus' ? 0 : -1
149
152
  }, /*#__PURE__*/_react.default.createElement(_NoDataIllustration.NoDataIllustration, {
150
153
  size: "lg"
151
154
  }), /*#__PURE__*/_react.default.createElement("span", {
@@ -98,7 +98,7 @@ var DatagridContent = function DatagridContent(_ref) {
98
98
  });
99
99
  var renderTable = function renderTable() {
100
100
  var _getTableProps;
101
- return /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
101
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
102
102
  className: (0, _classnames.default)(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-grid-active"), gridActive), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-is-resizing"), typeof columnResizing.isResizingColumn === 'string'), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
103
103
  role: withInlineEdit && 'grid',
104
104
  tabIndex: withInlineEdit && 0,
@@ -119,7 +119,7 @@ var DatagridContent = function DatagridContent(_ref) {
119
119
  title: title
120
120
  }), !withVirtualScroll && /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
121
121
  rows: contentRows
122
- })));
122
+ }))), (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && renderPagination());
123
123
  };
124
124
  var _useMultipleKeyTracki = (0, _hooks2.useMultipleKeyTracking)({
125
125
  ref: withInlineEdit ? multiKeyTrackingRef : null,
@@ -144,8 +144,6 @@ var DatagridContent = function DatagridContent(_ref) {
144
144
  (0, _hooks3.useSubscribeToEventEmitter)(_constants.CLEAR_SINGLE_FILTER, function (id) {
145
145
  return (0, _FilterProvider.clearSingleFilter)(id, setAllFilters, state);
146
146
  });
147
-
148
- /* istanbul ignore next */
149
147
  var renderFilterSummary = function renderFilterSummary() {
150
148
  return state.filters.length > 0 && /*#__PURE__*/_react.default.createElement(_FilterSummary.FilterSummary, {
151
149
  className: "".concat(blockClass, "__filter-summary"),
@@ -157,6 +155,11 @@ var DatagridContent = function DatagridContent(_ref) {
157
155
  overflowType: "tag"
158
156
  });
159
157
  };
158
+ var renderPagination = function renderPagination() {
159
+ if ((contentRows === null || contentRows === void 0 ? void 0 : contentRows.length) > 0 && !isFetching && DatagridPagination) {
160
+ return /*#__PURE__*/_react.default.createElement(DatagridPagination, datagridState);
161
+ }
162
+ };
160
163
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TableContainer, {
161
164
  className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : '', (_cx5 = {}, (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__grid-container-grid-active"), gridActive), (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__grid-container-inline-edit"), withInlineEdit), (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__grid-container-grid-active--without-toolbar"), withInlineEdit && !DatagridActions), _cx5)),
162
165
  title: gridTitle,
@@ -164,9 +167,7 @@ var DatagridContent = function DatagridContent(_ref) {
164
167
  }, /*#__PURE__*/_react.default.createElement(_DatagridToolbar.default, datagridState), /*#__PURE__*/_react.default.createElement("div", {
165
168
  className: (0, _classnames.default)("".concat(blockClass, "__table-container"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-container--filter-open"), panelOpen)),
166
169
  ref: gridAreaRef
167
- }, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/_react.default.createElement(_FilterPanel.default, (0, _extends2.default)({
168
- updateMethod: "batch"
169
- }, getFilterFlyoutProps(), {
170
+ }, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/_react.default.createElement(_FilterPanel.default, (0, _extends2.default)({}, getFilterFlyoutProps(), {
170
171
  title: filterProps.panelTitle,
171
172
  filterSections: filterProps.sections,
172
173
  isFetching: isFetching
@@ -177,7 +178,7 @@ var DatagridContent = function DatagridContent(_ref) {
177
178
  }, renderTable()) : withVirtualScroll ? /*#__PURE__*/_react.default.createElement("div", {
178
179
  className: "".concat(blockClass, "__virtualScrollContainer"),
179
180
  ref: gridRef
180
- }, renderTable()) : renderTable()))), (contentRows === null || contentRows === void 0 ? void 0 : contentRows.length) > 0 && !isFetching && DatagridPagination && /*#__PURE__*/_react.default.createElement(DatagridPagination, datagridState), CustomizeColumnsTearsheet && /*#__PURE__*/_react.default.createElement(CustomizeColumnsTearsheet, {
181
+ }, renderTable()) : renderTable()))), (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) !== 'panel' && renderPagination(), CustomizeColumnsTearsheet && /*#__PURE__*/_react.default.createElement(CustomizeColumnsTearsheet, {
181
182
  instance: datagridState
182
183
  }));
183
184
  };
@@ -33,7 +33,8 @@ var getAccessibilityProps = function getAccessibilityProps(header) {
33
33
  return props;
34
34
  };
35
35
  var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
36
- var resizerAriaLabel = datagridState.resizerAriaLabel;
36
+ var resizerAriaLabel = datagridState.resizerAriaLabel,
37
+ isFetching = datagridState.isFetching;
37
38
  // Used to measure the height of the table and uses that value
38
39
  // to display a vertical line to indicate the column you are resizing
39
40
  (0, _react.useEffect)(function () {
@@ -106,9 +107,13 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
106
107
  key: header.id,
107
108
  "aria-hidden": header.id === 'spacer' && 'true'
108
109
  }, getAccessibilityProps(header)), header.render('Header'), header.getResizerProps && !header.isAction && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({}, header.getResizerProps(), {
110
+ disabled: isFetching,
109
111
  onMouseDown: function onMouseDown(event) {
110
112
  return handleOnMouseDownResize(event, header.getResizerProps);
111
113
  },
114
+ onMouseUp: function onMouseUp() {
115
+ return (0, _stateReducer.handleColumnResizeEndEvent)(dispatch, onColResizeEnd, header.id, true);
116
+ },
112
117
  onKeyDown: function onKeyDown(event) {
113
118
  var key = event.key;
114
119
  if (key === 'ArrowLeft' || key === 'ArrowRight') {
@@ -37,7 +37,9 @@ var DatagridRow = function DatagridRow(datagridState) {
37
37
  prepareRow = datagridState.prepareRow,
38
38
  key = datagridState.key,
39
39
  tableId = datagridState.tableId,
40
- withExpandedRows = datagridState.withExpandedRows;
40
+ withExpandedRows = datagridState.withExpandedRows,
41
+ withMouseHover = datagridState.withMouseHover,
42
+ setMouseOverRowIndex = datagridState.setMouseOverRowIndex;
41
43
  var getVisibleNestedRowCount = function getVisibleNestedRowCount(_ref) {
42
44
  var isExpanded = _ref.isExpanded,
43
45
  subRows = _ref.subRows;
@@ -82,6 +84,9 @@ var DatagridRow = function DatagridRow(datagridState) {
82
84
  return null;
83
85
  };
84
86
  var handleMouseLeave = function handleMouseLeave(event) {
87
+ if (withMouseHover) {
88
+ setMouseOverRowIndex(null);
89
+ }
85
90
  var hoverRow = event.target.closest(".".concat(blockClass, "__carbon-row-expanded"));
86
91
  hoverRow === null || hoverRow === void 0 ? void 0 : hoverRow.classList.remove("".concat(blockClass, "__carbon-row-expanded-hover-active"));
87
92
  };
@@ -21,7 +21,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21
21
  var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
22
22
  var SelectAll = function SelectAll(datagridState) {
23
23
  var _columns$;
24
- var _useState = (0, _react.useState)(window.innerWidth),
24
+ var _useState = (0, _react.useState)(typeof window !== 'undefined' ? window.innerWidth : ''),
25
25
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
26
26
  windowSize = _useState2[0],
27
27
  setWindowSize = _useState2[1];
@@ -30,7 +30,9 @@ var SelectAll = function SelectAll(datagridState) {
30
30
  function updateSize() {
31
31
  setWindowSize(window.innerWidth);
32
32
  }
33
- window.addEventListener('resize', updateSize);
33
+ if (typeof window !== 'undefined') {
34
+ window.addEventListener('resize', updateSize);
35
+ }
34
36
  return function () {
35
37
  return window.removeEventListener('resize', updateSize);
36
38
  };
@@ -47,7 +49,8 @@ var SelectAll = function SelectAll(datagridState) {
47
49
  dispatch = datagridState.dispatch,
48
50
  rows = datagridState.rows,
49
51
  getRowId = datagridState.getRowId,
50
- toggleAllRowsSelected = datagridState.toggleAllRowsSelected;
52
+ toggleAllRowsSelected = datagridState.toggleAllRowsSelected,
53
+ onAllRowSelect = datagridState.onAllRowSelect;
51
54
  var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
52
55
  if (hideSelectAll || radio) {
53
56
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -69,6 +72,7 @@ var SelectAll = function SelectAll(datagridState) {
69
72
  indeterminate: true
70
73
  });
71
74
  toggleAllRowsSelected(false);
75
+ onAllRowSelect === null || onAllRowSelect === void 0 ? void 0 : onAllRowSelect(rows, event);
72
76
  return onChange === null || onChange === void 0 ? void 0 : onChange({
73
77
  target: {
74
78
  checked: false
@@ -81,6 +85,7 @@ var SelectAll = function SelectAll(datagridState) {
81
85
  getRowId: getRowId,
82
86
  isChecked: event.target.checked
83
87
  });
88
+ onAllRowSelect === null || onAllRowSelect === void 0 ? void 0 : onAllRowSelect(rows, event);
84
89
  return onChange === null || onChange === void 0 ? void 0 : onChange(event);
85
90
  };
86
91
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -109,6 +109,16 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
109
109
  }
110
110
  }));
111
111
  };
112
+ var onCancelHandler = function onCancelHandler() {
113
+ (0, _stateReducer.handleSelectAllRowData)({
114
+ dispatch: dispatch,
115
+ rows: [],
116
+ getRowId: getRowId,
117
+ isChecked: false
118
+ });
119
+ toggleAllRowsSelected(false);
120
+ setGlobalFilter(null);
121
+ };
112
122
 
113
123
  // Only display the first two batch actions, the rest are
114
124
  // displayed inside of the ButtonMenu if there are more than
@@ -116,10 +126,7 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
116
126
  return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.TableBatchActions, {
117
127
  shouldShowBatchActions: totalSelected > 0,
118
128
  totalSelected: totalSelected,
119
- onCancel: function onCancel() {
120
- toggleAllRowsSelected(false);
121
- setGlobalFilter(null);
122
- },
129
+ onCancel: onCancelHandler,
123
130
  translateWithId: translateWithIdBatchActions
124
131
  }, !displayAllInMenu && toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
125
132
  if (index < 2 && toolbarBatchActions.length > 3 || index < 3 && toolbarBatchActions.length <= 3) {
@@ -48,7 +48,7 @@ var DraggableElement = function DraggableElement(_ref) {
48
48
  }, "".concat(blockClass, "__draggable-handleStyle"))
49
49
  }, isSticky ? /*#__PURE__*/_react.default.createElement(_iconsReact.Locked16, null) : /*#__PURE__*/_react.default.createElement(_iconsReact.Draggable16, null)), children);
50
50
  var style = {
51
- transform: _utilities.CSS.Transform.toString(transform),
51
+ transform: !disabled ? _utilities.CSS.Transform.toString(transform) : {},
52
52
  transition: transition
53
53
  };
54
54
  return /*#__PURE__*/_react.default.createElement("li", (0, _extends2.default)({
@@ -48,6 +48,9 @@ var Columns = function Columns(_ref) {
48
48
  $splice: [[from, 1], [to, 0, fromCol]]
49
49
  }));
50
50
  }, [columns, setColumnsObject]);
51
+ var filteredStickyColumn = columns === null || columns === void 0 ? void 0 : columns.filter(function (item) {
52
+ return !item.sticky;
53
+ });
51
54
  return /*#__PURE__*/_react.default.createElement("div", {
52
55
  className: "".concat(blockClass, "__customize-columns-column-list"),
53
56
  ref: listRef
@@ -71,7 +74,7 @@ var Columns = function Columns(_ref) {
71
74
  checked: getVisibleColumnsCount() === columns.length,
72
75
  indeterminate: getVisibleColumnsCount() < columns.length && getVisibleColumnsCount() > 0,
73
76
  onChange: function onChange() {
74
- onSelectColumn(columns, getVisibleColumnsCount() !== columns.length);
77
+ onSelectColumn(filteredStickyColumn, getVisibleColumnsCount() !== columns.length);
75
78
  },
76
79
  id: "".concat(blockClass, "__customization-column-select-all"),
77
80
  labelText: selectAllLabel
@@ -92,7 +92,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
92
92
  };
93
93
  var onCheckboxCheck = function onCheckboxCheck(col, value) {
94
94
  var changedDefinitions = columnObjects.map(function (definition) {
95
- if (Array.isArray(col) && col.indexOf(definition) != null || definition.id === col.id) {
95
+ if (Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) {
96
96
  return _objectSpread(_objectSpread({}, definition), {}, {
97
97
  isVisible: value
98
98
  });
@@ -30,18 +30,23 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
30
30
 
31
31
  var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
32
32
  var componentClass = "".concat(blockClass, "-filter-flyout");
33
+ var defaults = {
34
+ flyoutIconDescription: 'Open filters',
35
+ title: 'Filter',
36
+ primaryActionLabel: 'Apply',
37
+ secondaryActionLabel: 'Cancel'
38
+ };
33
39
  var FilterFlyout = function FilterFlyout(_ref) {
34
40
  var _cx2;
35
- var _ref$updateMethod = _ref.updateMethod,
36
- updateMethod = _ref$updateMethod === void 0 ? _constants.BATCH : _ref$updateMethod,
41
+ var updateMethod = _ref.updateMethod,
37
42
  _ref$flyoutIconDescri = _ref.flyoutIconDescription,
38
- flyoutIconDescription = _ref$flyoutIconDescri === void 0 ? 'Open filters' : _ref$flyoutIconDescri,
43
+ flyoutIconDescription = _ref$flyoutIconDescri === void 0 ? defaults.flyoutIconDescription : _ref$flyoutIconDescri,
39
44
  _ref$filters = _ref.filters,
40
45
  filters = _ref$filters === void 0 ? [] : _ref$filters,
41
46
  _ref$title = _ref.title,
42
- title = _ref$title === void 0 ? 'Filter' : _ref$title,
47
+ title = _ref$title === void 0 ? defaults.title : _ref$title,
43
48
  _ref$primaryActionLab = _ref.primaryActionLabel,
44
- primaryActionLabel = _ref$primaryActionLab === void 0 ? 'Apply' : _ref$primaryActionLab,
49
+ primaryActionLabel = _ref$primaryActionLab === void 0 ? defaults.primaryActionLabel : _ref$primaryActionLab,
45
50
  _ref$onFlyoutOpen = _ref.onFlyoutOpen,
46
51
  onFlyoutOpen = _ref$onFlyoutOpen === void 0 ? function () {} : _ref$onFlyoutOpen,
47
52
  _ref$onFlyoutClose = _ref.onFlyoutClose,
@@ -51,7 +56,7 @@ var FilterFlyout = function FilterFlyout(_ref) {
51
56
  _ref$onCancel = _ref.onCancel,
52
57
  onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel,
53
58
  _ref$secondaryActionL = _ref.secondaryActionLabel,
54
- secondaryActionLabel = _ref$secondaryActionL === void 0 ? 'Cancel' : _ref$secondaryActionL,
59
+ secondaryActionLabel = _ref$secondaryActionL === void 0 ? defaults.secondaryActionLabel : _ref$secondaryActionL,
55
60
  setAllFilters = _ref.setAllFilters,
56
61
  _ref$data = _ref.data,
57
62
  data = _ref$data === void 0 ? [] : _ref$data,
@@ -97,6 +102,9 @@ var FilterFlyout = function FilterFlyout(_ref) {
97
102
  _useShouldDisableButt2 = (0, _slicedToArray2.default)(_useShouldDisableButt, 2),
98
103
  shouldDisableButtons = _useShouldDisableButt2[0],
99
104
  setShouldDisableButtons = _useShouldDisableButt2[1];
105
+
106
+ // Skip resize testing
107
+ /* istanbul ignore next */
100
108
  var handleResize = function handleResize(current) {
101
109
  var filterFlyoutRefPosition = flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current.getBoundingClientRect();
102
110
  var originalFlyoutWidth = parseInt(window.getComputedStyle(flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current).getPropertyValue('width'));
@@ -186,9 +194,13 @@ var FilterFlyout = function FilterFlyout(_ref) {
186
194
  };
187
195
 
188
196
  /** Effects */
197
+ // Close flyout when clicking outside
189
198
  (0, _hooks.useClickOutside)(filterFlyoutRef, function (target) {
190
199
  var hasClickedOnDatePicker = target.closest('.flatpickr-calendar');
191
200
  var hasClickedOnDropdown = target.className === "".concat(_settings.carbon.prefix, "--list-box__menu-item__option");
201
+
202
+ // Do not do anything if flyout is closed or if clicking on anything
203
+ // rendered via a portal
192
204
  if (!open || hasClickedOnDatePicker || hasClickedOnDropdown) {
193
205
  return;
194
206
  }
@@ -23,7 +23,6 @@ var _ = require(".");
23
23
  var _hooks = require("./hooks");
24
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
25
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
- /* eslint-disable react/jsx-key */
27
26
  /**
28
27
  * Copyright IBM Corp. 2022, 2024
29
28
  *
@@ -34,14 +33,21 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
34
33
  var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
35
34
  var componentClass = "".concat(blockClass, "-filter-panel");
36
35
  var MotionActionSet = (0, _framerMotion.motion)(_ActionSet.ActionSet);
36
+ var defaults = {
37
+ title: 'Filter',
38
+ closeIconDescription: 'Close filter panel',
39
+ primaryActionLabel: 'Apply',
40
+ secondaryActionLabel: 'Cancel',
41
+ searchLabelText: 'Filter search',
42
+ searchPlaceholder: 'Find filters'
43
+ };
37
44
  var FilterPanel = function FilterPanel(_ref) {
38
45
  var _cx;
39
46
  var _ref$title = _ref.title,
40
- title = _ref$title === void 0 ? 'Filter' : _ref$title,
47
+ title = _ref$title === void 0 ? defaults.title : _ref$title,
41
48
  _ref$closeIconDescrip = _ref.closeIconDescription,
42
- closeIconDescription = _ref$closeIconDescrip === void 0 ? 'Close filter panel' : _ref$closeIconDescrip,
43
- _ref$updateMethod = _ref.updateMethod,
44
- updateMethod = _ref$updateMethod === void 0 ? _constants.BATCH : _ref$updateMethod,
49
+ closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
50
+ updateMethod = _ref.updateMethod,
45
51
  filterSections = _ref.filterSections,
46
52
  setAllFilters = _ref.setAllFilters,
47
53
  _ref$onApply = _ref.onApply,
@@ -57,13 +63,13 @@ var FilterPanel = function FilterPanel(_ref) {
57
63
  _ref$filterPanelMinHe = _ref.filterPanelMinHeight,
58
64
  filterPanelMinHeight = _ref$filterPanelMinHe === void 0 ? 600 : _ref$filterPanelMinHe,
59
65
  _ref$primaryActionLab = _ref.primaryActionLabel,
60
- primaryActionLabel = _ref$primaryActionLab === void 0 ? 'Apply' : _ref$primaryActionLab,
66
+ primaryActionLabel = _ref$primaryActionLab === void 0 ? defaults.primaryActionLabel : _ref$primaryActionLab,
61
67
  _ref$secondaryActionL = _ref.secondaryActionLabel,
62
- secondaryActionLabel = _ref$secondaryActionL === void 0 ? 'Cancel' : _ref$secondaryActionL,
68
+ secondaryActionLabel = _ref$secondaryActionL === void 0 ? defaults.secondaryActionLabel : _ref$secondaryActionL,
63
69
  _ref$searchLabelText = _ref.searchLabelText,
64
- searchLabelText = _ref$searchLabelText === void 0 ? 'Filter search' : _ref$searchLabelText,
70
+ searchLabelText = _ref$searchLabelText === void 0 ? defaults.searchLabelText : _ref$searchLabelText,
65
71
  _ref$searchPlaceholde = _ref.searchPlaceholder,
66
- searchPlaceholder = _ref$searchPlaceholde === void 0 ? 'Find filters' : _ref$searchPlaceholde,
72
+ searchPlaceholder = _ref$searchPlaceholde === void 0 ? defaults.searchPlaceholder : _ref$searchPlaceholde,
67
73
  _ref$reactTableFilter = _ref.reactTableFiltersState,
68
74
  reactTableFiltersState = _ref$reactTableFilter === void 0 ? [] : _ref$reactTableFilter,
69
75
  _ref$isFetching = _ref.isFetching,
@@ -187,7 +193,8 @@ var FilterPanel = function FilterPanel(_ref) {
187
193
  var filterHeadingHeight = (_filterHeadingRef$cur = filterHeadingRef.current) === null || _filterHeadingRef$cur === void 0 ? void 0 : _filterHeadingRef$cur.getBoundingClientRect().height;
188
194
  var filterSearchHeight = (_filterSearchRef$curr = filterSearchRef.current) === null || _filterSearchRef$curr === void 0 ? void 0 : _filterSearchRef$curr.getBoundingClientRect().height;
189
195
  var actionSetHeight = (_actionSetRef$current = actionSetRef.current) === null || _actionSetRef$current === void 0 ? void 0 : _actionSetRef$current.getBoundingClientRect().height;
190
- var height = "calc(100vh - ".concat(filterHeadingHeight, "px - ").concat(showFilterSearch ? filterSearchHeight : 0, "px - ").concat(updateMethod === _constants.BATCH ? actionSetHeight : 0, "px)");
196
+ var height = panelOpen ? "calc(100vh - ".concat(filterHeadingHeight, "px - ").concat( /* istanbul ignore next */
197
+ showFilterSearch ? filterSearchHeight : 0, "px - ").concat(updateMethod === _constants.BATCH ? actionSetHeight : 0, "px)") : 0;
191
198
  return height;
192
199
  };
193
200
  return /*#__PURE__*/_react.default.createElement(_framerMotion.motion.div, {
@@ -213,7 +220,10 @@ var FilterPanel = function FilterPanel(_ref) {
213
220
  tooltipPosition: "bottom",
214
221
  tooltipAlignment: "end",
215
222
  onClick: closePanel
216
- }), showFilterSearch && /*#__PURE__*/_react.default.createElement("div", {
223
+ }), showFilterSearch &&
224
+ /*#__PURE__*/
225
+ /* istanbul ignore next */
226
+ _react.default.createElement("div", {
217
227
  ref: filterSearchRef,
218
228
  className: "".concat(componentClass, "__search")
219
229
  }, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Search, {
@@ -147,22 +147,45 @@ var prepareFiltersForTags = function prepareFiltersForTags(filters, renderDateLa
147
147
  });
148
148
  return tags;
149
149
  };
150
- var FilterProvider = function FilterProvider(_ref3) {
151
- var children = _ref3.children,
152
- filters = _ref3.filters,
153
- filterProps = _ref3.filterProps;
154
- var _ref4 = filterProps || {},
155
- renderDateLabel = _ref4.renderDateLabel;
150
+ var filteringReducer = function filteringReducer(state, action) {
151
+ switch (action.type) {
152
+ case _constants.SAVED_FILTERS:
153
+ {
154
+ var _ref3 = action.payload || {},
155
+ savedFilters = _ref3.savedFilters;
156
+ return _objectSpread(_objectSpread({}, state), {}, {
157
+ savedFilters: savedFilters
158
+ });
159
+ }
160
+ default:
161
+ return state;
162
+ }
163
+ };
164
+ var FilterProvider = function FilterProvider(_ref4) {
165
+ var children = _ref4.children,
166
+ filters = _ref4.filters,
167
+ filterProps = _ref4.filterProps;
168
+ var _ref5 = filterProps || {},
169
+ renderDateLabel = _ref5.renderDateLabel;
156
170
  var filterTags = prepareFiltersForTags(filters, renderDateLabel);
157
171
  var _useState = (0, _react.useState)(false),
158
172
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
159
173
  panelOpen = _useState2[0],
160
174
  setPanelOpen = _useState2[1];
175
+ var initialState = {
176
+ savedFilters: []
177
+ };
178
+ var _useReducer = (0, _react.useReducer)(filteringReducer, initialState),
179
+ _useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
180
+ state = _useReducer2[0],
181
+ dispatch = _useReducer2[1];
161
182
  var value = {
162
183
  filterTags: filterTags,
163
184
  EventEmitter: EventEmitter,
164
185
  panelOpen: panelOpen,
165
- setPanelOpen: setPanelOpen
186
+ setPanelOpen: setPanelOpen,
187
+ state: state,
188
+ dispatch: dispatch
166
189
  };
167
190
  return /*#__PURE__*/_react.default.createElement(FilterContext.Provider, {
168
191
  value: value
@@ -3,13 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.RADIO = exports.PANEL_WIDTH = exports.PANEL = exports.NUMBER = exports.INSTANT = exports.FLYOUT = exports.DROPDOWN = exports.DATE = exports.CLEAR_SINGLE_FILTER = exports.CLEAR_FILTERS = exports.CHECKBOX = exports.BATCH = exports.ACTION_SET_HEIGHT = void 0;
6
+ exports.SAVED_FILTERS = exports.RADIO = exports.PANEL_WIDTH = exports.PANEL = exports.NUMBER = exports.INSTANT = exports.FLYOUT = exports.DROPDOWN = exports.DATE = exports.CLEAR_SINGLE_FILTER = exports.CLEAR_FILTERS = exports.CHECKBOX = exports.BATCH = exports.ACTION_SET_HEIGHT = void 0;
7
7
  /**
8
- * Copyright IBM Corp. 2022, 2022
8
+ * Copyright IBM Corp. 2022, 2024
9
9
  *
10
10
  * This source code is licensed under the Apache-2.0 license found in the
11
11
  * LICENSE file in the root directory of this source tree.
12
12
  */
13
+
13
14
  /** Constants for update methods can either be batch or instant */
14
15
  var BATCH = 'batch';
15
16
  exports.BATCH = BATCH;
@@ -44,4 +45,8 @@ exports.CLEAR_SINGLE_FILTER = CLEAR_SINGLE_FILTER;
44
45
  var PANEL_WIDTH = 320;
45
46
  exports.PANEL_WIDTH = PANEL_WIDTH;
46
47
  var ACTION_SET_HEIGHT = 64;
47
- exports.ACTION_SET_HEIGHT = ACTION_SET_HEIGHT;
48
+
49
+ /** Constants for local reducer */
50
+ exports.ACTION_SET_HEIGHT = ACTION_SET_HEIGHT;
51
+ var SAVED_FILTERS = 'savedFilters';
52
+ exports.SAVED_FILTERS = SAVED_FILTERS;
@@ -6,6 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _FilterProvider = require("../FilterProvider");
8
8
  var _react = require("react");
9
+ /**
10
+ * Copyright IBM Corp. 2023, 2024
11
+ *
12
+ * This source code is licensed under the Apache-2.0 license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+
9
16
  var useFilterContext = function useFilterContext() {
10
17
  // get the context
11
18
  var context = (0, _react.useContext)(_FilterProvider.FilterContext);
@@ -15,6 +15,7 @@ var _carbonComponentsReact = require("carbon-components-react");
15
15
  var _constants = require("../constants");
16
16
  var _utils = require("../utils");
17
17
  var _hooks = require("../../../../../../global/js/hooks");
18
+ var _FilterProvider = require("../FilterProvider");
18
19
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
21
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -26,10 +27,13 @@ var useFilters = function useFilters(_ref) {
26
27
  setAllFilters = _ref.setAllFilters,
27
28
  variation = _ref.variation,
28
29
  reactTableFiltersState = _ref.reactTableFiltersState,
29
- _ref$onCancel = _ref.onCancel,
30
- onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel,
30
+ onCancel = _ref.onCancel,
31
31
  panelOpen = _ref.panelOpen,
32
32
  isFetching = _ref.isFetching;
33
+ var _useContext = (0, _react.useContext)(_FilterProvider.FilterContext),
34
+ state = _useContext.state,
35
+ localDispatch = _useContext.dispatch;
36
+ var savedFilters = state.savedFilters;
33
37
  /** State */
34
38
  var _useState = (0, _react.useState)((0, _utils.getInitialStateFromFilters)(filters, variation, reactTableFiltersState)),
35
39
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -169,6 +173,16 @@ var useFilters = function useFilters(_ref) {
169
173
  }
170
174
  setFiltersObjectArray(filtersObjectArrayCopy);
171
175
 
176
+ // Dispatch action from local filter context to track filters in order
177
+ // to keep history if `isFetching` becomes true. If so, react-table
178
+ // clears all filter history
179
+ localDispatch({
180
+ type: _constants.SAVED_FILTERS,
181
+ payload: {
182
+ savedFilters: filtersObjectArrayCopy
183
+ }
184
+ });
185
+
172
186
  // // Automatically apply the filters if the updateMethod is instant
173
187
  if (updateMethod === _constants.INSTANT) {
174
188
  setAllFilters(filtersObjectArrayCopy);
@@ -348,10 +362,27 @@ var useFilters = function useFilters(_ref) {
348
362
  setAllFilters(JSON.parse(prevFiltersObjectArrayRef.current));
349
363
  setFetchingReset(true);
350
364
  }
365
+ if (isFetching && fetchingReset) {
366
+ var cleanFilters = function cleanFilters(originalFilterState) {
367
+ var copy = _objectSpread({}, originalFilterState);
368
+ var updatedFilters = savedFilters.map(function (f) {
369
+ if (Object.hasOwn(copy, f.id)) {
370
+ copy[f.id] = f;
371
+ return copy;
372
+ }
373
+ return copy;
374
+ });
375
+ return updatedFilters[0];
376
+ };
377
+ setFiltersObjectArray(savedFilters);
378
+ var filterStateCopy = cleanFilters(filtersState);
379
+ setFiltersState(filterStateCopy);
380
+ }
351
381
  if (!isFetching) {
352
382
  setFetchingReset(false);
353
383
  }
354
- }, [isFetching, reactTableFiltersState, setAllFilters, fetchingReset]);
384
+ // eslint-disable-next-line react-hooks/exhaustive-deps
385
+ }, [isFetching, reactTableFiltersState, setAllFilters, fetchingReset, savedFilters, filtersObjectArray]);
355
386
  var cancel = function cancel() {
356
387
  // Reverting to previous filters only applies when using batch actions
357
388
  if (updateMethod === _constants.BATCH) {
@@ -9,11 +9,12 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
9
9
  var _react = require("react");
10
10
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
11
11
  /**
12
- * Copyright IBM Corp. 2023, 2023
12
+ * Copyright IBM Corp. 2023, 2024
13
13
  *
14
14
  * This source code is licensed under the Apache-2.0 license found in the
15
15
  * LICENSE file in the root directory of this source tree.
16
16
  */
17
+
17
18
  /* eslint-disable jsdoc/check-param-names */
18
19
 
19
20
  /**
@@ -24,8 +25,7 @@ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
24
25
  * @returns {Array} returns a tuple of the state and setter function
25
26
  */
26
27
  var useShouldDisableButtons = function useShouldDisableButtons(_ref) {
27
- var _ref$initialValue = _ref.initialValue,
28
- initialValue = _ref$initialValue === void 0 ? true : _ref$initialValue,
28
+ var initialValue = _ref.initialValue,
29
29
  filtersState = _ref.filtersState,
30
30
  prevFiltersRef = _ref.prevFiltersRef;
31
31
  var _useState = (0, _react.useState)(initialValue),
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getInitialStateFromFilters = void 0;
7
7
  var _constants = require("./constants");
8
8
  /**
9
- * Copyright IBM Corp. 2022, 2022
9
+ * Copyright IBM Corp. 2022, 2024
10
10
  *
11
11
  * This source code is licensed under the Apache-2.0 license found in the
12
12
  * LICENSE file in the root directory of this source tree.
@@ -24,9 +24,7 @@ var applyInitialFilters = function applyInitialFilters(filterState, initialFilte
24
24
  };
25
25
 
26
26
  // This functions takes the filters passed in and makes an object to track it's state
27
- var getInitialStateFromFilters = function getInitialStateFromFilters(filters) {
28
- var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.FLYOUT;
29
- var initialFilters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
27
+ var getInitialStateFromFilters = function getInitialStateFromFilters(filters, variation, initialFilters) {
30
28
  var initialFilterState = {};
31
29
  var setInitialState = function setInitialState(_ref) {
32
30
  var type = _ref.type,
@@ -80,8 +78,6 @@ var getInitialStateFromFilters = function getInitialStateFromFilters(filters) {
80
78
  return setInitialState(filter);
81
79
  });
82
80
  });
83
- } else {
84
- console.error('No variation passed into useInitialStateFromFilters');
85
81
  }
86
82
  if (initialFilters.length > 0) {
87
83
  applyInitialFilters(initialFilterState, initialFilters);