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