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