diff --git a/packages/core/src/common/unit.ts b/packages/core/src/common/unit.ts index d68ce98a10..3122741c56 100644 --- a/packages/core/src/common/unit.ts +++ b/packages/core/src/common/unit.ts @@ -14,18 +14,22 @@ * limitations under the License. */ -import type { UniverType } from '@univerjs/protocol'; import type { Observable } from 'rxjs'; import { Disposable } from '../shared/lifecycle'; -export { UniverType as UniverInstanceType } from '@univerjs/protocol'; - -export type UnitType = UniverType | number; +export enum UniverInstanceType { + UNIVER_UNKNOWN = 0, + UNIVER_DOC = 1, // Univer Docs + UNIVER_SHEET = 2, // Univer Sheets + UNIVER_SLIDE = 3, // Univer Slides + UNIVER_PROJECT = 4, + UNRECOGNIZED = -1, +} /** * The base class for all units. */ -export abstract class UnitModel extends Disposable { +export abstract class UnitModel extends Disposable { abstract readonly type: T; abstract getUnitId(): string; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 907c9dd69f..0aec76b94f 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -41,7 +41,7 @@ export { Registry, RegistryAsMap } from './common/registry'; export { requestImmediateMacroTask } from './common/request-immediate-macro-task'; export { type ISequenceExecuteResult, sequence, sequenceAsync } from './common/sequence'; export { mergeSets } from './common/set'; -export { UnitModel, type UnitType, UniverInstanceType } from './common/unit'; +export { UnitModel, UniverInstanceType } from './common/unit'; export { resolveWithBasePath } from './common/url'; export * from './docs/data-model'; export { JSON1, JSONX } from './docs/data-model/json-x/json-x'; diff --git a/packages/core/src/services/authz-io/authz-io-local.service.ts b/packages/core/src/services/authz-io/authz-io-local.service.ts index 006d5be6f3..71b6d625d0 100644 --- a/packages/core/src/services/authz-io/authz-io-local.service.ts +++ b/packages/core/src/services/authz-io/authz-io-local.service.ts @@ -16,8 +16,9 @@ import type { IActionInfo, IAllowedRequest, IBatchAllowedResponse, ICollaborator, ICreateRequest, ICreateRequest_SelectRangeObject, IListPermPointRequest, IPermissionPoint, IPutCollaboratorsRequest, IUnitRoleKV, IUpdatePermPointRequest, UnitAction, UnitObject } from '@univerjs/protocol'; import type { IAuthzIoService } from './type'; -import { ObjectScope, UnitRole, UniverType } from '@univerjs/protocol'; +import { ObjectScope, UnitRole } from '@univerjs/protocol'; import { Inject } from '../../common/di'; +import { UniverInstanceType } from '../../common/unit'; import { generateRandomId } from '../../shared/tools'; import { IResourceManagerService } from '../resource-manager/type'; import { createDefaultUser, isDevRole } from '../user-manager/const'; @@ -86,7 +87,7 @@ export class AuthzIoLocalService implements IAuthzIoService { return JSON.parse(json); }, pluginName: 'SHEET_AuthzIoMockService_PLUGIN', - businesses: [UniverType.UNIVER_SHEET, UniverType.UNIVER_DOC, UniverType.UNIVER_SLIDE], + businesses: [UniverInstanceType.UNIVER_SHEET, UniverInstanceType.UNIVER_DOC, UniverInstanceType.UNIVER_SLIDE], onLoad: (_unitId, resource) => { for (const key in resource) { this._permissionMap.set(key, resource[key]); diff --git a/packages/core/src/services/authz-io/type.ts b/packages/core/src/services/authz-io/type.ts index e8d5a62670..e7ca283bc9 100644 --- a/packages/core/src/services/authz-io/type.ts +++ b/packages/core/src/services/authz-io/type.ts @@ -14,7 +14,24 @@ * limitations under the License. */ -import type { IAllowedRequest, IAllowedResponse, IBatchAllowedResponse, ICreateCollaboratorRequest, ICreateRequest, ICreateResponse, IDeleteCollaboratorRequest, IListCollaboratorRequest, IListCollaboratorResponse, IListPermPointRequest, IListPermPointResponse, IListRolesRequest, IListRolesResponse, IPutCollaboratorsRequest, IUpdateCollaboratorRequest, IUpdatePermPointRequest } from '@univerjs/protocol'; +import type { + IAllowedRequest, + IAllowedResponse, + IBatchAllowedResponse, + ICreateCollaboratorRequest, + ICreateRequest, + ICreateResponse, + IDeleteCollaboratorRequest, + IListCollaboratorRequest, + IListCollaboratorResponse, + IListPermPointRequest, + IListPermPointResponse, + IListRolesRequest, + IListRolesResponse, + IPutCollaboratorsRequest, + IUpdateCollaboratorRequest, + IUpdatePermPointRequest, +} from '@univerjs/protocol'; import type { ILogContext } from '../log/context'; import { createIdentifier } from '../../common/di'; diff --git a/packages/core/src/services/instance/instance.service.ts b/packages/core/src/services/instance/instance.service.ts index 8860d9834b..c06c7d5842 100644 --- a/packages/core/src/services/instance/instance.service.ts +++ b/packages/core/src/services/instance/instance.service.ts @@ -16,7 +16,7 @@ import type { Observable } from 'rxjs'; import type { IDisposable } from '../../common/di'; -import type { UnitModel, UnitType } from '../../common/unit'; +import type { UnitModel } from '../../common/unit'; import type { Nullable } from '../../shared'; import { BehaviorSubject, distinctUntilChanged, filter, map, Subject } from 'rxjs'; import { createIdentifier, Inject, Injector } from '../../common/di'; @@ -50,7 +50,7 @@ export interface IUniverInstanceService { /** Omits value when a new UnitModel is created. */ unitAdded$: Observable; /** Subscribe to curtain type of units' creation. */ - getTypeOfUnitAdded$(type: UnitType): Observable; + getTypeOfUnitAdded$(type: UniverInstanceType): Observable; /** @ignore */ __addUnit(unit: UnitModel): void; @@ -58,7 +58,7 @@ export interface IUniverInstanceService { /** Omits value when a UnitModel is disposed. */ unitDisposed$: Observable; /** Subscribe to curtain type of units' disposing. */ - getTypeOfUnitDisposed$(type: UnitType): Observable; + getTypeOfUnitDisposed$(type: UniverInstanceType): Observable; /** * An observable value that emits the id of the focused unit. A Univer app instance @@ -74,24 +74,24 @@ export interface IUniverInstanceService { getFocusedUnit(): Nullable; /** @deprecated Use `getCurrentUnitOfType` instead. */ - getCurrentUnitForType(type: UnitType): Nullable; - getCurrentUnitOfType(type: UnitType): Nullable; + getCurrentUnitForType(type: UniverInstanceType): Nullable; + getCurrentUnitOfType(type: UniverInstanceType): Nullable; setCurrentUnitForType(unitId: string): void; - getCurrentTypeOfUnit$(type: UnitType): Observable>; + getCurrentTypeOfUnit$(type: UniverInstanceType): Observable>; /** Create a unit with snapshot info. */ - createUnit(type: UnitType, data: Partial, options?: ICreateUnitOptions): U; + createUnit(type: UniverInstanceType, data: Partial, options?: ICreateUnitOptions): U; /** Dispose a unit */ disposeUnit(unitId: string): boolean; - registerCtorForType(type: UnitType, ctor: new (...args: any[]) => T): IDisposable; + registerCtorForType(type: UniverInstanceType, ctor: new (...args: any[]) => T): IDisposable; /** @deprecated */ changeDoc(unitId: string, doc: DocumentDataModel): void; - getUnit(id: string, type?: UnitType): Nullable; - getAllUnitsForType(type: UnitType): T[]; - getUnitType(unitId: string): UnitType; + getUnit(id: string, type?: UniverInstanceType): Nullable; + getAllUnitsForType(type: UniverInstanceType): T[]; + getUnitType(unitId: string): UniverInstanceType; /** @deprecated */ getUniverSheetInstance(unitId: string): Nullable; @@ -103,7 +103,7 @@ export interface IUniverInstanceService { export const IUniverInstanceService = createIdentifier('univer.current'); export class UniverInstanceService extends Disposable implements IUniverInstanceService { - private readonly _unitsByType = new Map(); + private readonly _unitsByType = new Map(); constructor( @Inject(Injector) private readonly _injector: Injector, @@ -126,23 +126,23 @@ export class UniverInstanceService extends Disposable implements IUniverInstance } private _createHandler!: ( - type: UnitType, + type: UniverInstanceType, data: unknown, ctor: UnitCtor, options?: ICreateUnitOptions ) => UnitModel; - __setCreateHandler(handler: (type: UnitType, data: unknown, ctor: UnitCtor, options?: ICreateUnitOptions) => UnitModel): void { + __setCreateHandler(handler: (type: UniverInstanceType, data: unknown, ctor: UnitCtor, options?: ICreateUnitOptions) => UnitModel): void { this._createHandler = handler; } - createUnit(type: UnitType, data: T, options?: ICreateUnitOptions): U { + createUnit(type: UniverInstanceType, data: T, options?: ICreateUnitOptions): U { const model = this._createHandler(type, data, this._ctorByType.get(type)!, options); return model as U; } - private readonly _ctorByType = new Map UnitModel>(); - registerCtorForType(type: UnitType, ctor: new () => T): IDisposable { + private readonly _ctorByType = new Map UnitModel>(); + registerCtorForType(type: UniverInstanceType, ctor: new () => T): IDisposable { this._ctorByType.set(type, ctor); return { @@ -152,22 +152,22 @@ export class UniverInstanceService extends Disposable implements IUniverInstance }; } - __getCtorByType(type: UnitType): UnitCtor | undefined { + __getCtorByType(type: UniverInstanceType): UnitCtor | undefined { return this._ctorByType.get(type); } - private _currentUnits = new Map>(); - private readonly _currentUnits$ = new BehaviorSubject>>(this._currentUnits); + private _currentUnits = new Map>(); + private readonly _currentUnits$ = new BehaviorSubject>>(this._currentUnits); readonly currentUnits$ = this._currentUnits$.asObservable(); getCurrentTypeOfUnit$(type: number): Observable> { return this.currentUnits$.pipe(map((units) => units.get(type) ?? null), distinctUntilChanged()) as Observable>; } - getCurrentUnitForType(type: UnitType): Nullable { + getCurrentUnitForType(type: UniverInstanceType): Nullable { return this._currentUnits.get(type) as Nullable; } - getCurrentUnitOfType(type: UnitType): Nullable { + getCurrentUnitOfType(type: UniverInstanceType): Nullable { return this.getCurrentUnitForType(type); } @@ -181,7 +181,7 @@ export class UniverInstanceService extends Disposable implements IUniverInstance private readonly _unitAdded$ = new Subject(); readonly unitAdded$ = this._unitAdded$.asObservable(); - getTypeOfUnitAdded$>(type: UnitType): Observable { + getTypeOfUnitAdded$>(type: UniverInstanceType): Observable { return this._unitAdded$.pipe(filter((unit) => unit.type === type)) as Observable; } @@ -220,7 +220,7 @@ export class UniverInstanceService extends Disposable implements IUniverInstance return this.unitDisposed$.pipe(filter((unit) => unit.type === type)) as Observable; } - getUnit(id: string, type?: UnitType): Nullable { + getUnit(id: string, type?: UniverInstanceType): Nullable { const unit = this._getUnitById(id)?.[0] as Nullable; if (type && unit?.type !== type) return null; return unit; @@ -238,7 +238,7 @@ export class UniverInstanceService extends Disposable implements IUniverInstance return this.getUnit(unitId, UniverInstanceType.UNIVER_SHEET); } - getAllUnitsForType(type: UnitType): T[] { + getAllUnitsForType(type: UniverInstanceType): T[] { return (this._unitsByType.get(type) ?? []) as T[]; } @@ -327,7 +327,7 @@ export class UniverInstanceService extends Disposable implements IUniverInstance return true; } - private _tryResetCurrentOnRemoval(unitId: string, type: UnitType): void { + private _tryResetCurrentOnRemoval(unitId: string, type: UniverInstanceType): void { const current = this.getCurrentUnitForType(type); if (current?.getUnitId() === unitId) { this._currentUnits.set(type, null); @@ -341,7 +341,7 @@ export class UniverInstanceService extends Disposable implements IUniverInstance } }; - private _getUnitById(unitId: string): Nullable<[UnitModel, UnitType]> { + private _getUnitById(unitId: string): Nullable<[UnitModel, UniverInstanceType]> { for (const [type, units] of this._unitsByType) { const unit = units.find((unit) => unit.getUnitId() === unitId); if (unit) { diff --git a/packages/core/src/services/plugin/plugin.service.ts b/packages/core/src/services/plugin/plugin.service.ts index 67d6a35dae..dc0cc303f3 100644 --- a/packages/core/src/services/plugin/plugin.service.ts +++ b/packages/core/src/services/plugin/plugin.service.ts @@ -15,7 +15,7 @@ */ import type { Ctor, IDisposable } from '../../common/di'; -import type { UnitType } from '../../common/unit'; + import { skip } from 'rxjs'; import pkg from '../../../package.json'; import { Inject, Injector } from '../../common/di'; @@ -30,7 +30,7 @@ const INIT_LAZY_PLUGINS_TIMEOUT = 4; export const DependentOnSymbol = Symbol('DependentOn'); export type PluginCtor = Ctor & { - type: UnitType; + type: UniverInstanceType; pluginName: string; packageName: string; version: string; @@ -45,7 +45,7 @@ export abstract class Plugin extends Disposable { static packageName = pkg.name; static version = pkg.version; - static type: UnitType = UniverInstanceType.UNIVER_UNKNOWN; + static type: UniverInstanceType = UniverInstanceType.UNIVER_UNKNOWN; protected abstract _injector: Injector; @@ -65,7 +65,7 @@ export abstract class Plugin extends Disposable { // empty } - getUnitType(): UnitType { + getUnitType(): UniverInstanceType { return (this.constructor as typeof Plugin).type; } @@ -129,7 +129,7 @@ export class PluginService implements IDisposable { private readonly _seenPlugins = new Set(); private readonly _loadedPlugins = new Set(); - private readonly _loadedPluginTypes = new Set([UniverInstanceType.UNIVER_UNKNOWN]); + private readonly _loadedPluginTypes = new Set([UniverInstanceType.UNIVER_UNKNOWN]); constructor( @Inject(Injector) private readonly _injector: Injector, @@ -165,7 +165,7 @@ export class PluginService implements IDisposable { } } - startPluginsForType(type: UnitType): void { + startPluginsForType(type: UniverInstanceType): void { if (this._loadedPluginTypes.has(type)) { return; } @@ -173,7 +173,7 @@ export class PluginService implements IDisposable { this._loadPluginsForType(type); } - private _loadPluginsForType(type: UnitType): void { + private _loadPluginsForType(type: UniverInstanceType): void { const keys = Array.from(this._pluginRegistry.keys()); const allPluginsOfThisType: IPluginRegistryItem[] = []; keys.forEach((key) => { @@ -213,8 +213,8 @@ export class PluginService implements IDisposable { this._seenPlugins.add(ctor.pluginName); } - private _flushTimerByType = new Map(); - private _flushType(type: UnitType): void { + private _flushTimerByType = new Map(); + private _flushType(type: UniverInstanceType): void { if (this._flushTimerByType.get(type) === undefined) { this._flushTimerByType.set(type, setTimeout(() => { this._loadPluginsForType(type); diff --git a/packages/core/src/univer.ts b/packages/core/src/univer.ts index 36a62b8267..faf32fbb90 100644 --- a/packages/core/src/univer.ts +++ b/packages/core/src/univer.ts @@ -16,7 +16,7 @@ import type { Theme } from '@univerjs/themes'; import type { Dependency, IDisposable } from './common/di'; -import type { UnitModel, UnitType } from './common/unit'; +import type { UnitModel } from './common/unit'; import type { LogLevel } from './services/log/log.service'; import type { DependencyOverride } from './services/plugin/plugin-override'; import type { Plugin, PluginCtor } from './services/plugin/plugin.service'; @@ -96,7 +96,7 @@ export interface IUniverConfig { * @hideconstructor */ export class Univer implements IDisposable { - private _startedTypes = new Set(); + private _startedTypes = new Set(); private _injector: Injector; private get _univerInstanceService(): IUniverInstanceService { @@ -159,7 +159,7 @@ export class Univer implements IDisposable { this._injector.get(LocaleService).setLocale(locale); } - createUnit(type: UnitType, data: Partial): U { + createUnit(type: UniverInstanceType, data: Partial): U { return this._univerInstanceService.createUnit(type, data); } @@ -170,7 +170,7 @@ export class Univer implements IDisposable { const univerInstanceService = injector.get(IUniverInstanceService) as UniverInstanceService; univerInstanceService.__setCreateHandler( - (type: UnitType, data, ctor, options) => { + (type: UniverInstanceType, data, ctor, options) => { const isFirstTime = !this._startedTypes.has(type); if (isFirstTime) { this._pluginService.startPluginsForType(type); diff --git a/packages/engine-render/src/render-manager/render-manager.service.ts b/packages/engine-render/src/render-manager/render-manager.service.ts index a3189a07f7..fc5a56af83 100644 --- a/packages/engine-render/src/render-manager/render-manager.service.ts +++ b/packages/engine-render/src/render-manager/render-manager.service.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { Dependency, DependencyIdentifier, IDisposable, Nullable, UnitModel, UnitType } from '@univerjs/core'; +import type { Dependency, DependencyIdentifier, IDisposable, Nullable, UnitModel } from '@univerjs/core'; import type { Observable } from 'rxjs'; import type { BaseObject } from '../base-object'; import type { DocComponent } from '../components/docs/doc-component'; @@ -73,7 +73,7 @@ export interface IRenderManagerService extends IDisposable { * @param type * @param dep */ - registerRenderModule(type: UnitType, dep: Dependency): IDisposable; + registerRenderModule(type: UniverInstanceType, dep: Dependency): IDisposable; } const DEFAULT_SCENE_SIZE = { width: 1500, height: 1000 }; @@ -102,7 +102,7 @@ export class RenderManagerService extends Disposable implements IRenderManagerSe return this._defaultEngine; } - private readonly _renderDependencies = new Map(); + private readonly _renderDependencies = new Map(); constructor( @Inject(Injector) protected readonly _injector: Injector, @@ -124,7 +124,7 @@ export class RenderManagerService extends Disposable implements IRenderManagerSe this._renderDisposed$.complete(); } - registerRenderModules(type: UnitType, deps: Dependency[]): IDisposable { + registerRenderModules(type: UniverInstanceType, deps: Dependency[]): IDisposable { if (!this._renderDependencies.has(type)) { this._renderDependencies.set(type, []); } @@ -149,7 +149,7 @@ export class RenderManagerService extends Disposable implements IRenderManagerSe * @param type * @param depCtor */ - registerRenderModule(type: UnitType, depCtor: Dependency): IDisposable { + registerRenderModule(type: UniverInstanceType, depCtor: Dependency): IDisposable { if (!this._renderDependencies.has(type)) { this._renderDependencies.set(type, []); } @@ -172,7 +172,7 @@ export class RenderManagerService extends Disposable implements IRenderManagerSe * @param type * @returns Dependency[] */ - private _getRenderDepsByType(type: UnitType): Array { + private _getRenderDepsByType(type: UniverInstanceType): Array { return Array.from(this._renderDependencies.get(type) ?? []); } diff --git a/packages/engine-render/src/render-manager/render-unit.ts b/packages/engine-render/src/render-manager/render-unit.ts index 6e518d07d2..c2b272912b 100644 --- a/packages/engine-render/src/render-manager/render-unit.ts +++ b/packages/engine-render/src/render-manager/render-unit.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { Dependency, DependencyIdentifier, IDisposable, Nullable, UnitModel, UnitType, UniverInstanceType } from '@univerjs/core'; +import type { Dependency, DependencyIdentifier, IDisposable, Nullable, UnitModel, UniverInstanceType } from '@univerjs/core'; import type { Observable } from 'rxjs'; import type { Engine } from '../engine'; import type { Scene } from '../scene'; @@ -68,7 +68,7 @@ export interface IRenderModule extends IDisposable { } */ export interface IRenderContext extends Omit { unit: T; - type: UnitType; + type: UniverInstanceType; } /** @@ -82,7 +82,7 @@ export class RenderUnit extends Disposable implements IRender { readonly activated$ = this._activated$.pipe(distinctUntilChanged()); get unitId(): string { return this._renderContext.unitId; } - get type(): UnitType { return this._renderContext.type; } + get type(): UniverInstanceType { return this._renderContext.type; } private readonly _injector: Injector; diff --git a/packages/sheets-ui/src/commands/commands/worksheet-protection.command.ts b/packages/sheets-ui/src/commands/commands/worksheet-protection.command.ts index d547d7f7d9..840ed563d5 100644 --- a/packages/sheets-ui/src/commands/commands/worksheet-protection.command.ts +++ b/packages/sheets-ui/src/commands/commands/worksheet-protection.command.ts @@ -16,9 +16,8 @@ import type { ICommand, Workbook } from '@univerjs/core'; -import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core'; +import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core'; -import { UniverType } from '@univerjs/protocol'; import { AddWorksheetProtectionCommand, DeleteWorksheetProtectionCommand, WorksheetProtectionRuleModel } from '@univerjs/sheets'; export const DeleteWorksheetProtectionFormSheetBarCommand: ICommand = { @@ -34,7 +33,7 @@ export const DeleteWorksheetProtectionFormSheetBarCommand: ICommand = { const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel); const univerInstanceService = accessor.get(IUniverInstanceService); - const workbook = univerInstanceService.getCurrentUnitForType(UniverType.UNIVER_SHEET)!; + const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)!; const worksheet = workbook?.getActiveSheet(); const unitId = workbook.getUnitId(); diff --git a/packages/sheets/src/services/permission/range-permission/range-protection.service.ts b/packages/sheets/src/services/permission/range-permission/range-protection.service.ts index 04deb35996..ea2713ea71 100644 --- a/packages/sheets/src/services/permission/range-permission/range-protection.service.ts +++ b/packages/sheets/src/services/permission/range-permission/range-protection.service.ts @@ -17,8 +17,8 @@ import type { UnitAction } from '@univerjs/protocol'; import type { IObjectModel } from '../../../model/range-protection-rule.model'; -import { Disposable, Inject, IPermissionService, IResourceManagerService, IUniverInstanceService } from '@univerjs/core'; -import { UnitObject, UniverType } from '@univerjs/protocol'; +import { Disposable, Inject, IPermissionService, IResourceManagerService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core'; +import { UnitObject } from '@univerjs/protocol'; import { RangeProtectionRuleModel } from '../../../model/range-protection-rule.model'; import { RangeProtectionCache } from '../../../model/range-protection.cache'; @@ -95,7 +95,7 @@ export class RangeProtectionService extends Disposable { toJson, parseJson, pluginName: PLUGIN_NAME, - businesses: [UniverType.UNIVER_SHEET], + businesses: [UniverInstanceType.UNIVER_SHEET], onLoad: (unitId, resources) => { const result = this._selectionProtectionRuleModel.toObject(); result[unitId] = resources; diff --git a/packages/sheets/src/services/permission/worksheet-permission/worksheet-permission.service.ts b/packages/sheets/src/services/permission/worksheet-permission/worksheet-permission.service.ts index 189fe39e5c..df7917833e 100644 --- a/packages/sheets/src/services/permission/worksheet-permission/worksheet-permission.service.ts +++ b/packages/sheets/src/services/permission/worksheet-permission/worksheet-permission.service.ts @@ -17,7 +17,6 @@ import type { Workbook, Worksheet } from '@univerjs/core'; import type { IObjectModel, IObjectPointModel } from '../type'; import { ILogService, Inject, Injector, IPermissionService, IResourceManagerService, IUniverInstanceService, RxDisposable, UniverInstanceType } from '@univerjs/core'; -import { UniverType } from '@univerjs/protocol'; import { takeUntil } from 'rxjs/operators'; import { RangeProtectionRuleModel } from '../../../model/range-protection-rule.model'; @@ -147,7 +146,7 @@ export class WorksheetPermissionService extends RxDisposable { toJson, parseJson, pluginName: RULE_MODEL_PLUGIN_NAME, - businesses: [UniverType.UNIVER_SHEET], + businesses: [UniverInstanceType.UNIVER_SHEET], onLoad: (unitId, resources) => { this._worksheetProtectionRuleModel.fromObject(resources); Object.keys(resources).forEach((subUnitId) => { @@ -202,7 +201,7 @@ export class WorksheetPermissionService extends RxDisposable { toJson, parseJson, pluginName: POINT_MODEL_PLUGIN_NAME, - businesses: [UniverType.UNIVER_SHEET], + businesses: [UniverInstanceType.UNIVER_SHEET], onLoad: (unitId, resources) => { this._worksheetProtectionPointRuleModel.fromObject(resources); Object.keys(resources).forEach((subUnitId) => {