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