From 55db84e2a33fe8964f1eb5018671f9b9f017a98c Mon Sep 17 00:00:00 2001 From: lumixraku Date: Thu, 17 Oct 2024 20:09:08 +0800 Subject: [PATCH] fix: auto col only when dblclick, not trigger by set range value --- .../src/components/sheets/sheet-skeleton.ts | 2 +- .../src/controllers/auto-width.controller.ts | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/packages/engine-render/src/components/sheets/sheet-skeleton.ts b/packages/engine-render/src/components/sheets/sheet-skeleton.ts index 68780c21d2b..0a5d2e6ea30 100644 --- a/packages/engine-render/src/components/sheets/sheet-skeleton.ts +++ b/packages/engine-render/src/components/sheets/sheet-skeleton.ts @@ -1703,7 +1703,7 @@ export class SpreadsheetSkeleton extends Skeleton { continue; } const { w = defaultColumnWidth, aw, ia } = columnDataItem; - if ((ia === BooleanNumber.TRUE) && typeof aw === 'number') { + if (typeof aw === 'number') { columnWidth = aw; } else { columnWidth = w; diff --git a/packages/sheets-ui/src/controllers/auto-width.controller.ts b/packages/sheets-ui/src/controllers/auto-width.controller.ts index eeeb0ee89e1..9cc0666f4e7 100644 --- a/packages/sheets-ui/src/controllers/auto-width.controller.ts +++ b/packages/sheets-ui/src/controllers/auto-width.controller.ts @@ -17,7 +17,6 @@ import type { IColAutoWidthInfo, IRange, Workbook } from '@univerjs/core'; import type { RenderManagerService } from '@univerjs/engine-render'; import type { - ISetRangeValuesRangeMutationParams, ISetStyleCommandParams, ISetWorksheetColAutoWidthMutationParams, ISetWorksheetColIsAutoWidthMutationParams, @@ -25,7 +24,6 @@ import type { import { Disposable, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core'; import { IRenderManagerService } from '@univerjs/engine-render'; import { - SetRangeValuesCommand, SetStyleCommand, SetWorksheetColAutoWidthMutation, SetWorksheetColAutoWidthMutationFactory, @@ -91,19 +89,6 @@ export class AutoWidthController extends Disposable { private _initialize() { const { _sheetInterceptorService: sheetInterceptorService, _selectionManagerService: selectionManagerService } = this; - // for intercept'SetRangeValuesCommand' command. - this.disposeWithMe(sheetInterceptorService.interceptCommand({ - getMutations: (command: { id: string; params: ISetRangeValuesRangeMutationParams }) => { - if (command.id !== SetRangeValuesCommand.id) { - return { - redos: [], - undos: [], - }; - } - - return this.getUndoRedoParamsOfColWidth(command.params.range); - }, - })); // for intercept 'sheet.command.set-col-is-auto-width' command. this.disposeWithMe(sheetInterceptorService.interceptCommand({