@univerjs/sheets-drawing-ui 0.6.10 → 0.7.0-nightly.202504291607
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 +1416 -1461
- package/lib/index.css +1 -1
- package/lib/index.js +1416 -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 -16
- package/LICENSE +0 -176
- 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,117 @@ 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
|
-
const { unitId: n, subUnitId: r, drawingId: s } = e, o =
|
|
1741
|
+
const { unitId: n, subUnitId: r, drawingId: s } = e, o = Ie({ unitId: n, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(n);
|
|
1747
1742
|
if (a == null)
|
|
1748
1743
|
return;
|
|
1749
|
-
const { transformer:
|
|
1750
|
-
|
|
1744
|
+
const { transformer: d, scene: u } = a, c = u.getObject(o);
|
|
1745
|
+
c != null && c.oKey && d.clearControlByIds([c == null ? void 0 : c.oKey]);
|
|
1751
1746
|
});
|
|
1752
1747
|
})
|
|
1753
1748
|
);
|
|
1754
1749
|
}
|
|
1755
1750
|
_scrollUpdateListener() {
|
|
1756
1751
|
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 = (
|
|
1752
|
+
var d;
|
|
1753
|
+
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
1754
|
!r || !o || !a || s.forEach((u) => {
|
|
1760
|
-
const
|
|
1761
|
-
if (
|
|
1762
|
-
const l =
|
|
1763
|
-
|
|
1755
|
+
const c = this._domLayerInfoMap.get(u);
|
|
1756
|
+
if (c) {
|
|
1757
|
+
const l = fe(c.rect, r.renderUnit.scene, a.skeleton, o.worksheet, c);
|
|
1758
|
+
c.position$.next(l);
|
|
1764
1759
|
}
|
|
1765
1760
|
});
|
|
1766
1761
|
};
|
|
1767
1762
|
this.disposeWithMe(
|
|
1768
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1769
|
-
|
|
1770
|
-
|
|
1763
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(
|
|
1764
|
+
_e((e) => e ? e.activeSheet$ : Nn(null)),
|
|
1765
|
+
Me((e) => {
|
|
1771
1766
|
if (!e) return null;
|
|
1772
1767
|
const n = e.getUnitId(), r = this._renderManagerService.getRenderById(n);
|
|
1773
1768
|
return r ? { render: r, unitId: n, subUnitId: e.getSheetId() } : null;
|
|
1774
1769
|
}),
|
|
1775
|
-
|
|
1776
|
-
(e) => e ?
|
|
1770
|
+
_e(
|
|
1771
|
+
(e) => e ? Xr(e.render.scene.getViewport(Xn.VIEW_MAIN).onScrollAfter$).pipe(Me(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : Nn(null)
|
|
1777
1772
|
)
|
|
1778
1773
|
).subscribe((e) => {
|
|
1779
1774
|
if (!e) return;
|
|
@@ -1781,12 +1776,12 @@ let rt = class extends ie {
|
|
|
1781
1776
|
t(n, r);
|
|
1782
1777
|
})
|
|
1783
1778
|
), this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
|
|
1784
|
-
if (e.id ===
|
|
1779
|
+
if (e.id === On.id) {
|
|
1785
1780
|
const n = e.params, { unitId: r } = n;
|
|
1786
1781
|
Array.from(this._domLayerInfoMap.values()).filter((o) => o.unitId === r).map((o) => o.subUnitId).forEach((o) => {
|
|
1787
1782
|
t(r, o);
|
|
1788
1783
|
});
|
|
1789
|
-
} else if (e.id ===
|
|
1784
|
+
} else if (e.id === Vi.id) {
|
|
1790
1785
|
const { unitId: n, subUnitId: r } = e.params;
|
|
1791
1786
|
t(n, r);
|
|
1792
1787
|
}
|
|
@@ -1794,25 +1789,25 @@ let rt = class extends ie {
|
|
|
1794
1789
|
}
|
|
1795
1790
|
_getPosition(t, e) {
|
|
1796
1791
|
var g;
|
|
1797
|
-
const { startX: n, endX: r, startY: s, endY: o } = t, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(
|
|
1792
|
+
const { startX: n, endX: r, startY: s, endY: o } = t, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(Ge);
|
|
1798
1793
|
if (a == null)
|
|
1799
1794
|
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);
|
|
1795
|
+
const d = a.getCellWithCoordByOffset(n, s);
|
|
1809
1796
|
if (d == null)
|
|
1810
1797
|
return;
|
|
1811
|
-
const
|
|
1798
|
+
const u = {
|
|
1812
1799
|
column: d.actualColumn,
|
|
1813
|
-
columnOffset:
|
|
1800
|
+
columnOffset: n - d.startX,
|
|
1814
1801
|
row: d.actualRow,
|
|
1815
|
-
rowOffset:
|
|
1802
|
+
rowOffset: s - d.startY
|
|
1803
|
+
}, c = a.getCellWithCoordByOffset(r, o);
|
|
1804
|
+
if (c == null)
|
|
1805
|
+
return;
|
|
1806
|
+
const l = {
|
|
1807
|
+
column: c.actualColumn,
|
|
1808
|
+
columnOffset: r - c.startX,
|
|
1809
|
+
row: c.actualRow,
|
|
1810
|
+
rowOffset: o - c.startY
|
|
1816
1811
|
};
|
|
1817
1812
|
return {
|
|
1818
1813
|
from: u,
|
|
@@ -1824,7 +1819,7 @@ let rt = class extends ie {
|
|
|
1824
1819
|
this._drawingManagerService.update$.subscribe((t) => {
|
|
1825
1820
|
t.forEach((e) => {
|
|
1826
1821
|
const n = this._drawingManagerService.getDrawingByParam(e);
|
|
1827
|
-
if (!n || n.drawingType !==
|
|
1822
|
+
if (!n || n.drawingType !== j.DRAWING_DOM && n.drawingType !== j.DRAWING_CHART)
|
|
1828
1823
|
return;
|
|
1829
1824
|
const r = {
|
|
1830
1825
|
...n.transform
|
|
@@ -1846,8 +1841,8 @@ let rt = class extends ie {
|
|
|
1846
1841
|
updateFloatDomProps(t, e, n, r) {
|
|
1847
1842
|
const s = this._domLayerInfoMap.get(n), o = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1848
1843
|
if (s && o) {
|
|
1849
|
-
const { scene: a } = o,
|
|
1850
|
-
u && u instanceof
|
|
1844
|
+
const { scene: a } = o, d = Ie({ unitId: t, subUnitId: e, drawingId: n }), u = a.getObject(d);
|
|
1845
|
+
u && u instanceof Ne && u.setProps(r);
|
|
1851
1846
|
}
|
|
1852
1847
|
}
|
|
1853
1848
|
// CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
|
|
@@ -1858,14 +1853,14 @@ let rt = class extends ie {
|
|
|
1858
1853
|
});
|
|
1859
1854
|
if (!n)
|
|
1860
1855
|
throw new Error("cannot find current target!");
|
|
1861
|
-
const { unitId: r, subUnitId: s } = n, { initPosition: o, componentKey: a, data:
|
|
1856
|
+
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
1857
|
if (l == null)
|
|
1863
1858
|
return;
|
|
1864
1859
|
const g = {
|
|
1865
1860
|
unitId: r,
|
|
1866
1861
|
subUnitId: s,
|
|
1867
|
-
drawingId:
|
|
1868
|
-
drawingType: t.type ||
|
|
1862
|
+
drawingId: c,
|
|
1863
|
+
drawingType: t.type || j.DRAWING_DOM,
|
|
1869
1864
|
componentKey: a,
|
|
1870
1865
|
sheetTransform: l,
|
|
1871
1866
|
transform: {
|
|
@@ -1874,16 +1869,16 @@ let rt = class extends ie {
|
|
|
1874
1869
|
width: o.endX - o.startX,
|
|
1875
1870
|
height: o.endY - o.startY
|
|
1876
1871
|
},
|
|
1877
|
-
data:
|
|
1872
|
+
data: d,
|
|
1878
1873
|
allowTransform: u
|
|
1879
1874
|
};
|
|
1880
|
-
return this._commandService.executeCommand(
|
|
1875
|
+
return this._commandService.executeCommand(Wt.id, {
|
|
1881
1876
|
unitId: r,
|
|
1882
1877
|
drawings: [g]
|
|
1883
|
-
}), this._add$.next({ unitId: r, subUnitId: s, id:
|
|
1884
|
-
id:
|
|
1878
|
+
}), this._add$.next({ unitId: r, subUnitId: s, id: c }), {
|
|
1879
|
+
id: c,
|
|
1885
1880
|
dispose: () => {
|
|
1886
|
-
this._removeDom(
|
|
1881
|
+
this._removeDom(c, !0);
|
|
1887
1882
|
}
|
|
1888
1883
|
};
|
|
1889
1884
|
}
|
|
@@ -1898,33 +1893,33 @@ let rt = class extends ie {
|
|
|
1898
1893
|
const a = this._drawingManagerService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: t });
|
|
1899
1894
|
if (!a)
|
|
1900
1895
|
return;
|
|
1901
|
-
const
|
|
1902
|
-
this._commandService.syncExecuteCommand(
|
|
1896
|
+
const d = this._sheetDrawingService.getBatchRemoveOp([a]), { redo: u, objects: c } = d;
|
|
1897
|
+
this._commandService.syncExecuteCommand(P.id, { unitId: r, subUnitId: s, op: u, objects: c, type: U.REMOVE });
|
|
1903
1898
|
}
|
|
1904
1899
|
}
|
|
1905
1900
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
1906
1901
|
addFloatDomToRange(t, e, n, r) {
|
|
1907
|
-
var D,
|
|
1902
|
+
var D, w, y;
|
|
1908
1903
|
const s = ae(this._univerInstanceService, {
|
|
1909
1904
|
unitId: e.unitId,
|
|
1910
1905
|
subUnitId: e.subUnitId
|
|
1911
1906
|
});
|
|
1912
1907
|
if (!s)
|
|
1913
1908
|
throw new Error("cannot find current target!");
|
|
1914
|
-
const { unitId: o, subUnitId: a } = s,
|
|
1915
|
-
if (!
|
|
1909
|
+
const { unitId: o, subUnitId: a } = s, d = this._getSceneAndTransformerByDrawingSearch(o);
|
|
1910
|
+
if (!d) return;
|
|
1916
1911
|
const u = this._renderManagerService.getRenderById(o);
|
|
1917
1912
|
if (!u) return;
|
|
1918
|
-
const
|
|
1919
|
-
if (!
|
|
1920
|
-
const { componentKey: l, data: g, allowTransform: h = !0 } = e,
|
|
1913
|
+
const c = (D = this._renderManagerService.getRenderById(o)) == null ? void 0 : D.with(V).getWorksheetSkeleton(a);
|
|
1914
|
+
if (!c) return;
|
|
1915
|
+
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
1916
|
if (this._getPosition(p, o) == null)
|
|
1922
1917
|
return;
|
|
1923
|
-
const S =
|
|
1918
|
+
const S = d.scene, { scaleX: C } = S.getAncestorScale(), b = Ct(p, n, C), v = {
|
|
1924
1919
|
unitId: o,
|
|
1925
1920
|
subUnitId: a,
|
|
1926
|
-
drawingId:
|
|
1927
|
-
drawingType: e.type ||
|
|
1921
|
+
drawingId: m,
|
|
1922
|
+
drawingType: e.type || j.DRAWING_DOM,
|
|
1928
1923
|
componentKey: l,
|
|
1929
1924
|
transform: {
|
|
1930
1925
|
left: b.startX,
|
|
@@ -1936,62 +1931,62 @@ let rt = class extends ie {
|
|
|
1936
1931
|
allowTransform: h
|
|
1937
1932
|
};
|
|
1938
1933
|
{
|
|
1939
|
-
const { unitId: I, subUnitId: E, drawingId: T } = v,
|
|
1934
|
+
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
1935
|
if (!N)
|
|
1941
1936
|
return;
|
|
1942
|
-
const
|
|
1943
|
-
if (!R || !
|
|
1937
|
+
const B = N.getActiveSheet().getSheetId();
|
|
1938
|
+
if (!R || !M)
|
|
1944
1939
|
return;
|
|
1945
|
-
const Q = (
|
|
1940
|
+
const Q = (w = this._renderManagerService.getRenderById(I)) == null ? void 0 : w.with(V);
|
|
1946
1941
|
if (!Q)
|
|
1947
1942
|
return;
|
|
1948
|
-
const
|
|
1949
|
-
if (!
|
|
1943
|
+
const H = Q.getWorksheetSkeleton(E);
|
|
1944
|
+
if (!H)
|
|
1950
1945
|
return;
|
|
1951
|
-
const { transform:
|
|
1952
|
-
if (Y !==
|
|
1946
|
+
const { transform: X, drawingType: Y, data: K } = R;
|
|
1947
|
+
if (Y !== j.DRAWING_DOM && Y !== j.DRAWING_CHART)
|
|
1953
1948
|
return;
|
|
1954
1949
|
const k = this._getSceneAndTransformerByDrawingSearch(I);
|
|
1955
1950
|
if (k == null)
|
|
1956
1951
|
return;
|
|
1957
|
-
const { scene: ce, canvas:
|
|
1958
|
-
if (
|
|
1952
|
+
const { scene: ce, canvas: ye } = k;
|
|
1953
|
+
if (X == null || B !== E)
|
|
1959
1954
|
return;
|
|
1960
|
-
const { left:
|
|
1961
|
-
if (
|
|
1962
|
-
|
|
1955
|
+
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);
|
|
1956
|
+
if (le != null) {
|
|
1957
|
+
le.transformByState({ left: ot, top: at, width: ct, height: dt, angle: $t, flipX: xt, flipY: lt, skewX: ut, skewY: Ee });
|
|
1963
1958
|
return;
|
|
1964
1959
|
}
|
|
1965
1960
|
const ee = {
|
|
1966
|
-
left:
|
|
1961
|
+
left: ot,
|
|
1967
1962
|
// from floatDomParam.transform
|
|
1968
|
-
top:
|
|
1969
|
-
width:
|
|
1970
|
-
height:
|
|
1963
|
+
top: at,
|
|
1964
|
+
width: ct,
|
|
1965
|
+
height: dt,
|
|
1971
1966
|
zIndex: this._drawingManagerService.getDrawingOrder(I, E).length - 1
|
|
1972
|
-
},
|
|
1973
|
-
if (
|
|
1974
|
-
const
|
|
1975
|
-
ee.fill =
|
|
1967
|
+
}, Te = Y === j.DRAWING_CHART;
|
|
1968
|
+
if (Te) {
|
|
1969
|
+
const W = K ? K.backgroundColor : "white";
|
|
1970
|
+
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
1971
|
}
|
|
1977
|
-
const
|
|
1978
|
-
|
|
1979
|
-
const
|
|
1980
|
-
top:
|
|
1981
|
-
left:
|
|
1982
|
-
bottom:
|
|
1983
|
-
right:
|
|
1984
|
-
},
|
|
1985
|
-
dispose:
|
|
1986
|
-
rect:
|
|
1987
|
-
boundsOfViewArea:
|
|
1972
|
+
const ue = new Ne(ht, ee);
|
|
1973
|
+
Te && ue.setObjectType(yn.CHART), ce.addObject(ue, Yt), R.allowTransform !== !1 && ce.attachTransformerTo(ue);
|
|
1974
|
+
const he = new wt(), gt = ce.getMainViewport(), { rowHeaderWidth: Oe, columnHeaderHeight: Xe } = H.skeleton, ft = {
|
|
1975
|
+
top: Xe,
|
|
1976
|
+
left: Oe,
|
|
1977
|
+
bottom: gt.bottom,
|
|
1978
|
+
right: gt.right
|
|
1979
|
+
}, ge = {
|
|
1980
|
+
dispose: he,
|
|
1981
|
+
rect: ue,
|
|
1982
|
+
boundsOfViewArea: ft,
|
|
1988
1983
|
domAnchor: n,
|
|
1989
1984
|
unitId: I,
|
|
1990
1985
|
subUnitId: E
|
|
1991
|
-
}, $ =
|
|
1992
|
-
|
|
1993
|
-
let
|
|
1994
|
-
position$:
|
|
1986
|
+
}, $ = fe(ue, k.renderUnit.scene, H.skeleton, M.worksheet, ge), Ue = new je($);
|
|
1987
|
+
ge.position$ = Ue;
|
|
1988
|
+
let Ve = {
|
|
1989
|
+
position$: Ue,
|
|
1995
1990
|
id: T,
|
|
1996
1991
|
componentKey: R.componentKey,
|
|
1997
1992
|
onPointerDown: () => {
|
|
@@ -2000,63 +1995,63 @@ let rt = class extends ie {
|
|
|
2000
1995
|
},
|
|
2001
1996
|
onPointerUp: () => {
|
|
2002
1997
|
},
|
|
2003
|
-
onWheel: (
|
|
2004
|
-
|
|
1998
|
+
onWheel: (W) => {
|
|
1999
|
+
ye.dispatchEvent(new WheelEvent(W.type, W));
|
|
2005
2000
|
},
|
|
2006
|
-
data:
|
|
2001
|
+
data: K,
|
|
2007
2002
|
unitId: I
|
|
2008
2003
|
};
|
|
2009
|
-
e.eventPassThrough && (
|
|
2010
|
-
...
|
|
2011
|
-
onPointerDown: (
|
|
2012
|
-
|
|
2004
|
+
e.eventPassThrough && (Ve = {
|
|
2005
|
+
...Ve,
|
|
2006
|
+
onPointerDown: (W) => {
|
|
2007
|
+
ye.dispatchEvent(new PointerEvent(W.type, W));
|
|
2013
2008
|
},
|
|
2014
|
-
onPointerMove: (
|
|
2015
|
-
|
|
2009
|
+
onPointerMove: (W) => {
|
|
2010
|
+
ye.dispatchEvent(new PointerEvent(W.type, W));
|
|
2016
2011
|
},
|
|
2017
|
-
onPointerUp: (
|
|
2018
|
-
|
|
2012
|
+
onPointerUp: (W) => {
|
|
2013
|
+
ye.dispatchEvent(new PointerEvent(W.type, W));
|
|
2019
2014
|
}
|
|
2020
|
-
}), this._canvasFloatDomService.addFloatDom(
|
|
2021
|
-
var
|
|
2022
|
-
const
|
|
2023
|
-
startX:
|
|
2024
|
-
startY:
|
|
2025
|
-
endX:
|
|
2026
|
-
endY:
|
|
2027
|
-
width: (
|
|
2028
|
-
height: (
|
|
2015
|
+
}), this._canvasFloatDomService.addFloatDom(Ve), this.disposeWithMe(f.subscribe((W) => {
|
|
2016
|
+
var hn, gn, fn, mn;
|
|
2017
|
+
const un = Ct({
|
|
2018
|
+
startX: W.startX,
|
|
2019
|
+
startY: W.startY,
|
|
2020
|
+
endX: W.endX,
|
|
2021
|
+
endY: W.endY,
|
|
2022
|
+
width: (hn = n.width) != null ? hn : W.width,
|
|
2023
|
+
height: (gn = n.height) != null ? gn : W.height,
|
|
2029
2024
|
absolute: {
|
|
2030
2025
|
left: p.absolute.left,
|
|
2031
2026
|
top: p.absolute.top
|
|
2032
2027
|
}
|
|
2033
|
-
}, n),
|
|
2034
|
-
left:
|
|
2035
|
-
top:
|
|
2036
|
-
width: (
|
|
2037
|
-
height: (
|
|
2028
|
+
}, n), Ur = Ie({ unitId: I, subUnitId: E, drawingId: T }), Pr = new Ne(Ur, {
|
|
2029
|
+
left: un.startX,
|
|
2030
|
+
top: un.startY,
|
|
2031
|
+
width: (fn = n.width) != null ? fn : W.width,
|
|
2032
|
+
height: (mn = n.height) != null ? mn : W.height,
|
|
2038
2033
|
zIndex: this._drawingManagerService.getDrawingOrder(I, E).length - 1
|
|
2039
|
-
}),
|
|
2040
|
-
|
|
2034
|
+
}), Ar = fe(Pr, k.renderUnit.scene, H.skeleton, M.worksheet, ge);
|
|
2035
|
+
Ue.next(Ar);
|
|
2041
2036
|
}));
|
|
2042
|
-
const
|
|
2043
|
-
|
|
2044
|
-
|
|
2037
|
+
const He = (y = this._renderManagerService.getRenderById(I)) == null ? void 0 : y.with(V);
|
|
2038
|
+
He == null || He.currentSkeleton$.subscribe((W) => {
|
|
2039
|
+
W && H.sheetId !== W.sheetId && this._removeDom(m, !0);
|
|
2045
2040
|
});
|
|
2046
|
-
const
|
|
2047
|
-
const
|
|
2048
|
-
|
|
2049
|
-
|
|
2041
|
+
const mt = ue.onTransformChange$.subscribeEvent(() => {
|
|
2042
|
+
const W = fe(ue, k.renderUnit.scene, H.skeleton, M.worksheet, ge);
|
|
2043
|
+
Ue.next(
|
|
2044
|
+
W
|
|
2050
2045
|
);
|
|
2051
2046
|
});
|
|
2052
|
-
|
|
2047
|
+
he.add(() => {
|
|
2053
2048
|
this._canvasFloatDomService.removeFloatDom(T);
|
|
2054
|
-
}),
|
|
2049
|
+
}), mt && he.add(mt), this._domLayerInfoMap.set(T, ge);
|
|
2055
2050
|
}
|
|
2056
2051
|
return {
|
|
2057
|
-
id:
|
|
2052
|
+
id: m,
|
|
2058
2053
|
dispose: () => {
|
|
2059
|
-
this._removeDom(
|
|
2054
|
+
this._removeDom(m, !0);
|
|
2060
2055
|
}
|
|
2061
2056
|
};
|
|
2062
2057
|
}
|
|
@@ -2073,57 +2068,57 @@ let rt = class extends ie {
|
|
|
2073
2068
|
if (!this._getSceneAndTransformerByDrawingSearch(o)) return;
|
|
2074
2069
|
const u = this._renderManagerService.getRenderById(o);
|
|
2075
2070
|
if (!u) return;
|
|
2076
|
-
const
|
|
2077
|
-
if (!
|
|
2078
|
-
const { componentKey: l, data: g, allowTransform: h = !0 } = e,
|
|
2071
|
+
const c = (b = this._renderManagerService.getRenderById(o)) == null ? void 0 : b.with(V).getWorksheetSkeleton(a);
|
|
2072
|
+
if (!c) return;
|
|
2073
|
+
const { componentKey: l, data: g, allowTransform: h = !0 } = e, m = r != null ? r : bt(), { position: p, position$: f } = this._createRangePositionObserver({
|
|
2079
2074
|
startRow: 0,
|
|
2080
2075
|
endRow: 0,
|
|
2081
2076
|
startColumn: t,
|
|
2082
2077
|
endColumn: t
|
|
2083
|
-
}, u,
|
|
2084
|
-
if (
|
|
2078
|
+
}, u, c.skeleton), _ = p;
|
|
2079
|
+
if (_.startY = 0, this._getPosition(p, o) == null)
|
|
2085
2080
|
return;
|
|
2086
2081
|
const C = {
|
|
2087
2082
|
unitId: o,
|
|
2088
2083
|
subUnitId: a,
|
|
2089
|
-
drawingId:
|
|
2090
|
-
drawingType: e.type ||
|
|
2084
|
+
drawingId: m,
|
|
2085
|
+
drawingType: e.type || j.DRAWING_DOM,
|
|
2091
2086
|
componentKey: l,
|
|
2092
2087
|
transform: {
|
|
2093
|
-
left:
|
|
2094
|
-
top:
|
|
2095
|
-
width:
|
|
2096
|
-
height:
|
|
2088
|
+
left: _.startX,
|
|
2089
|
+
top: _.startY,
|
|
2090
|
+
width: _.width,
|
|
2091
|
+
height: _.height
|
|
2097
2092
|
},
|
|
2098
2093
|
data: g,
|
|
2099
2094
|
allowTransform: h
|
|
2100
2095
|
};
|
|
2101
2096
|
{
|
|
2102
|
-
const { unitId:
|
|
2103
|
-
if (!
|
|
2097
|
+
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);
|
|
2098
|
+
if (!M)
|
|
2104
2099
|
return;
|
|
2105
|
-
const R =
|
|
2100
|
+
const R = M.getActiveSheet().getSheetId();
|
|
2106
2101
|
if (!T || !E)
|
|
2107
2102
|
return;
|
|
2108
|
-
const N = (v = this._renderManagerService.getRenderById(
|
|
2103
|
+
const N = (v = this._renderManagerService.getRenderById(w)) == null ? void 0 : v.with(V);
|
|
2109
2104
|
if (!N)
|
|
2110
2105
|
return;
|
|
2111
|
-
const
|
|
2112
|
-
if (!
|
|
2106
|
+
const B = N.getWorksheetSkeleton(y);
|
|
2107
|
+
if (!B)
|
|
2113
2108
|
return;
|
|
2114
|
-
const { transform: Q, data:
|
|
2115
|
-
if (
|
|
2109
|
+
const { transform: Q, data: H } = T, X = this._getSceneAndTransformerByDrawingSearch(w);
|
|
2110
|
+
if (X == null)
|
|
2116
2111
|
return;
|
|
2117
|
-
const { scene: Y, canvas:
|
|
2118
|
-
if (Q == null || R !==
|
|
2112
|
+
const { scene: Y, canvas: K } = X;
|
|
2113
|
+
if (Q == null || R !== y)
|
|
2119
2114
|
return;
|
|
2120
|
-
const { left: k, top: ce, width:
|
|
2121
|
-
if (
|
|
2122
|
-
|
|
2115
|
+
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);
|
|
2116
|
+
if (ut != null) {
|
|
2117
|
+
ut.transformByState({ left: k, top: ce, width: ye, height: ot, angle: at, flipX: ct, flipY: dt, skewX: $t, skewY: xt });
|
|
2123
2118
|
return;
|
|
2124
2119
|
}
|
|
2125
|
-
const
|
|
2126
|
-
startX:
|
|
2120
|
+
const Ee = Ct({
|
|
2121
|
+
startX: _.startX,
|
|
2127
2122
|
startY: 0,
|
|
2128
2123
|
endX: p.endX,
|
|
2129
2124
|
endY: p.endY,
|
|
@@ -2133,34 +2128,34 @@ let rt = class extends ie {
|
|
|
2133
2128
|
left: p.absolute.left,
|
|
2134
2129
|
top: p.absolute.top
|
|
2135
2130
|
}
|
|
2136
|
-
}, n),
|
|
2137
|
-
left:
|
|
2138
|
-
top:
|
|
2139
|
-
width:
|
|
2140
|
-
height:
|
|
2141
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2142
|
-
},
|
|
2143
|
-
Y.addObject(
|
|
2144
|
-
const ee = new
|
|
2131
|
+
}, n), ht = {
|
|
2132
|
+
left: Ee.startX,
|
|
2133
|
+
top: Ee.startY,
|
|
2134
|
+
width: Ee.width,
|
|
2135
|
+
height: Ee.height,
|
|
2136
|
+
zIndex: this._drawingManagerService.getDrawingOrder(w, y).length - 1
|
|
2137
|
+
}, le = new Ne(lt, ht);
|
|
2138
|
+
Y.addObject(le, Yt), T.allowTransform !== !1 && Y.attachTransformerTo(le);
|
|
2139
|
+
const ee = new wt(), Te = Y.getMainViewport(), ue = {
|
|
2145
2140
|
top: 0,
|
|
2146
2141
|
//viewMain.top,
|
|
2147
|
-
left:
|
|
2148
|
-
bottom:
|
|
2149
|
-
right:
|
|
2150
|
-
},
|
|
2142
|
+
left: Te.left,
|
|
2143
|
+
bottom: Te.bottom,
|
|
2144
|
+
right: Te.right
|
|
2145
|
+
}, he = {
|
|
2151
2146
|
dispose: ee,
|
|
2152
|
-
rect:
|
|
2147
|
+
rect: le,
|
|
2153
2148
|
// position$,
|
|
2154
|
-
unitId:
|
|
2155
|
-
subUnitId:
|
|
2156
|
-
boundsOfViewArea:
|
|
2149
|
+
unitId: w,
|
|
2150
|
+
subUnitId: y,
|
|
2151
|
+
boundsOfViewArea: ue,
|
|
2157
2152
|
domAnchor: n,
|
|
2158
2153
|
scrollDirectionResponse: "HORIZONTAL"
|
|
2159
2154
|
/* HORIZONTAL */
|
|
2160
|
-
},
|
|
2161
|
-
|
|
2162
|
-
let
|
|
2163
|
-
position$:
|
|
2155
|
+
}, gt = fe(le, X.renderUnit.scene, B.skeleton, E.worksheet, he), Oe = new je(gt);
|
|
2156
|
+
he.position$ = Oe;
|
|
2157
|
+
let Xe = {
|
|
2158
|
+
position$: Oe,
|
|
2164
2159
|
id: I,
|
|
2165
2160
|
componentKey: T.componentKey,
|
|
2166
2161
|
onPointerDown: () => {
|
|
@@ -2170,31 +2165,31 @@ let rt = class extends ie {
|
|
|
2170
2165
|
onPointerUp: () => {
|
|
2171
2166
|
},
|
|
2172
2167
|
onWheel: ($) => {
|
|
2173
|
-
|
|
2168
|
+
K.dispatchEvent(new WheelEvent($.type, $));
|
|
2174
2169
|
},
|
|
2175
|
-
data:
|
|
2176
|
-
unitId:
|
|
2170
|
+
data: H,
|
|
2171
|
+
unitId: w
|
|
2177
2172
|
};
|
|
2178
|
-
e.eventPassThrough && (
|
|
2179
|
-
...
|
|
2173
|
+
e.eventPassThrough && (Xe = {
|
|
2174
|
+
...Xe,
|
|
2180
2175
|
onPointerDown: ($) => {
|
|
2181
|
-
|
|
2176
|
+
K.dispatchEvent(new PointerEvent($.type, $));
|
|
2182
2177
|
},
|
|
2183
2178
|
onPointerMove: ($) => {
|
|
2184
|
-
|
|
2179
|
+
K.dispatchEvent(new PointerEvent($.type, $));
|
|
2185
2180
|
},
|
|
2186
2181
|
onPointerUp: ($) => {
|
|
2187
|
-
|
|
2182
|
+
K.dispatchEvent(new PointerEvent($.type, $));
|
|
2188
2183
|
}
|
|
2189
|
-
}), this._canvasFloatDomService.addFloatDom(
|
|
2190
|
-
const
|
|
2191
|
-
const $ =
|
|
2192
|
-
|
|
2184
|
+
}), this._canvasFloatDomService.addFloatDom(Xe);
|
|
2185
|
+
const ft = le.onTransformChange$.subscribeEvent(() => {
|
|
2186
|
+
const $ = fe(le, X.renderUnit.scene, B.skeleton, E.worksheet, he);
|
|
2187
|
+
Oe.next(
|
|
2193
2188
|
$
|
|
2194
2189
|
);
|
|
2195
2190
|
});
|
|
2196
|
-
this.disposeWithMe(
|
|
2197
|
-
const
|
|
2191
|
+
this.disposeWithMe(f.subscribe(($) => {
|
|
2192
|
+
const Ue = Ct({
|
|
2198
2193
|
startX: $.startX,
|
|
2199
2194
|
startY: 0,
|
|
2200
2195
|
endX: $.endX,
|
|
@@ -2205,26 +2200,26 @@ let rt = class extends ie {
|
|
|
2205
2200
|
left: p.absolute.left,
|
|
2206
2201
|
top: p.absolute.top
|
|
2207
2202
|
}
|
|
2208
|
-
}, n),
|
|
2209
|
-
left:
|
|
2203
|
+
}, n), Ve = Ie({ unitId: w, subUnitId: y, drawingId: I }), He = new Ne(Ve, {
|
|
2204
|
+
left: Ue.startX,
|
|
2210
2205
|
top: 0,
|
|
2211
2206
|
width: n.width,
|
|
2212
2207
|
height: n.height,
|
|
2213
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2214
|
-
}),
|
|
2215
|
-
|
|
2208
|
+
zIndex: this._drawingManagerService.getDrawingOrder(w, y).length - 1
|
|
2209
|
+
}), mt = fe(He, X.renderUnit.scene, B.skeleton, E.worksheet, he);
|
|
2210
|
+
Oe.next(mt);
|
|
2216
2211
|
}));
|
|
2217
|
-
const
|
|
2218
|
-
|
|
2219
|
-
$ &&
|
|
2212
|
+
const ge = (D = this._renderManagerService.getRenderById(w)) == null ? void 0 : D.with(V);
|
|
2213
|
+
ge == null || ge.currentSkeleton$.subscribe(($) => {
|
|
2214
|
+
$ && c.sheetId !== $.sheetId && this._removeDom(m, !0);
|
|
2220
2215
|
}), ee.add(() => {
|
|
2221
2216
|
this._canvasFloatDomService.removeFloatDom(I);
|
|
2222
|
-
}),
|
|
2217
|
+
}), ft && ee.add(ft), this._domLayerInfoMap.set(I, he);
|
|
2223
2218
|
}
|
|
2224
2219
|
return {
|
|
2225
|
-
id:
|
|
2220
|
+
id: m,
|
|
2226
2221
|
dispose: () => {
|
|
2227
|
-
this._removeDom(
|
|
2222
|
+
this._removeDom(m, !0);
|
|
2228
2223
|
}
|
|
2229
2224
|
};
|
|
2230
2225
|
}
|
|
@@ -2241,51 +2236,51 @@ let rt = class extends ie {
|
|
|
2241
2236
|
// eslint-disable-next-line max-lines-per-function
|
|
2242
2237
|
_createRangePositionObserver(t, e, n) {
|
|
2243
2238
|
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
|
-
|
|
2239
|
+
const o = Je(r, s, n), a = new je(o), d = Je(t.endRow, t.endColumn, n), u = new je(d), c = () => {
|
|
2240
|
+
const f = Je(r, s, n), _ = Je(t.endRow, t.endColumn, n);
|
|
2241
|
+
a.next(f), u.next(_);
|
|
2242
|
+
}, l = new wt();
|
|
2243
|
+
l.add(e.engine.clientRect$.subscribe(() => c())), l.add(this._commandService.onCommandExecuted((f) => {
|
|
2244
|
+
if (f.id === Hi.id && f.params.rowsAutoHeightInfo.findIndex((S) => S.row === r) > -1) {
|
|
2245
|
+
c();
|
|
2251
2246
|
return;
|
|
2252
2247
|
}
|
|
2253
|
-
(
|
|
2248
|
+
(zi.indexOf(f.id) > -1 || f.id === Ei.id || f.id === On.id) && c();
|
|
2254
2249
|
}));
|
|
2255
|
-
const g = (
|
|
2256
|
-
r =
|
|
2250
|
+
const g = (f, _) => {
|
|
2251
|
+
r = f, s = _, c();
|
|
2257
2252
|
}, h = () => ({
|
|
2258
2253
|
rotate: 0,
|
|
2259
|
-
width:
|
|
2260
|
-
height:
|
|
2254
|
+
width: d.right - o.left,
|
|
2255
|
+
height: d.bottom - o.top,
|
|
2261
2256
|
absolute: {
|
|
2262
2257
|
left: !0,
|
|
2263
2258
|
top: !0
|
|
2264
2259
|
},
|
|
2265
2260
|
startX: o.left,
|
|
2266
2261
|
startY: o.top,
|
|
2267
|
-
endX:
|
|
2268
|
-
endY:
|
|
2269
|
-
}),
|
|
2270
|
-
|
|
2271
|
-
const
|
|
2262
|
+
endX: d.right,
|
|
2263
|
+
endY: d.bottom
|
|
2264
|
+
}), m = a.pipe(
|
|
2265
|
+
Me((f) => {
|
|
2266
|
+
const _ = Je(t.endRow, t.endColumn, n);
|
|
2272
2267
|
return {
|
|
2273
2268
|
rotate: 0,
|
|
2274
|
-
width:
|
|
2275
|
-
height:
|
|
2269
|
+
width: _.right - f.left,
|
|
2270
|
+
height: _.bottom - f.top,
|
|
2276
2271
|
absolute: {
|
|
2277
2272
|
left: !0,
|
|
2278
2273
|
top: !0
|
|
2279
2274
|
},
|
|
2280
|
-
startX:
|
|
2281
|
-
startY:
|
|
2282
|
-
endX:
|
|
2283
|
-
endY:
|
|
2275
|
+
startX: f.left,
|
|
2276
|
+
startY: f.top,
|
|
2277
|
+
endX: _.right,
|
|
2278
|
+
endY: _.bottom
|
|
2284
2279
|
};
|
|
2285
2280
|
})
|
|
2286
2281
|
), p = h();
|
|
2287
2282
|
return {
|
|
2288
|
-
position$:
|
|
2283
|
+
position$: m,
|
|
2289
2284
|
position: p,
|
|
2290
2285
|
updateRowCol: g,
|
|
2291
2286
|
topLeftPos$: a,
|
|
@@ -2294,16 +2289,16 @@ let rt = class extends ie {
|
|
|
2294
2289
|
};
|
|
2295
2290
|
}
|
|
2296
2291
|
};
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
],
|
|
2306
|
-
function
|
|
2292
|
+
tt = Ns([
|
|
2293
|
+
De(0, A(q)),
|
|
2294
|
+
De(1, Se),
|
|
2295
|
+
De(2, A(G)),
|
|
2296
|
+
De(3, se),
|
|
2297
|
+
De(4, A(ki)),
|
|
2298
|
+
De(5, oe),
|
|
2299
|
+
De(6, A(Yr))
|
|
2300
|
+
], tt);
|
|
2301
|
+
function Je(i, t, e) {
|
|
2307
2302
|
const n = e.getCellWithCoordByIndex(i, t), r = n.isMergedMainCell ? n.mergeInfo : n;
|
|
2308
2303
|
return {
|
|
2309
2304
|
left: r.startX,
|
|
@@ -2312,27 +2307,27 @@ function et(i, t, e) {
|
|
|
2312
2307
|
bottom: r.endY
|
|
2313
2308
|
};
|
|
2314
2309
|
}
|
|
2315
|
-
function
|
|
2316
|
-
var u,
|
|
2310
|
+
function Ct(i, t, e) {
|
|
2311
|
+
var u, c;
|
|
2317
2312
|
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,
|
|
2313
|
+
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;
|
|
2314
|
+
let a = 0, d = 0;
|
|
2320
2315
|
if (t) {
|
|
2321
2316
|
if (t.horizonOffsetAlign === "right") {
|
|
2322
|
-
const l =
|
|
2317
|
+
const l = Dt(t.marginX, n * e);
|
|
2323
2318
|
a = i.endX - l - s;
|
|
2324
2319
|
} else
|
|
2325
|
-
a = i.startX +
|
|
2320
|
+
a = i.startX + Dt(t.marginX, n);
|
|
2326
2321
|
if (t.verticalOffsetAlign === "bottom") {
|
|
2327
|
-
const l =
|
|
2328
|
-
|
|
2322
|
+
const l = Dt(t.marginY, r * e);
|
|
2323
|
+
d = i.endY - l - o;
|
|
2329
2324
|
} else
|
|
2330
|
-
|
|
2325
|
+
d = i.startY + Dt(t.marginY, r);
|
|
2331
2326
|
}
|
|
2332
2327
|
return {
|
|
2333
2328
|
rotate: 0,
|
|
2334
2329
|
startX: a,
|
|
2335
|
-
startY:
|
|
2330
|
+
startY: d,
|
|
2336
2331
|
endX: i.endX,
|
|
2337
2332
|
endY: i.endY,
|
|
2338
2333
|
width: s,
|
|
@@ -2343,102 +2338,37 @@ function yt(i, t, e) {
|
|
|
2343
2338
|
}
|
|
2344
2339
|
};
|
|
2345
2340
|
}
|
|
2346
|
-
function
|
|
2341
|
+
function Dt(i, t) {
|
|
2347
2342
|
if (i === void 0) return 0;
|
|
2348
2343
|
if (typeof i == "number") return i;
|
|
2349
2344
|
const e = Number.parseFloat(i);
|
|
2350
2345
|
return t * e / 100;
|
|
2351
2346
|
}
|
|
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(
|
|
2347
|
+
const ks = (i) => {
|
|
2348
|
+
const { floatDomInfos: t, scene: e, skeleton: n, worksheet: r } = i, s = ss(() => t.map((o) => {
|
|
2349
|
+
const { width: a, height: d, angle: u, left: c, top: l } = o.transform, g = Dr(
|
|
2420
2350
|
{
|
|
2421
|
-
left:
|
|
2422
|
-
right: (
|
|
2351
|
+
left: c != null ? c : 0,
|
|
2352
|
+
right: (c != null ? c : 0) + (a != null ? a : 0),
|
|
2423
2353
|
top: l != null ? l : 0,
|
|
2424
|
-
bottom: (l != null ? l : 0) + (
|
|
2354
|
+
bottom: (l != null ? l : 0) + (d != null ? d : 0)
|
|
2425
2355
|
},
|
|
2426
2356
|
e,
|
|
2427
2357
|
n,
|
|
2428
2358
|
r,
|
|
2429
2359
|
void 0,
|
|
2430
2360
|
!0
|
|
2431
|
-
), { scaleX: h, scaleY:
|
|
2361
|
+
), { scaleX: h, scaleY: m } = e.getAncestorScale(), p = {
|
|
2432
2362
|
startX: g.left,
|
|
2433
2363
|
endX: g.right,
|
|
2434
2364
|
startY: g.top,
|
|
2435
2365
|
endY: g.bottom,
|
|
2436
2366
|
rotate: u,
|
|
2437
2367
|
width: a * h,
|
|
2438
|
-
height:
|
|
2368
|
+
height: d * m,
|
|
2439
2369
|
absolute: g.absolute
|
|
2440
|
-
},
|
|
2441
|
-
position$: new
|
|
2370
|
+
}, f = {
|
|
2371
|
+
position$: new je(p),
|
|
2442
2372
|
position: p,
|
|
2443
2373
|
id: o.drawingId,
|
|
2444
2374
|
componentKey: o.componentKey,
|
|
@@ -2450,18 +2380,19 @@ const Vs = as((i) => {
|
|
|
2450
2380
|
},
|
|
2451
2381
|
onWheel: () => {
|
|
2452
2382
|
},
|
|
2453
|
-
unitId: o.unitId
|
|
2383
|
+
unitId: o.unitId,
|
|
2384
|
+
data: o.data
|
|
2454
2385
|
};
|
|
2455
|
-
return [o.drawingId,
|
|
2386
|
+
return [o.drawingId, f];
|
|
2456
2387
|
}), [t, e, n, r]);
|
|
2457
|
-
return /* @__PURE__ */
|
|
2388
|
+
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
2389
|
};
|
|
2459
|
-
var
|
|
2460
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2390
|
+
var Ws = Object.getOwnPropertyDescriptor, js = (i, t, e, n) => {
|
|
2391
|
+
for (var r = n > 1 ? void 0 : n ? Ws(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
2461
2392
|
(o = i[s]) && (r = o(r) || r);
|
|
2462
2393
|
return r;
|
|
2463
|
-
},
|
|
2464
|
-
let
|
|
2394
|
+
}, be = (i, t) => (e, n) => t(e, n, i);
|
|
2395
|
+
let Ut = class extends ie {
|
|
2465
2396
|
constructor(i, t, e, n, r, s, o) {
|
|
2466
2397
|
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
2398
|
}
|
|
@@ -2472,9 +2403,9 @@ let Bt = class extends ie {
|
|
|
2472
2403
|
{
|
|
2473
2404
|
handler: (i, t, e) => {
|
|
2474
2405
|
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 !==
|
|
2406
|
+
return a && a.order.forEach((d) => {
|
|
2407
|
+
const u = a.data[d];
|
|
2408
|
+
u.drawingType !== j.DRAWING_CHART && u.drawingType !== j.DRAWING_DOM && this._drawingRenderService.renderDrawing(u, r);
|
|
2478
2409
|
}), e();
|
|
2479
2410
|
}
|
|
2480
2411
|
}
|
|
@@ -2487,17 +2418,17 @@ let Bt = class extends ie {
|
|
|
2487
2418
|
const { unitId: n, subUnitId: r } = t, s = this._renderManagerService.getRenderById(n);
|
|
2488
2419
|
if (!s)
|
|
2489
2420
|
return e(i);
|
|
2490
|
-
const o = s.with(
|
|
2421
|
+
const o = s.with(V).getSkeletonParam(r);
|
|
2491
2422
|
if (!o)
|
|
2492
2423
|
return e(i);
|
|
2493
|
-
const a = this._drawingManagerService.getDrawingDataForUnit(n),
|
|
2494
|
-
if (!
|
|
2424
|
+
const a = this._drawingManagerService.getDrawingDataForUnit(n), d = a == null ? void 0 : a[t.subUnitId];
|
|
2425
|
+
if (!d)
|
|
2495
2426
|
return e(i);
|
|
2496
|
-
const { scaleX: u, scaleY:
|
|
2427
|
+
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
2428
|
return g.length ? (g.forEach((h) => {
|
|
2498
|
-
if (!h.groupId && h.transform &&
|
|
2499
|
-
const
|
|
2500
|
-
|
|
2429
|
+
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)) {
|
|
2430
|
+
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 });
|
|
2431
|
+
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
2432
|
}
|
|
2502
2433
|
}), e(l)) : e(i);
|
|
2503
2434
|
}
|
|
@@ -2514,20 +2445,26 @@ let Bt = class extends ie {
|
|
|
2514
2445
|
const { unitId: n, subUnitId: r } = t, s = this._drawingManagerService.getDrawingDataForUnit(n), o = s == null ? void 0 : s[r];
|
|
2515
2446
|
if (o) {
|
|
2516
2447
|
const a = o.order.map((u) => {
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2448
|
+
const c = o.data[u];
|
|
2449
|
+
if (c.drawingType === j.DRAWING_CHART)
|
|
2450
|
+
return {
|
|
2451
|
+
...c,
|
|
2452
|
+
componentKey: this._componetManager.get(Vr)
|
|
2453
|
+
};
|
|
2454
|
+
if (c.drawingType === j.DRAWING_DOM) {
|
|
2455
|
+
const l = this._sheetPrintInterceptorService.getPrintComponent(c.componentKey);
|
|
2456
|
+
return {
|
|
2457
|
+
...c,
|
|
2458
|
+
componentKey: this._componetManager.get(l || c.componentKey)
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
return null;
|
|
2462
|
+
}).filter(Boolean), d = ji(ks, this._injector);
|
|
2463
|
+
return wi(
|
|
2464
|
+
/* @__PURE__ */ Z(d, { floatDomInfos: a, scene: t.scene, skeleton: t.skeleton, worksheet: t.worksheet }),
|
|
2528
2465
|
t.root
|
|
2529
2466
|
), i == null || i.add(() => {
|
|
2530
|
-
|
|
2467
|
+
_i(t.root);
|
|
2531
2468
|
}), e(i);
|
|
2532
2469
|
}
|
|
2533
2470
|
}
|
|
@@ -2536,22 +2473,31 @@ let Bt = class extends ie {
|
|
|
2536
2473
|
);
|
|
2537
2474
|
}
|
|
2538
2475
|
};
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
],
|
|
2548
|
-
var
|
|
2549
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2476
|
+
Ut = js([
|
|
2477
|
+
be(0, A(Ti)),
|
|
2478
|
+
be(1, A(Gn)),
|
|
2479
|
+
be(2, se),
|
|
2480
|
+
be(3, q),
|
|
2481
|
+
be(4, A(tt)),
|
|
2482
|
+
be(5, A(zn)),
|
|
2483
|
+
be(6, A(Ye))
|
|
2484
|
+
], Ut);
|
|
2485
|
+
var Bs = Object.getOwnPropertyDescriptor, $s = (i, t, e, n) => {
|
|
2486
|
+
for (var r = n > 1 ? void 0 : n ? Bs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
2550
2487
|
(o = i[s]) && (r = o(r) || r);
|
|
2551
2488
|
return r;
|
|
2552
|
-
},
|
|
2553
|
-
const
|
|
2489
|
+
}, pe = (i, t) => (e, n) => t(e, n, i);
|
|
2490
|
+
const xs = [
|
|
2491
|
+
Kn.id,
|
|
2492
|
+
Zn.id,
|
|
2493
|
+
Jn.id,
|
|
2494
|
+
qn.id,
|
|
2495
|
+
Qn.id,
|
|
2496
|
+
er.id,
|
|
2497
|
+
tr.id,
|
|
2554
2498
|
nr.id,
|
|
2499
|
+
Jt.id,
|
|
2500
|
+
qt.id,
|
|
2555
2501
|
rr.id,
|
|
2556
2502
|
ir.id,
|
|
2557
2503
|
sr.id,
|
|
@@ -2559,84 +2505,75 @@ const qs = [
|
|
|
2559
2505
|
ar.id,
|
|
2560
2506
|
cr.id,
|
|
2561
2507
|
dr.id,
|
|
2562
|
-
nn.id,
|
|
2563
|
-
rn.id,
|
|
2564
2508
|
lr.id,
|
|
2565
|
-
ur.id
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
pr.id,
|
|
2571
|
-
wr.id,
|
|
2572
|
-
_r.id
|
|
2573
|
-
], Qs = [
|
|
2509
|
+
ur.id
|
|
2510
|
+
], Fs = [
|
|
2511
|
+
Ki.id,
|
|
2512
|
+
Zi.id,
|
|
2513
|
+
Ji.id,
|
|
2574
2514
|
qi.id,
|
|
2575
2515
|
Qi.id,
|
|
2576
|
-
es.id
|
|
2577
|
-
ts.id,
|
|
2578
|
-
ns.id,
|
|
2579
|
-
rs.id
|
|
2516
|
+
es.id
|
|
2580
2517
|
];
|
|
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 =
|
|
2518
|
+
let sn = class extends ie {
|
|
2519
|
+
constructor(i, t, e, n, r, s, o, a, d) {
|
|
2520
|
+
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
2521
|
}
|
|
2585
2522
|
_sheetInterceptorListener() {
|
|
2586
2523
|
this.disposeWithMe(
|
|
2587
2524
|
this._sheetInterceptorService.interceptCommand({
|
|
2588
2525
|
getMutations: (i) => {
|
|
2589
|
-
if (!
|
|
2526
|
+
if (!xs.includes(i.id))
|
|
2590
2527
|
return { redos: [], undos: [] };
|
|
2591
2528
|
if (i.params == null)
|
|
2592
2529
|
return { redos: [], undos: [] };
|
|
2593
2530
|
const t = i.id;
|
|
2594
|
-
if (t ===
|
|
2531
|
+
if (t === Kn.id)
|
|
2595
2532
|
return this._moveRowInterceptor(i.params, "insert");
|
|
2596
|
-
if ([
|
|
2533
|
+
if ([dr.id, lr.id, ur.id].includes(t))
|
|
2597
2534
|
return this._moveRangeInterceptor(i.params);
|
|
2598
|
-
if (t ===
|
|
2535
|
+
if (t === Zn.id)
|
|
2599
2536
|
return this._moveColInterceptor(i.params, "insert");
|
|
2600
|
-
if (t ===
|
|
2537
|
+
if (t === Jn.id)
|
|
2601
2538
|
return this._moveRowInterceptor(i.params, "remove");
|
|
2602
|
-
if (t ===
|
|
2539
|
+
if (t === qn.id)
|
|
2603
2540
|
return this._moveColInterceptor(i.params, "remove");
|
|
2604
|
-
if (t ===
|
|
2541
|
+
if (t === Qn.id) {
|
|
2605
2542
|
const { range: e } = i.params;
|
|
2606
2543
|
return this._getRangeMoveUndo(
|
|
2607
2544
|
e,
|
|
2608
2545
|
0
|
|
2609
2546
|
/* deleteLeft */
|
|
2610
2547
|
);
|
|
2611
|
-
} else if (t ===
|
|
2548
|
+
} else if (t === er.id) {
|
|
2612
2549
|
const { range: e } = i.params;
|
|
2613
2550
|
return this._getRangeMoveUndo(
|
|
2614
2551
|
e,
|
|
2615
2552
|
1
|
|
2616
2553
|
/* deleteUp */
|
|
2617
2554
|
);
|
|
2618
|
-
} else if (t ===
|
|
2555
|
+
} else if (t === tr.id) {
|
|
2619
2556
|
const { range: e } = i.params;
|
|
2620
2557
|
return this._getRangeMoveUndo(
|
|
2621
2558
|
e,
|
|
2622
2559
|
2
|
|
2623
2560
|
/* insertDown */
|
|
2624
2561
|
);
|
|
2625
|
-
} else if (t ===
|
|
2562
|
+
} else if (t === nr.id) {
|
|
2626
2563
|
const { range: e } = i.params;
|
|
2627
2564
|
return this._getRangeMoveUndo(
|
|
2628
2565
|
e,
|
|
2629
2566
|
3
|
|
2630
2567
|
/* insertRight */
|
|
2631
2568
|
);
|
|
2632
|
-
} else if (t ===
|
|
2569
|
+
} else if (t === sr.id || t === or.id) {
|
|
2633
2570
|
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
|
|
2634
2571
|
return this._getDrawingUndoForRowVisible(n, r, s);
|
|
2635
|
-
} else if (t ===
|
|
2572
|
+
} else if (t === ar.id || t === cr.id) {
|
|
2636
2573
|
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
|
|
2637
2574
|
return this._getDrawingUndoForColVisible(n, r, s);
|
|
2638
|
-
} else if (t ===
|
|
2639
|
-
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t ===
|
|
2575
|
+
} else if (t === Jt.id || t === qt.id || t === rr.id || t === ir.id) {
|
|
2576
|
+
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t === Jt.id || t === qt.id;
|
|
2640
2577
|
return this._getDrawingUndoForRowAndColSize(n, r, s, o);
|
|
2641
2578
|
}
|
|
2642
2579
|
return { redos: [], undos: [] };
|
|
@@ -2648,58 +2585,58 @@ let ln = class extends ie {
|
|
|
2648
2585
|
const e = ae(this._univerInstanceService);
|
|
2649
2586
|
if (e == null)
|
|
2650
2587
|
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
|
-
}),
|
|
2588
|
+
const n = e.unitId, r = e.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(n, r), d = [], u = [];
|
|
2589
|
+
if (Object.keys(a).forEach((c) => {
|
|
2590
|
+
const l = a[c], { updateDrawings: g, deleteDrawings: h } = this._getUpdateOrDeleteDrawings(i, t, l);
|
|
2591
|
+
d.push(...g), u.push(...h);
|
|
2592
|
+
}), d.length === 0 && u.length === 0)
|
|
2656
2593
|
return { redos: [], undos: [] };
|
|
2657
|
-
if (
|
|
2658
|
-
const
|
|
2659
|
-
s.push({ id:
|
|
2594
|
+
if (d.length > 0) {
|
|
2595
|
+
const c = this._sheetDrawingService.getBatchUpdateOp(d), { undo: l, redo: g, objects: h } = c;
|
|
2596
|
+
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
2597
|
}
|
|
2661
2598
|
if (u.length > 0) {
|
|
2662
|
-
const
|
|
2663
|
-
s.push({ id:
|
|
2599
|
+
const c = this._sheetDrawingService.getBatchRemoveOp(u), l = c.undo, g = c.redo, h = c.objects;
|
|
2600
|
+
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
2601
|
}
|
|
2665
|
-
return s.push({ id:
|
|
2602
|
+
return s.push({ id: L.id, params: [n] }), o.push({ id: L.id, params: [n] }), {
|
|
2666
2603
|
redos: s,
|
|
2667
2604
|
undos: o
|
|
2668
2605
|
};
|
|
2669
2606
|
}
|
|
2670
2607
|
_getUpdateOrDeleteDrawings(i, t, e) {
|
|
2671
|
-
const n = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: a, unitId:
|
|
2608
|
+
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
2609
|
if (s == null || a == null)
|
|
2673
2610
|
return {
|
|
2674
2611
|
updateDrawings: n,
|
|
2675
2612
|
deleteDrawings: r
|
|
2676
2613
|
};
|
|
2677
|
-
const { startRow:
|
|
2614
|
+
const { startRow: _, endRow: S, startColumn: C, endColumn: b } = i;
|
|
2678
2615
|
let v = null, D = null;
|
|
2679
|
-
if (t === 0 && h >=
|
|
2680
|
-
if (
|
|
2681
|
-
r.push({ unitId:
|
|
2616
|
+
if (t === 0 && h >= _ && p <= S)
|
|
2617
|
+
if (m >= C && f <= b)
|
|
2618
|
+
r.push({ unitId: d, subUnitId: u, drawingId: c });
|
|
2682
2619
|
else {
|
|
2683
|
-
const
|
|
2684
|
-
v =
|
|
2620
|
+
const w = this._shrinkCol(s, a, C, b, o);
|
|
2621
|
+
v = w == null ? void 0 : w.newSheetTransform, D = w == null ? void 0 : w.newTransform;
|
|
2685
2622
|
}
|
|
2686
|
-
else if (t === 1 &&
|
|
2687
|
-
if (h >=
|
|
2688
|
-
r.push({ unitId:
|
|
2623
|
+
else if (t === 1 && m >= C && f <= b)
|
|
2624
|
+
if (h >= _ && p <= S)
|
|
2625
|
+
r.push({ unitId: d, subUnitId: u, drawingId: c });
|
|
2689
2626
|
else {
|
|
2690
|
-
const
|
|
2691
|
-
v =
|
|
2627
|
+
const w = this._shrinkRow(s, a, _, S, o);
|
|
2628
|
+
v = w == null ? void 0 : w.newSheetTransform, D = w == null ? void 0 : w.newTransform;
|
|
2692
2629
|
}
|
|
2693
2630
|
else if (t === 2) {
|
|
2694
|
-
const
|
|
2695
|
-
v =
|
|
2631
|
+
const w = this._expandRow(s, a, _, S, o);
|
|
2632
|
+
v = w == null ? void 0 : w.newSheetTransform, D = w == null ? void 0 : w.newTransform;
|
|
2696
2633
|
} else if (t === 3) {
|
|
2697
|
-
const
|
|
2698
|
-
v =
|
|
2634
|
+
const w = this._expandCol(s, a, C, b, o);
|
|
2635
|
+
v = w == null ? void 0 : w.newSheetTransform, D = w == null ? void 0 : w.newTransform;
|
|
2699
2636
|
}
|
|
2700
2637
|
if (v != null && D != null) {
|
|
2701
|
-
const
|
|
2702
|
-
n.push({ ...e, sheetTransform: v, transform:
|
|
2638
|
+
const w = z(v, this._selectionRenderService, this._skeletonManagerService);
|
|
2639
|
+
n.push({ ...e, sheetTransform: v, transform: w });
|
|
2703
2640
|
}
|
|
2704
2641
|
return { updateDrawings: n, deleteDrawings: r };
|
|
2705
2642
|
}
|
|
@@ -2713,23 +2650,23 @@ let ln = class extends ie {
|
|
|
2713
2650
|
// eslint-disable-next-line max-lines-per-function
|
|
2714
2651
|
_getDrawingUndoForColVisible(i, t, e) {
|
|
2715
2652
|
const n = this._drawingManagerService.getDrawingData(i, t), r = [], s = [];
|
|
2716
|
-
if (Object.keys(n).forEach((
|
|
2717
|
-
const l = n[
|
|
2718
|
-
if (
|
|
2653
|
+
if (Object.keys(n).forEach((c) => {
|
|
2654
|
+
const l = n[c], { sheetTransform: g, transform: h, anchorType: m = O.Position } = l;
|
|
2655
|
+
if (m === O.None)
|
|
2719
2656
|
this._remainDrawingSize(h, r, l);
|
|
2720
2657
|
else {
|
|
2721
|
-
const { from: p, to:
|
|
2658
|
+
const { from: p, to: f } = g, { row: _, column: S } = p, { row: C, column: b } = f;
|
|
2722
2659
|
for (let v = 0; v < e.length; v++) {
|
|
2723
|
-
const D = e[v], { startRow:
|
|
2660
|
+
const D = e[v], { startRow: w, endRow: y, startColumn: I, endColumn: E } = D;
|
|
2724
2661
|
if (b < I)
|
|
2725
2662
|
continue;
|
|
2726
|
-
if (
|
|
2663
|
+
if (m === O.Position) {
|
|
2727
2664
|
let R = null, N = null;
|
|
2728
2665
|
if (S >= I && S <= E) {
|
|
2729
|
-
const
|
|
2730
|
-
if (
|
|
2666
|
+
const B = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: E, startRow: p.row, endRow: f.row });
|
|
2667
|
+
if (B == null)
|
|
2731
2668
|
return;
|
|
2732
|
-
N = { ...h, left:
|
|
2669
|
+
N = { ...h, left: B.startX };
|
|
2733
2670
|
}
|
|
2734
2671
|
if (N != null && (R = x(N, this._selectionRenderService), R != null && N != null)) {
|
|
2735
2672
|
r.push({ ...l, sheetTransform: R, transform: N });
|
|
@@ -2740,38 +2677,38 @@ let ln = class extends ie {
|
|
|
2740
2677
|
}
|
|
2741
2678
|
if (S >= I && b <= E)
|
|
2742
2679
|
continue;
|
|
2743
|
-
let T = null,
|
|
2680
|
+
let T = null, M = null;
|
|
2744
2681
|
if (S >= I && S <= E) {
|
|
2745
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: E, startRow: p.row, endRow:
|
|
2682
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: E, startRow: p.row, endRow: f.row });
|
|
2746
2683
|
if (R == null)
|
|
2747
2684
|
return;
|
|
2748
|
-
|
|
2685
|
+
M = {
|
|
2749
2686
|
...h,
|
|
2750
2687
|
left: (R == null ? void 0 : R.startX) || 0,
|
|
2751
2688
|
width: ((h == null ? void 0 : h.width) || 0) - R.endX + R.startX
|
|
2752
2689
|
};
|
|
2753
2690
|
} else if (b >= I && b <= E) {
|
|
2754
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: b, startRow: p.row, endRow:
|
|
2691
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: b, startRow: p.row, endRow: f.row });
|
|
2755
2692
|
if (R == null)
|
|
2756
2693
|
return;
|
|
2757
|
-
|
|
2694
|
+
M = {
|
|
2758
2695
|
...h,
|
|
2759
2696
|
left: R.startX - ((h == null ? void 0 : h.width) || 0)
|
|
2760
2697
|
};
|
|
2761
2698
|
} else {
|
|
2762
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: E, startRow: p.row, endRow:
|
|
2699
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: E, startRow: p.row, endRow: f.row });
|
|
2763
2700
|
if (R == null)
|
|
2764
2701
|
return;
|
|
2765
|
-
if (
|
|
2702
|
+
if (M = {
|
|
2766
2703
|
...h,
|
|
2767
2704
|
width: ((h == null ? void 0 : h.width) || 0) - R.endX + R.startX
|
|
2768
|
-
}, T = x(
|
|
2769
|
-
s.push({ ...l, sheetTransform: T, transform:
|
|
2705
|
+
}, T = x(M, this._selectionRenderService), T != null && M != null) {
|
|
2706
|
+
s.push({ ...l, sheetTransform: T, transform: M });
|
|
2770
2707
|
break;
|
|
2771
2708
|
}
|
|
2772
2709
|
}
|
|
2773
|
-
if (
|
|
2774
|
-
r.push({ ...l, sheetTransform: T, transform:
|
|
2710
|
+
if (M != null && (T = x(M, this._selectionRenderService)), M != null && T != null) {
|
|
2711
|
+
r.push({ ...l, sheetTransform: T, transform: M });
|
|
2775
2712
|
break;
|
|
2776
2713
|
} else
|
|
2777
2714
|
this._remainDrawingSize(h, r, l);
|
|
@@ -2779,51 +2716,51 @@ let ln = class extends ie {
|
|
|
2779
2716
|
}
|
|
2780
2717
|
}), r.length === 0 && s.length === 0)
|
|
2781
2718
|
return { redos: [], undos: [] };
|
|
2782
|
-
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, t, r),
|
|
2719
|
+
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, t, r), d = [], u = [];
|
|
2783
2720
|
if (s.length > 0) {
|
|
2784
|
-
const { redos:
|
|
2785
|
-
|
|
2721
|
+
const { redos: c, undos: l } = this._createUndoAndRedoMutation(i, t, s);
|
|
2722
|
+
d.push(...c), u.push(...l);
|
|
2786
2723
|
}
|
|
2787
2724
|
return {
|
|
2788
2725
|
redos: o,
|
|
2789
2726
|
undos: a,
|
|
2790
|
-
preRedos:
|
|
2727
|
+
preRedos: d,
|
|
2791
2728
|
preUndos: u
|
|
2792
2729
|
};
|
|
2793
2730
|
}
|
|
2794
2731
|
_createUndoAndRedoMutation(i, t, e) {
|
|
2795
2732
|
const n = this._sheetDrawingService.getBatchUpdateOp(e), { undo: r, redo: s, objects: o } = n, a = [
|
|
2796
|
-
{ id:
|
|
2797
|
-
{ id:
|
|
2798
|
-
],
|
|
2799
|
-
{ id:
|
|
2800
|
-
{ id:
|
|
2733
|
+
{ id: P.id, params: { unitId: i, subUnitId: t, op: s, objects: o, type: U.UPDATE } },
|
|
2734
|
+
{ id: L.id, params: [i] }
|
|
2735
|
+
], d = [
|
|
2736
|
+
{ id: P.id, params: { unitId: i, subUnitId: t, op: r, objects: o, type: U.UPDATE } },
|
|
2737
|
+
{ id: L.id, params: [i] }
|
|
2801
2738
|
];
|
|
2802
2739
|
return {
|
|
2803
2740
|
redos: a,
|
|
2804
|
-
undos:
|
|
2741
|
+
undos: d
|
|
2805
2742
|
};
|
|
2806
2743
|
}
|
|
2807
2744
|
// eslint-disable-next-line max-lines-per-function
|
|
2808
2745
|
_getDrawingUndoForRowVisible(i, t, e) {
|
|
2809
2746
|
const n = this._drawingManagerService.getDrawingData(i, t), r = [], s = [];
|
|
2810
|
-
if (Object.keys(n).forEach((
|
|
2811
|
-
const l = n[
|
|
2812
|
-
if (
|
|
2747
|
+
if (Object.keys(n).forEach((c) => {
|
|
2748
|
+
const l = n[c], { sheetTransform: g, transform: h, anchorType: m = O.Position } = l;
|
|
2749
|
+
if (m === O.None)
|
|
2813
2750
|
this._remainDrawingSize(h, r, l);
|
|
2814
2751
|
else {
|
|
2815
|
-
const { from: p, to:
|
|
2752
|
+
const { from: p, to: f } = g, { row: _, column: S } = p, { row: C, column: b } = f;
|
|
2816
2753
|
for (let v = 0; v < e.length; v++) {
|
|
2817
|
-
const D = e[v], { startRow:
|
|
2818
|
-
if (C <
|
|
2754
|
+
const D = e[v], { startRow: w, endRow: y, startColumn: I, endColumn: E } = D;
|
|
2755
|
+
if (C < w)
|
|
2819
2756
|
continue;
|
|
2820
|
-
if (
|
|
2757
|
+
if (m === O.Position) {
|
|
2821
2758
|
let R = null, N = null;
|
|
2822
|
-
if (
|
|
2823
|
-
const
|
|
2824
|
-
if (
|
|
2759
|
+
if (_ >= w && _ <= y) {
|
|
2760
|
+
const B = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: _, endRow: y });
|
|
2761
|
+
if (B == null)
|
|
2825
2762
|
return;
|
|
2826
|
-
N = { ...h, top:
|
|
2763
|
+
N = { ...h, top: B.startY };
|
|
2827
2764
|
}
|
|
2828
2765
|
if (N != null && (R = x(N, this._selectionRenderService), R != null && N != null)) {
|
|
2829
2766
|
r.push({ ...l, sheetTransform: R, transform: N });
|
|
@@ -2832,40 +2769,40 @@ let ln = class extends ie {
|
|
|
2832
2769
|
this._remainDrawingSize(h, r, l);
|
|
2833
2770
|
continue;
|
|
2834
2771
|
}
|
|
2835
|
-
if (
|
|
2772
|
+
if (_ >= w && C <= y)
|
|
2836
2773
|
continue;
|
|
2837
|
-
let T = null,
|
|
2838
|
-
if (
|
|
2839
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn:
|
|
2774
|
+
let T = null, M = null;
|
|
2775
|
+
if (_ >= w && _ <= y) {
|
|
2776
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: _, endRow: y });
|
|
2840
2777
|
if (R == null)
|
|
2841
2778
|
return;
|
|
2842
|
-
|
|
2779
|
+
M = {
|
|
2843
2780
|
...h,
|
|
2844
2781
|
top: (R == null ? void 0 : R.startY) || 0,
|
|
2845
2782
|
height: ((h == null ? void 0 : h.height) || 0) - R.endY + R.startY
|
|
2846
2783
|
};
|
|
2847
|
-
} else if (C >=
|
|
2848
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn:
|
|
2784
|
+
} else if (C >= w && C <= y) {
|
|
2785
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: w, endRow: C });
|
|
2849
2786
|
if (R == null)
|
|
2850
2787
|
return;
|
|
2851
|
-
|
|
2788
|
+
M = {
|
|
2852
2789
|
...h,
|
|
2853
2790
|
top: R.startY - ((h == null ? void 0 : h.height) || 0)
|
|
2854
2791
|
};
|
|
2855
2792
|
} else {
|
|
2856
|
-
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn:
|
|
2793
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: w, endRow: y });
|
|
2857
2794
|
if (R == null)
|
|
2858
2795
|
return;
|
|
2859
|
-
if (
|
|
2796
|
+
if (M = {
|
|
2860
2797
|
...h,
|
|
2861
2798
|
height: ((h == null ? void 0 : h.height) || 0) - R.endY + R.startY
|
|
2862
|
-
}, T = x(
|
|
2863
|
-
s.push({ ...l, sheetTransform: T, transform:
|
|
2799
|
+
}, T = x(M, this._selectionRenderService), T != null && M != null) {
|
|
2800
|
+
s.push({ ...l, sheetTransform: T, transform: M });
|
|
2864
2801
|
break;
|
|
2865
2802
|
}
|
|
2866
2803
|
}
|
|
2867
|
-
if (
|
|
2868
|
-
r.push({ ...l, sheetTransform: T, transform:
|
|
2804
|
+
if (M != null && (T = x(M, this._selectionRenderService)), M != null && T != null) {
|
|
2805
|
+
r.push({ ...l, sheetTransform: T, transform: M });
|
|
2869
2806
|
break;
|
|
2870
2807
|
} else
|
|
2871
2808
|
this._remainDrawingSize(h, r, l);
|
|
@@ -2873,39 +2810,39 @@ let ln = class extends ie {
|
|
|
2873
2810
|
}
|
|
2874
2811
|
}), r.length === 0 && s.length === 0)
|
|
2875
2812
|
return { redos: [], undos: [] };
|
|
2876
|
-
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, t, r),
|
|
2813
|
+
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, t, r), d = [], u = [];
|
|
2877
2814
|
if (s.length > 0) {
|
|
2878
|
-
const { redos:
|
|
2879
|
-
|
|
2815
|
+
const { redos: c, undos: l } = this._createUndoAndRedoMutation(i, t, s);
|
|
2816
|
+
d.push(...c), u.push(...l);
|
|
2880
2817
|
}
|
|
2881
2818
|
return {
|
|
2882
2819
|
redos: o,
|
|
2883
2820
|
undos: a,
|
|
2884
|
-
preRedos:
|
|
2821
|
+
preRedos: d,
|
|
2885
2822
|
preUndos: u
|
|
2886
2823
|
};
|
|
2887
2824
|
}
|
|
2888
2825
|
_getDrawingUndoForRowAndColSize(i, t, e, n) {
|
|
2889
2826
|
const r = this._drawingManagerService.getDrawingData(i, t), s = [];
|
|
2890
2827
|
return Object.keys(r).forEach((o) => {
|
|
2891
|
-
const a = r[o], { sheetTransform:
|
|
2892
|
-
if (
|
|
2828
|
+
const a = r[o], { sheetTransform: d, transform: u, anchorType: c = O.Position } = a;
|
|
2829
|
+
if (c === O.None)
|
|
2893
2830
|
this._remainDrawingSize(u, s, a);
|
|
2894
2831
|
else {
|
|
2895
|
-
const { from: l, to: g } =
|
|
2896
|
-
for (let
|
|
2897
|
-
const S = e[
|
|
2898
|
-
if (p < C ||
|
|
2832
|
+
const { from: l, to: g } = d, { row: h, column: m } = l, { row: p, column: f } = g;
|
|
2833
|
+
for (let _ = 0; _ < e.length; _++) {
|
|
2834
|
+
const S = e[_], { startRow: C, endRow: b, startColumn: v, endColumn: D } = S;
|
|
2835
|
+
if (p < C || f < v)
|
|
2899
2836
|
continue;
|
|
2900
|
-
if (
|
|
2837
|
+
if (c === O.Position && (h <= C && p >= b || m <= v && f >= D)) {
|
|
2901
2838
|
this._remainDrawingSize(u, s, a);
|
|
2902
2839
|
continue;
|
|
2903
2840
|
}
|
|
2904
|
-
const
|
|
2905
|
-
if (
|
|
2841
|
+
const w = z({ ...d }, this._selectionRenderService, this._skeletonManagerService);
|
|
2842
|
+
if (w != null) {
|
|
2906
2843
|
s.push({
|
|
2907
2844
|
...a,
|
|
2908
|
-
transform:
|
|
2845
|
+
transform: w
|
|
2909
2846
|
});
|
|
2910
2847
|
break;
|
|
2911
2848
|
}
|
|
@@ -2930,66 +2867,66 @@ let ln = class extends ie {
|
|
|
2930
2867
|
const { toRange: t, fromRange: e } = i, n = ae(this._univerInstanceService);
|
|
2931
2868
|
if (!n)
|
|
2932
2869
|
return { redos: [], undos: [] };
|
|
2933
|
-
const { unitId: r, subUnitId: s } = n, o = (b = (C = this._renderManagerService.getRenderById(r)) == null ? void 0 : C.with(
|
|
2870
|
+
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
2871
|
if (!o)
|
|
2935
2872
|
return { redos: [], undos: [] };
|
|
2936
|
-
const a =
|
|
2873
|
+
const a = Vn(o, e);
|
|
2937
2874
|
if (!a)
|
|
2938
2875
|
return { redos: [], undos: [] };
|
|
2939
|
-
const { startX:
|
|
2876
|
+
const { startX: d, endX: u, startY: c, endY: l } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
|
|
2940
2877
|
Object.keys(g).forEach((v) => {
|
|
2941
2878
|
const D = g[v];
|
|
2942
2879
|
if (D.anchorType !== O.Both)
|
|
2943
2880
|
return;
|
|
2944
|
-
const { transform:
|
|
2945
|
-
if (!
|
|
2881
|
+
const { transform: w } = D;
|
|
2882
|
+
if (!w)
|
|
2946
2883
|
return;
|
|
2947
|
-
const { left:
|
|
2948
|
-
drawingStartX:
|
|
2949
|
-
drawingEndX:
|
|
2884
|
+
const { left: y = 0, top: I = 0, width: E = 0, height: T = 0 } = w, { drawingStartX: M, drawingEndX: R, drawingStartY: N, drawingEndY: B } = {
|
|
2885
|
+
drawingStartX: y,
|
|
2886
|
+
drawingEndX: y + E,
|
|
2950
2887
|
drawingStartY: I,
|
|
2951
2888
|
drawingEndY: I + T
|
|
2952
2889
|
};
|
|
2953
|
-
|
|
2890
|
+
d <= M && R <= u && c <= N && B <= l && h.push(D);
|
|
2954
2891
|
});
|
|
2955
|
-
const
|
|
2956
|
-
const D = v.sheetTransform,
|
|
2957
|
-
to: { ...D.to, row: D.to.row +
|
|
2958
|
-
from: { ...D.from, row: D.from.row +
|
|
2959
|
-
},
|
|
2892
|
+
const m = [], p = [], f = t.startRow - e.startRow, _ = t.startColumn - e.startColumn, S = h.map((v) => {
|
|
2893
|
+
const D = v.sheetTransform, w = {
|
|
2894
|
+
to: { ...D.to, row: D.to.row + f, column: D.to.column + _ },
|
|
2895
|
+
from: { ...D.from, row: D.from.row + f, column: D.from.column + _ }
|
|
2896
|
+
}, y = z(w, this._selectionRenderService, this._skeletonManagerService);
|
|
2960
2897
|
return {
|
|
2961
2898
|
unitId: r,
|
|
2962
2899
|
subUnitId: s,
|
|
2963
2900
|
drawingId: v.drawingId,
|
|
2964
|
-
transform:
|
|
2965
|
-
sheetTransform:
|
|
2901
|
+
transform: y,
|
|
2902
|
+
sheetTransform: w
|
|
2966
2903
|
};
|
|
2967
2904
|
});
|
|
2968
2905
|
if (S.length) {
|
|
2969
|
-
const v = this._sheetDrawingService.getBatchUpdateOp(S), { undo: D, redo:
|
|
2970
|
-
|
|
2906
|
+
const v = this._sheetDrawingService.getBatchUpdateOp(S), { undo: D, redo: w, objects: y } = v;
|
|
2907
|
+
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
2908
|
}
|
|
2972
|
-
return { redos:
|
|
2909
|
+
return { redos: m, undos: p };
|
|
2973
2910
|
}
|
|
2974
2911
|
_moveRowInterceptor(i, t) {
|
|
2975
2912
|
const e = this._getUnitIdAndSubUnitId(i, t);
|
|
2976
2913
|
if (e == null)
|
|
2977
2914
|
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 ||
|
|
2915
|
+
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 = [];
|
|
2916
|
+
if (Object.keys(c).forEach((h) => {
|
|
2917
|
+
const m = c[h], { sheetTransform: p, transform: f, anchorType: _ = O.Position } = m;
|
|
2918
|
+
if (p == null || f == null)
|
|
2982
2919
|
return;
|
|
2983
2920
|
let S, C;
|
|
2984
2921
|
if (t === "insert") {
|
|
2985
|
-
const v = this._expandRow(p,
|
|
2922
|
+
const v = this._expandRow(p, f, o, a, _);
|
|
2986
2923
|
S = v == null ? void 0 : v.newSheetTransform, C = v == null ? void 0 : v.newTransform;
|
|
2987
2924
|
} else {
|
|
2988
|
-
const { from: v, to: D } = p, { row:
|
|
2989
|
-
if (
|
|
2925
|
+
const { from: v, to: D } = p, { row: w } = v, { row: y } = D;
|
|
2926
|
+
if (_ === O.Both && w >= o && y <= a)
|
|
2990
2927
|
g.push({ unitId: n, subUnitId: r, drawingId: h });
|
|
2991
2928
|
else {
|
|
2992
|
-
const I = this._shrinkRow(p,
|
|
2929
|
+
const I = this._shrinkRow(p, f, o, a, _);
|
|
2993
2930
|
S = I == null ? void 0 : I.newSheetTransform, C = I == null ? void 0 : I.newTransform;
|
|
2994
2931
|
}
|
|
2995
2932
|
}
|
|
@@ -3000,15 +2937,15 @@ let ln = class extends ie {
|
|
|
3000
2937
|
}), l.length === 0 && g.length === 0)
|
|
3001
2938
|
return { redos: [], undos: [] };
|
|
3002
2939
|
if (l.length > 0) {
|
|
3003
|
-
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo:
|
|
3004
|
-
|
|
2940
|
+
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: p, objects: f } = h;
|
|
2941
|
+
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
2942
|
}
|
|
3006
2943
|
if (g.length > 0) {
|
|
3007
|
-
const h = this._sheetDrawingService.getBatchRemoveOp(g),
|
|
3008
|
-
|
|
2944
|
+
const h = this._sheetDrawingService.getBatchRemoveOp(g), m = h.undo, p = h.redo, f = h.objects;
|
|
2945
|
+
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
2946
|
}
|
|
3010
|
-
return
|
|
3011
|
-
redos:
|
|
2947
|
+
return d.push({ id: L.id, params: [n] }), u.push({ id: L.id, params: [n] }), {
|
|
2948
|
+
redos: d,
|
|
3012
2949
|
undos: u
|
|
3013
2950
|
};
|
|
3014
2951
|
}
|
|
@@ -3016,21 +2953,21 @@ let ln = class extends ie {
|
|
|
3016
2953
|
const e = this._getUnitIdAndSubUnitId(i, t);
|
|
3017
2954
|
if (e == null)
|
|
3018
2955
|
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 ||
|
|
2956
|
+
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 = [];
|
|
2957
|
+
if (Object.keys(c).forEach((h) => {
|
|
2958
|
+
const m = c[h], { sheetTransform: p, transform: f, anchorType: _ = O.Position } = m;
|
|
2959
|
+
if (p == null || f == null)
|
|
3023
2960
|
return;
|
|
3024
2961
|
let S, C;
|
|
3025
2962
|
if (t === "insert") {
|
|
3026
|
-
const v = this._expandCol(p,
|
|
2963
|
+
const v = this._expandCol(p, f, o, a, _);
|
|
3027
2964
|
S = v == null ? void 0 : v.newSheetTransform, C = v == null ? void 0 : v.newTransform;
|
|
3028
2965
|
} else {
|
|
3029
|
-
const { from: v, to: D } = p, { column:
|
|
3030
|
-
if (
|
|
2966
|
+
const { from: v, to: D } = p, { column: w } = v, { column: y } = D;
|
|
2967
|
+
if (_ === O.Both && w >= o && y <= a)
|
|
3031
2968
|
g.push({ unitId: n, subUnitId: r, drawingId: h });
|
|
3032
2969
|
else {
|
|
3033
|
-
const I = this._shrinkCol(p,
|
|
2970
|
+
const I = this._shrinkCol(p, f, o, a, _);
|
|
3034
2971
|
S = I == null ? void 0 : I.newSheetTransform, C = I == null ? void 0 : I.newTransform;
|
|
3035
2972
|
}
|
|
3036
2973
|
}
|
|
@@ -3041,81 +2978,81 @@ let ln = class extends ie {
|
|
|
3041
2978
|
}), l.length === 0 && g.length === 0)
|
|
3042
2979
|
return { redos: [], undos: [] };
|
|
3043
2980
|
if (l.length > 0) {
|
|
3044
|
-
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo:
|
|
3045
|
-
|
|
2981
|
+
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: p, objects: f } = h;
|
|
2982
|
+
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
2983
|
}
|
|
3047
2984
|
if (g.length > 0) {
|
|
3048
|
-
const h = this._sheetDrawingService.getBatchRemoveOp(g),
|
|
3049
|
-
|
|
2985
|
+
const h = this._sheetDrawingService.getBatchRemoveOp(g), m = h.undo, p = h.redo, f = h.objects;
|
|
2986
|
+
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
2987
|
}
|
|
3051
|
-
return
|
|
2988
|
+
return d.push({ id: L.id, params: [n] }), u.push({ id: L.id, params: [n] }), { redos: d, undos: u };
|
|
3052
2989
|
}
|
|
3053
2990
|
_expandCol(i, t, e, n, r = O.Position) {
|
|
3054
|
-
const s = n - e + 1, { from: o, to: a } = i, { column:
|
|
2991
|
+
const s = n - e + 1, { from: o, to: a } = i, { column: d } = o, { column: u } = a;
|
|
3055
2992
|
if (r === O.None)
|
|
3056
2993
|
return {
|
|
3057
2994
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3058
2995
|
newTransform: t
|
|
3059
2996
|
};
|
|
3060
|
-
let
|
|
3061
|
-
if (
|
|
2997
|
+
let c = null, l = null;
|
|
2998
|
+
if (d >= e) {
|
|
3062
2999
|
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: e, endColumn: n, startRow: o.row, endRow: a.row });
|
|
3063
3000
|
if (g == null)
|
|
3064
3001
|
return;
|
|
3065
|
-
l = { ...t, left: (t.left || 0) + g.endX - g.startX },
|
|
3002
|
+
l = { ...t, left: (t.left || 0) + g.endX - g.startX }, c = x(l, this._selectionRenderService);
|
|
3066
3003
|
} else if (u >= n)
|
|
3067
3004
|
if (r === O.Both)
|
|
3068
|
-
|
|
3005
|
+
c = {
|
|
3069
3006
|
from: { ...o },
|
|
3070
3007
|
to: { ...a, column: u + s }
|
|
3071
|
-
}, l =
|
|
3008
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3072
3009
|
else
|
|
3073
3010
|
return {
|
|
3074
3011
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3075
3012
|
newTransform: t
|
|
3076
3013
|
};
|
|
3077
|
-
return
|
|
3078
|
-
newSheetTransform:
|
|
3014
|
+
return c != null && l != null ? {
|
|
3015
|
+
newSheetTransform: c,
|
|
3079
3016
|
newTransform: l
|
|
3080
3017
|
} : null;
|
|
3081
3018
|
}
|
|
3082
3019
|
_shrinkCol(i, t, e, n, r = O.Position) {
|
|
3083
|
-
const s = n - e + 1, { from: o, to: a } = i, { column:
|
|
3020
|
+
const s = n - e + 1, { from: o, to: a } = i, { column: d } = o, { column: u } = a;
|
|
3084
3021
|
if (r === O.None)
|
|
3085
3022
|
return {
|
|
3086
3023
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3087
3024
|
newTransform: t
|
|
3088
3025
|
};
|
|
3089
|
-
let
|
|
3090
|
-
if (
|
|
3091
|
-
|
|
3092
|
-
from: { ...o, column:
|
|
3026
|
+
let c = null, l = null;
|
|
3027
|
+
if (d > n)
|
|
3028
|
+
c = {
|
|
3029
|
+
from: { ...o, column: d - s },
|
|
3093
3030
|
to: { ...a, column: u - s }
|
|
3094
|
-
}, l =
|
|
3031
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3095
3032
|
else {
|
|
3096
|
-
if (
|
|
3033
|
+
if (d >= e && u <= n)
|
|
3097
3034
|
return null;
|
|
3098
|
-
if (
|
|
3035
|
+
if (d < e && u > n)
|
|
3099
3036
|
if (r === O.Both)
|
|
3100
|
-
|
|
3037
|
+
c = {
|
|
3101
3038
|
from: { ...o },
|
|
3102
3039
|
to: { ...a, column: u - s }
|
|
3103
|
-
}, l =
|
|
3040
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3104
3041
|
else
|
|
3105
3042
|
return {
|
|
3106
3043
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3107
3044
|
newTransform: t
|
|
3108
3045
|
};
|
|
3109
|
-
else if (
|
|
3110
|
-
if (
|
|
3046
|
+
else if (d >= e && d <= n) {
|
|
3047
|
+
if (d === e)
|
|
3111
3048
|
l = { ...t, left: (t.left || 0) - i.from.columnOffset };
|
|
3112
3049
|
else {
|
|
3113
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: e, endColumn:
|
|
3050
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: e, endColumn: d - 1, startRow: o.row, endRow: a.row });
|
|
3114
3051
|
if (g == null)
|
|
3115
3052
|
return;
|
|
3116
3053
|
l = { ...t, left: (t.left || 0) - g.endX + g.startX - i.from.columnOffset };
|
|
3117
3054
|
}
|
|
3118
|
-
|
|
3055
|
+
c = x(l, this._selectionRenderService);
|
|
3119
3056
|
} else if (u >= e && u <= n && r === O.Both) {
|
|
3120
3057
|
const g = this._skeletonManagerService.attachRangeWithCoord({
|
|
3121
3058
|
startColumn: e - 1,
|
|
@@ -3125,98 +3062,98 @@ let ln = class extends ie {
|
|
|
3125
3062
|
});
|
|
3126
3063
|
if (g == null)
|
|
3127
3064
|
return;
|
|
3128
|
-
|
|
3065
|
+
c = {
|
|
3129
3066
|
from: { ...o },
|
|
3130
3067
|
to: { ...a, column: e - 1, columnOffset: g.endX - g.startX }
|
|
3131
|
-
}, l =
|
|
3068
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3132
3069
|
}
|
|
3133
3070
|
}
|
|
3134
|
-
return
|
|
3135
|
-
newSheetTransform:
|
|
3071
|
+
return c != null && l != null ? {
|
|
3072
|
+
newSheetTransform: c,
|
|
3136
3073
|
newTransform: l
|
|
3137
3074
|
} : null;
|
|
3138
3075
|
}
|
|
3139
3076
|
_expandRow(i, t, e, n, r = O.Position) {
|
|
3140
|
-
const s = n - e + 1, { from: o, to: a } = i, { row:
|
|
3077
|
+
const s = n - e + 1, { from: o, to: a } = i, { row: d } = o, { row: u } = a;
|
|
3141
3078
|
if (r === O.None)
|
|
3142
3079
|
return {
|
|
3143
3080
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3144
3081
|
newTransform: t
|
|
3145
3082
|
};
|
|
3146
|
-
let
|
|
3147
|
-
if (
|
|
3083
|
+
let c = null, l = null;
|
|
3084
|
+
if (d >= e) {
|
|
3148
3085
|
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: e, endRow: n, startColumn: o.column, endColumn: a.column });
|
|
3149
3086
|
if (g == null)
|
|
3150
3087
|
return;
|
|
3151
|
-
l = { ...t, top: (t.top || 0) + g.endY - g.startY },
|
|
3088
|
+
l = { ...t, top: (t.top || 0) + g.endY - g.startY }, c = x(l, this._selectionRenderService);
|
|
3152
3089
|
} else if (u >= n)
|
|
3153
3090
|
if (r === O.Both)
|
|
3154
|
-
|
|
3091
|
+
c = {
|
|
3155
3092
|
from: { ...o },
|
|
3156
3093
|
to: {
|
|
3157
3094
|
...a,
|
|
3158
3095
|
row: u + s
|
|
3159
3096
|
}
|
|
3160
|
-
}, l =
|
|
3097
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3161
3098
|
else
|
|
3162
3099
|
return {
|
|
3163
3100
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3164
3101
|
newTransform: t
|
|
3165
3102
|
};
|
|
3166
|
-
return
|
|
3167
|
-
newSheetTransform:
|
|
3103
|
+
return c != null && l != null ? {
|
|
3104
|
+
newSheetTransform: c,
|
|
3168
3105
|
newTransform: l
|
|
3169
3106
|
} : null;
|
|
3170
3107
|
}
|
|
3171
3108
|
_shrinkRow(i, t, e, n, r = O.Position) {
|
|
3172
|
-
const s = n - e + 1, { from: o, to: a } = i, { row:
|
|
3109
|
+
const s = n - e + 1, { from: o, to: a } = i, { row: d } = o, { row: u } = a;
|
|
3173
3110
|
if (r === O.None)
|
|
3174
3111
|
return {
|
|
3175
3112
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3176
3113
|
newTransform: t
|
|
3177
3114
|
};
|
|
3178
|
-
let
|
|
3179
|
-
if (
|
|
3180
|
-
|
|
3181
|
-
from: { ...o, row:
|
|
3115
|
+
let c = null, l = null;
|
|
3116
|
+
if (d > n)
|
|
3117
|
+
c = {
|
|
3118
|
+
from: { ...o, row: d - s },
|
|
3182
3119
|
to: { ...a, row: u - s }
|
|
3183
|
-
}, l =
|
|
3120
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3184
3121
|
else {
|
|
3185
|
-
if (
|
|
3122
|
+
if (d >= e && u <= n)
|
|
3186
3123
|
return null;
|
|
3187
|
-
if (
|
|
3124
|
+
if (d < e && u > n)
|
|
3188
3125
|
if (r === O.Both)
|
|
3189
|
-
|
|
3126
|
+
c = {
|
|
3190
3127
|
from: { ...o },
|
|
3191
3128
|
to: { ...a, row: u - s }
|
|
3192
|
-
}, l =
|
|
3129
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3193
3130
|
else
|
|
3194
3131
|
return {
|
|
3195
3132
|
newSheetTransform: x({ ...t }, this._selectionRenderService),
|
|
3196
3133
|
newTransform: t
|
|
3197
3134
|
};
|
|
3198
|
-
else if (
|
|
3199
|
-
if (
|
|
3135
|
+
else if (d >= e && d <= n) {
|
|
3136
|
+
if (d === e)
|
|
3200
3137
|
l = { ...t, top: (t.top || 0) - i.from.rowOffset };
|
|
3201
3138
|
else {
|
|
3202
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: e, endRow:
|
|
3139
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: e, endRow: d - 1, startColumn: o.column, endColumn: a.column });
|
|
3203
3140
|
if (g == null)
|
|
3204
3141
|
return;
|
|
3205
3142
|
l = { ...t, top: (t.top || 0) - g.endY + g.startY - i.from.rowOffset };
|
|
3206
3143
|
}
|
|
3207
|
-
|
|
3144
|
+
c = x(l, this._selectionRenderService);
|
|
3208
3145
|
} else if (u >= e && u <= n && r === O.Both) {
|
|
3209
3146
|
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: e - 1, endRow: e - 1 });
|
|
3210
3147
|
if (g == null)
|
|
3211
3148
|
return;
|
|
3212
|
-
|
|
3149
|
+
c = {
|
|
3213
3150
|
from: { ...o },
|
|
3214
3151
|
to: { ...a, row: e - 1, rowOffset: g.endY - g.startY }
|
|
3215
|
-
}, l =
|
|
3152
|
+
}, l = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3216
3153
|
}
|
|
3217
3154
|
}
|
|
3218
|
-
return
|
|
3219
|
-
newSheetTransform:
|
|
3155
|
+
return c != null && l != null ? {
|
|
3156
|
+
newSheetTransform: c,
|
|
3220
3157
|
newTransform: l
|
|
3221
3158
|
} : null;
|
|
3222
3159
|
}
|
|
@@ -3226,7 +3163,7 @@ let ln = class extends ie {
|
|
|
3226
3163
|
// but the skeleton changes like other render modules. These two signals are not equivalent.
|
|
3227
3164
|
// As a temp solution, I subscribed to activate$ here.
|
|
3228
3165
|
this._commandService.onCommandExecuted((i) => {
|
|
3229
|
-
if (i.id ===
|
|
3166
|
+
if (i.id === ts.id) {
|
|
3230
3167
|
const { unitId: t, subUnitId: e } = i.params;
|
|
3231
3168
|
this._updateDrawings(t, e);
|
|
3232
3169
|
}
|
|
@@ -3262,13 +3199,13 @@ let ln = class extends ie {
|
|
|
3262
3199
|
Object.keys(e).forEach((s) => {
|
|
3263
3200
|
const o = e[s];
|
|
3264
3201
|
o != null && Object.keys(o).forEach((a) => {
|
|
3265
|
-
const
|
|
3266
|
-
|
|
3202
|
+
const d = o[a].data;
|
|
3203
|
+
d != null && Object.keys(d).forEach((u) => {
|
|
3267
3204
|
if (s === i && a === t) {
|
|
3268
|
-
const
|
|
3269
|
-
|
|
3205
|
+
const c = d[u];
|
|
3206
|
+
c.transform = z(c.sheetTransform, this._selectionRenderService, this._skeletonManagerService), n.push(d[u]);
|
|
3270
3207
|
} else
|
|
3271
|
-
r.push(
|
|
3208
|
+
r.push(d[u]);
|
|
3272
3209
|
});
|
|
3273
3210
|
});
|
|
3274
3211
|
}), this._drawingManagerService.removeNotification(r), this._drawingManagerService.addNotification(n);
|
|
@@ -3277,7 +3214,7 @@ let ln = class extends ie {
|
|
|
3277
3214
|
_sheetRefreshListener() {
|
|
3278
3215
|
this.disposeWithMe(
|
|
3279
3216
|
this._commandService.onCommandExecuted((i) => {
|
|
3280
|
-
|
|
3217
|
+
Fs.includes(i.id) && requestIdleCallback(() => {
|
|
3281
3218
|
const t = i.params, { unitId: e, subUnitId: n, ranges: r } = t;
|
|
3282
3219
|
this._refreshDrawingTransform(e, n, r);
|
|
3283
3220
|
});
|
|
@@ -3287,13 +3224,13 @@ let ln = class extends ie {
|
|
|
3287
3224
|
_refreshDrawingTransform(i, t, e) {
|
|
3288
3225
|
const n = this._drawingManagerService.getDrawingData(i, t), r = [];
|
|
3289
3226
|
Object.keys(n).forEach((s) => {
|
|
3290
|
-
const o = n[s], { sheetTransform: a, transform:
|
|
3227
|
+
const o = n[s], { sheetTransform: a, transform: d, anchorType: u = O.Position } = o;
|
|
3291
3228
|
if (u === O.None)
|
|
3292
3229
|
return !0;
|
|
3293
|
-
const { from:
|
|
3294
|
-
for (let
|
|
3295
|
-
const
|
|
3296
|
-
if (
|
|
3230
|
+
const { from: c, to: l } = a, { row: g, column: h } = c, { row: m, column: p } = l;
|
|
3231
|
+
for (let f = 0; f < e.length; f++) {
|
|
3232
|
+
const _ = e[f], { startRow: S, endRow: C, startColumn: b, endColumn: v } = _;
|
|
3233
|
+
if (Hr.intersects(
|
|
3297
3234
|
{
|
|
3298
3235
|
startRow: S,
|
|
3299
3236
|
endRow: C,
|
|
@@ -3302,36 +3239,36 @@ let ln = class extends ie {
|
|
|
3302
3239
|
},
|
|
3303
3240
|
{
|
|
3304
3241
|
startRow: g,
|
|
3305
|
-
endRow:
|
|
3242
|
+
endRow: m,
|
|
3306
3243
|
startColumn: h,
|
|
3307
3244
|
endColumn: p
|
|
3308
3245
|
}
|
|
3309
3246
|
) || g > C || h > v) {
|
|
3310
|
-
const D = u === O.Position,
|
|
3247
|
+
const D = u === O.Position, w = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
3311
3248
|
r.push({
|
|
3312
3249
|
...o,
|
|
3313
3250
|
transform: {
|
|
3314
|
-
...
|
|
3315
|
-
width: D ?
|
|
3316
|
-
height: D ?
|
|
3251
|
+
...w,
|
|
3252
|
+
width: D ? d == null ? void 0 : d.width : w == null ? void 0 : w.width,
|
|
3253
|
+
height: D ? d == null ? void 0 : d.height : w == null ? void 0 : w.height
|
|
3317
3254
|
}
|
|
3318
3255
|
});
|
|
3319
3256
|
break;
|
|
3320
3257
|
}
|
|
3321
3258
|
}
|
|
3322
|
-
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(
|
|
3259
|
+
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(L.id, [i]));
|
|
3323
3260
|
}
|
|
3324
3261
|
};
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
],
|
|
3262
|
+
sn = $s([
|
|
3263
|
+
pe(1, q),
|
|
3264
|
+
pe(2, G),
|
|
3265
|
+
pe(3, Ge),
|
|
3266
|
+
pe(4, A(V)),
|
|
3267
|
+
pe(5, A(kt)),
|
|
3268
|
+
pe(6, oe),
|
|
3269
|
+
pe(7, se),
|
|
3270
|
+
pe(8, Se)
|
|
3271
|
+
], sn);
|
|
3335
3272
|
var re = function() {
|
|
3336
3273
|
return re = Object.assign || function(i) {
|
|
3337
3274
|
for (var t, e = 1, n = arguments.length; e < n; e++) {
|
|
@@ -3340,23 +3277,23 @@ var re = function() {
|
|
|
3340
3277
|
}
|
|
3341
3278
|
return i;
|
|
3342
3279
|
}, re.apply(this, arguments);
|
|
3343
|
-
},
|
|
3280
|
+
}, Ls = function(i, t) {
|
|
3344
3281
|
var e = {};
|
|
3345
3282
|
for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && t.indexOf(n) < 0 && (e[n] = i[n]);
|
|
3346
3283
|
if (i != null && typeof Object.getOwnPropertySymbols == "function")
|
|
3347
3284
|
for (var r = 0, n = Object.getOwnPropertySymbols(i); r < n.length; r++)
|
|
3348
3285
|
t.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, n[r]) && (e[n[r]] = i[n[r]]);
|
|
3349
3286
|
return e;
|
|
3350
|
-
},
|
|
3351
|
-
var e = i.icon, n = i.id, r = i.className, s = i.extend, o =
|
|
3352
|
-
return
|
|
3287
|
+
}, br = hr(function(i, t) {
|
|
3288
|
+
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()));
|
|
3289
|
+
return Rr(e, "".concat(n), { defIds: e.defIds, idSuffix: d.current }, re({ ref: t, className: a }, o), s);
|
|
3353
3290
|
});
|
|
3354
|
-
function
|
|
3355
|
-
return
|
|
3356
|
-
return
|
|
3291
|
+
function Rr(i, t, e, n, r) {
|
|
3292
|
+
return gr(i.tag, re(re({ key: t }, Ys(i, e, r)), n), (Gs(i, e).children || []).map(function(s, o) {
|
|
3293
|
+
return Rr(s, "".concat(t, "-").concat(i.tag, "-").concat(o), e, void 0, r);
|
|
3357
3294
|
}));
|
|
3358
3295
|
}
|
|
3359
|
-
function
|
|
3296
|
+
function Ys(i, t, e) {
|
|
3360
3297
|
var n = re({}, i.attrs);
|
|
3361
3298
|
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
3299
|
var o = s[0], a = s[1];
|
|
@@ -3368,25 +3305,25 @@ function to(i, t, e) {
|
|
|
3368
3305
|
typeof a == "string" && (n[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
3369
3306
|
})), n;
|
|
3370
3307
|
}
|
|
3371
|
-
function
|
|
3308
|
+
function Gs(i, t) {
|
|
3372
3309
|
var e, n = t.defIds;
|
|
3373
3310
|
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
3311
|
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
3312
|
}) }) : i;
|
|
3376
3313
|
}
|
|
3377
|
-
function
|
|
3314
|
+
function Xs() {
|
|
3378
3315
|
return Math.random().toString(36).substring(2, 8);
|
|
3379
3316
|
}
|
|
3380
|
-
|
|
3381
|
-
var
|
|
3382
|
-
return
|
|
3317
|
+
br.displayName = "UniverIcon";
|
|
3318
|
+
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) {
|
|
3319
|
+
return gr(br, Object.assign({}, i, {
|
|
3383
3320
|
id: "add-image-single",
|
|
3384
3321
|
ref: t,
|
|
3385
|
-
icon:
|
|
3322
|
+
icon: Vs
|
|
3386
3323
|
}));
|
|
3387
3324
|
});
|
|
3388
|
-
|
|
3389
|
-
const
|
|
3325
|
+
Mr.displayName = "AddImageSingle";
|
|
3326
|
+
const yr = {
|
|
3390
3327
|
id: "sheet.command.delete-drawing",
|
|
3391
3328
|
type: J.COMMAND,
|
|
3392
3329
|
handler: (i) => {
|
|
@@ -3394,113 +3331,106 @@ const Ar = {
|
|
|
3394
3331
|
if (n.length === 0)
|
|
3395
3332
|
return !1;
|
|
3396
3333
|
const r = n[0].unitId, s = n.map((o) => {
|
|
3397
|
-
const { unitId: a, subUnitId:
|
|
3334
|
+
const { unitId: a, subUnitId: d, drawingId: u, drawingType: c } = o;
|
|
3398
3335
|
return {
|
|
3399
3336
|
unitId: a,
|
|
3400
|
-
subUnitId:
|
|
3337
|
+
subUnitId: d,
|
|
3401
3338
|
drawingId: u,
|
|
3402
|
-
drawingType:
|
|
3339
|
+
drawingType: c
|
|
3403
3340
|
};
|
|
3404
3341
|
});
|
|
3405
|
-
return t.executeCommand(
|
|
3342
|
+
return t.executeCommand(rt.id, {
|
|
3406
3343
|
unitId: r,
|
|
3407
3344
|
drawings: s
|
|
3408
3345
|
});
|
|
3409
3346
|
}
|
|
3410
|
-
},
|
|
3347
|
+
}, it = {
|
|
3411
3348
|
id: "sheet.command.move-drawing",
|
|
3412
3349
|
type: J.COMMAND,
|
|
3413
3350
|
handler: (i, t) => {
|
|
3414
|
-
const e = i.get(G), n = i.get(oe), r = i.get(
|
|
3351
|
+
const e = i.get(G), n = i.get(oe), r = i.get(Ge), { direction: s } = t, o = n.getFocusDrawings();
|
|
3415
3352
|
if (o.length === 0)
|
|
3416
3353
|
return !1;
|
|
3417
|
-
const a = o[0].unitId,
|
|
3418
|
-
const { transform: l } =
|
|
3354
|
+
const a = o[0].unitId, d = o.map((c) => {
|
|
3355
|
+
const { transform: l } = c;
|
|
3419
3356
|
if (l == null)
|
|
3420
3357
|
return null;
|
|
3421
|
-
const g = { ...l }, { left: h = 0, top:
|
|
3422
|
-
return s ===
|
|
3423
|
-
...
|
|
3358
|
+
const g = { ...l }, { left: h = 0, top: m = 0 } = l;
|
|
3359
|
+
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), {
|
|
3360
|
+
...c,
|
|
3424
3361
|
transform: g,
|
|
3425
3362
|
sheetTransform: x(g, r)
|
|
3426
3363
|
};
|
|
3427
|
-
}).filter((
|
|
3428
|
-
return e.syncExecuteCommand(
|
|
3364
|
+
}).filter((c) => c != null);
|
|
3365
|
+
return e.syncExecuteCommand(jt.id, {
|
|
3429
3366
|
unitId: a,
|
|
3430
|
-
drawings:
|
|
3431
|
-
}) ? (e.syncExecuteCommand(
|
|
3367
|
+
drawings: d
|
|
3368
|
+
}) ? (e.syncExecuteCommand(L.id, [a]), !0) : !1;
|
|
3432
3369
|
}
|
|
3433
|
-
},
|
|
3434
|
-
function
|
|
3370
|
+
}, Er = "addition-and-subtraction-single", Tr = "sheet.menu.image";
|
|
3371
|
+
function Hs(i) {
|
|
3435
3372
|
return {
|
|
3436
|
-
id:
|
|
3437
|
-
type:
|
|
3438
|
-
icon:
|
|
3373
|
+
id: Tr,
|
|
3374
|
+
type: cn.SUBITEMS,
|
|
3375
|
+
icon: Er,
|
|
3439
3376
|
tooltip: "sheetImage.title",
|
|
3440
|
-
hidden$:
|
|
3441
|
-
disabled$:
|
|
3377
|
+
hidden$: an(i, F.UNIVER_SHEET),
|
|
3378
|
+
disabled$: Oi(i, { workbookTypes: [Kt], worksheetTypes: [Zt], rangeTypes: [ns] })
|
|
3442
3379
|
};
|
|
3443
3380
|
}
|
|
3444
|
-
function
|
|
3381
|
+
function zs(i) {
|
|
3445
3382
|
return {
|
|
3446
|
-
id:
|
|
3383
|
+
id: Bt.id,
|
|
3447
3384
|
title: "sheetImage.upload.float",
|
|
3448
|
-
type:
|
|
3449
|
-
hidden$:
|
|
3385
|
+
type: cn.BUTTON,
|
|
3386
|
+
hidden$: an(i, F.UNIVER_SHEET)
|
|
3450
3387
|
};
|
|
3451
3388
|
}
|
|
3452
|
-
function
|
|
3389
|
+
function Ks(i) {
|
|
3453
3390
|
return {
|
|
3454
|
-
id:
|
|
3391
|
+
id: ln.id,
|
|
3455
3392
|
title: "sheetImage.upload.cell",
|
|
3456
|
-
type:
|
|
3457
|
-
hidden$:
|
|
3393
|
+
type: cn.BUTTON,
|
|
3394
|
+
hidden$: an(i, F.UNIVER_SHEET)
|
|
3458
3395
|
};
|
|
3459
3396
|
}
|
|
3460
|
-
const
|
|
3461
|
-
imageCommonPanel: co,
|
|
3462
|
-
imageCommonPanelGrid: lo,
|
|
3463
|
-
imageCommonPanelBorder: uo,
|
|
3464
|
-
imageCommonPanelTitle: ho,
|
|
3465
|
-
imageCommonPanelRow: go,
|
|
3466
|
-
imageCommonPanelColumn: mo
|
|
3467
|
-
}, fo = (i) => {
|
|
3397
|
+
const Zs = (i) => {
|
|
3468
3398
|
var C;
|
|
3469
|
-
const t =
|
|
3399
|
+
const t = Qe(G), e = Qe(nt), n = Qe(se), r = Qe(q), { drawings: s } = i, o = s[0];
|
|
3470
3400
|
if (o == null)
|
|
3471
3401
|
return;
|
|
3472
|
-
const { unitId: a } = o,
|
|
3402
|
+
const { unitId: a } = o, d = r.getRenderById(a), u = d == null ? void 0 : d.scene;
|
|
3473
3403
|
if (u == null)
|
|
3474
3404
|
return;
|
|
3475
|
-
const
|
|
3476
|
-
function
|
|
3405
|
+
const c = u.getTransformerByCreate(), [l, g] = en(!0), h = (C = o.anchorType) != null ? C : O.Position, [m, p] = en(h);
|
|
3406
|
+
function f(b, v) {
|
|
3477
3407
|
const D = [];
|
|
3478
|
-
return b.forEach((
|
|
3479
|
-
const { oKey:
|
|
3408
|
+
return b.forEach((w) => {
|
|
3409
|
+
const { oKey: y } = w, I = v.getDrawingOKey(y);
|
|
3480
3410
|
if (I == null)
|
|
3481
3411
|
return D.push(null), !0;
|
|
3482
|
-
const { unitId: E, subUnitId: T, drawingId:
|
|
3412
|
+
const { unitId: E, subUnitId: T, drawingId: M, drawingType: R, anchorType: N, sheetTransform: B } = I;
|
|
3483
3413
|
D.push({
|
|
3484
3414
|
unitId: E,
|
|
3485
3415
|
subUnitId: T,
|
|
3486
|
-
drawingId:
|
|
3416
|
+
drawingId: M,
|
|
3487
3417
|
anchorType: N,
|
|
3488
|
-
sheetTransform:
|
|
3418
|
+
sheetTransform: B,
|
|
3489
3419
|
drawingType: R
|
|
3490
3420
|
});
|
|
3491
3421
|
}), D;
|
|
3492
3422
|
}
|
|
3493
|
-
|
|
3494
|
-
const b =
|
|
3423
|
+
fr(() => {
|
|
3424
|
+
const b = c.clearControl$.subscribe((D) => {
|
|
3495
3425
|
D === !0 && g(!1);
|
|
3496
|
-
}), v =
|
|
3426
|
+
}), v = c.changeStart$.subscribe((D) => {
|
|
3497
3427
|
var I;
|
|
3498
|
-
const { objects:
|
|
3499
|
-
if (
|
|
3428
|
+
const { objects: w } = D, y = f(w, n);
|
|
3429
|
+
if (y.length === 0)
|
|
3500
3430
|
g(!1);
|
|
3501
|
-
else if (
|
|
3431
|
+
else if (y.length >= 1) {
|
|
3502
3432
|
g(!0);
|
|
3503
|
-
const E = ((I =
|
|
3433
|
+
const E = ((I = y[0]) == null ? void 0 : I.anchorType) || O.Position;
|
|
3504
3434
|
p(E);
|
|
3505
3435
|
}
|
|
3506
3436
|
});
|
|
@@ -3508,153 +3438,178 @@ const co = "univer-image-common-panel", lo = "univer-image-common-panel-grid", u
|
|
|
3508
3438
|
v.unsubscribe(), b.unsubscribe();
|
|
3509
3439
|
};
|
|
3510
3440
|
}, []);
|
|
3511
|
-
function
|
|
3441
|
+
function _(b) {
|
|
3512
3442
|
p(b);
|
|
3513
3443
|
const v = n.getFocusDrawings();
|
|
3514
3444
|
if (v.length === 0)
|
|
3515
3445
|
return;
|
|
3516
|
-
const D = v.map((
|
|
3517
|
-
unitId:
|
|
3518
|
-
subUnitId:
|
|
3519
|
-
drawingId:
|
|
3446
|
+
const D = v.map((w) => ({
|
|
3447
|
+
unitId: w.unitId,
|
|
3448
|
+
subUnitId: w.subUnitId,
|
|
3449
|
+
drawingId: w.drawingId,
|
|
3520
3450
|
anchorType: b
|
|
3521
3451
|
}));
|
|
3522
|
-
t.executeCommand(
|
|
3452
|
+
t.executeCommand(jt.id, {
|
|
3523
3453
|
unitId: v[0].unitId,
|
|
3524
3454
|
drawings: D
|
|
3525
3455
|
});
|
|
3526
3456
|
}
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3457
|
+
return /* @__PURE__ */ Qt(
|
|
3458
|
+
"div",
|
|
3459
|
+
{
|
|
3460
|
+
className: `
|
|
3461
|
+
univer-relative univer-mt-5 univer-w-full univer-border-b-0 univer-border-l-0 univer-border-r-0
|
|
3462
|
+
univer-border-t univer-border-solid univer-border-gray-200
|
|
3463
|
+
`,
|
|
3464
|
+
style: { display: ((b) => b ? "block" : "none")(l) },
|
|
3465
|
+
children: [
|
|
3466
|
+
/* @__PURE__ */ Z(
|
|
3467
|
+
"div",
|
|
3468
|
+
{
|
|
3469
|
+
className: `
|
|
3470
|
+
univer-relative univer-mt-2.5 univer-flex univer-h-full univer-items-start univer-justify-start
|
|
3471
|
+
`,
|
|
3472
|
+
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") }) })
|
|
3473
|
+
}
|
|
3474
|
+
),
|
|
3475
|
+
/* @__PURE__ */ Z(
|
|
3476
|
+
"div",
|
|
3477
|
+
{
|
|
3478
|
+
className: `
|
|
3479
|
+
univer-relative univer-mt-2.5 univer-flex univer-h-full univer-items-start univer-justify-start
|
|
3480
|
+
`,
|
|
3481
|
+
children: /* @__PURE__ */ Z("div", { className: "univer-flex univer-items-center univer-gap-1", children: /* @__PURE__ */ Qt(vi, { value: m, onChange: _, direction: "vertical", children: [
|
|
3482
|
+
/* @__PURE__ */ Z(Gt, { value: O.Both, children: e.t("drawing-anchor.both") }),
|
|
3483
|
+
/* @__PURE__ */ Z(Gt, { value: O.Position, children: e.t("drawing-anchor.position") }),
|
|
3484
|
+
/* @__PURE__ */ Z(Gt, { value: O.None, children: e.t("drawing-anchor.none") })
|
|
3485
|
+
] }) })
|
|
3486
|
+
}
|
|
3487
|
+
)
|
|
3488
|
+
]
|
|
3489
|
+
}
|
|
3490
|
+
);
|
|
3491
|
+
}, Js = () => {
|
|
3492
|
+
const i = Qe(se), t = i.getFocusDrawings(), [e, n] = en(t);
|
|
3493
|
+
return fr(() => {
|
|
3539
3494
|
const r = i.focus$.subscribe((s) => {
|
|
3540
3495
|
n(s);
|
|
3541
3496
|
});
|
|
3542
3497
|
return () => {
|
|
3543
3498
|
r.unsubscribe();
|
|
3544
3499
|
};
|
|
3545
|
-
}, []), !!(e != null && e.length) && /* @__PURE__ */
|
|
3546
|
-
/* @__PURE__ */
|
|
3547
|
-
/* @__PURE__ */
|
|
3500
|
+
}, []), !!(e != null && e.length) && /* @__PURE__ */ Qt("div", { className: "univer-p-2 univer-text-center univer-text-sm", children: [
|
|
3501
|
+
/* @__PURE__ */ Z(ui, { drawings: e }),
|
|
3502
|
+
/* @__PURE__ */ Z(Zs, { drawings: e })
|
|
3548
3503
|
] });
|
|
3549
|
-
},
|
|
3550
|
-
[
|
|
3551
|
-
[
|
|
3504
|
+
}, qs = {
|
|
3505
|
+
[Bi.FORMULAS_INSERT]: {
|
|
3506
|
+
[Tr]: {
|
|
3552
3507
|
order: 3,
|
|
3553
|
-
menuItemFactory:
|
|
3554
|
-
[
|
|
3508
|
+
menuItemFactory: Hs,
|
|
3509
|
+
[Bt.id]: {
|
|
3555
3510
|
order: 0,
|
|
3556
|
-
menuItemFactory:
|
|
3511
|
+
menuItemFactory: zs
|
|
3557
3512
|
},
|
|
3558
|
-
[
|
|
3513
|
+
[ln.id]: {
|
|
3559
3514
|
order: 1,
|
|
3560
|
-
menuItemFactory:
|
|
3515
|
+
menuItemFactory: Ks
|
|
3561
3516
|
}
|
|
3562
3517
|
}
|
|
3563
3518
|
}
|
|
3564
3519
|
};
|
|
3565
|
-
function
|
|
3566
|
-
return !i.getContextValue(
|
|
3520
|
+
function st(i) {
|
|
3521
|
+
return !i.getContextValue(zr) && !i.getContextValue(Kr) && !i.getContextValue(Zr) && i.getContextValue(xe);
|
|
3567
3522
|
}
|
|
3568
|
-
const
|
|
3569
|
-
id:
|
|
3523
|
+
const Qs = {
|
|
3524
|
+
id: it.id,
|
|
3570
3525
|
description: "shortcut.drawing-move-down",
|
|
3571
3526
|
group: "4_drawing-view",
|
|
3572
|
-
binding:
|
|
3527
|
+
binding: Fe.ARROW_DOWN,
|
|
3573
3528
|
priority: 100,
|
|
3574
|
-
preconditions:
|
|
3529
|
+
preconditions: st,
|
|
3575
3530
|
staticParameters: {
|
|
3576
|
-
direction:
|
|
3531
|
+
direction: ve.DOWN
|
|
3577
3532
|
}
|
|
3578
|
-
},
|
|
3579
|
-
id:
|
|
3533
|
+
}, eo = {
|
|
3534
|
+
id: it.id,
|
|
3580
3535
|
description: "shortcut.drawing-move-up",
|
|
3581
3536
|
group: "4_drawing-view",
|
|
3582
|
-
binding:
|
|
3537
|
+
binding: Fe.ARROW_UP,
|
|
3583
3538
|
priority: 100,
|
|
3584
|
-
preconditions:
|
|
3539
|
+
preconditions: st,
|
|
3585
3540
|
staticParameters: {
|
|
3586
|
-
direction:
|
|
3541
|
+
direction: ve.UP
|
|
3587
3542
|
}
|
|
3588
|
-
},
|
|
3589
|
-
id:
|
|
3543
|
+
}, to = {
|
|
3544
|
+
id: it.id,
|
|
3590
3545
|
description: "shortcut.drawing-move-left",
|
|
3591
3546
|
group: "4_drawing-view",
|
|
3592
|
-
binding:
|
|
3547
|
+
binding: Fe.ARROW_LEFT,
|
|
3593
3548
|
priority: 100,
|
|
3594
|
-
preconditions:
|
|
3549
|
+
preconditions: st,
|
|
3595
3550
|
staticParameters: {
|
|
3596
|
-
direction:
|
|
3551
|
+
direction: ve.LEFT
|
|
3597
3552
|
}
|
|
3598
|
-
},
|
|
3599
|
-
id:
|
|
3553
|
+
}, no = {
|
|
3554
|
+
id: it.id,
|
|
3600
3555
|
description: "shortcut.drawing-move-right",
|
|
3601
3556
|
group: "4_drawing-view",
|
|
3602
|
-
binding:
|
|
3557
|
+
binding: Fe.ARROW_RIGHT,
|
|
3603
3558
|
priority: 100,
|
|
3604
|
-
preconditions:
|
|
3559
|
+
preconditions: st,
|
|
3605
3560
|
staticParameters: {
|
|
3606
|
-
direction:
|
|
3561
|
+
direction: ve.RIGHT
|
|
3607
3562
|
}
|
|
3608
|
-
},
|
|
3609
|
-
id:
|
|
3563
|
+
}, ro = {
|
|
3564
|
+
id: yr.id,
|
|
3610
3565
|
description: "shortcut.drawing-delete",
|
|
3611
3566
|
group: "4_drawing-view",
|
|
3612
3567
|
// when focusing on any other input tag do not trigger this shortcut
|
|
3613
|
-
preconditions:
|
|
3614
|
-
binding:
|
|
3615
|
-
mac:
|
|
3568
|
+
preconditions: st,
|
|
3569
|
+
binding: Fe.DELETE,
|
|
3570
|
+
mac: Fe.BACKSPACE
|
|
3616
3571
|
};
|
|
3617
|
-
var
|
|
3618
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
3572
|
+
var io = Object.getOwnPropertyDescriptor, so = (i, t, e, n) => {
|
|
3573
|
+
for (var r = n > 1 ? void 0 : n ? io(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
3619
3574
|
(o = i[s]) && (r = o(r) || r);
|
|
3620
3575
|
return r;
|
|
3621
|
-
},
|
|
3622
|
-
let
|
|
3576
|
+
}, We = (i, t) => (e, n) => t(e, n, i);
|
|
3577
|
+
let Pt = class extends ie {
|
|
3623
3578
|
constructor(i, t, e, n, r, s) {
|
|
3624
3579
|
super(), this._componentManager = i, this._menuManagerService = t, this._commandService = e, this._shortcutService = n, this._drawingManagerService = r, this._sheetsSelectionsService = s, this._init();
|
|
3625
3580
|
}
|
|
3626
3581
|
_initCustomComponents() {
|
|
3627
3582
|
const i = this._componentManager;
|
|
3628
|
-
this.disposeWithMe(i.register(
|
|
3583
|
+
this.disposeWithMe(i.register(Er, Mr)), this.disposeWithMe(i.register(mr, Js));
|
|
3629
3584
|
}
|
|
3630
3585
|
_initMenus() {
|
|
3631
|
-
this._menuManagerService.mergeMenu(
|
|
3586
|
+
this._menuManagerService.mergeMenu(qs);
|
|
3632
3587
|
}
|
|
3633
3588
|
_initCommands() {
|
|
3634
3589
|
[
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3590
|
+
Bt,
|
|
3591
|
+
ln,
|
|
3592
|
+
Wt,
|
|
3593
|
+
rt,
|
|
3594
|
+
jt,
|
|
3595
|
+
pr,
|
|
3596
|
+
L,
|
|
3597
|
+
wr,
|
|
3598
|
+
_r,
|
|
3599
|
+
Sr,
|
|
3600
|
+
it,
|
|
3644
3601
|
yr,
|
|
3645
|
-
|
|
3646
|
-
Ar,
|
|
3647
|
-
Rr
|
|
3602
|
+
vr
|
|
3648
3603
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
3649
3604
|
}
|
|
3650
3605
|
_initShortcuts() {
|
|
3651
3606
|
[
|
|
3652
3607
|
// sheet drawing shortcuts
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3608
|
+
Qs,
|
|
3609
|
+
eo,
|
|
3610
|
+
to,
|
|
3611
|
+
no,
|
|
3612
|
+
ro
|
|
3658
3613
|
].forEach((i) => {
|
|
3659
3614
|
this.disposeWithMe(this._shortcutService.registerShortcut(i));
|
|
3660
3615
|
});
|
|
@@ -3663,97 +3618,97 @@ let Wt = class extends ie {
|
|
|
3663
3618
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
3664
3619
|
}
|
|
3665
3620
|
};
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
],
|
|
3674
|
-
var
|
|
3675
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
3621
|
+
Pt = so([
|
|
3622
|
+
We(0, A(zn)),
|
|
3623
|
+
We(1, $i),
|
|
3624
|
+
We(2, G),
|
|
3625
|
+
We(3, xi),
|
|
3626
|
+
We(4, se),
|
|
3627
|
+
We(5, A(dn))
|
|
3628
|
+
], Pt);
|
|
3629
|
+
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) => {
|
|
3630
|
+
for (var r = n > 1 ? void 0 : n ? ao(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
3676
3631
|
(o = i[s]) && (r = o(r) || r);
|
|
3677
3632
|
return r;
|
|
3678
|
-
},
|
|
3679
|
-
const
|
|
3680
|
-
let
|
|
3681
|
-
constructor(i =
|
|
3633
|
+
}, Vt = (i, t) => (e, n) => t(e, n, i), Or = (i, t, e) => co(i, typeof t != "symbol" ? t + "" : t, e);
|
|
3634
|
+
const uo = "SHEET_IMAGE_UI_PLUGIN";
|
|
3635
|
+
let At = class extends Qr {
|
|
3636
|
+
constructor(i = $n, t, e, n) {
|
|
3682
3637
|
super(), this._config = i, this._injector = t, this._renderManagerService = e, this._configService = n;
|
|
3683
|
-
const { menu: r, ...s } =
|
|
3638
|
+
const { menu: r, ...s } = ei(
|
|
3684
3639
|
{},
|
|
3685
|
-
|
|
3640
|
+
$n,
|
|
3686
3641
|
this._config
|
|
3687
3642
|
);
|
|
3688
|
-
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(
|
|
3643
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(as, s);
|
|
3689
3644
|
}
|
|
3690
3645
|
onStarting() {
|
|
3691
|
-
|
|
3692
|
-
[
|
|
3693
|
-
[Wt],
|
|
3694
|
-
[Ot],
|
|
3695
|
-
[Bt],
|
|
3696
|
-
[kt],
|
|
3697
|
-
[Nt],
|
|
3646
|
+
ti(this._injector, [
|
|
3647
|
+
[tt],
|
|
3698
3648
|
[Pt],
|
|
3649
|
+
[Rt],
|
|
3699
3650
|
[Ut],
|
|
3700
|
-
[
|
|
3701
|
-
|
|
3702
|
-
[
|
|
3651
|
+
[Ot],
|
|
3652
|
+
[Tt],
|
|
3653
|
+
[Mt],
|
|
3654
|
+
[yt],
|
|
3655
|
+
[Et]
|
|
3656
|
+
]), Ft(this._injector, [
|
|
3657
|
+
[tt]
|
|
3703
3658
|
]);
|
|
3704
3659
|
}
|
|
3705
3660
|
onReady() {
|
|
3706
|
-
|
|
3707
|
-
[
|
|
3708
|
-
[
|
|
3661
|
+
Ft(this._injector, [
|
|
3662
|
+
[Tt],
|
|
3663
|
+
[Et]
|
|
3709
3664
|
]);
|
|
3710
3665
|
}
|
|
3711
3666
|
onRendered() {
|
|
3712
|
-
this._registerRenderModules(),
|
|
3713
|
-
[
|
|
3714
|
-
[
|
|
3715
|
-
[Wt],
|
|
3667
|
+
this._registerRenderModules(), Ft(this._injector, [
|
|
3668
|
+
[Ot],
|
|
3669
|
+
[Ut],
|
|
3716
3670
|
[Pt],
|
|
3717
|
-
[
|
|
3671
|
+
[Mt],
|
|
3672
|
+
[yt]
|
|
3718
3673
|
]);
|
|
3719
3674
|
}
|
|
3720
3675
|
onSteady() {
|
|
3721
|
-
this._injector.get(
|
|
3676
|
+
this._injector.get(Rt);
|
|
3722
3677
|
}
|
|
3723
3678
|
_registerRenderModules() {
|
|
3724
3679
|
[
|
|
3725
|
-
[
|
|
3726
|
-
[
|
|
3727
|
-
[
|
|
3728
|
-
[
|
|
3680
|
+
[et],
|
|
3681
|
+
[sn],
|
|
3682
|
+
[nn],
|
|
3683
|
+
[tn]
|
|
3729
3684
|
].forEach((i) => {
|
|
3730
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
3685
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(F.UNIVER_SHEET, i));
|
|
3731
3686
|
});
|
|
3732
3687
|
}
|
|
3733
3688
|
};
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
],
|
|
3689
|
+
Or(At, "type", F.UNIVER_SHEET);
|
|
3690
|
+
Or(At, "pluginName", uo);
|
|
3691
|
+
At = lo([
|
|
3692
|
+
Jr(oi, ri, hi, pi),
|
|
3693
|
+
Vt(1, A(Ye)),
|
|
3694
|
+
Vt(2, q),
|
|
3695
|
+
Vt(3, qr)
|
|
3696
|
+
], At);
|
|
3742
3697
|
export {
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3698
|
+
L as ClearSheetDrawingTransformerOperation,
|
|
3699
|
+
yr as DeleteDrawingsCommand,
|
|
3700
|
+
wr as EditSheetDrawingOperation,
|
|
3701
|
+
_r as GroupSheetDrawingCommand,
|
|
3702
|
+
Bt as InsertFloatImageCommand,
|
|
3703
|
+
Wt as InsertSheetDrawingCommand,
|
|
3704
|
+
it as MoveDrawingsCommand,
|
|
3705
|
+
rt as RemoveSheetDrawingCommand,
|
|
3706
|
+
Tr as SHEETS_IMAGE_MENU_ID,
|
|
3707
|
+
vr as SetDrawingArrangeCommand,
|
|
3708
|
+
jt as SetSheetDrawingCommand,
|
|
3709
|
+
tt as SheetCanvasFloatDomManagerService,
|
|
3710
|
+
et as SheetDrawingUpdateController,
|
|
3711
|
+
pr as SidebarSheetDrawingOperation,
|
|
3712
|
+
Sr as UngroupSheetDrawingCommand,
|
|
3713
|
+
At as UniverSheetsDrawingUIPlugin
|
|
3759
3714
|
};
|