Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
refactor: change MarkDirtyRowAutoHeightMutation to MarkDirtyRowAutoHeightOperation (#6787)
wpxp123456c1689057e0f1
diff --git a/packages/sheets-ui/src/controllers/__tests__/auto-height.controller.spec.ts b/packages/sheets-ui/src/controllers/__tests__/auto-height.controller.spec.tsindex a4609dd0c6..a3316d3900 100644--- a/packages/sheets-ui/src/controllers/__tests__/auto-height.controller.spec.ts+++ b/packages/sheets-ui/src/controllers/__tests__/auto-height.controller.spec.ts@@ -18,8 +18,8 @@ import type { IUniverInstanceService, Workbook } from '@univerjs/core';import type { RenderManagerService } from '@univerjs/engine-render';import type { SheetInterceptorService } from '@univerjs/sheets';import {- CancelMarkDirtyRowAutoHeightMutation,- MarkDirtyRowAutoHeightMutation,+ CancelMarkDirtyRowAutoHeightOperation,+ MarkDirtyRowAutoHeightOperation,} from '@univerjs/sheets';import { describe, expect, it } from 'vitest';import { AutoHeightController } from '../auto-height.controller';@@ -83,7 +83,7 @@ describe('AutoHeightController', () => {// If our inline execution happened, we should have redo/undo mutations appended.expect(result.redos).toEqual([{- id: MarkDirtyRowAutoHeightMutation.id,+ id: MarkDirtyRowAutoHeightOperation.id,params: {unitId: 'u-1',subUnitId: 's-1',@@ -98,7 +98,7 @@ describe('AutoHeightController', () => {expect(result.undos).toEqual([{- id: CancelMarkDirtyRowAutoHeightMutation.id,+ id: CancelMarkDirtyRowAutoHeightOperation.id,params: {unitId: 'u-1',subUnitId: 's-1',diff --git a/packages/sheets-ui/src/controllers/auto-height.controller.ts b/packages/sheets-ui/src/controllers/auto-height.controller.tsindex 874fa31dd9..ccc2d877f6 100644--- a/packages/sheets-ui/src/controllers/auto-height.controller.ts+++ b/packages/sheets-ui/src/controllers/auto-height.controller.ts@@ -19,9 +19,9 @@ import type { ISetWorksheetRowAutoHeightMutationParams } from '@univerjs/sheets'import { Disposable, generateRandomId, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';import { IRenderManagerService } from '@univerjs/engine-render';import {- CancelMarkDirtyRowAutoHeightMutation,+ CancelMarkDirtyRowAutoHeightOperation,getSheetCommandTarget,- MarkDirtyRowAutoHeightMutation,+ MarkDirtyRowAutoHeightOperation,SetWorksheetRowAutoHeightMutation,SetWorksheetRowAutoHeightMutationFactory,SheetInterceptorService,@@ -41,7 +41,7 @@ export class AutoHeightController extends Disposable {private _processLazyAutoHeight(redoUndoItem: { redos: IMutationInfo[]; undos: IMutationInfo[] }, unitId: string, subUnitId: string, lazyAutoHeightRanges?: IRange[]) {if (lazyAutoHeightRanges?.length) {const redo = {- id: MarkDirtyRowAutoHeightMutation.id,+ id: MarkDirtyRowAutoHeightOperation.id,params: {unitId,subUnitId,@@ -53,7 +53,7 @@ export class AutoHeightController extends Disposable {},};const undo = {- id: CancelMarkDirtyRowAutoHeightMutation.id,+ id: CancelMarkDirtyRowAutoHeightOperation.id,params: {unitId,subUnitId,diff --git a/packages/sheets-ui/src/services/__tests__/auto-height.service.spec.ts b/packages/sheets-ui/src/services/__tests__/auto-height.service.spec.tsindex e6b0f0456f..a6fc1a883a 100644--- a/packages/sheets-ui/src/services/__tests__/auto-height.service.spec.ts+++ b/packages/sheets-ui/src/services/__tests__/auto-height.service.spec.ts@@ -17,7 +17,7 @@import type { ICommandInfo, ICommandService as ICommandServiceType, Workbook } from '@univerjs/core';import type { Engine, IRenderContext, Scene } from '@univerjs/engine-render';import { ICommandService, Injector, UniverInstanceType } from '@univerjs/core';-import { MarkDirtyRowAutoHeightMutation, SetWorksheetRowAutoHeightMutation } from '@univerjs/sheets';+import { MarkDirtyRowAutoHeightOperation, SetWorksheetRowAutoHeightMutation } from '@univerjs/sheets';import { BehaviorSubject } from 'rxjs';import { describe, expect, it, vi } from 'vitest';import { AutoHeightService, taskRowsFromRanges } from '../auto-height.service';@@ -178,7 +178,7 @@ describe('AutoHeightService', () => {expect(commandHandlers).toHaveLength(1);commandHandlers[0]({- id: MarkDirtyRowAutoHeightMutation.id,+ id: MarkDirtyRowAutoHeightOperation.id,params: {unitId: 'u-1',subUnitId: 's-1',diff --git a/packages/sheets-ui/src/services/auto-height.service.ts b/packages/sheets-ui/src/services/auto-height.service.tsindex 7f5b82532c..58b2f79437 100644--- a/packages/sheets-ui/src/services/auto-height.service.ts+++ b/packages/sheets-ui/src/services/auto-height.service.ts@@ -16,9 +16,9 @@import type { IRange, Workbook } from '@univerjs/core';import type { IRenderContext, IRenderModule, SpreadsheetSkeleton } from '@univerjs/engine-render';-import type { ICancelMarkDirtyRowAutoHeightMutationParams, IMarkDirtyRowAutoHeightMutationParams } from '@univerjs/sheets';+import type { ICancelMarkDirtyRowAutoHeightOperationParams, IMarkDirtyRowAutoHeightOperationParams } from '@univerjs/sheets';import { createIdentifier, Disposable, ICommandService, Inject, Rectangle } from '@univerjs/core';-import { CancelMarkDirtyRowAutoHeightMutation, MarkDirtyRowAutoHeightMutation, SetWorksheetRowAutoHeightMutation } from '@univerjs/sheets';+import { CancelMarkDirtyRowAutoHeightOperation, MarkDirtyRowAutoHeightOperation, SetWorksheetRowAutoHeightMutation } from '@univerjs/sheets';import { SheetSkeletonManagerService } from './sheet-skeleton-manager.service';export interface IAutoHeightTask {@@ -86,8 +86,8 @@ export class AutoHeightService extends Disposable implements IRenderModule {private _initMarkDirty() {this.disposeWithMe(this._commandService.onCommandExecuted((info) => {- if (info.id === MarkDirtyRowAutoHeightMutation.id) {- const params = info.params as IMarkDirtyRowAutoHeightMutationParams;+ if (info.id === MarkDirtyRowAutoHeightOperation.id) {+ const params = info.params as IMarkDirtyRowAutoHeightOperationParams;const { unitId, subUnitId, ranges, id } = params;if (unitId !== this._context.unitId) {return;@@ -102,8 +102,8 @@ export class AutoHeightService extends Disposable implements IRenderModule {});}- if (info.id === CancelMarkDirtyRowAutoHeightMutation.id) {- const params = info.params as ICancelMarkDirtyRowAutoHeightMutationParams;+ if (info.id === CancelMarkDirtyRowAutoHeightOperation.id) {+ const params = info.params as ICancelMarkDirtyRowAutoHeightOperationParams;const { unitId, id } = params;if (unitId !== this._context.unitId) {return;diff --git a/packages/sheets/src/commands/mutations/mark-dirty-auto-height.mutation.ts b/packages/sheets/src/commands/operations/mark-dirty-auto-height.operation.tssimilarity index 61%rename from packages/sheets/src/commands/mutations/mark-dirty-auto-height.mutation.tsrename to packages/sheets/src/commands/operations/mark-dirty-auto-height.operation.tsindex 7d987cf93e..d9e7602625 100644--- a/packages/sheets/src/commands/mutations/mark-dirty-auto-height.mutation.ts+++ b/packages/sheets/src/commands/operations/mark-dirty-auto-height.operation.ts@@ -14,33 +14,33 @@* limitations under the License.*/-import type { IMutation, IRange } from '@univerjs/core';+import type { IOperation, IRange } from '@univerjs/core';import { CommandType } from '@univerjs/core';-export interface IMarkDirtyRowAutoHeightMutationParams {+export interface IMarkDirtyRowAutoHeightOperationParams {unitId: string;subUnitId: string;ranges: IRange[];id: string;}-export const MarkDirtyRowAutoHeightMutation: IMutation<IMarkDirtyRowAutoHeightMutationParams> = {- id: 'sheet.mutation.mark-dirty-row-auto-height',- type: CommandType.MUTATION,+export const MarkDirtyRowAutoHeightOperation: IOperation<IMarkDirtyRowAutoHeightOperationParams> = {+ id: 'sheet.operation.mark-dirty-row-auto-height',+ type: CommandType.OPERATION,handler: () => {return true;},};-export interface ICancelMarkDirtyRowAutoHeightMutationParams {+export interface ICancelMarkDirtyRowAutoHeightOperationParams {unitId: string;subUnitId: string;id: string;}-export const CancelMarkDirtyRowAutoHeightMutation: IMutation<ICancelMarkDirtyRowAutoHeightMutationParams> = {- id: 'sheet.mutation.cancel-mark-dirty-row-auto-height',- type: CommandType.MUTATION,+export const CancelMarkDirtyRowAutoHeightOperation: IOperation<ICancelMarkDirtyRowAutoHeightOperationParams> = {+ id: 'sheet.operation.cancel-mark-dirty-row-auto-height',+ type: CommandType.OPERATION,handler: () => {return true;},diff --git a/packages/sheets/src/controllers/basic-worksheet.controller.ts b/packages/sheets/src/controllers/basic-worksheet.controller.tsindex df7de180f2..e349d320e1 100644--- a/packages/sheets/src/controllers/basic-worksheet.controller.ts+++ b/packages/sheets/src/controllers/basic-worksheet.controller.ts@@ -130,7 +130,6 @@ import { DeleteWorksheetRangeThemeStyleMutation } from '../commands/mutations/deimport { EmptyMutation } from '../commands/mutations/empty.mutation';import { InsertColMutation, InsertRowMutation } from '../commands/mutations/insert-row-col.mutation';import { InsertSheetMutation } from '../commands/mutations/insert-sheet.mutation';-import { CancelMarkDirtyRowAutoHeightMutation, MarkDirtyRowAutoHeightMutation } from '../commands/mutations/mark-dirty-auto-height.mutation';import { MarkDirtyFilterChangeMutation } from '../commands/mutations/mark-dirty-filter-change.mutation';import { MoveRangeMutation } from '../commands/mutations/move-range.mutation';import { MoveColsMutation, MoveRowsMutation } from '../commands/mutations/move-rows-cols.mutation';@@ -168,6 +167,7 @@ import {} from '../commands/mutations/set-worksheet-row-height.mutation';import { ToggleGridlinesMutation } from '../commands/mutations/toggle-gridlines.mutation';import { UnregisterWorksheetRangeThemeStyleMutation } from '../commands/mutations/unregister-range-theme-style.mutation';+import { CancelMarkDirtyRowAutoHeightOperation, MarkDirtyRowAutoHeightOperation } from '../commands/operations/mark-dirty-auto-height.operation';import { ScrollToCellOperation } from '../commands/operations/scroll-to-cell.operation';import { SelectRangeCommand, SetSelectionsOperation } from '../commands/operations/selection.operation';import { SetWorksheetActiveOperation } from '../commands/operations/set-worksheet-active.operation';@@ -218,8 +218,8 @@ export class BasicWorksheetController extends Disposable implements IDisposableSetRowHiddenMutation, // formula SUBTOTALSetRowVisibleMutation,- MarkDirtyRowAutoHeightMutation,- CancelMarkDirtyRowAutoHeightMutation,+ MarkDirtyRowAutoHeightOperation,+ CancelMarkDirtyRowAutoHeightOperation,CopyWorksheetEndMutation,SetWorksheetRowCountMutation,diff --git a/packages/sheets/src/index.ts b/packages/sheets/src/index.tsindex 24469e85b0..3e5bce195a 100644--- a/packages/sheets/src/index.ts+++ b/packages/sheets/src/index.ts@@ -230,12 +230,6 @@ export {InsertRowMutationUndoFactory,} from './commands/mutations/insert-row-col.mutation';export { InsertSheetMutation, InsertSheetUndoMutationFactory } from './commands/mutations/insert-sheet.mutation';-export {- CancelMarkDirtyRowAutoHeightMutation,- type ICancelMarkDirtyRowAutoHeightMutationParams,- type IMarkDirtyRowAutoHeightMutationParams,- MarkDirtyRowAutoHeightMutation,-} from './commands/mutations/mark-dirty-auto-height.mutation';export { type IMarkDirtyFilterChangeMutationParams, MarkDirtyFilterChangeMutation } from './commands/mutations/mark-dirty-filter-change.mutation';export { type IMoveRangeMutationParams, MoveRangeMutation } from './commands/mutations/move-range.mutation';export {@@ -323,6 +317,12 @@ export {} from './commands/mutations/set-worksheet-row-height.mutation';export { type IToggleGridlinesMutationParams, ToggleGridlinesMutation } from './commands/mutations/toggle-gridlines.mutation';export { type IUnregisterWorksheetRangeThemeStyleMutationParams, UnregisterWorksheetRangeThemeStyleMutation } from './commands/mutations/unregister-range-theme-style.mutation';+export {+ CancelMarkDirtyRowAutoHeightOperation,+ type ICancelMarkDirtyRowAutoHeightOperationParams,+ type IMarkDirtyRowAutoHeightOperationParams,+ MarkDirtyRowAutoHeightOperation,+} from './commands/operations/mark-dirty-auto-height.operation';export { type IScrollToCellOperationParams, ScrollToCellOperation } from './commands/operations/scroll-to-cell.operation';export { type ISelectRangeCommandParams, type ISetSelectionsOperationParams, SelectRangeCommand, SetSelectionsOperation } from './commands/operations/selection.operation';export { type ISetWorksheetActiveOperationParams, SetWorksheetActiveOperation } from './commands/operations/set-worksheet-active.operation';