@univerjs/sheets-drawing-ui 0.5.4-nightly.202501170612 → 0.5.4-nightly.202501171606
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +1379 -1347
- package/lib/types/facade/f-worksheet.d.ts +6 -9
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +10 -4
- package/lib/umd/index.js +2 -2
- package/package.json +12 -12
package/lib/es/index.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as
|
|
5
|
-
import { DocDrawingController as
|
|
6
|
-
import { SetDrawingSelectedOperation as
|
|
7
|
-
import { ImageCropperObject as
|
|
8
|
-
import { IRenderManagerService as
|
|
9
|
-
import { ISheetDrawingService as
|
|
10
|
-
import { SheetCanvasPopManagerService as
|
|
11
|
-
import { ISidebarService as
|
|
12
|
-
import { takeUntil as
|
|
13
|
-
import { SheetInterceptorService as
|
|
14
|
-
import
|
|
15
|
-
import { docDrawingPositionToTransform as
|
|
16
|
-
import { MessageType as
|
|
17
|
-
const
|
|
1
|
+
var vr = Object.defineProperty;
|
|
2
|
+
var Sr = (i, e, n) => e in i ? vr(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
|
+
var J = (i, e, n) => Sr(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { CommandType as q, ICommandService as H, IUndoRedoService as Be, sequenceExecute as Mn, LocaleService as Pt, IUniverInstanceService as $e, useDependency as Ee, Inject as N, Injector as qe, IContextService as yn, RxDisposable as Ir, UniverInstanceType as Y, connectInjector as Cr, toDisposable as Rr, FOCUSING_COMMON_DRAWINGS as We, DrawingTypeEnum as L, Disposable as ie, ArrangeTypeEnum as st, createDocumentModelWithStyle as br, ObjectRelativeFromH as Dr, ObjectRelativeFromV as Mr, BooleanNumber as yr, PositionedObjectLayoutType as Or, WrapTextType as Tr, BuildTextUtils as Er, Range as Pr, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as ot, DOCS_ZEN_EDITOR_UNIT_ID_KEY as at, InterceptorEffectEnum as Ur, ObjectMatrix as Ar, Tools as Pe, UserManagerService as Nr, IPermissionService as jr, Rectangle as Wr, Direction as _e, FOCUSING_FX_BAR_EDITOR as xr, EDITOR_ACTIVATED as Br, FOCUSING_PANEL_EDITOR as $r, LifecycleService as kr, LifecycleStages as Lr, DisposableCollection as ct, fromEventSubject as Fr, generateRandomId as Gt, DependentOn as Gr, Plugin as Vr, merge as Yr, registerDependencies as Hr, touchDependencies as Vt, IConfigService as Xr } from "@univerjs/core";
|
|
5
|
+
import { DocDrawingController as zr, UniverDocsDrawingPlugin as Kr } from "@univerjs/docs-drawing";
|
|
6
|
+
import { SetDrawingSelectedOperation as Ut, IImageIoService as On, IDrawingManagerService as ae, DRAWING_IMAGE_ALLOW_IMAGE_LIST as ln, DRAWING_IMAGE_COUNT_LIMIT as un, ImageUploadStatusType as Ae, DRAWING_IMAGE_ALLOW_SIZE as hn, getImageSize as gn, DRAWING_IMAGE_WIDTH_LIMIT as mn, DRAWING_IMAGE_HEIGHT_LIMIT as fn, getDrawingShapeKeyByDrawingSearch as Ye, UniverDrawingPlugin as Jr } from "@univerjs/drawing";
|
|
7
|
+
import { ImageCropperObject as Zr, COMPONENT_IMAGE_POPUP_MENU as qr, OpenImageCropOperation as Qr, ImageResetSizeOperation as ei, DrawingRenderService as Tn, DrawingCommonPanel as ti, UniverDrawingUIPlugin as ni } from "@univerjs/drawing-ui";
|
|
8
|
+
import { IRenderManagerService as Q, precisionTo as dt, getGroupState as ri, transformObjectOutOfGroup as ii, RENDER_CLASS_TYPE as Ne, Rect as lt, ObjectType as pn, DRAWING_OBJECT_LAYER_INDEX as Yt, SHEET_VIEWPORT_KEY as En } from "@univerjs/engine-render";
|
|
9
|
+
import { ISheetDrawingService as ee, SetDrawingApplyMutation as T, DrawingApplyType as E, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as si } from "@univerjs/sheets-drawing";
|
|
10
|
+
import { SheetCanvasPopManagerService as oi, convertPositionSheetOverGridToAbsolute as ai, ISheetSelectionRenderService as Qe, SheetSkeletonManagerService as Z, attachRangeWithCoord as Pn, IEditorBridgeService as ci, IAutoFillService as di, HoverManagerService as li, COPY_TYPE as wn, PREDEFINED_HOOK_NAME as ut, virtualizeDiscreteRanges as ui, ISheetClipboardService as hi, SheetPrintInterceptorService as gi, getCurrentRangeDisable$ as mi, SetZoomRatioOperation as _n, SetScrollOperation as fi } from "@univerjs/sheets-ui";
|
|
11
|
+
import { ISidebarService as pi, IUIPartsService as wi, BuiltInUIPart as _i, ILocalFileService as vi, IMessageService as Si, MenuItemType as on, getMenuHiddenObservable as Un, RibbonStartGroup as Ii, KeyCode as xe, ComponentManager as Ci, IMenuManagerService as Ri, IShortcutService as bi, CanvasFloatDomService as Di } from "@univerjs/ui";
|
|
12
|
+
import { takeUntil as vn, combineLatest as ht, map as Je, filter as ve, distinctUntilChanged as gt, Subject as Ht, take as Mi, BehaviorSubject as He, switchMap as Sn } from "rxjs";
|
|
13
|
+
import { SheetInterceptorService as At, getSheetCommandTarget as V, SheetsSelectionsService as An, SetRangeValuesCommand as yi, SetWorksheetRowHeightMutation as Nn, SetWorksheetColWidthMutation as jn, SetWorksheetRowIsAutoHeightMutation as Oi, SetWorksheetRowAutoHeightMutation as Wn, AddWorksheetMergeMutation as Ti, RemoveWorksheetMergeMutation as Ei, AFTER_CELL_EDIT as Pi, INTERCEPTOR_POINT as Ui, InterceptCellContentPriority as Ai, WorkbookViewPermission as In, WorksheetViewPermission as Xt, WorkbookEditablePermission as qt, WorksheetEditPermission as St, InsertRowCommand as xn, InsertColCommand as Bn, RemoveRowCommand as $n, RemoveColCommand as kn, DeleteRangeMoveLeftCommand as Ln, DeleteRangeMoveUpCommand as Fn, InsertRangeMoveDownCommand as Gn, InsertRangeMoveRightCommand as Vn, DeltaRowHeightCommand as Qt, SetRowHeightCommand as en, DeltaColumnWidthCommand as Yn, SetColWidthCommand as Hn, SetRowHiddenCommand as Xn, SetSpecificRowsVisibleCommand as zn, SetSpecificColsVisibleCommand as Kn, SetColHiddenCommand as Jn, MoveColsCommand as Zn, MoveRowsCommand as qn, MoveRangeCommand as Qn, SetRowVisibleMutation as Ni, SetRowHiddenMutation as ji, SetColVisibleMutation as Wi, SetColHiddenMutation as xi, SetWorksheetActiveOperation as Bi, RangeProtectionPermissionEditPoint as $i, SetFrozenMutation as ki, COMMAND_LISTENER_SKELETON_CHANGE as Li } from "@univerjs/sheets";
|
|
14
|
+
import er, { useEffect as an, forwardRef as tr, useRef as Fi, createElement as nr, useState as tn } from "react";
|
|
15
|
+
import { docDrawingPositionToTransform as Gi, ReplaceSnapshotCommand as Vi } from "@univerjs/docs-ui";
|
|
16
|
+
import { MessageType as Me, RadioGroup as Yi, Radio as zt } from "@univerjs/design";
|
|
17
|
+
const Hi = "sheets-drawing-ui.config", Cn = {}, F = {
|
|
18
18
|
id: "sheet.operation.clear-drawing-transformer",
|
|
19
|
-
type:
|
|
19
|
+
type: q.MUTATION,
|
|
20
20
|
handler: (i, e) => {
|
|
21
|
-
const n = i.get(
|
|
21
|
+
const n = i.get(Q);
|
|
22
22
|
return e.forEach((t) => {
|
|
23
23
|
var r, s;
|
|
24
24
|
(s = (r = n.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
|
|
25
25
|
}), !0;
|
|
26
26
|
}
|
|
27
|
-
},
|
|
27
|
+
}, Nt = {
|
|
28
28
|
id: "sheet.command.remove-sheet-image",
|
|
29
|
-
type:
|
|
29
|
+
type: q.COMMAND,
|
|
30
30
|
handler: (i, e) => {
|
|
31
|
-
var
|
|
32
|
-
const n = i.get(H), t = i.get(
|
|
31
|
+
var I, S, R;
|
|
32
|
+
const n = i.get(H), t = i.get(Be), r = i.get(At), s = i.get(ee);
|
|
33
33
|
if (!e) return !1;
|
|
34
34
|
const { drawings: o } = e, c = [];
|
|
35
35
|
o.forEach((v) => {
|
|
36
|
-
const { unitId:
|
|
37
|
-
c.push(
|
|
36
|
+
const { unitId: C } = v;
|
|
37
|
+
c.push(C);
|
|
38
38
|
});
|
|
39
|
-
const d = s.getBatchRemoveOp(o), { unitId: g, subUnitId: a, undo: l, redo:
|
|
40
|
-
return
|
|
39
|
+
const d = s.getBatchRemoveOp(o), { unitId: g, subUnitId: a, undo: l, redo: h, objects: u } = d, m = r.onCommandExecute({ id: Nt.id, params: e }), p = { id: T.id, params: { unitId: g, subUnitId: a, op: h, objects: u, type: E.REMOVE } }, f = { id: T.id, params: { unitId: g, subUnitId: a, op: l, objects: u, type: E.INSERT } };
|
|
40
|
+
return Mn([...(I = m.preRedos) != null ? I : [], p, ...m.redos], n) ? (t.pushUndoRedo({
|
|
41
41
|
unitID: g,
|
|
42
42
|
undoMutations: [
|
|
43
|
-
...(
|
|
44
|
-
|
|
45
|
-
...
|
|
46
|
-
{ id:
|
|
43
|
+
...(S = m.preUndos) != null ? S : [],
|
|
44
|
+
f,
|
|
45
|
+
...m.undos,
|
|
46
|
+
{ id: F.id, params: c }
|
|
47
47
|
],
|
|
48
48
|
redoMutations: [
|
|
49
|
-
...(
|
|
49
|
+
...(R = m.preRedos) != null ? R : [],
|
|
50
50
|
p,
|
|
51
|
-
...
|
|
52
|
-
{ id:
|
|
51
|
+
...m.redos,
|
|
52
|
+
{ id: F.id, params: c }
|
|
53
53
|
]
|
|
54
54
|
}), !0) : !1;
|
|
55
55
|
}
|
|
56
|
-
},
|
|
56
|
+
}, rr = "COMPONENT_SHEET_DRAWING_PANEL", ir = {
|
|
57
57
|
id: "sidebar.operation.sheet-image",
|
|
58
|
-
type:
|
|
58
|
+
type: q.COMMAND,
|
|
59
59
|
handler: async (i, e) => {
|
|
60
|
-
const n = i.get(
|
|
61
|
-
if (!
|
|
60
|
+
const n = i.get(pi), t = i.get(Pt), r = i.get($e), s = i.get(H);
|
|
61
|
+
if (!V(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: rr },
|
|
67
67
|
onClose: () => {
|
|
68
|
-
s.syncExecuteCommand(
|
|
68
|
+
s.syncExecuteCommand(Ut.id, []);
|
|
69
69
|
},
|
|
70
70
|
width: 360
|
|
71
71
|
});
|
|
@@ -77,15 +77,15 @@ const Fi = "sheets-drawing-ui.config", vn = {}, L = {
|
|
|
77
77
|
}
|
|
78
78
|
return !0;
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, sr = {
|
|
81
81
|
id: "sheet.operation.edit-sheet-image",
|
|
82
|
-
type:
|
|
82
|
+
type: q.OPERATION,
|
|
83
83
|
handler: (i, e) => {
|
|
84
84
|
const n = i.get(H);
|
|
85
|
-
return e == null ? !1 : (n.syncExecuteCommand(
|
|
85
|
+
return e == null ? !1 : (n.syncExecuteCommand(Ut.id, [e]), n.executeCommand(ir.id, { value: "open" }), !0);
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
var
|
|
88
|
+
var Kt = { exports: {} }, Xe = {};
|
|
89
89
|
/**
|
|
90
90
|
* @license React
|
|
91
91
|
* react-jsx-runtime.production.min.js
|
|
@@ -95,58 +95,58 @@ var Yt = { exports: {} }, Fe = {};
|
|
|
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
|
|
99
|
-
function
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
var i =
|
|
98
|
+
var Rn;
|
|
99
|
+
function Xi() {
|
|
100
|
+
if (Rn) return Xe;
|
|
101
|
+
Rn = 1;
|
|
102
|
+
var i = er, 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
103
|
function o(c, d, g) {
|
|
104
|
-
var a, l = {},
|
|
105
|
-
g !== void 0 && (
|
|
104
|
+
var a, l = {}, h = null, u = null;
|
|
105
|
+
g !== void 0 && (h = "" + g), d.key !== void 0 && (h = "" + d.key), d.ref !== void 0 && (u = d.ref);
|
|
106
106
|
for (a in d) t.call(d, a) && !s.hasOwnProperty(a) && (l[a] = d[a]);
|
|
107
107
|
if (c && c.defaultProps) for (a in d = c.defaultProps, d) l[a] === void 0 && (l[a] = d[a]);
|
|
108
|
-
return { $$typeof: e, type: c, key:
|
|
108
|
+
return { $$typeof: e, type: c, key: h, ref: u, props: l, _owner: r.current };
|
|
109
109
|
}
|
|
110
|
-
return
|
|
110
|
+
return Xe.Fragment = n, Xe.jsx = o, Xe.jsxs = o, Xe;
|
|
111
111
|
}
|
|
112
|
-
var
|
|
113
|
-
function
|
|
114
|
-
return
|
|
112
|
+
var bn;
|
|
113
|
+
function zi() {
|
|
114
|
+
return bn || (bn = 1, Kt.exports = Xi()), Kt.exports;
|
|
115
115
|
}
|
|
116
|
-
var G =
|
|
117
|
-
const
|
|
118
|
-
uploadLoading:
|
|
119
|
-
uploadLoadingBody:
|
|
120
|
-
uploadLoadingBodyAnimation:
|
|
121
|
-
univerCircleAnimation:
|
|
122
|
-
uploadLoadingBodyText:
|
|
123
|
-
},
|
|
124
|
-
const i =
|
|
125
|
-
return
|
|
116
|
+
var G = zi();
|
|
117
|
+
const Ki = "univer-upload-loading", Ji = "univer-upload-loading-body", Zi = "univer-upload-loading-body-animation", qi = "univer-UniverCircleAnimation", Qi = "univer-upload-loading-body-text", mt = {
|
|
118
|
+
uploadLoading: Ki,
|
|
119
|
+
uploadLoadingBody: Ji,
|
|
120
|
+
uploadLoadingBodyAnimation: Zi,
|
|
121
|
+
univerCircleAnimation: qi,
|
|
122
|
+
uploadLoadingBodyText: Qi
|
|
123
|
+
}, es = () => {
|
|
124
|
+
const i = Ee(On), e = Ee(Pt), [n, t] = er.useState(0);
|
|
125
|
+
return an(() => {
|
|
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__ */ G.jsx("div", { style: { display: n > 0 ? "block" : "none" }, className:
|
|
133
|
-
/* @__PURE__ */ G.jsx("div", { className:
|
|
134
|
-
/* @__PURE__ */ G.jsx("div", { className:
|
|
132
|
+
}, [i]), /* @__PURE__ */ G.jsx("div", { style: { display: n > 0 ? "block" : "none" }, className: mt.uploadLoading, children: /* @__PURE__ */ G.jsxs("div", { className: mt.uploadLoadingBody, children: [
|
|
133
|
+
/* @__PURE__ */ G.jsx("div", { className: mt.uploadLoadingBodyAnimation }),
|
|
134
|
+
/* @__PURE__ */ G.jsx("div", { className: mt.uploadLoadingBodyText, children: `${e.t("uploadLoading.loading")}: ${n}` })
|
|
135
135
|
] }) });
|
|
136
136
|
};
|
|
137
|
-
var
|
|
138
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
137
|
+
var ts = Object.defineProperty, ns = Object.getOwnPropertyDescriptor, rs = (i, e, n, t) => {
|
|
138
|
+
for (var r = t > 1 ? void 0 : t ? ns(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
|
-
return t && r &&
|
|
141
|
-
},
|
|
142
|
-
let
|
|
140
|
+
return t && r && ts(e, n, r), r;
|
|
141
|
+
}, fe = (i, e) => (n, t) => e(n, t, i);
|
|
142
|
+
let It = class extends Ir {
|
|
143
143
|
constructor(e, n, t, r, s, o, c, d) {
|
|
144
144
|
super();
|
|
145
|
-
|
|
145
|
+
J(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
146
146
|
this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = c, this._commandService = d, this._init();
|
|
147
147
|
}
|
|
148
148
|
_init() {
|
|
149
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
149
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET).pipe(vn(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(Y.UNIVER_SHEET).pipe(vn(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(Y.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(_i.CONTENT, () => Cr(es, this._injector));
|
|
150
150
|
}
|
|
151
151
|
_dispose(e) {
|
|
152
152
|
const n = e.getUnitId();
|
|
@@ -161,7 +161,7 @@ let _t = class extends _r {
|
|
|
161
161
|
_hasCropObject(e) {
|
|
162
162
|
const n = e.getAllObjectsByOrder();
|
|
163
163
|
for (const t of n)
|
|
164
|
-
if (t instanceof
|
|
164
|
+
if (t instanceof Zr)
|
|
165
165
|
return !0;
|
|
166
166
|
return !1;
|
|
167
167
|
}
|
|
@@ -175,9 +175,9 @@ let _t = class extends _r {
|
|
|
175
175
|
return;
|
|
176
176
|
let r;
|
|
177
177
|
this.disposeWithMe(
|
|
178
|
-
|
|
178
|
+
Rr(
|
|
179
179
|
t.createControl$.subscribe(() => {
|
|
180
|
-
if (this._contextService.setContextValue(
|
|
180
|
+
if (this._contextService.setContextValue(We, !0), this._hasCropObject(n))
|
|
181
181
|
return;
|
|
182
182
|
const o = t.getSelectedObjectMap();
|
|
183
183
|
if (o.size > 1) {
|
|
@@ -190,28 +190,28 @@ let _t = class extends _r {
|
|
|
190
190
|
const d = c.oKey, g = this._drawingManagerService.getDrawingOKey(d);
|
|
191
191
|
if (!g)
|
|
192
192
|
return;
|
|
193
|
-
const { unitId: a, subUnitId: l, drawingId:
|
|
194
|
-
if (
|
|
193
|
+
const { unitId: a, subUnitId: l, drawingId: h, drawingType: u } = g, m = g.data;
|
|
194
|
+
if (m && m.disablePopup)
|
|
195
195
|
return;
|
|
196
196
|
r == null || r.dispose();
|
|
197
|
-
const p = this._canvasPopManagerService.getFeatureMenu(a, l,
|
|
197
|
+
const p = this._canvasPopManagerService.getFeatureMenu(a, l, h, u);
|
|
198
198
|
r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(c, {
|
|
199
|
-
componentKey:
|
|
199
|
+
componentKey: qr,
|
|
200
200
|
direction: "horizontal",
|
|
201
201
|
offset: [2, 0],
|
|
202
202
|
extraProps: {
|
|
203
|
-
menuItems: p || this._getImageMenuItems(a, l,
|
|
203
|
+
menuItems: p || this._getImageMenuItems(a, l, 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(We, !1), this._commandService.syncExecuteCommand(Ut.id, []);
|
|
211
211
|
})
|
|
212
212
|
), this.disposeWithMe(
|
|
213
213
|
this._contextService.contextChanged$.subscribe((o) => {
|
|
214
|
-
o[
|
|
214
|
+
o[We] === !1 && (r == null || r.dispose());
|
|
215
215
|
})
|
|
216
216
|
), this.disposeWithMe(
|
|
217
217
|
t.changing$.subscribe(() => {
|
|
@@ -224,85 +224,85 @@ let _t = class extends _r {
|
|
|
224
224
|
{
|
|
225
225
|
label: "image-popup.edit",
|
|
226
226
|
index: 0,
|
|
227
|
-
commandId:
|
|
227
|
+
commandId: sr.id,
|
|
228
228
|
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
229
|
-
disable: r ===
|
|
229
|
+
disable: r === L.DRAWING_DOM
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
232
|
label: "image-popup.delete",
|
|
233
233
|
index: 1,
|
|
234
|
-
commandId:
|
|
234
|
+
commandId: Nt.id,
|
|
235
235
|
commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
|
|
236
236
|
disable: !1
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
239
|
label: "image-popup.crop",
|
|
240
240
|
index: 2,
|
|
241
|
-
commandId:
|
|
241
|
+
commandId: Qr.id,
|
|
242
242
|
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
243
|
-
disable: r ===
|
|
243
|
+
disable: r === L.DRAWING_DOM
|
|
244
244
|
},
|
|
245
245
|
{
|
|
246
246
|
label: "image-popup.reset",
|
|
247
247
|
index: 3,
|
|
248
|
-
commandId:
|
|
248
|
+
commandId: ei.id,
|
|
249
249
|
commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
|
|
250
|
-
disable: r ===
|
|
250
|
+
disable: r === L.DRAWING_DOM
|
|
251
251
|
}
|
|
252
252
|
];
|
|
253
253
|
}
|
|
254
254
|
};
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
],
|
|
265
|
-
function
|
|
255
|
+
It = rs([
|
|
256
|
+
fe(0, N(qe)),
|
|
257
|
+
fe(1, ae),
|
|
258
|
+
fe(2, N(oi)),
|
|
259
|
+
fe(3, Q),
|
|
260
|
+
fe(4, $e),
|
|
261
|
+
fe(5, yn),
|
|
262
|
+
fe(6, N(wi)),
|
|
263
|
+
fe(7, H)
|
|
264
|
+
], It);
|
|
265
|
+
function z(i, e, n) {
|
|
266
266
|
const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle: c = 0, skewX: d = 0, skewY: g = 0 } = i, a = n.getCurrent();
|
|
267
267
|
if (a == null)
|
|
268
268
|
return;
|
|
269
|
-
const l =
|
|
269
|
+
const l = ai(
|
|
270
270
|
a.unitId,
|
|
271
271
|
a.sheetId,
|
|
272
272
|
{ from: t, to: r },
|
|
273
273
|
n
|
|
274
274
|
);
|
|
275
|
-
let { left:
|
|
276
|
-
const
|
|
277
|
-
return
|
|
275
|
+
let { left: h, top: u, width: m, height: p } = l;
|
|
276
|
+
const f = n.getCurrentSkeleton(), w = f.rowHeaderWidth + f.columnTotalWidth, I = f.columnHeaderHeight + f.rowTotalHeight;
|
|
277
|
+
return h + m > w && (h = w - m), u + p > I && (u = I - p), {
|
|
278
278
|
flipY: s,
|
|
279
279
|
flipX: o,
|
|
280
280
|
angle: c,
|
|
281
281
|
skewX: d,
|
|
282
282
|
skewY: g,
|
|
283
|
-
left:
|
|
284
|
-
top:
|
|
285
|
-
width:
|
|
283
|
+
left: h,
|
|
284
|
+
top: u,
|
|
285
|
+
width: m,
|
|
286
286
|
height: p
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function k(i, e) {
|
|
290
290
|
const { left: n = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: c = !1, angle: d = 0, skewX: g = 0, skewY: a = 0 } = i, l = e.getCellWithCoordByOffset(n, t);
|
|
291
291
|
if (l == null)
|
|
292
292
|
return;
|
|
293
|
-
const
|
|
293
|
+
const h = {
|
|
294
294
|
column: l.actualColumn,
|
|
295
|
-
columnOffset:
|
|
295
|
+
columnOffset: dt(n - l.startX, 1),
|
|
296
296
|
row: l.actualRow,
|
|
297
|
-
rowOffset:
|
|
298
|
-
},
|
|
299
|
-
if (
|
|
297
|
+
rowOffset: dt(t - l.startY, 1)
|
|
298
|
+
}, u = e.getCellWithCoordByOffset(n + r, t + s);
|
|
299
|
+
if (u == null)
|
|
300
300
|
return;
|
|
301
|
-
const
|
|
302
|
-
column:
|
|
303
|
-
columnOffset:
|
|
304
|
-
row:
|
|
305
|
-
rowOffset:
|
|
301
|
+
const m = {
|
|
302
|
+
column: u.actualColumn,
|
|
303
|
+
columnOffset: dt(n + r - u.startX, 1),
|
|
304
|
+
row: u.actualRow,
|
|
305
|
+
rowOffset: dt(t + s - u.startY, 1)
|
|
306
306
|
};
|
|
307
307
|
return {
|
|
308
308
|
flipY: o,
|
|
@@ -310,16 +310,16 @@ function B(i, e) {
|
|
|
310
310
|
angle: d,
|
|
311
311
|
skewX: g,
|
|
312
312
|
skewY: a,
|
|
313
|
-
from:
|
|
314
|
-
to:
|
|
313
|
+
from: h,
|
|
314
|
+
to: m
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
|
-
var
|
|
318
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
317
|
+
var is = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, os = (i, e, n, t) => {
|
|
318
|
+
for (var r = t > 1 ? void 0 : t ? ss(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
|
-
return t && r &&
|
|
321
|
-
},
|
|
322
|
-
let
|
|
320
|
+
return t && r && is(e, n, r), r;
|
|
321
|
+
}, ft = (i, e) => (n, t) => e(n, t, i);
|
|
322
|
+
let nn = class extends ie {
|
|
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
|
}
|
|
@@ -333,31 +333,31 @@ let Qt = class extends se {
|
|
|
333
333
|
const n = i[e];
|
|
334
334
|
for (const t in n.data) {
|
|
335
335
|
const r = n.data[t];
|
|
336
|
-
r.transform =
|
|
336
|
+
r.transform = z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
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
|
-
],
|
|
348
|
-
function
|
|
342
|
+
nn = os([
|
|
343
|
+
ft(1, ee),
|
|
344
|
+
ft(2, ae),
|
|
345
|
+
ft(3, N(Qe)),
|
|
346
|
+
ft(4, N(Z))
|
|
347
|
+
], nn);
|
|
348
|
+
function as(i) {
|
|
349
349
|
const e = [];
|
|
350
350
|
return i.forEach((n) => {
|
|
351
|
-
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: c } = t, d =
|
|
352
|
-
const
|
|
351
|
+
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: c } = t, d = ri(0, 0, r.map((l) => l.transform || {})), g = r.map((l) => {
|
|
352
|
+
const h = l.transform || { left: 0, top: 0 }, { unitId: u, subUnitId: m, drawingId: p } = l;
|
|
353
353
|
return {
|
|
354
|
-
unitId:
|
|
355
|
-
subUnitId:
|
|
354
|
+
unitId: u,
|
|
355
|
+
subUnitId: m,
|
|
356
356
|
drawingId: p,
|
|
357
357
|
transform: {
|
|
358
|
-
...
|
|
359
|
-
left:
|
|
360
|
-
top:
|
|
358
|
+
...h,
|
|
359
|
+
left: h.left - d.left,
|
|
360
|
+
top: h.top - d.top
|
|
361
361
|
},
|
|
362
362
|
groupId: c
|
|
363
363
|
};
|
|
@@ -365,7 +365,7 @@ function is(i) {
|
|
|
365
365
|
unitId: s,
|
|
366
366
|
subUnitId: o,
|
|
367
367
|
drawingId: c,
|
|
368
|
-
drawingType:
|
|
368
|
+
drawingType: L.DRAWING_GROUP,
|
|
369
369
|
transform: d
|
|
370
370
|
};
|
|
371
371
|
e.push({
|
|
@@ -374,26 +374,26 @@ function is(i) {
|
|
|
374
374
|
});
|
|
375
375
|
}), e;
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function cs(i) {
|
|
378
378
|
const e = [];
|
|
379
379
|
return i.forEach((n) => {
|
|
380
380
|
const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: c, transform: d = { width: 0, height: 0 } } = t;
|
|
381
381
|
if (d == null)
|
|
382
382
|
return;
|
|
383
383
|
const g = r.map((l) => {
|
|
384
|
-
const { transform:
|
|
384
|
+
const { transform: h } = l, { unitId: u, subUnitId: m, drawingId: p } = l, f = ii(h || {}, d, d.width || 0, d.height || 0);
|
|
385
385
|
return {
|
|
386
|
-
unitId:
|
|
387
|
-
subUnitId:
|
|
386
|
+
unitId: u,
|
|
387
|
+
subUnitId: m,
|
|
388
388
|
drawingId: p,
|
|
389
|
-
transform:
|
|
389
|
+
transform: f,
|
|
390
390
|
groupId: void 0
|
|
391
391
|
};
|
|
392
392
|
}), a = {
|
|
393
393
|
unitId: s,
|
|
394
394
|
subUnitId: o,
|
|
395
395
|
drawingId: c,
|
|
396
|
-
drawingType:
|
|
396
|
+
drawingType: L.DRAWING_GROUP,
|
|
397
397
|
transform: {
|
|
398
398
|
left: 0,
|
|
399
399
|
top: 0
|
|
@@ -405,164 +405,164 @@ function ss(i) {
|
|
|
405
405
|
});
|
|
406
406
|
}), e;
|
|
407
407
|
}
|
|
408
|
-
const
|
|
408
|
+
const or = {
|
|
409
409
|
id: "sheet.command.group-sheet-image",
|
|
410
|
-
type:
|
|
410
|
+
type: q.COMMAND,
|
|
411
411
|
handler: (i, e) => {
|
|
412
|
-
const n = i.get(H), t = i.get(
|
|
412
|
+
const n = i.get(H), t = i.get(Be), r = i.get(ee);
|
|
413
413
|
if (!e) return !1;
|
|
414
414
|
const s = [];
|
|
415
|
-
e.forEach(({ parent:
|
|
416
|
-
s.push(
|
|
415
|
+
e.forEach(({ parent: u, children: m }) => {
|
|
416
|
+
s.push(u.unitId), m.forEach((p) => {
|
|
417
417
|
s.push(p.unitId);
|
|
418
418
|
});
|
|
419
419
|
});
|
|
420
420
|
const o = r.getGroupDrawingOp(e), { unitId: c, subUnitId: d, undo: g, redo: a, objects: l } = o;
|
|
421
|
-
return n.syncExecuteCommand(T.id, { op: a, unitId: c, subUnitId: d, objects: l, type:
|
|
421
|
+
return n.syncExecuteCommand(T.id, { op: a, unitId: c, subUnitId: d, objects: l, type: E.GROUP }) ? (t.pushUndoRedo({
|
|
422
422
|
unitID: c,
|
|
423
423
|
undoMutations: [
|
|
424
|
-
{ id: T.id, params: { op: g, unitId: c, subUnitId: d, objects:
|
|
425
|
-
{ id:
|
|
424
|
+
{ id: T.id, params: { op: g, unitId: c, subUnitId: d, objects: cs(l), type: E.UNGROUP } },
|
|
425
|
+
{ id: F.id, params: s }
|
|
426
426
|
],
|
|
427
427
|
redoMutations: [
|
|
428
|
-
{ id: T.id, params: { op: a, unitId: c, subUnitId: d, objects: l, type:
|
|
429
|
-
{ id:
|
|
428
|
+
{ id: T.id, params: { op: a, unitId: c, subUnitId: d, objects: l, type: E.GROUP } },
|
|
429
|
+
{ id: F.id, params: s }
|
|
430
430
|
]
|
|
431
431
|
}), !0) : !1;
|
|
432
432
|
}
|
|
433
|
-
},
|
|
433
|
+
}, jt = {
|
|
434
434
|
id: "sheet.command.insert-sheet-image",
|
|
435
|
-
type:
|
|
435
|
+
type: q.COMMAND,
|
|
436
436
|
handler: (i, e) => {
|
|
437
|
-
var
|
|
438
|
-
const n = i.get(H), t = i.get(
|
|
437
|
+
var I, S, R;
|
|
438
|
+
const n = i.get(H), t = i.get(Be), r = i.get(ee), s = i.get(At);
|
|
439
439
|
if (!e) return !1;
|
|
440
|
-
const o = e.drawings, c = o.map((v) => v.unitId), d = r.getBatchAddOp(o), { unitId: g, subUnitId: a, undo: l, redo:
|
|
441
|
-
return
|
|
440
|
+
const o = e.drawings, c = o.map((v) => v.unitId), d = r.getBatchAddOp(o), { unitId: g, subUnitId: a, undo: l, redo: h, objects: u } = d, m = s.onCommandExecute({ id: jt.id, params: e }), p = { id: T.id, params: { op: h, unitId: g, subUnitId: a, objects: u, type: E.INSERT } }, f = { id: T.id, params: { op: l, unitId: g, subUnitId: a, objects: u, type: E.REMOVE } };
|
|
441
|
+
return Mn([...(I = m.preRedos) != null ? I : [], p, ...m.redos], n) ? (t.pushUndoRedo({
|
|
442
442
|
unitID: g,
|
|
443
443
|
undoMutations: [
|
|
444
|
-
...(
|
|
445
|
-
|
|
446
|
-
...
|
|
447
|
-
{ id:
|
|
444
|
+
...(S = m.preUndos) != null ? S : [],
|
|
445
|
+
f,
|
|
446
|
+
...m.undos,
|
|
447
|
+
{ id: F.id, params: c }
|
|
448
448
|
],
|
|
449
449
|
redoMutations: [
|
|
450
|
-
...(
|
|
450
|
+
...(R = m.preRedos) != null ? R : [],
|
|
451
451
|
p,
|
|
452
|
-
...
|
|
453
|
-
{ id:
|
|
452
|
+
...m.redos,
|
|
453
|
+
{ id: F.id, params: c }
|
|
454
454
|
]
|
|
455
455
|
}), !0) : !1;
|
|
456
456
|
}
|
|
457
|
-
},
|
|
457
|
+
}, ar = {
|
|
458
458
|
id: "sheet.command.set-drawing-arrange",
|
|
459
|
-
type:
|
|
459
|
+
type: q.COMMAND,
|
|
460
460
|
handler: (i, e) => {
|
|
461
|
-
const n = i.get(H), t = i.get(
|
|
461
|
+
const n = i.get(H), t = i.get(Be);
|
|
462
462
|
if (!e) return !1;
|
|
463
|
-
const r = i.get(
|
|
463
|
+
const r = i.get(ee), { unitId: s, subUnitId: o, drawingIds: c, arrangeType: d } = e, g = { unitId: s, subUnitId: o, drawingIds: c };
|
|
464
464
|
let a;
|
|
465
|
-
if (d ===
|
|
465
|
+
if (d === st.forward ? a = r.getForwardDrawingsOp(g) : d === st.backward ? a = r.getBackwardDrawingOp(g) : d === st.front ? a = r.getFrontDrawingsOp(g) : d === st.back && (a = r.getBackDrawingsOp(g)), a == null)
|
|
466
466
|
return !1;
|
|
467
|
-
const { objects: l, redo:
|
|
468
|
-
return n.syncExecuteCommand(T.id, { op:
|
|
467
|
+
const { objects: l, redo: h, undo: u } = a;
|
|
468
|
+
return n.syncExecuteCommand(T.id, { op: h, unitId: s, subUnitId: o, objects: l, type: E.ARRANGE }) ? (t.pushUndoRedo({
|
|
469
469
|
unitID: s,
|
|
470
470
|
undoMutations: [
|
|
471
|
-
{ id: T.id, params: { op:
|
|
471
|
+
{ id: T.id, params: { op: u, unitId: s, subUnitId: o, objects: l, type: E.ARRANGE } }
|
|
472
472
|
],
|
|
473
473
|
redoMutations: [
|
|
474
|
-
{ id: T.id, params: { op:
|
|
474
|
+
{ id: T.id, params: { op: h, unitId: s, subUnitId: o, objects: l, type: E.ARRANGE } }
|
|
475
475
|
]
|
|
476
476
|
}), !0) : !1;
|
|
477
477
|
}
|
|
478
|
-
},
|
|
478
|
+
}, Wt = {
|
|
479
479
|
id: "sheet.command.set-sheet-image",
|
|
480
|
-
type:
|
|
480
|
+
type: q.COMMAND,
|
|
481
481
|
handler: (i, e) => {
|
|
482
|
-
const n = i.get(H), t = i.get(
|
|
482
|
+
const n = i.get(H), t = i.get(Be), r = i.get(ee);
|
|
483
483
|
if (!e) return !1;
|
|
484
484
|
const { drawings: s } = e, o = r.getBatchUpdateOp(s), { unitId: c, subUnitId: d, undo: g, redo: a, objects: l } = o;
|
|
485
|
-
return n.syncExecuteCommand(T.id, { unitId: c, subUnitId: d, op: a, objects: l, type:
|
|
485
|
+
return n.syncExecuteCommand(T.id, { unitId: c, subUnitId: d, op: a, objects: l, type: E.UPDATE }) ? (t.pushUndoRedo({
|
|
486
486
|
unitID: c,
|
|
487
487
|
undoMutations: [
|
|
488
|
-
{ id: T.id, params: { unitId: c, subUnitId: d, op: g, objects: l, type:
|
|
489
|
-
{ id:
|
|
488
|
+
{ id: T.id, params: { unitId: c, subUnitId: d, op: g, objects: l, type: E.UPDATE } },
|
|
489
|
+
{ id: F.id, params: [c] }
|
|
490
490
|
],
|
|
491
491
|
redoMutations: [
|
|
492
|
-
{ id: T.id, params: { unitId: c, subUnitId: d, op: a, objects: l, type:
|
|
493
|
-
{ id:
|
|
492
|
+
{ id: T.id, params: { unitId: c, subUnitId: d, op: a, objects: l, type: E.UPDATE } },
|
|
493
|
+
{ id: F.id, params: [c] }
|
|
494
494
|
]
|
|
495
495
|
}), !0) : !1;
|
|
496
496
|
}
|
|
497
|
-
},
|
|
497
|
+
}, cr = {
|
|
498
498
|
id: "sheet.command.ungroup-sheet-image",
|
|
499
|
-
type:
|
|
499
|
+
type: q.COMMAND,
|
|
500
500
|
handler: (i, e) => {
|
|
501
|
-
const n = i.get(H), t = i.get(
|
|
501
|
+
const n = i.get(H), t = i.get(Be), r = i.get(ee);
|
|
502
502
|
if (!e) return !1;
|
|
503
503
|
const s = [];
|
|
504
|
-
e.forEach(({ parent:
|
|
505
|
-
s.push(
|
|
504
|
+
e.forEach(({ parent: u, children: m }) => {
|
|
505
|
+
s.push(u.unitId), m.forEach((p) => {
|
|
506
506
|
s.push(p.unitId);
|
|
507
507
|
});
|
|
508
508
|
});
|
|
509
509
|
const o = r.getUngroupDrawingOp(e), { unitId: c, subUnitId: d, undo: g, redo: a, objects: l } = o;
|
|
510
|
-
return n.syncExecuteCommand(T.id, { op: a, unitId: c, subUnitId: d, objects: l, type:
|
|
510
|
+
return n.syncExecuteCommand(T.id, { op: a, unitId: c, subUnitId: d, objects: l, type: E.UNGROUP }) ? (t.pushUndoRedo({
|
|
511
511
|
unitID: c,
|
|
512
512
|
undoMutations: [
|
|
513
|
-
{ id: T.id, params: { op: g, unitId: c, subUnitId: d, objects:
|
|
514
|
-
{ id:
|
|
513
|
+
{ id: T.id, params: { op: g, unitId: c, subUnitId: d, objects: as(l), type: E.GROUP } },
|
|
514
|
+
{ id: F.id, params: s }
|
|
515
515
|
],
|
|
516
516
|
redoMutations: [
|
|
517
|
-
{ id: T.id, params: { op: a, unitId: c, subUnitId: d, objects: l, type:
|
|
518
|
-
{ id:
|
|
517
|
+
{ id: T.id, params: { op: a, unitId: c, subUnitId: d, objects: l, type: E.UNGROUP } },
|
|
518
|
+
{ id: F.id, params: s }
|
|
519
519
|
]
|
|
520
520
|
}), !0) : !1;
|
|
521
521
|
}
|
|
522
522
|
};
|
|
523
|
-
var
|
|
524
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
523
|
+
var ds = Object.defineProperty, ls = Object.getOwnPropertyDescriptor, us = (i, e, n, t) => {
|
|
524
|
+
for (var r = t > 1 ? void 0 : t ? ls(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
525
525
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
526
|
-
return t && r &&
|
|
526
|
+
return t && r && ds(e, n, r), r;
|
|
527
527
|
}, te = (i, e) => (n, t) => e(n, t, i);
|
|
528
|
-
function
|
|
528
|
+
function hs(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
|
|
533
|
-
var
|
|
534
|
-
const { rotatedHeight: s, rotatedWidth: o } =
|
|
532
|
+
function dr(i, e, n, t, r) {
|
|
533
|
+
var I;
|
|
534
|
+
const { rotatedHeight: s, rotatedWidth: o } = hs(n, t, r), d = i.get(Q).getRenderById(e.unitId);
|
|
535
535
|
if (!d)
|
|
536
536
|
return !1;
|
|
537
|
-
const a = (
|
|
537
|
+
const a = (I = d.with(Z).getWorksheetSkeleton(e.subUnitId)) == null ? void 0 : I.skeleton;
|
|
538
538
|
if (a == null)
|
|
539
539
|
return !1;
|
|
540
|
-
const l = a.getCellByIndex(e.row, e.col),
|
|
540
|
+
const l = a.getCellByIndex(e.row, e.col), h = l.mergeInfo.endX - l.mergeInfo.startX - 2, u = l.mergeInfo.endY - l.mergeInfo.startY - 2, m = o / s, f = Math.ceil(Math.min(h, u * m)) / o, w = !f || Number.isNaN(f) ? 1e-3 : f;
|
|
541
541
|
return {
|
|
542
|
-
width: n *
|
|
543
|
-
height: t *
|
|
542
|
+
width: n * w,
|
|
543
|
+
height: t * w
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
|
-
let
|
|
547
|
-
constructor(e, n, t, r, s, o, c, d, g, a, l,
|
|
546
|
+
let Ze = class extends ie {
|
|
547
|
+
constructor(e, n, t, r, s, o, c, d, g, a, l, h, u) {
|
|
548
548
|
super();
|
|
549
|
-
|
|
550
|
-
this._context = e, this._skeletonManagerService = n, this._commandService = t, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = c, this._drawingManagerService = d, this._contextService = g, this._messageService = a, this._localeService = l, this._injector =
|
|
549
|
+
J(this, "_workbookSelections");
|
|
550
|
+
this._context = e, this._skeletonManagerService = n, this._commandService = t, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = c, this._drawingManagerService = d, this._contextService = g, this._messageService = a, this._localeService = l, 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: ln.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 > un ? (this._messageService.show({
|
|
558
|
+
type: Me.Error,
|
|
559
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(un))
|
|
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: ln.map((t) => `.${t.replace("image/", "")}`).join(",")
|
|
566
566
|
}))[0];
|
|
567
567
|
return n ? (await this._insertCellImage(n), !0) : !1;
|
|
568
568
|
}
|
|
@@ -570,44 +570,44 @@ let Xe = class extends se {
|
|
|
570
570
|
let n;
|
|
571
571
|
try {
|
|
572
572
|
n = await this._imageIoService.saveImage(e);
|
|
573
|
-
} catch (
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
type:
|
|
577
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
578
|
-
}) :
|
|
579
|
-
type:
|
|
573
|
+
} catch (I) {
|
|
574
|
+
const S = I.message;
|
|
575
|
+
S === Ae.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
576
|
+
type: Me.Error,
|
|
577
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(hn / (1024 * 1024)))
|
|
578
|
+
}) : S === Ae.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
579
|
+
type: Me.Error,
|
|
580
580
|
content: this._localeService.t("update-status.invalidImageType")
|
|
581
|
-
}) :
|
|
582
|
-
type:
|
|
581
|
+
}) : S === Ae.ERROR_IMAGE && this._messageService.show({
|
|
582
|
+
type: Me.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: c, source: d, base64Cache: g } = n, { width: a, height: l, image:
|
|
589
|
-
this._imageIoService.addImageSourceCache(d, c,
|
|
588
|
+
const t = this._getUnitInfo(), { unitId: r, subUnitId: s } = t, { imageId: o, imageSourceType: c, source: d, base64Cache: g } = n, { width: a, height: l, image: h } = await gn(g || ""), { width: u, height: m } = this._context.scene;
|
|
589
|
+
this._imageIoService.addImageSourceCache(d, c, h);
|
|
590
590
|
let p = 1;
|
|
591
|
-
if (a >
|
|
592
|
-
const
|
|
593
|
-
p = Math.max(
|
|
591
|
+
if (a > mn || l > fn) {
|
|
592
|
+
const I = mn / a, S = fn / l;
|
|
593
|
+
p = Math.max(I, S);
|
|
594
594
|
}
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
595
|
+
const f = this._getImagePosition(a * p, l * p, u, m);
|
|
596
|
+
if (f == null)
|
|
597
597
|
return;
|
|
598
|
-
const
|
|
598
|
+
const w = {
|
|
599
599
|
unitId: r,
|
|
600
600
|
subUnitId: s,
|
|
601
601
|
drawingId: o,
|
|
602
|
-
drawingType:
|
|
602
|
+
drawingType: L.DRAWING_IMAGE,
|
|
603
603
|
imageSourceType: c,
|
|
604
604
|
source: d,
|
|
605
|
-
transform:
|
|
606
|
-
sheetTransform:
|
|
605
|
+
transform: z(f, this._selectionRenderService, this._skeletonManagerService),
|
|
606
|
+
sheetTransform: f
|
|
607
607
|
};
|
|
608
|
-
this._commandService.executeCommand(
|
|
608
|
+
this._commandService.executeCommand(jt.id, {
|
|
609
609
|
unitId: r,
|
|
610
|
-
drawings: [
|
|
610
|
+
drawings: [w]
|
|
611
611
|
});
|
|
612
612
|
}
|
|
613
613
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -615,27 +615,27 @@ let Xe = class extends se {
|
|
|
615
615
|
let n;
|
|
616
616
|
try {
|
|
617
617
|
n = await this._imageIoService.saveImage(e);
|
|
618
|
-
} catch (
|
|
619
|
-
const
|
|
620
|
-
|
|
621
|
-
type:
|
|
622
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
623
|
-
}) :
|
|
624
|
-
type:
|
|
618
|
+
} catch (f) {
|
|
619
|
+
const w = f.message;
|
|
620
|
+
w === Ae.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
621
|
+
type: Me.Error,
|
|
622
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(hn / (1024 * 1024)))
|
|
623
|
+
}) : w === Ae.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
624
|
+
type: Me.Error,
|
|
625
625
|
content: this._localeService.t("update-status.invalidImageType")
|
|
626
|
-
}) :
|
|
627
|
-
type:
|
|
626
|
+
}) : w === Ae.ERROR_IMAGE && this._messageService.show({
|
|
627
|
+
type: Me.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: c, height: d, image: g } = await
|
|
633
|
+
const { imageId: t, imageSourceType: r, source: s, base64Cache: o } = n, { width: c, height: d, image: g } = await gn(o || "");
|
|
634
634
|
this._imageIoService.addImageSourceCache(s, r, g);
|
|
635
635
|
const a = this._workbookSelections.getCurrentLastSelection();
|
|
636
636
|
if (!a)
|
|
637
637
|
return !1;
|
|
638
|
-
const l =
|
|
638
|
+
const l = br("", {}), h = dr(
|
|
639
639
|
this._injector,
|
|
640
640
|
{
|
|
641
641
|
unitId: this._context.unitId,
|
|
@@ -647,51 +647,51 @@ let Xe = class extends se {
|
|
|
647
647
|
d,
|
|
648
648
|
0
|
|
649
649
|
);
|
|
650
|
-
if (!
|
|
650
|
+
if (!h)
|
|
651
651
|
return !1;
|
|
652
|
-
const
|
|
652
|
+
const u = {
|
|
653
653
|
size: {
|
|
654
|
-
width:
|
|
655
|
-
height:
|
|
654
|
+
width: h.width,
|
|
655
|
+
height: h.height
|
|
656
656
|
},
|
|
657
657
|
positionH: {
|
|
658
|
-
relativeFrom:
|
|
658
|
+
relativeFrom: Dr.PAGE,
|
|
659
659
|
posOffset: 0
|
|
660
660
|
},
|
|
661
661
|
positionV: {
|
|
662
|
-
relativeFrom:
|
|
662
|
+
relativeFrom: Mr.PARAGRAPH,
|
|
663
663
|
posOffset: 0
|
|
664
664
|
},
|
|
665
665
|
angle: 0
|
|
666
|
-
},
|
|
666
|
+
}, m = {
|
|
667
667
|
unitId: l.getUnitId(),
|
|
668
668
|
subUnitId: l.getUnitId(),
|
|
669
669
|
drawingId: t,
|
|
670
|
-
drawingType:
|
|
670
|
+
drawingType: L.DRAWING_IMAGE,
|
|
671
671
|
imageSourceType: r,
|
|
672
672
|
source: s,
|
|
673
|
-
transform:
|
|
674
|
-
docTransform:
|
|
675
|
-
behindDoc:
|
|
673
|
+
transform: Gi(u),
|
|
674
|
+
docTransform: u,
|
|
675
|
+
behindDoc: yr.FALSE,
|
|
676
676
|
title: "",
|
|
677
677
|
description: "",
|
|
678
|
-
layoutType:
|
|
678
|
+
layoutType: Or.INLINE,
|
|
679
679
|
// Insert inline drawing by default.
|
|
680
|
-
wrapText:
|
|
680
|
+
wrapText: Tr.BOTH_SIDES,
|
|
681
681
|
distB: 0,
|
|
682
682
|
distL: 0,
|
|
683
683
|
distR: 0,
|
|
684
684
|
distT: 0
|
|
685
|
-
}, p =
|
|
685
|
+
}, p = Er.drawing.add({
|
|
686
686
|
documentDataModel: l,
|
|
687
|
-
drawings: [
|
|
687
|
+
drawings: [m],
|
|
688
688
|
selection: {
|
|
689
689
|
collapsed: !0,
|
|
690
690
|
startOffset: 0,
|
|
691
691
|
endOffset: 0
|
|
692
692
|
}
|
|
693
693
|
});
|
|
694
|
-
return p ? (l.apply(p), this._commandService.syncExecuteCommand(
|
|
694
|
+
return p ? (l.apply(p), this._commandService.syncExecuteCommand(yi.id, {
|
|
695
695
|
value: {
|
|
696
696
|
[a.primary.actualRow]: {
|
|
697
697
|
[a.primary.actualColumn]: {
|
|
@@ -718,39 +718,39 @@ let Xe = class extends se {
|
|
|
718
718
|
endColumn: 0
|
|
719
719
|
};
|
|
720
720
|
s && s.length > 0 && (o = s[s.length - 1].range);
|
|
721
|
-
const c =
|
|
721
|
+
const c = Pn(this._skeletonManagerService.getCurrent().skeleton, o);
|
|
722
722
|
if (c == null)
|
|
723
723
|
return;
|
|
724
|
-
let { startColumn: d, startRow: g, startX: a, startY: l } = c,
|
|
725
|
-
if (a + e > t && (a = t - e, a < 0 && (a = 0, e = t),
|
|
726
|
-
const
|
|
727
|
-
if (
|
|
724
|
+
let { startColumn: d, startRow: g, startX: a, startY: l } = c, h = !1;
|
|
725
|
+
if (a + e > t && (a = t - e, a < 0 && (a = 0, e = t), h = !0), l + n > r && (l = r - n, l < 0 && (l = 0, n = r), h = !0), h) {
|
|
726
|
+
const f = this._selectionRenderService.getCellWithCoordByOffset(a, l);
|
|
727
|
+
if (f == null)
|
|
728
728
|
return;
|
|
729
|
-
a =
|
|
729
|
+
a = f.startX, l = f.startY, d = f.actualColumn, g = f.actualRow;
|
|
730
730
|
}
|
|
731
|
-
const
|
|
731
|
+
const u = {
|
|
732
732
|
column: d,
|
|
733
733
|
columnOffset: 0,
|
|
734
734
|
row: g,
|
|
735
735
|
rowOffset: 0
|
|
736
|
-
},
|
|
737
|
-
if (
|
|
736
|
+
}, m = this._selectionRenderService.getCellWithCoordByOffset(a + e, l + n);
|
|
737
|
+
if (m == null)
|
|
738
738
|
return;
|
|
739
739
|
const p = {
|
|
740
|
-
column:
|
|
741
|
-
columnOffset: a + e -
|
|
742
|
-
row:
|
|
743
|
-
rowOffset: l + n -
|
|
740
|
+
column: m.actualColumn,
|
|
741
|
+
columnOffset: a + e - m.startX,
|
|
742
|
+
row: m.actualRow,
|
|
743
|
+
rowOffset: l + n - m.startY
|
|
744
744
|
};
|
|
745
745
|
return {
|
|
746
|
-
from:
|
|
746
|
+
from: u,
|
|
747
747
|
to: p
|
|
748
748
|
};
|
|
749
749
|
}
|
|
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(ar.id, {
|
|
754
754
|
unitId: n,
|
|
755
755
|
subUnitId: t,
|
|
756
756
|
drawingIds: r,
|
|
@@ -768,16 +768,16 @@ let Xe = class extends se {
|
|
|
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 a =
|
|
771
|
+
const a = k({ ...g.transform, ...d }, this._selectionRenderService);
|
|
772
772
|
if (a == null)
|
|
773
773
|
return;
|
|
774
774
|
const l = {
|
|
775
775
|
...t,
|
|
776
|
-
transform: { ...g.transform, ...d, ...
|
|
776
|
+
transform: { ...g.transform, ...d, ...z(a, this._selectionRenderService, this._skeletonManagerService) },
|
|
777
777
|
sheetTransform: { ...a }
|
|
778
778
|
};
|
|
779
779
|
n.push(l);
|
|
780
|
-
}), n.length > 0 && this._commandService.executeCommand(
|
|
780
|
+
}), n.length > 0 && this._commandService.executeCommand(Wt.id, {
|
|
781
781
|
unitId: e[0].unitId,
|
|
782
782
|
drawings: n
|
|
783
783
|
}));
|
|
@@ -785,44 +785,44 @@ let Xe = class extends se {
|
|
|
785
785
|
}
|
|
786
786
|
_groupDrawingListener() {
|
|
787
787
|
this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((e) => {
|
|
788
|
-
this._commandService.executeCommand(
|
|
788
|
+
this._commandService.executeCommand(or.id, e);
|
|
789
789
|
const { unitId: n, subUnitId: t, drawingId: r } = e[0].parent;
|
|
790
|
-
this._commandService.syncExecuteCommand(
|
|
790
|
+
this._commandService.syncExecuteCommand(Ut.id, [{ unitId: n, subUnitId: t, drawingId: r }]);
|
|
791
791
|
})), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((e) => {
|
|
792
|
-
this._commandService.executeCommand(
|
|
792
|
+
this._commandService.executeCommand(cr.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(We, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(We, !0), this._sheetDrawingService.focusDrawing(e));
|
|
799
799
|
})
|
|
800
800
|
);
|
|
801
801
|
}
|
|
802
802
|
};
|
|
803
|
-
|
|
804
|
-
te(1,
|
|
803
|
+
Ze = us([
|
|
804
|
+
te(1, N(Z)),
|
|
805
805
|
te(2, H),
|
|
806
|
-
te(3,
|
|
807
|
-
te(4,
|
|
808
|
-
te(5,
|
|
809
|
-
te(6,
|
|
810
|
-
te(7,
|
|
811
|
-
te(8,
|
|
812
|
-
te(9,
|
|
813
|
-
te(10,
|
|
814
|
-
te(11,
|
|
815
|
-
te(12,
|
|
816
|
-
],
|
|
817
|
-
var
|
|
818
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
806
|
+
te(3, Qe),
|
|
807
|
+
te(4, On),
|
|
808
|
+
te(5, vi),
|
|
809
|
+
te(6, ee),
|
|
810
|
+
te(7, ae),
|
|
811
|
+
te(8, yn),
|
|
812
|
+
te(9, Si),
|
|
813
|
+
te(10, N(Pt)),
|
|
814
|
+
te(11, N(An)),
|
|
815
|
+
te(12, N(qe))
|
|
816
|
+
], Ze);
|
|
817
|
+
var gs = Object.defineProperty, ms = Object.getOwnPropertyDescriptor, fs = (i, e, n, t) => {
|
|
818
|
+
for (var r = t > 1 ? void 0 : t ? ms(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
|
-
return t && r &&
|
|
821
|
-
},
|
|
822
|
-
function
|
|
820
|
+
return t && r && gs(e, n, r), r;
|
|
821
|
+
}, ye = (i, e) => (n, t) => e(n, t, i);
|
|
822
|
+
function rn(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 c = n.p.drawings[n.p.drawingsOrder[0]], d =
|
|
825
|
+
const c = n.p.drawings[n.p.drawingsOrder[0]], d = dr(
|
|
826
826
|
i,
|
|
827
827
|
{
|
|
828
828
|
unitId: e.unitId,
|
|
@@ -839,65 +839,65 @@ function en(i, e, n) {
|
|
|
839
839
|
}
|
|
840
840
|
return !1;
|
|
841
841
|
}
|
|
842
|
-
let
|
|
842
|
+
let Ct = class extends ie {
|
|
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 === Nn.id) {
|
|
850
850
|
const t = i.params;
|
|
851
|
-
n = t.ranges, e =
|
|
852
|
-
} else if (i.id ===
|
|
851
|
+
n = t.ranges, e = V(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
|
|
852
|
+
} else if (i.id === jn.id) {
|
|
853
853
|
const t = i.params;
|
|
854
|
-
n = t.ranges, e =
|
|
855
|
-
} else if (i.id ===
|
|
854
|
+
n = t.ranges, e = V(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
|
|
855
|
+
} else if (i.id === Oi.id) {
|
|
856
856
|
const t = i.params;
|
|
857
|
-
n = t.ranges, e =
|
|
858
|
-
} else if (i.id ===
|
|
857
|
+
n = t.ranges, e = V(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
|
|
858
|
+
} else if (i.id === Wn.id) {
|
|
859
859
|
const t = i.params;
|
|
860
|
-
e =
|
|
860
|
+
e = V(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId }), n = t.rowsAutoHeightInfo.map((r) => ({
|
|
861
861
|
startRow: r.row,
|
|
862
862
|
endRow: r.row,
|
|
863
863
|
startColumn: 0,
|
|
864
864
|
endColumn: 9999
|
|
865
865
|
}));
|
|
866
|
-
} else if (i.id ===
|
|
866
|
+
} else if (i.id === Ti.id) {
|
|
867
867
|
const t = i.params;
|
|
868
|
-
n = t.ranges, e =
|
|
869
|
-
} else if (i.id ===
|
|
868
|
+
n = t.ranges, e = V(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
|
|
869
|
+
} else if (i.id === Ei.id) {
|
|
870
870
|
const t = i.params;
|
|
871
|
-
n = t.ranges, e =
|
|
871
|
+
n = t.ranges, e = V(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
|
|
872
872
|
}
|
|
873
873
|
e && n.length && n.forEach((t) => {
|
|
874
|
-
const r =
|
|
874
|
+
const r = Pr.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
|
+
rn(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(ot), this._docDrawingController.loadDrawingDataForUnit(ot), this._drawingManagerService.initializeNotification(ot)) : this._drawingManagerService.removeDrawingDataForUnit(ot);
|
|
884
884
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
|
|
885
|
-
i.id ===
|
|
885
|
+
i.id === Vi.id && i.params.unitId === at && (this._drawingManagerService.removeDrawingDataForUnit(at), this._docDrawingController.loadDrawingDataForUnit(at), this._drawingManagerService.initializeNotification(at));
|
|
886
886
|
}));
|
|
887
887
|
}
|
|
888
888
|
_handleWriteCell() {
|
|
889
|
-
this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
889
|
+
this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(Pi, {
|
|
890
890
|
priority: 9999,
|
|
891
|
-
handler: (i, e, n) => (
|
|
891
|
+
handler: (i, e, n) => (rn(this._injector, { unitId: e.unitId, subUnitId: e.subUnitId, row: e.row, col: e.col }, i), n(i))
|
|
892
892
|
}));
|
|
893
893
|
}
|
|
894
894
|
_initCellContentInterceptor() {
|
|
895
895
|
this.disposeWithMe(
|
|
896
896
|
this._sheetInterceptorService.intercept(
|
|
897
|
-
|
|
897
|
+
Ui.CELL_CONTENT,
|
|
898
898
|
{
|
|
899
|
-
effect:
|
|
900
|
-
priority:
|
|
899
|
+
effect: Ur.Style,
|
|
900
|
+
priority: Ai.CELL_IMAGE,
|
|
901
901
|
handler: (i, e, n) => {
|
|
902
902
|
var t;
|
|
903
903
|
return i != null && i.p && ((t = i.p.drawingsOrder) != null && t.length) && (i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }), n(i);
|
|
@@ -907,21 +907,21 @@ let vt = class extends se {
|
|
|
907
907
|
);
|
|
908
908
|
}
|
|
909
909
|
};
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
],
|
|
919
|
-
var
|
|
920
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
910
|
+
Ct = fs([
|
|
911
|
+
ye(0, H),
|
|
912
|
+
ye(1, N(At)),
|
|
913
|
+
ye(2, $e),
|
|
914
|
+
ye(3, N(qe)),
|
|
915
|
+
ye(4, ae),
|
|
916
|
+
ye(5, N(zr)),
|
|
917
|
+
ye(6, N(ci))
|
|
918
|
+
], Ct);
|
|
919
|
+
var ps = Object.defineProperty, ws = Object.getOwnPropertyDescriptor, _s = (i, e, n, t) => {
|
|
920
|
+
for (var r = t > 1 ? void 0 : t ? ws(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
|
-
return t && r &&
|
|
923
|
-
},
|
|
924
|
-
let
|
|
922
|
+
return t && r && ps(e, n, r), r;
|
|
923
|
+
}, Dn = (i, e) => (n, t) => e(n, t, i);
|
|
924
|
+
let Rt = class extends ie {
|
|
925
925
|
constructor(i, e) {
|
|
926
926
|
super(), this._autoFillService = i, this._injector = e, this._initAutoFillHooks();
|
|
927
927
|
}
|
|
@@ -930,27 +930,27 @@ let St = class extends se {
|
|
|
930
930
|
this._autoFillService.addHook({
|
|
931
931
|
id: "sheet-cell-image-autofill",
|
|
932
932
|
onBeforeSubmit: (i, e, n, t) => {
|
|
933
|
-
new
|
|
934
|
-
|
|
933
|
+
new Ar(t).forValue((r, s, o) => {
|
|
934
|
+
rn(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
|
-
],
|
|
945
|
-
var
|
|
946
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
941
|
+
Rt = _s([
|
|
942
|
+
Dn(0, N(di)),
|
|
943
|
+
Dn(1, N(qe))
|
|
944
|
+
], Rt);
|
|
945
|
+
var vs = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, Is = (i, e, n, t) => {
|
|
946
|
+
for (var r = t > 1 ? void 0 : t ? Ss(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
|
-
return t && r &&
|
|
949
|
-
},
|
|
950
|
-
let
|
|
948
|
+
return t && r && vs(e, n, r), r;
|
|
949
|
+
}, pt = (i, e) => (n, t) => e(n, t, i);
|
|
950
|
+
let bt = class extends ie {
|
|
951
951
|
constructor(e, n, t, r) {
|
|
952
952
|
super();
|
|
953
|
-
|
|
953
|
+
J(this, "_isSetCursor", !1);
|
|
954
954
|
this._hoverManagerService = e, this._renderManagerService = n, this._selectionsService = t, this._drawingRenderService = r;
|
|
955
955
|
}
|
|
956
956
|
_initHover() {
|
|
@@ -958,21 +958,21 @@ let It = class extends se {
|
|
|
958
958
|
_initImageClick() {
|
|
959
959
|
}
|
|
960
960
|
};
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
],
|
|
967
|
-
var
|
|
968
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
961
|
+
bt = Is([
|
|
962
|
+
pt(0, N(li)),
|
|
963
|
+
pt(1, N(Q)),
|
|
964
|
+
pt(2, N(An)),
|
|
965
|
+
pt(3, N(Tn))
|
|
966
|
+
], bt);
|
|
967
|
+
var Cs = Object.defineProperty, Rs = Object.getOwnPropertyDescriptor, bs = (i, e, n, t) => {
|
|
968
|
+
for (var r = t > 1 ? void 0 : t ? Rs(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
|
-
return t && r &&
|
|
971
|
-
},
|
|
972
|
-
let
|
|
970
|
+
return t && r && Cs(e, n, r), r;
|
|
971
|
+
}, Jt = (i, e) => (n, t) => e(n, t, i);
|
|
972
|
+
let Dt = class extends ie {
|
|
973
973
|
constructor(e, n, t) {
|
|
974
974
|
super();
|
|
975
|
-
|
|
975
|
+
J(this, "_copyInfo");
|
|
976
976
|
this._sheetClipboardService = e, this._renderManagerService = n, this._sheetDrawingService = t, this._initCopyPaste();
|
|
977
977
|
}
|
|
978
978
|
_initCopyPaste() {
|
|
@@ -980,31 +980,31 @@ let Ct = class extends se {
|
|
|
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 =
|
|
983
|
+
const { copyType: s = wn.COPY, pasteType: o } = r, { range: c } = e || {}, { range: d, unitId: g, subUnitId: a } = n;
|
|
984
984
|
return this._generateMutations(d, { copyType: s, pasteType: o, copyRange: c, unitId: g, subUnitId: a });
|
|
985
985
|
},
|
|
986
986
|
onPastePlainText: (e, n) => ({ undos: [], redos: [] })
|
|
987
987
|
});
|
|
988
988
|
}
|
|
989
989
|
_collect(e, n, t) {
|
|
990
|
-
var
|
|
991
|
-
const r = (
|
|
990
|
+
var h;
|
|
991
|
+
const r = (h = this._renderManagerService.getRenderById(e)) == null ? void 0 : h.with(Z);
|
|
992
992
|
if (!r) return;
|
|
993
993
|
const s = r.attachRangeWithCoord(t);
|
|
994
994
|
if (!s)
|
|
995
995
|
return;
|
|
996
996
|
const { startX: o, endX: c, startY: d, endY: g } = s, a = this._sheetDrawingService.getDrawingData(e, n), l = [];
|
|
997
|
-
Object.keys(a).forEach((
|
|
998
|
-
const
|
|
999
|
-
if (
|
|
997
|
+
Object.keys(a).forEach((u) => {
|
|
998
|
+
const m = a[u], { transform: p } = m;
|
|
999
|
+
if (m.anchorType !== O.Both || !p)
|
|
1000
1000
|
return;
|
|
1001
|
-
const { left:
|
|
1002
|
-
drawingStartX:
|
|
1003
|
-
drawingEndX:
|
|
1004
|
-
drawingStartY:
|
|
1005
|
-
drawingEndY:
|
|
1001
|
+
const { left: f = 0, top: w = 0, width: I = 0, height: S = 0 } = p, { drawingStartX: R, drawingEndX: v, drawingStartY: C, drawingEndY: _ } = {
|
|
1002
|
+
drawingStartX: f,
|
|
1003
|
+
drawingEndX: f + I,
|
|
1004
|
+
drawingStartY: w,
|
|
1005
|
+
drawingEndY: w + S
|
|
1006
1006
|
};
|
|
1007
|
-
o <=
|
|
1007
|
+
o <= R && v <= c && d <= C && _ <= g && l.push(m);
|
|
1008
1008
|
}), l.length && (this._copyInfo = {
|
|
1009
1009
|
drawings: l,
|
|
1010
1010
|
unitId: e,
|
|
@@ -1013,104 +1013,104 @@ let Ct = class extends se {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
// eslint-disable-next-line max-lines-per-function
|
|
1015
1015
|
_generateMutations(e, n) {
|
|
1016
|
-
var
|
|
1016
|
+
var x;
|
|
1017
1017
|
if (!this._copyInfo)
|
|
1018
1018
|
return { redos: [], undos: [] };
|
|
1019
1019
|
if ([
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1020
|
+
ut.SPECIAL_PASTE_COL_WIDTH,
|
|
1021
|
+
ut.SPECIAL_PASTE_VALUE,
|
|
1022
|
+
ut.SPECIAL_PASTE_FORMAT,
|
|
1023
|
+
ut.SPECIAL_PASTE_FORMULA
|
|
1024
1024
|
].includes(n.pasteType))
|
|
1025
1025
|
return { redos: [], undos: [] };
|
|
1026
1026
|
const { copyRange: r } = n;
|
|
1027
1027
|
if (!r)
|
|
1028
1028
|
return { redos: [], undos: [] };
|
|
1029
|
-
const { drawings: s, unitId: o, subUnitId: c } = this._copyInfo, { ranges: [d, g], mapFunc: a } =
|
|
1029
|
+
const { drawings: s, unitId: o, subUnitId: c } = this._copyInfo, { ranges: [d, g], mapFunc: a } = ui([r, e]), { row: l, col: h } = a(d.startRow, d.startColumn), { row: u, col: m } = a(g.startRow, g.startColumn), p = (x = this._renderManagerService.getRenderById(o)) == null ? void 0 : x.with(Z);
|
|
1030
1030
|
if (!p)
|
|
1031
1031
|
return { redos: [], undos: [] };
|
|
1032
|
-
const
|
|
1032
|
+
const f = p.attachRangeWithCoord({
|
|
1033
1033
|
startRow: l,
|
|
1034
1034
|
endRow: l,
|
|
1035
|
-
startColumn:
|
|
1036
|
-
endColumn:
|
|
1037
|
-
}),
|
|
1038
|
-
startRow:
|
|
1039
|
-
endRow:
|
|
1040
|
-
startColumn:
|
|
1041
|
-
endColumn:
|
|
1035
|
+
startColumn: h,
|
|
1036
|
+
endColumn: h
|
|
1037
|
+
}), w = p.attachRangeWithCoord({
|
|
1038
|
+
startRow: u,
|
|
1039
|
+
endRow: u,
|
|
1040
|
+
startColumn: m,
|
|
1041
|
+
endColumn: m
|
|
1042
1042
|
});
|
|
1043
|
-
if (!
|
|
1043
|
+
if (!f || !w)
|
|
1044
1044
|
return { redos: [], undos: [] };
|
|
1045
|
-
const
|
|
1046
|
-
return s.forEach((
|
|
1047
|
-
const { transform: D, sheetTransform:
|
|
1045
|
+
const I = [], S = [], R = w.startX - f.startX, v = w.startY - f.startY, C = u - l, _ = m - h, y = n.copyType === wn.CUT, { _sheetDrawingService: M } = this;
|
|
1046
|
+
return s.forEach((U) => {
|
|
1047
|
+
const { transform: D, sheetTransform: b } = U;
|
|
1048
1048
|
if (!D)
|
|
1049
1049
|
return;
|
|
1050
|
-
const
|
|
1051
|
-
...
|
|
1050
|
+
const P = {
|
|
1051
|
+
...U,
|
|
1052
1052
|
unitId: o,
|
|
1053
1053
|
subUnitId: c,
|
|
1054
|
-
drawingId:
|
|
1054
|
+
drawingId: y ? U.drawingId : Pe.generateRandomId(),
|
|
1055
1055
|
transform: {
|
|
1056
1056
|
...D,
|
|
1057
|
-
left: D.left +
|
|
1057
|
+
left: D.left + R,
|
|
1058
1058
|
top: D.top + v
|
|
1059
1059
|
},
|
|
1060
1060
|
sheetTransform: {
|
|
1061
|
-
to: { ...
|
|
1062
|
-
from: { ...
|
|
1061
|
+
to: { ...b.to, row: b.to.row + C, column: b.to.column + _ },
|
|
1062
|
+
from: { ...b.from, row: b.from.row + C, column: b.from.column + _ }
|
|
1063
1063
|
}
|
|
1064
1064
|
};
|
|
1065
|
-
if (
|
|
1066
|
-
const { undo:
|
|
1067
|
-
|
|
1065
|
+
if (y) {
|
|
1066
|
+
const { undo: A, redo: j, objects: B } = M.getBatchUpdateOp([P]);
|
|
1067
|
+
I.push({
|
|
1068
1068
|
id: T.id,
|
|
1069
1069
|
params: {
|
|
1070
1070
|
unitId: o,
|
|
1071
1071
|
subUnitId: c,
|
|
1072
|
-
type:
|
|
1073
|
-
op:
|
|
1074
|
-
objects:
|
|
1072
|
+
type: E.UPDATE,
|
|
1073
|
+
op: j,
|
|
1074
|
+
objects: B
|
|
1075
1075
|
}
|
|
1076
|
-
}),
|
|
1076
|
+
}), S.push({
|
|
1077
1077
|
id: T.id,
|
|
1078
1078
|
params: {
|
|
1079
1079
|
unitId: o,
|
|
1080
1080
|
subUnitId: c,
|
|
1081
|
-
type:
|
|
1082
|
-
op:
|
|
1083
|
-
objects:
|
|
1081
|
+
type: E.UPDATE,
|
|
1082
|
+
op: A,
|
|
1083
|
+
objects: B
|
|
1084
1084
|
}
|
|
1085
1085
|
});
|
|
1086
1086
|
} else {
|
|
1087
|
-
const { undo:
|
|
1088
|
-
|
|
1087
|
+
const { undo: A, redo: j, objects: B } = M.getBatchAddOp([P]);
|
|
1088
|
+
I.push({ id: T.id, params: { op: j, unitId: o, subUnitId: c, objects: B, type: E.INSERT } }), S.push({ id: T.id, params: { op: A, unitId: o, subUnitId: c, objects: B, type: E.REMOVE } });
|
|
1089
1089
|
}
|
|
1090
1090
|
}), {
|
|
1091
|
-
redos:
|
|
1092
|
-
undos:
|
|
1091
|
+
redos: I,
|
|
1092
|
+
undos: S
|
|
1093
1093
|
};
|
|
1094
1094
|
}
|
|
1095
1095
|
};
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
],
|
|
1101
|
-
var
|
|
1102
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1096
|
+
Dt = bs([
|
|
1097
|
+
Jt(0, hi),
|
|
1098
|
+
Jt(1, Q),
|
|
1099
|
+
Jt(2, ee)
|
|
1100
|
+
], Dt);
|
|
1101
|
+
var Ds = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, ys = (i, e, n, t) => {
|
|
1102
|
+
for (var r = t > 1 ? void 0 : t ? Ms(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1103
1103
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
1104
|
-
return t && r &&
|
|
1105
|
-
},
|
|
1106
|
-
let
|
|
1104
|
+
return t && r && Ds(e, n, r), r;
|
|
1105
|
+
}, ze = (i, e) => (n, t) => e(n, t, i);
|
|
1106
|
+
let Mt = class extends ie {
|
|
1107
1107
|
constructor(i, e, n, t, r) {
|
|
1108
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();
|
|
1109
1109
|
}
|
|
1110
1110
|
_initDrawingVisible() {
|
|
1111
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1111
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
|
|
1112
1112
|
this.disposeWithMe(
|
|
1113
|
-
|
|
1113
|
+
ht([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
1114
1114
|
if (!e) {
|
|
1115
1115
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
1116
1116
|
return;
|
|
@@ -1121,15 +1121,15 @@ let Rt = class extends se {
|
|
|
1121
1121
|
return;
|
|
1122
1122
|
}
|
|
1123
1123
|
const r = e.getUnitId(), s = t.getSheetId();
|
|
1124
|
-
if (this._permissionService.composePermission([new
|
|
1124
|
+
if (this._permissionService.composePermission([new In(r).id, new Xt(r, s).id]).every((c) => c.value))
|
|
1125
1125
|
this._drawingManagerService.setDrawingVisible(!0);
|
|
1126
1126
|
else {
|
|
1127
1127
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
1128
|
-
const c = e.getUnitId(), d = t.getSheetId(), g = this._drawingManagerService.getDrawingData(c, d), a = Object.values(g), l = this._renderManagerService.getRenderById(c),
|
|
1129
|
-
if (
|
|
1128
|
+
const c = e.getUnitId(), d = t.getSheetId(), g = this._drawingManagerService.getDrawingData(c, d), a = Object.values(g), l = this._renderManagerService.getRenderById(c), h = l == null ? void 0 : l.scene;
|
|
1129
|
+
if (h == null)
|
|
1130
1130
|
return;
|
|
1131
|
-
|
|
1132
|
-
|
|
1131
|
+
h.getAllObjectsByOrder().forEach((m) => {
|
|
1132
|
+
m.classType === Ne.IMAGE && a.some((p) => m.oKey.includes(p.drawingId)) && h.removeObject(m);
|
|
1133
1133
|
});
|
|
1134
1134
|
}
|
|
1135
1135
|
});
|
|
@@ -1137,9 +1137,9 @@ let Rt = class extends se {
|
|
|
1137
1137
|
);
|
|
1138
1138
|
}
|
|
1139
1139
|
_initDrawingEditable() {
|
|
1140
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1140
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
|
|
1141
1141
|
this.disposeWithMe(
|
|
1142
|
-
|
|
1142
|
+
ht([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
1143
1143
|
if (!e) {
|
|
1144
1144
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
1145
1145
|
return;
|
|
@@ -1150,15 +1150,15 @@ let Rt = class extends se {
|
|
|
1150
1150
|
return;
|
|
1151
1151
|
}
|
|
1152
1152
|
const r = e.getUnitId(), s = t.getSheetId();
|
|
1153
|
-
if (this._permissionService.composePermission([new
|
|
1153
|
+
if (this._permissionService.composePermission([new qt(r).id, new St(r, s).id]).every((c) => c.value))
|
|
1154
1154
|
this._drawingManagerService.setDrawingEditable(!0);
|
|
1155
1155
|
else {
|
|
1156
1156
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
1157
|
-
const c = e.getUnitId(), d = t.getSheetId(), g = this._drawingManagerService.getDrawingData(c, d), a = Object.values(g), l = this._renderManagerService.getRenderById(c),
|
|
1158
|
-
if (
|
|
1157
|
+
const c = e.getUnitId(), d = t.getSheetId(), g = this._drawingManagerService.getDrawingData(c, d), a = Object.values(g), l = this._renderManagerService.getRenderById(c), h = l == null ? void 0 : l.scene;
|
|
1158
|
+
if (h == null)
|
|
1159
1159
|
return;
|
|
1160
|
-
|
|
1161
|
-
|
|
1160
|
+
h.getAllObjectsByOrder().forEach((m) => {
|
|
1161
|
+
m.classType === Ne.IMAGE && a.some((p) => m.oKey.includes(p.drawingId)) && h.detachTransformerFrom(m);
|
|
1162
1162
|
});
|
|
1163
1163
|
}
|
|
1164
1164
|
});
|
|
@@ -1166,9 +1166,9 @@ let Rt = class extends se {
|
|
|
1166
1166
|
);
|
|
1167
1167
|
}
|
|
1168
1168
|
_initViewPermissionChange() {
|
|
1169
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1169
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
|
|
1170
1170
|
this.disposeWithMe(
|
|
1171
|
-
|
|
1171
|
+
ht([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
1172
1172
|
e && e.activeSheet$.subscribe((t) => {
|
|
1173
1173
|
var l;
|
|
1174
1174
|
if (!t)
|
|
@@ -1178,26 +1178,26 @@ let Rt = class extends se {
|
|
|
1178
1178
|
const c = this._renderManagerService.getRenderById(r), d = c == null ? void 0 : c.scene;
|
|
1179
1179
|
if (d == null)
|
|
1180
1180
|
return;
|
|
1181
|
-
const g = d.getTransformerByCreate(), a = this._permissionService.composePermission$([new
|
|
1181
|
+
const g = d.getTransformerByCreate(), a = this._permissionService.composePermission$([new In(r).id, new Xt(r, s).id]).pipe(Je((h) => h.every((u) => u.value)));
|
|
1182
1182
|
a == null || a.pipe(
|
|
1183
|
-
|
|
1184
|
-
|
|
1183
|
+
ve((h) => h !== o),
|
|
1184
|
+
gt()
|
|
1185
1185
|
).subscribe({
|
|
1186
|
-
next: (
|
|
1187
|
-
o =
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1190
|
-
|
|
1186
|
+
next: (h) => {
|
|
1187
|
+
o = h, this._drawingManagerService.setDrawingVisible(h);
|
|
1188
|
+
const u = d.getAllObjectsByOrder(), m = this._drawingManagerService.getDrawingData(r, s), p = Object.values(m);
|
|
1189
|
+
h ? this._drawingManagerService.addNotification(p) : (u.forEach((f) => {
|
|
1190
|
+
f.classType === Ne.IMAGE && p.some((w) => f.oKey.includes(w.drawingId)) && d.removeObject(f);
|
|
1191
1191
|
}), g.clearSelectedObjects());
|
|
1192
1192
|
}
|
|
1193
|
-
}), (l = this._permissionService.getPermissionPoint$(new
|
|
1194
|
-
|
|
1195
|
-
|
|
1193
|
+
}), (l = this._permissionService.getPermissionPoint$(new Xt(r, s).id)) == null || l.pipe(
|
|
1194
|
+
ve((h) => h.value !== o),
|
|
1195
|
+
gt()
|
|
1196
1196
|
).subscribe({
|
|
1197
1197
|
complete: () => {
|
|
1198
1198
|
o = !0, this._drawingManagerService.setDrawingVisible(!0);
|
|
1199
|
-
const
|
|
1200
|
-
this._drawingManagerService.addNotification(
|
|
1199
|
+
const h = this._drawingManagerService.getDrawingData(r, s), u = Object.values(h);
|
|
1200
|
+
this._drawingManagerService.addNotification(u);
|
|
1201
1201
|
}
|
|
1202
1202
|
});
|
|
1203
1203
|
});
|
|
@@ -1205,9 +1205,9 @@ let Rt = class extends se {
|
|
|
1205
1205
|
);
|
|
1206
1206
|
}
|
|
1207
1207
|
_initEditPermissionChange() {
|
|
1208
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1208
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
|
|
1209
1209
|
this.disposeWithMe(
|
|
1210
|
-
|
|
1210
|
+
ht([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
|
|
1211
1211
|
e && e.activeSheet$.subscribe((t) => {
|
|
1212
1212
|
var l;
|
|
1213
1213
|
if (!t)
|
|
@@ -1217,31 +1217,31 @@ let Rt = class extends se {
|
|
|
1217
1217
|
const c = this._renderManagerService.getRenderById(r), d = c == null ? void 0 : c.scene;
|
|
1218
1218
|
if (d == null)
|
|
1219
1219
|
return;
|
|
1220
|
-
const g = d.getTransformerByCreate(), a = this._permissionService.composePermission$([new
|
|
1220
|
+
const g = d.getTransformerByCreate(), a = this._permissionService.composePermission$([new qt(r).id, new St(r, s).id]).pipe(Je((h) => h.every((u) => u.value)));
|
|
1221
1221
|
a == null || a.pipe(
|
|
1222
|
-
|
|
1223
|
-
|
|
1222
|
+
ve((h) => h !== o),
|
|
1223
|
+
gt()
|
|
1224
1224
|
).subscribe({
|
|
1225
|
-
next: (
|
|
1226
|
-
o =
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
}), this._drawingManagerService.addNotification(p)) : (
|
|
1231
|
-
|
|
1225
|
+
next: (h) => {
|
|
1226
|
+
o = h, this._drawingManagerService.setDrawingEditable(h);
|
|
1227
|
+
const u = d.getAllObjectsByOrder(), m = this._drawingManagerService.getDrawingData(r, s), p = Object.values(m);
|
|
1228
|
+
h ? (u.forEach((f) => {
|
|
1229
|
+
f.classType === Ne.IMAGE && p.some((w) => f.oKey.includes(w.drawingId)) && d.attachTransformerTo(f);
|
|
1230
|
+
}), this._drawingManagerService.addNotification(p)) : (u.forEach((f) => {
|
|
1231
|
+
f.classType === Ne.IMAGE && p.some((w) => f.oKey.includes(w.drawingId)) && d.detachTransformerFrom(f);
|
|
1232
1232
|
}), g.clearSelectedObjects());
|
|
1233
1233
|
}
|
|
1234
|
-
}), (l = this._permissionService.getPermissionPoint$(new
|
|
1235
|
-
|
|
1236
|
-
|
|
1234
|
+
}), (l = this._permissionService.getPermissionPoint$(new St(r, s).id)) == null || l.pipe(
|
|
1235
|
+
ve((h) => h.value !== o),
|
|
1236
|
+
gt()
|
|
1237
1237
|
).subscribe({
|
|
1238
1238
|
complete: () => {
|
|
1239
1239
|
o = !0;
|
|
1240
|
-
const
|
|
1241
|
-
if (
|
|
1240
|
+
const h = e.getUnitId(), u = t.getSheetId(), m = this._drawingManagerService.getDrawingData(h, u), p = Object.values(m), f = this._renderManagerService.getRenderById(h), w = f == null ? void 0 : f.scene;
|
|
1241
|
+
if (w == null)
|
|
1242
1242
|
return;
|
|
1243
|
-
this._drawingManagerService.setDrawingEditable(!0),
|
|
1244
|
-
|
|
1243
|
+
this._drawingManagerService.setDrawingEditable(!0), w.getAllObjectsByOrder().forEach((S) => {
|
|
1244
|
+
S.classType === Ne.IMAGE && p.some((R) => S.oKey.includes(R.drawingId)) && w.detachTransformerFrom(S);
|
|
1245
1245
|
});
|
|
1246
1246
|
}
|
|
1247
1247
|
});
|
|
@@ -1250,19 +1250,19 @@ let Rt = class extends se {
|
|
|
1250
1250
|
);
|
|
1251
1251
|
}
|
|
1252
1252
|
};
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
],
|
|
1260
|
-
var
|
|
1261
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1253
|
+
Mt = ys([
|
|
1254
|
+
ze(0, ae),
|
|
1255
|
+
ze(1, Q),
|
|
1256
|
+
ze(2, jr),
|
|
1257
|
+
ze(3, $e),
|
|
1258
|
+
ze(4, N(Nr))
|
|
1259
|
+
], Mt);
|
|
1260
|
+
var Os = Object.defineProperty, Ts = Object.getOwnPropertyDescriptor, Es = (i, e, n, t) => {
|
|
1261
|
+
for (var r = t > 1 ? void 0 : t ? Ts(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1262
1262
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
1263
|
-
return t && r &&
|
|
1264
|
-
},
|
|
1265
|
-
let
|
|
1263
|
+
return t && r && Os(e, n, r), r;
|
|
1264
|
+
}, wt = (i, e) => (n, t) => e(n, t, i);
|
|
1265
|
+
let yt = class extends ie {
|
|
1266
1266
|
constructor(i, e, n, t) {
|
|
1267
1267
|
super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting();
|
|
1268
1268
|
}
|
|
@@ -1287,17 +1287,17 @@ let bt = class extends se {
|
|
|
1287
1287
|
const { unitId: t, subUnitId: r } = e, s = this._renderManagerService.getRenderById(t);
|
|
1288
1288
|
if (!s)
|
|
1289
1289
|
return n(i);
|
|
1290
|
-
const o = s.with(
|
|
1290
|
+
const o = s.with(Z).getWorksheetSkeleton(r);
|
|
1291
1291
|
if (!o)
|
|
1292
1292
|
return n(i);
|
|
1293
1293
|
const c = this._drawingManagerService.getDrawingDataForUnit(t), d = c == null ? void 0 : c[e.subUnitId];
|
|
1294
1294
|
if (!d)
|
|
1295
1295
|
return n(i);
|
|
1296
|
-
const { scaleX: g, scaleY: a } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 },
|
|
1297
|
-
return
|
|
1298
|
-
if (!
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1296
|
+
const { scaleX: g, scaleY: a } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, h = d.order.map((u) => d.data[u]).filter((u) => u.drawingType !== L.DRAWING_DOM);
|
|
1297
|
+
return h.length ? (h.forEach((u) => {
|
|
1298
|
+
if (!u.groupId && u.transform && Pe.isDefine(u.transform.left) && Pe.isDefine(u.transform.top) && Pe.isDefine(u.transform.width) && Pe.isDefine(u.transform.height)) {
|
|
1299
|
+
const m = o.skeleton.getCellIndexByOffset(u.transform.left, u.transform.top, g, a, { x: 0, y: 0 }), p = o.skeleton.getCellIndexByOffset(u.transform.left + u.transform.width, u.transform.top + u.transform.height, g, a, { x: 0, y: 0 });
|
|
1300
|
+
m.column < l.startColumn && (l.startColumn = m.column), m.row < l.startRow && (l.startRow = m.row), l.endRow < p.row && (l.endRow = p.row), l.endColumn < p.column && (l.endColumn = p.column);
|
|
1301
1301
|
}
|
|
1302
1302
|
}), n(l)) : n(i);
|
|
1303
1303
|
}
|
|
@@ -1306,46 +1306,46 @@ let bt = class extends se {
|
|
|
1306
1306
|
);
|
|
1307
1307
|
}
|
|
1308
1308
|
};
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
],
|
|
1315
|
-
var
|
|
1316
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1309
|
+
yt = Es([
|
|
1310
|
+
wt(0, N(gi)),
|
|
1311
|
+
wt(1, N(Tn)),
|
|
1312
|
+
wt(2, ae),
|
|
1313
|
+
wt(3, Q)
|
|
1314
|
+
], yt);
|
|
1315
|
+
var Ps = Object.defineProperty, Us = Object.getOwnPropertyDescriptor, As = (i, e, n, t) => {
|
|
1316
|
+
for (var r = t > 1 ? void 0 : t ? Us(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1317
1317
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
1318
|
-
return t && r &&
|
|
1319
|
-
},
|
|
1320
|
-
const
|
|
1321
|
-
Nn.id,
|
|
1322
|
-
jn.id,
|
|
1323
|
-
Wn.id,
|
|
1318
|
+
return t && r && Ps(e, n, r), r;
|
|
1319
|
+
}, pe = (i, e) => (n, t) => e(n, t, i);
|
|
1320
|
+
const Ns = [
|
|
1324
1321
|
xn.id,
|
|
1325
1322
|
Bn.id,
|
|
1326
1323
|
$n.id,
|
|
1327
|
-
Ln.id,
|
|
1328
1324
|
kn.id,
|
|
1329
|
-
|
|
1330
|
-
Zt.id,
|
|
1331
|
-
Gn.id,
|
|
1325
|
+
Ln.id,
|
|
1332
1326
|
Fn.id,
|
|
1327
|
+
Gn.id,
|
|
1333
1328
|
Vn.id,
|
|
1334
|
-
|
|
1329
|
+
Qt.id,
|
|
1330
|
+
en.id,
|
|
1335
1331
|
Yn.id,
|
|
1332
|
+
Hn.id,
|
|
1336
1333
|
Xn.id,
|
|
1337
1334
|
zn.id,
|
|
1338
1335
|
Kn.id,
|
|
1339
|
-
Jn.id
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1336
|
+
Jn.id,
|
|
1337
|
+
Zn.id,
|
|
1338
|
+
qn.id,
|
|
1339
|
+
Qn.id
|
|
1340
|
+
], js = [
|
|
1344
1341
|
Ni.id,
|
|
1345
|
-
|
|
1346
|
-
|
|
1342
|
+
ji.id,
|
|
1343
|
+
Wi.id,
|
|
1344
|
+
xi.id,
|
|
1345
|
+
Nn.id,
|
|
1346
|
+
jn.id
|
|
1347
1347
|
];
|
|
1348
|
-
let
|
|
1348
|
+
let sn = class extends ie {
|
|
1349
1349
|
constructor(i, e, n, t, r, s, o, c, d) {
|
|
1350
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 = c, this._univerInstanceService = d, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
|
|
1351
1351
|
}
|
|
@@ -1353,57 +1353,57 @@ let tn = class extends se {
|
|
|
1353
1353
|
this.disposeWithMe(
|
|
1354
1354
|
this._sheetInterceptorService.interceptCommand({
|
|
1355
1355
|
getMutations: (i) => {
|
|
1356
|
-
if (!
|
|
1356
|
+
if (!Ns.includes(i.id))
|
|
1357
1357
|
return { redos: [], undos: [] };
|
|
1358
1358
|
if (i.params == null)
|
|
1359
1359
|
return { redos: [], undos: [] };
|
|
1360
1360
|
const e = i.id;
|
|
1361
|
-
if (e ===
|
|
1361
|
+
if (e === xn.id)
|
|
1362
1362
|
return this._moveRowInterceptor(i.params, "insert");
|
|
1363
|
-
if ([
|
|
1363
|
+
if ([Zn.id, qn.id, Qn.id].includes(e))
|
|
1364
1364
|
return this._moveRangeInterceptor(i.params);
|
|
1365
|
-
if (e ===
|
|
1365
|
+
if (e === Bn.id)
|
|
1366
1366
|
return this._moveColInterceptor(i.params, "insert");
|
|
1367
|
-
if (e ===
|
|
1367
|
+
if (e === $n.id)
|
|
1368
1368
|
return this._moveRowInterceptor(i.params, "remove");
|
|
1369
|
-
if (e ===
|
|
1369
|
+
if (e === kn.id)
|
|
1370
1370
|
return this._moveColInterceptor(i.params, "remove");
|
|
1371
|
-
if (e ===
|
|
1371
|
+
if (e === Ln.id) {
|
|
1372
1372
|
const { range: n } = i.params;
|
|
1373
1373
|
return this._getRangeMoveUndo(
|
|
1374
1374
|
n,
|
|
1375
1375
|
0
|
|
1376
1376
|
/* deleteLeft */
|
|
1377
1377
|
);
|
|
1378
|
-
} else if (e ===
|
|
1378
|
+
} else if (e === Fn.id) {
|
|
1379
1379
|
const { range: n } = i.params;
|
|
1380
1380
|
return this._getRangeMoveUndo(
|
|
1381
1381
|
n,
|
|
1382
1382
|
1
|
|
1383
1383
|
/* deleteUp */
|
|
1384
1384
|
);
|
|
1385
|
-
} else if (e ===
|
|
1385
|
+
} else if (e === Gn.id) {
|
|
1386
1386
|
const { range: n } = i.params;
|
|
1387
1387
|
return this._getRangeMoveUndo(
|
|
1388
1388
|
n,
|
|
1389
1389
|
2
|
|
1390
1390
|
/* insertDown */
|
|
1391
1391
|
);
|
|
1392
|
-
} else if (e ===
|
|
1392
|
+
} else if (e === Vn.id) {
|
|
1393
1393
|
const { range: n } = i.params;
|
|
1394
1394
|
return this._getRangeMoveUndo(
|
|
1395
1395
|
n,
|
|
1396
1396
|
3
|
|
1397
1397
|
/* insertRight */
|
|
1398
1398
|
);
|
|
1399
|
-
} else if (e ===
|
|
1399
|
+
} else if (e === Xn.id || e === zn.id) {
|
|
1400
1400
|
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
|
|
1401
1401
|
return this._getDrawingUndoForRowVisible(t, r, s);
|
|
1402
|
-
} else if (e ===
|
|
1402
|
+
} else if (e === Kn.id || e === Jn.id) {
|
|
1403
1403
|
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
|
|
1404
1404
|
return this._getDrawingUndoForColVisible(t, r, s);
|
|
1405
|
-
} else if (e ===
|
|
1406
|
-
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e ===
|
|
1405
|
+
} else if (e === Qt.id || e === en.id || e === Yn.id || e === Hn.id) {
|
|
1406
|
+
const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e === Qt.id || e === en.id;
|
|
1407
1407
|
return this._getDrawingUndoForRowAndColSize(t, r, s, o);
|
|
1408
1408
|
}
|
|
1409
1409
|
return { redos: [], undos: [] };
|
|
@@ -1412,66 +1412,66 @@ let tn = class extends se {
|
|
|
1412
1412
|
);
|
|
1413
1413
|
}
|
|
1414
1414
|
_getRangeMoveUndo(i, e) {
|
|
1415
|
-
const n =
|
|
1415
|
+
const n = V(this._univerInstanceService);
|
|
1416
1416
|
if (n == null)
|
|
1417
1417
|
return { redos: [], undos: [] };
|
|
1418
1418
|
const t = n.unitId, r = n.subUnitId, s = [], o = [], c = this._sheetDrawingService.getDrawingData(t, r), d = [], g = [];
|
|
1419
1419
|
if (Object.keys(c).forEach((a) => {
|
|
1420
|
-
const l = c[a], { updateDrawings:
|
|
1421
|
-
d.push(...
|
|
1420
|
+
const l = c[a], { updateDrawings: h, deleteDrawings: u } = this._getUpdateOrDeleteDrawings(i, e, l);
|
|
1421
|
+
d.push(...h), g.push(...u);
|
|
1422
1422
|
}), d.length === 0 && g.length === 0)
|
|
1423
1423
|
return { redos: [], undos: [] };
|
|
1424
1424
|
if (d.length > 0) {
|
|
1425
|
-
const a = this._sheetDrawingService.getBatchUpdateOp(d), { undo: l, redo:
|
|
1426
|
-
s.push({ id: T.id, params: { unitId: t, subUnitId: r, op:
|
|
1425
|
+
const a = this._sheetDrawingService.getBatchUpdateOp(d), { undo: l, redo: h, objects: u } = a;
|
|
1426
|
+
s.push({ id: T.id, params: { unitId: t, subUnitId: r, op: h, objects: u, type: E.UPDATE } }), o.push({ id: T.id, params: { unitId: t, subUnitId: r, op: l, objects: u, type: E.UPDATE } });
|
|
1427
1427
|
}
|
|
1428
1428
|
if (g.length > 0) {
|
|
1429
|
-
const a = this._sheetDrawingService.getBatchRemoveOp(g), l = a.undo,
|
|
1430
|
-
s.push({ id: T.id, params: { unitId: t, subUnitId: r, op:
|
|
1429
|
+
const a = this._sheetDrawingService.getBatchRemoveOp(g), l = a.undo, h = a.redo, u = a.objects;
|
|
1430
|
+
s.push({ id: T.id, params: { unitId: t, subUnitId: r, op: h, objects: u, type: E.REMOVE } }), o.push({ id: T.id, params: { unitId: t, subUnitId: r, op: l, objects: u, type: E.INSERT } });
|
|
1431
1431
|
}
|
|
1432
|
-
return s.push({ id:
|
|
1432
|
+
return s.push({ id: F.id, params: [t] }), o.push({ id: F.id, params: [t] }), {
|
|
1433
1433
|
redos: s,
|
|
1434
1434
|
undos: o
|
|
1435
1435
|
};
|
|
1436
1436
|
}
|
|
1437
1437
|
_getUpdateOrDeleteDrawings(i, e, n) {
|
|
1438
|
-
const t = [], r = [], { sheetTransform: s, anchorType: o =
|
|
1438
|
+
const t = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: c, unitId: d, subUnitId: g, drawingId: a } = n, { from: l, to: h } = s, { row: u, column: m } = l, { row: p, column: f } = h;
|
|
1439
1439
|
if (s == null || c == null)
|
|
1440
1440
|
return {
|
|
1441
1441
|
updateDrawings: t,
|
|
1442
1442
|
deleteDrawings: r
|
|
1443
1443
|
};
|
|
1444
|
-
const { startRow:
|
|
1445
|
-
let v = null,
|
|
1446
|
-
if (e === 0 &&
|
|
1447
|
-
if (
|
|
1444
|
+
const { startRow: w, endRow: I, startColumn: S, endColumn: R } = i;
|
|
1445
|
+
let v = null, C = null;
|
|
1446
|
+
if (e === 0 && u >= w && p <= I)
|
|
1447
|
+
if (m >= S && f <= R)
|
|
1448
1448
|
r.push({ unitId: d, subUnitId: g, drawingId: a });
|
|
1449
1449
|
else {
|
|
1450
|
-
const
|
|
1451
|
-
v =
|
|
1450
|
+
const _ = this._shrinkCol(s, c, S, R, o);
|
|
1451
|
+
v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
1452
1452
|
}
|
|
1453
|
-
else if (e === 1 &&
|
|
1454
|
-
if (
|
|
1453
|
+
else if (e === 1 && m >= S && f <= R)
|
|
1454
|
+
if (u >= w && p <= I)
|
|
1455
1455
|
r.push({ unitId: d, subUnitId: g, drawingId: a });
|
|
1456
1456
|
else {
|
|
1457
|
-
const
|
|
1458
|
-
v =
|
|
1457
|
+
const _ = this._shrinkRow(s, c, w, I, o);
|
|
1458
|
+
v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
1459
1459
|
}
|
|
1460
1460
|
else if (e === 2) {
|
|
1461
|
-
const
|
|
1462
|
-
v =
|
|
1461
|
+
const _ = this._expandRow(s, c, w, I, o);
|
|
1462
|
+
v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
1463
1463
|
} else if (e === 3) {
|
|
1464
|
-
const
|
|
1465
|
-
v =
|
|
1464
|
+
const _ = this._expandCol(s, c, S, R, o);
|
|
1465
|
+
v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
1466
1466
|
}
|
|
1467
|
-
if (v != null &&
|
|
1468
|
-
const
|
|
1469
|
-
t.push({ ...n, sheetTransform: v, transform:
|
|
1467
|
+
if (v != null && C != null) {
|
|
1468
|
+
const _ = z(v, this._selectionRenderService, this._skeletonManagerService);
|
|
1469
|
+
t.push({ ...n, sheetTransform: v, transform: _ });
|
|
1470
1470
|
}
|
|
1471
1471
|
return { updateDrawings: t, deleteDrawings: r };
|
|
1472
1472
|
}
|
|
1473
1473
|
_remainDrawingSize(i, e, n) {
|
|
1474
|
-
const t =
|
|
1474
|
+
const t = k({ ...i }, this._selectionRenderService);
|
|
1475
1475
|
t != null && e.push({
|
|
1476
1476
|
...n,
|
|
1477
1477
|
sheetTransform: t
|
|
@@ -1481,67 +1481,67 @@ let tn = class extends se {
|
|
|
1481
1481
|
_getDrawingUndoForColVisible(i, e, n) {
|
|
1482
1482
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
|
|
1483
1483
|
if (Object.keys(t).forEach((a) => {
|
|
1484
|
-
const l = t[a], { sheetTransform:
|
|
1485
|
-
if (
|
|
1486
|
-
this._remainDrawingSize(
|
|
1484
|
+
const l = t[a], { sheetTransform: h, transform: u, anchorType: m = O.Position } = l;
|
|
1485
|
+
if (m === O.None)
|
|
1486
|
+
this._remainDrawingSize(u, r, l);
|
|
1487
1487
|
else {
|
|
1488
|
-
const { from: p, to:
|
|
1488
|
+
const { from: p, to: f } = h, { row: w, column: I } = p, { row: S, column: R } = f;
|
|
1489
1489
|
for (let v = 0; v < n.length; v++) {
|
|
1490
|
-
const
|
|
1491
|
-
if (
|
|
1490
|
+
const C = n[v], { startRow: _, endRow: y, startColumn: M, endColumn: x } = C;
|
|
1491
|
+
if (R < M)
|
|
1492
1492
|
continue;
|
|
1493
|
-
if (
|
|
1494
|
-
let
|
|
1495
|
-
if (
|
|
1496
|
-
const
|
|
1497
|
-
if (
|
|
1493
|
+
if (m === O.Position) {
|
|
1494
|
+
let b = null, P = null;
|
|
1495
|
+
if (I >= M && I <= x) {
|
|
1496
|
+
const A = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: x, startRow: p.row, endRow: f.row });
|
|
1497
|
+
if (A == null)
|
|
1498
1498
|
return;
|
|
1499
|
-
|
|
1499
|
+
P = { ...u, left: A.startX };
|
|
1500
1500
|
}
|
|
1501
|
-
if (
|
|
1502
|
-
r.push({ ...l, sheetTransform:
|
|
1501
|
+
if (P != null && (b = k(P, this._selectionRenderService), b != null && P != null)) {
|
|
1502
|
+
r.push({ ...l, sheetTransform: b, transform: P });
|
|
1503
1503
|
break;
|
|
1504
1504
|
}
|
|
1505
|
-
this._remainDrawingSize(
|
|
1505
|
+
this._remainDrawingSize(u, r, l);
|
|
1506
1506
|
continue;
|
|
1507
1507
|
}
|
|
1508
|
-
if (
|
|
1508
|
+
if (I >= M && R <= x)
|
|
1509
1509
|
continue;
|
|
1510
|
-
let
|
|
1511
|
-
if (
|
|
1512
|
-
const
|
|
1513
|
-
if (
|
|
1510
|
+
let U = null, D = null;
|
|
1511
|
+
if (I >= M && I <= x) {
|
|
1512
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: x, startRow: p.row, endRow: f.row });
|
|
1513
|
+
if (b == null)
|
|
1514
1514
|
return;
|
|
1515
1515
|
D = {
|
|
1516
|
-
...
|
|
1517
|
-
left: (
|
|
1518
|
-
width: ((
|
|
1516
|
+
...u,
|
|
1517
|
+
left: (b == null ? void 0 : b.startX) || 0,
|
|
1518
|
+
width: ((u == null ? void 0 : u.width) || 0) - b.endX + b.startX
|
|
1519
1519
|
};
|
|
1520
|
-
} else if (
|
|
1521
|
-
const
|
|
1522
|
-
if (
|
|
1520
|
+
} else if (R >= M && R <= x) {
|
|
1521
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: M, endColumn: R, startRow: p.row, endRow: f.row });
|
|
1522
|
+
if (b == null)
|
|
1523
1523
|
return;
|
|
1524
1524
|
D = {
|
|
1525
|
-
...
|
|
1526
|
-
left:
|
|
1525
|
+
...u,
|
|
1526
|
+
left: b.startX - ((u == null ? void 0 : u.width) || 0)
|
|
1527
1527
|
};
|
|
1528
1528
|
} else {
|
|
1529
|
-
const
|
|
1530
|
-
if (
|
|
1529
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: M, endColumn: x, startRow: p.row, endRow: f.row });
|
|
1530
|
+
if (b == null)
|
|
1531
1531
|
return;
|
|
1532
1532
|
if (D = {
|
|
1533
|
-
...
|
|
1534
|
-
width: ((
|
|
1535
|
-
},
|
|
1536
|
-
s.push({ ...l, sheetTransform:
|
|
1533
|
+
...u,
|
|
1534
|
+
width: ((u == null ? void 0 : u.width) || 0) - b.endX + b.startX
|
|
1535
|
+
}, U = k(D, this._selectionRenderService), U != null && D != null) {
|
|
1536
|
+
s.push({ ...l, sheetTransform: U, transform: D });
|
|
1537
1537
|
break;
|
|
1538
1538
|
}
|
|
1539
1539
|
}
|
|
1540
|
-
if (D != null && (
|
|
1541
|
-
r.push({ ...l, sheetTransform:
|
|
1540
|
+
if (D != null && (U = k(D, this._selectionRenderService)), D != null && U != null) {
|
|
1541
|
+
r.push({ ...l, sheetTransform: U, transform: D });
|
|
1542
1542
|
break;
|
|
1543
1543
|
} else
|
|
1544
|
-
this._remainDrawingSize(
|
|
1544
|
+
this._remainDrawingSize(u, r, l);
|
|
1545
1545
|
}
|
|
1546
1546
|
}
|
|
1547
1547
|
}), r.length === 0 && s.length === 0)
|
|
@@ -1560,11 +1560,11 @@ let tn = class extends se {
|
|
|
1560
1560
|
}
|
|
1561
1561
|
_createUndoAndRedoMutation(i, e, n) {
|
|
1562
1562
|
const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: r, redo: s, objects: o } = t, c = [
|
|
1563
|
-
{ id: T.id, params: { unitId: i, subUnitId: e, op: s, objects: o, type:
|
|
1564
|
-
{ id:
|
|
1563
|
+
{ id: T.id, params: { unitId: i, subUnitId: e, op: s, objects: o, type: E.UPDATE } },
|
|
1564
|
+
{ id: F.id, params: [i] }
|
|
1565
1565
|
], d = [
|
|
1566
|
-
{ id: T.id, params: { unitId: i, subUnitId: e, op: r, objects: o, type:
|
|
1567
|
-
{ id:
|
|
1566
|
+
{ id: T.id, params: { unitId: i, subUnitId: e, op: r, objects: o, type: E.UPDATE } },
|
|
1567
|
+
{ id: F.id, params: [i] }
|
|
1568
1568
|
];
|
|
1569
1569
|
return {
|
|
1570
1570
|
redos: c,
|
|
@@ -1575,67 +1575,67 @@ let tn = class extends se {
|
|
|
1575
1575
|
_getDrawingUndoForRowVisible(i, e, n) {
|
|
1576
1576
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
|
|
1577
1577
|
if (Object.keys(t).forEach((a) => {
|
|
1578
|
-
const l = t[a], { sheetTransform:
|
|
1579
|
-
if (
|
|
1580
|
-
this._remainDrawingSize(
|
|
1578
|
+
const l = t[a], { sheetTransform: h, transform: u, anchorType: m = O.Position } = l;
|
|
1579
|
+
if (m === O.None)
|
|
1580
|
+
this._remainDrawingSize(u, r, l);
|
|
1581
1581
|
else {
|
|
1582
|
-
const { from: p, to:
|
|
1582
|
+
const { from: p, to: f } = h, { row: w, column: I } = p, { row: S, column: R } = f;
|
|
1583
1583
|
for (let v = 0; v < n.length; v++) {
|
|
1584
|
-
const
|
|
1585
|
-
if (
|
|
1584
|
+
const C = n[v], { startRow: _, endRow: y, startColumn: M, endColumn: x } = C;
|
|
1585
|
+
if (S < _)
|
|
1586
1586
|
continue;
|
|
1587
|
-
if (
|
|
1588
|
-
let
|
|
1589
|
-
if (
|
|
1590
|
-
const
|
|
1591
|
-
if (
|
|
1587
|
+
if (m === O.Position) {
|
|
1588
|
+
let b = null, P = null;
|
|
1589
|
+
if (w >= _ && w <= y) {
|
|
1590
|
+
const A = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: w, endRow: y });
|
|
1591
|
+
if (A == null)
|
|
1592
1592
|
return;
|
|
1593
|
-
|
|
1593
|
+
P = { ...u, top: A.startY };
|
|
1594
1594
|
}
|
|
1595
|
-
if (
|
|
1596
|
-
r.push({ ...l, sheetTransform:
|
|
1595
|
+
if (P != null && (b = k(P, this._selectionRenderService), b != null && P != null)) {
|
|
1596
|
+
r.push({ ...l, sheetTransform: b, transform: P });
|
|
1597
1597
|
break;
|
|
1598
1598
|
}
|
|
1599
|
-
this._remainDrawingSize(
|
|
1599
|
+
this._remainDrawingSize(u, r, l);
|
|
1600
1600
|
continue;
|
|
1601
1601
|
}
|
|
1602
|
-
if (
|
|
1602
|
+
if (w >= _ && S <= y)
|
|
1603
1603
|
continue;
|
|
1604
|
-
let
|
|
1605
|
-
if (
|
|
1606
|
-
const
|
|
1607
|
-
if (
|
|
1604
|
+
let U = null, D = null;
|
|
1605
|
+
if (w >= _ && w <= y) {
|
|
1606
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: w, endRow: y });
|
|
1607
|
+
if (b == null)
|
|
1608
1608
|
return;
|
|
1609
1609
|
D = {
|
|
1610
|
-
...
|
|
1611
|
-
top: (
|
|
1612
|
-
height: ((
|
|
1610
|
+
...u,
|
|
1611
|
+
top: (b == null ? void 0 : b.startY) || 0,
|
|
1612
|
+
height: ((u == null ? void 0 : u.height) || 0) - b.endY + b.startY
|
|
1613
1613
|
};
|
|
1614
|
-
} else if (
|
|
1615
|
-
const
|
|
1616
|
-
if (
|
|
1614
|
+
} else if (S >= _ && S <= y) {
|
|
1615
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: _, endRow: S });
|
|
1616
|
+
if (b == null)
|
|
1617
1617
|
return;
|
|
1618
1618
|
D = {
|
|
1619
|
-
...
|
|
1620
|
-
top:
|
|
1619
|
+
...u,
|
|
1620
|
+
top: b.startY - ((u == null ? void 0 : u.height) || 0)
|
|
1621
1621
|
};
|
|
1622
1622
|
} else {
|
|
1623
|
-
const
|
|
1624
|
-
if (
|
|
1623
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f.column, startRow: _, endRow: y });
|
|
1624
|
+
if (b == null)
|
|
1625
1625
|
return;
|
|
1626
1626
|
if (D = {
|
|
1627
|
-
...
|
|
1628
|
-
height: ((
|
|
1629
|
-
},
|
|
1630
|
-
s.push({ ...l, sheetTransform:
|
|
1627
|
+
...u,
|
|
1628
|
+
height: ((u == null ? void 0 : u.height) || 0) - b.endY + b.startY
|
|
1629
|
+
}, U = k(D, this._selectionRenderService), U != null && D != null) {
|
|
1630
|
+
s.push({ ...l, sheetTransform: U, transform: D });
|
|
1631
1631
|
break;
|
|
1632
1632
|
}
|
|
1633
1633
|
}
|
|
1634
|
-
if (D != null && (
|
|
1635
|
-
r.push({ ...l, sheetTransform:
|
|
1634
|
+
if (D != null && (U = k(D, this._selectionRenderService)), D != null && U != null) {
|
|
1635
|
+
r.push({ ...l, sheetTransform: U, transform: D });
|
|
1636
1636
|
break;
|
|
1637
1637
|
} else
|
|
1638
|
-
this._remainDrawingSize(
|
|
1638
|
+
this._remainDrawingSize(u, r, l);
|
|
1639
1639
|
}
|
|
1640
1640
|
}
|
|
1641
1641
|
}), r.length === 0 && s.length === 0)
|
|
@@ -1655,28 +1655,28 @@ let tn = class extends se {
|
|
|
1655
1655
|
_getDrawingUndoForRowAndColSize(i, e, n, t) {
|
|
1656
1656
|
const r = this._drawingManagerService.getDrawingData(i, e), s = [];
|
|
1657
1657
|
return Object.keys(r).forEach((o) => {
|
|
1658
|
-
const c = r[o], { sheetTransform: d, transform: g, anchorType: a =
|
|
1659
|
-
if (a ===
|
|
1658
|
+
const c = r[o], { sheetTransform: d, transform: g, anchorType: a = O.Position } = c;
|
|
1659
|
+
if (a === O.None)
|
|
1660
1660
|
this._remainDrawingSize(g, s, c);
|
|
1661
1661
|
else {
|
|
1662
|
-
const { from: l, to:
|
|
1663
|
-
for (let
|
|
1664
|
-
const
|
|
1665
|
-
if (p <
|
|
1662
|
+
const { from: l, to: h } = d, { row: u, column: m } = l, { row: p, column: f } = h;
|
|
1663
|
+
for (let w = 0; w < n.length; w++) {
|
|
1664
|
+
const I = n[w], { startRow: S, endRow: R, startColumn: v, endColumn: C } = I;
|
|
1665
|
+
if (p < S || f < v)
|
|
1666
1666
|
continue;
|
|
1667
|
-
if (a ===
|
|
1667
|
+
if (a === O.Position && (u <= S && p >= R || m <= v && f >= C)) {
|
|
1668
1668
|
this._remainDrawingSize(g, s, c);
|
|
1669
1669
|
continue;
|
|
1670
1670
|
}
|
|
1671
|
-
const
|
|
1671
|
+
const _ = z(
|
|
1672
1672
|
{ ...d },
|
|
1673
1673
|
this._selectionRenderService,
|
|
1674
1674
|
this._skeletonManagerService
|
|
1675
1675
|
);
|
|
1676
|
-
if (
|
|
1676
|
+
if (_ != null) {
|
|
1677
1677
|
s.push({
|
|
1678
1678
|
...c,
|
|
1679
|
-
transform:
|
|
1679
|
+
transform: _
|
|
1680
1680
|
});
|
|
1681
1681
|
break;
|
|
1682
1682
|
}
|
|
@@ -1689,7 +1689,7 @@ let tn = class extends se {
|
|
|
1689
1689
|
if (e === "insert")
|
|
1690
1690
|
n = i.unitId, t = i.subUnitId;
|
|
1691
1691
|
else {
|
|
1692
|
-
const r =
|
|
1692
|
+
const r = V(this._univerInstanceService);
|
|
1693
1693
|
if (r == null)
|
|
1694
1694
|
return;
|
|
1695
1695
|
n = r.unitId, t = r.subUnitId;
|
|
@@ -1697,88 +1697,88 @@ let tn = class extends se {
|
|
|
1697
1697
|
return { unitId: n, subUnitId: t };
|
|
1698
1698
|
}
|
|
1699
1699
|
_moveRangeInterceptor(i) {
|
|
1700
|
-
var
|
|
1701
|
-
const { toRange: e, fromRange: n } = i, t =
|
|
1700
|
+
var S, R;
|
|
1701
|
+
const { toRange: e, fromRange: n } = i, t = V(this._univerInstanceService);
|
|
1702
1702
|
if (!t)
|
|
1703
1703
|
return { redos: [], undos: [] };
|
|
1704
|
-
const { unitId: r, subUnitId: s } = t, o = (
|
|
1704
|
+
const { unitId: r, subUnitId: s } = t, o = (R = (S = this._renderManagerService.getRenderById(r)) == null ? void 0 : S.with(Z)) == null ? void 0 : R.getCurrentSkeleton();
|
|
1705
1705
|
if (!o)
|
|
1706
1706
|
return { redos: [], undos: [] };
|
|
1707
|
-
const c =
|
|
1707
|
+
const c = Pn(o, n);
|
|
1708
1708
|
if (!c)
|
|
1709
1709
|
return { redos: [], undos: [] };
|
|
1710
|
-
const { startX: d, endX: g, startY: a, endY: l } = c,
|
|
1711
|
-
Object.keys(
|
|
1712
|
-
const
|
|
1713
|
-
if (
|
|
1710
|
+
const { startX: d, endX: g, startY: a, endY: l } = c, h = this._sheetDrawingService.getDrawingData(r, s), u = [];
|
|
1711
|
+
Object.keys(h).forEach((v) => {
|
|
1712
|
+
const C = h[v];
|
|
1713
|
+
if (C.anchorType !== O.Both)
|
|
1714
1714
|
return;
|
|
1715
|
-
const { transform:
|
|
1716
|
-
if (!
|
|
1715
|
+
const { transform: _ } = C;
|
|
1716
|
+
if (!_)
|
|
1717
1717
|
return;
|
|
1718
|
-
const { left:
|
|
1719
|
-
drawingStartX:
|
|
1720
|
-
drawingEndX:
|
|
1718
|
+
const { left: y = 0, top: M = 0, width: x = 0, height: U = 0 } = _, { drawingStartX: D, drawingEndX: b, drawingStartY: P, drawingEndY: A } = {
|
|
1719
|
+
drawingStartX: y,
|
|
1720
|
+
drawingEndX: y + x,
|
|
1721
1721
|
drawingStartY: M,
|
|
1722
|
-
drawingEndY: M +
|
|
1722
|
+
drawingEndY: M + U
|
|
1723
1723
|
};
|
|
1724
|
-
d <= D &&
|
|
1724
|
+
d <= D && b <= g && a <= P && A <= l && u.push(C);
|
|
1725
1725
|
});
|
|
1726
|
-
const
|
|
1727
|
-
const
|
|
1728
|
-
to: { ...
|
|
1729
|
-
from: { ...
|
|
1730
|
-
},
|
|
1726
|
+
const m = [], p = [], f = e.startRow - n.startRow, w = e.startColumn - n.startColumn, I = u.map((v) => {
|
|
1727
|
+
const C = v.sheetTransform, _ = {
|
|
1728
|
+
to: { ...C.to, row: C.to.row + f, column: C.to.column + w },
|
|
1729
|
+
from: { ...C.from, row: C.from.row + f, column: C.from.column + w }
|
|
1730
|
+
}, y = z(_, this._selectionRenderService, this._skeletonManagerService);
|
|
1731
1731
|
return {
|
|
1732
1732
|
unitId: r,
|
|
1733
1733
|
subUnitId: s,
|
|
1734
1734
|
drawingId: v.drawingId,
|
|
1735
|
-
transform:
|
|
1736
|
-
sheetTransform:
|
|
1735
|
+
transform: y,
|
|
1736
|
+
sheetTransform: _
|
|
1737
1737
|
};
|
|
1738
1738
|
});
|
|
1739
|
-
if (
|
|
1740
|
-
const v = this._sheetDrawingService.getBatchUpdateOp(
|
|
1741
|
-
|
|
1739
|
+
if (I.length) {
|
|
1740
|
+
const v = this._sheetDrawingService.getBatchUpdateOp(I), { undo: C, redo: _, objects: y } = v;
|
|
1741
|
+
m.push({ id: T.id, params: { unitId: r, subUnitId: s, op: _, objects: y, type: E.UPDATE } }), p.push({ id: T.id, params: { unitId: r, subUnitId: s, op: C, objects: y, type: E.UPDATE } });
|
|
1742
1742
|
}
|
|
1743
|
-
return { redos:
|
|
1743
|
+
return { redos: m, undos: p };
|
|
1744
1744
|
}
|
|
1745
1745
|
_moveRowInterceptor(i, e) {
|
|
1746
1746
|
const n = this._getUnitIdAndSubUnitId(i, e);
|
|
1747
1747
|
if (n == null)
|
|
1748
1748
|
return { redos: [], undos: [] };
|
|
1749
|
-
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, c = s.endRow, d = [], g = [], a = this._sheetDrawingService.getDrawingData(t, r), l = [],
|
|
1750
|
-
if (Object.keys(a).forEach((
|
|
1751
|
-
const
|
|
1752
|
-
if (p == null ||
|
|
1749
|
+
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, c = s.endRow, d = [], g = [], a = this._sheetDrawingService.getDrawingData(t, r), l = [], h = [];
|
|
1750
|
+
if (Object.keys(a).forEach((u) => {
|
|
1751
|
+
const m = a[u], { sheetTransform: p, transform: f, anchorType: w = O.Position } = m;
|
|
1752
|
+
if (p == null || f == null)
|
|
1753
1753
|
return;
|
|
1754
|
-
let
|
|
1754
|
+
let I, S;
|
|
1755
1755
|
if (e === "insert") {
|
|
1756
|
-
const v = this._expandRow(p,
|
|
1757
|
-
|
|
1756
|
+
const v = this._expandRow(p, f, o, c, w);
|
|
1757
|
+
I = v == null ? void 0 : v.newSheetTransform, S = v == null ? void 0 : v.newTransform;
|
|
1758
1758
|
} else {
|
|
1759
|
-
const { from: v, to:
|
|
1760
|
-
if (
|
|
1761
|
-
|
|
1759
|
+
const { from: v, to: C } = p, { row: _ } = v, { row: y } = C;
|
|
1760
|
+
if (w === O.Both && _ >= o && y <= c)
|
|
1761
|
+
h.push({ unitId: t, subUnitId: r, drawingId: u });
|
|
1762
1762
|
else {
|
|
1763
|
-
const M = this._shrinkRow(p,
|
|
1764
|
-
|
|
1763
|
+
const M = this._shrinkRow(p, f, o, c, w);
|
|
1764
|
+
I = M == null ? void 0 : M.newSheetTransform, S = M == null ? void 0 : M.newTransform;
|
|
1765
1765
|
}
|
|
1766
1766
|
}
|
|
1767
|
-
if (!
|
|
1767
|
+
if (!I || !S)
|
|
1768
1768
|
return;
|
|
1769
|
-
const
|
|
1770
|
-
l.push(
|
|
1771
|
-
}), l.length === 0 &&
|
|
1769
|
+
const R = { unitId: t, subUnitId: r, drawingId: u, transform: S, sheetTransform: I };
|
|
1770
|
+
l.push(R);
|
|
1771
|
+
}), l.length === 0 && h.length === 0)
|
|
1772
1772
|
return { redos: [], undos: [] };
|
|
1773
1773
|
if (l.length > 0) {
|
|
1774
|
-
const
|
|
1775
|
-
d.push({ id: T.id, params: { unitId: t, subUnitId: r, op: p, objects:
|
|
1774
|
+
const u = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: p, objects: f } = u;
|
|
1775
|
+
d.push({ id: T.id, params: { unitId: t, subUnitId: r, op: p, objects: f, type: E.UPDATE } }), g.push({ id: T.id, params: { unitId: t, subUnitId: r, op: m, objects: f, type: E.UPDATE } });
|
|
1776
1776
|
}
|
|
1777
|
-
if (
|
|
1778
|
-
const
|
|
1779
|
-
d.push({ id: T.id, params: { unitId: t, subUnitId: r, op: p, objects:
|
|
1777
|
+
if (h.length > 0) {
|
|
1778
|
+
const u = this._sheetDrawingService.getBatchRemoveOp(h), m = u.undo, p = u.redo, f = u.objects;
|
|
1779
|
+
d.push({ id: T.id, params: { unitId: t, subUnitId: r, op: p, objects: f, type: E.REMOVE } }), g.push({ id: T.id, params: { unitId: t, subUnitId: r, op: m, objects: f, type: E.INSERT } });
|
|
1780
1780
|
}
|
|
1781
|
-
return d.push({ id:
|
|
1781
|
+
return d.push({ id: F.id, params: [t] }), g.push({ id: F.id, params: [t] }), {
|
|
1782
1782
|
redos: d,
|
|
1783
1783
|
undos: g
|
|
1784
1784
|
};
|
|
@@ -1787,62 +1787,62 @@ let tn = class extends se {
|
|
|
1787
1787
|
const n = this._getUnitIdAndSubUnitId(i, e);
|
|
1788
1788
|
if (n == null)
|
|
1789
1789
|
return { redos: [], undos: [] };
|
|
1790
|
-
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, c = s.endColumn, d = [], g = [], a = this._sheetDrawingService.getDrawingData(t, r), l = [],
|
|
1791
|
-
if (Object.keys(a).forEach((
|
|
1792
|
-
const
|
|
1793
|
-
if (p == null ||
|
|
1790
|
+
const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, c = s.endColumn, d = [], g = [], a = this._sheetDrawingService.getDrawingData(t, r), l = [], h = [];
|
|
1791
|
+
if (Object.keys(a).forEach((u) => {
|
|
1792
|
+
const m = a[u], { sheetTransform: p, transform: f, anchorType: w = O.Position } = m;
|
|
1793
|
+
if (p == null || f == null)
|
|
1794
1794
|
return;
|
|
1795
|
-
let
|
|
1795
|
+
let I, S;
|
|
1796
1796
|
if (e === "insert") {
|
|
1797
|
-
const v = this._expandCol(p,
|
|
1798
|
-
|
|
1797
|
+
const v = this._expandCol(p, f, o, c, w);
|
|
1798
|
+
I = v == null ? void 0 : v.newSheetTransform, S = v == null ? void 0 : v.newTransform;
|
|
1799
1799
|
} else {
|
|
1800
|
-
const { from: v, to:
|
|
1801
|
-
if (
|
|
1802
|
-
|
|
1800
|
+
const { from: v, to: C } = p, { column: _ } = v, { column: y } = C;
|
|
1801
|
+
if (w === O.Both && _ >= o && y <= c)
|
|
1802
|
+
h.push({ unitId: t, subUnitId: r, drawingId: u });
|
|
1803
1803
|
else {
|
|
1804
|
-
const M = this._shrinkCol(p,
|
|
1805
|
-
|
|
1804
|
+
const M = this._shrinkCol(p, f, o, c, w);
|
|
1805
|
+
I = M == null ? void 0 : M.newSheetTransform, S = M == null ? void 0 : M.newTransform;
|
|
1806
1806
|
}
|
|
1807
1807
|
}
|
|
1808
|
-
if (!
|
|
1808
|
+
if (!I || !S)
|
|
1809
1809
|
return;
|
|
1810
|
-
const
|
|
1811
|
-
l.push(
|
|
1812
|
-
}), l.length === 0 &&
|
|
1810
|
+
const R = { unitId: t, subUnitId: r, drawingId: u, transform: S, sheetTransform: I };
|
|
1811
|
+
l.push(R);
|
|
1812
|
+
}), l.length === 0 && h.length === 0)
|
|
1813
1813
|
return { redos: [], undos: [] };
|
|
1814
1814
|
if (l.length > 0) {
|
|
1815
|
-
const
|
|
1816
|
-
d.push({ id: T.id, params: { unitId: t, subUnitId: r, op: p, objects:
|
|
1815
|
+
const u = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: p, objects: f } = u;
|
|
1816
|
+
d.push({ id: T.id, params: { unitId: t, subUnitId: r, op: p, objects: f, type: E.UPDATE } }), g.push({ id: T.id, params: { unitId: t, subUnitId: r, op: m, objects: f, type: E.UPDATE } });
|
|
1817
1817
|
}
|
|
1818
|
-
if (
|
|
1819
|
-
const
|
|
1820
|
-
d.push({ id: T.id, params: { unitId: t, subUnitId: r, op: p, objects:
|
|
1818
|
+
if (h.length > 0) {
|
|
1819
|
+
const u = this._sheetDrawingService.getBatchRemoveOp(h), m = u.undo, p = u.redo, f = u.objects;
|
|
1820
|
+
d.push({ id: T.id, params: { unitId: t, subUnitId: r, op: p, objects: f, type: E.REMOVE } }), g.push({ id: T.id, params: { unitId: t, subUnitId: r, op: m, objects: f, type: E.INSERT } });
|
|
1821
1821
|
}
|
|
1822
|
-
return d.push({ id:
|
|
1822
|
+
return d.push({ id: F.id, params: [t] }), g.push({ id: F.id, params: [t] }), { redos: d, undos: g };
|
|
1823
1823
|
}
|
|
1824
|
-
_expandCol(i, e, n, t, r =
|
|
1824
|
+
_expandCol(i, e, n, t, r = O.Position) {
|
|
1825
1825
|
const s = t - n + 1, { from: o, to: c } = i, { column: d } = o, { column: g } = c;
|
|
1826
|
-
if (r ===
|
|
1826
|
+
if (r === O.None)
|
|
1827
1827
|
return {
|
|
1828
|
-
newSheetTransform:
|
|
1828
|
+
newSheetTransform: k({ ...e }, this._selectionRenderService),
|
|
1829
1829
|
newTransform: e
|
|
1830
1830
|
};
|
|
1831
1831
|
let a = null, l = null;
|
|
1832
1832
|
if (d >= n) {
|
|
1833
|
-
const
|
|
1834
|
-
if (
|
|
1833
|
+
const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: c.row });
|
|
1834
|
+
if (h == null)
|
|
1835
1835
|
return;
|
|
1836
|
-
l = { ...e, left: (e.left || 0) +
|
|
1836
|
+
l = { ...e, left: (e.left || 0) + h.endX - h.startX }, a = k(l, this._selectionRenderService);
|
|
1837
1837
|
} else if (g >= t)
|
|
1838
|
-
if (r ===
|
|
1838
|
+
if (r === O.Both)
|
|
1839
1839
|
a = {
|
|
1840
1840
|
from: { ...o },
|
|
1841
1841
|
to: { ...c, column: g + s }
|
|
1842
|
-
}, l =
|
|
1842
|
+
}, l = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
1843
1843
|
else
|
|
1844
1844
|
return {
|
|
1845
|
-
newSheetTransform:
|
|
1845
|
+
newSheetTransform: k({ ...e }, this._selectionRenderService),
|
|
1846
1846
|
newTransform: e
|
|
1847
1847
|
};
|
|
1848
1848
|
return a != null && l != null ? {
|
|
@@ -1850,11 +1850,11 @@ let tn = class extends se {
|
|
|
1850
1850
|
newTransform: l
|
|
1851
1851
|
} : null;
|
|
1852
1852
|
}
|
|
1853
|
-
_shrinkCol(i, e, n, t, r =
|
|
1853
|
+
_shrinkCol(i, e, n, t, r = O.Position) {
|
|
1854
1854
|
const s = t - n + 1, { from: o, to: c } = i, { column: d } = o, { column: g } = c;
|
|
1855
|
-
if (r ===
|
|
1855
|
+
if (r === O.None)
|
|
1856
1856
|
return {
|
|
1857
|
-
newSheetTransform:
|
|
1857
|
+
newSheetTransform: k({ ...e }, this._selectionRenderService),
|
|
1858
1858
|
newTransform: e
|
|
1859
1859
|
};
|
|
1860
1860
|
let a = null, l = null;
|
|
@@ -1862,44 +1862,44 @@ let tn = class extends se {
|
|
|
1862
1862
|
a = {
|
|
1863
1863
|
from: { ...o, column: d - s },
|
|
1864
1864
|
to: { ...c, column: g - s }
|
|
1865
|
-
}, l =
|
|
1865
|
+
}, l = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
1866
1866
|
else {
|
|
1867
1867
|
if (d >= n && g <= t)
|
|
1868
1868
|
return null;
|
|
1869
1869
|
if (d < n && g > t)
|
|
1870
|
-
if (r ===
|
|
1870
|
+
if (r === O.Both)
|
|
1871
1871
|
a = {
|
|
1872
1872
|
from: { ...o },
|
|
1873
1873
|
to: { ...c, column: g - s }
|
|
1874
|
-
}, l =
|
|
1874
|
+
}, l = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
1875
1875
|
else
|
|
1876
1876
|
return {
|
|
1877
|
-
newSheetTransform:
|
|
1877
|
+
newSheetTransform: k({ ...e }, this._selectionRenderService),
|
|
1878
1878
|
newTransform: e
|
|
1879
1879
|
};
|
|
1880
1880
|
else if (d >= n && d <= t) {
|
|
1881
1881
|
if (d === n)
|
|
1882
1882
|
l = { ...e, left: (e.left || 0) - i.from.columnOffset };
|
|
1883
1883
|
else {
|
|
1884
|
-
const
|
|
1885
|
-
if (
|
|
1884
|
+
const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: d - 1, startRow: o.row, endRow: c.row });
|
|
1885
|
+
if (h == null)
|
|
1886
1886
|
return;
|
|
1887
|
-
l = { ...e, left: (e.left || 0) -
|
|
1887
|
+
l = { ...e, left: (e.left || 0) - h.endX + h.startX - i.from.columnOffset };
|
|
1888
1888
|
}
|
|
1889
|
-
a =
|
|
1890
|
-
} else if (g >= n && g <= t && r ===
|
|
1891
|
-
const
|
|
1889
|
+
a = k(l, this._selectionRenderService);
|
|
1890
|
+
} else if (g >= n && g <= t && r === O.Both) {
|
|
1891
|
+
const h = this._skeletonManagerService.attachRangeWithCoord({
|
|
1892
1892
|
startColumn: n - 1,
|
|
1893
1893
|
endColumn: n - 1,
|
|
1894
1894
|
startRow: o.row,
|
|
1895
1895
|
endRow: c.row
|
|
1896
1896
|
});
|
|
1897
|
-
if (
|
|
1897
|
+
if (h == null)
|
|
1898
1898
|
return;
|
|
1899
1899
|
a = {
|
|
1900
1900
|
from: { ...o },
|
|
1901
|
-
to: { ...c, column: n - 1, columnOffset:
|
|
1902
|
-
}, l =
|
|
1901
|
+
to: { ...c, column: n - 1, columnOffset: h.endX - h.startX }
|
|
1902
|
+
}, l = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
1903
1903
|
}
|
|
1904
1904
|
}
|
|
1905
1905
|
return a != null && l != null ? {
|
|
@@ -1907,31 +1907,31 @@ let tn = class extends se {
|
|
|
1907
1907
|
newTransform: l
|
|
1908
1908
|
} : null;
|
|
1909
1909
|
}
|
|
1910
|
-
_expandRow(i, e, n, t, r =
|
|
1910
|
+
_expandRow(i, e, n, t, r = O.Position) {
|
|
1911
1911
|
const s = t - n + 1, { from: o, to: c } = i, { row: d } = o, { row: g } = c;
|
|
1912
|
-
if (r ===
|
|
1912
|
+
if (r === O.None)
|
|
1913
1913
|
return {
|
|
1914
|
-
newSheetTransform:
|
|
1914
|
+
newSheetTransform: k({ ...e }, this._selectionRenderService),
|
|
1915
1915
|
newTransform: e
|
|
1916
1916
|
};
|
|
1917
1917
|
let a = null, l = null;
|
|
1918
1918
|
if (d >= n) {
|
|
1919
|
-
const
|
|
1920
|
-
if (
|
|
1919
|
+
const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: c.column });
|
|
1920
|
+
if (h == null)
|
|
1921
1921
|
return;
|
|
1922
|
-
l = { ...e, top: (e.top || 0) +
|
|
1922
|
+
l = { ...e, top: (e.top || 0) + h.endY - h.startY }, a = k(l, this._selectionRenderService);
|
|
1923
1923
|
} else if (g >= t)
|
|
1924
|
-
if (r ===
|
|
1924
|
+
if (r === O.Both)
|
|
1925
1925
|
a = {
|
|
1926
1926
|
from: { ...o },
|
|
1927
1927
|
to: {
|
|
1928
1928
|
...c,
|
|
1929
1929
|
row: g + s
|
|
1930
1930
|
}
|
|
1931
|
-
}, l =
|
|
1931
|
+
}, l = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
1932
1932
|
else
|
|
1933
1933
|
return {
|
|
1934
|
-
newSheetTransform:
|
|
1934
|
+
newSheetTransform: k({ ...e }, this._selectionRenderService),
|
|
1935
1935
|
newTransform: e
|
|
1936
1936
|
};
|
|
1937
1937
|
return a != null && l != null ? {
|
|
@@ -1939,11 +1939,11 @@ let tn = class extends se {
|
|
|
1939
1939
|
newTransform: l
|
|
1940
1940
|
} : null;
|
|
1941
1941
|
}
|
|
1942
|
-
_shrinkRow(i, e, n, t, r =
|
|
1942
|
+
_shrinkRow(i, e, n, t, r = O.Position) {
|
|
1943
1943
|
const s = t - n + 1, { from: o, to: c } = i, { row: d } = o, { row: g } = c;
|
|
1944
|
-
if (r ===
|
|
1944
|
+
if (r === O.None)
|
|
1945
1945
|
return {
|
|
1946
|
-
newSheetTransform:
|
|
1946
|
+
newSheetTransform: k({ ...e }, this._selectionRenderService),
|
|
1947
1947
|
newTransform: e
|
|
1948
1948
|
};
|
|
1949
1949
|
let a = null, l = null;
|
|
@@ -1951,39 +1951,39 @@ let tn = class extends se {
|
|
|
1951
1951
|
a = {
|
|
1952
1952
|
from: { ...o, row: d - s },
|
|
1953
1953
|
to: { ...c, row: g - s }
|
|
1954
|
-
}, l =
|
|
1954
|
+
}, l = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
1955
1955
|
else {
|
|
1956
1956
|
if (d >= n && g <= t)
|
|
1957
1957
|
return null;
|
|
1958
1958
|
if (d < n && g > t)
|
|
1959
|
-
if (r ===
|
|
1959
|
+
if (r === O.Both)
|
|
1960
1960
|
a = {
|
|
1961
1961
|
from: { ...o },
|
|
1962
1962
|
to: { ...c, row: g - s }
|
|
1963
|
-
}, l =
|
|
1963
|
+
}, l = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
1964
1964
|
else
|
|
1965
1965
|
return {
|
|
1966
|
-
newSheetTransform:
|
|
1966
|
+
newSheetTransform: k({ ...e }, this._selectionRenderService),
|
|
1967
1967
|
newTransform: e
|
|
1968
1968
|
};
|
|
1969
1969
|
else if (d >= n && d <= t) {
|
|
1970
1970
|
if (d === n)
|
|
1971
1971
|
l = { ...e, top: (e.top || 0) - i.from.rowOffset };
|
|
1972
1972
|
else {
|
|
1973
|
-
const
|
|
1974
|
-
if (
|
|
1973
|
+
const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: d - 1, startColumn: o.column, endColumn: c.column });
|
|
1974
|
+
if (h == null)
|
|
1975
1975
|
return;
|
|
1976
|
-
l = { ...e, top: (e.top || 0) -
|
|
1976
|
+
l = { ...e, top: (e.top || 0) - h.endY + h.startY - i.from.rowOffset };
|
|
1977
1977
|
}
|
|
1978
|
-
a =
|
|
1979
|
-
} else if (g >= n && g <= t && r ===
|
|
1980
|
-
const
|
|
1981
|
-
if (
|
|
1978
|
+
a = k(l, this._selectionRenderService);
|
|
1979
|
+
} else if (g >= n && g <= t && r === O.Both) {
|
|
1980
|
+
const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
|
|
1981
|
+
if (h == null)
|
|
1982
1982
|
return;
|
|
1983
1983
|
a = {
|
|
1984
1984
|
from: { ...o },
|
|
1985
|
-
to: { ...c, row: n - 1, rowOffset:
|
|
1986
|
-
}, l =
|
|
1985
|
+
to: { ...c, row: n - 1, rowOffset: h.endY - h.startY }
|
|
1986
|
+
}, l = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
1987
1987
|
}
|
|
1988
1988
|
}
|
|
1989
1989
|
return a != null && l != null ? {
|
|
@@ -1994,7 +1994,7 @@ let tn = class extends se {
|
|
|
1994
1994
|
_commandListener() {
|
|
1995
1995
|
this.disposeWithMe(
|
|
1996
1996
|
this._commandService.onCommandExecuted((i) => {
|
|
1997
|
-
i.id ===
|
|
1997
|
+
i.id === Bi.id && setTimeout(() => {
|
|
1998
1998
|
const e = i.params, { unitId: n, subUnitId: t } = e, r = this._drawingManagerService.drawingManagerData, s = [], o = [];
|
|
1999
1999
|
Object.keys(r).forEach((c) => {
|
|
2000
2000
|
const d = r[c];
|
|
@@ -2002,8 +2002,8 @@ let tn = class extends se {
|
|
|
2002
2002
|
const a = d[g].data;
|
|
2003
2003
|
a != null && Object.keys(a).forEach((l) => {
|
|
2004
2004
|
if (c === n && g === t) {
|
|
2005
|
-
const
|
|
2006
|
-
|
|
2005
|
+
const h = a[l];
|
|
2006
|
+
h.transform = z(h.sheetTransform, this._selectionRenderService, this._skeletonManagerService), s.push(a[l]);
|
|
2007
2007
|
} else
|
|
2008
2008
|
o.push(a[l]);
|
|
2009
2009
|
});
|
|
@@ -2016,7 +2016,7 @@ let tn = class extends se {
|
|
|
2016
2016
|
_sheetRefreshListener() {
|
|
2017
2017
|
this.disposeWithMe(
|
|
2018
2018
|
this._commandService.onCommandExecuted((i) => {
|
|
2019
|
-
|
|
2019
|
+
js.includes(i.id) && requestIdleCallback(() => {
|
|
2020
2020
|
const e = i.params, { unitId: n, subUnitId: t, ranges: r } = e;
|
|
2021
2021
|
this._refreshDrawingTransform(n, t, r);
|
|
2022
2022
|
});
|
|
@@ -2026,51 +2026,51 @@ let tn = class extends se {
|
|
|
2026
2026
|
_refreshDrawingTransform(i, e, n) {
|
|
2027
2027
|
const t = this._drawingManagerService.getDrawingData(i, e), r = [];
|
|
2028
2028
|
Object.keys(t).forEach((s) => {
|
|
2029
|
-
const o = t[s], { sheetTransform: c, transform: d, anchorType: g =
|
|
2030
|
-
if (g ===
|
|
2029
|
+
const o = t[s], { sheetTransform: c, transform: d, anchorType: g = O.Position } = o;
|
|
2030
|
+
if (g === O.None)
|
|
2031
2031
|
return !0;
|
|
2032
|
-
const { from: a, to: l } = c, { row:
|
|
2033
|
-
for (let
|
|
2034
|
-
const
|
|
2035
|
-
if (
|
|
2032
|
+
const { from: a, to: l } = c, { row: h, column: u } = a, { row: m, column: p } = l;
|
|
2033
|
+
for (let f = 0; f < n.length; f++) {
|
|
2034
|
+
const w = n[f], { startRow: I, endRow: S, startColumn: R, endColumn: v } = w;
|
|
2035
|
+
if (Wr.intersects(
|
|
2036
2036
|
{
|
|
2037
|
-
startRow:
|
|
2038
|
-
endRow:
|
|
2039
|
-
startColumn:
|
|
2037
|
+
startRow: I,
|
|
2038
|
+
endRow: S,
|
|
2039
|
+
startColumn: R,
|
|
2040
2040
|
endColumn: v
|
|
2041
2041
|
},
|
|
2042
2042
|
{
|
|
2043
|
-
startRow:
|
|
2044
|
-
endRow:
|
|
2045
|
-
startColumn:
|
|
2043
|
+
startRow: h,
|
|
2044
|
+
endRow: m,
|
|
2045
|
+
startColumn: u,
|
|
2046
2046
|
endColumn: p
|
|
2047
2047
|
}
|
|
2048
|
-
) ||
|
|
2049
|
-
const
|
|
2048
|
+
) || h > S || u > v) {
|
|
2049
|
+
const C = g === O.Position, _ = z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
2050
2050
|
r.push({
|
|
2051
2051
|
...o,
|
|
2052
2052
|
transform: {
|
|
2053
|
-
...
|
|
2054
|
-
width:
|
|
2055
|
-
height:
|
|
2053
|
+
..._,
|
|
2054
|
+
width: C ? d == null ? void 0 : d.width : _ == null ? void 0 : _.width,
|
|
2055
|
+
height: C ? d == null ? void 0 : d.height : _ == null ? void 0 : _.height
|
|
2056
2056
|
}
|
|
2057
2057
|
});
|
|
2058
2058
|
break;
|
|
2059
2059
|
}
|
|
2060
2060
|
}
|
|
2061
|
-
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(
|
|
2061
|
+
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(F.id, [i]));
|
|
2062
2062
|
}
|
|
2063
2063
|
};
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
],
|
|
2064
|
+
sn = As([
|
|
2065
|
+
pe(1, Q),
|
|
2066
|
+
pe(2, H),
|
|
2067
|
+
pe(3, Qe),
|
|
2068
|
+
pe(4, N(Z)),
|
|
2069
|
+
pe(5, N(At)),
|
|
2070
|
+
pe(6, ee),
|
|
2071
|
+
pe(7, ae),
|
|
2072
|
+
pe(8, $e)
|
|
2073
|
+
], sn);
|
|
2074
2074
|
var ne = function() {
|
|
2075
2075
|
return ne = Object.assign || function(i) {
|
|
2076
2076
|
for (var e, n = 1, t = arguments.length; n < t; n++) {
|
|
@@ -2079,23 +2079,23 @@ var ne = function() {
|
|
|
2079
2079
|
}
|
|
2080
2080
|
return i;
|
|
2081
2081
|
}, ne.apply(this, arguments);
|
|
2082
|
-
},
|
|
2082
|
+
}, Ws = function(i, e) {
|
|
2083
2083
|
var n = {};
|
|
2084
2084
|
for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
|
|
2085
2085
|
if (i != null && typeof Object.getOwnPropertySymbols == "function")
|
|
2086
2086
|
for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
|
|
2087
2087
|
e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
|
|
2088
2088
|
return n;
|
|
2089
|
-
},
|
|
2090
|
-
var n = i.icon, t = i.id, r = i.className, s = i.extend, o =
|
|
2091
|
-
return
|
|
2089
|
+
}, lr = tr(function(i, e) {
|
|
2090
|
+
var n = i.icon, t = i.id, r = i.className, s = i.extend, o = Ws(i, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = Fi("_".concat($s()));
|
|
2091
|
+
return ur(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, ne({ ref: e, className: c }, o), s);
|
|
2092
2092
|
});
|
|
2093
|
-
function
|
|
2094
|
-
return
|
|
2095
|
-
return
|
|
2093
|
+
function ur(i, e, n, t, r) {
|
|
2094
|
+
return nr(i.tag, ne(ne({ key: e }, xs(i, n, r)), t), (Bs(i, n).children || []).map(function(s, o) {
|
|
2095
|
+
return ur(s, "".concat(e, "-").concat(i.tag, "-").concat(o), n, void 0, r);
|
|
2096
2096
|
}));
|
|
2097
2097
|
}
|
|
2098
|
-
function
|
|
2098
|
+
function xs(i, e, n) {
|
|
2099
2099
|
var t = ne({}, i.attrs);
|
|
2100
2100
|
n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
|
|
2101
2101
|
var r = e.defIds;
|
|
@@ -2104,29 +2104,29 @@ function Ns(i, e, n) {
|
|
|
2104
2104
|
typeof c == "string" && (t[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
2105
2105
|
})), t;
|
|
2106
2106
|
}
|
|
2107
|
-
function
|
|
2107
|
+
function Bs(i, e) {
|
|
2108
2108
|
var n, t = e.defIds;
|
|
2109
2109
|
return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? ne(ne({}, i), { children: i.children.map(function(r) {
|
|
2110
2110
|
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? ne(ne({}, r), { attrs: ne(ne({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
|
|
2111
2111
|
}) }) : i;
|
|
2112
2112
|
}
|
|
2113
|
-
function
|
|
2113
|
+
function $s() {
|
|
2114
2114
|
return Math.random().toString(36).substring(2, 8);
|
|
2115
2115
|
}
|
|
2116
|
-
|
|
2117
|
-
var
|
|
2118
|
-
return
|
|
2116
|
+
lr.displayName = "UniverIcon";
|
|
2117
|
+
var ks = { 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" } }] }, hr = tr(function(i, e) {
|
|
2118
|
+
return nr(lr, Object.assign({}, i, {
|
|
2119
2119
|
id: "add-image-single",
|
|
2120
2120
|
ref: e,
|
|
2121
|
-
icon:
|
|
2121
|
+
icon: ks
|
|
2122
2122
|
}));
|
|
2123
2123
|
});
|
|
2124
|
-
|
|
2125
|
-
const
|
|
2124
|
+
hr.displayName = "AddImageSingle";
|
|
2125
|
+
const gr = {
|
|
2126
2126
|
id: "sheet.command.delete-drawing",
|
|
2127
|
-
type:
|
|
2127
|
+
type: q.COMMAND,
|
|
2128
2128
|
handler: (i) => {
|
|
2129
|
-
const e = i.get(H), t = i.get(
|
|
2129
|
+
const e = i.get(H), t = i.get(ee).getFocusDrawings();
|
|
2130
2130
|
if (t.length === 0)
|
|
2131
2131
|
return !1;
|
|
2132
2132
|
const r = t[0].unitId, s = t.map((o) => {
|
|
@@ -2138,295 +2138,295 @@ const lr = {
|
|
|
2138
2138
|
drawingType: a
|
|
2139
2139
|
};
|
|
2140
2140
|
});
|
|
2141
|
-
return e.executeCommand(
|
|
2141
|
+
return e.executeCommand(Nt.id, {
|
|
2142
2142
|
unitId: r,
|
|
2143
2143
|
drawings: s
|
|
2144
2144
|
});
|
|
2145
2145
|
}
|
|
2146
|
-
},
|
|
2146
|
+
}, cn = {
|
|
2147
2147
|
id: "sheet.command.insert-float-image",
|
|
2148
|
-
type:
|
|
2148
|
+
type: q.COMMAND,
|
|
2149
2149
|
handler: (i) => {
|
|
2150
2150
|
var n, t;
|
|
2151
|
-
return (t = (n = i.get(
|
|
2151
|
+
return (t = (n = i.get(Q).getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : n.with(Ze).insertFloatImage()) != null ? t : !1;
|
|
2152
2152
|
}
|
|
2153
|
-
},
|
|
2153
|
+
}, dn = {
|
|
2154
2154
|
id: "sheet.command.insert-cell-image",
|
|
2155
|
-
type:
|
|
2155
|
+
type: q.COMMAND,
|
|
2156
2156
|
handler: (i) => {
|
|
2157
2157
|
var n, t;
|
|
2158
|
-
return (t = (n = i.get(
|
|
2158
|
+
return (t = (n = i.get(Q).getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : n.with(Ze).insertCellImage()) != null ? t : !1;
|
|
2159
2159
|
}
|
|
2160
|
-
},
|
|
2160
|
+
}, et = {
|
|
2161
2161
|
id: "sheet.command.move-drawing",
|
|
2162
|
-
type:
|
|
2162
|
+
type: q.COMMAND,
|
|
2163
2163
|
handler: (i, e) => {
|
|
2164
|
-
const n = i.get(H), t = i.get(
|
|
2164
|
+
const n = i.get(H), t = i.get(ee), r = i.get(Qe), { direction: s } = e, o = t.getFocusDrawings();
|
|
2165
2165
|
if (o.length === 0)
|
|
2166
2166
|
return !1;
|
|
2167
2167
|
const c = o[0].unitId, d = o.map((a) => {
|
|
2168
2168
|
const { transform: l } = a;
|
|
2169
2169
|
if (l == null)
|
|
2170
2170
|
return null;
|
|
2171
|
-
const
|
|
2172
|
-
return s ===
|
|
2171
|
+
const h = { ...l }, { left: u = 0, top: m = 0 } = l;
|
|
2172
|
+
return s === _e.UP ? h.top = m - 1 : s === _e.DOWN ? h.top = m + 1 : s === _e.LEFT ? h.left = u - 1 : s === _e.RIGHT && (h.left = u + 1), {
|
|
2173
2173
|
...a,
|
|
2174
|
-
transform:
|
|
2175
|
-
sheetTransform:
|
|
2174
|
+
transform: h,
|
|
2175
|
+
sheetTransform: k(h, r)
|
|
2176
2176
|
};
|
|
2177
2177
|
}).filter((a) => a != null);
|
|
2178
|
-
return n.syncExecuteCommand(
|
|
2178
|
+
return n.syncExecuteCommand(Wt.id, {
|
|
2179
2179
|
unitId: c,
|
|
2180
2180
|
drawings: d
|
|
2181
|
-
}) ? (n.syncExecuteCommand(
|
|
2181
|
+
}) ? (n.syncExecuteCommand(F.id, [c]), !0) : !1;
|
|
2182
2182
|
}
|
|
2183
|
-
},
|
|
2184
|
-
function
|
|
2183
|
+
}, mr = "addition-and-subtraction-single", fr = "sheet.menu.image";
|
|
2184
|
+
function Ls(i) {
|
|
2185
2185
|
return {
|
|
2186
|
-
id:
|
|
2187
|
-
type:
|
|
2188
|
-
icon:
|
|
2186
|
+
id: fr,
|
|
2187
|
+
type: on.SUBITEMS,
|
|
2188
|
+
icon: mr,
|
|
2189
2189
|
tooltip: "sheetImage.title",
|
|
2190
|
-
hidden$:
|
|
2191
|
-
disabled$:
|
|
2190
|
+
hidden$: Un(i, Y.UNIVER_SHEET),
|
|
2191
|
+
disabled$: mi(i, { workbookTypes: [qt], worksheetTypes: [St], rangeTypes: [$i] })
|
|
2192
2192
|
};
|
|
2193
2193
|
}
|
|
2194
|
-
function
|
|
2194
|
+
function Fs(i) {
|
|
2195
2195
|
return {
|
|
2196
|
-
id:
|
|
2196
|
+
id: cn.id,
|
|
2197
2197
|
title: "sheetImage.upload.float",
|
|
2198
|
-
type:
|
|
2199
|
-
hidden$:
|
|
2198
|
+
type: on.BUTTON,
|
|
2199
|
+
hidden$: Un(i, Y.UNIVER_SHEET)
|
|
2200
2200
|
};
|
|
2201
2201
|
}
|
|
2202
|
-
function
|
|
2202
|
+
function Gs(i) {
|
|
2203
2203
|
return {
|
|
2204
|
-
id:
|
|
2204
|
+
id: dn.id,
|
|
2205
2205
|
title: "sheetImage.upload.cell",
|
|
2206
|
-
type:
|
|
2206
|
+
type: on.BUTTON
|
|
2207
2207
|
};
|
|
2208
2208
|
}
|
|
2209
|
-
const
|
|
2210
|
-
imageCommonPanel:
|
|
2211
|
-
imageCommonPanelGrid:
|
|
2212
|
-
imageCommonPanelBorder:
|
|
2213
|
-
imageCommonPanelTitle:
|
|
2214
|
-
imageCommonPanelSubtitle:
|
|
2215
|
-
imageCommonPanelRow:
|
|
2216
|
-
imageCommonPanelRowVertical:
|
|
2217
|
-
imageCommonPanelColumn:
|
|
2218
|
-
imageCommonPanelColumnCenter:
|
|
2219
|
-
imageCommonPanelInline:
|
|
2220
|
-
imageCommonPanelSpan2:
|
|
2221
|
-
imageCommonPanelSpan3:
|
|
2222
|
-
imageCommonPanelInput:
|
|
2223
|
-
sheetImageMenu:
|
|
2224
|
-
sheetImageMenuInput:
|
|
2209
|
+
const Vs = "univer-image-common-panel", Ys = "univer-image-common-panel-grid", Hs = "univer-image-common-panel-border", Xs = "univer-image-common-panel-title", zs = "univer-image-common-panel-subtitle", Ks = "univer-image-common-panel-row", Js = "univer-image-common-panel-row-vertical", Zs = "univer-image-common-panel-column", qs = "univer-image-common-panel-column-center", Qs = "univer-image-common-panel-inline", eo = "univer-image-common-panel-span2", to = "univer-image-common-panel-span3", no = "univer-image-common-panel-input", ro = "univer-sheet-image-menu", io = "univer-sheet-image-menu-input", we = {
|
|
2210
|
+
imageCommonPanel: Vs,
|
|
2211
|
+
imageCommonPanelGrid: Ys,
|
|
2212
|
+
imageCommonPanelBorder: Hs,
|
|
2213
|
+
imageCommonPanelTitle: Xs,
|
|
2214
|
+
imageCommonPanelSubtitle: zs,
|
|
2215
|
+
imageCommonPanelRow: Ks,
|
|
2216
|
+
imageCommonPanelRowVertical: Js,
|
|
2217
|
+
imageCommonPanelColumn: Zs,
|
|
2218
|
+
imageCommonPanelColumnCenter: qs,
|
|
2219
|
+
imageCommonPanelInline: Qs,
|
|
2220
|
+
imageCommonPanelSpan2: eo,
|
|
2221
|
+
imageCommonPanelSpan3: to,
|
|
2222
|
+
imageCommonPanelInput: no,
|
|
2223
|
+
sheetImageMenu: ro,
|
|
2224
|
+
sheetImageMenuInput: io
|
|
2225
2225
|
};
|
|
2226
|
-
function
|
|
2226
|
+
function pr(i) {
|
|
2227
2227
|
var e, n, t = "";
|
|
2228
2228
|
if (typeof i == "string" || typeof i == "number") t += i;
|
|
2229
2229
|
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
2230
2230
|
var r = i.length;
|
|
2231
|
-
for (e = 0; e < r; e++) i[e] && (n =
|
|
2231
|
+
for (e = 0; e < r; e++) i[e] && (n = pr(i[e])) && (t && (t += " "), t += n);
|
|
2232
2232
|
} else for (n in i) i[n] && (t && (t += " "), t += n);
|
|
2233
2233
|
return t;
|
|
2234
2234
|
}
|
|
2235
|
-
function
|
|
2236
|
-
for (var i, e, n = 0, t = "", r = arguments.length; n < r; n++) (i = arguments[n]) && (e =
|
|
2235
|
+
function _t() {
|
|
2236
|
+
for (var i, e, n = 0, t = "", r = arguments.length; n < r; n++) (i = arguments[n]) && (e = pr(i)) && (t && (t += " "), t += e);
|
|
2237
2237
|
return t;
|
|
2238
2238
|
}
|
|
2239
|
-
const
|
|
2240
|
-
var
|
|
2241
|
-
const e =
|
|
2239
|
+
const so = (i) => {
|
|
2240
|
+
var S;
|
|
2241
|
+
const e = Ee(H), n = Ee(Pt), t = Ee(ae), r = Ee(Q), { drawings: s } = i, o = s[0];
|
|
2242
2242
|
if (o == null)
|
|
2243
2243
|
return;
|
|
2244
2244
|
const { unitId: c } = o, d = r.getRenderById(c), g = d == null ? void 0 : d.scene;
|
|
2245
2245
|
if (g == null)
|
|
2246
2246
|
return;
|
|
2247
|
-
const a = g.getTransformerByCreate(), [l,
|
|
2248
|
-
function
|
|
2249
|
-
const
|
|
2250
|
-
return
|
|
2251
|
-
const { oKey:
|
|
2247
|
+
const a = g.getTransformerByCreate(), [l, h] = tn(!0), u = (S = o.anchorType) != null ? S : O.Position, [m, p] = tn(u);
|
|
2248
|
+
function f(R, v) {
|
|
2249
|
+
const C = [];
|
|
2250
|
+
return R.forEach((_) => {
|
|
2251
|
+
const { oKey: y } = _, M = v.getDrawingOKey(y);
|
|
2252
2252
|
if (M == null)
|
|
2253
|
-
return
|
|
2254
|
-
const { unitId:
|
|
2255
|
-
|
|
2256
|
-
unitId:
|
|
2257
|
-
subUnitId:
|
|
2253
|
+
return C.push(null), !0;
|
|
2254
|
+
const { unitId: x, subUnitId: U, drawingId: D, drawingType: b, anchorType: P, sheetTransform: A } = M;
|
|
2255
|
+
C.push({
|
|
2256
|
+
unitId: x,
|
|
2257
|
+
subUnitId: U,
|
|
2258
2258
|
drawingId: D,
|
|
2259
|
-
anchorType:
|
|
2260
|
-
sheetTransform:
|
|
2261
|
-
drawingType:
|
|
2259
|
+
anchorType: P,
|
|
2260
|
+
sheetTransform: A,
|
|
2261
|
+
drawingType: b
|
|
2262
2262
|
});
|
|
2263
|
-
}),
|
|
2263
|
+
}), C;
|
|
2264
2264
|
}
|
|
2265
|
-
|
|
2266
|
-
const
|
|
2267
|
-
|
|
2268
|
-
}), v = a.changeStart$.subscribe((
|
|
2265
|
+
an(() => {
|
|
2266
|
+
const R = a.clearControl$.subscribe((C) => {
|
|
2267
|
+
C === !0 && h(!1);
|
|
2268
|
+
}), v = a.changeStart$.subscribe((C) => {
|
|
2269
2269
|
var M;
|
|
2270
|
-
const { objects:
|
|
2271
|
-
if (
|
|
2272
|
-
|
|
2273
|
-
else if (
|
|
2274
|
-
|
|
2275
|
-
const
|
|
2276
|
-
p(
|
|
2270
|
+
const { objects: _ } = C, y = f(_, t);
|
|
2271
|
+
if (y.length === 0)
|
|
2272
|
+
h(!1);
|
|
2273
|
+
else if (y.length >= 1) {
|
|
2274
|
+
h(!0);
|
|
2275
|
+
const x = ((M = y[0]) == null ? void 0 : M.anchorType) || O.Position;
|
|
2276
|
+
p(x);
|
|
2277
2277
|
}
|
|
2278
2278
|
});
|
|
2279
2279
|
return () => {
|
|
2280
|
-
v.unsubscribe(),
|
|
2280
|
+
v.unsubscribe(), R.unsubscribe();
|
|
2281
2281
|
};
|
|
2282
2282
|
}, []);
|
|
2283
|
-
function
|
|
2284
|
-
p(
|
|
2283
|
+
function w(R) {
|
|
2284
|
+
p(R);
|
|
2285
2285
|
const v = t.getFocusDrawings();
|
|
2286
2286
|
if (v.length === 0)
|
|
2287
2287
|
return;
|
|
2288
|
-
const
|
|
2289
|
-
unitId:
|
|
2290
|
-
subUnitId:
|
|
2291
|
-
drawingId:
|
|
2292
|
-
anchorType:
|
|
2288
|
+
const C = v.map((_) => ({
|
|
2289
|
+
unitId: _.unitId,
|
|
2290
|
+
subUnitId: _.subUnitId,
|
|
2291
|
+
drawingId: _.drawingId,
|
|
2292
|
+
anchorType: R
|
|
2293
2293
|
}));
|
|
2294
|
-
e.executeCommand(
|
|
2294
|
+
e.executeCommand(Wt.id, {
|
|
2295
2295
|
unitId: v[0].unitId,
|
|
2296
|
-
drawings:
|
|
2296
|
+
drawings: C
|
|
2297
2297
|
});
|
|
2298
2298
|
}
|
|
2299
|
-
const
|
|
2300
|
-
return /* @__PURE__ */ G.jsxs("div", { className:
|
|
2301
|
-
/* @__PURE__ */ G.jsx("div", { className:
|
|
2302
|
-
/* @__PURE__ */ G.jsx("div", { className:
|
|
2303
|
-
/* @__PURE__ */ G.jsx(
|
|
2304
|
-
/* @__PURE__ */ G.jsx(
|
|
2305
|
-
/* @__PURE__ */ G.jsx(
|
|
2299
|
+
const I = (R) => R ? "block" : "none";
|
|
2300
|
+
return /* @__PURE__ */ G.jsxs("div", { className: _t(we.imageCommonPanelGrid, we.imageCommonPanelBorder), style: { display: I(l) }, children: [
|
|
2301
|
+
/* @__PURE__ */ G.jsx("div", { className: we.imageCommonPanelRow, children: /* @__PURE__ */ G.jsx("div", { className: _t(we.imageCommonPanelColumn, we.imageCommonPanelTitle), children: /* @__PURE__ */ G.jsx("div", { children: n.t("drawing-anchor.title") }) }) }),
|
|
2302
|
+
/* @__PURE__ */ G.jsx("div", { className: _t(we.imageCommonPanelRow), children: /* @__PURE__ */ G.jsx("div", { className: _t(we.imageCommonPanelColumn), children: /* @__PURE__ */ G.jsxs(Yi, { value: m, onChange: w, direction: "vertical", children: [
|
|
2303
|
+
/* @__PURE__ */ G.jsx(zt, { value: O.Both, children: n.t("drawing-anchor.both") }),
|
|
2304
|
+
/* @__PURE__ */ G.jsx(zt, { value: O.Position, children: n.t("drawing-anchor.position") }),
|
|
2305
|
+
/* @__PURE__ */ G.jsx(zt, { value: O.None, children: n.t("drawing-anchor.none") })
|
|
2306
2306
|
] }) }) })
|
|
2307
2307
|
] });
|
|
2308
|
-
},
|
|
2309
|
-
const i =
|
|
2310
|
-
return
|
|
2308
|
+
}, oo = () => {
|
|
2309
|
+
const i = Ee(ae), e = i.getFocusDrawings(), [n, t] = tn(e);
|
|
2310
|
+
return an(() => {
|
|
2311
2311
|
const r = i.focus$.subscribe((s) => {
|
|
2312
2312
|
t(s);
|
|
2313
2313
|
});
|
|
2314
2314
|
return () => {
|
|
2315
2315
|
r.unsubscribe();
|
|
2316
2316
|
};
|
|
2317
|
-
}, []), !!(n != null && n.length) && /* @__PURE__ */ G.jsxs("div", { className:
|
|
2318
|
-
/* @__PURE__ */ G.jsx(
|
|
2319
|
-
/* @__PURE__ */ G.jsx(
|
|
2317
|
+
}, []), !!(n != null && n.length) && /* @__PURE__ */ G.jsxs("div", { className: we.imageCommonPanel, children: [
|
|
2318
|
+
/* @__PURE__ */ G.jsx(ti, { drawings: n }),
|
|
2319
|
+
/* @__PURE__ */ G.jsx(so, { drawings: n })
|
|
2320
2320
|
] });
|
|
2321
|
-
},
|
|
2322
|
-
[
|
|
2323
|
-
[
|
|
2321
|
+
}, ao = {
|
|
2322
|
+
[Ii.FORMULAS_INSERT]: {
|
|
2323
|
+
[fr]: {
|
|
2324
2324
|
order: 3,
|
|
2325
|
-
menuItemFactory:
|
|
2326
|
-
[
|
|
2325
|
+
menuItemFactory: Ls,
|
|
2326
|
+
[cn.id]: {
|
|
2327
2327
|
order: 0,
|
|
2328
|
-
menuItemFactory:
|
|
2328
|
+
menuItemFactory: Fs
|
|
2329
2329
|
},
|
|
2330
|
-
[
|
|
2330
|
+
[dn.id]: {
|
|
2331
2331
|
order: 1,
|
|
2332
|
-
menuItemFactory:
|
|
2332
|
+
menuItemFactory: Gs
|
|
2333
2333
|
}
|
|
2334
2334
|
}
|
|
2335
2335
|
}
|
|
2336
2336
|
};
|
|
2337
|
-
function
|
|
2338
|
-
return !i.getContextValue(
|
|
2337
|
+
function tt(i) {
|
|
2338
|
+
return !i.getContextValue(xr) && !i.getContextValue(Br) && !i.getContextValue($r) && i.getContextValue(We);
|
|
2339
2339
|
}
|
|
2340
|
-
const
|
|
2341
|
-
id:
|
|
2340
|
+
const co = {
|
|
2341
|
+
id: et.id,
|
|
2342
2342
|
description: "shortcut.sheet.drawing-move-down",
|
|
2343
2343
|
group: "4_sheet-drawing-view",
|
|
2344
|
-
binding:
|
|
2344
|
+
binding: xe.ARROW_DOWN,
|
|
2345
2345
|
priority: 100,
|
|
2346
|
-
preconditions:
|
|
2346
|
+
preconditions: tt,
|
|
2347
2347
|
staticParameters: {
|
|
2348
|
-
direction:
|
|
2348
|
+
direction: _e.DOWN
|
|
2349
2349
|
}
|
|
2350
|
-
},
|
|
2351
|
-
id:
|
|
2350
|
+
}, lo = {
|
|
2351
|
+
id: et.id,
|
|
2352
2352
|
description: "shortcut.sheet.drawing-move-up",
|
|
2353
2353
|
group: "4_sheet-drawing-view",
|
|
2354
|
-
binding:
|
|
2354
|
+
binding: xe.ARROW_UP,
|
|
2355
2355
|
priority: 100,
|
|
2356
|
-
preconditions:
|
|
2356
|
+
preconditions: tt,
|
|
2357
2357
|
staticParameters: {
|
|
2358
|
-
direction:
|
|
2358
|
+
direction: _e.UP
|
|
2359
2359
|
}
|
|
2360
|
-
},
|
|
2361
|
-
id:
|
|
2360
|
+
}, uo = {
|
|
2361
|
+
id: et.id,
|
|
2362
2362
|
description: "shortcut.sheet.drawing-move-left",
|
|
2363
2363
|
group: "4_sheet-drawing-view",
|
|
2364
|
-
binding:
|
|
2364
|
+
binding: xe.ARROW_LEFT,
|
|
2365
2365
|
priority: 100,
|
|
2366
|
-
preconditions:
|
|
2366
|
+
preconditions: tt,
|
|
2367
2367
|
staticParameters: {
|
|
2368
|
-
direction:
|
|
2368
|
+
direction: _e.LEFT
|
|
2369
2369
|
}
|
|
2370
|
-
},
|
|
2371
|
-
id:
|
|
2370
|
+
}, ho = {
|
|
2371
|
+
id: et.id,
|
|
2372
2372
|
description: "shortcut.sheet.drawing-move-right",
|
|
2373
2373
|
group: "4_sheet-drawing-view",
|
|
2374
|
-
binding:
|
|
2374
|
+
binding: xe.ARROW_RIGHT,
|
|
2375
2375
|
priority: 100,
|
|
2376
|
-
preconditions:
|
|
2376
|
+
preconditions: tt,
|
|
2377
2377
|
staticParameters: {
|
|
2378
|
-
direction:
|
|
2378
|
+
direction: _e.RIGHT
|
|
2379
2379
|
}
|
|
2380
|
-
},
|
|
2381
|
-
id:
|
|
2380
|
+
}, go = {
|
|
2381
|
+
id: gr.id,
|
|
2382
2382
|
description: "shortcut.sheet.drawing-delete",
|
|
2383
2383
|
group: "4_sheet-drawing-view",
|
|
2384
2384
|
// when focusing on any other input tag do not trigger this shortcut
|
|
2385
|
-
preconditions:
|
|
2386
|
-
binding:
|
|
2387
|
-
mac:
|
|
2385
|
+
preconditions: tt,
|
|
2386
|
+
binding: xe.DELETE,
|
|
2387
|
+
mac: xe.BACKSPACE
|
|
2388
2388
|
};
|
|
2389
|
-
var
|
|
2390
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2389
|
+
var mo = Object.defineProperty, fo = Object.getOwnPropertyDescriptor, po = (i, e, n, t) => {
|
|
2390
|
+
for (var r = t > 1 ? void 0 : t ? fo(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2391
2391
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2392
|
-
return t && r &&
|
|
2393
|
-
},
|
|
2394
|
-
let
|
|
2392
|
+
return t && r && mo(e, n, r), r;
|
|
2393
|
+
}, vt = (i, e) => (n, t) => e(n, t, i);
|
|
2394
|
+
let Ot = class extends ie {
|
|
2395
2395
|
constructor(i, e, n, t) {
|
|
2396
2396
|
super(), this._componentManager = i, this._menuManagerService = e, this._commandService = n, this._shortcutService = t, this._init();
|
|
2397
2397
|
}
|
|
2398
2398
|
_initCustomComponents() {
|
|
2399
2399
|
const i = this._componentManager;
|
|
2400
|
-
this.disposeWithMe(i.register(
|
|
2400
|
+
this.disposeWithMe(i.register(mr, hr)), this.disposeWithMe(i.register(rr, oo));
|
|
2401
2401
|
}
|
|
2402
2402
|
_initMenus() {
|
|
2403
|
-
this._menuManagerService.mergeMenu(
|
|
2403
|
+
this._menuManagerService.mergeMenu(ao);
|
|
2404
2404
|
}
|
|
2405
2405
|
_initCommands() {
|
|
2406
2406
|
[
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
nr,
|
|
2415
|
-
rr,
|
|
2407
|
+
cn,
|
|
2408
|
+
dn,
|
|
2409
|
+
jt,
|
|
2410
|
+
Nt,
|
|
2411
|
+
Wt,
|
|
2412
|
+
ir,
|
|
2413
|
+
F,
|
|
2416
2414
|
sr,
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2415
|
+
or,
|
|
2416
|
+
cr,
|
|
2417
|
+
et,
|
|
2418
|
+
gr,
|
|
2419
|
+
ar
|
|
2420
2420
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
2421
2421
|
}
|
|
2422
2422
|
_initShortcuts() {
|
|
2423
2423
|
[
|
|
2424
2424
|
// sheet drawing shortcuts
|
|
2425
|
-
so,
|
|
2426
|
-
oo,
|
|
2427
|
-
ao,
|
|
2428
2425
|
co,
|
|
2429
|
-
lo
|
|
2426
|
+
lo,
|
|
2427
|
+
uo,
|
|
2428
|
+
ho,
|
|
2429
|
+
go
|
|
2430
2430
|
].forEach((i) => {
|
|
2431
2431
|
this.disposeWithMe(this._shortcutService.registerShortcut(i));
|
|
2432
2432
|
});
|
|
@@ -2435,19 +2435,19 @@ let Dt = class extends se {
|
|
|
2435
2435
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
2436
2436
|
}
|
|
2437
2437
|
};
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
],
|
|
2444
|
-
var
|
|
2445
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2438
|
+
Ot = po([
|
|
2439
|
+
vt(0, N(Ci)),
|
|
2440
|
+
vt(1, Ri),
|
|
2441
|
+
vt(2, H),
|
|
2442
|
+
vt(3, bi)
|
|
2443
|
+
], Ot);
|
|
2444
|
+
var wo = Object.defineProperty, _o = Object.getOwnPropertyDescriptor, vo = (i, e, n, t) => {
|
|
2445
|
+
for (var r = t > 1 ? void 0 : t ? _o(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2446
2446
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
2447
|
-
return t && r &&
|
|
2448
|
-
},
|
|
2449
|
-
function
|
|
2450
|
-
const { scaleX: s, scaleY: o } = e.getAncestorScale(), c = e.getViewport(
|
|
2447
|
+
return t && r && wo(e, n, r), r;
|
|
2448
|
+
}, Oe = (i, e) => (n, t) => e(n, t, i);
|
|
2449
|
+
function So(i, e, n, t, r) {
|
|
2450
|
+
const { scaleX: s, scaleY: o } = e.getAncestorScale(), c = e.getViewport(En.VIEW_MAIN), d = {
|
|
2451
2451
|
left: !0,
|
|
2452
2452
|
top: !0
|
|
2453
2453
|
};
|
|
@@ -2456,70 +2456,70 @@ function wo(i, e, n, t, r) {
|
|
|
2456
2456
|
...i,
|
|
2457
2457
|
absolute: d
|
|
2458
2458
|
};
|
|
2459
|
-
const { left: g, right: a, top: l, bottom:
|
|
2460
|
-
let { top:
|
|
2461
|
-
const { boundsOfViewArea:
|
|
2462
|
-
|
|
2463
|
-
let
|
|
2464
|
-
g <
|
|
2459
|
+
const { left: g, right: a, top: l, bottom: h } = i;
|
|
2460
|
+
let { top: u, left: m, viewportScrollX: p, viewportScrollY: f } = c;
|
|
2461
|
+
const { boundsOfViewArea: w, scrollDirectionResponse: I } = r || {};
|
|
2462
|
+
w && (Pe.isDefine(w.top) && (u = w.top), Pe.isDefine(w.left) && (m = w.left)), I === "HORIZONTAL" && (f = 0), I === "VERTICAL" && (p = 0);
|
|
2463
|
+
let S, R;
|
|
2464
|
+
g < m ? (d.left = !0, S = (m + (g - m)) * s, R = Math.max(
|
|
2465
2465
|
Math.min(
|
|
2466
|
-
(
|
|
2467
|
-
|
|
2466
|
+
(m + (a - m)) * s,
|
|
2467
|
+
m * s
|
|
2468
2468
|
),
|
|
2469
|
-
(a -
|
|
2470
|
-
)) : (d.left = !1,
|
|
2471
|
-
let
|
|
2472
|
-
return l <
|
|
2469
|
+
(a - p) * s
|
|
2470
|
+
)) : (d.left = !1, S = Math.max((g - p) * s, m * s), R = Math.max((a - p) * s, m * s));
|
|
2471
|
+
let v, C;
|
|
2472
|
+
return l < u ? (d.top = !0, v = (u + (l - u)) * o, C = Math.max(
|
|
2473
2473
|
Math.min(
|
|
2474
|
-
(
|
|
2475
|
-
|
|
2474
|
+
(u + (a - u)) * o,
|
|
2475
|
+
u * o
|
|
2476
2476
|
),
|
|
2477
|
-
(
|
|
2478
|
-
)) : (d.top = !1,
|
|
2479
|
-
left:
|
|
2480
|
-
right:
|
|
2481
|
-
top:
|
|
2482
|
-
bottom:
|
|
2477
|
+
(h - f) * o
|
|
2478
|
+
)) : (d.top = !1, v = Math.max((l - f) * o, u * o), C = Math.max((h - f) * o, u * o)), {
|
|
2479
|
+
left: S,
|
|
2480
|
+
right: R,
|
|
2481
|
+
top: v,
|
|
2482
|
+
bottom: C,
|
|
2483
2483
|
absolute: d
|
|
2484
2484
|
};
|
|
2485
2485
|
}
|
|
2486
|
-
const
|
|
2486
|
+
const Te = (i, e, n, t, r) => {
|
|
2487
2487
|
const { scene: s } = e, { left: o, top: c, width: d, height: g, angle: a } = i, l = {
|
|
2488
2488
|
left: o,
|
|
2489
2489
|
right: o + d,
|
|
2490
2490
|
top: c,
|
|
2491
2491
|
bottom: c + g
|
|
2492
|
-
},
|
|
2492
|
+
}, h = So(l, s, n, t, r), { scaleX: u, scaleY: m } = s.getAncestorScale();
|
|
2493
2493
|
return {
|
|
2494
|
-
startX:
|
|
2495
|
-
endX:
|
|
2496
|
-
startY:
|
|
2497
|
-
endY:
|
|
2494
|
+
startX: h.left,
|
|
2495
|
+
endX: h.right,
|
|
2496
|
+
startY: h.top,
|
|
2497
|
+
endY: h.bottom,
|
|
2498
2498
|
rotate: a,
|
|
2499
|
-
width: d *
|
|
2500
|
-
height: g *
|
|
2501
|
-
absolute:
|
|
2499
|
+
width: d * u,
|
|
2500
|
+
height: g * m,
|
|
2501
|
+
absolute: h.absolute
|
|
2502
2502
|
};
|
|
2503
2503
|
};
|
|
2504
|
-
let
|
|
2504
|
+
let Tt = class extends ie {
|
|
2505
2505
|
constructor(e, n, t, r, s, o, c) {
|
|
2506
2506
|
super();
|
|
2507
2507
|
/**
|
|
2508
2508
|
* for update dom container position when scrolling
|
|
2509
2509
|
*/
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2510
|
+
J(this, "_domLayerMap", /* @__PURE__ */ new Map());
|
|
2511
|
+
J(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
|
|
2512
|
+
J(this, "_transformChange$", new Ht());
|
|
2513
|
+
J(this, "transformChange$", this._transformChange$.asObservable());
|
|
2514
|
+
J(this, "_add$", new Ht());
|
|
2515
|
+
J(this, "add$", this._add$.asObservable());
|
|
2516
|
+
J(this, "_remove$", new Ht());
|
|
2517
|
+
J(this, "remove$", this._remove$.asObservable());
|
|
2518
|
+
J(this, "_hooks", []);
|
|
2519
2519
|
this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = c, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
|
|
2520
2520
|
}
|
|
2521
2521
|
_bindScrollEvent() {
|
|
2522
|
-
this._lifecycleService.lifecycle$.pipe(
|
|
2522
|
+
this._lifecycleService.lifecycle$.pipe(ve((e) => e === Lr.Rendered), Mi(1)).subscribe(() => {
|
|
2523
2523
|
this._scrollUpdateListener();
|
|
2524
2524
|
});
|
|
2525
2525
|
}
|
|
@@ -2551,89 +2551,89 @@ let Mt = class extends se {
|
|
|
2551
2551
|
this.disposeWithMe(
|
|
2552
2552
|
this._drawingManagerService.add$.subscribe((e) => {
|
|
2553
2553
|
e.forEach((n) => {
|
|
2554
|
-
var
|
|
2555
|
-
const { unitId: t, subUnitId: r, drawingId: s } = n, o =
|
|
2554
|
+
var Se, ge, ce;
|
|
2555
|
+
const { unitId: t, subUnitId: r, drawingId: s } = n, o = V(this._univerInstanceService, { unitId: t, subUnitId: r }), c = this._drawingManagerService.getDrawingByParam(n), d = this._univerInstanceService.getUnit(t, Y.UNIVER_SHEET);
|
|
2556
2556
|
if (!d)
|
|
2557
2557
|
return;
|
|
2558
2558
|
const g = d.getActiveSheet().getSheetId();
|
|
2559
2559
|
if (!c || !o)
|
|
2560
2560
|
return;
|
|
2561
|
-
const a = (
|
|
2561
|
+
const a = (Se = this._renderManagerService.getRenderById(t)) == null ? void 0 : Se.with(Z).getWorksheetSkeleton(r);
|
|
2562
2562
|
if (!a)
|
|
2563
2563
|
return;
|
|
2564
|
-
const { transform: l, drawingType:
|
|
2565
|
-
if (
|
|
2564
|
+
const { transform: l, drawingType: h, data: u } = c;
|
|
2565
|
+
if (h !== L.DRAWING_DOM && h !== L.DRAWING_CHART)
|
|
2566
2566
|
return;
|
|
2567
|
-
const
|
|
2568
|
-
if (
|
|
2567
|
+
const m = this._getSceneAndTransformerByDrawingSearch(t);
|
|
2568
|
+
if (m == null)
|
|
2569
2569
|
return;
|
|
2570
|
-
const { scene: p, canvas:
|
|
2570
|
+
const { scene: p, canvas: f } = m;
|
|
2571
2571
|
if (l == null)
|
|
2572
2572
|
return !0;
|
|
2573
2573
|
if (g !== r)
|
|
2574
2574
|
return;
|
|
2575
|
-
const { left:
|
|
2576
|
-
if (
|
|
2577
|
-
|
|
2575
|
+
const { left: w, top: I, width: S, height: R, angle: v, flipX: C, flipY: _, skewX: y, skewY: M } = l, x = Ye({ unitId: t, subUnitId: r, drawingId: s }), U = p.getObject(x);
|
|
2576
|
+
if (U != null) {
|
|
2577
|
+
U.transformByState({ left: w, top: I, width: S, height: R, angle: v, flipX: C, flipY: _, skewX: y, skewY: M });
|
|
2578
2578
|
return;
|
|
2579
2579
|
}
|
|
2580
2580
|
const D = {
|
|
2581
|
-
left:
|
|
2582
|
-
top:
|
|
2583
|
-
width:
|
|
2584
|
-
height:
|
|
2581
|
+
left: w,
|
|
2582
|
+
top: I,
|
|
2583
|
+
width: S,
|
|
2584
|
+
height: R,
|
|
2585
2585
|
zIndex: this._drawingManagerService.getDrawingOrder(t, r).length - 1
|
|
2586
|
-
},
|
|
2587
|
-
if (
|
|
2588
|
-
const
|
|
2589
|
-
D.fill =
|
|
2586
|
+
}, b = h === L.DRAWING_CHART;
|
|
2587
|
+
if (b) {
|
|
2588
|
+
const $ = u ? u.backgroundColor : "white";
|
|
2589
|
+
D.fill = $, D.rotateEnabled = !1, u && u.border && (D.stroke = u.border), D.paintFirst = "stroke", D.strokeWidth = 1, D.borderEnabled = !1, D.radius = 8;
|
|
2590
2590
|
}
|
|
2591
|
-
const
|
|
2592
|
-
|
|
2593
|
-
const
|
|
2594
|
-
dispose:
|
|
2595
|
-
rect:
|
|
2596
|
-
position$:
|
|
2591
|
+
const P = new lt(x, D);
|
|
2592
|
+
b && P.setObjectType(pn.CHART), p.addObject(P, Yt), c.allowTransform !== !1 && p.attachTransformerTo(P);
|
|
2593
|
+
const A = this._ensureMap(t, r), j = new ct(), B = Te(P, m.renderUnit, a.skeleton, o.worksheet), X = new He(B), se = {
|
|
2594
|
+
dispose: j,
|
|
2595
|
+
rect: P,
|
|
2596
|
+
position$: X,
|
|
2597
2597
|
unitId: t,
|
|
2598
2598
|
subUnitId: r
|
|
2599
2599
|
};
|
|
2600
2600
|
this._canvasFloatDomService.addFloatDom({
|
|
2601
|
-
position$:
|
|
2601
|
+
position$: X,
|
|
2602
2602
|
id: s,
|
|
2603
2603
|
componentKey: c.componentKey,
|
|
2604
|
-
onPointerDown: (
|
|
2605
|
-
|
|
2604
|
+
onPointerDown: ($) => {
|
|
2605
|
+
f.dispatchEvent(new PointerEvent($.type, $));
|
|
2606
2606
|
},
|
|
2607
|
-
onPointerMove: (
|
|
2608
|
-
|
|
2607
|
+
onPointerMove: ($) => {
|
|
2608
|
+
f.dispatchEvent(new PointerEvent($.type, $));
|
|
2609
2609
|
},
|
|
2610
|
-
onPointerUp: (
|
|
2611
|
-
|
|
2610
|
+
onPointerUp: ($) => {
|
|
2611
|
+
f.dispatchEvent(new PointerEvent($.type, $));
|
|
2612
2612
|
},
|
|
2613
|
-
onWheel: (
|
|
2614
|
-
|
|
2613
|
+
onWheel: ($) => {
|
|
2614
|
+
f.dispatchEvent(new WheelEvent($.type, $));
|
|
2615
2615
|
},
|
|
2616
|
-
props: (
|
|
2617
|
-
data:
|
|
2616
|
+
props: (ce = (ge = A.get(s)) == null ? void 0 : ge.props) != null ? ce : this._getFloatDomProps(s),
|
|
2617
|
+
data: u,
|
|
2618
2618
|
unitId: t
|
|
2619
2619
|
});
|
|
2620
|
-
const
|
|
2621
|
-
const
|
|
2622
|
-
|
|
2623
|
-
|
|
2620
|
+
const oe = P.onTransformChange$.subscribeEvent(() => {
|
|
2621
|
+
const $ = Te(P, m.renderUnit, a.skeleton, o.worksheet);
|
|
2622
|
+
X.next(
|
|
2623
|
+
$
|
|
2624
2624
|
);
|
|
2625
2625
|
});
|
|
2626
|
-
|
|
2626
|
+
j.add(() => {
|
|
2627
2627
|
this._canvasFloatDomService.removeFloatDom(s);
|
|
2628
|
-
}),
|
|
2629
|
-
...
|
|
2628
|
+
}), oe && j.add(oe), this._domLayerInfoMap.set(s, se), A.set(s, {
|
|
2629
|
+
...A.get(s)
|
|
2630
2630
|
});
|
|
2631
2631
|
});
|
|
2632
2632
|
})
|
|
2633
2633
|
), this.disposeWithMe(
|
|
2634
2634
|
this._drawingManagerService.remove$.subscribe((e) => {
|
|
2635
2635
|
e.forEach((n) => {
|
|
2636
|
-
const { unitId: t, subUnitId: r, drawingId: s } = n, o =
|
|
2636
|
+
const { unitId: t, subUnitId: r, drawingId: s } = n, o = Ye({ unitId: t, subUnitId: r, drawingId: s }), c = this._getSceneAndTransformerByDrawingSearch(t);
|
|
2637
2637
|
if (c == null)
|
|
2638
2638
|
return;
|
|
2639
2639
|
const { transformer: d, scene: g } = c, a = g.getObject(o);
|
|
@@ -2645,47 +2645,47 @@ let Mt = class extends se {
|
|
|
2645
2645
|
_scrollUpdateListener() {
|
|
2646
2646
|
const e = (n, t) => {
|
|
2647
2647
|
var g;
|
|
2648
|
-
const r = this._getSceneAndTransformerByDrawingSearch(n), s = this._ensureMap(n, t), o = Array.from(s.keys()), c =
|
|
2648
|
+
const r = this._getSceneAndTransformerByDrawingSearch(n), s = this._ensureMap(n, t), o = Array.from(s.keys()), c = V(this._univerInstanceService, { unitId: n, subUnitId: t }), d = (g = this._renderManagerService.getRenderById(n)) == null ? void 0 : g.with(Z).getWorksheetSkeleton(t);
|
|
2649
2649
|
!r || !c || !d || o.forEach((a) => {
|
|
2650
2650
|
const l = this._domLayerInfoMap.get(a);
|
|
2651
2651
|
if (l) {
|
|
2652
|
-
const
|
|
2653
|
-
l.position$.next(
|
|
2652
|
+
const h = Te(l.rect, r.renderUnit, d.skeleton, c.worksheet, l);
|
|
2653
|
+
l.position$.next(h);
|
|
2654
2654
|
}
|
|
2655
2655
|
});
|
|
2656
2656
|
};
|
|
2657
2657
|
this.disposeWithMe(
|
|
2658
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2658
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET).pipe(
|
|
2659
|
+
ve((n) => !!n),
|
|
2660
|
+
Sn((n) => n.activeSheet$),
|
|
2661
|
+
ve((n) => !!n),
|
|
2662
|
+
Je((n) => {
|
|
2663
2663
|
const t = this._renderManagerService.getRenderById(n.getUnitId());
|
|
2664
2664
|
return t ? { render: t, unitId: n.getUnitId(), subUnitId: n.getSheetId() } : null;
|
|
2665
2665
|
}),
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
(n) =>
|
|
2666
|
+
ve((n) => !!n),
|
|
2667
|
+
Sn(
|
|
2668
|
+
(n) => Fr(n.render.scene.getViewport(En.VIEW_MAIN).onScrollAfter$).pipe(Je(() => ({ unitId: n.unitId, subUnitId: n.subUnitId })))
|
|
2669
2669
|
)
|
|
2670
2670
|
).subscribe(({ unitId: n, subUnitId: t }) => {
|
|
2671
2671
|
e(n, t);
|
|
2672
2672
|
})
|
|
2673
2673
|
), this.disposeWithMe(this._commandService.onCommandExecuted((n) => {
|
|
2674
2674
|
var t, r;
|
|
2675
|
-
if (n.id ===
|
|
2675
|
+
if (n.id === _n.id) {
|
|
2676
2676
|
const s = n.params, { unitId: o } = s;
|
|
2677
2677
|
Array.from((r = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? r : []).forEach((d) => {
|
|
2678
2678
|
e(o, d);
|
|
2679
2679
|
});
|
|
2680
|
-
} else if (n.id ===
|
|
2680
|
+
} else if (n.id === ki.id) {
|
|
2681
2681
|
const { unitId: s, subUnitId: o } = n.params;
|
|
2682
2682
|
e(s, o);
|
|
2683
2683
|
}
|
|
2684
2684
|
}));
|
|
2685
2685
|
}
|
|
2686
2686
|
_getPosition(e, n) {
|
|
2687
|
-
var
|
|
2688
|
-
const { startX: t, endX: r, startY: s, endY: o } = e, c = (
|
|
2687
|
+
var h;
|
|
2688
|
+
const { startX: t, endX: r, startY: s, endY: o } = e, c = (h = this._renderManagerService.getRenderById(n)) == null ? void 0 : h.with(Qe);
|
|
2689
2689
|
if (c == null)
|
|
2690
2690
|
return;
|
|
2691
2691
|
const d = c.getCellWithCoordByOffset(t, s);
|
|
@@ -2715,7 +2715,7 @@ let Mt = class extends se {
|
|
|
2715
2715
|
this._drawingManagerService.update$.subscribe((e) => {
|
|
2716
2716
|
e.forEach((n) => {
|
|
2717
2717
|
const t = this._drawingManagerService.getDrawingByParam(n);
|
|
2718
|
-
if (!t || t.drawingType !==
|
|
2718
|
+
if (!t || t.drawingType !== L.DRAWING_DOM && t.drawingType !== L.DRAWING_CHART)
|
|
2719
2719
|
return;
|
|
2720
2720
|
const r = {
|
|
2721
2721
|
...t.transform
|
|
@@ -2737,27 +2737,27 @@ let Mt = class extends se {
|
|
|
2737
2737
|
updateFloatDomProps(e, n, t, r) {
|
|
2738
2738
|
const s = this._domLayerInfoMap.get(t), o = this._getSceneAndTransformerByDrawingSearch(e);
|
|
2739
2739
|
if (s && o) {
|
|
2740
|
-
const { scene: c } = o, d =
|
|
2741
|
-
g && g instanceof
|
|
2740
|
+
const { scene: c } = o, d = Ye({ unitId: e, subUnitId: n, drawingId: t }), g = c.getObject(d);
|
|
2741
|
+
g && g instanceof lt && g.setProps(r);
|
|
2742
2742
|
}
|
|
2743
2743
|
}
|
|
2744
2744
|
// CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
|
|
2745
2745
|
addFloatDomToPosition(e, n) {
|
|
2746
|
-
const t =
|
|
2746
|
+
const t = V(this._univerInstanceService, {
|
|
2747
2747
|
unitId: e.unitId,
|
|
2748
2748
|
subUnitId: e.subUnitId
|
|
2749
2749
|
});
|
|
2750
2750
|
if (!t)
|
|
2751
2751
|
throw new Error("cannot find current target!");
|
|
2752
|
-
const { unitId: r, subUnitId: s } = t, { initPosition: o, componentKey: c, data: d, allowTransform: g = !0 } = e, a = n != null ? n :
|
|
2752
|
+
const { unitId: r, subUnitId: s } = t, { initPosition: o, componentKey: c, data: d, allowTransform: g = !0 } = e, a = n != null ? n : Gt(), l = this._getPosition(o, r);
|
|
2753
2753
|
if (l == null)
|
|
2754
2754
|
return;
|
|
2755
2755
|
this._ensureMap(r, s).set(a, e);
|
|
2756
|
-
const
|
|
2756
|
+
const u = {
|
|
2757
2757
|
unitId: r,
|
|
2758
2758
|
subUnitId: s,
|
|
2759
2759
|
drawingId: a,
|
|
2760
|
-
drawingType: e.type ||
|
|
2760
|
+
drawingType: e.type || L.DRAWING_DOM,
|
|
2761
2761
|
componentKey: c,
|
|
2762
2762
|
sheetTransform: l,
|
|
2763
2763
|
transform: {
|
|
@@ -2769,9 +2769,9 @@ let Mt = class extends se {
|
|
|
2769
2769
|
data: d,
|
|
2770
2770
|
allowTransform: g
|
|
2771
2771
|
};
|
|
2772
|
-
return this._commandService.executeCommand(
|
|
2772
|
+
return this._commandService.executeCommand(jt.id, {
|
|
2773
2773
|
unitId: r,
|
|
2774
|
-
drawings: [
|
|
2774
|
+
drawings: [u]
|
|
2775
2775
|
}), this._add$.next({ unitId: r, subUnitId: s, id: a }), {
|
|
2776
2776
|
id: a,
|
|
2777
2777
|
dispose: () => {
|
|
@@ -2792,7 +2792,7 @@ let Mt = class extends se {
|
|
|
2792
2792
|
if (!d)
|
|
2793
2793
|
return;
|
|
2794
2794
|
const g = this._sheetDrawingService.getBatchRemoveOp([d]), { redo: a, objects: l } = g;
|
|
2795
|
-
this._commandService.syncExecuteCommand(T.id, { unitId: r, subUnitId: s, op: a, objects: l, type:
|
|
2795
|
+
this._commandService.syncExecuteCommand(T.id, { unitId: r, subUnitId: s, op: a, objects: l, type: E.REMOVE });
|
|
2796
2796
|
}
|
|
2797
2797
|
}
|
|
2798
2798
|
addHook(e) {
|
|
@@ -2804,8 +2804,8 @@ let Mt = class extends se {
|
|
|
2804
2804
|
};
|
|
2805
2805
|
}
|
|
2806
2806
|
addFloatDomToRange(e, n, t, r) {
|
|
2807
|
-
var M,
|
|
2808
|
-
const s =
|
|
2807
|
+
var M, x, U, D, b, P;
|
|
2808
|
+
const s = V(this._univerInstanceService, {
|
|
2809
2809
|
unitId: n.unitId,
|
|
2810
2810
|
subUnitId: n.subUnitId
|
|
2811
2811
|
});
|
|
@@ -2815,120 +2815,130 @@ let Mt = class extends se {
|
|
|
2815
2815
|
if (!this._getSceneAndTransformerByDrawingSearch(o)) return;
|
|
2816
2816
|
const g = this._renderManagerService.getRenderById(o);
|
|
2817
2817
|
if (!g) return;
|
|
2818
|
-
const a = (M = this._renderManagerService.getRenderById(o)) == null ? void 0 : M.with(
|
|
2818
|
+
const a = (M = this._renderManagerService.getRenderById(o)) == null ? void 0 : M.with(Z).getWorksheetSkeleton(c);
|
|
2819
2819
|
if (!a) return;
|
|
2820
|
-
const { componentKey: l, data:
|
|
2821
|
-
if (
|
|
2820
|
+
const { componentKey: l, data: h, allowTransform: u = !0 } = n, m = r != null ? r : Gt(), { position: p } = this._createRangePositionObserver(e, g, a.skeleton), f = this._getPosition(p, o);
|
|
2821
|
+
if (f == null)
|
|
2822
2822
|
return;
|
|
2823
|
-
this._ensureMap(o, c).set(
|
|
2824
|
-
const
|
|
2823
|
+
this._ensureMap(o, c).set(m, n);
|
|
2824
|
+
const I = p.endX - p.startX, S = p.endY - p.startY, R = (x = t.width) != null ? x : I, v = (U = t.height) != null ? U : S, C = p.startX + je(t.marginX, I), _ = p.startY + je(t.marginY, S), y = {
|
|
2825
2825
|
unitId: o,
|
|
2826
2826
|
subUnitId: c,
|
|
2827
|
-
drawingId:
|
|
2828
|
-
drawingType: n.type ||
|
|
2827
|
+
drawingId: m,
|
|
2828
|
+
drawingType: n.type || L.DRAWING_DOM,
|
|
2829
2829
|
componentKey: l,
|
|
2830
|
-
sheetTransform:
|
|
2830
|
+
sheetTransform: f,
|
|
2831
2831
|
transform: {
|
|
2832
|
-
left:
|
|
2833
|
-
top:
|
|
2834
|
-
width:
|
|
2832
|
+
left: C,
|
|
2833
|
+
top: _,
|
|
2834
|
+
width: R,
|
|
2835
2835
|
height: v
|
|
2836
2836
|
},
|
|
2837
|
-
data:
|
|
2838
|
-
allowTransform:
|
|
2837
|
+
data: h,
|
|
2838
|
+
allowTransform: u
|
|
2839
2839
|
};
|
|
2840
2840
|
{
|
|
2841
|
-
const { unitId:
|
|
2842
|
-
if (!
|
|
2841
|
+
const { unitId: A, subUnitId: j, drawingId: B } = y, X = V(this._univerInstanceService, { unitId: A, subUnitId: j }), se = y, oe = this._univerInstanceService.getUnit(A, Y.UNIVER_SHEET);
|
|
2842
|
+
if (!oe)
|
|
2843
2843
|
return;
|
|
2844
|
-
const
|
|
2845
|
-
if (!
|
|
2844
|
+
const Se = oe.getActiveSheet().getSheetId();
|
|
2845
|
+
if (!se || !X)
|
|
2846
2846
|
return;
|
|
2847
|
-
const
|
|
2848
|
-
if (!
|
|
2847
|
+
const ge = (D = this._renderManagerService.getRenderById(A)) == null ? void 0 : D.with(Z).getWorksheetSkeleton(j);
|
|
2848
|
+
if (!ge)
|
|
2849
2849
|
return;
|
|
2850
|
-
const { transform:
|
|
2851
|
-
if (
|
|
2850
|
+
const { transform: ce, drawingType: $, data: de } = se;
|
|
2851
|
+
if ($ !== L.DRAWING_DOM && $ !== L.DRAWING_CHART)
|
|
2852
2852
|
return;
|
|
2853
|
-
const
|
|
2854
|
-
if (
|
|
2853
|
+
const Ue = this._getSceneAndTransformerByDrawingSearch(A);
|
|
2854
|
+
if (Ue == null)
|
|
2855
2855
|
return;
|
|
2856
|
-
const { scene:
|
|
2857
|
-
if (
|
|
2856
|
+
const { scene: le, canvas: ue } = Ue;
|
|
2857
|
+
if (ce == null || Se !== j)
|
|
2858
2858
|
return;
|
|
2859
|
-
const { left:
|
|
2860
|
-
if (
|
|
2861
|
-
|
|
2859
|
+
const { left: Ie, top: ke, width: Le, height: Fe, angle: nt, flipX: xt, flipY: Bt, skewX: $t, skewY: kt } = ce, rt = Ye({ unitId: A, subUnitId: j, drawingId: B }), Ge = le.getObject(rt);
|
|
2860
|
+
if (Ge != null) {
|
|
2861
|
+
Ge.transformByState({ left: Ie, top: ke, width: Le, height: Fe, angle: nt, flipX: xt, flipY: Bt, skewX: $t, skewY: kt });
|
|
2862
2862
|
return;
|
|
2863
2863
|
}
|
|
2864
|
-
const
|
|
2865
|
-
left:
|
|
2866
|
-
top:
|
|
2867
|
-
width:
|
|
2868
|
-
height:
|
|
2869
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2870
|
-
},
|
|
2871
|
-
if (
|
|
2872
|
-
const W =
|
|
2873
|
-
|
|
2864
|
+
const re = {
|
|
2865
|
+
left: Ie,
|
|
2866
|
+
top: ke,
|
|
2867
|
+
width: Le,
|
|
2868
|
+
height: Fe,
|
|
2869
|
+
zIndex: this._drawingManagerService.getDrawingOrder(A, j).length - 1
|
|
2870
|
+
}, it = $ === L.DRAWING_CHART;
|
|
2871
|
+
if (it) {
|
|
2872
|
+
const W = de ? de.backgroundColor : "white";
|
|
2873
|
+
re.fill = W, re.rotateEnabled = !1, de && de.border && (re.stroke = de.border), re.paintFirst = "stroke", re.strokeWidth = 1, re.borderEnabled = !1, re.radius = 8;
|
|
2874
2874
|
}
|
|
2875
|
-
const
|
|
2876
|
-
|
|
2877
|
-
const
|
|
2878
|
-
top:
|
|
2879
|
-
left:
|
|
2880
|
-
bottom:
|
|
2881
|
-
right:
|
|
2882
|
-
},
|
|
2883
|
-
dispose:
|
|
2884
|
-
rect:
|
|
2885
|
-
boundsOfViewArea:
|
|
2875
|
+
const K = new lt(rt, re);
|
|
2876
|
+
it && K.setObjectType(pn.CHART), le.addObject(K, Yt), se.allowTransform !== !1 && le.attachTransformerTo(K);
|
|
2877
|
+
const Ce = this._ensureMap(A, j), Re = new ct(), me = le.getMainViewport(), Lt = {
|
|
2878
|
+
top: me.top,
|
|
2879
|
+
left: me.left,
|
|
2880
|
+
bottom: me.bottom,
|
|
2881
|
+
right: me.right
|
|
2882
|
+
}, he = {
|
|
2883
|
+
dispose: Re,
|
|
2884
|
+
rect: K,
|
|
2885
|
+
boundsOfViewArea: Lt,
|
|
2886
2886
|
// position$,
|
|
2887
|
-
unitId:
|
|
2888
|
-
subUnitId:
|
|
2889
|
-
},
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2887
|
+
unitId: A,
|
|
2888
|
+
subUnitId: j
|
|
2889
|
+
}, Ft = Te(K, Ue.renderUnit, ge.skeleton, X.worksheet, he), be = new He(Ft);
|
|
2890
|
+
he.position$ = be;
|
|
2891
|
+
let De = {
|
|
2892
|
+
position$: be,
|
|
2893
|
+
id: B,
|
|
2894
|
+
componentKey: se.componentKey,
|
|
2895
|
+
onPointerDown: () => {
|
|
2896
2896
|
},
|
|
2897
|
-
onPointerMove: (
|
|
2898
|
-
le.dispatchEvent(new PointerEvent(W.type, W));
|
|
2897
|
+
onPointerMove: () => {
|
|
2899
2898
|
},
|
|
2900
|
-
onPointerUp: (
|
|
2901
|
-
le.dispatchEvent(new PointerEvent(W.type, W));
|
|
2899
|
+
onPointerUp: () => {
|
|
2902
2900
|
},
|
|
2903
2901
|
onWheel: (W) => {
|
|
2904
|
-
|
|
2902
|
+
ue.dispatchEvent(new WheelEvent(W.type, W));
|
|
2905
2903
|
},
|
|
2906
|
-
|
|
2907
|
-
data:
|
|
2908
|
-
unitId:
|
|
2909
|
-
}
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2904
|
+
props: (P = (b = Ce.get(B)) == null ? void 0 : b.props) != null ? P : this._getFloatDomProps(B),
|
|
2905
|
+
data: de,
|
|
2906
|
+
unitId: A
|
|
2907
|
+
};
|
|
2908
|
+
n.eventPassThrough && (De = {
|
|
2909
|
+
...De,
|
|
2910
|
+
onPointerDown: (W) => {
|
|
2911
|
+
ue.dispatchEvent(new PointerEvent(W.type, W));
|
|
2912
|
+
},
|
|
2913
|
+
onPointerMove: (W) => {
|
|
2914
|
+
ue.dispatchEvent(new PointerEvent(W.type, W));
|
|
2915
|
+
},
|
|
2916
|
+
onPointerUp: (W) => {
|
|
2917
|
+
ue.dispatchEvent(new PointerEvent(W.type, W));
|
|
2918
|
+
}
|
|
2919
|
+
}), this._canvasFloatDomService.addFloatDom(De);
|
|
2920
|
+
const Ve = K.onTransformChange$.subscribeEvent(() => {
|
|
2921
|
+
const W = Te(K, Ue.renderUnit, ge.skeleton, X.worksheet, he);
|
|
2922
|
+
be.next(
|
|
2913
2923
|
W
|
|
2914
2924
|
);
|
|
2915
2925
|
});
|
|
2916
|
-
|
|
2917
|
-
this._canvasFloatDomService.removeFloatDom(
|
|
2918
|
-
}),
|
|
2919
|
-
|
|
2926
|
+
Re.add(() => {
|
|
2927
|
+
this._canvasFloatDomService.removeFloatDom(B);
|
|
2928
|
+
}), Ve && Re.add(Ve), this._domLayerInfoMap.set(B, he), Ce.set(B, {
|
|
2929
|
+
...Ce.get(B)
|
|
2920
2930
|
});
|
|
2921
2931
|
}
|
|
2922
2932
|
return {
|
|
2923
|
-
id:
|
|
2933
|
+
id: m,
|
|
2924
2934
|
dispose: () => {
|
|
2925
|
-
this._removeDom(
|
|
2935
|
+
this._removeDom(m, !0);
|
|
2926
2936
|
}
|
|
2927
2937
|
};
|
|
2928
2938
|
}
|
|
2929
2939
|
addFloatDomToColumnHeader(e, n, t, r) {
|
|
2930
|
-
var
|
|
2931
|
-
const s =
|
|
2940
|
+
var x, U, D, b, P, A;
|
|
2941
|
+
const s = V(this._univerInstanceService, {
|
|
2932
2942
|
unitId: n.unitId,
|
|
2933
2943
|
subUnitId: n.subUnitId
|
|
2934
2944
|
});
|
|
@@ -2938,119 +2948,141 @@ let Mt = class extends se {
|
|
|
2938
2948
|
if (!this._getSceneAndTransformerByDrawingSearch(o)) return;
|
|
2939
2949
|
const g = this._renderManagerService.getRenderById(o);
|
|
2940
2950
|
if (!g) return;
|
|
2941
|
-
const a = (
|
|
2951
|
+
const a = (x = this._renderManagerService.getRenderById(o)) == null ? void 0 : x.with(Z).getWorksheetSkeleton(c);
|
|
2942
2952
|
if (!a) return;
|
|
2943
|
-
const { componentKey: l, data:
|
|
2953
|
+
const { componentKey: l, data: h, allowTransform: u = !0 } = n, m = r != null ? r : Gt(), { position: p } = this._createRangePositionObserver({
|
|
2944
2954
|
startRow: 0,
|
|
2945
2955
|
endRow: 0,
|
|
2946
2956
|
startColumn: e,
|
|
2947
2957
|
endColumn: e
|
|
2948
|
-
}, g, a.skeleton),
|
|
2949
|
-
|
|
2950
|
-
const
|
|
2951
|
-
if (
|
|
2958
|
+
}, g, a.skeleton), f = p;
|
|
2959
|
+
f.startY = 0;
|
|
2960
|
+
const w = this._getPosition(p, o);
|
|
2961
|
+
if (w == null)
|
|
2952
2962
|
return;
|
|
2953
|
-
this._ensureMap(o, c).set(
|
|
2954
|
-
const
|
|
2963
|
+
this._ensureMap(o, c).set(m, n);
|
|
2964
|
+
const S = p.endX - p.startX, R = p.endY - p.startY, v = (U = t.width) != null ? U : S, C = (D = t.height) != null ? D : R;
|
|
2965
|
+
let _ = 0, y = 0;
|
|
2966
|
+
if (t.horizonOffsetAlign === "right") {
|
|
2967
|
+
const j = je(t.marginX, S);
|
|
2968
|
+
_ = f.endX - j - v;
|
|
2969
|
+
} else
|
|
2970
|
+
_ = f.startX + je(t.marginX, S);
|
|
2971
|
+
if (t.verticalOffsetAlign === "bottom") {
|
|
2972
|
+
const j = je(t.marginY, R);
|
|
2973
|
+
y = f.endY - j - C;
|
|
2974
|
+
} else
|
|
2975
|
+
y = f.startY + je(t.marginY, R);
|
|
2976
|
+
const M = {
|
|
2955
2977
|
unitId: o,
|
|
2956
2978
|
subUnitId: c,
|
|
2957
|
-
drawingId:
|
|
2958
|
-
drawingType: n.type ||
|
|
2979
|
+
drawingId: m,
|
|
2980
|
+
drawingType: n.type || L.DRAWING_DOM,
|
|
2959
2981
|
componentKey: l,
|
|
2960
|
-
sheetTransform:
|
|
2982
|
+
sheetTransform: w,
|
|
2961
2983
|
transform: {
|
|
2962
|
-
left:
|
|
2963
|
-
top:
|
|
2984
|
+
left: _,
|
|
2985
|
+
top: y,
|
|
2964
2986
|
width: v,
|
|
2965
|
-
height:
|
|
2987
|
+
height: C
|
|
2966
2988
|
},
|
|
2967
|
-
data:
|
|
2968
|
-
allowTransform:
|
|
2989
|
+
data: h,
|
|
2990
|
+
allowTransform: u
|
|
2969
2991
|
};
|
|
2970
2992
|
{
|
|
2971
|
-
const { unitId:
|
|
2972
|
-
if (!
|
|
2993
|
+
const { unitId: j, subUnitId: B, drawingId: X } = M, se = V(this._univerInstanceService, { unitId: j, subUnitId: B }), oe = M, Se = this._univerInstanceService.getUnit(j, Y.UNIVER_SHEET);
|
|
2994
|
+
if (!Se)
|
|
2973
2995
|
return;
|
|
2974
|
-
const
|
|
2975
|
-
if (!
|
|
2996
|
+
const ge = Se.getActiveSheet().getSheetId();
|
|
2997
|
+
if (!oe || !se)
|
|
2976
2998
|
return;
|
|
2977
|
-
const
|
|
2978
|
-
if (!
|
|
2999
|
+
const ce = (b = this._renderManagerService.getRenderById(j)) == null ? void 0 : b.with(Z).getWorksheetSkeleton(B);
|
|
3000
|
+
if (!ce)
|
|
2979
3001
|
return;
|
|
2980
|
-
const { transform:
|
|
2981
|
-
if (
|
|
3002
|
+
const { transform: $, drawingType: de, data: Ue } = oe;
|
|
3003
|
+
if (de !== L.DRAWING_DOM && de !== L.DRAWING_CHART)
|
|
2982
3004
|
return;
|
|
2983
|
-
const
|
|
2984
|
-
if (
|
|
3005
|
+
const le = this._getSceneAndTransformerByDrawingSearch(j);
|
|
3006
|
+
if (le == null)
|
|
2985
3007
|
return;
|
|
2986
|
-
const { scene:
|
|
2987
|
-
if (
|
|
3008
|
+
const { scene: ue, canvas: Ie } = le;
|
|
3009
|
+
if ($ == null || ge !== B)
|
|
2988
3010
|
return;
|
|
2989
|
-
const { left:
|
|
2990
|
-
if (
|
|
2991
|
-
|
|
3011
|
+
const { left: ke, top: Le, width: Fe, height: nt, angle: xt, flipX: Bt, flipY: $t, skewX: kt, skewY: rt } = $, Ge = Ye({ unitId: j, subUnitId: B, drawingId: X }), re = ue.getObject(Ge);
|
|
3012
|
+
if (re != null) {
|
|
3013
|
+
re.transformByState({ left: ke, top: Le, width: Fe, height: nt, angle: xt, flipX: Bt, flipY: $t, skewX: kt, skewY: rt });
|
|
2992
3014
|
return;
|
|
2993
3015
|
}
|
|
2994
|
-
const
|
|
2995
|
-
left:
|
|
2996
|
-
top:
|
|
2997
|
-
width:
|
|
2998
|
-
height:
|
|
2999
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
3000
|
-
},
|
|
3001
|
-
|
|
3002
|
-
const
|
|
3016
|
+
const it = {
|
|
3017
|
+
left: ke,
|
|
3018
|
+
top: Le,
|
|
3019
|
+
width: Fe,
|
|
3020
|
+
height: nt,
|
|
3021
|
+
zIndex: this._drawingManagerService.getDrawingOrder(j, B).length - 1
|
|
3022
|
+
}, K = new lt(Ge, it);
|
|
3023
|
+
ue.addObject(K, Yt), oe.allowTransform !== !1 && ue.attachTransformerTo(K);
|
|
3024
|
+
const Ce = this._ensureMap(j, B), Re = new ct(), me = ue.getMainViewport(), Lt = {
|
|
3003
3025
|
top: 0,
|
|
3004
3026
|
//viewMain.top,
|
|
3005
|
-
left:
|
|
3006
|
-
bottom:
|
|
3007
|
-
right:
|
|
3008
|
-
},
|
|
3009
|
-
dispose:
|
|
3010
|
-
rect:
|
|
3027
|
+
left: me.left,
|
|
3028
|
+
bottom: me.bottom,
|
|
3029
|
+
right: me.right
|
|
3030
|
+
}, he = {
|
|
3031
|
+
dispose: Re,
|
|
3032
|
+
rect: K,
|
|
3011
3033
|
// position$,
|
|
3012
|
-
unitId:
|
|
3013
|
-
subUnitId:
|
|
3014
|
-
boundsOfViewArea:
|
|
3034
|
+
unitId: j,
|
|
3035
|
+
subUnitId: B,
|
|
3036
|
+
boundsOfViewArea: Lt,
|
|
3015
3037
|
scrollDirectionResponse: "HORIZONTAL"
|
|
3016
3038
|
/* HORIZONTAL */
|
|
3017
|
-
},
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3039
|
+
}, Ft = Te(K, le.renderUnit, ce.skeleton, se.worksheet, he), be = new He(Ft);
|
|
3040
|
+
he.position$ = be;
|
|
3041
|
+
let De = {
|
|
3042
|
+
position$: be,
|
|
3043
|
+
id: X,
|
|
3044
|
+
componentKey: oe.componentKey,
|
|
3045
|
+
onPointerDown: () => {
|
|
3024
3046
|
},
|
|
3025
|
-
onPointerMove: (
|
|
3026
|
-
ve.dispatchEvent(new PointerEvent(W.type, W));
|
|
3047
|
+
onPointerMove: () => {
|
|
3027
3048
|
},
|
|
3028
|
-
onPointerUp: (
|
|
3029
|
-
ve.dispatchEvent(new PointerEvent(W.type, W));
|
|
3049
|
+
onPointerUp: () => {
|
|
3030
3050
|
},
|
|
3031
3051
|
onWheel: (W) => {
|
|
3032
|
-
|
|
3052
|
+
Ie.dispatchEvent(new WheelEvent(W.type, W));
|
|
3033
3053
|
},
|
|
3034
|
-
|
|
3035
|
-
data:
|
|
3036
|
-
unitId:
|
|
3037
|
-
}
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3054
|
+
props: (A = (P = Ce.get(X)) == null ? void 0 : P.props) != null ? A : this._getFloatDomProps(X),
|
|
3055
|
+
data: Ue,
|
|
3056
|
+
unitId: j
|
|
3057
|
+
};
|
|
3058
|
+
n.eventPassThrough && (De = {
|
|
3059
|
+
...De,
|
|
3060
|
+
onPointerDown: (W) => {
|
|
3061
|
+
Ie.dispatchEvent(new PointerEvent(W.type, W));
|
|
3062
|
+
},
|
|
3063
|
+
onPointerMove: (W) => {
|
|
3064
|
+
Ie.dispatchEvent(new PointerEvent(W.type, W));
|
|
3065
|
+
},
|
|
3066
|
+
onPointerUp: (W) => {
|
|
3067
|
+
Ie.dispatchEvent(new PointerEvent(W.type, W));
|
|
3068
|
+
}
|
|
3069
|
+
}), this._canvasFloatDomService.addFloatDom(De);
|
|
3070
|
+
const Ve = K.onTransformChange$.subscribeEvent(() => {
|
|
3071
|
+
const W = Te(K, le.renderUnit, ce.skeleton, se.worksheet, he);
|
|
3072
|
+
be.next(
|
|
3041
3073
|
W
|
|
3042
3074
|
);
|
|
3043
3075
|
});
|
|
3044
|
-
|
|
3045
|
-
this._canvasFloatDomService.removeFloatDom(
|
|
3046
|
-
}),
|
|
3047
|
-
|
|
3076
|
+
Re.add(() => {
|
|
3077
|
+
this._canvasFloatDomService.removeFloatDom(X);
|
|
3078
|
+
}), Ve && Re.add(Ve), this._domLayerInfoMap.set(X, he), Ce.set(X, {
|
|
3079
|
+
...Ce.get(X)
|
|
3048
3080
|
});
|
|
3049
3081
|
}
|
|
3050
3082
|
return {
|
|
3051
|
-
id:
|
|
3083
|
+
id: m,
|
|
3052
3084
|
dispose: () => {
|
|
3053
|
-
this._removeDom(
|
|
3085
|
+
this._removeDom(m, !0);
|
|
3054
3086
|
}
|
|
3055
3087
|
};
|
|
3056
3088
|
}
|
|
@@ -3066,20 +3098,20 @@ let Mt = class extends se {
|
|
|
3066
3098
|
*/
|
|
3067
3099
|
_createRangePositionObserver(e, n, t) {
|
|
3068
3100
|
let { startRow: r, startColumn: s } = e;
|
|
3069
|
-
const o =
|
|
3070
|
-
const
|
|
3071
|
-
c.next(
|
|
3072
|
-
}, l = new
|
|
3073
|
-
l.add(n.engine.clientRect$.subscribe(() => a())), l.add(this._commandService.onCommandExecuted((
|
|
3074
|
-
if (
|
|
3101
|
+
const o = Ke(r, s, t), c = new He(o), d = Ke(e.endRow, e.endColumn, t), g = new He(d), a = () => {
|
|
3102
|
+
const f = Ke(r, s, t), w = Ke(e.endRow, e.endColumn, t);
|
|
3103
|
+
c.next(f), g.next(w);
|
|
3104
|
+
}, l = new ct();
|
|
3105
|
+
l.add(n.engine.clientRect$.subscribe(() => a())), l.add(this._commandService.onCommandExecuted((f) => {
|
|
3106
|
+
if (f.id === Wn.id && f.params.rowsAutoHeightInfo.findIndex((I) => I.row === r) > -1) {
|
|
3075
3107
|
a();
|
|
3076
3108
|
return;
|
|
3077
3109
|
}
|
|
3078
|
-
(
|
|
3110
|
+
(Li.indexOf(f.id) > -1 || f.id === fi.id || f.id === _n.id) && a();
|
|
3079
3111
|
}));
|
|
3080
|
-
const
|
|
3081
|
-
r =
|
|
3082
|
-
},
|
|
3112
|
+
const h = (f, w) => {
|
|
3113
|
+
r = f, s = w, a();
|
|
3114
|
+
}, u = () => ({
|
|
3083
3115
|
rotate: 0,
|
|
3084
3116
|
width: d.right - o.left,
|
|
3085
3117
|
height: d.bottom - o.top,
|
|
@@ -3091,44 +3123,44 @@ let Mt = class extends se {
|
|
|
3091
3123
|
startY: o.top,
|
|
3092
3124
|
endX: d.right,
|
|
3093
3125
|
endY: d.bottom
|
|
3094
|
-
}),
|
|
3095
|
-
|
|
3096
|
-
const
|
|
3097
|
-
return console.log("service",
|
|
3126
|
+
}), m = c.pipe(
|
|
3127
|
+
Je((f) => {
|
|
3128
|
+
const w = Ke(e.endRow, e.endColumn, t);
|
|
3129
|
+
return console.log("service", f.left, f.top), {
|
|
3098
3130
|
rotate: 0,
|
|
3099
|
-
width:
|
|
3100
|
-
height:
|
|
3131
|
+
width: w.right - f.left,
|
|
3132
|
+
height: w.bottom - f.top,
|
|
3101
3133
|
absolute: {
|
|
3102
3134
|
left: !0,
|
|
3103
3135
|
top: !0
|
|
3104
3136
|
},
|
|
3105
|
-
startX:
|
|
3106
|
-
startY:
|
|
3107
|
-
endX:
|
|
3108
|
-
endY:
|
|
3137
|
+
startX: f.left,
|
|
3138
|
+
startY: f.top,
|
|
3139
|
+
endX: w.right,
|
|
3140
|
+
endY: w.bottom
|
|
3109
3141
|
};
|
|
3110
3142
|
})
|
|
3111
|
-
), p =
|
|
3143
|
+
), p = u();
|
|
3112
3144
|
return console.log("init position", p), {
|
|
3113
|
-
position$:
|
|
3145
|
+
position$: m,
|
|
3114
3146
|
position: p,
|
|
3115
|
-
updateRowCol:
|
|
3147
|
+
updateRowCol: h,
|
|
3116
3148
|
topLeftPos$: c,
|
|
3117
3149
|
rightBottomPos$: g,
|
|
3118
3150
|
disposable: l
|
|
3119
3151
|
};
|
|
3120
3152
|
}
|
|
3121
3153
|
};
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
],
|
|
3131
|
-
function
|
|
3154
|
+
Tt = vo([
|
|
3155
|
+
Oe(0, N(Q)),
|
|
3156
|
+
Oe(1, $e),
|
|
3157
|
+
Oe(2, N(H)),
|
|
3158
|
+
Oe(3, ae),
|
|
3159
|
+
Oe(4, N(Di)),
|
|
3160
|
+
Oe(5, ee),
|
|
3161
|
+
Oe(6, N(kr))
|
|
3162
|
+
], Tt);
|
|
3163
|
+
function Ke(i, e, n) {
|
|
3132
3164
|
const t = n.getCellWithCoordByIndex(i, e), r = t.isMergedMainCell ? t.mergeInfo : t;
|
|
3133
3165
|
return {
|
|
3134
3166
|
left: r.startX,
|
|
@@ -3137,93 +3169,93 @@ function He(i, e, n) {
|
|
|
3137
3169
|
bottom: r.endY
|
|
3138
3170
|
};
|
|
3139
3171
|
}
|
|
3140
|
-
function
|
|
3172
|
+
function je(i, e) {
|
|
3141
3173
|
if (i === void 0) return 0;
|
|
3142
3174
|
if (typeof i == "number") return i;
|
|
3143
3175
|
const n = Number.parseFloat(i);
|
|
3144
3176
|
return e * n / 100;
|
|
3145
3177
|
}
|
|
3146
|
-
var
|
|
3147
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
3178
|
+
var wr = Object.defineProperty, Io = Object.getOwnPropertyDescriptor, Co = (i, e, n) => e in i ? wr(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, Ro = (i, e, n, t) => {
|
|
3179
|
+
for (var r = t > 1 ? void 0 : t ? Io(e, n) : e, s = i.length - 1, o; s >= 0; s--)
|
|
3148
3180
|
(o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
|
|
3149
|
-
return t && r &&
|
|
3150
|
-
},
|
|
3151
|
-
const
|
|
3152
|
-
let
|
|
3153
|
-
constructor(i =
|
|
3181
|
+
return t && r && wr(e, n, r), r;
|
|
3182
|
+
}, Zt = (i, e) => (n, t) => e(n, t, i), _r = (i, e, n) => Co(i, typeof e != "symbol" ? e + "" : e, n);
|
|
3183
|
+
const bo = "SHEET_IMAGE_UI_PLUGIN";
|
|
3184
|
+
let Et = class extends Vr {
|
|
3185
|
+
constructor(i = Cn, e, n, t) {
|
|
3154
3186
|
super(), this._config = i, this._injector = e, this._renderManagerService = n, this._configService = t;
|
|
3155
|
-
const { menu: r, ...s } =
|
|
3187
|
+
const { menu: r, ...s } = Yr(
|
|
3156
3188
|
{},
|
|
3157
|
-
|
|
3189
|
+
Cn,
|
|
3158
3190
|
this._config
|
|
3159
3191
|
);
|
|
3160
|
-
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(
|
|
3192
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Hi, s);
|
|
3161
3193
|
}
|
|
3162
3194
|
onStarting() {
|
|
3163
|
-
|
|
3195
|
+
Hr(this._injector, [
|
|
3196
|
+
[Tt],
|
|
3197
|
+
[Ot],
|
|
3198
|
+
[It],
|
|
3199
|
+
[yt],
|
|
3164
3200
|
[Mt],
|
|
3165
3201
|
[Dt],
|
|
3166
|
-
[_t],
|
|
3167
|
-
[bt],
|
|
3168
|
-
[Rt],
|
|
3169
3202
|
[Ct],
|
|
3170
|
-
[
|
|
3171
|
-
[
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
[Mt]
|
|
3203
|
+
[bt],
|
|
3204
|
+
[Rt]
|
|
3205
|
+
]), Vt(this._injector, [
|
|
3206
|
+
[Tt]
|
|
3175
3207
|
]);
|
|
3176
3208
|
}
|
|
3177
3209
|
onReady() {
|
|
3178
|
-
|
|
3179
|
-
[
|
|
3210
|
+
Vt(this._injector, [
|
|
3211
|
+
[Dt]
|
|
3180
3212
|
]);
|
|
3181
3213
|
}
|
|
3182
3214
|
onRendered() {
|
|
3183
|
-
this._registerRenderModules(),
|
|
3184
|
-
[
|
|
3215
|
+
this._registerRenderModules(), Vt(this._injector, [
|
|
3216
|
+
[Mt],
|
|
3217
|
+
[yt],
|
|
3218
|
+
[Ot],
|
|
3219
|
+
[Ct],
|
|
3185
3220
|
[bt],
|
|
3186
|
-
[
|
|
3187
|
-
[vt],
|
|
3188
|
-
[It],
|
|
3189
|
-
[St]
|
|
3221
|
+
[Rt]
|
|
3190
3222
|
]);
|
|
3191
3223
|
}
|
|
3192
3224
|
onSteady() {
|
|
3193
|
-
this._injector.get(
|
|
3225
|
+
this._injector.get(It);
|
|
3194
3226
|
}
|
|
3195
3227
|
_registerRenderModules() {
|
|
3196
3228
|
[
|
|
3197
|
-
[
|
|
3198
|
-
[
|
|
3199
|
-
[
|
|
3229
|
+
[Ze],
|
|
3230
|
+
[sn],
|
|
3231
|
+
[nn]
|
|
3200
3232
|
].forEach((i) => {
|
|
3201
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
3233
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(Y.UNIVER_SHEET, i));
|
|
3202
3234
|
});
|
|
3203
3235
|
}
|
|
3204
3236
|
};
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
],
|
|
3237
|
+
_r(Et, "type", Y.UNIVER_SHEET);
|
|
3238
|
+
_r(Et, "pluginName", bo);
|
|
3239
|
+
Et = Ro([
|
|
3240
|
+
Gr(Jr, Kr, ni, si),
|
|
3241
|
+
Zt(1, N(qe)),
|
|
3242
|
+
Zt(2, Q),
|
|
3243
|
+
Zt(3, Xr)
|
|
3244
|
+
], Et);
|
|
3213
3245
|
export {
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3246
|
+
F as ClearSheetDrawingTransformerOperation,
|
|
3247
|
+
gr as DeleteDrawingsCommand,
|
|
3248
|
+
sr as EditSheetDrawingOperation,
|
|
3249
|
+
or as GroupSheetDrawingCommand,
|
|
3250
|
+
cn as InsertFloatImageCommand,
|
|
3251
|
+
jt as InsertSheetDrawingCommand,
|
|
3252
|
+
et as MoveDrawingsCommand,
|
|
3253
|
+
Nt as RemoveSheetDrawingCommand,
|
|
3254
|
+
fr as SHEETS_IMAGE_MENU_ID,
|
|
3255
|
+
ar as SetDrawingArrangeCommand,
|
|
3256
|
+
Wt as SetSheetDrawingCommand,
|
|
3257
|
+
Tt as SheetCanvasFloatDomManagerService,
|
|
3258
|
+
ir as SidebarSheetDrawingOperation,
|
|
3259
|
+
cr as UngroupSheetDrawingCommand,
|
|
3260
|
+
Et as UniverSheetsDrawingUIPlugin
|
|
3229
3261
|
};
|