@carbon/ibm-products 2.45.0 → 2.46.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 (124) hide show
  1. package/css/index-full-carbon.css +261 -124
  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 +81 -86
  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 +182 -110
  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/ActionBar/ActionBarItem.js +1 -1
  18. package/es/components/Coachmark/Coachmark.d.ts +6 -1
  19. package/es/components/Coachmark/Coachmark.js +37 -6
  20. package/es/components/Coachmark/CoachmarkOverlay.js +2 -4
  21. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +1 -7
  22. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +20 -14
  23. package/es/components/ConditionBuilder/ConditionBuilder.js +3 -3
  24. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +8 -5
  25. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +4 -2
  26. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
  27. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -3
  28. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +1 -3
  29. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +26 -30
  30. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
  31. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +6 -1
  32. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +4 -1
  33. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -2
  34. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
  35. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +47 -23
  36. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -1
  37. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +3 -3
  38. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +6 -3
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +3 -2
  40. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +1 -3
  41. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +62 -32
  42. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -0
  43. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +52 -46
  44. package/es/components/ConditionBuilder/utils/util.d.ts +6 -5
  45. package/es/components/ConditionBuilder/utils/util.js +35 -17
  46. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +6 -0
  47. package/es/components/DataSpreadsheet/DataSpreadsheet.js +77 -38
  48. package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +4 -0
  49. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +10 -1
  50. package/es/components/DataSpreadsheet/types/index.d.ts +1 -0
  51. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +34 -10
  52. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +33 -1
  53. package/es/components/Datagrid/types/index.d.ts +14 -2
  54. package/es/components/Datagrid/useDisableSelectRows.d.ts +2 -1
  55. package/es/components/Datagrid/useDisableSelectRows.js +27 -22
  56. package/es/components/StringFormatter/StringFormatter.js +14 -3
  57. package/es/components/StringFormatter/utils/enums.d.ts +20 -1
  58. package/es/components/StringFormatter/utils/enums.js +22 -2
  59. package/es/components/Tearsheet/TearsheetShell.d.ts +1 -1
  60. package/es/components/Tearsheet/TearsheetShell.js +4 -2
  61. package/es/global/js/hooks/useFocus.d.ts +1 -0
  62. package/es/global/js/hooks/useFocus.js +5 -2
  63. package/es/node_modules/@carbon/icon-helpers/es/index.js +49 -62
  64. package/es/node_modules/@carbon/icons-react/es/generated/bucket-2.js +1020 -1058
  65. package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +881 -758
  66. package/lib/components/ActionBar/ActionBarItem.js +1 -1
  67. package/lib/components/Coachmark/Coachmark.d.ts +6 -1
  68. package/lib/components/Coachmark/Coachmark.js +36 -5
  69. package/lib/components/Coachmark/CoachmarkOverlay.js +2 -4
  70. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +1 -7
  71. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +19 -13
  72. package/lib/components/ConditionBuilder/ConditionBuilder.js +3 -3
  73. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +8 -5
  74. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +4 -2
  75. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
  76. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -3
  77. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +1 -3
  78. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +25 -29
  79. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -0
  80. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +6 -1
  81. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +4 -1
  82. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -2
  83. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
  84. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +46 -22
  85. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -1
  86. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +3 -3
  87. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +6 -3
  88. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +3 -2
  89. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +1 -3
  90. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +61 -31
  91. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -0
  92. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +51 -44
  93. package/lib/components/ConditionBuilder/utils/util.d.ts +6 -5
  94. package/lib/components/ConditionBuilder/utils/util.js +36 -16
  95. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +6 -0
  96. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +77 -38
  97. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +4 -0
  98. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +10 -1
  99. package/lib/components/DataSpreadsheet/types/index.d.ts +1 -0
  100. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +34 -10
  101. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +32 -0
  102. package/lib/components/Datagrid/types/index.d.ts +14 -2
  103. package/lib/components/Datagrid/useDisableSelectRows.d.ts +2 -1
  104. package/lib/components/Datagrid/useDisableSelectRows.js +27 -22
  105. package/lib/components/StringFormatter/StringFormatter.js +13 -2
  106. package/lib/components/StringFormatter/utils/enums.d.ts +20 -1
  107. package/lib/components/StringFormatter/utils/enums.js +23 -1
  108. package/lib/components/Tearsheet/TearsheetShell.d.ts +1 -1
  109. package/lib/components/Tearsheet/TearsheetShell.js +3 -1
  110. package/lib/global/js/hooks/useFocus.d.ts +1 -0
  111. package/lib/global/js/hooks/useFocus.js +5 -1
  112. package/lib/node_modules/@carbon/icon-helpers/es/index.js +49 -62
  113. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-2.js +1036 -1074
  114. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +946 -823
  115. package/package.json +6 -6
  116. package/scss/components/Coachmark/_coachmark-overlay.scss +6 -70
  117. package/scss/components/Coachmark/_coachmark.scss +5 -4
  118. package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +1 -3
  119. package/scss/components/ConditionBuilder/_condition-builder.scss +4 -0
  120. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +6 -1
  121. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +1 -1
  122. package/scss/components/Datagrid/styles/addons/_CustomizeColumnsTearsheet.scss +7 -5
  123. package/scss/components/Datagrid/styles/addons/_FilterFlyout.scss +5 -4
  124. package/telemetry.yml +5 -14
@@ -14,22 +14,24 @@ var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
14
14
  var util = require('./util.js');
