@univerjs/sheets-drawing 0.1.15 → 0.1.17

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 m=Object.defineProperty;var E=(r,t,e)=>t in r?m(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var d=(r,t,e)=>(E(r,typeof t!="symbol"?t+"":t,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),_=require("@wendellhu/redi"),f=require("@univerjs/drawing");var l=(r=>(r.Position="0",r.Both="1",r.None="2",r))(l||{});class I extends f.UnitDrawingService{}const h=_.createIdentifier("sheets-drawing.sheet-drawing.service");var D=(r=>(r[r.INSERT=0]="INSERT",r[r.REMOVE=1]="REMOVE",r[r.UPDATE=2]="UPDATE",r[r.ARRANGE=3]="ARRANGE",r[r.GROUP=4]="GROUP",r[r.UNGROUP=5]="UNGROUP",r))(D||{});const N={id:"sheet.mutation.set-drawing-apply",type:a.CommandType.MUTATION,handler:(r,t)=>{const e=r.get(f.IDrawingManagerService),i=r.get(h),{op:n,unitId:s,subUnitId:o,type:P,objects:c}=t;switch(e.applyJson1(s,o,n),i.applyJson1(s,o,n),P){case 0:e.addNotification(c),i.addNotification(c);break;case 1:e.removeNotification(c),i.removeNotification(c);break;case 2:e.updateNotification(c),i.updateNotification(c);break;case 3:e.orderNotification(c),i.orderNotification(c);break;case 4:e.groupUpdateNotification(c);break;case 5:e.ungroupUpdateNotification(c);break}return!0}};var O=Object.defineProperty,R=Object.getOwnPropertyDescriptor,U=(r,t,e,i)=>{for(var n=i>1?void 0:i?R(t,e):t,s=r.length-1,o;s>=0;s--)(o=r[s])&&(n=(i?o(t,e,n):o(n))||n);return i&&n&&O(t,e,n),n},v=(r,t)=>(e,i)=>t(e,i,r);const w="SHEET_DRAWING_PLUGIN";let S=class extends a.Disposable{constructor(r){super(),this._commandService=r,this.disposeWithMe(this._commandService.registerCommand(N))}};S=U([a.OnLifecycle(a.LifecycleStages.Starting,S),v(0,a.ICommandService)],S);let u=class extends a.Disposable{constructor(r,t,e){super(),this._sheetDrawingService=r,this._drawingManagerService=t,this._resourceManagerService=e,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const r=e=>{const i=this._sheetDrawingService.getDrawingDataForUnit(e);return i?JSON.stringify(i):""},t=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:w,businesses:[a.UniverInstanceType.UNIVER_SHEET],toJson:e=>r(e),parseJson:e=>t(e),onUnLoad:e=>{this._sheetDrawingService.removeDrawingDataForUnit(e),this._drawingManagerService.removeDrawingDataForUnit(e)},onLoad:(e,i)=>{this._sheetDrawingService.registerDrawingData(e,i),this._drawingManagerService.registerDrawingData(e,i)}}))}};u=U([a.OnLifecycle(a.LifecycleStages.Ready,u),v(0,h),v(1,f.IDrawingManagerService),v(2,a.IResourceManagerService)],u);var p=Object.defineProperty,b=Object.getOwnPropertyDescriptor,M=(r,t,e,i)=>{for(var n=i>1?void 0:i?b(t,e):t,s=r.length-1,o;s>=0;s--)(o=r[s])&&(n=(i?o(t,e,n):o(n))||n);return i&&n&&p(t,e,n),n},G=(r,t)=>(e,i)=>t(e,i,r),g;exports.UniverSheetsDrawingPlugin=(g=class extends a.Plugin{constructor(t,e){super(),this._config=t,this._injector=e}onStarting(t){[[S],[u],[h,{useClass:I}]].forEach(e=>t.add(e))}},d(g,"pluginName",w),d(g,"type",a.UniverInstanceType.UNIVER_SHEET),g);exports.UniverSheetsDrawingPlugin=M([G(1,_.Inject(_.Injector))],exports.UniverSheetsDrawingPlugin);exports.DrawingApplyType=D;exports.ISheetDrawingService=h;exports.SetDrawingApplyMutation=N;exports.SheetDrawingAnchorType=l;
1
+ "use strict";var m=Object.defineProperty;var E=(e,t,r)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var d=(e,t,r)=>E(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),_=require("@wendellhu/redi"),f=require("@univerjs/drawing");var l=(e=>(e.Position="0",e.Both="1",e.None="2",e))(l||{});class I extends f.UnitDrawingService{}const h=_.createIdentifier("sheets-drawing.sheet-drawing.service");var D=(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))(D||{});const N={id:"sheet.mutation.set-drawing-apply",type:a.CommandType.MUTATION,handler:(e,t)=>{const r=e.get(f.IDrawingManagerService),i=e.get(h),{op:n,unitId:s,subUnitId:o,type:P,objects:c}=t;switch(r.applyJson1(s,o,n),i.applyJson1(s,o,n),P){case 0:r.addNotification(c),i.addNotification(c);break;case 1:r.removeNotification(c),i.removeNotification(c);break;case 2:r.updateNotification(c),i.updateNotification(c);break;case 3:r.orderNotification(c),i.orderNotification(c);break;case 4:r.groupUpdateNotification(c);break;case 5:r.ungroupUpdateNotification(c);break}return!0}};var O=Object.defineProperty,R=Object.getOwnPropertyDescriptor,U=(e,t,r,i)=>{for(var n=i>1?void 0:i?R(t,r):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(n=(i?o(t,r,n):o(n))||n);return i&&n&&O(t,r,n),n},v=(e,t)=>(r,i)=>t(r,i,e);const w="SHEET_DRAWING_PLUGIN";let S=class extends a.Disposable{constructor(e){super(),this._commandService=e,this.disposeWithMe(this._commandService.registerCommand(N))}};S=U([a.OnLifecycle(a.LifecycleStages.Starting,S),v(0,a.ICommandService)],S);let u=class extends a.Disposable{constructor(e,t,r){super(),this._sheetDrawingService=e,this._drawingManagerService=t,this._resourceManagerService=r,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const e=r=>{const i=this._sheetDrawingService.getDrawingDataForUnit(r);return i?JSON.stringify(i):""},t=r=>{if(!r)return{};try{return JSON.parse(r)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:w,businesses:[a.UniverInstanceType.UNIVER_SHEET],toJson:r=>e(r),parseJson:r=>t(r),onUnLoad:r=>{this._sheetDrawingService.removeDrawingDataForUnit(r),this._drawingManagerService.removeDrawingDataForUnit(r)},onLoad:(r,i)=>{this._sheetDrawingService.registerDrawingData(r,i),this._drawingManagerService.registerDrawingData(r,i)}}))}};u=U([a.OnLifecycle(a.LifecycleStages.Ready,u),v(0,h),v(1,f.IDrawingManagerService),v(2,a.IResourceManagerService)],u);var p=Object.defineProperty,b=Object.getOwnPropertyDescriptor,M=(e,t,r,i)=>{for(var n=i>1?void 0:i?b(t,r):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(n=(i?o(t,r,n):o(n))||n);return i&&n&&p(t,r,n),n},G=(e,t)=>(r,i)=>t(r,i,e),g;exports.UniverSheetsDrawingPlugin=(g=class extends a.Plugin{constructor(t,r){super(),this._config=t,this._injector=r}onStarting(t){[[S],[u],[h,{useClass:I}]].forEach(r=>t.add(r))}},d(g,"pluginName",w),d(g,"type",a.UniverInstanceType.UNIVER_SHEET),g);exports.UniverSheetsDrawingPlugin=M([G(1,_.Inject(_.Injector))],exports.UniverSheetsDrawingPlugin);exports.DrawingApplyType=D;exports.ISheetDrawingService=h;exports.SetDrawingApplyMutation=N;exports.SheetDrawingAnchorType=l;
package/lib/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var D = Object.defineProperty;
2
2
  var R = (e, r, t) => r in e ? D(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var h = (e, r, t) => (R(e, typeof r != "symbol" ? r + "" : r, t), t);
3
+ var h = (e, r, t) => R(e, typeof r != "symbol" ? r + "" : r, t);
4
4
  import { CommandType as O, OnLifecycle as d, LifecycleStages as f, Disposable as N, ICommandService as w, UniverInstanceType as m, IResourceManagerService as I, Plugin as b } from "@univerjs/core";
5
5
  import { createIdentifier as M, Inject as p, Injector as G } from "@wendellhu/redi";
6
6
  import { UnitDrawingService as C, IDrawingManagerService as U } from "@univerjs/drawing";
@@ -14,6 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export { UniverSheetsDrawingPlugin } from './plugin';
17
- export { DrawingApplyType, SetDrawingApplyMutation } from './commands/mutations/set-drawing-apply.mutation';
17
+ export { DrawingApplyType, SetDrawingApplyMutation, type ISetDrawingApplyMutationParams } from './commands/mutations/set-drawing-apply.mutation';
18
18
  export { ISheetDrawingService, SheetDrawingAnchorType } from './services/sheet-drawing.service';
19
19
  export type { IFloatDomData, ISheetDrawing, ISheetDrawingPosition, ISheetFloatDom } from './services/sheet-drawing.service';
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(a,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/drawing"],r):(a=typeof globalThis<"u"?globalThis:a||self,r(a.UniverSheetsDrawing={},a.UniverCore,a["@wendellhu/redi"],a.UniverDrawing))})(this,function(a,r,v,_){"use strict";var j=Object.defineProperty;var G=(a,r,v)=>r in a?j(a,r,{enumerable:!0,configurable:!0,writable:!0,value:v}):a[r]=v;var l=(a,r,v)=>(G(a,typeof r!="symbol"?r+"":r,v),v);var f;var w=(i=>(i.Position="0",i.Both="1",i.None="2",i))(w||{});class m extends _.UnitDrawingService{}const g=v.createIdentifier("sheets-drawing.sheet-drawing.service");var D=(i=>(i[i.INSERT=0]="INSERT",i[i.REMOVE=1]="REMOVE",i[i.UPDATE=2]="UPDATE",i[i.ARRANGE=3]="ARRANGE",i[i.GROUP=4]="GROUP",i[i.UNGROUP=5]="UNGROUP",i))(D||{});const U={id:"sheet.mutation.set-drawing-apply",type:r.CommandType.MUTATION,handler:(i,n)=>{const e=i.get(_.IDrawingManagerService),t=i.get(g),{op:s,unitId:o,subUnitId:c,type:b,objects:u}=n;switch(e.applyJson1(o,c,s),t.applyJson1(o,c,s),b){case 0:e.addNotification(u),t.addNotification(u);break;case 1:e.removeNotification(u),t.removeNotification(u);break;case 2:e.updateNotification(u),t.updateNotification(u);break;case 3:e.orderNotification(u),t.orderNotification(u);break;case 4:e.groupUpdateNotification(u);break;case 5:e.ungroupUpdateNotification(u);break}return!0}};var E=Object.defineProperty,I=Object.getOwnPropertyDescriptor,N=(i,n,e,t)=>{for(var s=t>1?void 0:t?I(n,e):n,o=i.length-1,c;o>=0;o--)(c=i[o])&&(s=(t?c(n,e,s):c(s))||s);return t&&s&&E(n,e,s),s},d=(i,n)=>(e,t)=>n(e,t,i);const P="SHEET_DRAWING_PLUGIN";let h=class extends r.Disposable{constructor(i){super(),this._commandService=i,this.disposeWithMe(this._commandService.registerCommand(U))}};h=N([r.OnLifecycle(r.LifecycleStages.Starting,h),d(0,r.ICommandService)],h);let S=class extends r.Disposable{constructor(i,n,e){super(),this._sheetDrawingService=i,this._drawingManagerService=n,this._resourceManagerService=e,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const i=e=>{const t=this._sheetDrawingService.getDrawingDataForUnit(e);return t?JSON.stringify(t):""},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:P,businesses:[r.UniverInstanceType.UNIVER_SHEET],toJson:e=>i(e),parseJson:e=>n(e),onUnLoad:e=>{this._sheetDrawingService.removeDrawingDataForUnit(e),this._drawingManagerService.removeDrawingDataForUnit(e)},onLoad:(e,t)=>{this._sheetDrawingService.registerDrawingData(e,t),this._drawingManagerService.registerDrawingData(e,t)}}))}};S=N([r.OnLifecycle(r.LifecycleStages.Ready,S),d(0,g),d(1,_.IDrawingManagerService),d(2,r.IResourceManagerService)],S);var O=Object.defineProperty,R=Object.getOwnPropertyDescriptor,p=(i,n,e,t)=>{for(var s=t>1?void 0:t?R(n,e):n,o=i.length-1,c;o>=0;o--)(c=i[o])&&(s=(t?c(n,e,s):c(s))||s);return t&&s&&O(n,e,s),s},M=(i,n)=>(e,t)=>n(e,t,i);a.UniverSheetsDrawingPlugin=(f=class extends r.Plugin{constructor(n,e){super(),this._config=n,this._injector=e}onStarting(n){[[h],[S],[g,{useClass:m}]].forEach(e=>n.add(e))}},l(f,"pluginName",P),l(f,"type",r.UniverInstanceType.UNIVER_SHEET),f),a.UniverSheetsDrawingPlugin=p([M(1,v.Inject(v.Injector))],a.UniverSheetsDrawingPlugin),a.DrawingApplyType=D,a.ISheetDrawingService=g,a.SetDrawingApplyMutation=U,a.SheetDrawingAnchorType=w,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
1
+ (function(a,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/drawing"],r):(a=typeof globalThis<"u"?globalThis:a||self,r(a.UniverSheetsDrawing={},a.UniverCore,a["@wendellhu/redi"],a.UniverDrawing))})(this,function(a,r,v,_){"use strict";var j=Object.defineProperty;var G=(a,r,v)=>r in a?j(a,r,{enumerable:!0,configurable:!0,writable:!0,value:v}):a[r]=v;var l=(a,r,v)=>G(a,typeof r!="symbol"?r+"":r,v);var f;var w=(i=>(i.Position="0",i.Both="1",i.None="2",i))(w||{});class m extends _.UnitDrawingService{}const g=v.createIdentifier("sheets-drawing.sheet-drawing.service");var D=(i=>(i[i.INSERT=0]="INSERT",i[i.REMOVE=1]="REMOVE",i[i.UPDATE=2]="UPDATE",i[i.ARRANGE=3]="ARRANGE",i[i.GROUP=4]="GROUP",i[i.UNGROUP=5]="UNGROUP",i))(D||{});const U={id:"sheet.mutation.set-drawing-apply",type:r.CommandType.MUTATION,handler:(i,n)=>{const e=i.get(_.IDrawingManagerService),t=i.get(g),{op:s,unitId:o,subUnitId:c,type:b,objects:u}=n;switch(e.applyJson1(o,c,s),t.applyJson1(o,c,s),b){case 0:e.addNotification(u),t.addNotification(u);break;case 1:e.removeNotification(u),t.removeNotification(u);break;case 2:e.updateNotification(u),t.updateNotification(u);break;case 3:e.orderNotification(u),t.orderNotification(u);break;case 4:e.groupUpdateNotification(u);break;case 5:e.ungroupUpdateNotification(u);break}return!0}};var E=Object.defineProperty,I=Object.getOwnPropertyDescriptor,N=(i,n,e,t)=>{for(var s=t>1?void 0:t?I(n,e):n,o=i.length-1,c;o>=0;o--)(c=i[o])&&(s=(t?c(n,e,s):c(s))||s);return t&&s&&E(n,e,s),s},d=(i,n)=>(e,t)=>n(e,t,i);const P="SHEET_DRAWING_PLUGIN";let h=class extends r.Disposable{constructor(i){super(),this._commandService=i,this.disposeWithMe(this._commandService.registerCommand(U))}};h=N([r.OnLifecycle(r.LifecycleStages.Starting,h),d(0,r.ICommandService)],h);let S=class extends r.Disposable{constructor(i,n,e){super(),this._sheetDrawingService=i,this._drawingManagerService=n,this._resourceManagerService=e,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const i=e=>{const t=this._sheetDrawingService.getDrawingDataForUnit(e);return t?JSON.stringify(t):""},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:P,businesses:[r.UniverInstanceType.UNIVER_SHEET],toJson:e=>i(e),parseJson:e=>n(e),onUnLoad:e=>{this._sheetDrawingService.removeDrawingDataForUnit(e),this._drawingManagerService.removeDrawingDataForUnit(e)},onLoad:(e,t)=>{this._sheetDrawingService.registerDrawingData(e,t),this._drawingManagerService.registerDrawingData(e,t)}}))}};S=N([r.OnLifecycle(r.LifecycleStages.Ready,S),d(0,g),d(1,_.IDrawingManagerService),d(2,r.IResourceManagerService)],S);var O=Object.defineProperty,R=Object.getOwnPropertyDescriptor,p=(i,n,e,t)=>{for(var s=t>1?void 0:t?R(n,e):n,o=i.length-1,c;o>=0;o--)(c=i[o])&&(s=(t?c(n,e,s):c(s))||s);return t&&s&&O(n,e,s),s},M=(i,n)=>(e,t)=>n(e,t,i);a.UniverSheetsDrawingPlugin=(f=class extends r.Plugin{constructor(n,e){super(),this._config=n,this._injector=e}onStarting(n){[[h],[S],[g,{useClass:m}]].forEach(e=>n.add(e))}},l(f,"pluginName",P),l(f,"type",r.UniverInstanceType.UNIVER_SHEET),f),a.UniverSheetsDrawingPlugin=p([M(1,v.Inject(v.Injector))],a.UniverSheetsDrawingPlugin),a.DrawingApplyType=D,a.ISheetDrawingService=g,a.SetDrawingApplyMutation=U,a.SheetDrawingAnchorType=w,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-drawing",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -45,18 +45,18 @@
45
45
  ],
46
46
  "peerDependencies": {
47
47
  "@wendellhu/redi": "0.15.4",
48
- "@univerjs/drawing": "0.1.15",
49
- "@univerjs/core": "0.1.15"
48
+ "@univerjs/core": "0.1.17",
49
+ "@univerjs/drawing": "0.1.17"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@wendellhu/redi": "^0.15.4",
53
53
  "typescript": "^5.4.5",
54
- "vite": "^5.2.13",
54
+ "vite": "^5.3.1",
55
55
  "vitest": "^1.6.0",
56
- "@univerjs/core": "0.1.15",
57
- "@univerjs/drawing": "0.1.15",
58
- "@univerjs/shared": "0.1.15",
59
- "@univerjs/sheets": "0.1.15"
56
+ "@univerjs/core": "0.1.17",
57
+ "@univerjs/sheets": "0.1.17",
58
+ "@univerjs/shared": "0.1.17",
59
+ "@univerjs/drawing": "0.1.17"
60
60
  },
61
61
  "univerSpace": {
62
62
  ".": {