@univerjs/sheets-drawing-ui 0.12.3 → 0.12.4

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.
Files changed (65) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +2 -2
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fa-IR.js +1 -1
  7. package/lib/cjs/locale/fr-FR.js +1 -1
  8. package/lib/cjs/locale/ja-JP.js +1 -1
  9. package/lib/cjs/locale/ko-KR.js +1 -1
  10. package/lib/cjs/locale/ru-RU.js +1 -1
  11. package/lib/cjs/locale/vi-VN.js +1 -1
  12. package/lib/cjs/locale/zh-CN.js +1 -1
  13. package/lib/cjs/locale/zh-TW.js +1 -1
  14. package/lib/es/facade.js +439 -395
  15. package/lib/es/index.js +1786 -1234
  16. package/lib/es/locale/ca-ES.js +15 -2
  17. package/lib/es/locale/en-US.js +13 -0
  18. package/lib/es/locale/es-ES.js +13 -0
  19. package/lib/es/locale/fa-IR.js +13 -0
  20. package/lib/es/locale/fr-FR.js +13 -0
  21. package/lib/es/locale/ja-JP.js +13 -0
  22. package/lib/es/locale/ko-KR.js +13 -0
  23. package/lib/es/locale/ru-RU.js +13 -0
  24. package/lib/es/locale/vi-VN.js +13 -0
  25. package/lib/es/locale/zh-CN.js +13 -0
  26. package/lib/es/locale/zh-TW.js +17 -4
  27. package/lib/facade.js +439 -395
  28. package/lib/index.css +1 -1
  29. package/lib/index.js +1786 -1234
  30. package/lib/locale/ca-ES.js +15 -2
  31. package/lib/locale/en-US.js +13 -0
  32. package/lib/locale/es-ES.js +13 -0
  33. package/lib/locale/fa-IR.js +13 -0
  34. package/lib/locale/fr-FR.js +13 -0
  35. package/lib/locale/ja-JP.js +13 -0
  36. package/lib/locale/ko-KR.js +13 -0
  37. package/lib/locale/ru-RU.js +13 -0
  38. package/lib/locale/vi-VN.js +13 -0
  39. package/lib/locale/zh-CN.js +13 -0
  40. package/lib/locale/zh-TW.js +17 -4
  41. package/lib/types/commands/commands/save-cell-images.command.d.ts +2 -0
  42. package/lib/types/facade/f-range.d.ts +40 -0
  43. package/lib/types/facade/f-worksheet.d.ts +29 -0
  44. package/lib/types/index.d.ts +3 -1
  45. package/lib/types/locale/en-US.d.ts +13 -0
  46. package/lib/types/services/batch-save-images.service.d.ts +148 -0
  47. package/lib/types/services/canvas-float-dom-manager.service.d.ts +2 -0
  48. package/lib/types/views/batch-save-images/BatchSaveImagesDialog.d.ts +16 -0
  49. package/lib/types/views/batch-save-images/component-name.d.ts +16 -0
  50. package/lib/types/views/batch-save-images/index.d.ts +17 -0
  51. package/lib/types/views/menu/save-images.menu.d.ts +4 -0
  52. package/lib/umd/facade.js +1 -1
  53. package/lib/umd/index.js +2 -2
  54. package/lib/umd/locale/ca-ES.js +1 -1
  55. package/lib/umd/locale/en-US.js +1 -1
  56. package/lib/umd/locale/es-ES.js +1 -1
  57. package/lib/umd/locale/fa-IR.js +1 -1
  58. package/lib/umd/locale/fr-FR.js +1 -1
  59. package/lib/umd/locale/ja-JP.js +1 -1
  60. package/lib/umd/locale/ko-KR.js +1 -1
  61. package/lib/umd/locale/ru-RU.js +1 -1
  62. package/lib/umd/locale/vi-VN.js +1 -1
  63. package/lib/umd/locale/zh-CN.js +1 -1
  64. package/lib/umd/locale/zh-TW.js +1 -1
  65. package/package.json +16 -15
