@univerjs/sheets-drawing-ui 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js
CHANGED
|
@@ -1,69 +1,67 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as
|
|
5
|
-
import { Inject as
|
|
6
|
-
import { ImageCropperObject as
|
|
7
|
-
import { ISheetDrawingService as
|
|
8
|
-
import { IDrawingManagerService as
|
|
9
|
-
import { IRenderManagerService as
|
|
10
|
-
import { SheetCanvasPopManagerService as
|
|
11
|
-
import { takeUntil as
|
|
12
|
-
import { ISidebarService as
|
|
13
|
-
import { useDependency as
|
|
14
|
-
import { getSheetCommandTarget as
|
|
15
|
-
import
|
|
16
|
-
import { MessageType as
|
|
17
|
-
import
|
|
18
|
-
const
|
|
1
|
+
var kt = Object.defineProperty;
|
|
2
|
+
var Jt = (r, e, n) => e in r ? kt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
+
var K = (r, e, n) => Jt(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { CommandType as G, ICommandService as B, IUndoRedoService as ae, LocaleService as pe, IUniverInstanceService as ce, RxDisposable as Zt, UniverInstanceType as Y, toDisposable as qt, FOCUSING_COMMON_DRAWINGS as fe, OnLifecycle as de, LifecycleStages as le, IContextService as gt, Disposable as ue, Direction as J, FOCUSING_FORMULA_EDITOR as Qt, EDITOR_ACTIVATED as en, Rectangle as tn, DrawingTypeEnum as Ve, DisposableCollection as nn, Tools as ie, UserManagerService as rn, IPermissionService as sn, Plugin as on, DependentOn as an } from "@univerjs/core";
|
|
5
|
+
import { Inject as $, Injector as Ze } from "@wendellhu/redi";
|
|
6
|
+
import { ImageCropperObject as cn, COMPONENT_IMAGE_POPUP_MENU as dn, OpenImageCropOperation as ln, ImageResetSizeOperation as un, DrawingCommonPanel as mn, DrawingRenderService as gn, UniverDrawingUIPlugin as hn } from "@univerjs/drawing-ui";
|
|
7
|
+
import { ISheetDrawingService as X, SetDrawingApplyMutation as O, DrawingApplyType as P, SheetDrawingAnchorType as b, UniverSheetsDrawingPlugin as fn } from "@univerjs/sheets-drawing";
|
|
8
|
+
import { IDrawingManagerService as H, IImageIoService as ht, ArrangeTypeEnum as ve, DrawingTypeEnum as Le, DRAWING_IMAGE_COUNT_LIMIT as it, ImageUploadStatusType as Ge, DRAWING_IMAGE_ALLOW_SIZE as pn, getImageSize as wn, DRAWING_IMAGE_WIDTH_LIMIT as st, DRAWING_IMAGE_HEIGHT_LIMIT as ot, DRAWING_IMAGE_ALLOW_IMAGE_LIST as _n, getDrawingShapeKeyByDrawingSearch as vn, UniverDrawingPlugin as Sn } from "@univerjs/drawing";
|
|
9
|
+
import { IRenderManagerService as te, getGroupState as Cn, transformObjectOutOfGroup as In, precisionTo as Z, Rect as Rn, DRAWING_OBJECT_LAYER_INDEX as Dn, SHEET_VIEWPORT_KEY as Mn, RENDER_CLASS_TYPE as ne } from "@univerjs/engine-render";
|
|
10
|
+
import { SheetCanvasPopManagerService as bn, ISelectionRenderService as $e, getCurrentRangeDisable$ as On, SheetSkeletonManagerService as Xe, SetScrollOperation as Pn, SetZoomRatioOperation as En, SheetPrintInterceptorService as yn } from "@univerjs/sheets-ui";
|
|
11
|
+
import { takeUntil as at, Subject as ct, BehaviorSubject as Tn, combineLatest as Se, map as dt, filter as Ce, distinctUntilChanged as Ie } from "rxjs";
|
|
12
|
+
import { ISidebarService as Un, BuiltInUIPart as An, IUIPartsService as Nn, IMessageService as jn, MenuItemType as ft, MenuPosition as Ln, MenuGroup as $n, getMenuHiddenObservable as pt, KeyCode as oe, ComponentManager as Bn, IMenuService as Wn, IShortcutService as Vn, CanvasFloatDomService as Gn } from "@univerjs/ui";
|
|
13
|
+
import { useDependency as q, connectInjector as xn } from "@wendellhu/redi/react-bindings";
|
|
14
|
+
import { getSheetCommandTarget as se, SelectionManagerService as Fn, WorkbookEditablePermission as He, WorksheetEditPermission as Oe, RangeProtectionPermissionEditPoint as Yn, InsertRowCommand as wt, InsertColCommand as _t, RemoveRowCommand as vt, RemoveColCommand as St, DeleteRangeMoveLeftCommand as Ct, DeleteRangeMoveUpCommand as It, InsertRangeMoveDownCommand as Rt, InsertRangeMoveRightCommand as Dt, DeltaRowHeightCommand as ze, SetRowHeightCommand as Ke, DeltaColumnWidthCommand as Mt, SetColWidthCommand as bt, SetRowHiddenCommand as Ot, SetSpecificRowsVisibleCommand as Pt, SetSpecificColsVisibleCommand as Et, SetColHiddenCommand as yt, SetRowVisibleMutation as Xn, SetRowHiddenMutation as Hn, SetColVisibleMutation as zn, SetColHiddenMutation as Kn, SetWorksheetRowHeightMutation as kn, SetWorksheetColWidthMutation as Jn, SetWorksheetActiveOperation as Zn, SheetInterceptorService as qn, SetFrozenMutation as Qn, WorkbookViewPermission as lt, WorksheetViewPermission as xe } from "@univerjs/sheets";
|
|
15
|
+
import L, { useEffect as qe, forwardRef as Tt, useRef as Ut, createElement as At, useState as ke } from "react";
|
|
16
|
+
import { MessageType as Re, RadioGroup as er, Radio as Fe } from "@univerjs/design";
|
|
17
|
+
import De from "clsx";
|
|
18
|
+
const j = {
|
|
19
19
|
id: "sheet.operation.clear-drawing-transformer",
|
|
20
|
-
type:
|
|
20
|
+
type: G.MUTATION,
|
|
21
21
|
handler: (r, e) => {
|
|
22
|
-
const n = r.get(
|
|
22
|
+
const n = r.get(te);
|
|
23
23
|
return e.forEach((t) => {
|
|
24
|
-
var
|
|
25
|
-
(
|
|
24
|
+
var i, s;
|
|
25
|
+
(s = (i = n.getRenderById(t)) == null ? void 0 : i.scene.getTransformer()) == null || s.debounceRefreshControls();
|
|
26
26
|
}), !0;
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, Qe = {
|
|
29
29
|
id: "sheet.command.remove-sheet-image",
|
|
30
|
-
type:
|
|
30
|
+
type: G.COMMAND,
|
|
31
31
|
handler: (r, e) => {
|
|
32
|
-
const n = r.get(B), t = r.get(
|
|
33
|
-
if (!e)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
s.push(g);
|
|
32
|
+
const n = r.get(B), t = r.get(ae), i = r.get(X);
|
|
33
|
+
if (!e) return !1;
|
|
34
|
+
const { drawings: s } = e, o = [];
|
|
35
|
+
s.forEach((f) => {
|
|
36
|
+
const { unitId: h } = f;
|
|
37
|
+
o.push(h);
|
|
39
38
|
});
|
|
40
|
-
const a =
|
|
41
|
-
return n.syncExecuteCommand(
|
|
39
|
+
const a = i.getBatchRemoveOp(s), { unitId: c, subUnitId: g, undo: l, redo: d, objects: m } = a;
|
|
40
|
+
return n.syncExecuteCommand(O.id, { unitId: c, subUnitId: g, op: d, objects: m, type: P.REMOVE }) ? (t.pushUndoRedo({
|
|
42
41
|
unitID: c,
|
|
43
42
|
undoMutations: [
|
|
44
|
-
{ id:
|
|
45
|
-
{ id:
|
|
43
|
+
{ id: O.id, params: { unitId: c, subUnitId: g, op: l, objects: m, type: P.INSERT } },
|
|
44
|
+
{ id: j.id, params: o }
|
|
46
45
|
],
|
|
47
46
|
redoMutations: [
|
|
48
|
-
{ id:
|
|
49
|
-
{ id:
|
|
47
|
+
{ id: O.id, params: { unitId: c, subUnitId: g, op: d, objects: m, type: P.REMOVE } },
|
|
48
|
+
{ id: j.id, params: o }
|
|
50
49
|
]
|
|
51
50
|
}), !0) : !1;
|
|
52
51
|
}
|
|
53
|
-
},
|
|
52
|
+
}, Nt = "COMPONENT_SHEET_DRAWING_PANEL", jt = {
|
|
54
53
|
id: "sidebar.operation.sheet-image",
|
|
55
|
-
type:
|
|
54
|
+
type: G.COMMAND,
|
|
56
55
|
handler: async (r, e) => {
|
|
57
|
-
const n = r.get(
|
|
58
|
-
if (!
|
|
59
|
-
return !1;
|
|
56
|
+
const n = r.get(Un), t = r.get(pe), i = r.get(ce), s = r.get(H);
|
|
57
|
+
if (!se(i)) return !1;
|
|
60
58
|
switch (e.value) {
|
|
61
59
|
case "open":
|
|
62
60
|
n.open({
|
|
63
61
|
header: { title: t.t("sheetImage.panel.title") },
|
|
64
|
-
children: { label:
|
|
62
|
+
children: { label: Nt },
|
|
65
63
|
onClose: () => {
|
|
66
|
-
|
|
64
|
+
s.focusDrawing(null);
|
|
67
65
|
},
|
|
68
66
|
width: 360
|
|
69
67
|
});
|
|
@@ -75,43 +73,43 @@ const L = {
|
|
|
75
73
|
}
|
|
76
74
|
return !0;
|
|
77
75
|
}
|
|
78
|
-
},
|
|
76
|
+
}, Lt = {
|
|
79
77
|
id: "sheet.operation.edit-sheet-image",
|
|
80
|
-
type:
|
|
78
|
+
type: G.OPERATION,
|
|
81
79
|
handler: (r, e) => {
|
|
82
|
-
const n = r.get(
|
|
83
|
-
return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
uploadLoading:
|
|
87
|
-
uploadLoadingBody:
|
|
88
|
-
uploadLoadingBodyAnimation:
|
|
89
|
-
univerCircleAnimation:
|
|
90
|
-
uploadLoadingBodyText:
|
|
91
|
-
},
|
|
92
|
-
const r =
|
|
93
|
-
return
|
|
94
|
-
const
|
|
95
|
-
t(
|
|
80
|
+
const n = r.get(H), t = r.get(B);
|
|
81
|
+
return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(jt.id, { value: "open" }), !0);
|
|
82
|
+
}
|
|
83
|
+
}, tr = "univer-upload-loading", nr = "univer-upload-loading-body", rr = "univer-upload-loading-body-animation", ir = "univer-UniverCircleAnimation", sr = "univer-upload-loading-body-text", Me = {
|
|
84
|
+
uploadLoading: tr,
|
|
85
|
+
uploadLoadingBody: nr,
|
|
86
|
+
uploadLoadingBodyAnimation: rr,
|
|
87
|
+
univerCircleAnimation: ir,
|
|
88
|
+
uploadLoadingBodyText: sr
|
|
89
|
+
}, or = () => {
|
|
90
|
+
const r = q(ht), e = q(pe), [n, t] = L.useState(0);
|
|
91
|
+
return qe(() => {
|
|
92
|
+
const i = r.change$.subscribe((s) => {
|
|
93
|
+
t(s);
|
|
96
94
|
});
|
|
97
95
|
return () => {
|
|
98
|
-
|
|
96
|
+
i.unsubscribe();
|
|
99
97
|
};
|
|
100
|
-
}, [r]), /* @__PURE__ */
|
|
98
|
+
}, [r]), /* @__PURE__ */ L.createElement("div", { style: { display: n > 0 ? "block" : "none" }, className: Me.uploadLoading }, /* @__PURE__ */ L.createElement("div", { className: Me.uploadLoadingBody }, /* @__PURE__ */ L.createElement("div", { className: Me.uploadLoadingBodyAnimation }), /* @__PURE__ */ L.createElement("div", { className: Me.uploadLoadingBodyText }, `${e.t("uploadLoading.loading")}: ${n}`)));
|
|
101
99
|
};
|
|
102
|
-
var
|
|
103
|
-
for (var
|
|
104
|
-
(
|
|
105
|
-
return t &&
|
|
106
|
-
},
|
|
107
|
-
let
|
|
108
|
-
constructor(e, n, t,
|
|
100
|
+
var ar = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, dr = (r, e, n, t) => {
|
|
101
|
+
for (var i = t > 1 ? void 0 : t ? cr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
|
|
102
|
+
(o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
|
|
103
|
+
return t && i && ar(e, n, i), i;
|
|
104
|
+
}, Q = (r, e) => (n, t) => e(n, t, r);
|
|
105
|
+
let Pe = class extends Zt {
|
|
106
|
+
constructor(e, n, t, i, s, o, a) {
|
|
109
107
|
super();
|
|
110
|
-
|
|
111
|
-
this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService =
|
|
108
|
+
K(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
109
|
+
this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = i, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._init();
|
|
112
110
|
}
|
|
113
111
|
_init() {
|
|
114
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
112
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET).pipe(at(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(Y.UNIVER_SHEET).pipe(at(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(Y.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(An.CONTENT, () => xn(or, this._injector));
|
|
115
113
|
}
|
|
116
114
|
_dispose(e) {
|
|
117
115
|
const n = e.getUnitId();
|
|
@@ -126,62 +124,58 @@ let Re = class extends $t {
|
|
|
126
124
|
_hasCropObject(e) {
|
|
127
125
|
const n = e.getAllObjects();
|
|
128
126
|
for (const t of n)
|
|
129
|
-
if (t instanceof
|
|
127
|
+
if (t instanceof cn)
|
|
130
128
|
return !0;
|
|
131
129
|
return !1;
|
|
132
130
|
}
|
|
133
131
|
_popupMenuListener(e) {
|
|
134
|
-
var
|
|
135
|
-
const n = (
|
|
132
|
+
var s;
|
|
133
|
+
const n = (s = this._renderManagerService.getRenderById(e)) == null ? void 0 : s.scene;
|
|
136
134
|
if (!n)
|
|
137
135
|
return;
|
|
138
136
|
const t = n.getTransformerByCreate();
|
|
139
137
|
if (!t)
|
|
140
138
|
return;
|
|
141
|
-
const
|
|
139
|
+
const i = [];
|
|
142
140
|
this.disposeWithMe(
|
|
143
|
-
|
|
144
|
-
t.
|
|
145
|
-
if (this._contextService.setContextValue(
|
|
141
|
+
qt(
|
|
142
|
+
t.createControl$.subscribe(() => {
|
|
143
|
+
if (this._contextService.setContextValue(fe, !0), this._hasCropObject(n))
|
|
146
144
|
return;
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
149
|
-
|
|
145
|
+
const o = t.getSelectedObjectMap();
|
|
146
|
+
if (o.size > 1) {
|
|
147
|
+
i.forEach((u) => u.dispose());
|
|
150
148
|
return;
|
|
151
149
|
}
|
|
152
|
-
const a =
|
|
150
|
+
const a = o.values().next().value;
|
|
153
151
|
if (!a)
|
|
154
152
|
return;
|
|
155
|
-
const c = a.oKey,
|
|
156
|
-
if (!
|
|
153
|
+
const c = a.oKey, g = this._drawingManagerService.getDrawingOKey(c);
|
|
154
|
+
if (!g)
|
|
157
155
|
return;
|
|
158
|
-
const { unitId:
|
|
159
|
-
|
|
160
|
-
componentKey:
|
|
156
|
+
const { unitId: l, subUnitId: d, drawingId: m } = g;
|
|
157
|
+
i.push(this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
|
|
158
|
+
componentKey: dn,
|
|
161
159
|
direction: "horizontal",
|
|
162
160
|
offset: [2, 0],
|
|
163
161
|
extraProps: {
|
|
164
|
-
menuItems: this._getImageMenuItems(
|
|
162
|
+
menuItems: this._getImageMenuItems(l, d, m)
|
|
165
163
|
}
|
|
166
164
|
}))), this._drawingManagerService.focusDrawing([{
|
|
167
|
-
unitId:
|
|
168
|
-
subUnitId:
|
|
169
|
-
drawingId:
|
|
165
|
+
unitId: l,
|
|
166
|
+
subUnitId: d,
|
|
167
|
+
drawingId: m
|
|
170
168
|
}]);
|
|
171
169
|
})
|
|
172
170
|
)
|
|
173
171
|
), this.disposeWithMe(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
})
|
|
178
|
-
)
|
|
172
|
+
t.clearControl$.subscribe(() => {
|
|
173
|
+
i.forEach((o) => o.dispose()), this._contextService.setContextValue(fe, !1), this._drawingManagerService.focusDrawing(null);
|
|
174
|
+
})
|
|
179
175
|
), this.disposeWithMe(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
})
|
|
184
|
-
)
|
|
176
|
+
t.changing$.subscribe(() => {
|
|
177
|
+
i.forEach((o) => o.dispose());
|
|
178
|
+
})
|
|
185
179
|
);
|
|
186
180
|
}
|
|
187
181
|
_getImageMenuItems(e, n, t) {
|
|
@@ -189,285 +183,280 @@ let Re = class extends $t {
|
|
|
189
183
|
{
|
|
190
184
|
label: "image-popup.edit",
|
|
191
185
|
index: 0,
|
|
192
|
-
commandId:
|
|
186
|
+
commandId: Lt.id,
|
|
193
187
|
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
194
188
|
disable: !1
|
|
195
189
|
},
|
|
196
190
|
{
|
|
197
191
|
label: "image-popup.delete",
|
|
198
192
|
index: 1,
|
|
199
|
-
commandId:
|
|
193
|
+
commandId: Qe.id,
|
|
200
194
|
commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
|
|
201
195
|
disable: !1
|
|
202
196
|
},
|
|
203
197
|
{
|
|
204
198
|
label: "image-popup.crop",
|
|
205
199
|
index: 2,
|
|
206
|
-
commandId:
|
|
200
|
+
commandId: ln.id,
|
|
207
201
|
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
208
202
|
disable: !1
|
|
209
203
|
},
|
|
210
204
|
{
|
|
211
205
|
label: "image-popup.reset",
|
|
212
206
|
index: 3,
|
|
213
|
-
commandId:
|
|
207
|
+
commandId: un.id,
|
|
214
208
|
commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
|
|
215
209
|
disable: !1
|
|
216
210
|
}
|
|
217
211
|
];
|
|
218
212
|
}
|
|
219
213
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
],
|
|
230
|
-
const
|
|
214
|
+
Pe = dr([
|
|
215
|
+
de(le.Steady, Pe),
|
|
216
|
+
Q(0, $(Ze)),
|
|
217
|
+
Q(1, H),
|
|
218
|
+
Q(2, $(bn)),
|
|
219
|
+
Q(3, te),
|
|
220
|
+
Q(4, ce),
|
|
221
|
+
Q(5, gt),
|
|
222
|
+
Q(6, $(Nn))
|
|
223
|
+
], Pe);
|
|
224
|
+
const Be = {
|
|
231
225
|
id: "sheet.operation.insert-float-image",
|
|
232
|
-
type:
|
|
226
|
+
type: G.OPERATION,
|
|
233
227
|
handler: (r, e) => !0
|
|
234
|
-
},
|
|
228
|
+
}, Ae = {
|
|
235
229
|
id: "sheet.operation.insert-cell-image",
|
|
236
|
-
type:
|
|
230
|
+
type: G.OPERATION,
|
|
237
231
|
handler: (r, e) => !0
|
|
238
|
-
},
|
|
232
|
+
}, et = {
|
|
239
233
|
id: "sheet.command.insert-sheet-image",
|
|
240
|
-
type:
|
|
234
|
+
type: G.COMMAND,
|
|
241
235
|
handler: (r, e) => {
|
|
242
|
-
const n = r.get(B), t = r.get(
|
|
243
|
-
if (!e)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
return n.syncExecuteCommand(b.id, { op: l, unitId: c, subUnitId: u, objects: h, type: P.INSERT }) ? (t.pushUndoRedo({
|
|
236
|
+
const n = r.get(B), t = r.get(ae), i = r.get(X);
|
|
237
|
+
if (!e) return !1;
|
|
238
|
+
const s = e.drawings, o = s.map((f) => f.unitId), a = i.getBatchAddOp(s), { unitId: c, subUnitId: g, undo: l, redo: d, objects: m } = a;
|
|
239
|
+
return n.syncExecuteCommand(O.id, { op: d, unitId: c, subUnitId: g, objects: m, type: P.INSERT }) ? (t.pushUndoRedo({
|
|
247
240
|
unitID: c,
|
|
248
241
|
undoMutations: [
|
|
249
|
-
{ id:
|
|
250
|
-
{ id:
|
|
242
|
+
{ id: O.id, params: { op: l, unitId: c, subUnitId: g, objects: m, type: P.REMOVE } },
|
|
243
|
+
{ id: j.id, params: o }
|
|
251
244
|
],
|
|
252
245
|
redoMutations: [
|
|
253
|
-
{ id:
|
|
254
|
-
{ id:
|
|
246
|
+
{ id: O.id, params: { op: d, unitId: c, subUnitId: g, objects: m, type: P.INSERT } },
|
|
247
|
+
{ id: j.id, params: o }
|
|
255
248
|
]
|
|
256
249
|
}), !0) : !1;
|
|
257
250
|
}
|
|
258
|
-
},
|
|
251
|
+
}, We = {
|
|
259
252
|
id: "sheet.command.set-sheet-image",
|
|
260
|
-
type:
|
|
253
|
+
type: G.COMMAND,
|
|
261
254
|
handler: (r, e) => {
|
|
262
|
-
const n = r.get(B), t = r.get(
|
|
263
|
-
if (!e)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return n.syncExecuteCommand(b.id, { unitId: a, subUnitId: c, op: d, objects: l, type: P.UPDATE }) ? (t.pushUndoRedo({
|
|
255
|
+
const n = r.get(B), t = r.get(ae), i = r.get(X);
|
|
256
|
+
if (!e) return !1;
|
|
257
|
+
const { drawings: s } = e, o = i.getBatchUpdateOp(s), { unitId: a, subUnitId: c, undo: g, redo: l, objects: d } = o;
|
|
258
|
+
return n.syncExecuteCommand(O.id, { unitId: a, subUnitId: c, op: l, objects: d, type: P.UPDATE }) ? (t.pushUndoRedo({
|
|
267
259
|
unitID: a,
|
|
268
260
|
undoMutations: [
|
|
269
|
-
{ id:
|
|
270
|
-
{ id:
|
|
261
|
+
{ id: O.id, params: { unitId: a, subUnitId: c, op: g, objects: d, type: P.UPDATE } },
|
|
262
|
+
{ id: j.id, params: [a] }
|
|
271
263
|
],
|
|
272
264
|
redoMutations: [
|
|
273
|
-
{ id:
|
|
274
|
-
{ id:
|
|
265
|
+
{ id: O.id, params: { unitId: a, subUnitId: c, op: l, objects: d, type: P.UPDATE } },
|
|
266
|
+
{ id: j.id, params: [a] }
|
|
275
267
|
]
|
|
276
268
|
}), !0) : !1;
|
|
277
269
|
}
|
|
278
|
-
},
|
|
270
|
+
}, $t = {
|
|
279
271
|
id: "sheet.command.set-drawing-arrange",
|
|
280
|
-
type:
|
|
272
|
+
type: G.COMMAND,
|
|
281
273
|
handler: (r, e) => {
|
|
282
|
-
const n = r.get(B), t = r.get(
|
|
283
|
-
if (!e)
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if (c === we.forward ? d = o.getForwardDrawingsOp(u) : c === we.backward ? d = o.getBackwardDrawingOp(u) : c === we.front ? d = o.getFrontDrawingsOp(u) : c === we.back && (d = o.getBackDrawingsOp(u)), d == null)
|
|
274
|
+
const n = r.get(B), t = r.get(ae);
|
|
275
|
+
if (!e) return !1;
|
|
276
|
+
const i = r.get(X), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: c } = e, g = { unitId: s, subUnitId: o, drawingIds: a };
|
|
277
|
+
let l;
|
|
278
|
+
if (c === ve.forward ? l = i.getForwardDrawingsOp(g) : c === ve.backward ? l = i.getBackwardDrawingOp(g) : c === ve.front ? l = i.getFrontDrawingsOp(g) : c === ve.back && (l = i.getBackDrawingsOp(g)), l == null)
|
|
288
279
|
return !1;
|
|
289
|
-
const { objects:
|
|
290
|
-
return n.syncExecuteCommand(
|
|
291
|
-
unitID:
|
|
280
|
+
const { objects: d, redo: m, undo: u } = l;
|
|
281
|
+
return n.syncExecuteCommand(O.id, { op: m, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE }) ? (t.pushUndoRedo({
|
|
282
|
+
unitID: s,
|
|
292
283
|
undoMutations: [
|
|
293
|
-
{ id:
|
|
284
|
+
{ id: O.id, params: { op: u, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE } }
|
|
294
285
|
],
|
|
295
286
|
redoMutations: [
|
|
296
|
-
{ id:
|
|
287
|
+
{ id: O.id, params: { op: m, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE } }
|
|
297
288
|
]
|
|
298
289
|
}), !0) : !1;
|
|
299
290
|
}
|
|
300
291
|
};
|
|
301
|
-
function
|
|
292
|
+
function lr(r) {
|
|
302
293
|
const e = [];
|
|
303
294
|
return r.forEach((n) => {
|
|
304
|
-
const { parent: t, children:
|
|
305
|
-
const
|
|
295
|
+
const { parent: t, children: i } = n, { unitId: s, subUnitId: o, drawingId: a } = t, c = Cn(0, 0, i.map((d) => d.transform || {})), g = i.map((d) => {
|
|
296
|
+
const m = d.transform || { left: 0, top: 0 }, { unitId: u, subUnitId: f, drawingId: h } = d;
|
|
306
297
|
return {
|
|
307
|
-
unitId:
|
|
298
|
+
unitId: u,
|
|
308
299
|
subUnitId: f,
|
|
309
|
-
drawingId:
|
|
300
|
+
drawingId: h,
|
|
310
301
|
transform: {
|
|
311
|
-
...
|
|
312
|
-
left:
|
|
313
|
-
top:
|
|
302
|
+
...m,
|
|
303
|
+
left: m.left - c.left,
|
|
304
|
+
top: m.top - c.top
|
|
314
305
|
},
|
|
315
306
|
groupId: a
|
|
316
307
|
};
|
|
317
|
-
}),
|
|
318
|
-
unitId:
|
|
319
|
-
subUnitId:
|
|
308
|
+
}), l = {
|
|
309
|
+
unitId: s,
|
|
310
|
+
subUnitId: o,
|
|
320
311
|
drawingId: a,
|
|
321
|
-
drawingType:
|
|
312
|
+
drawingType: Le.DRAWING_GROUP,
|
|
322
313
|
transform: c
|
|
323
314
|
};
|
|
324
315
|
e.push({
|
|
325
|
-
parent:
|
|
326
|
-
children:
|
|
316
|
+
parent: l,
|
|
317
|
+
children: g
|
|
327
318
|
});
|
|
328
319
|
}), e;
|
|
329
320
|
}
|
|
330
|
-
function
|
|
321
|
+
function ur(r) {
|
|
331
322
|
const e = [];
|
|
332
323
|
return r.forEach((n) => {
|
|
333
|
-
const { parent: t, children:
|
|
324
|
+
const { parent: t, children: i } = n, { unitId: s, subUnitId: o, drawingId: a, transform: c = { width: 0, height: 0 } } = t;
|
|
334
325
|
if (c == null)
|
|
335
326
|
return;
|
|
336
|
-
const
|
|
337
|
-
const { transform:
|
|
327
|
+
const g = i.map((d) => {
|
|
328
|
+
const { transform: m } = d, { unitId: u, subUnitId: f, drawingId: h } = d, p = In(m || {}, c, c.width || 0, c.height || 0);
|
|
338
329
|
return {
|
|
339
|
-
unitId:
|
|
330
|
+
unitId: u,
|
|
340
331
|
subUnitId: f,
|
|
341
|
-
drawingId:
|
|
342
|
-
transform:
|
|
332
|
+
drawingId: h,
|
|
333
|
+
transform: p,
|
|
343
334
|
groupId: void 0
|
|
344
335
|
};
|
|
345
|
-
}),
|
|
346
|
-
unitId:
|
|
347
|
-
subUnitId:
|
|
336
|
+
}), l = {
|
|
337
|
+
unitId: s,
|
|
338
|
+
subUnitId: o,
|
|
348
339
|
drawingId: a,
|
|
349
|
-
drawingType:
|
|
340
|
+
drawingType: Le.DRAWING_GROUP,
|
|
350
341
|
transform: {
|
|
351
342
|
left: 0,
|
|
352
343
|
top: 0
|
|
353
344
|
}
|
|
354
345
|
};
|
|
355
346
|
e.push({
|
|
356
|
-
parent:
|
|
357
|
-
children:
|
|
347
|
+
parent: l,
|
|
348
|
+
children: g
|
|
358
349
|
});
|
|
359
350
|
}), e;
|
|
360
351
|
}
|
|
361
|
-
const
|
|
352
|
+
const Bt = {
|
|
362
353
|
id: "sheet.command.group-sheet-image",
|
|
363
|
-
type:
|
|
354
|
+
type: G.COMMAND,
|
|
364
355
|
handler: (r, e) => {
|
|
365
|
-
const n = r.get(B), t = r.get(
|
|
366
|
-
if (!e)
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
i.push(g.unitId);
|
|
356
|
+
const n = r.get(B), t = r.get(ae), i = r.get(X);
|
|
357
|
+
if (!e) return !1;
|
|
358
|
+
const s = [];
|
|
359
|
+
e.forEach(({ parent: u, children: f }) => {
|
|
360
|
+
s.push(u.unitId), f.forEach((h) => {
|
|
361
|
+
s.push(h.unitId);
|
|
372
362
|
});
|
|
373
363
|
});
|
|
374
|
-
const
|
|
375
|
-
return n.syncExecuteCommand(
|
|
364
|
+
const o = i.getGroupDrawingOp(e), { unitId: a, subUnitId: c, undo: g, redo: l, objects: d } = o;
|
|
365
|
+
return n.syncExecuteCommand(O.id, { op: l, unitId: a, subUnitId: c, objects: d, type: P.GROUP }) ? (t.pushUndoRedo({
|
|
376
366
|
unitID: a,
|
|
377
367
|
undoMutations: [
|
|
378
|
-
{ id:
|
|
379
|
-
{ id:
|
|
368
|
+
{ id: O.id, params: { op: g, unitId: a, subUnitId: c, objects: ur(d), type: P.UNGROUP } },
|
|
369
|
+
{ id: j.id, params: s }
|
|
380
370
|
],
|
|
381
371
|
redoMutations: [
|
|
382
|
-
{ id:
|
|
383
|
-
{ id:
|
|
372
|
+
{ id: O.id, params: { op: l, unitId: a, subUnitId: c, objects: d, type: P.GROUP } },
|
|
373
|
+
{ id: j.id, params: s }
|
|
384
374
|
]
|
|
385
375
|
}), !0) : !1;
|
|
386
376
|
}
|
|
387
|
-
},
|
|
377
|
+
}, Wt = {
|
|
388
378
|
id: "sheet.command.ungroup-sheet-image",
|
|
389
|
-
type:
|
|
379
|
+
type: G.COMMAND,
|
|
390
380
|
handler: (r, e) => {
|
|
391
|
-
const n = r.get(B), t = r.get(
|
|
392
|
-
if (!e)
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
i.push(g.unitId);
|
|
381
|
+
const n = r.get(B), t = r.get(ae), i = r.get(X);
|
|
382
|
+
if (!e) return !1;
|
|
383
|
+
const s = [];
|
|
384
|
+
e.forEach(({ parent: u, children: f }) => {
|
|
385
|
+
s.push(u.unitId), f.forEach((h) => {
|
|
386
|
+
s.push(h.unitId);
|
|
398
387
|
});
|
|
399
388
|
});
|
|
400
|
-
const
|
|
401
|
-
return n.syncExecuteCommand(
|
|
389
|
+
const o = i.getUngroupDrawingOp(e), { unitId: a, subUnitId: c, undo: g, redo: l, objects: d } = o;
|
|
390
|
+
return n.syncExecuteCommand(O.id, { op: l, unitId: a, subUnitId: c, objects: d, type: P.UNGROUP }) ? (t.pushUndoRedo({
|
|
402
391
|
unitID: a,
|
|
403
392
|
undoMutations: [
|
|
404
|
-
{ id:
|
|
405
|
-
{ id:
|
|
393
|
+
{ id: O.id, params: { op: g, unitId: a, subUnitId: c, objects: lr(d), type: P.GROUP } },
|
|
394
|
+
{ id: j.id, params: s }
|
|
406
395
|
],
|
|
407
396
|
redoMutations: [
|
|
408
|
-
{ id:
|
|
409
|
-
{ id:
|
|
397
|
+
{ id: O.id, params: { op: l, unitId: a, subUnitId: c, objects: d, type: P.UNGROUP } },
|
|
398
|
+
{ id: j.id, params: s }
|
|
410
399
|
]
|
|
411
400
|
}), !0) : !1;
|
|
412
401
|
}
|
|
413
402
|
};
|
|
414
|
-
function
|
|
415
|
-
const { from: n, to: t } = r, { column:
|
|
416
|
-
startColumn:
|
|
417
|
-
endColumn:
|
|
418
|
-
startRow:
|
|
419
|
-
endRow:
|
|
403
|
+
function V(r, e) {
|
|
404
|
+
const { from: n, to: t } = r, { column: i, columnOffset: s, row: o, rowOffset: a } = n, { column: c, columnOffset: g, row: l, rowOffset: d } = t, m = e.attachRangeWithCoord({
|
|
405
|
+
startColumn: i,
|
|
406
|
+
endColumn: i,
|
|
407
|
+
startRow: o,
|
|
408
|
+
endRow: o
|
|
420
409
|
});
|
|
421
|
-
if (
|
|
410
|
+
if (m == null)
|
|
422
411
|
return;
|
|
423
|
-
const
|
|
412
|
+
const u = e.attachRangeWithCoord({
|
|
424
413
|
startColumn: c,
|
|
425
414
|
endColumn: c,
|
|
426
|
-
startRow:
|
|
427
|
-
endRow:
|
|
415
|
+
startRow: l,
|
|
416
|
+
endRow: l
|
|
428
417
|
});
|
|
429
|
-
if (
|
|
418
|
+
if (u == null)
|
|
430
419
|
return;
|
|
431
|
-
const { startX: f, startY:
|
|
432
|
-
let R =
|
|
433
|
-
return
|
|
420
|
+
const { startX: f, startY: h } = m, { startX: p, startY: S } = u, C = Z(f + s, 1), v = Z(h + a, 1);
|
|
421
|
+
let R = Z(p + g - C, 1), _ = Z(S + d - v, 1);
|
|
422
|
+
return m.startX === u.endX && (R = 0), m.startY === u.endY && (_ = 0), {
|
|
434
423
|
left: C,
|
|
435
424
|
top: v,
|
|
436
425
|
width: R,
|
|
437
|
-
height:
|
|
426
|
+
height: _
|
|
438
427
|
};
|
|
439
428
|
}
|
|
440
429
|
function N(r, e) {
|
|
441
|
-
const { left: n = 0, top: t = 0, width:
|
|
442
|
-
if (
|
|
430
|
+
const { left: n = 0, top: t = 0, width: i = 0, height: s = 0 } = r, o = e.getSelectionCellByPosition(n, t);
|
|
431
|
+
if (o == null)
|
|
443
432
|
return;
|
|
444
433
|
const a = {
|
|
445
|
-
column:
|
|
446
|
-
columnOffset:
|
|
447
|
-
row:
|
|
448
|
-
rowOffset:
|
|
449
|
-
}, c = e.getSelectionCellByPosition(n +
|
|
434
|
+
column: o.actualColumn,
|
|
435
|
+
columnOffset: Z(n - o.startX, 1),
|
|
436
|
+
row: o.actualRow,
|
|
437
|
+
rowOffset: Z(t - o.startY, 1)
|
|
438
|
+
}, c = e.getSelectionCellByPosition(n + i, t + s);
|
|
450
439
|
if (c == null)
|
|
451
440
|
return;
|
|
452
|
-
const
|
|
441
|
+
const g = {
|
|
453
442
|
column: c.actualColumn,
|
|
454
|
-
columnOffset:
|
|
443
|
+
columnOffset: Z(n + i - c.startX, 1),
|
|
455
444
|
row: c.actualRow,
|
|
456
|
-
rowOffset:
|
|
445
|
+
rowOffset: Z(t + s - c.startY, 1)
|
|
457
446
|
};
|
|
458
447
|
return {
|
|
459
448
|
from: a,
|
|
460
|
-
to:
|
|
449
|
+
to: g
|
|
461
450
|
};
|
|
462
451
|
}
|
|
463
|
-
var
|
|
464
|
-
for (var
|
|
465
|
-
(
|
|
466
|
-
return t &&
|
|
467
|
-
},
|
|
468
|
-
let
|
|
469
|
-
constructor(r, e, n, t,
|
|
470
|
-
super(), this._commandService = r, this._univerInstanceService = e, this._selectionManagerService = n, this._selectionRenderService = t, this._imageIoService =
|
|
452
|
+
var mr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, hr = (r, e, n, t) => {
|
|
453
|
+
for (var i = t > 1 ? void 0 : t ? gr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
|
|
454
|
+
(o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
|
|
455
|
+
return t && i && mr(e, n, i), i;
|
|
456
|
+
}, F = (r, e) => (n, t) => e(n, t, r);
|
|
457
|
+
let Ee = class extends ue {
|
|
458
|
+
constructor(r, e, n, t, i, s, o, a, c, g, l) {
|
|
459
|
+
super(), this._commandService = r, this._univerInstanceService = e, this._selectionManagerService = n, this._selectionRenderService = t, this._imageIoService = i, this._sheetDrawingService = s, this._drawingManagerService = o, this._contextService = a, this._messageService = c, this._localeService = g, this._renderManagerService = l, this._init();
|
|
471
460
|
}
|
|
472
461
|
_init() {
|
|
473
462
|
this._initCommandListeners(), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
|
|
@@ -478,19 +467,19 @@ let Ie = class extends ge {
|
|
|
478
467
|
_initCommandListeners() {
|
|
479
468
|
this.disposeWithMe(
|
|
480
469
|
this._commandService.onCommandExecuted(async (r) => {
|
|
481
|
-
if (r.id ===
|
|
470
|
+
if (r.id === Ae.id || r.id === Be.id) {
|
|
482
471
|
const e = r.params;
|
|
483
472
|
if (e.files == null)
|
|
484
473
|
return;
|
|
485
474
|
const n = e.files.length;
|
|
486
|
-
if (n >
|
|
475
|
+
if (n > it) {
|
|
487
476
|
this._messageService.show({
|
|
488
|
-
type:
|
|
489
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(
|
|
477
|
+
type: Re.Error,
|
|
478
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(it))
|
|
490
479
|
});
|
|
491
480
|
return;
|
|
492
481
|
}
|
|
493
|
-
this._imageIoService.setWaitCount(n), r.id ===
|
|
482
|
+
this._imageIoService.setWaitCount(n), r.id === Ae.id ? e.files.forEach(async (t) => {
|
|
494
483
|
await this._insertCellImage(t);
|
|
495
484
|
}) : e.files.forEach(async (t) => {
|
|
496
485
|
await this._insertFloatImage(t);
|
|
@@ -507,14 +496,14 @@ let Ie = class extends ge {
|
|
|
507
496
|
e = await this._imageIoService.saveImage(r);
|
|
508
497
|
} catch (C) {
|
|
509
498
|
const v = C.message;
|
|
510
|
-
v ===
|
|
511
|
-
type:
|
|
512
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
513
|
-
}) : v ===
|
|
514
|
-
type:
|
|
499
|
+
v === Ge.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
500
|
+
type: Re.Error,
|
|
501
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(pn / (1024 * 1024)))
|
|
502
|
+
}) : v === Ge.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
503
|
+
type: Re.Error,
|
|
515
504
|
content: this._localeService.t("update-status.invalidImageType")
|
|
516
|
-
}) : v ===
|
|
517
|
-
type:
|
|
505
|
+
}) : v === Ge.ERROR_IMAGE && this._messageService.show({
|
|
506
|
+
type: Re.Error,
|
|
518
507
|
content: this._localeService.t("update-status.invalidImage")
|
|
519
508
|
});
|
|
520
509
|
}
|
|
@@ -523,36 +512,36 @@ let Ie = class extends ge {
|
|
|
523
512
|
const n = this._getUnitInfo();
|
|
524
513
|
if (n == null)
|
|
525
514
|
return;
|
|
526
|
-
const { unitId: t, subUnitId:
|
|
527
|
-
if (
|
|
515
|
+
const { unitId: t, subUnitId: i } = n, { imageId: s, imageSourceType: o, source: a, base64Cache: c } = e, { width: g, height: l, image: d } = await wn(c || ""), m = this._renderManagerService.getRenderById(t);
|
|
516
|
+
if (m == null)
|
|
528
517
|
return;
|
|
529
|
-
const { width:
|
|
530
|
-
this._imageIoService.addImageSourceCache(a,
|
|
531
|
-
let
|
|
532
|
-
if (
|
|
533
|
-
const C =
|
|
534
|
-
|
|
518
|
+
const { width: u, height: f } = m.scene;
|
|
519
|
+
this._imageIoService.addImageSourceCache(a, o, d);
|
|
520
|
+
let h = 1;
|
|
521
|
+
if (g > st || l > ot) {
|
|
522
|
+
const C = st / g, v = ot / l;
|
|
523
|
+
h = Math.max(C, v);
|
|
535
524
|
}
|
|
536
|
-
const
|
|
537
|
-
if (
|
|
525
|
+
const p = this._getImagePosition(g * h, l * h, u, f);
|
|
526
|
+
if (p == null)
|
|
538
527
|
return;
|
|
539
|
-
const
|
|
528
|
+
const S = {
|
|
540
529
|
unitId: t,
|
|
541
|
-
subUnitId:
|
|
542
|
-
drawingId:
|
|
543
|
-
drawingType:
|
|
544
|
-
imageSourceType:
|
|
530
|
+
subUnitId: i,
|
|
531
|
+
drawingId: s,
|
|
532
|
+
drawingType: Le.DRAWING_IMAGE,
|
|
533
|
+
imageSourceType: o,
|
|
545
534
|
source: a,
|
|
546
|
-
transform:
|
|
547
|
-
sheetTransform:
|
|
535
|
+
transform: V(p, this._selectionRenderService),
|
|
536
|
+
sheetTransform: p
|
|
548
537
|
};
|
|
549
|
-
this._commandService.executeCommand(
|
|
538
|
+
this._commandService.executeCommand(et.id, {
|
|
550
539
|
unitId: t,
|
|
551
|
-
drawings: [
|
|
540
|
+
drawings: [S]
|
|
552
541
|
});
|
|
553
542
|
}
|
|
554
543
|
_getUnitInfo() {
|
|
555
|
-
const r = this._univerInstanceService.getCurrentUnitForType(
|
|
544
|
+
const r = this._univerInstanceService.getCurrentUnitForType(Y.UNIVER_SHEET);
|
|
556
545
|
if (r == null)
|
|
557
546
|
return;
|
|
558
547
|
const e = r.getActiveSheet();
|
|
@@ -565,51 +554,51 @@ let Ie = class extends ge {
|
|
|
565
554
|
};
|
|
566
555
|
}
|
|
567
556
|
_getImagePosition(r, e, n, t) {
|
|
568
|
-
const
|
|
569
|
-
let
|
|
557
|
+
const i = this._selectionManagerService.getSelections();
|
|
558
|
+
let s = {
|
|
570
559
|
startRow: 0,
|
|
571
560
|
endRow: 0,
|
|
572
561
|
startColumn: 0,
|
|
573
562
|
endColumn: 0
|
|
574
563
|
};
|
|
575
|
-
|
|
576
|
-
const
|
|
577
|
-
if (
|
|
564
|
+
i && i.length > 0 && (s = i[i.length - 1].range);
|
|
565
|
+
const o = this._selectionRenderService.attachRangeWithCoord(s);
|
|
566
|
+
if (o == null)
|
|
578
567
|
return;
|
|
579
|
-
let { startColumn: a, startRow: c, startX:
|
|
580
|
-
if (
|
|
581
|
-
const
|
|
582
|
-
if (
|
|
568
|
+
let { startColumn: a, startRow: c, startX: g, startY: l } = o, d = !1;
|
|
569
|
+
if (g + r > n && (g = n - r, g < 0 && (g = 0, r = n), d = !0), l + e > t && (l = t - e, l < 0 && (l = 0, e = t), d = !0), d) {
|
|
570
|
+
const h = this._selectionRenderService.getSelectionCellByPosition(g, l);
|
|
571
|
+
if (h == null)
|
|
583
572
|
return;
|
|
584
|
-
|
|
573
|
+
g = h.startX, l = h.startY, a = h.actualColumn, c = h.actualRow;
|
|
585
574
|
}
|
|
586
|
-
const
|
|
575
|
+
const m = {
|
|
587
576
|
column: a,
|
|
588
577
|
columnOffset: 0,
|
|
589
578
|
row: c,
|
|
590
579
|
rowOffset: 0
|
|
591
|
-
},
|
|
592
|
-
if (
|
|
580
|
+
}, u = this._selectionRenderService.getSelectionCellByPosition(g + r, l + e);
|
|
581
|
+
if (u == null)
|
|
593
582
|
return;
|
|
594
583
|
const f = {
|
|
595
|
-
column:
|
|
596
|
-
columnOffset:
|
|
597
|
-
row:
|
|
598
|
-
rowOffset:
|
|
584
|
+
column: u.actualColumn,
|
|
585
|
+
columnOffset: g + r - u.startX,
|
|
586
|
+
row: u.actualRow,
|
|
587
|
+
rowOffset: l + e - u.startY
|
|
599
588
|
};
|
|
600
589
|
return {
|
|
601
|
-
from:
|
|
590
|
+
from: m,
|
|
602
591
|
to: f
|
|
603
592
|
};
|
|
604
593
|
}
|
|
605
594
|
_updateOrderListener() {
|
|
606
595
|
this._drawingManagerService.featurePluginOrderUpdate$.subscribe((r) => {
|
|
607
|
-
const { unitId: e, subUnitId: n, drawingIds: t, arrangeType:
|
|
608
|
-
this._commandService.executeCommand(
|
|
596
|
+
const { unitId: e, subUnitId: n, drawingIds: t, arrangeType: i } = r;
|
|
597
|
+
this._commandService.executeCommand($t.id, {
|
|
609
598
|
unitId: e,
|
|
610
599
|
subUnitId: n,
|
|
611
600
|
drawingIds: t,
|
|
612
|
-
arrangeType:
|
|
601
|
+
arrangeType: i
|
|
613
602
|
});
|
|
614
603
|
});
|
|
615
604
|
}
|
|
@@ -617,22 +606,22 @@ let Ie = class extends ge {
|
|
|
617
606
|
this._drawingManagerService.featurePluginUpdate$.subscribe((r) => {
|
|
618
607
|
const e = [];
|
|
619
608
|
r.length !== 0 && (r.forEach((n) => {
|
|
620
|
-
const { unitId: t, subUnitId:
|
|
609
|
+
const { unitId: t, subUnitId: i, drawingId: s, drawingType: o, transform: a } = n;
|
|
621
610
|
if (a == null)
|
|
622
611
|
return;
|
|
623
|
-
const c = this._sheetDrawingService.getDrawingByParam({ unitId: t, subUnitId:
|
|
612
|
+
const c = this._sheetDrawingService.getDrawingByParam({ unitId: t, subUnitId: i, drawingId: s });
|
|
624
613
|
if (c == null)
|
|
625
614
|
return;
|
|
626
|
-
const
|
|
627
|
-
if (
|
|
615
|
+
const g = N({ ...c.transform, ...a }, this._selectionRenderService);
|
|
616
|
+
if (g == null)
|
|
628
617
|
return;
|
|
629
|
-
const
|
|
618
|
+
const l = {
|
|
630
619
|
...n,
|
|
631
|
-
transform: { ...c.transform, ...a, ...
|
|
632
|
-
sheetTransform: { ...
|
|
620
|
+
transform: { ...c.transform, ...a, ...V(g, this._selectionRenderService) },
|
|
621
|
+
sheetTransform: { ...g }
|
|
633
622
|
};
|
|
634
|
-
e.push(
|
|
635
|
-
}), e.length > 0 && this._commandService.executeCommand(
|
|
623
|
+
e.push(l);
|
|
624
|
+
}), e.length > 0 && this._commandService.executeCommand(We.id, {
|
|
636
625
|
unitId: r[0].unitId,
|
|
637
626
|
drawings: e
|
|
638
627
|
}));
|
|
@@ -640,349 +629,344 @@ let Ie = class extends ge {
|
|
|
640
629
|
}
|
|
641
630
|
_groupDrawingListener() {
|
|
642
631
|
this._drawingManagerService.featurePluginGroupUpdate$.subscribe((r) => {
|
|
643
|
-
this._commandService.executeCommand(
|
|
632
|
+
this._commandService.executeCommand(Bt.id, r);
|
|
644
633
|
const { unitId: e, subUnitId: n, drawingId: t } = r[0].parent;
|
|
645
634
|
this._drawingManagerService.focusDrawing([{ unitId: e, subUnitId: n, drawingId: t }]);
|
|
646
635
|
}), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((r) => {
|
|
647
|
-
this._commandService.executeCommand(
|
|
636
|
+
this._commandService.executeCommand(Wt.id, r);
|
|
648
637
|
});
|
|
649
638
|
}
|
|
650
639
|
_focusDrawingListener() {
|
|
651
640
|
this.disposeWithMe(
|
|
652
641
|
this._drawingManagerService.focus$.subscribe((r) => {
|
|
653
|
-
r == null || r.length === 0 ? (this._contextService.setContextValue(
|
|
642
|
+
r == null || r.length === 0 ? (this._contextService.setContextValue(fe, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(fe, !0), this._sheetDrawingService.focusDrawing(r));
|
|
654
643
|
})
|
|
655
644
|
);
|
|
656
645
|
}
|
|
657
646
|
};
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
],
|
|
672
|
-
var
|
|
673
|
-
return
|
|
647
|
+
Ee = hr([
|
|
648
|
+
de(le.Rendered, Ee),
|
|
649
|
+
F(0, B),
|
|
650
|
+
F(1, ce),
|
|
651
|
+
F(2, $(Fn)),
|
|
652
|
+
F(3, $e),
|
|
653
|
+
F(4, ht),
|
|
654
|
+
F(5, X),
|
|
655
|
+
F(6, H),
|
|
656
|
+
F(7, gt),
|
|
657
|
+
F(8, jn),
|
|
658
|
+
F(9, $(pe)),
|
|
659
|
+
F(10, te)
|
|
660
|
+
], Ee);
|
|
661
|
+
var x = function() {
|
|
662
|
+
return x = Object.assign || function(r) {
|
|
674
663
|
for (var e, n = 1, t = arguments.length; n < t; n++) {
|
|
675
664
|
e = arguments[n];
|
|
676
|
-
for (var
|
|
677
|
-
Object.prototype.hasOwnProperty.call(e, o) && (r[o] = e[o]);
|
|
665
|
+
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (r[i] = e[i]);
|
|
678
666
|
}
|
|
679
667
|
return r;
|
|
680
|
-
},
|
|
681
|
-
},
|
|
668
|
+
}, x.apply(this, arguments);
|
|
669
|
+
}, fr = function(r, e) {
|
|
682
670
|
var n = {};
|
|
683
|
-
for (var t in r)
|
|
684
|
-
Object.prototype.hasOwnProperty.call(r, t) && e.indexOf(t) < 0 && (n[t] = r[t]);
|
|
671
|
+
for (var t in r) Object.prototype.hasOwnProperty.call(r, t) && e.indexOf(t) < 0 && (n[t] = r[t]);
|
|
685
672
|
if (r != null && typeof Object.getOwnPropertySymbols == "function")
|
|
686
|
-
for (var
|
|
687
|
-
e.indexOf(t[
|
|
673
|
+
for (var i = 0, t = Object.getOwnPropertySymbols(r); i < t.length; i++)
|
|
674
|
+
e.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(r, t[i]) && (n[t[i]] = r[t[i]]);
|
|
688
675
|
return n;
|
|
689
|
-
},
|
|
690
|
-
var n = r.icon, t = r.id,
|
|
691
|
-
return
|
|
676
|
+
}, Vt = Tt(function(r, e) {
|
|
677
|
+
var n = r.icon, t = r.id, i = r.className, s = r.extend, o = fr(r, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(i || "").trim(), c = Ut("_".concat(_r()));
|
|
678
|
+
return Gt(n, "".concat(t), { defIds: n.defIds, idSuffix: c.current }, x({ ref: e, className: a }, o), s);
|
|
692
679
|
});
|
|
693
|
-
function
|
|
694
|
-
return
|
|
695
|
-
return
|
|
680
|
+
function Gt(r, e, n, t, i) {
|
|
681
|
+
return At(r.tag, x(x({ key: e }, pr(r, n, i)), t), (wr(r, n).children || []).map(function(s, o) {
|
|
682
|
+
return Gt(s, "".concat(e, "-").concat(r.tag, "-").concat(o), n, void 0, i);
|
|
696
683
|
}));
|
|
697
684
|
}
|
|
698
|
-
function
|
|
699
|
-
var t =
|
|
685
|
+
function pr(r, e, n) {
|
|
686
|
+
var t = x({}, r.attrs);
|
|
700
687
|
n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
|
|
701
|
-
var
|
|
702
|
-
return !
|
|
703
|
-
var
|
|
704
|
-
typeof a == "string" && (t[
|
|
688
|
+
var i = e.defIds;
|
|
689
|
+
return !i || i.length === 0 || (r.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(s) {
|
|
690
|
+
var o = s[0], a = s[1];
|
|
691
|
+
typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
705
692
|
})), t;
|
|
706
693
|
}
|
|
707
|
-
function
|
|
694
|
+
function wr(r, e) {
|
|
708
695
|
var n, t = e.defIds;
|
|
709
|
-
return !t || t.length === 0 ? r : r.tag === "defs" && (!((n = r.children) === null || n === void 0) && n.length) ?
|
|
710
|
-
return typeof
|
|
696
|
+
return !t || t.length === 0 ? r : r.tag === "defs" && (!((n = r.children) === null || n === void 0) && n.length) ? x(x({}, r), { children: r.children.map(function(i) {
|
|
697
|
+
return typeof i.attrs.id == "string" && t && t.indexOf(i.attrs.id) > -1 ? x(x({}, i), { attrs: x(x({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
|
|
711
698
|
}) }) : r;
|
|
712
699
|
}
|
|
713
|
-
function
|
|
700
|
+
function _r() {
|
|
714
701
|
return Math.random().toString(36).substring(2, 8);
|
|
715
702
|
}
|
|
716
|
-
|
|
717
|
-
var
|
|
718
|
-
return
|
|
703
|
+
Vt.displayName = "UniverIcon";
|
|
704
|
+
var vr = { 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" } }] }, xt = Tt(function(r, e) {
|
|
705
|
+
return At(Vt, Object.assign({}, r, {
|
|
719
706
|
id: "add-image-single",
|
|
720
707
|
ref: e,
|
|
721
|
-
icon:
|
|
708
|
+
icon: vr
|
|
722
709
|
}));
|
|
723
710
|
});
|
|
724
|
-
|
|
725
|
-
const
|
|
726
|
-
uploadFileMenu:
|
|
727
|
-
uploadFileMenuInput:
|
|
728
|
-
},
|
|
729
|
-
var
|
|
730
|
-
const
|
|
731
|
-
const { type: e } = r, n =
|
|
711
|
+
xt.displayName = "AddImageSingle";
|
|
712
|
+
const Sr = "univer-upload-file-menu", Cr = "univer-upload-file-menu-input", ut = {
|
|
713
|
+
uploadFileMenu: Sr,
|
|
714
|
+
uploadFileMenuInput: Cr
|
|
715
|
+
}, Ft = "COMPONENT_UPLOAD_FILE_MENU";
|
|
716
|
+
var Ne = /* @__PURE__ */ ((r) => (r[r.cellImage = 0] = "cellImage", r[r.floatImage = 1] = "floatImage", r))(Ne || {});
|
|
717
|
+
const Ir = (r) => {
|
|
718
|
+
const { type: e } = r, n = q(B), t = Ut(null), i = () => {
|
|
732
719
|
var a;
|
|
733
720
|
(a = t.current) == null || a.click();
|
|
734
|
-
},
|
|
721
|
+
}, s = _n.map((a) => `.${a.replace("image/", "")}`).join(","), o = (a) => {
|
|
735
722
|
const c = a.target.files;
|
|
736
723
|
if (c == null)
|
|
737
724
|
return;
|
|
738
|
-
const
|
|
739
|
-
e ===
|
|
725
|
+
const g = Array.from(c);
|
|
726
|
+
e === Ne.floatImage ? n.executeCommand(Be.id, { files: g }) : e === Ne.cellImage && n.executeCommand(Ae.id, { files: g }), t.current && (t.current.value = "");
|
|
740
727
|
};
|
|
741
|
-
return /* @__PURE__ */
|
|
728
|
+
return /* @__PURE__ */ L.createElement("div", { onClick: i, className: ut.uploadFileMenu }, /* @__PURE__ */ L.createElement(
|
|
742
729
|
"input",
|
|
743
730
|
{
|
|
744
731
|
type: "file",
|
|
745
|
-
className:
|
|
732
|
+
className: ut.uploadFileMenuInput,
|
|
746
733
|
ref: t,
|
|
747
|
-
onChange:
|
|
748
|
-
accept:
|
|
734
|
+
onChange: o,
|
|
735
|
+
accept: s,
|
|
749
736
|
multiple: !0
|
|
750
737
|
}
|
|
751
738
|
));
|
|
752
|
-
},
|
|
753
|
-
function
|
|
739
|
+
}, Yt = "addition-and-subtraction-single", Xt = "sheet.menu.image";
|
|
740
|
+
function Rr(r) {
|
|
754
741
|
return {
|
|
755
|
-
id:
|
|
756
|
-
type:
|
|
757
|
-
positions: [
|
|
758
|
-
group:
|
|
759
|
-
icon:
|
|
742
|
+
id: Xt,
|
|
743
|
+
type: ft.SUBITEMS,
|
|
744
|
+
positions: [Ln.TOOLBAR_START],
|
|
745
|
+
group: $n.TOOLBAR_FORMULAS_INSERT,
|
|
746
|
+
icon: Yt,
|
|
760
747
|
tooltip: "sheetImage.title",
|
|
761
|
-
hidden$:
|
|
762
|
-
disabled$:
|
|
748
|
+
hidden$: pt(r, Y.UNIVER_SHEET),
|
|
749
|
+
disabled$: On(r, { workbookTypes: [He], worksheetTypes: [Oe], rangeTypes: [Yn] })
|
|
763
750
|
};
|
|
764
751
|
}
|
|
765
|
-
function
|
|
752
|
+
function Dr(r) {
|
|
766
753
|
return {
|
|
767
|
-
id:
|
|
754
|
+
id: Be.id,
|
|
768
755
|
title: "sheetImage.upload.float",
|
|
769
|
-
type:
|
|
756
|
+
type: ft.SELECTOR,
|
|
770
757
|
label: {
|
|
771
|
-
name:
|
|
758
|
+
name: Ft,
|
|
772
759
|
props: {
|
|
773
|
-
type:
|
|
760
|
+
type: Ne.floatImage
|
|
774
761
|
}
|
|
775
762
|
},
|
|
776
|
-
positions: [
|
|
777
|
-
hidden$:
|
|
763
|
+
positions: [Xt],
|
|
764
|
+
hidden$: pt(r, Y.UNIVER_SHEET)
|
|
778
765
|
};
|
|
779
766
|
}
|
|
780
|
-
const
|
|
781
|
-
imageCommonPanel:
|
|
782
|
-
imageCommonPanelGrid:
|
|
783
|
-
imageCommonPanelBorder:
|
|
784
|
-
imageCommonPanelTitle:
|
|
785
|
-
imageCommonPanelRow:
|
|
786
|
-
imageCommonPanelRowVertical:
|
|
787
|
-
imageCommonPanelColumn:
|
|
788
|
-
imageCommonPanelColumnCenter:
|
|
789
|
-
imageCommonPanelInline:
|
|
790
|
-
imageCommonPanelSpan2:
|
|
791
|
-
imageCommonPanelSpan3:
|
|
792
|
-
imageCommonPanelInput:
|
|
793
|
-
sheetImageMenu:
|
|
794
|
-
sheetImageMenuInput:
|
|
795
|
-
},
|
|
767
|
+
const Mr = "univer-image-common-panel", br = "univer-image-common-panel-grid", Or = "univer-image-common-panel-border", Pr = "univer-image-common-panel-title", Er = "univer-image-common-panel-row", yr = "univer-image-common-panel-row-vertical", Tr = "univer-image-common-panel-column", Ur = "univer-image-common-panel-column-center", Ar = "univer-image-common-panel-inline", Nr = "univer-image-common-panel-span2", jr = "univer-image-common-panel-span3", Lr = "univer-image-common-panel-input", $r = "univer-sheet-image-menu", Br = "univer-sheet-image-menu-input", k = {
|
|
768
|
+
imageCommonPanel: Mr,
|
|
769
|
+
imageCommonPanelGrid: br,
|
|
770
|
+
imageCommonPanelBorder: Or,
|
|
771
|
+
imageCommonPanelTitle: Pr,
|
|
772
|
+
imageCommonPanelRow: Er,
|
|
773
|
+
imageCommonPanelRowVertical: yr,
|
|
774
|
+
imageCommonPanelColumn: Tr,
|
|
775
|
+
imageCommonPanelColumnCenter: Ur,
|
|
776
|
+
imageCommonPanelInline: Ar,
|
|
777
|
+
imageCommonPanelSpan2: Nr,
|
|
778
|
+
imageCommonPanelSpan3: jr,
|
|
779
|
+
imageCommonPanelInput: Lr,
|
|
780
|
+
sheetImageMenu: $r,
|
|
781
|
+
sheetImageMenuInput: Br
|
|
782
|
+
}, Wr = (r) => {
|
|
796
783
|
var v;
|
|
797
|
-
const e =
|
|
798
|
-
if (
|
|
784
|
+
const e = q(B), n = q(pe), t = q(H), i = q(te), { drawings: s } = r, o = s[0];
|
|
785
|
+
if (o == null)
|
|
799
786
|
return;
|
|
800
|
-
const { unitId: a } =
|
|
801
|
-
if (
|
|
787
|
+
const { unitId: a } = o, c = i.getRenderById(a), g = c == null ? void 0 : c.scene;
|
|
788
|
+
if (g == null)
|
|
802
789
|
return;
|
|
803
|
-
const
|
|
804
|
-
function
|
|
790
|
+
const l = g.getTransformerByCreate(), [d, m] = ke(!0), u = (v = o.anchorType) != null ? v : b.Position, [f, h] = ke(u);
|
|
791
|
+
function p(R, _) {
|
|
805
792
|
const M = [];
|
|
806
|
-
return R.forEach((
|
|
807
|
-
const { oKey:
|
|
793
|
+
return R.forEach((w) => {
|
|
794
|
+
const { oKey: y } = w, D = _.getDrawingOKey(y);
|
|
808
795
|
if (D == null)
|
|
809
796
|
return M.push(null), !0;
|
|
810
|
-
const { unitId:
|
|
797
|
+
const { unitId: T, subUnitId: U, drawingId: E, drawingType: I, anchorType: A, sheetTransform: z } = D;
|
|
811
798
|
M.push({
|
|
812
|
-
unitId:
|
|
799
|
+
unitId: T,
|
|
813
800
|
subUnitId: U,
|
|
814
|
-
drawingId:
|
|
801
|
+
drawingId: E,
|
|
815
802
|
anchorType: A,
|
|
816
|
-
sheetTransform:
|
|
817
|
-
drawingType:
|
|
803
|
+
sheetTransform: z,
|
|
804
|
+
drawingType: I
|
|
818
805
|
});
|
|
819
806
|
}), M;
|
|
820
807
|
}
|
|
821
|
-
|
|
822
|
-
const R =
|
|
823
|
-
M === !0 &&
|
|
824
|
-
}),
|
|
808
|
+
qe(() => {
|
|
809
|
+
const R = l.clearControl$.subscribe((M) => {
|
|
810
|
+
M === !0 && m(!1);
|
|
811
|
+
}), _ = l.changeStart$.subscribe((M) => {
|
|
825
812
|
var D;
|
|
826
|
-
const { objects:
|
|
827
|
-
if (
|
|
828
|
-
|
|
829
|
-
else if (
|
|
830
|
-
|
|
831
|
-
const
|
|
832
|
-
|
|
813
|
+
const { objects: w } = M, y = p(w, t);
|
|
814
|
+
if (y.length === 0)
|
|
815
|
+
m(!1);
|
|
816
|
+
else if (y.length >= 1) {
|
|
817
|
+
m(!0);
|
|
818
|
+
const T = ((D = y[0]) == null ? void 0 : D.anchorType) || b.Position;
|
|
819
|
+
h(T);
|
|
833
820
|
}
|
|
834
821
|
});
|
|
835
822
|
return () => {
|
|
836
|
-
|
|
823
|
+
_.unsubscribe(), R.unsubscribe();
|
|
837
824
|
};
|
|
838
825
|
}, []);
|
|
839
|
-
function
|
|
840
|
-
|
|
841
|
-
const
|
|
842
|
-
if (
|
|
826
|
+
function S(R) {
|
|
827
|
+
h(R);
|
|
828
|
+
const _ = t.getFocusDrawings();
|
|
829
|
+
if (_.length === 0)
|
|
843
830
|
return;
|
|
844
|
-
const M =
|
|
845
|
-
unitId:
|
|
846
|
-
subUnitId:
|
|
847
|
-
drawingId:
|
|
831
|
+
const M = _.map((w) => ({
|
|
832
|
+
unitId: w.unitId,
|
|
833
|
+
subUnitId: w.subUnitId,
|
|
834
|
+
drawingId: w.drawingId,
|
|
848
835
|
anchorType: R
|
|
849
836
|
}));
|
|
850
|
-
e.executeCommand(
|
|
851
|
-
unitId:
|
|
837
|
+
e.executeCommand(We.id, {
|
|
838
|
+
unitId: _[0].unitId,
|
|
852
839
|
drawings: M
|
|
853
840
|
});
|
|
854
841
|
}
|
|
855
842
|
const C = (R) => R ? "block" : "none";
|
|
856
|
-
return /* @__PURE__ */
|
|
857
|
-
},
|
|
858
|
-
const r =
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
return Ye(() => {
|
|
863
|
-
const o = r.focus$.subscribe((i) => {
|
|
864
|
-
t(i);
|
|
843
|
+
return /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelGrid, k.imageCommonPanelBorder), style: { display: C(d) } }, /* @__PURE__ */ L.createElement("div", { className: k.imageCommonPanelRow }, /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelColumn, k.imageCommonPanelTitle) }, /* @__PURE__ */ L.createElement("div", null, n.t("drawing-anchor.title")))), /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelRow) }, /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelColumn) }, /* @__PURE__ */ L.createElement(er, { value: f, onChange: S, direction: "vertical" }, /* @__PURE__ */ L.createElement(Fe, { value: b.Both }, n.t("drawing-anchor.both")), /* @__PURE__ */ L.createElement(Fe, { value: b.Position }, n.t("drawing-anchor.position")), /* @__PURE__ */ L.createElement(Fe, { value: b.None }, n.t("drawing-anchor.none"))))));
|
|
844
|
+
}, Vr = () => {
|
|
845
|
+
const r = q(H), e = r.getFocusDrawings(), [n, t] = ke(e);
|
|
846
|
+
return qe(() => {
|
|
847
|
+
const i = r.focus$.subscribe((s) => {
|
|
848
|
+
t(s);
|
|
865
849
|
});
|
|
866
850
|
return () => {
|
|
867
|
-
|
|
851
|
+
i.unsubscribe();
|
|
868
852
|
};
|
|
869
|
-
}, []), /* @__PURE__ */
|
|
870
|
-
},
|
|
853
|
+
}, []), !!(n != null && n.length) && /* @__PURE__ */ L.createElement("div", { className: k.imageCommonPanel }, /* @__PURE__ */ L.createElement(mn, { drawings: n }), /* @__PURE__ */ L.createElement(Wr, { drawings: n }));
|
|
854
|
+
}, we = {
|
|
871
855
|
id: "sheet.command.move-drawing",
|
|
872
|
-
type:
|
|
856
|
+
type: G.COMMAND,
|
|
873
857
|
handler: (r, e) => {
|
|
874
|
-
const n = r.get(B), t = r.get(
|
|
875
|
-
if (
|
|
858
|
+
const n = r.get(B), t = r.get(X), i = r.get($e), { direction: s } = e, o = t.getFocusDrawings();
|
|
859
|
+
if (o.length === 0)
|
|
876
860
|
return !1;
|
|
877
|
-
const a =
|
|
878
|
-
const { transform:
|
|
879
|
-
if (
|
|
861
|
+
const a = o[0].unitId, c = o.map((l) => {
|
|
862
|
+
const { transform: d } = l;
|
|
863
|
+
if (d == null)
|
|
880
864
|
return null;
|
|
881
|
-
const
|
|
882
|
-
return
|
|
883
|
-
...
|
|
884
|
-
transform:
|
|
885
|
-
sheetTransform: N(
|
|
865
|
+
const m = { ...d }, { left: u = 0, top: f = 0 } = d;
|
|
866
|
+
return s === J.UP ? m.top = f - 1 : s === J.DOWN ? m.top = f + 1 : s === J.LEFT ? m.left = u - 1 : s === J.RIGHT && (m.left = u + 1), {
|
|
867
|
+
...l,
|
|
868
|
+
transform: m,
|
|
869
|
+
sheetTransform: N(m, i)
|
|
886
870
|
};
|
|
887
|
-
}).filter((
|
|
888
|
-
return n.syncExecuteCommand(
|
|
871
|
+
}).filter((l) => l != null);
|
|
872
|
+
return n.syncExecuteCommand(We.id, {
|
|
889
873
|
unitId: a,
|
|
890
874
|
drawings: c
|
|
891
|
-
}) ? (n.syncExecuteCommand(
|
|
875
|
+
}) ? (n.syncExecuteCommand(j.id, [a]), !0) : !1;
|
|
892
876
|
}
|
|
893
|
-
},
|
|
877
|
+
}, Ht = {
|
|
894
878
|
id: "sheet.command.delete-drawing",
|
|
895
|
-
type:
|
|
879
|
+
type: G.COMMAND,
|
|
896
880
|
handler: (r) => {
|
|
897
|
-
const e = r.get(B), t = r.get(
|
|
881
|
+
const e = r.get(B), t = r.get(X).getFocusDrawings();
|
|
898
882
|
if (t.length === 0)
|
|
899
883
|
return !1;
|
|
900
|
-
const
|
|
901
|
-
const { unitId: a, subUnitId: c, drawingId:
|
|
884
|
+
const i = t[0].unitId, s = t.map((o) => {
|
|
885
|
+
const { unitId: a, subUnitId: c, drawingId: g, drawingType: l } = o;
|
|
902
886
|
return {
|
|
903
887
|
unitId: a,
|
|
904
888
|
subUnitId: c,
|
|
905
|
-
drawingId:
|
|
906
|
-
drawingType:
|
|
889
|
+
drawingId: g,
|
|
890
|
+
drawingType: l
|
|
907
891
|
};
|
|
908
892
|
});
|
|
909
|
-
return e.executeCommand(
|
|
910
|
-
unitId:
|
|
911
|
-
drawings:
|
|
893
|
+
return e.executeCommand(Qe.id, {
|
|
894
|
+
unitId: i,
|
|
895
|
+
drawings: s
|
|
912
896
|
});
|
|
913
897
|
}
|
|
914
898
|
};
|
|
915
|
-
function
|
|
916
|
-
return !r.getContextValue(
|
|
899
|
+
function _e(r) {
|
|
900
|
+
return !r.getContextValue(Qt) && !r.getContextValue(en) && r.getContextValue(fe);
|
|
917
901
|
}
|
|
918
|
-
const
|
|
919
|
-
id:
|
|
902
|
+
const Gr = {
|
|
903
|
+
id: we.id,
|
|
920
904
|
description: "shortcut.sheet.drawing-move-down",
|
|
921
905
|
group: "4_sheet-drawing-view",
|
|
922
906
|
binding: oe.ARROW_DOWN,
|
|
923
907
|
priority: 100,
|
|
924
|
-
preconditions:
|
|
908
|
+
preconditions: _e,
|
|
925
909
|
staticParameters: {
|
|
926
|
-
direction:
|
|
910
|
+
direction: J.DOWN
|
|
927
911
|
}
|
|
928
|
-
},
|
|
929
|
-
id:
|
|
912
|
+
}, xr = {
|
|
913
|
+
id: we.id,
|
|
930
914
|
description: "shortcut.sheet.drawing-move-up",
|
|
931
915
|
group: "4_sheet-drawing-view",
|
|
932
916
|
binding: oe.ARROW_UP,
|
|
933
917
|
priority: 100,
|
|
934
|
-
preconditions:
|
|
918
|
+
preconditions: _e,
|
|
935
919
|
staticParameters: {
|
|
936
|
-
direction:
|
|
920
|
+
direction: J.UP
|
|
937
921
|
}
|
|
938
|
-
},
|
|
939
|
-
id:
|
|
922
|
+
}, Fr = {
|
|
923
|
+
id: we.id,
|
|
940
924
|
description: "shortcut.sheet.drawing-move-left",
|
|
941
925
|
group: "4_sheet-drawing-view",
|
|
942
926
|
binding: oe.ARROW_LEFT,
|
|
943
927
|
priority: 100,
|
|
944
|
-
preconditions:
|
|
928
|
+
preconditions: _e,
|
|
945
929
|
staticParameters: {
|
|
946
|
-
direction:
|
|
930
|
+
direction: J.LEFT
|
|
947
931
|
}
|
|
948
|
-
},
|
|
949
|
-
id:
|
|
932
|
+
}, Yr = {
|
|
933
|
+
id: we.id,
|
|
950
934
|
description: "shortcut.sheet.drawing-move-right",
|
|
951
935
|
group: "4_sheet-drawing-view",
|
|
952
936
|
binding: oe.ARROW_RIGHT,
|
|
953
937
|
priority: 100,
|
|
954
|
-
preconditions:
|
|
938
|
+
preconditions: _e,
|
|
955
939
|
staticParameters: {
|
|
956
|
-
direction:
|
|
940
|
+
direction: J.RIGHT
|
|
957
941
|
}
|
|
958
|
-
},
|
|
959
|
-
id:
|
|
942
|
+
}, Xr = {
|
|
943
|
+
id: Ht.id,
|
|
960
944
|
description: "shortcut.sheet.drawing-delete",
|
|
961
945
|
group: "4_sheet-drawing-view",
|
|
962
946
|
// when focusing on any other input tag do not trigger this shortcut
|
|
963
|
-
preconditions:
|
|
947
|
+
preconditions: _e,
|
|
964
948
|
binding: oe.DELETE,
|
|
965
949
|
mac: oe.BACKSPACE
|
|
966
950
|
};
|
|
967
|
-
var
|
|
968
|
-
for (var
|
|
969
|
-
(
|
|
970
|
-
return t &&
|
|
971
|
-
},
|
|
972
|
-
const
|
|
973
|
-
let
|
|
974
|
-
constructor(r, e, n, t,
|
|
975
|
-
super(), this._config = r, this._injector = e, this._componentManager = n, this._menuService = t, this._commandService =
|
|
951
|
+
var Hr = Object.defineProperty, zr = Object.getOwnPropertyDescriptor, Kr = (r, e, n, t) => {
|
|
952
|
+
for (var i = t > 1 ? void 0 : t ? zr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
|
|
953
|
+
(o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
|
|
954
|
+
return t && i && Hr(e, n, i), i;
|
|
955
|
+
}, me = (r, e) => (n, t) => e(n, t, r);
|
|
956
|
+
const kr = {};
|
|
957
|
+
let he = class extends ue {
|
|
958
|
+
constructor(r, e, n, t, i, s) {
|
|
959
|
+
super(), this._config = r, this._injector = e, this._componentManager = n, this._menuService = t, this._commandService = i, this._shortcutService = s, this._init();
|
|
976
960
|
}
|
|
977
961
|
_initCustomComponents() {
|
|
978
962
|
const r = this._componentManager;
|
|
979
|
-
this.disposeWithMe(r.register(
|
|
963
|
+
this.disposeWithMe(r.register(Yt, xt)), this.disposeWithMe(r.register(Ft, Ir)), this.disposeWithMe(r.register(Nt, Vr));
|
|
980
964
|
}
|
|
981
965
|
_initMenus() {
|
|
982
966
|
const { menu: r = {} } = this._config;
|
|
983
967
|
[
|
|
984
|
-
|
|
985
|
-
|
|
968
|
+
Rr,
|
|
969
|
+
Dr
|
|
986
970
|
// UploadCellImageMenuFactory,
|
|
987
971
|
].forEach((e) => {
|
|
988
972
|
this._menuService.addMenuItem(e(this._injector), r);
|
|
@@ -990,29 +974,29 @@ let ce = class extends ge {
|
|
|
990
974
|
}
|
|
991
975
|
_initCommands() {
|
|
992
976
|
[
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
Mt,
|
|
999
|
-
L,
|
|
1000
|
-
Ot,
|
|
1001
|
-
Pt,
|
|
1002
|
-
yt,
|
|
1003
|
-
fe,
|
|
977
|
+
Be,
|
|
978
|
+
Ae,
|
|
979
|
+
et,
|
|
980
|
+
Qe,
|
|
981
|
+
We,
|
|
1004
982
|
jt,
|
|
1005
|
-
|
|
983
|
+
j,
|
|
984
|
+
Lt,
|
|
985
|
+
Bt,
|
|
986
|
+
Wt,
|
|
987
|
+
we,
|
|
988
|
+
Ht,
|
|
989
|
+
$t
|
|
1006
990
|
].forEach((r) => this.disposeWithMe(this._commandService.registerCommand(r)));
|
|
1007
991
|
}
|
|
1008
992
|
_initShortcuts() {
|
|
1009
993
|
[
|
|
1010
994
|
// sheet drawing shortcuts
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
995
|
+
Gr,
|
|
996
|
+
xr,
|
|
997
|
+
Fr,
|
|
998
|
+
Yr,
|
|
999
|
+
Xr
|
|
1016
1000
|
].forEach((r) => {
|
|
1017
1001
|
this.disposeWithMe(this._shortcutService.registerShortcut(r));
|
|
1018
1002
|
});
|
|
@@ -1021,47 +1005,47 @@ let ce = class extends ge {
|
|
|
1021
1005
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
1022
1006
|
}
|
|
1023
1007
|
};
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
],
|
|
1032
|
-
var
|
|
1033
|
-
for (var
|
|
1034
|
-
(
|
|
1035
|
-
return t &&
|
|
1036
|
-
},
|
|
1037
|
-
const
|
|
1038
|
-
at.id,
|
|
1039
|
-
ct.id,
|
|
1040
|
-
lt.id,
|
|
1041
|
-
dt.id,
|
|
1042
|
-
ut.id,
|
|
1043
|
-
mt.id,
|
|
1044
|
-
ht.id,
|
|
1045
|
-
gt.id,
|
|
1046
|
-
Ge.id,
|
|
1047
|
-
xe.id,
|
|
1048
|
-
ft.id,
|
|
1049
|
-
pt.id,
|
|
1008
|
+
he = Kr([
|
|
1009
|
+
de(le.Rendered, he),
|
|
1010
|
+
me(1, $(Ze)),
|
|
1011
|
+
me(2, $(Bn)),
|
|
1012
|
+
me(3, Wn),
|
|
1013
|
+
me(4, B),
|
|
1014
|
+
me(5, Vn)
|
|
1015
|
+
], he);
|
|
1016
|
+
var Jr = Object.defineProperty, Zr = Object.getOwnPropertyDescriptor, qr = (r, e, n, t) => {
|
|
1017
|
+
for (var i = t > 1 ? void 0 : t ? Zr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1018
|
+
(o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
|
|
1019
|
+
return t && i && Jr(e, n, i), i;
|
|
1020
|
+
}, re = (r, e) => (n, t) => e(n, t, r);
|
|
1021
|
+
const Qr = [
|
|
1050
1022
|
wt.id,
|
|
1051
1023
|
_t.id,
|
|
1052
1024
|
vt.id,
|
|
1053
|
-
St.id
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1025
|
+
St.id,
|
|
1026
|
+
Ct.id,
|
|
1027
|
+
It.id,
|
|
1028
|
+
Rt.id,
|
|
1029
|
+
Dt.id,
|
|
1030
|
+
ze.id,
|
|
1031
|
+
Ke.id,
|
|
1032
|
+
Mt.id,
|
|
1033
|
+
bt.id,
|
|
1034
|
+
Ot.id,
|
|
1035
|
+
Pt.id,
|
|
1036
|
+
Et.id,
|
|
1037
|
+
yt.id
|
|
1038
|
+
], ei = [
|
|
1039
|
+
Xn.id,
|
|
1040
|
+
Hn.id,
|
|
1041
|
+
zn.id,
|
|
1042
|
+
Kn.id,
|
|
1043
|
+
kn.id,
|
|
1044
|
+
Jn.id
|
|
1061
1045
|
];
|
|
1062
|
-
let
|
|
1063
|
-
constructor(r, e, n, t,
|
|
1064
|
-
super(), this._commandService = r, this._sheetInterceptorService = e, this._sheetDrawingService = n, this._drawingManagerService = t, this._selectionRenderService =
|
|
1046
|
+
let ye = class extends ue {
|
|
1047
|
+
constructor(r, e, n, t, i, s) {
|
|
1048
|
+
super(), this._commandService = r, this._sheetInterceptorService = e, this._sheetDrawingService = n, this._drawingManagerService = t, this._selectionRenderService = i, this._univerInstanceService = s, this._init();
|
|
1065
1049
|
}
|
|
1066
1050
|
_init() {
|
|
1067
1051
|
this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
|
|
@@ -1070,56 +1054,56 @@ let De = class extends ge {
|
|
|
1070
1054
|
this.disposeWithMe(
|
|
1071
1055
|
this._sheetInterceptorService.interceptCommand({
|
|
1072
1056
|
getMutations: (r) => {
|
|
1073
|
-
if (!
|
|
1057
|
+
if (!Qr.includes(r.id))
|
|
1074
1058
|
return { redos: [], undos: [] };
|
|
1075
1059
|
if (r.params == null)
|
|
1076
1060
|
return { redos: [], undos: [] };
|
|
1077
1061
|
const e = r.id;
|
|
1078
|
-
if (e ===
|
|
1062
|
+
if (e === wt.id)
|
|
1079
1063
|
return this._moveRowInterceptor(r.params, "insert");
|
|
1080
|
-
if (e ===
|
|
1064
|
+
if (e === _t.id)
|
|
1081
1065
|
return this._moveColInterceptor(r.params, "insert");
|
|
1082
|
-
if (e ===
|
|
1066
|
+
if (e === vt.id)
|
|
1083
1067
|
return this._moveRowInterceptor(r.params, "remove");
|
|
1084
|
-
if (e ===
|
|
1068
|
+
if (e === St.id)
|
|
1085
1069
|
return this._moveColInterceptor(r.params, "remove");
|
|
1086
|
-
if (e ===
|
|
1070
|
+
if (e === Ct.id) {
|
|
1087
1071
|
const { range: n } = r.params;
|
|
1088
1072
|
return this._getRangeMoveUndo(
|
|
1089
1073
|
n,
|
|
1090
1074
|
0
|
|
1091
1075
|
/* deleteLeft */
|
|
1092
1076
|
);
|
|
1093
|
-
} else if (e ===
|
|
1077
|
+
} else if (e === It.id) {
|
|
1094
1078
|
const { range: n } = r.params;
|
|
1095
1079
|
return this._getRangeMoveUndo(
|
|
1096
1080
|
n,
|
|
1097
1081
|
1
|
|
1098
1082
|
/* deleteUp */
|
|
1099
1083
|
);
|
|
1100
|
-
} else if (e ===
|
|
1084
|
+
} else if (e === Rt.id) {
|
|
1101
1085
|
const { range: n } = r.params;
|
|
1102
1086
|
return this._getRangeMoveUndo(
|
|
1103
1087
|
n,
|
|
1104
1088
|
2
|
|
1105
1089
|
/* insertDown */
|
|
1106
1090
|
);
|
|
1107
|
-
} else if (e ===
|
|
1091
|
+
} else if (e === Dt.id) {
|
|
1108
1092
|
const { range: n } = r.params;
|
|
1109
1093
|
return this._getRangeMoveUndo(
|
|
1110
1094
|
n,
|
|
1111
1095
|
3
|
|
1112
1096
|
/* insertRight */
|
|
1113
1097
|
);
|
|
1114
|
-
} else if (e ===
|
|
1115
|
-
const n = r.params, { unitId: t, subUnitId:
|
|
1116
|
-
return this._getDrawingUndoForRowVisible(t,
|
|
1117
|
-
} else if (e ===
|
|
1118
|
-
const n = r.params, { unitId: t, subUnitId:
|
|
1119
|
-
return this._getDrawingUndoForColVisible(t,
|
|
1120
|
-
} else if (e ===
|
|
1121
|
-
const n = r.params, { unitId: t, subUnitId:
|
|
1122
|
-
return this._getDrawingUndoForRowAndColSize(t,
|
|
1098
|
+
} else if (e === Ot.id || e === Pt.id) {
|
|
1099
|
+
const n = r.params, { unitId: t, subUnitId: i, ranges: s } = n;
|
|
1100
|
+
return this._getDrawingUndoForRowVisible(t, i, s);
|
|
1101
|
+
} else if (e === Et.id || e === yt.id) {
|
|
1102
|
+
const n = r.params, { unitId: t, subUnitId: i, ranges: s } = n;
|
|
1103
|
+
return this._getDrawingUndoForColVisible(t, i, s);
|
|
1104
|
+
} else if (e === ze.id || e === Ke.id || e === Mt.id || e === bt.id) {
|
|
1105
|
+
const n = r.params, { unitId: t, subUnitId: i, ranges: s } = n, o = e === ze.id || e === Ke.id;
|
|
1106
|
+
return this._getDrawingUndoForRowAndColSize(t, i, s, o);
|
|
1123
1107
|
}
|
|
1124
1108
|
return { redos: [], undos: [] };
|
|
1125
1109
|
}
|
|
@@ -1127,63 +1111,63 @@ let De = class extends ge {
|
|
|
1127
1111
|
);
|
|
1128
1112
|
}
|
|
1129
1113
|
_getRangeMoveUndo(r, e) {
|
|
1130
|
-
const n =
|
|
1114
|
+
const n = se(this._univerInstanceService);
|
|
1131
1115
|
if (n == null)
|
|
1132
1116
|
return { redos: [], undos: [] };
|
|
1133
|
-
const t = n.unitId,
|
|
1134
|
-
if (Object.keys(a).forEach((
|
|
1135
|
-
const
|
|
1136
|
-
c.push(...
|
|
1137
|
-
}), c.length === 0 &&
|
|
1117
|
+
const t = n.unitId, i = n.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(t, i), c = [], g = [];
|
|
1118
|
+
if (Object.keys(a).forEach((l) => {
|
|
1119
|
+
const d = a[l], { updateDrawings: m, deleteDrawings: u } = this._getUpdateOrDeleteDrawings(r, e, d);
|
|
1120
|
+
c.push(...m), g.push(...u);
|
|
1121
|
+
}), c.length === 0 && g.length === 0)
|
|
1138
1122
|
return { redos: [], undos: [] };
|
|
1139
1123
|
if (c.length > 0) {
|
|
1140
|
-
const
|
|
1141
|
-
|
|
1124
|
+
const l = this._sheetDrawingService.getBatchUpdateOp(c), { undo: d, redo: m, objects: u } = l;
|
|
1125
|
+
s.push({ id: O.id, params: { unitId: t, subUnitId: i, op: m, objects: u, type: P.UPDATE } }), o.push({ id: O.id, params: { unitId: t, subUnitId: i, op: d, objects: u, type: P.UPDATE } });
|
|
1142
1126
|
}
|
|
1143
|
-
if (
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1127
|
+
if (g.length > 0) {
|
|
1128
|
+
const l = this._sheetDrawingService.getBatchRemoveOp(g), d = l.undo, m = l.redo, u = l.objects;
|
|
1129
|
+
s.push({ id: O.id, params: { unitId: t, subUnitId: i, op: m, objects: u, type: P.REMOVE } }), o.push({ id: O.id, params: { unitId: t, subUnitId: i, op: d, objects: u, type: P.INSERT } });
|
|
1146
1130
|
}
|
|
1147
|
-
return
|
|
1148
|
-
redos:
|
|
1149
|
-
undos:
|
|
1131
|
+
return s.push({ id: j.id, params: [t] }), o.push({ id: j.id, params: [t] }), {
|
|
1132
|
+
redos: s,
|
|
1133
|
+
undos: o
|
|
1150
1134
|
};
|
|
1151
1135
|
}
|
|
1152
1136
|
_getUpdateOrDeleteDrawings(r, e, n) {
|
|
1153
|
-
const t = [],
|
|
1154
|
-
if (
|
|
1137
|
+
const t = [], i = [], { sheetTransform: s, anchorType: o = b.Position, transform: a, unitId: c, subUnitId: g, drawingId: l } = n, { from: d, to: m } = s, { row: u, column: f } = d, { row: h, column: p } = m;
|
|
1138
|
+
if (s == null || a == null)
|
|
1155
1139
|
return {
|
|
1156
1140
|
updateDrawings: t,
|
|
1157
|
-
deleteDrawings:
|
|
1141
|
+
deleteDrawings: i
|
|
1158
1142
|
};
|
|
1159
|
-
const { startRow:
|
|
1160
|
-
let
|
|
1161
|
-
if (e === 0 &&
|
|
1162
|
-
if (f >= v &&
|
|
1163
|
-
|
|
1143
|
+
const { startRow: S, endRow: C, startColumn: v, endColumn: R } = r;
|
|
1144
|
+
let _ = null, M = null;
|
|
1145
|
+
if (e === 0 && u >= S && h <= C)
|
|
1146
|
+
if (f >= v && p <= R)
|
|
1147
|
+
i.push({ unitId: c, subUnitId: g, drawingId: l });
|
|
1164
1148
|
else {
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1149
|
+
const w = this._shrinkCol(s, a, v, R, o);
|
|
1150
|
+
_ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
|
|
1167
1151
|
}
|
|
1168
|
-
else if (e === 1 && f >= v &&
|
|
1169
|
-
if (
|
|
1170
|
-
|
|
1152
|
+
else if (e === 1 && f >= v && p <= R)
|
|
1153
|
+
if (u >= S && h <= C)
|
|
1154
|
+
i.push({ unitId: c, subUnitId: g, drawingId: l });
|
|
1171
1155
|
else {
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1156
|
+
const w = this._shrinkRow(s, a, S, C, o);
|
|
1157
|
+
_ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
|
|
1174
1158
|
}
|
|
1175
1159
|
else if (e === 2) {
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1160
|
+
const w = this._expandRow(s, a, S, C, o);
|
|
1161
|
+
_ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
|
|
1178
1162
|
} else if (e === 3) {
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1163
|
+
const w = this._expandCol(s, a, v, R, o);
|
|
1164
|
+
_ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
|
|
1181
1165
|
}
|
|
1182
|
-
if (
|
|
1183
|
-
const
|
|
1184
|
-
t.push({ ...n, sheetTransform:
|
|
1166
|
+
if (_ != null && M != null) {
|
|
1167
|
+
const w = V(_, this._selectionRenderService);
|
|
1168
|
+
t.push({ ...n, sheetTransform: _, transform: w });
|
|
1185
1169
|
}
|
|
1186
|
-
return { updateDrawings: t, deleteDrawings:
|
|
1170
|
+
return { updateDrawings: t, deleteDrawings: i };
|
|
1187
1171
|
}
|
|
1188
1172
|
_remainDrawingSize(r, e, n) {
|
|
1189
1173
|
const t = N({ ...r }, this._selectionRenderService);
|
|
@@ -1194,92 +1178,92 @@ let De = class extends ge {
|
|
|
1194
1178
|
}
|
|
1195
1179
|
// eslint-disable-next-line max-lines-per-function
|
|
1196
1180
|
_getDrawingUndoForColVisible(r, e, n) {
|
|
1197
|
-
const t = this._drawingManagerService.getDrawingData(r, e),
|
|
1198
|
-
if (Object.keys(t).forEach((
|
|
1199
|
-
const
|
|
1200
|
-
if (f ===
|
|
1201
|
-
this._remainDrawingSize(
|
|
1181
|
+
const t = this._drawingManagerService.getDrawingData(r, e), i = [], s = [];
|
|
1182
|
+
if (Object.keys(t).forEach((l) => {
|
|
1183
|
+
const d = t[l], { sheetTransform: m, transform: u, anchorType: f = b.Position } = d;
|
|
1184
|
+
if (f === b.None)
|
|
1185
|
+
this._remainDrawingSize(u, i, d);
|
|
1202
1186
|
else {
|
|
1203
|
-
const { from:
|
|
1204
|
-
for (let
|
|
1205
|
-
const M = n[
|
|
1187
|
+
const { from: h, to: p } = m, { row: S, column: C } = h, { row: v, column: R } = p;
|
|
1188
|
+
for (let _ = 0; _ < n.length; _++) {
|
|
1189
|
+
const M = n[_], { startRow: w, endRow: y, startColumn: D, endColumn: T } = M;
|
|
1206
1190
|
if (R < D)
|
|
1207
1191
|
continue;
|
|
1208
|
-
if (f ===
|
|
1209
|
-
let
|
|
1210
|
-
if (C >= D && C <=
|
|
1211
|
-
const
|
|
1212
|
-
if (
|
|
1192
|
+
if (f === b.Position) {
|
|
1193
|
+
let I = null, A = null;
|
|
1194
|
+
if (C >= D && C <= T) {
|
|
1195
|
+
const z = this._selectionRenderService.attachRangeWithCoord({ startColumn: C, endColumn: T, startRow: h.row, endRow: p.row });
|
|
1196
|
+
if (z == null)
|
|
1213
1197
|
return;
|
|
1214
|
-
A = { ...
|
|
1198
|
+
A = { ...u, left: z.startX };
|
|
1215
1199
|
}
|
|
1216
|
-
if (A != null && (
|
|
1217
|
-
|
|
1200
|
+
if (A != null && (I = N(A, this._selectionRenderService), I != null && A != null)) {
|
|
1201
|
+
i.push({ ...d, sheetTransform: I, transform: A });
|
|
1218
1202
|
break;
|
|
1219
1203
|
}
|
|
1220
|
-
this._remainDrawingSize(
|
|
1204
|
+
this._remainDrawingSize(u, i, d);
|
|
1221
1205
|
continue;
|
|
1222
1206
|
}
|
|
1223
|
-
if (C >= D && R <=
|
|
1207
|
+
if (C >= D && R <= T)
|
|
1224
1208
|
continue;
|
|
1225
|
-
let U = null,
|
|
1226
|
-
if (C >= D && C <=
|
|
1227
|
-
const
|
|
1228
|
-
if (
|
|
1209
|
+
let U = null, E = null;
|
|
1210
|
+
if (C >= D && C <= T) {
|
|
1211
|
+
const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: C, endColumn: T, startRow: h.row, endRow: p.row });
|
|
1212
|
+
if (I == null)
|
|
1229
1213
|
return;
|
|
1230
|
-
|
|
1231
|
-
...
|
|
1232
|
-
left: (
|
|
1233
|
-
width: ((
|
|
1214
|
+
E = {
|
|
1215
|
+
...u,
|
|
1216
|
+
left: (I == null ? void 0 : I.startX) || 0,
|
|
1217
|
+
width: ((u == null ? void 0 : u.width) || 0) - I.endX + I.startX
|
|
1234
1218
|
};
|
|
1235
|
-
} else if (R >= D && R <=
|
|
1236
|
-
const
|
|
1237
|
-
if (
|
|
1219
|
+
} else if (R >= D && R <= T) {
|
|
1220
|
+
const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: D, endColumn: R, startRow: h.row, endRow: p.row });
|
|
1221
|
+
if (I == null)
|
|
1238
1222
|
return;
|
|
1239
|
-
|
|
1240
|
-
...
|
|
1241
|
-
left:
|
|
1223
|
+
E = {
|
|
1224
|
+
...u,
|
|
1225
|
+
left: I.startX - ((u == null ? void 0 : u.width) || 0)
|
|
1242
1226
|
};
|
|
1243
1227
|
} else {
|
|
1244
|
-
const
|
|
1245
|
-
if (
|
|
1228
|
+
const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: D, endColumn: T, startRow: h.row, endRow: p.row });
|
|
1229
|
+
if (I == null)
|
|
1246
1230
|
return;
|
|
1247
|
-
if (
|
|
1248
|
-
...
|
|
1249
|
-
width: ((
|
|
1250
|
-
}, U = N(
|
|
1251
|
-
|
|
1231
|
+
if (E = {
|
|
1232
|
+
...u,
|
|
1233
|
+
width: ((u == null ? void 0 : u.width) || 0) - I.endX + I.startX
|
|
1234
|
+
}, U = N(E, this._selectionRenderService), U != null && E != null) {
|
|
1235
|
+
s.push({ ...d, sheetTransform: U, transform: E });
|
|
1252
1236
|
break;
|
|
1253
1237
|
}
|
|
1254
1238
|
}
|
|
1255
|
-
if (
|
|
1256
|
-
|
|
1239
|
+
if (E != null && (U = N(E, this._selectionRenderService)), E != null && U != null) {
|
|
1240
|
+
i.push({ ...d, sheetTransform: U, transform: E });
|
|
1257
1241
|
break;
|
|
1258
1242
|
} else
|
|
1259
|
-
this._remainDrawingSize(
|
|
1243
|
+
this._remainDrawingSize(u, i, d);
|
|
1260
1244
|
}
|
|
1261
1245
|
}
|
|
1262
|
-
}),
|
|
1246
|
+
}), i.length === 0 && s.length === 0)
|
|
1263
1247
|
return { redos: [], undos: [] };
|
|
1264
|
-
const { redos:
|
|
1265
|
-
if (
|
|
1266
|
-
const { redos:
|
|
1267
|
-
c.push(...
|
|
1248
|
+
const { redos: o, undos: a } = this._createUndoAndRedoMutation(r, e, i), c = [], g = [];
|
|
1249
|
+
if (s.length > 0) {
|
|
1250
|
+
const { redos: l, undos: d } = this._createUndoAndRedoMutation(r, e, s);
|
|
1251
|
+
c.push(...l), g.push(...d);
|
|
1268
1252
|
}
|
|
1269
1253
|
return {
|
|
1270
|
-
redos:
|
|
1254
|
+
redos: o,
|
|
1271
1255
|
undos: a,
|
|
1272
1256
|
preRedos: c,
|
|
1273
|
-
preUndos:
|
|
1257
|
+
preUndos: g
|
|
1274
1258
|
};
|
|
1275
1259
|
}
|
|
1276
1260
|
_createUndoAndRedoMutation(r, e, n) {
|
|
1277
|
-
const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo:
|
|
1278
|
-
{ id:
|
|
1279
|
-
{ id:
|
|
1261
|
+
const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: i, redo: s, objects: o } = t, a = [
|
|
1262
|
+
{ id: O.id, params: { unitId: r, subUnitId: e, op: s, objects: o, type: P.UPDATE } },
|
|
1263
|
+
{ id: j.id, params: [r] }
|
|
1280
1264
|
], c = [
|
|
1281
|
-
{ id:
|
|
1282
|
-
{ id:
|
|
1265
|
+
{ id: O.id, params: { unitId: r, subUnitId: e, op: i, objects: o, type: P.UPDATE } },
|
|
1266
|
+
{ id: j.id, params: [r] }
|
|
1283
1267
|
];
|
|
1284
1268
|
return {
|
|
1285
1269
|
redos: a,
|
|
@@ -1288,122 +1272,122 @@ let De = class extends ge {
|
|
|
1288
1272
|
}
|
|
1289
1273
|
// eslint-disable-next-line max-lines-per-function
|
|
1290
1274
|
_getDrawingUndoForRowVisible(r, e, n) {
|
|
1291
|
-
const t = this._drawingManagerService.getDrawingData(r, e),
|
|
1292
|
-
if (Object.keys(t).forEach((
|
|
1293
|
-
const
|
|
1294
|
-
if (f ===
|
|
1295
|
-
this._remainDrawingSize(
|
|
1275
|
+
const t = this._drawingManagerService.getDrawingData(r, e), i = [], s = [];
|
|
1276
|
+
if (Object.keys(t).forEach((l) => {
|
|
1277
|
+
const d = t[l], { sheetTransform: m, transform: u, anchorType: f = b.Position } = d;
|
|
1278
|
+
if (f === b.None)
|
|
1279
|
+
this._remainDrawingSize(u, i, d);
|
|
1296
1280
|
else {
|
|
1297
|
-
const { from:
|
|
1298
|
-
for (let
|
|
1299
|
-
const M = n[
|
|
1300
|
-
if (v <
|
|
1281
|
+
const { from: h, to: p } = m, { row: S, column: C } = h, { row: v, column: R } = p;
|
|
1282
|
+
for (let _ = 0; _ < n.length; _++) {
|
|
1283
|
+
const M = n[_], { startRow: w, endRow: y, startColumn: D, endColumn: T } = M;
|
|
1284
|
+
if (v < w)
|
|
1301
1285
|
continue;
|
|
1302
|
-
if (f ===
|
|
1303
|
-
let
|
|
1304
|
-
if (
|
|
1305
|
-
const
|
|
1306
|
-
if (
|
|
1286
|
+
if (f === b.Position) {
|
|
1287
|
+
let I = null, A = null;
|
|
1288
|
+
if (S >= w && S <= y) {
|
|
1289
|
+
const z = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: S, endRow: y });
|
|
1290
|
+
if (z == null)
|
|
1307
1291
|
return;
|
|
1308
|
-
A = { ...
|
|
1292
|
+
A = { ...u, top: z.startY };
|
|
1309
1293
|
}
|
|
1310
|
-
if (A != null && (
|
|
1311
|
-
|
|
1294
|
+
if (A != null && (I = N(A, this._selectionRenderService), I != null && A != null)) {
|
|
1295
|
+
i.push({ ...d, sheetTransform: I, transform: A });
|
|
1312
1296
|
break;
|
|
1313
1297
|
}
|
|
1314
|
-
this._remainDrawingSize(
|
|
1298
|
+
this._remainDrawingSize(u, i, d);
|
|
1315
1299
|
continue;
|
|
1316
1300
|
}
|
|
1317
|
-
if (
|
|
1301
|
+
if (S >= w && v <= y)
|
|
1318
1302
|
continue;
|
|
1319
|
-
let U = null,
|
|
1320
|
-
if (
|
|
1321
|
-
const
|
|
1322
|
-
if (
|
|
1303
|
+
let U = null, E = null;
|
|
1304
|
+
if (S >= w && S <= y) {
|
|
1305
|
+
const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: S, endRow: y });
|
|
1306
|
+
if (I == null)
|
|
1323
1307
|
return;
|
|
1324
|
-
|
|
1325
|
-
...
|
|
1326
|
-
top: (
|
|
1327
|
-
height: ((
|
|
1308
|
+
E = {
|
|
1309
|
+
...u,
|
|
1310
|
+
top: (I == null ? void 0 : I.startY) || 0,
|
|
1311
|
+
height: ((u == null ? void 0 : u.height) || 0) - I.endY + I.startY
|
|
1328
1312
|
};
|
|
1329
|
-
} else if (v >=
|
|
1330
|
-
const
|
|
1331
|
-
if (
|
|
1313
|
+
} else if (v >= w && v <= y) {
|
|
1314
|
+
const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: w, endRow: v });
|
|
1315
|
+
if (I == null)
|
|
1332
1316
|
return;
|
|
1333
|
-
|
|
1334
|
-
...
|
|
1335
|
-
top:
|
|
1317
|
+
E = {
|
|
1318
|
+
...u,
|
|
1319
|
+
top: I.startY - ((u == null ? void 0 : u.height) || 0)
|
|
1336
1320
|
};
|
|
1337
1321
|
} else {
|
|
1338
|
-
const
|
|
1339
|
-
if (
|
|
1322
|
+
const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: w, endRow: y });
|
|
1323
|
+
if (I == null)
|
|
1340
1324
|
return;
|
|
1341
|
-
if (
|
|
1342
|
-
...
|
|
1343
|
-
height: ((
|
|
1344
|
-
}, U = N(
|
|
1345
|
-
|
|
1325
|
+
if (E = {
|
|
1326
|
+
...u,
|
|
1327
|
+
height: ((u == null ? void 0 : u.height) || 0) - I.endY + I.startY
|
|
1328
|
+
}, U = N(E, this._selectionRenderService), U != null && E != null) {
|
|
1329
|
+
s.push({ ...d, sheetTransform: U, transform: E });
|
|
1346
1330
|
break;
|
|
1347
1331
|
}
|
|
1348
1332
|
}
|
|
1349
|
-
if (
|
|
1350
|
-
|
|
1333
|
+
if (E != null && (U = N(E, this._selectionRenderService)), E != null && U != null) {
|
|
1334
|
+
i.push({ ...d, sheetTransform: U, transform: E });
|
|
1351
1335
|
break;
|
|
1352
1336
|
} else
|
|
1353
|
-
this._remainDrawingSize(
|
|
1337
|
+
this._remainDrawingSize(u, i, d);
|
|
1354
1338
|
}
|
|
1355
1339
|
}
|
|
1356
|
-
}),
|
|
1340
|
+
}), i.length === 0 && s.length === 0)
|
|
1357
1341
|
return { redos: [], undos: [] };
|
|
1358
|
-
const { redos:
|
|
1359
|
-
if (
|
|
1360
|
-
const { redos:
|
|
1361
|
-
c.push(...
|
|
1342
|
+
const { redos: o, undos: a } = this._createUndoAndRedoMutation(r, e, i), c = [], g = [];
|
|
1343
|
+
if (s.length > 0) {
|
|
1344
|
+
const { redos: l, undos: d } = this._createUndoAndRedoMutation(r, e, s);
|
|
1345
|
+
c.push(...l), g.push(...d);
|
|
1362
1346
|
}
|
|
1363
1347
|
return {
|
|
1364
|
-
redos:
|
|
1348
|
+
redos: o,
|
|
1365
1349
|
undos: a,
|
|
1366
1350
|
preRedos: c,
|
|
1367
|
-
preUndos:
|
|
1351
|
+
preUndos: g
|
|
1368
1352
|
};
|
|
1369
1353
|
}
|
|
1370
1354
|
_getDrawingUndoForRowAndColSize(r, e, n, t) {
|
|
1371
|
-
const
|
|
1372
|
-
return Object.keys(
|
|
1373
|
-
const a = o
|
|
1374
|
-
if (
|
|
1375
|
-
this._remainDrawingSize(
|
|
1355
|
+
const i = this._drawingManagerService.getDrawingData(r, e), s = [];
|
|
1356
|
+
return Object.keys(i).forEach((o) => {
|
|
1357
|
+
const a = i[o], { sheetTransform: c, transform: g, anchorType: l = b.Position } = a;
|
|
1358
|
+
if (l === b.None)
|
|
1359
|
+
this._remainDrawingSize(g, s, a);
|
|
1376
1360
|
else {
|
|
1377
|
-
const { from:
|
|
1378
|
-
for (let
|
|
1379
|
-
const C = n[
|
|
1380
|
-
if (
|
|
1361
|
+
const { from: d, to: m } = c, { row: u, column: f } = d, { row: h, column: p } = m;
|
|
1362
|
+
for (let S = 0; S < n.length; S++) {
|
|
1363
|
+
const C = n[S], { startRow: v, endRow: R, startColumn: _, endColumn: M } = C;
|
|
1364
|
+
if (h < v || p < _)
|
|
1381
1365
|
continue;
|
|
1382
|
-
if (
|
|
1383
|
-
this._remainDrawingSize(
|
|
1366
|
+
if (l === b.Position && (u <= v && h >= R || f <= _ && p >= M)) {
|
|
1367
|
+
this._remainDrawingSize(g, s, a);
|
|
1384
1368
|
continue;
|
|
1385
1369
|
}
|
|
1386
|
-
const
|
|
1387
|
-
if (
|
|
1388
|
-
|
|
1370
|
+
const w = V({ ...c }, this._selectionRenderService);
|
|
1371
|
+
if (w != null) {
|
|
1372
|
+
s.push({
|
|
1389
1373
|
...a,
|
|
1390
|
-
transform:
|
|
1374
|
+
transform: w
|
|
1391
1375
|
});
|
|
1392
1376
|
break;
|
|
1393
1377
|
}
|
|
1394
1378
|
}
|
|
1395
1379
|
}
|
|
1396
|
-
}),
|
|
1380
|
+
}), s.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(r, e, s);
|
|
1397
1381
|
}
|
|
1398
1382
|
_getUnitIdAndSubUnitId(r, e) {
|
|
1399
1383
|
let n, t;
|
|
1400
1384
|
if (e === "insert")
|
|
1401
1385
|
n = r.unitId, t = r.subUnitId;
|
|
1402
1386
|
else {
|
|
1403
|
-
const
|
|
1404
|
-
if (
|
|
1387
|
+
const i = se(this._univerInstanceService);
|
|
1388
|
+
if (i == null)
|
|
1405
1389
|
return;
|
|
1406
|
-
n =
|
|
1390
|
+
n = i.unitId, t = i.subUnitId;
|
|
1407
1391
|
}
|
|
1408
1392
|
return { unitId: n, subUnitId: t };
|
|
1409
1393
|
}
|
|
@@ -1411,132 +1395,132 @@ let De = class extends ge {
|
|
|
1411
1395
|
const n = this._getUnitIdAndSubUnitId(r, e);
|
|
1412
1396
|
if (n == null)
|
|
1413
1397
|
return { redos: [], undos: [] };
|
|
1414
|
-
const { unitId: t, subUnitId:
|
|
1415
|
-
if (Object.keys(
|
|
1416
|
-
const f =
|
|
1417
|
-
if (
|
|
1398
|
+
const { unitId: t, subUnitId: i } = n, { range: s } = r, o = s.startRow, a = s.endRow, c = [], g = [], l = this._sheetDrawingService.getDrawingData(t, i), d = [], m = [];
|
|
1399
|
+
if (Object.keys(l).forEach((u) => {
|
|
1400
|
+
const f = l[u], { sheetTransform: h, transform: p, anchorType: S = b.Position } = f;
|
|
1401
|
+
if (h == null || p == null)
|
|
1418
1402
|
return;
|
|
1419
1403
|
let C, v;
|
|
1420
1404
|
if (e === "insert") {
|
|
1421
|
-
const
|
|
1422
|
-
C =
|
|
1405
|
+
const _ = this._expandRow(h, p, o, a, S);
|
|
1406
|
+
C = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
|
|
1423
1407
|
} else {
|
|
1424
|
-
const { from:
|
|
1425
|
-
if (
|
|
1426
|
-
|
|
1408
|
+
const { from: _, to: M } = h, { row: w } = _, { row: y } = M;
|
|
1409
|
+
if (w >= o && y <= a)
|
|
1410
|
+
m.push({ unitId: t, subUnitId: i, drawingId: u });
|
|
1427
1411
|
else {
|
|
1428
|
-
const D = this._shrinkRow(
|
|
1412
|
+
const D = this._shrinkRow(h, p, o, a, S);
|
|
1429
1413
|
C = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
|
|
1430
1414
|
}
|
|
1431
1415
|
}
|
|
1432
1416
|
if (!C || !v)
|
|
1433
1417
|
return;
|
|
1434
|
-
const R = { unitId: t, subUnitId:
|
|
1435
|
-
|
|
1436
|
-
}),
|
|
1418
|
+
const R = { unitId: t, subUnitId: i, drawingId: u, transform: v, sheetTransform: C };
|
|
1419
|
+
d.push(R);
|
|
1420
|
+
}), d.length === 0 && m.length === 0)
|
|
1437
1421
|
return { redos: [], undos: [] };
|
|
1438
|
-
if (
|
|
1439
|
-
const
|
|
1440
|
-
c.push({ id:
|
|
1422
|
+
if (d.length > 0) {
|
|
1423
|
+
const u = this._sheetDrawingService.getBatchUpdateOp(d), { undo: f, redo: h, objects: p } = u;
|
|
1424
|
+
c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.UPDATE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.UPDATE } });
|
|
1441
1425
|
}
|
|
1442
|
-
if (
|
|
1443
|
-
const
|
|
1444
|
-
c.push({ id:
|
|
1426
|
+
if (m.length > 0) {
|
|
1427
|
+
const u = this._sheetDrawingService.getBatchRemoveOp(m), f = u.undo, h = u.redo, p = u.objects;
|
|
1428
|
+
c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.REMOVE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.INSERT } });
|
|
1445
1429
|
}
|
|
1446
|
-
return c.push({ id:
|
|
1430
|
+
return c.push({ id: j.id, params: [t] }), g.push({ id: j.id, params: [t] }), {
|
|
1447
1431
|
redos: c,
|
|
1448
|
-
undos:
|
|
1432
|
+
undos: g
|
|
1449
1433
|
};
|
|
1450
1434
|
}
|
|
1451
1435
|
_moveColInterceptor(r, e) {
|
|
1452
1436
|
const n = this._getUnitIdAndSubUnitId(r, e);
|
|
1453
1437
|
if (n == null)
|
|
1454
1438
|
return { redos: [], undos: [] };
|
|
1455
|
-
const { unitId: t, subUnitId:
|
|
1456
|
-
if (Object.keys(
|
|
1457
|
-
const f =
|
|
1458
|
-
if (
|
|
1439
|
+
const { unitId: t, subUnitId: i } = n, { range: s } = r, o = s.startColumn, a = s.endColumn, c = [], g = [], l = this._sheetDrawingService.getDrawingData(t, i), d = [], m = [];
|
|
1440
|
+
if (Object.keys(l).forEach((u) => {
|
|
1441
|
+
const f = l[u], { sheetTransform: h, transform: p, anchorType: S = b.Position } = f;
|
|
1442
|
+
if (h == null || p == null)
|
|
1459
1443
|
return;
|
|
1460
1444
|
let C, v;
|
|
1461
1445
|
if (e === "insert") {
|
|
1462
|
-
const
|
|
1463
|
-
C =
|
|
1446
|
+
const _ = this._expandCol(h, p, o, a, S);
|
|
1447
|
+
C = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
|
|
1464
1448
|
} else {
|
|
1465
|
-
const { from:
|
|
1466
|
-
if (
|
|
1467
|
-
|
|
1449
|
+
const { from: _, to: M } = h, { column: w } = _, { column: y } = M;
|
|
1450
|
+
if (w >= o && y <= a)
|
|
1451
|
+
m.push({ unitId: t, subUnitId: i, drawingId: u });
|
|
1468
1452
|
else {
|
|
1469
|
-
const D = this._shrinkCol(
|
|
1453
|
+
const D = this._shrinkCol(h, p, o, a, S);
|
|
1470
1454
|
C = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
|
|
1471
1455
|
}
|
|
1472
1456
|
}
|
|
1473
1457
|
if (!C || !v)
|
|
1474
1458
|
return;
|
|
1475
|
-
const R = { unitId: t, subUnitId:
|
|
1476
|
-
|
|
1477
|
-
}),
|
|
1459
|
+
const R = { unitId: t, subUnitId: i, drawingId: u, transform: v, sheetTransform: C };
|
|
1460
|
+
d.push(R);
|
|
1461
|
+
}), d.length === 0 && m.length === 0)
|
|
1478
1462
|
return { redos: [], undos: [] };
|
|
1479
|
-
if (
|
|
1480
|
-
const
|
|
1481
|
-
c.push({ id:
|
|
1463
|
+
if (d.length > 0) {
|
|
1464
|
+
const u = this._sheetDrawingService.getBatchUpdateOp(d), { undo: f, redo: h, objects: p } = u;
|
|
1465
|
+
c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.UPDATE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.UPDATE } });
|
|
1482
1466
|
}
|
|
1483
|
-
if (
|
|
1484
|
-
const
|
|
1485
|
-
c.push({ id:
|
|
1467
|
+
if (m.length > 0) {
|
|
1468
|
+
const u = this._sheetDrawingService.getBatchRemoveOp(m), f = u.undo, h = u.redo, p = u.objects;
|
|
1469
|
+
c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.REMOVE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.INSERT } });
|
|
1486
1470
|
}
|
|
1487
|
-
return c.push({ id:
|
|
1471
|
+
return c.push({ id: j.id, params: [t] }), g.push({ id: j.id, params: [t] }), { redos: c, undos: g };
|
|
1488
1472
|
}
|
|
1489
|
-
_expandCol(r, e, n, t,
|
|
1490
|
-
const
|
|
1491
|
-
if (
|
|
1473
|
+
_expandCol(r, e, n, t, i = b.Position) {
|
|
1474
|
+
const s = t - n + 1, { from: o, to: a } = r, { column: c } = o, { column: g } = a;
|
|
1475
|
+
if (i === b.None)
|
|
1492
1476
|
return {
|
|
1493
1477
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1494
1478
|
newTransform: e
|
|
1495
1479
|
};
|
|
1496
|
-
let
|
|
1480
|
+
let l = null, d = null;
|
|
1497
1481
|
if (c >= n) {
|
|
1498
|
-
const
|
|
1499
|
-
if (
|
|
1482
|
+
const m = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: a.row });
|
|
1483
|
+
if (m == null)
|
|
1500
1484
|
return;
|
|
1501
|
-
|
|
1502
|
-
} else if (
|
|
1503
|
-
if (
|
|
1504
|
-
|
|
1505
|
-
from: { ...
|
|
1506
|
-
to: { ...a, column:
|
|
1507
|
-
},
|
|
1485
|
+
d = { ...e, left: (e.left || 0) + m.endX - m.startX }, l = N(d, this._selectionRenderService);
|
|
1486
|
+
} else if (g >= t)
|
|
1487
|
+
if (i === b.Both)
|
|
1488
|
+
l = {
|
|
1489
|
+
from: { ...o },
|
|
1490
|
+
to: { ...a, column: g + s }
|
|
1491
|
+
}, d = V(l, this._selectionRenderService);
|
|
1508
1492
|
else
|
|
1509
1493
|
return {
|
|
1510
1494
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1511
1495
|
newTransform: e
|
|
1512
1496
|
};
|
|
1513
|
-
return
|
|
1514
|
-
newSheetTransform:
|
|
1515
|
-
newTransform:
|
|
1497
|
+
return l != null && d != null ? {
|
|
1498
|
+
newSheetTransform: l,
|
|
1499
|
+
newTransform: d
|
|
1516
1500
|
} : null;
|
|
1517
1501
|
}
|
|
1518
|
-
_shrinkCol(r, e, n, t,
|
|
1519
|
-
const
|
|
1520
|
-
if (
|
|
1502
|
+
_shrinkCol(r, e, n, t, i = b.Position) {
|
|
1503
|
+
const s = t - n + 1, { from: o, to: a } = r, { column: c } = o, { column: g } = a;
|
|
1504
|
+
if (i === b.None)
|
|
1521
1505
|
return {
|
|
1522
1506
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1523
1507
|
newTransform: e
|
|
1524
1508
|
};
|
|
1525
|
-
let
|
|
1509
|
+
let l = null, d = null;
|
|
1526
1510
|
if (c > t)
|
|
1527
|
-
|
|
1528
|
-
from: { ...
|
|
1529
|
-
to: { ...a, column:
|
|
1530
|
-
},
|
|
1511
|
+
l = {
|
|
1512
|
+
from: { ...o, column: c - s },
|
|
1513
|
+
to: { ...a, column: g - s }
|
|
1514
|
+
}, d = V(l, this._selectionRenderService);
|
|
1531
1515
|
else {
|
|
1532
|
-
if (c >= n &&
|
|
1516
|
+
if (c >= n && g <= t)
|
|
1533
1517
|
return null;
|
|
1534
|
-
if (c < n &&
|
|
1535
|
-
if (
|
|
1536
|
-
|
|
1537
|
-
from: { ...
|
|
1538
|
-
to: { ...a, column:
|
|
1539
|
-
},
|
|
1518
|
+
if (c < n && g > t)
|
|
1519
|
+
if (i === b.Both)
|
|
1520
|
+
l = {
|
|
1521
|
+
from: { ...o },
|
|
1522
|
+
to: { ...a, column: g - s }
|
|
1523
|
+
}, d = V(l, this._selectionRenderService);
|
|
1540
1524
|
else
|
|
1541
1525
|
return {
|
|
1542
1526
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
@@ -1544,88 +1528,88 @@ let De = class extends ge {
|
|
|
1544
1528
|
};
|
|
1545
1529
|
else if (c >= n && c <= t) {
|
|
1546
1530
|
if (c === n)
|
|
1547
|
-
|
|
1531
|
+
d = { ...e, left: (e.left || 0) - r.from.columnOffset };
|
|
1548
1532
|
else {
|
|
1549
|
-
const
|
|
1550
|
-
if (
|
|
1533
|
+
const m = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: c - 1, startRow: o.row, endRow: a.row });
|
|
1534
|
+
if (m == null)
|
|
1551
1535
|
return;
|
|
1552
|
-
|
|
1536
|
+
d = { ...e, left: (e.left || 0) - m.endX + m.startX - r.from.columnOffset };
|
|
1553
1537
|
}
|
|
1554
|
-
|
|
1555
|
-
} else if (
|
|
1556
|
-
const
|
|
1538
|
+
l = N(d, this._selectionRenderService);
|
|
1539
|
+
} else if (g >= n && g <= t && i === b.Both) {
|
|
1540
|
+
const m = this._selectionRenderService.attachRangeWithCoord({
|
|
1557
1541
|
startColumn: n - 1,
|
|
1558
1542
|
endColumn: n - 1,
|
|
1559
|
-
startRow:
|
|
1543
|
+
startRow: o.row,
|
|
1560
1544
|
endRow: a.row
|
|
1561
1545
|
});
|
|
1562
|
-
if (
|
|
1546
|
+
if (m == null)
|
|
1563
1547
|
return;
|
|
1564
|
-
|
|
1565
|
-
from: { ...
|
|
1566
|
-
to: { ...a, column: n - 1, columnOffset:
|
|
1567
|
-
},
|
|
1548
|
+
l = {
|
|
1549
|
+
from: { ...o },
|
|
1550
|
+
to: { ...a, column: n - 1, columnOffset: m.endX - m.startX }
|
|
1551
|
+
}, d = V(l, this._selectionRenderService);
|
|
1568
1552
|
}
|
|
1569
1553
|
}
|
|
1570
|
-
return
|
|
1571
|
-
newSheetTransform:
|
|
1572
|
-
newTransform:
|
|
1554
|
+
return l != null && d != null ? {
|
|
1555
|
+
newSheetTransform: l,
|
|
1556
|
+
newTransform: d
|
|
1573
1557
|
} : null;
|
|
1574
1558
|
}
|
|
1575
|
-
_expandRow(r, e, n, t,
|
|
1576
|
-
const
|
|
1577
|
-
if (
|
|
1559
|
+
_expandRow(r, e, n, t, i = b.Position) {
|
|
1560
|
+
const s = t - n + 1, { from: o, to: a } = r, { row: c } = o, { row: g } = a;
|
|
1561
|
+
if (i === b.None)
|
|
1578
1562
|
return {
|
|
1579
1563
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1580
1564
|
newTransform: e
|
|
1581
1565
|
};
|
|
1582
|
-
let
|
|
1566
|
+
let l = null, d = null;
|
|
1583
1567
|
if (c >= n) {
|
|
1584
|
-
const
|
|
1585
|
-
if (
|
|
1568
|
+
const m = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: a.column });
|
|
1569
|
+
if (m == null)
|
|
1586
1570
|
return;
|
|
1587
|
-
|
|
1588
|
-
} else if (
|
|
1589
|
-
if (
|
|
1590
|
-
|
|
1591
|
-
from: { ...
|
|
1571
|
+
d = { ...e, top: (e.top || 0) + m.endY - m.startY }, l = N(d, this._selectionRenderService);
|
|
1572
|
+
} else if (g >= t)
|
|
1573
|
+
if (i === b.Both)
|
|
1574
|
+
l = {
|
|
1575
|
+
from: { ...o },
|
|
1592
1576
|
to: {
|
|
1593
1577
|
...a,
|
|
1594
|
-
row:
|
|
1578
|
+
row: g + s
|
|
1595
1579
|
}
|
|
1596
|
-
},
|
|
1580
|
+
}, d = V(l, this._selectionRenderService);
|
|
1597
1581
|
else
|
|
1598
1582
|
return {
|
|
1599
1583
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1600
1584
|
newTransform: e
|
|
1601
1585
|
};
|
|
1602
|
-
return
|
|
1603
|
-
newSheetTransform:
|
|
1604
|
-
newTransform:
|
|
1586
|
+
return l != null && d != null ? {
|
|
1587
|
+
newSheetTransform: l,
|
|
1588
|
+
newTransform: d
|
|
1605
1589
|
} : null;
|
|
1606
1590
|
}
|
|
1607
|
-
_shrinkRow(r, e, n, t,
|
|
1608
|
-
const
|
|
1609
|
-
if (
|
|
1591
|
+
_shrinkRow(r, e, n, t, i = b.Position) {
|
|
1592
|
+
const s = t - n + 1, { from: o, to: a } = r, { row: c } = o, { row: g } = a;
|
|
1593
|
+
if (i === b.None)
|
|
1610
1594
|
return {
|
|
1611
1595
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
1612
1596
|
newTransform: e
|
|
1613
1597
|
};
|
|
1614
|
-
let
|
|
1598
|
+
let l = null, d = null;
|
|
1615
1599
|
if (c > t)
|
|
1616
|
-
|
|
1617
|
-
from: { ...
|
|
1618
|
-
to: { ...a, row:
|
|
1619
|
-
},
|
|
1600
|
+
l = {
|
|
1601
|
+
from: { ...o, row: c - s },
|
|
1602
|
+
to: { ...a, row: g - s }
|
|
1603
|
+
}, d = V(l, this._selectionRenderService);
|
|
1620
1604
|
else {
|
|
1621
|
-
if (c >= n &&
|
|
1605
|
+
if (c >= n && g <= t)
|
|
1622
1606
|
return null;
|
|
1623
|
-
if (c < n &&
|
|
1624
|
-
if (
|
|
1625
|
-
|
|
1626
|
-
from: { ...
|
|
1627
|
-
to: { ...a, row:
|
|
1628
|
-
},
|
|
1607
|
+
if (c < n && g > t)
|
|
1608
|
+
if (i === b.Both)
|
|
1609
|
+
l = {
|
|
1610
|
+
from: { ...o },
|
|
1611
|
+
to: { ...a, row: g - s }
|
|
1612
|
+
}, d = V(l, this._selectionRenderService);
|
|
1629
1613
|
else
|
|
1630
1614
|
return {
|
|
1631
1615
|
newSheetTransform: N({ ...e }, this._selectionRenderService),
|
|
@@ -1633,43 +1617,43 @@ let De = class extends ge {
|
|
|
1633
1617
|
};
|
|
1634
1618
|
else if (c >= n && c <= t) {
|
|
1635
1619
|
if (c === n)
|
|
1636
|
-
|
|
1620
|
+
d = { ...e, top: (e.top || 0) - r.from.rowOffset };
|
|
1637
1621
|
else {
|
|
1638
|
-
const
|
|
1639
|
-
if (
|
|
1622
|
+
const m = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: c - 1, startColumn: o.column, endColumn: a.column });
|
|
1623
|
+
if (m == null)
|
|
1640
1624
|
return;
|
|
1641
|
-
|
|
1625
|
+
d = { ...e, top: (e.top || 0) - m.endY + m.startY - r.from.rowOffset };
|
|
1642
1626
|
}
|
|
1643
|
-
|
|
1644
|
-
} else if (
|
|
1645
|
-
const
|
|
1646
|
-
if (
|
|
1627
|
+
l = N(d, this._selectionRenderService);
|
|
1628
|
+
} else if (g >= n && g <= t && i === b.Both) {
|
|
1629
|
+
const m = this._selectionRenderService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
|
|
1630
|
+
if (m == null)
|
|
1647
1631
|
return;
|
|
1648
|
-
|
|
1649
|
-
from: { ...
|
|
1650
|
-
to: { ...a, row: n - 1, rowOffset:
|
|
1651
|
-
},
|
|
1632
|
+
l = {
|
|
1633
|
+
from: { ...o },
|
|
1634
|
+
to: { ...a, row: n - 1, rowOffset: m.endY - m.startY }
|
|
1635
|
+
}, d = V(l, this._selectionRenderService);
|
|
1652
1636
|
}
|
|
1653
1637
|
}
|
|
1654
|
-
return
|
|
1655
|
-
newSheetTransform:
|
|
1656
|
-
newTransform:
|
|
1638
|
+
return l != null && d != null ? {
|
|
1639
|
+
newSheetTransform: l,
|
|
1640
|
+
newTransform: d
|
|
1657
1641
|
} : null;
|
|
1658
1642
|
}
|
|
1659
1643
|
_commandListener() {
|
|
1660
1644
|
this.disposeWithMe(
|
|
1661
1645
|
this._commandService.onCommandExecuted((r) => {
|
|
1662
|
-
if (r.id ===
|
|
1663
|
-
const e = r.params, { unitId: n, subUnitId: t } = e,
|
|
1664
|
-
Object.keys(
|
|
1665
|
-
const c =
|
|
1666
|
-
Object.keys(c).forEach((
|
|
1667
|
-
const
|
|
1668
|
-
|
|
1669
|
-
a === n &&
|
|
1646
|
+
if (r.id === Zn.id) {
|
|
1647
|
+
const e = r.params, { unitId: n, subUnitId: t } = e, i = this._drawingManagerService.drawingManagerData, s = [], o = [];
|
|
1648
|
+
Object.keys(i).forEach((a) => {
|
|
1649
|
+
const c = i[a];
|
|
1650
|
+
Object.keys(c).forEach((g) => {
|
|
1651
|
+
const l = c[g].data;
|
|
1652
|
+
l != null && Object.keys(l).forEach((d) => {
|
|
1653
|
+
a === n && g === t ? s.push(l[d]) : o.push(l[d]);
|
|
1670
1654
|
});
|
|
1671
1655
|
});
|
|
1672
|
-
}), this._drawingManagerService.removeNotification(
|
|
1656
|
+
}), this._drawingManagerService.removeNotification(o), this._drawingManagerService.addNotification(s);
|
|
1673
1657
|
}
|
|
1674
1658
|
})
|
|
1675
1659
|
);
|
|
@@ -1677,128 +1661,128 @@ let De = class extends ge {
|
|
|
1677
1661
|
_sheetRefreshListener() {
|
|
1678
1662
|
this.disposeWithMe(
|
|
1679
1663
|
this._commandService.onCommandExecuted((r) => {
|
|
1680
|
-
|
|
1681
|
-
const e = r.params, { unitId: n, subUnitId: t, ranges:
|
|
1682
|
-
this._refreshDrawingTransform(n, t,
|
|
1664
|
+
ei.includes(r.id) && requestIdleCallback(() => {
|
|
1665
|
+
const e = r.params, { unitId: n, subUnitId: t, ranges: i } = e;
|
|
1666
|
+
this._refreshDrawingTransform(n, t, i);
|
|
1683
1667
|
});
|
|
1684
1668
|
})
|
|
1685
1669
|
);
|
|
1686
1670
|
}
|
|
1687
1671
|
_refreshDrawingTransform(r, e, n) {
|
|
1688
|
-
const t = this._drawingManagerService.getDrawingData(r, e),
|
|
1689
|
-
Object.keys(t).forEach((
|
|
1690
|
-
const
|
|
1691
|
-
if (c ===
|
|
1672
|
+
const t = this._drawingManagerService.getDrawingData(r, e), i = [];
|
|
1673
|
+
Object.keys(t).forEach((s) => {
|
|
1674
|
+
const o = t[s], { sheetTransform: a, anchorType: c = b.Position } = o;
|
|
1675
|
+
if (c === b.None)
|
|
1692
1676
|
return !0;
|
|
1693
|
-
const { from:
|
|
1694
|
-
for (let
|
|
1695
|
-
const
|
|
1696
|
-
if (
|
|
1677
|
+
const { from: g, to: l } = a, { row: d, column: m } = g, { row: u, column: f } = l;
|
|
1678
|
+
for (let h = 0; h < n.length; h++) {
|
|
1679
|
+
const p = n[h], { startRow: S, endRow: C, startColumn: v, endColumn: R } = p;
|
|
1680
|
+
if (tn.intersects(
|
|
1697
1681
|
{
|
|
1698
|
-
startRow:
|
|
1682
|
+
startRow: S,
|
|
1699
1683
|
endRow: C,
|
|
1700
1684
|
startColumn: v,
|
|
1701
1685
|
endColumn: R
|
|
1702
1686
|
},
|
|
1703
1687
|
{
|
|
1704
|
-
startRow:
|
|
1705
|
-
endRow:
|
|
1706
|
-
startColumn:
|
|
1688
|
+
startRow: d,
|
|
1689
|
+
endRow: u,
|
|
1690
|
+
startColumn: m,
|
|
1707
1691
|
endColumn: f
|
|
1708
1692
|
}
|
|
1709
|
-
) ||
|
|
1710
|
-
|
|
1711
|
-
...
|
|
1712
|
-
transform:
|
|
1693
|
+
) || d > C || m > R) {
|
|
1694
|
+
i.push({
|
|
1695
|
+
...o,
|
|
1696
|
+
transform: V(a, this._selectionRenderService)
|
|
1713
1697
|
});
|
|
1714
1698
|
break;
|
|
1715
1699
|
}
|
|
1716
1700
|
}
|
|
1717
|
-
}),
|
|
1701
|
+
}), i.length !== 0 && (this._drawingManagerService.refreshTransform(i), this._commandService.syncExecuteCommand(j.id, [r]));
|
|
1718
1702
|
}
|
|
1719
1703
|
};
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
],
|
|
1729
|
-
var
|
|
1730
|
-
for (var
|
|
1731
|
-
(
|
|
1732
|
-
return t &&
|
|
1733
|
-
},
|
|
1734
|
-
function
|
|
1735
|
-
const { scaleX:
|
|
1704
|
+
ye = qr([
|
|
1705
|
+
de(le.Rendered, ye),
|
|
1706
|
+
re(0, B),
|
|
1707
|
+
re(1, $(qn)),
|
|
1708
|
+
re(2, X),
|
|
1709
|
+
re(3, H),
|
|
1710
|
+
re(4, $e),
|
|
1711
|
+
re(5, ce)
|
|
1712
|
+
], ye);
|
|
1713
|
+
var ti = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, ri = (r, e, n, t) => {
|
|
1714
|
+
for (var i = t > 1 ? void 0 : t ? ni(e, n) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1715
|
+
(o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
|
|
1716
|
+
return t && i && ti(e, n, i), i;
|
|
1717
|
+
}, ee = (r, e) => (n, t) => e(n, t, r);
|
|
1718
|
+
function ii(r, e, n, t) {
|
|
1719
|
+
const { scaleX: i, scaleY: s } = e.getAncestorScale(), o = e.getViewport(Mn.VIEW_MAIN), a = {
|
|
1736
1720
|
left: !0,
|
|
1737
1721
|
top: !0
|
|
1738
1722
|
};
|
|
1739
|
-
if (!
|
|
1723
|
+
if (!o)
|
|
1740
1724
|
return {
|
|
1741
1725
|
...r,
|
|
1742
1726
|
absolute: a
|
|
1743
1727
|
};
|
|
1744
|
-
const { left: c, right:
|
|
1745
|
-
let U,
|
|
1746
|
-
c <
|
|
1728
|
+
const { left: c, right: g, top: l, bottom: d } = r, m = t.getFreeze(), { startColumn: u, startRow: f, xSplit: h, ySplit: p } = m, S = n.getNoMergeCellPositionByIndexWithNoHeader(f - p, u - h), C = n.getNoMergeCellPositionByIndexWithNoHeader(f, u), { rowHeaderWidth: v, columnHeaderHeight: R } = n, _ = C.startX - S.startX, M = C.startY - S.startY, { top: w, left: y, viewportScrollX: D, viewportScrollY: T } = o;
|
|
1729
|
+
let U, E;
|
|
1730
|
+
c < y ? (a.left = !0, U = (_ + v + (c - y)) * i, E = Math.max(
|
|
1747
1731
|
Math.min(
|
|
1748
|
-
(
|
|
1749
|
-
(
|
|
1732
|
+
(_ + v + (g - y)) * i,
|
|
1733
|
+
(_ + v) * i
|
|
1750
1734
|
),
|
|
1751
|
-
(
|
|
1752
|
-
)) : (a.left = !1, U = Math.max((c - D) *
|
|
1753
|
-
let
|
|
1754
|
-
return
|
|
1735
|
+
(g - D) * i
|
|
1736
|
+
)) : (a.left = !1, U = Math.max((c - D) * i, (_ + v) * i), E = Math.max((g - D) * i, (_ + v) * i));
|
|
1737
|
+
let I, A;
|
|
1738
|
+
return l < w ? (a.top = !0, I = (M + R + (l - w)) * s, A = Math.max(
|
|
1755
1739
|
Math.min(
|
|
1756
|
-
(M + R + (
|
|
1757
|
-
(M + R) *
|
|
1740
|
+
(M + R + (g - w)) * s,
|
|
1741
|
+
(M + R) * s
|
|
1758
1742
|
),
|
|
1759
|
-
(
|
|
1760
|
-
)) : (a.top = !1,
|
|
1743
|
+
(d - T) * s
|
|
1744
|
+
)) : (a.top = !1, I = Math.max((l - T) * s, (M + R) * s), A = Math.max((d - T) * s, (M + R) * s)), {
|
|
1761
1745
|
left: U,
|
|
1762
|
-
right:
|
|
1763
|
-
top:
|
|
1746
|
+
right: E,
|
|
1747
|
+
top: I,
|
|
1764
1748
|
bottom: A,
|
|
1765
1749
|
absolute: a
|
|
1766
1750
|
};
|
|
1767
1751
|
}
|
|
1768
|
-
const
|
|
1769
|
-
const { scene:
|
|
1770
|
-
left:
|
|
1771
|
-
right:
|
|
1772
|
-
top:
|
|
1773
|
-
bottom:
|
|
1774
|
-
},
|
|
1752
|
+
const Ye = (r, e, n, t) => {
|
|
1753
|
+
const { scene: i } = e, { left: s, top: o, width: a, height: c, angle: g } = r, l = {
|
|
1754
|
+
left: s,
|
|
1755
|
+
right: s + a,
|
|
1756
|
+
top: o,
|
|
1757
|
+
bottom: o + c
|
|
1758
|
+
}, d = ii(l, i, n, t);
|
|
1775
1759
|
return {
|
|
1776
|
-
startX:
|
|
1777
|
-
endX:
|
|
1778
|
-
startY:
|
|
1779
|
-
endY:
|
|
1780
|
-
rotate:
|
|
1760
|
+
startX: d.left,
|
|
1761
|
+
endX: d.right,
|
|
1762
|
+
startY: d.top,
|
|
1763
|
+
endY: d.bottom,
|
|
1764
|
+
rotate: g,
|
|
1781
1765
|
width: a,
|
|
1782
1766
|
height: c,
|
|
1783
|
-
absolute:
|
|
1767
|
+
absolute: d.absolute
|
|
1784
1768
|
};
|
|
1785
1769
|
};
|
|
1786
|
-
let
|
|
1787
|
-
constructor(e, n, t,
|
|
1770
|
+
let Je = class extends ue {
|
|
1771
|
+
constructor(e, n, t, i, s, o, a) {
|
|
1788
1772
|
super();
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService =
|
|
1773
|
+
K(this, "_domLayerMap", /* @__PURE__ */ new Map());
|
|
1774
|
+
K(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
|
|
1775
|
+
K(this, "_transformChange$", new ct());
|
|
1776
|
+
K(this, "transformChange$", this._transformChange$.asObservable());
|
|
1777
|
+
K(this, "_remove$", new ct());
|
|
1778
|
+
K(this, "remove$", this._remove$.asObservable());
|
|
1779
|
+
this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = i, this._selectionRenderService = s, this._canvasFloatDomService = o, this._sheetDrawingService = a, this._drawingAddListener(), this._scrollUpdateListener(), this._featureUpdateListener(), this._deleteListener();
|
|
1796
1780
|
}
|
|
1797
1781
|
_ensureMap(e, n) {
|
|
1798
1782
|
let t = this._domLayerMap.get(e);
|
|
1799
1783
|
t || (t = /* @__PURE__ */ new Map(), this._domLayerMap.set(e, t));
|
|
1800
|
-
let
|
|
1801
|
-
return
|
|
1784
|
+
let i = t.get(n);
|
|
1785
|
+
return i || (i = /* @__PURE__ */ new Map(), t.set(n, i)), i;
|
|
1802
1786
|
}
|
|
1803
1787
|
_getSceneAndTransformerByDrawingSearch(e) {
|
|
1804
1788
|
if (e == null)
|
|
@@ -1806,8 +1790,8 @@ let Fe = class extends ge {
|
|
|
1806
1790
|
const n = this._renderManagerService.getRenderById(e), t = n == null ? void 0 : n.scene;
|
|
1807
1791
|
if (n == null || t == null)
|
|
1808
1792
|
return null;
|
|
1809
|
-
const
|
|
1810
|
-
return { scene: t, transformer:
|
|
1793
|
+
const i = t.getTransformerByCreate(), s = n.engine.getCanvasElement();
|
|
1794
|
+
return { scene: t, transformer: i, renderObject: n, canvas: s };
|
|
1811
1795
|
}
|
|
1812
1796
|
// eslint-disable-next-line max-lines-per-function
|
|
1813
1797
|
_drawingAddListener() {
|
|
@@ -1815,119 +1799,119 @@ let Fe = class extends ge {
|
|
|
1815
1799
|
// eslint-disable-next-line max-lines-per-function
|
|
1816
1800
|
this._drawingManagerService.add$.subscribe((e) => {
|
|
1817
1801
|
e.forEach((n) => {
|
|
1818
|
-
var
|
|
1819
|
-
const { unitId: t, subUnitId:
|
|
1820
|
-
if (a == null ||
|
|
1802
|
+
var nt, rt;
|
|
1803
|
+
const { unitId: t, subUnitId: i, drawingId: s } = n, o = se(this._univerInstanceService, { unitId: t, subUnitId: i }), a = this._drawingManagerService.getDrawingByParam(n), c = (nt = this._renderManagerService.getRenderById(t)) == null ? void 0 : nt.with(Xe).getUnitSkeleton(t, i);
|
|
1804
|
+
if (a == null || o == null || c == null)
|
|
1821
1805
|
return;
|
|
1822
|
-
const { transform:
|
|
1823
|
-
if (
|
|
1806
|
+
const { transform: g, drawingType: l } = a;
|
|
1807
|
+
if (l !== Ve.DRAWING_DOM)
|
|
1824
1808
|
return;
|
|
1825
|
-
const
|
|
1826
|
-
if (
|
|
1809
|
+
const d = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1810
|
+
if (d == null)
|
|
1827
1811
|
return;
|
|
1828
|
-
const { scene:
|
|
1829
|
-
if (
|
|
1812
|
+
const { scene: m, canvas: u } = d;
|
|
1813
|
+
if (g == null)
|
|
1830
1814
|
return !0;
|
|
1831
|
-
const { left: f, top:
|
|
1832
|
-
if (
|
|
1833
|
-
|
|
1815
|
+
const { left: f, top: h, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: M } = g, w = vn({ unitId: t, subUnitId: i, drawingId: s }), y = m.getObject(w);
|
|
1816
|
+
if (y != null) {
|
|
1817
|
+
y.transformByState({ left: f, top: h, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: M });
|
|
1834
1818
|
return;
|
|
1835
1819
|
}
|
|
1836
1820
|
const D = {
|
|
1837
1821
|
left: f,
|
|
1838
|
-
top:
|
|
1839
|
-
width:
|
|
1840
|
-
height:
|
|
1841
|
-
zIndex: this._drawingManagerService.getDrawingOrder(t,
|
|
1842
|
-
},
|
|
1843
|
-
|
|
1844
|
-
const U = this._ensureMap(t,
|
|
1845
|
-
dispose:
|
|
1846
|
-
rect:
|
|
1822
|
+
top: h,
|
|
1823
|
+
width: p,
|
|
1824
|
+
height: S,
|
|
1825
|
+
zIndex: this._drawingManagerService.getDrawingOrder(t, i).length - 1
|
|
1826
|
+
}, T = new Rn(w, D);
|
|
1827
|
+
m.addObject(T, Dn).attachTransformerTo(T);
|
|
1828
|
+
const U = this._ensureMap(t, i), E = new nn(), I = Ye(T, d.renderObject, c.skeleton, o.worksheet), A = new Tn(I), z = {
|
|
1829
|
+
dispose: E,
|
|
1830
|
+
rect: T,
|
|
1847
1831
|
position$: A,
|
|
1848
1832
|
unitId: t,
|
|
1849
|
-
subUnitId:
|
|
1833
|
+
subUnitId: i
|
|
1850
1834
|
};
|
|
1851
1835
|
this._canvasFloatDomService.addFloatDom({
|
|
1852
1836
|
position$: A,
|
|
1853
|
-
id:
|
|
1837
|
+
id: s,
|
|
1854
1838
|
componentKey: a.componentKey,
|
|
1855
|
-
onPointerDown: (
|
|
1856
|
-
|
|
1839
|
+
onPointerDown: (W) => {
|
|
1840
|
+
u.dispatchEvent(new PointerEvent(W.type, W));
|
|
1857
1841
|
},
|
|
1858
|
-
onPointerMove: (
|
|
1859
|
-
|
|
1842
|
+
onPointerMove: (W) => {
|
|
1843
|
+
u.dispatchEvent(new PointerEvent(W.type, W));
|
|
1860
1844
|
},
|
|
1861
|
-
onPointerUp: (
|
|
1862
|
-
|
|
1845
|
+
onPointerUp: (W) => {
|
|
1846
|
+
u.dispatchEvent(new PointerEvent(W.type, W));
|
|
1863
1847
|
},
|
|
1864
|
-
onWheel: (
|
|
1865
|
-
|
|
1848
|
+
onWheel: (W) => {
|
|
1849
|
+
u.dispatchEvent(new WheelEvent(W.type, W));
|
|
1866
1850
|
},
|
|
1867
|
-
props: (
|
|
1851
|
+
props: (rt = U.get(s)) == null ? void 0 : rt.props
|
|
1868
1852
|
});
|
|
1869
|
-
const
|
|
1870
|
-
const
|
|
1853
|
+
const tt = T.onTransformChange$.subscribeEvent(() => {
|
|
1854
|
+
const W = Ye(T, d.renderObject, c.skeleton, o.worksheet);
|
|
1871
1855
|
A.next(
|
|
1872
|
-
|
|
1856
|
+
W
|
|
1873
1857
|
);
|
|
1874
1858
|
});
|
|
1875
|
-
|
|
1876
|
-
this._canvasFloatDomService.removeFloatDom(
|
|
1877
|
-
}),
|
|
1859
|
+
E.add(() => {
|
|
1860
|
+
this._canvasFloatDomService.removeFloatDom(s);
|
|
1861
|
+
}), tt && E.add(tt), this._domLayerInfoMap.set(s, z);
|
|
1878
1862
|
});
|
|
1879
1863
|
})
|
|
1880
1864
|
);
|
|
1881
1865
|
}
|
|
1882
1866
|
_scrollUpdateListener() {
|
|
1883
1867
|
this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
|
|
1884
|
-
var t,
|
|
1885
|
-
const n = (
|
|
1886
|
-
var
|
|
1887
|
-
const a = this._getSceneAndTransformerByDrawingSearch(
|
|
1888
|
-
!a || !
|
|
1889
|
-
const f = this._domLayerInfoMap.get(
|
|
1868
|
+
var t, i;
|
|
1869
|
+
const n = (s, o) => {
|
|
1870
|
+
var m;
|
|
1871
|
+
const a = this._getSceneAndTransformerByDrawingSearch(s), c = this._ensureMap(s, o), g = Array.from(c.keys()), l = se(this._univerInstanceService, { unitId: s, subUnitId: o }), d = (m = this._renderManagerService.getRenderById(s)) == null ? void 0 : m.with(Xe).getUnitSkeleton(s, o);
|
|
1872
|
+
!a || !l || !d || g.forEach((u) => {
|
|
1873
|
+
const f = this._domLayerInfoMap.get(u);
|
|
1890
1874
|
if (f) {
|
|
1891
|
-
const
|
|
1892
|
-
f.position$.next(
|
|
1875
|
+
const h = Ye(f.rect, a.renderObject, d.skeleton, l.worksheet);
|
|
1876
|
+
f.position$.next(h);
|
|
1893
1877
|
}
|
|
1894
1878
|
});
|
|
1895
1879
|
};
|
|
1896
|
-
if (e.id ===
|
|
1897
|
-
const
|
|
1898
|
-
n(
|
|
1899
|
-
} else if (e.id ===
|
|
1900
|
-
const
|
|
1901
|
-
Array.from((
|
|
1902
|
-
n(
|
|
1880
|
+
if (e.id === Pn.id) {
|
|
1881
|
+
const s = e.params, { unitId: o, sheetId: a } = s;
|
|
1882
|
+
n(o, a);
|
|
1883
|
+
} else if (e.id === En.id) {
|
|
1884
|
+
const s = e.params, { unitId: o } = s;
|
|
1885
|
+
Array.from((i = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? i : []).forEach((c) => {
|
|
1886
|
+
n(o, c);
|
|
1903
1887
|
});
|
|
1904
|
-
} else if (e.id ===
|
|
1905
|
-
const { unitId:
|
|
1906
|
-
n(
|
|
1888
|
+
} else if (e.id === Qn.id) {
|
|
1889
|
+
const { unitId: s, subUnitId: o } = e.params;
|
|
1890
|
+
n(s, o);
|
|
1907
1891
|
}
|
|
1908
1892
|
}));
|
|
1909
1893
|
}
|
|
1910
1894
|
_getPosition(e) {
|
|
1911
|
-
const { startX: n, endX: t, startY:
|
|
1912
|
-
if (
|
|
1895
|
+
const { startX: n, endX: t, startY: i, endY: s } = e, o = this._selectionRenderService.getSelectionCellByPosition(n, i);
|
|
1896
|
+
if (o == null)
|
|
1913
1897
|
return;
|
|
1914
1898
|
const a = {
|
|
1915
|
-
column:
|
|
1916
|
-
columnOffset: n -
|
|
1917
|
-
row:
|
|
1918
|
-
rowOffset:
|
|
1919
|
-
}, c = this._selectionRenderService.getSelectionCellByPosition(t,
|
|
1899
|
+
column: o.actualColumn,
|
|
1900
|
+
columnOffset: n - o.startX,
|
|
1901
|
+
row: o.actualRow,
|
|
1902
|
+
rowOffset: i - o.startY
|
|
1903
|
+
}, c = this._selectionRenderService.getSelectionCellByPosition(t, s);
|
|
1920
1904
|
if (c == null)
|
|
1921
1905
|
return;
|
|
1922
|
-
const
|
|
1906
|
+
const g = {
|
|
1923
1907
|
column: c.actualColumn,
|
|
1924
1908
|
columnOffset: t - c.startX,
|
|
1925
1909
|
row: c.actualRow,
|
|
1926
|
-
rowOffset:
|
|
1910
|
+
rowOffset: s - c.startY
|
|
1927
1911
|
};
|
|
1928
1912
|
return {
|
|
1929
1913
|
from: a,
|
|
1930
|
-
to:
|
|
1914
|
+
to: g
|
|
1931
1915
|
};
|
|
1932
1916
|
}
|
|
1933
1917
|
_featureUpdateListener() {
|
|
@@ -1935,12 +1919,12 @@ let Fe = class extends ge {
|
|
|
1935
1919
|
this._drawingManagerService.update$.subscribe((e) => {
|
|
1936
1920
|
e.forEach((n) => {
|
|
1937
1921
|
const t = this._drawingManagerService.getDrawingByParam(n);
|
|
1938
|
-
if (!t || t.drawingType !==
|
|
1922
|
+
if (!t || t.drawingType !== Ve.DRAWING_DOM)
|
|
1939
1923
|
return;
|
|
1940
|
-
const
|
|
1924
|
+
const i = {
|
|
1941
1925
|
...t.transform
|
|
1942
1926
|
};
|
|
1943
|
-
this._transformChange$.next({ id: n.drawingId, value:
|
|
1927
|
+
this._transformChange$.next({ id: n.drawingId, value: i });
|
|
1944
1928
|
});
|
|
1945
1929
|
})
|
|
1946
1930
|
);
|
|
@@ -1955,33 +1939,33 @@ let Fe = class extends ge {
|
|
|
1955
1939
|
);
|
|
1956
1940
|
}
|
|
1957
1941
|
addFloatDomToPosition(e) {
|
|
1958
|
-
const n =
|
|
1942
|
+
const n = se(this._univerInstanceService, {
|
|
1959
1943
|
unitId: e.unitId,
|
|
1960
1944
|
subUnitId: e.subUnitId
|
|
1961
1945
|
});
|
|
1962
1946
|
if (!n)
|
|
1963
1947
|
throw new Error("cannot find current target!");
|
|
1964
|
-
const { unitId: t, subUnitId:
|
|
1948
|
+
const { unitId: t, subUnitId: i } = n, { initPosition: s, componentKey: o } = e, a = ie.generateRandomId(), c = this._getPosition(s);
|
|
1965
1949
|
if (c == null)
|
|
1966
1950
|
return;
|
|
1967
|
-
this._ensureMap(t,
|
|
1968
|
-
const
|
|
1951
|
+
this._ensureMap(t, i).set(a, e);
|
|
1952
|
+
const l = {
|
|
1969
1953
|
unitId: t,
|
|
1970
|
-
subUnitId:
|
|
1954
|
+
subUnitId: i,
|
|
1971
1955
|
drawingId: a,
|
|
1972
|
-
drawingType:
|
|
1973
|
-
componentKey:
|
|
1956
|
+
drawingType: Ve.DRAWING_DOM,
|
|
1957
|
+
componentKey: o,
|
|
1974
1958
|
sheetTransform: c,
|
|
1975
1959
|
transform: {
|
|
1976
|
-
left:
|
|
1977
|
-
top:
|
|
1978
|
-
width:
|
|
1979
|
-
height:
|
|
1960
|
+
left: s.startX,
|
|
1961
|
+
top: s.startY,
|
|
1962
|
+
width: s.endX - s.startX,
|
|
1963
|
+
height: s.endY - s.startY
|
|
1980
1964
|
}
|
|
1981
1965
|
};
|
|
1982
|
-
return this._commandService.executeCommand(
|
|
1966
|
+
return this._commandService.executeCommand(et.id, {
|
|
1983
1967
|
unitId: t,
|
|
1984
|
-
drawings: [
|
|
1968
|
+
drawings: [l]
|
|
1985
1969
|
}), {
|
|
1986
1970
|
id: a,
|
|
1987
1971
|
dispose: () => {
|
|
@@ -1993,33 +1977,34 @@ let Fe = class extends ge {
|
|
|
1993
1977
|
const t = this._domLayerInfoMap.get(e);
|
|
1994
1978
|
if (!t)
|
|
1995
1979
|
return;
|
|
1996
|
-
const { unitId:
|
|
1997
|
-
this._domLayerInfoMap.delete(e),
|
|
1998
|
-
const
|
|
1999
|
-
if (
|
|
2000
|
-
|
|
1980
|
+
const { unitId: i, subUnitId: s } = t;
|
|
1981
|
+
this._domLayerInfoMap.delete(e), t.dispose.dispose();
|
|
1982
|
+
const o = this._getSceneAndTransformerByDrawingSearch(i);
|
|
1983
|
+
if (o && o.scene.removeObject(t.rect), n) {
|
|
1984
|
+
this._ensureMap(i, s).delete(e);
|
|
1985
|
+
const c = this._drawingManagerService.getDrawingByParam({ unitId: i, subUnitId: s, drawingId: e });
|
|
2001
1986
|
if (!c)
|
|
2002
1987
|
return;
|
|
2003
|
-
const
|
|
2004
|
-
this._commandService.syncExecuteCommand(
|
|
1988
|
+
const g = this._sheetDrawingService.getBatchRemoveOp([c]), { redo: l, objects: d } = g;
|
|
1989
|
+
this._commandService.syncExecuteCommand(O.id, { unitId: i, subUnitId: s, op: l, objects: d, type: P.REMOVE });
|
|
2005
1990
|
}
|
|
2006
1991
|
}
|
|
2007
1992
|
};
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
],
|
|
2017
|
-
var
|
|
2018
|
-
for (var
|
|
2019
|
-
(
|
|
2020
|
-
return t &&
|
|
2021
|
-
},
|
|
2022
|
-
let
|
|
1993
|
+
Je = ri([
|
|
1994
|
+
ee(0, $(te)),
|
|
1995
|
+
ee(1, ce),
|
|
1996
|
+
ee(2, $(B)),
|
|
1997
|
+
ee(3, H),
|
|
1998
|
+
ee(4, $e),
|
|
1999
|
+
ee(5, $(Gn)),
|
|
2000
|
+
ee(6, X)
|
|
2001
|
+
], Je);
|
|
2002
|
+
var si = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, ai = (r, e, n, t) => {
|
|
2003
|
+
for (var i = t > 1 ? void 0 : t ? oi(e, n) : e, s = r.length - 1, o; s >= 0; s--)
|
|
2004
|
+
(o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
|
|
2005
|
+
return t && i && si(e, n, i), i;
|
|
2006
|
+
}, be = (r, e) => (n, t) => e(n, t, r);
|
|
2007
|
+
let Te = class extends ue {
|
|
2023
2008
|
constructor(r, e, n, t) {
|
|
2024
2009
|
super(), this._sheetPrintInterceptorService = r, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting();
|
|
2025
2010
|
}
|
|
@@ -2029,9 +2014,9 @@ let Me = class extends ge {
|
|
|
2029
2014
|
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
|
|
2030
2015
|
{
|
|
2031
2016
|
handler: (r, e, n) => {
|
|
2032
|
-
const { unitId: t, scene:
|
|
2017
|
+
const { unitId: t, scene: i, subUnitId: s } = e, o = this._drawingManagerService.getDrawingDataForUnit(t), a = o == null ? void 0 : o[s];
|
|
2033
2018
|
return a && a.order.forEach((c) => {
|
|
2034
|
-
this._drawingRenderService.renderDrawing(a.data[c],
|
|
2019
|
+
this._drawingRenderService.renderDrawing(a.data[c], i);
|
|
2035
2020
|
}), n();
|
|
2036
2021
|
}
|
|
2037
2022
|
}
|
|
@@ -2041,46 +2026,206 @@ let Me = class extends ge {
|
|
|
2041
2026
|
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,
|
|
2042
2027
|
{
|
|
2043
2028
|
handler: (r, e, n) => {
|
|
2044
|
-
const { unitId: t, subUnitId:
|
|
2045
|
-
if (!i)
|
|
2046
|
-
return n(r);
|
|
2047
|
-
const s = i.with(Be).getUnitSkeleton(t, o);
|
|
2029
|
+
const { unitId: t, subUnitId: i } = e, s = this._renderManagerService.getRenderById(t);
|
|
2048
2030
|
if (!s)
|
|
2049
2031
|
return n(r);
|
|
2032
|
+
const o = s.with(Xe).getUnitSkeleton(t, i);
|
|
2033
|
+
if (!o)
|
|
2034
|
+
return n(r);
|
|
2050
2035
|
const a = this._drawingManagerService.getDrawingDataForUnit(t), c = a == null ? void 0 : a[e.subUnitId];
|
|
2051
2036
|
if (!c)
|
|
2052
2037
|
return n(r);
|
|
2053
|
-
const { scaleX:
|
|
2054
|
-
return
|
|
2055
|
-
if (!
|
|
2056
|
-
const f =
|
|
2057
|
-
f.column <
|
|
2038
|
+
const { scaleX: g, scaleY: l } = s.scene, d = r ? { ...r } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, m = c.order.map((u) => c.data[u]).filter((u) => u.drawingType !== Le.DRAWING_DOM);
|
|
2039
|
+
return m.length ? (m.forEach((u) => {
|
|
2040
|
+
if (!u.groupId && u.transform && ie.isDefine(u.transform.left) && ie.isDefine(u.transform.top) && ie.isDefine(u.transform.width) && ie.isDefine(u.transform.height)) {
|
|
2041
|
+
const f = o.skeleton.getCellPositionByOffset(u.transform.left, u.transform.top, g, l, { x: 0, y: 0 }), h = o.skeleton.getCellPositionByOffset(u.transform.left + u.transform.width, u.transform.top + u.transform.height, g, l, { x: 0, y: 0 });
|
|
2042
|
+
f.column < d.startColumn && (d.startColumn = f.column), f.row < d.startRow && (d.startRow = f.row), d.endRow < h.row && (d.endRow = h.row), d.endColumn < h.column && (d.endColumn = h.column);
|
|
2058
2043
|
}
|
|
2059
|
-
}), n(
|
|
2044
|
+
}), n(d)) : n(r);
|
|
2060
2045
|
}
|
|
2061
2046
|
}
|
|
2062
2047
|
)
|
|
2063
2048
|
);
|
|
2064
2049
|
}
|
|
2065
2050
|
};
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
],
|
|
2073
|
-
var
|
|
2074
|
-
for (var
|
|
2075
|
-
(
|
|
2076
|
-
return t &&
|
|
2077
|
-
},
|
|
2078
|
-
|
|
2079
|
-
|
|
2051
|
+
Te = ai([
|
|
2052
|
+
de(le.Rendered, Te),
|
|
2053
|
+
be(0, $(yn)),
|
|
2054
|
+
be(1, $(gn)),
|
|
2055
|
+
be(2, H),
|
|
2056
|
+
be(3, te)
|
|
2057
|
+
], Te);
|
|
2058
|
+
var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, li = (r, e, n, t) => {
|
|
2059
|
+
for (var i = t > 1 ? void 0 : t ? di(e, n) : e, s = r.length - 1, o; s >= 0; s--)
|
|
2060
|
+
(o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
|
|
2061
|
+
return t && i && ci(e, n, i), i;
|
|
2062
|
+
}, ge = (r, e) => (n, t) => e(n, t, r);
|
|
2063
|
+
let Ue = class extends ue {
|
|
2064
|
+
constructor(r, e, n, t, i) {
|
|
2065
|
+
super(), this._drawingManagerService = r, this._renderManagerService = e, this._permissionService = n, this._univerInstanceService = t, this._userManagerService = i, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
2066
|
+
}
|
|
2067
|
+
_initDrawingVisible() {
|
|
2068
|
+
const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
|
|
2069
|
+
this.disposeWithMe(
|
|
2070
|
+
Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
2071
|
+
if (!e) {
|
|
2072
|
+
this._drawingManagerService.setDrawingVisible(!1);
|
|
2073
|
+
return;
|
|
2074
|
+
}
|
|
2075
|
+
e.activeSheet$.subscribe((t) => {
|
|
2076
|
+
if (!t) {
|
|
2077
|
+
this._drawingManagerService.setDrawingVisible(!1);
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
const i = e.getUnitId(), s = t.getSheetId();
|
|
2081
|
+
if (this._permissionService.composePermission([new lt(i).id, new xe(i, s).id]).every((a) => a.value))
|
|
2082
|
+
this._drawingManagerService.setDrawingVisible(!0);
|
|
2083
|
+
else {
|
|
2084
|
+
this._drawingManagerService.setDrawingVisible(!1);
|
|
2085
|
+
const a = e.getUnitId(), c = t.getSheetId(), g = this._drawingManagerService.getDrawingData(a, c), l = Object.values(g), d = this._renderManagerService.getRenderById(a), m = d == null ? void 0 : d.scene;
|
|
2086
|
+
if (m == null)
|
|
2087
|
+
return;
|
|
2088
|
+
m.getAllObjects().forEach((f) => {
|
|
2089
|
+
f.classType === ne.IMAGE && l.some((h) => f.oKey.includes(h.drawingId)) && m.removeObject(f);
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
});
|
|
2093
|
+
})
|
|
2094
|
+
);
|
|
2095
|
+
}
|
|
2096
|
+
_initDrawingEditable() {
|
|
2097
|
+
const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
|
|
2098
|
+
this.disposeWithMe(
|
|
2099
|
+
Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
2100
|
+
if (!e) {
|
|
2101
|
+
this._drawingManagerService.setDrawingEditable(!1);
|
|
2102
|
+
return;
|
|
2103
|
+
}
|
|
2104
|
+
e.activeSheet$.subscribe((t) => {
|
|
2105
|
+
if (!t) {
|
|
2106
|
+
this._drawingManagerService.setDrawingEditable(!1);
|
|
2107
|
+
return;
|
|
2108
|
+
}
|
|
2109
|
+
const i = e.getUnitId(), s = t.getSheetId();
|
|
2110
|
+
if (this._permissionService.composePermission([new He(i).id, new Oe(i, s).id]).every((a) => a.value))
|
|
2111
|
+
this._drawingManagerService.setDrawingEditable(!0);
|
|
2112
|
+
else {
|
|
2113
|
+
this._drawingManagerService.setDrawingEditable(!1);
|
|
2114
|
+
const a = e.getUnitId(), c = t.getSheetId(), g = this._drawingManagerService.getDrawingData(a, c), l = Object.values(g), d = this._renderManagerService.getRenderById(a), m = d == null ? void 0 : d.scene;
|
|
2115
|
+
if (m == null)
|
|
2116
|
+
return;
|
|
2117
|
+
m.getAllObjects().forEach((f) => {
|
|
2118
|
+
f.classType === ne.IMAGE && l.some((h) => f.oKey.includes(h.drawingId)) && m.detachTransformerFrom(f);
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
});
|
|
2122
|
+
})
|
|
2123
|
+
);
|
|
2124
|
+
}
|
|
2125
|
+
_initViewPermissionChange() {
|
|
2126
|
+
const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
|
|
2127
|
+
this.disposeWithMe(
|
|
2128
|
+
Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
2129
|
+
e && e.activeSheet$.subscribe((t) => {
|
|
2130
|
+
var d;
|
|
2131
|
+
if (!t)
|
|
2132
|
+
return;
|
|
2133
|
+
const i = e.getUnitId(), s = t.getSheetId();
|
|
2134
|
+
let o = !0;
|
|
2135
|
+
const a = this._renderManagerService.getRenderById(i), c = a == null ? void 0 : a.scene;
|
|
2136
|
+
if (c == null)
|
|
2137
|
+
return;
|
|
2138
|
+
const g = c.getTransformerByCreate(), l = this._permissionService.composePermission$([new lt(i).id, new xe(i, s).id]).pipe(dt((m) => m.every((u) => u.value)));
|
|
2139
|
+
l == null || l.pipe(
|
|
2140
|
+
Ce((m) => m !== o),
|
|
2141
|
+
Ie()
|
|
2142
|
+
).subscribe({
|
|
2143
|
+
next: (m) => {
|
|
2144
|
+
o = m, this._drawingManagerService.setDrawingVisible(m);
|
|
2145
|
+
const u = c.getAllObjects(), f = this._drawingManagerService.getDrawingData(i, s), h = Object.values(f);
|
|
2146
|
+
m ? this._drawingManagerService.addNotification(h) : (u.forEach((p) => {
|
|
2147
|
+
p.classType === ne.IMAGE && h.some((S) => p.oKey.includes(S.drawingId)) && c.removeObject(p);
|
|
2148
|
+
}), g.clearSelectedObjects());
|
|
2149
|
+
}
|
|
2150
|
+
}), (d = this._permissionService.getPermissionPoint$(new xe(i, s).id)) == null || d.pipe(
|
|
2151
|
+
Ce((m) => m.value !== o),
|
|
2152
|
+
Ie()
|
|
2153
|
+
).subscribe({
|
|
2154
|
+
complete: () => {
|
|
2155
|
+
o = !0, this._drawingManagerService.setDrawingVisible(!0);
|
|
2156
|
+
const m = this._drawingManagerService.getDrawingData(i, s), u = Object.values(m);
|
|
2157
|
+
this._drawingManagerService.addNotification(u);
|
|
2158
|
+
}
|
|
2159
|
+
});
|
|
2160
|
+
});
|
|
2161
|
+
})
|
|
2162
|
+
);
|
|
2163
|
+
}
|
|
2164
|
+
_initEditPermissionChange() {
|
|
2165
|
+
const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
|
|
2166
|
+
this.disposeWithMe(
|
|
2167
|
+
Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
2168
|
+
e && e.activeSheet$.subscribe((t) => {
|
|
2169
|
+
var d;
|
|
2170
|
+
if (!t)
|
|
2171
|
+
return;
|
|
2172
|
+
const i = e.getUnitId(), s = t.getSheetId();
|
|
2173
|
+
let o = !0;
|
|
2174
|
+
const a = this._renderManagerService.getRenderById(i), c = a == null ? void 0 : a.scene;
|
|
2175
|
+
if (c == null)
|
|
2176
|
+
return;
|
|
2177
|
+
const g = c.getTransformerByCreate(), l = this._permissionService.composePermission$([new He(i).id, new Oe(i, s).id]).pipe(dt((m) => m.every((u) => u.value)));
|
|
2178
|
+
l == null || l.pipe(
|
|
2179
|
+
Ce((m) => m !== o),
|
|
2180
|
+
Ie()
|
|
2181
|
+
).subscribe({
|
|
2182
|
+
next: (m) => {
|
|
2183
|
+
o = m, this._drawingManagerService.setDrawingEditable(m);
|
|
2184
|
+
const u = c.getAllObjects(), f = this._drawingManagerService.getDrawingData(i, s), h = Object.values(f);
|
|
2185
|
+
m ? (u.forEach((p) => {
|
|
2186
|
+
p.classType === ne.IMAGE && h.some((S) => p.oKey.includes(S.drawingId)) && c.attachTransformerTo(p);
|
|
2187
|
+
}), this._drawingManagerService.addNotification(h)) : (u.forEach((p) => {
|
|
2188
|
+
p.classType === ne.IMAGE && h.some((S) => p.oKey.includes(S.drawingId)) && c.detachTransformerFrom(p);
|
|
2189
|
+
}), g.clearSelectedObjects());
|
|
2190
|
+
}
|
|
2191
|
+
}), (d = this._permissionService.getPermissionPoint$(new Oe(i, s).id)) == null || d.pipe(
|
|
2192
|
+
Ce((m) => m.value !== o),
|
|
2193
|
+
Ie()
|
|
2194
|
+
).subscribe({
|
|
2195
|
+
complete: () => {
|
|
2196
|
+
o = !0;
|
|
2197
|
+
const m = e.getUnitId(), u = t.getSheetId(), f = this._drawingManagerService.getDrawingData(m, u), h = Object.values(f), p = this._renderManagerService.getRenderById(m), S = p == null ? void 0 : p.scene;
|
|
2198
|
+
if (S == null)
|
|
2199
|
+
return;
|
|
2200
|
+
this._drawingManagerService.setDrawingEditable(!0), S.getAllObjects().forEach((v) => {
|
|
2201
|
+
v.classType === ne.IMAGE && h.some((R) => v.oKey.includes(R.drawingId)) && S.detachTransformerFrom(v);
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2204
|
+
});
|
|
2205
|
+
});
|
|
2206
|
+
})
|
|
2207
|
+
);
|
|
2208
|
+
}
|
|
2209
|
+
};
|
|
2210
|
+
Ue = li([
|
|
2211
|
+
de(le.Rendered, Ue),
|
|
2212
|
+
ge(0, H),
|
|
2213
|
+
ge(1, te),
|
|
2214
|
+
ge(2, sn),
|
|
2215
|
+
ge(3, ce),
|
|
2216
|
+
ge(4, $(rn))
|
|
2217
|
+
], Ue);
|
|
2218
|
+
var zt = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, mi = (r, e, n) => e in r ? zt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n, gi = (r, e, n, t) => {
|
|
2219
|
+
for (var i = t > 1 ? void 0 : t ? ui(e, n) : e, s = r.length - 1, o; s >= 0; s--)
|
|
2220
|
+
(o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
|
|
2221
|
+
return t && i && zt(e, n, i), i;
|
|
2222
|
+
}, mt = (r, e) => (n, t) => e(n, t, r), Kt = (r, e, n) => mi(r, typeof e != "symbol" ? e + "" : e, n);
|
|
2223
|
+
const hi = "SHEET_IMAGE_UI_PLUGIN";
|
|
2224
|
+
let je = class extends on {
|
|
2080
2225
|
constructor(e = {}, n, t) {
|
|
2081
2226
|
super();
|
|
2082
|
-
|
|
2083
|
-
this._injector = n, this._localeService = t, this._pluginConfig =
|
|
2227
|
+
K(this, "_pluginConfig");
|
|
2228
|
+
this._injector = n, this._localeService = t, this._pluginConfig = ie.deepMerge({}, kr, e);
|
|
2084
2229
|
}
|
|
2085
2230
|
onStarting(e) {
|
|
2086
2231
|
super.onStarting(e), this._initDependencies(e);
|
|
@@ -2088,29 +2233,30 @@ let Pe = class extends Ht {
|
|
|
2088
2233
|
_initDependencies(e) {
|
|
2089
2234
|
[
|
|
2090
2235
|
// services
|
|
2091
|
-
[
|
|
2236
|
+
[Je],
|
|
2092
2237
|
// controllers
|
|
2093
2238
|
[
|
|
2094
|
-
|
|
2239
|
+
he,
|
|
2095
2240
|
{
|
|
2096
|
-
useFactory: () => this._injector.createInstance(
|
|
2241
|
+
useFactory: () => this._injector.createInstance(he, this._pluginConfig)
|
|
2097
2242
|
}
|
|
2098
2243
|
],
|
|
2099
|
-
[
|
|
2100
|
-
[
|
|
2101
|
-
[
|
|
2102
|
-
[
|
|
2244
|
+
[Ee],
|
|
2245
|
+
[Pe],
|
|
2246
|
+
[ye],
|
|
2247
|
+
[Te],
|
|
2248
|
+
[Ue]
|
|
2103
2249
|
].forEach((t) => e.add(t));
|
|
2104
2250
|
}
|
|
2105
2251
|
};
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
],
|
|
2252
|
+
Kt(je, "type", Y.UNIVER_SHEET);
|
|
2253
|
+
Kt(je, "pluginName", hi);
|
|
2254
|
+
je = gi([
|
|
2255
|
+
an(Sn, hn, fn),
|
|
2256
|
+
mt(1, $(Ze)),
|
|
2257
|
+
mt(2, $(pe))
|
|
2258
|
+
], je);
|
|
2113
2259
|
export {
|
|
2114
|
-
|
|
2115
|
-
|
|
2260
|
+
Je as SheetCanvasFloatDomManagerService,
|
|
2261
|
+
je as UniverSheetsDrawingUIPlugin
|
|
2116
2262
|
};
|