@univerjs/sheets-drawing 0.2.14 → 0.3.0-alpha.0
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 +1 -1
- package/lib/es/index.js +4 -3
- package/lib/types/index.d.ts +2 -1
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,model)=>{const map=model||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,model)=>toJson(unitId,model),"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.SHEET_DRAWING_PLUGIN=SHEET_DRAWING_PLUGIN;exports.SetDrawingApplyMutation=SetDrawingApplyMutation;exports.SheetDrawingAnchorType=SheetDrawingAnchorType;
|
package/lib/es/index.js
CHANGED
|
@@ -50,8 +50,8 @@ let SheetsDrawingLoadController = (_a = class extends Disposable {
|
|
|
50
50
|
super(), this._commandService = _commandService, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._resourceManagerService = _resourceManagerService, this._initSnapshot(), this.disposeWithMe(this._commandService.registerCommand(SetDrawingApplyMutation));
|
|
51
51
|
}
|
|
52
52
|
_initSnapshot() {
|
|
53
|
-
const toJson = /* @__PURE__ */ __name((unitId) => {
|
|
54
|
-
const map = this._sheetDrawingService.getDrawingDataForUnit(unitId);
|
|
53
|
+
const toJson = /* @__PURE__ */ __name((unitId, model) => {
|
|
54
|
+
const map = model || this._sheetDrawingService.getDrawingDataForUnit(unitId);
|
|
55
55
|
return map ? JSON.stringify(map) : "";
|
|
56
56
|
}, "toJson"), parseJson = /* @__PURE__ */ __name((json) => {
|
|
57
57
|
if (!json)
|
|
@@ -66,7 +66,7 @@ let SheetsDrawingLoadController = (_a = class extends Disposable {
|
|
|
66
66
|
this._resourceManagerService.registerPluginResource({
|
|
67
67
|
pluginName: SHEET_DRAWING_PLUGIN,
|
|
68
68
|
businesses: [UniverInstanceType.UNIVER_SHEET],
|
|
69
|
-
toJson: /* @__PURE__ */ __name((unitId) => toJson(unitId), "toJson"),
|
|
69
|
+
toJson: /* @__PURE__ */ __name((unitId, model) => toJson(unitId, model), "toJson"),
|
|
70
70
|
parseJson: /* @__PURE__ */ __name((json) => parseJson(json), "parseJson"),
|
|
71
71
|
onUnLoad: /* @__PURE__ */ __name((unitId) => {
|
|
72
72
|
this._sheetDrawingService.removeDrawingDataForUnit(unitId), this._drawingManagerService.removeDrawingDataForUnit(unitId);
|
|
@@ -113,6 +113,7 @@ UniverSheetsDrawingPlugin = __decorateClass([
|
|
|
113
113
|
export {
|
|
114
114
|
DrawingApplyType,
|
|
115
115
|
ISheetDrawingService,
|
|
116
|
+
SHEET_DRAWING_PLUGIN,
|
|
116
117
|
SetDrawingApplyMutation,
|
|
117
118
|
SheetDrawingAnchorType,
|
|
118
119
|
UniverSheetsDrawingPlugin
|
package/lib/types/index.d.ts
CHANGED
|
@@ -15,5 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export { UniverSheetsDrawingPlugin } from './plugin';
|
|
17
17
|
export { ISheetDrawingService, SheetDrawingAnchorType } from './services/sheet-drawing.service';
|
|
18
|
+
export { SHEET_DRAWING_PLUGIN } from './controllers/sheet-drawing.controller';
|
|
18
19
|
export type { IFloatDomData, ISheetDrawing, ISheetDrawingPosition, ISheetFloatDom } from './services/sheet-drawing.service';
|
|
19
|
-
export {
|
|
20
|
+
export { DrawingApplyType, type ISetDrawingApplyMutationParams, SetDrawingApplyMutation } from './commands/mutations/set-drawing-apply.mutation';
|
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 __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"})});
|
|
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,model)=>{const map=model||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,model)=>toJson(unitId,model),"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.SHEET_DRAWING_PLUGIN=SHEET_DRAWING_PLUGIN,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.
|
|
3
|
+
"version": "0.3.0-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -44,19 +44,19 @@
|
|
|
44
44
|
"lib"
|
|
45
45
|
],
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@univerjs/
|
|
48
|
-
"@univerjs/
|
|
47
|
+
"@univerjs/drawing": "0.3.0-alpha.0",
|
|
48
|
+
"@univerjs/core": "0.3.0-alpha.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@univerjs/core": "0.
|
|
52
|
-
"@univerjs/drawing": "0.
|
|
53
|
-
"@univerjs/sheets": "0.
|
|
51
|
+
"@univerjs/core": "0.3.0-alpha.0",
|
|
52
|
+
"@univerjs/drawing": "0.3.0-alpha.0",
|
|
53
|
+
"@univerjs/sheets": "0.3.0-alpha.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"typescript": "^5.6.2",
|
|
57
|
-
"vite": "^5.4.
|
|
58
|
-
"vitest": "^2.
|
|
59
|
-
"@univerjs-infra/shared": "0.
|
|
57
|
+
"vite": "^5.4.8",
|
|
58
|
+
"vitest": "^2.1.1",
|
|
59
|
+
"@univerjs-infra/shared": "0.3.0-alpha.0"
|
|
60
60
|
},
|
|
61
61
|
"univerSpace": {
|
|
62
62
|
".": {
|