15
15
 
16
16
  var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef, variant) {
17
+ var _activeElement$closes;
17
18
  var activeElement = document.activeElement;
19
+ if (!((_activeElement$closes = activeElement.closest(".".concat(DataConfigs.blockClass, "__popover"))) !== null && _activeElement$closes !== void 0 && _activeElement$closes.querySelector('[role="dialog"]'))) {
20
+ handleKeyPressForMainContent(evt, conditionBuilderRef, variant);
21
+ }
22
+ };
23
+ var handleKeyDownForPopover = function handleKeyDownForPopover(evt, conditionBuilderRef, popoverRef) {
18
24
  if (excludeKeyPress(evt)) {
19
25
  return;
20
26
  }
21
- if (activeElement.closest("[role=\"dialog\"]")) {
22
- handleKeyPressForPopover(evt, activeElement.closest("[role=\"dialog\"]"));
23
- } else {
24
- handleKeyPressForMainContent(evt, conditionBuilderRef, variant);
25
- }
27
+ handleKeyPressForPopover(evt, popoverRef === null || popoverRef === void 0 ? void 0 : popoverRef.current, conditionBuilderRef);
26
28
  };
29
+
27
30
  //skipping keyboard handling for date and time fields to get take carbon's
28
31
  var excludeKeyPress = function excludeKeyPress(evt) {
29
- var _evt$target$closest, _evt$target$closest2;
30
- return !['Escape'].includes(evt.key) && (((_evt$target$closest = evt.target.closest(".".concat(DataConfigs.blockClass, "__item-date"))) === null || _evt$target$closest === void 0 ? void 0 : _evt$target$closest.length) || ((_evt$target$closest2 = evt.target.closest(".".concat(DataConfigs.blockClass, "__item-time"))) === null || _evt$target$closest2 === void 0 ? void 0 : _evt$target$closest2.length));
32
+ return !['Escape'].includes(evt.key) && (evt.target.closest(".".concat(DataConfigs.blockClass, "__item-date")) || evt.target.closest(".".concat(DataConfigs.blockClass, "__item-time")));
31
33
  };
32
- var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer) {
34
+ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer, conditionBuilderRef) {
33
35
  var _parentContainer$quer;
34
36
  var key = evt.key;
35
37
  var isHoldingShiftKey = util.checkForHoldingKey(evt, 'shiftKey');
@@ -39,22 +41,22 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
39
41
  case 'ArrowUp':
40
42
  //traverse through the popover options, search box, selectAll button
41
43
  parentContainer.querySelectorAll("[role=\"option\"]").forEach(function (eachElem, index, allElements) {
42
- util.traverseReverse(eachElem, index, allElements);
44
+ util.traverseReverse(eachElem, index, allElements, null, null, conditionBuilderRef);
43
45
  });
44
46
  break;
45
47
  case 'ArrowDown':
46
48
  //traverse through the popover options, search box, selectAll button
47
49
  parentContainer.querySelectorAll("[role=\"option\"]").forEach(function (eachElem, index, allElements) {
48
- util.traverseClockVise(eachElem, index, allElements);
50
+ util.traverseClockVise(eachElem, index, allElements, null, null, conditionBuilderRef);
49
51
  });
50
52
  break;
51
53
  case 'Tab':
52
54
  allItems = [].concat(_rollupPluginBabelHelpers.toConsumableArray(Array.from(parentContainer.querySelectorAll(".".concat(DataConfigs.blockClass, "__selectAll-button,[role=\"searchbox\"]")))), [parentContainer.querySelector("[role=\"option\"]")]);
53
55
  allItems.forEach(function (eachElem, index, allElements) {
54
56
  if (isHoldingShiftKey) {
55
- util.traverseReverse(eachElem, index, allElements, true, true);
57
+ util.traverseReverse(eachElem, index, allElements, true, true, conditionBuilderRef);
56
58
  } else {
57
- util.traverseClockVise(eachElem, index, allElements, true, true);
59
+ util.traverseClockVise(eachElem, index, allElements, true, true, conditionBuilderRef);
58
60
  }
59
61
  });
60
62
  evt.preventDefault();
@@ -74,40 +76,41 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
74
76
  if (document.activeElement.type !== 'button') {
75
77
  var _document$activeEleme2;
76
78
  //for button , enter key is click which already handled by framework, else trigger click
77
- util.focusThisField(evt);
79
+ util.focusThisField(evt, conditionBuilderRef);
78
80
  (_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
79
81
  }
80
82
  }
81
83
  break;
82
84
  case 'Escape':
83
- //focus the corresponding field in which the popover is triggered
84
- util.focusThisField(evt);
85
+ //focus the corresponding field in which the popover is triggered\
86
+ util.focusThisField(evt, conditionBuilderRef);
85
87
  break;
86
88
  }
87
89
  };
