@univerjs/sheets-drawing 0.2.12 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),drawing=require("@univerjs/drawing"),PLUGIN_CONFIG_KEY="sheets-drawing.config",defaultPluginConfig={};var SheetDrawingAnchorType=(SheetDrawingAnchorType2=>(SheetDrawingAnchorType2.Position="0",SheetDrawingAnchorType2.Both="1",SheetDrawingAnchorType2.None="2",SheetDrawingAnchorType2))(SheetDrawingAnchorType||{});const _SheetDrawingService=class _SheetDrawingService extends drawing.UnitDrawingService{};__name(_SheetDrawingService,"SheetDrawingService");let SheetDrawingService=_SheetDrawingService;const ISheetDrawingService=core.createIdentifier("sheets-drawing.sheet-drawing.service");var DrawingApplyType=(DrawingApplyType2=>(DrawingApplyType2[DrawingApplyType2.INSERT=0]="INSERT",DrawingApplyType2[DrawingApplyType2.REMOVE=1]="REMOVE",DrawingApplyType2[DrawingApplyType2.UPDATE=2]="UPDATE",DrawingApplyType2[DrawingApplyType2.ARRANGE=3]="ARRANGE",DrawingApplyType2[DrawingApplyType2.GROUP=4]="GROUP",DrawingApplyType2[DrawingApplyType2.UNGROUP=5]="UNGROUP",DrawingApplyType2))(DrawingApplyType||{});const SetDrawingApplyMutation={id:"sheet.mutation.set-drawing-apply",type:core.CommandType.MUTATION,handler:__name((accessor,params)=>{const drawingManagerService=accessor.get(drawing.IDrawingManagerService),sheetDrawingService=accessor.get(ISheetDrawingService),{op,unitId,subUnitId,type,objects}=params;switch(drawingManagerService.applyJson1(unitId,subUnitId,op),sheetDrawingService.applyJson1(unitId,subUnitId,op),type){case 0:drawingManagerService.addNotification(objects),sheetDrawingService.addNotification(objects);break;case 1:drawingManagerService.removeNotification(objects),sheetDrawingService.removeNotification(objects);break;case 2:drawingManagerService.updateNotification(objects),sheetDrawingService.updateNotification(objects);break;case 3:drawingManagerService.orderNotification(objects),sheetDrawingService.orderNotification(objects);break;case 4:drawingManagerService.groupUpdateNotification(objects);break;case 5:drawingManagerService.ungroupUpdateNotification(objects);break}return!0},"handler")};var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const SHEET_DRAWING_PLUGIN="SHEET_DRAWING_PLUGIN";var _a;let SheetsDrawingLoadController=(_a=class extends core.Disposable{constructor(_commandService,_sheetDrawingService,_drawingManagerService,_resourceManagerService){super(),this._commandService=_commandService,this._sheetDrawingService=_sheetDrawingService,this._drawingManagerService=_drawingManagerService,this._resourceManagerService=_resourceManagerService,this._initSnapshot(),this.disposeWithMe(this._commandService.registerCommand(SetDrawingApplyMutation))}_initSnapshot(){const toJson=__name(unitId=>{const map=this._sheetDrawingService.getDrawingDataForUnit(unitId);return map?JSON.stringify(map):""},"toJson"),parseJson=__name(json=>{if(!json)return{};try{return JSON.parse(json)}catch{return{}}},"parseJson");this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:SHEET_DRAWING_PLUGIN,businesses:[core.UniverInstanceType.UNIVER_SHEET],toJson:__name(unitId=>toJson(unitId),"toJson"),parseJson:__name(json=>parseJson(json),"parseJson"),onUnLoad:__name(unitId=>{this._sheetDrawingService.removeDrawingDataForUnit(unitId),this._drawingManagerService.removeDrawingDataForUnit(unitId)},"onUnLoad"),onLoad:__name((unitId,value)=>{this._sheetDrawingService.registerDrawingData(unitId,value),this._drawingManagerService.registerDrawingData(unitId,value)},"onLoad")}))}},__name(_a,"SheetsDrawingLoadController"),_a);SheetsDrawingLoadController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Starting,SheetsDrawingLoadController),__decorateParam$1(0,core.ICommandService),__decorateParam$1(1,ISheetDrawingService),__decorateParam$1(2,drawing.IDrawingManagerService),__decorateParam$1(3,core.IResourceManagerService)],SheetsDrawingLoadController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField=__name((obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value),"__publicField"),_a2;exports.UniverSheetsDrawingPlugin=(_a2=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest)}onStarting(){[[SheetsDrawingLoadController],[ISheetDrawingService,{useClass:SheetDrawingService}]].forEach(dependency=>this._injector.add(dependency))}},__name(_a2,"UniverSheetsDrawingPlugin"),_a2);__publicField(exports.UniverSheetsDrawingPlugin,"pluginName",SHEET_DRAWING_PLUGIN);__publicField(exports.UniverSheetsDrawingPlugin,"type",core.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsDrawingPlugin=__decorateClass([core.DependentOn(drawing.UniverDrawingPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports.UniverSheetsDrawingPlugin);exports.DrawingApplyType=DrawingApplyType;exports.ISheetDrawingService=ISheetDrawingService;exports.SetDrawingApplyMutation=SetDrawingApplyMutation;exports.SheetDrawingAnchorType=SheetDrawingAnchorType;
|
package/lib/es/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
3
|
+
import { createIdentifier, CommandType, OnLifecycle, LifecycleStages, Disposable, UniverInstanceType, ICommandService, IResourceManagerService, DependentOn, Inject, Injector, Plugin, IConfigService } from "@univerjs/core";
|
|
4
|
+
import { UnitDrawingService, IDrawingManagerService, UniverDrawingPlugin } from "@univerjs/drawing";
|
|
5
|
+
const PLUGIN_CONFIG_KEY = "sheets-drawing.config", defaultPluginConfig = {};
|
|
7
6
|
var SheetDrawingAnchorType = /* @__PURE__ */ ((SheetDrawingAnchorType2) => (SheetDrawingAnchorType2.Position = "0", SheetDrawingAnchorType2.Both = "1", SheetDrawingAnchorType2.None = "2", SheetDrawingAnchorType2))(SheetDrawingAnchorType || {});
|
|
8
7
|
const _SheetDrawingService = class _SheetDrawingService extends UnitDrawingService {
|
|
9
8
|
};
|
|
@@ -86,12 +85,11 @@ SheetsDrawingLoadController = __decorateClass$1([
|
|
|
86
85
|
__decorateParam$1(2, IDrawingManagerService),
|
|
87
86
|
__decorateParam$1(3, IResourceManagerService)
|
|
88
87
|
], SheetsDrawingLoadController);
|
|
89
|
-
|
|
90
|
-
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
88
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
91
89
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
92
90
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
93
91
|
return kind && result && __defProp2(target, key, result), result;
|
|
94
|
-
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), _a2;
|
|
92
|
+
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a2;
|
|
95
93
|
let UniverSheetsDrawingPlugin = (_a2 = class extends Plugin {
|
|
96
94
|
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
97
95
|
super(), this._config = _config, this._injector = _injector, this._configService = _configService;
|
|
@@ -104,8 +102,11 @@ let UniverSheetsDrawingPlugin = (_a2 = class extends Plugin {
|
|
|
104
102
|
[ISheetDrawingService, { useClass: SheetDrawingService }]
|
|
105
103
|
].forEach((dependency) => this._injector.add(dependency));
|
|
106
104
|
}
|
|
107
|
-
}, __name(_a2, "UniverSheetsDrawingPlugin"),
|
|
105
|
+
}, __name(_a2, "UniverSheetsDrawingPlugin"), _a2);
|
|
106
|
+
__publicField(UniverSheetsDrawingPlugin, "pluginName", SHEET_DRAWING_PLUGIN);
|
|
107
|
+
__publicField(UniverSheetsDrawingPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
108
108
|
UniverSheetsDrawingPlugin = __decorateClass([
|
|
109
|
+
DependentOn(UniverDrawingPlugin),
|
|
109
110
|
__decorateParam(1, Inject(Injector)),
|
|
110
111
|
__decorateParam(2, IConfigService)
|
|
111
112
|
], UniverSheetsDrawingPlugin);
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export declare class UniverSheetsDrawingPlugin extends Plugin {
|
|
|
6
6
|
private readonly _configService;
|
|
7
7
|
static pluginName: string;
|
|
8
8
|
static type: UniverInstanceType;
|
|
9
|
-
constructor(_config: Partial<IUniverSheetsDrawingConfig
|
|
9
|
+
constructor(_config: Partial<IUniverSheetsDrawingConfig> | undefined, _injector: Injector, _configService: IConfigService);
|
|
10
10
|
onStarting(): void;
|
|
11
11
|
}
|
|
@@ -40,5 +40,5 @@ export declare class SheetDrawingService extends UnitDrawingService<ISheetDrawin
|
|
|
40
40
|
}
|
|
41
41
|
export interface ISheetDrawingService extends IUnitDrawingService<ISheetDrawing> {
|
|
42
42
|
}
|
|
43
|
-
export declare const ISheetDrawingService: import('@
|
|
43
|
+
export declare const ISheetDrawingService: import('@wendellhu/redi').IdentifierDecorator<ISheetDrawingService>;
|
|
44
44
|
export {};
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverSheetsDrawing={},global.UniverCore,global.UniverDrawing))})(this,function(exports2,core,drawing){"use strict";var __defProp=Object.defineProperty;var
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverSheetsDrawing={},global.UniverCore,global.UniverDrawing))})(this,function(exports2,core,drawing){"use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var _a,_b;const PLUGIN_CONFIG_KEY="sheets-drawing.config",defaultPluginConfig={};var SheetDrawingAnchorType=(SheetDrawingAnchorType2=>(SheetDrawingAnchorType2.Position="0",SheetDrawingAnchorType2.Both="1",SheetDrawingAnchorType2.None="2",SheetDrawingAnchorType2))(SheetDrawingAnchorType||{});const _SheetDrawingService=class _SheetDrawingService extends drawing.UnitDrawingService{};__name(_SheetDrawingService,"SheetDrawingService");let SheetDrawingService=_SheetDrawingService;const ISheetDrawingService=core.createIdentifier("sheets-drawing.sheet-drawing.service");var DrawingApplyType=(DrawingApplyType2=>(DrawingApplyType2[DrawingApplyType2.INSERT=0]="INSERT",DrawingApplyType2[DrawingApplyType2.REMOVE=1]="REMOVE",DrawingApplyType2[DrawingApplyType2.UPDATE=2]="UPDATE",DrawingApplyType2[DrawingApplyType2.ARRANGE=3]="ARRANGE",DrawingApplyType2[DrawingApplyType2.GROUP=4]="GROUP",DrawingApplyType2[DrawingApplyType2.UNGROUP=5]="UNGROUP",DrawingApplyType2))(DrawingApplyType||{});const SetDrawingApplyMutation={id:"sheet.mutation.set-drawing-apply",type:core.CommandType.MUTATION,handler:__name((accessor,params)=>{const drawingManagerService=accessor.get(drawing.IDrawingManagerService),sheetDrawingService=accessor.get(ISheetDrawingService),{op,unitId,subUnitId,type,objects}=params;switch(drawingManagerService.applyJson1(unitId,subUnitId,op),sheetDrawingService.applyJson1(unitId,subUnitId,op),type){case 0:drawingManagerService.addNotification(objects),sheetDrawingService.addNotification(objects);break;case 1:drawingManagerService.removeNotification(objects),sheetDrawingService.removeNotification(objects);break;case 2:drawingManagerService.updateNotification(objects),sheetDrawingService.updateNotification(objects);break;case 3:drawingManagerService.orderNotification(objects),sheetDrawingService.orderNotification(objects);break;case 4:drawingManagerService.groupUpdateNotification(objects);break;case 5:drawingManagerService.ungroupUpdateNotification(objects);break}return!0},"handler")};var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const SHEET_DRAWING_PLUGIN="SHEET_DRAWING_PLUGIN";let SheetsDrawingLoadController=(_a=class extends core.Disposable{constructor(_commandService,_sheetDrawingService,_drawingManagerService,_resourceManagerService){super(),this._commandService=_commandService,this._sheetDrawingService=_sheetDrawingService,this._drawingManagerService=_drawingManagerService,this._resourceManagerService=_resourceManagerService,this._initSnapshot(),this.disposeWithMe(this._commandService.registerCommand(SetDrawingApplyMutation))}_initSnapshot(){const toJson=__name(unitId=>{const map=this._sheetDrawingService.getDrawingDataForUnit(unitId);return map?JSON.stringify(map):""},"toJson"),parseJson=__name(json=>{if(!json)return{};try{return JSON.parse(json)}catch{return{}}},"parseJson");this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:SHEET_DRAWING_PLUGIN,businesses:[core.UniverInstanceType.UNIVER_SHEET],toJson:__name(unitId=>toJson(unitId),"toJson"),parseJson:__name(json=>parseJson(json),"parseJson"),onUnLoad:__name(unitId=>{this._sheetDrawingService.removeDrawingDataForUnit(unitId),this._drawingManagerService.removeDrawingDataForUnit(unitId)},"onUnLoad"),onLoad:__name((unitId,value)=>{this._sheetDrawingService.registerDrawingData(unitId,value),this._drawingManagerService.registerDrawingData(unitId,value)},"onLoad")}))}},__name(_a,"SheetsDrawingLoadController"),_a);SheetsDrawingLoadController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Starting,SheetsDrawingLoadController),__decorateParam$1(0,core.ICommandService),__decorateParam$1(1,ISheetDrawingService),__decorateParam$1(2,drawing.IDrawingManagerService),__decorateParam$1(3,core.IResourceManagerService)],SheetsDrawingLoadController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField=__name((obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value),"__publicField");exports2.UniverSheetsDrawingPlugin=(_b=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest)}onStarting(){[[SheetsDrawingLoadController],[ISheetDrawingService,{useClass:SheetDrawingService}]].forEach(dependency=>this._injector.add(dependency))}},__name(_b,"UniverSheetsDrawingPlugin"),_b),__publicField(exports2.UniverSheetsDrawingPlugin,"pluginName",SHEET_DRAWING_PLUGIN),__publicField(exports2.UniverSheetsDrawingPlugin,"type",core.UniverInstanceType.UNIVER_SHEET),exports2.UniverSheetsDrawingPlugin=__decorateClass([core.DependentOn(drawing.UniverDrawingPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports2.UniverSheetsDrawingPlugin),exports2.DrawingApplyType=DrawingApplyType,exports2.ISheetDrawingService=ISheetDrawingService,exports2.SetDrawingApplyMutation=SetDrawingApplyMutation,exports2.SheetDrawingAnchorType=SheetDrawingAnchorType,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-drawing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -44,17 +44,19 @@
|
|
|
44
44
|
"lib"
|
|
45
45
|
],
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@univerjs/core": "0.2.
|
|
48
|
-
"@univerjs/drawing": "0.2.
|
|
47
|
+
"@univerjs/core": "0.2.14",
|
|
48
|
+
"@univerjs/drawing": "0.2.14"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@univerjs/core": "0.2.14",
|
|
52
|
+
"@univerjs/drawing": "0.2.14",
|
|
53
|
+
"@univerjs/sheets": "0.2.14"
|
|
49
54
|
},
|
|
50
55
|
"devDependencies": {
|
|
51
|
-
"typescript": "^5.
|
|
52
|
-
"vite": "^5.4.
|
|
56
|
+
"typescript": "^5.6.2",
|
|
57
|
+
"vite": "^5.4.4",
|
|
53
58
|
"vitest": "^2.0.5",
|
|
54
|
-
"@univerjs/
|
|
55
|
-
"@univerjs/drawing": "0.2.12",
|
|
56
|
-
"@univerjs/shared": "0.2.12",
|
|
57
|
-
"@univerjs/sheets": "0.2.12"
|
|
59
|
+
"@univerjs-infra/shared": "0.2.14"
|
|
58
60
|
},
|
|
59
61
|
"univerSpace": {
|
|
60
62
|
".": {
|