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