@univerjs/sheets-drawing-ui 0.5.4 → 0.5.5-nightly.202501201336

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/es/facade.js CHANGED
@@ -1,81 +1,81 @@
1
- var $ = Object.defineProperty;
2
- var L = (i, t, e) => t in i ? $(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var D = (i, t, e) => L(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { Inject as A, Injector as x, ICommandService as P, generateRandomId as X, DrawingTypeEnum as _, ImageSourceType as I, FBase as Y, ArrangeTypeEnum as f, toDisposable as C, FEnum as F, FEventName as W, FUniver as U } from "@univerjs/core";
5
- import { getImageSize as H, SetDrawingSelectedOperation as B, IDrawingManagerService as u } from "@univerjs/drawing";
6
- import { IRenderManagerService as j } from "@univerjs/engine-render";
7
- import { SetSheetDrawingCommand as g, SetDrawingArrangeCommand as w, SheetCanvasFloatDomManagerService as K, InsertSheetDrawingCommand as S, RemoveSheetDrawingCommand as G } from "@univerjs/sheets-drawing-ui";
8
- import { SheetSkeletonManagerService as T, ISheetSelectionRenderService as V, convertPositionSheetOverGridToAbsolute as q, convertPositionCellToSheetOverGrid as J } from "@univerjs/sheets-ui";
9
- import { ISheetDrawingService as h, SheetDrawingAnchorType as Q } from "@univerjs/sheets-drawing";
10
- import { transformComponentKey as Z } from "@univerjs/sheets-ui/facade";
11
- import { FWorksheet as M } from "@univerjs/sheets/facade";
12
- import { ComponentManager as ee } from "@univerjs/ui";
13
- var te = Object.defineProperty, re = Object.getOwnPropertyDescriptor, z = (i, t, e, r) => {
14
- for (var n = r > 1 ? void 0 : r ? re(t, e) : t, s = i.length - 1, a; s >= 0; s--)
15
- (a = i[s]) && (n = (r ? a(t, e, n) : a(n)) || n);
16
- return r && n && te(t, e, n), n;
17
- }, E = (i, t) => (e, r) => t(e, r, i);
18
- function ie(i, t) {
19
- const { from: e, to: r, flipY: n = !1, flipX: s = !1, angle: a = 0, skewX: o = 0, skewY: c = 0 } = i.sheetTransform, { column: m, columnOffset: l, row: v, rowOffset: O } = e, p = q(
20
- i.unitId,
21
- i.subUnitId,
22
- { from: e, to: r },
1
+ var L = Object.defineProperty;
2
+ var X = (r, t, e) => t in r ? L(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var T = (r, t, e) => X(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { Inject as x, Injector as P, ICommandService as W, generateRandomId as Y, DrawingTypeEnum as _, ImageSourceType as I, FBase as V, ArrangeTypeEnum as v, toDisposable as C, FEnum as M, FEventName as z, FUniver as N } from "@univerjs/core";
5
+ import { getImageSize as q, SetDrawingSelectedOperation as A, IDrawingManagerService as l } from "@univerjs/drawing";
6
+ import { IRenderManagerService as F } from "@univerjs/engine-render";
7
+ import { SetSheetDrawingCommand as m, SetDrawingArrangeCommand as w, SheetCanvasFloatDomManagerService as G, InsertSheetDrawingCommand as S, RemoveSheetDrawingCommand as D } from "@univerjs/sheets-drawing-ui";
8
+ import { SheetSkeletonManagerService as U, ISheetSelectionRenderService as J, convertPositionSheetOverGridToAbsolute as Q, convertPositionCellToSheetOverGrid as Z } from "@univerjs/sheets-ui";
9
+ import { ISheetDrawingService as u, SheetDrawingAnchorType as ee } from "@univerjs/sheets-drawing";
10
+ import { transformComponentKey as E } from "@univerjs/sheets-ui/facade";
11
+ import { FWorksheet as $ } from "@univerjs/sheets/facade";
12
+ import { ComponentManager as y } from "@univerjs/ui";
13
+ var te = Object.defineProperty, ie = Object.getOwnPropertyDescriptor, H = (r, t, e, i) => {
14
+ for (var n = i > 1 ? void 0 : i ? ie(t, e) : t, s = r.length - 1, o; s >= 0; s--)
15
+ (o = r[s]) && (n = (i ? o(t, e, n) : o(n)) || n);
16
+ return i && n && te(t, e, n), n;
17
+ }, R = (r, t) => (e, i) => t(e, i, r);
18
+ function re(r, t) {
19
+ const { from: e, to: i, flipY: n = !1, flipX: s = !1, angle: o = 0, skewX: c = 0, skewY: a = 0 } = r.sheetTransform, { column: h, columnOffset: d, row: f, rowOffset: p } = e, k = Q(
20
+ r.unitId,
21
+ r.subUnitId,
22
+ { from: e, to: i },
23
23
  t
24
- ), { left: y, top: R, width: k, height: N } = p;
24
+ ), { left: B, top: j, width: O, height: K } = k;
25
25
  return {
26
- ...i,
27
- column: m,
28
- columnOffset: l,
29
- row: v,
30
- rowOffset: O,
31
- width: k,
32
- height: N,
26
+ ...r,
27
+ column: h,
28
+ columnOffset: d,
29
+ row: f,
30
+ rowOffset: p,
31
+ width: O,
32
+ height: K,
33
33
  flipY: n,
34
34
  flipX: s,
35
- angle: a,
36
- skewX: o,
37
- skewY: c
35
+ angle: o,
36
+ skewX: c,
37
+ skewY: a
38
38
  };
39
39
  }
40
- function ne(i, t, e) {
41
- const { column: r, columnOffset: n, row: s, rowOffset: a, flipY: o = !1, flipX: c = !1, angle: m = 0, skewX: l = 0, skewY: v = 0, width: O, height: p } = i, y = J(
42
- i.unitId,
43
- i.subUnitId,
44
- { column: r, columnOffset: n, row: s, rowOffset: a },
45
- O,
40
+ function ne(r, t, e) {
41
+ const { column: i, columnOffset: n, row: s, rowOffset: o, flipY: c = !1, flipX: a = !1, angle: h = 0, skewX: d = 0, skewY: f = 0, width: p, height: k } = r, B = Z(
42
+ r.unitId,
43
+ r.subUnitId,
44
+ { column: i, columnOffset: n, row: s, rowOffset: o },
46
45
  p,
46
+ k,
47
47
  t,
48
48
  e
49
- ), { sheetTransform: R, transform: k } = y;
49
+ ), { sheetTransform: j, transform: O } = B;
50
50
  return {
51
- ...i,
51
+ ...r,
52
52
  sheetTransform: {
53
- ...R,
54
- flipY: o,
55
- flipX: c,
56
- angle: m,
57
- skewX: l,
58
- skewY: v
53
+ ...j,
54
+ flipY: c,
55
+ flipX: a,
56
+ angle: h,
57
+ skewX: d,
58
+ skewY: f
59
59
  },
60
60
  transform: {
61
- ...k,
62
- flipY: o,
63
- flipX: c,
64
- angle: m,
65
- skewX: l,
66
- skewY: v
61
+ ...O,
62
+ flipY: c,
63
+ flipX: a,
64
+ angle: h,
65
+ skewX: d,
66
+ skewY: f
67
67
  }
68
68
  };
69
69
  }
70
70
  let b = class {
71
- constructor(i, t, e) {
72
- D(this, "_image");
71
+ constructor(r, t, e) {
72
+ T(this, "_image");
73
73
  this._injector = e, this._image = {
74
- drawingId: X(6),
74
+ drawingId: Y(6),
75
75
  drawingType: _.DRAWING_IMAGE,
76
76
  imageSourceType: I.BASE64,
77
77
  source: "",
78
- unitId: i,
78
+ unitId: r,
79
79
  subUnitId: t,
80
80
  column: 0,
81
81
  columnOffset: 0,
@@ -106,12 +106,12 @@ let b = class {
106
106
  * activeSheet.insertImages([param]);
107
107
  * ```
108
108
  */
109
- setImage(i) {
110
- const e = this._injector.get(j).getRenderById(i.unitId);
109
+ setImage(r) {
110
+ const e = this._injector.get(F).getRenderById(r.unitId);
111
111
  if (!e)
112
- throw new Error(`Render Unit with unitId ${i.unitId} not found`);
113
- const r = e.with(T);
114
- return i.sheetTransform == null && (i.sheetTransform = {
112
+ throw new Error(`Render Unit with unitId ${r.unitId} not found`);
113
+ const i = e.with(U);
114
+ return r.sheetTransform == null && (r.sheetTransform = {
115
115
  from: {
116
116
  column: 0,
117
117
  columnOffset: 0,
@@ -124,11 +124,11 @@ let b = class {
124
124
  row: 0,
125
125
  rowOffset: 0
126
126
  }
127
- }), this._image = ie(i, r), this;
127
+ }), this._image = re(r, i), this;
128
128
  }
129
- setSource(i, t) {
129
+ setSource(r, t) {
130
130
  const e = t != null ? t : I.URL;
131
- return this._image.source = i, this._image.imageSourceType = e, this;
131
+ return this._image.source = r, this._image.imageSourceType = e, this;
132
132
  }
133
133
  getsource() {
134
134
  return this._image.source;
@@ -150,8 +150,8 @@ let b = class {
150
150
  * activeSheet.insertImages([param]);
151
151
  * ```
152
152
  */
153
- setColumn(i) {
154
- return this._image.column = i, this;
153
+ setColumn(r) {
154
+ return this._image.column = r, this;
155
155
  }
156
156
  /**
157
157
  * Set the position of the image
@@ -167,8 +167,8 @@ let b = class {
167
167
  * activeSheet.insertImages([param]);
168
168
  * ```
169
169
  */
170
- setRow(i) {
171
- return this._image.row = i, this;
170
+ setRow(r) {
171
+ return this._image.row = r, this;
172
172
  }
173
173
  /**
174
174
  * Set the column offset of the image in a unit
@@ -184,8 +184,8 @@ let b = class {
184
184
  * activeSheet.insertImages([param]);
185
185
  * ```
186
186
  */
187
- setColumnOffset(i) {
188
- return this._image.columnOffset = i, this;
187
+ setColumnOffset(r) {
188
+ return this._image.columnOffset = r, this;
189
189
  }
190
190
  /**
191
191
  * Set the row offset of the image in a unit
@@ -201,8 +201,8 @@ let b = class {
201
201
  * activeSheet.insertImages([param]);
202
202
  * ```
203
203
  */
204
- setRowOffset(i) {
205
- return this._image.rowOffset = i, this;
204
+ setRowOffset(r) {
205
+ return this._image.rowOffset = r, this;
206
206
  }
207
207
  /**
208
208
  * set the width of the image
@@ -218,8 +218,8 @@ let b = class {
218
218
  * activeSheet.insertImages([param]);
219
219
  * ```
220
220
  */
221
- setWidth(i) {
222
- return this._image.width = i, this;
221
+ setWidth(r) {
222
+ return this._image.width = r, this;
223
223
  }
224
224
  /**
225
225
  * Set the height of the image
@@ -235,8 +235,8 @@ let b = class {
235
235
  * activeSheet.insertImages([param]);
236
236
  * ```
237
237
  */
238
- setHeight(i) {
239
- return this._image.height = i, this;
238
+ setHeight(r) {
239
+ return this._image.height = r, this;
240
240
  }
241
241
  /**
242
242
  * Set the anchor type of the image, whether the position and size change with the cell
@@ -252,8 +252,8 @@ let b = class {
252
252
  * activeSheet.insertImages([param]);
253
253
  * ```
254
254
  */
255
- setAnchorType(i) {
256
- return this._image.anchorType = i, this;
255
+ setAnchorType(r) {
256
+ return this._image.anchorType = r, this;
257
257
  }
258
258
  /**
259
259
  * Set the cropping region of the image by defining the top edges, thereby displaying the specific part of the image you want.
@@ -269,8 +269,8 @@ let b = class {
269
269
  * activeSheet.insertImages([param]);
270
270
  * ```
271
271
  */
272
- setCropTop(i) {
273
- return this._initializeSrcRect(), this._image.srcRect.top = i, this;
272
+ setCropTop(r) {
273
+ return this._initializeSrcRect(), this._image.srcRect.top = r, this;
274
274
  }
275
275
  /**
276
276
  * Set the cropping region of the image by defining the left edges, thereby displaying the specific part of the image you want.
@@ -286,8 +286,8 @@ let b = class {
286
286
  * activeSheet.insertImages([param]);
287
287
  * ```
288
288
  */
289
- setCropLeft(i) {
290
- return this._initializeSrcRect(), this._image.srcRect.left = i, this;
289
+ setCropLeft(r) {
290
+ return this._initializeSrcRect(), this._image.srcRect.left = r, this;
291
291
  }
292
292
  /**
293
293
  * Set the cropping region of the image by defining the bottom edges, thereby displaying the specific part of the image you want.
@@ -303,8 +303,8 @@ let b = class {
303
303
  * activeSheet.insertImages([param]);
304
304
  * ```
305
305
  */
306
- setCropBottom(i) {
307
- return this._initializeSrcRect(), this._image.srcRect.bottom = i, this;
306
+ setCropBottom(r) {
307
+ return this._initializeSrcRect(), this._image.srcRect.bottom = r, this;
308
308
  }
309
309
  /**
310
310
  * Set the cropping region of the image by defining the right edges, thereby displaying the specific part of the image you want.
@@ -320,8 +320,8 @@ let b = class {
320
320
  * activeSheet.insertImages([param]);
321
321
  * ```
322
322
  */
323
- setCropRight(i) {
324
- return this._initializeSrcRect(), this._image.srcRect.right = i, this;
323
+ setCropRight(r) {
324
+ return this._initializeSrcRect(), this._image.srcRect.right = r, this;
325
325
  }
326
326
  _initializeSrcRect() {
327
327
  this._image.srcRect == null && (this._image.srcRect = {
@@ -345,37 +345,37 @@ let b = class {
345
345
  * activeSheet.insertImages([param]);
346
346
  * ```
347
347
  */
348
- setRotate(i) {
349
- return this._image.angle = i, this;
348
+ setRotate(r) {
349
+ return this._image.angle = r, this;
350
350
  }
351
351
  // setPresetGeometry(prstGeom: PresetGeometryType): FOverGridImageBuilder {
352
352
  // this._image.prstGeom = prstGeom;
353
353
  // return this;
354
354
  // }
355
- setUnitId(i) {
356
- return this._image.unitId = i, this;
355
+ setUnitId(r) {
356
+ return this._image.unitId = r, this;
357
357
  }
358
- setSubUnitId(i) {
359
- return this._image.subUnitId = i, this;
358
+ setSubUnitId(r) {
359
+ return this._image.subUnitId = r, this;
360
360
  }
361
361
  async buildAsync() {
362
- const t = this._injector.get(j).getRenderById(this._image.unitId);
362
+ const t = this._injector.get(F).getRenderById(this._image.unitId);
363
363
  if (!t)
364
364
  throw new Error(`Render Unit with unitId ${this._image.unitId} not found`);
365
- const e = t.with(V), r = t.with(T);
365
+ const e = t.with(J), i = t.with(U);
366
366
  if (this._image.width === 0 || this._image.height === 0) {
367
- const n = await H(this._image.source), s = n.width, a = n.height;
368
- this._image.width === 0 && (this._image.width = s), this._image.height === 0 && (this._image.height = a);
367
+ const n = await q(this._image.source), s = n.width, o = n.height;
368
+ this._image.width === 0 && (this._image.width = s), this._image.height === 0 && (this._image.height = o);
369
369
  }
370
- return ne(this._image, e, r);
370
+ return ne(this._image, e, i);
371
371
  }
372
372
  };
373
- b = z([
374
- E(2, A(x))
373
+ b = H([
374
+ R(2, x(P))
375
375
  ], b);
376
- let d = class extends Y {
377
- constructor(i, t, e) {
378
- super(), this._image = i, this._commandService = t, this._injector = e;
376
+ let g = class extends V {
377
+ constructor(r, t, e) {
378
+ super(), this._image = r, this._commandService = t, this._injector = e;
379
379
  }
380
380
  getId() {
381
381
  return this._image.drawingId;
@@ -396,7 +396,7 @@ let d = class extends Y {
396
396
  * ```
397
397
  */
398
398
  remove() {
399
- return this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [this._image] });
399
+ return this._commandService.syncExecuteCommand(m.id, { unitId: this._image.unitId, drawings: [this._image] });
400
400
  }
401
401
  /**
402
402
  * Convert the image to a FOverGridImageBuilder
@@ -413,18 +413,18 @@ let d = class extends Y {
413
413
  * ```
414
414
  */
415
415
  toBuilder() {
416
- const i = this._injector.createInstance(b);
417
- return i.setImage(this._image), i;
416
+ const r = this._injector.createInstance(b);
417
+ return r.setImage(this._image), r;
418
418
  }
419
- setSource(i, t) {
419
+ setSource(r, t) {
420
420
  const e = t != null ? t : I.URL;
421
- return this._image.source = i, this._image.imageSourceType = e, this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [this._image] });
421
+ return this._image.source = r, this._image.imageSourceType = e, this._commandService.syncExecuteCommand(m.id, { unitId: this._image.unitId, drawings: [this._image] });
422
422
  }
423
- async setPositionAsync(i, t, e, r) {
423
+ async setPositionAsync(r, t, e, i) {
424
424
  const n = this.toBuilder();
425
- n.setColumn(t), n.setRow(i), e != null && n.setRowOffset(e), r != null && n.setColumnOffset(r);
425
+ n.setColumn(t), n.setRow(r), e != null && n.setRowOffset(e), i != null && n.setColumnOffset(i);
426
426
  const s = await n.buildAsync();
427
- return this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [s] });
427
+ return this._commandService.syncExecuteCommand(m.id, { unitId: this._image.unitId, drawings: [s] });
428
428
  }
429
429
  /**
430
430
  * Set the size of the image
@@ -439,11 +439,11 @@ let d = class extends Y {
439
439
  * const image = activeSheet.getImages()[0];
440
440
  * console.log('Set size state is ', image.setSize(50, 120));
441
441
  */
442
- async setSizeAsync(i, t) {
442
+ async setSizeAsync(r, t) {
443
443
  const e = this.toBuilder();
444
- e.setWidth(i), e.setHeight(t);
445
- const r = await e.buildAsync();
446
- return this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [r] });
444
+ e.setWidth(r), e.setHeight(t);
445
+ const i = await e.buildAsync();
446
+ return this._commandService.syncExecuteCommand(m.id, { unitId: this._image.unitId, drawings: [i] });
447
447
  }
448
448
  /**
449
449
  * Set the cropping region of the image by defining the top, bottom, left, and right edges, thereby displaying the specific part of the image you want.
@@ -461,13 +461,13 @@ let d = class extends Y {
461
461
  * console.log('Set crop state is ', image.setCrop(10, 10, 10, 10));
462
462
  * ```
463
463
  */
464
- setCrop(i, t, e, r) {
464
+ setCrop(r, t, e, i) {
465
465
  return this._image.srcRect == null && (this._image.srcRect = {
466
466
  top: 0,
467
467
  left: 0,
468
468
  bottom: 0,
469
469
  right: 0
470
- }), i != null && (this._image.srcRect.top = i), t != null && (this._image.srcRect.left = t), e != null && (this._image.srcRect.bottom = e), r != null && (this._image.srcRect.right = r), this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [this._image] });
470
+ }), r != null && (this._image.srcRect.top = r), t != null && (this._image.srcRect.left = t), e != null && (this._image.srcRect.bottom = e), i != null && (this._image.srcRect.right = i), this._commandService.syncExecuteCommand(m.id, { unitId: this._image.unitId, drawings: [this._image] });
471
471
  }
472
472
  // setPresetGeometry(prstGeom: PresetGeometryType): boolean {
473
473
  // this._image.prstGeom = prstGeom;
@@ -486,8 +486,8 @@ let d = class extends Y {
486
486
  * console.log('Set rotate state is ', image.setRotate(90));
487
487
  * ```
488
488
  */
489
- setRotate(i) {
490
- return this._image.sheetTransform.angle = i, this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [this._image] });
489
+ setRotate(r) {
490
+ return this._image.sheetTransform.angle = r, this._commandService.syncExecuteCommand(m.id, { unitId: this._image.unitId, drawings: [this._image] });
491
491
  }
492
492
  /**
493
493
  * Move the image layer forward by one level
@@ -506,7 +506,7 @@ let d = class extends Y {
506
506
  unitId: this._image.unitId,
507
507
  subUnitId: this._image.subUnitId,
508
508
  drawingIds: [this._image.drawingId],
509
- arrangeType: f.forward
509
+ arrangeType: v.forward
510
510
  });
511
511
  }
512
512
  /**
@@ -526,7 +526,7 @@ let d = class extends Y {
526
526
  unitId: this._image.unitId,
527
527
  subUnitId: this._image.subUnitId,
528
528
  drawingIds: [this._image.drawingId],
529
- arrangeType: f.backward
529
+ arrangeType: v.backward
530
530
  });
531
531
  }
532
532
  /**
@@ -546,7 +546,7 @@ let d = class extends Y {
546
546
  unitId: this._image.unitId,
547
547
  subUnitId: this._image.subUnitId,
548
548
  drawingIds: [this._image.drawingId],
549
- arrangeType: f.back
549
+ arrangeType: v.back
550
550
  });
551
551
  }
552
552
  /**
@@ -566,95 +566,113 @@ let d = class extends Y {
566
566
  unitId: this._image.unitId,
567
567
  subUnitId: this._image.subUnitId,
568
568
  drawingIds: [this._image.drawingId],
569
- arrangeType: f.front
569
+ arrangeType: v.front
570
570
  });
571
571
  }
572
572
  };
573
- d = z([
574
- E(1, P),
575
- E(2, A(x))
576
- ], d);
577
- class se extends M {
573
+ g = H([
574
+ R(1, W),
575
+ R(2, x(P))
576
+ ], g);
577
+ class se extends $ {
578
578
  addFloatDomToPosition(t, e) {
579
- const r = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), { key: s, disposableCollection: a } = Z(t, this._injector.get(ee)), c = this._injector.get(K).addFloatDomToPosition({ ...t, componentKey: s, unitId: r, subUnitId: n }, e);
580
- return c ? (a.add(c.dispose), {
581
- id: c.id,
579
+ const i = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), { key: s, disposableCollection: o } = E(t, this._injector.get(y)), a = this._injector.get(G).addFloatDomToPosition({ ...t, componentKey: s, unitId: i, subUnitId: n }, e);
580
+ return a ? (o.add(a.dispose), {
581
+ id: a.id,
582
582
  dispose: () => {
583
- a.dispose(), c.dispose();
583
+ o.dispose(), a.dispose();
584
+ }
585
+ }) : (o.dispose(), null);
586
+ }
587
+ addFloatDomToRange(t, e, i, n) {
588
+ const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), { key: c, disposableCollection: a } = E(e, this._injector.get(y)), d = this._injector.get(G).addFloatDomToRange(t.getRange(), { ...e, componentKey: c, unitId: s, subUnitId: o }, i, n);
589
+ return d ? (a.add(d.dispose), {
590
+ id: d.id,
591
+ dispose: () => {
592
+ a.dispose(), d.dispose();
593
+ }
594
+ }) : (a.dispose(), null);
595
+ }
596
+ addFloatDomToColumnHeader(t, e, i, n) {
597
+ const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), { key: c, disposableCollection: a } = E(e, this._injector.get(y)), d = this._injector.get(G).addFloatDomToColumnHeader(t, { ...e, componentKey: c, unitId: s, subUnitId: o }, i, n);
598
+ return d ? (a.add(d.dispose), {
599
+ id: d.id,
600
+ dispose: () => {
601
+ a.dispose(), d.dispose();
584
602
  }
585
603
  }) : (a.dispose(), null);
586
604
  }
587
- async insertImage(t, e, r, n, s) {
588
- const a = this.newOverGridImage();
605
+ async insertImage(t, e, i, n, s) {
606
+ const o = this.newOverGridImage();
589
607
  if (typeof t == "string")
590
- a.setSource(t);
608
+ o.setSource(t);
591
609
  else {
592
- const m = await t.getBlob().getDataAsString();
593
- a.setSource(m, I.BASE64);
610
+ const h = await t.getBlob().getDataAsString();
611
+ o.setSource(h, I.BASE64);
594
612
  }
595
- e !== void 0 ? a.setColumn(e) : a.setColumn(0), r !== void 0 ? a.setRow(r) : a.setRow(0), n !== void 0 ? a.setColumnOffset(n) : a.setColumnOffset(0), s !== void 0 ? a.setRowOffset(s) : a.setRowOffset(0);
596
- const o = await a.buildAsync();
597
- return this._commandService.syncExecuteCommand(S.id, { unitId: this._fWorkbook.getId(), drawings: [o] });
613
+ e !== void 0 ? o.setColumn(e) : o.setColumn(0), i !== void 0 ? o.setRow(i) : o.setRow(0), n !== void 0 ? o.setColumnOffset(n) : o.setColumnOffset(0), s !== void 0 ? o.setRowOffset(s) : o.setRowOffset(0);
614
+ const c = await o.buildAsync();
615
+ return this._commandService.syncExecuteCommand(S.id, { unitId: this._fWorkbook.getId(), drawings: [c] });
598
616
  }
599
617
  insertImages(t) {
600
- const e = t.map((r) => (r.unitId = this._fWorkbook.getId(), r.subUnitId = this.getSheetId(), r));
618
+ const e = t.map((i) => (i.unitId = this._fWorkbook.getId(), i.subUnitId = this.getSheetId(), i));
601
619
  return this._commandService.syncExecuteCommand(S.id, { unitId: this._fWorkbook.getId(), drawings: e }), this;
602
620
  }
603
621
  deleteImages(t) {
604
- const e = t.map((r) => ({
622
+ const e = t.map((i) => ({
605
623
  unitId: this._fWorkbook.getId(),
606
- drawingId: r.getId(),
624
+ drawingId: i.getId(),
607
625
  subUnitId: this.getSheetId(),
608
- drawingType: r.getType()
626
+ drawingType: i.getType()
609
627
  }));
610
- return this._commandService.syncExecuteCommand(G.id, { unitId: this._fWorkbook.getId(), drawings: e }), this;
628
+ return this._commandService.syncExecuteCommand(D.id, { unitId: this._fWorkbook.getId(), drawings: e }), this;
611
629
  }
612
630
  getImages() {
613
- const e = this._injector.get(h).getDrawingData(this._fWorkbook.getId(), this.getSheetId()), r = [];
631
+ const e = this._injector.get(u).getDrawingData(this._fWorkbook.getId(), this.getSheetId()), i = [];
614
632
  for (const n in e) {
615
633
  const s = e[n];
616
- s.drawingType === _.DRAWING_IMAGE && r.push(this._injector.createInstance(d, s));
634
+ s.drawingType === _.DRAWING_IMAGE && i.push(this._injector.createInstance(g, s));
617
635
  }
618
- return r;
636
+ return i;
619
637
  }
620
638
  getImageById(t) {
621
- const r = this._injector.get(h).getDrawingByParam({ unitId: this._fWorkbook.getId(), subUnitId: this.getSheetId(), drawingId: t });
622
- return r && r.drawingType === _.DRAWING_IMAGE ? this._injector.createInstance(d, r) : null;
639
+ const i = this._injector.get(u).getDrawingByParam({ unitId: this._fWorkbook.getId(), subUnitId: this.getSheetId(), drawingId: t });
640
+ return i && i.drawingType === _.DRAWING_IMAGE ? this._injector.createInstance(g, i) : null;
623
641
  }
624
642
  getActiveImages() {
625
- const e = this._injector.get(h).getFocusDrawings(), r = [];
643
+ const e = this._injector.get(u).getFocusDrawings(), i = [];
626
644
  for (const n in e) {
627
645
  const s = e[n];
628
- r.push(this._injector.createInstance(d, s));
646
+ i.push(this._injector.createInstance(g, s));
629
647
  }
630
- return r;
648
+ return i;
631
649
  }
632
650
  updateImages(t) {
633
- return this._commandService.syncExecuteCommand(g.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
651
+ return this._commandService.syncExecuteCommand(m.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
634
652
  }
635
653
  onImageInserted(t) {
636
- const e = this._injector.get(h);
637
- return C(e.add$.subscribe((r) => {
638
- const n = r.map(
639
- (s) => this._injector.createInstance(d, e.getDrawingByParam(s))
654
+ const e = this._injector.get(u);
655
+ return C(e.add$.subscribe((i) => {
656
+ const n = i.map(
657
+ (s) => this._injector.createInstance(g, e.getDrawingByParam(s))
640
658
  );
641
659
  t(n);
642
660
  }));
643
661
  }
644
662
  onImageDeleted(t) {
645
- const e = this._injector.get(h);
646
- return C(e.remove$.subscribe((r) => {
647
- const n = r.map(
648
- (s) => this._injector.createInstance(d, e.getDrawingByParam(s))
663
+ const e = this._injector.get(u);
664
+ return C(e.remove$.subscribe((i) => {
665
+ const n = i.map(
666
+ (s) => this._injector.createInstance(g, e.getDrawingByParam(s))
649
667
  );
650
668
  t(n);
651
669
  }));
652
670
  }
653
671
  onImageChanged(t) {
654
- const e = this._injector.get(h);
655
- return C(e.update$.subscribe((r) => {
656
- const n = r.map(
657
- (s) => this._injector.createInstance(d, e.getDrawingByParam(s))
672
+ const e = this._injector.get(u);
673
+ return C(e.update$.subscribe((i) => {
674
+ const n = i.map(
675
+ (s) => this._injector.createInstance(g, e.getDrawingByParam(s))
658
676
  );
659
677
  t(n);
660
678
  }));
@@ -664,8 +682,8 @@ class se extends M {
664
682
  return this._injector.createInstance(b, t, e);
665
683
  }
666
684
  }
667
- M.extend(se);
668
- class ae extends F {
685
+ $.extend(se);
686
+ class oe extends M {
669
687
  get DrawingType() {
670
688
  return _;
671
689
  }
@@ -673,11 +691,11 @@ class ae extends F {
673
691
  return I;
674
692
  }
675
693
  get SheetDrawingAnchorType() {
676
- return Q;
694
+ return ee;
677
695
  }
678
696
  }
679
- F.extend(ae);
680
- class oe extends W {
697
+ M.extend(oe);
698
+ class ae extends z {
681
699
  get BeforeOverGridImageChange() {
682
700
  return "BeforeOverGridImageChange";
683
701
  }
@@ -703,38 +721,38 @@ class oe extends W {
703
721
  return "OverGridImageSelected";
704
722
  }
705
723
  }
706
- W.extend(oe);
707
- class ce extends U {
724
+ z.extend(ae);
725
+ class ce extends N {
708
726
  _initialize(t) {
709
- const e = t.get(P);
710
- this.disposeWithMe(e.beforeCommandExecuted((r) => {
711
- switch (r.id) {
727
+ const e = t.get(W);
728
+ this.disposeWithMe(e.beforeCommandExecuted((i) => {
729
+ switch (i.id) {
712
730
  case S.id:
713
- this._beforeOverGridImageInsert(r.params);
731
+ this._beforeOverGridImageInsert(i.params);
714
732
  break;
715
- case G.id:
716
- this._beforeOverGridImageRemove(r.params);
733
+ case D.id:
734
+ this._beforeOverGridImageRemove(i.params);
717
735
  break;
718
- case g.id:
719
- this._beforeOverGridImageChange(r.params);
736
+ case m.id:
737
+ this._beforeOverGridImageChange(i.params);
720
738
  break;
721
- case B.id:
722
- this._beforeOverGridImageSelect(r.params);
739
+ case A.id:
740
+ this._beforeOverGridImageSelect(i.params);
723
741
  break;
724
742
  }
725
- })), this.disposeWithMe(e.onCommandExecuted((r) => {
726
- switch (r.id) {
743
+ })), this.disposeWithMe(e.onCommandExecuted((i) => {
744
+ switch (i.id) {
727
745
  case S.id:
728
- this._overGridImageInserted(r.params);
746
+ this._overGridImageInserted(i.params);
729
747
  break;
730
- case G.id:
731
- this._overGridImageRemoved(r.params);
748
+ case D.id:
749
+ this._overGridImageRemoved(i.params);
732
750
  break;
733
- case g.id:
734
- this._overGridImageChanged(r.params);
751
+ case m.id:
752
+ this._overGridImageChanged(i.params);
735
753
  break;
736
- case B.id:
737
- this._overGridImageSelected(r.params);
754
+ case A.id:
755
+ this._overGridImageSelected(i.params);
738
756
  break;
739
757
  }
740
758
  }));
@@ -745,9 +763,9 @@ class ce extends U {
745
763
  const e = this.getActiveWorkbook();
746
764
  if (e == null || t == null)
747
765
  return;
748
- const { drawings: r } = t, n = {
766
+ const { drawings: i } = t, n = {
749
767
  workbook: e,
750
- insertImageParams: r
768
+ insertImageParams: i
751
769
  };
752
770
  if (this.fireEvent(this.Event.BeforeOverGridImageInsert, n), n.cancel)
753
771
  throw new Error("Canceled by BeforeOverGridImageInsert event");
@@ -758,10 +776,10 @@ class ce extends U {
758
776
  const e = this.getActiveWorkbook();
759
777
  if (e == null || t == null)
760
778
  return;
761
- const { drawings: r } = t;
779
+ const { drawings: i } = t;
762
780
  this.fireEvent(this.Event.OverGridImageInserted, {
763
781
  workbook: e,
764
- images: this._createFOverGridImage(r)
782
+ images: this._createFOverGridImage(i)
765
783
  });
766
784
  }
767
785
  _beforeOverGridImageRemove(t) {
@@ -770,11 +788,11 @@ class ce extends U {
770
788
  const e = this.getActiveWorkbook();
771
789
  if (e == null || t == null)
772
790
  return;
773
- const { drawings: r } = t, n = this._injector.get(u), s = r.map((o) => n.getDrawingByParam(o)), a = {
791
+ const { drawings: i } = t, n = this._injector.get(l), s = i.map((c) => n.getDrawingByParam(c)), o = {
774
792
  workbook: e,
775
793
  images: this._createFOverGridImage(s)
776
794
  };
777
- if (this.fireEvent(this.Event.BeforeOverGridImageRemove, a), a.cancel)
795
+ if (this.fireEvent(this.Event.BeforeOverGridImageRemove, o), o.cancel)
778
796
  throw new Error("Canceled by BeforeOverGridImageRemove event");
779
797
  }
780
798
  _overGridImageRemoved(t) {
@@ -783,10 +801,10 @@ class ce extends U {
783
801
  const e = this.getActiveWorkbook();
784
802
  if (e == null || t == null)
785
803
  return;
786
- const { drawings: r } = t;
804
+ const { drawings: i } = t;
787
805
  this.fireEvent(this.Event.OverGridImageRemoved, {
788
806
  workbook: e,
789
- removeImageParams: r
807
+ removeImageParams: i
790
808
  });
791
809
  }
792
810
  _beforeOverGridImageChange(t) {
@@ -795,20 +813,20 @@ class ce extends U {
795
813
  const e = this.getActiveWorkbook();
796
814
  if (e == null || t == null)
797
815
  return;
798
- const { drawings: r } = t, n = this._injector.get(u), s = [];
799
- r.forEach((o) => {
800
- const c = n.getDrawingByParam(o);
801
- c != null && s.push({
802
- changeParam: o,
803
- image: this._injector.createInstance(d, c)
816
+ const { drawings: i } = t, n = this._injector.get(l), s = [];
817
+ i.forEach((c) => {
818
+ const a = n.getDrawingByParam(c);
819
+ a != null && s.push({
820
+ changeParam: c,
821
+ image: this._injector.createInstance(g, a)
804
822
  });
805
823
  });
806
- const a = {
824
+ const o = {
807
825
  workbook: e,
808
826
  images: s
809
827
  };
810
- if (this.fireEvent(this.Event.BeforeOverGridImageChange, a), a.cancel)
811
- throw n.updateNotification(r), new Error("Canceled by BeforeOverGridImageChange event");
828
+ if (this.fireEvent(this.Event.BeforeOverGridImageChange, o), o.cancel)
829
+ throw n.updateNotification(i), new Error("Canceled by BeforeOverGridImageChange event");
812
830
  }
813
831
  _overGridImageChanged(t) {
814
832
  if (!this.hasEventCallback(this.Event.OverGridImageChanged))
@@ -816,7 +834,7 @@ class ce extends U {
816
834
  const e = this.getActiveWorkbook();
817
835
  if (e == null || t == null)
818
836
  return;
819
- const { drawings: r } = t, n = this._injector.get(u), s = r.map((a) => this._injector.createInstance(d, n.getDrawingByParam(a)));
837
+ const { drawings: i } = t, n = this._injector.get(l), s = i.map((o) => this._injector.createInstance(g, n.getDrawingByParam(o)));
820
838
  this.fireEvent(this.Event.OverGridImageChanged, {
821
839
  workbook: e,
822
840
  images: s
@@ -825,31 +843,31 @@ class ce extends U {
825
843
  _beforeOverGridImageSelect(t) {
826
844
  if (!this.hasEventCallback(this.Event.BeforeOverGridImageSelect))
827
845
  return;
828
- const e = this._injector.get(u), r = this.getActiveWorkbook();
829
- if (r == null)
846
+ const e = this._injector.get(l), i = this.getActiveWorkbook();
847
+ if (i == null)
830
848
  return;
831
- const n = e.getFocusDrawings(), s = t.map((o) => e.getDrawingByParam(o)), a = {
832
- workbook: r,
849
+ const n = e.getFocusDrawings(), s = t.map((c) => e.getDrawingByParam(c)), o = {
850
+ workbook: i,
833
851
  selectedImages: this._createFOverGridImage(s),
834
852
  oldSelectedImages: this._createFOverGridImage(n)
835
853
  };
836
- if (this.fireEvent(this.Event.BeforeOverGridImageSelect, a), a.cancel)
854
+ if (this.fireEvent(this.Event.BeforeOverGridImageSelect, o), o.cancel)
837
855
  throw new Error("Canceled by BeforeOverGridImageSelect event");
838
856
  }
839
857
  _overGridImageSelected(t) {
840
858
  if (!this.hasEventCallback(this.Event.OverGridImageSelected))
841
859
  return;
842
- const e = this.getActiveWorkbook(), r = this._injector.get(u);
860
+ const e = this.getActiveWorkbook(), i = this._injector.get(l);
843
861
  if (e == null)
844
862
  return;
845
- const n = t.map((s) => r.getDrawingByParam(s));
863
+ const n = t.map((s) => i.getDrawingByParam(s));
846
864
  this.fireEvent(this.Event.OverGridImageSelected, {
847
865
  workbook: e,
848
866
  selectedImages: this._createFOverGridImage(n)
849
867
  });
850
868
  }
851
869
  _createFOverGridImage(t) {
852
- return t.map((e) => this._injector.createInstance(d, e));
870
+ return t.map((e) => this._injector.createInstance(g, e));
853
871
  }
854
872
  }
855
- U.extend(ce);
873
+ N.extend(ce);