@univerjs/sheets-drawing-ui 0.5.5-experimental.20250122-3362a4a → 0.5.5-nightly.202501201336
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 +9 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +330 -346
- package/lib/es/index.js +2366 -2526
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/types/controllers/sheet-drawing-copy-paste.controller.d.ts +5 -11
- package/lib/types/controllers/sheet-drawing-update.controller.d.ts +2 -2
- package/lib/types/controllers/sheet-drawing.controller.d.ts +1 -5
- package/lib/types/facade/f-over-grid-image.d.ts +0 -6
- package/lib/types/facade/f-univer.d.ts +0 -6
- package/lib/types/views/sheet-image-panel/SheetDrawingAnchor.d.ts +2 -1
- package/lib/types/views/sheet-image-panel/SheetDrawingPanel.d.ts +2 -16
- package/lib/types/views/upload-loading/UploadLoading.d.ts +2 -16
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +9 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +13 -13
package/lib/es/facade.js
CHANGED
|
@@ -1,86 +1,82 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
), { left, top, width, height } = absolutePosition;
|
|
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
|
+
t
|
|
24
|
+
), { left: B, top: j, width: O, height: K } = k;
|
|
26
25
|
return {
|
|
27
|
-
...
|
|
28
|
-
column:
|
|
29
|
-
columnOffset:
|
|
30
|
-
row:
|
|
31
|
-
rowOffset:
|
|
32
|
-
width,
|
|
33
|
-
height,
|
|
34
|
-
flipY,
|
|
35
|
-
flipX,
|
|
36
|
-
angle,
|
|
37
|
-
skewX,
|
|
38
|
-
skewY
|
|
26
|
+
...r,
|
|
27
|
+
column: h,
|
|
28
|
+
columnOffset: d,
|
|
29
|
+
row: f,
|
|
30
|
+
rowOffset: p,
|
|
31
|
+
width: O,
|
|
32
|
+
height: K,
|
|
33
|
+
flipY: n,
|
|
34
|
+
flipX: s,
|
|
35
|
+
angle: o,
|
|
36
|
+
skewX: c,
|
|
37
|
+
skewY: a
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
), { sheetTransform, transform } = absolutePosition;
|
|
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 },
|
|
45
|
+
p,
|
|
46
|
+
k,
|
|
47
|
+
t,
|
|
48
|
+
e
|
|
49
|
+
), { sheetTransform: j, transform: O } = B;
|
|
52
50
|
return {
|
|
53
|
-
...
|
|
51
|
+
...r,
|
|
54
52
|
sheetTransform: {
|
|
55
|
-
...
|
|
56
|
-
flipY,
|
|
57
|
-
flipX,
|
|
58
|
-
angle,
|
|
59
|
-
skewX,
|
|
60
|
-
skewY
|
|
53
|
+
...j,
|
|
54
|
+
flipY: c,
|
|
55
|
+
flipX: a,
|
|
56
|
+
angle: h,
|
|
57
|
+
skewX: d,
|
|
58
|
+
skewY: f
|
|
61
59
|
},
|
|
62
60
|
transform: {
|
|
63
|
-
...
|
|
64
|
-
flipY,
|
|
65
|
-
flipX,
|
|
66
|
-
angle,
|
|
67
|
-
skewX,
|
|
68
|
-
skewY
|
|
61
|
+
...O,
|
|
62
|
+
flipY: c,
|
|
63
|
+
flipX: a,
|
|
64
|
+
angle: h,
|
|
65
|
+
skewX: d,
|
|
66
|
+
skewY: f
|
|
69
67
|
}
|
|
70
68
|
};
|
|
71
69
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
drawingType: DrawingTypeEnum.DRAWING_IMAGE,
|
|
80
|
-
imageSourceType: ImageSourceType.BASE64,
|
|
70
|
+
let b = class {
|
|
71
|
+
constructor(r, t, e) {
|
|
72
|
+
T(this, "_image");
|
|
73
|
+
this._injector = e, this._image = {
|
|
74
|
+
drawingId: Y(6),
|
|
75
|
+
drawingType: _.DRAWING_IMAGE,
|
|
76
|
+
imageSourceType: I.BASE64,
|
|
81
77
|
source: "",
|
|
82
|
-
unitId,
|
|
83
|
-
subUnitId,
|
|
78
|
+
unitId: r,
|
|
79
|
+
subUnitId: t,
|
|
84
80
|
column: 0,
|
|
85
81
|
columnOffset: 0,
|
|
86
82
|
row: 0,
|
|
@@ -110,12 +106,12 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
110
106
|
* activeSheet.insertImages([param]);
|
|
111
107
|
* ```
|
|
112
108
|
*/
|
|
113
|
-
setImage(
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
116
|
-
throw new Error(`Render Unit with unitId ${
|
|
117
|
-
const
|
|
118
|
-
return
|
|
109
|
+
setImage(r) {
|
|
110
|
+
const e = this._injector.get(F).getRenderById(r.unitId);
|
|
111
|
+
if (!e)
|
|
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 = {
|
|
119
115
|
from: {
|
|
120
116
|
column: 0,
|
|
121
117
|
columnOffset: 0,
|
|
@@ -128,11 +124,11 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
128
124
|
row: 0,
|
|
129
125
|
rowOffset: 0
|
|
130
126
|
}
|
|
131
|
-
}), this._image =
|
|
127
|
+
}), this._image = re(r, i), this;
|
|
132
128
|
}
|
|
133
|
-
setSource(
|
|
134
|
-
const
|
|
135
|
-
return this._image.source =
|
|
129
|
+
setSource(r, t) {
|
|
130
|
+
const e = t != null ? t : I.URL;
|
|
131
|
+
return this._image.source = r, this._image.imageSourceType = e, this;
|
|
136
132
|
}
|
|
137
133
|
getsource() {
|
|
138
134
|
return this._image.source;
|
|
@@ -154,8 +150,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
154
150
|
* activeSheet.insertImages([param]);
|
|
155
151
|
* ```
|
|
156
152
|
*/
|
|
157
|
-
setColumn(
|
|
158
|
-
return this._image.column =
|
|
153
|
+
setColumn(r) {
|
|
154
|
+
return this._image.column = r, this;
|
|
159
155
|
}
|
|
160
156
|
/**
|
|
161
157
|
* Set the position of the image
|
|
@@ -171,8 +167,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
171
167
|
* activeSheet.insertImages([param]);
|
|
172
168
|
* ```
|
|
173
169
|
*/
|
|
174
|
-
setRow(
|
|
175
|
-
return this._image.row =
|
|
170
|
+
setRow(r) {
|
|
171
|
+
return this._image.row = r, this;
|
|
176
172
|
}
|
|
177
173
|
/**
|
|
178
174
|
* Set the column offset of the image in a unit
|
|
@@ -188,8 +184,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
188
184
|
* activeSheet.insertImages([param]);
|
|
189
185
|
* ```
|
|
190
186
|
*/
|
|
191
|
-
setColumnOffset(
|
|
192
|
-
return this._image.columnOffset =
|
|
187
|
+
setColumnOffset(r) {
|
|
188
|
+
return this._image.columnOffset = r, this;
|
|
193
189
|
}
|
|
194
190
|
/**
|
|
195
191
|
* Set the row offset of the image in a unit
|
|
@@ -205,8 +201,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
205
201
|
* activeSheet.insertImages([param]);
|
|
206
202
|
* ```
|
|
207
203
|
*/
|
|
208
|
-
setRowOffset(
|
|
209
|
-
return this._image.rowOffset =
|
|
204
|
+
setRowOffset(r) {
|
|
205
|
+
return this._image.rowOffset = r, this;
|
|
210
206
|
}
|
|
211
207
|
/**
|
|
212
208
|
* set the width of the image
|
|
@@ -222,8 +218,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
222
218
|
* activeSheet.insertImages([param]);
|
|
223
219
|
* ```
|
|
224
220
|
*/
|
|
225
|
-
setWidth(
|
|
226
|
-
return this._image.width =
|
|
221
|
+
setWidth(r) {
|
|
222
|
+
return this._image.width = r, this;
|
|
227
223
|
}
|
|
228
224
|
/**
|
|
229
225
|
* Set the height of the image
|
|
@@ -239,8 +235,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
239
235
|
* activeSheet.insertImages([param]);
|
|
240
236
|
* ```
|
|
241
237
|
*/
|
|
242
|
-
setHeight(
|
|
243
|
-
return this._image.height =
|
|
238
|
+
setHeight(r) {
|
|
239
|
+
return this._image.height = r, this;
|
|
244
240
|
}
|
|
245
241
|
/**
|
|
246
242
|
* Set the anchor type of the image, whether the position and size change with the cell
|
|
@@ -256,8 +252,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
256
252
|
* activeSheet.insertImages([param]);
|
|
257
253
|
* ```
|
|
258
254
|
*/
|
|
259
|
-
setAnchorType(
|
|
260
|
-
return this._image.anchorType =
|
|
255
|
+
setAnchorType(r) {
|
|
256
|
+
return this._image.anchorType = r, this;
|
|
261
257
|
}
|
|
262
258
|
/**
|
|
263
259
|
* Set the cropping region of the image by defining the top edges, thereby displaying the specific part of the image you want.
|
|
@@ -273,8 +269,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
273
269
|
* activeSheet.insertImages([param]);
|
|
274
270
|
* ```
|
|
275
271
|
*/
|
|
276
|
-
setCropTop(
|
|
277
|
-
return this._initializeSrcRect(), this._image.srcRect.top =
|
|
272
|
+
setCropTop(r) {
|
|
273
|
+
return this._initializeSrcRect(), this._image.srcRect.top = r, this;
|
|
278
274
|
}
|
|
279
275
|
/**
|
|
280
276
|
* Set the cropping region of the image by defining the left edges, thereby displaying the specific part of the image you want.
|
|
@@ -290,8 +286,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
290
286
|
* activeSheet.insertImages([param]);
|
|
291
287
|
* ```
|
|
292
288
|
*/
|
|
293
|
-
setCropLeft(
|
|
294
|
-
return this._initializeSrcRect(), this._image.srcRect.left =
|
|
289
|
+
setCropLeft(r) {
|
|
290
|
+
return this._initializeSrcRect(), this._image.srcRect.left = r, this;
|
|
295
291
|
}
|
|
296
292
|
/**
|
|
297
293
|
* Set the cropping region of the image by defining the bottom edges, thereby displaying the specific part of the image you want.
|
|
@@ -307,8 +303,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
307
303
|
* activeSheet.insertImages([param]);
|
|
308
304
|
* ```
|
|
309
305
|
*/
|
|
310
|
-
setCropBottom(
|
|
311
|
-
return this._initializeSrcRect(), this._image.srcRect.bottom =
|
|
306
|
+
setCropBottom(r) {
|
|
307
|
+
return this._initializeSrcRect(), this._image.srcRect.bottom = r, this;
|
|
312
308
|
}
|
|
313
309
|
/**
|
|
314
310
|
* Set the cropping region of the image by defining the right edges, thereby displaying the specific part of the image you want.
|
|
@@ -324,8 +320,8 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
324
320
|
* activeSheet.insertImages([param]);
|
|
325
321
|
* ```
|
|
326
322
|
*/
|
|
327
|
-
setCropRight(
|
|
328
|
-
return this._initializeSrcRect(), this._image.srcRect.right =
|
|
323
|
+
setCropRight(r) {
|
|
324
|
+
return this._initializeSrcRect(), this._image.srcRect.right = r, this;
|
|
329
325
|
}
|
|
330
326
|
_initializeSrcRect() {
|
|
331
327
|
this._image.srcRect == null && (this._image.srcRect = {
|
|
@@ -349,38 +345,37 @@ let FOverGridImageBuilder = (_a = class {
|
|
|
349
345
|
* activeSheet.insertImages([param]);
|
|
350
346
|
* ```
|
|
351
347
|
*/
|
|
352
|
-
setRotate(
|
|
353
|
-
return this._image.angle =
|
|
348
|
+
setRotate(r) {
|
|
349
|
+
return this._image.angle = r, this;
|
|
354
350
|
}
|
|
355
351
|
// setPresetGeometry(prstGeom: PresetGeometryType): FOverGridImageBuilder {
|
|
356
352
|
// this._image.prstGeom = prstGeom;
|
|
357
353
|
// return this;
|
|
358
354
|
// }
|
|
359
|
-
setUnitId(
|
|
360
|
-
return this._image.unitId =
|
|
355
|
+
setUnitId(r) {
|
|
356
|
+
return this._image.unitId = r, this;
|
|
361
357
|
}
|
|
362
|
-
setSubUnitId(
|
|
363
|
-
return this._image.subUnitId =
|
|
358
|
+
setSubUnitId(r) {
|
|
359
|
+
return this._image.subUnitId = r, this;
|
|
364
360
|
}
|
|
365
361
|
async buildAsync() {
|
|
366
|
-
const
|
|
367
|
-
if (!
|
|
362
|
+
const t = this._injector.get(F).getRenderById(this._image.unitId);
|
|
363
|
+
if (!t)
|
|
368
364
|
throw new Error(`Render Unit with unitId ${this._image.unitId} not found`);
|
|
369
|
-
const
|
|
365
|
+
const e = t.with(J), i = t.with(U);
|
|
370
366
|
if (this._image.width === 0 || this._image.height === 0) {
|
|
371
|
-
const
|
|
372
|
-
this._image.width === 0 && (this._image.width =
|
|
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);
|
|
373
369
|
}
|
|
374
|
-
return
|
|
370
|
+
return ne(this._image, e, i);
|
|
375
371
|
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
],
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
super(), this._image = _image, this._commandService = _commandService, this._injector = _injector;
|
|
372
|
+
};
|
|
373
|
+
b = H([
|
|
374
|
+
R(2, x(P))
|
|
375
|
+
], b);
|
|
376
|
+
let g = class extends V {
|
|
377
|
+
constructor(r, t, e) {
|
|
378
|
+
super(), this._image = r, this._commandService = t, this._injector = e;
|
|
384
379
|
}
|
|
385
380
|
getId() {
|
|
386
381
|
return this._image.drawingId;
|
|
@@ -401,7 +396,7 @@ let FOverGridImage = (_a2 = class extends FBase {
|
|
|
401
396
|
* ```
|
|
402
397
|
*/
|
|
403
398
|
remove() {
|
|
404
|
-
return this._commandService.syncExecuteCommand(
|
|
399
|
+
return this._commandService.syncExecuteCommand(m.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
405
400
|
}
|
|
406
401
|
/**
|
|
407
402
|
* Convert the image to a FOverGridImageBuilder
|
|
@@ -418,18 +413,18 @@ let FOverGridImage = (_a2 = class extends FBase {
|
|
|
418
413
|
* ```
|
|
419
414
|
*/
|
|
420
415
|
toBuilder() {
|
|
421
|
-
const
|
|
422
|
-
return
|
|
416
|
+
const r = this._injector.createInstance(b);
|
|
417
|
+
return r.setImage(this._image), r;
|
|
423
418
|
}
|
|
424
|
-
setSource(
|
|
425
|
-
const
|
|
426
|
-
return this._image.source =
|
|
419
|
+
setSource(r, t) {
|
|
420
|
+
const e = t != null ? t : I.URL;
|
|
421
|
+
return this._image.source = r, this._image.imageSourceType = e, this._commandService.syncExecuteCommand(m.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
427
422
|
}
|
|
428
|
-
async setPositionAsync(
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
const
|
|
432
|
-
return this._commandService.syncExecuteCommand(
|
|
423
|
+
async setPositionAsync(r, t, e, i) {
|
|
424
|
+
const n = this.toBuilder();
|
|
425
|
+
n.setColumn(t), n.setRow(r), e != null && n.setRowOffset(e), i != null && n.setColumnOffset(i);
|
|
426
|
+
const s = await n.buildAsync();
|
|
427
|
+
return this._commandService.syncExecuteCommand(m.id, { unitId: this._image.unitId, drawings: [s] });
|
|
433
428
|
}
|
|
434
429
|
/**
|
|
435
430
|
* Set the size of the image
|
|
@@ -444,11 +439,11 @@ let FOverGridImage = (_a2 = class extends FBase {
|
|
|
444
439
|
* const image = activeSheet.getImages()[0];
|
|
445
440
|
* console.log('Set size state is ', image.setSize(50, 120));
|
|
446
441
|
*/
|
|
447
|
-
async setSizeAsync(
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
const
|
|
451
|
-
return this._commandService.syncExecuteCommand(
|
|
442
|
+
async setSizeAsync(r, t) {
|
|
443
|
+
const e = this.toBuilder();
|
|
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] });
|
|
452
447
|
}
|
|
453
448
|
/**
|
|
454
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.
|
|
@@ -466,13 +461,13 @@ let FOverGridImage = (_a2 = class extends FBase {
|
|
|
466
461
|
* console.log('Set crop state is ', image.setCrop(10, 10, 10, 10));
|
|
467
462
|
* ```
|
|
468
463
|
*/
|
|
469
|
-
setCrop(
|
|
464
|
+
setCrop(r, t, e, i) {
|
|
470
465
|
return this._image.srcRect == null && (this._image.srcRect = {
|
|
471
466
|
top: 0,
|
|
472
467
|
left: 0,
|
|
473
468
|
bottom: 0,
|
|
474
469
|
right: 0
|
|
475
|
-
}),
|
|
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] });
|
|
476
471
|
}
|
|
477
472
|
// setPresetGeometry(prstGeom: PresetGeometryType): boolean {
|
|
478
473
|
// this._image.prstGeom = prstGeom;
|
|
@@ -491,8 +486,8 @@ let FOverGridImage = (_a2 = class extends FBase {
|
|
|
491
486
|
* console.log('Set rotate state is ', image.setRotate(90));
|
|
492
487
|
* ```
|
|
493
488
|
*/
|
|
494
|
-
setRotate(
|
|
495
|
-
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] });
|
|
496
491
|
}
|
|
497
492
|
/**
|
|
498
493
|
* Move the image layer forward by one level
|
|
@@ -507,11 +502,11 @@ let FOverGridImage = (_a2 = class extends FBase {
|
|
|
507
502
|
* ```
|
|
508
503
|
*/
|
|
509
504
|
setForward() {
|
|
510
|
-
return this._commandService.syncExecuteCommand(
|
|
505
|
+
return this._commandService.syncExecuteCommand(w.id, {
|
|
511
506
|
unitId: this._image.unitId,
|
|
512
507
|
subUnitId: this._image.subUnitId,
|
|
513
508
|
drawingIds: [this._image.drawingId],
|
|
514
|
-
arrangeType:
|
|
509
|
+
arrangeType: v.forward
|
|
515
510
|
});
|
|
516
511
|
}
|
|
517
512
|
/**
|
|
@@ -527,11 +522,11 @@ let FOverGridImage = (_a2 = class extends FBase {
|
|
|
527
522
|
* ```
|
|
528
523
|
*/
|
|
529
524
|
setBackward() {
|
|
530
|
-
return this._commandService.syncExecuteCommand(
|
|
525
|
+
return this._commandService.syncExecuteCommand(w.id, {
|
|
531
526
|
unitId: this._image.unitId,
|
|
532
527
|
subUnitId: this._image.subUnitId,
|
|
533
528
|
drawingIds: [this._image.drawingId],
|
|
534
|
-
arrangeType:
|
|
529
|
+
arrangeType: v.backward
|
|
535
530
|
});
|
|
536
531
|
}
|
|
537
532
|
/**
|
|
@@ -547,11 +542,11 @@ let FOverGridImage = (_a2 = class extends FBase {
|
|
|
547
542
|
* ```
|
|
548
543
|
*/
|
|
549
544
|
setBack() {
|
|
550
|
-
return this._commandService.syncExecuteCommand(
|
|
545
|
+
return this._commandService.syncExecuteCommand(w.id, {
|
|
551
546
|
unitId: this._image.unitId,
|
|
552
547
|
subUnitId: this._image.subUnitId,
|
|
553
548
|
drawingIds: [this._image.drawingId],
|
|
554
|
-
arrangeType:
|
|
549
|
+
arrangeType: v.back
|
|
555
550
|
});
|
|
556
551
|
}
|
|
557
552
|
/**
|
|
@@ -567,144 +562,140 @@ let FOverGridImage = (_a2 = class extends FBase {
|
|
|
567
562
|
* ```
|
|
568
563
|
*/
|
|
569
564
|
setFront() {
|
|
570
|
-
return this._commandService.syncExecuteCommand(
|
|
565
|
+
return this._commandService.syncExecuteCommand(w.id, {
|
|
571
566
|
unitId: this._image.unitId,
|
|
572
567
|
subUnitId: this._image.subUnitId,
|
|
573
568
|
drawingIds: [this._image.drawingId],
|
|
574
|
-
arrangeType:
|
|
569
|
+
arrangeType: v.front
|
|
575
570
|
});
|
|
576
571
|
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
],
|
|
582
|
-
|
|
583
|
-
addFloatDomToPosition(
|
|
584
|
-
const
|
|
585
|
-
return
|
|
586
|
-
id:
|
|
587
|
-
dispose:
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
}) : (
|
|
591
|
-
}
|
|
592
|
-
addFloatDomToRange(
|
|
593
|
-
const
|
|
594
|
-
return
|
|
595
|
-
id:
|
|
596
|
-
dispose:
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
}) : (
|
|
600
|
-
}
|
|
601
|
-
addFloatDomToColumnHeader(
|
|
602
|
-
const
|
|
603
|
-
return
|
|
604
|
-
id:
|
|
605
|
-
dispose:
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
}) : (
|
|
609
|
-
}
|
|
610
|
-
async insertImage(
|
|
611
|
-
const
|
|
612
|
-
if (typeof
|
|
613
|
-
|
|
572
|
+
};
|
|
573
|
+
g = H([
|
|
574
|
+
R(1, W),
|
|
575
|
+
R(2, x(P))
|
|
576
|
+
], g);
|
|
577
|
+
class se extends $ {
|
|
578
|
+
addFloatDomToPosition(t, e) {
|
|
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
|
+
dispose: () => {
|
|
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();
|
|
602
|
+
}
|
|
603
|
+
}) : (a.dispose(), null);
|
|
604
|
+
}
|
|
605
|
+
async insertImage(t, e, i, n, s) {
|
|
606
|
+
const o = this.newOverGridImage();
|
|
607
|
+
if (typeof t == "string")
|
|
608
|
+
o.setSource(t);
|
|
614
609
|
else {
|
|
615
|
-
const
|
|
616
|
-
|
|
610
|
+
const h = await t.getBlob().getDataAsString();
|
|
611
|
+
o.setSource(h, I.BASE64);
|
|
617
612
|
}
|
|
618
|
-
|
|
619
|
-
const
|
|
620
|
-
return this._commandService.syncExecuteCommand(
|
|
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] });
|
|
621
616
|
}
|
|
622
|
-
insertImages(
|
|
623
|
-
const
|
|
624
|
-
return this._commandService.syncExecuteCommand(
|
|
617
|
+
insertImages(t) {
|
|
618
|
+
const e = t.map((i) => (i.unitId = this._fWorkbook.getId(), i.subUnitId = this.getSheetId(), i));
|
|
619
|
+
return this._commandService.syncExecuteCommand(S.id, { unitId: this._fWorkbook.getId(), drawings: e }), this;
|
|
625
620
|
}
|
|
626
|
-
deleteImages(
|
|
627
|
-
const
|
|
621
|
+
deleteImages(t) {
|
|
622
|
+
const e = t.map((i) => ({
|
|
628
623
|
unitId: this._fWorkbook.getId(),
|
|
629
|
-
drawingId:
|
|
624
|
+
drawingId: i.getId(),
|
|
630
625
|
subUnitId: this.getSheetId(),
|
|
631
|
-
drawingType:
|
|
626
|
+
drawingType: i.getType()
|
|
632
627
|
}));
|
|
633
|
-
return this._commandService.syncExecuteCommand(
|
|
628
|
+
return this._commandService.syncExecuteCommand(D.id, { unitId: this._fWorkbook.getId(), drawings: e }), this;
|
|
634
629
|
}
|
|
635
630
|
getImages() {
|
|
636
|
-
const
|
|
637
|
-
for (const
|
|
638
|
-
const
|
|
639
|
-
|
|
631
|
+
const e = this._injector.get(u).getDrawingData(this._fWorkbook.getId(), this.getSheetId()), i = [];
|
|
632
|
+
for (const n in e) {
|
|
633
|
+
const s = e[n];
|
|
634
|
+
s.drawingType === _.DRAWING_IMAGE && i.push(this._injector.createInstance(g, s));
|
|
640
635
|
}
|
|
641
|
-
return
|
|
636
|
+
return i;
|
|
642
637
|
}
|
|
643
|
-
getImageById(
|
|
644
|
-
const
|
|
645
|
-
return
|
|
638
|
+
getImageById(t) {
|
|
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;
|
|
646
641
|
}
|
|
647
642
|
getActiveImages() {
|
|
648
|
-
const
|
|
649
|
-
for (const
|
|
650
|
-
const
|
|
651
|
-
|
|
643
|
+
const e = this._injector.get(u).getFocusDrawings(), i = [];
|
|
644
|
+
for (const n in e) {
|
|
645
|
+
const s = e[n];
|
|
646
|
+
i.push(this._injector.createInstance(g, s));
|
|
652
647
|
}
|
|
653
|
-
return
|
|
648
|
+
return i;
|
|
654
649
|
}
|
|
655
|
-
updateImages(
|
|
656
|
-
return this._commandService.syncExecuteCommand(
|
|
650
|
+
updateImages(t) {
|
|
651
|
+
return this._commandService.syncExecuteCommand(m.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
|
|
657
652
|
}
|
|
658
|
-
onImageInserted(
|
|
659
|
-
const
|
|
660
|
-
return
|
|
661
|
-
const
|
|
662
|
-
(
|
|
653
|
+
onImageInserted(t) {
|
|
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))
|
|
663
658
|
);
|
|
664
|
-
|
|
659
|
+
t(n);
|
|
665
660
|
}));
|
|
666
661
|
}
|
|
667
|
-
onImageDeleted(
|
|
668
|
-
const
|
|
669
|
-
return
|
|
670
|
-
const
|
|
671
|
-
(
|
|
662
|
+
onImageDeleted(t) {
|
|
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))
|
|
672
667
|
);
|
|
673
|
-
|
|
668
|
+
t(n);
|
|
674
669
|
}));
|
|
675
670
|
}
|
|
676
|
-
onImageChanged(
|
|
677
|
-
const
|
|
678
|
-
return
|
|
679
|
-
const
|
|
680
|
-
(
|
|
671
|
+
onImageChanged(t) {
|
|
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))
|
|
681
676
|
);
|
|
682
|
-
|
|
677
|
+
t(n);
|
|
683
678
|
}));
|
|
684
679
|
}
|
|
685
680
|
newOverGridImage() {
|
|
686
|
-
const
|
|
687
|
-
return this._injector.createInstance(
|
|
681
|
+
const t = this._fWorkbook.getId(), e = this.getSheetId();
|
|
682
|
+
return this._injector.createInstance(b, t, e);
|
|
688
683
|
}
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
FWorksheet.extend(FWorksheetLegacy);
|
|
693
|
-
const _FDrawingEnumMixin = class _FDrawingEnumMixin extends FEnum {
|
|
684
|
+
}
|
|
685
|
+
$.extend(se);
|
|
686
|
+
class oe extends M {
|
|
694
687
|
get DrawingType() {
|
|
695
|
-
return
|
|
688
|
+
return _;
|
|
696
689
|
}
|
|
697
690
|
get ImageSourceType() {
|
|
698
|
-
return
|
|
691
|
+
return I;
|
|
699
692
|
}
|
|
700
693
|
get SheetDrawingAnchorType() {
|
|
701
|
-
return
|
|
694
|
+
return ee;
|
|
702
695
|
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
FEnum.extend(FDrawingEnumMixin);
|
|
707
|
-
const _FDrawingEventNameMixin = class _FDrawingEventNameMixin extends FEventName {
|
|
696
|
+
}
|
|
697
|
+
M.extend(oe);
|
|
698
|
+
class ae extends z {
|
|
708
699
|
get BeforeOverGridImageChange() {
|
|
709
700
|
return "BeforeOverGridImageChange";
|
|
710
701
|
}
|
|
@@ -729,161 +720,154 @@ const _FDrawingEventNameMixin = class _FDrawingEventNameMixin extends FEventName
|
|
|
729
720
|
get OverGridImageSelected() {
|
|
730
721
|
return "OverGridImageSelected";
|
|
731
722
|
}
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
const
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
const commandService = injector.get(ICommandService);
|
|
742
|
-
this.disposeWithMe(commandService.beforeCommandExecuted((commandInfo) => {
|
|
743
|
-
switch (commandInfo.id) {
|
|
744
|
-
case InsertSheetDrawingCommand.id:
|
|
745
|
-
this._beforeOverGridImageInsert(commandInfo.params);
|
|
723
|
+
}
|
|
724
|
+
z.extend(ae);
|
|
725
|
+
class ce extends N {
|
|
726
|
+
_initialize(t) {
|
|
727
|
+
const e = t.get(W);
|
|
728
|
+
this.disposeWithMe(e.beforeCommandExecuted((i) => {
|
|
729
|
+
switch (i.id) {
|
|
730
|
+
case S.id:
|
|
731
|
+
this._beforeOverGridImageInsert(i.params);
|
|
746
732
|
break;
|
|
747
|
-
case
|
|
748
|
-
this._beforeOverGridImageRemove(
|
|
733
|
+
case D.id:
|
|
734
|
+
this._beforeOverGridImageRemove(i.params);
|
|
749
735
|
break;
|
|
750
|
-
case
|
|
751
|
-
this._beforeOverGridImageChange(
|
|
736
|
+
case m.id:
|
|
737
|
+
this._beforeOverGridImageChange(i.params);
|
|
752
738
|
break;
|
|
753
|
-
case
|
|
754
|
-
this._beforeOverGridImageSelect(
|
|
739
|
+
case A.id:
|
|
740
|
+
this._beforeOverGridImageSelect(i.params);
|
|
755
741
|
break;
|
|
756
742
|
}
|
|
757
|
-
})), this.disposeWithMe(
|
|
758
|
-
switch (
|
|
759
|
-
case
|
|
760
|
-
this._overGridImageInserted(
|
|
743
|
+
})), this.disposeWithMe(e.onCommandExecuted((i) => {
|
|
744
|
+
switch (i.id) {
|
|
745
|
+
case S.id:
|
|
746
|
+
this._overGridImageInserted(i.params);
|
|
761
747
|
break;
|
|
762
|
-
case
|
|
763
|
-
this._overGridImageRemoved(
|
|
748
|
+
case D.id:
|
|
749
|
+
this._overGridImageRemoved(i.params);
|
|
764
750
|
break;
|
|
765
|
-
case
|
|
766
|
-
this._overGridImageChanged(
|
|
751
|
+
case m.id:
|
|
752
|
+
this._overGridImageChanged(i.params);
|
|
767
753
|
break;
|
|
768
|
-
case
|
|
769
|
-
this._overGridImageSelected(
|
|
754
|
+
case A.id:
|
|
755
|
+
this._overGridImageSelected(i.params);
|
|
770
756
|
break;
|
|
771
757
|
}
|
|
772
758
|
}));
|
|
773
759
|
}
|
|
774
|
-
_beforeOverGridImageInsert(
|
|
760
|
+
_beforeOverGridImageInsert(t) {
|
|
775
761
|
if (!this.hasEventCallback(this.Event.BeforeOverGridImageInsert))
|
|
776
762
|
return;
|
|
777
|
-
const
|
|
778
|
-
if (
|
|
763
|
+
const e = this.getActiveWorkbook();
|
|
764
|
+
if (e == null || t == null)
|
|
779
765
|
return;
|
|
780
|
-
const { drawings } =
|
|
781
|
-
workbook,
|
|
782
|
-
insertImageParams:
|
|
766
|
+
const { drawings: i } = t, n = {
|
|
767
|
+
workbook: e,
|
|
768
|
+
insertImageParams: i
|
|
783
769
|
};
|
|
784
|
-
if (this.fireEvent(this.Event.BeforeOverGridImageInsert,
|
|
770
|
+
if (this.fireEvent(this.Event.BeforeOverGridImageInsert, n), n.cancel)
|
|
785
771
|
throw new Error("Canceled by BeforeOverGridImageInsert event");
|
|
786
772
|
}
|
|
787
|
-
_overGridImageInserted(
|
|
773
|
+
_overGridImageInserted(t) {
|
|
788
774
|
if (!this.hasEventCallback(this.Event.OverGridImageInserted))
|
|
789
775
|
return;
|
|
790
|
-
const
|
|
791
|
-
if (
|
|
776
|
+
const e = this.getActiveWorkbook();
|
|
777
|
+
if (e == null || t == null)
|
|
792
778
|
return;
|
|
793
|
-
const { drawings } =
|
|
779
|
+
const { drawings: i } = t;
|
|
794
780
|
this.fireEvent(this.Event.OverGridImageInserted, {
|
|
795
|
-
workbook,
|
|
796
|
-
images: this._createFOverGridImage(
|
|
781
|
+
workbook: e,
|
|
782
|
+
images: this._createFOverGridImage(i)
|
|
797
783
|
});
|
|
798
784
|
}
|
|
799
|
-
_beforeOverGridImageRemove(
|
|
785
|
+
_beforeOverGridImageRemove(t) {
|
|
800
786
|
if (!this.hasEventCallback(this.Event.BeforeOverGridImageRemove))
|
|
801
787
|
return;
|
|
802
|
-
const
|
|
803
|
-
if (
|
|
788
|
+
const e = this.getActiveWorkbook();
|
|
789
|
+
if (e == null || t == null)
|
|
804
790
|
return;
|
|
805
|
-
const { drawings } =
|
|
806
|
-
workbook,
|
|
807
|
-
images: this._createFOverGridImage(
|
|
791
|
+
const { drawings: i } = t, n = this._injector.get(l), s = i.map((c) => n.getDrawingByParam(c)), o = {
|
|
792
|
+
workbook: e,
|
|
793
|
+
images: this._createFOverGridImage(s)
|
|
808
794
|
};
|
|
809
|
-
if (this.fireEvent(this.Event.BeforeOverGridImageRemove,
|
|
795
|
+
if (this.fireEvent(this.Event.BeforeOverGridImageRemove, o), o.cancel)
|
|
810
796
|
throw new Error("Canceled by BeforeOverGridImageRemove event");
|
|
811
797
|
}
|
|
812
|
-
_overGridImageRemoved(
|
|
798
|
+
_overGridImageRemoved(t) {
|
|
813
799
|
if (!this.hasEventCallback(this.Event.OverGridImageRemoved))
|
|
814
800
|
return;
|
|
815
|
-
const
|
|
816
|
-
if (
|
|
801
|
+
const e = this.getActiveWorkbook();
|
|
802
|
+
if (e == null || t == null)
|
|
817
803
|
return;
|
|
818
|
-
const { drawings } =
|
|
804
|
+
const { drawings: i } = t;
|
|
819
805
|
this.fireEvent(this.Event.OverGridImageRemoved, {
|
|
820
|
-
workbook,
|
|
821
|
-
removeImageParams:
|
|
806
|
+
workbook: e,
|
|
807
|
+
removeImageParams: i
|
|
822
808
|
});
|
|
823
809
|
}
|
|
824
|
-
_beforeOverGridImageChange(
|
|
810
|
+
_beforeOverGridImageChange(t) {
|
|
825
811
|
if (!this.hasEventCallback(this.Event.BeforeOverGridImageChange))
|
|
826
812
|
return;
|
|
827
|
-
const
|
|
828
|
-
if (
|
|
813
|
+
const e = this.getActiveWorkbook();
|
|
814
|
+
if (e == null || t == null)
|
|
829
815
|
return;
|
|
830
|
-
const { drawings } =
|
|
831
|
-
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
changeParam:
|
|
835
|
-
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)
|
|
836
822
|
});
|
|
837
823
|
});
|
|
838
|
-
const
|
|
839
|
-
workbook,
|
|
840
|
-
images
|
|
824
|
+
const o = {
|
|
825
|
+
workbook: e,
|
|
826
|
+
images: s
|
|
841
827
|
};
|
|
842
|
-
if (this.fireEvent(this.Event.BeforeOverGridImageChange,
|
|
843
|
-
throw
|
|
828
|
+
if (this.fireEvent(this.Event.BeforeOverGridImageChange, o), o.cancel)
|
|
829
|
+
throw n.updateNotification(i), new Error("Canceled by BeforeOverGridImageChange event");
|
|
844
830
|
}
|
|
845
|
-
_overGridImageChanged(
|
|
831
|
+
_overGridImageChanged(t) {
|
|
846
832
|
if (!this.hasEventCallback(this.Event.OverGridImageChanged))
|
|
847
833
|
return;
|
|
848
|
-
const
|
|
849
|
-
if (
|
|
834
|
+
const e = this.getActiveWorkbook();
|
|
835
|
+
if (e == null || t == null)
|
|
850
836
|
return;
|
|
851
|
-
const { drawings } =
|
|
837
|
+
const { drawings: i } = t, n = this._injector.get(l), s = i.map((o) => this._injector.createInstance(g, n.getDrawingByParam(o)));
|
|
852
838
|
this.fireEvent(this.Event.OverGridImageChanged, {
|
|
853
|
-
workbook,
|
|
854
|
-
images
|
|
839
|
+
workbook: e,
|
|
840
|
+
images: s
|
|
855
841
|
});
|
|
856
842
|
}
|
|
857
|
-
_beforeOverGridImageSelect(
|
|
843
|
+
_beforeOverGridImageSelect(t) {
|
|
858
844
|
if (!this.hasEventCallback(this.Event.BeforeOverGridImageSelect))
|
|
859
845
|
return;
|
|
860
|
-
const
|
|
861
|
-
if (
|
|
846
|
+
const e = this._injector.get(l), i = this.getActiveWorkbook();
|
|
847
|
+
if (i == null)
|
|
862
848
|
return;
|
|
863
|
-
const
|
|
864
|
-
workbook,
|
|
865
|
-
selectedImages: this._createFOverGridImage(
|
|
866
|
-
oldSelectedImages: this._createFOverGridImage(
|
|
849
|
+
const n = e.getFocusDrawings(), s = t.map((c) => e.getDrawingByParam(c)), o = {
|
|
850
|
+
workbook: i,
|
|
851
|
+
selectedImages: this._createFOverGridImage(s),
|
|
852
|
+
oldSelectedImages: this._createFOverGridImage(n)
|
|
867
853
|
};
|
|
868
|
-
if (this.fireEvent(this.Event.BeforeOverGridImageSelect,
|
|
854
|
+
if (this.fireEvent(this.Event.BeforeOverGridImageSelect, o), o.cancel)
|
|
869
855
|
throw new Error("Canceled by BeforeOverGridImageSelect event");
|
|
870
856
|
}
|
|
871
|
-
_overGridImageSelected(
|
|
857
|
+
_overGridImageSelected(t) {
|
|
872
858
|
if (!this.hasEventCallback(this.Event.OverGridImageSelected))
|
|
873
859
|
return;
|
|
874
|
-
const
|
|
875
|
-
if (
|
|
860
|
+
const e = this.getActiveWorkbook(), i = this._injector.get(l);
|
|
861
|
+
if (e == null)
|
|
876
862
|
return;
|
|
877
|
-
const
|
|
863
|
+
const n = t.map((s) => i.getDrawingByParam(s));
|
|
878
864
|
this.fireEvent(this.Event.OverGridImageSelected, {
|
|
879
|
-
workbook,
|
|
880
|
-
selectedImages: this._createFOverGridImage(
|
|
865
|
+
workbook: e,
|
|
866
|
+
selectedImages: this._createFOverGridImage(n)
|
|
881
867
|
});
|
|
882
868
|
}
|
|
883
|
-
_createFOverGridImage(
|
|
884
|
-
return
|
|
869
|
+
_createFOverGridImage(t) {
|
|
870
|
+
return t.map((e) => this._injector.createInstance(g, e));
|
|
885
871
|
}
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
let FUniverDrawingMixin = _FUniverDrawingMixin;
|
|
889
|
-
FUniver.extend(FUniverDrawingMixin);
|
|
872
|
+
}
|
|
873
|
+
N.extend(ce);
|