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