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