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