@univerjs/sheets-drawing-ui 0.6.10 → 0.7.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +9 -2
- package/lib/es/index.js +1417 -1461
- package/lib/index.css +1 -1
- package/lib/index.js +1417 -1461
- package/lib/types/controllers/drawing-popup-menu.controller.d.ts +8 -5
- package/lib/types/views/printing-float-dom/index.d.ts +0 -6
- package/lib/umd/index.js +9 -2
- package/package.json +16 -17
- package/lib/types/views/upload-loading/UploadLoading.d.ts +0 -16
package/lib/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var te = (i, t, e) =>
|
|
4
|
-
import { CommandType as J, ICommandService as G, IUndoRedoService as
|
|
5
|
-
import { DocDrawingController as
|
|
6
|
-
import { SetDrawingSelectedOperation as
|
|
7
|
-
import { ImageCropperObject as
|
|
8
|
-
import { IRenderManagerService as q, CURSOR_TYPE as
|
|
9
|
-
import { ISheetDrawingService as oe, DrawingApplyType as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
const
|
|
1
|
+
var Nr = Object.defineProperty;
|
|
2
|
+
var kr = (i, t, e) => t in i ? Nr(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var te = (i, t, e) => kr(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { CommandType as J, ICommandService as G, IUndoRedoService as Le, sequenceExecute as Ln, LocaleService as nt, IUniverInstanceService as Se, Inject as A, Injector as Ye, IContextService as Yn, IImageIoService as Wr, RxDisposable as jr, UniverInstanceType as F, FOCUSING_COMMON_DRAWINGS as xe, DrawingTypeEnum as j, Disposable as ie, ArrangeTypeEnum as pt, createDocumentModelWithStyle as Ht, ObjectRelativeFromV as pn, ObjectRelativeFromH as wn, WrapTextType as _n, PositionedObjectLayoutType as vn, BooleanNumber as Sn, BuildTextUtils as zt, ImageSourceType as In, generateRandomId as bt, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as qe, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Be, InterceptorEffectEnum as Br, ObjectMatrix as $r, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as xr, Tools as Re, IPermissionService as Fr, UserManagerService as Lr, LifecycleService as Yr, LifecycleStages as Gr, DisposableCollection as wt, fromEventSubject as Xr, PRINT_CHART_COMPONENT_KEY as Vr, Rectangle as Hr, Direction as ve, FOCUSING_FX_BAR_EDITOR as zr, EDITOR_ACTIVATED as Kr, FOCUSING_PANEL_EDITOR as Zr, DependentOn as Jr, IConfigService as qr, Plugin as Qr, merge as ei, registerDependencies as ti, touchDependencies as Ft } from "@univerjs/core";
|
|
5
|
+
import { DocDrawingController as ni, UniverDocsDrawingPlugin as ri } from "@univerjs/docs-drawing";
|
|
6
|
+
import { SetDrawingSelectedOperation as Nt, IDrawingManagerService as se, IImageIoService as ii, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Cn, DRAWING_IMAGE_COUNT_LIMIT as Dn, ImageUploadStatusType as Pe, DRAWING_IMAGE_ALLOW_SIZE as bn, getImageSize as Lt, DRAWING_IMAGE_WIDTH_LIMIT as Rn, DRAWING_IMAGE_HEIGHT_LIMIT as Mn, ImageSourceType as si, getDrawingShapeKeyByDrawingSearch as Ie, UniverDrawingPlugin as oi } from "@univerjs/drawing";
|
|
7
|
+
import { ImageCropperObject as ai, COMPONENT_IMAGE_POPUP_MENU as ci, OpenImageCropOperation as di, ImageResetSizeOperation as li, DrawingRenderService as Gn, DrawingCommonPanel as ui, UniverDrawingUIPlugin as hi } from "@univerjs/drawing-ui";
|
|
8
|
+
import { IRenderManagerService as q, CURSOR_TYPE as gi, precisionTo as _t, transformObjectOutOfGroup as fi, getGroupState as mi, getCurrentTypeOfRenderer as on, RENDER_CLASS_TYPE as Ae, Rect as Ne, ObjectType as yn, DRAWING_OBJECT_LAYER_INDEX as Yt, SHEET_VIEWPORT_KEY as Xn } from "@univerjs/engine-render";
|
|
9
|
+
import { ISheetDrawingService as oe, DrawingApplyType as U, SetDrawingApplyMutation as P, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as pi } from "@univerjs/sheets-drawing";
|
|
10
|
+
import { MessageType as we, render as wi, unmount as _i, RadioGroup as vi, Radio as Gt } from "@univerjs/design";
|
|
11
|
+
import { SheetCanvasPopManagerService as Si, HoverManagerService as Ii, SheetSkeletonManagerService as V, convertPositionSheetOverGridToAbsolute as Ci, ISheetSelectionRenderService as Ge, attachRangeWithCoord as Vn, IEditorBridgeService as Di, IAutoFillService as bi, EditingRenderController as Ri, SetCellEditVisibleOperation as En, PREDEFINED_HOOK_NAME as $e, COPY_TYPE as Ce, discreteRangeToRange as Tn, virtualizeDiscreteRanges as Mi, ISheetClipboardService as yi, SetZoomRatioOperation as On, SetScrollOperation as Ei, SheetPrintInterceptorService as Ti, getCurrentRangeDisable$ as Oi } from "@univerjs/sheets-ui";
|
|
12
|
+
import { ISidebarService as Ui, IMessageService as Hn, ILocalFileService as Pi, IDialogService as Ai, IClipboardInterfaceService as Ni, CanvasFloatDomService as ki, PrintFloatDomSingle as Wi, ComponentManager as zn, connectInjector as ji, getMenuHiddenObservable as an, MenuItemType as cn, useDependency as Qe, RibbonStartGroup as Bi, KeyCode as Fe, IMenuManagerService as $i, IShortcutService as xi } from "@univerjs/ui";
|
|
13
|
+
import { takeUntil as Un, throttleTime as Fi, combineLatest as vt, switchMap as _e, EMPTY as me, tap as Pn, map as Me, distinctUntilChanged as An, Subject as Xt, filter as Li, take as Yi, BehaviorSubject as je, of as Nn } from "rxjs";
|
|
14
|
+
import { SheetInterceptorService as kt, getSheetCommandTarget as ae, SheetsSelectionsService as dn, SetRangeValuesCommand as kn, INTERCEPTOR_POINT as Gi, InterceptCellContentPriority as Xi, WorkbookViewPermission as Wn, WorksheetViewPermission as jn, WorkbookEditablePermission as Kt, WorksheetEditPermission as Zt, SetFrozenMutation as Vi, SetWorksheetRowAutoHeightMutation as Hi, COMMAND_LISTENER_SKELETON_CHANGE as zi, InsertRowCommand as Kn, InsertColCommand as Zn, RemoveRowCommand as Jn, RemoveColCommand as qn, DeleteRangeMoveLeftCommand as Qn, DeleteRangeMoveUpCommand as er, InsertRangeMoveDownCommand as tr, InsertRangeMoveRightCommand as nr, DeltaRowHeightCommand as Jt, SetRowHeightCommand as qt, DeltaColumnWidthCommand as rr, SetColWidthCommand as ir, SetRowHiddenCommand as sr, SetSpecificRowsVisibleCommand as or, SetSpecificColsVisibleCommand as ar, SetColHiddenCommand as cr, MoveColsCommand as dr, MoveRowsCommand as lr, MoveRangeCommand as ur, SetRowVisibleMutation as Ki, SetRowHiddenMutation as Zi, SetColVisibleMutation as Ji, SetColHiddenMutation as qi, SetWorksheetRowHeightMutation as Qi, SetWorksheetColWidthMutation as es, SetWorksheetActiveOperation as ts, RangeProtectionPermissionEditPoint as ns } from "@univerjs/sheets";
|
|
15
|
+
import { docDrawingPositionToTransform as Bn, ReplaceSnapshotCommand as rs, InnerPasteCommand as is } from "@univerjs/docs-ui";
|
|
16
|
+
import { jsx as Z, jsxs as Qt } from "react/jsx-runtime";
|
|
17
|
+
import { useMemo as ss, forwardRef as hr, useRef as os, createElement as gr, useState as en, useEffect as fr } from "react";
|
|
18
|
+
const as = "sheets-drawing-ui.config", $n = {}, L = {
|
|
19
19
|
id: "sheet.operation.clear-drawing-transformer",
|
|
20
20
|
type: J.MUTATION,
|
|
21
21
|
handler: (i, t) => {
|
|
@@ -25,48 +25,48 @@ const gs = "sheets-drawing-ui.config", Vn = {}, F = {
|
|
|
25
25
|
(s = (r = e.getRenderById(n)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
|
|
26
26
|
}), !0;
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, rt = {
|
|
29
29
|
id: "sheet.command.remove-sheet-image",
|
|
30
30
|
type: J.COMMAND,
|
|
31
31
|
handler: (i, t) => {
|
|
32
32
|
var S, C, b;
|
|
33
|
-
const e = i.get(G), n = i.get(
|
|
33
|
+
const e = i.get(G), n = i.get(Le), r = i.get(kt), s = i.get(oe);
|
|
34
34
|
if (!t) return !1;
|
|
35
35
|
const { drawings: o } = t, a = [];
|
|
36
36
|
o.forEach((v) => {
|
|
37
37
|
const { unitId: D } = v;
|
|
38
38
|
a.push(D);
|
|
39
39
|
});
|
|
40
|
-
const
|
|
41
|
-
return
|
|
40
|
+
const d = s.getBatchRemoveOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, m = r.onCommandExecute({ id: rt.id, params: t }), p = { id: P.id, params: { unitId: u, subUnitId: c, op: g, objects: h, type: U.REMOVE } }, f = { id: P.id, params: { unitId: u, subUnitId: c, op: l, objects: h, type: U.INSERT } };
|
|
41
|
+
return Ln([...(S = m.preRedos) != null ? S : [], p, ...m.redos], e) ? (n.pushUndoRedo({
|
|
42
42
|
unitID: u,
|
|
43
43
|
undoMutations: [
|
|
44
|
-
...(C =
|
|
45
|
-
|
|
46
|
-
...
|
|
47
|
-
{ id:
|
|
44
|
+
...(C = m.preUndos) != null ? C : [],
|
|
45
|
+
f,
|
|
46
|
+
...m.undos,
|
|
47
|
+
{ id: L.id, params: a }
|
|
48
48
|
],
|
|
49
49
|
redoMutations: [
|
|
50
|
-
...(b =
|
|
50
|
+
...(b = m.preRedos) != null ? b : [],
|
|
51
51
|
p,
|
|
52
|
-
...
|
|
53
|
-
{ id:
|
|
52
|
+
...m.redos,
|
|
53
|
+
{ id: L.id, params: a }
|
|
54
54
|
]
|
|
55
55
|
}), !0) : !1;
|
|
56
56
|
}
|
|
57
|
-
},
|
|
57
|
+
}, mr = "COMPONENT_SHEET_DRAWING_PANEL", pr = {
|
|
58
58
|
id: "sidebar.operation.sheet-image",
|
|
59
59
|
type: J.COMMAND,
|
|
60
60
|
handler: async (i, t) => {
|
|
61
|
-
const e = i.get(
|
|
61
|
+
const e = i.get(Ui), n = i.get(nt), r = i.get(Se), s = i.get(G);
|
|
62
62
|
if (!ae(r)) return !1;
|
|
63
63
|
switch (t.value) {
|
|
64
64
|
case "open":
|
|
65
65
|
e.open({
|
|
66
66
|
header: { title: n.t("sheetImage.panel.title") },
|
|
67
|
-
children: { label:
|
|
67
|
+
children: { label: mr },
|
|
68
68
|
onClose: () => {
|
|
69
|
-
s.syncExecuteCommand(
|
|
69
|
+
s.syncExecuteCommand(Nt.id, []);
|
|
70
70
|
},
|
|
71
71
|
width: 360
|
|
72
72
|
});
|
|
@@ -78,47 +78,42 @@ const gs = "sheets-drawing-ui.config", Vn = {}, F = {
|
|
|
78
78
|
}
|
|
79
79
|
return !0;
|
|
80
80
|
}
|
|
81
|
-
},
|
|
81
|
+
}, wr = {
|
|
82
82
|
id: "sheet.operation.edit-sheet-image",
|
|
83
83
|
type: J.OPERATION,
|
|
84
84
|
handler: (i, t) => {
|
|
85
85
|
const e = i.get(G);
|
|
86
|
-
return t == null ? !1 : (e.syncExecuteCommand(
|
|
87
|
-
}
|
|
88
|
-
}, ms = "univer-upload-loading", fs = "univer-upload-loading-body", ps = "univer-upload-loading-body-animation", ws = "univer-upload-loading-body-text", Dt = {
|
|
89
|
-
uploadLoading: ms,
|
|
90
|
-
uploadLoadingBody: fs,
|
|
91
|
-
uploadLoadingBodyAnimation: ps,
|
|
92
|
-
uploadLoadingBodyText: ws
|
|
93
|
-
}, _s = () => {
|
|
94
|
-
const i = me(Jn), t = me(it), [e, n] = os.useState(0);
|
|
95
|
-
return pn(() => {
|
|
96
|
-
const r = i.change$.subscribe((s) => {
|
|
97
|
-
n(s);
|
|
98
|
-
});
|
|
99
|
-
return () => {
|
|
100
|
-
r.unsubscribe();
|
|
101
|
-
};
|
|
102
|
-
}, [i]), /* @__PURE__ */ X("div", { style: { display: e > 0 ? "block" : "none" }, className: Dt.uploadLoading, children: /* @__PURE__ */ Tt("div", { className: Dt.uploadLoadingBody, children: [
|
|
103
|
-
/* @__PURE__ */ X("div", { className: Dt.uploadLoadingBodyAnimation }),
|
|
104
|
-
/* @__PURE__ */ X("div", { className: Dt.uploadLoadingBodyText, children: `${t.t("uploadLoading.loading")}: ${e}` })
|
|
105
|
-
] }) });
|
|
86
|
+
return t == null ? !1 : (e.syncExecuteCommand(Nt.id, [t]), e.executeCommand(pr.id, { value: "open" }), !0);
|
|
87
|
+
}
|
|
106
88
|
};
|
|
107
|
-
var
|
|
108
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
89
|
+
var cs = Object.getOwnPropertyDescriptor, ds = (i, t, e, n) => {
|
|
90
|
+
for (var r = n > 1 ? void 0 : n ? cs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
109
91
|
(o = i[s]) && (r = o(r) || r);
|
|
110
92
|
return r;
|
|
111
|
-
},
|
|
112
|
-
let
|
|
113
|
-
constructor(t, e, n, r, s, o, a, c) {
|
|
93
|
+
}, de = (i, t) => (e, n) => t(e, n, i);
|
|
94
|
+
let Rt = class extends jr {
|
|
95
|
+
constructor(t, e, n, r, s, o, a, d, u, c) {
|
|
114
96
|
super();
|
|
115
97
|
te(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
116
|
-
this._injector = t, this.
|
|
98
|
+
this._injector = t, this._localeService = e, this._drawingManagerService = n, this._canvasPopManagerService = r, this._renderManagerService = s, this._univerInstanceService = o, this._messageService = a, this._contextService = d, this._ioService = u, this._commandService = c, this._init();
|
|
117
99
|
}
|
|
118
100
|
_init() {
|
|
119
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
101
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(Un(this.dispose$)).subscribe((t) => this._create(t)), this._univerInstanceService.getTypeOfUnitDisposed$(F.UNIVER_SHEET).pipe(Un(this.dispose$)).subscribe((t) => this._dispose(t)), this._univerInstanceService.getAllUnitsForType(F.UNIVER_SHEET).forEach((t) => this._create(t)), this._setupLoadingStatus();
|
|
102
|
+
}
|
|
103
|
+
_setupLoadingStatus() {
|
|
104
|
+
const t = "image-upload-loading";
|
|
105
|
+
let e;
|
|
106
|
+
this.disposeWithMe(this._ioService.change$.subscribe((n) => {
|
|
107
|
+
n > 0 && !e ? e = this._messageService.show({
|
|
108
|
+
id: t,
|
|
109
|
+
type: we.Loading,
|
|
110
|
+
content: `${this._localeService.t("uploadLoading.loading")}: ${n}`,
|
|
111
|
+
duration: 0
|
|
112
|
+
}) : n === 0 && (e == null || e.dispose(), e = void 0);
|
|
113
|
+
}));
|
|
120
114
|
}
|
|
121
115
|
_dispose(t) {
|
|
116
|
+
super.dispose();
|
|
122
117
|
const e = t.getUnitId();
|
|
123
118
|
this._renderManagerService.removeRender(e);
|
|
124
119
|
}
|
|
@@ -131,7 +126,7 @@ let Ot = class extends Fr {
|
|
|
131
126
|
_hasCropObject(t) {
|
|
132
127
|
const e = t.getAllObjectsByOrder();
|
|
133
128
|
for (const n of e)
|
|
134
|
-
if (n instanceof
|
|
129
|
+
if (n instanceof ai)
|
|
135
130
|
return !0;
|
|
136
131
|
return !1;
|
|
137
132
|
}
|
|
@@ -145,43 +140,41 @@ let Ot = class extends Fr {
|
|
|
145
140
|
return;
|
|
146
141
|
let r;
|
|
147
142
|
this.disposeWithMe(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (o.size > 1) {
|
|
154
|
-
r == null || r.dispose();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const a = o.values().next().value;
|
|
158
|
-
if (!a)
|
|
159
|
-
return;
|
|
160
|
-
const c = a.oKey, u = this._drawingManagerService.getDrawingOKey(c);
|
|
161
|
-
if (!u)
|
|
162
|
-
return;
|
|
163
|
-
const { unitId: d, subUnitId: l, drawingId: g, drawingType: h } = u, f = u.data;
|
|
164
|
-
if (f && f.disablePopup)
|
|
165
|
-
return;
|
|
143
|
+
n.createControl$.subscribe(() => {
|
|
144
|
+
if (this._contextService.setContextValue(xe, !0), this._hasCropObject(e))
|
|
145
|
+
return;
|
|
146
|
+
const o = n.getSelectedObjectMap();
|
|
147
|
+
if (o.size > 1) {
|
|
166
148
|
r == null || r.dispose();
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const a = o.values().next().value;
|
|
152
|
+
if (!a)
|
|
153
|
+
return;
|
|
154
|
+
const d = a.oKey, u = this._drawingManagerService.getDrawingOKey(d);
|
|
155
|
+
if (!u)
|
|
156
|
+
return;
|
|
157
|
+
const { unitId: c, subUnitId: l, drawingId: g, drawingType: h } = u, m = u.data;
|
|
158
|
+
if (m && m.disablePopup)
|
|
159
|
+
return;
|
|
160
|
+
r == null || r.dispose();
|
|
161
|
+
const p = this._canvasPopManagerService.getFeatureMenu(c, l, g, h);
|
|
162
|
+
r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
|
|
163
|
+
componentKey: ci,
|
|
164
|
+
direction: "horizontal",
|
|
165
|
+
offset: [2, 0],
|
|
166
|
+
extraProps: {
|
|
167
|
+
menuItems: p || this._getImageMenuItems(c, l, g, h)
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
})
|
|
178
171
|
), this.disposeWithMe(
|
|
179
172
|
n.clearControl$.subscribe(() => {
|
|
180
|
-
r == null || r.dispose(), this._contextService.setContextValue(
|
|
173
|
+
r == null || r.dispose(), this._contextService.setContextValue(xe, !1), this._commandService.syncExecuteCommand(Nt.id, []);
|
|
181
174
|
})
|
|
182
175
|
), this.disposeWithMe(
|
|
183
176
|
this._contextService.contextChanged$.subscribe((o) => {
|
|
184
|
-
o[
|
|
177
|
+
o[xe] === !1 && (r == null || r.dispose());
|
|
185
178
|
})
|
|
186
179
|
), this.disposeWithMe(
|
|
187
180
|
n.changing$.subscribe(() => {
|
|
@@ -194,60 +187,62 @@ let Ot = class extends Fr {
|
|
|
194
187
|
{
|
|
195
188
|
label: "image-popup.edit",
|
|
196
189
|
index: 0,
|
|
197
|
-
commandId:
|
|
190
|
+
commandId: wr.id,
|
|
198
191
|
commandParams: { unitId: t, subUnitId: e, drawingId: n },
|
|
199
|
-
disable: r ===
|
|
192
|
+
disable: r === j.DRAWING_DOM
|
|
200
193
|
},
|
|
201
194
|
{
|
|
202
195
|
label: "image-popup.delete",
|
|
203
196
|
index: 1,
|
|
204
|
-
commandId:
|
|
197
|
+
commandId: rt.id,
|
|
205
198
|
commandParams: { unitId: t, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
|
|
206
199
|
disable: !1
|
|
207
200
|
},
|
|
208
201
|
{
|
|
209
202
|
label: "image-popup.crop",
|
|
210
203
|
index: 2,
|
|
211
|
-
commandId:
|
|
204
|
+
commandId: di.id,
|
|
212
205
|
commandParams: { unitId: t, subUnitId: e, drawingId: n },
|
|
213
|
-
disable: r ===
|
|
206
|
+
disable: r === j.DRAWING_DOM
|
|
214
207
|
},
|
|
215
208
|
{
|
|
216
209
|
label: "image-popup.reset",
|
|
217
210
|
index: 3,
|
|
218
|
-
commandId:
|
|
211
|
+
commandId: li.id,
|
|
219
212
|
commandParams: [{ unitId: t, subUnitId: e, drawingId: n }],
|
|
220
|
-
disable: r ===
|
|
213
|
+
disable: r === j.DRAWING_DOM
|
|
221
214
|
}
|
|
222
215
|
];
|
|
223
216
|
}
|
|
224
217
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
218
|
+
Rt = ds([
|
|
219
|
+
de(0, A(Ye)),
|
|
220
|
+
de(1, A(nt)),
|
|
221
|
+
de(2, se),
|
|
222
|
+
de(3, A(Si)),
|
|
223
|
+
de(4, q),
|
|
224
|
+
de(5, Se),
|
|
225
|
+
de(6, Hn),
|
|
226
|
+
de(7, Yn),
|
|
227
|
+
de(8, Wr),
|
|
228
|
+
de(9, G)
|
|
229
|
+
], Rt);
|
|
230
|
+
var ls = Object.getOwnPropertyDescriptor, us = (i, t, e, n) => {
|
|
231
|
+
for (var r = n > 1 ? void 0 : n ? ls(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
237
232
|
(o = i[s]) && (r = o(r) || r);
|
|
238
233
|
return r;
|
|
239
|
-
},
|
|
240
|
-
let
|
|
234
|
+
}, St = (i, t) => (e, n) => t(e, n, i);
|
|
235
|
+
let tn = class extends ie {
|
|
241
236
|
constructor(t, e, n, r, s) {
|
|
242
237
|
super();
|
|
243
238
|
te(this, "_isSetCursor", !1);
|
|
244
239
|
this._context = t, this._hoverManagerService = e, this._selectionsService = n, this._drawingRenderService = r, this._sheetSkeletonManagerService = s, this._initHover(), this._initImageClick();
|
|
245
240
|
}
|
|
246
241
|
_initHover() {
|
|
247
|
-
this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(
|
|
242
|
+
this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(Fi(33)).subscribe((t) => {
|
|
248
243
|
var n, r;
|
|
249
244
|
let e = [];
|
|
250
|
-
t !== null && (e = this._selectionsService.getWorkbookSelections(this._context.unitId).getCurrentSelections()), e.length > 0 && (t == null ? void 0 : t.unitId) === this._context.unitId && (t != null && t.drawing) && e.length === 1 && ((n = e[0].primary) == null ? void 0 : n.actualRow) === t.row && ((r = e[0].primary) == null ? void 0 : r.actualColumn) === t.col ? (this._isSetCursor = !0, this._context.scene.setCursor(
|
|
245
|
+
t !== null && (e = this._selectionsService.getWorkbookSelections(this._context.unitId).getCurrentSelections()), e.length > 0 && (t == null ? void 0 : t.unitId) === this._context.unitId && (t != null && t.drawing) && e.length === 1 && ((n = e[0].primary) == null ? void 0 : n.actualRow) === t.row && ((r = e[0].primary) == null ? void 0 : r.actualColumn) === t.col ? (this._isSetCursor = !0, this._context.scene.setCursor(gi.ZOOM_IN)) : this._isSetCursor && (this._isSetCursor = !1, this._context.scene.resetCursor());
|
|
251
246
|
}));
|
|
252
247
|
}
|
|
253
248
|
_initImageClick() {
|
|
@@ -261,70 +256,70 @@ let an = class extends ie {
|
|
|
261
256
|
}));
|
|
262
257
|
}
|
|
263
258
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
],
|
|
270
|
-
function
|
|
271
|
-
const { from: n, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX:
|
|
272
|
-
if (
|
|
259
|
+
tn = us([
|
|
260
|
+
St(1, A(Ii)),
|
|
261
|
+
St(2, A(dn)),
|
|
262
|
+
St(3, A(Gn)),
|
|
263
|
+
St(4, A(V))
|
|
264
|
+
], tn);
|
|
265
|
+
function z(i, t, e) {
|
|
266
|
+
const { from: n, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY: u = 0 } = i, c = e.getCurrent();
|
|
267
|
+
if (c == null)
|
|
273
268
|
return;
|
|
274
|
-
const l =
|
|
275
|
-
|
|
276
|
-
|
|
269
|
+
const l = Ci(
|
|
270
|
+
c.unitId,
|
|
271
|
+
c.sheetId,
|
|
277
272
|
{ from: n, to: r },
|
|
278
273
|
e
|
|
279
274
|
);
|
|
280
|
-
let { left: g, top: h, width:
|
|
281
|
-
const
|
|
282
|
-
return g +
|
|
275
|
+
let { left: g, top: h, width: m, height: p } = l;
|
|
276
|
+
const f = e.getCurrentSkeleton(), _ = f.rowHeaderWidth + f.columnTotalWidth, S = f.columnHeaderHeight + f.rowTotalHeight;
|
|
277
|
+
return g + m > _ && (g = _ - m), h + p > S && (h = S - p), {
|
|
283
278
|
flipY: s,
|
|
284
279
|
flipX: o,
|
|
285
280
|
angle: a,
|
|
286
|
-
skewX:
|
|
281
|
+
skewX: d,
|
|
287
282
|
skewY: u,
|
|
288
283
|
left: g,
|
|
289
284
|
top: h,
|
|
290
|
-
width:
|
|
285
|
+
width: m,
|
|
291
286
|
height: p
|
|
292
287
|
};
|
|
293
288
|
}
|
|
294
289
|
function x(i, t) {
|
|
295
|
-
const { left: e = 0, top: n = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle:
|
|
290
|
+
const { left: e = 0, top: n = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: d = 0, skewX: u = 0, skewY: c = 0 } = i, l = t.getCellWithCoordByOffset(e, n);
|
|
296
291
|
if (l == null)
|
|
297
292
|
return;
|
|
298
293
|
const g = {
|
|
299
294
|
column: l.actualColumn,
|
|
300
|
-
columnOffset:
|
|
295
|
+
columnOffset: _t(e - l.startX, 1),
|
|
301
296
|
row: l.actualRow,
|
|
302
|
-
rowOffset:
|
|
297
|
+
rowOffset: _t(n - l.startY, 1)
|
|
303
298
|
}, h = t.getCellWithCoordByOffset(e + r, n + s);
|
|
304
299
|
if (h == null)
|
|
305
300
|
return;
|
|
306
|
-
const
|
|
301
|
+
const m = {
|
|
307
302
|
column: h.actualColumn,
|
|
308
|
-
columnOffset:
|
|
303
|
+
columnOffset: _t(e + r - h.startX, 1),
|
|
309
304
|
row: h.actualRow,
|
|
310
|
-
rowOffset:
|
|
305
|
+
rowOffset: _t(n + s - h.startY, 1)
|
|
311
306
|
};
|
|
312
307
|
return {
|
|
313
308
|
flipY: o,
|
|
314
309
|
flipX: a,
|
|
315
|
-
angle:
|
|
310
|
+
angle: d,
|
|
316
311
|
skewX: u,
|
|
317
|
-
skewY:
|
|
312
|
+
skewY: c,
|
|
318
313
|
from: g,
|
|
319
|
-
to:
|
|
314
|
+
to: m
|
|
320
315
|
};
|
|
321
316
|
}
|
|
322
|
-
var
|
|
323
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
317
|
+
var hs = Object.getOwnPropertyDescriptor, gs = (i, t, e, n) => {
|
|
318
|
+
for (var r = n > 1 ? void 0 : n ? hs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
324
319
|
(o = i[s]) && (r = o(r) || r);
|
|
325
320
|
return r;
|
|
326
|
-
},
|
|
327
|
-
let
|
|
321
|
+
}, It = (i, t) => (e, n) => t(e, n, i);
|
|
322
|
+
let nn = class extends ie {
|
|
328
323
|
constructor(i, t, e, n, r) {
|
|
329
324
|
super(), this._context = i, this._sheetDrawingService = t, this._drawingManagerService = e, this._sheetSelectionRenderService = n, this._sheetSkeletonManagerService = r, this._init();
|
|
330
325
|
}
|
|
@@ -338,236 +333,236 @@ let cn = class extends ie {
|
|
|
338
333
|
const e = i[t];
|
|
339
334
|
for (const n in e.data) {
|
|
340
335
|
const r = e.data[n];
|
|
341
|
-
r.transform =
|
|
336
|
+
r.transform = z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
|
|
342
337
|
}
|
|
343
338
|
}
|
|
344
339
|
this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
|
|
345
340
|
}
|
|
346
341
|
};
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
],
|
|
353
|
-
function
|
|
342
|
+
nn = gs([
|
|
343
|
+
It(1, oe),
|
|
344
|
+
It(2, se),
|
|
345
|
+
It(3, A(Ge)),
|
|
346
|
+
It(4, A(V))
|
|
347
|
+
], nn);
|
|
348
|
+
function fs(i) {
|
|
354
349
|
const t = [];
|
|
355
350
|
return i.forEach((e) => {
|
|
356
|
-
const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n,
|
|
357
|
-
const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId:
|
|
351
|
+
const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, d = mi(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
|
|
352
|
+
const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: m, drawingId: p } = l;
|
|
358
353
|
return {
|
|
359
354
|
unitId: h,
|
|
360
|
-
subUnitId:
|
|
355
|
+
subUnitId: m,
|
|
361
356
|
drawingId: p,
|
|
362
357
|
transform: {
|
|
363
358
|
...g,
|
|
364
|
-
left: g.left -
|
|
365
|
-
top: g.top -
|
|
359
|
+
left: g.left - d.left,
|
|
360
|
+
top: g.top - d.top
|
|
366
361
|
},
|
|
367
362
|
groupId: a
|
|
368
363
|
};
|
|
369
|
-
}),
|
|
364
|
+
}), c = {
|
|
370
365
|
unitId: s,
|
|
371
366
|
subUnitId: o,
|
|
372
367
|
drawingId: a,
|
|
373
|
-
drawingType:
|
|
374
|
-
transform:
|
|
368
|
+
drawingType: j.DRAWING_GROUP,
|
|
369
|
+
transform: d
|
|
375
370
|
};
|
|
376
371
|
t.push({
|
|
377
|
-
parent:
|
|
372
|
+
parent: c,
|
|
378
373
|
children: u
|
|
379
374
|
});
|
|
380
375
|
}), t;
|
|
381
376
|
}
|
|
382
|
-
function
|
|
377
|
+
function ms(i) {
|
|
383
378
|
const t = [];
|
|
384
379
|
return i.forEach((e) => {
|
|
385
|
-
const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a, transform:
|
|
386
|
-
if (
|
|
380
|
+
const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a, transform: d = { width: 0, height: 0 } } = n;
|
|
381
|
+
if (d == null)
|
|
387
382
|
return;
|
|
388
383
|
const u = r.map((l) => {
|
|
389
|
-
const { transform: g } = l, { unitId: h, subUnitId:
|
|
384
|
+
const { transform: g } = l, { unitId: h, subUnitId: m, drawingId: p } = l, f = fi(g || {}, d, d.width || 0, d.height || 0);
|
|
390
385
|
return {
|
|
391
386
|
unitId: h,
|
|
392
|
-
subUnitId:
|
|
387
|
+
subUnitId: m,
|
|
393
388
|
drawingId: p,
|
|
394
|
-
transform:
|
|
389
|
+
transform: f,
|
|
395
390
|
groupId: void 0
|
|
396
391
|
};
|
|
397
|
-
}),
|
|
392
|
+
}), c = {
|
|
398
393
|
unitId: s,
|
|
399
394
|
subUnitId: o,
|
|
400
395
|
drawingId: a,
|
|
401
|
-
drawingType:
|
|
396
|
+
drawingType: j.DRAWING_GROUP,
|
|
402
397
|
transform: {
|
|
403
398
|
left: 0,
|
|
404
399
|
top: 0
|
|
405
400
|
}
|
|
406
401
|
};
|
|
407
402
|
t.push({
|
|
408
|
-
parent:
|
|
403
|
+
parent: c,
|
|
409
404
|
children: u
|
|
410
405
|
});
|
|
411
406
|
}), t;
|
|
412
407
|
}
|
|
413
|
-
const
|
|
408
|
+
const _r = {
|
|
414
409
|
id: "sheet.command.group-sheet-image",
|
|
415
410
|
type: J.COMMAND,
|
|
416
411
|
handler: (i, t) => {
|
|
417
|
-
const e = i.get(G), n = i.get(
|
|
412
|
+
const e = i.get(G), n = i.get(Le), r = i.get(oe);
|
|
418
413
|
if (!t) return !1;
|
|
419
414
|
const s = [];
|
|
420
|
-
t.forEach(({ parent: h, children:
|
|
421
|
-
s.push(h.unitId),
|
|
415
|
+
t.forEach(({ parent: h, children: m }) => {
|
|
416
|
+
s.push(h.unitId), m.forEach((p) => {
|
|
422
417
|
s.push(p.unitId);
|
|
423
418
|
});
|
|
424
419
|
});
|
|
425
|
-
const o = r.getGroupDrawingOp(t), { unitId: a, subUnitId:
|
|
426
|
-
return e.syncExecuteCommand(
|
|
420
|
+
const o = r.getGroupDrawingOp(t), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
|
|
421
|
+
return e.syncExecuteCommand(P.id, { op: c, unitId: a, subUnitId: d, objects: l, type: U.GROUP }) ? (n.pushUndoRedo({
|
|
427
422
|
unitID: a,
|
|
428
423
|
undoMutations: [
|
|
429
|
-
{ id:
|
|
430
|
-
{ id:
|
|
424
|
+
{ id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: ms(l), type: U.UNGROUP } },
|
|
425
|
+
{ id: L.id, params: s }
|
|
431
426
|
],
|
|
432
427
|
redoMutations: [
|
|
433
|
-
{ id:
|
|
434
|
-
{ id:
|
|
428
|
+
{ id: P.id, params: { op: c, unitId: a, subUnitId: d, objects: l, type: U.GROUP } },
|
|
429
|
+
{ id: L.id, params: s }
|
|
435
430
|
]
|
|
436
431
|
}), !0) : !1;
|
|
437
432
|
}
|
|
438
|
-
},
|
|
433
|
+
}, Wt = {
|
|
439
434
|
id: "sheet.command.insert-sheet-image",
|
|
440
435
|
type: J.COMMAND,
|
|
441
436
|
handler: (i, t) => {
|
|
442
437
|
var S, C, b;
|
|
443
|
-
const e = i.get(G), n = i.get(
|
|
438
|
+
const e = i.get(G), n = i.get(Le), r = i.get(oe), s = i.get(kt);
|
|
444
439
|
if (!t) return !1;
|
|
445
|
-
const o = t.drawings, a = o.map((v) => v.unitId),
|
|
446
|
-
return
|
|
440
|
+
const o = t.drawings, a = o.map((v) => v.unitId), d = r.getBatchAddOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, m = s.onCommandExecute({ id: Wt.id, params: t }), p = { id: P.id, params: { op: g, unitId: u, subUnitId: c, objects: h, type: U.INSERT } }, f = { id: P.id, params: { op: l, unitId: u, subUnitId: c, objects: h, type: U.REMOVE } };
|
|
441
|
+
return Ln([...(S = m.preRedos) != null ? S : [], p, ...m.redos], e) ? (n.pushUndoRedo({
|
|
447
442
|
unitID: u,
|
|
448
443
|
undoMutations: [
|
|
449
|
-
...(C =
|
|
450
|
-
|
|
451
|
-
...
|
|
452
|
-
{ id:
|
|
444
|
+
...(C = m.preUndos) != null ? C : [],
|
|
445
|
+
f,
|
|
446
|
+
...m.undos,
|
|
447
|
+
{ id: L.id, params: a }
|
|
453
448
|
],
|
|
454
449
|
redoMutations: [
|
|
455
|
-
...(b =
|
|
450
|
+
...(b = m.preRedos) != null ? b : [],
|
|
456
451
|
p,
|
|
457
|
-
...
|
|
458
|
-
{ id:
|
|
452
|
+
...m.redos,
|
|
453
|
+
{ id: L.id, params: a }
|
|
459
454
|
]
|
|
460
455
|
}), !0) : !1;
|
|
461
456
|
}
|
|
462
|
-
},
|
|
457
|
+
}, vr = {
|
|
463
458
|
id: "sheet.command.set-drawing-arrange",
|
|
464
459
|
type: J.COMMAND,
|
|
465
460
|
handler: (i, t) => {
|
|
466
|
-
const e = i.get(G), n = i.get(
|
|
461
|
+
const e = i.get(G), n = i.get(Le);
|
|
467
462
|
if (!t) return !1;
|
|
468
|
-
const r = i.get(oe), { unitId: s, subUnitId: o, drawingIds: a, arrangeType:
|
|
469
|
-
let
|
|
470
|
-
if (
|
|
463
|
+
const r = i.get(oe), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: d } = t, u = { unitId: s, subUnitId: o, drawingIds: a };
|
|
464
|
+
let c;
|
|
465
|
+
if (d === pt.forward ? c = r.getForwardDrawingsOp(u) : d === pt.backward ? c = r.getBackwardDrawingOp(u) : d === pt.front ? c = r.getFrontDrawingsOp(u) : d === pt.back && (c = r.getBackDrawingsOp(u)), c == null)
|
|
471
466
|
return !1;
|
|
472
|
-
const { objects: l, redo: g, undo: h } =
|
|
473
|
-
return e.syncExecuteCommand(
|
|
467
|
+
const { objects: l, redo: g, undo: h } = c;
|
|
468
|
+
return e.syncExecuteCommand(P.id, { op: g, unitId: s, subUnitId: o, objects: l, type: U.ARRANGE }) ? (n.pushUndoRedo({
|
|
474
469
|
unitID: s,
|
|
475
470
|
undoMutations: [
|
|
476
|
-
{ id:
|
|
471
|
+
{ id: P.id, params: { op: h, unitId: s, subUnitId: o, objects: l, type: U.ARRANGE } }
|
|
477
472
|
],
|
|
478
473
|
redoMutations: [
|
|
479
|
-
{ id:
|
|
474
|
+
{ id: P.id, params: { op: g, unitId: s, subUnitId: o, objects: l, type: U.ARRANGE } }
|
|
480
475
|
]
|
|
481
476
|
}), !0) : !1;
|
|
482
477
|
}
|
|
483
|
-
},
|
|
478
|
+
}, jt = {
|
|
484
479
|
id: "sheet.command.set-sheet-image",
|
|
485
480
|
type: J.COMMAND,
|
|
486
481
|
handler: (i, t) => {
|
|
487
|
-
const e = i.get(G), n = i.get(
|
|
482
|
+
const e = i.get(G), n = i.get(Le), r = i.get(oe);
|
|
488
483
|
if (!t) return !1;
|
|
489
|
-
const { drawings: s } = t, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId:
|
|
490
|
-
return e.syncExecuteCommand(
|
|
484
|
+
const { drawings: s } = t, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
|
|
485
|
+
return e.syncExecuteCommand(P.id, { unitId: a, subUnitId: d, op: c, objects: l, type: U.UPDATE }) ? (n.pushUndoRedo({
|
|
491
486
|
unitID: a,
|
|
492
487
|
undoMutations: [
|
|
493
|
-
{ id:
|
|
494
|
-
{ id:
|
|
488
|
+
{ id: P.id, params: { unitId: a, subUnitId: d, op: u, objects: l, type: U.UPDATE } },
|
|
489
|
+
{ id: L.id, params: [a] }
|
|
495
490
|
],
|
|
496
491
|
redoMutations: [
|
|
497
|
-
{ id:
|
|
498
|
-
{ id:
|
|
492
|
+
{ id: P.id, params: { unitId: a, subUnitId: d, op: c, objects: l, type: U.UPDATE } },
|
|
493
|
+
{ id: L.id, params: [a] }
|
|
499
494
|
]
|
|
500
495
|
}), !0) : !1;
|
|
501
496
|
}
|
|
502
|
-
},
|
|
497
|
+
}, Sr = {
|
|
503
498
|
id: "sheet.command.ungroup-sheet-image",
|
|
504
499
|
type: J.COMMAND,
|
|
505
500
|
handler: (i, t) => {
|
|
506
|
-
const e = i.get(G), n = i.get(
|
|
501
|
+
const e = i.get(G), n = i.get(Le), r = i.get(oe);
|
|
507
502
|
if (!t) return !1;
|
|
508
503
|
const s = [];
|
|
509
|
-
t.forEach(({ parent: h, children:
|
|
510
|
-
s.push(h.unitId),
|
|
504
|
+
t.forEach(({ parent: h, children: m }) => {
|
|
505
|
+
s.push(h.unitId), m.forEach((p) => {
|
|
511
506
|
s.push(p.unitId);
|
|
512
507
|
});
|
|
513
508
|
});
|
|
514
|
-
const o = r.getUngroupDrawingOp(t), { unitId: a, subUnitId:
|
|
515
|
-
return e.syncExecuteCommand(
|
|
509
|
+
const o = r.getUngroupDrawingOp(t), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
|
|
510
|
+
return e.syncExecuteCommand(P.id, { op: c, unitId: a, subUnitId: d, objects: l, type: U.UNGROUP }) ? (n.pushUndoRedo({
|
|
516
511
|
unitID: a,
|
|
517
512
|
undoMutations: [
|
|
518
|
-
{ id:
|
|
519
|
-
{ id:
|
|
513
|
+
{ id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: fs(l), type: U.GROUP } },
|
|
514
|
+
{ id: L.id, params: s }
|
|
520
515
|
],
|
|
521
516
|
redoMutations: [
|
|
522
|
-
{ id:
|
|
523
|
-
{ id:
|
|
517
|
+
{ id: P.id, params: { op: c, unitId: a, subUnitId: d, objects: l, type: U.UNGROUP } },
|
|
518
|
+
{ id: L.id, params: s }
|
|
524
519
|
]
|
|
525
520
|
}), !0) : !1;
|
|
526
521
|
}
|
|
527
522
|
};
|
|
528
|
-
var
|
|
529
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
523
|
+
var ps = Object.getOwnPropertyDescriptor, ws = (i, t, e, n) => {
|
|
524
|
+
for (var r = n > 1 ? void 0 : n ? ps(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
530
525
|
(o = i[s]) && (r = o(r) || r);
|
|
531
526
|
return r;
|
|
532
527
|
}, ne = (i, t) => (e, n) => t(e, n, i);
|
|
533
|
-
function
|
|
528
|
+
function _s(i, t, e) {
|
|
534
529
|
const n = e * Math.PI / 180, r = Math.abs(i * Math.cos(n)) + Math.abs(t * Math.sin(n)), s = Math.abs(i * Math.sin(n)) + Math.abs(t * Math.cos(n));
|
|
535
530
|
return { rotatedWidth: r, rotatedHeight: s };
|
|
536
531
|
}
|
|
537
|
-
function
|
|
532
|
+
function rn(i, t, e, n, r) {
|
|
538
533
|
var S;
|
|
539
|
-
const { rotatedHeight: s, rotatedWidth: o } =
|
|
540
|
-
if (!
|
|
534
|
+
const { rotatedHeight: s, rotatedWidth: o } = _s(e, n, r), d = i.get(q).getRenderById(t.unitId);
|
|
535
|
+
if (!d)
|
|
541
536
|
return !1;
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
537
|
+
const c = (S = d.with(V).getSkeletonParam(t.subUnitId)) == null ? void 0 : S.skeleton;
|
|
538
|
+
if (c == null)
|
|
544
539
|
return !1;
|
|
545
|
-
const l =
|
|
540
|
+
const l = c.getCellByIndex(t.row, t.col), g = l.mergeInfo.endX - l.mergeInfo.startX - 2, h = l.mergeInfo.endY - l.mergeInfo.startY - 2, m = o / s, f = Math.ceil(Math.min(g, h * m)) / o, _ = !f || Number.isNaN(f) ? 1e-3 : f;
|
|
546
541
|
return {
|
|
547
|
-
width: e *
|
|
548
|
-
height: n *
|
|
542
|
+
width: e * _,
|
|
543
|
+
height: n * _
|
|
549
544
|
};
|
|
550
545
|
}
|
|
551
|
-
let
|
|
552
|
-
constructor(t, e, n, r, s, o, a,
|
|
546
|
+
let et = class extends ie {
|
|
547
|
+
constructor(t, e, n, r, s, o, a, d, u, c, l, g, h) {
|
|
553
548
|
super();
|
|
554
549
|
te(this, "_workbookSelections");
|
|
555
|
-
this._context = t, this._skeletonManagerService = e, this._commandService = n, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = a, this._drawingManagerService =
|
|
550
|
+
this._context = t, this._skeletonManagerService = e, this._commandService = n, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = a, this._drawingManagerService = d, this._contextService = u, this._messageService = c, this._localeService = l, this._injector = h, this._workbookSelections = g.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
|
|
556
551
|
}
|
|
557
552
|
async insertFloatImage() {
|
|
558
553
|
const t = await this._fileOpenerService.openFile({
|
|
559
554
|
multiple: !0,
|
|
560
|
-
accept:
|
|
555
|
+
accept: Cn.map((n) => `.${n.replace("image/", "")}`).join(",")
|
|
561
556
|
}), e = t.length;
|
|
562
|
-
return e >
|
|
563
|
-
type:
|
|
564
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(
|
|
557
|
+
return e > Dn ? (this._messageService.show({
|
|
558
|
+
type: we.Error,
|
|
559
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(Dn))
|
|
565
560
|
}), !1) : e === 0 ? !1 : (t.forEach(async (n) => await this.insertFloatImageByFile(n)), !0);
|
|
566
561
|
}
|
|
567
562
|
async insertCellImage() {
|
|
568
563
|
const e = (await this._fileOpenerService.openFile({
|
|
569
564
|
multiple: !1,
|
|
570
|
-
accept:
|
|
565
|
+
accept: Cn.map((n) => `.${n.replace("image/", "")}`).join(",")
|
|
571
566
|
}))[0];
|
|
572
567
|
return e ? (await this._insertCellImage(e), !0) : !1;
|
|
573
568
|
}
|
|
@@ -580,71 +575,71 @@ let nt = class extends ie {
|
|
|
580
575
|
e = await this._imageIoService.saveImage(t);
|
|
581
576
|
} catch (S) {
|
|
582
577
|
const C = S.message;
|
|
583
|
-
C ===
|
|
584
|
-
type:
|
|
585
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
586
|
-
}) : C ===
|
|
587
|
-
type:
|
|
578
|
+
C === Pe.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
579
|
+
type: we.Error,
|
|
580
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(bn / (1024 * 1024)))
|
|
581
|
+
}) : C === Pe.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
582
|
+
type: we.Error,
|
|
588
583
|
content: this._localeService.t("update-status.invalidImageType")
|
|
589
|
-
}) : C ===
|
|
590
|
-
type:
|
|
584
|
+
}) : C === Pe.ERROR_IMAGE && this._messageService.show({
|
|
585
|
+
type: we.Error,
|
|
591
586
|
content: this._localeService.t("update-status.invalidImage")
|
|
592
587
|
});
|
|
593
588
|
}
|
|
594
589
|
if (e == null)
|
|
595
590
|
return;
|
|
596
|
-
const n = this._getUnitInfo(), { unitId: r, subUnitId: s } = n, { imageId: o, imageSourceType: a, source:
|
|
597
|
-
this._imageIoService.addImageSourceCache(
|
|
591
|
+
const n = this._getUnitInfo(), { unitId: r, subUnitId: s } = n, { imageId: o, imageSourceType: a, source: d, base64Cache: u } = e, { width: c, height: l, image: g } = await Lt(u || ""), { width: h, height: m } = this._context.scene;
|
|
592
|
+
this._imageIoService.addImageSourceCache(d, a, g);
|
|
598
593
|
let p = 1;
|
|
599
|
-
if (
|
|
600
|
-
const S =
|
|
594
|
+
if (c > Rn || l > Mn) {
|
|
595
|
+
const S = Rn / c, C = Mn / l;
|
|
601
596
|
p = Math.max(S, C);
|
|
602
597
|
}
|
|
603
|
-
const
|
|
604
|
-
if (
|
|
598
|
+
const f = this._getImagePosition(c * p, l * p, h, m);
|
|
599
|
+
if (f == null)
|
|
605
600
|
return;
|
|
606
|
-
const
|
|
601
|
+
const _ = {
|
|
607
602
|
unitId: r,
|
|
608
603
|
subUnitId: s,
|
|
609
604
|
drawingId: o,
|
|
610
|
-
drawingType:
|
|
605
|
+
drawingType: j.DRAWING_IMAGE,
|
|
611
606
|
imageSourceType: a,
|
|
612
|
-
source:
|
|
613
|
-
transform:
|
|
614
|
-
sheetTransform:
|
|
607
|
+
source: d,
|
|
608
|
+
transform: z(f, this._selectionRenderService, this._skeletonManagerService),
|
|
609
|
+
sheetTransform: f
|
|
615
610
|
};
|
|
616
|
-
return this._commandService.executeCommand(
|
|
611
|
+
return this._commandService.executeCommand(Wt.id, {
|
|
617
612
|
unitId: r,
|
|
618
|
-
drawings: [
|
|
613
|
+
drawings: [_]
|
|
619
614
|
});
|
|
620
615
|
}
|
|
621
616
|
// eslint-disable-next-line max-lines-per-function
|
|
622
617
|
async _insertCellImage(t, e) {
|
|
623
|
-
var
|
|
618
|
+
var _, S;
|
|
624
619
|
let n;
|
|
625
620
|
try {
|
|
626
621
|
n = await this._imageIoService.saveImage(t);
|
|
627
622
|
} catch (C) {
|
|
628
623
|
const b = C.message;
|
|
629
|
-
b ===
|
|
630
|
-
type:
|
|
631
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
632
|
-
}) : b ===
|
|
633
|
-
type:
|
|
624
|
+
b === Pe.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
625
|
+
type: we.Error,
|
|
626
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(bn / (1024 * 1024)))
|
|
627
|
+
}) : b === Pe.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
628
|
+
type: we.Error,
|
|
634
629
|
content: this._localeService.t("update-status.invalidImageType")
|
|
635
|
-
}) : b ===
|
|
636
|
-
type:
|
|
630
|
+
}) : b === Pe.ERROR_IMAGE && this._messageService.show({
|
|
631
|
+
type: we.Error,
|
|
637
632
|
content: this._localeService.t("update-status.invalidImage")
|
|
638
633
|
});
|
|
639
634
|
}
|
|
640
635
|
if (n == null)
|
|
641
636
|
return !1;
|
|
642
|
-
const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = n, { width:
|
|
643
|
-
this._imageIoService.addImageSourceCache(o, s,
|
|
637
|
+
const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = n, { width: d, height: u, image: c } = await Lt(a || "");
|
|
638
|
+
this._imageIoService.addImageSourceCache(o, s, c);
|
|
644
639
|
const l = this._workbookSelections.getCurrentLastSelection();
|
|
645
640
|
if (!l)
|
|
646
641
|
return !1;
|
|
647
|
-
const g =
|
|
642
|
+
const g = Ht("", {}), h = rn(
|
|
648
643
|
this._injector,
|
|
649
644
|
{
|
|
650
645
|
unitId: this._context.unitId,
|
|
@@ -652,23 +647,23 @@ let nt = class extends ie {
|
|
|
652
647
|
row: l.primary.actualRow,
|
|
653
648
|
col: l.primary.actualColumn
|
|
654
649
|
},
|
|
655
|
-
|
|
650
|
+
d,
|
|
656
651
|
u,
|
|
657
652
|
0
|
|
658
653
|
);
|
|
659
654
|
if (!h)
|
|
660
655
|
return !1;
|
|
661
|
-
const
|
|
656
|
+
const m = {
|
|
662
657
|
size: {
|
|
663
658
|
width: h.width,
|
|
664
659
|
height: h.height
|
|
665
660
|
},
|
|
666
661
|
positionH: {
|
|
667
|
-
relativeFrom:
|
|
662
|
+
relativeFrom: wn.PAGE,
|
|
668
663
|
posOffset: 0
|
|
669
664
|
},
|
|
670
665
|
positionV: {
|
|
671
|
-
relativeFrom:
|
|
666
|
+
relativeFrom: pn.PARAGRAPH,
|
|
672
667
|
posOffset: 0
|
|
673
668
|
},
|
|
674
669
|
angle: 0
|
|
@@ -676,22 +671,22 @@ let nt = class extends ie {
|
|
|
676
671
|
unitId: g.getUnitId(),
|
|
677
672
|
subUnitId: g.getUnitId(),
|
|
678
673
|
drawingId: r,
|
|
679
|
-
drawingType:
|
|
674
|
+
drawingType: j.DRAWING_IMAGE,
|
|
680
675
|
imageSourceType: s,
|
|
681
676
|
source: o,
|
|
682
|
-
transform:
|
|
683
|
-
docTransform:
|
|
684
|
-
behindDoc:
|
|
677
|
+
transform: Bn(m),
|
|
678
|
+
docTransform: m,
|
|
679
|
+
behindDoc: Sn.FALSE,
|
|
685
680
|
title: "",
|
|
686
681
|
description: "",
|
|
687
|
-
layoutType:
|
|
682
|
+
layoutType: vn.INLINE,
|
|
688
683
|
// Insert inline drawing by default.
|
|
689
|
-
wrapText:
|
|
684
|
+
wrapText: _n.BOTH_SIDES,
|
|
690
685
|
distB: 0,
|
|
691
686
|
distL: 0,
|
|
692
687
|
distR: 0,
|
|
693
688
|
distT: 0
|
|
694
|
-
},
|
|
689
|
+
}, f = zt.drawing.add({
|
|
695
690
|
documentDataModel: g,
|
|
696
691
|
drawings: [p],
|
|
697
692
|
selection: {
|
|
@@ -700,9 +695,9 @@ let nt = class extends ie {
|
|
|
700
695
|
endOffset: 0
|
|
701
696
|
}
|
|
702
697
|
});
|
|
703
|
-
return
|
|
698
|
+
return f ? (g.apply(f), this._commandService.syncExecuteCommand(kn.id, {
|
|
704
699
|
value: {
|
|
705
|
-
[(
|
|
700
|
+
[(_ = e == null ? void 0 : e.row) != null ? _ : l.primary.actualRow]: {
|
|
706
701
|
[(S = e == null ? void 0 : e.col) != null ? S : l.primary.actualColumn]: {
|
|
707
702
|
p: g.getSnapshot(),
|
|
708
703
|
t: 1
|
|
@@ -716,12 +711,12 @@ let nt = class extends ie {
|
|
|
716
711
|
// eslint-disable-next-line max-lines-per-function
|
|
717
712
|
async insertCellImageByUrl(t, e) {
|
|
718
713
|
var g, h;
|
|
719
|
-
const { width: n, height: r, image: s } = await
|
|
720
|
-
this._imageIoService.addImageSourceCache(t,
|
|
714
|
+
const { width: n, height: r, image: s } = await Lt(t || "");
|
|
715
|
+
this._imageIoService.addImageSourceCache(t, In.URL, s);
|
|
721
716
|
const o = this._workbookSelections.getCurrentLastSelection();
|
|
722
717
|
if (!o)
|
|
723
718
|
return !1;
|
|
724
|
-
const a =
|
|
719
|
+
const a = Ht("", {}), d = rn(
|
|
725
720
|
this._injector,
|
|
726
721
|
{
|
|
727
722
|
unitId: this._context.unitId,
|
|
@@ -733,51 +728,51 @@ let nt = class extends ie {
|
|
|
733
728
|
r,
|
|
734
729
|
0
|
|
735
730
|
);
|
|
736
|
-
if (!
|
|
731
|
+
if (!d)
|
|
737
732
|
return !1;
|
|
738
733
|
const u = {
|
|
739
734
|
size: {
|
|
740
|
-
width:
|
|
741
|
-
height:
|
|
735
|
+
width: d.width,
|
|
736
|
+
height: d.height
|
|
742
737
|
},
|
|
743
738
|
positionH: {
|
|
744
|
-
relativeFrom:
|
|
739
|
+
relativeFrom: wn.PAGE,
|
|
745
740
|
posOffset: 0
|
|
746
741
|
},
|
|
747
742
|
positionV: {
|
|
748
|
-
relativeFrom:
|
|
743
|
+
relativeFrom: pn.PARAGRAPH,
|
|
749
744
|
posOffset: 0
|
|
750
745
|
},
|
|
751
746
|
angle: 0
|
|
752
|
-
},
|
|
747
|
+
}, c = {
|
|
753
748
|
unitId: a.getUnitId(),
|
|
754
749
|
subUnitId: a.getUnitId(),
|
|
755
|
-
drawingId:
|
|
756
|
-
drawingType:
|
|
757
|
-
imageSourceType:
|
|
750
|
+
drawingId: bt(),
|
|
751
|
+
drawingType: j.DRAWING_IMAGE,
|
|
752
|
+
imageSourceType: In.URL,
|
|
758
753
|
source: t,
|
|
759
|
-
transform:
|
|
754
|
+
transform: Bn(u),
|
|
760
755
|
docTransform: u,
|
|
761
|
-
behindDoc:
|
|
756
|
+
behindDoc: Sn.FALSE,
|
|
762
757
|
title: "",
|
|
763
758
|
description: "",
|
|
764
|
-
layoutType:
|
|
759
|
+
layoutType: vn.INLINE,
|
|
765
760
|
// Insert inline drawing by default.
|
|
766
|
-
wrapText:
|
|
761
|
+
wrapText: _n.BOTH_SIDES,
|
|
767
762
|
distB: 0,
|
|
768
763
|
distL: 0,
|
|
769
764
|
distR: 0,
|
|
770
765
|
distT: 0
|
|
771
|
-
}, l =
|
|
766
|
+
}, l = zt.drawing.add({
|
|
772
767
|
documentDataModel: a,
|
|
773
|
-
drawings: [
|
|
768
|
+
drawings: [c],
|
|
774
769
|
selection: {
|
|
775
770
|
collapsed: !0,
|
|
776
771
|
startOffset: 0,
|
|
777
772
|
endOffset: 0
|
|
778
773
|
}
|
|
779
774
|
});
|
|
780
|
-
return l ? (a.apply(l), this._commandService.syncExecuteCommand(
|
|
775
|
+
return l ? (a.apply(l), this._commandService.syncExecuteCommand(kn.id, {
|
|
781
776
|
value: {
|
|
782
777
|
[(g = e == null ? void 0 : e.row) != null ? g : o.primary.actualRow]: {
|
|
783
778
|
[(h = e == null ? void 0 : e.col) != null ? h : o.primary.actualColumn]: {
|
|
@@ -806,29 +801,29 @@ let nt = class extends ie {
|
|
|
806
801
|
endColumn: 0
|
|
807
802
|
};
|
|
808
803
|
s && s.length > 0 && (o = s[s.length - 1].range);
|
|
809
|
-
const a =
|
|
804
|
+
const a = Vn(this._skeletonManagerService.getCurrent().skeleton, o);
|
|
810
805
|
if (a == null)
|
|
811
806
|
return;
|
|
812
|
-
let { startColumn:
|
|
813
|
-
if (
|
|
814
|
-
const
|
|
815
|
-
if (
|
|
807
|
+
let { startColumn: d, startRow: u, startX: c, startY: l } = a, g = !1;
|
|
808
|
+
if (c + t > n && (c = n - t, c < 0 && (c = 0, t = n), g = !0), l + e > r && (l = r - e, l < 0 && (l = 0, e = r), g = !0), g) {
|
|
809
|
+
const f = this._selectionRenderService.getCellWithCoordByOffset(c, l);
|
|
810
|
+
if (f == null)
|
|
816
811
|
return;
|
|
817
|
-
|
|
812
|
+
c = f.startX, l = f.startY, d = f.actualColumn, u = f.actualRow;
|
|
818
813
|
}
|
|
819
814
|
const h = {
|
|
820
|
-
column:
|
|
815
|
+
column: d,
|
|
821
816
|
columnOffset: 0,
|
|
822
817
|
row: u,
|
|
823
818
|
rowOffset: 0
|
|
824
|
-
},
|
|
825
|
-
if (
|
|
819
|
+
}, m = this._selectionRenderService.getCellWithCoordByOffset(c + t, l + e);
|
|
820
|
+
if (m == null)
|
|
826
821
|
return;
|
|
827
822
|
const p = {
|
|
828
|
-
column:
|
|
829
|
-
columnOffset:
|
|
830
|
-
row:
|
|
831
|
-
rowOffset: l + e -
|
|
823
|
+
column: m.actualColumn,
|
|
824
|
+
columnOffset: c + t - m.startX,
|
|
825
|
+
row: m.actualRow,
|
|
826
|
+
rowOffset: l + e - m.startY
|
|
832
827
|
};
|
|
833
828
|
return {
|
|
834
829
|
from: h,
|
|
@@ -838,7 +833,7 @@ let nt = class extends ie {
|
|
|
838
833
|
_updateOrderListener() {
|
|
839
834
|
this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((t) => {
|
|
840
835
|
const { unitId: e, subUnitId: n, drawingIds: r, arrangeType: s } = t;
|
|
841
|
-
this._commandService.executeCommand(
|
|
836
|
+
this._commandService.executeCommand(vr.id, {
|
|
842
837
|
unitId: e,
|
|
843
838
|
subUnitId: n,
|
|
844
839
|
drawingIds: r,
|
|
@@ -850,22 +845,22 @@ let nt = class extends ie {
|
|
|
850
845
|
this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe((t) => {
|
|
851
846
|
const e = [];
|
|
852
847
|
t.length !== 0 && (t.forEach((n) => {
|
|
853
|
-
const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform:
|
|
854
|
-
if (
|
|
848
|
+
const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform: d } = n;
|
|
849
|
+
if (d == null)
|
|
855
850
|
return;
|
|
856
851
|
const u = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
|
|
857
852
|
if (u == null || u.unitId !== this._context.unitId)
|
|
858
853
|
return;
|
|
859
|
-
const
|
|
860
|
-
if (
|
|
854
|
+
const c = x({ ...u.transform, ...d }, this._selectionRenderService);
|
|
855
|
+
if (c == null)
|
|
861
856
|
return;
|
|
862
857
|
const l = {
|
|
863
858
|
...n,
|
|
864
|
-
transform: { ...u.transform, ...
|
|
865
|
-
sheetTransform: { ...
|
|
859
|
+
transform: { ...u.transform, ...d, ...z(c, this._selectionRenderService, this._skeletonManagerService) },
|
|
860
|
+
sheetTransform: { ...c }
|
|
866
861
|
};
|
|
867
862
|
e.push(l);
|
|
868
|
-
}), e.length > 0 && this._commandService.executeCommand(
|
|
863
|
+
}), e.length > 0 && this._commandService.executeCommand(jt.id, {
|
|
869
864
|
unitId: t[0].unitId,
|
|
870
865
|
drawings: e
|
|
871
866
|
}));
|
|
@@ -873,44 +868,44 @@ let nt = class extends ie {
|
|
|
873
868
|
}
|
|
874
869
|
_groupDrawingListener() {
|
|
875
870
|
this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((t) => {
|
|
876
|
-
this._commandService.executeCommand(
|
|
871
|
+
this._commandService.executeCommand(_r.id, t);
|
|
877
872
|
const { unitId: e, subUnitId: n, drawingId: r } = t[0].parent;
|
|
878
|
-
this._commandService.syncExecuteCommand(
|
|
873
|
+
this._commandService.syncExecuteCommand(Nt.id, [{ unitId: e, subUnitId: n, drawingId: r }]);
|
|
879
874
|
})), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((t) => {
|
|
880
|
-
this._commandService.executeCommand(
|
|
875
|
+
this._commandService.executeCommand(Sr.id, t);
|
|
881
876
|
}));
|
|
882
877
|
}
|
|
883
878
|
_focusDrawingListener() {
|
|
884
879
|
this.disposeWithMe(
|
|
885
880
|
this._drawingManagerService.focus$.subscribe((t) => {
|
|
886
|
-
t == null || t.length === 0 ? (this._contextService.setContextValue(
|
|
881
|
+
t == null || t.length === 0 ? (this._contextService.setContextValue(xe, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(xe, !0), this._sheetDrawingService.focusDrawing(t));
|
|
887
882
|
})
|
|
888
883
|
);
|
|
889
884
|
}
|
|
890
885
|
};
|
|
891
|
-
|
|
892
|
-
ne(1, A(
|
|
886
|
+
et = ws([
|
|
887
|
+
ne(1, A(V)),
|
|
893
888
|
ne(2, G),
|
|
894
|
-
ne(3,
|
|
895
|
-
ne(4,
|
|
896
|
-
ne(5,
|
|
889
|
+
ne(3, Ge),
|
|
890
|
+
ne(4, ii),
|
|
891
|
+
ne(5, Pi),
|
|
897
892
|
ne(6, oe),
|
|
898
893
|
ne(7, se),
|
|
899
|
-
ne(8,
|
|
900
|
-
ne(9,
|
|
901
|
-
ne(10, A(
|
|
902
|
-
ne(11, A(
|
|
903
|
-
ne(12, A(
|
|
904
|
-
],
|
|
905
|
-
var
|
|
906
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
894
|
+
ne(8, Yn),
|
|
895
|
+
ne(9, Hn),
|
|
896
|
+
ne(10, A(nt)),
|
|
897
|
+
ne(11, A(dn)),
|
|
898
|
+
ne(12, A(Ye))
|
|
899
|
+
], et);
|
|
900
|
+
var vs = Object.getOwnPropertyDescriptor, Ss = (i, t, e, n) => {
|
|
901
|
+
for (var r = n > 1 ? void 0 : n ? vs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
907
902
|
(o = i[s]) && (r = o(r) || r);
|
|
908
903
|
return r;
|
|
909
|
-
},
|
|
910
|
-
function
|
|
904
|
+
}, ke = (i, t) => (e, n) => t(e, n, i);
|
|
905
|
+
function Ir(i, t, e) {
|
|
911
906
|
var n, r, s, o;
|
|
912
907
|
if (((r = (n = e == null ? void 0 : e.p) == null ? void 0 : n.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = e.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
|
|
913
|
-
const a = e.p.drawings[e.p.drawingsOrder[0]],
|
|
908
|
+
const a = e.p.drawings[e.p.drawingsOrder[0]], d = rn(
|
|
914
909
|
i,
|
|
915
910
|
{
|
|
916
911
|
unitId: t.unitId,
|
|
@@ -922,52 +917,52 @@ function Mr(i, t, e) {
|
|
|
922
917
|
a.docTransform.size.height,
|
|
923
918
|
a.docTransform.angle
|
|
924
919
|
);
|
|
925
|
-
if (
|
|
926
|
-
return a.transform.width =
|
|
920
|
+
if (d)
|
|
921
|
+
return a.transform.width = d.width, a.transform.height = d.height, a.docTransform.size.width = d.width, a.docTransform.size.height = d.height, a.transform.left = 0, a.transform.top = 0, a.docTransform.positionH.posOffset = 0, a.docTransform.positionV.posOffset = 0, e.p.documentStyle.pageSize.width = 1 / 0, e.p.documentStyle.pageSize.height = 1 / 0, !0;
|
|
927
922
|
}
|
|
928
923
|
return !1;
|
|
929
924
|
}
|
|
930
|
-
let
|
|
925
|
+
let Mt = class extends ie {
|
|
931
926
|
constructor(i, t, e, n, r, s) {
|
|
932
927
|
super(), this._commandService = i, this._sheetInterceptorService = t, this._injector = e, this._drawingManagerService = n, this._docDrawingController = r, this._editorBridgeService = s, this._handleInitEditor(), this._initCellContentInterceptor();
|
|
933
928
|
}
|
|
934
929
|
_handleInitEditor() {
|
|
935
930
|
this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
|
|
936
|
-
i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(
|
|
931
|
+
i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(qe), this._docDrawingController.loadDrawingDataForUnit(qe), this._drawingManagerService.initializeNotification(qe)) : this._drawingManagerService.removeDrawingDataForUnit(qe);
|
|
937
932
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
|
|
938
|
-
i.id ===
|
|
933
|
+
i.id === rs.id && i.params.unitId === Be && (this._drawingManagerService.removeDrawingDataForUnit(Be), this._docDrawingController.loadDrawingDataForUnit(Be), this._drawingManagerService.initializeNotification(Be));
|
|
939
934
|
}));
|
|
940
935
|
}
|
|
941
936
|
_initCellContentInterceptor() {
|
|
942
937
|
this.disposeWithMe(
|
|
943
938
|
this._sheetInterceptorService.intercept(
|
|
944
|
-
|
|
939
|
+
Gi.CELL_CONTENT,
|
|
945
940
|
{
|
|
946
|
-
effect:
|
|
947
|
-
priority:
|
|
941
|
+
effect: Br.Style,
|
|
942
|
+
priority: Xi.CELL_IMAGE,
|
|
948
943
|
handler: (i, t, e) => {
|
|
949
944
|
var n;
|
|
950
|
-
return i != null && i.p && ((n = i.p.drawingsOrder) != null && n.length) && (i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 },
|
|
945
|
+
return i != null && i.p && ((n = i.p.drawingsOrder) != null && n.length) && (i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }, Ir(this._injector, { unitId: t.unitId, subUnitId: t.subUnitId, row: t.row, col: t.col }, i)), e(i);
|
|
951
946
|
}
|
|
952
947
|
}
|
|
953
948
|
)
|
|
954
949
|
);
|
|
955
950
|
}
|
|
956
951
|
};
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
],
|
|
965
|
-
var
|
|
966
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
952
|
+
Mt = Ss([
|
|
953
|
+
ke(0, G),
|
|
954
|
+
ke(1, A(kt)),
|
|
955
|
+
ke(2, A(Ye)),
|
|
956
|
+
ke(3, se),
|
|
957
|
+
ke(4, A(ni)),
|
|
958
|
+
ke(5, A(Di))
|
|
959
|
+
], Mt);
|
|
960
|
+
var Is = Object.getOwnPropertyDescriptor, Cs = (i, t, e, n) => {
|
|
961
|
+
for (var r = n > 1 ? void 0 : n ? Is(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
967
962
|
(o = i[s]) && (r = o(r) || r);
|
|
968
963
|
return r;
|
|
969
|
-
},
|
|
970
|
-
let
|
|
964
|
+
}, xn = (i, t) => (e, n) => t(e, n, i);
|
|
965
|
+
let yt = class extends ie {
|
|
971
966
|
constructor(i, t) {
|
|
972
967
|
super(), this._autoFillService = i, this._injector = t, this._initAutoFillHooks();
|
|
973
968
|
}
|
|
@@ -976,35 +971,35 @@ let Ut = class extends ie {
|
|
|
976
971
|
this._autoFillService.addHook({
|
|
977
972
|
id: "sheet-cell-image-autofill",
|
|
978
973
|
onBeforeSubmit: (i, t, e, n) => {
|
|
979
|
-
new
|
|
980
|
-
|
|
974
|
+
new $r(n).forValue((r, s, o) => {
|
|
975
|
+
Ir(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
|
|
981
976
|
});
|
|
982
977
|
}
|
|
983
978
|
})
|
|
984
979
|
);
|
|
985
980
|
}
|
|
986
981
|
};
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
],
|
|
991
|
-
var
|
|
992
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
982
|
+
yt = Cs([
|
|
983
|
+
xn(0, A(bi)),
|
|
984
|
+
xn(1, A(Ye))
|
|
985
|
+
], yt);
|
|
986
|
+
var Ds = Object.getOwnPropertyDescriptor, bs = (i, t, e, n) => {
|
|
987
|
+
for (var r = n > 1 ? void 0 : n ? Ds(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
993
988
|
(o = i[s]) && (r = o(r) || r);
|
|
994
989
|
return r;
|
|
995
|
-
},
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
990
|
+
}, ze = (i, t) => (e, n) => t(e, n, i);
|
|
991
|
+
const Rs = [
|
|
992
|
+
qe,
|
|
993
|
+
xr,
|
|
994
|
+
Be
|
|
1000
995
|
];
|
|
1001
|
-
let
|
|
996
|
+
let Et = class extends ie {
|
|
1002
997
|
constructor(i, t, e, n, r) {
|
|
1003
998
|
super(), this._commandService = i, this._univerInstanceService = t, this._dialogService = e, this._renderManagerService = n, this._localeService = r, this._initDocImageCopyPasteHooks();
|
|
1004
999
|
}
|
|
1005
1000
|
_setCellImage(i) {
|
|
1006
1001
|
var r;
|
|
1007
|
-
const t =
|
|
1002
|
+
const t = Ht("", {}), e = (r = on(F.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.with(Ri), n = zt.drawing.add({
|
|
1008
1003
|
documentDataModel: t,
|
|
1009
1004
|
drawings: [i],
|
|
1010
1005
|
selection: {
|
|
@@ -1019,20 +1014,20 @@ let At = class extends ie {
|
|
|
1019
1014
|
this.disposeWithMe(
|
|
1020
1015
|
this._commandService.beforeCommandExecuted((i) => {
|
|
1021
1016
|
var t, e;
|
|
1022
|
-
if (i.id ===
|
|
1023
|
-
const n = i.params, { doc: r } = n, s = this._univerInstanceService.getCurrentUnitOfType(
|
|
1017
|
+
if (i.id === is.id) {
|
|
1018
|
+
const n = i.params, { doc: r } = n, s = this._univerInstanceService.getCurrentUnitOfType(F.UNIVER_DOC);
|
|
1024
1019
|
if (s == null || !Object.keys((t = r.drawings) != null ? t : {}).length)
|
|
1025
1020
|
return;
|
|
1026
1021
|
const o = s.getUnitId();
|
|
1027
|
-
if (
|
|
1028
|
-
if (o !==
|
|
1022
|
+
if (Rs.includes(o)) {
|
|
1023
|
+
if (o !== Be) {
|
|
1029
1024
|
const a = () => {
|
|
1030
|
-
this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand(
|
|
1025
|
+
this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand(En.id, {
|
|
1031
1026
|
visible: !1
|
|
1032
1027
|
});
|
|
1033
1028
|
};
|
|
1034
1029
|
((e = s.getBody()) == null ? void 0 : e.dataStream) === `\r
|
|
1035
|
-
` ? (this._commandService.syncExecuteCommand(
|
|
1030
|
+
` ? (this._commandService.syncExecuteCommand(En.id, {
|
|
1036
1031
|
visible: !1
|
|
1037
1032
|
}), this._setCellImage(Object.values(r.drawings)[0])) : this._dialogService.open({
|
|
1038
1033
|
id: "sheet-cell-image-copy-paste",
|
|
@@ -1060,64 +1055,64 @@ let At = class extends ie {
|
|
|
1060
1055
|
);
|
|
1061
1056
|
}
|
|
1062
1057
|
};
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
],
|
|
1070
|
-
const
|
|
1058
|
+
Et = bs([
|
|
1059
|
+
ze(0, G),
|
|
1060
|
+
ze(1, Se),
|
|
1061
|
+
ze(2, Ai),
|
|
1062
|
+
ze(3, q),
|
|
1063
|
+
ze(4, A(nt))
|
|
1064
|
+
], Et);
|
|
1065
|
+
const Bt = {
|
|
1071
1066
|
id: "sheet.command.insert-float-image",
|
|
1072
1067
|
type: J.COMMAND,
|
|
1073
1068
|
handler: async (i, t) => {
|
|
1074
1069
|
var o, a;
|
|
1075
|
-
const e = i.get(
|
|
1076
|
-
|
|
1070
|
+
const e = i.get(Se), n = i.get(q), r = (o = on(
|
|
1071
|
+
F.UNIVER_SHEET,
|
|
1077
1072
|
e,
|
|
1078
1073
|
n
|
|
1079
|
-
)) == null ? void 0 : o.with(
|
|
1074
|
+
)) == null ? void 0 : o.with(et);
|
|
1080
1075
|
if (!r)
|
|
1081
1076
|
return !1;
|
|
1082
1077
|
const s = t == null ? void 0 : t.files;
|
|
1083
1078
|
if (s) {
|
|
1084
|
-
const
|
|
1085
|
-
return (await Promise.all(
|
|
1079
|
+
const d = s.map((u) => r.insertFloatImageByFile(u));
|
|
1080
|
+
return (await Promise.all(d)).every((u) => u);
|
|
1086
1081
|
} else
|
|
1087
1082
|
return (a = r.insertFloatImage()) != null ? a : !1;
|
|
1088
1083
|
}
|
|
1089
|
-
},
|
|
1084
|
+
}, ln = {
|
|
1090
1085
|
id: "sheet.command.insert-cell-image",
|
|
1091
1086
|
type: J.COMMAND,
|
|
1092
1087
|
handler: (i) => {
|
|
1093
1088
|
var n, r;
|
|
1094
|
-
const t = i.get(
|
|
1095
|
-
return (r = (n =
|
|
1096
|
-
|
|
1089
|
+
const t = i.get(Se), e = i.get(q);
|
|
1090
|
+
return (r = (n = on(
|
|
1091
|
+
F.UNIVER_SHEET,
|
|
1097
1092
|
t,
|
|
1098
1093
|
e
|
|
1099
|
-
)) == null ? void 0 : n.with(
|
|
1094
|
+
)) == null ? void 0 : n.with(et).insertCellImage()) != null ? r : !1;
|
|
1100
1095
|
}
|
|
1101
1096
|
};
|
|
1102
|
-
var
|
|
1103
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1097
|
+
var Ms = Object.getOwnPropertyDescriptor, ys = (i, t, e, n) => {
|
|
1098
|
+
for (var r = n > 1 ? void 0 : n ? Ms(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
1104
1099
|
(o = i[s]) && (r = o(r) || r);
|
|
1105
1100
|
return r;
|
|
1106
|
-
},
|
|
1107
|
-
const
|
|
1108
|
-
function
|
|
1101
|
+
}, Ke = (i, t) => (e, n) => t(e, n, i);
|
|
1102
|
+
const Cr = "image/png";
|
|
1103
|
+
function Es(i) {
|
|
1109
1104
|
const t = i.split(","), e = atob(t[1]), n = e.length, r = new Uint8Array(n);
|
|
1110
1105
|
for (let s = 0; s < n; s++)
|
|
1111
1106
|
r[s] = e.charCodeAt(s);
|
|
1112
|
-
return new Blob([r], { type:
|
|
1107
|
+
return new Blob([r], { type: Cr });
|
|
1113
1108
|
}
|
|
1114
|
-
function
|
|
1115
|
-
const t = new ClipboardItem({ [
|
|
1109
|
+
function Ts(i) {
|
|
1110
|
+
const t = new ClipboardItem({ [Cr]: Es(i) });
|
|
1116
1111
|
navigator.clipboard.write([t]).catch((e) => {
|
|
1117
1112
|
console.error("Could not copy image using clipboard API: ", e);
|
|
1118
1113
|
});
|
|
1119
1114
|
}
|
|
1120
|
-
function
|
|
1115
|
+
function Os() {
|
|
1121
1116
|
function i() {
|
|
1122
1117
|
const n = document.createElement("input");
|
|
1123
1118
|
return n.style.position = "absolute", n.style.height = "1px", n.style.width = "1px", n.style.opacity = "0", n;
|
|
@@ -1127,13 +1122,13 @@ function Ls() {
|
|
|
1127
1122
|
e.blur(), document.body.removeChild(e), t instanceof HTMLElement && t.focus();
|
|
1128
1123
|
};
|
|
1129
1124
|
}
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1125
|
+
const Fn = [
|
|
1126
|
+
$e.SPECIAL_PASTE_COL_WIDTH,
|
|
1127
|
+
$e.SPECIAL_PASTE_VALUE,
|
|
1128
|
+
$e.SPECIAL_PASTE_FORMAT,
|
|
1129
|
+
$e.SPECIAL_PASTE_FORMULA
|
|
1135
1130
|
];
|
|
1136
|
-
let
|
|
1131
|
+
let Tt = class extends ie {
|
|
1137
1132
|
constructor(t, e, n, r, s) {
|
|
1138
1133
|
super();
|
|
1139
1134
|
te(this, "_copyInfo");
|
|
@@ -1150,16 +1145,16 @@ let Nt = class extends ie {
|
|
|
1150
1145
|
const s = this._focusedDrawings;
|
|
1151
1146
|
if (s.length > 0) {
|
|
1152
1147
|
const [o] = s;
|
|
1153
|
-
if (r ===
|
|
1154
|
-
const
|
|
1148
|
+
if (r === Ce.CUT) {
|
|
1149
|
+
const d = {
|
|
1155
1150
|
unitId: t,
|
|
1156
1151
|
drawings: [o]
|
|
1157
1152
|
};
|
|
1158
|
-
this._commandService.executeCommand(
|
|
1153
|
+
this._commandService.executeCommand(rt.id, d);
|
|
1159
1154
|
}
|
|
1160
1155
|
setTimeout(() => {
|
|
1161
|
-
const
|
|
1162
|
-
o.drawingType ===
|
|
1156
|
+
const d = Os();
|
|
1157
|
+
o.drawingType === j.DRAWING_IMAGE && o.imageSourceType === si.BASE64 ? Ts(o.source) : this._clipboardInterfaceService.writeText(""), d();
|
|
1163
1158
|
}, 200);
|
|
1164
1159
|
const a = {
|
|
1165
1160
|
unitId: o.unitId,
|
|
@@ -1175,14 +1170,14 @@ let Nt = class extends ie {
|
|
|
1175
1170
|
onPasteCells: (t, e, n, r) => {
|
|
1176
1171
|
if (!this._copyInfo)
|
|
1177
1172
|
return { redos: [], undos: [] };
|
|
1178
|
-
const { copyType: s =
|
|
1179
|
-
return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId:
|
|
1173
|
+
const { copyType: s = Ce.COPY, pasteType: o } = r, { range: a } = t || {}, { range: d, unitId: u, subUnitId: c } = e;
|
|
1174
|
+
return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: c, pasteRange: d }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: e, pasteType: o }, Ce.COPY);
|
|
1180
1175
|
},
|
|
1181
1176
|
onPastePlainText: (t, e) => ({ undos: [], redos: [] }),
|
|
1182
|
-
onPasteUnrecognized: (t) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType:
|
|
1177
|
+
onPasteUnrecognized: (t) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: $e.DEFAULT_PASTE }, Ce.COPY) : { undos: [], redos: [] },
|
|
1183
1178
|
onPasteFiles: (t, e) => {
|
|
1184
1179
|
if (this._copyInfo)
|
|
1185
|
-
return this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType:
|
|
1180
|
+
return this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: $e.DEFAULT_PASTE }, Ce.COPY);
|
|
1186
1181
|
{
|
|
1187
1182
|
const n = e.filter((r) => r.type.includes("image"));
|
|
1188
1183
|
if (n.length)
|
|
@@ -1190,7 +1185,7 @@ let Nt = class extends ie {
|
|
|
1190
1185
|
undos: [],
|
|
1191
1186
|
redos: [
|
|
1192
1187
|
{
|
|
1193
|
-
id:
|
|
1188
|
+
id: Bt.id,
|
|
1194
1189
|
params: { files: n }
|
|
1195
1190
|
}
|
|
1196
1191
|
]
|
|
@@ -1202,23 +1197,23 @@ let Nt = class extends ie {
|
|
|
1202
1197
|
}
|
|
1203
1198
|
_createDrawingsCopyInfoByRange(t, e, n) {
|
|
1204
1199
|
var g;
|
|
1205
|
-
const r = (g = this._renderManagerService.getRenderById(t)) == null ? void 0 : g.with(
|
|
1200
|
+
const r = (g = this._renderManagerService.getRenderById(t)) == null ? void 0 : g.with(V);
|
|
1206
1201
|
if (!r) return;
|
|
1207
1202
|
const s = r.attachRangeWithCoord(n);
|
|
1208
1203
|
if (!s)
|
|
1209
1204
|
return;
|
|
1210
|
-
const { startX: o, endX: a, startY:
|
|
1211
|
-
if (Object.keys(
|
|
1212
|
-
const
|
|
1213
|
-
if (
|
|
1205
|
+
const { startX: o, endX: a, startY: d, endY: u } = s, c = this._drawingService.getDrawingData(t, e), l = this._focusedDrawings.slice();
|
|
1206
|
+
if (Object.keys(c).forEach((h) => {
|
|
1207
|
+
const m = c[h], { transform: p } = m;
|
|
1208
|
+
if (m.anchorType !== O.Both || !p)
|
|
1214
1209
|
return;
|
|
1215
|
-
const { left:
|
|
1216
|
-
drawingStartX:
|
|
1217
|
-
drawingEndX:
|
|
1218
|
-
drawingStartY:
|
|
1219
|
-
drawingEndY:
|
|
1210
|
+
const { left: f = 0, top: _ = 0, width: S = 0, height: C = 0 } = p, { drawingStartX: b, drawingEndX: v, drawingStartY: D, drawingEndY: w } = {
|
|
1211
|
+
drawingStartX: f,
|
|
1212
|
+
drawingEndX: f + S,
|
|
1213
|
+
drawingStartY: _,
|
|
1214
|
+
drawingEndY: _ + C
|
|
1220
1215
|
};
|
|
1221
|
-
o <= b && v <= a &&
|
|
1216
|
+
o <= b && v <= a && d <= D && w <= u && l.push(m);
|
|
1222
1217
|
}), l.length)
|
|
1223
1218
|
return {
|
|
1224
1219
|
copyRange: n,
|
|
@@ -1229,31 +1224,31 @@ let Nt = class extends ie {
|
|
|
1229
1224
|
}
|
|
1230
1225
|
_generateSingleDrawingPasteMutations(t, e) {
|
|
1231
1226
|
const { pasteType: n, pasteTo: r } = t;
|
|
1232
|
-
if (
|
|
1227
|
+
if (Fn.includes(n))
|
|
1233
1228
|
return { redos: [], undos: [] };
|
|
1234
|
-
const { unitId: s, subUnitId: o, range: a } = r,
|
|
1235
|
-
if (!u || !
|
|
1229
|
+
const { unitId: s, subUnitId: o, range: a } = r, d = this._renderManagerService.getRenderById(s), u = d == null ? void 0 : d.with(V), c = d == null ? void 0 : d.with(Ge), l = this._copyInfo;
|
|
1230
|
+
if (!u || !c)
|
|
1236
1231
|
return { redos: [], undos: [] };
|
|
1237
|
-
const { drawings: g } = l, h =
|
|
1232
|
+
const { drawings: g } = l, h = Tn(a);
|
|
1238
1233
|
return this._generateMutations(g, {
|
|
1239
1234
|
unitId: s,
|
|
1240
1235
|
subUnitId: o,
|
|
1241
|
-
isCut: e ===
|
|
1242
|
-
getTransform: (
|
|
1236
|
+
isCut: e === Ce.CUT,
|
|
1237
|
+
getTransform: (m, p) => {
|
|
1243
1238
|
var S;
|
|
1244
|
-
const
|
|
1239
|
+
const f = u.attachRangeWithCoord({
|
|
1245
1240
|
startRow: h.startRow,
|
|
1246
1241
|
endRow: h.endRow,
|
|
1247
1242
|
startColumn: h.startColumn,
|
|
1248
1243
|
endColumn: h.endColumn
|
|
1249
|
-
}),
|
|
1250
|
-
...
|
|
1251
|
-
left:
|
|
1252
|
-
top:
|
|
1244
|
+
}), _ = {
|
|
1245
|
+
...m,
|
|
1246
|
+
left: f == null ? void 0 : f.startX,
|
|
1247
|
+
top: f == null ? void 0 : f.startY
|
|
1253
1248
|
};
|
|
1254
1249
|
return {
|
|
1255
|
-
transform:
|
|
1256
|
-
sheetTransform: (S = x(
|
|
1250
|
+
transform: _,
|
|
1251
|
+
sheetTransform: (S = x(_, c)) != null ? S : p
|
|
1257
1252
|
};
|
|
1258
1253
|
}
|
|
1259
1254
|
});
|
|
@@ -1264,49 +1259,49 @@ let Nt = class extends ie {
|
|
|
1264
1259
|
subUnitId: r,
|
|
1265
1260
|
getTransform: s,
|
|
1266
1261
|
isCut: o
|
|
1267
|
-
} = e, a = [],
|
|
1268
|
-
return t.forEach((
|
|
1269
|
-
const { transform: l, sheetTransform: g } =
|
|
1262
|
+
} = e, a = [], d = [], { _drawingService: u } = this;
|
|
1263
|
+
return t.forEach((c) => {
|
|
1264
|
+
const { transform: l, sheetTransform: g } = c;
|
|
1270
1265
|
if (!l)
|
|
1271
1266
|
return;
|
|
1272
|
-
const h = s(l, g),
|
|
1273
|
-
...
|
|
1267
|
+
const h = s(l, g), m = {
|
|
1268
|
+
...c,
|
|
1274
1269
|
unitId: n,
|
|
1275
1270
|
subUnitId: r,
|
|
1276
|
-
drawingId: o ?
|
|
1271
|
+
drawingId: o ? c.drawingId : Re.generateRandomId(),
|
|
1277
1272
|
transform: h.transform,
|
|
1278
1273
|
sheetTransform: h.sheetTransform
|
|
1279
1274
|
};
|
|
1280
1275
|
if (o) {
|
|
1281
|
-
const { undo: p, redo:
|
|
1276
|
+
const { undo: p, redo: f, objects: _ } = u.getBatchUpdateOp([m]);
|
|
1282
1277
|
a.push({
|
|
1283
|
-
id:
|
|
1278
|
+
id: P.id,
|
|
1284
1279
|
params: {
|
|
1285
1280
|
unitId: n,
|
|
1286
1281
|
subUnitId: r,
|
|
1287
|
-
type:
|
|
1288
|
-
op:
|
|
1289
|
-
objects:
|
|
1282
|
+
type: U.UPDATE,
|
|
1283
|
+
op: f,
|
|
1284
|
+
objects: _
|
|
1290
1285
|
}
|
|
1291
|
-
}),
|
|
1292
|
-
id:
|
|
1286
|
+
}), d.push({
|
|
1287
|
+
id: P.id,
|
|
1293
1288
|
params: {
|
|
1294
1289
|
unitId: n,
|
|
1295
1290
|
subUnitId: r,
|
|
1296
|
-
type:
|
|
1291
|
+
type: U.UPDATE,
|
|
1297
1292
|
op: p,
|
|
1298
|
-
objects:
|
|
1293
|
+
objects: _
|
|
1299
1294
|
}
|
|
1300
1295
|
});
|
|
1301
1296
|
} else {
|
|
1302
|
-
const { undo: p, redo:
|
|
1303
|
-
a.push({ id:
|
|
1297
|
+
const { undo: p, redo: f, objects: _ } = u.getBatchAddOp([m]);
|
|
1298
|
+
a.push({ id: P.id, params: { op: f, unitId: n, subUnitId: r, objects: _, type: U.INSERT } }), d.push({ id: P.id, params: { op: p, unitId: n, subUnitId: r, objects: _, type: U.REMOVE } });
|
|
1304
1299
|
}
|
|
1305
|
-
}), { redos: a, undos:
|
|
1300
|
+
}), { redos: a, undos: d };
|
|
1306
1301
|
}
|
|
1307
1302
|
// eslint-disable-next-line max-lines-per-function
|
|
1308
1303
|
_generateRangeDrawingsPasteMutations(t, e) {
|
|
1309
|
-
var
|
|
1304
|
+
var y;
|
|
1310
1305
|
const {
|
|
1311
1306
|
unitId: n,
|
|
1312
1307
|
subUnitId: r,
|
|
@@ -1314,96 +1309,96 @@ let Nt = class extends ie {
|
|
|
1314
1309
|
pasteRange: o
|
|
1315
1310
|
} = t, {
|
|
1316
1311
|
copyRange: a,
|
|
1317
|
-
copyType:
|
|
1312
|
+
copyType: d
|
|
1318
1313
|
} = e;
|
|
1319
|
-
if (
|
|
1314
|
+
if (Fn.includes(s))
|
|
1320
1315
|
return { redos: [], undos: [] };
|
|
1321
|
-
const u = (
|
|
1316
|
+
const u = (y = this._renderManagerService.getRenderById(n)) == null ? void 0 : y.with(V);
|
|
1322
1317
|
if (!u || !this._copyInfo)
|
|
1323
1318
|
return { redos: [], undos: [] };
|
|
1324
|
-
const { drawings:
|
|
1319
|
+
const { drawings: c } = this._copyInfo;
|
|
1325
1320
|
if (!a)
|
|
1326
1321
|
return this._generateSingleDrawingPasteMutations({
|
|
1327
|
-
pasteTo: { unitId: n, subUnitId: r, range:
|
|
1322
|
+
pasteTo: { unitId: n, subUnitId: r, range: Tn(o) },
|
|
1328
1323
|
pasteType: s
|
|
1329
|
-
},
|
|
1330
|
-
const { ranges: [l, g], mapFunc: h } =
|
|
1331
|
-
startRow:
|
|
1332
|
-
endRow:
|
|
1324
|
+
}, d);
|
|
1325
|
+
const { ranges: [l, g], mapFunc: h } = Mi([a, o]), { row: m, col: p } = h(l.startRow, l.startColumn), { row: f, col: _ } = h(g.startRow, g.startColumn), S = u.attachRangeWithCoord({
|
|
1326
|
+
startRow: m,
|
|
1327
|
+
endRow: m,
|
|
1333
1328
|
startColumn: p,
|
|
1334
1329
|
endColumn: p
|
|
1335
1330
|
}), C = u.attachRangeWithCoord({
|
|
1336
|
-
startRow:
|
|
1337
|
-
endRow:
|
|
1338
|
-
startColumn:
|
|
1339
|
-
endColumn:
|
|
1331
|
+
startRow: f,
|
|
1332
|
+
endRow: f,
|
|
1333
|
+
startColumn: _,
|
|
1334
|
+
endColumn: _
|
|
1340
1335
|
});
|
|
1341
1336
|
if (!S || !C || !this._copyInfo)
|
|
1342
1337
|
return { redos: [], undos: [] };
|
|
1343
|
-
const b = C.startX - S.startX, v = C.startY - S.startY, D =
|
|
1344
|
-
return this._generateMutations(
|
|
1338
|
+
const b = C.startX - S.startX, v = C.startY - S.startY, D = f - m, w = _ - p;
|
|
1339
|
+
return this._generateMutations(c, {
|
|
1345
1340
|
unitId: n,
|
|
1346
1341
|
subUnitId: r,
|
|
1347
1342
|
getTransform: (I, E) => {
|
|
1348
|
-
var T,
|
|
1343
|
+
var T, M;
|
|
1349
1344
|
return {
|
|
1350
1345
|
transform: {
|
|
1351
1346
|
...I,
|
|
1352
1347
|
left: ((T = I == null ? void 0 : I.left) != null ? T : 0) + b,
|
|
1353
|
-
top: ((
|
|
1348
|
+
top: ((M = I == null ? void 0 : I.top) != null ? M : 0) + v
|
|
1354
1349
|
},
|
|
1355
1350
|
sheetTransform: {
|
|
1356
1351
|
...E,
|
|
1357
1352
|
to: {
|
|
1358
1353
|
...E.to,
|
|
1359
1354
|
row: E.to.row + D,
|
|
1360
|
-
column: E.to.column +
|
|
1355
|
+
column: E.to.column + w
|
|
1361
1356
|
},
|
|
1362
1357
|
from: {
|
|
1363
1358
|
...E.from,
|
|
1364
1359
|
row: E.from.row + D,
|
|
1365
|
-
column: E.from.column +
|
|
1360
|
+
column: E.from.column + w
|
|
1366
1361
|
}
|
|
1367
1362
|
}
|
|
1368
1363
|
};
|
|
1369
1364
|
},
|
|
1370
|
-
isCut:
|
|
1365
|
+
isCut: d === Ce.CUT
|
|
1371
1366
|
});
|
|
1372
1367
|
}
|
|
1373
1368
|
};
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
],
|
|
1381
|
-
var
|
|
1382
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1369
|
+
Tt = ys([
|
|
1370
|
+
Ke(0, yi),
|
|
1371
|
+
Ke(1, q),
|
|
1372
|
+
Ke(2, se),
|
|
1373
|
+
Ke(3, Ni),
|
|
1374
|
+
Ke(4, G)
|
|
1375
|
+
], Tt);
|
|
1376
|
+
var Us = Object.getOwnPropertyDescriptor, Ps = (i, t, e, n) => {
|
|
1377
|
+
for (var r = n > 1 ? void 0 : n ? Us(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
1383
1378
|
(o = i[s]) && (r = o(r) || r);
|
|
1384
1379
|
return r;
|
|
1385
|
-
},
|
|
1386
|
-
let
|
|
1380
|
+
}, Ze = (i, t) => (e, n) => t(e, n, i);
|
|
1381
|
+
let Ot = class extends ie {
|
|
1387
1382
|
constructor(i, t, e, n, r) {
|
|
1388
1383
|
super(), this._drawingManagerService = i, this._renderManagerService = t, this._permissionService = e, this._univerInstanceService = n, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
1389
1384
|
}
|
|
1390
1385
|
_initDrawingVisible() {
|
|
1391
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1386
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = vt([i, t]);
|
|
1392
1387
|
this.disposeWithMe(
|
|
1393
1388
|
e.pipe(
|
|
1394
|
-
|
|
1395
|
-
|
|
1389
|
+
_e(([n, r]) => n ? n.activeSheet$.pipe(
|
|
1390
|
+
Pn((s) => {
|
|
1396
1391
|
if (!s) {
|
|
1397
1392
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
1398
1393
|
return;
|
|
1399
1394
|
}
|
|
1400
1395
|
const o = n.getUnitId(), a = s.getSheetId();
|
|
1401
1396
|
this._permissionService.composePermission([
|
|
1402
|
-
new
|
|
1403
|
-
new
|
|
1397
|
+
new Wn(o).id,
|
|
1398
|
+
new jn(o, a).id
|
|
1404
1399
|
]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(n, s);
|
|
1405
1400
|
})
|
|
1406
|
-
) : (this._drawingManagerService.setDrawingVisible(!1),
|
|
1401
|
+
) : (this._drawingManagerService.setDrawingVisible(!1), me))
|
|
1407
1402
|
).subscribe()
|
|
1408
1403
|
);
|
|
1409
1404
|
}
|
|
@@ -1413,26 +1408,26 @@ let kt = class extends ie {
|
|
|
1413
1408
|
if (!a)
|
|
1414
1409
|
return;
|
|
1415
1410
|
a.getAllObjectsByOrder().forEach((u) => {
|
|
1416
|
-
u.classType ===
|
|
1411
|
+
u.classType === Ae.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.removeObject(u);
|
|
1417
1412
|
});
|
|
1418
1413
|
}
|
|
1419
1414
|
_initDrawingEditable() {
|
|
1420
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1415
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = vt([i, t]);
|
|
1421
1416
|
this.disposeWithMe(
|
|
1422
1417
|
e.pipe(
|
|
1423
|
-
|
|
1424
|
-
|
|
1418
|
+
_e(([n, r]) => n ? n.activeSheet$.pipe(
|
|
1419
|
+
Pn((s) => {
|
|
1425
1420
|
if (!s) {
|
|
1426
1421
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
1427
1422
|
return;
|
|
1428
1423
|
}
|
|
1429
1424
|
const o = n.getUnitId(), a = s.getSheetId();
|
|
1430
1425
|
this._permissionService.composePermission([
|
|
1431
|
-
new
|
|
1432
|
-
new
|
|
1426
|
+
new Kt(o).id,
|
|
1427
|
+
new Zt(o, a).id
|
|
1433
1428
|
]).every((u) => u.value) ? this._drawingManagerService.setDrawingEditable(!0) : this._handleDrawingEditableFalse(n, s);
|
|
1434
1429
|
})
|
|
1435
|
-
) : (this._drawingManagerService.setDrawingEditable(!1),
|
|
1430
|
+
) : (this._drawingManagerService.setDrawingEditable(!1), me))
|
|
1436
1431
|
).subscribe()
|
|
1437
1432
|
);
|
|
1438
1433
|
}
|
|
@@ -1442,49 +1437,49 @@ let kt = class extends ie {
|
|
|
1442
1437
|
if (!a)
|
|
1443
1438
|
return;
|
|
1444
1439
|
a.getAllObjectsByOrder().forEach((u) => {
|
|
1445
|
-
u.classType ===
|
|
1440
|
+
u.classType === Ae.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.detachTransformerFrom(u);
|
|
1446
1441
|
});
|
|
1447
1442
|
}
|
|
1448
1443
|
_initViewPermissionChange() {
|
|
1449
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1444
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), t = this._userManagerService.currentUser$;
|
|
1450
1445
|
this.disposeWithMe(
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1446
|
+
vt([i, t]).pipe(
|
|
1447
|
+
_e(([e, n]) => e ? e.activeSheet$.pipe(
|
|
1448
|
+
_e((r) => {
|
|
1454
1449
|
if (!r)
|
|
1455
|
-
return
|
|
1456
|
-
const s = e.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s),
|
|
1457
|
-
if (!
|
|
1458
|
-
return
|
|
1459
|
-
const u =
|
|
1450
|
+
return me;
|
|
1451
|
+
const s = e.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), d = a == null ? void 0 : a.scene;
|
|
1452
|
+
if (!d)
|
|
1453
|
+
return me;
|
|
1454
|
+
const u = d.getTransformerByCreate();
|
|
1460
1455
|
return this._permissionService.composePermission$([
|
|
1461
|
-
new
|
|
1462
|
-
new
|
|
1456
|
+
new Wn(s).id,
|
|
1457
|
+
new jn(s, o).id
|
|
1463
1458
|
]).pipe(
|
|
1464
|
-
|
|
1465
|
-
|
|
1459
|
+
Me((l) => l.every((g) => g.value)),
|
|
1460
|
+
An()
|
|
1466
1461
|
).pipe(
|
|
1467
|
-
|
|
1462
|
+
Me((l) => ({
|
|
1468
1463
|
permission: l,
|
|
1469
|
-
scene:
|
|
1464
|
+
scene: d,
|
|
1470
1465
|
transformer: u,
|
|
1471
1466
|
unitId: s,
|
|
1472
1467
|
subUnitId: o
|
|
1473
1468
|
}))
|
|
1474
1469
|
);
|
|
1475
1470
|
})
|
|
1476
|
-
) :
|
|
1471
|
+
) : me)
|
|
1477
1472
|
).subscribe({
|
|
1478
1473
|
next: ({ permission: e, scene: n, transformer: r, unitId: s, subUnitId: o }) => {
|
|
1479
1474
|
this._drawingManagerService.setDrawingVisible(e);
|
|
1480
|
-
const a = n.getAllObjectsByOrder(),
|
|
1481
|
-
e ? this._drawingManagerService.addNotification(u) : (a.forEach((
|
|
1482
|
-
|
|
1475
|
+
const a = n.getAllObjectsByOrder(), d = this._drawingManagerService.getDrawingData(s, o), u = Object.values(d);
|
|
1476
|
+
e ? this._drawingManagerService.addNotification(u) : (a.forEach((c) => {
|
|
1477
|
+
c.classType === Ae.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.removeObject(c);
|
|
1483
1478
|
}), r.clearSelectedObjects());
|
|
1484
1479
|
},
|
|
1485
1480
|
complete: () => {
|
|
1486
1481
|
this._drawingManagerService.setDrawingVisible(!0);
|
|
1487
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
1482
|
+
const e = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET), n = e == null ? void 0 : e.getActiveSheet(), r = e == null ? void 0 : e.getUnitId(), s = n == null ? void 0 : n.getSheetId();
|
|
1488
1483
|
if (!r || !s)
|
|
1489
1484
|
return;
|
|
1490
1485
|
const o = this._drawingManagerService.getDrawingData(r, s), a = Object.values(o);
|
|
@@ -1494,46 +1489,46 @@ let kt = class extends ie {
|
|
|
1494
1489
|
);
|
|
1495
1490
|
}
|
|
1496
1491
|
_initEditPermissionChange() {
|
|
1497
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1492
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), t = this._userManagerService.currentUser$;
|
|
1498
1493
|
this.disposeWithMe(
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1494
|
+
vt([i, t]).pipe(
|
|
1495
|
+
_e(([e, n]) => e ? e.activeSheet$.pipe(
|
|
1496
|
+
_e((r) => {
|
|
1502
1497
|
if (!r)
|
|
1503
|
-
return
|
|
1504
|
-
const s = e.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s),
|
|
1505
|
-
if (!
|
|
1506
|
-
return
|
|
1507
|
-
const u =
|
|
1498
|
+
return me;
|
|
1499
|
+
const s = e.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), d = a == null ? void 0 : a.scene;
|
|
1500
|
+
if (!d)
|
|
1501
|
+
return me;
|
|
1502
|
+
const u = d.getTransformerByCreate();
|
|
1508
1503
|
return this._permissionService.composePermission$([
|
|
1509
|
-
new
|
|
1510
|
-
new
|
|
1504
|
+
new Kt(s).id,
|
|
1505
|
+
new Zt(s, o).id
|
|
1511
1506
|
]).pipe(
|
|
1512
|
-
|
|
1513
|
-
|
|
1507
|
+
Me((l) => l.every((g) => g.value)),
|
|
1508
|
+
An()
|
|
1514
1509
|
).pipe(
|
|
1515
|
-
|
|
1510
|
+
Me((l) => ({
|
|
1516
1511
|
permission: l,
|
|
1517
|
-
scene:
|
|
1512
|
+
scene: d,
|
|
1518
1513
|
transformer: u,
|
|
1519
1514
|
unitId: s,
|
|
1520
1515
|
subUnitId: o
|
|
1521
1516
|
}))
|
|
1522
1517
|
);
|
|
1523
1518
|
})
|
|
1524
|
-
) :
|
|
1519
|
+
) : me)
|
|
1525
1520
|
).subscribe({
|
|
1526
1521
|
next: ({ permission: e, scene: n, transformer: r, unitId: s, subUnitId: o }) => {
|
|
1527
1522
|
this._drawingManagerService.setDrawingEditable(e);
|
|
1528
|
-
const a = n.getAllObjectsByOrder(),
|
|
1529
|
-
e ? (a.forEach((
|
|
1530
|
-
|
|
1531
|
-
}), this._drawingManagerService.addNotification(u)) : (a.forEach((
|
|
1532
|
-
|
|
1523
|
+
const a = n.getAllObjectsByOrder(), d = this._drawingManagerService.getDrawingData(s, o), u = Object.values(d);
|
|
1524
|
+
e ? (a.forEach((c) => {
|
|
1525
|
+
c.classType === Ae.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.attachTransformerTo(c);
|
|
1526
|
+
}), this._drawingManagerService.addNotification(u)) : (a.forEach((c) => {
|
|
1527
|
+
c.classType === Ae.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.detachTransformerFrom(c);
|
|
1533
1528
|
}), r.clearSelectedObjects());
|
|
1534
1529
|
},
|
|
1535
1530
|
complete: () => {
|
|
1536
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
1531
|
+
const e = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET);
|
|
1537
1532
|
if (!e)
|
|
1538
1533
|
return;
|
|
1539
1534
|
const n = e.getUnitId(), r = e.getActiveSheet();
|
|
@@ -1542,75 +1537,75 @@ let kt = class extends ie {
|
|
|
1542
1537
|
const s = r.getSheetId(), o = this._renderManagerService.getRenderById(n), a = o == null ? void 0 : o.scene;
|
|
1543
1538
|
if (!a)
|
|
1544
1539
|
return;
|
|
1545
|
-
const
|
|
1540
|
+
const d = this._drawingManagerService.getDrawingData(n, s), u = Object.values(d);
|
|
1546
1541
|
this._drawingManagerService.setDrawingEditable(!0), a.getAllObjectsByOrder().forEach((l) => {
|
|
1547
|
-
l.classType ===
|
|
1542
|
+
l.classType === Ae.IMAGE && u.some((g) => l.oKey.includes(g.drawingId)) && a.detachTransformerFrom(l);
|
|
1548
1543
|
});
|
|
1549
1544
|
}
|
|
1550
1545
|
})
|
|
1551
1546
|
);
|
|
1552
1547
|
}
|
|
1553
1548
|
};
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
],
|
|
1561
|
-
var
|
|
1562
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1549
|
+
Ot = Ps([
|
|
1550
|
+
Ze(0, se),
|
|
1551
|
+
Ze(1, q),
|
|
1552
|
+
Ze(2, Fr),
|
|
1553
|
+
Ze(3, Se),
|
|
1554
|
+
Ze(4, A(Lr))
|
|
1555
|
+
], Ot);
|
|
1556
|
+
var As = Object.getOwnPropertyDescriptor, Ns = (i, t, e, n) => {
|
|
1557
|
+
for (var r = n > 1 ? void 0 : n ? As(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
1563
1558
|
(o = i[s]) && (r = o(r) || r);
|
|
1564
1559
|
return r;
|
|
1565
|
-
},
|
|
1566
|
-
function
|
|
1567
|
-
const { scaleX: o, scaleY: a } = t.getAncestorScale(),
|
|
1560
|
+
}, De = (i, t) => (e, n) => t(e, n, i);
|
|
1561
|
+
function Dr(i, t, e, n, r, s = !1) {
|
|
1562
|
+
const { scaleX: o, scaleY: a } = t.getAncestorScale(), d = t.getViewport(Xn.VIEW_MAIN), u = n.getFreeze(), { startColumn: c, startRow: l, xSplit: g, ySplit: h } = u, m = {
|
|
1568
1563
|
left: !0,
|
|
1569
1564
|
// left means the left of pic is in a viewMainLeft
|
|
1570
1565
|
top: !0
|
|
1571
1566
|
};
|
|
1572
|
-
if (!
|
|
1567
|
+
if (!d)
|
|
1573
1568
|
return {
|
|
1574
1569
|
...i,
|
|
1575
|
-
absolute:
|
|
1570
|
+
absolute: m
|
|
1576
1571
|
};
|
|
1577
|
-
const { left: p, right:
|
|
1578
|
-
let { top: C, left: b, viewportScrollX: v, viewportScrollY: D } =
|
|
1579
|
-
const { boundsOfViewArea:
|
|
1572
|
+
const { left: p, right: f, top: _, bottom: S } = i;
|
|
1573
|
+
let { top: C, left: b, viewportScrollX: v, viewportScrollY: D } = d;
|
|
1574
|
+
const { boundsOfViewArea: w, scrollDirectionResponse: y } = r || {}, { rowHeaderWidth: I, columnHeaderHeight: E } = e, T = {
|
|
1580
1575
|
top: s ? 0 : E,
|
|
1581
1576
|
left: s ? 0 : I
|
|
1582
1577
|
};
|
|
1583
|
-
|
|
1584
|
-
let
|
|
1585
|
-
const N = e.rowStartY(l - h) + E,
|
|
1578
|
+
w && (Re.isDefine(T.top) && (T.top = w.top), Re.isDefine(T.left) && (T.left = w.left)), y === "HORIZONTAL" && (D = 0), y === "VERTICAL" && (v = 0);
|
|
1579
|
+
let M = 0, R = 0;
|
|
1580
|
+
const N = e.rowStartY(l - h) + E, B = e.colStartX(c - g) + I, Q = e.rowStartY(l) + E, H = e.colStartX(c) + I;
|
|
1586
1581
|
if (g === 0)
|
|
1587
|
-
|
|
1582
|
+
m.left = !1, M = (p - v) * o, R = (f - v) * o;
|
|
1588
1583
|
else {
|
|
1589
|
-
const k = p - (
|
|
1590
|
-
|
|
1584
|
+
const k = p - (B - I), ce = f - (B - I);
|
|
1585
|
+
f < H ? (M = k * o, R = ce * o) : p <= H && f >= H ? (M = k * o, R = Math.max(b, (f - v) * o)) : p > H && (m.left = !1, M = Math.max((p - v) * o, b), R = Math.max((f - v) * o, b));
|
|
1591
1586
|
}
|
|
1592
|
-
let
|
|
1587
|
+
let X = 0, Y = 0;
|
|
1593
1588
|
if (h === 0)
|
|
1594
|
-
|
|
1589
|
+
m.top = !1, X = (_ - D) * a, Y = (S - D) * a;
|
|
1595
1590
|
else {
|
|
1596
|
-
const k =
|
|
1597
|
-
S < Q ? (
|
|
1591
|
+
const k = _ - (N - E), ce = S - (N - E);
|
|
1592
|
+
S < Q ? (X = k * a, Y = ce * a) : _ <= Q && S >= Q ? (X = k * a, Y = Math.max(C, (S - D) * a)) : _ > Q && (m.top = !1, X = Math.max((_ - D) * a, C), Y = Math.max((S - D) * a, C));
|
|
1598
1593
|
}
|
|
1599
|
-
return
|
|
1600
|
-
left:
|
|
1594
|
+
return M = Math.max(M, T.left), X = Math.max(X, T.top), R = Math.max(R, T.left), Y = Math.max(Y, T.top), {
|
|
1595
|
+
left: M,
|
|
1601
1596
|
right: R,
|
|
1602
|
-
top:
|
|
1597
|
+
top: X,
|
|
1603
1598
|
bottom: Y,
|
|
1604
|
-
absolute:
|
|
1599
|
+
absolute: m
|
|
1605
1600
|
};
|
|
1606
1601
|
}
|
|
1607
|
-
const
|
|
1608
|
-
const { left: s, top: o, width: a, height:
|
|
1602
|
+
const fe = (i, t, e, n, r) => {
|
|
1603
|
+
const { left: s, top: o, width: a, height: d, angle: u } = i, c = {
|
|
1609
1604
|
left: s,
|
|
1610
1605
|
right: s + a,
|
|
1611
1606
|
top: o,
|
|
1612
|
-
bottom: o +
|
|
1613
|
-
}, l =
|
|
1607
|
+
bottom: o + d
|
|
1608
|
+
}, l = Dr(c, t, e, n, r), { scaleX: g, scaleY: h } = t.getAncestorScale();
|
|
1614
1609
|
return {
|
|
1615
1610
|
startX: l.left,
|
|
1616
1611
|
endX: l.right,
|
|
@@ -1618,27 +1613,27 @@ const ge = (i, t, e, n, r) => {
|
|
|
1618
1613
|
endY: l.bottom,
|
|
1619
1614
|
rotate: u,
|
|
1620
1615
|
width: a * g,
|
|
1621
|
-
height:
|
|
1616
|
+
height: d * h,
|
|
1622
1617
|
absolute: l.absolute
|
|
1623
1618
|
};
|
|
1624
1619
|
};
|
|
1625
|
-
let
|
|
1620
|
+
let tt = class extends ie {
|
|
1626
1621
|
constructor(t, e, n, r, s, o, a) {
|
|
1627
1622
|
super();
|
|
1628
1623
|
/**
|
|
1629
1624
|
* for update dom container position when scrolling and zoom
|
|
1630
1625
|
*/
|
|
1631
1626
|
te(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
|
|
1632
|
-
te(this, "_transformChange$", new
|
|
1627
|
+
te(this, "_transformChange$", new Xt());
|
|
1633
1628
|
te(this, "transformChange$", this._transformChange$.asObservable());
|
|
1634
|
-
te(this, "_add$", new
|
|
1629
|
+
te(this, "_add$", new Xt());
|
|
1635
1630
|
te(this, "add$", this._add$.asObservable());
|
|
1636
|
-
te(this, "_remove$", new
|
|
1631
|
+
te(this, "_remove$", new Xt());
|
|
1637
1632
|
te(this, "remove$", this._remove$.asObservable());
|
|
1638
1633
|
this._renderManagerService = t, this._univerInstanceService = e, this._commandService = n, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = a, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
|
|
1639
1634
|
}
|
|
1640
1635
|
_bindScrollEvent() {
|
|
1641
|
-
this._lifecycleService.lifecycle$.pipe(
|
|
1636
|
+
this._lifecycleService.lifecycle$.pipe(Li((t) => t === Gr.Rendered), Yi(1)).subscribe(() => {
|
|
1642
1637
|
this._scrollUpdateListener();
|
|
1643
1638
|
});
|
|
1644
1639
|
}
|
|
@@ -1663,117 +1658,118 @@ let rt = class extends ie {
|
|
|
1663
1658
|
// eslint-disable-next-line max-lines-per-function
|
|
1664
1659
|
this._drawingManagerService.add$.subscribe((t) => {
|
|
1665
1660
|
t.forEach((e) => {
|
|
1666
|
-
var
|
|
1667
|
-
const { unitId: n, subUnitId: r, drawingId: s } = e, o = ae(this._univerInstanceService, { unitId: n, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(e),
|
|
1668
|
-
if (!
|
|
1661
|
+
var K;
|
|
1662
|
+
const { unitId: n, subUnitId: r, drawingId: s } = e, o = ae(this._univerInstanceService, { unitId: n, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(e), d = this._univerInstanceService.getUnit(n, F.UNIVER_SHEET);
|
|
1663
|
+
if (!d)
|
|
1669
1664
|
return;
|
|
1670
|
-
const u =
|
|
1665
|
+
const u = d.getActiveSheet().getSheetId();
|
|
1671
1666
|
if (!a || !o)
|
|
1672
1667
|
return;
|
|
1673
|
-
const
|
|
1674
|
-
if (!
|
|
1668
|
+
const c = (K = this._renderManagerService.getRenderById(n)) == null ? void 0 : K.with(V).getSkeletonParam(r);
|
|
1669
|
+
if (!c)
|
|
1675
1670
|
return;
|
|
1676
1671
|
const { transform: l, drawingType: g, data: h } = a;
|
|
1677
|
-
if (g !==
|
|
1672
|
+
if (g !== j.DRAWING_DOM && g !== j.DRAWING_CHART)
|
|
1678
1673
|
return;
|
|
1679
|
-
const
|
|
1680
|
-
if (
|
|
1674
|
+
const m = this._getSceneAndTransformerByDrawingSearch(n);
|
|
1675
|
+
if (m == null)
|
|
1681
1676
|
return;
|
|
1682
|
-
const { scene: p, canvas:
|
|
1677
|
+
const { scene: p, canvas: f } = m;
|
|
1683
1678
|
if (l == null)
|
|
1684
1679
|
return !0;
|
|
1685
1680
|
if (u !== r)
|
|
1686
1681
|
return;
|
|
1687
|
-
const { left:
|
|
1682
|
+
const { left: _, top: S, width: C, height: b, angle: v, flipX: D, flipY: w, skewX: y, skewY: I } = l, E = Ie({ unitId: n, subUnitId: r, drawingId: s }), T = p.getObject(E);
|
|
1688
1683
|
if (T != null) {
|
|
1689
|
-
T.transformByState({ left:
|
|
1684
|
+
T.transformByState({ left: _, top: S, width: C, height: b, angle: v, flipX: D, flipY: w, skewX: y, skewY: I });
|
|
1690
1685
|
return;
|
|
1691
1686
|
}
|
|
1692
|
-
const
|
|
1693
|
-
left:
|
|
1687
|
+
const M = {
|
|
1688
|
+
left: _,
|
|
1694
1689
|
top: S,
|
|
1695
1690
|
width: C,
|
|
1696
1691
|
height: b,
|
|
1697
1692
|
zIndex: this._drawingManagerService.getDrawingOrder(n, r).length - 1
|
|
1698
|
-
}, R = g ===
|
|
1699
|
-
if (
|
|
1693
|
+
}, R = g === j.DRAWING_CHART;
|
|
1694
|
+
if (M.rotateEnabled = !1, R) {
|
|
1700
1695
|
const k = h ? h.backgroundColor : "white";
|
|
1701
|
-
|
|
1696
|
+
M.fill = k, h && h.border && (M.stroke = h.border), M.paintFirst = "stroke", M.strokeWidth = 1, M.borderEnabled = !1, M.radius = 8;
|
|
1702
1697
|
}
|
|
1703
|
-
const N = new
|
|
1704
|
-
R && N.setObjectType(
|
|
1705
|
-
const
|
|
1706
|
-
dispose:
|
|
1698
|
+
const N = new Ne(E, M);
|
|
1699
|
+
R && N.setObjectType(yn.CHART), p.addObject(N, Yt), a.allowTransform !== !1 && p.attachTransformerTo(N);
|
|
1700
|
+
const B = new wt(), Q = fe(N, m.renderUnit.scene, c.skeleton, o.worksheet), H = new je(Q), X = {
|
|
1701
|
+
dispose: B,
|
|
1707
1702
|
rect: N,
|
|
1708
|
-
position$:
|
|
1703
|
+
position$: H,
|
|
1709
1704
|
unitId: n,
|
|
1710
1705
|
subUnitId: r,
|
|
1711
1706
|
id: s
|
|
1712
1707
|
};
|
|
1713
1708
|
this._canvasFloatDomService.addFloatDom({
|
|
1714
|
-
position$:
|
|
1709
|
+
position$: H,
|
|
1715
1710
|
id: s,
|
|
1716
1711
|
componentKey: a.componentKey,
|
|
1717
1712
|
onPointerDown: (k) => {
|
|
1718
|
-
|
|
1713
|
+
f.dispatchEvent(new PointerEvent(k.type, k));
|
|
1719
1714
|
},
|
|
1720
1715
|
onPointerMove: (k) => {
|
|
1721
|
-
|
|
1716
|
+
f.dispatchEvent(new PointerEvent(k.type, k));
|
|
1722
1717
|
},
|
|
1723
1718
|
onPointerUp: (k) => {
|
|
1724
|
-
|
|
1719
|
+
f.dispatchEvent(new PointerEvent(k.type, k));
|
|
1725
1720
|
},
|
|
1726
1721
|
onWheel: (k) => {
|
|
1727
|
-
|
|
1722
|
+
f.dispatchEvent(new WheelEvent(k.type, k));
|
|
1728
1723
|
},
|
|
1729
1724
|
data: h,
|
|
1730
1725
|
unitId: n
|
|
1731
1726
|
});
|
|
1732
1727
|
const Y = N.onTransformChange$.subscribeEvent(() => {
|
|
1733
|
-
const k =
|
|
1734
|
-
|
|
1728
|
+
const k = fe(N, m.renderUnit.scene, c.skeleton, o.worksheet);
|
|
1729
|
+
H.next(
|
|
1735
1730
|
k
|
|
1736
1731
|
);
|
|
1737
1732
|
});
|
|
1738
|
-
|
|
1733
|
+
B.add(() => {
|
|
1739
1734
|
this._canvasFloatDomService.removeFloatDom(s);
|
|
1740
|
-
}), Y &&
|
|
1735
|
+
}), Y && B.add(Y), this._domLayerInfoMap.set(s, X);
|
|
1741
1736
|
});
|
|
1742
1737
|
})
|
|
1743
1738
|
), this.disposeWithMe(
|
|
1744
1739
|
this._drawingManagerService.remove$.subscribe((t) => {
|
|
1745
1740
|
t.forEach((e) => {
|
|
1746
|
-
|
|
1741
|
+
var l;
|
|
1742
|
+
const { unitId: n, subUnitId: r, drawingId: s } = e, o = Ie({ unitId: n, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(n);
|
|
1747
1743
|
if (a == null)
|
|
1748
1744
|
return;
|
|
1749
|
-
const { transformer:
|
|
1750
|
-
|
|
1745
|
+
const { transformer: d, scene: u } = a, c = u.getObject(o);
|
|
1746
|
+
c != null && c.oKey && (d.clearControlByIds([c == null ? void 0 : c.oKey]), (l = u.getTransformer()) == null || l.clearSelectedObjects());
|
|
1751
1747
|
});
|
|
1752
1748
|
})
|
|
1753
1749
|
);
|
|
1754
1750
|
}
|
|
1755
1751
|
_scrollUpdateListener() {
|
|
1756
1752
|
const t = (e, n) => {
|
|
1757
|
-
var
|
|
1758
|
-
const r = this._getSceneAndTransformerByDrawingSearch(e), s = Array.from(this._domLayerInfoMap.keys()).map((u) => ({ id: u, ...this._domLayerInfoMap.get(u) })).filter((u) => u.subUnitId === n && u.unitId === e).map((u) => u.id), o = ae(this._univerInstanceService, { unitId: e, subUnitId: n }), a = (
|
|
1753
|
+
var d;
|
|
1754
|
+
const r = this._getSceneAndTransformerByDrawingSearch(e), s = Array.from(this._domLayerInfoMap.keys()).map((u) => ({ id: u, ...this._domLayerInfoMap.get(u) })).filter((u) => u.subUnitId === n && u.unitId === e).map((u) => u.id), o = ae(this._univerInstanceService, { unitId: e, subUnitId: n }), a = (d = this._renderManagerService.getRenderById(e)) == null ? void 0 : d.with(V).getSkeletonParam(n);
|
|
1759
1755
|
!r || !o || !a || s.forEach((u) => {
|
|
1760
|
-
const
|
|
1761
|
-
if (
|
|
1762
|
-
const l =
|
|
1763
|
-
|
|
1756
|
+
const c = this._domLayerInfoMap.get(u);
|
|
1757
|
+
if (c) {
|
|
1758
|
+
const l = fe(c.rect, r.renderUnit.scene, a.skeleton, o.worksheet, c);
|
|
1759
|
+
c.position$.next(l);
|
|
1764
1760
|
}
|
|
1765
1761
|
});
|
|
1766
1762
|
};
|
|
1767
1763
|
this.disposeWithMe(
|
|
1768
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1769
|
-
|
|
1770
|
-
|
|
1764
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(
|
|
1765
|
+
_e((e) => e ? e.activeSheet$ : Nn(null)),
|
|
1766
|
+
Me((e) => {
|
|
1771
1767
|
if (!e) return null;
|
|
1772
1768
|
const n = e.getUnitId(), r = this._renderManagerService.getRenderById(n);
|
|
1773
1769
|
return r ? { render: r, unitId: n, subUnitId: e.getSheetId() } : null;
|
|
1774
1770
|
}),
|
|
1775
|
-
|
|
1776
|
-
(e) => e ?
|
|
1771
|
+
_e(
|
|
1772
|
+
(e) => e ? Xr(e.render.scene.getViewport(Xn.VIEW_MAIN).onScrollAfter$).pipe(Me(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : Nn(null)
|
|
1777
1773
|
)
|
|
1778
1774
|
).subscribe((e) => {
|
|
1779
1775
|
if (!e) return;
|
|
@@ -1781,12 +1777,12 @@ let rt = class extends ie {
|
|
|
1781
1777
|
t(n, r);
|
|
1782
1778
|
})
|
|
1783
1779
|
), this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
|
|
1784
|
-
if (e.id ===
|
|
1780
|
+
if (e.id === On.id) {
|
|
1785
1781
|
const n = e.params, { unitId: r } = n;
|
|
1786
1782
|
Array.from(this._domLayerInfoMap.values()).filter((o) => o.unitId === r).map((o) => o.subUnitId).forEach((o) => {
|
|
1787
1783
|
t(r, o);
|
|
1788
1784
|
});
|
|
1789
|
-
} else if (e.id ===
|
|
1785
|
+
} else if (e.id === Vi.id) {
|
|
1790
1786
|
const { unitId: n, subUnitId: r } = e.params;
|
|
1791
1787
|
t(n, r);
|
|
1792
1788
|
}
|
|
@@ -1794,25 +1790,25 @@ let rt = class extends ie {
|
|
|
1794
1790
|
}
|
|
1795
1791
|
_getPosition(t, e) {
|
|
1796
1792
|
var g;
|
|
1797
|
-
const { startX: n, endX: r, startY: s, endY: o } = t, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(
|
|
1793
|
+
const { startX: n, endX: r, startY: s, endY: o } = t, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(Ge);
|
|
1798
1794
|
if (a == null)
|
|
1799
1795
|
return;
|
|
1800
|
-
const
|
|
1801
|
-
if (c == null)
|
|
1802
|
-
return;
|
|
1803
|
-
const u = {
|
|
1804
|
-
column: c.actualColumn,
|
|
1805
|
-
columnOffset: n - c.startX,
|
|
1806
|
-
row: c.actualRow,
|
|
1807
|
-
rowOffset: s - c.startY
|
|
1808
|
-
}, d = a.getCellWithCoordByOffset(r, o);
|
|
1796
|
+
const d = a.getCellWithCoordByOffset(n, s);
|
|
1809
1797
|
if (d == null)
|
|
1810
1798
|
return;
|
|
1811
|
-
const
|
|
1799
|
+
const u = {
|
|
1812
1800
|
column: d.actualColumn,
|
|
1813
|
-
columnOffset:
|
|
1801
|
+
columnOffset: n - d.startX,
|
|
1814
1802
|
row: d.actualRow,
|
|
1815
|
-
rowOffset:
|
|
1803
|
+
rowOffset: s - d.startY
|
|
1804
|
+
}, c = a.getCellWithCoordByOffset(r, o);
|
|
1805
|
+
if (c == null)
|
|
1806
|
+
return;
|
|
1807
|
+
const l = {
|
|
1808
|
+
column: c.actualColumn,
|
|
1809
|
+
columnOffset: r - c.startX,
|
|
1810
|
+
row: c.actualRow,
|
|
1811
|
+
rowOffset: o - c.startY
|
|
1816
1812
|
};
|
|
1817
1813
|
return {
|
|
1818
1814
|
from: u,
|
|
@@ -1824,7 +1820,7 @@ let rt = class extends ie {
|
|
|
1824
1820
|
this._drawingManagerService.update$.subscribe((t) => {
|
|
1825
1821
|
t.forEach((e) => {
|
|
1826
1822
|
const n = this._drawingManagerService.getDrawingByParam(e);
|
|
1827
|
-
if (!n || n.drawingType !==
|
|
1823
|
+
if (!n || n.drawingType !== j.DRAWING_DOM && n.drawingType !== j.DRAWING_CHART)
|
|
1828
1824
|
return;
|
|
1829
1825
|
const r = {
|
|
1830
1826
|
...n.transform
|
|
@@ -1846,8 +1842,8 @@ let rt = class extends ie {
|
|
|
1846
1842
|
updateFloatDomProps(t, e, n, r) {
|
|
1847
1843
|
const s = this._domLayerInfoMap.get(n), o = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1848
1844
|
if (s && o) {
|
|
1849
|
-
const { scene: a } = o,
|
|
1850
|
-
u && u instanceof
|
|
1845
|
+
const { scene: a } = o, d = Ie({ unitId: t, subUnitId: e, drawingId: n }), u = a.getObject(d);
|
|
1846
|
+
u && u instanceof Ne && u.setProps(r);
|
|
1851
1847
|
}
|
|
1852
1848
|
}
|
|
1853
1849
|
// CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
|
|
@@ -1858,14 +1854,14 @@ let rt = class extends ie {
|
|
|
1858
1854
|
});
|
|
1859
1855
|
if (!n)
|
|
1860
1856
|
throw new Error("cannot find current target!");
|
|
1861
|
-
const { unitId: r, subUnitId: s } = n, { initPosition: o, componentKey: a, data:
|
|
1857
|
+
const { unitId: r, subUnitId: s } = n, { initPosition: o, componentKey: a, data: d, allowTransform: u = !0 } = t, c = e != null ? e : bt(), l = this._getPosition(o, r);
|
|
1862
1858
|
if (l == null)
|
|
1863
1859
|
return;
|
|
1864
1860
|
const g = {
|
|
1865
1861
|
unitId: r,
|
|
1866
1862
|
subUnitId: s,
|
|
1867
|
-
drawingId:
|
|
1868
|
-
drawingType: t.type ||
|
|
1863
|
+
drawingId: c,
|
|
1864
|
+
drawingType: t.type || j.DRAWING_DOM,
|
|
1869
1865
|
componentKey: a,
|
|
1870
1866
|
sheetTransform: l,
|
|
1871
1867
|
transform: {
|
|
@@ -1874,16 +1870,16 @@ let rt = class extends ie {
|
|
|
1874
1870
|
width: o.endX - o.startX,
|
|
1875
1871
|
height: o.endY - o.startY
|
|
1876
1872
|
},
|
|
1877
|
-
data:
|
|
1873
|
+
data: d,
|
|
1878
1874
|
allowTransform: u
|
|
1879
1875
|
};
|
|
1880
|
-
return this._commandService.executeCommand(
|
|
1876
|
+
return this._commandService.executeCommand(Wt.id, {
|
|
1881
1877
|
unitId: r,
|
|
1882
1878
|
drawings: [g]
|
|
1883
|
-
}), this._add$.next({ unitId: r, subUnitId: s, id:
|
|
1884
|
-
id:
|
|
1879
|
+
}), this._add$.next({ unitId: r, subUnitId: s, id: c }), {
|
|
1880
|
+
id: c,
|
|
1885
1881
|
dispose: () => {
|
|
1886
|
-
this._removeDom(
|
|
1882
|
+
this._removeDom(c, !0);
|
|
1887
1883
|
}
|
|
1888
1884
|
};
|
|
1889
1885
|
}
|
|
@@ -1898,33 +1894,33 @@ let rt = class extends ie {
|
|
|
1898
1894
|
const a = this._drawingManagerService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: t });
|
|
1899
1895
|
if (!a)
|
|
1900
1896
|
return;
|
|
1901
|
-
const
|
|
1902
|
-
this._commandService.syncExecuteCommand(
|
|
1897
|
+
const d = this._sheetDrawingService.getBatchRemoveOp([a]), { redo: u, objects: c } = d;
|
|
1898
|
+
this._commandService.syncExecuteCommand(P.id, { unitId: r, subUnitId: s, op: u, objects: c, type: U.REMOVE });
|
|
1903
1899
|
}
|
|
1904
1900
|
}
|
|
1905
1901
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
1906
1902
|
addFloatDomToRange(t, e, n, r) {
|
|
1907
|
-
var D,
|
|
1903
|
+
var D, w, y;
|
|
1908
1904
|
const s = ae(this._univerInstanceService, {
|
|
1909
1905
|
unitId: e.unitId,
|
|
1910
1906
|
subUnitId: e.subUnitId
|
|
1911
1907
|
});
|
|
1912
1908
|
if (!s)
|
|
1913
1909
|
throw new Error("cannot find current target!");
|
|
1914
|
-
const { unitId: o, subUnitId: a } = s,
|
|
1915
|
-
if (!
|
|
1910
|
+
const { unitId: o, subUnitId: a } = s, d = this._getSceneAndTransformerByDrawingSearch(o);
|
|
1911
|
+
if (!d) return;
|
|
1916
1912
|
const u = this._renderManagerService.getRenderById(o);
|
|
1917
1913
|
if (!u) return;
|
|
1918
|
-
const
|
|
1919
|
-
if (!
|
|
1920
|
-
const { componentKey: l, data: g, allowTransform: h = !0 } = e,
|
|
1914
|
+
const c = (D = this._renderManagerService.getRenderById(o)) == null ? void 0 : D.with(V).getWorksheetSkeleton(a);
|
|
1915
|
+
if (!c) return;
|
|
1916
|
+
const { componentKey: l, data: g, allowTransform: h = !0 } = e, m = r != null ? r : bt(), { position: p, position$: f } = this._createRangePositionObserver(t, u, c.skeleton);
|
|
1921
1917
|
if (this._getPosition(p, o) == null)
|
|
1922
1918
|
return;
|
|
1923
|
-
const S =
|
|
1919
|
+
const S = d.scene, { scaleX: C } = S.getAncestorScale(), b = Ct(p, n, C), v = {
|
|
1924
1920
|
unitId: o,
|
|
1925
1921
|
subUnitId: a,
|
|
1926
|
-
drawingId:
|
|
1927
|
-
drawingType: e.type ||
|
|
1922
|
+
drawingId: m,
|
|
1923
|
+
drawingType: e.type || j.DRAWING_DOM,
|
|
1928
1924
|
componentKey: l,
|
|
1929
1925
|
transform: {
|
|
1930
1926
|
left: b.startX,
|
|
@@ -1936,62 +1932,62 @@ let rt = class extends ie {
|
|
|
1936
1932
|
allowTransform: h
|
|
1937
1933
|
};
|
|
1938
1934
|
{
|
|
1939
|
-
const { unitId: I, subUnitId: E, drawingId: T } = v,
|
|
1935
|
+
const { unitId: I, subUnitId: E, drawingId: T } = v, M = ae(this._univerInstanceService, { unitId: I, subUnitId: E }), R = v, N = this._univerInstanceService.getUnit(I, F.UNIVER_SHEET);
|
|
1940
1936
|
if (!N)
|
|
1941
1937
|
return;
|
|
1942
|
-
const
|
|
1943
|
-
if (!R || !
|
|
1938
|
+
const B = N.getActiveSheet().getSheetId();
|
|
1939
|
+
if (!R || !M)
|
|
1944
1940
|
return;
|
|
1945
|
-
const Q = (
|
|
1941
|
+
const Q = (w = this._renderManagerService.getRenderById(I)) == null ? void 0 : w.with(V);
|
|
1946
1942
|
if (!Q)
|
|
1947
1943
|
return;
|
|
1948
|
-
const
|
|
1949
|
-
if (!
|
|
1944
|
+
const H = Q.getWorksheetSkeleton(E);
|
|
1945
|
+
if (!H)
|
|
1950
1946
|
return;
|
|
1951
|
-
const { transform:
|
|
1952
|
-
if (Y !==
|
|
1947
|
+
const { transform: X, drawingType: Y, data: K } = R;
|
|
1948
|
+
if (Y !== j.DRAWING_DOM && Y !== j.DRAWING_CHART)
|
|
1953
1949
|
return;
|
|
1954
1950
|
const k = this._getSceneAndTransformerByDrawingSearch(I);
|
|
1955
1951
|
if (k == null)
|
|
1956
1952
|
return;
|
|
1957
|
-
const { scene: ce, canvas:
|
|
1958
|
-
if (
|
|
1953
|
+
const { scene: ce, canvas: ye } = k;
|
|
1954
|
+
if (X == null || B !== E)
|
|
1959
1955
|
return;
|
|
1960
|
-
const { left:
|
|
1961
|
-
if (
|
|
1962
|
-
|
|
1956
|
+
const { left: ot, top: at, width: ct, height: dt, angle: $t, flipX: xt, flipY: lt, skewX: ut, skewY: Ee } = X, ht = Ie({ unitId: I, subUnitId: E, drawingId: T }), le = ce.getObject(ht);
|
|
1957
|
+
if (le != null) {
|
|
1958
|
+
le.transformByState({ left: ot, top: at, width: ct, height: dt, angle: $t, flipX: xt, flipY: lt, skewX: ut, skewY: Ee });
|
|
1963
1959
|
return;
|
|
1964
1960
|
}
|
|
1965
1961
|
const ee = {
|
|
1966
|
-
left:
|
|
1962
|
+
left: ot,
|
|
1967
1963
|
// from floatDomParam.transform
|
|
1968
|
-
top:
|
|
1969
|
-
width:
|
|
1970
|
-
height:
|
|
1964
|
+
top: at,
|
|
1965
|
+
width: ct,
|
|
1966
|
+
height: dt,
|
|
1971
1967
|
zIndex: this._drawingManagerService.getDrawingOrder(I, E).length - 1
|
|
1972
|
-
},
|
|
1973
|
-
if (
|
|
1974
|
-
const
|
|
1975
|
-
ee.fill =
|
|
1968
|
+
}, Te = Y === j.DRAWING_CHART;
|
|
1969
|
+
if (Te) {
|
|
1970
|
+
const W = K ? K.backgroundColor : "white";
|
|
1971
|
+
ee.fill = W, ee.rotateEnabled = !1, K && K.border && (ee.stroke = K.border), ee.paintFirst = "stroke", ee.strokeWidth = 1, ee.borderEnabled = !1, ee.radius = 8;
|
|
1976
1972
|
}
|
|
1977
|
-
const
|
|
1978
|
-
|
|
1979
|
-
const
|
|
1980
|
-
top:
|
|
1981
|
-
left:
|
|
1982
|
-
bottom:
|
|
1983
|
-
right:
|
|
1984
|
-
},
|
|
1985
|
-
dispose:
|
|
1986
|
-
rect:
|
|
1987
|
-
boundsOfViewArea:
|
|
1973
|
+
const ue = new Ne(ht, ee);
|
|
1974
|
+
Te && ue.setObjectType(yn.CHART), ce.addObject(ue, Yt), R.allowTransform !== !1 && ce.attachTransformerTo(ue);
|
|
1975
|
+
const he = new wt(), gt = ce.getMainViewport(), { rowHeaderWidth: Oe, columnHeaderHeight: Xe } = H.skeleton, ft = {
|
|
1976
|
+
top: Xe,
|
|
1977
|
+
left: Oe,
|
|
1978
|
+
bottom: gt.bottom,
|
|
1979
|
+
right: gt.right
|
|
1980
|
+
}, ge = {
|
|
1981
|
+
dispose: he,
|
|
1982
|
+
rect: ue,
|
|
1983
|
+
boundsOfViewArea: ft,
|
|
1988
1984
|
domAnchor: n,
|
|
1989
1985
|
unitId: I,
|
|
1990
1986
|
subUnitId: E
|
|
1991
|
-
}, $ =
|
|
1992
|
-
|
|
1993
|
-
let
|
|
1994
|
-
position$:
|
|
1987
|
+
}, $ = fe(ue, k.renderUnit.scene, H.skeleton, M.worksheet, ge), Ue = new je($);
|
|
1988
|
+
ge.position$ = Ue;
|
|
1989
|
+
let Ve = {
|
|
1990
|
+
position$: Ue,
|
|
1995
1991
|
id: T,
|
|
1996
1992
|
componentKey: R.componentKey,
|
|
1997
1993
|
onPointerDown: () => {
|
|
@@ -2000,63 +1996,63 @@ let rt = class extends ie {
|
|
|
2000
1996
|
},
|
|
2001
1997
|
onPointerUp: () => {
|
|
2002
1998
|
},
|
|
2003
|
-
onWheel: (
|
|
2004
|
-
|
|
1999
|
+
onWheel: (W) => {
|
|
2000
|
+
ye.dispatchEvent(new WheelEvent(W.type, W));
|
|
2005
2001
|
},
|
|
2006
|
-
data:
|
|
2002
|
+
data: K,
|
|
2007
2003
|
unitId: I
|
|
2008
2004
|
};
|
|
2009
|
-
e.eventPassThrough && (
|
|
2010
|
-
...
|
|
2011
|
-
onPointerDown: (
|
|
2012
|
-
|
|
2005
|
+
e.eventPassThrough && (Ve = {
|
|
2006
|
+
...Ve,
|
|
2007
|
+
onPointerDown: (W) => {
|
|
2008
|
+
ye.dispatchEvent(new PointerEvent(W.type, W));
|
|
2013
2009
|
},
|
|
2014
|
-
onPointerMove: (
|
|
2015
|
-
|
|
2010
|
+
onPointerMove: (W) => {
|
|
2011
|
+
ye.dispatchEvent(new PointerEvent(W.type, W));
|
|
2016
2012
|
},
|
|
2017
|
-
onPointerUp: (
|
|
2018
|
-
|
|
2013
|
+
onPointerUp: (W) => {
|
|
2014
|
+
ye.dispatchEvent(new PointerEvent(W.type, W));
|
|
2019
2015
|
}
|
|
2020
|
-
}), this._canvasFloatDomService.addFloatDom(
|
|
2021
|
-
var
|
|
2022
|
-
const
|
|
2023
|
-
startX:
|
|
2024
|
-
startY:
|
|
2025
|
-
endX:
|
|
2026
|
-
endY:
|
|
2027
|
-
width: (
|
|
2028
|
-
height: (
|
|
2016
|
+
}), this._canvasFloatDomService.addFloatDom(Ve), this.disposeWithMe(f.subscribe((W) => {
|
|
2017
|
+
var hn, gn, fn, mn;
|
|
2018
|
+
const un = Ct({
|
|
2019
|
+
startX: W.startX,
|
|
2020
|
+
startY: W.startY,
|
|
2021
|
+
endX: W.endX,
|
|
2022
|
+
endY: W.endY,
|
|
2023
|
+
width: (hn = n.width) != null ? hn : W.width,
|
|
2024
|
+
height: (gn = n.height) != null ? gn : W.height,
|
|
2029
2025
|
absolute: {
|
|
2030
2026
|
left: p.absolute.left,
|
|
2031
2027
|
top: p.absolute.top
|
|
2032
2028
|
}
|
|
2033
|
-
}, n),
|
|
2034
|
-
left:
|
|
2035
|
-
top:
|
|
2036
|
-
width: (
|
|
2037
|
-
height: (
|
|
2029
|
+
}, n), Ur = Ie({ unitId: I, subUnitId: E, drawingId: T }), Pr = new Ne(Ur, {
|
|
2030
|
+
left: un.startX,
|
|
2031
|
+
top: un.startY,
|
|
2032
|
+
width: (fn = n.width) != null ? fn : W.width,
|
|
2033
|
+
height: (mn = n.height) != null ? mn : W.height,
|
|
2038
2034
|
zIndex: this._drawingManagerService.getDrawingOrder(I, E).length - 1
|
|
2039
|
-
}),
|
|
2040
|
-
|
|
2035
|
+
}), Ar = fe(Pr, k.renderUnit.scene, H.skeleton, M.worksheet, ge);
|
|
2036
|
+
Ue.next(Ar);
|
|
2041
2037
|
}));
|
|
2042
|
-
const
|
|
2043
|
-
|
|
2044
|
-
|
|
2038
|
+
const He = (y = this._renderManagerService.getRenderById(I)) == null ? void 0 : y.with(V);
|
|
2039
|
+
He == null || He.currentSkeleton$.subscribe((W) => {
|
|
2040
|
+
W && H.sheetId !== W.sheetId && this._removeDom(m, !0);
|
|
2045
2041
|
});
|
|
2046
|
-
const
|
|
2047
|
-
const
|
|
2048
|
-
|
|
2049
|
-
|
|
2042
|
+
const mt = ue.onTransformChange$.subscribeEvent(() => {
|
|
2043
|
+
const W = fe(ue, k.renderUnit.scene, H.skeleton, M.worksheet, ge);
|
|
2044
|
+
Ue.next(
|
|
2045
|
+
W
|
|
2050
2046
|
);
|
|
2051
2047
|
});
|
|
2052
|
-
|
|
2048
|
+
he.add(() => {
|
|
2053
2049
|
this._canvasFloatDomService.removeFloatDom(T);
|
|
2054
|
-
}),
|
|
2050
|
+
}), mt && he.add(mt), this._domLayerInfoMap.set(T, ge);
|
|
2055
2051
|
}
|
|
2056
2052
|
return {
|
|
2057
|
-
id:
|
|
2053
|
+
id: m,
|
|
2058
2054
|
dispose: () => {
|
|
2059
|
-
this._removeDom(
|
|
2055
|
+
this._removeDom(m, !0);
|
|
2060
2056
|
}
|
|
2061
2057
|
};
|
|
2062
2058
|
}
|
|
@@ -2073,57 +2069,57 @@ let rt = class extends ie {
|
|
|
2073
2069
|
if (!this._getSceneAndTransformerByDrawingSearch(o)) return;
|
|
2074
2070
|
const u = this._renderManagerService.getRenderById(o);
|
|
2075
2071
|
if (!u) return;
|
|
2076
|
-
const
|
|
2077
|
-
if (!
|
|
2078
|
-
const { componentKey: l, data: g, allowTransform: h = !0 } = e,
|
|
2072
|
+
const c = (b = this._renderManagerService.getRenderById(o)) == null ? void 0 : b.with(V).getWorksheetSkeleton(a);
|
|
2073
|
+
if (!c) return;
|
|
2074
|
+
const { componentKey: l, data: g, allowTransform: h = !0 } = e, m = r != null ? r : bt(), { position: p, position$: f } = this._createRangePositionObserver({
|
|
2079
2075
|
startRow: 0,
|
|
2080
2076
|
endRow: 0,
|
|
2081
2077
|
startColumn: t,
|
|
2082
2078
|
endColumn: t
|
|
2083
|
-
}, u,
|
|
2084
|
-
if (
|
|
2079
|
+
}, u, c.skeleton), _ = p;
|
|
2080
|
+
if (_.startY = 0, this._getPosition(p, o) == null)
|
|
2085
2081
|
return;
|
|
2086
2082
|
const C = {
|
|
2087
2083
|
unitId: o,
|
|
2088
2084
|
subUnitId: a,
|
|
2089
|
-
drawingId:
|
|
2090
|
-
drawingType: e.type ||
|
|
2085
|
+
drawingId: m,
|
|
2086
|
+
drawingType: e.type || j.DRAWING_DOM,
|
|
2091
2087
|
componentKey: l,
|
|
2092
2088
|
transform: {
|
|
2093
|
-
left:
|
|
2094
|
-
top:
|
|
2095
|
-
width:
|
|
2096
|
-
height:
|
|
2089
|
+
left: _.startX,
|
|
2090
|
+
top: _.startY,
|
|
2091
|
+
width: _.width,
|
|
2092
|
+
height: _.height
|
|
2097
2093
|
},
|
|
2098
2094
|
data: g,
|
|
2099
2095
|
allowTransform: h
|
|
2100
2096
|
};
|
|
2101
2097
|
{
|
|
2102
|
-
const { unitId:
|
|
2103
|
-
if (!
|
|
2098
|
+
const { unitId: w, subUnitId: y, drawingId: I } = C, E = ae(this._univerInstanceService, { unitId: w, subUnitId: y }), T = C, M = this._univerInstanceService.getUnit(w, F.UNIVER_SHEET);
|
|
2099
|
+
if (!M)
|
|
2104
2100
|
return;
|
|
2105
|
-
const R =
|
|
2101
|
+
const R = M.getActiveSheet().getSheetId();
|
|
2106
2102
|
if (!T || !E)
|
|
2107
2103
|
return;
|
|
2108
|
-
const N = (v = this._renderManagerService.getRenderById(
|
|
2104
|
+
const N = (v = this._renderManagerService.getRenderById(w)) == null ? void 0 : v.with(V);
|
|
2109
2105
|
if (!N)
|
|
2110
2106
|
return;
|
|
2111
|
-
const
|
|
2112
|
-
if (!
|
|
2107
|
+
const B = N.getWorksheetSkeleton(y);
|
|
2108
|
+
if (!B)
|
|
2113
2109
|
return;
|
|
2114
|
-
const { transform: Q, data:
|
|
2115
|
-
if (
|
|
2110
|
+
const { transform: Q, data: H } = T, X = this._getSceneAndTransformerByDrawingSearch(w);
|
|
2111
|
+
if (X == null)
|
|
2116
2112
|
return;
|
|
2117
|
-
const { scene: Y, canvas:
|
|
2118
|
-
if (Q == null || R !==
|
|
2113
|
+
const { scene: Y, canvas: K } = X;
|
|
2114
|
+
if (Q == null || R !== y)
|
|
2119
2115
|
return;
|
|
2120
|
-
const { left: k, top: ce, width:
|
|
2121
|
-
if (
|
|
2122
|
-
|
|
2116
|
+
const { left: k, top: ce, width: ye, height: ot, angle: at, flipX: ct, flipY: dt, skewX: $t, skewY: xt } = Q, lt = Ie({ unitId: w, subUnitId: y, drawingId: I }), ut = Y.getObject(lt);
|
|
2117
|
+
if (ut != null) {
|
|
2118
|
+
ut.transformByState({ left: k, top: ce, width: ye, height: ot, angle: at, flipX: ct, flipY: dt, skewX: $t, skewY: xt });
|
|
2123
2119
|
return;
|
|
2124
2120
|
}
|
|
2125
|
-
const
|
|
2126
|
-
startX:
|
|
2121
|
+
const Ee = Ct({
|
|
2122
|
+
startX: _.startX,
|
|
2127
2123
|
startY: 0,
|
|
2128
2124
|
endX: p.endX,
|
|
2129
2125
|
endY: p.endY,
|
|
@@ -2133,34 +2129,34 @@ let rt = class extends ie {
|
|
|
2133
2129
|
left: p.absolute.left,
|
|
2134
2130
|
top: p.absolute.top
|
|
2135
2131
|
}
|
|
2136
|
-
}, n),
|
|
2137
|
-
left:
|
|
2138
|
-
top:
|
|
2139
|
-
width:
|
|
2140
|
-
height:
|
|
2141
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2142
|
-
},
|
|
2143
|
-
Y.addObject(
|
|
2144
|
-
const ee = new
|
|
2132
|
+
}, n), ht = {
|
|
2133
|
+
left: Ee.startX,
|
|
2134
|
+
top: Ee.startY,
|
|
2135
|
+
width: Ee.width,
|
|
2136
|
+
height: Ee.height,
|
|
2137
|
+
zIndex: this._drawingManagerService.getDrawingOrder(w, y).length - 1
|
|
2138
|
+
}, le = new Ne(lt, ht);
|
|
2139
|
+
Y.addObject(le, Yt), T.allowTransform !== !1 && Y.attachTransformerTo(le);
|
|
2140
|
+
const ee = new wt(), Te = Y.getMainViewport(), ue = {
|
|
2145
2141
|
top: 0,
|
|
2146
2142
|
//viewMain.top,
|
|
2147
|
-
left:
|
|
2148
|
-
bottom:
|
|
2149
|
-
right:
|
|
2150
|
-
},
|
|
2143
|
+
left: Te.left,
|
|
2144
|
+
bottom: Te.bottom,
|
|
2145
|
+
right: Te.right
|
|
2146
|
+
}, he = {
|
|
2151
2147
|
dispose: ee,
|
|
2152
|
-
rect:
|
|
2148
|
+
rect: le,
|
|
2153
2149
|
// position$,
|
|
2154
|
-
unitId:
|
|
2155
|
-
subUnitId:
|
|
2156
|
-
boundsOfViewArea:
|
|
2150
|
+
unitId: w,
|
|
2151
|
+
subUnitId: y,
|
|
2152
|
+
boundsOfViewArea: ue,
|
|
2157
2153
|
domAnchor: n,
|
|
2158
2154
|
scrollDirectionResponse: "HORIZONTAL"
|
|
2159
2155
|
/* HORIZONTAL */
|
|
2160
|
-
},
|
|
2161
|
-
|
|
2162
|
-
let
|
|
2163
|
-
position$:
|
|
2156
|
+
}, gt = fe(le, X.renderUnit.scene, B.skeleton, E.worksheet, he), Oe = new je(gt);
|
|
2157
|
+
he.position$ = Oe;
|
|
2158
|
+
let Xe = {
|
|
2159
|
+
position$: Oe,
|
|
2164
2160
|
id: I,
|
|
2165
2161
|
componentKey: T.componentKey,
|
|
2166
2162
|
onPointerDown: () => {
|
|
@@ -2170,31 +2166,31 @@ let rt = class extends ie {
|
|
|
2170
2166
|
onPointerUp: () => {
|
|
2171
2167
|
},
|
|
2172
2168
|
onWheel: ($) => {
|
|
2173
|
-
|
|
2169
|
+
K.dispatchEvent(new WheelEvent($.type, $));
|
|
2174
2170
|
},
|
|
2175
|
-
data:
|
|
2176
|
-
unitId:
|
|
2171
|
+
data: H,
|
|
2172
|
+
unitId: w
|
|
2177
2173
|
};
|
|
2178
|
-
e.eventPassThrough && (
|
|
2179
|
-
...
|
|
2174
|
+
e.eventPassThrough && (Xe = {
|
|
2175
|
+
...Xe,
|
|
2180
2176
|
onPointerDown: ($) => {
|
|
2181
|
-
|
|
2177
|
+
K.dispatchEvent(new PointerEvent($.type, $));
|
|
2182
2178
|
},
|
|
2183
2179
|
onPointerMove: ($) => {
|
|
2184
|
-
|
|
2180
|
+
K.dispatchEvent(new PointerEvent($.type, $));
|
|
2185
2181
|
},
|
|
2186
2182
|
onPointerUp: ($) => {
|
|
2187
|
-
|
|
2183
|
+
K.dispatchEvent(new PointerEvent($.type, $));
|
|
2188
2184
|
}
|
|
2189
|
-
}), this._canvasFloatDomService.addFloatDom(
|
|
2190
|
-
const
|
|
2191
|
-
const $ =
|
|
2192
|
-
|
|
2185
|
+
}), this._canvasFloatDomService.addFloatDom(Xe);
|
|
2186
|
+
const ft = le.onTransformChange$.subscribeEvent(() => {
|
|
2187
|
+
const $ = fe(le, X.renderUnit.scene, B.skeleton, E.worksheet, he);
|
|
2188
|
+
Oe.next(
|
|
2193
2189
|
$
|
|
2194
2190
|
);
|
|
2195
2191
|
});
|
|
2196
|
-
this.disposeWithMe(
|
|
2197
|
-
const
|
|
2192
|
+
this.disposeWithMe(f.subscribe(($) => {
|
|
2193
|
+
const Ue = Ct({
|
|
2198
2194
|
startX: $.startX,
|
|
2199
2195
|
startY: 0,
|
|
2200
2196
|
endX: $.endX,
|
|
@@ -2205,26 +2201,26 @@ let rt = class extends ie {
|
|
|
2205
2201
|
left: p.absolute.left,
|
|
2206
2202
|
top: p.absolute.top
|
|
2207
2203
|
}
|
|
2208
|
-
}, n),
|
|
2209
|
-
left:
|
|
2204
|
+
}, n), Ve = Ie({ unitId: w, subUnitId: y, drawingId: I }), He = new Ne(Ve, {
|
|
2205
|
+
left: Ue.startX,
|
|
2210
2206
|
top: 0,
|
|
2211
2207
|
width: n.width,
|
|
2212
2208
|
height: n.height,
|
|
2213
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2214
|
-
}),
|
|
2215
|
-
|
|
2209
|
+
zIndex: this._drawingManagerService.getDrawingOrder(w, y).length - 1
|
|
2210
|
+
}), mt = fe(He, X.renderUnit.scene, B.skeleton, E.worksheet, he);
|
|
2211
|
+
Oe.next(mt);
|
|
2216
2212
|
}));
|
|
2217
|
-
const
|
|
2218
|
-
|
|
2219
|
-
$ &&
|
|
2213
|
+
const ge = (D = this._renderManagerService.getRenderById(w)) == null ? void 0 : D.with(V);
|
|
2214
|
+
ge == null || ge.currentSkeleton$.subscribe(($) => {
|
|
2215
|
+
$ && c.sheetId !== $.sheetId && this._removeDom(m, !0);
|
|
2220
2216
|
}), ee.add(() => {
|
|
2221
2217
|
this._canvasFloatDomService.removeFloatDom(I);
|
|
2222
|
-
}),
|
|
2218
|
+
}), ft && ee.add(ft), this._domLayerInfoMap.set(I, he);
|
|
2223
2219
|
}
|
|
2224
2220
|
return {
|
|
2225
|
-
id:
|
|
2221
|
+
id: m,
|
|
2226
2222
|
dispose: () => {
|
|
2227
|
-
this._removeDom(
|
|
2223
|
+
this._removeDom(m, !0);
|
|
2228
2224
|
}
|
|
2229
2225
|
};
|
|
2230
2226
|
}
|
|
@@ -2241,51 +2237,51 @@ let rt = class extends ie {
|
|
|
2241
2237
|
// eslint-disable-next-line max-lines-per-function
|
|
2242
2238
|
_createRangePositionObserver(t, e, n) {
|
|
2243
2239
|
let { startRow: r, startColumn: s } = t;
|
|
2244
|
-
const o =
|
|
2245
|
-
const
|
|
2246
|
-
a.next(
|
|
2247
|
-
}, l = new
|
|
2248
|
-
l.add(e.engine.clientRect$.subscribe(() =>
|
|
2249
|
-
if (
|
|
2250
|
-
|
|
2240
|
+
const o = Je(r, s, n), a = new je(o), d = Je(t.endRow, t.endColumn, n), u = new je(d), c = () => {
|
|
2241
|
+
const f = Je(r, s, n), _ = Je(t.endRow, t.endColumn, n);
|
|
2242
|
+
a.next(f), u.next(_);
|
|
2243
|
+
}, l = new wt();
|
|
2244
|
+
l.add(e.engine.clientRect$.subscribe(() => c())), l.add(this._commandService.onCommandExecuted((f) => {
|
|
2245
|
+
if (f.id === Hi.id && f.params.rowsAutoHeightInfo.findIndex((S) => S.row === r) > -1) {
|
|
2246
|
+
c();
|
|
2251
2247
|
return;
|
|
2252
2248
|
}
|
|
2253
|
-
(
|
|
2249
|
+
(zi.indexOf(f.id) > -1 || f.id === Ei.id || f.id === On.id) && c();
|
|
2254
2250
|
}));
|
|
2255
|
-
const g = (
|
|
2256
|
-
r =
|
|
2251
|
+
const g = (f, _) => {
|
|
2252
|
+
r = f, s = _, c();
|
|
2257
2253
|
}, h = () => ({
|
|
2258
2254
|
rotate: 0,
|
|
2259
|
-
width:
|
|
2260
|
-
height:
|
|
2255
|
+
width: d.right - o.left,
|
|
2256
|
+
height: d.bottom - o.top,
|
|
2261
2257
|
absolute: {
|
|
2262
2258
|
left: !0,
|
|
2263
2259
|
top: !0
|
|
2264
2260
|
},
|
|
2265
2261
|
startX: o.left,
|
|
2266
2262
|
startY: o.top,
|
|
2267
|
-
endX:
|
|
2268
|
-
endY:
|
|
2269
|
-
}),
|
|
2270
|
-
|
|
2271
|
-
const
|
|
2263
|
+
endX: d.right,
|
|
2264
|
+
endY: d.bottom
|
|
2265
|
+
}), m = a.pipe(
|
|
2266
|
+
Me((f) => {
|
|
2267
|
+
const _ = Je(t.endRow, t.endColumn, n);
|
|
2272
2268
|
return {
|
|
2273
2269
|
rotate: 0,
|
|
2274
|
-
width:
|
|
2275
|
-
height:
|
|
2270
|
+
width: _.right - f.left,
|
|
2271
|
+
height: _.bottom - f.top,
|
|
2276
2272
|
absolute: {
|
|
2277
2273
|
left: !0,
|
|
2278
2274
|
top: !0
|
|
2279
2275
|
},
|
|
2280
|
-
startX:
|
|
2281
|
-
startY:
|
|
2282
|
-
endX:
|
|
2283
|
-
endY:
|
|
2276
|
+
startX: f.left,
|
|
2277
|
+
startY: f.top,
|
|
2278
|
+
endX: _.right,
|
|
2279
|
+
endY: _.bottom
|
|
2284
2280
|
};
|
|
2285
2281
|
})
|
|
2286
2282
|
), p = h();
|
|
2287
2283
|
return {
|
|
2288
|
-
position$:
|
|
2284
|
+
position$: m,
|
|
2289
2285
|
position: p,
|
|
2290
2286
|
updateRowCol: g,
|
|
2291
2287
|
topLeftPos$: a,
|
|
@@ -2294,16 +2290,16 @@ let rt = class extends ie {
|
|
|
2294
2290
|
};
|
|
2295
2291
|
}
|
|
2296
2292
|
};
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
],
|
|
2306
|
-
function
|
|
2293
|
+
tt = Ns([
|
|
2294
|
+
De(0, A(q)),
|
|
2295
|
+
De(1, Se),
|
|
2296
|
+
De(2, A(G)),
|
|
2297
|
+
De(3, se),
|
|
2298
|
+
De(4, A(ki)),
|
|
2299
|
+
De(5, oe),
|
|
2300
|
+
De(6, A(Yr))
|
|
2301
|
+
], tt);
|
|
2302
|
+
function Je(i, t, e) {
|
|
2307
2303
|
const n = e.getCellWithCoordByIndex(i, t), r = n.isMergedMainCell ? n.mergeInfo : n;
|
|
2308
2304
|
return {
|
|
2309
2305
|
left: r.startX,
|
|
@@ -2312,27 +2308,27 @@ function et(i, t, e) {
|
|
|
2312
2308
|
bottom: r.endY
|
|
2313
2309
|
};
|
|
2314
2310
|
}
|
|
2315
|
-
function
|
|
2316
|
-
var u,
|
|
2311
|
+
function Ct(i, t, e) {
|
|
2312
|
+
var u, c;
|
|
2317
2313
|
e = e != null ? e : 1;
|
|
2318
|
-
const n = i.endX - i.startX, r = i.endY - i.startY, s = (u = t == null ? void 0 : t.width) != null ? u : n, o = (
|
|
2319
|
-
let a = 0,
|
|
2314
|
+
const n = i.endX - i.startX, r = i.endY - i.startY, s = (u = t == null ? void 0 : t.width) != null ? u : n, o = (c = t == null ? void 0 : t.height) != null ? c : r;
|
|
2315
|
+
let a = 0, d = 0;
|
|
2320
2316
|
if (t) {
|
|
2321
2317
|
if (t.horizonOffsetAlign === "right") {
|
|
2322
|
-
const l =
|
|
2318
|
+
const l = Dt(t.marginX, n * e);
|
|
2323
2319
|
a = i.endX - l - s;
|
|
2324
2320
|
} else
|
|
2325
|
-
a = i.startX +
|
|
2321
|
+
a = i.startX + Dt(t.marginX, n);
|
|
2326
2322
|
if (t.verticalOffsetAlign === "bottom") {
|
|
2327
|
-
const l =
|
|
2328
|
-
|
|
2323
|
+
const l = Dt(t.marginY, r * e);
|
|
2324
|
+
d = i.endY - l - o;
|
|
2329
2325
|
} else
|
|
2330
|
-
|
|
2326
|
+
d = i.startY + Dt(t.marginY, r);
|
|
2331
2327
|
}
|
|
2332
2328
|
return {
|
|
2333
2329
|
rotate: 0,
|
|
2334
2330
|
startX: a,
|
|
2335
|
-
startY:
|
|
2331
|
+
startY: d,
|
|
2336
2332
|
endX: i.endX,
|
|
2337
2333
|
endY: i.endY,
|
|
2338
2334
|
width: s,
|
|
@@ -2343,102 +2339,37 @@ function yt(i, t, e) {
|
|
|
2343
2339
|
}
|
|
2344
2340
|
};
|
|
2345
2341
|
}
|
|
2346
|
-
function
|
|
2342
|
+
function Dt(i, t) {
|
|
2347
2343
|
if (i === void 0) return 0;
|
|
2348
2344
|
if (typeof i == "number") return i;
|
|
2349
2345
|
const e = Number.parseFloat(i);
|
|
2350
2346
|
return t * e / 100;
|
|
2351
2347
|
}
|
|
2352
|
-
const
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
data: t.data,
|
|
2356
|
-
...t.props
|
|
2357
|
-
}), [t.data, t.props]), g = {
|
|
2358
|
-
width: `${n.width - 4}px`,
|
|
2359
|
-
height: `${n.height - 4}px`,
|
|
2360
|
-
left: `${n.absolute.left ? 0 : "auto"}`,
|
|
2361
|
-
top: `${n.absolute.top ? 0 : "auto"}`,
|
|
2362
|
-
right: `${n.absolute.left ? "auto" : 0}`,
|
|
2363
|
-
bottom: `${n.absolute.top ? "auto" : 0}`
|
|
2364
|
-
};
|
|
2365
|
-
a.current = `rotate(${n.rotate}deg)`, c.current = n.startY, u.current = n.startX;
|
|
2366
|
-
const h = r.getUnit(t.unitId), f = sn(() => d ? /* @__PURE__ */ X(
|
|
2367
|
-
d,
|
|
2368
|
-
{
|
|
2369
|
-
...l,
|
|
2370
|
-
unitId: t.unitId,
|
|
2371
|
-
unit: h,
|
|
2372
|
-
floatDomId: t.id,
|
|
2373
|
-
context: {
|
|
2374
|
-
root: o
|
|
2375
|
-
}
|
|
2376
|
-
}
|
|
2377
|
-
) : null, [d, l]);
|
|
2378
|
-
return n ? /* @__PURE__ */ X(
|
|
2379
|
-
"div",
|
|
2380
|
-
{
|
|
2381
|
-
ref: s,
|
|
2382
|
-
className: "univer-z-10",
|
|
2383
|
-
style: {
|
|
2384
|
-
position: "absolute",
|
|
2385
|
-
top: c.current,
|
|
2386
|
-
left: u.current,
|
|
2387
|
-
width: Math.max(n.endX - n.startX - 2, 0),
|
|
2388
|
-
height: Math.max(n.endY - n.startY - 2, 0),
|
|
2389
|
-
transform: a.current,
|
|
2390
|
-
overflow: "hidden",
|
|
2391
|
-
transformOrigin: "center center"
|
|
2392
|
-
},
|
|
2393
|
-
onPointerMove: (w) => {
|
|
2394
|
-
t.onPointerMove(w.nativeEvent);
|
|
2395
|
-
},
|
|
2396
|
-
onPointerDown: (w) => {
|
|
2397
|
-
t.onPointerDown(w.nativeEvent);
|
|
2398
|
-
},
|
|
2399
|
-
onPointerUp: (w) => {
|
|
2400
|
-
t.onPointerUp(w.nativeEvent);
|
|
2401
|
-
},
|
|
2402
|
-
onWheel: (w) => {
|
|
2403
|
-
t.onWheel(w.nativeEvent);
|
|
2404
|
-
},
|
|
2405
|
-
children: /* @__PURE__ */ X(
|
|
2406
|
-
"div",
|
|
2407
|
-
{
|
|
2408
|
-
id: e,
|
|
2409
|
-
ref: o,
|
|
2410
|
-
className: "univer-overflow-hidden",
|
|
2411
|
-
style: { position: "absolute", ...g },
|
|
2412
|
-
children: f
|
|
2413
|
-
}
|
|
2414
|
-
)
|
|
2415
|
-
}
|
|
2416
|
-
) : null;
|
|
2417
|
-
}), Hs = (i) => {
|
|
2418
|
-
const { floatDomInfos: t, scene: e, skeleton: n, worksheet: r } = i, s = sn(() => t.map((o) => {
|
|
2419
|
-
const { width: a, height: c, angle: u, left: d, top: l } = o.transform, g = Tr(
|
|
2348
|
+
const ks = (i) => {
|
|
2349
|
+
const { floatDomInfos: t, scene: e, skeleton: n, worksheet: r } = i, s = ss(() => t.map((o) => {
|
|
2350
|
+
const { width: a, height: d, angle: u, left: c, top: l } = o.transform, g = Dr(
|
|
2420
2351
|
{
|
|
2421
|
-
left:
|
|
2422
|
-
right: (
|
|
2352
|
+
left: c != null ? c : 0,
|
|
2353
|
+
right: (c != null ? c : 0) + (a != null ? a : 0),
|
|
2423
2354
|
top: l != null ? l : 0,
|
|
2424
|
-
bottom: (l != null ? l : 0) + (
|
|
2355
|
+
bottom: (l != null ? l : 0) + (d != null ? d : 0)
|
|
2425
2356
|
},
|
|
2426
2357
|
e,
|
|
2427
2358
|
n,
|
|
2428
2359
|
r,
|
|
2429
2360
|
void 0,
|
|
2430
2361
|
!0
|
|
2431
|
-
), { scaleX: h, scaleY:
|
|
2362
|
+
), { scaleX: h, scaleY: m } = e.getAncestorScale(), p = {
|
|
2432
2363
|
startX: g.left,
|
|
2433
2364
|
endX: g.right,
|
|
2434
2365
|
startY: g.top,
|
|
2435
2366
|
endY: g.bottom,
|
|
2436
2367
|
rotate: u,
|
|
2437
2368
|
width: a * h,
|
|
2438
|
-
height:
|
|
2369
|
+
height: d * m,
|
|
2439
2370
|
absolute: g.absolute
|
|
2440
|
-
},
|
|
2441
|
-
position$: new
|
|
2371
|
+
}, f = {
|
|
2372
|
+
position$: new je(p),
|
|
2442
2373
|
position: p,
|
|
2443
2374
|
id: o.drawingId,
|
|
2444
2375
|
componentKey: o.componentKey,
|
|
@@ -2450,18 +2381,19 @@ const Vs = as((i) => {
|
|
|
2450
2381
|
},
|
|
2451
2382
|
onWheel: () => {
|
|
2452
2383
|
},
|
|
2453
|
-
unitId: o.unitId
|
|
2384
|
+
unitId: o.unitId,
|
|
2385
|
+
data: o.data
|
|
2454
2386
|
};
|
|
2455
|
-
return [o.drawingId,
|
|
2387
|
+
return [o.drawingId, f];
|
|
2456
2388
|
}), [t, e, n, r]);
|
|
2457
|
-
return /* @__PURE__ */
|
|
2389
|
+
return /* @__PURE__ */ Z("div", { style: { position: "absolute", top: 0, left: 0 }, children: s.map(([o, a]) => /* @__PURE__ */ Z(Wi, { layer: a, id: o, position: a.position }, o)) });
|
|
2458
2390
|
};
|
|
2459
|
-
var
|
|
2460
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2391
|
+
var Ws = Object.getOwnPropertyDescriptor, js = (i, t, e, n) => {
|
|
2392
|
+
for (var r = n > 1 ? void 0 : n ? Ws(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
2461
2393
|
(o = i[s]) && (r = o(r) || r);
|
|
2462
2394
|
return r;
|
|
2463
|
-
},
|
|
2464
|
-
let
|
|
2395
|
+
}, be = (i, t) => (e, n) => t(e, n, i);
|
|
2396
|
+
let Ut = class extends ie {
|
|
2465
2397
|
constructor(i, t, e, n, r, s, o) {
|
|
2466
2398
|
super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = t, this._drawingManagerService = e, this._renderManagerService = n, this._canvasFloatDomManagerService = r, this._componetManager = s, this._injector = o, this._initPrinting(), this._initPrintingDom();
|
|
2467
2399
|
}
|
|
@@ -2472,9 +2404,9 @@ let Bt = class extends ie {
|
|
|
2472
2404
|
{
|
|
2473
2405
|
handler: (i, t, e) => {
|
|
2474
2406
|
const { unitId: n, scene: r, subUnitId: s } = t, o = this._drawingManagerService.getDrawingDataForUnit(n), a = o == null ? void 0 : o[s];
|
|
2475
|
-
return a && a.order.forEach((
|
|
2476
|
-
const u = a.data[
|
|
2477
|
-
u.drawingType !==
|
|
2407
|
+
return a && a.order.forEach((d) => {
|
|
2408
|
+
const u = a.data[d];
|
|
2409
|
+
u.drawingType !== j.DRAWING_CHART && u.drawingType !== j.DRAWING_DOM && this._drawingRenderService.renderDrawing(u, r);
|
|
2478
2410
|
}), e();
|
|
2479
2411
|
}
|
|
2480
2412
|
}
|
|
@@ -2487,17 +2419,17 @@ let Bt = class extends ie {
|
|
|
2487
2419
|
const { unitId: n, subUnitId: r } = t, s = this._renderManagerService.getRenderById(n);
|
|
2488
2420
|
if (!s)
|
|
2489
2421
|
return e(i);
|
|
2490
|
-
const o = s.with(
|
|
2422
|
+
const o = s.with(V).getSkeletonParam(r);
|
|
2491
2423
|
if (!o)
|
|
2492
2424
|
return e(i);
|
|
2493
|
-
const a = this._drawingManagerService.getDrawingDataForUnit(n),
|
|
2494
|
-
if (!
|
|
2425
|
+
const a = this._drawingManagerService.getDrawingDataForUnit(n), d = a == null ? void 0 : a[t.subUnitId];
|
|
2426
|
+
if (!d)
|
|
2495
2427
|
return e(i);
|
|
2496
|
-
const { scaleX: u, scaleY:
|
|
2428
|
+
const { scaleX: u, scaleY: c } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, g = d.order.map((h) => d.data[h]);
|
|
2497
2429
|
return g.length ? (g.forEach((h) => {
|
|
2498
|
-
if (!h.groupId && h.transform &&
|
|
2499
|
-
const
|
|
2500
|
-
|
|
2430
|
+
if (!h.groupId && h.transform && Re.isDefine(h.transform.left) && Re.isDefine(h.transform.top) && Re.isDefine(h.transform.width) && Re.isDefine(h.transform.height)) {
|
|
2431
|
+
const m = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, c, { x: 0, y: 0 }), p = o.skeleton.getCellIndexByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, u, c, { x: 0, y: 0 });
|
|
2432
|
+
m.column < l.startColumn && (l.startColumn = m.column), m.row < l.startRow && (l.startRow = m.row), l.endRow < p.row && (l.endRow = p.row), l.endColumn < p.column && (l.endColumn = p.column);
|
|
2501
2433
|
}
|
|
2502
2434
|
}), e(l)) : e(i);
|
|
2503
2435
|
}
|
|
@@ -2514,20 +2446,26 @@ let Bt = class extends ie {
|
|
|
2514
2446
|
const { unitId: n, subUnitId: r } = t, s = this._drawingManagerService.getDrawingDataForUnit(n), o = s == null ? void 0 : s[r];
|
|
2515
2447
|
if (o) {
|
|
2516
2448
|
const a = o.order.map((u) => {
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2449
|
+
const c = o.data[u];
|
|
2450
|
+
if (c.drawingType === j.DRAWING_CHART)
|
|
2451
|
+
return {
|
|
2452
|
+
...c,
|
|
2453
|
+
componentKey: this._componetManager.get(Vr)
|
|
2454
|
+
};
|
|
2455
|
+
if (c.drawingType === j.DRAWING_DOM) {
|
|
2456
|
+
const l = this._sheetPrintInterceptorService.getPrintComponent(c.componentKey);
|
|
2457
|
+
return {
|
|
2458
|
+
...c,
|
|
2459
|
+
componentKey: this._componetManager.get(l || c.componentKey)
|
|
2460
|
+
};
|
|
2461
|
+
}
|
|
2462
|
+
return null;
|
|
2463
|
+
}).filter(Boolean), d = ji(ks, this._injector);
|
|
2464
|
+
return wi(
|
|
2465
|
+
/* @__PURE__ */ Z(d, { floatDomInfos: a, scene: t.scene, skeleton: t.skeleton, worksheet: t.worksheet }),
|
|
2528
2466
|
t.root
|
|
2529
2467
|
), i == null || i.add(() => {
|
|
2530
|
-
|
|
2468
|
+
_i(t.root);
|
|
2531
2469
|
}), e(i);
|
|
2532
2470
|
}
|
|
2533
2471
|
}
|
|
@@ -2536,22 +2474,31 @@ let Bt = class extends ie {
|
|
|
2536
2474
|
);
|
|
2537
2475
|
}
|
|
2538
2476
|
};
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
],
|
|
2548
|
-
var
|
|
2549
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2477
|
+
Ut = js([
|
|
2478
|
+
be(0, A(Ti)),
|
|
2479
|
+
be(1, A(Gn)),
|
|
2480
|
+
be(2, se),
|
|
2481
|
+
be(3, q),
|
|
2482
|
+
be(4, A(tt)),
|
|
2483
|
+
be(5, A(zn)),
|
|
2484
|
+
be(6, A(Ye))
|
|
2485
|
+
], Ut);
|
|
2486
|
+
var Bs = Object.getOwnPropertyDescriptor, $s = (i, t, e, n) => {
|
|
2487
|
+
for (var r = n > 1 ? void 0 : n ? Bs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
2550
2488
|
(o = i[s]) && (r = o(r) || r);
|
|
2551
2489
|
return r;
|
|
2552
|
-
},
|
|
2553
|
-
const
|
|
2490
|
+
}, pe = (i, t) => (e, n) => t(e, n, i);
|
|
2491
|
+
const xs = [
|
|
2492
|
+
Kn.id,
|
|
2493
|
+
Zn.id,
|
|
2494
|
+
Jn.id,
|
|
2495
|
+
qn.id,
|
|
2496
|
+
Qn.id,
|
|
2497
|
+
er.id,
|
|
2498
|
+
tr.id,
|
|
2554
2499
|
nr.id,
|
|
2500
|
+
Jt.id,
|
|
2501
|
+
qt.id,
|
|
2555
2502
|
rr.id,
|
|
2556
2503
|
ir.id,
|
|
2557
2504
|
sr.id,
|
|
@@ -2559,84 +2506,75 @@ const qs = [
|
|
|
2559
2506
|
ar.id,
|
|
2560
2507
|
cr.id,
|
|
2561
2508
|
dr.id,
|
|
2562
|
-
nn.id,
|
|
2563
|
-
rn.id,
|
|
2564
2509
|
lr.id,
|
|
2565
|
-
ur.id
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
pr.id,
|
|
2571
|
-
wr.id,
|
|
2572
|
-
_r.id
|
|
2573
|
-
], Qs = [
|
|
2510
|
+
ur.id
|
|
2511
|
+
], Fs = [
|
|
2512
|
+
Ki.id,
|
|
2513
|
+
Zi.id,
|
|
2514
|
+
Ji.id,
|
|
2574
2515
|
qi.id,
|
|
2575
2516
|
Qi.id,
|
|
2576
|
-
es.id
|
|
2577
|
-
ts.id,
|
|
2578
|
-
ns.id,
|
|
2579
|
-
rs.id
|
|
2517
|
+
es.id
|
|
2580
2518
|
];
|
|
2581
|
-
let
|
|
2582
|
-
constructor(i, t, e, n, r, s, o, a,
|
|
2583
|
-
super(), this._context = i, this._renderManagerService = t, this._commandService = e, this._selectionRenderService = n, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = a, this._univerInstanceService =
|
|
2519
|
+
let sn = class extends ie {
|
|
2520
|
+
constructor(i, t, e, n, r, s, o, a, d) {
|
|
2521
|
+
super(), this._context = i, this._renderManagerService = t, this._commandService = e, this._selectionRenderService = n, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = a, this._univerInstanceService = d, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
|
|
2584
2522
|
}
|
|
2585
2523
|
_sheetInterceptorListener() {
|
|
2586
2524
|
this.disposeWithMe(
|
|
2587
2525
|
this._sheetInterceptorService.interceptCommand({
|
|
2588
2526
|
getMutations: (i) => {
|
|
2589
|
-
if (!
|
|
2527
|
+
if (!xs.includes(i.id))
|
|
2590
2528
|
return { redos: [], undos: [] };
|
|
2591
2529
|
if (i.params == null)
|
|
2592
2530
|
return { redos: [], undos: [] };
|
|
2593
2531
|
const t = i.id;
|
|
2594
|
-
if (t ===
|
|
2532
|
+
if (t === Kn.id)
|
|
2595
2533
|
return this._moveRowInterceptor(i.params, "insert");
|
|
2596
|
-
if ([
|
|
2534
|
+
if ([dr.id, lr.id, ur.id].includes(t))
|
|
2597
2535
|
return this._moveRangeInterceptor(i.params);
|
|
2598
|
-
if (t ===
|
|
2536
|
+
if (t === Zn.id)
|
|
2599
2537
|
return this._moveColInterceptor(i.params, "insert");
|
|
2600
|
-
if (t ===
|
|
2538
|
+
if (t === Jn.id)
|
|
2601
2539
|
return this._moveRowInterceptor(i.params, "remove");
|
|
2602
|
-
if (t ===
|
|
2540
|
+
if (t === qn.id)
|
|
2603
2541
|
return this._moveColInterceptor(i.params, "remove");
|
|
2604
|
-
if (t ===
|
|
2542
|
+
if (t === Qn.id) {
|
|
2605
2543
|
const { range: e } = i.params;
|
|
2606
2544
|
return this._getRangeMoveUndo(
|
|
2607
2545
|
e,
|
|
2608
2546
|
0
|
|
2609
2547
|
/* deleteLeft */
|
|
2610
2548
|
);
|
|
2611
|
-
} else if (t ===
|
|
2549
|
+
} else if (t === er.id) {
|
|
2612
2550
|
const { range: e } = i.params;
|
|
2613
2551
|
return this._getRangeMoveUndo(
|
|
2614
2552
|
e,
|
|
2615
2553
|
1
|
|
2616
2554
|
/* deleteUp */
|
|
2617
2555
|
);
|
|
2618
|
-
} else if (t ===
|
|
2556
|
+
} else if (t === tr.id) {
|
|
2619
2557
|
const { range: e } = i.params;
|
|
2620
2558
|
return this._getRangeMoveUndo(
|
|
2621
2559
|
e,
|
|
2622
2560
|
2
|
|
2623
2561
|
/* insertDown */
|
|
2624
2562
|
);
|
|
2625
|
-
} else if (t ===
|
|
2563
|
+
} else if (t === nr.id) {
|
|
2626
2564
|
const { range: e } = i.params;
|
|
2627
2565
|
return this._getRangeMoveUndo(
|
|
2628
2566
|
e,
|
|
2629
2567
|
3
|
|
2630
2568
|
/* insertRight */
|
|
2631
2569
|
);
|
|
2632
|
-
} else if (t ===
|
|
2570
|
+
} else if (t === sr.id || t === or.id) {
|
|
2633
2571
|
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
|
|
2634
2572
|
return this._getDrawingUndoForRowVisible(n, r, s);
|
|
2635
|
-
} else if (t ===
|
|
2573
|
+
} else if (t === ar.id || t === cr.id) {
|
|
2636
2574
|
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
|
|
2637
2575
|
return this._getDrawingUndoForColVisible(n, r, s);
|
|
2638
|
-
} else if (t ===
|
|
2639
|
-
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t ===
|
|
2576
|
+
} else if (t === Jt.id || t === qt.id || t === rr.id || t === ir.id) {
|
|
2577
|
+
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t === Jt.id || t === qt.id;
|
|
2640
2578
|
return this._getDrawingUndoForRowAndColSize(n, r, s, o);
|
|
2641
2579
|
}
|
|
2642
2580
|
return { redos: [], undos: [] };
|
|
@@ -2648,58 +2586,58 @@ let ln = class extends ie {
|
|
|
2648
2586
|
const e = ae(this._univerInstanceService);
|
|
2649
2587
|
if (e == null)
|
|
2650
2588
|
return { redos: [], undos: [] };
|
|
2651
|
-
const n = e.unitId, r = e.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(n, r),
|
|
2652
|
-
if (Object.keys(a).forEach((
|
|
2653
|
-
const l = a[
|
|
2654
|
-
|
|
2655
|
-
}),
|
|
2589
|
+
const n = e.unitId, r = e.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(n, r), d = [], u = [];
|
|
2590
|
+
if (Object.keys(a).forEach((c) => {
|
|
2591
|
+
const l = a[c], { updateDrawings: g, deleteDrawings: h } = this._getUpdateOrDeleteDrawings(i, t, l);
|
|
2592
|
+
d.push(...g), u.push(...h);
|
|
2593
|
+
}), d.length === 0 && u.length === 0)
|
|
2656
2594
|
return { redos: [], undos: [] };
|
|
2657
|
-
if (
|
|
2658
|
-
const
|
|
2659
|
-
s.push({ id:
|
|
2595
|
+
if (d.length > 0) {
|
|
2596
|
+
const c = this._sheetDrawingService.getBatchUpdateOp(d), { undo: l, redo: g, objects: h } = c;
|
|
2597
|
+
s.push({ id: P.id, params: { unitId: n, subUnitId: r, op: g, objects: h, type: U.UPDATE } }), o.push({ id: P.id, params: { unitId: n, subUnitId: r, op: l, objects: h, type: U.UPDATE } });
|
|
2660
2598
|
}
|
|
2661
2599
|
if (u.length > 0) {
|
|
2662
|
-
const
|
|
2663
|
-
s.push({ id:
|
|
2600
|
+
const c = this._sheetDrawingService.getBatchRemoveOp(u), l = c.undo, g = c.redo, h = c.objects;
|
|
2601
|
+
s.push({ id: P.id, params: { unitId: n, subUnitId: r, op: g, objects: h, type: U.REMOVE } }), o.push({ id: P.id, params: { unitId: n, subUnitId: r, op: l, objects: h, type: U.INSERT } });
|
|
2664
2602
|
}
|
|
2665
|
-
return s.push({ id:
|
|
2603
|
+
return s.push({ id: L.id, params: [n] }), o.push({ id: L.id, params: [n] }), {
|
|
2666
2604
|
redos: s,
|
|
2667
2605
|
undos: o
|
|
2668
2606
|
};
|
|
2669
2607
|
}
|
|
2670
2608
|
_getUpdateOrDeleteDrawings(i, t, e) {
|
|
2671
|
-
const n = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: a, unitId:
|
|
2609
|
+
const n = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: a, unitId: d, subUnitId: u, drawingId: c } = e, { from: l, to: g } = s, { row: h, column: m } = l, { row: p, column: f } = g;
|
|
2672
2610
|
if (s == null || a == null)
|
|
2673
2611
|
return {
|
|
2674
2612
|
updateDrawings: n,
|
|
2675
2613
|
deleteDrawings: r
|
|
2676
2614
|
};
|
|
2677
|
-
const { startRow:
|
|
2615
|
+
const { startRow: _, endRow: S, startColumn: C, endColumn: b } = i;
|
|
2678
2616
|
let v = null, D = null;
|
|
2679
|
-
if (t === 0 && h >=
|
|
2680
|
-
if (
|
|
2681
|
-
r.push({ unitId:
|
|
2617
|
+
if (t === 0 && h >= _ && p <= S)
|
|
2618
|
+
if (m >= C && f <= b)
|
|
2619
|
+
r.push({ unitId: d, subUnitId: u, drawingId: c });
|
|
2682
2620
|
else {
|
|
2683
|
-
const
|
|
2684
|
-
v =
|
|
2621
|
+
const w = this._shrinkCol(s, a, C, b, o);
|
|
2622
|
+
v = w == null ? void 0 : w.newSheetTransform, D = w == null ? void 0 : w.newTransform;
|
|
2685
2623
|
}
|
|
2686
|
-
else if (t === 1 &&
|
|
2687
|
-
if (h >=
|
|
2688
|
-
r.push({ unitId:
|
|
2624
|
+
else if (t === 1 && m >= C && f <= b)
|
|
2625
|
+
if (h >= _ && p <= S)
|
|
2626
|
+
r.push({ unitId: d, subUnitId: u, drawingId: c });
|
|
2689
2627
|
else {
|
|
2690
|
-
const
|
|
2691
|
-
v =
|
|
2628
|
+
const w = this._shrinkRow(s, a, _, S, o);
|
|
2629
|
+
v = w == null ? void 0 : w.newSheetTransform, D = w == null ? void 0 : w.newTransform;
|
|
2692
2630
|
}
|
|
2693
2631
|
else if (t === 2) {
|
|
2694
|
-
const
|
|
2695
|
-
v =
|
|
2632
|
+
const w = this._expandRow(s, a, _, S, o);
|
|
2633
|
+
v = w == null ? void 0 : w.newSheetTransform, D = w == null ? void 0 : w.newTransform;
|
|
2696
2634
|
} else if (t === 3) {
|
|
2697
|
-
const
|
|
2698
|
-
v =
|
|
2635
|
+
const w = this._expandCol(s, a, C, b, o);
|
|
2636
|
+
v = w == null ? void 0 : w.newSheetTransform, D = w == null ? void 0 : w.newTransform;
|
|
2699
2637
|
}
|
|
2700
2638
|
if (v != null && D != null) {
|
|
2701
|
-
const
|
|
2702
|
-
n.push({ ...e, sheetTransform: v, transform:
|
|
2639
|
+
const w = z(v, this._selectionRenderService, this._skeletonManagerService);
|
|
2640
|
+
n.push({ ...e, sheetTransform: v, transform: w });
|
|
2703
2641
|
}
|
|
2704
2642
|
return { updateDrawings: n, deleteDrawings: r };
|
|
2705
2643
|
}
|
|
@@ -2713,23 +2651,23 @@ let ln = class extends ie {
|
|
|
2713
2651
|
// eslint-disable-next-line max-lines-per-function
|
|
2714
2652
|
_getDrawingUndoForColVisible(i, t, e) {
|
|
2715
2653
|
const n = this._drawingManagerService.getDrawingData(i, t), r = [], s = [];
|
|
2716
|
-
if (Object.keys(n).forEach((
|
|
2717
|
-
const l = n[
|
|
2718
|
-
if (
|
|
2654
|
+
if (Object.keys(n).forEach((c) => {
|
|
2655
|
+
const l = n[c], { sheetTransform: g, transform: h, anchorType: m = O.Position } = l;
|
|
2656
|
+
if (m === O.None)
|
|
2719
2657
|
this._remainDrawingSize(h, r, l);
|
|
2720
2658
|
else {
|
|
2721
|
-
const { from: p, to:
|
|
2659
|
+
const { from: p, to: f } = g, { row: _, column: S } = p, { row: C, column: b } = f;
|
|
2722
2660
|
for (let v = 0; v < e.length; v++) {
|
|
2723
|
-
const D = e[v], { startRow:
|
|
2661
|
+
const D = e[v], { startRow: w, endRow: y, startColumn: I, endColumn: E } = D;
|
|
2724
2662
|
if (b < I)
|
|
2725
2663
|
continue;
|
|
2726
|
-
if (
|
|
2664
|
+
if (m === O.Position) {
|
|
2727
2665
|
let R = null, N = null;
|
|
2728
2666
|
if (S >= I && S <= E) {
|
|
2729
|
-
const
|
|
2730
|
-
if (
|
|
2667
|
+
const B = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: E, startRow: p.row, endRow: f.row });
|
|
2668
|
+
if (B == null)
|
|
2731
2669
|
return;
|
|
2732
|
-
N = { ...h, left:
|
|
2670
|
+
N = { ...h, left: B.startX };
|
|
2733
2671
|
}
|
|
2734
2672
|
if (N != null && (R = x(N, this._selectionRenderService), R != null && N != null)) {
|
|
2735
2673
|
r.push({ ...l, sheetTransform: R, transform: N });
|
|
@@ -2740,38 +2678,38 @@ let ln = class extends ie {
|
|
|
2740
2678
|
}
|
|
2741
2679
|
if (S >= I && b <= E)
|
|
2742
2680
|
continue;
|
|
2743
|
-
let T = null,
|
|
2681
|
+
let T = null, M = null;
|
|
2744
2682
|
if (S >= I && S <= E) {
|
|
2745
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: E, startRow: p.row, endRow:
|
|
2683
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: E, startRow: p.row, endRow: f.row });
|
|
2746
2684
|
if (R == null)
|
|
2747
2685
|
return;
|
|
2748
|
-
|
|
2686
|
+
M = {
|
|
2749
2687
|
...h,
|
|
2750
2688
|
left: (R == null ? void 0 : R.startX) || 0,
|
|
2751
2689
|
width: ((h == null ? void 0 : h.width) || 0) - R.endX + R.startX
|
|
2752
2690
|
};
|
|
2753
2691
|
} else if (b >= I && b <= E) {
|
|
2754
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: b, startRow: p.row, endRow:
|
|
2692
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: b, startRow: p.row, endRow: f.row });
|
|
2755
2693
|
if (R == null)
|
|
2756
2694
|
return;
|
|
2757
|
-
|
|
2695
|
+
M = {
|
|
2758
2696
|
...h,
|
|
2759
2697
|
left: R.startX - ((h == null ? void 0 : h.width) || 0)
|
|
2760
2698
|
};
|
|
2761
2699
|
} else {
|
|
2762
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: E, startRow: p.row, endRow:
|
|
2700
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: E, startRow: p.row, endRow: f.row });
|
|
2763
2701
|
if (R == null)
|
|
2764
2702
|
return;
|
|
2765
|
-
if (
|
|
2703
|
+
if (M = {
|
|
2766
2704
|
...h,
|
|
2767
2705
|
width: ((h == null ? void 0 : h.width) || 0) - R.endX + R.startX
|
|
2768
|
-
}, T = x(
|
|
2769
|
-
s.push({ ...l, sheetTransform: T, transform:
|
|
2706
|
+
}, T = x(M, this._selectionRenderService), T != null && M != null) {
|
|
2707
|
+
s.push({ ...l, sheetTransform: T, transform: M });
|
|
2770
2708
|
break;
|
|
2771
2709
|
}
|
|
2772
2710
|
}
|
|
2773
|
-
if (
|
|
2774
|
-
r.push({ ...l, sheetTransform: T, transform:
|
|
2711
|
+
if (M != null && (T = x(M, this._selectionRenderService)), M != null && T != null) {
|
|
2712
|
+
r.push({ ...l, sheetTransform: T, transform: M });
|
|
2775
2713
|
break;
|
|
2776
2714
|
} else
|
|
2777
2715
|
this._remainDrawingSize(h, r, l);
|
|
@@ -2779,51 +2717,51 @@ let ln = class extends ie {
|
|
|
2779
2717
|
}
|
|
2780
2718
|
}), r.length === 0 && s.length === 0)
|
|
2781
2719
|
return { redos: [], undos: [] };
|
|
2782
|
-
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, t, r),
|
|
2720
|
+
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, t, r), d = [], u = [];
|
|
2783
2721
|
if (s.length > 0) {
|
|
2784
|
-
const { redos:
|
|
2785
|
-
|
|
2722
|
+
const { redos: c, undos: l } = this._createUndoAndRedoMutation(i, t, s);
|
|
2723
|
+
d.push(...c), u.push(...l);
|
|
2786
2724
|
}
|
|
2787
2725
|
return {
|
|
2788
2726
|
redos: o,
|
|
2789
2727
|
undos: a,
|
|
2790
|
-
preRedos:
|
|
2728
|
+
preRedos: d,
|
|
2791
2729
|
preUndos: u
|
|
2792
2730
|
};
|
|
2793
2731
|
}
|
|
2794
2732
|
_createUndoAndRedoMutation(i, t, e) {
|
|
2795
2733
|
const n = this._sheetDrawingService.getBatchUpdateOp(e), { undo: r, redo: s, objects: o } = n, a = [
|
|
2796
|
-
{ id:
|
|
2797
|
-
{ id:
|
|
2798
|
-
],
|
|
2799
|
-
{ id:
|
|
2800
|
-
{ id:
|
|
2734
|
+
{ id: P.id, params: { unitId: i, subUnitId: t, op: s, objects: o, type: U.UPDATE } },
|
|
2735
|
+
{ id: L.id, params: [i] }
|
|
2736
|
+
], d = [
|
|
2737
|
+
{ id: P.id, params: { unitId: i, subUnitId: t, op: r, objects: o, type: U.UPDATE } },
|
|
2738
|
+
{ id: L.id, params: [i] }
|
|
2801
2739
|
];
|
|
2802
2740
|
return {
|
|
2803
2741
|
redos: a,
|
|
2804
|
-
undos:
|
|
2742
|
+
undos: d
|
|
2805
2743
|
};
|
|
2806
2744
|
}
|
|
2807
2745
|
// eslint-disable-next-line max-lines-per-function
|
|
2808
2746
|
_getDrawingUndoForRowVisible(i, t, e) {
|
|
2809
2747
|
const n = this._drawingManagerService.getDrawingData(i, t), r = [], s = [];
|
|
2810
|
-
if (Object.keys(n).forEach((
|
|
2811
|
-
const l = n[
|
|
2812
|
-
if (
|
|
2748
|
+
if (Object.keys(n).forEach((c) => {
|
|
2749
|
+
const l = n[c], { sheetTransform: g, transform: h, anchorType: m = O.Position } = l;
|
|
2750
|
+
if (m === O.None)
|
|
2813
2751
|
this._remainDrawingSize(h, r, l);
|
|
2814
2752
|
else {
|
|
2815
|
-
const { from: p, to:
|
|
2753
|
+
const { from: p, to: f } = g, { row: _, column: S } = p, { row: C, column: b } = f;
|
|
2816
2754
|
for (let v = 0; v < e.length; v++) {
|
|
2817
|
-
const D = e[v], { startRow:
|
|
2818
|
-
if (C <
|
|
2755
|
+
const D = e[v], { startRow: w, endRow: y, startColumn: I, endColumn: E } = D;
|
|
2756
|
+
if (C < w)
|
|
2819
2757
|
continue;
|
|
2820
|
-
if (
|
|
2758
|
+
if (m === O.Position) {
|
|
2821
2759
|
let R = null, N = null;
|
|
2822
|
-
if (
|
|
2823
|
-
const
|
|
2824
|
-
if (
|
|
2760
|
+
if (_ >= w && _ <= y) {
|
|
2761
|
+
const B = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: _, endRow: y });
|
|
2762
|
+
if (B == null)
|
|
2825
2763
|
return;
|
|
2826
|
-
N = { ...h, top:
|
|
2764
|
+
N = { ...h, top: B.startY };
|
|
2827
2765
|
}
|
|
2828
2766
|
if (N != null && (R = x(N, this._selectionRenderService), R != null && N != null)) {
|
|
2829
2767
|
r.push({ ...l, sheetTransform: R, transform: N });
|
|
@@ -2832,40 +2770,40 @@ let ln = class extends ie {
|
|
|
2832
2770
|
this._remainDrawingSize(h, r, l);
|
|
2833
2771
|
continue;
|
|
2834
2772
|
}
|
|
2835
|
-
if (
|
|
2773
|
+
if (_ >= w && C <= y)
|
|
2836
2774
|
continue;
|
|
2837
|
-
let T = null,
|
|
2838
|
-
if (
|
|
2839
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn:
|
|
2775
|
+
let T = null, M = null;
|
|
2776
|
+
if (_ >= w && _ <= y) {
|
|
2777
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: _, endRow: y });
|
|
2840
2778
|
if (R == null)
|
|
2841
2779
|
return;
|
|
2842
|
-
|
|
2780
|
+
M = {
|
|
2843
2781
|
...h,
|
|
2844
2782
|
top: (R == null ? void 0 : R.startY) || 0,
|
|
2845
2783
|
height: ((h == null ? void 0 : h.height) || 0) - R.endY + R.startY
|
|
2846
2784
|
};
|
|
2847
|
-
} else if (C >=
|
|
2848
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn:
|
|
2785
|
+
} else if (C >= w && C <= y) {
|
|
2786
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: w, endRow: C });
|
|
2849
2787
|
if (R == null)
|
|
2850
2788
|
return;
|
|
2851
|
-
|
|
2789
|
+
M = {
|
|
2852
2790
|
...h,
|
|
2853
2791
|
top: R.startY - ((h == null ? void 0 : h.height) || 0)
|
|
2854
2792
|
};
|
|
2855
2793
|
} else {
|
|
2856
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn:
|
|
2794
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: w, endRow: y });
|
|
2857
2795
|
if (R == null)
|
|
2858
2796
|
return;
|
|
2859
|
-
if (
|
|
2797
|
+
if (M = {
|
|
2860
2798
|
...h,
|
|
2861
2799
|
height: ((h == null ? void 0 : h.height) || 0) - R.endY + R.startY
|
|
2862
|
-
}, T = x(
|
|
2863
|
-
s.push({ ...l, sheetTransform: T, transform:
|
|
2800
|
+
}, T = x(M, this._selectionRenderService), T != null && M != null) {
|
|
2801
|
+
s.push({ ...l, sheetTransform: T, transform: M });
|
|
2864
2802
|
break;
|
|
2865
2803
|
}
|
|
2866
2804
|
}
|
|
2867
|
-
if (
|
|
2868
|
-
r.push({ ...l, sheetTransform: T, transform:
|
|
2805
|
+
if (M != null && (T = x(M, this._selectionRenderService)), M != null && T != null) {
|
|
2806
|
+
r.push({ ...l, sheetTransform: T, transform: M });
|
|
2869
2807
|
break;
|
|
2870
2808
|
} else
|
|
2871
2809
|
this._remainDrawingSize(h, r, l);
|
|
@@ -2873,39 +2811,39 @@ let ln = class extends ie {
|
|
|
2873
2811
|
}
|
|
2874
2812
|
}), r.length === 0 && s.length === 0)
|
|
2875
2813
|
return { redos: [], undos: [] };
|
|
2876
|
-
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, t, r),
|
|
2814
|
+
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, t, r), d = [], u = [];
|
|
2877
2815
|
if (s.length > 0) {
|
|
2878
|
-
const { redos:
|
|
2879
|
-
|
|
2816
|
+
const { redos: c, undos: l } = this._createUndoAndRedoMutation(i, t, s);
|
|
2817
|
+
d.push(...c), u.push(...l);
|
|
2880
2818
|
}
|
|
2881
2819
|
return {
|
|
2882
2820
|
redos: o,
|
|
2883
2821
|
undos: a,
|
|
2884
|
-
preRedos:
|
|
2822
|
+
preRedos: d,
|
|
2885
2823
|
preUndos: u
|
|
2886
2824
|
};
|
|
2887
2825
|
}
|
|
2888
2826
|
_getDrawingUndoForRowAndColSize(i, t, e, n) {
|
|
2889
2827
|
const r = this._drawingManagerService.getDrawingData(i, t), s = [];
|
|
2890
2828
|
return Object.keys(r).forEach((o) => {
|
|
2891
|
-
const a = r[o], { sheetTransform:
|
|
2892
|
-
if (
|
|
2829
|
+
const a = r[o], { sheetTransform: d, transform: u, anchorType: c = O.Position } = a;
|
|
2830
|
+
if (c === O.None)
|
|
2893
2831
|
this._remainDrawingSize(u, s, a);
|
|
2894
2832
|
else {
|
|
2895
|
-
const { from: l, to: g } =
|
|
2896
|
-
for (let
|
|
2897
|
-
const S = e[
|
|
2898
|
-
if (p < C ||
|
|
2833
|
+
const { from: l, to: g } = d, { row: h, column: m } = l, { row: p, column: f } = g;
|
|
2834
|
+
for (let _ = 0; _ < e.length; _++) {
|
|
2835
|
+
const S = e[_], { startRow: C, endRow: b, startColumn: v, endColumn: D } = S;
|
|
2836
|
+
if (p < C || f < v)
|
|
2899
2837
|
continue;
|
|
2900
|
-
if (
|
|
2838
|
+
if (c === O.Position && (h <= C && p >= b || m <= v && f >= D)) {
|
|
2901
2839
|
this._remainDrawingSize(u, s, a);
|
|
2902
2840
|
continue;
|
|
2903
2841
|
}
|
|
2904
|
-
const
|
|
2905
|
-
if (
|
|
2842
|
+
const w = z({ ...d }, this._selectionRenderService, this._skeletonManagerService);
|
|
2843
|
+
if (w != null) {
|
|
2906
2844
|
s.push({
|
|
2907
2845
|
...a,
|
|
2908
|
-
transform:
|
|
2846
|
+
transform: w
|
|
2909
2847
|
});
|
|
2910
2848
|
break;
|
|
2911
2849
|
}
|
|
@@ -2930,66 +2868,66 @@ let ln = class extends ie {
|
|
|
2930
2868
|
const { toRange: t, fromRange: e } = i, n = ae(this._univerInstanceService);
|
|
2931
2869
|
if (!n)
|
|
2932
2870
|
return { redos: [], undos: [] };
|
|
2933
|
-
const { unitId: r, subUnitId: s } = n, o = (b = (C = this._renderManagerService.getRenderById(r)) == null ? void 0 : C.with(
|
|
2871
|
+
const { unitId: r, subUnitId: s } = n, o = (b = (C = this._renderManagerService.getRenderById(r)) == null ? void 0 : C.with(V)) == null ? void 0 : b.getCurrentSkeleton();
|
|
2934
2872
|
if (!o)
|
|
2935
2873
|
return { redos: [], undos: [] };
|
|
2936
|
-
const a =
|
|
2874
|
+
const a = Vn(o, e);
|
|
2937
2875
|
if (!a)
|
|
2938
2876
|
return { redos: [], undos: [] };
|
|
2939
|
-
const { startX:
|
|
2877
|
+
const { startX: d, endX: u, startY: c, endY: l } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
|
|
2940
2878
|
Object.keys(g).forEach((v) => {
|
|
2941
2879
|
const D = g[v];
|
|
2942
2880
|
if (D.anchorType !== O.Both)
|
|
2943
2881
|
return;
|
|
2944
|
-
const { transform:
|
|
2945
|
-
if (!
|
|
2882
|
+
const { transform: w } = D;
|
|
2883
|
+
if (!w)
|
|
2946
2884
|
return;
|
|
2947
|
-
const { left:
|
|
2948
|
-
drawingStartX:
|
|
2949
|
-
drawingEndX:
|
|
2885
|
+
const { left: y = 0, top: I = 0, width: E = 0, height: T = 0 } = w, { drawingStartX: M, drawingEndX: R, drawingStartY: N, drawingEndY: B } = {
|
|
2886
|
+
drawingStartX: y,
|
|
2887
|
+
drawingEndX: y + E,
|
|
2950
2888
|
drawingStartY: I,
|
|
2951
2889
|
drawingEndY: I + T
|
|
2952
2890
|
};
|
|
2953
|
-
|
|
2891
|
+
d <= M && R <= u && c <= N && B <= l && h.push(D);
|
|
2954
2892
|
});
|
|
2955
|
-
const
|
|
2956
|
-
const D = v.sheetTransform,
|
|
2957
|
-
to: { ...D.to, row: D.to.row +
|
|
2958
|
-
from: { ...D.from, row: D.from.row +
|
|
2959
|
-
},
|
|
2893
|
+
const m = [], p = [], f = t.startRow - e.startRow, _ = t.startColumn - e.startColumn, S = h.map((v) => {
|
|
2894
|
+
const D = v.sheetTransform, w = {
|
|
2895
|
+
to: { ...D.to, row: D.to.row + f, column: D.to.column + _ },
|
|
2896
|
+
from: { ...D.from, row: D.from.row + f, column: D.from.column + _ }
|
|
2897
|
+
}, y = z(w, this._selectionRenderService, this._skeletonManagerService);
|
|
2960
2898
|
return {
|
|
2961
2899
|
unitId: r,
|
|
2962
2900
|
subUnitId: s,
|
|
2963
2901
|
drawingId: v.drawingId,
|
|
2964
|
-
transform:
|
|
2965
|
-
sheetTransform:
|
|
2902
|
+
transform: y,
|
|
2903
|
+
sheetTransform: w
|
|
2966
2904
|
};
|
|
2967
2905
|
});
|
|
2968
2906
|
if (S.length) {
|
|
2969
|
-
const v = this._sheetDrawingService.getBatchUpdateOp(S), { undo: D, redo:
|
|
2970
|
-
|
|
2907
|
+
const v = this._sheetDrawingService.getBatchUpdateOp(S), { undo: D, redo: w, objects: y } = v;
|
|
2908
|
+
m.push({ id: P.id, params: { unitId: r, subUnitId: s, op: w, objects: y, type: U.UPDATE } }), p.push({ id: P.id, params: { unitId: r, subUnitId: s, op: D, objects: y, type: U.UPDATE } });
|
|
2971
2909
|
}
|
|
2972
|
-
return { redos:
|
|
2910
|
+
return { redos: m, undos: p };
|
|
2973
2911
|
}
|
|
2974
2912
|
_moveRowInterceptor(i, t) {
|
|
2975
2913
|
const e = this._getUnitIdAndSubUnitId(i, t);
|
|
2976
2914
|
if (e == null)
|
|
2977
2915
|
return { redos: [], undos: [] };
|
|
2978
|
-
const { unitId: n, subUnitId: r } = e, { range: s } = i, o = s.startRow, a = s.endRow,
|
|
2979
|
-
if (Object.keys(
|
|
2980
|
-
const
|
|
2981
|
-
if (p == null ||
|
|
2916
|
+
const { unitId: n, subUnitId: r } = e, { range: s } = i, o = s.startRow, a = s.endRow, d = [], u = [], c = this._sheetDrawingService.getDrawingData(n, r), l = [], g = [];
|
|
2917
|
+
if (Object.keys(c).forEach((h) => {
|
|
2918
|
+
const m = c[h], { sheetTransform: p, transform: f, anchorType: _ = O.Position } = m;
|
|
2919
|
+
if (p == null || f == null)
|
|
2982
2920
|
return;
|
|
2983
2921
|
let S, C;
|
|
2984
2922
|
if (t === "insert") {
|
|
2985
|
-
const v = this._expandRow(p,
|
|
2923
|
+
const v = this._expandRow(p, f, o, a, _);
|
|
2986
2924
|
S = v == null ? void 0 : v.newSheetTransform, C = v == null ? void 0 : v.newTransform;
|
|
2987
2925
|
} else {
|
|
2988
|
-
const { from: v, to: D } = p, { row:
|
|
2989
|
-
if (
|
|
2926
|
+
const { from: v, to: D } = p, { row: w } = v, { row: y } = D;
|
|
2927
|
+
if (_ === O.Both && w >= o && y <= a)
|
|
2990
2928
|
g.push({ unitId: n, subUnitId: r, drawingId: h });
|
|
2991
2929
|
else {
|
|
2992
|
-
const I = this._shrinkRow(p,
|
|
2930
|
+
const I = this._shrinkRow(p, f, o, a, _);
|
|
2993
2931
|
S = I == null ? void 0 : I.newSheetTransform, C = I == null ? void 0 : I.newTransform;
|
|
2994
2932
|
}
|
|
2995
2933
|
}
|
|
@@ -3000,15 +2938,15 @@ let ln = class extends ie {
|
|
|
3000
2938
|
}), l.length === 0 && g.length === 0)
|
|
3001
2939
|
return { redos: [], undos: [] };
|
|
3002
2940
|
if (l.length > 0) {
|
|
3003
|
-
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo:
|
|
3004
|
-
|
|
2941
|
+
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: p, objects: f } = h;
|
|
2942
|
+
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: p, objects: f, type: U.UPDATE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: f, type: U.UPDATE } });
|
|
3005
2943
|
}
|
|
3006
2944
|
if (g.length > 0) {
|
|
3007
|
-
const h = this._sheetDrawingService.getBatchRemoveOp(g),
|
|
3008
|
-
|
|
2945
|
+
const h = this._sheetDrawingService.getBatchRemoveOp(g), m = h.undo, p = h.redo, f = h.objects;
|
|
2946
|
+
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: p, objects: f, type: U.REMOVE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: f, type: U.INSERT } });
|
|
3009
2947
|
}
|
|
3010
|
-
return
|
|
3011
|
-
redos:
|
|
2948
|
+
return d.push({ id: L.id, params: [n] }), u.push({ id: L.id, params: [n] }), {
|
|
2949
|
+
redos: d,
|
|
3012
2950
|
undos: u
|
|
3013
2951
|
};
|
|
3014
2952
|
}
|
|
@@ -3016,21 +2954,21 @@ let ln = class extends ie {
|
|
|
3016
2954
|
const e = this._getUnitIdAndSubUnitId(i, t);
|
|
3017
2955
|
if (e == null)
|
|
3018
2956
|
return { redos: [], undos: [] };
|
|
3019
|
-
const { unitId: n, subUnitId: r } = e, { range: s } = i, o = s.startColumn, a = s.endColumn,
|
|
3020
|
-
if (Object.keys(
|
|
3021
|
-
const
|
|
3022
|
-
if (p == null ||
|
|
2957
|
+
const { unitId: n, subUnitId: r } = e, { range: s } = i, o = s.startColumn, a = s.endColumn, d = [], u = [], c = this._sheetDrawingService.getDrawingData(n, r), l = [], g = [];
|
|
2958
|
+
if (Object.keys(c).forEach((h) => {
|
|
2959
|
+
const m = c[h], { sheetTransform: p, transform: f, anchorType: _ = O.Position } = m;
|
|
2960
|
+
if (p == null || f == null)
|
|
3023
2961
|
return;
|
|
3024
2962
|
let S, C;
|
|
3025
2963
|
if (t === "insert") {
|
|
3026
|
-
const v = this._expandCol(p,
|
|
2964
|
+
const v = this._expandCol(p, f, o, a, _);
|
|
3027
2965
|
S = v == null ? void 0 : v.newSheetTransform, C = v == null ? void 0 : v.newTransform;
|
|
3028
2966
|
} else {
|
|
3029
|
-
const { from: v, to: D } = p, { column:
|
|
3030
|
-
if (
|
|
2967
|
+
const { from: v, to: D } = p, { column: w } = v, { column: y } = D;
|
|
2968
|
+
if (_ === O.Both && w >= o && y <= a)
|
|
3031
2969
|
g.push({ unitId: n, subUnitId: r, drawingId: h });
|
|
3032
2970
|
else {
|
|
3033
|
-
const I = this._shrinkCol(p,
|
|
2971
|
+
const I = this._shrinkCol(p, f, o, a, _);
|
|
3034
2972
|
S = I == null ? void 0 : I.newSheetTransform, C = I == null ? void 0 : I.newTransform;
|
|
3035
2973
|
}
|
|
3036
2974
|
}
|
|
@@ -3041,81 +2979,81 @@ let ln = class extends ie {
|
|
|
3041
2979
|
}), l.length === 0 && g.length === 0)
|
|
3042
2980
|
return { redos: [], undos: [] };
|
|
3043
2981
|
if (l.length > 0) {
|
|
3044
|
-
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo:
|
|
3045
|
-
|
|
2982
|
+
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: p, objects: f } = h;
|
|
2983
|
+
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: p, objects: f, type: U.UPDATE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: f, type: U.UPDATE } });
|
|
3046
2984
|
}
|
|
3047
2985
|
if (g.length > 0) {
|
|
3048
|
-
const h = this._sheetDrawingService.getBatchRemoveOp(g),
|
|
3049
|
-
|
|
2986
|
+
const h = this._sheetDrawingService.getBatchRemoveOp(g), m = h.undo, p = h.redo, f = h.objects;
|
|
2987
|
+
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: p, objects: f, type: U.REMOVE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: f, type: U.INSERT } });
|
|
3050
2988
|
}
|
|
3051
|
-
return
|
|
2989
|
+
return d.push({ id: L.id, params: [n] }), u.push({ id: L.id, params: [n] }), { redos: d, undos: u };
|
|
3052
2990
|
}
|
|
3053
2991
|
_expandCol(i, t, e, n, r = O.Position) {
|
|
3054
|
-
const s = n - e + 1, { from: o, to: a } = i, { column:
|
|
2992
|
+
const s = n - e + 1, { from: o, to: a } = i, { column: d } = o, { column: u } = a;
|
|
3055
2993
|
if (r === O.None)
|
|
3056
2994
|
return {
|
|
3057
2995
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3058
2996
|
newTransform: t
|
|
3059
2997
|
};
|
|
3060
|
-
let
|
|
3061
|
-
if (
|
|
2998
|
+
let c = null, l = null;
|
|
2999
|
+
if (d >= e) {
|
|
3062
3000
|
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: e, endColumn: n, startRow: o.row, endRow: a.row });
|
|
3063
3001
|
if (g == null)
|
|
3064
3002
|
return;
|
|
3065
|
-
l = { ...t, left: (t.left || 0) + g.endX - g.startX },
|
|
3003
|
+
l = { ...t, left: (t.left || 0) + g.endX - g.startX }, c = x(l, this._selectionRenderService);
|
|
3066
3004
|
} else if (u >= n)
|
|
3067
3005
|
if (r === O.Both)
|
|
3068
|
-
|
|
3006
|
+
c = {
|
|
3069
3007
|
from: { ...o },
|
|
3070
3008
|
to: { ...a, column: u + s }
|
|
3071
|
-
}, l =
|
|
3009
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3072
3010
|
else
|
|
3073
3011
|
return {
|
|
3074
3012
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3075
3013
|
newTransform: t
|
|
3076
3014
|
};
|
|
3077
|
-
return
|
|
3078
|
-
newSheetTransform:
|
|
3015
|
+
return c != null && l != null ? {
|
|
3016
|
+
newSheetTransform: c,
|
|
3079
3017
|
newTransform: l
|
|
3080
3018
|
} : null;
|
|
3081
3019
|
}
|
|
3082
3020
|
_shrinkCol(i, t, e, n, r = O.Position) {
|
|
3083
|
-
const s = n - e + 1, { from: o, to: a } = i, { column:
|
|
3021
|
+
const s = n - e + 1, { from: o, to: a } = i, { column: d } = o, { column: u } = a;
|
|
3084
3022
|
if (r === O.None)
|
|
3085
3023
|
return {
|
|
3086
3024
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3087
3025
|
newTransform: t
|
|
3088
3026
|
};
|
|
3089
|
-
let
|
|
3090
|
-
if (
|
|
3091
|
-
|
|
3092
|
-
from: { ...o, column:
|
|
3027
|
+
let c = null, l = null;
|
|
3028
|
+
if (d > n)
|
|
3029
|
+
c = {
|
|
3030
|
+
from: { ...o, column: d - s },
|
|
3093
3031
|
to: { ...a, column: u - s }
|
|
3094
|
-
}, l =
|
|
3032
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3095
3033
|
else {
|
|
3096
|
-
if (
|
|
3034
|
+
if (d >= e && u <= n)
|
|
3097
3035
|
return null;
|
|
3098
|
-
if (
|
|
3036
|
+
if (d < e && u > n)
|
|
3099
3037
|
if (r === O.Both)
|
|
3100
|
-
|
|
3038
|
+
c = {
|
|
3101
3039
|
from: { ...o },
|
|
3102
3040
|
to: { ...a, column: u - s }
|
|
3103
|
-
}, l =
|
|
3041
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3104
3042
|
else
|
|
3105
3043
|
return {
|
|
3106
3044
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3107
3045
|
newTransform: t
|
|
3108
3046
|
};
|
|
3109
|
-
else if (
|
|
3110
|
-
if (
|
|
3047
|
+
else if (d >= e && d <= n) {
|
|
3048
|
+
if (d === e)
|
|
3111
3049
|
l = { ...t, left: (t.left || 0) - i.from.columnOffset };
|
|
3112
3050
|
else {
|
|
3113
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: e, endColumn:
|
|
3051
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: e, endColumn: d - 1, startRow: o.row, endRow: a.row });
|
|
3114
3052
|
if (g == null)
|
|
3115
3053
|
return;
|
|
3116
3054
|
l = { ...t, left: (t.left || 0) - g.endX + g.startX - i.from.columnOffset };
|
|
3117
3055
|
}
|
|
3118
|
-
|
|
3056
|
+
c = x(l, this._selectionRenderService);
|
|
3119
3057
|
} else if (u >= e && u <= n && r === O.Both) {
|
|
3120
3058
|
const g = this._skeletonManagerService.attachRangeWithCoord({
|
|
3121
3059
|
startColumn: e - 1,
|
|
@@ -3125,98 +3063,98 @@ let ln = class extends ie {
|
|
|
3125
3063
|
});
|
|
3126
3064
|
if (g == null)
|
|
3127
3065
|
return;
|
|
3128
|
-
|
|
3066
|
+
c = {
|
|
3129
3067
|
from: { ...o },
|
|
3130
3068
|
to: { ...a, column: e - 1, columnOffset: g.endX - g.startX }
|
|
3131
|
-
}, l =
|
|
3069
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3132
3070
|
}
|
|
3133
3071
|
}
|
|
3134
|
-
return
|
|
3135
|
-
newSheetTransform:
|
|
3072
|
+
return c != null && l != null ? {
|
|
3073
|
+
newSheetTransform: c,
|
|
3136
3074
|
newTransform: l
|
|
3137
3075
|
} : null;
|
|
3138
3076
|
}
|
|
3139
3077
|
_expandRow(i, t, e, n, r = O.Position) {
|
|
3140
|
-
const s = n - e + 1, { from: o, to: a } = i, { row:
|
|
3078
|
+
const s = n - e + 1, { from: o, to: a } = i, { row: d } = o, { row: u } = a;
|
|
3141
3079
|
if (r === O.None)
|
|
3142
3080
|
return {
|
|
3143
3081
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3144
3082
|
newTransform: t
|
|
3145
3083
|
};
|
|
3146
|
-
let
|
|
3147
|
-
if (
|
|
3084
|
+
let c = null, l = null;
|
|
3085
|
+
if (d >= e) {
|
|
3148
3086
|
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: e, endRow: n, startColumn: o.column, endColumn: a.column });
|
|
3149
3087
|
if (g == null)
|
|
3150
3088
|
return;
|
|
3151
|
-
l = { ...t, top: (t.top || 0) + g.endY - g.startY },
|
|
3089
|
+
l = { ...t, top: (t.top || 0) + g.endY - g.startY }, c = x(l, this._selectionRenderService);
|
|
3152
3090
|
} else if (u >= n)
|
|
3153
3091
|
if (r === O.Both)
|
|
3154
|
-
|
|
3092
|
+
c = {
|
|
3155
3093
|
from: { ...o },
|
|
3156
3094
|
to: {
|
|
3157
3095
|
...a,
|
|
3158
3096
|
row: u + s
|
|
3159
3097
|
}
|
|
3160
|
-
}, l =
|
|
3098
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3161
3099
|
else
|
|
3162
3100
|
return {
|
|
3163
3101
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3164
3102
|
newTransform: t
|
|
3165
3103
|
};
|
|
3166
|
-
return
|
|
3167
|
-
newSheetTransform:
|
|
3104
|
+
return c != null && l != null ? {
|
|
3105
|
+
newSheetTransform: c,
|
|
3168
3106
|
newTransform: l
|
|
3169
3107
|
} : null;
|
|
3170
3108
|
}
|
|
3171
3109
|
_shrinkRow(i, t, e, n, r = O.Position) {
|
|
3172
|
-
const s = n - e + 1, { from: o, to: a } = i, { row:
|
|
3110
|
+
const s = n - e + 1, { from: o, to: a } = i, { row: d } = o, { row: u } = a;
|
|
3173
3111
|
if (r === O.None)
|
|
3174
3112
|
return {
|
|
3175
3113
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3176
3114
|
newTransform: t
|
|
3177
3115
|
};
|
|
3178
|
-
let
|
|
3179
|
-
if (
|
|
3180
|
-
|
|
3181
|
-
from: { ...o, row:
|
|
3116
|
+
let c = null, l = null;
|
|
3117
|
+
if (d > n)
|
|
3118
|
+
c = {
|
|
3119
|
+
from: { ...o, row: d - s },
|
|
3182
3120
|
to: { ...a, row: u - s }
|
|
3183
|
-
}, l =
|
|
3121
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3184
3122
|
else {
|
|
3185
|
-
if (
|
|
3123
|
+
if (d >= e && u <= n)
|
|
3186
3124
|
return null;
|
|
3187
|
-
if (
|
|
3125
|
+
if (d < e && u > n)
|
|
3188
3126
|
if (r === O.Both)
|
|
3189
|
-
|
|
3127
|
+
c = {
|
|
3190
3128
|
from: { ...o },
|
|
3191
3129
|
to: { ...a, row: u - s }
|
|
3192
|
-
}, l =
|
|
3130
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3193
3131
|
else
|
|
3194
3132
|
return {
|
|
3195
3133
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3196
3134
|
newTransform: t
|
|
3197
3135
|
};
|
|
3198
|
-
else if (
|
|
3199
|
-
if (
|
|
3136
|
+
else if (d >= e && d <= n) {
|
|
3137
|
+
if (d === e)
|
|
3200
3138
|
l = { ...t, top: (t.top || 0) - i.from.rowOffset };
|
|
3201
3139
|
else {
|
|
3202
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: e, endRow:
|
|
3140
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: e, endRow: d - 1, startColumn: o.column, endColumn: a.column });
|
|
3203
3141
|
if (g == null)
|
|
3204
3142
|
return;
|
|
3205
3143
|
l = { ...t, top: (t.top || 0) - g.endY + g.startY - i.from.rowOffset };
|
|
3206
3144
|
}
|
|
3207
|
-
|
|
3145
|
+
c = x(l, this._selectionRenderService);
|
|
3208
3146
|
} else if (u >= e && u <= n && r === O.Both) {
|
|
3209
3147
|
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: e - 1, endRow: e - 1 });
|
|
3210
3148
|
if (g == null)
|
|
3211
3149
|
return;
|
|
3212
|
-
|
|
3150
|
+
c = {
|
|
3213
3151
|
from: { ...o },
|
|
3214
3152
|
to: { ...a, row: e - 1, rowOffset: g.endY - g.startY }
|
|
3215
|
-
}, l =
|
|
3153
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3216
3154
|
}
|
|
3217
3155
|
}
|
|
3218
|
-
return
|
|
3219
|
-
newSheetTransform:
|
|
3156
|
+
return c != null && l != null ? {
|
|
3157
|
+
newSheetTransform: c,
|
|
3220
3158
|
newTransform: l
|
|
3221
3159
|
} : null;
|
|
3222
3160
|
}
|
|
@@ -3226,7 +3164,7 @@ let ln = class extends ie {
|
|
|
3226
3164
|
// but the skeleton changes like other render modules. These two signals are not equivalent.
|
|
3227
3165
|
// As a temp solution, I subscribed to activate$ here.
|
|
3228
3166
|
this._commandService.onCommandExecuted((i) => {
|
|
3229
|
-
if (i.id ===
|
|
3167
|
+
if (i.id === ts.id) {
|
|
3230
3168
|
const { unitId: t, subUnitId: e } = i.params;
|
|
3231
3169
|
this._updateDrawings(t, e);
|
|
3232
3170
|
}
|
|
@@ -3262,13 +3200,13 @@ let ln = class extends ie {
|
|
|
3262
3200
|
Object.keys(e).forEach((s) => {
|
|
3263
3201
|
const o = e[s];
|
|
3264
3202
|
o != null && Object.keys(o).forEach((a) => {
|
|
3265
|
-
const
|
|
3266
|
-
|
|
3203
|
+
const d = o[a].data;
|
|
3204
|
+
d != null && Object.keys(d).forEach((u) => {
|
|
3267
3205
|
if (s === i && a === t) {
|
|
3268
|
-
const
|
|
3269
|
-
|
|
3206
|
+
const c = d[u];
|
|
3207
|
+
c.transform = z(c.sheetTransform, this._selectionRenderService, this._skeletonManagerService), n.push(d[u]);
|
|
3270
3208
|
} else
|
|
3271
|
-
r.push(
|
|
3209
|
+
r.push(d[u]);
|
|
3272
3210
|
});
|
|
3273
3211
|
});
|
|
3274
3212
|
}), this._drawingManagerService.removeNotification(r), this._drawingManagerService.addNotification(n);
|
|
@@ -3277,7 +3215,7 @@ let ln = class extends ie {
|
|
|
3277
3215
|
_sheetRefreshListener() {
|
|
3278
3216
|
this.disposeWithMe(
|
|
3279
3217
|
this._commandService.onCommandExecuted((i) => {
|
|
3280
|
-
|
|
3218
|
+
Fs.includes(i.id) && requestIdleCallback(() => {
|
|
3281
3219
|
const t = i.params, { unitId: e, subUnitId: n, ranges: r } = t;
|
|
3282
3220
|
this._refreshDrawingTransform(e, n, r);
|
|
3283
3221
|
});
|
|
@@ -3287,13 +3225,13 @@ let ln = class extends ie {
|
|
|
3287
3225
|
_refreshDrawingTransform(i, t, e) {
|
|
3288
3226
|
const n = this._drawingManagerService.getDrawingData(i, t), r = [];
|
|
3289
3227
|
Object.keys(n).forEach((s) => {
|
|
3290
|
-
const o = n[s], { sheetTransform: a, transform:
|
|
3228
|
+
const o = n[s], { sheetTransform: a, transform: d, anchorType: u = O.Position } = o;
|
|
3291
3229
|
if (u === O.None)
|
|
3292
3230
|
return !0;
|
|
3293
|
-
const { from:
|
|
3294
|
-
for (let
|
|
3295
|
-
const
|
|
3296
|
-
if (
|
|
3231
|
+
const { from: c, to: l } = a, { row: g, column: h } = c, { row: m, column: p } = l;
|
|
3232
|
+
for (let f = 0; f < e.length; f++) {
|
|
3233
|
+
const _ = e[f], { startRow: S, endRow: C, startColumn: b, endColumn: v } = _;
|
|
3234
|
+
if (Hr.intersects(
|
|
3297
3235
|
{
|
|
3298
3236
|
startRow: S,
|
|
3299
3237
|
endRow: C,
|
|
@@ -3302,36 +3240,36 @@ let ln = class extends ie {
|
|
|
3302
3240
|
},
|
|
3303
3241
|
{
|
|
3304
3242
|
startRow: g,
|
|
3305
|
-
endRow:
|
|
3243
|
+
endRow: m,
|
|
3306
3244
|
startColumn: h,
|
|
3307
3245
|
endColumn: p
|
|
3308
3246
|
}
|
|
3309
3247
|
) || g > C || h > v) {
|
|
3310
|
-
const D = u === O.Position,
|
|
3248
|
+
const D = u === O.Position, w = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
3311
3249
|
r.push({
|
|
3312
3250
|
...o,
|
|
3313
3251
|
transform: {
|
|
3314
|
-
...
|
|
3315
|
-
width: D ?
|
|
3316
|
-
height: D ?
|
|
3252
|
+
...w,
|
|
3253
|
+
width: D ? d == null ? void 0 : d.width : w == null ? void 0 : w.width,
|
|
3254
|
+
height: D ? d == null ? void 0 : d.height : w == null ? void 0 : w.height
|
|
3317
3255
|
}
|
|
3318
3256
|
});
|
|
3319
3257
|
break;
|
|
3320
3258
|
}
|
|
3321
3259
|
}
|
|
3322
|
-
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(
|
|
3260
|
+
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(L.id, [i]));
|
|
3323
3261
|
}
|
|
3324
3262
|
};
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
],
|
|
3263
|
+
sn = $s([
|
|
3264
|
+
pe(1, q),
|
|
3265
|
+
pe(2, G),
|
|
3266
|
+
pe(3, Ge),
|
|
3267
|
+
pe(4, A(V)),
|
|
3268
|
+
pe(5, A(kt)),
|
|
3269
|
+
pe(6, oe),
|
|
3270
|
+
pe(7, se),
|
|
3271
|
+
pe(8, Se)
|
|
3272
|
+
], sn);
|
|
3335
3273
|
var re = function() {
|
|
3336
3274
|
return re = Object.assign || function(i) {
|
|
3337
3275
|
for (var t, e = 1, n = arguments.length; e < n; e++) {
|
|
@@ -3340,23 +3278,23 @@ var re = function() {
|
|
|
3340
3278
|
}
|
|
3341
3279
|
return i;
|
|
3342
3280
|
}, re.apply(this, arguments);
|
|
3343
|
-
},
|
|
3281
|
+
}, Ls = function(i, t) {
|
|
3344
3282
|
var e = {};
|
|
3345
3283
|
for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && t.indexOf(n) < 0 && (e[n] = i[n]);
|
|
3346
3284
|
if (i != null && typeof Object.getOwnPropertySymbols == "function")
|
|
3347
3285
|
for (var r = 0, n = Object.getOwnPropertySymbols(i); r < n.length; r++)
|
|
3348
3286
|
t.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, n[r]) && (e[n[r]] = i[n[r]]);
|
|
3349
3287
|
return e;
|
|
3350
|
-
},
|
|
3351
|
-
var e = i.icon, n = i.id, r = i.className, s = i.extend, o =
|
|
3352
|
-
return
|
|
3288
|
+
}, br = hr(function(i, t) {
|
|
3289
|
+
var e = i.icon, n = i.id, r = i.className, s = i.extend, o = Ls(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(n, " ").concat(r || "").trim(), d = os("_".concat(Xs()));
|
|
3290
|
+
return Rr(e, "".concat(n), { defIds: e.defIds, idSuffix: d.current }, re({ ref: t, className: a }, o), s);
|
|
3353
3291
|
});
|
|
3354
|
-
function
|
|
3355
|
-
return
|
|
3356
|
-
return
|
|
3292
|
+
function Rr(i, t, e, n, r) {
|
|
3293
|
+
return gr(i.tag, re(re({ key: t }, Ys(i, e, r)), n), (Gs(i, e).children || []).map(function(s, o) {
|
|
3294
|
+
return Rr(s, "".concat(t, "-").concat(i.tag, "-").concat(o), e, void 0, r);
|
|
3357
3295
|
}));
|
|
3358
3296
|
}
|
|
3359
|
-
function
|
|
3297
|
+
function Ys(i, t, e) {
|
|
3360
3298
|
var n = re({}, i.attrs);
|
|
3361
3299
|
e != null && e.colorChannel1 && n.fill === "colorChannel1" && (n.fill = e.colorChannel1), i.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(function(s) {
|
|
3362
3300
|
var o = s[0], a = s[1];
|
|
@@ -3368,25 +3306,25 @@ function to(i, t, e) {
|
|
|
3368
3306
|
typeof a == "string" && (n[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
3369
3307
|
})), n;
|
|
3370
3308
|
}
|
|
3371
|
-
function
|
|
3309
|
+
function Gs(i, t) {
|
|
3372
3310
|
var e, n = t.defIds;
|
|
3373
3311
|
return !n || n.length === 0 ? i : i.tag === "defs" && (!((e = i.children) === null || e === void 0) && e.length) ? re(re({}, i), { children: i.children.map(function(r) {
|
|
3374
3312
|
return typeof r.attrs.id == "string" && n && n.indexOf(r.attrs.id) > -1 ? re(re({}, r), { attrs: re(re({}, r.attrs), { id: r.attrs.id + t.idSuffix }) }) : r;
|
|
3375
3313
|
}) }) : i;
|
|
3376
3314
|
}
|
|
3377
|
-
function
|
|
3315
|
+
function Xs() {
|
|
3378
3316
|
return Math.random().toString(36).substring(2, 8);
|
|
3379
3317
|
}
|
|
3380
|
-
|
|
3381
|
-
var
|
|
3382
|
-
return
|
|
3318
|
+
br.displayName = "UniverIcon";
|
|
3319
|
+
var Vs = { 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" } }] }, Mr = hr(function(i, t) {
|
|
3320
|
+
return gr(br, Object.assign({}, i, {
|
|
3383
3321
|
id: "add-image-single",
|
|
3384
3322
|
ref: t,
|
|
3385
|
-
icon:
|
|
3323
|
+
icon: Vs
|
|
3386
3324
|
}));
|
|
3387
3325
|
});
|
|
3388
|
-
|
|
3389
|
-
const
|
|
3326
|
+
Mr.displayName = "AddImageSingle";
|
|
3327
|
+
const yr = {
|
|
3390
3328
|
id: "sheet.command.delete-drawing",
|
|
3391
3329
|
type: J.COMMAND,
|
|
3392
3330
|
handler: (i) => {
|
|
@@ -3394,113 +3332,106 @@ const Ar = {
|
|
|
3394
3332
|
if (n.length === 0)
|
|
3395
3333
|
return !1;
|
|
3396
3334
|
const r = n[0].unitId, s = n.map((o) => {
|
|
3397
|
-
const { unitId: a, subUnitId:
|
|
3335
|
+
const { unitId: a, subUnitId: d, drawingId: u, drawingType: c } = o;
|
|
3398
3336
|
return {
|
|
3399
3337
|
unitId: a,
|
|
3400
|
-
subUnitId:
|
|
3338
|
+
subUnitId: d,
|
|
3401
3339
|
drawingId: u,
|
|
3402
|
-
drawingType:
|
|
3340
|
+
drawingType: c
|
|
3403
3341
|
};
|
|
3404
3342
|
});
|
|
3405
|
-
return t.executeCommand(
|
|
3343
|
+
return t.executeCommand(rt.id, {
|
|
3406
3344
|
unitId: r,
|
|
3407
3345
|
drawings: s
|
|
3408
3346
|
});
|
|
3409
3347
|
}
|
|
3410
|
-
},
|
|
3348
|
+
}, it = {
|
|
3411
3349
|
id: "sheet.command.move-drawing",
|
|
3412
3350
|
type: J.COMMAND,
|
|
3413
3351
|
handler: (i, t) => {
|
|
3414
|
-
const e = i.get(G), n = i.get(oe), r = i.get(
|
|
3352
|
+
const e = i.get(G), n = i.get(oe), r = i.get(Ge), { direction: s } = t, o = n.getFocusDrawings();
|
|
3415
3353
|
if (o.length === 0)
|
|
3416
3354
|
return !1;
|
|
3417
|
-
const a = o[0].unitId,
|
|
3418
|
-
const { transform: l } =
|
|
3355
|
+
const a = o[0].unitId, d = o.map((c) => {
|
|
3356
|
+
const { transform: l } = c;
|
|
3419
3357
|
if (l == null)
|
|
3420
3358
|
return null;
|
|
3421
|
-
const g = { ...l }, { left: h = 0, top:
|
|
3422
|
-
return s ===
|
|
3423
|
-
...
|
|
3359
|
+
const g = { ...l }, { left: h = 0, top: m = 0 } = l;
|
|
3360
|
+
return s === ve.UP ? g.top = m - 1 : s === ve.DOWN ? g.top = m + 1 : s === ve.LEFT ? g.left = h - 1 : s === ve.RIGHT && (g.left = h + 1), {
|
|
3361
|
+
...c,
|
|
3424
3362
|
transform: g,
|
|
3425
3363
|
sheetTransform: x(g, r)
|
|
3426
3364
|
};
|
|
3427
|
-
}).filter((
|
|
3428
|
-
return e.syncExecuteCommand(
|
|
3365
|
+
}).filter((c) => c != null);
|
|
3366
|
+
return e.syncExecuteCommand(jt.id, {
|
|
3429
3367
|
unitId: a,
|
|
3430
|
-
drawings:
|
|
3431
|
-
}) ? (e.syncExecuteCommand(
|
|
3368
|
+
drawings: d
|
|
3369
|
+
}) ? (e.syncExecuteCommand(L.id, [a]), !0) : !1;
|
|
3432
3370
|
}
|
|
3433
|
-
},
|
|
3434
|
-
function
|
|
3371
|
+
}, Er = "addition-and-subtraction-single", Tr = "sheet.menu.image";
|
|
3372
|
+
function Hs(i) {
|
|
3435
3373
|
return {
|
|
3436
|
-
id:
|
|
3437
|
-
type:
|
|
3438
|
-
icon:
|
|
3374
|
+
id: Tr,
|
|
3375
|
+
type: cn.SUBITEMS,
|
|
3376
|
+
icon: Er,
|
|
3439
3377
|
tooltip: "sheetImage.title",
|
|
3440
|
-
hidden$:
|
|
3441
|
-
disabled$:
|
|
3378
|
+
hidden$: an(i, F.UNIVER_SHEET),
|
|
3379
|
+
disabled$: Oi(i, { workbookTypes: [Kt], worksheetTypes: [Zt], rangeTypes: [ns] })
|
|
3442
3380
|
};
|
|
3443
3381
|
}
|
|
3444
|
-
function
|
|
3382
|
+
function zs(i) {
|
|
3445
3383
|
return {
|
|
3446
|
-
id:
|
|
3384
|
+
id: Bt.id,
|
|
3447
3385
|
title: "sheetImage.upload.float",
|
|
3448
|
-
type:
|
|
3449
|
-
hidden$:
|
|
3386
|
+
type: cn.BUTTON,
|
|
3387
|
+
hidden$: an(i, F.UNIVER_SHEET)
|
|
3450
3388
|
};
|
|
3451
3389
|
}
|
|
3452
|
-
function
|
|
3390
|
+
function Ks(i) {
|
|
3453
3391
|
return {
|
|
3454
|
-
id:
|
|
3392
|
+
id: ln.id,
|
|
3455
3393
|
title: "sheetImage.upload.cell",
|
|
3456
|
-
type:
|
|
3457
|
-
hidden$:
|
|
3394
|
+
type: cn.BUTTON,
|
|
3395
|
+
hidden$: an(i, F.UNIVER_SHEET)
|
|
3458
3396
|
};
|
|
3459
3397
|
}
|
|
3460
|
-
const
|
|
3461
|
-
imageCommonPanel: co,
|
|
3462
|
-
imageCommonPanelGrid: lo,
|
|
3463
|
-
imageCommonPanelBorder: uo,
|
|
3464
|
-
imageCommonPanelTitle: ho,
|
|
3465
|
-
imageCommonPanelRow: go,
|
|
3466
|
-
imageCommonPanelColumn: mo
|
|
3467
|
-
}, fo = (i) => {
|
|
3398
|
+
const Zs = (i) => {
|
|
3468
3399
|
var C;
|
|
3469
|
-
const t =
|
|
3400
|
+
const t = Qe(G), e = Qe(nt), n = Qe(se), r = Qe(q), { drawings: s } = i, o = s[0];
|
|
3470
3401
|
if (o == null)
|
|
3471
3402
|
return;
|
|
3472
|
-
const { unitId: a } = o,
|
|
3403
|
+
const { unitId: a } = o, d = r.getRenderById(a), u = d == null ? void 0 : d.scene;
|
|
3473
3404
|
if (u == null)
|
|
3474
3405
|
return;
|
|
3475
|
-
const
|
|
3476
|
-
function
|
|
3406
|
+
const c = u.getTransformerByCreate(), [l, g] = en(!0), h = (C = o.anchorType) != null ? C : O.Position, [m, p] = en(h);
|
|
3407
|
+
function f(b, v) {
|
|
3477
3408
|
const D = [];
|
|
3478
|
-
return b.forEach((
|
|
3479
|
-
const { oKey:
|
|
3409
|
+
return b.forEach((w) => {
|
|
3410
|
+
const { oKey: y } = w, I = v.getDrawingOKey(y);
|
|
3480
3411
|
if (I == null)
|
|
3481
3412
|
return D.push(null), !0;
|
|
3482
|
-
const { unitId: E, subUnitId: T, drawingId:
|
|
3413
|
+
const { unitId: E, subUnitId: T, drawingId: M, drawingType: R, anchorType: N, sheetTransform: B } = I;
|
|
3483
3414
|
D.push({
|
|
3484
3415
|
unitId: E,
|
|
3485
3416
|
subUnitId: T,
|
|
3486
|
-
drawingId:
|
|
3417
|
+
drawingId: M,
|
|
3487
3418
|
anchorType: N,
|
|
3488
|
-
sheetTransform:
|
|
3419
|
+
sheetTransform: B,
|
|
3489
3420
|
drawingType: R
|
|
3490
3421
|
});
|
|
3491
3422
|
}), D;
|
|
3492
3423
|
}
|
|
3493
|
-
|
|
3494
|
-
const b =
|
|
3424
|
+
fr(() => {
|
|
3425
|
+
const b = c.clearControl$.subscribe((D) => {
|
|
3495
3426
|
D === !0 && g(!1);
|
|
3496
|
-
}), v =
|
|
3427
|
+
}), v = c.changeStart$.subscribe((D) => {
|
|
3497
3428
|
var I;
|
|
3498
|
-
const { objects:
|
|
3499
|
-
if (
|
|
3429
|
+
const { objects: w } = D, y = f(w, n);
|
|
3430
|
+
if (y.length === 0)
|
|
3500
3431
|
g(!1);
|
|
3501
|
-
else if (
|
|
3432
|
+
else if (y.length >= 1) {
|
|
3502
3433
|
g(!0);
|
|
3503
|
-
const E = ((I =
|
|
3434
|
+
const E = ((I = y[0]) == null ? void 0 : I.anchorType) || O.Position;
|
|
3504
3435
|
p(E);
|
|
3505
3436
|
}
|
|
3506
3437
|
});
|
|
@@ -3508,153 +3439,178 @@ const co = "univer-image-common-panel", lo = "univer-image-common-panel-grid", u
|
|
|
3508
3439
|
v.unsubscribe(), b.unsubscribe();
|
|
3509
3440
|
};
|
|
3510
3441
|
}, []);
|
|
3511
|
-
function
|
|
3442
|
+
function _(b) {
|
|
3512
3443
|
p(b);
|
|
3513
3444
|
const v = n.getFocusDrawings();
|
|
3514
3445
|
if (v.length === 0)
|
|
3515
3446
|
return;
|
|
3516
|
-
const D = v.map((
|
|
3517
|
-
unitId:
|
|
3518
|
-
subUnitId:
|
|
3519
|
-
drawingId:
|
|
3447
|
+
const D = v.map((w) => ({
|
|
3448
|
+
unitId: w.unitId,
|
|
3449
|
+
subUnitId: w.subUnitId,
|
|
3450
|
+
drawingId: w.drawingId,
|
|
3520
3451
|
anchorType: b
|
|
3521
3452
|
}));
|
|
3522
|
-
t.executeCommand(
|
|
3453
|
+
t.executeCommand(jt.id, {
|
|
3523
3454
|
unitId: v[0].unitId,
|
|
3524
3455
|
drawings: D
|
|
3525
3456
|
});
|
|
3526
3457
|
}
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3458
|
+
return /* @__PURE__ */ Qt(
|
|
3459
|
+
"div",
|
|
3460
|
+
{
|
|
3461
|
+
className: `
|
|
3462
|
+
univer-relative univer-mt-5 univer-w-full univer-border-b-0 univer-border-l-0 univer-border-r-0
|
|
3463
|
+
univer-border-t univer-border-solid univer-border-gray-200
|
|
3464
|
+
`,
|
|
3465
|
+
style: { display: ((b) => b ? "block" : "none")(l) },
|
|
3466
|
+
children: [
|
|
3467
|
+
/* @__PURE__ */ Z(
|
|
3468
|
+
"div",
|
|
3469
|
+
{
|
|
3470
|
+
className: `
|
|
3471
|
+
univer-relative univer-mt-2.5 univer-flex univer-h-full univer-items-start univer-justify-start
|
|
3472
|
+
`,
|
|
3473
|
+
children: /* @__PURE__ */ Z("div", { className: "univer-w-full univer-text-left univer-text-gray-400", children: /* @__PURE__ */ Z("div", { children: e.t("drawing-anchor.title") }) })
|
|
3474
|
+
}
|
|
3475
|
+
),
|
|
3476
|
+
/* @__PURE__ */ Z(
|
|
3477
|
+
"div",
|
|
3478
|
+
{
|
|
3479
|
+
className: `
|
|
3480
|
+
univer-relative univer-mt-2.5 univer-flex univer-h-full univer-items-start univer-justify-start
|
|
3481
|
+
`,
|
|
3482
|
+
children: /* @__PURE__ */ Z("div", { className: "univer-flex univer-items-center univer-gap-1", children: /* @__PURE__ */ Qt(vi, { value: m, onChange: _, direction: "vertical", children: [
|
|
3483
|
+
/* @__PURE__ */ Z(Gt, { value: O.Both, children: e.t("drawing-anchor.both") }),
|
|
3484
|
+
/* @__PURE__ */ Z(Gt, { value: O.Position, children: e.t("drawing-anchor.position") }),
|
|
3485
|
+
/* @__PURE__ */ Z(Gt, { value: O.None, children: e.t("drawing-anchor.none") })
|
|
3486
|
+
] }) })
|
|
3487
|
+
}
|
|
3488
|
+
)
|
|
3489
|
+
]
|
|
3490
|
+
}
|
|
3491
|
+
);
|
|
3492
|
+
}, Js = () => {
|
|
3493
|
+
const i = Qe(se), t = i.getFocusDrawings(), [e, n] = en(t);
|
|
3494
|
+
return fr(() => {
|
|
3539
3495
|
const r = i.focus$.subscribe((s) => {
|
|
3540
3496
|
n(s);
|
|
3541
3497
|
});
|
|
3542
3498
|
return () => {
|
|
3543
3499
|
r.unsubscribe();
|
|
3544
3500
|
};
|
|
3545
|
-
}, []), !!(e != null && e.length) && /* @__PURE__ */
|
|
3546
|
-
/* @__PURE__ */
|
|
3547
|
-
/* @__PURE__ */
|
|
3501
|
+
}, []), !!(e != null && e.length) && /* @__PURE__ */ Qt("div", { className: "univer-p-2 univer-text-center univer-text-sm", children: [
|
|
3502
|
+
/* @__PURE__ */ Z(ui, { drawings: e }),
|
|
3503
|
+
/* @__PURE__ */ Z(Zs, { drawings: e })
|
|
3548
3504
|
] });
|
|
3549
|
-
},
|
|
3550
|
-
[
|
|
3551
|
-
[
|
|
3505
|
+
}, qs = {
|
|
3506
|
+
[Bi.FORMULAS_INSERT]: {
|
|
3507
|
+
[Tr]: {
|
|
3552
3508
|
order: 3,
|
|
3553
|
-
menuItemFactory:
|
|
3554
|
-
[
|
|
3509
|
+
menuItemFactory: Hs,
|
|
3510
|
+
[Bt.id]: {
|
|
3555
3511
|
order: 0,
|
|
3556
|
-
menuItemFactory:
|
|
3512
|
+
menuItemFactory: zs
|
|
3557
3513
|
},
|
|
3558
|
-
[
|
|
3514
|
+
[ln.id]: {
|
|
3559
3515
|
order: 1,
|
|
3560
|
-
menuItemFactory:
|
|
3516
|
+
menuItemFactory: Ks
|
|
3561
3517
|
}
|
|
3562
3518
|
}
|
|
3563
3519
|
}
|
|
3564
3520
|
};
|
|
3565
|
-
function
|
|
3566
|
-
return !i.getContextValue(
|
|
3521
|
+
function st(i) {
|
|
3522
|
+
return !i.getContextValue(zr) && !i.getContextValue(Kr) && !i.getContextValue(Zr) && i.getContextValue(xe);
|
|
3567
3523
|
}
|
|
3568
|
-
const
|
|
3569
|
-
id:
|
|
3524
|
+
const Qs = {
|
|
3525
|
+
id: it.id,
|
|
3570
3526
|
description: "shortcut.drawing-move-down",
|
|
3571
3527
|
group: "4_drawing-view",
|
|
3572
|
-
binding:
|
|
3528
|
+
binding: Fe.ARROW_DOWN,
|
|
3573
3529
|
priority: 100,
|
|
3574
|
-
preconditions:
|
|
3530
|
+
preconditions: st,
|
|
3575
3531
|
staticParameters: {
|
|
3576
|
-
direction:
|
|
3532
|
+
direction: ve.DOWN
|
|
3577
3533
|
}
|
|
3578
|
-
},
|
|
3579
|
-
id:
|
|
3534
|
+
}, eo = {
|
|
3535
|
+
id: it.id,
|
|
3580
3536
|
description: "shortcut.drawing-move-up",
|
|
3581
3537
|
group: "4_drawing-view",
|
|
3582
|
-
binding:
|
|
3538
|
+
binding: Fe.ARROW_UP,
|
|
3583
3539
|
priority: 100,
|
|
3584
|
-
preconditions:
|
|
3540
|
+
preconditions: st,
|
|
3585
3541
|
staticParameters: {
|
|
3586
|
-
direction:
|
|
3542
|
+
direction: ve.UP
|
|
3587
3543
|
}
|
|
3588
|
-
},
|
|
3589
|
-
id:
|
|
3544
|
+
}, to = {
|
|
3545
|
+
id: it.id,
|
|
3590
3546
|
description: "shortcut.drawing-move-left",
|
|
3591
3547
|
group: "4_drawing-view",
|
|
3592
|
-
binding:
|
|
3548
|
+
binding: Fe.ARROW_LEFT,
|
|
3593
3549
|
priority: 100,
|
|
3594
|
-
preconditions:
|
|
3550
|
+
preconditions: st,
|
|
3595
3551
|
staticParameters: {
|
|
3596
|
-
direction:
|
|
3552
|
+
direction: ve.LEFT
|
|
3597
3553
|
}
|
|
3598
|
-
},
|
|
3599
|
-
id:
|
|
3554
|
+
}, no = {
|
|
3555
|
+
id: it.id,
|
|
3600
3556
|
description: "shortcut.drawing-move-right",
|
|
3601
3557
|
group: "4_drawing-view",
|
|
3602
|
-
binding:
|
|
3558
|
+
binding: Fe.ARROW_RIGHT,
|
|
3603
3559
|
priority: 100,
|
|
3604
|
-
preconditions:
|
|
3560
|
+
preconditions: st,
|
|
3605
3561
|
staticParameters: {
|
|
3606
|
-
direction:
|
|
3562
|
+
direction: ve.RIGHT
|
|
3607
3563
|
}
|
|
3608
|
-
},
|
|
3609
|
-
id:
|
|
3564
|
+
}, ro = {
|
|
3565
|
+
id: yr.id,
|
|
3610
3566
|
description: "shortcut.drawing-delete",
|
|
3611
3567
|
group: "4_drawing-view",
|
|
3612
3568
|
// when focusing on any other input tag do not trigger this shortcut
|
|
3613
|
-
preconditions:
|
|
3614
|
-
binding:
|
|
3615
|
-
mac:
|
|
3569
|
+
preconditions: st,
|
|
3570
|
+
binding: Fe.DELETE,
|
|
3571
|
+
mac: Fe.BACKSPACE
|
|
3616
3572
|
};
|
|
3617
|
-
var
|
|
3618
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
3573
|
+
var io = Object.getOwnPropertyDescriptor, so = (i, t, e, n) => {
|
|
3574
|
+
for (var r = n > 1 ? void 0 : n ? io(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
3619
3575
|
(o = i[s]) && (r = o(r) || r);
|
|
3620
3576
|
return r;
|
|
3621
|
-
},
|
|
3622
|
-
let
|
|
3577
|
+
}, We = (i, t) => (e, n) => t(e, n, i);
|
|
3578
|
+
let Pt = class extends ie {
|
|
3623
3579
|
constructor(i, t, e, n, r, s) {
|
|
3624
3580
|
super(), this._componentManager = i, this._menuManagerService = t, this._commandService = e, this._shortcutService = n, this._drawingManagerService = r, this._sheetsSelectionsService = s, this._init();
|
|
3625
3581
|
}
|
|
3626
3582
|
_initCustomComponents() {
|
|
3627
3583
|
const i = this._componentManager;
|
|
3628
|
-
this.disposeWithMe(i.register(
|
|
3584
|
+
this.disposeWithMe(i.register(Er, Mr)), this.disposeWithMe(i.register(mr, Js));
|
|
3629
3585
|
}
|
|
3630
3586
|
_initMenus() {
|
|
3631
|
-
this._menuManagerService.mergeMenu(
|
|
3587
|
+
this._menuManagerService.mergeMenu(qs);
|
|
3632
3588
|
}
|
|
3633
3589
|
_initCommands() {
|
|
3634
3590
|
[
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3591
|
+
Bt,
|
|
3592
|
+
ln,
|
|
3593
|
+
Wt,
|
|
3594
|
+
rt,
|
|
3595
|
+
jt,
|
|
3596
|
+
pr,
|
|
3597
|
+
L,
|
|
3598
|
+
wr,
|
|
3599
|
+
_r,
|
|
3600
|
+
Sr,
|
|
3601
|
+
it,
|
|
3644
3602
|
yr,
|
|
3645
|
-
|
|
3646
|
-
Ar,
|
|
3647
|
-
Rr
|
|
3603
|
+
vr
|
|
3648
3604
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
3649
3605
|
}
|
|
3650
3606
|
_initShortcuts() {
|
|
3651
3607
|
[
|
|
3652
3608
|
// sheet drawing shortcuts
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3609
|
+
Qs,
|
|
3610
|
+
eo,
|
|
3611
|
+
to,
|
|
3612
|
+
no,
|
|
3613
|
+
ro
|
|
3658
3614
|
].forEach((i) => {
|
|
3659
3615
|
this.disposeWithMe(this._shortcutService.registerShortcut(i));
|
|
3660
3616
|
});
|
|
@@ -3663,97 +3619,97 @@ let Wt = class extends ie {
|
|
|
3663
3619
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
3664
3620
|
}
|
|
3665
3621
|
};
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
],
|
|
3674
|
-
var
|
|
3675
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
3622
|
+
Pt = so([
|
|
3623
|
+
We(0, A(zn)),
|
|
3624
|
+
We(1, $i),
|
|
3625
|
+
We(2, G),
|
|
3626
|
+
We(3, xi),
|
|
3627
|
+
We(4, se),
|
|
3628
|
+
We(5, A(dn))
|
|
3629
|
+
], Pt);
|
|
3630
|
+
var oo = Object.defineProperty, ao = Object.getOwnPropertyDescriptor, co = (i, t, e) => t in i ? oo(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, lo = (i, t, e, n) => {
|
|
3631
|
+
for (var r = n > 1 ? void 0 : n ? ao(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
3676
3632
|
(o = i[s]) && (r = o(r) || r);
|
|
3677
3633
|
return r;
|
|
3678
|
-
},
|
|
3679
|
-
const
|
|
3680
|
-
let
|
|
3681
|
-
constructor(i =
|
|
3634
|
+
}, Vt = (i, t) => (e, n) => t(e, n, i), Or = (i, t, e) => co(i, typeof t != "symbol" ? t + "" : t, e);
|
|
3635
|
+
const uo = "SHEET_IMAGE_UI_PLUGIN";
|
|
3636
|
+
let At = class extends Qr {
|
|
3637
|
+
constructor(i = $n, t, e, n) {
|
|
3682
3638
|
super(), this._config = i, this._injector = t, this._renderManagerService = e, this._configService = n;
|
|
3683
|
-
const { menu: r, ...s } =
|
|
3639
|
+
const { menu: r, ...s } = ei(
|
|
3684
3640
|
{},
|
|
3685
|
-
|
|
3641
|
+
$n,
|
|
3686
3642
|
this._config
|
|
3687
3643
|
);
|
|
3688
|
-
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(
|
|
3644
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(as, s);
|
|
3689
3645
|
}
|
|
3690
3646
|
onStarting() {
|
|
3691
|
-
|
|
3692
|
-
[
|
|
3693
|
-
[Wt],
|
|
3694
|
-
[Ot],
|
|
3695
|
-
[Bt],
|
|
3696
|
-
[kt],
|
|
3697
|
-
[Nt],
|
|
3647
|
+
ti(this._injector, [
|
|
3648
|
+
[tt],
|
|
3698
3649
|
[Pt],
|
|
3650
|
+
[Rt],
|
|
3699
3651
|
[Ut],
|
|
3700
|
-
[
|
|
3701
|
-
|
|
3702
|
-
[
|
|
3652
|
+
[Ot],
|
|
3653
|
+
[Tt],
|
|
3654
|
+
[Mt],
|
|
3655
|
+
[yt],
|
|
3656
|
+
[Et]
|
|
3657
|
+
]), Ft(this._injector, [
|
|
3658
|
+
[tt]
|
|
3703
3659
|
]);
|
|
3704
3660
|
}
|
|
3705
3661
|
onReady() {
|
|
3706
|
-
|
|
3707
|
-
[
|
|
3708
|
-
[
|
|
3662
|
+
Ft(this._injector, [
|
|
3663
|
+
[Tt],
|
|
3664
|
+
[Et]
|
|
3709
3665
|
]);
|
|
3710
3666
|
}
|
|
3711
3667
|
onRendered() {
|
|
3712
|
-
this._registerRenderModules(),
|
|
3713
|
-
[
|
|
3714
|
-
[
|
|
3715
|
-
[Wt],
|
|
3668
|
+
this._registerRenderModules(), Ft(this._injector, [
|
|
3669
|
+
[Ot],
|
|
3670
|
+
[Ut],
|
|
3716
3671
|
[Pt],
|
|
3717
|
-
[
|
|
3672
|
+
[Mt],
|
|
3673
|
+
[yt]
|
|
3718
3674
|
]);
|
|
3719
3675
|
}
|
|
3720
3676
|
onSteady() {
|
|
3721
|
-
this._injector.get(
|
|
3677
|
+
this._injector.get(Rt);
|
|
3722
3678
|
}
|
|
3723
3679
|
_registerRenderModules() {
|
|
3724
3680
|
[
|
|
3725
|
-
[
|
|
3726
|
-
[
|
|
3727
|
-
[
|
|
3728
|
-
[
|
|
3681
|
+
[et],
|
|
3682
|
+
[sn],
|
|
3683
|
+
[nn],
|
|
3684
|
+
[tn]
|
|
3729
3685
|
].forEach((i) => {
|
|
3730
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
3686
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(F.UNIVER_SHEET, i));
|
|
3731
3687
|
});
|
|
3732
3688
|
}
|
|
3733
3689
|
};
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
],
|
|
3690
|
+
Or(At, "type", F.UNIVER_SHEET);
|
|
3691
|
+
Or(At, "pluginName", uo);
|
|
3692
|
+
At = lo([
|
|
3693
|
+
Jr(oi, ri, hi, pi),
|
|
3694
|
+
Vt(1, A(Ye)),
|
|
3695
|
+
Vt(2, q),
|
|
3696
|
+
Vt(3, qr)
|
|
3697
|
+
], At);
|
|
3742
3698
|
export {
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3699
|
+
L as ClearSheetDrawingTransformerOperation,
|
|
3700
|
+
yr as DeleteDrawingsCommand,
|
|
3701
|
+
wr as EditSheetDrawingOperation,
|
|
3702
|
+
_r as GroupSheetDrawingCommand,
|
|
3703
|
+
Bt as InsertFloatImageCommand,
|
|
3704
|
+
Wt as InsertSheetDrawingCommand,
|
|
3705
|
+
it as MoveDrawingsCommand,
|
|
3706
|
+
rt as RemoveSheetDrawingCommand,
|
|
3707
|
+
Tr as SHEETS_IMAGE_MENU_ID,
|
|
3708
|
+
vr as SetDrawingArrangeCommand,
|
|
3709
|
+
jt as SetSheetDrawingCommand,
|
|
3710
|
+
tt as SheetCanvasFloatDomManagerService,
|
|
3711
|
+
et as SheetDrawingUpdateController,
|
|
3712
|
+
pr as SidebarSheetDrawingOperation,
|
|
3713
|
+
Sr as UngroupSheetDrawingCommand,
|
|
3714
|
+
At as UniverSheetsDrawingUIPlugin
|
|
3759
3715
|
};
|