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