@univerjs/sheets-drawing-ui 0.6.0-experimental.20250125-1d060b9 → 0.6.0-experimental.20250220-d9a8e74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +210 -230
- package/lib/es/index.js +1934 -1876
- package/lib/types/controllers/sheet-drawing-permission.controller.d.ts +2 -0
- package/lib/types/controllers/sheet-drawing-transform-affected.controller.d.ts +3 -1
- package/lib/types/facade/f-enum.d.ts +3 -2
- package/lib/types/facade/f-event.d.ts +3 -2
- package/lib/types/facade/f-over-grid-image.d.ts +2 -1
- package/lib/types/facade/f-univer.d.ts +2 -9
- package/lib/types/facade/f-worksheet.d.ts +6 -2
- package/lib/types/facade/index.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/locale/zh-CN.d.ts +1 -1
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +6 -1
- package/lib/types/views/sheet-image-panel/SheetDrawingPanel.d.ts +1 -1
- package/lib/types/views/sheet-image-panel/component-name.d.ts +1 -1
- package/lib/types/views/upload-component/component-name.d.ts +1 -1
- package/lib/types/views/upload-loading/UploadLoading.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +18 -18
package/lib/es/facade.js
CHANGED
|
@@ -1,75 +1,76 @@
|
|
|
1
1
|
var L = Object.defineProperty;
|
|
2
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
|
|
4
|
-
import { Inject as
|
|
5
|
-
import {
|
|
3
|
+
var x = (r, t, e) => X(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { Inject as P, Injector as j, ICommandService as W, generateRandomId as Y, DrawingTypeEnum as _, ImageSourceType as I, ArrangeTypeEnum as v, toDisposable as k } from "@univerjs/core";
|
|
5
|
+
import { FBase as V, FEnum as M, FEventName as H, FUniver as z } from "@univerjs/core/facade";
|
|
6
|
+
import { getImageSize as q, IDrawingManagerService as f, SetDrawingSelectedOperation as A } from "@univerjs/drawing";
|
|
6
7
|
import { IRenderManagerService as F } from "@univerjs/engine-render";
|
|
7
|
-
import { SetSheetDrawingCommand as
|
|
8
|
+
import { SetSheetDrawingCommand as h, SetDrawingArrangeCommand as w, SheetCanvasFloatDomManagerService as C, InsertSheetDrawingCommand as S, RemoveSheetDrawingCommand as R } from "@univerjs/sheets-drawing-ui";
|
|
8
9
|
import { SheetSkeletonManagerService as U, ISheetSelectionRenderService as J, convertPositionSheetOverGridToAbsolute as Q, convertPositionCellToSheetOverGrid as Z } from "@univerjs/sheets-ui";
|
|
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 = i > 1 ? void 0 : i ?
|
|
10
|
+
import { ISheetDrawingService as l, SheetDrawingAnchorType as ee } from "@univerjs/sheets-drawing";
|
|
11
|
+
import { transformComponentKey as y } from "@univerjs/sheets-ui/facade";
|
|
12
|
+
import { FWorksheet as N } from "@univerjs/sheets/facade";
|
|
13
|
+
import { ComponentManager as D } from "@univerjs/ui";
|
|
14
|
+
var te = Object.defineProperty, re = Object.getOwnPropertyDescriptor, $ = (r, t, e, i) => {
|
|
15
|
+
for (var n = i > 1 ? void 0 : i ? re(t, e) : t, s = r.length - 1, o; s >= 0; s--)
|
|
15
16
|
(o = r[s]) && (n = (i ? o(t, e, n) : o(n)) || n);
|
|
16
17
|
return i && n && te(t, e, n), n;
|
|
17
|
-
},
|
|
18
|
-
function
|
|
19
|
-
const { from: e, to: i, flipY: n = !1, flipX: s = !1, angle: o = 0, skewX:
|
|
18
|
+
}, G = (r, t) => (e, i) => t(e, i, r);
|
|
19
|
+
function ie(r, t) {
|
|
20
|
+
const { from: e, to: i, flipY: n = !1, flipX: s = !1, angle: o = 0, skewX: d = 0, skewY: a = 0 } = r.sheetTransform, { column: g, columnOffset: c, row: u, rowOffset: b } = e, O = Q(
|
|
20
21
|
r.unitId,
|
|
21
22
|
r.subUnitId,
|
|
22
23
|
{ from: e, to: i },
|
|
23
24
|
t
|
|
24
|
-
), { left: B, top:
|
|
25
|
+
), { left: B, top: T, width: E, height: K } = O;
|
|
25
26
|
return {
|
|
26
27
|
...r,
|
|
27
|
-
column:
|
|
28
|
-
columnOffset:
|
|
29
|
-
row:
|
|
30
|
-
rowOffset:
|
|
31
|
-
width:
|
|
28
|
+
column: g,
|
|
29
|
+
columnOffset: c,
|
|
30
|
+
row: u,
|
|
31
|
+
rowOffset: b,
|
|
32
|
+
width: E,
|
|
32
33
|
height: K,
|
|
33
34
|
flipY: n,
|
|
34
35
|
flipX: s,
|
|
35
36
|
angle: o,
|
|
36
|
-
skewX:
|
|
37
|
+
skewX: d,
|
|
37
38
|
skewY: a
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
41
|
function ne(r, t, e) {
|
|
41
|
-
const { column: i, columnOffset: n, row: s, rowOffset: o, flipY:
|
|
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 } = r, B = Z(
|
|
42
43
|
r.unitId,
|
|
43
44
|
r.subUnitId,
|
|
44
45
|
{ column: i, columnOffset: n, row: s, rowOffset: o },
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
b,
|
|
47
|
+
O,
|
|
47
48
|
t,
|
|
48
49
|
e
|
|
49
|
-
), { sheetTransform:
|
|
50
|
+
), { sheetTransform: T, transform: E } = B;
|
|
50
51
|
return {
|
|
51
52
|
...r,
|
|
52
53
|
sheetTransform: {
|
|
53
|
-
...
|
|
54
|
-
flipY:
|
|
54
|
+
...T,
|
|
55
|
+
flipY: d,
|
|
55
56
|
flipX: a,
|
|
56
|
-
angle:
|
|
57
|
-
skewX:
|
|
58
|
-
skewY:
|
|
57
|
+
angle: g,
|
|
58
|
+
skewX: c,
|
|
59
|
+
skewY: u
|
|
59
60
|
},
|
|
60
61
|
transform: {
|
|
61
|
-
...
|
|
62
|
-
flipY:
|
|
62
|
+
...E,
|
|
63
|
+
flipY: d,
|
|
63
64
|
flipX: a,
|
|
64
|
-
angle:
|
|
65
|
-
skewX:
|
|
66
|
-
skewY:
|
|
65
|
+
angle: g,
|
|
66
|
+
skewX: c,
|
|
67
|
+
skewY: u
|
|
67
68
|
}
|
|
68
69
|
};
|
|
69
70
|
}
|
|
70
|
-
let
|
|
71
|
+
let p = class {
|
|
71
72
|
constructor(r, t, e) {
|
|
72
|
-
|
|
73
|
+
x(this, "_image");
|
|
73
74
|
this._injector = e, this._image = {
|
|
74
75
|
drawingId: Y(6),
|
|
75
76
|
drawingType: _.DRAWING_IMAGE,
|
|
@@ -124,7 +125,7 @@ let b = class {
|
|
|
124
125
|
row: 0,
|
|
125
126
|
rowOffset: 0
|
|
126
127
|
}
|
|
127
|
-
}), this._image =
|
|
128
|
+
}), this._image = ie(r, i), this;
|
|
128
129
|
}
|
|
129
130
|
setSource(r, t) {
|
|
130
131
|
const e = t != null ? t : I.URL;
|
|
@@ -370,10 +371,10 @@ let b = class {
|
|
|
370
371
|
return ne(this._image, e, i);
|
|
371
372
|
}
|
|
372
373
|
};
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
],
|
|
376
|
-
let
|
|
374
|
+
p = $([
|
|
375
|
+
G(2, P(j))
|
|
376
|
+
], p);
|
|
377
|
+
let m = class extends V {
|
|
377
378
|
constructor(r, t, e) {
|
|
378
379
|
super(), this._image = r, this._commandService = t, this._injector = e;
|
|
379
380
|
}
|
|
@@ -396,7 +397,7 @@ let g = class extends V {
|
|
|
396
397
|
* ```
|
|
397
398
|
*/
|
|
398
399
|
remove() {
|
|
399
|
-
return this._commandService.syncExecuteCommand(
|
|
400
|
+
return this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
400
401
|
}
|
|
401
402
|
/**
|
|
402
403
|
* Convert the image to a FOverGridImageBuilder
|
|
@@ -413,18 +414,18 @@ let g = class extends V {
|
|
|
413
414
|
* ```
|
|
414
415
|
*/
|
|
415
416
|
toBuilder() {
|
|
416
|
-
const r = this._injector.createInstance(
|
|
417
|
+
const r = this._injector.createInstance(p);
|
|
417
418
|
return r.setImage(this._image), r;
|
|
418
419
|
}
|
|
419
420
|
setSource(r, t) {
|
|
420
421
|
const e = t != null ? t : I.URL;
|
|
421
|
-
return this._image.source = r, this._image.imageSourceType = e, this._commandService.syncExecuteCommand(
|
|
422
|
+
return this._image.source = r, this._image.imageSourceType = e, this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
422
423
|
}
|
|
423
424
|
async setPositionAsync(r, t, e, i) {
|
|
424
425
|
const n = this.toBuilder();
|
|
425
426
|
n.setColumn(t), n.setRow(r), e != null && n.setRowOffset(e), i != null && n.setColumnOffset(i);
|
|
426
427
|
const s = await n.buildAsync();
|
|
427
|
-
return this._commandService.syncExecuteCommand(
|
|
428
|
+
return this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [s] });
|
|
428
429
|
}
|
|
429
430
|
/**
|
|
430
431
|
* Set the size of the image
|
|
@@ -443,7 +444,7 @@ let g = class extends V {
|
|
|
443
444
|
const e = this.toBuilder();
|
|
444
445
|
e.setWidth(r), e.setHeight(t);
|
|
445
446
|
const i = await e.buildAsync();
|
|
446
|
-
return this._commandService.syncExecuteCommand(
|
|
447
|
+
return this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [i] });
|
|
447
448
|
}
|
|
448
449
|
/**
|
|
449
450
|
* Set the cropping region of the image by defining the top, bottom, left, and right edges, thereby displaying the specific part of the image you want.
|
|
@@ -467,7 +468,7 @@ let g = class extends V {
|
|
|
467
468
|
left: 0,
|
|
468
469
|
bottom: 0,
|
|
469
470
|
right: 0
|
|
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(
|
|
471
|
+
}), 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(h.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
471
472
|
}
|
|
472
473
|
// setPresetGeometry(prstGeom: PresetGeometryType): boolean {
|
|
473
474
|
// this._image.prstGeom = prstGeom;
|
|
@@ -487,7 +488,7 @@ let g = class extends V {
|
|
|
487
488
|
* ```
|
|
488
489
|
*/
|
|
489
490
|
setRotate(r) {
|
|
490
|
-
return this._image.sheetTransform.angle = r, this._commandService.syncExecuteCommand(
|
|
491
|
+
return this._image.sheetTransform.angle = r, this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
491
492
|
}
|
|
492
493
|
/**
|
|
493
494
|
* Move the image layer forward by one level
|
|
@@ -570,13 +571,13 @@ let g = class extends V {
|
|
|
570
571
|
});
|
|
571
572
|
}
|
|
572
573
|
};
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
],
|
|
577
|
-
class se extends
|
|
574
|
+
m = $([
|
|
575
|
+
G(1, W),
|
|
576
|
+
G(2, P(j))
|
|
577
|
+
], m);
|
|
578
|
+
class se extends N {
|
|
578
579
|
addFloatDomToPosition(t, e) {
|
|
579
|
-
const i = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), { key: s, disposableCollection: o } =
|
|
580
|
+
const i = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), { key: s, disposableCollection: o } = y(t, this._injector.get(D)), a = this._injector.get(C).addFloatDomToPosition({ ...t, componentKey: s, unitId: i, subUnitId: n }, e);
|
|
580
581
|
return a ? (o.add(a.dispose), {
|
|
581
582
|
id: a.id,
|
|
582
583
|
dispose: () => {
|
|
@@ -585,20 +586,20 @@ class se extends $ {
|
|
|
585
586
|
}) : (o.dispose(), null);
|
|
586
587
|
}
|
|
587
588
|
addFloatDomToRange(t, e, i, n) {
|
|
588
|
-
const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), { key:
|
|
589
|
-
return
|
|
590
|
-
id:
|
|
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(t.getRange(), { ...e, componentKey: d, unitId: s, subUnitId: o }, i, n);
|
|
590
|
+
return c ? (a.add(c.dispose), {
|
|
591
|
+
id: c.id,
|
|
591
592
|
dispose: () => {
|
|
592
|
-
a.dispose(),
|
|
593
|
+
a.dispose(), c.dispose();
|
|
593
594
|
}
|
|
594
595
|
}) : (a.dispose(), null);
|
|
595
596
|
}
|
|
596
597
|
addFloatDomToColumnHeader(t, e, i, n) {
|
|
597
|
-
const s = this._workbook.getUnitId(), o = this._worksheet.getSheetId(), { key:
|
|
598
|
-
return
|
|
599
|
-
id:
|
|
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(t, { ...e, componentKey: d, unitId: s, subUnitId: o }, i, n);
|
|
599
|
+
return c ? (a.add(c.dispose), {
|
|
600
|
+
id: c.id,
|
|
600
601
|
dispose: () => {
|
|
601
|
-
a.dispose(),
|
|
602
|
+
a.dispose(), c.dispose();
|
|
602
603
|
}
|
|
603
604
|
}) : (a.dispose(), null);
|
|
604
605
|
}
|
|
@@ -607,12 +608,12 @@ class se extends $ {
|
|
|
607
608
|
if (typeof t == "string")
|
|
608
609
|
o.setSource(t);
|
|
609
610
|
else {
|
|
610
|
-
const
|
|
611
|
-
o.setSource(
|
|
611
|
+
const g = await t.getBlob().getDataAsString();
|
|
612
|
+
o.setSource(g, I.BASE64);
|
|
612
613
|
}
|
|
613
614
|
e !== void 0 ? o.setColumn(e) : o.setColumn(0), i !== void 0 ? o.setRow(i) : o.setRow(0), n !== void 0 ? o.setColumnOffset(n) : o.setColumnOffset(0), s !== void 0 ? o.setRowOffset(s) : o.setRowOffset(0);
|
|
614
|
-
const
|
|
615
|
-
return this._commandService.syncExecuteCommand(S.id, { unitId: this._fWorkbook.getId(), drawings: [
|
|
615
|
+
const d = await o.buildAsync();
|
|
616
|
+
return this._commandService.syncExecuteCommand(S.id, { unitId: this._fWorkbook.getId(), drawings: [d] });
|
|
616
617
|
}
|
|
617
618
|
insertImages(t) {
|
|
618
619
|
const e = t.map((i) => (i.unitId = this._fWorkbook.getId(), i.subUnitId = this.getSheetId(), i));
|
|
@@ -625,64 +626,64 @@ class se extends $ {
|
|
|
625
626
|
subUnitId: this.getSheetId(),
|
|
626
627
|
drawingType: i.getType()
|
|
627
628
|
}));
|
|
628
|
-
return this._commandService.syncExecuteCommand(
|
|
629
|
+
return this._commandService.syncExecuteCommand(R.id, { unitId: this._fWorkbook.getId(), drawings: e }), this;
|
|
629
630
|
}
|
|
630
631
|
getImages() {
|
|
631
|
-
const e = this._injector.get(
|
|
632
|
+
const e = this._injector.get(l).getDrawingData(this._fWorkbook.getId(), this.getSheetId()), i = [];
|
|
632
633
|
for (const n in e) {
|
|
633
634
|
const s = e[n];
|
|
634
|
-
s.drawingType === _.DRAWING_IMAGE && i.push(this._injector.createInstance(
|
|
635
|
+
s.drawingType === _.DRAWING_IMAGE && i.push(this._injector.createInstance(m, s));
|
|
635
636
|
}
|
|
636
637
|
return i;
|
|
637
638
|
}
|
|
638
639
|
getImageById(t) {
|
|
639
|
-
const i = this._injector.get(
|
|
640
|
-
return i && i.drawingType === _.DRAWING_IMAGE ? this._injector.createInstance(
|
|
640
|
+
const i = this._injector.get(l).getDrawingByParam({ unitId: this._fWorkbook.getId(), subUnitId: this.getSheetId(), drawingId: t });
|
|
641
|
+
return i && i.drawingType === _.DRAWING_IMAGE ? this._injector.createInstance(m, i) : null;
|
|
641
642
|
}
|
|
642
643
|
getActiveImages() {
|
|
643
|
-
const e = this._injector.get(
|
|
644
|
+
const e = this._injector.get(l).getFocusDrawings(), i = [];
|
|
644
645
|
for (const n in e) {
|
|
645
646
|
const s = e[n];
|
|
646
|
-
i.push(this._injector.createInstance(
|
|
647
|
+
i.push(this._injector.createInstance(m, s));
|
|
647
648
|
}
|
|
648
649
|
return i;
|
|
649
650
|
}
|
|
650
651
|
updateImages(t) {
|
|
651
|
-
return this._commandService.syncExecuteCommand(
|
|
652
|
+
return this._commandService.syncExecuteCommand(h.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
|
|
652
653
|
}
|
|
653
654
|
onImageInserted(t) {
|
|
654
|
-
const e = this._injector.get(
|
|
655
|
-
return
|
|
655
|
+
const e = this._injector.get(l);
|
|
656
|
+
return k(e.add$.subscribe((i) => {
|
|
656
657
|
const n = i.map(
|
|
657
|
-
(s) => this._injector.createInstance(
|
|
658
|
+
(s) => this._injector.createInstance(m, e.getDrawingByParam(s))
|
|
658
659
|
);
|
|
659
660
|
t(n);
|
|
660
661
|
}));
|
|
661
662
|
}
|
|
662
663
|
onImageDeleted(t) {
|
|
663
|
-
const e = this._injector.get(
|
|
664
|
-
return
|
|
664
|
+
const e = this._injector.get(l);
|
|
665
|
+
return k(e.remove$.subscribe((i) => {
|
|
665
666
|
const n = i.map(
|
|
666
|
-
(s) => this._injector.createInstance(
|
|
667
|
+
(s) => this._injector.createInstance(m, e.getDrawingByParam(s))
|
|
667
668
|
);
|
|
668
669
|
t(n);
|
|
669
670
|
}));
|
|
670
671
|
}
|
|
671
672
|
onImageChanged(t) {
|
|
672
|
-
const e = this._injector.get(
|
|
673
|
-
return
|
|
673
|
+
const e = this._injector.get(l);
|
|
674
|
+
return k(e.update$.subscribe((i) => {
|
|
674
675
|
const n = i.map(
|
|
675
|
-
(s) => this._injector.createInstance(
|
|
676
|
+
(s) => this._injector.createInstance(m, e.getDrawingByParam(s))
|
|
676
677
|
);
|
|
677
678
|
t(n);
|
|
678
679
|
}));
|
|
679
680
|
}
|
|
680
681
|
newOverGridImage() {
|
|
681
682
|
const t = this._fWorkbook.getId(), e = this.getSheetId();
|
|
682
|
-
return this._injector.createInstance(
|
|
683
|
+
return this._injector.createInstance(p, t, e);
|
|
683
684
|
}
|
|
684
685
|
}
|
|
685
|
-
|
|
686
|
+
N.extend(se);
|
|
686
687
|
class oe extends M {
|
|
687
688
|
get DrawingType() {
|
|
688
689
|
return _;
|
|
@@ -695,7 +696,7 @@ class oe extends M {
|
|
|
695
696
|
}
|
|
696
697
|
}
|
|
697
698
|
M.extend(oe);
|
|
698
|
-
class ae extends
|
|
699
|
+
class ae extends H {
|
|
699
700
|
get BeforeOverGridImageChange() {
|
|
700
701
|
return "BeforeOverGridImageChange";
|
|
701
702
|
}
|
|
@@ -721,156 +722,135 @@ class ae extends z {
|
|
|
721
722
|
return "OverGridImageSelected";
|
|
722
723
|
}
|
|
723
724
|
}
|
|
724
|
-
|
|
725
|
-
class
|
|
725
|
+
H.extend(ae);
|
|
726
|
+
class de extends z {
|
|
726
727
|
/**
|
|
727
728
|
* @ignore
|
|
728
729
|
*/
|
|
730
|
+
// eslint-disable-next-line max-lines-per-function
|
|
729
731
|
_initialize(t) {
|
|
730
732
|
const e = t.get(W);
|
|
731
|
-
this.
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
const e = this._injector.get(l), i = this.getActiveWorkbook();
|
|
850
|
-
if (i == null)
|
|
851
|
-
return;
|
|
852
|
-
const n = e.getFocusDrawings(), s = t.map((c) => e.getDrawingByParam(c)), o = {
|
|
853
|
-
workbook: i,
|
|
854
|
-
selectedImages: this._createFOverGridImage(s),
|
|
855
|
-
oldSelectedImages: this._createFOverGridImage(n)
|
|
856
|
-
};
|
|
857
|
-
if (this.fireEvent(this.Event.BeforeOverGridImageSelect, o), o.cancel)
|
|
858
|
-
throw new Error("Canceled by BeforeOverGridImageSelect event");
|
|
859
|
-
}
|
|
860
|
-
_overGridImageSelected(t) {
|
|
861
|
-
if (!this.hasEventCallback(this.Event.OverGridImageSelected))
|
|
862
|
-
return;
|
|
863
|
-
const e = this.getActiveWorkbook(), i = this._injector.get(l);
|
|
864
|
-
if (e == null)
|
|
865
|
-
return;
|
|
866
|
-
const n = t.map((s) => i.getDrawingByParam(s));
|
|
867
|
-
this.fireEvent(this.Event.OverGridImageSelected, {
|
|
868
|
-
workbook: e,
|
|
869
|
-
selectedImages: this._createFOverGridImage(n)
|
|
870
|
-
});
|
|
733
|
+
this.registerEventHandler(
|
|
734
|
+
this.Event.BeforeOverGridImageInsert,
|
|
735
|
+
() => e.beforeCommandExecuted((i) => {
|
|
736
|
+
if (i.id !== S.id) return;
|
|
737
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
738
|
+
if (s == null || n == null)
|
|
739
|
+
return;
|
|
740
|
+
const { drawings: o } = n, d = {
|
|
741
|
+
workbook: s,
|
|
742
|
+
insertImageParams: o
|
|
743
|
+
};
|
|
744
|
+
if (this.fireEvent(this.Event.BeforeOverGridImageInsert, d), d.cancel)
|
|
745
|
+
throw new Error("Canceled by BeforeOverGridImageInsert event");
|
|
746
|
+
})
|
|
747
|
+
), this.registerEventHandler(
|
|
748
|
+
this.Event.BeforeOverGridImageRemove,
|
|
749
|
+
() => e.beforeCommandExecuted((i) => {
|
|
750
|
+
if (i.id !== R.id) return;
|
|
751
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
752
|
+
if (s == null || n == null)
|
|
753
|
+
return;
|
|
754
|
+
const o = t.get(f), { drawings: d } = n, a = d.map((c) => o.getDrawingByParam(c)), g = {
|
|
755
|
+
workbook: s,
|
|
756
|
+
images: this._createFOverGridImage(a)
|
|
757
|
+
};
|
|
758
|
+
if (this.fireEvent(this.Event.BeforeOverGridImageRemove, g), g.cancel)
|
|
759
|
+
throw new Error("Canceled by BeforeOverGridImageRemove event");
|
|
760
|
+
})
|
|
761
|
+
), this.registerEventHandler(
|
|
762
|
+
this.Event.BeforeOverGridImageChange,
|
|
763
|
+
() => e.beforeCommandExecuted((i) => {
|
|
764
|
+
if (i.id !== h.id) return;
|
|
765
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
766
|
+
if (s == null || n == null)
|
|
767
|
+
return;
|
|
768
|
+
const { drawings: o } = n, d = t.get(f), a = [];
|
|
769
|
+
o.forEach((c) => {
|
|
770
|
+
const u = d.getDrawingByParam(c);
|
|
771
|
+
u != null && a.push({
|
|
772
|
+
changeParam: c,
|
|
773
|
+
image: this._injector.createInstance(m, u)
|
|
774
|
+
});
|
|
775
|
+
});
|
|
776
|
+
const g = {
|
|
777
|
+
workbook: s,
|
|
778
|
+
images: a
|
|
779
|
+
};
|
|
780
|
+
if (this.fireEvent(this.Event.BeforeOverGridImageChange, g), g.cancel)
|
|
781
|
+
throw d.updateNotification(o), new Error("Canceled by BeforeOverGridImageChange event");
|
|
782
|
+
})
|
|
783
|
+
), this.registerEventHandler(
|
|
784
|
+
this.Event.BeforeOverGridImageSelect,
|
|
785
|
+
() => e.beforeCommandExecuted((i) => {
|
|
786
|
+
if (i.id !== A.id) return;
|
|
787
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
788
|
+
if (s == null)
|
|
789
|
+
return;
|
|
790
|
+
const o = t.get(f), d = o.getFocusDrawings(), a = n.map((c) => o.getDrawingByParam(c)), g = {
|
|
791
|
+
workbook: s,
|
|
792
|
+
selectedImages: this._createFOverGridImage(a),
|
|
793
|
+
oldSelectedImages: this._createFOverGridImage(d)
|
|
794
|
+
};
|
|
795
|
+
if (this.fireEvent(this.Event.BeforeOverGridImageSelect, g), g.cancel)
|
|
796
|
+
throw new Error("Canceled by BeforeOverGridImageSelect event");
|
|
797
|
+
})
|
|
798
|
+
), this.registerEventHandler(
|
|
799
|
+
this.Event.OverGridImageInserted,
|
|
800
|
+
() => e.onCommandExecuted((i) => {
|
|
801
|
+
if (i.id !== S.id) return;
|
|
802
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
803
|
+
if (s == null || n == null)
|
|
804
|
+
return;
|
|
805
|
+
const { drawings: o } = n;
|
|
806
|
+
this.fireEvent(this.Event.OverGridImageInserted, {
|
|
807
|
+
workbook: s,
|
|
808
|
+
images: this._createFOverGridImage(o)
|
|
809
|
+
});
|
|
810
|
+
})
|
|
811
|
+
), this.registerEventHandler(
|
|
812
|
+
this.Event.OverGridImageRemoved,
|
|
813
|
+
() => e.onCommandExecuted((i) => {
|
|
814
|
+
if (i.id !== R.id) return;
|
|
815
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
816
|
+
if (s == null || n == null)
|
|
817
|
+
return;
|
|
818
|
+
const { drawings: o } = n;
|
|
819
|
+
this.fireEvent(this.Event.OverGridImageRemoved, {
|
|
820
|
+
workbook: s,
|
|
821
|
+
removeImageParams: o
|
|
822
|
+
});
|
|
823
|
+
})
|
|
824
|
+
), this.registerEventHandler(
|
|
825
|
+
this.Event.OverGridImageChanged,
|
|
826
|
+
() => e.onCommandExecuted((i) => {
|
|
827
|
+
if (i.id !== h.id) return;
|
|
828
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
829
|
+
if (s == null || n == null)
|
|
830
|
+
return;
|
|
831
|
+
const { drawings: o } = n, d = t.get(f), a = o.map((g) => this._injector.createInstance(m, d.getDrawingByParam(g)));
|
|
832
|
+
this.fireEvent(this.Event.OverGridImageChanged, {
|
|
833
|
+
workbook: s,
|
|
834
|
+
images: a
|
|
835
|
+
});
|
|
836
|
+
})
|
|
837
|
+
), this.registerEventHandler(
|
|
838
|
+
this.Event.OverGridImageSelected,
|
|
839
|
+
() => e.onCommandExecuted((i) => {
|
|
840
|
+
if (i.id !== A.id) return;
|
|
841
|
+
const n = i.params, s = this.getActiveWorkbook();
|
|
842
|
+
if (s == null)
|
|
843
|
+
return;
|
|
844
|
+
const o = t.get(f), d = n.map((a) => o.getDrawingByParam(a));
|
|
845
|
+
this.fireEvent(this.Event.OverGridImageSelected, {
|
|
846
|
+
workbook: s,
|
|
847
|
+
selectedImages: this._createFOverGridImage(d)
|
|
848
|
+
});
|
|
849
|
+
})
|
|
850
|
+
);
|
|
871
851
|
}
|
|
872
852
|
_createFOverGridImage(t) {
|
|
873
|
-
return t.map((e) => this._injector.createInstance(
|
|
853
|
+
return t.map((e) => this._injector.createInstance(m, e));
|
|
874
854
|
}
|
|
875
855
|
}
|
|
876
|
-
|
|
856
|
+
z.extend(de);
|