88
90
  var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef, variant) {
91
+ var _document$activeEleme3;
89
92
  switch (evt.key) {
90
93
  case 'ArrowRight':
91
94
  evt.preventDefault();
92
95
  if (variant == 'tree') {
93
- var _evt$target$closest3;
94
- var allCellsInRow = Array.from((_evt$target$closest3 = evt.target.closest('[role="row"]')) === null || _evt$target$closest3 === void 0 ? void 0 : _evt$target$closest3.querySelectorAll('[role="gridcell"] button'));
95
- if (evt.target.getAttribute('role') == 'row') {
96
+ var _evt$target$closest;
97
+ var allCellsInRow = Array.from((_evt$target$closest = evt.target.closest('[role="row"]')) === null || _evt$target$closest === void 0 ? void 0 : _evt$target$closest.querySelectorAll('[role="gridcell"] button'));
98
+ if (allCellsInRow.length === 1) {
99
+ evt.target = evt.target.closest('[role="row"]');
100
+ handleRowNavigationTree(evt, conditionBuilderRef, variant);
101
+ //focus next row
102
+ } else if (evt.target.getAttribute('role') == 'row') {
96
103
  //when current focus is on a row, then we need to enter inside and focus the first cell of that row
97
- if (allCellsInRow.length === 1) {
98
- handleRowNavigationTree(evt, conditionBuilderRef, variant);
99
- //focus next row
100
- } else {
101
- var _allCellsInRow$;
102
- (_allCellsInRow$ = allCellsInRow[0]) === null || _allCellsInRow$ === void 0 || _allCellsInRow$.focus();
103
- }
104
+
105
+ //focus first cell
106
+ util.manageTabIndexAndFocus(allCellsInRow[0], conditionBuilderRef);
104
107
  } else {
105
108
  //finding the next cell to be focussed
106
109
  //next cell = current cell index + 1
107
110
 
108
111
  var currentItemIndex = allCellsInRow.indexOf(evt.target);
109
112
  if (currentItemIndex < allCellsInRow.length - 1) {
110
- util.focusThisItem(allCellsInRow[currentItemIndex + 1]);
113
+ util.focusThisItem(allCellsInRow[currentItemIndex + 1], conditionBuilderRef);
111
114
  }
112
115
  }
113
116
  } else {
@@ -118,17 +121,17 @@ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, co
118
121
  evt.preventDefault();
119
122
  if (variant == 'tree') {
120
123
  if (evt.target.getAttribute('role') !== 'row') {
121
- var _evt$target$closest4;
124
+ var _evt$target$closest2;
122
125
  //when any cell is focussed, arrow left will select the previous cell or current row
123
126
 
124
- var allItems = Array.from((_evt$target$closest4 = evt.target.closest('[role="row"]')) === null || _evt$target$closest4 === void 0 ? void 0 : _evt$target$closest4.querySelectorAll('[role="gridcell"] button'));
125
- var _currentItemIndex = allItems.indexOf(evt.target);
127
+ var _allCellsInRow = Array.from((_evt$target$closest2 = evt.target.closest('[role="row"]')) === null || _evt$target$closest2 === void 0 ? void 0 : _evt$target$closest2.querySelectorAll('[role="gridcell"] button'));
128
+ var _currentItemIndex = _allCellsInRow.indexOf(evt.target);
126
129
  if (_currentItemIndex > 0) {
127
- util.focusThisItem(allItems[_currentItemIndex - 1]);
130
+ util.focusThisItem(_allCellsInRow[_currentItemIndex - 1], conditionBuilderRef);
128
131
  } else {
129
132
  //focus the row
130
133
  var wrapper = evt.target.closest("[role=\"row\"]");
131
- wrapper.focus();
134
+ util.manageTabIndexAndFocus(wrapper, conditionBuilderRef);
132
135
  }
133
136
  }
134
137
  } else {
@@ -144,6 +147,12 @@ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, co
144
147
  handleRowNavigation(evt, conditionBuilderRef, variant);
145
148
  }
146
149
  break;
150
+ case 'Enter':
151
+ if (((_document$activeEleme3 = document.activeElement) === null || _document$activeEleme3 === void 0 || (_document$activeEleme3 = _document$activeEleme3.querySelectorAll("button")) === null || _document$activeEleme3 === void 0 ? void 0 : _document$activeEleme3.length) === 1) {
152
+ var _document$activeEleme4;
153
+ (_document$activeEleme4 = document.activeElement) === null || _document$activeEleme4 === void 0 || (_document$activeEleme4 = _document$activeEleme4.querySelectorAll("button")[0]) === null || _document$activeEleme4 === void 0 || _document$activeEleme4.click();
154
+ }
155
+ break;
147
156
  }
148
157
  };
149
158
  var getRows = function getRows(conditionBuilderRef) {
@@ -159,9 +168,9 @@ var getRowIndex = function getRowIndex(element, conditionBuilderRef) {
159
168
  var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef, variant) {
160
169
  var rows = getRows(conditionBuilderRef);
161
170
  var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
162
- navigateToNextRowCell(evt, currentRowIndex, rows, variant);
171
+ navigateToNextRowCell(evt, currentRowIndex, rows, variant, conditionBuilderRef);
163
172
  };
164
- function handleRowNavigationTree(evt, conditionBuilderRef, variant) {
173
+ var handleRowNavigationTree = function handleRowNavigationTree(evt, conditionBuilderRef, variant) {
165
174
  var rows = getRows(conditionBuilderRef);
166
175
  var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
167
176
  var nextRowIndex = currentRowIndex;
@@ -179,15 +188,13 @@ function handleRowNavigationTree(evt, conditionBuilderRef, variant) {
179
188
  nextRowIndex = rows.length - 1;
180
189
  }
181
190
  if (nextRowIndex !== currentRowIndex) {
182
- rows[currentRowIndex].setAttribute('tabindex', '-1');
183
- rows[nextRowIndex].setAttribute('tabindex', '0');
184
- rows[nextRowIndex].focus();
191
+ util.manageTabIndexAndFocus(rows[nextRowIndex], conditionBuilderRef);
185
192
  }
186
193
  } else {
187
- navigateToNextRowCell(evt, currentRowIndex, rows, variant);
194
+ navigateToNextRowCell(evt, currentRowIndex, rows, variant, conditionBuilderRef);
188
195
  }
189
- }
190
- var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex, rows, variant) {
196
+ };
197
+ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex, rows, variant, conditionBuilderRef) {
191
198
  //when the current focussed element is a cell of any row, arrow up/down will focus the next row same cell.
192
199
 
193
200
  var nextRowIndex = currentRowIndex;
@@ -200,21 +207,21 @@ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex,
200
207
  var nextRow = rows[nextRowIndex];
201
208
  var itemName = evt.target.dataset.name;
202
209
  if (nextRow !== null && nextRow !== void 0 && nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) {
203
- var _nextRow$querySelecto;
204
- nextRow === null || nextRow === void 0 || (_nextRow$querySelecto = nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) === null || _nextRow$querySelecto === void 0 || _nextRow$querySelecto.focus();
210
+ util.manageTabIndexAndFocus(nextRow === null || nextRow === void 0 ? void 0 : nextRow.querySelector("[data-name=\"".concat(itemName, "\"]")), conditionBuilderRef);
205
211
  } else if (variant === 'tree') {
206
212
  //when the next row is a if statement , then that row is focused. From any cell of last row of an group , arrow down select the next row (if)
207
- nextRow === null || nextRow === void 0 || nextRow.focus();
213
+ util.manageTabIndexAndFocus(nextRow, conditionBuilderRef);
208
214
  }
209
215
  };
210
216
  var handleCellNavigation = function handleCellNavigation(evt, conditionBuilderRef) {
211
217
  conditionBuilderRef.current.querySelectorAll("[role=\"gridcell\"] button").forEach(function (eachElem, index, allElements) {
212
218
  if (evt.key === 'ArrowRight') {
213
- util.traverseClockVise(eachElem, index, allElements);
219
+ util.traverseClockVise(eachElem, index, allElements, null, null, conditionBuilderRef);
214
220
  } else {
215
- util.traverseReverse(eachElem, index, allElements);
221
+ util.traverseReverse(eachElem, index, allElements, null, null, conditionBuilderRef);
216
222
  }
217
223
  });
218
224
  };
219
225
 
220
226
  exports.handleKeyDown = handleKeyDown;
227
+ exports.handleKeyDownForPopover = handleKeyDownForPopover;
@@ -1,6 +1,7 @@
1
- export function focusThisField(evt: any): void;
2
- export function focusThisItem(currentElement: any): void;
3
- export function traverseClockVise(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
4
- export function traverseReverse(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
1
+ export function focusThisField(evt: any, conditionBuilderRef: any): void;
2
+ export function focusThisItem(currentElement: any, conditionBuilderRef: any): void;
3
+ export function traverseClockVise(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any, conditionBuilderRef: any): void;
4
+ export function traverseReverse(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any, conditionBuilderRef: any): void;
5
5
  export function checkForHoldingKey(evt: any, key: any): any;
6
- export function checkDuplicateAction(actionState: any, selectedId: any, currentActionId: any): boolean;
6
+ export function checkIsValid(item: any): any;
7
+ export function manageTabIndexAndFocus(currentElement: any, conditionBuilderRef: any): void;
@@ -9,40 +9,45 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
- var focusThisField = function focusThisField(evt) {
13
- setTimeout(function () {
14
- var _evt$target$closest, _evt$target$closest2;
15
- (_evt$target$closest = evt.target.closest('[role="gridcell"]')) === null || _evt$target$closest === void 0 || (_evt$target$closest = _evt$target$closest.querySelector('button')) === null || _evt$target$closest === void 0 || _evt$target$closest.click();
16
- (_evt$target$closest2 = evt.target.closest('[role="gridcell"]')) === null || _evt$target$closest2 === void 0 || (_evt$target$closest2 = _evt$target$closest2.querySelector('button')) === null || _evt$target$closest2 === void 0 || _evt$target$closest2.focus();
17
- }, 0);
12
+ var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
13
+
14
+ var focusThisField = function focusThisField(evt, conditionBuilderRef) {
15
+ if (evt) {
16
+ setTimeout(function () {
17
+ var _evt$target$closest, _evt$target$closest2, _evt$target$closest3;
18
+ manageTabIndexAndFocus((_evt$target$closest = evt.target.closest('[role="gridcell"]')) === null || _evt$target$closest === void 0 ? void 0 : _evt$target$closest.querySelector('button'), conditionBuilderRef);
19
+ (_evt$target$closest2 = evt.target.closest('[role="gridcell"]')) === null || _evt$target$closest2 === void 0 || (_evt$target$closest2 = _evt$target$closest2.querySelector('button')) === null || _evt$target$closest2 === void 0 || _evt$target$closest2.click();
20
+ (_evt$target$closest3 = evt.target.closest('[role="gridcell"]')) === null || _evt$target$closest3 === void 0 || (_evt$target$closest3 = _evt$target$closest3.querySelector('button')) === null || _evt$target$closest3 === void 0 || _evt$target$closest3.focus();
21
+ }, 0);
22
+ }
18
23
  };
19
- var focusThisItem = function focusThisItem(currentElement) {
24
+ var focusThisItem = function focusThisItem(currentElement, conditionBuilderRef) {
20
25
  setTimeout(function () {
21
26
  //document.activeElement.setAttribute('tabindex', '-1');
22
27
  // currentElement.setAttribute('tabindex', '0');
23
- currentElement === null || currentElement === void 0 || currentElement.focus();
28
+ manageTabIndexAndFocus(currentElement, conditionBuilderRef);
24
29
  }, 0);
25
30
  };
26
- var traverseClockVise = function traverseClockVise(eachElem, index, allElements, rotate, trapFocus) {
31
+ var traverseClockVise = function traverseClockVise(eachElem, index, allElements, rotate, trapFocus, conditionBuilderRef) {
27
32
  if (eachElem == document.activeElement) {
28
33
  if (index !== allElements.length - 1) {
29
- focusThisItem(allElements[index + 1]);
34
+ focusThisItem(allElements[index + 1], conditionBuilderRef);
30
35
  } else {
31
- focusThisItem(allElements[rotate ? 0 : allElements.length - 1]);
36
+ focusThisItem(allElements[rotate ? 0 : allElements.length - 1], conditionBuilderRef);
32
37
  }
33
38
  } else if (Array.from(allElements).indexOf(document.activeElement) == -1 && trapFocus) {
34
- focusThisItem(allElements[0]);
39
+ focusThisItem(allElements[0], conditionBuilderRef);
35
40
  }
36
41
  };
37
- var traverseReverse = function traverseReverse(eachElem, index, allElements, rotate, trapFocus) {
42
+ var traverseReverse = function traverseReverse(eachElem, index, allElements, rotate, trapFocus, conditionBuilderRef) {
38
43
  if (eachElem == document.activeElement) {
39
44
  if (index !== 0) {
40
- focusThisItem(allElements[index - 1]);
45
+ focusThisItem(allElements[index - 1], conditionBuilderRef);
41
46
  } else {
42
- focusThisItem(allElements[rotate ? allElements.length - 1 : 0]);
47
+ focusThisItem(allElements[rotate ? allElements.length - 1 : 0], conditionBuilderRef);
43
48
  }
44
49
  } else if (Array.from(allElements).indexOf(document.activeElement) == -1 && trapFocus) {
45
- focusThisItem(allElements[allElements.length - 1]);
50
+ focusThisItem(allElements[allElements.length - 1], conditionBuilderRef);
46
51
  }
47
52
  };
48
53
  var checkForHoldingKey = function checkForHoldingKey(evt, key) {
@@ -52,9 +57,24 @@ var checkForHoldingKey = function checkForHoldingKey(evt, key) {
52
57
  }
53
58
  return evt[key];
54
59
  };
60
+ var checkIsValid = function checkIsValid(item) {
61
+ return item && item !== 'INVALID';
62
+ };
63
+ var manageTabIndexAndFocus = function manageTabIndexAndFocus(currentElement, conditionBuilderRef) {
64
+ var _currentElement$close, _conditionBuilderRef$;
65
+ var contentContainer = (_currentElement$close = currentElement === null || currentElement === void 0 ? void 0 : currentElement.closest(".".concat(DataConfigs.blockClass, "__content-container"))) !== null && _currentElement$close !== void 0 ? _currentElement$close : currentElement === null || currentElement === void 0 ? void 0 : currentElement.closest(".".concat(DataConfigs.blockClass, "__actions-container"));
66
+ contentContainer && Array.from(contentContainer.querySelectorAll('[tabindex="0"]')).map(function (element) {
67
+ return element === null || element === void 0 ? void 0 : element.setAttribute('tabindex', '-1');
68
+ });
69
+ currentElement === null || currentElement === void 0 || currentElement.setAttribute('tabindex', '0');
70
+ (_conditionBuilderRef$ = conditionBuilderRef.current) === null || _conditionBuilderRef$ === void 0 || (_conditionBuilderRef$ = _conditionBuilderRef$.querySelector(".".concat(DataConfigs.blockClass, "__statement-button"))) === null || _conditionBuilderRef$ === void 0 || _conditionBuilderRef$.setAttribute('tabindex', '1');
71
+ currentElement === null || currentElement === void 0 || currentElement.focus();
72
+ };
55
73
 
56
74
  exports.checkForHoldingKey = checkForHoldingKey;
75
+ exports.checkIsValid = checkIsValid;
57
76
  exports.focusThisField = focusThisField;
58
77
  exports.focusThisItem = focusThisItem;
78
+ exports.manageTabIndexAndFocus = manageTabIndexAndFocus;
59
79
  exports.traverseClockVise = traverseClockVise;
60
80
  exports.traverseReverse = traverseReverse;
@@ -44,6 +44,12 @@ interface DataSpreadsheetProps {
44
44
  * The event handler that is called when the active cell changes
45
45
  */
46
46
  onActiveCellChange?: () => void;
47
+ /**
48
+ * Callback for columns after being dragged
49
+ */
50
+ onColDrag?: ({ ...args }: {
51
+ [x: string]: any;
52
+ }) => void;
47
53
  /**
48
54
  * The setter fn for the data prop
49
55
  */
@@ -41,7 +41,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
41
41
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
42
42
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
43
43
 
44
- var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "disableColumnSwapping", "readOnlyTable", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
44
+ var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "onColDrag", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "disableColumnSwapping", "readOnlyTable", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
45
45
  // The block part of our conventional BEM class names (blockClass__E--M).
46
46
  var blockClass = "".concat(settings.pkg.prefix, "--data-spreadsheet");
47
47
  var componentName = 'DataSpreadsheet';
@@ -52,6 +52,7 @@ var defaults = {
52
52
  data: Object.freeze([]),
53
53
  defaultEmptyRowCount: 16,
54
54
  onDataUpdate: Object.freeze(function () {}),
55
+ onColDrag: Object.freeze(function () {}),
55
56
  onActiveCellChange: Object.freeze(function () {}),
56
57
  onSelectionAreaChange: Object.freeze(function () {}),
57
58
  theme: 'light'
@@ -71,6 +72,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
71
72
  defaultEmptyRowCount = _ref$defaultEmptyRowC === void 0 ? defaults.defaultEmptyRowCount : _ref$defaultEmptyRowC,
72
73
  _ref$onDataUpdate = _ref.onDataUpdate,
73
74
  onDataUpdate = _ref$onDataUpdate === void 0 ? defaults.onDataUpdate : _ref$onDataUpdate,
75
+ _ref$onColDrag = _ref.onColDrag,
76
+ onColDrag = _ref$onColDrag === void 0 ? defaults.onColDrag : _ref$onColDrag,
74
77
  id = _ref.id,
75
78
  _ref$onActiveCellChan = _ref.onActiveCellChange,
76
79
  onActiveCellChange = _ref$onActiveCellChan === void 0 ? defaults.onActiveCellChange : _ref$onActiveCellChan,
@@ -91,66 +94,75 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
91
94
  var localRef = React.useRef();
92
95
  var spreadsheetRef = ref || localRef;
93
96
  var focusedElement = useActiveElement.useActiveElement();
94
- var _useState = React.useState(false),
97
+ var _useState = React.useState(columns),
95
98
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
96
- containerHasFocus = _useState2[0],
97
- setContainerHasFocus = _useState2[1];
98
- var _useState3 = React.useState(null),
99
+ currentColumns = _useState2[0],
100
+ setCurrentColumns = _useState2[1];
101
+ var _useState3 = React.useState([]),
99
102
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
100
- activeCellCoordinates = _useState4[0],
101
- setActiveCellCoordinates = _useState4[1];
102
- var _useState5 = React.useState([]),
103
+ pastColumns = _useState4[0],
104
+ setPastColumns = _useState4[1];
105
+ var _useState5 = React.useState(false),
103
106
  _useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
104
- selectionAreas = _useState6[0],
105
- setSelectionAreas = _useState6[1];
106
- var _useState7 = React.useState([]),
107
+ containerHasFocus = _useState6[0],
108
+ setContainerHasFocus = _useState6[1];
109
+ var _useState7 = React.useState(null),
107
110
  _useState8 = _rollupPluginBabelHelpers.slicedToArray(_useState7, 2),
108
- selectionAreaData = _useState8[0],
109
- setSelectionAreaData = _useState8[1];
110
- var _useState9 = React.useState(false),
111
+ activeCellCoordinates = _useState8[0],
112
+ setActiveCellCoordinates = _useState8[1];
113
+ var _useState9 = React.useState([]),
111
114
  _useState10 = _rollupPluginBabelHelpers.slicedToArray(_useState9, 2),
112
- clickAndHoldActive = _useState10[0],
113
- setClickAndHoldActive = _useState10[1];
114
- var _useState11 = React.useState(''),
115
+ selectionAreas = _useState10[0],
116
+ setSelectionAreas = _useState10[1];
117
+ var _useState11 = React.useState([]),
115
118
  _useState12 = _rollupPluginBabelHelpers.slicedToArray(_useState11, 2),
116
- currentMatcher = _useState12[0],
117
- setCurrentMatcher = _useState12[1];
119
+ selectionAreaData = _useState12[0],
120
+ setSelectionAreaData = _useState12[1];
118
121
  var _useState13 = React.useState(false),
119
122
  _useState14 = _rollupPluginBabelHelpers.slicedToArray(_useState13, 2),
120
- isEditing = _useState14[0],
121
- setIsEditing = _useState14[1];
123
+ clickAndHoldActive = _useState14[0],
124
+ setClickAndHoldActive = _useState14[1];
122
125
  var _useState15 = React.useState(''),
123
126
  _useState16 = _rollupPluginBabelHelpers.slicedToArray(_useState15, 2),
124
- cellEditorValue = _useState16[0],
125
- setCellEditorValue = _useState16[1];
127
+ currentMatcher = _useState16[0],
128
+ setCurrentMatcher = _useState16[1];
126
129
  var _useState17 = React.useState(false),
127
130
  _useState18 = _rollupPluginBabelHelpers.slicedToArray(_useState17, 2),
128
- headerCellHoldActive = _useState18[0],
129
- setHeaderCellHoldActive = _useState18[1];
130
- var _useState19 = React.useState(false),
131
+ isEditing = _useState18[0],
132
+ setIsEditing = _useState18[1];
133
+ var _useState19 = React.useState(''),
131
134
  _useState20 = _rollupPluginBabelHelpers.slicedToArray(_useState19, 2),
132
- selectedHeaderReorderActive = _useState20[0],
133
- setSelectedHeaderReorderActive = _useState20[1];
134
- var isBlurSpreadsheet = React.useRef(false);
135
+ cellEditorValue = _useState20[0],
136
+ setCellEditorValue = _useState20[1];
135
137
  var _useState21 = React.useState(false),
136
138
  _useState22 = _rollupPluginBabelHelpers.slicedToArray(_useState21, 2),
137
- isActiveHeaderCellChanged = _useState22[0],
138
- setIsActiveHeaderCellChanged = _useState22[1];
139
+ headerCellHoldActive = _useState22[0],
140
+ setHeaderCellHoldActive = _useState22[1];
139
141
  var _useState23 = React.useState(false),
140
142
  _useState24 = _rollupPluginBabelHelpers.slicedToArray(_useState23, 2),
141
- activeCellInsideSelectionArea = _useState24[0],
142
- setActiveCellInsideSelectionArea = _useState24[1];
143
+ selectedHeaderReorderActive = _useState24[0],
144
+ setSelectedHeaderReorderActive = _useState24[1];
145
+ var isBlurSpreadsheet = React.useRef(false);
146
+ var _useState25 = React.useState(false),
147
+ _useState26 = _rollupPluginBabelHelpers.slicedToArray(_useState25, 2),
148
+ isActiveHeaderCellChanged = _useState26[0],
149
+ setIsActiveHeaderCellChanged = _useState26[1];
150
+ var _useState27 = React.useState(false),
151
+ _useState28 = _rollupPluginBabelHelpers.slicedToArray(_useState27, 2),
152
+ activeCellInsideSelectionArea = _useState28[0],
153
+ setActiveCellInsideSelectionArea = _useState28[1];
143
154
  var previousState = usePreviousValue.usePreviousValue({
144
155
  activeCellCoordinates: activeCellCoordinates,
145
156
  isEditing: isEditing,
146
- cellEditorValue: cellEditorValue
157
+ cellEditorValue: cellEditorValue,
158
+ selectedHeaderReorderActive: selectedHeaderReorderActive
147
159
  }) || {};
148
160
  var cellSizeValue = getCellSize.getCellSize(cellSize);
149
161
  var cellEditorRef = React.useRef();
150
- var _useState25 = React.useState(),
151
- _useState26 = _rollupPluginBabelHelpers.slicedToArray(_useState25, 2),
152
- activeCellContent = _useState26[0],
153
- setActiveCellContent = _useState26[1];
162
+ var _useState29 = React.useState(),
163
+ _useState30 = _rollupPluginBabelHelpers.slicedToArray(_useState29, 2),
164
+ activeCellContent = _useState30[0],
165
+ setActiveCellContent = _useState30[1];
154
166
  var activeCellRef = React.useRef();
155
167
  var cellEditorRulerRef = React.useRef();
156
168
  var hasCustomRowHeader = typeof renderRowHeader === 'function';
@@ -197,6 +209,28 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
197
209
  });
198
210
  });
199
211
  }, [cellEditorValue, onDataUpdate]);
212
+ React.useEffect(function () {
213
+ var currentHeaders = [];
214
+ if (Object.keys(currentColumns).length > 0) {
215
+ Object.keys(currentColumns).forEach(function (itemIndex) {
216
+ if (currentColumns[itemIndex].Header) {
217
+ currentHeaders.push(currentColumns[itemIndex].Header);
218
+ }
219
+ });
220
+ }
221
+ if (previousState.selectedHeaderReorderActive) {
222
+ setPastColumns(currentHeaders);
223
+ }
224
+ if (!previousState.selectedHeaderReorderActive && pastColumns.length > 0 && !headerCellHoldActive && JSON.stringify(currentHeaders) !== JSON.stringify(pastColumns)) {
225
+ onColDrag({
226
+ headers: currentHeaders,
227
+ data: activeCellContent.props.data
228
+ });
229
+ if (currentHeaders.length === 0) {
230
+ setPastColumns([]);
231
+ }
232
+ }
233
+ }, [previousState === null || previousState === void 0 ? void 0 : previousState.selectedHeaderReorderActive, currentColumns, headerCellHoldActive, columns, activeCellContent, onColDrag, pastColumns]);
200
234
 
201
235
  // Removes the active cell element
202
236
  var removeActiveCell = React.useCallback(function () {
@@ -659,6 +693,7 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
659
693
  }), /*#__PURE__*/React__default["default"].createElement(DataSpreadsheetBody.DataSpreadsheetBody, {
660
694
  activeCellRef: activeCellRef,
661
695
  activeCellCoordinates: activeCellCoordinates,
696
+ setCurrentColumns: setCurrentColumns,
662
697
  ref: spreadsheetRef,
663
698
  clickAndHoldActive: clickAndHoldActive,
664
699
  setClickAndHoldActive: setClickAndHoldActive,
@@ -792,6 +827,10 @@ exports.DataSpreadsheet.propTypes = {
792
827
  * The event handler that is called when the active cell changes
793
828
  */
794
829
  onActiveCellChange: index["default"].func,
830
+ /**
831
+ * Callback for when columns are dropped after dragged
832
+ */
833
+ onColDrag: index["default"].func,
795
834
  /**
796
835
  * The setter fn for the data prop
797
836
  */
@@ -48,6 +48,10 @@ interface DataSpreadsheetBodyProps {
48
48
  * The spreadsheet id
49
49
  */
50
50
  id?: number | string;
51
+ /**
52
+ * Set current columns after drag drop
53
+ */
54
+ setCurrentColumns?: Dispatch<SetStateAction<object[]>>;
51
55
  /**
52
56
  * The event handler that is called when the active cell changes
53
57
  */
@@ -42,6 +42,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
42
42
  defaultEmptyRowCount = _ref.defaultEmptyRowCount,
43
43
  getTableBodyProps = _ref.getTableBodyProps,
44
44
  headerGroups = _ref.headerGroups,
45
+ setCurrentColumns = _ref.setCurrentColumns,
45
46
  id = _ref.id,
46
47
  onDataUpdate = _ref.onDataUpdate,
47
48
  renderRowHeader = _ref.renderRowHeader,
@@ -318,7 +319,11 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
318
319
  };
319
320
  buildEmptyRows();
320
321
  }
321
- }, [rows, headerGroups, defaultEmptyRowCount, onDataUpdate]);
322
+ if (headerGroups !== null && headerGroups !== void 0 && headerGroups[0] && typeof setCurrentColumns === 'function') {
323
+ var headers = headerGroups[0].headers;
324
+ setCurrentColumns(headers);
325
+ }
326
+ }, [rows, headerGroups, defaultEmptyRowCount, onDataUpdate, setCurrentColumns]);
322
327
  var RenderEmptyRows = function RenderEmptyRows() {
323
328
  return _div || (_div = /*#__PURE__*/React__default["default"].createElement("div", null));
324
329
  };
@@ -522,6 +527,10 @@ DataSpreadsheetBody.propTypes = {
522
527
  * Setter fn for containerHasFocus state value
523
528
  */
524
529
  setContainerHasFocus: index["default"].func,
530
+ /**
531
+ * Set current columns after drag drop
532
+ */
533
+ setCurrentColumns: index["default"].func,
525
534
  /**
526
535
  * Setter fn for currentMatcher state value
527
536
  */
@@ -15,6 +15,7 @@ export interface PrevState {
15
15
  isEditing?: boolean;
16
16
  selectionAreaData?: any[];
17
17
  clickAndHoldActive?: boolean;
18
+ selectedHeaderReorderActive?: boolean;
18
19
  rowHeight?: number;
19
20
  cellSize?: Size;
20
21
  }
@@ -81,15 +81,39 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
81
81
  onSaveColumnPrefs(updatedColumns);
82
82
  };
83
83
  var onCheckboxCheck = function onCheckboxCheck(col, value) {
84
+ // Update the visibility of columns based on a single column or an array of columns
84
85
  var changedDefinitions = columnObjects.map(function (definition) {
85
- if ((Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) && definition.canFilter && !definition.disabled) {
86
- return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, definition), {}, {
86
+ // If select all is clicked
87
+ if (Array.isArray(col)) {
88
+ return col.includes(definition) && definition.canFilter && !definition.disabled ? _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, definition), {}, {
87
89
  isVisible: value
88
- });
90
+ }) : definition;
89
91
  }
90
- return definition;
92
+ // If a single checkbox is clicked which is written below as a default return
93
+ return col.id === definition.id ? _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, definition), {}, {
94
+ isVisible: value
95
+ }) : definition;
91
96
  });
