@univerjs/sheets-drawing-ui 0.6.0-nightly.202502181606 → 0.6.0-nightly.202502201606
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 +1 -1
- package/lib/es/facade.js +519 -381
- package/lib/es/index.js +955 -969
- package/lib/types/facade/f-event.d.ts +61 -45
- package/lib/types/facade/f-over-grid-image.d.ts +378 -217
- package/lib/types/facade/f-worksheet.d.ts +290 -131
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +2 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +16 -16
package/lib/es/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Q = (i, n,
|
|
4
|
-
import { CommandType as te, ICommandService as G, IUndoRedoService as Ye, sequenceExecute as
|
|
5
|
-
import { DocDrawingController as
|
|
6
|
-
import { SetDrawingSelectedOperation as
|
|
7
|
-
import { ImageCropperObject as
|
|
8
|
-
import { IRenderManagerService as ne, precisionTo as vt,
|
|
9
|
-
import { ISheetDrawingService as ae,
|
|
10
|
-
import { SheetCanvasPopManagerService as
|
|
11
|
-
import { ISidebarService as
|
|
12
|
-
import { takeUntil as Mn, combineLatest as St, switchMap as Se, EMPTY as pe, tap as yn, map as Ee, distinctUntilChanged as Tn, Subject as Zt, filter as
|
|
13
|
-
import { SheetInterceptorService as
|
|
1
|
+
var Er = Object.defineProperty;
|
|
2
|
+
var Or = (i, n, t) => n in i ? Er(i, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[n] = t;
|
|
3
|
+
var Q = (i, n, t) => Or(i, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { CommandType as te, ICommandService as G, IUndoRedoService as Ye, sequenceExecute as kn, LocaleService as $t, IUniverInstanceService as Ge, Inject as N, Injector as tt, IContextService as Bn, RxDisposable as Ur, UniverInstanceType as F, toDisposable as Pr, FOCUSING_COMMON_DRAWINGS as Le, DrawingTypeEnum as L, Disposable as le, ArrangeTypeEnum as mt, createDocumentModelWithStyle as Ar, ObjectRelativeFromV as Nr, ObjectRelativeFromH as kr, WrapTextType as Br, PositionedObjectLayoutType as Wr, BooleanNumber as jr, BuildTextUtils as $r, Range as xr, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as pt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as wt, InterceptorEffectEnum as Lr, ObjectMatrix as Fr, Tools as ye, IPermissionService as Yr, UserManagerService as Gr, Rectangle as Xr, Direction as Ie, FOCUSING_FX_BAR_EDITOR as Vr, EDITOR_ACTIVATED as Hr, FOCUSING_PANEL_EDITOR as zr, LifecycleService as Kr, LifecycleStages as Zr, DisposableCollection as _t, fromEventSubject as Jr, generateRandomId as Ht, DependentOn as qr, IConfigService as Qr, Plugin as ei, merge as ti, registerDependencies as ni, touchDependencies as zt } from "@univerjs/core";
|
|
5
|
+
import { DocDrawingController as ri, UniverDocsDrawingPlugin as ii } from "@univerjs/docs-drawing";
|
|
6
|
+
import { SetDrawingSelectedOperation as xt, IImageIoService as Wn, IDrawingManagerService as oe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as wn, DRAWING_IMAGE_COUNT_LIMIT as _n, ImageUploadStatusType as Be, DRAWING_IMAGE_ALLOW_SIZE as vn, getImageSize as Sn, DRAWING_IMAGE_WIDTH_LIMIT as In, DRAWING_IMAGE_HEIGHT_LIMIT as Cn, ImageSourceType as si, getDrawingShapeKeyByDrawingSearch as Ce, UniverDrawingPlugin as oi } from "@univerjs/drawing";
|
|
7
|
+
import { ImageCropperObject as ai, COMPONENT_IMAGE_POPUP_MENU as ci, OpenImageCropOperation as di, ImageResetSizeOperation as li, DrawingRenderService as jn, DrawingCommonPanel as ui, UniverDrawingUIPlugin as hi } from "@univerjs/drawing-ui";
|
|
8
|
+
import { IRenderManagerService as ne, precisionTo as vt, transformObjectOutOfGroup as gi, getGroupState as fi, RENDER_CLASS_TYPE as We, Rect as je, ObjectType as bn, DRAWING_OBJECT_LAYER_INDEX as Kt, SHEET_VIEWPORT_KEY as $n } from "@univerjs/engine-render";
|
|
9
|
+
import { ISheetDrawingService as ae, DrawingApplyType as P, SetDrawingApplyMutation as A, SheetDrawingAnchorType as U, UniverSheetsDrawingPlugin as mi } from "@univerjs/sheets-drawing";
|
|
10
|
+
import { SheetCanvasPopManagerService as pi, convertPositionSheetOverGridToAbsolute as wi, ISheetSelectionRenderService as Xe, SheetSkeletonManagerService as V, attachRangeWithCoord as xn, IEditorBridgeService as _i, IAutoFillService as vi, HoverManagerService as Si, PREDEFINED_HOOK_NAME as xe, COPY_TYPE as be, discreteRangeToRange as Rn, virtualizeDiscreteRanges as Ii, ISheetClipboardService as Ci, SheetPrintInterceptorService as bi, getCurrentRangeDisable$ as Ri, SetZoomRatioOperation as Dn, SetScrollOperation as Di } from "@univerjs/sheets-ui";
|
|
11
|
+
import { ISidebarService as Mi, useDependency as Te, IUIPartsService as yi, BuiltInUIPart as Ti, connectInjector as Ei, ILocalFileService as Oi, IMessageService as Ui, IClipboardInterfaceService as Pi, MenuItemType as cn, getMenuHiddenObservable as Ln, RibbonStartGroup as Ai, KeyCode as Fe, ComponentManager as Ni, IMenuManagerService as ki, IShortcutService as Bi, CanvasFloatDomService as Wi } from "@univerjs/ui";
|
|
12
|
+
import { takeUntil as Mn, combineLatest as St, switchMap as Se, EMPTY as pe, tap as yn, map as Ee, distinctUntilChanged as Tn, Subject as Zt, filter as ji, take as $i, BehaviorSubject as Ze, of as En } from "rxjs";
|
|
13
|
+
import { SheetInterceptorService as Lt, getSheetCommandTarget as H, SheetsSelectionsService as dn, SetRangeValuesCommand as xi, SetWorksheetRowHeightMutation as Fn, SetWorksheetColWidthMutation as Yn, SetWorksheetRowIsAutoHeightMutation as Li, SetWorksheetRowAutoHeightMutation as Gn, AddWorksheetMergeMutation as Fi, RemoveWorksheetMergeMutation as Yi, AFTER_CELL_EDIT as Gi, INTERCEPTOR_POINT as Xi, InterceptCellContentPriority as Vi, WorkbookViewPermission as On, WorksheetViewPermission as Un, WorkbookEditablePermission as Qt, WorksheetEditPermission as en, InsertRowCommand as Xn, InsertColCommand as Vn, RemoveRowCommand as Hn, RemoveColCommand as zn, DeleteRangeMoveLeftCommand as Kn, DeleteRangeMoveUpCommand as Zn, InsertRangeMoveDownCommand as Jn, InsertRangeMoveRightCommand as qn, DeltaRowHeightCommand as tn, SetRowHeightCommand as nn, DeltaColumnWidthCommand as Qn, SetColWidthCommand as er, SetRowHiddenCommand as tr, SetSpecificRowsVisibleCommand as nr, SetSpecificColsVisibleCommand as rr, SetColHiddenCommand as ir, MoveColsCommand as sr, MoveRowsCommand as or, MoveRangeCommand as ar, SetRowVisibleMutation as Hi, SetRowHiddenMutation as zi, SetColVisibleMutation as Ki, SetColHiddenMutation as Zi, SetWorksheetActiveOperation as Ji, RangeProtectionPermissionEditPoint as qi, SetFrozenMutation as Qi, COMMAND_LISTENER_SKELETON_CHANGE as es } from "@univerjs/sheets";
|
|
14
14
|
import { jsx as ee, jsxs as Tt } from "react/jsx-runtime";
|
|
15
|
-
import
|
|
16
|
-
import { docDrawingPositionToTransform as
|
|
17
|
-
import { MessageType as Re, RadioGroup as
|
|
18
|
-
const
|
|
15
|
+
import ts, { useEffect as ln, forwardRef as cr, useRef as ns, createElement as dr, useState as rn } from "react";
|
|
16
|
+
import { docDrawingPositionToTransform as rs, ReplaceSnapshotCommand as is } from "@univerjs/docs-ui";
|
|
17
|
+
import { MessageType as Re, RadioGroup as ss, Radio as Jt } from "@univerjs/design";
|
|
18
|
+
const os = "sheets-drawing-ui.config", Pn = {}, x = {
|
|
19
19
|
id: "sheet.operation.clear-drawing-transformer",
|
|
20
20
|
type: te.MUTATION,
|
|
21
21
|
handler: (i, n) => {
|
|
22
|
-
const
|
|
23
|
-
return n.forEach((
|
|
22
|
+
const t = i.get(ne);
|
|
23
|
+
return n.forEach((e) => {
|
|
24
24
|
var r, s;
|
|
25
|
-
(s = (r =
|
|
25
|
+
(s = (r = t.getRenderById(e)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
|
|
26
26
|
}), !0;
|
|
27
27
|
}
|
|
28
28
|
}, nt = {
|
|
@@ -30,27 +30,27 @@ const as = "sheets-drawing-ui.config", Un = {}, L = {
|
|
|
30
30
|
type: te.COMMAND,
|
|
31
31
|
handler: (i, n) => {
|
|
32
32
|
var S, C, D;
|
|
33
|
-
const
|
|
33
|
+
const t = i.get(G), e = i.get(Ye), r = i.get(Lt), s = i.get(ae);
|
|
34
34
|
if (!n) return !1;
|
|
35
35
|
const { drawings: o } = n, a = [];
|
|
36
36
|
o.forEach((v) => {
|
|
37
37
|
const { unitId: b } = v;
|
|
38
38
|
a.push(b);
|
|
39
39
|
});
|
|
40
|
-
const c = s.getBatchRemoveOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, f = r.onCommandExecute({ id: nt.id, params: n }), p = { id:
|
|
41
|
-
return
|
|
40
|
+
const c = s.getBatchRemoveOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, f = r.onCommandExecute({ id: nt.id, params: n }), p = { id: A.id, params: { unitId: u, subUnitId: d, op: g, objects: h, type: P.REMOVE } }, m = { id: A.id, params: { unitId: u, subUnitId: d, op: l, objects: h, type: P.INSERT } };
|
|
41
|
+
return kn([...(S = f.preRedos) != null ? S : [], p, ...f.redos], t) ? (e.pushUndoRedo({
|
|
42
42
|
unitID: u,
|
|
43
43
|
undoMutations: [
|
|
44
44
|
...(C = f.preUndos) != null ? C : [],
|
|
45
45
|
m,
|
|
46
46
|
...f.undos,
|
|
47
|
-
{ id:
|
|
47
|
+
{ id: x.id, params: a }
|
|
48
48
|
],
|
|
49
49
|
redoMutations: [
|
|
50
50
|
...(D = f.preRedos) != null ? D : [],
|
|
51
51
|
p,
|
|
52
52
|
...f.redos,
|
|
53
|
-
{ id:
|
|
53
|
+
{ id: x.id, params: a }
|
|
54
54
|
]
|
|
55
55
|
}), !0) : !1;
|
|
56
56
|
}
|
|
@@ -58,22 +58,22 @@ const as = "sheets-drawing-ui.config", Un = {}, L = {
|
|
|
58
58
|
id: "sidebar.operation.sheet-image",
|
|
59
59
|
type: te.COMMAND,
|
|
60
60
|
handler: async (i, n) => {
|
|
61
|
-
const
|
|
61
|
+
const t = i.get(Mi), e = i.get($t), r = i.get(Ge), s = i.get(G);
|
|
62
62
|
if (!H(r)) return !1;
|
|
63
63
|
switch (n.value) {
|
|
64
64
|
case "open":
|
|
65
|
-
|
|
66
|
-
header: { title:
|
|
65
|
+
t.open({
|
|
66
|
+
header: { title: e.t("sheetImage.panel.title") },
|
|
67
67
|
children: { label: lr },
|
|
68
68
|
onClose: () => {
|
|
69
|
-
s.syncExecuteCommand(
|
|
69
|
+
s.syncExecuteCommand(xt.id, []);
|
|
70
70
|
},
|
|
71
71
|
width: 360
|
|
72
72
|
});
|
|
73
73
|
break;
|
|
74
74
|
case "close":
|
|
75
75
|
default:
|
|
76
|
-
|
|
76
|
+
t.close();
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
return !0;
|
|
@@ -82,75 +82,74 @@ const as = "sheets-drawing-ui.config", Un = {}, L = {
|
|
|
82
82
|
id: "sheet.operation.edit-sheet-image",
|
|
83
83
|
type: te.OPERATION,
|
|
84
84
|
handler: (i, n) => {
|
|
85
|
-
const
|
|
86
|
-
return n == null ? !1 : (
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
uploadLoading:
|
|
90
|
-
uploadLoadingBody:
|
|
91
|
-
uploadLoadingBodyAnimation:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const i = Te(Wn), n = Te(xt), [e, t] = ns.useState(0);
|
|
85
|
+
const t = i.get(G);
|
|
86
|
+
return n == null ? !1 : (t.syncExecuteCommand(xt.id, [n]), t.executeCommand(ur.id, { value: "open" }), !0);
|
|
87
|
+
}
|
|
88
|
+
}, as = "univer-upload-loading", cs = "univer-upload-loading-body", ds = "univer-upload-loading-body-animation", ls = "univer-upload-loading-body-text", It = {
|
|
89
|
+
uploadLoading: as,
|
|
90
|
+
uploadLoadingBody: cs,
|
|
91
|
+
uploadLoadingBodyAnimation: ds,
|
|
92
|
+
uploadLoadingBodyText: ls
|
|
93
|
+
}, us = () => {
|
|
94
|
+
const i = Te(Wn), n = Te($t), [t, e] = ts.useState(0);
|
|
96
95
|
return ln(() => {
|
|
97
96
|
const r = i.change$.subscribe((s) => {
|
|
98
|
-
|
|
97
|
+
e(s);
|
|
99
98
|
});
|
|
100
99
|
return () => {
|
|
101
100
|
r.unsubscribe();
|
|
102
101
|
};
|
|
103
|
-
}, [i]), /* @__PURE__ */ ee("div", { style: { display:
|
|
102
|
+
}, [i]), /* @__PURE__ */ ee("div", { style: { display: t > 0 ? "block" : "none" }, className: It.uploadLoading, children: /* @__PURE__ */ Tt("div", { className: It.uploadLoadingBody, children: [
|
|
104
103
|
/* @__PURE__ */ ee("div", { className: It.uploadLoadingBodyAnimation }),
|
|
105
|
-
/* @__PURE__ */ ee("div", { className: It.uploadLoadingBodyText, children: `${n.t("uploadLoading.loading")}: ${
|
|
104
|
+
/* @__PURE__ */ ee("div", { className: It.uploadLoadingBodyText, children: `${n.t("uploadLoading.loading")}: ${t}` })
|
|
106
105
|
] }) });
|
|
107
106
|
};
|
|
108
|
-
var
|
|
109
|
-
for (var r =
|
|
110
|
-
(o = i[s]) && (r =
|
|
111
|
-
return
|
|
112
|
-
}, we = (i, n) => (
|
|
107
|
+
var hs = Object.getOwnPropertyDescriptor, gs = (i, n, t, e) => {
|
|
108
|
+
for (var r = e > 1 ? void 0 : e ? hs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
109
|
+
(o = i[s]) && (r = o(r) || r);
|
|
110
|
+
return r;
|
|
111
|
+
}, we = (i, n) => (t, e) => n(t, e, i);
|
|
113
112
|
let Et = class extends Ur {
|
|
114
|
-
constructor(n,
|
|
113
|
+
constructor(n, t, e, r, s, o, a, c) {
|
|
115
114
|
super();
|
|
116
115
|
Q(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
117
|
-
this._injector = n, this._drawingManagerService =
|
|
116
|
+
this._injector = n, this._drawingManagerService = t, this._canvasPopManagerService = e, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._commandService = c, this._init();
|
|
118
117
|
}
|
|
119
118
|
_init() {
|
|
120
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
119
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(Mn(this.dispose$)).subscribe((n) => this._create(n)), this._univerInstanceService.getTypeOfUnitDisposed$(F.UNIVER_SHEET).pipe(Mn(this.dispose$)).subscribe((n) => this._dispose(n)), this._univerInstanceService.getAllUnitsForType(F.UNIVER_SHEET).forEach((n) => this._create(n)), this._uiPartsService.registerComponent(Ti.CONTENT, () => Ei(us, this._injector));
|
|
121
120
|
}
|
|
122
121
|
_dispose(n) {
|
|
123
|
-
const
|
|
124
|
-
this._renderManagerService.removeRender(
|
|
122
|
+
const t = n.getUnitId();
|
|
123
|
+
this._renderManagerService.removeRender(t);
|
|
125
124
|
}
|
|
126
125
|
_create(n) {
|
|
127
126
|
if (!n)
|
|
128
127
|
return;
|
|
129
|
-
const
|
|
130
|
-
this._renderManagerService.has(
|
|
128
|
+
const t = n.getUnitId();
|
|
129
|
+
this._renderManagerService.has(t) && !this._initImagePopupMenu.has(t) && (this._popupMenuListener(t), this._initImagePopupMenu.add(t));
|
|
131
130
|
}
|
|
132
131
|
_hasCropObject(n) {
|
|
133
|
-
const
|
|
134
|
-
for (const
|
|
135
|
-
if (
|
|
132
|
+
const t = n.getAllObjectsByOrder();
|
|
133
|
+
for (const e of t)
|
|
134
|
+
if (e instanceof ai)
|
|
136
135
|
return !0;
|
|
137
136
|
return !1;
|
|
138
137
|
}
|
|
139
138
|
_popupMenuListener(n) {
|
|
140
139
|
var s;
|
|
141
|
-
const
|
|
142
|
-
if (!e)
|
|
143
|
-
return;
|
|
144
|
-
const t = e.getTransformerByCreate();
|
|
140
|
+
const t = (s = this._renderManagerService.getRenderById(n)) == null ? void 0 : s.scene;
|
|
145
141
|
if (!t)
|
|
146
142
|
return;
|
|
143
|
+
const e = t.getTransformerByCreate();
|
|
144
|
+
if (!e)
|
|
145
|
+
return;
|
|
147
146
|
let r;
|
|
148
147
|
this.disposeWithMe(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (this._contextService.setContextValue(
|
|
148
|
+
Pr(
|
|
149
|
+
e.createControl$.subscribe(() => {
|
|
150
|
+
if (this._contextService.setContextValue(Le, !0), this._hasCropObject(t))
|
|
152
151
|
return;
|
|
153
|
-
const o =
|
|
152
|
+
const o = e.getSelectedObjectMap();
|
|
154
153
|
if (o.size > 1) {
|
|
155
154
|
r == null || r.dispose();
|
|
156
155
|
return;
|
|
@@ -167,7 +166,7 @@ let Et = class extends Ur {
|
|
|
167
166
|
r == null || r.dispose();
|
|
168
167
|
const p = this._canvasPopManagerService.getFeatureMenu(d, l, g, h);
|
|
169
168
|
r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
|
|
170
|
-
componentKey:
|
|
169
|
+
componentKey: ci,
|
|
171
170
|
direction: "horizontal",
|
|
172
171
|
offset: [2, 0],
|
|
173
172
|
extraProps: {
|
|
@@ -177,74 +176,74 @@ let Et = class extends Ur {
|
|
|
177
176
|
})
|
|
178
177
|
)
|
|
179
178
|
), this.disposeWithMe(
|
|
180
|
-
|
|
181
|
-
r == null || r.dispose(), this._contextService.setContextValue(
|
|
179
|
+
e.clearControl$.subscribe(() => {
|
|
180
|
+
r == null || r.dispose(), this._contextService.setContextValue(Le, !1), this._commandService.syncExecuteCommand(xt.id, []);
|
|
182
181
|
})
|
|
183
182
|
), this.disposeWithMe(
|
|
184
183
|
this._contextService.contextChanged$.subscribe((o) => {
|
|
185
|
-
o[
|
|
184
|
+
o[Le] === !1 && (r == null || r.dispose());
|
|
186
185
|
})
|
|
187
186
|
), this.disposeWithMe(
|
|
188
|
-
|
|
187
|
+
e.changing$.subscribe(() => {
|
|
189
188
|
r == null || r.dispose();
|
|
190
189
|
})
|
|
191
190
|
);
|
|
192
191
|
}
|
|
193
|
-
_getImageMenuItems(n,
|
|
192
|
+
_getImageMenuItems(n, t, e, r) {
|
|
194
193
|
return [
|
|
195
194
|
{
|
|
196
195
|
label: "image-popup.edit",
|
|
197
196
|
index: 0,
|
|
198
197
|
commandId: hr.id,
|
|
199
|
-
commandParams: { unitId: n, subUnitId:
|
|
200
|
-
disable: r ===
|
|
198
|
+
commandParams: { unitId: n, subUnitId: t, drawingId: e },
|
|
199
|
+
disable: r === L.DRAWING_DOM
|
|
201
200
|
},
|
|
202
201
|
{
|
|
203
202
|
label: "image-popup.delete",
|
|
204
203
|
index: 1,
|
|
205
204
|
commandId: nt.id,
|
|
206
|
-
commandParams: { unitId: n, drawings: [{ unitId: n, subUnitId:
|
|
205
|
+
commandParams: { unitId: n, drawings: [{ unitId: n, subUnitId: t, drawingId: e }] },
|
|
207
206
|
disable: !1
|
|
208
207
|
},
|
|
209
208
|
{
|
|
210
209
|
label: "image-popup.crop",
|
|
211
210
|
index: 2,
|
|
212
|
-
commandId:
|
|
213
|
-
commandParams: { unitId: n, subUnitId:
|
|
214
|
-
disable: r ===
|
|
211
|
+
commandId: di.id,
|
|
212
|
+
commandParams: { unitId: n, subUnitId: t, drawingId: e },
|
|
213
|
+
disable: r === L.DRAWING_DOM
|
|
215
214
|
},
|
|
216
215
|
{
|
|
217
216
|
label: "image-popup.reset",
|
|
218
217
|
index: 3,
|
|
219
|
-
commandId:
|
|
220
|
-
commandParams: [{ unitId: n, subUnitId:
|
|
221
|
-
disable: r ===
|
|
218
|
+
commandId: li.id,
|
|
219
|
+
commandParams: [{ unitId: n, subUnitId: t, drawingId: e }],
|
|
220
|
+
disable: r === L.DRAWING_DOM
|
|
222
221
|
}
|
|
223
222
|
];
|
|
224
223
|
}
|
|
225
224
|
};
|
|
226
|
-
Et =
|
|
225
|
+
Et = gs([
|
|
227
226
|
we(0, N(tt)),
|
|
228
227
|
we(1, oe),
|
|
229
|
-
we(2, N(
|
|
228
|
+
we(2, N(pi)),
|
|
230
229
|
we(3, ne),
|
|
231
230
|
we(4, Ge),
|
|
232
231
|
we(5, Bn),
|
|
233
|
-
we(6, N(
|
|
232
|
+
we(6, N(yi)),
|
|
234
233
|
we(7, G)
|
|
235
234
|
], Et);
|
|
236
|
-
function z(i, n,
|
|
237
|
-
const { from:
|
|
235
|
+
function z(i, n, t) {
|
|
236
|
+
const { from: e, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: c = 0, skewY: u = 0 } = i, d = t.getCurrent();
|
|
238
237
|
if (d == null)
|
|
239
238
|
return;
|
|
240
|
-
const l =
|
|
239
|
+
const l = wi(
|
|
241
240
|
d.unitId,
|
|
242
241
|
d.sheetId,
|
|
243
|
-
{ from:
|
|
244
|
-
|
|
242
|
+
{ from: e, to: r },
|
|
243
|
+
t
|
|
245
244
|
);
|
|
246
245
|
let { left: g, top: h, width: f, height: p } = l;
|
|
247
|
-
const m =
|
|
246
|
+
const m = t.getCurrentSkeleton(), w = m.rowHeaderWidth + m.columnTotalWidth, S = m.columnHeaderHeight + m.rowTotalHeight;
|
|
248
247
|
return g + f > w && (g = w - f), h + p > S && (h = S - p), {
|
|
249
248
|
flipY: s,
|
|
250
249
|
flipX: o,
|
|
@@ -257,23 +256,23 @@ function z(i, n, e) {
|
|
|
257
256
|
height: p
|
|
258
257
|
};
|
|
259
258
|
}
|
|
260
|
-
function
|
|
261
|
-
const { left:
|
|
259
|
+
function $(i, n) {
|
|
260
|
+
const { left: t = 0, top: e = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: c = 0, skewX: u = 0, skewY: d = 0 } = i, l = n.getCellWithCoordByOffset(t, e);
|
|
262
261
|
if (l == null)
|
|
263
262
|
return;
|
|
264
263
|
const g = {
|
|
265
264
|
column: l.actualColumn,
|
|
266
|
-
columnOffset: vt(
|
|
265
|
+
columnOffset: vt(t - l.startX, 1),
|
|
267
266
|
row: l.actualRow,
|
|
268
|
-
rowOffset: vt(
|
|
269
|
-
}, h = n.getCellWithCoordByOffset(
|
|
267
|
+
rowOffset: vt(e - l.startY, 1)
|
|
268
|
+
}, h = n.getCellWithCoordByOffset(t + r, e + s);
|
|
270
269
|
if (h == null)
|
|
271
270
|
return;
|
|
272
271
|
const f = {
|
|
273
272
|
column: h.actualColumn,
|
|
274
|
-
columnOffset: vt(
|
|
273
|
+
columnOffset: vt(t + r - h.startX, 1),
|
|
275
274
|
row: h.actualRow,
|
|
276
|
-
rowOffset: vt(
|
|
275
|
+
rowOffset: vt(e + s - h.startY, 1)
|
|
277
276
|
};
|
|
278
277
|
return {
|
|
279
278
|
flipY: o,
|
|
@@ -285,14 +284,14 @@ function x(i, n) {
|
|
|
285
284
|
to: f
|
|
286
285
|
};
|
|
287
286
|
}
|
|
288
|
-
var
|
|
289
|
-
for (var r =
|
|
290
|
-
(o = i[s]) && (r =
|
|
291
|
-
return
|
|
292
|
-
}, Ct = (i, n) => (
|
|
287
|
+
var fs = Object.getOwnPropertyDescriptor, ms = (i, n, t, e) => {
|
|
288
|
+
for (var r = e > 1 ? void 0 : e ? fs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
289
|
+
(o = i[s]) && (r = o(r) || r);
|
|
290
|
+
return r;
|
|
291
|
+
}, Ct = (i, n) => (t, e) => n(t, e, i);
|
|
293
292
|
let sn = class extends le {
|
|
294
|
-
constructor(i, n,
|
|
295
|
-
super(), this._context = i, this._sheetDrawingService = n, this._drawingManagerService =
|
|
293
|
+
constructor(i, n, t, e, r) {
|
|
294
|
+
super(), this._context = i, this._sheetDrawingService = n, this._drawingManagerService = t, this._sheetSelectionRenderService = e, this._sheetSkeletonManagerService = r, this._init();
|
|
296
295
|
}
|
|
297
296
|
_init() {
|
|
298
297
|
this._drawingInitializeListener();
|
|
@@ -301,25 +300,25 @@ let sn = class extends le {
|
|
|
301
300
|
this._sheetDrawingService.initializeNotification(this._context.unitId);
|
|
302
301
|
const i = this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);
|
|
303
302
|
for (const n in i) {
|
|
304
|
-
const
|
|
305
|
-
for (const
|
|
306
|
-
const r =
|
|
303
|
+
const t = i[n];
|
|
304
|
+
for (const e in t.data) {
|
|
305
|
+
const r = t.data[e];
|
|
307
306
|
r.transform = z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
|
|
308
307
|
}
|
|
309
308
|
}
|
|
310
309
|
this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
|
|
311
310
|
}
|
|
312
311
|
};
|
|
313
|
-
sn =
|
|
312
|
+
sn = ms([
|
|
314
313
|
Ct(1, ae),
|
|
315
314
|
Ct(2, oe),
|
|
316
315
|
Ct(3, N(Xe)),
|
|
317
316
|
Ct(4, N(V))
|
|
318
317
|
], sn);
|
|
319
|
-
function
|
|
318
|
+
function ps(i) {
|
|
320
319
|
const n = [];
|
|
321
|
-
return i.forEach((
|
|
322
|
-
const { parent:
|
|
320
|
+
return i.forEach((t) => {
|
|
321
|
+
const { parent: e, children: r } = t, { unitId: s, subUnitId: o, drawingId: a } = e, c = fi(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
|
|
323
322
|
const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: p } = l;
|
|
324
323
|
return {
|
|
325
324
|
unitId: h,
|
|
@@ -336,7 +335,7 @@ function Ss(i) {
|
|
|
336
335
|
unitId: s,
|
|
337
336
|
subUnitId: o,
|
|
338
337
|
drawingId: a,
|
|
339
|
-
drawingType:
|
|
338
|
+
drawingType: L.DRAWING_GROUP,
|
|
340
339
|
transform: c
|
|
341
340
|
};
|
|
342
341
|
n.push({
|
|
@@ -345,14 +344,14 @@ function Ss(i) {
|
|
|
345
344
|
});
|
|
346
345
|
}), n;
|
|
347
346
|
}
|
|
348
|
-
function
|
|
347
|
+
function ws(i) {
|
|
349
348
|
const n = [];
|
|
350
|
-
return i.forEach((
|
|
351
|
-
const { parent:
|
|
349
|
+
return i.forEach((t) => {
|
|
350
|
+
const { parent: e, children: r } = t, { unitId: s, subUnitId: o, drawingId: a, transform: c = { width: 0, height: 0 } } = e;
|
|
352
351
|
if (c == null)
|
|
353
352
|
return;
|
|
354
353
|
const u = r.map((l) => {
|
|
355
|
-
const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: p } = l, m =
|
|
354
|
+
const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: p } = l, m = gi(g || {}, c, c.width || 0, c.height || 0);
|
|
356
355
|
return {
|
|
357
356
|
unitId: h,
|
|
358
357
|
subUnitId: f,
|
|
@@ -364,7 +363,7 @@ function Is(i) {
|
|
|
364
363
|
unitId: s,
|
|
365
364
|
subUnitId: o,
|
|
366
365
|
drawingId: a,
|
|
367
|
-
drawingType:
|
|
366
|
+
drawingType: L.DRAWING_GROUP,
|
|
368
367
|
transform: {
|
|
369
368
|
left: 0,
|
|
370
369
|
top: 0
|
|
@@ -380,7 +379,7 @@ const gr = {
|
|
|
380
379
|
id: "sheet.command.group-sheet-image",
|
|
381
380
|
type: te.COMMAND,
|
|
382
381
|
handler: (i, n) => {
|
|
383
|
-
const
|
|
382
|
+
const t = i.get(G), e = i.get(Ye), r = i.get(ae);
|
|
384
383
|
if (!n) return !1;
|
|
385
384
|
const s = [];
|
|
386
385
|
n.forEach(({ parent: h, children: f }) => {
|
|
@@ -389,39 +388,39 @@ const gr = {
|
|
|
389
388
|
});
|
|
390
389
|
});
|
|
391
390
|
const o = r.getGroupDrawingOp(n), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
|
|
392
|
-
return
|
|
391
|
+
return t.syncExecuteCommand(A.id, { op: d, unitId: a, subUnitId: c, objects: l, type: P.GROUP }) ? (e.pushUndoRedo({
|
|
393
392
|
unitID: a,
|
|
394
393
|
undoMutations: [
|
|
395
|
-
{ id:
|
|
396
|
-
{ id:
|
|
394
|
+
{ id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: ws(l), type: P.UNGROUP } },
|
|
395
|
+
{ id: x.id, params: s }
|
|
397
396
|
],
|
|
398
397
|
redoMutations: [
|
|
399
|
-
{ id:
|
|
400
|
-
{ id:
|
|
398
|
+
{ id: A.id, params: { op: d, unitId: a, subUnitId: c, objects: l, type: P.GROUP } },
|
|
399
|
+
{ id: x.id, params: s }
|
|
401
400
|
]
|
|
402
401
|
}), !0) : !1;
|
|
403
402
|
}
|
|
404
|
-
},
|
|
403
|
+
}, Ft = {
|
|
405
404
|
id: "sheet.command.insert-sheet-image",
|
|
406
405
|
type: te.COMMAND,
|
|
407
406
|
handler: (i, n) => {
|
|
408
407
|
var S, C, D;
|
|
409
|
-
const
|
|
408
|
+
const t = i.get(G), e = i.get(Ye), r = i.get(ae), s = i.get(Lt);
|
|
410
409
|
if (!n) return !1;
|
|
411
|
-
const o = n.drawings, a = o.map((v) => v.unitId), c = r.getBatchAddOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, f = s.onCommandExecute({ id:
|
|
412
|
-
return
|
|
410
|
+
const o = n.drawings, a = o.map((v) => v.unitId), c = r.getBatchAddOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, f = s.onCommandExecute({ id: Ft.id, params: n }), p = { id: A.id, params: { op: g, unitId: u, subUnitId: d, objects: h, type: P.INSERT } }, m = { id: A.id, params: { op: l, unitId: u, subUnitId: d, objects: h, type: P.REMOVE } };
|
|
411
|
+
return kn([...(S = f.preRedos) != null ? S : [], p, ...f.redos], t) ? (e.pushUndoRedo({
|
|
413
412
|
unitID: u,
|
|
414
413
|
undoMutations: [
|
|
415
414
|
...(C = f.preUndos) != null ? C : [],
|
|
416
415
|
m,
|
|
417
416
|
...f.undos,
|
|
418
|
-
{ id:
|
|
417
|
+
{ id: x.id, params: a }
|
|
419
418
|
],
|
|
420
419
|
redoMutations: [
|
|
421
420
|
...(D = f.preRedos) != null ? D : [],
|
|
422
421
|
p,
|
|
423
422
|
...f.redos,
|
|
424
|
-
{ id:
|
|
423
|
+
{ id: x.id, params: a }
|
|
425
424
|
]
|
|
426
425
|
}), !0) : !1;
|
|
427
426
|
}
|
|
@@ -429,20 +428,20 @@ const gr = {
|
|
|
429
428
|
id: "sheet.command.set-drawing-arrange",
|
|
430
429
|
type: te.COMMAND,
|
|
431
430
|
handler: (i, n) => {
|
|
432
|
-
const
|
|
431
|
+
const t = i.get(G), e = i.get(Ye);
|
|
433
432
|
if (!n) return !1;
|
|
434
433
|
const r = i.get(ae), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: c } = n, u = { unitId: s, subUnitId: o, drawingIds: a };
|
|
435
434
|
let d;
|
|
436
435
|
if (c === mt.forward ? d = r.getForwardDrawingsOp(u) : c === mt.backward ? d = r.getBackwardDrawingOp(u) : c === mt.front ? d = r.getFrontDrawingsOp(u) : c === mt.back && (d = r.getBackDrawingsOp(u)), d == null)
|
|
437
436
|
return !1;
|
|
438
437
|
const { objects: l, redo: g, undo: h } = d;
|
|
439
|
-
return
|
|
438
|
+
return t.syncExecuteCommand(A.id, { op: g, unitId: s, subUnitId: o, objects: l, type: P.ARRANGE }) ? (e.pushUndoRedo({
|
|
440
439
|
unitID: s,
|
|
441
440
|
undoMutations: [
|
|
442
|
-
{ id:
|
|
441
|
+
{ id: A.id, params: { op: h, unitId: s, subUnitId: o, objects: l, type: P.ARRANGE } }
|
|
443
442
|
],
|
|
444
443
|
redoMutations: [
|
|
445
|
-
{ id:
|
|
444
|
+
{ id: A.id, params: { op: g, unitId: s, subUnitId: o, objects: l, type: P.ARRANGE } }
|
|
446
445
|
]
|
|
447
446
|
}), !0) : !1;
|
|
448
447
|
}
|
|
@@ -450,18 +449,18 @@ const gr = {
|
|
|
450
449
|
id: "sheet.command.set-sheet-image",
|
|
451
450
|
type: te.COMMAND,
|
|
452
451
|
handler: (i, n) => {
|
|
453
|
-
const
|
|
452
|
+
const t = i.get(G), e = i.get(Ye), r = i.get(ae);
|
|
454
453
|
if (!n) return !1;
|
|
455
454
|
const { drawings: s } = n, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
|
|
456
|
-
return
|
|
455
|
+
return t.syncExecuteCommand(A.id, { unitId: a, subUnitId: c, op: d, objects: l, type: P.UPDATE }) ? (e.pushUndoRedo({
|
|
457
456
|
unitID: a,
|
|
458
457
|
undoMutations: [
|
|
459
|
-
{ id:
|
|
460
|
-
{ id:
|
|
458
|
+
{ id: A.id, params: { unitId: a, subUnitId: c, op: u, objects: l, type: P.UPDATE } },
|
|
459
|
+
{ id: x.id, params: [a] }
|
|
461
460
|
],
|
|
462
461
|
redoMutations: [
|
|
463
|
-
{ id:
|
|
464
|
-
{ id:
|
|
462
|
+
{ id: A.id, params: { unitId: a, subUnitId: c, op: d, objects: l, type: P.UPDATE } },
|
|
463
|
+
{ id: x.id, params: [a] }
|
|
465
464
|
]
|
|
466
465
|
}), !0) : !1;
|
|
467
466
|
}
|
|
@@ -469,7 +468,7 @@ const gr = {
|
|
|
469
468
|
id: "sheet.command.ungroup-sheet-image",
|
|
470
469
|
type: te.COMMAND,
|
|
471
470
|
handler: (i, n) => {
|
|
472
|
-
const
|
|
471
|
+
const t = i.get(G), e = i.get(Ye), r = i.get(ae);
|
|
473
472
|
if (!n) return !1;
|
|
474
473
|
const s = [];
|
|
475
474
|
n.forEach(({ parent: h, children: f }) => {
|
|
@@ -478,31 +477,31 @@ const gr = {
|
|
|
478
477
|
});
|
|
479
478
|
});
|
|
480
479
|
const o = r.getUngroupDrawingOp(n), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
|
|
481
|
-
return
|
|
480
|
+
return t.syncExecuteCommand(A.id, { op: d, unitId: a, subUnitId: c, objects: l, type: P.UNGROUP }) ? (e.pushUndoRedo({
|
|
482
481
|
unitID: a,
|
|
483
482
|
undoMutations: [
|
|
484
|
-
{ id:
|
|
485
|
-
{ id:
|
|
483
|
+
{ id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: ps(l), type: P.GROUP } },
|
|
484
|
+
{ id: x.id, params: s }
|
|
486
485
|
],
|
|
487
486
|
redoMutations: [
|
|
488
|
-
{ id:
|
|
489
|
-
{ id:
|
|
487
|
+
{ id: A.id, params: { op: d, unitId: a, subUnitId: c, objects: l, type: P.UNGROUP } },
|
|
488
|
+
{ id: x.id, params: s }
|
|
490
489
|
]
|
|
491
490
|
}), !0) : !1;
|
|
492
491
|
}
|
|
493
492
|
};
|
|
494
|
-
var
|
|
495
|
-
for (var r =
|
|
496
|
-
(o = i[s]) && (r =
|
|
497
|
-
return
|
|
498
|
-
}, ie = (i, n) => (
|
|
499
|
-
function
|
|
500
|
-
const
|
|
493
|
+
var _s = Object.getOwnPropertyDescriptor, vs = (i, n, t, e) => {
|
|
494
|
+
for (var r = e > 1 ? void 0 : e ? _s(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
495
|
+
(o = i[s]) && (r = o(r) || r);
|
|
496
|
+
return r;
|
|
497
|
+
}, ie = (i, n) => (t, e) => n(t, e, i);
|
|
498
|
+
function Ss(i, n, t) {
|
|
499
|
+
const e = t * Math.PI / 180, r = Math.abs(i * Math.cos(e)) + Math.abs(n * Math.sin(e)), s = Math.abs(i * Math.sin(e)) + Math.abs(n * Math.cos(e));
|
|
501
500
|
return { rotatedWidth: r, rotatedHeight: s };
|
|
502
501
|
}
|
|
503
|
-
function pr(i, n,
|
|
502
|
+
function pr(i, n, t, e, r) {
|
|
504
503
|
var S;
|
|
505
|
-
const { rotatedHeight: s, rotatedWidth: o } =
|
|
504
|
+
const { rotatedHeight: s, rotatedWidth: o } = Ss(t, e, r), c = i.get(ne).getRenderById(n.unitId);
|
|
506
505
|
if (!c)
|
|
507
506
|
return !1;
|
|
508
507
|
const d = (S = c.with(V).getSkeletonParam(n.subUnitId)) == null ? void 0 : S.skeleton;
|
|
@@ -510,37 +509,37 @@ function pr(i, n, e, t, r) {
|
|
|
510
509
|
return !1;
|
|
511
510
|
const l = d.getCellByIndex(n.row, n.col), g = l.mergeInfo.endX - l.mergeInfo.startX - 2, h = l.mergeInfo.endY - l.mergeInfo.startY - 2, f = o / s, m = Math.ceil(Math.min(g, h * f)) / o, w = !m || Number.isNaN(m) ? 1e-3 : m;
|
|
512
511
|
return {
|
|
513
|
-
width:
|
|
514
|
-
height:
|
|
512
|
+
width: t * w,
|
|
513
|
+
height: e * w
|
|
515
514
|
};
|
|
516
515
|
}
|
|
517
516
|
let et = class extends le {
|
|
518
|
-
constructor(n,
|
|
517
|
+
constructor(n, t, e, r, s, o, a, c, u, d, l, g, h) {
|
|
519
518
|
super();
|
|
520
519
|
Q(this, "_workbookSelections");
|
|
521
|
-
this._context = n, this._skeletonManagerService =
|
|
520
|
+
this._context = n, this._skeletonManagerService = t, this._commandService = e, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = a, this._drawingManagerService = c, this._contextService = u, this._messageService = d, this._localeService = l, this._injector = h, this._workbookSelections = g.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
|
|
522
521
|
}
|
|
523
522
|
async insertFloatImage() {
|
|
524
523
|
const n = await this._fileOpenerService.openFile({
|
|
525
524
|
multiple: !0,
|
|
526
|
-
accept: wn.map((
|
|
527
|
-
}),
|
|
528
|
-
return
|
|
525
|
+
accept: wn.map((e) => `.${e.replace("image/", "")}`).join(",")
|
|
526
|
+
}), t = n.length;
|
|
527
|
+
return t > _n ? (this._messageService.show({
|
|
529
528
|
type: Re.Error,
|
|
530
529
|
content: this._localeService.t("update-status.exceedMaxCount", String(_n))
|
|
531
|
-
}), !1) :
|
|
530
|
+
}), !1) : t === 0 ? !1 : (n.forEach(async (e) => await this.insertFloatImageByFile(e)), !0);
|
|
532
531
|
}
|
|
533
532
|
async insertCellImage() {
|
|
534
|
-
const
|
|
533
|
+
const t = (await this._fileOpenerService.openFile({
|
|
535
534
|
multiple: !1,
|
|
536
|
-
accept: wn.map((
|
|
535
|
+
accept: wn.map((e) => `.${e.replace("image/", "")}`).join(",")
|
|
537
536
|
}))[0];
|
|
538
|
-
return
|
|
537
|
+
return t ? (await this._insertCellImage(t), !0) : !1;
|
|
539
538
|
}
|
|
540
539
|
async insertFloatImageByFile(n) {
|
|
541
|
-
let
|
|
540
|
+
let t;
|
|
542
541
|
try {
|
|
543
|
-
|
|
542
|
+
t = await this._imageIoService.saveImage(n);
|
|
544
543
|
} catch (S) {
|
|
545
544
|
const C = S.message;
|
|
546
545
|
C === Be.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
@@ -554,9 +553,9 @@ let et = class extends le {
|
|
|
554
553
|
content: this._localeService.t("update-status.invalidImage")
|
|
555
554
|
});
|
|
556
555
|
}
|
|
557
|
-
if (
|
|
556
|
+
if (t == null)
|
|
558
557
|
return;
|
|
559
|
-
const
|
|
558
|
+
const e = this._getUnitInfo(), { unitId: r, subUnitId: s } = e, { imageId: o, imageSourceType: a, source: c, base64Cache: u } = t, { width: d, height: l, image: g } = await Sn(u || ""), { width: h, height: f } = this._context.scene;
|
|
560
559
|
this._imageIoService.addImageSourceCache(c, a, g);
|
|
561
560
|
let p = 1;
|
|
562
561
|
if (d > In || l > Cn) {
|
|
@@ -570,22 +569,22 @@ let et = class extends le {
|
|
|
570
569
|
unitId: r,
|
|
571
570
|
subUnitId: s,
|
|
572
571
|
drawingId: o,
|
|
573
|
-
drawingType:
|
|
572
|
+
drawingType: L.DRAWING_IMAGE,
|
|
574
573
|
imageSourceType: a,
|
|
575
574
|
source: c,
|
|
576
575
|
transform: z(m, this._selectionRenderService, this._skeletonManagerService),
|
|
577
576
|
sheetTransform: m
|
|
578
577
|
};
|
|
579
|
-
return this._commandService.executeCommand(
|
|
578
|
+
return this._commandService.executeCommand(Ft.id, {
|
|
580
579
|
unitId: r,
|
|
581
580
|
drawings: [w]
|
|
582
581
|
});
|
|
583
582
|
}
|
|
584
583
|
// eslint-disable-next-line max-lines-per-function
|
|
585
584
|
async _insertCellImage(n) {
|
|
586
|
-
let
|
|
585
|
+
let t;
|
|
587
586
|
try {
|
|
588
|
-
|
|
587
|
+
t = await this._imageIoService.saveImage(n);
|
|
589
588
|
} catch (m) {
|
|
590
589
|
const w = m.message;
|
|
591
590
|
w === Be.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
@@ -599,14 +598,14 @@ let et = class extends le {
|
|
|
599
598
|
content: this._localeService.t("update-status.invalidImage")
|
|
600
599
|
});
|
|
601
600
|
}
|
|
602
|
-
if (
|
|
601
|
+
if (t == null)
|
|
603
602
|
return;
|
|
604
|
-
const { imageId:
|
|
603
|
+
const { imageId: e, imageSourceType: r, source: s, base64Cache: o } = t, { width: a, height: c, image: u } = await Sn(o || "");
|
|
605
604
|
this._imageIoService.addImageSourceCache(s, r, u);
|
|
606
605
|
const d = this._workbookSelections.getCurrentLastSelection();
|
|
607
606
|
if (!d)
|
|
608
607
|
return !1;
|
|
609
|
-
const l =
|
|
608
|
+
const l = Ar("", {}), g = pr(
|
|
610
609
|
this._injector,
|
|
611
610
|
{
|
|
612
611
|
unitId: this._context.unitId,
|
|
@@ -626,34 +625,34 @@ let et = class extends le {
|
|
|
626
625
|
height: g.height
|
|
627
626
|
},
|
|
628
627
|
positionH: {
|
|
629
|
-
relativeFrom:
|
|
628
|
+
relativeFrom: kr.PAGE,
|
|
630
629
|
posOffset: 0
|
|
631
630
|
},
|
|
632
631
|
positionV: {
|
|
633
|
-
relativeFrom:
|
|
632
|
+
relativeFrom: Nr.PARAGRAPH,
|
|
634
633
|
posOffset: 0
|
|
635
634
|
},
|
|
636
635
|
angle: 0
|
|
637
636
|
}, f = {
|
|
638
637
|
unitId: l.getUnitId(),
|
|
639
638
|
subUnitId: l.getUnitId(),
|
|
640
|
-
drawingId:
|
|
641
|
-
drawingType:
|
|
639
|
+
drawingId: e,
|
|
640
|
+
drawingType: L.DRAWING_IMAGE,
|
|
642
641
|
imageSourceType: r,
|
|
643
642
|
source: s,
|
|
644
|
-
transform:
|
|
643
|
+
transform: rs(h),
|
|
645
644
|
docTransform: h,
|
|
646
|
-
behindDoc:
|
|
645
|
+
behindDoc: jr.FALSE,
|
|
647
646
|
title: "",
|
|
648
647
|
description: "",
|
|
649
|
-
layoutType:
|
|
648
|
+
layoutType: Wr.INLINE,
|
|
650
649
|
// Insert inline drawing by default.
|
|
651
|
-
wrapText:
|
|
650
|
+
wrapText: Br.BOTH_SIDES,
|
|
652
651
|
distB: 0,
|
|
653
652
|
distL: 0,
|
|
654
653
|
distR: 0,
|
|
655
654
|
distT: 0
|
|
656
|
-
}, p =
|
|
655
|
+
}, p = $r.drawing.add({
|
|
657
656
|
documentDataModel: l,
|
|
658
657
|
drawings: [f],
|
|
659
658
|
selection: {
|
|
@@ -662,7 +661,7 @@ let et = class extends le {
|
|
|
662
661
|
endOffset: 0
|
|
663
662
|
}
|
|
664
663
|
});
|
|
665
|
-
return p ? (l.apply(p), this._commandService.syncExecuteCommand(
|
|
664
|
+
return p ? (l.apply(p), this._commandService.syncExecuteCommand(xi.id, {
|
|
666
665
|
value: {
|
|
667
666
|
[d.primary.actualRow]: {
|
|
668
667
|
[d.primary.actualColumn]: {
|
|
@@ -674,13 +673,13 @@ let et = class extends le {
|
|
|
674
673
|
})) : !1;
|
|
675
674
|
}
|
|
676
675
|
_getUnitInfo() {
|
|
677
|
-
const n = this._context.unit,
|
|
676
|
+
const n = this._context.unit, t = n.getActiveSheet(), e = n.getUnitId(), r = t.getSheetId();
|
|
678
677
|
return {
|
|
679
|
-
unitId:
|
|
678
|
+
unitId: e,
|
|
680
679
|
subUnitId: r
|
|
681
680
|
};
|
|
682
681
|
}
|
|
683
|
-
_getImagePosition(n,
|
|
682
|
+
_getImagePosition(n, t, e, r) {
|
|
684
683
|
const s = this._workbookSelections.getCurrentSelections();
|
|
685
684
|
let o = {
|
|
686
685
|
startRow: 0,
|
|
@@ -689,11 +688,11 @@ let et = class extends le {
|
|
|
689
688
|
endColumn: 0
|
|
690
689
|
};
|
|
691
690
|
s && s.length > 0 && (o = s[s.length - 1].range);
|
|
692
|
-
const a =
|
|
691
|
+
const a = xn(this._skeletonManagerService.getCurrent().skeleton, o);
|
|
693
692
|
if (a == null)
|
|
694
693
|
return;
|
|
695
694
|
let { startColumn: c, startRow: u, startX: d, startY: l } = a, g = !1;
|
|
696
|
-
if (d + n >
|
|
695
|
+
if (d + n > e && (d = e - n, d < 0 && (d = 0, n = e), g = !0), l + t > r && (l = r - t, l < 0 && (l = 0, t = r), g = !0), g) {
|
|
697
696
|
const m = this._selectionRenderService.getCellWithCoordByOffset(d, l);
|
|
698
697
|
if (m == null)
|
|
699
698
|
return;
|
|
@@ -704,14 +703,14 @@ let et = class extends le {
|
|
|
704
703
|
columnOffset: 0,
|
|
705
704
|
row: u,
|
|
706
705
|
rowOffset: 0
|
|
707
|
-
}, f = this._selectionRenderService.getCellWithCoordByOffset(d + n, l +
|
|
706
|
+
}, f = this._selectionRenderService.getCellWithCoordByOffset(d + n, l + t);
|
|
708
707
|
if (f == null)
|
|
709
708
|
return;
|
|
710
709
|
const p = {
|
|
711
710
|
column: f.actualColumn,
|
|
712
711
|
columnOffset: d + n - f.startX,
|
|
713
712
|
row: f.actualRow,
|
|
714
|
-
rowOffset: l +
|
|
713
|
+
rowOffset: l + t - f.startY
|
|
715
714
|
};
|
|
716
715
|
return {
|
|
717
716
|
from: h,
|
|
@@ -720,10 +719,10 @@ let et = class extends le {
|
|
|
720
719
|
}
|
|
721
720
|
_updateOrderListener() {
|
|
722
721
|
this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((n) => {
|
|
723
|
-
const { unitId:
|
|
722
|
+
const { unitId: t, subUnitId: e, drawingIds: r, arrangeType: s } = n;
|
|
724
723
|
this._commandService.executeCommand(fr.id, {
|
|
725
|
-
unitId:
|
|
726
|
-
subUnitId:
|
|
724
|
+
unitId: t,
|
|
725
|
+
subUnitId: e,
|
|
727
726
|
drawingIds: r,
|
|
728
727
|
arrangeType: s
|
|
729
728
|
});
|
|
@@ -731,34 +730,34 @@ let et = class extends le {
|
|
|
731
730
|
}
|
|
732
731
|
_updateImageListener() {
|
|
733
732
|
this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe((n) => {
|
|
734
|
-
const
|
|
735
|
-
n.length !== 0 && (n.forEach((
|
|
736
|
-
const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform: c } =
|
|
733
|
+
const t = [];
|
|
734
|
+
n.length !== 0 && (n.forEach((e) => {
|
|
735
|
+
const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform: c } = e;
|
|
737
736
|
if (c == null)
|
|
738
737
|
return;
|
|
739
738
|
const u = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
|
|
740
739
|
if (u == null || u.unitId !== this._context.unitId)
|
|
741
740
|
return;
|
|
742
|
-
const d =
|
|
741
|
+
const d = $({ ...u.transform, ...c }, this._selectionRenderService);
|
|
743
742
|
if (d == null)
|
|
744
743
|
return;
|
|
745
744
|
const l = {
|
|
746
|
-
...
|
|
745
|
+
...e,
|
|
747
746
|
transform: { ...u.transform, ...c, ...z(d, this._selectionRenderService, this._skeletonManagerService) },
|
|
748
747
|
sheetTransform: { ...d }
|
|
749
748
|
};
|
|
750
|
-
|
|
751
|
-
}),
|
|
749
|
+
t.push(l);
|
|
750
|
+
}), t.length > 0 && this._commandService.executeCommand(Yt.id, {
|
|
752
751
|
unitId: n[0].unitId,
|
|
753
|
-
drawings:
|
|
752
|
+
drawings: t
|
|
754
753
|
}));
|
|
755
754
|
}));
|
|
756
755
|
}
|
|
757
756
|
_groupDrawingListener() {
|
|
758
757
|
this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((n) => {
|
|
759
758
|
this._commandService.executeCommand(gr.id, n);
|
|
760
|
-
const { unitId:
|
|
761
|
-
this._commandService.syncExecuteCommand(
|
|
759
|
+
const { unitId: t, subUnitId: e, drawingId: r } = n[0].parent;
|
|
760
|
+
this._commandService.syncExecuteCommand(xt.id, [{ unitId: t, subUnitId: e, drawingId: r }]);
|
|
762
761
|
})), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((n) => {
|
|
763
762
|
this._commandService.executeCommand(mr.id, n);
|
|
764
763
|
}));
|
|
@@ -766,34 +765,34 @@ let et = class extends le {
|
|
|
766
765
|
_focusDrawingListener() {
|
|
767
766
|
this.disposeWithMe(
|
|
768
767
|
this._drawingManagerService.focus$.subscribe((n) => {
|
|
769
|
-
n == null || n.length === 0 ? (this._contextService.setContextValue(
|
|
768
|
+
n == null || n.length === 0 ? (this._contextService.setContextValue(Le, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(Le, !0), this._sheetDrawingService.focusDrawing(n));
|
|
770
769
|
})
|
|
771
770
|
);
|
|
772
771
|
}
|
|
773
772
|
};
|
|
774
|
-
et =
|
|
773
|
+
et = vs([
|
|
775
774
|
ie(1, N(V)),
|
|
776
775
|
ie(2, G),
|
|
777
776
|
ie(3, Xe),
|
|
778
777
|
ie(4, Wn),
|
|
779
|
-
ie(5,
|
|
778
|
+
ie(5, Oi),
|
|
780
779
|
ie(6, ae),
|
|
781
780
|
ie(7, oe),
|
|
782
781
|
ie(8, Bn),
|
|
783
782
|
ie(9, Ui),
|
|
784
|
-
ie(10, N(
|
|
783
|
+
ie(10, N($t)),
|
|
785
784
|
ie(11, N(dn)),
|
|
786
785
|
ie(12, N(tt))
|
|
787
786
|
], et);
|
|
788
|
-
var
|
|
789
|
-
for (var r =
|
|
790
|
-
(o = i[s]) && (r =
|
|
791
|
-
return
|
|
792
|
-
}, De = (i, n) => (
|
|
793
|
-
function on(i, n,
|
|
794
|
-
var
|
|
795
|
-
if (((r = (
|
|
796
|
-
const a =
|
|
787
|
+
var Is = Object.getOwnPropertyDescriptor, Cs = (i, n, t, e) => {
|
|
788
|
+
for (var r = e > 1 ? void 0 : e ? Is(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
789
|
+
(o = i[s]) && (r = o(r) || r);
|
|
790
|
+
return r;
|
|
791
|
+
}, De = (i, n) => (t, e) => n(t, e, i);
|
|
792
|
+
function on(i, n, t) {
|
|
793
|
+
var e, r, s, o;
|
|
794
|
+
if (((r = (e = t == null ? void 0 : t.p) == null ? void 0 : e.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = t.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
|
|
795
|
+
const a = t.p.drawings[t.p.drawingsOrder[0]], c = pr(
|
|
797
796
|
i,
|
|
798
797
|
{
|
|
799
798
|
unitId: n.unitId,
|
|
@@ -806,43 +805,43 @@ function on(i, n, e) {
|
|
|
806
805
|
a.docTransform.angle
|
|
807
806
|
);
|
|
808
807
|
if (c)
|
|
809
|
-
return a.transform.width = c.width, a.transform.height = c.height, a.docTransform.size.width = c.width, a.docTransform.size.height = c.height, a.transform.left = 0, a.transform.top = 0, a.docTransform.positionH.posOffset = 0, a.docTransform.positionV.posOffset = 0,
|
|
808
|
+
return a.transform.width = c.width, a.transform.height = c.height, a.docTransform.size.width = c.width, a.docTransform.size.height = c.height, a.transform.left = 0, a.transform.top = 0, a.docTransform.positionH.posOffset = 0, a.docTransform.positionV.posOffset = 0, t.p.documentStyle.pageSize.width = 1 / 0, t.p.documentStyle.pageSize.height = 1 / 0, !0;
|
|
810
809
|
}
|
|
811
810
|
return !1;
|
|
812
811
|
}
|
|
813
812
|
let Ot = class extends le {
|
|
814
|
-
constructor(i, n,
|
|
815
|
-
super(), this._commandService = i, this._sheetInterceptorService = n, this._univerInstanceService =
|
|
813
|
+
constructor(i, n, t, e, r, s, o) {
|
|
814
|
+
super(), this._commandService = i, this._sheetInterceptorService = n, this._univerInstanceService = t, this._injector = e, this._drawingManagerService = r, this._docDrawingController = s, this._editorBridgeService = o, this._initHandleResize(), this._handleInitEditor(), this._handleWriteCell(), this._initCellContentInterceptor();
|
|
816
815
|
}
|
|
817
816
|
_initHandleResize() {
|
|
818
817
|
this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
|
|
819
|
-
let n,
|
|
820
|
-
if (i.id ===
|
|
821
|
-
const
|
|
822
|
-
|
|
818
|
+
let n, t = [];
|
|
819
|
+
if (i.id === Fn.id) {
|
|
820
|
+
const e = i.params;
|
|
821
|
+
t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
|
|
823
822
|
} else if (i.id === Yn.id) {
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
} else if (i.id ===
|
|
827
|
-
const
|
|
828
|
-
|
|
823
|
+
const e = i.params;
|
|
824
|
+
t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
|
|
825
|
+
} else if (i.id === Li.id) {
|
|
826
|
+
const e = i.params;
|
|
827
|
+
t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
|
|
829
828
|
} else if (i.id === Gn.id) {
|
|
830
|
-
const
|
|
831
|
-
n = H(this._univerInstanceService, { unitId:
|
|
829
|
+
const e = i.params;
|
|
830
|
+
n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId }), t = e.rowsAutoHeightInfo.map((r) => ({
|
|
832
831
|
startRow: r.row,
|
|
833
832
|
endRow: r.row,
|
|
834
833
|
startColumn: 0,
|
|
835
834
|
endColumn: 9999
|
|
836
835
|
}));
|
|
836
|
+
} else if (i.id === Fi.id) {
|
|
837
|
+
const e = i.params;
|
|
838
|
+
t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
|
|
837
839
|
} else if (i.id === Yi.id) {
|
|
838
|
-
const
|
|
839
|
-
|
|
840
|
-
} else if (i.id === Gi.id) {
|
|
841
|
-
const t = i.params;
|
|
842
|
-
e = t.ranges, n = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
|
|
840
|
+
const e = i.params;
|
|
841
|
+
t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
|
|
843
842
|
}
|
|
844
|
-
n &&
|
|
845
|
-
const r =
|
|
843
|
+
n && t.length && t.forEach((e) => {
|
|
844
|
+
const r = xr.transformRange(e, n.worksheet);
|
|
846
845
|
for (let s = r.startRow; s <= r.endRow; s++)
|
|
847
846
|
for (let o = r.startColumn; o <= r.endColumn; o++)
|
|
848
847
|
on(this._injector, { unitId: n.unitId, subUnitId: n.subUnitId, row: s, col: o }, n.worksheet.getCellRaw(s, o));
|
|
@@ -853,46 +852,46 @@ let Ot = class extends le {
|
|
|
853
852
|
this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
|
|
854
853
|
i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(pt), this._docDrawingController.loadDrawingDataForUnit(pt), this._drawingManagerService.initializeNotification(pt)) : this._drawingManagerService.removeDrawingDataForUnit(pt);
|
|
855
854
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
|
|
856
|
-
i.id ===
|
|
855
|
+
i.id === is.id && i.params.unitId === wt && (this._drawingManagerService.removeDrawingDataForUnit(wt), this._docDrawingController.loadDrawingDataForUnit(wt), this._drawingManagerService.initializeNotification(wt));
|
|
857
856
|
}));
|
|
858
857
|
}
|
|
859
858
|
_handleWriteCell() {
|
|
860
|
-
this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
859
|
+
this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(Gi, {
|
|
861
860
|
priority: 9999,
|
|
862
|
-
handler: (i, n,
|
|
861
|
+
handler: (i, n, t) => (on(this._injector, { unitId: n.unitId, subUnitId: n.subUnitId, row: n.row, col: n.col }, i), t(i))
|
|
863
862
|
}));
|
|
864
863
|
}
|
|
865
864
|
_initCellContentInterceptor() {
|
|
866
865
|
this.disposeWithMe(
|
|
867
866
|
this._sheetInterceptorService.intercept(
|
|
868
|
-
|
|
867
|
+
Xi.CELL_CONTENT,
|
|
869
868
|
{
|
|
870
|
-
effect:
|
|
871
|
-
priority:
|
|
872
|
-
handler: (i, n,
|
|
873
|
-
var
|
|
874
|
-
return i != null && i.p && ((
|
|
869
|
+
effect: Lr.Style,
|
|
870
|
+
priority: Vi.CELL_IMAGE,
|
|
871
|
+
handler: (i, n, t) => {
|
|
872
|
+
var e;
|
|
873
|
+
return i != null && i.p && ((e = i.p.drawingsOrder) != null && e.length) && (i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }), t(i);
|
|
875
874
|
}
|
|
876
875
|
}
|
|
877
876
|
)
|
|
878
877
|
);
|
|
879
878
|
}
|
|
880
879
|
};
|
|
881
|
-
Ot =
|
|
880
|
+
Ot = Cs([
|
|
882
881
|
De(0, G),
|
|
883
|
-
De(1, N(
|
|
882
|
+
De(1, N(Lt)),
|
|
884
883
|
De(2, Ge),
|
|
885
884
|
De(3, N(tt)),
|
|
886
885
|
De(4, oe),
|
|
887
|
-
De(5, N(
|
|
888
|
-
De(6, N(
|
|
886
|
+
De(5, N(ri)),
|
|
887
|
+
De(6, N(_i))
|
|
889
888
|
], Ot);
|
|
890
|
-
var
|
|
891
|
-
for (var r =
|
|
892
|
-
(o = i[s]) && (r =
|
|
893
|
-
return
|
|
894
|
-
}, An = (i, n) => (
|
|
895
|
-
let
|
|
889
|
+
var bs = Object.getOwnPropertyDescriptor, Rs = (i, n, t, e) => {
|
|
890
|
+
for (var r = e > 1 ? void 0 : e ? bs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
891
|
+
(o = i[s]) && (r = o(r) || r);
|
|
892
|
+
return r;
|
|
893
|
+
}, An = (i, n) => (t, e) => n(t, e, i);
|
|
894
|
+
let Ut = class extends le {
|
|
896
895
|
constructor(i, n) {
|
|
897
896
|
super(), this._autoFillService = i, this._injector = n, this._initAutoFillHooks();
|
|
898
897
|
}
|
|
@@ -900,8 +899,8 @@ let Pt = class extends le {
|
|
|
900
899
|
this.disposeWithMe(
|
|
901
900
|
this._autoFillService.addHook({
|
|
902
901
|
id: "sheet-cell-image-autofill",
|
|
903
|
-
onBeforeSubmit: (i, n,
|
|
904
|
-
new
|
|
902
|
+
onBeforeSubmit: (i, n, t, e) => {
|
|
903
|
+
new Fr(e).forValue((r, s, o) => {
|
|
905
904
|
on(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
|
|
906
905
|
});
|
|
907
906
|
}
|
|
@@ -909,94 +908,94 @@ let Pt = class extends le {
|
|
|
909
908
|
);
|
|
910
909
|
}
|
|
911
910
|
};
|
|
912
|
-
|
|
913
|
-
An(0, N(
|
|
911
|
+
Ut = Rs([
|
|
912
|
+
An(0, N(vi)),
|
|
914
913
|
An(1, N(tt))
|
|
915
|
-
],
|
|
916
|
-
var
|
|
917
|
-
for (var r =
|
|
918
|
-
(o = i[s]) && (r =
|
|
919
|
-
return
|
|
920
|
-
}, bt = (i, n) => (
|
|
921
|
-
let
|
|
922
|
-
constructor(n,
|
|
914
|
+
], Ut);
|
|
915
|
+
var Ds = Object.getOwnPropertyDescriptor, Ms = (i, n, t, e) => {
|
|
916
|
+
for (var r = e > 1 ? void 0 : e ? Ds(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
917
|
+
(o = i[s]) && (r = o(r) || r);
|
|
918
|
+
return r;
|
|
919
|
+
}, bt = (i, n) => (t, e) => n(t, e, i);
|
|
920
|
+
let Pt = class extends le {
|
|
921
|
+
constructor(n, t, e, r) {
|
|
923
922
|
super();
|
|
924
923
|
Q(this, "_isSetCursor", !1);
|
|
925
|
-
this._hoverManagerService = n, this._renderManagerService =
|
|
924
|
+
this._hoverManagerService = n, this._renderManagerService = t, this._selectionsService = e, this._drawingRenderService = r;
|
|
926
925
|
}
|
|
927
926
|
_initHover() {
|
|
928
927
|
}
|
|
929
928
|
_initImageClick() {
|
|
930
929
|
}
|
|
931
930
|
};
|
|
932
|
-
|
|
933
|
-
bt(0, N(
|
|
931
|
+
Pt = Ms([
|
|
932
|
+
bt(0, N(Si)),
|
|
934
933
|
bt(1, N(ne)),
|
|
935
934
|
bt(2, N(dn)),
|
|
936
|
-
bt(3, N(
|
|
937
|
-
],
|
|
935
|
+
bt(3, N(jn))
|
|
936
|
+
], Pt);
|
|
938
937
|
const Gt = {
|
|
939
938
|
id: "sheet.command.insert-float-image",
|
|
940
939
|
type: te.COMMAND,
|
|
941
940
|
handler: async (i, n) => {
|
|
942
941
|
var s, o;
|
|
943
|
-
const
|
|
944
|
-
if (!
|
|
942
|
+
const e = (s = i.get(ne).getCurrentTypeOfRenderer(F.UNIVER_SHEET)) == null ? void 0 : s.with(et);
|
|
943
|
+
if (!e)
|
|
945
944
|
return !1;
|
|
946
945
|
const r = n == null ? void 0 : n.files;
|
|
947
946
|
if (r) {
|
|
948
|
-
const a = r.map((c) =>
|
|
947
|
+
const a = r.map((c) => e.insertFloatImageByFile(c));
|
|
949
948
|
return (await Promise.all(a)).every((c) => c);
|
|
950
949
|
} else
|
|
951
|
-
return (o =
|
|
950
|
+
return (o = e.insertFloatImage()) != null ? o : !1;
|
|
952
951
|
}
|
|
953
952
|
}, un = {
|
|
954
953
|
id: "sheet.command.insert-cell-image",
|
|
955
954
|
type: te.COMMAND,
|
|
956
955
|
handler: (i) => {
|
|
957
|
-
var
|
|
958
|
-
return (
|
|
956
|
+
var t, e;
|
|
957
|
+
return (e = (t = i.get(ne).getCurrentTypeOfRenderer(F.UNIVER_SHEET)) == null ? void 0 : t.with(et).insertCellImage()) != null ? e : !1;
|
|
959
958
|
}
|
|
960
959
|
};
|
|
961
|
-
var
|
|
962
|
-
for (var r =
|
|
963
|
-
(o = i[s]) && (r =
|
|
964
|
-
return
|
|
965
|
-
}, Je = (i, n) => (
|
|
960
|
+
var ys = Object.getOwnPropertyDescriptor, Ts = (i, n, t, e) => {
|
|
961
|
+
for (var r = e > 1 ? void 0 : e ? ys(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
962
|
+
(o = i[s]) && (r = o(r) || r);
|
|
963
|
+
return r;
|
|
964
|
+
}, Je = (i, n) => (t, e) => n(t, e, i);
|
|
966
965
|
const wr = "image/png";
|
|
967
|
-
function
|
|
968
|
-
const n = i.split(","),
|
|
969
|
-
for (let s = 0; s <
|
|
970
|
-
r[s] =
|
|
966
|
+
function Es(i) {
|
|
967
|
+
const n = i.split(","), t = atob(n[1]), e = t.length, r = new Uint8Array(e);
|
|
968
|
+
for (let s = 0; s < e; s++)
|
|
969
|
+
r[s] = t.charCodeAt(s);
|
|
971
970
|
return new Blob([r], { type: wr });
|
|
972
971
|
}
|
|
973
|
-
function
|
|
974
|
-
const n = new ClipboardItem({ [wr]:
|
|
975
|
-
navigator.clipboard.write([n]).catch((
|
|
976
|
-
console.error("Could not copy image using clipboard API: ",
|
|
972
|
+
function Os(i) {
|
|
973
|
+
const n = new ClipboardItem({ [wr]: Es(i) });
|
|
974
|
+
navigator.clipboard.write([n]).catch((t) => {
|
|
975
|
+
console.error("Could not copy image using clipboard API: ", t);
|
|
977
976
|
});
|
|
978
977
|
}
|
|
979
|
-
function
|
|
978
|
+
function Us() {
|
|
980
979
|
function i() {
|
|
981
|
-
const
|
|
982
|
-
return
|
|
980
|
+
const e = document.createElement("input");
|
|
981
|
+
return e.style.position = "absolute", e.style.height = "1px", e.style.width = "1px", e.style.opacity = "0", e;
|
|
983
982
|
}
|
|
984
|
-
const n = document.activeElement,
|
|
985
|
-
return document.body.appendChild(
|
|
986
|
-
|
|
983
|
+
const n = document.activeElement, t = i();
|
|
984
|
+
return document.body.appendChild(t), t.focus(), () => {
|
|
985
|
+
t.blur(), document.body.removeChild(t), n instanceof HTMLElement && n.focus();
|
|
987
986
|
};
|
|
988
987
|
}
|
|
989
988
|
const Nn = [
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
989
|
+
xe.SPECIAL_PASTE_COL_WIDTH,
|
|
990
|
+
xe.SPECIAL_PASTE_VALUE,
|
|
991
|
+
xe.SPECIAL_PASTE_FORMAT,
|
|
992
|
+
xe.SPECIAL_PASTE_FORMULA
|
|
994
993
|
];
|
|
995
994
|
let At = class extends le {
|
|
996
|
-
constructor(n,
|
|
995
|
+
constructor(n, t, e, r, s) {
|
|
997
996
|
super();
|
|
998
997
|
Q(this, "_copyInfo");
|
|
999
|
-
this._sheetClipboardService = n, this._renderManagerService =
|
|
998
|
+
this._sheetClipboardService = n, this._renderManagerService = t, this._drawingService = e, this._clipboardInterfaceService = r, this._commandService = s, this._initCopyPaste();
|
|
1000
999
|
}
|
|
1001
1000
|
get _focusedDrawings() {
|
|
1002
1001
|
return this._drawingService.getFocusDrawings();
|
|
@@ -1005,7 +1004,7 @@ let At = class extends le {
|
|
|
1005
1004
|
_initCopyPaste() {
|
|
1006
1005
|
this._sheetClipboardService.addClipboardHook({
|
|
1007
1006
|
id: "SHEET_IMAGE_UI_PLUGIN",
|
|
1008
|
-
onBeforeCopy: (n,
|
|
1007
|
+
onBeforeCopy: (n, t, e, r) => {
|
|
1009
1008
|
const s = this._focusedDrawings;
|
|
1010
1009
|
if (s.length > 0) {
|
|
1011
1010
|
const [o] = s;
|
|
@@ -1017,8 +1016,8 @@ let At = class extends le {
|
|
|
1017
1016
|
this._commandService.executeCommand(nt.id, c);
|
|
1018
1017
|
}
|
|
1019
1018
|
setTimeout(() => {
|
|
1020
|
-
const c =
|
|
1021
|
-
o.drawingType ===
|
|
1019
|
+
const c = Us();
|
|
1020
|
+
o.drawingType === L.DRAWING_IMAGE && o.imageSourceType === si.BASE64 ? Os(o.source) : this._clipboardInterfaceService.writeText(""), c();
|
|
1022
1021
|
}, 200);
|
|
1023
1022
|
const a = {
|
|
1024
1023
|
unitId: o.unitId,
|
|
@@ -1027,30 +1026,30 @@ let At = class extends le {
|
|
|
1027
1026
|
};
|
|
1028
1027
|
this._copyInfo = a;
|
|
1029
1028
|
} else {
|
|
1030
|
-
const o = this._createDrawingsCopyInfoByRange(n,
|
|
1029
|
+
const o = this._createDrawingsCopyInfoByRange(n, t, e);
|
|
1031
1030
|
this._copyInfo = o;
|
|
1032
1031
|
}
|
|
1033
1032
|
},
|
|
1034
|
-
onPasteCells: (n,
|
|
1033
|
+
onPasteCells: (n, t, e, r) => {
|
|
1035
1034
|
if (!this._copyInfo)
|
|
1036
1035
|
return { redos: [], undos: [] };
|
|
1037
|
-
const { copyType: s = be.COPY, pasteType: o } = r, { range: a } = n || {}, { range: c, unitId: u, subUnitId: d } =
|
|
1038
|
-
return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: d, pasteRange: c }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo:
|
|
1036
|
+
const { copyType: s = be.COPY, pasteType: o } = r, { range: a } = n || {}, { range: c, unitId: u, subUnitId: d } = t;
|
|
1037
|
+
return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: d, pasteRange: c }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: o }, be.COPY);
|
|
1039
1038
|
},
|
|
1040
|
-
onPastePlainText: (n,
|
|
1041
|
-
onPasteUnrecognized: (n) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: n, pasteType:
|
|
1042
|
-
onPasteFiles: (n,
|
|
1039
|
+
onPastePlainText: (n, t) => ({ undos: [], redos: [] }),
|
|
1040
|
+
onPasteUnrecognized: (n) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: n, pasteType: xe.DEFAULT_PASTE }, be.COPY) : { undos: [], redos: [] },
|
|
1041
|
+
onPasteFiles: (n, t) => {
|
|
1043
1042
|
if (this._copyInfo)
|
|
1044
|
-
return this._generateSingleDrawingPasteMutations({ pasteTo: n, pasteType:
|
|
1043
|
+
return this._generateSingleDrawingPasteMutations({ pasteTo: n, pasteType: xe.DEFAULT_PASTE }, be.COPY);
|
|
1045
1044
|
{
|
|
1046
|
-
const
|
|
1047
|
-
if (
|
|
1045
|
+
const e = t.filter((r) => r.type.includes("image"));
|
|
1046
|
+
if (e.length)
|
|
1048
1047
|
return {
|
|
1049
1048
|
undos: [],
|
|
1050
1049
|
redos: [
|
|
1051
1050
|
{
|
|
1052
1051
|
id: Gt.id,
|
|
1053
|
-
params: { files:
|
|
1052
|
+
params: { files: e }
|
|
1054
1053
|
}
|
|
1055
1054
|
]
|
|
1056
1055
|
};
|
|
@@ -1059,17 +1058,17 @@ let At = class extends le {
|
|
|
1059
1058
|
}
|
|
1060
1059
|
});
|
|
1061
1060
|
}
|
|
1062
|
-
_createDrawingsCopyInfoByRange(n,
|
|
1061
|
+
_createDrawingsCopyInfoByRange(n, t, e) {
|
|
1063
1062
|
var g;
|
|
1064
1063
|
const r = (g = this._renderManagerService.getRenderById(n)) == null ? void 0 : g.with(V);
|
|
1065
1064
|
if (!r) return;
|
|
1066
|
-
const s = r.attachRangeWithCoord(
|
|
1065
|
+
const s = r.attachRangeWithCoord(e);
|
|
1067
1066
|
if (!s)
|
|
1068
1067
|
return;
|
|
1069
|
-
const { startX: o, endX: a, startY: c, endY: u } = s, d = this._drawingService.getDrawingData(n,
|
|
1068
|
+
const { startX: o, endX: a, startY: c, endY: u } = s, d = this._drawingService.getDrawingData(n, t), l = this._focusedDrawings.slice();
|
|
1070
1069
|
if (Object.keys(d).forEach((h) => {
|
|
1071
1070
|
const f = d[h], { transform: p } = f;
|
|
1072
|
-
if (f.anchorType !==
|
|
1071
|
+
if (f.anchorType !== U.Both || !p)
|
|
1073
1072
|
return;
|
|
1074
1073
|
const { left: m = 0, top: w = 0, width: S = 0, height: C = 0 } = p, { drawingStartX: D, drawingEndX: v, drawingStartY: b, drawingEndY: _ } = {
|
|
1075
1074
|
drawingStartX: m,
|
|
@@ -1080,15 +1079,15 @@ let At = class extends le {
|
|
|
1080
1079
|
o <= D && v <= a && c <= b && _ <= u && l.push(f);
|
|
1081
1080
|
}), l.length)
|
|
1082
1081
|
return {
|
|
1083
|
-
copyRange:
|
|
1082
|
+
copyRange: e,
|
|
1084
1083
|
drawings: l,
|
|
1085
1084
|
unitId: n,
|
|
1086
|
-
subUnitId:
|
|
1085
|
+
subUnitId: t
|
|
1087
1086
|
};
|
|
1088
1087
|
}
|
|
1089
|
-
_generateSingleDrawingPasteMutations(n,
|
|
1090
|
-
const { pasteType:
|
|
1091
|
-
if (Nn.includes(
|
|
1088
|
+
_generateSingleDrawingPasteMutations(n, t) {
|
|
1089
|
+
const { pasteType: e, pasteTo: r } = n;
|
|
1090
|
+
if (Nn.includes(e))
|
|
1092
1091
|
return { redos: [], undos: [] };
|
|
1093
1092
|
const { unitId: s, subUnitId: o, range: a } = r, c = this._renderManagerService.getRenderById(s), u = c == null ? void 0 : c.with(V), d = c == null ? void 0 : c.with(Xe), l = this._copyInfo;
|
|
1094
1093
|
if (!u || !d)
|
|
@@ -1097,7 +1096,7 @@ let At = class extends le {
|
|
|
1097
1096
|
return this._generateMutations(g, {
|
|
1098
1097
|
unitId: s,
|
|
1099
1098
|
subUnitId: o,
|
|
1100
|
-
isCut:
|
|
1099
|
+
isCut: t === be.CUT,
|
|
1101
1100
|
getTransform: (f, p) => {
|
|
1102
1101
|
var S;
|
|
1103
1102
|
const m = u.attachRangeWithCoord({
|
|
@@ -1112,25 +1111,25 @@ let At = class extends le {
|
|
|
1112
1111
|
};
|
|
1113
1112
|
return {
|
|
1114
1113
|
transform: w,
|
|
1115
|
-
sheetTransform: (S =
|
|
1114
|
+
sheetTransform: (S = $(w, d)) != null ? S : p
|
|
1116
1115
|
};
|
|
1117
1116
|
}
|
|
1118
1117
|
});
|
|
1119
1118
|
}
|
|
1120
|
-
_generateMutations(n,
|
|
1119
|
+
_generateMutations(n, t) {
|
|
1121
1120
|
const {
|
|
1122
|
-
unitId:
|
|
1121
|
+
unitId: e,
|
|
1123
1122
|
subUnitId: r,
|
|
1124
1123
|
getTransform: s,
|
|
1125
1124
|
isCut: o
|
|
1126
|
-
} =
|
|
1125
|
+
} = t, a = [], c = [], { _drawingService: u } = this;
|
|
1127
1126
|
return n.forEach((d) => {
|
|
1128
1127
|
const { transform: l, sheetTransform: g } = d;
|
|
1129
1128
|
if (!l)
|
|
1130
1129
|
return;
|
|
1131
1130
|
const h = s(l, g), f = {
|
|
1132
1131
|
...d,
|
|
1133
|
-
unitId:
|
|
1132
|
+
unitId: e,
|
|
1134
1133
|
subUnitId: r,
|
|
1135
1134
|
drawingId: o ? d.drawingId : ye.generateRandomId(),
|
|
1136
1135
|
transform: h.transform,
|
|
@@ -1139,54 +1138,54 @@ let At = class extends le {
|
|
|
1139
1138
|
if (o) {
|
|
1140
1139
|
const { undo: p, redo: m, objects: w } = u.getBatchUpdateOp([f]);
|
|
1141
1140
|
a.push({
|
|
1142
|
-
id:
|
|
1141
|
+
id: A.id,
|
|
1143
1142
|
params: {
|
|
1144
|
-
unitId:
|
|
1143
|
+
unitId: e,
|
|
1145
1144
|
subUnitId: r,
|
|
1146
|
-
type:
|
|
1145
|
+
type: P.UPDATE,
|
|
1147
1146
|
op: m,
|
|
1148
1147
|
objects: w
|
|
1149
1148
|
}
|
|
1150
1149
|
}), c.push({
|
|
1151
|
-
id:
|
|
1150
|
+
id: A.id,
|
|
1152
1151
|
params: {
|
|
1153
|
-
unitId:
|
|
1152
|
+
unitId: e,
|
|
1154
1153
|
subUnitId: r,
|
|
1155
|
-
type:
|
|
1154
|
+
type: P.UPDATE,
|
|
1156
1155
|
op: p,
|
|
1157
1156
|
objects: w
|
|
1158
1157
|
}
|
|
1159
1158
|
});
|
|
1160
1159
|
} else {
|
|
1161
1160
|
const { undo: p, redo: m, objects: w } = u.getBatchAddOp([f]);
|
|
1162
|
-
a.push({ id:
|
|
1161
|
+
a.push({ id: A.id, params: { op: m, unitId: e, subUnitId: r, objects: w, type: P.INSERT } }), c.push({ id: A.id, params: { op: p, unitId: e, subUnitId: r, objects: w, type: P.REMOVE } });
|
|
1163
1162
|
}
|
|
1164
1163
|
}), { redos: a, undos: c };
|
|
1165
1164
|
}
|
|
1166
1165
|
// eslint-disable-next-line max-lines-per-function
|
|
1167
|
-
_generateRangeDrawingsPasteMutations(n,
|
|
1166
|
+
_generateRangeDrawingsPasteMutations(n, t) {
|
|
1168
1167
|
var E;
|
|
1169
1168
|
const {
|
|
1170
|
-
unitId:
|
|
1169
|
+
unitId: e,
|
|
1171
1170
|
subUnitId: r,
|
|
1172
1171
|
pasteType: s,
|
|
1173
1172
|
pasteRange: o
|
|
1174
1173
|
} = n, {
|
|
1175
1174
|
copyRange: a,
|
|
1176
1175
|
copyType: c
|
|
1177
|
-
} =
|
|
1176
|
+
} = t;
|
|
1178
1177
|
if (Nn.includes(s))
|
|
1179
1178
|
return { redos: [], undos: [] };
|
|
1180
|
-
const u = (E = this._renderManagerService.getRenderById(
|
|
1179
|
+
const u = (E = this._renderManagerService.getRenderById(e)) == null ? void 0 : E.with(V);
|
|
1181
1180
|
if (!u || !this._copyInfo)
|
|
1182
1181
|
return { redos: [], undos: [] };
|
|
1183
1182
|
const { drawings: d } = this._copyInfo;
|
|
1184
1183
|
if (!a)
|
|
1185
1184
|
return this._generateSingleDrawingPasteMutations({
|
|
1186
|
-
pasteTo: { unitId:
|
|
1185
|
+
pasteTo: { unitId: e, subUnitId: r, range: Rn(o) },
|
|
1187
1186
|
pasteType: s
|
|
1188
1187
|
}, c);
|
|
1189
|
-
const { ranges: [l, g], mapFunc: h } =
|
|
1188
|
+
const { ranges: [l, g], mapFunc: h } = Ii([a, o]), { row: f, col: p } = h(l.startRow, l.startColumn), { row: m, col: w } = h(g.startRow, g.startColumn), S = u.attachRangeWithCoord({
|
|
1190
1189
|
startRow: f,
|
|
1191
1190
|
endRow: f,
|
|
1192
1191
|
startColumn: p,
|
|
@@ -1201,7 +1200,7 @@ let At = class extends le {
|
|
|
1201
1200
|
return { redos: [], undos: [] };
|
|
1202
1201
|
const D = C.startX - S.startX, v = C.startY - S.startY, b = m - f, _ = w - p;
|
|
1203
1202
|
return this._generateMutations(d, {
|
|
1204
|
-
unitId:
|
|
1203
|
+
unitId: e,
|
|
1205
1204
|
subUnitId: r,
|
|
1206
1205
|
getTransform: (M, y) => {
|
|
1207
1206
|
var T, I;
|
|
@@ -1230,37 +1229,37 @@ let At = class extends le {
|
|
|
1230
1229
|
});
|
|
1231
1230
|
}
|
|
1232
1231
|
};
|
|
1233
|
-
At =
|
|
1234
|
-
Je(0,
|
|
1232
|
+
At = Ts([
|
|
1233
|
+
Je(0, Ci),
|
|
1235
1234
|
Je(1, ne),
|
|
1236
1235
|
Je(2, oe),
|
|
1237
|
-
Je(3,
|
|
1236
|
+
Je(3, Pi),
|
|
1238
1237
|
Je(4, G)
|
|
1239
1238
|
], At);
|
|
1240
|
-
var
|
|
1241
|
-
for (var r =
|
|
1242
|
-
(o = i[s]) && (r =
|
|
1243
|
-
return
|
|
1244
|
-
}, qe = (i, n) => (
|
|
1239
|
+
var Ps = Object.getOwnPropertyDescriptor, As = (i, n, t, e) => {
|
|
1240
|
+
for (var r = e > 1 ? void 0 : e ? Ps(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
1241
|
+
(o = i[s]) && (r = o(r) || r);
|
|
1242
|
+
return r;
|
|
1243
|
+
}, qe = (i, n) => (t, e) => n(t, e, i);
|
|
1245
1244
|
let Nt = class extends le {
|
|
1246
|
-
constructor(i, n,
|
|
1247
|
-
super(), this._drawingManagerService = i, this._renderManagerService = n, this._permissionService =
|
|
1245
|
+
constructor(i, n, t, e, r) {
|
|
1246
|
+
super(), this._drawingManagerService = i, this._renderManagerService = n, this._permissionService = t, this._univerInstanceService = e, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
1248
1247
|
}
|
|
1249
1248
|
_initDrawingVisible() {
|
|
1250
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1249
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$, t = St([i, n]);
|
|
1251
1250
|
this.disposeWithMe(
|
|
1252
|
-
|
|
1253
|
-
Se(([
|
|
1251
|
+
t.pipe(
|
|
1252
|
+
Se(([e, r]) => e ? e.activeSheet$.pipe(
|
|
1254
1253
|
yn((s) => {
|
|
1255
1254
|
if (!s) {
|
|
1256
1255
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
1257
1256
|
return;
|
|
1258
1257
|
}
|
|
1259
|
-
const o =
|
|
1258
|
+
const o = e.getUnitId(), a = s.getSheetId();
|
|
1260
1259
|
this._permissionService.composePermission([
|
|
1261
1260
|
new On(o).id,
|
|
1262
|
-
new
|
|
1263
|
-
]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(
|
|
1261
|
+
new Un(o, a).id
|
|
1262
|
+
]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(e, s);
|
|
1264
1263
|
})
|
|
1265
1264
|
) : (this._drawingManagerService.setDrawingVisible(!1), pe))
|
|
1266
1265
|
).subscribe()
|
|
@@ -1268,7 +1267,7 @@ let Nt = class extends le {
|
|
|
1268
1267
|
}
|
|
1269
1268
|
_handleDrawingVisibilityFalse(i, n) {
|
|
1270
1269
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
1271
|
-
const
|
|
1270
|
+
const t = i.getUnitId(), e = n.getSheetId(), r = this._drawingManagerService.getDrawingData(t, e), s = Object.values(r), o = this._renderManagerService.getRenderById(t), a = o == null ? void 0 : o.scene;
|
|
1272
1271
|
if (!a)
|
|
1273
1272
|
return;
|
|
1274
1273
|
a.getAllObjectsByOrder().forEach((u) => {
|
|
@@ -1276,20 +1275,20 @@ let Nt = class extends le {
|
|
|
1276
1275
|
});
|
|
1277
1276
|
}
|
|
1278
1277
|
_initDrawingEditable() {
|
|
1279
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1278
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$, t = St([i, n]);
|
|
1280
1279
|
this.disposeWithMe(
|
|
1281
|
-
|
|
1282
|
-
Se(([
|
|
1280
|
+
t.pipe(
|
|
1281
|
+
Se(([e, r]) => e ? e.activeSheet$.pipe(
|
|
1283
1282
|
yn((s) => {
|
|
1284
1283
|
if (!s) {
|
|
1285
1284
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
1286
1285
|
return;
|
|
1287
1286
|
}
|
|
1288
|
-
const o =
|
|
1287
|
+
const o = e.getUnitId(), a = s.getSheetId();
|
|
1289
1288
|
this._permissionService.composePermission([
|
|
1290
1289
|
new Qt(o).id,
|
|
1291
1290
|
new en(o, a).id
|
|
1292
|
-
]).every((u) => u.value) ? this._drawingManagerService.setDrawingEditable(!0) : this._handleDrawingEditableFalse(
|
|
1291
|
+
]).every((u) => u.value) ? this._drawingManagerService.setDrawingEditable(!0) : this._handleDrawingEditableFalse(e, s);
|
|
1293
1292
|
})
|
|
1294
1293
|
) : (this._drawingManagerService.setDrawingEditable(!1), pe))
|
|
1295
1294
|
).subscribe()
|
|
@@ -1297,7 +1296,7 @@ let Nt = class extends le {
|
|
|
1297
1296
|
}
|
|
1298
1297
|
_handleDrawingEditableFalse(i, n) {
|
|
1299
1298
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
1300
|
-
const
|
|
1299
|
+
const t = i.getUnitId(), e = n.getSheetId(), r = this._drawingManagerService.getDrawingData(t, e), s = Object.values(r), o = this._renderManagerService.getRenderById(t), a = o == null ? void 0 : o.scene;
|
|
1301
1300
|
if (!a)
|
|
1302
1301
|
return;
|
|
1303
1302
|
a.getAllObjectsByOrder().forEach((u) => {
|
|
@@ -1305,20 +1304,20 @@ let Nt = class extends le {
|
|
|
1305
1304
|
});
|
|
1306
1305
|
}
|
|
1307
1306
|
_initViewPermissionChange() {
|
|
1308
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1307
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$;
|
|
1309
1308
|
this.disposeWithMe(
|
|
1310
1309
|
St([i, n]).pipe(
|
|
1311
|
-
Se(([
|
|
1310
|
+
Se(([t, e]) => t ? t.activeSheet$.pipe(
|
|
1312
1311
|
Se((r) => {
|
|
1313
1312
|
if (!r)
|
|
1314
1313
|
return pe;
|
|
1315
|
-
const s =
|
|
1314
|
+
const s = t.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), c = a == null ? void 0 : a.scene;
|
|
1316
1315
|
if (!c)
|
|
1317
1316
|
return pe;
|
|
1318
1317
|
const u = c.getTransformerByCreate();
|
|
1319
1318
|
return this._permissionService.composePermission$([
|
|
1320
1319
|
new On(s).id,
|
|
1321
|
-
new
|
|
1320
|
+
new Un(s, o).id
|
|
1322
1321
|
]).pipe(
|
|
1323
1322
|
Ee((l) => l.every((g) => g.value)),
|
|
1324
1323
|
Tn()
|
|
@@ -1334,16 +1333,16 @@ let Nt = class extends le {
|
|
|
1334
1333
|
})
|
|
1335
1334
|
) : pe)
|
|
1336
1335
|
).subscribe({
|
|
1337
|
-
next: ({ permission:
|
|
1338
|
-
this._drawingManagerService.setDrawingVisible(
|
|
1339
|
-
const a =
|
|
1340
|
-
|
|
1341
|
-
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) &&
|
|
1336
|
+
next: ({ permission: t, scene: e, transformer: r, unitId: s, subUnitId: o }) => {
|
|
1337
|
+
this._drawingManagerService.setDrawingVisible(t);
|
|
1338
|
+
const a = e.getAllObjectsByOrder(), c = this._drawingManagerService.getDrawingData(s, o), u = Object.values(c);
|
|
1339
|
+
t ? this._drawingManagerService.addNotification(u) : (a.forEach((d) => {
|
|
1340
|
+
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) && e.removeObject(d);
|
|
1342
1341
|
}), r.clearSelectedObjects());
|
|
1343
1342
|
},
|
|
1344
1343
|
complete: () => {
|
|
1345
1344
|
this._drawingManagerService.setDrawingVisible(!0);
|
|
1346
|
-
const
|
|
1345
|
+
const t = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET), e = t == null ? void 0 : t.getActiveSheet(), r = t == null ? void 0 : t.getUnitId(), s = e == null ? void 0 : e.getSheetId();
|
|
1347
1346
|
if (!r || !s)
|
|
1348
1347
|
return;
|
|
1349
1348
|
const o = this._drawingManagerService.getDrawingData(r, s), a = Object.values(o);
|
|
@@ -1353,14 +1352,14 @@ let Nt = class extends le {
|
|
|
1353
1352
|
);
|
|
1354
1353
|
}
|
|
1355
1354
|
_initEditPermissionChange() {
|
|
1356
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1355
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$;
|
|
1357
1356
|
this.disposeWithMe(
|
|
1358
1357
|
St([i, n]).pipe(
|
|
1359
|
-
Se(([
|
|
1358
|
+
Se(([t, e]) => t ? t.activeSheet$.pipe(
|
|
1360
1359
|
Se((r) => {
|
|
1361
1360
|
if (!r)
|
|
1362
1361
|
return pe;
|
|
1363
|
-
const s =
|
|
1362
|
+
const s = t.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), c = a == null ? void 0 : a.scene;
|
|
1364
1363
|
if (!c)
|
|
1365
1364
|
return pe;
|
|
1366
1365
|
const u = c.getTransformerByCreate();
|
|
@@ -1382,26 +1381,26 @@ let Nt = class extends le {
|
|
|
1382
1381
|
})
|
|
1383
1382
|
) : pe)
|
|
1384
1383
|
).subscribe({
|
|
1385
|
-
next: ({ permission:
|
|
1386
|
-
this._drawingManagerService.setDrawingEditable(
|
|
1387
|
-
const a =
|
|
1388
|
-
|
|
1389
|
-
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) &&
|
|
1384
|
+
next: ({ permission: t, scene: e, transformer: r, unitId: s, subUnitId: o }) => {
|
|
1385
|
+
this._drawingManagerService.setDrawingEditable(t);
|
|
1386
|
+
const a = e.getAllObjectsByOrder(), c = this._drawingManagerService.getDrawingData(s, o), u = Object.values(c);
|
|
1387
|
+
t ? (a.forEach((d) => {
|
|
1388
|
+
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) && e.attachTransformerTo(d);
|
|
1390
1389
|
}), this._drawingManagerService.addNotification(u)) : (a.forEach((d) => {
|
|
1391
|
-
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) &&
|
|
1390
|
+
d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) && e.detachTransformerFrom(d);
|
|
1392
1391
|
}), r.clearSelectedObjects());
|
|
1393
1392
|
},
|
|
1394
1393
|
complete: () => {
|
|
1395
|
-
const
|
|
1396
|
-
if (!
|
|
1394
|
+
const t = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET);
|
|
1395
|
+
if (!t)
|
|
1397
1396
|
return;
|
|
1398
|
-
const
|
|
1397
|
+
const e = t.getUnitId(), r = t.getActiveSheet();
|
|
1399
1398
|
if (!r)
|
|
1400
1399
|
return;
|
|
1401
|
-
const s = r.getSheetId(), o = this._renderManagerService.getRenderById(
|
|
1400
|
+
const s = r.getSheetId(), o = this._renderManagerService.getRenderById(e), a = o == null ? void 0 : o.scene;
|
|
1402
1401
|
if (!a)
|
|
1403
1402
|
return;
|
|
1404
|
-
const c = this._drawingManagerService.getDrawingData(
|
|
1403
|
+
const c = this._drawingManagerService.getDrawingData(e, s), u = Object.values(c);
|
|
1405
1404
|
this._drawingManagerService.setDrawingEditable(!0), a.getAllObjectsByOrder().forEach((l) => {
|
|
1406
1405
|
l.classType === We.IMAGE && u.some((g) => l.oKey.includes(g.drawingId)) && a.detachTransformerFrom(l);
|
|
1407
1406
|
});
|
|
@@ -1410,32 +1409,32 @@ let Nt = class extends le {
|
|
|
1410
1409
|
);
|
|
1411
1410
|
}
|
|
1412
1411
|
};
|
|
1413
|
-
Nt =
|
|
1412
|
+
Nt = As([
|
|
1414
1413
|
qe(0, oe),
|
|
1415
1414
|
qe(1, ne),
|
|
1416
|
-
qe(2,
|
|
1415
|
+
qe(2, Yr),
|
|
1417
1416
|
qe(3, Ge),
|
|
1418
1417
|
qe(4, N(Gr))
|
|
1419
1418
|
], Nt);
|
|
1420
|
-
var
|
|
1421
|
-
for (var r =
|
|
1422
|
-
(o = i[s]) && (r =
|
|
1423
|
-
return
|
|
1424
|
-
}, Rt = (i, n) => (
|
|
1425
|
-
let
|
|
1426
|
-
constructor(i, n,
|
|
1427
|
-
super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = n, this._drawingManagerService =
|
|
1419
|
+
var Ns = Object.getOwnPropertyDescriptor, ks = (i, n, t, e) => {
|
|
1420
|
+
for (var r = e > 1 ? void 0 : e ? Ns(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
1421
|
+
(o = i[s]) && (r = o(r) || r);
|
|
1422
|
+
return r;
|
|
1423
|
+
}, Rt = (i, n) => (t, e) => n(t, e, i);
|
|
1424
|
+
let kt = class extends le {
|
|
1425
|
+
constructor(i, n, t, e) {
|
|
1426
|
+
super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = n, this._drawingManagerService = t, this._renderManagerService = e, this._initPrinting();
|
|
1428
1427
|
}
|
|
1429
1428
|
_initPrinting() {
|
|
1430
1429
|
this.disposeWithMe(
|
|
1431
1430
|
this._sheetPrintInterceptorService.interceptor.intercept(
|
|
1432
1431
|
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
|
|
1433
1432
|
{
|
|
1434
|
-
handler: (i, n,
|
|
1435
|
-
const { unitId:
|
|
1433
|
+
handler: (i, n, t) => {
|
|
1434
|
+
const { unitId: e, scene: r, subUnitId: s } = n, o = this._drawingManagerService.getDrawingDataForUnit(e), a = o == null ? void 0 : o[s];
|
|
1436
1435
|
return a && a.order.forEach((c) => {
|
|
1437
1436
|
this._drawingRenderService.renderDrawing(a.data[c], r);
|
|
1438
|
-
}),
|
|
1437
|
+
}), t();
|
|
1439
1438
|
}
|
|
1440
1439
|
}
|
|
1441
1440
|
)
|
|
@@ -1443,41 +1442,41 @@ let jt = class extends le {
|
|
|
1443
1442
|
this._sheetPrintInterceptorService.interceptor.intercept(
|
|
1444
1443
|
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,
|
|
1445
1444
|
{
|
|
1446
|
-
handler: (i, n,
|
|
1447
|
-
const { unitId:
|
|
1445
|
+
handler: (i, n, t) => {
|
|
1446
|
+
const { unitId: e, subUnitId: r } = n, s = this._renderManagerService.getRenderById(e);
|
|
1448
1447
|
if (!s)
|
|
1449
|
-
return
|
|
1448
|
+
return t(i);
|
|
1450
1449
|
const o = s.with(V).getSkeletonParam(r);
|
|
1451
1450
|
if (!o)
|
|
1452
|
-
return
|
|
1453
|
-
const a = this._drawingManagerService.getDrawingDataForUnit(
|
|
1451
|
+
return t(i);
|
|
1452
|
+
const a = this._drawingManagerService.getDrawingDataForUnit(e), c = a == null ? void 0 : a[n.subUnitId];
|
|
1454
1453
|
if (!c)
|
|
1455
|
-
return
|
|
1456
|
-
const { scaleX: u, scaleY: d } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, g = c.order.map((h) => c.data[h]).filter((h) => h.drawingType !==
|
|
1454
|
+
return t(i);
|
|
1455
|
+
const { scaleX: u, scaleY: d } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, g = c.order.map((h) => c.data[h]).filter((h) => h.drawingType !== L.DRAWING_DOM);
|
|
1457
1456
|
return g.length ? (g.forEach((h) => {
|
|
1458
1457
|
if (!h.groupId && h.transform && ye.isDefine(h.transform.left) && ye.isDefine(h.transform.top) && ye.isDefine(h.transform.width) && ye.isDefine(h.transform.height)) {
|
|
1459
1458
|
const f = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, d, { x: 0, y: 0 }), p = o.skeleton.getCellIndexByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, u, d, { x: 0, y: 0 });
|
|
1460
1459
|
f.column < l.startColumn && (l.startColumn = f.column), f.row < l.startRow && (l.startRow = f.row), l.endRow < p.row && (l.endRow = p.row), l.endColumn < p.column && (l.endColumn = p.column);
|
|
1461
1460
|
}
|
|
1462
|
-
}),
|
|
1461
|
+
}), t(l)) : t(i);
|
|
1463
1462
|
}
|
|
1464
1463
|
}
|
|
1465
1464
|
)
|
|
1466
1465
|
);
|
|
1467
1466
|
}
|
|
1468
1467
|
};
|
|
1469
|
-
|
|
1470
|
-
Rt(0, N(
|
|
1471
|
-
Rt(1, N(
|
|
1468
|
+
kt = ks([
|
|
1469
|
+
Rt(0, N(bi)),
|
|
1470
|
+
Rt(1, N(jn)),
|
|
1472
1471
|
Rt(2, oe),
|
|
1473
1472
|
Rt(3, ne)
|
|
1474
|
-
],
|
|
1475
|
-
var
|
|
1476
|
-
for (var r =
|
|
1477
|
-
(o = i[s]) && (r =
|
|
1478
|
-
return
|
|
1479
|
-
}, _e = (i, n) => (
|
|
1480
|
-
const
|
|
1473
|
+
], kt);
|
|
1474
|
+
var Bs = Object.getOwnPropertyDescriptor, Ws = (i, n, t, e) => {
|
|
1475
|
+
for (var r = e > 1 ? void 0 : e ? Bs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
1476
|
+
(o = i[s]) && (r = o(r) || r);
|
|
1477
|
+
return r;
|
|
1478
|
+
}, _e = (i, n) => (t, e) => n(t, e, i);
|
|
1479
|
+
const js = [
|
|
1481
1480
|
Xn.id,
|
|
1482
1481
|
Vn.id,
|
|
1483
1482
|
Hn.id,
|
|
@@ -1497,23 +1496,23 @@ const Zs = [
|
|
|
1497
1496
|
sr.id,
|
|
1498
1497
|
or.id,
|
|
1499
1498
|
ar.id
|
|
1500
|
-
],
|
|
1499
|
+
], $s = [
|
|
1500
|
+
Hi.id,
|
|
1501
1501
|
zi.id,
|
|
1502
1502
|
Ki.id,
|
|
1503
1503
|
Zi.id,
|
|
1504
|
-
|
|
1505
|
-
kn.id,
|
|
1504
|
+
Fn.id,
|
|
1506
1505
|
Yn.id
|
|
1507
1506
|
];
|
|
1508
1507
|
let an = class extends le {
|
|
1509
|
-
constructor(i, n,
|
|
1510
|
-
super(), this._context = i, this._renderManagerService = n, this._commandService =
|
|
1508
|
+
constructor(i, n, t, e, r, s, o, a, c) {
|
|
1509
|
+
super(), this._context = i, this._renderManagerService = n, this._commandService = t, this._selectionRenderService = e, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = a, this._univerInstanceService = c, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
|
|
1511
1510
|
}
|
|
1512
1511
|
_sheetInterceptorListener() {
|
|
1513
1512
|
this.disposeWithMe(
|
|
1514
1513
|
this._sheetInterceptorService.interceptCommand({
|
|
1515
1514
|
getMutations: (i) => {
|
|
1516
|
-
if (!
|
|
1515
|
+
if (!js.includes(i.id))
|
|
1517
1516
|
return { redos: [], undos: [] };
|
|
1518
1517
|
if (i.params == null)
|
|
1519
1518
|
return { redos: [], undos: [] };
|
|
@@ -1529,42 +1528,42 @@ let an = class extends le {
|
|
|
1529
1528
|
if (n === zn.id)
|
|
1530
1529
|
return this._moveColInterceptor(i.params, "remove");
|
|
1531
1530
|
if (n === Kn.id) {
|
|
1532
|
-
const { range:
|
|
1531
|
+
const { range: t } = i.params;
|
|
1533
1532
|
return this._getRangeMoveUndo(
|
|
1534
|
-
|
|
1533
|
+
t,
|
|
1535
1534
|
0
|
|
1536
1535
|
/* deleteLeft */
|
|
1537
1536
|
);
|
|
1538
1537
|
} else if (n === Zn.id) {
|
|
1539
|
-
const { range:
|
|
1538
|
+
const { range: t } = i.params;
|
|
1540
1539
|
return this._getRangeMoveUndo(
|
|
1541
|
-
|
|
1540
|
+
t,
|
|
1542
1541
|
1
|
|
1543
1542
|
/* deleteUp */
|
|
1544
1543
|
);
|
|
1545
1544
|
} else if (n === Jn.id) {
|
|
1546
|
-
const { range:
|
|
1545
|
+
const { range: t } = i.params;
|
|
1547
1546
|
return this._getRangeMoveUndo(
|
|
1548
|
-
|
|
1547
|
+
t,
|
|
1549
1548
|
2
|
|
1550
1549
|
/* insertDown */
|
|
1551
1550
|
);
|
|
1552
1551
|
} else if (n === qn.id) {
|
|
1553
|
-
const { range:
|
|
1552
|
+
const { range: t } = i.params;
|
|
1554
1553
|
return this._getRangeMoveUndo(
|
|
1555
|
-
|
|
1554
|
+
t,
|
|
1556
1555
|
3
|
|
1557
1556
|
/* insertRight */
|
|
1558
1557
|
);
|
|
1559
1558
|
} else if (n === tr.id || n === nr.id) {
|
|
1560
|
-
const
|
|
1561
|
-
return this._getDrawingUndoForRowVisible(
|
|
1559
|
+
const t = i.params, { unitId: e, subUnitId: r, ranges: s } = t;
|
|
1560
|
+
return this._getDrawingUndoForRowVisible(e, r, s);
|
|
1562
1561
|
} else if (n === rr.id || n === ir.id) {
|
|
1563
|
-
const
|
|
1564
|
-
return this._getDrawingUndoForColVisible(
|
|
1562
|
+
const t = i.params, { unitId: e, subUnitId: r, ranges: s } = t;
|
|
1563
|
+
return this._getDrawingUndoForColVisible(e, r, s);
|
|
1565
1564
|
} else if (n === tn.id || n === nn.id || n === Qn.id || n === er.id) {
|
|
1566
|
-
const
|
|
1567
|
-
return this._getDrawingUndoForRowAndColSize(
|
|
1565
|
+
const t = i.params, { unitId: e, subUnitId: r, ranges: s } = t, o = n === tn.id || n === nn.id;
|
|
1566
|
+
return this._getDrawingUndoForRowAndColSize(e, r, s, o);
|
|
1568
1567
|
}
|
|
1569
1568
|
return { redos: [], undos: [] };
|
|
1570
1569
|
}
|
|
@@ -1572,10 +1571,10 @@ let an = class extends le {
|
|
|
1572
1571
|
);
|
|
1573
1572
|
}
|
|
1574
1573
|
_getRangeMoveUndo(i, n) {
|
|
1575
|
-
const
|
|
1576
|
-
if (
|
|
1574
|
+
const t = H(this._univerInstanceService);
|
|
1575
|
+
if (t == null)
|
|
1577
1576
|
return { redos: [], undos: [] };
|
|
1578
|
-
const
|
|
1577
|
+
const e = t.unitId, r = t.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(e, r), c = [], u = [];
|
|
1579
1578
|
if (Object.keys(a).forEach((d) => {
|
|
1580
1579
|
const l = a[d], { updateDrawings: g, deleteDrawings: h } = this._getUpdateOrDeleteDrawings(i, n, l);
|
|
1581
1580
|
c.push(...g), u.push(...h);
|
|
@@ -1583,22 +1582,22 @@ let an = class extends le {
|
|
|
1583
1582
|
return { redos: [], undos: [] };
|
|
1584
1583
|
if (c.length > 0) {
|
|
1585
1584
|
const d = this._sheetDrawingService.getBatchUpdateOp(c), { undo: l, redo: g, objects: h } = d;
|
|
1586
|
-
s.push({ id:
|
|
1585
|
+
s.push({ id: A.id, params: { unitId: e, subUnitId: r, op: g, objects: h, type: P.UPDATE } }), o.push({ id: A.id, params: { unitId: e, subUnitId: r, op: l, objects: h, type: P.UPDATE } });
|
|
1587
1586
|
}
|
|
1588
1587
|
if (u.length > 0) {
|
|
1589
1588
|
const d = this._sheetDrawingService.getBatchRemoveOp(u), l = d.undo, g = d.redo, h = d.objects;
|
|
1590
|
-
s.push({ id:
|
|
1589
|
+
s.push({ id: A.id, params: { unitId: e, subUnitId: r, op: g, objects: h, type: P.REMOVE } }), o.push({ id: A.id, params: { unitId: e, subUnitId: r, op: l, objects: h, type: P.INSERT } });
|
|
1591
1590
|
}
|
|
1592
|
-
return s.push({ id:
|
|
1591
|
+
return s.push({ id: x.id, params: [e] }), o.push({ id: x.id, params: [e] }), {
|
|
1593
1592
|
redos: s,
|
|
1594
1593
|
undos: o
|
|
1595
1594
|
};
|
|
1596
1595
|
}
|
|
1597
|
-
_getUpdateOrDeleteDrawings(i, n,
|
|
1598
|
-
const
|
|
1596
|
+
_getUpdateOrDeleteDrawings(i, n, t) {
|
|
1597
|
+
const e = [], r = [], { sheetTransform: s, anchorType: o = U.Position, transform: a, unitId: c, subUnitId: u, drawingId: d } = t, { from: l, to: g } = s, { row: h, column: f } = l, { row: p, column: m } = g;
|
|
1599
1598
|
if (s == null || a == null)
|
|
1600
1599
|
return {
|
|
1601
|
-
updateDrawings:
|
|
1600
|
+
updateDrawings: e,
|
|
1602
1601
|
deleteDrawings: r
|
|
1603
1602
|
};
|
|
1604
1603
|
const { startRow: w, endRow: S, startColumn: C, endColumn: D } = i;
|
|
@@ -1626,31 +1625,31 @@ let an = class extends le {
|
|
|
1626
1625
|
}
|
|
1627
1626
|
if (v != null && b != null) {
|
|
1628
1627
|
const _ = z(v, this._selectionRenderService, this._skeletonManagerService);
|
|
1629
|
-
|
|
1628
|
+
e.push({ ...t, sheetTransform: v, transform: _ });
|
|
1630
1629
|
}
|
|
1631
|
-
return { updateDrawings:
|
|
1630
|
+
return { updateDrawings: e, deleteDrawings: r };
|
|
1632
1631
|
}
|
|
1633
|
-
_remainDrawingSize(i, n,
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
...
|
|
1637
|
-
sheetTransform:
|
|
1632
|
+
_remainDrawingSize(i, n, t) {
|
|
1633
|
+
const e = $({ ...i }, this._selectionRenderService);
|
|
1634
|
+
e != null && n.push({
|
|
1635
|
+
...t,
|
|
1636
|
+
sheetTransform: e
|
|
1638
1637
|
});
|
|
1639
1638
|
}
|
|
1640
1639
|
// eslint-disable-next-line max-lines-per-function
|
|
1641
|
-
_getDrawingUndoForColVisible(i, n,
|
|
1642
|
-
const
|
|
1643
|
-
if (Object.keys(
|
|
1644
|
-
const l =
|
|
1645
|
-
if (f ===
|
|
1640
|
+
_getDrawingUndoForColVisible(i, n, t) {
|
|
1641
|
+
const e = this._drawingManagerService.getDrawingData(i, n), r = [], s = [];
|
|
1642
|
+
if (Object.keys(e).forEach((d) => {
|
|
1643
|
+
const l = e[d], { sheetTransform: g, transform: h, anchorType: f = U.Position } = l;
|
|
1644
|
+
if (f === U.None)
|
|
1646
1645
|
this._remainDrawingSize(h, r, l);
|
|
1647
1646
|
else {
|
|
1648
1647
|
const { from: p, to: m } = g, { row: w, column: S } = p, { row: C, column: D } = m;
|
|
1649
|
-
for (let v = 0; v <
|
|
1650
|
-
const b =
|
|
1648
|
+
for (let v = 0; v < t.length; v++) {
|
|
1649
|
+
const b = t[v], { startRow: _, endRow: E, startColumn: M, endColumn: y } = b;
|
|
1651
1650
|
if (D < M)
|
|
1652
1651
|
continue;
|
|
1653
|
-
if (f ===
|
|
1652
|
+
if (f === U.Position) {
|
|
1654
1653
|
let R = null, O = null;
|
|
1655
1654
|
if (S >= M && S <= y) {
|
|
1656
1655
|
const B = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: y, startRow: p.row, endRow: m.row });
|
|
@@ -1658,7 +1657,7 @@ let an = class extends le {
|
|
|
1658
1657
|
return;
|
|
1659
1658
|
O = { ...h, left: B.startX };
|
|
1660
1659
|
}
|
|
1661
|
-
if (O != null && (R =
|
|
1660
|
+
if (O != null && (R = $(O, this._selectionRenderService), R != null && O != null)) {
|
|
1662
1661
|
r.push({ ...l, sheetTransform: R, transform: O });
|
|
1663
1662
|
break;
|
|
1664
1663
|
}
|
|
@@ -1692,12 +1691,12 @@ let an = class extends le {
|
|
|
1692
1691
|
if (I = {
|
|
1693
1692
|
...h,
|
|
1694
1693
|
width: ((h == null ? void 0 : h.width) || 0) - R.endX + R.startX
|
|
1695
|
-
}, T =
|
|
1694
|
+
}, T = $(I, this._selectionRenderService), T != null && I != null) {
|
|
1696
1695
|
s.push({ ...l, sheetTransform: T, transform: I });
|
|
1697
1696
|
break;
|
|
1698
1697
|
}
|
|
1699
1698
|
}
|
|
1700
|
-
if (I != null && (T =
|
|
1699
|
+
if (I != null && (T = $(I, this._selectionRenderService)), I != null && T != null) {
|
|
1701
1700
|
r.push({ ...l, sheetTransform: T, transform: I });
|
|
1702
1701
|
break;
|
|
1703
1702
|
} else
|
|
@@ -1718,13 +1717,13 @@ let an = class extends le {
|
|
|
1718
1717
|
preUndos: u
|
|
1719
1718
|
};
|
|
1720
1719
|
}
|
|
1721
|
-
_createUndoAndRedoMutation(i, n,
|
|
1722
|
-
const
|
|
1723
|
-
{ id:
|
|
1724
|
-
{ id:
|
|
1720
|
+
_createUndoAndRedoMutation(i, n, t) {
|
|
1721
|
+
const e = this._sheetDrawingService.getBatchUpdateOp(t), { undo: r, redo: s, objects: o } = e, a = [
|
|
1722
|
+
{ id: A.id, params: { unitId: i, subUnitId: n, op: s, objects: o, type: P.UPDATE } },
|
|
1723
|
+
{ id: x.id, params: [i] }
|
|
1725
1724
|
], c = [
|
|
1726
|
-
{ id:
|
|
1727
|
-
{ id:
|
|
1725
|
+
{ id: A.id, params: { unitId: i, subUnitId: n, op: r, objects: o, type: P.UPDATE } },
|
|
1726
|
+
{ id: x.id, params: [i] }
|
|
1728
1727
|
];
|
|
1729
1728
|
return {
|
|
1730
1729
|
redos: a,
|
|
@@ -1732,19 +1731,19 @@ let an = class extends le {
|
|
|
1732
1731
|
};
|
|
1733
1732
|
}
|
|
1734
1733
|
// eslint-disable-next-line max-lines-per-function
|
|
1735
|
-
_getDrawingUndoForRowVisible(i, n,
|
|
1736
|
-
const
|
|
1737
|
-
if (Object.keys(
|
|
1738
|
-
const l =
|
|
1739
|
-
if (f ===
|
|
1734
|
+
_getDrawingUndoForRowVisible(i, n, t) {
|
|
1735
|
+
const e = this._drawingManagerService.getDrawingData(i, n), r = [], s = [];
|
|
1736
|
+
if (Object.keys(e).forEach((d) => {
|
|
1737
|
+
const l = e[d], { sheetTransform: g, transform: h, anchorType: f = U.Position } = l;
|
|
1738
|
+
if (f === U.None)
|
|
1740
1739
|
this._remainDrawingSize(h, r, l);
|
|
1741
1740
|
else {
|
|
1742
1741
|
const { from: p, to: m } = g, { row: w, column: S } = p, { row: C, column: D } = m;
|
|
1743
|
-
for (let v = 0; v <
|
|
1744
|
-
const b =
|
|
1742
|
+
for (let v = 0; v < t.length; v++) {
|
|
1743
|
+
const b = t[v], { startRow: _, endRow: E, startColumn: M, endColumn: y } = b;
|
|
1745
1744
|
if (C < _)
|
|
1746
1745
|
continue;
|
|
1747
|
-
if (f ===
|
|
1746
|
+
if (f === U.Position) {
|
|
1748
1747
|
let R = null, O = null;
|
|
1749
1748
|
if (w >= _ && w <= E) {
|
|
1750
1749
|
const B = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: w, endRow: E });
|
|
@@ -1752,7 +1751,7 @@ let an = class extends le {
|
|
|
1752
1751
|
return;
|
|
1753
1752
|
O = { ...h, top: B.startY };
|
|
1754
1753
|
}
|
|
1755
|
-
if (O != null && (R =
|
|
1754
|
+
if (O != null && (R = $(O, this._selectionRenderService), R != null && O != null)) {
|
|
1756
1755
|
r.push({ ...l, sheetTransform: R, transform: O });
|
|
1757
1756
|
break;
|
|
1758
1757
|
}
|
|
@@ -1786,12 +1785,12 @@ let an = class extends le {
|
|
|
1786
1785
|
if (I = {
|
|
1787
1786
|
...h,
|
|
1788
1787
|
height: ((h == null ? void 0 : h.height) || 0) - R.endY + R.startY
|
|
1789
|
-
}, T =
|
|
1788
|
+
}, T = $(I, this._selectionRenderService), T != null && I != null) {
|
|
1790
1789
|
s.push({ ...l, sheetTransform: T, transform: I });
|
|
1791
1790
|
break;
|
|
1792
1791
|
}
|
|
1793
1792
|
}
|
|
1794
|
-
if (I != null && (T =
|
|
1793
|
+
if (I != null && (T = $(I, this._selectionRenderService)), I != null && T != null) {
|
|
1795
1794
|
r.push({ ...l, sheetTransform: T, transform: I });
|
|
1796
1795
|
break;
|
|
1797
1796
|
} else
|
|
@@ -1812,19 +1811,19 @@ let an = class extends le {
|
|
|
1812
1811
|
preUndos: u
|
|
1813
1812
|
};
|
|
1814
1813
|
}
|
|
1815
|
-
_getDrawingUndoForRowAndColSize(i, n,
|
|
1814
|
+
_getDrawingUndoForRowAndColSize(i, n, t, e) {
|
|
1816
1815
|
const r = this._drawingManagerService.getDrawingData(i, n), s = [];
|
|
1817
1816
|
return Object.keys(r).forEach((o) => {
|
|
1818
|
-
const a = r[o], { sheetTransform: c, transform: u, anchorType: d =
|
|
1819
|
-
if (d ===
|
|
1817
|
+
const a = r[o], { sheetTransform: c, transform: u, anchorType: d = U.Position } = a;
|
|
1818
|
+
if (d === U.None)
|
|
1820
1819
|
this._remainDrawingSize(u, s, a);
|
|
1821
1820
|
else {
|
|
1822
1821
|
const { from: l, to: g } = c, { row: h, column: f } = l, { row: p, column: m } = g;
|
|
1823
|
-
for (let w = 0; w <
|
|
1824
|
-
const S =
|
|
1822
|
+
for (let w = 0; w < t.length; w++) {
|
|
1823
|
+
const S = t[w], { startRow: C, endRow: D, startColumn: v, endColumn: b } = S;
|
|
1825
1824
|
if (p < C || m < v)
|
|
1826
1825
|
continue;
|
|
1827
|
-
if (d ===
|
|
1826
|
+
if (d === U.Position && (h <= C && p >= D || f <= v && m >= b)) {
|
|
1828
1827
|
this._remainDrawingSize(u, s, a);
|
|
1829
1828
|
continue;
|
|
1830
1829
|
}
|
|
@@ -1845,32 +1844,32 @@ let an = class extends le {
|
|
|
1845
1844
|
}), s.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(i, n, s);
|
|
1846
1845
|
}
|
|
1847
1846
|
_getUnitIdAndSubUnitId(i, n) {
|
|
1848
|
-
let
|
|
1847
|
+
let t, e;
|
|
1849
1848
|
if (n === "insert")
|
|
1850
|
-
|
|
1849
|
+
t = i.unitId, e = i.subUnitId;
|
|
1851
1850
|
else {
|
|
1852
1851
|
const r = H(this._univerInstanceService);
|
|
1853
1852
|
if (r == null)
|
|
1854
1853
|
return;
|
|
1855
|
-
|
|
1854
|
+
t = r.unitId, e = r.subUnitId;
|
|
1856
1855
|
}
|
|
1857
|
-
return { unitId:
|
|
1856
|
+
return { unitId: t, subUnitId: e };
|
|
1858
1857
|
}
|
|
1859
1858
|
_moveRangeInterceptor(i) {
|
|
1860
1859
|
var C, D;
|
|
1861
|
-
const { toRange: n, fromRange:
|
|
1862
|
-
if (!
|
|
1860
|
+
const { toRange: n, fromRange: t } = i, e = H(this._univerInstanceService);
|
|
1861
|
+
if (!e)
|
|
1863
1862
|
return { redos: [], undos: [] };
|
|
1864
|
-
const { unitId: r, subUnitId: s } =
|
|
1863
|
+
const { unitId: r, subUnitId: s } = e, o = (D = (C = this._renderManagerService.getRenderById(r)) == null ? void 0 : C.with(V)) == null ? void 0 : D.getCurrentSkeleton();
|
|
1865
1864
|
if (!o)
|
|
1866
1865
|
return { redos: [], undos: [] };
|
|
1867
|
-
const a =
|
|
1866
|
+
const a = xn(o, t);
|
|
1868
1867
|
if (!a)
|
|
1869
1868
|
return { redos: [], undos: [] };
|
|
1870
1869
|
const { startX: c, endX: u, startY: d, endY: l } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
|
|
1871
1870
|
Object.keys(g).forEach((v) => {
|
|
1872
1871
|
const b = g[v];
|
|
1873
|
-
if (b.anchorType !==
|
|
1872
|
+
if (b.anchorType !== U.Both)
|
|
1874
1873
|
return;
|
|
1875
1874
|
const { transform: _ } = b;
|
|
1876
1875
|
if (!_)
|
|
@@ -1883,7 +1882,7 @@ let an = class extends le {
|
|
|
1883
1882
|
};
|
|
1884
1883
|
c <= I && R <= u && d <= O && B <= l && h.push(b);
|
|
1885
1884
|
});
|
|
1886
|
-
const f = [], p = [], m = n.startRow -
|
|
1885
|
+
const f = [], p = [], m = n.startRow - t.startRow, w = n.startColumn - t.startColumn, S = h.map((v) => {
|
|
1887
1886
|
const b = v.sheetTransform, _ = {
|
|
1888
1887
|
to: { ...b.to, row: b.to.row + m, column: b.to.column + w },
|
|
1889
1888
|
from: { ...b.from, row: b.from.row + m, column: b.from.column + w }
|
|
@@ -1898,17 +1897,17 @@ let an = class extends le {
|
|
|
1898
1897
|
});
|
|
1899
1898
|
if (S.length) {
|
|
1900
1899
|
const v = this._sheetDrawingService.getBatchUpdateOp(S), { undo: b, redo: _, objects: E } = v;
|
|
1901
|
-
f.push({ id:
|
|
1900
|
+
f.push({ id: A.id, params: { unitId: r, subUnitId: s, op: _, objects: E, type: P.UPDATE } }), p.push({ id: A.id, params: { unitId: r, subUnitId: s, op: b, objects: E, type: P.UPDATE } });
|
|
1902
1901
|
}
|
|
1903
1902
|
return { redos: f, undos: p };
|
|
1904
1903
|
}
|
|
1905
1904
|
_moveRowInterceptor(i, n) {
|
|
1906
|
-
const
|
|
1907
|
-
if (
|
|
1905
|
+
const t = this._getUnitIdAndSubUnitId(i, n);
|
|
1906
|
+
if (t == null)
|
|
1908
1907
|
return { redos: [], undos: [] };
|
|
1909
|
-
const { unitId:
|
|
1908
|
+
const { unitId: e, subUnitId: r } = t, { range: s } = i, o = s.startRow, a = s.endRow, c = [], u = [], d = this._sheetDrawingService.getDrawingData(e, r), l = [], g = [];
|
|
1910
1909
|
if (Object.keys(d).forEach((h) => {
|
|
1911
|
-
const f = d[h], { sheetTransform: p, transform: m, anchorType: w =
|
|
1910
|
+
const f = d[h], { sheetTransform: p, transform: m, anchorType: w = U.Position } = f;
|
|
1912
1911
|
if (p == null || m == null)
|
|
1913
1912
|
return;
|
|
1914
1913
|
let S, C;
|
|
@@ -1917,8 +1916,8 @@ let an = class extends le {
|
|
|
1917
1916
|
S = v == null ? void 0 : v.newSheetTransform, C = v == null ? void 0 : v.newTransform;
|
|
1918
1917
|
} else {
|
|
1919
1918
|
const { from: v, to: b } = p, { row: _ } = v, { row: E } = b;
|
|
1920
|
-
if (w ===
|
|
1921
|
-
g.push({ unitId:
|
|
1919
|
+
if (w === U.Both && _ >= o && E <= a)
|
|
1920
|
+
g.push({ unitId: e, subUnitId: r, drawingId: h });
|
|
1922
1921
|
else {
|
|
1923
1922
|
const M = this._shrinkRow(p, m, o, a, w);
|
|
1924
1923
|
S = M == null ? void 0 : M.newSheetTransform, C = M == null ? void 0 : M.newTransform;
|
|
@@ -1926,30 +1925,30 @@ let an = class extends le {
|
|
|
1926
1925
|
}
|
|
1927
1926
|
if (!S || !C)
|
|
1928
1927
|
return;
|
|
1929
|
-
const D = { unitId:
|
|
1928
|
+
const D = { unitId: e, subUnitId: r, drawingId: h, transform: C, sheetTransform: S };
|
|
1930
1929
|
l.push(D);
|
|
1931
1930
|
}), l.length === 0 && g.length === 0)
|
|
1932
1931
|
return { redos: [], undos: [] };
|
|
1933
1932
|
if (l.length > 0) {
|
|
1934
1933
|
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: p, objects: m } = h;
|
|
1935
|
-
c.push({ id:
|
|
1934
|
+
c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.UPDATE } });
|
|
1936
1935
|
}
|
|
1937
1936
|
if (g.length > 0) {
|
|
1938
1937
|
const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, p = h.redo, m = h.objects;
|
|
1939
|
-
c.push({ id:
|
|
1938
|
+
c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.INSERT } });
|
|
1940
1939
|
}
|
|
1941
|
-
return c.push({ id:
|
|
1940
|
+
return c.push({ id: x.id, params: [e] }), u.push({ id: x.id, params: [e] }), {
|
|
1942
1941
|
redos: c,
|
|
1943
1942
|
undos: u
|
|
1944
1943
|
};
|
|
1945
1944
|
}
|
|
1946
1945
|
_moveColInterceptor(i, n) {
|
|
1947
|
-
const
|
|
1948
|
-
if (
|
|
1946
|
+
const t = this._getUnitIdAndSubUnitId(i, n);
|
|
1947
|
+
if (t == null)
|
|
1949
1948
|
return { redos: [], undos: [] };
|
|
1950
|
-
const { unitId:
|
|
1949
|
+
const { unitId: e, subUnitId: r } = t, { range: s } = i, o = s.startColumn, a = s.endColumn, c = [], u = [], d = this._sheetDrawingService.getDrawingData(e, r), l = [], g = [];
|
|
1951
1950
|
if (Object.keys(d).forEach((h) => {
|
|
1952
|
-
const f = d[h], { sheetTransform: p, transform: m, anchorType: w =
|
|
1951
|
+
const f = d[h], { sheetTransform: p, transform: m, anchorType: w = U.Position } = f;
|
|
1953
1952
|
if (p == null || m == null)
|
|
1954
1953
|
return;
|
|
1955
1954
|
let S, C;
|
|
@@ -1958,8 +1957,8 @@ let an = class extends le {
|
|
|
1958
1957
|
S = v == null ? void 0 : v.newSheetTransform, C = v == null ? void 0 : v.newTransform;
|
|
1959
1958
|
} else {
|
|
1960
1959
|
const { from: v, to: b } = p, { column: _ } = v, { column: E } = b;
|
|
1961
|
-
if (w ===
|
|
1962
|
-
g.push({ unitId:
|
|
1960
|
+
if (w === U.Both && _ >= o && E <= a)
|
|
1961
|
+
g.push({ unitId: e, subUnitId: r, drawingId: h });
|
|
1963
1962
|
else {
|
|
1964
1963
|
const M = this._shrinkCol(p, m, o, a, w);
|
|
1965
1964
|
S = M == null ? void 0 : M.newSheetTransform, C = M == null ? void 0 : M.newTransform;
|
|
@@ -1967,42 +1966,42 @@ let an = class extends le {
|
|
|
1967
1966
|
}
|
|
1968
1967
|
if (!S || !C)
|
|
1969
1968
|
return;
|
|
1970
|
-
const D = { unitId:
|
|
1969
|
+
const D = { unitId: e, subUnitId: r, drawingId: h, transform: C, sheetTransform: S };
|
|
1971
1970
|
l.push(D);
|
|
1972
1971
|
}), l.length === 0 && g.length === 0)
|
|
1973
1972
|
return { redos: [], undos: [] };
|
|
1974
1973
|
if (l.length > 0) {
|
|
1975
1974
|
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: p, objects: m } = h;
|
|
1976
|
-
c.push({ id:
|
|
1975
|
+
c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.UPDATE } });
|
|
1977
1976
|
}
|
|
1978
1977
|
if (g.length > 0) {
|
|
1979
1978
|
const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, p = h.redo, m = h.objects;
|
|
1980
|
-
c.push({ id:
|
|
1979
|
+
c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.INSERT } });
|
|
1981
1980
|
}
|
|
1982
|
-
return c.push({ id:
|
|
1981
|
+
return c.push({ id: x.id, params: [e] }), u.push({ id: x.id, params: [e] }), { redos: c, undos: u };
|
|
1983
1982
|
}
|
|
1984
|
-
_expandCol(i, n,
|
|
1985
|
-
const s =
|
|
1986
|
-
if (r ===
|
|
1983
|
+
_expandCol(i, n, t, e, r = U.Position) {
|
|
1984
|
+
const s = e - t + 1, { from: o, to: a } = i, { column: c } = o, { column: u } = a;
|
|
1985
|
+
if (r === U.None)
|
|
1987
1986
|
return {
|
|
1988
|
-
newSheetTransform:
|
|
1987
|
+
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
1989
1988
|
newTransform: n
|
|
1990
1989
|
};
|
|
1991
1990
|
let d = null, l = null;
|
|
1992
|
-
if (c >=
|
|
1993
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn:
|
|
1991
|
+
if (c >= t) {
|
|
1992
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: t, endColumn: e, startRow: o.row, endRow: a.row });
|
|
1994
1993
|
if (g == null)
|
|
1995
1994
|
return;
|
|
1996
|
-
l = { ...n, left: (n.left || 0) + g.endX - g.startX }, d =
|
|
1997
|
-
} else if (u >=
|
|
1998
|
-
if (r ===
|
|
1995
|
+
l = { ...n, left: (n.left || 0) + g.endX - g.startX }, d = $(l, this._selectionRenderService);
|
|
1996
|
+
} else if (u >= e)
|
|
1997
|
+
if (r === U.Both)
|
|
1999
1998
|
d = {
|
|
2000
1999
|
from: { ...o },
|
|
2001
2000
|
to: { ...a, column: u + s }
|
|
2002
2001
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2003
2002
|
else
|
|
2004
2003
|
return {
|
|
2005
|
-
newSheetTransform:
|
|
2004
|
+
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2006
2005
|
newTransform: n
|
|
2007
2006
|
};
|
|
2008
2007
|
return d != null && l != null ? {
|
|
@@ -2010,47 +2009,47 @@ let an = class extends le {
|
|
|
2010
2009
|
newTransform: l
|
|
2011
2010
|
} : null;
|
|
2012
2011
|
}
|
|
2013
|
-
_shrinkCol(i, n,
|
|
2014
|
-
const s =
|
|
2015
|
-
if (r ===
|
|
2012
|
+
_shrinkCol(i, n, t, e, r = U.Position) {
|
|
2013
|
+
const s = e - t + 1, { from: o, to: a } = i, { column: c } = o, { column: u } = a;
|
|
2014
|
+
if (r === U.None)
|
|
2016
2015
|
return {
|
|
2017
|
-
newSheetTransform:
|
|
2016
|
+
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2018
2017
|
newTransform: n
|
|
2019
2018
|
};
|
|
2020
2019
|
let d = null, l = null;
|
|
2021
|
-
if (c >
|
|
2020
|
+
if (c > e)
|
|
2022
2021
|
d = {
|
|
2023
2022
|
from: { ...o, column: c - s },
|
|
2024
2023
|
to: { ...a, column: u - s }
|
|
2025
2024
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2026
2025
|
else {
|
|
2027
|
-
if (c >=
|
|
2026
|
+
if (c >= t && u <= e)
|
|
2028
2027
|
return null;
|
|
2029
|
-
if (c <
|
|
2030
|
-
if (r ===
|
|
2028
|
+
if (c < t && u > e)
|
|
2029
|
+
if (r === U.Both)
|
|
2031
2030
|
d = {
|
|
2032
2031
|
from: { ...o },
|
|
2033
2032
|
to: { ...a, column: u - s }
|
|
2034
2033
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2035
2034
|
else
|
|
2036
2035
|
return {
|
|
2037
|
-
newSheetTransform:
|
|
2036
|
+
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2038
2037
|
newTransform: n
|
|
2039
2038
|
};
|
|
2040
|
-
else if (c >=
|
|
2041
|
-
if (c ===
|
|
2039
|
+
else if (c >= t && c <= e) {
|
|
2040
|
+
if (c === t)
|
|
2042
2041
|
l = { ...n, left: (n.left || 0) - i.from.columnOffset };
|
|
2043
2042
|
else {
|
|
2044
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn:
|
|
2043
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: t, endColumn: c - 1, startRow: o.row, endRow: a.row });
|
|
2045
2044
|
if (g == null)
|
|
2046
2045
|
return;
|
|
2047
2046
|
l = { ...n, left: (n.left || 0) - g.endX + g.startX - i.from.columnOffset };
|
|
2048
2047
|
}
|
|
2049
|
-
d =
|
|
2050
|
-
} else if (u >=
|
|
2048
|
+
d = $(l, this._selectionRenderService);
|
|
2049
|
+
} else if (u >= t && u <= e && r === U.Both) {
|
|
2051
2050
|
const g = this._skeletonManagerService.attachRangeWithCoord({
|
|
2052
|
-
startColumn:
|
|
2053
|
-
endColumn:
|
|
2051
|
+
startColumn: t - 1,
|
|
2052
|
+
endColumn: t - 1,
|
|
2054
2053
|
startRow: o.row,
|
|
2055
2054
|
endRow: a.row
|
|
2056
2055
|
});
|
|
@@ -2058,7 +2057,7 @@ let an = class extends le {
|
|
|
2058
2057
|
return;
|
|
2059
2058
|
d = {
|
|
2060
2059
|
from: { ...o },
|
|
2061
|
-
to: { ...a, column:
|
|
2060
|
+
to: { ...a, column: t - 1, columnOffset: g.endX - g.startX }
|
|
2062
2061
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2063
2062
|
}
|
|
2064
2063
|
}
|
|
@@ -2067,21 +2066,21 @@ let an = class extends le {
|
|
|
2067
2066
|
newTransform: l
|
|
2068
2067
|
} : null;
|
|
2069
2068
|
}
|
|
2070
|
-
_expandRow(i, n,
|
|
2071
|
-
const s =
|
|
2072
|
-
if (r ===
|
|
2069
|
+
_expandRow(i, n, t, e, r = U.Position) {
|
|
2070
|
+
const s = e - t + 1, { from: o, to: a } = i, { row: c } = o, { row: u } = a;
|
|
2071
|
+
if (r === U.None)
|
|
2073
2072
|
return {
|
|
2074
|
-
newSheetTransform:
|
|
2073
|
+
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2075
2074
|
newTransform: n
|
|
2076
2075
|
};
|
|
2077
2076
|
let d = null, l = null;
|
|
2078
|
-
if (c >=
|
|
2079
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow:
|
|
2077
|
+
if (c >= t) {
|
|
2078
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: t, endRow: e, startColumn: o.column, endColumn: a.column });
|
|
2080
2079
|
if (g == null)
|
|
2081
2080
|
return;
|
|
2082
|
-
l = { ...n, top: (n.top || 0) + g.endY - g.startY }, d =
|
|
2083
|
-
} else if (u >=
|
|
2084
|
-
if (r ===
|
|
2081
|
+
l = { ...n, top: (n.top || 0) + g.endY - g.startY }, d = $(l, this._selectionRenderService);
|
|
2082
|
+
} else if (u >= e)
|
|
2083
|
+
if (r === U.Both)
|
|
2085
2084
|
d = {
|
|
2086
2085
|
from: { ...o },
|
|
2087
2086
|
to: {
|
|
@@ -2091,7 +2090,7 @@ let an = class extends le {
|
|
|
2091
2090
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2092
2091
|
else
|
|
2093
2092
|
return {
|
|
2094
|
-
newSheetTransform:
|
|
2093
|
+
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2095
2094
|
newTransform: n
|
|
2096
2095
|
};
|
|
2097
2096
|
return d != null && l != null ? {
|
|
@@ -2099,50 +2098,50 @@ let an = class extends le {
|
|
|
2099
2098
|
newTransform: l
|
|
2100
2099
|
} : null;
|
|
2101
2100
|
}
|
|
2102
|
-
_shrinkRow(i, n,
|
|
2103
|
-
const s =
|
|
2104
|
-
if (r ===
|
|
2101
|
+
_shrinkRow(i, n, t, e, r = U.Position) {
|
|
2102
|
+
const s = e - t + 1, { from: o, to: a } = i, { row: c } = o, { row: u } = a;
|
|
2103
|
+
if (r === U.None)
|
|
2105
2104
|
return {
|
|
2106
|
-
newSheetTransform:
|
|
2105
|
+
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2107
2106
|
newTransform: n
|
|
2108
2107
|
};
|
|
2109
2108
|
let d = null, l = null;
|
|
2110
|
-
if (c >
|
|
2109
|
+
if (c > e)
|
|
2111
2110
|
d = {
|
|
2112
2111
|
from: { ...o, row: c - s },
|
|
2113
2112
|
to: { ...a, row: u - s }
|
|
2114
2113
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2115
2114
|
else {
|
|
2116
|
-
if (c >=
|
|
2115
|
+
if (c >= t && u <= e)
|
|
2117
2116
|
return null;
|
|
2118
|
-
if (c <
|
|
2119
|
-
if (r ===
|
|
2117
|
+
if (c < t && u > e)
|
|
2118
|
+
if (r === U.Both)
|
|
2120
2119
|
d = {
|
|
2121
2120
|
from: { ...o },
|
|
2122
2121
|
to: { ...a, row: u - s }
|
|
2123
2122
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2124
2123
|
else
|
|
2125
2124
|
return {
|
|
2126
|
-
newSheetTransform:
|
|
2125
|
+
newSheetTransform: $({ ...n }, this._selectionRenderService),
|
|
2127
2126
|
newTransform: n
|
|
2128
2127
|
};
|
|
2129
|
-
else if (c >=
|
|
2130
|
-
if (c ===
|
|
2128
|
+
else if (c >= t && c <= e) {
|
|
2129
|
+
if (c === t)
|
|
2131
2130
|
l = { ...n, top: (n.top || 0) - i.from.rowOffset };
|
|
2132
2131
|
else {
|
|
2133
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow:
|
|
2132
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: t, endRow: c - 1, startColumn: o.column, endColumn: a.column });
|
|
2134
2133
|
if (g == null)
|
|
2135
2134
|
return;
|
|
2136
2135
|
l = { ...n, top: (n.top || 0) - g.endY + g.startY - i.from.rowOffset };
|
|
2137
2136
|
}
|
|
2138
|
-
d =
|
|
2139
|
-
} else if (u >=
|
|
2140
|
-
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow:
|
|
2137
|
+
d = $(l, this._selectionRenderService);
|
|
2138
|
+
} else if (u >= t && u <= e && r === U.Both) {
|
|
2139
|
+
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: t - 1, endRow: t - 1 });
|
|
2141
2140
|
if (g == null)
|
|
2142
2141
|
return;
|
|
2143
2142
|
d = {
|
|
2144
2143
|
from: { ...o },
|
|
2145
|
-
to: { ...a, row:
|
|
2144
|
+
to: { ...a, row: t - 1, rowOffset: g.endY - g.startY }
|
|
2146
2145
|
}, l = z(d, this._selectionRenderService, this._skeletonManagerService);
|
|
2147
2146
|
}
|
|
2148
2147
|
}
|
|
@@ -2157,74 +2156,74 @@ let an = class extends le {
|
|
|
2157
2156
|
// but the skeleton changes like other render modules. These two signals are not equivalent.
|
|
2158
2157
|
// As a temp solution, I subscribed to activate$ here.
|
|
2159
2158
|
this._commandService.onCommandExecuted((i) => {
|
|
2160
|
-
if (i.id ===
|
|
2161
|
-
const { unitId: n, subUnitId:
|
|
2162
|
-
this._updateDrawings(n,
|
|
2159
|
+
if (i.id === Ji.id) {
|
|
2160
|
+
const { unitId: n, subUnitId: t } = i.params;
|
|
2161
|
+
this._updateDrawings(n, t);
|
|
2163
2162
|
}
|
|
2164
2163
|
})
|
|
2165
2164
|
), this.disposeWithMe(
|
|
2166
2165
|
this._context.activated$.subscribe((i) => {
|
|
2167
|
-
const { unit: n, unitId:
|
|
2166
|
+
const { unit: n, unitId: t } = this._context;
|
|
2168
2167
|
if (i) {
|
|
2169
|
-
const
|
|
2170
|
-
this._updateDrawings(
|
|
2168
|
+
const e = n.getActiveSheet().getSheetId();
|
|
2169
|
+
this._updateDrawings(t, e);
|
|
2171
2170
|
} else
|
|
2172
|
-
this._clearDrawings(
|
|
2171
|
+
this._clearDrawings(t);
|
|
2173
2172
|
})
|
|
2174
2173
|
);
|
|
2175
2174
|
}
|
|
2176
2175
|
_clearDrawings(i) {
|
|
2177
2176
|
setTimeout(() => {
|
|
2178
|
-
const n = this._drawingManagerService.drawingManagerData,
|
|
2179
|
-
Object.keys(n).forEach((
|
|
2180
|
-
const r = n[
|
|
2177
|
+
const n = this._drawingManagerService.drawingManagerData, t = [];
|
|
2178
|
+
Object.keys(n).forEach((e) => {
|
|
2179
|
+
const r = n[e];
|
|
2181
2180
|
r != null && Object.keys(r).forEach((s) => {
|
|
2182
2181
|
const o = r[s].data;
|
|
2183
2182
|
o != null && Object.keys(o).forEach((a) => {
|
|
2184
|
-
|
|
2183
|
+
e === i && t.push(o[a]);
|
|
2185
2184
|
});
|
|
2186
2185
|
});
|
|
2187
|
-
}), this._drawingManagerService.removeNotification(
|
|
2186
|
+
}), this._drawingManagerService.removeNotification(t);
|
|
2188
2187
|
});
|
|
2189
2188
|
}
|
|
2190
2189
|
_updateDrawings(i, n) {
|
|
2191
2190
|
setTimeout(() => {
|
|
2192
|
-
const
|
|
2193
|
-
Object.keys(
|
|
2194
|
-
const o =
|
|
2191
|
+
const t = this._drawingManagerService.drawingManagerData, e = [], r = [];
|
|
2192
|
+
Object.keys(t).forEach((s) => {
|
|
2193
|
+
const o = t[s];
|
|
2195
2194
|
o != null && Object.keys(o).forEach((a) => {
|
|
2196
2195
|
const c = o[a].data;
|
|
2197
2196
|
c != null && Object.keys(c).forEach((u) => {
|
|
2198
2197
|
if (s === i && a === n) {
|
|
2199
2198
|
const d = c[u];
|
|
2200
|
-
d.transform = z(d.sheetTransform, this._selectionRenderService, this._skeletonManagerService),
|
|
2199
|
+
d.transform = z(d.sheetTransform, this._selectionRenderService, this._skeletonManagerService), e.push(c[u]);
|
|
2201
2200
|
} else
|
|
2202
2201
|
r.push(c[u]);
|
|
2203
2202
|
});
|
|
2204
2203
|
});
|
|
2205
|
-
}), this._drawingManagerService.removeNotification(r), this._drawingManagerService.addNotification(
|
|
2204
|
+
}), this._drawingManagerService.removeNotification(r), this._drawingManagerService.addNotification(e);
|
|
2206
2205
|
}, 0);
|
|
2207
2206
|
}
|
|
2208
2207
|
_sheetRefreshListener() {
|
|
2209
2208
|
this.disposeWithMe(
|
|
2210
2209
|
this._commandService.onCommandExecuted((i) => {
|
|
2211
|
-
|
|
2212
|
-
const n = i.params, { unitId:
|
|
2213
|
-
this._refreshDrawingTransform(
|
|
2210
|
+
$s.includes(i.id) && requestIdleCallback(() => {
|
|
2211
|
+
const n = i.params, { unitId: t, subUnitId: e, ranges: r } = n;
|
|
2212
|
+
this._refreshDrawingTransform(t, e, r);
|
|
2214
2213
|
});
|
|
2215
2214
|
})
|
|
2216
2215
|
);
|
|
2217
2216
|
}
|
|
2218
|
-
_refreshDrawingTransform(i, n,
|
|
2219
|
-
const
|
|
2220
|
-
Object.keys(
|
|
2221
|
-
const o =
|
|
2222
|
-
if (u ===
|
|
2217
|
+
_refreshDrawingTransform(i, n, t) {
|
|
2218
|
+
const e = this._drawingManagerService.getDrawingData(i, n), r = [];
|
|
2219
|
+
Object.keys(e).forEach((s) => {
|
|
2220
|
+
const o = e[s], { sheetTransform: a, transform: c, anchorType: u = U.Position } = o;
|
|
2221
|
+
if (u === U.None)
|
|
2223
2222
|
return !0;
|
|
2224
2223
|
const { from: d, to: l } = a, { row: g, column: h } = d, { row: f, column: p } = l;
|
|
2225
|
-
for (let m = 0; m <
|
|
2226
|
-
const w =
|
|
2227
|
-
if (
|
|
2224
|
+
for (let m = 0; m < t.length; m++) {
|
|
2225
|
+
const w = t[m], { startRow: S, endRow: C, startColumn: D, endColumn: v } = w;
|
|
2226
|
+
if (Xr.intersects(
|
|
2228
2227
|
{
|
|
2229
2228
|
startRow: S,
|
|
2230
2229
|
endRow: C,
|
|
@@ -2238,7 +2237,7 @@ let an = class extends le {
|
|
|
2238
2237
|
endColumn: p
|
|
2239
2238
|
}
|
|
2240
2239
|
) || g > C || h > v) {
|
|
2241
|
-
const b = u ===
|
|
2240
|
+
const b = u === U.Position, _ = z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
2242
2241
|
r.push({
|
|
2243
2242
|
...o,
|
|
2244
2243
|
transform: {
|
|
@@ -2250,67 +2249,70 @@ let an = class extends le {
|
|
|
2250
2249
|
break;
|
|
2251
2250
|
}
|
|
2252
2251
|
}
|
|
2253
|
-
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(
|
|
2252
|
+
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(x.id, [i]));
|
|
2254
2253
|
}
|
|
2255
2254
|
};
|
|
2256
|
-
an =
|
|
2255
|
+
an = Ws([
|
|
2257
2256
|
_e(1, ne),
|
|
2258
2257
|
_e(2, G),
|
|
2259
2258
|
_e(3, Xe),
|
|
2260
2259
|
_e(4, N(V)),
|
|
2261
|
-
_e(5, N(
|
|
2260
|
+
_e(5, N(Lt)),
|
|
2262
2261
|
_e(6, ae),
|
|
2263
2262
|
_e(7, oe),
|
|
2264
2263
|
_e(8, Ge)
|
|
2265
2264
|
], an);
|
|
2266
2265
|
var se = function() {
|
|
2267
2266
|
return se = Object.assign || function(i) {
|
|
2268
|
-
for (var n,
|
|
2269
|
-
n = arguments[
|
|
2267
|
+
for (var n, t = 1, e = arguments.length; t < e; t++) {
|
|
2268
|
+
n = arguments[t];
|
|
2270
2269
|
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (i[r] = n[r]);
|
|
2271
2270
|
}
|
|
2272
2271
|
return i;
|
|
2273
2272
|
}, se.apply(this, arguments);
|
|
2274
|
-
},
|
|
2275
|
-
var
|
|
2276
|
-
for (var
|
|
2273
|
+
}, xs = function(i, n) {
|
|
2274
|
+
var t = {};
|
|
2275
|
+
for (var e in i) Object.prototype.hasOwnProperty.call(i, e) && n.indexOf(e) < 0 && (t[e] = i[e]);
|
|
2277
2276
|
if (i != null && typeof Object.getOwnPropertySymbols == "function")
|
|
2278
|
-
for (var r = 0,
|
|
2279
|
-
n.indexOf(
|
|
2280
|
-
return
|
|
2277
|
+
for (var r = 0, e = Object.getOwnPropertySymbols(i); r < e.length; r++)
|
|
2278
|
+
n.indexOf(e[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, e[r]) && (t[e[r]] = i[e[r]]);
|
|
2279
|
+
return t;
|
|
2281
2280
|
}, _r = cr(function(i, n) {
|
|
2282
|
-
var
|
|
2283
|
-
return vr(
|
|
2281
|
+
var t = i.icon, e = i.id, r = i.className, s = i.extend, o = xs(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(e, " ").concat(r || "").trim(), c = ns("_".concat(Ys()));
|
|
2282
|
+
return vr(t, "".concat(e), { defIds: t.defIds, idSuffix: c.current }, se({ ref: n, className: a }, o), s);
|
|
2284
2283
|
});
|
|
2285
|
-
function vr(i, n,
|
|
2286
|
-
return dr(i.tag, se(se({ key: n },
|
|
2287
|
-
return vr(s, "".concat(n, "-").concat(i.tag, "-").concat(o),
|
|
2284
|
+
function vr(i, n, t, e, r) {
|
|
2285
|
+
return dr(i.tag, se(se({ key: n }, Ls(i, t, r)), e), (Fs(i, t).children || []).map(function(s, o) {
|
|
2286
|
+
return vr(s, "".concat(n, "-").concat(i.tag, "-").concat(o), t, void 0, r);
|
|
2288
2287
|
}));
|
|
2289
2288
|
}
|
|
2290
|
-
function
|
|
2291
|
-
var
|
|
2292
|
-
|
|
2289
|
+
function Ls(i, n, t) {
|
|
2290
|
+
var e = se({}, i.attrs);
|
|
2291
|
+
t != null && t.colorChannel1 && e.fill === "colorChannel1" && (e.fill = t.colorChannel1), i.tag === "mask" && e.id && (e.id = e.id + n.idSuffix), Object.entries(e).forEach(function(s) {
|
|
2292
|
+
var o = s[0], a = s[1];
|
|
2293
|
+
o === "mask" && typeof a == "string" && (e[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
|
|
2294
|
+
});
|
|
2293
2295
|
var r = n.defIds;
|
|
2294
|
-
return !r || r.length === 0 || (i.tag === "use" &&
|
|
2296
|
+
return !r || r.length === 0 || (i.tag === "use" && e["xlink:href"] && (e["xlink:href"] = e["xlink:href"] + n.idSuffix), Object.entries(e).forEach(function(s) {
|
|
2295
2297
|
var o = s[0], a = s[1];
|
|
2296
|
-
typeof a == "string" && (
|
|
2297
|
-
})),
|
|
2298
|
+
typeof a == "string" && (e[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
|
|
2299
|
+
})), e;
|
|
2298
2300
|
}
|
|
2299
|
-
function
|
|
2300
|
-
var
|
|
2301
|
-
return !
|
|
2302
|
-
return typeof r.attrs.id == "string" &&
|
|
2301
|
+
function Fs(i, n) {
|
|
2302
|
+
var t, e = n.defIds;
|
|
2303
|
+
return !e || e.length === 0 ? i : i.tag === "defs" && (!((t = i.children) === null || t === void 0) && t.length) ? se(se({}, i), { children: i.children.map(function(r) {
|
|
2304
|
+
return typeof r.attrs.id == "string" && e && e.indexOf(r.attrs.id) > -1 ? se(se({}, r), { attrs: se(se({}, r.attrs), { id: r.attrs.id + n.idSuffix }) }) : r;
|
|
2303
2305
|
}) }) : i;
|
|
2304
2306
|
}
|
|
2305
|
-
function
|
|
2307
|
+
function Ys() {
|
|
2306
2308
|
return Math.random().toString(36).substring(2, 8);
|
|
2307
2309
|
}
|
|
2308
2310
|
_r.displayName = "UniverIcon";
|
|
2309
|
-
var
|
|
2311
|
+
var Gs = { 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" } }] }, Sr = cr(function(i, n) {
|
|
2310
2312
|
return dr(_r, Object.assign({}, i, {
|
|
2311
2313
|
id: "add-image-single",
|
|
2312
2314
|
ref: n,
|
|
2313
|
-
icon:
|
|
2315
|
+
icon: Gs
|
|
2314
2316
|
}));
|
|
2315
2317
|
});
|
|
2316
2318
|
Sr.displayName = "AddImageSingle";
|
|
@@ -2318,10 +2320,10 @@ const Ir = {
|
|
|
2318
2320
|
id: "sheet.command.delete-drawing",
|
|
2319
2321
|
type: te.COMMAND,
|
|
2320
2322
|
handler: (i) => {
|
|
2321
|
-
const n = i.get(G),
|
|
2322
|
-
if (
|
|
2323
|
+
const n = i.get(G), e = i.get(ae).getFocusDrawings();
|
|
2324
|
+
if (e.length === 0)
|
|
2323
2325
|
return !1;
|
|
2324
|
-
const r =
|
|
2326
|
+
const r = e[0].unitId, s = e.map((o) => {
|
|
2325
2327
|
const { unitId: a, subUnitId: c, drawingId: u, drawingType: d } = o;
|
|
2326
2328
|
return {
|
|
2327
2329
|
unitId: a,
|
|
@@ -2339,7 +2341,7 @@ const Ir = {
|
|
|
2339
2341
|
id: "sheet.command.move-drawing",
|
|
2340
2342
|
type: te.COMMAND,
|
|
2341
2343
|
handler: (i, n) => {
|
|
2342
|
-
const
|
|
2344
|
+
const t = i.get(G), e = i.get(ae), r = i.get(Xe), { direction: s } = n, o = e.getFocusDrawings();
|
|
2343
2345
|
if (o.length === 0)
|
|
2344
2346
|
return !1;
|
|
2345
2347
|
const a = o[0].unitId, c = o.map((d) => {
|
|
@@ -2350,79 +2352,70 @@ const Ir = {
|
|
|
2350
2352
|
return s === Ie.UP ? g.top = f - 1 : s === Ie.DOWN ? g.top = f + 1 : s === Ie.LEFT ? g.left = h - 1 : s === Ie.RIGHT && (g.left = h + 1), {
|
|
2351
2353
|
...d,
|
|
2352
2354
|
transform: g,
|
|
2353
|
-
sheetTransform:
|
|
2355
|
+
sheetTransform: $(g, r)
|
|
2354
2356
|
};
|
|
2355
2357
|
}).filter((d) => d != null);
|
|
2356
|
-
return
|
|
2358
|
+
return t.syncExecuteCommand(Yt.id, {
|
|
2357
2359
|
unitId: a,
|
|
2358
2360
|
drawings: c
|
|
2359
|
-
}) ? (
|
|
2361
|
+
}) ? (t.syncExecuteCommand(x.id, [a]), !0) : !1;
|
|
2360
2362
|
}
|
|
2361
2363
|
}, Cr = "addition-and-subtraction-single", br = "sheet.menu.image";
|
|
2362
|
-
function
|
|
2364
|
+
function Xs(i) {
|
|
2363
2365
|
return {
|
|
2364
2366
|
id: br,
|
|
2365
2367
|
type: cn.SUBITEMS,
|
|
2366
2368
|
icon: Cr,
|
|
2367
2369
|
tooltip: "sheetImage.title",
|
|
2368
|
-
hidden$:
|
|
2369
|
-
disabled$:
|
|
2370
|
+
hidden$: Ln(i, F.UNIVER_SHEET),
|
|
2371
|
+
disabled$: Ri(i, { workbookTypes: [Qt], worksheetTypes: [en], rangeTypes: [qi] })
|
|
2370
2372
|
};
|
|
2371
2373
|
}
|
|
2372
|
-
function
|
|
2374
|
+
function Vs(i) {
|
|
2373
2375
|
return {
|
|
2374
2376
|
id: Gt.id,
|
|
2375
2377
|
title: "sheetImage.upload.float",
|
|
2376
2378
|
type: cn.BUTTON,
|
|
2377
|
-
hidden$:
|
|
2379
|
+
hidden$: Ln(i, F.UNIVER_SHEET)
|
|
2378
2380
|
};
|
|
2379
2381
|
}
|
|
2380
|
-
function
|
|
2382
|
+
function Hs(i) {
|
|
2381
2383
|
return {
|
|
2382
2384
|
id: un.id,
|
|
2383
2385
|
title: "sheetImage.upload.cell",
|
|
2384
2386
|
type: cn.BUTTON
|
|
2385
2387
|
};
|
|
2386
2388
|
}
|
|
2387
|
-
const
|
|
2388
|
-
imageCommonPanel:
|
|
2389
|
-
imageCommonPanelGrid:
|
|
2390
|
-
imageCommonPanelBorder:
|
|
2391
|
-
imageCommonPanelTitle:
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
imageCommonPanelRowVertical: go,
|
|
2395
|
-
imageCommonPanelColumn: fo,
|
|
2396
|
-
imageCommonPanelColumnCenter: mo,
|
|
2397
|
-
imageCommonPanelInline: po,
|
|
2398
|
-
imageCommonPanelSpan2: wo,
|
|
2399
|
-
imageCommonPanelSpan3: _o,
|
|
2400
|
-
imageCommonPanelInput: vo,
|
|
2401
|
-
sheetImageMenu: So,
|
|
2402
|
-
sheetImageMenuInput: Io
|
|
2389
|
+
const zs = "univer-image-common-panel", Ks = "univer-image-common-panel-grid", Zs = "univer-image-common-panel-border", Js = "univer-image-common-panel-title", qs = "univer-image-common-panel-row", Qs = "univer-image-common-panel-column", ve = {
|
|
2390
|
+
imageCommonPanel: zs,
|
|
2391
|
+
imageCommonPanelGrid: Ks,
|
|
2392
|
+
imageCommonPanelBorder: Zs,
|
|
2393
|
+
imageCommonPanelTitle: Js,
|
|
2394
|
+
imageCommonPanelRow: qs,
|
|
2395
|
+
imageCommonPanelColumn: Qs
|
|
2403
2396
|
};
|
|
2404
2397
|
function Rr(i) {
|
|
2405
|
-
var n,
|
|
2406
|
-
if (typeof i == "string" || typeof i == "number")
|
|
2398
|
+
var n, t, e = "";
|
|
2399
|
+
if (typeof i == "string" || typeof i == "number") e += i;
|
|
2407
2400
|
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
2408
2401
|
var r = i.length;
|
|
2409
|
-
for (n = 0; n < r; n++) i[n] && (
|
|
2410
|
-
} else for (
|
|
2411
|
-
return
|
|
2402
|
+
for (n = 0; n < r; n++) i[n] && (t = Rr(i[n])) && (e && (e += " "), e += t);
|
|
2403
|
+
} else for (t in i) i[t] && (e && (e += " "), e += t);
|
|
2404
|
+
return e;
|
|
2412
2405
|
}
|
|
2413
2406
|
function Dt() {
|
|
2414
|
-
for (var i, n,
|
|
2415
|
-
return
|
|
2407
|
+
for (var i, n, t = 0, e = "", r = arguments.length; t < r; t++) (i = arguments[t]) && (n = Rr(i)) && (e && (e += " "), e += n);
|
|
2408
|
+
return e;
|
|
2416
2409
|
}
|
|
2417
|
-
const
|
|
2410
|
+
const eo = (i) => {
|
|
2418
2411
|
var C;
|
|
2419
|
-
const n = Te(G),
|
|
2412
|
+
const n = Te(G), t = Te($t), e = Te(oe), r = Te(ne), { drawings: s } = i, o = s[0];
|
|
2420
2413
|
if (o == null)
|
|
2421
2414
|
return;
|
|
2422
2415
|
const { unitId: a } = o, c = r.getRenderById(a), u = c == null ? void 0 : c.scene;
|
|
2423
2416
|
if (u == null)
|
|
2424
2417
|
return;
|
|
2425
|
-
const d = u.getTransformerByCreate(), [l, g] = rn(!0), h = (C = o.anchorType) != null ? C :
|
|
2418
|
+
const d = u.getTransformerByCreate(), [l, g] = rn(!0), h = (C = o.anchorType) != null ? C : U.Position, [f, p] = rn(h);
|
|
2426
2419
|
function m(D, v) {
|
|
2427
2420
|
const b = [];
|
|
2428
2421
|
return D.forEach((_) => {
|
|
@@ -2445,12 +2438,12 @@ const Co = (i) => {
|
|
|
2445
2438
|
b === !0 && g(!1);
|
|
2446
2439
|
}), v = d.changeStart$.subscribe((b) => {
|
|
2447
2440
|
var M;
|
|
2448
|
-
const { objects: _ } = b, E = m(_,
|
|
2441
|
+
const { objects: _ } = b, E = m(_, e);
|
|
2449
2442
|
if (E.length === 0)
|
|
2450
2443
|
g(!1);
|
|
2451
2444
|
else if (E.length >= 1) {
|
|
2452
2445
|
g(!0);
|
|
2453
|
-
const y = ((M = E[0]) == null ? void 0 : M.anchorType) ||
|
|
2446
|
+
const y = ((M = E[0]) == null ? void 0 : M.anchorType) || U.Position;
|
|
2454
2447
|
p(y);
|
|
2455
2448
|
}
|
|
2456
2449
|
});
|
|
@@ -2460,7 +2453,7 @@ const Co = (i) => {
|
|
|
2460
2453
|
}, []);
|
|
2461
2454
|
function w(D) {
|
|
2462
2455
|
p(D);
|
|
2463
|
-
const v =
|
|
2456
|
+
const v = e.getFocusDrawings();
|
|
2464
2457
|
if (v.length === 0)
|
|
2465
2458
|
return;
|
|
2466
2459
|
const b = v.map((_) => ({
|
|
@@ -2476,119 +2469,119 @@ const Co = (i) => {
|
|
|
2476
2469
|
}
|
|
2477
2470
|
const S = (D) => D ? "block" : "none";
|
|
2478
2471
|
return /* @__PURE__ */ Tt("div", { className: Dt(ve.imageCommonPanelGrid, ve.imageCommonPanelBorder), style: { display: S(l) }, children: [
|
|
2479
|
-
/* @__PURE__ */ ee("div", { className: ve.imageCommonPanelRow, children: /* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelColumn, ve.imageCommonPanelTitle), children: /* @__PURE__ */ ee("div", { children:
|
|
2480
|
-
/* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelRow), children: /* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelColumn), children: /* @__PURE__ */ Tt(
|
|
2481
|
-
/* @__PURE__ */ ee(Jt, { value:
|
|
2482
|
-
/* @__PURE__ */ ee(Jt, { value:
|
|
2483
|
-
/* @__PURE__ */ ee(Jt, { value:
|
|
2472
|
+
/* @__PURE__ */ ee("div", { className: ve.imageCommonPanelRow, children: /* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelColumn, ve.imageCommonPanelTitle), children: /* @__PURE__ */ ee("div", { children: t.t("drawing-anchor.title") }) }) }),
|
|
2473
|
+
/* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelRow), children: /* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelColumn), children: /* @__PURE__ */ Tt(ss, { value: f, onChange: w, direction: "vertical", children: [
|
|
2474
|
+
/* @__PURE__ */ ee(Jt, { value: U.Both, children: t.t("drawing-anchor.both") }),
|
|
2475
|
+
/* @__PURE__ */ ee(Jt, { value: U.Position, children: t.t("drawing-anchor.position") }),
|
|
2476
|
+
/* @__PURE__ */ ee(Jt, { value: U.None, children: t.t("drawing-anchor.none") })
|
|
2484
2477
|
] }) }) })
|
|
2485
2478
|
] });
|
|
2486
|
-
},
|
|
2487
|
-
const i = Te(oe), n = i.getFocusDrawings(), [
|
|
2479
|
+
}, to = () => {
|
|
2480
|
+
const i = Te(oe), n = i.getFocusDrawings(), [t, e] = rn(n);
|
|
2488
2481
|
return ln(() => {
|
|
2489
2482
|
const r = i.focus$.subscribe((s) => {
|
|
2490
|
-
|
|
2483
|
+
e(s);
|
|
2491
2484
|
});
|
|
2492
2485
|
return () => {
|
|
2493
2486
|
r.unsubscribe();
|
|
2494
2487
|
};
|
|
2495
|
-
}, []), !!(
|
|
2496
|
-
/* @__PURE__ */ ee(
|
|
2497
|
-
/* @__PURE__ */ ee(
|
|
2488
|
+
}, []), !!(t != null && t.length) && /* @__PURE__ */ Tt("div", { className: ve.imageCommonPanel, children: [
|
|
2489
|
+
/* @__PURE__ */ ee(ui, { drawings: t }),
|
|
2490
|
+
/* @__PURE__ */ ee(eo, { drawings: t })
|
|
2498
2491
|
] });
|
|
2499
|
-
},
|
|
2500
|
-
[
|
|
2492
|
+
}, no = {
|
|
2493
|
+
[Ai.FORMULAS_INSERT]: {
|
|
2501
2494
|
[br]: {
|
|
2502
2495
|
order: 3,
|
|
2503
|
-
menuItemFactory:
|
|
2496
|
+
menuItemFactory: Xs,
|
|
2504
2497
|
[Gt.id]: {
|
|
2505
2498
|
order: 0,
|
|
2506
|
-
menuItemFactory:
|
|
2499
|
+
menuItemFactory: Vs
|
|
2507
2500
|
},
|
|
2508
2501
|
[un.id]: {
|
|
2509
2502
|
order: 1,
|
|
2510
|
-
menuItemFactory:
|
|
2503
|
+
menuItemFactory: Hs
|
|
2511
2504
|
}
|
|
2512
2505
|
}
|
|
2513
2506
|
}
|
|
2514
2507
|
};
|
|
2515
2508
|
function it(i) {
|
|
2516
|
-
return !i.getContextValue(
|
|
2509
|
+
return !i.getContextValue(Vr) && !i.getContextValue(Hr) && !i.getContextValue(zr) && i.getContextValue(Le);
|
|
2517
2510
|
}
|
|
2518
|
-
const
|
|
2511
|
+
const ro = {
|
|
2519
2512
|
id: rt.id,
|
|
2520
2513
|
description: "shortcut.sheet.drawing-move-down",
|
|
2521
2514
|
group: "4_sheet-drawing-view",
|
|
2522
|
-
binding:
|
|
2515
|
+
binding: Fe.ARROW_DOWN,
|
|
2523
2516
|
priority: 100,
|
|
2524
2517
|
preconditions: it,
|
|
2525
2518
|
staticParameters: {
|
|
2526
2519
|
direction: Ie.DOWN
|
|
2527
2520
|
}
|
|
2528
|
-
},
|
|
2521
|
+
}, io = {
|
|
2529
2522
|
id: rt.id,
|
|
2530
2523
|
description: "shortcut.sheet.drawing-move-up",
|
|
2531
2524
|
group: "4_sheet-drawing-view",
|
|
2532
|
-
binding:
|
|
2525
|
+
binding: Fe.ARROW_UP,
|
|
2533
2526
|
priority: 100,
|
|
2534
2527
|
preconditions: it,
|
|
2535
2528
|
staticParameters: {
|
|
2536
2529
|
direction: Ie.UP
|
|
2537
2530
|
}
|
|
2538
|
-
},
|
|
2531
|
+
}, so = {
|
|
2539
2532
|
id: rt.id,
|
|
2540
2533
|
description: "shortcut.sheet.drawing-move-left",
|
|
2541
2534
|
group: "4_sheet-drawing-view",
|
|
2542
|
-
binding:
|
|
2535
|
+
binding: Fe.ARROW_LEFT,
|
|
2543
2536
|
priority: 100,
|
|
2544
2537
|
preconditions: it,
|
|
2545
2538
|
staticParameters: {
|
|
2546
2539
|
direction: Ie.LEFT
|
|
2547
2540
|
}
|
|
2548
|
-
},
|
|
2541
|
+
}, oo = {
|
|
2549
2542
|
id: rt.id,
|
|
2550
2543
|
description: "shortcut.sheet.drawing-move-right",
|
|
2551
2544
|
group: "4_sheet-drawing-view",
|
|
2552
|
-
binding:
|
|
2545
|
+
binding: Fe.ARROW_RIGHT,
|
|
2553
2546
|
priority: 100,
|
|
2554
2547
|
preconditions: it,
|
|
2555
2548
|
staticParameters: {
|
|
2556
2549
|
direction: Ie.RIGHT
|
|
2557
2550
|
}
|
|
2558
|
-
},
|
|
2551
|
+
}, ao = {
|
|
2559
2552
|
id: Ir.id,
|
|
2560
2553
|
description: "shortcut.sheet.drawing-delete",
|
|
2561
2554
|
group: "4_sheet-drawing-view",
|
|
2562
2555
|
// when focusing on any other input tag do not trigger this shortcut
|
|
2563
2556
|
preconditions: it,
|
|
2564
|
-
binding:
|
|
2565
|
-
mac:
|
|
2557
|
+
binding: Fe.DELETE,
|
|
2558
|
+
mac: Fe.BACKSPACE
|
|
2566
2559
|
};
|
|
2567
|
-
var
|
|
2568
|
-
for (var r =
|
|
2569
|
-
(o = i[s]) && (r =
|
|
2570
|
-
return
|
|
2571
|
-
},
|
|
2560
|
+
var co = Object.getOwnPropertyDescriptor, lo = (i, n, t, e) => {
|
|
2561
|
+
for (var r = e > 1 ? void 0 : e ? co(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
2562
|
+
(o = i[s]) && (r = o(r) || r);
|
|
2563
|
+
return r;
|
|
2564
|
+
}, $e = (i, n) => (t, e) => n(t, e, i);
|
|
2572
2565
|
let Bt = class extends le {
|
|
2573
|
-
constructor(i, n,
|
|
2574
|
-
super(), this._componentManager = i, this._menuManagerService = n, this._commandService =
|
|
2566
|
+
constructor(i, n, t, e, r, s) {
|
|
2567
|
+
super(), this._componentManager = i, this._menuManagerService = n, this._commandService = t, this._shortcutService = e, this._drawingManagerService = r, this._sheetsSelectionsService = s, this._init();
|
|
2575
2568
|
}
|
|
2576
2569
|
_initCustomComponents() {
|
|
2577
2570
|
const i = this._componentManager;
|
|
2578
|
-
this.disposeWithMe(i.register(Cr, Sr)), this.disposeWithMe(i.register(lr,
|
|
2571
|
+
this.disposeWithMe(i.register(Cr, Sr)), this.disposeWithMe(i.register(lr, to));
|
|
2579
2572
|
}
|
|
2580
2573
|
_initMenus() {
|
|
2581
|
-
this._menuManagerService.mergeMenu(
|
|
2574
|
+
this._menuManagerService.mergeMenu(no);
|
|
2582
2575
|
}
|
|
2583
2576
|
_initCommands() {
|
|
2584
2577
|
[
|
|
2585
2578
|
Gt,
|
|
2586
2579
|
un,
|
|
2587
|
-
|
|
2580
|
+
Ft,
|
|
2588
2581
|
nt,
|
|
2589
2582
|
Yt,
|
|
2590
2583
|
ur,
|
|
2591
|
-
|
|
2584
|
+
x,
|
|
2592
2585
|
hr,
|
|
2593
2586
|
gr,
|
|
2594
2587
|
mr,
|
|
@@ -2600,11 +2593,11 @@ let Bt = class extends le {
|
|
|
2600
2593
|
_initShortcuts() {
|
|
2601
2594
|
[
|
|
2602
2595
|
// sheet drawing shortcuts
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2596
|
+
ro,
|
|
2597
|
+
io,
|
|
2598
|
+
so,
|
|
2599
|
+
oo,
|
|
2600
|
+
ao
|
|
2608
2601
|
].forEach((i) => {
|
|
2609
2602
|
this.disposeWithMe(this._shortcutService.registerShortcut(i));
|
|
2610
2603
|
});
|
|
@@ -2613,21 +2606,21 @@ let Bt = class extends le {
|
|
|
2613
2606
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
2614
2607
|
}
|
|
2615
2608
|
};
|
|
2616
|
-
Bt =
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2609
|
+
Bt = lo([
|
|
2610
|
+
$e(0, N(Ni)),
|
|
2611
|
+
$e(1, ki),
|
|
2612
|
+
$e(2, G),
|
|
2613
|
+
$e(3, Bi),
|
|
2614
|
+
$e(4, oe),
|
|
2615
|
+
$e(5, N(dn))
|
|
2623
2616
|
], Bt);
|
|
2624
|
-
var
|
|
2625
|
-
for (var r =
|
|
2626
|
-
(o = i[s]) && (r =
|
|
2627
|
-
return
|
|
2628
|
-
}, Me = (i, n) => (
|
|
2629
|
-
function
|
|
2630
|
-
const { scaleX: s, scaleY: o } = n.getAncestorScale(), a = n.getViewport(
|
|
2617
|
+
var uo = Object.getOwnPropertyDescriptor, ho = (i, n, t, e) => {
|
|
2618
|
+
for (var r = e > 1 ? void 0 : e ? uo(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
2619
|
+
(o = i[s]) && (r = o(r) || r);
|
|
2620
|
+
return r;
|
|
2621
|
+
}, Me = (i, n) => (t, e) => n(t, e, i);
|
|
2622
|
+
function go(i, n, t, e, r) {
|
|
2623
|
+
const { scaleX: s, scaleY: o } = n.getAncestorScale(), a = n.getViewport($n.VIEW_MAIN), c = e.getFreeze(), { startColumn: u, startRow: d, xSplit: l, ySplit: g } = c, h = {
|
|
2631
2624
|
left: !0,
|
|
2632
2625
|
// left means the left of pic is in a viewMainLeft
|
|
2633
2626
|
top: !0
|
|
@@ -2639,13 +2632,13 @@ function Bo(i, n, e, t, r) {
|
|
|
2639
2632
|
};
|
|
2640
2633
|
const { left: f, right: p, top: m, bottom: w } = i;
|
|
2641
2634
|
let { top: S, left: C, viewportScrollX: D, viewportScrollY: v } = a;
|
|
2642
|
-
const { boundsOfViewArea: b, scrollDirectionResponse: _ } = r || {}, { rowHeaderWidth: E, columnHeaderHeight: M } =
|
|
2635
|
+
const { boundsOfViewArea: b, scrollDirectionResponse: _ } = r || {}, { rowHeaderWidth: E, columnHeaderHeight: M } = t, y = {
|
|
2643
2636
|
top: M,
|
|
2644
2637
|
left: E
|
|
2645
2638
|
};
|
|
2646
2639
|
b && (ye.isDefine(y.top) && (y.top = b.top), ye.isDefine(y.left) && (y.left = b.left)), _ === "HORIZONTAL" && (v = 0), _ === "VERTICAL" && (D = 0);
|
|
2647
2640
|
let T = 0, I = 0;
|
|
2648
|
-
const R =
|
|
2641
|
+
const R = t.rowStartY(d - g) + M, O = t.colStartX(u - l) + E, B = t.rowStartY(d) + M, K = t.colStartX(u) + E;
|
|
2649
2642
|
if (l === 0)
|
|
2650
2643
|
h.left = !1, T = (f - D) * s, I = (p - D) * s;
|
|
2651
2644
|
else {
|
|
@@ -2667,13 +2660,13 @@ function Bo(i, n, e, t, r) {
|
|
|
2667
2660
|
absolute: h
|
|
2668
2661
|
};
|
|
2669
2662
|
}
|
|
2670
|
-
const fe = (i, n,
|
|
2663
|
+
const fe = (i, n, t, e, r) => {
|
|
2671
2664
|
const { scene: s } = n, { left: o, top: a, width: c, height: u, angle: d } = i, l = {
|
|
2672
2665
|
left: o,
|
|
2673
2666
|
right: o + c,
|
|
2674
2667
|
top: a,
|
|
2675
2668
|
bottom: a + u
|
|
2676
|
-
}, g =
|
|
2669
|
+
}, g = go(l, s, t, e, r), { scaleX: h, scaleY: f } = s.getAncestorScale();
|
|
2677
2670
|
return {
|
|
2678
2671
|
startX: g.left,
|
|
2679
2672
|
endX: g.right,
|
|
@@ -2686,7 +2679,7 @@ const fe = (i, n, e, t, r) => {
|
|
|
2686
2679
|
};
|
|
2687
2680
|
};
|
|
2688
2681
|
let Wt = class extends le {
|
|
2689
|
-
constructor(n,
|
|
2682
|
+
constructor(n, t, e, r, s, o, a) {
|
|
2690
2683
|
super();
|
|
2691
2684
|
/**
|
|
2692
2685
|
* for update dom container position when scrolling and zoom
|
|
@@ -2703,10 +2696,10 @@ let Wt = class extends le {
|
|
|
2703
2696
|
Q(this, "_remove$", new Zt());
|
|
2704
2697
|
Q(this, "remove$", this._remove$.asObservable());
|
|
2705
2698
|
Q(this, "_hooks", []);
|
|
2706
|
-
this._renderManagerService = n, this._univerInstanceService =
|
|
2699
|
+
this._renderManagerService = n, this._univerInstanceService = t, this._commandService = e, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = a, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
|
|
2707
2700
|
}
|
|
2708
2701
|
_bindScrollEvent() {
|
|
2709
|
-
this._lifecycleService.lifecycle$.pipe(
|
|
2702
|
+
this._lifecycleService.lifecycle$.pipe(ji((n) => n === Zr.Rendered), $i(1)).subscribe(() => {
|
|
2710
2703
|
this._scrollUpdateListener();
|
|
2711
2704
|
});
|
|
2712
2705
|
}
|
|
@@ -2715,11 +2708,11 @@ let Wt = class extends le {
|
|
|
2715
2708
|
* @param unitId
|
|
2716
2709
|
* @param subUnitId
|
|
2717
2710
|
*/
|
|
2718
|
-
_ensureMap(n,
|
|
2719
|
-
let
|
|
2720
|
-
|
|
2721
|
-
let r =
|
|
2722
|
-
return r || (r = /* @__PURE__ */ new Map(),
|
|
2711
|
+
_ensureMap(n, t) {
|
|
2712
|
+
let e = this._domLayerMap.get(n);
|
|
2713
|
+
e || (e = /* @__PURE__ */ new Map(), this._domLayerMap.set(n, e));
|
|
2714
|
+
let r = e.get(t);
|
|
2715
|
+
return r || (r = /* @__PURE__ */ new Map(), e.set(t, r)), r;
|
|
2723
2716
|
}
|
|
2724
2717
|
getFloatDomInfo(n) {
|
|
2725
2718
|
return this._domLayerInfoMap.get(n);
|
|
@@ -2727,36 +2720,36 @@ let Wt = class extends le {
|
|
|
2727
2720
|
_getSceneAndTransformerByDrawingSearch(n) {
|
|
2728
2721
|
if (n == null)
|
|
2729
2722
|
return;
|
|
2730
|
-
const
|
|
2731
|
-
if (
|
|
2723
|
+
const t = this._renderManagerService.getRenderById(n), e = t == null ? void 0 : t.scene;
|
|
2724
|
+
if (t == null || e == null)
|
|
2732
2725
|
return null;
|
|
2733
|
-
const r =
|
|
2734
|
-
return { scene:
|
|
2726
|
+
const r = e.getTransformerByCreate(), s = t.engine.getCanvasElement();
|
|
2727
|
+
return { scene: e, transformer: r, renderUnit: t, canvas: s };
|
|
2735
2728
|
}
|
|
2736
2729
|
_getFloatDomProps(n) {
|
|
2737
|
-
let
|
|
2738
|
-
return this._hooks.forEach((
|
|
2739
|
-
|
|
2740
|
-
}),
|
|
2730
|
+
let t;
|
|
2731
|
+
return this._hooks.forEach((e) => {
|
|
2732
|
+
t = e.onGetFloatDomProps(n);
|
|
2733
|
+
}), t;
|
|
2741
2734
|
}
|
|
2742
2735
|
_drawingAddListener() {
|
|
2743
2736
|
this.disposeWithMe(
|
|
2744
2737
|
this._drawingManagerService.add$.subscribe((n) => {
|
|
2745
|
-
n.forEach((
|
|
2738
|
+
n.forEach((t) => {
|
|
2746
2739
|
var J, ce, q;
|
|
2747
|
-
const { unitId:
|
|
2740
|
+
const { unitId: e, subUnitId: r, drawingId: s } = t, o = H(this._univerInstanceService, { unitId: e, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(t), c = this._univerInstanceService.getUnit(e, F.UNIVER_SHEET);
|
|
2748
2741
|
if (!c)
|
|
2749
2742
|
return;
|
|
2750
2743
|
const u = c.getActiveSheet().getSheetId();
|
|
2751
2744
|
if (!a || !o)
|
|
2752
2745
|
return;
|
|
2753
|
-
const d = (J = this._renderManagerService.getRenderById(
|
|
2746
|
+
const d = (J = this._renderManagerService.getRenderById(e)) == null ? void 0 : J.with(V).getSkeletonParam(r);
|
|
2754
2747
|
if (!d)
|
|
2755
2748
|
return;
|
|
2756
2749
|
const { transform: l, drawingType: g, data: h } = a;
|
|
2757
|
-
if (g !==
|
|
2750
|
+
if (g !== L.DRAWING_DOM && g !== L.DRAWING_CHART)
|
|
2758
2751
|
return;
|
|
2759
|
-
const f = this._getSceneAndTransformerByDrawingSearch(
|
|
2752
|
+
const f = this._getSceneAndTransformerByDrawingSearch(e);
|
|
2760
2753
|
if (f == null)
|
|
2761
2754
|
return;
|
|
2762
2755
|
const { scene: p, canvas: m } = f;
|
|
@@ -2764,7 +2757,7 @@ let Wt = class extends le {
|
|
|
2764
2757
|
return !0;
|
|
2765
2758
|
if (u !== r)
|
|
2766
2759
|
return;
|
|
2767
|
-
const { left: w, top: S, width: C, height: D, angle: v, flipX: b, flipY: _, skewX: E, skewY: M } = l, y = Ce({ unitId:
|
|
2760
|
+
const { left: w, top: S, width: C, height: D, angle: v, flipX: b, flipY: _, skewX: E, skewY: M } = l, y = Ce({ unitId: e, subUnitId: r, drawingId: s }), T = p.getObject(y);
|
|
2768
2761
|
if (T != null) {
|
|
2769
2762
|
T.transformByState({ left: w, top: S, width: C, height: D, angle: v, flipX: b, flipY: _, skewX: E, skewY: M });
|
|
2770
2763
|
return;
|
|
@@ -2774,19 +2767,19 @@ let Wt = class extends le {
|
|
|
2774
2767
|
top: S,
|
|
2775
2768
|
width: C,
|
|
2776
2769
|
height: D,
|
|
2777
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2778
|
-
}, R = g ===
|
|
2770
|
+
zIndex: this._drawingManagerService.getDrawingOrder(e, r).length - 1
|
|
2771
|
+
}, R = g === L.DRAWING_CHART;
|
|
2779
2772
|
if (R) {
|
|
2780
2773
|
const W = h ? h.backgroundColor : "white";
|
|
2781
2774
|
I.fill = W, I.rotateEnabled = !1, h && h.border && (I.stroke = h.border), I.paintFirst = "stroke", I.strokeWidth = 1, I.borderEnabled = !1, I.radius = 8;
|
|
2782
2775
|
}
|
|
2783
|
-
const O = new
|
|
2776
|
+
const O = new je(y, I);
|
|
2784
2777
|
R && O.setObjectType(bn.CHART), p.addObject(O, Kt), a.allowTransform !== !1 && p.attachTransformerTo(O);
|
|
2785
|
-
const B = this._ensureMap(
|
|
2778
|
+
const B = this._ensureMap(e, r), K = new _t(), Z = fe(O, f.renderUnit, d.skeleton, o.worksheet), Y = new Ze(Z), me = {
|
|
2786
2779
|
dispose: K,
|
|
2787
2780
|
rect: O,
|
|
2788
2781
|
position$: Y,
|
|
2789
|
-
unitId:
|
|
2782
|
+
unitId: e,
|
|
2790
2783
|
subUnitId: r
|
|
2791
2784
|
};
|
|
2792
2785
|
this._canvasFloatDomService.addFloatDom({
|
|
@@ -2807,7 +2800,7 @@ let Wt = class extends le {
|
|
|
2807
2800
|
},
|
|
2808
2801
|
props: (q = (ce = B.get(s)) == null ? void 0 : ce.props) != null ? q : this._getFloatDomProps(s),
|
|
2809
2802
|
data: h,
|
|
2810
|
-
unitId:
|
|
2803
|
+
unitId: e
|
|
2811
2804
|
});
|
|
2812
2805
|
const X = O.onTransformChange$.subscribeEvent(() => {
|
|
2813
2806
|
const W = fe(O, f.renderUnit, d.skeleton, o.worksheet);
|
|
@@ -2824,8 +2817,8 @@ let Wt = class extends le {
|
|
|
2824
2817
|
})
|
|
2825
2818
|
), this.disposeWithMe(
|
|
2826
2819
|
this._drawingManagerService.remove$.subscribe((n) => {
|
|
2827
|
-
n.forEach((
|
|
2828
|
-
const { unitId:
|
|
2820
|
+
n.forEach((t) => {
|
|
2821
|
+
const { unitId: e, subUnitId: r, drawingId: s } = t, o = Ce({ unitId: e, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(e);
|
|
2829
2822
|
if (a == null)
|
|
2830
2823
|
return;
|
|
2831
2824
|
const { transformer: c, scene: u } = a, d = u.getObject(o);
|
|
@@ -2835,9 +2828,9 @@ let Wt = class extends le {
|
|
|
2835
2828
|
);
|
|
2836
2829
|
}
|
|
2837
2830
|
_scrollUpdateListener() {
|
|
2838
|
-
const n = (
|
|
2831
|
+
const n = (t, e) => {
|
|
2839
2832
|
var u;
|
|
2840
|
-
const r = this._getSceneAndTransformerByDrawingSearch(
|
|
2833
|
+
const r = this._getSceneAndTransformerByDrawingSearch(t), s = this._ensureMap(t, e), o = Array.from(s.keys()), a = H(this._univerInstanceService, { unitId: t, subUnitId: e }), c = (u = this._renderManagerService.getRenderById(t)) == null ? void 0 : u.with(V).getSkeletonParam(e);
|
|
2841
2834
|
!r || !a || !c || o.forEach((d) => {
|
|
2842
2835
|
const l = this._domLayerInfoMap.get(d);
|
|
2843
2836
|
if (l) {
|
|
@@ -2847,45 +2840,45 @@ let Wt = class extends le {
|
|
|
2847
2840
|
});
|
|
2848
2841
|
};
|
|
2849
2842
|
this.disposeWithMe(
|
|
2850
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
2851
|
-
Se((
|
|
2852
|
-
Ee((
|
|
2853
|
-
if (!
|
|
2854
|
-
const
|
|
2855
|
-
return r ? { render: r, unitId:
|
|
2843
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(
|
|
2844
|
+
Se((t) => t ? t.activeSheet$ : En(null)),
|
|
2845
|
+
Ee((t) => {
|
|
2846
|
+
if (!t) return null;
|
|
2847
|
+
const e = t.getUnitId(), r = this._renderManagerService.getRenderById(e);
|
|
2848
|
+
return r ? { render: r, unitId: e, subUnitId: t.getSheetId() } : null;
|
|
2856
2849
|
}),
|
|
2857
2850
|
Se(
|
|
2858
|
-
(
|
|
2851
|
+
(t) => t ? Jr(t.render.scene.getViewport($n.VIEW_MAIN).onScrollAfter$).pipe(Ee(() => ({ unitId: t.unitId, subUnitId: t.subUnitId }))) : En(null)
|
|
2859
2852
|
)
|
|
2860
|
-
).subscribe((
|
|
2861
|
-
if (!
|
|
2862
|
-
const { unitId:
|
|
2863
|
-
n(
|
|
2853
|
+
).subscribe((t) => {
|
|
2854
|
+
if (!t) return;
|
|
2855
|
+
const { unitId: e, subUnitId: r } = t;
|
|
2856
|
+
n(e, r);
|
|
2864
2857
|
})
|
|
2865
|
-
), this.disposeWithMe(this._commandService.onCommandExecuted((
|
|
2866
|
-
var
|
|
2867
|
-
if (
|
|
2868
|
-
const s =
|
|
2869
|
-
Array.from((r = (
|
|
2858
|
+
), this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
|
|
2859
|
+
var e, r;
|
|
2860
|
+
if (t.id === Dn.id) {
|
|
2861
|
+
const s = t.params, { unitId: o } = s;
|
|
2862
|
+
Array.from((r = (e = this._domLayerMap.get(o)) == null ? void 0 : e.keys()) != null ? r : []).forEach((c) => {
|
|
2870
2863
|
n(o, c);
|
|
2871
2864
|
});
|
|
2872
|
-
} else if (
|
|
2873
|
-
const { unitId: s, subUnitId: o } =
|
|
2865
|
+
} else if (t.id === Qi.id) {
|
|
2866
|
+
const { unitId: s, subUnitId: o } = t.params;
|
|
2874
2867
|
n(s, o);
|
|
2875
2868
|
}
|
|
2876
2869
|
}));
|
|
2877
2870
|
}
|
|
2878
|
-
_getPosition(n,
|
|
2871
|
+
_getPosition(n, t) {
|
|
2879
2872
|
var g;
|
|
2880
|
-
const { startX:
|
|
2873
|
+
const { startX: e, endX: r, startY: s, endY: o } = n, a = (g = this._renderManagerService.getRenderById(t)) == null ? void 0 : g.with(Xe);
|
|
2881
2874
|
if (a == null)
|
|
2882
2875
|
return;
|
|
2883
|
-
const c = a.getCellWithCoordByOffset(
|
|
2876
|
+
const c = a.getCellWithCoordByOffset(e, s);
|
|
2884
2877
|
if (c == null)
|
|
2885
2878
|
return;
|
|
2886
2879
|
const u = {
|
|
2887
2880
|
column: c.actualColumn,
|
|
2888
|
-
columnOffset:
|
|
2881
|
+
columnOffset: e - c.startX,
|
|
2889
2882
|
row: c.actualRow,
|
|
2890
2883
|
rowOffset: s - c.startY
|
|
2891
2884
|
}, d = a.getCellWithCoordByOffset(r, o);
|
|
@@ -2905,14 +2898,14 @@ let Wt = class extends le {
|
|
|
2905
2898
|
_featureUpdateListener() {
|
|
2906
2899
|
this.disposeWithMe(
|
|
2907
2900
|
this._drawingManagerService.update$.subscribe((n) => {
|
|
2908
|
-
n.forEach((
|
|
2909
|
-
const
|
|
2910
|
-
if (!
|
|
2901
|
+
n.forEach((t) => {
|
|
2902
|
+
const e = this._drawingManagerService.getDrawingByParam(t);
|
|
2903
|
+
if (!e || e.drawingType !== L.DRAWING_DOM && e.drawingType !== L.DRAWING_CHART)
|
|
2911
2904
|
return;
|
|
2912
2905
|
const r = {
|
|
2913
|
-
...
|
|
2906
|
+
...e.transform
|
|
2914
2907
|
};
|
|
2915
|
-
this._transformChange$.next({ id:
|
|
2908
|
+
this._transformChange$.next({ id: t.drawingId, value: r });
|
|
2916
2909
|
});
|
|
2917
2910
|
})
|
|
2918
2911
|
);
|
|
@@ -2920,28 +2913,28 @@ let Wt = class extends le {
|
|
|
2920
2913
|
_deleteListener() {
|
|
2921
2914
|
this.disposeWithMe(
|
|
2922
2915
|
this._drawingManagerService.remove$.subscribe((n) => {
|
|
2923
|
-
n.forEach((
|
|
2924
|
-
this._removeDom(
|
|
2916
|
+
n.forEach((t) => {
|
|
2917
|
+
this._removeDom(t.drawingId);
|
|
2925
2918
|
});
|
|
2926
2919
|
})
|
|
2927
2920
|
);
|
|
2928
2921
|
}
|
|
2929
|
-
updateFloatDomProps(n,
|
|
2930
|
-
const s = this._domLayerInfoMap.get(
|
|
2922
|
+
updateFloatDomProps(n, t, e, r) {
|
|
2923
|
+
const s = this._domLayerInfoMap.get(e), o = this._getSceneAndTransformerByDrawingSearch(n);
|
|
2931
2924
|
if (s && o) {
|
|
2932
|
-
const { scene: a } = o, c = Ce({ unitId: n, subUnitId:
|
|
2933
|
-
u && u instanceof
|
|
2925
|
+
const { scene: a } = o, c = Ce({ unitId: n, subUnitId: t, drawingId: e }), u = a.getObject(c);
|
|
2926
|
+
u && u instanceof je && u.setProps(r);
|
|
2934
2927
|
}
|
|
2935
2928
|
}
|
|
2936
2929
|
// CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
|
|
2937
|
-
addFloatDomToPosition(n,
|
|
2938
|
-
const
|
|
2930
|
+
addFloatDomToPosition(n, t) {
|
|
2931
|
+
const e = H(this._univerInstanceService, {
|
|
2939
2932
|
unitId: n.unitId,
|
|
2940
2933
|
subUnitId: n.subUnitId
|
|
2941
2934
|
});
|
|
2942
|
-
if (!
|
|
2935
|
+
if (!e)
|
|
2943
2936
|
throw new Error("cannot find current target!");
|
|
2944
|
-
const { unitId: r, subUnitId: s } =
|
|
2937
|
+
const { unitId: r, subUnitId: s } = e, { initPosition: o, componentKey: a, data: c, allowTransform: u = !0 } = n, d = t != null ? t : Ht(), l = this._getPosition(o, r);
|
|
2945
2938
|
if (l == null)
|
|
2946
2939
|
return;
|
|
2947
2940
|
this._ensureMap(r, s).set(d, n);
|
|
@@ -2949,7 +2942,7 @@ let Wt = class extends le {
|
|
|
2949
2942
|
unitId: r,
|
|
2950
2943
|
subUnitId: s,
|
|
2951
2944
|
drawingId: d,
|
|
2952
|
-
drawingType: n.type ||
|
|
2945
|
+
drawingType: n.type || L.DRAWING_DOM,
|
|
2953
2946
|
componentKey: a,
|
|
2954
2947
|
sheetTransform: l,
|
|
2955
2948
|
transform: {
|
|
@@ -2961,7 +2954,7 @@ let Wt = class extends le {
|
|
|
2961
2954
|
data: c,
|
|
2962
2955
|
allowTransform: u
|
|
2963
2956
|
};
|
|
2964
|
-
return this._commandService.executeCommand(
|
|
2957
|
+
return this._commandService.executeCommand(Ft.id, {
|
|
2965
2958
|
unitId: r,
|
|
2966
2959
|
drawings: [h]
|
|
2967
2960
|
}), this._add$.next({ unitId: r, subUnitId: s, id: d }), {
|
|
@@ -2971,36 +2964,36 @@ let Wt = class extends le {
|
|
|
2971
2964
|
}
|
|
2972
2965
|
};
|
|
2973
2966
|
}
|
|
2974
|
-
_removeDom(n,
|
|
2975
|
-
const
|
|
2976
|
-
if (!
|
|
2967
|
+
_removeDom(n, t = !1) {
|
|
2968
|
+
const e = this._domLayerInfoMap.get(n);
|
|
2969
|
+
if (!e)
|
|
2977
2970
|
return;
|
|
2978
|
-
const { unitId: r, subUnitId: s } =
|
|
2979
|
-
this._domLayerInfoMap.delete(n),
|
|
2971
|
+
const { unitId: r, subUnitId: s } = e;
|
|
2972
|
+
this._domLayerInfoMap.delete(n), e.dispose.dispose();
|
|
2980
2973
|
const o = this._getSceneAndTransformerByDrawingSearch(r);
|
|
2981
|
-
if (o && o.scene.removeObject(
|
|
2974
|
+
if (o && o.scene.removeObject(e.rect), t) {
|
|
2982
2975
|
this._ensureMap(r, s).delete(n);
|
|
2983
2976
|
const c = this._drawingManagerService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: n });
|
|
2984
2977
|
if (!c)
|
|
2985
2978
|
return;
|
|
2986
2979
|
const u = this._sheetDrawingService.getBatchRemoveOp([c]), { redo: d, objects: l } = u;
|
|
2987
|
-
this._commandService.syncExecuteCommand(
|
|
2980
|
+
this._commandService.syncExecuteCommand(A.id, { unitId: r, subUnitId: s, op: d, objects: l, type: P.REMOVE });
|
|
2988
2981
|
}
|
|
2989
2982
|
}
|
|
2990
2983
|
addHook(n) {
|
|
2991
2984
|
return this._hooks.push(n), {
|
|
2992
2985
|
dispose: () => {
|
|
2993
|
-
const
|
|
2994
|
-
this._hooks.splice(
|
|
2986
|
+
const t = this._hooks.findIndex((e) => e === n);
|
|
2987
|
+
this._hooks.splice(t, 1);
|
|
2995
2988
|
}
|
|
2996
2989
|
};
|
|
2997
2990
|
}
|
|
2998
2991
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
2999
|
-
addFloatDomToRange(n,
|
|
2992
|
+
addFloatDomToRange(n, t, e, r) {
|
|
3000
2993
|
var _, E, M, y, T;
|
|
3001
2994
|
const s = H(this._univerInstanceService, {
|
|
3002
|
-
unitId:
|
|
3003
|
-
subUnitId:
|
|
2995
|
+
unitId: t.unitId,
|
|
2996
|
+
subUnitId: t.subUnitId
|
|
3004
2997
|
});
|
|
3005
2998
|
if (!s)
|
|
3006
2999
|
throw new Error("cannot find current target!");
|
|
@@ -3010,17 +3003,16 @@ let Wt = class extends le {
|
|
|
3010
3003
|
if (!u) return;
|
|
3011
3004
|
const d = (_ = this._renderManagerService.getRenderById(o)) == null ? void 0 : _.with(V).getWorksheetSkeleton(a);
|
|
3012
3005
|
if (!d) return;
|
|
3013
|
-
const { componentKey: l, data: g, allowTransform: h = !0 } =
|
|
3014
|
-
if (
|
|
3006
|
+
const { componentKey: l, data: g, allowTransform: h = !0 } = t, f = r != null ? r : Ht(), { position: p, position$: m } = this._createRangePositionObserver(n, u, d.skeleton);
|
|
3007
|
+
if (this._getPosition(p, o) == null)
|
|
3015
3008
|
return;
|
|
3016
|
-
this._ensureMap(o, a).set(f,
|
|
3017
|
-
const C = c.scene, { scaleX: D } = C.getAncestorScale(), v = Mt(p,
|
|
3009
|
+
this._ensureMap(o, a).set(f, t);
|
|
3010
|
+
const C = c.scene, { scaleX: D } = C.getAncestorScale(), v = Mt(p, e, D), b = {
|
|
3018
3011
|
unitId: o,
|
|
3019
3012
|
subUnitId: a,
|
|
3020
3013
|
drawingId: f,
|
|
3021
|
-
drawingType:
|
|
3014
|
+
drawingType: t.type || L.DRAWING_DOM,
|
|
3022
3015
|
componentKey: l,
|
|
3023
|
-
sheetTransform: w,
|
|
3024
3016
|
transform: {
|
|
3025
3017
|
left: v.startX,
|
|
3026
3018
|
top: v.startY,
|
|
@@ -3031,7 +3023,7 @@ let Wt = class extends le {
|
|
|
3031
3023
|
allowTransform: h
|
|
3032
3024
|
};
|
|
3033
3025
|
{
|
|
3034
|
-
const { unitId: I, subUnitId: R, drawingId: O } = b, B = H(this._univerInstanceService, { unitId: I, subUnitId: R }), K = b, Z = this._univerInstanceService.getUnit(I,
|
|
3026
|
+
const { unitId: I, subUnitId: R, drawingId: O } = b, B = H(this._univerInstanceService, { unitId: I, subUnitId: R }), K = b, Z = this._univerInstanceService.getUnit(I, F.UNIVER_SHEET);
|
|
3035
3027
|
if (!Z)
|
|
3036
3028
|
return;
|
|
3037
3029
|
const Y = Z.getActiveSheet().getSheetId();
|
|
@@ -3044,17 +3036,17 @@ let Wt = class extends le {
|
|
|
3044
3036
|
if (!X)
|
|
3045
3037
|
return;
|
|
3046
3038
|
const { transform: J, drawingType: ce, data: q } = K;
|
|
3047
|
-
if (ce !==
|
|
3039
|
+
if (ce !== L.DRAWING_DOM && ce !== L.DRAWING_CHART)
|
|
3048
3040
|
return;
|
|
3049
3041
|
const W = this._getSceneAndTransformerByDrawingSearch(I);
|
|
3050
3042
|
if (W == null)
|
|
3051
3043
|
return;
|
|
3052
|
-
const { scene: Oe, canvas:
|
|
3044
|
+
const { scene: Oe, canvas: Ue } = W;
|
|
3053
3045
|
if (J == null || Y !== R)
|
|
3054
3046
|
return;
|
|
3055
|
-
const { left: st, top: ot, width: at, height: ct, angle: Xt, flipX: Vt, flipY: dt, skewX: lt, skewY:
|
|
3047
|
+
const { left: st, top: ot, width: at, height: ct, angle: Xt, flipX: Vt, flipY: dt, skewX: lt, skewY: Pe } = J, ut = Ce({ unitId: I, subUnitId: R, drawingId: O }), ue = Oe.getObject(ut);
|
|
3056
3048
|
if (ue != null) {
|
|
3057
|
-
ue.transformByState({ left: st, top: ot, width: at, height: ct, angle: Xt, flipX: Vt, flipY: dt, skewX: lt, skewY:
|
|
3049
|
+
ue.transformByState({ left: st, top: ot, width: at, height: ct, angle: Xt, flipX: Vt, flipY: dt, skewX: lt, skewY: Pe });
|
|
3058
3050
|
return;
|
|
3059
3051
|
}
|
|
3060
3052
|
const re = {
|
|
@@ -3064,12 +3056,12 @@ let Wt = class extends le {
|
|
|
3064
3056
|
width: at,
|
|
3065
3057
|
height: ct,
|
|
3066
3058
|
zIndex: this._drawingManagerService.getDrawingOrder(I, R).length - 1
|
|
3067
|
-
}, Ae = ce ===
|
|
3059
|
+
}, Ae = ce === L.DRAWING_CHART;
|
|
3068
3060
|
if (Ae) {
|
|
3069
|
-
const
|
|
3070
|
-
re.fill =
|
|
3061
|
+
const k = q ? q.backgroundColor : "white";
|
|
3062
|
+
re.fill = k, re.rotateEnabled = !1, q && q.border && (re.stroke = q.border), re.paintFirst = "stroke", re.strokeWidth = 1, re.borderEnabled = !1, re.radius = 8;
|
|
3071
3063
|
}
|
|
3072
|
-
const de = new
|
|
3064
|
+
const de = new je(ut, re);
|
|
3073
3065
|
Ae && de.setObjectType(bn.CHART), Oe.addObject(de, Kt), K.allowTransform !== !1 && Oe.attachTransformerTo(de);
|
|
3074
3066
|
const Ve = this._ensureMap(I, R), he = new _t(), ht = Oe.getMainViewport(), { rowHeaderWidth: Ne, columnHeaderHeight: He } = X.skeleton, gt = {
|
|
3075
3067
|
top: He,
|
|
@@ -3080,13 +3072,13 @@ let Wt = class extends le {
|
|
|
3080
3072
|
dispose: he,
|
|
3081
3073
|
rect: de,
|
|
3082
3074
|
boundsOfViewArea: gt,
|
|
3083
|
-
domAnchor:
|
|
3075
|
+
domAnchor: e,
|
|
3084
3076
|
unitId: I,
|
|
3085
3077
|
subUnitId: R
|
|
3086
|
-
},
|
|
3087
|
-
ge.position$ =
|
|
3078
|
+
}, j = fe(de, W.renderUnit, X.skeleton, B.worksheet, ge), ke = new Ze(j);
|
|
3079
|
+
ge.position$ = ke;
|
|
3088
3080
|
let ze = {
|
|
3089
|
-
position$:
|
|
3081
|
+
position$: ke,
|
|
3090
3082
|
id: O,
|
|
3091
3083
|
componentKey: K.componentKey,
|
|
3092
3084
|
onPointerDown: () => {
|
|
@@ -3095,55 +3087,54 @@ let Wt = class extends le {
|
|
|
3095
3087
|
},
|
|
3096
3088
|
onPointerUp: () => {
|
|
3097
3089
|
},
|
|
3098
|
-
onWheel: (
|
|
3099
|
-
|
|
3090
|
+
onWheel: (k) => {
|
|
3091
|
+
Ue.dispatchEvent(new WheelEvent(k.type, k));
|
|
3100
3092
|
},
|
|
3101
3093
|
props: (y = (M = Ve.get(O)) == null ? void 0 : M.props) != null ? y : this._getFloatDomProps(O),
|
|
3102
3094
|
data: q,
|
|
3103
3095
|
unitId: I
|
|
3104
3096
|
};
|
|
3105
|
-
|
|
3097
|
+
t.eventPassThrough && (ze = {
|
|
3106
3098
|
...ze,
|
|
3107
|
-
onPointerDown: (
|
|
3108
|
-
|
|
3099
|
+
onPointerDown: (k) => {
|
|
3100
|
+
Ue.dispatchEvent(new PointerEvent(k.type, k));
|
|
3109
3101
|
},
|
|
3110
|
-
onPointerMove: (
|
|
3111
|
-
|
|
3102
|
+
onPointerMove: (k) => {
|
|
3103
|
+
Ue.dispatchEvent(new PointerEvent(k.type, k));
|
|
3112
3104
|
},
|
|
3113
|
-
onPointerUp: (
|
|
3114
|
-
|
|
3105
|
+
onPointerUp: (k) => {
|
|
3106
|
+
Ue.dispatchEvent(new PointerEvent(k.type, k));
|
|
3115
3107
|
}
|
|
3116
|
-
}), this._canvasFloatDomService.addFloatDom(ze), this.disposeWithMe(m.subscribe((
|
|
3108
|
+
}), this._canvasFloatDomService.addFloatDom(ze), this.disposeWithMe(m.subscribe((k) => {
|
|
3117
3109
|
var gn, fn, mn, pn;
|
|
3118
3110
|
const hn = Mt({
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
height: (fn = t.height) != null ? fn : j.height,
|
|
3111
|
+
startX: k.startX,
|
|
3112
|
+
startY: k.startY,
|
|
3113
|
+
endX: k.endX,
|
|
3114
|
+
endY: k.endY,
|
|
3115
|
+
width: (gn = e.width) != null ? gn : k.width,
|
|
3116
|
+
height: (fn = e.height) != null ? fn : k.height,
|
|
3126
3117
|
absolute: {
|
|
3127
3118
|
left: p.absolute.left,
|
|
3128
3119
|
top: p.absolute.top
|
|
3129
3120
|
}
|
|
3130
|
-
},
|
|
3121
|
+
}, e), Mr = Ce({ unitId: I, subUnitId: R, drawingId: O }), yr = new je(Mr, {
|
|
3131
3122
|
left: hn.startX,
|
|
3132
3123
|
top: hn.startY,
|
|
3133
|
-
width: (mn =
|
|
3134
|
-
height: (pn =
|
|
3124
|
+
width: (mn = e.width) != null ? mn : k.width,
|
|
3125
|
+
height: (pn = e.height) != null ? pn : k.height,
|
|
3135
3126
|
zIndex: this._drawingManagerService.getDrawingOrder(I, R).length - 1
|
|
3136
|
-
}),
|
|
3137
|
-
|
|
3127
|
+
}), Tr = fe(yr, W.renderUnit, X.skeleton, B.worksheet, ge);
|
|
3128
|
+
ke.next(Tr);
|
|
3138
3129
|
}));
|
|
3139
3130
|
const Ke = (T = this._renderManagerService.getRenderById(I)) == null ? void 0 : T.with(V);
|
|
3140
|
-
Ke == null || Ke.currentSkeleton$.subscribe((
|
|
3141
|
-
|
|
3131
|
+
Ke == null || Ke.currentSkeleton$.subscribe((k) => {
|
|
3132
|
+
k && X.sheetId !== k.sheetId && this._removeDom(f, !0);
|
|
3142
3133
|
});
|
|
3143
3134
|
const ft = de.onTransformChange$.subscribeEvent(() => {
|
|
3144
|
-
const
|
|
3145
|
-
|
|
3146
|
-
|
|
3135
|
+
const k = fe(de, W.renderUnit, X.skeleton, B.worksheet, ge);
|
|
3136
|
+
ke.next(
|
|
3137
|
+
k
|
|
3147
3138
|
);
|
|
3148
3139
|
});
|
|
3149
3140
|
he.add(() => {
|
|
@@ -3159,11 +3150,11 @@ let Wt = class extends le {
|
|
|
3159
3150
|
}
|
|
3160
3151
|
};
|
|
3161
3152
|
}
|
|
3162
|
-
addFloatDomToColumnHeader(n,
|
|
3153
|
+
addFloatDomToColumnHeader(n, t, e, r) {
|
|
3163
3154
|
var v, b, _, E, M;
|
|
3164
3155
|
const s = H(this._univerInstanceService, {
|
|
3165
|
-
unitId:
|
|
3166
|
-
subUnitId:
|
|
3156
|
+
unitId: t.unitId,
|
|
3157
|
+
subUnitId: t.subUnitId
|
|
3167
3158
|
});
|
|
3168
3159
|
if (!s)
|
|
3169
3160
|
throw new Error("cannot find current target!");
|
|
@@ -3173,24 +3164,21 @@ let Wt = class extends le {
|
|
|
3173
3164
|
if (!u) return;
|
|
3174
3165
|
const d = (v = this._renderManagerService.getRenderById(o)) == null ? void 0 : v.with(V).getWorksheetSkeleton(a);
|
|
3175
3166
|
if (!d) return;
|
|
3176
|
-
const { componentKey: l, data: g, allowTransform: h = !0 } =
|
|
3167
|
+
const { componentKey: l, data: g, allowTransform: h = !0 } = t, f = r != null ? r : Ht(), { position: p, position$: m } = this._createRangePositionObserver({
|
|
3177
3168
|
startRow: 0,
|
|
3178
3169
|
endRow: 0,
|
|
3179
3170
|
startColumn: n,
|
|
3180
3171
|
endColumn: n
|
|
3181
3172
|
}, u, d.skeleton), w = p;
|
|
3182
|
-
w.startY = 0
|
|
3183
|
-
const S = this._getPosition(p, o);
|
|
3184
|
-
if (S == null)
|
|
3173
|
+
if (w.startY = 0, this._getPosition(p, o) == null)
|
|
3185
3174
|
return;
|
|
3186
|
-
this._ensureMap(o, a).set(f,
|
|
3175
|
+
this._ensureMap(o, a).set(f, t);
|
|
3187
3176
|
const D = {
|
|
3188
3177
|
unitId: o,
|
|
3189
3178
|
subUnitId: a,
|
|
3190
3179
|
drawingId: f,
|
|
3191
|
-
drawingType:
|
|
3180
|
+
drawingType: t.type || L.DRAWING_DOM,
|
|
3192
3181
|
componentKey: l,
|
|
3193
|
-
sheetTransform: S,
|
|
3194
3182
|
transform: {
|
|
3195
3183
|
left: w.startX,
|
|
3196
3184
|
top: w.startY,
|
|
@@ -3201,7 +3189,7 @@ let Wt = class extends le {
|
|
|
3201
3189
|
allowTransform: h
|
|
3202
3190
|
};
|
|
3203
3191
|
{
|
|
3204
|
-
const { unitId: y, subUnitId: T, drawingId: I } = D, R = H(this._univerInstanceService, { unitId: y, subUnitId: T }), O = D, B = this._univerInstanceService.getUnit(y,
|
|
3192
|
+
const { unitId: y, subUnitId: T, drawingId: I } = D, R = H(this._univerInstanceService, { unitId: y, subUnitId: T }), O = D, B = this._univerInstanceService.getUnit(y, F.UNIVER_SHEET);
|
|
3205
3193
|
if (!B)
|
|
3206
3194
|
return;
|
|
3207
3195
|
const K = B.getActiveSheet().getSheetId();
|
|
@@ -3219,30 +3207,29 @@ let Wt = class extends le {
|
|
|
3219
3207
|
const { scene: ce, canvas: q } = J;
|
|
3220
3208
|
if (me == null || K !== T)
|
|
3221
3209
|
return;
|
|
3222
|
-
const { left: W, top: Oe, width:
|
|
3210
|
+
const { left: W, top: Oe, width: Ue, height: st, angle: ot, flipX: at, flipY: ct, skewX: Xt, skewY: Vt } = me, dt = Ce({ unitId: y, subUnitId: T, drawingId: I }), lt = ce.getObject(dt);
|
|
3223
3211
|
if (lt != null) {
|
|
3224
|
-
lt.transformByState({ left: W, top: Oe, width:
|
|
3212
|
+
lt.transformByState({ left: W, top: Oe, width: Ue, height: st, angle: ot, flipX: at, flipY: ct, skewX: Xt, skewY: Vt });
|
|
3225
3213
|
return;
|
|
3226
3214
|
}
|
|
3227
|
-
const
|
|
3228
|
-
rotate: 0,
|
|
3215
|
+
const Pe = Mt({
|
|
3229
3216
|
startX: w.startX,
|
|
3230
3217
|
startY: 0,
|
|
3231
3218
|
endX: p.endX,
|
|
3232
3219
|
endY: p.endY,
|
|
3233
|
-
width:
|
|
3234
|
-
height:
|
|
3220
|
+
width: e.width,
|
|
3221
|
+
height: e.height,
|
|
3235
3222
|
absolute: {
|
|
3236
3223
|
left: p.absolute.left,
|
|
3237
3224
|
top: p.absolute.top
|
|
3238
3225
|
}
|
|
3239
|
-
},
|
|
3240
|
-
left:
|
|
3241
|
-
top:
|
|
3242
|
-
width:
|
|
3243
|
-
height:
|
|
3226
|
+
}, e), ut = {
|
|
3227
|
+
left: Pe.startX,
|
|
3228
|
+
top: Pe.startY,
|
|
3229
|
+
width: Pe.width,
|
|
3230
|
+
height: Pe.height,
|
|
3244
3231
|
zIndex: this._drawingManagerService.getDrawingOrder(y, T).length - 1
|
|
3245
|
-
}, ue = new
|
|
3232
|
+
}, ue = new je(dt, ut);
|
|
3246
3233
|
ce.addObject(ue, Kt), O.allowTransform !== !1 && ce.attachTransformerTo(ue);
|
|
3247
3234
|
const re = this._ensureMap(y, T), Ae = new _t(), de = ce.getMainViewport(), Ve = {
|
|
3248
3235
|
top: 0,
|
|
@@ -3257,7 +3244,7 @@ let Wt = class extends le {
|
|
|
3257
3244
|
unitId: y,
|
|
3258
3245
|
subUnitId: T,
|
|
3259
3246
|
boundsOfViewArea: Ve,
|
|
3260
|
-
domAnchor:
|
|
3247
|
+
domAnchor: e,
|
|
3261
3248
|
scrollDirectionResponse: "HORIZONTAL"
|
|
3262
3249
|
/* HORIZONTAL */
|
|
3263
3250
|
}, ht = fe(ue, J.renderUnit, Y.skeleton, R.worksheet, he), Ne = new Ze(ht);
|
|
@@ -3272,56 +3259,55 @@ let Wt = class extends le {
|
|
|
3272
3259
|
},
|
|
3273
3260
|
onPointerUp: () => {
|
|
3274
3261
|
},
|
|
3275
|
-
onWheel: (
|
|
3276
|
-
q.dispatchEvent(new WheelEvent(
|
|
3262
|
+
onWheel: (j) => {
|
|
3263
|
+
q.dispatchEvent(new WheelEvent(j.type, j));
|
|
3277
3264
|
},
|
|
3278
3265
|
props: (E = (_ = re.get(I)) == null ? void 0 : _.props) != null ? E : this._getFloatDomProps(I),
|
|
3279
3266
|
data: X,
|
|
3280
3267
|
unitId: y
|
|
3281
3268
|
};
|
|
3282
|
-
|
|
3269
|
+
t.eventPassThrough && (He = {
|
|
3283
3270
|
...He,
|
|
3284
|
-
onPointerDown: (
|
|
3285
|
-
q.dispatchEvent(new PointerEvent(
|
|
3271
|
+
onPointerDown: (j) => {
|
|
3272
|
+
q.dispatchEvent(new PointerEvent(j.type, j));
|
|
3286
3273
|
},
|
|
3287
|
-
onPointerMove: (
|
|
3288
|
-
q.dispatchEvent(new PointerEvent(
|
|
3274
|
+
onPointerMove: (j) => {
|
|
3275
|
+
q.dispatchEvent(new PointerEvent(j.type, j));
|
|
3289
3276
|
},
|
|
3290
|
-
onPointerUp: (
|
|
3291
|
-
q.dispatchEvent(new PointerEvent(
|
|
3277
|
+
onPointerUp: (j) => {
|
|
3278
|
+
q.dispatchEvent(new PointerEvent(j.type, j));
|
|
3292
3279
|
}
|
|
3293
3280
|
}), this._canvasFloatDomService.addFloatDom(He);
|
|
3294
3281
|
const gt = ue.onTransformChange$.subscribeEvent(() => {
|
|
3295
|
-
const
|
|
3282
|
+
const j = fe(ue, J.renderUnit, Y.skeleton, R.worksheet, he);
|
|
3296
3283
|
Ne.next(
|
|
3297
|
-
|
|
3284
|
+
j
|
|
3298
3285
|
);
|
|
3299
3286
|
});
|
|
3300
|
-
this.disposeWithMe(m.subscribe((
|
|
3301
|
-
const
|
|
3302
|
-
|
|
3303
|
-
startX: $.startX,
|
|
3287
|
+
this.disposeWithMe(m.subscribe((j) => {
|
|
3288
|
+
const ke = Mt({
|
|
3289
|
+
startX: j.startX,
|
|
3304
3290
|
startY: 0,
|
|
3305
|
-
endX:
|
|
3306
|
-
endY:
|
|
3307
|
-
width:
|
|
3308
|
-
height:
|
|
3291
|
+
endX: j.endX,
|
|
3292
|
+
endY: j.endY,
|
|
3293
|
+
width: e.width,
|
|
3294
|
+
height: e.height,
|
|
3309
3295
|
absolute: {
|
|
3310
3296
|
left: p.absolute.left,
|
|
3311
3297
|
top: p.absolute.top
|
|
3312
3298
|
}
|
|
3313
|
-
},
|
|
3314
|
-
left:
|
|
3299
|
+
}, e), ze = Ce({ unitId: y, subUnitId: T, drawingId: I }), Ke = new je(ze, {
|
|
3300
|
+
left: ke.startX,
|
|
3315
3301
|
top: 0,
|
|
3316
|
-
width:
|
|
3317
|
-
height:
|
|
3302
|
+
width: e.width,
|
|
3303
|
+
height: e.height,
|
|
3318
3304
|
zIndex: this._drawingManagerService.getDrawingOrder(y, T).length - 1
|
|
3319
3305
|
}), ft = fe(Ke, J.renderUnit, Y.skeleton, R.worksheet, he);
|
|
3320
3306
|
Ne.next(ft);
|
|
3321
3307
|
}));
|
|
3322
3308
|
const ge = (M = this._renderManagerService.getRenderById(y)) == null ? void 0 : M.with(V);
|
|
3323
|
-
ge == null || ge.currentSkeleton$.subscribe((
|
|
3324
|
-
|
|
3309
|
+
ge == null || ge.currentSkeleton$.subscribe((j) => {
|
|
3310
|
+
j && d.sheetId !== j.sheetId && this._removeDom(f, !0);
|
|
3325
3311
|
}), Ae.add(() => {
|
|
3326
3312
|
this._canvasFloatDomService.removeFloatDom(I);
|
|
3327
3313
|
}), gt && Ae.add(gt), this._domLayerInfoMap.set(I, he), re.set(I, {
|
|
@@ -3345,18 +3331,18 @@ let Wt = class extends le {
|
|
|
3345
3331
|
* @param activeViewport
|
|
3346
3332
|
* @returns position of cell to canvas.
|
|
3347
3333
|
*/
|
|
3348
|
-
_createRangePositionObserver(n,
|
|
3334
|
+
_createRangePositionObserver(n, t, e) {
|
|
3349
3335
|
let { startRow: r, startColumn: s } = n;
|
|
3350
|
-
const o = Qe(r, s,
|
|
3351
|
-
const m = Qe(r, s,
|
|
3336
|
+
const o = Qe(r, s, e), a = new Ze(o), c = Qe(n.endRow, n.endColumn, e), u = new Ze(c), d = () => {
|
|
3337
|
+
const m = Qe(r, s, e), w = Qe(n.endRow, n.endColumn, e);
|
|
3352
3338
|
a.next(m), u.next(w);
|
|
3353
3339
|
}, l = new _t();
|
|
3354
|
-
l.add(
|
|
3340
|
+
l.add(t.engine.clientRect$.subscribe(() => d())), l.add(this._commandService.onCommandExecuted((m) => {
|
|
3355
3341
|
if (m.id === Gn.id && m.params.rowsAutoHeightInfo.findIndex((S) => S.row === r) > -1) {
|
|
3356
3342
|
d();
|
|
3357
3343
|
return;
|
|
3358
3344
|
}
|
|
3359
|
-
(
|
|
3345
|
+
(es.indexOf(m.id) > -1 || m.id === Di.id || m.id === Dn.id) && d();
|
|
3360
3346
|
}));
|
|
3361
3347
|
const g = (m, w) => {
|
|
3362
3348
|
r = m, s = w, d();
|
|
@@ -3374,7 +3360,7 @@ let Wt = class extends le {
|
|
|
3374
3360
|
endY: c.bottom
|
|
3375
3361
|
}), f = a.pipe(
|
|
3376
3362
|
Ee((m) => {
|
|
3377
|
-
const w = Qe(n.endRow, n.endColumn,
|
|
3363
|
+
const w = Qe(n.endRow, n.endColumn, e);
|
|
3378
3364
|
return {
|
|
3379
3365
|
rotate: 0,
|
|
3380
3366
|
width: w.right - m.left,
|
|
@@ -3400,17 +3386,17 @@ let Wt = class extends le {
|
|
|
3400
3386
|
};
|
|
3401
3387
|
}
|
|
3402
3388
|
};
|
|
3403
|
-
Wt =
|
|
3389
|
+
Wt = ho([
|
|
3404
3390
|
Me(0, N(ne)),
|
|
3405
3391
|
Me(1, Ge),
|
|
3406
3392
|
Me(2, N(G)),
|
|
3407
3393
|
Me(3, oe),
|
|
3408
|
-
Me(4, N(
|
|
3394
|
+
Me(4, N(Wi)),
|
|
3409
3395
|
Me(5, ae),
|
|
3410
|
-
Me(6, N(
|
|
3396
|
+
Me(6, N(Kr))
|
|
3411
3397
|
], Wt);
|
|
3412
|
-
function Qe(i, n,
|
|
3413
|
-
const
|
|
3398
|
+
function Qe(i, n, t) {
|
|
3399
|
+
const e = t.getCellWithCoordByIndex(i, n), r = e.isMergedMainCell ? e.mergeInfo : e;
|
|
3414
3400
|
return {
|
|
3415
3401
|
left: r.startX,
|
|
3416
3402
|
right: r.endX,
|
|
@@ -3418,19 +3404,19 @@ function Qe(i, n, e) {
|
|
|
3418
3404
|
bottom: r.endY
|
|
3419
3405
|
};
|
|
3420
3406
|
}
|
|
3421
|
-
function Mt(i, n,
|
|
3407
|
+
function Mt(i, n, t) {
|
|
3422
3408
|
var u, d;
|
|
3423
|
-
|
|
3424
|
-
const
|
|
3409
|
+
t = t != null ? t : 1;
|
|
3410
|
+
const e = i.endX - i.startX, r = i.endY - i.startY, s = (u = n == null ? void 0 : n.width) != null ? u : e, o = (d = n == null ? void 0 : n.height) != null ? d : r;
|
|
3425
3411
|
let a = 0, c = 0;
|
|
3426
3412
|
if (n) {
|
|
3427
3413
|
if (n.horizonOffsetAlign === "right") {
|
|
3428
|
-
const l = yt(n.marginX,
|
|
3414
|
+
const l = yt(n.marginX, e * t);
|
|
3429
3415
|
a = i.endX - l - s;
|
|
3430
3416
|
} else
|
|
3431
|
-
a = i.startX + yt(n.marginX,
|
|
3417
|
+
a = i.startX + yt(n.marginX, e);
|
|
3432
3418
|
if (n.verticalOffsetAlign === "bottom") {
|
|
3433
|
-
const l = yt(n.marginY, r *
|
|
3419
|
+
const l = yt(n.marginY, r * t);
|
|
3434
3420
|
c = i.endY - l - o;
|
|
3435
3421
|
} else
|
|
3436
3422
|
c = i.startY + yt(n.marginY, r);
|
|
@@ -3452,36 +3438,36 @@ function Mt(i, n, e) {
|
|
|
3452
3438
|
function yt(i, n) {
|
|
3453
3439
|
if (i === void 0) return 0;
|
|
3454
3440
|
if (typeof i == "number") return i;
|
|
3455
|
-
const
|
|
3456
|
-
return n *
|
|
3441
|
+
const t = Number.parseFloat(i);
|
|
3442
|
+
return n * t / 100;
|
|
3457
3443
|
}
|
|
3458
|
-
var
|
|
3459
|
-
for (var r =
|
|
3460
|
-
(o = i[s]) && (r =
|
|
3461
|
-
return
|
|
3462
|
-
}, qt = (i, n) => (
|
|
3463
|
-
const
|
|
3464
|
-
let
|
|
3465
|
-
constructor(i =
|
|
3466
|
-
super(), this._config = i, this._injector = n, this._renderManagerService =
|
|
3444
|
+
var fo = Object.defineProperty, mo = Object.getOwnPropertyDescriptor, po = (i, n, t) => n in i ? fo(i, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[n] = t, wo = (i, n, t, e) => {
|
|
3445
|
+
for (var r = e > 1 ? void 0 : e ? mo(n, t) : n, s = i.length - 1, o; s >= 0; s--)
|
|
3446
|
+
(o = i[s]) && (r = o(r) || r);
|
|
3447
|
+
return r;
|
|
3448
|
+
}, qt = (i, n) => (t, e) => n(t, e, i), Dr = (i, n, t) => po(i, typeof n != "symbol" ? n + "" : n, t);
|
|
3449
|
+
const _o = "SHEET_IMAGE_UI_PLUGIN";
|
|
3450
|
+
let jt = class extends ei {
|
|
3451
|
+
constructor(i = Pn, n, t, e) {
|
|
3452
|
+
super(), this._config = i, this._injector = n, this._renderManagerService = t, this._configService = e;
|
|
3467
3453
|
const { menu: r, ...s } = ti(
|
|
3468
3454
|
{},
|
|
3469
|
-
|
|
3455
|
+
Pn,
|
|
3470
3456
|
this._config
|
|
3471
3457
|
);
|
|
3472
|
-
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(
|
|
3458
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(os, s);
|
|
3473
3459
|
}
|
|
3474
3460
|
onStarting() {
|
|
3475
3461
|
ni(this._injector, [
|
|
3476
3462
|
[Wt],
|
|
3477
3463
|
[Bt],
|
|
3478
3464
|
[Et],
|
|
3479
|
-
[
|
|
3465
|
+
[kt],
|
|
3480
3466
|
[Nt],
|
|
3481
3467
|
[At],
|
|
3482
3468
|
[Ot],
|
|
3483
|
-
[
|
|
3484
|
-
[
|
|
3469
|
+
[Pt],
|
|
3470
|
+
[Ut]
|
|
3485
3471
|
]), zt(this._injector, [
|
|
3486
3472
|
[Wt]
|
|
3487
3473
|
]);
|
|
@@ -3494,11 +3480,11 @@ let $t = class extends ei {
|
|
|
3494
3480
|
onRendered() {
|
|
3495
3481
|
this._registerRenderModules(), zt(this._injector, [
|
|
3496
3482
|
[Nt],
|
|
3497
|
-
[
|
|
3483
|
+
[kt],
|
|
3498
3484
|
[Bt],
|
|
3499
3485
|
[Ot],
|
|
3500
|
-
[
|
|
3501
|
-
[
|
|
3486
|
+
[Pt],
|
|
3487
|
+
[Ut]
|
|
3502
3488
|
]);
|
|
3503
3489
|
}
|
|
3504
3490
|
onSteady() {
|
|
@@ -3510,25 +3496,25 @@ let $t = class extends ei {
|
|
|
3510
3496
|
[an],
|
|
3511
3497
|
[sn]
|
|
3512
3498
|
].forEach((i) => {
|
|
3513
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
3499
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(F.UNIVER_SHEET, i));
|
|
3514
3500
|
});
|
|
3515
3501
|
}
|
|
3516
3502
|
};
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3503
|
+
Dr(jt, "type", F.UNIVER_SHEET);
|
|
3504
|
+
Dr(jt, "pluginName", _o);
|
|
3505
|
+
jt = wo([
|
|
3506
|
+
qr(oi, ii, hi, mi),
|
|
3521
3507
|
qt(1, N(tt)),
|
|
3522
3508
|
qt(2, ne),
|
|
3523
|
-
qt(3,
|
|
3524
|
-
],
|
|
3509
|
+
qt(3, Qr)
|
|
3510
|
+
], jt);
|
|
3525
3511
|
export {
|
|
3526
|
-
|
|
3512
|
+
x as ClearSheetDrawingTransformerOperation,
|
|
3527
3513
|
Ir as DeleteDrawingsCommand,
|
|
3528
3514
|
hr as EditSheetDrawingOperation,
|
|
3529
3515
|
gr as GroupSheetDrawingCommand,
|
|
3530
3516
|
Gt as InsertFloatImageCommand,
|
|
3531
|
-
|
|
3517
|
+
Ft as InsertSheetDrawingCommand,
|
|
3532
3518
|
rt as MoveDrawingsCommand,
|
|
3533
3519
|
nt as RemoveSheetDrawingCommand,
|
|
3534
3520
|
br as SHEETS_IMAGE_MENU_ID,
|
|
@@ -3537,5 +3523,5 @@ export {
|
|
|
3537
3523
|
Wt as SheetCanvasFloatDomManagerService,
|
|
3538
3524
|
ur as SidebarSheetDrawingOperation,
|
|
3539
3525
|
mr as UngroupSheetDrawingCommand,
|
|
3540
|
-
|
|
3526
|
+
jt as UniverSheetsDrawingUIPlugin
|
|
3541
3527
|
};
|