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