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