@univerjs/sheets-drawing-ui 0.6.1-nightly.202502251606 → 0.6.2-nightly.202503031606
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 +1 -1
- package/lib/es/facade.js +160 -144
- package/lib/es/index.js +1468 -1379
- package/lib/types/controllers/sheet-cell-image.controller.d.ts +1 -0
- package/lib/types/controllers/sheet-drawing-update.controller.d.ts +2 -0
- package/lib/types/facade/f-over-grid-image.d.ts +5 -5
- package/lib/types/facade/f-range.d.ts +27 -0
- package/lib/types/facade/index.d.ts +2 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +16 -17
package/lib/es/facade.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
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 S, SetSheetDrawingCommand as h, SetDrawingArrangeCommand as w, SheetCanvasFloatDomManagerService as D, InsertSheetDrawingCommand as p } from "@univerjs/sheets-drawing-ui";
|
|
9
|
-
import { SheetSkeletonManagerService as F, ISheetSelectionRenderService as
|
|
10
|
-
import { ISheetDrawingService as l, SheetDrawingAnchorType as
|
|
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
11
|
import { transformComponentKey as R } from "@univerjs/sheets-ui/facade";
|
|
12
|
-
import { FWorksheet as z } from "@univerjs/sheets/facade";
|
|
12
|
+
import { FWorksheet as z, FRange as N } from "@univerjs/sheets/facade";
|
|
13
13
|
import { ComponentManager as G } from "@univerjs/ui";
|
|
14
|
-
var
|
|
15
|
-
for (var n = i > 1 ? void 0 : i ?
|
|
16
|
-
(o =
|
|
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: i, flipY: n = !1, flipX: s = !1, angle: o = 0, skewX: d = 0, skewY: a = 0 } =
|
|
21
|
-
|
|
22
|
-
|
|
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
23
|
{ from: t, to: i },
|
|
24
|
-
|
|
24
|
+
e
|
|
25
25
|
), { width: E, height: C } = k;
|
|
26
26
|
return {
|
|
27
|
-
...
|
|
27
|
+
...r,
|
|
28
28
|
column: g,
|
|
29
29
|
columnOffset: c,
|
|
30
30
|
row: u,
|
|
@@ -38,18 +38,18 @@ function te(e, r) {
|
|
|
38
38
|
skewY: a
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
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 } =
|
|
43
|
-
|
|
44
|
-
|
|
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
45
|
{ column: i, columnOffset: n, row: s, rowOffset: o },
|
|
46
46
|
O,
|
|
47
47
|
k,
|
|
48
|
-
|
|
48
|
+
e,
|
|
49
49
|
t
|
|
50
|
-
), { sheetTransform: C, transform:
|
|
50
|
+
), { sheetTransform: C, transform: K } = E;
|
|
51
51
|
return {
|
|
52
|
-
...
|
|
52
|
+
...r,
|
|
53
53
|
sheetTransform: {
|
|
54
54
|
...C,
|
|
55
55
|
flipY: d,
|
|
@@ -59,7 +59,7 @@ function re(e, r, 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,
|
|
@@ -69,15 +69,15 @@ function re(e, r, t) {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
let b = class {
|
|
72
|
-
constructor(
|
|
73
|
-
|
|
72
|
+
constructor(r, e, t) {
|
|
73
|
+
U(this, "_image");
|
|
74
74
|
this._injector = t, this._image = {
|
|
75
75
|
drawingId: X(6),
|
|
76
76
|
drawingType: _.DRAWING_IMAGE,
|
|
77
77
|
imageSourceType: f.BASE64,
|
|
78
78
|
source: "",
|
|
79
|
-
unitId:
|
|
80
|
-
subUnitId:
|
|
79
|
+
unitId: r,
|
|
80
|
+
subUnitId: e,
|
|
81
81
|
column: 0,
|
|
82
82
|
columnOffset: 0,
|
|
83
83
|
row: 0,
|
|
@@ -111,12 +111,12 @@ let b = 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 ${
|
|
117
|
+
throw new Error(`Render Unit with unitId ${r.unitId} not found`);
|
|
118
118
|
const i = t.with(F);
|
|
119
|
-
return
|
|
119
|
+
return r.sheetTransform == null && (r.sheetTransform = {
|
|
120
120
|
from: {
|
|
121
121
|
column: 0,
|
|
122
122
|
columnOffset: 0,
|
|
@@ -129,11 +129,11 @@ let b = 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(
|
|
135
|
-
const t =
|
|
136
|
-
return this._image.source =
|
|
134
|
+
setSource(r, e) {
|
|
135
|
+
const t = e != null ? e : f.URL;
|
|
136
|
+
return this._image.source = r, this._image.imageSourceType = t, this;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Get the source of the image
|
|
@@ -169,7 +169,7 @@ let b = class {
|
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* Set the horizontal position of the image
|
|
172
|
-
* @param {number} column - The column index of the image start position
|
|
172
|
+
* @param {number} column - The column index of the image start position, start at 0
|
|
173
173
|
* @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
|
|
174
174
|
* @example
|
|
175
175
|
* ```ts
|
|
@@ -185,12 +185,12 @@ let b = 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
|
|
193
|
-
* @param {number} row - The row index of the image start position
|
|
193
|
+
* @param {number} row - The row index of the image start position, start at 0
|
|
194
194
|
* @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
|
|
195
195
|
* @example
|
|
196
196
|
* ```ts
|
|
@@ -206,8 +206,8 @@ let b = 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 b = 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 b = 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 b = 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 b = 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 b = 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 b = 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 b = 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 b = 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 b = 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 b = 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
|
|
477
|
-
if (!
|
|
476
|
+
const e = this._injector.get(B).getRenderById(this._image.unitId);
|
|
477
|
+
if (!e)
|
|
478
478
|
throw new Error(`Render Unit with unitId ${this._image.unitId} not found`);
|
|
479
|
-
const t =
|
|
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
|
-
b =
|
|
488
|
-
|
|
487
|
+
b = $([
|
|
488
|
+
T(2, A(j))
|
|
489
489
|
], b);
|
|
490
|
-
let m = class extends
|
|
491
|
-
constructor(
|
|
492
|
-
super(), this._image =
|
|
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
|
|
@@ -552,16 +552,16 @@ let m = class extends Y {
|
|
|
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(
|
|
559
|
-
const t =
|
|
560
|
-
return this._image.source =
|
|
558
|
+
setSource(r, e) {
|
|
559
|
+
const t = e != null ? e : f.URL;
|
|
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(
|
|
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,9 +580,9 @@ let m = class extends Y {
|
|
|
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(
|
|
585
|
+
t.setWidth(r), t.setHeight(e);
|
|
586
586
|
const i = await t.buildAsync();
|
|
587
587
|
return this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [i] });
|
|
588
588
|
}
|
|
@@ -603,13 +603,13 @@ let m = class extends Y {
|
|
|
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 Y {
|
|
|
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
|
|
@@ -650,7 +650,7 @@ let m = class extends Y {
|
|
|
650
650
|
}
|
|
651
651
|
/**
|
|
652
652
|
* Move the image layer backward by one level
|
|
653
|
-
* @returns
|
|
653
|
+
* @returns {boolean} true if the image is moved backward successfully, otherwise false
|
|
654
654
|
* @example
|
|
655
655
|
* ```ts
|
|
656
656
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -670,7 +670,7 @@ let m = class extends Y {
|
|
|
670
670
|
}
|
|
671
671
|
/**
|
|
672
672
|
* Move the image layer to the bottom layer
|
|
673
|
-
* @returns
|
|
673
|
+
* @returns {boolean} true if the image is moved to the bottom layer successfully, otherwise false
|
|
674
674
|
* @example
|
|
675
675
|
* ```ts
|
|
676
676
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -690,7 +690,7 @@ let m = class extends Y {
|
|
|
690
690
|
}
|
|
691
691
|
/**
|
|
692
692
|
* Move the image layer to the top layer
|
|
693
|
-
* @returns
|
|
693
|
+
* @returns {boolean} true if the image is moved to the top layer successfully, otherwise false
|
|
694
694
|
* @example
|
|
695
695
|
* ```ts
|
|
696
696
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -709,13 +709,13 @@ let m = class extends Y {
|
|
|
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
|
|
717
|
-
addFloatDomToPosition(
|
|
718
|
-
const i = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), { key: s, disposableCollection: o } = R(
|
|
716
|
+
class de extends z {
|
|
717
|
+
addFloatDomToPosition(e, t) {
|
|
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 ie extends z {
|
|
|
723
723
|
}
|
|
724
724
|
}) : (o.dispose(), null);
|
|
725
725
|
}
|
|
726
|
-
addFloatDomToRange(
|
|
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(
|
|
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 ie extends z {
|
|
|
732
732
|
}
|
|
733
733
|
}) : (a.dispose(), null);
|
|
734
734
|
}
|
|
735
|
-
addFloatDomToColumnHeader(
|
|
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(
|
|
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,24 +741,24 @@ class ie extends z {
|
|
|
741
741
|
}
|
|
742
742
|
}) : (a.dispose(), null);
|
|
743
743
|
}
|
|
744
|
-
async insertImage(
|
|
744
|
+
async insertImage(e, t, i, n, s) {
|
|
745
745
|
const o = this.newOverGridImage();
|
|
746
|
-
if (typeof
|
|
747
|
-
o.setSource(
|
|
746
|
+
if (typeof e == "string")
|
|
747
|
+
o.setSource(e);
|
|
748
748
|
else {
|
|
749
|
-
const g = await
|
|
749
|
+
const g = await e.getBlob().getDataAsString();
|
|
750
750
|
o.setSource(g, f.BASE64);
|
|
751
751
|
}
|
|
752
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
754
|
return this._commandService.syncExecuteCommand(p.id, { unitId: this._fWorkbook.getId(), drawings: [d] });
|
|
755
755
|
}
|
|
756
|
-
insertImages(
|
|
757
|
-
const t =
|
|
756
|
+
insertImages(e) {
|
|
757
|
+
const t = e.map((i) => (i.unitId = this._fWorkbook.getId(), i.subUnitId = this.getSheetId(), i));
|
|
758
758
|
return this._commandService.syncExecuteCommand(p.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
|
|
759
759
|
}
|
|
760
|
-
deleteImages(
|
|
761
|
-
const t =
|
|
760
|
+
deleteImages(e) {
|
|
761
|
+
const t = e.map((i) => ({
|
|
762
762
|
unitId: this._fWorkbook.getId(),
|
|
763
763
|
drawingId: i.getId(),
|
|
764
764
|
subUnitId: this.getSheetId(),
|
|
@@ -774,8 +774,8 @@ class ie extends z {
|
|
|
774
774
|
}
|
|
775
775
|
return i;
|
|
776
776
|
}
|
|
777
|
-
getImageById(
|
|
778
|
-
const i = this._injector.get(l).getDrawingByParam({ unitId: this._fWorkbook.getId(), subUnitId: this.getSheetId(), drawingId:
|
|
777
|
+
getImageById(e) {
|
|
778
|
+
const i = this._injector.get(l).getDrawingByParam({ unitId: this._fWorkbook.getId(), subUnitId: this.getSheetId(), drawingId: e });
|
|
779
779
|
return i && i.drawingType === _.DRAWING_IMAGE ? this._injector.createInstance(m, i) : null;
|
|
780
780
|
}
|
|
781
781
|
getActiveImages() {
|
|
@@ -786,43 +786,43 @@ class ie extends z {
|
|
|
786
786
|
}
|
|
787
787
|
return i;
|
|
788
788
|
}
|
|
789
|
-
updateImages(
|
|
790
|
-
return this._commandService.syncExecuteCommand(h.id, { unitId: this._fWorkbook.getId(), drawings:
|
|
789
|
+
updateImages(e) {
|
|
790
|
+
return this._commandService.syncExecuteCommand(h.id, { unitId: this._fWorkbook.getId(), drawings: e }), this;
|
|
791
791
|
}
|
|
792
|
-
onImageInserted(
|
|
792
|
+
onImageInserted(e) {
|
|
793
793
|
const t = this._injector.get(l);
|
|
794
794
|
return y(t.add$.subscribe((i) => {
|
|
795
795
|
const n = i.map(
|
|
796
796
|
(s) => this._injector.createInstance(m, t.getDrawingByParam(s))
|
|
797
797
|
);
|
|
798
|
-
|
|
798
|
+
e(n);
|
|
799
799
|
}));
|
|
800
800
|
}
|
|
801
|
-
onImageDeleted(
|
|
801
|
+
onImageDeleted(e) {
|
|
802
802
|
const t = this._injector.get(l);
|
|
803
803
|
return y(t.remove$.subscribe((i) => {
|
|
804
804
|
const n = i.map(
|
|
805
805
|
(s) => this._injector.createInstance(m, t.getDrawingByParam(s))
|
|
806
806
|
);
|
|
807
|
-
|
|
807
|
+
e(n);
|
|
808
808
|
}));
|
|
809
809
|
}
|
|
810
|
-
onImageChanged(
|
|
810
|
+
onImageChanged(e) {
|
|
811
811
|
const t = this._injector.get(l);
|
|
812
812
|
return y(t.update$.subscribe((i) => {
|
|
813
813
|
const n = i.map(
|
|
814
814
|
(s) => this._injector.createInstance(m, t.getDrawingByParam(s))
|
|
815
815
|
);
|
|
816
|
-
|
|
816
|
+
e(n);
|
|
817
817
|
}));
|
|
818
818
|
}
|
|
819
819
|
newOverGridImage() {
|
|
820
|
-
const
|
|
821
|
-
return this._injector.createInstance(b,
|
|
820
|
+
const e = this._fWorkbook.getId(), t = this.getSheetId();
|
|
821
|
+
return this._injector.createInstance(b, e, t);
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
|
-
z.extend(
|
|
825
|
-
class
|
|
824
|
+
z.extend(de);
|
|
825
|
+
class ce extends W {
|
|
826
826
|
get DrawingType() {
|
|
827
827
|
return _;
|
|
828
828
|
}
|
|
@@ -830,11 +830,11 @@ class ne extends W {
|
|
|
830
830
|
return f;
|
|
831
831
|
}
|
|
832
832
|
get SheetDrawingAnchorType() {
|
|
833
|
-
return
|
|
833
|
+
return ne;
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
|
-
W.extend(
|
|
837
|
-
class
|
|
836
|
+
W.extend(ce);
|
|
837
|
+
class ge extends M {
|
|
838
838
|
get BeforeOverGridImageChange() {
|
|
839
839
|
return "BeforeOverGridImageChange";
|
|
840
840
|
}
|
|
@@ -860,14 +860,14 @@ class se extends M {
|
|
|
860
860
|
return "OverGridImageSelected";
|
|
861
861
|
}
|
|
862
862
|
}
|
|
863
|
-
M.extend(
|
|
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
|
-
_initialize(
|
|
870
|
-
const t =
|
|
869
|
+
_initialize(e) {
|
|
870
|
+
const t = e.get(P);
|
|
871
871
|
this.registerEventHandler(
|
|
872
872
|
this.Event.BeforeOverGridImageInsert,
|
|
873
873
|
() => t.beforeCommandExecuted((i) => {
|
|
@@ -889,7 +889,7 @@ class oe extends H {
|
|
|
889
889
|
const n = i.params, s = this.getActiveWorkbook();
|
|
890
890
|
if (s == null || n == null)
|
|
891
891
|
return;
|
|
892
|
-
const o =
|
|
892
|
+
const o = e.get(I), { drawings: d } = n, a = d.map((c) => o.getDrawingByParam(c)), g = {
|
|
893
893
|
workbook: s,
|
|
894
894
|
images: this._createFOverGridImage(a)
|
|
895
895
|
};
|
|
@@ -903,7 +903,7 @@ class oe extends H {
|
|
|
903
903
|
const n = i.params, s = this.getActiveWorkbook();
|
|
904
904
|
if (s == null || n == null)
|
|
905
905
|
return;
|
|
906
|
-
const { drawings: o } = n, d =
|
|
906
|
+
const { drawings: o } = n, d = e.get(I), a = [];
|
|
907
907
|
o.forEach((c) => {
|
|
908
908
|
const u = d.getDrawingByParam(c);
|
|
909
909
|
u != null && a.push({
|
|
@@ -925,7 +925,7 @@ class oe extends H {
|
|
|
925
925
|
const n = i.params, s = this.getActiveWorkbook();
|
|
926
926
|
if (s == null)
|
|
927
927
|
return;
|
|
928
|
-
const o =
|
|
928
|
+
const o = e.get(I), d = o.getFocusDrawings(), a = n.map((c) => o.getDrawingByParam(c)), g = {
|
|
929
929
|
workbook: s,
|
|
930
930
|
selectedImages: this._createFOverGridImage(a),
|
|
931
931
|
oldSelectedImages: this._createFOverGridImage(d)
|
|
@@ -966,7 +966,7 @@ class oe extends H {
|
|
|
966
966
|
const n = i.params, s = this.getActiveWorkbook();
|
|
967
967
|
if (s == null || n == null)
|
|
968
968
|
return;
|
|
969
|
-
const { drawings: o } = n, d =
|
|
969
|
+
const { drawings: o } = n, d = e.get(I), a = o.map((g) => this._injector.createInstance(m, d.getDrawingByParam(g)));
|
|
970
970
|
this.fireEvent(this.Event.OverGridImageChanged, {
|
|
971
971
|
workbook: s,
|
|
972
972
|
images: a
|
|
@@ -979,7 +979,7 @@ class oe extends H {
|
|
|
979
979
|
const n = i.params, s = this.getActiveWorkbook();
|
|
980
980
|
if (s == null)
|
|
981
981
|
return;
|
|
982
|
-
const o =
|
|
982
|
+
const o = e.get(I), d = n.map((a) => o.getDrawingByParam(a));
|
|
983
983
|
this.fireEvent(this.Event.OverGridImageSelected, {
|
|
984
984
|
workbook: s,
|
|
985
985
|
selectedImages: this._createFOverGridImage(d)
|
|
@@ -987,8 +987,24 @@ class oe extends H {
|
|
|
987
987
|
})
|
|
988
988
|
);
|
|
989
989
|
}
|
|
990
|
-
_createFOverGridImage(
|
|
991
|
-
return
|
|
990
|
+
_createFOverGridImage(e) {
|
|
991
|
+
return e.map((t) => this._injector.createInstance(m, t));
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
|
-
H.extend(
|
|
994
|
+
H.extend(me);
|
|
995
|
+
class he extends N {
|
|
996
|
+
async insertCellImageAsync(e) {
|
|
997
|
+
var s;
|
|
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
|
+
return !1;
|
|
1001
|
+
const n = {
|
|
1002
|
+
unitId: this._workbook.getUnitId(),
|
|
1003
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
1004
|
+
row: this.getRow(),
|
|
1005
|
+
col: this.getColumn()
|
|
1006
|
+
};
|
|
1007
|
+
return typeof e == "string" ? i.insertCellImageByUrl(e, n) : i.insertCellImageByFile(e, n);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
N.extend(he);
|