@univerjs/preset-sheets-drawing 0.10.14 → 0.11.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/umd/index.js +1 -1
- package/package.json +8 -8
package/lib/umd/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// @univerjs/sheets-drawing/index
|
|
10
|
-
(function(a,
|
|
10
|
+
(function(a,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/drawing"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing","@univerjs/sheets"],r):(a=typeof globalThis<"u"?globalThis:a||self,r(a.UniverSheetsDrawing={},a.UniverCore,a.UniverDrawing,a.UniverSheets))})(this,(function(a,r,I,w){"use strict";var l=(e=>(e.Position="0",e.Both="1",e.None="2",e))(l||{});class P extends I.UnitDrawingService{}const _=r.createIdentifier("sheets-drawing.sheet-drawing.service");var c=(e=>(e[e.INSERT=0]="INSERT",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE",e[e.ARRANGE=3]="ARRANGE",e[e.GROUP=4]="GROUP",e[e.UNGROUP=5]="UNGROUP",e))(c||{});const g={id:"sheet.mutation.set-drawing-apply",type:r.CommandType.MUTATION,handler:(e,n)=>{const t=e.get(I.IDrawingManagerService),i=e.get(_),{op:s,unitId:o,subUnitId:u,type:h,objects:d}=n;switch(t.applyJson1(o,u,s),i.applyJson1(o,u,s),h){case 0:t.addNotification(d),i.addNotification(d);break;case 1:t.removeNotification(d),i.removeNotification(d);break;case 2:t.updateNotification(d),i.updateNotification(d);break;case 3:t.orderNotification(d),i.orderNotification(d);break;case 4:t.groupUpdateNotification(d);break;case 5:t.ungroupUpdateNotification(d);break}return!0}};var j=Object.getOwnPropertyDescriptor,C=(e,n,t,i)=>{for(var s=i>1?void 0:i?j(n,t):n,o=e.length-1,u;o>=0;o--)(u=e[o])&&(s=u(s)||s);return s},v=(e,n)=>(t,i)=>n(t,i,e);const m="SHEET_DRAWING_PLUGIN";let U=class extends r.Disposable{constructor(e,n,t,i,s,o){super(),this._sheetInterceptorService=e,this._univerInstanceService=n,this._commandService=t,this._sheetDrawingService=i,this._drawingManagerService=s,this._resourceManagerService=o,this._initSnapshot(),this._initSheetChange(),this.disposeWithMe(this._commandService.registerCommand(g))}_initSnapshot(){const e=(t,i)=>{const s=i||this._sheetDrawingService.getDrawingDataForUnit(t);return s?JSON.stringify(s):""},n=t=>{if(!t)return{};try{return JSON.parse(t)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:m,businesses:[r.UniverInstanceType.UNIVER_SHEET],toJson:(t,i)=>e(t,i),parseJson:t=>n(t),onUnLoad:t=>{this._sheetDrawingService.removeDrawingDataForUnit(t),this._drawingManagerService.removeDrawingDataForUnit(t)},onLoad:(t,i)=>{this._sheetDrawingService.registerDrawingData(t,i),this._drawingManagerService.registerDrawingData(t,i)}}))}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var n;if(e.id===w.RemoveSheetCommand.id){const t=e.params,i=t.unitId||this._univerInstanceService.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_SHEET).getUnitId(),s=t.subUnitId||((n=this._univerInstanceService.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId());if(!i||!s)return{redos:[],undos:[]};const o=this._sheetDrawingService.getDrawingData(i,s),u=Object.values(o).filter(D=>D.drawingType!==r.DrawingTypeEnum.DRAWING_CHART);if(u.length===0)return{redos:[],undos:[]};const h=this._sheetDrawingService.getBatchRemoveOp(u),{unitId:d,subUnitId:S,undo:f,redo:E,objects:p}=h;return{redos:[{id:g.id,params:{op:E,unitId:d,subUnitId:S,objects:p,type:c.REMOVE}}],undos:[{id:g.id,params:{op:f,unitId:d,subUnitId:S,objects:p,type:c.INSERT}}]}}else if(e.id===w.CopySheetCommand.id){const t=e.params,{unitId:i,subUnitId:s,targetSubUnitId:o}=t;if(!i||!s||!o)return{redos:[],undos:[]};const u=this._sheetDrawingService.getDrawingData(i,s),h=Object.values(u).filter(N=>N.drawingType!==r.DrawingTypeEnum.DRAWING_CHART).map(N=>({...N,subUnitId:o,drawingId:r.generateRandomId(6)}));if(h.length===0)return{redos:[],undos:[]};const d=this._sheetDrawingService.getBatchAddOp(h),{unitId:S,subUnitId:f,undo:E,redo:p,objects:D}=d;return{redos:[{id:g.id,params:{op:p,unitId:S,subUnitId:f,objects:D,type:c.INSERT}}],undos:[{id:g.id,params:{op:E,unitId:S,subUnitId:f,objects:D,type:c.REMOVE}}]}}return{redos:[],undos:[]}}}))}};U=C([v(0,r.Inject(w.SheetInterceptorService)),v(1,r.Inject(r.IUniverInstanceService)),v(2,r.ICommandService),v(3,_),v(4,I.IDrawingManagerService),v(5,r.IResourceManagerService)],U);const M="sheets-drawing.config",b={};var T=Object.defineProperty,G=Object.getOwnPropertyDescriptor,y=(e,n,t)=>n in e?T(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,H=(e,n,t,i)=>{for(var s=i>1?void 0:i?G(n,t):n,o=e.length-1,u;o>=0;o--)(u=e[o])&&(s=u(s)||s);return s},O=(e,n)=>(t,i)=>n(t,i,e),R=(e,n,t)=>y(e,typeof n!="symbol"?n+"":n,t);a.UniverSheetsDrawingPlugin=class extends r.Plugin{constructor(n=b,t,i){super(),this._config=n,this._injector=t,this._configService=i;const{...s}=r.merge({},b,this._config);this._configService.setConfig(M,s)}onStarting(){[[U],[_,{useClass:P}]].forEach(n=>this._injector.add(n)),this._injector.get(U)}},R(a.UniverSheetsDrawingPlugin,"pluginName",m),R(a.UniverSheetsDrawingPlugin,"type",r.UniverInstanceType.UNIVER_SHEET),a.UniverSheetsDrawingPlugin=H([r.DependentOn(I.UniverDrawingPlugin),O(1,r.Inject(r.Injector)),O(2,r.IConfigService)],a.UniverSheetsDrawingPlugin),a.DrawingApplyType=c,a.ISheetDrawingService=_,a.SHEET_DRAWING_PLUGIN=m,a.SetDrawingApplyMutation=g,a.SheetDrawingAnchorType=l,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
// @univerjs/sheets-drawing-ui/index
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/preset-sheets-drawing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -58,19 +58,19 @@
|
|
|
58
58
|
"rxjs": ">=7.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@univerjs/docs-drawing": "0.
|
|
62
|
-
"@univerjs/drawing": "0.
|
|
63
|
-
"@univerjs/drawing-ui": "0.
|
|
64
|
-
"@univerjs/sheets-drawing": "0.
|
|
65
|
-
"@univerjs/sheets-drawing-ui": "0.
|
|
61
|
+
"@univerjs/docs-drawing": "0.11.0",
|
|
62
|
+
"@univerjs/drawing": "0.11.0",
|
|
63
|
+
"@univerjs/drawing-ui": "0.11.0",
|
|
64
|
+
"@univerjs/sheets-drawing": "0.11.0",
|
|
65
|
+
"@univerjs/sheets-drawing-ui": "0.11.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@univerjs/core": "0.
|
|
68
|
+
"@univerjs/core": "0.11.0",
|
|
69
69
|
"react": "18.3.1",
|
|
70
70
|
"react-dom": "18.3.1",
|
|
71
71
|
"rxjs": "7.8.2",
|
|
72
72
|
"typescript": "^5.9.3",
|
|
73
|
-
"@univerjs-infra/shared": "0.
|
|
73
|
+
"@univerjs-infra/shared": "0.11.0"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"prebuild:preset": "tsx prepare.ts",
|