@univerjs/sheets-drawing-ui 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +2 -2
- package/lib/es/facade.js +558 -297
- package/lib/es/index.js +350 -341
- package/lib/facade.js +558 -297
- package/lib/index.js +350 -341
- package/lib/types/facade/f-event.d.ts +169 -1
- package/lib/types/facade/f-worksheet.d.ts +151 -9
- package/lib/types/index.d.ts +2 -1
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +13 -13
package/lib/index.js
CHANGED
|
@@ -1,25 +1,77 @@
|
|
|
1
1
|
var yr = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var ee = (i, t, e) =>
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
2
|
+
var Tr = (i, t, e) => t in i ? yr(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var ee = (i, t, e) => Tr(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { precisionTo as mt, IRenderManagerService as J, transformObjectOutOfGroup as Er, getGroupState as Or, getCurrentTypeOfRenderer as sn, CURSOR_TYPE as Ur, RENDER_CLASS_TYPE as Ue, Rect as Pe, ObjectType as mn, DRAWING_OBJECT_LAYER_INDEX as Ft, SHEET_VIEWPORT_KEY as xn } from "@univerjs/engine-render";
|
|
5
|
+
import { convertPositionSheetOverGridToAbsolute as Pr, SheetSkeletonManagerService as V, ISheetSelectionRenderService as xe, attachRangeWithCoord as Yn, SheetCanvasPopManagerService as Ar, HoverManagerService as Nr, IEditorBridgeService as kr, IAutoFillService as Wr, EditingRenderController as Br, SetCellEditVisibleOperation as pn, PREDEFINED_HOOK_NAME as Be, COPY_TYPE as ve, discreteRangeToRange as wn, virtualizeDiscreteRanges as jr, ISheetClipboardService as $r, SetZoomRatioOperation as _n, SetScrollOperation as Fr, SheetPrintInterceptorService as xr, getCurrentRangeDisable$ as Yr } from "@univerjs/sheets-ui";
|
|
6
|
+
import { CommandType as Z, ICommandService as G, IUndoRedoService as Ye, sequenceExecute as Xn, DrawingTypeEnum as B, ArrangeTypeEnum as pt, Inject as A, IContextService as Gn, LocaleService as tt, Injector as Xe, Disposable as ne, createDocumentModelWithStyle as Vt, ObjectRelativeFromV as Sn, ObjectRelativeFromH as vn, WrapTextType as In, PositionedObjectLayoutType as Cn, BooleanNumber as Dn, BuildTextUtils as Ht, ImageSourceType as Rn, generateRandomId as Dt, FOCUSING_COMMON_DRAWINGS as $e, IUniverInstanceService as Se, UniverInstanceType as F, Direction as _e, IImageIoService as Xr, RxDisposable as Gr, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ze, DOCS_ZEN_EDITOR_UNIT_ID_KEY as je, InterceptorEffectEnum as Lr, ObjectMatrix as Vr, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Hr, Tools as Re, IPermissionService as zr, UserManagerService as Kr, LifecycleService as Jr, LifecycleStages as Zr, DisposableCollection as wt, fromEventSubject as qr, PRINT_CHART_COMPONENT_KEY as Qr, Rectangle as ei, FOCUSING_FX_BAR_EDITOR as ti, EDITOR_ACTIVATED as ni, FOCUSING_PANEL_EDITOR as ri, DependentOn as ii, IConfigService as si, Plugin as oi, merge as ai, registerDependencies as ci, touchDependencies as xt } from "@univerjs/core";
|
|
7
|
+
import { ISheetDrawingService as re, DrawingApplyType as U, SetDrawingApplyMutation as P, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as di } from "@univerjs/sheets-drawing";
|
|
8
|
+
import { SheetInterceptorService as At, SheetsSelectionsService as on, SetRangeValuesCommand as bn, getSheetCommandTarget as se, INTERCEPTOR_POINT as li, InterceptCellContentPriority as ui, WorkbookViewPermission as Mn, WorksheetViewPermission as yn, WorkbookEditablePermission as zt, WorksheetEditPermission as Kt, SetFrozenMutation as hi, SetWorksheetRowAutoHeightMutation as gi, COMMAND_LISTENER_SKELETON_CHANGE as fi, InsertRowCommand as Ln, InsertColCommand as Vn, RemoveRowCommand as Hn, RemoveColCommand as zn, DeleteRangeMoveLeftCommand as Kn, DeleteRangeMoveUpCommand as Jn, InsertRangeMoveDownCommand as Zn, InsertRangeMoveRightCommand as qn, DeltaRowHeightCommand as Jt, SetRowHeightCommand as Zt, 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 mi, SetRowHiddenMutation as pi, SetColVisibleMutation as wi, SetColHiddenMutation as _i, SetWorksheetRowHeightMutation as Si, SetWorksheetColWidthMutation as vi, SetWorksheetActiveOperation as Ii, RangeProtectionPermissionEditPoint as Ci } from "@univerjs/sheets";
|
|
9
|
+
import { MessageType as pe, render as Di, unmount as Ri, clsx as bi, RadioGroup as Mi, Radio as Yt } from "@univerjs/design";
|
|
10
|
+
import { docDrawingPositionToTransform as Tn, ReplaceSnapshotCommand as yi, InnerPasteCommand as Ti } from "@univerjs/docs-ui";
|
|
11
|
+
import { IImageIoService as Ei, IDrawingManagerService as ie, DRAWING_IMAGE_ALLOW_IMAGE_LIST as En, DRAWING_IMAGE_COUNT_LIMIT as On, ImageUploadStatusType as Ae, DRAWING_IMAGE_ALLOW_SIZE as Un, getImageSize as Xt, SetDrawingSelectedOperation as Nt, DRAWING_IMAGE_WIDTH_LIMIT as Pn, DRAWING_IMAGE_HEIGHT_LIMIT as An, ImageSourceType as Oi, getDrawingShapeKeyByDrawingSearch as Ie, UniverDrawingPlugin as Ui } from "@univerjs/drawing";
|
|
12
12
|
import { ILocalFileService as Pi, IMessageService as cr, ISidebarService as Ai, IDialogService as Ni, IClipboardInterfaceService as ki, CanvasFloatDomService as Wi, PrintFloatDomSingle as Bi, ComponentManager as dr, connectInjector as ji, useDependency as qe, getMenuHiddenObservable as an, MenuItemType as cn, RibbonInsertGroup as $i, KeyCode as Fe, IMenuManagerService as Fi, IShortcutService as xi } from "@univerjs/ui";
|
|
13
13
|
import { DocDrawingController as Yi, UniverDocsDrawingPlugin as Xi } from "@univerjs/docs-drawing";
|
|
14
14
|
import { ImageCropperObject as Gi, COMPONENT_IMAGE_POPUP_MENU as Li, OpenImageCropOperation as Vi, ImageResetSizeOperation as Hi, DrawingRenderService as lr, DrawingCommonPanel as zi, UniverDrawingUIPlugin as Ki } from "@univerjs/drawing-ui";
|
|
15
15
|
import { takeUntil as Nn, throttleTime as Ji, combineLatest as _t, switchMap as we, EMPTY as fe, tap as kn, map as be, distinctUntilChanged as Wn, Subject as Gt, filter as Zi, take as qi, BehaviorSubject as We, of as Bn } from "rxjs";
|
|
16
16
|
import { jsx as oe, jsxs as qt } from "react/jsx-runtime";
|
|
17
17
|
import { useMemo as Qi, useState as Qt, useEffect as ur } from "react";
|
|
18
|
+
function z(i, t, e) {
|
|
19
|
+
const { from: n, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY: u = 0 } = i, c = e.getCurrent();
|
|
20
|
+
if (c == null)
|
|
21
|
+
return;
|
|
22
|
+
const l = Pr(
|
|
23
|
+
c.unitId,
|
|
24
|
+
c.sheetId,
|
|
25
|
+
{ from: n, to: r },
|
|
26
|
+
e
|
|
27
|
+
);
|
|
28
|
+
let { left: g, top: h, width: f, height: p } = l;
|
|
29
|
+
const m = e.getCurrentSkeleton(), _ = m.rowHeaderWidth + m.columnTotalWidth, v = m.columnHeaderHeight + m.rowTotalHeight;
|
|
30
|
+
return g + f > _ && (g = _ - f), h + p > v && (h = v - p), {
|
|
31
|
+
flipY: s,
|
|
32
|
+
flipX: o,
|
|
33
|
+
angle: a,
|
|
34
|
+
skewX: d,
|
|
35
|
+
skewY: u,
|
|
36
|
+
left: g,
|
|
37
|
+
top: h,
|
|
38
|
+
width: f,
|
|
39
|
+
height: p
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function $(i, t) {
|
|
43
|
+
const { left: e = 0, top: n = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: d = 0, skewX: u = 0, skewY: c = 0 } = i, l = t.getCellWithCoordByOffset(e, n);
|
|
44
|
+
if (l == null)
|
|
45
|
+
return;
|
|
46
|
+
const g = {
|
|
47
|
+
column: l.actualColumn,
|
|
48
|
+
columnOffset: mt(e - l.startX, 1),
|
|
49
|
+
row: l.actualRow,
|
|
50
|
+
rowOffset: mt(n - l.startY, 1)
|
|
51
|
+
}, h = t.getCellWithCoordByOffset(e + r, n + s);
|
|
52
|
+
if (h == null)
|
|
53
|
+
return;
|
|
54
|
+
const f = {
|
|
55
|
+
column: h.actualColumn,
|
|
56
|
+
columnOffset: mt(e + r - h.startX, 1),
|
|
57
|
+
row: h.actualRow,
|
|
58
|
+
rowOffset: mt(n + s - h.startY, 1)
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
flipY: o,
|
|
62
|
+
flipX: a,
|
|
63
|
+
angle: d,
|
|
64
|
+
skewX: u,
|
|
65
|
+
skewY: c,
|
|
66
|
+
from: g,
|
|
67
|
+
to: f
|
|
68
|
+
};
|
|
69
|
+
}
|
|
18
70
|
const Y = {
|
|
19
71
|
id: "sheet.operation.clear-drawing-transformer",
|
|
20
|
-
type:
|
|
72
|
+
type: Z.MUTATION,
|
|
21
73
|
handler: (i, t) => {
|
|
22
|
-
const e = i.get(
|
|
74
|
+
const e = i.get(J);
|
|
23
75
|
return t.forEach((n) => {
|
|
24
76
|
var r, s;
|
|
25
77
|
(s = (r = e.getRenderById(n)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
|
|
@@ -27,10 +79,10 @@ const Y = {
|
|
|
27
79
|
}
|
|
28
80
|
}, nt = {
|
|
29
81
|
id: "sheet.command.remove-sheet-image",
|
|
30
|
-
type:
|
|
82
|
+
type: Z.COMMAND,
|
|
31
83
|
handler: (i, t) => {
|
|
32
84
|
var v, I, R;
|
|
33
|
-
const e = i.get(G), n = i.get(
|
|
85
|
+
const e = i.get(G), n = i.get(Ye), r = i.get(At), s = i.get(re);
|
|
34
86
|
if (!t) return !1;
|
|
35
87
|
const { drawings: o } = t, a = [];
|
|
36
88
|
o.forEach((S) => {
|
|
@@ -38,7 +90,7 @@ const Y = {
|
|
|
38
90
|
a.push(C);
|
|
39
91
|
});
|
|
40
92
|
const d = s.getBatchRemoveOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, f = r.onCommandExecute({ id: nt.id, params: t }), p = { id: P.id, params: { unitId: u, subUnitId: c, op: g, objects: h, type: U.REMOVE } }, m = { id: P.id, params: { unitId: u, subUnitId: c, op: l, objects: h, type: U.INSERT } };
|
|
41
|
-
return
|
|
93
|
+
return Xn([...(v = f.preRedos) != null ? v : [], p, ...f.redos], e) ? (n.pushUndoRedo({
|
|
42
94
|
unitID: u,
|
|
43
95
|
undoMutations: [
|
|
44
96
|
...(I = f.preUndos) != null ? I : [],
|
|
@@ -56,7 +108,7 @@ const Y = {
|
|
|
56
108
|
}
|
|
57
109
|
}, hr = {
|
|
58
110
|
id: "sheet.command.delete-drawing",
|
|
59
|
-
type:
|
|
111
|
+
type: Z.COMMAND,
|
|
60
112
|
handler: (i) => {
|
|
61
113
|
const t = i.get(G), n = i.get(re).getFocusDrawings();
|
|
62
114
|
if (n.length === 0)
|
|
@@ -79,7 +131,7 @@ const Y = {
|
|
|
79
131
|
function es(i) {
|
|
80
132
|
const t = [];
|
|
81
133
|
return i.forEach((e) => {
|
|
82
|
-
const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, d =
|
|
134
|
+
const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, d = Or(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
|
|
83
135
|
const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: p } = l;
|
|
84
136
|
return {
|
|
85
137
|
unitId: h,
|
|
@@ -112,7 +164,7 @@ function ts(i) {
|
|
|
112
164
|
if (d == null)
|
|
113
165
|
return;
|
|
114
166
|
const u = r.map((l) => {
|
|
115
|
-
const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: p } = l, m =
|
|
167
|
+
const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: p } = l, m = Er(g || {}, d, d.width || 0, d.height || 0);
|
|
116
168
|
return {
|
|
117
169
|
unitId: h,
|
|
118
170
|
subUnitId: f,
|
|
@@ -138,9 +190,9 @@ function ts(i) {
|
|
|
138
190
|
}
|
|
139
191
|
const gr = {
|
|
140
192
|
id: "sheet.command.group-sheet-image",
|
|
141
|
-
type:
|
|
193
|
+
type: Z.COMMAND,
|
|
142
194
|
handler: (i, t) => {
|
|
143
|
-
const e = i.get(G), n = i.get(
|
|
195
|
+
const e = i.get(G), n = i.get(Ye), r = i.get(re);
|
|
144
196
|
if (!t) return !1;
|
|
145
197
|
const s = [];
|
|
146
198
|
t.forEach(({ parent: h, children: f }) => {
|
|
@@ -161,68 +213,15 @@ const gr = {
|
|
|
161
213
|
]
|
|
162
214
|
}), !0) : !1;
|
|
163
215
|
}
|
|
164
|
-
}
|
|
165
|
-
function z(i, t, e) {
|
|
166
|
-
const { from: n, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY: u = 0 } = i, c = e.getCurrent();
|
|
167
|
-
if (c == null)
|
|
168
|
-
return;
|
|
169
|
-
const l = Ii(
|
|
170
|
-
c.unitId,
|
|
171
|
-
c.sheetId,
|
|
172
|
-
{ from: n, to: r },
|
|
173
|
-
e
|
|
174
|
-
);
|
|
175
|
-
let { left: g, top: h, width: f, height: p } = l;
|
|
176
|
-
const m = e.getCurrentSkeleton(), _ = m.rowHeaderWidth + m.columnTotalWidth, v = m.columnHeaderHeight + m.rowTotalHeight;
|
|
177
|
-
return g + f > _ && (g = _ - f), h + p > v && (h = v - p), {
|
|
178
|
-
flipY: s,
|
|
179
|
-
flipX: o,
|
|
180
|
-
angle: a,
|
|
181
|
-
skewX: d,
|
|
182
|
-
skewY: u,
|
|
183
|
-
left: g,
|
|
184
|
-
top: h,
|
|
185
|
-
width: f,
|
|
186
|
-
height: p
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
function $(i, t) {
|
|
190
|
-
const { left: e = 0, top: n = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: d = 0, skewX: u = 0, skewY: c = 0 } = i, l = t.getCellWithCoordByOffset(e, n);
|
|
191
|
-
if (l == null)
|
|
192
|
-
return;
|
|
193
|
-
const g = {
|
|
194
|
-
column: l.actualColumn,
|
|
195
|
-
columnOffset: wt(e - l.startX, 1),
|
|
196
|
-
row: l.actualRow,
|
|
197
|
-
rowOffset: wt(n - l.startY, 1)
|
|
198
|
-
}, h = t.getCellWithCoordByOffset(e + r, n + s);
|
|
199
|
-
if (h == null)
|
|
200
|
-
return;
|
|
201
|
-
const f = {
|
|
202
|
-
column: h.actualColumn,
|
|
203
|
-
columnOffset: wt(e + r - h.startX, 1),
|
|
204
|
-
row: h.actualRow,
|
|
205
|
-
rowOffset: wt(n + s - h.startY, 1)
|
|
206
|
-
};
|
|
207
|
-
return {
|
|
208
|
-
flipY: o,
|
|
209
|
-
flipX: a,
|
|
210
|
-
angle: d,
|
|
211
|
-
skewX: u,
|
|
212
|
-
skewY: c,
|
|
213
|
-
from: g,
|
|
214
|
-
to: f
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
const kt = {
|
|
216
|
+
}, kt = {
|
|
218
217
|
id: "sheet.command.insert-sheet-image",
|
|
219
|
-
type:
|
|
218
|
+
type: Z.COMMAND,
|
|
220
219
|
handler: (i, t) => {
|
|
221
220
|
var v, I, R;
|
|
222
|
-
const e = i.get(G), n = i.get(
|
|
221
|
+
const e = i.get(G), n = i.get(Ye), r = i.get(re), s = i.get(At);
|
|
223
222
|
if (!t) return !1;
|
|
224
223
|
const o = t.drawings, a = o.map((S) => S.unitId), d = r.getBatchAddOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, f = s.onCommandExecute({ id: kt.id, params: t }), p = { id: P.id, params: { op: g, unitId: u, subUnitId: c, objects: h, type: U.INSERT } }, m = { id: P.id, params: { op: l, unitId: u, subUnitId: c, objects: h, type: U.REMOVE } };
|
|
225
|
-
return
|
|
224
|
+
return Xn([...(v = f.preRedos) != null ? v : [], p, ...f.redos], e) ? (n.pushUndoRedo({
|
|
226
225
|
unitID: u,
|
|
227
226
|
undoMutations: [
|
|
228
227
|
...(I = f.preUndos) != null ? I : [],
|
|
@@ -240,13 +239,13 @@ const kt = {
|
|
|
240
239
|
}
|
|
241
240
|
}, fr = {
|
|
242
241
|
id: "sheet.command.set-drawing-arrange",
|
|
243
|
-
type:
|
|
242
|
+
type: Z.COMMAND,
|
|
244
243
|
handler: (i, t) => {
|
|
245
|
-
const e = i.get(G), n = i.get(
|
|
244
|
+
const e = i.get(G), n = i.get(Ye);
|
|
246
245
|
if (!t) return !1;
|
|
247
246
|
const r = i.get(re), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: d } = t, u = { unitId: s, subUnitId: o, drawingIds: a };
|
|
248
247
|
let c;
|
|
249
|
-
if (d ===
|
|
248
|
+
if (d === pt.forward ? c = r.getForwardDrawingsOp(u) : d === pt.backward ? c = r.getBackwardDrawingOp(u) : d === pt.front ? c = r.getFrontDrawingsOp(u) : d === pt.back && (c = r.getBackDrawingsOp(u)), c == null)
|
|
250
249
|
return !1;
|
|
251
250
|
const { objects: l, redo: g, undo: h } = c;
|
|
252
251
|
return e.syncExecuteCommand(P.id, { op: g, unitId: s, subUnitId: o, objects: l, type: U.ARRANGE }) ? (n.pushUndoRedo({
|
|
@@ -261,9 +260,9 @@ const kt = {
|
|
|
261
260
|
}
|
|
262
261
|
}, Wt = {
|
|
263
262
|
id: "sheet.command.set-sheet-image",
|
|
264
|
-
type:
|
|
263
|
+
type: Z.COMMAND,
|
|
265
264
|
handler: (i, t) => {
|
|
266
|
-
const e = i.get(G), n = i.get(
|
|
265
|
+
const e = i.get(G), n = i.get(Ye), r = i.get(re);
|
|
267
266
|
if (!t) return !1;
|
|
268
267
|
const { drawings: s } = t, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
|
|
269
268
|
return e.syncExecuteCommand(P.id, { unitId: a, subUnitId: d, op: c, objects: l, type: U.UPDATE }) ? (n.pushUndoRedo({
|
|
@@ -280,9 +279,9 @@ const kt = {
|
|
|
280
279
|
}
|
|
281
280
|
}, mr = {
|
|
282
281
|
id: "sheet.command.ungroup-sheet-image",
|
|
283
|
-
type:
|
|
282
|
+
type: Z.COMMAND,
|
|
284
283
|
handler: (i, t) => {
|
|
285
|
-
const e = i.get(G), n = i.get(
|
|
284
|
+
const e = i.get(G), n = i.get(Ye), r = i.get(re);
|
|
286
285
|
if (!t) return !1;
|
|
287
286
|
const s = [];
|
|
288
287
|
t.forEach(({ parent: h, children: f }) => {
|
|
@@ -315,7 +314,7 @@ function is(i, t, e) {
|
|
|
315
314
|
}
|
|
316
315
|
function en(i, t, e, n, r) {
|
|
317
316
|
var v;
|
|
318
|
-
const { rotatedHeight: s, rotatedWidth: o } = is(e, n, r), d = i.get(
|
|
317
|
+
const { rotatedHeight: s, rotatedWidth: o } = is(e, n, r), d = i.get(J).getRenderById(t.unitId);
|
|
319
318
|
if (!d)
|
|
320
319
|
return !1;
|
|
321
320
|
const c = (v = d.with(V).getSkeletonParam(t.subUnitId)) == null ? void 0 : v.skeleton;
|
|
@@ -336,17 +335,17 @@ let Qe = class extends ne {
|
|
|
336
335
|
async insertFloatImage() {
|
|
337
336
|
const t = await this._fileOpenerService.openFile({
|
|
338
337
|
multiple: !0,
|
|
339
|
-
accept:
|
|
338
|
+
accept: En.map((n) => `.${n.replace("image/", "")}`).join(",")
|
|
340
339
|
}), e = t.length;
|
|
341
|
-
return e >
|
|
340
|
+
return e > On ? (this._messageService.show({
|
|
342
341
|
type: pe.Error,
|
|
343
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(
|
|
342
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(On))
|
|
344
343
|
}), !1) : e === 0 ? !1 : (t.forEach(async (n) => await this.insertFloatImageByFile(n)), !0);
|
|
345
344
|
}
|
|
346
345
|
async insertCellImage() {
|
|
347
346
|
const e = (await this._fileOpenerService.openFile({
|
|
348
347
|
multiple: !1,
|
|
349
|
-
accept:
|
|
348
|
+
accept: En.map((n) => `.${n.replace("image/", "")}`).join(",")
|
|
350
349
|
}))[0];
|
|
351
350
|
return e ? (await this._insertCellImage(e), !0) : !1;
|
|
352
351
|
}
|
|
@@ -361,7 +360,7 @@ let Qe = class extends ne {
|
|
|
361
360
|
const I = v.message;
|
|
362
361
|
I === Ae.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
363
362
|
type: pe.Error,
|
|
364
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
363
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(Un / (1024 * 1024)))
|
|
365
364
|
}) : I === Ae.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
366
365
|
type: pe.Error,
|
|
367
366
|
content: this._localeService.t("update-status.invalidImageType")
|
|
@@ -375,8 +374,8 @@ let Qe = class extends ne {
|
|
|
375
374
|
const n = this._getUnitInfo(), { unitId: r, subUnitId: s } = n, { imageId: o, imageSourceType: a, source: d, base64Cache: u } = e, { width: c, height: l, image: g } = await Xt(u || ""), { width: h, height: f } = this._context.scene;
|
|
376
375
|
this._imageIoService.addImageSourceCache(d, a, g);
|
|
377
376
|
let p = 1;
|
|
378
|
-
if (c >
|
|
379
|
-
const v =
|
|
377
|
+
if (c > Pn || l > An) {
|
|
378
|
+
const v = Pn / c, I = An / l;
|
|
380
379
|
p = Math.max(v, I);
|
|
381
380
|
}
|
|
382
381
|
const m = this._getImagePosition(c * p, l * p, h, f);
|
|
@@ -407,7 +406,7 @@ let Qe = class extends ne {
|
|
|
407
406
|
const C = S.message;
|
|
408
407
|
C === Ae.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
409
408
|
type: pe.Error,
|
|
410
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
409
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(Un / (1024 * 1024)))
|
|
411
410
|
}) : C === Ae.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
412
411
|
type: pe.Error,
|
|
413
412
|
content: this._localeService.t("update-status.invalidImageType")
|
|
@@ -445,11 +444,11 @@ let Qe = class extends ne {
|
|
|
445
444
|
height: p.height
|
|
446
445
|
},
|
|
447
446
|
positionH: {
|
|
448
|
-
relativeFrom:
|
|
447
|
+
relativeFrom: vn.PAGE,
|
|
449
448
|
posOffset: 0
|
|
450
449
|
},
|
|
451
450
|
positionV: {
|
|
452
|
-
relativeFrom:
|
|
451
|
+
relativeFrom: Sn.PARAGRAPH,
|
|
453
452
|
posOffset: 0
|
|
454
453
|
},
|
|
455
454
|
angle: 0
|
|
@@ -460,14 +459,14 @@ let Qe = class extends ne {
|
|
|
460
459
|
drawingType: B.DRAWING_IMAGE,
|
|
461
460
|
imageSourceType: s,
|
|
462
461
|
source: o,
|
|
463
|
-
transform:
|
|
462
|
+
transform: Tn(m),
|
|
464
463
|
docTransform: m,
|
|
465
|
-
behindDoc:
|
|
464
|
+
behindDoc: Dn.FALSE,
|
|
466
465
|
title: "",
|
|
467
466
|
description: "",
|
|
468
|
-
layoutType:
|
|
467
|
+
layoutType: Cn.INLINE,
|
|
469
468
|
// Insert inline drawing by default.
|
|
470
|
-
wrapText:
|
|
469
|
+
wrapText: In.BOTH_SIDES,
|
|
471
470
|
distB: 0,
|
|
472
471
|
distL: 0,
|
|
473
472
|
distR: 0,
|
|
@@ -481,7 +480,7 @@ let Qe = class extends ne {
|
|
|
481
480
|
endOffset: 0
|
|
482
481
|
}
|
|
483
482
|
});
|
|
484
|
-
return v ? (f.apply(v), this._commandService.syncExecuteCommand(
|
|
483
|
+
return v ? (f.apply(v), this._commandService.syncExecuteCommand(bn.id, {
|
|
485
484
|
value: {
|
|
486
485
|
[(I = e == null ? void 0 : e.row) != null ? I : g]: {
|
|
487
486
|
[(R = e == null ? void 0 : e.col) != null ? R : h]: {
|
|
@@ -498,7 +497,7 @@ let Qe = class extends ne {
|
|
|
498
497
|
async insertCellImageByUrl(t, e) {
|
|
499
498
|
var g, h;
|
|
500
499
|
const { width: n, height: r, image: s } = await Xt(t || "");
|
|
501
|
-
this._imageIoService.addImageSourceCache(t,
|
|
500
|
+
this._imageIoService.addImageSourceCache(t, Rn.URL, s);
|
|
502
501
|
const o = this._workbookSelections.getCurrentLastSelection();
|
|
503
502
|
if (!o)
|
|
504
503
|
return !1;
|
|
@@ -522,11 +521,11 @@ let Qe = class extends ne {
|
|
|
522
521
|
height: d.height
|
|
523
522
|
},
|
|
524
523
|
positionH: {
|
|
525
|
-
relativeFrom:
|
|
524
|
+
relativeFrom: vn.PAGE,
|
|
526
525
|
posOffset: 0
|
|
527
526
|
},
|
|
528
527
|
positionV: {
|
|
529
|
-
relativeFrom:
|
|
528
|
+
relativeFrom: Sn.PARAGRAPH,
|
|
530
529
|
posOffset: 0
|
|
531
530
|
},
|
|
532
531
|
angle: 0
|
|
@@ -535,16 +534,16 @@ let Qe = class extends ne {
|
|
|
535
534
|
subUnitId: a.getUnitId(),
|
|
536
535
|
drawingId: Dt(),
|
|
537
536
|
drawingType: B.DRAWING_IMAGE,
|
|
538
|
-
imageSourceType:
|
|
537
|
+
imageSourceType: Rn.URL,
|
|
539
538
|
source: t,
|
|
540
|
-
transform:
|
|
539
|
+
transform: Tn(u),
|
|
541
540
|
docTransform: u,
|
|
542
|
-
behindDoc:
|
|
541
|
+
behindDoc: Dn.FALSE,
|
|
543
542
|
title: "",
|
|
544
543
|
description: "",
|
|
545
|
-
layoutType:
|
|
544
|
+
layoutType: Cn.INLINE,
|
|
546
545
|
// Insert inline drawing by default.
|
|
547
|
-
wrapText:
|
|
546
|
+
wrapText: In.BOTH_SIDES,
|
|
548
547
|
distB: 0,
|
|
549
548
|
distL: 0,
|
|
550
549
|
distR: 0,
|
|
@@ -558,7 +557,7 @@ let Qe = class extends ne {
|
|
|
558
557
|
endOffset: 0
|
|
559
558
|
}
|
|
560
559
|
});
|
|
561
|
-
return l ? (a.apply(l), this._commandService.syncExecuteCommand(
|
|
560
|
+
return l ? (a.apply(l), this._commandService.syncExecuteCommand(bn.id, {
|
|
562
561
|
value: {
|
|
563
562
|
[(g = e == null ? void 0 : e.row) != null ? g : o.primary.actualRow]: {
|
|
564
563
|
[(h = e == null ? void 0 : e.col) != null ? h : o.primary.actualColumn]: {
|
|
@@ -587,7 +586,7 @@ let Qe = class extends ne {
|
|
|
587
586
|
endColumn: 0
|
|
588
587
|
};
|
|
589
588
|
s && s.length > 0 && (o = s[s.length - 1].range);
|
|
590
|
-
const a =
|
|
589
|
+
const a = Yn(this._skeletonManagerService.getCurrent().skeleton, o);
|
|
591
590
|
if (a == null)
|
|
592
591
|
return;
|
|
593
592
|
let { startColumn: d, startRow: u, startX: c, startY: l } = a, g = !1;
|
|
@@ -672,23 +671,23 @@ let Qe = class extends ne {
|
|
|
672
671
|
Qe = rs([
|
|
673
672
|
te(1, A(V)),
|
|
674
673
|
te(2, G),
|
|
675
|
-
te(3,
|
|
676
|
-
te(4,
|
|
674
|
+
te(3, xe),
|
|
675
|
+
te(4, Ei),
|
|
677
676
|
te(5, Pi),
|
|
678
677
|
te(6, re),
|
|
679
678
|
te(7, ie),
|
|
680
|
-
te(8,
|
|
679
|
+
te(8, Gn),
|
|
681
680
|
te(9, cr),
|
|
682
681
|
te(10, A(tt)),
|
|
683
|
-
te(11, A(
|
|
684
|
-
te(12, A(
|
|
682
|
+
te(11, A(on)),
|
|
683
|
+
te(12, A(Xe))
|
|
685
684
|
], Qe);
|
|
686
685
|
const Bt = {
|
|
687
686
|
id: "sheet.command.insert-float-image",
|
|
688
|
-
type:
|
|
687
|
+
type: Z.COMMAND,
|
|
689
688
|
handler: async (i, t) => {
|
|
690
689
|
var o, a;
|
|
691
|
-
const e = i.get(Se), n = i.get(
|
|
690
|
+
const e = i.get(Se), n = i.get(J), r = (o = sn(
|
|
692
691
|
F.UNIVER_SHEET,
|
|
693
692
|
e,
|
|
694
693
|
n
|
|
@@ -704,11 +703,11 @@ const Bt = {
|
|
|
704
703
|
}
|
|
705
704
|
}, dn = {
|
|
706
705
|
id: "sheet.command.insert-cell-image",
|
|
707
|
-
type:
|
|
706
|
+
type: Z.COMMAND,
|
|
708
707
|
handler: (i) => {
|
|
709
708
|
var n, r;
|
|
710
|
-
const t = i.get(Se), e = i.get(
|
|
711
|
-
return (r = (n =
|
|
709
|
+
const t = i.get(Se), e = i.get(J);
|
|
710
|
+
return (r = (n = sn(
|
|
712
711
|
F.UNIVER_SHEET,
|
|
713
712
|
t,
|
|
714
713
|
e
|
|
@@ -716,9 +715,9 @@ const Bt = {
|
|
|
716
715
|
}
|
|
717
716
|
}, rt = {
|
|
718
717
|
id: "sheet.command.move-drawing",
|
|
719
|
-
type:
|
|
718
|
+
type: Z.COMMAND,
|
|
720
719
|
handler: (i, t) => {
|
|
721
|
-
const e = i.get(G), n = i.get(re), r = i.get(
|
|
720
|
+
const e = i.get(G), n = i.get(re), r = i.get(xe), { direction: s } = t, o = n.getFocusDrawings();
|
|
722
721
|
if (o.length === 0)
|
|
723
722
|
return !1;
|
|
724
723
|
const a = o[0].unitId, d = o.map((c) => {
|
|
@@ -739,7 +738,7 @@ const Bt = {
|
|
|
739
738
|
}
|
|
740
739
|
}, pr = "COMPONENT_SHEET_DRAWING_PANEL", wr = {
|
|
741
740
|
id: "sidebar.operation.sheet-image",
|
|
742
|
-
type:
|
|
741
|
+
type: Z.COMMAND,
|
|
743
742
|
handler: async (i, t) => {
|
|
744
743
|
const e = i.get(Ai), n = i.get(tt), r = i.get(Se), s = i.get(G);
|
|
745
744
|
if (!se(r)) return !1;
|
|
@@ -763,7 +762,7 @@ const Bt = {
|
|
|
763
762
|
}
|
|
764
763
|
}, _r = {
|
|
765
764
|
id: "sheet.operation.edit-sheet-image",
|
|
766
|
-
type:
|
|
765
|
+
type: Z.OPERATION,
|
|
767
766
|
handler: (i, t) => {
|
|
768
767
|
const e = i.get(G);
|
|
769
768
|
return t == null ? !1 : (e.syncExecuteCommand(Nt.id, [t]), e.executeCommand(wr.id, { value: "open" }), !0);
|
|
@@ -774,7 +773,7 @@ var os = Object.getOwnPropertyDescriptor, as = (i, t, e, n) => {
|
|
|
774
773
|
(o = i[s]) && (r = o(r) || r);
|
|
775
774
|
return r;
|
|
776
775
|
}, ce = (i, t) => (e, n) => t(e, n, i);
|
|
777
|
-
let Rt = class extends
|
|
776
|
+
let Rt = class extends Gr {
|
|
778
777
|
constructor(t, e, n, r, s, o, a, d, u, c) {
|
|
779
778
|
super();
|
|
780
779
|
ee(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
@@ -899,15 +898,15 @@ let Rt = class extends Or {
|
|
|
899
898
|
}
|
|
900
899
|
};
|
|
901
900
|
Rt = as([
|
|
902
|
-
ce(0, A(
|
|
901
|
+
ce(0, A(Xe)),
|
|
903
902
|
ce(1, A(tt)),
|
|
904
903
|
ce(2, ie),
|
|
905
|
-
ce(3, A(
|
|
906
|
-
ce(4,
|
|
904
|
+
ce(3, A(Ar)),
|
|
905
|
+
ce(4, J),
|
|
907
906
|
ce(5, Se),
|
|
908
907
|
ce(6, cr),
|
|
909
|
-
ce(7,
|
|
910
|
-
ce(8,
|
|
908
|
+
ce(7, Gn),
|
|
909
|
+
ce(8, Xr),
|
|
911
910
|
ce(9, G)
|
|
912
911
|
], Rt);
|
|
913
912
|
var cs = Object.getOwnPropertyDescriptor, ds = (i, t, e, n) => {
|
|
@@ -925,7 +924,7 @@ let tn = class extends ne {
|
|
|
925
924
|
this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(Ji(33)).subscribe((t) => {
|
|
926
925
|
var n, r;
|
|
927
926
|
let e = [];
|
|
928
|
-
t !== null && (e = this._selectionsService.getWorkbookSelections(this._context.unitId).getCurrentSelections()), e.length > 0 && (t == null ? void 0 : t.unitId) === this._context.unitId && (t != null && t.drawing) && e.length === 1 && ((n = e[0].primary) == null ? void 0 : n.actualRow) === t.row && ((r = e[0].primary) == null ? void 0 : r.actualColumn) === t.col ? (this._isSetCursor = !0, this._context.scene.setCursor(
|
|
927
|
+
t !== null && (e = this._selectionsService.getWorkbookSelections(this._context.unitId).getCurrentSelections()), e.length > 0 && (t == null ? void 0 : t.unitId) === this._context.unitId && (t != null && t.drawing) && e.length === 1 && ((n = e[0].primary) == null ? void 0 : n.actualRow) === t.row && ((r = e[0].primary) == null ? void 0 : r.actualColumn) === t.col ? (this._isSetCursor = !0, this._context.scene.setCursor(Ur.ZOOM_IN)) : this._isSetCursor && (this._isSetCursor = !1, this._context.scene.resetCursor());
|
|
929
928
|
}));
|
|
930
929
|
}
|
|
931
930
|
_initImageClick() {
|
|
@@ -940,8 +939,8 @@ let tn = class extends ne {
|
|
|
940
939
|
}
|
|
941
940
|
};
|
|
942
941
|
tn = ds([
|
|
943
|
-
St(1, A(
|
|
944
|
-
St(2, A(
|
|
942
|
+
St(1, A(Nr)),
|
|
943
|
+
St(2, A(on)),
|
|
945
944
|
St(3, A(lr)),
|
|
946
945
|
St(4, A(V))
|
|
947
946
|
], tn);
|
|
@@ -973,7 +972,7 @@ let nn = class extends ne {
|
|
|
973
972
|
nn = us([
|
|
974
973
|
vt(1, re),
|
|
975
974
|
vt(2, ie),
|
|
976
|
-
vt(3, A(
|
|
975
|
+
vt(3, A(xe)),
|
|
977
976
|
vt(4, A(V))
|
|
978
977
|
], nn);
|
|
979
978
|
var hs = Object.getOwnPropertyDescriptor, gs = (i, t, e, n) => {
|
|
@@ -1009,16 +1008,16 @@ let bt = class extends ne {
|
|
|
1009
1008
|
this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
|
|
1010
1009
|
i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(Ze), this._docDrawingController.loadDrawingDataForUnit(Ze), this._drawingManagerService.initializeNotification(Ze)) : this._drawingManagerService.removeDrawingDataForUnit(Ze);
|
|
1011
1010
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
|
|
1012
|
-
i.id ===
|
|
1011
|
+
i.id === yi.id && i.params.unitId === je && (this._drawingManagerService.removeDrawingDataForUnit(je), this._docDrawingController.loadDrawingDataForUnit(je), this._drawingManagerService.initializeNotification(je));
|
|
1013
1012
|
}));
|
|
1014
1013
|
}
|
|
1015
1014
|
_initCellContentInterceptor() {
|
|
1016
1015
|
this.disposeWithMe(
|
|
1017
1016
|
this._sheetInterceptorService.intercept(
|
|
1018
|
-
|
|
1017
|
+
li.CELL_CONTENT,
|
|
1019
1018
|
{
|
|
1020
|
-
effect:
|
|
1021
|
-
priority:
|
|
1019
|
+
effect: Lr.Style,
|
|
1020
|
+
priority: ui.CELL_IMAGE,
|
|
1022
1021
|
handler: (i, t, e) => {
|
|
1023
1022
|
var n;
|
|
1024
1023
|
return i != null && i.p && ((n = i.p.drawingsOrder) != null && n.length) && (i === t.rawData && (i = { ...t.rawData }), i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }, Sr(this._injector, { unitId: t.unitId, subUnitId: t.subUnitId, row: t.row, col: t.col }, i)), e(i);
|
|
@@ -1031,10 +1030,10 @@ let bt = class extends ne {
|
|
|
1031
1030
|
bt = gs([
|
|
1032
1031
|
Ne(0, G),
|
|
1033
1032
|
Ne(1, A(At)),
|
|
1034
|
-
Ne(2, A(
|
|
1033
|
+
Ne(2, A(Xe)),
|
|
1035
1034
|
Ne(3, ie),
|
|
1036
1035
|
Ne(4, A(Yi)),
|
|
1037
|
-
Ne(5, A(
|
|
1036
|
+
Ne(5, A(kr))
|
|
1038
1037
|
], bt);
|
|
1039
1038
|
var fs = Object.getOwnPropertyDescriptor, ms = (i, t, e, n) => {
|
|
1040
1039
|
for (var r = n > 1 ? void 0 : n ? fs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
@@ -1050,7 +1049,7 @@ let Mt = class extends ne {
|
|
|
1050
1049
|
this._autoFillService.addHook({
|
|
1051
1050
|
id: "sheet-cell-image-autofill",
|
|
1052
1051
|
onBeforeSubmit: (i, t, e, n) => {
|
|
1053
|
-
new
|
|
1052
|
+
new Vr(n).forValue((r, s, o) => {
|
|
1054
1053
|
Sr(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
|
|
1055
1054
|
});
|
|
1056
1055
|
}
|
|
@@ -1059,8 +1058,8 @@ let Mt = class extends ne {
|
|
|
1059
1058
|
}
|
|
1060
1059
|
};
|
|
1061
1060
|
Mt = ms([
|
|
1062
|
-
$n(0, A(
|
|
1063
|
-
$n(1, A(
|
|
1061
|
+
$n(0, A(Wr)),
|
|
1062
|
+
$n(1, A(Xe))
|
|
1064
1063
|
], Mt);
|
|
1065
1064
|
var ps = Object.getOwnPropertyDescriptor, ws = (i, t, e, n) => {
|
|
1066
1065
|
for (var r = n > 1 ? void 0 : n ? ps(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
@@ -1069,8 +1068,8 @@ var ps = Object.getOwnPropertyDescriptor, ws = (i, t, e, n) => {
|
|
|
1069
1068
|
}, He = (i, t) => (e, n) => t(e, n, i);
|
|
1070
1069
|
const _s = [
|
|
1071
1070
|
Ze,
|
|
1072
|
-
|
|
1073
|
-
|
|
1071
|
+
Hr,
|
|
1072
|
+
je
|
|
1074
1073
|
];
|
|
1075
1074
|
let yt = class extends ne {
|
|
1076
1075
|
constructor(i, t, e, n, r) {
|
|
@@ -1078,7 +1077,7 @@ let yt = class extends ne {
|
|
|
1078
1077
|
}
|
|
1079
1078
|
_setCellImage(i) {
|
|
1080
1079
|
var r;
|
|
1081
|
-
const t = Vt("", {}), e = (r =
|
|
1080
|
+
const t = Vt("", {}), e = (r = sn(F.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.with(Br), n = Ht.drawing.add({
|
|
1082
1081
|
documentDataModel: t,
|
|
1083
1082
|
drawings: [i],
|
|
1084
1083
|
selection: {
|
|
@@ -1093,20 +1092,20 @@ let yt = class extends ne {
|
|
|
1093
1092
|
this.disposeWithMe(
|
|
1094
1093
|
this._commandService.beforeCommandExecuted((i) => {
|
|
1095
1094
|
var t, e;
|
|
1096
|
-
if (i.id ===
|
|
1095
|
+
if (i.id === Ti.id) {
|
|
1097
1096
|
const n = i.params, { doc: r } = n, s = this._univerInstanceService.getCurrentUnitOfType(F.UNIVER_DOC);
|
|
1098
1097
|
if (s == null || !Object.keys((t = r.drawings) != null ? t : {}).length)
|
|
1099
1098
|
return;
|
|
1100
1099
|
const o = s.getUnitId();
|
|
1101
1100
|
if (_s.includes(o)) {
|
|
1102
|
-
if (o !==
|
|
1101
|
+
if (o !== je) {
|
|
1103
1102
|
const a = () => {
|
|
1104
|
-
this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand(
|
|
1103
|
+
this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand(pn.id, {
|
|
1105
1104
|
visible: !1
|
|
1106
1105
|
});
|
|
1107
1106
|
};
|
|
1108
1107
|
((e = s.getBody()) == null ? void 0 : e.dataStream) === `\r
|
|
1109
|
-
` ? (this._commandService.syncExecuteCommand(
|
|
1108
|
+
` ? (this._commandService.syncExecuteCommand(pn.id, {
|
|
1110
1109
|
visible: !1
|
|
1111
1110
|
}), this._setCellImage(Object.values(r.drawings)[0])) : this._dialogService.open({
|
|
1112
1111
|
id: "sheet-cell-image-copy-paste",
|
|
@@ -1138,7 +1137,7 @@ yt = ws([
|
|
|
1138
1137
|
He(0, G),
|
|
1139
1138
|
He(1, Se),
|
|
1140
1139
|
He(2, Ni),
|
|
1141
|
-
He(3,
|
|
1140
|
+
He(3, J),
|
|
1142
1141
|
He(4, A(tt))
|
|
1143
1142
|
], yt);
|
|
1144
1143
|
var Ss = Object.getOwnPropertyDescriptor, vs = (i, t, e, n) => {
|
|
@@ -1170,12 +1169,12 @@ function Ds() {
|
|
|
1170
1169
|
};
|
|
1171
1170
|
}
|
|
1172
1171
|
const Fn = [
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1172
|
+
Be.SPECIAL_PASTE_COL_WIDTH,
|
|
1173
|
+
Be.SPECIAL_PASTE_VALUE,
|
|
1174
|
+
Be.SPECIAL_PASTE_FORMAT,
|
|
1175
|
+
Be.SPECIAL_PASTE_FORMULA
|
|
1177
1176
|
];
|
|
1178
|
-
let
|
|
1177
|
+
let Tt = class extends ne {
|
|
1179
1178
|
constructor(t, e, n, r, s) {
|
|
1180
1179
|
super();
|
|
1181
1180
|
ee(this, "_copyInfo");
|
|
@@ -1192,7 +1191,7 @@ let Et = class extends ne {
|
|
|
1192
1191
|
const s = this._focusedDrawings;
|
|
1193
1192
|
if (s.length > 0) {
|
|
1194
1193
|
const [o] = s;
|
|
1195
|
-
if (r ===
|
|
1194
|
+
if (r === ve.CUT) {
|
|
1196
1195
|
const d = {
|
|
1197
1196
|
unitId: t,
|
|
1198
1197
|
drawings: [o]
|
|
@@ -1201,7 +1200,7 @@ let Et = class extends ne {
|
|
|
1201
1200
|
}
|
|
1202
1201
|
setTimeout(() => {
|
|
1203
1202
|
const d = Ds();
|
|
1204
|
-
o.drawingType === B.DRAWING_IMAGE && o.imageSourceType ===
|
|
1203
|
+
o.drawingType === B.DRAWING_IMAGE && o.imageSourceType === Oi.BASE64 ? Cs(o.source) : this._clipboardInterfaceService.writeText(""), d();
|
|
1205
1204
|
}, 200);
|
|
1206
1205
|
const a = {
|
|
1207
1206
|
unitId: o.unitId,
|
|
@@ -1217,14 +1216,14 @@ let Et = class extends ne {
|
|
|
1217
1216
|
onPasteCells: (t, e, n, r) => {
|
|
1218
1217
|
if (!this._copyInfo)
|
|
1219
1218
|
return { redos: [], undos: [] };
|
|
1220
|
-
const { copyType: s =
|
|
1221
|
-
return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: c, pasteRange: d }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: e, pasteType: o },
|
|
1219
|
+
const { copyType: s = ve.COPY, pasteType: o } = r, { range: a } = t || {}, { range: d, unitId: u, subUnitId: c } = e;
|
|
1220
|
+
return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: c, pasteRange: d }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: e, pasteType: o }, ve.COPY);
|
|
1222
1221
|
},
|
|
1223
1222
|
onPastePlainText: (t, e) => ({ undos: [], redos: [] }),
|
|
1224
|
-
onPasteUnrecognized: (t) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType:
|
|
1223
|
+
onPasteUnrecognized: (t) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: Be.DEFAULT_PASTE }, ve.COPY) : { undos: [], redos: [] },
|
|
1225
1224
|
onPasteFiles: (t, e) => {
|
|
1226
1225
|
if (this._copyInfo)
|
|
1227
|
-
return this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType:
|
|
1226
|
+
return this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: Be.DEFAULT_PASTE }, ve.COPY);
|
|
1228
1227
|
{
|
|
1229
1228
|
const n = e.filter((r) => r.type.includes("image"));
|
|
1230
1229
|
if (n.length)
|
|
@@ -1273,14 +1272,14 @@ let Et = class extends ne {
|
|
|
1273
1272
|
const { pasteType: n, pasteTo: r } = t;
|
|
1274
1273
|
if (Fn.includes(n))
|
|
1275
1274
|
return { redos: [], undos: [] };
|
|
1276
|
-
const { unitId: s, subUnitId: o, range: a } = r, d = this._renderManagerService.getRenderById(s), u = d == null ? void 0 : d.with(V), c = d == null ? void 0 : d.with(
|
|
1275
|
+
const { unitId: s, subUnitId: o, range: a } = r, d = this._renderManagerService.getRenderById(s), u = d == null ? void 0 : d.with(V), c = d == null ? void 0 : d.with(xe), l = this._copyInfo;
|
|
1277
1276
|
if (!u || !c)
|
|
1278
1277
|
return { redos: [], undos: [] };
|
|
1279
|
-
const { drawings: g } = l, h =
|
|
1278
|
+
const { drawings: g } = l, h = wn(a);
|
|
1280
1279
|
return this._generateMutations(g, {
|
|
1281
1280
|
unitId: s,
|
|
1282
1281
|
subUnitId: o,
|
|
1283
|
-
isCut: e ===
|
|
1282
|
+
isCut: e === ve.CUT,
|
|
1284
1283
|
getTransform: (f, p) => {
|
|
1285
1284
|
var v;
|
|
1286
1285
|
const m = u.attachRangeWithCoord({
|
|
@@ -1366,10 +1365,10 @@ let Et = class extends ne {
|
|
|
1366
1365
|
const { drawings: c } = this._copyInfo;
|
|
1367
1366
|
if (!a)
|
|
1368
1367
|
return this._generateSingleDrawingPasteMutations({
|
|
1369
|
-
pasteTo: { unitId: n, subUnitId: r, range:
|
|
1368
|
+
pasteTo: { unitId: n, subUnitId: r, range: wn(o) },
|
|
1370
1369
|
pasteType: s
|
|
1371
1370
|
}, d);
|
|
1372
|
-
const { ranges: [l, g], mapFunc: h } =
|
|
1371
|
+
const { ranges: [l, g], mapFunc: h } = jr([a, o]), { row: f, col: p } = h(l.startRow, l.startColumn), { row: m, col: _ } = h(g.startRow, g.startColumn), v = u.attachRangeWithCoord({
|
|
1373
1372
|
startRow: f,
|
|
1374
1373
|
endRow: f,
|
|
1375
1374
|
startColumn: p,
|
|
@@ -1386,46 +1385,46 @@ let Et = class extends ne {
|
|
|
1386
1385
|
return this._generateMutations(c, {
|
|
1387
1386
|
unitId: n,
|
|
1388
1387
|
subUnitId: r,
|
|
1389
|
-
getTransform: (D,
|
|
1390
|
-
var
|
|
1388
|
+
getTransform: (D, T) => {
|
|
1389
|
+
var E, M;
|
|
1391
1390
|
return {
|
|
1392
1391
|
transform: {
|
|
1393
1392
|
...D,
|
|
1394
|
-
left: ((
|
|
1393
|
+
left: ((E = D == null ? void 0 : D.left) != null ? E : 0) + R,
|
|
1395
1394
|
top: ((M = D == null ? void 0 : D.top) != null ? M : 0) + S
|
|
1396
1395
|
},
|
|
1397
1396
|
sheetTransform: {
|
|
1398
|
-
...
|
|
1397
|
+
...T,
|
|
1399
1398
|
to: {
|
|
1400
|
-
...
|
|
1401
|
-
row:
|
|
1402
|
-
column:
|
|
1399
|
+
...T.to,
|
|
1400
|
+
row: T.to.row + C,
|
|
1401
|
+
column: T.to.column + w
|
|
1403
1402
|
},
|
|
1404
1403
|
from: {
|
|
1405
|
-
...
|
|
1406
|
-
row:
|
|
1407
|
-
column:
|
|
1404
|
+
...T.from,
|
|
1405
|
+
row: T.from.row + C,
|
|
1406
|
+
column: T.from.column + w
|
|
1408
1407
|
}
|
|
1409
1408
|
}
|
|
1410
1409
|
};
|
|
1411
1410
|
},
|
|
1412
|
-
isCut: d ===
|
|
1411
|
+
isCut: d === ve.CUT
|
|
1413
1412
|
});
|
|
1414
1413
|
}
|
|
1415
1414
|
};
|
|
1416
|
-
|
|
1417
|
-
ze(0,
|
|
1418
|
-
ze(1,
|
|
1415
|
+
Tt = vs([
|
|
1416
|
+
ze(0, $r),
|
|
1417
|
+
ze(1, J),
|
|
1419
1418
|
ze(2, ie),
|
|
1420
1419
|
ze(3, ki),
|
|
1421
1420
|
ze(4, G)
|
|
1422
|
-
],
|
|
1421
|
+
], Tt);
|
|
1423
1422
|
var Rs = Object.getOwnPropertyDescriptor, bs = (i, t, e, n) => {
|
|
1424
1423
|
for (var r = n > 1 ? void 0 : n ? Rs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
1425
1424
|
(o = i[s]) && (r = o(r) || r);
|
|
1426
1425
|
return r;
|
|
1427
1426
|
}, Ke = (i, t) => (e, n) => t(e, n, i);
|
|
1428
|
-
let
|
|
1427
|
+
let Et = class extends ne {
|
|
1429
1428
|
constructor(i, t, e, n, r) {
|
|
1430
1429
|
super(), this._drawingManagerService = i, this._renderManagerService = t, this._permissionService = e, this._univerInstanceService = n, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
1431
1430
|
}
|
|
@@ -1441,8 +1440,8 @@ let Tt = class extends ne {
|
|
|
1441
1440
|
}
|
|
1442
1441
|
const o = n.getUnitId(), a = s.getSheetId();
|
|
1443
1442
|
this._permissionService.composePermission([
|
|
1444
|
-
new
|
|
1445
|
-
new
|
|
1443
|
+
new Mn(o).id,
|
|
1444
|
+
new yn(o, a).id
|
|
1446
1445
|
]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(n, s);
|
|
1447
1446
|
})
|
|
1448
1447
|
) : (this._drawingManagerService.setDrawingVisible(!1), fe))
|
|
@@ -1500,8 +1499,8 @@ let Tt = class extends ne {
|
|
|
1500
1499
|
return fe;
|
|
1501
1500
|
const u = d.getTransformerByCreate();
|
|
1502
1501
|
return this._permissionService.composePermission$([
|
|
1503
|
-
new
|
|
1504
|
-
new
|
|
1502
|
+
new Mn(s).id,
|
|
1503
|
+
new yn(s, o).id
|
|
1505
1504
|
]).pipe(
|
|
1506
1505
|
be((l) => l.every((g) => g.value)),
|
|
1507
1506
|
Wn()
|
|
@@ -1593,20 +1592,20 @@ let Tt = class extends ne {
|
|
|
1593
1592
|
);
|
|
1594
1593
|
}
|
|
1595
1594
|
};
|
|
1596
|
-
|
|
1595
|
+
Et = bs([
|
|
1597
1596
|
Ke(0, ie),
|
|
1598
|
-
Ke(1,
|
|
1599
|
-
Ke(2,
|
|
1597
|
+
Ke(1, J),
|
|
1598
|
+
Ke(2, zr),
|
|
1600
1599
|
Ke(3, Se),
|
|
1601
|
-
Ke(4, A(
|
|
1602
|
-
],
|
|
1600
|
+
Ke(4, A(Kr))
|
|
1601
|
+
], Et);
|
|
1603
1602
|
var Ms = Object.getOwnPropertyDescriptor, ys = (i, t, e, n) => {
|
|
1604
1603
|
for (var r = n > 1 ? void 0 : n ? Ms(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
1605
1604
|
(o = i[s]) && (r = o(r) || r);
|
|
1606
1605
|
return r;
|
|
1607
1606
|
}, Ce = (i, t) => (e, n) => t(e, n, i);
|
|
1608
1607
|
function Ir(i, t, e, n, r, s = !1) {
|
|
1609
|
-
const { scaleX: o, scaleY: a } = t.getAncestorScale(), d = t.getViewport(
|
|
1608
|
+
const { scaleX: o, scaleY: a } = t.getAncestorScale(), d = t.getViewport(xn.VIEW_MAIN), u = n.getFreeze(), { startColumn: c, startRow: l, xSplit: g, ySplit: h } = u, f = {
|
|
1610
1609
|
left: !0,
|
|
1611
1610
|
// left means the left of pic is in a viewMainLeft
|
|
1612
1611
|
top: !0
|
|
@@ -1618,13 +1617,13 @@ function Ir(i, t, e, n, r, s = !1) {
|
|
|
1618
1617
|
};
|
|
1619
1618
|
const { left: p, right: m, top: _, bottom: v } = i;
|
|
1620
1619
|
let { top: I, left: R, viewportScrollX: S, viewportScrollY: C } = d;
|
|
1621
|
-
const { boundsOfViewArea: w, scrollDirectionResponse: y } = r || {}, { rowHeaderWidth: D, columnHeaderHeight:
|
|
1622
|
-
top: s ? 0 :
|
|
1620
|
+
const { boundsOfViewArea: w, scrollDirectionResponse: y } = r || {}, { rowHeaderWidth: D, columnHeaderHeight: T } = e, E = {
|
|
1621
|
+
top: s ? 0 : T,
|
|
1623
1622
|
left: s ? 0 : D
|
|
1624
1623
|
};
|
|
1625
|
-
w && (Re.isDefine(
|
|
1624
|
+
w && (Re.isDefine(E.top) && (E.top = w.top), Re.isDefine(E.left) && (E.left = w.left)), y === "HORIZONTAL" && (C = 0), y === "VERTICAL" && (S = 0);
|
|
1626
1625
|
let M = 0, b = 0;
|
|
1627
|
-
const N = e.rowStartY(l - h) +
|
|
1626
|
+
const N = e.rowStartY(l - h) + T, x = e.colStartX(c - g) + D, q = e.rowStartY(l) + T, H = e.colStartX(c) + D;
|
|
1628
1627
|
if (g === 0)
|
|
1629
1628
|
f.left = !1, M = (p - S) * o, b = (m - S) * o;
|
|
1630
1629
|
else {
|
|
@@ -1635,10 +1634,10 @@ function Ir(i, t, e, n, r, s = !1) {
|
|
|
1635
1634
|
if (h === 0)
|
|
1636
1635
|
f.top = !1, L = (_ - C) * a, X = (v - C) * a;
|
|
1637
1636
|
else {
|
|
1638
|
-
const k = _ - (N -
|
|
1637
|
+
const k = _ - (N - T), ae = v - (N - T);
|
|
1639
1638
|
v < q ? (L = k * a, X = ae * a) : _ <= q && v >= q ? (L = k * a, X = Math.max(I, (v - C) * a)) : _ > q && (f.top = !1, L = Math.max((_ - C) * a, I), X = Math.max((v - C) * a, I));
|
|
1640
1639
|
}
|
|
1641
|
-
return M = Math.max(M,
|
|
1640
|
+
return M = Math.max(M, E.left), L = Math.max(L, E.top), b = Math.max(b, E.left), X = Math.max(X, E.top), {
|
|
1642
1641
|
left: M,
|
|
1643
1642
|
right: b,
|
|
1644
1643
|
top: L,
|
|
@@ -1680,7 +1679,7 @@ let et = class extends ne {
|
|
|
1680
1679
|
this._renderManagerService = t, this._univerInstanceService = e, this._commandService = n, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = a, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
|
|
1681
1680
|
}
|
|
1682
1681
|
_bindScrollEvent() {
|
|
1683
|
-
this._lifecycleService.lifecycle$.pipe(Zi((t) => t ===
|
|
1682
|
+
this._lifecycleService.lifecycle$.pipe(Zi((t) => t === Zr.Rendered), qi(1)).subscribe(() => {
|
|
1684
1683
|
this._scrollUpdateListener();
|
|
1685
1684
|
});
|
|
1686
1685
|
}
|
|
@@ -1726,9 +1725,9 @@ let et = class extends ne {
|
|
|
1726
1725
|
return !0;
|
|
1727
1726
|
if (u !== r)
|
|
1728
1727
|
return;
|
|
1729
|
-
const { left: _, top: v, width: I, height: R, angle: S, flipX: C, flipY: w, skewX: y, skewY: D } = l,
|
|
1730
|
-
if (
|
|
1731
|
-
|
|
1728
|
+
const { left: _, top: v, width: I, height: R, angle: S, flipX: C, flipY: w, skewX: y, skewY: D } = l, T = Ie({ unitId: n, subUnitId: r, drawingId: s }), E = p.getObject(T);
|
|
1729
|
+
if (E != null) {
|
|
1730
|
+
E.transformByState({ left: _, top: v, width: I, height: R, angle: S, flipX: C, flipY: w, skewX: y, skewY: D });
|
|
1732
1731
|
return;
|
|
1733
1732
|
}
|
|
1734
1733
|
const M = {
|
|
@@ -1742,9 +1741,9 @@ let et = class extends ne {
|
|
|
1742
1741
|
const k = h ? h.backgroundColor : "white";
|
|
1743
1742
|
M.fill = k, h && h.border && (M.stroke = h.border), M.paintFirst = "stroke", M.strokeWidth = 1, M.borderEnabled = !1, M.radius = 8;
|
|
1744
1743
|
}
|
|
1745
|
-
const N = new Pe(
|
|
1746
|
-
b && N.setObjectType(
|
|
1747
|
-
const x = new
|
|
1744
|
+
const N = new Pe(T, M);
|
|
1745
|
+
b && N.setObjectType(mn.CHART), p.addObject(N, Ft), a.allowTransform !== !1 && p.attachTransformerTo(N);
|
|
1746
|
+
const x = new wt(), q = ge(N, f.renderUnit.scene, c.skeleton, o.worksheet), H = new We(q), L = {
|
|
1748
1747
|
dispose: x,
|
|
1749
1748
|
rect: N,
|
|
1750
1749
|
position$: H,
|
|
@@ -1786,7 +1785,7 @@ let et = class extends ne {
|
|
|
1786
1785
|
this._drawingManagerService.remove$.subscribe((t) => {
|
|
1787
1786
|
t.forEach((e) => {
|
|
1788
1787
|
var l;
|
|
1789
|
-
const { unitId: n, subUnitId: r, drawingId: s } = e, o =
|
|
1788
|
+
const { unitId: n, subUnitId: r, drawingId: s } = e, o = Ie({ unitId: n, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(n);
|
|
1790
1789
|
if (a == null)
|
|
1791
1790
|
return;
|
|
1792
1791
|
const { transformer: d, scene: u } = a, c = u.getObject(o);
|
|
@@ -1816,7 +1815,7 @@ let et = class extends ne {
|
|
|
1816
1815
|
return r ? { render: r, unitId: n, subUnitId: e.getSheetId() } : null;
|
|
1817
1816
|
}),
|
|
1818
1817
|
we(
|
|
1819
|
-
(e) => e ?
|
|
1818
|
+
(e) => e ? qr(e.render.scene.getViewport(xn.VIEW_MAIN).onScrollAfter$).pipe(be(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : Bn(null)
|
|
1820
1819
|
)
|
|
1821
1820
|
).subscribe((e) => {
|
|
1822
1821
|
if (!e) return;
|
|
@@ -1824,20 +1823,27 @@ let et = class extends ne {
|
|
|
1824
1823
|
t(n, r);
|
|
1825
1824
|
})
|
|
1826
1825
|
), this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
|
|
1827
|
-
if (e.id ===
|
|
1826
|
+
if (e.id === _n.id) {
|
|
1828
1827
|
const n = e.params, { unitId: r } = n;
|
|
1829
1828
|
Array.from(this._domLayerInfoMap.values()).filter((o) => o.unitId === r).map((o) => o.subUnitId).forEach((o) => {
|
|
1830
1829
|
t(r, o);
|
|
1831
1830
|
});
|
|
1832
|
-
} else if (e.id ===
|
|
1831
|
+
} else if (e.id === hi.id) {
|
|
1833
1832
|
const { unitId: n, subUnitId: r } = e.params;
|
|
1834
1833
|
t(n, r);
|
|
1835
1834
|
}
|
|
1836
1835
|
}));
|
|
1837
1836
|
}
|
|
1837
|
+
updateFloatDomProps(t, e, n, r) {
|
|
1838
|
+
const s = this._domLayerInfoMap.get(n), o = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1839
|
+
if (s && o) {
|
|
1840
|
+
const { scene: a } = o, d = Ie({ unitId: t, subUnitId: e, drawingId: n }), u = a.getObject(d);
|
|
1841
|
+
u && u instanceof Pe && u.setProps(r);
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1838
1844
|
_getPosition(t, e) {
|
|
1839
1845
|
var g;
|
|
1840
|
-
const { startX: n, endX: r, startY: s, endY: o } = t, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(
|
|
1846
|
+
const { startX: n, endX: r, startY: s, endY: o } = t, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(xe);
|
|
1841
1847
|
if (a == null)
|
|
1842
1848
|
return;
|
|
1843
1849
|
const d = a.getCellWithCoordByOffset(n, s);
|
|
@@ -1872,7 +1878,14 @@ let et = class extends ne {
|
|
|
1872
1878
|
const r = {
|
|
1873
1879
|
...n.transform
|
|
1874
1880
|
};
|
|
1875
|
-
this._transformChange$.next({ id: e.drawingId, value: r })
|
|
1881
|
+
this._transformChange$.next({ id: e.drawingId, value: r }), this._canvasFloatDomService.updateFloatDom(e.drawingId, {
|
|
1882
|
+
...n
|
|
1883
|
+
});
|
|
1884
|
+
const s = this._getSceneAndTransformerByDrawingSearch(e.unitId);
|
|
1885
|
+
if (s) {
|
|
1886
|
+
const { scene: o } = s, a = this._domLayerInfoMap.get(e.drawingId);
|
|
1887
|
+
a != null && a.rect && (n.allowTransform === !1 ? o.detachTransformerFrom(a.rect) : o.attachTransformerTo(a.rect));
|
|
1888
|
+
}
|
|
1876
1889
|
});
|
|
1877
1890
|
})
|
|
1878
1891
|
);
|
|
@@ -1886,13 +1899,6 @@ let et = class extends ne {
|
|
|
1886
1899
|
})
|
|
1887
1900
|
);
|
|
1888
1901
|
}
|
|
1889
|
-
updateFloatDomProps(t, e, n, r) {
|
|
1890
|
-
const s = this._domLayerInfoMap.get(n), o = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1891
|
-
if (s && o) {
|
|
1892
|
-
const { scene: a } = o, d = ve({ unitId: t, subUnitId: e, drawingId: n }), u = a.getObject(d);
|
|
1893
|
-
u && u instanceof Pe && u.setProps(r);
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
1902
|
// CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
|
|
1897
1903
|
addFloatDomToPosition(t, e) {
|
|
1898
1904
|
const n = se(this._univerInstanceService, {
|
|
@@ -1979,7 +1985,7 @@ let et = class extends ne {
|
|
|
1979
1985
|
allowTransform: h
|
|
1980
1986
|
};
|
|
1981
1987
|
{
|
|
1982
|
-
const { unitId: D, subUnitId:
|
|
1988
|
+
const { unitId: D, subUnitId: T, drawingId: E } = S, M = se(this._univerInstanceService, { unitId: D, subUnitId: T }), b = S, N = this._univerInstanceService.getUnit(D, F.UNIVER_SHEET);
|
|
1983
1989
|
if (!N)
|
|
1984
1990
|
return;
|
|
1985
1991
|
const x = N.getActiveSheet().getSheetId();
|
|
@@ -1988,7 +1994,7 @@ let et = class extends ne {
|
|
|
1988
1994
|
const q = (w = this._renderManagerService.getRenderById(D)) == null ? void 0 : w.with(V);
|
|
1989
1995
|
if (!q)
|
|
1990
1996
|
return;
|
|
1991
|
-
const H = q.getWorksheetSkeleton(
|
|
1997
|
+
const H = q.getWorksheetSkeleton(T);
|
|
1992
1998
|
if (!H)
|
|
1993
1999
|
return;
|
|
1994
2000
|
const { transform: L, drawingType: X, data: K } = b;
|
|
@@ -1998,9 +2004,9 @@ let et = class extends ne {
|
|
|
1998
2004
|
if (k == null)
|
|
1999
2005
|
return;
|
|
2000
2006
|
const { scene: ae, canvas: Me } = k;
|
|
2001
|
-
if (L == null || x !==
|
|
2007
|
+
if (L == null || x !== T)
|
|
2002
2008
|
return;
|
|
2003
|
-
const { left: st, top: ot, width: at, height: ct, angle: jt, flipX: $t, flipY: dt, skewX: lt, skewY: ye } = L, ut =
|
|
2009
|
+
const { left: st, top: ot, width: at, height: ct, angle: jt, flipX: $t, flipY: dt, skewX: lt, skewY: ye } = L, ut = Ie({ unitId: D, subUnitId: T, drawingId: E }), de = ae.getObject(ut);
|
|
2004
2010
|
if (de != null) {
|
|
2005
2011
|
de.transformByState({ left: st, top: ot, width: at, height: ct, angle: jt, flipX: $t, flipY: dt, skewX: lt, skewY: ye });
|
|
2006
2012
|
return;
|
|
@@ -2011,17 +2017,17 @@ let et = class extends ne {
|
|
|
2011
2017
|
top: ot,
|
|
2012
2018
|
width: at,
|
|
2013
2019
|
height: ct,
|
|
2014
|
-
zIndex: this._drawingManagerService.getDrawingOrder(D,
|
|
2015
|
-
},
|
|
2016
|
-
if (
|
|
2020
|
+
zIndex: this._drawingManagerService.getDrawingOrder(D, T).length - 1
|
|
2021
|
+
}, Te = X === B.DRAWING_CHART;
|
|
2022
|
+
if (Te) {
|
|
2017
2023
|
const W = K ? K.backgroundColor : "white";
|
|
2018
2024
|
Q.fill = W, Q.rotateEnabled = !1, K && K.border && (Q.stroke = K.border), Q.paintFirst = "stroke", Q.strokeWidth = 1, Q.borderEnabled = !1, Q.radius = 8;
|
|
2019
2025
|
}
|
|
2020
2026
|
const le = new Pe(ut, Q);
|
|
2021
|
-
|
|
2022
|
-
const ue = new
|
|
2027
|
+
Te && le.setObjectType(mn.CHART), ae.addObject(le, Ft), b.allowTransform !== !1 && ae.attachTransformerTo(le);
|
|
2028
|
+
const ue = new wt(), ht = ae.getMainViewport(), { rowHeaderWidth: Ee, columnHeaderHeight: Ge } = H.skeleton, gt = {
|
|
2023
2029
|
top: Ge,
|
|
2024
|
-
left:
|
|
2030
|
+
left: Ee,
|
|
2025
2031
|
bottom: ht.bottom,
|
|
2026
2032
|
right: ht.right
|
|
2027
2033
|
}, he = {
|
|
@@ -2030,12 +2036,12 @@ let et = class extends ne {
|
|
|
2030
2036
|
boundsOfViewArea: gt,
|
|
2031
2037
|
domAnchor: n,
|
|
2032
2038
|
unitId: D,
|
|
2033
|
-
subUnitId:
|
|
2039
|
+
subUnitId: T
|
|
2034
2040
|
}, j = ge(le, k.renderUnit.scene, H.skeleton, M.worksheet, he), Oe = new We(j);
|
|
2035
2041
|
he.position$ = Oe;
|
|
2036
2042
|
let Le = {
|
|
2037
2043
|
position$: Oe,
|
|
2038
|
-
id:
|
|
2044
|
+
id: E,
|
|
2039
2045
|
componentKey: b.componentKey,
|
|
2040
2046
|
onPointerDown: () => {
|
|
2041
2047
|
},
|
|
@@ -2073,12 +2079,12 @@ let et = class extends ne {
|
|
|
2073
2079
|
left: p.absolute.left,
|
|
2074
2080
|
top: p.absolute.top
|
|
2075
2081
|
}
|
|
2076
|
-
}, n), Rr =
|
|
2082
|
+
}, n), Rr = Ie({ unitId: D, subUnitId: T, drawingId: E }), br = new Pe(Rr, {
|
|
2077
2083
|
left: ln.startX,
|
|
2078
2084
|
top: ln.startY,
|
|
2079
2085
|
width: (gn = n.width) != null ? gn : W.width,
|
|
2080
2086
|
height: (fn = n.height) != null ? fn : W.height,
|
|
2081
|
-
zIndex: this._drawingManagerService.getDrawingOrder(D,
|
|
2087
|
+
zIndex: this._drawingManagerService.getDrawingOrder(D, T).length - 1
|
|
2082
2088
|
}), Mr = ge(br, k.renderUnit.scene, H.skeleton, M.worksheet, he);
|
|
2083
2089
|
Oe.next(Mr);
|
|
2084
2090
|
}));
|
|
@@ -2093,8 +2099,8 @@ let et = class extends ne {
|
|
|
2093
2099
|
);
|
|
2094
2100
|
});
|
|
2095
2101
|
ue.add(() => {
|
|
2096
|
-
this._canvasFloatDomService.removeFloatDom(
|
|
2097
|
-
}), ft && ue.add(ft), this._domLayerInfoMap.set(
|
|
2102
|
+
this._canvasFloatDomService.removeFloatDom(E);
|
|
2103
|
+
}), ft && ue.add(ft), this._domLayerInfoMap.set(E, he);
|
|
2098
2104
|
}
|
|
2099
2105
|
return {
|
|
2100
2106
|
id: f,
|
|
@@ -2142,11 +2148,11 @@ let et = class extends ne {
|
|
|
2142
2148
|
allowTransform: h
|
|
2143
2149
|
};
|
|
2144
2150
|
{
|
|
2145
|
-
const { unitId: w, subUnitId: y, drawingId: D } = I,
|
|
2151
|
+
const { unitId: w, subUnitId: y, drawingId: D } = I, T = se(this._univerInstanceService, { unitId: w, subUnitId: y }), E = I, M = this._univerInstanceService.getUnit(w, F.UNIVER_SHEET);
|
|
2146
2152
|
if (!M)
|
|
2147
2153
|
return;
|
|
2148
2154
|
const b = M.getActiveSheet().getSheetId();
|
|
2149
|
-
if (!
|
|
2155
|
+
if (!E || !T)
|
|
2150
2156
|
return;
|
|
2151
2157
|
const N = (S = this._renderManagerService.getRenderById(w)) == null ? void 0 : S.with(V);
|
|
2152
2158
|
if (!N)
|
|
@@ -2154,13 +2160,13 @@ let et = class extends ne {
|
|
|
2154
2160
|
const x = N.getWorksheetSkeleton(y);
|
|
2155
2161
|
if (!x)
|
|
2156
2162
|
return;
|
|
2157
|
-
const { transform: q, data: H } =
|
|
2163
|
+
const { transform: q, data: H } = E, L = this._getSceneAndTransformerByDrawingSearch(w);
|
|
2158
2164
|
if (L == null)
|
|
2159
2165
|
return;
|
|
2160
2166
|
const { scene: X, canvas: K } = L;
|
|
2161
2167
|
if (q == null || b !== y)
|
|
2162
2168
|
return;
|
|
2163
|
-
const { left: k, top: ae, width: Me, height: st, angle: ot, flipX: at, flipY: ct, skewX: jt, skewY: $t } = q, dt =
|
|
2169
|
+
const { left: k, top: ae, width: Me, height: st, angle: ot, flipX: at, flipY: ct, skewX: jt, skewY: $t } = q, dt = Ie({ unitId: w, subUnitId: y, drawingId: D }), lt = X.getObject(dt);
|
|
2164
2170
|
if (lt != null) {
|
|
2165
2171
|
lt.transformByState({ left: k, top: ae, width: Me, height: st, angle: ot, flipX: at, flipY: ct, skewX: jt, skewY: $t });
|
|
2166
2172
|
return;
|
|
@@ -2183,13 +2189,13 @@ let et = class extends ne {
|
|
|
2183
2189
|
height: ye.height,
|
|
2184
2190
|
zIndex: this._drawingManagerService.getDrawingOrder(w, y).length - 1
|
|
2185
2191
|
}, de = new Pe(dt, ut);
|
|
2186
|
-
X.addObject(de,
|
|
2187
|
-
const Q = new
|
|
2192
|
+
X.addObject(de, Ft), E.allowTransform !== !1 && X.attachTransformerTo(de);
|
|
2193
|
+
const Q = new wt(), Te = X.getMainViewport(), le = {
|
|
2188
2194
|
top: 0,
|
|
2189
2195
|
//viewMain.top,
|
|
2190
|
-
left:
|
|
2191
|
-
bottom:
|
|
2192
|
-
right:
|
|
2196
|
+
left: Te.left,
|
|
2197
|
+
bottom: Te.bottom,
|
|
2198
|
+
right: Te.right
|
|
2193
2199
|
}, ue = {
|
|
2194
2200
|
dispose: Q,
|
|
2195
2201
|
rect: de,
|
|
@@ -2200,12 +2206,12 @@ let et = class extends ne {
|
|
|
2200
2206
|
domAnchor: n,
|
|
2201
2207
|
scrollDirectionResponse: "HORIZONTAL"
|
|
2202
2208
|
/* HORIZONTAL */
|
|
2203
|
-
}, ht = ge(de, L.renderUnit.scene, x.skeleton,
|
|
2204
|
-
ue.position$ =
|
|
2209
|
+
}, ht = ge(de, L.renderUnit.scene, x.skeleton, T.worksheet, ue), Ee = new We(ht);
|
|
2210
|
+
ue.position$ = Ee;
|
|
2205
2211
|
let Ge = {
|
|
2206
|
-
position$:
|
|
2212
|
+
position$: Ee,
|
|
2207
2213
|
id: D,
|
|
2208
|
-
componentKey:
|
|
2214
|
+
componentKey: E.componentKey,
|
|
2209
2215
|
onPointerDown: () => {
|
|
2210
2216
|
},
|
|
2211
2217
|
onPointerMove: () => {
|
|
@@ -2231,8 +2237,8 @@ let et = class extends ne {
|
|
|
2231
2237
|
}
|
|
2232
2238
|
}), this._canvasFloatDomService.addFloatDom(Ge);
|
|
2233
2239
|
const gt = de.onTransformChange$.subscribeEvent(() => {
|
|
2234
|
-
const j = ge(de, L.renderUnit.scene, x.skeleton,
|
|
2235
|
-
|
|
2240
|
+
const j = ge(de, L.renderUnit.scene, x.skeleton, T.worksheet, ue);
|
|
2241
|
+
Ee.next(
|
|
2236
2242
|
j
|
|
2237
2243
|
);
|
|
2238
2244
|
});
|
|
@@ -2248,14 +2254,14 @@ let et = class extends ne {
|
|
|
2248
2254
|
left: p.absolute.left,
|
|
2249
2255
|
top: p.absolute.top
|
|
2250
2256
|
}
|
|
2251
|
-
}, n), Le =
|
|
2257
|
+
}, n), Le = Ie({ unitId: w, subUnitId: y, drawingId: D }), Ve = new Pe(Le, {
|
|
2252
2258
|
left: Oe.startX,
|
|
2253
2259
|
top: 0,
|
|
2254
2260
|
width: n.width,
|
|
2255
2261
|
height: n.height,
|
|
2256
2262
|
zIndex: this._drawingManagerService.getDrawingOrder(w, y).length - 1
|
|
2257
|
-
}), ft = ge(Ve, L.renderUnit.scene, x.skeleton,
|
|
2258
|
-
|
|
2263
|
+
}), ft = ge(Ve, L.renderUnit.scene, x.skeleton, T.worksheet, ue);
|
|
2264
|
+
Ee.next(ft);
|
|
2259
2265
|
}));
|
|
2260
2266
|
const he = (C = this._renderManagerService.getRenderById(w)) == null ? void 0 : C.with(V);
|
|
2261
2267
|
he == null || he.currentSkeleton$.subscribe((j) => {
|
|
@@ -2287,13 +2293,13 @@ let et = class extends ne {
|
|
|
2287
2293
|
const o = Je(r, s, n), a = new We(o), d = Je(t.endRow, t.endColumn, n), u = new We(d), c = () => {
|
|
2288
2294
|
const m = Je(r, s, n), _ = Je(t.endRow, t.endColumn, n);
|
|
2289
2295
|
a.next(m), u.next(_);
|
|
2290
|
-
}, l = new
|
|
2296
|
+
}, l = new wt();
|
|
2291
2297
|
l.add(e.engine.clientRect$.subscribe(() => c())), l.add(this._commandService.onCommandExecuted((m) => {
|
|
2292
|
-
if (m.id ===
|
|
2298
|
+
if (m.id === gi.id && m.params.rowsAutoHeightInfo.findIndex((v) => v.row === r) > -1) {
|
|
2293
2299
|
c();
|
|
2294
2300
|
return;
|
|
2295
2301
|
}
|
|
2296
|
-
(
|
|
2302
|
+
(fi.indexOf(m.id) > -1 || m.id === Fr.id || m.id === _n.id) && c();
|
|
2297
2303
|
}));
|
|
2298
2304
|
const g = (m, _) => {
|
|
2299
2305
|
r = m, s = _, c();
|
|
@@ -2338,13 +2344,13 @@ let et = class extends ne {
|
|
|
2338
2344
|
}
|
|
2339
2345
|
};
|
|
2340
2346
|
et = ys([
|
|
2341
|
-
Ce(0, A(
|
|
2347
|
+
Ce(0, A(J)),
|
|
2342
2348
|
Ce(1, Se),
|
|
2343
2349
|
Ce(2, A(G)),
|
|
2344
2350
|
Ce(3, ie),
|
|
2345
2351
|
Ce(4, A(Wi)),
|
|
2346
2352
|
Ce(5, re),
|
|
2347
|
-
Ce(6, A(
|
|
2353
|
+
Ce(6, A(Jr))
|
|
2348
2354
|
], et);
|
|
2349
2355
|
function Je(i, t, e) {
|
|
2350
2356
|
const n = e.getCellWithCoordByIndex(i, t), r = n.isMergedMainCell ? n.mergeInfo : n;
|
|
@@ -2392,7 +2398,7 @@ function Ct(i, t) {
|
|
|
2392
2398
|
const e = Number.parseFloat(i);
|
|
2393
2399
|
return t * e / 100;
|
|
2394
2400
|
}
|
|
2395
|
-
const
|
|
2401
|
+
const Ts = (i) => {
|
|
2396
2402
|
const { floatDomInfos: t, scene: e, skeleton: n, worksheet: r } = i, s = Qi(() => t.map((o) => {
|
|
2397
2403
|
const { width: a, height: d, angle: u, left: c, top: l } = o.transform, g = Ir(
|
|
2398
2404
|
{
|
|
@@ -2435,8 +2441,8 @@ const Es = (i) => {
|
|
|
2435
2441
|
}), [t, e, n, r]);
|
|
2436
2442
|
return /* @__PURE__ */ oe("div", { style: { position: "absolute", top: 0, left: 0 }, children: s.map(([o, a]) => /* @__PURE__ */ oe(Bi, { layer: a, id: o, position: a.position }, o)) });
|
|
2437
2443
|
};
|
|
2438
|
-
var
|
|
2439
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2444
|
+
var Es = Object.getOwnPropertyDescriptor, Os = (i, t, e, n) => {
|
|
2445
|
+
for (var r = n > 1 ? void 0 : n ? Es(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
2440
2446
|
(o = i[s]) && (r = o(r) || r);
|
|
2441
2447
|
return r;
|
|
2442
2448
|
}, De = (i, t) => (e, n) => t(e, n, i);
|
|
@@ -2497,7 +2503,7 @@ let Ot = class extends ne {
|
|
|
2497
2503
|
if (c.drawingType === B.DRAWING_CHART)
|
|
2498
2504
|
return {
|
|
2499
2505
|
...c,
|
|
2500
|
-
componentKey: this._componetManager.get(
|
|
2506
|
+
componentKey: this._componetManager.get(Qr)
|
|
2501
2507
|
};
|
|
2502
2508
|
if (c.drawingType === B.DRAWING_DOM) {
|
|
2503
2509
|
const l = this._sheetPrintInterceptorService.getPrintComponent(c.componentKey);
|
|
@@ -2507,12 +2513,12 @@ let Ot = class extends ne {
|
|
|
2507
2513
|
};
|
|
2508
2514
|
}
|
|
2509
2515
|
return null;
|
|
2510
|
-
}).filter(Boolean), d = ji(
|
|
2511
|
-
return
|
|
2516
|
+
}).filter(Boolean), d = ji(Ts, this._injector);
|
|
2517
|
+
return Di(
|
|
2512
2518
|
/* @__PURE__ */ oe(d, { floatDomInfos: a, scene: t.scene, skeleton: t.skeleton, worksheet: t.worksheet }),
|
|
2513
2519
|
t.root
|
|
2514
2520
|
), i == null || i.add(() => {
|
|
2515
|
-
|
|
2521
|
+
Ri(t.root);
|
|
2516
2522
|
}), e(i);
|
|
2517
2523
|
}
|
|
2518
2524
|
}
|
|
@@ -2522,13 +2528,13 @@ let Ot = class extends ne {
|
|
|
2522
2528
|
}
|
|
2523
2529
|
};
|
|
2524
2530
|
Ot = Os([
|
|
2525
|
-
De(0, A(
|
|
2531
|
+
De(0, A(xr)),
|
|
2526
2532
|
De(1, A(lr)),
|
|
2527
2533
|
De(2, ie),
|
|
2528
|
-
De(3,
|
|
2534
|
+
De(3, J),
|
|
2529
2535
|
De(4, A(et)),
|
|
2530
2536
|
De(5, A(dr)),
|
|
2531
|
-
De(6, A(
|
|
2537
|
+
De(6, A(Xe))
|
|
2532
2538
|
], Ot);
|
|
2533
2539
|
var Us = Object.getOwnPropertyDescriptor, Ps = (i, t, e, n) => {
|
|
2534
2540
|
for (var r = n > 1 ? void 0 : n ? Us(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
@@ -2536,32 +2542,32 @@ var Us = Object.getOwnPropertyDescriptor, Ps = (i, t, e, n) => {
|
|
|
2536
2542
|
return r;
|
|
2537
2543
|
}, me = (i, t) => (e, n) => t(e, n, i);
|
|
2538
2544
|
const As = [
|
|
2539
|
-
Xn.id,
|
|
2540
|
-
Gn.id,
|
|
2541
2545
|
Ln.id,
|
|
2542
2546
|
Vn.id,
|
|
2543
2547
|
Hn.id,
|
|
2544
2548
|
zn.id,
|
|
2545
2549
|
Kn.id,
|
|
2546
2550
|
Jn.id,
|
|
2547
|
-
Jt.id,
|
|
2548
|
-
Zt.id,
|
|
2549
2551
|
Zn.id,
|
|
2550
2552
|
qn.id,
|
|
2553
|
+
Jt.id,
|
|
2554
|
+
Zt.id,
|
|
2551
2555
|
Qn.id,
|
|
2552
2556
|
er.id,
|
|
2553
2557
|
tr.id,
|
|
2554
2558
|
nr.id,
|
|
2555
2559
|
rr.id,
|
|
2556
2560
|
ir.id,
|
|
2557
|
-
sr.id
|
|
2561
|
+
sr.id,
|
|
2562
|
+
or.id,
|
|
2563
|
+
ar.id
|
|
2558
2564
|
], Ns = [
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
+
mi.id,
|
|
2566
|
+
pi.id,
|
|
2567
|
+
wi.id,
|
|
2568
|
+
_i.id,
|
|
2569
|
+
Si.id,
|
|
2570
|
+
vi.id
|
|
2565
2571
|
];
|
|
2566
2572
|
let rn = class extends ne {
|
|
2567
2573
|
constructor(i, t, e, n, r, s, o, a, d) {
|
|
@@ -2576,51 +2582,51 @@ let rn = class extends ne {
|
|
|
2576
2582
|
if (i.params == null)
|
|
2577
2583
|
return { redos: [], undos: [] };
|
|
2578
2584
|
const t = i.id;
|
|
2579
|
-
if (t ===
|
|
2585
|
+
if (t === Ln.id)
|
|
2580
2586
|
return this._moveRowInterceptor(i.params, "insert");
|
|
2581
|
-
if ([
|
|
2587
|
+
if ([sr.id, or.id, ar.id].includes(t))
|
|
2582
2588
|
return this._moveRangeInterceptor(i.params);
|
|
2583
|
-
if (t ===
|
|
2589
|
+
if (t === Vn.id)
|
|
2584
2590
|
return this._moveColInterceptor(i.params, "insert");
|
|
2585
|
-
if (t ===
|
|
2591
|
+
if (t === Hn.id)
|
|
2586
2592
|
return this._moveRowInterceptor(i.params, "remove");
|
|
2587
|
-
if (t ===
|
|
2593
|
+
if (t === zn.id)
|
|
2588
2594
|
return this._moveColInterceptor(i.params, "remove");
|
|
2589
|
-
if (t ===
|
|
2595
|
+
if (t === Kn.id) {
|
|
2590
2596
|
const { range: e } = i.params;
|
|
2591
2597
|
return this._getRangeMoveUndo(
|
|
2592
2598
|
e,
|
|
2593
2599
|
0
|
|
2594
2600
|
/* deleteLeft */
|
|
2595
2601
|
);
|
|
2596
|
-
} else if (t ===
|
|
2602
|
+
} else if (t === Jn.id) {
|
|
2597
2603
|
const { range: e } = i.params;
|
|
2598
2604
|
return this._getRangeMoveUndo(
|
|
2599
2605
|
e,
|
|
2600
2606
|
1
|
|
2601
2607
|
/* deleteUp */
|
|
2602
2608
|
);
|
|
2603
|
-
} else if (t ===
|
|
2609
|
+
} else if (t === Zn.id) {
|
|
2604
2610
|
const { range: e } = i.params;
|
|
2605
2611
|
return this._getRangeMoveUndo(
|
|
2606
2612
|
e,
|
|
2607
2613
|
2
|
|
2608
2614
|
/* insertDown */
|
|
2609
2615
|
);
|
|
2610
|
-
} else if (t ===
|
|
2616
|
+
} else if (t === qn.id) {
|
|
2611
2617
|
const { range: e } = i.params;
|
|
2612
2618
|
return this._getRangeMoveUndo(
|
|
2613
2619
|
e,
|
|
2614
2620
|
3
|
|
2615
2621
|
/* insertRight */
|
|
2616
2622
|
);
|
|
2617
|
-
} else if (t ===
|
|
2623
|
+
} else if (t === tr.id || t === nr.id) {
|
|
2618
2624
|
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
|
|
2619
2625
|
return this._getDrawingUndoForRowVisible(n, r, s);
|
|
2620
|
-
} else if (t ===
|
|
2626
|
+
} else if (t === rr.id || t === ir.id) {
|
|
2621
2627
|
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
|
|
2622
2628
|
return this._getDrawingUndoForColVisible(n, r, s);
|
|
2623
|
-
} else if (t === Jt.id || t === Zt.id || t ===
|
|
2629
|
+
} else if (t === Jt.id || t === Zt.id || t === Qn.id || t === er.id) {
|
|
2624
2630
|
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t === Jt.id || t === Zt.id;
|
|
2625
2631
|
return this._getDrawingUndoForRowAndColSize(n, r, s, o);
|
|
2626
2632
|
}
|
|
@@ -2705,13 +2711,13 @@ let rn = class extends ne {
|
|
|
2705
2711
|
else {
|
|
2706
2712
|
const { from: p, to: m } = g, { row: _, column: v } = p, { row: I, column: R } = m;
|
|
2707
2713
|
for (let S = 0; S < e.length; S++) {
|
|
2708
|
-
const C = e[S], { startRow: w, endRow: y, startColumn: D, endColumn:
|
|
2714
|
+
const C = e[S], { startRow: w, endRow: y, startColumn: D, endColumn: T } = C;
|
|
2709
2715
|
if (R < D)
|
|
2710
2716
|
continue;
|
|
2711
2717
|
if (f === O.Position) {
|
|
2712
2718
|
let b = null, N = null;
|
|
2713
|
-
if (v >= D && v <=
|
|
2714
|
-
const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: v, endColumn:
|
|
2719
|
+
if (v >= D && v <= T) {
|
|
2720
|
+
const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: v, endColumn: T, startRow: p.row, endRow: m.row });
|
|
2715
2721
|
if (x == null)
|
|
2716
2722
|
return;
|
|
2717
2723
|
N = { ...h, left: x.startX };
|
|
@@ -2723,11 +2729,11 @@ let rn = class extends ne {
|
|
|
2723
2729
|
this._remainDrawingSize(h, r, l);
|
|
2724
2730
|
continue;
|
|
2725
2731
|
}
|
|
2726
|
-
if (v >= D && R <=
|
|
2732
|
+
if (v >= D && R <= T)
|
|
2727
2733
|
continue;
|
|
2728
|
-
let
|
|
2729
|
-
if (v >= D && v <=
|
|
2730
|
-
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: v, endColumn:
|
|
2734
|
+
let E = null, M = null;
|
|
2735
|
+
if (v >= D && v <= T) {
|
|
2736
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: v, endColumn: T, startRow: p.row, endRow: m.row });
|
|
2731
2737
|
if (b == null)
|
|
2732
2738
|
return;
|
|
2733
2739
|
M = {
|
|
@@ -2735,7 +2741,7 @@ let rn = class extends ne {
|
|
|
2735
2741
|
left: (b == null ? void 0 : b.startX) || 0,
|
|
2736
2742
|
width: ((h == null ? void 0 : h.width) || 0) - b.endX + b.startX
|
|
2737
2743
|
};
|
|
2738
|
-
} else if (R >= D && R <=
|
|
2744
|
+
} else if (R >= D && R <= T) {
|
|
2739
2745
|
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn: R, startRow: p.row, endRow: m.row });
|
|
2740
2746
|
if (b == null)
|
|
2741
2747
|
return;
|
|
@@ -2744,19 +2750,19 @@ let rn = class extends ne {
|
|
|
2744
2750
|
left: b.startX - ((h == null ? void 0 : h.width) || 0)
|
|
2745
2751
|
};
|
|
2746
2752
|
} else {
|
|
2747
|
-
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn:
|
|
2753
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn: T, startRow: p.row, endRow: m.row });
|
|
2748
2754
|
if (b == null)
|
|
2749
2755
|
return;
|
|
2750
2756
|
if (M = {
|
|
2751
2757
|
...h,
|
|
2752
2758
|
width: ((h == null ? void 0 : h.width) || 0) - b.endX + b.startX
|
|
2753
|
-
},
|
|
2754
|
-
s.push({ ...l, sheetTransform:
|
|
2759
|
+
}, E = $(M, this._selectionRenderService), E != null && M != null) {
|
|
2760
|
+
s.push({ ...l, sheetTransform: E, transform: M });
|
|
2755
2761
|
break;
|
|
2756
2762
|
}
|
|
2757
2763
|
}
|
|
2758
|
-
if (M != null && (
|
|
2759
|
-
r.push({ ...l, sheetTransform:
|
|
2764
|
+
if (M != null && (E = $(M, this._selectionRenderService)), M != null && E != null) {
|
|
2765
|
+
r.push({ ...l, sheetTransform: E, transform: M });
|
|
2760
2766
|
break;
|
|
2761
2767
|
} else
|
|
2762
2768
|
this._remainDrawingSize(h, r, l);
|
|
@@ -2799,7 +2805,7 @@ let rn = class extends ne {
|
|
|
2799
2805
|
else {
|
|
2800
2806
|
const { from: p, to: m } = g, { row: _, column: v } = p, { row: I, column: R } = m;
|
|
2801
2807
|
for (let S = 0; S < e.length; S++) {
|
|
2802
|
-
const C = e[S], { startRow: w, endRow: y, startColumn: D, endColumn:
|
|
2808
|
+
const C = e[S], { startRow: w, endRow: y, startColumn: D, endColumn: T } = C;
|
|
2803
2809
|
if (I < w)
|
|
2804
2810
|
continue;
|
|
2805
2811
|
if (f === O.Position) {
|
|
@@ -2819,7 +2825,7 @@ let rn = class extends ne {
|
|
|
2819
2825
|
}
|
|
2820
2826
|
if (_ >= w && I <= y)
|
|
2821
2827
|
continue;
|
|
2822
|
-
let
|
|
2828
|
+
let E = null, M = null;
|
|
2823
2829
|
if (_ >= w && _ <= y) {
|
|
2824
2830
|
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: _, endRow: y });
|
|
2825
2831
|
if (b == null)
|
|
@@ -2844,13 +2850,13 @@ let rn = class extends ne {
|
|
|
2844
2850
|
if (M = {
|
|
2845
2851
|
...h,
|
|
2846
2852
|
height: ((h == null ? void 0 : h.height) || 0) - b.endY + b.startY
|
|
2847
|
-
},
|
|
2848
|
-
s.push({ ...l, sheetTransform:
|
|
2853
|
+
}, E = $(M, this._selectionRenderService), E != null && M != null) {
|
|
2854
|
+
s.push({ ...l, sheetTransform: E, transform: M });
|
|
2849
2855
|
break;
|
|
2850
2856
|
}
|
|
2851
2857
|
}
|
|
2852
|
-
if (M != null && (
|
|
2853
|
-
r.push({ ...l, sheetTransform:
|
|
2858
|
+
if (M != null && (E = $(M, this._selectionRenderService)), M != null && E != null) {
|
|
2859
|
+
r.push({ ...l, sheetTransform: E, transform: M });
|
|
2854
2860
|
break;
|
|
2855
2861
|
} else
|
|
2856
2862
|
this._remainDrawingSize(h, r, l);
|
|
@@ -2918,7 +2924,7 @@ let rn = class extends ne {
|
|
|
2918
2924
|
const { unitId: r, subUnitId: s } = n, o = (R = (I = this._renderManagerService.getRenderById(r)) == null ? void 0 : I.with(V)) == null ? void 0 : R.getCurrentSkeleton();
|
|
2919
2925
|
if (!o)
|
|
2920
2926
|
return { redos: [], undos: [] };
|
|
2921
|
-
const a =
|
|
2927
|
+
const a = Yn(o, e);
|
|
2922
2928
|
if (!a)
|
|
2923
2929
|
return { redos: [], undos: [] };
|
|
2924
2930
|
const { startX: d, endX: u, startY: c, endY: l } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
|
|
@@ -2929,11 +2935,11 @@ let rn = class extends ne {
|
|
|
2929
2935
|
const { transform: w } = C;
|
|
2930
2936
|
if (!w)
|
|
2931
2937
|
return;
|
|
2932
|
-
const { left: y = 0, top: D = 0, width:
|
|
2938
|
+
const { left: y = 0, top: D = 0, width: T = 0, height: E = 0 } = w, { drawingStartX: M, drawingEndX: b, drawingStartY: N, drawingEndY: x } = {
|
|
2933
2939
|
drawingStartX: y,
|
|
2934
|
-
drawingEndX: y +
|
|
2940
|
+
drawingEndX: y + T,
|
|
2935
2941
|
drawingStartY: D,
|
|
2936
|
-
drawingEndY: D +
|
|
2942
|
+
drawingEndY: D + E
|
|
2937
2943
|
};
|
|
2938
2944
|
d <= M && b <= u && c <= N && x <= l && h.push(C);
|
|
2939
2945
|
});
|
|
@@ -3211,7 +3217,7 @@ let rn = class extends ne {
|
|
|
3211
3217
|
// but the skeleton changes like other render modules. These two signals are not equivalent.
|
|
3212
3218
|
// As a temp solution, I subscribed to activate$ here.
|
|
3213
3219
|
this._commandService.onCommandExecuted((i) => {
|
|
3214
|
-
if (i.id ===
|
|
3220
|
+
if (i.id === Ii.id) {
|
|
3215
3221
|
const { unitId: t, subUnitId: e } = i.params;
|
|
3216
3222
|
this._updateDrawings(t, e);
|
|
3217
3223
|
}
|
|
@@ -3278,7 +3284,7 @@ let rn = class extends ne {
|
|
|
3278
3284
|
const { from: c, to: l } = a, { row: g, column: h } = c, { row: f, column: p } = l;
|
|
3279
3285
|
for (let m = 0; m < e.length; m++) {
|
|
3280
3286
|
const _ = e[m], { startRow: v, endRow: I, startColumn: R, endColumn: S } = _;
|
|
3281
|
-
if (
|
|
3287
|
+
if (ei.intersects(
|
|
3282
3288
|
{
|
|
3283
3289
|
startRow: v,
|
|
3284
3290
|
endRow: I,
|
|
@@ -3308,9 +3314,9 @@ let rn = class extends ne {
|
|
|
3308
3314
|
}
|
|
3309
3315
|
};
|
|
3310
3316
|
rn = Ps([
|
|
3311
|
-
me(1,
|
|
3317
|
+
me(1, J),
|
|
3312
3318
|
me(2, G),
|
|
3313
|
-
me(3,
|
|
3319
|
+
me(3, xe),
|
|
3314
3320
|
me(4, A(V)),
|
|
3315
3321
|
me(5, A(At)),
|
|
3316
3322
|
me(6, re),
|
|
@@ -3319,7 +3325,7 @@ rn = Ps([
|
|
|
3319
3325
|
], rn);
|
|
3320
3326
|
const ks = (i) => {
|
|
3321
3327
|
var v;
|
|
3322
|
-
const t = qe(G), e = qe(tt), n = qe(ie), r = qe(
|
|
3328
|
+
const t = qe(G), e = qe(tt), n = qe(ie), r = qe(J), { drawings: s } = i, o = s[0];
|
|
3323
3329
|
if (o == null)
|
|
3324
3330
|
return;
|
|
3325
3331
|
const { unitId: a } = o, d = r.getRenderById(a), u = d == null ? void 0 : d.scene;
|
|
@@ -3332,11 +3338,11 @@ const ks = (i) => {
|
|
|
3332
3338
|
const { oKey: w } = C, y = R.getDrawingOKey(w);
|
|
3333
3339
|
if (y == null)
|
|
3334
3340
|
return S.push(null), !0;
|
|
3335
|
-
const { unitId: D, subUnitId:
|
|
3341
|
+
const { unitId: D, subUnitId: T, drawingId: E, drawingType: M, anchorType: b, sheetTransform: N } = y;
|
|
3336
3342
|
S.push({
|
|
3337
3343
|
unitId: D,
|
|
3338
|
-
subUnitId:
|
|
3339
|
-
drawingId:
|
|
3344
|
+
subUnitId: T,
|
|
3345
|
+
drawingId: E,
|
|
3340
3346
|
anchorType: b,
|
|
3341
3347
|
sheetTransform: N,
|
|
3342
3348
|
drawingType: M
|
|
@@ -3380,7 +3386,7 @@ const ks = (i) => {
|
|
|
3380
3386
|
return /* @__PURE__ */ qt(
|
|
3381
3387
|
"div",
|
|
3382
3388
|
{
|
|
3383
|
-
className:
|
|
3389
|
+
className: bi("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
|
|
3384
3390
|
"univer-hidden": !l
|
|
3385
3391
|
}),
|
|
3386
3392
|
children: [
|
|
@@ -3391,7 +3397,7 @@ const ks = (i) => {
|
|
|
3391
3397
|
children: /* @__PURE__ */ oe("div", { children: e.t("drawing-anchor.title") })
|
|
3392
3398
|
}
|
|
3393
3399
|
),
|
|
3394
|
-
/* @__PURE__ */ oe("div", { children: /* @__PURE__ */ qt(
|
|
3400
|
+
/* @__PURE__ */ oe("div", { children: /* @__PURE__ */ qt(Mi, { value: f, onChange: _, direction: "vertical", children: [
|
|
3395
3401
|
/* @__PURE__ */ oe(Yt, { value: O.Both, children: e.t("drawing-anchor.both") }),
|
|
3396
3402
|
/* @__PURE__ */ oe(Yt, { value: O.Position, children: e.t("drawing-anchor.position") }),
|
|
3397
3403
|
/* @__PURE__ */ oe(Yt, { value: O.None, children: e.t("drawing-anchor.none") })
|
|
@@ -3420,7 +3426,7 @@ function Bs(i) {
|
|
|
3420
3426
|
icon: "AddImageIcon",
|
|
3421
3427
|
tooltip: "sheetImage.title",
|
|
3422
3428
|
hidden$: an(i, F.UNIVER_SHEET),
|
|
3423
|
-
disabled$:
|
|
3429
|
+
disabled$: Yr(i, { workbookTypes: [zt], worksheetTypes: [Kt], rangeTypes: [Ci] })
|
|
3424
3430
|
};
|
|
3425
3431
|
}
|
|
3426
3432
|
function js(i) {
|
|
@@ -3456,7 +3462,7 @@ const Fs = {
|
|
|
3456
3462
|
}
|
|
3457
3463
|
};
|
|
3458
3464
|
function it(i) {
|
|
3459
|
-
return !i.getContextValue(
|
|
3465
|
+
return !i.getContextValue(ti) && !i.getContextValue(ni) && !i.getContextValue(ri) && i.getContextValue($e);
|
|
3460
3466
|
}
|
|
3461
3467
|
const xs = {
|
|
3462
3468
|
id: rt.id,
|
|
@@ -3562,7 +3568,7 @@ Ut = Hs([
|
|
|
3562
3568
|
ke(2, G),
|
|
3563
3569
|
ke(3, xi),
|
|
3564
3570
|
ke(4, ie),
|
|
3565
|
-
ke(5, A(
|
|
3571
|
+
ke(5, A(on))
|
|
3566
3572
|
], Ut);
|
|
3567
3573
|
var zs = Object.defineProperty, Ks = Object.getOwnPropertyDescriptor, Js = (i, t, e) => t in i ? zs(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, Zs = (i, t, e, n) => {
|
|
3568
3574
|
for (var r = n > 1 ? void 0 : n ? Ks(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
@@ -3570,10 +3576,10 @@ var zs = Object.defineProperty, Ks = Object.getOwnPropertyDescriptor, Js = (i, t
|
|
|
3570
3576
|
return r;
|
|
3571
3577
|
}, Lt = (i, t) => (e, n) => t(e, n, i), Dr = (i, t, e) => Js(i, typeof t != "symbol" ? t + "" : t, e);
|
|
3572
3578
|
const qs = "SHEET_IMAGE_UI_PLUGIN";
|
|
3573
|
-
let Pt = class extends
|
|
3579
|
+
let Pt = class extends oi {
|
|
3574
3580
|
constructor(i = jn, t, e, n) {
|
|
3575
3581
|
super(), this._config = i, this._injector = t, this._renderManagerService = e, this._configService = n;
|
|
3576
|
-
const { menu: r, ...s } =
|
|
3582
|
+
const { menu: r, ...s } = ai(
|
|
3577
3583
|
{},
|
|
3578
3584
|
jn,
|
|
3579
3585
|
this._config
|
|
@@ -3581,29 +3587,29 @@ let Pt = class extends Vr {
|
|
|
3581
3587
|
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(ss, s);
|
|
3582
3588
|
}
|
|
3583
3589
|
onStarting() {
|
|
3584
|
-
|
|
3590
|
+
ci(this._injector, [
|
|
3585
3591
|
[et],
|
|
3586
3592
|
[Ut],
|
|
3587
3593
|
[Rt],
|
|
3588
3594
|
[Ot],
|
|
3589
|
-
[Tt],
|
|
3590
3595
|
[Et],
|
|
3596
|
+
[Tt],
|
|
3591
3597
|
[bt],
|
|
3592
3598
|
[Mt],
|
|
3593
3599
|
[yt]
|
|
3594
|
-
]),
|
|
3600
|
+
]), xt(this._injector, [
|
|
3595
3601
|
[et]
|
|
3596
3602
|
]);
|
|
3597
3603
|
}
|
|
3598
3604
|
onReady() {
|
|
3599
|
-
|
|
3600
|
-
[
|
|
3605
|
+
xt(this._injector, [
|
|
3606
|
+
[Tt],
|
|
3601
3607
|
[yt]
|
|
3602
3608
|
]);
|
|
3603
3609
|
}
|
|
3604
3610
|
onRendered() {
|
|
3605
|
-
this._registerRenderModules(),
|
|
3606
|
-
[
|
|
3611
|
+
this._registerRenderModules(), xt(this._injector, [
|
|
3612
|
+
[Et],
|
|
3607
3613
|
[Ot],
|
|
3608
3614
|
[Ut],
|
|
3609
3615
|
[bt],
|
|
@@ -3627,10 +3633,10 @@ let Pt = class extends Vr {
|
|
|
3627
3633
|
Dr(Pt, "type", F.UNIVER_SHEET);
|
|
3628
3634
|
Dr(Pt, "pluginName", qs);
|
|
3629
3635
|
Pt = Zs([
|
|
3630
|
-
|
|
3631
|
-
Lt(1, A(
|
|
3632
|
-
Lt(2,
|
|
3633
|
-
Lt(3,
|
|
3636
|
+
ii(Ui, Xi, Ki, di),
|
|
3637
|
+
Lt(1, A(Xe)),
|
|
3638
|
+
Lt(2, J),
|
|
3639
|
+
Lt(3, si)
|
|
3634
3640
|
], Pt);
|
|
3635
3641
|
export {
|
|
3636
3642
|
Y as ClearSheetDrawingTransformerOperation,
|
|
@@ -3648,5 +3654,8 @@ export {
|
|
|
3648
3654
|
Qe as SheetDrawingUpdateController,
|
|
3649
3655
|
wr as SidebarSheetDrawingOperation,
|
|
3650
3656
|
mr as UngroupSheetDrawingCommand,
|
|
3651
|
-
Pt as UniverSheetsDrawingUIPlugin
|
|
3657
|
+
Pt as UniverSheetsDrawingUIPlugin,
|
|
3658
|
+
ge as calcSheetFloatDomPosition,
|
|
3659
|
+
z as drawingPositionToTransform,
|
|
3660
|
+
$ as transformToDrawingPosition
|
|
3652
3661
|
};
|