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: rename current univer service (#294)
Wenzhao Hu77b47b282efd
diff --git a/packages/base-docs/src/Basics/component-tools.ts b/packages/base-docs/src/Basics/component-tools.tsindex 65b7503788..364a8846c3 100644--- a/packages/base-docs/src/Basics/component-tools.ts+++ b/packages/base-docs/src/Basics/component-tools.ts@@ -1,5 +1,5 @@import { Documents, Engine, IRenderManagerService, Scene } from '@univerjs/base-render';-import { ICurrentUniverService, Nullable } from '@univerjs/core';+import { IUniverInstanceService, Nullable } from '@univerjs/core';export interface IDocObjectParam {document: Documents;@@ -8,10 +8,10 @@ export interface IDocObjectParam {}export function getDocObject(- currentUniverService: ICurrentUniverService,+ univerInstanceService: IUniverInstanceService,renderManagerService: IRenderManagerService): Nullable<IDocObjectParam> {- const documentModel = currentUniverService.getCurrentUniverDocInstance();+ const documentModel = univerInstanceService.getCurrentUniverDocInstance();const unitId = documentModel.getUnitId();diff --git a/packages/base-docs/src/Controller/delete-left-input.controller.ts b/packages/base-docs/src/Controller/delete-left-input.controller.tsindex 1e1fb40b60..2440f11b12 100644--- a/packages/base-docs/src/Controller/delete-left-input.controller.ts+++ b/packages/base-docs/src/Controller/delete-left-input.controller.ts@@ -11,8 +11,8 @@ import {Disposable,ICommandInfo,ICommandService,- ICurrentUniverService,IParagraph,+ IUniverInstanceService,LifecycleStages,Nullable,OnLifecycle,@@ -31,7 +31,7 @@ export class DeleteLeftInputController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ITextSelectionRenderManager private readonly _textSelectionRenderManager: ITextSelectionRenderManager,@Inject(TextSelectionManagerService) private readonly _textSelectionManagerService: TextSelectionManagerService,diff --git a/packages/base-docs/src/Controller/doc-render.controller.ts b/packages/base-docs/src/Controller/doc-render.controller.tsindex 33623eb10c..7e964a86aa 100644--- a/packages/base-docs/src/Controller/doc-render.controller.ts+++ b/packages/base-docs/src/Controller/doc-render.controller.ts@@ -1,5 +1,5 @@import { Documents, IRenderManagerService } from '@univerjs/base-render';-import { Disposable, ICommandService, ICurrentUniverService, LifecycleStages, OnLifecycle } from '@univerjs/core';+import { Disposable, ICommandService, IUniverInstanceService, LifecycleStages, OnLifecycle } from '@univerjs/core';import { Inject } from '@wendellhu/redi';import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.service';@@ -8,7 +8,7 @@ import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.servexport class DocRenderController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ICommandService private readonly _commandService: ICommandService) {diff --git a/packages/base-docs/src/Controller/ime-input.controller.ts b/packages/base-docs/src/Controller/ime-input.controller.tsindex 65ed80bdd8..b6c805cf09 100644--- a/packages/base-docs/src/Controller/ime-input.controller.ts+++ b/packages/base-docs/src/Controller/ime-input.controller.ts@@ -6,7 +6,7 @@ import {import {Disposable,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,Nullable,OnLifecycle,@@ -33,7 +33,7 @@ export class IMEInputController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ITextSelectionRenderManager private readonly _textSelectionRenderManager: ITextSelectionRenderManager,@Inject(TextSelectionManagerService) private readonly _textSelectionManagerService: TextSelectionManagerService,diff --git a/packages/base-docs/src/Controller/line-break-input.controller.ts b/packages/base-docs/src/Controller/line-break-input.controller.tsindex 324167af63..505444380f 100644--- a/packages/base-docs/src/Controller/line-break-input.controller.ts+++ b/packages/base-docs/src/Controller/line-break-input.controller.ts@@ -4,8 +4,8 @@ import {Disposable,ICommandInfo,ICommandService,- ICurrentUniverService,IParagraph,+ IUniverInstanceService,LifecycleStages,Nullable,OnLifecycle,@@ -24,7 +24,7 @@ export class LineBreakInputController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ITextSelectionRenderManager private readonly _textSelectionRenderManager: ITextSelectionRenderManager,@Inject(TextSelectionManagerService) private readonly _textSelectionManagerService: TextSelectionManagerService,diff --git a/packages/base-docs/src/Controller/move-cursor.controller.ts b/packages/base-docs/src/Controller/move-cursor.controller.tsindex 35e8dc7809..8c0fb5aa16 100644--- a/packages/base-docs/src/Controller/move-cursor.controller.ts+++ b/packages/base-docs/src/Controller/move-cursor.controller.ts@@ -15,7 +15,7 @@ import {Disposable,ICommandInfo,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,Nullable,OnLifecycle,@@ -34,7 +34,7 @@ export class MoveCursorController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ITextSelectionRenderManager private readonly _textSelectionRenderManager: ITextSelectionRenderManager,@Inject(TextSelectionManagerService) private readonly _textSelectionManagerService: TextSelectionManagerService,diff --git a/packages/base-docs/src/Controller/normal-input.controller.ts b/packages/base-docs/src/Controller/normal-input.controller.tsindex 3a0725d6fc..be02a9ac87 100644--- a/packages/base-docs/src/Controller/normal-input.controller.ts+++ b/packages/base-docs/src/Controller/normal-input.controller.ts@@ -2,7 +2,7 @@ import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/baimport {Disposable,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,Nullable,OnLifecycle,@@ -21,7 +21,7 @@ export class NormalInputController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ITextSelectionRenderManager private readonly _textSelectionRenderManager: ITextSelectionRenderManager,@Inject(TextSelectionManagerService) private readonly _textSelectionManagerService: TextSelectionManagerService,diff --git a/packages/base-docs/src/Controller/page-render.controller.ts b/packages/base-docs/src/Controller/page-render.controller.tsindex ee52fc18cf..940db386ae 100644--- a/packages/base-docs/src/Controller/page-render.controller.ts+++ b/packages/base-docs/src/Controller/page-render.controller.ts@@ -1,5 +1,5 @@import { Documents, IPageRenderConfig, IRenderManagerService, Rect } from '@univerjs/base-render';-import { Disposable, ICommandService, ICurrentUniverService, LifecycleStages, OnLifecycle } from '@univerjs/core';+import { Disposable, ICommandService, IUniverInstanceService, LifecycleStages, OnLifecycle } from '@univerjs/core';import { Inject } from '@wendellhu/redi';import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.service';@@ -12,7 +12,7 @@ const PAGE_FILL_COLOR = 'rgba(255,255,255, 1)';export class PageRenderController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ICommandService private readonly _commandService: ICommandService) {diff --git a/packages/base-docs/src/Controller/text-selection.controller.ts b/packages/base-docs/src/Controller/text-selection.controller.tsindex 81338af48c..b328cbd7ee 100644--- a/packages/base-docs/src/Controller/text-selection.controller.ts+++ b/packages/base-docs/src/Controller/text-selection.controller.ts@@ -13,7 +13,7 @@ import {Disposable,ICommandInfo,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,Nullable,Observer,@@ -41,7 +41,7 @@ export class TextSelectionController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@ICommandService private readonly _commandService: ICommandService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ITextSelectionRenderManagerdiff --git a/packages/base-docs/src/DocPlugin.ts b/packages/base-docs/src/DocPlugin.tsindex 8656545ebe..d93eb9894c 100644--- a/packages/base-docs/src/DocPlugin.ts+++ b/packages/base-docs/src/DocPlugin.ts@@ -4,7 +4,7 @@ import {ICommand,ICommandService,IConfigService,- ICurrentUniverService,+ IUniverInstanceService,LocaleService,Plugin,PLUGIN_NAMES,@@ -65,7 +65,7 @@ export class DocPlugin extends Plugin {@Inject(Injector) override _injector: Injector,@Inject(LocaleService) private readonly _localeService: LocaleService,@IConfigService private readonly _configService: IConfigService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService) {super(PLUGIN_NAMES.DOCUMENT);diff --git a/packages/base-docs/src/View/Render/Views/DocsView.ts b/packages/base-docs/src/View/Render/Views/DocsView.tsindex fbb6c7de0a..8b2031d251 100644--- a/packages/base-docs/src/View/Render/Views/DocsView.ts+++ b/packages/base-docs/src/View/Render/Views/DocsView.ts@@ -1,5 +1,5 @@import { Documents, DocumentSkeleton, IDocumentSkeletonDrawing, Picture, Scene } from '@univerjs/base-render';-import { DocumentModel, ICurrentUniverService, LocaleService } from '@univerjs/core';+import { DocumentModel, IUniverInstanceService, LocaleService } from '@univerjs/core';import { Inject, Injector } from '@wendellhu/redi';import { DocsViewManagerService } from '../../../services/docs-view-manager/docs-view-manager.service';@@ -24,7 +24,7 @@ export class DocsView extends BaseView {constructor(externalModel: DocumentModel | undefined,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(DocsViewManagerService) private _docsViewManagerService: DocsViewManagerService,@Inject(LocaleService) private readonly _localeService: LocaleService) {diff --git a/packages/base-docs/src/View/doc-canvas-view.ts b/packages/base-docs/src/View/doc-canvas-view.tsindex 650d01718f..3664f620e1 100644--- a/packages/base-docs/src/View/doc-canvas-view.ts+++ b/packages/base-docs/src/View/doc-canvas-view.ts@@ -14,7 +14,7 @@ import {DocumentModel,EventState,IConfigService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,Nullable,OnLifecycle,@@ -38,7 +38,7 @@ export class DocCanvasView {constructor(@IRenderManagerService private readonly _renderManagerService: RenderManagerService,@IConfigService private readonly _configService: IConfigService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,// @IRenderingEngine private readonly _engine: Engine,@Inject(Injector) private readonly _injector: Injectordiff --git a/packages/base-docs/src/commands/commands/core-editing.command.ts b/packages/base-docs/src/commands/commands/core-editing.command.tsindex 1793fa554e..ca59a5546b 100644--- a/packages/base-docs/src/commands/commands/core-editing.command.ts+++ b/packages/base-docs/src/commands/commands/core-editing.command.ts@@ -5,11 +5,11 @@ import {ICommand,ICommandInfo,ICommandService,- ICurrentUniverService,IDocumentBody,IDocumentData,ITextSelectionRange,IUndoRedoService,+ IUniverInstanceService,UpdateDocsAttributeType,} from '@univerjs/core';@@ -318,9 +318,9 @@ export const CoverCommand: ICommand<ICoverCommandParams> = {id: 'doc.command-cover-content',type: CommandType.COMMAND,handler: async (accessor, params: ICoverCommandParams) => {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const { unitId, snapshot, clearUndoRedoStack } = params;- const doc = currentUniverService.getUniverDocInstance(unitId);+ const doc = univerInstanceService.getUniverDocInstance(unitId);if (!doc) {return false;}diff --git a/packages/base-docs/src/commands/commands/set-zoom-ratio.command.ts b/packages/base-docs/src/commands/commands/set-zoom-ratio.command.tsindex 2de3a44337..9376d69f6f 100644--- a/packages/base-docs/src/commands/commands/set-zoom-ratio.command.ts+++ b/packages/base-docs/src/commands/commands/set-zoom-ratio.command.ts@@ -1,4 +1,4 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService, IUndoRedoService } from '@univerjs/core';+import { CommandType, ICommand, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import {@@ -19,9 +19,9 @@ export const SetZoomRatioCommand: ICommand = {handler: async (accessor: IAccessor, params?: ISetZoomRatioCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- let documentId = currentUniverService.getCurrentUniverDocInstance().getUnitId();+ let documentId = univerInstanceService.getCurrentUniverDocInstance().getUnitId();let zoomRatio = 1;if (params) {@@ -29,7 +29,7 @@ export const SetZoomRatioCommand: ICommand = {zoomRatio = params.zoomRatio ?? zoomRatio;}- const workbook = currentUniverService.getUniverDocInstance(documentId);+ const workbook = univerInstanceService.getUniverDocInstance(documentId);if (!workbook) return false;const setZoomRatioMutationParams: ISetZoomRatioMutationParams = {diff --git a/packages/base-docs/src/commands/mutations/core-editing.mutation.ts b/packages/base-docs/src/commands/mutations/core-editing.mutation.tsindex 740a4b1d77..882d6903f8 100644--- a/packages/base-docs/src/commands/mutations/core-editing.mutation.ts+++ b/packages/base-docs/src/commands/mutations/core-editing.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IDocumentBody, IMutation, UpdateDocsAttributeType } from '@univerjs/core';+import { CommandType, IDocumentBody, IMutation, IUniverInstanceService, UpdateDocsAttributeType } from '@univerjs/core';import { DeleteApply } from './functions/delete-apply';import { InsertApply } from './functions/insert';@@ -50,9 +50,9 @@ export const RichTextEditingMutation: IMutation<IRichTextEditingMutationParams,type: CommandType.MUTATION,handler: async (accessor, params) => {const { unitId, mutations } = params;- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const document = currentUniverService.getUniverDocInstance(unitId);+ const document = univerInstanceService.getUniverDocInstance(unitId);if (!document) {throw new Error(`Document not found for unitId: ${unitId}`);}diff --git a/packages/base-docs/src/commands/mutations/set-zoom-ratio.mutation.ts b/packages/base-docs/src/commands/mutations/set-zoom-ratio.mutation.tsindex 534955c80f..b27da811a7 100644--- a/packages/base-docs/src/commands/mutations/set-zoom-ratio.mutation.ts+++ b/packages/base-docs/src/commands/mutations/set-zoom-ratio.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation, Tools } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService, Tools } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetZoomRatioMutationParams {@@ -10,7 +10,7 @@ export const SetZoomRatioUndoMutationFactory = (accessor: IAccessor,params: ISetZoomRatioMutationParams): ISetZoomRatioMutationParams => {- const documentModel = accessor.get(ICurrentUniverService).getUniverDocInstance(params.documentId);+ const documentModel = accessor.get(IUniverInstanceService).getUniverDocInstance(params.documentId);const old = documentModel?.getSettings()?.zoomRatio || 1;return {...Tools.deepClone(params),@@ -22,7 +22,7 @@ export const SetZoomRatioMutation: IMutation<ISetZoomRatioMutationParams> = {id: 'doc.mutation.set-zoom-ratio',type: CommandType.MUTATION,handler: async (accessor, params) => {- const documentModel = accessor.get(ICurrentUniverService).getUniverDocInstance(params.documentId);+ const documentModel = accessor.get(IUniverInstanceService).getUniverDocInstance(params.documentId);if (!documentModel) return false;const documentData = documentModel.getSnapshot();if (documentData.settings == null) {diff --git a/packages/base-docs/src/commands/operations/cursor.operation.ts b/packages/base-docs/src/commands/operations/cursor.operation.tsindex d9e4928b26..abe8882c97 100644--- a/packages/base-docs/src/commands/operations/cursor.operation.ts+++ b/packages/base-docs/src/commands/operations/cursor.operation.ts@@ -17,10 +17,10 @@ export const MoveCursorOperation: IOperation<IMoveCursorOperationParams> = {return false;}- // const currentUniverService = accessor.get(ICurrentUniverService);+ // const univerInstanceService = accessor.get(IUniverInstanceService);// const inputController = accessor.get(InputController);- // inputController.moveCursor(currentUniverService.getCurrentUniverDocInstance(), params.direction);+ // inputController.moveCursor(univerInstanceService.getCurrentUniverDocInstance(), params.direction);return true;},diff --git a/packages/base-docs/src/services/doc-skeleton-manager.service.ts b/packages/base-docs/src/services/doc-skeleton-manager.service.tsindex 3e0e7be6f9..3f5a92cda9 100644--- a/packages/base-docs/src/services/doc-skeleton-manager.service.ts+++ b/packages/base-docs/src/services/doc-skeleton-manager.service.ts@@ -1,5 +1,5 @@import { DocumentSkeleton } from '@univerjs/base-render';-import { DocumentModel, ICurrentUniverService, LocaleService, Nullable } from '@univerjs/core';+import { DocumentModel, IUniverInstanceService, LocaleService, Nullable } from '@univerjs/core';import { IDisposable, Inject } from '@wendellhu/redi';import { BehaviorSubject } from 'rxjs';@@ -35,7 +35,7 @@ export class DocSkeletonManagerService implements IDisposable {readonly currentSkeletonBefore$ = this._currentSkeletonBefore$.asObservable();constructor(- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(LocaleService) private readonly _localeService: LocaleService) {}diff --git a/packages/base-docs/src/services/docs-view-manager/docs-view-manager.service.ts b/packages/base-docs/src/services/docs-view-manager/docs-view-manager.service.tsindex 4a3622b847..8b74185938 100644--- a/packages/base-docs/src/services/docs-view-manager/docs-view-manager.service.ts+++ b/packages/base-docs/src/services/docs-view-manager/docs-view-manager.service.ts@@ -1,4 +1,4 @@-import { Disposable, ICurrentUniverService, toDisposable } from '@univerjs/core';+import { Disposable, IUniverInstanceService, toDisposable } from '@univerjs/core';import { IDisposable } from '@wendellhu/redi';import { BehaviorSubject, Observable } from 'rxjs';@@ -15,7 +15,7 @@ export class DocsViewManagerService extends Disposable {private readonly _viewsMap = new Map<string, DocsView>();- constructor(@ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService) {+ constructor(@IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService) {super();this.disposeWithMe(diff --git a/packages/base-sheets/src/Basics/component-tools.ts b/packages/base-sheets/src/Basics/component-tools.tsindex 14ea9455d2..5934af4277 100644--- a/packages/base-sheets/src/Basics/component-tools.ts+++ b/packages/base-sheets/src/Basics/component-tools.ts@@ -9,7 +9,7 @@ import {SpreadsheetSkeleton,Vector2,} from '@univerjs/base-render';-import { ICurrentUniverService, Nullable } from '@univerjs/core';+import { IUniverInstanceService, Nullable } from '@univerjs/core';import { SHEET_VIEW_KEY, VIEWPORT_KEY } from './Const/DEFAULT_SPREADSHEET_VIEW';@@ -23,10 +23,10 @@ export interface ISheetObjectParam {}export function getSheetObject(- currentUniverService: ICurrentUniverService,+ univerInstanceService: IUniverInstanceService,renderManagerService: IRenderManagerService): Nullable<ISheetObjectParam> {- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const unitId = workbook.getUnitId();diff --git a/packages/base-sheets/src/Controller/Selection.controller.ts b/packages/base-sheets/src/Controller/Selection.controller.tsindex 1a7af30a1e..3e51a4d43f 100644--- a/packages/base-sheets/src/Controller/Selection.controller.ts+++ b/packages/base-sheets/src/Controller/Selection.controller.ts@@ -9,7 +9,7 @@ import {Disposable,ICommandInfo,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,OnLifecycle,RANGE_TYPE,@@ -27,7 +27,7 @@ import { SheetSkeletonManagerService } from '../services/sheet-skeleton-manager.export class SelectionController extends Disposable {constructor(@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@ICommandService private readonly _commandService: ICommandService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ISelectionTransformerShapeManagerdiff --git a/packages/base-sheets/src/Controller/editor-bridge.controller.ts b/packages/base-sheets/src/Controller/editor-bridge.controller.tsindex d656204f38..eb3eac35f9 100644--- a/packages/base-sheets/src/Controller/editor-bridge.controller.ts+++ b/packages/base-sheets/src/Controller/editor-bridge.controller.ts@@ -9,7 +9,7 @@ import {import {Disposable,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,LocaleService,OnLifecycle,@@ -26,7 +26,7 @@ import { SheetSkeletonManagerService } from '../services/sheet-skeleton-manager.export class EditorBridgeController extends Disposable {constructor(@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@ICommandService private readonly _commandService: ICommandService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@IEditorBridgeService private readonly _editorBridgeService: IEditorBridgeService,diff --git a/packages/base-sheets/src/Controller/freeze.controller.ts b/packages/base-sheets/src/Controller/freeze.controller.tsindex fad1f16e00..f27de439f2 100644--- a/packages/base-sheets/src/Controller/freeze.controller.ts+++ b/packages/base-sheets/src/Controller/freeze.controller.ts@@ -11,7 +11,7 @@ import {Disposable,ICommandInfo,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,Nullable,Observer,@@ -83,7 +83,7 @@ export class FreezeController extends Disposable {constructor(@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@ICommandService private readonly _commandService: ICommandService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ISelectionTransformerShapeManagerdiff --git a/packages/base-sheets/src/Controller/header-menu.controller.ts b/packages/base-sheets/src/Controller/header-menu.controller.tsindex 97d3b4d230..6007c86e64 100644--- a/packages/base-sheets/src/Controller/header-menu.controller.ts+++ b/packages/base-sheets/src/Controller/header-menu.controller.ts@@ -6,7 +6,7 @@ import {ISelectionTransformerShapeManager,Rect,} from '@univerjs/base-render';-import { Disposable, ICurrentUniverService, LifecycleStages, Nullable, Observer, OnLifecycle } from '@univerjs/core';+import { Disposable, IUniverInstanceService, LifecycleStages, Nullable, Observer, OnLifecycle } from '@univerjs/core';import { Inject } from '@wendellhu/redi';import { getCoordByOffset, getSheetObject } from '../Basics/component-tools';@@ -42,7 +42,7 @@ export class HeaderMenuController extends Disposable {constructor(@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ISelectionTransformerShapeManager@Inject(SelectionManagerService)diff --git a/packages/base-sheets/src/Controller/header-move.controller.ts b/packages/base-sheets/src/Controller/header-move.controller.tsindex cc2611dfc7..bfb85c31db 100644--- a/packages/base-sheets/src/Controller/header-move.controller.ts+++ b/packages/base-sheets/src/Controller/header-move.controller.ts@@ -12,7 +12,7 @@ import {import {Disposable,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,Nullable,Observer,@@ -108,7 +108,7 @@ export class HeaderMoveController extends Disposable {constructor(@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ICommandService private readonly _commandService: ICommandService,@ISelectionTransformerShapeManagerdiff --git a/packages/base-sheets/src/Controller/header-resize.controller.ts b/packages/base-sheets/src/Controller/header-resize.controller.tsindex 95ac96cb9e..2b884b2d75 100644--- a/packages/base-sheets/src/Controller/header-resize.controller.ts+++ b/packages/base-sheets/src/Controller/header-resize.controller.ts@@ -2,7 +2,7 @@ import { CURSOR_TYPE, IMouseEvent, IPointerEvent, IRenderManagerService, Rect, Vimport {Disposable,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,Nullable,Observer,@@ -62,7 +62,7 @@ export class HeaderResizeController extends Disposable {constructor(@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@ICommandService private readonly _commandService: ICommandService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService) {diff --git a/packages/base-sheets/src/Controller/header-unhide.controller.ts b/packages/base-sheets/src/Controller/header-unhide.controller.tsindex 13dda41a3b..4d6f661ccd 100644--- a/packages/base-sheets/src/Controller/header-unhide.controller.ts+++ b/packages/base-sheets/src/Controller/header-unhide.controller.ts@@ -2,8 +2,8 @@ import { IRenderManagerService } from '@univerjs/base-render';import {getWorksheetUID,ICommandService,- ICurrentUniverService,IKeyValue,+ IUniverInstanceService,LifecycleStages,OnLifecycle,RxDisposable,@@ -48,7 +48,7 @@ export class HeaderUnhideController extends RxDisposable {constructor(@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,@ICommandService private readonly _cmdSrv: ICommandService,- @ICurrentUniverService private readonly _cuSrv: ICurrentUniverService,+ @IUniverInstanceService private readonly _cuSrv: IUniverInstanceService,@IRenderManagerService private readonly _rendererManagerService: IRenderManagerService) {super();diff --git a/packages/base-sheets/src/Controller/scroll.controller.ts b/packages/base-sheets/src/Controller/scroll.controller.tsindex 00b1ea5737..d4091c38e7 100644--- a/packages/base-sheets/src/Controller/scroll.controller.ts+++ b/packages/base-sheets/src/Controller/scroll.controller.ts@@ -4,7 +4,7 @@ import {Disposable,ICommandInfo,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,OnLifecycle,} from '@univerjs/core';@@ -22,7 +22,7 @@ import { ISheetSkeletonManagerParam, SheetSkeletonManagerService } from '../servexport class ScrollController extends Disposable {constructor(@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@ICommandService private readonly _commandService: ICommandService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ISelectionTransformerShapeManagerdiff --git a/packages/base-sheets/src/Controller/sheet-render.controller.ts b/packages/base-sheets/src/Controller/sheet-render.controller.tsindex 815fed15cf..abc0599342 100644--- a/packages/base-sheets/src/Controller/sheet-render.controller.ts+++ b/packages/base-sheets/src/Controller/sheet-render.controller.ts@@ -10,7 +10,7 @@ import {Disposable,ICommandInfo,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,OnLifecycle,} from '@univerjs/core';@@ -41,7 +41,7 @@ interface ISetWorksheetMutationParams {export class SheetRenderController extends Disposable {constructor(@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ICommandService private readonly _commandService: ICommandService,@ISelectionTransformerShapeManagerdiff --git a/packages/base-sheets/src/Controller/zoom.controller.ts b/packages/base-sheets/src/Controller/zoom.controller.tsindex ce18d227fa..123f592248 100644--- a/packages/base-sheets/src/Controller/zoom.controller.ts+++ b/packages/base-sheets/src/Controller/zoom.controller.ts@@ -3,7 +3,7 @@ import {Disposable,ICommandInfo,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,OnLifecycle,} from '@univerjs/core';@@ -26,7 +26,7 @@ interface ISetWorksheetMutationParams {export class ZoomController extends Disposable {constructor(@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@ICommandService private readonly _commandService: ICommandService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ISelectionTransformerShapeManagerdiff --git a/packages/base-sheets/src/View/sheet-canvas-view.ts b/packages/base-sheets/src/View/sheet-canvas-view.tsindex ec5ec6a42a..a93b871221 100644--- a/packages/base-sheets/src/View/sheet-canvas-view.ts+++ b/packages/base-sheets/src/View/sheet-canvas-view.ts@@ -12,7 +12,7 @@ import {SpreadsheetRowHeader,Viewport,} from '@univerjs/base-render';-import { ICurrentUniverService, LifecycleStages, OnLifecycle, Workbook, Worksheet } from '@univerjs/core';+import { IUniverInstanceService, LifecycleStages, OnLifecycle, Workbook, Worksheet } from '@univerjs/core';import { Inject } from '@wendellhu/redi';import {@@ -30,7 +30,7 @@ export class SheetCanvasView {private _currentWorkbook!: Workbook;constructor(- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ISelectionTransformerShapeManagerprivate readonly _selectionTransformerShapeManager: ISelectionTransformerShapeManager,diff --git a/packages/base-sheets/src/commands/commands/__tests__/add-worksheet-merge.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/add-worksheet-merge.command.spec.tsindex 284cb5aa98..e7da6e6689 100644--- a/packages/base-sheets/src/commands/commands/__tests__/add-worksheet-merge.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/add-worksheet-merge.command.spec.ts@@ -1,7 +1,7 @@import {ICommandService,- ICurrentUniverService,IRange,+ IUniverInstanceService,RANGE_TYPE,RedoCommand,UndoCommand,@@ -65,7 +65,7 @@ describe('Test style commands', () => {]);function getMerge(): IRange[] | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getConfig().mergeData;@@ -107,7 +107,7 @@ describe('Test style commands', () => {]);function getMerge(): IRange[] | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getConfig().mergeData;@@ -146,7 +146,7 @@ describe('Test style commands', () => {]);function getMerge(): IRange[] | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getConfig().mergeData;@@ -185,7 +185,7 @@ describe('Test style commands', () => {]);function getMerge(): IRange[] | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getConfig().mergeData;diff --git a/packages/base-sheets/src/commands/commands/__tests__/clear-selection.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/clear-selection.command.spec.tsindex c456a1611c..395ccd8548 100644--- a/packages/base-sheets/src/commands/commands/__tests__/clear-selection.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/clear-selection.command.spec.ts@@ -1,9 +1,9 @@import {ICellData,ICommandService,- ICurrentUniverService,IRange,IStyleData,+ IUniverInstanceService,Nullable,RANGE_TYPE,RedoCommand,@@ -67,7 +67,7 @@ describe('Test clear selection content commands', () => {]);function getValue(): Nullable<ICellData> {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -115,7 +115,7 @@ describe('Test clear selection content commands', () => {]);function getValue(): Nullable<ICellData> {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -124,7 +124,7 @@ describe('Test clear selection content commands', () => {function getStyle(): Nullable<IStyleData> {const value = getValue();- const styles = get(ICurrentUniverService).getUniverSheetInstance('test')?.getStyles();+ const styles = get(IUniverInstanceService).getUniverSheetInstance('test')?.getStyles();if (value && styles) {return styles.getStyleByCell(value);}@@ -177,7 +177,7 @@ describe('Test clear selection content commands', () => {]);function getValue(): Nullable<ICellData> {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -186,14 +186,14 @@ describe('Test clear selection content commands', () => {function getStyle(): Nullable<IStyleData> {const value = getValue();- const styles = get(ICurrentUniverService).getUniverSheetInstance('test')?.getStyles();+ const styles = get(IUniverInstanceService).getUniverSheetInstance('test')?.getStyles();if (value && styles) {return styles.getStyleByCell(value);}}function getMerge(): IRange[] | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getConfig().mergeData;@@ -267,7 +267,7 @@ describe('Test clear selection content commands', () => {]);function getValue(): Nullable<ICellData> {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -276,7 +276,7 @@ describe('Test clear selection content commands', () => {function getStyle(): Nullable<IStyleData> {const value = getValue();- const styles = get(ICurrentUniverService).getUniverSheetInstance('test')?.getStyles();+ const styles = get(IUniverInstanceService).getUniverSheetInstance('test')?.getStyles();if (value && styles) {return styles.getStyleByCell(value);}@@ -323,7 +323,7 @@ describe('Test clear selection content commands', () => {]);function getValue(): Nullable<ICellData> {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -332,14 +332,14 @@ describe('Test clear selection content commands', () => {function getStyle(): Nullable<IStyleData> {const value = getValue();- const styles = get(ICurrentUniverService).getUniverSheetInstance('test')?.getStyles();+ const styles = get(IUniverInstanceService).getUniverSheetInstance('test')?.getStyles();if (value && styles) {return styles.getStyleByCell(value);}}function getMerge(): IRange[] | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getConfig().mergeData;diff --git a/packages/base-sheets/src/commands/commands/__tests__/create-command-test-bed.ts b/packages/base-sheets/src/commands/commands/__tests__/create-command-test-bed.tsindex 6cd42aae8b..ff1ab129e4 100644--- a/packages/base-sheets/src/commands/commands/__tests__/create-command-test-bed.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/create-command-test-bed.ts@@ -1,6 +1,6 @@import {- ICurrentUniverService,ILogService,+ IUniverInstanceService,IWorkbookConfig,LocaleType,Plugin,@@ -82,8 +82,8 @@ export function createCommandTestBed(workbookConfig?: IWorkbookConfig, dependencthrow new Error('[TestPlugin]: not hooked on!');}- const currentUniverService = get(ICurrentUniverService);- currentUniverService.focusUniverInstance('test');+ const univerInstanceService = get(IUniverInstanceService);+ univerInstanceService.focusUniverInstance('test');const logService = get(ILogService);logService.toggleLogEnabled(false); // change this to `true` to debug tests via logsdiff --git a/packages/base-sheets/src/commands/commands/__tests__/insert-remove-rows-cols.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/insert-remove-rows-cols.command.spec.tsindex b0c8526be8..e1e45fa81f 100644--- a/packages/base-sheets/src/commands/commands/__tests__/insert-remove-rows-cols.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/insert-remove-rows-cols.command.spec.ts@@ -2,9 +2,9 @@import {ICellData,ICommandService,- ICurrentUniverService,IRange,IStyleData,+ IUniverInstanceService,IWorkbookConfig,LocaleType,Nullable,@@ -126,14 +126,14 @@ describe('Test insert and remove rows cols commands', () => {}function getRowCount(): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getRowCount();}function getColCount(): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();@@ -144,14 +144,14 @@ describe('Test insert and remove rows cols commands', () => {}function getCellInfo(row: number, col: number): Nullable<ICellData> {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getCellMatrix().getValue(row, col);}function getMergedInfo(row: number, col: number): Nullable<IRange> {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getMergedCells(row, col)?.[0];diff --git a/packages/base-sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.tsindex a03750cf97..f4b553dc18 100644--- a/packages/base-sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.ts@@ -3,8 +3,8 @@ import { IMessageService } from '@univerjs/base-ui';import {ICellData,ICommandService,- ICurrentUniverService,IRange,+ IUniverInstanceService,IWorkbookConfig,LocaleType,Nullable,@@ -110,42 +110,42 @@ describe('Test move rows cols', () => {}function getRowCount(): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getRowCount();}function getColCount(): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();}function getCellInfo(row: number, col: number): Nullable<ICellData> {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getCellMatrix().getValue(row, col);}function getMergedInfo(row: number, col: number): Nullable<IRange> {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getMergedCells(row, col)?.[0];}function getRowHeight(row: number): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getRowHeight(row);}function getColWidth(col: number): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getColumnWidth(col);diff --git a/packages/base-sheets/src/commands/commands/__tests__/set-border.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/set-border.command.spec.tsindex 7d0d7db0a5..5da141a988 100644--- a/packages/base-sheets/src/commands/commands/__tests__/set-border.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/set-border.command.spec.ts@@ -3,8 +3,8 @@ import {BorderType,IBorderData,ICommandService,- ICurrentUniverService,IRange,+ IUniverInstanceService,RANGE_TYPE,Univer,} from '@univerjs/core';@@ -70,7 +70,7 @@ describe('Test style commands', () => {]);function getBorder({ startRow, startColumn }: IRange): IBorderData | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(startRow, startColumn)diff --git a/packages/base-sheets/src/commands/commands/__tests__/set-col-width.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/set-col-width.command.spec.tsindex 5b0ee0f89d..e0340ebb3d 100644--- a/packages/base-sheets/src/commands/commands/__tests__/set-col-width.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/set-col-width.command.spec.ts@@ -1,5 +1,5 @@/* eslint-disable no-magic-numbers */-import { ICommandService, ICurrentUniverService, RANGE_TYPE, RedoCommand, UndoCommand, Univer } from '@univerjs/core';+import { ICommandService, IUniverInstanceService, RANGE_TYPE, RedoCommand, UndoCommand, Univer } from '@univerjs/core';import { Injector } from '@wendellhu/redi';import { afterEach, beforeEach, describe, expect, it } from 'vitest';@@ -19,7 +19,7 @@ describe('Test set col width commands', () => {let commandService: ICommandService;function getColumnWidth(col: number): number {- const worksheet = get(ICurrentUniverService).getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = get(IUniverInstanceService).getCurrentUniverSheetInstance().getActiveSheet();return worksheet.getColumnWidth(col);}@@ -33,7 +33,7 @@ describe('Test set col width commands', () => {commandService.registerCommand(SetColWidthCommand);commandService.registerCommand(SetWorksheetColWidthMutation);- const worksheet = get(ICurrentUniverService).getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = get(IUniverInstanceService).getCurrentUniverSheetInstance().getActiveSheet();const maxRow = worksheet.getMaxRows() - 1;const selectionManagerService = get(SelectionManagerService);selectionManagerService.setCurrentSelection({diff --git a/packages/base-sheets/src/commands/commands/__tests__/set-range-values.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/set-range-values.command.spec.tsindex 0534c36edb..5e54d578ef 100644--- a/packages/base-sheets/src/commands/commands/__tests__/set-range-values.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/set-range-values.command.spec.ts@@ -2,9 +2,9 @@ import {CellValueType,ICellData,ICommandService,- ICurrentUniverService,IDocumentData,IStyleData,+ IUniverInstanceService,Nullable,RANGE_TYPE,RedoCommand,@@ -52,7 +52,7 @@ describe('Test set range values commands', () => {]);getValue = (): Nullable<ICellData> =>- get(ICurrentUniverService)+ get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -60,7 +60,7 @@ describe('Test set range values commands', () => {getStyle = (): Nullable<IStyleData> => {const value = getValue();- const styles = get(ICurrentUniverService).getUniverSheetInstance('test')?.getStyles();+ const styles = get(IUniverInstanceService).getUniverSheetInstance('test')?.getStyles();if (value && styles) {return styles.getStyleByCell(value);}diff --git a/packages/base-sheets/src/commands/commands/__tests__/set-row-col-visible.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/set-row-col-visible.command.spec.tsindex ead0e2b65f..ab0b556bda 100644--- a/packages/base-sheets/src/commands/commands/__tests__/set-row-col-visible.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/set-row-col-visible.command.spec.ts@@ -1,5 +1,5 @@/* eslint-disable no-magic-numbers */-import { ICommandService, ICurrentUniverService, RANGE_TYPE, RedoCommand, UndoCommand, Univer } from '@univerjs/core';+import { ICommandService, IUniverInstanceService, RANGE_TYPE, RedoCommand, UndoCommand, Univer } from '@univerjs/core';import { Injector } from '@wendellhu/redi';import { afterEach, beforeEach, describe, expect, it } from 'vitest';@@ -58,27 +58,27 @@ describe('Test row col hide/unhine commands', () => {afterEach(() => univer.dispose());function getRowCount(): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getRowCount();}function getColCount(): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();}function getRowVisible(row: number): boolean {- const workbook = get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const workbook = get(IUniverInstanceService).getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getRowVisible(row);}function getColVisible(col: number): boolean {- const workbook = get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const workbook = get(IUniverInstanceService).getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getColVisible(col);}diff --git a/packages/base-sheets/src/commands/commands/__tests__/set-row-height.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/set-row-height.command.spec.tsindex 76c3be6465..d9b6c1b559 100644--- a/packages/base-sheets/src/commands/commands/__tests__/set-row-height.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/set-row-height.command.spec.ts@@ -1,5 +1,5 @@/* eslint-disable no-magic-numbers */-import { ICommandService, ICurrentUniverService, RANGE_TYPE, RedoCommand, UndoCommand, Univer } from '@univerjs/core';+import { ICommandService, IUniverInstanceService, RANGE_TYPE, RedoCommand, UndoCommand, Univer } from '@univerjs/core';import { Injector } from '@wendellhu/redi';import { afterEach, beforeEach, describe, expect, it } from 'vitest';@@ -21,7 +21,7 @@ describe('Test set row height commands', () => {let commandService: ICommandService;function getRowHeight(row: number): number {- const worksheet = get(ICurrentUniverService).getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = get(IUniverInstanceService).getCurrentUniverSheetInstance().getActiveSheet();return worksheet.getRowHeight(row);}@@ -35,7 +35,7 @@ describe('Test set row height commands', () => {commandService.registerCommand(SetRowHeightCommand);commandService.registerCommand(SetWorksheetRowHeightMutation);- const worksheet = get(ICurrentUniverService).getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = get(IUniverInstanceService).getCurrentUniverSheetInstance().getActiveSheet();const maxColumn = worksheet.getMaxColumns() - 1;const selectionManager = get(SelectionManagerService);selectionManager.setCurrentSelection({diff --git a/packages/base-sheets/src/commands/commands/__tests__/set-selections.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/set-selections.command.spec.tsindex 3a9760f892..d8106d641e 100644--- a/packages/base-sheets/src/commands/commands/__tests__/set-selections.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/set-selections.command.spec.ts@@ -1,6 +1,13 @@/* eslint-disable no-magic-numbers */-import { Direction, ICommandService, ICurrentUniverService, IWorkbookConfig, RANGE_TYPE, Univer } from '@univerjs/core';+import {+ Direction,+ ICommandService,+ IUniverInstanceService,+ IWorkbookConfig,+ RANGE_TYPE,+ Univer,+} from '@univerjs/core';import { Injector } from '@wendellhu/redi';import { afterEach, beforeEach, describe, expect, it } from 'vitest';@@ -93,27 +100,27 @@ describe('Test commands used for change selections', () => {}function getRowCount(): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getRowCount();}function getColCount(): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();}function getRowVisible(row: number): boolean {- const workbook = get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const workbook = get(IUniverInstanceService).getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getRowVisible(row);}function getColVisible(col: number): boolean {- const workbook = get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const workbook = get(IUniverInstanceService).getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getColVisible(col);}diff --git a/packages/base-sheets/src/commands/commands/__tests__/set-style.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/set-style.command.spec.tsindex 46b99bddba..e5e4d7ca3d 100644--- a/packages/base-sheets/src/commands/commands/__tests__/set-style.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/set-style.command.spec.ts@@ -5,9 +5,9 @@ import {FontWeight,HorizontalAlign,ICommandService,- ICurrentUniverService,ITextDecoration,ITextRotation,+ IUniverInstanceService,RANGE_TYPE,RedoCommand,UndoCommand,@@ -95,7 +95,7 @@ describe("Test commands used for updating cells' styles", () => {]);function getFontBold(): FontWeight | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -155,7 +155,7 @@ describe("Test commands used for updating cells' styles", () => {endRow: number,endColumn: number): FontItalic | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(startRow, startColumn, endRow, endColumn)@@ -205,7 +205,7 @@ describe("Test commands used for updating cells' styles", () => {]);function getFontUnderline(): ITextDecoration | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -262,7 +262,7 @@ describe("Test commands used for updating cells' styles", () => {]);function getFontThroughLine(): ITextDecoration | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -310,7 +310,7 @@ describe("Test commands used for updating cells' styles", () => {]);function getFontSize(): number | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -356,7 +356,7 @@ describe("Test commands used for updating cells' styles", () => {]);function getFontFamily(): string | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -411,28 +411,28 @@ describe("Test commands used for updating cells' styles", () => {]);function getFontColor(): string | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0).getFontColor();}function getFontThroughLine(): ITextDecoration | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0).getStrikeThrough();}function getFontUnderline(): ITextDecoration | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0).getUnderline();}function getFontOverline(): ITextDecoration | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -504,7 +504,7 @@ describe("Test commands used for updating cells' styles", () => {]);function getBackgroundColor(): string | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -552,7 +552,7 @@ describe("Test commands used for updating cells' styles", () => {]);function getVerticalAlignment(): VerticalAlign | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -600,7 +600,7 @@ describe("Test commands used for updating cells' styles", () => {]);function getHorizontalAlignment(): HorizontalAlign | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -650,7 +650,7 @@ describe("Test commands used for updating cells' styles", () => {]);function getTextWrap(): BooleanNumber | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)@@ -700,7 +700,7 @@ describe("Test commands used for updating cells' styles", () => {]);function getTextRotation(): ITextRotation | undefined {- return get(ICurrentUniverService)+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1')?.getRange(0, 0, 0, 0)diff --git a/packages/base-sheets/src/commands/commands/__tests__/set-tab-color.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/set-tab-color.command.spec.tsindex 70a1b2d225..9fad6f8c2c 100644--- a/packages/base-sheets/src/commands/commands/__tests__/set-tab-color.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/set-tab-color.command.spec.ts@@ -1,4 +1,4 @@-import { ICommandService, ICurrentUniverService, RedoCommand, UndoCommand, Univer } from '@univerjs/core';+import { ICommandService, IUniverInstanceService, RedoCommand, UndoCommand, Univer } from '@univerjs/core';import { Injector } from '@wendellhu/redi';import { afterEach, beforeEach, describe, expect, it } from 'vitest';@@ -27,7 +27,7 @@ describe('Test tab color commands', () => {describe('Set several specific colors', () => {function getTabColor() {- return get(ICurrentUniverService).getUniverSheetInstance('test')?.getActiveSheet()?.getTabColor();+ return get(IUniverInstanceService).getUniverSheetInstance('test')?.getActiveSheet()?.getTabColor();}describe('correct situations', () => {diff --git a/packages/base-sheets/src/commands/commands/__tests__/set-worksheet-hide.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/set-worksheet-hide.command.spec.tsindex deef06e595..9963c28752 100644--- a/packages/base-sheets/src/commands/commands/__tests__/set-worksheet-hide.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/set-worksheet-hide.command.spec.ts@@ -1,7 +1,7 @@import {BooleanNumber,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,RedoCommand,UndoCommand,Univer,@@ -44,7 +44,7 @@ describe('Test set worksheet hide commands', () => {describe('Set worksheet hide', () => {it('will set current acitve worksheet hidden', async () => {- const workbook = get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const workbook = get(IUniverInstanceService).getCurrentUniverSheetInstance();if (!workbook) throw new Error('This is an error');const targetActiveSheet = workbook.getActiveSheet();diff --git a/packages/base-sheets/src/commands/commands/add-worksheet-merge.command.ts b/packages/base-sheets/src/commands/commands/add-worksheet-merge.command.tsindex 1bae030dc4..5b0ce897d0 100644--- a/packages/base-sheets/src/commands/commands/add-worksheet-merge.command.ts+++ b/packages/base-sheets/src/commands/commands/add-worksheet-merge.command.ts@@ -3,9 +3,9 @@ import {Dimension,ICommand,ICommandService,- ICurrentUniverService,IRange,IUndoRedoService,+ IUniverInstanceService,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -32,12 +32,12 @@ export const AddWorksheetMergeCommand: ICommand = {const selectionManagerService = accessor.get(SelectionManagerService);const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selections = selectionManagerService.getRangeDatas();if (!selections?.length) return false;- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/clear-selection-all.command.ts b/packages/base-sheets/src/commands/commands/clear-selection-all.command.tsindex e866b4e4b2..9adcefe5d6 100644--- a/packages/base-sheets/src/commands/commands/clear-selection-all.command.ts+++ b/packages/base-sheets/src/commands/commands/clear-selection-all.command.ts@@ -4,9 +4,9 @@ import {ICommand,ICommandInfo,ICommandService,- ICurrentUniverService,IRange,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,ObjectMatrixPrimitiveType,Rectangle,@@ -37,12 +37,12 @@ export const ClearSelectionAllCommand: ICommand = {id: 'sheet.command.clear-selection-all',type: CommandType.COMMAND,handler: async (accessor: IAccessor) => {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const commandService = accessor.get(ICommandService);const selectionManagerService = accessor.get(SelectionManagerService);const undoRedoService = accessor.get(IUndoRedoService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const workbookId = workbook.getUnitId();const worksheet = workbook.getActiveSheet();const worksheetId = worksheet.getSheetId();diff --git a/packages/base-sheets/src/commands/commands/clear-selection-content.command.ts b/packages/base-sheets/src/commands/commands/clear-selection-content.command.tsindex 968a21cf66..ae4d9662bb 100644--- a/packages/base-sheets/src/commands/commands/clear-selection-content.command.ts+++ b/packages/base-sheets/src/commands/commands/clear-selection-content.command.ts@@ -3,9 +3,9 @@ import {ICellData,ICommand,ICommandService,- ICurrentUniverService,IRange,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,ObjectMatrixPrimitiveType,} from '@univerjs/core';@@ -25,12 +25,12 @@ export const ClearSelectionContentCommand: ICommand = {id: 'sheet.command.clear-selection-content',type: CommandType.COMMAND,handler: async (accessor: IAccessor) => {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const commandService = accessor.get(ICommandService);const selectionManagerService = accessor.get(SelectionManagerService);const undoRedoService = accessor.get(IUndoRedoService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const workbookId = workbook.getUnitId();const worksheet = workbook.getActiveSheet();const worksheetId = worksheet.getSheetId();diff --git a/packages/base-sheets/src/commands/commands/clear-selection-format.command.ts b/packages/base-sheets/src/commands/commands/clear-selection-format.command.tsindex 9d71cb7e45..e0b55e8077 100644--- a/packages/base-sheets/src/commands/commands/clear-selection-format.command.ts+++ b/packages/base-sheets/src/commands/commands/clear-selection-format.command.ts@@ -4,9 +4,9 @@ import {ICommand,ICommandInfo,ICommandService,- ICurrentUniverService,IRange,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,ObjectMatrixPrimitiveType,Rectangle,@@ -37,12 +37,12 @@ export const ClearSelectionFormatCommand: ICommand = {id: 'sheet.command.clear-selection-format',type: CommandType.COMMAND,handler: async (accessor: IAccessor) => {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const commandService = accessor.get(ICommandService);const selectionManagerService = accessor.get(SelectionManagerService);const undoRedoService = accessor.get(IUndoRedoService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const workbookId = workbook.getUnitId();const worksheet = workbook.getActiveSheet();const worksheetId = worksheet.getSheetId();diff --git a/packages/base-sheets/src/commands/commands/copy-format-to-range.command.ts b/packages/base-sheets/src/commands/commands/copy-format-to-range.command.tsindex ed29493096..2b096a2eaf 100644--- a/packages/base-sheets/src/commands/commands/copy-format-to-range.command.ts+++ b/packages/base-sheets/src/commands/commands/copy-format-to-range.command.ts@@ -4,10 +4,10 @@ import {ICellDataMatrix,ICommand,ICommandService,- ICurrentUniverService,IRange,IStyleData,IUndoRedoService,+ IUniverInstanceService,Nullable,ObjectMatrix,} from '@univerjs/core';@@ -31,19 +31,19 @@ export const CopyFormatToRangeCommand: ICommand = {const selectionManagerService = accessor.get(SelectionManagerService);const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selections = selectionManagerService.getRangeDatas();if (!selections?.length) return false;const originRange = selections[0];- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const handleResult = handleCopyRange(accessor, workbookId, worksheetId, originRange, params.destinationRange);if (!handleResult) return false;@@ -95,7 +95,7 @@ function handleCopyRange(destinationRange: IRange): Nullable<[ICellDataMatrix, IRange]> {const worksheet = accessor- .get(ICurrentUniverService)+ .get(IUniverInstanceService).getUniverSheetInstance(workbookId)?.getSheetBySheetId(worksheetId);if (!worksheet) return;diff --git a/packages/base-sheets/src/commands/commands/copy-range-to.command.ts b/packages/base-sheets/src/commands/commands/copy-range-to.command.tsindex ef39b3ad6b..bf601fb281 100644--- a/packages/base-sheets/src/commands/commands/copy-range-to.command.ts+++ b/packages/base-sheets/src/commands/commands/copy-range-to.command.ts@@ -4,10 +4,10 @@ import {ICellDataMatrix,ICommand,ICommandService,- ICurrentUniverService,IOptionData,IRange,IUndoRedoService,+ IUniverInstanceService,Nullable,ObjectMatrix,} from '@univerjs/core';@@ -32,18 +32,18 @@ export const CopyRangeToCommand: ICommand = {const selectionManagerService = accessor.get(SelectionManagerService);const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selections = selectionManagerService.getRangeDatas();if (!selections?.length) return false;const originRange = selections[0];- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const handleResult = handleCopyRange(accessor, workbookId, worksheetId, originRange, params.destinationRange);if (!handleResult) return false;@@ -137,7 +137,7 @@ function handleCopyRange(destinationRange: IRange): Nullable<[ICellDataMatrix, IRange]> {const worksheet = accessor- .get(ICurrentUniverService)+ .get(IUniverInstanceService).getUniverSheetInstance(workbookId)?.getSheetBySheetId(worksheetId);if (!worksheet) return;diff --git a/packages/base-sheets/src/commands/commands/copy-to-worksheet.command.ts b/packages/base-sheets/src/commands/commands/copy-to-worksheet.command.tsindex 8f4259b8c5..55a7449ac3 100644--- a/packages/base-sheets/src/commands/commands/copy-to-worksheet.command.ts+++ b/packages/base-sheets/src/commands/commands/copy-to-worksheet.command.ts@@ -1,4 +1,11 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService, IUndoRedoService, Tools } from '@univerjs/core';+import {+ CommandType,+ ICommand,+ ICommandService,+ IUndoRedoService,+ IUniverInstanceService,+ Tools,+} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import {@@ -20,17 +27,17 @@ export const CopySheetToCommand: ICommand = {handler: async (accessor: IAccessor, params: ICopySheetToCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const workbookId = params.workbookId || currentUniverService.getCurrentUniverSheetInstance().getUnitId();+ const workbookId = params.workbookId || univerInstanceService.getCurrentUniverSheetInstance().getUnitId();const worksheetId =- params.worksheetId || currentUniverService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const copyToWorkbookId = params.workbookId || currentUniverService.getCurrentUniverSheetInstance().getUnitId();+ params.worksheetId || univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();+ const copyToWorkbookId = params.workbookId || univerInstanceService.getCurrentUniverSheetInstance().getUnitId();const copyToSheetId =- params.copyToSheetId || currentUniverService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ params.copyToSheetId || univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;- const copyToWorkbook = currentUniverService.getUniverSheetInstance(copyToWorkbookId);+ const copyToWorkbook = univerInstanceService.getUniverSheetInstance(copyToWorkbookId);if (!copyToWorkbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/copy-values-to-range.command.ts b/packages/base-sheets/src/commands/commands/copy-values-to-range.command.tsindex a576b16d35..99dc3d73c4 100644--- a/packages/base-sheets/src/commands/commands/copy-values-to-range.command.ts+++ b/packages/base-sheets/src/commands/commands/copy-values-to-range.command.ts@@ -5,9 +5,9 @@ import {ICellV,ICommand,ICommandService,- ICurrentUniverService,IRange,IUndoRedoService,+ IUniverInstanceService,Nullable,ObjectMatrix,} from '@univerjs/core';@@ -31,18 +31,18 @@ export const CopyValuesToRangeCommand: ICommand = {const selectionManagerService = accessor.get(SelectionManagerService);const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selections = selectionManagerService.getRangeDatas();if (!selections?.length) return false;const originRange = selections[0];- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const handleResult = handleCopyRange(accessor, workbookId, worksheetId, originRange, params.destinationRange);if (!handleResult) return false;@@ -98,7 +98,7 @@ function handleCopyRange(destinationRange: IRange): Nullable<[ICellDataMatrix, IRange]> {const worksheet = accessor- .get(ICurrentUniverService)+ .get(IUniverInstanceService).getUniverSheetInstance(workbookId)?.getSheetBySheetId(worksheetId);if (!worksheet) return;diff --git a/packages/base-sheets/src/commands/commands/copy-worksheet.command.ts b/packages/base-sheets/src/commands/commands/copy-worksheet.command.tsindex 89d4c72888..d742324de4 100644--- a/packages/base-sheets/src/commands/commands/copy-worksheet.command.ts+++ b/packages/base-sheets/src/commands/commands/copy-worksheet.command.ts@@ -1,4 +1,11 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService, IUndoRedoService, Tools } from '@univerjs/core';+import {+ CommandType,+ ICommand,+ ICommandService,+ IUndoRedoService,+ IUniverInstanceService,+ Tools,+} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import { IInsertSheetMutationParams, IRemoveSheetMutationParams } from '../../Basics/Interfaces/MutationInterface';@@ -21,10 +28,10 @@ export const CopySheetCommand: ICommand = {handler: async (accessor: IAccessor, params?: ICopySheetCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- let workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- let worksheetId = currentUniverService+ let workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ let worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()@@ -33,7 +40,7 @@ export const CopySheetCommand: ICommand = {workbookId = params.workbookId ?? workbookId;worksheetId = params.worksheetId ?? worksheetId;}- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/delete-range-move-left.command.ts b/packages/base-sheets/src/commands/commands/delete-range-move-left.command.tsindex 1fd0672180..0656add935 100644--- a/packages/base-sheets/src/commands/commands/delete-range-move-left.command.ts+++ b/packages/base-sheets/src/commands/commands/delete-range-move-left.command.ts@@ -3,8 +3,8 @@ import {Dimension,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,Nullable,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -24,11 +24,11 @@ export const DeleteRangeMoveLeftCommand: ICommand = {handler: async (accessor: IAccessor) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()@@ -36,7 +36,7 @@ export const DeleteRangeMoveLeftCommand: ICommand = {const range = selectionManagerService.getRangeDatas();if (!range?.length) return false;- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/delete-range-move-up.command.ts b/packages/base-sheets/src/commands/commands/delete-range-move-up.command.tsindex 96ce77ff34..abc23e4546 100644--- a/packages/base-sheets/src/commands/commands/delete-range-move-up.command.ts+++ b/packages/base-sheets/src/commands/commands/delete-range-move-up.command.ts@@ -3,8 +3,8 @@ import {Dimension,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,Nullable,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -24,11 +24,11 @@ export const DeleteRangeMoveUpCommand: ICommand = {handler: async (accessor: IAccessor) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()@@ -36,7 +36,7 @@ export const DeleteRangeMoveUpCommand: ICommand = {const range = selectionManagerService.getRangeDatas();if (!range?.length) return false;- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/insert-range-move-down.command.ts b/packages/base-sheets/src/commands/commands/insert-range-move-down.command.tsindex d409d7ba42..4914b479fc 100644--- a/packages/base-sheets/src/commands/commands/insert-range-move-down.command.ts+++ b/packages/base-sheets/src/commands/commands/insert-range-move-down.command.ts@@ -4,8 +4,8 @@ import {ICellData,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -25,11 +25,11 @@ export const InsertRangeMoveDownCommand: ICommand = {handler: async (accessor: IAccessor) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()@@ -37,7 +37,7 @@ export const InsertRangeMoveDownCommand: ICommand = {const range = selectionManagerService.getRangeDatas();if (!range?.length) return false;- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/insert-range-move-right.command.ts b/packages/base-sheets/src/commands/commands/insert-range-move-right.command.tsindex 503ee247a4..7b641da955 100644--- a/packages/base-sheets/src/commands/commands/insert-range-move-right.command.ts+++ b/packages/base-sheets/src/commands/commands/insert-range-move-right.command.ts@@ -4,8 +4,8 @@ import {ICellData,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -25,11 +25,11 @@ export const InsertRangeMoveRightCommand: ICommand = {handler: async (accessor: IAccessor) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()@@ -37,7 +37,7 @@ export const InsertRangeMoveRightCommand: ICommand = {const range = selectionManagerService.getRangeDatas();if (!range?.length) return false;- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/insert-row-col.command.ts b/packages/base-sheets/src/commands/commands/insert-row-col.command.tsindex 823f5dd755..806fa6fa08 100644--- a/packages/base-sheets/src/commands/commands/insert-row-col.command.ts+++ b/packages/base-sheets/src/commands/commands/insert-row-col.command.ts@@ -7,11 +7,11 @@ import {IColumnData,ICommand,ICommandService,- ICurrentUniverService,IRange,IRowData,IStyleData,IUndoRedoService,+ IUniverInstanceService,Nullable,ObjectArray,ObjectMatrix,@@ -74,9 +74,9 @@ export const InsertRowCommand: ICommand = {handler: async (accessor: IAccessor, params: IInsertRowCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = currentUniverService.getUniverSheetInstance(params.workbookId)!!;+ const workbook = univerInstanceService.getUniverSheetInstance(params.workbookId)!!;const worksheet = workbook.getSheetBySheetId(params.worksheetId)!;const { range, direction, workbookId, worksheetId } = params;@@ -230,8 +230,8 @@ export const InsertRowBeforeCommand: ICommand = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();if (!workbook) {return false;}@@ -277,8 +277,8 @@ export const InsertRowAfterCommand: ICommand = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();if (!workbook) {return false;}@@ -322,11 +322,11 @@ export const InsertColCommand: ICommand<IInsertColCommandParams> = {handler: async (accessor: IAccessor, params: IInsertColCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const { range, direction, worksheetId, workbookId } = params;const { startRow, endRow, startColumn, endColumn } = params.range;- const workbook = currentUniverService.getUniverSheetInstance(params.workbookId)!;+ const workbook = univerInstanceService.getUniverSheetInstance(params.workbookId)!;const worksheet = workbook.getSheetBySheetId(params.worksheetId)!;const anchorCol = direction === Direction.LEFT ? startColumn : startColumn - 1;const width = worksheet.getColumnWidth(anchorCol);@@ -475,8 +475,8 @@ export const InsertColBeforeCommand: ICommand = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();if (!workbook) {return false;}@@ -520,8 +520,8 @@ export const InsertColAfterCommand: ICommand = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();if (!workbook) {return false;}diff --git a/packages/base-sheets/src/commands/commands/insert-sheet.command.ts b/packages/base-sheets/src/commands/commands/insert-sheet.command.tsindex 5dc9657a47..5fc1efbdfd 100644--- a/packages/base-sheets/src/commands/commands/insert-sheet.command.ts+++ b/packages/base-sheets/src/commands/commands/insert-sheet.command.ts@@ -3,8 +3,8 @@ import {DEFAULT_WORKSHEET,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,IWorksheetConfig,Tools,} from '@univerjs/core';@@ -34,15 +34,15 @@ export const InsertSheetCommand: ICommand = {handler: async (accessor: IAccessor, params?: InsertSheetCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- let workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();+ let workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();if (params) {workbookId = params.workbookId ?? workbookId;}- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;let index = workbook.getSheets().length;diff --git a/packages/base-sheets/src/commands/commands/move-range-to.command.ts b/packages/base-sheets/src/commands/commands/move-range-to.command.tsindex 3a522907e3..1769435faa 100644--- a/packages/base-sheets/src/commands/commands/move-range-to.command.ts+++ b/packages/base-sheets/src/commands/commands/move-range-to.command.ts@@ -3,9 +3,9 @@ import {ICellData,ICommand,ICommandService,- ICurrentUniverService,IRange,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -27,7 +27,7 @@ export const MoveRangeToCommand: ICommand = {handler: async (accessor: IAccessor, params: IMoveRangeToCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);const originRange = selectionManagerService.getRangeDatas()?.[0];@@ -35,13 +35,13 @@ export const MoveRangeToCommand: ICommand = {return false;}- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/move-rows-cols.command.ts b/packages/base-sheets/src/commands/commands/move-rows-cols.command.tsindex b4c7a6f354..b8333a6dd6 100644--- a/packages/base-sheets/src/commands/commands/move-rows-cols.command.ts+++ b/packages/base-sheets/src/commands/commands/move-rows-cols.command.ts@@ -3,9 +3,9 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IRange,IUndoRedoService,+ IUniverInstanceService,RANGE_TYPE,Rectangle,sequenceExecute,@@ -60,8 +60,8 @@ export const MoveRowsCommand: ICommand<IMoveRowsCommandParams> = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();if (!workbook) {return false;}@@ -242,8 +242,8 @@ export const MoveColsCommand: ICommand<IMoveColsCommandParams> = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();if (!workbook) {return false;}diff --git a/packages/base-sheets/src/commands/commands/remove-row-col.command.ts b/packages/base-sheets/src/commands/commands/remove-row-col.command.tsindex d602415e0f..4d3e1b25df 100644--- a/packages/base-sheets/src/commands/commands/remove-row-col.command.ts+++ b/packages/base-sheets/src/commands/commands/remove-row-col.command.ts@@ -3,9 +3,9 @@ import {Dimension,ICommand,ICommandService,- ICurrentUniverService,IRange,IUndoRedoService,+ IUniverInstanceService,Nullable,Rectangle,sequenceExecute,@@ -52,8 +52,8 @@ export const RemoveRowCommand: ICommand = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();const workbookId = workbook.getUnitId();@@ -204,8 +204,8 @@ export const RemoveColCommand: ICommand = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();const workbookId = workbook.getUnitId();diff --git a/packages/base-sheets/src/commands/commands/remove-sheet.command.ts b/packages/base-sheets/src/commands/commands/remove-sheet.command.tsindex c738bb0197..25efefd153 100644--- a/packages/base-sheets/src/commands/commands/remove-sheet.command.ts+++ b/packages/base-sheets/src/commands/commands/remove-sheet.command.ts@@ -1,4 +1,4 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService, IUndoRedoService } from '@univerjs/core';+import { CommandType, ICommand, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import { IInsertSheetMutationParams, IRemoveSheetMutationParams } from '../../Basics/Interfaces/MutationInterface';@@ -24,9 +24,9 @@ export const RemoveSheetCommand: ICommand = {handler: async (accessor: IAccessor, params?: RemoveSheetCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);- let workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- let worksheetId = currentUniverService+ const univerInstanceService = accessor.get(IUniverInstanceService);+ let workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ let worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()@@ -37,7 +37,7 @@ export const RemoveSheetCommand: ICommand = {worksheetId = params.worksheetId ?? worksheetId;}- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/remove-worksheet-merge.command.ts b/packages/base-sheets/src/commands/commands/remove-worksheet-merge.command.tsindex 8b9fdb8a44..4f3589f509 100644--- a/packages/base-sheets/src/commands/commands/remove-worksheet-merge.command.ts+++ b/packages/base-sheets/src/commands/commands/remove-worksheet-merge.command.ts@@ -2,8 +2,8 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,Rectangle,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -26,18 +26,18 @@ export const RemoveWorksheetMergeCommand: ICommand = {const selectionManagerService = accessor.get(SelectionManagerService);const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selections = selectionManagerService.getRangeDatas();if (!selections?.length) return false;- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-border-command.ts b/packages/base-sheets/src/commands/commands/set-border-command.tsindex 57a840f72e..7b63691c2e 100644--- a/packages/base-sheets/src/commands/commands/set-border-command.ts+++ b/packages/base-sheets/src/commands/commands/set-border-command.ts@@ -6,10 +6,10 @@ import {IBorderStyleData,ICommand,ICommandService,- ICurrentUniverService,IRange,IStyleData,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,Rectangle,Tools,@@ -89,12 +89,12 @@ export const SetBorderCommand: ICommand = {handler: async (accessor: IAccessor) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);const borderStyleManagerService = accessor.get(BorderStyleManagerService);const selections = selectionManagerService.getRangeDatas();- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const workbookId = workbook.getUnitId();const worksheet = workbook.getActiveSheet();const worksheetId = worksheet.getSheetId();diff --git a/packages/base-sheets/src/commands/commands/set-border-styles-command.ts b/packages/base-sheets/src/commands/commands/set-border-styles-command.tsindex ef73b4879c..e9144ade20 100644--- a/packages/base-sheets/src/commands/commands/set-border-styles-command.ts+++ b/packages/base-sheets/src/commands/commands/set-border-styles-command.ts@@ -5,10 +5,10 @@ import {IBorderStyleData,ICommand,ICommandService,- ICurrentUniverService,IRange,IStyleData,IUndoRedoService,+ IUniverInstanceService,Nullable,ObjectMatrix,Tools,@@ -56,7 +56,7 @@ export const SetBorderCommand: ICommand = {handler: async (accessor: IAccessor, params: ISetBorderCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);const range = params.range || selectionManagerService.getRangeDatas()?.[0];@@ -75,11 +75,11 @@ export const SetBorderCommand: ICommand = {style = BorderStyleTypes.DASH_DOT,} = params;- const workbookId = params.workbookId || currentUniverService.getCurrentUniverSheetInstance().getUnitId();+ const workbookId = params.workbookId || univerInstanceService.getCurrentUniverSheetInstance().getUnitId();const worksheetId =- params.worksheetId || currentUniverService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();+ params.worksheetId || univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-col-visible.command.ts b/packages/base-sheets/src/commands/commands/set-col-visible.command.tsindex 046043b4f6..52461f0ba5 100644--- a/packages/base-sheets/src/commands/commands/set-col-visible.command.ts+++ b/packages/base-sheets/src/commands/commands/set-col-visible.command.ts@@ -2,9 +2,9 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IRange,IUndoRedoService,+ IUniverInstanceService,Nullable,RANGE_TYPE,sequenceExecute,@@ -36,7 +36,7 @@ export const SetSpecificColsVisibleCommand: ICommand<ISetSpecificColsVisibleCommconst { workbookId, worksheetId, ranges } = params;const worksheet = accessor- .get(ICurrentUniverService)+ .get(IUniverInstanceService).getUniverSheetInstance(workbookId)!.getSheetBySheetId(worksheetId)!;@@ -120,8 +120,8 @@ export const SetSelectedColsVisibleCommand: ICommand = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();if (!workbook) return false;const worksheet = workbook.getActiveSheet();if (!worksheet) return false;@@ -154,8 +154,8 @@ export const SetColHiddenCommand: ICommand = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();if (!workbook) return false;const worksheet = workbook.getActiveSheet();if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-frozen-cancel.command.ts b/packages/base-sheets/src/commands/commands/set-frozen-cancel.command.tsindex 08eb5ea9c7..d2f11a7f4e 100644--- a/packages/base-sheets/src/commands/commands/set-frozen-cancel.command.ts+++ b/packages/base-sheets/src/commands/commands/set-frozen-cancel.command.ts@@ -1,4 +1,4 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService, IUndoRedoService } from '@univerjs/core';+import { CommandType, ICommand, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import {@@ -13,16 +13,16 @@ export const SetFrozenCancelCommand: ICommand = {handler: async (accessor: IAccessor) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-frozen.command.ts b/packages/base-sheets/src/commands/commands/set-frozen.command.tsindex 86912fb7bc..a88d2504a0 100644--- a/packages/base-sheets/src/commands/commands/set-frozen.command.ts+++ b/packages/base-sheets/src/commands/commands/set-frozen.command.ts@@ -2,8 +2,8 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,RANGE_TYPE,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -27,10 +27,10 @@ export const SetSelectionFrozenCommand: ICommand = {type: CommandType.COMMAND,id: 'sheet.command.set-selection-frozen',handler: async (accessor: IAccessor) => {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const undoRedoService = accessor.get(IUndoRedoService);- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()@@ -105,16 +105,16 @@ export const SetFrozenCommand: ICommand = {handler: async (accessor: IAccessor, params: ISetFrozenCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-hide-gridlines.command.ts b/packages/base-sheets/src/commands/commands/set-hide-gridlines.command.tsindex c9909c9fb4..f2c18ad191 100644--- a/packages/base-sheets/src/commands/commands/set-hide-gridlines.command.ts+++ b/packages/base-sheets/src/commands/commands/set-hide-gridlines.command.ts@@ -3,8 +3,8 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -27,10 +27,10 @@ export const SetHideGridlinesCommand: ICommand = {handler: async (accessor: IAccessor, params?: ISetHideGridlinesCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- let workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- let worksheetId = currentUniverService+ let workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ let worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()@@ -43,7 +43,7 @@ export const SetHideGridlinesCommand: ICommand = {hideGridlines = params.hideGridlines ?? BooleanNumber.FALSE;}- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-range-formatted-value.command.ts b/packages/base-sheets/src/commands/commands/set-range-formatted-value.command.tsindex 1c2efc3b9d..332e3e9479 100644--- a/packages/base-sheets/src/commands/commands/set-range-formatted-value.command.ts+++ b/packages/base-sheets/src/commands/commands/set-range-formatted-value.command.ts@@ -3,8 +3,8 @@ import {ICellV,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,Tools,} from '@univerjs/core';@@ -31,7 +31,7 @@ export const SetRangeFormattedValueCommand: ICommand = {handler: async (accessor: IAccessor, params: ISetRangeFormattedValueParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);const ranges = selectionManagerService.getRangeDatas();@@ -39,14 +39,14 @@ export const SetRangeFormattedValueCommand: ICommand = {return false;}- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-range-values.command.ts b/packages/base-sheets/src/commands/commands/set-range-values.command.tsindex 2df619f435..0f99fbc12e 100644--- a/packages/base-sheets/src/commands/commands/set-range-values.command.ts+++ b/packages/base-sheets/src/commands/commands/set-range-values.command.ts@@ -3,10 +3,10 @@ import {ICellData,ICommand,ICommandService,- ICurrentUniverService,IRange,isICellData,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,ObjectMatrixPrimitiveType,Tools,@@ -42,14 +42,14 @@ export const SetRangeValuesCommand: ICommand = {handler: async (accessor: IAccessor, params: ISetRangeValuesCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);const {value,range,- workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId(),- worksheetId = currentUniverService+ workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId(),+ worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()diff --git a/packages/base-sheets/src/commands/commands/set-row-visible.command.ts b/packages/base-sheets/src/commands/commands/set-row-visible.command.tsindex d22f7ae438..fbe393754b 100644--- a/packages/base-sheets/src/commands/commands/set-row-visible.command.ts+++ b/packages/base-sheets/src/commands/commands/set-row-visible.command.ts@@ -2,9 +2,9 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IRange,IUndoRedoService,+ IUniverInstanceService,RANGE_TYPE,sequenceExecute,} from '@univerjs/core';@@ -38,7 +38,7 @@ export const SetSpecificRowsVisibleCommand: ICommand<ISetSpecificRowsVisibleCommconst undoRedoService = accessor.get(IUndoRedoService);const worksheet = accessor- .get(ICurrentUniverService)+ .get(IUniverInstanceService).getUniverSheetInstance(workbookId)!.getSheetBySheetId(worksheetId)!;@@ -116,7 +116,7 @@ export const SetSelectedRowsVisibleCommand: ICommand = {id: 'sheet.command.set-selected-rows-visible',handler: async (accessor: IAccessor) => {const selectionManagerService = accessor.get(SelectionManagerService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const ranges = selectionManagerService.getSelections()@@ -126,7 +126,7 @@ export const SetSelectedRowsVisibleCommand: ICommand = {return false;}- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();if (!workbook) return false;const worksheet = workbook.getActiveSheet();if (!worksheet) return false;@@ -151,7 +151,7 @@ export const SetRowHiddenCommand: ICommand = {const selectionManagerService = accessor.get(SelectionManagerService);const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const ranges = selectionManagerService.getSelections()@@ -161,9 +161,9 @@ export const SetRowHiddenCommand: ICommand = {return false;}- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-scroll.command.ts b/packages/base-sheets/src/commands/commands/set-scroll.command.tsindex 63b5f6a755..599631caf3 100644--- a/packages/base-sheets/src/commands/commands/set-scroll.command.ts+++ b/packages/base-sheets/src/commands/commands/set-scroll.command.ts@@ -1,4 +1,4 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService } from '@univerjs/core';+import { CommandType, ICommand, ICommandService, IUniverInstanceService } from '@univerjs/core';import { SetScrollOperation } from '../operations/scroll.operation';@@ -14,9 +14,9 @@ export const ScrollCommand: ICommand<IScrollCommandParams> = {id: 'sheet.command.scroll-view',type: CommandType.COMMAND,handler: async (accessor, params = { sheetViewStartRow: 0, sheetViewStartColumn: 0 }) => {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const currentWorkbook = currentUniverService.getCurrentUniverSheetInstance();+ const currentWorkbook = univerInstanceService.getCurrentUniverSheetInstance();const currentWorksheet = currentWorkbook.getActiveSheet();if (!currentWorksheet) {@@ -43,9 +43,9 @@ export const RestScrollCommand: ICommand<{}> = {id: 'sheet.command.scroll-view-reset',type: CommandType.COMMAND,handler: async (accessor) => {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const currentWorkbook = currentUniverService.getCurrentUniverSheetInstance();+ const currentWorkbook = univerInstanceService.getCurrentUniverSheetInstance();const currentWorksheet = currentWorkbook.getActiveSheet();if (!currentWorksheet) {diff --git a/packages/base-sheets/src/commands/commands/set-selections.command.ts b/packages/base-sheets/src/commands/commands/set-selections.command.tsindex 2197c85c06..75b5d8097f 100644--- a/packages/base-sheets/src/commands/commands/set-selections.command.ts+++ b/packages/base-sheets/src/commands/commands/set-selections.command.ts@@ -3,8 +3,8 @@ import {Direction,ICommand,ICommandService,- ICurrentUniverService,IRange,+ IUniverInstanceService,RANGE_TYPE,Rectangle,} from '@univerjs/core';@@ -43,7 +43,7 @@ export const MoveSelectionCommand: ICommand<IMoveSelectionCommandParams> = {return false;}- const workbook = accessor.get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const workbook = accessor.get(IUniverInstanceService).getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();const selection = accessor.get(SelectionManagerService).getLast();if (!selection) {@@ -104,7 +104,7 @@ export const ExpandSelectionCommand: ICommand<IExpandSelectionCommandParams> = {return false;}- const currentWorkbook = accessor.get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const currentWorkbook = accessor.get(IUniverInstanceService).getCurrentUniverSheetInstance();const currentWorksheet = currentWorkbook.getActiveSheet();const selection = accessor.get(SelectionManagerService).getLast();@@ -170,7 +170,7 @@ export const SelectAllCommand: ICommand<ISelectAllCommandParams> = {},handler: async (accessor, params = { expandToGapFirst: true, loop: false }) => {const selection = accessor.get(SelectionManagerService).getLast();- const workbook = accessor.get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const workbook = accessor.get(IUniverInstanceService).getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();if (!selection || !worksheet) {diff --git a/packages/base-sheets/src/commands/commands/set-style.command.ts b/packages/base-sheets/src/commands/commands/set-style.command.tsindex ab8e1fed53..804b437de8 100644--- a/packages/base-sheets/src/commands/commands/set-style.command.ts+++ b/packages/base-sheets/src/commands/commands/set-style.command.ts@@ -8,10 +8,10 @@ import {IColorStyle,ICommand,ICommandService,- ICurrentUniverService,IStyleData,ITextRotation,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,Tools,VerticalAlign,@@ -47,22 +47,22 @@ export const SetStyleCommand: ICommand<ISetStyleParams<unknown>> = {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);const selectionManagerService = accessor.get(SelectionManagerService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const ranges = selectionManagerService.getRangeDatas();if (!ranges?.length) {return false;}- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();const style = params.style;- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;@@ -148,7 +148,7 @@ export const SetBoldCommand: ICommand = {}const worksheet = accessor- .get(ICurrentUniverService)+ .get(IUniverInstanceService).getCurrentUniverSheetInstance().getActiveSheet();@@ -180,7 +180,7 @@ export const SetItalicCommand: ICommand = {}const worksheet = accessor- .get(ICurrentUniverService)+ .get(IUniverInstanceService).getCurrentUniverSheetInstance().getActiveSheet();@@ -215,7 +215,7 @@ export const SetUnderlineCommand: ICommand = {}const worksheet = accessor- .get(ICurrentUniverService)+ .get(IUniverInstanceService).getCurrentUniverSheetInstance().getActiveSheet();@@ -252,7 +252,7 @@ export const SetStrikeThroughCommand: ICommand = {}const worksheet = accessor- .get(ICurrentUniverService)+ .get(IUniverInstanceService).getCurrentUniverSheetInstance().getActiveSheet();@@ -287,7 +287,7 @@ export const SetOverlineCommand: ICommand = {}const worksheet = accessor- .get(ICurrentUniverService)+ .get(IUniverInstanceService).getCurrentUniverSheetInstance().getActiveSheet();diff --git a/packages/base-sheets/src/commands/commands/set-tab-color.command.ts b/packages/base-sheets/src/commands/commands/set-tab-color.command.tsindex 9e883aab1d..79b9a12f74 100644--- a/packages/base-sheets/src/commands/commands/set-tab-color.command.ts+++ b/packages/base-sheets/src/commands/commands/set-tab-color.command.ts@@ -1,4 +1,4 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService, IUndoRedoService } from '@univerjs/core';+import { CommandType, ICommand, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import {@@ -18,16 +18,16 @@ export const SetTabColorCommand: ICommand = {handler: async (accessor: IAccessor, params: ISetTabColorCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-worksheet-activate.command.ts b/packages/base-sheets/src/commands/commands/set-worksheet-activate.command.tsindex 337d630827..93243e0b1c 100644--- a/packages/base-sheets/src/commands/commands/set-worksheet-activate.command.ts+++ b/packages/base-sheets/src/commands/commands/set-worksheet-activate.command.ts@@ -1,4 +1,4 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService, IUndoRedoService } from '@univerjs/core';+import { CommandType, ICommand, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import {@@ -18,10 +18,10 @@ export const SetWorksheetActivateCommand: ICommand = {handler: async (accessor: IAccessor, params?: ISetWorksheetActivateCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- let workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- let worksheetId = currentUniverService+ let workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ let worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()diff --git a/packages/base-sheets/src/commands/commands/set-worksheet-col-width.command.ts b/packages/base-sheets/src/commands/commands/set-worksheet-col-width.command.tsindex e539ef11aa..724d4b58c1 100644--- a/packages/base-sheets/src/commands/commands/set-worksheet-col-width.command.ts+++ b/packages/base-sheets/src/commands/commands/set-worksheet-col-width.command.ts@@ -2,8 +2,8 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,RANGE_TYPE,Rectangle,} from '@univerjs/core';@@ -31,8 +31,8 @@ export const DeltaColumnWidthCommand: ICommand<IDeltaColumnWidthCommandParams> =return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();const workbookId = workbook.getUnitId();const worksheetId = worksheet.getSheetId();@@ -113,15 +113,15 @@ export const SetColWidthCommand: ICommand = {const selectionManagerService = accessor.get(SelectionManagerService);const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selections = selectionManagerService.getRangeDatas();if (!selections?.length) {return false;}- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()diff --git a/packages/base-sheets/src/commands/commands/set-worksheet-hide.command.ts b/packages/base-sheets/src/commands/commands/set-worksheet-hide.command.tsindex d2766ab663..47dc2ffe4d 100644--- a/packages/base-sheets/src/commands/commands/set-worksheet-hide.command.ts+++ b/packages/base-sheets/src/commands/commands/set-worksheet-hide.command.ts@@ -3,8 +3,8 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -30,16 +30,16 @@ export const SetWorksheetHideCommand: ICommand = {handler: async (accessor: IAccessor, params?: ISetWorksheetHiddenCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- let worksheetId = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ let worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();if (params) {worksheetId = params.worksheetId ?? worksheetId;}- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-worksheet-name.command.ts b/packages/base-sheets/src/commands/commands/set-worksheet-name.command.tsindex 7bf836691d..8c71729a5f 100644--- a/packages/base-sheets/src/commands/commands/set-worksheet-name.command.ts+++ b/packages/base-sheets/src/commands/commands/set-worksheet-name.command.ts@@ -1,4 +1,4 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService, IUndoRedoService } from '@univerjs/core';+import { CommandType, ICommand, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import {@@ -23,11 +23,11 @@ export const SetWorksheetNameCommand: ICommand = {handler: async (accessor: IAccessor, params: SetWorksheetNameCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const workbookId = params.workbookId || currentUniverService.getCurrentUniverSheetInstance().getUnitId();+ const workbookId = params.workbookId || univerInstanceService.getCurrentUniverSheetInstance().getUnitId();const worksheetId =- params.worksheetId || currentUniverService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();+ params.worksheetId || univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();const redoMutationParams: ISetWorksheetNameMutationParams = {worksheetId,diff --git a/packages/base-sheets/src/commands/commands/set-worksheet-order.command.ts b/packages/base-sheets/src/commands/commands/set-worksheet-order.command.tsindex 0d66535c53..29448fc981 100644--- a/packages/base-sheets/src/commands/commands/set-worksheet-order.command.ts+++ b/packages/base-sheets/src/commands/commands/set-worksheet-order.command.ts@@ -1,4 +1,4 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService, IUndoRedoService } from '@univerjs/core';+import { CommandType, ICommand, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import {@@ -20,13 +20,13 @@ export const SetWorksheetOrderCommand: ICommand = {handler: async (accessor: IAccessor, params: ISetWorksheetOrderCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const workbookId = params.workbookId || currentUniverService.getCurrentUniverSheetInstance().getUnitId();+ const workbookId = params.workbookId || univerInstanceService.getCurrentUniverSheetInstance().getUnitId();const worksheetId =- params.worksheetId || currentUniverService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();+ params.worksheetId || univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-worksheet-right-to-left.command.ts b/packages/base-sheets/src/commands/commands/set-worksheet-right-to-left.command.tsindex b7ec7f78b6..72b94f8dfc 100644--- a/packages/base-sheets/src/commands/commands/set-worksheet-right-to-left.command.ts+++ b/packages/base-sheets/src/commands/commands/set-worksheet-right-to-left.command.ts@@ -3,8 +3,8 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -27,10 +27,10 @@ export const SetWorksheetRightToLeftCommand: ICommand = {handler: async (accessor: IAccessor, params?: ISetWorksheetRightToLeftCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- let workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- let worksheetId = currentUniverService+ let workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ let worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()@@ -43,7 +43,7 @@ export const SetWorksheetRightToLeftCommand: ICommand = {rightToLeft = params.rightToLeft ?? BooleanNumber.FALSE;}- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-worksheet-row-height.command.ts b/packages/base-sheets/src/commands/commands/set-worksheet-row-height.command.tsindex 75c8ddf7a3..b99cf8ab4c 100644--- a/packages/base-sheets/src/commands/commands/set-worksheet-row-height.command.ts+++ b/packages/base-sheets/src/commands/commands/set-worksheet-row-height.command.ts@@ -2,8 +2,8 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,RANGE_TYPE,Rectangle,} from '@univerjs/core';@@ -31,8 +31,8 @@ export const DeltaRowHeightCommand: ICommand = {return false;}- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();const workbookId = workbook.getUnitId();const worksheetId = worksheet.getSheetId();@@ -112,12 +112,12 @@ export const SetRowHeightCommand: ICommand = {const selectionManagerService = accessor.get(SelectionManagerService);const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selections = selectionManagerService.getRangeDatas();if (!selections?.length) return false;- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const workbookId = workbook.getUnitId();const worksheetId = workbook.getActiveSheet().getSheetId();diff --git a/packages/base-sheets/src/commands/commands/set-worksheet-show.command.ts b/packages/base-sheets/src/commands/commands/set-worksheet-show.command.tsindex 57f8ee7e65..c635997196 100644--- a/packages/base-sheets/src/commands/commands/set-worksheet-show.command.ts+++ b/packages/base-sheets/src/commands/commands/set-worksheet-show.command.ts@@ -3,8 +3,8 @@ import {CommandType,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -30,10 +30,10 @@ export const SetWorksheetShowCommand: ICommand = {handler: async (accessor: IAccessor, params?: ISetWorksheetShowCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- let worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ let worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet()@@ -43,7 +43,7 @@ export const SetWorksheetShowCommand: ICommand = {worksheetId = params.value ?? worksheetId;}- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/commands/set-zoom-ratio.command.ts b/packages/base-sheets/src/commands/commands/set-zoom-ratio.command.tsindex 0998f405e2..c5d86deda7 100644--- a/packages/base-sheets/src/commands/commands/set-zoom-ratio.command.ts+++ b/packages/base-sheets/src/commands/commands/set-zoom-ratio.command.ts@@ -1,4 +1,4 @@-import { CommandType, ICommand, ICommandService, ICurrentUniverService } from '@univerjs/core';+import { CommandType, ICommand, ICommandService, IUniverInstanceService } from '@univerjs/core';import { SHEET_ZOOM_RANGE } from '../../Basics/Const';import { SetZoomRatioOperation } from '../operations/set-zoom-ratio.operation';@@ -25,7 +25,7 @@ export const ChangeZoomRatioCommand: ICommand<IChangeZoomRatioCommandParams> = {return false;}const { delta, reset } = params;- const workbook = accessor.get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const workbook = accessor.get(IUniverInstanceService).getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();const workbookId = workbook.getUnitId();const worksheetId = worksheet.getSheetId();diff --git a/packages/base-sheets/src/commands/commands/trim-whitespace.command.ts b/packages/base-sheets/src/commands/commands/trim-whitespace.command.tsindex f8d795ea62..3dbc1c674b 100644--- a/packages/base-sheets/src/commands/commands/trim-whitespace.command.ts+++ b/packages/base-sheets/src/commands/commands/trim-whitespace.command.ts@@ -3,8 +3,8 @@ import {ICellV,ICommand,ICommandService,- ICurrentUniverService,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';@@ -27,19 +27,19 @@ export const TrimWhitespaceCommand: ICommand = {const selectionManagerService = accessor.get(SelectionManagerService);const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selections = selectionManagerService.getRangeDatas();if (!selections?.length) return false;- const workbookId = currentUniverService.getCurrentUniverSheetInstance().getUnitId();- const worksheetId = currentUniverService+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();+ const worksheetId = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();- const worksheet = currentUniverService.getUniverSheetInstance(workbookId)?.getSheetBySheetId(worksheetId);+ const worksheet = univerInstanceService.getUniverSheetInstance(workbookId)?.getSheetBySheetId(worksheetId);if (!worksheet) return false;const sheetMatrix = worksheet.getCellMatrix();const cellValue = new ObjectMatrix<ICellV>();diff --git a/packages/base-sheets/src/commands/mutations/add-worksheet-merge.mutation.ts b/packages/base-sheets/src/commands/mutations/add-worksheet-merge.mutation.tsindex 9b67934274..ba3a0d0ab5 100644--- a/packages/base-sheets/src/commands/mutations/add-worksheet-merge.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/add-worksheet-merge.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import {@@ -10,8 +10,8 @@ export const AddMergeUndoMutationFactory = (accessor: IAccessor,params: IAddWorksheetMergeMutationParams): IRemoveWorksheetMergeMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -28,8 +28,8 @@ export const AddWorksheetMergeMutation: IMutation<IAddWorksheetMergeMutationParaid: 'sheet.mutation.add-worksheet-merge',type: CommandType.MUTATION,handler: async (accessor: IAccessor, params: IAddWorksheetMergeMutationParams) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');diff --git a/packages/base-sheets/src/commands/mutations/delete-range.mutation.ts b/packages/base-sheets/src/commands/mutations/delete-range.mutation.tsindex 61590977ce..c0c6936a68 100644--- a/packages/base-sheets/src/commands/mutations/delete-range.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/delete-range.mutation.ts@@ -2,8 +2,8 @@ import {CommandType,Dimension,ICellData,- ICurrentUniverService,IMutation,+ IUniverInstanceService,Nullable,ObjectMatrix,Tools,@@ -23,8 +23,8 @@ export const DeleteRangeUndoMutationFactory = (accessor: IAccessor,params: IDeleteRangeMutationParams): Nullable<IInsertRangeMutationParams> => {- const currentUniverService = accessor.get(ICurrentUniverService);- const worksheet = currentUniverService+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getSheetBySheetId(params.worksheetId);@@ -77,8 +77,8 @@ export const DeleteRangeMutation: IMutation<IDeleteRangeMutationParams, boolean>id: 'sheet.mutation.delete-range',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getUniverSheetInstance(params.workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(params.worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/mutations/insert-range.mutation.ts b/packages/base-sheets/src/commands/mutations/insert-range.mutation.tsindex c74e89e848..d491f2d237 100644--- a/packages/base-sheets/src/commands/mutations/insert-range.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/insert-range.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, Dimension, ICellData, ICurrentUniverService, IMutation } from '@univerjs/core';+import { CommandType, Dimension, ICellData, IMutation, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import { IDeleteRangeMutationParams, IInsertRangeMutationParams } from '../../Basics/Interfaces/MutationInterface';@@ -24,8 +24,8 @@ export const InsertRangeMutation: IMutation<IInsertRangeMutationParams, boolean>id: 'sheet.mutation.insert-range',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getUniverSheetInstance(params.workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(params.worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/mutations/insert-row-col.mutation.ts b/packages/base-sheets/src/commands/mutations/insert-row-col.mutation.tsindex 8ff2d315ed..42dc9211e9 100644--- a/packages/base-sheets/src/commands/mutations/insert-row-col.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/insert-row-col.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation, ObjectArray, Rectangle } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService, ObjectArray, Rectangle } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import {@@ -12,8 +12,8 @@ export const InsertRowMutationUndoFactory = (accessor: IAccessor,params: IInsertRowMutationParams): IRemoveRowsMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -31,9 +31,9 @@ export const InsertRowMutation: IMutation<IInsertRowMutationParams> = {type: CommandType.MUTATION,handler: async (accessor, params) => {const { workbookId, worksheetId, ranges, rowInfo } = params;- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const universheet = currentUniverService.getUniverSheetInstance(workbookId);+ const universheet = univerInstanceService.getUniverSheetInstance(workbookId);if (universheet == null) {throw new Error('universheet is null error!');}@@ -77,8 +77,8 @@ export const InsertColMutationUndoFactory = (accessor: IAccessor,params: IInsertColMutationParams): IRemoveColMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -95,8 +95,8 @@ export const InsertColMutation: IMutation<IInsertColMutationParams> = {id: 'sheet.mutation.insert-col',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');diff --git a/packages/base-sheets/src/commands/mutations/insert-sheet.mutation.ts b/packages/base-sheets/src/commands/mutations/insert-sheet.mutation.tsindex 6227bdc38f..7d6a474a16 100644--- a/packages/base-sheets/src/commands/mutations/insert-sheet.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/insert-sheet.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import { IInsertSheetMutationParams, IRemoveSheetMutationParams } from '../../Basics/Interfaces/MutationInterface';@@ -22,9 +22,9 @@ export const InsertSheetMutation: IMutation<IInsertSheetMutationParams, boolean>id: 'sheet.mutation.insert-sheet',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const { sheet, index, workbookId } = params;- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) {return false;}diff --git a/packages/base-sheets/src/commands/mutations/move-rows-cols.mutation.ts b/packages/base-sheets/src/commands/mutations/move-rows-cols.mutation.tsindex 1b64f9f0b3..8c73a4d265 100644--- a/packages/base-sheets/src/commands/mutations/move-rows-cols.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/move-rows-cols.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation, IRange, Rectangle } from '@univerjs/core';+import { CommandType, IMutation, IRange, IUniverInstanceService, Rectangle } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';// TODO@wzhudev: maybe we should do some error handling in these mutators@@ -50,9 +50,9 @@ export const MoveRowsMutation: IMutation<IMoveRowsMutationParams> = {type: CommandType.MUTATION,handler: async (accessor, params) => {const { workbookId, worksheetId, sourceRange, targetRange } = params;- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const univerSheet = currentUniverService.getUniverSheetInstance(workbookId);+ const univerSheet = univerInstanceService.getUniverSheetInstance(workbookId);if (!univerSheet) {throw new Error('[MoveRowMutation] univerSheet is null!');}@@ -124,9 +124,9 @@ export const MoveColsMutation: IMutation<IMoveColumnsMutationParams> = {type: CommandType.MUTATION,handler: async (accessor, params) => {const { workbookId, worksheetId, sourceRange, targetRange } = params;- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);- const univerSheet = currentUniverService.getUniverSheetInstance(workbookId);+ const univerSheet = univerInstanceService.getUniverSheetInstance(workbookId);if (!univerSheet) {throw new Error('[MoveColumnMutation] univerSheet is null!');}diff --git a/packages/base-sheets/src/commands/mutations/remove-row-col.mutation.ts b/packages/base-sheets/src/commands/mutations/remove-row-col.mutation.tsindex 5036696f2f..353a5e9079 100644--- a/packages/base-sheets/src/commands/mutations/remove-row-col.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/remove-row-col.mutation.ts@@ -1,9 +1,9 @@import {CommandType,IColumnData,- ICurrentUniverService,IMutation,IRowData,+ IUniverInstanceService,ObjectArray,Worksheet,} from '@univerjs/core';@@ -43,8 +43,8 @@ export const RemoveRowMutation: IMutation<IRemoveRowsMutationParams> = {id: 'sheet.mutation.remove-rows',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -79,8 +79,8 @@ export const RemoveColMutationFactory = (accessor: IAccessor,params: IRemoveColMutationParams): IInsertColMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -116,8 +116,8 @@ export const RemoveColMutation: IMutation<IRemoveColMutationParams> = {id: 'sheet.mutation.remove-col',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');diff --git a/packages/base-sheets/src/commands/mutations/remove-sheet.mutation.ts b/packages/base-sheets/src/commands/mutations/remove-sheet.mutation.tsindex a45ca5fae2..b80a913f5d 100644--- a/packages/base-sheets/src/commands/mutations/remove-sheet.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/remove-sheet.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import { IInsertSheetMutationParams, IRemoveSheetMutationParams } from '../../Basics/Interfaces/MutationInterface';@@ -14,8 +14,8 @@ export const RemoveSheetUndoMutationFactory = (accessor: IAccessor,params: IRemoveSheetMutationParams): IInsertSheetMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const { worksheetId, workbookId } = params;const sheet = workbook.getSheetBySheetId(worksheetId)!.getConfig();const config = workbook!.getConfig();@@ -32,9 +32,9 @@ export const RemoveSheetMutation: IMutation<IRemoveSheetMutationParams, boolean>id: 'sheet.mutation.remove-sheet',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const { worksheetId, workbookId } = params;- const workbook = currentUniverService.getUniverSheetInstance(workbookId);+ const workbook = univerInstanceService.getUniverSheetInstance(workbookId);if (!workbook) {return false;diff --git a/packages/base-sheets/src/commands/mutations/remove-worksheet-merge.mutation.ts b/packages/base-sheets/src/commands/mutations/remove-worksheet-merge.mutation.tsindex f034e98935..419ed69ed1 100644--- a/packages/base-sheets/src/commands/mutations/remove-worksheet-merge.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/remove-worksheet-merge.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation, Rectangle } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService, Rectangle } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';import {@@ -10,8 +10,8 @@ export const RemoveMergeUndoMutationFactory = (accessor: IAccessor,params: IRemoveWorksheetMergeMutationParams): IAddWorksheetMergeMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -46,8 +46,8 @@ export const RemoveWorksheetMergeMutation: IMutation<IRemoveWorksheetMergeMutatiid: 'sheet.mutation.remove-worksheet-merge',type: CommandType.MUTATION,handler: async (accessor: IAccessor, params: IRemoveWorksheetMergeMutationParams) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');diff --git a/packages/base-sheets/src/commands/mutations/set-border-styles.mutation.ts b/packages/base-sheets/src/commands/mutations/set-border-styles.mutation.tsindex 86c3466262..d4cc9b7c32 100644--- a/packages/base-sheets/src/commands/mutations/set-border-styles.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-border-styles.mutation.ts@@ -1,12 +1,12 @@import {CommandType,IBorderData,- ICurrentUniverService,IDocumentData,IKeyValue,IMutation,IStyleData,ITextStyle,+ IUniverInstanceService,Nullable,ObjectMatrix,ObjectMatrixPrimitiveType,@@ -31,9 +31,9 @@ export const SetBorderStylesUndoMutationFactory = (accessor: IAccessor,params: ISetBorderStylesMutationParams): ISetBorderStylesMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();- const worksheet = currentUniverService+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getSheetBySheetId(params.worksheetId);@@ -58,8 +58,8 @@ export const SetBorderStylesMutation: IMutation<ISetBorderStylesMutationParams,id: 'sheet.mutation.set-border-styles',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getUniverSheetInstance(params.workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(params.worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/mutations/set-col-visible.mutation.ts b/packages/base-sheets/src/commands/mutations/set-col-visible.mutation.tsindex a39fc5dcd9..fb78d477ea 100644--- a/packages/base-sheets/src/commands/mutations/set-col-visible.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-col-visible.mutation.ts@@ -1,4 +1,4 @@-import { BooleanNumber, CommandType, ICurrentUniverService, IMutation, IRange } from '@univerjs/core';+import { BooleanNumber, CommandType, IMutation, IRange, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetColHiddenMutationParams {@@ -8,8 +8,8 @@ export interface ISetColHiddenMutationParams {}export const SetColHiddenUndoMutationFactory = (accessor: IAccessor, params: ISetColHiddenMutationParams) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -26,8 +26,8 @@ export const SetColHiddenMutation: IMutation<ISetColHiddenMutationParams> = {id: 'sheet.mutation.set-col-hidden',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (!universheet) {return false;@@ -55,8 +55,8 @@ export interface ISetColVisibleMutationParams {}export const SetColVisibleUndoMutationFactory = (accessor: IAccessor, params: ISetColVisibleMutationParams) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -73,8 +73,8 @@ export const SetColVisibleMutation: IMutation<ISetColVisibleMutationParams> = {id: 'sheet.mutation.set-col-visible',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (!universheet) {return false;diff --git a/packages/base-sheets/src/commands/mutations/set-frozen.mutation.ts b/packages/base-sheets/src/commands/mutations/set-frozen.mutation.tsindex 637e7bdb80..f8193ed1ad 100644--- a/packages/base-sheets/src/commands/mutations/set-frozen.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-frozen.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetFrozenMutationParams {@@ -14,8 +14,8 @@ export const SetFrozenMutationFactory = (accessor: IAccessor,params: ISetFrozenMutationParams): ISetFrozenMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -39,8 +39,8 @@ export const SetFrozenMutation: IMutation<ISetFrozenMutationParams> = {id: 'sheet.mutation.set-frozen',type: CommandType.MUTATION,handler: async (accessor: IAccessor, params: ISetFrozenMutationParams) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');diff --git a/packages/base-sheets/src/commands/mutations/set-hide-gridlines.mutatiom.ts b/packages/base-sheets/src/commands/mutations/set-hide-gridlines.mutatiom.tsindex 7ae99bdcc3..d09c324691 100644--- a/packages/base-sheets/src/commands/mutations/set-hide-gridlines.mutatiom.ts+++ b/packages/base-sheets/src/commands/mutations/set-hide-gridlines.mutatiom.ts@@ -1,4 +1,4 @@-import { BooleanNumber, CommandType, ICurrentUniverService, IMutation, Tools } from '@univerjs/core';+import { BooleanNumber, CommandType, IMutation, IUniverInstanceService, Tools } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetHideGridlinesMutationParams {@@ -11,7 +11,7 @@ export const SetHideGridlinesUndoMutationFactory = (accessor: IAccessor,params: ISetHideGridlinesMutationParams): ISetHideGridlinesMutationParams => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);const worksheet = workbook!.getSheetBySheetId(params.worksheetId);const config = worksheet!.getConfig();@@ -27,7 +27,7 @@ export const SetHideGridlinesMutation: IMutation<ISetHideGridlinesMutationParamsid: 'sheet.mutation.set-hide-gridlines',type: CommandType.MUTATION,handler: async (accessor, params) => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(params.worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/mutations/set-range-formatted-value.mutation.ts b/packages/base-sheets/src/commands/mutations/set-range-formatted-value.mutation.tsindex 528f75c2cb..2520404d20 100644--- a/packages/base-sheets/src/commands/mutations/set-range-formatted-value.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-range-formatted-value.mutation.ts@@ -2,9 +2,9 @@ import {CommandType,ICellData,ICellV,- ICurrentUniverService,IMutation,IRange,+ IUniverInstanceService,Nullable,ObjectMatrix,ObjectMatrixPrimitiveType,@@ -30,8 +30,8 @@ export const SetRangeFormattedValueUndoMutationFactory = (accessor: IAccessor,params: ISetRangeFormattedValueMutationParams): ISetRangeFormattedValueMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const worksheet = currentUniverService+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getSheetBySheetId(params.worksheetId);@@ -58,8 +58,8 @@ export const SetRangeFormattedValueMutation: IMutation<ISetRangeFormattedValueMuid: 'sheet.mutation.set-range-formatted-value',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getUniverSheetInstance(params.workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(params.worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/mutations/set-range-styles.mutation.ts b/packages/base-sheets/src/commands/mutations/set-range-styles.mutation.tsindex 4bdade4341..0fa4a68525 100644--- a/packages/base-sheets/src/commands/mutations/set-range-styles.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-range-styles.mutation.ts@@ -1,13 +1,13 @@import {CommandType,IBorderData,- ICurrentUniverService,IDocumentData,IKeyValue,IMutation,IRange,IStyleData,ITextStyle,+ IUniverInstanceService,Nullable,ObjectMatrix,ObjectMatrixPrimitiveType,@@ -34,9 +34,9 @@ export const SetRangeStyleUndoMutationFactory = (accessor: IAccessor,params: ISetRangeStyleMutationParams): ISetRangeStyleMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();- const worksheet = currentUniverService+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getSheetBySheetId(params.worksheetId);@@ -77,8 +77,8 @@ export const SetRangeStyleMutation: IMutation<ISetRangeStyleMutationParams, boolid: 'sheet.mutation.set-range-style',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getUniverSheetInstance(params.workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(params.worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/mutations/set-range-values.mutation.ts b/packages/base-sheets/src/commands/mutations/set-range-values.mutation.tsindex 8aefeac030..862a84644b 100644--- a/packages/base-sheets/src/commands/mutations/set-range-values.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-range-values.mutation.ts@@ -2,10 +2,10 @@ import {CommandType,ICellData,ICopyToOptionsData,- ICurrentUniverService,IMutation,IRange,IStyleData,+ IUniverInstanceService,Nullable,ObjectMatrix,ObjectMatrixPrimitiveType,@@ -44,8 +44,8 @@ export const SetRangeValuesUndoMutationFactory = (params: ISetRangeValuesMutationParams): ISetRangeValuesMutationParams => {const { workbookId, worksheetId, cellValue } = params;- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(workbookId);if (universheet == null) {throw new Error('universheet is null error!');}@@ -125,8 +125,8 @@ export const SetRangeValuesMutation: IMutation<ISetRangeValuesMutationParams, boid: 'sheet.mutation.set-range-values',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const worksheet = workbook.getSheetBySheetId(params.worksheetId);if (!worksheet) {return false;diff --git a/packages/base-sheets/src/commands/mutations/set-row-visible.mutation.ts b/packages/base-sheets/src/commands/mutations/set-row-visible.mutation.tsindex 146a5de18a..47e18ec49f 100644--- a/packages/base-sheets/src/commands/mutations/set-row-visible.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-row-visible.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation, IRange } from '@univerjs/core';+import { CommandType, IMutation, IRange, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetRowVisibleMutationParams {@@ -8,8 +8,8 @@ export interface ISetRowVisibleMutationParams {}export const SetRowVisibleUndoMutationFactory = (accessor: IAccessor, params: ISetRowVisibleMutationParams) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -26,8 +26,8 @@ export const SetRowVisibleMutation: IMutation<ISetRowVisibleMutationParams> = {id: 'sheet.mutation.set-row-visible',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -55,8 +55,8 @@ export interface ISetRowHiddenMutationParams {}export const SetRowHiddenUndoMutationFactory = (accessor: IAccessor, params: ISetRowHiddenMutationParams) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -73,8 +73,8 @@ export const SetRowHiddenMutation: IMutation<ISetRowHiddenMutationParams> = {id: 'sheet.mutation.set-row-hidden',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');diff --git a/packages/base-sheets/src/commands/mutations/set-tab-color.mutation.ts b/packages/base-sheets/src/commands/mutations/set-tab-color.mutation.tsindex c4f6e1e0a4..721de9ebbd 100644--- a/packages/base-sheets/src/commands/mutations/set-tab-color.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-tab-color.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation, Tools } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService, Tools } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetTabColorMutationParams {@@ -11,7 +11,7 @@ export const SetTabColorUndoMutationFactory = (accessor: IAccessor,params: ISetTabColorMutationParams): ISetTabColorMutationParams => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);const worksheet = workbook!.getSheetBySheetId(params.worksheetId);const config = worksheet!.getConfig();@@ -27,7 +27,7 @@ export const SetTabColorMutation: IMutation<ISetTabColorMutationParams> = {id: 'sheet.mutation.set-tab-color',type: CommandType.MUTATION,handler: async (accessor, params) => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(params.worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/mutations/set-worksheet-activate.mutation.ts b/packages/base-sheets/src/commands/mutations/set-worksheet-activate.mutation.tsindex d72e9da142..f34dec83a0 100644--- a/packages/base-sheets/src/commands/mutations/set-worksheet-activate.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-worksheet-activate.mutation.ts@@ -1,4 +1,4 @@-import { BooleanNumber, CommandType, ICurrentUniverService, IMutation, Nullable, Worksheet } from '@univerjs/core';+import { BooleanNumber, CommandType, IMutation, IUniverInstanceService, Nullable, Worksheet } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetWorksheetActivateMutationParams {@@ -10,7 +10,7 @@ export const SetWorksheetUnActivateMutationFactory = (accessor: IAccessor,params: ISetWorksheetActivateMutationParams): ISetWorksheetActivateMutationParams => {- const universheet = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const universheet = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -40,7 +40,7 @@ export const SetWorksheetActivateMutation: IMutation<ISetWorksheetActivateMutatiid: 'sheet.mutation.set-worksheet-activate',type: CommandType.MUTATION,handler: async (accessor, params) => {- const universheet = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const universheet = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);if (!universheet) return false;diff --git a/packages/base-sheets/src/commands/mutations/set-worksheet-col-width.mutation.ts b/packages/base-sheets/src/commands/mutations/set-worksheet-col-width.mutation.tsindex 4e8c8c12c6..b9431333e1 100644--- a/packages/base-sheets/src/commands/mutations/set-worksheet-col-width.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-worksheet-col-width.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation, IRange, ObjectArray } from '@univerjs/core';+import { CommandType, IMutation, IRange, IUniverInstanceService, ObjectArray } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetWorksheetColWidthMutationParams {@@ -12,8 +12,8 @@ export const SetWorksheetColWidthMutationFactory = (accessor: IAccessor,params: ISetWorksheetColWidthMutationParams): ISetWorksheetColWidthMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -46,8 +46,8 @@ export const SetWorksheetColWidthMutation: IMutation<ISetWorksheetColWidthMutatiid: 'sheet.mutation.set-worksheet-col-width',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');diff --git a/packages/base-sheets/src/commands/mutations/set-worksheet-config.mutation.ts b/packages/base-sheets/src/commands/mutations/set-worksheet-config.mutation.tsindex f6ae9022aa..bc7fd32a37 100644--- a/packages/base-sheets/src/commands/mutations/set-worksheet-config.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-worksheet-config.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation, IWorksheetConfig, Tools } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService, IWorksheetConfig, Tools } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';/** @deprecated */@@ -13,7 +13,7 @@ export const SetWorksheetConfigUndoMutationFactory = (accessor: IAccessor,params: ISetWorksheetConfigMutationParams): ISetWorksheetConfigMutationParams => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);const worksheet = workbook!.getSheetBySheetId(params.worksheetId)!;const config = Tools.deepClone(worksheet.getConfig());@@ -29,7 +29,7 @@ export const SetWorksheetConfigMutation: IMutation<ISetWorksheetConfigMutationPaid: 'sheet.mutation.set-worksheet-config',type: CommandType.MUTATION,handler: async (accessor, params) => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(params.worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/mutations/set-worksheet-hide.mutation.ts b/packages/base-sheets/src/commands/mutations/set-worksheet-hide.mutation.tsindex 48c560e698..d338110f69 100644--- a/packages/base-sheets/src/commands/mutations/set-worksheet-hide.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-worksheet-hide.mutation.ts@@ -1,4 +1,4 @@-import { BooleanNumber, CommandType, ICurrentUniverService, IMutation } from '@univerjs/core';+import { BooleanNumber, CommandType, IMutation, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetWorksheetHideMutationParams {@@ -11,7 +11,7 @@ export const SetWorksheetHideMutationFactory = (accessor: IAccessor,params: ISetWorksheetHideMutationParams): ISetWorksheetHideMutationParams => {- const universheet = accessor.get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const universheet = accessor.get(IUniverInstanceService).getCurrentUniverSheetInstance();const worksheet = universheet.getSheetBySheetId(params.worksheetId);if (worksheet == null) {throw new Error('worksheet is null error!');@@ -27,7 +27,7 @@ export const SetWorksheetHideMutation: IMutation<ISetWorksheetHideMutationParamsid: 'sheet.mutation.set-worksheet-hidden',type: CommandType.MUTATION,handler: async (accessor, params) => {- const universheet = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const universheet = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);if (universheet == null) {return false;diff --git a/packages/base-sheets/src/commands/mutations/set-worksheet-name.mutation.ts b/packages/base-sheets/src/commands/mutations/set-worksheet-name.mutation.tsindex 41d4df0d19..a98bac189d 100644--- a/packages/base-sheets/src/commands/mutations/set-worksheet-name.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-worksheet-name.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetWorksheetNameMutationParams {@@ -11,7 +11,7 @@ export const SetWorksheetNameMutationFactory = (accessor: IAccessor,params: ISetWorksheetNameMutationParams): ISetWorksheetNameMutationParams => {- const universheet = accessor.get(ICurrentUniverService).getCurrentUniverSheetInstance();+ const universheet = accessor.get(IUniverInstanceService).getCurrentUniverSheetInstance();const worksheet = universheet.getSheetBySheetId(params.worksheetId);if (worksheet == null) {throw new Error('worksheet is null error!');@@ -27,7 +27,7 @@ export const SetWorksheetNameMutation: IMutation<ISetWorksheetNameMutationParamsid: 'sheet.mutation.set-worksheet-name',type: CommandType.MUTATION,handler: async (accessor, params) => {- const universheet = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const universheet = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);if (universheet == null) {return false;diff --git a/packages/base-sheets/src/commands/mutations/set-worksheet-order.mutation.ts b/packages/base-sheets/src/commands/mutations/set-worksheet-order.mutation.tsindex 7a2c6c746e..3da2ed484d 100644--- a/packages/base-sheets/src/commands/mutations/set-worksheet-order.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-worksheet-order.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation, Tools } from '@univerjs/core';+import { CommandType, IMutation, IUniverInstanceService, Tools } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetWorksheetOrderMutationParams {@@ -11,7 +11,7 @@ export const SetWorksheetOrderUndoMutationFactory = (accessor: IAccessor,params: ISetWorksheetOrderMutationParams): ISetWorksheetOrderMutationParams => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);const config = workbook!.getConfig();const oldIndex = config.sheetOrder.findIndex((current: string) => current === params.worksheetId);return {@@ -24,7 +24,7 @@ export const SetWorksheetOrderMutation: IMutation<ISetWorksheetOrderMutationParaid: 'sheet.mutation.set-worksheet-order',type: CommandType.MUTATION,handler: async (accessor, params) => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);if (!workbook) return false;const config = workbook.getConfig();const exclude = config.sheetOrder.filter((currentId: string) => currentId !== params.worksheetId);diff --git a/packages/base-sheets/src/commands/mutations/set-worksheet-right-to-left.mutation.ts b/packages/base-sheets/src/commands/mutations/set-worksheet-right-to-left.mutation.tsindex f2364739d7..5d7966c106 100644--- a/packages/base-sheets/src/commands/mutations/set-worksheet-right-to-left.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-worksheet-right-to-left.mutation.ts@@ -1,4 +1,4 @@-import { BooleanNumber, CommandType, ICurrentUniverService, IMutation, Tools } from '@univerjs/core';+import { BooleanNumber, CommandType, IMutation, IUniverInstanceService, Tools } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetWorksheetRightToLeftMutationParams {@@ -11,7 +11,7 @@ export const SetWorksheetRightToLeftUndoMutationFactory = (accessor: IAccessor,params: ISetWorksheetRightToLeftMutationParams): ISetWorksheetRightToLeftMutationParams => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);const worksheet = workbook!.getSheetBySheetId(params.worksheetId);const config = worksheet!.getConfig();@@ -27,7 +27,7 @@ export const SetWorksheetRightToLeftMutation: IMutation<ISetWorksheetRightToLeftid: 'sheet.mutation.set-worksheet-right-to-left',type: CommandType.MUTATION,handler: async (accessor, params) => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);if (!workbook) return false;const worksheet = workbook.getSheetBySheetId(params.worksheetId);if (!worksheet) return false;diff --git a/packages/base-sheets/src/commands/mutations/set-worksheet-row-height.mutation.ts b/packages/base-sheets/src/commands/mutations/set-worksheet-row-height.mutation.tsindex a5cc991fc6..97003caffb 100644--- a/packages/base-sheets/src/commands/mutations/set-worksheet-row-height.mutation.ts+++ b/packages/base-sheets/src/commands/mutations/set-worksheet-row-height.mutation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IMutation, IRange, ObjectArray } from '@univerjs/core';+import { CommandType, IMutation, IRange, IUniverInstanceService, ObjectArray } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetWorksheetRowHeightMutationParams {@@ -12,8 +12,8 @@ export const SetWorksheetRowHeightMutationFactory = (accessor: IAccessor,params: ISetWorksheetRowHeightMutationParams): ISetWorksheetRowHeightMutationParams => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');@@ -46,8 +46,8 @@ export const SetWorksheetRowHeightMutation: IMutation<ISetWorksheetRowHeightMutaid: 'sheet.mutation.set-worksheet-row-height',type: CommandType.MUTATION,handler: async (accessor, params) => {- const currentUniverService = accessor.get(ICurrentUniverService);- const universheet = currentUniverService.getUniverSheetInstance(params.workbookId);+ const univerInstanceService = accessor.get(IUniverInstanceService);+ const universheet = univerInstanceService.getUniverSheetInstance(params.workbookId);if (universheet == null) {throw new Error('universheet is null error!');diff --git a/packages/base-sheets/src/commands/operations/set-zoom-ratio.operation.ts b/packages/base-sheets/src/commands/operations/set-zoom-ratio.operation.tsindex 601feacca4..fdd78324e9 100644--- a/packages/base-sheets/src/commands/operations/set-zoom-ratio.operation.ts+++ b/packages/base-sheets/src/commands/operations/set-zoom-ratio.operation.ts@@ -1,4 +1,4 @@-import { CommandType, ICurrentUniverService, IOperation, Tools } from '@univerjs/core';+import { CommandType, IOperation, IUniverInstanceService, Tools } from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';export interface ISetZoomRatioOperationParams {@@ -11,7 +11,7 @@ export const SetZoomRatioUndoMutationFactory = (accessor: IAccessor,params: ISetZoomRatioOperationParams): ISetZoomRatioOperationParams => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);const worksheet = workbook!.getSheetBySheetId(params.worksheetId);const old = worksheet!.getConfig().zoomRatio;return {@@ -24,7 +24,7 @@ export const SetZoomRatioOperation: IOperation<ISetZoomRatioOperationParams> = {id: 'sheet.operation.set-zoom-ratio',type: CommandType.OPERATION,handler: async (accessor, params: ISetZoomRatioOperationParams) => {- const workbook = accessor.get(ICurrentUniverService).getUniverSheetInstance(params.workbookId);+ const workbook = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.workbookId);if (!workbook) {return false;}diff --git a/packages/base-sheets/src/services/sheet-skeleton-manager.service.ts b/packages/base-sheets/src/services/sheet-skeleton-manager.service.tsindex 912f16c949..843c4b3767 100644--- a/packages/base-sheets/src/services/sheet-skeleton-manager.service.ts+++ b/packages/base-sheets/src/services/sheet-skeleton-manager.service.ts@@ -1,5 +1,5 @@import { SpreadsheetSkeleton } from '@univerjs/base-render';-import { ICurrentUniverService, LocaleService, Nullable, Workbook, Worksheet } from '@univerjs/core';+import { IUniverInstanceService, LocaleService, Nullable, Workbook, Worksheet } from '@univerjs/core';import { IDisposable, Inject } from '@wendellhu/redi';import { BehaviorSubject } from 'rxjs';@@ -38,7 +38,7 @@ export class SheetSkeletonManagerService implements IDisposable {readonly currentSkeletonBefore$ = this._currentSkeletonBefore$.asObservable();constructor(- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(LocaleService) private readonly _localeService: LocaleService) {}diff --git a/packages/base-slides/src/SlidePlugin.ts b/packages/base-slides/src/SlidePlugin.tsindex 2d45f63de3..c3c1e7c80e 100644--- a/packages/base-slides/src/SlidePlugin.ts+++ b/packages/base-slides/src/SlidePlugin.ts@@ -1,5 +1,5 @@import { Engine, IRenderingEngine } from '@univerjs/base-render';-import { ICurrentUniverService, ILanguagePack, LocaleService, Plugin, PLUGIN_NAMES, PluginType } from '@univerjs/core';+import { ILanguagePack, IUniverInstanceService, LocaleService, Plugin, PLUGIN_NAMES, PluginType } from '@univerjs/core';import { Dependency, Inject, Injector } from '@wendellhu/redi';import { en } from './Locale';@@ -20,7 +20,7 @@ export class SlidePlugin extends Plugin {constructor(config: Partial<ISlidePluginConfig> = {},- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(LocaleService) private readonly _localeService: LocaleService,@Inject(Injector) override readonly _injector: Injector) {diff --git a/packages/base-slides/src/View/Render/CanvasView.ts b/packages/base-slides/src/View/Render/CanvasView.tsindex 99dd88ffbc..4474d0c082 100644--- a/packages/base-slides/src/View/Render/CanvasView.ts+++ b/packages/base-slides/src/View/Render/CanvasView.ts@@ -11,7 +11,7 @@ import {Slide,Viewport,} from '@univerjs/base-render';-import { EventState, getColorStyle, IColorStyle, ICurrentUniverService, ISlidePage, Nullable } from '@univerjs/core';+import { EventState, getColorStyle, IColorStyle, ISlidePage, IUniverInstanceService, Nullable } from '@univerjs/core';import { Inject, Injector } from '@wendellhu/redi';import { ObjectProvider } from './ObjectProvider';@@ -34,7 +34,7 @@ export class CanvasView {private _activePageId: string = '';constructor(- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(Injector) private readonly _injector: Injector,@IRenderingEngine private readonly _engine: Engine,@IRenderManagerService private readonly _rms: RenderManagerServicediff --git a/packages/base-ui/src/base-ui-plugin.ts b/packages/base-ui/src/base-ui-plugin.tsindex aa4178c4ef..210bb203e7 100644--- a/packages/base-ui/src/base-ui-plugin.ts+++ b/packages/base-ui/src/base-ui-plugin.ts@@ -8,6 +8,7 @@ import { IUIController, IWorkbenchOptions } from './controllers/ui/ui.controllerimport { DesktopUIController } from './controllers/ui/ui-desktop.controller';import { BrowserClipboardService, IClipboardInterfaceService } from './services/clipboard/clipboard-interface.service';import { DesktopContextMenuService, IContextMenuService } from './services/contextmenu/contextmenu.service';+import { DesktopFocusService, IFocusService } from './services/focus/focus.service';import { DesktopLocalStorageService } from './services/local-storage/local-storage.service';import { DesktopMenuService, IMenuService } from './services/menu/menu.service';import { DesktopMessageService } from './services/message/desktop-message.service';@@ -52,7 +53,6 @@ export class UIPlugin extends Plugin {// legacy managers - deprecated[ComponentManager],[ZIndexManager],-// services[IShortcutService, { useClass: DesktopShortcutService }],[IPlatformService, { useClass: DesktopPlatformService }],@@ -62,8 +62,8 @@ export class UIPlugin extends Plugin {[INotificationService, { useClass: DesktopNotificationService, lazy: true }],[IMessageService, { useClass: DesktopMessageService, lazy: true }],[ILocalStorageService, { useClass: DesktopLocalStorageService, lazy: true }],-// controllers+ [IFocusService, { useClass: DesktopFocusService }],[SharedController],[IUIController, { useClass: DesktopUIController }],];diff --git a/packages/base-ui/src/controllers/ui/ui-desktop.controller.tsx b/packages/base-ui/src/controllers/ui/ui-desktop.controller.tsxindex a1f5626047..89f00a866a 100644--- a/packages/base-ui/src/controllers/ui/ui-desktop.controller.tsx+++ b/packages/base-ui/src/controllers/ui/ui-desktop.controller.tsx@@ -1,11 +1,12 @@import { IRenderManagerService } from '@univerjs/base-render';-import { Disposable, ICurrentUniverService, LifecycleService, LifecycleStages, toDisposable } from '@univerjs/core';+import { Disposable, LifecycleService, LifecycleStages, toDisposable } from '@univerjs/core';import { IDisposable, Inject, Injector } from '@wendellhu/redi';import { connectInjector } from '@wendellhu/redi/react-bindings';import React, { ComponentType } from 'react';import { createRoot } from 'react-dom/client';import { Observable, Subject } from 'rxjs';+import { IFocusService } from '../../services/focus/focus.service';import { App } from '../../views/app';import { IUIController, IWorkbenchOptions } from './ui.controller';@@ -51,18 +52,18 @@ export class DesktopUIController extends Disposable implements IDesktopUIControlconstructor(@Inject(Injector) private readonly _injector: Injector,@Inject(LifecycleService) private readonly _lifecycleService: LifecycleService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,- @IRenderManagerService private readonly _renderManagerService: IRenderManagerService+ @IRenderManagerService private readonly _renderManagerService: IRenderManagerService,+ @IFocusService private readonly _focusService: IFocusService) {super();}bootstrapWorkbench(options: IWorkbenchOptions): void {this.disposeWithMe(- bootStrap(this._injector, options, (element) => {- // this._renderManagerService.defaultEngine.setContainer(element);- this._initializeEngine(element);+ bootStrap(this._injector, options, (canvasElement, containerElement) => {+ this._initializeEngine(canvasElement);this._lifecycleService.stage = LifecycleStages.Rendered;+ this._focusService.setContainerElement(containerElement);setTimeout(() => (this._lifecycleService.stage = LifecycleStages.Steady), STEADY_TIMEOUT);})@@ -118,7 +119,7 @@ export class DesktopUIController extends Disposable implements IDesktopUIControlfunction bootStrap(injector: Injector,options: IWorkbenchOptions,- callback: (containerEl: HTMLElement) => void+ callback: (canvasEl: HTMLElement, containerElement: HTMLElement) => void): IDisposable {let mountContainer: HTMLElement;@@ -143,12 +144,13 @@ function bootStrap(const contentComponents = desktopUIController.getContentComponents();const footerComponents = desktopUIController.getFooterComponents();const sidebarComponents = desktopUIController.getSidebarComponents();+ const onRendered = (canvasElement: HTMLElement) => callback(canvasElement, mountContainer);root.render(<ConnectedApp{...options}- onRendered={callback}headerComponents={headerComponents}contentComponents={contentComponents}+ onRendered={onRendered}footerComponents={footerComponents}sidebarComponents={sidebarComponents}/>@@ -166,7 +168,7 @@ function bootStrap(contentComponents={contentComponents}footerComponents={footerComponents}sidebarComponents={sidebarComponents}- onRendered={callback}+ onRendered={onRendered}/>);});diff --git a/packages/base-ui/src/services/focus/focus.service.ts b/packages/base-ui/src/services/focus/focus.service.tsnew file mode 100644index 0000000000..8c3056c7a2--- /dev/null+++ b/packages/base-ui/src/services/focus/focus.service.ts@@ -0,0 +1,69 @@+import { Disposable, IContextService, LifecycleStages, OnLifecycle, toDisposable } from '@univerjs/core';+import { ContextService } from '@univerjs/core/services/context/context.service.js';+import { createIdentifier } from '@wendellhu/redi';+import { fromEvent } from 'rxjs';+import { Nullable } from 'vitest';++/**+ * FocusService manages focusing state of the Univer application instance.+ */+export const IFocusService = createIdentifier<IFocusService>('univer.focus-service');++export interface IFocusService {+ readonly isFocused: boolean;+ setContainerElement(container: HTMLElement): void;+}++export const FOCUSING_UNIVER = 'FOCUSING_UNIVER';++@OnLifecycle(LifecycleStages.Ready, IFocusService)+export class DesktopFocusService extends Disposable implements IFocusService {+ private _containerElement: Nullable<HTMLElement> = null;++ private _isUniverFocused = true;++ get isFocused(): boolean {+ return this._isUniverFocused;+ }++ constructor(@IContextService private readonly _contextService: ContextService) {+ super();++ this._initFocusListener();+ // TODO: we may call context service to set context values+ }++ override dispose(): void {+ super.dispose();++ this._containerElement = null;+ }++ setContainerElement(container: HTMLElement): void {+ this._containerElement = container;+ }++ private _initFocusListener(): void {+ this.disposeWithMe(+ toDisposable(+ fromEvent(window, 'focusin').subscribe((event) => {+ if (event.target && this._containerElement?.contains(event.target as Node)) {+ this._isUniverFocused = true;+ } else {+ this._isUniverFocused = false;+ }++ this._contextService.setContextValue(FOCUSING_UNIVER, this._isUniverFocused);+ })+ )+ );++ // this.disposeWithMe(+ // toDisposable(+ // fromEvent(window, 'focusout').subscribe((element) => {+ // console.log('focusing out element', element.target);+ // })+ // )+ // );+ }+}diff --git a/packages/base-ui/src/services/shortcut/shortcut.service.ts b/packages/base-ui/src/services/shortcut/shortcut.service.tsindex c004e00966..5b16596944 100644--- a/packages/base-ui/src/services/shortcut/shortcut.service.ts+++ b/packages/base-ui/src/services/shortcut/shortcut.service.ts@@ -2,6 +2,7 @@ import { Disposable, ICommandService, IContextService, toDisposable } from '@uniimport { createIdentifier, IDisposable } from '@wendellhu/redi';import { fromDocumentEvent } from '../../Common/lifecycle';+import { IFocusService } from '../focus/focus.service';import { IPlatformService } from '../platform/platform.service';import { MetaKeys } from './keycode';@@ -41,13 +42,16 @@ export class DesktopShortcutService extends Disposable implements IShortcutServiconstructor(@ICommandService private readonly _commandService: ICommandService,@IPlatformService private readonly _platformService: IPlatformService,- @IContextService private readonly _contextService: IContextService+ @IContextService private readonly _contextService: IContextService,+ @IFocusService private readonly _focusService: IFocusService) {super();this.disposeWithMe(fromDocumentEvent('keydown', (e: KeyboardEvent) => {- this.resolveMouseEvent(e);+ if (this._focusService.isFocused) {+ this.resolveMouseEvent(e);+ }}));}diff --git a/packages/core/src/Basics/Univer.ts b/packages/core/src/Basics/Univer.tsindex f72a9a0b52..601fe9162f 100644--- a/packages/core/src/Basics/Univer.ts+++ b/packages/core/src/Basics/Univer.ts@@ -6,7 +6,7 @@ import { Plugin, PluginCtor, PluginRegistry, PluginStore, PluginType } from '../import { CommandService, ICommandService } from '../services/command/command.service';import { ConfigService, IConfigService } from '../services/config/config.service';import { ContextService, IContextService } from '../services/context/context.service';-import { CurrentUniverService, ICurrentUniverService } from '../services/current.service';+import { IUniverInstanceService, UniverInstanceService } from '../services/current.service';import { LifecycleStages } from '../services/lifecycle/lifecycle';import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';import { LocaleService } from '../services/locale/locale.service';@@ -53,8 +53,8 @@ export class Univer {// TODO@wzhudev: dispose all the businesses}- private get _currentUniverService(): ICurrentUniverService {- return this._rootInjector.get(ICurrentUniverService);+ private get _currentUniverService(): IUniverInstanceService {+ return this._rootInjector.get(IUniverInstanceService);}/** Register a plugin into univer. */@@ -159,10 +159,10 @@ export class Univer {private _initDependencies(): Injector {return new Injector([[- ICurrentUniverService,+ IUniverInstanceService,{useFactory: (contextService: IContextService) =>- new CurrentUniverService(+ new UniverInstanceService({createUniverDoc: (data) => this.createUniverDoc(data),createUniverSheet: (data) => this.createUniverSheet(data),diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex 43735d17a6..cdfc5b7286 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -18,7 +18,7 @@ export {export { IConfigService } from './services/config/config.service';export { FOCUSING_DOC, FOCUSING_SHEET, FOCUSING_SLIDE } from './services/context/context';export { IContextService } from './services/context/context.service';-export { ICurrentUniverService } from './services/current.service';+export { IUniverInstanceService } from './services/current.service';export { LifecycleStages, OnLifecycle } from './services/lifecycle/lifecycle';export { LifecycleService } from './services/lifecycle/lifecycle.service';export { ILocalStorageService } from './services/local-storage/local-storage.service';diff --git a/packages/core/src/services/current.service.ts b/packages/core/src/services/current.service.tsindex 843bd30557..08c590a16a 100644--- a/packages/core/src/services/current.service.ts+++ b/packages/core/src/services/current.service.ts@@ -16,10 +16,10 @@ export interface IUniverHandler {}/**- * ICurrentUniverService holds all the current univer instances. And it also manages+ * IUniverInstanceService holds all the current univer instances. And it also manages* the focused univer instance.*/-export interface ICurrentUniverService {+export interface IUniverInstanceService {focused$: Observable<Nullable<string>>;currentSheet$: Observable<Nullable<Workbook>>;@@ -59,9 +59,9 @@ export interface ICurrentUniverService {getAllUniverSlidesInstance(): Slide[];}-export const ICurrentUniverService = createIdentifier<ICurrentUniverService>('univer.current');+export const IUniverInstanceService = createIdentifier<IUniverInstanceService>('univer.current');-export class CurrentUniverService extends Disposable implements ICurrentUniverService {+export class UniverInstanceService extends Disposable implements IUniverInstanceService {private readonly _focused$ = new BehaviorSubject<Nullable<string>>(null);private _focused: DocumentModel | Workbook | Slide | null = null;readonly focused$ = this._focused$.asObservable();diff --git a/packages/core/src/services/sheet-interceptor/__tests__/create-core-test-bed.ts b/packages/core/src/services/sheet-interceptor/__tests__/create-core-test-bed.tsindex cf29eda90e..1f5495330a 100644--- a/packages/core/src/services/sheet-interceptor/__tests__/create-core-test-bed.ts+++ b/packages/core/src/services/sheet-interceptor/__tests__/create-core-test-bed.ts@@ -4,7 +4,7 @@ import { Univer } from '../../../Basics/Univer';import { Plugin, PluginType } from '../../../plugin/plugin';import { LocaleType } from '../../../Types/Enum/LocaleType';import { IWorkbookConfig } from '../../../Types/Interfaces/IWorkbookData';-import { ICurrentUniverService } from '../../current.service';+import { IUniverInstanceService } from '../../current.service';import { ILogService } from '../../log/log.service';const TEST_WORKBOOK_DATA: IWorkbookConfig = {@@ -67,8 +67,8 @@ export function createCoreTestBed(workbookConfig?: IWorkbookConfig, dependenciesthrow new Error('[TestPlugin]: not hooked on!');}- const currentUniverService = get(ICurrentUniverService);- currentUniverService.focusUniverInstance('test');+ const univerInstanceService = get(IUniverInstanceService);+ univerInstanceService.focusUniverInstance('test');const logService = get(ILogService);logService.toggleLogEnabled(false);diff --git a/packages/core/src/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.ts b/packages/core/src/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.tsindex 30adbba865..ebdc08cfb9 100644--- a/packages/core/src/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.ts+++ b/packages/core/src/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.ts@@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest';import { Univer } from '../../../Basics/Univer';import { Nullable } from '../../../common/type-utils';import { ICellData } from '../../../Types/Interfaces/ICellData';-import { ICurrentUniverService } from '../../current.service';+import { IUniverInstanceService } from '../../current.service';import { SheetInterceptorService } from '../sheet-interceptor.service';import { createCoreTestBed } from './create-core-test-bed';@@ -21,7 +21,7 @@ describe('Test SheetInterceptorService', () => {afterEach(() => univer.dispose());function getCell(row: number, col: number): Nullable<ICellData> {- const cus = get(ICurrentUniverService);+ const cus = get(IUniverInstanceService);const sheet = cus.getCurrentUniverSheetInstance().getActiveSheet()!;return sheet.getCell(row, col);}diff --git a/packages/core/src/services/sheet-interceptor/sheet-interceptor.service.ts b/packages/core/src/services/sheet-interceptor/sheet-interceptor.service.tsindex 9d93a22a37..a53f6c3635 100644--- a/packages/core/src/services/sheet-interceptor/sheet-interceptor.service.ts+++ b/packages/core/src/services/sheet-interceptor/sheet-interceptor.service.ts@@ -7,7 +7,7 @@ import { Workbook } from '../../sheets/workbook';import { Worksheet } from '../../sheets/worksheet';import { ICellData } from '../../Types/Interfaces/ICellData';import { ICommandInfo } from '../command/command.service';-import { ICurrentUniverService } from '../current.service';+import { IUniverInstanceService } from '../current.service';import { LifecycleStages, OnLifecycle } from '../lifecycle/lifecycle';import { IUndoRedoCommandInfos } from '../undoredo/undoredo.service';@@ -75,7 +75,7 @@ export class SheetInterceptorService extends Disposable {private readonly _workbookDisposables = new Map<string, IDisposable>();private readonly _worksheetDisposables = new Map<string, IDisposable>();- constructor(@ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService) {+ constructor(@IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService) {super();// When a workbook is created or a worksheet is added after when workbook is created,diff --git a/packages/core/src/services/undoredo/undoredo.service.ts b/packages/core/src/services/undoredo/undoredo.service.tsindex 7a15805a4e..1f5c461242 100644--- a/packages/core/src/services/undoredo/undoredo.service.ts+++ b/packages/core/src/services/undoredo/undoredo.service.ts@@ -3,7 +3,7 @@ import { BehaviorSubject, Observable } from 'rxjs';import { Disposable, toDisposable } from '../../Shared/lifecycle';import { CommandService, CommandType, ICommand, ICommandInfo, ICommandService } from '../command/command.service';-import { ICurrentUniverService } from '../current.service';+import { IUniverInstanceService } from '../current.service';// TODO:: an undo redo element may be mergeable to another undo redo element@@ -57,7 +57,7 @@ export class LocalUndoRedoService extends Disposable implements IUndoRedoServiceprivate readonly _redoStacks = new Map<string, IUndoRedoItem[]>();constructor(- @ICurrentUniverService private readonly _currentUniverSheet: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverSheet: IUniverInstanceService,@ICommandService private readonly _commandService: CommandService) {super();diff --git a/packages/sheets-plugin-find/src/Domain/TextFind.ts b/packages/sheets-plugin-find/src/Domain/TextFind.tsindex 50d778e102..02f3f69c6a 100644--- a/packages/sheets-plugin-find/src/Domain/TextFind.ts+++ b/packages/sheets-plugin-find/src/Domain/TextFind.ts@@ -3,8 +3,8 @@ import { SelectionManagerService } from '@univerjs/base-sheets';import {FormatType,ICellData,- ICurrentUniverService,IGridRange,+ IUniverInstanceService,Nullable,ObjectMatrix,Range,@@ -40,7 +40,7 @@ export class TextFinder {private _startRange: Nullable<Range>; // 从这个位置后开始找constructor(- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService,@ISelectionTransformerShapeManagerprivate readonly _selectionTransformerShapeManager: ISelectionTransformerShapeManagerdiff --git a/packages/sheets-plugin-find/src/FindPlugin.ts b/packages/sheets-plugin-find/src/FindPlugin.tsindex f1d79fdd9c..528524f7f2 100644--- a/packages/sheets-plugin-find/src/FindPlugin.ts+++ b/packages/sheets-plugin-find/src/FindPlugin.ts@@ -1,4 +1,4 @@-import { ICurrentUniverService, LocaleService, Plugin, PluginType } from '@univerjs/core';+import { IUniverInstanceService, LocaleService, Plugin, PluginType } from '@univerjs/core';// import { TextFinder } from './Domain/TextFind';import { Dependency, Inject, Injector } from '@wendellhu/redi';@@ -25,7 +25,7 @@ export class FindPlugin extends Plugin {constructor(config: Partial<IFindPluginConfig>,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(LocaleService) private readonly _localeService: LocaleService,@Inject(Injector) protected readonly _injector: Injector) {diff --git a/packages/sheets-plugin-formula/src/Controller/ArrayFormulaLineController.ts b/packages/sheets-plugin-formula/src/Controller/ArrayFormulaLineController.tsindex 5ee349a935..9d6437435b 100644--- a/packages/sheets-plugin-formula/src/Controller/ArrayFormulaLineController.ts+++ b/packages/sheets-plugin-formula/src/Controller/ArrayFormulaLineController.ts@@ -1,5 +1,5 @@import { IRenderManagerService, Rect } from '@univerjs/base-render';-import { ICurrentUniverService, IRange, Workbook } from '@univerjs/core';+import { IRange, IUniverInstanceService, Workbook } from '@univerjs/core';enum ARRAY_FORMULA_LINE_MANAGER_KEY {top = '__ArrayFormulaLineTopControl__',@@ -23,7 +23,7 @@ export class ArrayFormulaLineControl {constructor(private _sheetId: string,private _range: IRange,- @ICurrentUniverService private readonly _currentUniverSheet: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverSheet: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService) {this._initialize();diff --git a/packages/sheets-plugin-formula/src/Controller/FormulaController.ts b/packages/sheets-plugin-formula/src/Controller/FormulaController.tsindex 911b8e035d..51919b8dfd 100644--- a/packages/sheets-plugin-formula/src/Controller/FormulaController.ts+++ b/packages/sheets-plugin-formula/src/Controller/FormulaController.ts@@ -7,7 +7,7 @@ import {UnitDataType,} from '@univerjs/base-formula-engine';import { SelectionManagerService } from '@univerjs/base-sheets';-import { ICurrentUniverService } from '@univerjs/core';+import { IUniverInstanceService } from '@univerjs/core';import { Inject, Injector } from '@wendellhu/redi';import { IFormulaConfig } from '../Basics/Interfaces/IFormula';@@ -28,7 +28,7 @@ export class FormulaController {constructor(config: IFormulaConfig,@Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(Injector) private readonly _sheetInjector: Injector) {this._formulaDataModel = new FormulaDataModel(config);diff --git a/packages/sheets-plugin-image/src/services/upload.service.ts b/packages/sheets-plugin-image/src/services/upload.service.tsindex a541783830..033d21fc7d 100644--- a/packages/sheets-plugin-image/src/services/upload.service.ts+++ b/packages/sheets-plugin-image/src/services/upload.service.ts@@ -1,5 +1,5 @@import { SelectionManagerService } from '@univerjs/base-sheets';-import { ICurrentUniverService } from '@univerjs/core';+import { IUniverInstanceService } from '@univerjs/core';import { Inject, Injector } from '@wendellhu/redi';import { FileSelected } from '../Basics';@@ -7,7 +7,7 @@ import { FileSelected } from '../Basics';export class UploadService {constructor(@Inject(Injector) readonly _injector: Injector,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService) {}diff --git a/packages/sheets-plugin-import-xlsx/src/services/upload.service.ts b/packages/sheets-plugin-import-xlsx/src/services/upload.service.tsindex 5f4c651eea..c44701e81e 100644--- a/packages/sheets-plugin-import-xlsx/src/services/upload.service.ts+++ b/packages/sheets-plugin-import-xlsx/src/services/upload.service.ts@@ -1,9 +1,9 @@-import { ICurrentUniverService, IKeyValue, migrate, Tools } from '@univerjs/core';+import { IKeyValue, IUniverInstanceService, migrate, Tools } from '@univerjs/core';// @ts-ignoreimport * as LuckyExcel from 'luckyexcel'; // no type definition for package luckyexcelexport class UploadService {- constructor(@ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService) {}+ constructor(@IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService) {}upload() {const input = document.createElement('input');diff --git a/packages/sheets-plugin-numfmt/src/Basics/Register/NumfmtActionExtension.ts b/packages/sheets-plugin-numfmt/src/Basics/Register/NumfmtActionExtension.tsindex dbfe11e236..e879ea42b9 100644--- a/packages/sheets-plugin-numfmt/src/Basics/Register/NumfmtActionExtension.ts+++ b/packages/sheets-plugin-numfmt/src/Basics/Register/NumfmtActionExtension.ts@@ -5,7 +5,7 @@// BaseActionExtension,// BaseActionExtensionFactory,// IActionData,-// ICurrentUniverService,+// IUniverInstanceService,// ISetRangeDataActionData,// ISheetActionData,// ObjectMatrix,@@ -20,7 +20,7 @@// export class NumfmtActionExtension extends BaseActionExtension {// constructor(// actionDataList: IActionData[],-// @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+// @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,// @Inject(INumfmtPluginData) private _numfmtPluginData: NumfmtModel,// @Inject(Injector) private readonly _sheetInjector: Injector// ) {diff --git a/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts b/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.tsindex 68cb4948b1..e6187455ac 100644--- a/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts+++ b/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts@@ -2,8 +2,8 @@ import { ComponentManager, IMenuService } from '@univerjs/base-ui';import {Disposable,ICommandService,- ICurrentUniverService,IRange,+ IUniverInstanceService,ObjectMatrix,ObjectMatrixPrimitiveType,Range,@@ -91,7 +91,7 @@ export class NumfmtController extends Disposable {@Inject(ComponentManager) private readonly _componentManager: ComponentManager,@Inject(Injector) private readonly _injector: Injector,@Inject(INumfmtPluginData) private _numfmtPluginData: NumfmtModel,- @Inject(ICurrentUniverService) private readonly _currentUniverService: ICurrentUniverService,+ @Inject(IUniverInstanceService) private readonly _currentUniverService: IUniverInstanceService,@Inject(NumfmtModalController) private readonly _numfmtModalController: NumfmtModalController,@IMenuService private readonly _menuService: IMenuService,@ICommandService private readonly _commandService: ICommandServicediff --git a/packages/ui-plugin-docs/src/Controller/clipboard.controller.ts b/packages/ui-plugin-docs/src/Controller/clipboard.controller.tsindex 9130e9c92a..38f9325f8e 100644--- a/packages/ui-plugin-docs/src/Controller/clipboard.controller.ts+++ b/packages/ui-plugin-docs/src/Controller/clipboard.controller.ts@@ -1,4 +1,4 @@-import { Disposable, ICommandService, ICurrentUniverService } from '@univerjs/core';+import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';import { DocCopyCommand } from '../commands/commands/clipboard.command';import { IDocClipboardService } from '../services/clipboard/clipboard.service';@@ -6,7 +6,7 @@ import { IDocClipboardService } from '../services/clipboard/clipboard.service';export class DocClipboardController extends Disposable {constructor(@ICommandService private readonly _commandService: ICommandService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IDocClipboardService private readonly _docClipboardService: IDocClipboardService) {super();diff --git a/packages/ui-plugin-docs/src/doc-ui-plugin.ts b/packages/ui-plugin-docs/src/doc-ui-plugin.tsindex 57a15df237..66b4187efe 100644--- a/packages/ui-plugin-docs/src/doc-ui-plugin.ts+++ b/packages/ui-plugin-docs/src/doc-ui-plugin.ts@@ -1,4 +1,4 @@-import { ICurrentUniverService, LocaleService, Plugin, PluginType, Tools } from '@univerjs/core';+import { IUniverInstanceService, LocaleService, Plugin, PluginType, Tools } from '@univerjs/core';import { Dependency, Inject, Injector } from '@wendellhu/redi';import { DefaultDocUiConfig, IDocUIPluginConfig } from './Basics';@@ -52,7 +52,7 @@ export class DocUIPlugin extends Plugin {}private _markDocAsFocused() {- const currentService = this._injector.get(ICurrentUniverService);+ const currentService = this._injector.get(IUniverInstanceService);const c = currentService.getCurrentUniverDocInstance();currentService.focusUniverInstance(c.getUnitId());}diff --git a/packages/ui-plugin-docs/src/services/clipboard/clipboard.service.ts b/packages/ui-plugin-docs/src/services/clipboard/clipboard.service.tsindex cf989d648d..6fb0d4c64a 100644--- a/packages/ui-plugin-docs/src/services/clipboard/clipboard.service.ts+++ b/packages/ui-plugin-docs/src/services/clipboard/clipboard.service.ts@@ -1,5 +1,5 @@import { IClipboardInterfaceService } from '@univerjs/base-ui';-import { Disposable, ICurrentUniverService, toDisposable } from '@univerjs/core';+import { Disposable, IUniverInstanceService, toDisposable } from '@univerjs/core';import { createIdentifier, IDisposable } from '@wendellhu/redi';export interface IClipboardPropertyItem {}@@ -23,7 +23,7 @@ export class DocClipboardService extends Disposable implements IDocClipboardServprivate _clipboardHooks: IDocClipboardHook[] = [];constructor(- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IClipboardInterfaceService private readonly _clipboardInterfaceService: IClipboardInterfaceService) {super();diff --git a/packages/ui-plugin-sheets/src/View/CountBar/zoom-slider.tsx b/packages/ui-plugin-sheets/src/View/CountBar/zoom-slider.tsxindex 3e60e198cb..272cf36251 100644--- a/packages/ui-plugin-sheets/src/View/CountBar/zoom-slider.tsx+++ b/packages/ui-plugin-sheets/src/View/CountBar/zoom-slider.tsx@@ -1,7 +1,7 @@import { SetWorksheetActivateCommand, SetZoomRatioCommand, SHEET_ZOOM_RANGE } from '@univerjs/base-sheets';import { SetZoomRatioOperation } from '@univerjs/base-sheets/commands/operations/set-zoom-ratio.operation.js';import { Slider } from '@univerjs/base-ui';-import { ICommandService, ICurrentUniverService } from '@univerjs/core';+import { ICommandService, IUniverInstanceService } from '@univerjs/core';import { useDependency } from '@wendellhu/redi/react-bindings';import { useEffect, useState } from 'react';@@ -9,7 +9,7 @@ const ZOOM_MAP = [50, 75, 100, 125, 150, 175, 200, 400];export function ZoomSlider() {const commandService = useDependency(ICommandService);- const currentUniverService = useDependency(ICurrentUniverService);+ const univerInstanceService = useDependency(IUniverInstanceService);const currentZoom = getCurrentZoom();const [zoom, setZoom] = useState(currentZoom);@@ -25,14 +25,14 @@ export function ZoomSlider() {function getCurrentZoom() {const currentZoom =- currentUniverService.getCurrentUniverSheetInstance()?.getActiveSheet().getZoomRatio() * 100 ?? 100;+ univerInstanceService.getCurrentUniverSheetInstance()?.getActiveSheet().getZoomRatio() * 100 ?? 100;return Math.round(currentZoom);}function handleChange(value: number) {setZoom(value);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();if (!workbook) return;const worksheet = workbook.getActiveSheet();if (!worksheet) return;diff --git a/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx b/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsxindex 4dc8584dc7..7d716c2638 100644--- a/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx+++ b/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx@@ -24,7 +24,7 @@ import {TabPane,Tabs,} from '@univerjs/base-ui';-import { BooleanNumber, ICommandService, ICurrentUniverService, IKeyValue } from '@univerjs/core';+import { BooleanNumber, ICommandService, IKeyValue, IUniverInstanceService } from '@univerjs/core';import { IDisposable } from '@wendellhu/redi';import { Component, createRef } from 'react';@@ -254,9 +254,9 @@ export class SheetBar extends Component<BaseSheetBarProps, SheetState> {*/private _updateSheetBarStatus(): void {const injector = this.context.injector!;- const currentUniverService = injector.get(ICurrentUniverService);+ const univerInstanceService = injector.get(IUniverInstanceService);const commandService = injector.get(ICommandService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const sheets = workbook.getSheets();const worksheetMenuItems = sheets.map((sheet, index) => ({diff --git a/packages/ui-plugin-sheets/src/View/SheetBar/input-edit.tsx b/packages/ui-plugin-sheets/src/View/SheetBar/input-edit.tsxindex 31b06546e1..e4297301e7 100644--- a/packages/ui-plugin-sheets/src/View/SheetBar/input-edit.tsx+++ b/packages/ui-plugin-sheets/src/View/SheetBar/input-edit.tsx@@ -1,6 +1,6 @@import { SetWorksheetNameCommand } from '@univerjs/base-sheets';import { useObservable } from '@univerjs/base-ui/Components/hooks/observable.js';-import { ICommandService, ICurrentUniverService } from '@univerjs/core';+import { ICommandService, IUniverInstanceService } from '@univerjs/core';import { useDependency } from '@wendellhu/redi/react-bindings';import { useState } from 'react';@@ -13,7 +13,7 @@ interface IBaseInputProps {export const InputEdit: React.FC<IBaseInputProps> = (props) => {const sheetbarService = useDependency(ISheetBarService);const commandService = useDependency(ICommandService);- const currentUniverService = useDependency(ICurrentUniverService);+ const univerInstanceService = useDependency(IUniverInstanceService);const renameId = useObservable(sheetbarService.renameId$, '');const oldValue = props.sheetName;const [val, setVal] = useState(props.sheetName || '');@@ -26,7 +26,7 @@ export const InputEdit: React.FC<IBaseInputProps> = (props) => {const submit = () => {if (val !== oldValue) {- const workbookId = currentUniverService.getCurrentUniverSheetInstance()?.getUnitId();+ const workbookId = univerInstanceService.getCurrentUniverSheetInstance()?.getUnitId();commandService.executeCommand(SetWorksheetNameCommand.id, {worksheetId: props.sheetId,workbookId,diff --git a/packages/ui-plugin-sheets/src/controller/clipboard/clipboard.controller.ts b/packages/ui-plugin-sheets/src/controller/clipboard/clipboard.controller.tsindex ecfb0516f5..27b914285e 100644--- a/packages/ui-plugin-sheets/src/controller/clipboard/clipboard.controller.ts+++ b/packages/ui-plugin-sheets/src/controller/clipboard/clipboard.controller.ts@@ -18,8 +18,8 @@ import {ICommandInfo,ICommandService,IConfigService,- ICurrentUniverService,IRange,+ IUniverInstanceService,LifecycleStages,LocaleService,ObjectArray,@@ -48,7 +48,7 @@ const DEFAULT_HEIGHT = 20;@OnLifecycle(LifecycleStages.Rendered, SheetClipboardController)export class SheetClipboardController extends Disposable {constructor(- @ICurrentUniverService private readonly _currentUniverSheet: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverSheet: IUniverInstanceService,@ICommandService private readonly _commandService: ICommandService,@IConfigService private readonly _configService: IConfigService,@ISheetClipboardService private readonly _sheetClipboardService: ISheetClipboardService,diff --git a/packages/ui-plugin-sheets/src/controller/contextmenu/contextmenu.controller.ts b/packages/ui-plugin-sheets/src/controller/contextmenu/contextmenu.controller.tsindex 7109b77173..85d3406b2a 100644--- a/packages/ui-plugin-sheets/src/controller/contextmenu/contextmenu.controller.ts+++ b/packages/ui-plugin-sheets/src/controller/contextmenu/contextmenu.controller.ts@@ -1,7 +1,7 @@import { IRenderManagerService } from '@univerjs/base-render';import { getSheetObject } from '@univerjs/base-sheets';import { IContextMenuService, MenuPosition } from '@univerjs/base-ui';-import { Disposable, ICurrentUniverService, LifecycleStages, OnLifecycle, toDisposable } from '@univerjs/core';+import { Disposable, IUniverInstanceService, LifecycleStages, OnLifecycle, toDisposable } from '@univerjs/core';import { SheetMenuPosition } from '../menu/menu';@@ -13,7 +13,7 @@ import { SheetMenuPosition } from '../menu/menu';@OnLifecycle(LifecycleStages.Rendered, SheetContextMenuController)export class SheetContextMenuController extends Disposable {constructor(- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IContextMenuService private readonly _contextMenuService: IContextMenuService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService) {diff --git a/packages/ui-plugin-sheets/src/controller/editor/editing.controller.ts b/packages/ui-plugin-sheets/src/controller/editor/editing.controller.tsindex 63116b46a0..a2ad652b3d 100644--- a/packages/ui-plugin-sheets/src/controller/editor/editing.controller.ts+++ b/packages/ui-plugin-sheets/src/controller/editor/editing.controller.ts@@ -3,7 +3,7 @@ import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/baimport {Disposable,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,Nullable,OnLifecycle,@@ -17,7 +17,7 @@ export class NormalInputController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ITextSelectionRenderManager private readonly _textSelectionRenderManager: ITextSelectionRenderManager,@Inject(TextSelectionManagerService) private readonly _textSelectionManagerService: TextSelectionManagerService,diff --git a/packages/ui-plugin-sheets/src/controller/editor/end-edit.controller.ts b/packages/ui-plugin-sheets/src/controller/editor/end-edit.controller.tsindex 63116b46a0..a2ad652b3d 100644--- a/packages/ui-plugin-sheets/src/controller/editor/end-edit.controller.ts+++ b/packages/ui-plugin-sheets/src/controller/editor/end-edit.controller.ts@@ -3,7 +3,7 @@ import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/baimport {Disposable,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,Nullable,OnLifecycle,@@ -17,7 +17,7 @@ export class NormalInputController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ITextSelectionRenderManager private readonly _textSelectionRenderManager: ITextSelectionRenderManager,@Inject(TextSelectionManagerService) private readonly _textSelectionManagerService: TextSelectionManagerService,diff --git a/packages/ui-plugin-sheets/src/controller/editor/start-edit.controller.ts b/packages/ui-plugin-sheets/src/controller/editor/start-edit.controller.tsindex 26a15546a5..776c61ad5e 100644--- a/packages/ui-plugin-sheets/src/controller/editor/start-edit.controller.ts+++ b/packages/ui-plugin-sheets/src/controller/editor/start-edit.controller.ts@@ -11,7 +11,7 @@ import { IEditorBridgeService } from '@univerjs/base-sheets';import {Disposable,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,LifecycleStages,makeCellToSelection,Nullable,@@ -29,7 +29,7 @@ export class StartEditController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@IEditorBridgeService private readonly _editorBridgeService: IEditorBridgeService,@ICellEditorManagerService private readonly _cellEditorManagerService: ICellEditorManagerService,diff --git a/packages/ui-plugin-sheets/src/controller/menu/__tests__/row-col.menu.spec.ts b/packages/ui-plugin-sheets/src/controller/menu/__tests__/row-col.menu.spec.tsindex 9928768a1b..a84cb864c1 100644--- a/packages/ui-plugin-sheets/src/controller/menu/__tests__/row-col.menu.spec.ts+++ b/packages/ui-plugin-sheets/src/controller/menu/__tests__/row-col.menu.spec.ts@@ -17,7 +17,7 @@ import { ISetSelectionsOperationParams } from '@univerjs/base-sheets/commands/opimport {DisposableCollection,ICommandService,- ICurrentUniverService,+ IUniverInstanceService,RANGE_TYPE,toDisposable,Univer,@@ -70,21 +70,21 @@ describe('Test row col menu items', () => {afterEach(() => univer.dispose());function getRowCount(): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getRowCount();}function getColCount(): number {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();}async function selectRow(rowStart: number, rowEnd: number): Promise<boolean> {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();const endColumn = getColCount() - 1;@@ -112,7 +112,7 @@ describe('Test row col menu items', () => {}async function selectColumn(columnStart: number, columnEnd: number): Promise<boolean> {- const currentService = get(ICurrentUniverService);+ const currentService = get(IUniverInstanceService);const workbook = currentService.getCurrentUniverSheetInstance();const worksheet = workbook.getActiveSheet();const endRow = getRowCount() - 1;diff --git a/packages/ui-plugin-sheets/src/controller/menu/menu.ts b/packages/ui-plugin-sheets/src/controller/menu/menu.tsindex 5a21bcf8c0..59eaf5caec 100644--- a/packages/ui-plugin-sheets/src/controller/menu/menu.ts+++ b/packages/ui-plugin-sheets/src/controller/menu/menu.ts@@ -62,9 +62,9 @@ import {FontWeight,HorizontalAlign,ICommandService,- ICurrentUniverService,IPermissionService,IUndoRedoService,+ IUniverInstanceService,RANGE_TYPE,RedoCommand,UndoCommand,@@ -119,7 +119,7 @@ export function RedoMenuItemFactory(accessor: IAccessor): IMenuButtonItem {export function BoldMenuItemFactory(accessor: IAccessor): IMenuButtonItem {const commandService = accessor.get(ICommandService);const permissionService = accessor.get(IPermissionService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {@@ -155,7 +155,7 @@ export function BoldMenuItemFactory(accessor: IAccessor): IMenuButtonItem {}const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let isBold = FontWeight.NORMAL;if (primary != null) {const range = worksheet.getRange(primary.startRow, primary.startColumn);@@ -174,7 +174,7 @@ export function BoldMenuItemFactory(accessor: IAccessor): IMenuButtonItem {export function ItalicMenuItemFactory(accessor: IAccessor): IMenuButtonItem {const permissionService = accessor.get(IPermissionService);const commandService = accessor.get(ICommandService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {@@ -212,7 +212,7 @@ export function ItalicMenuItemFactory(accessor: IAccessor): IMenuButtonItem {}const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let isItalic = FontItalic.NORMAL;if (primary != null) {const range = worksheet.getRange(primary.startRow, primary.startColumn);@@ -231,7 +231,7 @@ export function ItalicMenuItemFactory(accessor: IAccessor): IMenuButtonItem {export function UnderlineMenuItemFactory(accessor: IAccessor): IMenuButtonItem {const permissionService = accessor.get(IPermissionService);const commandService = accessor.get(ICommandService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {@@ -269,7 +269,7 @@ export function UnderlineMenuItemFactory(accessor: IAccessor): IMenuButtonItem {}const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let isUnderline;if (primary != null) {const range = worksheet.getRange(primary.startRow, primary.startColumn);@@ -288,7 +288,7 @@ export function UnderlineMenuItemFactory(accessor: IAccessor): IMenuButtonItem {export function StrikeThroughMenuItemFactory(accessor: IAccessor): IMenuButtonItem {const permissionService = accessor.get(IPermissionService);const commandService = accessor.get(ICommandService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {@@ -326,7 +326,7 @@ export function StrikeThroughMenuItemFactory(accessor: IAccessor): IMenuButtonIt}const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let st;if (primary != null) {const range = worksheet.getRange(primary.startRow, primary.startColumn);@@ -493,7 +493,7 @@ export const FONT_FAMILY_CHILDREN = [export function FontFamilySelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string> {const permissionService = accessor.get(IPermissionService);const commandService = accessor.get(ICommandService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {@@ -536,7 +536,7 @@ export function FontFamilySelectorMenuItemFactory(accessor: IAccessor): IMenuSel}const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let ff;if (primary != null) {const range = worksheet.getRange(primary.startRow, primary.startColumn);@@ -555,7 +555,7 @@ export function FontFamilySelectorMenuItemFactory(accessor: IAccessor): IMenuSelexport function FontSizeSelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<number> {const permissionService = accessor.get(IPermissionService);const commandService = accessor.get(ICommandService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {@@ -599,7 +599,7 @@ export function FontSizeSelectorMenuItemFactory(accessor: IAccessor): IMenuSelec}const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let fs;if (primary != null) {const range = worksheet.getRange(primary.startRow, primary.startColumn);@@ -717,7 +717,7 @@ export const HORIZONTAL_ALIGN_CHILDREN = [];export function HorizontalAlignMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<HorizontalAlign> {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {id: SetHorizontalTextAlignCommand.id,@@ -737,7 +737,7 @@ export function HorizontalAlignMenuItemFactory(accessor: IAccessor): IMenuSelect}const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let ha;if (primary != null) {const range = worksheet.getRange(primary.startRow, primary.startColumn);@@ -773,7 +773,7 @@ export const VERTICAL_ALIGN_CHILDREN = [];export function VerticalAlignMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<VerticalAlign> {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {id: SetVerticalTextAlignCommand.id,@@ -793,7 +793,7 @@ export function VerticalAlignMenuItemFactory(accessor: IAccessor): IMenuSelector}const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let va;if (primary != null) {const range = worksheet.getRange(primary.startRow, primary.startColumn);@@ -829,7 +829,7 @@ export const TEXT_WRAP_CHILDREN = [];export function WrapTextMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<WrapStrategy> {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {id: SetTextWrapCommand.id,@@ -849,7 +849,7 @@ export function WrapTextMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<}const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let ws;if (primary != null) {const range = worksheet.getRange(primary.startRow, primary.startColumn);@@ -900,7 +900,7 @@ export const TEXT_ROTATE_CHILDREN = [];export function TextRotateMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<number | string> {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {id: SetTextRotationCommand.id,@@ -920,7 +920,7 @@ export function TextRotateMenuItemFactory(accessor: IAccessor): IMenuSelectorIte}const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let tr;if (primary != null) {const range = worksheet.getRange(primary.startRow, primary.startColumn);@@ -1120,11 +1120,11 @@ export function HideColMenuItemFactory(): IMenuButtonItem {}export function ShowRowMenuItemFactory(accessor: IAccessor): IMenuButtonItem {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);function hasHiddenRowsInSelections(): boolean {- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();const rowRanges = selectionManagerService.getSelections()?.map((s) => s.range)@@ -1167,11 +1167,11 @@ export function ShowRowMenuItemFactory(accessor: IAccessor): IMenuButtonItem {}export function ShowColMenuItemFactory(accessor: IAccessor): IMenuButtonItem {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);function hasHiddenColsInSelections(): boolean {- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();const colRanges = selectionManagerService.getSelections()?.map((s) => s.range)@@ -1223,7 +1223,7 @@ export function RemoveColMenuItemFactory(): IMenuButtonItem {export function SetRowHeightMenuItemFactory(accessor: IAccessor): IMenuButtonItem<number> {const commandService = accessor.get(ICommandService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {@@ -1242,7 +1242,7 @@ export function SetRowHeightMenuItemFactory(accessor: IAccessor): IMenuButtonItevalue$: new Observable((subscriber) => {function update() {const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let rowHeight;if (primary != null) {rowHeight = worksheet.getRowHeight(primary.startRow);@@ -1270,7 +1270,7 @@ export function SetRowHeightMenuItemFactory(accessor: IAccessor): IMenuButtonIteexport function SetColWidthMenuItemFactory(accessor: IAccessor): IMenuButtonItem<number> {const commandService = accessor.get(ICommandService);- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const selectionManagerService = accessor.get(SelectionManagerService);return {@@ -1289,7 +1289,7 @@ export function SetColWidthMenuItemFactory(accessor: IAccessor): IMenuButtonItemvalue$: new Observable((subscriber) => {function update() {const primary = selectionManagerService.getLast()?.primary;- const worksheet = currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet();let colWidth: number = 0;if (primary != null) {@@ -1399,9 +1399,9 @@ export function HideSheetMenuItemFactory(): IMenuButtonItem {}export function UnHideSheetMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<any> {- const currentUniverService = accessor.get(ICurrentUniverService);+ const univerInstanceService = accessor.get(IUniverInstanceService);const commandService = accessor.get(ICommandService);- const workbook = currentUniverService.getCurrentUniverSheetInstance();+ const workbook = univerInstanceService.getCurrentUniverSheetInstance();const hiddenList = workbook.getHiddenWorksheets().map((s) => ({label: workbook.getSheetBySheetId(s)?.getName() || '',value: s,diff --git a/packages/ui-plugin-sheets/src/services/cell-editor/cell-editor-desktop.service.ts b/packages/ui-plugin-sheets/src/services/cell-editor/cell-editor-desktop.service.tsindex d1b1eb67cb..cf18036597 100644--- a/packages/ui-plugin-sheets/src/services/cell-editor/cell-editor-desktop.service.ts+++ b/packages/ui-plugin-sheets/src/services/cell-editor/cell-editor-desktop.service.ts@@ -25,11 +25,11 @@ import {handleJsonToDom,ICommandService,IContextService,- ICurrentUniverService,IDocumentData,IRange,ISelectionCell,IStyleData,+ IUniverInstanceService,LifecycleStages,Nullable,OnLifecycle,@@ -72,7 +72,7 @@ export class DesktopCellEditorService extends RxDisposable implements ICellEdito@ISelectionTransformerShapeManagerprivate readonly _selectionTransformerShapeManager: ISelectionTransformerShapeManager,@ICommandService private readonly _commandService: ICommandService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@IContextService private readonly _contextService: IContextService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ITextSelectionRenderManager private readonly _textSelectionRenderManager: ITextSelectionRenderManager,diff --git a/packages/ui-plugin-sheets/src/services/clipboard/clipboard.service.ts b/packages/ui-plugin-sheets/src/services/clipboard/clipboard.service.tsindex 99e3406fc9..e4f61bdd4e 100644--- a/packages/ui-plugin-sheets/src/services/clipboard/clipboard.service.ts+++ b/packages/ui-plugin-sheets/src/services/clipboard/clipboard.service.ts@@ -9,10 +9,10 @@ import {ICellData,ICommandInfo,ICommandService,- ICurrentUniverService,ILogService,IRange,IUndoRedoService,+ IUniverInstanceService,ObjectMatrix,ObjectMatrixPrimitiveType,toDisposable,@@ -142,7 +142,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboardconstructor(@ILogService private readonly _logService: ILogService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService,@IClipboardInterfaceService private readonly _clipboardInterfaceService: IClipboardInterfaceService,@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,diff --git a/packages/ui-plugin-sheets/src/sheet-ui-plugin.ts b/packages/ui-plugin-sheets/src/sheet-ui-plugin.tsindex ccabe1741c..b0e089edd5 100644--- a/packages/ui-plugin-sheets/src/sheet-ui-plugin.ts+++ b/packages/ui-plugin-sheets/src/sheet-ui-plugin.ts@@ -1,4 +1,4 @@-import { ICurrentUniverService, LocaleService, Plugin, PluginType } from '@univerjs/core';+import { IUniverInstanceService, LocaleService, Plugin, PluginType } from '@univerjs/core';import { Dependency, Inject, Injector } from '@wendellhu/redi';import { filter } from 'rxjs/operators';@@ -19,7 +19,7 @@ export class SheetUIPlugin extends Plugin {config: undefined,@Inject(Injector) override readonly _injector: Injector,@Inject(LocaleService) private readonly _localeService: LocaleService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService) {super(SHEET_UI_PLUGIN_NAME);@@ -53,9 +53,9 @@ export class SheetUIPlugin extends Plugin {}private _markSheetAsFocused() {- const currentUniverService = this._currentUniverService;- currentUniverService.currentSheet$.pipe(filter((v) => !!v)).subscribe((workbook) => {- currentUniverService.focusUniverInstance(workbook!.getUnitId());+ const univerInstanceService = this._currentUniverService;+ univerInstanceService.currentSheet$.pipe(filter((v) => !!v)).subscribe((workbook) => {+ univerInstanceService.focusUniverInstance(workbook!.getUnitId());});}}diff --git a/packages/ui-plugin-slides/src/Controller/SlideBarUIController.ts b/packages/ui-plugin-slides/src/Controller/SlideBarUIController.tsindex 4cb329ce1e..fc7bbade71 100644--- a/packages/ui-plugin-slides/src/Controller/SlideBarUIController.ts+++ b/packages/ui-plugin-slides/src/Controller/SlideBarUIController.ts@@ -1,5 +1,5 @@import { CanvasView } from '@univerjs/base-slides';-import { ICurrentUniverService, ISlidePage } from '@univerjs/core';+import { ISlidePage, IUniverInstanceService } from '@univerjs/core';import { Inject } from '@wendellhu/redi';import { SlideBar } from '../View/SlideBar/SlideBar';@@ -11,7 +11,7 @@ export class SlideBarUIController {constructor(@Inject(CanvasView) private readonly _canvasView: CanvasView,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService) {this._initialize();}diff --git a/packages/ui-plugin-slides/src/Controller/ToolbarUIController.ts b/packages/ui-plugin-slides/src/Controller/ToolbarUIController.tsindex d8e35c94a6..e930432cde 100644--- a/packages/ui-plugin-slides/src/Controller/ToolbarUIController.ts+++ b/packages/ui-plugin-slides/src/Controller/ToolbarUIController.ts@@ -2,8 +2,8 @@ import { BaseSelectChildrenProps, BaseSelectProps, ColorPicker, ComponentManagerimport {BorderType,HorizontalAlign,- ICurrentUniverService,IKeyValue,+ IUniverInstanceService,Tools,UIObserver,VerticalAlign,@@ -60,7 +60,7 @@ export class ToolbarUIController {constructor(config: SlideToolbarConfig | undefined,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,@Inject(ComponentManager) private readonly _componentManager: ComponentManager) {this._config = Tools.deepMerge({}, DefaultToolbarConfig, config);diff --git a/packages/ui-plugin-slides/src/View/SlideBar/SlideBar.tsx b/packages/ui-plugin-slides/src/View/SlideBar/SlideBar.tsxindex f16d7b7a14..1bc3613a0b 100644--- a/packages/ui-plugin-slides/src/View/SlideBar/SlideBar.tsx+++ b/packages/ui-plugin-slides/src/View/SlideBar/SlideBar.tsx@@ -1,5 +1,5 @@import { AppContext, BaseComponentProps } from '@univerjs/base-ui';-import { ICurrentUniverService, ISlidePage } from '@univerjs/core';+import { ISlidePage, IUniverInstanceService } from '@univerjs/core';import { Component, createRef } from 'react';import styles from './index.module.less';@@ -66,8 +66,8 @@ export class SlideBar extends Component<{}, SlideBarState> {private _init(): void {// TODO: should subscribe to active slide change event- const currentUniverService = this.context.injector.get(ICurrentUniverService);- const model = currentUniverService.getCurrentUniverSlideInstance();+ const univerInstanceService = this.context.injector.get(IUniverInstanceService);+ const model = univerInstanceService.getCurrentUniverSlideInstance();const pages = model.getPages();const pageOrder = model.getPageOrder();if (!pages || !pageOrder) {diff --git a/packages/ui-plugin-slides/src/slide-ui-plugin.ts b/packages/ui-plugin-slides/src/slide-ui-plugin.tsindex 532e75d63b..1cdf18bd53 100644--- a/packages/ui-plugin-slides/src/slide-ui-plugin.ts+++ b/packages/ui-plugin-slides/src/slide-ui-plugin.ts@@ -1,5 +1,5 @@import { ComponentManager } from '@univerjs/base-ui';-import { ICurrentUniverService, LocaleService, Plugin, PluginType, Tools } from '@univerjs/core';+import { IUniverInstanceService, LocaleService, Plugin, PluginType, Tools } from '@univerjs/core';import { Inject, Injector } from '@wendellhu/redi';import { DefaultSlideUIConfig, ISlideUIPluginConfig } from './Basics';@@ -22,7 +22,7 @@ export class SlideUIPlugin extends Plugin {config: Partial<ISlideUIPluginConfig> = {},@Inject(Injector) override readonly _injector: Injector,@Inject(LocaleService) private readonly _localeService: LocaleService,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService+ @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService) {super(SLIDE_UI_PLUGIN_NAME);this._config = Tools.deepMerge({}, DefaultSlideUIConfig, config);