@carbon/ibm-products
Version:
Carbon for IBM Products
46 lines (44 loc) • 1.36 kB
JavaScript
/**
* Copyright IBM Corp. 2020, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const require_uuidv4 = require("../../../global/js/utils/uuidv4.js");
const require_removeCellSelections = require("./removeCellSelections.js");
//#region src/components/DataSpreadsheet/utils/selectAllCells.js
/**
* Copyright IBM Corp. 2022, 2022
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const selectAllCells = ({ activeCellCoordinates, columns, setCurrentMatcher, setSelectionAreas, ref, rows, updateActiveCellCoordinates }) => {
require_removeCellSelections.removeCellSelections({ spreadsheetRef: ref });
const selectionPoint1 = {
row: 0,
column: 0
};
const selectionPoint2 = {
row: rows.length - 1,
column: columns.length - 1
};
const tempMatcher = require_uuidv4.default();
const newSelectionArea = {
point1: selectionPoint1,
point2: selectionPoint2,
areaCreated: false,
matcher: tempMatcher
};
updateActiveCellCoordinates({
coords: { ...activeCellCoordinates },
updatedValue: {
column: 0,
row: 0
}
});
setCurrentMatcher(tempMatcher);
return setSelectionAreas([newSelectionArea]);
};
//#endregion
exports.selectAllCells = selectAllCells;