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