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
fix(sheet): active next sheet when remove sheet (#2305)
Dushusir9a24216063a3
diff --git a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.tsindex 40dcd4e085..e5d61640f5 100644--- a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts+++ b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts@@ -16,7 +16,7 @@import type { IRange, IWorkbookData } from '@univerjs/core';import { DisposableCollection, ICommandService, LocaleType, Plugin, RANGE_TYPE, Univer, UniverInstanceType } from '@univerjs/core';-import { NORMAL_SELECTION_PLUGIN_NAME, RefRangeService, SelectionManagerService, SheetInterceptorService, SheetPermissionService } from '@univerjs/sheets';+import { NORMAL_SELECTION_PLUGIN_NAME, RefRangeService, SelectionManagerService, SetWorksheetActiveOperation, SheetInterceptorService, SheetPermissionService } from '@univerjs/sheets';import type { ISetSheetsFilterCriteriaMutationParams, ISetSheetsFilterRangeMutationParams } from '@univerjs/sheets-filter';import { RemoveSheetsFilterMutation, SetSheetsFilterCriteriaMutation, SetSheetsFilterRangeMutation, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import { DesktopMenuService, DesktopPlatformService, DesktopShortcutService, IMenuService, IPlatformService, IShortcutService } from '@univerjs/ui';@@ -105,6 +105,10 @@ describe('test sheet filter menu items', () => {disposableCollection = new DisposableCollection();commandService = get(ICommandService);+ commandService.registerCommand(SetWorksheetActiveOperation);++ // Active sheet, prevent activeSheet from being initialized to null, causing activeFilterModel$ to also transmit null.+ expect(commandService.syncExecuteCommand(SetWorksheetActiveOperation.id, { unitId: 'test', subUnitId: 'sheet1' })).toBeTruthy();});afterEach(() => {diff --git a/packages/sheets-filter/src/services/sheet-filter.service.ts b/packages/sheets-filter/src/services/sheet-filter.service.tsindex e88e9ca4c3..4092ac3b8a 100644--- a/packages/sheets-filter/src/services/sheet-filter.service.ts+++ b/packages/sheets-filter/src/services/sheet-filter.service.ts@@ -128,7 +128,8 @@ export class SheetsFilterService extends Disposable {return;}- const activeSheet = workbook.getActiveSheet();+ // Use getRawActiveSheet to avoid automatically activating the next sheet when deleting the sheet, causing the sheet switching in ActiveWorksheetController to be invalid.+ const activeSheet = workbook.getRawActiveSheet();if (!activeSheet) {this._activeFilterModel$.next(null);return;diff --git a/packages/sheets-formula/src/locale/en-US.ts b/packages/sheets-formula/src/locale/en-US.tsindex 6e7c0a9201..86ed133065 100644--- a/packages/sheets-formula/src/locale/en-US.ts+++ b/packages/sheets-formula/src/locale/en-US.ts@@ -97,6 +97,7 @@ export default {array: 'Array',univer: 'Univer',user: 'User Defined',+ definedname: 'Defined Name',},moreFunctions: {confirm: 'Confirm',diff --git a/packages/sheets-formula/src/locale/zh-CN.ts b/packages/sheets-formula/src/locale/zh-CN.tsindex bdf45f40ad..2e623f5ac1 100644--- a/packages/sheets-formula/src/locale/zh-CN.ts+++ b/packages/sheets-formula/src/locale/zh-CN.ts@@ -99,6 +99,7 @@ export default {array: '数组',univer: 'Univer',user: '用户自定义',+ definedname: '定义名称',},moreFunctions: {diff --git a/packages/sheets-formula/src/views/more-functions/select-function/index.module.less b/packages/sheets-formula/src/views/more-functions/select-function/index.module.lessindex d3a15edbf1..ed7127686c 100644--- a/packages/sheets-formula/src/views/more-functions/select-function/index.module.less+++ b/packages/sheets-formula/src/views/more-functions/select-function/index.module.less@@ -18,7 +18,7 @@box-sizing: border-box;width: 100%;- height: @result-height;+ max-height: @result-height;margin: 0;margin-top: var(--margin-xs);padding: var(--padding-base);