package/lib/es/facade.js CHANGED
@@ -1,66 +1,66 @@
1
- var q = Object.defineProperty;
2
- var J = (o, r, t) => r in o ? q(o, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[r] = t;
3
- var P = (o, r, t) => J(o, typeof r != "symbol" ? r + "" : r, t);
4
- import { Inject as H, Injector as K, ICommandService as N, ImageSourceType as E, ArrangeTypeEnum as C, DrawingTypeEnum as I, generateRandomId as Q, toDisposable as T, CanceledError as S, UniverInstanceType as Z, IUniverInstanceService as ee } from "@univerjs/core";
5
- import { FBase as te, FEnum as z, FEventName as X, FUniver as Y } from "@univerjs/core/facade";
6
- import { getImageSize as re, IDrawingManagerService as p, SetDrawingSelectedOperation as W } from "@univerjs/drawing";
7
- import { IRenderManagerService as y, getCurrentTypeOfRenderer as ie } from "@univerjs/engine-render";
8
- import { RemoveSheetDrawingCommand as k, SetSheetDrawingCommand as f, SetDrawingArrangeCommand as R, SheetCanvasFloatDomManagerService as D, transformToDrawingPosition as j, InsertSheetDrawingCommand as b, SheetDrawingUpdateController as ne } from "@univerjs/sheets-drawing-ui";
9
- import { SheetSkeletonManagerService as M, ISheetSelectionRenderService as A, convertPositionSheetOverGridToAbsolute as oe, convertPositionCellToSheetOverGrid as se } from "@univerjs/sheets-ui";
10
- import { ISheetDrawingService as w, SheetDrawingAnchorType as ae } from "@univerjs/sheets-drawing";
1
+ var Q = Object.defineProperty;
2
+ var Z = (s, t, r) => t in s ? Q(s, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[t] = r;
3
+ var W = (s, t, r) => Z(s, typeof t != "symbol" ? t + "" : t, r);
4
+ import { Inject as N, Injector as L, ICommandService as K, ImageSourceType as y, ArrangeTypeEnum as O, DrawingTypeEnum as v, generateRandomId as ee, toDisposable as T, CanceledError as D, UniverInstanceType as te, IUniverInstanceService as re } from "@univerjs/core";
5
+ import { FBase as ne, FEnum as z, FEventName as X, FUniver as Y } from "@univerjs/core/facade";
6
+ import { getImageSize as ie, IDrawingManagerService as S, SetDrawingSelectedOperation as j } from "@univerjs/drawing";
7
+ import { IRenderManagerService as C, getCurrentTypeOfRenderer as se } from "@univerjs/engine-render";
8
+ import { RemoveSheetDrawingCommand as k, SetSheetDrawingCommand as f, SetDrawingArrangeCommand as F, SheetCanvasFloatDomManagerService as p, transformToDrawingPosition as M, InsertSheetDrawingCommand as E, IBatchSaveImagesService as V, FileNamePart as b, SheetDrawingUpdateController as oe } from "@univerjs/sheets-drawing-ui";
9
+ import { SheetSkeletonManagerService as H, ISheetSelectionRenderService as x, convertPositionSheetOverGridToAbsolute as ae, convertPositionCellToSheetOverGrid as de } from "@univerjs/sheets-ui";
10
+ import { ISheetDrawingService as w, SheetDrawingAnchorType as ce } from "@univerjs/sheets-drawing";
11
11
  import { transformComponentKey as U } from "@univerjs/sheets-ui/facade";
12
- import { FWorksheet as $, FRange as L } from "@univerjs/sheets/facade";
12
+ import { FWorksheet as $, FRange as q } from "@univerjs/sheets/facade";
13
13
  import { ComponentManager as G } from "@univerjs/ui";
14
- var de = Object.getOwnPropertyDescriptor, V = (o, r, t, e) => {
15
- for (var i = e > 1 ? void 0 : e ? de(r, t) : r, n = o.length - 1, s; n >= 0; n--)
16
- (s = o[n]) && (i = s(i) || i);
17
- return i;
18
- }, x = (o, r) => (t, e) => r(t, e, o);
19
- function ce(o, r) {
20
- const { from: t, to: e, flipY: i = !1, flipX: n = !1, angle: s = 0, skewX: a = 0, skewY: d = 0 } = o.sheetTransform, { column: g, columnOffset: c, row: m, rowOffset: l } = t, _ = oe(
21
- o.unitId,
22
- o.subUnitId,
23
- { from: t, to: e },
24
- r
25
- ), { width: h, height: u } = _;
14
+ var ge = Object.getOwnPropertyDescriptor, J = (s, t, r, e) => {
15
+ for (var n = e > 1 ? void 0 : e ? ge(t, r) : t, i = s.length - 1, a; i >= 0; i--)
16
+ (a = s[i]) && (n = a(n) || n);
17
+ return n;
18
+ }, P = (s, t) => (r, e) => t(r, e, s);
19
+ function me(s, t) {
20
+ const { from: r, to: e, flipY: n = !1, flipX: i = !1, angle: a = 0, skewX: o = 0, skewY: d = 0 } = s.sheetTransform, { column: g, columnOffset: c, row: m, rowOffset: h } = r, _ = ae(
21
+ s.unitId,
22
+ s.subUnitId,
23
+ { from: r, to: e },
24
+ t
25
+ ), { width: l, height: u } = _;
26
26
  return {
27
- ...o,
27
+ ...s,
28
28
  column: g,
29
29
  columnOffset: c,
30
30
  row: m,
31
- rowOffset: l,
32
- width: h,
31
+ rowOffset: h,
32
+ width: l,
33
33
  height: u,
34
- flipY: i,
35
- flipX: n,
36
- angle: s,
37
- skewX: a,
34
+ flipY: n,
35
+ flipX: i,
36
+ angle: a,
37
+ skewX: o,
38
38
  skewY: d
39
39
  };
40
40
  }
41
- function ge(o, r, t) {
42
- const { column: e, columnOffset: i, row: n, rowOffset: s, flipY: a = !1, flipX: d = !1, angle: g = 0, skewX: c = 0, skewY: m = 0, width: l, height: _ } = o, h = se(
43
- o.unitId,
44
- o.subUnitId,
45
- { column: e, columnOffset: i, row: n, rowOffset: s },
46
- l,
41
+ function he(s, t, r) {
42
+ const { column: e, columnOffset: n, row: i, rowOffset: a, flipY: o = !1, flipX: d = !1, angle: g = 0, skewX: c = 0, skewY: m = 0, width: h, height: _ } = s, l = de(
43
+ s.unitId,
44
+ s.subUnitId,
45
+ { column: e, columnOffset: n, row: i, rowOffset: a },
46
+ h,
47
47
  _,
48
- r,
49
- t
50
- ), { sheetTransform: u, transform: B } = h;
48
+ t,
49
+ r
50
+ ), { sheetTransform: u, transform: A } = l;
51
51
  return {
52
- ...o,
52
+ ...s,
53
53
  sheetTransform: {
54
54
  ...u,
55
- flipY: a,
55
+ flipY: o,
56
56
  flipX: d,
57
57
  angle: g,
58
58
  skewX: c,
59
59
  skewY: m
60
60
  },
61
61
  transform: {
62
- ...B,
63
- flipY: a,
62
+ ...A,
63
+ flipY: o,
64
64
  flipX: d,
65
65
  angle: g,
66
66
  skewX: c,
@@ -68,16 +68,16 @@ function ge(o, r, t) {
68
68
  }
69
69
  };
70
70
  }
71
- let F = class {
72
- constructor(o, r, t) {
73
- P(this, "_image");
74
- this._injector = t, this._image = {
75
- drawingId: Q(6),
76
- drawingType: I.DRAWING_IMAGE,
77
- imageSourceType: E.BASE64,
71
+ let B = class {
72
+ constructor(s, t, r) {
73
+ W(this, "_image");
74
+ this._injector = r, this._image = {
75
+ drawingId: ee(6),
76
+ drawingType: v.DRAWING_IMAGE,
77
+ imageSourceType: y.BASE64,
78
78
  source: "",
79
- unitId: o,
80
- subUnitId: r,
79
+ unitId: s,
80
+ subUnitId: t,
81
81
  column: 0,
82
82
  columnOffset: 0,
83
83
  row: 0,
@@ -111,12 +111,12 @@ let F = class {
111
111
  * fWorksheet.insertImages([image]);
112
112
  * ```
113
113
  */
114
- setImage(o) {
115
- const t = this._injector.get(y).getRenderById(o.unitId);
116
- if (!t)
117
- throw new Error(`Render Unit with unitId ${o.unitId} not found`);
118
- const e = t.with(M);
119
- return o.sheetTransform == null && (o.sheetTransform = {
114
+ setImage(s) {
115
+ const r = this._injector.get(C).getRenderById(s.unitId);
116
+ if (!r)
117
+ throw new Error(`Render Unit with unitId ${s.unitId} not found`);
118
+ const e = r.with(H);
119
+ return s.sheetTransform == null && (s.sheetTransform = {
120
120
  from: {
121
121
  column: 0,
122
122
  columnOffset: 0,
@@ -129,11 +129,11 @@ let F = class {
129
129
  row: 0,
130
130
  rowOffset: 0
131
131
  }
132
- }), this._image = ce(o, e), this;
132
+ }), this._image = me(s, e), this;
133
133
  }
134
- setSource(o, r) {
135
- const t = r != null ? r : E.URL;
136
- return this._image.source = o, this._image.imageSourceType = t, this;
134
+ setSource(s, t) {
135
+ const r = t != null ? t : y.URL;
136
+ return this._image.source = s, this._image.imageSourceType = r, this;
137
137
  }
138
138
  /**
139
139
  * Get the source of the image
@@ -185,8 +185,8 @@ let F = class {
185
185
  * fWorksheet.insertImages([image]);
186
186
  * ```
187
187
  */
188
- setColumn(o) {
189
- return this._image.column = o, this;
188
+ setColumn(s) {
189
+ return this._image.column = s, this;
190
190
  }
191
191
  /**
192
192
  * Set the vertical position of the image
@@ -206,8 +206,8 @@ let F = class {
206
206
  * fWorksheet.insertImages([image]);
207
207
  * ```
208
208
  */
209
- setRow(o) {
210
- return this._image.row = o, this;
209
+ setRow(s) {
210
+ return this._image.row = s, this;
211
211
  }
212
212
  /**
213
213
  * Set the horizontal offset of the image
@@ -228,8 +228,8 @@ let F = class {
228
228
  * fWorksheet.insertImages([image]);
229
229
  * ```
230
230
  */
231
- setColumnOffset(o) {
232
- return this._image.columnOffset = o, this;
231
+ setColumnOffset(s) {
232
+ return this._image.columnOffset = s, this;
233
233
  }
234
234
  /**
235
235
  * Set the vertical offset of the image
@@ -250,8 +250,8 @@ let F = class {
250
250
  * fWorksheet.insertImages([image]);
251
251
  * ```
252
252
  */
253
- setRowOffset(o) {
254
- return this._image.rowOffset = o, this;
253
+ setRowOffset(s) {
254
+ return this._image.rowOffset = s, this;
255
255
  }
256
256
  /**
257
257
  * Set the width of the image
@@ -273,8 +273,8 @@ let F = class {
273
273
  * fWorksheet.insertImages([image]);
274
274
  * ```
275
275
  */
276
- setWidth(o) {
277
- return this._image.width = o, this;
276
+ setWidth(s) {
277
+ return this._image.width = s, this;
278
278
  }
279
279
  /**
280
280
  * Set the height of the image
@@ -296,8 +296,8 @@ let F = class {
296
296
  * fWorksheet.insertImages([image]);
297
297
  * ```
298
298
  */
299
- setHeight(o) {
300
- return this._image.height = o, this;
299
+ setHeight(s) {
300
+ return this._image.height = s, this;
301
301
  }
302
302
  /**
303
303
  * Set the anchor type of the image, whether the position and size change with the cell
@@ -345,8 +345,8 @@ let F = class {
345
345
  * }, 2000);
346
346
  * ```
347
347
  */
348
- setAnchorType(o) {
349
- return this._image.anchorType = o, this;
348
+ setAnchorType(s) {
349
+ return this._image.anchorType = s, this;
350
350
  }
351
351
  /**
352
352
  * Set the cropping region of the image by defining the top edges, thereby displaying the specific part of the image you want.
@@ -367,8 +367,8 @@ let F = class {
367
367
  * fWorksheet.insertImages([image]);
368
368
  * ```
369
369
  */
370
- setCropTop(o) {
371
- return this._initializeSrcRect(), this._image.srcRect.top = o, this;
370
+ setCropTop(s) {
371
+ return this._initializeSrcRect(), this._image.srcRect.top = s, this;
372
372
  }
373
373
  /**
374
374
  * Set the cropping region of the image by defining the left edges, thereby displaying the specific part of the image you want.
@@ -389,8 +389,8 @@ let F = class {
389
389
  * fWorksheet.insertImages([image]);
390
390
  * ```
391
391
  */
392
- setCropLeft(o) {
393
- return this._initializeSrcRect(), this._image.srcRect.left = o, this;
392
+ setCropLeft(s) {
393
+ return this._initializeSrcRect(), this._image.srcRect.left = s, this;
394
394
  }
395
395
  /**
396
396
  * Set the cropping region of the image by defining the bottom edges, thereby displaying the specific part of the image you want.
@@ -411,8 +411,8 @@ let F = class {
411
411
  * fWorksheet.insertImages([image]);
412
412
  * ```
413
413
  */
414
- setCropBottom(o) {
415
- return this._initializeSrcRect(), this._image.srcRect.bottom = o, this;
414
+ setCropBottom(s) {
415
+ return this._initializeSrcRect(), this._image.srcRect.bottom = s, this;
416
416
  }
417
417
  /**
418
418
  * Set the cropping region of the image by defining the right edges, thereby displaying the specific part of the image you want.
@@ -433,8 +433,8 @@ let F = class {
433
433
  * fWorksheet.insertImages([image]);
434
434
  * ```
435
435
  */
436
- setCropRight(o) {
437
- return this._initializeSrcRect(), this._image.srcRect.right = o, this;
436
+ setCropRight(s) {
437
+ return this._initializeSrcRect(), this._image.srcRect.right = s, this;
438
438
  }
439
439
  _initializeSrcRect() {
440
440
  this._image.srcRect == null && (this._image.srcRect = {
@@ -463,33 +463,33 @@ let F = class {
463
463
  * fWorksheet.insertImages([image]);
464
464
  * ```
465
465
  */
466
- setRotate(o) {
467
- return this._image.angle = o, this;
466
+ setRotate(s) {
467
+ return this._image.angle = s, this;
468
468
  }
469
- setUnitId(o) {
470
- return this._image.unitId = o, this;
469
+ setUnitId(s) {
470
+ return this._image.unitId = s, this;
471
471
  }
472
- setSubUnitId(o) {
473
- return this._image.subUnitId = o, this;
472
+ setSubUnitId(s) {
473
+ return this._image.subUnitId = s, this;
474
474
  }
475
475
  async buildAsync() {
476
- const r = this._injector.get(y).getRenderById(this._image.unitId);
477
- if (!r)
476
+ const t = this._injector.get(C).getRenderById(this._image.unitId);
477
+ if (!t)
478
478
  throw new Error(`Render Unit with unitId ${this._image.unitId} not found`);
479
- const t = r.with(A), e = r.with(M);
479
+ const r = t.with(x), e = t.with(H);
480
480
  if (this._image.width === 0 || this._image.height === 0) {
481
- const i = await re(this._image.source), n = i.width, s = i.height;
482
- this._image.width === 0 && (this._image.width = n), this._image.height === 0 && (this._image.height = s);
481
+ const n = await ie(this._image.source), i = n.width, a = n.height;
482
+ this._image.width === 0 && (this._image.width = i), this._image.height === 0 && (this._image.height = a);
483
483
  }
484
- return ge(this._image, t, e);
484
+ return he(this._image, r, e);
485
485
  }
486
486
  };
487
- F = V([
488
- x(2, H(K))
489
- ], F);
490
- let v = class extends te {
491
- constructor(o, r, t) {
492
- super(), this._image = o, this._commandService = r, this._injector = t;
487
+ B = J([
488
+ P(2, N(L))
489
+ ], B);
490
+ let I = class extends ne {
491
+ constructor(s, t, r) {
492
+ super(), this._image = s, this._commandService = t, this._injector = r;
493
493
  }
494
494
  /**
495
495
  * Get the id of the image
@@ -552,18 +552,18 @@ let v = class extends te {
552
552
  * ```
553
553
  */
554
554
  toBuilder() {
555
- const o = this._injector.createInstance(F);
556
- return o.setImage(this._image), o;
555
+ const s = this._injector.createInstance(B);
556
+ return s.setImage(this._image), s;
557
557
  }
558
- setSource(o, r) {
559
- const t = r != null ? r : E.URL;
560
- return this._image.source = o, this._image.imageSourceType = t, this._commandService.syncExecuteCommand(f.id, { unitId: this._image.unitId, drawings: [this._image] });
558
+ setSource(s, t) {
559
+ const r = t != null ? t : y.URL;
560
+ return this._image.source = s, this._image.imageSourceType = r, this._commandService.syncExecuteCommand(f.id, { unitId: this._image.unitId, drawings: [this._image] });
561
561
  }
562
- async setPositionAsync(o, r, t, e) {
563
- const i = this.toBuilder();
564
- i.setColumn(r), i.setRow(o), t != null && i.setRowOffset(t), e != null && i.setColumnOffset(e);
565
- const n = await i.buildAsync();
566
- return this._commandService.syncExecuteCommand(f.id, { unitId: this._image.unitId, drawings: [n] });
562
+ async setPositionAsync(s, t, r, e) {
563
+ const n = this.toBuilder();
564
+ n.setColumn(t), n.setRow(s), r != null && n.setRowOffset(r), e != null && n.setColumnOffset(e);
565
+ const i = await n.buildAsync();
566
+ return this._commandService.syncExecuteCommand(f.id, { unitId: this._image.unitId, drawings: [i] });
567
567
  }
568
568
  /**
569
569
  * Set the size of the image
@@ -580,10 +580,10 @@ let v = class extends te {
580
580
  * console.log(result);
581
581
  * ```
582
582
  */
583
- async setSizeAsync(o, r) {
584
- const t = this.toBuilder();
585
- t.setWidth(o), t.setHeight(r);
586
- const e = await t.buildAsync();
583
+ async setSizeAsync(s, t) {
584
+ const r = this.toBuilder();
585
+ r.setWidth(s), r.setHeight(t);
586
+ const e = await r.buildAsync();
587
587
  return this._commandService.syncExecuteCommand(f.id, { unitId: this._image.unitId, drawings: [e] });
588
588
  }
589
589
  /**
@@ -603,13 +603,13 @@ let v = class extends te {
603
603
  * console.log(result);
604
604
  * ```
605
605
  */
606
- setCrop(o, r, t, e) {
606
+ setCrop(s, t, r, e) {
607
607
  return this._image.srcRect == null && (this._image.srcRect = {
608
608
  top: 0,
609
609
  left: 0,
610
610
  bottom: 0,
611
611
  right: 0
612
- }), o != null && (this._image.srcRect.top = o), r != null && (this._image.srcRect.left = r), t != null && (this._image.srcRect.bottom = t), e != null && (this._image.srcRect.right = e), this._commandService.syncExecuteCommand(f.id, { unitId: this._image.unitId, drawings: [this._image] });
612
+ }), s != null && (this._image.srcRect.top = s), t != null && (this._image.srcRect.left = t), r != null && (this._image.srcRect.bottom = r), e != null && (this._image.srcRect.right = e), this._commandService.syncExecuteCommand(f.id, { unitId: this._image.unitId, drawings: [this._image] });
613
613
  }
614
614
  /**
615
615
  * Set the rotation angle of the image
@@ -625,8 +625,8 @@ let v = class extends te {
625
625
  * console.log(result);
626
626
  * ```
627
627
  */
628
- setRotate(o) {
629
- return this._image.sheetTransform.angle = o, this._image.transform && (this._image.transform.angle = o), this._commandService.syncExecuteCommand(f.id, { unitId: this._image.unitId, drawings: [this._image] });
628
+ setRotate(s) {
629
+ return this._image.sheetTransform.angle = s, this._image.transform && (this._image.transform.angle = s), this._commandService.syncExecuteCommand(f.id, { unitId: this._image.unitId, drawings: [this._image] });
630
630
  }
631
631
  /**
632
632
  * Move the image layer forward by one level
@@ -641,11 +641,11 @@ let v = class extends te {
641
641
  * ```
642
642
  */
643
643
  setForward() {
644
- return this._commandService.syncExecuteCommand(R.id, {
644
+ return this._commandService.syncExecuteCommand(F.id, {
645
645
  unitId: this._image.unitId,
646
646
  subUnitId: this._image.subUnitId,
647
647
  drawingIds: [this._image.drawingId],
648
- arrangeType: C.forward
648
+ arrangeType: O.forward
649
649
  });
650
650
  }
651
651
  /**
@@ -661,11 +661,11 @@ let v = class extends te {
661
661
  * ```
662
662
  */
663
663
  setBackward() {
664
- return this._commandService.syncExecuteCommand(R.id, {
664
+ return this._commandService.syncExecuteCommand(F.id, {
665
665
  unitId: this._image.unitId,
666
666
  subUnitId: this._image.subUnitId,
667
667
  drawingIds: [this._image.drawingId],
668
- arrangeType: C.backward
668
+ arrangeType: O.backward
669
669
  });
670
670
  }
671
671
  /**
@@ -681,11 +681,11 @@ let v = class extends te {
681
681
  * ```
682
682
  */
683
683
  setBack() {
684
- return this._commandService.syncExecuteCommand(R.id, {
684
+ return this._commandService.syncExecuteCommand(F.id, {
685
685
  unitId: this._image.unitId,
686
686
  subUnitId: this._image.subUnitId,
687
687
  drawingIds: [this._image.drawingId],
688
- arrangeType: C.back
688
+ arrangeType: O.back
689
689
  });
690
690
  }
691
691
  /**
@@ -701,171 +701,171 @@ let v = class extends te {
701
701
  * ```
702
702
  */
703
703
  setFront() {
704
- return this._commandService.syncExecuteCommand(R.id, {
704
+ return this._commandService.syncExecuteCommand(F.id, {
705
705
  unitId: this._image.unitId,
706
706
  subUnitId: this._image.subUnitId,
707
707
  drawingIds: [this._image.drawingId],
708
- arrangeType: C.front
708
+ arrangeType: O.front
709
709
  });
710
710
  }
711
711
  };
712
- v = V([
713
- x(1, N),
714
- x(2, H(K))
715
- ], v);
716
- class me extends $ {
717
- getFloatDomById(r) {
718
- const e = this._injector.get(D).getFloatDomInfo(r);
712
+ I = J([
713
+ P(1, K),
714
+ P(2, N(L))
715
+ ], I);
716
+ class le extends $ {
717
+ getFloatDomById(t) {
718
+ const e = this._injector.get(p).getFloatDomInfo(t);
719
719
  if (!e) return null;
720
- const { unitId: i, subUnitId: n } = e, { rect: s } = e, a = s.getState(), { left: d = 0, top: g = 0, width: c = 0, height: m = 0, flipX: l = !1, flipY: _ = !1, angle: h = 0, skewX: u = 0, skewY: B = 0 } = a, O = this._injector.get(w).getDrawingByParam({
720
+ const { unitId: n, subUnitId: i } = e, { rect: a } = e, o = a.getState(), { left: d = 0, top: g = 0, width: c = 0, height: m = 0, flipX: h = !1, flipY: _ = !1, angle: l = 0, skewX: u = 0, skewY: A = 0 } = o, R = this._injector.get(w).getDrawingByParam({
721
721
  drawingId: e.id,
722
- unitId: i,
723
- subUnitId: n
722
+ unitId: n,
723
+ subUnitId: i
724
724
  });
725
- return O ? {
725
+ return R ? {
726
726
  position: {
727
727
  left: d,
728
728
  top: g,
729
729
  width: c,
730
730
  height: m,
731
- flipX: l,
731
+ flipX: h,
732
732
  flipY: _,
733
- angle: h,
733
+ angle: l,
734
734
  skewX: u,
735
- skewY: B
735
+ skewY: A
736
736
  },
737
- componentKey: O.componentKey,
738
- allowTransform: O.allowTransform,
739
- data: O.data,
737
+ componentKey: R.componentKey,
738
+ allowTransform: R.allowTransform,
739
+ data: R.data,
740
740
  id: e.id
741
741
  } : null;
742
742
  }
743
743
  getAllFloatDoms() {
744
- const r = this._injector.get(D), t = this._workbook.getUnitId(), e = this._worksheet.getSheetId();
745
- return Array.from(r.getFloatDomsBySubUnitId(t, e).values()).map((i) => {
746
- const { rect: n } = i, s = this._injector.get(w).getDrawingByParam({
747
- drawingId: i.id,
748
- unitId: t,
744
+ const t = this._injector.get(p), r = this._workbook.getUnitId(), e = this._worksheet.getSheetId();
745
+ return Array.from(t.getFloatDomsBySubUnitId(r, e).values()).map((n) => {
746
+ const { rect: i } = n, a = this._injector.get(w).getDrawingByParam({
747
+ drawingId: n.id,
748
+ unitId: r,
749
749
  subUnitId: e
750
- }), { left: a, top: d, width: g, height: c, flipX: m, flipY: l, angle: _, skewX: h, skewY: u } = n.getState();
750
+ }), { left: o, top: d, width: g, height: c, flipX: m, flipY: h, angle: _, skewX: l, skewY: u } = i.getState();
751
751
  return {
752
752
  position: {
753
- left: a,
753
+ left: o,
754
754
  top: d,
755
755
  width: g,
756
756
  height: c,
757
757
  flipX: m,
758
- flipY: l,
758
+ flipY: h,
759
759
  angle: _,
760
- skewX: h,
760
+ skewX: l,
761
761
  skewY: u
762
762
  },
763
- componentKey: s.componentKey,
764
- allowTransform: s.allowTransform,
765
- data: s.data,
766
- id: i.id
763
+ componentKey: a.componentKey,
764
+ allowTransform: a.allowTransform,
765
+ data: a.data,
766
+ id: n.id
767
767
  };
768
768
  });
769
769
  }
770
- updateFloatDom(r, t) {
771
- var h, u;
772
- const i = this._injector.get(D).getFloatDomInfo(r);
773
- if (!i) return this;
774
- const { unitId: n, subUnitId: s } = i, a = this._injector.get(w).getDrawingByParam({
775
- unitId: n,
776
- subUnitId: s,
777
- drawingId: r
778
- }), d = this._injector.get(y);
779
- if (!d.getRenderById(n)) return this;
770
+ updateFloatDom(t, r) {
771
+ var l, u;
772
+ const n = this._injector.get(p).getFloatDomInfo(t);
773
+ if (!n) return this;
774
+ const { unitId: i, subUnitId: a } = n, o = this._injector.get(w).getDrawingByParam({
775
+ unitId: i,
776
+ subUnitId: a,
777
+ drawingId: t
778
+ }), d = this._injector.get(C);
779
+ if (!d.getRenderById(i)) return this;
780
780
  if (!this.getSkeleton()) return this;
781
- const m = (h = d.getRenderById(this.getWorkbook().getUnitId())) == null ? void 0 : h.with(A);
781
+ const m = (l = d.getRenderById(this.getWorkbook().getUnitId())) == null ? void 0 : l.with(x);
782
782
  if (!m) return this;
783
- const l = {
784
- ...a,
785
- componentKey: t.componentKey || a.componentKey,
786
- allowTransform: t.allowTransform !== void 0 ? t.allowTransform : a.allowTransform,
787
- data: t.data || a.data,
788
- sheetTransform: t.position && (u = j(
789
- t.position,
783
+ const h = {
784
+ ...o,
785
+ componentKey: r.componentKey || o.componentKey,
786
+ allowTransform: r.allowTransform !== void 0 ? r.allowTransform : o.allowTransform,
787
+ data: r.data || o.data,
788
+ sheetTransform: r.position && (u = M(
789
+ r.position,
790
790
  m
791
- )) != null ? u : a.sheetTransform,
791
+ )) != null ? u : o.sheetTransform,
792
792
  transform: {
793
- ...a.transform,
794
- ...t.position
793
+ ...o.transform,
794
+ ...r.position
795
795
  // Merge with existing transform
796
796
  }
797
797
  };
798
- if (!this._commandService.syncExecuteCommand(f.id, { unitId: n, subUnitId: s, drawings: [l] }))
798
+ if (!this._commandService.syncExecuteCommand(f.id, { unitId: i, subUnitId: a, drawings: [h] }))
799
799
  throw new Error("updateFloatDom failed");
800
800
  return this;
801
801
  }
802
- batchUpdateFloatDoms(r) {
803
- var s;
804
- const t = this._injector.get(D), e = this._injector.get(w), i = this._injector.get(y), n = [];
805
- for (const a of r) {
806
- const d = t.getFloatDomInfo(a.id);
802
+ batchUpdateFloatDoms(t) {
803
+ var a;
804
+ const r = this._injector.get(p), e = this._injector.get(w), n = this._injector.get(C), i = [];
805
+ for (const o of t) {
806
+ const d = r.getFloatDomInfo(o.id);
807
807
  if (!d) continue;
808
808
  const { unitId: g, subUnitId: c } = d, m = e.getDrawingByParam({
809
809
  unitId: g,
810
810
  subUnitId: c,
811
- drawingId: a.id
811
+ drawingId: o.id
812
812
  });
813
813
  if (!m) continue;
814
- const l = i.getRenderById(g);
815
- if (!l || !this.getSkeleton()) continue;
816
- const h = l.with(A);
817
- if (!h) return this;
814
+ const h = n.getRenderById(g);
815
+ if (!h || !this.getSkeleton()) continue;
816
+ const l = h.with(x);
817
+ if (!l) return this;
818
818
  const u = {
819
819
  ...m,
820
- componentKey: a.config.componentKey || m.componentKey,
821
- allowTransform: a.config.allowTransform !== void 0 ? a.config.allowTransform : m.allowTransform,
822
- data: a.config.data || m.data,
823
- sheetTransform: a.config.position && (s = j(
824
- a.config.position,
825
- h
826
- )) != null ? s : m.sheetTransform,
820
+ componentKey: o.config.componentKey || m.componentKey,
821
+ allowTransform: o.config.allowTransform !== void 0 ? o.config.allowTransform : m.allowTransform,
822
+ data: o.config.data || m.data,
823
+ sheetTransform: o.config.position && (a = M(
824
+ o.config.position,
825
+ l
826
+ )) != null ? a : m.sheetTransform,
827
827
  transform: {
828
828
  ...m.transform,
829
- ...a.config.position
829
+ ...o.config.position
830
830
  // Merge with existing transform
831
831
  }
832
832
  };
833
- n.push(u);
833
+ i.push(u);
834
834
  }
835
- if (n.length > 0) {
836
- const a = this._workbook.getUnitId(), d = this._worksheet.getSheetId();
837
- if (!this._commandService.syncExecuteCommand(f.id, { unitId: a, subUnitId: d, drawings: n }))
835
+ if (i.length > 0) {
836
+ const o = this._workbook.getUnitId(), d = this._worksheet.getSheetId();
837
+ if (!this._commandService.syncExecuteCommand(f.id, { unitId: o, subUnitId: d, drawings: i }))
838
838
  throw new Error("batchUpdateFloatDoms failed");
839
839
  }
840
840
  return this;
841
841
  }
842
- removeFloatDom(r) {
843
- const e = this._injector.get(D).getFloatDomInfo(r);
842
+ removeFloatDom(t) {
843
+ const e = this._injector.get(p).getFloatDomInfo(t);
844
844
  if (!e) return this;
845
- const { unitId: i, subUnitId: n } = e, a = this._injector.get(w).getDrawingByParam({
846
- unitId: i,
847
- subUnitId: n,
848
- drawingId: r
845
+ const { unitId: n, subUnitId: i } = e, o = this._injector.get(w).getDrawingByParam({
846
+ unitId: n,
847
+ subUnitId: i,
848
+ drawingId: t
849
849
  });
850
- if (!a) return this;
850
+ if (!o) return this;
851
851
  if (!this._commandService.syncExecuteCommand(k.id, {
852
- unitId: i,
853
- drawings: [a]
852
+ unitId: n,
853
+ drawings: [o]
854
854
  }))
855
855
  throw new Error("removeFloatDom failed");
856
856
  return this;
857
857
  }
858
- addFloatDomToPosition(r, t) {
859
- const e = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), { key: n, disposableCollection: s } = U(r, this._injector.get(G)), d = this._injector.get(D).addFloatDomToPosition({ ...r, componentKey: n, unitId: e, subUnitId: i }, t);
860
- return d ? (s.add(d.dispose), {
858
+ addFloatDomToPosition(t, r) {
859
+ const e = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), { key: i, disposableCollection: a } = U(t, this._injector.get(G)), d = this._injector.get(p).addFloatDomToPosition({ ...t, componentKey: i, unitId: e, subUnitId: n }, r);
860
+ return d ? (a.add(d.dispose), {
861
861
  id: d.id,
862
862
  dispose: () => {
863
- s.dispose(), d.dispose();
863
+ a.dispose(), d.dispose();
864
864
  }
865
- }) : (s.dispose(), null);
865
+ }) : (a.dispose(), null);
866
866
  }
867
- addFloatDomToRange(r, t, e, i) {
868
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), { key: a, disposableCollection: d } = U(t, this._injector.get(G)), c = this._injector.get(D).addFloatDomToRange(r.getRange(), { ...t, componentKey: a, unitId: n, subUnitId: s }, e, i);
867
+ addFloatDomToRange(t, r, e, n) {
868
+ const i = this._workbook.getUnitId(), a = this._worksheet.getSheetId(), { key: o, disposableCollection: d } = U(r, this._injector.get(G)), c = this._injector.get(p).addFloatDomToRange(t.getRange(), { ...r, componentKey: o, unitId: i, subUnitId: a }, e, n);
869
869
  return c ? (d.add(c.dispose), {
870
870
  id: c.id,
871
871
  dispose: () => {
@@ -873,8 +873,8 @@ class me extends $ {
873
873
  }
874
874
  }) : (d.dispose(), null);
875
875
  }
876
- addFloatDomToColumnHeader(r, t, e, i) {
877
- const n = this._workbook.getUnitId(), s = this._worksheet.getSheetId(), { key: a, disposableCollection: d } = U(t, this._injector.get(G)), c = this._injector.get(D).addFloatDomToColumnHeader(r, { ...t, componentKey: a, unitId: n, subUnitId: s }, e, i);
876
+ addFloatDomToColumnHeader(t, r, e, n) {
877
+ const i = this._workbook.getUnitId(), a = this._worksheet.getSheetId(), { key: o, disposableCollection: d } = U(r, this._injector.get(G)), c = this._injector.get(p).addFloatDomToColumnHeader(t, { ...r, componentKey: o, unitId: i, subUnitId: a }, e, n);
878
878
  return c ? (d.add(c.dispose), {
879
879
  id: c.id,
880
880
  dispose: () => {
@@ -882,100 +882,122 @@ class me extends $ {
882
882
  }
883
883
  }) : (d.dispose(), null);
884
884
  }
885
- async insertImage(r, t, e, i, n) {
886
- const s = this.newOverGridImage();
887
- if (typeof r == "string")
888
- s.setSource(r);
885
+ async insertImage(t, r, e, n, i) {
886
+ const a = this.newOverGridImage();
887
+ if (typeof t == "string")
888
+ a.setSource(t);
889
889
  else {
890
- const g = await r.getBlob().getDataAsString();
891
- s.setSource(g, E.BASE64);
890
+ const g = await t.getBlob().getDataAsString();
891
+ a.setSource(g, y.BASE64);
892
892
  }
893
- t !== void 0 ? s.setColumn(t) : s.setColumn(0), e !== void 0 ? s.setRow(e) : s.setRow(0), i !== void 0 ? s.setColumnOffset(i) : s.setColumnOffset(0), n !== void 0 ? s.setRowOffset(n) : s.setRowOffset(0);
894
- const a = await s.buildAsync();
895
- return this._commandService.syncExecuteCommand(b.id, { unitId: this._fWorkbook.getId(), drawings: [a] });
893
+ r !== void 0 ? a.setColumn(r) : a.setColumn(0), e !== void 0 ? a.setRow(e) : a.setRow(0), n !== void 0 ? a.setColumnOffset(n) : a.setColumnOffset(0), i !== void 0 ? a.setRowOffset(i) : a.setRowOffset(0);
894
+ const o = await a.buildAsync();
895
+ return this._commandService.syncExecuteCommand(E.id, { unitId: this._fWorkbook.getId(), drawings: [o] });
896
896
  }
897
- insertImages(r) {
898
- const t = r.map((e) => (e.unitId = this._fWorkbook.getId(), e.subUnitId = this.getSheetId(), e));
899
- return this._commandService.syncExecuteCommand(b.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
897
+ insertImages(t) {
898
+ const r = t.map((e) => (e.unitId = this._fWorkbook.getId(), e.subUnitId = this.getSheetId(), e));
899
+ return this._commandService.syncExecuteCommand(E.id, { unitId: this._fWorkbook.getId(), drawings: r }), this;
900
900
  }
901
- deleteImages(r) {
902
- const t = r.map((e) => ({
901
+ deleteImages(t) {
902
+ const r = t.map((e) => ({
903
903
  unitId: this._fWorkbook.getId(),
904
904
  drawingId: e.getId(),
905
905
  subUnitId: this.getSheetId(),
906
906
  drawingType: e.getType()
907
907
  }));
908
- return this._commandService.syncExecuteCommand(k.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
908
+ return this._commandService.syncExecuteCommand(k.id, { unitId: this._fWorkbook.getId(), drawings: r }), this;
909
909
  }
910
910
  getImages() {
911
- const t = this._injector.get(w).getDrawingData(this._fWorkbook.getId(), this.getSheetId()), e = [];
912
- for (const i in t) {
913
- const n = t[i];
914
- n.drawingType === I.DRAWING_IMAGE && e.push(this._injector.createInstance(v, n));
911
+ const r = this._injector.get(w).getDrawingData(this._fWorkbook.getId(), this.getSheetId()), e = [];
912
+ for (const n in r) {
913
+ const i = r[n];
914
+ i.drawingType === v.DRAWING_IMAGE && e.push(this._injector.createInstance(I, i));
915
915
  }
916
916
  return e;
917
917
  }
918
- getImageById(r) {
919
- const e = this._injector.get(w).getDrawingByParam({ unitId: this._fWorkbook.getId(), subUnitId: this.getSheetId(), drawingId: r });
920
- return e && e.drawingType === I.DRAWING_IMAGE ? this._injector.createInstance(v, e) : null;
918
+ getImageById(t) {
919
+ const e = this._injector.get(w).getDrawingByParam({ unitId: this._fWorkbook.getId(), subUnitId: this.getSheetId(), drawingId: t });
920
+ return e && e.drawingType === v.DRAWING_IMAGE ? this._injector.createInstance(I, e) : null;
921
921
  }
922
922
  getActiveImages() {
923
- const t = this._injector.get(w).getFocusDrawings(), e = [];
924
- for (const i in t) {
925
- const n = t[i];
926
- e.push(this._injector.createInstance(v, n));
923
+ const r = this._injector.get(w).getFocusDrawings(), e = [];
924
+ for (const n in r) {
925
+ const i = r[n];
926
+ e.push(this._injector.createInstance(I, i));
927
927
  }
928
928
  return e;
929
929
  }
930
- updateImages(r) {
931
- return this._commandService.syncExecuteCommand(f.id, { unitId: this._fWorkbook.getId(), drawings: r }), this;
930
+ updateImages(t) {
931
+ return this._commandService.syncExecuteCommand(f.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
932
932
  }
933
- onImageInserted(r) {
934
- const t = this._injector.get(w);
935
- return T(t.add$.subscribe((e) => {
936
- const i = e.map(
937
- (n) => this._injector.createInstance(v, t.getDrawingByParam(n))
933
+ onImageInserted(t) {
934
+ const r = this._injector.get(w);
935
+ return T(r.add$.subscribe((e) => {
936
+ const n = e.map(
937
+ (i) => this._injector.createInstance(I, r.getDrawingByParam(i))
938
938
  );
939
- r(i);
939
+ t(n);
940
940
  }));
941
941
  }
942
- onImageDeleted(r) {
943
- const t = this._injector.get(w);
944
- return T(t.remove$.subscribe((e) => {
945
- const i = e.map(
946
- (n) => this._injector.createInstance(v, t.getDrawingByParam(n))
942
+ onImageDeleted(t) {
943
+ const r = this._injector.get(w);
944
+ return T(r.remove$.subscribe((e) => {
945
+ const n = e.map(
946
+ (i) => this._injector.createInstance(I, r.getDrawingByParam(i))
947
947
  );
948
- r(i);
948
+ t(n);
949
949
  }));
950
950
  }
951
- onImageChanged(r) {
952
- const t = this._injector.get(w);
953
- return T(t.update$.subscribe((e) => {
954
- const i = e.map(
955
- (n) => this._injector.createInstance(v, t.getDrawingByParam(n))
951
+ onImageChanged(t) {
952
+ const r = this._injector.get(w);
953
+ return T(r.update$.subscribe((e) => {
954
+ const n = e.map(
955
+ (i) => this._injector.createInstance(I, r.getDrawingByParam(i))
956
956
  );
957
- r(i);
957
+ t(n);
958
958
  }));
959
959
  }
960
960
  newOverGridImage() {
961
- const r = this._fWorkbook.getId(), t = this.getSheetId();
962
- return this._injector.createInstance(F, r, t);
961
+ const t = this._fWorkbook.getId(), r = this.getSheetId();
962
+ return this._injector.createInstance(B, t, r);
963
+ }
964
+ async saveCellImagesAsync(t, r) {
965
+ var m;
966
+ const e = this._injector.get(V), n = this._fWorkbook.getId(), i = this.getSheetId(), a = r ? r.map((h) => h.getRange()) : [this._worksheet.getCellMatrix().getDataRange()], o = e.getCellImagesFromRanges(n, i, a);
967
+ if (o.length === 0)
968
+ return !1;
969
+ if (o.length === 1)
970
+ try {
971
+ return await e.downloadSingleImage(o[0]), !0;
972
+ } catch (h) {
973
+ return console.error("Failed to download image:", h), !1;
974
+ }
975
+ const d = [], g = (m = t == null ? void 0 : t.useCellAddress) != null ? m : !0, c = t == null ? void 0 : t.useColumnIndex;
976
+ g && d.push(b.CELL_ADDRESS), c !== void 0 && d.push(b.COLUMN_VALUE), d.length === 0 && d.push(b.CELL_ADDRESS);
977
+ try {
978
+ return await e.saveImagesWithContext(o, {
979
+ fileNameParts: d,
980
+ columnIndex: c
981
+ }, n, i), !0;
982
+ } catch (h) {
983
+ return console.error("Failed to save images:", h), !1;
984
+ }
963
985
  }
964
986
  }
965
- $.extend(me);
966
- class he extends z {
987
+ $.extend(le);
988
+ class ue extends z {
967
989
  get DrawingType() {
968
- return I;
990
+ return v;
969
991
  }
970
992
  get ImageSourceType() {
971
- return E;
993
+ return y;
972
994
  }
973
995
  get SheetDrawingAnchorType() {
974
- return ae;
996
+ return ce;
975
997
  }
976
998
  }
977
- z.extend(he);
978
- class le extends X {
999
+ z.extend(ue);
1000
+ class fe extends X {
979
1001
  get BeforeFloatDomAdd() {
980
1002
  return "BeforeFloatDomAdd";
981
1003
  }
@@ -1019,253 +1041,275 @@ class le extends X {
1019
1041
  return "OverGridImageSelected";
1020
1042
  }
1021
1043
  }
1022
- X.extend(le);
1023
- class ue extends Y {
1044
+ X.extend(fe);
1045
+ class we extends Y {
1024
1046
  /**
1025
1047
  * @ignore
1026
1048
  */
1027
1049
  // eslint-disable-next-line max-lines-per-function
1028
- _initialize(r) {
1029
- const t = r.get(N);
1050
+ _initialize(t) {
1051
+ const r = t.get(K);
1030
1052
  this.registerEventHandler(
1031
1053
  this.Event.BeforeFloatDomAdd,
1032
- () => t.beforeCommandExecuted((e) => {
1033
- if (e.id !== b.id) return;
1034
- const i = e.params, n = this.getActiveWorkbook();
1035
- if (n == null || i == null)
1054
+ () => r.beforeCommandExecuted((e) => {
1055
+ if (e.id !== E.id) return;
1056
+ const n = e.params, i = this.getActiveWorkbook();
1057
+ if (i == null || n == null)
1036
1058
  return;
1037
- const { drawings: s } = i, a = s.filter(
1038
- (g) => g.drawingType === I.DRAWING_DOM
1059
+ const { drawings: a } = n, o = a.filter(
1060
+ (g) => g.drawingType === v.DRAWING_DOM
1039
1061
  );
1040
- if (a.length === 0)
1062
+ if (o.length === 0)
1041
1063
  return;
1042
1064
  const d = {
1043
- workbook: n,
1044
- drawings: a
1065
+ workbook: i,
1066
+ drawings: o
1045
1067
  };
1046
1068
  if (this.fireEvent(this.Event.BeforeFloatDomAdd, d), d.cancel)
1047
- throw new S();
1069
+ throw new D();
1048
1070
  })
1049
1071
  ), this.registerEventHandler(
1050
1072
  this.Event.FloatDomAdded,
1051
- () => t.onCommandExecuted((e) => {
1052
- if (e.id !== b.id) return;
1053
- const i = e.params, n = this.getActiveWorkbook();
1054
- if (n == null || i == null)
1073
+ () => r.onCommandExecuted((e) => {
1074
+ if (e.id !== E.id) return;
1075
+ const n = e.params, i = this.getActiveWorkbook();
1076
+ if (i == null || n == null)
1055
1077
  return;
1056
- const { drawings: s } = i, a = s.filter(
1057
- (d) => d.drawingType === I.DRAWING_DOM
1078
+ const { drawings: a } = n, o = a.filter(
1079
+ (d) => d.drawingType === v.DRAWING_DOM
1058
1080
  );
1059
- a.length !== 0 && this.fireEvent(this.Event.FloatDomAdded, {
1060
- workbook: n,
1061
- drawings: a
1081
+ o.length !== 0 && this.fireEvent(this.Event.FloatDomAdded, {
1082
+ workbook: i,
1083
+ drawings: o
1062
1084
  });
1063
1085
  })
1064
1086
  ), this.registerEventHandler(
1065
1087
  this.Event.BeforeOverGridImageInsert,
1066
- () => t.beforeCommandExecuted((e) => {
1067
- if (e.id !== b.id) return;
1068
- const i = e.params, n = this.getActiveWorkbook();
1069
- if (n == null || i == null)
1088
+ () => r.beforeCommandExecuted((e) => {
1089
+ if (e.id !== E.id) return;
1090
+ const n = e.params, i = this.getActiveWorkbook();
1091
+ if (i == null || n == null)
1070
1092
  return;
1071
- const { drawings: s } = i, a = {
1072
- workbook: n,
1073
- insertImageParams: s
1093
+ const { drawings: a } = n, o = {
1094
+ workbook: i,
1095
+ insertImageParams: a
1074
1096
  };
1075
- if (this.fireEvent(this.Event.BeforeOverGridImageInsert, a), a.cancel)
1076
- throw new S();
1097
+ if (this.fireEvent(this.Event.BeforeOverGridImageInsert, o), o.cancel)
1098
+ throw new D();
1077
1099
  })
1078
1100
  ), this.registerEventHandler(
1079
1101
  this.Event.BeforeOverGridImageRemove,
1080
- () => t.beforeCommandExecuted((e) => {
1102
+ () => r.beforeCommandExecuted((e) => {
1081
1103
  if (e.id !== k.id) return;
1082
- const i = e.params, n = this.getActiveWorkbook();
1083
- if (n == null || i == null)
1104
+ const n = e.params, i = this.getActiveWorkbook();
1105
+ if (i == null || n == null)
1084
1106
  return;
1085
- const s = r.get(p), { drawings: a } = i, d = a.map((c) => s.getDrawingByParam(c)), g = {
1086
- workbook: n,
1107
+ const a = t.get(S), { drawings: o } = n, d = o.map((c) => a.getDrawingByParam(c)), g = {
1108
+ workbook: i,
1087
1109
  images: this._createFOverGridImage(d)
1088
1110
  };
1089
1111
  if (this.fireEvent(this.Event.BeforeOverGridImageRemove, g), g.cancel)
1090
- throw new S();
1112
+ throw new D();
1091
1113
  })
1092
1114
  ), this.registerEventHandler(
1093
1115
  this.Event.BeforeOverGridImageChange,
1094
- () => t.beforeCommandExecuted((e) => {
1116
+ () => r.beforeCommandExecuted((e) => {
1095
1117
  if (e.id !== f.id) return;
1096
- const i = e.params, n = this.getActiveWorkbook();
1097
- if (n == null || i == null)
1118
+ const n = e.params, i = this.getActiveWorkbook();
1119
+ if (i == null || n == null)
1098
1120
  return;
1099
- const { drawings: s } = i, a = r.get(p), d = [];
1100
- s.forEach((c) => {
1101
- const m = a.getDrawingByParam(c);
1121
+ const { drawings: a } = n, o = t.get(S), d = [];
1122
+ a.forEach((c) => {
1123
+ const m = o.getDrawingByParam(c);
1102
1124
  m != null && d.push({
1103
1125
  changeParam: c,
1104
- image: this._injector.createInstance(v, m)
1126
+ image: this._injector.createInstance(I, m)
1105
1127
  });
1106
1128
  });
1107
1129
  const g = {
1108
- workbook: n,
1130
+ workbook: i,
1109
1131
  images: d
1110
1132
  };
1111
1133
  if (this.fireEvent(this.Event.BeforeOverGridImageChange, g), g.cancel)
1112
- throw a.updateNotification(s), new S();
1134
+ throw o.updateNotification(a), new D();
1113
1135
  })
1114
1136
  ), this.registerEventHandler(
1115
1137
  this.Event.BeforeFloatDomUpdate,
1116
- () => t.beforeCommandExecuted((e) => {
1138
+ () => r.beforeCommandExecuted((e) => {
1117
1139
  if (e.id !== f.id) return;
1118
- const i = e.params, n = this.getActiveWorkbook();
1119
- if (n == null || i == null)
1140
+ const n = e.params, i = this.getActiveWorkbook();
1141
+ if (i == null || n == null)
1120
1142
  return;
1121
- const { drawings: s } = i, a = r.get(p), d = [];
1122
- if (s.forEach((c) => {
1123
- const m = a.getDrawingByParam(c);
1124
- (m == null ? void 0 : m.drawingType) === I.DRAWING_DOM && d.push(m);
1143
+ const { drawings: a } = n, o = t.get(S), d = [];
1144
+ if (a.forEach((c) => {
1145
+ const m = o.getDrawingByParam(c);
1146
+ (m == null ? void 0 : m.drawingType) === v.DRAWING_DOM && d.push(m);
1125
1147
  }), d.length === 0)
1126
1148
  return;
1127
1149
  const g = {
1128
- workbook: n,
1150
+ workbook: i,
1129
1151
  drawings: d
1130
1152
  };
1131
1153
  if (this.fireEvent(this.Event.BeforeFloatDomUpdate, g), g.cancel)
1132
- throw a.updateNotification(s), new S();
1154
+ throw o.updateNotification(a), new D();
1133
1155
  })
1134
1156
  ), this.registerEventHandler(
1135
1157
  this.Event.FloatDomUpdated,
1136
- () => t.onCommandExecuted((e) => {
1158
+ () => r.onCommandExecuted((e) => {
1137
1159
  if (e.id !== f.id) return;
1138
- const i = e.params, n = this.getActiveWorkbook();
1139
- if (n == null || i == null)
1160
+ const n = e.params, i = this.getActiveWorkbook();
1161
+ if (i == null || n == null)
1140
1162
  return;
1141
- const { drawings: s } = i, a = r.get(p), d = [];
1142
- s.forEach((g) => {
1143
- const c = a.getDrawingByParam(g);
1144
- (c == null ? void 0 : c.drawingType) === I.DRAWING_DOM && d.push(c);
1163
+ const { drawings: a } = n, o = t.get(S), d = [];
1164
+ a.forEach((g) => {
1165
+ const c = o.getDrawingByParam(g);
1166
+ (c == null ? void 0 : c.drawingType) === v.DRAWING_DOM && d.push(c);
1145
1167
  }), d.length !== 0 && this.fireEvent(this.Event.FloatDomUpdated, {
1146
- workbook: n,
1168
+ workbook: i,
1147
1169
  drawings: d
1148
1170
  });
1149
1171
  })
1150
1172
  ), this.registerEventHandler(
1151
1173
  this.Event.BeforeFloatDomDelete,
1152
- () => t.beforeCommandExecuted((e) => {
1174
+ () => r.beforeCommandExecuted((e) => {
1153
1175
  if (e.id !== k.id) return;
1154
- const i = e.params, n = this.getActiveWorkbook();
1155
- if (n == null || i == null)
1176
+ const n = e.params, i = this.getActiveWorkbook();
1177
+ if (i == null || n == null)
1156
1178
  return;
1157
- const s = r.get(p), { drawings: a } = i, d = a.map((c) => s.getDrawingByParam(c)).filter(
1158
- (c) => (c == null ? void 0 : c.drawingType) === I.DRAWING_DOM
1179
+ const a = t.get(S), { drawings: o } = n, d = o.map((c) => a.getDrawingByParam(c)).filter(
1180
+ (c) => (c == null ? void 0 : c.drawingType) === v.DRAWING_DOM
1159
1181
  );
1160
1182
  if (d.length === 0)
1161
1183
  return;
1162
1184
  const g = {
1163
- workbook: n,
1185
+ workbook: i,
1164
1186
  drawings: d
1165
1187
  };
1166
1188
  if (this.fireEvent(this.Event.BeforeFloatDomDelete, g), g.cancel)
1167
- throw new S();
1189
+ throw new D();
1168
1190
  })
1169
1191
  ), this.registerEventHandler(
1170
1192
  this.Event.FloatDomDeleted,
1171
- () => t.onCommandExecuted((e) => {
1193
+ () => r.onCommandExecuted((e) => {
1172
1194
  if (e.id !== k.id) return;
1173
- const i = e.params, n = this.getActiveWorkbook();
1174
- if (n == null || i == null)
1195
+ const n = e.params, i = this.getActiveWorkbook();
1196
+ if (i == null || n == null)
1175
1197
  return;
1176
- const { drawings: s } = i;
1198
+ const { drawings: a } = n;
1177
1199
  this.fireEvent(this.Event.FloatDomDeleted, {
1178
- workbook: n,
1179
- drawings: s.filter((a) => a.drawingType === I.DRAWING_DOM).map((a) => a.drawingId)
1200
+ workbook: i,
1201
+ drawings: a.filter((o) => o.drawingType === v.DRAWING_DOM).map((o) => o.drawingId)
1180
1202
  });
1181
1203
  })
1182
1204
  ), this.registerEventHandler(
1183
1205
  this.Event.BeforeOverGridImageSelect,
1184
- () => t.beforeCommandExecuted((e) => {
1185
- if (e.id !== W.id) return;
1186
- const i = e.params, n = this.getActiveWorkbook();
1187
- if (n == null)
1206
+ () => r.beforeCommandExecuted((e) => {
1207
+ if (e.id !== j.id) return;
1208
+ const n = e.params, i = this.getActiveWorkbook();
1209
+ if (i == null)
1188
1210
  return;
1189
- const s = r.get(p), a = s.getFocusDrawings(), d = i.map((c) => s.getDrawingByParam(c)), g = {
1190
- workbook: n,
1211
+ const a = t.get(S), o = a.getFocusDrawings(), d = n.map((c) => a.getDrawingByParam(c)), g = {
1212
+ workbook: i,
1191
1213
  selectedImages: this._createFOverGridImage(d),
1192
- oldSelectedImages: this._createFOverGridImage(a)
1214
+ oldSelectedImages: this._createFOverGridImage(o)
1193
1215
  };
1194
1216
  if (this.fireEvent(this.Event.BeforeOverGridImageSelect, g), g.cancel)
1195
- throw new S();
1217
+ throw new D();
1196
1218
  })
1197
1219
  ), this.registerEventHandler(
1198
1220
  this.Event.OverGridImageInserted,
1199
- () => t.onCommandExecuted((e) => {
1200
- if (e.id !== b.id) return;
1201
- const i = e.params, n = this.getActiveWorkbook();
1202
- if (n == null || i == null)
1221
+ () => r.onCommandExecuted((e) => {
1222
+ if (e.id !== E.id) return;
1223
+ const n = e.params, i = this.getActiveWorkbook();
1224
+ if (i == null || n == null)
1203
1225
  return;
1204
- const { drawings: s } = i;
1226
+ const { drawings: a } = n;
1205
1227
  this.fireEvent(this.Event.OverGridImageInserted, {
1206
- workbook: n,
1207
- images: this._createFOverGridImage(s)
1228
+ workbook: i,
1229
+ images: this._createFOverGridImage(a)
1208
1230
  });
1209
1231
  })
1210
1232
  ), this.registerEventHandler(
1211
1233
  this.Event.OverGridImageRemoved,
1212
- () => t.onCommandExecuted((e) => {
1234
+ () => r.onCommandExecuted((e) => {
1213
1235
  if (e.id !== k.id) return;
1214
- const i = e.params, n = this.getActiveWorkbook();
1215
- if (n == null || i == null)
1236
+ const n = e.params, i = this.getActiveWorkbook();
1237
+ if (i == null || n == null)
1216
1238
  return;
1217
- const { drawings: s } = i;
1239
+ const { drawings: a } = n;
1218
1240
  this.fireEvent(this.Event.OverGridImageRemoved, {
1219
- workbook: n,
1220
- removeImageParams: s
1241
+ workbook: i,
1242
+ removeImageParams: a
1221
1243
  });
1222
1244
  })
1223
1245
  ), this.registerEventHandler(
1224
1246
  this.Event.OverGridImageChanged,
1225
- () => t.onCommandExecuted((e) => {
1247
+ () => r.onCommandExecuted((e) => {
1226
1248
  if (e.id !== f.id) return;
1227
- const i = e.params, n = this.getActiveWorkbook();
1228
- if (n == null || i == null)
1249
+ const n = e.params, i = this.getActiveWorkbook();
1250
+ if (i == null || n == null)
1229
1251
  return;
1230
- const { drawings: s } = i, a = r.get(p), d = s.map((g) => this._injector.createInstance(v, a.getDrawingByParam(g)));
1252
+ const { drawings: a } = n, o = t.get(S), d = a.map((g) => this._injector.createInstance(I, o.getDrawingByParam(g)));
1231
1253
  this.fireEvent(this.Event.OverGridImageChanged, {
1232
- workbook: n,
1254
+ workbook: i,
1233
1255
  images: d
1234
1256
  });
1235
1257
  })
1236
1258
  ), this.registerEventHandler(
1237
1259
  this.Event.OverGridImageSelected,
1238
- () => t.onCommandExecuted((e) => {
1239
- if (e.id !== W.id) return;
1240
- const i = e.params, n = this.getActiveWorkbook();
1241
- if (n == null)
1260
+ () => r.onCommandExecuted((e) => {
1261
+ if (e.id !== j.id) return;
1262
+ const n = e.params, i = this.getActiveWorkbook();
1263
+ if (i == null)
1242
1264
  return;
1243
- const s = r.get(p), a = i.map((d) => s.getDrawingByParam(d));
1265
+ const a = t.get(S), o = n.map((d) => a.getDrawingByParam(d));
1244
1266
  this.fireEvent(this.Event.OverGridImageSelected, {
1245
- workbook: n,
1246
- selectedImages: this._createFOverGridImage(a)
1267
+ workbook: i,
1268
+ selectedImages: this._createFOverGridImage(o)
1247
1269
  });
1248
1270
  })
1249
1271
  );
1250
1272
  }
1251
- _createFOverGridImage(r) {
1252
- return r.map((t) => this._injector.createInstance(v, t));
1273
+ _createFOverGridImage(t) {
1274
+ return t.map((r) => this._injector.createInstance(I, r));
1253
1275
  }
1254
1276
  }
1255
- Y.extend(ue);
1256
- class fe extends L {
1257
- async insertCellImageAsync(r) {
1258
- var n;
1259
- const t = this._injector.get(y), e = (n = ie(Z.UNIVER_SHEET, this._injector.get(ee), t)) == null ? void 0 : n.with(ne);
1277
+ Y.extend(we);
1278
+ class Ie extends q {
1279
+ async insertCellImageAsync(t) {
1280
+ var i;
1281
+ const r = this._injector.get(C), e = (i = se(te.UNIVER_SHEET, this._injector.get(re), r)) == null ? void 0 : i.with(oe);
1260
1282
  if (!e)
1261
1283
  return !1;
1262
- const i = {
1284
+ const n = {
1263
1285
  unitId: this._workbook.getUnitId(),
1264
1286
  subUnitId: this._worksheet.getSheetId(),
1265
1287
  row: this.getRow(),
1266
1288
  col: this.getColumn()
1267
1289
  };
1268
- return typeof r == "string" ? e.insertCellImageByUrl(r, i) : e.insertCellImageByFile(r, i);
1290
+ return typeof t == "string" ? e.insertCellImageByUrl(t, n) : e.insertCellImageByFile(t, n);
1291
+ }
1292
+ async saveCellImagesAsync(t) {
1293
+ var c;
1294
+ const r = this._injector.get(V), e = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), i = this.getRange(), a = r.getCellImagesFromRanges(e, n, [i]);
1295
+ if (a.length === 0)
1296
+ return !1;
1297
+ if (a.length === 1)
1298
+ try {
1299
+ return await r.downloadSingleImage(a[0]), !0;
1300
+ } catch (m) {
1301
+ return console.error("Failed to download image:", m), !1;
1302
+ }
1303
+ const o = [], d = (c = t == null ? void 0 : t.useCellAddress) != null ? c : !0, g = t == null ? void 0 : t.useColumnIndex;
1304
+ d && o.push(b.CELL_ADDRESS), g !== void 0 && o.push(b.COLUMN_VALUE), o.length === 0 && o.push(b.CELL_ADDRESS);
1305
+ try {
1306
+ return await r.saveImagesWithContext(a, {
1307
+ fileNameParts: o,
1308
+ columnIndex: g
1309
+ }, e, n), !0;
1310
+ } catch (m) {
1311
+ return console.error("Failed to save images:", m), !1;
1312
+ }
1269
1313
  }
1270
1314
  }
1271
- L.extend(fe);
1315
+ q.extend(Ie);