@univerjs/sheets-drawing-ui 0.5.3-nightly.202501070959 → 0.5.3-nightly.202501081606
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/facade.js +36 -36
- package/lib/es/index.js +869 -871
- package/lib/umd/index.js +2 -2
- package/package.json +15 -14
package/lib/es/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var Wn = Object.defineProperty;
|
|
2
2
|
var xn = (i, e, n) => e in i ? Wn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
3
|
var V = (i, e, n) => xn(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { CommandType as Y, ICommandService as B, IUndoRedoService as
|
|
4
|
+
import { CommandType as Y, ICommandService as B, IUndoRedoService as fe, sequenceExecute as Ft, LocaleService as Je, IUniverInstanceService as pe, useDependency as le, Inject as U, Injector as Ie, IContextService as Vt, RxDisposable as $n, UniverInstanceType as F, connectInjector as Bn, toDisposable as Ln, FOCUSING_COMMON_DRAWINGS as ge, DrawingTypeEnum as k, Disposable as q, ArrangeTypeEnum as be, createDocumentModelWithStyle as Gn, ObjectRelativeFromH as Fn, ObjectRelativeFromV as Vn, BooleanNumber as kn, PositionedObjectLayoutType as Hn, WrapTextType as Yn, BuildTextUtils as Xn, Range as zn, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as De, DOCS_ZEN_EDITOR_UNIT_ID_KEY as ye, InterceptorEffectEnum as Kn, ObjectMatrix as Jn, Tools as ve, UserManagerService as qn, IPermissionService as Zn, Rectangle as Qn, Direction as re, FOCUSING_FX_BAR_EDITOR as er, EDITOR_ACTIVATED as tr, FOCUSING_PANEL_EDITOR as nr, LifecycleService as rr, LifecycleStages as ir, DisposableCollection as sr, fromEventSubject as or, generateRandomId as ar, DependentOn as cr, Plugin as dr, merge as lr, registerDependencies as ur, touchDependencies as rt, IConfigService as hr } from "@univerjs/core";
|
|
5
5
|
import { DocDrawingController as gr, UniverDocsDrawingPlugin as mr } from "@univerjs/docs-drawing";
|
|
6
|
-
import { SetDrawingSelectedOperation as
|
|
7
|
-
import { ImageCropperObject as pr, COMPONENT_IMAGE_POPUP_MENU as _r, OpenImageCropOperation as wr, ImageResetSizeOperation as vr, DrawingRenderService as
|
|
8
|
-
import { IRenderManagerService as X, precisionTo as
|
|
6
|
+
import { SetDrawingSelectedOperation as qe, IImageIoService as kt, IDrawingManagerService as Q, DRAWING_IMAGE_ALLOW_IMAGE_LIST as yt, DRAWING_IMAGE_COUNT_LIMIT as Ot, ImageUploadStatusType as ue, DRAWING_IMAGE_ALLOW_SIZE as Et, getImageSize as Tt, DRAWING_IMAGE_WIDTH_LIMIT as Pt, DRAWING_IMAGE_HEIGHT_LIMIT as Ut, getDrawingShapeKeyByDrawingSearch as it, UniverDrawingPlugin as fr } from "@univerjs/drawing";
|
|
7
|
+
import { ImageCropperObject as pr, COMPONENT_IMAGE_POPUP_MENU as _r, OpenImageCropOperation as wr, ImageResetSizeOperation as vr, DrawingRenderService as Ht, DrawingCommonPanel as Sr, UniverDrawingUIPlugin as Ir } from "@univerjs/drawing-ui";
|
|
8
|
+
import { IRenderManagerService as X, precisionTo as Oe, getGroupState as Cr, transformObjectOutOfGroup as Rr, RENDER_CLASS_TYPE as he, Rect as At, ObjectType as Mr, DRAWING_OBJECT_LAYER_INDEX as br, SHEET_VIEWPORT_KEY as Yt } from "@univerjs/engine-render";
|
|
9
9
|
import { ISheetDrawingService as z, SetDrawingApplyMutation as O, DrawingApplyType as E, SheetDrawingAnchorType as y, UniverSheetsDrawingPlugin as Dr } from "@univerjs/sheets-drawing";
|
|
10
|
-
import { SheetCanvasPopManagerService as yr, convertPositionSheetOverGridToAbsolute as Or, ISheetSelectionRenderService as
|
|
11
|
-
import { ISidebarService as xr, IUIPartsService as $r, BuiltInUIPart as Br, ILocalFileService as Lr, IMessageService as Gr, MenuItemType as
|
|
12
|
-
import { takeUntil as
|
|
13
|
-
import { SheetInterceptorService as
|
|
14
|
-
import
|
|
10
|
+
import { SheetCanvasPopManagerService as yr, convertPositionSheetOverGridToAbsolute as Or, ISheetSelectionRenderService as Ce, SheetSkeletonManagerService as Z, attachRangeWithCoord as Xt, IEditorBridgeService as Er, IAutoFillService as Tr, HoverManagerService as Pr, COPY_TYPE as Nt, PREDEFINED_HOOK_NAME as Ee, virtualizeDiscreteRanges as Ur, ISheetClipboardService as Ar, SheetPrintInterceptorService as Nr, getCurrentRangeDisable$ as jr, SetZoomRatioOperation as Wr } from "@univerjs/sheets-ui";
|
|
11
|
+
import { ISidebarService as xr, IUIPartsService as $r, BuiltInUIPart as Br, ILocalFileService as Lr, IMessageService as Gr, MenuItemType as vt, getMenuHiddenObservable as zt, RibbonStartGroup as Fr, KeyCode as me, ComponentManager as Vr, IMenuManagerService as kr, IShortcutService as Hr, CanvasFloatDomService as Yr } from "@univerjs/ui";
|
|
12
|
+
import { takeUntil as jt, combineLatest as Te, map as Be, filter as ie, distinctUntilChanged as Pe, Subject as st, take as Xr, BehaviorSubject as zr, switchMap as Wt } from "rxjs";
|
|
13
|
+
import { SheetInterceptorService as Ze, getSheetCommandTarget as H, SheetsSelectionsService as Kt, SetRangeValuesCommand as Kr, SetWorksheetRowHeightMutation as Jt, SetWorksheetColWidthMutation as qt, SetWorksheetRowIsAutoHeightMutation as Jr, SetWorksheetRowAutoHeightMutation as qr, AddWorksheetMergeMutation as Zr, RemoveWorksheetMergeMutation as Qr, AFTER_CELL_EDIT as ei, INTERCEPTOR_POINT as ti, InterceptCellContentPriority as ni, WorkbookViewPermission as xt, WorksheetViewPermission as ot, WorkbookEditablePermission as ht, WorksheetEditPermission as $e, InsertRowCommand as Zt, InsertColCommand as Qt, RemoveRowCommand as en, RemoveColCommand as tn, DeleteRangeMoveLeftCommand as nn, DeleteRangeMoveUpCommand as rn, InsertRangeMoveDownCommand as sn, InsertRangeMoveRightCommand as on, DeltaRowHeightCommand as gt, SetRowHeightCommand as mt, DeltaColumnWidthCommand as an, SetColWidthCommand as cn, SetRowHiddenCommand as dn, SetSpecificRowsVisibleCommand as ln, SetSpecificColsVisibleCommand as un, SetColHiddenCommand as hn, MoveColsCommand as gn, MoveRowsCommand as mn, MoveRangeCommand as fn, SetRowVisibleMutation as ri, SetRowHiddenMutation as ii, SetColVisibleMutation as si, SetColHiddenMutation as oi, SetWorksheetActiveOperation as ai, RangeProtectionPermissionEditPoint as ci, SetFrozenMutation as di } from "@univerjs/sheets";
|
|
14
|
+
import pn, { useEffect as St, forwardRef as _n, useRef as li, createElement as wn, useState as ft } from "react";
|
|
15
15
|
import { docDrawingPositionToTransform as ui, ReplaceSnapshotCommand as hi } from "@univerjs/docs-ui";
|
|
16
|
-
import { MessageType as
|
|
17
|
-
const mi = "sheets-drawing-ui.config",
|
|
16
|
+
import { MessageType as ae, RadioGroup as gi, Radio as at } from "@univerjs/design";
|
|
17
|
+
const mi = "sheets-drawing-ui.config", $t = {}, W = {
|
|
18
18
|
id: "sheet.operation.clear-drawing-transformer",
|
|
19
19
|
type: Y.MUTATION,
|
|
20
20
|
handler: (i, e) => {
|
|
@@ -24,48 +24,48 @@ const mi = "sheets-drawing-ui.config", xt = {}, W = {
|
|
|
24
24
|
(s = (r = n.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
|
|
25
25
|
}), !0;
|
|
26
26
|
}
|
|
27
|
-
},
|
|
27
|
+
}, Qe = {
|
|
28
28
|
id: "sheet.command.remove-sheet-image",
|
|
29
29
|
type: Y.COMMAND,
|
|
30
30
|
handler: (i, e) => {
|
|
31
|
-
var I, S,
|
|
32
|
-
const n = i.get(B), t = i.get(
|
|
31
|
+
var I, S, M;
|
|
32
|
+
const n = i.get(B), t = i.get(fe), r = i.get(Ze), s = i.get(z);
|
|
33
33
|
if (!e) return !1;
|
|
34
|
-
const { drawings: o } = e,
|
|
34
|
+
const { drawings: o } = e, a = [];
|
|
35
35
|
o.forEach((w) => {
|
|
36
36
|
const { unitId: C } = w;
|
|
37
|
-
|
|
37
|
+
a.push(C);
|
|
38
38
|
});
|
|
39
|
-
const l = s.getBatchRemoveOp(o), { unitId: g, subUnitId:
|
|
40
|
-
return
|
|
39
|
+
const l = s.getBatchRemoveOp(o), { unitId: g, subUnitId: d, undo: c, redo: h, objects: u } = l, m = r.onCommandExecute({ id: Qe.id, params: e }), f = { id: O.id, params: { unitId: g, subUnitId: d, op: h, objects: u, type: E.REMOVE } }, p = { id: O.id, params: { unitId: g, subUnitId: d, op: c, objects: u, type: E.INSERT } };
|
|
40
|
+
return Ft([...(I = m.preRedos) != null ? I : [], f, ...m.redos], n) ? (t.pushUndoRedo({
|
|
41
41
|
unitID: g,
|
|
42
42
|
undoMutations: [
|
|
43
43
|
...(S = m.preUndos) != null ? S : [],
|
|
44
44
|
p,
|
|
45
45
|
...m.undos,
|
|
46
|
-
{ id: W.id, params:
|
|
46
|
+
{ id: W.id, params: a }
|
|
47
47
|
],
|
|
48
48
|
redoMutations: [
|
|
49
|
-
...(
|
|
49
|
+
...(M = m.preRedos) != null ? M : [],
|
|
50
50
|
f,
|
|
51
51
|
...m.redos,
|
|
52
|
-
{ id: W.id, params:
|
|
52
|
+
{ id: W.id, params: a }
|
|
53
53
|
]
|
|
54
54
|
}), !0) : !1;
|
|
55
55
|
}
|
|
56
|
-
},
|
|
56
|
+
}, vn = "COMPONENT_SHEET_DRAWING_PANEL", Sn = {
|
|
57
57
|
id: "sidebar.operation.sheet-image",
|
|
58
58
|
type: Y.COMMAND,
|
|
59
59
|
handler: async (i, e) => {
|
|
60
|
-
const n = i.get(xr), t = i.get(
|
|
60
|
+
const n = i.get(xr), t = i.get(Je), r = i.get(pe), s = i.get(B);
|
|
61
61
|
if (!H(r)) return !1;
|
|
62
62
|
switch (e.value) {
|
|
63
63
|
case "open":
|
|
64
64
|
n.open({
|
|
65
65
|
header: { title: t.t("sheetImage.panel.title") },
|
|
66
|
-
children: { label:
|
|
66
|
+
children: { label: vn },
|
|
67
67
|
onClose: () => {
|
|
68
|
-
s.syncExecuteCommand(
|
|
68
|
+
s.syncExecuteCommand(qe.id, []);
|
|
69
69
|
},
|
|
70
70
|
width: 360
|
|
71
71
|
});
|
|
@@ -77,15 +77,15 @@ const mi = "sheets-drawing-ui.config", xt = {}, W = {
|
|
|
77
77
|
}
|
|
78
78
|
return !0;
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, In = {
|
|
81
81
|
id: "sheet.operation.edit-sheet-image",
|
|
82
82
|
type: Y.OPERATION,
|
|
83
83
|
handler: (i, e) => {
|
|
84
84
|
const n = i.get(B);
|
|
85
|
-
return e == null ? !1 : (n.syncExecuteCommand(
|
|
85
|
+
return e == null ? !1 : (n.syncExecuteCommand(qe.id, [e]), n.executeCommand(Sn.id, { value: "open" }), !0);
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
var
|
|
88
|
+
var ct = { exports: {} }, _e = {};
|
|
89
89
|
/**
|
|
90
90
|
* @license React
|
|
91
91
|
* react-jsx-runtime.production.min.js
|
|
@@ -95,58 +95,58 @@ var at = { exports: {} }, pe = {};
|
|
|
95
95
|
* This source code is licensed under the MIT license found in the
|
|
96
96
|
* LICENSE file in the root directory of this source tree.
|
|
97
97
|
*/
|
|
98
|
-
var
|
|
98
|
+
var Bt;
|
|
99
99
|
function fi() {
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
var i =
|
|
103
|
-
function o(
|
|
104
|
-
var
|
|
100
|
+
if (Bt) return _e;
|
|
101
|
+
Bt = 1;
|
|
102
|
+
var i = pn, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), t = 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 };
|
|
103
|
+
function o(a, l, g) {
|
|
104
|
+
var d, c = {}, h = null, u = null;
|
|
105
105
|
g !== void 0 && (h = "" + g), l.key !== void 0 && (h = "" + l.key), l.ref !== void 0 && (u = l.ref);
|
|
106
|
-
for (
|
|
107
|
-
if (
|
|
108
|
-
return { $$typeof: e, type:
|
|
106
|
+
for (d in l) t.call(l, d) && !s.hasOwnProperty(d) && (c[d] = l[d]);
|
|
107
|
+
if (a && a.defaultProps) for (d in l = a.defaultProps, l) c[d] === void 0 && (c[d] = l[d]);
|
|
108
|
+
return { $$typeof: e, type: a, key: h, ref: u, props: c, _owner: r.current };
|
|
109
109
|
}
|
|
110
|
-
return
|
|
110
|
+
return _e.Fragment = n, _e.jsx = o, _e.jsxs = o, _e;
|
|
111
111
|
}
|
|
112
|
-
var
|
|
112
|
+
var Lt;
|
|
113
113
|
function pi() {
|
|
114
|
-
return
|
|
114
|
+
return Lt || (Lt = 1, ct.exports = fi()), ct.exports;
|
|
115
115
|
}
|
|
116
116
|
var $ = pi();
|
|
117
|
-
const _i = "univer-upload-loading", wi = "univer-upload-loading-body", vi = "univer-upload-loading-body-animation", Si = "univer-UniverCircleAnimation", Ii = "univer-upload-loading-body-text",
|
|
117
|
+
const _i = "univer-upload-loading", wi = "univer-upload-loading-body", vi = "univer-upload-loading-body-animation", Si = "univer-UniverCircleAnimation", Ii = "univer-upload-loading-body-text", Ue = {
|
|
118
118
|
uploadLoading: _i,
|
|
119
119
|
uploadLoadingBody: wi,
|
|
120
120
|
uploadLoadingBodyAnimation: vi,
|
|
121
121
|
univerCircleAnimation: Si,
|
|
122
122
|
uploadLoadingBodyText: Ii
|
|
123
123
|
}, Ci = () => {
|
|
124
|
-
const i =
|
|
125
|
-
return
|
|
124
|
+
const i = le(kt), e = le(Je), [n, t] = pn.useState(0);
|
|
125
|
+
return St(() => {
|
|
126
126
|
const r = i.change$.subscribe((s) => {
|
|
127
127
|
t(s);
|
|
128
128
|
});
|
|
129
129
|
return () => {
|
|
130
130
|
r.unsubscribe();
|
|
131
131
|
};
|
|
132
|
-
}, [i]), /* @__PURE__ */ $.jsx("div", { style: { display: n > 0 ? "block" : "none" }, className:
|
|
133
|
-
/* @__PURE__ */ $.jsx("div", { className:
|
|
134
|
-
/* @__PURE__ */ $.jsx("div", { className:
|
|
132
|
+
}, [i]), /* @__PURE__ */ $.jsx("div", { style: { display: n > 0 ? "block" : "none" }, className: Ue.uploadLoading, children: /* @__PURE__ */ $.jsxs("div", { className: Ue.uploadLoadingBody, children: [
|
|
133
|
+
/* @__PURE__ */ $.jsx("div", { className: Ue.uploadLoadingBodyAnimation }),
|
|
134
|
+
/* @__PURE__ */ $.jsx("div", { className: Ue.uploadLoadingBodyText, children: `${e.t("uploadLoading.loading")}: ${n}` })
|
|
135
135
|
] }) });
|
|
136
136
|
};
|
|
137
137
|
var Ri = Object.defineProperty, Mi = Object.getOwnPropertyDescriptor, bi = (i, e, n, t) => {
|
|
138
138
|
for (var r = t > 1 ? void 0 : t ? Mi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
139
139
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
140
140
|
return t && r && Ri(e, n, r), r;
|
|
141
|
-
},
|
|
142
|
-
let
|
|
143
|
-
constructor(e, n, t, r, s, o,
|
|
141
|
+
}, ee = (i, e) => (n, t) => e(n, t, i);
|
|
142
|
+
let Le = class extends $n {
|
|
143
|
+
constructor(e, n, t, r, s, o, a, l) {
|
|
144
144
|
super();
|
|
145
145
|
V(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
146
|
-
this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService =
|
|
146
|
+
this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._commandService = l, this._init();
|
|
147
147
|
}
|
|
148
148
|
_init() {
|
|
149
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(
|
|
149
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(jt(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(F.UNIVER_SHEET).pipe(jt(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(F.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(Br.CONTENT, () => Bn(Ci, this._injector));
|
|
150
150
|
}
|
|
151
151
|
_dispose(e) {
|
|
152
152
|
const n = e.getUnitId();
|
|
@@ -177,41 +177,41 @@ let Be = class extends $n {
|
|
|
177
177
|
this.disposeWithMe(
|
|
178
178
|
Ln(
|
|
179
179
|
t.createControl$.subscribe(() => {
|
|
180
|
-
if (this._contextService.setContextValue(
|
|
180
|
+
if (this._contextService.setContextValue(ge, !0), this._hasCropObject(n))
|
|
181
181
|
return;
|
|
182
182
|
const o = t.getSelectedObjectMap();
|
|
183
183
|
if (o.size > 1) {
|
|
184
184
|
r == null || r.dispose();
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
|
-
const
|
|
188
|
-
if (!
|
|
187
|
+
const a = o.values().next().value;
|
|
188
|
+
if (!a)
|
|
189
189
|
return;
|
|
190
|
-
const l =
|
|
190
|
+
const l = a.oKey, g = this._drawingManagerService.getDrawingOKey(l);
|
|
191
191
|
if (!g)
|
|
192
192
|
return;
|
|
193
|
-
const { unitId:
|
|
193
|
+
const { unitId: d, subUnitId: c, drawingId: h, drawingType: u } = g, m = g.data;
|
|
194
194
|
if (m && m.disablePopup)
|
|
195
195
|
return;
|
|
196
196
|
r == null || r.dispose();
|
|
197
|
-
const f = this._canvasPopManagerService.getFeatureMenu(
|
|
198
|
-
r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(
|
|
197
|
+
const f = this._canvasPopManagerService.getFeatureMenu(d, c, h, u);
|
|
198
|
+
r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
|
|
199
199
|
componentKey: _r,
|
|
200
200
|
direction: "horizontal",
|
|
201
201
|
offset: [2, 0],
|
|
202
202
|
extraProps: {
|
|
203
|
-
menuItems: f || this._getImageMenuItems(
|
|
203
|
+
menuItems: f || this._getImageMenuItems(d, c, h, u)
|
|
204
204
|
}
|
|
205
205
|
}));
|
|
206
206
|
})
|
|
207
207
|
)
|
|
208
208
|
), this.disposeWithMe(
|
|
209
209
|
t.clearControl$.subscribe(() => {
|
|
210
|
-
r == null || r.dispose(), this._contextService.setContextValue(
|
|
210
|
+
r == null || r.dispose(), this._contextService.setContextValue(ge, !1), this._commandService.syncExecuteCommand(qe.id, []);
|
|
211
211
|
})
|
|
212
212
|
), this.disposeWithMe(
|
|
213
213
|
this._contextService.contextChanged$.subscribe((o) => {
|
|
214
|
-
o[
|
|
214
|
+
o[ge] === !1 && (r == null || r.dispose());
|
|
215
215
|
})
|
|
216
216
|
), this.disposeWithMe(
|
|
217
217
|
t.changing$.subscribe(() => {
|
|
@@ -224,14 +224,14 @@ let Be = class extends $n {
|
|
|
224
224
|
{
|
|
225
225
|
label: "image-popup.edit",
|
|
226
226
|
index: 0,
|
|
227
|
-
commandId:
|
|
227
|
+
commandId: In.id,
|
|
228
228
|
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
229
229
|
disable: r === k.DRAWING_DOM
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
232
|
label: "image-popup.delete",
|
|
233
233
|
index: 1,
|
|
234
|
-
commandId:
|
|
234
|
+
commandId: Qe.id,
|
|
235
235
|
commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
|
|
236
236
|
disable: !1
|
|
237
237
|
},
|
|
@@ -252,32 +252,32 @@ let Be = class extends $n {
|
|
|
252
252
|
];
|
|
253
253
|
}
|
|
254
254
|
};
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
],
|
|
255
|
+
Le = bi([
|
|
256
|
+
ee(0, U(Ie)),
|
|
257
|
+
ee(1, Q),
|
|
258
|
+
ee(2, U(yr)),
|
|
259
|
+
ee(3, X),
|
|
260
|
+
ee(4, pe),
|
|
261
|
+
ee(5, Vt),
|
|
262
|
+
ee(6, U($r)),
|
|
263
|
+
ee(7, B)
|
|
264
|
+
], Le);
|
|
265
265
|
function L(i, e, n) {
|
|
266
|
-
const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle:
|
|
267
|
-
if (
|
|
266
|
+
const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: l = 0, skewY: g = 0 } = i, d = n.getCurrent();
|
|
267
|
+
if (d == null)
|
|
268
268
|
return;
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
const c = Or(
|
|
270
|
+
d.unitId,
|
|
271
|
+
d.sheetId,
|
|
272
272
|
{ from: t, to: r },
|
|
273
273
|
n
|
|
274
274
|
);
|
|
275
|
-
let { left: h, top: u, width: m, height: f } =
|
|
275
|
+
let { left: h, top: u, width: m, height: f } = c;
|
|
276
276
|
const p = n.getCurrentSkeleton(), v = p.rowHeaderWidth + p.columnTotalWidth, I = p.columnHeaderHeight + p.rowTotalHeight;
|
|
277
277
|
return h + m > v && (h = v - m), u + f > I && (u = I - f), {
|
|
278
278
|
flipY: s,
|
|
279
279
|
flipX: o,
|
|
280
|
-
angle:
|
|
280
|
+
angle: a,
|
|
281
281
|
skewX: l,
|
|
282
282
|
skewY: g,
|
|
283
283
|
left: h,
|
|
@@ -287,29 +287,29 @@ function L(i, e, n) {
|
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
289
|
function j(i, e) {
|
|
290
|
-
const { left: n = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX:
|
|
291
|
-
if (
|
|
290
|
+
const { left: n = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: l = 0, skewX: g = 0, skewY: d = 0 } = i, c = e.getCellWithCoordByOffset(n, t);
|
|
291
|
+
if (c == null)
|
|
292
292
|
return;
|
|
293
293
|
const h = {
|
|
294
|
-
column:
|
|
295
|
-
columnOffset:
|
|
296
|
-
row:
|
|
297
|
-
rowOffset:
|
|
294
|
+
column: c.actualColumn,
|
|
295
|
+
columnOffset: Oe(n - c.startX, 1),
|
|
296
|
+
row: c.actualRow,
|
|
297
|
+
rowOffset: Oe(t - c.startY, 1)
|
|
298
298
|
}, u = e.getCellWithCoordByOffset(n + r, t + s);
|
|
299
299
|
if (u == null)
|
|
300
300
|
return;
|
|
301
301
|
const m = {
|
|
302
302
|
column: u.actualColumn,
|
|
303
|
-
columnOffset:
|
|
303
|
+
columnOffset: Oe(n + r - u.startX, 1),
|
|
304
304
|
row: u.actualRow,
|
|
305
|
-
rowOffset:
|
|
305
|
+
rowOffset: Oe(t + s - u.startY, 1)
|
|
306
306
|
};
|
|
307
307
|
return {
|
|
308
308
|
flipY: o,
|
|
309
|
-
flipX:
|
|
309
|
+
flipX: a,
|
|
310
310
|
angle: l,
|
|
311
311
|
skewX: g,
|
|
312
|
-
skewY:
|
|
312
|
+
skewY: d,
|
|
313
313
|
from: h,
|
|
314
314
|
to: m
|
|
315
315
|
};
|
|
@@ -318,8 +318,8 @@ var Di = Object.defineProperty, yi = Object.getOwnPropertyDescriptor, Oi = (i, e
|
|
|
318
318
|
for (var r = t > 1 ? void 0 : t ? yi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
319
319
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
320
320
|
return t && r && Di(e, n, r), r;
|
|
321
|
-
},
|
|
322
|
-
let
|
|
321
|
+
}, Ae = (i, e) => (n, t) => e(n, t, i);
|
|
322
|
+
let pt = class extends q {
|
|
323
323
|
constructor(i, e, n, t, r) {
|
|
324
324
|
super(), this._context = i, this._sheetDrawingService = e, this._drawingManagerService = n, this._sheetSelectionRenderService = t, this._sheetSkeletonManagerService = r, this._init();
|
|
325
325
|
}
|
|
@@ -339,17 +339,17 @@ let ft = class extends q {
|
|
|
339
339
|
this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
|
|
340
340
|
}
|
|
341
341
|
};
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
],
|
|
342
|
+
pt = Oi([
|
|
343
|
+
Ae(1, z),
|
|
344
|
+
Ae(2, Q),
|
|
345
|
+
Ae(3, U(Ce)),
|
|
346
|
+
Ae(4, U(Z))
|
|
347
|
+
], pt);
|
|
348
348
|
function Ei(i) {
|
|
349
349
|
const e = [];
|
|
350
350
|
return i.forEach((n) => {
|
|
351
|
-
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId:
|
|
352
|
-
const h =
|
|
351
|
+
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a } = t, l = Cr(0, 0, r.map((c) => c.transform || {})), g = r.map((c) => {
|
|
352
|
+
const h = c.transform || { left: 0, top: 0 }, { unitId: u, subUnitId: m, drawingId: f } = c;
|
|
353
353
|
return {
|
|
354
354
|
unitId: u,
|
|
355
355
|
subUnitId: m,
|
|
@@ -359,17 +359,17 @@ function Ei(i) {
|
|
|
359
359
|
left: h.left - l.left,
|
|
360
360
|
top: h.top - l.top
|
|
361
361
|
},
|
|
362
|
-
groupId:
|
|
362
|
+
groupId: a
|
|
363
363
|
};
|
|
364
|
-
}),
|
|
364
|
+
}), d = {
|
|
365
365
|
unitId: s,
|
|
366
366
|
subUnitId: o,
|
|
367
|
-
drawingId:
|
|
367
|
+
drawingId: a,
|
|
368
368
|
drawingType: k.DRAWING_GROUP,
|
|
369
369
|
transform: l
|
|
370
370
|
};
|
|
371
371
|
e.push({
|
|
372
|
-
parent:
|
|
372
|
+
parent: d,
|
|
373
373
|
children: g
|
|
374
374
|
});
|
|
375
375
|
}), e;
|
|
@@ -377,11 +377,11 @@ function Ei(i) {
|
|
|
377
377
|
function Ti(i) {
|
|
378
378
|
const e = [];
|
|
379
379
|
return i.forEach((n) => {
|
|
380
|
-
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId:
|
|
380
|
+
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a, transform: l = { width: 0, height: 0 } } = t;
|
|
381
381
|
if (l == null)
|
|
382
382
|
return;
|
|
383
|
-
const g = r.map((
|
|
384
|
-
const { transform: h } =
|
|
383
|
+
const g = r.map((c) => {
|
|
384
|
+
const { transform: h } = c, { unitId: u, subUnitId: m, drawingId: f } = c, p = Rr(h || {}, l, l.width || 0, l.height || 0);
|
|
385
385
|
return {
|
|
386
386
|
unitId: u,
|
|
387
387
|
subUnitId: m,
|
|
@@ -389,10 +389,10 @@ function Ti(i) {
|
|
|
389
389
|
transform: p,
|
|
390
390
|
groupId: void 0
|
|
391
391
|
};
|
|
392
|
-
}),
|
|
392
|
+
}), d = {
|
|
393
393
|
unitId: s,
|
|
394
394
|
subUnitId: o,
|
|
395
|
-
drawingId:
|
|
395
|
+
drawingId: a,
|
|
396
396
|
drawingType: k.DRAWING_GROUP,
|
|
397
397
|
transform: {
|
|
398
398
|
left: 0,
|
|
@@ -400,16 +400,16 @@ function Ti(i) {
|
|
|
400
400
|
}
|
|
401
401
|
};
|
|
402
402
|
e.push({
|
|
403
|
-
parent:
|
|
403
|
+
parent: d,
|
|
404
404
|
children: g
|
|
405
405
|
});
|
|
406
406
|
}), e;
|
|
407
407
|
}
|
|
408
|
-
const
|
|
408
|
+
const Cn = {
|
|
409
409
|
id: "sheet.command.group-sheet-image",
|
|
410
410
|
type: Y.COMMAND,
|
|
411
411
|
handler: (i, e) => {
|
|
412
|
-
const n = i.get(B), t = i.get(
|
|
412
|
+
const n = i.get(B), t = i.get(fe), r = i.get(z);
|
|
413
413
|
if (!e) return !1;
|
|
414
414
|
const s = [];
|
|
415
415
|
e.forEach(({ parent: u, children: m }) => {
|
|
@@ -417,88 +417,88 @@ const In = {
|
|
|
417
417
|
s.push(f.unitId);
|
|
418
418
|
});
|
|
419
419
|
});
|
|
420
|
-
const o = r.getGroupDrawingOp(e), { unitId:
|
|
421
|
-
return n.syncExecuteCommand(O.id, { op:
|
|
422
|
-
unitID:
|
|
420
|
+
const o = r.getGroupDrawingOp(e), { unitId: a, subUnitId: l, undo: g, redo: d, objects: c } = o;
|
|
421
|
+
return n.syncExecuteCommand(O.id, { op: d, unitId: a, subUnitId: l, objects: c, type: E.GROUP }) ? (t.pushUndoRedo({
|
|
422
|
+
unitID: a,
|
|
423
423
|
undoMutations: [
|
|
424
|
-
{ id: O.id, params: { op: g, unitId:
|
|
424
|
+
{ id: O.id, params: { op: g, unitId: a, subUnitId: l, objects: Ti(c), type: E.UNGROUP } },
|
|
425
425
|
{ id: W.id, params: s }
|
|
426
426
|
],
|
|
427
427
|
redoMutations: [
|
|
428
|
-
{ id: O.id, params: { op:
|
|
428
|
+
{ id: O.id, params: { op: d, unitId: a, subUnitId: l, objects: c, type: E.GROUP } },
|
|
429
429
|
{ id: W.id, params: s }
|
|
430
430
|
]
|
|
431
431
|
}), !0) : !1;
|
|
432
432
|
}
|
|
433
|
-
},
|
|
433
|
+
}, et = {
|
|
434
434
|
id: "sheet.command.insert-sheet-image",
|
|
435
435
|
type: Y.COMMAND,
|
|
436
436
|
handler: (i, e) => {
|
|
437
|
-
var I, S,
|
|
438
|
-
const n = i.get(B), t = i.get(
|
|
437
|
+
var I, S, M;
|
|
438
|
+
const n = i.get(B), t = i.get(fe), r = i.get(z), s = i.get(Ze);
|
|
439
439
|
if (!e) return !1;
|
|
440
|
-
const o = e.drawings,
|
|
441
|
-
return
|
|
440
|
+
const o = e.drawings, a = o.map((w) => w.unitId), l = r.getBatchAddOp(o), { unitId: g, subUnitId: d, undo: c, redo: h, objects: u } = l, m = s.onCommandExecute({ id: et.id, params: e }), f = { id: O.id, params: { op: h, unitId: g, subUnitId: d, objects: u, type: E.INSERT } }, p = { id: O.id, params: { op: c, unitId: g, subUnitId: d, objects: u, type: E.REMOVE } };
|
|
441
|
+
return Ft([...(I = m.preRedos) != null ? I : [], f, ...m.redos], n) ? (t.pushUndoRedo({
|
|
442
442
|
unitID: g,
|
|
443
443
|
undoMutations: [
|
|
444
444
|
...(S = m.preUndos) != null ? S : [],
|
|
445
445
|
p,
|
|
446
446
|
...m.undos,
|
|
447
|
-
{ id: W.id, params:
|
|
447
|
+
{ id: W.id, params: a }
|
|
448
448
|
],
|
|
449
449
|
redoMutations: [
|
|
450
|
-
...(
|
|
450
|
+
...(M = m.preRedos) != null ? M : [],
|
|
451
451
|
f,
|
|
452
452
|
...m.redos,
|
|
453
|
-
{ id: W.id, params:
|
|
453
|
+
{ id: W.id, params: a }
|
|
454
454
|
]
|
|
455
455
|
}), !0) : !1;
|
|
456
456
|
}
|
|
457
|
-
},
|
|
457
|
+
}, Rn = {
|
|
458
458
|
id: "sheet.command.set-drawing-arrange",
|
|
459
459
|
type: Y.COMMAND,
|
|
460
460
|
handler: (i, e) => {
|
|
461
|
-
const n = i.get(B), t = i.get(
|
|
461
|
+
const n = i.get(B), t = i.get(fe);
|
|
462
462
|
if (!e) return !1;
|
|
463
|
-
const r = i.get(z), { unitId: s, subUnitId: o, drawingIds:
|
|
464
|
-
let
|
|
465
|
-
if (l ===
|
|
463
|
+
const r = i.get(z), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: l } = e, g = { unitId: s, subUnitId: o, drawingIds: a };
|
|
464
|
+
let d;
|
|
465
|
+
if (l === be.forward ? d = r.getForwardDrawingsOp(g) : l === be.backward ? d = r.getBackwardDrawingOp(g) : l === be.front ? d = r.getFrontDrawingsOp(g) : l === be.back && (d = r.getBackDrawingsOp(g)), d == null)
|
|
466
466
|
return !1;
|
|
467
|
-
const { objects:
|
|
468
|
-
return n.syncExecuteCommand(O.id, { op: h, unitId: s, subUnitId: o, objects:
|
|
467
|
+
const { objects: c, redo: h, undo: u } = d;
|
|
468
|
+
return n.syncExecuteCommand(O.id, { op: h, unitId: s, subUnitId: o, objects: c, type: E.ARRANGE }) ? (t.pushUndoRedo({
|
|
469
469
|
unitID: s,
|
|
470
470
|
undoMutations: [
|
|
471
|
-
{ id: O.id, params: { op: u, unitId: s, subUnitId: o, objects:
|
|
471
|
+
{ id: O.id, params: { op: u, unitId: s, subUnitId: o, objects: c, type: E.ARRANGE } }
|
|
472
472
|
],
|
|
473
473
|
redoMutations: [
|
|
474
|
-
{ id: O.id, params: { op: h, unitId: s, subUnitId: o, objects:
|
|
474
|
+
{ id: O.id, params: { op: h, unitId: s, subUnitId: o, objects: c, type: E.ARRANGE } }
|
|
475
475
|
]
|
|
476
476
|
}), !0) : !1;
|
|
477
477
|
}
|
|
478
|
-
},
|
|
478
|
+
}, tt = {
|
|
479
479
|
id: "sheet.command.set-sheet-image",
|
|
480
480
|
type: Y.COMMAND,
|
|
481
481
|
handler: (i, e) => {
|
|
482
|
-
const n = i.get(B), t = i.get(
|
|
482
|
+
const n = i.get(B), t = i.get(fe), r = i.get(z);
|
|
483
483
|
if (!e) return !1;
|
|
484
|
-
const { drawings: s } = e, o = r.getBatchUpdateOp(s), { unitId:
|
|
485
|
-
return n.syncExecuteCommand(O.id, { unitId:
|
|
486
|
-
unitID:
|
|
484
|
+
const { drawings: s } = e, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: l, undo: g, redo: d, objects: c } = o;
|
|
485
|
+
return n.syncExecuteCommand(O.id, { unitId: a, subUnitId: l, op: d, objects: c, type: E.UPDATE }) ? (t.pushUndoRedo({
|
|
486
|
+
unitID: a,
|
|
487
487
|
undoMutations: [
|
|
488
|
-
{ id: O.id, params: { unitId:
|
|
489
|
-
{ id: W.id, params: [
|
|
488
|
+
{ id: O.id, params: { unitId: a, subUnitId: l, op: g, objects: c, type: E.UPDATE } },
|
|
489
|
+
{ id: W.id, params: [a] }
|
|
490
490
|
],
|
|
491
491
|
redoMutations: [
|
|
492
|
-
{ id: O.id, params: { unitId:
|
|
493
|
-
{ id: W.id, params: [
|
|
492
|
+
{ id: O.id, params: { unitId: a, subUnitId: l, op: d, objects: c, type: E.UPDATE } },
|
|
493
|
+
{ id: W.id, params: [a] }
|
|
494
494
|
]
|
|
495
495
|
}), !0) : !1;
|
|
496
496
|
}
|
|
497
|
-
},
|
|
497
|
+
}, Mn = {
|
|
498
498
|
id: "sheet.command.ungroup-sheet-image",
|
|
499
499
|
type: Y.COMMAND,
|
|
500
500
|
handler: (i, e) => {
|
|
501
|
-
const n = i.get(B), t = i.get(
|
|
501
|
+
const n = i.get(B), t = i.get(fe), r = i.get(z);
|
|
502
502
|
if (!e) return !1;
|
|
503
503
|
const s = [];
|
|
504
504
|
e.forEach(({ parent: u, children: m }) => {
|
|
@@ -506,15 +506,15 @@ const In = {
|
|
|
506
506
|
s.push(f.unitId);
|
|
507
507
|
});
|
|
508
508
|
});
|
|
509
|
-
const o = r.getUngroupDrawingOp(e), { unitId:
|
|
510
|
-
return n.syncExecuteCommand(O.id, { op:
|
|
511
|
-
unitID:
|
|
509
|
+
const o = r.getUngroupDrawingOp(e), { unitId: a, subUnitId: l, undo: g, redo: d, objects: c } = o;
|
|
510
|
+
return n.syncExecuteCommand(O.id, { op: d, unitId: a, subUnitId: l, objects: c, type: E.UNGROUP }) ? (t.pushUndoRedo({
|
|
511
|
+
unitID: a,
|
|
512
512
|
undoMutations: [
|
|
513
|
-
{ id: O.id, params: { op: g, unitId:
|
|
513
|
+
{ id: O.id, params: { op: g, unitId: a, subUnitId: l, objects: Ei(c), type: E.GROUP } },
|
|
514
514
|
{ id: W.id, params: s }
|
|
515
515
|
],
|
|
516
516
|
redoMutations: [
|
|
517
|
-
{ id: O.id, params: { op:
|
|
517
|
+
{ id: O.id, params: { op: d, unitId: a, subUnitId: l, objects: c, type: E.UNGROUP } },
|
|
518
518
|
{ id: W.id, params: s }
|
|
519
519
|
]
|
|
520
520
|
}), !0) : !1;
|
|
@@ -529,40 +529,40 @@ function Ni(i, e, n) {
|
|
|
529
529
|
const t = n * Math.PI / 180, r = Math.abs(i * Math.cos(t)) + Math.abs(e * Math.sin(t)), s = Math.abs(i * Math.sin(t)) + Math.abs(e * Math.cos(t));
|
|
530
530
|
return { rotatedWidth: r, rotatedHeight: s };
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function bn(i, e, n, t, r) {
|
|
533
533
|
var I;
|
|
534
534
|
const { rotatedHeight: s, rotatedWidth: o } = Ni(n, t, r), l = i.get(X).getRenderById(e.unitId);
|
|
535
535
|
if (!l)
|
|
536
536
|
return !1;
|
|
537
|
-
const
|
|
538
|
-
if (
|
|
537
|
+
const d = (I = l.with(Z).getWorksheetSkeleton(e.subUnitId)) == null ? void 0 : I.skeleton;
|
|
538
|
+
if (d == null)
|
|
539
539
|
return !1;
|
|
540
|
-
const
|
|
540
|
+
const c = d.getCellByIndex(e.row, e.col), h = c.mergeInfo.endX - c.mergeInfo.startX - 2, u = c.mergeInfo.endY - c.mergeInfo.startY - 2, m = o / s, p = Math.ceil(Math.min(h, u * m)) / o, v = !p || Number.isNaN(p) ? 1e-3 : p;
|
|
541
541
|
return {
|
|
542
542
|
width: n * v,
|
|
543
543
|
height: t * v
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
|
-
let
|
|
547
|
-
constructor(e, n, t, r, s, o,
|
|
546
|
+
let Se = class extends q {
|
|
547
|
+
constructor(e, n, t, r, s, o, a, l, g, d, c, h, u) {
|
|
548
548
|
super();
|
|
549
549
|
V(this, "_workbookSelections");
|
|
550
|
-
this._context = e, this._skeletonManagerService = n, this._commandService = t, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService =
|
|
550
|
+
this._context = e, this._skeletonManagerService = n, this._commandService = t, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = a, this._drawingManagerService = l, this._contextService = g, this._messageService = d, this._localeService = c, this._injector = u, this._workbookSelections = h.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
|
|
551
551
|
}
|
|
552
552
|
async insertFloatImage() {
|
|
553
553
|
const e = await this._fileOpenerService.openFile({
|
|
554
554
|
multiple: !0,
|
|
555
|
-
accept:
|
|
555
|
+
accept: yt.map((t) => `.${t.replace("image/", "")}`).join(",")
|
|
556
556
|
}), n = e.length;
|
|
557
|
-
return n >
|
|
558
|
-
type:
|
|
559
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(
|
|
557
|
+
return n > Ot ? (this._messageService.show({
|
|
558
|
+
type: ae.Error,
|
|
559
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(Ot))
|
|
560
560
|
}), !1) : n === 0 ? !1 : (e.forEach(async (t) => await this._insertFloatImage(t)), !0);
|
|
561
561
|
}
|
|
562
562
|
async insertCellImage() {
|
|
563
563
|
const n = (await this._fileOpenerService.openFile({
|
|
564
564
|
multiple: !1,
|
|
565
|
-
accept:
|
|
565
|
+
accept: yt.map((t) => `.${t.replace("image/", "")}`).join(",")
|
|
566
566
|
}))[0];
|
|
567
567
|
return n ? (await this._insertCellImage(n), !0) : !1;
|
|
568
568
|
}
|
|
@@ -572,27 +572,27 @@ let ve = class extends q {
|
|
|
572
572
|
n = await this._imageIoService.saveImage(e);
|
|
573
573
|
} catch (I) {
|
|
574
574
|
const S = I.message;
|
|
575
|
-
S ===
|
|
576
|
-
type:
|
|
577
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
578
|
-
}) : S ===
|
|
579
|
-
type:
|
|
575
|
+
S === ue.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
576
|
+
type: ae.Error,
|
|
577
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(Et / (1024 * 1024)))
|
|
578
|
+
}) : S === ue.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
579
|
+
type: ae.Error,
|
|
580
580
|
content: this._localeService.t("update-status.invalidImageType")
|
|
581
|
-
}) : S ===
|
|
582
|
-
type:
|
|
581
|
+
}) : S === ue.ERROR_IMAGE && this._messageService.show({
|
|
582
|
+
type: ae.Error,
|
|
583
583
|
content: this._localeService.t("update-status.invalidImage")
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
586
|
if (n == null)
|
|
587
587
|
return;
|
|
588
|
-
const t = this._getUnitInfo(), { unitId: r, subUnitId: s } = t, { imageId: o, imageSourceType:
|
|
589
|
-
this._imageIoService.addImageSourceCache(l,
|
|
588
|
+
const t = this._getUnitInfo(), { unitId: r, subUnitId: s } = t, { imageId: o, imageSourceType: a, source: l, base64Cache: g } = n, { width: d, height: c, image: h } = await Tt(g || ""), { width: u, height: m } = this._context.scene;
|
|
589
|
+
this._imageIoService.addImageSourceCache(l, a, h);
|
|
590
590
|
let f = 1;
|
|
591
|
-
if (
|
|
592
|
-
const I =
|
|
591
|
+
if (d > Pt || c > Ut) {
|
|
592
|
+
const I = Pt / d, S = Ut / c;
|
|
593
593
|
f = Math.max(I, S);
|
|
594
594
|
}
|
|
595
|
-
const p = this._getImagePosition(
|
|
595
|
+
const p = this._getImagePosition(d * f, c * f, u, m);
|
|
596
596
|
if (p == null)
|
|
597
597
|
return;
|
|
598
598
|
const v = {
|
|
@@ -600,12 +600,12 @@ let ve = class extends q {
|
|
|
600
600
|
subUnitId: s,
|
|
601
601
|
drawingId: o,
|
|
602
602
|
drawingType: k.DRAWING_IMAGE,
|
|
603
|
-
imageSourceType:
|
|
603
|
+
imageSourceType: a,
|
|
604
604
|
source: l,
|
|
605
605
|
transform: L(p, this._selectionRenderService, this._skeletonManagerService),
|
|
606
606
|
sheetTransform: p
|
|
607
607
|
};
|
|
608
|
-
this._commandService.executeCommand(
|
|
608
|
+
this._commandService.executeCommand(et.id, {
|
|
609
609
|
unitId: r,
|
|
610
610
|
drawings: [v]
|
|
611
611
|
});
|
|
@@ -617,33 +617,33 @@ let ve = class extends q {
|
|
|
617
617
|
n = await this._imageIoService.saveImage(e);
|
|
618
618
|
} catch (p) {
|
|
619
619
|
const v = p.message;
|
|
620
|
-
v ===
|
|
621
|
-
type:
|
|
622
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
623
|
-
}) : v ===
|
|
624
|
-
type:
|
|
620
|
+
v === ue.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
621
|
+
type: ae.Error,
|
|
622
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(Et / (1024 * 1024)))
|
|
623
|
+
}) : v === ue.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
624
|
+
type: ae.Error,
|
|
625
625
|
content: this._localeService.t("update-status.invalidImageType")
|
|
626
|
-
}) : v ===
|
|
627
|
-
type:
|
|
626
|
+
}) : v === ue.ERROR_IMAGE && this._messageService.show({
|
|
627
|
+
type: ae.Error,
|
|
628
628
|
content: this._localeService.t("update-status.invalidImage")
|
|
629
629
|
});
|
|
630
630
|
}
|
|
631
631
|
if (n == null)
|
|
632
632
|
return;
|
|
633
|
-
const { imageId: t, imageSourceType: r, source: s, base64Cache: o } = n, { width:
|
|
633
|
+
const { imageId: t, imageSourceType: r, source: s, base64Cache: o } = n, { width: a, height: l, image: g } = await Tt(o || "");
|
|
634
634
|
this._imageIoService.addImageSourceCache(s, r, g);
|
|
635
|
-
const
|
|
636
|
-
if (!
|
|
635
|
+
const d = this._workbookSelections.getCurrentLastSelection();
|
|
636
|
+
if (!d)
|
|
637
637
|
return !1;
|
|
638
|
-
const
|
|
638
|
+
const c = Gn("", {}), h = bn(
|
|
639
639
|
this._injector,
|
|
640
640
|
{
|
|
641
641
|
unitId: this._context.unitId,
|
|
642
642
|
subUnitId: this._context.unit.getActiveSheet().getSheetId(),
|
|
643
|
-
row:
|
|
644
|
-
col:
|
|
643
|
+
row: d.primary.actualRow,
|
|
644
|
+
col: d.primary.actualColumn
|
|
645
645
|
},
|
|
646
|
-
|
|
646
|
+
a,
|
|
647
647
|
l,
|
|
648
648
|
0
|
|
649
649
|
);
|
|
@@ -664,8 +664,8 @@ let ve = class extends q {
|
|
|
664
664
|
},
|
|
665
665
|
angle: 0
|
|
666
666
|
}, m = {
|
|
667
|
-
unitId:
|
|
668
|
-
subUnitId:
|
|
667
|
+
unitId: c.getUnitId(),
|
|
668
|
+
subUnitId: c.getUnitId(),
|
|
669
669
|
drawingId: t,
|
|
670
670
|
drawingType: k.DRAWING_IMAGE,
|
|
671
671
|
imageSourceType: r,
|
|
@@ -683,7 +683,7 @@ let ve = class extends q {
|
|
|
683
683
|
distR: 0,
|
|
684
684
|
distT: 0
|
|
685
685
|
}, f = Xn.drawing.add({
|
|
686
|
-
documentDataModel:
|
|
686
|
+
documentDataModel: c,
|
|
687
687
|
drawings: [m],
|
|
688
688
|
selection: {
|
|
689
689
|
collapsed: !0,
|
|
@@ -691,11 +691,11 @@ let ve = class extends q {
|
|
|
691
691
|
endOffset: 0
|
|
692
692
|
}
|
|
693
693
|
});
|
|
694
|
-
return f ? (
|
|
694
|
+
return f ? (c.apply(f), this._commandService.syncExecuteCommand(Kr.id, {
|
|
695
695
|
value: {
|
|
696
|
-
[
|
|
697
|
-
[
|
|
698
|
-
p:
|
|
696
|
+
[d.primary.actualRow]: {
|
|
697
|
+
[d.primary.actualColumn]: {
|
|
698
|
+
p: c.getSnapshot(),
|
|
699
699
|
t: 1
|
|
700
700
|
}
|
|
701
701
|
}
|
|
@@ -718,29 +718,29 @@ let ve = class extends q {
|
|
|
718
718
|
endColumn: 0
|
|
719
719
|
};
|
|
720
720
|
s && s.length > 0 && (o = s[s.length - 1].range);
|
|
721
|
-
const
|
|
722
|
-
if (
|
|
721
|
+
const a = Xt(this._skeletonManagerService.getCurrent().skeleton, o);
|
|
722
|
+
if (a == null)
|
|
723
723
|
return;
|
|
724
|
-
let { startColumn: l, startRow: g, startX:
|
|
725
|
-
if (
|
|
726
|
-
const p = this._selectionRenderService.getCellWithCoordByOffset(
|
|
724
|
+
let { startColumn: l, startRow: g, startX: d, startY: c } = a, h = !1;
|
|
725
|
+
if (d + e > t && (d = t - e, d < 0 && (d = 0, e = t), h = !0), c + n > r && (c = r - n, c < 0 && (c = 0, n = r), h = !0), h) {
|
|
726
|
+
const p = this._selectionRenderService.getCellWithCoordByOffset(d, c);
|
|
727
727
|
if (p == null)
|
|
728
728
|
return;
|
|
729
|
-
|
|
729
|
+
d = p.startX, c = p.startY, l = p.actualColumn, g = p.actualRow;
|
|
730
730
|
}
|
|
731
731
|
const u = {
|
|
732
732
|
column: l,
|
|
733
733
|
columnOffset: 0,
|
|
734
734
|
row: g,
|
|
735
735
|
rowOffset: 0
|
|
736
|
-
}, m = this._selectionRenderService.getCellWithCoordByOffset(
|
|
736
|
+
}, m = this._selectionRenderService.getCellWithCoordByOffset(d + e, c + n);
|
|
737
737
|
if (m == null)
|
|
738
738
|
return;
|
|
739
739
|
const f = {
|
|
740
740
|
column: m.actualColumn,
|
|
741
|
-
columnOffset:
|
|
741
|
+
columnOffset: d + e - m.startX,
|
|
742
742
|
row: m.actualRow,
|
|
743
|
-
rowOffset:
|
|
743
|
+
rowOffset: c + n - m.startY
|
|
744
744
|
};
|
|
745
745
|
return {
|
|
746
746
|
from: u,
|
|
@@ -750,7 +750,7 @@ let ve = class extends q {
|
|
|
750
750
|
_updateOrderListener() {
|
|
751
751
|
this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((e) => {
|
|
752
752
|
const { unitId: n, subUnitId: t, drawingIds: r, arrangeType: s } = e;
|
|
753
|
-
this._commandService.executeCommand(
|
|
753
|
+
this._commandService.executeCommand(Rn.id, {
|
|
754
754
|
unitId: n,
|
|
755
755
|
subUnitId: t,
|
|
756
756
|
drawingIds: r,
|
|
@@ -762,22 +762,22 @@ let ve = class extends q {
|
|
|
762
762
|
this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe((e) => {
|
|
763
763
|
const n = [];
|
|
764
764
|
e.length !== 0 && (e.forEach((t) => {
|
|
765
|
-
const { unitId: r, subUnitId: s, drawingId: o, drawingType:
|
|
765
|
+
const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform: l } = t;
|
|
766
766
|
if (l == null)
|
|
767
767
|
return;
|
|
768
768
|
const g = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
|
|
769
769
|
if (g == null || g.unitId !== this._context.unitId)
|
|
770
770
|
return;
|
|
771
|
-
const
|
|
772
|
-
if (
|
|
771
|
+
const d = j({ ...g.transform, ...l }, this._selectionRenderService);
|
|
772
|
+
if (d == null)
|
|
773
773
|
return;
|
|
774
|
-
const
|
|
774
|
+
const c = {
|
|
775
775
|
...t,
|
|
776
|
-
transform: { ...g.transform, ...l, ...L(
|
|
777
|
-
sheetTransform: { ...
|
|
776
|
+
transform: { ...g.transform, ...l, ...L(d, this._selectionRenderService, this._skeletonManagerService) },
|
|
777
|
+
sheetTransform: { ...d }
|
|
778
778
|
};
|
|
779
|
-
n.push(
|
|
780
|
-
}), n.length > 0 && this._commandService.executeCommand(
|
|
779
|
+
n.push(c);
|
|
780
|
+
}), n.length > 0 && this._commandService.executeCommand(tt.id, {
|
|
781
781
|
unitId: e[0].unitId,
|
|
782
782
|
drawings: n
|
|
783
783
|
}));
|
|
@@ -785,44 +785,44 @@ let ve = class extends q {
|
|
|
785
785
|
}
|
|
786
786
|
_groupDrawingListener() {
|
|
787
787
|
this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((e) => {
|
|
788
|
-
this._commandService.executeCommand(
|
|
788
|
+
this._commandService.executeCommand(Cn.id, e);
|
|
789
789
|
const { unitId: n, subUnitId: t, drawingId: r } = e[0].parent;
|
|
790
|
-
this._commandService.syncExecuteCommand(
|
|
790
|
+
this._commandService.syncExecuteCommand(qe.id, [{ unitId: n, subUnitId: t, drawingId: r }]);
|
|
791
791
|
})), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((e) => {
|
|
792
|
-
this._commandService.executeCommand(
|
|
792
|
+
this._commandService.executeCommand(Mn.id, e);
|
|
793
793
|
}));
|
|
794
794
|
}
|
|
795
795
|
_focusDrawingListener() {
|
|
796
796
|
this.disposeWithMe(
|
|
797
797
|
this._drawingManagerService.focus$.subscribe((e) => {
|
|
798
|
-
e == null || e.length === 0 ? (this._contextService.setContextValue(
|
|
798
|
+
e == null || e.length === 0 ? (this._contextService.setContextValue(ge, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(ge, !0), this._sheetDrawingService.focusDrawing(e));
|
|
799
799
|
})
|
|
800
800
|
);
|
|
801
801
|
}
|
|
802
802
|
};
|
|
803
|
-
|
|
803
|
+
Se = Ai([
|
|
804
804
|
K(1, U(Z)),
|
|
805
805
|
K(2, B),
|
|
806
|
-
K(3,
|
|
807
|
-
K(4,
|
|
806
|
+
K(3, Ce),
|
|
807
|
+
K(4, kt),
|
|
808
808
|
K(5, Lr),
|
|
809
809
|
K(6, z),
|
|
810
810
|
K(7, Q),
|
|
811
|
-
K(8,
|
|
811
|
+
K(8, Vt),
|
|
812
812
|
K(9, Gr),
|
|
813
|
-
K(10, U(
|
|
814
|
-
K(11, U(
|
|
815
|
-
K(12, U(
|
|
816
|
-
],
|
|
813
|
+
K(10, U(Je)),
|
|
814
|
+
K(11, U(Kt)),
|
|
815
|
+
K(12, U(Ie))
|
|
816
|
+
], Se);
|
|
817
817
|
var ji = Object.defineProperty, Wi = Object.getOwnPropertyDescriptor, xi = (i, e, n, t) => {
|
|
818
818
|
for (var r = t > 1 ? void 0 : t ? Wi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
819
819
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
820
820
|
return t && r && ji(e, n, r), r;
|
|
821
|
-
},
|
|
822
|
-
function
|
|
821
|
+
}, ce = (i, e) => (n, t) => e(n, t, i);
|
|
822
|
+
function _t(i, e, n) {
|
|
823
823
|
var t, r, s, o;
|
|
824
824
|
if (((r = (t = n == null ? void 0 : n.p) == null ? void 0 : t.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = n.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
|
|
825
|
-
const
|
|
825
|
+
const a = n.p.drawings[n.p.drawingsOrder[0]], l = bn(
|
|
826
826
|
i,
|
|
827
827
|
{
|
|
828
828
|
unitId: e.unitId,
|
|
@@ -830,26 +830,26 @@ function pt(i, e, n) {
|
|
|
830
830
|
row: e.row,
|
|
831
831
|
col: e.col
|
|
832
832
|
},
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
833
|
+
a.docTransform.size.width,
|
|
834
|
+
a.docTransform.size.height,
|
|
835
|
+
a.docTransform.angle
|
|
836
836
|
);
|
|
837
837
|
if (l)
|
|
838
|
-
return
|
|
838
|
+
return a.transform.width = l.width, a.transform.height = l.height, a.docTransform.size.width = l.width, a.docTransform.size.height = l.height, a.transform.left = 0, a.transform.top = 0, a.docTransform.positionH.posOffset = 0, a.docTransform.positionV.posOffset = 0, n.p.documentStyle.pageSize.width = 1 / 0, n.p.documentStyle.pageSize.height = 1 / 0, !0;
|
|
839
839
|
}
|
|
840
840
|
return !1;
|
|
841
841
|
}
|
|
842
|
-
let
|
|
842
|
+
let Ge = class extends q {
|
|
843
843
|
constructor(i, e, n, t, r, s, o) {
|
|
844
844
|
super(), this._commandService = i, this._sheetInterceptorService = e, this._univerInstanceService = n, this._injector = t, this._drawingManagerService = r, this._docDrawingController = s, this._editorBridgeService = o, this._initHandleResize(), this._handleInitEditor(), this._handleWriteCell(), this._initCellContentInterceptor();
|
|
845
845
|
}
|
|
846
846
|
_initHandleResize() {
|
|
847
847
|
this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
|
|
848
848
|
let e, n = [];
|
|
849
|
-
if (i.id ===
|
|
849
|
+
if (i.id === Jt.id) {
|
|
850
850
|
const t = i.params;
|
|
851
851
|
n = t.ranges, e = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
|
|
852
|
-
} else if (i.id ===
|
|
852
|
+
} else if (i.id === qt.id) {
|
|
853
853
|
const t = i.params;
|
|
854
854
|
n = t.ranges, e = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
|
|
855
855
|
} else if (i.id === Jr.id) {
|
|
@@ -874,21 +874,21 @@ let Le = class extends q {
|
|
|
874
874
|
const r = zn.transformRange(t, e.worksheet);
|
|
875
875
|
for (let s = r.startRow; s <= r.endRow; s++)
|
|
876
876
|
for (let o = r.startColumn; o <= r.endColumn; o++)
|
|
877
|
-
|
|
877
|
+
_t(this._injector, { unitId: e.unitId, subUnitId: e.subUnitId, row: s, col: o }, e.worksheet.getCellRaw(s, o));
|
|
878
878
|
});
|
|
879
879
|
}));
|
|
880
880
|
}
|
|
881
881
|
_handleInitEditor() {
|
|
882
882
|
this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
|
|
883
|
-
i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(
|
|
883
|
+
i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(De), this._docDrawingController.loadDrawingDataForUnit(De), this._drawingManagerService.initializeNotification(De)) : this._drawingManagerService.removeDrawingDataForUnit(De);
|
|
884
884
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
|
|
885
|
-
i.id === hi.id && i.params.unitId ===
|
|
885
|
+
i.id === hi.id && i.params.unitId === ye && (this._drawingManagerService.removeDrawingDataForUnit(ye), this._docDrawingController.loadDrawingDataForUnit(ye), this._drawingManagerService.initializeNotification(ye));
|
|
886
886
|
}));
|
|
887
887
|
}
|
|
888
888
|
_handleWriteCell() {
|
|
889
889
|
this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(ei, {
|
|
890
890
|
priority: 9999,
|
|
891
|
-
handler: (i, e, n) => (
|
|
891
|
+
handler: (i, e, n) => (_t(this._injector, { unitId: e.unitId, subUnitId: e.subUnitId, row: e.row, col: e.col }, i), n(i))
|
|
892
892
|
}));
|
|
893
893
|
}
|
|
894
894
|
_initCellContentInterceptor() {
|
|
@@ -907,21 +907,21 @@ let Le = class extends q {
|
|
|
907
907
|
);
|
|
908
908
|
}
|
|
909
909
|
};
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
],
|
|
910
|
+
Ge = xi([
|
|
911
|
+
ce(0, B),
|
|
912
|
+
ce(1, U(Ze)),
|
|
913
|
+
ce(2, pe),
|
|
914
|
+
ce(3, U(Ie)),
|
|
915
|
+
ce(4, Q),
|
|
916
|
+
ce(5, U(gr)),
|
|
917
|
+
ce(6, U(Er))
|
|
918
|
+
], Ge);
|
|
919
919
|
var $i = Object.defineProperty, Bi = Object.getOwnPropertyDescriptor, Li = (i, e, n, t) => {
|
|
920
920
|
for (var r = t > 1 ? void 0 : t ? Bi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
921
921
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
922
922
|
return t && r && $i(e, n, r), r;
|
|
923
|
-
},
|
|
924
|
-
let
|
|
923
|
+
}, Gt = (i, e) => (n, t) => e(n, t, i);
|
|
924
|
+
let Fe = class extends q {
|
|
925
925
|
constructor(i, e) {
|
|
926
926
|
super(), this._autoFillService = i, this._injector = e, this._initAutoFillHooks();
|
|
927
927
|
}
|
|
@@ -931,23 +931,23 @@ let Ge = class extends q {
|
|
|
931
931
|
id: "sheet-cell-image-autofill",
|
|
932
932
|
onBeforeSubmit: (i, e, n, t) => {
|
|
933
933
|
new Jn(t).forValue((r, s, o) => {
|
|
934
|
-
|
|
934
|
+
_t(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
|
|
935
935
|
});
|
|
936
936
|
}
|
|
937
937
|
})
|
|
938
938
|
);
|
|
939
939
|
}
|
|
940
940
|
};
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
],
|
|
941
|
+
Fe = Li([
|
|
942
|
+
Gt(0, U(Tr)),
|
|
943
|
+
Gt(1, U(Ie))
|
|
944
|
+
], Fe);
|
|
945
945
|
var Gi = Object.defineProperty, Fi = Object.getOwnPropertyDescriptor, Vi = (i, e, n, t) => {
|
|
946
946
|
for (var r = t > 1 ? void 0 : t ? Fi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
947
947
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
948
948
|
return t && r && Gi(e, n, r), r;
|
|
949
|
-
},
|
|
950
|
-
let
|
|
949
|
+
}, Ne = (i, e) => (n, t) => e(n, t, i);
|
|
950
|
+
let Ve = class extends q {
|
|
951
951
|
constructor(e, n, t, r) {
|
|
952
952
|
super();
|
|
953
953
|
V(this, "_isSetCursor", !1);
|
|
@@ -958,18 +958,18 @@ let Fe = class extends q {
|
|
|
958
958
|
_initImageClick() {
|
|
959
959
|
}
|
|
960
960
|
};
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
],
|
|
961
|
+
Ve = Vi([
|
|
962
|
+
Ne(0, U(Pr)),
|
|
963
|
+
Ne(1, U(X)),
|
|
964
|
+
Ne(2, U(Kt)),
|
|
965
|
+
Ne(3, U(Ht))
|
|
966
|
+
], Ve);
|
|
967
967
|
var ki = Object.defineProperty, Hi = Object.getOwnPropertyDescriptor, Yi = (i, e, n, t) => {
|
|
968
968
|
for (var r = t > 1 ? void 0 : t ? Hi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
969
969
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
970
970
|
return t && r && ki(e, n, r), r;
|
|
971
|
-
},
|
|
972
|
-
let
|
|
971
|
+
}, dt = (i, e) => (n, t) => e(n, t, i);
|
|
972
|
+
let ke = class extends q {
|
|
973
973
|
constructor(e, n, t) {
|
|
974
974
|
super();
|
|
975
975
|
V(this, "_copyInfo");
|
|
@@ -980,8 +980,8 @@ let Ve = class extends q {
|
|
|
980
980
|
id: "SHEET_IMAGE_UI_PLUGIN",
|
|
981
981
|
onBeforeCopy: (e, n, t) => this._collect(e, n, t),
|
|
982
982
|
onPasteCells: (e, n, t, r) => {
|
|
983
|
-
const { copyType: s =
|
|
984
|
-
return this._generateMutations(l, { copyType: s, pasteType: o, copyRange:
|
|
983
|
+
const { copyType: s = Nt.COPY, pasteType: o } = r, { range: a } = e || {}, { range: l, unitId: g, subUnitId: d } = n;
|
|
984
|
+
return this._generateMutations(l, { copyType: s, pasteType: o, copyRange: a, unitId: g, subUnitId: d });
|
|
985
985
|
},
|
|
986
986
|
onPastePlainText: (e, n) => ({ undos: [], redos: [] })
|
|
987
987
|
});
|
|
@@ -993,126 +993,124 @@ let Ve = class extends q {
|
|
|
993
993
|
const s = r.attachRangeWithCoord(t);
|
|
994
994
|
if (!s)
|
|
995
995
|
return;
|
|
996
|
-
const { startX: o, endX:
|
|
997
|
-
Object.keys(
|
|
998
|
-
const m =
|
|
996
|
+
const { startX: o, endX: a, startY: l, endY: g } = s, d = this._sheetDrawingService.getDrawingData(e, n), c = [];
|
|
997
|
+
Object.keys(d).forEach((u) => {
|
|
998
|
+
const m = d[u], { transform: f } = m;
|
|
999
999
|
if (m.anchorType !== y.Both || !f)
|
|
1000
1000
|
return;
|
|
1001
|
-
const { left: p = 0, top: v = 0, width: I = 0, height: S = 0 } = f, { drawingStartX:
|
|
1001
|
+
const { left: p = 0, top: v = 0, width: I = 0, height: S = 0 } = f, { drawingStartX: M, drawingEndX: w, drawingStartY: C, drawingEndY: _ } = {
|
|
1002
1002
|
drawingStartX: p,
|
|
1003
1003
|
drawingEndX: p + I,
|
|
1004
1004
|
drawingStartY: v,
|
|
1005
1005
|
drawingEndY: v + S
|
|
1006
1006
|
};
|
|
1007
|
-
o <=
|
|
1008
|
-
}),
|
|
1009
|
-
drawings:
|
|
1007
|
+
o <= M && w <= a && l <= C && _ <= g && c.push(m);
|
|
1008
|
+
}), c.length && (this._copyInfo = {
|
|
1009
|
+
drawings: c,
|
|
1010
1010
|
unitId: e,
|
|
1011
1011
|
subUnitId: n
|
|
1012
1012
|
});
|
|
1013
1013
|
}
|
|
1014
1014
|
// eslint-disable-next-line max-lines-per-function
|
|
1015
1015
|
_generateMutations(e, n) {
|
|
1016
|
-
var
|
|
1016
|
+
var N;
|
|
1017
1017
|
if (!this._copyInfo)
|
|
1018
1018
|
return { redos: [], undos: [] };
|
|
1019
1019
|
if ([
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
].includes(
|
|
1025
|
-
n.pasteType
|
|
1026
|
-
))
|
|
1020
|
+
Ee.SPECIAL_PASTE_COL_WIDTH,
|
|
1021
|
+
Ee.SPECIAL_PASTE_VALUE,
|
|
1022
|
+
Ee.SPECIAL_PASTE_FORMAT,
|
|
1023
|
+
Ee.SPECIAL_PASTE_FORMULA
|
|
1024
|
+
].includes(n.pasteType))
|
|
1027
1025
|
return { redos: [], undos: [] };
|
|
1028
|
-
const { copyRange:
|
|
1029
|
-
if (!
|
|
1026
|
+
const { copyRange: r } = n;
|
|
1027
|
+
if (!r)
|
|
1030
1028
|
return { redos: [], undos: [] };
|
|
1031
|
-
const { drawings:
|
|
1032
|
-
if (!
|
|
1029
|
+
const { drawings: s, unitId: o, subUnitId: a } = this._copyInfo, { ranges: [l, g], mapFunc: d } = Ur([r, e]), { row: c, col: h } = d(l.startRow, l.startColumn), { row: u, col: m } = d(g.startRow, g.startColumn), f = (N = this._renderManagerService.getRenderById(o)) == null ? void 0 : N.with(Z);
|
|
1030
|
+
if (!f)
|
|
1033
1031
|
return { redos: [], undos: [] };
|
|
1034
|
-
const
|
|
1032
|
+
const p = f.attachRangeWithCoord({
|
|
1035
1033
|
startRow: c,
|
|
1036
1034
|
endRow: c,
|
|
1037
|
-
startColumn:
|
|
1038
|
-
endColumn:
|
|
1039
|
-
}),
|
|
1040
|
-
startRow:
|
|
1041
|
-
endRow:
|
|
1042
|
-
startColumn:
|
|
1043
|
-
endColumn:
|
|
1035
|
+
startColumn: h,
|
|
1036
|
+
endColumn: h
|
|
1037
|
+
}), v = f.attachRangeWithCoord({
|
|
1038
|
+
startRow: u,
|
|
1039
|
+
endRow: u,
|
|
1040
|
+
startColumn: m,
|
|
1041
|
+
endColumn: m
|
|
1044
1042
|
});
|
|
1045
|
-
if (!
|
|
1043
|
+
if (!p || !v)
|
|
1046
1044
|
return { redos: [], undos: [] };
|
|
1047
|
-
const
|
|
1048
|
-
return
|
|
1049
|
-
const { transform:
|
|
1050
|
-
if (!
|
|
1045
|
+
const I = [], S = [], M = v.startX - p.startX, w = v.startY - p.startY, C = u - c, _ = m - h, T = n.copyType === Nt.CUT, { _sheetDrawingService: D } = this;
|
|
1046
|
+
return s.forEach((A) => {
|
|
1047
|
+
const { transform: b, sheetTransform: R } = A;
|
|
1048
|
+
if (!b)
|
|
1051
1049
|
return;
|
|
1052
|
-
const
|
|
1053
|
-
...
|
|
1054
|
-
unitId:
|
|
1055
|
-
subUnitId:
|
|
1056
|
-
drawingId:
|
|
1050
|
+
const P = {
|
|
1051
|
+
...A,
|
|
1052
|
+
unitId: o,
|
|
1053
|
+
subUnitId: a,
|
|
1054
|
+
drawingId: T ? A.drawingId : ve.generateRandomId(),
|
|
1057
1055
|
transform: {
|
|
1058
|
-
...
|
|
1059
|
-
left:
|
|
1060
|
-
top:
|
|
1056
|
+
...b,
|
|
1057
|
+
left: b.left + M,
|
|
1058
|
+
top: b.top + w
|
|
1061
1059
|
},
|
|
1062
1060
|
sheetTransform: {
|
|
1063
|
-
to: { ...
|
|
1064
|
-
from: { ...
|
|
1061
|
+
to: { ...R.to, row: R.to.row + C, column: R.to.column + _ },
|
|
1062
|
+
from: { ...R.from, row: R.from.row + C, column: R.from.column + _ }
|
|
1065
1063
|
}
|
|
1066
1064
|
};
|
|
1067
|
-
if (
|
|
1068
|
-
const { undo:
|
|
1069
|
-
|
|
1065
|
+
if (T) {
|
|
1066
|
+
const { undo: x, redo: se, objects: oe } = D.getBatchUpdateOp([P]);
|
|
1067
|
+
I.push({
|
|
1070
1068
|
id: O.id,
|
|
1071
1069
|
params: {
|
|
1072
|
-
unitId:
|
|
1073
|
-
subUnitId:
|
|
1070
|
+
unitId: o,
|
|
1071
|
+
subUnitId: a,
|
|
1074
1072
|
type: E.UPDATE,
|
|
1075
|
-
op:
|
|
1076
|
-
objects:
|
|
1073
|
+
op: se,
|
|
1074
|
+
objects: oe
|
|
1077
1075
|
}
|
|
1078
|
-
}),
|
|
1076
|
+
}), S.push({
|
|
1079
1077
|
id: O.id,
|
|
1080
1078
|
params: {
|
|
1081
|
-
unitId:
|
|
1082
|
-
subUnitId:
|
|
1079
|
+
unitId: o,
|
|
1080
|
+
subUnitId: a,
|
|
1083
1081
|
type: E.UPDATE,
|
|
1084
|
-
op:
|
|
1085
|
-
objects:
|
|
1082
|
+
op: x,
|
|
1083
|
+
objects: oe
|
|
1086
1084
|
}
|
|
1087
1085
|
});
|
|
1088
1086
|
} else {
|
|
1089
|
-
const { undo:
|
|
1090
|
-
|
|
1087
|
+
const { undo: x, redo: se, objects: oe } = D.getBatchAddOp([P]);
|
|
1088
|
+
I.push({ id: O.id, params: { op: se, unitId: o, subUnitId: a, objects: oe, type: E.INSERT } }), S.push({ id: O.id, params: { op: x, unitId: o, subUnitId: a, objects: oe, type: E.REMOVE } });
|
|
1091
1089
|
}
|
|
1092
1090
|
}), {
|
|
1093
|
-
redos:
|
|
1094
|
-
undos:
|
|
1091
|
+
redos: I,
|
|
1092
|
+
undos: S
|
|
1095
1093
|
};
|
|
1096
1094
|
}
|
|
1097
1095
|
};
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
],
|
|
1096
|
+
ke = Yi([
|
|
1097
|
+
dt(0, Ar),
|
|
1098
|
+
dt(1, X),
|
|
1099
|
+
dt(2, z)
|
|
1100
|
+
], ke);
|
|
1103
1101
|
var Xi = Object.defineProperty, zi = Object.getOwnPropertyDescriptor, Ki = (i, e, n, t) => {
|
|
1104
1102
|
for (var r = t > 1 ? void 0 : t ? zi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1105
1103
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
1106
1104
|
return t && r && Xi(e, n, r), r;
|
|
1107
|
-
},
|
|
1108
|
-
let
|
|
1105
|
+
}, we = (i, e) => (n, t) => e(n, t, i);
|
|
1106
|
+
let He = class extends q {
|
|
1109
1107
|
constructor(i, e, n, t, r) {
|
|
1110
1108
|
super(), this._drawingManagerService = i, this._renderManagerService = e, this._permissionService = n, this._univerInstanceService = t, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
1111
1109
|
}
|
|
1112
1110
|
_initDrawingVisible() {
|
|
1113
1111
|
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET);
|
|
1114
1112
|
this.disposeWithMe(
|
|
1115
|
-
|
|
1113
|
+
Te([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
1116
1114
|
if (!e) {
|
|
1117
1115
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
1118
1116
|
return;
|
|
@@ -1123,15 +1121,15 @@ let ke = class extends q {
|
|
|
1123
1121
|
return;
|
|
1124
1122
|
}
|
|
1125
1123
|
const r = e.getUnitId(), s = t.getSheetId();
|
|
1126
|
-
if (this._permissionService.composePermission([new
|
|
1124
|
+
if (this._permissionService.composePermission([new xt(r).id, new ot(r, s).id]).every((a) => a.value))
|
|
1127
1125
|
this._drawingManagerService.setDrawingVisible(!0);
|
|
1128
1126
|
else {
|
|
1129
1127
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
1130
|
-
const
|
|
1128
|
+
const a = e.getUnitId(), l = t.getSheetId(), g = this._drawingManagerService.getDrawingData(a, l), d = Object.values(g), c = this._renderManagerService.getRenderById(a), h = c == null ? void 0 : c.scene;
|
|
1131
1129
|
if (h == null)
|
|
1132
1130
|
return;
|
|
1133
1131
|
h.getAllObjectsByOrder().forEach((m) => {
|
|
1134
|
-
m.classType ===
|
|
1132
|
+
m.classType === he.IMAGE && d.some((f) => m.oKey.includes(f.drawingId)) && h.removeObject(m);
|
|
1135
1133
|
});
|
|
1136
1134
|
}
|
|
1137
1135
|
});
|
|
@@ -1141,7 +1139,7 @@ let ke = class extends q {
|
|
|
1141
1139
|
_initDrawingEditable() {
|
|
1142
1140
|
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET);
|
|
1143
1141
|
this.disposeWithMe(
|
|
1144
|
-
|
|
1142
|
+
Te([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
1145
1143
|
if (!e) {
|
|
1146
1144
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
1147
1145
|
return;
|
|
@@ -1152,15 +1150,15 @@ let ke = class extends q {
|
|
|
1152
1150
|
return;
|
|
1153
1151
|
}
|
|
1154
1152
|
const r = e.getUnitId(), s = t.getSheetId();
|
|
1155
|
-
if (this._permissionService.composePermission([new
|
|
1153
|
+
if (this._permissionService.composePermission([new ht(r).id, new $e(r, s).id]).every((a) => a.value))
|
|
1156
1154
|
this._drawingManagerService.setDrawingEditable(!0);
|
|
1157
1155
|
else {
|
|
1158
1156
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
1159
|
-
const
|
|
1157
|
+
const a = e.getUnitId(), l = t.getSheetId(), g = this._drawingManagerService.getDrawingData(a, l), d = Object.values(g), c = this._renderManagerService.getRenderById(a), h = c == null ? void 0 : c.scene;
|
|
1160
1158
|
if (h == null)
|
|
1161
1159
|
return;
|
|
1162
1160
|
h.getAllObjectsByOrder().forEach((m) => {
|
|
1163
|
-
m.classType ===
|
|
1161
|
+
m.classType === he.IMAGE && d.some((f) => m.oKey.includes(f.drawingId)) && h.detachTransformerFrom(m);
|
|
1164
1162
|
});
|
|
1165
1163
|
}
|
|
1166
1164
|
});
|
|
@@ -1170,31 +1168,31 @@ let ke = class extends q {
|
|
|
1170
1168
|
_initViewPermissionChange() {
|
|
1171
1169
|
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET);
|
|
1172
1170
|
this.disposeWithMe(
|
|
1173
|
-
|
|
1171
|
+
Te([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
1174
1172
|
e && e.activeSheet$.subscribe((t) => {
|
|
1175
|
-
var
|
|
1173
|
+
var c;
|
|
1176
1174
|
if (!t)
|
|
1177
1175
|
return;
|
|
1178
1176
|
const r = e.getUnitId(), s = t.getSheetId();
|
|
1179
1177
|
let o = !0;
|
|
1180
|
-
const
|
|
1178
|
+
const a = this._renderManagerService.getRenderById(r), l = a == null ? void 0 : a.scene;
|
|
1181
1179
|
if (l == null)
|
|
1182
1180
|
return;
|
|
1183
|
-
const g = l.getTransformerByCreate(),
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1181
|
+
const g = l.getTransformerByCreate(), d = this._permissionService.composePermission$([new xt(r).id, new ot(r, s).id]).pipe(Be((h) => h.every((u) => u.value)));
|
|
1182
|
+
d == null || d.pipe(
|
|
1183
|
+
ie((h) => h !== o),
|
|
1184
|
+
Pe()
|
|
1187
1185
|
).subscribe({
|
|
1188
1186
|
next: (h) => {
|
|
1189
1187
|
o = h, this._drawingManagerService.setDrawingVisible(h);
|
|
1190
1188
|
const u = l.getAllObjectsByOrder(), m = this._drawingManagerService.getDrawingData(r, s), f = Object.values(m);
|
|
1191
1189
|
h ? this._drawingManagerService.addNotification(f) : (u.forEach((p) => {
|
|
1192
|
-
p.classType ===
|
|
1190
|
+
p.classType === he.IMAGE && f.some((v) => p.oKey.includes(v.drawingId)) && l.removeObject(p);
|
|
1193
1191
|
}), g.clearSelectedObjects());
|
|
1194
1192
|
}
|
|
1195
|
-
}), (
|
|
1196
|
-
|
|
1197
|
-
|
|
1193
|
+
}), (c = this._permissionService.getPermissionPoint$(new ot(r, s).id)) == null || c.pipe(
|
|
1194
|
+
ie((h) => h.value !== o),
|
|
1195
|
+
Pe()
|
|
1198
1196
|
).subscribe({
|
|
1199
1197
|
complete: () => {
|
|
1200
1198
|
o = !0, this._drawingManagerService.setDrawingVisible(!0);
|
|
@@ -1209,33 +1207,33 @@ let ke = class extends q {
|
|
|
1209
1207
|
_initEditPermissionChange() {
|
|
1210
1208
|
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET);
|
|
1211
1209
|
this.disposeWithMe(
|
|
1212
|
-
|
|
1210
|
+
Te([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
1213
1211
|
e && e.activeSheet$.subscribe((t) => {
|
|
1214
|
-
var
|
|
1212
|
+
var c;
|
|
1215
1213
|
if (!t)
|
|
1216
1214
|
return;
|
|
1217
1215
|
const r = e.getUnitId(), s = t.getSheetId();
|
|
1218
1216
|
let o = !0;
|
|
1219
|
-
const
|
|
1217
|
+
const a = this._renderManagerService.getRenderById(r), l = a == null ? void 0 : a.scene;
|
|
1220
1218
|
if (l == null)
|
|
1221
1219
|
return;
|
|
1222
|
-
const g = l.getTransformerByCreate(),
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1220
|
+
const g = l.getTransformerByCreate(), d = this._permissionService.composePermission$([new ht(r).id, new $e(r, s).id]).pipe(Be((h) => h.every((u) => u.value)));
|
|
1221
|
+
d == null || d.pipe(
|
|
1222
|
+
ie((h) => h !== o),
|
|
1223
|
+
Pe()
|
|
1226
1224
|
).subscribe({
|
|
1227
1225
|
next: (h) => {
|
|
1228
1226
|
o = h, this._drawingManagerService.setDrawingEditable(h);
|
|
1229
1227
|
const u = l.getAllObjectsByOrder(), m = this._drawingManagerService.getDrawingData(r, s), f = Object.values(m);
|
|
1230
1228
|
h ? (u.forEach((p) => {
|
|
1231
|
-
p.classType ===
|
|
1229
|
+
p.classType === he.IMAGE && f.some((v) => p.oKey.includes(v.drawingId)) && l.attachTransformerTo(p);
|
|
1232
1230
|
}), this._drawingManagerService.addNotification(f)) : (u.forEach((p) => {
|
|
1233
|
-
p.classType ===
|
|
1231
|
+
p.classType === he.IMAGE && f.some((v) => p.oKey.includes(v.drawingId)) && l.detachTransformerFrom(p);
|
|
1234
1232
|
}), g.clearSelectedObjects());
|
|
1235
1233
|
}
|
|
1236
|
-
}), (
|
|
1237
|
-
|
|
1238
|
-
|
|
1234
|
+
}), (c = this._permissionService.getPermissionPoint$(new $e(r, s).id)) == null || c.pipe(
|
|
1235
|
+
ie((h) => h.value !== o),
|
|
1236
|
+
Pe()
|
|
1239
1237
|
).subscribe({
|
|
1240
1238
|
complete: () => {
|
|
1241
1239
|
o = !0;
|
|
@@ -1243,7 +1241,7 @@ let ke = class extends q {
|
|
|
1243
1241
|
if (v == null)
|
|
1244
1242
|
return;
|
|
1245
1243
|
this._drawingManagerService.setDrawingEditable(!0), v.getAllObjectsByOrder().forEach((S) => {
|
|
1246
|
-
S.classType ===
|
|
1244
|
+
S.classType === he.IMAGE && f.some((M) => S.oKey.includes(M.drawingId)) && v.detachTransformerFrom(S);
|
|
1247
1245
|
});
|
|
1248
1246
|
}
|
|
1249
1247
|
});
|
|
@@ -1252,19 +1250,19 @@ let ke = class extends q {
|
|
|
1252
1250
|
);
|
|
1253
1251
|
}
|
|
1254
1252
|
};
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
],
|
|
1253
|
+
He = Ki([
|
|
1254
|
+
we(0, Q),
|
|
1255
|
+
we(1, X),
|
|
1256
|
+
we(2, Zn),
|
|
1257
|
+
we(3, pe),
|
|
1258
|
+
we(4, U(qn))
|
|
1259
|
+
], He);
|
|
1262
1260
|
var Ji = Object.defineProperty, qi = Object.getOwnPropertyDescriptor, Zi = (i, e, n, t) => {
|
|
1263
1261
|
for (var r = t > 1 ? void 0 : t ? qi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1264
1262
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
1265
1263
|
return t && r && Ji(e, n, r), r;
|
|
1266
|
-
},
|
|
1267
|
-
let
|
|
1264
|
+
}, je = (i, e) => (n, t) => e(n, t, i);
|
|
1265
|
+
let Ye = class extends q {
|
|
1268
1266
|
constructor(i, e, n, t) {
|
|
1269
1267
|
super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting();
|
|
1270
1268
|
}
|
|
@@ -1274,9 +1272,9 @@ let He = class extends q {
|
|
|
1274
1272
|
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
|
|
1275
1273
|
{
|
|
1276
1274
|
handler: (i, e, n) => {
|
|
1277
|
-
const { unitId: t, scene: r, subUnitId: s } = e, o = this._drawingManagerService.getDrawingDataForUnit(t),
|
|
1278
|
-
return
|
|
1279
|
-
this._drawingRenderService.renderDrawing(
|
|
1275
|
+
const { unitId: t, scene: r, subUnitId: s } = e, o = this._drawingManagerService.getDrawingDataForUnit(t), a = o == null ? void 0 : o[s];
|
|
1276
|
+
return a && a.order.forEach((l) => {
|
|
1277
|
+
this._drawingRenderService.renderDrawing(a.data[l], r);
|
|
1280
1278
|
}), n();
|
|
1281
1279
|
}
|
|
1282
1280
|
}
|
|
@@ -1292,35 +1290,34 @@ let He = class extends q {
|
|
|
1292
1290
|
const o = s.with(Z).getWorksheetSkeleton(r);
|
|
1293
1291
|
if (!o)
|
|
1294
1292
|
return n(i);
|
|
1295
|
-
const
|
|
1293
|
+
const a = this._drawingManagerService.getDrawingDataForUnit(t), l = a == null ? void 0 : a[e.subUnitId];
|
|
1296
1294
|
if (!l)
|
|
1297
1295
|
return n(i);
|
|
1298
|
-
const { scaleX: g, scaleY:
|
|
1296
|
+
const { scaleX: g, scaleY: d } = s.scene, c = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, h = l.order.map((u) => l.data[u]).filter((u) => u.drawingType !== k.DRAWING_DOM);
|
|
1299
1297
|
return h.length ? (h.forEach((u) => {
|
|
1300
|
-
if (!u.groupId && u.transform &&
|
|
1301
|
-
const m = o.skeleton.getCellIndexByOffset(u.transform.left, u.transform.top, g,
|
|
1302
|
-
m.column <
|
|
1298
|
+
if (!u.groupId && u.transform && ve.isDefine(u.transform.left) && ve.isDefine(u.transform.top) && ve.isDefine(u.transform.width) && ve.isDefine(u.transform.height)) {
|
|
1299
|
+
const m = o.skeleton.getCellIndexByOffset(u.transform.left, u.transform.top, g, d, { x: 0, y: 0 }), f = o.skeleton.getCellIndexByOffset(u.transform.left + u.transform.width, u.transform.top + u.transform.height, g, d, { x: 0, y: 0 });
|
|
1300
|
+
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);
|
|
1303
1301
|
}
|
|
1304
|
-
}), n(
|
|
1302
|
+
}), n(c)) : n(i);
|
|
1305
1303
|
}
|
|
1306
1304
|
}
|
|
1307
1305
|
)
|
|
1308
1306
|
);
|
|
1309
1307
|
}
|
|
1310
1308
|
};
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
],
|
|
1309
|
+
Ye = Zi([
|
|
1310
|
+
je(0, U(Nr)),
|
|
1311
|
+
je(1, U(Ht)),
|
|
1312
|
+
je(2, Q),
|
|
1313
|
+
je(3, X)
|
|
1314
|
+
], Ye);
|
|
1317
1315
|
var Qi = Object.defineProperty, es = Object.getOwnPropertyDescriptor, ts = (i, e, n, t) => {
|
|
1318
1316
|
for (var r = t > 1 ? void 0 : t ? es(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1319
1317
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
1320
1318
|
return t && r && Qi(e, n, r), r;
|
|
1321
|
-
},
|
|
1319
|
+
}, te = (i, e) => (n, t) => e(n, t, i);
|
|
1322
1320
|
const ns = [
|
|
1323
|
-
qt.id,
|
|
1324
1321
|
Zt.id,
|
|
1325
1322
|
Qt.id,
|
|
1326
1323
|
en.id,
|
|
@@ -1328,9 +1325,9 @@ const ns = [
|
|
|
1328
1325
|
nn.id,
|
|
1329
1326
|
rn.id,
|
|
1330
1327
|
sn.id,
|
|
1331
|
-
ht.id,
|
|
1332
|
-
gt.id,
|
|
1333
1328
|
on.id,
|
|
1329
|
+
gt.id,
|
|
1330
|
+
mt.id,
|
|
1334
1331
|
an.id,
|
|
1335
1332
|
cn.id,
|
|
1336
1333
|
dn.id,
|
|
@@ -1338,18 +1335,19 @@ const ns = [
|
|
|
1338
1335
|
un.id,
|
|
1339
1336
|
hn.id,
|
|
1340
1337
|
gn.id,
|
|
1341
|
-
mn.id
|
|
1338
|
+
mn.id,
|
|
1339
|
+
fn.id
|
|
1342
1340
|
], rs = [
|
|
1343
1341
|
ri.id,
|
|
1344
1342
|
ii.id,
|
|
1345
1343
|
si.id,
|
|
1346
1344
|
oi.id,
|
|
1347
|
-
|
|
1348
|
-
|
|
1345
|
+
Jt.id,
|
|
1346
|
+
qt.id
|
|
1349
1347
|
];
|
|
1350
|
-
let
|
|
1351
|
-
constructor(i, e, n, t, r, s, o,
|
|
1352
|
-
super(), this._context = i, this._renderManagerService = e, this._commandService = n, this._selectionRenderService = t, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService =
|
|
1348
|
+
let wt = class extends q {
|
|
1349
|
+
constructor(i, e, n, t, r, s, o, a, l) {
|
|
1350
|
+
super(), this._context = i, this._renderManagerService = e, this._commandService = n, this._selectionRenderService = t, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = a, this._univerInstanceService = l, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
|
|
1353
1351
|
}
|
|
1354
1352
|
_sheetInterceptorListener() {
|
|
1355
1353
|
this.disposeWithMe(
|
|
@@ -1360,52 +1358,52 @@ let _t = class extends q {
|
|
|
1360
1358
|
if (i.params == null)
|
|
1361
1359
|
return { redos: [], undos: [] };
|
|
1362
1360
|
const e = i.id;
|
|
1363
|
-
if (e ===
|
|
1361
|
+
if (e === Zt.id)
|
|
1364
1362
|
return this._moveRowInterceptor(i.params, "insert");
|
|
1365
|
-
if ([
|
|
1363
|
+
if ([gn.id, mn.id, fn.id].includes(e))
|
|
1366
1364
|
return this._moveRangeInterceptor(i.params);
|
|
1367
|
-
if (e === Zt.id)
|
|
1368
|
-
return this._moveColInterceptor(i.params, "insert");
|
|
1369
1365
|
if (e === Qt.id)
|
|
1370
|
-
return this.
|
|
1366
|
+
return this._moveColInterceptor(i.params, "insert");
|
|
1371
1367
|
if (e === en.id)
|
|
1368
|
+
return this._moveRowInterceptor(i.params, "remove");
|
|
1369
|
+
if (e === tn.id)
|
|
1372
1370
|
return this._moveColInterceptor(i.params, "remove");
|
|
1373
|
-
if (e ===
|
|
1371
|
+
if (e === nn.id) {
|
|
1374
1372
|
const { range: n } = i.params;
|
|
1375
1373
|
return this._getRangeMoveUndo(
|
|
1376
1374
|
n,
|
|
1377
1375
|
0
|
|
1378
1376
|
/* deleteLeft */
|
|
1379
1377
|
);
|
|
1380
|
-
} else if (e ===
|
|
1378
|
+
} else if (e === rn.id) {
|
|
1381
1379
|
const { range: n } = i.params;
|
|
1382
1380
|
return this._getRangeMoveUndo(
|
|
1383
1381
|
n,
|
|
1384
1382
|
1
|
|
1385
1383
|
/* deleteUp */
|
|
1386
1384
|
);
|
|
1387
|
-
} else if (e ===
|
|
1385
|
+
} else if (e === sn.id) {
|
|
1388
1386
|
const { range: n } = i.params;
|
|
1389
1387
|
return this._getRangeMoveUndo(
|
|
1390
1388
|
n,
|
|
1391
1389
|
2
|
|
1392
1390
|
/* insertDown */
|
|
1393
1391
|
);
|
|
1394
|
-
} else if (e ===
|
|
1392
|
+
} else if (e === on.id) {
|
|
1395
1393
|
const { range: n } = i.params;
|
|
1396
1394
|
return this._getRangeMoveUndo(
|
|
1397
1395
|
n,
|
|
1398
1396
|
3
|
|
1399
1397
|
/* insertRight */
|
|
1400
1398
|
);
|
|
1401
|
-
} else if (e ===
|
|
1399
|
+
} else if (e === dn.id || e === ln.id) {
|
|
1402
1400
|
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
|
|
1403
1401
|
return this._getDrawingUndoForRowVisible(t, r, s);
|
|
1404
|
-
} else if (e ===
|
|
1402
|
+
} else if (e === un.id || e === hn.id) {
|
|
1405
1403
|
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
|
|
1406
1404
|
return this._getDrawingUndoForColVisible(t, r, s);
|
|
1407
|
-
} else if (e ===
|
|
1408
|
-
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e ===
|
|
1405
|
+
} else if (e === gt.id || e === mt.id || e === an.id || e === cn.id) {
|
|
1406
|
+
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e === gt.id || e === mt.id;
|
|
1409
1407
|
return this._getDrawingUndoForRowAndColSize(t, r, s, o);
|
|
1410
1408
|
}
|
|
1411
1409
|
return { redos: [], undos: [] };
|
|
@@ -1417,19 +1415,19 @@ let _t = class extends q {
|
|
|
1417
1415
|
const n = H(this._univerInstanceService);
|
|
1418
1416
|
if (n == null)
|
|
1419
1417
|
return { redos: [], undos: [] };
|
|
1420
|
-
const t = n.unitId, r = n.subUnitId, s = [], o = [],
|
|
1421
|
-
if (Object.keys(
|
|
1422
|
-
const
|
|
1418
|
+
const t = n.unitId, r = n.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(t, r), l = [], g = [];
|
|
1419
|
+
if (Object.keys(a).forEach((d) => {
|
|
1420
|
+
const c = a[d], { updateDrawings: h, deleteDrawings: u } = this._getUpdateOrDeleteDrawings(i, e, c);
|
|
1423
1421
|
l.push(...h), g.push(...u);
|
|
1424
1422
|
}), l.length === 0 && g.length === 0)
|
|
1425
1423
|
return { redos: [], undos: [] };
|
|
1426
1424
|
if (l.length > 0) {
|
|
1427
|
-
const
|
|
1428
|
-
s.push({ id: O.id, params: { unitId: t, subUnitId: r, op: h, objects: u, type: E.UPDATE } }), o.push({ id: O.id, params: { unitId: t, subUnitId: r, op:
|
|
1425
|
+
const d = this._sheetDrawingService.getBatchUpdateOp(l), { undo: c, redo: h, objects: u } = d;
|
|
1426
|
+
s.push({ id: O.id, params: { unitId: t, subUnitId: r, op: h, objects: u, type: E.UPDATE } }), o.push({ id: O.id, params: { unitId: t, subUnitId: r, op: c, objects: u, type: E.UPDATE } });
|
|
1429
1427
|
}
|
|
1430
1428
|
if (g.length > 0) {
|
|
1431
|
-
const
|
|
1432
|
-
s.push({ id: O.id, params: { unitId: t, subUnitId: r, op: h, objects: u, type: E.REMOVE } }), o.push({ id: O.id, params: { unitId: t, subUnitId: r, op:
|
|
1429
|
+
const d = this._sheetDrawingService.getBatchRemoveOp(g), c = d.undo, h = d.redo, u = d.objects;
|
|
1430
|
+
s.push({ id: O.id, params: { unitId: t, subUnitId: r, op: h, objects: u, type: E.REMOVE } }), o.push({ id: O.id, params: { unitId: t, subUnitId: r, op: c, objects: u, type: E.INSERT } });
|
|
1433
1431
|
}
|
|
1434
1432
|
return s.push({ id: W.id, params: [t] }), o.push({ id: W.id, params: [t] }), {
|
|
1435
1433
|
redos: s,
|
|
@@ -1437,33 +1435,33 @@ let _t = class extends q {
|
|
|
1437
1435
|
};
|
|
1438
1436
|
}
|
|
1439
1437
|
_getUpdateOrDeleteDrawings(i, e, n) {
|
|
1440
|
-
const t = [], r = [], { sheetTransform: s, anchorType: o = y.Position, transform:
|
|
1441
|
-
if (s == null ||
|
|
1438
|
+
const t = [], r = [], { sheetTransform: s, anchorType: o = y.Position, transform: a, unitId: l, subUnitId: g, drawingId: d } = n, { from: c, to: h } = s, { row: u, column: m } = c, { row: f, column: p } = h;
|
|
1439
|
+
if (s == null || a == null)
|
|
1442
1440
|
return {
|
|
1443
1441
|
updateDrawings: t,
|
|
1444
1442
|
deleteDrawings: r
|
|
1445
1443
|
};
|
|
1446
|
-
const { startRow: v, endRow: I, startColumn: S, endColumn:
|
|
1444
|
+
const { startRow: v, endRow: I, startColumn: S, endColumn: M } = i;
|
|
1447
1445
|
let w = null, C = null;
|
|
1448
1446
|
if (e === 0 && u >= v && f <= I)
|
|
1449
|
-
if (m >= S && p <=
|
|
1450
|
-
r.push({ unitId: l, subUnitId: g, drawingId:
|
|
1447
|
+
if (m >= S && p <= M)
|
|
1448
|
+
r.push({ unitId: l, subUnitId: g, drawingId: d });
|
|
1451
1449
|
else {
|
|
1452
|
-
const _ = this._shrinkCol(s,
|
|
1450
|
+
const _ = this._shrinkCol(s, a, S, M, o);
|
|
1453
1451
|
w = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
1454
1452
|
}
|
|
1455
|
-
else if (e === 1 && m >= S && p <=
|
|
1453
|
+
else if (e === 1 && m >= S && p <= M)
|
|
1456
1454
|
if (u >= v && f <= I)
|
|
1457
|
-
r.push({ unitId: l, subUnitId: g, drawingId:
|
|
1455
|
+
r.push({ unitId: l, subUnitId: g, drawingId: d });
|
|
1458
1456
|
else {
|
|
1459
|
-
const _ = this._shrinkRow(s,
|
|
1457
|
+
const _ = this._shrinkRow(s, a, v, I, o);
|
|
1460
1458
|
w = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
1461
1459
|
}
|
|
1462
1460
|
else if (e === 2) {
|
|
1463
|
-
const _ = this._expandRow(s,
|
|
1461
|
+
const _ = this._expandRow(s, a, v, I, o);
|
|
1464
1462
|
w = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
1465
1463
|
} else if (e === 3) {
|
|
1466
|
-
const _ = this._expandCol(s,
|
|
1464
|
+
const _ = this._expandCol(s, a, S, M, o);
|
|
1467
1465
|
w = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
1468
1466
|
}
|
|
1469
1467
|
if (w != null && C != null) {
|
|
@@ -1482,86 +1480,86 @@ let _t = class extends q {
|
|
|
1482
1480
|
// eslint-disable-next-line max-lines-per-function
|
|
1483
1481
|
_getDrawingUndoForColVisible(i, e, n) {
|
|
1484
1482
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
|
|
1485
|
-
if (Object.keys(t).forEach((
|
|
1486
|
-
const
|
|
1483
|
+
if (Object.keys(t).forEach((d) => {
|
|
1484
|
+
const c = t[d], { sheetTransform: h, transform: u, anchorType: m = y.Position } = c;
|
|
1487
1485
|
if (m === y.None)
|
|
1488
|
-
this._remainDrawingSize(u, r,
|
|
1486
|
+
this._remainDrawingSize(u, r, c);
|
|
1489
1487
|
else {
|
|
1490
|
-
const { from: f, to: p } = h, { row: v, column: I } = f, { row: S, column:
|
|
1488
|
+
const { from: f, to: p } = h, { row: v, column: I } = f, { row: S, column: M } = p;
|
|
1491
1489
|
for (let w = 0; w < n.length; w++) {
|
|
1492
1490
|
const C = n[w], { startRow: _, endRow: T, startColumn: D, endColumn: N } = C;
|
|
1493
|
-
if (
|
|
1491
|
+
if (M < D)
|
|
1494
1492
|
continue;
|
|
1495
1493
|
if (m === y.Position) {
|
|
1496
|
-
let
|
|
1494
|
+
let R = null, P = null;
|
|
1497
1495
|
if (I >= D && I <= N) {
|
|
1498
1496
|
const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: N, startRow: f.row, endRow: p.row });
|
|
1499
1497
|
if (x == null)
|
|
1500
1498
|
return;
|
|
1501
1499
|
P = { ...u, left: x.startX };
|
|
1502
1500
|
}
|
|
1503
|
-
if (P != null && (
|
|
1504
|
-
r.push({ ...
|
|
1501
|
+
if (P != null && (R = j(P, this._selectionRenderService), R != null && P != null)) {
|
|
1502
|
+
r.push({ ...c, sheetTransform: R, transform: P });
|
|
1505
1503
|
break;
|
|
1506
1504
|
}
|
|
1507
|
-
this._remainDrawingSize(u, r,
|
|
1505
|
+
this._remainDrawingSize(u, r, c);
|
|
1508
1506
|
continue;
|
|
1509
1507
|
}
|
|
1510
|
-
if (I >= D &&
|
|
1508
|
+
if (I >= D && M <= N)
|
|
1511
1509
|
continue;
|
|
1512
1510
|
let A = null, b = null;
|
|
1513
1511
|
if (I >= D && I <= N) {
|
|
1514
|
-
const
|
|
1515
|
-
if (
|
|
1512
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: N, startRow: f.row, endRow: p.row });
|
|
1513
|
+
if (R == null)
|
|
1516
1514
|
return;
|
|
1517
1515
|
b = {
|
|
1518
1516
|
...u,
|
|
1519
|
-
left: (
|
|
1520
|
-
width: ((u == null ? void 0 : u.width) || 0) -
|
|
1517
|
+
left: (R == null ? void 0 : R.startX) || 0,
|
|
1518
|
+
width: ((u == null ? void 0 : u.width) || 0) - R.endX + R.startX
|
|
1521
1519
|
};
|
|
1522
|
-
} else if (
|
|
1523
|
-
const
|
|
1524
|
-
if (
|
|
1520
|
+
} else if (M >= D && M <= N) {
|
|
1521
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn: M, startRow: f.row, endRow: p.row });
|
|
1522
|
+
if (R == null)
|
|
1525
1523
|
return;
|
|
1526
1524
|
b = {
|
|
1527
1525
|
...u,
|
|
1528
|
-
left:
|
|
1526
|
+
left: R.startX - ((u == null ? void 0 : u.width) || 0)
|
|
1529
1527
|
};
|
|
1530
1528
|
} else {
|
|
1531
|
-
const
|
|
1532
|
-
if (
|
|
1529
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn: N, startRow: f.row, endRow: p.row });
|
|
1530
|
+
if (R == null)
|
|
1533
1531
|
return;
|
|
1534
1532
|
if (b = {
|
|
1535
1533
|
...u,
|
|
1536
|
-
width: ((u == null ? void 0 : u.width) || 0) -
|
|
1534
|
+
width: ((u == null ? void 0 : u.width) || 0) - R.endX + R.startX
|
|
1537
1535
|
}, A = j(b, this._selectionRenderService), A != null && b != null) {
|
|
1538
|
-
s.push({ ...
|
|
1536
|
+
s.push({ ...c, sheetTransform: A, transform: b });
|
|
1539
1537
|
break;
|
|
1540
1538
|
}
|
|
1541
1539
|
}
|
|
1542
1540
|
if (b != null && (A = j(b, this._selectionRenderService)), b != null && A != null) {
|
|
1543
|
-
r.push({ ...
|
|
1541
|
+
r.push({ ...c, sheetTransform: A, transform: b });
|
|
1544
1542
|
break;
|
|
1545
1543
|
} else
|
|
1546
|
-
this._remainDrawingSize(u, r,
|
|
1544
|
+
this._remainDrawingSize(u, r, c);
|
|
1547
1545
|
}
|
|
1548
1546
|
}
|
|
1549
1547
|
}), r.length === 0 && s.length === 0)
|
|
1550
1548
|
return { redos: [], undos: [] };
|
|
1551
|
-
const { redos: o, undos:
|
|
1549
|
+
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, e, r), l = [], g = [];
|
|
1552
1550
|
if (s.length > 0) {
|
|
1553
|
-
const { redos:
|
|
1554
|
-
l.push(...
|
|
1551
|
+
const { redos: d, undos: c } = this._createUndoAndRedoMutation(i, e, s);
|
|
1552
|
+
l.push(...d), g.push(...c);
|
|
1555
1553
|
}
|
|
1556
1554
|
return {
|
|
1557
1555
|
redos: o,
|
|
1558
|
-
undos:
|
|
1556
|
+
undos: a,
|
|
1559
1557
|
preRedos: l,
|
|
1560
1558
|
preUndos: g
|
|
1561
1559
|
};
|
|
1562
1560
|
}
|
|
1563
1561
|
_createUndoAndRedoMutation(i, e, n) {
|
|
1564
|
-
const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: r, redo: s, objects: o } = t,
|
|
1562
|
+
const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: r, redo: s, objects: o } = t, a = [
|
|
1565
1563
|
{ id: O.id, params: { unitId: i, subUnitId: e, op: s, objects: o, type: E.UPDATE } },
|
|
1566
1564
|
{ id: W.id, params: [i] }
|
|
1567
1565
|
], l = [
|
|
@@ -1569,87 +1567,87 @@ let _t = class extends q {
|
|
|
1569
1567
|
{ id: W.id, params: [i] }
|
|
1570
1568
|
];
|
|
1571
1569
|
return {
|
|
1572
|
-
redos:
|
|
1570
|
+
redos: a,
|
|
1573
1571
|
undos: l
|
|
1574
1572
|
};
|
|
1575
1573
|
}
|
|
1576
1574
|
// eslint-disable-next-line max-lines-per-function
|
|
1577
1575
|
_getDrawingUndoForRowVisible(i, e, n) {
|
|
1578
1576
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
|
|
1579
|
-
if (Object.keys(t).forEach((
|
|
1580
|
-
const
|
|
1577
|
+
if (Object.keys(t).forEach((d) => {
|
|
1578
|
+
const c = t[d], { sheetTransform: h, transform: u, anchorType: m = y.Position } = c;
|
|
1581
1579
|
if (m === y.None)
|
|
1582
|
-
this._remainDrawingSize(u, r,
|
|
1580
|
+
this._remainDrawingSize(u, r, c);
|
|
1583
1581
|
else {
|
|
1584
|
-
const { from: f, to: p } = h, { row: v, column: I } = f, { row: S, column:
|
|
1582
|
+
const { from: f, to: p } = h, { row: v, column: I } = f, { row: S, column: M } = p;
|
|
1585
1583
|
for (let w = 0; w < n.length; w++) {
|
|
1586
1584
|
const C = n[w], { startRow: _, endRow: T, startColumn: D, endColumn: N } = C;
|
|
1587
1585
|
if (S < _)
|
|
1588
1586
|
continue;
|
|
1589
1587
|
if (m === y.Position) {
|
|
1590
|
-
let
|
|
1588
|
+
let R = null, P = null;
|
|
1591
1589
|
if (v >= _ && v <= T) {
|
|
1592
1590
|
const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: v, endRow: T });
|
|
1593
1591
|
if (x == null)
|
|
1594
1592
|
return;
|
|
1595
1593
|
P = { ...u, top: x.startY };
|
|
1596
1594
|
}
|
|
1597
|
-
if (P != null && (
|
|
1598
|
-
r.push({ ...
|
|
1595
|
+
if (P != null && (R = j(P, this._selectionRenderService), R != null && P != null)) {
|
|
1596
|
+
r.push({ ...c, sheetTransform: R, transform: P });
|
|
1599
1597
|
break;
|
|
1600
1598
|
}
|
|
1601
|
-
this._remainDrawingSize(u, r,
|
|
1599
|
+
this._remainDrawingSize(u, r, c);
|
|
1602
1600
|
continue;
|
|
1603
1601
|
}
|
|
1604
1602
|
if (v >= _ && S <= T)
|
|
1605
1603
|
continue;
|
|
1606
1604
|
let A = null, b = null;
|
|
1607
1605
|
if (v >= _ && v <= T) {
|
|
1608
|
-
const
|
|
1609
|
-
if (
|
|
1606
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: v, endRow: T });
|
|
1607
|
+
if (R == null)
|
|
1610
1608
|
return;
|
|
1611
1609
|
b = {
|
|
1612
1610
|
...u,
|
|
1613
|
-
top: (
|
|
1614
|
-
height: ((u == null ? void 0 : u.height) || 0) -
|
|
1611
|
+
top: (R == null ? void 0 : R.startY) || 0,
|
|
1612
|
+
height: ((u == null ? void 0 : u.height) || 0) - R.endY + R.startY
|
|
1615
1613
|
};
|
|
1616
1614
|
} else if (S >= _ && S <= T) {
|
|
1617
|
-
const
|
|
1618
|
-
if (
|
|
1615
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: _, endRow: S });
|
|
1616
|
+
if (R == null)
|
|
1619
1617
|
return;
|
|
1620
1618
|
b = {
|
|
1621
1619
|
...u,
|
|
1622
|
-
top:
|
|
1620
|
+
top: R.startY - ((u == null ? void 0 : u.height) || 0)
|
|
1623
1621
|
};
|
|
1624
1622
|
} else {
|
|
1625
|
-
const
|
|
1626
|
-
if (
|
|
1623
|
+
const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: _, endRow: T });
|
|
1624
|
+
if (R == null)
|
|
1627
1625
|
return;
|
|
1628
1626
|
if (b = {
|
|
1629
1627
|
...u,
|
|
1630
|
-
height: ((u == null ? void 0 : u.height) || 0) -
|
|
1628
|
+
height: ((u == null ? void 0 : u.height) || 0) - R.endY + R.startY
|
|
1631
1629
|
}, A = j(b, this._selectionRenderService), A != null && b != null) {
|
|
1632
|
-
s.push({ ...
|
|
1630
|
+
s.push({ ...c, sheetTransform: A, transform: b });
|
|
1633
1631
|
break;
|
|
1634
1632
|
}
|
|
1635
1633
|
}
|
|
1636
1634
|
if (b != null && (A = j(b, this._selectionRenderService)), b != null && A != null) {
|
|
1637
|
-
r.push({ ...
|
|
1635
|
+
r.push({ ...c, sheetTransform: A, transform: b });
|
|
1638
1636
|
break;
|
|
1639
1637
|
} else
|
|
1640
|
-
this._remainDrawingSize(u, r,
|
|
1638
|
+
this._remainDrawingSize(u, r, c);
|
|
1641
1639
|
}
|
|
1642
1640
|
}
|
|
1643
1641
|
}), r.length === 0 && s.length === 0)
|
|
1644
1642
|
return { redos: [], undos: [] };
|
|
1645
|
-
const { redos: o, undos:
|
|
1643
|
+
const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, e, r), l = [], g = [];
|
|
1646
1644
|
if (s.length > 0) {
|
|
1647
|
-
const { redos:
|
|
1648
|
-
l.push(...
|
|
1645
|
+
const { redos: d, undos: c } = this._createUndoAndRedoMutation(i, e, s);
|
|
1646
|
+
l.push(...d), g.push(...c);
|
|
1649
1647
|
}
|
|
1650
1648
|
return {
|
|
1651
1649
|
redos: o,
|
|
1652
|
-
undos:
|
|
1650
|
+
undos: a,
|
|
1653
1651
|
preRedos: l,
|
|
1654
1652
|
preUndos: g
|
|
1655
1653
|
};
|
|
@@ -1657,17 +1655,17 @@ let _t = class extends q {
|
|
|
1657
1655
|
_getDrawingUndoForRowAndColSize(i, e, n, t) {
|
|
1658
1656
|
const r = this._drawingManagerService.getDrawingData(i, e), s = [];
|
|
1659
1657
|
return Object.keys(r).forEach((o) => {
|
|
1660
|
-
const
|
|
1661
|
-
if (
|
|
1662
|
-
this._remainDrawingSize(g, s,
|
|
1658
|
+
const a = r[o], { sheetTransform: l, transform: g, anchorType: d = y.Position } = a;
|
|
1659
|
+
if (d === y.None)
|
|
1660
|
+
this._remainDrawingSize(g, s, a);
|
|
1663
1661
|
else {
|
|
1664
|
-
const { from:
|
|
1662
|
+
const { from: c, to: h } = l, { row: u, column: m } = c, { row: f, column: p } = h;
|
|
1665
1663
|
for (let v = 0; v < n.length; v++) {
|
|
1666
|
-
const I = n[v], { startRow: S, endRow:
|
|
1664
|
+
const I = n[v], { startRow: S, endRow: M, startColumn: w, endColumn: C } = I;
|
|
1667
1665
|
if (f < S || p < w)
|
|
1668
1666
|
continue;
|
|
1669
|
-
if (
|
|
1670
|
-
this._remainDrawingSize(g, s,
|
|
1667
|
+
if (d === y.Position && (u <= S && f >= M || m <= w && p >= C)) {
|
|
1668
|
+
this._remainDrawingSize(g, s, a);
|
|
1671
1669
|
continue;
|
|
1672
1670
|
}
|
|
1673
1671
|
const _ = L(
|
|
@@ -1677,7 +1675,7 @@ let _t = class extends q {
|
|
|
1677
1675
|
);
|
|
1678
1676
|
if (_ != null) {
|
|
1679
1677
|
s.push({
|
|
1680
|
-
...
|
|
1678
|
+
...a,
|
|
1681
1679
|
transform: _
|
|
1682
1680
|
});
|
|
1683
1681
|
break;
|
|
@@ -1699,17 +1697,17 @@ let _t = class extends q {
|
|
|
1699
1697
|
return { unitId: n, subUnitId: t };
|
|
1700
1698
|
}
|
|
1701
1699
|
_moveRangeInterceptor(i) {
|
|
1702
|
-
var S,
|
|
1700
|
+
var S, M;
|
|
1703
1701
|
const { toRange: e, fromRange: n } = i, t = H(this._univerInstanceService);
|
|
1704
1702
|
if (!t)
|
|
1705
1703
|
return { redos: [], undos: [] };
|
|
1706
|
-
const { unitId: r, subUnitId: s } = t, o = (
|
|
1704
|
+
const { unitId: r, subUnitId: s } = t, o = (M = (S = this._renderManagerService.getRenderById(r)) == null ? void 0 : S.with(Z)) == null ? void 0 : M.getCurrentSkeleton();
|
|
1707
1705
|
if (!o)
|
|
1708
1706
|
return { redos: [], undos: [] };
|
|
1709
|
-
const
|
|
1710
|
-
if (!
|
|
1707
|
+
const a = Xt(o, n);
|
|
1708
|
+
if (!a)
|
|
1711
1709
|
return { redos: [], undos: [] };
|
|
1712
|
-
const { startX: l, endX: g, startY:
|
|
1710
|
+
const { startX: l, endX: g, startY: d, endY: c } = a, h = this._sheetDrawingService.getDrawingData(r, s), u = [];
|
|
1713
1711
|
Object.keys(h).forEach((w) => {
|
|
1714
1712
|
const C = h[w];
|
|
1715
1713
|
if (C.anchorType !== y.Both)
|
|
@@ -1717,13 +1715,13 @@ let _t = class extends q {
|
|
|
1717
1715
|
const { transform: _ } = C;
|
|
1718
1716
|
if (!_)
|
|
1719
1717
|
return;
|
|
1720
|
-
const { left: T = 0, top: D = 0, width: N = 0, height: A = 0 } = _, { drawingStartX: b, drawingEndX:
|
|
1718
|
+
const { left: T = 0, top: D = 0, width: N = 0, height: A = 0 } = _, { drawingStartX: b, drawingEndX: R, drawingStartY: P, drawingEndY: x } = {
|
|
1721
1719
|
drawingStartX: T,
|
|
1722
1720
|
drawingEndX: T + N,
|
|
1723
1721
|
drawingStartY: D,
|
|
1724
1722
|
drawingEndY: D + A
|
|
1725
1723
|
};
|
|
1726
|
-
l <= b &&
|
|
1724
|
+
l <= b && R <= g && d <= P && x <= c && u.push(C);
|
|
1727
1725
|
});
|
|
1728
1726
|
const m = [], f = [], p = e.startRow - n.startRow, v = e.startColumn - n.startColumn, I = u.map((w) => {
|
|
1729
1727
|
const C = w.sheetTransform, _ = {
|
|
@@ -1748,32 +1746,32 @@ let _t = class extends q {
|
|
|
1748
1746
|
const n = this._getUnitIdAndSubUnitId(i, e);
|
|
1749
1747
|
if (n == null)
|
|
1750
1748
|
return { redos: [], undos: [] };
|
|
1751
|
-
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow,
|
|
1752
|
-
if (Object.keys(
|
|
1753
|
-
const m =
|
|
1749
|
+
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, a = s.endRow, l = [], g = [], d = this._sheetDrawingService.getDrawingData(t, r), c = [], h = [];
|
|
1750
|
+
if (Object.keys(d).forEach((u) => {
|
|
1751
|
+
const m = d[u], { sheetTransform: f, transform: p, anchorType: v = y.Position } = m;
|
|
1754
1752
|
if (f == null || p == null)
|
|
1755
1753
|
return;
|
|
1756
1754
|
let I, S;
|
|
1757
1755
|
if (e === "insert") {
|
|
1758
|
-
const w = this._expandRow(f, p, o,
|
|
1756
|
+
const w = this._expandRow(f, p, o, a, v);
|
|
1759
1757
|
I = w == null ? void 0 : w.newSheetTransform, S = w == null ? void 0 : w.newTransform;
|
|
1760
1758
|
} else {
|
|
1761
1759
|
const { from: w, to: C } = f, { row: _ } = w, { row: T } = C;
|
|
1762
|
-
if (v === y.Both && _ >= o && T <=
|
|
1760
|
+
if (v === y.Both && _ >= o && T <= a)
|
|
1763
1761
|
h.push({ unitId: t, subUnitId: r, drawingId: u });
|
|
1764
1762
|
else {
|
|
1765
|
-
const D = this._shrinkRow(f, p, o,
|
|
1763
|
+
const D = this._shrinkRow(f, p, o, a, v);
|
|
1766
1764
|
I = D == null ? void 0 : D.newSheetTransform, S = D == null ? void 0 : D.newTransform;
|
|
1767
1765
|
}
|
|
1768
1766
|
}
|
|
1769
1767
|
if (!I || !S)
|
|
1770
1768
|
return;
|
|
1771
|
-
const
|
|
1772
|
-
|
|
1773
|
-
}),
|
|
1769
|
+
const M = { unitId: t, subUnitId: r, drawingId: u, transform: S, sheetTransform: I };
|
|
1770
|
+
c.push(M);
|
|
1771
|
+
}), c.length === 0 && h.length === 0)
|
|
1774
1772
|
return { redos: [], undos: [] };
|
|
1775
|
-
if (
|
|
1776
|
-
const u = this._sheetDrawingService.getBatchUpdateOp(
|
|
1773
|
+
if (c.length > 0) {
|
|
1774
|
+
const u = this._sheetDrawingService.getBatchUpdateOp(c), { undo: m, redo: f, objects: p } = u;
|
|
1777
1775
|
l.push({ id: O.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: E.UPDATE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: E.UPDATE } });
|
|
1778
1776
|
}
|
|
1779
1777
|
if (h.length > 0) {
|
|
@@ -1789,32 +1787,32 @@ let _t = class extends q {
|
|
|
1789
1787
|
const n = this._getUnitIdAndSubUnitId(i, e);
|
|
1790
1788
|
if (n == null)
|
|
1791
1789
|
return { redos: [], undos: [] };
|
|
1792
|
-
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn,
|
|
1793
|
-
if (Object.keys(
|
|
1794
|
-
const m =
|
|
1790
|
+
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, a = s.endColumn, l = [], g = [], d = this._sheetDrawingService.getDrawingData(t, r), c = [], h = [];
|
|
1791
|
+
if (Object.keys(d).forEach((u) => {
|
|
1792
|
+
const m = d[u], { sheetTransform: f, transform: p, anchorType: v = y.Position } = m;
|
|
1795
1793
|
if (f == null || p == null)
|
|
1796
1794
|
return;
|
|
1797
1795
|
let I, S;
|
|
1798
1796
|
if (e === "insert") {
|
|
1799
|
-
const w = this._expandCol(f, p, o,
|
|
1797
|
+
const w = this._expandCol(f, p, o, a, v);
|
|
1800
1798
|
I = w == null ? void 0 : w.newSheetTransform, S = w == null ? void 0 : w.newTransform;
|
|
1801
1799
|
} else {
|
|
1802
1800
|
const { from: w, to: C } = f, { column: _ } = w, { column: T } = C;
|
|
1803
|
-
if (v === y.Both && _ >= o && T <=
|
|
1801
|
+
if (v === y.Both && _ >= o && T <= a)
|
|
1804
1802
|
h.push({ unitId: t, subUnitId: r, drawingId: u });
|
|
1805
1803
|
else {
|
|
1806
|
-
const D = this._shrinkCol(f, p, o,
|
|
1804
|
+
const D = this._shrinkCol(f, p, o, a, v);
|
|
1807
1805
|
I = D == null ? void 0 : D.newSheetTransform, S = D == null ? void 0 : D.newTransform;
|
|
1808
1806
|
}
|
|
1809
1807
|
}
|
|
1810
1808
|
if (!I || !S)
|
|
1811
1809
|
return;
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1814
|
-
}),
|
|
1810
|
+
const M = { unitId: t, subUnitId: r, drawingId: u, transform: S, sheetTransform: I };
|
|
1811
|
+
c.push(M);
|
|
1812
|
+
}), c.length === 0 && h.length === 0)
|
|
1815
1813
|
return { redos: [], undos: [] };
|
|
1816
|
-
if (
|
|
1817
|
-
const u = this._sheetDrawingService.getBatchUpdateOp(
|
|
1814
|
+
if (c.length > 0) {
|
|
1815
|
+
const u = this._sheetDrawingService.getBatchUpdateOp(c), { undo: m, redo: f, objects: p } = u;
|
|
1818
1816
|
l.push({ id: O.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: E.UPDATE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: E.UPDATE } });
|
|
1819
1817
|
}
|
|
1820
1818
|
if (h.length > 0) {
|
|
@@ -1824,56 +1822,56 @@ let _t = class extends q {
|
|
|
1824
1822
|
return l.push({ id: W.id, params: [t] }), g.push({ id: W.id, params: [t] }), { redos: l, undos: g };
|
|
1825
1823
|
}
|
|
1826
1824
|
_expandCol(i, e, n, t, r = y.Position) {
|
|
1827
|
-
const s = t - n + 1, { from: o, to:
|
|
1825
|
+
const s = t - n + 1, { from: o, to: a } = i, { column: l } = o, { column: g } = a;
|
|
1828
1826
|
if (r === y.None)
|
|
1829
1827
|
return {
|
|
1830
1828
|
newSheetTransform: j({ ...e }, this._selectionRenderService),
|
|
1831
1829
|
newTransform: e
|
|
1832
1830
|
};
|
|
1833
|
-
let
|
|
1831
|
+
let d = null, c = null;
|
|
1834
1832
|
if (l >= n) {
|
|
1835
|
-
const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow:
|
|
1833
|
+
const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: a.row });
|
|
1836
1834
|
if (h == null)
|
|
1837
1835
|
return;
|
|
1838
|
-
|
|
1836
|
+
c = { ...e, left: (e.left || 0) + h.endX - h.startX }, d = j(c, this._selectionRenderService);
|
|
1839
1837
|
} else if (g >= t)
|
|
1840
1838
|
if (r === y.Both)
|
|
1841
|
-
|
|
1839
|
+
d = {
|
|
1842
1840
|
from: { ...o },
|
|
1843
|
-
to: { ...
|
|
1844
|
-
},
|
|
1841
|
+
to: { ...a, column: g + s }
|
|
1842
|
+
}, c = L(d, this._selectionRenderService, this._skeletonManagerService);
|
|
1845
1843
|
else
|
|
1846
1844
|
return {
|
|
1847
1845
|
newSheetTransform: j({ ...e }, this._selectionRenderService),
|
|
1848
1846
|
newTransform: e
|
|
1849
1847
|
};
|
|
1850
|
-
return
|
|
1851
|
-
newSheetTransform:
|
|
1852
|
-
newTransform:
|
|
1848
|
+
return d != null && c != null ? {
|
|
1849
|
+
newSheetTransform: d,
|
|
1850
|
+
newTransform: c
|
|
1853
1851
|
} : null;
|
|
1854
1852
|
}
|
|
1855
1853
|
_shrinkCol(i, e, n, t, r = y.Position) {
|
|
1856
|
-
const s = t - n + 1, { from: o, to:
|
|
1854
|
+
const s = t - n + 1, { from: o, to: a } = i, { column: l } = o, { column: g } = a;
|
|
1857
1855
|
if (r === y.None)
|
|
1858
1856
|
return {
|
|
1859
1857
|
newSheetTransform: j({ ...e }, this._selectionRenderService),
|
|
1860
1858
|
newTransform: e
|
|
1861
1859
|
};
|
|
1862
|
-
let
|
|
1860
|
+
let d = null, c = null;
|
|
1863
1861
|
if (l > t)
|
|
1864
|
-
|
|
1862
|
+
d = {
|
|
1865
1863
|
from: { ...o, column: l - s },
|
|
1866
|
-
to: { ...
|
|
1867
|
-
},
|
|
1864
|
+
to: { ...a, column: g - s }
|
|
1865
|
+
}, c = L(d, this._selectionRenderService, this._skeletonManagerService);
|
|
1868
1866
|
else {
|
|
1869
1867
|
if (l >= n && g <= t)
|
|
1870
1868
|
return null;
|
|
1871
1869
|
if (l < n && g > t)
|
|
1872
1870
|
if (r === y.Both)
|
|
1873
|
-
|
|
1871
|
+
d = {
|
|
1874
1872
|
from: { ...o },
|
|
1875
|
-
to: { ...
|
|
1876
|
-
},
|
|
1873
|
+
to: { ...a, column: g - s }
|
|
1874
|
+
}, c = L(d, this._selectionRenderService, this._skeletonManagerService);
|
|
1877
1875
|
else
|
|
1878
1876
|
return {
|
|
1879
1877
|
newSheetTransform: j({ ...e }, this._selectionRenderService),
|
|
@@ -1881,88 +1879,88 @@ let _t = class extends q {
|
|
|
1881
1879
|
};
|
|
1882
1880
|
else if (l >= n && l <= t) {
|
|
1883
1881
|
if (l === n)
|
|
1884
|
-
|
|
1882
|
+
c = { ...e, left: (e.left || 0) - i.from.columnOffset };
|
|
1885
1883
|
else {
|
|
1886
|
-
const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: l - 1, startRow: o.row, endRow:
|
|
1884
|
+
const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: l - 1, startRow: o.row, endRow: a.row });
|
|
1887
1885
|
if (h == null)
|
|
1888
1886
|
return;
|
|
1889
|
-
|
|
1887
|
+
c = { ...e, left: (e.left || 0) - h.endX + h.startX - i.from.columnOffset };
|
|
1890
1888
|
}
|
|
1891
|
-
|
|
1889
|
+
d = j(c, this._selectionRenderService);
|
|
1892
1890
|
} else if (g >= n && g <= t && r === y.Both) {
|
|
1893
1891
|
const h = this._skeletonManagerService.attachRangeWithCoord({
|
|
1894
1892
|
startColumn: n - 1,
|
|
1895
1893
|
endColumn: n - 1,
|
|
1896
1894
|
startRow: o.row,
|
|
1897
|
-
endRow:
|
|
1895
|
+
endRow: a.row
|
|
1898
1896
|
});
|
|
1899
1897
|
if (h == null)
|
|
1900
1898
|
return;
|
|
1901
|
-
|
|
1899
|
+
d = {
|
|
1902
1900
|
from: { ...o },
|
|
1903
|
-
to: { ...
|
|
1904
|
-
},
|
|
1901
|
+
to: { ...a, column: n - 1, columnOffset: h.endX - h.startX }
|
|
1902
|
+
}, c = L(d, this._selectionRenderService, this._skeletonManagerService);
|
|
1905
1903
|
}
|
|
1906
1904
|
}
|
|
1907
|
-
return
|
|
1908
|
-
newSheetTransform:
|
|
1909
|
-
newTransform:
|
|
1905
|
+
return d != null && c != null ? {
|
|
1906
|
+
newSheetTransform: d,
|
|
1907
|
+
newTransform: c
|
|
1910
1908
|
} : null;
|
|
1911
1909
|
}
|
|
1912
1910
|
_expandRow(i, e, n, t, r = y.Position) {
|
|
1913
|
-
const s = t - n + 1, { from: o, to:
|
|
1911
|
+
const s = t - n + 1, { from: o, to: a } = i, { row: l } = o, { row: g } = a;
|
|
1914
1912
|
if (r === y.None)
|
|
1915
1913
|
return {
|
|
1916
1914
|
newSheetTransform: j({ ...e }, this._selectionRenderService),
|
|
1917
1915
|
newTransform: e
|
|
1918
1916
|
};
|
|
1919
|
-
let
|
|
1917
|
+
let d = null, c = null;
|
|
1920
1918
|
if (l >= n) {
|
|
1921
|
-
const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn:
|
|
1919
|
+
const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: a.column });
|
|
1922
1920
|
if (h == null)
|
|
1923
1921
|
return;
|
|
1924
|
-
|
|
1922
|
+
c = { ...e, top: (e.top || 0) + h.endY - h.startY }, d = j(c, this._selectionRenderService);
|
|
1925
1923
|
} else if (g >= t)
|
|
1926
1924
|
if (r === y.Both)
|
|
1927
|
-
|
|
1925
|
+
d = {
|
|
1928
1926
|
from: { ...o },
|
|
1929
1927
|
to: {
|
|
1930
|
-
...
|
|
1928
|
+
...a,
|
|
1931
1929
|
row: g + s
|
|
1932
1930
|
}
|
|
1933
|
-
},
|
|
1931
|
+
}, c = L(d, this._selectionRenderService, this._skeletonManagerService);
|
|
1934
1932
|
else
|
|
1935
1933
|
return {
|
|
1936
1934
|
newSheetTransform: j({ ...e }, this._selectionRenderService),
|
|
1937
1935
|
newTransform: e
|
|
1938
1936
|
};
|
|
1939
|
-
return
|
|
1940
|
-
newSheetTransform:
|
|
1941
|
-
newTransform:
|
|
1937
|
+
return d != null && c != null ? {
|
|
1938
|
+
newSheetTransform: d,
|
|
1939
|
+
newTransform: c
|
|
1942
1940
|
} : null;
|
|
1943
1941
|
}
|
|
1944
1942
|
_shrinkRow(i, e, n, t, r = y.Position) {
|
|
1945
|
-
const s = t - n + 1, { from: o, to:
|
|
1943
|
+
const s = t - n + 1, { from: o, to: a } = i, { row: l } = o, { row: g } = a;
|
|
1946
1944
|
if (r === y.None)
|
|
1947
1945
|
return {
|
|
1948
1946
|
newSheetTransform: j({ ...e }, this._selectionRenderService),
|
|
1949
1947
|
newTransform: e
|
|
1950
1948
|
};
|
|
1951
|
-
let
|
|
1949
|
+
let d = null, c = null;
|
|
1952
1950
|
if (l > t)
|
|
1953
|
-
|
|
1951
|
+
d = {
|
|
1954
1952
|
from: { ...o, row: l - s },
|
|
1955
|
-
to: { ...
|
|
1956
|
-
},
|
|
1953
|
+
to: { ...a, row: g - s }
|
|
1954
|
+
}, c = L(d, this._selectionRenderService, this._skeletonManagerService);
|
|
1957
1955
|
else {
|
|
1958
1956
|
if (l >= n && g <= t)
|
|
1959
1957
|
return null;
|
|
1960
1958
|
if (l < n && g > t)
|
|
1961
1959
|
if (r === y.Both)
|
|
1962
|
-
|
|
1960
|
+
d = {
|
|
1963
1961
|
from: { ...o },
|
|
1964
|
-
to: { ...
|
|
1965
|
-
},
|
|
1962
|
+
to: { ...a, row: g - s }
|
|
1963
|
+
}, c = L(d, this._selectionRenderService, this._skeletonManagerService);
|
|
1966
1964
|
else
|
|
1967
1965
|
return {
|
|
1968
1966
|
newSheetTransform: j({ ...e }, this._selectionRenderService),
|
|
@@ -1970,27 +1968,27 @@ let _t = class extends q {
|
|
|
1970
1968
|
};
|
|
1971
1969
|
else if (l >= n && l <= t) {
|
|
1972
1970
|
if (l === n)
|
|
1973
|
-
|
|
1971
|
+
c = { ...e, top: (e.top || 0) - i.from.rowOffset };
|
|
1974
1972
|
else {
|
|
1975
|
-
const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: l - 1, startColumn: o.column, endColumn:
|
|
1973
|
+
const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: l - 1, startColumn: o.column, endColumn: a.column });
|
|
1976
1974
|
if (h == null)
|
|
1977
1975
|
return;
|
|
1978
|
-
|
|
1976
|
+
c = { ...e, top: (e.top || 0) - h.endY + h.startY - i.from.rowOffset };
|
|
1979
1977
|
}
|
|
1980
|
-
|
|
1978
|
+
d = j(c, this._selectionRenderService);
|
|
1981
1979
|
} else if (g >= n && g <= t && r === y.Both) {
|
|
1982
1980
|
const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
|
|
1983
1981
|
if (h == null)
|
|
1984
1982
|
return;
|
|
1985
|
-
|
|
1983
|
+
d = {
|
|
1986
1984
|
from: { ...o },
|
|
1987
|
-
to: { ...
|
|
1988
|
-
},
|
|
1985
|
+
to: { ...a, row: n - 1, rowOffset: h.endY - h.startY }
|
|
1986
|
+
}, c = L(d, this._selectionRenderService, this._skeletonManagerService);
|
|
1989
1987
|
}
|
|
1990
1988
|
}
|
|
1991
|
-
return
|
|
1992
|
-
newSheetTransform:
|
|
1993
|
-
newTransform:
|
|
1989
|
+
return d != null && c != null ? {
|
|
1990
|
+
newSheetTransform: d,
|
|
1991
|
+
newTransform: c
|
|
1994
1992
|
} : null;
|
|
1995
1993
|
}
|
|
1996
1994
|
_commandListener() {
|
|
@@ -1998,16 +1996,16 @@ let _t = class extends q {
|
|
|
1998
1996
|
this._commandService.onCommandExecuted((i) => {
|
|
1999
1997
|
i.id === ai.id && setTimeout(() => {
|
|
2000
1998
|
const e = i.params, { unitId: n, subUnitId: t } = e, r = this._drawingManagerService.drawingManagerData, s = [], o = [];
|
|
2001
|
-
Object.keys(r).forEach((
|
|
2002
|
-
const l = r[
|
|
1999
|
+
Object.keys(r).forEach((a) => {
|
|
2000
|
+
const l = r[a];
|
|
2003
2001
|
l != null && Object.keys(l).forEach((g) => {
|
|
2004
|
-
const
|
|
2005
|
-
|
|
2006
|
-
if (
|
|
2007
|
-
const h = c
|
|
2008
|
-
h.transform = L(h.sheetTransform, this._selectionRenderService, this._skeletonManagerService), s.push(c
|
|
2002
|
+
const d = l[g].data;
|
|
2003
|
+
d != null && Object.keys(d).forEach((c) => {
|
|
2004
|
+
if (a === n && g === t) {
|
|
2005
|
+
const h = d[c];
|
|
2006
|
+
h.transform = L(h.sheetTransform, this._selectionRenderService, this._skeletonManagerService), s.push(d[c]);
|
|
2009
2007
|
} else
|
|
2010
|
-
o.push(c
|
|
2008
|
+
o.push(d[c]);
|
|
2011
2009
|
});
|
|
2012
2010
|
});
|
|
2013
2011
|
}), this._drawingManagerService.removeNotification(o), this._drawingManagerService.addNotification(s);
|
|
@@ -2028,17 +2026,17 @@ let _t = class extends q {
|
|
|
2028
2026
|
_refreshDrawingTransform(i, e, n) {
|
|
2029
2027
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [];
|
|
2030
2028
|
Object.keys(t).forEach((s) => {
|
|
2031
|
-
const o = t[s], { sheetTransform:
|
|
2029
|
+
const o = t[s], { sheetTransform: a, transform: l, anchorType: g = y.Position } = o;
|
|
2032
2030
|
if (g === y.None)
|
|
2033
2031
|
return !0;
|
|
2034
|
-
const { from:
|
|
2032
|
+
const { from: d, to: c } = a, { row: h, column: u } = d, { row: m, column: f } = c;
|
|
2035
2033
|
for (let p = 0; p < n.length; p++) {
|
|
2036
|
-
const v = n[p], { startRow: I, endRow: S, startColumn:
|
|
2034
|
+
const v = n[p], { startRow: I, endRow: S, startColumn: M, endColumn: w } = v;
|
|
2037
2035
|
if (Qn.intersects(
|
|
2038
2036
|
{
|
|
2039
2037
|
startRow: I,
|
|
2040
2038
|
endRow: S,
|
|
2041
|
-
startColumn:
|
|
2039
|
+
startColumn: M,
|
|
2042
2040
|
endColumn: w
|
|
2043
2041
|
},
|
|
2044
2042
|
{
|
|
@@ -2048,7 +2046,7 @@ let _t = class extends q {
|
|
|
2048
2046
|
endColumn: f
|
|
2049
2047
|
}
|
|
2050
2048
|
) || h > S || u > w) {
|
|
2051
|
-
const C = g === y.Position, _ = L(
|
|
2049
|
+
const C = g === y.Position, _ = L(a, this._selectionRenderService, this._skeletonManagerService);
|
|
2052
2050
|
r.push({
|
|
2053
2051
|
...o,
|
|
2054
2052
|
transform: {
|
|
@@ -2063,16 +2061,16 @@ let _t = class extends q {
|
|
|
2063
2061
|
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(W.id, [i]));
|
|
2064
2062
|
}
|
|
2065
2063
|
};
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
],
|
|
2064
|
+
wt = ts([
|
|
2065
|
+
te(1, X),
|
|
2066
|
+
te(2, B),
|
|
2067
|
+
te(3, Ce),
|
|
2068
|
+
te(4, U(Z)),
|
|
2069
|
+
te(5, U(Ze)),
|
|
2070
|
+
te(6, z),
|
|
2071
|
+
te(7, Q),
|
|
2072
|
+
te(8, pe)
|
|
2073
|
+
], wt);
|
|
2076
2074
|
var J = function() {
|
|
2077
2075
|
return J = Object.assign || function(i) {
|
|
2078
2076
|
for (var e, n = 1, t = arguments.length; n < t; n++) {
|
|
@@ -2088,13 +2086,13 @@ var J = function() {
|
|
|
2088
2086
|
for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
|
|
2089
2087
|
e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
|
|
2090
2088
|
return n;
|
|
2091
|
-
},
|
|
2092
|
-
var n = i.icon, t = i.id, r = i.className, s = i.extend, o = is(i, ["icon", "id", "className", "extend"]),
|
|
2093
|
-
return
|
|
2089
|
+
}, Dn = _n(function(i, e) {
|
|
2090
|
+
var n = i.icon, t = i.id, r = i.className, s = i.extend, o = is(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), l = li("_".concat(as()));
|
|
2091
|
+
return yn(n, "".concat(t), { defIds: n.defIds, idSuffix: l.current }, J({ ref: e, className: a }, o), s);
|
|
2094
2092
|
});
|
|
2095
|
-
function
|
|
2096
|
-
return
|
|
2097
|
-
return
|
|
2093
|
+
function yn(i, e, n, t, r) {
|
|
2094
|
+
return wn(i.tag, J(J({ key: e }, ss(i, n, r)), t), (os(i, n).children || []).map(function(s, o) {
|
|
2095
|
+
return yn(s, "".concat(e, "-").concat(i.tag, "-").concat(o), n, void 0, r);
|
|
2098
2096
|
}));
|
|
2099
2097
|
}
|
|
2100
2098
|
function ss(i, e, n) {
|
|
@@ -2102,8 +2100,8 @@ function ss(i, e, n) {
|
|
|
2102
2100
|
n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
|
|
2103
2101
|
var r = e.defIds;
|
|
2104
2102
|
return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(s) {
|
|
2105
|
-
var o = s[0],
|
|
2106
|
-
typeof
|
|
2103
|
+
var o = s[0], a = s[1];
|
|
2104
|
+
typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
2107
2105
|
})), t;
|
|
2108
2106
|
}
|
|
2109
2107
|
function os(i, e) {
|
|
@@ -2115,16 +2113,16 @@ function os(i, e) {
|
|
|
2115
2113
|
function as() {
|
|
2116
2114
|
return Math.random().toString(36).substring(2, 8);
|
|
2117
2115
|
}
|
|
2118
|
-
|
|
2119
|
-
var cs = { 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" } }] },
|
|
2120
|
-
return
|
|
2116
|
+
Dn.displayName = "UniverIcon";
|
|
2117
|
+
var cs = { 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" } }] }, On = _n(function(i, e) {
|
|
2118
|
+
return wn(Dn, Object.assign({}, i, {
|
|
2121
2119
|
id: "add-image-single",
|
|
2122
2120
|
ref: e,
|
|
2123
2121
|
icon: cs
|
|
2124
2122
|
}));
|
|
2125
2123
|
});
|
|
2126
|
-
|
|
2127
|
-
const
|
|
2124
|
+
On.displayName = "AddImageSingle";
|
|
2125
|
+
const En = {
|
|
2128
2126
|
id: "sheet.command.delete-drawing",
|
|
2129
2127
|
type: Y.COMMAND,
|
|
2130
2128
|
handler: (i) => {
|
|
@@ -2132,83 +2130,83 @@ const On = {
|
|
|
2132
2130
|
if (t.length === 0)
|
|
2133
2131
|
return !1;
|
|
2134
2132
|
const r = t[0].unitId, s = t.map((o) => {
|
|
2135
|
-
const { unitId:
|
|
2133
|
+
const { unitId: a, subUnitId: l, drawingId: g, drawingType: d } = o;
|
|
2136
2134
|
return {
|
|
2137
|
-
unitId:
|
|
2135
|
+
unitId: a,
|
|
2138
2136
|
subUnitId: l,
|
|
2139
2137
|
drawingId: g,
|
|
2140
|
-
drawingType:
|
|
2138
|
+
drawingType: d
|
|
2141
2139
|
};
|
|
2142
2140
|
});
|
|
2143
|
-
return e.executeCommand(
|
|
2141
|
+
return e.executeCommand(Qe.id, {
|
|
2144
2142
|
unitId: r,
|
|
2145
2143
|
drawings: s
|
|
2146
2144
|
});
|
|
2147
2145
|
}
|
|
2148
|
-
},
|
|
2146
|
+
}, It = {
|
|
2149
2147
|
id: "sheet.command.insert-float-image",
|
|
2150
2148
|
type: Y.COMMAND,
|
|
2151
2149
|
handler: (i) => {
|
|
2152
2150
|
var n, t;
|
|
2153
|
-
return (t = (n = i.get(X).getCurrentTypeOfRenderer(F.UNIVER_SHEET)) == null ? void 0 : n.with(
|
|
2151
|
+
return (t = (n = i.get(X).getCurrentTypeOfRenderer(F.UNIVER_SHEET)) == null ? void 0 : n.with(Se).insertFloatImage()) != null ? t : !1;
|
|
2154
2152
|
}
|
|
2155
|
-
},
|
|
2153
|
+
}, Ct = {
|
|
2156
2154
|
id: "sheet.command.insert-cell-image",
|
|
2157
2155
|
type: Y.COMMAND,
|
|
2158
2156
|
handler: (i) => {
|
|
2159
2157
|
var n, t;
|
|
2160
|
-
return (t = (n = i.get(X).getCurrentTypeOfRenderer(F.UNIVER_SHEET)) == null ? void 0 : n.with(
|
|
2158
|
+
return (t = (n = i.get(X).getCurrentTypeOfRenderer(F.UNIVER_SHEET)) == null ? void 0 : n.with(Se).insertCellImage()) != null ? t : !1;
|
|
2161
2159
|
}
|
|
2162
|
-
},
|
|
2160
|
+
}, Re = {
|
|
2163
2161
|
id: "sheet.command.move-drawing",
|
|
2164
2162
|
type: Y.COMMAND,
|
|
2165
2163
|
handler: (i, e) => {
|
|
2166
|
-
const n = i.get(B), t = i.get(z), r = i.get(
|
|
2164
|
+
const n = i.get(B), t = i.get(z), r = i.get(Ce), { direction: s } = e, o = t.getFocusDrawings();
|
|
2167
2165
|
if (o.length === 0)
|
|
2168
2166
|
return !1;
|
|
2169
|
-
const
|
|
2170
|
-
const { transform:
|
|
2171
|
-
if (
|
|
2167
|
+
const a = o[0].unitId, l = o.map((d) => {
|
|
2168
|
+
const { transform: c } = d;
|
|
2169
|
+
if (c == null)
|
|
2172
2170
|
return null;
|
|
2173
|
-
const h = { ...
|
|
2174
|
-
return s ===
|
|
2175
|
-
...
|
|
2171
|
+
const h = { ...c }, { left: u = 0, top: m = 0 } = c;
|
|
2172
|
+
return s === re.UP ? h.top = m - 1 : s === re.DOWN ? h.top = m + 1 : s === re.LEFT ? h.left = u - 1 : s === re.RIGHT && (h.left = u + 1), {
|
|
2173
|
+
...d,
|
|
2176
2174
|
transform: h,
|
|
2177
2175
|
sheetTransform: j(h, r)
|
|
2178
2176
|
};
|
|
2179
|
-
}).filter((
|
|
2180
|
-
return n.syncExecuteCommand(
|
|
2181
|
-
unitId:
|
|
2177
|
+
}).filter((d) => d != null);
|
|
2178
|
+
return n.syncExecuteCommand(tt.id, {
|
|
2179
|
+
unitId: a,
|
|
2182
2180
|
drawings: l
|
|
2183
|
-
}) ? (n.syncExecuteCommand(W.id, [
|
|
2181
|
+
}) ? (n.syncExecuteCommand(W.id, [a]), !0) : !1;
|
|
2184
2182
|
}
|
|
2185
|
-
},
|
|
2183
|
+
}, Tn = "addition-and-subtraction-single", Pn = "sheet.menu.image";
|
|
2186
2184
|
function ds(i) {
|
|
2187
2185
|
return {
|
|
2188
|
-
id:
|
|
2189
|
-
type:
|
|
2190
|
-
icon:
|
|
2186
|
+
id: Pn,
|
|
2187
|
+
type: vt.SUBITEMS,
|
|
2188
|
+
icon: Tn,
|
|
2191
2189
|
tooltip: "sheetImage.title",
|
|
2192
|
-
hidden$:
|
|
2193
|
-
disabled$: jr(i, { workbookTypes: [
|
|
2190
|
+
hidden$: zt(i, F.UNIVER_SHEET),
|
|
2191
|
+
disabled$: jr(i, { workbookTypes: [ht], worksheetTypes: [$e], rangeTypes: [ci] })
|
|
2194
2192
|
};
|
|
2195
2193
|
}
|
|
2196
2194
|
function ls(i) {
|
|
2197
2195
|
return {
|
|
2198
|
-
id:
|
|
2196
|
+
id: It.id,
|
|
2199
2197
|
title: "sheetImage.upload.float",
|
|
2200
|
-
type:
|
|
2201
|
-
hidden$:
|
|
2198
|
+
type: vt.BUTTON,
|
|
2199
|
+
hidden$: zt(i, F.UNIVER_SHEET)
|
|
2202
2200
|
};
|
|
2203
2201
|
}
|
|
2204
2202
|
function us(i) {
|
|
2205
2203
|
return {
|
|
2206
|
-
id:
|
|
2204
|
+
id: Ct.id,
|
|
2207
2205
|
title: "sheetImage.upload.cell",
|
|
2208
|
-
type:
|
|
2206
|
+
type: vt.BUTTON
|
|
2209
2207
|
};
|
|
2210
2208
|
}
|
|
2211
|
-
const hs = "univer-image-common-panel", gs = "univer-image-common-panel-grid", ms = "univer-image-common-panel-border", fs = "univer-image-common-panel-title", ps = "univer-image-common-panel-subtitle", _s = "univer-image-common-panel-row", ws = "univer-image-common-panel-row-vertical", vs = "univer-image-common-panel-column", Ss = "univer-image-common-panel-column-center", Is = "univer-image-common-panel-inline", Cs = "univer-image-common-panel-span2", Rs = "univer-image-common-panel-span3", Ms = "univer-image-common-panel-input", bs = "univer-sheet-image-menu", Ds = "univer-sheet-image-menu-input",
|
|
2209
|
+
const hs = "univer-image-common-panel", gs = "univer-image-common-panel-grid", ms = "univer-image-common-panel-border", fs = "univer-image-common-panel-title", ps = "univer-image-common-panel-subtitle", _s = "univer-image-common-panel-row", ws = "univer-image-common-panel-row-vertical", vs = "univer-image-common-panel-column", Ss = "univer-image-common-panel-column-center", Is = "univer-image-common-panel-inline", Cs = "univer-image-common-panel-span2", Rs = "univer-image-common-panel-span3", Ms = "univer-image-common-panel-input", bs = "univer-sheet-image-menu", Ds = "univer-sheet-image-menu-input", ne = {
|
|
2212
2210
|
imageCommonPanel: hs,
|
|
2213
2211
|
imageCommonPanelGrid: gs,
|
|
2214
2212
|
imageCommonPanelBorder: ms,
|
|
@@ -2225,49 +2223,49 @@ const hs = "univer-image-common-panel", gs = "univer-image-common-panel-grid", m
|
|
|
2225
2223
|
sheetImageMenu: bs,
|
|
2226
2224
|
sheetImageMenuInput: Ds
|
|
2227
2225
|
};
|
|
2228
|
-
function
|
|
2226
|
+
function Un(i) {
|
|
2229
2227
|
var e, n, t = "";
|
|
2230
2228
|
if (typeof i == "string" || typeof i == "number") t += i;
|
|
2231
2229
|
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
2232
2230
|
var r = i.length;
|
|
2233
|
-
for (e = 0; e < r; e++) i[e] && (n =
|
|
2231
|
+
for (e = 0; e < r; e++) i[e] && (n = Un(i[e])) && (t && (t += " "), t += n);
|
|
2234
2232
|
} else for (n in i) i[n] && (t && (t += " "), t += n);
|
|
2235
2233
|
return t;
|
|
2236
2234
|
}
|
|
2237
|
-
function
|
|
2238
|
-
for (var i, e, n = 0, t = "", r = arguments.length; n < r; n++) (i = arguments[n]) && (e =
|
|
2235
|
+
function We() {
|
|
2236
|
+
for (var i, e, n = 0, t = "", r = arguments.length; n < r; n++) (i = arguments[n]) && (e = Un(i)) && (t && (t += " "), t += e);
|
|
2239
2237
|
return t;
|
|
2240
2238
|
}
|
|
2241
2239
|
const ys = (i) => {
|
|
2242
2240
|
var S;
|
|
2243
|
-
const e =
|
|
2241
|
+
const e = le(B), n = le(Je), t = le(Q), r = le(X), { drawings: s } = i, o = s[0];
|
|
2244
2242
|
if (o == null)
|
|
2245
2243
|
return;
|
|
2246
|
-
const { unitId:
|
|
2244
|
+
const { unitId: a } = o, l = r.getRenderById(a), g = l == null ? void 0 : l.scene;
|
|
2247
2245
|
if (g == null)
|
|
2248
2246
|
return;
|
|
2249
|
-
const
|
|
2250
|
-
function p(
|
|
2247
|
+
const d = g.getTransformerByCreate(), [c, h] = ft(!0), u = (S = o.anchorType) != null ? S : y.Position, [m, f] = ft(u);
|
|
2248
|
+
function p(M, w) {
|
|
2251
2249
|
const C = [];
|
|
2252
|
-
return
|
|
2250
|
+
return M.forEach((_) => {
|
|
2253
2251
|
const { oKey: T } = _, D = w.getDrawingOKey(T);
|
|
2254
2252
|
if (D == null)
|
|
2255
2253
|
return C.push(null), !0;
|
|
2256
|
-
const { unitId: N, subUnitId: A, drawingId: b, drawingType:
|
|
2254
|
+
const { unitId: N, subUnitId: A, drawingId: b, drawingType: R, anchorType: P, sheetTransform: x } = D;
|
|
2257
2255
|
C.push({
|
|
2258
2256
|
unitId: N,
|
|
2259
2257
|
subUnitId: A,
|
|
2260
2258
|
drawingId: b,
|
|
2261
2259
|
anchorType: P,
|
|
2262
2260
|
sheetTransform: x,
|
|
2263
|
-
drawingType:
|
|
2261
|
+
drawingType: R
|
|
2264
2262
|
});
|
|
2265
2263
|
}), C;
|
|
2266
2264
|
}
|
|
2267
|
-
|
|
2268
|
-
const
|
|
2265
|
+
St(() => {
|
|
2266
|
+
const M = d.clearControl$.subscribe((C) => {
|
|
2269
2267
|
C === !0 && h(!1);
|
|
2270
|
-
}), w =
|
|
2268
|
+
}), w = d.changeStart$.subscribe((C) => {
|
|
2271
2269
|
var D;
|
|
2272
2270
|
const { objects: _ } = C, T = p(_, t);
|
|
2273
2271
|
if (T.length === 0)
|
|
@@ -2279,11 +2277,11 @@ const ys = (i) => {
|
|
|
2279
2277
|
}
|
|
2280
2278
|
});
|
|
2281
2279
|
return () => {
|
|
2282
|
-
w.unsubscribe(),
|
|
2280
|
+
w.unsubscribe(), M.unsubscribe();
|
|
2283
2281
|
};
|
|
2284
2282
|
}, []);
|
|
2285
|
-
function v(
|
|
2286
|
-
f(
|
|
2283
|
+
function v(M) {
|
|
2284
|
+
f(M);
|
|
2287
2285
|
const w = t.getFocusDrawings();
|
|
2288
2286
|
if (w.length === 0)
|
|
2289
2287
|
return;
|
|
@@ -2291,134 +2289,134 @@ const ys = (i) => {
|
|
|
2291
2289
|
unitId: _.unitId,
|
|
2292
2290
|
subUnitId: _.subUnitId,
|
|
2293
2291
|
drawingId: _.drawingId,
|
|
2294
|
-
anchorType:
|
|
2292
|
+
anchorType: M
|
|
2295
2293
|
}));
|
|
2296
|
-
e.executeCommand(
|
|
2294
|
+
e.executeCommand(tt.id, {
|
|
2297
2295
|
unitId: w[0].unitId,
|
|
2298
2296
|
drawings: C
|
|
2299
2297
|
});
|
|
2300
2298
|
}
|
|
2301
|
-
const I = (
|
|
2302
|
-
return /* @__PURE__ */ $.jsxs("div", { className:
|
|
2303
|
-
/* @__PURE__ */ $.jsx("div", { className:
|
|
2304
|
-
/* @__PURE__ */ $.jsx("div", { className:
|
|
2305
|
-
/* @__PURE__ */ $.jsx(
|
|
2306
|
-
/* @__PURE__ */ $.jsx(
|
|
2307
|
-
/* @__PURE__ */ $.jsx(
|
|
2299
|
+
const I = (M) => M ? "block" : "none";
|
|
2300
|
+
return /* @__PURE__ */ $.jsxs("div", { className: We(ne.imageCommonPanelGrid, ne.imageCommonPanelBorder), style: { display: I(c) }, children: [
|
|
2301
|
+
/* @__PURE__ */ $.jsx("div", { className: ne.imageCommonPanelRow, children: /* @__PURE__ */ $.jsx("div", { className: We(ne.imageCommonPanelColumn, ne.imageCommonPanelTitle), children: /* @__PURE__ */ $.jsx("div", { children: n.t("drawing-anchor.title") }) }) }),
|
|
2302
|
+
/* @__PURE__ */ $.jsx("div", { className: We(ne.imageCommonPanelRow), children: /* @__PURE__ */ $.jsx("div", { className: We(ne.imageCommonPanelColumn), children: /* @__PURE__ */ $.jsxs(gi, { value: m, onChange: v, direction: "vertical", children: [
|
|
2303
|
+
/* @__PURE__ */ $.jsx(at, { value: y.Both, children: n.t("drawing-anchor.both") }),
|
|
2304
|
+
/* @__PURE__ */ $.jsx(at, { value: y.Position, children: n.t("drawing-anchor.position") }),
|
|
2305
|
+
/* @__PURE__ */ $.jsx(at, { value: y.None, children: n.t("drawing-anchor.none") })
|
|
2308
2306
|
] }) }) })
|
|
2309
2307
|
] });
|
|
2310
2308
|
}, Os = () => {
|
|
2311
|
-
const i =
|
|
2312
|
-
return
|
|
2309
|
+
const i = le(Q), e = i.getFocusDrawings(), [n, t] = ft(e);
|
|
2310
|
+
return St(() => {
|
|
2313
2311
|
const r = i.focus$.subscribe((s) => {
|
|
2314
2312
|
t(s);
|
|
2315
2313
|
});
|
|
2316
2314
|
return () => {
|
|
2317
2315
|
r.unsubscribe();
|
|
2318
2316
|
};
|
|
2319
|
-
}, []), !!(n != null && n.length) && /* @__PURE__ */ $.jsxs("div", { className:
|
|
2317
|
+
}, []), !!(n != null && n.length) && /* @__PURE__ */ $.jsxs("div", { className: ne.imageCommonPanel, children: [
|
|
2320
2318
|
/* @__PURE__ */ $.jsx(Sr, { drawings: n }),
|
|
2321
2319
|
/* @__PURE__ */ $.jsx(ys, { drawings: n })
|
|
2322
2320
|
] });
|
|
2323
2321
|
}, Es = {
|
|
2324
2322
|
[Fr.FORMULAS_INSERT]: {
|
|
2325
|
-
[
|
|
2323
|
+
[Pn]: {
|
|
2326
2324
|
order: 3,
|
|
2327
2325
|
menuItemFactory: ds,
|
|
2328
|
-
[
|
|
2326
|
+
[It.id]: {
|
|
2329
2327
|
order: 0,
|
|
2330
2328
|
menuItemFactory: ls
|
|
2331
2329
|
},
|
|
2332
|
-
[
|
|
2330
|
+
[Ct.id]: {
|
|
2333
2331
|
order: 1,
|
|
2334
2332
|
menuItemFactory: us
|
|
2335
2333
|
}
|
|
2336
2334
|
}
|
|
2337
2335
|
}
|
|
2338
2336
|
};
|
|
2339
|
-
function
|
|
2340
|
-
return !i.getContextValue(er) && !i.getContextValue(tr) && !i.getContextValue(nr) && i.getContextValue(
|
|
2337
|
+
function Me(i) {
|
|
2338
|
+
return !i.getContextValue(er) && !i.getContextValue(tr) && !i.getContextValue(nr) && i.getContextValue(ge);
|
|
2341
2339
|
}
|
|
2342
2340
|
const Ts = {
|
|
2343
|
-
id:
|
|
2341
|
+
id: Re.id,
|
|
2344
2342
|
description: "shortcut.sheet.drawing-move-down",
|
|
2345
2343
|
group: "4_sheet-drawing-view",
|
|
2346
|
-
binding:
|
|
2344
|
+
binding: me.ARROW_DOWN,
|
|
2347
2345
|
priority: 100,
|
|
2348
|
-
preconditions:
|
|
2346
|
+
preconditions: Me,
|
|
2349
2347
|
staticParameters: {
|
|
2350
|
-
direction:
|
|
2348
|
+
direction: re.DOWN
|
|
2351
2349
|
}
|
|
2352
2350
|
}, Ps = {
|
|
2353
|
-
id:
|
|
2351
|
+
id: Re.id,
|
|
2354
2352
|
description: "shortcut.sheet.drawing-move-up",
|
|
2355
2353
|
group: "4_sheet-drawing-view",
|
|
2356
|
-
binding:
|
|
2354
|
+
binding: me.ARROW_UP,
|
|
2357
2355
|
priority: 100,
|
|
2358
|
-
preconditions:
|
|
2356
|
+
preconditions: Me,
|
|
2359
2357
|
staticParameters: {
|
|
2360
|
-
direction:
|
|
2358
|
+
direction: re.UP
|
|
2361
2359
|
}
|
|
2362
2360
|
}, Us = {
|
|
2363
|
-
id:
|
|
2361
|
+
id: Re.id,
|
|
2364
2362
|
description: "shortcut.sheet.drawing-move-left",
|
|
2365
2363
|
group: "4_sheet-drawing-view",
|
|
2366
|
-
binding:
|
|
2364
|
+
binding: me.ARROW_LEFT,
|
|
2367
2365
|
priority: 100,
|
|
2368
|
-
preconditions:
|
|
2366
|
+
preconditions: Me,
|
|
2369
2367
|
staticParameters: {
|
|
2370
|
-
direction:
|
|
2368
|
+
direction: re.LEFT
|
|
2371
2369
|
}
|
|
2372
2370
|
}, As = {
|
|
2373
|
-
id:
|
|
2371
|
+
id: Re.id,
|
|
2374
2372
|
description: "shortcut.sheet.drawing-move-right",
|
|
2375
2373
|
group: "4_sheet-drawing-view",
|
|
2376
|
-
binding:
|
|
2374
|
+
binding: me.ARROW_RIGHT,
|
|
2377
2375
|
priority: 100,
|
|
2378
|
-
preconditions:
|
|
2376
|
+
preconditions: Me,
|
|
2379
2377
|
staticParameters: {
|
|
2380
|
-
direction:
|
|
2378
|
+
direction: re.RIGHT
|
|
2381
2379
|
}
|
|
2382
2380
|
}, Ns = {
|
|
2383
|
-
id:
|
|
2381
|
+
id: En.id,
|
|
2384
2382
|
description: "shortcut.sheet.drawing-delete",
|
|
2385
2383
|
group: "4_sheet-drawing-view",
|
|
2386
2384
|
// when focusing on any other input tag do not trigger this shortcut
|
|
2387
|
-
preconditions:
|
|
2388
|
-
binding:
|
|
2389
|
-
mac:
|
|
2385
|
+
preconditions: Me,
|
|
2386
|
+
binding: me.DELETE,
|
|
2387
|
+
mac: me.BACKSPACE
|
|
2390
2388
|
};
|
|
2391
2389
|
var js = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, xs = (i, e, n, t) => {
|
|
2392
2390
|
for (var r = t > 1 ? void 0 : t ? Ws(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2393
2391
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2394
2392
|
return t && r && js(e, n, r), r;
|
|
2395
|
-
},
|
|
2396
|
-
let
|
|
2393
|
+
}, xe = (i, e) => (n, t) => e(n, t, i);
|
|
2394
|
+
let Xe = class extends q {
|
|
2397
2395
|
constructor(i, e, n, t) {
|
|
2398
2396
|
super(), this._componentManager = i, this._menuManagerService = e, this._commandService = n, this._shortcutService = t, this._init();
|
|
2399
2397
|
}
|
|
2400
2398
|
_initCustomComponents() {
|
|
2401
2399
|
const i = this._componentManager;
|
|
2402
|
-
this.disposeWithMe(i.register(
|
|
2400
|
+
this.disposeWithMe(i.register(Tn, On)), this.disposeWithMe(i.register(vn, Os));
|
|
2403
2401
|
}
|
|
2404
2402
|
_initMenus() {
|
|
2405
2403
|
this._menuManagerService.mergeMenu(Es);
|
|
2406
2404
|
}
|
|
2407
2405
|
_initCommands() {
|
|
2408
2406
|
[
|
|
2409
|
-
St,
|
|
2410
2407
|
It,
|
|
2411
|
-
|
|
2412
|
-
Ze,
|
|
2408
|
+
Ct,
|
|
2413
2409
|
et,
|
|
2414
|
-
|
|
2415
|
-
|
|
2410
|
+
Qe,
|
|
2411
|
+
tt,
|
|
2416
2412
|
Sn,
|
|
2413
|
+
W,
|
|
2417
2414
|
In,
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2415
|
+
Cn,
|
|
2416
|
+
Mn,
|
|
2417
|
+
Re,
|
|
2418
|
+
En,
|
|
2419
|
+
Rn
|
|
2422
2420
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
2423
2421
|
}
|
|
2424
2422
|
_initShortcuts() {
|
|
@@ -2437,85 +2435,85 @@ let Ye = class extends q {
|
|
|
2437
2435
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
2438
2436
|
}
|
|
2439
2437
|
};
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
],
|
|
2438
|
+
Xe = xs([
|
|
2439
|
+
xe(0, U(Vr)),
|
|
2440
|
+
xe(1, kr),
|
|
2441
|
+
xe(2, B),
|
|
2442
|
+
xe(3, Hr)
|
|
2443
|
+
], Xe);
|
|
2446
2444
|
var $s = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, Ls = (i, e, n, t) => {
|
|
2447
2445
|
for (var r = t > 1 ? void 0 : t ? Bs(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2448
2446
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2449
2447
|
return t && r && $s(e, n, r), r;
|
|
2450
|
-
},
|
|
2448
|
+
}, de = (i, e) => (n, t) => e(n, t, i);
|
|
2451
2449
|
function Gs(i, e, n, t) {
|
|
2452
|
-
const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(
|
|
2450
|
+
const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(Yt.VIEW_MAIN), a = {
|
|
2453
2451
|
left: !0,
|
|
2454
2452
|
top: !0
|
|
2455
2453
|
};
|
|
2456
2454
|
if (!o)
|
|
2457
2455
|
return {
|
|
2458
2456
|
...i,
|
|
2459
|
-
absolute:
|
|
2457
|
+
absolute: a
|
|
2460
2458
|
};
|
|
2461
|
-
const { left: l, right: g, top:
|
|
2459
|
+
const { left: l, right: g, top: d, bottom: c } = i, h = t.getFreeze(), { startColumn: u, startRow: m, xSplit: f, ySplit: p } = h, v = n.getNoMergeCellPositionByIndexWithNoHeader(m - p, u - f), I = n.getNoMergeCellPositionByIndexWithNoHeader(m, u), { rowHeaderWidth: S, columnHeaderHeight: M } = n, w = I.startX - v.startX, C = I.startY - v.startY, { top: _, left: T, viewportScrollX: D, viewportScrollY: N } = o;
|
|
2462
2460
|
let A, b;
|
|
2463
|
-
l < T ? (
|
|
2461
|
+
l < T ? (a.left = !0, A = (w + S + (l - T)) * r, b = Math.max(
|
|
2464
2462
|
Math.min(
|
|
2465
2463
|
(w + S + (g - T)) * r,
|
|
2466
2464
|
(w + S) * r
|
|
2467
2465
|
),
|
|
2468
2466
|
(g - D) * r
|
|
2469
|
-
)) : (
|
|
2470
|
-
let
|
|
2471
|
-
return
|
|
2467
|
+
)) : (a.left = !1, A = Math.max((l - D) * r, (w + S) * r), b = Math.max((g - D) * r, (w + S) * r));
|
|
2468
|
+
let R, P;
|
|
2469
|
+
return d < _ ? (a.top = !0, R = (C + M + (d - _)) * s, P = Math.max(
|
|
2472
2470
|
Math.min(
|
|
2473
|
-
(C +
|
|
2474
|
-
(C +
|
|
2471
|
+
(C + M + (g - _)) * s,
|
|
2472
|
+
(C + M) * s
|
|
2475
2473
|
),
|
|
2476
|
-
(
|
|
2477
|
-
)) : (
|
|
2474
|
+
(c - N) * s
|
|
2475
|
+
)) : (a.top = !1, R = Math.max((d - N) * s, (C + M) * s), P = Math.max((c - N) * s, (C + M) * s)), {
|
|
2478
2476
|
left: A,
|
|
2479
2477
|
right: b,
|
|
2480
|
-
top:
|
|
2478
|
+
top: R,
|
|
2481
2479
|
bottom: P,
|
|
2482
|
-
absolute:
|
|
2480
|
+
absolute: a
|
|
2483
2481
|
};
|
|
2484
2482
|
}
|
|
2485
|
-
const
|
|
2486
|
-
const { scene: r } = e, { left: s, top: o, width:
|
|
2483
|
+
const lt = (i, e, n, t) => {
|
|
2484
|
+
const { scene: r } = e, { left: s, top: o, width: a, height: l, angle: g } = i, d = {
|
|
2487
2485
|
left: s,
|
|
2488
|
-
right: s +
|
|
2486
|
+
right: s + a,
|
|
2489
2487
|
top: o,
|
|
2490
2488
|
bottom: o + l
|
|
2491
|
-
},
|
|
2489
|
+
}, c = Gs(d, r, n, t), { scaleX: h, scaleY: u } = r.getAncestorScale();
|
|
2492
2490
|
return {
|
|
2493
|
-
startX:
|
|
2494
|
-
endX:
|
|
2495
|
-
startY:
|
|
2496
|
-
endY:
|
|
2491
|
+
startX: c.left,
|
|
2492
|
+
endX: c.right,
|
|
2493
|
+
startY: c.top,
|
|
2494
|
+
endY: c.bottom,
|
|
2497
2495
|
rotate: g,
|
|
2498
|
-
width:
|
|
2496
|
+
width: a * h,
|
|
2499
2497
|
height: l * u,
|
|
2500
|
-
absolute:
|
|
2498
|
+
absolute: c.absolute
|
|
2501
2499
|
};
|
|
2502
2500
|
};
|
|
2503
|
-
let
|
|
2504
|
-
constructor(e, n, t, r, s, o,
|
|
2501
|
+
let ze = class extends q {
|
|
2502
|
+
constructor(e, n, t, r, s, o, a) {
|
|
2505
2503
|
super();
|
|
2506
2504
|
V(this, "_domLayerMap", /* @__PURE__ */ new Map());
|
|
2507
2505
|
V(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
|
|
2508
|
-
V(this, "_transformChange$", new
|
|
2506
|
+
V(this, "_transformChange$", new st());
|
|
2509
2507
|
V(this, "transformChange$", this._transformChange$.asObservable());
|
|
2510
|
-
V(this, "_add$", new
|
|
2508
|
+
V(this, "_add$", new st());
|
|
2511
2509
|
V(this, "add$", this._add$.asObservable());
|
|
2512
|
-
V(this, "_remove$", new
|
|
2510
|
+
V(this, "_remove$", new st());
|
|
2513
2511
|
V(this, "remove$", this._remove$.asObservable());
|
|
2514
2512
|
V(this, "_hooks", []);
|
|
2515
|
-
this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService =
|
|
2513
|
+
this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = a, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
|
|
2516
2514
|
}
|
|
2517
2515
|
_bindScrollEvent() {
|
|
2518
|
-
this._lifecycleService.lifecycle$.pipe(
|
|
2516
|
+
this._lifecycleService.lifecycle$.pipe(ie((e) => e === ir.Rendered), Xr(1)).subscribe(() => {
|
|
2519
2517
|
this._scrollUpdateListener();
|
|
2520
2518
|
});
|
|
2521
2519
|
}
|
|
@@ -2549,56 +2547,56 @@ let Xe = class extends q {
|
|
|
2549
2547
|
// eslint-disable-next-line max-lines-per-function
|
|
2550
2548
|
this._drawingManagerService.add$.subscribe((e) => {
|
|
2551
2549
|
e.forEach((n) => {
|
|
2552
|
-
var
|
|
2553
|
-
const { unitId: t, subUnitId: r, drawingId: s } = n, o = H(this._univerInstanceService, { unitId: t, subUnitId: r }),
|
|
2550
|
+
var Mt, bt, Dt;
|
|
2551
|
+
const { unitId: t, subUnitId: r, drawingId: s } = n, o = H(this._univerInstanceService, { unitId: t, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(n), l = this._univerInstanceService.getUnit(t, F.UNIVER_SHEET);
|
|
2554
2552
|
if (!l)
|
|
2555
2553
|
return;
|
|
2556
2554
|
const g = l.getActiveSheet().getSheetId();
|
|
2557
|
-
if (!
|
|
2555
|
+
if (!a || !o)
|
|
2558
2556
|
return;
|
|
2559
|
-
const
|
|
2560
|
-
if (!
|
|
2557
|
+
const d = (Mt = this._renderManagerService.getRenderById(t)) == null ? void 0 : Mt.with(Z).getWorksheetSkeleton(r);
|
|
2558
|
+
if (!d)
|
|
2561
2559
|
return;
|
|
2562
|
-
const { transform:
|
|
2560
|
+
const { transform: c, drawingType: h, data: u } = a;
|
|
2563
2561
|
if (h !== k.DRAWING_DOM && h !== k.DRAWING_CHART)
|
|
2564
2562
|
return;
|
|
2565
2563
|
const m = this._getSceneAndTransformerByDrawingSearch(t);
|
|
2566
2564
|
if (m == null)
|
|
2567
2565
|
return;
|
|
2568
2566
|
const { scene: f, canvas: p } = m;
|
|
2569
|
-
if (
|
|
2567
|
+
if (c == null)
|
|
2570
2568
|
return !0;
|
|
2571
2569
|
if (g !== r)
|
|
2572
2570
|
return;
|
|
2573
|
-
const { left: v, top: I, width: S, height:
|
|
2571
|
+
const { left: v, top: I, width: S, height: M, angle: w, flipX: C, flipY: _, skewX: T, skewY: D } = c, N = it({ unitId: t, subUnitId: r, drawingId: s }), A = f.getObject(N);
|
|
2574
2572
|
if (A != null) {
|
|
2575
|
-
A.transformByState({ left: v, top: I, width: S, height:
|
|
2573
|
+
A.transformByState({ left: v, top: I, width: S, height: M, angle: w, flipX: C, flipY: _, skewX: T, skewY: D });
|
|
2576
2574
|
return;
|
|
2577
2575
|
}
|
|
2578
2576
|
const b = {
|
|
2579
2577
|
left: v,
|
|
2580
2578
|
top: I,
|
|
2581
2579
|
width: S,
|
|
2582
|
-
height:
|
|
2580
|
+
height: M,
|
|
2583
2581
|
zIndex: this._drawingManagerService.getDrawingOrder(t, r).length - 1
|
|
2584
|
-
},
|
|
2585
|
-
if (
|
|
2582
|
+
}, R = h === k.DRAWING_CHART;
|
|
2583
|
+
if (R) {
|
|
2586
2584
|
const G = u ? u.backgroundColor : "white";
|
|
2587
2585
|
b.fill = G, b.rotateEnabled = !1, u && u.border && (b.stroke = u.border), b.paintFirst = "stroke", b.strokeWidth = 1, b.borderEnabled = !1, b.radius = 8;
|
|
2588
2586
|
}
|
|
2589
|
-
const P = new
|
|
2590
|
-
|
|
2591
|
-
const x = this._ensureMap(t, r),
|
|
2592
|
-
dispose:
|
|
2587
|
+
const P = new At(N, b);
|
|
2588
|
+
R && P.setObjectType(Mr.CHART), f.addObject(P, br), a.allowTransform !== !1 && f.attachTransformerTo(P);
|
|
2589
|
+
const x = this._ensureMap(t, r), se = new sr(), oe = lt(P, m.renderObject, d.skeleton, o.worksheet), nt = new zr(oe), jn = {
|
|
2590
|
+
dispose: se,
|
|
2593
2591
|
rect: P,
|
|
2594
|
-
position$:
|
|
2592
|
+
position$: nt,
|
|
2595
2593
|
unitId: t,
|
|
2596
2594
|
subUnitId: r
|
|
2597
2595
|
};
|
|
2598
2596
|
this._canvasFloatDomService.addFloatDom({
|
|
2599
|
-
position$:
|
|
2597
|
+
position$: nt,
|
|
2600
2598
|
id: s,
|
|
2601
|
-
componentKey:
|
|
2599
|
+
componentKey: a.componentKey,
|
|
2602
2600
|
onPointerDown: (G) => {
|
|
2603
2601
|
p.dispatchEvent(new PointerEvent(G.type, G));
|
|
2604
2602
|
},
|
|
@@ -2611,19 +2609,19 @@ let Xe = class extends q {
|
|
|
2611
2609
|
onWheel: (G) => {
|
|
2612
2610
|
p.dispatchEvent(new WheelEvent(G.type, G));
|
|
2613
2611
|
},
|
|
2614
|
-
props: (
|
|
2612
|
+
props: (Dt = (bt = x.get(s)) == null ? void 0 : bt.props) != null ? Dt : this._getFloatDomProps(s),
|
|
2615
2613
|
data: u,
|
|
2616
2614
|
unitId: t
|
|
2617
2615
|
});
|
|
2618
|
-
const
|
|
2619
|
-
const G =
|
|
2620
|
-
|
|
2616
|
+
const Rt = P.onTransformChange$.subscribeEvent(() => {
|
|
2617
|
+
const G = lt(P, m.renderObject, d.skeleton, o.worksheet);
|
|
2618
|
+
nt.next(
|
|
2621
2619
|
G
|
|
2622
2620
|
);
|
|
2623
2621
|
});
|
|
2624
|
-
|
|
2622
|
+
se.add(() => {
|
|
2625
2623
|
this._canvasFloatDomService.removeFloatDom(s);
|
|
2626
|
-
}),
|
|
2624
|
+
}), Rt && se.add(Rt), this._domLayerInfoMap.set(s, jn), x.set(s, {
|
|
2627
2625
|
...x.get(s)
|
|
2628
2626
|
});
|
|
2629
2627
|
});
|
|
@@ -2631,11 +2629,11 @@ let Xe = class extends q {
|
|
|
2631
2629
|
), this.disposeWithMe(
|
|
2632
2630
|
this._drawingManagerService.remove$.subscribe((e) => {
|
|
2633
2631
|
e.forEach((n) => {
|
|
2634
|
-
const { unitId: t, subUnitId: r, drawingId: s } = n, o =
|
|
2635
|
-
if (
|
|
2632
|
+
const { unitId: t, subUnitId: r, drawingId: s } = n, o = it({ unitId: t, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(t);
|
|
2633
|
+
if (a == null)
|
|
2636
2634
|
return;
|
|
2637
|
-
const { transformer: l, scene: g } =
|
|
2638
|
-
|
|
2635
|
+
const { transformer: l, scene: g } = a, d = g.getObject(o);
|
|
2636
|
+
d != null && d.oKey && l.clearControlByIds([d == null ? void 0 : d.oKey]);
|
|
2639
2637
|
});
|
|
2640
2638
|
})
|
|
2641
2639
|
);
|
|
@@ -2643,27 +2641,27 @@ let Xe = class extends q {
|
|
|
2643
2641
|
_scrollUpdateListener() {
|
|
2644
2642
|
const e = (n, t) => {
|
|
2645
2643
|
var g;
|
|
2646
|
-
const r = this._getSceneAndTransformerByDrawingSearch(n), s = this._ensureMap(n, t), o = Array.from(s.keys()),
|
|
2647
|
-
!r || !
|
|
2648
|
-
const
|
|
2649
|
-
if (
|
|
2650
|
-
const h =
|
|
2651
|
-
|
|
2644
|
+
const r = this._getSceneAndTransformerByDrawingSearch(n), s = this._ensureMap(n, t), o = Array.from(s.keys()), a = H(this._univerInstanceService, { unitId: n, subUnitId: t }), l = (g = this._renderManagerService.getRenderById(n)) == null ? void 0 : g.with(Z).getWorksheetSkeleton(t);
|
|
2645
|
+
!r || !a || !l || o.forEach((d) => {
|
|
2646
|
+
const c = this._domLayerInfoMap.get(d);
|
|
2647
|
+
if (c) {
|
|
2648
|
+
const h = lt(c.rect, r.renderObject, l.skeleton, a.worksheet);
|
|
2649
|
+
c.position$.next(h);
|
|
2652
2650
|
}
|
|
2653
2651
|
});
|
|
2654
2652
|
};
|
|
2655
2653
|
this.disposeWithMe(
|
|
2656
2654
|
this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2655
|
+
ie((n) => !!n),
|
|
2656
|
+
Wt((n) => n.activeSheet$),
|
|
2657
|
+
ie((n) => !!n),
|
|
2658
|
+
Be((n) => {
|
|
2661
2659
|
const t = this._renderManagerService.getRenderById(n.getUnitId());
|
|
2662
2660
|
return t ? { render: t, unitId: n.getUnitId(), subUnitId: n.getSheetId() } : null;
|
|
2663
2661
|
}),
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
(n) => or(n.render.scene.getViewport(
|
|
2662
|
+
ie((n) => !!n),
|
|
2663
|
+
Wt(
|
|
2664
|
+
(n) => or(n.render.scene.getViewport(Yt.VIEW_MAIN).onScrollAfter$).pipe(Be(() => ({ unitId: n.unitId, subUnitId: n.subUnitId })))
|
|
2667
2665
|
)
|
|
2668
2666
|
).subscribe(({ unitId: n, subUnitId: t }) => {
|
|
2669
2667
|
e(n, t);
|
|
@@ -2683,10 +2681,10 @@ let Xe = class extends q {
|
|
|
2683
2681
|
}
|
|
2684
2682
|
_getPosition(e, n) {
|
|
2685
2683
|
var h;
|
|
2686
|
-
const { startX: t, endX: r, startY: s, endY: o } = e,
|
|
2687
|
-
if (
|
|
2684
|
+
const { startX: t, endX: r, startY: s, endY: o } = e, a = (h = this._renderManagerService.getRenderById(n)) == null ? void 0 : h.with(Ce);
|
|
2685
|
+
if (a == null)
|
|
2688
2686
|
return;
|
|
2689
|
-
const l =
|
|
2687
|
+
const l = a.getCellWithCoordByOffset(t, s);
|
|
2690
2688
|
if (l == null)
|
|
2691
2689
|
return;
|
|
2692
2690
|
const g = {
|
|
@@ -2694,18 +2692,18 @@ let Xe = class extends q {
|
|
|
2694
2692
|
columnOffset: t - l.startX,
|
|
2695
2693
|
row: l.actualRow,
|
|
2696
2694
|
rowOffset: s - l.startY
|
|
2697
|
-
},
|
|
2698
|
-
if (
|
|
2695
|
+
}, d = a.getCellWithCoordByOffset(r, o);
|
|
2696
|
+
if (d == null)
|
|
2699
2697
|
return;
|
|
2700
|
-
const
|
|
2701
|
-
column:
|
|
2702
|
-
columnOffset: r -
|
|
2703
|
-
row:
|
|
2704
|
-
rowOffset: o -
|
|
2698
|
+
const c = {
|
|
2699
|
+
column: d.actualColumn,
|
|
2700
|
+
columnOffset: r - d.startX,
|
|
2701
|
+
row: d.actualRow,
|
|
2702
|
+
rowOffset: o - d.startY
|
|
2705
2703
|
};
|
|
2706
2704
|
return {
|
|
2707
2705
|
from: g,
|
|
2708
|
-
to:
|
|
2706
|
+
to: c
|
|
2709
2707
|
};
|
|
2710
2708
|
}
|
|
2711
2709
|
_featureUpdateListener() {
|
|
@@ -2735,8 +2733,8 @@ let Xe = class extends q {
|
|
|
2735
2733
|
updateFloatDomProps(e, n, t, r) {
|
|
2736
2734
|
const s = this._domLayerInfoMap.get(t), o = this._getSceneAndTransformerByDrawingSearch(e);
|
|
2737
2735
|
if (s && o) {
|
|
2738
|
-
const { scene:
|
|
2739
|
-
g && g instanceof
|
|
2736
|
+
const { scene: a } = o, l = it({ unitId: e, subUnitId: n, drawingId: t }), g = a.getObject(l);
|
|
2737
|
+
g && g instanceof At && g.setProps(r);
|
|
2740
2738
|
}
|
|
2741
2739
|
}
|
|
2742
2740
|
addFloatDomToPosition(e, n) {
|
|
@@ -2746,17 +2744,17 @@ let Xe = class extends q {
|
|
|
2746
2744
|
});
|
|
2747
2745
|
if (!t)
|
|
2748
2746
|
throw new Error("cannot find current target!");
|
|
2749
|
-
const { unitId: r, subUnitId: s } = t, { initPosition: o, componentKey:
|
|
2750
|
-
if (
|
|
2747
|
+
const { unitId: r, subUnitId: s } = t, { initPosition: o, componentKey: a, data: l, allowTransform: g = !0 } = e, d = n != null ? n : ar(), c = this._getPosition(o, r);
|
|
2748
|
+
if (c == null)
|
|
2751
2749
|
return;
|
|
2752
|
-
this._ensureMap(r, s).set(
|
|
2750
|
+
this._ensureMap(r, s).set(d, e);
|
|
2753
2751
|
const u = {
|
|
2754
2752
|
unitId: r,
|
|
2755
2753
|
subUnitId: s,
|
|
2756
|
-
drawingId:
|
|
2754
|
+
drawingId: d,
|
|
2757
2755
|
drawingType: e.type || k.DRAWING_DOM,
|
|
2758
|
-
componentKey:
|
|
2759
|
-
sheetTransform:
|
|
2756
|
+
componentKey: a,
|
|
2757
|
+
sheetTransform: c,
|
|
2760
2758
|
transform: {
|
|
2761
2759
|
left: o.startX,
|
|
2762
2760
|
top: o.startY,
|
|
@@ -2766,13 +2764,13 @@ let Xe = class extends q {
|
|
|
2766
2764
|
data: l,
|
|
2767
2765
|
allowTransform: g
|
|
2768
2766
|
};
|
|
2769
|
-
return this._commandService.executeCommand(
|
|
2767
|
+
return this._commandService.executeCommand(et.id, {
|
|
2770
2768
|
unitId: r,
|
|
2771
2769
|
drawings: [u]
|
|
2772
|
-
}), this._add$.next({ unitId: r, subUnitId: s, id:
|
|
2773
|
-
id:
|
|
2770
|
+
}), this._add$.next({ unitId: r, subUnitId: s, id: d }), {
|
|
2771
|
+
id: d,
|
|
2774
2772
|
dispose: () => {
|
|
2775
|
-
this._removeDom(
|
|
2773
|
+
this._removeDom(d, !0);
|
|
2776
2774
|
}
|
|
2777
2775
|
};
|
|
2778
2776
|
}
|
|
@@ -2788,8 +2786,8 @@ let Xe = class extends q {
|
|
|
2788
2786
|
const l = this._drawingManagerService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: e });
|
|
2789
2787
|
if (!l)
|
|
2790
2788
|
return;
|
|
2791
|
-
const g = this._sheetDrawingService.getBatchRemoveOp([l]), { redo:
|
|
2792
|
-
this._commandService.syncExecuteCommand(O.id, { unitId: r, subUnitId: s, op:
|
|
2789
|
+
const g = this._sheetDrawingService.getBatchRemoveOp([l]), { redo: d, objects: c } = g;
|
|
2790
|
+
this._commandService.syncExecuteCommand(O.id, { unitId: r, subUnitId: s, op: d, objects: c, type: E.REMOVE });
|
|
2793
2791
|
}
|
|
2794
2792
|
}
|
|
2795
2793
|
addHook(e) {
|
|
@@ -2801,96 +2799,96 @@ let Xe = class extends q {
|
|
|
2801
2799
|
};
|
|
2802
2800
|
}
|
|
2803
2801
|
};
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
],
|
|
2813
|
-
var
|
|
2802
|
+
ze = Ls([
|
|
2803
|
+
de(0, U(X)),
|
|
2804
|
+
de(1, pe),
|
|
2805
|
+
de(2, U(B)),
|
|
2806
|
+
de(3, Q),
|
|
2807
|
+
de(4, U(Yr)),
|
|
2808
|
+
de(5, z),
|
|
2809
|
+
de(6, U(rr))
|
|
2810
|
+
], ze);
|
|
2811
|
+
var An = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, Vs = (i, e, n) => e in i ? An(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, ks = (i, e, n, t) => {
|
|
2814
2812
|
for (var r = t > 1 ? void 0 : t ? Fs(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2815
2813
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2816
|
-
return t && r &&
|
|
2817
|
-
},
|
|
2814
|
+
return t && r && An(e, n, r), r;
|
|
2815
|
+
}, ut = (i, e) => (n, t) => e(n, t, i), Nn = (i, e, n) => Vs(i, typeof e != "symbol" ? e + "" : e, n);
|
|
2818
2816
|
const Hs = "SHEET_IMAGE_UI_PLUGIN";
|
|
2819
|
-
let
|
|
2820
|
-
constructor(i =
|
|
2817
|
+
let Ke = class extends dr {
|
|
2818
|
+
constructor(i = $t, e, n, t) {
|
|
2821
2819
|
super(), this._config = i, this._injector = e, this._renderManagerService = n, this._configService = t;
|
|
2822
2820
|
const { menu: r, ...s } = lr(
|
|
2823
2821
|
{},
|
|
2824
|
-
|
|
2822
|
+
$t,
|
|
2825
2823
|
this._config
|
|
2826
2824
|
);
|
|
2827
2825
|
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(mi, s);
|
|
2828
2826
|
}
|
|
2829
2827
|
onStarting() {
|
|
2830
2828
|
ur(this._injector, [
|
|
2829
|
+
[ze],
|
|
2831
2830
|
[Xe],
|
|
2831
|
+
[Le],
|
|
2832
2832
|
[Ye],
|
|
2833
|
-
[Be],
|
|
2834
2833
|
[He],
|
|
2835
2834
|
[ke],
|
|
2835
|
+
[Ge],
|
|
2836
2836
|
[Ve],
|
|
2837
|
-
[
|
|
2838
|
-
|
|
2839
|
-
[
|
|
2840
|
-
]), nt(this._injector, [
|
|
2841
|
-
[Xe]
|
|
2837
|
+
[Fe]
|
|
2838
|
+
]), rt(this._injector, [
|
|
2839
|
+
[ze]
|
|
2842
2840
|
]);
|
|
2843
2841
|
}
|
|
2844
2842
|
onReady() {
|
|
2845
|
-
|
|
2846
|
-
[
|
|
2843
|
+
rt(this._injector, [
|
|
2844
|
+
[ke]
|
|
2847
2845
|
]);
|
|
2848
2846
|
}
|
|
2849
2847
|
onRendered() {
|
|
2850
|
-
this._registerRenderModules(),
|
|
2851
|
-
[ke],
|
|
2848
|
+
this._registerRenderModules(), rt(this._injector, [
|
|
2852
2849
|
[He],
|
|
2853
2850
|
[Ye],
|
|
2854
|
-
[
|
|
2855
|
-
[
|
|
2856
|
-
[
|
|
2851
|
+
[Xe],
|
|
2852
|
+
[Ge],
|
|
2853
|
+
[Ve],
|
|
2854
|
+
[Fe]
|
|
2857
2855
|
]);
|
|
2858
2856
|
}
|
|
2859
2857
|
onSteady() {
|
|
2860
|
-
this._injector.get(
|
|
2858
|
+
this._injector.get(Le);
|
|
2861
2859
|
}
|
|
2862
2860
|
_registerRenderModules() {
|
|
2863
2861
|
[
|
|
2864
|
-
[
|
|
2865
|
-
[
|
|
2866
|
-
[
|
|
2862
|
+
[Se],
|
|
2863
|
+
[wt],
|
|
2864
|
+
[pt]
|
|
2867
2865
|
].forEach((i) => {
|
|
2868
2866
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(F.UNIVER_SHEET, i));
|
|
2869
2867
|
});
|
|
2870
2868
|
}
|
|
2871
2869
|
};
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2870
|
+
Nn(Ke, "type", F.UNIVER_SHEET);
|
|
2871
|
+
Nn(Ke, "pluginName", Hs);
|
|
2872
|
+
Ke = ks([
|
|
2875
2873
|
cr(fr, mr, Ir, Dr),
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
],
|
|
2874
|
+
ut(1, U(Ie)),
|
|
2875
|
+
ut(2, X),
|
|
2876
|
+
ut(3, hr)
|
|
2877
|
+
], Ke);
|
|
2880
2878
|
export {
|
|
2881
2879
|
W as ClearSheetDrawingTransformerOperation,
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2880
|
+
En as DeleteDrawingsCommand,
|
|
2881
|
+
In as EditSheetDrawingOperation,
|
|
2882
|
+
Cn as GroupSheetDrawingCommand,
|
|
2883
|
+
It as InsertFloatImageCommand,
|
|
2884
|
+
et as InsertSheetDrawingCommand,
|
|
2885
|
+
Re as MoveDrawingsCommand,
|
|
2886
|
+
Qe as RemoveSheetDrawingCommand,
|
|
2887
|
+
Pn as SHEETS_IMAGE_MENU_ID,
|
|
2888
|
+
Rn as SetDrawingArrangeCommand,
|
|
2889
|
+
tt as SetSheetDrawingCommand,
|
|
2890
|
+
ze as SheetCanvasFloatDomManagerService,
|
|
2891
|
+
Sn as SidebarSheetDrawingOperation,
|
|
2892
|
+
Mn as UngroupSheetDrawingCommand,
|
|
2893
|
+
Ke as UniverSheetsDrawingUIPlugin
|
|
2896
2894
|
};
|