@univerjs/sheets-drawing 0.10.12-nightly.202510221114 → 0.10.12-nightly.202510251119

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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),u=require("@univerjs/drawing");var f=(e=>(e.Position="0",e.Both="1",e.None="2",e))(f||{});class P extends u.UnitDrawingService{}const S=a.createIdentifier("sheets-drawing.sheet-drawing.service");var N=(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))(N||{});const D={id:"sheet.mutation.set-drawing-apply",type:a.CommandType.MUTATION,handler:(e,t)=>{const r=e.get(u.IDrawingManagerService),i=e.get(S),{op:n,unitId:s,subUnitId:c,type:l,objects:o}=t;switch(r.applyJson1(s,c,n),i.applyJson1(s,c,n),l){case 0:r.addNotification(o),i.addNotification(o);break;case 1:r.removeNotification(o),i.removeNotification(o);break;case 2:r.updateNotification(o),i.updateNotification(o);break;case 3:r.orderNotification(o),i.orderNotification(o);break;case 4:r.groupUpdateNotification(o);break;case 5:r.ungroupUpdateNotification(o);break}return!0}};var w=Object.getOwnPropertyDescriptor,E=(e,t,r,i)=>{for(var n=i>1?void 0:i?w(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(n=c(n)||n);return n},g=(e,t)=>(r,i)=>t(r,i,e);const _="SHEET_DRAWING_PLUGIN";let v=class extends a.Disposable{constructor(e,t,r,i){super(),this._commandService=e,this._sheetDrawingService=t,this._drawingManagerService=r,this._resourceManagerService=i,this._initSnapshot(),this.disposeWithMe(this._commandService.registerCommand(D))}_initSnapshot(){const e=(r,i)=>{const n=i||this._sheetDrawingService.getDrawingDataForUnit(r);return n?JSON.stringify(n):""},t=r=>{if(!r)return{};try{return JSON.parse(r)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:_,businesses:[a.UniverInstanceType.UNIVER_SHEET],toJson:(r,i)=>e(r,i),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)}}))}};v=E([g(0,a.ICommandService),g(1,S),g(2,u.IDrawingManagerService),g(3,a.IResourceManagerService)],v);const I="sheets-drawing.config",h={};var m=Object.defineProperty,R=Object.getOwnPropertyDescriptor,O=(e,t,r)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,b=(e,t,r,i)=>{for(var n=i>1?void 0:i?R(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(n=c(n)||n);return n},d=(e,t)=>(r,i)=>t(r,i,e),U=(e,t,r)=>O(e,typeof t!="symbol"?t+"":t,r);exports.UniverSheetsDrawingPlugin=class extends a.Plugin{constructor(t=h,r,i){super(),this._config=t,this._injector=r,this._configService=i;const{...n}=a.merge({},h,this._config);this._configService.setConfig(I,n)}onStarting(){[[v],[S,{useClass:P}]].forEach(t=>this._injector.add(t)),this._injector.get(v)}};U(exports.UniverSheetsDrawingPlugin,"pluginName",_);U(exports.UniverSheetsDrawingPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsDrawingPlugin=b([a.DependentOn(u.UniverDrawingPlugin),d(1,a.Inject(a.Injector)),d(2,a.IConfigService)],exports.UniverSheetsDrawingPlugin);exports.DrawingApplyType=N;exports.ISheetDrawingService=S;exports.SHEET_DRAWING_PLUGIN=_;exports.SetDrawingApplyMutation=D;exports.SheetDrawingAnchorType=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@univerjs/core"),U=require("@univerjs/drawing"),w=require("@univerjs/sheets");var l=(e=>(e.Position="0",e.Both="1",e.None="2",e))(l||{});class P extends U.UnitDrawingService{}const p=s.createIdentifier("sheets-drawing.sheet-drawing.service");var h=(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))(h||{});const g={id:"sheet.mutation.set-drawing-apply",type:s.CommandType.MUTATION,handler:(e,r)=>{const t=e.get(U.IDrawingManagerService),i=e.get(p),{op:n,unitId:a,subUnitId:c,type:d,objects:o}=r;switch(t.applyJson1(a,c,n),i.applyJson1(a,c,n),d){case 0:t.addNotification(o),i.addNotification(o);break;case 1:t.removeNotification(o),i.removeNotification(o);break;case 2:t.updateNotification(o),i.updateNotification(o);break;case 3:t.orderNotification(o),i.orderNotification(o);break;case 4:t.groupUpdateNotification(o);break;case 5:t.ungroupUpdateNotification(o);break}return!0}};var R=Object.getOwnPropertyDescriptor,M=(e,r,t,i)=>{for(var n=i>1?void 0:i?R(r,t):r,a=e.length-1,c;a>=0;a--)(c=e[a])&&(n=c(n)||n);return n},u=(e,r)=>(t,i)=>r(t,i,e);const f="SHEET_DRAWING_PLUGIN";let _=class extends s.Disposable{constructor(e,r,t,i,n,a){super(),this._sheetInterceptorService=e,this._univerInstanceService=r,this._commandService=t,this._sheetDrawingService=i,this._drawingManagerService=n,this._resourceManagerService=a,this._initSnapshot(),this._initSheetChange(),this.disposeWithMe(this._commandService.registerCommand(g))}_initSnapshot(){const e=(t,i)=>{const n=i||this._sheetDrawingService.getDrawingDataForUnit(t);return n?JSON.stringify(n):""},r=t=>{if(!t)return{};try{return JSON.parse(t)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:f,businesses:[s.UniverInstanceType.UNIVER_SHEET],toJson:(t,i)=>e(t,i),parseJson:t=>r(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 r;if(e.id===w.RemoveSheetCommand.id){const t=e.params,i=t.unitId||this._univerInstanceService.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),n=t.subUnitId||((r=this._univerInstanceService.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:r.getSheetId());if(!i||!n)return{redos:[],undos:[]};const a=this._sheetDrawingService.getDrawingData(i,n),c=Object.values(a);if(c.length===0)return{redos:[],undos:[]};const d=this._sheetDrawingService.getBatchRemoveOp(c),{unitId:o,subUnitId:v,undo:S,redo:D,objects:I}=d;return{redos:[{id:g.id,params:{op:D,unitId:o,subUnitId:v,objects:I,type:h.REMOVE}}],undos:[{id:g.id,params:{op:S,unitId:o,subUnitId:v,objects:I,type:h.INSERT}}]}}else if(e.id===w.CopySheetCommand.id){const t=e.params,{unitId:i,subUnitId:n,targetSubUnitId:a}=t;if(!i||!n||!a)return{redos:[],undos:[]};const c=this._sheetDrawingService.getDrawingData(i,n),d=Object.values(c).map(O=>({...O,subUnitId:a,drawingId:s.generateRandomId(6)}));if(d.length===0)return{redos:[],undos:[]};const o=this._sheetDrawingService.getBatchAddOp(d),{unitId:v,subUnitId:S,undo:D,redo:I,objects:E}=o;return{redos:[{id:g.id,params:{op:I,unitId:v,subUnitId:S,objects:E,type:h.INSERT}}],undos:[{id:g.id,params:{op:D,unitId:v,subUnitId:S,objects:E,type:h.REMOVE}}]}}return{redos:[],undos:[]}}}))}};_=M([u(0,s.Inject(w.SheetInterceptorService)),u(1,s.Inject(s.IUniverInstanceService)),u(2,s.ICommandService),u(3,p),u(4,U.IDrawingManagerService),u(5,s.IResourceManagerService)],_);const j="sheets-drawing.config",N={};var C=Object.defineProperty,G=Object.getOwnPropertyDescriptor,T=(e,r,t)=>r in e?C(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,H=(e,r,t,i)=>{for(var n=i>1?void 0:i?G(r,t):r,a=e.length-1,c;a>=0;a--)(c=e[a])&&(n=c(n)||n);return n},m=(e,r)=>(t,i)=>r(t,i,e),b=(e,r,t)=>T(e,typeof r!="symbol"?r+"":r,t);exports.UniverSheetsDrawingPlugin=class extends s.Plugin{constructor(r=N,t,i){super(),this._config=r,this._injector=t,this._configService=i;const{...n}=s.merge({},N,this._config);this._configService.setConfig(j,n)}onStarting(){[[_],[p,{useClass:P}]].forEach(r=>this._injector.add(r)),this._injector.get(_)}};b(exports.UniverSheetsDrawingPlugin,"pluginName",f);b(exports.UniverSheetsDrawingPlugin,"type",s.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsDrawingPlugin=H([s.DependentOn(U.UniverDrawingPlugin),m(1,s.Inject(s.Injector)),m(2,s.IConfigService)],exports.UniverSheetsDrawingPlugin);exports.DrawingApplyType=h;exports.ISheetDrawingService=p;exports.SHEET_DRAWING_PLUGIN=f;exports.SetDrawingApplyMutation=g;exports.SheetDrawingAnchorType=l;
package/lib/es/index.js CHANGED
@@ -1,53 +1,54 @@
1
- import { createIdentifier as U, CommandType as E, Disposable as P, UniverInstanceType as h, ICommandService as l, IResourceManagerService as D, DependentOn as I, Inject as w, Injector as R, IConfigService as O, Plugin as b, merge as M } from "@univerjs/core";
2
- import { UnitDrawingService as p, IDrawingManagerService as S, UniverDrawingPlugin as G } from "@univerjs/drawing";
3
- var C = /* @__PURE__ */ ((e) => (e.Position = "0", e.Both = "1", e.None = "2", e))(C || {});
4
- class J extends p {
1
+ import { createIdentifier as l, CommandType as P, Inject as m, IUniverInstanceService as C, ICommandService as M, IResourceManagerService as j, Disposable as G, UniverInstanceType as _, generateRandomId as J, DependentOn as V, Injector as H, IConfigService as L, Plugin as T, merge as W } from "@univerjs/core";
2
+ import { UnitDrawingService as F, IDrawingManagerService as O, UniverDrawingPlugin as x } from "@univerjs/drawing";
3
+ import { SheetInterceptorService as B, RemoveSheetCommand as $, CopySheetCommand as K } from "@univerjs/sheets";
4
+ var Y = /* @__PURE__ */ ((e) => (e.Position = "0", e.Both = "1", e.None = "2", e))(Y || {});
5
+ class k extends F {
5
6
  }
6
- const v = U("sheets-drawing.sheet-drawing.service");
7
- var j = /* @__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))(j || {});
8
- const L = {
7
+ const f = l("sheets-drawing.sheet-drawing.service");
8
+ var h = /* @__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))(h || {});
9
+ const g = {
9
10
  id: "sheet.mutation.set-drawing-apply",
10
- type: E.MUTATION,
11
- handler: (e, i) => {
12
- const t = e.get(S), r = e.get(v), { op: n, unitId: a, subUnitId: o, type: m, objects: s } = i;
13
- switch (t.applyJson1(a, o, n), r.applyJson1(a, o, n), m) {
11
+ type: P.MUTATION,
12
+ handler: (e, r) => {
13
+ const t = e.get(O), i = e.get(f), { op: n, unitId: s, subUnitId: o, type: c, objects: a } = r;
14
+ switch (t.applyJson1(s, o, n), i.applyJson1(s, o, n), c) {
14
15
  case 0:
15
- t.addNotification(s), r.addNotification(s);
16
+ t.addNotification(a), i.addNotification(a);
16
17
  break;
17
18
  case 1:
18
- t.removeNotification(s), r.removeNotification(s);
19
+ t.removeNotification(a), i.removeNotification(a);
19
20
  break;
20
21
  case 2:
21
- t.updateNotification(s), r.updateNotification(s);
22
+ t.updateNotification(a), i.updateNotification(a);
22
23
  break;
23
24
  case 3:
24
- t.orderNotification(s), r.orderNotification(s);
25
+ t.orderNotification(a), i.orderNotification(a);
25
26
  break;
26
27
  case 4:
27
- t.groupUpdateNotification(s);
28
+ t.groupUpdateNotification(a);
28
29
  break;
29
30
  case 5:
30
- t.ungroupUpdateNotification(s);
31
+ t.ungroupUpdateNotification(a);
31
32
  break;
32
33
  }
33
34
  return !0;
34
35
  }
35
36
  };
36
- var F = Object.getOwnPropertyDescriptor, H = (e, i, t, r) => {
37
- for (var n = r > 1 ? void 0 : r ? F(i, t) : i, a = e.length - 1, o; a >= 0; a--)
38
- (o = e[a]) && (n = o(n) || n);
37
+ var q = Object.getOwnPropertyDescriptor, z = (e, r, t, i) => {
38
+ for (var n = i > 1 ? void 0 : i ? q(r, t) : r, s = e.length - 1, o; s >= 0; s--)
39
+ (o = e[s]) && (n = o(n) || n);
39
40
  return n;
40
- }, c = (e, i) => (t, r) => i(t, r, e);
41
- const f = "SHEET_DRAWING_PLUGIN";
42
- let g = class extends P {
43
- constructor(e, i, t, r) {
44
- super(), this._commandService = e, this._sheetDrawingService = i, this._drawingManagerService = t, this._resourceManagerService = r, this._initSnapshot(), this.disposeWithMe(this._commandService.registerCommand(L));
41
+ }, d = (e, r) => (t, i) => r(t, i, e);
42
+ const D = "SHEET_DRAWING_PLUGIN";
43
+ let I = class extends G {
44
+ constructor(e, r, t, i, n, s) {
45
+ super(), this._sheetInterceptorService = e, this._univerInstanceService = r, this._commandService = t, this._sheetDrawingService = i, this._drawingManagerService = n, this._resourceManagerService = s, this._initSnapshot(), this._initSheetChange(), this.disposeWithMe(this._commandService.registerCommand(g));
45
46
  }
46
47
  _initSnapshot() {
47
- const e = (t, r) => {
48
- const n = r || this._sheetDrawingService.getDrawingDataForUnit(t);
48
+ const e = (t, i) => {
49
+ const n = i || this._sheetDrawingService.getDrawingDataForUnit(t);
49
50
  return n ? JSON.stringify(n) : "";
50
- }, i = (t) => {
51
+ }, r = (t) => {
51
52
  if (!t)
52
53
  return {};
53
54
  try {
@@ -58,61 +59,148 @@ let g = class extends P {
58
59
  };
59
60
  this.disposeWithMe(
60
61
  this._resourceManagerService.registerPluginResource({
61
- pluginName: f,
62
- businesses: [h.UNIVER_SHEET],
63
- toJson: (t, r) => e(t, r),
64
- parseJson: (t) => i(t),
62
+ pluginName: D,
63
+ businesses: [_.UNIVER_SHEET],
64
+ toJson: (t, i) => e(t, i),
65
+ parseJson: (t) => r(t),
65
66
  onUnLoad: (t) => {
66
67
  this._sheetDrawingService.removeDrawingDataForUnit(t), this._drawingManagerService.removeDrawingDataForUnit(t);
67
68
  },
68
- onLoad: (t, r) => {
69
- this._sheetDrawingService.registerDrawingData(t, r), this._drawingManagerService.registerDrawingData(t, r);
69
+ onLoad: (t, i) => {
70
+ this._sheetDrawingService.registerDrawingData(t, i), this._drawingManagerService.registerDrawingData(t, i);
71
+ }
72
+ })
73
+ );
74
+ }
75
+ // eslint-disable-next-line max-lines-per-function
76
+ _initSheetChange() {
77
+ this.disposeWithMe(
78
+ this._sheetInterceptorService.interceptCommand({
79
+ // eslint-disable-next-line max-lines-per-function
80
+ getMutations: (e) => {
81
+ var r;
82
+ if (e.id === $.id) {
83
+ const t = e.params, i = t.unitId || this._univerInstanceService.getCurrentUnitOfType(_.UNIVER_SHEET).getUnitId(), n = t.subUnitId || ((r = this._univerInstanceService.getCurrentUnitOfType(_.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : r.getSheetId());
84
+ if (!i || !n)
85
+ return { redos: [], undos: [] };
86
+ const s = this._sheetDrawingService.getDrawingData(i, n), o = Object.values(s);
87
+ if (o.length === 0)
88
+ return { redos: [], undos: [] };
89
+ const c = this._sheetDrawingService.getBatchRemoveOp(o), { unitId: a, subUnitId: u, undo: v, redo: U, objects: S } = c;
90
+ return {
91
+ redos: [
92
+ {
93
+ id: g.id,
94
+ params: {
95
+ op: U,
96
+ unitId: a,
97
+ subUnitId: u,
98
+ objects: S,
99
+ type: h.REMOVE
100
+ }
101
+ }
102
+ ],
103
+ undos: [
104
+ {
105
+ id: g.id,
106
+ params: {
107
+ op: v,
108
+ unitId: a,
109
+ subUnitId: u,
110
+ objects: S,
111
+ type: h.INSERT
112
+ }
113
+ }
114
+ ]
115
+ };
116
+ } else if (e.id === K.id) {
117
+ const t = e.params, { unitId: i, subUnitId: n, targetSubUnitId: s } = t;
118
+ if (!i || !n || !s)
119
+ return { redos: [], undos: [] };
120
+ const o = this._sheetDrawingService.getDrawingData(i, n), c = Object.values(o).map((R) => ({
121
+ ...R,
122
+ subUnitId: s,
123
+ drawingId: J(6)
124
+ }));
125
+ if (c.length === 0)
126
+ return { redos: [], undos: [] };
127
+ const a = this._sheetDrawingService.getBatchAddOp(c), { unitId: u, subUnitId: v, undo: U, redo: S, objects: E } = a;
128
+ return {
129
+ redos: [
130
+ {
131
+ id: g.id,
132
+ params: {
133
+ op: S,
134
+ unitId: u,
135
+ subUnitId: v,
136
+ objects: E,
137
+ type: h.INSERT
138
+ }
139
+ }
140
+ ],
141
+ undos: [
142
+ {
143
+ id: g.id,
144
+ params: {
145
+ op: U,
146
+ unitId: u,
147
+ subUnitId: v,
148
+ objects: E,
149
+ type: h.REMOVE
150
+ }
151
+ }
152
+ ]
153
+ };
154
+ }
155
+ return { redos: [], undos: [] };
70
156
  }
71
157
  })
72
158
  );
73
159
  }
74
160
  };
75
- g = H([
76
- c(0, l),
77
- c(1, v),
78
- c(2, S),
79
- c(3, D)
80
- ], g);
81
- const W = "sheets-drawing.config", d = {};
82
- var x = Object.defineProperty, V = Object.getOwnPropertyDescriptor, $ = (e, i, t) => i in e ? x(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t, B = (e, i, t, r) => {
83
- for (var n = r > 1 ? void 0 : r ? V(i, t) : i, a = e.length - 1, o; a >= 0; a--)
84
- (o = e[a]) && (n = o(n) || n);
161
+ I = z([
162
+ d(0, m(B)),
163
+ d(1, m(C)),
164
+ d(2, M),
165
+ d(3, f),
166
+ d(4, O),
167
+ d(5, j)
168
+ ], I);
169
+ const A = "sheets-drawing.config", N = {};
170
+ var Q = Object.defineProperty, X = Object.getOwnPropertyDescriptor, Z = (e, r, t) => r in e ? Q(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, y = (e, r, t, i) => {
171
+ for (var n = i > 1 ? void 0 : i ? X(r, t) : r, s = e.length - 1, o; s >= 0; s--)
172
+ (o = e[s]) && (n = o(n) || n);
85
173
  return n;
86
- }, u = (e, i) => (t, r) => i(t, r, e), N = (e, i, t) => $(e, typeof i != "symbol" ? i + "" : i, t);
87
- let _ = class extends b {
88
- constructor(e = d, i, t) {
89
- super(), this._config = e, this._injector = i, this._configService = t;
90
- const { ...r } = M(
174
+ }, b = (e, r) => (t, i) => r(t, i, e), w = (e, r, t) => Z(e, typeof r != "symbol" ? r + "" : r, t);
175
+ let p = class extends T {
176
+ constructor(e = N, r, t) {
177
+ super(), this._config = e, this._injector = r, this._configService = t;
178
+ const { ...i } = W(
91
179
  {},
92
- d,
180
+ N,
93
181
  this._config
94
182
  );
95
- this._configService.setConfig(W, r);
183
+ this._configService.setConfig(A, i);
96
184
  }
97
185
  onStarting() {
98
186
  [
99
- [g],
100
- [v, { useClass: J }]
101
- ].forEach((e) => this._injector.add(e)), this._injector.get(g);
187
+ [I],
188
+ [f, { useClass: k }]
189
+ ].forEach((e) => this._injector.add(e)), this._injector.get(I);
102
190
  }
103
191
  };
104
- N(_, "pluginName", f);
105
- N(_, "type", h.UNIVER_SHEET);
106
- _ = B([
107
- I(G),
108
- u(1, w(R)),
109
- u(2, O)
110
- ], _);
192
+ w(p, "pluginName", D);
193
+ w(p, "type", _.UNIVER_SHEET);
194
+ p = y([
195
+ V(x),
196
+ b(1, m(H)),
197
+ b(2, L)
198
+ ], p);
111
199
  export {
112
- j as DrawingApplyType,
113
- v as ISheetDrawingService,
114
- f as SHEET_DRAWING_PLUGIN,
115
- L as SetDrawingApplyMutation,
116
- C as SheetDrawingAnchorType,
117
- _ as UniverSheetsDrawingPlugin
200
+ h as DrawingApplyType,
201
+ f as ISheetDrawingService,
202
+ D as SHEET_DRAWING_PLUGIN,
203
+ g as SetDrawingApplyMutation,
204
+ Y as SheetDrawingAnchorType,
205
+ p as UniverSheetsDrawingPlugin
118
206
  };
package/lib/index.js CHANGED
@@ -1,53 +1,54 @@
1
- import { createIdentifier as U, CommandType as E, Disposable as P, UniverInstanceType as h, ICommandService as l, IResourceManagerService as D, DependentOn as I, Inject as w, Injector as R, IConfigService as O, Plugin as b, merge as M } from "@univerjs/core";
2
- import { UnitDrawingService as p, IDrawingManagerService as S, UniverDrawingPlugin as G } from "@univerjs/drawing";
3
- var C = /* @__PURE__ */ ((e) => (e.Position = "0", e.Both = "1", e.None = "2", e))(C || {});
4
- class J extends p {
1
+ import { createIdentifier as l, CommandType as P, Inject as m, IUniverInstanceService as C, ICommandService as M, IResourceManagerService as j, Disposable as G, UniverInstanceType as _, generateRandomId as J, DependentOn as V, Injector as H, IConfigService as L, Plugin as T, merge as W } from "@univerjs/core";
2
+ import { UnitDrawingService as F, IDrawingManagerService as O, UniverDrawingPlugin as x } from "@univerjs/drawing";
3
+ import { SheetInterceptorService as B, RemoveSheetCommand as $, CopySheetCommand as K } from "@univerjs/sheets";
4
+ var Y = /* @__PURE__ */ ((e) => (e.Position = "0", e.Both = "1", e.None = "2", e))(Y || {});
5
+ class k extends F {
5
6
  }
6
- const v = U("sheets-drawing.sheet-drawing.service");
7
- var j = /* @__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))(j || {});
8
- const L = {
7
+ const f = l("sheets-drawing.sheet-drawing.service");
8
+ var h = /* @__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))(h || {});
9
+ const g = {
9
10
  id: "sheet.mutation.set-drawing-apply",
10
- type: E.MUTATION,
11
- handler: (e, i) => {
12
- const t = e.get(S), r = e.get(v), { op: n, unitId: a, subUnitId: o, type: m, objects: s } = i;
13
- switch (t.applyJson1(a, o, n), r.applyJson1(a, o, n), m) {
11
+ type: P.MUTATION,
12
+ handler: (e, r) => {
13
+ const t = e.get(O), i = e.get(f), { op: n, unitId: s, subUnitId: o, type: c, objects: a } = r;
14
+ switch (t.applyJson1(s, o, n), i.applyJson1(s, o, n), c) {
14
15
  case 0:
15
- t.addNotification(s), r.addNotification(s);
16
+ t.addNotification(a), i.addNotification(a);
16
17
  break;
17
18
  case 1:
18
- t.removeNotification(s), r.removeNotification(s);
19
+ t.removeNotification(a), i.removeNotification(a);
19
20
  break;
20
21
  case 2:
21
- t.updateNotification(s), r.updateNotification(s);
22
+ t.updateNotification(a), i.updateNotification(a);
22
23
  break;
23
24
  case 3:
24
- t.orderNotification(s), r.orderNotification(s);
25
+ t.orderNotification(a), i.orderNotification(a);
25
26
  break;
26
27
  case 4:
27
- t.groupUpdateNotification(s);
28
+ t.groupUpdateNotification(a);
28
29
  break;
29
30
  case 5:
30
- t.ungroupUpdateNotification(s);
31
+ t.ungroupUpdateNotification(a);
31
32
  break;
32
33
  }
33
34
  return !0;
34
35
  }
35
36
  };
36
- var F = Object.getOwnPropertyDescriptor, H = (e, i, t, r) => {
37
- for (var n = r > 1 ? void 0 : r ? F(i, t) : i, a = e.length - 1, o; a >= 0; a--)
38
- (o = e[a]) && (n = o(n) || n);
37
+ var q = Object.getOwnPropertyDescriptor, z = (e, r, t, i) => {
38
+ for (var n = i > 1 ? void 0 : i ? q(r, t) : r, s = e.length - 1, o; s >= 0; s--)
39
+ (o = e[s]) && (n = o(n) || n);
39
40
  return n;
40
- }, c = (e, i) => (t, r) => i(t, r, e);
41
- const f = "SHEET_DRAWING_PLUGIN";
42
- let g = class extends P {
43
- constructor(e, i, t, r) {
44
- super(), this._commandService = e, this._sheetDrawingService = i, this._drawingManagerService = t, this._resourceManagerService = r, this._initSnapshot(), this.disposeWithMe(this._commandService.registerCommand(L));
41
+ }, d = (e, r) => (t, i) => r(t, i, e);
42
+ const D = "SHEET_DRAWING_PLUGIN";
43
+ let I = class extends G {
44
+ constructor(e, r, t, i, n, s) {
45
+ super(), this._sheetInterceptorService = e, this._univerInstanceService = r, this._commandService = t, this._sheetDrawingService = i, this._drawingManagerService = n, this._resourceManagerService = s, this._initSnapshot(), this._initSheetChange(), this.disposeWithMe(this._commandService.registerCommand(g));
45
46
  }
46
47
  _initSnapshot() {
47
- const e = (t, r) => {
48
- const n = r || this._sheetDrawingService.getDrawingDataForUnit(t);
48
+ const e = (t, i) => {
49
+ const n = i || this._sheetDrawingService.getDrawingDataForUnit(t);
49
50
  return n ? JSON.stringify(n) : "";
50
- }, i = (t) => {
51
+ }, r = (t) => {
51
52
  if (!t)
52
53
  return {};
53
54
  try {
@@ -58,61 +59,148 @@ let g = class extends P {
58
59
  };
59
60
  this.disposeWithMe(
60
61
  this._resourceManagerService.registerPluginResource({
61
- pluginName: f,
62
- businesses: [h.UNIVER_SHEET],
63
- toJson: (t, r) => e(t, r),
64
- parseJson: (t) => i(t),
62
+ pluginName: D,
63
+ businesses: [_.UNIVER_SHEET],
64
+ toJson: (t, i) => e(t, i),
65
+ parseJson: (t) => r(t),
65
66
  onUnLoad: (t) => {
66
67
  this._sheetDrawingService.removeDrawingDataForUnit(t), this._drawingManagerService.removeDrawingDataForUnit(t);
67
68
  },
68
- onLoad: (t, r) => {
69
- this._sheetDrawingService.registerDrawingData(t, r), this._drawingManagerService.registerDrawingData(t, r);
69
+ onLoad: (t, i) => {
70
+ this._sheetDrawingService.registerDrawingData(t, i), this._drawingManagerService.registerDrawingData(t, i);
71
+ }
72
+ })
73
+ );
74
+ }
75
+ // eslint-disable-next-line max-lines-per-function
76
+ _initSheetChange() {
77
+ this.disposeWithMe(
78
+ this._sheetInterceptorService.interceptCommand({
79
+ // eslint-disable-next-line max-lines-per-function
80
+ getMutations: (e) => {
81
+ var r;
82
+ if (e.id === $.id) {
83
+ const t = e.params, i = t.unitId || this._univerInstanceService.getCurrentUnitOfType(_.UNIVER_SHEET).getUnitId(), n = t.subUnitId || ((r = this._univerInstanceService.getCurrentUnitOfType(_.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : r.getSheetId());
84
+ if (!i || !n)
85
+ return { redos: [], undos: [] };
86
+ const s = this._sheetDrawingService.getDrawingData(i, n), o = Object.values(s);
87
+ if (o.length === 0)
88
+ return { redos: [], undos: [] };
89
+ const c = this._sheetDrawingService.getBatchRemoveOp(o), { unitId: a, subUnitId: u, undo: v, redo: U, objects: S } = c;
90
+ return {
91
+ redos: [
92
+ {
93
+ id: g.id,
94
+ params: {
95
+ op: U,
96
+ unitId: a,
97
+ subUnitId: u,
98
+ objects: S,
99
+ type: h.REMOVE
100
+ }
101
+ }
102
+ ],
103
+ undos: [
104
+ {
105
+ id: g.id,
106
+ params: {
107
+ op: v,
108
+ unitId: a,
109
+ subUnitId: u,
110
+ objects: S,
111
+ type: h.INSERT
112
+ }
113
+ }
114
+ ]
115
+ };
116
+ } else if (e.id === K.id) {
117
+ const t = e.params, { unitId: i, subUnitId: n, targetSubUnitId: s } = t;
118
+ if (!i || !n || !s)
119
+ return { redos: [], undos: [] };
120
+ const o = this._sheetDrawingService.getDrawingData(i, n), c = Object.values(o).map((R) => ({
121
+ ...R,
122
+ subUnitId: s,
123
+ drawingId: J(6)
124
+ }));
125
+ if (c.length === 0)
126
+ return { redos: [], undos: [] };
127
+ const a = this._sheetDrawingService.getBatchAddOp(c), { unitId: u, subUnitId: v, undo: U, redo: S, objects: E } = a;
128
+ return {
129
+ redos: [
130
+ {
131
+ id: g.id,
132
+ params: {
133
+ op: S,
134
+ unitId: u,
135
+ subUnitId: v,
136
+ objects: E,
137
+ type: h.INSERT
138
+ }
139
+ }
140
+ ],
141
+ undos: [
142
+ {
143
+ id: g.id,
144
+ params: {
145
+ op: U,
146
+ unitId: u,
147
+ subUnitId: v,
148
+ objects: E,
149
+ type: h.REMOVE
150
+ }
151
+ }
152
+ ]
153
+ };
154
+ }
155
+ return { redos: [], undos: [] };
70
156
  }
71
157
  })
72
158
  );
73
159
  }
74
160
  };
75
- g = H([
76
- c(0, l),
77
- c(1, v),
78
- c(2, S),
79
- c(3, D)
80
- ], g);
81
- const W = "sheets-drawing.config", d = {};
82
- var x = Object.defineProperty, V = Object.getOwnPropertyDescriptor, $ = (e, i, t) => i in e ? x(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t, B = (e, i, t, r) => {
83
- for (var n = r > 1 ? void 0 : r ? V(i, t) : i, a = e.length - 1, o; a >= 0; a--)
84
- (o = e[a]) && (n = o(n) || n);
161
+ I = z([
162
+ d(0, m(B)),
163
+ d(1, m(C)),
164
+ d(2, M),
165
+ d(3, f),
166
+ d(4, O),
167
+ d(5, j)
168
+ ], I);
169
+ const A = "sheets-drawing.config", N = {};
170
+ var Q = Object.defineProperty, X = Object.getOwnPropertyDescriptor, Z = (e, r, t) => r in e ? Q(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, y = (e, r, t, i) => {
171
+ for (var n = i > 1 ? void 0 : i ? X(r, t) : r, s = e.length - 1, o; s >= 0; s--)
172
+ (o = e[s]) && (n = o(n) || n);
85
173
  return n;
86
- }, u = (e, i) => (t, r) => i(t, r, e), N = (e, i, t) => $(e, typeof i != "symbol" ? i + "" : i, t);
87
- let _ = class extends b {
88
- constructor(e = d, i, t) {
89
- super(), this._config = e, this._injector = i, this._configService = t;
90
- const { ...r } = M(
174
+ }, b = (e, r) => (t, i) => r(t, i, e), w = (e, r, t) => Z(e, typeof r != "symbol" ? r + "" : r, t);
175
+ let p = class extends T {
176
+ constructor(e = N, r, t) {
177
+ super(), this._config = e, this._injector = r, this._configService = t;
178
+ const { ...i } = W(
91
179
  {},
92
- d,
180
+ N,
93
181
  this._config
94
182
  );
95
- this._configService.setConfig(W, r);
183
+ this._configService.setConfig(A, i);
96
184
  }
97
185
  onStarting() {
98
186
  [
99
- [g],
100
- [v, { useClass: J }]
101
- ].forEach((e) => this._injector.add(e)), this._injector.get(g);
187
+ [I],
188
+ [f, { useClass: k }]
189
+ ].forEach((e) => this._injector.add(e)), this._injector.get(I);
102
190
  }
103
191
  };
104
- N(_, "pluginName", f);
105
- N(_, "type", h.UNIVER_SHEET);
106
- _ = B([
107
- I(G),
108
- u(1, w(R)),
109
- u(2, O)
110
- ], _);
192
+ w(p, "pluginName", D);
193
+ w(p, "type", _.UNIVER_SHEET);
194
+ p = y([
195
+ V(x),
196
+ b(1, m(H)),
197
+ b(2, L)
198
+ ], p);
111
199
  export {
112
- j as DrawingApplyType,
113
- v as ISheetDrawingService,
114
- f as SHEET_DRAWING_PLUGIN,
115
- L as SetDrawingApplyMutation,
116
- C as SheetDrawingAnchorType,
117
- _ as UniverSheetsDrawingPlugin
200
+ h as DrawingApplyType,
201
+ f as ISheetDrawingService,
202
+ D as SHEET_DRAWING_PLUGIN,
203
+ g as SetDrawingApplyMutation,
204
+ Y as SheetDrawingAnchorType,
205
+ p as UniverSheetsDrawingPlugin
118
206
  };
@@ -1,12 +1,16 @@
1
- import { Disposable, ICommandService, IResourceManagerService } from '@univerjs/core';
1
+ import { Disposable, ICommandService, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { IDrawingManagerService } from '@univerjs/drawing';
3
+ import { SheetInterceptorService } from '@univerjs/sheets';
3
4
  import { ISheetDrawingService } from '../services/sheet-drawing.service';
4
5
  export declare const SHEET_DRAWING_PLUGIN = "SHEET_DRAWING_PLUGIN";
5
6
  export declare class SheetsDrawingLoadController extends Disposable {
7
+ private _sheetInterceptorService;
8
+ private _univerInstanceService;
6
9
  private readonly _commandService;
7
10
  private readonly _sheetDrawingService;
8
11
  private readonly _drawingManagerService;
9
12
  private _resourceManagerService;
10
- constructor(_commandService: ICommandService, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _resourceManagerService: IResourceManagerService);
13
+ constructor(_sheetInterceptorService: SheetInterceptorService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _resourceManagerService: IResourceManagerService);
11
14
  private _initSnapshot;
15
+ private _initSheetChange;
12
16
  }
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(n,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],a):(n=typeof globalThis<"u"?globalThis:n||self,a(n.UniverSheetsDrawing={},n.UniverCore,n.UniverDrawing))})(this,(function(n,a,u){"use strict";var _=(e=>(e.Position="0",e.Both="1",e.None="2",e))(_||{});class w extends u.UnitDrawingService{}const v=a.createIdentifier("sheets-drawing.sheet-drawing.service");var f=(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))(f||{});const U={id:"sheet.mutation.set-drawing-apply",type:a.CommandType.MUTATION,handler:(e,t)=>{const i=e.get(u.IDrawingManagerService),r=e.get(v),{op:s,unitId:o,subUnitId:g,type:M,objects:c}=t;switch(i.applyJson1(o,g,s),r.applyJson1(o,g,s),M){case 0:i.addNotification(c),r.addNotification(c);break;case 1:i.removeNotification(c),r.removeNotification(c);break;case 2:i.updateNotification(c),r.updateNotification(c);break;case 3:i.orderNotification(c),r.orderNotification(c);break;case 4:i.groupUpdateNotification(c);break;case 5:i.ungroupUpdateNotification(c);break}return!0}};var l=Object.getOwnPropertyDescriptor,m=(e,t,i,r)=>{for(var s=r>1?void 0:r?l(t,i):t,o=e.length-1,g;o>=0;o--)(g=e[o])&&(s=g(s)||s);return s},h=(e,t)=>(i,r)=>t(i,r,e);const S="SHEET_DRAWING_PLUGIN";let d=class extends a.Disposable{constructor(e,t,i,r){super(),this._commandService=e,this._sheetDrawingService=t,this._drawingManagerService=i,this._resourceManagerService=r,this._initSnapshot(),this.disposeWithMe(this._commandService.registerCommand(U))}_initSnapshot(){const e=(i,r)=>{const s=r||this._sheetDrawingService.getDrawingDataForUnit(i);return s?JSON.stringify(s):""},t=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:S,businesses:[a.UniverInstanceType.UNIVER_SHEET],toJson:(i,r)=>e(i,r),parseJson:i=>t(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,r)=>{this._sheetDrawingService.registerDrawingData(i,r),this._drawingManagerService.registerDrawingData(i,r)}}))}};d=m([h(0,a.ICommandService),h(1,v),h(2,u.IDrawingManagerService),h(3,a.IResourceManagerService)],d);const E="sheets-drawing.config",D={};var I=Object.defineProperty,R=Object.getOwnPropertyDescriptor,O=(e,t,i)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,b=(e,t,i,r)=>{for(var s=r>1?void 0:r?R(t,i):t,o=e.length-1,g;o>=0;o--)(g=e[o])&&(s=g(s)||s);return s},N=(e,t)=>(i,r)=>t(i,r,e),P=(e,t,i)=>O(e,typeof t!="symbol"?t+"":t,i);n.UniverSheetsDrawingPlugin=class extends a.Plugin{constructor(t=D,i,r){super(),this._config=t,this._injector=i,this._configService=r;const{...s}=a.merge({},D,this._config);this._configService.setConfig(E,s)}onStarting(){[[d],[v,{useClass:w}]].forEach(t=>this._injector.add(t)),this._injector.get(d)}},P(n.UniverSheetsDrawingPlugin,"pluginName",S),P(n.UniverSheetsDrawingPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),n.UniverSheetsDrawingPlugin=b([a.DependentOn(u.UniverDrawingPlugin),N(1,a.Inject(a.Injector)),N(2,a.IConfigService)],n.UniverSheetsDrawingPlugin),n.DrawingApplyType=f,n.ISheetDrawingService=v,n.SHEET_DRAWING_PLUGIN=S,n.SetDrawingApplyMutation=U,n.SheetDrawingAnchorType=_,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(a,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/drawing"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing","@univerjs/sheets"],s):(a=typeof globalThis<"u"?globalThis:a||self,s(a.UniverSheetsDrawing={},a.UniverCore,a.UniverDrawing,a.UniverSheets))})(this,(function(a,s,I,D){"use strict";var E=(e=>(e.Position="0",e.Both="1",e.None="2",e))(E||{});class P extends I.UnitDrawingService{}const _=s.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 g={id:"sheet.mutation.set-drawing-apply",type:s.CommandType.MUTATION,handler:(e,n)=>{const t=e.get(I.IDrawingManagerService),i=e.get(_),{op:r,unitId:o,subUnitId:c,type:h,objects:d}=n;switch(t.applyJson1(o,c,r),i.applyJson1(o,c,r),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 R=Object.getOwnPropertyDescriptor,j=(e,n,t,i)=>{for(var r=i>1?void 0:i?R(n,t):n,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},v=(e,n)=>(t,i)=>n(t,i,e);const w="SHEET_DRAWING_PLUGIN";let U=class extends s.Disposable{constructor(e,n,t,i,r,o){super(),this._sheetInterceptorService=e,this._univerInstanceService=n,this._commandService=t,this._sheetDrawingService=i,this._drawingManagerService=r,this._resourceManagerService=o,this._initSnapshot(),this._initSheetChange(),this.disposeWithMe(this._commandService.registerCommand(g))}_initSnapshot(){const e=(t,i)=>{const r=i||this._sheetDrawingService.getDrawingDataForUnit(t);return r?JSON.stringify(r):""},n=t=>{if(!t)return{};try{return JSON.parse(t)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:w,businesses:[s.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===D.RemoveSheetCommand.id){const t=e.params,i=t.unitId||this._univerInstanceService.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=t.subUnitId||((n=this._univerInstanceService.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId());if(!i||!r)return{redos:[],undos:[]};const o=this._sheetDrawingService.getDrawingData(i,r),c=Object.values(o);if(c.length===0)return{redos:[],undos:[]};const h=this._sheetDrawingService.getBatchRemoveOp(c),{unitId:d,subUnitId:S,undo:f,redo:m,objects:p}=h;return{redos:[{id:g.id,params:{op:m,unitId:d,subUnitId:S,objects:p,type:u.REMOVE}}],undos:[{id:g.id,params:{op:f,unitId:d,subUnitId:S,objects:p,type:u.INSERT}}]}}else if(e.id===D.CopySheetCommand.id){const t=e.params,{unitId:i,subUnitId:r,targetSubUnitId:o}=t;if(!i||!r||!o)return{redos:[],undos:[]};const c=this._sheetDrawingService.getDrawingData(i,r),h=Object.values(c).map(J=>({...J,subUnitId:o,drawingId:s.generateRandomId(6)}));if(h.length===0)return{redos:[],undos:[]};const d=this._sheetDrawingService.getBatchAddOp(h),{unitId:S,subUnitId:f,undo:m,redo:p,objects:l}=d;return{redos:[{id:g.id,params:{op:p,unitId:S,subUnitId:f,objects:l,type:u.INSERT}}],undos:[{id:g.id,params:{op:m,unitId:S,subUnitId:f,objects:l,type:u.REMOVE}}]}}return{redos:[],undos:[]}}}))}};U=j([v(0,s.Inject(D.SheetInterceptorService)),v(1,s.Inject(s.IUniverInstanceService)),v(2,s.ICommandService),v(3,_),v(4,I.IDrawingManagerService),v(5,s.IResourceManagerService)],U);const M="sheets-drawing.config",N={};var C=Object.defineProperty,G=Object.getOwnPropertyDescriptor,T=(e,n,t)=>n in e?C(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,H=(e,n,t,i)=>{for(var r=i>1?void 0:i?G(n,t):n,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},b=(e,n)=>(t,i)=>n(t,i,e),O=(e,n,t)=>T(e,typeof n!="symbol"?n+"":n,t);a.UniverSheetsDrawingPlugin=class extends s.Plugin{constructor(n=N,t,i){super(),this._config=n,this._injector=t,this._configService=i;const{...r}=s.merge({},N,this._config);this._configService.setConfig(M,r)}onStarting(){[[U],[_,{useClass:P}]].forEach(n=>this._injector.add(n)),this._injector.get(U)}},O(a.UniverSheetsDrawingPlugin,"pluginName",w),O(a.UniverSheetsDrawingPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),a.UniverSheetsDrawingPlugin=H([s.DependentOn(I.UniverDrawingPlugin),b(1,s.Inject(s.Injector)),b(2,s.IConfigService)],a.UniverSheetsDrawingPlugin),a.DrawingApplyType=u,a.ISheetDrawingService=_,a.SHEET_DRAWING_PLUGIN=w,a.SetDrawingApplyMutation=g,a.SheetDrawingAnchorType=E,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.10.12-nightly.202510221114",
3
+ "version": "0.10.12-nightly.202510251119",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -43,15 +43,15 @@
43
43
  "lib"
44
44
  ],
45
45
  "dependencies": {
46
- "@univerjs/core": "0.10.12-nightly.202510221114",
47
- "@univerjs/drawing": "0.10.12-nightly.202510221114"
46
+ "@univerjs/core": "0.10.12-nightly.202510251119",
47
+ "@univerjs/sheets": "0.10.12-nightly.202510251119",
48
+ "@univerjs/drawing": "0.10.12-nightly.202510251119"
48
49
  },
49
50
  "devDependencies": {
50
51
  "typescript": "^5.9.3",
51
52
  "vite": "^7.1.10",
52
53
  "vitest": "^3.2.4",
53
- "@univerjs-infra/shared": "0.10.12",
54
- "@univerjs/sheets": "0.10.12-nightly.202510221114"
54
+ "@univerjs-infra/shared": "0.10.12"
55
55
  },
56
56
  "scripts": {
57
57
  "test": "vitest run",