@univerjs/sheets-drawing-ui 0.5.3-nightly.202501071618 → 0.5.3-nightly.202501081606
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/index.js +2 -2
- package/lib/es/facade.js +36 -36
- package/lib/es/index.js +869 -871
- package/lib/umd/index.js +2 -2
- package/package.json +15 -14
package/lib/es/facade.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var $ = Object.defineProperty;
|
|
2
2
|
var L = (i, t, e) => t in i ? $(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
3
|
var D = (i, t, e) => L(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { Inject as T, Injector as A, ICommandService as x, generateRandomId as X, DrawingTypeEnum as _, ImageSourceType as
|
|
4
|
+
import { Inject as T, Injector as A, ICommandService as x, generateRandomId as X, DrawingTypeEnum as _, ImageSourceType as I, FBase as Y, ArrangeTypeEnum as f, toDisposable as G, FEnum as P, FEventName as F, FUniver as M } from "@univerjs/core";
|
|
5
5
|
import { getImageSize as H, SetDrawingSelectedOperation as B, IDrawingManagerService as u } from "@univerjs/drawing";
|
|
6
6
|
import { IRenderManagerService as U } from "@univerjs/engine-render";
|
|
7
|
-
import { SetSheetDrawingCommand as
|
|
7
|
+
import { SetSheetDrawingCommand as g, SetDrawingArrangeCommand as w, SheetCanvasFloatDomManagerService as K, InsertSheetDrawingCommand as S, RemoveSheetDrawingCommand as E } from "@univerjs/sheets-drawing-ui";
|
|
8
8
|
import { SheetSkeletonManagerService as j, ISheetSelectionRenderService as V, convertPositionSheetOverGridToAbsolute as q, convertPositionCellToSheetOverGrid as J } from "@univerjs/sheets-ui";
|
|
9
9
|
import { ISheetDrawingService as h, SheetDrawingAnchorType as Q } from "@univerjs/sheets-drawing";
|
|
10
10
|
import { transformComponentKey as Z } from "@univerjs/sheets-ui/facade";
|
|
@@ -16,7 +16,7 @@ var te = Object.defineProperty, re = Object.getOwnPropertyDescriptor, z = (i, t,
|
|
|
16
16
|
return r && n && te(t, e, n), n;
|
|
17
17
|
}, y = (i, t) => (e, r) => t(e, r, i);
|
|
18
18
|
function ie(i, t) {
|
|
19
|
-
const { from: e, to: r, flipY: n = !1, flipX: s = !1, angle: a = 0, skewX: o = 0, skewY: c = 0 } = i.sheetTransform, { column: m, columnOffset:
|
|
19
|
+
const { from: e, to: r, flipY: n = !1, flipX: s = !1, angle: a = 0, skewX: o = 0, skewY: c = 0 } = i.sheetTransform, { column: m, columnOffset: l, row: v, rowOffset: O } = e, p = q(
|
|
20
20
|
i.unitId,
|
|
21
21
|
i.subUnitId,
|
|
22
22
|
{ from: e, to: r },
|
|
@@ -25,8 +25,8 @@ function ie(i, t) {
|
|
|
25
25
|
return {
|
|
26
26
|
...i,
|
|
27
27
|
column: m,
|
|
28
|
-
columnOffset:
|
|
29
|
-
row:
|
|
28
|
+
columnOffset: l,
|
|
29
|
+
row: v,
|
|
30
30
|
rowOffset: O,
|
|
31
31
|
width: C,
|
|
32
32
|
height: N,
|
|
@@ -38,7 +38,7 @@ function ie(i, t) {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
function ne(i, t, e) {
|
|
41
|
-
const { column: r, columnOffset: n, row: s, rowOffset: a, flipY: o = !1, flipX: c = !1, angle: m = 0, skewX:
|
|
41
|
+
const { column: r, columnOffset: n, row: s, rowOffset: a, flipY: o = !1, flipX: c = !1, angle: m = 0, skewX: l = 0, skewY: v = 0, width: O, height: p } = i, k = J(
|
|
42
42
|
i.unitId,
|
|
43
43
|
i.subUnitId,
|
|
44
44
|
{ column: r, columnOffset: n, row: s, rowOffset: a },
|
|
@@ -54,16 +54,16 @@ function ne(i, t, e) {
|
|
|
54
54
|
flipY: o,
|
|
55
55
|
flipX: c,
|
|
56
56
|
angle: m,
|
|
57
|
-
skewX:
|
|
58
|
-
skewY:
|
|
57
|
+
skewX: l,
|
|
58
|
+
skewY: v
|
|
59
59
|
},
|
|
60
60
|
transform: {
|
|
61
61
|
...C,
|
|
62
62
|
flipY: o,
|
|
63
63
|
flipX: c,
|
|
64
64
|
angle: m,
|
|
65
|
-
skewX:
|
|
66
|
-
skewY:
|
|
65
|
+
skewX: l,
|
|
66
|
+
skewY: v
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
}
|
|
@@ -73,7 +73,7 @@ let b = class {
|
|
|
73
73
|
this._injector = e, this._image = {
|
|
74
74
|
drawingId: X(6),
|
|
75
75
|
drawingType: _.DRAWING_IMAGE,
|
|
76
|
-
imageSourceType:
|
|
76
|
+
imageSourceType: I.BASE64,
|
|
77
77
|
source: "",
|
|
78
78
|
unitId: i,
|
|
79
79
|
subUnitId: t,
|
|
@@ -127,7 +127,7 @@ let b = class {
|
|
|
127
127
|
}), this._image = ie(i, r), this;
|
|
128
128
|
}
|
|
129
129
|
setSource(i, t) {
|
|
130
|
-
const e = t != null ? t :
|
|
130
|
+
const e = t != null ? t : I.URL;
|
|
131
131
|
return this._image.source = i, this._image.imageSourceType = e, this;
|
|
132
132
|
}
|
|
133
133
|
getsource() {
|
|
@@ -373,7 +373,7 @@ let b = class {
|
|
|
373
373
|
b = z([
|
|
374
374
|
y(2, T(A))
|
|
375
375
|
], b);
|
|
376
|
-
let
|
|
376
|
+
let d = class extends Y {
|
|
377
377
|
constructor(i, t, e) {
|
|
378
378
|
super(), this._image = i, this._commandService = t, this._injector = e;
|
|
379
379
|
}
|
|
@@ -396,7 +396,7 @@ let g = class extends Y {
|
|
|
396
396
|
* ```
|
|
397
397
|
*/
|
|
398
398
|
remove() {
|
|
399
|
-
return this._commandService.syncExecuteCommand(
|
|
399
|
+
return this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
400
400
|
}
|
|
401
401
|
/**
|
|
402
402
|
* Convert the image to a FOverGridImageBuilder
|
|
@@ -417,14 +417,14 @@ let g = class extends Y {
|
|
|
417
417
|
return i.setImage(this._image), i;
|
|
418
418
|
}
|
|
419
419
|
setSource(i, t) {
|
|
420
|
-
const e = t != null ? t :
|
|
421
|
-
return this._image.source = i, this._image.imageSourceType = e, this._commandService.syncExecuteCommand(
|
|
420
|
+
const e = t != null ? t : I.URL;
|
|
421
|
+
return this._image.source = i, this._image.imageSourceType = e, this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
422
422
|
}
|
|
423
423
|
async setPositionAsync(i, t, e, r) {
|
|
424
424
|
const n = this.toBuilder();
|
|
425
425
|
n.setColumn(t), n.setRow(i), e != null && n.setRowOffset(e), r != null && n.setColumnOffset(r);
|
|
426
426
|
const s = await n.buildAsync();
|
|
427
|
-
return this._commandService.syncExecuteCommand(
|
|
427
|
+
return this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [s] });
|
|
428
428
|
}
|
|
429
429
|
/**
|
|
430
430
|
* Set the size of the image
|
|
@@ -443,7 +443,7 @@ let g = class extends Y {
|
|
|
443
443
|
const e = this.toBuilder();
|
|
444
444
|
e.setWidth(i), e.setHeight(t);
|
|
445
445
|
const r = await e.buildAsync();
|
|
446
|
-
return this._commandService.syncExecuteCommand(
|
|
446
|
+
return this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [r] });
|
|
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.
|
|
@@ -467,7 +467,7 @@ let g = class extends Y {
|
|
|
467
467
|
left: 0,
|
|
468
468
|
bottom: 0,
|
|
469
469
|
right: 0
|
|
470
|
-
}), i != null && (this._image.srcRect.top = i), t != null && (this._image.srcRect.left = t), e != null && (this._image.srcRect.bottom = e), r != null && (this._image.srcRect.right = r), this._commandService.syncExecuteCommand(
|
|
470
|
+
}), i != null && (this._image.srcRect.top = i), t != null && (this._image.srcRect.left = t), e != null && (this._image.srcRect.bottom = e), r != null && (this._image.srcRect.right = r), this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
471
471
|
}
|
|
472
472
|
// setPresetGeometry(prstGeom: PresetGeometryType): boolean {
|
|
473
473
|
// this._image.prstGeom = prstGeom;
|
|
@@ -487,7 +487,7 @@ let g = class extends Y {
|
|
|
487
487
|
* ```
|
|
488
488
|
*/
|
|
489
489
|
setRotate(i) {
|
|
490
|
-
return this._image.sheetTransform.angle = i, this._commandService.syncExecuteCommand(
|
|
490
|
+
return this._image.sheetTransform.angle = i, this._commandService.syncExecuteCommand(g.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
491
491
|
}
|
|
492
492
|
/**
|
|
493
493
|
* Move the image layer forward by one level
|
|
@@ -570,10 +570,10 @@ let g = class extends Y {
|
|
|
570
570
|
});
|
|
571
571
|
}
|
|
572
572
|
};
|
|
573
|
-
|
|
573
|
+
d = z([
|
|
574
574
|
y(1, x),
|
|
575
575
|
y(2, T(A))
|
|
576
|
-
],
|
|
576
|
+
], d);
|
|
577
577
|
class se extends W {
|
|
578
578
|
addFloatDomToPosition(t, e) {
|
|
579
579
|
const r = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), { key: s, disposableCollection: a } = Z(t, this._injector.get(ee)), c = this._injector.get(K).addFloatDomToPosition({ ...t, componentKey: s, unitId: r, subUnitId: n }, e);
|
|
@@ -590,7 +590,7 @@ class se extends W {
|
|
|
590
590
|
a.setSource(t);
|
|
591
591
|
else {
|
|
592
592
|
const m = await t.getBlob().getDataAsString();
|
|
593
|
-
a.setSource(m,
|
|
593
|
+
a.setSource(m, I.BASE64);
|
|
594
594
|
}
|
|
595
595
|
e !== void 0 ? a.setColumn(e) : a.setColumn(0), r !== void 0 ? a.setRow(r) : a.setRow(0), n !== void 0 ? a.setColumnOffset(n) : a.setColumnOffset(0), s !== void 0 ? a.setRowOffset(s) : a.setRowOffset(0);
|
|
596
596
|
const o = await a.buildAsync();
|
|
@@ -613,30 +613,30 @@ class se extends W {
|
|
|
613
613
|
const e = this._injector.get(h).getDrawingData(this._fWorkbook.getId(), this.getSheetId()), r = [];
|
|
614
614
|
for (const n in e) {
|
|
615
615
|
const s = e[n];
|
|
616
|
-
s.drawingType === _.DRAWING_IMAGE && r.push(this._injector.createInstance(
|
|
616
|
+
s.drawingType === _.DRAWING_IMAGE && r.push(this._injector.createInstance(d, s));
|
|
617
617
|
}
|
|
618
618
|
return r;
|
|
619
619
|
}
|
|
620
620
|
getImageById(t) {
|
|
621
621
|
const r = this._injector.get(h).getDrawingByParam({ unitId: this._fWorkbook.getId(), subUnitId: this.getSheetId(), drawingId: t });
|
|
622
|
-
return r && r.drawingType === _.DRAWING_IMAGE ? this._injector.createInstance(
|
|
622
|
+
return r && r.drawingType === _.DRAWING_IMAGE ? this._injector.createInstance(d, r) : null;
|
|
623
623
|
}
|
|
624
624
|
getActiveImages() {
|
|
625
625
|
const e = this._injector.get(h).getFocusDrawings(), r = [];
|
|
626
626
|
for (const n in e) {
|
|
627
627
|
const s = e[n];
|
|
628
|
-
r.push(this._injector.createInstance(
|
|
628
|
+
r.push(this._injector.createInstance(d, s));
|
|
629
629
|
}
|
|
630
630
|
return r;
|
|
631
631
|
}
|
|
632
632
|
updateImages(t) {
|
|
633
|
-
return this._commandService.syncExecuteCommand(
|
|
633
|
+
return this._commandService.syncExecuteCommand(g.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
|
|
634
634
|
}
|
|
635
635
|
onImageInserted(t) {
|
|
636
636
|
const e = this._injector.get(h);
|
|
637
637
|
return G(e.add$.subscribe((r) => {
|
|
638
638
|
const n = r.map(
|
|
639
|
-
(s) => this._injector.createInstance(
|
|
639
|
+
(s) => this._injector.createInstance(d, e.getDrawingByParam(s))
|
|
640
640
|
);
|
|
641
641
|
t(n);
|
|
642
642
|
}));
|
|
@@ -645,7 +645,7 @@ class se extends W {
|
|
|
645
645
|
const e = this._injector.get(h);
|
|
646
646
|
return G(e.remove$.subscribe((r) => {
|
|
647
647
|
const n = r.map(
|
|
648
|
-
(s) => this._injector.createInstance(
|
|
648
|
+
(s) => this._injector.createInstance(d, e.getDrawingByParam(s))
|
|
649
649
|
);
|
|
650
650
|
t(n);
|
|
651
651
|
}));
|
|
@@ -654,7 +654,7 @@ class se extends W {
|
|
|
654
654
|
const e = this._injector.get(h);
|
|
655
655
|
return G(e.update$.subscribe((r) => {
|
|
656
656
|
const n = r.map(
|
|
657
|
-
(s) => this._injector.createInstance(
|
|
657
|
+
(s) => this._injector.createInstance(d, e.getDrawingByParam(s))
|
|
658
658
|
);
|
|
659
659
|
t(n);
|
|
660
660
|
}));
|
|
@@ -670,7 +670,7 @@ class ae extends P {
|
|
|
670
670
|
return _;
|
|
671
671
|
}
|
|
672
672
|
get ImageSourceType() {
|
|
673
|
-
return
|
|
673
|
+
return I;
|
|
674
674
|
}
|
|
675
675
|
get SheetDrawingAnchorType() {
|
|
676
676
|
return Q;
|
|
@@ -715,7 +715,7 @@ class ce extends M {
|
|
|
715
715
|
case E.id:
|
|
716
716
|
this._beforeOverGridImageRemove(r.params);
|
|
717
717
|
break;
|
|
718
|
-
case
|
|
718
|
+
case g.id:
|
|
719
719
|
this._beforeOverGridImageChange(r.params);
|
|
720
720
|
break;
|
|
721
721
|
case B.id:
|
|
@@ -730,7 +730,7 @@ class ce extends M {
|
|
|
730
730
|
case E.id:
|
|
731
731
|
this._overGridImageRemoved(r.params);
|
|
732
732
|
break;
|
|
733
|
-
case
|
|
733
|
+
case g.id:
|
|
734
734
|
this._overGridImageChanged(r.params);
|
|
735
735
|
break;
|
|
736
736
|
case B.id:
|
|
@@ -800,7 +800,7 @@ class ce extends M {
|
|
|
800
800
|
const c = n.getDrawingByParam(o);
|
|
801
801
|
c != null && s.push({
|
|
802
802
|
changeParam: o,
|
|
803
|
-
image: this._injector.createInstance(
|
|
803
|
+
image: this._injector.createInstance(d, c)
|
|
804
804
|
});
|
|
805
805
|
});
|
|
806
806
|
const a = {
|
|
@@ -816,7 +816,7 @@ class ce extends M {
|
|
|
816
816
|
const e = this.getActiveUniverSheet();
|
|
817
817
|
if (e == null || t == null)
|
|
818
818
|
return;
|
|
819
|
-
const { drawings: r } = t, n = this._injector.get(u), s = r.map((a) => this._injector.createInstance(
|
|
819
|
+
const { drawings: r } = t, n = this._injector.get(u), s = r.map((a) => this._injector.createInstance(d, n.getDrawingByParam(a)));
|
|
820
820
|
this.fireEvent(this.Event.OverGridImageChanged, {
|
|
821
821
|
workbook: e,
|
|
822
822
|
images: s
|
|
@@ -849,7 +849,7 @@ class ce extends M {
|
|
|
849
849
|
});
|
|
850
850
|
}
|
|
851
851
|
_createFOverGridImage(t) {
|
|
852
|
-
return t.map((e) => this._injector.createInstance(
|
|
852
|
+
return t.map((e) => this._injector.createInstance(d, e));
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
855
|
M.extend(ce);
|