UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

56 lines (51 loc) 1.23 kB
/** * Copyright IBM Corp. 2020, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; var removeCellSelections = require('./removeCellSelections.js'); var uuidv4 = require('../../../global/js/utils/uuidv4.js'); const selectAllCells = _ref => { let { activeCellCoordinates, columns, setCurrentMatcher, setSelectionAreas, ref, rows, updateActiveCellCoordinates } = _ref; removeCellSelections.removeCellSelections({ spreadsheetRef: ref }); const selectionPoint1 = { row: 0, column: 0 }; const selectionPoint2 = { row: rows.length - 1, column: columns.length - 1 }; const tempMatcher = uuidv4.default(); const newSelectionArea = { point1: selectionPoint1, point2: selectionPoint2, areaCreated: false, matcher: tempMatcher }; const coordinatesClone = { ...activeCellCoordinates }; updateActiveCellCoordinates({ coords: coordinatesClone, updatedValue: { column: 0, row: 0 } }); setCurrentMatcher(tempMatcher); return setSelectionAreas([newSelectionArea]); }; exports.selectAllCells = selectAllCells;