Skip to content

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.

feat(core): refactoring resources load and snapshot (#1853)

Gpound.liu8ae91b766439
diff --git a/examples/src/plugins/debugger/commands/operations/save-snapshot.operations.ts b/examples/src/plugins/debugger/commands/operations/save-snapshot.operations.ts
index d829c52146..85977f3179 100644
--- a/examples/src/plugins/debugger/commands/operations/save-snapshot.operations.ts
+++ b/examples/src/plugins/debugger/commands/operations/save-snapshot.operations.ts
@@ -16,7 +16,7 @@
/* eslint-disable node/prefer-global/process */
import type { ICommand, IStyleData, IWorkbookData } from '@univerjs/core';
-import { CommandType, ISnapshotPersistenceService, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
+import { CommandType, IResourceLoaderService, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
import type { IAccessor } from '@wendellhu/redi';
import { ExportController, RecordController } from '../../../local-save';
@@ -48,13 +48,13 @@ export const SaveSnapshotOptions: ICommand = {
type: CommandType.OPERATION,
handler: async (accessor: IAccessor, params: ISaveSnapshotParams) => {
const univerInstanceService = accessor.get(IUniverInstanceService);
- const localPersistenceService = accessor.get(ISnapshotPersistenceService);
+ const resourceLoaderService = accessor.get(IResourceLoaderService);
const exportController = accessor.get(ExportController);
const recordController = accessor.get(RecordController);
const workbook = univerInstanceService.getCurrentUniverSheetInstance()!;
const worksheet = workbook.getActiveSheet();
- const snapshot = localPersistenceService.saveWorkbook(workbook);
+ const snapshot = resourceLoaderService.saveWorkbook(workbook);
const gitHash = process.env.GIT_COMMIT_HASH;
const gitBranch = process.env.GIT_REF_NAME;
const buildTime = process.env.BUILD_TIME;
diff --git a/examples/src/plugins/debugger/controllers/debugger.controller.ts b/examples/src/plugins/debugger/controllers/debugger.controller.ts
index e2c2c49ad1..f947f6c375 100644
--- a/examples/src/plugins/debugger/controllers/debugger.controller.ts
+++ b/examples/src/plugins/debugger/controllers/debugger.controller.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { Disposable, ICommandService, ISnapshotPersistenceService, IUniverInstanceService } from '@univerjs/core';
+import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
import { ComponentManager, IMenuService } from '@univerjs/ui';
import { Inject, Injector } from '@wendellhu/redi';
-import { ExportController, LocalSnapshotService, RecordController } from '../../local-save';
+import { ExportController, RecordController } from '../../local-save';
import { ConfirmOperation } from '../commands/operations/confirm.operation';
import { DialogOperation } from '../commands/operations/dialog.operation';
import { LocaleOperation } from '../commands/operations/locale.operation';
@@ -71,7 +71,6 @@ export class DebuggerController extends Disposable {
SaveSnapshotOptions,
].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
- this._injector.add([ISnapshotPersistenceService, { useClass: LocalSnapshotService }]);
this._injector.add([ExportController]);
this._injector.add([RecordController]);
}
diff --git a/examples/src/plugins/local-save/index.ts b/examples/src/plugins/local-save/index.ts
index fe3d3c5b4f..f5098dde2a 100644
--- a/examples/src/plugins/local-save/index.ts
+++ b/examples/src/plugins/local-save/index.ts
@@ -16,4 +16,3 @@
export { ExportController } from './controller/export.controller';
export { RecordController } from './controller/record.controller';
-export { LocalSnapshotService } from './services/local-snapshot.service';
diff --git a/examples/src/plugins/local-save/services/local-snapshot.service.ts b/examples/src/plugins/local-save/services/local-snapshot.service.ts
deleted file mode 100644
index d8bc55f9a7..0000000000
--- a/examples/src/plugins/local-save/services/local-snapshot.service.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import type { ISnapshotPersistenceService, Workbook } from '@univerjs/core';
-import { Disposable, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
-import { Inject } from '@wendellhu/redi';
-
-export class LocalSnapshotService extends Disposable implements ISnapshotPersistenceService {
- constructor(
- @Inject(IResourceManagerService) private _resourceManagerService: IResourceManagerService,
- @Inject(IUniverInstanceService) private _univerInstanceService: IUniverInstanceService
- ) {
- super();
- this._initWorkBook();
- }
-
- private _initWorkBook() {
- this._univerInstanceService.sheetAdded$.subscribe((workbook) => this._initWorkbookFromSnapshot(workbook));
- const workbooks = this._univerInstanceService.getAllUniverSheetsInstance();
- workbooks.forEach((workbook) => {
- this._initWorkbookFromSnapshot(workbook);
- });
- }
-
- private _initWorkbookFromSnapshot(workbook: Workbook) {
- const unitId = workbook.getUnitId();
- const snapshot = workbook.getSnapshot();
- const resources = this._resourceManagerService.getAllResource(unitId);
- resources.forEach((resource) => {
- const resourceSnapshot = (snapshot.resources || []).find((item) => item.name === resource.resourceName);
- if (resourceSnapshot) {
- const model = resource.hook.parseJson(resourceSnapshot.data);
- resource.hook.onChange(unitId, model);
- }
- });
- }
-
- saveWorkbook(workbook: Workbook) {
- const snapshot = { ...workbook.getSnapshot() };
- const unitId = workbook.getUnitId();
- const resourceHooks = this._resourceManagerService.getAllResource(workbook.getUnitId());
- const resources = resourceHooks.map((resourceHook) => {
- const data = resourceHook.hook.toJson(unitId);
- return {
- name: resourceHook.resourceName,
- data,
- };
- });
- snapshot.resources = resources;
- return snapshot;
- }
-}
diff --git a/packages/core/src/basics/univer.ts b/packages/core/src/basics/univer.ts
index b51207f722..d601f7b39f 100644
--- a/packages/core/src/basics/univer.ts
+++ b/packages/core/src/basics/univer.ts
@@ -36,6 +36,8 @@ import { IPermissionService, PermissionService } from '../services/permission/pe
import { UniverPermissionService } from '../services/permission/univer.permission.service';
import { ResourceManagerService } from '../services/resource-manager/resource-manager.service';
import { IResourceManagerService } from '../services/resource-manager/type';
+import { ResourceLoaderService } from '../services/resource-loader/resource-loader';
+import { IResourceLoaderService } from '../services/resource-loader/type';
import { ThemeService } from '../services/theme/theme.service';
import { IUndoRedoService, LocalUndoRedoService } from '../services/undoredo/undoredo.service';
import type { Workbook } from '../sheets/workbook';
@@ -213,6 +215,7 @@ export class Univer extends PluginHolder {
[IContextService, { useClass: ContextService }],
[IFloatingObjectManagerService, { useClass: FloatingObjectManagerService, lazy: true }],
[IResourceManagerService, { useClass: ResourceManagerService, lazy: true }],
+ [IResourceLoaderService, { useClass: ResourceLoaderService, lazy: true }],
]);
}
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index b8ce3e9da4..592a6a01b9 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -88,9 +88,10 @@ export {
UniverEditablePermissionPoint,
UniverPermissionService,
} from './services/permission';
+export { IResourceLoaderService } from './services/resource-loader/type';
export { ResourceManagerService } from './services/resource-manager/resource-manager.service';
export type { IResourceHook } from './services/resource-manager/type';
-export { IResourceManagerService, ISnapshotPersistenceService } from './services/resource-manager/type';
+export { IResourceManagerService } from './services/resource-manager/type';
export { type IStyleSheet, ThemeService } from './services/theme/theme.service';
export {
type IUndoRedoCommandInfos,
diff --git a/packages/core/src/services/permission/permission.service.ts b/packages/core/src/services/permission/permission.service.ts
index 764362c15d..fd3a2424f8 100644
--- a/packages/core/src/services/permission/permission.service.ts
+++ b/packages/core/src/services/permission/permission.service.ts
@@ -20,7 +20,7 @@ import { BehaviorSubject, combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import type { PermissionPoint } from '../../shared';
-import { Disposable, PermissionStatus, toDisposable } from '../../shared';
+import { Disposable, PermissionStatus } from '../../shared';
import type { Nullable } from '../../shared/types';
import { IUniverInstanceService } from '../instance/instance.service';
import { LifecycleStages, OnLifecycle } from '../lifecycle/lifecycle';
@@ -50,34 +50,34 @@ export class PermissionService extends Disposable implements IPermissionService
// this._init();
}
- private _init() {
- this.disposeWithMe(
- toDisposable(
- this._univerInstanceService.sheetAdded$.subscribe((workbook) => {
- this._resourceManagerService.registerPluginResource(workbook.getUnitId(), resourceKey, {
- onChange: (unitID, value) => {
- (value as PermissionPoint[]).forEach((permissionPoint) => {
- if (this.getPermissionPoint(unitID, permissionPoint.id)) {
- this.updatePermissionPoint(unitID, permissionPoint.id, permissionPoint.value);
- } else {
- this.addPermissionPoint(unitID, permissionPoint);
- }
- });
- },
- toJson: (unitID: string) => this._toJson(unitID),
- parseJson: (json: string) => this._parseJson(json),
- });
- })
- )
- );
- this.disposeWithMe(
- toDisposable(
- this._univerInstanceService.sheetDisposed$.subscribe((workbook) => {
- this._resourceManagerService.disposePluginResource(workbook.getUnitId(), resourceKey);
- })
- )
- );
- }
+ // private _init() {
+ // this.disposeWithMe(
+ // toDisposable(
+ // this._univerInstanceService.sheetAdded$.subscribe((workbook) => {
+ // this._resourceManagerService.registerPluginResource(workbook.getUnitId(), resourceKey, {
+ // onChange: (unitID, value) => {
+ // (value as PermissionPoint[]).forEach((permissionPoint) => {
+ // if (this.getPermissionPoint(unitID, permissionPoint.id)) {
+ // this.updatePermissionPoint(unitID, permissionPoint.id, permissionPoint.value);
+ // } else {
+ // this.addPermissionPoint(unitID, permissionPoint);
+ // }
+ // });
+ // },
+ // toJson: (unitID: string) => this._toJson(unitID),
+ // parseJson: (json: string) => this._parseJson(json),
+ // });
+ // })
+ // )
+ // );
+ // this.disposeWithMe(
+ // toDisposable(
+ // this._univerInstanceService.sheetDisposed$.subscribe((workbook) => {
+ // this._resourceManagerService.disposePluginResource(workbook.getUnitId(), resourceKey);
+ // })
+ // )
+ // );
+ // }
private _toJson(unitID: string) {
const permissionMap = this._permissionPointMap.get(unitID);
diff --git a/packages/core/src/services/resource-loader/resource-loader.ts b/packages/core/src/services/resource-loader/resource-loader.ts
new file mode 100644
index 0000000000..ff7e5797c7
--- /dev/null
+++ b/packages/core/src/services/resource-loader/resource-loader.ts
@@ -0,0 +1,101 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { 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';
+import { IResourceManagerService } from '../resource-manager/type';
+import { IUniverInstanceService } from '../instance/instance.service';
+import { Disposable, toDisposable } from '../../shared/lifecycle';
+import type { IResourceLoaderService } from './type';
+
+
+export class ResourceLoaderService extends Disposable implements IResourceLoaderService {
+ constructor(
+ @Inject(IResourceManagerService) private readonly _resourceManagerService: IResourceManagerService,
+ @Inject(IUniverInstanceService) private readonly _univerInstanceService: IUniverInstanceService
+
+
+ ) {
+ super();
+ this._init();
+ }
+
+ private _init() {
+ const handleHookAdd = (hook: IResourceHook) => {
+ hook.businesses.forEach((business) => {
+ switch (business) {
+ case UniverType.UNRECOGNIZED:
+ case UniverType.UNIVER_UNKNOWN:
+ case UniverType.UNIVER_SLIDE:
+ case UniverType.UNIVER_DOC: {
+ // TODO@gggpound: wait to support.
+ break;
+ }
+ case UniverType.UNIVER_SHEET: {
+ this._univerInstanceService.getAllUniverSheetsInstance().forEach((workbook) => {
+ const snapshotResource = workbook.getSnapshot().resources || [];
+ const plugin = snapshotResource.find((r) => r.name === hook.pluginName);
+ if (plugin) {
+ try {
+ const data = hook.parseJson(plugin.data);
+ hook.onLoad(workbook.getUnitId(), data);
+ } catch (err) {
+ console.error(`Load Workbook{${workbook.getUnitId()}} Resources{${hook.pluginName}} Data Error.`);
+ }
+ }
+ });
+ }
+ }
+ });
+ };
+
+ const allResourceHooks = this._resourceManagerService.getAllResourceHooks();
+ allResourceHooks.forEach((hook) => {
+ handleHookAdd(hook);
+ });
+
+ this.disposeWithMe(this._resourceManagerService.register$.subscribe((hook) => {
+ handleHookAdd(hook);
+ }));
+
+ this.disposeWithMe(
+ toDisposable(
+ this._univerInstanceService.sheetAdded$.subscribe((workbook) => {
+ this._resourceManagerService.loadResources(workbook.getUnitId(), workbook.getSnapshot().resources);
+ })
+ )
+ );
+
+ this.disposeWithMe(
+ toDisposable(
+ this._univerInstanceService.sheetDisposed$.subscribe((workbook) => {
+ this._resourceManagerService.unloadResources(workbook.getUnitId());
+ })
+ )
+ );
+ }
+
+ saveWorkbook: (workbook: Workbook) => IWorkbookData = (workbook) => {
+ const unitId = workbook.getUnitId();
+ const resources = this._resourceManagerService.getResources(unitId) || [];
+ const snapshot = workbook.getSnapshot();
+ snapshot.resources = resources;
+ return snapshot;
+ };
+}
diff --git a/packages/core/src/services/resource-loader/type.ts b/packages/core/src/services/resource-loader/type.ts
new file mode 100644
index 0000000000..c7358ed445
--- /dev/null
+++ b/packages/core/src/services/resource-loader/type.ts
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { createIdentifier } from '@wendellhu/redi';
+import type { Workbook } from '../../sheets/workbook';
+import type { IWorkbookData } from '../../types/interfaces/i-workbook-data';
+import { LifecycleStages, runOnLifecycle } from '../lifecycle/lifecycle';
+
+export interface IResourceLoaderService {
+ saveWorkbook: (workbook: Workbook) => IWorkbookData;
+}
+export const IResourceLoaderService = createIdentifier<IResourceLoaderService>('resource-loader-service');
+runOnLifecycle(LifecycleStages.Ready, IResourceLoaderService);
diff --git a/packages/core/src/services/resource-manager/resource-manager.service.ts b/packages/core/src/services/resource-manager/resource-manager.service.ts
index e769b2e2e6..717d63e3d0 100644
--- a/packages/core/src/services/resource-manager/resource-manager.service.ts
+++ b/packages/core/src/services/resource-manager/resource-manager.service.ts
@@ -15,56 +15,65 @@
*/
import { Subject } from 'rxjs';
-
import { Disposable, toDisposable } from '../../shared/lifecycle';
-import type { IResourceHook, IResourceManagerService } from './type';
+import type { IWorkbookData } from '../../types/interfaces/i-workbook-data';
+import type { IResourceHook, IResourceManagerService, IResourceName } from './type';
export class ResourceManagerService extends Disposable implements IResourceManagerService {
- private _resourceMap = new Map<string, Map<string, IResourceHook>>();
+ private _resourceMap = new Map<IResourceName, IResourceHook>();
- private _register$ = new Subject<{ resourceName: string; hook: IResourceHook; unitID: string }>();
- register$ = this._register$.asObservable();
+ private _register$ = new Subject<IResourceHook>();
+ public register$ = this._register$.asObservable();
- getAllResource(unitID: string) {
- const resourceMap = this._resourceMap.get(unitID);
- if (resourceMap) {
- return [...resourceMap.keys()].reduce(
- (list, resourceName) => {
- const hook = resourceMap.get(resourceName);
- if (hook) {
- list.push({
- unitID,
- resourceName,
- hook,
- });
- }
- return list;
- },
- [] as Array<{ unitID: string; resourceName: string; hook: IResourceHook }>
- );
- }
- return [];
+ public getAllResourceHooks() {
+ const list = [...this._resourceMap.values()];
+ return list;
+ }
+
+ public getResources(unitId: string) {
+ const resourceHooks = this.getAllResourceHooks();
+ const resources = resourceHooks.map((resourceHook) => {
+ const data = resourceHook.toJson(unitId);
+ return {
+ name: resourceHook.pluginName,
+ data,
+ };
+ });
+ return resources;
}
- /**
- * the pluginName is map to resourceId which is created by serve.
- * @param {string} pluginName
- * @param {ResourceHook<T>} hook
- */
- registerPluginResource<T = any>(unitID: string, resourceName: string, hook: IResourceHook<T>) {
- const resourceMap = this._resourceMap.get(unitID) || new Map<string, IResourceHook>();
- if (resourceMap.has(resourceName)) {
+ public registerPluginResource<T = unknown>(hook: IResourceHook<T>) {
+ const resourceName = hook.pluginName;
+ if (this._resourceMap.has(resourceName)) {
throw new Error(`the pluginName is registered {${resourceName}}`);
}
- resourceMap.set(resourceName, hook);
- this._resourceMap.set(unitID, resourceMap);
- this._register$.next({ unitID, resourceName, hook });
- return toDisposable(() => resourceMap.delete(resourceName));
+ this._resourceMap.set(resourceName, hook);
+ this._register$.next(hook);
+ return toDisposable(() => this._resourceMap.delete(resourceName));
+ }
+
+ public disposePluginResource(pluginName: IResourceName) {
+ this._resourceMap.delete(pluginName);
+ }
+
+ public loadResources(unitId: string, resources: IWorkbookData['resources']) {
+ this.getAllResourceHooks().forEach((hook) => {
+ const data = resources?.find((resource) => resource.name === hook.pluginName)?.data;
+ if (data) {
+ try {
+ const model = hook.parseJson(data);
+ hook.onLoad(unitId, model);
+ } catch (err) {
+ console.error('LoadResources Error!');
+ }
+ }
+ });
}
- disposePluginResource(unitID: string, pluginName: string) {
- const resourceMap = this._resourceMap.get(unitID);
- resourceMap?.delete(pluginName);
+ public unloadResources(unitId: string) {
+ this.getAllResourceHooks().forEach((hook) => {
+ hook.onUnLoad(unitId);
+ });
}
override dispose(): void {
diff --git a/packages/core/src/services/resource-manager/type.ts b/packages/core/src/services/resource-manager/type.ts
index 14675f521b..969fa3e8d1 100644
--- a/packages/core/src/services/resource-manager/type.ts
+++ b/packages/core/src/services/resource-manager/type.ts
@@ -17,28 +17,29 @@
import type { IDisposable } from '@wendellhu/redi';
import { createIdentifier } from '@wendellhu/redi';
import type { Observable } from 'rxjs';
-
-import type { Workbook } from '../../sheets/workbook';
+import type { UniverType } from '@univerjs/protocol';
import type { IWorkbookData } from '../../types/interfaces/i-workbook-data';
-import { LifecycleStages, runOnLifecycle } from '../lifecycle/lifecycle';
+type IBusinessName = 'SHEET' | 'DOC';
+export type IResourceName = `${IBusinessName}_${string}_PLUGIN`;
export interface IResourceHook<T = any> {
- onChange: (unitID: string, resource: T) => void;
+ pluginName: IResourceName;
+ businesses: UniverType[];
+ onLoad: (unitID: string, resource: T) => void;
+ onUnLoad: (unitID: string) => void;
toJson: (unitID: string) => string;
parseJson: (bytes: string) => T;
}
export interface IResourceManagerService {
- registerPluginResource: <T = any>(unitID: string, pluginName: string, hook: IResourceHook<T>) => IDisposable;
- disposePluginResource: (unitID: string, pluginName: string) => void;
- getAllResource: (unitID: string) => Array<{ unitID: string; resourceName: string; hook: IResourceHook }>;
- register$: Observable<{ resourceName: string; hook: IResourceHook; unitID: string }>;
-}
+ register$: Observable<IResourceHook>;
+ registerPluginResource: <T = any>(hook: IResourceHook<T>) => IDisposable;
+ disposePluginResource: (pluginName: IResourceName) => void;
+ getAllResourceHooks: () => IResourceHook[];
+ getResources: (unitId: string) => IWorkbookData['resources'];
+ loadResources: (unitId: string, resources: IWorkbookData['resources']) => void;
-export const IResourceManagerService = createIdentifier<IResourceManagerService>('resource-manager-service');
-export interface ISnapshotPersistenceService {
- saveWorkbook: (workbook: Workbook) => IWorkbookData;
+ unloadResources(unitId: string): void;
}
-export const ISnapshotPersistenceService = createIdentifier<ISnapshotPersistenceService>('ResourcePersistenceService');
-runOnLifecycle(LifecycleStages.Ready, ISnapshotPersistenceService);
+export const IResourceManagerService = createIdentifier<IResourceManagerService>('resource-manager-service');
diff --git a/packages/data-validation/package.json b/packages/data-validation/package.json
index 4ddf584741..c713340c80 100644
--- a/packages/data-validation/package.json
+++ b/packages/data-validation/package.json
@@ -63,6 +63,7 @@
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
+ "@univerjs/protocol": "^0.1.14",
"@univerjs/sheets": "workspace:*",
"@wendellhu/redi": "0.13.0",
"rxjs": ">=7.0.0"
diff --git a/packages/data-validation/src/controllers/dv-resource.controller.ts b/packages/data-validation/src/controllers/dv-resource.controller.ts
index 56b79c619c..692a96bb66 100644
--- a/packages/data-validation/src/controllers/dv-resource.controller.ts
+++ b/packages/data-validation/src/controllers/dv-resource.controller.ts
@@ -14,14 +14,15 @@
* limitations under the License.
*/
-import type { ISheetDataValidationRule, Workbook } from '@univerjs/core';
-import { Disposable, IResourceManagerService, IUniverInstanceService, LifecycleStages, OnLifecycle, toDisposable } from '@univerjs/core';
+import type { ISheetDataValidationRule } from '@univerjs/core';
+import { Disposable, IResourceManagerService, IUniverInstanceService, LifecycleStages, OnLifecycle } 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[]>;
-const DATA_VALIDATION_PLUGIN_NAME = 'SHEET_DATA_VALIDATION';
+const DATA_VALIDATION_PLUGIN_NAME = 'SHEET_DATA_VALIDATION_PLUGIN';
@OnLifecycle(LifecycleStages.Ready, DataValidationResourceController)
export class DataValidationResourceController extends Disposable {
@@ -56,33 +57,24 @@ export class DataValidationResourceController extends Disposable {
return {};
}
};
- const handleWorkbookAdd = (workbook: Workbook) => {
- const unitID = workbook.getUnitId();
- this.disposeWithMe(
- this._resourceManagerService.registerPluginResource<DataValidationJSON>(unitID, DATA_VALIDATION_PLUGIN_NAME, {
- toJson: (unitID) => toJson(unitID),
- parseJson: (json) => parseJson(json),
- onChange: (unitID, value) => {
- Object.keys(value).forEach((subunitId) => {
- const ruleList = value[subunitId];
- ruleList.forEach((rule) => {
- this._dataValidationModel.addRule(unitID, subunitId, rule);
- });
- });
- },
- })
- );
- };
- this.disposeWithMe(toDisposable(this._univerInstanceService.sheetAdded$.subscribe(handleWorkbookAdd)));
this.disposeWithMe(
- toDisposable(
- this._univerInstanceService.sheetDisposed$.subscribe((workbook) => {
- const unitID = workbook.getUnitId();
- this._resourceManagerService.disposePluginResource(unitID, DATA_VALIDATION_PLUGIN_NAME);
- })
- )
+ this._resourceManagerService.registerPluginResource<DataValidationJSON>({
+ pluginName: DATA_VALIDATION_PLUGIN_NAME,
+ businesses: [UniverType.UNIVER_SHEET],
+ toJson: (unitID) => toJson(unitID),
+ parseJson: (json) => parseJson(json),
+ onUnLoad: (unitID) => {
+ this._dataValidationModel.deleteUnitRules(unitID);
+ },
+ onLoad: (unitID, value) => {
+ Object.keys(value).forEach((subunitId) => {
+ const ruleList = value[subunitId];
+ ruleList.forEach((rule) => {
+ this._dataValidationModel.addRule(unitID, subunitId, rule);
+ });
+ });
+ },
+ })
);
- const workbook = this._univerInstanceService.getCurrentUniverSheetInstance()!;
- handleWorkbookAdd(workbook);
}
}
diff --git a/packages/data-validation/src/models/data-validation-model.ts b/packages/data-validation/src/models/data-validation-model.ts
index a2c42bc9fd..4dfbe32708 100644
--- a/packages/data-validation/src/models/data-validation-model.ts
+++ b/packages/data-validation/src/models/data-validation-model.ts
@@ -166,4 +166,8 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
return res;
}
+
+ deleteUnitRules(unitId: string) {
+ this._model.delete(unitId);
+ }
}
diff --git a/packages/engine-formula/src/services/defined-names.service.ts b/packages/engine-formula/src/services/defined-names.service.ts
index b629e75345..cb3e0be1cb 100644
--- a/packages/engine-formula/src/services/defined-names.service.ts
+++ b/packages/engine-formula/src/services/defined-names.service.ts
@@ -56,6 +56,8 @@ export interface IDefinedNamesService {
removeDefinedName(unitId: string, name: string): void;
+ removeUnitDefinedName(unitId: string): void;
+
hasDefinedName(unitId: string): boolean;
setCurrentRange(range: IUnitRange): void;
@@ -80,12 +82,14 @@ export class DefinedNamesService extends Disposable implements IDefinedNamesServ
private readonly _update$ = new Subject();
readonly update$ = this._update$.asObservable();
- private _currentRange: IUnitRange = { unitId: '', sheetId: '', range: {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 0,
- } };
+ private _currentRange: IUnitRange = {
+ unitId: '', sheetId: '', range: {
+ startRow: 0,
+ endRow: 0,
+ startColumn: 0,
+ endColumn: 0,
+ },
+ };
private readonly _currentRange$ = new Subject<IUnitRange>();
readonly currentRange$ = this._currentRange$.asObservable();
@@ -144,6 +148,11 @@ export class DefinedNamesService extends Disposable implements IDefinedNamesServ
this._update();
}
+ removeUnitDefinedName(unitId: string) {
+ delete this._definedNameMap[unitId];
+ this._update();
+ }
+
getDefinedNameMap(unitId: string) {
return this._definedNameMap[unitId];
}
diff --git a/packages/facade/package.json b/packages/facade/package.json
index dff11033c7..e1418ebf2b 100644
--- a/packages/facade/package.json
+++ b/packages/facade/package.json
@@ -68,6 +68,7 @@
"@univerjs/engine-render": "workspace:*",
"@univerjs/network": "workspace:*",
"@univerjs/sheets": "workspace:*",
+ "@univerjs/sheets-conditional-formatting": "workspace:*",
"@univerjs/sheets-formula": "workspace:*",
"@univerjs/sheets-numfmt": "workspace:*",
"@univerjs/sheets-ui": "workspace:*",
diff --git a/packages/facade/src/apis/__tests__/create-test-bed.ts b/packages/facade/src/apis/__tests__/create-test-bed.ts
index 58240a018e..5170dab823 100644
--- a/packages/facade/src/apis/__tests__/create-test-bed.ts
+++ b/packages/facade/src/apis/__tests__/create-test-bed.ts
@@ -45,6 +45,7 @@ import { Inject, Injector } from '@wendellhu/redi';
import { Engine, IRenderingEngine, IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';
import { ISelectionRenderService, SelectionRenderService, SheetCanvasView, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
import { DesktopPlatformService, DesktopShortcutService, IPlatformService, IShortcutService } from '@univerjs/ui';
+import { SheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';
import { FUniver } from '../facade';
function getTestWorkbookDataDemo(): IWorkbookData {
@@ -64,6 +65,12 @@ function getTestWorkbookDataDemo(): IWorkbookData {
name: '',
sheetOrder: [],
styles: {},
+ resources: [
+ {
+ name: 'SHEET_CONDITIONAL_FORMATTING_PLUGIN',
+ data: '{"sheet-0011":[{"cfId":"AEGZdW8C","ranges":[{"startRow":2,"startColumn":1,"endRow":11,"endColumn":5,"startAbsoluteRefType":0,"endAbsoluteRefType":0,"rangeType":0}],"rule":{"type":"highlightCell","subType":"text","operator":"containsText","style":{"cl":{"rgb":"#2f56ef"},"bg":{"rgb":"#e8ecfc"}},"value":""},"stopIfTrue":false},{"cfId":"4ICEXdJj","ranges":[{"startRow":2,"startColumn":1,"endRow":11,"endColumn":5,"startAbsoluteRefType":0,"endAbsoluteRefType":0,"rangeType":0}],"rule":{"type":"highlightCell","subType":"text","operator":"containsText","style":{"cl":{"rgb":"#2f56ef"},"bg":{"rgb":"#e8ecfc"}},"value":""},"stopIfTrue":false},{"cfId":"geCv018z","ranges":[{"startRow":2,"startColumn":1,"endRow":11,"endColumn":5,"startAbsoluteRefType":0,"endAbsoluteRefType":0,"rangeType":0}],"rule":{"type":"highlightCell","subType":"text","operator":"containsText","style":{"cl":{"rgb":"#2f56ef"},"bg":{"rgb":"#e8ecfc"}},"value":""},"stopIfTrue":false}]}',
+ },
+ ],
};
}
@@ -108,7 +115,9 @@ export function createTestBed(workbookConfig?: IWorkbookData, dependencies?: Dep
injector.add([IShortcutService, { useClass: DesktopShortcutService }]);
injector.add([IPlatformService, { useClass: DesktopPlatformService }]);
injector.add([SheetSkeletonManagerService]);
-
+ SheetsConditionalFormattingPlugin.dependencyList.forEach((d) => {
+ injector.add(d);
+ });
dependencies?.forEach((d) => injector.add(d));
}
}
diff --git a/packages/facade/src/apis/__tests__/facade.spec.ts b/packages/facade/src/apis/__tests__/facade.spec.ts
index a14d3d2d1d..c190350cbc 100644
--- a/packages/facade/src/apis/__tests__/facade.spec.ts
+++ b/packages/facade/src/apis/__tests__/facade.spec.ts
@@ -223,4 +223,14 @@ describe('Test FUniver', () => {
const worksheet = univerAPI.getActiveWorkbook()?.getSheetBySheetId('sheet1');
expect(worksheet!.getMaxRows()).toBe(100);
});
+
+ it('Function getSnapshot', () => {
+ const snapshot = univerAPI.getActiveWorkbook()?.getSnapshot();
+ expect(snapshot?.resources).toEqual([
+ {
+ name: 'SHEET_CONDITIONAL_FORMATTING_PLUGIN',
+ data: '{"sheet-0011":[{"cfId":"AEGZdW8C","ranges":[{"startRow":2,"startColumn":1,"endRow":11,"endColumn":5,"startAbsoluteRefType":0,"endAbsoluteRefType":0,"rangeType":0}],"rule":{"type":"highlightCell","subType":"text","operator":"containsText","style":{"cl":{"rgb":"#2f56ef"},"bg":{"rgb":"#e8ecfc"}},"value":""},"stopIfTrue":false},{"cfId":"4ICEXdJj","ranges":[{"startRow":2,"startColumn":1,"endRow":11,"endColumn":5,"startAbsoluteRefType":0,"endAbsoluteRefType":0,"rangeType":0}],"rule":{"type":"highlightCell","subType":"text","operator":"containsText","style":{"cl":{"rgb":"#2f56ef"},"bg":{"rgb":"#e8ecfc"}},"value":""},"stopIfTrue":false},{"cfId":"geCv018z","ranges":[{"startRow":2,"startColumn":1,"endRow":11,"endColumn":5,"startAbsoluteRefType":0,"endAbsoluteRefType":0,"rangeType":0}],"rule":{"type":"highlightCell","subType":"text","operator":"containsText","style":{"cl":{"rgb":"#2f56ef"},"bg":{"rgb":"#e8ecfc"}},"value":""},"stopIfTrue":false}]}',
+ },
+ ]);
+ });
});
diff --git a/packages/facade/src/apis/sheets/f-workbook.ts b/packages/facade/src/apis/sheets/f-workbook.ts
index 7048ed81db..06abbbae17 100644
--- a/packages/facade/src/apis/sheets/f-workbook.ts
+++ b/packages/facade/src/apis/sheets/f-workbook.ts
@@ -17,6 +17,7 @@
import type { CommandListener, ICommandInfo, IRange, IWorkbookData, Workbook } from '@univerjs/core';
import {
ICommandService,
+ IResourceLoaderService,
IUniverInstanceService,
mergeWorksheetSnapshotWithDefault,
RedoCommand,
@@ -38,9 +39,11 @@ export class FWorkbook {
constructor(
private readonly _workbook: Workbook,
@Inject(Injector) private readonly _injector: Injector,
+ @Inject(IResourceLoaderService) private readonly _resourceLoaderService: IResourceLoaderService,
@Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService,
@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
@ICommandService private readonly _commandService: ICommandService
+
) {
this.id = this._workbook.getUnitId();
}
@@ -53,8 +56,12 @@ export class FWorkbook {
return this._workbook.getName();
}
+ /**
+ * Returns workbook snapshot data, including conditional formatting, data validation, and other plugin data."
+ */
getSnapshot(): IWorkbookData {
- return this._workbook.getSnapshot();
+ const snapshot = this._resourceLoaderService.saveWorkbook(this._workbook);
+ return snapshot;
}
/**
diff --git a/packages/sheets-conditional-formatting/package.json b/packages/sheets-conditional-formatting/package.json
index 269a1aa47c..09ef20e597 100644
--- a/packages/sheets-conditional-formatting/package.json
+++ b/packages/sheets-conditional-formatting/package.json
@@ -67,6 +67,7 @@
"@univerjs/core": "workspace:*",
"@univerjs/engine-formula": "workspace:*",
"@univerjs/engine-render": "workspace:*",
+ "@univerjs/protocol": "^0.1.14",
"@univerjs/sheets": "workspace:*",
"@wendellhu/redi": "0.13.0",
"rxjs": ">=7.0.0"
diff --git a/packages/sheets-conditional-formatting/src/models/conditional-formatting-rule-model.ts b/packages/sheets-conditional-formatting/src/models/conditional-formatting-rule-model.ts
index 7edb407511..c46bbf60c9 100644
--- a/packages/sheets-conditional-formatting/src/models/conditional-formatting-rule-model.ts
+++ b/packages/sheets-conditional-formatting/src/models/conditional-formatting-rule-model.ts
@@ -185,4 +185,8 @@ export class ConditionalFormattingRuleModel {
createCfId(_unitId: string, _subUnitId: string) {
return createCfId();
}
+
+ deleteUnitId(unitId: string) {
+ this._model.delete(unitId);
+ }
}
diff --git a/packages/sheets-conditional-formatting/src/services/__test__/test.util.ts b/packages/sheets-conditional-formatting/src/services/__test__/test.util.ts
index 8a6b35495d..a1246f1be4 100644
--- a/packages/sheets-conditional-formatting/src/services/__test__/test.util.ts
+++ b/packages/sheets-conditional-formatting/src/services/__test__/test.util.ts
@@ -51,16 +51,7 @@ const TEST_WORKBOOK_DATA_DEMO: () => IWorkbookData = () => ({
name: '',
sheetOrder: [],
styles: {},
- resources: [
- {
- name: 'SHEET_NUMFMT_PLUGIN',
- data: '{"model":{},"refModel":[]}',
- },
- {
- name: 'SHEET_CONDITIONAL_FORMATTING_PLUGIN',
- data: '{"sheet1":[{"cfId":"1","ranges":[{"startRow":0,"startColumn":0,"endRow":5,"endColumn":6,"startAbsoluteRefType":0,"endAbsoluteRefType":0,"rangeType":0}],"rule":{"config":[{"color":"#ff0000","value":{"type":"min","value":10},"index":0},{"color":"#0000ff","value":{"type":"max","value":90},"index":1}],"type":"colorScale"},"stopIfTrue":false}]}',
- },
- ],
+ resources: [],
});
export const createTestBed = (dependencies?: Dependency[]) => {
const univer = new Univer();
diff --git a/packages/sheets-conditional-formatting/src/services/conditional-formatting.service.ts b/packages/sheets-conditional-formatting/src/services/conditional-formatting.service.ts
index 791eedb192..c2cea8e768 100644
--- a/packages/sheets-conditional-formatting/src/services/conditional-formatting.service.ts
+++ b/packages/sheets-conditional-formatting/src/services/conditional-formatting.service.ts
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-import type { IMutationInfo, IRange, Workbook } from '@univerjs/core';
-import { createInterceptorKey, Disposable, ICommandService, InterceptorManager, IResourceManagerService, IUniverInstanceService, LifecycleStages, ObjectMatrix, OnLifecycle, Rectangle, toDisposable, Tools } from '@univerjs/core';
+import type { IMutationInfo, IRange } from '@univerjs/core';
+import { createInterceptorKey, Disposable, ICommandService, InterceptorManager, IResourceManagerService, IUniverInstanceService, LifecycleStages, ObjectMatrix, OnLifecycle, Rectangle, Tools } from '@univerjs/core';
import type { IInsertColMutationParams, IMoveColumnsMutationParams, IMoveRangeMutationParams, IMoveRowsMutationParams, IRemoveRowsMutationParams, IRemoveSheetCommandParams, ISetRangeValuesMutationParams } from '@univerjs/sheets';
import { InsertColMutation, InsertRowMutation, MoveColsMutation, MoveRangeMutation, MoveRowsMutation, RemoveColMutation, RemoveRowMutation, RemoveSheetCommand, SetRangeValuesMutation, SheetInterceptorService } from '@univerjs/sheets';
import { 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';
@@ -138,34 +139,25 @@ export class ConditionalFormattingService extends Disposable {
return {};
}
};
- const handleWorkbookAdd = (workbook: Workbook) => {
- const unitID = workbook.getUnitId();
- this.disposeWithMe(
- this._resourceManagerService.registerPluginResource<IRuleModelJson[keyof IRuleModelJson]>(unitID, SHEET_CONDITIONAL_FORMATTING_PLUGIN, {
- toJson: (unitID) => toJson(unitID),
- parseJson: (json) => parseJson(json),
- onChange: (unitID, value) => {
- Object.keys(value).forEach((subunitId) => {
- const ruleList = value[subunitId];
- ruleList.forEach((rule) => {
- this._conditionalFormattingRuleModel.addRule(unitID, subunitId, rule);
- });
- });
- },
- })
- );
- };
- this.disposeWithMe(toDisposable(this._univerInstanceService.sheetAdded$.subscribe(handleWorkbookAdd)));
this.disposeWithMe(
- toDisposable(
- this._univerInstanceService.sheetDisposed$.subscribe((workbook) => {
- const unitID = workbook.getUnitId();
- this._resourceManagerService.disposePluginResource(unitID, SHEET_CONDITIONAL_FORMATTING_PLUGIN);
- })
- )
+ this._resourceManagerService.registerPluginResource<IRuleModelJson[keyof IRuleModelJson]>({
+ pluginName: SHEET_CONDITIONAL_FORMATTING_PLUGIN,
+ businesses: [UniverType.UNIVER_SHEET],
+ toJson: (unitID) => toJson(unitID),
+ parseJson: (json) => parseJson(json),
+ onUnLoad: (unitID) => {
+ this._conditionalFormattingRuleModel.deleteUnitId(unitID);
+ },
+ onLoad: (unitID, value) => {
+ Object.keys(value).forEach((subunitId) => {
+ const ruleList = [...value[subunitId]].reverse();
+ ruleList.forEach((rule) => {
+ this._conditionalFormattingRuleModel.addRule(unitID, subunitId, rule);
+ });
+ });
+ },
+ })
);
- const workbookList = this._univerInstanceService.getAllUniverSheetsInstance();
- workbookList.forEach((workbook) => handleWorkbookAdd(workbook));
}
private _initSheetChange() {
diff --git a/packages/sheets-data-validation/src/common/const.ts b/packages/sheets-data-validation/src/common/const.ts
index f461690346..e1a1eea9dd 100644
--- a/packages/sheets-data-validation/src/common/const.ts
+++ b/packages/sheets-data-validation/src/common/const.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-export const DATA_VALIDATION_PLUGIN_NAME = 'SHEET_DATA_VALIDATION';
+export const DATA_VALIDATION_PLUGIN_NAME = 'SHEET_DATA_VALIDATION_PLUGIN';
export const DROP_DOWN_DEFAULT_COLOR = '#ECECEC';
diff --git a/packages/sheets/package.json b/packages/sheets/package.json
index 2369a2733b..1fe900074d 100644
--- a/packages/sheets/package.json
+++ b/packages/sheets/package.json
@@ -69,6 +69,9 @@
"@wendellhu/redi": "0.13.0",
"rxjs": ">=7.0.0"
},
+ "dependencies": {
+ "@univerjs/protocol": "^0.1.17"
+ },
"devDependencies": {
"@univerjs/core": "workspace:*",
"@univerjs/engine-formula": "workspace:*",
diff --git a/packages/sheets/src/controllers/defined-name-data.controller.ts b/packages/sheets/src/controllers/defined-name-data.controller.ts
index 585697a28f..e14e5589ed 100644
--- a/packages/sheets/src/controllers/defined-name-data.controller.ts
+++ b/packages/sheets/src/controllers/defined-name-data.controller.ts
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import type {
- Workbook } from '@univerjs/core';
import {
Disposable,
ICommandService,
@@ -23,10 +21,10 @@ import {
IUniverInstanceService,
LifecycleStages,
OnLifecycle,
- toDisposable,
} 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';
@@ -66,31 +64,19 @@ export class DefinedNameDataController extends Disposable {
return {};
}
};
- const handleWorkbookAdd = (workbook: Workbook) => {
- const unitID = workbook.getUnitId();
- this.disposeWithMe(
- this._resourceManagerService.registerPluginResource<IDefinedNameMapItem>(unitID, SHEET_DEFINED_NAME_PLUGIN, {
- toJson: (unitID) => toJson(unitID),
- parseJson: (json) => parseJson(json),
- onChange: (unitID, value) => {
- this._definedNamesService.registerDefinedNames(unitID, value);
- },
- })
- );
- };
- this.disposeWithMe(toDisposable(this._univerInstanceService.sheetAdded$.subscribe(handleWorkbookAdd)));
this.disposeWithMe(
- toDisposable(
- this._univerInstanceService.sheetDisposed$.subscribe((workbook) => {
- const unitID = workbook.getUnitId();
- this._resourceManagerService.disposePluginResource(unitID, SHEET_DEFINED_NAME_PLUGIN);
- })
- )
+ this._resourceManagerService.registerPluginResource<IDefinedNameMapItem>({
+ pluginName: SHEET_DEFINED_NAME_PLUGIN,
+ businesses: [UniverType.UNIVER_SHEET],
+ toJson: (unitID) => toJson(unitID),
+ parseJson: (json) => parseJson(json),
+ onUnLoad: (unitID) => {
+ this._definedNamesService.removeUnitDefinedName(unitID);
+ },
+ onLoad: (unitID, value) => {
+ this._definedNamesService.registerDefinedNames(unitID, value);
+ },
+ })
);
-
- const workbook = this._univerInstanceService.getCurrentUniverSheetInstance()!;
- if (workbook) {
- handleWorkbookAdd(workbook);
- }
}
}
diff --git a/packages/sheets/src/services/numfmt/numfmt.service.ts b/packages/sheets/src/services/numfmt/numfmt.service.ts
index 21b4d6de7d..cb50ea9551 100644
--- a/packages/sheets/src/services/numfmt/numfmt.service.ts
+++ b/packages/sheets/src/services/numfmt/numfmt.service.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import type { IObjectMatrixPrimitiveType, IRange, Nullable, Workbook } from '@univerjs/core';
+import type { IObjectMatrixPrimitiveType, IRange, Nullable } from '@univerjs/core';
import {
Disposable,
ICommandService,
@@ -28,6 +28,7 @@ import {
} from '@univerjs/core';
import { Inject } from '@wendellhu/redi';
import { Subject } from 'rxjs';
+import { UniverType } from '@univerjs/protocol';
import type { FormatType, INumfmtItem, INumfmtService, IRefItem, ISnapshot } from './type';
@@ -65,52 +66,35 @@ export class NumfmtService extends Disposable implements INumfmtService {
}
private _initModel() {
- const handleWorkbookAdd = (workbook: Workbook) => {
- const unitID = workbook.getUnitId();
- this.disposeWithMe(
- this._resourceManagerService.registerPluginResource<ISnapshot>(unitID, SHEET_NUMFMT_PLUGIN, {
- toJson: (unitID) => this._toJson(unitID),
- parseJson: (json) => this._parseJson(json),
- onChange: (unitID, value) => {
- const { model, refModel } = value;
-
- if (model) {
- const parseModel = Object.keys(model).reduce((result, sheetId) => {
- result.set(sheetId, new ObjectMatrix<INumfmtItem>(model[sheetId]));
- return result;
- }, new Map<string, ObjectMatrix<INumfmtItem>>());
- this._numfmtModel.set(unitID, parseModel);
- }
- if (refModel) {
- this._refAliasModel.set(
- unitID,
- new RefAlias<IRefItem, 'pattern' | 'i'>(refModel, ['pattern', 'i'])
- );
- }
- this._modelReplace$.next(unitID);
- },
- })
- );
- };
- this.disposeWithMe(toDisposable(this._univerInstanceService.sheetAdded$.subscribe(handleWorkbookAdd)));
this.disposeWithMe(
- toDisposable(
- this._univerInstanceService.sheetDisposed$.subscribe((workbook) => {
- const unitID = workbook.getUnitId();
- const model = this._numfmtModel.get(unitID);
+ this._resourceManagerService.registerPluginResource<ISnapshot>({
+ pluginName: SHEET_NUMFMT_PLUGIN,
+ businesses: [UniverType.UNIVER_SHEET],
+ toJson: (unitID) => this._toJson(unitID),
+ parseJson: (json) => this._parseJson(json),
+ onUnLoad: (unitID) => {
+ this._numfmtModel.delete(unitID);
+ this._refAliasModel.delete(unitID);
+ },
+ onLoad: (unitID, value) => {
+ const { model, refModel } = value;
if (model) {
- this._numfmtModel.delete(unitID);
+ const parseModel = Object.keys(model).reduce((result, sheetId) => {
+ result.set(sheetId, new ObjectMatrix<INumfmtItem>(model[sheetId]));
+ return result;
+ }, new Map<string, ObjectMatrix<INumfmtItem>>());
+ this._numfmtModel.set(unitID, parseModel);
}
- const refModel = this._refAliasModel.get(unitID);
if (refModel) {
- this._refAliasModel.delete(unitID);
+ this._refAliasModel.set(
+ unitID,
+ new RefAlias<IRefItem, 'pattern' | 'i'>(refModel, ['pattern', 'i'])
+ );
}
- this._resourceManagerService.disposePluginResource(unitID, SHEET_NUMFMT_PLUGIN);
- })
- )
+ this._modelReplace$.next(unitID);
+ },
+ })
);
- const workbooks = this._univerInstanceService.getAllUniverSheetsInstance();
- workbooks.forEach((workbook) => handleWorkbookAdd(workbook));
}
private _toJson(unitID: string) {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c02563fc03..9ddab65b06 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -356,6 +356,9 @@ importers:
packages/data-validation:
dependencies:
+ '@univerjs/protocol':
+ specifier: ^0.1.14
+ version: 0.1.14(@grpc/[email protected])([email protected])
dayjs:
specifier: ^1.11.10
version: 1.11.10
@@ -642,6 +645,10 @@ importers:
version: 1.4.0(@types/[email protected])([email protected])
packages/facade:
+ dependencies:
+ '@univerjs/sheets-conditional-formatting':
+ specifier: workspace:*
+ version: link:../sheets-conditional-formatting
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -796,6 +803,10 @@ importers:
version: 1.4.0(@types/[email protected])([email protected])
packages/sheets:
+ dependencies:
+ '@univerjs/protocol':
+ specifier: ^0.1.17
+ version: 0.1.17(@grpc/[email protected])([email protected])
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -827,6 +838,9 @@ importers:
packages/sheets-conditional-formatting:
dependencies:
+ '@univerjs/protocol':
+ specifier: ^0.1.14
+ version: 0.1.14(@grpc/[email protected])([email protected])
dayjs:
specifier: ^1.11.10
version: 1.11.10
@@ -5931,6 +5945,17 @@ packages:
react-dom: 18.2.0([email protected])
dev: false
+ resolution: {integrity: sha512-f4BmBCDJ3WKVj5MIiB8S0PLnzVu0xHUpC8g4YCT4Ac2P/29UV0KfRPj2CqYQJOwsym6jLJTSHIvr9BhRGEgIWQ==}
+ engines: {node: '>=16.0.0', npm: '>=8.0.0'}
+ peerDependencies:
+ '@grpc/grpc-js': ^1.9.14
+ rxjs: '>=7.0.0'
+ dependencies:
+ '@grpc/grpc-js': 1.10.4
+ rxjs: 7.8.1
+ dev: false
+
resolution: {integrity: sha512-V7THIzlOroiTPwXPS57q1IfOLK9Be+oH6mSRH5XAsYEywNqRVwUlMIe1TTu4GWKhJpfjTMwihkcDeVZfA1+C4A==}
engines: {node: '>=16.0.0', npm: '>=8.0.0'}
@@ -15269,13 +15294,13 @@ packages:
dev: false
r2.cnpmjs.org/@types/[email protected]:
- resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/@types/argparse/-/argparse-1.0.38.tgz}
+ resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/@types/argparse/-/argparse-1.0.38.tgz}
name: '@types/argparse'
version: 1.0.38
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/ajv/-/ajv-6.12.6.tgz}
+ resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/ajv/-/ajv-6.12.6.tgz}
name: ajv
version: 6.12.6
dependencies:
@@ -15286,7 +15311,7 @@ packages:
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/argparse/-/argparse-1.0.10.tgz}
+ resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/argparse/-/argparse-1.0.10.tgz}
name: argparse
version: 1.0.10
dependencies:
@@ -15294,13 +15319,13 @@ packages:
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/balanced-match/-/balanced-match-1.0.2.tgz}
+ resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/balanced-match/-/balanced-match-1.0.2.tgz}
name: balanced-match
version: 1.0.2
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz}
+ resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz}
name: brace-expansion
version: 1.1.11
dependencies:
@@ -15309,25 +15334,25 @@ packages:
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/concat-map/-/concat-map-0.0.1.tgz}
+ resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/concat-map/-/concat-map-0.0.1.tgz}
name: concat-map
version: 0.0.1
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz}
+ resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz}
name: fast-deep-equal
version: 3.1.3
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz}
+ resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz}
name: fast-json-stable-stringify
version: 2.1.0
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/fs-extra/-/fs-extra-7.0.1.tgz}
+ resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/fs-extra/-/fs-extra-7.0.1.tgz}
name: fs-extra
version: 7.0.1
engines: {node: '>=6 <7 || >=8'}
@@ -15338,7 +15363,7 @@ packages:
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz}
+ resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz}
name: iconv-lite
version: 0.6.3
engines: {node: '>=0.10.0'}
@@ -15348,36 +15373,36 @@ packages:
optional: true
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/import-lazy/-/import-lazy-4.0.0.tgz}
+ resolution: {integrity: sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/import-lazy/-/import-lazy-4.0.0.tgz}
name: import-lazy
version: 4.0.0
engines: {node: '>=8'}
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/is-what/-/is-what-3.14.1.tgz}
+ resolution: {integrity: sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/is-what/-/is-what-3.14.1.tgz}
name: is-what
version: 3.14.1
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/jju/-/jju-1.4.0.tgz}
+ resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/jju/-/jju-1.4.0.tgz}
name: jju
version: 1.4.0
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/js-tokens/-/js-tokens-4.0.0.tgz}
+ resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/js-tokens/-/js-tokens-4.0.0.tgz}
name: js-tokens
version: 4.0.0
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz}
+ resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz}
name: json-schema-traverse
version: 0.4.1
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/jsonfile/-/jsonfile-4.0.0.tgz}
+ resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/jsonfile/-/jsonfile-4.0.0.tgz}
name: jsonfile
version: 4.0.0
optionalDependencies:
@@ -15385,19 +15410,19 @@ packages:
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/lodash.get/-/lodash.get-4.4.2.tgz}
+ resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/lodash.get/-/lodash.get-4.4.2.tgz}
name: lodash.get
version: 4.4.2
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz}
+ resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz}
name: lodash.isequal
version: 4.5.0
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==, tarball: https://r2.cnpmjs.org/loose-envify/-/loose-envify-1.4.0.tgz}
+ resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/loose-envify/-/loose-envify-1.4.0.tgz}
name: loose-envify
version: 1.4.0
hasBin: true
@@ -15405,7 +15430,7 @@ packages:
js-tokens: r2.cnpmjs.org/[email protected]
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/lru-cache/-/lru-cache-6.0.0.tgz}
+ resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/lru-cache/-/lru-cache-6.0.0.tgz}
name: lru-cache
version: 6.0.0
engines: {node: '>=10'}
@@ -15413,44 +15438,44 @@ packages:
yallist: r2.cnpmjs.org/[email protected]
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz}
+ resolution: {integrity: sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz}
name: parse-node-version
version: 1.0.1
engines: {node: '>= 0.10'}
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/path-parse/-/path-parse-1.0.7.tgz}
+ resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/path-parse/-/path-parse-1.0.7.tgz}
name: path-parse
version: 1.0.7
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/picocolors/-/picocolors-1.0.0.tgz}
+ resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/picocolors/-/picocolors-1.0.0.tgz}
name: picocolors
version: 1.0.0
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/pify/-/pify-4.0.1.tgz}
+ resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/pify/-/pify-4.0.1.tgz}
name: pify
version: 4.0.1
engines: {node: '>=6'}
requiresBuild: true
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/prr/-/prr-1.0.1.tgz}
+ resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/prr/-/prr-1.0.1.tgz}
name: prr
version: 1.0.1
requiresBuild: true
optional: true
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==, tarball: https://r2.cnpmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz}
+ resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz}
name: resize-observer-polyfill
version: 1.5.1
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/resolve/-/resolve-1.19.0.tgz}
+ resolution: {integrity: sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/resolve/-/resolve-1.19.0.tgz}
name: resolve
version: 1.19.0
dependencies:
@@ -15459,34 +15484,34 @@ packages:
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz}
+ resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz}
name: safer-buffer
version: 2.1.2
requiresBuild: true
optional: true
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz}
+ resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz}
name: sprintf-js
version: 1.0.3
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz}
+ resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz}
name: strip-json-comments
version: 3.1.1
engines: {node: '>=8'}
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/universalify/-/universalify-0.1.2.tgz}
+ resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/universalify/-/universalify-0.1.2.tgz}
name: universalify
version: 0.1.2
engines: {node: '>= 4.0.0'}
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/uri-js/-/uri-js-4.4.1.tgz}
+ resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/uri-js/-/uri-js-4.4.1.tgz}
name: uri-js
version: 4.4.1
dependencies:
@@ -15494,6 +15519,6 @@ packages:
dev: false
r2.cnpmjs.org/[email protected]:
- resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==, registry: http://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/yallist/-/yallist-4.0.0.tgz}
+ resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==, registry: https://registry.npmjs.org/, tarball: https://r2.cnpmjs.org/yallist/-/yallist-4.0.0.tgz}
name: yallist
version: 4.0.0