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