@univerjs/sheets-drawing-ui 0.8.1-nightly.202506191607 → 0.8.1
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/LICENSE +176 -0
- package/lib/cjs/facade.js +1 -1
- package/lib/es/facade.js +187 -187
- package/lib/facade.js +187 -187
- package/lib/index.css +1 -1
- package/lib/umd/facade.js +1 -1
- package/package.json +13 -13
package/lib/facade.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
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 l, SheetDrawingAnchorType as
|
|
11
|
-
import { transformComponentKey as
|
|
12
|
-
import { FWorksheet as
|
|
13
|
-
import { ComponentManager as
|
|
14
|
-
var
|
|
15
|
-
for (var n =
|
|
16
|
-
(o =
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var V = (r, e, t) => e in r ? L(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var U = (r, e, t) => V(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as A, Injector as j, ICommandService as P, ImageSourceType as f, ArrangeTypeEnum as v, DrawingTypeEnum as _, generateRandomId as X, toDisposable as y, UniverInstanceType as Y, IUniverInstanceService as q } from "@univerjs/core";
|
|
5
|
+
import { FBase as J, FEnum as W, FEventName as M, FUniver as H } from "@univerjs/core/facade";
|
|
6
|
+
import { getImageSize as Q, IDrawingManagerService as I, SetDrawingSelectedOperation as x } from "@univerjs/drawing";
|
|
7
|
+
import { IRenderManagerService as B, getCurrentTypeOfRenderer as Z } from "@univerjs/engine-render";
|
|
8
|
+
import { RemoveSheetDrawingCommand as S, SetSheetDrawingCommand as h, SetDrawingArrangeCommand as w, SheetCanvasFloatDomManagerService as D, InsertSheetDrawingCommand as p, SheetDrawingUpdateController as ee } from "@univerjs/sheets-drawing-ui";
|
|
9
|
+
import { SheetSkeletonManagerService as F, ISheetSelectionRenderService as te, convertPositionSheetOverGridToAbsolute as re, convertPositionCellToSheetOverGrid as ie } from "@univerjs/sheets-ui";
|
|
10
|
+
import { ISheetDrawingService as l, SheetDrawingAnchorType as ne } from "@univerjs/sheets-drawing";
|
|
11
|
+
import { transformComponentKey as R } from "@univerjs/sheets-ui/facade";
|
|
12
|
+
import { FWorksheet as z, FRange as N } from "@univerjs/sheets/facade";
|
|
13
|
+
import { ComponentManager as G } from "@univerjs/ui";
|
|
14
|
+
var se = Object.getOwnPropertyDescriptor, $ = (r, e, t, i) => {
|
|
15
|
+
for (var n = i > 1 ? void 0 : i ? se(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
16
|
+
(o = r[s]) && (n = o(n) || n);
|
|
17
17
|
return n;
|
|
18
|
-
},
|
|
19
|
-
function
|
|
20
|
-
const { from: t, to:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{ from: t, to:
|
|
18
|
+
}, T = (r, e) => (t, i) => e(t, i, r);
|
|
19
|
+
function oe(r, e) {
|
|
20
|
+
const { from: t, to: i, flipY: n = !1, flipX: s = !1, angle: o = 0, skewX: d = 0, skewY: a = 0 } = r.sheetTransform, { column: g, columnOffset: c, row: u, rowOffset: O } = t, k = re(
|
|
21
|
+
r.unitId,
|
|
22
|
+
r.subUnitId,
|
|
23
|
+
{ from: t, to: i },
|
|
24
24
|
e
|
|
25
|
-
), { width:
|
|
25
|
+
), { width: E, height: C } = k;
|
|
26
26
|
return {
|
|
27
|
-
...
|
|
27
|
+
...r,
|
|
28
28
|
column: g,
|
|
29
29
|
columnOffset: c,
|
|
30
30
|
row: u,
|
|
31
31
|
rowOffset: O,
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
32
|
+
width: E,
|
|
33
|
+
height: C,
|
|
34
34
|
flipY: n,
|
|
35
35
|
flipX: s,
|
|
36
36
|
angle: o,
|
|
@@ -38,20 +38,20 @@ function ae(i, e) {
|
|
|
38
38
|
skewY: a
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const { column:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{ column:
|
|
41
|
+
function ae(r, e, t) {
|
|
42
|
+
const { column: i, columnOffset: n, row: s, rowOffset: o, flipY: d = !1, flipX: a = !1, angle: g = 0, skewX: c = 0, skewY: u = 0, width: O, height: k } = r, E = ie(
|
|
43
|
+
r.unitId,
|
|
44
|
+
r.subUnitId,
|
|
45
|
+
{ column: i, columnOffset: n, row: s, rowOffset: o },
|
|
46
46
|
O,
|
|
47
|
-
|
|
47
|
+
k,
|
|
48
48
|
e,
|
|
49
49
|
t
|
|
50
|
-
), { sheetTransform:
|
|
50
|
+
), { sheetTransform: C, transform: K } = E;
|
|
51
51
|
return {
|
|
52
|
-
...
|
|
52
|
+
...r,
|
|
53
53
|
sheetTransform: {
|
|
54
|
-
...
|
|
54
|
+
...C,
|
|
55
55
|
flipY: d,
|
|
56
56
|
flipX: a,
|
|
57
57
|
angle: g,
|
|
@@ -59,7 +59,7 @@ function de(i, e, t) {
|
|
|
59
59
|
skewY: u
|
|
60
60
|
},
|
|
61
61
|
transform: {
|
|
62
|
-
...
|
|
62
|
+
...K,
|
|
63
63
|
flipY: d,
|
|
64
64
|
flipX: a,
|
|
65
65
|
angle: g,
|
|
@@ -68,15 +68,15 @@ function de(i, e, t) {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
let
|
|
72
|
-
constructor(
|
|
73
|
-
|
|
71
|
+
let b = class {
|
|
72
|
+
constructor(r, e, t) {
|
|
73
|
+
U(this, "_image");
|
|
74
74
|
this._injector = t, this._image = {
|
|
75
|
-
drawingId:
|
|
76
|
-
drawingType:
|
|
75
|
+
drawingId: X(6),
|
|
76
|
+
drawingType: _.DRAWING_IMAGE,
|
|
77
77
|
imageSourceType: f.BASE64,
|
|
78
78
|
source: "",
|
|
79
|
-
unitId:
|
|
79
|
+
unitId: r,
|
|
80
80
|
subUnitId: e,
|
|
81
81
|
column: 0,
|
|
82
82
|
columnOffset: 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(r) {
|
|
115
|
+
const t = this._injector.get(B).getRenderById(r.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 ${r.unitId} not found`);
|
|
118
|
+
const i = t.with(F);
|
|
119
|
+
return r.sheetTransform == null && (r.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 = oe(r, i), this;
|
|
133
133
|
}
|
|
134
|
-
setSource(
|
|
134
|
+
setSource(r, e) {
|
|
135
135
|
const t = e != null ? e : f.URL;
|
|
136
|
-
return this._image.source =
|
|
136
|
+
return this._image.source = r, 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(r) {
|
|
189
|
+
return this._image.column = r, 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(r) {
|
|
210
|
+
return this._image.row = r, 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(r) {
|
|
232
|
+
return this._image.columnOffset = r, 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(r) {
|
|
254
|
+
return this._image.rowOffset = r, 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(r) {
|
|
277
|
+
return this._image.width = r, 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(r) {
|
|
300
|
+
return this._image.height = r, 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(r) {
|
|
349
|
+
return this._image.anchorType = r, 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(r) {
|
|
371
|
+
return this._initializeSrcRect(), this._image.srcRect.top = r, 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(r) {
|
|
393
|
+
return this._initializeSrcRect(), this._image.srcRect.left = r, 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(r) {
|
|
415
|
+
return this._initializeSrcRect(), this._image.srcRect.bottom = r, 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(r) {
|
|
437
|
+
return this._initializeSrcRect(), this._image.srcRect.right = r, 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(r) {
|
|
467
|
+
return this._image.angle = r, this;
|
|
468
468
|
}
|
|
469
|
-
setUnitId(
|
|
470
|
-
return this._image.unitId =
|
|
469
|
+
setUnitId(r) {
|
|
470
|
+
return this._image.unitId = r, this;
|
|
471
471
|
}
|
|
472
|
-
setSubUnitId(
|
|
473
|
-
return this._image.subUnitId =
|
|
472
|
+
setSubUnitId(r) {
|
|
473
|
+
return this._image.subUnitId = r, this;
|
|
474
474
|
}
|
|
475
475
|
async buildAsync() {
|
|
476
|
-
const e = this._injector.get(
|
|
476
|
+
const e = this._injector.get(B).getRenderById(this._image.unitId);
|
|
477
477
|
if (!e)
|
|
478
478
|
throw new Error(`Render Unit with unitId ${this._image.unitId} not found`);
|
|
479
|
-
const t = e.with(
|
|
479
|
+
const t = e.with(te), i = e.with(F);
|
|
480
480
|
if (this._image.width === 0 || this._image.height === 0) {
|
|
481
|
-
const n = await
|
|
481
|
+
const n = await Q(this._image.source), s = n.width, o = n.height;
|
|
482
482
|
this._image.width === 0 && (this._image.width = s), this._image.height === 0 && (this._image.height = o);
|
|
483
483
|
}
|
|
484
|
-
return
|
|
484
|
+
return ae(this._image, t, i);
|
|
485
485
|
}
|
|
486
486
|
};
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
],
|
|
490
|
-
let m = class extends
|
|
491
|
-
constructor(
|
|
492
|
-
super(), this._image =
|
|
487
|
+
b = $([
|
|
488
|
+
T(2, A(j))
|
|
489
|
+
], b);
|
|
490
|
+
let m = class extends J {
|
|
491
|
+
constructor(r, e, t) {
|
|
492
|
+
super(), this._image = r, this._commandService = e, 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(S.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
540
540
|
}
|
|
541
541
|
/**
|
|
542
542
|
* Convert the image to a FOverGridImageBuilder
|
|
@@ -552,16 +552,16 @@ let m = class extends Q {
|
|
|
552
552
|
* ```
|
|
553
553
|
*/
|
|
554
554
|
toBuilder() {
|
|
555
|
-
const
|
|
556
|
-
return
|
|
555
|
+
const r = this._injector.createInstance(b);
|
|
556
|
+
return r.setImage(this._image), r;
|
|
557
557
|
}
|
|
558
|
-
setSource(
|
|
558
|
+
setSource(r, e) {
|
|
559
559
|
const t = e != null ? e : f.URL;
|
|
560
|
-
return this._image.source =
|
|
560
|
+
return this._image.source = r, this._image.imageSourceType = t, this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
561
561
|
}
|
|
562
|
-
async setPositionAsync(
|
|
562
|
+
async setPositionAsync(r, e, t, i) {
|
|
563
563
|
const n = this.toBuilder();
|
|
564
|
-
n.setColumn(e), n.setRow(
|
|
564
|
+
n.setColumn(e), n.setRow(r), t != null && n.setRowOffset(t), i != null && n.setColumnOffset(i);
|
|
565
565
|
const s = await n.buildAsync();
|
|
566
566
|
return this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [s] });
|
|
567
567
|
}
|
|
@@ -580,11 +580,11 @@ let m = class extends Q {
|
|
|
580
580
|
* console.log(result);
|
|
581
581
|
* ```
|
|
582
582
|
*/
|
|
583
|
-
async setSizeAsync(
|
|
583
|
+
async setSizeAsync(r, e) {
|
|
584
584
|
const t = this.toBuilder();
|
|
585
|
-
t.setWidth(
|
|
586
|
-
const
|
|
587
|
-
return this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [
|
|
585
|
+
t.setWidth(r), t.setHeight(e);
|
|
586
|
+
const i = await t.buildAsync();
|
|
587
|
+
return this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [i] });
|
|
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(r, e, t, i) {
|
|
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
|
+
}), r != null && (this._image.srcRect.top = r), e != null && (this._image.srcRect.left = e), t != null && (this._image.srcRect.bottom = t), i != null && (this._image.srcRect.right = i), this._commandService.syncExecuteCommand(h.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(r) {
|
|
629
|
+
return this._image.sheetTransform.angle = r, this._image.transform && (this._image.transform.angle = r), this._commandService.syncExecuteCommand(h.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(w.id, {
|
|
645
645
|
unitId: this._image.unitId,
|
|
646
646
|
subUnitId: this._image.subUnitId,
|
|
647
647
|
drawingIds: [this._image.drawingId],
|
|
648
|
-
arrangeType:
|
|
648
|
+
arrangeType: v.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(w.id, {
|
|
665
665
|
unitId: this._image.unitId,
|
|
666
666
|
subUnitId: this._image.subUnitId,
|
|
667
667
|
drawingIds: [this._image.drawingId],
|
|
668
|
-
arrangeType:
|
|
668
|
+
arrangeType: v.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(w.id, {
|
|
685
685
|
unitId: this._image.unitId,
|
|
686
686
|
subUnitId: this._image.subUnitId,
|
|
687
687
|
drawingIds: [this._image.drawingId],
|
|
688
|
-
arrangeType:
|
|
688
|
+
arrangeType: v.back
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
691
|
/**
|
|
@@ -701,21 +701,21 @@ let m = class extends Q {
|
|
|
701
701
|
* ```
|
|
702
702
|
*/
|
|
703
703
|
setFront() {
|
|
704
|
-
return this._commandService.syncExecuteCommand(
|
|
704
|
+
return this._commandService.syncExecuteCommand(w.id, {
|
|
705
705
|
unitId: this._image.unitId,
|
|
706
706
|
subUnitId: this._image.subUnitId,
|
|
707
707
|
drawingIds: [this._image.drawingId],
|
|
708
|
-
arrangeType:
|
|
708
|
+
arrangeType: v.front
|
|
709
709
|
});
|
|
710
710
|
}
|
|
711
711
|
};
|
|
712
|
-
m =
|
|
713
|
-
|
|
714
|
-
|
|
712
|
+
m = $([
|
|
713
|
+
T(1, P),
|
|
714
|
+
T(2, A(j))
|
|
715
715
|
], m);
|
|
716
|
-
class
|
|
716
|
+
class de extends z {
|
|
717
717
|
addFloatDomToPosition(e, t) {
|
|
718
|
-
const
|
|
718
|
+
const i = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), { key: s, disposableCollection: o } = R(e, this._injector.get(G)), a = this._injector.get(D).addFloatDomToPosition({ ...e, componentKey: s, unitId: i, subUnitId: n }, t);
|
|
719
719
|
return a ? (o.add(a.dispose), {
|
|
720
720
|
id: a.id,
|
|
721
721
|
dispose: () => {
|
|
@@ -723,8 +723,8 @@ class ce extends N {
|
|
|
723
723
|
}
|
|
724
724
|
}) : (o.dispose(), null);
|
|
725
725
|
}
|
|
726
|
-
addFloatDomToRange(e, t,
|
|
727
|
-
const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), { key: d, disposableCollection: a } =
|
|
726
|
+
addFloatDomToRange(e, t, i, n) {
|
|
727
|
+
const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), { key: d, disposableCollection: a } = R(t, this._injector.get(G)), c = this._injector.get(D).addFloatDomToRange(e.getRange(), { ...t, componentKey: d, unitId: s, subUnitId: o }, i, n);
|
|
728
728
|
return c ? (a.add(c.dispose), {
|
|
729
729
|
id: c.id,
|
|
730
730
|
dispose: () => {
|
|
@@ -732,8 +732,8 @@ class ce extends N {
|
|
|
732
732
|
}
|
|
733
733
|
}) : (a.dispose(), null);
|
|
734
734
|
}
|
|
735
|
-
addFloatDomToColumnHeader(e, t,
|
|
736
|
-
const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), { key: d, disposableCollection: a } =
|
|
735
|
+
addFloatDomToColumnHeader(e, t, i, n) {
|
|
736
|
+
const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), { key: d, disposableCollection: a } = R(t, this._injector.get(G)), c = this._injector.get(D).addFloatDomToColumnHeader(e, { ...t, componentKey: d, unitId: s, subUnitId: o }, i, n);
|
|
737
737
|
return c ? (a.add(c.dispose), {
|
|
738
738
|
id: c.id,
|
|
739
739
|
dispose: () => {
|
|
@@ -741,7 +741,7 @@ class ce extends N {
|
|
|
741
741
|
}
|
|
742
742
|
}) : (a.dispose(), null);
|
|
743
743
|
}
|
|
744
|
-
async insertImage(e, t,
|
|
744
|
+
async insertImage(e, t, i, n, s) {
|
|
745
745
|
const o = this.newOverGridImage();
|
|
746
746
|
if (typeof e == "string")
|
|
747
747
|
o.setSource(e);
|
|
@@ -749,50 +749,50 @@ class ce extends N {
|
|
|
749
749
|
const g = await e.getBlob().getDataAsString();
|
|
750
750
|
o.setSource(g, f.BASE64);
|
|
751
751
|
}
|
|
752
|
-
t !== void 0 ? o.setColumn(t) : o.setColumn(0),
|
|
752
|
+
t !== void 0 ? o.setColumn(t) : o.setColumn(0), i !== void 0 ? o.setRow(i) : o.setRow(0), n !== void 0 ? o.setColumnOffset(n) : o.setColumnOffset(0), s !== void 0 ? o.setRowOffset(s) : o.setRowOffset(0);
|
|
753
753
|
const d = await o.buildAsync();
|
|
754
|
-
return this._commandService.syncExecuteCommand(
|
|
754
|
+
return this._commandService.syncExecuteCommand(p.id, { unitId: this._fWorkbook.getId(), drawings: [d] });
|
|
755
755
|
}
|
|
756
756
|
insertImages(e) {
|
|
757
|
-
const t = e.map((
|
|
758
|
-
return this._commandService.syncExecuteCommand(
|
|
757
|
+
const t = e.map((i) => (i.unitId = this._fWorkbook.getId(), i.subUnitId = this.getSheetId(), i));
|
|
758
|
+
return this._commandService.syncExecuteCommand(p.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
|
|
759
759
|
}
|
|
760
760
|
deleteImages(e) {
|
|
761
|
-
const t = e.map((
|
|
761
|
+
const t = e.map((i) => ({
|
|
762
762
|
unitId: this._fWorkbook.getId(),
|
|
763
|
-
drawingId:
|
|
763
|
+
drawingId: i.getId(),
|
|
764
764
|
subUnitId: this.getSheetId(),
|
|
765
|
-
drawingType:
|
|
765
|
+
drawingType: i.getType()
|
|
766
766
|
}));
|
|
767
|
-
return this._commandService.syncExecuteCommand(
|
|
767
|
+
return this._commandService.syncExecuteCommand(S.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
|
|
768
768
|
}
|
|
769
769
|
getImages() {
|
|
770
|
-
const t = this._injector.get(l).getDrawingData(this._fWorkbook.getId(), this.getSheetId()),
|
|
770
|
+
const t = this._injector.get(l).getDrawingData(this._fWorkbook.getId(), this.getSheetId()), i = [];
|
|
771
771
|
for (const n in t) {
|
|
772
772
|
const s = t[n];
|
|
773
|
-
s.drawingType ===
|
|
773
|
+
s.drawingType === _.DRAWING_IMAGE && i.push(this._injector.createInstance(m, s));
|
|
774
774
|
}
|
|
775
|
-
return
|
|
775
|
+
return i;
|
|
776
776
|
}
|
|
777
777
|
getImageById(e) {
|
|
778
|
-
const
|
|
779
|
-
return
|
|
778
|
+
const i = this._injector.get(l).getDrawingByParam({ unitId: this._fWorkbook.getId(), subUnitId: this.getSheetId(), drawingId: e });
|
|
779
|
+
return i && i.drawingType === _.DRAWING_IMAGE ? this._injector.createInstance(m, i) : null;
|
|
780
780
|
}
|
|
781
781
|
getActiveImages() {
|
|
782
|
-
const t = this._injector.get(l).getFocusDrawings(),
|
|
782
|
+
const t = this._injector.get(l).getFocusDrawings(), i = [];
|
|
783
783
|
for (const n in t) {
|
|
784
784
|
const s = t[n];
|
|
785
|
-
|
|
785
|
+
i.push(this._injector.createInstance(m, s));
|
|
786
786
|
}
|
|
787
|
-
return
|
|
787
|
+
return i;
|
|
788
788
|
}
|
|
789
789
|
updateImages(e) {
|
|
790
790
|
return this._commandService.syncExecuteCommand(h.id, { unitId: this._fWorkbook.getId(), drawings: e }), this;
|
|
791
791
|
}
|
|
792
792
|
onImageInserted(e) {
|
|
793
793
|
const t = this._injector.get(l);
|
|
794
|
-
return
|
|
795
|
-
const n =
|
|
794
|
+
return y(t.add$.subscribe((i) => {
|
|
795
|
+
const n = i.map(
|
|
796
796
|
(s) => this._injector.createInstance(m, t.getDrawingByParam(s))
|
|
797
797
|
);
|
|
798
798
|
e(n);
|
|
@@ -800,8 +800,8 @@ class ce extends N {
|
|
|
800
800
|
}
|
|
801
801
|
onImageDeleted(e) {
|
|
802
802
|
const t = this._injector.get(l);
|
|
803
|
-
return
|
|
804
|
-
const n =
|
|
803
|
+
return y(t.remove$.subscribe((i) => {
|
|
804
|
+
const n = i.map(
|
|
805
805
|
(s) => this._injector.createInstance(m, t.getDrawingByParam(s))
|
|
806
806
|
);
|
|
807
807
|
e(n);
|
|
@@ -809,8 +809,8 @@ class ce extends N {
|
|
|
809
809
|
}
|
|
810
810
|
onImageChanged(e) {
|
|
811
811
|
const t = this._injector.get(l);
|
|
812
|
-
return
|
|
813
|
-
const n =
|
|
812
|
+
return y(t.update$.subscribe((i) => {
|
|
813
|
+
const n = i.map(
|
|
814
814
|
(s) => this._injector.createInstance(m, t.getDrawingByParam(s))
|
|
815
815
|
);
|
|
816
816
|
e(n);
|
|
@@ -818,23 +818,23 @@ class ce extends N {
|
|
|
818
818
|
}
|
|
819
819
|
newOverGridImage() {
|
|
820
820
|
const e = this._fWorkbook.getId(), t = this.getSheetId();
|
|
821
|
-
return this._injector.createInstance(
|
|
821
|
+
return this._injector.createInstance(b, e, t);
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
|
-
|
|
825
|
-
class
|
|
824
|
+
z.extend(de);
|
|
825
|
+
class ce extends W {
|
|
826
826
|
get DrawingType() {
|
|
827
|
-
return
|
|
827
|
+
return _;
|
|
828
828
|
}
|
|
829
829
|
get ImageSourceType() {
|
|
830
830
|
return f;
|
|
831
831
|
}
|
|
832
832
|
get SheetDrawingAnchorType() {
|
|
833
|
-
return
|
|
833
|
+
return ne;
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
|
-
|
|
837
|
-
class
|
|
836
|
+
W.extend(ce);
|
|
837
|
+
class ge extends M {
|
|
838
838
|
get BeforeOverGridImageChange() {
|
|
839
839
|
return "BeforeOverGridImageChange";
|
|
840
840
|
}
|
|
@@ -860,19 +860,19 @@ class me extends H {
|
|
|
860
860
|
return "OverGridImageSelected";
|
|
861
861
|
}
|
|
862
862
|
}
|
|
863
|
-
|
|
864
|
-
class
|
|
863
|
+
M.extend(ge);
|
|
864
|
+
class me extends H {
|
|
865
865
|
/**
|
|
866
866
|
* @ignore
|
|
867
867
|
*/
|
|
868
868
|
// eslint-disable-next-line max-lines-per-function
|
|
869
869
|
_initialize(e) {
|
|
870
|
-
const t = e.get(
|
|
870
|
+
const t = e.get(P);
|
|
871
871
|
this.registerEventHandler(
|
|
872
872
|
this.Event.BeforeOverGridImageInsert,
|
|
873
|
-
() => t.beforeCommandExecuted((
|
|
874
|
-
if (
|
|
875
|
-
const n =
|
|
873
|
+
() => t.beforeCommandExecuted((i) => {
|
|
874
|
+
if (i.id !== p.id) return;
|
|
875
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
876
876
|
if (s == null || n == null)
|
|
877
877
|
return;
|
|
878
878
|
const { drawings: o } = n, d = {
|
|
@@ -880,13 +880,13 @@ class he extends z {
|
|
|
880
880
|
insertImageParams: o
|
|
881
881
|
};
|
|
882
882
|
if (this.fireEvent(this.Event.BeforeOverGridImageInsert, d), d.cancel)
|
|
883
|
-
throw new
|
|
883
|
+
throw new Error("Canceled by BeforeOverGridImageInsert event");
|
|
884
884
|
})
|
|
885
885
|
), this.registerEventHandler(
|
|
886
886
|
this.Event.BeforeOverGridImageRemove,
|
|
887
|
-
() => t.beforeCommandExecuted((
|
|
888
|
-
if (
|
|
889
|
-
const n =
|
|
887
|
+
() => t.beforeCommandExecuted((i) => {
|
|
888
|
+
if (i.id !== S.id) return;
|
|
889
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
890
890
|
if (s == null || n == null)
|
|
891
891
|
return;
|
|
892
892
|
const o = e.get(I), { drawings: d } = n, a = d.map((c) => o.getDrawingByParam(c)), g = {
|
|
@@ -894,13 +894,13 @@ class he extends z {
|
|
|
894
894
|
images: this._createFOverGridImage(a)
|
|
895
895
|
};
|
|
896
896
|
if (this.fireEvent(this.Event.BeforeOverGridImageRemove, g), g.cancel)
|
|
897
|
-
throw new
|
|
897
|
+
throw new Error("Canceled by BeforeOverGridImageRemove event");
|
|
898
898
|
})
|
|
899
899
|
), this.registerEventHandler(
|
|
900
900
|
this.Event.BeforeOverGridImageChange,
|
|
901
|
-
() => t.beforeCommandExecuted((
|
|
902
|
-
if (
|
|
903
|
-
const n =
|
|
901
|
+
() => t.beforeCommandExecuted((i) => {
|
|
902
|
+
if (i.id !== h.id) return;
|
|
903
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
904
904
|
if (s == null || n == null)
|
|
905
905
|
return;
|
|
906
906
|
const { drawings: o } = n, d = e.get(I), a = [];
|
|
@@ -916,13 +916,13 @@ class he extends z {
|
|
|
916
916
|
images: a
|
|
917
917
|
};
|
|
918
918
|
if (this.fireEvent(this.Event.BeforeOverGridImageChange, g), g.cancel)
|
|
919
|
-
throw d.updateNotification(o), new
|
|
919
|
+
throw d.updateNotification(o), new Error("Canceled by BeforeOverGridImageChange event");
|
|
920
920
|
})
|
|
921
921
|
), this.registerEventHandler(
|
|
922
922
|
this.Event.BeforeOverGridImageSelect,
|
|
923
|
-
() => t.beforeCommandExecuted((
|
|
924
|
-
if (
|
|
925
|
-
const n =
|
|
923
|
+
() => t.beforeCommandExecuted((i) => {
|
|
924
|
+
if (i.id !== x.id) return;
|
|
925
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
926
926
|
if (s == null)
|
|
927
927
|
return;
|
|
928
928
|
const o = e.get(I), d = o.getFocusDrawings(), a = n.map((c) => o.getDrawingByParam(c)), g = {
|
|
@@ -931,13 +931,13 @@ class he extends z {
|
|
|
931
931
|
oldSelectedImages: this._createFOverGridImage(d)
|
|
932
932
|
};
|
|
933
933
|
if (this.fireEvent(this.Event.BeforeOverGridImageSelect, g), g.cancel)
|
|
934
|
-
throw new
|
|
934
|
+
throw new Error("Canceled by BeforeOverGridImageSelect event");
|
|
935
935
|
})
|
|
936
936
|
), this.registerEventHandler(
|
|
937
937
|
this.Event.OverGridImageInserted,
|
|
938
|
-
() => t.onCommandExecuted((
|
|
939
|
-
if (
|
|
940
|
-
const n =
|
|
938
|
+
() => t.onCommandExecuted((i) => {
|
|
939
|
+
if (i.id !== p.id) return;
|
|
940
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
941
941
|
if (s == null || n == null)
|
|
942
942
|
return;
|
|
943
943
|
const { drawings: o } = n;
|
|
@@ -948,9 +948,9 @@ class he extends z {
|
|
|
948
948
|
})
|
|
949
949
|
), this.registerEventHandler(
|
|
950
950
|
this.Event.OverGridImageRemoved,
|
|
951
|
-
() => t.onCommandExecuted((
|
|
952
|
-
if (
|
|
953
|
-
const n =
|
|
951
|
+
() => t.onCommandExecuted((i) => {
|
|
952
|
+
if (i.id !== S.id) return;
|
|
953
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
954
954
|
if (s == null || n == null)
|
|
955
955
|
return;
|
|
956
956
|
const { drawings: o } = n;
|
|
@@ -961,9 +961,9 @@ class he extends z {
|
|
|
961
961
|
})
|
|
962
962
|
), this.registerEventHandler(
|
|
963
963
|
this.Event.OverGridImageChanged,
|
|
964
|
-
() => t.onCommandExecuted((
|
|
965
|
-
if (
|
|
966
|
-
const n =
|
|
964
|
+
() => t.onCommandExecuted((i) => {
|
|
965
|
+
if (i.id !== h.id) return;
|
|
966
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
967
967
|
if (s == null || n == null)
|
|
968
968
|
return;
|
|
969
969
|
const { drawings: o } = n, d = e.get(I), a = o.map((g) => this._injector.createInstance(m, d.getDrawingByParam(g)));
|
|
@@ -974,9 +974,9 @@ class he extends z {
|
|
|
974
974
|
})
|
|
975
975
|
), this.registerEventHandler(
|
|
976
976
|
this.Event.OverGridImageSelected,
|
|
977
|
-
() => t.onCommandExecuted((
|
|
978
|
-
if (
|
|
979
|
-
const n =
|
|
977
|
+
() => t.onCommandExecuted((i) => {
|
|
978
|
+
if (i.id !== x.id) return;
|
|
979
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
980
980
|
if (s == null)
|
|
981
981
|
return;
|
|
982
982
|
const o = e.get(I), d = n.map((a) => o.getDrawingByParam(a));
|
|
@@ -991,12 +991,12 @@ class he extends z {
|
|
|
991
991
|
return e.map((t) => this._injector.createInstance(m, t));
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
|
-
|
|
995
|
-
class
|
|
994
|
+
H.extend(me);
|
|
995
|
+
class he extends N {
|
|
996
996
|
async insertCellImageAsync(e) {
|
|
997
997
|
var s;
|
|
998
|
-
const t = this._injector.get(
|
|
999
|
-
if (!
|
|
998
|
+
const t = this._injector.get(B), i = (s = Z(Y.UNIVER_SHEET, this._injector.get(q), t)) == null ? void 0 : s.with(ee);
|
|
999
|
+
if (!i)
|
|
1000
1000
|
return !1;
|
|
1001
1001
|
const n = {
|
|
1002
1002
|
unitId: this._workbook.getUnitId(),
|
|
@@ -1004,7 +1004,7 @@ class ue extends $ {
|
|
|
1004
1004
|
row: this.getRow(),
|
|
1005
1005
|
col: this.getColumn()
|
|
1006
1006
|
};
|
|
1007
|
-
return typeof e == "string" ?
|
|
1007
|
+
return typeof e == "string" ? i.insertCellImageByUrl(e, n) : i.insertCellImageByFile(e, n);
|
|
1008
1008
|
}
|
|
1009
1009
|
}
|
|
1010
|
-
|
|
1010
|
+
N.extend(he);
|