@univerjs/docs-drawing-ui 0.6.10-experimental.20250428-ab93895 → 0.6.10-experimental.20250428-63779a3
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 +1 -1
- package/lib/es/index.js +166 -160
- package/lib/index.js +166 -160
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
package/lib/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var kt = Object.defineProperty;
|
|
2
2
|
var Wt = (i, e, n) => e in i ? kt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
3
|
var Se = (i, e, n) => Wt(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { CommandType as Y, ICommandService as $, IUniverInstanceService as q, TextX as On, JSONX as X, MemoryCursor as Ht, TextXActionType as Q, IUndoRedoService as Jn, BuildTextUtils as Gt, ArrangeTypeEnum as en, Tools as be, Inject as J, IContextService as et, LocaleService as fn, Disposable as Be, WrapTextType as Ke, PositionedObjectLayoutType as W, BooleanNumber as ae, DrawingTypeEnum as Ue, ObjectRelativeFromV as H, ObjectRelativeFromH as ne, FOCUSING_COMMON_DRAWINGS as sn, UniverInstanceType as _e, Direction as fe, DocumentFlavor as In, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Pn, FOCUSING_UNIVER_EDITOR as jt, UndoCommand as Vt, RedoCommand as $t, DisposableCollection as zt, toDisposable as Oe, fromEventSubject as nt, generateRandomId as Xt, Injector as tt,
|
|
4
|
+
import { CommandType as Y, ICommandService as $, IUniverInstanceService as q, TextX as On, JSONX as X, MemoryCursor as Ht, TextXActionType as Q, IUndoRedoService as Jn, BuildTextUtils as Gt, ArrangeTypeEnum as en, Tools as be, Inject as J, IContextService as et, LocaleService as fn, Disposable as Be, WrapTextType as Ke, PositionedObjectLayoutType as W, BooleanNumber as ae, DrawingTypeEnum as Ue, ObjectRelativeFromV as H, ObjectRelativeFromH as ne, FOCUSING_COMMON_DRAWINGS as sn, UniverInstanceType as _e, Direction as fe, DocumentFlavor as In, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Pn, FOCUSING_UNIVER_EDITOR as jt, UndoCommand as Vt, RedoCommand as $t, DisposableCollection as zt, toDisposable as Oe, fromEventSubject as nt, generateRandomId as Xt, Injector as tt, DOC_DRAWING_PRINTING_COMPONENT_KEY as qt, throttle as An, COLORS as Kt, RxDisposable as Yt, LifecycleService as Zt, LifecycleStages as xn, DependentOn as Qt, IConfigService as Jt, Plugin as ei, merge as ni } from "@univerjs/core";
|
|
5
5
|
import { IDocDrawingService as Fe, UniverDocsDrawingPlugin as ti } from "@univerjs/docs-drawing";
|
|
6
6
|
import { IImageIoService as ii, IDrawingManagerService as we, DRAWING_IMAGE_ALLOW_IMAGE_LIST as ri, DRAWING_IMAGE_COUNT_LIMIT as Ln, ImageUploadStatusType as _n, DRAWING_IMAGE_ALLOW_SIZE as oi, getImageSize as si, getDrawingShapeKeyByDrawingSearch as ai, DRAWING_IMAGE_WIDTH_LIMIT as Un, DRAWING_IMAGE_HEIGHT_LIMIT as Bn, UniverDrawingPlugin as ci } from "@univerjs/drawing";
|
|
7
7
|
import { DrawingCommonPanel as di, DrawingRenderService as it, ImageCropperObject as li, COMPONENT_IMAGE_POPUP_MENU as gi, OpenImageCropOperation as mi, ImageResetSizeOperation as ui, UniverDrawingUIPlugin as hi } from "@univerjs/drawing-ui";
|
|
@@ -77,9 +77,9 @@ const bn = {
|
|
|
77
77
|
const n = i.get($), t = i.get(q), r = i.get(ee), o = t.getCurrentUniverDocInstance();
|
|
78
78
|
if (e == null || o == null)
|
|
79
79
|
return !1;
|
|
80
|
-
const s = r.getRenderById(e.unitId).with(Re), { drawings: c } = e, d = (b = s.getSegment()) != null ? b : "", a = new On(),
|
|
80
|
+
const s = r.getRenderById(e.unitId).with(Re), { drawings: c } = e, d = (b = s.getSegment()) != null ? b : "", a = new On(), l = X.getInstance(), m = (E = (y = o.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : y.customBlocks) != null ? E : [], g = c.map((N) => m.find((_) => _.blockId === N.drawingId)).filter((N) => !!N).sort((N, _) => N.startIndex > _.startIndex ? 1 : -1), p = c[0].unitId, u = new Ht();
|
|
81
81
|
u.reset();
|
|
82
|
-
const v =
|
|
82
|
+
const v = g[0].startIndex, w = [
|
|
83
83
|
{
|
|
84
84
|
startOffset: v,
|
|
85
85
|
endOffset: v
|
|
@@ -92,7 +92,7 @@ const bn = {
|
|
|
92
92
|
textRanges: w
|
|
93
93
|
}
|
|
94
94
|
}, O = [];
|
|
95
|
-
for (const N of
|
|
95
|
+
for (const N of g) {
|
|
96
96
|
const { startIndex: _ } = N;
|
|
97
97
|
_ > u.cursor && a.push({
|
|
98
98
|
t: Q.RETAIN,
|
|
@@ -103,9 +103,9 @@ const bn = {
|
|
|
103
103
|
}), u.moveCursorTo(_ + 1);
|
|
104
104
|
}
|
|
105
105
|
const C = Ye(o, d);
|
|
106
|
-
O.push(
|
|
107
|
-
for (const N of
|
|
108
|
-
const { blockId: _ } = N, L = ((B = o.getDrawings()) != null ? B : {})[_], x = o.getDrawingsOrder().indexOf(_), j =
|
|
106
|
+
O.push(l.editOp(a.serialize(), C));
|
|
107
|
+
for (const N of g) {
|
|
108
|
+
const { blockId: _ } = N, L = ((B = o.getDrawings()) != null ? B : {})[_], x = o.getDrawingsOrder().indexOf(_), j = l.removeOp(["drawings", _], L), S = l.removeOp(["drawingsOrder", x], _);
|
|
109
109
|
O.push(j), O.push(S);
|
|
110
110
|
}
|
|
111
111
|
return I.params.actions = O.reduce((N, _) => X.compose(N, _), null), !!n.syncExecuteCommand(I.id, I.params);
|
|
@@ -118,12 +118,12 @@ const bn = {
|
|
|
118
118
|
if (t.length === 0)
|
|
119
119
|
return !1;
|
|
120
120
|
const { unitId: r } = t[0], o = t.map((s) => {
|
|
121
|
-
const { unitId: c, subUnitId: d, drawingId: a, drawingType:
|
|
121
|
+
const { unitId: c, subUnitId: d, drawingId: a, drawingType: l } = s;
|
|
122
122
|
return {
|
|
123
123
|
unitId: c,
|
|
124
124
|
subUnitId: d,
|
|
125
125
|
drawingId: a,
|
|
126
|
-
drawingType:
|
|
126
|
+
drawingType: l
|
|
127
127
|
};
|
|
128
128
|
});
|
|
129
129
|
return e.executeCommand(bn.id, {
|
|
@@ -139,9 +139,9 @@ const bn = {
|
|
|
139
139
|
const n = i.get(Fe);
|
|
140
140
|
if (!e) return !1;
|
|
141
141
|
const t = [];
|
|
142
|
-
e.forEach(({ parent:
|
|
143
|
-
t.push(
|
|
144
|
-
t.push(
|
|
142
|
+
e.forEach(({ parent: l, children: m }) => {
|
|
143
|
+
t.push(l.unitId), m.forEach((g) => {
|
|
144
|
+
t.push(g.unitId);
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
147
|
const r = n.getGroupDrawingOp(e), { unitId: o, subUnitId: s, undo: c, redo: d, objects: a } = r;
|
|
@@ -158,20 +158,20 @@ const bn = {
|
|
|
158
158
|
const n = i.get($), t = i.get(Tn), r = i.get(q), o = t.getActiveTextRange(), s = r.getCurrentUniverDocInstance();
|
|
159
159
|
if (o == null || s == null)
|
|
160
160
|
return !1;
|
|
161
|
-
const c = s.getUnitId(), { drawings: d } = e, { collapsed: a, startOffset:
|
|
162
|
-
if (
|
|
161
|
+
const c = s.getUnitId(), { drawings: d } = e, { collapsed: a, startOffset: l, segmentId: m } = o, g = s.getSelfOrHeaderFooterModel(m).getBody();
|
|
162
|
+
if (g == null)
|
|
163
163
|
return !1;
|
|
164
164
|
const p = new On(), u = X.getInstance(), v = [], w = (E = (y = s.getSnapshot().drawingsOrder) == null ? void 0 : y.length) != null ? E : 0;
|
|
165
165
|
let I = 0;
|
|
166
166
|
if (a)
|
|
167
|
-
|
|
167
|
+
l > 0 && p.push({
|
|
168
168
|
t: Q.RETAIN,
|
|
169
|
-
len:
|
|
169
|
+
len: l
|
|
170
170
|
});
|
|
171
171
|
else {
|
|
172
|
-
const _ = Gt.selection.delete([o],
|
|
172
|
+
const _ = Gt.selection.delete([o], g, 0, null, !1);
|
|
173
173
|
p.push(..._);
|
|
174
|
-
const L = Ri(
|
|
174
|
+
const L = Ri(g, [o]), G = (B = s.getDrawings()) != null ? B : {}, x = (N = s.getDrawingsOrder()) != null ? N : [], j = L.sort((S, D) => x.indexOf(S) > x.indexOf(D) ? -1 : x.indexOf(S) < x.indexOf(D) ? 1 : 0);
|
|
175
175
|
if (j.length > 0)
|
|
176
176
|
for (const S of j) {
|
|
177
177
|
const D = G[S], R = x.indexOf(S);
|
|
@@ -219,12 +219,12 @@ const bn = {
|
|
|
219
219
|
let a;
|
|
220
220
|
if (c === en.forward ? a = t.getForwardDrawingsOp(d) : c === en.backward ? a = t.getBackwardDrawingOp(d) : c === en.front ? a = t.getFrontDrawingsOp(d) : c === en.back && (a = t.getBackDrawingsOp(d)), a == null)
|
|
221
221
|
return !1;
|
|
222
|
-
const { redo:
|
|
223
|
-
if (
|
|
222
|
+
const { redo: l } = a;
|
|
223
|
+
if (l == null)
|
|
224
224
|
return !1;
|
|
225
225
|
const m = [];
|
|
226
|
-
let
|
|
227
|
-
|
|
226
|
+
let g = be.deepClone(l);
|
|
227
|
+
g = g.slice(3), g.unshift("drawingsOrder"), m.push(g);
|
|
228
228
|
const p = {
|
|
229
229
|
id: te.id,
|
|
230
230
|
params: {
|
|
@@ -243,9 +243,9 @@ const bn = {
|
|
|
243
243
|
const n = i.get(Fe);
|
|
244
244
|
if (!e) return !1;
|
|
245
245
|
const t = [];
|
|
246
|
-
e.forEach(({ parent:
|
|
247
|
-
t.push(
|
|
248
|
-
t.push(
|
|
246
|
+
e.forEach(({ parent: l, children: m }) => {
|
|
247
|
+
t.push(l.unitId), m.forEach((g) => {
|
|
248
|
+
t.push(g.unitId);
|
|
249
249
|
});
|
|
250
250
|
});
|
|
251
251
|
const r = n.getUngroupDrawingOp(e), { unitId: o, subUnitId: s, undo: c, redo: d, objects: a } = r;
|
|
@@ -267,8 +267,8 @@ var Zi = Object.getOwnPropertyDescriptor, Qi = (i, e, n, t) => {
|
|
|
267
267
|
return r;
|
|
268
268
|
}, ue = (i, e) => (n, t) => e(n, t, i);
|
|
269
269
|
let an = class extends Be {
|
|
270
|
-
constructor(i, e, n, t, r, o, s, c, d, a,
|
|
271
|
-
super(), this._context = i, this._commandService = e, this._docSelectionManagerService = n, this._renderManagerSrv = t, this._imageIoService = r, this._docDrawingService = o, this._drawingManagerService = s, this._contextService = c, this._messageService = d, this._localeService = a, this._docSelectionRenderService =
|
|
270
|
+
constructor(i, e, n, t, r, o, s, c, d, a, l, m, g) {
|
|
271
|
+
super(), this._context = i, this._commandService = e, this._docSelectionManagerService = n, this._renderManagerSrv = t, this._imageIoService = r, this._docDrawingService = o, this._drawingManagerService = s, this._contextService = c, this._messageService = d, this._localeService = a, this._docSelectionRenderService = l, this._docRefreshDrawingsService = m, this._fileOpenerService = g, this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._transformDrawingListener(), this._editAreaChangeListener();
|
|
272
272
|
}
|
|
273
273
|
async insertDocImage() {
|
|
274
274
|
const i = await this._fileOpenerService.openFile({
|
|
@@ -310,14 +310,14 @@ let an = class extends Be {
|
|
|
310
310
|
for (const r of e) {
|
|
311
311
|
if (r == null)
|
|
312
312
|
continue;
|
|
313
|
-
const { imageId: o, imageSourceType: s, source: c, base64Cache: d } = r, { width: a, height:
|
|
313
|
+
const { imageId: o, imageSourceType: s, source: c, base64Cache: d } = r, { width: a, height: l, image: m } = await si(d || "");
|
|
314
314
|
this._imageIoService.addImageSourceCache(o, s, m);
|
|
315
|
-
let
|
|
316
|
-
if (a > Un ||
|
|
317
|
-
const w = Un / a, I = Bn /
|
|
318
|
-
|
|
315
|
+
let g = 1;
|
|
316
|
+
if (a > Un || l > Bn) {
|
|
317
|
+
const w = Un / a, I = Bn / l;
|
|
318
|
+
g = Math.min(w, I);
|
|
319
319
|
}
|
|
320
|
-
const p = this._getImagePosition(a *
|
|
320
|
+
const p = this._getImagePosition(a * g, l * g);
|
|
321
321
|
if (p == null)
|
|
322
322
|
return;
|
|
323
323
|
const u = {
|
|
@@ -433,10 +433,10 @@ let an = class extends Be {
|
|
|
433
433
|
if (((s = n == null ? void 0 : n.customBlocks) != null ? s : []).some((a) => a.blockId === i))
|
|
434
434
|
return "";
|
|
435
435
|
for (const a of Object.keys(t))
|
|
436
|
-
if ((c = t[a].body.customBlocks) != null && c.some((
|
|
436
|
+
if ((c = t[a].body.customBlocks) != null && c.some((l) => l.blockId === i))
|
|
437
437
|
return a;
|
|
438
438
|
for (const a of Object.keys(r))
|
|
439
|
-
if ((d = r[a].body.customBlocks) != null && d.some((
|
|
439
|
+
if ((d = r[a].body.customBlocks) != null && d.some((l) => l.blockId === i))
|
|
440
440
|
return a;
|
|
441
441
|
return "";
|
|
442
442
|
}
|
|
@@ -448,18 +448,18 @@ let an = class extends Be {
|
|
|
448
448
|
return;
|
|
449
449
|
const r = i.getSnapshot(), { drawings: o = {} } = r, s = t.getEditArea() === Ge.BODY;
|
|
450
450
|
for (const d of Object.keys(o)) {
|
|
451
|
-
const a = o[d],
|
|
451
|
+
const a = o[d], l = ai({ unitId: n, drawingId: a.drawingId, subUnitId: n }), m = e.fuzzyMathObjects(l, !0);
|
|
452
452
|
if (m.length)
|
|
453
|
-
for (const
|
|
454
|
-
e.detachTransformerFrom(
|
|
453
|
+
for (const g of m) {
|
|
454
|
+
e.detachTransformerFrom(g);
|
|
455
455
|
try {
|
|
456
|
-
|
|
456
|
+
g.setOpacity(0.5);
|
|
457
457
|
} catch {
|
|
458
458
|
}
|
|
459
459
|
if (s && a.isMultiTransform !== ae.TRUE || !s && a.isMultiTransform === ae.TRUE) {
|
|
460
|
-
a.allowTransform !== !1 && e.attachTransformerTo(
|
|
460
|
+
a.allowTransform !== !1 && e.attachTransformerTo(g);
|
|
461
461
|
try {
|
|
462
|
-
|
|
462
|
+
g.setOpacity(1);
|
|
463
463
|
} catch {
|
|
464
464
|
}
|
|
465
465
|
}
|
|
@@ -527,13 +527,13 @@ const Ji = {
|
|
|
527
527
|
};
|
|
528
528
|
function Dt(i, e, n, t, r, o, s) {
|
|
529
529
|
var p, u;
|
|
530
|
-
const c = new On(), d = X.getInstance(), a = [],
|
|
531
|
-
if (
|
|
530
|
+
const c = new On(), d = X.getInstance(), a = [], l = o.getSelfOrHeaderFooterModel(e).getBody(), m = o.getSelfOrHeaderFooterModel(i).getBody();
|
|
531
|
+
if (l == null || m == null)
|
|
532
532
|
return;
|
|
533
|
-
const
|
|
534
|
-
if (
|
|
533
|
+
const g = (u = (p = l.customBlocks) == null ? void 0 : p.find((v) => v.blockId === r)) == null ? void 0 : u.startIndex;
|
|
534
|
+
if (g != null) {
|
|
535
535
|
if (t = Math.min(m.dataStream.length - 2, t), i === e) {
|
|
536
|
-
if (t <
|
|
536
|
+
if (t < g ? (t > 0 && c.push({
|
|
537
537
|
t: Q.RETAIN,
|
|
538
538
|
len: t
|
|
539
539
|
}), c.push({
|
|
@@ -548,19 +548,19 @@ function Dt(i, e, n, t, r, o, s) {
|
|
|
548
548
|
len: 1
|
|
549
549
|
}), c.push({
|
|
550
550
|
t: Q.RETAIN,
|
|
551
|
-
len:
|
|
551
|
+
len: g - t
|
|
552
552
|
}), c.push({
|
|
553
553
|
t: Q.DELETE,
|
|
554
554
|
len: 1
|
|
555
|
-
})) : (
|
|
555
|
+
})) : (g > 0 && c.push({
|
|
556
556
|
t: Q.RETAIN,
|
|
557
|
-
len:
|
|
557
|
+
len: g
|
|
558
558
|
}), c.push({
|
|
559
559
|
t: Q.DELETE,
|
|
560
560
|
len: 1
|
|
561
|
-
}), t -
|
|
561
|
+
}), t - g - 1 > 0 && c.push({
|
|
562
562
|
t: Q.RETAIN,
|
|
563
|
-
len: t -
|
|
563
|
+
len: t - g - 1
|
|
564
564
|
}), c.push({
|
|
565
565
|
t: Q.INSERT,
|
|
566
566
|
body: {
|
|
@@ -571,14 +571,14 @@ function Dt(i, e, n, t, r, o, s) {
|
|
|
571
571
|
}]
|
|
572
572
|
},
|
|
573
573
|
len: 1
|
|
574
|
-
})), t !==
|
|
574
|
+
})), t !== g) {
|
|
575
575
|
const v = Ye(o, e), w = d.editOp(c.serialize(), v);
|
|
576
576
|
a.push(w);
|
|
577
577
|
}
|
|
578
578
|
} else {
|
|
579
|
-
|
|
579
|
+
g > 0 && c.push({
|
|
580
580
|
t: Q.RETAIN,
|
|
581
|
-
len:
|
|
581
|
+
len: g
|
|
582
582
|
}), c.push({
|
|
583
583
|
t: Q.DELETE,
|
|
584
584
|
len: 1
|
|
@@ -610,10 +610,10 @@ const Ct = {
|
|
|
610
610
|
var E, B;
|
|
611
611
|
if (e == null)
|
|
612
612
|
return !1;
|
|
613
|
-
const { drawings: n, wrappingStyle: t, unitId: r } = e, o = i.get($), s = i.get(q), d = i.get(ee).getRenderById(r), a = d == null ? void 0 : d.with(ie).getSkeleton().getSkeletonData(),
|
|
614
|
-
if (
|
|
613
|
+
const { drawings: n, wrappingStyle: t, unitId: r } = e, o = i.get($), s = i.get(q), d = i.get(ee).getRenderById(r), a = d == null ? void 0 : d.with(ie).getSkeleton().getSkeletonData(), l = d == null ? void 0 : d.with(ie).getViewModel(), m = d == null ? void 0 : d.scene, g = s.getCurrentUniverDocInstance();
|
|
614
|
+
if (g == null || a == null || m == null || l == null)
|
|
615
615
|
return !1;
|
|
616
|
-
const p =
|
|
616
|
+
const p = l.getEditArea(), u = m.getTransformerByCreate(), { pages: v, skeHeaders: w, skeFooters: I } = a, O = X.getInstance(), C = [], { drawings: P = {} } = g.getSnapshot();
|
|
617
617
|
for (const N of n) {
|
|
618
618
|
const { drawingId: _ } = N, L = P[_].layoutType, G = Ji[t];
|
|
619
619
|
if (L !== G) {
|
|
@@ -697,11 +697,11 @@ const Ct = {
|
|
|
697
697
|
const n = i.get($), r = i.get(q).getCurrentUniverDocInstance();
|
|
698
698
|
if (r == null)
|
|
699
699
|
return !1;
|
|
700
|
-
const { drawings: o, dist: s, unitId: c } = e, d = X.getInstance(), a = [], { drawings:
|
|
700
|
+
const { drawings: o, dist: s, unitId: c } = e, d = X.getInstance(), a = [], { drawings: l = {} } = r.getSnapshot();
|
|
701
701
|
for (const p of o) {
|
|
702
702
|
const { drawingId: u } = p;
|
|
703
703
|
for (const [v, w] of Object.entries(s)) {
|
|
704
|
-
const I =
|
|
704
|
+
const I = l[u][v];
|
|
705
705
|
if (I !== w) {
|
|
706
706
|
const O = d.replaceOp(["drawings", u, v], I, w);
|
|
707
707
|
a.push(O);
|
|
@@ -727,9 +727,9 @@ const Ct = {
|
|
|
727
727
|
const n = i.get($), r = i.get(q).getCurrentUniverDocInstance();
|
|
728
728
|
if (r == null)
|
|
729
729
|
return !1;
|
|
730
|
-
const { drawings: o, wrapText: s, unitId: c } = e, d = X.getInstance(), a = [], { drawings:
|
|
730
|
+
const { drawings: o, wrapText: s, unitId: c } = e, d = X.getInstance(), a = [], { drawings: l = {} } = r.getSnapshot();
|
|
731
731
|
for (const p of o) {
|
|
732
|
-
const { drawingId: u } = p, v =
|
|
732
|
+
const { drawingId: u } = p, v = l[u].wrapText;
|
|
733
733
|
if (v !== s) {
|
|
734
734
|
const w = d.replaceOp(["drawings", u, "wrapText"], v, s);
|
|
735
735
|
a.push(w);
|
|
@@ -757,24 +757,24 @@ const Ct = {
|
|
|
757
757
|
const c = s.getTransformerByCreate(), d = t.getCurrentUniverDocInstance();
|
|
758
758
|
if (d == null)
|
|
759
759
|
return !1;
|
|
760
|
-
const { drawings: a, unitId:
|
|
760
|
+
const { drawings: a, unitId: l } = e, m = X.getInstance(), g = [], { drawings: p = {} } = d.getSnapshot();
|
|
761
761
|
for (const w of a) {
|
|
762
762
|
const { drawingId: I, key: O, value: C } = w, P = p[I].docTransform[O];
|
|
763
763
|
if (!be.diffValue(P, C)) {
|
|
764
764
|
const b = m.replaceOp(["drawings", I, "docTransform", O], P, C);
|
|
765
|
-
|
|
765
|
+
g.push(b);
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
768
|
const u = {
|
|
769
769
|
id: te.id,
|
|
770
770
|
params: {
|
|
771
|
-
unitId:
|
|
771
|
+
unitId: l,
|
|
772
772
|
actions: [],
|
|
773
773
|
textRanges: null,
|
|
774
774
|
debounce: !0
|
|
775
775
|
}
|
|
776
776
|
};
|
|
777
|
-
u.params.actions =
|
|
777
|
+
u.params.actions = g.reduce((w, I) => X.compose(w, I), null);
|
|
778
778
|
const v = n.syncExecuteCommand(u.id, u.params);
|
|
779
779
|
return c.refreshControls(), !!v;
|
|
780
780
|
}
|
|
@@ -791,10 +791,10 @@ const Ct = {
|
|
|
791
791
|
const d = s.getTransformerByCreate(), a = i.get($), m = i.get(q).getCurrentUniverDocInstance();
|
|
792
792
|
if (m == null)
|
|
793
793
|
return !1;
|
|
794
|
-
const { drawing:
|
|
794
|
+
const { drawing: g, unitId: p, offset: u, segmentId: v, segmentPage: w, needRefreshDrawings: I } = e;
|
|
795
795
|
if (I)
|
|
796
796
|
return r.refreshDrawings(c), d.refreshControls(), !0;
|
|
797
|
-
const O = [], { drawingId: C } =
|
|
797
|
+
const O = [], { drawingId: C } = g, P = (N = t.getSegment()) != null ? N : "", b = Dt(
|
|
798
798
|
v,
|
|
799
799
|
P,
|
|
800
800
|
w,
|
|
@@ -832,11 +832,11 @@ const Ct = {
|
|
|
832
832
|
const s = o.getTransformerByCreate(), c = i.get($), a = i.get(q).getCurrentUniverDocInstance();
|
|
833
833
|
if (a == null)
|
|
834
834
|
return !1;
|
|
835
|
-
const { drawing:
|
|
835
|
+
const { drawing: l, unitId: m, offset: g, docTransform: p, segmentId: u, segmentPage: v } = e, w = [], { drawingId: I } = l, O = (j = t.getSegment()) != null ? j : "", C = Dt(
|
|
836
836
|
u,
|
|
837
837
|
O,
|
|
838
838
|
v,
|
|
839
|
-
|
|
839
|
+
g,
|
|
840
840
|
I,
|
|
841
841
|
a,
|
|
842
842
|
t
|
|
@@ -881,12 +881,12 @@ const Ct = {
|
|
|
881
881
|
const n = i.get($), t = i.get(Fe), r = i.get(q), o = i.get(ee), { direction: s } = e, c = t.getFocusDrawings();
|
|
882
882
|
if (c.length === 0)
|
|
883
883
|
return !1;
|
|
884
|
-
const d = c[0].unitId, a = o.getRenderById(d),
|
|
885
|
-
if (
|
|
884
|
+
const d = c[0].unitId, a = o.getRenderById(d), l = a == null ? void 0 : a.scene;
|
|
885
|
+
if (l == null)
|
|
886
886
|
return !1;
|
|
887
|
-
const m =
|
|
887
|
+
const m = l.getTransformerByCreate(), g = r.getUniverDocInstance(d), p = c.map((v) => {
|
|
888
888
|
var y, E, B, N, _;
|
|
889
|
-
const { drawingId: w } = v, I = (y =
|
|
889
|
+
const { drawingId: w } = v, I = (y = g == null ? void 0 : g.getSnapshot().drawings) == null ? void 0 : y[w];
|
|
890
890
|
if (I == null || I.layoutType === W.INLINE)
|
|
891
891
|
return null;
|
|
892
892
|
const { positionH: O, positionV: C } = I.docTransform, P = { ...O }, b = { ...C };
|
|
@@ -959,10 +959,10 @@ const Ct = {
|
|
|
959
959
|
const e = Ie($), n = Ie(fn), t = Ie(we), r = Ie(ee), o = Ie(q), { drawings: s } = i, c = s[0];
|
|
960
960
|
if (c == null)
|
|
961
961
|
return;
|
|
962
|
-
const { unitId: d } = c, a = o.getUniverDocInstance(d),
|
|
963
|
-
if (
|
|
962
|
+
const { unitId: d } = c, a = o.getUniverDocInstance(d), l = a == null ? void 0 : a.getSnapshot().documentStyle.documentFlavor, m = r.getRenderById(d), g = m == null ? void 0 : m.scene;
|
|
963
|
+
if (g == null)
|
|
964
964
|
return;
|
|
965
|
-
const p =
|
|
965
|
+
const p = g.getTransformerByCreate(), u = [{
|
|
966
966
|
label: n.t("image-position.column"),
|
|
967
967
|
value: String(ne.COLUMN)
|
|
968
968
|
}, {
|
|
@@ -974,15 +974,15 @@ const Ct = {
|
|
|
974
974
|
}], v = [{
|
|
975
975
|
label: n.t("image-position.line"),
|
|
976
976
|
value: String(H.LINE),
|
|
977
|
-
disabled:
|
|
977
|
+
disabled: l === In.MODERN
|
|
978
978
|
}, {
|
|
979
979
|
label: n.t("image-position.page"),
|
|
980
980
|
value: String(H.PAGE),
|
|
981
|
-
disabled:
|
|
981
|
+
disabled: l === In.MODERN
|
|
982
982
|
}, {
|
|
983
983
|
label: n.t("image-position.margin"),
|
|
984
984
|
value: String(H.MARGIN),
|
|
985
|
-
disabled:
|
|
985
|
+
disabled: l === In.MODERN
|
|
986
986
|
}, {
|
|
987
987
|
label: n.t("image-position.paragraph"),
|
|
988
988
|
value: String(H.PARAGRAPH)
|
|
@@ -1190,10 +1190,10 @@ const Ct = {
|
|
|
1190
1190
|
const e = Ie($), n = Ie(fn), t = Ie(we), r = Ie(ee), o = Ie(q), { drawings: s } = i, c = s[0];
|
|
1191
1191
|
if (c == null)
|
|
1192
1192
|
return null;
|
|
1193
|
-
const { unitId: d } = c, a = o.getUniverDocInstance(d),
|
|
1194
|
-
if ((
|
|
1193
|
+
const { unitId: d } = c, a = o.getUniverDocInstance(d), l = r.getRenderById(d);
|
|
1194
|
+
if ((l == null ? void 0 : l.scene) == null)
|
|
1195
1195
|
return null;
|
|
1196
|
-
const [
|
|
1196
|
+
const [g, p] = se(!0), [u, v] = se(!0), [w, I] = se(!0), [O, C] = se(he.INLINE), [P, b] = se(""), [y, E] = se({
|
|
1197
1197
|
distT: 0,
|
|
1198
1198
|
distL: 0,
|
|
1199
1199
|
distB: 0,
|
|
@@ -1320,7 +1320,7 @@ const Ct = {
|
|
|
1320
1320
|
/* @__PURE__ */ h(Me, { value: he.IN_FRONT_OF_TEXT, children: n.t("image-text-wrap.inFrontText") })
|
|
1321
1321
|
] }) }) }),
|
|
1322
1322
|
/* @__PURE__ */ h("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ h("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSubtitle), children: /* @__PURE__ */ h("div", { children: n.t("image-text-wrap.wrapText") }) }) }),
|
|
1323
|
-
/* @__PURE__ */ h("div", { className: V(f.imageCommonPanelRow), children: /* @__PURE__ */ h("div", { className: V(f.imageCommonPanelColumn), children: /* @__PURE__ */ K($n, { disabled:
|
|
1323
|
+
/* @__PURE__ */ h("div", { className: V(f.imageCommonPanelRow), children: /* @__PURE__ */ h("div", { className: V(f.imageCommonPanelColumn), children: /* @__PURE__ */ K($n, { disabled: g, value: P, onChange: L, direction: "horizontal", children: [
|
|
1324
1324
|
/* @__PURE__ */ h(Me, { value: Ke.BOTH_SIDES, children: n.t("image-text-wrap.bothSide") }),
|
|
1325
1325
|
/* @__PURE__ */ h(Me, { value: Ke.LEFT, children: n.t("image-text-wrap.leftOnly") }),
|
|
1326
1326
|
/* @__PURE__ */ h(Me, { value: Ke.RIGHT, children: n.t("image-text-wrap.rightOnly") })
|
|
@@ -1420,9 +1420,9 @@ const Ct = {
|
|
|
1420
1420
|
var s;
|
|
1421
1421
|
const o = e.getActiveTextRange();
|
|
1422
1422
|
if (o) {
|
|
1423
|
-
const { segmentId: c, startOffset: d, endOffset: a } = o,
|
|
1424
|
-
if (m && m.length && m.some((
|
|
1425
|
-
const { startIndex: p, endIndex: u } =
|
|
1423
|
+
const { segmentId: c, startOffset: d, endOffset: a } = o, l = n.getCurrentUniverDocInstance(), m = (s = l == null ? void 0 : l.getSelfOrHeaderFooterModel(c).getBody()) == null ? void 0 : s.tables;
|
|
1424
|
+
if (m && m.length && m.some((g) => {
|
|
1425
|
+
const { startIndex: p, endIndex: u } = g;
|
|
1426
1426
|
return d >= p && d < u || a >= p && a < u;
|
|
1427
1427
|
})) {
|
|
1428
1428
|
t.next(!0);
|
|
@@ -1702,12 +1702,12 @@ var Mr = Object.getOwnPropertyDescriptor, br = (i, e, n, t) => {
|
|
|
1702
1702
|
return r;
|
|
1703
1703
|
}, We = (i, e) => (n, t) => e(n, t, i);
|
|
1704
1704
|
function xt(i, e, n = 1, t = 0) {
|
|
1705
|
-
const { top: r, left: o, bottom: s, right: c } = i, d = c - o, a = s - r,
|
|
1705
|
+
const { top: r, left: o, bottom: s, right: c } = i, d = c - o, a = s - r, l = e.getViewport(dt.VIEW_MAIN), { viewportScrollX: m, viewportScrollY: g } = l, { scaleX: p, scaleY: u } = e.getAncestorScale();
|
|
1706
1706
|
return {
|
|
1707
1707
|
startX: (o - m) * p,
|
|
1708
|
-
startY: (r -
|
|
1708
|
+
startY: (r - g) * u,
|
|
1709
1709
|
endX: (o + d - m) * p,
|
|
1710
|
-
endY: (r + a -
|
|
1710
|
+
endY: (r + a - g) * u,
|
|
1711
1711
|
width: d * p,
|
|
1712
1712
|
height: a * u,
|
|
1713
1713
|
rotate: t,
|
|
@@ -1771,7 +1771,7 @@ let ln = class extends Be {
|
|
|
1771
1771
|
if (!(c == null || c.length === 0))
|
|
1772
1772
|
for (const d of c) {
|
|
1773
1773
|
this._addHoverForRect(d);
|
|
1774
|
-
const a = new zt(),
|
|
1774
|
+
const a = new zt(), l = Sn(d, o.renderUnit), m = new yn(l), g = o.canvas, p = s.data, u = {
|
|
1775
1775
|
dispose: a,
|
|
1776
1776
|
rect: d,
|
|
1777
1777
|
position$: m,
|
|
@@ -1782,16 +1782,16 @@ let ln = class extends Be {
|
|
|
1782
1782
|
id: s.drawingId,
|
|
1783
1783
|
componentKey: s.componentKey,
|
|
1784
1784
|
onPointerDown: (w) => {
|
|
1785
|
-
|
|
1785
|
+
g.dispatchEvent(new PointerEvent(w.type, w));
|
|
1786
1786
|
},
|
|
1787
1787
|
onPointerMove: (w) => {
|
|
1788
|
-
|
|
1788
|
+
g.dispatchEvent(new PointerEvent(w.type, w));
|
|
1789
1789
|
},
|
|
1790
1790
|
onPointerUp: (w) => {
|
|
1791
|
-
|
|
1791
|
+
g.dispatchEvent(new PointerEvent(w.type, w));
|
|
1792
1792
|
},
|
|
1793
1793
|
onWheel: (w) => {
|
|
1794
|
-
|
|
1794
|
+
g.dispatchEvent(new WheelEvent(w.type, w));
|
|
1795
1795
|
},
|
|
1796
1796
|
data: p,
|
|
1797
1797
|
unitId: t
|
|
@@ -1871,7 +1871,7 @@ let ln = class extends Be {
|
|
|
1871
1871
|
if (!r) return !1;
|
|
1872
1872
|
const c = (v = r.renderUnit.with(ie).getSkeleton().getSkeletonData()) == null ? void 0 : v.pages[0];
|
|
1873
1873
|
if (!c) return !1;
|
|
1874
|
-
const { pageWidth: d, marginLeft: a, marginRight:
|
|
1874
|
+
const { pageWidth: d, marginLeft: a, marginRight: l } = c, m = d - a - l, g = {
|
|
1875
1875
|
size: {
|
|
1876
1876
|
width: (w = n.width) != null ? w : m,
|
|
1877
1877
|
height: n.height
|
|
@@ -1896,9 +1896,9 @@ let ln = class extends Be {
|
|
|
1896
1896
|
...e,
|
|
1897
1897
|
title: "",
|
|
1898
1898
|
description: "",
|
|
1899
|
-
docTransform:
|
|
1899
|
+
docTransform: g,
|
|
1900
1900
|
layoutType: W.INLINE,
|
|
1901
|
-
transform: ct(
|
|
1901
|
+
transform: ct(g)
|
|
1902
1902
|
}
|
|
1903
1903
|
]
|
|
1904
1904
|
};
|
|
@@ -1923,7 +1923,7 @@ const Rr = (i) => {
|
|
|
1923
1923
|
bottom: (a != null ? a : 0) + (c != null ? c : 0) - t.y
|
|
1924
1924
|
},
|
|
1925
1925
|
n
|
|
1926
|
-
),
|
|
1926
|
+
), g = {
|
|
1927
1927
|
position$: new yn(m),
|
|
1928
1928
|
position: m,
|
|
1929
1929
|
id: o.drawingId,
|
|
@@ -1938,7 +1938,7 @@ const Rr = (i) => {
|
|
|
1938
1938
|
},
|
|
1939
1939
|
unitId: o.unitId
|
|
1940
1940
|
};
|
|
1941
|
-
return [o.drawingId,
|
|
1941
|
+
return [o.drawingId, g];
|
|
1942
1942
|
}), [e, n, t]);
|
|
1943
1943
|
return /* @__PURE__ */ h("div", { style: { position: "absolute", top: 0, left: 0 }, children: r.map(([o, s]) => /* @__PURE__ */ h(yi, { layer: s, id: o, position: s.position }, o)) });
|
|
1944
1944
|
};
|
|
@@ -1977,13 +1977,19 @@ let gn = class extends Be {
|
|
|
1977
1977
|
if (o) {
|
|
1978
1978
|
const s = o.order.map((d) => {
|
|
1979
1979
|
const a = o.data[d];
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1980
|
+
if (a.drawingType === Ue.DRAWING_CHART)
|
|
1981
|
+
return {
|
|
1982
|
+
...a,
|
|
1983
|
+
componentKey: this._componetManager.get(qt)
|
|
1984
|
+
};
|
|
1985
|
+
if (a.drawingType === Ue.DRAWING_DOM) {
|
|
1986
|
+
const l = this._docPrintInterceptorService.getPrintComponent(a.componentKey);
|
|
1987
|
+
return {
|
|
1988
|
+
...a,
|
|
1989
|
+
componentKey: this._componetManager.get(l || a.componentKey)
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
return null;
|
|
1987
1993
|
}).filter(Boolean), c = Mi(Rr, this._injector);
|
|
1988
1994
|
return Fi(
|
|
1989
1995
|
/* @__PURE__ */ h(
|
|
@@ -2062,7 +2068,7 @@ let mn = class extends Be {
|
|
|
2062
2068
|
this._transformerCache.clear();
|
|
2063
2069
|
const { objects: s } = o;
|
|
2064
2070
|
for (const d of s.values()) {
|
|
2065
|
-
const { oKey: a, width:
|
|
2071
|
+
const { oKey: a, width: l, height: m, left: g, top: p, angle: u } = d, v = this._drawingManagerService.getDrawingOKey(a);
|
|
2066
2072
|
if (v == null)
|
|
2067
2073
|
continue;
|
|
2068
2074
|
const w = this._univerInstanceService.getUniverDocInstance(v.unitId), I = (c = w == null ? void 0 : w.getSnapshot().drawings) == null ? void 0 : c[v.drawingId];
|
|
@@ -2074,8 +2080,8 @@ let mn = class extends Be {
|
|
|
2074
2080
|
I != null && this._transformerCache.set(v.drawingId, {
|
|
2075
2081
|
drawing: I,
|
|
2076
2082
|
top: p,
|
|
2077
|
-
left:
|
|
2078
|
-
width:
|
|
2083
|
+
left: g,
|
|
2084
|
+
width: l,
|
|
2079
2085
|
height: m,
|
|
2080
2086
|
angle: u
|
|
2081
2087
|
});
|
|
@@ -2091,8 +2097,8 @@ let mn = class extends Be {
|
|
|
2091
2097
|
if (s.size > 1)
|
|
2092
2098
|
t(s);
|
|
2093
2099
|
else if (s.size === 1) {
|
|
2094
|
-
const a = this._transformerCache.values().next().value,
|
|
2095
|
-
if (a && m === a.width &&
|
|
2100
|
+
const a = this._transformerCache.values().next().value, l = s.values().next().value, { width: m, height: g, top: p, left: u, angle: v } = l;
|
|
2101
|
+
if (a && m === a.width && g === a.height && p === a.top && u === a.left && v === a.angle)
|
|
2096
2102
|
return;
|
|
2097
2103
|
a && (a.drawing.layoutType, W.INLINE), a && a.drawing.layoutType === W.INLINE && c != null && d != null && this._updateInlineDrawingAnchor(a.drawing, c, d);
|
|
2098
2104
|
}
|
|
@@ -2104,10 +2110,10 @@ let mn = class extends Be {
|
|
|
2104
2110
|
n.changeEnd$.subscribe((o) => {
|
|
2105
2111
|
const { objects: s, offsetX: c, offsetY: d } = o;
|
|
2106
2112
|
for (const a of s.values()) {
|
|
2107
|
-
const
|
|
2108
|
-
if (
|
|
2113
|
+
const l = this._drawingManagerService.getDrawingOKey(a.oKey);
|
|
2114
|
+
if (l == null)
|
|
2109
2115
|
continue;
|
|
2110
|
-
const m = this._transformerCache.get(
|
|
2116
|
+
const m = this._transformerCache.get(l == null ? void 0 : l.drawingId);
|
|
2111
2117
|
if ((m == null ? void 0 : m.drawing.layoutType) === W.INLINE)
|
|
2112
2118
|
try {
|
|
2113
2119
|
a.setOpacity(1);
|
|
@@ -2117,10 +2123,10 @@ let mn = class extends Be {
|
|
|
2117
2123
|
if (this._anchorShape && this._anchorShape.hide(), s.size > 1)
|
|
2118
2124
|
this._updateMultipleDrawingDocTransform(s);
|
|
2119
2125
|
else if (s.size === 1) {
|
|
2120
|
-
const a = this._transformerCache.values().next().value,
|
|
2121
|
-
if (a && m === a.width &&
|
|
2126
|
+
const a = this._transformerCache.values().next().value, l = s.values().next().value, { width: m, height: g, top: p, left: u, angle: v } = l;
|
|
2127
|
+
if (a && m === a.width && g === a.height && p === a.top && u === a.left && v === a.angle)
|
|
2122
2128
|
return;
|
|
2123
|
-
a && a.drawing.layoutType === W.INLINE ? m !== a.width ||
|
|
2129
|
+
a && a.drawing.layoutType === W.INLINE ? m !== a.width || g !== a.height || v !== a.angle ? this._updateDrawingSize(a, l) : c != null && d != null && this._moveInlineDrawing(a.drawing, c, d) : a && this._nonInlineDrawingTransform(a.drawing, l);
|
|
2124
2130
|
}
|
|
2125
2131
|
this._transformerCache.clear();
|
|
2126
2132
|
})
|
|
@@ -2135,37 +2141,37 @@ let mn = class extends Be {
|
|
|
2135
2141
|
let t, r;
|
|
2136
2142
|
for (const o of e.values()) {
|
|
2137
2143
|
const { oKey: s, left: c, top: d, angle: a } = o;
|
|
2138
|
-
let { width:
|
|
2139
|
-
const
|
|
2140
|
-
if (
|
|
2144
|
+
let { width: l, height: m } = o;
|
|
2145
|
+
const g = this._drawingManagerService.getDrawingOKey(s);
|
|
2146
|
+
if (g == null)
|
|
2141
2147
|
continue;
|
|
2142
|
-
t == null && (t =
|
|
2143
|
-
const p = this._transformerCache.get(
|
|
2148
|
+
t == null && (t = g.unitId), r == null && (r = g.subUnitId);
|
|
2149
|
+
const p = this._transformerCache.get(g.drawingId);
|
|
2144
2150
|
if (p == null)
|
|
2145
2151
|
continue;
|
|
2146
2152
|
const { drawing: u, top: v, left: w, width: I, height: O, angle: C } = p, { width: P, height: b } = this._getPageContentSize(u);
|
|
2147
|
-
if (
|
|
2148
|
-
drawingId:
|
|
2153
|
+
if (l = Math.min(l, P), m = Math.min(m, b), (I !== l || O !== m) && n.push({
|
|
2154
|
+
drawingId: g.drawingId,
|
|
2149
2155
|
key: "size",
|
|
2150
2156
|
value: {
|
|
2151
|
-
width:
|
|
2157
|
+
width: l,
|
|
2152
2158
|
height: m
|
|
2153
2159
|
}
|
|
2154
2160
|
}), C !== a && n.push({
|
|
2155
|
-
drawingId:
|
|
2161
|
+
drawingId: g.drawingId,
|
|
2156
2162
|
key: "angle",
|
|
2157
2163
|
value: a
|
|
2158
2164
|
}), v !== d || w !== c) {
|
|
2159
2165
|
const y = d - v, E = c - w;
|
|
2160
2166
|
y !== 0 && n.push({
|
|
2161
|
-
drawingId:
|
|
2167
|
+
drawingId: g.drawingId,
|
|
2162
2168
|
key: "positionV",
|
|
2163
2169
|
value: {
|
|
2164
2170
|
relativeFrom: u.docTransform.positionV.relativeFrom,
|
|
2165
2171
|
posOffset: u.docTransform.positionV.posOffset + y
|
|
2166
2172
|
}
|
|
2167
2173
|
}), E !== 0 && n.push({
|
|
2168
|
-
drawingId:
|
|
2174
|
+
drawingId: g.drawingId,
|
|
2169
2175
|
key: "positionH",
|
|
2170
2176
|
value: {
|
|
2171
2177
|
relativeFrom: u.docTransform.positionH.relativeFrom,
|
|
@@ -2200,9 +2206,9 @@ let mn = class extends Be {
|
|
|
2200
2206
|
if (r == null)
|
|
2201
2207
|
return;
|
|
2202
2208
|
const { mainComponent: s, scene: c } = r, d = s, a = c.getViewports()[0], {
|
|
2203
|
-
pageLayoutType:
|
|
2209
|
+
pageLayoutType: l = kn.VERTICAL,
|
|
2204
2210
|
pageMarginLeft: m,
|
|
2205
|
-
pageMarginTop:
|
|
2211
|
+
pageMarginTop: g
|
|
2206
2212
|
} = d.getOffsetConfig();
|
|
2207
2213
|
let p = null, u = !1, v = -1, w = "";
|
|
2208
2214
|
const I = 0.5, O = this._getTransformCoordForDocumentOffset(d, a, n, t);
|
|
@@ -2211,7 +2217,7 @@ let mn = class extends Be {
|
|
|
2211
2217
|
const C = (x = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : x.with(Re);
|
|
2212
2218
|
if (C == null)
|
|
2213
2219
|
return;
|
|
2214
|
-
const P = o == null ? void 0 : o.findNodeByCoord(O,
|
|
2220
|
+
const P = o == null ? void 0 : o.findNodeByCoord(O, l, m, g, {
|
|
2215
2221
|
strict: !1,
|
|
2216
2222
|
segmentId: C.getSegment(),
|
|
2217
2223
|
segmentPage: C.getSegmentPage()
|
|
@@ -2238,7 +2244,7 @@ let mn = class extends Be {
|
|
|
2238
2244
|
const t = this._renderManagerService.getRenderById(e.unitId), r = t == null ? void 0 : t.with(ie).getSkeleton(), o = r == null ? void 0 : r.getSkeletonData();
|
|
2239
2245
|
if (o == null || t == null)
|
|
2240
2246
|
return;
|
|
2241
|
-
const { pages: s, skeHeaders: c, skeFooters: d } = o, { mainComponent: a, scene:
|
|
2247
|
+
const { pages: s, skeHeaders: c, skeFooters: d } = o, { mainComponent: a, scene: l } = t, m = a, g = l.getViewports()[0], { pageLayoutType: p = kn.VERTICAL, pageMarginLeft: u, pageMarginTop: v, docsLeft: w, docsTop: I } = m.getOffsetConfig(), { left: O, top: C, angle: P } = n;
|
|
2242
2248
|
let { width: b, height: y } = n;
|
|
2243
2249
|
const { positionV: E, positionH: B } = e.docTransform, { width: N, height: _ } = this._getPageContentSize(e);
|
|
2244
2250
|
b = Math.min(b, N), y = Math.min(y, _);
|
|
@@ -2250,7 +2256,7 @@ let mn = class extends Be {
|
|
|
2250
2256
|
height: y
|
|
2251
2257
|
},
|
|
2252
2258
|
angle: P
|
|
2253
|
-
}, { x: D, y: R } =
|
|
2259
|
+
}, { x: D, y: R } = l.getViewportScrollXY(g), T = this._getTransformCoordForDocumentOffset(m, g, O - D, C - R);
|
|
2254
2260
|
if (T == null)
|
|
2255
2261
|
return;
|
|
2256
2262
|
const U = (De = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : De.with(Re);
|
|
@@ -2350,19 +2356,19 @@ let mn = class extends Be {
|
|
|
2350
2356
|
// Update drawing when use transformer to resize it.
|
|
2351
2357
|
_updateDrawingSize(e, n) {
|
|
2352
2358
|
const t = [], { drawing: r, width: o, height: s, angle: c } = e, { unitId: d, subUnitId: a } = r;
|
|
2353
|
-
let { width:
|
|
2359
|
+
let { width: l, height: m, angle: g } = n;
|
|
2354
2360
|
const { width: p, height: u } = this._getPageContentSize(r);
|
|
2355
|
-
|
|
2361
|
+
l = Math.min(p, l), m = Math.min(u, m), (l !== o || m !== s) && t.push({
|
|
2356
2362
|
drawingId: r.drawingId,
|
|
2357
2363
|
key: "size",
|
|
2358
2364
|
value: {
|
|
2359
|
-
width:
|
|
2365
|
+
width: l,
|
|
2360
2366
|
height: m
|
|
2361
2367
|
}
|
|
2362
|
-
}),
|
|
2368
|
+
}), g !== c && t.push({
|
|
2363
2369
|
drawingId: r.drawingId,
|
|
2364
2370
|
key: "angle",
|
|
2365
|
-
value:
|
|
2371
|
+
value: g
|
|
2366
2372
|
}), t.length > 0 && d && a && this._commandService.executeCommand(Ze.id, {
|
|
2367
2373
|
unitId: d,
|
|
2368
2374
|
subUnitId: a,
|
|
@@ -2385,8 +2391,8 @@ let mn = class extends Be {
|
|
|
2385
2391
|
// Limit the drawing to the page area, mainly in the vertical direction,
|
|
2386
2392
|
// and the upper and lower limits cannot exceed the page margin area.
|
|
2387
2393
|
_limitDrawingInPage(e, n) {
|
|
2388
|
-
const t = this._renderManagerService.getRenderById(e.unitId), { left: r, top: o, width: s, height: c, angle: d } = n, a = t == null ? void 0 : t.with(ie).getSkeleton(),
|
|
2389
|
-
if (
|
|
2394
|
+
const t = this._renderManagerService.getRenderById(e.unitId), { left: r, top: o, width: s, height: c, angle: d } = n, a = t == null ? void 0 : t.with(ie).getSkeleton(), l = a == null ? void 0 : a.getSkeletonData(), { pages: m } = l != null ? l : {};
|
|
2395
|
+
if (l == null || t == null || m == null)
|
|
2390
2396
|
return {
|
|
2391
2397
|
left: r,
|
|
2392
2398
|
top: o,
|
|
@@ -2394,7 +2400,7 @@ let mn = class extends Be {
|
|
|
2394
2400
|
height: c,
|
|
2395
2401
|
angle: d
|
|
2396
2402
|
};
|
|
2397
|
-
const { mainComponent:
|
|
2403
|
+
const { mainComponent: g } = t, p = g, { top: u, pageLayoutType: v, pageMarginLeft: w, pageMarginTop: I } = p;
|
|
2398
2404
|
let O = o;
|
|
2399
2405
|
this._liquid.reset();
|
|
2400
2406
|
for (const C of m) {
|
|
@@ -2456,15 +2462,15 @@ let mn = class extends Be {
|
|
|
2456
2462
|
const { mainComponent: r, scene: o } = t, s = r, {
|
|
2457
2463
|
docsLeft: c,
|
|
2458
2464
|
docsTop: d
|
|
2459
|
-
} = s.getOffsetConfig(), a = Ei(n), { left:
|
|
2465
|
+
} = s.getOffsetConfig(), a = Ei(n), { left: l, top: m, height: g } = a, p = l + c, u = m + d;
|
|
2460
2466
|
if (this._anchorShape) {
|
|
2461
|
-
this._anchorShape.transformByState({ left: p, top: u, height:
|
|
2467
|
+
this._anchorShape.transformByState({ left: p, top: u, height: g }), this._anchorShape.show();
|
|
2462
2468
|
return;
|
|
2463
2469
|
}
|
|
2464
2470
|
const v = 6, w = new wi(Lr + be.generateRandomId(v), {
|
|
2465
2471
|
left: p,
|
|
2466
2472
|
top: u,
|
|
2467
|
-
height:
|
|
2473
|
+
height: g,
|
|
2468
2474
|
strokeWidth: 2,
|
|
2469
2475
|
stroke: vi(Kt.darkGray, 1),
|
|
2470
2476
|
evented: !1
|
|
@@ -2484,17 +2490,17 @@ let mn = class extends Be {
|
|
|
2484
2490
|
const { pages: c } = s;
|
|
2485
2491
|
let d = null;
|
|
2486
2492
|
for (const a of c) {
|
|
2487
|
-
const { skeDrawings:
|
|
2488
|
-
if (
|
|
2493
|
+
const { skeDrawings: l } = a;
|
|
2494
|
+
if (l.has(e.drawingId)) {
|
|
2489
2495
|
d = a;
|
|
2490
2496
|
break;
|
|
2491
2497
|
}
|
|
2492
2498
|
}
|
|
2493
2499
|
if (d) {
|
|
2494
|
-
const { pageWidth: a, pageHeight:
|
|
2500
|
+
const { pageWidth: a, pageHeight: l, marginLeft: m, marginBottom: g, marginRight: p, marginTop: u } = d;
|
|
2495
2501
|
return {
|
|
2496
2502
|
width: Math.max(r, a - m - p),
|
|
2497
|
-
height: Math.max(o,
|
|
2503
|
+
height: Math.max(o, l - u - g)
|
|
2498
2504
|
};
|
|
2499
2505
|
} else
|
|
2500
2506
|
return {
|
|
@@ -2564,22 +2570,22 @@ let un = class extends Yt {
|
|
|
2564
2570
|
const d = c.oKey, a = this._drawingManagerService.getDrawingOKey(d);
|
|
2565
2571
|
if (!a || a.drawingType === Ue.DRAWING_DOM)
|
|
2566
2572
|
return;
|
|
2567
|
-
const { unitId:
|
|
2573
|
+
const { unitId: l, subUnitId: m, drawingId: g, drawingType: p } = a, u = this._canvasPopManagerService.attachPopupToObject(
|
|
2568
2574
|
c,
|
|
2569
2575
|
{
|
|
2570
2576
|
componentKey: gi,
|
|
2571
2577
|
direction: "horizontal",
|
|
2572
2578
|
offset: [2, 0],
|
|
2573
2579
|
extraProps: {
|
|
2574
|
-
menuItems: this._getImageMenuItems(
|
|
2580
|
+
menuItems: this._getImageMenuItems(l, m, g, p)
|
|
2575
2581
|
}
|
|
2576
2582
|
},
|
|
2577
|
-
|
|
2583
|
+
l
|
|
2578
2584
|
);
|
|
2579
|
-
r.push(this.disposeWithMe(u)), !this._drawingManagerService.getFocusDrawings().find((I) => I.unitId ===
|
|
2580
|
-
unitId:
|
|
2585
|
+
r.push(this.disposeWithMe(u)), !this._drawingManagerService.getFocusDrawings().find((I) => I.unitId === l && I.subUnitId === m && I.drawingId === g) && this._drawingManagerService.focusDrawing([{
|
|
2586
|
+
unitId: l,
|
|
2581
2587
|
subUnitId: m,
|
|
2582
|
-
drawingId:
|
|
2588
|
+
drawingId: g
|
|
2583
2589
|
}]);
|
|
2584
2590
|
})
|
|
2585
2591
|
)
|
|
@@ -2704,12 +2710,12 @@ let Cn = class extends Be {
|
|
|
2704
2710
|
const n = e == null ? void 0 : e.getSkeletonData(), { mainComponent: t, unitId: r } = this._context, o = t;
|
|
2705
2711
|
if (!n)
|
|
2706
2712
|
return;
|
|
2707
|
-
const { left: s, top: c, pageLayoutType: d, pageMarginLeft: a, pageMarginTop:
|
|
2713
|
+
const { left: s, top: c, pageLayoutType: d, pageMarginLeft: a, pageMarginTop: l } = o, { pages: m, skeHeaders: g, skeFooters: p } = n, u = {};
|
|
2708
2714
|
this._liquid.reset();
|
|
2709
2715
|
for (let P = 0, b = m.length; P < b; P++) {
|
|
2710
2716
|
const y = m[P], { headerId: E, footerId: B, pageWidth: N } = y;
|
|
2711
2717
|
if (E) {
|
|
2712
|
-
const _ = (O =
|
|
2718
|
+
const _ = (O = g.get(E)) == null ? void 0 : O.get(N);
|
|
2713
2719
|
_ && this._calculateDrawingPosition(
|
|
2714
2720
|
r,
|
|
2715
2721
|
_,
|
|
@@ -2732,7 +2738,7 @@ let Cn = class extends Be {
|
|
|
2732
2738
|
y.marginLeft
|
|
2733
2739
|
);
|
|
2734
2740
|
}
|
|
2735
|
-
this._calculateDrawingPosition(r, y, s, c, u, y.marginTop, y.marginLeft), this._liquid.translatePage(y, d, a,
|
|
2741
|
+
this._calculateDrawingPosition(r, y, s, c, u, y.marginTop, y.marginLeft), this._liquid.translatePage(y, d, a, l);
|
|
2736
2742
|
}
|
|
2737
2743
|
const v = Object.values(u), w = v.filter((P) => !P.isMultiTransform), I = v.filter((P) => P.isMultiTransform);
|
|
2738
2744
|
w.length > 0 && this._drawingManagerService.refreshTransform(w), this._handleMultiDrawingsTransform(I);
|
|
@@ -2756,11 +2762,11 @@ let Cn = class extends Be {
|
|
|
2756
2762
|
marginTop: s,
|
|
2757
2763
|
marginLeft: c
|
|
2758
2764
|
}), d.forEach((a) => {
|
|
2759
|
-
const { aLeft:
|
|
2760
|
-
left:
|
|
2765
|
+
const { aLeft: l, aTop: m, height: g, width: p, angle: u, drawingId: v, drawingOrigin: w } = a, I = w.layoutType === W.WRAP_NONE && w.behindDoc === ae.TRUE, { isMultiTransform: O = ae.FALSE } = w, C = {
|
|
2766
|
+
left: l + t + this._liquid.x,
|
|
2761
2767
|
top: m + r + this._liquid.y,
|
|
2762
2768
|
width: p,
|
|
2763
|
-
height:
|
|
2769
|
+
height: g,
|
|
2764
2770
|
angle: u
|
|
2765
2771
|
};
|
|
2766
2772
|
o[v] == null ? o[v] = {
|