@univerjs/sheets-drawing 0.2.3 → 0.2.4-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 CHANGED
@@ -1 +1 @@
1
- "use strict";var E=Object.defineProperty;var p=(e,t,i)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var d=(e,t,i)=>p(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),h=require("@wendellhu/redi"),l=require("@univerjs/drawing"),f=require("rxjs/operators");var I=(e=>(e.Position="0",e.Both="1",e.None="2",e))(I||{});class m extends l.UnitDrawingService{}const _=h.createIdentifier("sheets-drawing.sheet-drawing.service");var U=(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))(U||{});const N={id:"sheet.mutation.set-drawing-apply",type:a.CommandType.MUTATION,handler:(e,t)=>{const i=e.get(l.IDrawingManagerService),r=e.get(_),{op:n,unitId:s,subUnitId:c,type:P,objects:o}=t;switch(i.applyJson1(s,c,n),r.applyJson1(s,c,n),P){case 0:i.addNotification(o),r.addNotification(o);break;case 1:i.removeNotification(o),r.removeNotification(o);break;case 2:i.updateNotification(o),r.updateNotification(o);break;case 3:i.orderNotification(o),r.orderNotification(o);break;case 4:i.groupUpdateNotification(o);break;case 5:i.ungroupUpdateNotification(o);break}return!0}};var O=Object.defineProperty,b=Object.getOwnPropertyDescriptor,w=(e,t,i,r)=>{for(var n=r>1?void 0:r?b(t,i):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(n=(r?c(t,i,n):c(n))||n);return r&&n&&O(t,i,n),n},v=(e,t)=>(i,r)=>t(i,r,e);const D="SHEET_DRAWING_PLUGIN";let S=class extends a.Disposable{constructor(e){super(),this._commandService=e,this.disposeWithMe(this._commandService.registerCommand(N))}};S=w([a.OnLifecycle(a.LifecycleStages.Starting,S),v(0,a.ICommandService)],S);let u=class extends a.Disposable{constructor(e,t,i,r,n){super(),this._sheetDrawingService=e,this._drawingManagerService=t,this._resourceManagerService=i,this._lifecycleService=r,this._univerInstanceService=n,this._init()}_init(){this._initSnapshot(),this._drawingInitializeListener()}_initSnapshot(){const e=i=>{const r=this._sheetDrawingService.getDrawingDataForUnit(i);return r?JSON.stringify(r):""},t=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:D,businesses:[a.UniverInstanceType.UNIVER_SHEET],toJson:i=>e(i),parseJson:i=>t(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,r)=>{this._sheetDrawingService.registerDrawingData(i,r)}}))}_drawingInitializeListener(){this._lifecycleService.lifecycle$.pipe(f.filter(e=>e===a.LifecycleStages.Steady),f.first()).subscribe(()=>{var t;const e=(t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:t.getUnitId();e&&this._sheetDrawingService.initializeNotification(e)})}};u=w([a.OnLifecycle(a.LifecycleStages.Starting,u),v(0,_),v(1,l.IDrawingManagerService),v(2,a.IResourceManagerService),v(3,h.Inject(a.LifecycleService)),v(4,a.IUniverInstanceService)],u);var R=Object.defineProperty,M=Object.getOwnPropertyDescriptor,L=(e,t,i,r)=>{for(var n=r>1?void 0:r?M(t,i):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(n=(r?c(t,i,n):c(n))||n);return r&&n&&R(t,i,n),n},G=(e,t)=>(i,r)=>t(i,r,e),g;exports.UniverSheetsDrawingPlugin=(g=class extends a.Plugin{constructor(t,i){super(),this._config=t,this._injector=i}onStarting(t){[[S],[u],[_,{useClass:m}]].forEach(i=>t.add(i))}},d(g,"pluginName",D),d(g,"type",a.UniverInstanceType.UNIVER_SHEET),g);exports.UniverSheetsDrawingPlugin=L([G(1,h.Inject(h.Injector))],exports.UniverSheetsDrawingPlugin);exports.DrawingApplyType=U;exports.ISheetDrawingService=_;exports.SetDrawingApplyMutation=N;exports.SheetDrawingAnchorType=I;
1
+ "use strict";var P=Object.defineProperty;var E=(e,t,i)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var _=(e,t,i)=>E(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),d=require("@univerjs/drawing"),l=require("rxjs/operators");var f=(e=>(e.Position="0",e.Both="1",e.None="2",e))(f||{});class p extends d.UnitDrawingService{}const h=a.createIdentifier("sheets-drawing.sheet-drawing.service");var I=(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))(I||{});const U={id:"sheet.mutation.set-drawing-apply",type:a.CommandType.MUTATION,handler:(e,t)=>{const i=e.get(d.IDrawingManagerService),r=e.get(h),{op:n,unitId:s,subUnitId:c,type:D,objects:o}=t;switch(i.applyJson1(s,c,n),r.applyJson1(s,c,n),D){case 0:i.addNotification(o),r.addNotification(o);break;case 1:i.removeNotification(o),r.removeNotification(o);break;case 2:i.updateNotification(o),r.updateNotification(o);break;case 3:i.orderNotification(o),r.orderNotification(o);break;case 4:i.groupUpdateNotification(o);break;case 5:i.ungroupUpdateNotification(o);break}return!0}};var m=Object.defineProperty,O=Object.getOwnPropertyDescriptor,N=(e,t,i,r)=>{for(var n=r>1?void 0:r?O(t,i):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(n=(r?c(t,i,n):c(n))||n);return r&&n&&m(t,i,n),n},v=(e,t)=>(i,r)=>t(i,r,e);const w="SHEET_DRAWING_PLUGIN";let S=class extends a.Disposable{constructor(e){super(),this._commandService=e,this.disposeWithMe(this._commandService.registerCommand(U))}};S=N([a.OnLifecycle(a.LifecycleStages.Starting,S),v(0,a.ICommandService)],S);let u=class extends a.Disposable{constructor(e,t,i,r,n){super(),this._sheetDrawingService=e,this._drawingManagerService=t,this._resourceManagerService=i,this._lifecycleService=r,this._univerInstanceService=n,this._init()}_init(){this._initSnapshot(),this._drawingInitializeListener()}_initSnapshot(){const e=i=>{const r=this._sheetDrawingService.getDrawingDataForUnit(i);return r?JSON.stringify(r):""},t=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:w,businesses:[a.UniverInstanceType.UNIVER_SHEET],toJson:i=>e(i),parseJson:i=>t(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,r)=>{this._sheetDrawingService.registerDrawingData(i,r)}}))}_drawingInitializeListener(){this._lifecycleService.lifecycle$.pipe(l.filter(e=>e===a.LifecycleStages.Steady),l.first()).subscribe(()=>{var t;const e=(t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:t.getUnitId();e&&this._sheetDrawingService.initializeNotification(e)})}};u=N([a.OnLifecycle(a.LifecycleStages.Starting,u),v(0,h),v(1,d.IDrawingManagerService),v(2,a.IResourceManagerService),v(3,a.Inject(a.LifecycleService)),v(4,a.IUniverInstanceService)],u);var b=Object.defineProperty,R=Object.getOwnPropertyDescriptor,M=(e,t,i,r)=>{for(var n=r>1?void 0:r?R(t,i):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(n=(r?c(t,i,n):c(n))||n);return r&&n&&b(t,i,n),n},L=(e,t)=>(i,r)=>t(i,r,e),g;exports.UniverSheetsDrawingPlugin=(g=class extends a.Plugin{constructor(t,i){super(),this._config=t,this._injector=i}onStarting(t){[[S],[u],[h,{useClass:p}]].forEach(i=>t.add(i))}},_(g,"pluginName",w),_(g,"type",a.UniverInstanceType.UNIVER_SHEET),g);exports.UniverSheetsDrawingPlugin=M([L(1,a.Inject(a.Injector))],exports.UniverSheetsDrawingPlugin);exports.DrawingApplyType=I;exports.ISheetDrawingService=h;exports.SetDrawingApplyMutation=U;exports.SheetDrawingAnchorType=f;
package/lib/es/index.js CHANGED
@@ -1,20 +1,19 @@
1
1
  var R = Object.defineProperty;
2
2
  var w = (e, i, t) => i in e ? R(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
3
3
  var u = (e, i, t) => w(e, typeof i != "symbol" ? i + "" : i, t);
4
- import { CommandType as D, OnLifecycle as l, LifecycleStages as g, LifecycleService as O, Disposable as N, ICommandService as p, UniverInstanceType as h, IResourceManagerService as b, IUniverInstanceService as M, Plugin as G } from "@univerjs/core";
5
- import { createIdentifier as L, Inject as m, Injector as C } from "@wendellhu/redi";
6
- import { UnitDrawingService as J, IDrawingManagerService as I } from "@univerjs/drawing";
4
+ import { createIdentifier as D, CommandType as O, OnLifecycle as l, LifecycleStages as g, Inject as N, LifecycleService as b, Disposable as I, ICommandService as p, UniverInstanceType as h, IResourceManagerService as M, IUniverInstanceService as G, Plugin as L, Injector as C } from "@univerjs/core";
5
+ import { UnitDrawingService as J, IDrawingManagerService as U } from "@univerjs/drawing";
7
6
  import { filter as j, first as x } from "rxjs/operators";
8
7
  var H = /* @__PURE__ */ ((e) => (e.Position = "0", e.Both = "1", e.None = "2", e))(H || {});
9
8
  class V extends J {
10
9
  }
11
- const f = L("sheets-drawing.sheet-drawing.service");
10
+ const d = D("sheets-drawing.sheet-drawing.service");
12
11
  var $ = /* @__PURE__ */ ((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))($ || {});
13
12
  const F = {
14
13
  id: "sheet.mutation.set-drawing-apply",
15
- type: D.MUTATION,
14
+ type: O.MUTATION,
16
15
  handler: (e, i) => {
17
- const t = e.get(I), r = e.get(f), { op: n, unitId: s, subUnitId: a, type: P, objects: o } = i;
16
+ const t = e.get(U), r = e.get(d), { op: n, unitId: s, subUnitId: a, type: P, objects: o } = i;
18
17
  switch (t.applyJson1(s, a, n), r.applyJson1(s, a, n), P) {
19
18
  case 0:
20
19
  t.addNotification(o), r.addNotification(o);
@@ -38,22 +37,22 @@ const F = {
38
37
  return !0;
39
38
  }
40
39
  };
41
- var W = Object.defineProperty, z = Object.getOwnPropertyDescriptor, U = (e, i, t, r) => {
40
+ var W = Object.defineProperty, z = Object.getOwnPropertyDescriptor, m = (e, i, t, r) => {
42
41
  for (var n = r > 1 ? void 0 : r ? z(i, t) : i, s = e.length - 1, a; s >= 0; s--)
43
42
  (a = e[s]) && (n = (r ? a(i, t, n) : a(n)) || n);
44
43
  return r && n && W(i, t, n), n;
45
44
  }, c = (e, i) => (t, r) => i(t, r, e);
46
45
  const E = "SHEET_DRAWING_PLUGIN";
47
- let _ = class extends N {
46
+ let _ = class extends I {
48
47
  constructor(e) {
49
48
  super(), this._commandService = e, this.disposeWithMe(this._commandService.registerCommand(F));
50
49
  }
51
50
  };
52
- _ = U([
51
+ _ = m([
53
52
  l(g.Starting, _),
54
53
  c(0, p)
55
54
  ], _);
56
- let S = class extends N {
55
+ let S = class extends I {
57
56
  constructor(e, i, t, r, n) {
58
57
  super(), this._sheetDrawingService = e, this._drawingManagerService = i, this._resourceManagerService = t, this._lifecycleService = r, this._univerInstanceService = n, this._init();
59
58
  }
@@ -96,20 +95,20 @@ let S = class extends N {
96
95
  });
97
96
  }
98
97
  };
99
- S = U([
98
+ S = m([
100
99
  l(g.Starting, S),
101
- c(0, f),
102
- c(1, I),
103
- c(2, b),
104
- c(3, m(O)),
105
- c(4, M)
100
+ c(0, d),
101
+ c(1, U),
102
+ c(2, M),
103
+ c(3, N(b)),
104
+ c(4, G)
106
105
  ], S);
107
106
  var B = Object.defineProperty, T = Object.getOwnPropertyDescriptor, q = (e, i, t, r) => {
108
107
  for (var n = r > 1 ? void 0 : r ? T(i, t) : i, s = e.length - 1, a; s >= 0; s--)
109
108
  (a = e[s]) && (n = (r ? a(i, t, n) : a(n)) || n);
110
109
  return r && n && B(i, t, n), n;
111
110
  }, K = (e, i) => (t, r) => i(t, r, e), v;
112
- let d = (v = class extends G {
111
+ let f = (v = class extends L {
113
112
  constructor(e, i) {
114
113
  super(), this._config = e, this._injector = i;
115
114
  }
@@ -117,17 +116,17 @@ let d = (v = class extends G {
117
116
  [
118
117
  [_],
119
118
  [S],
120
- [f, { useClass: V }]
119
+ [d, { useClass: V }]
121
120
  ].forEach((i) => e.add(i));
122
121
  }
123
122
  }, u(v, "pluginName", E), u(v, "type", h.UNIVER_SHEET), v);
124
- d = q([
125
- K(1, m(C))
126
- ], d);
123
+ f = q([
124
+ K(1, N(C))
125
+ ], f);
127
126
  export {
128
127
  $ as DrawingApplyType,
129
- f as ISheetDrawingService,
128
+ d as ISheetDrawingService,
130
129
  F as SetDrawingApplyMutation,
131
130
  H as SheetDrawingAnchorType,
132
- d as UniverSheetsDrawingPlugin
131
+ f as UniverSheetsDrawingPlugin
133
132
  };
@@ -1,5 +1,4 @@
1
- import { Plugin, UniverInstanceType } from '@univerjs/core';
2
- import { Injector } from '@wendellhu/redi';
1
+ import { Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
2
 
4
3
  export declare class UniverSheetsDrawingPlugin extends Plugin {
5
4
  private readonly _config;
@@ -38,5 +38,5 @@ export declare class SheetDrawingService extends UnitDrawingService<ISheetDrawin
38
38
  }
39
39
  export interface ISheetDrawingService extends IUnitDrawingService<ISheetDrawing> {
40
40
  }
41
- export declare const ISheetDrawingService: import('@wendellhu/redi').IdentifierDecorator<ISheetDrawingService>;
41
+ export declare const ISheetDrawingService: import('@univerjs/core').IdentifierDecorator<ISheetDrawingService>;
42
42
  export {};
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/drawing"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/drawing","rxjs/operators"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.UniverSheetsDrawing={},s.UniverCore,s["@wendellhu/redi"],s.UniverDrawing,s.rxjs.operators))})(this,function(s,t,v,_,U){"use strict";var L=Object.defineProperty;var C=(s,t,v)=>t in s?L(s,t,{enumerable:!0,configurable:!0,writable:!0,value:v}):s[t]=v;var l=(s,t,v)=>C(s,typeof t!="symbol"?t+"":t,v);var f;var I=(e=>(e.Position="0",e.Both="1",e.None="2",e))(I||{});class p extends _.UnitDrawingService{}const h=v.createIdentifier("sheets-drawing.sheet-drawing.service");var w=(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))(w||{});const N={id:"sheet.mutation.set-drawing-apply",type:t.CommandType.MUTATION,handler:(e,n)=>{const i=e.get(_.IDrawingManagerService),r=e.get(h),{op:a,unitId:c,subUnitId:o,type:M,objects:u}=n;switch(i.applyJson1(c,o,a),r.applyJson1(c,o,a),M){case 0:i.addNotification(u),r.addNotification(u);break;case 1:i.removeNotification(u),r.removeNotification(u);break;case 2:i.updateNotification(u),r.updateNotification(u);break;case 3:i.orderNotification(u),r.orderNotification(u);break;case 4:i.groupUpdateNotification(u);break;case 5:i.ungroupUpdateNotification(u);break}return!0}};var E=Object.defineProperty,m=Object.getOwnPropertyDescriptor,D=(e,n,i,r)=>{for(var a=r>1?void 0:r?m(n,i):n,c=e.length-1,o;c>=0;c--)(o=e[c])&&(a=(r?o(n,i,a):o(a))||a);return r&&a&&E(n,i,a),a},S=(e,n)=>(i,r)=>n(i,r,e);const P="SHEET_DRAWING_PLUGIN";let g=class extends t.Disposable{constructor(e){super(),this._commandService=e,this.disposeWithMe(this._commandService.registerCommand(N))}};g=D([t.OnLifecycle(t.LifecycleStages.Starting,g),S(0,t.ICommandService)],g);let d=class extends t.Disposable{constructor(e,n,i,r,a){super(),this._sheetDrawingService=e,this._drawingManagerService=n,this._resourceManagerService=i,this._lifecycleService=r,this._univerInstanceService=a,this._init()}_init(){this._initSnapshot(),this._drawingInitializeListener()}_initSnapshot(){const e=i=>{const r=this._sheetDrawingService.getDrawingDataForUnit(i);return r?JSON.stringify(r):""},n=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:P,businesses:[t.UniverInstanceType.UNIVER_SHEET],toJson:i=>e(i),parseJson:i=>n(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,r)=>{this._sheetDrawingService.registerDrawingData(i,r)}}))}_drawingInitializeListener(){this._lifecycleService.lifecycle$.pipe(U.filter(e=>e===t.LifecycleStages.Steady),U.first()).subscribe(()=>{var n;const e=(n=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getUnitId();e&&this._sheetDrawingService.initializeNotification(e)})}};d=D([t.OnLifecycle(t.LifecycleStages.Starting,d),S(0,h),S(1,_.IDrawingManagerService),S(2,t.IResourceManagerService),S(3,v.Inject(t.LifecycleService)),S(4,t.IUniverInstanceService)],d);var O=Object.defineProperty,R=Object.getOwnPropertyDescriptor,j=(e,n,i,r)=>{for(var a=r>1?void 0:r?R(n,i):n,c=e.length-1,o;c>=0;c--)(o=e[c])&&(a=(r?o(n,i,a):o(a))||a);return r&&a&&O(n,i,a),a},b=(e,n)=>(i,r)=>n(i,r,e);s.UniverSheetsDrawingPlugin=(f=class extends t.Plugin{constructor(n,i){super(),this._config=n,this._injector=i}onStarting(n){[[g],[d],[h,{useClass:p}]].forEach(i=>n.add(i))}},l(f,"pluginName",P),l(f,"type",t.UniverInstanceType.UNIVER_SHEET),f),s.UniverSheetsDrawingPlugin=j([b(1,v.Inject(v.Injector))],s.UniverSheetsDrawingPlugin),s.DrawingApplyType=w,s.ISheetDrawingService=h,s.SetDrawingApplyMutation=N,s.SheetDrawingAnchorType=I,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
1
+ (function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@univerjs/core"),require("@univerjs/drawing"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing","rxjs/operators"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.UniverSheetsDrawing={},s.UniverCore,s.UniverDrawing,s.rxjs.operators))})(this,function(s,t,u,l){"use strict";var M=Object.defineProperty;var L=(s,t,u)=>t in s?M(s,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):s[t]=u;var _=(s,t,u)=>L(s,typeof t!="symbol"?t+"":t,u);var d;var U=(e=>(e.Position="0",e.Both="1",e.None="2",e))(U||{});class P extends u.UnitDrawingService{}const g=t.createIdentifier("sheets-drawing.sheet-drawing.service");var I=(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))(I||{});const N={id:"sheet.mutation.set-drawing-apply",type:t.CommandType.MUTATION,handler:(e,n)=>{const i=e.get(u.IDrawingManagerService),r=e.get(g),{op:a,unitId:c,subUnitId:o,type:j,objects:v}=n;switch(i.applyJson1(c,o,a),r.applyJson1(c,o,a),j){case 0:i.addNotification(v),r.addNotification(v);break;case 1:i.removeNotification(v),r.removeNotification(v);break;case 2:i.updateNotification(v),r.updateNotification(v);break;case 3:i.orderNotification(v),r.orderNotification(v);break;case 4:i.groupUpdateNotification(v);break;case 5:i.ungroupUpdateNotification(v);break}return!0}};var p=Object.defineProperty,E=Object.getOwnPropertyDescriptor,D=(e,n,i,r)=>{for(var a=r>1?void 0:r?E(n,i):n,c=e.length-1,o;c>=0;c--)(o=e[c])&&(a=(r?o(n,i,a):o(a))||a);return r&&a&&p(n,i,a),a},S=(e,n)=>(i,r)=>n(i,r,e);const w="SHEET_DRAWING_PLUGIN";let h=class extends t.Disposable{constructor(e){super(),this._commandService=e,this.disposeWithMe(this._commandService.registerCommand(N))}};h=D([t.OnLifecycle(t.LifecycleStages.Starting,h),S(0,t.ICommandService)],h);let f=class extends t.Disposable{constructor(e,n,i,r,a){super(),this._sheetDrawingService=e,this._drawingManagerService=n,this._resourceManagerService=i,this._lifecycleService=r,this._univerInstanceService=a,this._init()}_init(){this._initSnapshot(),this._drawingInitializeListener()}_initSnapshot(){const e=i=>{const r=this._sheetDrawingService.getDrawingDataForUnit(i);return r?JSON.stringify(r):""},n=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:w,businesses:[t.UniverInstanceType.UNIVER_SHEET],toJson:i=>e(i),parseJson:i=>n(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,r)=>{this._sheetDrawingService.registerDrawingData(i,r)}}))}_drawingInitializeListener(){this._lifecycleService.lifecycle$.pipe(l.filter(e=>e===t.LifecycleStages.Steady),l.first()).subscribe(()=>{var n;const e=(n=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getUnitId();e&&this._sheetDrawingService.initializeNotification(e)})}};f=D([t.OnLifecycle(t.LifecycleStages.Starting,f),S(0,g),S(1,u.IDrawingManagerService),S(2,t.IResourceManagerService),S(3,t.Inject(t.LifecycleService)),S(4,t.IUniverInstanceService)],f);var m=Object.defineProperty,O=Object.getOwnPropertyDescriptor,R=(e,n,i,r)=>{for(var a=r>1?void 0:r?O(n,i):n,c=e.length-1,o;c>=0;c--)(o=e[c])&&(a=(r?o(n,i,a):o(a))||a);return r&&a&&m(n,i,a),a},b=(e,n)=>(i,r)=>n(i,r,e);s.UniverSheetsDrawingPlugin=(d=class extends t.Plugin{constructor(n,i){super(),this._config=n,this._injector=i}onStarting(n){[[h],[f],[g,{useClass:P}]].forEach(i=>n.add(i))}},_(d,"pluginName",w),_(d,"type",t.UniverInstanceType.UNIVER_SHEET),d),s.UniverSheetsDrawingPlugin=R([b(1,t.Inject(t.Injector))],s.UniverSheetsDrawingPlugin),s.DrawingApplyType=I,s.ISheetDrawingService=g,s.SetDrawingApplyMutation=N,s.SheetDrawingAnchorType=U,Object.defineProperty(s,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",
3
+ "version": "0.2.4-alpha.0",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -44,20 +44,18 @@
44
44
  "lib"
45
45
  ],
46
46
  "peerDependencies": {
47
- "@wendellhu/redi": "0.15.5",
48
47
  "rxjs": ">=7.0.0",
49
- "@univerjs/core": "0.2.3",
50
- "@univerjs/drawing": "0.2.3"
48
+ "@univerjs/core": "0.2.4-alpha.0",
49
+ "@univerjs/drawing": "0.2.4-alpha.0"
51
50
  },
52
51
  "devDependencies": {
53
- "@wendellhu/redi": "0.15.5",
54
52
  "typescript": "^5.5.3",
55
- "vite": "^5.3.3",
56
- "vitest": "^1.6.0",
57
- "@univerjs/drawing": "0.2.3",
58
- "@univerjs/shared": "0.2.3",
59
- "@univerjs/core": "0.2.3",
60
- "@univerjs/sheets": "0.2.3"
53
+ "vite": "^5.3.4",
54
+ "vitest": "^2.0.3",
55
+ "@univerjs/core": "0.2.4-alpha.0",
56
+ "@univerjs/shared": "0.2.4-alpha.0",
57
+ "@univerjs/drawing": "0.2.4-alpha.0",
58
+ "@univerjs/sheets": "0.2.4-alpha.0"
61
59
  },
62
60
  "univerSpace": {
63
61
  ".": {