@univerjs/sheets-drawing-ui 0.2.2 → 0.2.4-alpha.0
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/README.md +16 -5
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +962 -988
- package/lib/index.css +1 -1
- package/lib/locale/en-US.json +10 -0
- package/lib/locale/ru-RU.json +10 -0
- package/lib/locale/vi-VN.json +41 -0
- package/lib/locale/zh-CN.json +10 -0
- package/lib/locale/zh-TW.json +41 -0
- package/lib/types/basics/transform-position.d.ts +3 -3
- package/lib/types/controllers/drawing-popup-menu.controller.d.ts +1 -2
- package/lib/types/controllers/sheet-drawing-copy-paste.controller.d.ts +4 -5
- package/lib/types/controllers/sheet-drawing-transform-affected.controller.d.ts +7 -9
- package/lib/types/controllers/sheet-drawing-update.controller.d.ts +7 -9
- package/lib/types/controllers/sheet-drawing.controller.d.ts +1 -2
- package/lib/types/locale/vi-VN.d.ts +4 -0
- package/lib/types/locale/zh-CN.d.ts +10 -0
- package/lib/types/locale/zh-TW.d.ts +4 -0
- package/lib/types/plugin.d.ts +3 -2
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +8 -4
- package/lib/types/views/menu/image.menu.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +23 -25
package/lib/es/index.js
CHANGED
|
@@ -1,60 +1,58 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as
|
|
5
|
-
import { Inject as W, Injector as xe } from "@wendellhu/redi";
|
|
1
|
+
var en = Object.defineProperty;
|
|
2
|
+
var tn = (i, e, n) => e in i ? en(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
|
+
var H = (i, e, n) => tn(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { CommandType as F, ICommandService as V, IUndoRedoService as ge, LocaleService as _e, IUniverInstanceService as he, useDependency as q, RxDisposable as nn, UniverInstanceType as B, connectInjector as rn, toDisposable as sn, FOCUSING_COMMON_DRAWINGS as we, OnLifecycle as ie, LifecycleStages as se, Inject as W, Injector as nt, IContextService as _t, Disposable as oe, Direction as Q, FOCUSING_FORMULA_EDITOR as on, EDITOR_ACTIVATED as an, Rectangle as cn, DrawingTypeEnum as Ye, DisposableCollection as dn, Tools as ne, UserManagerService as ln, IPermissionService as un, Plugin as gn, DependentOn as hn } from "@univerjs/core";
|
|
6
5
|
import { ImageCropperObject as mn, COMPONENT_IMAGE_POPUP_MENU as fn, OpenImageCropOperation as pn, ImageResetSizeOperation as wn, DrawingCommonPanel as _n, DrawingRenderService as vn, UniverDrawingUIPlugin as Sn } from "@univerjs/drawing-ui";
|
|
7
|
-
import { ISheetDrawingService as
|
|
8
|
-
import { IDrawingManagerService as
|
|
9
|
-
import { IRenderManagerService as
|
|
10
|
-
import { SheetCanvasPopManagerService as Un, SheetSkeletonManagerService as
|
|
11
|
-
import { takeUntil as ht, Subject as
|
|
12
|
-
import { ISidebarService as
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import Te from "clsx";
|
|
6
|
+
import { ISheetDrawingService as k, SetDrawingApplyMutation as E, DrawingApplyType as y, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as Cn } from "@univerjs/sheets-drawing";
|
|
7
|
+
import { IDrawingManagerService as z, IImageIoService as vt, ArrangeTypeEnum as Ce, DrawingTypeEnum as Ve, DRAWING_IMAGE_COUNT_LIMIT as dt, ImageUploadStatusType as ke, DRAWING_IMAGE_ALLOW_SIZE as In, getImageSize as Rn, DRAWING_IMAGE_WIDTH_LIMIT as lt, DRAWING_IMAGE_HEIGHT_LIMIT as ut, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Mn, getDrawingShapeKeyByDrawingSearch as Dn, UniverDrawingPlugin as bn } from "@univerjs/drawing";
|
|
8
|
+
import { IRenderManagerService as K, getGroupState as En, transformObjectOutOfGroup as yn, precisionTo as ee, Rect as On, DRAWING_OBJECT_LAYER_INDEX as Pn, SHEET_VIEWPORT_KEY as Tn, RENDER_CLASS_TYPE as ae } from "@univerjs/engine-render";
|
|
9
|
+
import { SheetCanvasPopManagerService as Un, ISheetSelectionRenderService as Ge, SheetSkeletonManagerService as re, attachRangeWithCoord as An, getCurrentRangeDisable$ as Nn, SetScrollOperation as jn, SetZoomRatioOperation as Ln, SheetPrintInterceptorService as Bn, COPY_TYPE as gt, PREDEFINED_HOOK_NAME as Ie, virtualizeDiscreteRanges as Wn, ISheetClipboardService as $n } from "@univerjs/sheets-ui";
|
|
10
|
+
import { takeUntil as ht, Subject as mt, BehaviorSubject as Vn, combineLatest as Re, map as ft, filter as Me, distinctUntilChanged as De } from "rxjs";
|
|
11
|
+
import { ISidebarService as Gn, BuiltInUIPart as xn, IUIPartsService as Fn, IMessageService as Yn, MenuItemType as St, MenuPosition as kn, MenuGroup as Hn, getMenuHiddenObservable as Ct, KeyCode as ue, ComponentManager as Xn, IMenuService as zn, IShortcutService as Kn, CanvasFloatDomService as Jn } from "@univerjs/ui";
|
|
12
|
+
import { getSheetCommandTarget as le, SheetsSelectionsService as Zn, WorkbookEditablePermission as Ze, WorksheetEditPermission as Pe, RangeProtectionPermissionEditPoint as qn, InsertRowCommand as It, InsertColCommand as Rt, RemoveRowCommand as Mt, RemoveColCommand as Dt, DeleteRangeMoveLeftCommand as bt, DeleteRangeMoveUpCommand as Et, InsertRangeMoveDownCommand as yt, InsertRangeMoveRightCommand as Ot, DeltaRowHeightCommand as qe, SetRowHeightCommand as Qe, DeltaColumnWidthCommand as Pt, SetColWidthCommand as Tt, SetRowHiddenCommand as Ut, SetSpecificRowsVisibleCommand as At, SetSpecificColsVisibleCommand as Nt, SetColHiddenCommand as jt, SetRowVisibleMutation as Qn, SetRowHiddenMutation as er, SetColVisibleMutation as tr, SetColHiddenMutation as nr, SetWorksheetRowHeightMutation as rr, SetWorksheetColWidthMutation as ir, SetWorksheetActiveOperation as sr, SheetInterceptorService as or, SetFrozenMutation as ar, WorkbookViewPermission as pt, WorksheetViewPermission as He } from "@univerjs/sheets";
|
|
13
|
+
import L, { useEffect as rt, forwardRef as Lt, useRef as Bt, createElement as Wt, useState as et } from "react";
|
|
14
|
+
import { MessageType as be, RadioGroup as cr, Radio as Xe } from "@univerjs/design";
|
|
15
|
+
import Ee from "clsx";
|
|
18
16
|
const j = {
|
|
19
17
|
id: "sheet.operation.clear-drawing-transformer",
|
|
20
|
-
type:
|
|
18
|
+
type: F.MUTATION,
|
|
21
19
|
handler: (i, e) => {
|
|
22
|
-
const n = i.get(
|
|
20
|
+
const n = i.get(K);
|
|
23
21
|
return e.forEach((t) => {
|
|
24
22
|
var r, s;
|
|
25
23
|
(s = (r = n.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
|
|
26
24
|
}), !0;
|
|
27
25
|
}
|
|
28
|
-
},
|
|
26
|
+
}, it = {
|
|
29
27
|
id: "sheet.command.remove-sheet-image",
|
|
30
|
-
type:
|
|
28
|
+
type: F.COMMAND,
|
|
31
29
|
handler: (i, e) => {
|
|
32
|
-
const n = i.get(
|
|
30
|
+
const n = i.get(V), t = i.get(ge), r = i.get(k);
|
|
33
31
|
if (!e) return !1;
|
|
34
32
|
const { drawings: s } = e, o = [];
|
|
35
33
|
s.forEach((f) => {
|
|
36
34
|
const { unitId: m } = f;
|
|
37
35
|
o.push(m);
|
|
38
36
|
});
|
|
39
|
-
const a = r.getBatchRemoveOp(s), { unitId: d, subUnitId:
|
|
40
|
-
return n.syncExecuteCommand(
|
|
37
|
+
const a = r.getBatchRemoveOp(s), { unitId: d, subUnitId: h, undo: l, redo: c, objects: u } = a;
|
|
38
|
+
return n.syncExecuteCommand(E.id, { unitId: d, subUnitId: h, op: c, objects: u, type: y.REMOVE }) ? (t.pushUndoRedo({
|
|
41
39
|
unitID: d,
|
|
42
40
|
undoMutations: [
|
|
43
|
-
{ id:
|
|
41
|
+
{ id: E.id, params: { unitId: d, subUnitId: h, op: l, objects: u, type: y.INSERT } },
|
|
44
42
|
{ id: j.id, params: o }
|
|
45
43
|
],
|
|
46
44
|
redoMutations: [
|
|
47
|
-
{ id:
|
|
45
|
+
{ id: E.id, params: { unitId: d, subUnitId: h, op: c, objects: u, type: y.REMOVE } },
|
|
48
46
|
{ id: j.id, params: o }
|
|
49
47
|
]
|
|
50
48
|
}), !0) : !1;
|
|
51
49
|
}
|
|
52
50
|
}, $t = "COMPONENT_SHEET_DRAWING_PANEL", Vt = {
|
|
53
51
|
id: "sidebar.operation.sheet-image",
|
|
54
|
-
type:
|
|
52
|
+
type: F.COMMAND,
|
|
55
53
|
handler: async (i, e) => {
|
|
56
|
-
const n = i.get(
|
|
57
|
-
if (!
|
|
54
|
+
const n = i.get(Gn), t = i.get(_e), r = i.get(he), s = i.get(z);
|
|
55
|
+
if (!le(r)) return !1;
|
|
58
56
|
switch (e.value) {
|
|
59
57
|
case "open":
|
|
60
58
|
n.open({
|
|
@@ -73,43 +71,43 @@ const j = {
|
|
|
73
71
|
}
|
|
74
72
|
return !0;
|
|
75
73
|
}
|
|
76
|
-
},
|
|
74
|
+
}, Gt = {
|
|
77
75
|
id: "sheet.operation.edit-sheet-image",
|
|
78
|
-
type:
|
|
76
|
+
type: F.OPERATION,
|
|
79
77
|
handler: (i, e) => {
|
|
80
|
-
const n = i.get(
|
|
78
|
+
const n = i.get(z), t = i.get(V);
|
|
81
79
|
return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(Vt.id, { value: "open" }), !0);
|
|
82
80
|
}
|
|
83
|
-
}, dr = "univer-upload-loading", lr = "univer-upload-loading-body", ur = "univer-upload-loading-body-animation",
|
|
81
|
+
}, dr = "univer-upload-loading", lr = "univer-upload-loading-body", ur = "univer-upload-loading-body-animation", gr = "univer-UniverCircleAnimation", hr = "univer-upload-loading-body-text", ye = {
|
|
84
82
|
uploadLoading: dr,
|
|
85
83
|
uploadLoadingBody: lr,
|
|
86
84
|
uploadLoadingBodyAnimation: ur,
|
|
87
|
-
univerCircleAnimation:
|
|
88
|
-
uploadLoadingBodyText:
|
|
85
|
+
univerCircleAnimation: gr,
|
|
86
|
+
uploadLoadingBodyText: hr
|
|
89
87
|
}, mr = () => {
|
|
90
|
-
const i =
|
|
91
|
-
return
|
|
88
|
+
const i = q(vt), e = q(_e), [n, t] = L.useState(0);
|
|
89
|
+
return rt(() => {
|
|
92
90
|
const r = i.change$.subscribe((s) => {
|
|
93
91
|
t(s);
|
|
94
92
|
});
|
|
95
93
|
return () => {
|
|
96
94
|
r.unsubscribe();
|
|
97
95
|
};
|
|
98
|
-
}, [i]), /* @__PURE__ */ L.createElement("div", { style: { display: n > 0 ? "block" : "none" }, className:
|
|
96
|
+
}, [i]), /* @__PURE__ */ L.createElement("div", { style: { display: n > 0 ? "block" : "none" }, className: ye.uploadLoading }, /* @__PURE__ */ L.createElement("div", { className: ye.uploadLoadingBody }, /* @__PURE__ */ L.createElement("div", { className: ye.uploadLoadingBodyAnimation }), /* @__PURE__ */ L.createElement("div", { className: ye.uploadLoadingBodyText }, `${e.t("uploadLoading.loading")}: ${n}`)));
|
|
99
97
|
};
|
|
100
98
|
var fr = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, wr = (i, e, n, t) => {
|
|
101
99
|
for (var r = t > 1 ? void 0 : t ? pr(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
102
100
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
103
101
|
return t && r && fr(e, n, r), r;
|
|
104
|
-
},
|
|
105
|
-
let
|
|
102
|
+
}, te = (i, e) => (n, t) => e(n, t, i);
|
|
103
|
+
let Te = class extends nn {
|
|
106
104
|
constructor(e, n, t, r, s, o, a) {
|
|
107
105
|
super();
|
|
108
|
-
|
|
106
|
+
H(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
109
107
|
this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._init();
|
|
110
108
|
}
|
|
111
109
|
_init() {
|
|
112
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
110
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET).pipe(ht(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(B.UNIVER_SHEET).pipe(ht(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(B.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(xn.CONTENT, () => rn(mr, this._injector));
|
|
113
111
|
}
|
|
114
112
|
_dispose(e) {
|
|
115
113
|
const n = e.getUnitId();
|
|
@@ -150,10 +148,10 @@ let je = class extends rn {
|
|
|
150
148
|
const a = o.values().next().value;
|
|
151
149
|
if (!a)
|
|
152
150
|
return;
|
|
153
|
-
const d = a.oKey,
|
|
154
|
-
if (!
|
|
151
|
+
const d = a.oKey, h = this._drawingManagerService.getDrawingOKey(d);
|
|
152
|
+
if (!h)
|
|
155
153
|
return;
|
|
156
|
-
const { unitId: l, subUnitId: c, drawingId: u } =
|
|
154
|
+
const { unitId: l, subUnitId: c, drawingId: u } = h;
|
|
157
155
|
r == null || r.dispose(), r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
|
|
158
156
|
componentKey: fn,
|
|
159
157
|
direction: "horizontal",
|
|
@@ -183,14 +181,14 @@ let je = class extends rn {
|
|
|
183
181
|
{
|
|
184
182
|
label: "image-popup.edit",
|
|
185
183
|
index: 0,
|
|
186
|
-
commandId:
|
|
184
|
+
commandId: Gt.id,
|
|
187
185
|
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
188
186
|
disable: !1
|
|
189
187
|
},
|
|
190
188
|
{
|
|
191
189
|
label: "image-popup.delete",
|
|
192
190
|
index: 1,
|
|
193
|
-
commandId:
|
|
191
|
+
commandId: it.id,
|
|
194
192
|
commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
|
|
195
193
|
disable: !1
|
|
196
194
|
},
|
|
@@ -211,80 +209,80 @@ let je = class extends rn {
|
|
|
211
209
|
];
|
|
212
210
|
}
|
|
213
211
|
};
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
],
|
|
224
|
-
const
|
|
212
|
+
Te = wr([
|
|
213
|
+
ie(se.Steady, Te),
|
|
214
|
+
te(0, W(nt)),
|
|
215
|
+
te(1, z),
|
|
216
|
+
te(2, W(Un)),
|
|
217
|
+
te(3, K),
|
|
218
|
+
te(4, he),
|
|
219
|
+
te(5, _t),
|
|
220
|
+
te(6, W(Fn))
|
|
221
|
+
], Te);
|
|
222
|
+
const xe = {
|
|
225
223
|
id: "sheet.operation.insert-float-image",
|
|
226
|
-
type:
|
|
224
|
+
type: F.OPERATION,
|
|
227
225
|
handler: (i, e) => !0
|
|
228
|
-
},
|
|
226
|
+
}, Be = {
|
|
229
227
|
id: "sheet.operation.insert-cell-image",
|
|
230
|
-
type:
|
|
228
|
+
type: F.OPERATION,
|
|
231
229
|
handler: (i, e) => !0
|
|
232
|
-
},
|
|
230
|
+
}, st = {
|
|
233
231
|
id: "sheet.command.insert-sheet-image",
|
|
234
|
-
type:
|
|
232
|
+
type: F.COMMAND,
|
|
235
233
|
handler: (i, e) => {
|
|
236
|
-
const n = i.get(
|
|
234
|
+
const n = i.get(V), t = i.get(ge), r = i.get(k);
|
|
237
235
|
if (!e) return !1;
|
|
238
|
-
const s = e.drawings, o = s.map((f) => f.unitId), a = r.getBatchAddOp(s), { unitId: d, subUnitId:
|
|
239
|
-
return n.syncExecuteCommand(
|
|
236
|
+
const s = e.drawings, o = s.map((f) => f.unitId), a = r.getBatchAddOp(s), { unitId: d, subUnitId: h, undo: l, redo: c, objects: u } = a;
|
|
237
|
+
return n.syncExecuteCommand(E.id, { op: c, unitId: d, subUnitId: h, objects: u, type: y.INSERT }) ? (t.pushUndoRedo({
|
|
240
238
|
unitID: d,
|
|
241
239
|
undoMutations: [
|
|
242
|
-
{ id:
|
|
240
|
+
{ id: E.id, params: { op: l, unitId: d, subUnitId: h, objects: u, type: y.REMOVE } },
|
|
243
241
|
{ id: j.id, params: o }
|
|
244
242
|
],
|
|
245
243
|
redoMutations: [
|
|
246
|
-
{ id:
|
|
244
|
+
{ id: E.id, params: { op: c, unitId: d, subUnitId: h, objects: u, type: y.INSERT } },
|
|
247
245
|
{ id: j.id, params: o }
|
|
248
246
|
]
|
|
249
247
|
}), !0) : !1;
|
|
250
248
|
}
|
|
251
|
-
},
|
|
249
|
+
}, Fe = {
|
|
252
250
|
id: "sheet.command.set-sheet-image",
|
|
253
|
-
type:
|
|
251
|
+
type: F.COMMAND,
|
|
254
252
|
handler: (i, e) => {
|
|
255
|
-
const n = i.get(
|
|
253
|
+
const n = i.get(V), t = i.get(ge), r = i.get(k);
|
|
256
254
|
if (!e) return !1;
|
|
257
|
-
const { drawings: s } = e, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: d, undo:
|
|
258
|
-
return n.syncExecuteCommand(
|
|
255
|
+
const { drawings: s } = e, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: d, undo: h, redo: l, objects: c } = o;
|
|
256
|
+
return n.syncExecuteCommand(E.id, { unitId: a, subUnitId: d, op: l, objects: c, type: y.UPDATE }) ? (t.pushUndoRedo({
|
|
259
257
|
unitID: a,
|
|
260
258
|
undoMutations: [
|
|
261
|
-
{ id:
|
|
259
|
+
{ id: E.id, params: { unitId: a, subUnitId: d, op: h, objects: c, type: y.UPDATE } },
|
|
262
260
|
{ id: j.id, params: [a] }
|
|
263
261
|
],
|
|
264
262
|
redoMutations: [
|
|
265
|
-
{ id:
|
|
263
|
+
{ id: E.id, params: { unitId: a, subUnitId: d, op: l, objects: c, type: y.UPDATE } },
|
|
266
264
|
{ id: j.id, params: [a] }
|
|
267
265
|
]
|
|
268
266
|
}), !0) : !1;
|
|
269
267
|
}
|
|
270
|
-
},
|
|
268
|
+
}, xt = {
|
|
271
269
|
id: "sheet.command.set-drawing-arrange",
|
|
272
|
-
type:
|
|
270
|
+
type: F.COMMAND,
|
|
273
271
|
handler: (i, e) => {
|
|
274
|
-
const n = i.get(
|
|
272
|
+
const n = i.get(V), t = i.get(ge);
|
|
275
273
|
if (!e) return !1;
|
|
276
|
-
const r = i.get(
|
|
274
|
+
const r = i.get(k), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: d } = e, h = { unitId: s, subUnitId: o, drawingIds: a };
|
|
277
275
|
let l;
|
|
278
|
-
if (d ===
|
|
276
|
+
if (d === Ce.forward ? l = r.getForwardDrawingsOp(h) : d === Ce.backward ? l = r.getBackwardDrawingOp(h) : d === Ce.front ? l = r.getFrontDrawingsOp(h) : d === Ce.back && (l = r.getBackDrawingsOp(h)), l == null)
|
|
279
277
|
return !1;
|
|
280
|
-
const { objects: c, redo: u, undo:
|
|
281
|
-
return n.syncExecuteCommand(
|
|
278
|
+
const { objects: c, redo: u, undo: g } = l;
|
|
279
|
+
return n.syncExecuteCommand(E.id, { op: u, unitId: s, subUnitId: o, objects: c, type: y.ARRANGE }) ? (t.pushUndoRedo({
|
|
282
280
|
unitID: s,
|
|
283
281
|
undoMutations: [
|
|
284
|
-
{ id:
|
|
282
|
+
{ id: E.id, params: { op: g, unitId: s, subUnitId: o, objects: c, type: y.ARRANGE } }
|
|
285
283
|
],
|
|
286
284
|
redoMutations: [
|
|
287
|
-
{ id:
|
|
285
|
+
{ id: E.id, params: { op: u, unitId: s, subUnitId: o, objects: c, type: y.ARRANGE } }
|
|
288
286
|
]
|
|
289
287
|
}), !0) : !1;
|
|
290
288
|
}
|
|
@@ -292,10 +290,10 @@ const He = {
|
|
|
292
290
|
function _r(i) {
|
|
293
291
|
const e = [];
|
|
294
292
|
return i.forEach((n) => {
|
|
295
|
-
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a } = t, d =
|
|
296
|
-
const u = c.transform || { left: 0, top: 0 }, { unitId:
|
|
293
|
+
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a } = t, d = En(0, 0, r.map((c) => c.transform || {})), h = r.map((c) => {
|
|
294
|
+
const u = c.transform || { left: 0, top: 0 }, { unitId: g, subUnitId: f, drawingId: m } = c;
|
|
297
295
|
return {
|
|
298
|
-
unitId:
|
|
296
|
+
unitId: g,
|
|
299
297
|
subUnitId: f,
|
|
300
298
|
drawingId: m,
|
|
301
299
|
transform: {
|
|
@@ -309,12 +307,12 @@ function _r(i) {
|
|
|
309
307
|
unitId: s,
|
|
310
308
|
subUnitId: o,
|
|
311
309
|
drawingId: a,
|
|
312
|
-
drawingType:
|
|
310
|
+
drawingType: Ve.DRAWING_GROUP,
|
|
313
311
|
transform: d
|
|
314
312
|
};
|
|
315
313
|
e.push({
|
|
316
314
|
parent: l,
|
|
317
|
-
children:
|
|
315
|
+
children: h
|
|
318
316
|
});
|
|
319
317
|
}), e;
|
|
320
318
|
}
|
|
@@ -324,10 +322,10 @@ function vr(i) {
|
|
|
324
322
|
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a, transform: d = { width: 0, height: 0 } } = t;
|
|
325
323
|
if (d == null)
|
|
326
324
|
return;
|
|
327
|
-
const
|
|
328
|
-
const { transform: u } = c, { unitId:
|
|
325
|
+
const h = r.map((c) => {
|
|
326
|
+
const { transform: u } = c, { unitId: g, subUnitId: f, drawingId: m } = c, p = yn(u || {}, d, d.width || 0, d.height || 0);
|
|
329
327
|
return {
|
|
330
|
-
unitId:
|
|
328
|
+
unitId: g,
|
|
331
329
|
subUnitId: f,
|
|
332
330
|
drawingId: m,
|
|
333
331
|
transform: p,
|
|
@@ -337,7 +335,7 @@ function vr(i) {
|
|
|
337
335
|
unitId: s,
|
|
338
336
|
subUnitId: o,
|
|
339
337
|
drawingId: a,
|
|
340
|
-
drawingType:
|
|
338
|
+
drawingType: Ve.DRAWING_GROUP,
|
|
341
339
|
transform: {
|
|
342
340
|
left: 0,
|
|
343
341
|
top: 0
|
|
@@ -345,130 +343,142 @@ function vr(i) {
|
|
|
345
343
|
};
|
|
346
344
|
e.push({
|
|
347
345
|
parent: l,
|
|
348
|
-
children:
|
|
346
|
+
children: h
|
|
349
347
|
});
|
|
350
348
|
}), e;
|
|
351
349
|
}
|
|
352
|
-
const
|
|
350
|
+
const Ft = {
|
|
353
351
|
id: "sheet.command.group-sheet-image",
|
|
354
|
-
type:
|
|
352
|
+
type: F.COMMAND,
|
|
355
353
|
handler: (i, e) => {
|
|
356
|
-
const n = i.get(
|
|
354
|
+
const n = i.get(V), t = i.get(ge), r = i.get(k);
|
|
357
355
|
if (!e) return !1;
|
|
358
356
|
const s = [];
|
|
359
|
-
e.forEach(({ parent:
|
|
360
|
-
s.push(
|
|
357
|
+
e.forEach(({ parent: g, children: f }) => {
|
|
358
|
+
s.push(g.unitId), f.forEach((m) => {
|
|
361
359
|
s.push(m.unitId);
|
|
362
360
|
});
|
|
363
361
|
});
|
|
364
|
-
const o = r.getGroupDrawingOp(e), { unitId: a, subUnitId: d, undo:
|
|
365
|
-
return n.syncExecuteCommand(
|
|
362
|
+
const o = r.getGroupDrawingOp(e), { unitId: a, subUnitId: d, undo: h, redo: l, objects: c } = o;
|
|
363
|
+
return n.syncExecuteCommand(E.id, { op: l, unitId: a, subUnitId: d, objects: c, type: y.GROUP }) ? (t.pushUndoRedo({
|
|
366
364
|
unitID: a,
|
|
367
365
|
undoMutations: [
|
|
368
|
-
{ id:
|
|
366
|
+
{ id: E.id, params: { op: h, unitId: a, subUnitId: d, objects: vr(c), type: y.UNGROUP } },
|
|
369
367
|
{ id: j.id, params: s }
|
|
370
368
|
],
|
|
371
369
|
redoMutations: [
|
|
372
|
-
{ id:
|
|
370
|
+
{ id: E.id, params: { op: l, unitId: a, subUnitId: d, objects: c, type: y.GROUP } },
|
|
373
371
|
{ id: j.id, params: s }
|
|
374
372
|
]
|
|
375
373
|
}), !0) : !1;
|
|
376
374
|
}
|
|
377
|
-
},
|
|
375
|
+
}, Yt = {
|
|
378
376
|
id: "sheet.command.ungroup-sheet-image",
|
|
379
|
-
type:
|
|
377
|
+
type: F.COMMAND,
|
|
380
378
|
handler: (i, e) => {
|
|
381
|
-
const n = i.get(
|
|
379
|
+
const n = i.get(V), t = i.get(ge), r = i.get(k);
|
|
382
380
|
if (!e) return !1;
|
|
383
381
|
const s = [];
|
|
384
|
-
e.forEach(({ parent:
|
|
385
|
-
s.push(
|
|
382
|
+
e.forEach(({ parent: g, children: f }) => {
|
|
383
|
+
s.push(g.unitId), f.forEach((m) => {
|
|
386
384
|
s.push(m.unitId);
|
|
387
385
|
});
|
|
388
386
|
});
|
|
389
|
-
const o = r.getUngroupDrawingOp(e), { unitId: a, subUnitId: d, undo:
|
|
390
|
-
return n.syncExecuteCommand(
|
|
387
|
+
const o = r.getUngroupDrawingOp(e), { unitId: a, subUnitId: d, undo: h, redo: l, objects: c } = o;
|
|
388
|
+
return n.syncExecuteCommand(E.id, { op: l, unitId: a, subUnitId: d, objects: c, type: y.UNGROUP }) ? (t.pushUndoRedo({
|
|
391
389
|
unitID: a,
|
|
392
390
|
undoMutations: [
|
|
393
|
-
{ id:
|
|
391
|
+
{ id: E.id, params: { op: h, unitId: a, subUnitId: d, objects: _r(c), type: y.GROUP } },
|
|
394
392
|
{ id: j.id, params: s }
|
|
395
393
|
],
|
|
396
394
|
redoMutations: [
|
|
397
|
-
{ id:
|
|
395
|
+
{ id: E.id, params: { op: l, unitId: a, subUnitId: d, objects: c, type: y.UNGROUP } },
|
|
398
396
|
{ id: j.id, params: s }
|
|
399
397
|
]
|
|
400
398
|
}), !0) : !1;
|
|
401
399
|
}
|
|
402
400
|
};
|
|
403
|
-
function
|
|
404
|
-
const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY:
|
|
401
|
+
function $(i, e, n) {
|
|
402
|
+
const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY: h = 0 } = i, { column: l, columnOffset: c, row: u, rowOffset: g } = t, { column: f, columnOffset: m, row: p, rowOffset: S } = r, C = n.attachRangeWithCoord({
|
|
405
403
|
startColumn: l,
|
|
406
404
|
endColumn: l,
|
|
407
405
|
startRow: u,
|
|
408
406
|
endRow: u
|
|
409
407
|
});
|
|
410
|
-
if (
|
|
408
|
+
if (C == null)
|
|
411
409
|
return;
|
|
412
|
-
const
|
|
410
|
+
const v = n.attachRangeWithCoord({
|
|
413
411
|
startColumn: f,
|
|
414
412
|
endColumn: f,
|
|
415
413
|
startRow: p,
|
|
416
414
|
endRow: p
|
|
417
415
|
});
|
|
418
|
-
if (
|
|
416
|
+
if (v == null)
|
|
419
417
|
return;
|
|
420
|
-
const { startX:
|
|
421
|
-
let
|
|
422
|
-
|
|
423
|
-
const M = n.getCurrentSkeleton(),
|
|
424
|
-
return
|
|
418
|
+
const { startX: R, startY: _ } = C, { startX: b, startY: w } = v;
|
|
419
|
+
let P = ee(R + c, 1), D = ee(_ + g, 1), T = ee(b + m - P, 1), U = ee(w + S - D, 1);
|
|
420
|
+
C.startX === v.endX && (T = 0), C.startY === v.endY && (U = 0);
|
|
421
|
+
const M = n.getCurrentSkeleton(), I = M.rowHeaderWidth + M.columnTotalWidth, A = M.columnHeaderHeight + M.rowTotalHeight;
|
|
422
|
+
return P + T > I && (P = I - T), D + U > A && (D = A - U), {
|
|
425
423
|
flipY: s,
|
|
426
424
|
flipX: o,
|
|
427
425
|
angle: a,
|
|
428
426
|
skewX: d,
|
|
429
|
-
skewY:
|
|
430
|
-
left:
|
|
431
|
-
top:
|
|
432
|
-
width:
|
|
433
|
-
height:
|
|
427
|
+
skewY: h,
|
|
428
|
+
left: P,
|
|
429
|
+
top: D,
|
|
430
|
+
width: T,
|
|
431
|
+
height: U
|
|
434
432
|
};
|
|
435
433
|
}
|
|
436
434
|
function N(i, e) {
|
|
437
|
-
const { left: n = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: d = 0, skewX:
|
|
435
|
+
const { left: n = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: d = 0, skewX: h = 0, skewY: l = 0 } = i, c = e.getSelectionCellByPosition(n, t);
|
|
438
436
|
if (c == null)
|
|
439
437
|
return;
|
|
440
438
|
const u = {
|
|
441
439
|
column: c.actualColumn,
|
|
442
|
-
columnOffset:
|
|
440
|
+
columnOffset: ee(n - c.startX, 1),
|
|
443
441
|
row: c.actualRow,
|
|
444
|
-
rowOffset:
|
|
445
|
-
},
|
|
446
|
-
if (
|
|
442
|
+
rowOffset: ee(t - c.startY, 1)
|
|
443
|
+
}, g = e.getSelectionCellByPosition(n + r, t + s);
|
|
444
|
+
if (g == null)
|
|
447
445
|
return;
|
|
448
446
|
const f = {
|
|
449
|
-
column:
|
|
450
|
-
columnOffset:
|
|
451
|
-
row:
|
|
452
|
-
rowOffset:
|
|
447
|
+
column: g.actualColumn,
|
|
448
|
+
columnOffset: ee(n + r - g.startX, 1),
|
|
449
|
+
row: g.actualRow,
|
|
450
|
+
rowOffset: ee(t + s - g.startY, 1)
|
|
453
451
|
};
|
|
454
452
|
return {
|
|
455
453
|
flipY: o,
|
|
456
454
|
flipX: a,
|
|
457
455
|
angle: d,
|
|
458
|
-
skewX:
|
|
456
|
+
skewX: h,
|
|
459
457
|
skewY: l,
|
|
460
458
|
from: u,
|
|
461
459
|
to: f
|
|
462
460
|
};
|
|
463
461
|
}
|
|
464
|
-
var Sr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor,
|
|
462
|
+
var Sr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Ir = (i, e, n, t) => {
|
|
465
463
|
for (var r = t > 1 ? void 0 : t ? Cr(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
466
464
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
467
465
|
return t && r && Sr(e, n, r), r;
|
|
468
466
|
}, X = (i, e) => (n, t) => e(n, t, i);
|
|
469
|
-
let
|
|
470
|
-
constructor(i, e, n, t, r, s, o, a, d,
|
|
471
|
-
super(), this.
|
|
467
|
+
let Ue = class extends oe {
|
|
468
|
+
constructor(i, e, n, t, r, s, o, a, d, h) {
|
|
469
|
+
super(), this._commandService = i, this._univerInstanceService = e, this._selectionManagerService = n, this._imageIoService = t, this._sheetDrawingService = r, this._drawingManagerService = s, this._contextService = o, this._messageService = a, this._localeService = d, this._renderManagerService = h, this._init();
|
|
470
|
+
}
|
|
471
|
+
// TODO@wzhudev: selection render service would be a render unit, we we cannot
|
|
472
|
+
// easily access it here.
|
|
473
|
+
get _selectionRenderService() {
|
|
474
|
+
return this._renderManagerService.getRenderById(
|
|
475
|
+
this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET).getUnitId()
|
|
476
|
+
).with(Ge);
|
|
477
|
+
}
|
|
478
|
+
get _skeletonManagerService() {
|
|
479
|
+
return this._renderManagerService.getRenderById(
|
|
480
|
+
this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET).getUnitId()
|
|
481
|
+
).with(re);
|
|
472
482
|
}
|
|
473
483
|
_init() {
|
|
474
484
|
this._initCommandListeners(), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._drawingAddListener();
|
|
@@ -479,19 +489,19 @@ let Le = class extends de {
|
|
|
479
489
|
_initCommandListeners() {
|
|
480
490
|
this.disposeWithMe(
|
|
481
491
|
this._commandService.onCommandExecuted(async (i) => {
|
|
482
|
-
if (i.id ===
|
|
492
|
+
if (i.id === Be.id || i.id === xe.id) {
|
|
483
493
|
const e = i.params;
|
|
484
494
|
if (e.files == null)
|
|
485
495
|
return;
|
|
486
496
|
const n = e.files.length;
|
|
487
|
-
if (n >
|
|
497
|
+
if (n > dt) {
|
|
488
498
|
this._messageService.show({
|
|
489
|
-
type:
|
|
490
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(
|
|
499
|
+
type: be.Error,
|
|
500
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(dt))
|
|
491
501
|
});
|
|
492
502
|
return;
|
|
493
503
|
}
|
|
494
|
-
this._imageIoService.setWaitCount(n), i.id ===
|
|
504
|
+
this._imageIoService.setWaitCount(n), i.id === Be.id ? e.files.forEach(async (t) => {
|
|
495
505
|
await this._insertCellImage(t);
|
|
496
506
|
}) : e.files.forEach(async (t) => {
|
|
497
507
|
await this._insertFloatImage(t);
|
|
@@ -506,16 +516,16 @@ let Le = class extends de {
|
|
|
506
516
|
let e;
|
|
507
517
|
try {
|
|
508
518
|
e = await this._imageIoService.saveImage(i);
|
|
509
|
-
} catch (
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
type:
|
|
513
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
514
|
-
}) :
|
|
515
|
-
type:
|
|
519
|
+
} catch (C) {
|
|
520
|
+
const v = C.message;
|
|
521
|
+
v === ke.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
522
|
+
type: be.Error,
|
|
523
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(In / (1024 * 1024)))
|
|
524
|
+
}) : v === ke.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
525
|
+
type: be.Error,
|
|
516
526
|
content: this._localeService.t("update-status.invalidImageType")
|
|
517
|
-
}) :
|
|
518
|
-
type:
|
|
527
|
+
}) : v === ke.ERROR_IMAGE && this._messageService.show({
|
|
528
|
+
type: be.Error,
|
|
519
529
|
content: this._localeService.t("update-status.invalidImage")
|
|
520
530
|
});
|
|
521
531
|
}
|
|
@@ -524,36 +534,36 @@ let Le = class extends de {
|
|
|
524
534
|
const n = this._getUnitInfo();
|
|
525
535
|
if (n == null)
|
|
526
536
|
return;
|
|
527
|
-
const { unitId: t, subUnitId: r } = n, { imageId: s, imageSourceType: o, source: a, base64Cache: d } = e, { width:
|
|
537
|
+
const { unitId: t, subUnitId: r } = n, { imageId: s, imageSourceType: o, source: a, base64Cache: d } = e, { width: h, height: l, image: c } = await Rn(d || ""), u = this._renderManagerService.getRenderById(t);
|
|
528
538
|
if (u == null)
|
|
529
539
|
return;
|
|
530
|
-
const { width:
|
|
540
|
+
const { width: g, height: f } = u.scene;
|
|
531
541
|
this._imageIoService.addImageSourceCache(a, o, c);
|
|
532
542
|
let m = 1;
|
|
533
|
-
if (
|
|
534
|
-
const
|
|
535
|
-
m = Math.max(
|
|
543
|
+
if (h > lt || l > ut) {
|
|
544
|
+
const C = lt / h, v = ut / l;
|
|
545
|
+
m = Math.max(C, v);
|
|
536
546
|
}
|
|
537
|
-
const p = this._getImagePosition(
|
|
547
|
+
const p = this._getImagePosition(h * m, l * m, g, f);
|
|
538
548
|
if (p == null)
|
|
539
549
|
return;
|
|
540
|
-
const
|
|
550
|
+
const S = {
|
|
541
551
|
unitId: t,
|
|
542
552
|
subUnitId: r,
|
|
543
553
|
drawingId: s,
|
|
544
|
-
drawingType:
|
|
554
|
+
drawingType: Ve.DRAWING_IMAGE,
|
|
545
555
|
imageSourceType: o,
|
|
546
556
|
source: a,
|
|
547
|
-
transform:
|
|
557
|
+
transform: $(p, this._selectionRenderService, this._skeletonManagerService),
|
|
548
558
|
sheetTransform: p
|
|
549
559
|
};
|
|
550
|
-
this._commandService.executeCommand(
|
|
560
|
+
this._commandService.executeCommand(st.id, {
|
|
551
561
|
unitId: t,
|
|
552
|
-
drawings: [
|
|
562
|
+
drawings: [S]
|
|
553
563
|
});
|
|
554
564
|
}
|
|
555
565
|
_getUnitInfo() {
|
|
556
|
-
const i = this._univerInstanceService.getCurrentUnitForType(
|
|
566
|
+
const i = this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET);
|
|
557
567
|
if (i == null)
|
|
558
568
|
return;
|
|
559
569
|
const e = i.getActiveSheet();
|
|
@@ -566,7 +576,7 @@ let Le = class extends de {
|
|
|
566
576
|
};
|
|
567
577
|
}
|
|
568
578
|
_getImagePosition(i, e, n, t) {
|
|
569
|
-
const r = this._selectionManagerService.
|
|
579
|
+
const r = this._selectionManagerService.getCurrentSelections();
|
|
570
580
|
let s = {
|
|
571
581
|
startRow: 0,
|
|
572
582
|
endRow: 0,
|
|
@@ -574,29 +584,29 @@ let Le = class extends de {
|
|
|
574
584
|
endColumn: 0
|
|
575
585
|
};
|
|
576
586
|
r && r.length > 0 && (s = r[r.length - 1].range);
|
|
577
|
-
const o = this.
|
|
587
|
+
const o = An(this._skeletonManagerService.getCurrent().skeleton, s);
|
|
578
588
|
if (o == null)
|
|
579
589
|
return;
|
|
580
|
-
let { startColumn: a, startRow: d, startX:
|
|
581
|
-
if (
|
|
582
|
-
const m = this._selectionRenderService.getSelectionCellByPosition(
|
|
590
|
+
let { startColumn: a, startRow: d, startX: h, startY: l } = o, c = !1;
|
|
591
|
+
if (h + i > n && (h = n - i, h < 0 && (h = 0, i = n), c = !0), l + e > t && (l = t - e, l < 0 && (l = 0, e = t), c = !0), c) {
|
|
592
|
+
const m = this._selectionRenderService.getSelectionCellByPosition(h, l);
|
|
583
593
|
if (m == null)
|
|
584
594
|
return;
|
|
585
|
-
|
|
595
|
+
h = m.startX, l = m.startY, a = m.actualColumn, d = m.actualRow;
|
|
586
596
|
}
|
|
587
597
|
const u = {
|
|
588
598
|
column: a,
|
|
589
599
|
columnOffset: 0,
|
|
590
600
|
row: d,
|
|
591
601
|
rowOffset: 0
|
|
592
|
-
},
|
|
593
|
-
if (
|
|
602
|
+
}, g = this._selectionRenderService.getSelectionCellByPosition(h + i, l + e);
|
|
603
|
+
if (g == null)
|
|
594
604
|
return;
|
|
595
605
|
const f = {
|
|
596
|
-
column:
|
|
597
|
-
columnOffset:
|
|
598
|
-
row:
|
|
599
|
-
rowOffset: l + e -
|
|
606
|
+
column: g.actualColumn,
|
|
607
|
+
columnOffset: h + i - g.startX,
|
|
608
|
+
row: g.actualRow,
|
|
609
|
+
rowOffset: l + e - g.startY
|
|
600
610
|
};
|
|
601
611
|
return {
|
|
602
612
|
from: u,
|
|
@@ -606,7 +616,7 @@ let Le = class extends de {
|
|
|
606
616
|
_updateOrderListener() {
|
|
607
617
|
this._drawingManagerService.featurePluginOrderUpdate$.subscribe((i) => {
|
|
608
618
|
const { unitId: e, subUnitId: n, drawingIds: t, arrangeType: r } = i;
|
|
609
|
-
this._commandService.executeCommand(
|
|
619
|
+
this._commandService.executeCommand(xt.id, {
|
|
610
620
|
unitId: e,
|
|
611
621
|
subUnitId: n,
|
|
612
622
|
drawingIds: t,
|
|
@@ -624,16 +634,16 @@ let Le = class extends de {
|
|
|
624
634
|
const d = this._sheetDrawingService.getDrawingByParam({ unitId: t, subUnitId: r, drawingId: s });
|
|
625
635
|
if (d == null)
|
|
626
636
|
return;
|
|
627
|
-
const
|
|
628
|
-
if (
|
|
637
|
+
const h = N({ ...d.transform, ...a }, this._selectionRenderService);
|
|
638
|
+
if (h == null)
|
|
629
639
|
return;
|
|
630
640
|
const l = {
|
|
631
641
|
...n,
|
|
632
|
-
transform: { ...d.transform, ...a,
|
|
633
|
-
sheetTransform: { ...
|
|
642
|
+
transform: { ...d.transform, ...a, ...$(h, this._selectionRenderService, this._skeletonManagerService) },
|
|
643
|
+
sheetTransform: { ...h }
|
|
634
644
|
};
|
|
635
645
|
e.push(l);
|
|
636
|
-
}), e.length > 0 && this._commandService.executeCommand(
|
|
646
|
+
}), e.length > 0 && this._commandService.executeCommand(Fe.id, {
|
|
637
647
|
unitId: i[0].unitId,
|
|
638
648
|
drawings: e
|
|
639
649
|
}));
|
|
@@ -641,11 +651,11 @@ let Le = class extends de {
|
|
|
641
651
|
}
|
|
642
652
|
_groupDrawingListener() {
|
|
643
653
|
this._drawingManagerService.featurePluginGroupUpdate$.subscribe((i) => {
|
|
644
|
-
this._commandService.executeCommand(
|
|
654
|
+
this._commandService.executeCommand(Ft.id, i);
|
|
645
655
|
const { unitId: e, subUnitId: n, drawingId: t } = i[0].parent;
|
|
646
656
|
this._drawingManagerService.focusDrawing([{ unitId: e, subUnitId: n, drawingId: t }]);
|
|
647
657
|
}), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((i) => {
|
|
648
|
-
this._commandService.executeCommand(
|
|
658
|
+
this._commandService.executeCommand(Yt.id, i);
|
|
649
659
|
});
|
|
650
660
|
}
|
|
651
661
|
_focusDrawingListener() {
|
|
@@ -668,53 +678,51 @@ let Le = class extends de {
|
|
|
668
678
|
if (t == null)
|
|
669
679
|
return;
|
|
670
680
|
const { sheetTransform: r } = t;
|
|
671
|
-
t.transform =
|
|
681
|
+
t.transform = $(r, this._selectionRenderService, this._skeletonManagerService);
|
|
672
682
|
});
|
|
673
683
|
const e = i[0].unitId;
|
|
674
684
|
this._drawingManagerService.registerDrawingData(e, this._sheetDrawingService.getDrawingDataForUnit(e)), this._drawingManagerService.initializeNotification(e);
|
|
675
685
|
}
|
|
676
686
|
};
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
X(
|
|
680
|
-
X(
|
|
681
|
-
X(
|
|
682
|
-
X(
|
|
683
|
-
X(
|
|
684
|
-
X(
|
|
685
|
-
X(
|
|
686
|
-
X(
|
|
687
|
-
X(
|
|
688
|
-
X(
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
var x = function() {
|
|
693
|
-
return x = Object.assign || function(i) {
|
|
687
|
+
Ue = Ir([
|
|
688
|
+
ie(se.Rendered, Ue),
|
|
689
|
+
X(0, V),
|
|
690
|
+
X(1, he),
|
|
691
|
+
X(2, W(Zn)),
|
|
692
|
+
X(3, vt),
|
|
693
|
+
X(4, k),
|
|
694
|
+
X(5, z),
|
|
695
|
+
X(6, _t),
|
|
696
|
+
X(7, Yn),
|
|
697
|
+
X(8, W(_e)),
|
|
698
|
+
X(9, K)
|
|
699
|
+
], Ue);
|
|
700
|
+
var Y = function() {
|
|
701
|
+
return Y = Object.assign || function(i) {
|
|
694
702
|
for (var e, n = 1, t = arguments.length; n < t; n++) {
|
|
695
703
|
e = arguments[n];
|
|
696
704
|
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (i[r] = e[r]);
|
|
697
705
|
}
|
|
698
706
|
return i;
|
|
699
|
-
},
|
|
700
|
-
},
|
|
707
|
+
}, Y.apply(this, arguments);
|
|
708
|
+
}, Rr = function(i, e) {
|
|
701
709
|
var n = {};
|
|
702
710
|
for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
|
|
703
711
|
if (i != null && typeof Object.getOwnPropertySymbols == "function")
|
|
704
712
|
for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
|
|
705
713
|
e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
|
|
706
714
|
return n;
|
|
707
|
-
},
|
|
708
|
-
var n = i.icon, t = i.id, r = i.className, s = i.extend, o =
|
|
709
|
-
return Ht(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current },
|
|
715
|
+
}, kt = Lt(function(i, e) {
|
|
716
|
+
var n = i.icon, t = i.id, r = i.className, s = i.extend, o = Rr(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = Bt("_".concat(br()));
|
|
717
|
+
return Ht(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, Y({ ref: e, className: a }, o), s);
|
|
710
718
|
});
|
|
711
719
|
function Ht(i, e, n, t, r) {
|
|
712
|
-
return
|
|
720
|
+
return Wt(i.tag, Y(Y({ key: e }, Mr(i, n, r)), t), (Dr(i, n).children || []).map(function(s, o) {
|
|
713
721
|
return Ht(s, "".concat(e, "-").concat(i.tag, "-").concat(o), n, void 0, r);
|
|
714
722
|
}));
|
|
715
723
|
}
|
|
716
|
-
function
|
|
717
|
-
var t =
|
|
724
|
+
function Mr(i, e, n) {
|
|
725
|
+
var t = Y({}, i.attrs);
|
|
718
726
|
n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
|
|
719
727
|
var r = e.defIds;
|
|
720
728
|
return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(s) {
|
|
@@ -722,45 +730,45 @@ function Dr(i, e, n) {
|
|
|
722
730
|
typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
723
731
|
})), t;
|
|
724
732
|
}
|
|
725
|
-
function
|
|
733
|
+
function Dr(i, e) {
|
|
726
734
|
var n, t = e.defIds;
|
|
727
|
-
return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ?
|
|
728
|
-
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ?
|
|
735
|
+
return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? Y(Y({}, i), { children: i.children.map(function(r) {
|
|
736
|
+
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? Y(Y({}, r), { attrs: Y(Y({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
|
|
729
737
|
}) }) : i;
|
|
730
738
|
}
|
|
731
739
|
function br() {
|
|
732
740
|
return Math.random().toString(36).substring(2, 8);
|
|
733
741
|
}
|
|
734
|
-
|
|
735
|
-
var
|
|
736
|
-
return
|
|
742
|
+
kt.displayName = "UniverIcon";
|
|
743
|
+
var Er = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, Xt = Lt(function(i, e) {
|
|
744
|
+
return Wt(kt, Object.assign({}, i, {
|
|
737
745
|
id: "add-image-single",
|
|
738
746
|
ref: e,
|
|
739
|
-
icon:
|
|
747
|
+
icon: Er
|
|
740
748
|
}));
|
|
741
749
|
});
|
|
742
|
-
|
|
743
|
-
const
|
|
744
|
-
uploadFileMenu:
|
|
745
|
-
uploadFileMenuInput:
|
|
750
|
+
Xt.displayName = "AddImageSingle";
|
|
751
|
+
const yr = "univer-upload-file-menu", Or = "univer-upload-file-menu-input", wt = {
|
|
752
|
+
uploadFileMenu: yr,
|
|
753
|
+
uploadFileMenuInput: Or
|
|
746
754
|
}, zt = "COMPONENT_UPLOAD_FILE_MENU";
|
|
747
|
-
var
|
|
748
|
-
const
|
|
749
|
-
const { type: e } = i, n =
|
|
755
|
+
var We = /* @__PURE__ */ ((i) => (i[i.cellImage = 0] = "cellImage", i[i.floatImage = 1] = "floatImage", i))(We || {});
|
|
756
|
+
const Pr = (i) => {
|
|
757
|
+
const { type: e } = i, n = q(V), t = Bt(null), r = () => {
|
|
750
758
|
var a;
|
|
751
759
|
(a = t.current) == null || a.click();
|
|
752
|
-
}, s =
|
|
760
|
+
}, s = Mn.map((a) => `.${a.replace("image/", "")}`).join(","), o = (a) => {
|
|
753
761
|
const d = a.target.files;
|
|
754
762
|
if (d == null)
|
|
755
763
|
return;
|
|
756
|
-
const
|
|
757
|
-
e ===
|
|
764
|
+
const h = Array.from(d);
|
|
765
|
+
e === We.floatImage ? n.executeCommand(xe.id, { files: h }) : e === We.cellImage && n.executeCommand(Be.id, { files: h }), t.current && (t.current.value = "");
|
|
758
766
|
};
|
|
759
|
-
return /* @__PURE__ */ L.createElement("div", { onClick: r, className:
|
|
767
|
+
return /* @__PURE__ */ L.createElement("div", { onClick: r, className: wt.uploadFileMenu }, /* @__PURE__ */ L.createElement(
|
|
760
768
|
"input",
|
|
761
769
|
{
|
|
762
770
|
type: "file",
|
|
763
|
-
className:
|
|
771
|
+
className: wt.uploadFileMenuInput,
|
|
764
772
|
ref: t,
|
|
765
773
|
onChange: o,
|
|
766
774
|
accept: s,
|
|
@@ -768,94 +776,95 @@ const Tr = (i) => {
|
|
|
768
776
|
}
|
|
769
777
|
));
|
|
770
778
|
}, Kt = "addition-and-subtraction-single", Jt = "sheet.menu.image";
|
|
771
|
-
function
|
|
779
|
+
function Tr(i) {
|
|
772
780
|
return {
|
|
773
781
|
id: Jt,
|
|
774
|
-
type:
|
|
775
|
-
positions: [
|
|
776
|
-
group:
|
|
782
|
+
type: St.SUBITEMS,
|
|
783
|
+
positions: [kn.TOOLBAR_START],
|
|
784
|
+
group: Hn.TOOLBAR_FORMULAS_INSERT,
|
|
777
785
|
icon: Kt,
|
|
778
786
|
tooltip: "sheetImage.title",
|
|
779
|
-
hidden$:
|
|
780
|
-
disabled$:
|
|
787
|
+
hidden$: Ct(i, B.UNIVER_SHEET),
|
|
788
|
+
disabled$: Nn(i, { workbookTypes: [Ze], worksheetTypes: [Pe], rangeTypes: [qn] })
|
|
781
789
|
};
|
|
782
790
|
}
|
|
783
791
|
function Ur(i) {
|
|
784
792
|
return {
|
|
785
|
-
id:
|
|
793
|
+
id: xe.id,
|
|
786
794
|
title: "sheetImage.upload.float",
|
|
787
|
-
type:
|
|
795
|
+
type: St.SELECTOR,
|
|
788
796
|
label: {
|
|
789
797
|
name: zt,
|
|
790
798
|
props: {
|
|
791
|
-
type:
|
|
799
|
+
type: We.floatImage
|
|
792
800
|
}
|
|
793
801
|
},
|
|
794
802
|
positions: [Jt],
|
|
795
|
-
hidden$:
|
|
803
|
+
hidden$: Ct(i, B.UNIVER_SHEET)
|
|
796
804
|
};
|
|
797
805
|
}
|
|
798
|
-
const Ar = "univer-image-common-panel", Nr = "univer-image-common-panel-grid", jr = "univer-image-common-panel-border", Lr = "univer-image-common-panel-title", Wr = "univer-image-common-panel-row",
|
|
806
|
+
const Ar = "univer-image-common-panel", Nr = "univer-image-common-panel-grid", jr = "univer-image-common-panel-border", Lr = "univer-image-common-panel-title", Br = "univer-image-common-panel-subtitle", Wr = "univer-image-common-panel-row", $r = "univer-image-common-panel-row-vertical", Vr = "univer-image-common-panel-column", Gr = "univer-image-common-panel-column-center", xr = "univer-image-common-panel-inline", Fr = "univer-image-common-panel-span2", Yr = "univer-image-common-panel-span3", kr = "univer-image-common-panel-input", Hr = "univer-sheet-image-menu", Xr = "univer-sheet-image-menu-input", Z = {
|
|
799
807
|
imageCommonPanel: Ar,
|
|
800
808
|
imageCommonPanelGrid: Nr,
|
|
801
809
|
imageCommonPanelBorder: jr,
|
|
802
810
|
imageCommonPanelTitle: Lr,
|
|
811
|
+
imageCommonPanelSubtitle: Br,
|
|
803
812
|
imageCommonPanelRow: Wr,
|
|
804
|
-
imageCommonPanelRowVertical:
|
|
805
|
-
imageCommonPanelColumn:
|
|
806
|
-
imageCommonPanelColumnCenter:
|
|
807
|
-
imageCommonPanelInline:
|
|
808
|
-
imageCommonPanelSpan2:
|
|
809
|
-
imageCommonPanelSpan3:
|
|
810
|
-
imageCommonPanelInput:
|
|
811
|
-
sheetImageMenu:
|
|
812
|
-
sheetImageMenuInput:
|
|
813
|
-
},
|
|
814
|
-
var
|
|
815
|
-
const e =
|
|
813
|
+
imageCommonPanelRowVertical: $r,
|
|
814
|
+
imageCommonPanelColumn: Vr,
|
|
815
|
+
imageCommonPanelColumnCenter: Gr,
|
|
816
|
+
imageCommonPanelInline: xr,
|
|
817
|
+
imageCommonPanelSpan2: Fr,
|
|
818
|
+
imageCommonPanelSpan3: Yr,
|
|
819
|
+
imageCommonPanelInput: kr,
|
|
820
|
+
sheetImageMenu: Hr,
|
|
821
|
+
sheetImageMenuInput: Xr
|
|
822
|
+
}, zr = (i) => {
|
|
823
|
+
var v;
|
|
824
|
+
const e = q(V), n = q(_e), t = q(z), r = q(K), { drawings: s } = i, o = s[0];
|
|
816
825
|
if (o == null)
|
|
817
826
|
return;
|
|
818
|
-
const { unitId: a } = o, d = r.getRenderById(a),
|
|
819
|
-
if (
|
|
827
|
+
const { unitId: a } = o, d = r.getRenderById(a), h = d == null ? void 0 : d.scene;
|
|
828
|
+
if (h == null)
|
|
820
829
|
return;
|
|
821
|
-
const l =
|
|
822
|
-
function p(
|
|
830
|
+
const l = h.getTransformerByCreate(), [c, u] = et(!0), g = (v = o.anchorType) != null ? v : O.Position, [f, m] = et(g);
|
|
831
|
+
function p(R, _) {
|
|
823
832
|
const b = [];
|
|
824
|
-
return
|
|
825
|
-
const { oKey:
|
|
826
|
-
if (
|
|
833
|
+
return R.forEach((w) => {
|
|
834
|
+
const { oKey: P } = w, D = _.getDrawingOKey(P);
|
|
835
|
+
if (D == null)
|
|
827
836
|
return b.push(null), !0;
|
|
828
|
-
const { unitId:
|
|
837
|
+
const { unitId: T, subUnitId: U, drawingId: M, drawingType: I, anchorType: A, sheetTransform: G } = D;
|
|
829
838
|
b.push({
|
|
830
|
-
unitId:
|
|
831
|
-
subUnitId:
|
|
839
|
+
unitId: T,
|
|
840
|
+
subUnitId: U,
|
|
832
841
|
drawingId: M,
|
|
833
842
|
anchorType: A,
|
|
834
|
-
sheetTransform:
|
|
835
|
-
drawingType:
|
|
843
|
+
sheetTransform: G,
|
|
844
|
+
drawingType: I
|
|
836
845
|
});
|
|
837
846
|
}), b;
|
|
838
847
|
}
|
|
839
|
-
|
|
840
|
-
const
|
|
848
|
+
rt(() => {
|
|
849
|
+
const R = l.clearControl$.subscribe((b) => {
|
|
841
850
|
b === !0 && u(!1);
|
|
842
851
|
}), _ = l.changeStart$.subscribe((b) => {
|
|
843
|
-
var
|
|
844
|
-
const { objects: w } = b,
|
|
845
|
-
if (
|
|
852
|
+
var D;
|
|
853
|
+
const { objects: w } = b, P = p(w, t);
|
|
854
|
+
if (P.length === 0)
|
|
846
855
|
u(!1);
|
|
847
|
-
else if (
|
|
856
|
+
else if (P.length >= 1) {
|
|
848
857
|
u(!0);
|
|
849
|
-
const
|
|
850
|
-
m(
|
|
858
|
+
const T = ((D = P[0]) == null ? void 0 : D.anchorType) || O.Position;
|
|
859
|
+
m(T);
|
|
851
860
|
}
|
|
852
861
|
});
|
|
853
862
|
return () => {
|
|
854
|
-
_.unsubscribe(),
|
|
863
|
+
_.unsubscribe(), R.unsubscribe();
|
|
855
864
|
};
|
|
856
865
|
}, []);
|
|
857
|
-
function
|
|
858
|
-
m(
|
|
866
|
+
function S(R) {
|
|
867
|
+
m(R);
|
|
859
868
|
const _ = t.getFocusDrawings();
|
|
860
869
|
if (_.length === 0)
|
|
861
870
|
return;
|
|
@@ -863,140 +872,140 @@ const Ar = "univer-image-common-panel", Nr = "univer-image-common-panel-grid", j
|
|
|
863
872
|
unitId: w.unitId,
|
|
864
873
|
subUnitId: w.subUnitId,
|
|
865
874
|
drawingId: w.drawingId,
|
|
866
|
-
anchorType:
|
|
875
|
+
anchorType: R
|
|
867
876
|
}));
|
|
868
|
-
e.executeCommand(
|
|
877
|
+
e.executeCommand(Fe.id, {
|
|
869
878
|
unitId: _[0].unitId,
|
|
870
879
|
drawings: b
|
|
871
880
|
});
|
|
872
881
|
}
|
|
873
|
-
const
|
|
874
|
-
return /* @__PURE__ */ L.createElement("div", { className:
|
|
875
|
-
},
|
|
876
|
-
const i =
|
|
877
|
-
return
|
|
882
|
+
const C = (R) => R ? "block" : "none";
|
|
883
|
+
return /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelGrid, Z.imageCommonPanelBorder), style: { display: C(c) } }, /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanelRow }, /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelColumn, Z.imageCommonPanelTitle) }, /* @__PURE__ */ L.createElement("div", null, n.t("drawing-anchor.title")))), /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelRow) }, /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelColumn) }, /* @__PURE__ */ L.createElement(cr, { value: f, onChange: S, direction: "vertical" }, /* @__PURE__ */ L.createElement(Xe, { value: O.Both }, n.t("drawing-anchor.both")), /* @__PURE__ */ L.createElement(Xe, { value: O.Position }, n.t("drawing-anchor.position")), /* @__PURE__ */ L.createElement(Xe, { value: O.None }, n.t("drawing-anchor.none"))))));
|
|
884
|
+
}, Kr = () => {
|
|
885
|
+
const i = q(z), e = i.getFocusDrawings(), [n, t] = et(e);
|
|
886
|
+
return rt(() => {
|
|
878
887
|
const r = i.focus$.subscribe((s) => {
|
|
879
888
|
t(s);
|
|
880
889
|
});
|
|
881
890
|
return () => {
|
|
882
891
|
r.unsubscribe();
|
|
883
892
|
};
|
|
884
|
-
}, []), !!(n != null && n.length) && /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanel }, /* @__PURE__ */ L.createElement(_n, { drawings: n }), /* @__PURE__ */ L.createElement(
|
|
885
|
-
},
|
|
893
|
+
}, []), !!(n != null && n.length) && /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanel }, /* @__PURE__ */ L.createElement(_n, { drawings: n }), /* @__PURE__ */ L.createElement(zr, { drawings: n }));
|
|
894
|
+
}, ve = {
|
|
886
895
|
id: "sheet.command.move-drawing",
|
|
887
|
-
type:
|
|
896
|
+
type: F.COMMAND,
|
|
888
897
|
handler: (i, e) => {
|
|
889
|
-
const n = i.get(
|
|
898
|
+
const n = i.get(V), t = i.get(k), r = i.get(Ge), { direction: s } = e, o = t.getFocusDrawings();
|
|
890
899
|
if (o.length === 0)
|
|
891
900
|
return !1;
|
|
892
901
|
const a = o[0].unitId, d = o.map((l) => {
|
|
893
902
|
const { transform: c } = l;
|
|
894
903
|
if (c == null)
|
|
895
904
|
return null;
|
|
896
|
-
const u = { ...c }, { left:
|
|
897
|
-
return s ===
|
|
905
|
+
const u = { ...c }, { left: g = 0, top: f = 0 } = c;
|
|
906
|
+
return s === Q.UP ? u.top = f - 1 : s === Q.DOWN ? u.top = f + 1 : s === Q.LEFT ? u.left = g - 1 : s === Q.RIGHT && (u.left = g + 1), {
|
|
898
907
|
...l,
|
|
899
908
|
transform: u,
|
|
900
909
|
sheetTransform: N(u, r)
|
|
901
910
|
};
|
|
902
911
|
}).filter((l) => l != null);
|
|
903
|
-
return n.syncExecuteCommand(
|
|
912
|
+
return n.syncExecuteCommand(Fe.id, {
|
|
904
913
|
unitId: a,
|
|
905
914
|
drawings: d
|
|
906
915
|
}) ? (n.syncExecuteCommand(j.id, [a]), !0) : !1;
|
|
907
916
|
}
|
|
908
917
|
}, Zt = {
|
|
909
918
|
id: "sheet.command.delete-drawing",
|
|
910
|
-
type:
|
|
919
|
+
type: F.COMMAND,
|
|
911
920
|
handler: (i) => {
|
|
912
|
-
const e = i.get(
|
|
921
|
+
const e = i.get(V), t = i.get(k).getFocusDrawings();
|
|
913
922
|
if (t.length === 0)
|
|
914
923
|
return !1;
|
|
915
924
|
const r = t[0].unitId, s = t.map((o) => {
|
|
916
|
-
const { unitId: a, subUnitId: d, drawingId:
|
|
925
|
+
const { unitId: a, subUnitId: d, drawingId: h, drawingType: l } = o;
|
|
917
926
|
return {
|
|
918
927
|
unitId: a,
|
|
919
928
|
subUnitId: d,
|
|
920
|
-
drawingId:
|
|
929
|
+
drawingId: h,
|
|
921
930
|
drawingType: l
|
|
922
931
|
};
|
|
923
932
|
});
|
|
924
|
-
return e.executeCommand(
|
|
933
|
+
return e.executeCommand(it.id, {
|
|
925
934
|
unitId: r,
|
|
926
935
|
drawings: s
|
|
927
936
|
});
|
|
928
937
|
}
|
|
929
938
|
};
|
|
930
|
-
function
|
|
939
|
+
function Se(i) {
|
|
931
940
|
return !i.getContextValue(on) && !i.getContextValue(an) && i.getContextValue(we);
|
|
932
941
|
}
|
|
933
|
-
const
|
|
934
|
-
id:
|
|
942
|
+
const Jr = {
|
|
943
|
+
id: ve.id,
|
|
935
944
|
description: "shortcut.sheet.drawing-move-down",
|
|
936
945
|
group: "4_sheet-drawing-view",
|
|
937
946
|
binding: ue.ARROW_DOWN,
|
|
938
947
|
priority: 100,
|
|
939
|
-
preconditions:
|
|
948
|
+
preconditions: Se,
|
|
940
949
|
staticParameters: {
|
|
941
|
-
direction:
|
|
950
|
+
direction: Q.DOWN
|
|
942
951
|
}
|
|
943
|
-
},
|
|
944
|
-
id:
|
|
952
|
+
}, Zr = {
|
|
953
|
+
id: ve.id,
|
|
945
954
|
description: "shortcut.sheet.drawing-move-up",
|
|
946
955
|
group: "4_sheet-drawing-view",
|
|
947
956
|
binding: ue.ARROW_UP,
|
|
948
957
|
priority: 100,
|
|
949
|
-
preconditions:
|
|
958
|
+
preconditions: Se,
|
|
950
959
|
staticParameters: {
|
|
951
|
-
direction:
|
|
960
|
+
direction: Q.UP
|
|
952
961
|
}
|
|
953
|
-
},
|
|
954
|
-
id:
|
|
962
|
+
}, qr = {
|
|
963
|
+
id: ve.id,
|
|
955
964
|
description: "shortcut.sheet.drawing-move-left",
|
|
956
965
|
group: "4_sheet-drawing-view",
|
|
957
966
|
binding: ue.ARROW_LEFT,
|
|
958
967
|
priority: 100,
|
|
959
|
-
preconditions:
|
|
968
|
+
preconditions: Se,
|
|
960
969
|
staticParameters: {
|
|
961
|
-
direction:
|
|
970
|
+
direction: Q.LEFT
|
|
962
971
|
}
|
|
963
|
-
},
|
|
964
|
-
id:
|
|
972
|
+
}, Qr = {
|
|
973
|
+
id: ve.id,
|
|
965
974
|
description: "shortcut.sheet.drawing-move-right",
|
|
966
975
|
group: "4_sheet-drawing-view",
|
|
967
976
|
binding: ue.ARROW_RIGHT,
|
|
968
977
|
priority: 100,
|
|
969
|
-
preconditions:
|
|
978
|
+
preconditions: Se,
|
|
970
979
|
staticParameters: {
|
|
971
|
-
direction:
|
|
980
|
+
direction: Q.RIGHT
|
|
972
981
|
}
|
|
973
|
-
},
|
|
982
|
+
}, ei = {
|
|
974
983
|
id: Zt.id,
|
|
975
984
|
description: "shortcut.sheet.drawing-delete",
|
|
976
985
|
group: "4_sheet-drawing-view",
|
|
977
986
|
// when focusing on any other input tag do not trigger this shortcut
|
|
978
|
-
preconditions:
|
|
987
|
+
preconditions: Se,
|
|
979
988
|
binding: ue.DELETE,
|
|
980
989
|
mac: ue.BACKSPACE
|
|
981
990
|
};
|
|
982
|
-
var
|
|
983
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
991
|
+
var ti = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, ri = (i, e, n, t) => {
|
|
992
|
+
for (var r = t > 1 ? void 0 : t ? ni(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
984
993
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
985
|
-
return t && r &&
|
|
994
|
+
return t && r && ti(e, n, r), r;
|
|
986
995
|
}, me = (i, e) => (n, t) => e(n, t, i);
|
|
987
|
-
const
|
|
988
|
-
let pe = class extends
|
|
996
|
+
const ii = {};
|
|
997
|
+
let pe = class extends oe {
|
|
989
998
|
constructor(i, e, n, t, r, s) {
|
|
990
999
|
super(), this._config = i, this._injector = e, this._componentManager = n, this._menuService = t, this._commandService = r, this._shortcutService = s, this._init();
|
|
991
1000
|
}
|
|
992
1001
|
_initCustomComponents() {
|
|
993
1002
|
const i = this._componentManager;
|
|
994
|
-
this.disposeWithMe(i.register(Kt,
|
|
1003
|
+
this.disposeWithMe(i.register(Kt, Xt)), this.disposeWithMe(i.register(zt, Pr)), this.disposeWithMe(i.register($t, Kr));
|
|
995
1004
|
}
|
|
996
1005
|
_initMenus() {
|
|
997
1006
|
const { menu: i = {} } = this._config;
|
|
998
1007
|
[
|
|
999
|
-
|
|
1008
|
+
Tr,
|
|
1000
1009
|
Ur
|
|
1001
1010
|
// UploadCellImageMenuFactory,
|
|
1002
1011
|
].forEach((e) => {
|
|
@@ -1005,29 +1014,29 @@ let pe = class extends de {
|
|
|
1005
1014
|
}
|
|
1006
1015
|
_initCommands() {
|
|
1007
1016
|
[
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1017
|
+
xe,
|
|
1018
|
+
Be,
|
|
1019
|
+
st,
|
|
1020
|
+
it,
|
|
1021
|
+
Fe,
|
|
1013
1022
|
Vt,
|
|
1014
1023
|
j,
|
|
1024
|
+
Gt,
|
|
1025
|
+
Ft,
|
|
1015
1026
|
Yt,
|
|
1016
|
-
|
|
1017
|
-
xt,
|
|
1018
|
-
Ce,
|
|
1027
|
+
ve,
|
|
1019
1028
|
Zt,
|
|
1020
|
-
|
|
1029
|
+
xt
|
|
1021
1030
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
1022
1031
|
}
|
|
1023
1032
|
_initShortcuts() {
|
|
1024
1033
|
[
|
|
1025
1034
|
// sheet drawing shortcuts
|
|
1026
|
-
Kr,
|
|
1027
1035
|
Jr,
|
|
1028
1036
|
Zr,
|
|
1029
1037
|
qr,
|
|
1030
|
-
Qr
|
|
1038
|
+
Qr,
|
|
1039
|
+
ei
|
|
1031
1040
|
].forEach((i) => {
|
|
1032
1041
|
this.disposeWithMe(this._shortcutService.registerShortcut(i));
|
|
1033
1042
|
});
|
|
@@ -1036,38 +1045,37 @@ let pe = class extends de {
|
|
|
1036
1045
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
1037
1046
|
}
|
|
1038
1047
|
};
|
|
1039
|
-
pe =
|
|
1040
|
-
|
|
1041
|
-
me(1, W(
|
|
1042
|
-
me(2, W(
|
|
1043
|
-
me(3,
|
|
1044
|
-
me(4,
|
|
1045
|
-
me(5,
|
|
1048
|
+
pe = ri([
|
|
1049
|
+
ie(se.Rendered, pe),
|
|
1050
|
+
me(1, W(nt)),
|
|
1051
|
+
me(2, W(Xn)),
|
|
1052
|
+
me(3, zn),
|
|
1053
|
+
me(4, V),
|
|
1054
|
+
me(5, Kn)
|
|
1046
1055
|
], pe);
|
|
1047
|
-
var
|
|
1048
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1056
|
+
var si = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, ai = (i, e, n, t) => {
|
|
1057
|
+
for (var r = t > 1 ? void 0 : t ? oi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1049
1058
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
1050
|
-
return t && r &&
|
|
1051
|
-
},
|
|
1052
|
-
const
|
|
1053
|
-
Ct.id,
|
|
1054
|
-
Rt.id,
|
|
1059
|
+
return t && r && si(e, n, r), r;
|
|
1060
|
+
}, ce = (i, e) => (n, t) => e(n, t, i);
|
|
1061
|
+
const ci = [
|
|
1055
1062
|
It.id,
|
|
1056
|
-
|
|
1063
|
+
Rt.id,
|
|
1057
1064
|
Mt.id,
|
|
1065
|
+
Dt.id,
|
|
1058
1066
|
bt.id,
|
|
1059
|
-
Ot.id,
|
|
1060
1067
|
Et.id,
|
|
1061
|
-
tt.id,
|
|
1062
|
-
nt.id,
|
|
1063
1068
|
yt.id,
|
|
1064
|
-
|
|
1069
|
+
Ot.id,
|
|
1070
|
+
qe.id,
|
|
1071
|
+
Qe.id,
|
|
1065
1072
|
Pt.id,
|
|
1073
|
+
Tt.id,
|
|
1066
1074
|
Ut.id,
|
|
1067
1075
|
At.id,
|
|
1068
1076
|
Nt.id,
|
|
1069
1077
|
jt.id
|
|
1070
|
-
],
|
|
1078
|
+
], di = [
|
|
1071
1079
|
Qn.id,
|
|
1072
1080
|
er.id,
|
|
1073
1081
|
tr.id,
|
|
@@ -1075,9 +1083,21 @@ const ai = [
|
|
|
1075
1083
|
rr.id,
|
|
1076
1084
|
ir.id
|
|
1077
1085
|
];
|
|
1078
|
-
let
|
|
1079
|
-
constructor(i, e, n, t, r, s
|
|
1080
|
-
super(), this.
|
|
1086
|
+
let Ae = class extends oe {
|
|
1087
|
+
constructor(i, e, n, t, r, s) {
|
|
1088
|
+
super(), this._commandService = i, this._sheetInterceptorService = e, this._renderManagerService = n, this._sheetDrawingService = t, this._drawingManagerService = r, this._univerInstanceService = s, this._init();
|
|
1089
|
+
}
|
|
1090
|
+
// TODO@wzhudev: selection render service would be a render unit, we we cannot
|
|
1091
|
+
// easily access it here.
|
|
1092
|
+
get _selectionRenderService() {
|
|
1093
|
+
return this._renderManagerService.getRenderById(
|
|
1094
|
+
this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET).getUnitId()
|
|
1095
|
+
).with(Ge);
|
|
1096
|
+
}
|
|
1097
|
+
get _skeletonManagerService() {
|
|
1098
|
+
return this._renderManagerService.getRenderById(
|
|
1099
|
+
this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET).getUnitId()
|
|
1100
|
+
).with(re);
|
|
1081
1101
|
}
|
|
1082
1102
|
_init() {
|
|
1083
1103
|
this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
|
|
@@ -1086,57 +1106,55 @@ let We = class extends de {
|
|
|
1086
1106
|
this.disposeWithMe(
|
|
1087
1107
|
this._sheetInterceptorService.interceptCommand({
|
|
1088
1108
|
getMutations: (i) => {
|
|
1089
|
-
if (!
|
|
1109
|
+
if (!ci.includes(i.id))
|
|
1090
1110
|
return { redos: [], undos: [] };
|
|
1091
1111
|
if (i.params == null)
|
|
1092
1112
|
return { redos: [], undos: [] };
|
|
1093
1113
|
const e = i.id;
|
|
1094
|
-
if (e ===
|
|
1114
|
+
if (e === It.id)
|
|
1095
1115
|
return this._moveRowInterceptor(i.params, "insert");
|
|
1096
1116
|
if (e === Rt.id)
|
|
1097
1117
|
return this._moveColInterceptor(i.params, "insert");
|
|
1098
|
-
if (e ===
|
|
1118
|
+
if (e === Mt.id)
|
|
1099
1119
|
return this._moveRowInterceptor(i.params, "remove");
|
|
1100
1120
|
if (e === Dt.id)
|
|
1101
1121
|
return this._moveColInterceptor(i.params, "remove");
|
|
1102
|
-
if (e ===
|
|
1103
|
-
return this._moveRangeInterceptor(i.params);
|
|
1104
|
-
if (e === Mt.id) {
|
|
1122
|
+
if (e === bt.id) {
|
|
1105
1123
|
const { range: n } = i.params;
|
|
1106
1124
|
return this._getRangeMoveUndo(
|
|
1107
1125
|
n,
|
|
1108
1126
|
0
|
|
1109
1127
|
/* deleteLeft */
|
|
1110
1128
|
);
|
|
1111
|
-
} else if (e ===
|
|
1129
|
+
} else if (e === Et.id) {
|
|
1112
1130
|
const { range: n } = i.params;
|
|
1113
1131
|
return this._getRangeMoveUndo(
|
|
1114
1132
|
n,
|
|
1115
1133
|
1
|
|
1116
1134
|
/* deleteUp */
|
|
1117
1135
|
);
|
|
1118
|
-
} else if (e ===
|
|
1136
|
+
} else if (e === yt.id) {
|
|
1119
1137
|
const { range: n } = i.params;
|
|
1120
1138
|
return this._getRangeMoveUndo(
|
|
1121
1139
|
n,
|
|
1122
1140
|
2
|
|
1123
1141
|
/* insertDown */
|
|
1124
1142
|
);
|
|
1125
|
-
} else if (e ===
|
|
1143
|
+
} else if (e === Ot.id) {
|
|
1126
1144
|
const { range: n } = i.params;
|
|
1127
1145
|
return this._getRangeMoveUndo(
|
|
1128
1146
|
n,
|
|
1129
1147
|
3
|
|
1130
1148
|
/* insertRight */
|
|
1131
1149
|
);
|
|
1132
|
-
} else if (e ===
|
|
1150
|
+
} else if (e === Ut.id || e === At.id) {
|
|
1133
1151
|
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
|
|
1134
1152
|
return this._getDrawingUndoForRowVisible(t, r, s);
|
|
1135
|
-
} else if (e ===
|
|
1153
|
+
} else if (e === Nt.id || e === jt.id) {
|
|
1136
1154
|
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
|
|
1137
1155
|
return this._getDrawingUndoForColVisible(t, r, s);
|
|
1138
|
-
} else if (e ===
|
|
1139
|
-
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e ===
|
|
1156
|
+
} else if (e === qe.id || e === Qe.id || e === Pt.id || e === Tt.id) {
|
|
1157
|
+
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e === qe.id || e === Qe.id;
|
|
1140
1158
|
return this._getDrawingUndoForRowAndColSize(t, r, s, o);
|
|
1141
1159
|
}
|
|
1142
1160
|
return { redos: [], undos: [] };
|
|
@@ -1145,22 +1163,22 @@ let We = class extends de {
|
|
|
1145
1163
|
);
|
|
1146
1164
|
}
|
|
1147
1165
|
_getRangeMoveUndo(i, e) {
|
|
1148
|
-
const n =
|
|
1166
|
+
const n = le(this._univerInstanceService);
|
|
1149
1167
|
if (n == null)
|
|
1150
1168
|
return { redos: [], undos: [] };
|
|
1151
|
-
const t = n.unitId, r = n.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(t, r), d = [],
|
|
1169
|
+
const t = n.unitId, r = n.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(t, r), d = [], h = [];
|
|
1152
1170
|
if (Object.keys(a).forEach((l) => {
|
|
1153
|
-
const c = a[l], { updateDrawings: u, deleteDrawings:
|
|
1154
|
-
d.push(...u),
|
|
1155
|
-
}), d.length === 0 &&
|
|
1171
|
+
const c = a[l], { updateDrawings: u, deleteDrawings: g } = this._getUpdateOrDeleteDrawings(i, e, c);
|
|
1172
|
+
d.push(...u), h.push(...g);
|
|
1173
|
+
}), d.length === 0 && h.length === 0)
|
|
1156
1174
|
return { redos: [], undos: [] };
|
|
1157
1175
|
if (d.length > 0) {
|
|
1158
|
-
const l = this._sheetDrawingService.getBatchUpdateOp(d), { undo: c, redo: u, objects:
|
|
1159
|
-
s.push({ id:
|
|
1176
|
+
const l = this._sheetDrawingService.getBatchUpdateOp(d), { undo: c, redo: u, objects: g } = l;
|
|
1177
|
+
s.push({ id: E.id, params: { unitId: t, subUnitId: r, op: u, objects: g, type: y.UPDATE } }), o.push({ id: E.id, params: { unitId: t, subUnitId: r, op: c, objects: g, type: y.UPDATE } });
|
|
1160
1178
|
}
|
|
1161
|
-
if (
|
|
1162
|
-
const l = this._sheetDrawingService.getBatchRemoveOp(
|
|
1163
|
-
s.push({ id:
|
|
1179
|
+
if (h.length > 0) {
|
|
1180
|
+
const l = this._sheetDrawingService.getBatchRemoveOp(h), c = l.undo, u = l.redo, g = l.objects;
|
|
1181
|
+
s.push({ id: E.id, params: { unitId: t, subUnitId: r, op: u, objects: g, type: y.REMOVE } }), o.push({ id: E.id, params: { unitId: t, subUnitId: r, op: c, objects: g, type: y.INSERT } });
|
|
1164
1182
|
}
|
|
1165
1183
|
return s.push({ id: j.id, params: [t] }), o.push({ id: j.id, params: [t] }), {
|
|
1166
1184
|
redos: s,
|
|
@@ -1168,37 +1186,37 @@ let We = class extends de {
|
|
|
1168
1186
|
};
|
|
1169
1187
|
}
|
|
1170
1188
|
_getUpdateOrDeleteDrawings(i, e, n) {
|
|
1171
|
-
const t = [], r = [], { sheetTransform: s, anchorType: o =
|
|
1189
|
+
const t = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: a, unitId: d, subUnitId: h, drawingId: l } = n, { from: c, to: u } = s, { row: g, column: f } = c, { row: m, column: p } = u;
|
|
1172
1190
|
if (s == null || a == null)
|
|
1173
1191
|
return {
|
|
1174
1192
|
updateDrawings: t,
|
|
1175
1193
|
deleteDrawings: r
|
|
1176
1194
|
};
|
|
1177
|
-
const { startRow:
|
|
1195
|
+
const { startRow: S, endRow: C, startColumn: v, endColumn: R } = i;
|
|
1178
1196
|
let _ = null, b = null;
|
|
1179
|
-
if (e === 0 &&
|
|
1180
|
-
if (f >=
|
|
1181
|
-
r.push({ unitId: d, subUnitId:
|
|
1197
|
+
if (e === 0 && g >= S && m <= C)
|
|
1198
|
+
if (f >= v && p <= R)
|
|
1199
|
+
r.push({ unitId: d, subUnitId: h, drawingId: l });
|
|
1182
1200
|
else {
|
|
1183
|
-
const w = this._shrinkCol(s, a,
|
|
1201
|
+
const w = this._shrinkCol(s, a, v, R, o);
|
|
1184
1202
|
_ = w == null ? void 0 : w.newSheetTransform, b = w == null ? void 0 : w.newTransform;
|
|
1185
1203
|
}
|
|
1186
|
-
else if (e === 1 && f >=
|
|
1187
|
-
if (
|
|
1188
|
-
r.push({ unitId: d, subUnitId:
|
|
1204
|
+
else if (e === 1 && f >= v && p <= R)
|
|
1205
|
+
if (g >= S && m <= C)
|
|
1206
|
+
r.push({ unitId: d, subUnitId: h, drawingId: l });
|
|
1189
1207
|
else {
|
|
1190
|
-
const w = this._shrinkRow(s, a,
|
|
1208
|
+
const w = this._shrinkRow(s, a, S, C, o);
|
|
1191
1209
|
_ = w == null ? void 0 : w.newSheetTransform, b = w == null ? void 0 : w.newTransform;
|
|
1192
1210
|
}
|
|
1193
1211
|
else if (e === 2) {
|
|
1194
|
-
const w = this._expandRow(s, a,
|
|
1212
|
+
const w = this._expandRow(s, a, S, C, o);
|
|
1195
1213
|
_ = w == null ? void 0 : w.newSheetTransform, b = w == null ? void 0 : w.newTransform;
|
|
1196
1214
|
} else if (e === 3) {
|
|
1197
|
-
const w = this._expandCol(s, a,
|
|
1215
|
+
const w = this._expandCol(s, a, v, R, o);
|
|
1198
1216
|
_ = w == null ? void 0 : w.newSheetTransform, b = w == null ? void 0 : w.newTransform;
|
|
1199
1217
|
}
|
|
1200
1218
|
if (_ != null && b != null) {
|
|
1201
|
-
const w =
|
|
1219
|
+
const w = $(_, this._selectionRenderService, this._skeletonManagerService);
|
|
1202
1220
|
t.push({ ...n, sheetTransform: _, transform: w });
|
|
1203
1221
|
}
|
|
1204
1222
|
return { updateDrawings: t, deleteDrawings: r };
|
|
@@ -1214,89 +1232,89 @@ let We = class extends de {
|
|
|
1214
1232
|
_getDrawingUndoForColVisible(i, e, n) {
|
|
1215
1233
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
|
|
1216
1234
|
if (Object.keys(t).forEach((l) => {
|
|
1217
|
-
const c = t[l], { sheetTransform: u, transform:
|
|
1218
|
-
if (f ===
|
|
1219
|
-
this._remainDrawingSize(
|
|
1235
|
+
const c = t[l], { sheetTransform: u, transform: g, anchorType: f = O.Position } = c;
|
|
1236
|
+
if (f === O.None)
|
|
1237
|
+
this._remainDrawingSize(g, r, c);
|
|
1220
1238
|
else {
|
|
1221
|
-
const { from: m, to: p } = u, { row:
|
|
1239
|
+
const { from: m, to: p } = u, { row: S, column: C } = m, { row: v, column: R } = p;
|
|
1222
1240
|
for (let _ = 0; _ < n.length; _++) {
|
|
1223
|
-
const b = n[_], { startRow: w, endRow:
|
|
1224
|
-
if (
|
|
1241
|
+
const b = n[_], { startRow: w, endRow: P, startColumn: D, endColumn: T } = b;
|
|
1242
|
+
if (R < D)
|
|
1225
1243
|
continue;
|
|
1226
|
-
if (f ===
|
|
1227
|
-
let
|
|
1228
|
-
if (
|
|
1229
|
-
const
|
|
1230
|
-
if (
|
|
1244
|
+
if (f === O.Position) {
|
|
1245
|
+
let I = null, A = null;
|
|
1246
|
+
if (C >= D && C <= T) {
|
|
1247
|
+
const G = this._skeletonManagerService.attachRangeWithCoord({ startColumn: C, endColumn: T, startRow: m.row, endRow: p.row });
|
|
1248
|
+
if (G == null)
|
|
1231
1249
|
return;
|
|
1232
|
-
A = { ...
|
|
1250
|
+
A = { ...g, left: G.startX };
|
|
1233
1251
|
}
|
|
1234
|
-
if (A != null && (
|
|
1235
|
-
r.push({ ...c, sheetTransform:
|
|
1252
|
+
if (A != null && (I = N(A, this._selectionRenderService), I != null && A != null)) {
|
|
1253
|
+
r.push({ ...c, sheetTransform: I, transform: A });
|
|
1236
1254
|
break;
|
|
1237
1255
|
}
|
|
1238
|
-
this._remainDrawingSize(
|
|
1256
|
+
this._remainDrawingSize(g, r, c);
|
|
1239
1257
|
continue;
|
|
1240
1258
|
}
|
|
1241
|
-
if (
|
|
1259
|
+
if (C >= D && R <= T)
|
|
1242
1260
|
continue;
|
|
1243
|
-
let
|
|
1244
|
-
if (
|
|
1245
|
-
const
|
|
1246
|
-
if (
|
|
1261
|
+
let U = null, M = null;
|
|
1262
|
+
if (C >= D && C <= T) {
|
|
1263
|
+
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: C, endColumn: T, startRow: m.row, endRow: p.row });
|
|
1264
|
+
if (I == null)
|
|
1247
1265
|
return;
|
|
1248
1266
|
M = {
|
|
1249
|
-
...
|
|
1250
|
-
left: (
|
|
1251
|
-
width: ((
|
|
1267
|
+
...g,
|
|
1268
|
+
left: (I == null ? void 0 : I.startX) || 0,
|
|
1269
|
+
width: ((g == null ? void 0 : g.width) || 0) - I.endX + I.startX
|
|
1252
1270
|
};
|
|
1253
|
-
} else if (
|
|
1254
|
-
const
|
|
1255
|
-
if (
|
|
1271
|
+
} else if (R >= D && R <= T) {
|
|
1272
|
+
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn: R, startRow: m.row, endRow: p.row });
|
|
1273
|
+
if (I == null)
|
|
1256
1274
|
return;
|
|
1257
1275
|
M = {
|
|
1258
|
-
...
|
|
1259
|
-
left:
|
|
1276
|
+
...g,
|
|
1277
|
+
left: I.startX - ((g == null ? void 0 : g.width) || 0)
|
|
1260
1278
|
};
|
|
1261
1279
|
} else {
|
|
1262
|
-
const
|
|
1263
|
-
if (
|
|
1280
|
+
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn: T, startRow: m.row, endRow: p.row });
|
|
1281
|
+
if (I == null)
|
|
1264
1282
|
return;
|
|
1265
1283
|
if (M = {
|
|
1266
|
-
...
|
|
1267
|
-
width: ((
|
|
1268
|
-
},
|
|
1269
|
-
s.push({ ...c, sheetTransform:
|
|
1284
|
+
...g,
|
|
1285
|
+
width: ((g == null ? void 0 : g.width) || 0) - I.endX + I.startX
|
|
1286
|
+
}, U = N(M, this._selectionRenderService), U != null && M != null) {
|
|
1287
|
+
s.push({ ...c, sheetTransform: U, transform: M });
|
|
1270
1288
|
break;
|
|
1271
1289
|
}
|
|
1272
1290
|
}
|
|
1273
|
-
if (M != null && (
|
|
1274
|
-
r.push({ ...c, sheetTransform:
|
|
1291
|
+
if (M != null && (U = N(M, this._selectionRenderService)), M != null && U != null) {
|
|
1292
|
+
r.push({ ...c, sheetTransform: U, transform: M });
|
|
1275
1293
|
break;
|
|
1276
1294
|
} else
|
|
1277
|
-
this._remainDrawingSize(
|
|
1295
|
+
this._remainDrawingSize(g, r, c);
|
|
1278
1296
|
}
|
|
1279
1297
|
}
|
|
1280
1298
|
}), r.length === 0 && s.length === 0)
|
|
1281
1299
|
return { redos: [], undos: [] };
|
|
1282
|
-
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, e, r), d = [],
|
|
1300
|
+
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, e, r), d = [], h = [];
|
|
1283
1301
|
if (s.length > 0) {
|
|
1284
1302
|
const { redos: l, undos: c } = this._createUndoAndRedoMutation(i, e, s);
|
|
1285
|
-
d.push(...l),
|
|
1303
|
+
d.push(...l), h.push(...c);
|
|
1286
1304
|
}
|
|
1287
1305
|
return {
|
|
1288
1306
|
redos: o,
|
|
1289
1307
|
undos: a,
|
|
1290
1308
|
preRedos: d,
|
|
1291
|
-
preUndos:
|
|
1309
|
+
preUndos: h
|
|
1292
1310
|
};
|
|
1293
1311
|
}
|
|
1294
1312
|
_createUndoAndRedoMutation(i, e, n) {
|
|
1295
1313
|
const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: r, redo: s, objects: o } = t, a = [
|
|
1296
|
-
{ id:
|
|
1314
|
+
{ id: E.id, params: { unitId: i, subUnitId: e, op: s, objects: o, type: y.UPDATE } },
|
|
1297
1315
|
{ id: j.id, params: [i] }
|
|
1298
1316
|
], d = [
|
|
1299
|
-
{ id:
|
|
1317
|
+
{ id: E.id, params: { unitId: i, subUnitId: e, op: r, objects: o, type: y.UPDATE } },
|
|
1300
1318
|
{ id: j.id, params: [i] }
|
|
1301
1319
|
];
|
|
1302
1320
|
return {
|
|
@@ -1308,100 +1326,104 @@ let We = class extends de {
|
|
|
1308
1326
|
_getDrawingUndoForRowVisible(i, e, n) {
|
|
1309
1327
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
|
|
1310
1328
|
if (Object.keys(t).forEach((l) => {
|
|
1311
|
-
const c = t[l], { sheetTransform: u, transform:
|
|
1312
|
-
if (f ===
|
|
1313
|
-
this._remainDrawingSize(
|
|
1329
|
+
const c = t[l], { sheetTransform: u, transform: g, anchorType: f = O.Position } = c;
|
|
1330
|
+
if (f === O.None)
|
|
1331
|
+
this._remainDrawingSize(g, r, c);
|
|
1314
1332
|
else {
|
|
1315
|
-
const { from: m, to: p } = u, { row:
|
|
1333
|
+
const { from: m, to: p } = u, { row: S, column: C } = m, { row: v, column: R } = p;
|
|
1316
1334
|
for (let _ = 0; _ < n.length; _++) {
|
|
1317
|
-
const b = n[_], { startRow: w, endRow:
|
|
1318
|
-
if (
|
|
1335
|
+
const b = n[_], { startRow: w, endRow: P, startColumn: D, endColumn: T } = b;
|
|
1336
|
+
if (v < w)
|
|
1319
1337
|
continue;
|
|
1320
|
-
if (f ===
|
|
1321
|
-
let
|
|
1322
|
-
if (
|
|
1323
|
-
const
|
|
1324
|
-
if (
|
|
1338
|
+
if (f === O.Position) {
|
|
1339
|
+
let I = null, A = null;
|
|
1340
|
+
if (S >= w && S <= P) {
|
|
1341
|
+
const G = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: S, endRow: P });
|
|
1342
|
+
if (G == null)
|
|
1325
1343
|
return;
|
|
1326
|
-
A = { ...
|
|
1344
|
+
A = { ...g, top: G.startY };
|
|
1327
1345
|
}
|
|
1328
|
-
if (A != null && (
|
|
1329
|
-
r.push({ ...c, sheetTransform:
|
|
1346
|
+
if (A != null && (I = N(A, this._selectionRenderService), I != null && A != null)) {
|
|
1347
|
+
r.push({ ...c, sheetTransform: I, transform: A });
|
|
1330
1348
|
break;
|
|
1331
1349
|
}
|
|
1332
|
-
this._remainDrawingSize(
|
|
1350
|
+
this._remainDrawingSize(g, r, c);
|
|
1333
1351
|
continue;
|
|
1334
1352
|
}
|
|
1335
|
-
if (
|
|
1353
|
+
if (S >= w && v <= P)
|
|
1336
1354
|
continue;
|
|
1337
|
-
let
|
|
1338
|
-
if (
|
|
1339
|
-
const
|
|
1340
|
-
if (
|
|
1355
|
+
let U = null, M = null;
|
|
1356
|
+
if (S >= w && S <= P) {
|
|
1357
|
+
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: S, endRow: P });
|
|
1358
|
+
if (I == null)
|
|
1341
1359
|
return;
|
|
1342
1360
|
M = {
|
|
1343
|
-
...
|
|
1344
|
-
top: (
|
|
1345
|
-
height: ((
|
|
1361
|
+
...g,
|
|
1362
|
+
top: (I == null ? void 0 : I.startY) || 0,
|
|
1363
|
+
height: ((g == null ? void 0 : g.height) || 0) - I.endY + I.startY
|
|
1346
1364
|
};
|
|
1347
|
-
} else if (
|
|
1348
|
-
const
|
|
1349
|
-
if (
|
|
1365
|
+
} else if (v >= w && v <= P) {
|
|
1366
|
+
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow: v });
|
|
1367
|
+
if (I == null)
|
|
1350
1368
|
return;
|
|
1351
1369
|
M = {
|
|
1352
|
-
...
|
|
1353
|
-
top:
|
|
1370
|
+
...g,
|
|
1371
|
+
top: I.startY - ((g == null ? void 0 : g.height) || 0)
|
|
1354
1372
|
};
|
|
1355
1373
|
} else {
|
|
1356
|
-
const
|
|
1357
|
-
if (
|
|
1374
|
+
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow: P });
|
|
1375
|
+
if (I == null)
|
|
1358
1376
|
return;
|
|
1359
1377
|
if (M = {
|
|
1360
|
-
...
|
|
1361
|
-
height: ((
|
|
1362
|
-
},
|
|
1363
|
-
s.push({ ...c, sheetTransform:
|
|
1378
|
+
...g,
|
|
1379
|
+
height: ((g == null ? void 0 : g.height) || 0) - I.endY + I.startY
|
|
1380
|
+
}, U = N(M, this._selectionRenderService), U != null && M != null) {
|
|
1381
|
+
s.push({ ...c, sheetTransform: U, transform: M });
|
|
1364
1382
|
break;
|
|
1365
1383
|
}
|
|
1366
1384
|
}
|
|
1367
|
-
if (M != null && (
|
|
1368
|
-
r.push({ ...c, sheetTransform:
|
|
1385
|
+
if (M != null && (U = N(M, this._selectionRenderService)), M != null && U != null) {
|
|
1386
|
+
r.push({ ...c, sheetTransform: U, transform: M });
|
|
1369
1387
|
break;
|
|
1370
1388
|
} else
|
|
1371
|
-
this._remainDrawingSize(
|
|
1389
|
+
this._remainDrawingSize(g, r, c);
|
|
1372
1390
|
}
|
|
1373
1391
|
}
|
|
1374
1392
|
}), r.length === 0 && s.length === 0)
|
|
1375
1393
|
return { redos: [], undos: [] };
|
|
1376
|
-
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, e, r), d = [],
|
|
1394
|
+
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, e, r), d = [], h = [];
|
|
1377
1395
|
if (s.length > 0) {
|
|
1378
1396
|
const { redos: l, undos: c } = this._createUndoAndRedoMutation(i, e, s);
|
|
1379
|
-
d.push(...l),
|
|
1397
|
+
d.push(...l), h.push(...c);
|
|
1380
1398
|
}
|
|
1381
1399
|
return {
|
|
1382
1400
|
redos: o,
|
|
1383
1401
|
undos: a,
|
|
1384
1402
|
preRedos: d,
|
|
1385
|
-
preUndos:
|
|
1403
|
+
preUndos: h
|
|
1386
1404
|
};
|
|
1387
1405
|
}
|
|
1388
1406
|
_getDrawingUndoForRowAndColSize(i, e, n, t) {
|
|
1389
1407
|
const r = this._drawingManagerService.getDrawingData(i, e), s = [];
|
|
1390
1408
|
return Object.keys(r).forEach((o) => {
|
|
1391
|
-
const a = r[o], { sheetTransform: d, transform:
|
|
1392
|
-
if (l ===
|
|
1393
|
-
this._remainDrawingSize(
|
|
1409
|
+
const a = r[o], { sheetTransform: d, transform: h, anchorType: l = O.Position } = a;
|
|
1410
|
+
if (l === O.None)
|
|
1411
|
+
this._remainDrawingSize(h, s, a);
|
|
1394
1412
|
else {
|
|
1395
|
-
const { from: c, to: u } = d, { row:
|
|
1396
|
-
for (let
|
|
1397
|
-
const
|
|
1398
|
-
if (m <
|
|
1413
|
+
const { from: c, to: u } = d, { row: g, column: f } = c, { row: m, column: p } = u;
|
|
1414
|
+
for (let S = 0; S < n.length; S++) {
|
|
1415
|
+
const C = n[S], { startRow: v, endRow: R, startColumn: _, endColumn: b } = C;
|
|
1416
|
+
if (m < v || p < _)
|
|
1399
1417
|
continue;
|
|
1400
|
-
if (l ===
|
|
1401
|
-
this._remainDrawingSize(
|
|
1418
|
+
if (l === O.Position && (g <= v && m >= R || f <= _ && p >= b)) {
|
|
1419
|
+
this._remainDrawingSize(h, s, a);
|
|
1402
1420
|
continue;
|
|
1403
1421
|
}
|
|
1404
|
-
const w =
|
|
1422
|
+
const w = $(
|
|
1423
|
+
{ ...d },
|
|
1424
|
+
this._selectionRenderService,
|
|
1425
|
+
this._skeletonManagerService
|
|
1426
|
+
);
|
|
1405
1427
|
if (w != null) {
|
|
1406
1428
|
s.push({
|
|
1407
1429
|
...a,
|
|
@@ -1418,7 +1440,7 @@ let We = class extends de {
|
|
|
1418
1440
|
if (e === "insert")
|
|
1419
1441
|
n = i.unitId, t = i.subUnitId;
|
|
1420
1442
|
else {
|
|
1421
|
-
const r =
|
|
1443
|
+
const r = le(this._univerInstanceService);
|
|
1422
1444
|
if (r == null)
|
|
1423
1445
|
return;
|
|
1424
1446
|
n = r.unitId, t = r.subUnitId;
|
|
@@ -1429,160 +1451,100 @@ let We = class extends de {
|
|
|
1429
1451
|
const n = this._getUnitIdAndSubUnitId(i, e);
|
|
1430
1452
|
if (n == null)
|
|
1431
1453
|
return { redos: [], undos: [] };
|
|
1432
|
-
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, a = s.endRow, d = [],
|
|
1433
|
-
if (Object.keys(l).forEach((
|
|
1434
|
-
const f = l[
|
|
1454
|
+
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, a = s.endRow, d = [], h = [], l = this._sheetDrawingService.getDrawingData(t, r), c = [], u = [];
|
|
1455
|
+
if (Object.keys(l).forEach((g) => {
|
|
1456
|
+
const f = l[g], { sheetTransform: m, transform: p, anchorType: S = O.Position } = f;
|
|
1435
1457
|
if (m == null || p == null)
|
|
1436
1458
|
return;
|
|
1437
|
-
let
|
|
1459
|
+
let C, v;
|
|
1438
1460
|
if (e === "insert") {
|
|
1439
|
-
const _ = this._expandRow(m, p, o, a,
|
|
1440
|
-
|
|
1461
|
+
const _ = this._expandRow(m, p, o, a, S);
|
|
1462
|
+
C = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
|
|
1441
1463
|
} else {
|
|
1442
|
-
const { from: _, to: b } = m, { row: w } = _, { row:
|
|
1443
|
-
if (
|
|
1444
|
-
u.push({ unitId: t, subUnitId: r, drawingId:
|
|
1464
|
+
const { from: _, to: b } = m, { row: w } = _, { row: P } = b;
|
|
1465
|
+
if (w >= o && P <= a)
|
|
1466
|
+
u.push({ unitId: t, subUnitId: r, drawingId: g });
|
|
1445
1467
|
else {
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1468
|
+
const D = this._shrinkRow(m, p, o, a, S);
|
|
1469
|
+
C = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
|
|
1448
1470
|
}
|
|
1449
1471
|
}
|
|
1450
|
-
if (!
|
|
1472
|
+
if (!C || !v)
|
|
1451
1473
|
return;
|
|
1452
|
-
const
|
|
1453
|
-
c.push(
|
|
1474
|
+
const R = { unitId: t, subUnitId: r, drawingId: g, transform: v, sheetTransform: C };
|
|
1475
|
+
c.push(R);
|
|
1454
1476
|
}), c.length === 0 && u.length === 0)
|
|
1455
1477
|
return { redos: [], undos: [] };
|
|
1456
1478
|
if (c.length > 0) {
|
|
1457
|
-
const
|
|
1458
|
-
d.push({ id:
|
|
1479
|
+
const g = this._sheetDrawingService.getBatchUpdateOp(c), { undo: f, redo: m, objects: p } = g;
|
|
1480
|
+
d.push({ id: E.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: y.UPDATE } }), h.push({ id: E.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: y.UPDATE } });
|
|
1459
1481
|
}
|
|
1460
1482
|
if (u.length > 0) {
|
|
1461
|
-
const
|
|
1462
|
-
d.push({ id:
|
|
1483
|
+
const g = this._sheetDrawingService.getBatchRemoveOp(u), f = g.undo, m = g.redo, p = g.objects;
|
|
1484
|
+
d.push({ id: E.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: y.REMOVE } }), h.push({ id: E.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: y.INSERT } });
|
|
1463
1485
|
}
|
|
1464
|
-
return d.push({ id: j.id, params: [t] }),
|
|
1486
|
+
return d.push({ id: j.id, params: [t] }), h.push({ id: j.id, params: [t] }), {
|
|
1465
1487
|
redos: d,
|
|
1466
|
-
undos:
|
|
1488
|
+
undos: h
|
|
1467
1489
|
};
|
|
1468
1490
|
}
|
|
1469
|
-
_moveRangeInterceptor(i) {
|
|
1470
|
-
const { fromRange: e, toRange: n } = i, t = oe(this._univerInstanceService);
|
|
1471
|
-
if (!t)
|
|
1472
|
-
return { redos: [], undos: [] };
|
|
1473
|
-
const { unitId: r, subUnitId: s } = t, o = this._sheetDrawingService.getDrawingData(r, s), a = [], d = this._selectionRenderService.attachRangeWithCoord(e), g = this._selectionRenderService.attachRangeWithCoord(n);
|
|
1474
|
-
if (!d || !g)
|
|
1475
|
-
return { redos: [], undos: [] };
|
|
1476
|
-
Object.keys(o).forEach((u) => {
|
|
1477
|
-
const h = o[u], { sheetTransform: f, transform: m, anchorType: p = E.Position } = h;
|
|
1478
|
-
if (!f || !m || p === E.None)
|
|
1479
|
-
return;
|
|
1480
|
-
const { left: v = 0, top: R = 0, width: S = 0, height: D = 0 } = m, { drawingStartX: _, drawingEndX: b, drawingStartY: w, drawingEndY: U } = {
|
|
1481
|
-
drawingStartX: v,
|
|
1482
|
-
drawingEndX: v + S,
|
|
1483
|
-
drawingStartY: R,
|
|
1484
|
-
drawingEndY: R + D
|
|
1485
|
-
};
|
|
1486
|
-
if (!(d.startX <= _ && b <= d.endX && d.startY <= U && w <= d.endY))
|
|
1487
|
-
return;
|
|
1488
|
-
const { to: I, from: P } = f, M = n.startRow - e.startRow, C = n.startColumn - e.startColumn;
|
|
1489
|
-
let A, $;
|
|
1490
|
-
if (p === E.Both) {
|
|
1491
|
-
const k = this._selectionRenderService.attachRangeWithCoord({
|
|
1492
|
-
startRow: I.row,
|
|
1493
|
-
endRow: P.row,
|
|
1494
|
-
startColumn: I.column,
|
|
1495
|
-
endColumn: P.column
|
|
1496
|
-
}), z = this._selectionRenderService.attachRangeWithCoord({
|
|
1497
|
-
startRow: I.row + M,
|
|
1498
|
-
endRow: P.row + M,
|
|
1499
|
-
startColumn: I.column + C,
|
|
1500
|
-
endColumn: P.column + C
|
|
1501
|
-
});
|
|
1502
|
-
if (!z || !k)
|
|
1503
|
-
return;
|
|
1504
|
-
const B = z.endX - z.startX - (k.endX - k.startX), en = z.endY - z.startY - (k.endY - k.startY);
|
|
1505
|
-
A = {
|
|
1506
|
-
to: { ...I, row: I.row + M, column: I.column + C, columnOffset: I.columnOffset + B },
|
|
1507
|
-
from: { ...P, row: P.row + M, column: P.column + C, columnOffset: I.columnOffset + B, rowOffset: I.rowOffset + en }
|
|
1508
|
-
}, $ = V(A, this._selectionRenderService, this._sheetSkeletonManagerService);
|
|
1509
|
-
} else {
|
|
1510
|
-
const k = g.startX - d.startX, z = g.startY - d.startY;
|
|
1511
|
-
$ = {
|
|
1512
|
-
...m,
|
|
1513
|
-
left: v + k,
|
|
1514
|
-
top: R + z
|
|
1515
|
-
}, A = N($, this._selectionRenderService);
|
|
1516
|
-
}
|
|
1517
|
-
if (!A || !$)
|
|
1518
|
-
return;
|
|
1519
|
-
const Ie = { unitId: r, subUnitId: s, drawingId: u, transform: $, sheetTransform: A };
|
|
1520
|
-
a.push(Ie);
|
|
1521
|
-
});
|
|
1522
|
-
const l = [], c = [];
|
|
1523
|
-
if (a.length > 0) {
|
|
1524
|
-
const u = this._sheetDrawingService.getBatchUpdateOp(a), { undo: h, redo: f, objects: m } = u;
|
|
1525
|
-
l.push({ id: y.id, params: { unitId: r, subUnitId: s, op: f, objects: m, type: T.UPDATE } }), c.push({ id: y.id, params: { unitId: r, subUnitId: s, op: h, objects: m, type: T.UPDATE } });
|
|
1526
|
-
}
|
|
1527
|
-
return { redos: l, undos: c };
|
|
1528
|
-
}
|
|
1529
1491
|
_moveColInterceptor(i, e) {
|
|
1530
1492
|
const n = this._getUnitIdAndSubUnitId(i, e);
|
|
1531
1493
|
if (n == null)
|
|
1532
1494
|
return { redos: [], undos: [] };
|
|
1533
|
-
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, a = s.endColumn, d = [],
|
|
1534
|
-
if (Object.keys(l).forEach((
|
|
1535
|
-
const f = l[
|
|
1495
|
+
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, a = s.endColumn, d = [], h = [], l = this._sheetDrawingService.getDrawingData(t, r), c = [], u = [];
|
|
1496
|
+
if (Object.keys(l).forEach((g) => {
|
|
1497
|
+
const f = l[g], { sheetTransform: m, transform: p, anchorType: S = O.Position } = f;
|
|
1536
1498
|
if (m == null || p == null)
|
|
1537
1499
|
return;
|
|
1538
|
-
let
|
|
1500
|
+
let C, v;
|
|
1539
1501
|
if (e === "insert") {
|
|
1540
|
-
const _ = this._expandCol(m, p, o, a,
|
|
1541
|
-
|
|
1502
|
+
const _ = this._expandCol(m, p, o, a, S);
|
|
1503
|
+
C = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
|
|
1542
1504
|
} else {
|
|
1543
|
-
const { from: _, to: b } = m, { column: w } = _, { column:
|
|
1544
|
-
if (w >= o &&
|
|
1545
|
-
u.push({ unitId: t, subUnitId: r, drawingId:
|
|
1505
|
+
const { from: _, to: b } = m, { column: w } = _, { column: P } = b;
|
|
1506
|
+
if (w >= o && P <= a)
|
|
1507
|
+
u.push({ unitId: t, subUnitId: r, drawingId: g });
|
|
1546
1508
|
else {
|
|
1547
|
-
const
|
|
1548
|
-
|
|
1509
|
+
const D = this._shrinkCol(m, p, o, a, S);
|
|
1510
|
+
C = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
|
|
1549
1511
|
}
|
|
1550
1512
|
}
|
|
1551
|
-
if (!
|
|
1513
|
+
if (!C || !v)
|
|
1552
1514
|
return;
|
|
1553
|
-
const
|
|
1554
|
-
c.push(
|
|
1515
|
+
const R = { unitId: t, subUnitId: r, drawingId: g, transform: v, sheetTransform: C };
|
|
1516
|
+
c.push(R);
|
|
1555
1517
|
}), c.length === 0 && u.length === 0)
|
|
1556
1518
|
return { redos: [], undos: [] };
|
|
1557
1519
|
if (c.length > 0) {
|
|
1558
|
-
const
|
|
1559
|
-
d.push({ id:
|
|
1520
|
+
const g = this._sheetDrawingService.getBatchUpdateOp(c), { undo: f, redo: m, objects: p } = g;
|
|
1521
|
+
d.push({ id: E.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: y.UPDATE } }), h.push({ id: E.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: y.UPDATE } });
|
|
1560
1522
|
}
|
|
1561
1523
|
if (u.length > 0) {
|
|
1562
|
-
const
|
|
1563
|
-
d.push({ id:
|
|
1524
|
+
const g = this._sheetDrawingService.getBatchRemoveOp(u), f = g.undo, m = g.redo, p = g.objects;
|
|
1525
|
+
d.push({ id: E.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: y.REMOVE } }), h.push({ id: E.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: y.INSERT } });
|
|
1564
1526
|
}
|
|
1565
|
-
return d.push({ id: j.id, params: [t] }),
|
|
1527
|
+
return d.push({ id: j.id, params: [t] }), h.push({ id: j.id, params: [t] }), { redos: d, undos: h };
|
|
1566
1528
|
}
|
|
1567
|
-
_expandCol(i, e, n, t, r =
|
|
1568
|
-
const s = t - n + 1, { from: o, to: a } = i, { column: d } = o, { column:
|
|
1569
|
-
if (r ===
|
|
1529
|
+
_expandCol(i, e, n, t, r = O.Position) {
|
|
1530
|
+
const s = t - n + 1, { from: o, to: a } = i, { column: d } = o, { column: h } = a;
|
|
1531
|
+
if (r === O.None)
|
|
1570
1532
|
return {
|
|
1571
1533
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1572
1534
|
newTransform: e
|
|
1573
1535
|
};
|
|
1574
1536
|
let l = null, c = null;
|
|
1575
1537
|
if (d >= n) {
|
|
1576
|
-
const u = this.
|
|
1538
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: a.row });
|
|
1577
1539
|
if (u == null)
|
|
1578
1540
|
return;
|
|
1579
1541
|
c = { ...e, left: (e.left || 0) + u.endX - u.startX }, l = N(c, this._selectionRenderService);
|
|
1580
|
-
} else if (
|
|
1581
|
-
if (r ===
|
|
1542
|
+
} else if (h >= t)
|
|
1543
|
+
if (r === O.Both)
|
|
1582
1544
|
l = {
|
|
1583
1545
|
from: { ...o },
|
|
1584
|
-
to: { ...a, column:
|
|
1585
|
-
}, c =
|
|
1546
|
+
to: { ...a, column: h + s }
|
|
1547
|
+
}, c = $(l, this._selectionRenderService, this._skeletonManagerService);
|
|
1586
1548
|
else
|
|
1587
1549
|
return {
|
|
1588
1550
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
@@ -1593,95 +1555,85 @@ let We = class extends de {
|
|
|
1593
1555
|
newTransform: c
|
|
1594
1556
|
} : null;
|
|
1595
1557
|
}
|
|
1596
|
-
_shrinkCol(i, e, n, t, r =
|
|
1597
|
-
const s = t - n + 1, { from: o, to: a } = i, { column: d } = o, { column:
|
|
1598
|
-
if (r ===
|
|
1558
|
+
_shrinkCol(i, e, n, t, r = O.Position) {
|
|
1559
|
+
const s = t - n + 1, { from: o, to: a } = i, { column: d } = o, { column: h } = a;
|
|
1560
|
+
if (r === O.None)
|
|
1599
1561
|
return {
|
|
1600
1562
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1601
1563
|
newTransform: e
|
|
1602
1564
|
};
|
|
1603
1565
|
let l = null, c = null;
|
|
1604
|
-
if (d > t)
|
|
1605
|
-
const u = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: a.row });
|
|
1606
|
-
if (u == null)
|
|
1607
|
-
return;
|
|
1608
|
-
c = { ...e, left: (e.left || 0) - (u.endX - u.startX) }, l = N(c, this._selectionRenderService);
|
|
1609
|
-
} else if (d >= n && g <= t) {
|
|
1610
|
-
const u = this._selectionRenderService.attachRangeWithCoord({
|
|
1611
|
-
startColumn: n,
|
|
1612
|
-
endColumn: t,
|
|
1613
|
-
startRow: 0,
|
|
1614
|
-
endRow: 0
|
|
1615
|
-
});
|
|
1566
|
+
if (d > t)
|
|
1616
1567
|
l = {
|
|
1617
|
-
from: { ...o,
|
|
1618
|
-
to: { ...a,
|
|
1619
|
-
}, c =
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1568
|
+
from: { ...o, column: d - s },
|
|
1569
|
+
to: { ...a, column: h - s }
|
|
1570
|
+
}, c = $(l, this._selectionRenderService, this._skeletonManagerService);
|
|
1571
|
+
else {
|
|
1572
|
+
if (d >= n && h <= t)
|
|
1573
|
+
return null;
|
|
1574
|
+
if (d < n && h > t)
|
|
1575
|
+
if (r === O.Both)
|
|
1576
|
+
l = {
|
|
1577
|
+
from: { ...o },
|
|
1578
|
+
to: { ...a, column: h - s }
|
|
1579
|
+
}, c = $(l, this._selectionRenderService, this._skeletonManagerService);
|
|
1580
|
+
else
|
|
1581
|
+
return {
|
|
1582
|
+
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1583
|
+
newTransform: e
|
|
1584
|
+
};
|
|
1585
|
+
else if (d >= n && d <= t) {
|
|
1586
|
+
if (d === n)
|
|
1587
|
+
c = { ...e, left: (e.left || 0) - i.from.columnOffset };
|
|
1588
|
+
else {
|
|
1589
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: d - 1, startRow: o.row, endRow: a.row });
|
|
1590
|
+
if (u == null)
|
|
1591
|
+
return;
|
|
1592
|
+
c = { ...e, left: (e.left || 0) - u.endX + u.startX - i.from.columnOffset };
|
|
1593
|
+
}
|
|
1594
|
+
l = N(c, this._selectionRenderService);
|
|
1595
|
+
} else if (h >= n && h <= t && r === O.Both) {
|
|
1596
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({
|
|
1597
|
+
startColumn: n - 1,
|
|
1598
|
+
endColumn: n - 1,
|
|
1599
|
+
startRow: o.row,
|
|
1600
|
+
endRow: a.row
|
|
1601
|
+
});
|
|
1639
1602
|
if (u == null)
|
|
1640
1603
|
return;
|
|
1641
|
-
|
|
1604
|
+
l = {
|
|
1605
|
+
from: { ...o },
|
|
1606
|
+
to: { ...a, column: n - 1, columnOffset: u.endX - u.startX }
|
|
1607
|
+
}, c = $(l, this._selectionRenderService, this._skeletonManagerService);
|
|
1642
1608
|
}
|
|
1643
|
-
l = N(c, this._selectionRenderService);
|
|
1644
|
-
} else if (g >= n && g <= t && r === E.Both) {
|
|
1645
|
-
const u = this._selectionRenderService.attachRangeWithCoord({
|
|
1646
|
-
startColumn: n - 1,
|
|
1647
|
-
endColumn: n - 1,
|
|
1648
|
-
startRow: o.row,
|
|
1649
|
-
endRow: a.row
|
|
1650
|
-
});
|
|
1651
|
-
if (u == null)
|
|
1652
|
-
return;
|
|
1653
|
-
l = {
|
|
1654
|
-
from: { ...o },
|
|
1655
|
-
to: { ...a, column: n - 1, columnOffset: u.endX - u.startX }
|
|
1656
|
-
}, c = V(l, this._selectionRenderService, this._sheetSkeletonManagerService);
|
|
1657
1609
|
}
|
|
1658
1610
|
return l != null && c != null ? {
|
|
1659
1611
|
newSheetTransform: l,
|
|
1660
1612
|
newTransform: c
|
|
1661
1613
|
} : null;
|
|
1662
1614
|
}
|
|
1663
|
-
_expandRow(i, e, n, t, r =
|
|
1664
|
-
const s = t - n + 1, { from: o, to: a } = i, { row: d } = o, { row:
|
|
1665
|
-
if (r ===
|
|
1615
|
+
_expandRow(i, e, n, t, r = O.Position) {
|
|
1616
|
+
const s = t - n + 1, { from: o, to: a } = i, { row: d } = o, { row: h } = a;
|
|
1617
|
+
if (r === O.None)
|
|
1666
1618
|
return {
|
|
1667
1619
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1668
1620
|
newTransform: e
|
|
1669
1621
|
};
|
|
1670
1622
|
let l = null, c = null;
|
|
1671
1623
|
if (d >= n) {
|
|
1672
|
-
const u = this.
|
|
1624
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: a.column });
|
|
1673
1625
|
if (u == null)
|
|
1674
1626
|
return;
|
|
1675
1627
|
c = { ...e, top: (e.top || 0) + u.endY - u.startY }, l = N(c, this._selectionRenderService);
|
|
1676
|
-
} else if (
|
|
1677
|
-
if (r ===
|
|
1628
|
+
} else if (h >= t)
|
|
1629
|
+
if (r === O.Both)
|
|
1678
1630
|
l = {
|
|
1679
1631
|
from: { ...o },
|
|
1680
1632
|
to: {
|
|
1681
1633
|
...a,
|
|
1682
|
-
row:
|
|
1634
|
+
row: h + s
|
|
1683
1635
|
}
|
|
1684
|
-
}, c =
|
|
1636
|
+
}, c = $(l, this._selectionRenderService, this._skeletonManagerService);
|
|
1685
1637
|
else
|
|
1686
1638
|
return {
|
|
1687
1639
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
@@ -1692,9 +1644,9 @@ let We = class extends de {
|
|
|
1692
1644
|
newTransform: c
|
|
1693
1645
|
} : null;
|
|
1694
1646
|
}
|
|
1695
|
-
_shrinkRow(i, e, n, t, r =
|
|
1696
|
-
const s = t - n + 1, { from: o, to: a } = i, { row: d } = o, { row:
|
|
1697
|
-
if (r ===
|
|
1647
|
+
_shrinkRow(i, e, n, t, r = O.Position) {
|
|
1648
|
+
const s = t - n + 1, { from: o, to: a } = i, { row: d } = o, { row: h } = a;
|
|
1649
|
+
if (r === O.None)
|
|
1698
1650
|
return {
|
|
1699
1651
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1700
1652
|
newTransform: e
|
|
@@ -1703,51 +1655,41 @@ let We = class extends de {
|
|
|
1703
1655
|
if (d > t)
|
|
1704
1656
|
l = {
|
|
1705
1657
|
from: { ...o, row: d - s },
|
|
1706
|
-
to: { ...a, row:
|
|
1707
|
-
}, c =
|
|
1708
|
-
else
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
if (d === n)
|
|
1735
|
-
c = { ...e, top: (e.top || 0) - i.from.rowOffset };
|
|
1736
|
-
else {
|
|
1737
|
-
const u = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: d - 1, startColumn: o.column, endColumn: a.column });
|
|
1658
|
+
to: { ...a, row: h - s }
|
|
1659
|
+
}, c = $(l, this._selectionRenderService, this._skeletonManagerService);
|
|
1660
|
+
else {
|
|
1661
|
+
if (d >= n && h <= t)
|
|
1662
|
+
return null;
|
|
1663
|
+
if (d < n && h > t)
|
|
1664
|
+
if (r === O.Both)
|
|
1665
|
+
l = {
|
|
1666
|
+
from: { ...o },
|
|
1667
|
+
to: { ...a, row: h - s }
|
|
1668
|
+
}, c = $(l, this._selectionRenderService, this._skeletonManagerService);
|
|
1669
|
+
else
|
|
1670
|
+
return {
|
|
1671
|
+
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1672
|
+
newTransform: e
|
|
1673
|
+
};
|
|
1674
|
+
else if (d >= n && d <= t) {
|
|
1675
|
+
if (d === n)
|
|
1676
|
+
c = { ...e, top: (e.top || 0) - i.from.rowOffset };
|
|
1677
|
+
else {
|
|
1678
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: d - 1, startColumn: o.column, endColumn: a.column });
|
|
1679
|
+
if (u == null)
|
|
1680
|
+
return;
|
|
1681
|
+
c = { ...e, top: (e.top || 0) - u.endY + u.startY - i.from.rowOffset };
|
|
1682
|
+
}
|
|
1683
|
+
l = N(c, this._selectionRenderService);
|
|
1684
|
+
} else if (h >= n && h <= t && r === O.Both) {
|
|
1685
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
|
|
1738
1686
|
if (u == null)
|
|
1739
1687
|
return;
|
|
1740
|
-
|
|
1688
|
+
l = {
|
|
1689
|
+
from: { ...o },
|
|
1690
|
+
to: { ...a, row: n - 1, rowOffset: u.endY - u.startY }
|
|
1691
|
+
}, c = $(l, this._selectionRenderService, this._skeletonManagerService);
|
|
1741
1692
|
}
|
|
1742
|
-
l = N(c, this._selectionRenderService);
|
|
1743
|
-
} else if (g >= n && g <= t && r === E.Both) {
|
|
1744
|
-
const u = this._selectionRenderService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
|
|
1745
|
-
if (u == null)
|
|
1746
|
-
return;
|
|
1747
|
-
l = {
|
|
1748
|
-
from: { ...o },
|
|
1749
|
-
to: { ...a, row: n - 1, rowOffset: u.endY - u.startY }
|
|
1750
|
-
}, c = V(l, this._selectionRenderService, this._sheetSkeletonManagerService);
|
|
1751
1693
|
}
|
|
1752
1694
|
return l != null && c != null ? {
|
|
1753
1695
|
newSheetTransform: l,
|
|
@@ -1761,12 +1703,12 @@ let We = class extends de {
|
|
|
1761
1703
|
const e = i.params, { unitId: n, subUnitId: t } = e, r = this._drawingManagerService.drawingManagerData, s = [], o = [];
|
|
1762
1704
|
Object.keys(r).forEach((a) => {
|
|
1763
1705
|
const d = r[a];
|
|
1764
|
-
Object.keys(d).forEach((
|
|
1765
|
-
const l = d[
|
|
1706
|
+
Object.keys(d).forEach((h) => {
|
|
1707
|
+
const l = d[h].data;
|
|
1766
1708
|
l != null && Object.keys(l).forEach((c) => {
|
|
1767
|
-
if (a === n &&
|
|
1709
|
+
if (a === n && h === t) {
|
|
1768
1710
|
const u = l[c];
|
|
1769
|
-
u.transform =
|
|
1711
|
+
u.transform = $(u.sheetTransform, this._selectionRenderService, this._skeletonManagerService), s.push(l[c]);
|
|
1770
1712
|
} else
|
|
1771
1713
|
o.push(l[c]);
|
|
1772
1714
|
});
|
|
@@ -1779,7 +1721,7 @@ let We = class extends de {
|
|
|
1779
1721
|
_sheetRefreshListener() {
|
|
1780
1722
|
this.disposeWithMe(
|
|
1781
1723
|
this._commandService.onCommandExecuted((i) => {
|
|
1782
|
-
|
|
1724
|
+
di.includes(i.id) && requestIdleCallback(() => {
|
|
1783
1725
|
const e = i.params, { unitId: n, subUnitId: t, ranges: r } = e;
|
|
1784
1726
|
this._refreshDrawingTransform(n, t, r);
|
|
1785
1727
|
});
|
|
@@ -1789,29 +1731,29 @@ let We = class extends de {
|
|
|
1789
1731
|
_refreshDrawingTransform(i, e, n) {
|
|
1790
1732
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [];
|
|
1791
1733
|
Object.keys(t).forEach((s) => {
|
|
1792
|
-
const o = t[s], { sheetTransform: a, anchorType: d =
|
|
1793
|
-
if (d ===
|
|
1734
|
+
const o = t[s], { sheetTransform: a, anchorType: d = O.Position } = o;
|
|
1735
|
+
if (d === O.None)
|
|
1794
1736
|
return !0;
|
|
1795
|
-
const { from:
|
|
1737
|
+
const { from: h, to: l } = a, { row: c, column: u } = h, { row: g, column: f } = l;
|
|
1796
1738
|
for (let m = 0; m < n.length; m++) {
|
|
1797
|
-
const p = n[m], { startRow:
|
|
1739
|
+
const p = n[m], { startRow: S, endRow: C, startColumn: v, endColumn: R } = p;
|
|
1798
1740
|
if (cn.intersects(
|
|
1799
1741
|
{
|
|
1800
|
-
startRow:
|
|
1801
|
-
endRow:
|
|
1802
|
-
startColumn:
|
|
1803
|
-
endColumn:
|
|
1742
|
+
startRow: S,
|
|
1743
|
+
endRow: C,
|
|
1744
|
+
startColumn: v,
|
|
1745
|
+
endColumn: R
|
|
1804
1746
|
},
|
|
1805
1747
|
{
|
|
1806
1748
|
startRow: c,
|
|
1807
|
-
endRow:
|
|
1749
|
+
endRow: g,
|
|
1808
1750
|
startColumn: u,
|
|
1809
1751
|
endColumn: f
|
|
1810
1752
|
}
|
|
1811
|
-
) || c >
|
|
1753
|
+
) || c > C || u > R) {
|
|
1812
1754
|
r.push({
|
|
1813
1755
|
...o,
|
|
1814
|
-
transform:
|
|
1756
|
+
transform: $(a, this._selectionRenderService, this._skeletonManagerService)
|
|
1815
1757
|
});
|
|
1816
1758
|
break;
|
|
1817
1759
|
}
|
|
@@ -1819,23 +1761,22 @@ let We = class extends de {
|
|
|
1819
1761
|
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(j.id, [i]));
|
|
1820
1762
|
}
|
|
1821
1763
|
};
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
var
|
|
1833
|
-
for (var r = t > 1 ? void 0 : t ? li(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1764
|
+
Ae = ai([
|
|
1765
|
+
ie(se.Rendered, Ae),
|
|
1766
|
+
ce(0, V),
|
|
1767
|
+
ce(1, W(or)),
|
|
1768
|
+
ce(2, K),
|
|
1769
|
+
ce(3, k),
|
|
1770
|
+
ce(4, z),
|
|
1771
|
+
ce(5, he)
|
|
1772
|
+
], Ae);
|
|
1773
|
+
var li = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, gi = (i, e, n, t) => {
|
|
1774
|
+
for (var r = t > 1 ? void 0 : t ? ui(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1834
1775
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
1835
|
-
return t && r &&
|
|
1836
|
-
},
|
|
1776
|
+
return t && r && li(e, n, r), r;
|
|
1777
|
+
}, de = (i, e) => (n, t) => e(n, t, i);
|
|
1837
1778
|
function hi(i, e, n, t) {
|
|
1838
|
-
const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(
|
|
1779
|
+
const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(Tn.VIEW_MAIN), a = {
|
|
1839
1780
|
left: !0,
|
|
1840
1781
|
top: !0
|
|
1841
1782
|
};
|
|
@@ -1844,32 +1785,32 @@ function hi(i, e, n, t) {
|
|
|
1844
1785
|
...i,
|
|
1845
1786
|
absolute: a
|
|
1846
1787
|
};
|
|
1847
|
-
const { left: d, right:
|
|
1848
|
-
let
|
|
1849
|
-
d <
|
|
1788
|
+
const { left: d, right: h, top: l, bottom: c } = i, u = t.getFreeze(), { startColumn: g, startRow: f, xSplit: m, ySplit: p } = u, S = n.getNoMergeCellPositionByIndexWithNoHeader(f - p, g - m), C = n.getNoMergeCellPositionByIndexWithNoHeader(f, g), { rowHeaderWidth: v, columnHeaderHeight: R } = n, _ = C.startX - S.startX, b = C.startY - S.startY, { top: w, left: P, viewportScrollX: D, viewportScrollY: T } = o;
|
|
1789
|
+
let U, M;
|
|
1790
|
+
d < P ? (a.left = !0, U = (_ + v + (d - P)) * r, M = Math.max(
|
|
1850
1791
|
Math.min(
|
|
1851
|
-
(_ +
|
|
1852
|
-
(_ +
|
|
1792
|
+
(_ + v + (h - P)) * r,
|
|
1793
|
+
(_ + v) * r
|
|
1853
1794
|
),
|
|
1854
|
-
(
|
|
1855
|
-
)) : (a.left = !1,
|
|
1856
|
-
let
|
|
1857
|
-
return l < w ? (a.top = !0,
|
|
1795
|
+
(h - D) * r
|
|
1796
|
+
)) : (a.left = !1, U = Math.max((d - D) * r, (_ + v) * r), M = Math.max((h - D) * r, (_ + v) * r));
|
|
1797
|
+
let I, A;
|
|
1798
|
+
return l < w ? (a.top = !0, I = (b + R + (l - w)) * s, A = Math.max(
|
|
1858
1799
|
Math.min(
|
|
1859
|
-
(b +
|
|
1860
|
-
(b +
|
|
1800
|
+
(b + R + (h - w)) * s,
|
|
1801
|
+
(b + R) * s
|
|
1861
1802
|
),
|
|
1862
|
-
(c -
|
|
1863
|
-
)) : (a.top = !1,
|
|
1864
|
-
left:
|
|
1803
|
+
(c - T) * s
|
|
1804
|
+
)) : (a.top = !1, I = Math.max((l - T) * s, (b + R) * s), A = Math.max((c - T) * s, (b + R) * s)), {
|
|
1805
|
+
left: U,
|
|
1865
1806
|
right: M,
|
|
1866
|
-
top:
|
|
1807
|
+
top: I,
|
|
1867
1808
|
bottom: A,
|
|
1868
1809
|
absolute: a
|
|
1869
1810
|
};
|
|
1870
1811
|
}
|
|
1871
|
-
const
|
|
1872
|
-
const { scene: r } = e, { left: s, top: o, width: a, height: d, angle:
|
|
1812
|
+
const ze = (i, e, n, t) => {
|
|
1813
|
+
const { scene: r } = e, { left: s, top: o, width: a, height: d, angle: h } = i, l = {
|
|
1873
1814
|
left: s,
|
|
1874
1815
|
right: s + a,
|
|
1875
1816
|
top: o,
|
|
@@ -1880,22 +1821,23 @@ const qe = (i, e, n, t) => {
|
|
|
1880
1821
|
endX: c.right,
|
|
1881
1822
|
startY: c.top,
|
|
1882
1823
|
endY: c.bottom,
|
|
1883
|
-
rotate:
|
|
1824
|
+
rotate: h,
|
|
1884
1825
|
width: a,
|
|
1885
1826
|
height: d,
|
|
1886
1827
|
absolute: c.absolute
|
|
1887
1828
|
};
|
|
1888
1829
|
};
|
|
1889
|
-
let
|
|
1890
|
-
constructor(e, n, t, r, s, o
|
|
1830
|
+
let tt = class extends oe {
|
|
1831
|
+
constructor(e, n, t, r, s, o) {
|
|
1891
1832
|
super();
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1833
|
+
H(this, "_domLayerMap", /* @__PURE__ */ new Map());
|
|
1834
|
+
H(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
|
|
1835
|
+
H(this, "_transformChange$", new mt());
|
|
1836
|
+
H(this, "transformChange$", this._transformChange$.asObservable());
|
|
1837
|
+
H(this, "_remove$", new mt());
|
|
1838
|
+
H(this, "remove$", this._remove$.asObservable());
|
|
1839
|
+
H(this, "_hooks", []);
|
|
1840
|
+
this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._drawingAddListener(), this._scrollUpdateListener(), this._featureUpdateListener(), this._deleteListener();
|
|
1899
1841
|
}
|
|
1900
1842
|
_ensureMap(e, n) {
|
|
1901
1843
|
let t = this._domLayerMap.get(e);
|
|
@@ -1912,41 +1854,47 @@ let it = class extends de {
|
|
|
1912
1854
|
const r = t.getTransformerByCreate(), s = n.engine.getCanvasElement();
|
|
1913
1855
|
return { scene: t, transformer: r, renderObject: n, canvas: s };
|
|
1914
1856
|
}
|
|
1857
|
+
_getFloatDomProps(e) {
|
|
1858
|
+
let n;
|
|
1859
|
+
return this._hooks.forEach((t) => {
|
|
1860
|
+
n = t.onGetFloatDomProps(e);
|
|
1861
|
+
}), n;
|
|
1862
|
+
}
|
|
1915
1863
|
// eslint-disable-next-line max-lines-per-function
|
|
1916
1864
|
_drawingAddListener() {
|
|
1917
1865
|
this.disposeWithMe(
|
|
1918
1866
|
// eslint-disable-next-line max-lines-per-function
|
|
1919
1867
|
this._drawingManagerService.add$.subscribe((e) => {
|
|
1920
1868
|
e.forEach((n) => {
|
|
1921
|
-
var
|
|
1922
|
-
const { unitId: t, subUnitId: r, drawingId: s } = n, o =
|
|
1869
|
+
var ot, at, ct;
|
|
1870
|
+
const { unitId: t, subUnitId: r, drawingId: s } = n, o = le(this._univerInstanceService, { unitId: t, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(n), d = (ot = this._renderManagerService.getRenderById(t)) == null ? void 0 : ot.with(re).getWorksheetSkeleton(r);
|
|
1923
1871
|
if (a == null || o == null || d == null)
|
|
1924
1872
|
return;
|
|
1925
|
-
const { transform:
|
|
1926
|
-
if (l !==
|
|
1873
|
+
const { transform: h, drawingType: l } = a;
|
|
1874
|
+
if (l !== Ye.DRAWING_DOM)
|
|
1927
1875
|
return;
|
|
1928
1876
|
const c = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1929
1877
|
if (c == null)
|
|
1930
1878
|
return;
|
|
1931
|
-
const { scene: u, canvas:
|
|
1932
|
-
if (
|
|
1879
|
+
const { scene: u, canvas: g } = c;
|
|
1880
|
+
if (h == null)
|
|
1933
1881
|
return !0;
|
|
1934
|
-
const { left: f, top: m, width: p, height:
|
|
1935
|
-
if (
|
|
1936
|
-
|
|
1882
|
+
const { left: f, top: m, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: b } = h, w = Dn({ unitId: t, subUnitId: r, drawingId: s }), P = u.getObject(w);
|
|
1883
|
+
if (P != null) {
|
|
1884
|
+
P.transformByState({ left: f, top: m, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: b });
|
|
1937
1885
|
return;
|
|
1938
1886
|
}
|
|
1939
|
-
const
|
|
1887
|
+
const D = {
|
|
1940
1888
|
left: f,
|
|
1941
1889
|
top: m,
|
|
1942
1890
|
width: p,
|
|
1943
|
-
height:
|
|
1891
|
+
height: S,
|
|
1944
1892
|
zIndex: this._drawingManagerService.getDrawingOrder(t, r).length - 1
|
|
1945
|
-
},
|
|
1946
|
-
u.addObject(
|
|
1947
|
-
const
|
|
1893
|
+
}, T = new On(w, D);
|
|
1894
|
+
u.addObject(T, Pn).attachTransformerTo(T);
|
|
1895
|
+
const U = this._ensureMap(t, r), M = new dn(), I = ze(T, c.renderObject, d.skeleton, o.worksheet), A = new Vn(I), G = {
|
|
1948
1896
|
dispose: M,
|
|
1949
|
-
rect:
|
|
1897
|
+
rect: T,
|
|
1950
1898
|
position$: A,
|
|
1951
1899
|
unitId: t,
|
|
1952
1900
|
subUnitId: r
|
|
@@ -1955,29 +1903,29 @@ let it = class extends de {
|
|
|
1955
1903
|
position$: A,
|
|
1956
1904
|
id: s,
|
|
1957
1905
|
componentKey: a.componentKey,
|
|
1958
|
-
onPointerDown: (
|
|
1959
|
-
|
|
1906
|
+
onPointerDown: (x) => {
|
|
1907
|
+
g.dispatchEvent(new PointerEvent(x.type, x));
|
|
1960
1908
|
},
|
|
1961
|
-
onPointerMove: (
|
|
1962
|
-
|
|
1909
|
+
onPointerMove: (x) => {
|
|
1910
|
+
g.dispatchEvent(new PointerEvent(x.type, x));
|
|
1963
1911
|
},
|
|
1964
|
-
onPointerUp: (
|
|
1965
|
-
|
|
1912
|
+
onPointerUp: (x) => {
|
|
1913
|
+
g.dispatchEvent(new PointerEvent(x.type, x));
|
|
1966
1914
|
},
|
|
1967
|
-
onWheel: (
|
|
1968
|
-
|
|
1915
|
+
onWheel: (x) => {
|
|
1916
|
+
g.dispatchEvent(new WheelEvent(x.type, x));
|
|
1969
1917
|
},
|
|
1970
|
-
props: (
|
|
1918
|
+
props: (ct = (at = U.get(s)) == null ? void 0 : at.props) != null ? ct : this._getFloatDomProps(s)
|
|
1971
1919
|
});
|
|
1972
|
-
const
|
|
1973
|
-
const
|
|
1920
|
+
const J = T.onTransformChange$.subscribeEvent(() => {
|
|
1921
|
+
const x = ze(T, c.renderObject, d.skeleton, o.worksheet);
|
|
1974
1922
|
A.next(
|
|
1975
|
-
|
|
1923
|
+
x
|
|
1976
1924
|
);
|
|
1977
1925
|
});
|
|
1978
1926
|
M.add(() => {
|
|
1979
1927
|
this._canvasFloatDomService.removeFloatDom(s);
|
|
1980
|
-
}),
|
|
1928
|
+
}), J && M.add(J), this._domLayerInfoMap.set(s, G);
|
|
1981
1929
|
});
|
|
1982
1930
|
})
|
|
1983
1931
|
);
|
|
@@ -1987,19 +1935,19 @@ let it = class extends de {
|
|
|
1987
1935
|
var t, r;
|
|
1988
1936
|
const n = (s, o) => {
|
|
1989
1937
|
var u;
|
|
1990
|
-
const a = this._getSceneAndTransformerByDrawingSearch(s), d = this._ensureMap(s, o),
|
|
1991
|
-
!a || !l || !c ||
|
|
1992
|
-
const f = this._domLayerInfoMap.get(
|
|
1938
|
+
const a = this._getSceneAndTransformerByDrawingSearch(s), d = this._ensureMap(s, o), h = Array.from(d.keys()), l = le(this._univerInstanceService, { unitId: s, subUnitId: o }), c = (u = this._renderManagerService.getRenderById(s)) == null ? void 0 : u.with(re).getWorksheetSkeleton(o);
|
|
1939
|
+
!a || !l || !c || h.forEach((g) => {
|
|
1940
|
+
const f = this._domLayerInfoMap.get(g);
|
|
1993
1941
|
if (f) {
|
|
1994
|
-
const m =
|
|
1942
|
+
const m = ze(f.rect, a.renderObject, c.skeleton, l.worksheet);
|
|
1995
1943
|
f.position$.next(m);
|
|
1996
1944
|
}
|
|
1997
1945
|
});
|
|
1998
1946
|
};
|
|
1999
|
-
if (e.id ===
|
|
1947
|
+
if (e.id === jn.id) {
|
|
2000
1948
|
const s = e.params, { unitId: o, sheetId: a } = s;
|
|
2001
1949
|
n(o, a);
|
|
2002
|
-
} else if (e.id ===
|
|
1950
|
+
} else if (e.id === Ln.id) {
|
|
2003
1951
|
const s = e.params, { unitId: o } = s;
|
|
2004
1952
|
Array.from((r = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? r : []).forEach((d) => {
|
|
2005
1953
|
n(o, d);
|
|
@@ -2010,27 +1958,31 @@ let it = class extends de {
|
|
|
2010
1958
|
}
|
|
2011
1959
|
}));
|
|
2012
1960
|
}
|
|
2013
|
-
_getPosition(e) {
|
|
2014
|
-
|
|
2015
|
-
|
|
1961
|
+
_getPosition(e, n) {
|
|
1962
|
+
var u;
|
|
1963
|
+
const { startX: t, endX: r, startY: s, endY: o } = e, a = (u = this._renderManagerService.getRenderById(n)) == null ? void 0 : u.with(Ge);
|
|
1964
|
+
if (a == null)
|
|
2016
1965
|
return;
|
|
2017
|
-
const
|
|
2018
|
-
column: o.actualColumn,
|
|
2019
|
-
columnOffset: n - o.startX,
|
|
2020
|
-
row: o.actualRow,
|
|
2021
|
-
rowOffset: r - o.startY
|
|
2022
|
-
}, d = this._selectionRenderService.getSelectionCellByPosition(t, s);
|
|
1966
|
+
const d = a.getSelectionCellByPosition(t, s);
|
|
2023
1967
|
if (d == null)
|
|
2024
1968
|
return;
|
|
2025
|
-
const
|
|
1969
|
+
const h = {
|
|
2026
1970
|
column: d.actualColumn,
|
|
2027
1971
|
columnOffset: t - d.startX,
|
|
2028
1972
|
row: d.actualRow,
|
|
2029
1973
|
rowOffset: s - d.startY
|
|
1974
|
+
}, l = a.getSelectionCellByPosition(r, o);
|
|
1975
|
+
if (l == null)
|
|
1976
|
+
return;
|
|
1977
|
+
const c = {
|
|
1978
|
+
column: l.actualColumn,
|
|
1979
|
+
columnOffset: r - l.startX,
|
|
1980
|
+
row: l.actualRow,
|
|
1981
|
+
rowOffset: o - l.startY
|
|
2030
1982
|
};
|
|
2031
1983
|
return {
|
|
2032
|
-
from:
|
|
2033
|
-
to:
|
|
1984
|
+
from: h,
|
|
1985
|
+
to: c
|
|
2034
1986
|
};
|
|
2035
1987
|
}
|
|
2036
1988
|
_featureUpdateListener() {
|
|
@@ -2038,7 +1990,7 @@ let it = class extends de {
|
|
|
2038
1990
|
this._drawingManagerService.update$.subscribe((e) => {
|
|
2039
1991
|
e.forEach((n) => {
|
|
2040
1992
|
const t = this._drawingManagerService.getDrawingByParam(n);
|
|
2041
|
-
if (!t || t.drawingType !==
|
|
1993
|
+
if (!t || t.drawingType !== Ye.DRAWING_DOM)
|
|
2042
1994
|
return;
|
|
2043
1995
|
const r = {
|
|
2044
1996
|
...t.transform
|
|
@@ -2058,13 +2010,13 @@ let it = class extends de {
|
|
|
2058
2010
|
);
|
|
2059
2011
|
}
|
|
2060
2012
|
addFloatDomToPosition(e) {
|
|
2061
|
-
const n =
|
|
2013
|
+
const n = le(this._univerInstanceService, {
|
|
2062
2014
|
unitId: e.unitId,
|
|
2063
2015
|
subUnitId: e.subUnitId
|
|
2064
2016
|
});
|
|
2065
2017
|
if (!n)
|
|
2066
2018
|
throw new Error("cannot find current target!");
|
|
2067
|
-
const { unitId: t, subUnitId: r } = n, { initPosition: s, componentKey: o } = e, a =
|
|
2019
|
+
const { unitId: t, subUnitId: r } = n, { initPosition: s, componentKey: o } = e, a = ne.generateRandomId(), d = this._getPosition(s, t);
|
|
2068
2020
|
if (d == null)
|
|
2069
2021
|
return;
|
|
2070
2022
|
this._ensureMap(t, r).set(a, e);
|
|
@@ -2072,7 +2024,7 @@ let it = class extends de {
|
|
|
2072
2024
|
unitId: t,
|
|
2073
2025
|
subUnitId: r,
|
|
2074
2026
|
drawingId: a,
|
|
2075
|
-
drawingType:
|
|
2027
|
+
drawingType: Ye.DRAWING_DOM,
|
|
2076
2028
|
componentKey: o,
|
|
2077
2029
|
sheetTransform: d,
|
|
2078
2030
|
transform: {
|
|
@@ -2082,7 +2034,7 @@ let it = class extends de {
|
|
|
2082
2034
|
height: s.endY - s.startY
|
|
2083
2035
|
}
|
|
2084
2036
|
};
|
|
2085
|
-
return this._commandService.executeCommand(
|
|
2037
|
+
return this._commandService.executeCommand(st.id, {
|
|
2086
2038
|
unitId: t,
|
|
2087
2039
|
drawings: [l]
|
|
2088
2040
|
}), {
|
|
@@ -2104,26 +2056,33 @@ let it = class extends de {
|
|
|
2104
2056
|
const d = this._drawingManagerService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: e });
|
|
2105
2057
|
if (!d)
|
|
2106
2058
|
return;
|
|
2107
|
-
const
|
|
2108
|
-
this._commandService.syncExecuteCommand(
|
|
2059
|
+
const h = this._sheetDrawingService.getBatchRemoveOp([d]), { redo: l, objects: c } = h;
|
|
2060
|
+
this._commandService.syncExecuteCommand(E.id, { unitId: r, subUnitId: s, op: l, objects: c, type: y.REMOVE });
|
|
2109
2061
|
}
|
|
2110
2062
|
}
|
|
2063
|
+
addHook(e) {
|
|
2064
|
+
return this._hooks.push(e), {
|
|
2065
|
+
dispose: () => {
|
|
2066
|
+
const n = this._hooks.findIndex((t) => t === e);
|
|
2067
|
+
this._hooks.splice(n, 1);
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
2070
|
+
}
|
|
2111
2071
|
};
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
var
|
|
2122
|
-
for (var r = t > 1 ? void 0 : t ? mi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2072
|
+
tt = gi([
|
|
2073
|
+
de(0, W(K)),
|
|
2074
|
+
de(1, he),
|
|
2075
|
+
de(2, W(V)),
|
|
2076
|
+
de(3, z),
|
|
2077
|
+
de(4, W(Jn)),
|
|
2078
|
+
de(5, k)
|
|
2079
|
+
], tt);
|
|
2080
|
+
var mi = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, pi = (i, e, n, t) => {
|
|
2081
|
+
for (var r = t > 1 ? void 0 : t ? fi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2123
2082
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2124
|
-
return t && r &&
|
|
2125
|
-
},
|
|
2126
|
-
let
|
|
2083
|
+
return t && r && mi(e, n, r), r;
|
|
2084
|
+
}, Oe = (i, e) => (n, t) => e(n, t, i);
|
|
2085
|
+
let Ne = class extends oe {
|
|
2127
2086
|
constructor(i, e, n, t) {
|
|
2128
2087
|
super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting();
|
|
2129
2088
|
}
|
|
@@ -2148,16 +2107,16 @@ let Be = class extends de {
|
|
|
2148
2107
|
const { unitId: t, subUnitId: r } = e, s = this._renderManagerService.getRenderById(t);
|
|
2149
2108
|
if (!s)
|
|
2150
2109
|
return n(i);
|
|
2151
|
-
const o = s.with(
|
|
2110
|
+
const o = s.with(re).getWorksheetSkeleton(r);
|
|
2152
2111
|
if (!o)
|
|
2153
2112
|
return n(i);
|
|
2154
2113
|
const a = this._drawingManagerService.getDrawingDataForUnit(t), d = a == null ? void 0 : a[e.subUnitId];
|
|
2155
2114
|
if (!d)
|
|
2156
2115
|
return n(i);
|
|
2157
|
-
const { scaleX:
|
|
2158
|
-
return u.length ? (u.forEach((
|
|
2159
|
-
if (!
|
|
2160
|
-
const f = o.skeleton.getCellPositionByOffset(
|
|
2116
|
+
const { scaleX: h, scaleY: l } = s.scene, c = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, u = d.order.map((g) => d.data[g]).filter((g) => g.drawingType !== Ve.DRAWING_DOM);
|
|
2117
|
+
return u.length ? (u.forEach((g) => {
|
|
2118
|
+
if (!g.groupId && g.transform && ne.isDefine(g.transform.left) && ne.isDefine(g.transform.top) && ne.isDefine(g.transform.width) && ne.isDefine(g.transform.height)) {
|
|
2119
|
+
const f = o.skeleton.getCellPositionByOffset(g.transform.left, g.transform.top, h, l, { x: 0, y: 0 }), m = o.skeleton.getCellPositionByOffset(g.transform.left + g.transform.width, g.transform.top + g.transform.height, h, l, { x: 0, y: 0 });
|
|
2161
2120
|
f.column < c.startColumn && (c.startColumn = f.column), f.row < c.startRow && (c.startRow = f.row), c.endRow < m.row && (c.endRow = m.row), c.endColumn < m.column && (c.endColumn = m.column);
|
|
2162
2121
|
}
|
|
2163
2122
|
}), n(c)) : n(i);
|
|
@@ -2167,26 +2126,26 @@ let Be = class extends de {
|
|
|
2167
2126
|
);
|
|
2168
2127
|
}
|
|
2169
2128
|
};
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
],
|
|
2177
|
-
var
|
|
2178
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2129
|
+
Ne = pi([
|
|
2130
|
+
ie(se.Rendered, Ne),
|
|
2131
|
+
Oe(0, W(Bn)),
|
|
2132
|
+
Oe(1, W(vn)),
|
|
2133
|
+
Oe(2, z),
|
|
2134
|
+
Oe(3, K)
|
|
2135
|
+
], Ne);
|
|
2136
|
+
var wi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, vi = (i, e, n, t) => {
|
|
2137
|
+
for (var r = t > 1 ? void 0 : t ? _i(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2179
2138
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2180
|
-
return t && r &&
|
|
2139
|
+
return t && r && wi(e, n, r), r;
|
|
2181
2140
|
}, fe = (i, e) => (n, t) => e(n, t, i);
|
|
2182
|
-
let
|
|
2141
|
+
let je = class extends oe {
|
|
2183
2142
|
constructor(i, e, n, t, r) {
|
|
2184
2143
|
super(), this._drawingManagerService = i, this._renderManagerService = e, this._permissionService = n, this._univerInstanceService = t, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
2185
2144
|
}
|
|
2186
2145
|
_initDrawingVisible() {
|
|
2187
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
2146
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET);
|
|
2188
2147
|
this.disposeWithMe(
|
|
2189
|
-
|
|
2148
|
+
Re([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
2190
2149
|
if (!e) {
|
|
2191
2150
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
2192
2151
|
return;
|
|
@@ -2197,15 +2156,15 @@ let $e = class extends de {
|
|
|
2197
2156
|
return;
|
|
2198
2157
|
}
|
|
2199
2158
|
const r = e.getUnitId(), s = t.getSheetId();
|
|
2200
|
-
if (this._permissionService.composePermission([new
|
|
2159
|
+
if (this._permissionService.composePermission([new pt(r).id, new He(r, s).id]).every((a) => a.value))
|
|
2201
2160
|
this._drawingManagerService.setDrawingVisible(!0);
|
|
2202
2161
|
else {
|
|
2203
2162
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
2204
|
-
const a = e.getUnitId(), d = t.getSheetId(),
|
|
2163
|
+
const a = e.getUnitId(), d = t.getSheetId(), h = this._drawingManagerService.getDrawingData(a, d), l = Object.values(h), c = this._renderManagerService.getRenderById(a), u = c == null ? void 0 : c.scene;
|
|
2205
2164
|
if (u == null)
|
|
2206
2165
|
return;
|
|
2207
2166
|
u.getAllObjects().forEach((f) => {
|
|
2208
|
-
f.classType ===
|
|
2167
|
+
f.classType === ae.IMAGE && l.some((m) => f.oKey.includes(m.drawingId)) && u.removeObject(f);
|
|
2209
2168
|
});
|
|
2210
2169
|
}
|
|
2211
2170
|
});
|
|
@@ -2213,9 +2172,9 @@ let $e = class extends de {
|
|
|
2213
2172
|
);
|
|
2214
2173
|
}
|
|
2215
2174
|
_initDrawingEditable() {
|
|
2216
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
2175
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET);
|
|
2217
2176
|
this.disposeWithMe(
|
|
2218
|
-
|
|
2177
|
+
Re([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
2219
2178
|
if (!e) {
|
|
2220
2179
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
2221
2180
|
return;
|
|
@@ -2226,15 +2185,15 @@ let $e = class extends de {
|
|
|
2226
2185
|
return;
|
|
2227
2186
|
}
|
|
2228
2187
|
const r = e.getUnitId(), s = t.getSheetId();
|
|
2229
|
-
if (this._permissionService.composePermission([new
|
|
2188
|
+
if (this._permissionService.composePermission([new Ze(r).id, new Pe(r, s).id]).every((a) => a.value))
|
|
2230
2189
|
this._drawingManagerService.setDrawingEditable(!0);
|
|
2231
2190
|
else {
|
|
2232
2191
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
2233
|
-
const a = e.getUnitId(), d = t.getSheetId(),
|
|
2192
|
+
const a = e.getUnitId(), d = t.getSheetId(), h = this._drawingManagerService.getDrawingData(a, d), l = Object.values(h), c = this._renderManagerService.getRenderById(a), u = c == null ? void 0 : c.scene;
|
|
2234
2193
|
if (u == null)
|
|
2235
2194
|
return;
|
|
2236
2195
|
u.getAllObjects().forEach((f) => {
|
|
2237
|
-
f.classType ===
|
|
2196
|
+
f.classType === ae.IMAGE && l.some((m) => f.oKey.includes(m.drawingId)) && u.detachTransformerFrom(f);
|
|
2238
2197
|
});
|
|
2239
2198
|
}
|
|
2240
2199
|
});
|
|
@@ -2242,9 +2201,9 @@ let $e = class extends de {
|
|
|
2242
2201
|
);
|
|
2243
2202
|
}
|
|
2244
2203
|
_initViewPermissionChange() {
|
|
2245
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
2204
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET);
|
|
2246
2205
|
this.disposeWithMe(
|
|
2247
|
-
|
|
2206
|
+
Re([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
2248
2207
|
e && e.activeSheet$.subscribe((t) => {
|
|
2249
2208
|
var c;
|
|
2250
2209
|
if (!t)
|
|
@@ -2254,26 +2213,26 @@ let $e = class extends de {
|
|
|
2254
2213
|
const a = this._renderManagerService.getRenderById(r), d = a == null ? void 0 : a.scene;
|
|
2255
2214
|
if (d == null)
|
|
2256
2215
|
return;
|
|
2257
|
-
const
|
|
2216
|
+
const h = d.getTransformerByCreate(), l = this._permissionService.composePermission$([new pt(r).id, new He(r, s).id]).pipe(ft((u) => u.every((g) => g.value)));
|
|
2258
2217
|
l == null || l.pipe(
|
|
2259
|
-
|
|
2260
|
-
|
|
2218
|
+
Me((u) => u !== o),
|
|
2219
|
+
De()
|
|
2261
2220
|
).subscribe({
|
|
2262
2221
|
next: (u) => {
|
|
2263
2222
|
o = u, this._drawingManagerService.setDrawingVisible(u);
|
|
2264
|
-
const
|
|
2265
|
-
u ? this._drawingManagerService.addNotification(m) : (
|
|
2266
|
-
p.classType ===
|
|
2267
|
-
}),
|
|
2223
|
+
const g = d.getAllObjects(), f = this._drawingManagerService.getDrawingData(r, s), m = Object.values(f);
|
|
2224
|
+
u ? this._drawingManagerService.addNotification(m) : (g.forEach((p) => {
|
|
2225
|
+
p.classType === ae.IMAGE && m.some((S) => p.oKey.includes(S.drawingId)) && d.removeObject(p);
|
|
2226
|
+
}), h.clearSelectedObjects());
|
|
2268
2227
|
}
|
|
2269
|
-
}), (c = this._permissionService.getPermissionPoint$(new
|
|
2270
|
-
|
|
2271
|
-
|
|
2228
|
+
}), (c = this._permissionService.getPermissionPoint$(new He(r, s).id)) == null || c.pipe(
|
|
2229
|
+
Me((u) => u.value !== o),
|
|
2230
|
+
De()
|
|
2272
2231
|
).subscribe({
|
|
2273
2232
|
complete: () => {
|
|
2274
2233
|
o = !0, this._drawingManagerService.setDrawingVisible(!0);
|
|
2275
|
-
const u = this._drawingManagerService.getDrawingData(r, s),
|
|
2276
|
-
this._drawingManagerService.addNotification(
|
|
2234
|
+
const u = this._drawingManagerService.getDrawingData(r, s), g = Object.values(u);
|
|
2235
|
+
this._drawingManagerService.addNotification(g);
|
|
2277
2236
|
}
|
|
2278
2237
|
});
|
|
2279
2238
|
});
|
|
@@ -2281,9 +2240,9 @@ let $e = class extends de {
|
|
|
2281
2240
|
);
|
|
2282
2241
|
}
|
|
2283
2242
|
_initEditPermissionChange() {
|
|
2284
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
2243
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET);
|
|
2285
2244
|
this.disposeWithMe(
|
|
2286
|
-
|
|
2245
|
+
Re([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
2287
2246
|
e && e.activeSheet$.subscribe((t) => {
|
|
2288
2247
|
var c;
|
|
2289
2248
|
if (!t)
|
|
@@ -2293,31 +2252,31 @@ let $e = class extends de {
|
|
|
2293
2252
|
const a = this._renderManagerService.getRenderById(r), d = a == null ? void 0 : a.scene;
|
|
2294
2253
|
if (d == null)
|
|
2295
2254
|
return;
|
|
2296
|
-
const
|
|
2255
|
+
const h = d.getTransformerByCreate(), l = this._permissionService.composePermission$([new Ze(r).id, new Pe(r, s).id]).pipe(ft((u) => u.every((g) => g.value)));
|
|
2297
2256
|
l == null || l.pipe(
|
|
2298
|
-
|
|
2299
|
-
|
|
2257
|
+
Me((u) => u !== o),
|
|
2258
|
+
De()
|
|
2300
2259
|
).subscribe({
|
|
2301
2260
|
next: (u) => {
|
|
2302
2261
|
o = u, this._drawingManagerService.setDrawingEditable(u);
|
|
2303
|
-
const
|
|
2304
|
-
u ? (
|
|
2305
|
-
p.classType ===
|
|
2306
|
-
}), this._drawingManagerService.addNotification(m)) : (
|
|
2307
|
-
p.classType ===
|
|
2308
|
-
}),
|
|
2262
|
+
const g = d.getAllObjects(), f = this._drawingManagerService.getDrawingData(r, s), m = Object.values(f);
|
|
2263
|
+
u ? (g.forEach((p) => {
|
|
2264
|
+
p.classType === ae.IMAGE && m.some((S) => p.oKey.includes(S.drawingId)) && d.attachTransformerTo(p);
|
|
2265
|
+
}), this._drawingManagerService.addNotification(m)) : (g.forEach((p) => {
|
|
2266
|
+
p.classType === ae.IMAGE && m.some((S) => p.oKey.includes(S.drawingId)) && d.detachTransformerFrom(p);
|
|
2267
|
+
}), h.clearSelectedObjects());
|
|
2309
2268
|
}
|
|
2310
|
-
}), (c = this._permissionService.getPermissionPoint$(new
|
|
2311
|
-
|
|
2312
|
-
|
|
2269
|
+
}), (c = this._permissionService.getPermissionPoint$(new Pe(r, s).id)) == null || c.pipe(
|
|
2270
|
+
Me((u) => u.value !== o),
|
|
2271
|
+
De()
|
|
2313
2272
|
).subscribe({
|
|
2314
2273
|
complete: () => {
|
|
2315
2274
|
o = !0;
|
|
2316
|
-
const u = e.getUnitId(),
|
|
2317
|
-
if (
|
|
2275
|
+
const u = e.getUnitId(), g = t.getSheetId(), f = this._drawingManagerService.getDrawingData(u, g), m = Object.values(f), p = this._renderManagerService.getRenderById(u), S = p == null ? void 0 : p.scene;
|
|
2276
|
+
if (S == null)
|
|
2318
2277
|
return;
|
|
2319
|
-
this._drawingManagerService.setDrawingEditable(!0),
|
|
2320
|
-
|
|
2278
|
+
this._drawingManagerService.setDrawingEditable(!0), S.getAllObjects().forEach((v) => {
|
|
2279
|
+
v.classType === ae.IMAGE && m.some((R) => v.oKey.includes(R.drawingId)) && S.detachTransformerFrom(v);
|
|
2321
2280
|
});
|
|
2322
2281
|
}
|
|
2323
2282
|
});
|
|
@@ -2326,67 +2285,71 @@ let $e = class extends de {
|
|
|
2326
2285
|
);
|
|
2327
2286
|
}
|
|
2328
2287
|
};
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
fe(0,
|
|
2332
|
-
fe(1,
|
|
2288
|
+
je = vi([
|
|
2289
|
+
ie(se.Rendered, je),
|
|
2290
|
+
fe(0, z),
|
|
2291
|
+
fe(1, K),
|
|
2333
2292
|
fe(2, un),
|
|
2334
|
-
fe(3,
|
|
2293
|
+
fe(3, he),
|
|
2335
2294
|
fe(4, W(ln))
|
|
2336
|
-
],
|
|
2337
|
-
var
|
|
2338
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2295
|
+
], je);
|
|
2296
|
+
var Si = Object.defineProperty, Ci = Object.getOwnPropertyDescriptor, Ii = (i, e, n, t) => {
|
|
2297
|
+
for (var r = t > 1 ? void 0 : t ? Ci(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2339
2298
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2340
|
-
return t && r &&
|
|
2341
|
-
},
|
|
2342
|
-
let
|
|
2343
|
-
constructor(e, n, t
|
|
2299
|
+
return t && r && Si(e, n, r), r;
|
|
2300
|
+
}, Ke = (i, e) => (n, t) => e(n, t, i);
|
|
2301
|
+
let Le = class extends oe {
|
|
2302
|
+
constructor(e, n, t) {
|
|
2344
2303
|
super();
|
|
2345
|
-
|
|
2346
|
-
this._sheetClipboardService = e, this.
|
|
2304
|
+
H(this, "_copyInfo");
|
|
2305
|
+
this._sheetClipboardService = e, this._renderManagerService = n, this._sheetDrawingService = t, this._initCopyPaste();
|
|
2347
2306
|
}
|
|
2348
2307
|
_initCopyPaste() {
|
|
2349
2308
|
this._sheetClipboardService.addClipboardHook({
|
|
2350
2309
|
id: "SHEET_IMAGE_UI_PLUGIN",
|
|
2351
2310
|
onBeforeCopy: (e, n, t) => this._collect(e, n, t),
|
|
2352
2311
|
onPasteCells: (e, n, t, r) => {
|
|
2353
|
-
const { copyType: s =
|
|
2354
|
-
return this._generateMutations(d, { copyType: s, pasteType: o, copyRange: a, unitId:
|
|
2312
|
+
const { copyType: s = gt.COPY, pasteType: o } = r, { range: a } = e || {}, { range: d, unitId: h, subUnitId: l } = n;
|
|
2313
|
+
return this._generateMutations(d, { copyType: s, pasteType: o, copyRange: a, unitId: h, subUnitId: l });
|
|
2355
2314
|
},
|
|
2356
2315
|
onPastePlainText: (e, n) => ({ undos: [], redos: [] })
|
|
2357
2316
|
});
|
|
2358
2317
|
}
|
|
2359
2318
|
_collect(e, n, t) {
|
|
2360
|
-
|
|
2361
|
-
|
|
2319
|
+
var u;
|
|
2320
|
+
const r = (u = this._renderManagerService.getRenderById(e)) == null ? void 0 : u.with(re);
|
|
2321
|
+
if (!r) return;
|
|
2322
|
+
const s = r.attachRangeWithCoord(t);
|
|
2323
|
+
if (!s)
|
|
2362
2324
|
return;
|
|
2363
|
-
const { startX:
|
|
2364
|
-
Object.keys(
|
|
2365
|
-
const
|
|
2366
|
-
if (
|
|
2325
|
+
const { startX: o, endX: a, startY: d, endY: h } = s, l = this._sheetDrawingService.getDrawingData(e, n), c = [];
|
|
2326
|
+
Object.keys(l).forEach((g) => {
|
|
2327
|
+
const f = l[g], { transform: m } = f;
|
|
2328
|
+
if (f.anchorType !== O.Both || !m)
|
|
2367
2329
|
return;
|
|
2368
|
-
const { left:
|
|
2369
|
-
drawingStartX:
|
|
2370
|
-
drawingEndX:
|
|
2371
|
-
drawingStartY:
|
|
2372
|
-
drawingEndY:
|
|
2330
|
+
const { left: p = 0, top: S = 0, width: C = 0, height: v = 0 } = m, { drawingStartX: R, drawingEndX: _, drawingStartY: b, drawingEndY: w } = {
|
|
2331
|
+
drawingStartX: p,
|
|
2332
|
+
drawingEndX: p + C,
|
|
2333
|
+
drawingStartY: S,
|
|
2334
|
+
drawingEndY: S + v
|
|
2373
2335
|
};
|
|
2374
|
-
|
|
2375
|
-
}),
|
|
2376
|
-
drawings:
|
|
2336
|
+
o <= R && _ <= a && d <= b && w <= h && c.push(f);
|
|
2337
|
+
}), c.length && (this._copyInfo = {
|
|
2338
|
+
drawings: c,
|
|
2377
2339
|
unitId: e,
|
|
2378
2340
|
subUnitId: n
|
|
2379
2341
|
});
|
|
2380
2342
|
}
|
|
2381
2343
|
// eslint-disable-next-line max-lines-per-function
|
|
2382
2344
|
_generateMutations(e, n) {
|
|
2345
|
+
var D;
|
|
2383
2346
|
if (!this._copyInfo)
|
|
2384
2347
|
return { redos: [], undos: [] };
|
|
2385
2348
|
if ([
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2349
|
+
Ie.SPECIAL_PASTE_COL_WIDTH,
|
|
2350
|
+
Ie.SPECIAL_PASTE_VALUE,
|
|
2351
|
+
Ie.SPECIAL_PASTE_FORMAT,
|
|
2352
|
+
Ie.SPECIAL_PASTE_FORMULA
|
|
2390
2353
|
].includes(
|
|
2391
2354
|
n.pasteType
|
|
2392
2355
|
))
|
|
@@ -2394,96 +2357,101 @@ let Ve = class extends de {
|
|
|
2394
2357
|
const { copyRange: t } = n;
|
|
2395
2358
|
if (!t)
|
|
2396
2359
|
return { redos: [], undos: [] };
|
|
2397
|
-
const { drawings: r, unitId: s, subUnitId: o } = this._copyInfo, { ranges: [a, d], mapFunc:
|
|
2360
|
+
const { drawings: r, unitId: s, subUnitId: o } = this._copyInfo, { ranges: [a, d], mapFunc: h } = Wn([t, e]), { row: l, col: c } = h(a.startRow, a.startColumn), { row: u, col: g } = h(d.startRow, d.startColumn), f = (D = this._renderManagerService.getRenderById(s)) == null ? void 0 : D.with(re);
|
|
2361
|
+
if (!f)
|
|
2362
|
+
return { redos: [], undos: [] };
|
|
2363
|
+
const m = f.attachRangeWithCoord({
|
|
2398
2364
|
startRow: l,
|
|
2399
2365
|
endRow: l,
|
|
2400
2366
|
startColumn: c,
|
|
2401
2367
|
endColumn: c
|
|
2402
|
-
}),
|
|
2368
|
+
}), p = f.attachRangeWithCoord({
|
|
2403
2369
|
startRow: u,
|
|
2404
2370
|
endRow: u,
|
|
2405
|
-
startColumn:
|
|
2406
|
-
endColumn:
|
|
2371
|
+
startColumn: g,
|
|
2372
|
+
endColumn: g
|
|
2407
2373
|
});
|
|
2408
|
-
if (!
|
|
2374
|
+
if (!m || !p)
|
|
2409
2375
|
return { redos: [], undos: [] };
|
|
2410
|
-
const
|
|
2411
|
-
return r.forEach((
|
|
2412
|
-
const { transform:
|
|
2413
|
-
if (!
|
|
2376
|
+
const S = [], C = [], v = p.startX - m.startX, R = p.startY - m.startY, _ = u - l, b = g - c, w = n.copyType === gt.CUT, { _sheetDrawingService: P } = this;
|
|
2377
|
+
return r.forEach((T) => {
|
|
2378
|
+
const { transform: U, sheetTransform: M } = T;
|
|
2379
|
+
if (!U)
|
|
2414
2380
|
return;
|
|
2415
|
-
const
|
|
2416
|
-
...
|
|
2381
|
+
const I = {
|
|
2382
|
+
...T,
|
|
2417
2383
|
unitId: s,
|
|
2418
2384
|
subUnitId: o,
|
|
2419
|
-
drawingId:
|
|
2385
|
+
drawingId: w ? T.drawingId : ne.generateRandomId(),
|
|
2420
2386
|
transform: {
|
|
2421
|
-
...
|
|
2422
|
-
left:
|
|
2423
|
-
top:
|
|
2387
|
+
...U,
|
|
2388
|
+
left: U.left + v,
|
|
2389
|
+
top: U.top + R
|
|
2424
2390
|
},
|
|
2425
2391
|
sheetTransform: {
|
|
2426
|
-
to: { ...
|
|
2427
|
-
from: { ...
|
|
2392
|
+
to: { ...M.to, row: M.to.row + _, column: M.to.column + b },
|
|
2393
|
+
from: { ...M.from, row: M.from.row + _, column: M.from.column + b }
|
|
2428
2394
|
}
|
|
2429
2395
|
};
|
|
2430
|
-
if (
|
|
2431
|
-
const { undo:
|
|
2432
|
-
|
|
2433
|
-
id:
|
|
2396
|
+
if (w) {
|
|
2397
|
+
const { undo: A, redo: G, objects: J } = P.getBatchUpdateOp([I]);
|
|
2398
|
+
S.push({
|
|
2399
|
+
id: E.id,
|
|
2434
2400
|
params: {
|
|
2435
2401
|
unitId: s,
|
|
2436
2402
|
subUnitId: o,
|
|
2437
|
-
type:
|
|
2438
|
-
op:
|
|
2439
|
-
objects:
|
|
2403
|
+
type: y.UPDATE,
|
|
2404
|
+
op: G,
|
|
2405
|
+
objects: J
|
|
2440
2406
|
}
|
|
2441
|
-
}),
|
|
2442
|
-
id:
|
|
2407
|
+
}), C.push({
|
|
2408
|
+
id: E.id,
|
|
2443
2409
|
params: {
|
|
2444
2410
|
unitId: s,
|
|
2445
2411
|
subUnitId: o,
|
|
2446
|
-
type:
|
|
2447
|
-
op:
|
|
2448
|
-
objects:
|
|
2412
|
+
type: y.UPDATE,
|
|
2413
|
+
op: A,
|
|
2414
|
+
objects: J
|
|
2449
2415
|
}
|
|
2450
2416
|
});
|
|
2451
2417
|
} else {
|
|
2452
|
-
const { undo:
|
|
2453
|
-
|
|
2418
|
+
const { undo: A, redo: G, objects: J } = P.getBatchAddOp([I]);
|
|
2419
|
+
S.push({ id: E.id, params: { op: G, unitId: s, subUnitId: o, objects: J, type: y.INSERT } }), C.push({ id: E.id, params: { op: A, unitId: s, subUnitId: o, objects: J, type: y.REMOVE } });
|
|
2454
2420
|
}
|
|
2455
2421
|
}), {
|
|
2456
|
-
redos:
|
|
2457
|
-
undos:
|
|
2422
|
+
redos: S,
|
|
2423
|
+
undos: C
|
|
2458
2424
|
};
|
|
2459
2425
|
}
|
|
2460
2426
|
};
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
],
|
|
2468
|
-
var qt = Object.defineProperty, Ri = Object.getOwnPropertyDescriptor, Ii = (i, e, n) => e in i ? qt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, Di = (i, e, n, t) => {
|
|
2427
|
+
Le = Ii([
|
|
2428
|
+
ie(se.Ready, Le),
|
|
2429
|
+
Ke(0, $n),
|
|
2430
|
+
Ke(1, K),
|
|
2431
|
+
Ke(2, k)
|
|
2432
|
+
], Le);
|
|
2433
|
+
var qt = Object.defineProperty, Ri = Object.getOwnPropertyDescriptor, Mi = (i, e, n) => e in i ? qt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, Di = (i, e, n, t) => {
|
|
2469
2434
|
for (var r = t > 1 ? void 0 : t ? Ri(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2470
2435
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2471
2436
|
return t && r && qt(e, n, r), r;
|
|
2472
|
-
},
|
|
2473
|
-
const
|
|
2474
|
-
let
|
|
2437
|
+
}, Je = (i, e) => (n, t) => e(n, t, i), Qt = (i, e, n) => Mi(i, typeof e != "symbol" ? e + "" : e, n);
|
|
2438
|
+
const bi = "SHEET_IMAGE_UI_PLUGIN";
|
|
2439
|
+
let $e = class extends gn {
|
|
2475
2440
|
constructor(e = {}, n, t, r) {
|
|
2476
2441
|
super();
|
|
2477
|
-
|
|
2478
|
-
this._injector = n, this._localeService = t, this._renderManagerService = r, this._pluginConfig =
|
|
2442
|
+
H(this, "_pluginConfig");
|
|
2443
|
+
this._injector = n, this._localeService = t, this._renderManagerService = r, this._pluginConfig = ne.deepMerge({}, ii, e);
|
|
2479
2444
|
}
|
|
2480
2445
|
onStarting(e) {
|
|
2481
2446
|
super.onStarting(e), this._initDependencies(e);
|
|
2482
2447
|
}
|
|
2448
|
+
onRendered() {
|
|
2449
|
+
this._registerRenderModules();
|
|
2450
|
+
}
|
|
2483
2451
|
_initDependencies(e) {
|
|
2484
2452
|
const n = [
|
|
2485
2453
|
// services
|
|
2486
|
-
[
|
|
2454
|
+
[tt],
|
|
2487
2455
|
// controllers
|
|
2488
2456
|
[
|
|
2489
2457
|
pe,
|
|
@@ -2491,39 +2459,45 @@ let Xe = class extends hn {
|
|
|
2491
2459
|
useFactory: () => this._injector.createInstance(pe, this._pluginConfig)
|
|
2492
2460
|
}
|
|
2493
2461
|
],
|
|
2494
|
-
[
|
|
2495
|
-
[
|
|
2496
|
-
[
|
|
2497
|
-
[Ve]
|
|
2462
|
+
[Te],
|
|
2463
|
+
[Ne],
|
|
2464
|
+
[je]
|
|
2498
2465
|
], t = [
|
|
2499
|
-
|
|
2500
|
-
|
|
2466
|
+
Ue,
|
|
2467
|
+
Ae
|
|
2501
2468
|
];
|
|
2502
|
-
n.forEach((r) => e.add(r)), t.forEach((r) => this._renderManagerService.registerRenderModule(
|
|
2469
|
+
n.forEach((r) => e.add(r)), t.forEach((r) => this._renderManagerService.registerRenderModule(B.UNIVER_SHEET, r));
|
|
2470
|
+
}
|
|
2471
|
+
_registerRenderModules() {
|
|
2472
|
+
[
|
|
2473
|
+
[Le]
|
|
2474
|
+
].forEach((e) => {
|
|
2475
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(B.UNIVER_SHEET, e));
|
|
2476
|
+
});
|
|
2503
2477
|
}
|
|
2504
2478
|
};
|
|
2505
|
-
Qt(
|
|
2506
|
-
Qt(
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
],
|
|
2479
|
+
Qt($e, "type", B.UNIVER_SHEET);
|
|
2480
|
+
Qt($e, "pluginName", bi);
|
|
2481
|
+
$e = Di([
|
|
2482
|
+
hn(bn, Sn, Cn),
|
|
2483
|
+
Je(1, W(nt)),
|
|
2484
|
+
Je(2, W(_e)),
|
|
2485
|
+
Je(3, K)
|
|
2486
|
+
], $e);
|
|
2513
2487
|
export {
|
|
2514
2488
|
j as ClearSheetDrawingTransformerOperation,
|
|
2515
2489
|
Zt as DeleteDrawingsCommand,
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2490
|
+
Gt as EditSheetDrawingOperation,
|
|
2491
|
+
Ft as GroupSheetDrawingCommand,
|
|
2492
|
+
Be as InsertCellImageOperation,
|
|
2493
|
+
xe as InsertFloatImageOperation,
|
|
2494
|
+
st as InsertSheetDrawingCommand,
|
|
2495
|
+
ve as MoveDrawingsCommand,
|
|
2496
|
+
it as RemoveSheetDrawingCommand,
|
|
2497
|
+
xt as SetDrawingArrangeCommand,
|
|
2498
|
+
Fe as SetSheetDrawingCommand,
|
|
2499
|
+
tt as SheetCanvasFloatDomManagerService,
|
|
2526
2500
|
Vt as SidebarSheetDrawingOperation,
|
|
2527
|
-
|
|
2528
|
-
|
|
2501
|
+
Yt as UngroupSheetDrawingCommand,
|
|
2502
|
+
$e as UniverSheetsDrawingUIPlugin
|
|
2529
2503
|
};
|