Skip to content

Commit

Permalink
Merge branch 'dev' into fix/selecion-add-error
Browse files Browse the repository at this point in the history
  • Loading branch information
weird94 authored Feb 12, 2025
2 parents 1fead0e + aee23ec commit e92b6ba
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ test('ensure switching render unit successful with no errors', async () => {
await page.waitForTimeout(1000);

await page.evaluate(() => window.E2EControllerAPI.loadDefaultSheet());
await page.waitForTimeout(1000);

const filename = generateSnapshotName('switching-render-unit');
const firstScreenshot = await page.screenshot({
mask: [
Expand Down
2 changes: 1 addition & 1 deletion packages/sheets-ui/src/facade/f-univer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ export class FUniverSheetsUIMixin extends FUniver implements IFUniverSheetsUIMix
if (COMMAND_LISTENER_SKELETON_CHANGE.indexOf(commandInfo.id) > -1) {
const sheet = this.getActiveSheet();
if (!sheet) return;
const ranges = getSkeletonChangedEffectedRange(commandInfo)
const ranges = getSkeletonChangedEffectedRange(commandInfo, sheet.worksheet.getMaxColumns())
.map((range) => this.getWorkbook(range.unitId)?.getSheetBySheetId(range.subUnitId)?.getRange(range.range))
.filter(Boolean) as FRange[];
if (!ranges.length) return;
Expand Down
23 changes: 19 additions & 4 deletions packages/sheets/src/basics/const/command-listener-const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import type { ICommandInfo, IRange } from '@univerjs/core';
import type { IMoveRangeMutationParams } from '../../commands/mutations/move-range.mutation';
import type { IMoveColumnsMutationParams, IMoveRowsMutationParams } from '../../commands/mutations/move-rows-cols.mutation';
import type { IReorderRangeMutationParams } from '../../commands/mutations/reorder-range.mutation';
Expand All @@ -32,7 +33,7 @@ import type {
import type { IToggleGridlinesMutationParams } from '../../commands/mutations/toggle-gridlines.mutation';
import type { ISetWorksheetActiveOperationParams } from '../../commands/operations/set-worksheet-active.operation';
import type { IAddWorksheetMergeMutationParams, IInsertColMutationParams, IInsertRowMutationParams, IRemoveColMutationParams, IRemoveRowsMutationParams, IRemoveWorksheetMergeMutationParams, IWorksheetRangeThemeStyleMutationParams } from '../interfaces';
import { type ICommandInfo, type IRange, ObjectMatrix, RANGE_TYPE } from '@univerjs/core';
import { ObjectMatrix, RANGE_TYPE } from '@univerjs/core';
import { AddWorksheetMergeMutation } from '../../commands/mutations/add-worksheet-merge.mutation';
import { SetWorksheetRangeThemeStyleMutation } from '../../commands/mutations/add-worksheet-range-theme.mutation';
import { DeleteWorksheetRangeThemeStyleMutation } from '../../commands/mutations/delete-worksheet-range-theme.mutation';
Expand Down Expand Up @@ -362,11 +363,10 @@ export function getValueChangedEffectedRange(commandInfo: ICommandInfo): { unitI
* @returns {{ unitId: string; subUnitId: string; range: IRange }[]} Array of affected ranges
*/
// eslint-disable-next-line max-lines-per-function
export function getSkeletonChangedEffectedRange(commandInfo: ICommandInfo): { unitId: string; subUnitId: string; range: IRange }[] {
export function getSkeletonChangedEffectedRange(commandInfo: ICommandInfo, columnCount: number): { unitId: string; subUnitId: string; range: IRange }[] {
switch (commandInfo.id) {
case SheetSkeletonChangeType.SET_WORKSHEET_ROW_HEIGHT:
case SheetSkeletonChangeType.SET_WORKSHEET_ROW_IS_AUTO_HEIGHT:
case SheetSkeletonChangeType.SET_WORKSHEET_ROW_AUTO_HEIGHT: {
case SheetSkeletonChangeType.SET_WORKSHEET_ROW_IS_AUTO_HEIGHT: {
const params = commandInfo.params as ISetWorksheetRowHeightMutationParams;
return params.ranges.map((range) => ({
unitId: params.unitId,
Expand All @@ -377,6 +377,21 @@ export function getSkeletonChangedEffectedRange(commandInfo: ICommandInfo): { un
},
}));
}
// Note: SET_WORKSHEET_ROW_AUTO_HEIGHT has no ranges
case SheetSkeletonChangeType.SET_WORKSHEET_ROW_AUTO_HEIGHT:{
const params = commandInfo.params as ISetWorksheetRowAutoHeightMutationParams;
return params.rowsAutoHeightInfo.map((rowAutoHeightInfo) => ({
unitId: params.unitId,
subUnitId: params.subUnitId,
range: {
startRow: rowAutoHeightInfo.row,
endRow: rowAutoHeightInfo.row,
startColumn: 0,
endColumn: columnCount - 1,
rangeType: RANGE_TYPE.ROW,
},
}));
}

case SheetSkeletonChangeType.SET_WORKSHEET_COL_WIDTH: {
const params = commandInfo.params as ISetWorksheetColWidthMutationParams;
Expand Down

0 comments on commit e92b6ba

Please sign in to comment.