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