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