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
test: add more test for CommandService & LifecycleService (#899)
Wenzhao Hud8e4ef57f6b5
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERSindex 03fea0f3b8..15d9a8c5ad 100644--- a/.github/CODEOWNERS+++ b/.github/CODEOWNERS@@ -1,7 +1,3 @@-# CI / CD / repo settings-.github @jikkai @wzhudev-.commitlint.config.cjs @jikkai @wzhudev-# corepackages/core @DR-Univer @wzhudevpackages/core/src/services/resource-manager @Gggpound@@ -17,23 +13,31 @@ packages/ui @jikkai @wzhudev @Jocspackages/ui/src/services/clipboard @yuhongzpackages/design @jikkai @wzhudev+# common+packages/image @DR-Univer+packages/uniscript @wzhudev+# docspackages/docs @DR-Univer @Jocspackages/docs-ui @jikkai @Jocs# sheetspackages/sheets @wzhudev @DR-Univer+packages/sheets/src/services/numfmt @Gggpound+packages/sheets/src/services/ref-range @Gggpound+packages/sheets-ui @jikkai @wzhudevpackages/sheets-ui/src/controllers/clipboard @yuhongzpackages/sheets-ui/src/controllers/editor @Jocspackages/sheets-ui/src/services/clipboard @yuhongzpackages/sheets-ui/src/services/editor @Jocspackages/sheets-ui/src/services/editor-bridge.service.ts @Jocs++packages/sheets-find @wzhudevpackages/sheets-numfmt @Gggpound+packages/sheets-imoprt-xlsx @Gggpoundpackages/sheets-formula @DR-Univer @Dushusirpackages/sheets-zen-editor @Jocs-packages/sheets/src/services/numfmt @Gggpound-packages/sheets/src/services/ref-range @Gggpound# slidespackages/slides @wzhudev @DR-Univer @jikkaidiff --git a/packages/core/src/services/auth/auth.service.ts b/packages/core/src/services/auth/auth.service.tsdeleted file mode 100644index 527e257b67..0000000000--- a/packages/core/src/services/auth/auth.service.ts+++ /dev/null@@ -1,17 +0,0 @@-/**- * Copyright 2023-present DreamNum Inc.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--export interface IAuthService {}diff --git a/packages/core/src/services/command/command.service.spec.ts b/packages/core/src/services/command/command.service.spec.tsindex 3454a368e1..2b040777e0 100644--- a/packages/core/src/services/command/command.service.spec.ts+++ b/packages/core/src/services/command/command.service.spec.ts@@ -14,13 +14,18 @@* limitations under the License.*/+/* eslint-disable no-magic-numbers */+import { Injector } from '@wendellhu/redi';import { beforeEach, describe, expect, it, vi } from 'vitest';+import { ContextService, IContextService } from '../context/context.service';import { DesktopLogService, ILogService } from '../log/log.service';+import type { IMultiCommand } from './command.service';import { CommandService, CommandType, ICommandService, sequenceExecute, sequenceExecuteAsync } from './command.service';const commandID = 'emit-plural-error-command';+const anotherCommandID = 'another-command';describe('Test CommandService', () => {let injector: Injector;@@ -30,6 +35,7 @@ describe('Test CommandService', () => {injector = new Injector();injector.add([ICommandService, { useClass: CommandService }]);injector.add([ILogService, { useClass: DesktopLogService }]);+ injector.add([IContextService, { useClass: ContextService }]);commandService = injector.get(ICommandService);commandService.registerCommand({@@ -121,39 +127,126 @@ describe('Test CommandService', () => {});});- describe('Test "sequenceExecuteAsync" utils function', () => {- it('Should stop on the failure command', () => {- const spy = vi.spyOn(commandService, 'syncExecuteCommand');+ describe('Test registering command', () => {+ it('Should throw error when registering a command with the same id', () => {+ expect(() => {+ commandService.registerCommand({+ id: commandID,+ type: CommandType.COMMAND,+ handler: () => {+ return true;+ },+ });+ }).toThrowError(`[CommandRegistry]: command "${commandID}" has been registered before.`);+ });- expect(- sequenceExecute(- [- { id: commandID, params: { value: 1 } },- { id: commandID, params: { value: 2 } },- { id: commandID, params: { value: 3 } },- ],- commandService- )- ).toEqual({ index: 1, result: false });- expect(spy).toHaveBeenCalledTimes(2);+ it('Should return an disposable to unregister command', async () => {+ const disposable = commandService.registerCommand({+ id: anotherCommandID,+ type: CommandType.COMMAND,+ handler: () => {+ return true;+ },+ });++ expect(commandService.syncExecuteCommand(anotherCommandID)).toBeTruthy();+ disposable.dispose();++ expect(() => {+ commandService.syncExecuteCommand(anotherCommandID);+ }).toThrowError(`[CommandService]: command "${anotherCommandID}" is not registered.`);++ expect(commandService.executeCommand(anotherCommandID)).rejects.toThrowError(+ `[CommandService]: command "${anotherCommandID}" is not registered.`+ );});+ });- it('Should stop on the error command', () => {- const spy = vi.spyOn(commandService, 'syncExecuteCommand');+ describe('Test command execution hooks', () => {+ it('Should "beforeCommandExecuted" hook be called before command execution', async () => {+ const numbers: number[] = [];+ const pushValCommandID = 'push-val';+ commandService.registerCommand({+ id: pushValCommandID,+ type: CommandType.COMMAND,+ handler: () => {+ numbers.push(0);+ return true;+ },+ });++ const beforeListener = () => numbers.push(-1);+ const beforeDisposable = commandService.beforeCommandExecuted(beforeListener);+ expect(() => commandService.beforeCommandExecuted(beforeListener)).toThrowError(+ '[CommandService]: could not add a listener twice.'+ );+ const listener = () => numbers.push(1);+ const disposable = commandService.onCommandExecuted(listener);+ expect(() => commandService.onCommandExecuted(listener)).toThrowError(+ '[CommandService]: could not add a listener twice.'+ );++ commandService.syncExecuteCommand(pushValCommandID);+ expect(numbers).toEqual([-1, 0, 1]);++ await commandService.executeCommand(pushValCommandID);+ expect(numbers).toEqual([-1, 0, 1, -1, 0, 1]);++ beforeDisposable.dispose();+ disposable.dispose();+ commandService.syncExecuteCommand(pushValCommandID);+ expect(numbers).toEqual([-1, 0, 1, -1, 0, 1, 0]);+ });+ });- expect(- sequenceExecute(- [- { id: commandID, params: { value: 1 } },- { id: commandID, params: { value: 3 } },- { id: commandID, params: { value: 5 } },- { id: commandID, params: { value: 100 } },- { id: commandID, params: { value: 7 } },- ],- commandService- )- ).toEqual({ index: 3, result: false, error: new Error('100') });- expect(spy).toHaveBeenCalledTimes(4);+ describe('Test MultiCommand', () => {+ it('Should support register command and execute them in priority order', async () => {+ const commandID = 'command';+ const str: string[] = [];++ let executor: string = 'A';++ const disposable = commandService.registerMultipleCommand({+ id: commandID,+ type: CommandType.COMMAND,+ name: 'A',+ multi: true,+ priority: 100,+ preconditions: () => executor === 'A',+ handler: () => {+ str.push('A');+ return true;+ },+ } as IMultiCommand);+ const secondDisposable = commandService.registerMultipleCommand({+ id: commandID,+ type: CommandType.COMMAND,+ name: 'B',+ multi: true,+ priority: 10,+ preconditions: () => true,+ handler: () => {+ str.push('B');+ return true;+ },+ } as IMultiCommand);++ await commandService.executeCommand(commandID);+ expect(str).toEqual(['A']);++ executor = 'B';+ await commandService.executeCommand(commandID);+ expect(str).toEqual(['A', 'B']);++ executor = 'A';+ disposable.dispose();+ await commandService.executeCommand(commandID);+ expect(str).toEqual(['A', 'B', 'B']);++ secondDisposable.dispose();+ expect(commandService.executeCommand(commandID)).rejects.toThrowError(+ `[CommandService]: command "${commandID}" is not registered.`+ );});});});diff --git a/packages/core/src/services/command/command.service.ts b/packages/core/src/services/command/command.service.tsindex adb3f29922..8293364567 100644--- a/packages/core/src/services/command/command.service.ts+++ b/packages/core/src/services/command/command.service.ts@@ -19,7 +19,7 @@ import { createIdentifier, Inject, Injector } from '@wendellhu/redi';import { findLast, remove } from '../../common/array';import { sequence, sequenceAsync } from '../../common/sequence';-import { toDisposable } from '../../shared/lifecycle';+import { DisposableCollection, toDisposable } from '../../shared/lifecycle';import type { IKeyValue } from '../../shared/types';import { IContextService } from '../context/context.service';import { ILogService } from '../log/log.service';@@ -133,7 +133,7 @@ export type CommandListener = (commandInfo: Readonly<ICommandInfo>, options?: IEexport interface ICommandService {registerCommand(command: ICommand): IDisposable;- registerAsMultipleCommand(command: ICommand): IDisposable;+ registerMultipleCommand(command: ICommand): IDisposable;executeCommand<P extends object = object, R = boolean>(id: string,@@ -160,13 +160,13 @@ export const ICommandService = createIdentifier<ICommandService>('anywhere.comma/*** The registry of commands.*/-class CommandRegistry {+export class CommandRegistry {// eslint-disable-next-line @typescript-eslint/no-explicit-anyprivate readonly _commands = new Map<string, ICommand>();registerCommand(command: ICommand): IDisposable {if (this._commands.has(command.id)) {- throw new Error(`Command ${command.id} has registered before!`);+ throw new Error(`[CommandRegistry]: command "${command.id}" has been registered before.`);}this._commands.set(command.id, command);@@ -212,7 +212,7 @@ export class CommandService implements ICommandService {return this._registerCommand(command);}- registerAsMultipleCommand(command: ICommand): IDisposable {+ registerMultipleCommand(command: ICommand): IDisposable {return this._registerMultiCommand(command);}@@ -226,7 +226,7 @@ export class CommandService implements ICommandService {});}- throw new Error('Could not add a listener twice.');+ throw new Error('[CommandService]: could not add a listener twice.');}onCommandExecuted(listener: (commandInfo: ICommandInfo) => void): IDisposable {@@ -239,7 +239,7 @@ export class CommandService implements ICommandService {});}- throw new Error('Could not add a listener twice.');+ throw new Error('[CommandService]: could not add a listener twice.');}async executeCommand<P extends object = object, R = boolean>(@@ -326,8 +326,16 @@ export class CommandService implements ICommandService {let multiCommand: MultiCommand;if (!registry) {+ const disposableCollection = new DisposableCollection();multiCommand = new MultiCommand(command.id);- this._multiCommandDisposables.set(command.id, this._commandRegistry.registerCommand(multiCommand));+ disposableCollection.add(this._commandRegistry.registerCommand(multiCommand));+ disposableCollection.add(+ toDisposable(() => {+ this._multiCommandDisposables.delete(command.id);+ })+ );++ this._multiCommandDisposables.set(command.id, disposableCollection);} else {if ((registry[0] as IKeyValue).multi !== true) {throw new Error('Command has registered as a single command.');@@ -336,10 +344,9 @@ export class CommandService implements ICommandService {}}- const commandDisposable = multiCommand.registerImplementation(command as IMultiCommand);-+ const implementationDisposable = multiCommand.registerImplementation(command as IMultiCommand);return toDisposable(() => {- commandDisposable.dispose();+ implementationDisposable.dispose();if (!multiCommand.hasImplementations()) {this._multiCommandDisposables.get(command.id)?.dispose();}@@ -434,7 +441,7 @@ class MultiCommand implements IMultiCommand {for (const item of this._implementations) {const preconditions = item.command.preconditions;- if (preconditions?.(contextService)) {+ if (!preconditions || (preconditions && preconditions(contextService))) {logService.log(`[MultiCommand]`, `executing implementation "${item.command.name}".`);const result = await injector.invoke(item.command.handler, params);if (result) {diff --git a/packages/core/src/services/config/config.service.ts b/packages/core/src/services/config/config.service.tsindex fc5e01d9be..66c519d83c 100644--- a/packages/core/src/services/config/config.service.ts+++ b/packages/core/src/services/config/config.service.ts@@ -24,10 +24,11 @@ import type { Nullable } from '../../shared/types';* IConfig provides universal configuration for the whole application.*/export const IConfigService = createIdentifier<IConfigService>('univer.config-service');+export interface IConfigService {getConfig<T>(id: string, defaultValue: T): T;getConfig<T>(id: string): Nullable<T>;- setConfig(id: string, value: any): void;+ setConfig(id: string, value: unknown): void;deleteConfig(id: string): void;}@@ -39,7 +40,7 @@ export class ConfigService implements IConfigService {return this._config.get(id) as T;}- setConfig(id: string, value: any) {+ setConfig(id: string, value: unknown) {this._config.set(id, value);}diff --git a/packages/core/src/services/context/context.service.ts b/packages/core/src/services/context/context.service.tsindex 2f90a9accc..ad5a97eddb 100644--- a/packages/core/src/services/context/context.service.ts+++ b/packages/core/src/services/context/context.service.ts@@ -21,7 +21,7 @@ import { Subject } from 'rxjs';import { Disposable } from '../../shared/lifecycle';export interface IContextService {- contextChanged$: Observable<void>;+ readonly contextChanged$: Observable<void>;getContextValue(key: string): boolean;setContextValue(key: string, value: boolean): void;@@ -31,7 +31,6 @@ export const IContextService = createIdentifier<IContextService>('univer.contextexport class ContextService extends Disposable implements IContextService {private _contextChanged$ = new Subject<void>();-contextChanged$: Observable<void> = this._contextChanged$.asObservable();private readonly _contextMap = new Map<string, boolean>();@@ -45,18 +44,6 @@ export class ContextService extends Disposable implements IContextService {return this._contextMap.get(key) ?? false;}- // matchContextValue(matchKey: string): boolean {- // let resultKey = '';- // for (const [key] of this._contextMap) {- // if (key.indexOf(matchKey) > -1) {- // resultKey = key;- // break;- // }- // }-- // return this._contextMap.get(resultKey) ?? false;- // }-setContextValue(key: string, value: boolean): void {this._contextMap.set(key, value);this._contextChanged$.next();diff --git a/packages/core/src/services/lifecycle/__tests__/lifecycle.service.spec.ts b/packages/core/src/services/lifecycle/__tests__/lifecycle.service.spec.tsnew file mode 100644index 0000000000..15773c1932--- /dev/null+++ b/packages/core/src/services/lifecycle/__tests__/lifecycle.service.spec.ts@@ -0,0 +1,150 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { Injector } from '@wendellhu/redi';+import { afterEach, describe, expect, it } from 'vitest';++import { DesktopLogService, ILogService } from '../../log/log.service';+import { LifecycleStages, OnLifecycle } from '../lifecycle';+import { LifecycleInitializerService, LifecycleService } from '../lifecycle.service';++function createLifecycleTestBed() {+ const injector = new Injector();++ injector.add([ILogService, { useClass: DesktopLogService }]);+ injector.add([LifecycleInitializerService]);+ injector.add([LifecycleService]);++ return {+ injector,+ };+}++describe('Test LifecycleService', () => {+ let injector: Injector;+ let lifecycleService: LifecycleService;++ afterEach(() => {+ injector.dispose();+ });++ it('Should be able to progress lifecycle stages', () => {+ injector = createLifecycleTestBed().injector;+ lifecycleService = injector.get(LifecycleService);++ const lifecycleStages: LifecycleStages[] = [];+ lifecycleService.lifecycle$.subscribe((stage) => lifecycleStages.push(stage));++ lifecycleService.stage = LifecycleStages.Starting;+ expect(lifecycleStages).toEqual([LifecycleStages.Starting]);+ lifecycleService.stage = LifecycleStages.Ready;+ expect(lifecycleStages).toEqual([LifecycleStages.Starting, LifecycleStages.Ready]);++ // Cannot go backward+ expect(() => {+ lifecycleService.stage = LifecycleStages.Starting;+ }).toThrowError('[LifecycleService]: lifecycle stage cannot go backward!');++ lifecycleService.stage = LifecycleStages.Rendered;+ expect(lifecycleStages).toEqual([LifecycleStages.Starting, LifecycleStages.Ready, LifecycleStages.Rendered]);+ expect(lifecycleService.stage).toEqual(LifecycleStages.Rendered);++ lifecycleService.stage = LifecycleStages.Steady;+ expect(lifecycleStages).toEqual([+ LifecycleStages.Starting,+ LifecycleStages.Ready,+ LifecycleStages.Rendered,+ LifecycleStages.Steady,+ ]);+ });++ it('Should "subscribeWithPrevious" emit all previous stages', () => {+ injector = createLifecycleTestBed().injector;+ lifecycleService = injector.get(LifecycleService);++ const lifecycleStages1: LifecycleStages[] = [];+ lifecycleService.subscribeWithPrevious().subscribe((stage) => lifecycleStages1.push(stage));++ lifecycleService.stage = LifecycleStages.Starting;+ const lifecycleStages2: LifecycleStages[] = [];+ lifecycleService.subscribeWithPrevious().subscribe((stage) => lifecycleStages2.push(stage));+ const startingStage = [LifecycleStages.Starting];+ expect(lifecycleStages1).toEqual(startingStage);+ expect(lifecycleStages2).toEqual(startingStage);++ lifecycleService.stage = LifecycleStages.Ready;+ const lifecycleStages3: LifecycleStages[] = [];+ lifecycleService.subscribeWithPrevious().subscribe((stage) => lifecycleStages3.push(stage));+ const readyStates = [LifecycleStages.Starting, LifecycleStages.Ready];+ expect(lifecycleStages1).toEqual(readyStates);+ expect(lifecycleStages2).toEqual(readyStates);+ expect(lifecycleStages3).toEqual(readyStates);++ lifecycleService.stage = LifecycleStages.Rendered;+ const lifecycleStages4: LifecycleStages[] = [];+ lifecycleService.subscribeWithPrevious().subscribe((stage) => lifecycleStages4.push(stage));+ const renderedStates = [LifecycleStages.Starting, LifecycleStages.Ready, LifecycleStages.Rendered];+ expect(lifecycleStages1).toEqual(renderedStates);+ expect(lifecycleStages2).toEqual(renderedStates);+ expect(lifecycleStages3).toEqual(renderedStates);+ expect(lifecycleStages4).toEqual(renderedStates);++ lifecycleService.stage = LifecycleStages.Steady;+ const lifecycleStages5: LifecycleStages[] = [];+ lifecycleService.subscribeWithPrevious().subscribe((stage) => lifecycleStages5.push(stage));+ const steadyStages = [+ LifecycleStages.Starting,+ LifecycleStages.Ready,+ LifecycleStages.Rendered,+ LifecycleStages.Steady,+ ];+ expect(lifecycleStages1).toEqual(steadyStages);+ expect(lifecycleStages2).toEqual(steadyStages);+ expect(lifecycleStages3).toEqual(steadyStages);+ expect(lifecycleStages4).toEqual(steadyStages);+ expect(lifecycleStages5).toEqual(steadyStages);+ });++ describe('Test automatically instantiate modules on lifecycle stages', () => {+ let initializer: LifecycleInitializerService;++ it('Should instantiate modules on lifecycle stages', () => {+ injector = createLifecycleTestBed().injector;+ initializer = injector.get(LifecycleInitializerService);+ lifecycleService = injector.get(LifecycleService);++ initializer.start();+ initializer.start(); // For just test coverage.++ const initModules: string[] = [];++ @OnLifecycle(LifecycleStages.Rendered, TestModule1)+ class TestModule1 {+ constructor() {+ initModules.push('test1');+ }+ }+ injector.add([TestModule1]);++ lifecycleService.stage = LifecycleStages.Starting;+ lifecycleService.stage = LifecycleStages.Ready;+ expect(initModules).toEqual([]);++ lifecycleService.stage = LifecycleStages.Rendered;+ expect(initModules).toEqual(['test1']);+ });+ });+});diff --git a/packages/core/src/services/lifecycle/lifecycle.service.ts b/packages/core/src/services/lifecycle/lifecycle.service.tsindex bb0ca78a9c..984ef0956d 100644--- a/packages/core/src/services/lifecycle/lifecycle.service.ts+++ b/packages/core/src/services/lifecycle/lifecycle.service.ts@@ -21,10 +21,14 @@ import { Disposable, toDisposable } from '../../shared/lifecycle';import { ILogService } from '../log/log.service';import { LifecycleNameMap, LifecycleStages, LifecycleToModules } from './lifecycle';+/**+ * This service controls the lifecycle of a Univer instance. Other modules can+ * inject this service to read the current lifecycle stage or subscribe to+ * lifecycle changes.+ */export class LifecycleService extends Disposable {private _lifecycle$ = new BehaviorSubject<LifecycleStages>(LifecycleStages.Starting);-- lifecycle$ = this._lifecycle$.asObservable();+ readonly lifecycle$ = this._lifecycle$.asObservable();constructor(@ILogService private readonly _logService: ILogService) {super();@@ -52,9 +56,22 @@ export class LifecycleService extends Disposable {this._lifecycle$.next(stage);}+ override dispose(): void {+ this._lifecycle$.complete();++ super.dispose();+ }++ /**+ * Subscribe to lifecycle changes and all previous stages and the current+ * stage will be emitted immediately.+ * @returns+ */subscribeWithPrevious(): Observable<LifecycleStages> {return new Observable<LifecycleStages>((subscriber) => {- // before subscribe, emit the current stage and all previous stages+ // Before subscribe, emit the current stage and all previous stages.+ // Since `this._lifecycle$` is a BehaviorSubject, it will emit the current stage immediately.+ // So we just need to manually next all previous stages.if (this.stage === LifecycleStages.Starting) {// do nothing} else if (this.stage === LifecycleStages.Ready) {@@ -73,6 +90,12 @@ export class LifecycleService extends Disposable {}}+/**+ * This service is used to initialize modules on a certain lifecycle stage.+ * Refer to `runOnLifecycle` and `OnLifecycle` for more details.+ *+ * @internal+ */export class LifecycleInitializerService extends Disposable {private _started = false;diff --git a/packages/docs/src/controllers/clipboard.controller.ts b/packages/docs/src/controllers/clipboard.controller.tsindex b4ffab5ae2..58d389478b 100644--- a/packages/docs/src/controllers/clipboard.controller.ts+++ b/packages/docs/src/controllers/clipboard.controller.ts@@ -51,7 +51,7 @@ export class DocClipboardController extends Disposable {initialize() {[DocCopyCommand, DocCutCommand, DocPasteCommand].forEach((command) =>- this.disposeWithMe(this._commandService.registerAsMultipleCommand(command))+ this.disposeWithMe(this._commandService.registerMultipleCommand(command)));[InnerPasteCommand, CutContentCommand].forEach((command) =>this.disposeWithMe(this._commandService.registerCommand(command))diff --git a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.tsindex c64acf3543..6c1a12f17b 100644--- a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts+++ b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts@@ -105,7 +105,7 @@ export class SheetClipboardController extends Disposable {private _init() {// register sheet clipboard commands[SheetCopyCommand, SheetCutCommand, SheetPasteCommand].forEach((command) =>- this.disposeWithMe(this._commandService.registerAsMultipleCommand(command))+ this.disposeWithMe(this._commandService.registerMultipleCommand(command)));[diff --git a/packages/sheets/src/services/selection-manager.service.ts b/packages/sheets/src/services/selection-manager.service.tsindex 216dfbf7ef..1dd9ee93c5 100644--- a/packages/sheets/src/services/selection-manager.service.ts+++ b/packages/sheets/src/services/selection-manager.service.ts@@ -232,6 +232,7 @@ export class SelectionManagerService implements IDisposable {if (this._currentSelection == null) {return;}+this._replaceByParam({...this._currentSelection,selectionDatas,diff --git a/packages/ui/src/controllers/shared-shortcut.controller.ts b/packages/ui/src/controllers/shared-shortcut.controller.tsindex 877424b8b9..0892a6b379 100644--- a/packages/ui/src/controllers/shared-shortcut.controller.ts+++ b/packages/ui/src/controllers/shared-shortcut.controller.ts@@ -89,7 +89,7 @@ export class SharedController extends Disposable {private _registerCommands(): void {[CutCommand, CopyCommand, PasteCommand].forEach((command) =>- this.disposeWithMe(this._commandService.registerAsMultipleCommand(command))+ this.disposeWithMe(this._commandService.registerMultipleCommand(command)));}diff --git a/packages/uniscript/src/services/command/batch-command.service.ts b/packages/uniscript/src/services/command/batch-command.service.tsindex 6a00db278d..8307642d3e 100644--- a/packages/uniscript/src/services/command/batch-command.service.ts+++ b/packages/uniscript/src/services/command/batch-command.service.ts@@ -26,7 +26,7 @@ export class BatchCommandService implements ICommandService {throw new Error('Method not implemented.');}- registerAsMultipleCommand(command: ICommand<object, boolean>): IDisposable {+ registerMultipleCommand(command: ICommand<object, boolean>): IDisposable {throw new Error('Method not implemented.');}