UNPKG

@carbon/ibm-products

Version:
46 lines (44 loc) 1.27 kB
/** * 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. */ import uuidv4 from "../../../global/js/utils/uuidv4.js"; import { removeCellSelections } from "./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 }) => { removeCellSelections({ spreadsheetRef: ref }); const selectionPoint1 = { row: 0, column: 0 }; const selectionPoint2 = { row: rows.length - 1, column: columns.length - 1 }; const tempMatcher = uuidv4(); const newSelectionArea = { point1: selectionPoint1, point2: selectionPoint2, areaCreated: false, matcher: tempMatcher }; updateActiveCellCoordinates({ coords: { ...activeCellCoordinates }, updatedValue: { column: 0, row: 0 } }); setCurrentMatcher(tempMatcher); return setSelectionAreas([newSelectionArea]); }; //#endregion export { selectAllCells };