@univerjs/sheets-drawing-ui 0.6.0 → 0.6.1
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 +490 -352
- package/lib/es/index.js +584 -581
- package/lib/types/facade/f-event.d.ts +61 -45
- package/lib/types/facade/f-over-grid-image.d.ts +378 -217
- package/lib/types/facade/f-worksheet.d.ts +290 -131
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +2 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +17 -17
package/lib/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Er = Object.defineProperty;
|
|
2
|
-
var Or = (i, n,
|
|
3
|
-
var Q = (i, n,
|
|
2
|
+
var Or = (i, n, t) => n in i ? Er(i, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[n] = t;
|
|
3
|
+
var Q = (i, n, t) => Or(i, typeof n != "symbol" ? n + "" : n, t);
|
|
4
4
|
import { CommandType as te, ICommandService as G, IUndoRedoService as Ye, sequenceExecute as kn, LocaleService as $t, IUniverInstanceService as Ge, Inject as N, Injector as tt, IContextService as Bn, RxDisposable as Ur, UniverInstanceType as F, toDisposable as Pr, FOCUSING_COMMON_DRAWINGS as Le, DrawingTypeEnum as L, Disposable as le, ArrangeTypeEnum as mt, createDocumentModelWithStyle as Ar, ObjectRelativeFromV as Nr, ObjectRelativeFromH as kr, WrapTextType as Br, PositionedObjectLayoutType as Wr, BooleanNumber as jr, BuildTextUtils as $r, Range as xr, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as pt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as wt, InterceptorEffectEnum as Lr, ObjectMatrix as Fr, Tools as ye, IPermissionService as Yr, UserManagerService as Gr, Rectangle as Xr, Direction as Ie, FOCUSING_FX_BAR_EDITOR as Vr, EDITOR_ACTIVATED as Hr, FOCUSING_PANEL_EDITOR as zr, LifecycleService as Kr, LifecycleStages as Zr, DisposableCollection as _t, fromEventSubject as Jr, generateRandomId as Ht, DependentOn as qr, IConfigService as Qr, Plugin as ei, merge as ti, registerDependencies as ni, touchDependencies as zt } from "@univerjs/core";
|
|
5
5
|
import { DocDrawingController as ri, UniverDocsDrawingPlugin as ii } from "@univerjs/docs-drawing";
|
|
6
6
|
import { SetDrawingSelectedOperation as xt, IImageIoService as Wn, IDrawingManagerService as oe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as wn, DRAWING_IMAGE_COUNT_LIMIT as _n, ImageUploadStatusType as Be, DRAWING_IMAGE_ALLOW_SIZE as vn, getImageSize as Sn, DRAWING_IMAGE_WIDTH_LIMIT as In, DRAWING_IMAGE_HEIGHT_LIMIT as Cn, ImageSourceType as si, getDrawingShapeKeyByDrawingSearch as Ce, UniverDrawingPlugin as oi } from "@univerjs/drawing";
|
|
@@ -19,10 +19,10 @@ const os = "sheets-drawing-ui.config", Pn = {}, x = {
|
|
|
19
19
|
id: "sheet.operation.clear-drawing-transformer",
|
|
20
20
|
type: te.MUTATION,
|
|
21
21
|
handler: (i, n) => {
|
|
22
|
-
const
|
|
23
|
-
return n.forEach((
|
|
22
|
+
const t = i.get(ne);
|
|
23
|
+
return n.forEach((e) => {
|
|
24
24
|
var r, s;
|
|
25
|
-
(s = (r =
|
|
25
|
+
(s = (r = t.getRenderById(e)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
|
|
26
26
|
}), !0;
|
|
27
27
|
}
|
|
28
28
|
}, nt = {
|
|
@@ -30,7 +30,7 @@ const os = "sheets-drawing-ui.config", Pn = {}, x = {
|
|
|
30
30
|
type: te.COMMAND,
|
|
31
31
|
handler: (i, n) => {
|
|
32
32
|
var S, C, D;
|
|
33
|
-
const
|
|
33
|
+
const t = i.get(G), e = i.get(Ye), r = i.get(Lt), s = i.get(ae);
|
|
34
34
|
if (!n) return !1;
|
|
35
35
|
const { drawings: o } = n, a = [];
|
|
36
36
|
o.forEach((v) => {
|
|
@@ -38,7 +38,7 @@ const os = "sheets-drawing-ui.config", Pn = {}, x = {
|
|
|
38
38
|
a.push(b);
|
|
39
39
|
});
|
|
40
40
|
const c = s.getBatchRemoveOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, f = r.onCommandExecute({ id: nt.id, params: n }), p = { id: A.id, params: { unitId: u, subUnitId: d, op: g, objects: h, type: P.REMOVE } }, m = { id: A.id, params: { unitId: u, subUnitId: d, op: l, objects: h, type: P.INSERT } };
|
|
41
|
-
return kn([...(S = f.preRedos) != null ? S : [], p, ...f.redos],
|
|
41
|
+
return kn([...(S = f.preRedos) != null ? S : [], p, ...f.redos], t) ? (e.pushUndoRedo({
|
|
42
42
|
unitID: u,
|
|
43
43
|
undoMutations: [
|
|
44
44
|
...(C = f.preUndos) != null ? C : [],
|
|
@@ -58,12 +58,12 @@ const os = "sheets-drawing-ui.config", Pn = {}, x = {
|
|
|
58
58
|
id: "sidebar.operation.sheet-image",
|
|
59
59
|
type: te.COMMAND,
|
|
60
60
|
handler: async (i, n) => {
|
|
61
|
-
const
|
|
61
|
+
const t = i.get(Mi), e = i.get($t), r = i.get(Ge), s = i.get(G);
|
|
62
62
|
if (!H(r)) return !1;
|
|
63
63
|
switch (n.value) {
|
|
64
64
|
case "open":
|
|
65
|
-
|
|
66
|
-
header: { title:
|
|
65
|
+
t.open({
|
|
66
|
+
header: { title: e.t("sheetImage.panel.title") },
|
|
67
67
|
children: { label: lr },
|
|
68
68
|
onClose: () => {
|
|
69
69
|
s.syncExecuteCommand(xt.id, []);
|
|
@@ -73,7 +73,7 @@ const os = "sheets-drawing-ui.config", Pn = {}, x = {
|
|
|
73
73
|
break;
|
|
74
74
|
case "close":
|
|
75
75
|
default:
|
|
76
|
-
|
|
76
|
+
t.close();
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
return !0;
|
|
@@ -82,8 +82,8 @@ const os = "sheets-drawing-ui.config", Pn = {}, x = {
|
|
|
82
82
|
id: "sheet.operation.edit-sheet-image",
|
|
83
83
|
type: te.OPERATION,
|
|
84
84
|
handler: (i, n) => {
|
|
85
|
-
const
|
|
86
|
-
return n == null ? !1 : (
|
|
85
|
+
const t = i.get(G);
|
|
86
|
+
return n == null ? !1 : (t.syncExecuteCommand(xt.id, [n]), t.executeCommand(ur.id, { value: "open" }), !0);
|
|
87
87
|
}
|
|
88
88
|
}, as = "univer-upload-loading", cs = "univer-upload-loading-body", ds = "univer-upload-loading-body-animation", ls = "univer-upload-loading-body-text", It = {
|
|
89
89
|
uploadLoading: as,
|
|
@@ -91,65 +91,65 @@ const os = "sheets-drawing-ui.config", Pn = {}, x = {
|
|
|
91
91
|
uploadLoadingBodyAnimation: ds,
|
|
92
92
|
uploadLoadingBodyText: ls
|
|
93
93
|
}, us = () => {
|
|
94
|
-
const i = Te(Wn), n = Te($t), [
|
|
94
|
+
const i = Te(Wn), n = Te($t), [t, e] = ts.useState(0);
|
|
95
95
|
return ln(() => {
|
|
96
96
|
const r = i.change$.subscribe((s) => {
|
|
97
|
-
|
|
97
|
+
e(s);
|
|
98
98
|
});
|
|
99
99
|
return () => {
|
|
100
100
|
r.unsubscribe();
|
|
101
101
|
};
|
|
102
|
-
}, [i]), /* @__PURE__ */ ee("div", { style: { display:
|
|
102
|
+
}, [i]), /* @__PURE__ */ ee("div", { style: { display: t > 0 ? "block" : "none" }, className: It.uploadLoading, children: /* @__PURE__ */ Tt("div", { className: It.uploadLoadingBody, children: [
|
|
103
103
|
/* @__PURE__ */ ee("div", { className: It.uploadLoadingBodyAnimation }),
|
|
104
|
-
/* @__PURE__ */ ee("div", { className: It.uploadLoadingBodyText, children: `${n.t("uploadLoading.loading")}: ${
|
|
104
|
+
/* @__PURE__ */ ee("div", { className: It.uploadLoadingBodyText, children: `${n.t("uploadLoading.loading")}: ${t}` })
|
|
105
105
|
] }) });
|
|
106
106
|
};
|
|
107
|
-
var hs = Object.getOwnPropertyDescriptor, gs = (i, n,
|
|
108
|
-
for (var r =
|
|
107
|
+
var hs = Object.getOwnPropertyDescriptor, gs = (i, n, t, e) => {
|
|
108
|
+
for (var r = e > 1 ? void 0 : e ? hs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
109
109
|
(o = i[s]) && (r = o(r) || r);
|
|
110
110
|
return r;
|
|
111
|
-
}, we = (i, n) => (
|
|
111
|
+
}, we = (i, n) => (t, e) => n(t, e, i);
|
|
112
112
|
let Et = class extends Ur {
|
|
113
|
-
constructor(n,
|
|
113
|
+
constructor(n, t, e, r, s, o, a, c) {
|
|
114
114
|
super();
|
|
115
115
|
Q(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
116
|
-
this._injector = n, this._drawingManagerService =
|
|
116
|
+
this._injector = n, this._drawingManagerService = t, this._canvasPopManagerService = e, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._commandService = c, this._init();
|
|
117
117
|
}
|
|
118
118
|
_init() {
|
|
119
119
|
this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(Mn(this.dispose$)).subscribe((n) => this._create(n)), this._univerInstanceService.getTypeOfUnitDisposed$(F.UNIVER_SHEET).pipe(Mn(this.dispose$)).subscribe((n) => this._dispose(n)), this._univerInstanceService.getAllUnitsForType(F.UNIVER_SHEET).forEach((n) => this._create(n)), this._uiPartsService.registerComponent(Ti.CONTENT, () => Ei(us, this._injector));
|
|
120
120
|
}
|
|
121
121
|
_dispose(n) {
|
|
122
|
-
const
|
|
123
|
-
this._renderManagerService.removeRender(
|
|
122
|
+
const t = n.getUnitId();
|
|
123
|
+
this._renderManagerService.removeRender(t);
|
|
124
124
|
}
|
|
125
125
|
_create(n) {
|
|
126
126
|
if (!n)
|
|
127
127
|
return;
|
|
128
|
-
const
|
|
129
|
-
this._renderManagerService.has(
|
|
128
|
+
const t = n.getUnitId();
|
|
129
|
+
this._renderManagerService.has(t) && !this._initImagePopupMenu.has(t) && (this._popupMenuListener(t), this._initImagePopupMenu.add(t));
|
|
130
130
|
}
|
|
131
131
|
_hasCropObject(n) {
|
|
132
|
-
const
|
|
133
|
-
for (const
|
|
134
|
-
if (
|
|
132
|
+
const t = n.getAllObjectsByOrder();
|
|
133
|
+
for (const e of t)
|
|
134
|
+
if (e instanceof ai)
|
|
135
135
|
return !0;
|
|
136
136
|
return !1;
|
|
137
137
|
}
|
|
138
138
|
_popupMenuListener(n) {
|
|
139
139
|
var s;
|
|
140
|
-
const
|
|
141
|
-
if (!e)
|
|
142
|
-
return;
|
|
143
|
-
const t = e.getTransformerByCreate();
|
|
140
|
+
const t = (s = this._renderManagerService.getRenderById(n)) == null ? void 0 : s.scene;
|
|
144
141
|
if (!t)
|
|
145
142
|
return;
|
|
143
|
+
const e = t.getTransformerByCreate();
|
|
144
|
+
if (!e)
|
|
145
|
+
return;
|
|
146
146
|
let r;
|
|
147
147
|
this.disposeWithMe(
|
|
148
148
|
Pr(
|
|
149
|
-
|
|
150
|
-
if (this._contextService.setContextValue(Le, !0), this._hasCropObject(
|
|
149
|
+
e.createControl$.subscribe(() => {
|
|
150
|
+
if (this._contextService.setContextValue(Le, !0), this._hasCropObject(t))
|
|
151
151
|
return;
|
|
152
|
-
const o =
|
|
152
|
+
const o = e.getSelectedObjectMap();
|
|
153
153
|
if (o.size > 1) {
|
|
154
154
|
r == null || r.dispose();
|
|
155
155
|
return;
|
|
@@ -176,7 +176,7 @@ let Et = class extends Ur {
|
|
|
176
176
|
})
|
|
177
177
|
)
|
|
178
178
|
), this.disposeWithMe(
|
|
179
|
-
|
|
179
|
+
e.clearControl$.subscribe(() => {
|
|
180
180
|
r == null || r.dispose(), this._contextService.setContextValue(Le, !1), this._commandService.syncExecuteCommand(xt.id, []);
|
|
181
181
|
})
|
|
182
182
|
), this.disposeWithMe(
|
|
@@ -184,39 +184,39 @@ let Et = class extends Ur {
|
|
|
184
184
|
o[Le] === !1 && (r == null || r.dispose());
|
|
185
185
|
})
|
|
186
186
|
), this.disposeWithMe(
|
|
187
|
-
|
|
187
|
+
e.changing$.subscribe(() => {
|
|
188
188
|
r == null || r.dispose();
|
|
189
189
|
})
|
|
190
190
|
);
|
|
191
191
|
}
|
|
192
|
-
_getImageMenuItems(n,
|
|
192
|
+
_getImageMenuItems(n, t, e, r) {
|
|
193
193
|
return [
|
|
194
194
|
{
|
|
195
195
|
label: "image-popup.edit",
|
|
196
196
|
index: 0,
|
|
197
197
|
commandId: hr.id,
|
|
198
|
-
commandParams: { unitId: n, subUnitId:
|
|
198
|
+
commandParams: { unitId: n, subUnitId: t, drawingId: e },
|
|
199
199
|
disable: r === L.DRAWING_DOM
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
202
|
label: "image-popup.delete",
|
|
203
203
|
index: 1,
|
|
204
204
|
commandId: nt.id,
|
|
205
|
-
commandParams: { unitId: n, drawings: [{ unitId: n, subUnitId:
|
|
205
|
+
commandParams: { unitId: n, drawings: [{ unitId: n, subUnitId: t, drawingId: e }] },
|
|
206
206
|
disable: !1
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
209
|
label: "image-popup.crop",
|
|
210
210
|
index: 2,
|
|
211
211
|
commandId: di.id,
|
|
212
|
-
commandParams: { unitId: n, subUnitId:
|
|
212
|
+
commandParams: { unitId: n, subUnitId: t, drawingId: e },
|
|
213
213
|
disable: r === L.DRAWING_DOM
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
216
|
label: "image-popup.reset",
|
|
217
217
|
index: 3,
|
|
218
218
|
commandId: li.id,
|
|
219
|
-
commandParams: [{ unitId: n, subUnitId:
|
|
219
|
+
commandParams: [{ unitId: n, subUnitId: t, drawingId: e }],
|
|
220
220
|
disable: r === L.DRAWING_DOM
|
|
221
221
|
}
|
|
222
222
|
];
|
|
@@ -232,18 +232,18 @@ Et = gs([
|
|
|
232
232
|
we(6, N(yi)),
|
|
233
233
|
we(7, G)
|
|
234
234
|
], Et);
|
|
235
|
-
function z(i, n,
|
|
236
|
-
const { from:
|
|
235
|
+
function z(i, n, t) {
|
|
236
|
+
const { from: e, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: c = 0, skewY: u = 0 } = i, d = t.getCurrent();
|
|
237
237
|
if (d == null)
|
|
238
238
|
return;
|
|
239
239
|
const l = wi(
|
|
240
240
|
d.unitId,
|
|
241
241
|
d.sheetId,
|
|
242
|
-
{ from:
|
|
243
|
-
|
|
242
|
+
{ from: e, to: r },
|
|
243
|
+
t
|
|
244
244
|
);
|
|
245
245
|
let { left: g, top: h, width: f, height: p } = l;
|
|
246
|
-
const m =
|
|
246
|
+
const m = t.getCurrentSkeleton(), w = m.rowHeaderWidth + m.columnTotalWidth, S = m.columnHeaderHeight + m.rowTotalHeight;
|
|
247
247
|
return g + f > w && (g = w - f), h + p > S && (h = S - p), {
|
|
248
248
|
flipY: s,
|
|
249
249
|
flipX: o,
|
|
@@ -257,22 +257,22 @@ function z(i, n, e) {
|
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
259
|
function $(i, n) {
|
|
260
|
-
const { left:
|
|
260
|
+
const { left: t = 0, top: e = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: c = 0, skewX: u = 0, skewY: d = 0 } = i, l = n.getCellWithCoordByOffset(t, e);
|
|
261
261
|
if (l == null)
|
|
262
262
|
return;
|
|
263
263
|
const g = {
|
|
264
264
|
column: l.actualColumn,
|
|
265
|
-
columnOffset: vt(
|
|
265
|
+
columnOffset: vt(t - l.startX, 1),
|
|
266
266
|
row: l.actualRow,
|
|
267
|
-
rowOffset: vt(
|
|
268
|
-
}, h = n.getCellWithCoordByOffset(
|
|
267
|
+
rowOffset: vt(e - l.startY, 1)
|
|
268
|
+
}, h = n.getCellWithCoordByOffset(t + r, e + s);
|
|
269
269
|
if (h == null)
|
|
270
270
|
return;
|
|
271
271
|
const f = {
|
|
272
272
|
column: h.actualColumn,
|
|
273
|
-
columnOffset: vt(
|
|
273
|
+
columnOffset: vt(t + r - h.startX, 1),
|
|
274
274
|
row: h.actualRow,
|
|
275
|
-
rowOffset: vt(
|
|
275
|
+
rowOffset: vt(e + s - h.startY, 1)
|
|
276
276
|
};
|
|
277
277
|
return {
|
|
278
278
|
flipY: o,
|
|
@@ -284,14 +284,14 @@ function $(i, n) {
|
|
|
284
284
|
to: f
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
|
-
var fs = Object.getOwnPropertyDescriptor, ms = (i, n,
|
|
288
|
-
for (var r =
|
|
287
|
+
var fs = Object.getOwnPropertyDescriptor, ms = (i, n, t, e) => {
|
|
288
|
+
for (var r = e > 1 ? void 0 : e ? fs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
289
289
|
(o = i[s]) && (r = o(r) || r);
|
|
290
290
|
return r;
|
|
291
|
-
}, Ct = (i, n) => (
|
|
291
|
+
}, Ct = (i, n) => (t, e) => n(t, e, i);
|
|
292
292
|
let sn = class extends le {
|
|
293
|
-
constructor(i, n,
|
|
294
|
-
super(), this._context = i, this._sheetDrawingService = n, this._drawingManagerService =
|
|
293
|
+
constructor(i, n, t, e, r) {
|
|
294
|
+
super(), this._context = i, this._sheetDrawingService = n, this._drawingManagerService = t, this._sheetSelectionRenderService = e, this._sheetSkeletonManagerService = r, this._init();
|
|
295
295
|
}
|
|
296
296
|
_init() {
|
|
297
297
|
this._drawingInitializeListener();
|
|
@@ -300,9 +300,9 @@ let sn = class extends le {
|
|
|
300
300
|
this._sheetDrawingService.initializeNotification(this._context.unitId);
|
|
301
301
|
const i = this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);
|
|
302
302
|
for (const n in i) {
|
|
303
|
-
const
|
|
304
|
-
for (const
|
|
305
|
-
const r =
|
|
303
|
+
const t = i[n];
|
|
304
|
+
for (const e in t.data) {
|
|
305
|
+
const r = t.data[e];
|
|
306
306
|
r.transform = z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
|
|
307
307
|
}
|
|
308
308
|
}
|
|
@@ -317,8 +317,8 @@ sn = ms([
|
|
|
317
317
|
], sn);
|
|
318
318
|
function ps(i) {
|
|
319
319
|
const n = [];
|
|
320
|
-
return i.forEach((
|
|
321
|
-
const { parent:
|
|
320
|
+
return i.forEach((t) => {
|
|
321
|
+
const { parent: e, children: r } = t, { unitId: s, subUnitId: o, drawingId: a } = e, c = fi(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
|
|
322
322
|
const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: p } = l;
|
|
323
323
|
return {
|
|
324
324
|
unitId: h,
|
|
@@ -346,8 +346,8 @@ function ps(i) {
|
|
|
346
346
|
}
|
|
347
347
|
function ws(i) {
|
|
348
348
|
const n = [];
|
|
349
|
-
return i.forEach((
|
|
350
|
-
const { parent:
|
|
349
|
+
return i.forEach((t) => {
|
|
350
|
+
const { parent: e, children: r } = t, { unitId: s, subUnitId: o, drawingId: a, transform: c = { width: 0, height: 0 } } = e;
|
|
351
351
|
if (c == null)
|
|
352
352
|
return;
|
|
353
353
|
const u = r.map((l) => {
|
|
@@ -379,7 +379,7 @@ const gr = {
|
|
|
379
379
|
id: "sheet.command.group-sheet-image",
|
|
380
380
|
type: te.COMMAND,
|
|
381
381
|
handler: (i, n) => {
|
|
382
|
-
const
|
|
382
|
+
const t = i.get(G), e = i.get(Ye), r = i.get(ae);
|
|
383
383
|
if (!n) return !1;
|
|
384
384
|
const s = [];
|
|
385
385
|
n.forEach(({ parent: h, children: f }) => {
|
|
@@ -388,7 +388,7 @@ const gr = {
|
|
|
388
388
|
});
|
|
389
389
|
});
|
|
390
390
|
const o = r.getGroupDrawingOp(n), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
|
|
391
|
-
return
|
|
391
|
+
return t.syncExecuteCommand(A.id, { op: d, unitId: a, subUnitId: c, objects: l, type: P.GROUP }) ? (e.pushUndoRedo({
|
|
392
392
|
unitID: a,
|
|
393
393
|
undoMutations: [
|
|
394
394
|
{ id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: ws(l), type: P.UNGROUP } },
|
|
@@ -405,10 +405,10 @@ const gr = {
|
|
|
405
405
|
type: te.COMMAND,
|
|
406
406
|
handler: (i, n) => {
|
|
407
407
|
var S, C, D;
|
|
408
|
-
const
|
|
408
|
+
const t = i.get(G), e = i.get(Ye), r = i.get(ae), s = i.get(Lt);
|
|
409
409
|
if (!n) return !1;
|
|
410
410
|
const o = n.drawings, a = o.map((v) => v.unitId), c = r.getBatchAddOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, f = s.onCommandExecute({ id: Ft.id, params: n }), p = { id: A.id, params: { op: g, unitId: u, subUnitId: d, objects: h, type: P.INSERT } }, m = { id: A.id, params: { op: l, unitId: u, subUnitId: d, objects: h, type: P.REMOVE } };
|
|
411
|
-
return kn([...(S = f.preRedos) != null ? S : [], p, ...f.redos],
|
|
411
|
+
return kn([...(S = f.preRedos) != null ? S : [], p, ...f.redos], t) ? (e.pushUndoRedo({
|
|
412
412
|
unitID: u,
|
|
413
413
|
undoMutations: [
|
|
414
414
|
...(C = f.preUndos) != null ? C : [],
|
|
@@ -428,14 +428,14 @@ const gr = {
|
|
|
428
428
|
id: "sheet.command.set-drawing-arrange",
|
|
429
429
|
type: te.COMMAND,
|
|
430
430
|
handler: (i, n) => {
|
|
431
|
-
const
|
|
431
|
+
const t = i.get(G), e = i.get(Ye);
|
|
432
432
|
if (!n) return !1;
|
|
433
433
|
const r = i.get(ae), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: c } = n, u = { unitId: s, subUnitId: o, drawingIds: a };
|
|
434
434
|
let d;
|
|
435
435
|
if (c === mt.forward ? d = r.getForwardDrawingsOp(u) : c === mt.backward ? d = r.getBackwardDrawingOp(u) : c === mt.front ? d = r.getFrontDrawingsOp(u) : c === mt.back && (d = r.getBackDrawingsOp(u)), d == null)
|
|
436
436
|
return !1;
|
|
437
437
|
const { objects: l, redo: g, undo: h } = d;
|
|
438
|
-
return
|
|
438
|
+
return t.syncExecuteCommand(A.id, { op: g, unitId: s, subUnitId: o, objects: l, type: P.ARRANGE }) ? (e.pushUndoRedo({
|
|
439
439
|
unitID: s,
|
|
440
440
|
undoMutations: [
|
|
441
441
|
{ id: A.id, params: { op: h, unitId: s, subUnitId: o, objects: l, type: P.ARRANGE } }
|
|
@@ -449,10 +449,10 @@ const gr = {
|
|
|
449
449
|
id: "sheet.command.set-sheet-image",
|
|
450
450
|
type: te.COMMAND,
|
|
451
451
|
handler: (i, n) => {
|
|
452
|
-
const
|
|
452
|
+
const t = i.get(G), e = i.get(Ye), r = i.get(ae);
|
|
453
453
|
if (!n) return !1;
|
|
454
454
|
const { drawings: s } = n, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
|
|
455
|
-
return
|
|
455
|
+
return t.syncExecuteCommand(A.id, { unitId: a, subUnitId: c, op: d, objects: l, type: P.UPDATE }) ? (e.pushUndoRedo({
|
|
456
456
|
unitID: a,
|
|
457
457
|
undoMutations: [
|
|
458
458
|
{ id: A.id, params: { unitId: a, subUnitId: c, op: u, objects: l, type: P.UPDATE } },
|
|
@@ -468,7 +468,7 @@ const gr = {
|
|
|
468
468
|
id: "sheet.command.ungroup-sheet-image",
|
|
469
469
|
type: te.COMMAND,
|
|
470
470
|
handler: (i, n) => {
|
|
471
|
-
const
|
|
471
|
+
const t = i.get(G), e = i.get(Ye), r = i.get(ae);
|
|
472
472
|
if (!n) return !1;
|
|
473
473
|
const s = [];
|
|
474
474
|
n.forEach(({ parent: h, children: f }) => {
|
|
@@ -477,7 +477,7 @@ const gr = {
|
|
|
477
477
|
});
|
|
478
478
|
});
|
|
479
479
|
const o = r.getUngroupDrawingOp(n), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
|
|
480
|
-
return
|
|
480
|
+
return t.syncExecuteCommand(A.id, { op: d, unitId: a, subUnitId: c, objects: l, type: P.UNGROUP }) ? (e.pushUndoRedo({
|
|
481
481
|
unitID: a,
|
|
482
482
|
undoMutations: [
|
|
483
483
|
{ id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: ps(l), type: P.GROUP } },
|
|
@@ -490,18 +490,18 @@ const gr = {
|
|
|
490
490
|
}), !0) : !1;
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
|
-
var _s = Object.getOwnPropertyDescriptor, vs = (i, n,
|
|
494
|
-
for (var r =
|
|
493
|
+
var _s = Object.getOwnPropertyDescriptor, vs = (i, n, t, e) => {
|
|
494
|
+
for (var r = e > 1 ? void 0 : e ? _s(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
495
495
|
(o = i[s]) && (r = o(r) || r);
|
|
496
496
|
return r;
|
|
497
|
-
}, ie = (i, n) => (
|
|
498
|
-
function Ss(i, n,
|
|
499
|
-
const
|
|
497
|
+
}, ie = (i, n) => (t, e) => n(t, e, i);
|
|
498
|
+
function Ss(i, n, t) {
|
|
499
|
+
const e = t * Math.PI / 180, r = Math.abs(i * Math.cos(e)) + Math.abs(n * Math.sin(e)), s = Math.abs(i * Math.sin(e)) + Math.abs(n * Math.cos(e));
|
|
500
500
|
return { rotatedWidth: r, rotatedHeight: s };
|
|
501
501
|
}
|
|
502
|
-
function pr(i, n,
|
|
502
|
+
function pr(i, n, t, e, r) {
|
|
503
503
|
var S;
|
|
504
|
-
const { rotatedHeight: s, rotatedWidth: o } = Ss(
|
|
504
|
+
const { rotatedHeight: s, rotatedWidth: o } = Ss(t, e, r), c = i.get(ne).getRenderById(n.unitId);
|
|
505
505
|
if (!c)
|
|
506
506
|
return !1;
|
|
507
507
|
const d = (S = c.with(V).getSkeletonParam(n.subUnitId)) == null ? void 0 : S.skeleton;
|
|
@@ -509,37 +509,37 @@ function pr(i, n, e, t, r) {
|
|
|
509
509
|
return !1;
|
|
510
510
|
const l = d.getCellByIndex(n.row, n.col), g = l.mergeInfo.endX - l.mergeInfo.startX - 2, h = l.mergeInfo.endY - l.mergeInfo.startY - 2, f = o / s, m = Math.ceil(Math.min(g, h * f)) / o, w = !m || Number.isNaN(m) ? 1e-3 : m;
|
|
511
511
|
return {
|
|
512
|
-
width:
|
|
513
|
-
height:
|
|
512
|
+
width: t * w,
|
|
513
|
+
height: e * w
|
|
514
514
|
};
|
|
515
515
|
}
|
|
516
516
|
let et = class extends le {
|
|
517
|
-
constructor(n,
|
|
517
|
+
constructor(n, t, e, r, s, o, a, c, u, d, l, g, h) {
|
|
518
518
|
super();
|
|
519
519
|
Q(this, "_workbookSelections");
|
|
520
|
-
this._context = n, this._skeletonManagerService =
|
|
520
|
+
this._context = n, this._skeletonManagerService = t, this._commandService = e, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = a, this._drawingManagerService = c, this._contextService = u, this._messageService = d, this._localeService = l, this._injector = h, this._workbookSelections = g.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
|
|
521
521
|
}
|
|
522
522
|
async insertFloatImage() {
|
|
523
523
|
const n = await this._fileOpenerService.openFile({
|
|
524
524
|
multiple: !0,
|
|
525
|
-
accept: wn.map((
|
|
526
|
-
}),
|
|
527
|
-
return
|
|
525
|
+
accept: wn.map((e) => `.${e.replace("image/", "")}`).join(",")
|
|
526
|
+
}), t = n.length;
|
|
527
|
+
return t > _n ? (this._messageService.show({
|
|
528
528
|
type: Re.Error,
|
|
529
529
|
content: this._localeService.t("update-status.exceedMaxCount", String(_n))
|
|
530
|
-
}), !1) :
|
|
530
|
+
}), !1) : t === 0 ? !1 : (n.forEach(async (e) => await this.insertFloatImageByFile(e)), !0);
|
|
531
531
|
}
|
|
532
532
|
async insertCellImage() {
|
|
533
|
-
const
|
|
533
|
+
const t = (await this._fileOpenerService.openFile({
|
|
534
534
|
multiple: !1,
|
|
535
|
-
accept: wn.map((
|
|
535
|
+
accept: wn.map((e) => `.${e.replace("image/", "")}`).join(",")
|
|
536
536
|
}))[0];
|
|
537
|
-
return
|
|
537
|
+
return t ? (await this._insertCellImage(t), !0) : !1;
|
|
538
538
|
}
|
|
539
539
|
async insertFloatImageByFile(n) {
|
|
540
|
-
let
|
|
540
|
+
let t;
|
|
541
541
|
try {
|
|
542
|
-
|
|
542
|
+
t = await this._imageIoService.saveImage(n);
|
|
543
543
|
} catch (S) {
|
|
544
544
|
const C = S.message;
|
|
545
545
|
C === Be.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
@@ -553,9 +553,9 @@ let et = class extends le {
|
|
|
553
553
|
content: this._localeService.t("update-status.invalidImage")
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
|
-
if (
|
|
556
|
+
if (t == null)
|
|
557
557
|
return;
|
|
558
|
-
const
|
|
558
|
+
const e = this._getUnitInfo(), { unitId: r, subUnitId: s } = e, { imageId: o, imageSourceType: a, source: c, base64Cache: u } = t, { width: d, height: l, image: g } = await Sn(u || ""), { width: h, height: f } = this._context.scene;
|
|
559
559
|
this._imageIoService.addImageSourceCache(c, a, g);
|
|
560
560
|
let p = 1;
|
|
561
561
|
if (d > In || l > Cn) {
|
|
@@ -582,9 +582,9 @@ let et = class extends le {
|
|
|
582
582
|
}
|
|
583
583
|
// eslint-disable-next-line max-lines-per-function
|
|
584
584
|
async _insertCellImage(n) {
|
|
585
|
-
let
|
|
585
|
+
let t;
|
|
586
586
|
try {
|
|
587
|
-
|
|
587
|
+
t = await this._imageIoService.saveImage(n);
|
|
588
588
|
} catch (m) {
|
|
589
589
|
const w = m.message;
|
|
590
590
|
w === Be.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
@@ -598,9 +598,9 @@ let et = class extends le {
|
|
|
598
598
|
content: this._localeService.t("update-status.invalidImage")
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
|
-
if (
|
|
601
|
+
if (t == null)
|
|
602
602
|
return;
|
|
603
|
-
const { imageId:
|
|
603
|
+
const { imageId: e, imageSourceType: r, source: s, base64Cache: o } = t, { width: a, height: c, image: u } = await Sn(o || "");
|
|
604
604
|
this._imageIoService.addImageSourceCache(s, r, u);
|
|
605
605
|
const d = this._workbookSelections.getCurrentLastSelection();
|
|
606
606
|
if (!d)
|
|
@@ -636,7 +636,7 @@ let et = class extends le {
|
|
|
636
636
|
}, f = {
|
|
637
637
|
unitId: l.getUnitId(),
|
|
638
638
|
subUnitId: l.getUnitId(),
|
|
639
|
-
drawingId:
|
|
639
|
+
drawingId: e,
|
|
640
640
|
drawingType: L.DRAWING_IMAGE,
|
|
641
641
|
imageSourceType: r,
|
|
642
642
|
source: s,
|
|
@@ -673,13 +673,13 @@ let et = class extends le {
|
|
|
673
673
|
})) : !1;
|
|
674
674
|
}
|
|
675
675
|
_getUnitInfo() {
|
|
676
|
-
const n = this._context.unit,
|
|
676
|
+
const n = this._context.unit, t = n.getActiveSheet(), e = n.getUnitId(), r = t.getSheetId();
|
|
677
677
|
return {
|
|
678
|
-
unitId:
|
|
678
|
+
unitId: e,
|
|
679
679
|
subUnitId: r
|
|
680
680
|
};
|
|
681
681
|
}
|
|
682
|
-
_getImagePosition(n,
|
|
682
|
+
_getImagePosition(n, t, e, r) {
|
|
683
683
|
const s = this._workbookSelections.getCurrentSelections();
|
|
684
684
|
let o = {
|
|
685
685
|
startRow: 0,
|
|
@@ -692,7 +692,7 @@ let et = class extends le {
|
|
|
692
692
|
if (a == null)
|
|
693
693
|
return;
|
|
694
694
|
let { startColumn: c, startRow: u, startX: d, startY: l } = a, g = !1;
|
|
695
|
-
if (d + n >
|
|
695
|
+
if (d + n > e && (d = e - n, d < 0 && (d = 0, n = e), g = !0), l + t > r && (l = r - t, l < 0 && (l = 0, t = r), g = !0), g) {
|
|
696
696
|
const m = this._selectionRenderService.getCellWithCoordByOffset(d, l);
|
|
697
697
|
if (m == null)
|
|
698
698
|
return;
|
|
@@ -703,14 +703,14 @@ let et = class extends le {
|
|
|
703
703
|
columnOffset: 0,
|
|
704
704
|
row: u,
|
|
705
705
|
rowOffset: 0
|
|
706
|
-
}, f = this._selectionRenderService.getCellWithCoordByOffset(d + n, l +
|
|
706
|
+
}, f = this._selectionRenderService.getCellWithCoordByOffset(d + n, l + t);
|
|
707
707
|
if (f == null)
|
|
708
708
|
return;
|
|
709
709
|
const p = {
|
|
710
710
|
column: f.actualColumn,
|
|
711
711
|
columnOffset: d + n - f.startX,
|
|
712
712
|
row: f.actualRow,
|
|
713
|
-
rowOffset: l +
|
|
713
|
+
rowOffset: l + t - f.startY
|
|
714
714
|
};
|
|
715
715
|
return {
|
|
716
716
|
from: h,
|
|
@@ -719,10 +719,10 @@ let et = class extends le {
|
|
|
719
719
|
}
|
|
720
720
|
_updateOrderListener() {
|
|
721
721
|
this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((n) => {
|
|
722
|
-
const { unitId:
|
|
722
|
+
const { unitId: t, subUnitId: e, drawingIds: r, arrangeType: s } = n;
|
|
723
723
|
this._commandService.executeCommand(fr.id, {
|
|
724
|
-
unitId:
|
|
725
|
-
subUnitId:
|
|
724
|
+
unitId: t,
|
|
725
|
+
subUnitId: e,
|
|
726
726
|
drawingIds: r,
|
|
727
727
|
arrangeType: s
|
|
728
728
|
});
|
|
@@ -730,9 +730,9 @@ let et = class extends le {
|
|
|
730
730
|
}
|
|
731
731
|
_updateImageListener() {
|
|
732
732
|
this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe((n) => {
|
|
733
|
-
const
|
|
734
|
-
n.length !== 0 && (n.forEach((
|
|
735
|
-
const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform: c } =
|
|
733
|
+
const t = [];
|
|
734
|
+
n.length !== 0 && (n.forEach((e) => {
|
|
735
|
+
const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform: c } = e;
|
|
736
736
|
if (c == null)
|
|
737
737
|
return;
|
|
738
738
|
const u = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
|
|
@@ -742,22 +742,22 @@ let et = class extends le {
|
|
|
742
742
|
if (d == null)
|
|
743
743
|
return;
|
|
744
744
|
const l = {
|
|
745
|
-
...
|
|
745
|
+
...e,
|
|
746
746
|
transform: { ...u.transform, ...c, ...z(d, this._selectionRenderService, this._skeletonManagerService) },
|
|
747
747
|
sheetTransform: { ...d }
|
|
748
748
|
};
|
|
749
|
-
|
|
750
|
-
}),
|
|
749
|
+
t.push(l);
|
|
750
|
+
}), t.length > 0 && this._commandService.executeCommand(Yt.id, {
|
|
751
751
|
unitId: n[0].unitId,
|
|
752
|
-
drawings:
|
|
752
|
+
drawings: t
|
|
753
753
|
}));
|
|
754
754
|
}));
|
|
755
755
|
}
|
|
756
756
|
_groupDrawingListener() {
|
|
757
757
|
this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((n) => {
|
|
758
758
|
this._commandService.executeCommand(gr.id, n);
|
|
759
|
-
const { unitId:
|
|
760
|
-
this._commandService.syncExecuteCommand(xt.id, [{ unitId:
|
|
759
|
+
const { unitId: t, subUnitId: e, drawingId: r } = n[0].parent;
|
|
760
|
+
this._commandService.syncExecuteCommand(xt.id, [{ unitId: t, subUnitId: e, drawingId: r }]);
|
|
761
761
|
})), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((n) => {
|
|
762
762
|
this._commandService.executeCommand(mr.id, n);
|
|
763
763
|
}));
|
|
@@ -784,15 +784,15 @@ et = vs([
|
|
|
784
784
|
ie(11, N(dn)),
|
|
785
785
|
ie(12, N(tt))
|
|
786
786
|
], et);
|
|
787
|
-
var Is = Object.getOwnPropertyDescriptor, Cs = (i, n,
|
|
788
|
-
for (var r =
|
|
787
|
+
var Is = Object.getOwnPropertyDescriptor, Cs = (i, n, t, e) => {
|
|
788
|
+
for (var r = e > 1 ? void 0 : e ? Is(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
789
789
|
(o = i[s]) && (r = o(r) || r);
|
|
790
790
|
return r;
|
|
791
|
-
}, De = (i, n) => (
|
|
792
|
-
function on(i, n,
|
|
793
|
-
var
|
|
794
|
-
if (((r = (
|
|
795
|
-
const a =
|
|
791
|
+
}, De = (i, n) => (t, e) => n(t, e, i);
|
|
792
|
+
function on(i, n, t) {
|
|
793
|
+
var e, r, s, o;
|
|
794
|
+
if (((r = (e = t == null ? void 0 : t.p) == null ? void 0 : e.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = t.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
|
|
795
|
+
const a = t.p.drawings[t.p.drawingsOrder[0]], c = pr(
|
|
796
796
|
i,
|
|
797
797
|
{
|
|
798
798
|
unitId: n.unitId,
|
|
@@ -805,43 +805,43 @@ function on(i, n, e) {
|
|
|
805
805
|
a.docTransform.angle
|
|
806
806
|
);
|
|
807
807
|
if (c)
|
|
808
|
-
return a.transform.width = c.width, a.transform.height = c.height, a.docTransform.size.width = c.width, a.docTransform.size.height = c.height, a.transform.left = 0, a.transform.top = 0, a.docTransform.positionH.posOffset = 0, a.docTransform.positionV.posOffset = 0,
|
|
808
|
+
return a.transform.width = c.width, a.transform.height = c.height, a.docTransform.size.width = c.width, a.docTransform.size.height = c.height, a.transform.left = 0, a.transform.top = 0, a.docTransform.positionH.posOffset = 0, a.docTransform.positionV.posOffset = 0, t.p.documentStyle.pageSize.width = 1 / 0, t.p.documentStyle.pageSize.height = 1 / 0, !0;
|
|
809
809
|
}
|
|
810
810
|
return !1;
|
|
811
811
|
}
|
|
812
812
|
let Ot = class extends le {
|
|
813
|
-
constructor(i, n,
|
|
814
|
-
super(), this._commandService = i, this._sheetInterceptorService = n, this._univerInstanceService =
|
|
813
|
+
constructor(i, n, t, e, r, s, o) {
|
|
814
|
+
super(), this._commandService = i, this._sheetInterceptorService = n, this._univerInstanceService = t, this._injector = e, this._drawingManagerService = r, this._docDrawingController = s, this._editorBridgeService = o, this._initHandleResize(), this._handleInitEditor(), this._handleWriteCell(), this._initCellContentInterceptor();
|
|
815
815
|
}
|
|
816
816
|
_initHandleResize() {
|
|
817
817
|
this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
|
|
818
|
-
let n,
|
|
818
|
+
let n, t = [];
|
|
819
819
|
if (i.id === Fn.id) {
|
|
820
|
-
const
|
|
821
|
-
|
|
820
|
+
const e = i.params;
|
|
821
|
+
t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
|
|
822
822
|
} else if (i.id === Yn.id) {
|
|
823
|
-
const
|
|
824
|
-
|
|
823
|
+
const e = i.params;
|
|
824
|
+
t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
|
|
825
825
|
} else if (i.id === Li.id) {
|
|
826
|
-
const
|
|
827
|
-
|
|
826
|
+
const e = i.params;
|
|
827
|
+
t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
|
|
828
828
|
} else if (i.id === Gn.id) {
|
|
829
|
-
const
|
|
830
|
-
n = H(this._univerInstanceService, { unitId:
|
|
829
|
+
const e = i.params;
|
|
830
|
+
n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId }), t = e.rowsAutoHeightInfo.map((r) => ({
|
|
831
831
|
startRow: r.row,
|
|
832
832
|
endRow: r.row,
|
|
833
833
|
startColumn: 0,
|
|
834
834
|
endColumn: 9999
|
|
835
835
|
}));
|
|
836
836
|
} else if (i.id === Fi.id) {
|
|
837
|
-
const
|
|
838
|
-
|
|
837
|
+
const e = i.params;
|
|
838
|
+
t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
|
|
839
839
|
} else if (i.id === Yi.id) {
|
|
840
|
-
const
|
|
841
|
-
|
|
840
|
+
const e = i.params;
|
|
841
|
+
t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
|
|
842
842
|
}
|
|
843
|
-
n &&
|
|
844
|
-
const r = xr.transformRange(
|
|
843
|
+
n && t.length && t.forEach((e) => {
|
|
844
|
+
const r = xr.transformRange(e, n.worksheet);
|
|
845
845
|
for (let s = r.startRow; s <= r.endRow; s++)
|
|
846
846
|
for (let o = r.startColumn; o <= r.endColumn; o++)
|
|
847
847
|
on(this._injector, { unitId: n.unitId, subUnitId: n.subUnitId, row: s, col: o }, n.worksheet.getCellRaw(s, o));
|
|
@@ -858,7 +858,7 @@ let Ot = class extends le {
|
|
|
858
858
|
_handleWriteCell() {
|
|
859
859
|
this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(Gi, {
|
|
860
860
|
priority: 9999,
|
|
861
|
-
handler: (i, n,
|
|
861
|
+
handler: (i, n, t) => (on(this._injector, { unitId: n.unitId, subUnitId: n.subUnitId, row: n.row, col: n.col }, i), t(i))
|
|
862
862
|
}));
|
|
863
863
|
}
|
|
864
864
|
_initCellContentInterceptor() {
|
|
@@ -868,9 +868,9 @@ let Ot = class extends le {
|
|
|
868
868
|
{
|
|
869
869
|
effect: Lr.Style,
|
|
870
870
|
priority: Vi.CELL_IMAGE,
|
|
871
|
-
handler: (i, n,
|
|
872
|
-
var
|
|
873
|
-
return i != null && i.p && ((
|
|
871
|
+
handler: (i, n, t) => {
|
|
872
|
+
var e;
|
|
873
|
+
return i != null && i.p && ((e = i.p.drawingsOrder) != null && e.length) && (i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }), t(i);
|
|
874
874
|
}
|
|
875
875
|
}
|
|
876
876
|
)
|
|
@@ -886,11 +886,11 @@ Ot = Cs([
|
|
|
886
886
|
De(5, N(ri)),
|
|
887
887
|
De(6, N(_i))
|
|
888
888
|
], Ot);
|
|
889
|
-
var bs = Object.getOwnPropertyDescriptor, Rs = (i, n,
|
|
890
|
-
for (var r =
|
|
889
|
+
var bs = Object.getOwnPropertyDescriptor, Rs = (i, n, t, e) => {
|
|
890
|
+
for (var r = e > 1 ? void 0 : e ? bs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
891
891
|
(o = i[s]) && (r = o(r) || r);
|
|
892
892
|
return r;
|
|
893
|
-
}, An = (i, n) => (
|
|
893
|
+
}, An = (i, n) => (t, e) => n(t, e, i);
|
|
894
894
|
let Ut = class extends le {
|
|
895
895
|
constructor(i, n) {
|
|
896
896
|
super(), this._autoFillService = i, this._injector = n, this._initAutoFillHooks();
|
|
@@ -899,8 +899,8 @@ let Ut = class extends le {
|
|
|
899
899
|
this.disposeWithMe(
|
|
900
900
|
this._autoFillService.addHook({
|
|
901
901
|
id: "sheet-cell-image-autofill",
|
|
902
|
-
onBeforeSubmit: (i, n,
|
|
903
|
-
new Fr(
|
|
902
|
+
onBeforeSubmit: (i, n, t, e) => {
|
|
903
|
+
new Fr(e).forValue((r, s, o) => {
|
|
904
904
|
on(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
|
|
905
905
|
});
|
|
906
906
|
}
|
|
@@ -912,16 +912,16 @@ Ut = Rs([
|
|
|
912
912
|
An(0, N(vi)),
|
|
913
913
|
An(1, N(tt))
|
|
914
914
|
], Ut);
|
|
915
|
-
var Ds = Object.getOwnPropertyDescriptor, Ms = (i, n,
|
|
916
|
-
for (var r =
|
|
915
|
+
var Ds = Object.getOwnPropertyDescriptor, Ms = (i, n, t, e) => {
|
|
916
|
+
for (var r = e > 1 ? void 0 : e ? Ds(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
917
917
|
(o = i[s]) && (r = o(r) || r);
|
|
918
918
|
return r;
|
|
919
|
-
}, bt = (i, n) => (
|
|
919
|
+
}, bt = (i, n) => (t, e) => n(t, e, i);
|
|
920
920
|
let Pt = class extends le {
|
|
921
|
-
constructor(n,
|
|
921
|
+
constructor(n, t, e, r) {
|
|
922
922
|
super();
|
|
923
923
|
Q(this, "_isSetCursor", !1);
|
|
924
|
-
this._hoverManagerService = n, this._renderManagerService =
|
|
924
|
+
this._hoverManagerService = n, this._renderManagerService = t, this._selectionsService = e, this._drawingRenderService = r;
|
|
925
925
|
}
|
|
926
926
|
_initHover() {
|
|
927
927
|
}
|
|
@@ -939,50 +939,50 @@ const Gt = {
|
|
|
939
939
|
type: te.COMMAND,
|
|
940
940
|
handler: async (i, n) => {
|
|
941
941
|
var s, o;
|
|
942
|
-
const
|
|
943
|
-
if (!
|
|
942
|
+
const e = (s = i.get(ne).getCurrentTypeOfRenderer(F.UNIVER_SHEET)) == null ? void 0 : s.with(et);
|
|
943
|
+
if (!e)
|
|
944
944
|
return !1;
|
|
945
945
|
const r = n == null ? void 0 : n.files;
|
|
946
946
|
if (r) {
|
|
947
|
-
const a = r.map((c) =>
|
|
947
|
+
const a = r.map((c) => e.insertFloatImageByFile(c));
|
|
948
948
|
return (await Promise.all(a)).every((c) => c);
|
|
949
949
|
} else
|
|
950
|
-
return (o =
|
|
950
|
+
return (o = e.insertFloatImage()) != null ? o : !1;
|
|
951
951
|
}
|
|
952
952
|
}, un = {
|
|
953
953
|
id: "sheet.command.insert-cell-image",
|
|
954
954
|
type: te.COMMAND,
|
|
955
955
|
handler: (i) => {
|
|
956
|
-
var
|
|
957
|
-
return (
|
|
956
|
+
var t, e;
|
|
957
|
+
return (e = (t = i.get(ne).getCurrentTypeOfRenderer(F.UNIVER_SHEET)) == null ? void 0 : t.with(et).insertCellImage()) != null ? e : !1;
|
|
958
958
|
}
|
|
959
959
|
};
|
|
960
|
-
var ys = Object.getOwnPropertyDescriptor, Ts = (i, n,
|
|
961
|
-
for (var r =
|
|
960
|
+
var ys = Object.getOwnPropertyDescriptor, Ts = (i, n, t, e) => {
|
|
961
|
+
for (var r = e > 1 ? void 0 : e ? ys(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
962
962
|
(o = i[s]) && (r = o(r) || r);
|
|
963
963
|
return r;
|
|
964
|
-
}, Je = (i, n) => (
|
|
964
|
+
}, Je = (i, n) => (t, e) => n(t, e, i);
|
|
965
965
|
const wr = "image/png";
|
|
966
966
|
function Es(i) {
|
|
967
|
-
const n = i.split(","),
|
|
968
|
-
for (let s = 0; s <
|
|
969
|
-
r[s] =
|
|
967
|
+
const n = i.split(","), t = atob(n[1]), e = t.length, r = new Uint8Array(e);
|
|
968
|
+
for (let s = 0; s < e; s++)
|
|
969
|
+
r[s] = t.charCodeAt(s);
|
|
970
970
|
return new Blob([r], { type: wr });
|
|
971
971
|
}
|
|
972
972
|
function Os(i) {
|
|
973
973
|
const n = new ClipboardItem({ [wr]: Es(i) });
|
|
974
|
-
navigator.clipboard.write([n]).catch((
|
|
975
|
-
console.error("Could not copy image using clipboard API: ",
|
|
974
|
+
navigator.clipboard.write([n]).catch((t) => {
|
|
975
|
+
console.error("Could not copy image using clipboard API: ", t);
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
978
|
function Us() {
|
|
979
979
|
function i() {
|
|
980
|
-
const
|
|
981
|
-
return
|
|
980
|
+
const e = document.createElement("input");
|
|
981
|
+
return e.style.position = "absolute", e.style.height = "1px", e.style.width = "1px", e.style.opacity = "0", e;
|
|
982
982
|
}
|
|
983
|
-
const n = document.activeElement,
|
|
984
|
-
return document.body.appendChild(
|
|
985
|
-
|
|
983
|
+
const n = document.activeElement, t = i();
|
|
984
|
+
return document.body.appendChild(t), t.focus(), () => {
|
|
985
|
+
t.blur(), document.body.removeChild(t), n instanceof HTMLElement && n.focus();
|
|
986
986
|
};
|
|
987
987
|
}
|
|
988
988
|
const Nn = [
|
|
@@ -992,10 +992,10 @@ const Nn = [
|
|
|
992
992
|
xe.SPECIAL_PASTE_FORMULA
|
|
993
993
|
];
|
|
994
994
|
let At = class extends le {
|
|
995
|
-
constructor(n,
|
|
995
|
+
constructor(n, t, e, r, s) {
|
|
996
996
|
super();
|
|
997
997
|
Q(this, "_copyInfo");
|
|
998
|
-
this._sheetClipboardService = n, this._renderManagerService =
|
|
998
|
+
this._sheetClipboardService = n, this._renderManagerService = t, this._drawingService = e, this._clipboardInterfaceService = r, this._commandService = s, this._initCopyPaste();
|
|
999
999
|
}
|
|
1000
1000
|
get _focusedDrawings() {
|
|
1001
1001
|
return this._drawingService.getFocusDrawings();
|
|
@@ -1004,7 +1004,7 @@ let At = class extends le {
|
|
|
1004
1004
|
_initCopyPaste() {
|
|
1005
1005
|
this._sheetClipboardService.addClipboardHook({
|
|
1006
1006
|
id: "SHEET_IMAGE_UI_PLUGIN",
|
|
1007
|
-
onBeforeCopy: (n,
|
|
1007
|
+
onBeforeCopy: (n, t, e, r) => {
|
|
1008
1008
|
const s = this._focusedDrawings;
|
|
1009
1009
|
if (s.length > 0) {
|
|
1010
1010
|
const [o] = s;
|
|
@@ -1026,30 +1026,30 @@ let At = class extends le {
|
|
|
1026
1026
|
};
|
|
1027
1027
|
this._copyInfo = a;
|
|
1028
1028
|
} else {
|
|
1029
|
-
const o = this._createDrawingsCopyInfoByRange(n,
|
|
1029
|
+
const o = this._createDrawingsCopyInfoByRange(n, t, e);
|
|
1030
1030
|
this._copyInfo = o;
|
|
1031
1031
|
}
|
|
1032
1032
|
},
|
|
1033
|
-
onPasteCells: (n,
|
|
1033
|
+
onPasteCells: (n, t, e, r) => {
|
|
1034
1034
|
if (!this._copyInfo)
|
|
1035
1035
|
return { redos: [], undos: [] };
|
|
1036
|
-
const { copyType: s = be.COPY, pasteType: o } = r, { range: a } = n || {}, { range: c, unitId: u, subUnitId: d } =
|
|
1037
|
-
return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: d, pasteRange: c }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo:
|
|
1036
|
+
const { copyType: s = be.COPY, pasteType: o } = r, { range: a } = n || {}, { range: c, unitId: u, subUnitId: d } = t;
|
|
1037
|
+
return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: d, pasteRange: c }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: o }, be.COPY);
|
|
1038
1038
|
},
|
|
1039
|
-
onPastePlainText: (n,
|
|
1039
|
+
onPastePlainText: (n, t) => ({ undos: [], redos: [] }),
|
|
1040
1040
|
onPasteUnrecognized: (n) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: n, pasteType: xe.DEFAULT_PASTE }, be.COPY) : { undos: [], redos: [] },
|
|
1041
|
-
onPasteFiles: (n,
|
|
1041
|
+
onPasteFiles: (n, t) => {
|
|
1042
1042
|
if (this._copyInfo)
|
|
1043
1043
|
return this._generateSingleDrawingPasteMutations({ pasteTo: n, pasteType: xe.DEFAULT_PASTE }, be.COPY);
|
|
1044
1044
|
{
|
|
1045
|
-
const
|
|
1046
|
-
if (
|
|
1045
|
+
const e = t.filter((r) => r.type.includes("image"));
|
|
1046
|
+
if (e.length)
|
|
1047
1047
|
return {
|
|
1048
1048
|
undos: [],
|
|
1049
1049
|
redos: [
|
|
1050
1050
|
{
|
|
1051
1051
|
id: Gt.id,
|
|
1052
|
-
params: { files:
|
|
1052
|
+
params: { files: e }
|
|
1053
1053
|
}
|
|
1054
1054
|
]
|
|
1055
1055
|
};
|
|
@@ -1058,14 +1058,14 @@ let At = class extends le {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
});
|
|
1060
1060
|
}
|
|
1061
|
-
_createDrawingsCopyInfoByRange(n,
|
|
1061
|
+
_createDrawingsCopyInfoByRange(n, t, e) {
|
|
1062
1062
|
var g;
|
|
1063
1063
|
const r = (g = this._renderManagerService.getRenderById(n)) == null ? void 0 : g.with(V);
|
|
1064
1064
|
if (!r) return;
|
|
1065
|
-
const s = r.attachRangeWithCoord(
|
|
1065
|
+
const s = r.attachRangeWithCoord(e);
|
|
1066
1066
|
if (!s)
|
|
1067
1067
|
return;
|
|
1068
|
-
const { startX: o, endX: a, startY: c, endY: u } = s, d = this._drawingService.getDrawingData(n,
|
|
1068
|
+
const { startX: o, endX: a, startY: c, endY: u } = s, d = this._drawingService.getDrawingData(n, t), l = this._focusedDrawings.slice();
|
|
1069
1069
|
if (Object.keys(d).forEach((h) => {
|
|
1070
1070
|
const f = d[h], { transform: p } = f;
|
|
1071
1071
|
if (f.anchorType !== U.Both || !p)
|
|
@@ -1079,15 +1079,15 @@ let At = class extends le {
|
|
|
1079
1079
|
o <= D && v <= a && c <= b && _ <= u && l.push(f);
|
|
1080
1080
|
}), l.length)
|
|
1081
1081
|
return {
|
|
1082
|
-
copyRange:
|
|
1082
|
+
copyRange: e,
|
|
1083
1083
|
drawings: l,
|
|
1084
1084
|
unitId: n,
|
|
1085
|
-
subUnitId:
|
|
1085
|
+
subUnitId: t
|
|
1086
1086
|
};
|
|
1087
1087
|
}
|
|
1088
|
-
_generateSingleDrawingPasteMutations(n,
|
|
1089
|
-
const { pasteType:
|
|
1090
|
-
if (Nn.includes(
|
|
1088
|
+
_generateSingleDrawingPasteMutations(n, t) {
|
|
1089
|
+
const { pasteType: e, pasteTo: r } = n;
|
|
1090
|
+
if (Nn.includes(e))
|
|
1091
1091
|
return { redos: [], undos: [] };
|
|
1092
1092
|
const { unitId: s, subUnitId: o, range: a } = r, c = this._renderManagerService.getRenderById(s), u = c == null ? void 0 : c.with(V), d = c == null ? void 0 : c.with(Xe), l = this._copyInfo;
|
|
1093
1093
|
if (!u || !d)
|
|
@@ -1096,7 +1096,7 @@ let At = class extends le {
|
|
|
1096
1096
|
return this._generateMutations(g, {
|
|
1097
1097
|
unitId: s,
|
|
1098
1098
|
subUnitId: o,
|
|
1099
|
-
isCut:
|
|
1099
|
+
isCut: t === be.CUT,
|
|
1100
1100
|
getTransform: (f, p) => {
|
|
1101
1101
|
var S;
|
|
1102
1102
|
const m = u.attachRangeWithCoord({
|
|
@@ -1116,20 +1116,20 @@ let At = class extends le {
|
|
|
1116
1116
|
}
|
|
1117
1117
|
});
|
|
1118
1118
|
}
|
|
1119
|
-
_generateMutations(n,
|
|
1119
|
+
_generateMutations(n, t) {
|
|
1120
1120
|
const {
|
|
1121
|
-
unitId:
|
|
1121
|
+
unitId: e,
|
|
1122
1122
|
subUnitId: r,
|
|
1123
1123
|
getTransform: s,
|
|
1124
1124
|
isCut: o
|
|
1125
|
-
} =
|
|
1125
|
+
} = t, a = [], c = [], { _drawingService: u } = this;
|
|
1126
1126
|
return n.forEach((d) => {
|
|
1127
1127
|
const { transform: l, sheetTransform: g } = d;
|
|
1128
1128
|
if (!l)
|
|
1129
1129
|
return;
|
|
1130
1130
|
const h = s(l, g), f = {
|
|
1131
1131
|
...d,
|
|
1132
|
-
unitId:
|
|
1132
|
+
unitId: e,
|
|
1133
1133
|
subUnitId: r,
|
|
1134
1134
|
drawingId: o ? d.drawingId : ye.generateRandomId(),
|
|
1135
1135
|
transform: h.transform,
|
|
@@ -1140,7 +1140,7 @@ let At = class extends le {
|
|
|
1140
1140
|
a.push({
|
|
1141
1141
|
id: A.id,
|
|
1142
1142
|
params: {
|
|
1143
|
-
unitId:
|
|
1143
|
+
unitId: e,
|
|
1144
1144
|
subUnitId: r,
|
|
1145
1145
|
type: P.UPDATE,
|
|
1146
1146
|
op: m,
|
|
@@ -1149,7 +1149,7 @@ let At = class extends le {
|
|
|
1149
1149
|
}), c.push({
|
|
1150
1150
|
id: A.id,
|
|
1151
1151
|
params: {
|
|
1152
|
-
unitId:
|
|
1152
|
+
unitId: e,
|
|
1153
1153
|
subUnitId: r,
|
|
1154
1154
|
type: P.UPDATE,
|
|
1155
1155
|
op: p,
|
|
@@ -1158,31 +1158,31 @@ let At = class extends le {
|
|
|
1158
1158
|
});
|
|
1159
1159
|
} else {
|
|
1160
1160
|
const { undo: p, redo: m, objects: w } = u.getBatchAddOp([f]);
|
|
1161
|
-
a.push({ id: A.id, params: { op: m, unitId:
|
|
1161
|
+
a.push({ id: A.id, params: { op: m, unitId: e, subUnitId: r, objects: w, type: P.INSERT } }), c.push({ id: A.id, params: { op: p, unitId: e, subUnitId: r, objects: w, type: P.REMOVE } });
|
|
1162
1162
|
}
|
|
1163
1163
|
}), { redos: a, undos: c };
|
|
1164
1164
|
}
|
|
1165
1165
|
// eslint-disable-next-line max-lines-per-function
|
|
1166
|
-
_generateRangeDrawingsPasteMutations(n,
|
|
1166
|
+
_generateRangeDrawingsPasteMutations(n, t) {
|
|
1167
1167
|
var E;
|
|
1168
1168
|
const {
|
|
1169
|
-
unitId:
|
|
1169
|
+
unitId: e,
|
|
1170
1170
|
subUnitId: r,
|
|
1171
1171
|
pasteType: s,
|
|
1172
1172
|
pasteRange: o
|
|
1173
1173
|
} = n, {
|
|
1174
1174
|
copyRange: a,
|
|
1175
1175
|
copyType: c
|
|
1176
|
-
} =
|
|
1176
|
+
} = t;
|
|
1177
1177
|
if (Nn.includes(s))
|
|
1178
1178
|
return { redos: [], undos: [] };
|
|
1179
|
-
const u = (E = this._renderManagerService.getRenderById(
|
|
1179
|
+
const u = (E = this._renderManagerService.getRenderById(e)) == null ? void 0 : E.with(V);
|
|
1180
1180
|
if (!u || !this._copyInfo)
|
|
1181
1181
|
return { redos: [], undos: [] };
|
|
1182
1182
|
const { drawings: d } = this._copyInfo;
|
|
1183
1183
|
if (!a)
|
|
1184
1184
|
return this._generateSingleDrawingPasteMutations({
|
|
1185
|
-
pasteTo: { unitId:
|
|
1185
|
+
pasteTo: { unitId: e, subUnitId: r, range: Rn(o) },
|
|
1186
1186
|
pasteType: s
|
|
1187
1187
|
}, c);
|
|
1188
1188
|
const { ranges: [l, g], mapFunc: h } = Ii([a, o]), { row: f, col: p } = h(l.startRow, l.startColumn), { row: m, col: w } = h(g.startRow, g.startColumn), S = u.attachRangeWithCoord({
|
|
@@ -1200,7 +1200,7 @@ let At = class extends le {
|
|
|
1200
1200
|
return { redos: [], undos: [] };
|
|
1201
1201
|
const D = C.startX - S.startX, v = C.startY - S.startY, b = m - f, _ = w - p;
|
|
1202
1202
|
return this._generateMutations(d, {
|
|
1203
|
-
unitId:
|
|
1203
|
+
unitId: e,
|
|
1204
1204
|
subUnitId: r,
|
|
1205
1205
|
getTransform: (M, y) => {
|
|
1206
1206
|
var T, I;
|
|
@@ -1236,30 +1236,30 @@ At = Ts([
|
|
|
1236
1236
|
Je(3, Pi),
|
|
1237
1237
|
Je(4, G)
|
|
1238
1238
|
], At);
|
|
1239
|
-
var Ps = Object.getOwnPropertyDescriptor, As = (i, n,
|
|
1240
|
-
for (var r =
|
|
1239
|
+
var Ps = Object.getOwnPropertyDescriptor, As = (i, n, t, e) => {
|
|
1240
|
+
for (var r = e > 1 ? void 0 : e ? Ps(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
1241
1241
|
(o = i[s]) && (r = o(r) || r);
|
|
1242
1242
|
return r;
|
|
1243
|
-
}, qe = (i, n) => (
|
|
1243
|
+
}, qe = (i, n) => (t, e) => n(t, e, i);
|
|
1244
1244
|
let Nt = class extends le {
|
|
1245
|
-
constructor(i, n,
|
|
1246
|
-
super(), this._drawingManagerService = i, this._renderManagerService = n, this._permissionService =
|
|
1245
|
+
constructor(i, n, t, e, r) {
|
|
1246
|
+
super(), this._drawingManagerService = i, this._renderManagerService = n, this._permissionService = t, this._univerInstanceService = e, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
1247
1247
|
}
|
|
1248
1248
|
_initDrawingVisible() {
|
|
1249
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$,
|
|
1249
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$, t = St([i, n]);
|
|
1250
1250
|
this.disposeWithMe(
|
|
1251
|
-
|
|
1252
|
-
Se(([
|
|
1251
|
+
t.pipe(
|
|
1252
|
+
Se(([e, r]) => e ? e.activeSheet$.pipe(
|
|
1253
1253
|
yn((s) => {
|
|
1254
1254
|
if (!s) {
|
|
1255
1255
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
1256
1256
|
return;
|
|
1257
1257
|
}
|
|
1258
|
-
const o =
|
|
1258
|
+
const o = e.getUnitId(), a = s.getSheetId();
|
|
1259
1259
|
this._permissionService.composePermission([
|
|
1260
1260
|
new On(o).id,
|
|
1261
1261
|
new Un(o, a).id
|
|
1262
|
-
]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(
|
|
1262
|
+
]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(e, s);
|
|
1263
1263
|
})
|
|
1264
1264
|
) : (this._drawingManagerService.setDrawingVisible(!1), pe))
|
|
1265
1265
|
).subscribe()
|
|
@@ -1267,7 +1267,7 @@ let Nt = class extends le {
|
|
|
1267
1267
|
}
|
|
1268
1268
|
_handleDrawingVisibilityFalse(i, n) {
|
|
1269
1269
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
1270
|
-
const
|
|
1270
|
+
const t = i.getUnitId(), e = n.getSheetId(), r = this._drawingManagerService.getDrawingData(t, e), s = Object.values(r), o = this._renderManagerService.getRenderById(t), a = o == null ? void 0 : o.scene;
|
|
1271
1271
|
if (!a)
|
|
1272
1272
|
return;
|
|
1273
1273
|
a.getAllObjectsByOrder().forEach((u) => {
|
|
@@ -1275,20 +1275,20 @@ let Nt = class extends le {
|
|
|
1275
1275
|
});
|
|
1276
1276
|
}
|
|
1277
1277
|
_initDrawingEditable() {
|
|
1278
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$,
|
|
1278
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$, t = St([i, n]);
|
|
1279
1279
|
this.disposeWithMe(
|
|
1280
|
-
|
|
1281
|
-
Se(([
|
|
1280
|
+
t.pipe(
|
|
1281
|
+
Se(([e, r]) => e ? e.activeSheet$.pipe(
|
|
1282
1282
|
yn((s) => {
|
|
1283
1283
|
if (!s) {
|
|
1284
1284
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
1285
1285
|
return;
|
|
1286
1286
|
}
|
|
1287
|
-
const o =
|
|
1287
|
+
const o = e.getUnitId(), a = s.getSheetId();
|
|
1288
1288
|
this._permissionService.composePermission([
|
|
1289
1289
|
new Qt(o).id,
|
|
1290
1290
|
new en(o, a).id
|
|
1291
|
-
]).every((u) => u.value) ? this._drawingManagerService.setDrawingEditable(!0) : this._handleDrawingEditableFalse(
|
|
1291
|
+
]).every((u) => u.value) ? this._drawingManagerService.setDrawingEditable(!0) : this._handleDrawingEditableFalse(e, s);
|
|
1292
1292
|
})
|
|
1293
1293
|
) : (this._drawingManagerService.setDrawingEditable(!1), pe))
|
|
1294
1294
|
).subscribe()
|
|
@@ -1296,7 +1296,7 @@ let Nt = class extends le {
|
|
|
1296
1296
|
}
|
|
1297
1297
|
_handleDrawingEditableFalse(i, n) {
|
|
1298
1298
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
1299
|
-
const
|
|
1299
|
+
const t = i.getUnitId(), e = n.getSheetId(), r = this._drawingManagerService.getDrawingData(t, e), s = Object.values(r), o = this._renderManagerService.getRenderById(t), a = o == null ? void 0 : o.scene;
|
|
1300
1300
|
if (!a)
|
|
1301
1301
|
return;
|
|
1302
1302
|
a.getAllObjectsByOrder().forEach((u) => {
|
|
@@ -1307,11 +1307,11 @@ let Nt = class extends le {
|
|
|
1307
1307
|
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$;
|
|
1308
1308
|
this.disposeWithMe(
|
|
1309
1309
|
St([i, n]).pipe(
|
|
1310
|
-
Se(([
|
|
1310
|
+
Se(([t, e]) => t ? t.activeSheet$.pipe(
|
|
1311
1311
|
Se((r) => {
|
|
1312
1312
|
if (!r)
|
|
1313
1313
|
return pe;
|
|
1314
|
-
const s =
|
|
1314
|
+
const s = t.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), c = a == null ? void 0 : a.scene;
|
|
1315
1315
|
if (!c)
|
|
1316
1316
|
return pe;
|
|
1317
1317
|
const u = c.getTransformerByCreate();
|
|
@@ -1333,16 +1333,16 @@ let Nt = class extends le {
|
|
|
1333
1333
|
})
|
|
1334
1334
|
) : pe)
|
|
1335
1335
|
).subscribe({
|
|
1336
|
-
next: ({ permission:
|
|
1337
|
-
this._drawingManagerService.setDrawingVisible(
|
|
1338
|
-
const a =
|
|
1339
|
-
|
|
1340
|
-
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) &&
|
|
1336
|
+
next: ({ permission: t, scene: e, transformer: r, unitId: s, subUnitId: o }) => {
|
|
1337
|
+
this._drawingManagerService.setDrawingVisible(t);
|
|
1338
|
+
const a = e.getAllObjectsByOrder(), c = this._drawingManagerService.getDrawingData(s, o), u = Object.values(c);
|
|
1339
|
+
t ? this._drawingManagerService.addNotification(u) : (a.forEach((d) => {
|
|
1340
|
+
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) && e.removeObject(d);
|
|
1341
1341
|
}), r.clearSelectedObjects());
|
|
1342
1342
|
},
|
|
1343
1343
|
complete: () => {
|
|
1344
1344
|
this._drawingManagerService.setDrawingVisible(!0);
|
|
1345
|
-
const
|
|
1345
|
+
const t = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET), e = t == null ? void 0 : t.getActiveSheet(), r = t == null ? void 0 : t.getUnitId(), s = e == null ? void 0 : e.getSheetId();
|
|
1346
1346
|
if (!r || !s)
|
|
1347
1347
|
return;
|
|
1348
1348
|
const o = this._drawingManagerService.getDrawingData(r, s), a = Object.values(o);
|
|
@@ -1355,11 +1355,11 @@ let Nt = class extends le {
|
|
|
1355
1355
|
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$;
|
|
1356
1356
|
this.disposeWithMe(
|
|
1357
1357
|
St([i, n]).pipe(
|
|
1358
|
-
Se(([
|
|
1358
|
+
Se(([t, e]) => t ? t.activeSheet$.pipe(
|
|
1359
1359
|
Se((r) => {
|
|
1360
1360
|
if (!r)
|
|
1361
1361
|
return pe;
|
|
1362
|
-
const s =
|
|
1362
|
+
const s = t.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), c = a == null ? void 0 : a.scene;
|
|
1363
1363
|
if (!c)
|
|
1364
1364
|
return pe;
|
|
1365
1365
|
const u = c.getTransformerByCreate();
|
|
@@ -1381,26 +1381,26 @@ let Nt = class extends le {
|
|
|
1381
1381
|
})
|
|
1382
1382
|
) : pe)
|
|
1383
1383
|
).subscribe({
|
|
1384
|
-
next: ({ permission:
|
|
1385
|
-
this._drawingManagerService.setDrawingEditable(
|
|
1386
|
-
const a =
|
|
1387
|
-
|
|
1388
|
-
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) &&
|
|
1384
|
+
next: ({ permission: t, scene: e, transformer: r, unitId: s, subUnitId: o }) => {
|
|
1385
|
+
this._drawingManagerService.setDrawingEditable(t);
|
|
1386
|
+
const a = e.getAllObjectsByOrder(), c = this._drawingManagerService.getDrawingData(s, o), u = Object.values(c);
|
|
1387
|
+
t ? (a.forEach((d) => {
|
|
1388
|
+
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) && e.attachTransformerTo(d);
|
|
1389
1389
|
}), this._drawingManagerService.addNotification(u)) : (a.forEach((d) => {
|
|
1390
|
-
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) &&
|
|
1390
|
+
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) && e.detachTransformerFrom(d);
|
|
1391
1391
|
}), r.clearSelectedObjects());
|
|
1392
1392
|
},
|
|
1393
1393
|
complete: () => {
|
|
1394
|
-
const
|
|
1395
|
-
if (!
|
|
1394
|
+
const t = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET);
|
|
1395
|
+
if (!t)
|
|
1396
1396
|
return;
|
|
1397
|
-
const
|
|
1397
|
+
const e = t.getUnitId(), r = t.getActiveSheet();
|
|
1398
1398
|
if (!r)
|
|
1399
1399
|
return;
|
|
1400
|
-
const s = r.getSheetId(), o = this._renderManagerService.getRenderById(
|
|
1400
|
+
const s = r.getSheetId(), o = this._renderManagerService.getRenderById(e), a = o == null ? void 0 : o.scene;
|
|
1401
1401
|
if (!a)
|
|
1402
1402
|
return;
|
|
1403
|
-
const c = this._drawingManagerService.getDrawingData(
|
|
1403
|
+
const c = this._drawingManagerService.getDrawingData(e, s), u = Object.values(c);
|
|
1404
1404
|
this._drawingManagerService.setDrawingEditable(!0), a.getAllObjectsByOrder().forEach((l) => {
|
|
1405
1405
|
l.classType === We.IMAGE && u.some((g) => l.oKey.includes(g.drawingId)) && a.detachTransformerFrom(l);
|
|
1406
1406
|
});
|
|
@@ -1416,25 +1416,25 @@ Nt = As([
|
|
|
1416
1416
|
qe(3, Ge),
|
|
1417
1417
|
qe(4, N(Gr))
|
|
1418
1418
|
], Nt);
|
|
1419
|
-
var Ns = Object.getOwnPropertyDescriptor, ks = (i, n,
|
|
1420
|
-
for (var r =
|
|
1419
|
+
var Ns = Object.getOwnPropertyDescriptor, ks = (i, n, t, e) => {
|
|
1420
|
+
for (var r = e > 1 ? void 0 : e ? Ns(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
1421
1421
|
(o = i[s]) && (r = o(r) || r);
|
|
1422
1422
|
return r;
|
|
1423
|
-
}, Rt = (i, n) => (
|
|
1423
|
+
}, Rt = (i, n) => (t, e) => n(t, e, i);
|
|
1424
1424
|
let kt = class extends le {
|
|
1425
|
-
constructor(i, n,
|
|
1426
|
-
super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = n, this._drawingManagerService =
|
|
1425
|
+
constructor(i, n, t, e) {
|
|
1426
|
+
super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = n, this._drawingManagerService = t, this._renderManagerService = e, this._initPrinting();
|
|
1427
1427
|
}
|
|
1428
1428
|
_initPrinting() {
|
|
1429
1429
|
this.disposeWithMe(
|
|
1430
1430
|
this._sheetPrintInterceptorService.interceptor.intercept(
|
|
1431
1431
|
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
|
|
1432
1432
|
{
|
|
1433
|
-
handler: (i, n,
|
|
1434
|
-
const { unitId:
|
|
1433
|
+
handler: (i, n, t) => {
|
|
1434
|
+
const { unitId: e, scene: r, subUnitId: s } = n, o = this._drawingManagerService.getDrawingDataForUnit(e), a = o == null ? void 0 : o[s];
|
|
1435
1435
|
return a && a.order.forEach((c) => {
|
|
1436
1436
|
this._drawingRenderService.renderDrawing(a.data[c], r);
|
|
1437
|
-
}),
|
|
1437
|
+
}), t();
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
)
|
|
@@ -1442,23 +1442,23 @@ let kt = class extends le {
|
|
|
1442
1442
|
this._sheetPrintInterceptorService.interceptor.intercept(
|
|
1443
1443
|
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,
|
|
1444
1444
|
{
|
|
1445
|
-
handler: (i, n,
|
|
1446
|
-
const { unitId:
|
|
1445
|
+
handler: (i, n, t) => {
|
|
1446
|
+
const { unitId: e, subUnitId: r } = n, s = this._renderManagerService.getRenderById(e);
|
|
1447
1447
|
if (!s)
|
|
1448
|
-
return
|
|
1448
|
+
return t(i);
|
|
1449
1449
|
const o = s.with(V).getSkeletonParam(r);
|
|
1450
1450
|
if (!o)
|
|
1451
|
-
return
|
|
1452
|
-
const a = this._drawingManagerService.getDrawingDataForUnit(
|
|
1451
|
+
return t(i);
|
|
1452
|
+
const a = this._drawingManagerService.getDrawingDataForUnit(e), c = a == null ? void 0 : a[n.subUnitId];
|
|
1453
1453
|
if (!c)
|
|
1454
|
-
return
|
|
1454
|
+
return t(i);
|
|
1455
1455
|
const { scaleX: u, scaleY: d } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, g = c.order.map((h) => c.data[h]).filter((h) => h.drawingType !== L.DRAWING_DOM);
|
|
1456
1456
|
return g.length ? (g.forEach((h) => {
|
|
1457
1457
|
if (!h.groupId && h.transform && ye.isDefine(h.transform.left) && ye.isDefine(h.transform.top) && ye.isDefine(h.transform.width) && ye.isDefine(h.transform.height)) {
|
|
1458
1458
|
const f = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, d, { x: 0, y: 0 }), p = o.skeleton.getCellIndexByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, u, d, { x: 0, y: 0 });
|
|
1459
1459
|
f.column < l.startColumn && (l.startColumn = f.column), f.row < l.startRow && (l.startRow = f.row), l.endRow < p.row && (l.endRow = p.row), l.endColumn < p.column && (l.endColumn = p.column);
|
|
1460
1460
|
}
|
|
1461
|
-
}),
|
|
1461
|
+
}), t(l)) : t(i);
|
|
1462
1462
|
}
|
|
1463
1463
|
}
|
|
1464
1464
|
)
|
|
@@ -1471,11 +1471,11 @@ kt = ks([
|
|
|
1471
1471
|
Rt(2, oe),
|
|
1472
1472
|
Rt(3, ne)
|
|
1473
1473
|
], kt);
|
|
1474
|
-
var Bs = Object.getOwnPropertyDescriptor, Ws = (i, n,
|
|
1475
|
-
for (var r =
|
|
1474
|
+
var Bs = Object.getOwnPropertyDescriptor, Ws = (i, n, t, e) => {
|
|
1475
|
+
for (var r = e > 1 ? void 0 : e ? Bs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
1476
1476
|
(o = i[s]) && (r = o(r) || r);
|
|
1477
1477
|
return r;
|
|
1478
|
-
}, _e = (i, n) => (
|
|
1478
|
+
}, _e = (i, n) => (t, e) => n(t, e, i);
|
|
1479
1479
|
const js = [
|
|
1480
1480
|
Xn.id,
|
|
1481
1481
|
Vn.id,
|
|
@@ -1505,8 +1505,8 @@ const js = [
|
|
|
1505
1505
|
Yn.id
|
|
1506
1506
|
];
|
|
1507
1507
|
let an = class extends le {
|
|
1508
|
-
constructor(i, n,
|
|
1509
|
-
super(), this._context = i, this._renderManagerService = n, this._commandService =
|
|
1508
|
+
constructor(i, n, t, e, r, s, o, a, c) {
|
|
1509
|
+
super(), this._context = i, this._renderManagerService = n, this._commandService = t, this._selectionRenderService = e, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = a, this._univerInstanceService = c, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
|
|
1510
1510
|
}
|
|
1511
1511
|
_sheetInterceptorListener() {
|
|
1512
1512
|
this.disposeWithMe(
|
|
@@ -1528,42 +1528,42 @@ let an = class extends le {
|
|
|
1528
1528
|
if (n === zn.id)
|
|
1529
1529
|
return this._moveColInterceptor(i.params, "remove");
|
|
1530
1530
|
if (n === Kn.id) {
|
|
1531
|
-
const { range:
|
|
1531
|
+
const { range: t } = i.params;
|
|
1532
1532
|
return this._getRangeMoveUndo(
|
|
1533
|
-
|
|
1533
|
+
t,
|
|
1534
1534
|
0
|
|
1535
1535
|
/* deleteLeft */
|
|
1536
1536
|
);
|
|
1537
1537
|
} else if (n === Zn.id) {
|
|
1538
|
-
const { range:
|
|
1538
|
+
const { range: t } = i.params;
|
|
1539
1539
|
return this._getRangeMoveUndo(
|
|
1540
|
-
|
|
1540
|
+
t,
|
|
1541
1541
|
1
|
|
1542
1542
|
/* deleteUp */
|
|
1543
1543
|
);
|
|
1544
1544
|
} else if (n === Jn.id) {
|
|
1545
|
-
const { range:
|
|
1545
|
+
const { range: t } = i.params;
|
|
1546
1546
|
return this._getRangeMoveUndo(
|
|
1547
|
-
|
|
1547
|
+
t,
|
|
1548
1548
|
2
|
|
1549
1549
|
/* insertDown */
|
|
1550
1550
|
);
|
|
1551
1551
|
} else if (n === qn.id) {
|
|
1552
|
-
const { range:
|
|
1552
|
+
const { range: t } = i.params;
|
|
1553
1553
|
return this._getRangeMoveUndo(
|
|
1554
|
-
|
|
1554
|
+
t,
|
|
1555
1555
|
3
|
|
1556
1556
|
/* insertRight */
|
|
1557
1557
|
);
|
|
1558
1558
|
} else if (n === tr.id || n === nr.id) {
|
|
1559
|
-
const
|
|
1560
|
-
return this._getDrawingUndoForRowVisible(
|
|
1559
|
+
const t = i.params, { unitId: e, subUnitId: r, ranges: s } = t;
|
|
1560
|
+
return this._getDrawingUndoForRowVisible(e, r, s);
|
|
1561
1561
|
} else if (n === rr.id || n === ir.id) {
|
|
1562
|
-
const
|
|
1563
|
-
return this._getDrawingUndoForColVisible(
|
|
1562
|
+
const t = i.params, { unitId: e, subUnitId: r, ranges: s } = t;
|
|
1563
|
+
return this._getDrawingUndoForColVisible(e, r, s);
|
|
1564
1564
|
} else if (n === tn.id || n === nn.id || n === Qn.id || n === er.id) {
|
|
1565
|
-
const
|
|
1566
|
-
return this._getDrawingUndoForRowAndColSize(
|
|
1565
|
+
const t = i.params, { unitId: e, subUnitId: r, ranges: s } = t, o = n === tn.id || n === nn.id;
|
|
1566
|
+
return this._getDrawingUndoForRowAndColSize(e, r, s, o);
|
|
1567
1567
|
}
|
|
1568
1568
|
return { redos: [], undos: [] };
|
|
1569
1569
|
}
|
|
@@ -1571,10 +1571,10 @@ let an = class extends le {
|
|
|
1571
1571
|
);
|
|
1572
1572
|
}
|
|
1573
1573
|
_getRangeMoveUndo(i, n) {
|
|
1574
|
-
const
|
|
1575
|
-
if (
|
|
1574
|
+
const t = H(this._univerInstanceService);
|
|
1575
|
+
if (t == null)
|
|
1576
1576
|
return { redos: [], undos: [] };
|
|
1577
|
-
const
|
|
1577
|
+
const e = t.unitId, r = t.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(e, r), c = [], u = [];
|
|
1578
1578
|
if (Object.keys(a).forEach((d) => {
|
|
1579
1579
|
const l = a[d], { updateDrawings: g, deleteDrawings: h } = this._getUpdateOrDeleteDrawings(i, n, l);
|
|
1580
1580
|
c.push(...g), u.push(...h);
|
|
@@ -1582,22 +1582,22 @@ let an = class extends le {
|
|
|
1582
1582
|
return { redos: [], undos: [] };
|
|
1583
1583
|
if (c.length > 0) {
|
|
1584
1584
|
const d = this._sheetDrawingService.getBatchUpdateOp(c), { undo: l, redo: g, objects: h } = d;
|
|
1585
|
-
s.push({ id: A.id, params: { unitId:
|
|
1585
|
+
s.push({ id: A.id, params: { unitId: e, subUnitId: r, op: g, objects: h, type: P.UPDATE } }), o.push({ id: A.id, params: { unitId: e, subUnitId: r, op: l, objects: h, type: P.UPDATE } });
|
|
1586
1586
|
}
|
|
1587
1587
|
if (u.length > 0) {
|
|
1588
1588
|
const d = this._sheetDrawingService.getBatchRemoveOp(u), l = d.undo, g = d.redo, h = d.objects;
|
|
1589
|
-
s.push({ id: A.id, params: { unitId:
|
|
1589
|
+
s.push({ id: A.id, params: { unitId: e, subUnitId: r, op: g, objects: h, type: P.REMOVE } }), o.push({ id: A.id, params: { unitId: e, subUnitId: r, op: l, objects: h, type: P.INSERT } });
|
|
1590
1590
|
}
|
|
1591
|
-
return s.push({ id: x.id, params: [
|
|
1591
|
+
return s.push({ id: x.id, params: [e] }), o.push({ id: x.id, params: [e] }), {
|
|
1592
1592
|
redos: s,
|
|
1593
1593
|
undos: o
|
|
1594
1594
|
};
|
|
1595
1595
|
}
|
|
1596
|
-
_getUpdateOrDeleteDrawings(i, n,
|
|
1597
|
-
const
|
|
1596
|
+
_getUpdateOrDeleteDrawings(i, n, t) {
|
|
1597
|
+
const e = [], r = [], { sheetTransform: s, anchorType: o = U.Position, transform: a, unitId: c, subUnitId: u, drawingId: d } = t, { from: l, to: g } = s, { row: h, column: f } = l, { row: p, column: m } = g;
|
|
1598
1598
|
if (s == null || a == null)
|
|
1599
1599
|
return {
|
|
1600
|
-
updateDrawings:
|
|
1600
|
+
updateDrawings: e,
|
|
1601
1601
|
deleteDrawings: r
|
|
1602
1602
|
};
|
|
1603
1603
|
const { startRow: w, endRow: S, startColumn: C, endColumn: D } = i;
|
|
@@ -1625,28 +1625,28 @@ let an = class extends le {
|
|
|
1625
1625
|
}
|
|
1626
1626
|
if (v != null && b != null) {
|
|
1627
1627
|
const _ = z(v, this._selectionRenderService, this._skeletonManagerService);
|
|
1628
|
-
|
|
1628
|
+
e.push({ ...t, sheetTransform: v, transform: _ });
|
|
1629
1629
|
}
|
|
1630
|
-
return { updateDrawings:
|
|
1630
|
+
return { updateDrawings: e, deleteDrawings: r };
|
|
1631
1631
|
}
|
|
1632
|
-
_remainDrawingSize(i, n,
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1635
|
-
...
|
|
1636
|
-
sheetTransform:
|
|
1632
|
+
_remainDrawingSize(i, n, t) {
|
|
1633
|
+
const e = $({ ...i }, this._selectionRenderService);
|
|
1634
|
+
e != null && n.push({
|
|
1635
|
+
...t,
|
|
1636
|
+
sheetTransform: e
|
|
1637
1637
|
});
|
|
1638
1638
|
}
|
|
1639
1639
|
// eslint-disable-next-line max-lines-per-function
|
|
1640
|
-
_getDrawingUndoForColVisible(i, n,
|
|
1641
|
-
const
|
|
1642
|
-
if (Object.keys(
|
|
1643
|
-
const l =
|
|
1640
|
+
_getDrawingUndoForColVisible(i, n, t) {
|
|
1641
|
+
const e = this._drawingManagerService.getDrawingData(i, n), r = [], s = [];
|
|
1642
|
+
if (Object.keys(e).forEach((d) => {
|
|
1643
|
+
const l = e[d], { sheetTransform: g, transform: h, anchorType: f = U.Position } = l;
|
|
1644
1644
|
if (f === U.None)
|
|
1645
1645
|
this._remainDrawingSize(h, r, l);
|
|
1646
1646
|
else {
|
|
1647
1647
|
const { from: p, to: m } = g, { row: w, column: S } = p, { row: C, column: D } = m;
|
|
1648
|
-
for (let v = 0; v <
|
|
1649
|
-
const b =
|
|
1648
|
+
for (let v = 0; v < t.length; v++) {
|
|
1649
|
+
const b = t[v], { startRow: _, endRow: E, startColumn: M, endColumn: y } = b;
|
|
1650
1650
|
if (D < M)
|
|
1651
1651
|
continue;
|
|
1652
1652
|
if (f === U.Position) {
|
|
@@ -1717,8 +1717,8 @@ let an = class extends le {
|
|
|
1717
1717
|
preUndos: u
|
|
1718
1718
|
};
|
|
1719
1719
|
}
|
|
1720
|
-
_createUndoAndRedoMutation(i, n,
|
|
1721
|
-
const
|
|
1720
|
+
_createUndoAndRedoMutation(i, n, t) {
|
|
1721
|
+
const e = this._sheetDrawingService.getBatchUpdateOp(t), { undo: r, redo: s, objects: o } = e, a = [
|
|
1722
1722
|
{ id: A.id, params: { unitId: i, subUnitId: n, op: s, objects: o, type: P.UPDATE } },
|
|
1723
1723
|
{ id: x.id, params: [i] }
|
|
1724
1724
|
], c = [
|
|
@@ -1731,16 +1731,16 @@ let an = class extends le {
|
|
|
1731
1731
|
};
|
|
1732
1732
|
}
|
|
1733
1733
|
// eslint-disable-next-line max-lines-per-function
|
|
1734
|
-
_getDrawingUndoForRowVisible(i, n,
|
|
1735
|
-
const
|
|
1736
|
-
if (Object.keys(
|
|
1737
|
-
const l =
|
|
1734
|
+
_getDrawingUndoForRowVisible(i, n, t) {
|
|
1735
|
+
const e = this._drawingManagerService.getDrawingData(i, n), r = [], s = [];
|
|
1736
|
+
if (Object.keys(e).forEach((d) => {
|
|
1737
|
+
const l = e[d], { sheetTransform: g, transform: h, anchorType: f = U.Position } = l;
|
|
1738
1738
|
if (f === U.None)
|
|
1739
1739
|
this._remainDrawingSize(h, r, l);
|
|
1740
1740
|
else {
|
|
1741
1741
|
const { from: p, to: m } = g, { row: w, column: S } = p, { row: C, column: D } = m;
|
|
1742
|
-
for (let v = 0; v <
|
|
1743
|
-
const b =
|
|
1742
|
+
for (let v = 0; v < t.length; v++) {
|
|
1743
|
+
const b = t[v], { startRow: _, endRow: E, startColumn: M, endColumn: y } = b;
|
|
1744
1744
|
if (C < _)
|
|
1745
1745
|
continue;
|
|
1746
1746
|
if (f === U.Position) {
|
|
@@ -1811,7 +1811,7 @@ let an = class extends le {
|
|
|
1811
1811
|
preUndos: u
|
|
1812
1812
|
};
|
|
1813
1813
|
}
|
|
1814
|
-
_getDrawingUndoForRowAndColSize(i, n,
|
|
1814
|
+
_getDrawingUndoForRowAndColSize(i, n, t, e) {
|
|
1815
1815
|
const r = this._drawingManagerService.getDrawingData(i, n), s = [];
|
|
1816
1816
|
return Object.keys(r).forEach((o) => {
|
|
1817
1817
|
const a = r[o], { sheetTransform: c, transform: u, anchorType: d = U.Position } = a;
|
|
@@ -1819,8 +1819,8 @@ let an = class extends le {
|
|
|
1819
1819
|
this._remainDrawingSize(u, s, a);
|
|
1820
1820
|
else {
|
|
1821
1821
|
const { from: l, to: g } = c, { row: h, column: f } = l, { row: p, column: m } = g;
|
|
1822
|
-
for (let w = 0; w <
|
|
1823
|
-
const S =
|
|
1822
|
+
for (let w = 0; w < t.length; w++) {
|
|
1823
|
+
const S = t[w], { startRow: C, endRow: D, startColumn: v, endColumn: b } = S;
|
|
1824
1824
|
if (p < C || m < v)
|
|
1825
1825
|
continue;
|
|
1826
1826
|
if (d === U.Position && (h <= C && p >= D || f <= v && m >= b)) {
|
|
@@ -1844,26 +1844,26 @@ let an = class extends le {
|
|
|
1844
1844
|
}), s.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(i, n, s);
|
|
1845
1845
|
}
|
|
1846
1846
|
_getUnitIdAndSubUnitId(i, n) {
|
|
1847
|
-
let
|
|
1847
|
+
let t, e;
|
|
1848
1848
|
if (n === "insert")
|
|
1849
|
-
|
|
1849
|
+
t = i.unitId, e = i.subUnitId;
|
|
1850
1850
|
else {
|
|
1851
1851
|
const r = H(this._univerInstanceService);
|
|
1852
1852
|
if (r == null)
|
|
1853
1853
|
return;
|
|
1854
|
-
|
|
1854
|
+
t = r.unitId, e = r.subUnitId;
|
|
1855
1855
|
}
|
|
1856
|
-
return { unitId:
|
|
1856
|
+
return { unitId: t, subUnitId: e };
|
|
1857
1857
|
}
|
|
1858
1858
|
_moveRangeInterceptor(i) {
|
|
1859
1859
|
var C, D;
|
|
1860
|
-
const { toRange: n, fromRange:
|
|
1861
|
-
if (!
|
|
1860
|
+
const { toRange: n, fromRange: t } = i, e = H(this._univerInstanceService);
|
|
1861
|
+
if (!e)
|
|
1862
1862
|
return { redos: [], undos: [] };
|
|
1863
|
-
const { unitId: r, subUnitId: s } =
|
|
1863
|
+
const { unitId: r, subUnitId: s } = e, o = (D = (C = this._renderManagerService.getRenderById(r)) == null ? void 0 : C.with(V)) == null ? void 0 : D.getCurrentSkeleton();
|
|
1864
1864
|
if (!o)
|
|
1865
1865
|
return { redos: [], undos: [] };
|
|
1866
|
-
const a = xn(o,
|
|
1866
|
+
const a = xn(o, t);
|
|
1867
1867
|
if (!a)
|
|
1868
1868
|
return { redos: [], undos: [] };
|
|
1869
1869
|
const { startX: c, endX: u, startY: d, endY: l } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
|
|
@@ -1882,7 +1882,7 @@ let an = class extends le {
|
|
|
1882
1882
|
};
|
|
1883
1883
|
c <= I && R <= u && d <= O && B <= l && h.push(b);
|
|
1884
1884
|
});
|
|
1885
|
-
const f = [], p = [], m = n.startRow -
|
|
1885
|
+
const f = [], p = [], m = n.startRow - t.startRow, w = n.startColumn - t.startColumn, S = h.map((v) => {
|
|
1886
1886
|
const b = v.sheetTransform, _ = {
|
|
1887
1887
|
to: { ...b.to, row: b.to.row + m, column: b.to.column + w },
|
|
1888
1888
|
from: { ...b.from, row: b.from.row + m, column: b.from.column + w }
|
|
@@ -1902,10 +1902,10 @@ let an = class extends le {
|
|
|
1902
1902
|
return { redos: f, undos: p };
|
|
1903
1903
|
}
|
|
1904
1904
|
_moveRowInterceptor(i, n) {
|
|
1905
|
-
const
|
|
1906
|
-
if (
|
|
1905
|
+
const t = this._getUnitIdAndSubUnitId(i, n);
|
|
1906
|
+
if (t == null)
|
|
1907
1907
|
return { redos: [], undos: [] };
|
|
1908
|
-
const { unitId:
|
|
1908
|
+
const { unitId: e, subUnitId: r } = t, { range: s } = i, o = s.startRow, a = s.endRow, c = [], u = [], d = this._sheetDrawingService.getDrawingData(e, r), l = [], g = [];
|
|
1909
1909
|
if (Object.keys(d).forEach((h) => {
|
|
1910
1910
|
const f = d[h], { sheetTransform: p, transform: m, anchorType: w = U.Position } = f;
|
|
1911
1911
|
if (p == null || m == null)
|
|
@@ -1917,7 +1917,7 @@ let an = class extends le {
|
|
|
1917
1917
|
} else {
|
|
1918
1918
|
const { from: v, to: b } = p, { row: _ } = v, { row: E } = b;
|
|
1919
1919
|
if (w === U.Both && _ >= o && E <= a)
|
|
1920
|
-
g.push({ unitId:
|
|
1920
|
+
g.push({ unitId: e, subUnitId: r, drawingId: h });
|
|
1921
1921
|
else {
|
|
1922
1922
|
const M = this._shrinkRow(p, m, o, a, w);
|
|
1923
1923
|
S = M == null ? void 0 : M.newSheetTransform, C = M == null ? void 0 : M.newTransform;
|
|
@@ -1925,28 +1925,28 @@ let an = class extends le {
|
|
|
1925
1925
|
}
|
|
1926
1926
|
if (!S || !C)
|
|
1927
1927
|
return;
|
|
1928
|
-
const D = { unitId:
|
|
1928
|
+
const D = { unitId: e, subUnitId: r, drawingId: h, transform: C, sheetTransform: S };
|
|
1929
1929
|
l.push(D);
|
|
1930
1930
|
}), l.length === 0 && g.length === 0)
|
|
1931
1931
|
return { redos: [], undos: [] };
|
|
1932
1932
|
if (l.length > 0) {
|
|
1933
1933
|
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: p, objects: m } = h;
|
|
1934
|
-
c.push({ id: A.id, params: { unitId:
|
|
1934
|
+
c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.UPDATE } });
|
|
1935
1935
|
}
|
|
1936
1936
|
if (g.length > 0) {
|
|
1937
1937
|
const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, p = h.redo, m = h.objects;
|
|
1938
|
-
c.push({ id: A.id, params: { unitId:
|
|
1938
|
+
c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.INSERT } });
|
|
1939
1939
|
}
|
|
1940
|
-
return c.push({ id: x.id, params: [
|
|
1940
|
+
return c.push({ id: x.id, params: [e] }), u.push({ id: x.id, params: [e] }), {
|
|
1941
1941
|
redos: c,
|
|
1942
1942
|
undos: u
|
|
1943
1943
|
};
|
|
1944
1944
|
}
|
|
1945
1945
|
_moveColInterceptor(i, n) {
|
|
1946
|
-
const
|
|
1947
|
-
if (
|
|
1946
|
+
const t = this._getUnitIdAndSubUnitId(i, n);
|
|
1947
|
+
if (t == null)
|
|
1948
1948
|
return { redos: [], undos: [] };
|
|
1949
|
-
const { unitId:
|
|
1949
|
+
const { unitId: e, subUnitId: r } = t, { range: s } = i, o = s.startColumn, a = s.endColumn, c = [], u = [], d = this._sheetDrawingService.getDrawingData(e, r), l = [], g = [];
|
|
1950
1950
|
if (Object.keys(d).forEach((h) => {
|
|
1951
1951
|
const f = d[h], { sheetTransform: p, transform: m, anchorType: w = U.Position } = f;
|
|
1952
1952
|
if (p == null || m == null)
|
|
@@ -1958,7 +1958,7 @@ let an = class extends le {
|
|
|
1958
1958
|
} else {
|
|
1959
1959
|
const { from: v, to: b } = p, { column: _ } = v, { column: E } = b;
|
|
1960
1960
|
if (w === U.Both && _ >= o && E <= a)
|
|
1961
|
-
g.push({ unitId:
|
|
1961
|
+
g.push({ unitId: e, subUnitId: r, drawingId: h });
|
|
1962
1962
|
else {
|
|
1963
1963
|
const M = this._shrinkCol(p, m, o, a, w);
|
|
1964
1964
|
S = M == null ? void 0 : M.newSheetTransform, C = M == null ? void 0 : M.newTransform;
|
|
@@ -1966,34 +1966,34 @@ let an = class extends le {
|
|
|
1966
1966
|
}
|
|
1967
1967
|
if (!S || !C)
|
|
1968
1968
|
return;
|
|
1969
|
-
const D = { unitId:
|
|
1969
|
+
const D = { unitId: e, subUnitId: r, drawingId: h, transform: C, sheetTransform: S };
|
|
1970
1970
|
l.push(D);
|
|
1971
1971
|
}), l.length === 0 && g.length === 0)
|
|
1972
1972
|
return { redos: [], undos: [] };
|
|
1973
1973
|
if (l.length > 0) {
|
|
1974
1974
|
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: p, objects: m } = h;
|
|
1975
|
-
c.push({ id: A.id, params: { unitId:
|
|
1975
|
+
c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.UPDATE } });
|
|
1976
1976
|
}
|
|
1977
1977
|
if (g.length > 0) {
|
|
1978
1978
|
const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, p = h.redo, m = h.objects;
|
|
1979
|
-
c.push({ id: A.id, params: { unitId:
|
|
1979
|
+
c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.INSERT } });
|
|
1980
1980
|
}
|
|
1981
|
-
return c.push({ id: x.id, params: [
|
|
1981
|
+
return c.push({ id: x.id, params: [e] }), u.push({ id: x.id, params: [e] }), { redos: c, undos: u };
|
|
1982
1982
|
}
|
|
1983
|
-
_expandCol(i, n,
|
|
1984
|
-
const s =
|
|
1983
|
+
_expandCol(i, n, t, e, r = U.Position) {
|
|
1984
|
+
const s = e - t + 1, { from: o, to: a } = i, { column: c } = o, { column: u } = a;
|
|
1985
1985
|
if (r === U.None)
|
|
1986
1986
|
return {
|
|
1987
1987
|
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
1988
1988
|
newTransform: n
|
|
1989
1989
|
};
|
|
1990
1990
|
let d = null, l = null;
|
|
1991
|
-
if (c >=
|
|
1992
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn:
|
|
1991
|
+
if (c >= t) {
|
|
1992
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: t, endColumn: e, startRow: o.row, endRow: a.row });
|
|
1993
1993
|
if (g == null)
|
|
1994
1994
|
return;
|
|
1995
1995
|
l = { ...n, left: (n.left || 0) + g.endX - g.startX }, d = $(l, this._selectionRenderService);
|
|
1996
|
-
} else if (u >=
|
|
1996
|
+
} else if (u >= e)
|
|
1997
1997
|
if (r === U.Both)
|
|
1998
1998
|
d = {
|
|
1999
1999
|
from: { ...o },
|
|
@@ -2009,23 +2009,23 @@ let an = class extends le {
|
|
|
2009
2009
|
newTransform: l
|
|
2010
2010
|
} : null;
|
|
2011
2011
|
}
|
|
2012
|
-
_shrinkCol(i, n,
|
|
2013
|
-
const s =
|
|
2012
|
+
_shrinkCol(i, n, t, e, r = U.Position) {
|
|
2013
|
+
const s = e - t + 1, { from: o, to: a } = i, { column: c } = o, { column: u } = a;
|
|
2014
2014
|
if (r === U.None)
|
|
2015
2015
|
return {
|
|
2016
2016
|
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2017
2017
|
newTransform: n
|
|
2018
2018
|
};
|
|
2019
2019
|
let d = null, l = null;
|
|
2020
|
-
if (c >
|
|
2020
|
+
if (c > e)
|
|
2021
2021
|
d = {
|
|
2022
2022
|
from: { ...o, column: c - s },
|
|
2023
2023
|
to: { ...a, column: u - s }
|
|
2024
2024
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2025
2025
|
else {
|
|
2026
|
-
if (c >=
|
|
2026
|
+
if (c >= t && u <= e)
|
|
2027
2027
|
return null;
|
|
2028
|
-
if (c <
|
|
2028
|
+
if (c < t && u > e)
|
|
2029
2029
|
if (r === U.Both)
|
|
2030
2030
|
d = {
|
|
2031
2031
|
from: { ...o },
|
|
@@ -2036,20 +2036,20 @@ let an = class extends le {
|
|
|
2036
2036
|
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2037
2037
|
newTransform: n
|
|
2038
2038
|
};
|
|
2039
|
-
else if (c >=
|
|
2040
|
-
if (c ===
|
|
2039
|
+
else if (c >= t && c <= e) {
|
|
2040
|
+
if (c === t)
|
|
2041
2041
|
l = { ...n, left: (n.left || 0) - i.from.columnOffset };
|
|
2042
2042
|
else {
|
|
2043
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn:
|
|
2043
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: t, endColumn: c - 1, startRow: o.row, endRow: a.row });
|
|
2044
2044
|
if (g == null)
|
|
2045
2045
|
return;
|
|
2046
2046
|
l = { ...n, left: (n.left || 0) - g.endX + g.startX - i.from.columnOffset };
|
|
2047
2047
|
}
|
|
2048
2048
|
d = $(l, this._selectionRenderService);
|
|
2049
|
-
} else if (u >=
|
|
2049
|
+
} else if (u >= t && u <= e && r === U.Both) {
|
|
2050
2050
|
const g = this._skeletonManagerService.attachRangeWithCoord({
|
|
2051
|
-
startColumn:
|
|
2052
|
-
endColumn:
|
|
2051
|
+
startColumn: t - 1,
|
|
2052
|
+
endColumn: t - 1,
|
|
2053
2053
|
startRow: o.row,
|
|
2054
2054
|
endRow: a.row
|
|
2055
2055
|
});
|
|
@@ -2057,7 +2057,7 @@ let an = class extends le {
|
|
|
2057
2057
|
return;
|
|
2058
2058
|
d = {
|
|
2059
2059
|
from: { ...o },
|
|
2060
|
-
to: { ...a, column:
|
|
2060
|
+
to: { ...a, column: t - 1, columnOffset: g.endX - g.startX }
|
|
2061
2061
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2062
2062
|
}
|
|
2063
2063
|
}
|
|
@@ -2066,20 +2066,20 @@ let an = class extends le {
|
|
|
2066
2066
|
newTransform: l
|
|
2067
2067
|
} : null;
|
|
2068
2068
|
}
|
|
2069
|
-
_expandRow(i, n,
|
|
2070
|
-
const s =
|
|
2069
|
+
_expandRow(i, n, t, e, r = U.Position) {
|
|
2070
|
+
const s = e - t + 1, { from: o, to: a } = i, { row: c } = o, { row: u } = a;
|
|
2071
2071
|
if (r === U.None)
|
|
2072
2072
|
return {
|
|
2073
2073
|
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2074
2074
|
newTransform: n
|
|
2075
2075
|
};
|
|
2076
2076
|
let d = null, l = null;
|
|
2077
|
-
if (c >=
|
|
2078
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow:
|
|
2077
|
+
if (c >= t) {
|
|
2078
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: t, endRow: e, startColumn: o.column, endColumn: a.column });
|
|
2079
2079
|
if (g == null)
|
|
2080
2080
|
return;
|
|
2081
2081
|
l = { ...n, top: (n.top || 0) + g.endY - g.startY }, d = $(l, this._selectionRenderService);
|
|
2082
|
-
} else if (u >=
|
|
2082
|
+
} else if (u >= e)
|
|
2083
2083
|
if (r === U.Both)
|
|
2084
2084
|
d = {
|
|
2085
2085
|
from: { ...o },
|
|
@@ -2098,23 +2098,23 @@ let an = class extends le {
|
|
|
2098
2098
|
newTransform: l
|
|
2099
2099
|
} : null;
|
|
2100
2100
|
}
|
|
2101
|
-
_shrinkRow(i, n,
|
|
2102
|
-
const s =
|
|
2101
|
+
_shrinkRow(i, n, t, e, r = U.Position) {
|
|
2102
|
+
const s = e - t + 1, { from: o, to: a } = i, { row: c } = o, { row: u } = a;
|
|
2103
2103
|
if (r === U.None)
|
|
2104
2104
|
return {
|
|
2105
2105
|
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2106
2106
|
newTransform: n
|
|
2107
2107
|
};
|
|
2108
2108
|
let d = null, l = null;
|
|
2109
|
-
if (c >
|
|
2109
|
+
if (c > e)
|
|
2110
2110
|
d = {
|
|
2111
2111
|
from: { ...o, row: c - s },
|
|
2112
2112
|
to: { ...a, row: u - s }
|
|
2113
2113
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2114
2114
|
else {
|
|
2115
|
-
if (c >=
|
|
2115
|
+
if (c >= t && u <= e)
|
|
2116
2116
|
return null;
|
|
2117
|
-
if (c <
|
|
2117
|
+
if (c < t && u > e)
|
|
2118
2118
|
if (r === U.Both)
|
|
2119
2119
|
d = {
|
|
2120
2120
|
from: { ...o },
|
|
@@ -2125,23 +2125,23 @@ let an = class extends le {
|
|
|
2125
2125
|
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2126
2126
|
newTransform: n
|
|
2127
2127
|
};
|
|
2128
|
-
else if (c >=
|
|
2129
|
-
if (c ===
|
|
2128
|
+
else if (c >= t && c <= e) {
|
|
2129
|
+
if (c === t)
|
|
2130
2130
|
l = { ...n, top: (n.top || 0) - i.from.rowOffset };
|
|
2131
2131
|
else {
|
|
2132
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow:
|
|
2132
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: t, endRow: c - 1, startColumn: o.column, endColumn: a.column });
|
|
2133
2133
|
if (g == null)
|
|
2134
2134
|
return;
|
|
2135
2135
|
l = { ...n, top: (n.top || 0) - g.endY + g.startY - i.from.rowOffset };
|
|
2136
2136
|
}
|
|
2137
2137
|
d = $(l, this._selectionRenderService);
|
|
2138
|
-
} else if (u >=
|
|
2139
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow:
|
|
2138
|
+
} else if (u >= t && u <= e && r === U.Both) {
|
|
2139
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: t - 1, endRow: t - 1 });
|
|
2140
2140
|
if (g == null)
|
|
2141
2141
|
return;
|
|
2142
2142
|
d = {
|
|
2143
2143
|
from: { ...o },
|
|
2144
|
-
to: { ...a, row:
|
|
2144
|
+
to: { ...a, row: t - 1, rowOffset: g.endY - g.startY }
|
|
2145
2145
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2146
2146
|
}
|
|
2147
2147
|
}
|
|
@@ -2157,72 +2157,72 @@ let an = class extends le {
|
|
|
2157
2157
|
// As a temp solution, I subscribed to activate$ here.
|
|
2158
2158
|
this._commandService.onCommandExecuted((i) => {
|
|
2159
2159
|
if (i.id === Ji.id) {
|
|
2160
|
-
const { unitId: n, subUnitId:
|
|
2161
|
-
this._updateDrawings(n,
|
|
2160
|
+
const { unitId: n, subUnitId: t } = i.params;
|
|
2161
|
+
this._updateDrawings(n, t);
|
|
2162
2162
|
}
|
|
2163
2163
|
})
|
|
2164
2164
|
), this.disposeWithMe(
|
|
2165
2165
|
this._context.activated$.subscribe((i) => {
|
|
2166
|
-
const { unit: n, unitId:
|
|
2166
|
+
const { unit: n, unitId: t } = this._context;
|
|
2167
2167
|
if (i) {
|
|
2168
|
-
const
|
|
2169
|
-
this._updateDrawings(
|
|
2168
|
+
const e = n.getActiveSheet().getSheetId();
|
|
2169
|
+
this._updateDrawings(t, e);
|
|
2170
2170
|
} else
|
|
2171
|
-
this._clearDrawings(
|
|
2171
|
+
this._clearDrawings(t);
|
|
2172
2172
|
})
|
|
2173
2173
|
);
|
|
2174
2174
|
}
|
|
2175
2175
|
_clearDrawings(i) {
|
|
2176
2176
|
setTimeout(() => {
|
|
2177
|
-
const n = this._drawingManagerService.drawingManagerData,
|
|
2178
|
-
Object.keys(n).forEach((
|
|
2179
|
-
const r = n[
|
|
2177
|
+
const n = this._drawingManagerService.drawingManagerData, t = [];
|
|
2178
|
+
Object.keys(n).forEach((e) => {
|
|
2179
|
+
const r = n[e];
|
|
2180
2180
|
r != null && Object.keys(r).forEach((s) => {
|
|
2181
2181
|
const o = r[s].data;
|
|
2182
2182
|
o != null && Object.keys(o).forEach((a) => {
|
|
2183
|
-
|
|
2183
|
+
e === i && t.push(o[a]);
|
|
2184
2184
|
});
|
|
2185
2185
|
});
|
|
2186
|
-
}), this._drawingManagerService.removeNotification(
|
|
2186
|
+
}), this._drawingManagerService.removeNotification(t);
|
|
2187
2187
|
});
|
|
2188
2188
|
}
|
|
2189
2189
|
_updateDrawings(i, n) {
|
|
2190
2190
|
setTimeout(() => {
|
|
2191
|
-
const
|
|
2192
|
-
Object.keys(
|
|
2193
|
-
const o =
|
|
2191
|
+
const t = this._drawingManagerService.drawingManagerData, e = [], r = [];
|
|
2192
|
+
Object.keys(t).forEach((s) => {
|
|
2193
|
+
const o = t[s];
|
|
2194
2194
|
o != null && Object.keys(o).forEach((a) => {
|
|
2195
2195
|
const c = o[a].data;
|
|
2196
2196
|
c != null && Object.keys(c).forEach((u) => {
|
|
2197
2197
|
if (s === i && a === n) {
|
|
2198
2198
|
const d = c[u];
|
|
2199
|
-
d.transform = z(d.sheetTransform, this._selectionRenderService, this._skeletonManagerService),
|
|
2199
|
+
d.transform = z(d.sheetTransform, this._selectionRenderService, this._skeletonManagerService), e.push(c[u]);
|
|
2200
2200
|
} else
|
|
2201
2201
|
r.push(c[u]);
|
|
2202
2202
|
});
|
|
2203
2203
|
});
|
|
2204
|
-
}), this._drawingManagerService.removeNotification(r), this._drawingManagerService.addNotification(
|
|
2204
|
+
}), this._drawingManagerService.removeNotification(r), this._drawingManagerService.addNotification(e);
|
|
2205
2205
|
}, 0);
|
|
2206
2206
|
}
|
|
2207
2207
|
_sheetRefreshListener() {
|
|
2208
2208
|
this.disposeWithMe(
|
|
2209
2209
|
this._commandService.onCommandExecuted((i) => {
|
|
2210
2210
|
$s.includes(i.id) && requestIdleCallback(() => {
|
|
2211
|
-
const n = i.params, { unitId:
|
|
2212
|
-
this._refreshDrawingTransform(
|
|
2211
|
+
const n = i.params, { unitId: t, subUnitId: e, ranges: r } = n;
|
|
2212
|
+
this._refreshDrawingTransform(t, e, r);
|
|
2213
2213
|
});
|
|
2214
2214
|
})
|
|
2215
2215
|
);
|
|
2216
2216
|
}
|
|
2217
|
-
_refreshDrawingTransform(i, n,
|
|
2218
|
-
const
|
|
2219
|
-
Object.keys(
|
|
2220
|
-
const o =
|
|
2217
|
+
_refreshDrawingTransform(i, n, t) {
|
|
2218
|
+
const e = this._drawingManagerService.getDrawingData(i, n), r = [];
|
|
2219
|
+
Object.keys(e).forEach((s) => {
|
|
2220
|
+
const o = e[s], { sheetTransform: a, transform: c, anchorType: u = U.Position } = o;
|
|
2221
2221
|
if (u === U.None)
|
|
2222
2222
|
return !0;
|
|
2223
2223
|
const { from: d, to: l } = a, { row: g, column: h } = d, { row: f, column: p } = l;
|
|
2224
|
-
for (let m = 0; m <
|
|
2225
|
-
const w =
|
|
2224
|
+
for (let m = 0; m < t.length; m++) {
|
|
2225
|
+
const w = t[m], { startRow: S, endRow: C, startColumn: D, endColumn: v } = w;
|
|
2226
2226
|
if (Xr.intersects(
|
|
2227
2227
|
{
|
|
2228
2228
|
startRow: S,
|
|
@@ -2264,41 +2264,44 @@ an = Ws([
|
|
|
2264
2264
|
], an);
|
|
2265
2265
|
var se = function() {
|
|
2266
2266
|
return se = Object.assign || function(i) {
|
|
2267
|
-
for (var n,
|
|
2268
|
-
n = arguments[
|
|
2267
|
+
for (var n, t = 1, e = arguments.length; t < e; t++) {
|
|
2268
|
+
n = arguments[t];
|
|
2269
2269
|
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (i[r] = n[r]);
|
|
2270
2270
|
}
|
|
2271
2271
|
return i;
|
|
2272
2272
|
}, se.apply(this, arguments);
|
|
2273
2273
|
}, xs = function(i, n) {
|
|
2274
|
-
var
|
|
2275
|
-
for (var
|
|
2274
|
+
var t = {};
|
|
2275
|
+
for (var e in i) Object.prototype.hasOwnProperty.call(i, e) && n.indexOf(e) < 0 && (t[e] = i[e]);
|
|
2276
2276
|
if (i != null && typeof Object.getOwnPropertySymbols == "function")
|
|
2277
|
-
for (var r = 0,
|
|
2278
|
-
n.indexOf(
|
|
2279
|
-
return
|
|
2277
|
+
for (var r = 0, e = Object.getOwnPropertySymbols(i); r < e.length; r++)
|
|
2278
|
+
n.indexOf(e[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, e[r]) && (t[e[r]] = i[e[r]]);
|
|
2279
|
+
return t;
|
|
2280
2280
|
}, _r = cr(function(i, n) {
|
|
2281
|
-
var
|
|
2282
|
-
return vr(
|
|
2281
|
+
var t = i.icon, e = i.id, r = i.className, s = i.extend, o = xs(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(e, " ").concat(r || "").trim(), c = ns("_".concat(Ys()));
|
|
2282
|
+
return vr(t, "".concat(e), { defIds: t.defIds, idSuffix: c.current }, se({ ref: n, className: a }, o), s);
|
|
2283
2283
|
});
|
|
2284
|
-
function vr(i, n,
|
|
2285
|
-
return dr(i.tag, se(se({ key: n }, Ls(i,
|
|
2286
|
-
return vr(s, "".concat(n, "-").concat(i.tag, "-").concat(o),
|
|
2284
|
+
function vr(i, n, t, e, r) {
|
|
2285
|
+
return dr(i.tag, se(se({ key: n }, Ls(i, t, r)), e), (Fs(i, t).children || []).map(function(s, o) {
|
|
2286
|
+
return vr(s, "".concat(n, "-").concat(i.tag, "-").concat(o), t, void 0, r);
|
|
2287
2287
|
}));
|
|
2288
2288
|
}
|
|
2289
|
-
function Ls(i, n,
|
|
2290
|
-
var
|
|
2291
|
-
|
|
2289
|
+
function Ls(i, n, t) {
|
|
2290
|
+
var e = se({}, i.attrs);
|
|
2291
|
+
t != null && t.colorChannel1 && e.fill === "colorChannel1" && (e.fill = t.colorChannel1), i.tag === "mask" && e.id && (e.id = e.id + n.idSuffix), Object.entries(e).forEach(function(s) {
|
|
2292
|
+
var o = s[0], a = s[1];
|
|
2293
|
+
o === "mask" && typeof a == "string" && (e[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
|
|
2294
|
+
});
|
|
2292
2295
|
var r = n.defIds;
|
|
2293
|
-
return !r || r.length === 0 || (i.tag === "use" &&
|
|
2296
|
+
return !r || r.length === 0 || (i.tag === "use" && e["xlink:href"] && (e["xlink:href"] = e["xlink:href"] + n.idSuffix), Object.entries(e).forEach(function(s) {
|
|
2294
2297
|
var o = s[0], a = s[1];
|
|
2295
|
-
typeof a == "string" && (
|
|
2296
|
-
})),
|
|
2298
|
+
typeof a == "string" && (e[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
|
|
2299
|
+
})), e;
|
|
2297
2300
|
}
|
|
2298
2301
|
function Fs(i, n) {
|
|
2299
|
-
var
|
|
2300
|
-
return !
|
|
2301
|
-
return typeof r.attrs.id == "string" &&
|
|
2302
|
+
var t, e = n.defIds;
|
|
2303
|
+
return !e || e.length === 0 ? i : i.tag === "defs" && (!((t = i.children) === null || t === void 0) && t.length) ? se(se({}, i), { children: i.children.map(function(r) {
|
|
2304
|
+
return typeof r.attrs.id == "string" && e && e.indexOf(r.attrs.id) > -1 ? se(se({}, r), { attrs: se(se({}, r.attrs), { id: r.attrs.id + n.idSuffix }) }) : r;
|
|
2302
2305
|
}) }) : i;
|
|
2303
2306
|
}
|
|
2304
2307
|
function Ys() {
|
|
@@ -2317,10 +2320,10 @@ const Ir = {
|
|
|
2317
2320
|
id: "sheet.command.delete-drawing",
|
|
2318
2321
|
type: te.COMMAND,
|
|
2319
2322
|
handler: (i) => {
|
|
2320
|
-
const n = i.get(G),
|
|
2321
|
-
if (
|
|
2323
|
+
const n = i.get(G), e = i.get(ae).getFocusDrawings();
|
|
2324
|
+
if (e.length === 0)
|
|
2322
2325
|
return !1;
|
|
2323
|
-
const r =
|
|
2326
|
+
const r = e[0].unitId, s = e.map((o) => {
|
|
2324
2327
|
const { unitId: a, subUnitId: c, drawingId: u, drawingType: d } = o;
|
|
2325
2328
|
return {
|
|
2326
2329
|
unitId: a,
|
|
@@ -2338,7 +2341,7 @@ const Ir = {
|
|
|
2338
2341
|
id: "sheet.command.move-drawing",
|
|
2339
2342
|
type: te.COMMAND,
|
|
2340
2343
|
handler: (i, n) => {
|
|
2341
|
-
const
|
|
2344
|
+
const t = i.get(G), e = i.get(ae), r = i.get(Xe), { direction: s } = n, o = e.getFocusDrawings();
|
|
2342
2345
|
if (o.length === 0)
|
|
2343
2346
|
return !1;
|
|
2344
2347
|
const a = o[0].unitId, c = o.map((d) => {
|
|
@@ -2352,10 +2355,10 @@ const Ir = {
|
|
|
2352
2355
|
sheetTransform: $(g, r)
|
|
2353
2356
|
};
|
|
2354
2357
|
}).filter((d) => d != null);
|
|
2355
|
-
return
|
|
2358
|
+
return t.syncExecuteCommand(Yt.id, {
|
|
2356
2359
|
unitId: a,
|
|
2357
2360
|
drawings: c
|
|
2358
|
-
}) ? (
|
|
2361
|
+
}) ? (t.syncExecuteCommand(x.id, [a]), !0) : !1;
|
|
2359
2362
|
}
|
|
2360
2363
|
}, Cr = "addition-and-subtraction-single", br = "sheet.menu.image";
|
|
2361
2364
|
function Xs(i) {
|
|
@@ -2392,21 +2395,21 @@ const zs = "univer-image-common-panel", Ks = "univer-image-common-panel-grid", Z
|
|
|
2392
2395
|
imageCommonPanelColumn: Qs
|
|
2393
2396
|
};
|
|
2394
2397
|
function Rr(i) {
|
|
2395
|
-
var n,
|
|
2396
|
-
if (typeof i == "string" || typeof i == "number")
|
|
2398
|
+
var n, t, e = "";
|
|
2399
|
+
if (typeof i == "string" || typeof i == "number") e += i;
|
|
2397
2400
|
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
2398
2401
|
var r = i.length;
|
|
2399
|
-
for (n = 0; n < r; n++) i[n] && (
|
|
2400
|
-
} else for (
|
|
2401
|
-
return
|
|
2402
|
+
for (n = 0; n < r; n++) i[n] && (t = Rr(i[n])) && (e && (e += " "), e += t);
|
|
2403
|
+
} else for (t in i) i[t] && (e && (e += " "), e += t);
|
|
2404
|
+
return e;
|
|
2402
2405
|
}
|
|
2403
2406
|
function Dt() {
|
|
2404
|
-
for (var i, n,
|
|
2405
|
-
return
|
|
2407
|
+
for (var i, n, t = 0, e = "", r = arguments.length; t < r; t++) (i = arguments[t]) && (n = Rr(i)) && (e && (e += " "), e += n);
|
|
2408
|
+
return e;
|
|
2406
2409
|
}
|
|
2407
2410
|
const eo = (i) => {
|
|
2408
2411
|
var C;
|
|
2409
|
-
const n = Te(G),
|
|
2412
|
+
const n = Te(G), t = Te($t), e = Te(oe), r = Te(ne), { drawings: s } = i, o = s[0];
|
|
2410
2413
|
if (o == null)
|
|
2411
2414
|
return;
|
|
2412
2415
|
const { unitId: a } = o, c = r.getRenderById(a), u = c == null ? void 0 : c.scene;
|
|
@@ -2435,7 +2438,7 @@ const eo = (i) => {
|
|
|
2435
2438
|
b === !0 && g(!1);
|
|
2436
2439
|
}), v = d.changeStart$.subscribe((b) => {
|
|
2437
2440
|
var M;
|
|
2438
|
-
const { objects: _ } = b, E = m(_,
|
|
2441
|
+
const { objects: _ } = b, E = m(_, e);
|
|
2439
2442
|
if (E.length === 0)
|
|
2440
2443
|
g(!1);
|
|
2441
2444
|
else if (E.length >= 1) {
|
|
@@ -2450,7 +2453,7 @@ const eo = (i) => {
|
|
|
2450
2453
|
}, []);
|
|
2451
2454
|
function w(D) {
|
|
2452
2455
|
p(D);
|
|
2453
|
-
const v =
|
|
2456
|
+
const v = e.getFocusDrawings();
|
|
2454
2457
|
if (v.length === 0)
|
|
2455
2458
|
return;
|
|
2456
2459
|
const b = v.map((_) => ({
|
|
@@ -2466,25 +2469,25 @@ const eo = (i) => {
|
|
|
2466
2469
|
}
|
|
2467
2470
|
const S = (D) => D ? "block" : "none";
|
|
2468
2471
|
return /* @__PURE__ */ Tt("div", { className: Dt(ve.imageCommonPanelGrid, ve.imageCommonPanelBorder), style: { display: S(l) }, children: [
|
|
2469
|
-
/* @__PURE__ */ ee("div", { className: ve.imageCommonPanelRow, children: /* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelColumn, ve.imageCommonPanelTitle), children: /* @__PURE__ */ ee("div", { children:
|
|
2472
|
+
/* @__PURE__ */ ee("div", { className: ve.imageCommonPanelRow, children: /* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelColumn, ve.imageCommonPanelTitle), children: /* @__PURE__ */ ee("div", { children: t.t("drawing-anchor.title") }) }) }),
|
|
2470
2473
|
/* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelRow), children: /* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelColumn), children: /* @__PURE__ */ Tt(ss, { value: f, onChange: w, direction: "vertical", children: [
|
|
2471
|
-
/* @__PURE__ */ ee(Jt, { value: U.Both, children:
|
|
2472
|
-
/* @__PURE__ */ ee(Jt, { value: U.Position, children:
|
|
2473
|
-
/* @__PURE__ */ ee(Jt, { value: U.None, children:
|
|
2474
|
+
/* @__PURE__ */ ee(Jt, { value: U.Both, children: t.t("drawing-anchor.both") }),
|
|
2475
|
+
/* @__PURE__ */ ee(Jt, { value: U.Position, children: t.t("drawing-anchor.position") }),
|
|
2476
|
+
/* @__PURE__ */ ee(Jt, { value: U.None, children: t.t("drawing-anchor.none") })
|
|
2474
2477
|
] }) }) })
|
|
2475
2478
|
] });
|
|
2476
2479
|
}, to = () => {
|
|
2477
|
-
const i = Te(oe), n = i.getFocusDrawings(), [
|
|
2480
|
+
const i = Te(oe), n = i.getFocusDrawings(), [t, e] = rn(n);
|
|
2478
2481
|
return ln(() => {
|
|
2479
2482
|
const r = i.focus$.subscribe((s) => {
|
|
2480
|
-
|
|
2483
|
+
e(s);
|
|
2481
2484
|
});
|
|
2482
2485
|
return () => {
|
|
2483
2486
|
r.unsubscribe();
|
|
2484
2487
|
};
|
|
2485
|
-
}, []), !!(
|
|
2486
|
-
/* @__PURE__ */ ee(ui, { drawings:
|
|
2487
|
-
/* @__PURE__ */ ee(eo, { drawings:
|
|
2488
|
+
}, []), !!(t != null && t.length) && /* @__PURE__ */ Tt("div", { className: ve.imageCommonPanel, children: [
|
|
2489
|
+
/* @__PURE__ */ ee(ui, { drawings: t }),
|
|
2490
|
+
/* @__PURE__ */ ee(eo, { drawings: t })
|
|
2488
2491
|
] });
|
|
2489
2492
|
}, no = {
|
|
2490
2493
|
[Ai.FORMULAS_INSERT]: {
|
|
@@ -2554,14 +2557,14 @@ const ro = {
|
|
|
2554
2557
|
binding: Fe.DELETE,
|
|
2555
2558
|
mac: Fe.BACKSPACE
|
|
2556
2559
|
};
|
|
2557
|
-
var co = Object.getOwnPropertyDescriptor, lo = (i, n,
|
|
2558
|
-
for (var r =
|
|
2560
|
+
var co = Object.getOwnPropertyDescriptor, lo = (i, n, t, e) => {
|
|
2561
|
+
for (var r = e > 1 ? void 0 : e ? co(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
2559
2562
|
(o = i[s]) && (r = o(r) || r);
|
|
2560
2563
|
return r;
|
|
2561
|
-
}, $e = (i, n) => (
|
|
2564
|
+
}, $e = (i, n) => (t, e) => n(t, e, i);
|
|
2562
2565
|
let Bt = class extends le {
|
|
2563
|
-
constructor(i, n,
|
|
2564
|
-
super(), this._componentManager = i, this._menuManagerService = n, this._commandService =
|
|
2566
|
+
constructor(i, n, t, e, r, s) {
|
|
2567
|
+
super(), this._componentManager = i, this._menuManagerService = n, this._commandService = t, this._shortcutService = e, this._drawingManagerService = r, this._sheetsSelectionsService = s, this._init();
|
|
2565
2568
|
}
|
|
2566
2569
|
_initCustomComponents() {
|
|
2567
2570
|
const i = this._componentManager;
|
|
@@ -2611,13 +2614,13 @@ Bt = lo([
|
|
|
2611
2614
|
$e(4, oe),
|
|
2612
2615
|
$e(5, N(dn))
|
|
2613
2616
|
], Bt);
|
|
2614
|
-
var uo = Object.getOwnPropertyDescriptor, ho = (i, n,
|
|
2615
|
-
for (var r =
|
|
2617
|
+
var uo = Object.getOwnPropertyDescriptor, ho = (i, n, t, e) => {
|
|
2618
|
+
for (var r = e > 1 ? void 0 : e ? uo(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
2616
2619
|
(o = i[s]) && (r = o(r) || r);
|
|
2617
2620
|
return r;
|
|
2618
|
-
}, Me = (i, n) => (
|
|
2619
|
-
function go(i, n,
|
|
2620
|
-
const { scaleX: s, scaleY: o } = n.getAncestorScale(), a = n.getViewport($n.VIEW_MAIN), c =
|
|
2621
|
+
}, Me = (i, n) => (t, e) => n(t, e, i);
|
|
2622
|
+
function go(i, n, t, e, r) {
|
|
2623
|
+
const { scaleX: s, scaleY: o } = n.getAncestorScale(), a = n.getViewport($n.VIEW_MAIN), c = e.getFreeze(), { startColumn: u, startRow: d, xSplit: l, ySplit: g } = c, h = {
|
|
2621
2624
|
left: !0,
|
|
2622
2625
|
// left means the left of pic is in a viewMainLeft
|
|
2623
2626
|
top: !0
|
|
@@ -2629,13 +2632,13 @@ function go(i, n, e, t, r) {
|
|
|
2629
2632
|
};
|
|
2630
2633
|
const { left: f, right: p, top: m, bottom: w } = i;
|
|
2631
2634
|
let { top: S, left: C, viewportScrollX: D, viewportScrollY: v } = a;
|
|
2632
|
-
const { boundsOfViewArea: b, scrollDirectionResponse: _ } = r || {}, { rowHeaderWidth: E, columnHeaderHeight: M } =
|
|
2635
|
+
const { boundsOfViewArea: b, scrollDirectionResponse: _ } = r || {}, { rowHeaderWidth: E, columnHeaderHeight: M } = t, y = {
|
|
2633
2636
|
top: M,
|
|
2634
2637
|
left: E
|
|
2635
2638
|
};
|
|
2636
2639
|
b && (ye.isDefine(y.top) && (y.top = b.top), ye.isDefine(y.left) && (y.left = b.left)), _ === "HORIZONTAL" && (v = 0), _ === "VERTICAL" && (D = 0);
|
|
2637
2640
|
let T = 0, I = 0;
|
|
2638
|
-
const R =
|
|
2641
|
+
const R = t.rowStartY(d - g) + M, O = t.colStartX(u - l) + E, B = t.rowStartY(d) + M, K = t.colStartX(u) + E;
|
|
2639
2642
|
if (l === 0)
|
|
2640
2643
|
h.left = !1, T = (f - D) * s, I = (p - D) * s;
|
|
2641
2644
|
else {
|
|
@@ -2657,13 +2660,13 @@ function go(i, n, e, t, r) {
|
|
|
2657
2660
|
absolute: h
|
|
2658
2661
|
};
|
|
2659
2662
|
}
|
|
2660
|
-
const fe = (i, n,
|
|
2663
|
+
const fe = (i, n, t, e, r) => {
|
|
2661
2664
|
const { scene: s } = n, { left: o, top: a, width: c, height: u, angle: d } = i, l = {
|
|
2662
2665
|
left: o,
|
|
2663
2666
|
right: o + c,
|
|
2664
2667
|
top: a,
|
|
2665
2668
|
bottom: a + u
|
|
2666
|
-
}, g = go(l, s,
|
|
2669
|
+
}, g = go(l, s, t, e, r), { scaleX: h, scaleY: f } = s.getAncestorScale();
|
|
2667
2670
|
return {
|
|
2668
2671
|
startX: g.left,
|
|
2669
2672
|
endX: g.right,
|
|
@@ -2676,7 +2679,7 @@ const fe = (i, n, e, t, r) => {
|
|
|
2676
2679
|
};
|
|
2677
2680
|
};
|
|
2678
2681
|
let Wt = class extends le {
|
|
2679
|
-
constructor(n,
|
|
2682
|
+
constructor(n, t, e, r, s, o, a) {
|
|
2680
2683
|
super();
|
|
2681
2684
|
/**
|
|
2682
2685
|
* for update dom container position when scrolling and zoom
|
|
@@ -2693,7 +2696,7 @@ let Wt = class extends le {
|
|
|
2693
2696
|
Q(this, "_remove$", new Zt());
|
|
2694
2697
|
Q(this, "remove$", this._remove$.asObservable());
|
|
2695
2698
|
Q(this, "_hooks", []);
|
|
2696
|
-
this._renderManagerService = n, this._univerInstanceService =
|
|
2699
|
+
this._renderManagerService = n, this._univerInstanceService = t, this._commandService = e, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = a, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
|
|
2697
2700
|
}
|
|
2698
2701
|
_bindScrollEvent() {
|
|
2699
2702
|
this._lifecycleService.lifecycle$.pipe(ji((n) => n === Zr.Rendered), $i(1)).subscribe(() => {
|
|
@@ -2705,11 +2708,11 @@ let Wt = class extends le {
|
|
|
2705
2708
|
* @param unitId
|
|
2706
2709
|
* @param subUnitId
|
|
2707
2710
|
*/
|
|
2708
|
-
_ensureMap(n,
|
|
2709
|
-
let
|
|
2710
|
-
|
|
2711
|
-
let r =
|
|
2712
|
-
return r || (r = /* @__PURE__ */ new Map(),
|
|
2711
|
+
_ensureMap(n, t) {
|
|
2712
|
+
let e = this._domLayerMap.get(n);
|
|
2713
|
+
e || (e = /* @__PURE__ */ new Map(), this._domLayerMap.set(n, e));
|
|
2714
|
+
let r = e.get(t);
|
|
2715
|
+
return r || (r = /* @__PURE__ */ new Map(), e.set(t, r)), r;
|
|
2713
2716
|
}
|
|
2714
2717
|
getFloatDomInfo(n) {
|
|
2715
2718
|
return this._domLayerInfoMap.get(n);
|
|
@@ -2717,36 +2720,36 @@ let Wt = class extends le {
|
|
|
2717
2720
|
_getSceneAndTransformerByDrawingSearch(n) {
|
|
2718
2721
|
if (n == null)
|
|
2719
2722
|
return;
|
|
2720
|
-
const
|
|
2721
|
-
if (
|
|
2723
|
+
const t = this._renderManagerService.getRenderById(n), e = t == null ? void 0 : t.scene;
|
|
2724
|
+
if (t == null || e == null)
|
|
2722
2725
|
return null;
|
|
2723
|
-
const r =
|
|
2724
|
-
return { scene:
|
|
2726
|
+
const r = e.getTransformerByCreate(), s = t.engine.getCanvasElement();
|
|
2727
|
+
return { scene: e, transformer: r, renderUnit: t, canvas: s };
|
|
2725
2728
|
}
|
|
2726
2729
|
_getFloatDomProps(n) {
|
|
2727
|
-
let
|
|
2728
|
-
return this._hooks.forEach((
|
|
2729
|
-
|
|
2730
|
-
}),
|
|
2730
|
+
let t;
|
|
2731
|
+
return this._hooks.forEach((e) => {
|
|
2732
|
+
t = e.onGetFloatDomProps(n);
|
|
2733
|
+
}), t;
|
|
2731
2734
|
}
|
|
2732
2735
|
_drawingAddListener() {
|
|
2733
2736
|
this.disposeWithMe(
|
|
2734
2737
|
this._drawingManagerService.add$.subscribe((n) => {
|
|
2735
|
-
n.forEach((
|
|
2738
|
+
n.forEach((t) => {
|
|
2736
2739
|
var J, ce, q;
|
|
2737
|
-
const { unitId:
|
|
2740
|
+
const { unitId: e, subUnitId: r, drawingId: s } = t, o = H(this._univerInstanceService, { unitId: e, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(t), c = this._univerInstanceService.getUnit(e, F.UNIVER_SHEET);
|
|
2738
2741
|
if (!c)
|
|
2739
2742
|
return;
|
|
2740
2743
|
const u = c.getActiveSheet().getSheetId();
|
|
2741
2744
|
if (!a || !o)
|
|
2742
2745
|
return;
|
|
2743
|
-
const d = (J = this._renderManagerService.getRenderById(
|
|
2746
|
+
const d = (J = this._renderManagerService.getRenderById(e)) == null ? void 0 : J.with(V).getSkeletonParam(r);
|
|
2744
2747
|
if (!d)
|
|
2745
2748
|
return;
|
|
2746
2749
|
const { transform: l, drawingType: g, data: h } = a;
|
|
2747
2750
|
if (g !== L.DRAWING_DOM && g !== L.DRAWING_CHART)
|
|
2748
2751
|
return;
|
|
2749
|
-
const f = this._getSceneAndTransformerByDrawingSearch(
|
|
2752
|
+
const f = this._getSceneAndTransformerByDrawingSearch(e);
|
|
2750
2753
|
if (f == null)
|
|
2751
2754
|
return;
|
|
2752
2755
|
const { scene: p, canvas: m } = f;
|
|
@@ -2754,7 +2757,7 @@ let Wt = class extends le {
|
|
|
2754
2757
|
return !0;
|
|
2755
2758
|
if (u !== r)
|
|
2756
2759
|
return;
|
|
2757
|
-
const { left: w, top: S, width: C, height: D, angle: v, flipX: b, flipY: _, skewX: E, skewY: M } = l, y = Ce({ unitId:
|
|
2760
|
+
const { left: w, top: S, width: C, height: D, angle: v, flipX: b, flipY: _, skewX: E, skewY: M } = l, y = Ce({ unitId: e, subUnitId: r, drawingId: s }), T = p.getObject(y);
|
|
2758
2761
|
if (T != null) {
|
|
2759
2762
|
T.transformByState({ left: w, top: S, width: C, height: D, angle: v, flipX: b, flipY: _, skewX: E, skewY: M });
|
|
2760
2763
|
return;
|
|
@@ -2764,7 +2767,7 @@ let Wt = class extends le {
|
|
|
2764
2767
|
top: S,
|
|
2765
2768
|
width: C,
|
|
2766
2769
|
height: D,
|
|
2767
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2770
|
+
zIndex: this._drawingManagerService.getDrawingOrder(e, r).length - 1
|
|
2768
2771
|
}, R = g === L.DRAWING_CHART;
|
|
2769
2772
|
if (R) {
|
|
2770
2773
|
const W = h ? h.backgroundColor : "white";
|
|
@@ -2772,11 +2775,11 @@ let Wt = class extends le {
|
|
|
2772
2775
|
}
|
|
2773
2776
|
const O = new je(y, I);
|
|
2774
2777
|
R && O.setObjectType(bn.CHART), p.addObject(O, Kt), a.allowTransform !== !1 && p.attachTransformerTo(O);
|
|
2775
|
-
const B = this._ensureMap(
|
|
2778
|
+
const B = this._ensureMap(e, r), K = new _t(), Z = fe(O, f.renderUnit, d.skeleton, o.worksheet), Y = new Ze(Z), me = {
|
|
2776
2779
|
dispose: K,
|
|
2777
2780
|
rect: O,
|
|
2778
2781
|
position$: Y,
|
|
2779
|
-
unitId:
|
|
2782
|
+
unitId: e,
|
|
2780
2783
|
subUnitId: r
|
|
2781
2784
|
};
|
|
2782
2785
|
this._canvasFloatDomService.addFloatDom({
|
|
@@ -2797,7 +2800,7 @@ let Wt = class extends le {
|
|
|
2797
2800
|
},
|
|
2798
2801
|
props: (q = (ce = B.get(s)) == null ? void 0 : ce.props) != null ? q : this._getFloatDomProps(s),
|
|
2799
2802
|
data: h,
|
|
2800
|
-
unitId:
|
|
2803
|
+
unitId: e
|
|
2801
2804
|
});
|
|
2802
2805
|
const X = O.onTransformChange$.subscribeEvent(() => {
|
|
2803
2806
|
const W = fe(O, f.renderUnit, d.skeleton, o.worksheet);
|
|
@@ -2814,8 +2817,8 @@ let Wt = class extends le {
|
|
|
2814
2817
|
})
|
|
2815
2818
|
), this.disposeWithMe(
|
|
2816
2819
|
this._drawingManagerService.remove$.subscribe((n) => {
|
|
2817
|
-
n.forEach((
|
|
2818
|
-
const { unitId:
|
|
2820
|
+
n.forEach((t) => {
|
|
2821
|
+
const { unitId: e, subUnitId: r, drawingId: s } = t, o = Ce({ unitId: e, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(e);
|
|
2819
2822
|
if (a == null)
|
|
2820
2823
|
return;
|
|
2821
2824
|
const { transformer: c, scene: u } = a, d = u.getObject(o);
|
|
@@ -2825,9 +2828,9 @@ let Wt = class extends le {
|
|
|
2825
2828
|
);
|
|
2826
2829
|
}
|
|
2827
2830
|
_scrollUpdateListener() {
|
|
2828
|
-
const n = (
|
|
2831
|
+
const n = (t, e) => {
|
|
2829
2832
|
var u;
|
|
2830
|
-
const r = this._getSceneAndTransformerByDrawingSearch(
|
|
2833
|
+
const r = this._getSceneAndTransformerByDrawingSearch(t), s = this._ensureMap(t, e), o = Array.from(s.keys()), a = H(this._univerInstanceService, { unitId: t, subUnitId: e }), c = (u = this._renderManagerService.getRenderById(t)) == null ? void 0 : u.with(V).getSkeletonParam(e);
|
|
2831
2834
|
!r || !a || !c || o.forEach((d) => {
|
|
2832
2835
|
const l = this._domLayerInfoMap.get(d);
|
|
2833
2836
|
if (l) {
|
|
@@ -2838,44 +2841,44 @@ let Wt = class extends le {
|
|
|
2838
2841
|
};
|
|
2839
2842
|
this.disposeWithMe(
|
|
2840
2843
|
this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(
|
|
2841
|
-
Se((
|
|
2842
|
-
Ee((
|
|
2843
|
-
if (!
|
|
2844
|
-
const
|
|
2845
|
-
return r ? { render: r, unitId:
|
|
2844
|
+
Se((t) => t ? t.activeSheet$ : En(null)),
|
|
2845
|
+
Ee((t) => {
|
|
2846
|
+
if (!t) return null;
|
|
2847
|
+
const e = t.getUnitId(), r = this._renderManagerService.getRenderById(e);
|
|
2848
|
+
return r ? { render: r, unitId: e, subUnitId: t.getSheetId() } : null;
|
|
2846
2849
|
}),
|
|
2847
2850
|
Se(
|
|
2848
|
-
(
|
|
2851
|
+
(t) => t ? Jr(t.render.scene.getViewport($n.VIEW_MAIN).onScrollAfter$).pipe(Ee(() => ({ unitId: t.unitId, subUnitId: t.subUnitId }))) : En(null)
|
|
2849
2852
|
)
|
|
2850
|
-
).subscribe((
|
|
2851
|
-
if (!
|
|
2852
|
-
const { unitId:
|
|
2853
|
-
n(
|
|
2853
|
+
).subscribe((t) => {
|
|
2854
|
+
if (!t) return;
|
|
2855
|
+
const { unitId: e, subUnitId: r } = t;
|
|
2856
|
+
n(e, r);
|
|
2854
2857
|
})
|
|
2855
|
-
), this.disposeWithMe(this._commandService.onCommandExecuted((
|
|
2856
|
-
var
|
|
2857
|
-
if (
|
|
2858
|
-
const s =
|
|
2859
|
-
Array.from((r = (
|
|
2858
|
+
), this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
|
|
2859
|
+
var e, r;
|
|
2860
|
+
if (t.id === Dn.id) {
|
|
2861
|
+
const s = t.params, { unitId: o } = s;
|
|
2862
|
+
Array.from((r = (e = this._domLayerMap.get(o)) == null ? void 0 : e.keys()) != null ? r : []).forEach((c) => {
|
|
2860
2863
|
n(o, c);
|
|
2861
2864
|
});
|
|
2862
|
-
} else if (
|
|
2863
|
-
const { unitId: s, subUnitId: o } =
|
|
2865
|
+
} else if (t.id === Qi.id) {
|
|
2866
|
+
const { unitId: s, subUnitId: o } = t.params;
|
|
2864
2867
|
n(s, o);
|
|
2865
2868
|
}
|
|
2866
2869
|
}));
|
|
2867
2870
|
}
|
|
2868
|
-
_getPosition(n,
|
|
2871
|
+
_getPosition(n, t) {
|
|
2869
2872
|
var g;
|
|
2870
|
-
const { startX:
|
|
2873
|
+
const { startX: e, endX: r, startY: s, endY: o } = n, a = (g = this._renderManagerService.getRenderById(t)) == null ? void 0 : g.with(Xe);
|
|
2871
2874
|
if (a == null)
|
|
2872
2875
|
return;
|
|
2873
|
-
const c = a.getCellWithCoordByOffset(
|
|
2876
|
+
const c = a.getCellWithCoordByOffset(e, s);
|
|
2874
2877
|
if (c == null)
|
|
2875
2878
|
return;
|
|
2876
2879
|
const u = {
|
|
2877
2880
|
column: c.actualColumn,
|
|
2878
|
-
columnOffset:
|
|
2881
|
+
columnOffset: e - c.startX,
|
|
2879
2882
|
row: c.actualRow,
|
|
2880
2883
|
rowOffset: s - c.startY
|
|
2881
2884
|
}, d = a.getCellWithCoordByOffset(r, o);
|
|
@@ -2895,14 +2898,14 @@ let Wt = class extends le {
|
|
|
2895
2898
|
_featureUpdateListener() {
|
|
2896
2899
|
this.disposeWithMe(
|
|
2897
2900
|
this._drawingManagerService.update$.subscribe((n) => {
|
|
2898
|
-
n.forEach((
|
|
2899
|
-
const
|
|
2900
|
-
if (!
|
|
2901
|
+
n.forEach((t) => {
|
|
2902
|
+
const e = this._drawingManagerService.getDrawingByParam(t);
|
|
2903
|
+
if (!e || e.drawingType !== L.DRAWING_DOM && e.drawingType !== L.DRAWING_CHART)
|
|
2901
2904
|
return;
|
|
2902
2905
|
const r = {
|
|
2903
|
-
...
|
|
2906
|
+
...e.transform
|
|
2904
2907
|
};
|
|
2905
|
-
this._transformChange$.next({ id:
|
|
2908
|
+
this._transformChange$.next({ id: t.drawingId, value: r });
|
|
2906
2909
|
});
|
|
2907
2910
|
})
|
|
2908
2911
|
);
|
|
@@ -2910,28 +2913,28 @@ let Wt = class extends le {
|
|
|
2910
2913
|
_deleteListener() {
|
|
2911
2914
|
this.disposeWithMe(
|
|
2912
2915
|
this._drawingManagerService.remove$.subscribe((n) => {
|
|
2913
|
-
n.forEach((
|
|
2914
|
-
this._removeDom(
|
|
2916
|
+
n.forEach((t) => {
|
|
2917
|
+
this._removeDom(t.drawingId);
|
|
2915
2918
|
});
|
|
2916
2919
|
})
|
|
2917
2920
|
);
|
|
2918
2921
|
}
|
|
2919
|
-
updateFloatDomProps(n,
|
|
2920
|
-
const s = this._domLayerInfoMap.get(
|
|
2922
|
+
updateFloatDomProps(n, t, e, r) {
|
|
2923
|
+
const s = this._domLayerInfoMap.get(e), o = this._getSceneAndTransformerByDrawingSearch(n);
|
|
2921
2924
|
if (s && o) {
|
|
2922
|
-
const { scene: a } = o, c = Ce({ unitId: n, subUnitId:
|
|
2925
|
+
const { scene: a } = o, c = Ce({ unitId: n, subUnitId: t, drawingId: e }), u = a.getObject(c);
|
|
2923
2926
|
u && u instanceof je && u.setProps(r);
|
|
2924
2927
|
}
|
|
2925
2928
|
}
|
|
2926
2929
|
// CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
|
|
2927
|
-
addFloatDomToPosition(n,
|
|
2928
|
-
const
|
|
2930
|
+
addFloatDomToPosition(n, t) {
|
|
2931
|
+
const e = H(this._univerInstanceService, {
|
|
2929
2932
|
unitId: n.unitId,
|
|
2930
2933
|
subUnitId: n.subUnitId
|
|
2931
2934
|
});
|
|
2932
|
-
if (!
|
|
2935
|
+
if (!e)
|
|
2933
2936
|
throw new Error("cannot find current target!");
|
|
2934
|
-
const { unitId: r, subUnitId: s } =
|
|
2937
|
+
const { unitId: r, subUnitId: s } = e, { initPosition: o, componentKey: a, data: c, allowTransform: u = !0 } = n, d = t != null ? t : Ht(), l = this._getPosition(o, r);
|
|
2935
2938
|
if (l == null)
|
|
2936
2939
|
return;
|
|
2937
2940
|
this._ensureMap(r, s).set(d, n);
|
|
@@ -2961,14 +2964,14 @@ let Wt = class extends le {
|
|
|
2961
2964
|
}
|
|
2962
2965
|
};
|
|
2963
2966
|
}
|
|
2964
|
-
_removeDom(n,
|
|
2965
|
-
const
|
|
2966
|
-
if (!
|
|
2967
|
+
_removeDom(n, t = !1) {
|
|
2968
|
+
const e = this._domLayerInfoMap.get(n);
|
|
2969
|
+
if (!e)
|
|
2967
2970
|
return;
|
|
2968
|
-
const { unitId: r, subUnitId: s } =
|
|
2969
|
-
this._domLayerInfoMap.delete(n),
|
|
2971
|
+
const { unitId: r, subUnitId: s } = e;
|
|
2972
|
+
this._domLayerInfoMap.delete(n), e.dispose.dispose();
|
|
2970
2973
|
const o = this._getSceneAndTransformerByDrawingSearch(r);
|
|
2971
|
-
if (o && o.scene.removeObject(
|
|
2974
|
+
if (o && o.scene.removeObject(e.rect), t) {
|
|
2972
2975
|
this._ensureMap(r, s).delete(n);
|
|
2973
2976
|
const c = this._drawingManagerService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: n });
|
|
2974
2977
|
if (!c)
|
|
@@ -2980,17 +2983,17 @@ let Wt = class extends le {
|
|
|
2980
2983
|
addHook(n) {
|
|
2981
2984
|
return this._hooks.push(n), {
|
|
2982
2985
|
dispose: () => {
|
|
2983
|
-
const
|
|
2984
|
-
this._hooks.splice(
|
|
2986
|
+
const t = this._hooks.findIndex((e) => e === n);
|
|
2987
|
+
this._hooks.splice(t, 1);
|
|
2985
2988
|
}
|
|
2986
2989
|
};
|
|
2987
2990
|
}
|
|
2988
2991
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
2989
|
-
addFloatDomToRange(n,
|
|
2992
|
+
addFloatDomToRange(n, t, e, r) {
|
|
2990
2993
|
var _, E, M, y, T;
|
|
2991
2994
|
const s = H(this._univerInstanceService, {
|
|
2992
|
-
unitId:
|
|
2993
|
-
subUnitId:
|
|
2995
|
+
unitId: t.unitId,
|
|
2996
|
+
subUnitId: t.subUnitId
|
|
2994
2997
|
});
|
|
2995
2998
|
if (!s)
|
|
2996
2999
|
throw new Error("cannot find current target!");
|
|
@@ -3000,15 +3003,15 @@ let Wt = class extends le {
|
|
|
3000
3003
|
if (!u) return;
|
|
3001
3004
|
const d = (_ = this._renderManagerService.getRenderById(o)) == null ? void 0 : _.with(V).getWorksheetSkeleton(a);
|
|
3002
3005
|
if (!d) return;
|
|
3003
|
-
const { componentKey: l, data: g, allowTransform: h = !0 } =
|
|
3006
|
+
const { componentKey: l, data: g, allowTransform: h = !0 } = t, f = r != null ? r : Ht(), { position: p, position$: m } = this._createRangePositionObserver(n, u, d.skeleton);
|
|
3004
3007
|
if (this._getPosition(p, o) == null)
|
|
3005
3008
|
return;
|
|
3006
|
-
this._ensureMap(o, a).set(f,
|
|
3007
|
-
const C = c.scene, { scaleX: D } = C.getAncestorScale(), v = Mt(p,
|
|
3009
|
+
this._ensureMap(o, a).set(f, t);
|
|
3010
|
+
const C = c.scene, { scaleX: D } = C.getAncestorScale(), v = Mt(p, e, D), b = {
|
|
3008
3011
|
unitId: o,
|
|
3009
3012
|
subUnitId: a,
|
|
3010
3013
|
drawingId: f,
|
|
3011
|
-
drawingType:
|
|
3014
|
+
drawingType: t.type || L.DRAWING_DOM,
|
|
3012
3015
|
componentKey: l,
|
|
3013
3016
|
transform: {
|
|
3014
3017
|
left: v.startX,
|
|
@@ -3069,7 +3072,7 @@ let Wt = class extends le {
|
|
|
3069
3072
|
dispose: he,
|
|
3070
3073
|
rect: de,
|
|
3071
3074
|
boundsOfViewArea: gt,
|
|
3072
|
-
domAnchor:
|
|
3075
|
+
domAnchor: e,
|
|
3073
3076
|
unitId: I,
|
|
3074
3077
|
subUnitId: R
|
|
3075
3078
|
}, j = fe(de, W.renderUnit, X.skeleton, B.worksheet, ge), ke = new Ze(j);
|
|
@@ -3091,7 +3094,7 @@ let Wt = class extends le {
|
|
|
3091
3094
|
data: q,
|
|
3092
3095
|
unitId: I
|
|
3093
3096
|
};
|
|
3094
|
-
|
|
3097
|
+
t.eventPassThrough && (ze = {
|
|
3095
3098
|
...ze,
|
|
3096
3099
|
onPointerDown: (k) => {
|
|
3097
3100
|
Ue.dispatchEvent(new PointerEvent(k.type, k));
|
|
@@ -3109,17 +3112,17 @@ let Wt = class extends le {
|
|
|
3109
3112
|
startY: k.startY,
|
|
3110
3113
|
endX: k.endX,
|
|
3111
3114
|
endY: k.endY,
|
|
3112
|
-
width: (gn =
|
|
3113
|
-
height: (fn =
|
|
3115
|
+
width: (gn = e.width) != null ? gn : k.width,
|
|
3116
|
+
height: (fn = e.height) != null ? fn : k.height,
|
|
3114
3117
|
absolute: {
|
|
3115
3118
|
left: p.absolute.left,
|
|
3116
3119
|
top: p.absolute.top
|
|
3117
3120
|
}
|
|
3118
|
-
},
|
|
3121
|
+
}, e), Mr = Ce({ unitId: I, subUnitId: R, drawingId: O }), yr = new je(Mr, {
|
|
3119
3122
|
left: hn.startX,
|
|
3120
3123
|
top: hn.startY,
|
|
3121
|
-
width: (mn =
|
|
3122
|
-
height: (pn =
|
|
3124
|
+
width: (mn = e.width) != null ? mn : k.width,
|
|
3125
|
+
height: (pn = e.height) != null ? pn : k.height,
|
|
3123
3126
|
zIndex: this._drawingManagerService.getDrawingOrder(I, R).length - 1
|
|
3124
3127
|
}), Tr = fe(yr, W.renderUnit, X.skeleton, B.worksheet, ge);
|
|
3125
3128
|
ke.next(Tr);
|
|
@@ -3147,11 +3150,11 @@ let Wt = class extends le {
|
|
|
3147
3150
|
}
|
|
3148
3151
|
};
|
|
3149
3152
|
}
|
|
3150
|
-
addFloatDomToColumnHeader(n,
|
|
3153
|
+
addFloatDomToColumnHeader(n, t, e, r) {
|
|
3151
3154
|
var v, b, _, E, M;
|
|
3152
3155
|
const s = H(this._univerInstanceService, {
|
|
3153
|
-
unitId:
|
|
3154
|
-
subUnitId:
|
|
3156
|
+
unitId: t.unitId,
|
|
3157
|
+
subUnitId: t.subUnitId
|
|
3155
3158
|
});
|
|
3156
3159
|
if (!s)
|
|
3157
3160
|
throw new Error("cannot find current target!");
|
|
@@ -3161,7 +3164,7 @@ let Wt = class extends le {
|
|
|
3161
3164
|
if (!u) return;
|
|
3162
3165
|
const d = (v = this._renderManagerService.getRenderById(o)) == null ? void 0 : v.with(V).getWorksheetSkeleton(a);
|
|
3163
3166
|
if (!d) return;
|
|
3164
|
-
const { componentKey: l, data: g, allowTransform: h = !0 } =
|
|
3167
|
+
const { componentKey: l, data: g, allowTransform: h = !0 } = t, f = r != null ? r : Ht(), { position: p, position$: m } = this._createRangePositionObserver({
|
|
3165
3168
|
startRow: 0,
|
|
3166
3169
|
endRow: 0,
|
|
3167
3170
|
startColumn: n,
|
|
@@ -3169,12 +3172,12 @@ let Wt = class extends le {
|
|
|
3169
3172
|
}, u, d.skeleton), w = p;
|
|
3170
3173
|
if (w.startY = 0, this._getPosition(p, o) == null)
|
|
3171
3174
|
return;
|
|
3172
|
-
this._ensureMap(o, a).set(f,
|
|
3175
|
+
this._ensureMap(o, a).set(f, t);
|
|
3173
3176
|
const D = {
|
|
3174
3177
|
unitId: o,
|
|
3175
3178
|
subUnitId: a,
|
|
3176
3179
|
drawingId: f,
|
|
3177
|
-
drawingType:
|
|
3180
|
+
drawingType: t.type || L.DRAWING_DOM,
|
|
3178
3181
|
componentKey: l,
|
|
3179
3182
|
transform: {
|
|
3180
3183
|
left: w.startX,
|
|
@@ -3214,13 +3217,13 @@ let Wt = class extends le {
|
|
|
3214
3217
|
startY: 0,
|
|
3215
3218
|
endX: p.endX,
|
|
3216
3219
|
endY: p.endY,
|
|
3217
|
-
width:
|
|
3218
|
-
height:
|
|
3220
|
+
width: e.width,
|
|
3221
|
+
height: e.height,
|
|
3219
3222
|
absolute: {
|
|
3220
3223
|
left: p.absolute.left,
|
|
3221
3224
|
top: p.absolute.top
|
|
3222
3225
|
}
|
|
3223
|
-
},
|
|
3226
|
+
}, e), ut = {
|
|
3224
3227
|
left: Pe.startX,
|
|
3225
3228
|
top: Pe.startY,
|
|
3226
3229
|
width: Pe.width,
|
|
@@ -3241,7 +3244,7 @@ let Wt = class extends le {
|
|
|
3241
3244
|
unitId: y,
|
|
3242
3245
|
subUnitId: T,
|
|
3243
3246
|
boundsOfViewArea: Ve,
|
|
3244
|
-
domAnchor:
|
|
3247
|
+
domAnchor: e,
|
|
3245
3248
|
scrollDirectionResponse: "HORIZONTAL"
|
|
3246
3249
|
/* HORIZONTAL */
|
|
3247
3250
|
}, ht = fe(ue, J.renderUnit, Y.skeleton, R.worksheet, he), Ne = new Ze(ht);
|
|
@@ -3263,7 +3266,7 @@ let Wt = class extends le {
|
|
|
3263
3266
|
data: X,
|
|
3264
3267
|
unitId: y
|
|
3265
3268
|
};
|
|
3266
|
-
|
|
3269
|
+
t.eventPassThrough && (He = {
|
|
3267
3270
|
...He,
|
|
3268
3271
|
onPointerDown: (j) => {
|
|
3269
3272
|
q.dispatchEvent(new PointerEvent(j.type, j));
|
|
@@ -3287,17 +3290,17 @@ let Wt = class extends le {
|
|
|
3287
3290
|
startY: 0,
|
|
3288
3291
|
endX: j.endX,
|
|
3289
3292
|
endY: j.endY,
|
|
3290
|
-
width:
|
|
3291
|
-
height:
|
|
3293
|
+
width: e.width,
|
|
3294
|
+
height: e.height,
|
|
3292
3295
|
absolute: {
|
|
3293
3296
|
left: p.absolute.left,
|
|
3294
3297
|
top: p.absolute.top
|
|
3295
3298
|
}
|
|
3296
|
-
},
|
|
3299
|
+
}, e), ze = Ce({ unitId: y, subUnitId: T, drawingId: I }), Ke = new je(ze, {
|
|
3297
3300
|
left: ke.startX,
|
|
3298
3301
|
top: 0,
|
|
3299
|
-
width:
|
|
3300
|
-
height:
|
|
3302
|
+
width: e.width,
|
|
3303
|
+
height: e.height,
|
|
3301
3304
|
zIndex: this._drawingManagerService.getDrawingOrder(y, T).length - 1
|
|
3302
3305
|
}), ft = fe(Ke, J.renderUnit, Y.skeleton, R.worksheet, he);
|
|
3303
3306
|
Ne.next(ft);
|
|
@@ -3328,13 +3331,13 @@ let Wt = class extends le {
|
|
|
3328
3331
|
* @param activeViewport
|
|
3329
3332
|
* @returns position of cell to canvas.
|
|
3330
3333
|
*/
|
|
3331
|
-
_createRangePositionObserver(n,
|
|
3334
|
+
_createRangePositionObserver(n, t, e) {
|
|
3332
3335
|
let { startRow: r, startColumn: s } = n;
|
|
3333
|
-
const o = Qe(r, s,
|
|
3334
|
-
const m = Qe(r, s,
|
|
3336
|
+
const o = Qe(r, s, e), a = new Ze(o), c = Qe(n.endRow, n.endColumn, e), u = new Ze(c), d = () => {
|
|
3337
|
+
const m = Qe(r, s, e), w = Qe(n.endRow, n.endColumn, e);
|
|
3335
3338
|
a.next(m), u.next(w);
|
|
3336
3339
|
}, l = new _t();
|
|
3337
|
-
l.add(
|
|
3340
|
+
l.add(t.engine.clientRect$.subscribe(() => d())), l.add(this._commandService.onCommandExecuted((m) => {
|
|
3338
3341
|
if (m.id === Gn.id && m.params.rowsAutoHeightInfo.findIndex((S) => S.row === r) > -1) {
|
|
3339
3342
|
d();
|
|
3340
3343
|
return;
|
|
@@ -3357,7 +3360,7 @@ let Wt = class extends le {
|
|
|
3357
3360
|
endY: c.bottom
|
|
3358
3361
|
}), f = a.pipe(
|
|
3359
3362
|
Ee((m) => {
|
|
3360
|
-
const w = Qe(n.endRow, n.endColumn,
|
|
3363
|
+
const w = Qe(n.endRow, n.endColumn, e);
|
|
3361
3364
|
return {
|
|
3362
3365
|
rotate: 0,
|
|
3363
3366
|
width: w.right - m.left,
|
|
@@ -3392,8 +3395,8 @@ Wt = ho([
|
|
|
3392
3395
|
Me(5, ae),
|
|
3393
3396
|
Me(6, N(Kr))
|
|
3394
3397
|
], Wt);
|
|
3395
|
-
function Qe(i, n,
|
|
3396
|
-
const
|
|
3398
|
+
function Qe(i, n, t) {
|
|
3399
|
+
const e = t.getCellWithCoordByIndex(i, n), r = e.isMergedMainCell ? e.mergeInfo : e;
|
|
3397
3400
|
return {
|
|
3398
3401
|
left: r.startX,
|
|
3399
3402
|
right: r.endX,
|
|
@@ -3401,19 +3404,19 @@ function Qe(i, n, e) {
|
|
|
3401
3404
|
bottom: r.endY
|
|
3402
3405
|
};
|
|
3403
3406
|
}
|
|
3404
|
-
function Mt(i, n,
|
|
3407
|
+
function Mt(i, n, t) {
|
|
3405
3408
|
var u, d;
|
|
3406
|
-
|
|
3407
|
-
const
|
|
3409
|
+
t = t != null ? t : 1;
|
|
3410
|
+
const e = i.endX - i.startX, r = i.endY - i.startY, s = (u = n == null ? void 0 : n.width) != null ? u : e, o = (d = n == null ? void 0 : n.height) != null ? d : r;
|
|
3408
3411
|
let a = 0, c = 0;
|
|
3409
3412
|
if (n) {
|
|
3410
3413
|
if (n.horizonOffsetAlign === "right") {
|
|
3411
|
-
const l = yt(n.marginX,
|
|
3414
|
+
const l = yt(n.marginX, e * t);
|
|
3412
3415
|
a = i.endX - l - s;
|
|
3413
3416
|
} else
|
|
3414
|
-
a = i.startX + yt(n.marginX,
|
|
3417
|
+
a = i.startX + yt(n.marginX, e);
|
|
3415
3418
|
if (n.verticalOffsetAlign === "bottom") {
|
|
3416
|
-
const l = yt(n.marginY, r *
|
|
3419
|
+
const l = yt(n.marginY, r * t);
|
|
3417
3420
|
c = i.endY - l - o;
|
|
3418
3421
|
} else
|
|
3419
3422
|
c = i.startY + yt(n.marginY, r);
|
|
@@ -3435,18 +3438,18 @@ function Mt(i, n, e) {
|
|
|
3435
3438
|
function yt(i, n) {
|
|
3436
3439
|
if (i === void 0) return 0;
|
|
3437
3440
|
if (typeof i == "number") return i;
|
|
3438
|
-
const
|
|
3439
|
-
return n *
|
|
3441
|
+
const t = Number.parseFloat(i);
|
|
3442
|
+
return n * t / 100;
|
|
3440
3443
|
}
|
|
3441
|
-
var fo = Object.defineProperty, mo = Object.getOwnPropertyDescriptor, po = (i, n,
|
|
3442
|
-
for (var r =
|
|
3444
|
+
var fo = Object.defineProperty, mo = Object.getOwnPropertyDescriptor, po = (i, n, t) => n in i ? fo(i, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[n] = t, wo = (i, n, t, e) => {
|
|
3445
|
+
for (var r = e > 1 ? void 0 : e ? mo(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
3443
3446
|
(o = i[s]) && (r = o(r) || r);
|
|
3444
3447
|
return r;
|
|
3445
|
-
}, qt = (i, n) => (
|
|
3448
|
+
}, qt = (i, n) => (t, e) => n(t, e, i), Dr = (i, n, t) => po(i, typeof n != "symbol" ? n + "" : n, t);
|
|
3446
3449
|
const _o = "SHEET_IMAGE_UI_PLUGIN";
|
|
3447
3450
|
let jt = class extends ei {
|
|
3448
|
-
constructor(i = Pn, n,
|
|
3449
|
-
super(), this._config = i, this._injector = n, this._renderManagerService =
|
|
3451
|
+
constructor(i = Pn, n, t, e) {
|
|
3452
|
+
super(), this._config = i, this._injector = n, this._renderManagerService = t, this._configService = e;
|
|
3450
3453
|
const { menu: r, ...s } = ti(
|
|
3451
3454
|
{},
|
|
3452
3455
|
Pn,
|