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: make the source of univer-instance-type unique (#2073)
#FF0000bee6d9b9cf71
diff --git a/examples/src/plugins/debugger/commands/operations/save-snapshot.operations.ts b/examples/src/plugins/debugger/commands/operations/save-snapshot.operations.tsindex 82c1d06e90..a766bdd472 100644--- a/examples/src/plugins/debugger/commands/operations/save-snapshot.operations.ts+++ b/examples/src/plugins/debugger/commands/operations/save-snapshot.operations.ts@@ -52,7 +52,7 @@ export const SaveSnapshotOptions: ICommand = {const exportController = accessor.get(ExportController);const recordController = accessor.get(RecordController);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const snapshot = resourceLoaderService.saveWorkbook(workbook);const gitHash = process.env.GIT_COMMIT_HASH;diff --git a/examples/src/plugins/debugger/commands/operations/set.editable.operation.ts b/examples/src/plugins/debugger/commands/operations/set.editable.operation.tsindex b7f8cf2915..ef590a0566 100644--- a/examples/src/plugins/debugger/commands/operations/set.editable.operation.ts+++ b/examples/src/plugins/debugger/commands/operations/set.editable.operation.ts@@ -34,7 +34,7 @@ export const SetEditable: ICommand = {} else {const univerPermissionService = accessor.get(UniverPermissionService);const univerInstanceService = accessor.get(IUniverInstanceService);- const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();+ const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();const editable = univerPermissionService.getEditable(unitId);univerPermissionService.setEditable(unitId, !editable);}diff --git a/examples/src/plugins/debugger/commands/operations/sidebar.operation.ts b/examples/src/plugins/debugger/commands/operations/sidebar.operation.tsindex 40044788bd..652fa52db3 100644--- a/examples/src/plugins/debugger/commands/operations/sidebar.operation.ts+++ b/examples/src/plugins/debugger/commands/operations/sidebar.operation.ts@@ -31,7 +31,7 @@ export const SidebarOperation: ICommand = {const sidebarService = accessor.get(ISidebarService);const editorService = accessor.get(IEditorService);const univerInstanceService = accessor.get(IUniverInstanceService);- const unit = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const unit = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;switch (params.value) {case 'open':editorService.setOperationSheetUnitId(unit.getUnitId());diff --git a/examples/src/plugins/debugger/controllers/e2e/e2e-memory.controller.ts b/examples/src/plugins/debugger/controllers/e2e/e2e-memory.controller.tsindex 04043898ea..b6f8159b0a 100644--- a/examples/src/plugins/debugger/controllers/e2e/e2e-memory.controller.ts+++ b/examples/src/plugins/debugger/controllers/e2e/e2e-memory.controller.ts@@ -51,7 +51,7 @@ export class E2EMemoryController {private async _loadAndRelease(id: number): Promise<void> {const unitId = `e2e${id}`;- this._univerInstanceService.createUnit(UniverInstanceType.SHEET, { ...DEFAULT_WORKBOOK_DATA_DEMO, id: unitId });+ this._univerInstanceService.createUnit(UniverInstanceType.UNIVER_SHEET, { ...DEFAULT_WORKBOOK_DATA_DEMO, id: unitId });await timer(AWAIT_LOADING_TIMEOUT);this._univerInstanceService.disposeUnit(unitId);await timer(AWAIT_DISPOSING_TIMEOUT);diff --git a/examples/src/plugins/debugger/controllers/performance-monitor.controller.ts b/examples/src/plugins/debugger/controllers/performance-monitor.controller.tsindex 3dc2eb3533..85e1ffddbc 100644--- a/examples/src/plugins/debugger/controllers/performance-monitor.controller.ts+++ b/examples/src/plugins/debugger/controllers/performance-monitor.controller.ts@@ -22,7 +22,7 @@ import { interval, takeUntil, throttle } from 'rxjs';@OnLifecycle(LifecycleStages.Rendered, PerformanceMonitorController)export class PerformanceMonitorController extends RxDisposable {- private _documentType: UniverInstanceType = UniverInstanceType.UNIVER;+ private _documentType: UniverInstanceType = UniverInstanceType.UNIVER_UNKNOWN;private _hasWatched = false;private _container!: HTMLDivElement;private _styleElement!: HTMLStyleElement;@@ -87,14 +87,14 @@ export class PerformanceMonitorController extends RxDisposable {this._styleElement = document.createElement('style');document.head.appendChild(this._styleElement).innerText = style;- if (this._documentType === UniverInstanceType.DOC) {+ if (this._documentType === UniverInstanceType.UNIVER_DOC) {this._docCanvasView.fps$.pipe(takeUntil(this.dispose$)).pipe(throttle(() => interval(THROTTLE_TIME))).subscribe((fps) => {container.innerText = `FPS: ${fps}`;});- } else if (this._documentType === UniverInstanceType.SHEET) {+ } else if (this._documentType === UniverInstanceType.UNIVER_SHEET) {this._injector.get(SheetCanvasView).fps$.pipe(takeUntil(this.dispose$))diff --git a/examples/src/plugins/debugger/views/test-editor/TestTextEditor.tsx b/examples/src/plugins/debugger/views/test-editor/TestTextEditor.tsxindex 99d6b241bd..eeef91157f 100644--- a/examples/src/plugins/debugger/views/test-editor/TestTextEditor.tsx+++ b/examples/src/plugins/debugger/views/test-editor/TestTextEditor.tsx@@ -40,7 +40,7 @@ const editorStyle: React.CSSProperties = {*/export const TestEditorContainer = () => {const univerInstanceService = useDependency(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (workbook == null) {return;}diff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.tsindex 290e9d9a9d..c8d24ccc0b 100644--- a/examples/src/sheets/main.ts+++ b/examples/src/sheets/main.ts@@ -96,7 +96,7 @@ univer.registerPlugin(UniverSheetsConditionalFormattingUIPlugin);// create univer sheet instanceif (!IS_E2E) {- univer.createUnit(UniverInstanceType.SHEET, DEFAULT_WORKBOOK_DATA_DEMO);+ univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO);}// Uncomment the following lines to test if the document is disposed correctly without memory leaks.@@ -104,7 +104,7 @@ if (!IS_E2E) {// univer.__getInjector().get(IUniverInstanceService).disposeUnit(DEFAULT_WORKBOOK_DATA_DEMO.id);// }, 5000);// setTimeout(() => {-// univer.createUnit(UniverInstanceType.SHEET, DEFAULT_WORKBOOK_DATA_DEMO);+// univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO);// }, 7000);diff --git a/packages/core/src/common/unit.ts b/packages/core/src/common/unit.tsindex 6362bb5937..35e8092f7f 100644--- a/packages/core/src/common/unit.ts+++ b/packages/core/src/common/unit.ts@@ -14,21 +14,12 @@* limitations under the License.*/+import type { UniverType } from '@univerjs/protocol';import { Disposable } from '../shared';-/**- * Type of built-in univer document instances.- */-export enum UniverInstanceType {- UNIVER = 0,- DOC = 1,- SHEET = 2,- SLIDE = 3,-- UNRECOGNIZED = -1,-}+export { UniverType as UniverInstanceType } from '@univerjs/protocol';-export type UnitType = UniverInstanceType | number;+export type UnitType = UniverType | number;export abstract class UnitModel<_D = object, T extends UnitType = UnitType> extends Disposable {abstract readonly type: T;diff --git a/packages/core/src/docs/data-model/document-data-model.ts b/packages/core/src/docs/data-model/document-data-model.tsindex b71d90377c..2998e08913 100644--- a/packages/core/src/docs/data-model/document-data-model.ts+++ b/packages/core/src/docs/data-model/document-data-model.ts@@ -46,8 +46,8 @@ interface IDrawingUpdateConfig {width: number;}-class DocumentDataModelSimple extends UnitModel<IDocumentData, UniverInstanceType.DOC> {- override type: UniverInstanceType.DOC = UniverInstanceType.DOC;+class DocumentDataModelSimple extends UnitModel<IDocumentData, UniverInstanceType.UNIVER_DOC> {+ override type: UniverInstanceType.UNIVER_DOC = UniverInstanceType.UNIVER_DOC;override getUnitId(): string {throw new Error('Method not implemented.');diff --git a/packages/core/src/services/instance/instance.service.ts b/packages/core/src/services/instance/instance.service.tsindex 2ade3ab226..1025e49dd3 100644--- a/packages/core/src/services/instance/instance.service.ts+++ b/packages/core/src/services/instance/instance.service.ts@@ -167,15 +167,15 @@ export class UniverInstanceService extends Disposable implements IUniverInstance}getCurrentUniverDocInstance(): Nullable<DocumentDataModel> {- return this.getCurrentUnitForType(UniverInstanceType.DOC) as Nullable<DocumentDataModel>;+ return this.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC) as Nullable<DocumentDataModel>;}getUniverDocInstance(unitId: string): Nullable<DocumentDataModel> {- return this.getUnit<DocumentDataModel>(unitId, UniverInstanceType.DOC);+ return this.getUnit<DocumentDataModel>(unitId, UniverInstanceType.UNIVER_DOC);}getUniverSheetInstance(unitId: string): Nullable<Workbook> {- return this.getUnit<Workbook>(unitId, UniverInstanceType.SHEET);+ return this.getUnit<Workbook>(unitId, UniverInstanceType.UNIVER_SHEET);}getAllUnitsForType<T>(type: UnitType): T[] {@@ -183,7 +183,7 @@ export class UniverInstanceService extends Disposable implements IUniverInstance}changeDoc(unitId: string, doc: DocumentDataModel): void {- const allDocs = this.getAllUnitsForType<DocumentDataModel>(UniverInstanceType.DOC);+ const allDocs = this.getAllUnitsForType<DocumentDataModel>(UniverInstanceType.UNIVER_DOC);const oldDoc = allDocs.find((doc) => doc.getUnitId() === unitId);if (oldDoc != null) {diff --git a/packages/core/src/services/permission/permission.service.ts b/packages/core/src/services/permission/permission.service.tsindex 16bd4e1480..aca6c2c939 100644--- a/packages/core/src/services/permission/permission.service.ts+++ b/packages/core/src/services/permission/permission.service.ts@@ -53,7 +53,7 @@ export class PermissionService extends Disposable implements IPermissionService// private _init() {// this.disposeWithMe(// toDisposable(- // this._univerInstanceService.getTypeOfUnitAdded$<Workbook>(UniverInstanceType.SHEET).subscribe((workbook) => {+ // this._univerInstanceService.getTypeOfUnitAdded$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {// this._resourceManagerService.registerPluginResource(workbook.getUnitId(), resourceKey, {// onChange: (unitID, value) => {// (value as PermissionPoint[]).forEach((permissionPoint) => {@@ -72,7 +72,7 @@ export class PermissionService extends Disposable implements IPermissionService// );// this.disposeWithMe(// toDisposable(- // this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.SHEET).subscribe((workbook) => {+ // this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {// this._resourceManagerService.disposePluginResource(workbook.getUnitId(), resourceKey);// })// )diff --git a/packages/core/src/services/permission/univer.permission.service.ts b/packages/core/src/services/permission/univer.permission.service.tsindex 9b4d57490b..330a80c7cf 100644--- a/packages/core/src/services/permission/univer.permission.service.ts+++ b/packages/core/src/services/permission/univer.permission.service.ts@@ -34,13 +34,13 @@ export class UniverPermissionService extends Disposable {}private _init() {- this._univerInstanceService.getTypeOfUnitAdded$(UniverInstanceType.SHEET).subscribe((workbook) => {+ this._univerInstanceService.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {const univerEditablePermission = new UniverEditablePermission(workbook.getUnitId());this._permissionService.addPermissionPoint(workbook.getUnitId(), univerEditablePermission);});}- getEditable(unitId = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.SHEET)?.getUnitId()) {+ getEditable(unitId = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)?.getUnitId()) {if (!unitId) {return;}diff --git a/packages/core/src/services/plugin/plugin.service.ts b/packages/core/src/services/plugin/plugin.service.tsindex e64c3d4b3b..3d6abba425 100644--- a/packages/core/src/services/plugin/plugin.service.ts+++ b/packages/core/src/services/plugin/plugin.service.ts@@ -16,7 +16,6 @@import type { IDisposable } from '@wendellhu/redi';import { Inject, Injector } from '@wendellhu/redi';-import type { UniverType } from '@univerjs/protocol';import { type UnitType, UniverInstanceType } from '../../common/unit';import { PluginHolder } from './plugin-holder';import type { Plugin, PluginCtor } from './plugin';@@ -54,7 +53,7 @@ export class PluginService implements IDisposable {this._scheduleInitPlugin();const { type } = plugin;- if (type === UniverInstanceType.UNIVER) {+ if (type === UniverInstanceType.UNIVER_UNKNOWN) {this._pluginHolderForUniver.registerPlugin(plugin, config);this._pluginHolderForUniver.flush();} else {@@ -64,7 +63,7 @@ export class PluginService implements IDisposable {}}- startPluginForType(type: UniverType): void {+ startPluginForType(type: UniverInstanceType): void {const holder = this._ensurePluginHolderForType(type);holder.start();}diff --git a/packages/core/src/services/plugin/plugin.ts b/packages/core/src/services/plugin/plugin.tsindex ade2df45ad..28ac433613 100644--- a/packages/core/src/services/plugin/plugin.ts+++ b/packages/core/src/services/plugin/plugin.ts@@ -26,7 +26,7 @@ export type PluginCtor<T extends Plugin> = Ctor<T> & { type: UniverInstanceType;export abstract class Plugin extends Disposable {static pluginName: string;- static type: UniverInstanceType = UniverInstanceType.UNIVER;+ static type: UniverInstanceType = UniverInstanceType.UNIVER_UNKNOWN;protected abstract _injector: Injector;diff --git a/packages/core/src/services/resource-loader/resource-loader.service.ts b/packages/core/src/services/resource-loader/resource-loader.service.tsindex 809d2cef4b..08aaf7a7eb 100644--- a/packages/core/src/services/resource-loader/resource-loader.service.ts+++ b/packages/core/src/services/resource-loader/resource-loader.service.ts@@ -15,7 +15,6 @@*/import { Inject } from '@wendellhu/redi';-import { UniverType } from '@univerjs/protocol';import type { Workbook } from '../../sheets/workbook';import type { IWorkbookData } from '../../types/interfaces';import type { IResourceHook } from '../resource-manager/type';@@ -39,15 +38,15 @@ export class ResourceLoaderService extends Disposable implements IResourceLoaderconst handleHookAdd = (hook: IResourceHook) => {hook.businesses.forEach((business) => {switch (business) {- case UniverType.UNRECOGNIZED:- case UniverType.UNIVER_UNKNOWN:- case UniverType.UNIVER_SLIDE:- case UniverType.UNIVER_DOC: {+ case UniverInstanceType.UNRECOGNIZED:+ case UniverInstanceType.UNIVER_UNKNOWN:+ case UniverInstanceType.UNIVER_SLIDE:+ case UniverInstanceType.UNIVER_DOC: {// TODO@gggpound: wait to support.break;}- case UniverType.UNIVER_SHEET: {- this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.SHEET).forEach((workbook) => {+ case UniverInstanceType.UNIVER_SHEET: {+ this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.UNIVER_SHEET).forEach((workbook) => {const snapshotResource = workbook.getSnapshot().resources || [];const plugin = snapshotResource.find((r) => r.name === hook.pluginName);if (plugin) {@@ -75,7 +74,7 @@ export class ResourceLoaderService extends Disposable implements IResourceLoaderthis.disposeWithMe(toDisposable(- this._univerInstanceService.getTypeOfUnitAdded$<Workbook>(UniverInstanceType.SHEET).subscribe((workbook) => {+ this._univerInstanceService.getTypeOfUnitAdded$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {this._resourceManagerService.loadResources(workbook.getUnitId(), workbook.getSnapshot().resources);}))@@ -83,7 +82,7 @@ export class ResourceLoaderService extends Disposable implements IResourceLoaderthis.disposeWithMe(toDisposable(- this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.SHEET).subscribe((workbook) => {+ this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {this._resourceManagerService.unloadResources(workbook.getUnitId());}))diff --git a/packages/core/src/services/resource-manager/type.ts b/packages/core/src/services/resource-manager/type.tsindex 969fa3e8d1..1cef7403af 100644--- a/packages/core/src/services/resource-manager/type.ts+++ b/packages/core/src/services/resource-manager/type.ts@@ -17,14 +17,14 @@import type { IDisposable } from '@wendellhu/redi';import { createIdentifier } from '@wendellhu/redi';import type { Observable } from 'rxjs';-import type { UniverType } from '@univerjs/protocol';+import type { UniverInstanceType } from '@univerjs/core';import type { IWorkbookData } from '../../types/interfaces/i-workbook-data';type IBusinessName = 'SHEET' | 'DOC';export type IResourceName = `${IBusinessName}_${string}_PLUGIN`;export interface IResourceHook<T = any> {pluginName: IResourceName;- businesses: UniverType[];+ businesses: UniverInstanceType[];onLoad: (unitID: string, resource: T) => void;onUnLoad: (unitID: string) => void;toJson: (unitID: string) => string;diff --git a/packages/core/src/sheets/workbook.ts b/packages/core/src/sheets/workbook.tsindex 9b5a272fba..fd797cd2e0 100644--- a/packages/core/src/sheets/workbook.ts+++ b/packages/core/src/sheets/workbook.ts@@ -43,8 +43,8 @@ export function getWorksheetUID(workbook: Workbook, worksheet: Worksheet): strin/*** Access and create Univer Sheets files*/-export class Workbook extends UnitModel<IWorkbookData, UniverInstanceType.SHEET> {- override type: UniverInstanceType.SHEET = UniverInstanceType.SHEET;+export class Workbook extends UnitModel<IWorkbookData, UniverInstanceType.UNIVER_SHEET> {+ override type: UniverInstanceType.UNIVER_SHEET = UniverInstanceType.UNIVER_SHEET;private readonly _sheetCreated$ = new Subject<Worksheet>();readonly sheetCreated$ = this._sheetCreated$.asObservable();diff --git a/packages/core/src/sheets/worksheet.ts b/packages/core/src/sheets/worksheet.tsindex 5d3fc6756a..5819799f64 100644--- a/packages/core/src/sheets/worksheet.ts+++ b/packages/core/src/sheets/worksheet.ts@@ -14,12 +14,11 @@* limitations under the License.*/-import { CellValueType } from '@univerjs/protocol';import type { Nullable } from '../shared';import { ObjectMatrix, Rectangle, Tools } from '../shared';import { createRowColIter } from '../shared/row-col-iter';-import type { BooleanNumber } from '../types/enum';+import { type BooleanNumber, CellValueType } from '../types/enum';import type { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, IWorksheetData } from '../types/interfaces';import { ColumnManager } from './column-manager';import { Range } from './range';diff --git a/packages/core/src/slides/slide-model.ts b/packages/core/src/slides/slide-model.tsindex 907563e8ad..f699140780 100644--- a/packages/core/src/slides/slide-model.ts+++ b/packages/core/src/slides/slide-model.ts@@ -20,8 +20,8 @@ import { DEFAULT_SLIDE } from '../types/const';import type { ISlideData, ISlidePage } from '../types/interfaces';import { PageType } from '../types/interfaces';-export class SlideDataModel extends UnitModel<ISlideData, UniverInstanceType.SLIDE> {- override type: UniverInstanceType.SLIDE = UniverInstanceType.SLIDE;+export class SlideDataModel extends UnitModel<ISlideData, UniverInstanceType.UNIVER_SLIDE> {+ override type: UniverInstanceType.UNIVER_SLIDE = UniverInstanceType.UNIVER_SLIDE;private _snapshot: ISlideData;diff --git a/packages/core/src/univer.ts b/packages/core/src/univer.tsindex 20ae4058fd..a9ce1e2b46 100644--- a/packages/core/src/univer.ts+++ b/packages/core/src/univer.ts@@ -103,27 +103,27 @@ export class Univer {* @deprecated use `createUnit` instead*/createUniverSheet(data: Partial<IWorkbookData>): Workbook {- return this._univerInstanceService.createUnit<IWorkbookData, Workbook>(UniverInstanceType.SHEET, data);+ return this._univerInstanceService.createUnit<IWorkbookData, Workbook>(UniverInstanceType.UNIVER_SHEET, data);}/*** @deprecated use `createUnit` instead*/createUniverDoc(data: Partial<IDocumentData>): DocumentDataModel {- return this._univerInstanceService.createUnit<IDocumentData, DocumentDataModel>(UniverInstanceType.DOC, data);+ return this._univerInstanceService.createUnit<IDocumentData, DocumentDataModel>(UniverInstanceType.UNIVER_DOC, data);}/*** @deprecated use `createUnit` instead*/createUniverSlide(data: Partial<ISlideData>): SlideDataModel {- return this._univerInstanceService.createUnit<ISlideData, SlideDataModel>(UniverInstanceType.SLIDE, data);+ return this._univerInstanceService.createUnit<ISlideData, SlideDataModel>(UniverInstanceType.UNIVER_SLIDE, data);}private _init(injector: Injector): void {- this._univerInstanceService.registerCtorForType(UniverInstanceType.SHEET, Workbook);- this._univerInstanceService.registerCtorForType(UniverInstanceType.DOC, DocumentDataModel);- this._univerInstanceService.registerCtorForType(UniverInstanceType.SLIDE, SlideDataModel);+ this._univerInstanceService.registerCtorForType(UniverInstanceType.UNIVER_SHEET, Workbook);+ this._univerInstanceService.registerCtorForType(UniverInstanceType.UNIVER_DOC, DocumentDataModel);+ this._univerInstanceService.registerCtorForType(UniverInstanceType.UNIVER_SLIDE, SlideDataModel);const univerInstanceService = injector.get(IUniverInstanceService) as UniverInstanceService;univerInstanceService.__setCreateHandler(diff --git a/packages/data-validation/package.json b/packages/data-validation/package.jsonindex abe1794219..057288b354 100644--- a/packages/data-validation/package.json+++ b/packages/data-validation/package.json@@ -67,9 +67,6 @@"@wendellhu/redi": "^0.13.3","rxjs": ">=7.0.0"},- "dependencies": {- "@univerjs/protocol": "^0.1.20"- },"devDependencies": {"@univerjs/core": "workspace:*","@univerjs/shared": "workspace:*",diff --git a/packages/data-validation/src/controllers/dv-resource.controller.ts b/packages/data-validation/src/controllers/dv-resource.controller.tsindex 692a96bb66..625d32e3ca 100644--- a/packages/data-validation/src/controllers/dv-resource.controller.ts+++ b/packages/data-validation/src/controllers/dv-resource.controller.ts@@ -15,9 +15,8 @@*/import type { ISheetDataValidationRule } from '@univerjs/core';-import { Disposable, IResourceManagerService, IUniverInstanceService, LifecycleStages, OnLifecycle } from '@univerjs/core';+import { Disposable, IResourceManagerService, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';import { Inject } from '@wendellhu/redi';-import { UniverType } from '@univerjs/protocol';import { DataValidationModel } from '../models/data-validation-model';type DataValidationJSON = Record<string, ISheetDataValidationRule[]>;@@ -60,7 +59,7 @@ export class DataValidationResourceController extends Disposable {this.disposeWithMe(this._resourceManagerService.registerPluginResource<DataValidationJSON>({pluginName: DATA_VALIDATION_PLUGIN_NAME,- businesses: [UniverType.UNIVER_SHEET],+ businesses: [UniverInstanceType.UNIVER_SHEET],toJson: (unitID) => toJson(unitID),parseJson: (json) => parseJson(json),onUnLoad: (unitID) => {diff --git a/packages/data-validation/src/controllers/dv-sheet.controller.ts b/packages/data-validation/src/controllers/dv-sheet.controller.tsindex 3674a481e5..ebe9010120 100644--- a/packages/data-validation/src/controllers/dv-sheet.controller.ts+++ b/packages/data-validation/src/controllers/dv-sheet.controller.ts@@ -40,7 +40,7 @@ export class DataValidationSheetController extends Disposable {getMutations: (commandInfo) => {if (commandInfo.id === RemoveSheetCommand.id) {const params = commandInfo.params as IRemoveSheetCommandParams;- const unitId = params.unitId || this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();+ const unitId = params.unitId || this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();const workbook = this._univerInstanceService.getUniverSheetInstance(unitId);if (!workbook) {return { redos: [], undos: [] };diff --git a/packages/docs-ui/src/controllers/doc-editor-bridge.controller.ts b/packages/docs-ui/src/controllers/doc-editor-bridge.controller.tsindex 4125690178..85eb4137db 100644--- a/packages/docs-ui/src/controllers/doc-editor-bridge.controller.ts+++ b/packages/docs-ui/src/controllers/doc-editor-bridge.controller.ts@@ -219,7 +219,7 @@ export class DocEditorBridgeController extends Disposable {// })// );- const currentUniverSheet = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.SHEET);+ const currentUniverSheet = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.UNIVER_SHEET);currentUniverSheet.forEach((unit) => {const unitId = unit.getUnitId();const render = this._renderManagerService.getRenderById(unitId);diff --git a/packages/docs-ui/src/controllers/doc-ui.controller.ts b/packages/docs-ui/src/controllers/doc-ui.controller.tsindex 4a34506428..d4fda65409 100644--- a/packages/docs-ui/src/controllers/doc-ui.controller.ts+++ b/packages/docs-ui/src/controllers/doc-ui.controller.ts@@ -111,7 +111,7 @@ export class DocUIController extends Disposable {}private _initDocBackground() {- const firstDocUnitId = this._univerInstanceService.getAllUnitsForType<DocumentDataModel>(UniverInstanceType.DOC)[0].getUnitId();+ const firstDocUnitId = this._univerInstanceService.getAllUnitsForType<DocumentDataModel>(UniverInstanceType.UNIVER_DOC)[0].getUnitId();if (firstDocUnitId == null) {return;}@@ -126,7 +126,7 @@ export class DocUIController extends Disposable {private _initFocusHandler(): void {this.disposeWithMe(- this._layoutService.registerFocusHandler(UniverInstanceType.DOC, () => {+ this._layoutService.registerFocusHandler(UniverInstanceType.UNIVER_DOC, () => {const textSelectionManagerService = this._injector.get(ITextSelectionRenderManager);textSelectionManagerService.focus();})diff --git a/packages/docs-ui/src/controllers/menu/menu.ts b/packages/docs-ui/src/controllers/menu/menu.tsindex 6c04ed9909..71a5bab859 100644--- a/packages/docs-ui/src/controllers/menu/menu.ts+++ b/packages/docs-ui/src/controllers/menu/menu.ts@@ -94,7 +94,7 @@ export function BoldMenuItemFactory(accessor: IAccessor): IMenuButtonItem {return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -130,7 +130,7 @@ export function ItalicMenuItemFactory(accessor: IAccessor): IMenuButtonItem {return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -166,7 +166,7 @@ export function UnderlineMenuItemFactory(accessor: IAccessor): IMenuButtonItem {return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -202,7 +202,7 @@ export function StrikeThroughMenuItemFactory(accessor: IAccessor): IMenuButtonItreturn disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -237,7 +237,7 @@ export function SubscriptMenuItemFactory(accessor: IAccessor): IMenuButtonItem {return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -272,7 +272,7 @@ export function SuperscriptMenuItemFactory(accessor: IAccessor): IMenuButtonItemreturn disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -316,7 +316,7 @@ export function FontFamilySelectorMenuItemFactory(accessor: IAccessor): IMenuSelsubscriber.next(defaultValue);return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -361,7 +361,7 @@ export function FontSizeSelectorMenuItemFactory(accessor: IAccessor): IMenuSelecreturn disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -397,7 +397,7 @@ export function TextColorSelectorMenuItemFactory(accessor: IAccessor): IMenuSelesubscriber.next(defaultColor);return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),// disabled$: getCurrentSheetDisabled$(accessor),};}@@ -433,7 +433,7 @@ export function AlignLeftMenuItemFactory(accessor: IAccessor): IMenuButtonItem {return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -468,7 +468,7 @@ export function AlignCenterMenuItemFactory(accessor: IAccessor): IMenuButtonItemreturn disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -503,7 +503,7 @@ export function AlignRightMenuItemFactory(accessor: IAccessor): IMenuButtonItemreturn disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -538,7 +538,7 @@ export function AlignJustifyMenuItemFactory(accessor: IAccessor): IMenuButtonItereturn disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -550,7 +550,7 @@ export function OrderListMenuItemFactory(accessor: IAccessor): IMenuButtonItem {icon: 'OrderSingle',tooltip: 'toolbar.order',positions: [MenuPosition.TOOLBAR_START],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -562,7 +562,7 @@ export function BulletListMenuItemFactory(accessor: IAccessor): IMenuButtonItemicon: 'UnorderSingle',tooltip: 'toolbar.unorder',positions: [MenuPosition.TOOLBAR_START],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -607,7 +607,7 @@ export function BackgroundColorSelectorMenuItemFactory(accessor: IAccessor): IMesubscriber.next(defaultColor);return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.DOC),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}diff --git a/packages/docs-ui/src/controllers/text-selection.controller.ts b/packages/docs-ui/src/controllers/text-selection.controller.tsindex a212ce682c..c218b3fc24 100644--- a/packages/docs-ui/src/controllers/text-selection.controller.ts+++ b/packages/docs-ui/src/controllers/text-selection.controller.ts@@ -182,9 +182,9 @@ export class TextSelectionController extends Disposable {/*** The object for selecting data in the editor is set to the current sheet.*/- const sheetInstances = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.SHEET);+ const sheetInstances = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (sheetInstances.length > 0) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;this._editorService.setOperationSheetUnitId(workbook.getUnitId());// this._editorService.setOperationSheetSubUnitId(workbook.getActiveSheet().getSheetId());}@@ -241,7 +241,7 @@ export class TextSelectionController extends Disposable {}private _getDocObjectById(unitId: string) {- if (this._univerInstanceService.getUnitType(unitId) !== UniverInstanceType.DOC) {+ if (this._univerInstanceService.getUnitType(unitId) !== UniverInstanceType.UNIVER_DOC) {return null;}diff --git a/packages/docs-ui/src/docs-ui-plugin.ts b/packages/docs-ui/src/docs-ui-plugin.tsindex 427f43b406..c1e59a944d 100644--- a/packages/docs-ui/src/docs-ui-plugin.ts+++ b/packages/docs-ui/src/docs-ui-plugin.ts@@ -59,7 +59,7 @@ import { BackScrollController } from './controllers/back-scroll.controller';export class UniverDocsUIPlugin extends Plugin {static override pluginName = DOC_UI_PLUGIN_NAME;- static override type = UniverInstanceType.DOC;+ static override type = UniverInstanceType.UNIVER_DOC;constructor(private readonly _config: IUniverDocsUIConfig,diff --git a/packages/docs-ui/src/views/doc-canvas-view.ts b/packages/docs-ui/src/views/doc-canvas-view.tsindex a6bfda115b..71e885c5ea 100644--- a/packages/docs-ui/src/views/doc-canvas-view.ts+++ b/packages/docs-ui/src/views/doc-canvas-view.ts@@ -53,11 +53,11 @@ export class DocCanvasView extends RxDisposable {this._create(unitId);});- this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.DOC).pipe(takeUntil(this.dispose$)).subscribe((documentModel) => {+ this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC).pipe(takeUntil(this.dispose$)).subscribe((documentModel) => {this._create(documentModel?.getUnitId());});- this._univerInstanceService.getAllUnitsForType<DocumentDataModel>(UniverInstanceType.DOC).forEach((documentModel) => {+ this._univerInstanceService.getAllUnitsForType<DocumentDataModel>(UniverInstanceType.UNIVER_DOC).forEach((documentModel) => {this._create(documentModel.getUnitId());});}diff --git a/packages/docs/src/basics/component-tools.ts b/packages/docs/src/basics/component-tools.tsindex e075cfe2f9..f3723b90cc 100644--- a/packages/docs/src/basics/component-tools.ts+++ b/packages/docs/src/basics/component-tools.ts@@ -27,7 +27,7 @@ export function getDocObject(univerInstanceService: IUniverInstanceService,renderManagerService: IRenderManagerService): Nullable<IDocObjectParam> {- const documentModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.DOC);+ const documentModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);if (!documentModel) {return null;}diff --git a/packages/docs/src/commands/commands/__tests__/clipboard.command.spec.ts b/packages/docs/src/commands/commands/__tests__/clipboard.command.spec.tsindex 0ab6c4e0e1..af862501b9 100644--- a/packages/docs/src/commands/commands/__tests__/clipboard.command.spec.ts+++ b/packages/docs/src/commands/commands/__tests__/clipboard.command.spec.ts@@ -101,7 +101,7 @@ describe('test cases in clipboard', () => {function getFormatValueAt(key: keyof IStyleBase, pos: number) {const univerInstanceService = get(IUniverInstanceService);- const docsModel = univerInstanceService.getUnit<DocumentDataModel>('test-doc', UniverInstanceType.DOC);+ const docsModel = univerInstanceService.getUnit<DocumentDataModel>('test-doc', UniverInstanceType.UNIVER_DOC);if (docsModel?.body?.textRuns == null) {return;@@ -118,7 +118,7 @@ describe('test cases in clipboard', () => {function getTextByPosition(start: number, end: number) {const univerInstanceService = get(IUniverInstanceService);- const docsModel = univerInstanceService.getUnit<DocumentDataModel>('test-doc', UniverInstanceType.DOC);+ const docsModel = univerInstanceService.getUnit<DocumentDataModel>('test-doc', UniverInstanceType.UNIVER_DOC);return docsModel?.body?.dataStream.slice(start, end);}diff --git a/packages/docs/src/commands/commands/__tests__/inline-format.command.spec.ts b/packages/docs/src/commands/commands/__tests__/inline-format.command.spec.tsindex edd91f119a..04226eedd8 100644--- a/packages/docs/src/commands/commands/__tests__/inline-format.command.spec.ts+++ b/packages/docs/src/commands/commands/__tests__/inline-format.command.spec.ts@@ -54,7 +54,7 @@ describe('Test inline format commands', () => {function getFormatValueAt(key: keyof IStyleBase, pos: number) {const univerInstanceService = get(IUniverInstanceService);- const docsModel = univerInstanceService.getUnit<DocumentDataModel>('test-doc', UniverInstanceType.DOC);+ const docsModel = univerInstanceService.getUnit<DocumentDataModel>('test-doc', UniverInstanceType.UNIVER_DOC);if (docsModel?.body?.textRuns == null) {return;diff --git a/packages/docs/src/commands/commands/__tests__/replace-content.command.spec.ts b/packages/docs/src/commands/commands/__tests__/replace-content.command.spec.tsindex a15442192a..44ae71e649 100644--- a/packages/docs/src/commands/commands/__tests__/replace-content.command.spec.ts+++ b/packages/docs/src/commands/commands/__tests__/replace-content.command.spec.ts@@ -62,7 +62,7 @@ describe('replace or cover content of document', () => {function getDataStream() {const univerInstanceService = get(IUniverInstanceService);- const docsModel = univerInstanceService.getUnit<DocumentDataModel>('test-doc', UniverInstanceType.DOC);+ const docsModel = univerInstanceService.getUnit<DocumentDataModel>('test-doc', UniverInstanceType.UNIVER_DOC);if (docsModel?.body?.dataStream == null) {return '';diff --git a/packages/docs/src/doc-plugin.ts b/packages/docs/src/doc-plugin.tsindex be07d9d855..c7d95db1b8 100644--- a/packages/docs/src/doc-plugin.ts+++ b/packages/docs/src/doc-plugin.ts@@ -71,7 +71,7 @@ const PLUGIN_NAME = 'docs';export class UniverDocsPlugin extends Plugin {static override pluginName = PLUGIN_NAME;- static override type = UniverInstanceType.DOC;+ static override type = UniverInstanceType.UNIVER_DOC;private _config: IUniverDocsConfig;diff --git a/packages/docs/src/services/doc-skeleton-manager.service.ts b/packages/docs/src/services/doc-skeleton-manager.service.tsindex 7fad9228ee..8eb54f35bd 100644--- a/packages/docs/src/services/doc-skeleton-manager.service.ts+++ b/packages/docs/src/services/doc-skeleton-manager.service.ts@@ -84,10 +84,10 @@ export class DocSkeletonManagerService extends RxDisposable {this._setCurrent(docViewModel);});- this._univerInstanceService.getTypeOfUnitDisposed$(UniverInstanceType.DOC).pipe(takeUntil(this.dispose$)).subscribe((documentModel) => {+ this._univerInstanceService.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_DOC).pipe(takeUntil(this.dispose$)).subscribe((documentModel) => {this._docSkeletonMap.delete(documentModel.getUnitId());- this._currentSkeletonUnitId = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.DOC)?.getUnitId() ?? '';+ this._currentSkeletonUnitId = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC)?.getUnitId() ?? '';});}diff --git a/packages/docs/src/services/doc-view-model-manager.service.ts b/packages/docs/src/services/doc-view-model-manager.service.tsindex 11f693d04d..e06b9b4578 100644--- a/packages/docs/src/services/doc-view-model-manager.service.ts+++ b/packages/docs/src/services/doc-view-model-manager.service.ts@@ -49,16 +49,16 @@ export class DocViewModelManagerService extends RxDisposable {private _init() {this._univerInstanceService- .getCurrentTypeOfUnit$<DocumentDataModel>(UniverInstanceType.DOC)+ .getCurrentTypeOfUnit$<DocumentDataModel>(UniverInstanceType.UNIVER_DOC).pipe(takeUntil(this.dispose$)).subscribe((documentModel) => {this._create(documentModel);});- this._univerInstanceService.getAllUnitsForType<DocumentDataModel>(UniverInstanceType.DOC).forEach((documentModel) => {+ this._univerInstanceService.getAllUnitsForType<DocumentDataModel>(UniverInstanceType.UNIVER_DOC).forEach((documentModel) => {this._create(documentModel);});- this._univerInstanceService.getTypeOfUnitDisposed$(UniverInstanceType.DOC).pipe(takeUntil(this.dispose$)).subscribe((documentModel) => {+ this._univerInstanceService.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_DOC).pipe(takeUntil(this.dispose$)).subscribe((documentModel) => {this._docViewModelMap.delete(documentModel.getUnitId());});}diff --git a/packages/engine-formula/src/engine/analysis/__tests__/create-command-test-bed.ts b/packages/engine-formula/src/engine/analysis/__tests__/create-command-test-bed.tsindex c8abbe874a..16ee928c99 100644--- a/packages/engine-formula/src/engine/analysis/__tests__/create-command-test-bed.ts+++ b/packages/engine-formula/src/engine/analysis/__tests__/create-command-test-bed.ts@@ -234,7 +234,7 @@ export function createCommandTestBed(workbookData?: IWorkbookData, dependencies?*/class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;private _formulaDataModel: FormulaDataModel | null = null;@@ -265,7 +265,7 @@ export function createCommandTestBed(workbookData?: IWorkbookData, dependencies?logService.setLogLevel(LogLevel.SILENT); // change this to `true` to debug tests via logsconst sheetData: ISheetData = {};- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const sheetId = workbook.getActiveSheet().getSheetId();workbook.getSheets().forEach((sheet) => {diff --git a/packages/engine-formula/src/engine/utils/reference.ts b/packages/engine-formula/src/engine/utils/reference.tsindex 31d277ccc0..ded2267bb9 100644--- a/packages/engine-formula/src/engine/utils/reference.ts+++ b/packages/engine-formula/src/engine/utils/reference.ts@@ -311,7 +311,7 @@ export function isReferenceStringWithEffectiveColumn(refString: string) {/*** implement getSheetIdByName* function getSheetIdByName(name: string) {- return univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)?.getSheetBySheetName(name)?.getSheetId() || '';+ return univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)?.getSheetBySheetName(name)?.getSheetId() || '';}*/export function getRangeWithRefsString(refString: string, getSheetIdByName: (name: string) => string): IUnitRangeWithName[] {diff --git a/packages/engine-formula/src/functions/__tests__/create-function-test-bed.ts b/packages/engine-formula/src/functions/__tests__/create-function-test-bed.tsindex c98326bee4..1bf5e0aedc 100644--- a/packages/engine-formula/src/functions/__tests__/create-function-test-bed.ts+++ b/packages/engine-formula/src/functions/__tests__/create-function-test-bed.ts@@ -157,7 +157,7 @@ export function createFunctionTestBed(workbookData?: IWorkbookData, dependencies*/class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;private _formulaDataModel: FormulaDataModel | null = null;@@ -213,7 +213,7 @@ export function createFunctionTestBed(workbookData?: IWorkbookData, dependencieslogService.setLogLevel(LogLevel.SILENT); // change this to `true` to debug tests via logsconst sheetData: ISheetData = {};- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const sheetId = workbook.getActiveSheet().getSheetId();workbook.getSheets().forEach((sheet) => {diff --git a/packages/engine-formula/src/models/__tests__/create-command-test-bed.ts b/packages/engine-formula/src/models/__tests__/create-command-test-bed.tsindex 87185e9956..b1be6097c8 100644--- a/packages/engine-formula/src/models/__tests__/create-command-test-bed.ts+++ b/packages/engine-formula/src/models/__tests__/create-command-test-bed.ts@@ -60,7 +60,7 @@ export function createCommandTestBed(workbookData?: IWorkbookData, dependencies?*/class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/engine-formula/src/models/formula-data.model.ts b/packages/engine-formula/src/models/formula-data.model.tsindex 65679df7ec..f5a51f21c4 100644--- a/packages/engine-formula/src/models/formula-data.model.ts+++ b/packages/engine-formula/src/models/formula-data.model.ts@@ -257,13 +257,13 @@ export class FormulaDataModel extends Disposable {initFormulaData() {// Load formula data from workbook config data.- const allSheets = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.SHEET);+ const allSheets = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (allSheets.length === 0) {return;}// Since there is at least a sheet, there must be current univer sheet instance.- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();this._formulaData[unitId] = {};@@ -277,7 +277,7 @@ export class FormulaDataModel extends Disposable {}getCalculateData() {- const unitAllSheet = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.SHEET);+ const unitAllSheet = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.UNIVER_SHEET);const allUnitData: IUnitData = {};diff --git a/packages/engine-formula/src/services/current-data.service.ts b/packages/engine-formula/src/services/current-data.service.tsindex 95bcc41c47..0abd5e193b 100644--- a/packages/engine-formula/src/services/current-data.service.ts+++ b/packages/engine-formula/src/services/current-data.service.ts@@ -366,9 +366,9 @@ export class FormulaCurrentConfigService extends Disposable implements IFormulaC}private _loadSheetData() {- const unitAllSheet = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.SHEET);+ const unitAllSheet = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.UNIVER_SHEET);- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook?.getActiveSheet();this._executeUnitId = workbook?.getUnitId();diff --git a/packages/facade/src/apis/__tests__/create-test-bed.ts b/packages/facade/src/apis/__tests__/create-test-bed.tsindex be958b35e6..d3421fc690 100644--- a/packages/facade/src/apis/__tests__/create-test-bed.ts+++ b/packages/facade/src/apis/__tests__/create-test-bed.ts@@ -87,7 +87,7 @@ export function createTestBed(workbookData?: IWorkbookData, dependencies?: Depenclass TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/facade/src/apis/facade.ts b/packages/facade/src/apis/facade.tsindex 94e01a39c3..66639b3422 100644--- a/packages/facade/src/apis/facade.ts+++ b/packages/facade/src/apis/facade.ts@@ -71,7 +71,7 @@ export class FUniver {* @returns Spreadsheet API instance.*/createUniverSheet(data: Partial<IWorkbookData>): FWorkbook {- const workbook = this._univerInstanceService.createUnit<IWorkbookData, Workbook>(UniverInstanceType.SHEET, data);+ const workbook = this._univerInstanceService.createUnit<IWorkbookData, Workbook>(UniverInstanceType.UNIVER_SHEET, data);return this._injector.createInstance(FWorkbook, workbook);}@@ -81,7 +81,7 @@ export class FUniver {* @returns Document API instance.*/createUniverDoc(data: Partial<IDocumentData>): FDocument {- const document = this._univerInstanceService.createUnit<IDocumentData, DocumentDataModel>(UniverInstanceType.DOC, data);+ const document = this._univerInstanceService.createUnit<IDocumentData, DocumentDataModel>(UniverInstanceType.UNIVER_DOC, data);return this._injector.createInstance(FDocument, document);}@@ -118,7 +118,7 @@ export class FUniver {* @returns the currently focused Univer spreadsheet.*/getActiveWorkbook(): FWorkbook | null {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) {return null;}diff --git a/packages/facade/src/apis/sheets/__tests__/create-test-bed.ts b/packages/facade/src/apis/sheets/__tests__/create-test-bed.tsindex 29e489bf89..c5533a7f10 100644--- a/packages/facade/src/apis/sheets/__tests__/create-test-bed.ts+++ b/packages/facade/src/apis/sheets/__tests__/create-test-bed.ts@@ -74,7 +74,7 @@ export function createTestBed(workbookData?: IWorkbookData, dependencies?: Depenclass TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/facade/src/apis/sheets/f-workbook.ts b/packages/facade/src/apis/sheets/f-workbook.tsindex 6d7cd0682b..9e0e468a82 100644--- a/packages/facade/src/apis/sheets/f-workbook.ts+++ b/packages/facade/src/apis/sheets/f-workbook.ts@@ -168,7 +168,7 @@ export class FWorkbook {onSelectionChange(callback: (selections: IRange[]) => void): IDisposable {return toDisposable(this._selectionManagerService.selectionMoveEnd$.subscribe((selections) => {- if (this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId() !== this.id) {+ if (this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId() !== this.id) {return;}diff --git a/packages/find-replace/src/controllers/find-replace.menu.ts b/packages/find-replace/src/controllers/find-replace.menu.tsindex 4f8fe2ac3e..ea6f384078 100644--- a/packages/find-replace/src/controllers/find-replace.menu.ts+++ b/packages/find-replace/src/controllers/find-replace.menu.ts@@ -32,7 +32,7 @@ export function FindReplaceMenuItemFactory(accessor: IAccessor): IMenuButtonItemgroup: MenuGroup.TOOLBAR_OTHERS,type: MenuItemType.BUTTON,positions: [MenuPosition.TOOLBAR_START],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: combineLatest([contextService.subscribeContextValue$(EDITOR_ACTIVATED),contextService.subscribeContextValue$(FOCUSING_SHEET),diff --git a/packages/rpc/src/controllers/data-sync/data-sync-primary.controller.ts b/packages/rpc/src/controllers/data-sync/data-sync-primary.controller.tsindex 54584e47cf..f225da697b 100644--- a/packages/rpc/src/controllers/data-sync/data-sync-primary.controller.ts+++ b/packages/rpc/src/controllers/data-sync/data-sync-primary.controller.ts@@ -74,18 +74,18 @@ export class DataSyncPrimaryController extends RxDisposable {}private _init(): void {- this._univerInstanceService.getTypeOfUnitAdded$<Workbook>(UniverInstanceType.SHEET).pipe(takeUntil(this.dispose$)).subscribe((sheet) => {+ this._univerInstanceService.getTypeOfUnitAdded$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((sheet) => {this._syncingUnits.add(sheet.getUnitId());// If a sheet is created, it should sync the data to the worker thread.this._remoteInstanceService.createInstance({unitID: sheet.getUnitId(),- type: UniverInstanceType.SHEET,+ type: UniverInstanceType.UNIVER_SHEET,snapshot: sheet.getSnapshot(),});});- this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => {+ this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => {this._syncingUnits.delete(workbook.getUnitId());// If a sheet is disposed, it should sync the data to the worker thread.this._remoteInstanceService.disposeInstance({diff --git a/packages/rpc/src/services/remote-instance/remote-instance.service.ts b/packages/rpc/src/services/remote-instance/remote-instance.service.tsindex efe1084565..8afb82abf2 100644--- a/packages/rpc/src/services/remote-instance/remote-instance.service.ts+++ b/packages/rpc/src/services/remote-instance/remote-instance.service.ts@@ -86,8 +86,8 @@ export class WebWorkerRemoteInstanceService implements IRemoteInstanceService {const { type, snapshot } = params;try {switch (type) {- case UniverInstanceType.SHEET:- this._univerInstanceService.createUnit(UniverInstanceType.SHEET, snapshot);+ case UniverInstanceType.UNIVER_SHEET:+ this._univerInstanceService.createUnit(UniverInstanceType.UNIVER_SHEET, snapshot);return true;default:throw new Error(diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/colorScale.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/colorScale.tsxindex a37658aba0..0828eb7aaa 100644--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/colorScale.tsx+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/colorScale.tsx@@ -33,8 +33,8 @@ const createOptionItem = (text: string, localeService: LocaleService) => ({ labeconst TextInput = (props: { id: string; type: CFValueType | 'none';value: number | string;onChange: (v: number | string) => void; className: string }) => {const { type, className, onChange, id, value } = props;const univerInstanceService = useDependency(IUniverInstanceService);- const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();- const subUnitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId();+ const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();+ const subUnitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId();const formulaInitValue = useMemo(() => {return String(value).startsWith('=') ? String(value) : '=';}, [value]);diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/dataBar.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/dataBar.tsxindex f4b9e26b17..d738c2789f 100644--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/dataBar.tsx+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/dataBar.tsx@@ -33,8 +33,8 @@ const createOptionItem = (text: CFValueType, localeService: LocaleService) => ({const InputText = (props: { disabled?: boolean; id: string; className: string; type: CFValueType;value: string | number;onChange: (v: string | number) => void }) => {const { onChange, className, value, type, id, disabled = false } = props;const univerInstanceService = useDependency(IUniverInstanceService);- const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();- const subUnitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId();+ const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();+ const subUnitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId();const _value = useRef(value);const config = useMemo(() => {if ([CFValueType.percentile, CFValueType.percent].includes(type)) {diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/formula.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/formula.tsxindex be9f19fb2d..377968d146 100644--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/formula.tsx+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/formula.tsx@@ -31,7 +31,7 @@ export const FormulaStyleEditor = (props: IStyleEditorProps) => {const { onChange, interceptorManager } = props;const localeService = useDependency(LocaleService);const univerInstanceService = useDependency(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const rule = props.rule?.type === CFRuleType.highlightCell ? props.rule : undefined as IRankHighlightCell | IAverageHighlightCell | undefined;diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/iconSet.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/iconSet.tsxindex 1758b08f42..085fb8cd8f 100644--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/iconSet.tsx+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/iconSet.tsx@@ -39,8 +39,8 @@ const getIcon = (iconType: string, iconId: string | number) => {const TextInput = (props: { id: number; type: CFValueType; value: number | string;onChange: (v: number | string) => void; error?: string }) => {const univerInstanceService = useDependency(IUniverInstanceService);- const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();- const subUnitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId();+ const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();+ const subUnitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId();const className = useMemo(() => {if (props.error) {return styles.errorInput;diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsxindex 195796bda0..17d39e9927 100644--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsx+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsx@@ -47,8 +47,8 @@ interface IRuleEditProps {onCancel: () => void;}-const getUnitId = (univerInstanceService: IUniverInstanceService) => univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();-const getSubUnitId = (univerInstanceService: IUniverInstanceService) => univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId();+const getUnitId = (univerInstanceService: IUniverInstanceService) => univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();+const getSubUnitId = (univerInstanceService: IUniverInstanceService) => univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId();export const RuleEdit = (props: IRuleEditProps) => {const localeService = useDependency(LocaleService);@@ -184,7 +184,7 @@ export const RuleEdit = (props: IRuleEditProps) => {const handleSubmit = () => {const beforeSubmitResult = interceptorManager.fetchThroughInterceptors(interceptorManager.getInterceptPoints().beforeSubmit)(true, null);const getRanges = () => {- const worksheet = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet();+ const worksheet = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet();const ranges = rangeResult.current.map((range) => setEndForRange(range, worksheet.getRowCount(), worksheet.getColumnCount()));const result = ranges.filter((range) => !(Number.isNaN(range.startRow) || Number.isNaN(range.startColumn)));return result;diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsxindex a5047f4b6e..b036b63db8 100644--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx@@ -113,7 +113,7 @@ export const RuleList = (props: IRuleListProps) => {const localeService = useDependency(LocaleService);const conditionalFormattingI18nController = useDependency(ConditionalFormattingI18nController);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const worksheet = workbook.getActiveSheet();const subUnitId = worksheet.getSheetId();@@ -176,7 +176,7 @@ export const RuleList = (props: IRuleListProps) => {const commandList = [SetSelectionsOperation.id, AddConditionalRuleMutation.id, SetConditionalRuleMutation.id, DeleteConditionalRuleMutation.id, MoveConditionalRuleMutation.id];const disposable = commandService.onCommandExecuted((commandInfo) => {const { id, params } = commandInfo;- const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();+ const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();if (commandList.includes(id) && (params as { unitId: string }).unitId === unitId) {commandSubscribe.next(null);}@@ -239,8 +239,8 @@ export const RuleList = (props: IRuleListProps) => {}, []);const handleDelete = (rule: IConditionFormattingRule) => {- const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();- const subUnitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId();+ const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();+ const subUnitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId();commandService.executeCommand(DeleteCfCommand.id, { unitId, subUnitId, cfId: rule.cfId } as IDeleteCfCommandParams);};@@ -250,8 +250,8 @@ export const RuleList = (props: IRuleListProps) => {const handleDragStop = (_layout: unknown, from: { y: number }, to: { y: number }) => {draggingIdSet(-1);- const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();- const subUnitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId();+ const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();+ const subUnitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId();const getSaveIndex = (index: number) => {const length = ruleList.length;return Math.min(length - 1, Math.max(0, index));diff --git a/packages/sheets-conditional-formatting-ui/src/controllers/cf.auto-fill.controller.ts b/packages/sheets-conditional-formatting-ui/src/controllers/cf.auto-fill.controller.tsindex 83319dd0ef..eebebbb4f8 100644--- a/packages/sheets-conditional-formatting-ui/src/controllers/cf.auto-fill.controller.ts+++ b/packages/sheets-conditional-formatting-ui/src/controllers/cf.auto-fill.controller.ts@@ -51,8 +51,8 @@ export class ConditionalFormattingAutoFillController extends Disposable {matrixMap: Map<string, ObjectMatrix<1>>,mapFunc: (row: number, col: number) => ({ row: number; col: number })) => {- const unitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();- const subUnitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId();+ const unitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();+ const subUnitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId();const sourceRange = {startRow: sourceStartCell.row,startColumn: sourceStartCell.col,@@ -142,8 +142,8 @@ export class ConditionalFormattingAutoFillController extends Disposable {};const generalApplyFunc = (sourceRange: IDiscreteRange, targetRange: IDiscreteRange) => {- const unitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)?.getUnitId();- const subUnitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)?.getActiveSheet().getSheetId();+ const unitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)?.getUnitId();+ const subUnitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)?.getActiveSheet().getSheetId();const matrixMap: Map<string, ObjectMatrix<1>> = new Map();const redos: IMutationInfo[] = [];diff --git a/packages/sheets-conditional-formatting-ui/src/controllers/cf.clear.controller.ts b/packages/sheets-conditional-formatting-ui/src/controllers/cf.clear.controller.tsindex c380adf0be..3cfe5b1ffb 100644--- a/packages/sheets-conditional-formatting-ui/src/controllers/cf.clear.controller.ts+++ b/packages/sheets-conditional-formatting-ui/src/controllers/cf.clear.controller.ts@@ -46,7 +46,7 @@ export class ConditionalFormattingClearController extends Disposable {if (!ranges) {return defaultV;}- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const allRules = this._conditionalFormattingRuleModel.getSubunitRules(workbook.getUnitId(), worksheet.getSheetId());if (!allRules || !allRules.length) {diff --git a/packages/sheets-conditional-formatting-ui/src/controllers/cf.copy-paste.controller.ts b/packages/sheets-conditional-formatting-ui/src/controllers/cf.copy-paste.controller.tsindex e82860ec81..b0cb07d7b3 100644--- a/packages/sheets-conditional-formatting-ui/src/controllers/cf.copy-paste.controller.ts+++ b/packages/sheets-conditional-formatting-ui/src/controllers/cf.copy-paste.controller.ts@@ -123,7 +123,7 @@ export class ConditionalFormattingCopyPasteController extends Disposable {pasteType: string;}) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const sheet = workbook.getActiveSheet();const unitId = workbook.getUnitId();const subUnitId = sheet.getSheetId();diff --git a/packages/sheets-conditional-formatting-ui/src/controllers/cf.ref-range.controller.ts b/packages/sheets-conditional-formatting-ui/src/controllers/cf.ref-range.controller.tsindex 8bb6cb8b81..ddcf8ceb2e 100644--- a/packages/sheets-conditional-formatting-ui/src/controllers/cf.ref-range.controller.ts+++ b/packages/sheets-conditional-formatting-ui/src/controllers/cf.ref-range.controller.ts@@ -94,7 +94,7 @@ export class RefRangeController extends Disposable {toDisposable(this._conditionalFormattingRuleModel.$ruleChange.subscribe((option) => {const { unitId, subUnitId, rule } = option;- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();if (option.unitId !== workbook.getUnitId() || option.subUnitId !== worksheet.getSheetId()) {return;diff --git a/packages/sheets-conditional-formatting-ui/src/controllers/cf.render.controller.ts b/packages/sheets-conditional-formatting-ui/src/controllers/cf.render.controller.tsindex 76aaba0c29..38610a0495 100644--- a/packages/sheets-conditional-formatting-ui/src/controllers/cf.render.controller.ts+++ b/packages/sheets-conditional-formatting-ui/src/controllers/cf.render.controller.ts@@ -61,7 +61,7 @@ export class RenderController extends Disposable {this.disposeWithMe(this._renderManagerService.currentRender$.subscribe((renderId) => {renderId && register(renderId);}));- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (workbook) {register(workbook.getUnitId());}@@ -70,13 +70,13 @@ export class RenderController extends Disposable {_initSkeleton() {const markDirtySkeleton = () => {this._sheetSkeletonManagerService.reCalculate();- const unitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();+ const unitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();this._renderManagerService.getRenderById(unitId)?.mainComponent?.makeDirty();};// After the conditional formatting is marked dirty to drive a rendering, to trigger the window within the conditional formatting recalculationthis.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(bufferTime(16), filter((v) => {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const worksheet = workbook.getActiveSheet();@@ -85,7 +85,7 @@ export class RenderController extends Disposable {// Sort and delete does not mark dirty.this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(bufferTime(16), filter((v) => {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const worksheet = workbook.getActiveSheet();@@ -95,7 +95,7 @@ export class RenderController extends Disposable {// Once the calculation is complete, a view update is triggered// This rendering does not trigger conditional formatting recalculation,because the rule is not mark dirtythis.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(bufferTime(16), filter((v) => {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const worksheet = workbook.getActiveSheet();diff --git a/packages/sheets-conditional-formatting-ui/src/menu/manage-rule.ts b/packages/sheets-conditional-formatting-ui/src/menu/manage-rule.tsindex c9b8fa95cf..667ae26dd6 100644--- a/packages/sheets-conditional-formatting-ui/src/menu/manage-rule.ts+++ b/packages/sheets-conditional-formatting-ui/src/menu/manage-rule.ts@@ -44,7 +44,7 @@ export const FactoryManageConditionalFormattingRule = (componentManager: Componenew Observable<null>((commandSubscribe) => {const disposable = commandService.onCommandExecuted((commandInfo) => {const { id, params } = commandInfo;- const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)?.getUnitId();+ const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)?.getUnitId();if (commandList.includes(id) && (params as { unitId: string }).unitId === unitId) {commandSubscribe.next(null);}@@ -53,7 +53,7 @@ export const FactoryManageConditionalFormattingRule = (componentManager: Compone})).pipe(debounceTime(16)).subscribe(() => {const ranges = selectionManagerService.getSelections()?.map((selection) => selection.range) || [];- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return;const allRule = conditionalFormattingRuleModel.getSubunitRules(workbook.getUnitId(), workbook.getActiveSheet().getSheetId()) || [];const ruleList = allRule.filter((rule) => rule.ranges.some((ruleRange) => ranges.some((range) => Rectangle.intersects(range, ruleRange))));@@ -65,7 +65,7 @@ export const FactoryManageConditionalFormattingRule = (componentManager: Componenew Observable<null>((commandSubscribe) => {const disposable = commandService.onCommandExecuted((commandInfo) => {const { id, params } = commandInfo;- const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)?.getUnitId();+ const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)?.getUnitId();if (commandList.includes(id) && (params as { unitId: string }).unitId === unitId) {commandSubscribe.next(null);}@@ -73,7 +73,7 @@ export const FactoryManageConditionalFormattingRule = (componentManager: Componereturn () => disposable.dispose();})).pipe(debounceTime(16)).subscribe(() => {- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return;const allRule = conditionalFormattingRuleModel.getSubunitRules(workbook.getUnitId(), workbook.getActiveSheet().getSheetId()) || [];subscriber.next(!!allRule.length);@@ -105,7 +105,7 @@ export const FactoryManageConditionalFormattingRule = (componentManager: Componeicon: key,tooltip: localeService.t('sheet.cf.title'),selections: selections$,- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),} as IMenuSelectorItem;};};diff --git a/packages/sheets-conditional-formatting-ui/src/plugin.ts b/packages/sheets-conditional-formatting-ui/src/plugin.tsindex a891551c71..017ab706a0 100644--- a/packages/sheets-conditional-formatting-ui/src/plugin.ts+++ b/packages/sheets-conditional-formatting-ui/src/plugin.ts@@ -45,7 +45,7 @@ import { ConditionalFormattingClearController } from './controllers/cf.clear.conexport class UniverSheetsConditionalFormattingUIPlugin extends Plugin {static override pluginName = SHEET_CONDITIONAL_FORMATTING_PLUGIN;- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;static commandList = [AddAverageCfCommand,diff --git a/packages/sheets-conditional-formatting/package.json b/packages/sheets-conditional-formatting/package.jsonindex c77ce17f14..4d3a2d1031 100644--- a/packages/sheets-conditional-formatting/package.json+++ b/packages/sheets-conditional-formatting/package.json@@ -72,9 +72,6 @@"dayjs": ">=1.11.0","rxjs": ">=7.0.0"},- "dependencies": {- "@univerjs/protocol": "^0.1.20"- },"devDependencies": {"@univerjs/core": "workspace:*","@univerjs/engine-formula": "workspace:*",diff --git a/packages/sheets-conditional-formatting/src/plugin.ts b/packages/sheets-conditional-formatting/src/plugin.tsindex 4130091495..bd09749c62 100644--- a/packages/sheets-conditional-formatting/src/plugin.ts+++ b/packages/sheets-conditional-formatting/src/plugin.ts@@ -31,7 +31,7 @@ import { ConditionalFormattingFormulaMarkDirty } from './commands/mutations/formexport class SheetsConditionalFormattingPlugin extends Plugin {static override pluginName = SHEET_CONDITIONAL_FORMATTING_PLUGIN;- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;static readonly dependencyList: Dependency[] = [[ConditionalFormattingService], [ConditionalFormattingFormulaService], [ConditionalFormattingRuleModel], [ConditionalFormattingViewModel]];static readonly mutationList = [AddConditionalRuleMutation, DeleteConditionalRuleMutation, SetConditionalRuleMutation, MoveConditionalRuleMutation, ConditionalFormattingFormulaMarkDirty];diff --git a/packages/sheets-conditional-formatting/src/services/__test__/test.util.ts b/packages/sheets-conditional-formatting/src/services/__test__/test.util.tsindex 287cf1ec2a..6615a565bb 100644--- a/packages/sheets-conditional-formatting/src/services/__test__/test.util.ts+++ b/packages/sheets-conditional-formatting/src/services/__test__/test.util.ts@@ -61,7 +61,7 @@ export const createTestBed = (dependencies?: Dependency[]) => {class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets-conditional-formatting/src/services/conditional-formatting.service.ts b/packages/sheets-conditional-formatting/src/services/conditional-formatting.service.tsindex 1ac228405c..4ba46d8b03 100644--- a/packages/sheets-conditional-formatting/src/services/conditional-formatting.service.ts+++ b/packages/sheets-conditional-formatting/src/services/conditional-formatting.service.ts@@ -21,7 +21,6 @@ import { InsertColMutation, InsertRowMutation, MoveColsMutation, MoveRangeMutatiimport { Inject, Injector } from '@wendellhu/redi';import { Subject } from 'rxjs';import { filter } from 'rxjs/operators';-import { UniverType } from '@univerjs/protocol';import type { IDeleteConditionalRuleMutationParams } from '../commands/mutations/delete-conditional-rule.mutation';import { DeleteConditionalRuleMutation, DeleteConditionalRuleMutationUndoFactory } from '../commands/mutations/delete-conditional-rule.mutation';import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';@@ -142,7 +141,7 @@ export class ConditionalFormattingService extends Disposable {this.disposeWithMe(this._resourceManagerService.registerPluginResource<IRuleModelJson[keyof IRuleModelJson]>({pluginName: SHEET_CONDITIONAL_FORMATTING_PLUGIN,- businesses: [UniverType.UNIVER_SHEET],+ businesses: [UniverInstanceType.UNIVER_SHEET],toJson: (unitID) => toJson(unitID),parseJson: (json) => parseJson(json),onUnLoad: (unitID) => {@@ -396,5 +395,5 @@ export class ConditionalFormattingService extends Disposable {}}-const getUnitId = (u: IUniverInstanceService) => u.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();-const getSubUnitId = (u: IUniverInstanceService) => u.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId();+const getUnitId = (u: IUniverInstanceService) => u.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();+const getSubUnitId = (u: IUniverInstanceService) => u.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId();diff --git a/packages/sheets-data-validation/README-zh.md b/packages/sheets-data-validation/README-zh.mdindex 4553990f93..0c271d0586 100644--- a/packages/sheets-data-validation/README-zh.md+++ b/packages/sheets-data-validation/README-zh.md@@ -59,5 +59,5 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {}// 加载初始snapshot-univer.createUnit(UniverInstanceType.SHEET, DEFAULT_WORKBOOK_DATA_DEMO);+univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO);```diff --git a/packages/sheets-data-validation/README.md b/packages/sheets-data-validation/README.mdindex 7ef738731c..537a4fb8fa 100644--- a/packages/sheets-data-validation/README.md+++ b/packages/sheets-data-validation/README.md@@ -58,5 +58,5 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {}// load initial snapshot-univer.createUnit(UniverInstanceType.SHEET, DEFAULT_WORKBOOK_DATA_DEMO);+univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO);```diff --git a/packages/sheets-data-validation/src/controllers/dv-alert.controller.ts b/packages/sheets-data-validation/src/controllers/dv-alert.controller.tsindex d9c31ef524..0e0e8c8b77 100644--- a/packages/sheets-data-validation/src/controllers/dv-alert.controller.ts+++ b/packages/sheets-data-validation/src/controllers/dv-alert.controller.ts@@ -41,7 +41,7 @@ export class DataValidationAlertController extends Disposable {private _initCellAlertPopup() {this.disposeWithMe(this._hoverManagerService.currentCell$.subscribe((cellPos) => {if (cellPos) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const cellData = worksheet.getCell(cellPos.location.row, cellPos.location.col);diff --git a/packages/sheets-data-validation/src/controllers/dv-render.controller.ts b/packages/sheets-data-validation/src/controllers/dv-render.controller.tsindex 6f6f250316..60aad5bdd4 100644--- a/packages/sheets-data-validation/src/controllers/dv-render.controller.ts+++ b/packages/sheets-data-validation/src/controllers/dv-render.controller.ts@@ -173,7 +173,7 @@ export class DataValidationRenderController extends RxDisposable {private _initSkeletonChange() {const markSkeletonDirty = () => {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return;const unitId = workbook.getUnitId();diff --git a/packages/sheets-data-validation/src/controllers/dv.controller.ts b/packages/sheets-data-validation/src/controllers/dv.controller.tsindex c3add0f7ef..e15c278ed3 100644--- a/packages/sheets-data-validation/src/controllers/dv.controller.ts+++ b/packages/sheets-data-validation/src/controllers/dv.controller.ts@@ -78,7 +78,7 @@ export class DataValidationController extends RxDisposable {private _initInstanceChange() {const disposableCollection = new DisposableCollection();- this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET).subscribe((workbook) => {+ this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {disposableCollection.dispose();if (!workbook) {return;@@ -103,7 +103,7 @@ export class DataValidationController extends RxDisposable {this._sheetInterceptorService.interceptCommand({getMutations: (commandInfo) => {if (commandInfo.id === ClearSelectionAllCommand.id) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const worksheet = workbook.getActiveSheet();const subUnitId = worksheet.getSheetId();diff --git a/packages/sheets-data-validation/src/controllers/dv.menu.ts b/packages/sheets-data-validation/src/controllers/dv.menu.tsindex aa77bfaac4..4cfff56bc1 100644--- a/packages/sheets-data-validation/src/controllers/dv.menu.ts+++ b/packages/sheets-data-validation/src/controllers/dv.menu.ts@@ -31,7 +31,7 @@ export function dataValidationMenuFactory(accessor: IAccessor): IMenuItem {group: MenuGroup.TOOLBAR_FORMULAS_INSERT,icon: DataValidationIcon,tooltip: 'dataValidation.title',- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),};}diff --git a/packages/sheets-data-validation/src/plugin.ts b/packages/sheets-data-validation/src/plugin.tsindex a162a4d0e6..27a52b1734 100644--- a/packages/sheets-data-validation/src/plugin.ts+++ b/packages/sheets-data-validation/src/plugin.ts@@ -37,7 +37,7 @@ import { DataValidationPanelService } from './services/data-validation-panel.serexport class UniverSheetsDataValidationPlugin extends Plugin {static override pluginName = DATA_VALIDATION_PLUGIN_NAME;- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: unknown,diff --git a/packages/sheets-data-validation/src/validators/list-validator.ts b/packages/sheets-data-validation/src/validators/list-validator.tsindex 45bd654737..69f593875b 100644--- a/packages/sheets-data-validation/src/validators/list-validator.ts+++ b/packages/sheets-data-validation/src/validators/list-validator.ts@@ -137,7 +137,7 @@ export class ListValidator extends BaseDataValidator {getList(rule: IDataValidationRule, currentUnitId?: string, currentSubUnitId?: string) {const { formula1 = '' } = rule;const univerInstanceService = this.injector.get(IUniverInstanceService);- const workbook = (currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : undefined) ?? univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = (currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : undefined) ?? univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return [];const worksheet = (currentSubUnitId ? workbook.getSheetBySheetId(currentSubUnitId) : undefined) ?? workbook.getActiveSheet();@@ -150,7 +150,7 @@ export class ListValidator extends BaseDataValidator {async getListAsync(rule: IDataValidationRule, currentUnitId?: string, currentSubUnitId?: string) {const { formula1 = '' } = rule;const univerInstanceService = this.injector.get(IUniverInstanceService);- const workbook = (currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : undefined) ?? univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = (currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : undefined) ?? univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) {return [];}diff --git a/packages/sheets-data-validation/src/validators/util.ts b/packages/sheets-data-validation/src/validators/util.tsindex 5954c6dcef..d9bc5a4f89 100644--- a/packages/sheets-data-validation/src/validators/util.ts+++ b/packages/sheets-data-validation/src/validators/util.ts@@ -21,7 +21,7 @@ import { getCellValueOrigin } from '../utils/get-cell-data-origin';export function getSheetRangeValueSet(grid: IUnitRangeName, univerInstanceService: IUniverInstanceService, currUnitId: string, currSubUnitId: string) {const set = new Set<string>();const unitId = grid.unitId || currUnitId;- const workbook = univerInstanceService.getUniverSheetInstance(unitId) ?? univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getUniverSheetInstance(unitId) ?? univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getSheetBySheetName(grid.sheetName) ?? workbook.getSheetBySheetId(currSubUnitId) ?? workbook.getActiveSheet();Range.foreach(grid.range, (row, col) => {const data = worksheet.getCellRaw(row, col);diff --git a/packages/sheets-data-validation/src/views/list/index.tsx b/packages/sheets-data-validation/src/views/list/index.tsxindex 853529edc7..686a27db1f 100644--- a/packages/sheets-data-validation/src/views/list/index.tsx+++ b/packages/sheets-data-validation/src/views/list/index.tsx@@ -35,7 +35,7 @@ export const DataValidationList = memo(() => {const injector = useDependency(Injector);const dataValidationPanelService = useDependency(DataValidationPanelService);const workbook = useObservable(- () => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET),+ () => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET),undefined,true,[]diff --git a/packages/sheets-filter-ui/src/commands/__tests__/sheets-filter.command.spec.ts b/packages/sheets-filter-ui/src/commands/__tests__/sheets-filter.command.spec.tsindex 116ff4a0c6..4e95dfb3e3 100644--- a/packages/sheets-filter-ui/src/commands/__tests__/sheets-filter.command.spec.ts+++ b/packages/sheets-filter-ui/src/commands/__tests__/sheets-filter.command.spec.ts@@ -84,7 +84,7 @@ function createFilterCommandTestBed() {class SheetsFilterCommandTestPlugin extends Plugin {static override pluginName = 'sheets-filter-command-test';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: unknown, @Inject(Injector) protected readonly _injector: Injector) {super();}diff --git a/packages/sheets-filter-ui/src/commands/__tests__/sheets-filter.operation.spec.ts b/packages/sheets-filter-ui/src/commands/__tests__/sheets-filter.operation.spec.tsindex 76bd56bbd4..0ae7be731a 100644--- a/packages/sheets-filter-ui/src/commands/__tests__/sheets-filter.operation.spec.ts+++ b/packages/sheets-filter-ui/src/commands/__tests__/sheets-filter.operation.spec.ts@@ -68,7 +68,7 @@ function createFilterOperationTestBed() {const get = injector.get.bind(injector);class SheetsFilterOperationTestPlugin extends Plugin {- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;static override pluginName = 'sheets-filter-operation-test';constructor(_config: unknown, @Inject(Injector) protected readonly _injector: Injector) {diff --git a/packages/sheets-filter-ui/src/commands/sheets-filter.command.ts b/packages/sheets-filter-ui/src/commands/sheets-filter.command.tsindex 9812212f3c..167c184cdb 100644--- a/packages/sheets-filter-ui/src/commands/sheets-filter.command.ts+++ b/packages/sheets-filter-ui/src/commands/sheets-filter.command.ts@@ -37,7 +37,7 @@ export const SmartToggleSheetsFilterCommand: ICommand = {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);- const currentWorkbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const currentWorkbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);const currentWorksheet = currentWorkbook?.getActiveSheet();if (!currentWorksheet || !currentWorkbook) return false;diff --git a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.tsindex f9bf2535ba..d3561dfd9b 100644--- a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts+++ b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts@@ -53,7 +53,7 @@ function createSheetsFilterMenuTestBed() {const get = injector.get.bind(injector);class TestPlugin extends Plugin {- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;static override pluginName = 'test-plugin';constructor(_config: unknown, override readonly _injector: Injector) {diff --git a/packages/sheets-filter-ui/src/controllers/sheets-filter.menu.ts b/packages/sheets-filter-ui/src/controllers/sheets-filter.menu.tsindex f51a0ddecb..d5f083928e 100644--- a/packages/sheets-filter-ui/src/controllers/sheets-filter.menu.ts+++ b/packages/sheets-filter-ui/src/controllers/sheets-filter.menu.ts@@ -33,7 +33,7 @@ export function SmartToggleFilterMenuItemFactory(accessor: IAccessor): IMenuSeleicon: 'FilterSingle',tooltip: 'sheets-filter.toolbar.smart-toggle-filter-tooltip',positions: [MenuPosition.TOOLBAR_START],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),};}@@ -47,7 +47,7 @@ export function ClearFilterCriteriaMenuItemFactory(accessor: IAccessor): IMenuButype: MenuItemType.BUTTON,title: 'sheets-filter.toolbar.clear-filter-criteria',positions: [SmartToggleSheetsFilterCommand.id],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => model?.hasCriteria$.pipe(map((m) => !m)) ?? of(true))),};}@@ -61,7 +61,7 @@ export function ReCalcFilterMenuItemFactory(accessor: IAccessor): IMenuButtonItetype: MenuItemType.BUTTON,title: 'sheets-filter.toolbar.re-calc-filter-conditions',positions: [SmartToggleSheetsFilterCommand.id],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => model?.hasCriteria$.pipe(map((m) => !m)) ?? of(true))),};}diff --git a/packages/sheets-filter-ui/src/plugin.ts b/packages/sheets-filter-ui/src/plugin.tsindex b697e9c7eb..ec5b2d38c0 100644--- a/packages/sheets-filter-ui/src/plugin.ts+++ b/packages/sheets-filter-ui/src/plugin.ts@@ -26,7 +26,7 @@ import { SheetsFilterRenderController } from './controllers/sheets-filter-renderconst NAME = 'UNIVER_SHEETS_FILTER_UI_PLUGIN';export class UniverSheetsFilterUIPlugin extends Plugin {- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;static override pluginName = NAME;constructor(diff --git a/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.ts b/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.tsindex bf62ccbf23..62dcd0bfb6 100644--- a/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.ts+++ b/packages/sheets-filter-ui/src/services/__tests__/sheets-filter-panel.service.spec.ts@@ -47,7 +47,7 @@ function createSheetsFilterPanelServiceTestBed(workbookData: IWorkbookData) {const get = injector.get.bind(injector);class SheetsFilterPanelTestPlugin extends Plugin {- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;static override pluginName = 'sheets-filter-panel-test';constructor(_config: unknown, @Inject(Injector) protected readonly _injector: Injector) {diff --git a/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsx b/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsxindex 8f2d541b77..c334b46b8f 100644--- a/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsx+++ b/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsx@@ -48,7 +48,7 @@ function createFilterStorybookBed(workbookData: IWorkbookData, locale: LocaleTypconst commandService = get(ICommandService);class TestPlugin extends Plugin {- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;static override pluginName = 'test-plugin';constructor(_config: unknown, override readonly _injector: Injector) {diff --git a/packages/sheets-filter/src/commands/__tests__/sheets-filter.mutation.spec.ts b/packages/sheets-filter/src/commands/__tests__/sheets-filter.mutation.spec.tsindex c451067fb3..61cfc6c42f 100644--- a/packages/sheets-filter/src/commands/__tests__/sheets-filter.mutation.spec.ts+++ b/packages/sheets-filter/src/commands/__tests__/sheets-filter.mutation.spec.ts@@ -98,7 +98,7 @@ function createFilterMutationTestBed(workbookData?: IWorkbookData) {const get = injector.get.bind(injector);class SheetsFilterTestPlugin extends Plugin {- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;static override pluginName = 'SheetsFilterTestPlugin';constructor(_config: unknown, @Inject(Injector) protected readonly _injector: Injector) {diff --git a/packages/sheets-filter/src/models/__tests__/filter-interceptor.spec.ts b/packages/sheets-filter/src/models/__tests__/filter-interceptor.spec.tsindex 533a9319d8..fbd58e870f 100644--- a/packages/sheets-filter/src/models/__tests__/filter-interceptor.spec.ts+++ b/packages/sheets-filter/src/models/__tests__/filter-interceptor.spec.ts@@ -162,7 +162,7 @@ function createFilterTestUniver(dependencies?: Dependency[], workbookData?: IWor* This plugin hooks into Sheet's DI system to expose API to test scripts*/class TestPlugin extends Plugin {- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;static override pluginName = 'test-plugin';constructor(diff --git a/packages/sheets-filter/src/models/__tests__/filter-model.spec.ts b/packages/sheets-filter/src/models/__tests__/filter-model.spec.tsindex 032b5fc88f..da3aeeb25f 100644--- a/packages/sheets-filter/src/models/__tests__/filter-model.spec.ts+++ b/packages/sheets-filter/src/models/__tests__/filter-model.spec.ts@@ -131,7 +131,7 @@ describe('Test filter model and related utils', () => {filterColumn = new FilterColumn('test','sheet1',- get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet()!,+ get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()!,{ colId: 0, customFilters: { customFilters: [{ operator: CustomFilterOperator.LESS_THAN, val: 123 }] } },{ getAlreadyFilteredOutRows() { return new Set(); } });@@ -151,7 +151,7 @@ describe('Test filter model and related utils', () => {filterColumn = new FilterColumn('test','sheet1',- get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet()!,+ get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()!,{ colId: 0, customFilters: { customFilters: [{ operator: CustomFilterOperator.LESS_THAN, val: 123 }] } },{ getAlreadyFilteredOutRows() { return new Set(); } });@@ -169,7 +169,7 @@ describe('Test filter model and related utils', () => {filterColumn = new FilterColumn('test','sheet1',- get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet()!,+ get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()!,{ colId: 0, customFilters: { customFilters: [{ operator: CustomFilterOperator.LESS_THAN, val: 123 }] } },{ getAlreadyFilteredOutRows() { return new Set(); } });@@ -190,7 +190,7 @@ describe('Test filter model and related utils', () => {filterColumn = new FilterColumn('test','sheet1',- get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet()!,+ get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()!,{ colId: 0, customFilters: { customFilters: [{ operator: CustomFilterOperator.LESS_THAN, val: 123 }] } },{ getAlreadyFilteredOutRows() { return new Set(); } });@@ -205,7 +205,7 @@ describe('Test filter model and related utils', () => {filterColumn = new FilterColumn('test','sheet1',- get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet()!,+ get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()!,{ colId: 0, customFilters: { customFilters: [{ operator: CustomFilterOperator.LESS_THAN, val: 123 }] } },{ getAlreadyFilteredOutRows() { return new Set([1]); } });diff --git a/packages/sheets-filter/src/plugin.ts b/packages/sheets-filter/src/plugin.tsindex c4a32c9207..7d2b6f3301 100644--- a/packages/sheets-filter/src/plugin.ts+++ b/packages/sheets-filter/src/plugin.ts@@ -24,7 +24,7 @@ import { SheetsFilterController } from './controllers/sheets-fiter.controller';const NAME = 'UNIVER_SHEETS_FILTER_PLUGIN';export class UniverSheetsFilterPlugin extends Plugin {- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;static override pluginName = NAME;constructor(_config: unknown, @Inject(Injector) protected readonly _injector: Injector) {diff --git a/packages/sheets-filter/src/services/sheet-filter.service.ts b/packages/sheets-filter/src/services/sheet-filter.service.tsindex aa619cbcb0..ae43e20fb8 100644--- a/packages/sheets-filter/src/services/sheet-filter.service.ts+++ b/packages/sheets-filter/src/services/sheet-filter.service.ts@@ -119,7 +119,7 @@ export class SheetsFilterService extends Disposable {private _updateActiveFilterModel() {let workbook: Nullable<Workbook>;try {- workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.SHEET);+ workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);if (!workbook) {this._activeFilterModel$.next(null);return;@@ -148,7 +148,7 @@ export class SheetsFilterService extends Disposable {.pipe(filter(([command]) => command.type === CommandType.MUTATION && FILTER_MUTATIONS.has(command.id))),// source2: activte sheet changes- this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET)+ this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(switchMap((workbook) => workbook?.activeSheet$ ?? of(null)))).subscribe(() => this._updateActiveFilterModel()));}diff --git a/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts b/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.tsindex 9d624add4c..49e9f21fbf 100644--- a/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts+++ b/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts@@ -903,7 +903,7 @@ class SheetsFindReplaceProvider extends Disposable implements IFindReplaceProvid// NOTE: If there are multi Workbook instances then we should create `SheetFindModel` for each of them.// But we don't need to implement that in the foreseeable future.- const currentWorkbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const currentWorkbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (currentWorkbook) {const sheetFind = this._injector.createInstance(SheetFindModel, currentWorkbook);this._findModelsByUnitId.set(currentWorkbook.getUnitId(), sheetFind);diff --git a/packages/sheets-find-replace/src/plugin.ts b/packages/sheets-find-replace/src/plugin.tsindex 34a1825de3..0671c2de58 100644--- a/packages/sheets-find-replace/src/plugin.ts+++ b/packages/sheets-find-replace/src/plugin.ts@@ -24,7 +24,7 @@ const NAME = 'UNIVER_SHEETS_FIND_REPLACE_PLUGIN';export class UniverSheetsFindReplacePlugin extends Plugin {static override pluginName = NAME;- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: unknown,diff --git a/packages/sheets-formula/README-zh.md b/packages/sheets-formula/README-zh.mdindex a87e58d75e..068569c2fd 100644--- a/packages/sheets-formula/README-zh.md+++ b/packages/sheets-formula/README-zh.md@@ -626,7 +626,7 @@ import { CustomFunctionController } from './controllers/custom-function.controllexport class UniverSheetsCustomFunctionPlugin extends Plugin {static override pluginName = FORMULA_UI_PLUGIN_NAME- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(@Inject(Injector) override readonly _injector: Injector) {super();diff --git a/packages/sheets-formula/README.md b/packages/sheets-formula/README.mdindex 1b76ae4ea3..ba16b9fdab 100644--- a/packages/sheets-formula/README.md+++ b/packages/sheets-formula/README.md@@ -626,7 +626,7 @@ import { CustomFunctionController } from './controllers/custom-function.controllexport class UniverSheetsCustomFunctionPlugin extends Plugin {static override pluginName = FORMULA_UI_PLUGIN_NAME- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(@Inject(Injector) override readonly _injector: Injector) {super();diff --git a/packages/sheets-formula/src/commands/operations/__tests__/create-command-test-bed.ts b/packages/sheets-formula/src/commands/operations/__tests__/create-command-test-bed.tsindex 07aa076b3f..0602e287cf 100644--- a/packages/sheets-formula/src/commands/operations/__tests__/create-command-test-bed.ts+++ b/packages/sheets-formula/src/commands/operations/__tests__/create-command-test-bed.ts@@ -55,7 +55,7 @@ export function createCommandTestBed(workbookData?: IWorkbookData, dependencies?*/class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets-formula/src/controllers/__tests__/create-command-test-bed.ts b/packages/sheets-formula/src/controllers/__tests__/create-command-test-bed.tsindex 688bdbfdbe..d48bf3f299 100644--- a/packages/sheets-formula/src/controllers/__tests__/create-command-test-bed.ts+++ b/packages/sheets-formula/src/controllers/__tests__/create-command-test-bed.ts@@ -63,7 +63,7 @@ export function createCommandTestBed(workbookData?: IWorkbookData, dependencies?class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;private _formulaDataModel: FormulaDataModel | null = null;diff --git a/packages/sheets-formula/src/controllers/defined-name.controller.ts b/packages/sheets-formula/src/controllers/defined-name.controller.tsindex c88202d198..70a7569c7d 100644--- a/packages/sheets-formula/src/controllers/defined-name.controller.ts+++ b/packages/sheets-formula/src/controllers/defined-name.controller.ts@@ -69,7 +69,7 @@ export class DefinedNameController extends Disposable {private _changeUnitListener() {toDisposable(- this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET).subscribe(() => {+ this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe(() => {this._unRegisterDescriptions();this._registerDescriptions();})@@ -147,7 +147,7 @@ export class DefinedNameController extends Disposable {}private _getUnitIdAndSheetId() {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (workbook == null) {return {};}diff --git a/packages/sheets-formula/src/controllers/formula-clipboard.controller.ts b/packages/sheets-formula/src/controllers/formula-clipboard.controller.tsindex 8b155f87e1..7988326210 100644--- a/packages/sheets-formula/src/controllers/formula-clipboard.controller.ts+++ b/packages/sheets-formula/src/controllers/formula-clipboard.controller.ts@@ -91,7 +91,7 @@ export class FormulaClipboardController extends Disposable {};const pastedRange = pasteTo.range;const matrix = data;- const workbook = this._currentUniverSheet.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._currentUniverSheet.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const subUnitId = workbook.getActiveSheet().getSheetId();diff --git a/packages/sheets-formula/src/controllers/menu.ts b/packages/sheets-formula/src/controllers/menu.tsindex 73a030ff8e..a67d1fa34f 100644--- a/packages/sheets-formula/src/controllers/menu.ts+++ b/packages/sheets-formula/src/controllers/menu.ts@@ -61,7 +61,7 @@ export function InsertFunctionMenuItemFactory(accessor: IAccessor): IMenuItem {icon: 'MinSingle',},],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),};}diff --git a/packages/sheets-formula/src/controllers/prompt.controller.ts b/packages/sheets-formula/src/controllers/prompt.controller.tsindex 8d6e9a4dd5..48f9f03bc8 100644--- a/packages/sheets-formula/src/controllers/prompt.controller.ts+++ b/packages/sheets-formula/src/controllers/prompt.controller.ts@@ -343,7 +343,7 @@ export class PromptController extends Disposable {private _initialChangeEditor() {this.disposeWithMe(- this._univerInstanceService.getCurrentTypeOfUnit$<DocumentDataModel>(UniverInstanceType.DOC).subscribe((documentDataModel) => {+ this._univerInstanceService.getCurrentTypeOfUnit$<DocumentDataModel>(UniverInstanceType.UNIVER_DOC).subscribe((documentDataModel) => {if (documentDataModel == null) {return;}@@ -1137,7 +1137,7 @@ export class PromptController extends Disposable {const current = this._sheetSkeletonManagerService.getCurrent();if (current == null) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return {unitId: workbook.getUnitId(),diff --git a/packages/sheets-formula/src/controllers/update-formula.controller.ts b/packages/sheets-formula/src/controllers/update-formula.controller.tsindex 628fa617ca..de6648a32b 100644--- a/packages/sheets-formula/src/controllers/update-formula.controller.ts+++ b/packages/sheets-formula/src/controllers/update-formula.controller.ts@@ -405,7 +405,7 @@ export class UpdateFormulaController extends Disposable {toRange: { startRow: toStartRow, endRow: toEndRow },} = params;- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const worksheet = workbook.getActiveSheet();const sheetId = worksheet.getSheetId();@@ -443,7 +443,7 @@ export class UpdateFormulaController extends Disposable {toRange: { startColumn: toStartCol, endColumn: toEndCol },} = params;- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const worksheet = workbook.getActiveSheet();const sheetId = worksheet.getSheetId();@@ -1377,7 +1377,7 @@ export class UpdateFormulaController extends Disposable {}private _getCurrentSheetInfo() {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const sheetId = workbook.getActiveSheet().getSheetId();diff --git a/packages/sheets-formula/src/formula-ui-plugin.ts b/packages/sheets-formula/src/formula-ui-plugin.tsindex e9cda1bb52..c19103d5ab 100644--- a/packages/sheets-formula/src/formula-ui-plugin.ts+++ b/packages/sheets-formula/src/formula-ui-plugin.ts@@ -51,7 +51,7 @@ interface IFormulaUIConfig {}export class UniverSheetsFormulaPlugin extends Plugin {static override pluginName = FORMULA_UI_PLUGIN_NAME;- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(private _config: Partial<IFormulaUIConfig>,diff --git a/packages/sheets-formula/src/services/formula-ref-range.service.ts b/packages/sheets-formula/src/services/formula-ref-range.service.tsindex 69e25f01f5..295b4dd264 100644--- a/packages/sheets-formula/src/services/formula-ref-range.service.ts+++ b/packages/sheets-formula/src/services/formula-ref-range.service.ts@@ -43,7 +43,7 @@ export class FormulaRefRangeService extends Disposable {const sequenceNodes = this._lexerTreeBuilder.sequenceNodesBuilder(formula);const disposableCollection = new DisposableCollection();const handleChange = (params: EffectRefRangeParams) => {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const unitId = workbook.getUnitId();const subUnitId = worksheet.getSheetId();@@ -81,7 +81,7 @@ export class FormulaRefRangeService extends Disposable {if (typeof node === 'object' && node.nodeType === sequenceNodeType.REFERENCE) {const gridRangeName = deserializeRangeWithSheet(node.token);const { range, unitId, sheetName } = gridRangeName;- const workbook = unitId ? this._univerInstanceService.getUniverSheetInstance(unitId) : this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = unitId ? this._univerInstanceService.getUniverSheetInstance(unitId) : this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = sheetName ? workbook?.getSheetBySheetName(sheetName) : workbook?.getActiveSheet();if (!worksheet) {return;diff --git a/packages/sheets-numfmt/src/controllers/__tests__/cell-content.controller.spec.ts b/packages/sheets-numfmt/src/controllers/__tests__/cell-content.controller.spec.tsindex 413361b9ab..16b386bd50 100644--- a/packages/sheets-numfmt/src/controllers/__tests__/cell-content.controller.spec.ts+++ b/packages/sheets-numfmt/src/controllers/__tests__/cell-content.controller.spec.ts@@ -52,7 +52,7 @@ describe('test cell-content', () => {},},};- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();testBed.get(NumfmtCellContent);const value = worksheet.getCell(0, 0);diff --git a/packages/sheets-numfmt/src/controllers/__tests__/editor.controller.spec.ts b/packages/sheets-numfmt/src/controllers/__tests__/editor.controller.spec.tsindex 62a44e22a5..dd5f0f5e62 100644--- a/packages/sheets-numfmt/src/controllers/__tests__/editor.controller.spec.ts+++ b/packages/sheets-numfmt/src/controllers/__tests__/editor.controller.spec.ts@@ -53,7 +53,7 @@ describe('test editor', () => {const univerInstanceService = testBed.get(IUniverInstanceService);testBed.get(NumfmtEditorController);testBed.get(NumfmtCellContent);- workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;worksheet = workbook.getActiveSheet();});diff --git a/packages/sheets-numfmt/src/controllers/__tests__/test.util.ts b/packages/sheets-numfmt/src/controllers/__tests__/test.util.tsindex cedb1bb142..000f7a4fba 100644--- a/packages/sheets-numfmt/src/controllers/__tests__/test.util.ts+++ b/packages/sheets-numfmt/src/controllers/__tests__/test.util.ts@@ -54,7 +54,7 @@ export const createTestBed = (dependencies?: Dependency[]) => {class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets-numfmt/src/controllers/numfmt.controller.ts b/packages/sheets-numfmt/src/controllers/numfmt.controller.tsindex 49941890c3..1584d5ec38 100644--- a/packages/sheets-numfmt/src/controllers/numfmt.controller.ts+++ b/packages/sheets-numfmt/src/controllers/numfmt.controller.ts@@ -102,7 +102,7 @@ export class NumfmtController extends Disposable implements INumfmtController {if (!range) {return false;}- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const sheet = workbook.getActiveSheet();const cellValue = sheet.getCellRaw(range.startRow, range.startColumn);@@ -226,7 +226,7 @@ export class NumfmtController extends Disposable implements INumfmtController {})).subscribe(({ disposableCollection, selectionRanges }) => {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;this.openPanel();disposableCollection.add(this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {diff --git a/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.ts b/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.tsindex 5bcb86b8bd..7ced673634 100644--- a/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.ts+++ b/packages/sheets-numfmt/src/controllers/numfmt.editor.controller.ts@@ -201,7 +201,7 @@ export class NumfmtEditorController extends Disposable {getMutations(command) {switch (command.id) {case SetRangeValuesCommand.id: {- const workbook = self._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = self._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const subUnitId = workbook.getActiveSheet().getSheetId();const list = self._collectEffectMutation.getEffects();diff --git a/packages/sheets-numfmt/src/menu/menu.ts b/packages/sheets-numfmt/src/menu/menu.tsindex 2a6968027d..6a4c4b5190 100644--- a/packages/sheets-numfmt/src/menu/menu.ts+++ b/packages/sheets-numfmt/src/menu/menu.ts@@ -52,7 +52,7 @@ export const CurrencyMenuItem = (componentManager: ComponentManager) => {type: MenuItemType.BUTTON,group: MenuGroup.TOOLBAR_FORMULAS_INSERT,positions: [MenuPosition.TOOLBAR_START],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),};};@@ -69,7 +69,7 @@ export const AddDecimalMenuItem = (componentManager: ComponentManager) => {type: MenuItemType.BUTTON,positions: [MenuPosition.TOOLBAR_START],group: MenuGroup.TOOLBAR_FORMULAS_INSERT,- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),});};@@ -84,7 +84,7 @@ export const SubtractDecimalMenuItem = (componentManager: ComponentManager) => {type: MenuItemType.BUTTON,group: MenuGroup.TOOLBAR_FORMULAS_INSERT,positions: [MenuPosition.TOOLBAR_START],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),});};@@ -100,7 +100,7 @@ export const PercentMenuItem = (componentManager: ComponentManager) => {type: MenuItemType.BUTTON,group: MenuGroup.TOOLBAR_FORMULAS_INSERT,positions: [MenuPosition.TOOLBAR_START],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),});};@@ -175,7 +175,7 @@ export const FactoryOtherMenuItem = (componentManager: ComponentManager) => {},],value$,- hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(_accessor),} as IMenuSelectorItem;};diff --git a/packages/sheets-numfmt/src/numfmt-plugin.ts b/packages/sheets-numfmt/src/numfmt-plugin.tsindex 9121a66739..356c364121 100644--- a/packages/sheets-numfmt/src/numfmt-plugin.ts+++ b/packages/sheets-numfmt/src/numfmt-plugin.ts@@ -28,7 +28,7 @@ import { UserHabitController } from './controllers/user-habit.controller';export class UniverSheetsNumfmtPlugin extends Plugin {static override pluginName = SHEET_NUMFMT_PLUGIN;- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: unknown,diff --git a/packages/sheets-ui/src/commands/commands/__tests__/add-worksheet-merge.command.spec.ts b/packages/sheets-ui/src/commands/commands/__tests__/add-worksheet-merge.command.spec.tsindex 2142ab35bf..690ecbe32a 100644--- a/packages/sheets-ui/src/commands/commands/__tests__/add-worksheet-merge.command.spec.ts+++ b/packages/sheets-ui/src/commands/commands/__tests__/add-worksheet-merge.command.spec.ts@@ -350,7 +350,7 @@ describe('Test add worksheet merge commands', () => {]);const commandService = get(ICommandService);const univerInstanceService = get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const mergeData = worksheet.getConfig().mergeData;expect(mergeData.length).toBe(0);@@ -445,7 +445,7 @@ describe('Test add worksheet merge commands', () => {]);const commandService = get(ICommandService);const univerInstanceService = get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const mergeData = worksheet.getConfig().mergeData;expect(mergeData.length).toBe(0);diff --git a/packages/sheets-ui/src/commands/commands/__tests__/auto-fill.controller.spec.ts b/packages/sheets-ui/src/commands/commands/__tests__/auto-fill.controller.spec.tsindex 7921266444..3883ddfa55 100644--- a/packages/sheets-ui/src/commands/commands/__tests__/auto-fill.controller.spec.ts+++ b/packages/sheets-ui/src/commands/commands/__tests__/auto-fill.controller.spec.ts@@ -333,7 +333,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill', () => {describe('auto fill the numbers', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// test number(autoFillController as any)._triggerAutoFill(@@ -374,7 +374,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill the extend numbers', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// test extend number(autoFillController as any)._triggerAutoFill(@@ -398,7 +398,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill the chinese numbers', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// test chinese number(autoFillController as any)._triggerAutoFill(@@ -422,7 +422,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill the chinese week', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// test chinese week@@ -447,7 +447,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill the loop series', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// test loop series(autoFillController as any)._triggerAutoFill(@@ -471,7 +471,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill the other string', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// test other string(autoFillController as any)._triggerAutoFill(@@ -495,7 +495,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill the mixed mode', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// test mixed mode(autoFillController as any)._triggerAutoFill(@@ -534,7 +534,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill the merged cell', async () => {it('test primary', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');const selectionManagerService = get(SelectionManagerService);@@ -584,7 +584,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill clear', async () => {it('test primary will move to upper left corner', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');const selectionManagerService = get(SelectionManagerService);@@ -636,7 +636,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill range is auto detected', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// test other string(autoFillController as any)._handleDbClickFill({@@ -664,7 +664,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill in left direction', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// test other string(autoFillController as any)._triggerAutoFill(@@ -696,7 +696,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill with equal ratio & style', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// equal ratio(autoFillController as any)._triggerAutoFill(@@ -744,7 +744,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill without format', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// equal ratio(autoFillController as any)._triggerAutoFill(@@ -811,7 +811,7 @@ describe('Test auto fill rules in controller', () => {describe('auto fill from single cell', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');// test right(autoFillController as any)._triggerAutoFill(diff --git a/packages/sheets-ui/src/commands/commands/__tests__/create-command-test-bed.ts b/packages/sheets-ui/src/commands/commands/__tests__/create-command-test-bed.tsindex 41c364c9ea..d79d145f1d 100644--- a/packages/sheets-ui/src/commands/commands/__tests__/create-command-test-bed.ts+++ b/packages/sheets-ui/src/commands/commands/__tests__/create-command-test-bed.ts@@ -82,7 +82,7 @@ export function createCommandTestBed(workbookData?: IWorkbookData, dependencies?class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets-ui/src/commands/commands/__tests__/set-format-painter.command.spec.ts b/packages/sheets-ui/src/commands/commands/__tests__/set-format-painter.command.spec.tsindex 074aefe791..a3543dbda7 100644--- a/packages/sheets-ui/src/commands/commands/__tests__/set-format-painter.command.spec.ts+++ b/packages/sheets-ui/src/commands/commands/__tests__/set-format-painter.command.spec.ts@@ -250,7 +250,7 @@ describe('Test format painter rules in controller', () => {describe('format painter', () => {describe('format painter the numbers', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');await commandService.executeCommand(SetSelectionsOperation.id, {unitId: 'workbook-01',diff --git a/packages/sheets-ui/src/commands/commands/__tests__/set-frozen.command.spec.ts b/packages/sheets-ui/src/commands/commands/__tests__/set-frozen.command.spec.tsindex 5b93269428..8848f9d8fe 100644--- a/packages/sheets-ui/src/commands/commands/__tests__/set-frozen.command.spec.ts+++ b/packages/sheets-ui/src/commands/commands/__tests__/set-frozen.command.spec.ts@@ -86,7 +86,7 @@ describe('Test commands used for change selections', () => {const getFreeze = () => {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getConfig().freeze;};diff --git a/packages/sheets-ui/src/commands/commands/__tests__/set-selections.command.spec.ts b/packages/sheets-ui/src/commands/commands/__tests__/set-selections.command.spec.tsindex 38243575c2..e216039806 100644--- a/packages/sheets-ui/src/commands/commands/__tests__/set-selections.command.spec.ts+++ b/packages/sheets-ui/src/commands/commands/__tests__/set-selections.command.spec.ts@@ -114,14 +114,14 @@ describe('Test commands used for change selections', () => {function getRowCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getRowCount();}function getColCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();}diff --git a/packages/sheets-ui/src/commands/commands/add-worksheet-merge.command.ts b/packages/sheets-ui/src/commands/commands/add-worksheet-merge.command.tsindex 69e282eeee..530270d7f2 100644--- a/packages/sheets-ui/src/commands/commands/add-worksheet-merge.command.ts+++ b/packages/sheets-ui/src/commands/commands/add-worksheet-merge.command.ts@@ -152,7 +152,7 @@ export const AddWorksheetMergeAllCommand: ICommand = {const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const workSheet = workbook.getActiveSheet();@@ -183,7 +183,7 @@ export const AddWorksheetMergeVerticalCommand: ICommand = {const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const workSheet = workbook.getActiveSheet();@@ -215,7 +215,7 @@ export const AddWorksheetMergeHorizontalCommand: ICommand = {const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const workSheet = workbook.getActiveSheet();diff --git a/packages/sheets-ui/src/controllers/auto-fill.controller.ts b/packages/sheets-ui/src/controllers/auto-fill.controller.tsindex 651a0227ca..2370f4b03d 100644--- a/packages/sheets-ui/src/controllers/auto-fill.controller.ts+++ b/packages/sheets-ui/src/controllers/auto-fill.controller.ts@@ -279,7 +279,7 @@ export class AutoFillController extends Disposable {return;}- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return;const unitId = workbook.getUnitId();@@ -326,7 +326,7 @@ export class AutoFillController extends Disposable {private _detectFillRange(source: IRange) {const { startRow, endRow, startColumn, endColumn } = source;- const worksheet = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)?.getActiveSheet();+ const worksheet = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)?.getActiveSheet();if (!worksheet) {return source;}@@ -370,8 +370,8 @@ export class AutoFillController extends Disposable {const {source,target,- unitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId(),- subUnitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId(),+ unitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId(),+ subUnitId = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId(),} = this._autoFillService.autoFillLocation || {};const direction = this._autoFillService.direction;if (!source || !target) {@@ -540,7 +540,7 @@ export class AutoFillController extends Disposable {// endColumn: copyEndColumn,// } = source;const currentCellDatas = this._univerInstanceService- .getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!+ .getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getCellMatrix();const rules = this._autoFillService.getRules();@@ -610,7 +610,7 @@ export class AutoFillController extends Disposable {}private _getMergeApplyData(source: IRange, target: IRange, direction: Direction, csLen: number) {- const mergeData = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getMergeData();+ const mergeData = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getMergeData();const applyMergeRanges = [];for (let i = source.startRow; i <= source.endRow; i++) {for (let j = source.startColumn; j <= source.endColumn; j++) {@@ -683,7 +683,7 @@ export class AutoFillController extends Disposable {const { source, target } = location;// cache original data of apply rangeconst currentCellDatas = this._univerInstanceService- .getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!+ .getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getCellMatrix();// cache the original data in currentCellDatas in apply range for later use / refill@@ -778,7 +778,7 @@ export class AutoFillController extends Disposable {// deal with styleslet applyMergeRanges: IRange[] = [];- const style = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getStyles();+ const style = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getStyles();if (hasStyle) {applyMergeRanges = this._getMergeApplyData(sourceRange, targetRange, direction, csLen);applyDatas.forEach((row) => {diff --git a/packages/sheets-ui/src/controllers/auto-height.controller.ts b/packages/sheets-ui/src/controllers/auto-height.controller.tsindex 6c8833bfb2..bb08e1f813 100644--- a/packages/sheets-ui/src/controllers/auto-height.controller.ts+++ b/packages/sheets-ui/src/controllers/auto-height.controller.ts@@ -57,7 +57,7 @@ export class AutoHeightController {const { skeleton } = sheetSkeletonService.getCurrent()!;const rowsAutoHeightInfo = skeleton.calculateAutoHeightInRange(ranges);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const subUnitId = workbook.getActiveSheet().getSheetId();diff --git a/packages/sheets-ui/src/controllers/cell-custom-render.controller.ts b/packages/sheets-ui/src/controllers/cell-custom-render.controller.tsindex 56f19f1aa1..ad1a94b5b7 100644--- a/packages/sheets-ui/src/controllers/cell-custom-render.controller.ts+++ b/packages/sheets-ui/src/controllers/cell-custom-render.controller.ts@@ -45,7 +45,7 @@ export class CellCustomRenderController extends Disposable {private _initEventBinding() {const disposableCollection = new DisposableCollection();// eslint-disable-next-line max-lines-per-function- this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET).subscribe((workbook) => {+ this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {disposableCollection.dispose();if (workbook) {const unitId = workbook.getUnitId();diff --git a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.tsindex 11852ff922..0113d4f0da 100644--- a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts+++ b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts@@ -264,7 +264,7 @@ export class SheetClipboardController extends RxDisposable {},getFilteredOutRows(range: IRange) {const { startRow, endRow } = range;- const worksheet = self._currentUniverSheet.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)?.getActiveSheet();+ const worksheet = self._currentUniverSheet.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)?.getActiveSheet();const res: number[] = [];if (!worksheet) {return res;@@ -670,7 +670,7 @@ export class SheetClipboardController extends RxDisposable {};},onPasteColumns(pasteTo, colProperties, payload) {- const workbook = self._currentUniverSheet.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = self._currentUniverSheet.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const subUnitId = workbook.getActiveSheet().getSheetId();const redoMutations: IMutationInfo[] = [];@@ -721,7 +721,7 @@ export class SheetClipboardController extends RxDisposable {label: 'specialPaste.besidesBorder',},onPasteCells(pasteFrom, pasteTo, matrix, payload) {- const workbook = self._currentUniverSheet.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = self._currentUniverSheet.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const redoMutationsInfo: IMutationInfo[] = [];const undoMutationsInfo: IMutationInfo[] = [];const { range, unitId, subUnitId } = pasteTo;diff --git a/packages/sheets-ui/src/controllers/contextmenu/contextmenu.controller.ts b/packages/sheets-ui/src/controllers/contextmenu/contextmenu.controller.tsindex fb867f930e..13fa32ba56 100644--- a/packages/sheets-ui/src/controllers/contextmenu/contextmenu.controller.ts+++ b/packages/sheets-ui/src/controllers/contextmenu/contextmenu.controller.ts@@ -52,7 +52,7 @@ export class SheetContextMenuController extends Disposable {@ISelectionRenderService private readonly _selectionRenderService: ISelectionRenderService) {super();- this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET).subscribe((workbook) => {+ this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {if (workbook) {this._addListeners();}diff --git a/packages/sheets-ui/src/controllers/editor-bridge.controller.ts b/packages/sheets-ui/src/controllers/editor-bridge.controller.tsindex 068ebbd390..71265cce8c 100644--- a/packages/sheets-ui/src/controllers/editor-bridge.controller.ts+++ b/packages/sheets-ui/src/controllers/editor-bridge.controller.ts@@ -155,7 +155,7 @@ export class EditorBridgeController extends RxDisposable {private _initialChangeEditorListener() {this.disposeWithMe(- this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.DOC).subscribe((documentDataModel) => {+ this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC).subscribe((documentDataModel) => {if (documentDataModel == null) {return;}@@ -267,7 +267,7 @@ export class EditorBridgeController extends RxDisposable {}private _getCurrentUnitIdAndSheetId() {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return {unitId: workbook.getUnitId(),diff --git a/packages/sheets-ui/src/controllers/editor/__tests__/create-test-bed.ts b/packages/sheets-ui/src/controllers/editor/__tests__/create-test-bed.tsindex 54af4c73a2..f5c21e7aed 100644--- a/packages/sheets-ui/src/controllers/editor/__tests__/create-test-bed.ts+++ b/packages/sheets-ui/src/controllers/editor/__tests__/create-test-bed.ts@@ -49,7 +49,7 @@ export function createTestBed(workbookData?: IWorkbookData, dependencies?: Depenclass TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets-ui/src/controllers/editor/editing.controller.ts b/packages/sheets-ui/src/controllers/editor/editing.controller.tsindex f295ed6e6c..d431474cb3 100644--- a/packages/sheets-ui/src/controllers/editor/editing.controller.ts+++ b/packages/sheets-ui/src/controllers/editor/editing.controller.ts@@ -52,7 +52,7 @@ export class EditingController extends RxDisposable {}private _listenEditorBlur() {- this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.DOC)+ this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC).pipe(takeUntil(this.dispose$)).subscribe((docDataModel) => {if (docDataModel == null) {@@ -84,7 +84,7 @@ export class EditingController extends RxDisposable {*/const sheetData: ISheetData = {};this._univerInstanceService- .getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!+ .getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getSheets().forEach((sheet) => {const sheetConfig = sheet.getConfig();diff --git a/packages/sheets-ui/src/controllers/force-string-alert.controller.ts b/packages/sheets-ui/src/controllers/force-string-alert.controller.tsindex 539d84b3f1..c45b418827 100644--- a/packages/sheets-ui/src/controllers/force-string-alert.controller.ts+++ b/packages/sheets-ui/src/controllers/force-string-alert.controller.ts@@ -42,7 +42,7 @@ export class ForceStringAlertController extends Disposable {private _initCellAlertPopup() {this.disposeWithMe(this._hoverManagerService.currentCell$.subscribe((cellPos) => {if (cellPos) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const cellData = worksheet.getCell(cellPos.location.row, cellPos.location.col);diff --git a/packages/sheets-ui/src/controllers/format-painter/format-painter.controller.ts b/packages/sheets-ui/src/controllers/format-painter/format-painter.controller.tsindex f307c5c2a6..e48f643d7a 100644--- a/packages/sheets-ui/src/controllers/format-painter/format-painter.controller.ts+++ b/packages/sheets-ui/src/controllers/format-painter/format-painter.controller.ts@@ -90,7 +90,7 @@ export class FormatPainterController extends Disposable {private async _applyFormatPainter(range: IRange) {const { styles: stylesMatrix, merges } = this._formatPainterService.getSelectionFormat();- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const subUnitId = workbook.getActiveSheet().getSheetId();if (!stylesMatrix) return;diff --git a/packages/sheets-ui/src/controllers/header-menu.controller.ts b/packages/sheets-ui/src/controllers/header-menu.controller.tsindex 19d25ad072..6b8fb68fc0 100644--- a/packages/sheets-ui/src/controllers/header-menu.controller.ts+++ b/packages/sheets-ui/src/controllers/header-menu.controller.ts@@ -285,7 +285,7 @@ export class HeaderMenuController extends Disposable {}private _getSelectionOnColumn(column: number): ISetSelectionsOperationParams {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return {diff --git a/packages/sheets-ui/src/controllers/hover.controller.ts b/packages/sheets-ui/src/controllers/hover.controller.tsindex a8c634934f..c11b74e6f7 100644--- a/packages/sheets-ui/src/controllers/hover.controller.ts+++ b/packages/sheets-ui/src/controllers/hover.controller.ts@@ -38,7 +38,7 @@ export class HoverController extends Disposable {private _initPointerEvent() {const currentRender = this._renderManagerService.getRenderById(- this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId()+ this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId());if (!currentRender) {return;diff --git a/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.ts b/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.tsindex 1bce6f6d89..0e99b9bd9a 100644--- a/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.ts+++ b/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.ts@@ -50,7 +50,7 @@ export function createMenuTestBed() {static override pluginName = 'test-plugin';protected override _injector: Injector;- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: unknown, @Inject(Injector) _injector: Injector) {super();diff --git a/packages/sheets-ui/src/controllers/menu/__tests__/row-col.menu.spec.ts b/packages/sheets-ui/src/controllers/menu/__tests__/row-col.menu.spec.tsindex 857e6390fa..c7e0773de3 100644--- a/packages/sheets-ui/src/controllers/menu/__tests__/row-col.menu.spec.ts+++ b/packages/sheets-ui/src/controllers/menu/__tests__/row-col.menu.spec.ts@@ -88,21 +88,21 @@ describe('Test row col menu items', () => {function getRowCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getRowCount();}function getColCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();}async function selectRow(rowStart: number, rowEnd: number): Promise<boolean> {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const endColumn = getColCount() - 1;return commandService.executeCommand<ISetSelectionsOperationParams, boolean>(SetSelectionsOperation.id, {@@ -130,7 +130,7 @@ describe('Test row col menu items', () => {async function selectColumn(columnStart: number, columnEnd: number): Promise<boolean> {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const endRow = getRowCount() - 1;return commandService.executeCommand<ISetSelectionsOperationParams, boolean>(SetSelectionsOperation.id, {diff --git a/packages/sheets-ui/src/controllers/menu/border.menu.ts b/packages/sheets-ui/src/controllers/menu/border.menu.tsindex a2d8d4a47c..83d0b350a2 100644--- a/packages/sheets-ui/src/controllers/menu/border.menu.ts+++ b/packages/sheets-ui/src/controllers/menu/border.menu.ts@@ -70,7 +70,7 @@ export function CellBorderSelectorMenuItemFactory(accessor: IAccessor): IMenuSel},],value$: borderStyleManagerService.borderInfo$,- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$,};}diff --git a/packages/sheets-ui/src/controllers/menu/menu-util.ts b/packages/sheets-ui/src/controllers/menu/menu-util.tsindex 20195a568f..50349a6cb5 100644--- a/packages/sheets-ui/src/controllers/menu/menu-util.ts+++ b/packages/sheets-ui/src/controllers/menu/menu-util.ts@@ -24,7 +24,7 @@ interface IActive {}function getActiveSheet$(univerInstanceService: IUniverInstanceService): Observable<Nullable<IActive>> {- return univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET).pipe(switchMap((workbook) =>+ return univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(switchMap((workbook) =>workbook? workbook.activeSheet$.pipe(map((worksheet) => {if (!worksheet) return null;diff --git a/packages/sheets-ui/src/controllers/menu/menu.ts b/packages/sheets-ui/src/controllers/menu/menu.tsindex 84d50576e0..47bd7fc9d7 100644--- a/packages/sheets-ui/src/controllers/menu/menu.ts+++ b/packages/sheets-ui/src/controllers/menu/menu.ts@@ -137,7 +137,7 @@ export function FormatPainterMenuItemFactory(accessor: IAccessor): IMenuButtonItstatus$.unsubscribe();};}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),};}@@ -202,7 +202,7 @@ export function BoldMenuItemFactory(accessor: IAccessor): IMenuButtonItem {return disposable.dispose;})),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),};}@@ -258,7 +258,7 @@ export function ItalicMenuItemFactory(accessor: IAccessor): IMenuButtonItem {subscriber.next(isItalic === FontItalic.ITALIC);return disposable.dispose;})),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),};}@@ -315,7 +315,7 @@ export function UnderlineMenuItemFactory(accessor: IAccessor): IMenuButtonItem {return disposable.dispose;})),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),};}@@ -375,7 +375,7 @@ export function StrikeThroughMenuItemFactory(accessor: IAccessor): IMenuButtonItsubscriber.next(!!(st && st.s));return disposable.dispose;})),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),};}@@ -427,7 +427,7 @@ export function FontFamilySelectorMenuItemFactory(accessor: IAccessor): IMenuSelsubscriber.next(ff ?? defaultValue);return disposable.dispose;})),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),};}@@ -494,7 +494,7 @@ export function FontSizeSelectorMenuItemFactory(accessor: IAccessor): IMenuSelecreturn disposable.dispose;})),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),};}@@ -541,7 +541,7 @@ export function TextColorSelectorMenuItemFactory(accessor: IAccessor): IMenuSelesubscriber.next(defaultColor);return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),};}@@ -588,7 +588,7 @@ export function BackgroundColorSelectorMenuItemFactory(accessor: IAccessor): IMesubscriber.next(defaultColor);return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),};}@@ -651,7 +651,7 @@ export function HorizontalAlignMenuItemFactory(accessor: IAccessor): IMenuSelectreturn disposable.dispose;})),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),};}@@ -714,7 +714,7 @@ export function VerticalAlignMenuItemFactory(accessor: IAccessor): IMenuSelectorreturn disposable.dispose;})),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),};}@@ -777,7 +777,7 @@ export function WrapTextMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<return disposable.dispose;})),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),};}@@ -863,7 +863,7 @@ export function TextRotateMenuItemFactory(accessor: IAccessor): IMenuSelectorItereturn disposable.dispose;})),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: getCurrentSheetDisabled$(accessor),};}diff --git a/packages/sheets-ui/src/controllers/menu/merge.menu.ts b/packages/sheets-ui/src/controllers/menu/merge.menu.tsindex 24b4d5fa7a..155fdd831b 100644--- a/packages/sheets-ui/src/controllers/menu/merge.menu.ts+++ b/packages/sheets-ui/src/controllers/menu/merge.menu.ts@@ -41,7 +41,7 @@ export function CellMergeMenuItemFactory(accessor: IAccessor): IMenuSelectorItemgroup: MenuGroup.TOOLBAR_LAYOUT,type: MenuItemType.SUBITEMS,// selections: [...MERGE_CHILDREN],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),disabled$: disabled$.pipe(combineLatestWith(selectionsHasCross$),map(([disable, hasCross]) => disable || hasCross)diff --git a/packages/sheets-ui/src/controllers/menu/sheet.menu.ts b/packages/sheets-ui/src/controllers/menu/sheet.menu.tsindex 381b95643b..cd15becfcb 100644--- a/packages/sheets-ui/src/controllers/menu/sheet.menu.ts+++ b/packages/sheets-ui/src/controllers/menu/sheet.menu.ts@@ -52,7 +52,7 @@ export function DeleteSheetMenuItemFactory(accessor: IAccessor): IMenuButtonItemid === InsertSheetMutation.id ||id === SetWorksheetHideMutation.id) {- const worksheets = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getWorksheets();+ const worksheets = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getWorksheets();// loop through all worksheets Map to see if there is more than one visible sheetconst visibleSheets = Array.from(worksheets.values()).filter((sheet) => sheet.getConfig().hidden === BooleanNumber.FALSE@@ -118,7 +118,7 @@ export function HideSheetMenuItemFactory(accessor: IAccessor): IMenuButtonItem {id === InsertSheetMutation.id ||id === SetWorksheetHideMutation.id) {- const worksheets = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getWorksheets();+ const worksheets = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getWorksheets();// loop through all worksheets Map to see if there is more than one visible sheetconst visibleSheets = Array.from(worksheets.values()).filter((sheet) => sheet.getConfig().hidden === BooleanNumber.FALSE@@ -136,7 +136,7 @@ export function HideSheetMenuItemFactory(accessor: IAccessor): IMenuButtonItem {export function UnHideSheetMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<any> {const univerInstanceService = accessor.get(IUniverInstanceService);const commandService = accessor.get(ICommandService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const hiddenList = workbook.getHiddenWorksheets().map((s) => ({label: workbook.getSheetBySheetId(s)?.getName() || '',value: s,@@ -191,7 +191,7 @@ export function ShowMenuItemFactory(accessor: IAccessor): IMenuButtonItem {id === InsertSheetMutation.id ||id === SetWorksheetHideMutation.id) {- const worksheets = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getWorksheets();+ const worksheets = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getWorksheets();// loop through all worksheets Map to see if there is more than one sheetconst visibleSheets = Array.from(worksheets.values());diff --git a/packages/sheets-ui/src/controllers/scroll.controller.ts b/packages/sheets-ui/src/controllers/scroll.controller.tsindex 229e0c5b29..c9c808b1d2 100644--- a/packages/sheets-ui/src/controllers/scroll.controller.ts+++ b/packages/sheets-ui/src/controllers/scroll.controller.ts@@ -405,7 +405,7 @@ export class ScrollController extends Disposable {return false;}- const worksheet = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet();+ const worksheet = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet();const {startColumn: freezeStartColumn,startRow: freezeStartRow,diff --git a/packages/sheets-ui/src/controllers/selection.controller.ts b/packages/sheets-ui/src/controllers/selection.controller.tsindex 9fe023acc3..7297216d4f 100644--- a/packages/sheets-ui/src/controllers/selection.controller.ts+++ b/packages/sheets-ui/src/controllers/selection.controller.ts@@ -71,7 +71,7 @@ export class SelectionController extends Disposable {}private _initialize() {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const sheetObject = this._getSheetObject();if (sheetObject == null) {@@ -109,7 +109,7 @@ export class SelectionController extends Disposable {const { unitId } = item;let { formulaOrRefString } = item;- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (unitId !== workbook.getUnitId()) {return;@@ -376,7 +376,7 @@ export class SelectionController extends Disposable {}const lastSelection = params[params.length - 1];- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();this._definedNamesService.setCurrentRange({@@ -401,7 +401,7 @@ export class SelectionController extends Disposable {}private _move(selectionDataWithStyleList: ISelectionWithCoordAndStyle[], type: SelectionMoveType) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return;const unitId = workbook.getUnitId();@@ -433,7 +433,7 @@ export class SelectionController extends Disposable {this.disposeWithMe(this._commandService.onCommandExecuted((command: ICommandInfo) => {if (updateCommandList.includes(command.id)) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const params = command.params as ISetZoomRatioOperationParams;diff --git a/packages/sheets-ui/src/controllers/sheet-render.controller.ts b/packages/sheets-ui/src/controllers/sheet-render.controller.tsindex 16c3e6d67c..51400785c0 100644--- a/packages/sheets-ui/src/controllers/sheet-render.controller.ts+++ b/packages/sheets-ui/src/controllers/sheet-render.controller.ts@@ -115,7 +115,7 @@ export class SheetRenderController extends RxDisposable {}private _initSheetDisposeListener(): void {- this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.SHEET)+ this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => {const unitId = workbook.getUnitId();@@ -127,7 +127,7 @@ export class SheetRenderController extends RxDisposable {private _initCommandListener(): void {this.disposeWithMe(this._commandService.onCommandExecuted((command: ICommandInfo) => {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return;const unitId = workbook.getUnitId();diff --git a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts b/packages/sheets-ui/src/controllers/sheet-ui.controller.tsindex b606e63ef7..c33e363a14 100644--- a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts+++ b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts@@ -474,7 +474,7 @@ export class SheetUIController extends Disposable {private _initFocusHandler(): void {this.disposeWithMe(- this._layoutService.registerFocusHandler(UniverInstanceType.SHEET, (_unitId: string) => {+ this._layoutService.registerFocusHandler(UniverInstanceType.UNIVER_SHEET, (_unitId: string) => {// DEBT: `_unitId` is not used hence we cannot support Univer mode nowconst textSelectionManagerService = this._injector.get(ITextSelectionRenderManager);textSelectionManagerService.focus();diff --git a/packages/sheets-ui/src/controllers/status-bar.controller.ts b/packages/sheets-ui/src/controllers/status-bar.controller.tsindex 83dc95a7c5..ee2fd36bd7 100644--- a/packages/sheets-ui/src/controllers/status-bar.controller.ts+++ b/packages/sheets-ui/src/controllers/status-bar.controller.ts@@ -115,13 +115,13 @@ export class StatusBarController extends Disposable {}private _calculateSelection(selections: IRange[], primary: Nullable<ISelectionCell>) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const sheetId = workbook.getActiveSheet().getSheetId();const sheetData: ISheetData = {};const arrayFormulaMatrixCell = this._formulaDataModel.getArrayFormulaCellData();this._univerInstanceService- .getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!+ .getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getSheets().forEach((sheet) => {const sheetConfig = sheet.getConfig();diff --git a/packages/sheets-ui/src/controllers/utils/component-tools.ts b/packages/sheets-ui/src/controllers/utils/component-tools.tsindex 0d6ce4e79c..ab01cc5541 100644--- a/packages/sheets-ui/src/controllers/utils/component-tools.ts+++ b/packages/sheets-ui/src/controllers/utils/component-tools.ts@@ -51,7 +51,7 @@ export function getSheetObject(): Nullable<ISheetObjectParam> {const workbook = univerInstanceService instanceof Workbook? univerInstanceService- : univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ : univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return null;const unitId = workbook.getUnitId();diff --git a/packages/sheets-ui/src/controllers/utils/range-tools.ts b/packages/sheets-ui/src/controllers/utils/range-tools.tsindex e293a06af4..155d482ca6 100644--- a/packages/sheets-ui/src/controllers/utils/range-tools.ts+++ b/packages/sheets-ui/src/controllers/utils/range-tools.ts@@ -26,8 +26,8 @@ export interface IDiscreteRange {export function rangeToDiscreteRange(range: IRange, accessor: IAccessor, unitId?: string, subUnitId?: string): IDiscreteRange | null {const univerInstanceService = accessor.get(IUniverInstanceService);const workbook = unitId- ? univerInstanceService.getUnit<Workbook>(unitId, UniverInstanceType.SHEET)- : univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ ? univerInstanceService.getUnit<Workbook>(unitId, UniverInstanceType.UNIVER_SHEET)+ : univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);const worksheet = subUnitId ? workbook?.getSheetBySheetId(subUnitId) : workbook?.getActiveSheet();if (!worksheet) {return null;diff --git a/packages/sheets-ui/src/controllers/zoom.controller.ts b/packages/sheets-ui/src/controllers/zoom.controller.tsindex 766061b0a3..32880100e0 100644--- a/packages/sheets-ui/src/controllers/zoom.controller.ts+++ b/packages/sheets-ui/src/controllers/zoom.controller.ts@@ -91,7 +91,7 @@ export class ZoomController extends Disposable {ratioDelta /= 2;}- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const sheet = workbook.getActiveSheet();const currentRatio = sheet.getZoomRatio();let nextRatio = +Number.parseFloat(`${currentRatio + ratioDelta}`).toFixed(1);@@ -117,7 +117,7 @@ export class ZoomController extends Disposable {return;}- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();@@ -135,7 +135,7 @@ export class ZoomController extends Disposable {this.disposeWithMe(this._commandService.onCommandExecuted((command: ICommandInfo) => {if (updateCommandList.includes(command.id)) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const params = command.params;diff --git a/packages/sheets-ui/src/services/canvas-pop-manager.service.ts b/packages/sheets-ui/src/services/canvas-pop-manager.service.tsindex 6b535c76cf..273d535340 100644--- a/packages/sheets-ui/src/services/canvas-pop-manager.service.ts+++ b/packages/sheets-ui/src/services/canvas-pop-manager.service.ts@@ -185,7 +185,7 @@ export class SheetCanvasPopManagerService extends Disposable {* @returns disposable*/attachPopupToObject(targetObject: BaseObject, popup: ICanvasPopup): IDisposable {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const unitId = workbook.getUnitId();const subUnitId = worksheet.getSheetId();@@ -229,7 +229,7 @@ export class SheetCanvasPopManagerService extends Disposable {* @returns disposable*/attachPopupToCell(row: number, col: number, popup: ICanvasPopup, viewport?: Viewport): Nullable<IDisposable> {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const unitId = workbook.getUnitId();const subUnitId = worksheet.getSheetId();diff --git a/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-test-bed.ts b/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-test-bed.tsindex bda844d12b..5067b1a652 100644--- a/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-test-bed.ts+++ b/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-test-bed.ts@@ -521,7 +521,7 @@ export function clipboardTestBed(workbookData?: IWorkbookData, dependencies?: De*/class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts b/packages/sheets-ui/src/services/clipboard/clipboard.service.tsindex e9e704ba8d..4abe340d82 100644--- a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts+++ b/packages/sheets-ui/src/services/clipboard/clipboard.service.ts@@ -137,7 +137,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboardreturn false; // maybe we should notify user that there is no selection}- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const hooks = this._clipboardHooks;@@ -366,7 +366,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboardif (result) {// add to undo redo servicesthis._undoRedoService.pushUndoRedo({- unitID: this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId(),+ unitID: this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId(),undoMutations: undoMutationsInfo,redoMutations: redoMutationsInfo,});@@ -717,7 +717,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard}private _getPastingTarget() {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const selection = this._selectionManagerService.getLast();return {@@ -794,7 +794,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboardconst destinationRows = endRow - startRow + 1;const destinationColumns = endColumn - startColumn + 1;- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);const worksheet = workbook?.getActiveSheet();if (!worksheet) {return null;@@ -1004,7 +1004,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard* @param range*/private _topLeftCellsMatch(rowCount: number, colCount: number, range: { topRow: number; leftCol: number }): boolean {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook?.getActiveSheet();if (!worksheet) {return false;diff --git a/packages/sheets-ui/src/services/editor-bridge.service.ts b/packages/sheets-ui/src/services/editor-bridge.service.tsindex d582f0b9d3..588a6bc211 100644--- a/packages/sheets-ui/src/services/editor-bridge.service.ts+++ b/packages/sheets-ui/src/services/editor-bridge.service.ts@@ -229,7 +229,7 @@ export class EditorBridgeService extends Disposable implements IEditorBridgeServendX = skeleton.convertTransformToOffsetX(endX, scaleX, scrollXY);endY = skeleton.convertTransformToOffsetY(endY, scaleY, scrollXY);- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const location = {workbook,diff --git a/packages/sheets-ui/src/services/format-painter/format-painter.service.ts b/packages/sheets-ui/src/services/format-painter/format-painter.service.tsindex b600e4ef9a..13a287fbca 100644--- a/packages/sheets-ui/src/services/format-painter/format-painter.service.ts+++ b/packages/sheets-ui/src/services/format-painter/format-painter.service.ts@@ -97,10 +97,10 @@ export class FormatPainterService extends Disposable implements IFormatPainterSeconst range = selection?.range;if (!range) return;const { startRow, endRow, startColumn, endColumn } = range;- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook?.getActiveSheet();const cellData = worksheet.getCellMatrix();- const mergeData = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getMergeData();+ const mergeData = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getMergeData();const styles = workbook.getStyles();const stylesMatrix = new ObjectMatrix<IStyleData>();diff --git a/packages/sheets-ui/src/services/hover-manager.service.ts b/packages/sheets-ui/src/services/hover-manager.service.tsindex 8b3c19b366..dad780d01f 100644--- a/packages/sheets-ui/src/services/hover-manager.service.ts+++ b/packages/sheets-ui/src/services/hover-manager.service.ts@@ -55,7 +55,7 @@ export class HoverManagerService extends Disposable {}private _initCellDisposableListener(): void {- this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.SHEET).subscribe((workbook) => {+ this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {if (!workbook) this._currentCell$.next(null);}));}@@ -64,7 +64,7 @@ export class HoverManagerService extends Disposable {if (!this._lastPosition) return;const { offsetX, offsetY } = this._lastPosition;- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) {this._currentCell$.next(null);return;diff --git a/packages/sheets-ui/src/services/mark-selection/mark-selection.service.ts b/packages/sheets-ui/src/services/mark-selection/mark-selection.service.tsindex d2f76f87a7..191e6a24a4 100644--- a/packages/sheets-ui/src/services/mark-selection/mark-selection.service.ts+++ b/packages/sheets-ui/src/services/mark-selection/mark-selection.service.ts@@ -58,7 +58,7 @@ export class MarkSelectionService extends Disposable implements IMarkSelectionSe}addShape(selection: ISelectionWithStyle, exits: string[] = [], zIndex: number = DEFAULT_Z_INDEX): string | null {- const workbook = this._currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const subUnitId = workbook.getActiveSheet().getSheetId();const id = Tools.generateRandomId();this._shapeMap.set(id, {@@ -74,8 +74,8 @@ export class MarkSelectionService extends Disposable implements IMarkSelectionSe}refreshShapes() {- const currentUnitId = this._currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();- const currentSubUnitId = this._currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId();+ const currentUnitId = this._currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();+ const currentSubUnitId = this._currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId();this._shapeMap.forEach((shape) => {const { unitId, subUnitId, selection, control: oldControl, zIndex } = shape;diff --git a/packages/sheets-ui/src/services/selection/__test__/create-service-test-bed.ts b/packages/sheets-ui/src/services/selection/__test__/create-service-test-bed.tsindex 8bce8d588a..6d855a3e7d 100644--- a/packages/sheets-ui/src/services/selection/__test__/create-service-test-bed.ts+++ b/packages/sheets-ui/src/services/selection/__test__/create-service-test-bed.ts@@ -110,7 +110,7 @@ export function createCommandTestBed(workbookData?: IWorkbookData, dependencies?class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets-ui/src/sheets-ui-plugin.ts b/packages/sheets-ui/src/sheets-ui-plugin.tsindex 6dccc39feb..11af7f48dd 100644--- a/packages/sheets-ui/src/sheets-ui-plugin.ts+++ b/packages/sheets-ui/src/sheets-ui-plugin.ts@@ -74,7 +74,7 @@ import { ForceStringAlertController } from './controllers/force-string-alert.conexport class UniverSheetsUIPlugin extends Plugin {static override pluginName = 'SHEET_UI_PLUGIN_NAME';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,@@ -159,13 +159,13 @@ export class UniverSheetsUIPlugin extends Plugin {private _registerRenderControllers(): void {([HeaderFreezeRenderController, HeaderUnhideRenderController, HeaderResizeController]).forEach((controller) => {- this.disposeWithMe(this._renderManagerService.registerRenderControllers(UniverInstanceType.SHEET, controller));+ this.disposeWithMe(this._renderManagerService.registerRenderControllers(UniverInstanceType.UNIVER_SHEET, controller));});}private _markSheetAsFocused() {const univerInstanceService = this._univerInstanceService;- univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET).pipe(filter((v) => !!v)).subscribe((workbook) => {+ univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(filter((v) => !!v)).subscribe((workbook) => {univerInstanceService.focusUnit(workbook!.getUnitId());});}diff --git a/packages/sheets-ui/src/views/count-bar/ZoomSlider.tsx b/packages/sheets-ui/src/views/count-bar/ZoomSlider.tsxindex 0db2e76c2b..51de2137ce 100644--- a/packages/sheets-ui/src/views/count-bar/ZoomSlider.tsx+++ b/packages/sheets-ui/src/views/count-bar/ZoomSlider.tsx@@ -36,7 +36,7 @@ export function ZoomSlider() {const univerInstanceService = useDependency(IUniverInstanceService);const getCurrentZoom = useCallback(() => {- const currentZoom = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getZoomRatio() * 100 || 100;+ const currentZoom = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getZoomRatio() * 100 || 100;return Math.round(currentZoom);}, [univerInstanceService]);@@ -54,7 +54,7 @@ export function ZoomSlider() {function handleChange(value: number) {setZoom(value);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook?.getActiveSheet();if (worksheet == null) {return;diff --git a/packages/sheets-ui/src/views/defined-name/DefinedNameContainer.tsx b/packages/sheets-ui/src/views/defined-name/DefinedNameContainer.tsxindex d4bf3f7fe9..515f4c3d5b 100644--- a/packages/sheets-ui/src/views/defined-name/DefinedNameContainer.tsx+++ b/packages/sheets-ui/src/views/defined-name/DefinedNameContainer.tsx@@ -32,7 +32,7 @@ import { SCOPE_WORKBOOK_VALUE } from './component-name';export const DefinedNameContainer = () => {const commandService = useDependency(ICommandService);const univerInstanceService = useDependency(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const localeService = useDependency(LocaleService);const definedNamesService = useDependency(IDefinedNamesService);const selectionManagerService = useDependency(SelectionManagerService);diff --git a/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsx b/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsxindex eaebfa9f1d..17bf35ddf3 100644--- a/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsx+++ b/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsx@@ -56,7 +56,7 @@ export const DefinedNameInput = (props: IDefinedNameInputProps) => {} = props;const univerInstanceService = useDependency(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const localeService = useDependency(LocaleService);const definedNamesService = useDependency(IDefinedNamesService);const functionService = useDependency(IFunctionService);diff --git a/packages/sheets-ui/src/views/defined-name/DefinedNameOverlay.tsx b/packages/sheets-ui/src/views/defined-name/DefinedNameOverlay.tsxindex 600aab3e90..61f237c1a2 100644--- a/packages/sheets-ui/src/views/defined-name/DefinedNameOverlay.tsx+++ b/packages/sheets-ui/src/views/defined-name/DefinedNameOverlay.tsx@@ -33,7 +33,7 @@ export function DefinedNameOverlay(props: IDefinedNameOverlayProps) {const localeService = useDependency(LocaleService);const definedNamesService = useDependency(IDefinedNamesService);const univerInstanceService = useDependency(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const getDefinedNameMap = () => {diff --git a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-menu/SheetBarMenu.tsx b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-menu/SheetBarMenu.tsxindex 305db291eb..f3e24b1dbd 100644--- a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-menu/SheetBarMenu.tsx+++ b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-menu/SheetBarMenu.tsx@@ -57,7 +57,7 @@ export function SheetBarMenu(props: ISheetBarMenuProps) {const univerInstanceService = useDependency(IUniverInstanceService);const commandService = useDependency(ICommandService);const sheetBarService = useDependency(ISheetBarService);- const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET), null, false, []);+ const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET), null, false, []);const handleClick = (item: ISheetBarMenuItem) => {const { sheetId } = item;diff --git a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsx b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsxindex b6c4a36065..b25a968557 100644--- a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsx+++ b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsx@@ -62,7 +62,7 @@ export function SheetBarTabs() {const editorBridgeService = useDependency(IEditorBridgeService);const injector = useInjector();- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;useEffect(() => {statusInit();@@ -161,7 +161,7 @@ export function SheetBarTabs() {};const nameRepeatCheck = (name: string) => {- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();const currenSheetName = worksheet.getName();// TODO@Dushusir: no need trigger savediff --git a/packages/sheets-ui/src/views/sheet-canvas-view.ts b/packages/sheets-ui/src/views/sheet-canvas-view.tsindex 610a565fe1..2dd77de25e 100644--- a/packages/sheets-ui/src/views/sheet-canvas-view.ts+++ b/packages/sheets-ui/src/views/sheet-canvas-view.ts@@ -71,9 +71,9 @@ export class SheetCanvasView extends RxDisposable {}private _init() {- this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._create(workbook));- this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._dispose(workbook));- this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.SHEET).forEach((workbook) => this._create(workbook));+ this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._create(workbook));+ this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._dispose(workbook));+ this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.UNIVER_SHEET).forEach((workbook) => this._create(workbook));}private _dispose(workbook: Workbook) {diff --git a/packages/sheets-ui/src/views/sheet-container/SheetContainer.tsx b/packages/sheets-ui/src/views/sheet-container/SheetContainer.tsxindex f27417334e..243fbf1029 100644--- a/packages/sheets-ui/src/views/sheet-container/SheetContainer.tsx+++ b/packages/sheets-ui/src/views/sheet-container/SheetContainer.tsx@@ -30,7 +30,7 @@ import styles from './index.module.less';export function RenderSheetFooter() {const univerInstanceService = useDependency(IUniverInstanceService);- const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET), null, false, []);+ const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET), null, false, []);if (!workbook) return null;return (@@ -44,7 +44,7 @@ export function RenderSheetFooter() {export function RenderSheetHeader() {const univerInstanceService = useDependency(IUniverInstanceService);- const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET), null, false, []);+ const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET), null, false, []);if (!workbook) return null;return (@@ -56,7 +56,7 @@ export function RenderSheetHeader() {export function RenderSheetContent() {const univerInstanceService = useDependency(IUniverInstanceService);- const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET), null, false, []);+ const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET), null, false, []);if (!workbook) return null;return (diff --git a/packages/sheets-zen-editor/src/commands/commands/zen-editor.command.ts b/packages/sheets-zen-editor/src/commands/commands/zen-editor.command.tsindex 30904aa389..ea01fe7f1a 100644--- a/packages/sheets-zen-editor/src/commands/commands/zen-editor.command.ts+++ b/packages/sheets-zen-editor/src/commands/commands/zen-editor.command.ts@@ -39,7 +39,7 @@ export const CancelZenEditCommand: ICommand = {zenZoneEditorService.close();- const currentSheetInstance = univerInstanceManager.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const currentSheetInstance = univerInstanceManager.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (currentSheetInstance) {univerInstanceManager.focusUnit(currentSheetInstance.getUnitId());editorBridgeService.refreshEditCellState();@@ -71,7 +71,7 @@ export const ConfirmZenEditCommand: ICommand = {zenZoneEditorService.close();- const currentSheetInstance = univerInstanceManager.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const currentSheetInstance = univerInstanceManager.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (currentSheetInstance) {univerInstanceManager.focusUnit(currentSheetInstance.getUnitId());editorBridgeService.refreshEditCellState();diff --git a/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts b/packages/sheets-zen-editor/src/controllers/zen-editor.controller.tsindex b0416caa18..075dd3562d 100644--- a/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts+++ b/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts@@ -105,7 +105,7 @@ export class ZenEditorController extends RxDisposable {},};- return this._univerInstanceService.createUnit(UniverInstanceType.DOC, INITIAL_SNAPSHOT);+ return this._univerInstanceService.createUnit(UniverInstanceType.UNIVER_DOC, INITIAL_SNAPSHOT);}// Listen to changes in the size of the zen editor container to set the size of the editor.diff --git a/packages/sheets-zen-editor/src/plugin.ts b/packages/sheets-zen-editor/src/plugin.tsindex 3b7f158bca..41d77e52a2 100644--- a/packages/sheets-zen-editor/src/plugin.ts+++ b/packages/sheets-zen-editor/src/plugin.ts@@ -26,7 +26,7 @@ import { zhCN } from './locale';export interface IUniverSheetsZenEditorPluginConfig {}export class UniverSheetsZenEditorPlugin extends Plugin {static override pluginName = 'zen-editor';- static override type = UniverInstanceType.DOC;+ static override type = UniverInstanceType.UNIVER_DOC;constructor(_config: IUniverSheetsZenEditorPluginConfig,diff --git a/packages/sheets/package.json b/packages/sheets/package.jsonindex 44e4deea91..2965b45f14 100644--- a/packages/sheets/package.json+++ b/packages/sheets/package.json@@ -70,9 +70,6 @@"@wendellhu/redi": "^0.13.3","rxjs": ">=7.0.0"},- "dependencies": {- "@univerjs/protocol": "^0.1.20"- },"devDependencies": {"@univerjs/core": "workspace:*","@univerjs/engine-formula": "workspace:*",diff --git a/packages/sheets/src/commands/commands/__tests__/copy-worksheet.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/copy-worksheet.command.spec.tsindex da14c47505..7b990dff7b 100644--- a/packages/sheets/src/commands/commands/__tests__/copy-worksheet.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/copy-worksheet.command.spec.ts@@ -57,7 +57,7 @@ describe('Test copy worksheet commands', () => {describe('copy sheet', () => {describe('copy the only sheet', async () => {it('correct situation', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');function getSheetCopyPart(sheet: Worksheet) {const config = sheet.getConfig();diff --git a/packages/sheets/src/commands/commands/__tests__/create-command-test-bed.ts b/packages/sheets/src/commands/commands/__tests__/create-command-test-bed.tsindex c11b871c53..157d1b874f 100644--- a/packages/sheets/src/commands/commands/__tests__/create-command-test-bed.ts+++ b/packages/sheets/src/commands/commands/__tests__/create-command-test-bed.ts@@ -83,7 +83,7 @@ export function createCommandTestBed(workbookData?: IWorkbookData, dependencies?class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets/src/commands/commands/__tests__/insert-remove-rows-cols.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/insert-remove-rows-cols.command.spec.tsindex 319461ee9a..38c5bdb442 100644--- a/packages/sheets/src/commands/commands/__tests__/insert-remove-rows-cols.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/insert-remove-rows-cols.command.spec.ts@@ -143,14 +143,14 @@ describe('Test insert and remove rows cols commands', () => {function getRowCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getRowCount();}function getColCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();}@@ -161,21 +161,21 @@ describe('Test insert and remove rows cols commands', () => {function getCellInfo(row: number, col: number): Nullable<ICellData> {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getCellMatrix().getValue(row, col);}function getMergedInfo(row: number, col: number): Nullable<IRange> {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getMergedCell(row, col);}function getMergeData() {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getMergeData();}diff --git a/packages/sheets/src/commands/commands/__tests__/move-range-commands.spec.ts b/packages/sheets/src/commands/commands/__tests__/move-range-commands.spec.tsindex 8704117416..d4ca71b15d 100644--- a/packages/sheets/src/commands/commands/__tests__/move-range-commands.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/move-range-commands.spec.ts@@ -138,14 +138,14 @@ describe('Test move range commands', () => {function getMergedInfo(row: number, col: number): Nullable<IRange> {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getMergedCell(row, col);}function getMergeData() {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getConfig().mergeData;}diff --git a/packages/sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.tsindex cdc73c811c..8844a4c4fd 100644--- a/packages/sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.ts@@ -120,42 +120,42 @@ describe('Test move rows cols', () => {function getRowCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getRowCount();}function getColCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();}function getCellInfo(row: number, col: number): Nullable<ICellData> {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getCellMatrix().getValue(row, col);}function getMergedInfo(row: number, col: number): Nullable<IRange> {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getMergedCell(row, col);}function getRowHeight(row: number): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getRowHeight(row);}function getColWidth(col: number): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getColumnWidth(col);}diff --git a/packages/sheets/src/commands/commands/__tests__/remove-rows-cols.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/remove-rows-cols.command.spec.tsindex 104c118577..5c4ee12dfc 100644--- a/packages/sheets/src/commands/commands/__tests__/remove-rows-cols.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/remove-rows-cols.command.spec.ts@@ -93,14 +93,14 @@ describe('Test remove rows cols', () => {function getColCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();}function getCellInfo(row: number, col: number): Nullable<ICellData> {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getCellMatrix().getValue(row, col);}diff --git a/packages/sheets/src/commands/commands/__tests__/remove-sheet.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/remove-sheet.command.spec.tsindex 9b02c532b5..4664b9420d 100644--- a/packages/sheets/src/commands/commands/__tests__/remove-sheet.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/remove-sheet.command.spec.ts@@ -61,7 +61,7 @@ describe('Test remove worksheet commands', () => {).toBeFalsy();});it('will be working if there are more than one sheet', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');const targetActiveSheet = workbook.getActiveSheet();diff --git a/packages/sheets/src/commands/commands/__tests__/set-col-width.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/set-col-width.command.spec.tsindex 91f4fe2c8f..4651c688d4 100644--- a/packages/sheets/src/commands/commands/__tests__/set-col-width.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/set-col-width.command.spec.ts@@ -31,7 +31,7 @@ describe('Test set col width commands', () => {let commandService: ICommandService;function getColumnWidth(col: number): number {- const worksheet = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet();+ const worksheet = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet();return worksheet.getColumnWidth(col);}@@ -45,7 +45,7 @@ describe('Test set col width commands', () => {commandService.registerCommand(SetColWidthCommand);commandService.registerCommand(SetWorksheetColWidthMutation);- const worksheet = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet();+ const worksheet = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet();const maxRow = worksheet.getMaxRows() - 1;const selectionManagerService = get(SelectionManagerService);selectionManagerService.setCurrentSelection({diff --git a/packages/sheets/src/commands/commands/__tests__/set-frozen.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/set-frozen.command.spec.tsindex e6fdf8a2b1..d28bb6d847 100644--- a/packages/sheets/src/commands/commands/__tests__/set-frozen.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/set-frozen.command.spec.ts@@ -108,7 +108,7 @@ describe('Test set frozen commands', () => {describe('set frozen', () => {describe('set frozen', async () => {it('correct situation: ', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');const targetActiveSheet = workbook.getActiveSheet();diff --git a/packages/sheets/src/commands/commands/__tests__/set-row-col-visible.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/set-row-col-visible.command.spec.tsindex 157ab84dc8..af8ffd7bab 100644--- a/packages/sheets/src/commands/commands/__tests__/set-row-col-visible.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/set-row-col-visible.command.spec.ts@@ -75,26 +75,26 @@ describe('Test row col hide/unhine commands', () => {function getRowCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getRowCount();}function getColCount(): number {const currentService = get(IUniverInstanceService);- const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = currentService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getColumnCount();}function getRowRawVisible(row: number): boolean {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getRowRawVisible(row);}function getColVisible(col: number): boolean {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet.getColVisible(col);}diff --git a/packages/sheets/src/commands/commands/__tests__/set-row-height.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/set-row-height.command.spec.tsindex 64d118f44d..51d2e3afcc 100644--- a/packages/sheets/src/commands/commands/__tests__/set-row-height.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/set-row-height.command.spec.ts@@ -48,12 +48,12 @@ describe('Test set row height commands', () => {let commandService: ICommandService;function getRowHeight(row: number): number {- const worksheet = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet();+ const worksheet = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet();return worksheet.getRowHeight(row);}function getRowIsAutoHeight(row: number): Nullable<BooleanNumber> {- const worksheet = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet();+ const worksheet = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet();const rowManager = worksheet.getRowManager();const rowInfo = rowManager.getRow(row);@@ -72,7 +72,7 @@ describe('Test set row height commands', () => {commandService.registerCommand(SetWorksheetRowHeightMutation);commandService.registerCommand(SetWorksheetRowIsAutoHeightMutation);- const worksheet = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet();+ const worksheet = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet();const maxColumn = worksheet.getMaxColumns() - 1;const selectionManager = get(SelectionManagerService);diff --git a/packages/sheets/src/commands/commands/__tests__/set-worksheet-hide.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/set-worksheet-hide.command.spec.tsindex 8f1d299f61..4f5d8c5b3a 100644--- a/packages/sheets/src/commands/commands/__tests__/set-worksheet-hide.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/set-worksheet-hide.command.spec.ts@@ -52,7 +52,7 @@ describe('Test set worksheet hide commands', () => {describe('Set worksheet hide', () => {it('will set current active worksheet hidden', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');const targetActiveSheet = workbook.getActiveSheet();diff --git a/packages/sheets/src/commands/commands/__tests__/set-worksheet-name.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/set-worksheet-name.command.spec.tsindex 2f5a41fc9b..09cb01d774 100644--- a/packages/sheets/src/commands/commands/__tests__/set-worksheet-name.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/set-worksheet-name.command.spec.ts@@ -45,7 +45,7 @@ describe('Test set worksheet name commands', () => {describe('set worksheet name', () => {describe('set worksheet name', async () => {it('correct situation: ', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');expect(diff --git a/packages/sheets/src/commands/commands/__tests__/set-worksheet-order.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/set-worksheet-order.command.spec.tsindex 79880807ce..20db10416f 100644--- a/packages/sheets/src/commands/commands/__tests__/set-worksheet-order.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/set-worksheet-order.command.spec.ts@@ -53,7 +53,7 @@ describe('Test set worksheet order commands', () => {describe('set worksheet order', () => {describe('set worksheet order', async () => {it('correct situation: ', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');const targetActiveSheet = workbook.getActiveSheet();diff --git a/packages/sheets/src/commands/commands/__tests__/set-worksheet-show.command.spec.ts b/packages/sheets/src/commands/commands/__tests__/set-worksheet-show.command.spec.tsindex 6c2e79312d..adbb315163 100644--- a/packages/sheets/src/commands/commands/__tests__/set-worksheet-show.command.spec.ts+++ b/packages/sheets/src/commands/commands/__tests__/set-worksheet-show.command.spec.ts@@ -53,7 +53,7 @@ describe('Test set worksheet show commands', () => {describe('set sheet show', () => {describe('set sheet show after make it hidden', async () => {it('correct situation: ', async () => {- const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = get(IUniverInstanceService).getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) throw new Error('This is an error');const targetActiveSheet = workbook.getActiveSheet();diff --git a/packages/sheets/src/commands/commands/add-worksheet-merge.command.ts b/packages/sheets/src/commands/commands/add-worksheet-merge.command.tsindex 6eedf3cd6b..074678ebaf 100644--- a/packages/sheets/src/commands/commands/add-worksheet-merge.command.ts+++ b/packages/sheets/src/commands/commands/add-worksheet-merge.command.ts@@ -188,7 +188,7 @@ export const AddWorksheetMergeAllCommand: ICommand = {}const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const workSheet = workbook.getActiveSheet();@@ -217,7 +217,7 @@ export const AddWorksheetMergeVerticalCommand: ICommand = {}const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const workSheet = workbook.getActiveSheet();@@ -247,7 +247,7 @@ export const AddWorksheetMergeHorizontalCommand: ICommand = {}const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const workSheet = workbook.getActiveSheet();diff --git a/packages/sheets/src/commands/commands/clear-selection-all.command.ts b/packages/sheets/src/commands/commands/clear-selection-all.command.tsindex dbcd037045..4673a0a078 100644--- a/packages/sheets/src/commands/commands/clear-selection-all.command.ts+++ b/packages/sheets/src/commands/commands/clear-selection-all.command.ts@@ -44,7 +44,7 @@ export const ClearSelectionAllCommand: ICommand = {const undoRedoService = accessor.get(IUndoRedoService);const sheetInterceptorService = accessor.get(SheetInterceptorService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const unitId = workbook.getUnitId();diff --git a/packages/sheets/src/commands/commands/clear-selection-content.command.ts b/packages/sheets/src/commands/commands/clear-selection-content.command.tsindex 44302718a5..2243ef4768 100644--- a/packages/sheets/src/commands/commands/clear-selection-content.command.ts+++ b/packages/sheets/src/commands/commands/clear-selection-content.command.ts@@ -46,7 +46,7 @@ export const ClearSelectionContentCommand: ICommand = {const undoRedoService = accessor.get(IUndoRedoService);const sheetInterceptorService = accessor.get(SheetInterceptorService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const unitId = workbook.getUnitId();diff --git a/packages/sheets/src/commands/commands/clear-selection-format.command.ts b/packages/sheets/src/commands/commands/clear-selection-format.command.tsindex 159cf5b2f4..03c5fa8c97 100644--- a/packages/sheets/src/commands/commands/clear-selection-format.command.ts+++ b/packages/sheets/src/commands/commands/clear-selection-format.command.ts@@ -44,7 +44,7 @@ export const ClearSelectionFormatCommand: ICommand = {const undoRedoService = accessor.get(IUndoRedoService);const sheetInterceptorService = accessor.get(SheetInterceptorService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const unitId = workbook.getUnitId();diff --git a/packages/sheets/src/commands/commands/insert-row-col.command.ts b/packages/sheets/src/commands/commands/insert-row-col.command.tsindex 96fb8498c3..18b97b2509 100644--- a/packages/sheets/src/commands/commands/insert-row-col.command.ts+++ b/packages/sheets/src/commands/commands/insert-row-col.command.ts@@ -145,7 +145,7 @@ export const InsertRowBeforeCommand: ICommand = {}const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) {return false;}@@ -203,7 +203,7 @@ export const InsertRowAfterCommand: ICommand = {}const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) {return false;}@@ -327,7 +327,7 @@ export const InsertColBeforeCommand: ICommand = {}const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) {return false;}@@ -383,7 +383,7 @@ export const InsertColAfterCommand: ICommand = {}const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) {return false;}diff --git a/packages/sheets/src/commands/commands/move-rows-cols.command.ts b/packages/sheets/src/commands/commands/move-rows-cols.command.tsindex 893be78d2f..55fc94fad3 100644--- a/packages/sheets/src/commands/commands/move-rows-cols.command.ts+++ b/packages/sheets/src/commands/commands/move-rows-cols.command.ts@@ -74,7 +74,7 @@ export const MoveRowsCommand: ICommand<IMoveRowsCommandParams> = {const sheetInterceptorService = accessor.get(SheetInterceptorService);const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) {return false;}@@ -204,7 +204,7 @@ export const MoveColsCommand: ICommand<IMoveColsCommandParams> = {const sheetInterceptorService = accessor.get(SheetInterceptorService);const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) {return false;}diff --git a/packages/sheets/src/commands/commands/set-col-visible.command.ts b/packages/sheets/src/commands/commands/set-col-visible.command.tsindex 75d3e06315..5955e991c1 100644--- a/packages/sheets/src/commands/commands/set-col-visible.command.ts+++ b/packages/sheets/src/commands/commands/set-col-visible.command.ts@@ -121,7 +121,7 @@ export const SetSelectedColsVisibleCommand: ICommand = {}const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const worksheet = workbook.getActiveSheet();if (!worksheet) return false;@@ -155,7 +155,7 @@ export const SetColHiddenCommand: ICommand = {}const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const worksheet = workbook.getActiveSheet();if (!worksheet) return false;diff --git a/packages/sheets/src/commands/commands/set-row-visible.command.ts b/packages/sheets/src/commands/commands/set-row-visible.command.tsindex 2a0b23dcc3..1ac4c603c5 100644--- a/packages/sheets/src/commands/commands/set-row-visible.command.ts+++ b/packages/sheets/src/commands/commands/set-row-visible.command.ts@@ -127,7 +127,7 @@ export const SetSelectedRowsVisibleCommand: ICommand = {return false;}- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return false;const worksheet = workbook.getActiveSheet();if (!worksheet) return false;diff --git a/packages/sheets/src/commands/commands/utils/target-util.ts b/packages/sheets/src/commands/commands/utils/target-util.tsindex c81e4e8c41..627f32e86b 100644--- a/packages/sheets/src/commands/commands/utils/target-util.ts+++ b/packages/sheets/src/commands/commands/utils/target-util.ts@@ -23,7 +23,7 @@ export function getSheetCommandTargetWorkbook(univerInstanceService: IUniverInstconst { unitId } = params;const workbook = unitId? univerInstanceService.getUniverSheetInstance(unitId)- : univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ : univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return null;@@ -55,7 +55,7 @@ export function getSheetCommandTarget(univerInstanceService: IUniverInstanceServconst workbook = unitId? univerInstanceService.getUniverSheetInstance(unitId)- : univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ : univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) return null;const worksheet = subUnitId ? workbook.getSheetBySheetId(subUnitId) : workbook.getActiveSheet();diff --git a/packages/sheets/src/commands/mutations/__tests__/create-command-test-bed.ts b/packages/sheets/src/commands/mutations/__tests__/create-command-test-bed.tsindex 9ed775050c..b09327ebc7 100644--- a/packages/sheets/src/commands/mutations/__tests__/create-command-test-bed.ts+++ b/packages/sheets/src/commands/mutations/__tests__/create-command-test-bed.ts@@ -110,7 +110,7 @@ export function createCommandTestBed(workbookData?: IWorkbookData, dependencies?class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets/src/commands/mutations/__tests__/remove-row-col.mutation.spec.ts b/packages/sheets/src/commands/mutations/__tests__/remove-row-col.mutation.spec.tsindex cf91ccb073..829f8bbc78 100644--- a/packages/sheets/src/commands/mutations/__tests__/remove-row-col.mutation.spec.ts+++ b/packages/sheets/src/commands/mutations/__tests__/remove-row-col.mutation.spec.ts@@ -36,13 +36,13 @@ describe('Test moving rows & cols', () => {let get: Injector['get'];const getWorksheet = () => {const univerInstanceService = get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return worksheet;};const getId = () => {const univerInstanceService = get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();return {unitId: workbook.getUnitId(),diff --git a/packages/sheets/src/commands/mutations/move-range.mutation.ts b/packages/sheets/src/commands/mutations/move-range.mutation.tsindex f3b550b674..096f78a2cb 100644--- a/packages/sheets/src/commands/mutations/move-range.mutation.ts+++ b/packages/sheets/src/commands/mutations/move-range.mutation.ts@@ -40,7 +40,7 @@ export const MoveRangeMutation: IMutation<IMoveRangeMutationParams, boolean> = {}const univerInstanceService = accessor.get(IUniverInstanceService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET);+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) {return false;}diff --git a/packages/sheets/src/controllers/__tests__/util.ts b/packages/sheets/src/controllers/__tests__/util.tsindex e162d37d7a..c45ddebd9f 100644--- a/packages/sheets/src/controllers/__tests__/util.ts+++ b/packages/sheets/src/controllers/__tests__/util.ts@@ -53,7 +53,7 @@ export function createTestBase(workbookData?: IWorkbookData, dependencies?: Depe*/class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets/src/controllers/defined-name-data.controller.ts b/packages/sheets/src/controllers/defined-name-data.controller.tsindex e14e5589ed..20668558de 100644--- a/packages/sheets/src/controllers/defined-name-data.controller.ts+++ b/packages/sheets/src/controllers/defined-name-data.controller.ts@@ -21,10 +21,9 @@ import {IUniverInstanceService,LifecycleStages,OnLifecycle,-} from '@univerjs/core';+ UniverInstanceType } from '@univerjs/core';import type { IDefinedNameMapItem } from '@univerjs/engine-formula';import { IDefinedNamesService } from '@univerjs/engine-formula';-import { UniverType } from '@univerjs/protocol';const SHEET_DEFINED_NAME_PLUGIN = 'SHEET_DEFINED_NAME_PLUGIN';@@ -67,7 +66,7 @@ export class DefinedNameDataController extends Disposable {this.disposeWithMe(this._resourceManagerService.registerPluginResource<IDefinedNameMapItem>({pluginName: SHEET_DEFINED_NAME_PLUGIN,- businesses: [UniverType.UNIVER_SHEET],+ businesses: [UniverInstanceType.UNIVER_SHEET],toJson: (unitID) => toJson(unitID),parseJson: (json) => parseJson(json),onUnLoad: (unitID) => {diff --git a/packages/sheets/src/controllers/merge-cell.controller.ts b/packages/sheets/src/controllers/merge-cell.controller.tsindex 27d50fb369..6cc8794607 100644--- a/packages/sheets/src/controllers/merge-cell.controller.ts+++ b/packages/sheets/src/controllers/merge-cell.controller.ts@@ -142,7 +142,7 @@ export class MergeCellController extends Disposable {case ClearSelectionAllCommand.id:case ClearSelectionFormatCommand.id: {// TODO@Gggpound: get by unit id and subUnitId- const workbook = self._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = self._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const unitId = workbook.getUnitId();const worksheet = workbook.getActiveSheet();const subUnitId = worksheet.getSheetId();@@ -276,7 +276,7 @@ export class MergeCellController extends Disposable {}));- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (workbook) {const sheet = workbook.getActiveSheet();registerRefRange(workbook.getUnitId(), sheet.getSheetId());@@ -1182,7 +1182,7 @@ function getWorkbook(univerInstanceService: IUniverInstanceService, unitId?: strif (unitId) {return univerInstanceService.getUniverSheetInstance(unitId);}- return univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ return univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;}function getWorksheet(workbook: Workbook, subUnitId?: string) {diff --git a/packages/sheets/src/services/__tests__/numfmt.service.test.ts b/packages/sheets/src/services/__tests__/numfmt.service.test.tsindex 7dd85b2204..1d7a38172a 100644--- a/packages/sheets/src/services/__tests__/numfmt.service.test.ts+++ b/packages/sheets/src/services/__tests__/numfmt.service.test.ts@@ -46,7 +46,7 @@ describe('test numfmt service', () => {it('model delete', () => {const univerInstanceService = get(IUniverInstanceService);const numfmtService = get(INumfmtService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const sheet = workbook.getActiveSheet();const unitId = workbook.getUnitId();const subUnitId = sheet.getSheetId();@@ -76,7 +76,7 @@ describe('test numfmt service', () => {it('model set', () => {const univerInstanceService = get(IUniverInstanceService);const numfmtService = get(INumfmtService);- const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const styles = workbook.getStyles();const sheet = workbook.getActiveSheet();const unitId = workbook.getUnitId();diff --git a/packages/sheets/src/services/__tests__/ref-range.setvice.spec.ts b/packages/sheets/src/services/__tests__/ref-range.setvice.spec.tsindex d8e05adf5e..3e40679e5c 100644--- a/packages/sheets/src/services/__tests__/ref-range.setvice.spec.ts+++ b/packages/sheets/src/services/__tests__/ref-range.setvice.spec.ts@@ -65,7 +65,7 @@ describe('Test ref-range.service', () => {);const univerInstanceService = get(IUniverInstanceService);- workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;worksheet = workbook.getActiveSheet();});afterEach(() => {diff --git a/packages/sheets/src/services/__tests__/util.ts b/packages/sheets/src/services/__tests__/util.tsindex 473065ae8c..cb1ed3e5e6 100644--- a/packages/sheets/src/services/__tests__/util.ts+++ b/packages/sheets/src/services/__tests__/util.ts@@ -67,7 +67,7 @@ export function createTestBase(workbookData?: IWorkbookData, dependencies?: Depe*/class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets/src/services/permission/sheet-permission.service.ts b/packages/sheets/src/services/permission/sheet-permission.service.tsindex c55150ac5d..69d2cbec4e 100644--- a/packages/sheets/src/services/permission/sheet-permission.service.ts+++ b/packages/sheets/src/services/permission/sheet-permission.service.ts@@ -47,15 +47,15 @@ export class SheetPermissionService extends RxDisposable {}private _init() {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) return;this._interceptWorkbook(workbook);- this._univerInstanceService.getTypeOfUnitAdded$<Workbook>(UniverInstanceType.SHEET)+ this._univerInstanceService.getTypeOfUnitAdded$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._interceptWorkbook(workbook));- this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.SHEET)+ this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._disposableByUnit.get(workbook.getUnitId())?.dispose());}@@ -90,10 +90,11 @@ export class SheetPermissionService extends RxDisposable {this._disposableByUnit.set(unitId, disposableCollection);}+ // TODO@Gggpound: should get by unitId instead of the current onegetEditable$(unitId?: string, sheetId?: string) {return of({ value: true, status: PermissionStatus.INIT });- // const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ // const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;// if (!workbook) {// }@@ -114,7 +115,7 @@ export class SheetPermissionService extends RxDisposable {getSheetEditable(unitId?: string, sheetId?: string) {return true;- // const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ // const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;// if (!workbook) return false;// const _unitId = unitId || workbook.getUnitId();@@ -127,7 +128,7 @@ export class SheetPermissionService extends RxDisposable {}setSheetEditable(v: boolean, unitId?: string, sheetId?: string) {- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;if (!workbook) return;const _unitId = unitId || workbook.getUnitId();diff --git a/packages/sheets/src/services/permission/tool.ts b/packages/sheets/src/services/permission/tool.tsindex 8ae25121fe..a07ee01a91 100644--- a/packages/sheets/src/services/permission/tool.ts+++ b/packages/sheets/src/services/permission/tool.ts@@ -25,8 +25,8 @@ export function getCurrentSheetDisabled$(accessor: IAccessor) {const univerInstanceService = accessor.get(IUniverInstanceService);const sheetPermissionService = accessor.get(SheetPermissionService);- const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)?.getUnitId();- const sheetId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)?.getActiveSheet().getSheetId();+ const unitId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)?.getUnitId();+ const sheetId = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)?.getActiveSheet().getSheetId();return sheetPermissionService.getEditable$(unitId, sheetId)?.pipe(map((e) => !e.value));}diff --git a/packages/sheets/src/services/ref-range/__tests__/__testing__.ts b/packages/sheets/src/services/ref-range/__tests__/__testing__.tsindex 473065ae8c..cb1ed3e5e6 100644--- a/packages/sheets/src/services/ref-range/__tests__/__testing__.ts+++ b/packages/sheets/src/services/ref-range/__tests__/__testing__.ts@@ -67,7 +67,7 @@ export function createTestBase(workbookData?: IWorkbookData, dependencies?: Depe*/class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets/src/services/ref-range/__tests__/ref-range.service.spec.ts b/packages/sheets/src/services/ref-range/__tests__/ref-range.service.spec.tsindex 8744061ef2..bd7a909617 100644--- a/packages/sheets/src/services/ref-range/__tests__/ref-range.service.spec.ts+++ b/packages/sheets/src/services/ref-range/__tests__/ref-range.service.spec.ts@@ -62,7 +62,7 @@ export function createRefRangeTestBed() {class TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets/src/services/ref-range/ref-range.service.ts b/packages/sheets/src/services/ref-range/ref-range.service.tsindex eb183b68c1..c79100137b 100644--- a/packages/sheets/src/services/ref-range/ref-range.service.ts+++ b/packages/sheets/src/services/ref-range/ref-range.service.ts@@ -145,7 +145,7 @@ export class RefRangeService extends Disposable {private _onRefRangeChange = () => {this._sheetInterceptorService.interceptCommand({getMutations: (command: EffectRefRangeParams) => {- const worksheet = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet();+ const worksheet = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet();const unitId = getUnitId(this._univerInstanceService);const subUnitId = getSubUnitId(this._univerInstanceService);const getEffectsCbList = () => {@@ -367,11 +367,11 @@ export class RefRangeService extends Disposable {}function getUnitId(univerInstanceService: IUniverInstanceService) {- return univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getUnitId();+ return univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();}function getSubUnitId(univerInstanceService: IUniverInstanceService) {- return univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet().getSheetId();+ return univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet().getSheetId();}function getSelectionRanges(selectionManagerService: SelectionManagerService) {diff --git a/packages/sheets/src/services/sheet-interceptor/__tests__/create-core-test-bed.ts b/packages/sheets/src/services/sheet-interceptor/__tests__/create-core-test-bed.tsindex a4e30935f6..24b31a840d 100644--- a/packages/sheets/src/services/sheet-interceptor/__tests__/create-core-test-bed.ts+++ b/packages/sheets/src/services/sheet-interceptor/__tests__/create-core-test-bed.ts@@ -50,7 +50,7 @@ export function createCoreTestBed(workbookData?: IWorkbookData, dependencies?: Dclass TestPlugin extends Plugin {static override pluginName = 'test-plugin';- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(_config: undefined,diff --git a/packages/sheets/src/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.ts b/packages/sheets/src/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.tsindex 89e4bfeb80..778b2beda6 100644--- a/packages/sheets/src/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.ts+++ b/packages/sheets/src/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.ts@@ -40,19 +40,19 @@ describe('Test SheetInterceptorService', () => {function getCell(row: number, col: number): Nullable<ICellData> {const cus = get(IUniverInstanceService);- const sheet = cus.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet()!;+ const sheet = cus.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()!;return sheet.getCell(row, col);}function getRowFiltered(row: number): boolean {const cus = get(IUniverInstanceService);- const sheet = cus.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet()!;+ const sheet = cus.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()!;return sheet.getRowFiltered(row);}function getRowRawVisible(row: number): boolean {const cus = get(IUniverInstanceService);- const sheet = cus.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet()!;+ const sheet = cus.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()!;return sheet.getRowVisible(row);}@@ -202,12 +202,12 @@ describe('Test SheetInterceptorService', () => {// it('Test SheetInterceptorService', () => {// it('getLastRowWithContent', () => {// const univerInstanceService = get(IUniverInstanceService);- // const sheet = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet()!;+ // const sheet = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()!;// expect(sheet.getLastRowWithContent()).toBe(3);// });// it('getLastColumnWithContent', () => {// const univerInstanceService = get(IUniverInstanceService);- // const sheet = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!.getActiveSheet()!;+ // const sheet = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()!;// expect(sheet.getLastColumnWithContent()).toBe(3);// });// });diff --git a/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts b/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.tsindex c07b7f4e38..c350b01a63 100644--- a/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts+++ b/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts@@ -61,11 +61,11 @@ export class SheetInterceptorService extends Disposable {// When a workbook is created or a worksheet is added after when workbook is created,// `SheetInterceptorService` inject interceptors to worksheet instances to it.- this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$<Workbook>(UniverInstanceType.SHEET).subscribe((workbook) => {+ this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {this._interceptWorkbook(workbook);}));- this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.SHEET).subscribe((workbook) =>+ this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) =>this._disposeWorkbookInterceptor(workbook)));diff --git a/packages/sheets/src/sheets-plugin.ts b/packages/sheets/src/sheets-plugin.tsindex 8d22654c27..187c38c86b 100644--- a/packages/sheets/src/sheets-plugin.ts+++ b/packages/sheets/src/sheets-plugin.ts@@ -43,7 +43,7 @@ export interface IUniverSheetsConfig {*/export class UniverSheetsPlugin extends Plugin {static override pluginName = PLUGIN_NAME;- static override type = UniverInstanceType.SHEET;+ static override type = UniverInstanceType.UNIVER_SHEET;constructor(private _config: IUniverSheetsConfig,diff --git a/packages/slides-ui/src/slides-ui-plugin.ts b/packages/slides-ui/src/slides-ui-plugin.tsindex ddfd94b2af..07554d6788 100644--- a/packages/slides-ui/src/slides-ui-plugin.ts+++ b/packages/slides-ui/src/slides-ui-plugin.ts@@ -26,7 +26,7 @@ export const SLIDE_UI_PLUGIN_NAME = 'slides-ui';export class UniverSlidesUIPlugin extends Plugin {static override pluginName = SLIDE_UI_PLUGIN_NAME;- static override type = UniverInstanceType.SLIDE;+ static override type = UniverInstanceType.UNIVER_SLIDE;constructor(_config: unknown,@@ -52,7 +52,7 @@ export class UniverSlidesUIPlugin extends Plugin {private _markSlideAsFocused() {const currentService = this._univerInstanceService;try {- const slide = currentService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.SLIDE)!;+ const slide = currentService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.UNIVER_SLIDE)!;currentService.focusUnit(slide.getUnitId());} catch (e) {}diff --git a/packages/slides-ui/src/views/slide-bar/SlideBar.tsx b/packages/slides-ui/src/views/slide-bar/SlideBar.tsxindex 2d67b41f3e..9de5d3b863 100644--- a/packages/slides-ui/src/views/slide-bar/SlideBar.tsx+++ b/packages/slides-ui/src/views/slide-bar/SlideBar.tsx@@ -35,7 +35,7 @@ export function SlideSideBar() {const renderManagerService = useDependency(IRenderManagerService);const slideBarRef = useRef<HTMLDivElement>(null);- const currentSlide = useObservable(univerInstanceService.getCurrentTypeOfUnit$<SlideDataModel>(UniverInstanceType.SLIDE));+ const currentSlide = useObservable(univerInstanceService.getCurrentTypeOfUnit$<SlideDataModel>(UniverInstanceType.UNIVER_SLIDE));const pages = currentSlide?.getPages();const pageOrder = currentSlide?.getPageOrder();diff --git a/packages/slides/src/slides-plugin.ts b/packages/slides/src/slides-plugin.tsindex 2fa95cb95e..b769187ad6 100644--- a/packages/slides/src/slides-plugin.ts+++ b/packages/slides/src/slides-plugin.ts@@ -31,7 +31,7 @@ const PLUGIN_NAME = 'slides';export class UniverSlidesPlugin extends Plugin {static override pluginName = PLUGIN_NAME;- static override type = UniverInstanceType.SLIDE;+ static override type = UniverInstanceType.UNIVER_SLIDE;private _config: IUniverSlidesConfig;diff --git a/packages/slides/src/views/render/canvas-view.ts b/packages/slides/src/views/render/canvas-view.tsindex a05b9b452c..c4f0b28d9d 100644--- a/packages/slides/src/views/render/canvas-view.ts+++ b/packages/slides/src/views/render/canvas-view.ts@@ -57,17 +57,17 @@ export class CanvasView extends RxDisposable {this._create(unitId);});- this._univerInstanceService.getCurrentTypeOfUnit$<SlideDataModel>(UniverInstanceType.SLIDE).pipe(takeUntil(this.dispose$)).subscribe((slideModel) => {+ this._univerInstanceService.getCurrentTypeOfUnit$<SlideDataModel>(UniverInstanceType.UNIVER_SLIDE).pipe(takeUntil(this.dispose$)).subscribe((slideModel) => {this._create(slideModel?.getUnitId());});- this._univerInstanceService.getAllUnitsForType<SlideDataModel>(UniverInstanceType.SLIDE).forEach((slideModel) => {+ this._univerInstanceService.getAllUnitsForType<SlideDataModel>(UniverInstanceType.UNIVER_SLIDE).forEach((slideModel) => {this._create(slideModel.getUnitId());});}activePage(pageId?: string) {- const model = this._univerInstanceService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.SLIDE)!;+ const model = this._univerInstanceService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.UNIVER_SLIDE)!;let page: Nullable<ISlidePage>;if (pageId) {page = model.getPage(pageId);@@ -122,7 +122,7 @@ export class CanvasView extends RxDisposable {return;}- const model = this._univerInstanceService.getUnit(unitId, UniverInstanceType.SLIDE);+ const model = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SLIDE);if (model == null) {return;}@@ -133,12 +133,12 @@ export class CanvasView extends RxDisposable {}private _currentRender() {- const slideDataModel = this._univerInstanceService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.SLIDE)!;+ const slideDataModel = this._univerInstanceService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.UNIVER_SLIDE)!;return this._renderManagerService.getRenderById(slideDataModel.getUnitId());}private _addNewRender(unitId: string) {- const slideDataModel = this._univerInstanceService.getUnit<SlideDataModel>(unitId, UniverInstanceType.SLIDE);+ const slideDataModel = this._univerInstanceService.getUnit<SlideDataModel>(unitId, UniverInstanceType.UNIVER_SLIDE);if (slideDataModel == null) {return;@@ -258,7 +258,7 @@ export class CanvasView extends RxDisposable {}, 300);private _createSlide(mainScene: Scene) {- const model = this._univerInstanceService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.SLIDE)!;+ const model = this._univerInstanceService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.UNIVER_SLIDE)!;const { width: sceneWidth, height: sceneHeight } = mainScene;@@ -284,7 +284,7 @@ export class CanvasView extends RxDisposable {}private _addBackgroundRect(scene: Scene, fill: IColorStyle) {- const model = this._univerInstanceService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.SLIDE)!;+ const model = this._univerInstanceService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.UNIVER_SLIDE)!;const pageSize = model.getPageSize();@@ -376,7 +376,7 @@ export class CanvasView extends RxDisposable {}createThumbs() {- const slideDataModel = this._univerInstanceService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.SLIDE)!;+ const slideDataModel = this._univerInstanceService.getCurrentUnitForType<SlideDataModel>(UniverInstanceType.UNIVER_SLIDE)!;const pageOrder = slideDataModel.getPageOrder();diff --git a/packages/ui/src/components/range-selector/RangeSelector.tsx b/packages/ui/src/components/range-selector/RangeSelector.tsxindex 514ecc03d8..107f133313 100644--- a/packages/ui/src/components/range-selector/RangeSelector.tsx+++ b/packages/ui/src/components/range-selector/RangeSelector.tsx@@ -247,7 +247,7 @@ export function RangeSelector(props: IRangeSelectorProps) {}function getSheetIdByName(name: string) {- return univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)?.getSheetBySheetName(name)?.getSheetId() || '';+ return univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)?.getSheetBySheetName(name)?.getSheetId() || '';}function handleTextValueChange(value: Nullable<string>) {diff --git a/packages/ui/src/controllers/shortcut-display/menu.ts b/packages/ui/src/controllers/shortcut-display/menu.tsindex 1ff8872efd..162f5c0158 100644--- a/packages/ui/src/controllers/shortcut-display/menu.ts+++ b/packages/ui/src/controllers/shortcut-display/menu.ts@@ -30,7 +30,7 @@ export function ShortcutPanelMenuItemFactory(accessor: IAccessor): IMenuButtonIticon: 'KeyboardSingle',type: MenuItemType.BUTTON,positions: [MenuPosition.TOOLBAR_START],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),// disabled$: getCurrentSheetDisabled$(accessor),};}diff --git a/packages/ui/src/controllers/ui/ui-desktop.controller.tsx b/packages/ui/src/controllers/ui/ui-desktop.controller.tsxindex 419e2f52cc..2bc9638ee7 100644--- a/packages/ui/src/controllers/ui/ui-desktop.controller.tsx+++ b/packages/ui/src/controllers/ui/ui-desktop.controller.tsx@@ -79,7 +79,7 @@ export class DesktopUIController extends Disposable implements IDesktopUIControlif (!render.unitId) return;const unitType = this._instanceService.getUnitType(render.unitId);- if (unitType !== UniverInstanceType.SHEET) return;+ if (unitType !== UniverInstanceType.UNIVER_SHEET) return;render.engine.setContainer(canvasElement);}diff --git a/packages/ui/src/services/editor/editor.service.ts b/packages/ui/src/services/editor/editor.service.tsindex 39ede496f4..f6881022dc 100644--- a/packages/ui/src/services/editor/editor.service.ts+++ b/packages/ui/src/services/editor/editor.service.ts@@ -617,7 +617,7 @@ export class EditorService extends Disposable implements IEditorService, IDisposregister(config: IEditorConfigParam, container: HTMLDivElement): IDisposable {const { initialSnapshot, editorUnitId, canvasStyle = {} } = config;- const documentDataModel = this._univerInstanceService.createUnit<IDocumentData, DocumentDataModel>(UniverInstanceType.DOC, initialSnapshot || this._getBlank(editorUnitId));+ const documentDataModel = this._univerInstanceService.createUnit<IDocumentData, DocumentDataModel>(UniverInstanceType.UNIVER_DOC, initialSnapshot || this._getBlank(editorUnitId));let render = this._renderManagerService.getRenderById(editorUnitId);@@ -664,9 +664,9 @@ export class EditorService extends Disposable implements IEditorService, IDispos* Compatible with the editor in the sheet scenario,* it is necessary to refocus back to the current sheet when unloading.*/- const sheets = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.SHEET);+ const sheets = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (sheets.length > 0) {- const current = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.SHEET)!;+ const current = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;this._univerInstanceService.focusUnit(current.getUnitId());}}diff --git a/packages/ui/src/services/layout/layout.service.ts b/packages/ui/src/services/layout/layout.service.tsindex 8dcbc9c297..34434ca03f 100644--- a/packages/ui/src/services/layout/layout.service.ts+++ b/packages/ui/src/services/layout/layout.service.ts@@ -83,11 +83,11 @@ export class DesktopLayoutService extends Disposable implements ILayoutService {let handler: Nullable<FocusHandlerFn>;if (currentFocused instanceof Workbook) {- handler = this._focusHandlers.get(UniverInstanceType.SHEET);+ handler = this._focusHandlers.get(UniverInstanceType.UNIVER_SHEET);} else if (currentFocused instanceof DocumentDataModel) {- handler = this._focusHandlers.get(UniverInstanceType.DOC);+ handler = this._focusHandlers.get(UniverInstanceType.UNIVER_DOC);} else if (currentFocused instanceof SlideDataModel) {- handler = this._focusHandlers.get(UniverInstanceType.SLIDE);+ handler = this._focusHandlers.get(UniverInstanceType.UNIVER_SLIDE);}if (handler) {diff --git a/packages/ui/src/views/hooks/active.ts b/packages/ui/src/views/hooks/active.tsindex 24023c68d4..766c2b8304 100644--- a/packages/ui/src/views/hooks/active.ts+++ b/packages/ui/src/views/hooks/active.ts@@ -25,7 +25,7 @@ import { useObservable } from '../../components/hooks/observable';*/export function useActiveWorkbook(): Nullable<Workbook> {const univerInstanceService = useDependency(IUniverInstanceService);- const activeWorkbook = useObservable(univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.SHEET));+ const activeWorkbook = useObservable(univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET));return activeWorkbook;}diff --git a/packages/uniscript/src/controllers/menu.ts b/packages/uniscript/src/controllers/menu.tsindex fe4532aafc..f872bdc171 100644--- a/packages/uniscript/src/controllers/menu.ts+++ b/packages/uniscript/src/controllers/menu.ts@@ -30,7 +30,7 @@ export function UniscriptMenuItemFactory(accessor: IAccessor): IMenuButtonItem {type: MenuItemType.BUTTON,positions: [MenuPosition.TOOLBAR_START],// FIXME hidden$ and disabled$ are not correctly in doc- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),// disabled$: getCurrentSheetDisabled$(accessor),};}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 2982466807..a923272db1 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -370,10 +370,6 @@ importers:version: 1.5.0(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])packages/data-validation:- dependencies:- '@univerjs/protocol':- specifier: ^0.1.20- version: 0.1.20(@grpc/[email protected])([email protected])devDependencies:'@univerjs/core':specifier: workspace:*@@ -860,10 +856,6 @@ importers:version: 1.5.0(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])packages/sheets:- dependencies:- '@univerjs/protocol':- specifier: ^0.1.20- version: 0.1.20(@grpc/[email protected])([email protected])devDependencies:'@univerjs/core':specifier: workspace:*@@ -897,10 +889,6 @@ importers:version: 1.5.0(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])packages/sheets-conditional-formatting:- dependencies:- '@univerjs/protocol':- specifier: ^0.1.20- version: 0.1.20(@grpc/[email protected])([email protected])devDependencies:'@univerjs/core':specifier: workspace:*