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