92
- setColumnObjects(changedDefinitions);
97
+
98
+ // Count the number of visible columns excluding certain IDs after 1st mutation
99
+ var selectedColumnsCount = changedDefinitions.filter(function (definition) {
100
+ return definition.isVisible && !['datagridSelection', 'actions'].includes(definition.id);
101
+ }).length;
102
+
103
+ // Ensure special columns are visible if any other columns are visible
104
+ var finalDefinitions = changedDefinitions.map(function (definition) {
105
+ // If at least 1 column is visible after mutation, we add selection column and actions column (coming from various extensions)
106
+ if (selectedColumnsCount > 0) {
107
+ return ['datagridSelection', 'actions'].includes(definition.id) ? _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, definition), {}, {
108
+ isVisible: true
109
+ }) : definition;
110
+ }
111
+ // Else we remove selection column and actions column
112
+ return ['datagridSelection', 'actions'].includes(definition.id) ? _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, definition), {}, {
113
+ isVisible: false
114
+ }) : definition;
115
+ });
116
+ setColumnObjects(finalDefinitions);
93
117
  setDirty();
94
118
  };
95
119
  var setDirty = function setDirty() {
@@ -104,14 +128,14 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
104
128
  }, [columnObjects]);
105
129
  var string = searchText.trim().toLowerCase();
106
130
  React.useEffect(function () {
107
- var notFilterableCount = columnObjects.filter(function (col) {
108
- return !col.canFilter;
109
- }).length;
110
131
  var actionCount = columnObjects.filter(function (col) {
111
132
  return col.id === 'actions';
112
133
  }).length;
113
- setVisibleColumnsCount(getVisibleColumnsCount() - notFilterableCount - actionCount);
114
- setTotalColumns(columnObjects.length - notFilterableCount - actionCount);
134
+ var datagridSelectionCount = columnObjects.filter(function (col) {
135
+ return col.id === 'datagridSelection';
136
+ }).length;
137
+ setVisibleColumnsCount(getVisibleColumnsCount() - actionCount - datagridSelectionCount < 0 ? 0 : getVisibleColumnsCount() - actionCount - datagridSelectionCount);
138
+ setTotalColumns(columnObjects.length - actionCount - datagridSelectionCount);
115
139
  }, [getVisibleColumnsCount, columnObjects]);
116
140
  return /*#__PURE__*/React__default["default"].createElement(TearsheetNarrow.TearsheetNarrow, {
117
141
  className: "".concat(blockClass, "__customize-columns-tearsheet"),