@univerjs/sheets-drawing-ui 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +555 -537
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +8 -3
- package/lib/umd/index.js +1 -1
- package/package.json +25 -25
package/lib/es/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as F, ICommandService as V, IUndoRedoService as ge, LocaleService as _e, IUniverInstanceService as he, RxDisposable as
|
|
1
|
+
var en = Object.defineProperty;
|
|
2
|
+
var tn = (i, e, n) => e in i ? en(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
|
+
var H = (i, e, n) => tn(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { CommandType as F, ICommandService as V, IUndoRedoService as ge, LocaleService as _e, IUniverInstanceService as he, RxDisposable as nn, UniverInstanceType as B, toDisposable as rn, FOCUSING_COMMON_DRAWINGS as we, OnLifecycle as ie, LifecycleStages as se, IContextService as _t, Disposable as oe, Direction as q, FOCUSING_FORMULA_EDITOR as sn, EDITOR_ACTIVATED as on, Rectangle as an, DrawingTypeEnum as Ye, DisposableCollection as cn, Tools as ne, UserManagerService as dn, IPermissionService as ln, Plugin as un, DependentOn as gn } from "@univerjs/core";
|
|
5
5
|
import { Inject as W, Injector as nt } from "@wendellhu/redi";
|
|
6
|
-
import { ImageCropperObject as
|
|
7
|
-
import { ISheetDrawingService as
|
|
8
|
-
import { IDrawingManagerService as z, IImageIoService as
|
|
9
|
-
import { IRenderManagerService as K, getGroupState as
|
|
10
|
-
import { SheetCanvasPopManagerService as Tn, ISheetSelectionRenderService as Ge, SheetSkeletonManagerService as
|
|
11
|
-
import { takeUntil as
|
|
12
|
-
import { ISidebarService as
|
|
13
|
-
import { useDependency as ee, connectInjector as
|
|
14
|
-
import { getSheetCommandTarget as le, SheetsSelectionsService as
|
|
15
|
-
import L, { useEffect as rt, forwardRef as
|
|
16
|
-
import { MessageType as be, RadioGroup as
|
|
6
|
+
import { ImageCropperObject as hn, COMPONENT_IMAGE_POPUP_MENU as mn, OpenImageCropOperation as fn, ImageResetSizeOperation as pn, DrawingCommonPanel as wn, DrawingRenderService as _n, UniverDrawingUIPlugin as vn } from "@univerjs/drawing-ui";
|
|
7
|
+
import { ISheetDrawingService as k, SetDrawingApplyMutation as E, DrawingApplyType as y, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as Sn } from "@univerjs/sheets-drawing";
|
|
8
|
+
import { IDrawingManagerService as z, IImageIoService as vt, ArrangeTypeEnum as Ce, DrawingTypeEnum as Ve, DRAWING_IMAGE_COUNT_LIMIT as dt, ImageUploadStatusType as ke, DRAWING_IMAGE_ALLOW_SIZE as Cn, getImageSize as In, DRAWING_IMAGE_WIDTH_LIMIT as lt, DRAWING_IMAGE_HEIGHT_LIMIT as ut, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Rn, getDrawingShapeKeyByDrawingSearch as Mn, UniverDrawingPlugin as Dn } from "@univerjs/drawing";
|
|
9
|
+
import { IRenderManagerService as K, getGroupState as bn, transformObjectOutOfGroup as En, precisionTo as Q, Rect as yn, DRAWING_OBJECT_LAYER_INDEX as On, SHEET_VIEWPORT_KEY as Pn, RENDER_CLASS_TYPE as ae } from "@univerjs/engine-render";
|
|
10
|
+
import { SheetCanvasPopManagerService as Tn, ISheetSelectionRenderService as Ge, SheetSkeletonManagerService as re, attachRangeWithCoord as Un, getCurrentRangeDisable$ as An, SetScrollOperation as Nn, SetZoomRatioOperation as jn, SheetPrintInterceptorService as Ln, COPY_TYPE as gt, PREDEFINED_HOOK_NAME as Ie, virtualizeDiscreteRanges as Bn, ISheetClipboardService as Wn } from "@univerjs/sheets-ui";
|
|
11
|
+
import { takeUntil as ht, Subject as mt, BehaviorSubject as $n, combineLatest as Re, map as ft, filter as Me, distinctUntilChanged as De } from "rxjs";
|
|
12
|
+
import { ISidebarService as Vn, BuiltInUIPart as Gn, IUIPartsService as xn, IMessageService as Fn, MenuItemType as St, MenuPosition as Yn, MenuGroup as kn, getMenuHiddenObservable as Ct, KeyCode as ue, ComponentManager as Hn, IMenuService as Xn, IShortcutService as zn, CanvasFloatDomService as Kn } from "@univerjs/ui";
|
|
13
|
+
import { useDependency as ee, connectInjector as Jn } from "@wendellhu/redi/react-bindings";
|
|
14
|
+
import { getSheetCommandTarget as le, SheetsSelectionsService as Zn, WorkbookEditablePermission as Ze, WorksheetEditPermission as Pe, RangeProtectionPermissionEditPoint as qn, InsertRowCommand as It, InsertColCommand as Rt, RemoveRowCommand as Mt, RemoveColCommand as Dt, DeleteRangeMoveLeftCommand as bt, DeleteRangeMoveUpCommand as Et, InsertRangeMoveDownCommand as yt, InsertRangeMoveRightCommand as Ot, DeltaRowHeightCommand as qe, SetRowHeightCommand as Qe, DeltaColumnWidthCommand as Pt, SetColWidthCommand as Tt, SetRowHiddenCommand as Ut, SetSpecificRowsVisibleCommand as At, SetSpecificColsVisibleCommand as Nt, SetColHiddenCommand as jt, SetRowVisibleMutation as Qn, SetRowHiddenMutation as er, SetColVisibleMutation as tr, SetColHiddenMutation as nr, SetWorksheetRowHeightMutation as rr, SetWorksheetColWidthMutation as ir, SetWorksheetActiveOperation as sr, SheetInterceptorService as or, SetFrozenMutation as ar, WorkbookViewPermission as pt, WorksheetViewPermission as He } from "@univerjs/sheets";
|
|
15
|
+
import L, { useEffect as rt, forwardRef as Lt, useRef as Bt, createElement as Wt, useState as et } from "react";
|
|
16
|
+
import { MessageType as be, RadioGroup as cr, Radio as Xe } from "@univerjs/design";
|
|
17
17
|
import Ee from "clsx";
|
|
18
18
|
const j = {
|
|
19
19
|
id: "sheet.operation.clear-drawing-transformer",
|
|
@@ -29,37 +29,37 @@ const j = {
|
|
|
29
29
|
id: "sheet.command.remove-sheet-image",
|
|
30
30
|
type: F.COMMAND,
|
|
31
31
|
handler: (i, e) => {
|
|
32
|
-
const n = i.get(V), t = i.get(ge), r = i.get(
|
|
32
|
+
const n = i.get(V), t = i.get(ge), r = i.get(k);
|
|
33
33
|
if (!e) return !1;
|
|
34
34
|
const { drawings: s } = e, o = [];
|
|
35
35
|
s.forEach((f) => {
|
|
36
36
|
const { unitId: m } = f;
|
|
37
37
|
o.push(m);
|
|
38
38
|
});
|
|
39
|
-
const a = r.getBatchRemoveOp(s), { unitId: d, subUnitId: h, undo: l, redo: c, objects:
|
|
40
|
-
return n.syncExecuteCommand(E.id, { unitId: d, subUnitId: h, op: c, objects:
|
|
39
|
+
const a = r.getBatchRemoveOp(s), { unitId: d, subUnitId: h, undo: l, redo: c, objects: u } = a;
|
|
40
|
+
return n.syncExecuteCommand(E.id, { unitId: d, subUnitId: h, op: c, objects: u, type: y.REMOVE }) ? (t.pushUndoRedo({
|
|
41
41
|
unitID: d,
|
|
42
42
|
undoMutations: [
|
|
43
|
-
{ id: E.id, params: { unitId: d, subUnitId: h, op: l, objects:
|
|
43
|
+
{ id: E.id, params: { unitId: d, subUnitId: h, op: l, objects: u, type: y.INSERT } },
|
|
44
44
|
{ id: j.id, params: o }
|
|
45
45
|
],
|
|
46
46
|
redoMutations: [
|
|
47
|
-
{ id: E.id, params: { unitId: d, subUnitId: h, op: c, objects:
|
|
47
|
+
{ id: E.id, params: { unitId: d, subUnitId: h, op: c, objects: u, type: y.REMOVE } },
|
|
48
48
|
{ id: j.id, params: o }
|
|
49
49
|
]
|
|
50
50
|
}), !0) : !1;
|
|
51
51
|
}
|
|
52
|
-
},
|
|
52
|
+
}, $t = "COMPONENT_SHEET_DRAWING_PANEL", Vt = {
|
|
53
53
|
id: "sidebar.operation.sheet-image",
|
|
54
54
|
type: F.COMMAND,
|
|
55
55
|
handler: async (i, e) => {
|
|
56
|
-
const n = i.get(
|
|
56
|
+
const n = i.get(Vn), t = i.get(_e), r = i.get(he), s = i.get(z);
|
|
57
57
|
if (!le(r)) return !1;
|
|
58
58
|
switch (e.value) {
|
|
59
59
|
case "open":
|
|
60
60
|
n.open({
|
|
61
61
|
header: { title: t.t("sheetImage.panel.title") },
|
|
62
|
-
children: { label:
|
|
62
|
+
children: { label: $t },
|
|
63
63
|
onClose: () => {
|
|
64
64
|
s.focusDrawing(null);
|
|
65
65
|
},
|
|
@@ -73,21 +73,21 @@ const j = {
|
|
|
73
73
|
}
|
|
74
74
|
return !0;
|
|
75
75
|
}
|
|
76
|
-
},
|
|
76
|
+
}, Gt = {
|
|
77
77
|
id: "sheet.operation.edit-sheet-image",
|
|
78
78
|
type: F.OPERATION,
|
|
79
79
|
handler: (i, e) => {
|
|
80
80
|
const n = i.get(z), t = i.get(V);
|
|
81
|
-
return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
uploadLoading:
|
|
85
|
-
uploadLoadingBody:
|
|
86
|
-
uploadLoadingBodyAnimation:
|
|
87
|
-
univerCircleAnimation:
|
|
88
|
-
uploadLoadingBodyText:
|
|
89
|
-
},
|
|
90
|
-
const i = ee(
|
|
81
|
+
return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(Vt.id, { value: "open" }), !0);
|
|
82
|
+
}
|
|
83
|
+
}, dr = "univer-upload-loading", lr = "univer-upload-loading-body", ur = "univer-upload-loading-body-animation", gr = "univer-UniverCircleAnimation", hr = "univer-upload-loading-body-text", ye = {
|
|
84
|
+
uploadLoading: dr,
|
|
85
|
+
uploadLoadingBody: lr,
|
|
86
|
+
uploadLoadingBodyAnimation: ur,
|
|
87
|
+
univerCircleAnimation: gr,
|
|
88
|
+
uploadLoadingBodyText: hr
|
|
89
|
+
}, mr = () => {
|
|
90
|
+
const i = ee(vt), e = ee(_e), [n, t] = L.useState(0);
|
|
91
91
|
return rt(() => {
|
|
92
92
|
const r = i.change$.subscribe((s) => {
|
|
93
93
|
t(s);
|
|
@@ -97,19 +97,19 @@ const j = {
|
|
|
97
97
|
};
|
|
98
98
|
}, [i]), /* @__PURE__ */ L.createElement("div", { style: { display: n > 0 ? "block" : "none" }, className: ye.uploadLoading }, /* @__PURE__ */ L.createElement("div", { className: ye.uploadLoadingBody }, /* @__PURE__ */ L.createElement("div", { className: ye.uploadLoadingBodyAnimation }), /* @__PURE__ */ L.createElement("div", { className: ye.uploadLoadingBodyText }, `${e.t("uploadLoading.loading")}: ${n}`)));
|
|
99
99
|
};
|
|
100
|
-
var
|
|
101
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
100
|
+
var fr = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, wr = (i, e, n, t) => {
|
|
101
|
+
for (var r = t > 1 ? void 0 : t ? pr(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
102
102
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
103
|
-
return t && r &&
|
|
103
|
+
return t && r && fr(e, n, r), r;
|
|
104
104
|
}, te = (i, e) => (n, t) => e(n, t, i);
|
|
105
|
-
let
|
|
105
|
+
let Te = class extends nn {
|
|
106
106
|
constructor(e, n, t, r, s, o, a) {
|
|
107
107
|
super();
|
|
108
|
-
|
|
108
|
+
H(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
109
109
|
this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._init();
|
|
110
110
|
}
|
|
111
111
|
_init() {
|
|
112
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET).pipe(
|
|
112
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET).pipe(ht(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(B.UNIVER_SHEET).pipe(ht(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(B.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(Gn.CONTENT, () => Jn(mr, this._injector));
|
|
113
113
|
}
|
|
114
114
|
_dispose(e) {
|
|
115
115
|
const n = e.getUnitId();
|
|
@@ -124,7 +124,7 @@ let Pe = class extends tn {
|
|
|
124
124
|
_hasCropObject(e) {
|
|
125
125
|
const n = e.getAllObjects();
|
|
126
126
|
for (const t of n)
|
|
127
|
-
if (t instanceof
|
|
127
|
+
if (t instanceof hn)
|
|
128
128
|
return !0;
|
|
129
129
|
return !1;
|
|
130
130
|
}
|
|
@@ -138,7 +138,7 @@ let Pe = class extends tn {
|
|
|
138
138
|
return;
|
|
139
139
|
let r;
|
|
140
140
|
this.disposeWithMe(
|
|
141
|
-
|
|
141
|
+
rn(
|
|
142
142
|
t.createControl$.subscribe(() => {
|
|
143
143
|
if (this._contextService.setContextValue(we, !0), this._hasCropObject(n))
|
|
144
144
|
return;
|
|
@@ -153,18 +153,18 @@ let Pe = class extends tn {
|
|
|
153
153
|
const d = a.oKey, h = this._drawingManagerService.getDrawingOKey(d);
|
|
154
154
|
if (!h)
|
|
155
155
|
return;
|
|
156
|
-
const { unitId: l, subUnitId: c, drawingId:
|
|
156
|
+
const { unitId: l, subUnitId: c, drawingId: u } = h;
|
|
157
157
|
r == null || r.dispose(), r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
|
|
158
|
-
componentKey:
|
|
158
|
+
componentKey: mn,
|
|
159
159
|
direction: "horizontal",
|
|
160
160
|
offset: [2, 0],
|
|
161
161
|
extraProps: {
|
|
162
|
-
menuItems: this._getImageMenuItems(l, c,
|
|
162
|
+
menuItems: this._getImageMenuItems(l, c, u)
|
|
163
163
|
}
|
|
164
164
|
})), this._drawingManagerService.focusDrawing([{
|
|
165
165
|
unitId: l,
|
|
166
166
|
subUnitId: c,
|
|
167
|
-
drawingId:
|
|
167
|
+
drawingId: u
|
|
168
168
|
}]);
|
|
169
169
|
})
|
|
170
170
|
)
|
|
@@ -183,7 +183,7 @@ let Pe = class extends tn {
|
|
|
183
183
|
{
|
|
184
184
|
label: "image-popup.edit",
|
|
185
185
|
index: 0,
|
|
186
|
-
commandId:
|
|
186
|
+
commandId: Gt.id,
|
|
187
187
|
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
188
188
|
disable: !1
|
|
189
189
|
},
|
|
@@ -197,30 +197,30 @@ let Pe = class extends tn {
|
|
|
197
197
|
{
|
|
198
198
|
label: "image-popup.crop",
|
|
199
199
|
index: 2,
|
|
200
|
-
commandId:
|
|
200
|
+
commandId: fn.id,
|
|
201
201
|
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
202
202
|
disable: !1
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
label: "image-popup.reset",
|
|
206
206
|
index: 3,
|
|
207
|
-
commandId:
|
|
207
|
+
commandId: pn.id,
|
|
208
208
|
commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
|
|
209
209
|
disable: !1
|
|
210
210
|
}
|
|
211
211
|
];
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
|
-
|
|
215
|
-
se
|
|
214
|
+
Te = wr([
|
|
215
|
+
ie(se.Steady, Te),
|
|
216
216
|
te(0, W(nt)),
|
|
217
217
|
te(1, z),
|
|
218
218
|
te(2, W(Tn)),
|
|
219
219
|
te(3, K),
|
|
220
220
|
te(4, he),
|
|
221
|
-
te(5,
|
|
222
|
-
te(6, W(
|
|
223
|
-
],
|
|
221
|
+
te(5, _t),
|
|
222
|
+
te(6, W(xn))
|
|
223
|
+
], Te);
|
|
224
224
|
const xe = {
|
|
225
225
|
id: "sheet.operation.insert-float-image",
|
|
226
226
|
type: F.OPERATION,
|
|
@@ -233,17 +233,17 @@ const xe = {
|
|
|
233
233
|
id: "sheet.command.insert-sheet-image",
|
|
234
234
|
type: F.COMMAND,
|
|
235
235
|
handler: (i, e) => {
|
|
236
|
-
const n = i.get(V), t = i.get(ge), r = i.get(
|
|
236
|
+
const n = i.get(V), t = i.get(ge), r = i.get(k);
|
|
237
237
|
if (!e) return !1;
|
|
238
|
-
const s = e.drawings, o = s.map((f) => f.unitId), a = r.getBatchAddOp(s), { unitId: d, subUnitId: h, undo: l, redo: c, objects:
|
|
239
|
-
return n.syncExecuteCommand(E.id, { op: c, unitId: d, subUnitId: h, objects:
|
|
238
|
+
const s = e.drawings, o = s.map((f) => f.unitId), a = r.getBatchAddOp(s), { unitId: d, subUnitId: h, undo: l, redo: c, objects: u } = a;
|
|
239
|
+
return n.syncExecuteCommand(E.id, { op: c, unitId: d, subUnitId: h, objects: u, type: y.INSERT }) ? (t.pushUndoRedo({
|
|
240
240
|
unitID: d,
|
|
241
241
|
undoMutations: [
|
|
242
|
-
{ id: E.id, params: { op: l, unitId: d, subUnitId: h, objects:
|
|
242
|
+
{ id: E.id, params: { op: l, unitId: d, subUnitId: h, objects: u, type: y.REMOVE } },
|
|
243
243
|
{ id: j.id, params: o }
|
|
244
244
|
],
|
|
245
245
|
redoMutations: [
|
|
246
|
-
{ id: E.id, params: { op: c, unitId: d, subUnitId: h, objects:
|
|
246
|
+
{ id: E.id, params: { op: c, unitId: d, subUnitId: h, objects: u, type: y.INSERT } },
|
|
247
247
|
{ id: j.id, params: o }
|
|
248
248
|
]
|
|
249
249
|
}), !0) : !1;
|
|
@@ -252,7 +252,7 @@ const xe = {
|
|
|
252
252
|
id: "sheet.command.set-sheet-image",
|
|
253
253
|
type: F.COMMAND,
|
|
254
254
|
handler: (i, e) => {
|
|
255
|
-
const n = i.get(V), t = i.get(ge), r = i.get(
|
|
255
|
+
const n = i.get(V), t = i.get(ge), r = i.get(k);
|
|
256
256
|
if (!e) return !1;
|
|
257
257
|
const { drawings: s } = e, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: d, undo: h, redo: l, objects: c } = o;
|
|
258
258
|
return n.syncExecuteCommand(E.id, { unitId: a, subUnitId: d, op: l, objects: c, type: y.UPDATE }) ? (t.pushUndoRedo({
|
|
@@ -267,41 +267,41 @@ const xe = {
|
|
|
267
267
|
]
|
|
268
268
|
}), !0) : !1;
|
|
269
269
|
}
|
|
270
|
-
},
|
|
270
|
+
}, xt = {
|
|
271
271
|
id: "sheet.command.set-drawing-arrange",
|
|
272
272
|
type: F.COMMAND,
|
|
273
273
|
handler: (i, e) => {
|
|
274
274
|
const n = i.get(V), t = i.get(ge);
|
|
275
275
|
if (!e) return !1;
|
|
276
|
-
const r = i.get(
|
|
276
|
+
const r = i.get(k), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: d } = e, h = { unitId: s, subUnitId: o, drawingIds: a };
|
|
277
277
|
let l;
|
|
278
278
|
if (d === Ce.forward ? l = r.getForwardDrawingsOp(h) : d === Ce.backward ? l = r.getBackwardDrawingOp(h) : d === Ce.front ? l = r.getFrontDrawingsOp(h) : d === Ce.back && (l = r.getBackDrawingsOp(h)), l == null)
|
|
279
279
|
return !1;
|
|
280
|
-
const { objects: c, redo:
|
|
281
|
-
return n.syncExecuteCommand(E.id, { op:
|
|
280
|
+
const { objects: c, redo: u, undo: g } = l;
|
|
281
|
+
return n.syncExecuteCommand(E.id, { op: u, unitId: s, subUnitId: o, objects: c, type: y.ARRANGE }) ? (t.pushUndoRedo({
|
|
282
282
|
unitID: s,
|
|
283
283
|
undoMutations: [
|
|
284
|
-
{ id: E.id, params: { op:
|
|
284
|
+
{ id: E.id, params: { op: g, unitId: s, subUnitId: o, objects: c, type: y.ARRANGE } }
|
|
285
285
|
],
|
|
286
286
|
redoMutations: [
|
|
287
|
-
{ id: E.id, params: { op:
|
|
287
|
+
{ id: E.id, params: { op: u, unitId: s, subUnitId: o, objects: c, type: y.ARRANGE } }
|
|
288
288
|
]
|
|
289
289
|
}), !0) : !1;
|
|
290
290
|
}
|
|
291
291
|
};
|
|
292
|
-
function
|
|
292
|
+
function _r(i) {
|
|
293
293
|
const e = [];
|
|
294
294
|
return i.forEach((n) => {
|
|
295
|
-
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a } = t, d =
|
|
296
|
-
const
|
|
295
|
+
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a } = t, d = bn(0, 0, r.map((c) => c.transform || {})), h = r.map((c) => {
|
|
296
|
+
const u = c.transform || { left: 0, top: 0 }, { unitId: g, subUnitId: f, drawingId: m } = c;
|
|
297
297
|
return {
|
|
298
|
-
unitId:
|
|
298
|
+
unitId: g,
|
|
299
299
|
subUnitId: f,
|
|
300
300
|
drawingId: m,
|
|
301
301
|
transform: {
|
|
302
|
-
...
|
|
303
|
-
left:
|
|
304
|
-
top:
|
|
302
|
+
...u,
|
|
303
|
+
left: u.left - d.left,
|
|
304
|
+
top: u.top - d.top
|
|
305
305
|
},
|
|
306
306
|
groupId: a
|
|
307
307
|
};
|
|
@@ -318,16 +318,16 @@ function wr(i) {
|
|
|
318
318
|
});
|
|
319
319
|
}), e;
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function vr(i) {
|
|
322
322
|
const e = [];
|
|
323
323
|
return i.forEach((n) => {
|
|
324
324
|
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a, transform: d = { width: 0, height: 0 } } = t;
|
|
325
325
|
if (d == null)
|
|
326
326
|
return;
|
|
327
327
|
const h = r.map((c) => {
|
|
328
|
-
const { transform:
|
|
328
|
+
const { transform: u } = c, { unitId: g, subUnitId: f, drawingId: m } = c, p = En(u || {}, d, d.width || 0, d.height || 0);
|
|
329
329
|
return {
|
|
330
|
-
unitId:
|
|
330
|
+
unitId: g,
|
|
331
331
|
subUnitId: f,
|
|
332
332
|
drawingId: m,
|
|
333
333
|
transform: p,
|
|
@@ -349,15 +349,15 @@ function _r(i) {
|
|
|
349
349
|
});
|
|
350
350
|
}), e;
|
|
351
351
|
}
|
|
352
|
-
const
|
|
352
|
+
const Ft = {
|
|
353
353
|
id: "sheet.command.group-sheet-image",
|
|
354
354
|
type: F.COMMAND,
|
|
355
355
|
handler: (i, e) => {
|
|
356
|
-
const n = i.get(V), t = i.get(ge), r = i.get(
|
|
356
|
+
const n = i.get(V), t = i.get(ge), r = i.get(k);
|
|
357
357
|
if (!e) return !1;
|
|
358
358
|
const s = [];
|
|
359
|
-
e.forEach(({ parent:
|
|
360
|
-
s.push(
|
|
359
|
+
e.forEach(({ parent: g, children: f }) => {
|
|
360
|
+
s.push(g.unitId), f.forEach((m) => {
|
|
361
361
|
s.push(m.unitId);
|
|
362
362
|
});
|
|
363
363
|
});
|
|
@@ -365,7 +365,7 @@ const xt = {
|
|
|
365
365
|
return n.syncExecuteCommand(E.id, { op: l, unitId: a, subUnitId: d, objects: c, type: y.GROUP }) ? (t.pushUndoRedo({
|
|
366
366
|
unitID: a,
|
|
367
367
|
undoMutations: [
|
|
368
|
-
{ id: E.id, params: { op: h, unitId: a, subUnitId: d, objects:
|
|
368
|
+
{ id: E.id, params: { op: h, unitId: a, subUnitId: d, objects: vr(c), type: y.UNGROUP } },
|
|
369
369
|
{ id: j.id, params: s }
|
|
370
370
|
],
|
|
371
371
|
redoMutations: [
|
|
@@ -374,15 +374,15 @@ const xt = {
|
|
|
374
374
|
]
|
|
375
375
|
}), !0) : !1;
|
|
376
376
|
}
|
|
377
|
-
},
|
|
377
|
+
}, Yt = {
|
|
378
378
|
id: "sheet.command.ungroup-sheet-image",
|
|
379
379
|
type: F.COMMAND,
|
|
380
380
|
handler: (i, e) => {
|
|
381
|
-
const n = i.get(V), t = i.get(ge), r = i.get(
|
|
381
|
+
const n = i.get(V), t = i.get(ge), r = i.get(k);
|
|
382
382
|
if (!e) return !1;
|
|
383
383
|
const s = [];
|
|
384
|
-
e.forEach(({ parent:
|
|
385
|
-
s.push(
|
|
384
|
+
e.forEach(({ parent: g, children: f }) => {
|
|
385
|
+
s.push(g.unitId), f.forEach((m) => {
|
|
386
386
|
s.push(m.unitId);
|
|
387
387
|
});
|
|
388
388
|
});
|
|
@@ -390,7 +390,7 @@ const xt = {
|
|
|
390
390
|
return n.syncExecuteCommand(E.id, { op: l, unitId: a, subUnitId: d, objects: c, type: y.UNGROUP }) ? (t.pushUndoRedo({
|
|
391
391
|
unitID: a,
|
|
392
392
|
undoMutations: [
|
|
393
|
-
{ id: E.id, params: { op: h, unitId: a, subUnitId: d, objects:
|
|
393
|
+
{ id: E.id, params: { op: h, unitId: a, subUnitId: d, objects: _r(c), type: y.GROUP } },
|
|
394
394
|
{ id: j.id, params: s }
|
|
395
395
|
],
|
|
396
396
|
redoMutations: [
|
|
@@ -401,11 +401,11 @@ const xt = {
|
|
|
401
401
|
}
|
|
402
402
|
};
|
|
403
403
|
function $(i, e, n) {
|
|
404
|
-
const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY: h = 0 } = i, { column: l, columnOffset: c, row:
|
|
404
|
+
const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY: h = 0 } = i, { column: l, columnOffset: c, row: u, rowOffset: g } = t, { column: f, columnOffset: m, row: p, rowOffset: S } = r, C = n.attachRangeWithCoord({
|
|
405
405
|
startColumn: l,
|
|
406
406
|
endColumn: l,
|
|
407
|
-
startRow:
|
|
408
|
-
endRow:
|
|
407
|
+
startRow: u,
|
|
408
|
+
endRow: u
|
|
409
409
|
});
|
|
410
410
|
if (C == null)
|
|
411
411
|
return;
|
|
@@ -418,18 +418,18 @@ function $(i, e, n) {
|
|
|
418
418
|
if (v == null)
|
|
419
419
|
return;
|
|
420
420
|
const { startX: R, startY: _ } = C, { startX: b, startY: w } = v;
|
|
421
|
-
let
|
|
422
|
-
C.startX === v.endX && (
|
|
421
|
+
let P = Q(R + c, 1), D = Q(_ + g, 1), T = Q(b + m - P, 1), U = Q(w + S - D, 1);
|
|
422
|
+
C.startX === v.endX && (T = 0), C.startY === v.endY && (U = 0);
|
|
423
423
|
const M = n.getCurrentSkeleton(), I = M.rowHeaderWidth + M.columnTotalWidth, A = M.columnHeaderHeight + M.rowTotalHeight;
|
|
424
|
-
return
|
|
424
|
+
return P + T > I && (P = I - T), D + U > A && (D = A - U), {
|
|
425
425
|
flipY: s,
|
|
426
426
|
flipX: o,
|
|
427
427
|
angle: a,
|
|
428
428
|
skewX: d,
|
|
429
429
|
skewY: h,
|
|
430
|
-
left:
|
|
430
|
+
left: P,
|
|
431
431
|
top: D,
|
|
432
|
-
width:
|
|
432
|
+
width: T,
|
|
433
433
|
height: U
|
|
434
434
|
};
|
|
435
435
|
}
|
|
@@ -437,19 +437,19 @@ function N(i, e) {
|
|
|
437
437
|
const { left: n = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: d = 0, skewX: h = 0, skewY: l = 0 } = i, c = e.getSelectionCellByPosition(n, t);
|
|
438
438
|
if (c == null)
|
|
439
439
|
return;
|
|
440
|
-
const
|
|
440
|
+
const u = {
|
|
441
441
|
column: c.actualColumn,
|
|
442
442
|
columnOffset: Q(n - c.startX, 1),
|
|
443
443
|
row: c.actualRow,
|
|
444
444
|
rowOffset: Q(t - c.startY, 1)
|
|
445
|
-
},
|
|
446
|
-
if (
|
|
445
|
+
}, g = e.getSelectionCellByPosition(n + r, t + s);
|
|
446
|
+
if (g == null)
|
|
447
447
|
return;
|
|
448
448
|
const f = {
|
|
449
|
-
column:
|
|
450
|
-
columnOffset: Q(n + r -
|
|
451
|
-
row:
|
|
452
|
-
rowOffset: Q(t + s -
|
|
449
|
+
column: g.actualColumn,
|
|
450
|
+
columnOffset: Q(n + r - g.startX, 1),
|
|
451
|
+
row: g.actualRow,
|
|
452
|
+
rowOffset: Q(t + s - g.startY, 1)
|
|
453
453
|
};
|
|
454
454
|
return {
|
|
455
455
|
flipY: o,
|
|
@@ -457,16 +457,16 @@ function N(i, e) {
|
|
|
457
457
|
angle: d,
|
|
458
458
|
skewX: h,
|
|
459
459
|
skewY: l,
|
|
460
|
-
from:
|
|
460
|
+
from: u,
|
|
461
461
|
to: f
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
|
-
var
|
|
465
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
464
|
+
var Sr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Ir = (i, e, n, t) => {
|
|
465
|
+
for (var r = t > 1 ? void 0 : t ? Cr(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
466
466
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
467
|
-
return t && r &&
|
|
468
|
-
},
|
|
469
|
-
let Ue = class extends
|
|
467
|
+
return t && r && Sr(e, n, r), r;
|
|
468
|
+
}, X = (i, e) => (n, t) => e(n, t, i);
|
|
469
|
+
let Ue = class extends oe {
|
|
470
470
|
constructor(i, e, n, t, r, s, o, a, d, h) {
|
|
471
471
|
super(), this._commandService = i, this._univerInstanceService = e, this._selectionManagerService = n, this._imageIoService = t, this._sheetDrawingService = r, this._drawingManagerService = s, this._contextService = o, this._messageService = a, this._localeService = d, this._renderManagerService = h, this._init();
|
|
472
472
|
}
|
|
@@ -480,7 +480,7 @@ let Ue = class extends ae {
|
|
|
480
480
|
get _skeletonManagerService() {
|
|
481
481
|
return this._renderManagerService.getRenderById(
|
|
482
482
|
this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET).getUnitId()
|
|
483
|
-
).with(
|
|
483
|
+
).with(re);
|
|
484
484
|
}
|
|
485
485
|
_init() {
|
|
486
486
|
this._initCommandListeners(), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._drawingAddListener();
|
|
@@ -496,10 +496,10 @@ let Ue = class extends ae {
|
|
|
496
496
|
if (e.files == null)
|
|
497
497
|
return;
|
|
498
498
|
const n = e.files.length;
|
|
499
|
-
if (n >
|
|
499
|
+
if (n > dt) {
|
|
500
500
|
this._messageService.show({
|
|
501
501
|
type: be.Error,
|
|
502
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(
|
|
502
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(dt))
|
|
503
503
|
});
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
@@ -520,13 +520,13 @@ let Ue = class extends ae {
|
|
|
520
520
|
e = await this._imageIoService.saveImage(i);
|
|
521
521
|
} catch (C) {
|
|
522
522
|
const v = C.message;
|
|
523
|
-
v ===
|
|
523
|
+
v === ke.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
524
524
|
type: be.Error,
|
|
525
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
526
|
-
}) : v ===
|
|
525
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(Cn / (1024 * 1024)))
|
|
526
|
+
}) : v === ke.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
527
527
|
type: be.Error,
|
|
528
528
|
content: this._localeService.t("update-status.invalidImageType")
|
|
529
|
-
}) : v ===
|
|
529
|
+
}) : v === ke.ERROR_IMAGE && this._messageService.show({
|
|
530
530
|
type: be.Error,
|
|
531
531
|
content: this._localeService.t("update-status.invalidImage")
|
|
532
532
|
});
|
|
@@ -536,17 +536,17 @@ let Ue = class extends ae {
|
|
|
536
536
|
const n = this._getUnitInfo();
|
|
537
537
|
if (n == null)
|
|
538
538
|
return;
|
|
539
|
-
const { unitId: t, subUnitId: r } = n, { imageId: s, imageSourceType: o, source: a, base64Cache: d } = e, { width: h, height: l, image: c } = await
|
|
540
|
-
if (
|
|
539
|
+
const { unitId: t, subUnitId: r } = n, { imageId: s, imageSourceType: o, source: a, base64Cache: d } = e, { width: h, height: l, image: c } = await In(d || ""), u = this._renderManagerService.getRenderById(t);
|
|
540
|
+
if (u == null)
|
|
541
541
|
return;
|
|
542
|
-
const { width:
|
|
542
|
+
const { width: g, height: f } = u.scene;
|
|
543
543
|
this._imageIoService.addImageSourceCache(a, o, c);
|
|
544
544
|
let m = 1;
|
|
545
|
-
if (h >
|
|
546
|
-
const C =
|
|
545
|
+
if (h > lt || l > ut) {
|
|
546
|
+
const C = lt / h, v = ut / l;
|
|
547
547
|
m = Math.max(C, v);
|
|
548
548
|
}
|
|
549
|
-
const p = this._getImagePosition(h * m, l * m,
|
|
549
|
+
const p = this._getImagePosition(h * m, l * m, g, f);
|
|
550
550
|
if (p == null)
|
|
551
551
|
return;
|
|
552
552
|
const S = {
|
|
@@ -586,7 +586,7 @@ let Ue = class extends ae {
|
|
|
586
586
|
endColumn: 0
|
|
587
587
|
};
|
|
588
588
|
r && r.length > 0 && (s = r[r.length - 1].range);
|
|
589
|
-
const o =
|
|
589
|
+
const o = Un(this._skeletonManagerService.getCurrent().skeleton, s);
|
|
590
590
|
if (o == null)
|
|
591
591
|
return;
|
|
592
592
|
let { startColumn: a, startRow: d, startX: h, startY: l } = o, c = !1;
|
|
@@ -596,29 +596,29 @@ let Ue = class extends ae {
|
|
|
596
596
|
return;
|
|
597
597
|
h = m.startX, l = m.startY, a = m.actualColumn, d = m.actualRow;
|
|
598
598
|
}
|
|
599
|
-
const
|
|
599
|
+
const u = {
|
|
600
600
|
column: a,
|
|
601
601
|
columnOffset: 0,
|
|
602
602
|
row: d,
|
|
603
603
|
rowOffset: 0
|
|
604
|
-
},
|
|
605
|
-
if (
|
|
604
|
+
}, g = this._selectionRenderService.getSelectionCellByPosition(h + i, l + e);
|
|
605
|
+
if (g == null)
|
|
606
606
|
return;
|
|
607
607
|
const f = {
|
|
608
|
-
column:
|
|
609
|
-
columnOffset: h + i -
|
|
610
|
-
row:
|
|
611
|
-
rowOffset: l + e -
|
|
608
|
+
column: g.actualColumn,
|
|
609
|
+
columnOffset: h + i - g.startX,
|
|
610
|
+
row: g.actualRow,
|
|
611
|
+
rowOffset: l + e - g.startY
|
|
612
612
|
};
|
|
613
613
|
return {
|
|
614
|
-
from:
|
|
614
|
+
from: u,
|
|
615
615
|
to: f
|
|
616
616
|
};
|
|
617
617
|
}
|
|
618
618
|
_updateOrderListener() {
|
|
619
619
|
this._drawingManagerService.featurePluginOrderUpdate$.subscribe((i) => {
|
|
620
620
|
const { unitId: e, subUnitId: n, drawingIds: t, arrangeType: r } = i;
|
|
621
|
-
this._commandService.executeCommand(
|
|
621
|
+
this._commandService.executeCommand(xt.id, {
|
|
622
622
|
unitId: e,
|
|
623
623
|
subUnitId: n,
|
|
624
624
|
drawingIds: t,
|
|
@@ -653,11 +653,11 @@ let Ue = class extends ae {
|
|
|
653
653
|
}
|
|
654
654
|
_groupDrawingListener() {
|
|
655
655
|
this._drawingManagerService.featurePluginGroupUpdate$.subscribe((i) => {
|
|
656
|
-
this._commandService.executeCommand(
|
|
656
|
+
this._commandService.executeCommand(Ft.id, i);
|
|
657
657
|
const { unitId: e, subUnitId: n, drawingId: t } = i[0].parent;
|
|
658
658
|
this._drawingManagerService.focusDrawing([{ unitId: e, subUnitId: n, drawingId: t }]);
|
|
659
659
|
}), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((i) => {
|
|
660
|
-
this._commandService.executeCommand(
|
|
660
|
+
this._commandService.executeCommand(Yt.id, i);
|
|
661
661
|
});
|
|
662
662
|
}
|
|
663
663
|
_focusDrawingListener() {
|
|
@@ -686,18 +686,18 @@ let Ue = class extends ae {
|
|
|
686
686
|
this._drawingManagerService.registerDrawingData(e, this._sheetDrawingService.getDrawingDataForUnit(e)), this._drawingManagerService.initializeNotification(e);
|
|
687
687
|
}
|
|
688
688
|
};
|
|
689
|
-
Ue =
|
|
690
|
-
se
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
689
|
+
Ue = Ir([
|
|
690
|
+
ie(se.Rendered, Ue),
|
|
691
|
+
X(0, V),
|
|
692
|
+
X(1, he),
|
|
693
|
+
X(2, W(Zn)),
|
|
694
|
+
X(3, vt),
|
|
695
|
+
X(4, k),
|
|
696
|
+
X(5, z),
|
|
697
|
+
X(6, _t),
|
|
698
|
+
X(7, Fn),
|
|
699
|
+
X(8, W(_e)),
|
|
700
|
+
X(9, K)
|
|
701
701
|
], Ue);
|
|
702
702
|
var Y = function() {
|
|
703
703
|
return Y = Object.assign || function(i) {
|
|
@@ -707,23 +707,23 @@ var Y = function() {
|
|
|
707
707
|
}
|
|
708
708
|
return i;
|
|
709
709
|
}, Y.apply(this, arguments);
|
|
710
|
-
},
|
|
710
|
+
}, Rr = function(i, e) {
|
|
711
711
|
var n = {};
|
|
712
712
|
for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
|
|
713
713
|
if (i != null && typeof Object.getOwnPropertySymbols == "function")
|
|
714
714
|
for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
|
|
715
715
|
e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
|
|
716
716
|
return n;
|
|
717
|
-
},
|
|
718
|
-
var n = i.icon, t = i.id, r = i.className, s = i.extend, o =
|
|
717
|
+
}, kt = Lt(function(i, e) {
|
|
718
|
+
var n = i.icon, t = i.id, r = i.className, s = i.extend, o = Rr(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = Bt("_".concat(br()));
|
|
719
719
|
return Ht(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, Y({ ref: e, className: a }, o), s);
|
|
720
720
|
});
|
|
721
721
|
function Ht(i, e, n, t, r) {
|
|
722
|
-
return
|
|
722
|
+
return Wt(i.tag, Y(Y({ key: e }, Mr(i, n, r)), t), (Dr(i, n).children || []).map(function(s, o) {
|
|
723
723
|
return Ht(s, "".concat(e, "-").concat(i.tag, "-").concat(o), n, void 0, r);
|
|
724
724
|
}));
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function Mr(i, e, n) {
|
|
727
727
|
var t = Y({}, i.attrs);
|
|
728
728
|
n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
|
|
729
729
|
var r = e.defIds;
|
|
@@ -732,96 +732,96 @@ function Rr(i, e, n) {
|
|
|
732
732
|
typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
733
733
|
})), t;
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function Dr(i, e) {
|
|
736
736
|
var n, t = e.defIds;
|
|
737
737
|
return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? Y(Y({}, i), { children: i.children.map(function(r) {
|
|
738
738
|
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? Y(Y({}, r), { attrs: Y(Y({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
|
|
739
739
|
}) }) : i;
|
|
740
740
|
}
|
|
741
|
-
function
|
|
741
|
+
function br() {
|
|
742
742
|
return Math.random().toString(36).substring(2, 8);
|
|
743
743
|
}
|
|
744
|
-
|
|
745
|
-
var
|
|
746
|
-
return
|
|
744
|
+
kt.displayName = "UniverIcon";
|
|
745
|
+
var Er = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, Xt = Lt(function(i, e) {
|
|
746
|
+
return Wt(kt, Object.assign({}, i, {
|
|
747
747
|
id: "add-image-single",
|
|
748
748
|
ref: e,
|
|
749
|
-
icon:
|
|
749
|
+
icon: Er
|
|
750
750
|
}));
|
|
751
751
|
});
|
|
752
752
|
Xt.displayName = "AddImageSingle";
|
|
753
|
-
const
|
|
754
|
-
uploadFileMenu:
|
|
755
|
-
uploadFileMenuInput:
|
|
756
|
-
},
|
|
753
|
+
const yr = "univer-upload-file-menu", Or = "univer-upload-file-menu-input", wt = {
|
|
754
|
+
uploadFileMenu: yr,
|
|
755
|
+
uploadFileMenuInput: Or
|
|
756
|
+
}, zt = "COMPONENT_UPLOAD_FILE_MENU";
|
|
757
757
|
var We = /* @__PURE__ */ ((i) => (i[i.cellImage = 0] = "cellImage", i[i.floatImage = 1] = "floatImage", i))(We || {});
|
|
758
|
-
const
|
|
759
|
-
const { type: e } = i, n = ee(V), t =
|
|
758
|
+
const Pr = (i) => {
|
|
759
|
+
const { type: e } = i, n = ee(V), t = Bt(null), r = () => {
|
|
760
760
|
var a;
|
|
761
761
|
(a = t.current) == null || a.click();
|
|
762
|
-
}, s =
|
|
762
|
+
}, s = Rn.map((a) => `.${a.replace("image/", "")}`).join(","), o = (a) => {
|
|
763
763
|
const d = a.target.files;
|
|
764
764
|
if (d == null)
|
|
765
765
|
return;
|
|
766
766
|
const h = Array.from(d);
|
|
767
767
|
e === We.floatImage ? n.executeCommand(xe.id, { files: h }) : e === We.cellImage && n.executeCommand(Be.id, { files: h }), t.current && (t.current.value = "");
|
|
768
768
|
};
|
|
769
|
-
return /* @__PURE__ */ L.createElement("div", { onClick: r, className:
|
|
769
|
+
return /* @__PURE__ */ L.createElement("div", { onClick: r, className: wt.uploadFileMenu }, /* @__PURE__ */ L.createElement(
|
|
770
770
|
"input",
|
|
771
771
|
{
|
|
772
772
|
type: "file",
|
|
773
|
-
className:
|
|
773
|
+
className: wt.uploadFileMenuInput,
|
|
774
774
|
ref: t,
|
|
775
775
|
onChange: o,
|
|
776
776
|
accept: s,
|
|
777
777
|
multiple: !0
|
|
778
778
|
}
|
|
779
779
|
));
|
|
780
|
-
},
|
|
780
|
+
}, Kt = "addition-and-subtraction-single", Jt = "sheet.menu.image";
|
|
781
781
|
function Tr(i) {
|
|
782
782
|
return {
|
|
783
|
-
id:
|
|
784
|
-
type:
|
|
785
|
-
positions: [
|
|
786
|
-
group:
|
|
787
|
-
icon:
|
|
783
|
+
id: Jt,
|
|
784
|
+
type: St.SUBITEMS,
|
|
785
|
+
positions: [Yn.TOOLBAR_START],
|
|
786
|
+
group: kn.TOOLBAR_FORMULAS_INSERT,
|
|
787
|
+
icon: Kt,
|
|
788
788
|
tooltip: "sheetImage.title",
|
|
789
|
-
hidden$:
|
|
790
|
-
disabled$:
|
|
789
|
+
hidden$: Ct(i, B.UNIVER_SHEET),
|
|
790
|
+
disabled$: An(i, { workbookTypes: [Ze], worksheetTypes: [Pe], rangeTypes: [qn] })
|
|
791
791
|
};
|
|
792
792
|
}
|
|
793
|
-
function
|
|
793
|
+
function Ur(i) {
|
|
794
794
|
return {
|
|
795
795
|
id: xe.id,
|
|
796
796
|
title: "sheetImage.upload.float",
|
|
797
|
-
type:
|
|
797
|
+
type: St.SELECTOR,
|
|
798
798
|
label: {
|
|
799
|
-
name:
|
|
799
|
+
name: zt,
|
|
800
800
|
props: {
|
|
801
801
|
type: We.floatImage
|
|
802
802
|
}
|
|
803
803
|
},
|
|
804
|
-
positions: [
|
|
805
|
-
hidden$:
|
|
804
|
+
positions: [Jt],
|
|
805
|
+
hidden$: Ct(i, B.UNIVER_SHEET)
|
|
806
806
|
};
|
|
807
807
|
}
|
|
808
|
-
const
|
|
809
|
-
imageCommonPanel:
|
|
810
|
-
imageCommonPanelGrid:
|
|
811
|
-
imageCommonPanelBorder:
|
|
812
|
-
imageCommonPanelTitle:
|
|
813
|
-
imageCommonPanelSubtitle:
|
|
814
|
-
imageCommonPanelRow:
|
|
815
|
-
imageCommonPanelRowVertical:
|
|
816
|
-
imageCommonPanelColumn:
|
|
817
|
-
imageCommonPanelColumnCenter:
|
|
818
|
-
imageCommonPanelInline:
|
|
819
|
-
imageCommonPanelSpan2:
|
|
820
|
-
imageCommonPanelSpan3:
|
|
821
|
-
imageCommonPanelInput:
|
|
808
|
+
const Ar = "univer-image-common-panel", Nr = "univer-image-common-panel-grid", jr = "univer-image-common-panel-border", Lr = "univer-image-common-panel-title", Br = "univer-image-common-panel-subtitle", Wr = "univer-image-common-panel-row", $r = "univer-image-common-panel-row-vertical", Vr = "univer-image-common-panel-column", Gr = "univer-image-common-panel-column-center", xr = "univer-image-common-panel-inline", Fr = "univer-image-common-panel-span2", Yr = "univer-image-common-panel-span3", kr = "univer-image-common-panel-input", Hr = "univer-sheet-image-menu", Xr = "univer-sheet-image-menu-input", Z = {
|
|
809
|
+
imageCommonPanel: Ar,
|
|
810
|
+
imageCommonPanelGrid: Nr,
|
|
811
|
+
imageCommonPanelBorder: jr,
|
|
812
|
+
imageCommonPanelTitle: Lr,
|
|
813
|
+
imageCommonPanelSubtitle: Br,
|
|
814
|
+
imageCommonPanelRow: Wr,
|
|
815
|
+
imageCommonPanelRowVertical: $r,
|
|
816
|
+
imageCommonPanelColumn: Vr,
|
|
817
|
+
imageCommonPanelColumnCenter: Gr,
|
|
818
|
+
imageCommonPanelInline: xr,
|
|
819
|
+
imageCommonPanelSpan2: Fr,
|
|
820
|
+
imageCommonPanelSpan3: Yr,
|
|
821
|
+
imageCommonPanelInput: kr,
|
|
822
822
|
sheetImageMenu: Hr,
|
|
823
823
|
sheetImageMenuInput: Xr
|
|
824
|
-
},
|
|
824
|
+
}, zr = (i) => {
|
|
825
825
|
var v;
|
|
826
826
|
const e = ee(V), n = ee(_e), t = ee(z), r = ee(K), { drawings: s } = i, o = s[0];
|
|
827
827
|
if (o == null)
|
|
@@ -829,16 +829,16 @@ const Ur = "univer-image-common-panel", Ar = "univer-image-common-panel-grid", N
|
|
|
829
829
|
const { unitId: a } = o, d = r.getRenderById(a), h = d == null ? void 0 : d.scene;
|
|
830
830
|
if (h == null)
|
|
831
831
|
return;
|
|
832
|
-
const l = h.getTransformerByCreate(), [c,
|
|
832
|
+
const l = h.getTransformerByCreate(), [c, u] = et(!0), g = (v = o.anchorType) != null ? v : O.Position, [f, m] = et(g);
|
|
833
833
|
function p(R, _) {
|
|
834
834
|
const b = [];
|
|
835
835
|
return R.forEach((w) => {
|
|
836
|
-
const { oKey:
|
|
836
|
+
const { oKey: P } = w, D = _.getDrawingOKey(P);
|
|
837
837
|
if (D == null)
|
|
838
838
|
return b.push(null), !0;
|
|
839
|
-
const { unitId:
|
|
839
|
+
const { unitId: T, subUnitId: U, drawingId: M, drawingType: I, anchorType: A, sheetTransform: G } = D;
|
|
840
840
|
b.push({
|
|
841
|
-
unitId:
|
|
841
|
+
unitId: T,
|
|
842
842
|
subUnitId: U,
|
|
843
843
|
drawingId: M,
|
|
844
844
|
anchorType: A,
|
|
@@ -849,16 +849,16 @@ const Ur = "univer-image-common-panel", Ar = "univer-image-common-panel-grid", N
|
|
|
849
849
|
}
|
|
850
850
|
rt(() => {
|
|
851
851
|
const R = l.clearControl$.subscribe((b) => {
|
|
852
|
-
b === !0 &&
|
|
852
|
+
b === !0 && u(!1);
|
|
853
853
|
}), _ = l.changeStart$.subscribe((b) => {
|
|
854
854
|
var D;
|
|
855
|
-
const { objects: w } = b,
|
|
856
|
-
if (
|
|
857
|
-
|
|
858
|
-
else if (
|
|
859
|
-
|
|
860
|
-
const
|
|
861
|
-
m(
|
|
855
|
+
const { objects: w } = b, P = p(w, t);
|
|
856
|
+
if (P.length === 0)
|
|
857
|
+
u(!1);
|
|
858
|
+
else if (P.length >= 1) {
|
|
859
|
+
u(!0);
|
|
860
|
+
const T = ((D = P[0]) == null ? void 0 : D.anchorType) || O.Position;
|
|
861
|
+
m(T);
|
|
862
862
|
}
|
|
863
863
|
});
|
|
864
864
|
return () => {
|
|
@@ -882,8 +882,8 @@ const Ur = "univer-image-common-panel", Ar = "univer-image-common-panel-grid", N
|
|
|
882
882
|
});
|
|
883
883
|
}
|
|
884
884
|
const C = (R) => R ? "block" : "none";
|
|
885
|
-
return /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelGrid, Z.imageCommonPanelBorder), style: { display: C(c) } }, /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanelRow }, /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelColumn, Z.imageCommonPanelTitle) }, /* @__PURE__ */ L.createElement("div", null, n.t("drawing-anchor.title")))), /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelRow) }, /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelColumn) }, /* @__PURE__ */ L.createElement(
|
|
886
|
-
},
|
|
885
|
+
return /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelGrid, Z.imageCommonPanelBorder), style: { display: C(c) } }, /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanelRow }, /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelColumn, Z.imageCommonPanelTitle) }, /* @__PURE__ */ L.createElement("div", null, n.t("drawing-anchor.title")))), /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelRow) }, /* @__PURE__ */ L.createElement("div", { className: Ee(Z.imageCommonPanelColumn) }, /* @__PURE__ */ L.createElement(cr, { value: f, onChange: S, direction: "vertical" }, /* @__PURE__ */ L.createElement(Xe, { value: O.Both }, n.t("drawing-anchor.both")), /* @__PURE__ */ L.createElement(Xe, { value: O.Position }, n.t("drawing-anchor.position")), /* @__PURE__ */ L.createElement(Xe, { value: O.None }, n.t("drawing-anchor.none"))))));
|
|
886
|
+
}, Kr = () => {
|
|
887
887
|
const i = ee(z), e = i.getFocusDrawings(), [n, t] = et(e);
|
|
888
888
|
return rt(() => {
|
|
889
889
|
const r = i.focus$.subscribe((s) => {
|
|
@@ -892,23 +892,23 @@ const Ur = "univer-image-common-panel", Ar = "univer-image-common-panel-grid", N
|
|
|
892
892
|
return () => {
|
|
893
893
|
r.unsubscribe();
|
|
894
894
|
};
|
|
895
|
-
}, []), !!(n != null && n.length) && /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanel }, /* @__PURE__ */ L.createElement(
|
|
895
|
+
}, []), !!(n != null && n.length) && /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanel }, /* @__PURE__ */ L.createElement(wn, { drawings: n }), /* @__PURE__ */ L.createElement(zr, { drawings: n }));
|
|
896
896
|
}, ve = {
|
|
897
897
|
id: "sheet.command.move-drawing",
|
|
898
898
|
type: F.COMMAND,
|
|
899
899
|
handler: (i, e) => {
|
|
900
|
-
const n = i.get(V), t = i.get(
|
|
900
|
+
const n = i.get(V), t = i.get(k), r = i.get(Ge), { direction: s } = e, o = t.getFocusDrawings();
|
|
901
901
|
if (o.length === 0)
|
|
902
902
|
return !1;
|
|
903
903
|
const a = o[0].unitId, d = o.map((l) => {
|
|
904
904
|
const { transform: c } = l;
|
|
905
905
|
if (c == null)
|
|
906
906
|
return null;
|
|
907
|
-
const
|
|
908
|
-
return s === q.UP ?
|
|
907
|
+
const u = { ...c }, { left: g = 0, top: f = 0 } = c;
|
|
908
|
+
return s === q.UP ? u.top = f - 1 : s === q.DOWN ? u.top = f + 1 : s === q.LEFT ? u.left = g - 1 : s === q.RIGHT && (u.left = g + 1), {
|
|
909
909
|
...l,
|
|
910
|
-
transform:
|
|
911
|
-
sheetTransform: N(
|
|
910
|
+
transform: u,
|
|
911
|
+
sheetTransform: N(u, r)
|
|
912
912
|
};
|
|
913
913
|
}).filter((l) => l != null);
|
|
914
914
|
return n.syncExecuteCommand(Fe.id, {
|
|
@@ -916,11 +916,11 @@ const Ur = "univer-image-common-panel", Ar = "univer-image-common-panel-grid", N
|
|
|
916
916
|
drawings: d
|
|
917
917
|
}) ? (n.syncExecuteCommand(j.id, [a]), !0) : !1;
|
|
918
918
|
}
|
|
919
|
-
},
|
|
919
|
+
}, Zt = {
|
|
920
920
|
id: "sheet.command.delete-drawing",
|
|
921
921
|
type: F.COMMAND,
|
|
922
922
|
handler: (i) => {
|
|
923
|
-
const e = i.get(V), t = i.get(
|
|
923
|
+
const e = i.get(V), t = i.get(k).getFocusDrawings();
|
|
924
924
|
if (t.length === 0)
|
|
925
925
|
return !1;
|
|
926
926
|
const r = t[0].unitId, s = t.map((o) => {
|
|
@@ -939,9 +939,9 @@ const Ur = "univer-image-common-panel", Ar = "univer-image-common-panel-grid", N
|
|
|
939
939
|
}
|
|
940
940
|
};
|
|
941
941
|
function Se(i) {
|
|
942
|
-
return !i.getContextValue(
|
|
942
|
+
return !i.getContextValue(sn) && !i.getContextValue(on) && i.getContextValue(we);
|
|
943
943
|
}
|
|
944
|
-
const
|
|
944
|
+
const Jr = {
|
|
945
945
|
id: ve.id,
|
|
946
946
|
description: "shortcut.sheet.drawing-move-down",
|
|
947
947
|
group: "4_sheet-drawing-view",
|
|
@@ -951,7 +951,7 @@ const Kr = {
|
|
|
951
951
|
staticParameters: {
|
|
952
952
|
direction: q.DOWN
|
|
953
953
|
}
|
|
954
|
-
},
|
|
954
|
+
}, Zr = {
|
|
955
955
|
id: ve.id,
|
|
956
956
|
description: "shortcut.sheet.drawing-move-up",
|
|
957
957
|
group: "4_sheet-drawing-view",
|
|
@@ -961,7 +961,7 @@ const Kr = {
|
|
|
961
961
|
staticParameters: {
|
|
962
962
|
direction: q.UP
|
|
963
963
|
}
|
|
964
|
-
},
|
|
964
|
+
}, qr = {
|
|
965
965
|
id: ve.id,
|
|
966
966
|
description: "shortcut.sheet.drawing-move-left",
|
|
967
967
|
group: "4_sheet-drawing-view",
|
|
@@ -971,7 +971,7 @@ const Kr = {
|
|
|
971
971
|
staticParameters: {
|
|
972
972
|
direction: q.LEFT
|
|
973
973
|
}
|
|
974
|
-
},
|
|
974
|
+
}, Qr = {
|
|
975
975
|
id: ve.id,
|
|
976
976
|
description: "shortcut.sheet.drawing-move-right",
|
|
977
977
|
group: "4_sheet-drawing-view",
|
|
@@ -981,8 +981,8 @@ const Kr = {
|
|
|
981
981
|
staticParameters: {
|
|
982
982
|
direction: q.RIGHT
|
|
983
983
|
}
|
|
984
|
-
},
|
|
985
|
-
id:
|
|
984
|
+
}, ei = {
|
|
985
|
+
id: Zt.id,
|
|
986
986
|
description: "shortcut.sheet.drawing-delete",
|
|
987
987
|
group: "4_sheet-drawing-view",
|
|
988
988
|
// when focusing on any other input tag do not trigger this shortcut
|
|
@@ -990,25 +990,25 @@ const Kr = {
|
|
|
990
990
|
binding: ue.DELETE,
|
|
991
991
|
mac: ue.BACKSPACE
|
|
992
992
|
};
|
|
993
|
-
var
|
|
994
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
993
|
+
var ti = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, ri = (i, e, n, t) => {
|
|
994
|
+
for (var r = t > 1 ? void 0 : t ? ni(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
995
995
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
996
|
-
return t && r &&
|
|
996
|
+
return t && r && ti(e, n, r), r;
|
|
997
997
|
}, me = (i, e) => (n, t) => e(n, t, i);
|
|
998
|
-
const
|
|
999
|
-
let pe = class extends
|
|
998
|
+
const ii = {};
|
|
999
|
+
let pe = class extends oe {
|
|
1000
1000
|
constructor(i, e, n, t, r, s) {
|
|
1001
1001
|
super(), this._config = i, this._injector = e, this._componentManager = n, this._menuService = t, this._commandService = r, this._shortcutService = s, this._init();
|
|
1002
1002
|
}
|
|
1003
1003
|
_initCustomComponents() {
|
|
1004
1004
|
const i = this._componentManager;
|
|
1005
|
-
this.disposeWithMe(i.register(
|
|
1005
|
+
this.disposeWithMe(i.register(Kt, Xt)), this.disposeWithMe(i.register(zt, Pr)), this.disposeWithMe(i.register($t, Kr));
|
|
1006
1006
|
}
|
|
1007
1007
|
_initMenus() {
|
|
1008
1008
|
const { menu: i = {} } = this._config;
|
|
1009
1009
|
[
|
|
1010
1010
|
Tr,
|
|
1011
|
-
|
|
1011
|
+
Ur
|
|
1012
1012
|
// UploadCellImageMenuFactory,
|
|
1013
1013
|
].forEach((e) => {
|
|
1014
1014
|
this._menuService.addMenuItem(e(this._injector), i);
|
|
@@ -1021,24 +1021,24 @@ let pe = class extends ae {
|
|
|
1021
1021
|
st,
|
|
1022
1022
|
it,
|
|
1023
1023
|
Fe,
|
|
1024
|
-
$t,
|
|
1025
|
-
j,
|
|
1026
1024
|
Vt,
|
|
1027
|
-
|
|
1025
|
+
j,
|
|
1026
|
+
Gt,
|
|
1028
1027
|
Ft,
|
|
1028
|
+
Yt,
|
|
1029
1029
|
ve,
|
|
1030
|
-
|
|
1031
|
-
|
|
1030
|
+
Zt,
|
|
1031
|
+
xt
|
|
1032
1032
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
1033
1033
|
}
|
|
1034
1034
|
_initShortcuts() {
|
|
1035
1035
|
[
|
|
1036
1036
|
// sheet drawing shortcuts
|
|
1037
|
-
Kr,
|
|
1038
1037
|
Jr,
|
|
1039
1038
|
Zr,
|
|
1040
1039
|
qr,
|
|
1041
|
-
Qr
|
|
1040
|
+
Qr,
|
|
1041
|
+
ei
|
|
1042
1042
|
].forEach((i) => {
|
|
1043
1043
|
this.disposeWithMe(this._shortcutService.registerShortcut(i));
|
|
1044
1044
|
});
|
|
@@ -1047,21 +1047,20 @@ let pe = class extends ae {
|
|
|
1047
1047
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
1048
1048
|
}
|
|
1049
1049
|
};
|
|
1050
|
-
pe =
|
|
1051
|
-
se
|
|
1050
|
+
pe = ri([
|
|
1051
|
+
ie(se.Rendered, pe),
|
|
1052
1052
|
me(1, W(nt)),
|
|
1053
1053
|
me(2, W(Hn)),
|
|
1054
1054
|
me(3, Xn),
|
|
1055
1055
|
me(4, V),
|
|
1056
|
-
me(5,
|
|
1056
|
+
me(5, zn)
|
|
1057
1057
|
], pe);
|
|
1058
|
-
var
|
|
1059
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1058
|
+
var si = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, ai = (i, e, n, t) => {
|
|
1059
|
+
for (var r = t > 1 ? void 0 : t ? oi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1060
1060
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
1061
|
-
return t && r &&
|
|
1062
|
-
},
|
|
1063
|
-
const
|
|
1064
|
-
Ct.id,
|
|
1061
|
+
return t && r && si(e, n, r), r;
|
|
1062
|
+
}, ce = (i, e) => (n, t) => e(n, t, i);
|
|
1063
|
+
const ci = [
|
|
1065
1064
|
It.id,
|
|
1066
1065
|
Rt.id,
|
|
1067
1066
|
Mt.id,
|
|
@@ -1069,23 +1068,24 @@ const ai = [
|
|
|
1069
1068
|
bt.id,
|
|
1070
1069
|
Et.id,
|
|
1071
1070
|
yt.id,
|
|
1071
|
+
Ot.id,
|
|
1072
1072
|
qe.id,
|
|
1073
1073
|
Qe.id,
|
|
1074
|
-
Ot.id,
|
|
1075
|
-
Tt.id,
|
|
1076
1074
|
Pt.id,
|
|
1075
|
+
Tt.id,
|
|
1077
1076
|
Ut.id,
|
|
1078
1077
|
At.id,
|
|
1079
|
-
Nt.id
|
|
1080
|
-
|
|
1081
|
-
|
|
1078
|
+
Nt.id,
|
|
1079
|
+
jt.id
|
|
1080
|
+
], di = [
|
|
1082
1081
|
Qn.id,
|
|
1083
1082
|
er.id,
|
|
1084
1083
|
tr.id,
|
|
1085
1084
|
nr.id,
|
|
1086
|
-
rr.id
|
|
1085
|
+
rr.id,
|
|
1086
|
+
ir.id
|
|
1087
1087
|
];
|
|
1088
|
-
let Ae = class extends
|
|
1088
|
+
let Ae = class extends oe {
|
|
1089
1089
|
constructor(i, e, n, t, r, s) {
|
|
1090
1090
|
super(), this._commandService = i, this._sheetInterceptorService = e, this._renderManagerService = n, this._sheetDrawingService = t, this._drawingManagerService = r, this._univerInstanceService = s, this._init();
|
|
1091
1091
|
}
|
|
@@ -1099,7 +1099,7 @@ let Ae = class extends ae {
|
|
|
1099
1099
|
get _skeletonManagerService() {
|
|
1100
1100
|
return this._renderManagerService.getRenderById(
|
|
1101
1101
|
this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET).getUnitId()
|
|
1102
|
-
).with(
|
|
1102
|
+
).with(re);
|
|
1103
1103
|
}
|
|
1104
1104
|
_init() {
|
|
1105
1105
|
this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
|
|
@@ -1108,54 +1108,54 @@ let Ae = class extends ae {
|
|
|
1108
1108
|
this.disposeWithMe(
|
|
1109
1109
|
this._sheetInterceptorService.interceptCommand({
|
|
1110
1110
|
getMutations: (i) => {
|
|
1111
|
-
if (!
|
|
1111
|
+
if (!ci.includes(i.id))
|
|
1112
1112
|
return { redos: [], undos: [] };
|
|
1113
1113
|
if (i.params == null)
|
|
1114
1114
|
return { redos: [], undos: [] };
|
|
1115
1115
|
const e = i.id;
|
|
1116
|
-
if (e === Ct.id)
|
|
1117
|
-
return this._moveRowInterceptor(i.params, "insert");
|
|
1118
1116
|
if (e === It.id)
|
|
1119
|
-
return this.
|
|
1117
|
+
return this._moveRowInterceptor(i.params, "insert");
|
|
1120
1118
|
if (e === Rt.id)
|
|
1121
|
-
return this.
|
|
1119
|
+
return this._moveColInterceptor(i.params, "insert");
|
|
1122
1120
|
if (e === Mt.id)
|
|
1121
|
+
return this._moveRowInterceptor(i.params, "remove");
|
|
1122
|
+
if (e === Dt.id)
|
|
1123
1123
|
return this._moveColInterceptor(i.params, "remove");
|
|
1124
|
-
if (e ===
|
|
1124
|
+
if (e === bt.id) {
|
|
1125
1125
|
const { range: n } = i.params;
|
|
1126
1126
|
return this._getRangeMoveUndo(
|
|
1127
1127
|
n,
|
|
1128
1128
|
0
|
|
1129
1129
|
/* deleteLeft */
|
|
1130
1130
|
);
|
|
1131
|
-
} else if (e ===
|
|
1131
|
+
} else if (e === Et.id) {
|
|
1132
1132
|
const { range: n } = i.params;
|
|
1133
1133
|
return this._getRangeMoveUndo(
|
|
1134
1134
|
n,
|
|
1135
1135
|
1
|
|
1136
1136
|
/* deleteUp */
|
|
1137
1137
|
);
|
|
1138
|
-
} else if (e ===
|
|
1138
|
+
} else if (e === yt.id) {
|
|
1139
1139
|
const { range: n } = i.params;
|
|
1140
1140
|
return this._getRangeMoveUndo(
|
|
1141
1141
|
n,
|
|
1142
1142
|
2
|
|
1143
1143
|
/* insertDown */
|
|
1144
1144
|
);
|
|
1145
|
-
} else if (e ===
|
|
1145
|
+
} else if (e === Ot.id) {
|
|
1146
1146
|
const { range: n } = i.params;
|
|
1147
1147
|
return this._getRangeMoveUndo(
|
|
1148
1148
|
n,
|
|
1149
1149
|
3
|
|
1150
1150
|
/* insertRight */
|
|
1151
1151
|
);
|
|
1152
|
-
} else if (e ===
|
|
1152
|
+
} else if (e === Ut.id || e === At.id) {
|
|
1153
1153
|
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
|
|
1154
1154
|
return this._getDrawingUndoForRowVisible(t, r, s);
|
|
1155
|
-
} else if (e ===
|
|
1155
|
+
} else if (e === Nt.id || e === jt.id) {
|
|
1156
1156
|
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
|
|
1157
1157
|
return this._getDrawingUndoForColVisible(t, r, s);
|
|
1158
|
-
} else if (e === qe.id || e === Qe.id || e ===
|
|
1158
|
+
} else if (e === qe.id || e === Qe.id || e === Pt.id || e === Tt.id) {
|
|
1159
1159
|
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e === qe.id || e === Qe.id;
|
|
1160
1160
|
return this._getDrawingUndoForRowAndColSize(t, r, s, o);
|
|
1161
1161
|
}
|
|
@@ -1170,17 +1170,17 @@ let Ae = class extends ae {
|
|
|
1170
1170
|
return { redos: [], undos: [] };
|
|
1171
1171
|
const t = n.unitId, r = n.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(t, r), d = [], h = [];
|
|
1172
1172
|
if (Object.keys(a).forEach((l) => {
|
|
1173
|
-
const c = a[l], { updateDrawings:
|
|
1174
|
-
d.push(...
|
|
1173
|
+
const c = a[l], { updateDrawings: u, deleteDrawings: g } = this._getUpdateOrDeleteDrawings(i, e, c);
|
|
1174
|
+
d.push(...u), h.push(...g);
|
|
1175
1175
|
}), d.length === 0 && h.length === 0)
|
|
1176
1176
|
return { redos: [], undos: [] };
|
|
1177
1177
|
if (d.length > 0) {
|
|
1178
|
-
const l = this._sheetDrawingService.getBatchUpdateOp(d), { undo: c, redo:
|
|
1179
|
-
s.push({ id: E.id, params: { unitId: t, subUnitId: r, op:
|
|
1178
|
+
const l = this._sheetDrawingService.getBatchUpdateOp(d), { undo: c, redo: u, objects: g } = l;
|
|
1179
|
+
s.push({ id: E.id, params: { unitId: t, subUnitId: r, op: u, objects: g, type: y.UPDATE } }), o.push({ id: E.id, params: { unitId: t, subUnitId: r, op: c, objects: g, type: y.UPDATE } });
|
|
1180
1180
|
}
|
|
1181
1181
|
if (h.length > 0) {
|
|
1182
|
-
const l = this._sheetDrawingService.getBatchRemoveOp(h), c = l.undo,
|
|
1183
|
-
s.push({ id: E.id, params: { unitId: t, subUnitId: r, op:
|
|
1182
|
+
const l = this._sheetDrawingService.getBatchRemoveOp(h), c = l.undo, u = l.redo, g = l.objects;
|
|
1183
|
+
s.push({ id: E.id, params: { unitId: t, subUnitId: r, op: u, objects: g, type: y.REMOVE } }), o.push({ id: E.id, params: { unitId: t, subUnitId: r, op: c, objects: g, type: y.INSERT } });
|
|
1184
1184
|
}
|
|
1185
1185
|
return s.push({ id: j.id, params: [t] }), o.push({ id: j.id, params: [t] }), {
|
|
1186
1186
|
redos: s,
|
|
@@ -1188,7 +1188,7 @@ let Ae = class extends ae {
|
|
|
1188
1188
|
};
|
|
1189
1189
|
}
|
|
1190
1190
|
_getUpdateOrDeleteDrawings(i, e, n) {
|
|
1191
|
-
const t = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: a, unitId: d, subUnitId: h, drawingId: l } = n, { from: c, to:
|
|
1191
|
+
const t = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: a, unitId: d, subUnitId: h, drawingId: l } = n, { from: c, to: u } = s, { row: g, column: f } = c, { row: m, column: p } = u;
|
|
1192
1192
|
if (s == null || a == null)
|
|
1193
1193
|
return {
|
|
1194
1194
|
updateDrawings: t,
|
|
@@ -1196,7 +1196,7 @@ let Ae = class extends ae {
|
|
|
1196
1196
|
};
|
|
1197
1197
|
const { startRow: S, endRow: C, startColumn: v, endColumn: R } = i;
|
|
1198
1198
|
let _ = null, b = null;
|
|
1199
|
-
if (e === 0 &&
|
|
1199
|
+
if (e === 0 && g >= S && m <= C)
|
|
1200
1200
|
if (f >= v && p <= R)
|
|
1201
1201
|
r.push({ unitId: d, subUnitId: h, drawingId: l });
|
|
1202
1202
|
else {
|
|
@@ -1204,7 +1204,7 @@ let Ae = class extends ae {
|
|
|
1204
1204
|
_ = w == null ? void 0 : w.newSheetTransform, b = w == null ? void 0 : w.newTransform;
|
|
1205
1205
|
}
|
|
1206
1206
|
else if (e === 1 && f >= v && p <= R)
|
|
1207
|
-
if (
|
|
1207
|
+
if (g >= S && m <= C)
|
|
1208
1208
|
r.push({ unitId: d, subUnitId: h, drawingId: l });
|
|
1209
1209
|
else {
|
|
1210
1210
|
const w = this._shrinkRow(s, a, S, C, o);
|
|
@@ -1234,57 +1234,57 @@ let Ae = class extends ae {
|
|
|
1234
1234
|
_getDrawingUndoForColVisible(i, e, n) {
|
|
1235
1235
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
|
|
1236
1236
|
if (Object.keys(t).forEach((l) => {
|
|
1237
|
-
const c = t[l], { sheetTransform:
|
|
1237
|
+
const c = t[l], { sheetTransform: u, transform: g, anchorType: f = O.Position } = c;
|
|
1238
1238
|
if (f === O.None)
|
|
1239
|
-
this._remainDrawingSize(
|
|
1239
|
+
this._remainDrawingSize(g, r, c);
|
|
1240
1240
|
else {
|
|
1241
|
-
const { from: m, to: p } =
|
|
1241
|
+
const { from: m, to: p } = u, { row: S, column: C } = m, { row: v, column: R } = p;
|
|
1242
1242
|
for (let _ = 0; _ < n.length; _++) {
|
|
1243
|
-
const b = n[_], { startRow: w, endRow:
|
|
1243
|
+
const b = n[_], { startRow: w, endRow: P, startColumn: D, endColumn: T } = b;
|
|
1244
1244
|
if (R < D)
|
|
1245
1245
|
continue;
|
|
1246
1246
|
if (f === O.Position) {
|
|
1247
1247
|
let I = null, A = null;
|
|
1248
|
-
if (C >= D && C <=
|
|
1249
|
-
const G = this._skeletonManagerService.attachRangeWithCoord({ startColumn: C, endColumn:
|
|
1248
|
+
if (C >= D && C <= T) {
|
|
1249
|
+
const G = this._skeletonManagerService.attachRangeWithCoord({ startColumn: C, endColumn: T, startRow: m.row, endRow: p.row });
|
|
1250
1250
|
if (G == null)
|
|
1251
1251
|
return;
|
|
1252
|
-
A = { ...
|
|
1252
|
+
A = { ...g, left: G.startX };
|
|
1253
1253
|
}
|
|
1254
1254
|
if (A != null && (I = N(A, this._selectionRenderService), I != null && A != null)) {
|
|
1255
1255
|
r.push({ ...c, sheetTransform: I, transform: A });
|
|
1256
1256
|
break;
|
|
1257
1257
|
}
|
|
1258
|
-
this._remainDrawingSize(
|
|
1258
|
+
this._remainDrawingSize(g, r, c);
|
|
1259
1259
|
continue;
|
|
1260
1260
|
}
|
|
1261
|
-
if (C >= D && R <=
|
|
1261
|
+
if (C >= D && R <= T)
|
|
1262
1262
|
continue;
|
|
1263
1263
|
let U = null, M = null;
|
|
1264
|
-
if (C >= D && C <=
|
|
1265
|
-
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: C, endColumn:
|
|
1264
|
+
if (C >= D && C <= T) {
|
|
1265
|
+
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: C, endColumn: T, startRow: m.row, endRow: p.row });
|
|
1266
1266
|
if (I == null)
|
|
1267
1267
|
return;
|
|
1268
1268
|
M = {
|
|
1269
|
-
...
|
|
1269
|
+
...g,
|
|
1270
1270
|
left: (I == null ? void 0 : I.startX) || 0,
|
|
1271
|
-
width: ((
|
|
1271
|
+
width: ((g == null ? void 0 : g.width) || 0) - I.endX + I.startX
|
|
1272
1272
|
};
|
|
1273
|
-
} else if (R >= D && R <=
|
|
1273
|
+
} else if (R >= D && R <= T) {
|
|
1274
1274
|
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn: R, startRow: m.row, endRow: p.row });
|
|
1275
1275
|
if (I == null)
|
|
1276
1276
|
return;
|
|
1277
1277
|
M = {
|
|
1278
|
-
...
|
|
1279
|
-
left: I.startX - ((
|
|
1278
|
+
...g,
|
|
1279
|
+
left: I.startX - ((g == null ? void 0 : g.width) || 0)
|
|
1280
1280
|
};
|
|
1281
1281
|
} else {
|
|
1282
|
-
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn:
|
|
1282
|
+
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn: T, startRow: m.row, endRow: p.row });
|
|
1283
1283
|
if (I == null)
|
|
1284
1284
|
return;
|
|
1285
1285
|
if (M = {
|
|
1286
|
-
...
|
|
1287
|
-
width: ((
|
|
1286
|
+
...g,
|
|
1287
|
+
width: ((g == null ? void 0 : g.width) || 0) - I.endX + I.startX
|
|
1288
1288
|
}, U = N(M, this._selectionRenderService), U != null && M != null) {
|
|
1289
1289
|
s.push({ ...c, sheetTransform: U, transform: M });
|
|
1290
1290
|
break;
|
|
@@ -1294,7 +1294,7 @@ let Ae = class extends ae {
|
|
|
1294
1294
|
r.push({ ...c, sheetTransform: U, transform: M });
|
|
1295
1295
|
break;
|
|
1296
1296
|
} else
|
|
1297
|
-
this._remainDrawingSize(
|
|
1297
|
+
this._remainDrawingSize(g, r, c);
|
|
1298
1298
|
}
|
|
1299
1299
|
}
|
|
1300
1300
|
}), r.length === 0 && s.length === 0)
|
|
@@ -1328,57 +1328,57 @@ let Ae = class extends ae {
|
|
|
1328
1328
|
_getDrawingUndoForRowVisible(i, e, n) {
|
|
1329
1329
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
|
|
1330
1330
|
if (Object.keys(t).forEach((l) => {
|
|
1331
|
-
const c = t[l], { sheetTransform:
|
|
1331
|
+
const c = t[l], { sheetTransform: u, transform: g, anchorType: f = O.Position } = c;
|
|
1332
1332
|
if (f === O.None)
|
|
1333
|
-
this._remainDrawingSize(
|
|
1333
|
+
this._remainDrawingSize(g, r, c);
|
|
1334
1334
|
else {
|
|
1335
|
-
const { from: m, to: p } =
|
|
1335
|
+
const { from: m, to: p } = u, { row: S, column: C } = m, { row: v, column: R } = p;
|
|
1336
1336
|
for (let _ = 0; _ < n.length; _++) {
|
|
1337
|
-
const b = n[_], { startRow: w, endRow:
|
|
1337
|
+
const b = n[_], { startRow: w, endRow: P, startColumn: D, endColumn: T } = b;
|
|
1338
1338
|
if (v < w)
|
|
1339
1339
|
continue;
|
|
1340
1340
|
if (f === O.Position) {
|
|
1341
1341
|
let I = null, A = null;
|
|
1342
|
-
if (S >= w && S <=
|
|
1343
|
-
const G = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: S, endRow:
|
|
1342
|
+
if (S >= w && S <= P) {
|
|
1343
|
+
const G = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: S, endRow: P });
|
|
1344
1344
|
if (G == null)
|
|
1345
1345
|
return;
|
|
1346
|
-
A = { ...
|
|
1346
|
+
A = { ...g, top: G.startY };
|
|
1347
1347
|
}
|
|
1348
1348
|
if (A != null && (I = N(A, this._selectionRenderService), I != null && A != null)) {
|
|
1349
1349
|
r.push({ ...c, sheetTransform: I, transform: A });
|
|
1350
1350
|
break;
|
|
1351
1351
|
}
|
|
1352
|
-
this._remainDrawingSize(
|
|
1352
|
+
this._remainDrawingSize(g, r, c);
|
|
1353
1353
|
continue;
|
|
1354
1354
|
}
|
|
1355
|
-
if (S >= w && v <=
|
|
1355
|
+
if (S >= w && v <= P)
|
|
1356
1356
|
continue;
|
|
1357
1357
|
let U = null, M = null;
|
|
1358
|
-
if (S >= w && S <=
|
|
1359
|
-
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: S, endRow:
|
|
1358
|
+
if (S >= w && S <= P) {
|
|
1359
|
+
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: S, endRow: P });
|
|
1360
1360
|
if (I == null)
|
|
1361
1361
|
return;
|
|
1362
1362
|
M = {
|
|
1363
|
-
...
|
|
1363
|
+
...g,
|
|
1364
1364
|
top: (I == null ? void 0 : I.startY) || 0,
|
|
1365
|
-
height: ((
|
|
1365
|
+
height: ((g == null ? void 0 : g.height) || 0) - I.endY + I.startY
|
|
1366
1366
|
};
|
|
1367
|
-
} else if (v >= w && v <=
|
|
1367
|
+
} else if (v >= w && v <= P) {
|
|
1368
1368
|
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow: v });
|
|
1369
1369
|
if (I == null)
|
|
1370
1370
|
return;
|
|
1371
1371
|
M = {
|
|
1372
|
-
...
|
|
1373
|
-
top: I.startY - ((
|
|
1372
|
+
...g,
|
|
1373
|
+
top: I.startY - ((g == null ? void 0 : g.height) || 0)
|
|
1374
1374
|
};
|
|
1375
1375
|
} else {
|
|
1376
|
-
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow:
|
|
1376
|
+
const I = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow: P });
|
|
1377
1377
|
if (I == null)
|
|
1378
1378
|
return;
|
|
1379
1379
|
if (M = {
|
|
1380
|
-
...
|
|
1381
|
-
height: ((
|
|
1380
|
+
...g,
|
|
1381
|
+
height: ((g == null ? void 0 : g.height) || 0) - I.endY + I.startY
|
|
1382
1382
|
}, U = N(M, this._selectionRenderService), U != null && M != null) {
|
|
1383
1383
|
s.push({ ...c, sheetTransform: U, transform: M });
|
|
1384
1384
|
break;
|
|
@@ -1388,7 +1388,7 @@ let Ae = class extends ae {
|
|
|
1388
1388
|
r.push({ ...c, sheetTransform: U, transform: M });
|
|
1389
1389
|
break;
|
|
1390
1390
|
} else
|
|
1391
|
-
this._remainDrawingSize(
|
|
1391
|
+
this._remainDrawingSize(g, r, c);
|
|
1392
1392
|
}
|
|
1393
1393
|
}
|
|
1394
1394
|
}), r.length === 0 && s.length === 0)
|
|
@@ -1412,12 +1412,12 @@ let Ae = class extends ae {
|
|
|
1412
1412
|
if (l === O.None)
|
|
1413
1413
|
this._remainDrawingSize(h, s, a);
|
|
1414
1414
|
else {
|
|
1415
|
-
const { from: c, to:
|
|
1415
|
+
const { from: c, to: u } = d, { row: g, column: f } = c, { row: m, column: p } = u;
|
|
1416
1416
|
for (let S = 0; S < n.length; S++) {
|
|
1417
1417
|
const C = n[S], { startRow: v, endRow: R, startColumn: _, endColumn: b } = C;
|
|
1418
1418
|
if (m < v || p < _)
|
|
1419
1419
|
continue;
|
|
1420
|
-
if (l === O.Position && (
|
|
1420
|
+
if (l === O.Position && (g <= v && m >= R || f <= _ && p >= b)) {
|
|
1421
1421
|
this._remainDrawingSize(h, s, a);
|
|
1422
1422
|
continue;
|
|
1423
1423
|
}
|
|
@@ -1453,9 +1453,9 @@ let Ae = class extends ae {
|
|
|
1453
1453
|
const n = this._getUnitIdAndSubUnitId(i, e);
|
|
1454
1454
|
if (n == null)
|
|
1455
1455
|
return { redos: [], undos: [] };
|
|
1456
|
-
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, a = s.endRow, d = [], h = [], l = this._sheetDrawingService.getDrawingData(t, r), c = [],
|
|
1457
|
-
if (Object.keys(l).forEach((
|
|
1458
|
-
const f = l[
|
|
1456
|
+
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, a = s.endRow, d = [], h = [], l = this._sheetDrawingService.getDrawingData(t, r), c = [], u = [];
|
|
1457
|
+
if (Object.keys(l).forEach((g) => {
|
|
1458
|
+
const f = l[g], { sheetTransform: m, transform: p, anchorType: S = O.Position } = f;
|
|
1459
1459
|
if (m == null || p == null)
|
|
1460
1460
|
return;
|
|
1461
1461
|
let C, v;
|
|
@@ -1463,9 +1463,9 @@ let Ae = class extends ae {
|
|
|
1463
1463
|
const _ = this._expandRow(m, p, o, a, S);
|
|
1464
1464
|
C = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
|
|
1465
1465
|
} else {
|
|
1466
|
-
const { from: _, to: b } = m, { row: w } = _, { row:
|
|
1467
|
-
if (w >= o &&
|
|
1468
|
-
|
|
1466
|
+
const { from: _, to: b } = m, { row: w } = _, { row: P } = b;
|
|
1467
|
+
if (w >= o && P <= a)
|
|
1468
|
+
u.push({ unitId: t, subUnitId: r, drawingId: g });
|
|
1469
1469
|
else {
|
|
1470
1470
|
const D = this._shrinkRow(m, p, o, a, S);
|
|
1471
1471
|
C = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
|
|
@@ -1473,16 +1473,16 @@ let Ae = class extends ae {
|
|
|
1473
1473
|
}
|
|
1474
1474
|
if (!C || !v)
|
|
1475
1475
|
return;
|
|
1476
|
-
const R = { unitId: t, subUnitId: r, drawingId:
|
|
1476
|
+
const R = { unitId: t, subUnitId: r, drawingId: g, transform: v, sheetTransform: C };
|
|
1477
1477
|
c.push(R);
|
|
1478
|
-
}), c.length === 0 &&
|
|
1478
|
+
}), c.length === 0 && u.length === 0)
|
|
1479
1479
|
return { redos: [], undos: [] };
|
|
1480
1480
|
if (c.length > 0) {
|
|
1481
|
-
const
|
|
1481
|
+
const g = this._sheetDrawingService.getBatchUpdateOp(c), { undo: f, redo: m, objects: p } = g;
|
|
1482
1482
|
d.push({ id: E.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: y.UPDATE } }), h.push({ id: E.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: y.UPDATE } });
|
|
1483
1483
|
}
|
|
1484
|
-
if (
|
|
1485
|
-
const
|
|
1484
|
+
if (u.length > 0) {
|
|
1485
|
+
const g = this._sheetDrawingService.getBatchRemoveOp(u), f = g.undo, m = g.redo, p = g.objects;
|
|
1486
1486
|
d.push({ id: E.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: y.REMOVE } }), h.push({ id: E.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: y.INSERT } });
|
|
1487
1487
|
}
|
|
1488
1488
|
return d.push({ id: j.id, params: [t] }), h.push({ id: j.id, params: [t] }), {
|
|
@@ -1494,9 +1494,9 @@ let Ae = class extends ae {
|
|
|
1494
1494
|
const n = this._getUnitIdAndSubUnitId(i, e);
|
|
1495
1495
|
if (n == null)
|
|
1496
1496
|
return { redos: [], undos: [] };
|
|
1497
|
-
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, a = s.endColumn, d = [], h = [], l = this._sheetDrawingService.getDrawingData(t, r), c = [],
|
|
1498
|
-
if (Object.keys(l).forEach((
|
|
1499
|
-
const f = l[
|
|
1497
|
+
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, a = s.endColumn, d = [], h = [], l = this._sheetDrawingService.getDrawingData(t, r), c = [], u = [];
|
|
1498
|
+
if (Object.keys(l).forEach((g) => {
|
|
1499
|
+
const f = l[g], { sheetTransform: m, transform: p, anchorType: S = O.Position } = f;
|
|
1500
1500
|
if (m == null || p == null)
|
|
1501
1501
|
return;
|
|
1502
1502
|
let C, v;
|
|
@@ -1504,9 +1504,9 @@ let Ae = class extends ae {
|
|
|
1504
1504
|
const _ = this._expandCol(m, p, o, a, S);
|
|
1505
1505
|
C = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
|
|
1506
1506
|
} else {
|
|
1507
|
-
const { from: _, to: b } = m, { column: w } = _, { column:
|
|
1508
|
-
if (w >= o &&
|
|
1509
|
-
|
|
1507
|
+
const { from: _, to: b } = m, { column: w } = _, { column: P } = b;
|
|
1508
|
+
if (w >= o && P <= a)
|
|
1509
|
+
u.push({ unitId: t, subUnitId: r, drawingId: g });
|
|
1510
1510
|
else {
|
|
1511
1511
|
const D = this._shrinkCol(m, p, o, a, S);
|
|
1512
1512
|
C = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
|
|
@@ -1514,16 +1514,16 @@ let Ae = class extends ae {
|
|
|
1514
1514
|
}
|
|
1515
1515
|
if (!C || !v)
|
|
1516
1516
|
return;
|
|
1517
|
-
const R = { unitId: t, subUnitId: r, drawingId:
|
|
1517
|
+
const R = { unitId: t, subUnitId: r, drawingId: g, transform: v, sheetTransform: C };
|
|
1518
1518
|
c.push(R);
|
|
1519
|
-
}), c.length === 0 &&
|
|
1519
|
+
}), c.length === 0 && u.length === 0)
|
|
1520
1520
|
return { redos: [], undos: [] };
|
|
1521
1521
|
if (c.length > 0) {
|
|
1522
|
-
const
|
|
1522
|
+
const g = this._sheetDrawingService.getBatchUpdateOp(c), { undo: f, redo: m, objects: p } = g;
|
|
1523
1523
|
d.push({ id: E.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: y.UPDATE } }), h.push({ id: E.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: y.UPDATE } });
|
|
1524
1524
|
}
|
|
1525
|
-
if (
|
|
1526
|
-
const
|
|
1525
|
+
if (u.length > 0) {
|
|
1526
|
+
const g = this._sheetDrawingService.getBatchRemoveOp(u), f = g.undo, m = g.redo, p = g.objects;
|
|
1527
1527
|
d.push({ id: E.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: y.REMOVE } }), h.push({ id: E.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: y.INSERT } });
|
|
1528
1528
|
}
|
|
1529
1529
|
return d.push({ id: j.id, params: [t] }), h.push({ id: j.id, params: [t] }), { redos: d, undos: h };
|
|
@@ -1537,10 +1537,10 @@ let Ae = class extends ae {
|
|
|
1537
1537
|
};
|
|
1538
1538
|
let l = null, c = null;
|
|
1539
1539
|
if (d >= n) {
|
|
1540
|
-
const
|
|
1541
|
-
if (
|
|
1540
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: a.row });
|
|
1541
|
+
if (u == null)
|
|
1542
1542
|
return;
|
|
1543
|
-
c = { ...e, left: (e.left || 0) +
|
|
1543
|
+
c = { ...e, left: (e.left || 0) + u.endX - u.startX }, l = N(c, this._selectionRenderService);
|
|
1544
1544
|
} else if (h >= t)
|
|
1545
1545
|
if (r === O.Both)
|
|
1546
1546
|
l = {
|
|
@@ -1588,24 +1588,24 @@ let Ae = class extends ae {
|
|
|
1588
1588
|
if (d === n)
|
|
1589
1589
|
c = { ...e, left: (e.left || 0) - i.from.columnOffset };
|
|
1590
1590
|
else {
|
|
1591
|
-
const
|
|
1592
|
-
if (
|
|
1591
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: d - 1, startRow: o.row, endRow: a.row });
|
|
1592
|
+
if (u == null)
|
|
1593
1593
|
return;
|
|
1594
|
-
c = { ...e, left: (e.left || 0) -
|
|
1594
|
+
c = { ...e, left: (e.left || 0) - u.endX + u.startX - i.from.columnOffset };
|
|
1595
1595
|
}
|
|
1596
1596
|
l = N(c, this._selectionRenderService);
|
|
1597
1597
|
} else if (h >= n && h <= t && r === O.Both) {
|
|
1598
|
-
const
|
|
1598
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({
|
|
1599
1599
|
startColumn: n - 1,
|
|
1600
1600
|
endColumn: n - 1,
|
|
1601
1601
|
startRow: o.row,
|
|
1602
1602
|
endRow: a.row
|
|
1603
1603
|
});
|
|
1604
|
-
if (
|
|
1604
|
+
if (u == null)
|
|
1605
1605
|
return;
|
|
1606
1606
|
l = {
|
|
1607
1607
|
from: { ...o },
|
|
1608
|
-
to: { ...a, column: n - 1, columnOffset:
|
|
1608
|
+
to: { ...a, column: n - 1, columnOffset: u.endX - u.startX }
|
|
1609
1609
|
}, c = $(l, this._selectionRenderService, this._skeletonManagerService);
|
|
1610
1610
|
}
|
|
1611
1611
|
}
|
|
@@ -1623,10 +1623,10 @@ let Ae = class extends ae {
|
|
|
1623
1623
|
};
|
|
1624
1624
|
let l = null, c = null;
|
|
1625
1625
|
if (d >= n) {
|
|
1626
|
-
const
|
|
1627
|
-
if (
|
|
1626
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: a.column });
|
|
1627
|
+
if (u == null)
|
|
1628
1628
|
return;
|
|
1629
|
-
c = { ...e, top: (e.top || 0) +
|
|
1629
|
+
c = { ...e, top: (e.top || 0) + u.endY - u.startY }, l = N(c, this._selectionRenderService);
|
|
1630
1630
|
} else if (h >= t)
|
|
1631
1631
|
if (r === O.Both)
|
|
1632
1632
|
l = {
|
|
@@ -1677,19 +1677,19 @@ let Ae = class extends ae {
|
|
|
1677
1677
|
if (d === n)
|
|
1678
1678
|
c = { ...e, top: (e.top || 0) - i.from.rowOffset };
|
|
1679
1679
|
else {
|
|
1680
|
-
const
|
|
1681
|
-
if (
|
|
1680
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: d - 1, startColumn: o.column, endColumn: a.column });
|
|
1681
|
+
if (u == null)
|
|
1682
1682
|
return;
|
|
1683
|
-
c = { ...e, top: (e.top || 0) -
|
|
1683
|
+
c = { ...e, top: (e.top || 0) - u.endY + u.startY - i.from.rowOffset };
|
|
1684
1684
|
}
|
|
1685
1685
|
l = N(c, this._selectionRenderService);
|
|
1686
1686
|
} else if (h >= n && h <= t && r === O.Both) {
|
|
1687
|
-
const
|
|
1688
|
-
if (
|
|
1687
|
+
const u = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
|
|
1688
|
+
if (u == null)
|
|
1689
1689
|
return;
|
|
1690
1690
|
l = {
|
|
1691
1691
|
from: { ...o },
|
|
1692
|
-
to: { ...a, row: n - 1, rowOffset:
|
|
1692
|
+
to: { ...a, row: n - 1, rowOffset: u.endY - u.startY }
|
|
1693
1693
|
}, c = $(l, this._selectionRenderService, this._skeletonManagerService);
|
|
1694
1694
|
}
|
|
1695
1695
|
}
|
|
@@ -1701,7 +1701,7 @@ let Ae = class extends ae {
|
|
|
1701
1701
|
_commandListener() {
|
|
1702
1702
|
this.disposeWithMe(
|
|
1703
1703
|
this._commandService.onCommandExecuted((i) => {
|
|
1704
|
-
i.id ===
|
|
1704
|
+
i.id === sr.id && setTimeout(() => {
|
|
1705
1705
|
const e = i.params, { unitId: n, subUnitId: t } = e, r = this._drawingManagerService.drawingManagerData, s = [], o = [];
|
|
1706
1706
|
Object.keys(r).forEach((a) => {
|
|
1707
1707
|
const d = r[a];
|
|
@@ -1709,8 +1709,8 @@ let Ae = class extends ae {
|
|
|
1709
1709
|
const l = d[h].data;
|
|
1710
1710
|
l != null && Object.keys(l).forEach((c) => {
|
|
1711
1711
|
if (a === n && h === t) {
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1712
|
+
const u = l[c];
|
|
1713
|
+
u.transform = $(u.sheetTransform, this._selectionRenderService, this._skeletonManagerService), s.push(l[c]);
|
|
1714
1714
|
} else
|
|
1715
1715
|
o.push(l[c]);
|
|
1716
1716
|
});
|
|
@@ -1723,7 +1723,7 @@ let Ae = class extends ae {
|
|
|
1723
1723
|
_sheetRefreshListener() {
|
|
1724
1724
|
this.disposeWithMe(
|
|
1725
1725
|
this._commandService.onCommandExecuted((i) => {
|
|
1726
|
-
|
|
1726
|
+
di.includes(i.id) && requestIdleCallback(() => {
|
|
1727
1727
|
const e = i.params, { unitId: n, subUnitId: t, ranges: r } = e;
|
|
1728
1728
|
this._refreshDrawingTransform(n, t, r);
|
|
1729
1729
|
});
|
|
@@ -1736,10 +1736,10 @@ let Ae = class extends ae {
|
|
|
1736
1736
|
const o = t[s], { sheetTransform: a, anchorType: d = O.Position } = o;
|
|
1737
1737
|
if (d === O.None)
|
|
1738
1738
|
return !0;
|
|
1739
|
-
const { from: h, to: l } = a, { row: c, column:
|
|
1739
|
+
const { from: h, to: l } = a, { row: c, column: u } = h, { row: g, column: f } = l;
|
|
1740
1740
|
for (let m = 0; m < n.length; m++) {
|
|
1741
1741
|
const p = n[m], { startRow: S, endRow: C, startColumn: v, endColumn: R } = p;
|
|
1742
|
-
if (
|
|
1742
|
+
if (an.intersects(
|
|
1743
1743
|
{
|
|
1744
1744
|
startRow: S,
|
|
1745
1745
|
endRow: C,
|
|
@@ -1748,11 +1748,11 @@ let Ae = class extends ae {
|
|
|
1748
1748
|
},
|
|
1749
1749
|
{
|
|
1750
1750
|
startRow: c,
|
|
1751
|
-
endRow:
|
|
1752
|
-
startColumn:
|
|
1751
|
+
endRow: g,
|
|
1752
|
+
startColumn: u,
|
|
1753
1753
|
endColumn: f
|
|
1754
1754
|
}
|
|
1755
|
-
) || c > C ||
|
|
1755
|
+
) || c > C || u > R) {
|
|
1756
1756
|
r.push({
|
|
1757
1757
|
...o,
|
|
1758
1758
|
transform: $(a, this._selectionRenderService, this._skeletonManagerService)
|
|
@@ -1763,22 +1763,22 @@ let Ae = class extends ae {
|
|
|
1763
1763
|
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(j.id, [i]));
|
|
1764
1764
|
}
|
|
1765
1765
|
};
|
|
1766
|
-
Ae =
|
|
1767
|
-
se
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1766
|
+
Ae = ai([
|
|
1767
|
+
ie(se.Rendered, Ae),
|
|
1768
|
+
ce(0, V),
|
|
1769
|
+
ce(1, W(or)),
|
|
1770
|
+
ce(2, K),
|
|
1771
|
+
ce(3, k),
|
|
1772
|
+
ce(4, z),
|
|
1773
|
+
ce(5, he)
|
|
1774
1774
|
], Ae);
|
|
1775
|
-
var
|
|
1776
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1775
|
+
var li = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, gi = (i, e, n, t) => {
|
|
1776
|
+
for (var r = t > 1 ? void 0 : t ? ui(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1777
1777
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
1778
|
-
return t && r &&
|
|
1779
|
-
},
|
|
1780
|
-
function
|
|
1781
|
-
const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(
|
|
1778
|
+
return t && r && li(e, n, r), r;
|
|
1779
|
+
}, de = (i, e) => (n, t) => e(n, t, i);
|
|
1780
|
+
function hi(i, e, n, t) {
|
|
1781
|
+
const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(Pn.VIEW_MAIN), a = {
|
|
1782
1782
|
left: !0,
|
|
1783
1783
|
top: !0
|
|
1784
1784
|
};
|
|
@@ -1787,11 +1787,11 @@ function gi(i, e, n, t) {
|
|
|
1787
1787
|
...i,
|
|
1788
1788
|
absolute: a
|
|
1789
1789
|
};
|
|
1790
|
-
const { left: d, right: h, top: l, bottom: c } = i,
|
|
1790
|
+
const { left: d, right: h, top: l, bottom: c } = i, u = t.getFreeze(), { startColumn: g, startRow: f, xSplit: m, ySplit: p } = u, S = n.getNoMergeCellPositionByIndexWithNoHeader(f - p, g - m), C = n.getNoMergeCellPositionByIndexWithNoHeader(f, g), { rowHeaderWidth: v, columnHeaderHeight: R } = n, _ = C.startX - S.startX, b = C.startY - S.startY, { top: w, left: P, viewportScrollX: D, viewportScrollY: T } = o;
|
|
1791
1791
|
let U, M;
|
|
1792
|
-
d <
|
|
1792
|
+
d < P ? (a.left = !0, U = (_ + v + (d - P)) * r, M = Math.max(
|
|
1793
1793
|
Math.min(
|
|
1794
|
-
(_ + v + (h -
|
|
1794
|
+
(_ + v + (h - P)) * r,
|
|
1795
1795
|
(_ + v) * r
|
|
1796
1796
|
),
|
|
1797
1797
|
(h - D) * r
|
|
@@ -1802,8 +1802,8 @@ function gi(i, e, n, t) {
|
|
|
1802
1802
|
(b + R + (h - w)) * s,
|
|
1803
1803
|
(b + R) * s
|
|
1804
1804
|
),
|
|
1805
|
-
(c -
|
|
1806
|
-
)) : (a.top = !1, I = Math.max((l -
|
|
1805
|
+
(c - T) * s
|
|
1806
|
+
)) : (a.top = !1, I = Math.max((l - T) * s, (b + R) * s), A = Math.max((c - T) * s, (b + R) * s)), {
|
|
1807
1807
|
left: U,
|
|
1808
1808
|
right: M,
|
|
1809
1809
|
top: I,
|
|
@@ -1817,7 +1817,7 @@ const ze = (i, e, n, t) => {
|
|
|
1817
1817
|
right: s + a,
|
|
1818
1818
|
top: o,
|
|
1819
1819
|
bottom: o + d
|
|
1820
|
-
}, c =
|
|
1820
|
+
}, c = hi(l, r, n, t);
|
|
1821
1821
|
return {
|
|
1822
1822
|
startX: c.left,
|
|
1823
1823
|
endX: c.right,
|
|
@@ -1829,16 +1829,17 @@ const ze = (i, e, n, t) => {
|
|
|
1829
1829
|
absolute: c.absolute
|
|
1830
1830
|
};
|
|
1831
1831
|
};
|
|
1832
|
-
let tt = class extends
|
|
1833
|
-
constructor(e, n, t, r, s, o
|
|
1832
|
+
let tt = class extends oe {
|
|
1833
|
+
constructor(e, n, t, r, s, o) {
|
|
1834
1834
|
super();
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1835
|
+
H(this, "_domLayerMap", /* @__PURE__ */ new Map());
|
|
1836
|
+
H(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
|
|
1837
|
+
H(this, "_transformChange$", new mt());
|
|
1838
|
+
H(this, "transformChange$", this._transformChange$.asObservable());
|
|
1839
|
+
H(this, "_remove$", new mt());
|
|
1840
|
+
H(this, "remove$", this._remove$.asObservable());
|
|
1841
|
+
H(this, "_hooks", []);
|
|
1842
|
+
this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._drawingAddListener(), this._scrollUpdateListener(), this._featureUpdateListener(), this._deleteListener();
|
|
1842
1843
|
}
|
|
1843
1844
|
_ensureMap(e, n) {
|
|
1844
1845
|
let t = this._domLayerMap.get(e);
|
|
@@ -1855,14 +1856,20 @@ let tt = class extends ae {
|
|
|
1855
1856
|
const r = t.getTransformerByCreate(), s = n.engine.getCanvasElement();
|
|
1856
1857
|
return { scene: t, transformer: r, renderObject: n, canvas: s };
|
|
1857
1858
|
}
|
|
1859
|
+
_getFloatDomProps(e) {
|
|
1860
|
+
let n;
|
|
1861
|
+
return this._hooks.forEach((t) => {
|
|
1862
|
+
n = t.onGetFloatDomProps(e);
|
|
1863
|
+
}), n;
|
|
1864
|
+
}
|
|
1858
1865
|
// eslint-disable-next-line max-lines-per-function
|
|
1859
1866
|
_drawingAddListener() {
|
|
1860
1867
|
this.disposeWithMe(
|
|
1861
1868
|
// eslint-disable-next-line max-lines-per-function
|
|
1862
1869
|
this._drawingManagerService.add$.subscribe((e) => {
|
|
1863
1870
|
e.forEach((n) => {
|
|
1864
|
-
var ot, at;
|
|
1865
|
-
const { unitId: t, subUnitId: r, drawingId: s } = n, o = le(this._univerInstanceService, { unitId: t, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(n), d = (ot = this._renderManagerService.getRenderById(t)) == null ? void 0 : ot.with(
|
|
1871
|
+
var ot, at, ct;
|
|
1872
|
+
const { unitId: t, subUnitId: r, drawingId: s } = n, o = le(this._univerInstanceService, { unitId: t, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(n), d = (ot = this._renderManagerService.getRenderById(t)) == null ? void 0 : ot.with(re).getWorksheetSkeleton(r);
|
|
1866
1873
|
if (a == null || o == null || d == null)
|
|
1867
1874
|
return;
|
|
1868
1875
|
const { transform: h, drawingType: l } = a;
|
|
@@ -1871,12 +1878,12 @@ let tt = class extends ae {
|
|
|
1871
1878
|
const c = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1872
1879
|
if (c == null)
|
|
1873
1880
|
return;
|
|
1874
|
-
const { scene:
|
|
1881
|
+
const { scene: u, canvas: g } = c;
|
|
1875
1882
|
if (h == null)
|
|
1876
1883
|
return !0;
|
|
1877
|
-
const { left: f, top: m, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: b } = h, w =
|
|
1878
|
-
if (
|
|
1879
|
-
|
|
1884
|
+
const { left: f, top: m, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: b } = h, w = Mn({ unitId: t, subUnitId: r, drawingId: s }), P = u.getObject(w);
|
|
1885
|
+
if (P != null) {
|
|
1886
|
+
P.transformByState({ left: f, top: m, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: b });
|
|
1880
1887
|
return;
|
|
1881
1888
|
}
|
|
1882
1889
|
const D = {
|
|
@@ -1885,11 +1892,11 @@ let tt = class extends ae {
|
|
|
1885
1892
|
width: p,
|
|
1886
1893
|
height: S,
|
|
1887
1894
|
zIndex: this._drawingManagerService.getDrawingOrder(t, r).length - 1
|
|
1888
|
-
},
|
|
1889
|
-
|
|
1890
|
-
const U = this._ensureMap(t, r), M = new
|
|
1895
|
+
}, T = new yn(w, D);
|
|
1896
|
+
u.addObject(T, On).attachTransformerTo(T);
|
|
1897
|
+
const U = this._ensureMap(t, r), M = new cn(), I = ze(T, c.renderObject, d.skeleton, o.worksheet), A = new $n(I), G = {
|
|
1891
1898
|
dispose: M,
|
|
1892
|
-
rect:
|
|
1899
|
+
rect: T,
|
|
1893
1900
|
position$: A,
|
|
1894
1901
|
unitId: t,
|
|
1895
1902
|
subUnitId: r
|
|
@@ -1899,21 +1906,21 @@ let tt = class extends ae {
|
|
|
1899
1906
|
id: s,
|
|
1900
1907
|
componentKey: a.componentKey,
|
|
1901
1908
|
onPointerDown: (x) => {
|
|
1902
|
-
|
|
1909
|
+
g.dispatchEvent(new PointerEvent(x.type, x));
|
|
1903
1910
|
},
|
|
1904
1911
|
onPointerMove: (x) => {
|
|
1905
|
-
|
|
1912
|
+
g.dispatchEvent(new PointerEvent(x.type, x));
|
|
1906
1913
|
},
|
|
1907
1914
|
onPointerUp: (x) => {
|
|
1908
|
-
|
|
1915
|
+
g.dispatchEvent(new PointerEvent(x.type, x));
|
|
1909
1916
|
},
|
|
1910
1917
|
onWheel: (x) => {
|
|
1911
|
-
|
|
1918
|
+
g.dispatchEvent(new WheelEvent(x.type, x));
|
|
1912
1919
|
},
|
|
1913
|
-
props: (at = U.get(s)) == null ? void 0 : at.props
|
|
1920
|
+
props: (ct = (at = U.get(s)) == null ? void 0 : at.props) != null ? ct : this._getFloatDomProps(s)
|
|
1914
1921
|
});
|
|
1915
|
-
const J =
|
|
1916
|
-
const x = ze(
|
|
1922
|
+
const J = T.onTransformChange$.subscribeEvent(() => {
|
|
1923
|
+
const x = ze(T, c.renderObject, d.skeleton, o.worksheet);
|
|
1917
1924
|
A.next(
|
|
1918
1925
|
x
|
|
1919
1926
|
);
|
|
@@ -1929,40 +1936,36 @@ let tt = class extends ae {
|
|
|
1929
1936
|
this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
|
|
1930
1937
|
var t, r;
|
|
1931
1938
|
const n = (s, o) => {
|
|
1932
|
-
var
|
|
1933
|
-
const a = this._getSceneAndTransformerByDrawingSearch(s), d = this._ensureMap(s, o), h = Array.from(d.keys()), l = le(this._univerInstanceService, { unitId: s, subUnitId: o }), c = (
|
|
1934
|
-
!a || !l || !c || h.forEach((
|
|
1935
|
-
const f = this._domLayerInfoMap.get(
|
|
1939
|
+
var u;
|
|
1940
|
+
const a = this._getSceneAndTransformerByDrawingSearch(s), d = this._ensureMap(s, o), h = Array.from(d.keys()), l = le(this._univerInstanceService, { unitId: s, subUnitId: o }), c = (u = this._renderManagerService.getRenderById(s)) == null ? void 0 : u.with(re).getWorksheetSkeleton(o);
|
|
1941
|
+
!a || !l || !c || h.forEach((g) => {
|
|
1942
|
+
const f = this._domLayerInfoMap.get(g);
|
|
1936
1943
|
if (f) {
|
|
1937
1944
|
const m = ze(f.rect, a.renderObject, c.skeleton, l.worksheet);
|
|
1938
1945
|
f.position$.next(m);
|
|
1939
1946
|
}
|
|
1940
1947
|
});
|
|
1941
1948
|
};
|
|
1942
|
-
if (e.id ===
|
|
1949
|
+
if (e.id === Nn.id) {
|
|
1943
1950
|
const s = e.params, { unitId: o, sheetId: a } = s;
|
|
1944
1951
|
n(o, a);
|
|
1945
|
-
} else if (e.id ===
|
|
1952
|
+
} else if (e.id === jn.id) {
|
|
1946
1953
|
const s = e.params, { unitId: o } = s;
|
|
1947
1954
|
Array.from((r = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? r : []).forEach((d) => {
|
|
1948
1955
|
n(o, d);
|
|
1949
1956
|
});
|
|
1950
|
-
} else if (e.id ===
|
|
1957
|
+
} else if (e.id === ar.id) {
|
|
1951
1958
|
const { unitId: s, subUnitId: o } = e.params;
|
|
1952
1959
|
n(s, o);
|
|
1953
1960
|
}
|
|
1954
1961
|
}));
|
|
1955
1962
|
}
|
|
1956
|
-
_getPosition(e) {
|
|
1957
|
-
|
|
1958
|
-
|
|
1963
|
+
_getPosition(e, n) {
|
|
1964
|
+
var u;
|
|
1965
|
+
const { startX: t, endX: r, startY: s, endY: o } = e, a = (u = this._renderManagerService.getRenderById(n)) == null ? void 0 : u.with(Ge);
|
|
1966
|
+
if (a == null)
|
|
1959
1967
|
return;
|
|
1960
|
-
const
|
|
1961
|
-
column: o.actualColumn,
|
|
1962
|
-
columnOffset: n - o.startX,
|
|
1963
|
-
row: o.actualRow,
|
|
1964
|
-
rowOffset: r - o.startY
|
|
1965
|
-
}, d = this._selectionRenderService.getSelectionCellByPosition(t, s);
|
|
1968
|
+
const d = a.getSelectionCellByPosition(t, s);
|
|
1966
1969
|
if (d == null)
|
|
1967
1970
|
return;
|
|
1968
1971
|
const h = {
|
|
@@ -1970,10 +1973,18 @@ let tt = class extends ae {
|
|
|
1970
1973
|
columnOffset: t - d.startX,
|
|
1971
1974
|
row: d.actualRow,
|
|
1972
1975
|
rowOffset: s - d.startY
|
|
1976
|
+
}, l = a.getSelectionCellByPosition(r, o);
|
|
1977
|
+
if (l == null)
|
|
1978
|
+
return;
|
|
1979
|
+
const c = {
|
|
1980
|
+
column: l.actualColumn,
|
|
1981
|
+
columnOffset: r - l.startX,
|
|
1982
|
+
row: l.actualRow,
|
|
1983
|
+
rowOffset: o - l.startY
|
|
1973
1984
|
};
|
|
1974
1985
|
return {
|
|
1975
|
-
from:
|
|
1976
|
-
to:
|
|
1986
|
+
from: h,
|
|
1987
|
+
to: c
|
|
1977
1988
|
};
|
|
1978
1989
|
}
|
|
1979
1990
|
_featureUpdateListener() {
|
|
@@ -2007,7 +2018,7 @@ let tt = class extends ae {
|
|
|
2007
2018
|
});
|
|
2008
2019
|
if (!n)
|
|
2009
2020
|
throw new Error("cannot find current target!");
|
|
2010
|
-
const { unitId: t, subUnitId: r } = n, { initPosition: s, componentKey: o } = e, a =
|
|
2021
|
+
const { unitId: t, subUnitId: r } = n, { initPosition: s, componentKey: o } = e, a = ne.generateRandomId(), d = this._getPosition(s, t);
|
|
2011
2022
|
if (d == null)
|
|
2012
2023
|
return;
|
|
2013
2024
|
this._ensureMap(t, r).set(a, e);
|
|
@@ -2051,22 +2062,29 @@ let tt = class extends ae {
|
|
|
2051
2062
|
this._commandService.syncExecuteCommand(E.id, { unitId: r, subUnitId: s, op: l, objects: c, type: y.REMOVE });
|
|
2052
2063
|
}
|
|
2053
2064
|
}
|
|
2065
|
+
addHook(e) {
|
|
2066
|
+
return this._hooks.push(e), {
|
|
2067
|
+
dispose: () => {
|
|
2068
|
+
const n = this._hooks.findIndex((t) => t === e);
|
|
2069
|
+
this._hooks.splice(n, 1);
|
|
2070
|
+
}
|
|
2071
|
+
};
|
|
2072
|
+
}
|
|
2054
2073
|
};
|
|
2055
|
-
tt =
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
ne(6, H)
|
|
2074
|
+
tt = gi([
|
|
2075
|
+
de(0, W(K)),
|
|
2076
|
+
de(1, he),
|
|
2077
|
+
de(2, W(V)),
|
|
2078
|
+
de(3, z),
|
|
2079
|
+
de(4, W(Kn)),
|
|
2080
|
+
de(5, k)
|
|
2063
2081
|
], tt);
|
|
2064
|
-
var
|
|
2065
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2082
|
+
var mi = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, pi = (i, e, n, t) => {
|
|
2083
|
+
for (var r = t > 1 ? void 0 : t ? fi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2066
2084
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2067
|
-
return t && r &&
|
|
2085
|
+
return t && r && mi(e, n, r), r;
|
|
2068
2086
|
}, Oe = (i, e) => (n, t) => e(n, t, i);
|
|
2069
|
-
let Ne = class extends
|
|
2087
|
+
let Ne = class extends oe {
|
|
2070
2088
|
constructor(i, e, n, t) {
|
|
2071
2089
|
super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting();
|
|
2072
2090
|
}
|
|
@@ -2091,16 +2109,16 @@ let Ne = class extends ae {
|
|
|
2091
2109
|
const { unitId: t, subUnitId: r } = e, s = this._renderManagerService.getRenderById(t);
|
|
2092
2110
|
if (!s)
|
|
2093
2111
|
return n(i);
|
|
2094
|
-
const o = s.with(
|
|
2112
|
+
const o = s.with(re).getWorksheetSkeleton(r);
|
|
2095
2113
|
if (!o)
|
|
2096
2114
|
return n(i);
|
|
2097
2115
|
const a = this._drawingManagerService.getDrawingDataForUnit(t), d = a == null ? void 0 : a[e.subUnitId];
|
|
2098
2116
|
if (!d)
|
|
2099
2117
|
return n(i);
|
|
2100
|
-
const { scaleX: h, scaleY: l } = s.scene, c = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 },
|
|
2101
|
-
return
|
|
2102
|
-
if (!
|
|
2103
|
-
const f = o.skeleton.getCellPositionByOffset(
|
|
2118
|
+
const { scaleX: h, scaleY: l } = s.scene, c = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, u = d.order.map((g) => d.data[g]).filter((g) => g.drawingType !== Ve.DRAWING_DOM);
|
|
2119
|
+
return u.length ? (u.forEach((g) => {
|
|
2120
|
+
if (!g.groupId && g.transform && ne.isDefine(g.transform.left) && ne.isDefine(g.transform.top) && ne.isDefine(g.transform.width) && ne.isDefine(g.transform.height)) {
|
|
2121
|
+
const f = o.skeleton.getCellPositionByOffset(g.transform.left, g.transform.top, h, l, { x: 0, y: 0 }), m = o.skeleton.getCellPositionByOffset(g.transform.left + g.transform.width, g.transform.top + g.transform.height, h, l, { x: 0, y: 0 });
|
|
2104
2122
|
f.column < c.startColumn && (c.startColumn = f.column), f.row < c.startRow && (c.startRow = f.row), c.endRow < m.row && (c.endRow = m.row), c.endColumn < m.column && (c.endColumn = m.column);
|
|
2105
2123
|
}
|
|
2106
2124
|
}), n(c)) : n(i);
|
|
@@ -2110,19 +2128,19 @@ let Ne = class extends ae {
|
|
|
2110
2128
|
);
|
|
2111
2129
|
}
|
|
2112
2130
|
};
|
|
2113
|
-
Ne =
|
|
2114
|
-
se
|
|
2115
|
-
Oe(0, W(
|
|
2116
|
-
Oe(1, W(
|
|
2131
|
+
Ne = pi([
|
|
2132
|
+
ie(se.Rendered, Ne),
|
|
2133
|
+
Oe(0, W(Ln)),
|
|
2134
|
+
Oe(1, W(_n)),
|
|
2117
2135
|
Oe(2, z),
|
|
2118
2136
|
Oe(3, K)
|
|
2119
2137
|
], Ne);
|
|
2120
|
-
var
|
|
2121
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2138
|
+
var wi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, vi = (i, e, n, t) => {
|
|
2139
|
+
for (var r = t > 1 ? void 0 : t ? _i(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2122
2140
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2123
|
-
return t && r &&
|
|
2141
|
+
return t && r && wi(e, n, r), r;
|
|
2124
2142
|
}, fe = (i, e) => (n, t) => e(n, t, i);
|
|
2125
|
-
let je = class extends
|
|
2143
|
+
let je = class extends oe {
|
|
2126
2144
|
constructor(i, e, n, t, r) {
|
|
2127
2145
|
super(), this._drawingManagerService = i, this._renderManagerService = e, this._permissionService = n, this._univerInstanceService = t, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
2128
2146
|
}
|
|
@@ -2140,15 +2158,15 @@ let je = class extends ae {
|
|
|
2140
2158
|
return;
|
|
2141
2159
|
}
|
|
2142
2160
|
const r = e.getUnitId(), s = t.getSheetId();
|
|
2143
|
-
if (this._permissionService.composePermission([new
|
|
2161
|
+
if (this._permissionService.composePermission([new pt(r).id, new He(r, s).id]).every((a) => a.value))
|
|
2144
2162
|
this._drawingManagerService.setDrawingVisible(!0);
|
|
2145
2163
|
else {
|
|
2146
2164
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
2147
|
-
const a = e.getUnitId(), d = t.getSheetId(), h = this._drawingManagerService.getDrawingData(a, d), l = Object.values(h), c = this._renderManagerService.getRenderById(a),
|
|
2148
|
-
if (
|
|
2165
|
+
const a = e.getUnitId(), d = t.getSheetId(), h = this._drawingManagerService.getDrawingData(a, d), l = Object.values(h), c = this._renderManagerService.getRenderById(a), u = c == null ? void 0 : c.scene;
|
|
2166
|
+
if (u == null)
|
|
2149
2167
|
return;
|
|
2150
|
-
|
|
2151
|
-
f.classType ===
|
|
2168
|
+
u.getAllObjects().forEach((f) => {
|
|
2169
|
+
f.classType === ae.IMAGE && l.some((m) => f.oKey.includes(m.drawingId)) && u.removeObject(f);
|
|
2152
2170
|
});
|
|
2153
2171
|
}
|
|
2154
2172
|
});
|
|
@@ -2169,15 +2187,15 @@ let je = class extends ae {
|
|
|
2169
2187
|
return;
|
|
2170
2188
|
}
|
|
2171
2189
|
const r = e.getUnitId(), s = t.getSheetId();
|
|
2172
|
-
if (this._permissionService.composePermission([new Ze(r).id, new
|
|
2190
|
+
if (this._permissionService.composePermission([new Ze(r).id, new Pe(r, s).id]).every((a) => a.value))
|
|
2173
2191
|
this._drawingManagerService.setDrawingEditable(!0);
|
|
2174
2192
|
else {
|
|
2175
2193
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
2176
|
-
const a = e.getUnitId(), d = t.getSheetId(), h = this._drawingManagerService.getDrawingData(a, d), l = Object.values(h), c = this._renderManagerService.getRenderById(a),
|
|
2177
|
-
if (
|
|
2194
|
+
const a = e.getUnitId(), d = t.getSheetId(), h = this._drawingManagerService.getDrawingData(a, d), l = Object.values(h), c = this._renderManagerService.getRenderById(a), u = c == null ? void 0 : c.scene;
|
|
2195
|
+
if (u == null)
|
|
2178
2196
|
return;
|
|
2179
|
-
|
|
2180
|
-
f.classType ===
|
|
2197
|
+
u.getAllObjects().forEach((f) => {
|
|
2198
|
+
f.classType === ae.IMAGE && l.some((m) => f.oKey.includes(m.drawingId)) && u.detachTransformerFrom(f);
|
|
2181
2199
|
});
|
|
2182
2200
|
}
|
|
2183
2201
|
});
|
|
@@ -2197,26 +2215,26 @@ let je = class extends ae {
|
|
|
2197
2215
|
const a = this._renderManagerService.getRenderById(r), d = a == null ? void 0 : a.scene;
|
|
2198
2216
|
if (d == null)
|
|
2199
2217
|
return;
|
|
2200
|
-
const h = d.getTransformerByCreate(), l = this._permissionService.composePermission$([new
|
|
2218
|
+
const h = d.getTransformerByCreate(), l = this._permissionService.composePermission$([new pt(r).id, new He(r, s).id]).pipe(ft((u) => u.every((g) => g.value)));
|
|
2201
2219
|
l == null || l.pipe(
|
|
2202
|
-
Me((
|
|
2220
|
+
Me((u) => u !== o),
|
|
2203
2221
|
De()
|
|
2204
2222
|
).subscribe({
|
|
2205
|
-
next: (
|
|
2206
|
-
o =
|
|
2207
|
-
const
|
|
2208
|
-
|
|
2209
|
-
p.classType ===
|
|
2223
|
+
next: (u) => {
|
|
2224
|
+
o = u, this._drawingManagerService.setDrawingVisible(u);
|
|
2225
|
+
const g = d.getAllObjects(), f = this._drawingManagerService.getDrawingData(r, s), m = Object.values(f);
|
|
2226
|
+
u ? this._drawingManagerService.addNotification(m) : (g.forEach((p) => {
|
|
2227
|
+
p.classType === ae.IMAGE && m.some((S) => p.oKey.includes(S.drawingId)) && d.removeObject(p);
|
|
2210
2228
|
}), h.clearSelectedObjects());
|
|
2211
2229
|
}
|
|
2212
|
-
}), (c = this._permissionService.getPermissionPoint$(new
|
|
2213
|
-
Me((
|
|
2230
|
+
}), (c = this._permissionService.getPermissionPoint$(new He(r, s).id)) == null || c.pipe(
|
|
2231
|
+
Me((u) => u.value !== o),
|
|
2214
2232
|
De()
|
|
2215
2233
|
).subscribe({
|
|
2216
2234
|
complete: () => {
|
|
2217
2235
|
o = !0, this._drawingManagerService.setDrawingVisible(!0);
|
|
2218
|
-
const
|
|
2219
|
-
this._drawingManagerService.addNotification(
|
|
2236
|
+
const u = this._drawingManagerService.getDrawingData(r, s), g = Object.values(u);
|
|
2237
|
+
this._drawingManagerService.addNotification(g);
|
|
2220
2238
|
}
|
|
2221
2239
|
});
|
|
2222
2240
|
});
|
|
@@ -2236,31 +2254,31 @@ let je = class extends ae {
|
|
|
2236
2254
|
const a = this._renderManagerService.getRenderById(r), d = a == null ? void 0 : a.scene;
|
|
2237
2255
|
if (d == null)
|
|
2238
2256
|
return;
|
|
2239
|
-
const h = d.getTransformerByCreate(), l = this._permissionService.composePermission$([new Ze(r).id, new
|
|
2257
|
+
const h = d.getTransformerByCreate(), l = this._permissionService.composePermission$([new Ze(r).id, new Pe(r, s).id]).pipe(ft((u) => u.every((g) => g.value)));
|
|
2240
2258
|
l == null || l.pipe(
|
|
2241
|
-
Me((
|
|
2259
|
+
Me((u) => u !== o),
|
|
2242
2260
|
De()
|
|
2243
2261
|
).subscribe({
|
|
2244
|
-
next: (
|
|
2245
|
-
o =
|
|
2246
|
-
const
|
|
2247
|
-
|
|
2248
|
-
p.classType ===
|
|
2249
|
-
}), this._drawingManagerService.addNotification(m)) : (
|
|
2250
|
-
p.classType ===
|
|
2262
|
+
next: (u) => {
|
|
2263
|
+
o = u, this._drawingManagerService.setDrawingEditable(u);
|
|
2264
|
+
const g = d.getAllObjects(), f = this._drawingManagerService.getDrawingData(r, s), m = Object.values(f);
|
|
2265
|
+
u ? (g.forEach((p) => {
|
|
2266
|
+
p.classType === ae.IMAGE && m.some((S) => p.oKey.includes(S.drawingId)) && d.attachTransformerTo(p);
|
|
2267
|
+
}), this._drawingManagerService.addNotification(m)) : (g.forEach((p) => {
|
|
2268
|
+
p.classType === ae.IMAGE && m.some((S) => p.oKey.includes(S.drawingId)) && d.detachTransformerFrom(p);
|
|
2251
2269
|
}), h.clearSelectedObjects());
|
|
2252
2270
|
}
|
|
2253
|
-
}), (c = this._permissionService.getPermissionPoint$(new
|
|
2254
|
-
Me((
|
|
2271
|
+
}), (c = this._permissionService.getPermissionPoint$(new Pe(r, s).id)) == null || c.pipe(
|
|
2272
|
+
Me((u) => u.value !== o),
|
|
2255
2273
|
De()
|
|
2256
2274
|
).subscribe({
|
|
2257
2275
|
complete: () => {
|
|
2258
2276
|
o = !0;
|
|
2259
|
-
const
|
|
2277
|
+
const u = e.getUnitId(), g = t.getSheetId(), f = this._drawingManagerService.getDrawingData(u, g), m = Object.values(f), p = this._renderManagerService.getRenderById(u), S = p == null ? void 0 : p.scene;
|
|
2260
2278
|
if (S == null)
|
|
2261
2279
|
return;
|
|
2262
2280
|
this._drawingManagerService.setDrawingEditable(!0), S.getAllObjects().forEach((v) => {
|
|
2263
|
-
v.classType ===
|
|
2281
|
+
v.classType === ae.IMAGE && m.some((R) => v.oKey.includes(R.drawingId)) && S.detachTransformerFrom(v);
|
|
2264
2282
|
});
|
|
2265
2283
|
}
|
|
2266
2284
|
});
|
|
@@ -2269,23 +2287,23 @@ let je = class extends ae {
|
|
|
2269
2287
|
);
|
|
2270
2288
|
}
|
|
2271
2289
|
};
|
|
2272
|
-
je =
|
|
2273
|
-
se
|
|
2290
|
+
je = vi([
|
|
2291
|
+
ie(se.Rendered, je),
|
|
2274
2292
|
fe(0, z),
|
|
2275
2293
|
fe(1, K),
|
|
2276
|
-
fe(2,
|
|
2294
|
+
fe(2, ln),
|
|
2277
2295
|
fe(3, he),
|
|
2278
|
-
fe(4, W(
|
|
2296
|
+
fe(4, W(dn))
|
|
2279
2297
|
], je);
|
|
2280
|
-
var
|
|
2281
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2298
|
+
var Si = Object.defineProperty, Ci = Object.getOwnPropertyDescriptor, Ii = (i, e, n, t) => {
|
|
2299
|
+
for (var r = t > 1 ? void 0 : t ? Ci(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2282
2300
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2283
|
-
return t && r &&
|
|
2301
|
+
return t && r && Si(e, n, r), r;
|
|
2284
2302
|
}, Ke = (i, e) => (n, t) => e(n, t, i);
|
|
2285
|
-
let Le = class extends
|
|
2303
|
+
let Le = class extends oe {
|
|
2286
2304
|
constructor(e, n, t) {
|
|
2287
2305
|
super();
|
|
2288
|
-
|
|
2306
|
+
H(this, "_copyInfo");
|
|
2289
2307
|
this._sheetClipboardService = e, this._renderManagerService = n, this._sheetDrawingService = t, this._initCopyPaste();
|
|
2290
2308
|
}
|
|
2291
2309
|
_initCopyPaste() {
|
|
@@ -2293,22 +2311,22 @@ let Le = class extends ae {
|
|
|
2293
2311
|
id: "SHEET_IMAGE_UI_PLUGIN",
|
|
2294
2312
|
onBeforeCopy: (e, n, t) => this._collect(e, n, t),
|
|
2295
2313
|
onPasteCells: (e, n, t, r) => {
|
|
2296
|
-
const { copyType: s =
|
|
2314
|
+
const { copyType: s = gt.COPY, pasteType: o } = r, { range: a } = e || {}, { range: d, unitId: h, subUnitId: l } = n;
|
|
2297
2315
|
return this._generateMutations(d, { copyType: s, pasteType: o, copyRange: a, unitId: h, subUnitId: l });
|
|
2298
2316
|
},
|
|
2299
2317
|
onPastePlainText: (e, n) => ({ undos: [], redos: [] })
|
|
2300
2318
|
});
|
|
2301
2319
|
}
|
|
2302
2320
|
_collect(e, n, t) {
|
|
2303
|
-
var
|
|
2304
|
-
const r = (
|
|
2321
|
+
var u;
|
|
2322
|
+
const r = (u = this._renderManagerService.getRenderById(e)) == null ? void 0 : u.with(re);
|
|
2305
2323
|
if (!r) return;
|
|
2306
2324
|
const s = r.attachRangeWithCoord(t);
|
|
2307
2325
|
if (!s)
|
|
2308
2326
|
return;
|
|
2309
2327
|
const { startX: o, endX: a, startY: d, endY: h } = s, l = this._sheetDrawingService.getDrawingData(e, n), c = [];
|
|
2310
|
-
Object.keys(l).forEach((
|
|
2311
|
-
const f = l[
|
|
2328
|
+
Object.keys(l).forEach((g) => {
|
|
2329
|
+
const f = l[g], { transform: m } = f;
|
|
2312
2330
|
if (f.anchorType !== O.Both || !m)
|
|
2313
2331
|
return;
|
|
2314
2332
|
const { left: p = 0, top: S = 0, width: C = 0, height: v = 0 } = m, { drawingStartX: R, drawingEndX: _, drawingStartY: b, drawingEndY: w } = {
|
|
@@ -2341,7 +2359,7 @@ let Le = class extends ae {
|
|
|
2341
2359
|
const { copyRange: t } = n;
|
|
2342
2360
|
if (!t)
|
|
2343
2361
|
return { redos: [], undos: [] };
|
|
2344
|
-
const { drawings: r, unitId: s, subUnitId: o } = this._copyInfo, { ranges: [a, d], mapFunc: h } =
|
|
2362
|
+
const { drawings: r, unitId: s, subUnitId: o } = this._copyInfo, { ranges: [a, d], mapFunc: h } = Bn([t, e]), { row: l, col: c } = h(a.startRow, a.startColumn), { row: u, col: g } = h(d.startRow, d.startColumn), f = (D = this._renderManagerService.getRenderById(s)) == null ? void 0 : D.with(re);
|
|
2345
2363
|
if (!f)
|
|
2346
2364
|
return { redos: [], undos: [] };
|
|
2347
2365
|
const m = f.attachRangeWithCoord({
|
|
@@ -2350,23 +2368,23 @@ let Le = class extends ae {
|
|
|
2350
2368
|
startColumn: c,
|
|
2351
2369
|
endColumn: c
|
|
2352
2370
|
}), p = f.attachRangeWithCoord({
|
|
2353
|
-
startRow:
|
|
2354
|
-
endRow:
|
|
2355
|
-
startColumn:
|
|
2356
|
-
endColumn:
|
|
2371
|
+
startRow: u,
|
|
2372
|
+
endRow: u,
|
|
2373
|
+
startColumn: g,
|
|
2374
|
+
endColumn: g
|
|
2357
2375
|
});
|
|
2358
2376
|
if (!m || !p)
|
|
2359
2377
|
return { redos: [], undos: [] };
|
|
2360
|
-
const S = [], C = [], v = p.startX - m.startX, R = p.startY - m.startY, _ =
|
|
2361
|
-
return r.forEach((
|
|
2362
|
-
const { transform: U, sheetTransform: M } =
|
|
2378
|
+
const S = [], C = [], v = p.startX - m.startX, R = p.startY - m.startY, _ = u - l, b = g - c, w = n.copyType === gt.CUT, { _sheetDrawingService: P } = this;
|
|
2379
|
+
return r.forEach((T) => {
|
|
2380
|
+
const { transform: U, sheetTransform: M } = T;
|
|
2363
2381
|
if (!U)
|
|
2364
2382
|
return;
|
|
2365
2383
|
const I = {
|
|
2366
|
-
...
|
|
2384
|
+
...T,
|
|
2367
2385
|
unitId: s,
|
|
2368
2386
|
subUnitId: o,
|
|
2369
|
-
drawingId: w ?
|
|
2387
|
+
drawingId: w ? T.drawingId : ne.generateRandomId(),
|
|
2370
2388
|
transform: {
|
|
2371
2389
|
...U,
|
|
2372
2390
|
left: U.left + v,
|
|
@@ -2378,7 +2396,7 @@ let Le = class extends ae {
|
|
|
2378
2396
|
}
|
|
2379
2397
|
};
|
|
2380
2398
|
if (w) {
|
|
2381
|
-
const { undo: A, redo: G, objects: J } =
|
|
2399
|
+
const { undo: A, redo: G, objects: J } = P.getBatchUpdateOp([I]);
|
|
2382
2400
|
S.push({
|
|
2383
2401
|
id: E.id,
|
|
2384
2402
|
params: {
|
|
@@ -2399,7 +2417,7 @@ let Le = class extends ae {
|
|
|
2399
2417
|
}
|
|
2400
2418
|
});
|
|
2401
2419
|
} else {
|
|
2402
|
-
const { undo: A, redo: G, objects: J } =
|
|
2420
|
+
const { undo: A, redo: G, objects: J } = P.getBatchAddOp([I]);
|
|
2403
2421
|
S.push({ id: E.id, params: { op: G, unitId: s, subUnitId: o, objects: J, type: y.INSERT } }), C.push({ id: E.id, params: { op: A, unitId: s, subUnitId: o, objects: J, type: y.REMOVE } });
|
|
2404
2422
|
}
|
|
2405
2423
|
}), {
|
|
@@ -2408,23 +2426,23 @@ let Le = class extends ae {
|
|
|
2408
2426
|
};
|
|
2409
2427
|
}
|
|
2410
2428
|
};
|
|
2411
|
-
Le =
|
|
2412
|
-
se
|
|
2413
|
-
Ke(0,
|
|
2429
|
+
Le = Ii([
|
|
2430
|
+
ie(se.Ready, Le),
|
|
2431
|
+
Ke(0, Wn),
|
|
2414
2432
|
Ke(1, K),
|
|
2415
|
-
Ke(2,
|
|
2433
|
+
Ke(2, k)
|
|
2416
2434
|
], Le);
|
|
2417
|
-
var
|
|
2418
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2435
|
+
var qt = Object.defineProperty, Ri = Object.getOwnPropertyDescriptor, Mi = (i, e, n) => e in i ? qt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, Di = (i, e, n, t) => {
|
|
2436
|
+
for (var r = t > 1 ? void 0 : t ? Ri(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2419
2437
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2420
|
-
return t && r &&
|
|
2421
|
-
}, Je = (i, e) => (n, t) => e(n, t, i),
|
|
2422
|
-
const
|
|
2423
|
-
let $e = class extends
|
|
2438
|
+
return t && r && qt(e, n, r), r;
|
|
2439
|
+
}, Je = (i, e) => (n, t) => e(n, t, i), Qt = (i, e, n) => Mi(i, typeof e != "symbol" ? e + "" : e, n);
|
|
2440
|
+
const bi = "SHEET_IMAGE_UI_PLUGIN";
|
|
2441
|
+
let $e = class extends un {
|
|
2424
2442
|
constructor(e = {}, n, t, r) {
|
|
2425
2443
|
super();
|
|
2426
|
-
|
|
2427
|
-
this._injector = n, this._localeService = t, this._renderManagerService = r, this._pluginConfig =
|
|
2444
|
+
H(this, "_pluginConfig");
|
|
2445
|
+
this._injector = n, this._localeService = t, this._renderManagerService = r, this._pluginConfig = ne.deepMerge({}, ii, e);
|
|
2428
2446
|
}
|
|
2429
2447
|
onStarting(e) {
|
|
2430
2448
|
super.onStarting(e), this._initDependencies(e);
|
|
@@ -2443,7 +2461,7 @@ let $e = class extends ln {
|
|
|
2443
2461
|
useFactory: () => this._injector.createInstance(pe, this._pluginConfig)
|
|
2444
2462
|
}
|
|
2445
2463
|
],
|
|
2446
|
-
[
|
|
2464
|
+
[Te],
|
|
2447
2465
|
[Ne],
|
|
2448
2466
|
[je]
|
|
2449
2467
|
], t = [
|
|
@@ -2460,28 +2478,28 @@ let $e = class extends ln {
|
|
|
2460
2478
|
});
|
|
2461
2479
|
}
|
|
2462
2480
|
};
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
$e =
|
|
2466
|
-
|
|
2481
|
+
Qt($e, "type", B.UNIVER_SHEET);
|
|
2482
|
+
Qt($e, "pluginName", bi);
|
|
2483
|
+
$e = Di([
|
|
2484
|
+
gn(Dn, vn, Sn),
|
|
2467
2485
|
Je(1, W(nt)),
|
|
2468
2486
|
Je(2, W(_e)),
|
|
2469
2487
|
Je(3, K)
|
|
2470
2488
|
], $e);
|
|
2471
2489
|
export {
|
|
2472
2490
|
j as ClearSheetDrawingTransformerOperation,
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2491
|
+
Zt as DeleteDrawingsCommand,
|
|
2492
|
+
Gt as EditSheetDrawingOperation,
|
|
2493
|
+
Ft as GroupSheetDrawingCommand,
|
|
2476
2494
|
Be as InsertCellImageOperation,
|
|
2477
2495
|
xe as InsertFloatImageOperation,
|
|
2478
2496
|
st as InsertSheetDrawingCommand,
|
|
2479
2497
|
ve as MoveDrawingsCommand,
|
|
2480
2498
|
it as RemoveSheetDrawingCommand,
|
|
2481
|
-
|
|
2499
|
+
xt as SetDrawingArrangeCommand,
|
|
2482
2500
|
Fe as SetSheetDrawingCommand,
|
|
2483
2501
|
tt as SheetCanvasFloatDomManagerService,
|
|
2484
|
-
|
|
2485
|
-
|
|
2502
|
+
Vt as SidebarSheetDrawingOperation,
|
|
2503
|
+
Yt as UngroupSheetDrawingCommand,
|
|
2486
2504
|
$e as UniverSheetsDrawingUIPlugin
|
|
2487
2505
|
};
|