@univerjs/sheets-drawing 0.1.13 → 0.1.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 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),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){super(),this._injector=t}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(0,_.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=(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;
package/lib/es/index.js CHANGED
@@ -100,8 +100,8 @@ var W = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, F = (e, r, t
100
100
  return i && a && W(r, t, a), a;
101
101
  }, B = (e, r) => (t, i) => r(t, i, e), c;
102
102
  let S = (c = class extends b {
103
- constructor(e) {
104
- super(), this._injector = e;
103
+ constructor(e, r) {
104
+ super(), this._config = e, this._injector = r;
105
105
  }
106
106
  onStarting(e) {
107
107
  [
@@ -112,7 +112,7 @@ let S = (c = class extends b {
112
112
  }
113
113
  }, h(c, "pluginName", E), h(c, "type", m.UNIVER_SHEET), c);
114
114
  S = F([
115
- B(0, p(G))
115
+ B(1, p(G))
116
116
  ], S);
117
117
  export {
118
118
  L as DrawingApplyType,
@@ -2,9 +2,10 @@ import { Plugin, UniverInstanceType } from '@univerjs/core';
2
2
  import { Injector } from '@wendellhu/redi';
3
3
 
4
4
  export declare class UniverSheetsDrawingPlugin extends Plugin {
5
+ private readonly _config;
5
6
  readonly _injector: Injector;
6
7
  static pluginName: string;
7
8
  static type: UniverInstanceType;
8
- constructor(_injector: Injector);
9
+ constructor(_config: unknown, _injector: Injector);
9
10
  onStarting(_injector: Injector): void;
10
11
  }
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=(e=>(e.Position="0",e.Both="1",e.None="2",e))(w||{});class m extends _.UnitDrawingService{}const g=v.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 U={id:"sheet.mutation.set-drawing-apply",type:r.CommandType.MUTATION,handler:(e,n)=>{const i=e.get(_.IDrawingManagerService),t=e.get(g),{op:s,unitId:o,subUnitId:c,type:b,objects:u}=n;switch(i.applyJson1(o,c,s),t.applyJson1(o,c,s),b){case 0:i.addNotification(u),t.addNotification(u);break;case 1:i.removeNotification(u),t.removeNotification(u);break;case 2:i.updateNotification(u),t.updateNotification(u);break;case 3:i.orderNotification(u),t.orderNotification(u);break;case 4:i.groupUpdateNotification(u);break;case 5:i.ungroupUpdateNotification(u);break}return!0}};var E=Object.defineProperty,I=Object.getOwnPropertyDescriptor,N=(e,n,i,t)=>{for(var s=t>1?void 0:t?I(n,i):n,o=e.length-1,c;o>=0;o--)(c=e[o])&&(s=(t?c(n,i,s):c(s))||s);return t&&s&&E(n,i,s),s},d=(e,n)=>(i,t)=>n(i,t,e);const P="SHEET_DRAWING_PLUGIN";let h=class extends r.Disposable{constructor(e){super(),this._commandService=e,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(e,n,i){super(),this._sheetDrawingService=e,this._drawingManagerService=n,this._resourceManagerService=i,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const e=i=>{const t=this._sheetDrawingService.getDrawingDataForUnit(i);return t?JSON.stringify(t):""},n=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:P,businesses:[r.UniverInstanceType.UNIVER_SHEET],toJson:i=>e(i),parseJson:i=>n(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,t)=>{this._sheetDrawingService.registerDrawingData(i,t),this._drawingManagerService.registerDrawingData(i,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=(e,n,i,t)=>{for(var s=t>1?void 0:t?R(n,i):n,o=e.length-1,c;o>=0;o--)(c=e[o])&&(s=(t?c(n,i,s):c(s))||s);return t&&s&&O(n,i,s),s},M=(e,n)=>(i,t)=>n(i,t,e);a.UniverSheetsDrawingPlugin=(f=class extends r.Plugin{constructor(n){super(),this._injector=n}onStarting(n){[[h],[S],[g,{useClass:m}]].forEach(i=>n.add(i))}},l(f,"pluginName",P),l(f,"type",r.UniverInstanceType.UNIVER_SHEET),f),a.UniverSheetsDrawingPlugin=p([M(0,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),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.13",
3
+ "version": "0.1.14",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -45,8 +45,8 @@
45
45
  ],
46
46
  "peerDependencies": {
47
47
  "@wendellhu/redi": "0.15.2",
48
- "@univerjs/drawing": "0.1.13",
49
- "@univerjs/core": "0.1.13"
48
+ "@univerjs/core": "0.1.14",
49
+ "@univerjs/drawing": "0.1.14"
50
50
  },
51
51
  "dependencies": {},
52
52
  "devDependencies": {
@@ -54,10 +54,23 @@
54
54
  "typescript": "^5.4.5",
55
55
  "vite": "^5.2.12",
56
56
  "vitest": "^1.6.0",
57
- "@univerjs/shared": "0.1.13",
58
- "@univerjs/drawing": "0.1.13",
59
- "@univerjs/core": "0.1.13",
60
- "@univerjs/sheets": "0.1.13"
57
+ "@univerjs/core": "0.1.14",
58
+ "@univerjs/shared": "0.1.14",
59
+ "@univerjs/drawing": "0.1.14",
60
+ "@univerjs/sheets": "0.1.14"
61
+ },
62
+ "univerSpace": {
63
+ ".": {
64
+ "import": "./lib/es/index.js",
65
+ "require": "./lib/cjs/index.js",
66
+ "types": "./lib/types/index.d.ts"
67
+ },
68
+ "./*": {
69
+ "import": "./lib/es/*",
70
+ "require": "./lib/cjs/*",
71
+ "types": "./lib/types/index.d.ts"
72
+ },
73
+ "./lib/*": "./lib/*"
61
74
  },
62
75
  "scripts": {
63
76
  "test": "vitest run",