@carbon/ibm-products 2.32.0 → 2.34.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +351 -3
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +351 -3
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +351 -3
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/ActionBar/ActionBar.js +8 -1
- package/es/components/CreateSidePanel/CreateSidePanel.d.ts +81 -2
- package/es/components/CreateSidePanel/CreateSidePanel.js +5 -2
- package/es/components/CreateTearsheet/CreateTearsheetDivider.d.ts +12 -1
- package/es/components/CreateTearsheet/CreateTearsheetDivider.js +1 -1
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +39 -145
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +60 -112
- package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.d.ts +3 -1
- package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +10 -3
- package/es/components/DataSpreadsheet/utils/commonEventHandlers.d.ts +4 -0
- package/es/components/DataSpreadsheet/utils/commonEventHandlers.js +304 -0
- package/es/components/Datagrid/Datagrid/DatagridContent.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +3 -1
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +6 -2
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +4 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +5 -5
- package/es/components/Datagrid/useRowSize.js +4 -2
- package/es/components/DescriptionList/DescriptionList.d.ts +0 -37
- package/es/components/DescriptionList/DescriptionList.js +7 -12
- package/es/components/DescriptionList/DescriptionListBody.d.ts +2 -0
- package/es/components/DescriptionList/DescriptionListBody.js +39 -0
- package/es/components/DescriptionList/DescriptionListCell.d.ts +2 -0
- package/es/components/DescriptionList/DescriptionListCell.js +39 -0
- package/es/components/DescriptionList/DescriptionListRow.d.ts +2 -0
- package/es/components/DescriptionList/DescriptionListRow.js +41 -0
- package/es/components/DescriptionList/index.d.ts +4 -1
- package/es/components/EditSidePanel/EditSidePanel.d.ts +92 -2
- package/es/components/EditSidePanel/EditSidePanel.js +8 -10
- package/es/components/FilterPanel/FilterPanel.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanel.js +55 -0
- package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +83 -0
- package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +94 -0
- package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +80 -0
- package/es/components/FilterPanel/FilterPanelCheckbox/index.d.ts +1 -0
- package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.d.ts +10 -0
- package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +157 -0
- package/es/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.js +72 -0
- package/es/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +63 -0
- package/es/components/FilterPanel/FilterPanelLabel/index.d.ts +1 -0
- package/es/components/FilterPanel/index.d.ts +7 -0
- package/es/components/OptionsTile/OptionsTile.d.ts +77 -3
- package/es/components/OptionsTile/OptionsTile.js +9 -20
- package/es/components/RemoveModal/RemoveModal.d.ts +81 -7
- package/es/components/RemoveModal/RemoveModal.js +1 -0
- package/es/components/ScrollGradient/ScrollGradient.d.ts +5 -0
- package/es/components/ScrollGradient/ScrollGradient.js +156 -0
- package/es/components/ScrollGradient/constants.d.ts +15 -0
- package/es/components/ScrollGradient/constants.js +121 -0
- package/es/components/ScrollGradient/index.d.ts +1 -0
- package/es/components/SidePanel/SidePanel.d.ts +144 -2
- package/es/components/SidePanel/SidePanel.js +88 -112
- package/es/components/StatusIcon/StatusIcon.d.ts +34 -2
- package/es/components/StatusIcon/StatusIcon.js +97 -95
- package/es/components/Tearsheet/TearsheetShell.js +9 -1
- package/es/components/Toolbar/ToolbarGroup.d.ts +17 -2
- package/es/components/Toolbar/ToolbarGroup.js +0 -1
- package/es/components/TruncatedList/TruncatedList.js +5 -3
- package/es/components/UserAvatar/UserAvatar.js +3 -2
- package/es/components/index.d.ts +4 -1
- package/es/global/js/hooks/useFocus.js +9 -2
- package/es/global/js/package-settings.d.ts +12 -0
- package/es/global/js/package-settings.js +12 -0
- package/es/index.js +12 -0
- package/es/settings.d.ts +12 -0
- package/lib/components/ActionBar/ActionBar.js +11 -6
- package/lib/components/CreateSidePanel/CreateSidePanel.d.ts +81 -2
- package/lib/components/CreateSidePanel/CreateSidePanel.js +5 -2
- package/lib/components/CreateTearsheet/CreateTearsheetDivider.d.ts +12 -1
- package/lib/components/CreateTearsheet/CreateTearsheetDivider.js +1 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +39 -145
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +60 -112
- package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.d.ts +3 -1
- package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +9 -2
- package/lib/components/DataSpreadsheet/utils/commonEventHandlers.d.ts +4 -0
- package/lib/components/DataSpreadsheet/utils/commonEventHandlers.js +311 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +3 -1
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +4 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +5 -5
- package/lib/components/Datagrid/useRowSize.js +4 -2
- package/lib/components/DescriptionList/DescriptionList.d.ts +0 -37
- package/lib/components/DescriptionList/DescriptionList.js +6 -11
- package/lib/components/DescriptionList/DescriptionListBody.d.ts +2 -0
- package/lib/components/DescriptionList/DescriptionListBody.js +46 -0
- package/lib/components/DescriptionList/DescriptionListCell.d.ts +2 -0
- package/lib/components/DescriptionList/DescriptionListCell.js +46 -0
- package/lib/components/DescriptionList/DescriptionListRow.d.ts +2 -0
- package/lib/components/DescriptionList/DescriptionListRow.js +48 -0
- package/lib/components/DescriptionList/index.d.ts +4 -1
- package/lib/components/EditSidePanel/EditSidePanel.d.ts +92 -2
- package/lib/components/EditSidePanel/EditSidePanel.js +8 -10
- package/lib/components/FilterPanel/FilterPanel.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanel.js +62 -0
- package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +90 -0
- package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +101 -0
- package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +87 -0
- package/lib/components/FilterPanel/FilterPanelCheckbox/index.d.ts +1 -0
- package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.d.ts +10 -0
- package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +164 -0
- package/lib/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.js +79 -0
- package/lib/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +70 -0
- package/lib/components/FilterPanel/FilterPanelLabel/index.d.ts +1 -0
- package/lib/components/FilterPanel/index.d.ts +7 -0
- package/lib/components/OptionsTile/OptionsTile.d.ts +77 -3
- package/lib/components/OptionsTile/OptionsTile.js +9 -20
- package/lib/components/RemoveModal/RemoveModal.d.ts +81 -7
- package/lib/components/RemoveModal/RemoveModal.js +1 -0
- package/lib/components/ScrollGradient/ScrollGradient.d.ts +5 -0
- package/lib/components/ScrollGradient/ScrollGradient.js +163 -0
- package/lib/components/ScrollGradient/constants.d.ts +15 -0
- package/lib/components/ScrollGradient/constants.js +128 -0
- package/lib/components/ScrollGradient/index.d.ts +1 -0
- package/lib/components/SidePanel/SidePanel.d.ts +144 -2
- package/lib/components/SidePanel/SidePanel.js +88 -112
- package/lib/components/StatusIcon/StatusIcon.d.ts +34 -2
- package/lib/components/StatusIcon/StatusIcon.js +97 -95
- package/lib/components/Tearsheet/TearsheetShell.js +9 -1
- package/lib/components/Toolbar/ToolbarGroup.d.ts +17 -2
- package/lib/components/Toolbar/ToolbarGroup.js +0 -1
- package/lib/components/TruncatedList/TruncatedList.js +5 -3
- package/lib/components/UserAvatar/UserAvatar.js +3 -2
- package/lib/components/index.d.ts +4 -1
- package/lib/global/js/hooks/useFocus.js +9 -2
- package/lib/global/js/package-settings.d.ts +12 -0
- package/lib/global/js/package-settings.js +12 -0
- package/lib/index.js +60 -0
- package/lib/settings.d.ts +12 -0
- package/package.json +3 -3
- package/scss/components/FilterPanel/_carbon-imports.scss +9 -0
- package/scss/components/FilterPanel/_filter-panel-accordion-item.scss +56 -0
- package/scss/components/FilterPanel/_filter-panel-accordion.scss +6 -0
- package/scss/components/FilterPanel/_filter-panel-checkbox-with-overflow.scss +62 -0
- package/scss/components/FilterPanel/_filter-panel-checkbox.scss +54 -0
- package/scss/components/FilterPanel/_filter-panel-group.scss +39 -0
- package/scss/components/FilterPanel/_filter-panel-label.scss +39 -0
- package/scss/components/FilterPanel/_filter-panel.scss +31 -0
- package/scss/components/FilterPanel/_index-with-carbon.scss +15 -0
- package/scss/components/FilterPanel/_index.scss +14 -0
- package/scss/components/ScrollGradient/_carbon-imports.scss +9 -0
- package/scss/components/ScrollGradient/_index-with-carbon.scss +9 -0
- package/scss/components/ScrollGradient/_index.scss +8 -0
- package/scss/components/ScrollGradient/_scroll-gradient.scss +102 -0
- package/scss/components/UserAvatar/_user-avatar.scss +37 -4
- package/scss/components/_index-with-carbon.scss +2 -0
- package/scss/components/_index.scss +2 -0
@@ -17,14 +17,12 @@ var cx = require('classnames');
|
|
17
17
|
var layout = require('@carbon/layout');
|
18
18
|
var settings = require('../../settings.js');
|
19
19
|
var deepCloneObject = require('../../global/js/utils/deepCloneObject.js');
|
20
|
-
var uuidv4 = require('../../global/js/utils/uuidv4.js');
|
21
20
|
var removeCellSelections = require('./utils/removeCellSelections.js');
|
22
21
|
var createCellSelectionArea = require('./utils/createCellSelectionArea.js');
|
23
22
|
var checkActiveHeaderCell = require('./utils/checkActiveHeaderCell.js');
|
24
23
|
var checkSelectedHeaderCell = require('./utils/checkSelectedHeaderCell.js');
|
25
|
-
var handleHeaderCellSelection = require('./utils/handleHeaderCellSelection.js');
|
26
24
|
var getSpreadsheetWidth = require('./utils/getSpreadsheetWidth.js');
|
27
|
-
var
|
25
|
+
var commonEventHandlers = require('./utils/commonEventHandlers.js');
|
28
26
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
29
27
|
var useSpreadsheetMouseUp = require('./hooks/useSpreadsheetMouseUp.js');
|
30
28
|
|
@@ -36,7 +34,8 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
36
34
|
var _div;
|
37
35
|
var blockClass = "".concat(settings.pkg.prefix, "--data-spreadsheet");
|
38
36
|
var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
39
|
-
var
|
37
|
+
var activeCellRef = _ref.activeCellRef,
|
38
|
+
columns = _ref.columns,
|
40
39
|
activeCellCoordinates = _ref.activeCellCoordinates,
|
41
40
|
defaultColumn = _ref.defaultColumn,
|
42
41
|
defaultEmptyRowCount = _ref.defaultEmptyRowCount,
|
@@ -205,75 +204,56 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
205
204
|
}
|
206
205
|
}
|
207
206
|
}, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns]);
|
207
|
+
//selectionAreas will be set when ever a selection area is made.
|
208
|
+
React.useEffect(function () {
|
209
|
+
removeDuplicateSelections();
|
210
|
+
}, [selectionAreas, removeDuplicateSelections]);
|
208
211
|
|
209
|
-
//
|
210
|
-
//
|
211
|
-
var
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
var
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
var
|
221
|
-
|
222
|
-
|
223
|
-
}
|
224
|
-
|
225
|
-
|
212
|
+
//this method will check for any duplicate selection area and remove.
|
213
|
+
//same selections are those have the same height, width, top, left styles. These inline styles are being set in createCellSelection util.
|
214
|
+
var removeDuplicateSelections = React.useCallback(function () {
|
215
|
+
var uniqueAttrArray = [],
|
216
|
+
removedSelectionAreaMatcherArr = [];
|
217
|
+
ref.current.querySelectorAll(".".concat(blockClass, "__selection-area--element")).forEach(function (selectorEl) {
|
218
|
+
var _selectorEl$style = selectorEl.style,
|
219
|
+
top = _selectorEl$style.top,
|
220
|
+
left = _selectorEl$style.left,
|
221
|
+
height = _selectorEl$style.height,
|
222
|
+
width = _selectorEl$style.width;
|
223
|
+
var uniqueAttrStr = "".concat(top).concat(left).concat(height).concat(width); // eg: 20px30px70px90px
|
224
|
+
if (uniqueAttrArray.indexOf(uniqueAttrStr) == -1) {
|
225
|
+
uniqueAttrArray.push(uniqueAttrStr);
|
226
|
+
} else {
|
227
|
+
selectorEl.remove(); // this is identified as duplicate selection and hence removing.
|
228
|
+
removedSelectionAreaMatcherArr.push(selectorEl.getAttribute('data-matcher-id'));
|
229
|
+
}
|
230
|
+
});
|
226
231
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
var
|
231
|
-
|
232
|
-
|
233
|
-
setActiveCellCoordinates(activeCoordinates);
|
234
|
-
setCurrentMatcher(tempMatcher);
|
235
|
-
setSelectionAreas(function (prev) {
|
236
|
-
return [].concat(_rollupPluginBabelHelpers.toConsumableArray(prev), [{
|
237
|
-
point1: activeCoordinates,
|
238
|
-
matcher: tempMatcher
|
239
|
-
}]);
|
232
|
+
//clean the duplicate selectionAreaData and selectionArea
|
233
|
+
if (removedSelectionAreaMatcherArr.length) {
|
234
|
+
setSelectionAreas(function (prev) {
|
235
|
+
var prevValues = deepCloneObject.deepCloneObject(prev);
|
236
|
+
return prevValues.filter(function (item) {
|
237
|
+
return !removedSelectionAreaMatcherArr.includes(item.matcher);
|
240
238
|
});
|
241
|
-
}
|
242
|
-
|
243
|
-
var
|
244
|
-
|
245
|
-
return item.
|
246
|
-
});
|
247
|
-
if (indexOfItemToUpdate === -1) {
|
248
|
-
// There is always a selectionArea with a point1 object that updates
|
249
|
-
// whenever the activeCellCoordinates update, we should always be able
|
250
|
-
// to find an index, but if we do not for some reason we should return
|
251
|
-
// at this point.
|
252
|
-
return;
|
253
|
-
} else {
|
254
|
-
// Update the selectionArea that was found, do not update currentMatcher
|
255
|
-
selectionAreaClone[indexOfItemToUpdate].point1 = activeCellCoordinates;
|
256
|
-
selectionAreaClone[indexOfItemToUpdate].point2 = activeCoordinates;
|
257
|
-
selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
|
258
|
-
selectionAreaClone[indexOfItemToUpdate].matcher = currentMatcher;
|
259
|
-
setSelectionAreas(selectionAreaClone);
|
260
|
-
}
|
261
|
-
} else {
|
262
|
-
setActiveCellInsideSelectionArea(false);
|
263
|
-
setActiveCellCoordinates(activeCoordinates);
|
264
|
-
// remove all previous cell selections
|
265
|
-
removeCellSelections.removeCellSelections({
|
266
|
-
spreadsheetRef: ref
|
239
|
+
});
|
240
|
+
setSelectionAreaData(function (prev) {
|
241
|
+
var prevValues = deepCloneObject.deepCloneObject(prev);
|
242
|
+
return prevValues.filter(function (item) {
|
243
|
+
return !removedSelectionAreaMatcherArr.includes(item.selectionId);
|
267
244
|
});
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
245
|
+
});
|
246
|
+
}
|
247
|
+
}, [ref, setSelectionAreas, setSelectionAreaData]);
|
248
|
+
|
249
|
+
// onClick fn for each cell in the data spreadsheet body,
|
250
|
+
// adds the active cell highlight
|
251
|
+
|
252
|
+
var handleBodyCellClickEvent = React.useCallback(function (cell, columnIndex) {
|
253
|
+
return function (event) {
|
254
|
+
commonEventHandlers.handleBodyCellClick(cell, columnIndex, event, currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea, activeCellRef, setValidStartingPoint);
|
275
255
|
};
|
276
|
-
}, [currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea]);
|
256
|
+
}, [currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea, activeCellRef]);
|
277
257
|
var handleBodyScroll = function handleBodyScroll() {
|
278
258
|
var headerRowElement = ref.current.querySelector("\n .".concat(blockClass, "__header--container .").concat(blockClass, "__tr"));
|
279
259
|
headerRowElement.scrollLeft = contentScrollRef.current.scrollLeft;
|
@@ -287,50 +267,14 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
287
267
|
contentScrollElementRef.removeEventListener('scroll', handleBodyScroll);
|
288
268
|
};
|
289
269
|
});
|
290
|
-
var
|
270
|
+
var handleBodyCellHoverEvent = React.useCallback(function (cell, columnIndex) {
|
291
271
|
return function () {
|
292
|
-
|
293
|
-
var cellCoordinates = {
|
294
|
-
row: cell.row.index,
|
295
|
-
column: columnIndex
|
296
|
-
};
|
297
|
-
setSelectionAreas(function (prev) {
|
298
|
-
var _selectionAreaClone$i, _selectionAreaClone$i2;
|
299
|
-
var selectionAreaClone = deepCloneObject.deepCloneObject(prev);
|
300
|
-
var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
|
301
|
-
return item.matcher === currentMatcher;
|
302
|
-
});
|
303
|
-
// No items in the array match up with the currentMatcher value
|
304
|
-
if (indexOfItemToUpdate === -1) {
|
305
|
-
return prev;
|
306
|
-
}
|
307
|
-
// Do not update state if you're still hovering on the same cell
|
308
|
-
if (((_selectionAreaClone$i = selectionAreaClone[indexOfItemToUpdate].point2) === null || _selectionAreaClone$i === void 0 ? void 0 : _selectionAreaClone$i.row) === cellCoordinates.row && ((_selectionAreaClone$i2 = selectionAreaClone[indexOfItemToUpdate].point2) === null || _selectionAreaClone$i2 === void 0 ? void 0 : _selectionAreaClone$i2.column) === cellCoordinates.column) {
|
309
|
-
return prev;
|
310
|
-
}
|
311
|
-
selectionAreaClone[indexOfItemToUpdate].point2 = cellCoordinates;
|
312
|
-
selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
|
313
|
-
return selectionAreaClone;
|
314
|
-
});
|
315
|
-
}
|
272
|
+
commonEventHandlers.handleBodyCellHover(cell, columnIndex, clickAndHoldActive, currentMatcher, setSelectionAreas);
|
316
273
|
};
|
317
274
|
}, [clickAndHoldActive, currentMatcher, setSelectionAreas]);
|
318
|
-
var
|
275
|
+
var handleRowHeaderClickEvent = React.useCallback(function (index) {
|
319
276
|
return function (event) {
|
320
|
-
|
321
|
-
handleHeaderCellSelection.handleHeaderCellSelection({
|
322
|
-
type: 'row',
|
323
|
-
activeCellCoordinates: activeCellCoordinates,
|
324
|
-
rows: rows,
|
325
|
-
columns: columns,
|
326
|
-
setActiveCellCoordinates: setActiveCellCoordinates,
|
327
|
-
setCurrentMatcher: setCurrentMatcher,
|
328
|
-
setSelectionAreas: setSelectionAreas,
|
329
|
-
spreadsheetRef: ref,
|
330
|
-
index: index,
|
331
|
-
setSelectionAreaData: setSelectionAreaData,
|
332
|
-
isHoldingCommandKey: isHoldingCommandKey
|
333
|
-
});
|
277
|
+
commonEventHandlers.handleRowHeaderClick(index, event, columns, ref, setSelectionAreas, setCurrentMatcher, setActiveCellCoordinates, activeCellCoordinates, rows, setSelectionAreaData);
|
334
278
|
};
|
335
279
|
}, [columns, ref, setSelectionAreas, setCurrentMatcher, setActiveCellCoordinates, activeCellCoordinates, rows, setSelectionAreaData]);
|
336
280
|
|
@@ -380,7 +324,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
380
324
|
"data-row-index": index,
|
381
325
|
"data-column-index": "header",
|
382
326
|
type: "button",
|
383
|
-
onClick:
|
327
|
+
onClick: handleRowHeaderClickEvent(index),
|
384
328
|
className: cx__default["default"]("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__td-th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || checkActiveHeaderCell.checkActiveHeaderCell(index, selectionAreas, 'row')), "".concat(blockClass, "__td-th--selected-header"), checkSelectedHeaderCell.checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
|
385
329
|
style: {
|
386
330
|
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
|
@@ -402,14 +346,14 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
402
346
|
"data-row-index": cell.row.index,
|
403
347
|
"data-column-index": index,
|
404
348
|
className: cx__default["default"]("".concat(blockClass, "__td"), "".concat(blockClass, "__body--td"), "".concat(blockClass, "--interactive-cell-element")),
|
405
|
-
onMouseDown:
|
406
|
-
onMouseOver:
|
349
|
+
onMouseDown: handleBodyCellClickEvent(cell, index),
|
350
|
+
onMouseOver: handleBodyCellHoverEvent(cell, index),
|
407
351
|
onFocus: function onFocus() {},
|
408
352
|
type: "button"
|
409
353
|
}, cell.render('Cell')));
|
410
354
|
}));
|
411
355
|
}
|
412
|
-
}, [prepareRow, rows, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas,
|
356
|
+
}, [prepareRow, rows, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
|
413
357
|
var spreadsheetBodyRef = React.useRef();
|
414
358
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
415
359
|
ref: spreadsheetBodyRef,
|
@@ -437,6 +381,10 @@ DataSpreadsheetBody.propTypes = {
|
|
437
381
|
row: index["default"].oneOfType([index["default"].string, index["default"].number]),
|
438
382
|
column: index["default"].oneOfType([index["default"].string, index["default"].number])
|
439
383
|
}),
|
384
|
+
/**
|
385
|
+
*This is the ref of the button input, which is the active cell element
|
386
|
+
*/
|
387
|
+
activeCellRef: index["default"].object,
|
440
388
|
/**
|
441
389
|
* Is the user clicking and holding in the data spreadsheet body
|
442
390
|
*/
|
@@ -1,6 +1,8 @@
|
|
1
|
-
export function useMoveActiveCell({ spreadsheetRef, activeCellCoordinates, containerHasFocus, createActiveCell, }: {
|
1
|
+
export function useMoveActiveCell({ spreadsheetRef, activeCellCoordinates, containerHasFocus, createActiveCell, activeCellContent, isActiveHeaderCellChanged, }: {
|
2
2
|
spreadsheetRef: any;
|
3
3
|
activeCellCoordinates: any;
|
4
4
|
containerHasFocus: any;
|
5
5
|
createActiveCell: any;
|
6
|
+
activeCellContent: any;
|
7
|
+
isActiveHeaderCellChanged: any;
|
6
8
|
}): void;
|
@@ -16,8 +16,15 @@ var useMoveActiveCell = function useMoveActiveCell(_ref) {
|
|
16
16
|
var spreadsheetRef = _ref.spreadsheetRef,
|
17
17
|
activeCellCoordinates = _ref.activeCellCoordinates,
|
18
18
|
containerHasFocus = _ref.containerHasFocus,
|
19
|
-
createActiveCell = _ref.createActiveCell
|
19
|
+
createActiveCell = _ref.createActiveCell,
|
20
|
+
activeCellContent = _ref.activeCellContent,
|
21
|
+
isActiveHeaderCellChanged = _ref.isActiveHeaderCellChanged;
|
22
|
+
//new active cell is created when the activeCellContent changes or navigate through headers
|
23
|
+
// Otherwise new active cell will display the old value in a glance
|
20
24
|
React.useEffect(function () {
|
25
|
+
performCreateActiveCell();
|
26
|
+
}, [activeCellContent, performCreateActiveCell, isActiveHeaderCellChanged]);
|
27
|
+
var performCreateActiveCell = React.useCallback(function () {
|
21
28
|
var activeCellPlacementElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"".concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column, "\"]"));
|
22
29
|
var shouldPlaceActiveCellInHeader = (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' && true;
|
23
30
|
var selectAllElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"header\"][data-column-index=\"header\"]");
|
@@ -28,7 +35,7 @@ var useMoveActiveCell = function useMoveActiveCell(_ref) {
|
|
28
35
|
addToHeader: shouldPlaceActiveCellInHeader
|
29
36
|
});
|
30
37
|
}
|
31
|
-
}, [activeCellCoordinates,
|
38
|
+
}, [spreadsheetRef, activeCellCoordinates, containerHasFocus, createActiveCell]);
|
32
39
|
};
|
33
40
|
|
34
41
|
exports.useMoveActiveCell = useMoveActiveCell;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export function handleBodyCellClick(cell: any, columnIndex: any, event: any, ...rest: any[]): void;
|
2
|
+
export function handleBodyCellHover(cell: any, columnIndex: any, ...rest: any[]): void;
|
3
|
+
export function handleRowHeaderClick(index: any, event: any, ...rest: any[]): void;
|
4
|
+
export function handleKeyPress(event: any, ...rest: any[]): any;
|
@@ -0,0 +1,311 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var settings = require('../../../settings.js');
|
14
|
+
var checkForHoldingKey = require('./checkForHoldingKey.js');
|
15
|
+
var deepCloneObject = require('../../../global/js/utils/deepCloneObject.js');
|
16
|
+
var uuidv4 = require('../../../global/js/utils/uuidv4.js');
|
17
|
+
var removeCellSelections = require('./removeCellSelections.js');
|
18
|
+
var handleHeaderCellSelection = require('./handleHeaderCellSelection.js');
|
19
|
+
var handleMultipleKeys = require('./handleMultipleKeys.js');
|
20
|
+
var handleActiveCellInSelectionEnter = require('./handleActiveCellInSelectionEnter.js');
|
21
|
+
var handleActiveCellInSelectionTab = require('./handleActiveCellInSelectionTab.js');
|
22
|
+
var handleCellDeletion = require('./handleCellDeletion.js');
|
23
|
+
|
24
|
+
var blockClass = "".concat(settings.pkg.prefix, "--data-spreadsheet");
|
25
|
+
|
26
|
+
// onClick fn for each cell in the data spreadsheet body,
|
27
|
+
// adds the active cell highlight
|
28
|
+
|
29
|
+
var handleBodyCellClick = function handleBodyCellClick(cell, columnIndex, event) {
|
30
|
+
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
31
|
+
rest[_key - 3] = arguments[_key];
|
32
|
+
}
|
33
|
+
var currentMatcher = rest[0],
|
34
|
+
activeCellCoordinates = rest[1],
|
35
|
+
selectionAreas = rest[2],
|
36
|
+
setActiveCellCoordinates = rest[3],
|
37
|
+
setSelectionAreas = rest[4],
|
38
|
+
setContainerHasFocus = rest[5],
|
39
|
+
setClickAndHoldActive = rest[6],
|
40
|
+
setCurrentMatcher = rest[7],
|
41
|
+
ref = rest[8],
|
42
|
+
setSelectionAreaData = rest[9],
|
43
|
+
setActiveCellInsideSelectionArea = rest[10],
|
44
|
+
activeCellRef = rest[11],
|
45
|
+
setValidStartingPoint = rest[12];
|
46
|
+
event.preventDefault();
|
47
|
+
var closestBodyCell = event.target.closest(".".concat(blockClass, "__body--td"));
|
48
|
+
var isValidSelectionAreaStart = closestBodyCell.classList.contains("".concat(blockClass, "__body--td"));
|
49
|
+
setValidStartingPoint(isValidSelectionAreaStart);
|
50
|
+
var isHoldingCommandKey = checkForHoldingKey.checkForHoldingKey(event, 'cmd');
|
51
|
+
var isHoldingShiftKey = checkForHoldingKey.checkForHoldingKey(event, 'shiftKey');
|
52
|
+
setContainerHasFocus(true);
|
53
|
+
var activeCoordinates = {
|
54
|
+
row: cell.row.index,
|
55
|
+
column: columnIndex
|
56
|
+
};
|
57
|
+
var tempMatcher = uuidv4["default"]();
|
58
|
+
setClickAndHoldActive(true);
|
59
|
+
|
60
|
+
// prevent multiple selections unless cmd key is held
|
61
|
+
// meaning that selectionAreas should only have one item by default
|
62
|
+
if (isHoldingCommandKey) {
|
63
|
+
var activeCellElement = ref.current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
|
64
|
+
activeCellElement.setAttribute('data-selection-id', tempMatcher);
|
65
|
+
setActiveCellInsideSelectionArea(true);
|
66
|
+
setActiveCellCoordinates(activeCoordinates);
|
67
|
+
setCurrentMatcher(tempMatcher);
|
68
|
+
setSelectionAreas(function (prev) {
|
69
|
+
return [].concat(_rollupPluginBabelHelpers.toConsumableArray(prev), [{
|
70
|
+
point1: activeCoordinates,
|
71
|
+
matcher: tempMatcher
|
72
|
+
}]);
|
73
|
+
});
|
74
|
+
} else if (isHoldingShiftKey) {
|
75
|
+
setContainerHasFocus(true);
|
76
|
+
var selectionAreaClone = deepCloneObject.deepCloneObject(selectionAreas);
|
77
|
+
var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
|
78
|
+
return item.matcher === currentMatcher;
|
79
|
+
});
|
80
|
+
if (indexOfItemToUpdate === -1) {
|
81
|
+
// There is always a selectionArea with a point1 object that updates
|
82
|
+
// whenever the activeCellCoordinates update, we should always be able
|
83
|
+
// to find an index, but if we do not for some reason we should return
|
84
|
+
// at this point.
|
85
|
+
return;
|
86
|
+
} else {
|
87
|
+
// Update the selectionArea that was found, do not update currentMatcher
|
88
|
+
selectionAreaClone[indexOfItemToUpdate].point1 = activeCellCoordinates;
|
89
|
+
selectionAreaClone[indexOfItemToUpdate].point2 = activeCoordinates;
|
90
|
+
selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
|
91
|
+
selectionAreaClone[indexOfItemToUpdate].matcher = currentMatcher;
|
92
|
+
setSelectionAreas(selectionAreaClone);
|
93
|
+
}
|
94
|
+
} else {
|
95
|
+
activeCellRef.current.style.display = 'none';
|
96
|
+
setActiveCellInsideSelectionArea(false);
|
97
|
+
setActiveCellCoordinates(activeCoordinates);
|
98
|
+
// remove all previous cell selections
|
99
|
+
removeCellSelections.removeCellSelections({
|
100
|
+
spreadsheetRef: ref
|
101
|
+
});
|
102
|
+
setSelectionAreas([{
|
103
|
+
point1: activeCoordinates,
|
104
|
+
matcher: tempMatcher
|
105
|
+
}]);
|
106
|
+
setCurrentMatcher(tempMatcher);
|
107
|
+
setSelectionAreaData([]);
|
108
|
+
}
|
109
|
+
};
|
110
|
+
var handleBodyCellHover = function handleBodyCellHover(cell, columnIndex) {
|
111
|
+
for (var _len2 = arguments.length, rest = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
112
|
+
rest[_key2 - 2] = arguments[_key2];
|
113
|
+
}
|
114
|
+
var clickAndHoldActive = rest[0],
|
115
|
+
currentMatcher = rest[1],
|
116
|
+
setSelectionAreas = rest[2];
|
117
|
+
if (clickAndHoldActive) {
|
118
|
+
var cellCoordinates = {
|
119
|
+
row: cell.row.index,
|
120
|
+
column: columnIndex
|
121
|
+
};
|
122
|
+
setSelectionAreas(function (prev) {
|
123
|
+
var _selectionAreaClone$i, _selectionAreaClone$i2;
|
124
|
+
var selectionAreaClone = deepCloneObject.deepCloneObject(prev);
|
125
|
+
var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
|
126
|
+
return item.matcher === currentMatcher;
|
127
|
+
});
|
128
|
+
// No items in the array match up with the currentMatcher value
|
129
|
+
if (indexOfItemToUpdate === -1) {
|
130
|
+
return prev;
|
131
|
+
}
|
132
|
+
// Do not update state if you're still hovering on the same cell
|
133
|
+
if (((_selectionAreaClone$i = selectionAreaClone[indexOfItemToUpdate].point2) === null || _selectionAreaClone$i === void 0 ? void 0 : _selectionAreaClone$i.row) === cellCoordinates.row && ((_selectionAreaClone$i2 = selectionAreaClone[indexOfItemToUpdate].point2) === null || _selectionAreaClone$i2 === void 0 ? void 0 : _selectionAreaClone$i2.column) === cellCoordinates.column) {
|
134
|
+
return prev;
|
135
|
+
}
|
136
|
+
selectionAreaClone[indexOfItemToUpdate].point2 = cellCoordinates;
|
137
|
+
selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
|
138
|
+
return selectionAreaClone;
|
139
|
+
});
|
140
|
+
}
|
141
|
+
};
|
142
|
+
var handleRowHeaderClick = function handleRowHeaderClick(index, event) {
|
143
|
+
for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
144
|
+
rest[_key3 - 2] = arguments[_key3];
|
145
|
+
}
|
146
|
+
var columns = rest[0],
|
147
|
+
ref = rest[1],
|
148
|
+
setSelectionAreas = rest[2],
|
149
|
+
setCurrentMatcher = rest[3],
|
150
|
+
setActiveCellCoordinates = rest[4],
|
151
|
+
activeCellCoordinates = rest[5],
|
152
|
+
rows = rest[6],
|
153
|
+
setSelectionAreaData = rest[7];
|
154
|
+
var isHoldingCommandKey = checkForHoldingKey.checkForHoldingKey(event, 'cmd');
|
155
|
+
handleHeaderCellSelection.handleHeaderCellSelection({
|
156
|
+
type: 'row',
|
157
|
+
activeCellCoordinates: activeCellCoordinates,
|
158
|
+
rows: rows,
|
159
|
+
columns: columns,
|
160
|
+
setActiveCellCoordinates: setActiveCellCoordinates,
|
161
|
+
setCurrentMatcher: setCurrentMatcher,
|
162
|
+
setSelectionAreas: setSelectionAreas,
|
163
|
+
spreadsheetRef: ref,
|
164
|
+
index: index,
|
165
|
+
setSelectionAreaData: setSelectionAreaData,
|
166
|
+
isHoldingCommandKey: isHoldingCommandKey
|
167
|
+
});
|
168
|
+
};
|
169
|
+
var handleKeyPress = function handleKeyPress(event) {
|
170
|
+
for (var _len4 = arguments.length, rest = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
171
|
+
rest[_key4 - 1] = arguments[_key4];
|
172
|
+
}
|
173
|
+
var activeCellInsideSelectionArea = rest[0],
|
174
|
+
updateActiveCellCoordinates = rest[1],
|
175
|
+
activeCellCoordinates = rest[2],
|
176
|
+
removeActiveCell = rest[3],
|
177
|
+
columns = rest[4],
|
178
|
+
rows = rest[5],
|
179
|
+
spreadsheetRef = rest[6],
|
180
|
+
currentMatcher = rest[7],
|
181
|
+
removeCellEditor = rest[8],
|
182
|
+
selectionAreas = rest[9],
|
183
|
+
handleHomeEndKey = rest[10],
|
184
|
+
keysPressedList = rest[11],
|
185
|
+
usingMac = rest[12],
|
186
|
+
updateData = rest[13],
|
187
|
+
checkForReturnCondition = rest[14],
|
188
|
+
handleArrowKeyPress = rest[15],
|
189
|
+
setSelectionAreas = rest[16],
|
190
|
+
setSelectionAreaData = rest[17],
|
191
|
+
setCurrentMatcher = rest[18],
|
192
|
+
activeCellRef = rest[19],
|
193
|
+
setActiveCellCoordinates = rest[20],
|
194
|
+
setContainerHasFocus = rest[21],
|
195
|
+
setActiveCellContent = rest[22];
|
196
|
+
var key = event.key;
|
197
|
+
// Command keys need to be returned as there is default browser behavior with these keys
|
198
|
+
// Needs to be returned in editing mode
|
199
|
+
if (checkForReturnCondition(key)) {
|
200
|
+
return;
|
201
|
+
}
|
202
|
+
|
203
|
+
// Clear out all cell selection areas if user uses any arrow key, except if the shift key is being held
|
204
|
+
if (['ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown'].indexOf(key) > -1) {
|
205
|
+
if (selectionAreas !== null && selectionAreas !== void 0 && selectionAreas.length && keysPressedList.length < 2 && !handleMultipleKeys.includesShift(keysPressedList)) {
|
206
|
+
setSelectionAreas([]);
|
207
|
+
setSelectionAreaData([]);
|
208
|
+
removeCellSelections.removeCellSelections({
|
209
|
+
spreadsheetRef: spreadsheetRef
|
210
|
+
});
|
211
|
+
}
|
212
|
+
}
|
213
|
+
if ((keysPressedList === null || keysPressedList === void 0 ? void 0 : keysPressedList.length) > 1) {
|
214
|
+
handleMultipleKeys.handleMultipleKeys({
|
215
|
+
activeCellCoordinates: activeCellCoordinates,
|
216
|
+
event: event,
|
217
|
+
keysPressedList: keysPressedList,
|
218
|
+
selectionAreas: selectionAreas,
|
219
|
+
currentMatcher: currentMatcher,
|
220
|
+
rows: rows,
|
221
|
+
setSelectionAreas: setSelectionAreas,
|
222
|
+
columns: columns,
|
223
|
+
updateActiveCellCoordinates: updateActiveCellCoordinates,
|
224
|
+
spreadsheetRef: spreadsheetRef,
|
225
|
+
removeCellSelections: removeCellSelections.removeCellSelections,
|
226
|
+
blockClass: blockClass,
|
227
|
+
setCurrentMatcher: setCurrentMatcher,
|
228
|
+
usingMac: usingMac
|
229
|
+
});
|
230
|
+
}
|
231
|
+
|
232
|
+
// Allow arrow key navigation if there are less than two activeKeys OR
|
233
|
+
// if one of the activeCellCoordinates is in a header position
|
234
|
+
// Prevent arrow keys, home key, and end key from scrolling the page when the data spreadsheet container has focus
|
235
|
+
|
236
|
+
if (keysPressedList.length < 2 && !handleMultipleKeys.includesShift(keysPressedList) || activeCellCoordinates.row === 'header' || activeCellCoordinates.column === 'header') {
|
237
|
+
switch (key) {
|
238
|
+
case 'Backspace':
|
239
|
+
case 'Delete':
|
240
|
+
{
|
241
|
+
var deleteParams = {
|
242
|
+
selectionAreas: selectionAreas,
|
243
|
+
currentMatcher: currentMatcher,
|
244
|
+
rows: rows,
|
245
|
+
setActiveCellContent: setActiveCellContent,
|
246
|
+
updateData: updateData,
|
247
|
+
activeCellCoordinates: activeCellCoordinates
|
248
|
+
};
|
249
|
+
handleCellDeletion.handleCellDeletion(deleteParams);
|
250
|
+
break;
|
251
|
+
}
|
252
|
+
// Enter
|
253
|
+
case 'Enter':
|
254
|
+
{
|
255
|
+
handleActiveCellInSelectionEnter.handleActiveCellInSelectionEnter({
|
256
|
+
activeCellInsideSelectionArea: activeCellInsideSelectionArea,
|
257
|
+
activeCellCoordinates: activeCellCoordinates,
|
258
|
+
activeCellRef: activeCellRef,
|
259
|
+
selectionAreas: selectionAreas,
|
260
|
+
updateActiveCellCoordinates: updateActiveCellCoordinates
|
261
|
+
});
|
262
|
+
break;
|
263
|
+
}
|
264
|
+
// HOME
|
265
|
+
case 'Home':
|
266
|
+
case 'End':
|
267
|
+
{
|
268
|
+
event.preventDefault();
|
269
|
+
if (handleMultipleKeys.includesResourceKey(keysPressedList, usingMac)) {
|
270
|
+
return;
|
271
|
+
}
|
272
|
+
handleHomeEndKey({
|
273
|
+
type: key
|
274
|
+
});
|
275
|
+
break;
|
276
|
+
}
|
277
|
+
// Tab
|
278
|
+
case 'Tab':
|
279
|
+
{
|
280
|
+
if (activeCellInsideSelectionArea) {
|
281
|
+
event.preventDefault();
|
282
|
+
return handleActiveCellInSelectionTab.handleActiveCellInSelectionTab({
|
283
|
+
activeCellInsideSelectionArea: activeCellInsideSelectionArea,
|
284
|
+
activeCellCoordinates: activeCellCoordinates,
|
285
|
+
activeCellRef: activeCellRef,
|
286
|
+
selectionAreas: selectionAreas,
|
287
|
+
updateActiveCellCoordinates: updateActiveCellCoordinates
|
288
|
+
});
|
289
|
+
}
|
290
|
+
setSelectionAreas([]);
|
291
|
+
removeActiveCell();
|
292
|
+
removeCellEditor();
|
293
|
+
setContainerHasFocus(false);
|
294
|
+
setActiveCellCoordinates(null);
|
295
|
+
break;
|
296
|
+
}
|
297
|
+
case 'ArrowLeft':
|
298
|
+
case 'ArrowUp':
|
299
|
+
case 'ArrowRight':
|
300
|
+
case 'ArrowDown':
|
301
|
+
{
|
302
|
+
handleArrowKeyPress(key);
|
303
|
+
}
|
304
|
+
}
|
305
|
+
}
|
306
|
+
};
|
307
|
+
|
308
|
+
exports.handleBodyCellClick = handleBodyCellClick;
|
309
|
+
exports.handleBodyCellHover = handleBodyCellHover;
|
310
|
+
exports.handleKeyPress = handleKeyPress;
|
311
|
+
exports.handleRowHeaderClick = handleRowHeaderClick;
|
@@ -107,7 +107,8 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
107
107
|
instance: datagridState,
|
108
108
|
keysPressedList: keysPressedList,
|
109
109
|
state: inlineEditState,
|
110
|
-
usingMac: usingMac
|
110
|
+
usingMac: usingMac,
|
111
|
+
ref: multiKeyTrackingRef
|
111
112
|
});
|
112
113
|
},
|
113
114
|
onFocus: withInlineEdit && function () {
|
@@ -43,7 +43,10 @@ var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
|
|
43
43
|
link: emptyStateLink
|
44
44
|
};
|
45
45
|
var validEmptyStates = ['error', 'noData', 'notFound'];
|
46
|
-
return /*#__PURE__*/React__default["default"].createElement(react.TableBody, _rollupPluginBabelHelpers["extends"]({}, getTableBodyProps(
|
46
|
+
return /*#__PURE__*/React__default["default"].createElement(react.TableBody, _rollupPluginBabelHelpers["extends"]({}, getTableBodyProps({
|
47
|
+
role: undefined
|
48
|
+
}), {
|
49
|
+
"aria-live": null,
|
47
50
|
className: "".concat(blockClass, "__empty-state-body")
|
48
51
|
}), /*#__PURE__*/React__default["default"].createElement(react.TableRow, null, /*#__PURE__*/React__default["default"].createElement(react.TableCell, {
|
49
52
|
colSpan: headers.length,
|
@@ -29,7 +29,9 @@ var DatagridRefBody = function DatagridRefBody(datagridState) {
|
|
29
29
|
var getTableBodyProps = datagridState.getTableBodyProps,
|
30
30
|
rows = datagridState.rows,
|
31
31
|
prepareRow = datagridState.prepareRow;
|
32
|
-
return /*#__PURE__*/React__default["default"].createElement("tbody", _rollupPluginBabelHelpers["extends"]({}, getTableBodyProps(
|
32
|
+
return /*#__PURE__*/React__default["default"].createElement("tbody", _rollupPluginBabelHelpers["extends"]({}, getTableBodyProps({
|
33
|
+
role: undefined
|
34
|
+
}), {
|
33
35
|
className: cx__default["default"]("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
|
34
36
|
}), rows.map(function (row) {
|
35
37
|
prepareRow(row);
|
@@ -25,7 +25,10 @@ var DatagridSimpleBody = function DatagridSimpleBody(datagridState) {
|
|
25
25
|
var getTableBodyProps = datagridState.getTableBodyProps,
|
26
26
|
rows = datagridState.rows,
|
27
27
|
prepareRow = datagridState.prepareRow;
|
28
|
-
return /*#__PURE__*/React__default["default"].createElement(react.TableBody, _rollupPluginBabelHelpers["extends"]({}, getTableBodyProps(
|
28
|
+
return /*#__PURE__*/React__default["default"].createElement(react.TableBody, _rollupPluginBabelHelpers["extends"]({}, getTableBodyProps({
|
29
|
+
role: undefined
|
30
|
+
}), {
|
31
|
+
"aria-live": null,
|
29
32
|
className: cx__default["default"]("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
|
30
33
|
}), rows.map(function (row) {
|
31
34
|
prepareRow(row);
|
@@ -85,7 +85,11 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
85
85
|
width: (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
|
86
86
|
overflow: 'hidden'
|
87
87
|
}
|
88
|
-
}, /*#__PURE__*/React__default["default"].createElement(DatagridHead["default"], datagridState)), /*#__PURE__*/React__default["default"].createElement(react.TableBody,
|
88
|
+
}, /*#__PURE__*/React__default["default"].createElement(DatagridHead["default"], datagridState)), /*#__PURE__*/React__default["default"].createElement(react.TableBody, _rollupPluginBabelHelpers["extends"]({}, getTableBodyProps({
|
89
|
+
role: undefined
|
90
|
+
}), {
|
91
|
+
"aria-live": null
|
92
|
+
}), /*#__PURE__*/React__default["default"].createElement(reactWindow.VariableSizeList, {
|
89
93
|
height: virtualHeight || tableHeight,
|
90
94
|
itemCount: visibleRows.length,
|
91
95
|
itemSize: function itemSize(index) {
|