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