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