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