@univerjs/sheets-drawing-ui 0.12.3 → 0.12.4
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/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +439 -395
- package/lib/es/index.js +1786 -1234
- package/lib/es/locale/ca-ES.js +15 -2
- package/lib/es/locale/en-US.js +13 -0
- package/lib/es/locale/es-ES.js +13 -0
- package/lib/es/locale/fa-IR.js +13 -0
- package/lib/es/locale/fr-FR.js +13 -0
- package/lib/es/locale/ja-JP.js +13 -0
- package/lib/es/locale/ko-KR.js +13 -0
- package/lib/es/locale/ru-RU.js +13 -0
- package/lib/es/locale/vi-VN.js +13 -0
- package/lib/es/locale/zh-CN.js +13 -0
- package/lib/es/locale/zh-TW.js +17 -4
- package/lib/facade.js +439 -395
- package/lib/index.css +1 -1
- package/lib/index.js +1786 -1234
- package/lib/locale/ca-ES.js +15 -2
- package/lib/locale/en-US.js +13 -0
- package/lib/locale/es-ES.js +13 -0
- package/lib/locale/fa-IR.js +13 -0
- package/lib/locale/fr-FR.js +13 -0
- package/lib/locale/ja-JP.js +13 -0
- package/lib/locale/ko-KR.js +13 -0
- package/lib/locale/ru-RU.js +13 -0
- package/lib/locale/vi-VN.js +13 -0
- package/lib/locale/zh-CN.js +13 -0
- package/lib/locale/zh-TW.js +17 -4
- package/lib/types/commands/commands/save-cell-images.command.d.ts +2 -0
- package/lib/types/facade/f-range.d.ts +40 -0
- package/lib/types/facade/f-worksheet.d.ts +29 -0
- package/lib/types/index.d.ts +3 -1
- package/lib/types/locale/en-US.d.ts +13 -0
- package/lib/types/services/batch-save-images.service.d.ts +148 -0
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +2 -0
- package/lib/types/views/batch-save-images/BatchSaveImagesDialog.d.ts +16 -0
- package/lib/types/views/batch-save-images/component-name.d.ts +16 -0
- package/lib/types/views/batch-save-images/index.d.ts +17 -0
- package/lib/types/views/menu/save-images.menu.d.ts +4 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +16 -15
package/lib/es/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { precisionTo as
|
|
5
|
-
import { convertPositionSheetOverGridToAbsolute as
|
|
6
|
-
import { CommandType as
|
|
7
|
-
import { ISheetDrawingService as
|
|
8
|
-
import { SheetInterceptorService as
|
|
9
|
-
import { MessageType as
|
|
10
|
-
import { docDrawingPositionToTransform as
|
|
11
|
-
import { IImageIoService as
|
|
12
|
-
import { ILocalFileService as
|
|
13
|
-
import { DocDrawingController as
|
|
14
|
-
import { ImageCropperObject as
|
|
15
|
-
import { takeUntil as
|
|
16
|
-
import { jsx as
|
|
17
|
-
import { useMemo as
|
|
18
|
-
function
|
|
1
|
+
var Qr = Object.defineProperty;
|
|
2
|
+
var ei = (i, t, e) => t in i ? Qr(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var re = (i, t, e) => ei(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { precisionTo as bt, IRenderManagerService as Q, transformObjectOutOfGroup as ti, getGroupState as ni, getCurrentTypeOfRenderer as Dn, CURSOR_TYPE as ri, RENDER_CLASS_TYPE as $e, Rect as ke, ObjectType as An, DRAWING_OBJECT_LAYER_INDEX as qt, SHEET_VIEWPORT_KEY as cr } from "@univerjs/engine-render";
|
|
5
|
+
import { convertPositionSheetOverGridToAbsolute as ii, SheetSkeletonManagerService as X, ISheetSelectionRenderService as Ze, attachRangeWithCoord as dr, SheetCanvasPopManagerService as si, HoverManagerService as oi, IEditorBridgeService as ai, IAutoFillService as ci, EditingRenderController as di, SetCellEditVisibleOperation as Nn, PREDEFINED_HOOK_NAME as Le, COPY_TYPE as Re, discreteRangeToRange as $n, virtualizeDiscreteRanges as li, ISheetClipboardService as ui, SetZoomRatioOperation as kn, SetScrollOperation as hi, SheetPrintInterceptorService as gi, useHighlightRange as fi, getCurrentRangeDisable$ as mi } from "@univerjs/sheets-ui";
|
|
6
|
+
import { CommandType as q, ICommandService as Y, IUndoRedoService as Je, sequenceExecute as lr, DrawingTypeEnum as x, ArrangeTypeEnum as Mt, Inject as A, IContextService as ur, LocaleService as Te, Injector as qe, Disposable as ee, createDocumentModelWithStyle as un, ObjectRelativeFromV as xn, ObjectRelativeFromH as Wn, WrapTextType as Bn, PositionedObjectLayoutType as jn, BooleanNumber as Fn, BuildTextUtils as hn, ImageSourceType as Ce, generateRandomId as Ve, FOCUSING_COMMON_DRAWINGS as Ge, IUniverInstanceService as de, UniverInstanceType as $, Direction as ve, createIdentifier as pi, IImageIoService as hr, RxDisposable as wi, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as ot, DOCS_ZEN_EDITOR_UNIT_ID_KEY as He, InterceptorEffectEnum as _i, ObjectMatrix as Si, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as vi, IPermissionService as Ii, UserManagerService as Ci, LifecycleService as Ri, LifecycleStages as Di, DisposableCollection as yt, fromEventSubject as bi, Tools as Ye, PRINT_CHART_COMPONENT_KEY as Mi, Rectangle as yi, FOCUSING_FX_BAR_EDITOR as Ei, EDITOR_ACTIVATED as Ti, FOCUSING_PANEL_EDITOR as Oi, DependentOn as Ui, IConfigService as Pi, Plugin as Ai, merge as Ni, registerDependencies as $i, touchDependencies as Qt } from "@univerjs/core";
|
|
7
|
+
import { ISheetDrawingService as se, DrawingApplyType as U, SetDrawingApplyMutation as P, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as ki } from "@univerjs/sheets-drawing";
|
|
8
|
+
import { SheetInterceptorService as Vt, SheetsSelectionsService as ut, SetRangeValuesCommand as Ln, getSheetCommandTarget as ae, INTERCEPTOR_POINT as xi, InterceptCellContentPriority as Wi, WorkbookViewPermission as Vn, WorksheetViewPermission as Hn, WorkbookEditablePermission as gn, WorksheetEditPermission as fn, SetFrozenMutation as Bi, SetSelectionsOperation as ji, SetWorksheetRowAutoHeightMutation as Fi, COMMAND_LISTENER_SKELETON_CHANGE as Li, InsertRowCommand as gr, InsertColCommand as fr, RemoveRowCommand as mr, RemoveColCommand as pr, DeleteRangeMoveLeftCommand as wr, DeleteRangeMoveUpCommand as _r, InsertRangeMoveDownCommand as Sr, InsertRangeMoveRightCommand as vr, DeltaRowHeightCommand as mn, SetRowHeightCommand as pn, DeltaColumnWidthCommand as Ir, SetColWidthCommand as Cr, SetRowHiddenCommand as Rr, SetSpecificRowsVisibleCommand as Dr, SetSpecificColsVisibleCommand as br, SetColHiddenCommand as Mr, MoveColsCommand as yr, MoveRowsCommand as Er, MoveRangeCommand as Tr, SetRowVisibleMutation as Vi, SetRowHiddenMutation as Hi, SetColVisibleMutation as Yi, SetColHiddenMutation as Gi, SetWorksheetRowHeightMutation as Xi, SetWorksheetColWidthMutation as zi, SetWorksheetActiveOperation as Ki, RangeProtectionPermissionEditPoint as Zi } from "@univerjs/sheets";
|
|
9
|
+
import { MessageType as Se, render as Ji, unmount as qi, FormLayout as en, CheckboxGroup as Qi, Checkbox as Yn, Select as es, Button as Gn, clsx as ts, RadioGroup as ns, Radio as tn } from "@univerjs/design";
|
|
10
|
+
import { docDrawingPositionToTransform as Xn, ReplaceSnapshotCommand as rs, InnerPasteCommand as is } from "@univerjs/docs-ui";
|
|
11
|
+
import { IImageIoService as ss, IDrawingManagerService as oe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as zn, DRAWING_IMAGE_COUNT_LIMIT as Kn, ImageUploadStatusType as xe, DRAWING_IMAGE_ALLOW_SIZE as Zn, getImageSize as nn, SetDrawingSelectedOperation as Ht, DRAWING_IMAGE_WIDTH_LIMIT as Jn, DRAWING_IMAGE_HEIGHT_LIMIT as qn, ImageSourceType as os, getDrawingShapeKeyByDrawingSearch as De, UniverDrawingPlugin as as } from "@univerjs/drawing";
|
|
12
|
+
import { ILocalFileService as cs, IMessageService as Or, IDialogService as bn, ISidebarService as ds, IClipboardInterfaceService as ls, CanvasFloatDomService as us, PrintFloatDomSingle as hs, ComponentManager as Ur, connectInjector as gs, useDependency as Ie, getMenuHiddenObservable as Yt, MenuItemType as Gt, ContextMenuPosition as rn, ContextMenuGroup as sn, RibbonInsertGroup as fs, KeyCode as Ke, IMenuManagerService as ms, IShortcutService as ps } from "@univerjs/ui";
|
|
13
|
+
import { DocDrawingController as ws, UniverDocsDrawingPlugin as _s } from "@univerjs/docs-drawing";
|
|
14
|
+
import { ImageCropperObject as Ss, COMPONENT_IMAGE_POPUP_MENU as vs, OpenImageCropOperation as Is, ImageResetSizeOperation as Cs, DrawingRenderService as Pr, DrawingCommonPanel as Rs, UniverDrawingUIPlugin as Ds } from "@univerjs/drawing-ui";
|
|
15
|
+
import { takeUntil as Qn, throttleTime as bs, combineLatest as at, switchMap as me, EMPTY as we, tap as er, map as pe, distinctUntilChanged as tr, Subject as on, filter as Ms, take as ys, BehaviorSubject as je, of as wn } from "rxjs";
|
|
16
|
+
import { jsx as L, jsxs as Xe } from "react/jsx-runtime";
|
|
17
|
+
import { useMemo as Fe, useRef as Es, createElement as Ar, forwardRef as Ts, useState as Ee, useCallback as Et, useEffect as Nr } from "react";
|
|
18
|
+
function Z(i, t, e) {
|
|
19
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
20
|
if (c == null)
|
|
21
21
|
return;
|
|
22
|
-
const l =
|
|
22
|
+
const l = ii(
|
|
23
23
|
c.unitId,
|
|
24
24
|
c.sheetId,
|
|
25
25
|
{ from: n, to: r },
|
|
26
26
|
e
|
|
27
27
|
);
|
|
28
|
-
let { left: g, top: h, width: f, height:
|
|
29
|
-
const
|
|
30
|
-
return g + f >
|
|
28
|
+
let { left: g, top: h, width: f, height: m } = l;
|
|
29
|
+
const p = e.getCurrentSkeleton(), w = p.rowHeaderWidth + p.columnTotalWidth, S = p.columnHeaderHeight + p.rowTotalHeight;
|
|
30
|
+
return g + f > w && (g = w - f), h + m > S && (h = S - m), {
|
|
31
31
|
flipY: s,
|
|
32
32
|
flipX: o,
|
|
33
33
|
angle: a,
|
|
@@ -36,26 +36,26 @@ function z(i, t, e) {
|
|
|
36
36
|
left: g,
|
|
37
37
|
top: h,
|
|
38
38
|
width: f,
|
|
39
|
-
height:
|
|
39
|
+
height: m
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function j(i, t) {
|
|
43
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
44
|
if (l == null)
|
|
45
45
|
return;
|
|
46
46
|
const g = {
|
|
47
47
|
column: l.actualColumn,
|
|
48
|
-
columnOffset:
|
|
48
|
+
columnOffset: bt(e - l.startX, 1),
|
|
49
49
|
row: l.actualRow,
|
|
50
|
-
rowOffset:
|
|
50
|
+
rowOffset: bt(n - l.startY, 1)
|
|
51
51
|
}, h = t.getCellWithCoordByOffset(e + r, n + s);
|
|
52
52
|
if (h == null)
|
|
53
53
|
return;
|
|
54
54
|
const f = {
|
|
55
55
|
column: h.actualColumn,
|
|
56
|
-
columnOffset:
|
|
56
|
+
columnOffset: bt(e + r - h.startX, 1),
|
|
57
57
|
row: h.actualRow,
|
|
58
|
-
rowOffset:
|
|
58
|
+
rowOffset: bt(n + s - h.startY, 1)
|
|
59
59
|
};
|
|
60
60
|
return {
|
|
61
61
|
flipY: o,
|
|
@@ -67,50 +67,50 @@ function $(i, t) {
|
|
|
67
67
|
to: f
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const V = {
|
|
71
71
|
id: "sheet.operation.clear-drawing-transformer",
|
|
72
|
-
type:
|
|
72
|
+
type: q.MUTATION,
|
|
73
73
|
handler: (i, t) => {
|
|
74
|
-
const e = i.get(
|
|
74
|
+
const e = i.get(Q);
|
|
75
75
|
return t.forEach((n) => {
|
|
76
76
|
var r, s;
|
|
77
77
|
(s = (r = e.getRenderById(n)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
|
|
78
78
|
}), !0;
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, ht = {
|
|
81
81
|
id: "sheet.command.remove-sheet-image",
|
|
82
|
-
type:
|
|
82
|
+
type: q.COMMAND,
|
|
83
83
|
handler: (i, t) => {
|
|
84
|
-
var
|
|
85
|
-
const e = i.get(
|
|
84
|
+
var S, I, D;
|
|
85
|
+
const e = i.get(Y), n = i.get(Je), r = i.get(Vt), s = i.get(se);
|
|
86
86
|
if (!t) return !1;
|
|
87
87
|
const { drawings: o } = t, a = [];
|
|
88
|
-
o.forEach((
|
|
89
|
-
const { unitId: C } =
|
|
88
|
+
o.forEach((v) => {
|
|
89
|
+
const { unitId: C } = v;
|
|
90
90
|
a.push(C);
|
|
91
91
|
});
|
|
92
|
-
const d = s.getBatchRemoveOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, f = r.onCommandExecute({ id:
|
|
93
|
-
return
|
|
92
|
+
const d = s.getBatchRemoveOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, f = r.onCommandExecute({ id: ht.id, params: t }), m = { id: P.id, params: { unitId: u, subUnitId: c, op: g, objects: h, type: U.REMOVE } }, p = { id: P.id, params: { unitId: u, subUnitId: c, op: l, objects: h, type: U.INSERT } };
|
|
93
|
+
return lr([...(S = f.preRedos) != null ? S : [], m, ...f.redos], e) ? (n.pushUndoRedo({
|
|
94
94
|
unitID: u,
|
|
95
95
|
undoMutations: [
|
|
96
96
|
...(I = f.preUndos) != null ? I : [],
|
|
97
|
-
|
|
97
|
+
p,
|
|
98
98
|
...f.undos,
|
|
99
|
-
{ id:
|
|
99
|
+
{ id: V.id, params: a }
|
|
100
100
|
],
|
|
101
101
|
redoMutations: [
|
|
102
|
-
...(
|
|
103
|
-
|
|
102
|
+
...(D = f.preRedos) != null ? D : [],
|
|
103
|
+
m,
|
|
104
104
|
...f.redos,
|
|
105
|
-
{ id:
|
|
105
|
+
{ id: V.id, params: a }
|
|
106
106
|
]
|
|
107
107
|
}), !0) : !1;
|
|
108
108
|
}
|
|
109
|
-
},
|
|
109
|
+
}, $r = {
|
|
110
110
|
id: "sheet.command.delete-drawing",
|
|
111
|
-
type:
|
|
111
|
+
type: q.COMMAND,
|
|
112
112
|
handler: (i) => {
|
|
113
|
-
const t = i.get(
|
|
113
|
+
const t = i.get(Y), n = i.get(se).getFocusDrawings();
|
|
114
114
|
if (n.length === 0)
|
|
115
115
|
return !1;
|
|
116
116
|
const r = n[0].unitId, s = n.map((o) => {
|
|
@@ -122,21 +122,21 @@ const Y = {
|
|
|
122
122
|
drawingType: c
|
|
123
123
|
};
|
|
124
124
|
});
|
|
125
|
-
return t.executeCommand(
|
|
125
|
+
return t.executeCommand(ht.id, {
|
|
126
126
|
unitId: r,
|
|
127
127
|
drawings: s
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
|
-
function
|
|
131
|
+
function Os(i) {
|
|
132
132
|
const t = [];
|
|
133
133
|
return i.forEach((e) => {
|
|
134
|
-
const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, d =
|
|
135
|
-
const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId:
|
|
134
|
+
const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, d = ni(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
|
|
135
|
+
const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: m } = l;
|
|
136
136
|
return {
|
|
137
137
|
unitId: h,
|
|
138
138
|
subUnitId: f,
|
|
139
|
-
drawingId:
|
|
139
|
+
drawingId: m,
|
|
140
140
|
transform: {
|
|
141
141
|
...g,
|
|
142
142
|
left: g.left - d.left,
|
|
@@ -148,7 +148,7 @@ function es(i) {
|
|
|
148
148
|
unitId: s,
|
|
149
149
|
subUnitId: o,
|
|
150
150
|
drawingId: a,
|
|
151
|
-
drawingType:
|
|
151
|
+
drawingType: x.DRAWING_GROUP,
|
|
152
152
|
transform: d
|
|
153
153
|
};
|
|
154
154
|
t.push({
|
|
@@ -157,26 +157,26 @@ function es(i) {
|
|
|
157
157
|
});
|
|
158
158
|
}), t;
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function Us(i) {
|
|
161
161
|
const t = [];
|
|
162
162
|
return i.forEach((e) => {
|
|
163
163
|
const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a, transform: d = { width: 0, height: 0 } } = n;
|
|
164
164
|
if (d == null)
|
|
165
165
|
return;
|
|
166
166
|
const u = r.map((l) => {
|
|
167
|
-
const { transform: g } = l, { unitId: h, subUnitId: f, drawingId:
|
|
167
|
+
const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: m } = l, p = ti(g || {}, d, d.width || 0, d.height || 0);
|
|
168
168
|
return {
|
|
169
169
|
unitId: h,
|
|
170
170
|
subUnitId: f,
|
|
171
|
-
drawingId:
|
|
172
|
-
transform:
|
|
171
|
+
drawingId: m,
|
|
172
|
+
transform: p,
|
|
173
173
|
groupId: void 0
|
|
174
174
|
};
|
|
175
175
|
}), c = {
|
|
176
176
|
unitId: s,
|
|
177
177
|
subUnitId: o,
|
|
178
178
|
drawingId: a,
|
|
179
|
-
drawingType:
|
|
179
|
+
drawingType: x.DRAWING_GROUP,
|
|
180
180
|
transform: {
|
|
181
181
|
left: 0,
|
|
182
182
|
top: 0
|
|
@@ -188,64 +188,64 @@ function ts(i) {
|
|
|
188
188
|
});
|
|
189
189
|
}), t;
|
|
190
190
|
}
|
|
191
|
-
const
|
|
191
|
+
const kr = {
|
|
192
192
|
id: "sheet.command.group-sheet-image",
|
|
193
|
-
type:
|
|
193
|
+
type: q.COMMAND,
|
|
194
194
|
handler: (i, t) => {
|
|
195
|
-
const e = i.get(
|
|
195
|
+
const e = i.get(Y), n = i.get(Je), r = i.get(se);
|
|
196
196
|
if (!t) return !1;
|
|
197
197
|
const s = [];
|
|
198
198
|
t.forEach(({ parent: h, children: f }) => {
|
|
199
|
-
s.push(h.unitId), f.forEach((
|
|
200
|
-
s.push(
|
|
199
|
+
s.push(h.unitId), f.forEach((m) => {
|
|
200
|
+
s.push(m.unitId);
|
|
201
201
|
});
|
|
202
202
|
});
|
|
203
203
|
const o = r.getGroupDrawingOp(t), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
|
|
204
204
|
return e.syncExecuteCommand(P.id, { op: c, unitId: a, subUnitId: d, objects: l, type: U.GROUP }) ? (n.pushUndoRedo({
|
|
205
205
|
unitID: a,
|
|
206
206
|
undoMutations: [
|
|
207
|
-
{ id: P.id, params: { op: u, unitId: a, subUnitId: d, objects:
|
|
208
|
-
{ id:
|
|
207
|
+
{ id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: Us(l), type: U.UNGROUP } },
|
|
208
|
+
{ id: V.id, params: s }
|
|
209
209
|
],
|
|
210
210
|
redoMutations: [
|
|
211
211
|
{ id: P.id, params: { op: c, unitId: a, subUnitId: d, objects: l, type: U.GROUP } },
|
|
212
|
-
{ id:
|
|
212
|
+
{ id: V.id, params: s }
|
|
213
213
|
]
|
|
214
214
|
}), !0) : !1;
|
|
215
215
|
}
|
|
216
|
-
},
|
|
216
|
+
}, Xt = {
|
|
217
217
|
id: "sheet.command.insert-sheet-image",
|
|
218
|
-
type:
|
|
218
|
+
type: q.COMMAND,
|
|
219
219
|
handler: (i, t) => {
|
|
220
|
-
var
|
|
221
|
-
const e = i.get(
|
|
220
|
+
var S, I, D;
|
|
221
|
+
const e = i.get(Y), n = i.get(Je), r = i.get(se), s = i.get(Vt);
|
|
222
222
|
if (!t) return !1;
|
|
223
|
-
const o = t.drawings, a = o.map((
|
|
224
|
-
return
|
|
223
|
+
const o = t.drawings, a = o.map((v) => v.unitId), d = r.getBatchAddOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, f = s.onCommandExecute({ id: Xt.id, params: t }), m = { id: P.id, params: { op: g, unitId: u, subUnitId: c, objects: h, type: U.INSERT } }, p = { id: P.id, params: { op: l, unitId: u, subUnitId: c, objects: h, type: U.REMOVE } };
|
|
224
|
+
return lr([...(S = f.preRedos) != null ? S : [], m, ...f.redos], e) ? (n.pushUndoRedo({
|
|
225
225
|
unitID: u,
|
|
226
226
|
undoMutations: [
|
|
227
227
|
...(I = f.preUndos) != null ? I : [],
|
|
228
|
-
|
|
228
|
+
p,
|
|
229
229
|
...f.undos,
|
|
230
|
-
{ id:
|
|
230
|
+
{ id: V.id, params: a }
|
|
231
231
|
],
|
|
232
232
|
redoMutations: [
|
|
233
|
-
...(
|
|
234
|
-
|
|
233
|
+
...(D = f.preRedos) != null ? D : [],
|
|
234
|
+
m,
|
|
235
235
|
...f.redos,
|
|
236
|
-
{ id:
|
|
236
|
+
{ id: V.id, params: a }
|
|
237
237
|
]
|
|
238
238
|
}), !0) : !1;
|
|
239
239
|
}
|
|
240
|
-
},
|
|
240
|
+
}, xr = {
|
|
241
241
|
id: "sheet.command.set-drawing-arrange",
|
|
242
|
-
type:
|
|
242
|
+
type: q.COMMAND,
|
|
243
243
|
handler: (i, t) => {
|
|
244
|
-
const e = i.get(
|
|
244
|
+
const e = i.get(Y), n = i.get(Je);
|
|
245
245
|
if (!t) return !1;
|
|
246
|
-
const r = i.get(
|
|
246
|
+
const r = i.get(se), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: d } = t, u = { unitId: s, subUnitId: o, drawingIds: a };
|
|
247
247
|
let c;
|
|
248
|
-
if (d ===
|
|
248
|
+
if (d === Mt.forward ? c = r.getForwardDrawingsOp(u) : d === Mt.backward ? c = r.getBackwardDrawingOp(u) : d === Mt.front ? c = r.getFrontDrawingsOp(u) : d === Mt.back && (c = r.getBackDrawingsOp(u)), c == null)
|
|
249
249
|
return !1;
|
|
250
250
|
const { objects: l, redo: g, undo: h } = c;
|
|
251
251
|
return e.syncExecuteCommand(P.id, { op: g, unitId: s, subUnitId: o, objects: l, type: U.ARRANGE }) ? (n.pushUndoRedo({
|
|
@@ -258,94 +258,94 @@ const gr = {
|
|
|
258
258
|
]
|
|
259
259
|
}), !0) : !1;
|
|
260
260
|
}
|
|
261
|
-
},
|
|
261
|
+
}, zt = {
|
|
262
262
|
id: "sheet.command.set-sheet-image",
|
|
263
|
-
type:
|
|
263
|
+
type: q.COMMAND,
|
|
264
264
|
handler: (i, t) => {
|
|
265
|
-
const e = i.get(
|
|
265
|
+
const e = i.get(Y), n = i.get(Je), r = i.get(se);
|
|
266
266
|
if (!t) return !1;
|
|
267
267
|
const { drawings: s } = t, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
|
|
268
268
|
return e.syncExecuteCommand(P.id, { unitId: a, subUnitId: d, op: c, objects: l, type: U.UPDATE }) ? (n.pushUndoRedo({
|
|
269
269
|
unitID: a,
|
|
270
270
|
undoMutations: [
|
|
271
271
|
{ id: P.id, params: { unitId: a, subUnitId: d, op: u, objects: l, type: U.UPDATE } },
|
|
272
|
-
{ id:
|
|
272
|
+
{ id: V.id, params: [a] }
|
|
273
273
|
],
|
|
274
274
|
redoMutations: [
|
|
275
275
|
{ id: P.id, params: { unitId: a, subUnitId: d, op: c, objects: l, type: U.UPDATE } },
|
|
276
|
-
{ id:
|
|
276
|
+
{ id: V.id, params: [a] }
|
|
277
277
|
]
|
|
278
278
|
}), !0) : !1;
|
|
279
279
|
}
|
|
280
|
-
},
|
|
280
|
+
}, Wr = {
|
|
281
281
|
id: "sheet.command.ungroup-sheet-image",
|
|
282
|
-
type:
|
|
282
|
+
type: q.COMMAND,
|
|
283
283
|
handler: (i, t) => {
|
|
284
|
-
const e = i.get(
|
|
284
|
+
const e = i.get(Y), n = i.get(Je), r = i.get(se);
|
|
285
285
|
if (!t) return !1;
|
|
286
286
|
const s = [];
|
|
287
287
|
t.forEach(({ parent: h, children: f }) => {
|
|
288
|
-
s.push(h.unitId), f.forEach((
|
|
289
|
-
s.push(
|
|
288
|
+
s.push(h.unitId), f.forEach((m) => {
|
|
289
|
+
s.push(m.unitId);
|
|
290
290
|
});
|
|
291
291
|
});
|
|
292
292
|
const o = r.getUngroupDrawingOp(t), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
|
|
293
293
|
return e.syncExecuteCommand(P.id, { op: c, unitId: a, subUnitId: d, objects: l, type: U.UNGROUP }) ? (n.pushUndoRedo({
|
|
294
294
|
unitID: a,
|
|
295
295
|
undoMutations: [
|
|
296
|
-
{ id: P.id, params: { op: u, unitId: a, subUnitId: d, objects:
|
|
297
|
-
{ id:
|
|
296
|
+
{ id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: Os(l), type: U.GROUP } },
|
|
297
|
+
{ id: V.id, params: s }
|
|
298
298
|
],
|
|
299
299
|
redoMutations: [
|
|
300
300
|
{ id: P.id, params: { op: c, unitId: a, subUnitId: d, objects: l, type: U.UNGROUP } },
|
|
301
|
-
{ id:
|
|
301
|
+
{ id: V.id, params: s }
|
|
302
302
|
]
|
|
303
303
|
}), !0) : !1;
|
|
304
304
|
}
|
|
305
305
|
};
|
|
306
|
-
var
|
|
307
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
306
|
+
var Ps = Object.getOwnPropertyDescriptor, As = (i, t, e, n) => {
|
|
307
|
+
for (var r = n > 1 ? void 0 : n ? Ps(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
308
308
|
(o = i[s]) && (r = o(r) || r);
|
|
309
309
|
return r;
|
|
310
|
-
},
|
|
311
|
-
function
|
|
310
|
+
}, ie = (i, t) => (e, n) => t(e, n, i);
|
|
311
|
+
function Ns(i, t, e) {
|
|
312
312
|
const n = e * Math.PI / 180, r = Math.abs(i * Math.cos(n)) + Math.abs(t * Math.sin(n)), s = Math.abs(i * Math.sin(n)) + Math.abs(t * Math.cos(n));
|
|
313
313
|
return { rotatedWidth: r, rotatedHeight: s };
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
var
|
|
317
|
-
const { rotatedHeight: s, rotatedWidth: o } =
|
|
315
|
+
function _n(i, t, e, n, r) {
|
|
316
|
+
var S;
|
|
317
|
+
const { rotatedHeight: s, rotatedWidth: o } = Ns(e, n, r), d = i.get(Q).getRenderById(t.unitId);
|
|
318
318
|
if (!d)
|
|
319
319
|
return !1;
|
|
320
|
-
const c = (
|
|
320
|
+
const c = (S = d.with(X).getSkeletonParam(t.subUnitId)) == null ? void 0 : S.skeleton;
|
|
321
321
|
if (c == null)
|
|
322
322
|
return !1;
|
|
323
|
-
const l = c.getCellByIndex(t.row, t.col), g = l.mergeInfo.endX - l.mergeInfo.startX - 2, h = l.mergeInfo.endY - l.mergeInfo.startY - 2, f = o / s,
|
|
323
|
+
const l = c.getCellByIndex(t.row, t.col), g = l.mergeInfo.endX - l.mergeInfo.startX - 2, h = l.mergeInfo.endY - l.mergeInfo.startY - 2, f = o / s, p = Math.ceil(Math.min(g, h * f)) / o, w = !p || Number.isNaN(p) ? 1e-3 : p;
|
|
324
324
|
return {
|
|
325
|
-
width: e *
|
|
326
|
-
height: n *
|
|
325
|
+
width: e * w,
|
|
326
|
+
height: n * w
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
|
-
let
|
|
329
|
+
let dt = class extends ee {
|
|
330
330
|
constructor(t, e, n, r, s, o, a, d, u, c, l, g, h) {
|
|
331
331
|
super();
|
|
332
|
-
|
|
332
|
+
re(this, "_workbookSelections");
|
|
333
333
|
this._context = t, this._skeletonManagerService = e, this._commandService = n, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = a, this._drawingManagerService = d, this._contextService = u, this._messageService = c, this._localeService = l, this._injector = h, this._workbookSelections = g.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
|
|
334
334
|
}
|
|
335
335
|
async insertFloatImage() {
|
|
336
336
|
const t = await this._fileOpenerService.openFile({
|
|
337
337
|
multiple: !0,
|
|
338
|
-
accept:
|
|
338
|
+
accept: zn.map((n) => `.${n.replace("image/", "")}`).join(",")
|
|
339
339
|
}), e = t.length;
|
|
340
|
-
return e >
|
|
341
|
-
type:
|
|
342
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(
|
|
340
|
+
return e > Kn ? (this._messageService.show({
|
|
341
|
+
type: Se.Error,
|
|
342
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(Kn))
|
|
343
343
|
}), !1) : e === 0 ? !1 : (t.forEach(async (n) => await this.insertFloatImageByFile(n)), !0);
|
|
344
344
|
}
|
|
345
345
|
async insertCellImage() {
|
|
346
346
|
const e = (await this._fileOpenerService.openFile({
|
|
347
347
|
multiple: !1,
|
|
348
|
-
accept:
|
|
348
|
+
accept: zn.map((n) => `.${n.replace("image/", "")}`).join(",")
|
|
349
349
|
}))[0];
|
|
350
350
|
return e ? (await this._insertCellImage(e), !0) : !1;
|
|
351
351
|
}
|
|
@@ -356,75 +356,75 @@ let et = class extends ne {
|
|
|
356
356
|
let e;
|
|
357
357
|
try {
|
|
358
358
|
e = await this._imageIoService.saveImage(t);
|
|
359
|
-
} catch (
|
|
360
|
-
const I =
|
|
361
|
-
I ===
|
|
362
|
-
type:
|
|
363
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
364
|
-
}) : I ===
|
|
365
|
-
type:
|
|
359
|
+
} catch (S) {
|
|
360
|
+
const I = S.message;
|
|
361
|
+
I === xe.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
362
|
+
type: Se.Error,
|
|
363
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(Zn / (1024 * 1024)))
|
|
364
|
+
}) : I === xe.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
365
|
+
type: Se.Error,
|
|
366
366
|
content: this._localeService.t("update-status.invalidImageType")
|
|
367
|
-
}) : I ===
|
|
368
|
-
type:
|
|
367
|
+
}) : I === xe.ERROR_IMAGE && this._messageService.show({
|
|
368
|
+
type: Se.Error,
|
|
369
369
|
content: this._localeService.t("update-status.invalidImage")
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
if (e == null)
|
|
373
373
|
return;
|
|
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
|
|
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 nn(u || ""), { width: h, height: f } = this._context.scene;
|
|
375
375
|
this._imageIoService.addImageSourceCache(d, a, g);
|
|
376
|
-
let
|
|
377
|
-
if (c >
|
|
378
|
-
const
|
|
379
|
-
|
|
376
|
+
let m = 1;
|
|
377
|
+
if (c > Jn || l > qn) {
|
|
378
|
+
const S = Jn / c, I = qn / l;
|
|
379
|
+
m = Math.max(S, I);
|
|
380
380
|
}
|
|
381
|
-
const
|
|
382
|
-
if (
|
|
381
|
+
const p = this._getImagePosition(c * m, l * m, h, f);
|
|
382
|
+
if (p == null)
|
|
383
383
|
return;
|
|
384
|
-
const
|
|
384
|
+
const w = {
|
|
385
385
|
unitId: r,
|
|
386
386
|
subUnitId: s,
|
|
387
387
|
drawingId: o,
|
|
388
|
-
drawingType:
|
|
388
|
+
drawingType: x.DRAWING_IMAGE,
|
|
389
389
|
imageSourceType: a,
|
|
390
390
|
source: d,
|
|
391
|
-
transform:
|
|
392
|
-
sheetTransform:
|
|
391
|
+
transform: Z(p, this._selectionRenderService, this._skeletonManagerService),
|
|
392
|
+
sheetTransform: p
|
|
393
393
|
};
|
|
394
|
-
return this._commandService.executeCommand(
|
|
394
|
+
return this._commandService.executeCommand(Xt.id, {
|
|
395
395
|
unitId: r,
|
|
396
|
-
drawings: [
|
|
396
|
+
drawings: [w]
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
399
|
// eslint-disable-next-line max-lines-per-function
|
|
400
400
|
async _insertCellImage(t, e) {
|
|
401
|
-
var I,
|
|
401
|
+
var I, D;
|
|
402
402
|
let n;
|
|
403
403
|
try {
|
|
404
404
|
n = await this._imageIoService.saveImage(t);
|
|
405
|
-
} catch (
|
|
406
|
-
const C =
|
|
407
|
-
C ===
|
|
408
|
-
type:
|
|
409
|
-
content: this._localeService.t("update-status.exceedMaxSize", String(
|
|
410
|
-
}) : C ===
|
|
411
|
-
type:
|
|
405
|
+
} catch (v) {
|
|
406
|
+
const C = v.message;
|
|
407
|
+
C === xe.ERROR_EXCEED_SIZE ? this._messageService.show({
|
|
408
|
+
type: Se.Error,
|
|
409
|
+
content: this._localeService.t("update-status.exceedMaxSize", String(Zn / (1024 * 1024)))
|
|
410
|
+
}) : C === xe.ERROR_IMAGE_TYPE ? this._messageService.show({
|
|
411
|
+
type: Se.Error,
|
|
412
412
|
content: this._localeService.t("update-status.invalidImageType")
|
|
413
|
-
}) : C ===
|
|
414
|
-
type:
|
|
413
|
+
}) : C === xe.ERROR_IMAGE && this._messageService.show({
|
|
414
|
+
type: Se.Error,
|
|
415
415
|
content: this._localeService.t("update-status.invalidImage")
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
if (n == null)
|
|
419
419
|
return !1;
|
|
420
|
-
const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = n, { width: d, height: u, image: c } = await
|
|
420
|
+
const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = n, { width: d, height: u, image: c } = await nn(a || "");
|
|
421
421
|
this._imageIoService.addImageSourceCache(o, s, c);
|
|
422
422
|
const l = this._workbookSelections.getCurrentLastSelection();
|
|
423
423
|
if (!l)
|
|
424
424
|
return !1;
|
|
425
425
|
let g = l.primary.actualRow, h = l.primary.actualColumn;
|
|
426
426
|
l.primary.isMerged && (g = l.primary.startRow, h = l.primary.startColumn);
|
|
427
|
-
const f =
|
|
427
|
+
const f = un("", {}), m = _n(
|
|
428
428
|
this._injector,
|
|
429
429
|
{
|
|
430
430
|
unitId: this._context.unitId,
|
|
@@ -436,54 +436,54 @@ let et = class extends ne {
|
|
|
436
436
|
u,
|
|
437
437
|
0
|
|
438
438
|
);
|
|
439
|
-
if (!
|
|
439
|
+
if (!m)
|
|
440
440
|
return !1;
|
|
441
|
-
const
|
|
441
|
+
const p = {
|
|
442
442
|
size: {
|
|
443
|
-
width:
|
|
444
|
-
height:
|
|
443
|
+
width: m.width,
|
|
444
|
+
height: m.height
|
|
445
445
|
},
|
|
446
446
|
positionH: {
|
|
447
|
-
relativeFrom:
|
|
447
|
+
relativeFrom: Wn.PAGE,
|
|
448
448
|
posOffset: 0
|
|
449
449
|
},
|
|
450
450
|
positionV: {
|
|
451
|
-
relativeFrom:
|
|
451
|
+
relativeFrom: xn.PARAGRAPH,
|
|
452
452
|
posOffset: 0
|
|
453
453
|
},
|
|
454
454
|
angle: 0
|
|
455
|
-
},
|
|
455
|
+
}, w = {
|
|
456
456
|
unitId: f.getUnitId(),
|
|
457
457
|
subUnitId: f.getUnitId(),
|
|
458
458
|
drawingId: r,
|
|
459
|
-
drawingType:
|
|
459
|
+
drawingType: x.DRAWING_IMAGE,
|
|
460
460
|
imageSourceType: s,
|
|
461
461
|
source: o,
|
|
462
|
-
transform:
|
|
463
|
-
docTransform:
|
|
464
|
-
behindDoc:
|
|
462
|
+
transform: Xn(p),
|
|
463
|
+
docTransform: p,
|
|
464
|
+
behindDoc: Fn.FALSE,
|
|
465
465
|
title: "",
|
|
466
466
|
description: "",
|
|
467
|
-
layoutType:
|
|
467
|
+
layoutType: jn.INLINE,
|
|
468
468
|
// Insert inline drawing by default.
|
|
469
|
-
wrapText:
|
|
469
|
+
wrapText: Bn.BOTH_SIDES,
|
|
470
470
|
distB: 0,
|
|
471
471
|
distL: 0,
|
|
472
472
|
distR: 0,
|
|
473
473
|
distT: 0
|
|
474
|
-
},
|
|
474
|
+
}, S = hn.drawing.add({
|
|
475
475
|
documentDataModel: f,
|
|
476
|
-
drawings: [
|
|
476
|
+
drawings: [w],
|
|
477
477
|
selection: {
|
|
478
478
|
collapsed: !0,
|
|
479
479
|
startOffset: 0,
|
|
480
480
|
endOffset: 0
|
|
481
481
|
}
|
|
482
482
|
});
|
|
483
|
-
return
|
|
483
|
+
return S ? (f.apply(S), this._commandService.syncExecuteCommand(Ln.id, {
|
|
484
484
|
value: {
|
|
485
485
|
[(I = e == null ? void 0 : e.row) != null ? I : g]: {
|
|
486
|
-
[(
|
|
486
|
+
[(D = e == null ? void 0 : e.col) != null ? D : h]: {
|
|
487
487
|
p: f.getSnapshot(),
|
|
488
488
|
t: 1
|
|
489
489
|
}
|
|
@@ -496,12 +496,12 @@ let et = class extends ne {
|
|
|
496
496
|
// eslint-disable-next-line max-lines-per-function
|
|
497
497
|
async insertCellImageByUrl(t, e) {
|
|
498
498
|
var g, h;
|
|
499
|
-
const { width: n, height: r, image: s } = await
|
|
500
|
-
this._imageIoService.addImageSourceCache(t,
|
|
499
|
+
const { width: n, height: r, image: s } = await nn(t || "");
|
|
500
|
+
this._imageIoService.addImageSourceCache(t, Ce.URL, s);
|
|
501
501
|
const o = this._workbookSelections.getCurrentLastSelection();
|
|
502
502
|
if (!o)
|
|
503
503
|
return !1;
|
|
504
|
-
const a =
|
|
504
|
+
const a = un("", {}), d = _n(
|
|
505
505
|
this._injector,
|
|
506
506
|
{
|
|
507
507
|
unitId: this._context.unitId,
|
|
@@ -521,34 +521,34 @@ let et = class extends ne {
|
|
|
521
521
|
height: d.height
|
|
522
522
|
},
|
|
523
523
|
positionH: {
|
|
524
|
-
relativeFrom:
|
|
524
|
+
relativeFrom: Wn.PAGE,
|
|
525
525
|
posOffset: 0
|
|
526
526
|
},
|
|
527
527
|
positionV: {
|
|
528
|
-
relativeFrom:
|
|
528
|
+
relativeFrom: xn.PARAGRAPH,
|
|
529
529
|
posOffset: 0
|
|
530
530
|
},
|
|
531
531
|
angle: 0
|
|
532
532
|
}, c = {
|
|
533
533
|
unitId: a.getUnitId(),
|
|
534
534
|
subUnitId: a.getUnitId(),
|
|
535
|
-
drawingId:
|
|
536
|
-
drawingType:
|
|
537
|
-
imageSourceType:
|
|
535
|
+
drawingId: Ve(),
|
|
536
|
+
drawingType: x.DRAWING_IMAGE,
|
|
537
|
+
imageSourceType: Ce.URL,
|
|
538
538
|
source: t,
|
|
539
|
-
transform:
|
|
539
|
+
transform: Xn(u),
|
|
540
540
|
docTransform: u,
|
|
541
|
-
behindDoc:
|
|
541
|
+
behindDoc: Fn.FALSE,
|
|
542
542
|
title: "",
|
|
543
543
|
description: "",
|
|
544
|
-
layoutType:
|
|
544
|
+
layoutType: jn.INLINE,
|
|
545
545
|
// Insert inline drawing by default.
|
|
546
|
-
wrapText:
|
|
546
|
+
wrapText: Bn.BOTH_SIDES,
|
|
547
547
|
distB: 0,
|
|
548
548
|
distL: 0,
|
|
549
549
|
distR: 0,
|
|
550
550
|
distT: 0
|
|
551
|
-
}, l =
|
|
551
|
+
}, l = hn.drawing.add({
|
|
552
552
|
documentDataModel: a,
|
|
553
553
|
drawings: [c],
|
|
554
554
|
selection: {
|
|
@@ -557,7 +557,7 @@ let et = class extends ne {
|
|
|
557
557
|
endOffset: 0
|
|
558
558
|
}
|
|
559
559
|
});
|
|
560
|
-
return l ? (a.apply(l), this._commandService.syncExecuteCommand(
|
|
560
|
+
return l ? (a.apply(l), this._commandService.syncExecuteCommand(Ln.id, {
|
|
561
561
|
value: {
|
|
562
562
|
[(g = e == null ? void 0 : e.row) != null ? g : o.primary.actualRow]: {
|
|
563
563
|
[(h = e == null ? void 0 : e.col) != null ? h : o.primary.actualColumn]: {
|
|
@@ -586,15 +586,15 @@ let et = class extends ne {
|
|
|
586
586
|
endColumn: 0
|
|
587
587
|
};
|
|
588
588
|
s && s.length > 0 && (o = s[s.length - 1].range);
|
|
589
|
-
const a =
|
|
589
|
+
const a = dr(this._skeletonManagerService.getCurrent().skeleton, o);
|
|
590
590
|
if (a == null)
|
|
591
591
|
return;
|
|
592
592
|
let { startColumn: d, startRow: u, startX: c, startY: l } = a, g = !1;
|
|
593
593
|
if (c + t > n && (c = n - t, c < 0 && (c = 0, t = n), g = !0), l + e > r && (l = r - e, l < 0 && (l = 0, e = r), g = !0), g) {
|
|
594
|
-
const
|
|
595
|
-
if (
|
|
594
|
+
const p = this._selectionRenderService.getCellWithCoordByOffset(c, l);
|
|
595
|
+
if (p == null)
|
|
596
596
|
return;
|
|
597
|
-
c =
|
|
597
|
+
c = p.startX, l = p.startY, d = p.actualColumn, u = p.actualRow;
|
|
598
598
|
}
|
|
599
599
|
const h = {
|
|
600
600
|
column: d,
|
|
@@ -604,7 +604,7 @@ let et = class extends ne {
|
|
|
604
604
|
}, f = this._selectionRenderService.getCellWithCoordByOffset(c + t, l + e);
|
|
605
605
|
if (f == null)
|
|
606
606
|
return;
|
|
607
|
-
const
|
|
607
|
+
const m = {
|
|
608
608
|
column: f.actualColumn,
|
|
609
609
|
columnOffset: c + t - f.startX,
|
|
610
610
|
row: f.actualRow,
|
|
@@ -612,13 +612,13 @@ let et = class extends ne {
|
|
|
612
612
|
};
|
|
613
613
|
return {
|
|
614
614
|
from: h,
|
|
615
|
-
to:
|
|
615
|
+
to: m
|
|
616
616
|
};
|
|
617
617
|
}
|
|
618
618
|
_updateOrderListener() {
|
|
619
619
|
this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((t) => {
|
|
620
620
|
const { unitId: e, subUnitId: n, drawingIds: r, arrangeType: s } = t;
|
|
621
|
-
this._commandService.executeCommand(
|
|
621
|
+
this._commandService.executeCommand(xr.id, {
|
|
622
622
|
unitId: e,
|
|
623
623
|
subUnitId: n,
|
|
624
624
|
drawingIds: r,
|
|
@@ -636,16 +636,16 @@ let et = class extends ne {
|
|
|
636
636
|
const u = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
|
|
637
637
|
if (u == null || u.unitId !== this._context.unitId)
|
|
638
638
|
return;
|
|
639
|
-
const c =
|
|
639
|
+
const c = j({ ...u.transform, ...d }, this._selectionRenderService);
|
|
640
640
|
if (c == null)
|
|
641
641
|
return;
|
|
642
642
|
const l = {
|
|
643
643
|
...n,
|
|
644
|
-
transform: { ...u.transform, ...d, ...
|
|
644
|
+
transform: { ...u.transform, ...d, ...Z(c, this._selectionRenderService, this._skeletonManagerService) },
|
|
645
645
|
sheetTransform: { ...c }
|
|
646
646
|
};
|
|
647
647
|
e.push(l);
|
|
648
|
-
}), e.length > 0 && this._commandService.executeCommand(
|
|
648
|
+
}), e.length > 0 && this._commandService.executeCommand(zt.id, {
|
|
649
649
|
unitId: t[0].unitId,
|
|
650
650
|
drawings: e
|
|
651
651
|
}));
|
|
@@ -653,45 +653,45 @@ let et = class extends ne {
|
|
|
653
653
|
}
|
|
654
654
|
_groupDrawingListener() {
|
|
655
655
|
this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((t) => {
|
|
656
|
-
this._commandService.executeCommand(
|
|
656
|
+
this._commandService.executeCommand(kr.id, t);
|
|
657
657
|
const { unitId: e, subUnitId: n, drawingId: r } = t[0].parent;
|
|
658
|
-
this._commandService.syncExecuteCommand(
|
|
658
|
+
this._commandService.syncExecuteCommand(Ht.id, [{ unitId: e, subUnitId: n, drawingId: r }]);
|
|
659
659
|
})), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((t) => {
|
|
660
|
-
this._commandService.executeCommand(
|
|
660
|
+
this._commandService.executeCommand(Wr.id, t);
|
|
661
661
|
}));
|
|
662
662
|
}
|
|
663
663
|
_focusDrawingListener() {
|
|
664
664
|
this.disposeWithMe(
|
|
665
665
|
this._drawingManagerService.focus$.subscribe((t) => {
|
|
666
|
-
t == null || t.length === 0 ? (this._contextService.setContextValue(
|
|
666
|
+
t == null || t.length === 0 ? (this._contextService.setContextValue(Ge, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(Ge, !0), this._sheetDrawingService.focusDrawing(t));
|
|
667
667
|
})
|
|
668
668
|
);
|
|
669
669
|
}
|
|
670
670
|
};
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
],
|
|
685
|
-
const
|
|
671
|
+
dt = As([
|
|
672
|
+
ie(1, A(X)),
|
|
673
|
+
ie(2, Y),
|
|
674
|
+
ie(3, Ze),
|
|
675
|
+
ie(4, ss),
|
|
676
|
+
ie(5, cs),
|
|
677
|
+
ie(6, se),
|
|
678
|
+
ie(7, oe),
|
|
679
|
+
ie(8, ur),
|
|
680
|
+
ie(9, Or),
|
|
681
|
+
ie(10, A(Te)),
|
|
682
|
+
ie(11, A(ut)),
|
|
683
|
+
ie(12, A(qe))
|
|
684
|
+
], dt);
|
|
685
|
+
const Kt = {
|
|
686
686
|
id: "sheet.command.insert-float-image",
|
|
687
|
-
type:
|
|
687
|
+
type: q.COMMAND,
|
|
688
688
|
handler: async (i, t) => {
|
|
689
689
|
var o, a;
|
|
690
|
-
const e = i.get(
|
|
691
|
-
|
|
690
|
+
const e = i.get(de), n = i.get(Q), r = (o = Dn(
|
|
691
|
+
$.UNIVER_SHEET,
|
|
692
692
|
e,
|
|
693
693
|
n
|
|
694
|
-
)) == null ? void 0 : o.with(
|
|
694
|
+
)) == null ? void 0 : o.with(dt);
|
|
695
695
|
if (!r)
|
|
696
696
|
return !1;
|
|
697
697
|
const s = t == null ? void 0 : t.files;
|
|
@@ -701,23 +701,23 @@ const Bt = {
|
|
|
701
701
|
} else
|
|
702
702
|
return (a = r.insertFloatImage()) != null ? a : !1;
|
|
703
703
|
}
|
|
704
|
-
},
|
|
704
|
+
}, Mn = {
|
|
705
705
|
id: "sheet.command.insert-cell-image",
|
|
706
|
-
type:
|
|
706
|
+
type: q.COMMAND,
|
|
707
707
|
handler: (i) => {
|
|
708
708
|
var n, r;
|
|
709
|
-
const t = i.get(
|
|
710
|
-
return (r = (n =
|
|
711
|
-
|
|
709
|
+
const t = i.get(de), e = i.get(Q);
|
|
710
|
+
return (r = (n = Dn(
|
|
711
|
+
$.UNIVER_SHEET,
|
|
712
712
|
t,
|
|
713
713
|
e
|
|
714
|
-
)) == null ? void 0 : n.with(
|
|
714
|
+
)) == null ? void 0 : n.with(dt).insertCellImage()) != null ? r : !1;
|
|
715
715
|
}
|
|
716
|
-
},
|
|
716
|
+
}, gt = {
|
|
717
717
|
id: "sheet.command.move-drawing",
|
|
718
|
-
type:
|
|
718
|
+
type: q.COMMAND,
|
|
719
719
|
handler: (i, t) => {
|
|
720
|
-
const e = i.get(
|
|
720
|
+
const e = i.get(Y), n = i.get(se), r = i.get(Ze), { direction: s } = t, o = n.getFocusDrawings();
|
|
721
721
|
if (o.length === 0)
|
|
722
722
|
return !1;
|
|
723
723
|
const a = o[0].unitId, d = o.map((c) => {
|
|
@@ -725,30 +725,345 @@ const Bt = {
|
|
|
725
725
|
if (l == null)
|
|
726
726
|
return null;
|
|
727
727
|
const g = { ...l }, { left: h = 0, top: f = 0 } = l;
|
|
728
|
-
return s ===
|
|
728
|
+
return s === ve.UP ? g.top = f - 1 : s === ve.DOWN ? g.top = f + 1 : s === ve.LEFT ? g.left = h - 1 : s === ve.RIGHT && (g.left = h + 1), {
|
|
729
729
|
...c,
|
|
730
730
|
transform: g,
|
|
731
|
-
sheetTransform:
|
|
731
|
+
sheetTransform: j(g, r)
|
|
732
732
|
};
|
|
733
733
|
}).filter((c) => c != null);
|
|
734
|
-
return e.syncExecuteCommand(
|
|
734
|
+
return e.syncExecuteCommand(zt.id, {
|
|
735
735
|
unitId: a,
|
|
736
736
|
drawings: d
|
|
737
|
-
}) ? (e.syncExecuteCommand(
|
|
737
|
+
}) ? (e.syncExecuteCommand(V.id, [a]), !0) : !1;
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
var $s = Object.getOwnPropertyDescriptor, ks = (i, t, e, n) => {
|
|
741
|
+
for (var r = n > 1 ? void 0 : n ? $s(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
742
|
+
(o = i[s]) && (r = o(r) || r);
|
|
743
|
+
return r;
|
|
744
|
+
}, an = (i, t) => (e, n) => t(e, n, i), ye = /* @__PURE__ */ ((i) => (i.CELL_ADDRESS = "cellAddress", i.COLUMN_VALUE = "columnValue", i))(ye || {});
|
|
745
|
+
const yn = pi("sheets-drawing-ui.batch-save-images.service");
|
|
746
|
+
function Sn(i) {
|
|
747
|
+
let t = "", e = i;
|
|
748
|
+
for (; e >= 0; )
|
|
749
|
+
t = String.fromCharCode(e % 26 + 65) + t, e = Math.floor(e / 26) - 1;
|
|
750
|
+
return t;
|
|
751
|
+
}
|
|
752
|
+
function At(i, t) {
|
|
753
|
+
return `${Sn(t)}${i + 1}`;
|
|
754
|
+
}
|
|
755
|
+
function xs(i) {
|
|
756
|
+
const t = At(i.startRow, i.startColumn), e = At(i.endRow, i.endColumn);
|
|
757
|
+
return t === e ? t : `${t}:${e}`;
|
|
758
|
+
}
|
|
759
|
+
function nr(i) {
|
|
760
|
+
var t, e, n, r;
|
|
761
|
+
return !!((e = (t = i == null ? void 0 : i.p) == null ? void 0 : t.drawingsOrder) != null && e.length && ((r = (n = i == null ? void 0 : i.p) == null ? void 0 : n.drawingsOrder) == null ? void 0 : r.length) > 0);
|
|
762
|
+
}
|
|
763
|
+
function rr(i) {
|
|
764
|
+
var n, r, s;
|
|
765
|
+
if (!((r = (n = i.p) == null ? void 0 : n.drawingsOrder) != null && r.length) || !((s = i.p) != null && s.drawings))
|
|
766
|
+
return null;
|
|
767
|
+
const t = i.p.drawingsOrder[0], e = i.p.drawings[t];
|
|
768
|
+
return !e || !("source" in e) || !("imageSourceType" in e) ? null : e;
|
|
769
|
+
}
|
|
770
|
+
function cn(i, t) {
|
|
771
|
+
if (t === Ce.BASE64) {
|
|
772
|
+
const e = i.match(/^data:image\/(\w+);/);
|
|
773
|
+
if (e)
|
|
774
|
+
return e[1] === "jpeg" ? "jpg" : e[1];
|
|
775
|
+
}
|
|
776
|
+
if (t === Ce.URL) {
|
|
777
|
+
const e = i.match(/\.(\w+)(?:\?|$)/);
|
|
778
|
+
if (e)
|
|
779
|
+
return e[1].toLowerCase();
|
|
780
|
+
}
|
|
781
|
+
return "png";
|
|
782
|
+
}
|
|
783
|
+
async function ir(i, t) {
|
|
784
|
+
if (t === Ce.BASE64)
|
|
785
|
+
return (await fetch(i)).blob();
|
|
786
|
+
if (t === Ce.URL)
|
|
787
|
+
return (await fetch(i)).blob();
|
|
788
|
+
throw new Error("UUID image type requires additional handling");
|
|
789
|
+
}
|
|
790
|
+
let vn = class extends ee {
|
|
791
|
+
constructor(i, t, e) {
|
|
792
|
+
super(), this._univerInstanceService = i, this._selectionService = t, this._imageIoService = e;
|
|
793
|
+
}
|
|
794
|
+
getCellImagesInSelection() {
|
|
795
|
+
const i = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
|
|
796
|
+
if (!i) return [];
|
|
797
|
+
const t = i.getActiveSheet();
|
|
798
|
+
if (!t) return [];
|
|
799
|
+
const e = this._selectionService.getCurrentSelections();
|
|
800
|
+
if (!e || e.length === 0) return [];
|
|
801
|
+
const n = t.getCellMatrix(), r = [];
|
|
802
|
+
for (const s of e) {
|
|
803
|
+
const { startRow: o, endRow: a, startColumn: d, endColumn: u } = s.range;
|
|
804
|
+
for (let c = o; c <= a; c++)
|
|
805
|
+
for (let l = d; l <= u; l++) {
|
|
806
|
+
const g = n.getValue(c, l);
|
|
807
|
+
if (nr(g)) {
|
|
808
|
+
const h = rr(g);
|
|
809
|
+
h && r.push({
|
|
810
|
+
row: c,
|
|
811
|
+
col: l,
|
|
812
|
+
cellAddress: At(c, l),
|
|
813
|
+
source: h.source,
|
|
814
|
+
imageSourceType: h.imageSourceType,
|
|
815
|
+
imageId: h.drawingId
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
return r;
|
|
821
|
+
}
|
|
822
|
+
getCellImagesFromRanges(i, t, e) {
|
|
823
|
+
const n = this._univerInstanceService.getUnit(i, $.UNIVER_SHEET);
|
|
824
|
+
if (!n) return [];
|
|
825
|
+
const r = n.getSheetBySheetId(t);
|
|
826
|
+
if (!r) return [];
|
|
827
|
+
const s = r.getCellMatrix(), o = [];
|
|
828
|
+
for (const a of e) {
|
|
829
|
+
const { startRow: d, endRow: u, startColumn: c, endColumn: l } = a;
|
|
830
|
+
for (let g = d; g <= u; g++)
|
|
831
|
+
for (let h = c; h <= l; h++) {
|
|
832
|
+
const f = s.getValue(g, h);
|
|
833
|
+
if (nr(f)) {
|
|
834
|
+
const m = rr(f);
|
|
835
|
+
m && o.push({
|
|
836
|
+
row: g,
|
|
837
|
+
col: h,
|
|
838
|
+
cellAddress: At(g, h),
|
|
839
|
+
source: m.source,
|
|
840
|
+
imageSourceType: m.imageSourceType,
|
|
841
|
+
imageId: m.drawingId
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
return o;
|
|
847
|
+
}
|
|
848
|
+
getDataColumns() {
|
|
849
|
+
var l, g, h, f;
|
|
850
|
+
const i = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
|
|
851
|
+
if (!i) return [];
|
|
852
|
+
const t = i.getActiveSheet();
|
|
853
|
+
if (!t) return [];
|
|
854
|
+
const e = this._selectionService.getCurrentSelections();
|
|
855
|
+
if (!e || e.length === 0) return [];
|
|
856
|
+
const n = t.getCellMatrix(), r = n.getDataRange();
|
|
857
|
+
let s = 1 / 0, o = -1 / 0;
|
|
858
|
+
const a = /* @__PURE__ */ new Set();
|
|
859
|
+
for (const m of e) {
|
|
860
|
+
s = Math.min(s, m.range.startRow), o = Math.max(o, m.range.endRow);
|
|
861
|
+
for (let p = m.range.startColumn; p <= m.range.endColumn; p++)
|
|
862
|
+
a.add(p);
|
|
863
|
+
}
|
|
864
|
+
const d = /* @__PURE__ */ new Set();
|
|
865
|
+
for (let m = r.startColumn; m <= r.endColumn; m++)
|
|
866
|
+
if (!a.has(m))
|
|
867
|
+
for (let p = s; p <= o; p++) {
|
|
868
|
+
const w = n.getValue(p, m);
|
|
869
|
+
if (w && (((l = w.v) == null ? void 0 : l.toString()) || ((f = (h = (g = w.p) == null ? void 0 : g.body) == null ? void 0 : h.dataStream) == null ? void 0 : f.trim()) || "")) {
|
|
870
|
+
d.add(m);
|
|
871
|
+
break;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
const u = [], c = Array.from(d).sort((m, p) => m - p);
|
|
875
|
+
for (const m of c)
|
|
876
|
+
u.push({
|
|
877
|
+
index: m,
|
|
878
|
+
label: Sn(m)
|
|
879
|
+
});
|
|
880
|
+
return u;
|
|
881
|
+
}
|
|
882
|
+
getDataColumnsForRanges(i, t, e) {
|
|
883
|
+
var h, f, m, p;
|
|
884
|
+
const n = this._univerInstanceService.getUnit(i, $.UNIVER_SHEET);
|
|
885
|
+
if (!n) return [];
|
|
886
|
+
const r = n.getSheetBySheetId(t);
|
|
887
|
+
if (!r) return [];
|
|
888
|
+
const s = r.getCellMatrix(), o = s.getDataRange();
|
|
889
|
+
let a = 1 / 0, d = -1 / 0;
|
|
890
|
+
const u = /* @__PURE__ */ new Set();
|
|
891
|
+
for (const w of e) {
|
|
892
|
+
a = Math.min(a, w.startRow), d = Math.max(d, w.endRow);
|
|
893
|
+
for (let S = w.startColumn; S <= w.endColumn; S++)
|
|
894
|
+
u.add(S);
|
|
895
|
+
}
|
|
896
|
+
const c = /* @__PURE__ */ new Set();
|
|
897
|
+
for (let w = o.startColumn; w <= o.endColumn; w++)
|
|
898
|
+
if (!u.has(w))
|
|
899
|
+
for (let S = a; S <= d; S++) {
|
|
900
|
+
const I = s.getValue(S, w);
|
|
901
|
+
if (I && (((h = I.v) == null ? void 0 : h.toString()) || ((p = (m = (f = I.p) == null ? void 0 : f.body) == null ? void 0 : m.dataStream) == null ? void 0 : p.trim()) || "")) {
|
|
902
|
+
c.add(w);
|
|
903
|
+
break;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
const l = [], g = Array.from(c).sort((w, S) => w - S);
|
|
907
|
+
for (const w of g)
|
|
908
|
+
l.push({
|
|
909
|
+
index: w,
|
|
910
|
+
label: Sn(w)
|
|
911
|
+
});
|
|
912
|
+
return l;
|
|
913
|
+
}
|
|
914
|
+
getSelectionRangeNotation() {
|
|
915
|
+
const i = this._selectionService.getCurrentSelections();
|
|
916
|
+
return !i || i.length === 0 ? "" : i.map((t) => xs(t.range)).join(", ");
|
|
917
|
+
}
|
|
918
|
+
getSelectionRowRange() {
|
|
919
|
+
const i = this._selectionService.getCurrentSelections();
|
|
920
|
+
if (!i || i.length === 0) return null;
|
|
921
|
+
let t = 1 / 0, e = -1 / 0;
|
|
922
|
+
for (const n of i)
|
|
923
|
+
t = Math.min(t, n.range.startRow), e = Math.max(e, n.range.endRow);
|
|
924
|
+
return { startRow: t, endRow: e };
|
|
738
925
|
}
|
|
739
|
-
|
|
926
|
+
getSelectionColumnIndices() {
|
|
927
|
+
const i = this._selectionService.getCurrentSelections();
|
|
928
|
+
if (!i || i.length === 0) return /* @__PURE__ */ new Set();
|
|
929
|
+
const t = /* @__PURE__ */ new Set();
|
|
930
|
+
for (const e of i)
|
|
931
|
+
for (let n = e.range.startColumn; n <= e.range.endColumn; n++)
|
|
932
|
+
t.add(n);
|
|
933
|
+
return t;
|
|
934
|
+
}
|
|
935
|
+
generateFileName(i, t) {
|
|
936
|
+
var s, o, a, d;
|
|
937
|
+
const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET), n = cn(i.source, i.imageSourceType), r = [];
|
|
938
|
+
for (const u of t.fileNameParts)
|
|
939
|
+
if (u === "cellAddress")
|
|
940
|
+
r.push(i.cellAddress);
|
|
941
|
+
else if (u === "columnValue" && t.columnIndex !== void 0) {
|
|
942
|
+
const c = e == null ? void 0 : e.getActiveSheet();
|
|
943
|
+
if (c) {
|
|
944
|
+
const g = c.getCellMatrix().getValue(i.row, t.columnIndex);
|
|
945
|
+
if (g) {
|
|
946
|
+
const h = ((s = g.v) == null ? void 0 : s.toString()) || ((d = (a = (o = g.p) == null ? void 0 : o.body) == null ? void 0 : a.dataStream) == null ? void 0 : d.trim()) || "";
|
|
947
|
+
if (h) {
|
|
948
|
+
const f = h.replace(/[<>:"/\\|?*]/g, "_").trim();
|
|
949
|
+
f && r.push(f);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
return r.length === 0 ? `${i.cellAddress}.${n}` : `${r.join("_")}.${n}`;
|
|
955
|
+
}
|
|
956
|
+
generateFileNameWithContext(i, t, e, n) {
|
|
957
|
+
var a, d, u, c;
|
|
958
|
+
const r = this._univerInstanceService.getUnit(e, $.UNIVER_SHEET), s = cn(i.source, i.imageSourceType), o = [];
|
|
959
|
+
for (const l of t.fileNameParts)
|
|
960
|
+
if (l === "cellAddress")
|
|
961
|
+
o.push(i.cellAddress);
|
|
962
|
+
else if (l === "columnValue" && t.columnIndex !== void 0) {
|
|
963
|
+
const g = r == null ? void 0 : r.getSheetBySheetId(n);
|
|
964
|
+
if (g) {
|
|
965
|
+
const f = g.getCellMatrix().getValue(i.row, t.columnIndex);
|
|
966
|
+
if (f) {
|
|
967
|
+
const m = ((a = f.v) == null ? void 0 : a.toString()) || ((c = (u = (d = f.p) == null ? void 0 : d.body) == null ? void 0 : u.dataStream) == null ? void 0 : c.trim()) || "";
|
|
968
|
+
if (m) {
|
|
969
|
+
const p = m.replace(/[<>:"/\\|?*]/g, "_").trim();
|
|
970
|
+
p && o.push(p);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
return o.length === 0 ? `${i.cellAddress}.${s}` : `${o.join("_")}.${s}`;
|
|
976
|
+
}
|
|
977
|
+
async saveImages(i, t) {
|
|
978
|
+
var r;
|
|
979
|
+
const e = await window.showDirectoryPicker({ mode: "readwrite" }), n = /* @__PURE__ */ new Map();
|
|
980
|
+
for (const s of i) {
|
|
981
|
+
let o = this.generateFileName(s, t);
|
|
982
|
+
const a = o.replace(/\.\w+$/, ""), d = ((r = o.match(/\.\w+$/)) == null ? void 0 : r[0]) || ".png", u = n.get(a) || 0;
|
|
983
|
+
u > 0 && (o = `${a}_${u}${d}`), n.set(a, u + 1);
|
|
984
|
+
try {
|
|
985
|
+
const c = await this._getImageBlob(s), g = await (await e.getFileHandle(o, { create: !0 })).createWritable();
|
|
986
|
+
await g.write(c), await g.close();
|
|
987
|
+
} catch (c) {
|
|
988
|
+
throw console.error(`Failed to save image ${o}:`, c), c;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
async saveImagesWithContext(i, t, e, n) {
|
|
993
|
+
var o;
|
|
994
|
+
const r = await window.showDirectoryPicker({ mode: "readwrite" }), s = /* @__PURE__ */ new Map();
|
|
995
|
+
for (const a of i) {
|
|
996
|
+
let d = this.generateFileNameWithContext(a, t, e, n);
|
|
997
|
+
const u = d.replace(/\.\w+$/, ""), c = ((o = d.match(/\.\w+$/)) == null ? void 0 : o[0]) || ".png", l = s.get(u) || 0;
|
|
998
|
+
l > 0 && (d = `${u}_${l}${c}`), s.set(u, l + 1);
|
|
999
|
+
try {
|
|
1000
|
+
const g = await this._getImageBlob(a), f = await (await r.getFileHandle(d, { create: !0 })).createWritable();
|
|
1001
|
+
await f.write(g), await f.close();
|
|
1002
|
+
} catch (g) {
|
|
1003
|
+
throw console.error(`Failed to save image ${d}:`, g), g;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
async downloadSingleImage(i) {
|
|
1008
|
+
const t = cn(i.source, i.imageSourceType), e = `${i.cellAddress}.${t}`;
|
|
1009
|
+
try {
|
|
1010
|
+
const n = await this._getImageBlob(i), r = URL.createObjectURL(n), s = document.createElement("a");
|
|
1011
|
+
s.href = r, s.download = e, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(r);
|
|
1012
|
+
} catch (n) {
|
|
1013
|
+
throw console.error(`Failed to download image ${e}:`, n), n;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
async _getImageBlob(i) {
|
|
1017
|
+
if (i.imageSourceType === Ce.UUID) {
|
|
1018
|
+
const t = await this._imageIoService.getImage(i.source);
|
|
1019
|
+
return ir(t, Ce.URL);
|
|
1020
|
+
}
|
|
1021
|
+
return ir(i.source, i.imageSourceType);
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
vn = ks([
|
|
1025
|
+
an(0, de),
|
|
1026
|
+
an(1, A(ut)),
|
|
1027
|
+
an(2, hr)
|
|
1028
|
+
], vn);
|
|
1029
|
+
const ze = "sheet.dialog.batch-save-images", ct = {
|
|
1030
|
+
id: "sheet.command.save-cell-images",
|
|
1031
|
+
type: q.COMMAND,
|
|
1032
|
+
handler: async (i) => {
|
|
1033
|
+
const t = i.get(bn), e = i.get(yn), n = e.getCellImagesInSelection();
|
|
1034
|
+
if (n.length === 1)
|
|
1035
|
+
try {
|
|
1036
|
+
return await e.downloadSingleImage(n[0]), !0;
|
|
1037
|
+
} catch (a) {
|
|
1038
|
+
return console.error("Failed to download image:", a), !1;
|
|
1039
|
+
}
|
|
1040
|
+
const r = i.get(Te), s = e.getSelectionRangeNotation(), o = `${r.t("sheetImage.save.title")} (${s})`;
|
|
1041
|
+
return t.open({
|
|
1042
|
+
id: ze,
|
|
1043
|
+
draggable: !0,
|
|
1044
|
+
width: 360,
|
|
1045
|
+
title: { title: o },
|
|
1046
|
+
children: {
|
|
1047
|
+
label: ze
|
|
1048
|
+
},
|
|
1049
|
+
destroyOnClose: !0,
|
|
1050
|
+
preservePositionOnDestroy: !0,
|
|
1051
|
+
onClose: () => t.close(ze)
|
|
1052
|
+
}), !0;
|
|
1053
|
+
}
|
|
1054
|
+
}, Br = "COMPONENT_SHEET_DRAWING_PANEL", jr = {
|
|
740
1055
|
id: "sidebar.operation.sheet-image",
|
|
741
|
-
type:
|
|
1056
|
+
type: q.COMMAND,
|
|
742
1057
|
handler: async (i, t) => {
|
|
743
|
-
const e = i.get(
|
|
744
|
-
if (!
|
|
1058
|
+
const e = i.get(ds), n = i.get(Te), r = i.get(de), s = i.get(Y);
|
|
1059
|
+
if (!ae(r)) return !1;
|
|
745
1060
|
switch (t.value) {
|
|
746
1061
|
case "open":
|
|
747
1062
|
e.open({
|
|
748
1063
|
header: { title: n.t("sheetImage.panel.title") },
|
|
749
|
-
children: { label:
|
|
1064
|
+
children: { label: Br },
|
|
750
1065
|
onClose: () => {
|
|
751
|
-
s.syncExecuteCommand(
|
|
1066
|
+
s.syncExecuteCommand(Ht.id, []);
|
|
752
1067
|
},
|
|
753
1068
|
width: 360
|
|
754
1069
|
});
|
|
@@ -760,27 +1075,27 @@ const Bt = {
|
|
|
760
1075
|
}
|
|
761
1076
|
return !0;
|
|
762
1077
|
}
|
|
763
|
-
},
|
|
1078
|
+
}, Fr = {
|
|
764
1079
|
id: "sheet.operation.edit-sheet-image",
|
|
765
|
-
type:
|
|
1080
|
+
type: q.OPERATION,
|
|
766
1081
|
handler: (i, t) => {
|
|
767
|
-
const e = i.get(
|
|
768
|
-
return t == null ? !1 : (e.syncExecuteCommand(
|
|
1082
|
+
const e = i.get(Y);
|
|
1083
|
+
return t == null ? !1 : (e.syncExecuteCommand(Ht.id, [t]), e.executeCommand(jr.id, { value: "open" }), !0);
|
|
769
1084
|
}
|
|
770
|
-
},
|
|
771
|
-
var
|
|
772
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1085
|
+
}, Ws = "sheets-drawing-ui.config", sr = {};
|
|
1086
|
+
var Bs = Object.getOwnPropertyDescriptor, js = (i, t, e, n) => {
|
|
1087
|
+
for (var r = n > 1 ? void 0 : n ? Bs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
773
1088
|
(o = i[s]) && (r = o(r) || r);
|
|
774
1089
|
return r;
|
|
775
1090
|
}, ce = (i, t) => (e, n) => t(e, n, i);
|
|
776
|
-
let
|
|
1091
|
+
let Nt = class extends wi {
|
|
777
1092
|
constructor(t, e, n, r, s, o, a, d, u, c) {
|
|
778
1093
|
super();
|
|
779
|
-
|
|
1094
|
+
re(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
780
1095
|
this._injector = t, this._localeService = e, this._drawingManagerService = n, this._canvasPopManagerService = r, this._renderManagerService = s, this._univerInstanceService = o, this._messageService = a, this._contextService = d, this._ioService = u, this._commandService = c, this._init();
|
|
781
1096
|
}
|
|
782
1097
|
_init() {
|
|
783
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1098
|
+
this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET).pipe(Qn(this.dispose$)).subscribe((t) => this._create(t)), this._univerInstanceService.getTypeOfUnitDisposed$($.UNIVER_SHEET).pipe(Qn(this.dispose$)).subscribe((t) => this._dispose(t)), this._univerInstanceService.getAllUnitsForType($.UNIVER_SHEET).forEach((t) => this._create(t)), this._setupLoadingStatus();
|
|
784
1099
|
}
|
|
785
1100
|
_setupLoadingStatus() {
|
|
786
1101
|
const t = "image-upload-loading";
|
|
@@ -788,7 +1103,7 @@ let Rt = class extends Xr {
|
|
|
788
1103
|
this.disposeWithMe(this._ioService.change$.subscribe((n) => {
|
|
789
1104
|
n > 0 && !e ? e = this._messageService.show({
|
|
790
1105
|
id: t,
|
|
791
|
-
type:
|
|
1106
|
+
type: Se.Loading,
|
|
792
1107
|
content: `${this._localeService.t("uploadLoading.loading")}: ${n}`,
|
|
793
1108
|
duration: 0
|
|
794
1109
|
}) : n === 0 && (e == null || e.dispose(), e = void 0);
|
|
@@ -808,7 +1123,7 @@ let Rt = class extends Xr {
|
|
|
808
1123
|
_hasCropObject(t) {
|
|
809
1124
|
const e = t.getAllObjectsByOrder();
|
|
810
1125
|
for (const n of e)
|
|
811
|
-
if (n instanceof
|
|
1126
|
+
if (n instanceof Ss)
|
|
812
1127
|
return !0;
|
|
813
1128
|
return !1;
|
|
814
1129
|
}
|
|
@@ -823,7 +1138,7 @@ let Rt = class extends Xr {
|
|
|
823
1138
|
let r;
|
|
824
1139
|
this.disposeWithMe(
|
|
825
1140
|
n.createControl$.subscribe(() => {
|
|
826
|
-
if (this._contextService.setContextValue(
|
|
1141
|
+
if (this._contextService.setContextValue(Ge, !0), this._hasCropObject(e))
|
|
827
1142
|
return;
|
|
828
1143
|
const o = n.getSelectedObjectMap();
|
|
829
1144
|
if (o.size > 1) {
|
|
@@ -840,23 +1155,23 @@ let Rt = class extends Xr {
|
|
|
840
1155
|
if (f && f.disablePopup)
|
|
841
1156
|
return;
|
|
842
1157
|
r == null || r.dispose();
|
|
843
|
-
const
|
|
1158
|
+
const m = this._canvasPopManagerService.getFeatureMenu(c, l, g, h);
|
|
844
1159
|
r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
|
|
845
|
-
componentKey:
|
|
1160
|
+
componentKey: vs,
|
|
846
1161
|
direction: "horizontal",
|
|
847
1162
|
offset: [2, 0],
|
|
848
1163
|
extraProps: {
|
|
849
|
-
menuItems:
|
|
1164
|
+
menuItems: m || this._getImageMenuItems(c, l, g, h)
|
|
850
1165
|
}
|
|
851
1166
|
}));
|
|
852
1167
|
})
|
|
853
1168
|
), this.disposeWithMe(
|
|
854
1169
|
n.clearControl$.subscribe(() => {
|
|
855
|
-
r == null || r.dispose(), this._contextService.setContextValue(
|
|
1170
|
+
r == null || r.dispose(), this._contextService.setContextValue(Ge, !1), this._commandService.syncExecuteCommand(Ht.id, []);
|
|
856
1171
|
})
|
|
857
1172
|
), this.disposeWithMe(
|
|
858
1173
|
this._contextService.contextChanged$.subscribe((o) => {
|
|
859
|
-
o[
|
|
1174
|
+
o[Ge] === !1 && (r == null || r.dispose());
|
|
860
1175
|
})
|
|
861
1176
|
), this.disposeWithMe(
|
|
862
1177
|
n.changing$.subscribe(() => {
|
|
@@ -869,62 +1184,62 @@ let Rt = class extends Xr {
|
|
|
869
1184
|
{
|
|
870
1185
|
label: "image-popup.edit",
|
|
871
1186
|
index: 0,
|
|
872
|
-
commandId:
|
|
1187
|
+
commandId: Fr.id,
|
|
873
1188
|
commandParams: { unitId: t, subUnitId: e, drawingId: n },
|
|
874
|
-
disable: r ===
|
|
1189
|
+
disable: r === x.DRAWING_DOM
|
|
875
1190
|
},
|
|
876
1191
|
{
|
|
877
1192
|
label: "image-popup.delete",
|
|
878
1193
|
index: 1,
|
|
879
|
-
commandId:
|
|
1194
|
+
commandId: ht.id,
|
|
880
1195
|
commandParams: { unitId: t, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
|
|
881
1196
|
disable: !1
|
|
882
1197
|
},
|
|
883
1198
|
{
|
|
884
1199
|
label: "image-popup.crop",
|
|
885
1200
|
index: 2,
|
|
886
|
-
commandId:
|
|
1201
|
+
commandId: Is.id,
|
|
887
1202
|
commandParams: { unitId: t, subUnitId: e, drawingId: n },
|
|
888
|
-
disable: r ===
|
|
1203
|
+
disable: r === x.DRAWING_DOM
|
|
889
1204
|
},
|
|
890
1205
|
{
|
|
891
1206
|
label: "image-popup.reset",
|
|
892
1207
|
index: 3,
|
|
893
|
-
commandId:
|
|
1208
|
+
commandId: Cs.id,
|
|
894
1209
|
commandParams: [{ unitId: t, subUnitId: e, drawingId: n }],
|
|
895
|
-
disable: r ===
|
|
1210
|
+
disable: r === x.DRAWING_DOM
|
|
896
1211
|
}
|
|
897
1212
|
];
|
|
898
1213
|
}
|
|
899
1214
|
};
|
|
900
|
-
|
|
901
|
-
ce(0, A(
|
|
902
|
-
ce(1, A(
|
|
903
|
-
ce(2,
|
|
904
|
-
ce(3, A(
|
|
905
|
-
ce(4,
|
|
906
|
-
ce(5,
|
|
907
|
-
ce(6,
|
|
908
|
-
ce(7,
|
|
909
|
-
ce(8,
|
|
910
|
-
ce(9,
|
|
911
|
-
],
|
|
912
|
-
var
|
|
913
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1215
|
+
Nt = js([
|
|
1216
|
+
ce(0, A(qe)),
|
|
1217
|
+
ce(1, A(Te)),
|
|
1218
|
+
ce(2, oe),
|
|
1219
|
+
ce(3, A(si)),
|
|
1220
|
+
ce(4, Q),
|
|
1221
|
+
ce(5, de),
|
|
1222
|
+
ce(6, Or),
|
|
1223
|
+
ce(7, ur),
|
|
1224
|
+
ce(8, hr),
|
|
1225
|
+
ce(9, Y)
|
|
1226
|
+
], Nt);
|
|
1227
|
+
var Fs = Object.getOwnPropertyDescriptor, Ls = (i, t, e, n) => {
|
|
1228
|
+
for (var r = n > 1 ? void 0 : n ? Fs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
914
1229
|
(o = i[s]) && (r = o(r) || r);
|
|
915
1230
|
return r;
|
|
916
|
-
},
|
|
917
|
-
let
|
|
1231
|
+
}, Tt = (i, t) => (e, n) => t(e, n, i);
|
|
1232
|
+
let In = class extends ee {
|
|
918
1233
|
constructor(t, e, n, r, s) {
|
|
919
1234
|
super();
|
|
920
|
-
|
|
1235
|
+
re(this, "_isSetCursor", !1);
|
|
921
1236
|
this._context = t, this._hoverManagerService = e, this._selectionsService = n, this._drawingRenderService = r, this._sheetSkeletonManagerService = s, this._initHover(), this._initImageClick();
|
|
922
1237
|
}
|
|
923
1238
|
_initHover() {
|
|
924
|
-
this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(
|
|
1239
|
+
this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(bs(33)).subscribe((t) => {
|
|
925
1240
|
var n, r;
|
|
926
1241
|
let e = [];
|
|
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(
|
|
1242
|
+
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(ri.ZOOM_IN)) : this._isSetCursor && (this._isSetCursor = !1, this._context.scene.resetCursor());
|
|
928
1243
|
}));
|
|
929
1244
|
}
|
|
930
1245
|
_initImageClick() {
|
|
@@ -938,18 +1253,18 @@ let tn = class extends ne {
|
|
|
938
1253
|
}));
|
|
939
1254
|
}
|
|
940
1255
|
};
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
],
|
|
947
|
-
var
|
|
948
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1256
|
+
In = Ls([
|
|
1257
|
+
Tt(1, A(oi)),
|
|
1258
|
+
Tt(2, A(ut)),
|
|
1259
|
+
Tt(3, A(Pr)),
|
|
1260
|
+
Tt(4, A(X))
|
|
1261
|
+
], In);
|
|
1262
|
+
var Vs = Object.getOwnPropertyDescriptor, Hs = (i, t, e, n) => {
|
|
1263
|
+
for (var r = n > 1 ? void 0 : n ? Vs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
949
1264
|
(o = i[s]) && (r = o(r) || r);
|
|
950
1265
|
return r;
|
|
951
|
-
},
|
|
952
|
-
let
|
|
1266
|
+
}, Ot = (i, t) => (e, n) => t(e, n, i);
|
|
1267
|
+
let Cn = class extends ee {
|
|
953
1268
|
constructor(i, t, e, n, r) {
|
|
954
1269
|
super(), this._context = i, this._sheetDrawingService = t, this._drawingManagerService = e, this._sheetSelectionRenderService = n, this._sheetSkeletonManagerService = r, this._init();
|
|
955
1270
|
}
|
|
@@ -963,27 +1278,27 @@ let nn = class extends ne {
|
|
|
963
1278
|
const e = i[t];
|
|
964
1279
|
for (const n in e.data) {
|
|
965
1280
|
const r = e.data[n];
|
|
966
|
-
r.sheetTransform && (r.transform =
|
|
1281
|
+
r.sheetTransform && (r.transform = Z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService));
|
|
967
1282
|
}
|
|
968
1283
|
}
|
|
969
1284
|
this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
|
|
970
1285
|
}
|
|
971
1286
|
};
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
],
|
|
978
|
-
var
|
|
979
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1287
|
+
Cn = Hs([
|
|
1288
|
+
Ot(1, se),
|
|
1289
|
+
Ot(2, oe),
|
|
1290
|
+
Ot(3, A(Ze)),
|
|
1291
|
+
Ot(4, A(X))
|
|
1292
|
+
], Cn);
|
|
1293
|
+
var Ys = Object.getOwnPropertyDescriptor, Gs = (i, t, e, n) => {
|
|
1294
|
+
for (var r = n > 1 ? void 0 : n ? Ys(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
980
1295
|
(o = i[s]) && (r = o(r) || r);
|
|
981
1296
|
return r;
|
|
982
|
-
},
|
|
983
|
-
function
|
|
1297
|
+
}, We = (i, t) => (e, n) => t(e, n, i);
|
|
1298
|
+
function Lr(i, t, e) {
|
|
984
1299
|
var n, r, s, o;
|
|
985
1300
|
if (((r = (n = e == null ? void 0 : e.p) == null ? void 0 : n.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = e.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
|
|
986
|
-
const a = e.p.drawings[e.p.drawingsOrder[0]], d =
|
|
1301
|
+
const a = e.p.drawings[e.p.drawingsOrder[0]], d = _n(
|
|
987
1302
|
i,
|
|
988
1303
|
{
|
|
989
1304
|
unitId: t.unitId,
|
|
@@ -1000,47 +1315,47 @@ function Sr(i, t, e) {
|
|
|
1000
1315
|
}
|
|
1001
1316
|
return !1;
|
|
1002
1317
|
}
|
|
1003
|
-
let
|
|
1318
|
+
let $t = class extends ee {
|
|
1004
1319
|
constructor(i, t, e, n, r, s) {
|
|
1005
1320
|
super(), this._commandService = i, this._sheetInterceptorService = t, this._injector = e, this._drawingManagerService = n, this._docDrawingController = r, this._editorBridgeService = s, this._handleInitEditor(), this._initCellContentInterceptor();
|
|
1006
1321
|
}
|
|
1007
1322
|
_handleInitEditor() {
|
|
1008
1323
|
this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
|
|
1009
|
-
i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(
|
|
1324
|
+
i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(ot), this._docDrawingController.loadDrawingDataForUnit(ot), this._drawingManagerService.initializeNotification(ot)) : this._drawingManagerService.removeDrawingDataForUnit(ot);
|
|
1010
1325
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
|
|
1011
|
-
i.id ===
|
|
1326
|
+
i.id === rs.id && i.params.unitId === He && (this._drawingManagerService.removeDrawingDataForUnit(He), this._docDrawingController.loadDrawingDataForUnit(He), this._drawingManagerService.initializeNotification(He));
|
|
1012
1327
|
}));
|
|
1013
1328
|
}
|
|
1014
1329
|
_initCellContentInterceptor() {
|
|
1015
1330
|
this.disposeWithMe(
|
|
1016
1331
|
this._sheetInterceptorService.intercept(
|
|
1017
|
-
|
|
1332
|
+
xi.CELL_CONTENT,
|
|
1018
1333
|
{
|
|
1019
|
-
effect:
|
|
1020
|
-
priority:
|
|
1334
|
+
effect: _i.Style,
|
|
1335
|
+
priority: Wi.CELL_IMAGE,
|
|
1021
1336
|
handler: (i, t, e) => {
|
|
1022
1337
|
var n;
|
|
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 },
|
|
1338
|
+
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 }, Lr(this._injector, { unitId: t.unitId, subUnitId: t.subUnitId, row: t.row, col: t.col }, i)), e(i);
|
|
1024
1339
|
}
|
|
1025
1340
|
}
|
|
1026
1341
|
)
|
|
1027
1342
|
);
|
|
1028
1343
|
}
|
|
1029
1344
|
};
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
],
|
|
1038
|
-
var
|
|
1039
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1345
|
+
$t = Gs([
|
|
1346
|
+
We(0, Y),
|
|
1347
|
+
We(1, A(Vt)),
|
|
1348
|
+
We(2, A(qe)),
|
|
1349
|
+
We(3, oe),
|
|
1350
|
+
We(4, A(ws)),
|
|
1351
|
+
We(5, A(ai))
|
|
1352
|
+
], $t);
|
|
1353
|
+
var Xs = Object.getOwnPropertyDescriptor, zs = (i, t, e, n) => {
|
|
1354
|
+
for (var r = n > 1 ? void 0 : n ? Xs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
1040
1355
|
(o = i[s]) && (r = o(r) || r);
|
|
1041
1356
|
return r;
|
|
1042
|
-
},
|
|
1043
|
-
let
|
|
1357
|
+
}, or = (i, t) => (e, n) => t(e, n, i);
|
|
1358
|
+
let kt = class extends ee {
|
|
1044
1359
|
constructor(i, t) {
|
|
1045
1360
|
super(), this._autoFillService = i, this._injector = t, this._initAutoFillHooks();
|
|
1046
1361
|
}
|
|
@@ -1049,35 +1364,35 @@ let Mt = class extends ne {
|
|
|
1049
1364
|
this._autoFillService.addHook({
|
|
1050
1365
|
id: "sheet-cell-image-autofill",
|
|
1051
1366
|
onBeforeSubmit: (i, t, e, n) => {
|
|
1052
|
-
new
|
|
1053
|
-
|
|
1367
|
+
new Si(n).forValue((r, s, o) => {
|
|
1368
|
+
Lr(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
|
|
1054
1369
|
});
|
|
1055
1370
|
}
|
|
1056
1371
|
})
|
|
1057
1372
|
);
|
|
1058
1373
|
}
|
|
1059
1374
|
};
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
],
|
|
1064
|
-
var
|
|
1065
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1375
|
+
kt = zs([
|
|
1376
|
+
or(0, A(ci)),
|
|
1377
|
+
or(1, A(qe))
|
|
1378
|
+
], kt);
|
|
1379
|
+
var Ks = Object.getOwnPropertyDescriptor, Zs = (i, t, e, n) => {
|
|
1380
|
+
for (var r = n > 1 ? void 0 : n ? Ks(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
1066
1381
|
(o = i[s]) && (r = o(r) || r);
|
|
1067
1382
|
return r;
|
|
1068
|
-
},
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1383
|
+
}, nt = (i, t) => (e, n) => t(e, n, i);
|
|
1384
|
+
const Js = [
|
|
1385
|
+
ot,
|
|
1386
|
+
vi,
|
|
1387
|
+
He
|
|
1073
1388
|
];
|
|
1074
|
-
let
|
|
1389
|
+
let xt = class extends ee {
|
|
1075
1390
|
constructor(i, t, e, n, r) {
|
|
1076
1391
|
super(), this._commandService = i, this._univerInstanceService = t, this._dialogService = e, this._renderManagerService = n, this._localeService = r, this._initDocImageCopyPasteHooks();
|
|
1077
1392
|
}
|
|
1078
1393
|
_setCellImage(i) {
|
|
1079
1394
|
var r;
|
|
1080
|
-
const t =
|
|
1395
|
+
const t = un("", {}), e = (r = Dn($.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.with(di), n = hn.drawing.add({
|
|
1081
1396
|
documentDataModel: t,
|
|
1082
1397
|
drawings: [i],
|
|
1083
1398
|
selection: {
|
|
@@ -1092,20 +1407,20 @@ let yt = class extends ne {
|
|
|
1092
1407
|
this.disposeWithMe(
|
|
1093
1408
|
this._commandService.beforeCommandExecuted((i) => {
|
|
1094
1409
|
var t, e;
|
|
1095
|
-
if (i.id ===
|
|
1096
|
-
const n = i.params, { doc: r } = n, s = this._univerInstanceService.getCurrentUnitOfType(
|
|
1410
|
+
if (i.id === is.id) {
|
|
1411
|
+
const n = i.params, { doc: r } = n, s = this._univerInstanceService.getCurrentUnitOfType($.UNIVER_DOC);
|
|
1097
1412
|
if (s == null || !Object.keys((t = r.drawings) != null ? t : {}).length)
|
|
1098
1413
|
return;
|
|
1099
1414
|
const o = s.getUnitId();
|
|
1100
|
-
if (
|
|
1101
|
-
if (o !==
|
|
1415
|
+
if (Js.includes(o)) {
|
|
1416
|
+
if (o !== He) {
|
|
1102
1417
|
const a = () => {
|
|
1103
|
-
this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand(
|
|
1418
|
+
this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand(Nn.id, {
|
|
1104
1419
|
visible: !1
|
|
1105
1420
|
});
|
|
1106
1421
|
};
|
|
1107
1422
|
((e = s.getBody()) == null ? void 0 : e.dataStream) === `\r
|
|
1108
|
-
` ? (this._commandService.syncExecuteCommand(
|
|
1423
|
+
` ? (this._commandService.syncExecuteCommand(Nn.id, {
|
|
1109
1424
|
visible: !1
|
|
1110
1425
|
}), this._setCellImage(Object.values(r.drawings)[0])) : this._dialogService.open({
|
|
1111
1426
|
id: "sheet-cell-image-copy-paste",
|
|
@@ -1133,32 +1448,32 @@ let yt = class extends ne {
|
|
|
1133
1448
|
);
|
|
1134
1449
|
}
|
|
1135
1450
|
};
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
],
|
|
1143
|
-
var
|
|
1144
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1451
|
+
xt = Zs([
|
|
1452
|
+
nt(0, Y),
|
|
1453
|
+
nt(1, de),
|
|
1454
|
+
nt(2, bn),
|
|
1455
|
+
nt(3, Q),
|
|
1456
|
+
nt(4, A(Te))
|
|
1457
|
+
], xt);
|
|
1458
|
+
var qs = Object.getOwnPropertyDescriptor, Qs = (i, t, e, n) => {
|
|
1459
|
+
for (var r = n > 1 ? void 0 : n ? qs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
1145
1460
|
(o = i[s]) && (r = o(r) || r);
|
|
1146
1461
|
return r;
|
|
1147
|
-
},
|
|
1148
|
-
const
|
|
1149
|
-
function
|
|
1462
|
+
}, rt = (i, t) => (e, n) => t(e, n, i);
|
|
1463
|
+
const Vr = "image/png";
|
|
1464
|
+
function eo(i) {
|
|
1150
1465
|
const t = i.split(","), e = atob(t[1]), n = e.length, r = new Uint8Array(n);
|
|
1151
1466
|
for (let s = 0; s < n; s++)
|
|
1152
1467
|
r[s] = e.charCodeAt(s);
|
|
1153
|
-
return new Blob([r], { type:
|
|
1468
|
+
return new Blob([r], { type: Vr });
|
|
1154
1469
|
}
|
|
1155
|
-
function
|
|
1156
|
-
const t = new ClipboardItem({ [
|
|
1470
|
+
function to(i) {
|
|
1471
|
+
const t = new ClipboardItem({ [Vr]: eo(i) });
|
|
1157
1472
|
navigator.clipboard.write([t]).catch((e) => {
|
|
1158
1473
|
console.error("Could not copy image using clipboard API: ", e);
|
|
1159
1474
|
});
|
|
1160
1475
|
}
|
|
1161
|
-
function
|
|
1476
|
+
function no() {
|
|
1162
1477
|
function i() {
|
|
1163
1478
|
const n = document.createElement("input");
|
|
1164
1479
|
return n.style.position = "absolute", n.style.height = "1px", n.style.width = "1px", n.style.opacity = "0", n;
|
|
@@ -1168,16 +1483,16 @@ function Ds() {
|
|
|
1168
1483
|
e.blur(), document.body.removeChild(e), t instanceof HTMLElement && t.focus();
|
|
1169
1484
|
};
|
|
1170
1485
|
}
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1486
|
+
const ar = [
|
|
1487
|
+
Le.SPECIAL_PASTE_COL_WIDTH,
|
|
1488
|
+
Le.SPECIAL_PASTE_VALUE,
|
|
1489
|
+
Le.SPECIAL_PASTE_FORMAT,
|
|
1490
|
+
Le.SPECIAL_PASTE_FORMULA
|
|
1176
1491
|
];
|
|
1177
|
-
let
|
|
1492
|
+
let Wt = class extends ee {
|
|
1178
1493
|
constructor(t, e, n, r, s) {
|
|
1179
1494
|
super();
|
|
1180
|
-
|
|
1495
|
+
re(this, "_copyInfo");
|
|
1181
1496
|
this._sheetClipboardService = t, this._renderManagerService = e, this._drawingService = n, this._clipboardInterfaceService = r, this._commandService = s, this._initCopyPaste();
|
|
1182
1497
|
}
|
|
1183
1498
|
get _focusedDrawings() {
|
|
@@ -1192,18 +1507,18 @@ let Tt = class extends ne {
|
|
|
1192
1507
|
const s = this._focusedDrawings;
|
|
1193
1508
|
if (s.length > 0) {
|
|
1194
1509
|
const [o] = s;
|
|
1195
|
-
if (o.drawingType !==
|
|
1510
|
+
if (o.drawingType !== x.DRAWING_IMAGE)
|
|
1196
1511
|
return;
|
|
1197
|
-
if (r ===
|
|
1512
|
+
if (r === Re.CUT) {
|
|
1198
1513
|
const d = {
|
|
1199
1514
|
unitId: t,
|
|
1200
1515
|
drawings: [o]
|
|
1201
1516
|
};
|
|
1202
|
-
this._commandService.executeCommand(
|
|
1517
|
+
this._commandService.executeCommand(ht.id, d);
|
|
1203
1518
|
}
|
|
1204
1519
|
setTimeout(() => {
|
|
1205
|
-
const d =
|
|
1206
|
-
o.drawingType ===
|
|
1520
|
+
const d = no();
|
|
1521
|
+
o.drawingType === x.DRAWING_IMAGE && o.imageSourceType === os.BASE64 ? to(o.source) : this._clipboardInterfaceService.writeText(""), d();
|
|
1207
1522
|
}, 200);
|
|
1208
1523
|
const a = {
|
|
1209
1524
|
unitId: o.unitId,
|
|
@@ -1219,14 +1534,14 @@ let Tt = class extends ne {
|
|
|
1219
1534
|
onPasteCells: (t, e, n, r) => {
|
|
1220
1535
|
if (!this._copyInfo)
|
|
1221
1536
|
return { redos: [], undos: [] };
|
|
1222
|
-
const { copyType: s =
|
|
1223
|
-
return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: c, pasteRange: d }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: e, pasteType: o },
|
|
1537
|
+
const { copyType: s = Re.COPY, pasteType: o } = r, { range: a } = t || {}, { range: d, unitId: u, subUnitId: c } = e;
|
|
1538
|
+
return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: c, pasteRange: d }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: e, pasteType: o }, Re.COPY);
|
|
1224
1539
|
},
|
|
1225
1540
|
onPastePlainText: (t, e) => ({ undos: [], redos: [] }),
|
|
1226
|
-
onPasteUnrecognized: (t) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType:
|
|
1541
|
+
onPasteUnrecognized: (t) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: Le.DEFAULT_PASTE }, Re.COPY) : { undos: [], redos: [] },
|
|
1227
1542
|
onPasteFiles: (t, e) => {
|
|
1228
1543
|
if (this._copyInfo)
|
|
1229
|
-
return this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType:
|
|
1544
|
+
return this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: Le.DEFAULT_PASTE }, Re.COPY);
|
|
1230
1545
|
{
|
|
1231
1546
|
const n = e.filter((r) => r.type.includes("image"));
|
|
1232
1547
|
if (n.length)
|
|
@@ -1234,7 +1549,7 @@ let Tt = class extends ne {
|
|
|
1234
1549
|
undos: [],
|
|
1235
1550
|
redos: [
|
|
1236
1551
|
{
|
|
1237
|
-
id:
|
|
1552
|
+
id: Kt.id,
|
|
1238
1553
|
params: { files: n }
|
|
1239
1554
|
}
|
|
1240
1555
|
]
|
|
@@ -1246,7 +1561,7 @@ let Tt = class extends ne {
|
|
|
1246
1561
|
}
|
|
1247
1562
|
_createDrawingsCopyInfoByRange(t, e, n) {
|
|
1248
1563
|
var g;
|
|
1249
|
-
const r = (g = this._renderManagerService.getRenderById(t)) == null ? void 0 : g.with(
|
|
1564
|
+
const r = (g = this._renderManagerService.getRenderById(t)) == null ? void 0 : g.with(X);
|
|
1250
1565
|
if (!r) return;
|
|
1251
1566
|
const s = r.attachRangeWithCoord(n);
|
|
1252
1567
|
if (!s)
|
|
@@ -1254,18 +1569,18 @@ let Tt = class extends ne {
|
|
|
1254
1569
|
const { startX: o, endX: a, startY: d, endY: u } = s, c = this._drawingService.getDrawingData(t, e), l = this._focusedDrawings.slice();
|
|
1255
1570
|
if (Object.keys(c).forEach((h) => {
|
|
1256
1571
|
const f = c[h];
|
|
1257
|
-
if (f.drawingType !==
|
|
1572
|
+
if (f.drawingType !== x.DRAWING_IMAGE)
|
|
1258
1573
|
return;
|
|
1259
|
-
const { transform:
|
|
1260
|
-
if (f.anchorType !== O.Both || !
|
|
1574
|
+
const { transform: m } = f;
|
|
1575
|
+
if (f.anchorType !== O.Both || !m)
|
|
1261
1576
|
return;
|
|
1262
|
-
const { left:
|
|
1263
|
-
drawingStartX:
|
|
1264
|
-
drawingEndX:
|
|
1265
|
-
drawingStartY:
|
|
1266
|
-
drawingEndY:
|
|
1577
|
+
const { left: p = 0, top: w = 0, width: S = 0, height: I = 0 } = m, { drawingStartX: D, drawingEndX: v, drawingStartY: C, drawingEndY: _ } = {
|
|
1578
|
+
drawingStartX: p,
|
|
1579
|
+
drawingEndX: p + S,
|
|
1580
|
+
drawingStartY: w,
|
|
1581
|
+
drawingEndY: w + I
|
|
1267
1582
|
};
|
|
1268
|
-
o <=
|
|
1583
|
+
o <= D && v <= a && d <= C && _ <= u && l.push(f);
|
|
1269
1584
|
}), l.length)
|
|
1270
1585
|
return {
|
|
1271
1586
|
copyRange: n,
|
|
@@ -1276,31 +1591,31 @@ let Tt = class extends ne {
|
|
|
1276
1591
|
}
|
|
1277
1592
|
_generateSingleDrawingPasteMutations(t, e) {
|
|
1278
1593
|
const { pasteType: n, pasteTo: r } = t;
|
|
1279
|
-
if (
|
|
1594
|
+
if (ar.includes(n))
|
|
1280
1595
|
return { redos: [], undos: [] };
|
|
1281
|
-
const { unitId: s, subUnitId: o, range: a } = r, d = this._renderManagerService.getRenderById(s), u = d == null ? void 0 : d.with(
|
|
1596
|
+
const { unitId: s, subUnitId: o, range: a } = r, d = this._renderManagerService.getRenderById(s), u = d == null ? void 0 : d.with(X), c = d == null ? void 0 : d.with(Ze), l = this._copyInfo;
|
|
1282
1597
|
if (!u || !c)
|
|
1283
1598
|
return { redos: [], undos: [] };
|
|
1284
|
-
const { drawings: g } = l, h =
|
|
1599
|
+
const { drawings: g } = l, h = $n(a);
|
|
1285
1600
|
return this._generateMutations(g, {
|
|
1286
1601
|
unitId: s,
|
|
1287
1602
|
subUnitId: o,
|
|
1288
|
-
isCut: e ===
|
|
1289
|
-
getTransform: (f,
|
|
1290
|
-
var
|
|
1291
|
-
const
|
|
1603
|
+
isCut: e === Re.CUT,
|
|
1604
|
+
getTransform: (f, m) => {
|
|
1605
|
+
var S;
|
|
1606
|
+
const p = u.attachRangeWithCoord({
|
|
1292
1607
|
startRow: h.startRow,
|
|
1293
1608
|
endRow: h.endRow,
|
|
1294
1609
|
startColumn: h.startColumn,
|
|
1295
1610
|
endColumn: h.endColumn
|
|
1296
|
-
}),
|
|
1611
|
+
}), w = {
|
|
1297
1612
|
...f,
|
|
1298
|
-
left:
|
|
1299
|
-
top:
|
|
1613
|
+
left: p == null ? void 0 : p.startX,
|
|
1614
|
+
top: p == null ? void 0 : p.startY
|
|
1300
1615
|
};
|
|
1301
1616
|
return {
|
|
1302
|
-
transform:
|
|
1303
|
-
sheetTransform: (
|
|
1617
|
+
transform: w,
|
|
1618
|
+
sheetTransform: (S = j(w, c)) != null ? S : m
|
|
1304
1619
|
};
|
|
1305
1620
|
}
|
|
1306
1621
|
});
|
|
@@ -1320,20 +1635,20 @@ let Tt = class extends ne {
|
|
|
1320
1635
|
...c,
|
|
1321
1636
|
unitId: n,
|
|
1322
1637
|
subUnitId: r,
|
|
1323
|
-
drawingId: o ? c.drawingId :
|
|
1638
|
+
drawingId: o ? c.drawingId : Ve(),
|
|
1324
1639
|
transform: h.transform,
|
|
1325
1640
|
sheetTransform: h.sheetTransform
|
|
1326
1641
|
};
|
|
1327
1642
|
if (o) {
|
|
1328
|
-
const { undo:
|
|
1643
|
+
const { undo: m, redo: p, objects: w } = u.getBatchUpdateOp([f]);
|
|
1329
1644
|
a.push({
|
|
1330
1645
|
id: P.id,
|
|
1331
1646
|
params: {
|
|
1332
1647
|
unitId: n,
|
|
1333
1648
|
subUnitId: r,
|
|
1334
1649
|
type: U.UPDATE,
|
|
1335
|
-
op:
|
|
1336
|
-
objects:
|
|
1650
|
+
op: p,
|
|
1651
|
+
objects: w
|
|
1337
1652
|
}
|
|
1338
1653
|
}), d.push({
|
|
1339
1654
|
id: P.id,
|
|
@@ -1341,13 +1656,13 @@ let Tt = class extends ne {
|
|
|
1341
1656
|
unitId: n,
|
|
1342
1657
|
subUnitId: r,
|
|
1343
1658
|
type: U.UPDATE,
|
|
1344
|
-
op:
|
|
1345
|
-
objects:
|
|
1659
|
+
op: m,
|
|
1660
|
+
objects: w
|
|
1346
1661
|
}
|
|
1347
1662
|
});
|
|
1348
1663
|
} else {
|
|
1349
|
-
const { undo:
|
|
1350
|
-
a.push({ id: P.id, params: { op:
|
|
1664
|
+
const { undo: m, redo: p, objects: w } = u.getBatchAddOp([f]);
|
|
1665
|
+
a.push({ id: P.id, params: { op: p, unitId: n, subUnitId: r, objects: w, type: U.INSERT } }), d.push({ id: P.id, params: { op: m, unitId: n, subUnitId: r, objects: w, type: U.REMOVE } });
|
|
1351
1666
|
}
|
|
1352
1667
|
}), { redos: a, undos: d };
|
|
1353
1668
|
}
|
|
@@ -1363,94 +1678,94 @@ let Tt = class extends ne {
|
|
|
1363
1678
|
copyRange: a,
|
|
1364
1679
|
copyType: d
|
|
1365
1680
|
} = e;
|
|
1366
|
-
if (
|
|
1681
|
+
if (ar.includes(s))
|
|
1367
1682
|
return { redos: [], undos: [] };
|
|
1368
|
-
const u = (y = this._renderManagerService.getRenderById(n)) == null ? void 0 : y.with(
|
|
1683
|
+
const u = (y = this._renderManagerService.getRenderById(n)) == null ? void 0 : y.with(X);
|
|
1369
1684
|
if (!u || !this._copyInfo)
|
|
1370
1685
|
return { redos: [], undos: [] };
|
|
1371
1686
|
const { drawings: c } = this._copyInfo;
|
|
1372
1687
|
if (!a)
|
|
1373
1688
|
return this._generateSingleDrawingPasteMutations({
|
|
1374
|
-
pasteTo: { unitId: n, subUnitId: r, range:
|
|
1689
|
+
pasteTo: { unitId: n, subUnitId: r, range: $n(o) },
|
|
1375
1690
|
pasteType: s
|
|
1376
1691
|
}, d);
|
|
1377
|
-
const { ranges: [l, g], mapFunc: h } =
|
|
1692
|
+
const { ranges: [l, g], mapFunc: h } = li([a, o]), { row: f, col: m } = h(l.startRow, l.startColumn), { row: p, col: w } = h(g.startRow, g.startColumn), S = u.attachRangeWithCoord({
|
|
1378
1693
|
startRow: f,
|
|
1379
1694
|
endRow: f,
|
|
1380
|
-
startColumn:
|
|
1381
|
-
endColumn:
|
|
1695
|
+
startColumn: m,
|
|
1696
|
+
endColumn: m
|
|
1382
1697
|
}), I = u.attachRangeWithCoord({
|
|
1383
|
-
startRow:
|
|
1384
|
-
endRow:
|
|
1385
|
-
startColumn:
|
|
1386
|
-
endColumn:
|
|
1698
|
+
startRow: p,
|
|
1699
|
+
endRow: p,
|
|
1700
|
+
startColumn: w,
|
|
1701
|
+
endColumn: w
|
|
1387
1702
|
});
|
|
1388
|
-
if (!
|
|
1703
|
+
if (!S || !I || !this._copyInfo)
|
|
1389
1704
|
return { redos: [], undos: [] };
|
|
1390
|
-
const
|
|
1705
|
+
const D = I.startX - S.startX, v = I.startY - S.startY, C = p - f, _ = w - m;
|
|
1391
1706
|
return this._generateMutations(c, {
|
|
1392
1707
|
unitId: n,
|
|
1393
1708
|
subUnitId: r,
|
|
1394
|
-
getTransform: (
|
|
1395
|
-
var
|
|
1709
|
+
getTransform: (R, E) => {
|
|
1710
|
+
var T, M;
|
|
1396
1711
|
return {
|
|
1397
1712
|
transform: {
|
|
1398
|
-
...
|
|
1399
|
-
left: ((
|
|
1400
|
-
top: ((M =
|
|
1713
|
+
...R,
|
|
1714
|
+
left: ((T = R == null ? void 0 : R.left) != null ? T : 0) + D,
|
|
1715
|
+
top: ((M = R == null ? void 0 : R.top) != null ? M : 0) + v
|
|
1401
1716
|
},
|
|
1402
1717
|
sheetTransform: {
|
|
1403
|
-
...
|
|
1718
|
+
...E,
|
|
1404
1719
|
to: {
|
|
1405
|
-
...
|
|
1406
|
-
row:
|
|
1407
|
-
column:
|
|
1720
|
+
...E.to,
|
|
1721
|
+
row: E.to.row + C,
|
|
1722
|
+
column: E.to.column + _
|
|
1408
1723
|
},
|
|
1409
1724
|
from: {
|
|
1410
|
-
...
|
|
1411
|
-
row:
|
|
1412
|
-
column:
|
|
1725
|
+
...E.from,
|
|
1726
|
+
row: E.from.row + C,
|
|
1727
|
+
column: E.from.column + _
|
|
1413
1728
|
}
|
|
1414
1729
|
}
|
|
1415
1730
|
};
|
|
1416
1731
|
},
|
|
1417
|
-
isCut: d ===
|
|
1732
|
+
isCut: d === Re.CUT
|
|
1418
1733
|
});
|
|
1419
1734
|
}
|
|
1420
1735
|
};
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
],
|
|
1428
|
-
var
|
|
1429
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1736
|
+
Wt = Qs([
|
|
1737
|
+
rt(0, ui),
|
|
1738
|
+
rt(1, Q),
|
|
1739
|
+
rt(2, oe),
|
|
1740
|
+
rt(3, ls),
|
|
1741
|
+
rt(4, Y)
|
|
1742
|
+
], Wt);
|
|
1743
|
+
var ro = Object.getOwnPropertyDescriptor, io = (i, t, e, n) => {
|
|
1744
|
+
for (var r = n > 1 ? void 0 : n ? ro(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
1430
1745
|
(o = i[s]) && (r = o(r) || r);
|
|
1431
1746
|
return r;
|
|
1432
|
-
},
|
|
1433
|
-
let
|
|
1747
|
+
}, it = (i, t) => (e, n) => t(e, n, i);
|
|
1748
|
+
let Bt = class extends ee {
|
|
1434
1749
|
constructor(i, t, e, n, r) {
|
|
1435
1750
|
super(), this._drawingManagerService = i, this._renderManagerService = t, this._permissionService = e, this._univerInstanceService = n, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
1436
1751
|
}
|
|
1437
1752
|
_initDrawingVisible() {
|
|
1438
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1753
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = at([i, t]);
|
|
1439
1754
|
this.disposeWithMe(
|
|
1440
1755
|
e.pipe(
|
|
1441
|
-
|
|
1442
|
-
|
|
1756
|
+
me(([n, r]) => n ? n.activeSheet$.pipe(
|
|
1757
|
+
er((s) => {
|
|
1443
1758
|
if (!s) {
|
|
1444
1759
|
this._drawingManagerService.setDrawingVisible(!1);
|
|
1445
1760
|
return;
|
|
1446
1761
|
}
|
|
1447
1762
|
const o = n.getUnitId(), a = s.getSheetId();
|
|
1448
1763
|
this._permissionService.composePermission([
|
|
1449
|
-
new
|
|
1450
|
-
new
|
|
1764
|
+
new Vn(o).id,
|
|
1765
|
+
new Hn(o, a).id
|
|
1451
1766
|
]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(n, s);
|
|
1452
1767
|
})
|
|
1453
|
-
) : (this._drawingManagerService.setDrawingVisible(!1),
|
|
1768
|
+
) : (this._drawingManagerService.setDrawingVisible(!1), we))
|
|
1454
1769
|
).subscribe()
|
|
1455
1770
|
);
|
|
1456
1771
|
}
|
|
@@ -1460,26 +1775,26 @@ let Et = class extends ne {
|
|
|
1460
1775
|
if (!a)
|
|
1461
1776
|
return;
|
|
1462
1777
|
a.getAllObjectsByOrder().forEach((u) => {
|
|
1463
|
-
u.classType ===
|
|
1778
|
+
u.classType === $e.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.removeObject(u);
|
|
1464
1779
|
});
|
|
1465
1780
|
}
|
|
1466
1781
|
_initDrawingEditable() {
|
|
1467
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1782
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = at([i, t]);
|
|
1468
1783
|
this.disposeWithMe(
|
|
1469
1784
|
e.pipe(
|
|
1470
|
-
|
|
1471
|
-
|
|
1785
|
+
me(([n, r]) => n ? n.activeSheet$.pipe(
|
|
1786
|
+
er((s) => {
|
|
1472
1787
|
if (!s) {
|
|
1473
1788
|
this._drawingManagerService.setDrawingEditable(!1);
|
|
1474
1789
|
return;
|
|
1475
1790
|
}
|
|
1476
1791
|
const o = n.getUnitId(), a = s.getSheetId();
|
|
1477
1792
|
this._permissionService.composePermission([
|
|
1478
|
-
new
|
|
1479
|
-
new
|
|
1793
|
+
new gn(o).id,
|
|
1794
|
+
new fn(o, a).id
|
|
1480
1795
|
]).every((u) => u.value) ? this._drawingManagerService.setDrawingEditable(!0) : this._handleDrawingEditableFalse(n, s);
|
|
1481
1796
|
})
|
|
1482
|
-
) : (this._drawingManagerService.setDrawingEditable(!1),
|
|
1797
|
+
) : (this._drawingManagerService.setDrawingEditable(!1), we))
|
|
1483
1798
|
).subscribe()
|
|
1484
1799
|
);
|
|
1485
1800
|
}
|
|
@@ -1489,29 +1804,29 @@ let Et = class extends ne {
|
|
|
1489
1804
|
if (!a)
|
|
1490
1805
|
return;
|
|
1491
1806
|
a.getAllObjectsByOrder().forEach((u) => {
|
|
1492
|
-
u.classType ===
|
|
1807
|
+
u.classType === $e.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.detachTransformerFrom(u);
|
|
1493
1808
|
});
|
|
1494
1809
|
}
|
|
1495
1810
|
_initViewPermissionChange() {
|
|
1496
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1811
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$;
|
|
1497
1812
|
this.disposeWithMe(
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1813
|
+
at([i, t]).pipe(
|
|
1814
|
+
me(([e, n]) => e ? e.activeSheet$.pipe(
|
|
1815
|
+
me((r) => {
|
|
1501
1816
|
if (!r)
|
|
1502
|
-
return
|
|
1817
|
+
return we;
|
|
1503
1818
|
const s = e.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), d = a == null ? void 0 : a.scene;
|
|
1504
1819
|
if (!d)
|
|
1505
|
-
return
|
|
1820
|
+
return we;
|
|
1506
1821
|
const u = d.getTransformerByCreate();
|
|
1507
1822
|
return this._permissionService.composePermission$([
|
|
1508
|
-
new
|
|
1509
|
-
new
|
|
1823
|
+
new Vn(s).id,
|
|
1824
|
+
new Hn(s, o).id
|
|
1510
1825
|
]).pipe(
|
|
1511
|
-
|
|
1512
|
-
|
|
1826
|
+
pe((l) => l.every((g) => g.value)),
|
|
1827
|
+
tr()
|
|
1513
1828
|
).pipe(
|
|
1514
|
-
|
|
1829
|
+
pe((l) => ({
|
|
1515
1830
|
permission: l,
|
|
1516
1831
|
scene: d,
|
|
1517
1832
|
transformer: u,
|
|
@@ -1520,18 +1835,18 @@ let Et = class extends ne {
|
|
|
1520
1835
|
}))
|
|
1521
1836
|
);
|
|
1522
1837
|
})
|
|
1523
|
-
) :
|
|
1838
|
+
) : we)
|
|
1524
1839
|
).subscribe({
|
|
1525
1840
|
next: ({ permission: e, scene: n, transformer: r, unitId: s, subUnitId: o }) => {
|
|
1526
1841
|
this._drawingManagerService.setDrawingVisible(e);
|
|
1527
1842
|
const a = n.getAllObjectsByOrder(), d = this._drawingManagerService.getDrawingData(s, o), u = Object.values(d);
|
|
1528
1843
|
e ? this._drawingManagerService.addNotification(u) : (a.forEach((c) => {
|
|
1529
|
-
c.classType ===
|
|
1844
|
+
c.classType === $e.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.removeObject(c);
|
|
1530
1845
|
}), r.clearSelectedObjects());
|
|
1531
1846
|
},
|
|
1532
1847
|
complete: () => {
|
|
1533
1848
|
this._drawingManagerService.setDrawingVisible(!0);
|
|
1534
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
1849
|
+
const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET), n = e == null ? void 0 : e.getActiveSheet(), r = e == null ? void 0 : e.getUnitId(), s = n == null ? void 0 : n.getSheetId();
|
|
1535
1850
|
if (!r || !s)
|
|
1536
1851
|
return;
|
|
1537
1852
|
const o = this._drawingManagerService.getDrawingData(r, s), a = Object.values(o);
|
|
@@ -1541,25 +1856,25 @@ let Et = class extends ne {
|
|
|
1541
1856
|
);
|
|
1542
1857
|
}
|
|
1543
1858
|
_initEditPermissionChange() {
|
|
1544
|
-
const i = this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1859
|
+
const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$;
|
|
1545
1860
|
this.disposeWithMe(
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1861
|
+
at([i, t]).pipe(
|
|
1862
|
+
me(([e, n]) => e ? e.activeSheet$.pipe(
|
|
1863
|
+
me((r) => {
|
|
1549
1864
|
if (!r)
|
|
1550
|
-
return
|
|
1865
|
+
return we;
|
|
1551
1866
|
const s = e.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), d = a == null ? void 0 : a.scene;
|
|
1552
1867
|
if (!d)
|
|
1553
|
-
return
|
|
1868
|
+
return we;
|
|
1554
1869
|
const u = d.getTransformerByCreate();
|
|
1555
1870
|
return this._permissionService.composePermission$([
|
|
1556
|
-
new
|
|
1557
|
-
new
|
|
1871
|
+
new gn(s).id,
|
|
1872
|
+
new fn(s, o).id
|
|
1558
1873
|
]).pipe(
|
|
1559
|
-
|
|
1560
|
-
|
|
1874
|
+
pe((l) => l.every((g) => g.value)),
|
|
1875
|
+
tr()
|
|
1561
1876
|
).pipe(
|
|
1562
|
-
|
|
1877
|
+
pe((l) => ({
|
|
1563
1878
|
permission: l,
|
|
1564
1879
|
scene: d,
|
|
1565
1880
|
transformer: u,
|
|
@@ -1568,19 +1883,19 @@ let Et = class extends ne {
|
|
|
1568
1883
|
}))
|
|
1569
1884
|
);
|
|
1570
1885
|
})
|
|
1571
|
-
) :
|
|
1886
|
+
) : we)
|
|
1572
1887
|
).subscribe({
|
|
1573
1888
|
next: ({ permission: e, scene: n, transformer: r, unitId: s, subUnitId: o }) => {
|
|
1574
1889
|
this._drawingManagerService.setDrawingEditable(e);
|
|
1575
1890
|
const a = n.getAllObjectsByOrder(), d = this._drawingManagerService.getDrawingData(s, o), u = Object.values(d);
|
|
1576
1891
|
e ? (a.forEach((c) => {
|
|
1577
|
-
c.classType ===
|
|
1892
|
+
c.classType === $e.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.attachTransformerTo(c);
|
|
1578
1893
|
}), this._drawingManagerService.addNotification(u)) : (a.forEach((c) => {
|
|
1579
|
-
c.classType ===
|
|
1894
|
+
c.classType === $e.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.detachTransformerFrom(c);
|
|
1580
1895
|
}), r.clearSelectedObjects());
|
|
1581
1896
|
},
|
|
1582
1897
|
complete: () => {
|
|
1583
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
1898
|
+
const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
|
|
1584
1899
|
if (!e)
|
|
1585
1900
|
return;
|
|
1586
1901
|
const n = e.getUnitId(), r = e.getActiveSheet();
|
|
@@ -1591,27 +1906,28 @@ let Et = class extends ne {
|
|
|
1591
1906
|
return;
|
|
1592
1907
|
const d = this._drawingManagerService.getDrawingData(n, s), u = Object.values(d);
|
|
1593
1908
|
this._drawingManagerService.setDrawingEditable(!0), a.getAllObjectsByOrder().forEach((l) => {
|
|
1594
|
-
l.classType ===
|
|
1909
|
+
l.classType === $e.IMAGE && u.some((g) => l.oKey.includes(g.drawingId)) && a.detachTransformerFrom(l);
|
|
1595
1910
|
});
|
|
1596
1911
|
}
|
|
1597
1912
|
})
|
|
1598
1913
|
);
|
|
1599
1914
|
}
|
|
1600
1915
|
};
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
],
|
|
1608
|
-
var
|
|
1609
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1916
|
+
Bt = io([
|
|
1917
|
+
it(0, oe),
|
|
1918
|
+
it(1, Q),
|
|
1919
|
+
it(2, Ii),
|
|
1920
|
+
it(3, de),
|
|
1921
|
+
it(4, A(Ci))
|
|
1922
|
+
], Bt);
|
|
1923
|
+
var so = Object.getOwnPropertyDescriptor, oo = (i, t, e, n) => {
|
|
1924
|
+
for (var r = n > 1 ? void 0 : n ? so(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
1610
1925
|
(o = i[s]) && (r = o(r) || r);
|
|
1611
1926
|
return r;
|
|
1612
|
-
},
|
|
1613
|
-
|
|
1614
|
-
|
|
1927
|
+
}, be = (i, t) => (e, n) => t(e, n, i);
|
|
1928
|
+
const ao = "univer-sheet-float-dom-";
|
|
1929
|
+
function Hr(i, t, e, n, r, s = !1) {
|
|
1930
|
+
const { scaleX: o, scaleY: a } = t.getAncestorScale(), d = t.getViewport(cr.VIEW_MAIN), u = n.getFreeze(), { startColumn: c, startRow: l, xSplit: g, ySplit: h } = u, f = {
|
|
1615
1931
|
left: !0,
|
|
1616
1932
|
// left means the left of pic is in a viewMainLeft
|
|
1617
1933
|
top: !0
|
|
@@ -1621,43 +1937,43 @@ function Ir(i, t, e, n, r, s = !1) {
|
|
|
1621
1937
|
...i,
|
|
1622
1938
|
absolute: f
|
|
1623
1939
|
};
|
|
1624
|
-
const { left:
|
|
1625
|
-
let { top: I, left:
|
|
1626
|
-
const { boundsOfViewArea:
|
|
1627
|
-
top: s ? 0 :
|
|
1628
|
-
left: s ? 0 :
|
|
1940
|
+
const { left: m, right: p, top: w, bottom: S } = i;
|
|
1941
|
+
let { top: I, left: D, viewportScrollX: v, viewportScrollY: C } = d;
|
|
1942
|
+
const { boundsOfViewArea: _, scrollDirectionResponse: y } = r || {}, { rowHeaderWidth: R, columnHeaderHeight: E } = e, T = {
|
|
1943
|
+
top: s ? 0 : E,
|
|
1944
|
+
left: s ? 0 : R
|
|
1629
1945
|
};
|
|
1630
|
-
|
|
1946
|
+
_ && (Ye.isDefine(T.top) && (T.top = _.top), Ye.isDefine(T.left) && (T.left = _.left)), y === "HORIZONTAL" && (C = 0), y === "VERTICAL" && (v = 0);
|
|
1631
1947
|
let M = 0, b = 0;
|
|
1632
|
-
const N = e.rowStartY(l - h) +
|
|
1948
|
+
const N = e.rowStartY(l - h) + E, F = e.colStartX(c - g) + R, te = e.rowStartY(l) + E, z = e.colStartX(c) + R;
|
|
1633
1949
|
if (g === 0)
|
|
1634
|
-
f.left = !1, M = (
|
|
1950
|
+
f.left = !1, M = (m - v) * o, b = (p - v) * o;
|
|
1635
1951
|
else {
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1952
|
+
const K = m - (F - R), W = p - (F - R);
|
|
1953
|
+
p < z ? (M = K * o, b = W * o) : m <= z && p >= z ? (M = K * o, b = Math.max(D, (p - v) * o)) : m > z && (f.left = !1, M = Math.max((m - v) * o, D), b = Math.max((p - v) * o, D));
|
|
1638
1954
|
}
|
|
1639
|
-
let
|
|
1955
|
+
let H = 0, G = 0;
|
|
1640
1956
|
if (h === 0)
|
|
1641
|
-
f.top = !1,
|
|
1957
|
+
f.top = !1, H = (w - C) * a, G = (S - C) * a;
|
|
1642
1958
|
else {
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1959
|
+
const K = w - (N - E), W = S - (N - E);
|
|
1960
|
+
S < te ? (H = K * a, G = W * a) : w <= te && S >= te ? (H = K * a, G = Math.max(I, (S - C) * a)) : w > te && (f.top = !1, H = Math.max((w - C) * a, I), G = Math.max((S - C) * a, I));
|
|
1645
1961
|
}
|
|
1646
|
-
return M = Math.max(M,
|
|
1962
|
+
return M = Math.max(M, T.left), H = Math.max(H, T.top), b = Math.max(b, T.left), G = Math.max(G, T.top), {
|
|
1647
1963
|
left: M,
|
|
1648
1964
|
right: b,
|
|
1649
|
-
top:
|
|
1965
|
+
top: H,
|
|
1650
1966
|
bottom: G,
|
|
1651
1967
|
absolute: f
|
|
1652
1968
|
};
|
|
1653
1969
|
}
|
|
1654
|
-
const
|
|
1970
|
+
const fe = (i, t, e, n, r) => {
|
|
1655
1971
|
const { left: s, top: o, width: a, height: d, angle: u } = i, c = {
|
|
1656
1972
|
left: s,
|
|
1657
1973
|
right: s + a,
|
|
1658
1974
|
top: o,
|
|
1659
1975
|
bottom: o + d
|
|
1660
|
-
}, l =
|
|
1976
|
+
}, l = Hr(c, t, e, n, r), { scaleX: g, scaleY: h } = t.getAncestorScale();
|
|
1661
1977
|
return {
|
|
1662
1978
|
startX: l.left,
|
|
1663
1979
|
endX: l.right,
|
|
@@ -1669,23 +1985,23 @@ const ge = (i, t, e, n, r) => {
|
|
|
1669
1985
|
absolute: l.absolute
|
|
1670
1986
|
};
|
|
1671
1987
|
};
|
|
1672
|
-
let
|
|
1988
|
+
let lt = class extends ee {
|
|
1673
1989
|
constructor(t, e, n, r, s, o, a) {
|
|
1674
1990
|
super();
|
|
1675
1991
|
/**
|
|
1676
1992
|
* for update dom container position when scrolling and zoom
|
|
1677
1993
|
*/
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1994
|
+
re(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
|
|
1995
|
+
re(this, "_transformChange$", new on());
|
|
1996
|
+
re(this, "transformChange$", this._transformChange$.asObservable());
|
|
1997
|
+
re(this, "_add$", new on());
|
|
1998
|
+
re(this, "add$", this._add$.asObservable());
|
|
1999
|
+
re(this, "_remove$", new on());
|
|
2000
|
+
re(this, "remove$", this._remove$.asObservable());
|
|
1685
2001
|
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();
|
|
1686
2002
|
}
|
|
1687
2003
|
_bindScrollEvent() {
|
|
1688
|
-
this._lifecycleService.lifecycle$.pipe(
|
|
2004
|
+
this._lifecycleService.lifecycle$.pipe(Ms((t) => t === Di.Rendered), ys(1)).subscribe(() => {
|
|
1689
2005
|
this._scrollUpdateListener();
|
|
1690
2006
|
});
|
|
1691
2007
|
}
|
|
@@ -1711,87 +2027,89 @@ let tt = class extends ne {
|
|
|
1711
2027
|
this._drawingManagerService.add$.subscribe((t) => {
|
|
1712
2028
|
t.forEach((e) => {
|
|
1713
2029
|
var K;
|
|
1714
|
-
const { unitId: n, subUnitId: r, drawingId: s } = e, o =
|
|
2030
|
+
const { unitId: n, subUnitId: r, drawingId: s } = e, o = ae(this._univerInstanceService, { unitId: n, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(e), d = this._univerInstanceService.getUnit(n, $.UNIVER_SHEET);
|
|
1715
2031
|
if (!d)
|
|
1716
2032
|
return;
|
|
1717
2033
|
const u = d.getActiveSheet().getSheetId();
|
|
1718
2034
|
if (!a || !o)
|
|
1719
2035
|
return;
|
|
1720
|
-
const c = (K = this._renderManagerService.getRenderById(n)) == null ? void 0 : K.with(
|
|
2036
|
+
const c = (K = this._renderManagerService.getRenderById(n)) == null ? void 0 : K.with(X).getSkeletonParam(r);
|
|
1721
2037
|
if (!c)
|
|
1722
2038
|
return;
|
|
1723
2039
|
const { transform: l, drawingType: g, data: h } = a;
|
|
1724
|
-
if (g !==
|
|
2040
|
+
if (g !== x.DRAWING_DOM && g !== x.DRAWING_CHART)
|
|
1725
2041
|
return;
|
|
1726
2042
|
const f = this._getSceneAndTransformerByDrawingSearch(n);
|
|
1727
2043
|
if (f == null)
|
|
1728
2044
|
return;
|
|
1729
|
-
const { scene:
|
|
2045
|
+
const { scene: m, canvas: p } = f;
|
|
1730
2046
|
if (l == null)
|
|
1731
2047
|
return !0;
|
|
1732
2048
|
if (u !== r)
|
|
1733
2049
|
return;
|
|
1734
|
-
const { left:
|
|
1735
|
-
if (
|
|
1736
|
-
|
|
2050
|
+
const { left: w, top: S, width: I, height: D, angle: v, flipX: C, flipY: _, skewX: y, skewY: R } = l, E = De({ unitId: n, subUnitId: r, drawingId: s }), T = m.getObject(E);
|
|
2051
|
+
if (T != null) {
|
|
2052
|
+
T.transformByState({ left: w, top: S, width: I, height: D, angle: v, flipX: C, flipY: _, skewX: y, skewY: R });
|
|
1737
2053
|
return;
|
|
1738
2054
|
}
|
|
1739
2055
|
const M = {
|
|
1740
|
-
left:
|
|
1741
|
-
top:
|
|
2056
|
+
left: w,
|
|
2057
|
+
top: S,
|
|
1742
2058
|
width: I,
|
|
1743
|
-
height:
|
|
2059
|
+
height: D,
|
|
1744
2060
|
zIndex: this._drawingManagerService.getDrawingOrder(n, r).length - 1
|
|
1745
|
-
}, b = g ===
|
|
2061
|
+
}, b = g === x.DRAWING_CHART;
|
|
1746
2062
|
if (M.rotateEnabled = !1, b) {
|
|
1747
|
-
const
|
|
1748
|
-
M.fill =
|
|
2063
|
+
const W = h ? h.backgroundColor : "white";
|
|
2064
|
+
M.fill = W, h && h.border && (M.stroke = h.border), M.paintFirst = "stroke", M.strokeWidth = 1, M.borderEnabled = !1, M.radius = 8;
|
|
1749
2065
|
}
|
|
1750
|
-
const N = new
|
|
1751
|
-
b && N.setObjectType(
|
|
1752
|
-
const
|
|
1753
|
-
dispose:
|
|
2066
|
+
const N = new ke(E, M);
|
|
2067
|
+
b && N.setObjectType(An.CHART), m.addObject(N, qt), a.allowTransform !== !1 && m.attachTransformerTo(N);
|
|
2068
|
+
const F = new yt(), te = fe(N, f.renderUnit.scene, c.skeleton, o.worksheet), z = new je(te), H = `${ao}${Ve(6)}`, G = {
|
|
2069
|
+
dispose: F,
|
|
1754
2070
|
rect: N,
|
|
1755
|
-
position$:
|
|
2071
|
+
position$: z,
|
|
1756
2072
|
unitId: n,
|
|
1757
2073
|
subUnitId: r,
|
|
1758
|
-
id: s
|
|
2074
|
+
id: s,
|
|
2075
|
+
domId: H
|
|
1759
2076
|
};
|
|
1760
2077
|
this._canvasFloatDomService.addFloatDom({
|
|
1761
|
-
position$:
|
|
2078
|
+
position$: z,
|
|
1762
2079
|
id: s,
|
|
2080
|
+
domId: H,
|
|
1763
2081
|
componentKey: a.componentKey,
|
|
1764
|
-
onPointerDown: (
|
|
1765
|
-
|
|
2082
|
+
onPointerDown: (W) => {
|
|
2083
|
+
p.dispatchEvent(new PointerEvent(W.type, W));
|
|
1766
2084
|
},
|
|
1767
|
-
onPointerMove: (
|
|
1768
|
-
|
|
2085
|
+
onPointerMove: (W) => {
|
|
2086
|
+
p.dispatchEvent(new PointerEvent(W.type, W));
|
|
1769
2087
|
},
|
|
1770
|
-
onPointerUp: (
|
|
1771
|
-
|
|
2088
|
+
onPointerUp: (W) => {
|
|
2089
|
+
p.dispatchEvent(new PointerEvent(W.type, W));
|
|
1772
2090
|
},
|
|
1773
|
-
onWheel: (
|
|
1774
|
-
|
|
2091
|
+
onWheel: (W) => {
|
|
2092
|
+
p.dispatchEvent(new WheelEvent(W.type, W));
|
|
1775
2093
|
},
|
|
1776
2094
|
data: h,
|
|
1777
2095
|
unitId: n
|
|
1778
2096
|
});
|
|
1779
|
-
const
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1782
|
-
|
|
2097
|
+
const J = N.onTransformChange$.subscribeEvent(() => {
|
|
2098
|
+
const W = fe(N, f.renderUnit.scene, c.skeleton, o.worksheet);
|
|
2099
|
+
z.next(
|
|
2100
|
+
W
|
|
1783
2101
|
);
|
|
1784
2102
|
});
|
|
1785
|
-
|
|
2103
|
+
F.add(() => {
|
|
1786
2104
|
this._canvasFloatDomService.removeFloatDom(s);
|
|
1787
|
-
}),
|
|
2105
|
+
}), J && F.add(J), this._domLayerInfoMap.set(s, G);
|
|
1788
2106
|
});
|
|
1789
2107
|
})
|
|
1790
2108
|
), this.disposeWithMe(
|
|
1791
2109
|
this._drawingManagerService.remove$.subscribe((t) => {
|
|
1792
2110
|
t.forEach((e) => {
|
|
1793
2111
|
var l;
|
|
1794
|
-
const { unitId: n, subUnitId: r, drawingId: s } = e, o =
|
|
2112
|
+
const { unitId: n, subUnitId: r, drawingId: s } = e, o = De({ unitId: n, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(n);
|
|
1795
2113
|
if (a == null)
|
|
1796
2114
|
return;
|
|
1797
2115
|
const { transformer: d, scene: u } = a, c = u.getObject(o);
|
|
@@ -1803,25 +2121,25 @@ let tt = class extends ne {
|
|
|
1803
2121
|
_scrollUpdateListener() {
|
|
1804
2122
|
const t = (e, n) => {
|
|
1805
2123
|
var d;
|
|
1806
|
-
const r = this._getSceneAndTransformerByDrawingSearch(e), s = Array.from(this._domLayerInfoMap.keys()).map((u) => ({ id: u, ...this._domLayerInfoMap.get(u) })).filter((u) => u.subUnitId === n && u.unitId === e).map((u) => u.id), o =
|
|
2124
|
+
const r = this._getSceneAndTransformerByDrawingSearch(e), s = Array.from(this._domLayerInfoMap.keys()).map((u) => ({ id: u, ...this._domLayerInfoMap.get(u) })).filter((u) => u.subUnitId === n && u.unitId === e).map((u) => u.id), o = ae(this._univerInstanceService, { unitId: e, subUnitId: n }), a = (d = this._renderManagerService.getRenderById(e)) == null ? void 0 : d.with(X).getSkeletonParam(n);
|
|
1807
2125
|
!r || !o || !a || s.forEach((u) => {
|
|
1808
2126
|
const c = this._domLayerInfoMap.get(u);
|
|
1809
2127
|
if (c) {
|
|
1810
|
-
const l =
|
|
2128
|
+
const l = fe(c.rect, r.renderUnit.scene, a.skeleton, o.worksheet, c);
|
|
1811
2129
|
c.position$.next(l);
|
|
1812
2130
|
}
|
|
1813
2131
|
});
|
|
1814
2132
|
};
|
|
1815
2133
|
this.disposeWithMe(
|
|
1816
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1817
|
-
|
|
1818
|
-
|
|
2134
|
+
this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET).pipe(
|
|
2135
|
+
me((e) => e ? e.activeSheet$ : wn(null)),
|
|
2136
|
+
pe((e) => {
|
|
1819
2137
|
if (!e) return null;
|
|
1820
2138
|
const n = e.getUnitId(), r = this._renderManagerService.getRenderById(n);
|
|
1821
2139
|
return r ? { render: r, unitId: n, subUnitId: e.getSheetId() } : null;
|
|
1822
2140
|
}),
|
|
1823
|
-
|
|
1824
|
-
(e) => e ?
|
|
2141
|
+
me(
|
|
2142
|
+
(e) => e ? bi(e.render.scene.getViewport(cr.VIEW_MAIN).onScrollAfter$).pipe(pe(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : wn(null)
|
|
1825
2143
|
)
|
|
1826
2144
|
).subscribe((e) => {
|
|
1827
2145
|
if (!e) return;
|
|
@@ -1829,12 +2147,15 @@ let tt = class extends ne {
|
|
|
1829
2147
|
t(n, r);
|
|
1830
2148
|
})
|
|
1831
2149
|
), this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
|
|
1832
|
-
if (e.id ===
|
|
2150
|
+
if (e.id === kn.id) {
|
|
1833
2151
|
const n = e.params, { unitId: r } = n;
|
|
1834
2152
|
Array.from(this._domLayerInfoMap.values()).filter((o) => o.unitId === r).map((o) => o.subUnitId).forEach((o) => {
|
|
1835
2153
|
t(r, o);
|
|
1836
2154
|
});
|
|
1837
|
-
} else if (e.id ===
|
|
2155
|
+
} else if (e.id === Bi.id) {
|
|
2156
|
+
const { unitId: n, subUnitId: r } = e.params;
|
|
2157
|
+
t(n, r);
|
|
2158
|
+
} else if (e.id === ji.id) {
|
|
1838
2159
|
const { unitId: n, subUnitId: r } = e.params;
|
|
1839
2160
|
t(n, r);
|
|
1840
2161
|
}
|
|
@@ -1843,13 +2164,13 @@ let tt = class extends ne {
|
|
|
1843
2164
|
updateFloatDomProps(t, e, n, r) {
|
|
1844
2165
|
const s = this._domLayerInfoMap.get(n), o = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1845
2166
|
if (s && o) {
|
|
1846
|
-
const { scene: a } = o, d =
|
|
1847
|
-
u && u instanceof
|
|
2167
|
+
const { scene: a } = o, d = De({ unitId: t, subUnitId: e, drawingId: n }), u = a.getObject(d);
|
|
2168
|
+
u && u instanceof ke && u.setProps(r);
|
|
1848
2169
|
}
|
|
1849
2170
|
}
|
|
1850
2171
|
_getPosition(t, e) {
|
|
1851
2172
|
var g;
|
|
1852
|
-
const { startX: n, endX: r, startY: s, endY: o } = t, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(
|
|
2173
|
+
const { startX: n, endX: r, startY: s, endY: o } = t, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(Ze);
|
|
1853
2174
|
if (a == null)
|
|
1854
2175
|
return;
|
|
1855
2176
|
const d = a.getCellWithCoordByOffset(n, s);
|
|
@@ -1879,7 +2200,7 @@ let tt = class extends ne {
|
|
|
1879
2200
|
this._drawingManagerService.update$.subscribe((t) => {
|
|
1880
2201
|
t.forEach((e) => {
|
|
1881
2202
|
const n = this._drawingManagerService.getDrawingByParam(e);
|
|
1882
|
-
if (!n || n.drawingType !==
|
|
2203
|
+
if (!n || n.drawingType !== x.DRAWING_DOM && n.drawingType !== x.DRAWING_CHART)
|
|
1883
2204
|
return;
|
|
1884
2205
|
const r = {
|
|
1885
2206
|
...n.transform
|
|
@@ -1888,7 +2209,7 @@ let tt = class extends ne {
|
|
|
1888
2209
|
...n
|
|
1889
2210
|
});
|
|
1890
2211
|
const s = this._getSceneAndTransformerByDrawingSearch(e.unitId);
|
|
1891
|
-
if (s && n.drawingType !==
|
|
2212
|
+
if (s && n.drawingType !== x.DRAWING_CHART) {
|
|
1892
2213
|
const { scene: o } = s, a = this._domLayerInfoMap.get(e.drawingId);
|
|
1893
2214
|
a != null && a.rect && (n.allowTransform === !1 ? o.detachTransformerFrom(a.rect) : o.attachTransformerTo(a.rect));
|
|
1894
2215
|
}
|
|
@@ -1907,20 +2228,20 @@ let tt = class extends ne {
|
|
|
1907
2228
|
}
|
|
1908
2229
|
// CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
|
|
1909
2230
|
addFloatDomToPosition(t, e) {
|
|
1910
|
-
const n =
|
|
2231
|
+
const n = ae(this._univerInstanceService, {
|
|
1911
2232
|
unitId: t.unitId,
|
|
1912
2233
|
subUnitId: t.subUnitId
|
|
1913
2234
|
});
|
|
1914
2235
|
if (!n)
|
|
1915
2236
|
throw new Error("cannot find current target!");
|
|
1916
|
-
const { unitId: r, subUnitId: s } = n, { initPosition: o, componentKey: a, data: d, allowTransform: u = !0 } = t, c = e != null ? e :
|
|
2237
|
+
const { unitId: r, subUnitId: s } = n, { initPosition: o, componentKey: a, data: d, allowTransform: u = !0 } = t, c = e != null ? e : Ve(), l = this._getPosition(o, r);
|
|
1917
2238
|
if (l == null)
|
|
1918
2239
|
return;
|
|
1919
2240
|
const g = {
|
|
1920
2241
|
unitId: r,
|
|
1921
2242
|
subUnitId: s,
|
|
1922
2243
|
drawingId: c,
|
|
1923
|
-
drawingType: t.type ||
|
|
2244
|
+
drawingType: t.type || x.DRAWING_DOM,
|
|
1924
2245
|
componentKey: a,
|
|
1925
2246
|
sheetTransform: l,
|
|
1926
2247
|
transform: {
|
|
@@ -1932,7 +2253,7 @@ let tt = class extends ne {
|
|
|
1932
2253
|
data: d,
|
|
1933
2254
|
allowTransform: u
|
|
1934
2255
|
};
|
|
1935
|
-
return this._commandService.executeCommand(
|
|
2256
|
+
return this._commandService.executeCommand(Xt.id, {
|
|
1936
2257
|
unitId: r,
|
|
1937
2258
|
drawings: [g]
|
|
1938
2259
|
}), this._add$.next({ unitId: r, subUnitId: s, id: c }), {
|
|
@@ -1959,8 +2280,8 @@ let tt = class extends ne {
|
|
|
1959
2280
|
}
|
|
1960
2281
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
1961
2282
|
addFloatDomToRange(t, e, n, r) {
|
|
1962
|
-
var C,
|
|
1963
|
-
const s =
|
|
2283
|
+
var C, _, y;
|
|
2284
|
+
const s = ae(this._univerInstanceService, {
|
|
1964
2285
|
unitId: e.unitId,
|
|
1965
2286
|
subUnitId: e.subUnitId
|
|
1966
2287
|
});
|
|
@@ -1970,84 +2291,84 @@ let tt = class extends ne {
|
|
|
1970
2291
|
if (!d) return;
|
|
1971
2292
|
const u = this._renderManagerService.getRenderById(o);
|
|
1972
2293
|
if (!u) return;
|
|
1973
|
-
const c = (C = this._renderManagerService.getRenderById(o)) == null ? void 0 : C.with(
|
|
2294
|
+
const c = (C = this._renderManagerService.getRenderById(o)) == null ? void 0 : C.with(X).getWorksheetSkeleton(a);
|
|
1974
2295
|
if (!c) return;
|
|
1975
|
-
const { componentKey: l, data: g, allowTransform: h = !0 } = e, f = r != null ? r :
|
|
1976
|
-
if (this._getPosition(
|
|
2296
|
+
const { componentKey: l, data: g, allowTransform: h = !0 } = e, f = r != null ? r : Ve(), { position: m, position$: p } = this._createRangePositionObserver(t, u, c.skeleton);
|
|
2297
|
+
if (this._getPosition(m, o) == null)
|
|
1977
2298
|
return;
|
|
1978
|
-
const
|
|
2299
|
+
const S = d.scene, { scaleX: I } = S.getAncestorScale(), D = Ut(m, n, I), v = {
|
|
1979
2300
|
unitId: o,
|
|
1980
2301
|
subUnitId: a,
|
|
1981
2302
|
drawingId: f,
|
|
1982
|
-
drawingType: e.type ||
|
|
2303
|
+
drawingType: e.type || x.DRAWING_DOM,
|
|
1983
2304
|
componentKey: l,
|
|
1984
2305
|
transform: {
|
|
1985
|
-
left:
|
|
1986
|
-
top:
|
|
1987
|
-
width:
|
|
1988
|
-
height:
|
|
2306
|
+
left: D.startX,
|
|
2307
|
+
top: D.startY,
|
|
2308
|
+
width: D.width,
|
|
2309
|
+
height: D.height
|
|
1989
2310
|
},
|
|
1990
2311
|
data: g,
|
|
1991
2312
|
allowTransform: h
|
|
1992
2313
|
};
|
|
1993
2314
|
{
|
|
1994
|
-
const { unitId:
|
|
2315
|
+
const { unitId: R, subUnitId: E, drawingId: T } = v, M = ae(this._univerInstanceService, { unitId: R, subUnitId: E }), b = v, N = this._univerInstanceService.getUnit(R, $.UNIVER_SHEET);
|
|
1995
2316
|
if (!N)
|
|
1996
2317
|
return;
|
|
1997
|
-
const
|
|
2318
|
+
const F = N.getActiveSheet().getSheetId();
|
|
1998
2319
|
if (!b || !M)
|
|
1999
2320
|
return;
|
|
2000
|
-
const
|
|
2001
|
-
if (!
|
|
2321
|
+
const te = (_ = this._renderManagerService.getRenderById(R)) == null ? void 0 : _.with(X);
|
|
2322
|
+
if (!te)
|
|
2002
2323
|
return;
|
|
2003
|
-
const
|
|
2004
|
-
if (!
|
|
2324
|
+
const z = te.getWorksheetSkeleton(E);
|
|
2325
|
+
if (!z)
|
|
2005
2326
|
return;
|
|
2006
|
-
const { transform:
|
|
2007
|
-
if (G !==
|
|
2327
|
+
const { transform: H, drawingType: G, data: J } = b;
|
|
2328
|
+
if (G !== x.DRAWING_DOM && G !== x.DRAWING_CHART)
|
|
2008
2329
|
return;
|
|
2009
|
-
const
|
|
2010
|
-
if (
|
|
2330
|
+
const K = this._getSceneAndTransformerByDrawingSearch(R);
|
|
2331
|
+
if (K == null)
|
|
2011
2332
|
return;
|
|
2012
|
-
const { scene:
|
|
2013
|
-
if (
|
|
2333
|
+
const { scene: W, canvas: Oe } = K;
|
|
2334
|
+
if (H == null || F !== E)
|
|
2014
2335
|
return;
|
|
2015
|
-
const { left:
|
|
2016
|
-
if (
|
|
2017
|
-
|
|
2336
|
+
const { left: mt, top: pt, width: wt, height: _t, angle: Zt, flipX: Jt, flipY: St, skewX: vt, skewY: Ue } = H, It = De({ unitId: R, subUnitId: E, drawingId: T }), le = W.getObject(It);
|
|
2337
|
+
if (le != null) {
|
|
2338
|
+
le.transformByState({ left: mt, top: pt, width: wt, height: _t, angle: Zt, flipX: Jt, flipY: St, skewX: vt, skewY: Ue });
|
|
2018
2339
|
return;
|
|
2019
2340
|
}
|
|
2020
|
-
const
|
|
2021
|
-
left:
|
|
2341
|
+
const ne = {
|
|
2342
|
+
left: mt,
|
|
2022
2343
|
// from floatDomParam.transform
|
|
2023
|
-
top:
|
|
2024
|
-
width:
|
|
2025
|
-
height:
|
|
2026
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2027
|
-
},
|
|
2028
|
-
if (
|
|
2029
|
-
const
|
|
2030
|
-
|
|
2344
|
+
top: pt,
|
|
2345
|
+
width: wt,
|
|
2346
|
+
height: _t,
|
|
2347
|
+
zIndex: this._drawingManagerService.getDrawingOrder(R, E).length - 1
|
|
2348
|
+
}, Pe = G === x.DRAWING_CHART;
|
|
2349
|
+
if (Pe) {
|
|
2350
|
+
const k = J ? J.backgroundColor : "white";
|
|
2351
|
+
ne.fill = k, ne.rotateEnabled = !1, J && J.border && (ne.stroke = J.border), ne.paintFirst = "stroke", ne.strokeWidth = 1, ne.borderEnabled = !1, ne.radius = 8;
|
|
2031
2352
|
}
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2034
|
-
const
|
|
2035
|
-
top:
|
|
2036
|
-
left:
|
|
2037
|
-
bottom:
|
|
2038
|
-
right:
|
|
2039
|
-
},
|
|
2040
|
-
dispose:
|
|
2041
|
-
rect:
|
|
2042
|
-
boundsOfViewArea:
|
|
2353
|
+
const ue = new ke(It, ne);
|
|
2354
|
+
Pe && ue.setObjectType(An.CHART), W.addObject(ue, qt), b.allowTransform !== !1 && W.attachTransformerTo(ue);
|
|
2355
|
+
const he = new yt(), Ct = W.getMainViewport(), { rowHeaderWidth: Ae, columnHeaderHeight: Qe } = z.skeleton, Rt = {
|
|
2356
|
+
top: Qe,
|
|
2357
|
+
left: Ae,
|
|
2358
|
+
bottom: Ct.bottom,
|
|
2359
|
+
right: Ct.right
|
|
2360
|
+
}, ge = {
|
|
2361
|
+
dispose: he,
|
|
2362
|
+
rect: ue,
|
|
2363
|
+
boundsOfViewArea: Rt,
|
|
2043
2364
|
domAnchor: n,
|
|
2044
|
-
unitId:
|
|
2045
|
-
subUnitId:
|
|
2046
|
-
},
|
|
2047
|
-
|
|
2048
|
-
let
|
|
2049
|
-
position$:
|
|
2050
|
-
id:
|
|
2365
|
+
unitId: R,
|
|
2366
|
+
subUnitId: E
|
|
2367
|
+
}, B = fe(ue, K.renderUnit.scene, z.skeleton, M.worksheet, ge), Ne = new je(B);
|
|
2368
|
+
ge.position$ = Ne;
|
|
2369
|
+
let et = {
|
|
2370
|
+
position$: Ne,
|
|
2371
|
+
id: T,
|
|
2051
2372
|
componentKey: b.componentKey,
|
|
2052
2373
|
onPointerDown: () => {
|
|
2053
2374
|
},
|
|
@@ -2055,58 +2376,58 @@ let tt = class extends ne {
|
|
|
2055
2376
|
},
|
|
2056
2377
|
onPointerUp: () => {
|
|
2057
2378
|
},
|
|
2058
|
-
onWheel: (
|
|
2059
|
-
|
|
2379
|
+
onWheel: (k) => {
|
|
2380
|
+
Oe.dispatchEvent(new WheelEvent(k.type, k));
|
|
2060
2381
|
},
|
|
2061
|
-
data:
|
|
2062
|
-
unitId:
|
|
2382
|
+
data: J,
|
|
2383
|
+
unitId: R
|
|
2063
2384
|
};
|
|
2064
|
-
e.eventPassThrough && (
|
|
2065
|
-
...
|
|
2066
|
-
onPointerDown: (
|
|
2067
|
-
|
|
2385
|
+
e.eventPassThrough && (et = {
|
|
2386
|
+
...et,
|
|
2387
|
+
onPointerDown: (k) => {
|
|
2388
|
+
Oe.dispatchEvent(new PointerEvent(k.type, k));
|
|
2068
2389
|
},
|
|
2069
|
-
onPointerMove: (
|
|
2070
|
-
|
|
2390
|
+
onPointerMove: (k) => {
|
|
2391
|
+
Oe.dispatchEvent(new PointerEvent(k.type, k));
|
|
2071
2392
|
},
|
|
2072
|
-
onPointerUp: (
|
|
2073
|
-
|
|
2393
|
+
onPointerUp: (k) => {
|
|
2394
|
+
Oe.dispatchEvent(new PointerEvent(k.type, k));
|
|
2074
2395
|
}
|
|
2075
|
-
}), this._canvasFloatDomService.addFloatDom(
|
|
2076
|
-
var
|
|
2077
|
-
const
|
|
2078
|
-
startX:
|
|
2079
|
-
startY:
|
|
2080
|
-
endX:
|
|
2081
|
-
endY:
|
|
2082
|
-
width: (
|
|
2083
|
-
height: (
|
|
2396
|
+
}), this._canvasFloatDomService.addFloatDom(et), this.disposeWithMe(p.subscribe((k) => {
|
|
2397
|
+
var Tn, On, Un, Pn;
|
|
2398
|
+
const En = Ut({
|
|
2399
|
+
startX: k.startX,
|
|
2400
|
+
startY: k.startY,
|
|
2401
|
+
endX: k.endX,
|
|
2402
|
+
endY: k.endY,
|
|
2403
|
+
width: (Tn = n.width) != null ? Tn : k.width,
|
|
2404
|
+
height: (On = n.height) != null ? On : k.height,
|
|
2084
2405
|
absolute: {
|
|
2085
|
-
left:
|
|
2086
|
-
top:
|
|
2406
|
+
left: m.absolute.left,
|
|
2407
|
+
top: m.absolute.top
|
|
2087
2408
|
}
|
|
2088
|
-
}, n),
|
|
2089
|
-
left:
|
|
2090
|
-
top:
|
|
2091
|
-
width: (
|
|
2092
|
-
height: (
|
|
2093
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2094
|
-
}),
|
|
2095
|
-
|
|
2409
|
+
}, n), Zr = De({ unitId: R, subUnitId: E, drawingId: T }), Jr = new ke(Zr, {
|
|
2410
|
+
left: En.startX,
|
|
2411
|
+
top: En.startY,
|
|
2412
|
+
width: (Un = n.width) != null ? Un : k.width,
|
|
2413
|
+
height: (Pn = n.height) != null ? Pn : k.height,
|
|
2414
|
+
zIndex: this._drawingManagerService.getDrawingOrder(R, E).length - 1
|
|
2415
|
+
}), qr = fe(Jr, K.renderUnit.scene, z.skeleton, M.worksheet, ge);
|
|
2416
|
+
Ne.next(qr);
|
|
2096
2417
|
}));
|
|
2097
|
-
const
|
|
2098
|
-
|
|
2099
|
-
|
|
2418
|
+
const tt = (y = this._renderManagerService.getRenderById(R)) == null ? void 0 : y.with(X);
|
|
2419
|
+
tt == null || tt.currentSkeleton$.subscribe((k) => {
|
|
2420
|
+
k && z.sheetId !== k.sheetId && this._removeDom(f, !0);
|
|
2100
2421
|
});
|
|
2101
|
-
const
|
|
2102
|
-
const
|
|
2103
|
-
|
|
2104
|
-
|
|
2422
|
+
const Dt = ue.onTransformChange$.subscribeEvent(() => {
|
|
2423
|
+
const k = fe(ue, K.renderUnit.scene, z.skeleton, M.worksheet, ge);
|
|
2424
|
+
Ne.next(
|
|
2425
|
+
k
|
|
2105
2426
|
);
|
|
2106
2427
|
});
|
|
2107
|
-
|
|
2108
|
-
this._canvasFloatDomService.removeFloatDom(
|
|
2109
|
-
}),
|
|
2428
|
+
he.add(() => {
|
|
2429
|
+
this._canvasFloatDomService.removeFloatDom(T);
|
|
2430
|
+
}), Dt && he.add(Dt), this._domLayerInfoMap.set(T, ge);
|
|
2110
2431
|
}
|
|
2111
2432
|
return {
|
|
2112
2433
|
id: f,
|
|
@@ -2117,8 +2438,8 @@ let tt = class extends ne {
|
|
|
2117
2438
|
}
|
|
2118
2439
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
2119
2440
|
addFloatDomToColumnHeader(t, e, n, r) {
|
|
2120
|
-
var
|
|
2121
|
-
const s =
|
|
2441
|
+
var D, v, C;
|
|
2442
|
+
const s = ae(this._univerInstanceService, {
|
|
2122
2443
|
unitId: e.unitId,
|
|
2123
2444
|
subUnitId: e.subUnitId
|
|
2124
2445
|
});
|
|
@@ -2128,153 +2449,153 @@ let tt = class extends ne {
|
|
|
2128
2449
|
if (!this._getSceneAndTransformerByDrawingSearch(o)) return;
|
|
2129
2450
|
const u = this._renderManagerService.getRenderById(o);
|
|
2130
2451
|
if (!u) return;
|
|
2131
|
-
const c = (
|
|
2452
|
+
const c = (D = this._renderManagerService.getRenderById(o)) == null ? void 0 : D.with(X).getWorksheetSkeleton(a);
|
|
2132
2453
|
if (!c) return;
|
|
2133
|
-
const { componentKey: l, data: g, allowTransform: h = !0 } = e, f = r != null ? r :
|
|
2454
|
+
const { componentKey: l, data: g, allowTransform: h = !0 } = e, f = r != null ? r : Ve(), { position: m, position$: p } = this._createRangePositionObserver({
|
|
2134
2455
|
startRow: 0,
|
|
2135
2456
|
endRow: 0,
|
|
2136
2457
|
startColumn: t,
|
|
2137
2458
|
endColumn: t
|
|
2138
|
-
}, u, c.skeleton),
|
|
2139
|
-
if (
|
|
2459
|
+
}, u, c.skeleton), w = m;
|
|
2460
|
+
if (w.startY = 0, this._getPosition(m, o) == null)
|
|
2140
2461
|
return;
|
|
2141
2462
|
const I = {
|
|
2142
2463
|
unitId: o,
|
|
2143
2464
|
subUnitId: a,
|
|
2144
2465
|
drawingId: f,
|
|
2145
|
-
drawingType: e.type ||
|
|
2466
|
+
drawingType: e.type || x.DRAWING_DOM,
|
|
2146
2467
|
componentKey: l,
|
|
2147
2468
|
transform: {
|
|
2148
|
-
left:
|
|
2149
|
-
top:
|
|
2150
|
-
width:
|
|
2151
|
-
height:
|
|
2469
|
+
left: w.startX,
|
|
2470
|
+
top: w.startY,
|
|
2471
|
+
width: w.width,
|
|
2472
|
+
height: w.height
|
|
2152
2473
|
},
|
|
2153
2474
|
data: g,
|
|
2154
2475
|
allowTransform: h
|
|
2155
2476
|
};
|
|
2156
2477
|
{
|
|
2157
|
-
const { unitId:
|
|
2478
|
+
const { unitId: _, subUnitId: y, drawingId: R } = I, E = ae(this._univerInstanceService, { unitId: _, subUnitId: y }), T = I, M = this._univerInstanceService.getUnit(_, $.UNIVER_SHEET);
|
|
2158
2479
|
if (!M)
|
|
2159
2480
|
return;
|
|
2160
2481
|
const b = M.getActiveSheet().getSheetId();
|
|
2161
|
-
if (!
|
|
2482
|
+
if (!T || !E)
|
|
2162
2483
|
return;
|
|
2163
|
-
const N = (
|
|
2484
|
+
const N = (v = this._renderManagerService.getRenderById(_)) == null ? void 0 : v.with(X);
|
|
2164
2485
|
if (!N)
|
|
2165
2486
|
return;
|
|
2166
|
-
const
|
|
2167
|
-
if (!
|
|
2487
|
+
const F = N.getWorksheetSkeleton(y);
|
|
2488
|
+
if (!F)
|
|
2168
2489
|
return;
|
|
2169
|
-
const { transform:
|
|
2170
|
-
if (
|
|
2490
|
+
const { transform: te, data: z } = T, H = this._getSceneAndTransformerByDrawingSearch(_);
|
|
2491
|
+
if (H == null)
|
|
2171
2492
|
return;
|
|
2172
|
-
const { scene: G, canvas:
|
|
2173
|
-
if (
|
|
2493
|
+
const { scene: G, canvas: J } = H;
|
|
2494
|
+
if (te == null || b !== y)
|
|
2174
2495
|
return;
|
|
2175
|
-
const { left:
|
|
2176
|
-
if (
|
|
2177
|
-
|
|
2496
|
+
const { left: K, top: W, width: Oe, height: mt, angle: pt, flipX: wt, flipY: _t, skewX: Zt, skewY: Jt } = te, St = De({ unitId: _, subUnitId: y, drawingId: R }), vt = G.getObject(St);
|
|
2497
|
+
if (vt != null) {
|
|
2498
|
+
vt.transformByState({ left: K, top: W, width: Oe, height: mt, angle: pt, flipX: wt, flipY: _t, skewX: Zt, skewY: Jt });
|
|
2178
2499
|
return;
|
|
2179
2500
|
}
|
|
2180
|
-
const
|
|
2181
|
-
startX:
|
|
2501
|
+
const Ue = Ut({
|
|
2502
|
+
startX: w.startX,
|
|
2182
2503
|
startY: 0,
|
|
2183
|
-
endX:
|
|
2184
|
-
endY:
|
|
2504
|
+
endX: m.endX,
|
|
2505
|
+
endY: m.endY,
|
|
2185
2506
|
width: n.width,
|
|
2186
2507
|
height: n.height,
|
|
2187
2508
|
absolute: {
|
|
2188
|
-
left:
|
|
2189
|
-
top:
|
|
2509
|
+
left: m.absolute.left,
|
|
2510
|
+
top: m.absolute.top
|
|
2190
2511
|
}
|
|
2191
|
-
}, n),
|
|
2192
|
-
left:
|
|
2193
|
-
top:
|
|
2194
|
-
width:
|
|
2195
|
-
height:
|
|
2196
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2197
|
-
},
|
|
2198
|
-
G.addObject(
|
|
2199
|
-
const
|
|
2512
|
+
}, n), It = {
|
|
2513
|
+
left: Ue.startX,
|
|
2514
|
+
top: Ue.startY,
|
|
2515
|
+
width: Ue.width,
|
|
2516
|
+
height: Ue.height,
|
|
2517
|
+
zIndex: this._drawingManagerService.getDrawingOrder(_, y).length - 1
|
|
2518
|
+
}, le = new ke(St, It);
|
|
2519
|
+
G.addObject(le, qt), T.allowTransform !== !1 && G.attachTransformerTo(le);
|
|
2520
|
+
const ne = new yt(), Pe = G.getMainViewport(), ue = {
|
|
2200
2521
|
top: 0,
|
|
2201
2522
|
//viewMain.top,
|
|
2202
|
-
left:
|
|
2203
|
-
bottom:
|
|
2204
|
-
right:
|
|
2205
|
-
},
|
|
2206
|
-
dispose:
|
|
2207
|
-
rect:
|
|
2523
|
+
left: Pe.left,
|
|
2524
|
+
bottom: Pe.bottom,
|
|
2525
|
+
right: Pe.right
|
|
2526
|
+
}, he = {
|
|
2527
|
+
dispose: ne,
|
|
2528
|
+
rect: le,
|
|
2208
2529
|
// position$,
|
|
2209
|
-
unitId:
|
|
2530
|
+
unitId: _,
|
|
2210
2531
|
subUnitId: y,
|
|
2211
|
-
boundsOfViewArea:
|
|
2532
|
+
boundsOfViewArea: ue,
|
|
2212
2533
|
domAnchor: n,
|
|
2213
2534
|
scrollDirectionResponse: "HORIZONTAL"
|
|
2214
2535
|
/* HORIZONTAL */
|
|
2215
|
-
},
|
|
2216
|
-
|
|
2217
|
-
let
|
|
2218
|
-
position$:
|
|
2219
|
-
id:
|
|
2220
|
-
componentKey:
|
|
2536
|
+
}, Ct = fe(le, H.renderUnit.scene, F.skeleton, E.worksheet, he), Ae = new je(Ct);
|
|
2537
|
+
he.position$ = Ae;
|
|
2538
|
+
let Qe = {
|
|
2539
|
+
position$: Ae,
|
|
2540
|
+
id: R,
|
|
2541
|
+
componentKey: T.componentKey,
|
|
2221
2542
|
onPointerDown: () => {
|
|
2222
2543
|
},
|
|
2223
2544
|
onPointerMove: () => {
|
|
2224
2545
|
},
|
|
2225
2546
|
onPointerUp: () => {
|
|
2226
2547
|
},
|
|
2227
|
-
onWheel: (
|
|
2228
|
-
|
|
2548
|
+
onWheel: (B) => {
|
|
2549
|
+
J.dispatchEvent(new WheelEvent(B.type, B));
|
|
2229
2550
|
},
|
|
2230
|
-
data:
|
|
2231
|
-
unitId:
|
|
2551
|
+
data: z,
|
|
2552
|
+
unitId: _
|
|
2232
2553
|
};
|
|
2233
|
-
e.eventPassThrough && (
|
|
2234
|
-
...
|
|
2235
|
-
onPointerDown: (
|
|
2236
|
-
|
|
2554
|
+
e.eventPassThrough && (Qe = {
|
|
2555
|
+
...Qe,
|
|
2556
|
+
onPointerDown: (B) => {
|
|
2557
|
+
J.dispatchEvent(new PointerEvent(B.type, B));
|
|
2237
2558
|
},
|
|
2238
|
-
onPointerMove: (
|
|
2239
|
-
|
|
2559
|
+
onPointerMove: (B) => {
|
|
2560
|
+
J.dispatchEvent(new PointerEvent(B.type, B));
|
|
2240
2561
|
},
|
|
2241
|
-
onPointerUp: (
|
|
2242
|
-
|
|
2562
|
+
onPointerUp: (B) => {
|
|
2563
|
+
J.dispatchEvent(new PointerEvent(B.type, B));
|
|
2243
2564
|
}
|
|
2244
|
-
}), this._canvasFloatDomService.addFloatDom(
|
|
2245
|
-
const
|
|
2246
|
-
const
|
|
2247
|
-
|
|
2248
|
-
|
|
2565
|
+
}), this._canvasFloatDomService.addFloatDom(Qe);
|
|
2566
|
+
const Rt = le.onTransformChange$.subscribeEvent(() => {
|
|
2567
|
+
const B = fe(le, H.renderUnit.scene, F.skeleton, E.worksheet, he);
|
|
2568
|
+
Ae.next(
|
|
2569
|
+
B
|
|
2249
2570
|
);
|
|
2250
2571
|
});
|
|
2251
|
-
this.disposeWithMe(
|
|
2252
|
-
const
|
|
2253
|
-
startX:
|
|
2572
|
+
this.disposeWithMe(p.subscribe((B) => {
|
|
2573
|
+
const Ne = Ut({
|
|
2574
|
+
startX: B.startX,
|
|
2254
2575
|
startY: 0,
|
|
2255
|
-
endX:
|
|
2256
|
-
endY:
|
|
2576
|
+
endX: B.endX,
|
|
2577
|
+
endY: B.endY,
|
|
2257
2578
|
width: n.width,
|
|
2258
2579
|
height: n.height,
|
|
2259
2580
|
absolute: {
|
|
2260
|
-
left:
|
|
2261
|
-
top:
|
|
2581
|
+
left: m.absolute.left,
|
|
2582
|
+
top: m.absolute.top
|
|
2262
2583
|
}
|
|
2263
|
-
}, n),
|
|
2264
|
-
left:
|
|
2584
|
+
}, n), et = De({ unitId: _, subUnitId: y, drawingId: R }), tt = new ke(et, {
|
|
2585
|
+
left: Ne.startX,
|
|
2265
2586
|
top: 0,
|
|
2266
2587
|
width: n.width,
|
|
2267
2588
|
height: n.height,
|
|
2268
|
-
zIndex: this._drawingManagerService.getDrawingOrder(
|
|
2269
|
-
}),
|
|
2270
|
-
|
|
2589
|
+
zIndex: this._drawingManagerService.getDrawingOrder(_, y).length - 1
|
|
2590
|
+
}), Dt = fe(tt, H.renderUnit.scene, F.skeleton, E.worksheet, he);
|
|
2591
|
+
Ae.next(Dt);
|
|
2271
2592
|
}));
|
|
2272
|
-
const
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
}),
|
|
2276
|
-
this._canvasFloatDomService.removeFloatDom(
|
|
2277
|
-
}),
|
|
2593
|
+
const ge = (C = this._renderManagerService.getRenderById(_)) == null ? void 0 : C.with(X);
|
|
2594
|
+
ge == null || ge.currentSkeleton$.subscribe((B) => {
|
|
2595
|
+
B && c.sheetId !== B.sheetId && this._removeDom(f, !0);
|
|
2596
|
+
}), ne.add(() => {
|
|
2597
|
+
this._canvasFloatDomService.removeFloatDom(R);
|
|
2598
|
+
}), Rt && ne.add(Rt), this._domLayerInfoMap.set(R, he);
|
|
2278
2599
|
}
|
|
2279
2600
|
return {
|
|
2280
2601
|
id: f,
|
|
@@ -2296,19 +2617,19 @@ let tt = class extends ne {
|
|
|
2296
2617
|
// eslint-disable-next-line max-lines-per-function
|
|
2297
2618
|
_createRangePositionObserver(t, e, n) {
|
|
2298
2619
|
let { startRow: r, startColumn: s } = t;
|
|
2299
|
-
const o =
|
|
2300
|
-
const
|
|
2301
|
-
a.next(
|
|
2302
|
-
}, l = new
|
|
2303
|
-
l.add(e.engine.clientRect$.subscribe(() => c())), l.add(this._commandService.onCommandExecuted((
|
|
2304
|
-
if (
|
|
2620
|
+
const o = st(r, s, n), a = new je(o), d = st(t.endRow, t.endColumn, n), u = new je(d), c = () => {
|
|
2621
|
+
const p = st(r, s, n), w = st(t.endRow, t.endColumn, n);
|
|
2622
|
+
a.next(p), u.next(w);
|
|
2623
|
+
}, l = new yt();
|
|
2624
|
+
l.add(e.engine.clientRect$.subscribe(() => c())), l.add(this._commandService.onCommandExecuted((p) => {
|
|
2625
|
+
if (p.id === Fi.id && p.params.rowsAutoHeightInfo.findIndex((S) => S.row === r) > -1) {
|
|
2305
2626
|
c();
|
|
2306
2627
|
return;
|
|
2307
2628
|
}
|
|
2308
|
-
(
|
|
2629
|
+
(Li.indexOf(p.id) > -1 || p.id === hi.id || p.id === kn.id) && c();
|
|
2309
2630
|
}));
|
|
2310
|
-
const g = (
|
|
2311
|
-
r =
|
|
2631
|
+
const g = (p, w) => {
|
|
2632
|
+
r = p, s = w, c();
|
|
2312
2633
|
}, h = () => ({
|
|
2313
2634
|
rotate: 0,
|
|
2314
2635
|
width: d.right - o.left,
|
|
@@ -2322,26 +2643,26 @@ let tt = class extends ne {
|
|
|
2322
2643
|
endX: d.right,
|
|
2323
2644
|
endY: d.bottom
|
|
2324
2645
|
}), f = a.pipe(
|
|
2325
|
-
|
|
2326
|
-
const
|
|
2646
|
+
pe((p) => {
|
|
2647
|
+
const w = st(t.endRow, t.endColumn, n);
|
|
2327
2648
|
return {
|
|
2328
2649
|
rotate: 0,
|
|
2329
|
-
width:
|
|
2330
|
-
height:
|
|
2650
|
+
width: w.right - p.left,
|
|
2651
|
+
height: w.bottom - p.top,
|
|
2331
2652
|
absolute: {
|
|
2332
2653
|
left: !0,
|
|
2333
2654
|
top: !0
|
|
2334
2655
|
},
|
|
2335
|
-
startX:
|
|
2336
|
-
startY:
|
|
2337
|
-
endX:
|
|
2338
|
-
endY:
|
|
2656
|
+
startX: p.left,
|
|
2657
|
+
startY: p.top,
|
|
2658
|
+
endX: w.right,
|
|
2659
|
+
endY: w.bottom
|
|
2339
2660
|
};
|
|
2340
2661
|
})
|
|
2341
|
-
),
|
|
2662
|
+
), m = h();
|
|
2342
2663
|
return {
|
|
2343
2664
|
position$: f,
|
|
2344
|
-
position:
|
|
2665
|
+
position: m,
|
|
2345
2666
|
updateRowCol: g,
|
|
2346
2667
|
topLeftPos$: a,
|
|
2347
2668
|
rightBottomPos$: u,
|
|
@@ -2349,16 +2670,16 @@ let tt = class extends ne {
|
|
|
2349
2670
|
};
|
|
2350
2671
|
}
|
|
2351
2672
|
};
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
],
|
|
2361
|
-
function
|
|
2673
|
+
lt = oo([
|
|
2674
|
+
be(0, A(Q)),
|
|
2675
|
+
be(1, de),
|
|
2676
|
+
be(2, A(Y)),
|
|
2677
|
+
be(3, oe),
|
|
2678
|
+
be(4, A(us)),
|
|
2679
|
+
be(5, se),
|
|
2680
|
+
be(6, A(Ri))
|
|
2681
|
+
], lt);
|
|
2682
|
+
function st(i, t, e) {
|
|
2362
2683
|
const n = e.getCellWithCoordByIndex(i, t), r = n.isMergedMainCell ? n.mergeInfo : n;
|
|
2363
2684
|
return {
|
|
2364
2685
|
left: r.startX,
|
|
@@ -2367,22 +2688,22 @@ function Je(i, t, e) {
|
|
|
2367
2688
|
bottom: r.endY
|
|
2368
2689
|
};
|
|
2369
2690
|
}
|
|
2370
|
-
function
|
|
2691
|
+
function Ut(i, t, e) {
|
|
2371
2692
|
var u, c;
|
|
2372
2693
|
e = e != null ? e : 1;
|
|
2373
2694
|
const n = i.endX - i.startX, r = i.endY - i.startY, s = (u = t == null ? void 0 : t.width) != null ? u : n, o = (c = t == null ? void 0 : t.height) != null ? c : r;
|
|
2374
2695
|
let a = 0, d = 0;
|
|
2375
2696
|
if (t) {
|
|
2376
2697
|
if (t.horizonOffsetAlign === "right") {
|
|
2377
|
-
const l =
|
|
2698
|
+
const l = Pt(t.marginX, n * e);
|
|
2378
2699
|
a = i.endX - l - s;
|
|
2379
2700
|
} else
|
|
2380
|
-
a = i.startX +
|
|
2701
|
+
a = i.startX + Pt(t.marginX, n);
|
|
2381
2702
|
if (t.verticalOffsetAlign === "bottom") {
|
|
2382
|
-
const l =
|
|
2703
|
+
const l = Pt(t.marginY, r * e);
|
|
2383
2704
|
d = i.endY - l - o;
|
|
2384
2705
|
} else
|
|
2385
|
-
d = i.startY +
|
|
2706
|
+
d = i.startY + Pt(t.marginY, r);
|
|
2386
2707
|
}
|
|
2387
2708
|
return {
|
|
2388
2709
|
rotate: 0,
|
|
@@ -2398,15 +2719,15 @@ function Ct(i, t, e) {
|
|
|
2398
2719
|
}
|
|
2399
2720
|
};
|
|
2400
2721
|
}
|
|
2401
|
-
function
|
|
2722
|
+
function Pt(i, t) {
|
|
2402
2723
|
if (i === void 0) return 0;
|
|
2403
2724
|
if (typeof i == "number") return i;
|
|
2404
2725
|
const e = Number.parseFloat(i);
|
|
2405
2726
|
return t * e / 100;
|
|
2406
2727
|
}
|
|
2407
|
-
const
|
|
2408
|
-
const { floatDomInfos: t, scene: e, skeleton: n, worksheet: r } = i, s =
|
|
2409
|
-
const { width: a, height: d, angle: u, left: c, top: l } = o.transform, g =
|
|
2728
|
+
const co = (i) => {
|
|
2729
|
+
const { floatDomInfos: t, scene: e, skeleton: n, worksheet: r } = i, s = Fe(() => t.map((o) => {
|
|
2730
|
+
const { width: a, height: d, angle: u, left: c, top: l } = o.transform, g = Hr(
|
|
2410
2731
|
{
|
|
2411
2732
|
left: c != null ? c : 0,
|
|
2412
2733
|
right: (c != null ? c : 0) + (a != null ? a : 0),
|
|
@@ -2418,7 +2739,7 @@ const Ts = (i) => {
|
|
|
2418
2739
|
r,
|
|
2419
2740
|
void 0,
|
|
2420
2741
|
!0
|
|
2421
|
-
), { scaleX: h, scaleY: f } = e.getAncestorScale(),
|
|
2742
|
+
), { scaleX: h, scaleY: f } = e.getAncestorScale(), m = {
|
|
2422
2743
|
startX: g.left,
|
|
2423
2744
|
endX: g.right,
|
|
2424
2745
|
startY: g.top,
|
|
@@ -2427,9 +2748,9 @@ const Ts = (i) => {
|
|
|
2427
2748
|
width: a * h,
|
|
2428
2749
|
height: d * f,
|
|
2429
2750
|
absolute: g.absolute
|
|
2430
|
-
},
|
|
2431
|
-
position$: new
|
|
2432
|
-
position:
|
|
2751
|
+
}, p = {
|
|
2752
|
+
position$: new je(m),
|
|
2753
|
+
position: m,
|
|
2433
2754
|
id: o.drawingId,
|
|
2434
2755
|
componentKey: o.componentKey,
|
|
2435
2756
|
onPointerMove: () => {
|
|
@@ -2443,16 +2764,16 @@ const Ts = (i) => {
|
|
|
2443
2764
|
unitId: o.unitId,
|
|
2444
2765
|
data: o.data
|
|
2445
2766
|
};
|
|
2446
|
-
return [o.drawingId,
|
|
2767
|
+
return [o.drawingId, p];
|
|
2447
2768
|
}), [t, e, n, r]);
|
|
2448
|
-
return /* @__PURE__ */
|
|
2769
|
+
return /* @__PURE__ */ L("div", { style: { position: "absolute", top: 0, left: 0 }, children: s.map(([o, a]) => /* @__PURE__ */ L(hs, { layer: a, id: o, position: a.position }, o)) });
|
|
2449
2770
|
};
|
|
2450
|
-
var
|
|
2451
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2771
|
+
var lo = Object.getOwnPropertyDescriptor, uo = (i, t, e, n) => {
|
|
2772
|
+
for (var r = n > 1 ? void 0 : n ? lo(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
2452
2773
|
(o = i[s]) && (r = o(r) || r);
|
|
2453
2774
|
return r;
|
|
2454
|
-
},
|
|
2455
|
-
let
|
|
2775
|
+
}, Me = (i, t) => (e, n) => t(e, n, i);
|
|
2776
|
+
let jt = class extends ee {
|
|
2456
2777
|
constructor(i, t, e, n, r, s, o) {
|
|
2457
2778
|
super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = t, this._drawingManagerService = e, this._renderManagerService = n, this._canvasFloatDomManagerService = r, this._componetManager = s, this._injector = o, this._initPrinting(), this._initPrintingDom();
|
|
2458
2779
|
}
|
|
@@ -2465,7 +2786,7 @@ let Ot = class extends ne {
|
|
|
2465
2786
|
const { unitId: n, scene: r, subUnitId: s } = t, o = this._drawingManagerService.getDrawingDataForUnit(n), a = o == null ? void 0 : o[s];
|
|
2466
2787
|
return a && a.order.forEach((d) => {
|
|
2467
2788
|
const u = a.data[d];
|
|
2468
|
-
u.drawingType !==
|
|
2789
|
+
u.drawingType !== x.DRAWING_CHART && u.drawingType !== x.DRAWING_DOM && this._drawingRenderService.renderDrawing(u, r);
|
|
2469
2790
|
}), e();
|
|
2470
2791
|
}
|
|
2471
2792
|
}
|
|
@@ -2478,7 +2799,7 @@ let Ot = class extends ne {
|
|
|
2478
2799
|
const { unitId: n, subUnitId: r } = t, s = this._renderManagerService.getRenderById(n);
|
|
2479
2800
|
if (!s)
|
|
2480
2801
|
return e(i);
|
|
2481
|
-
const o = s.with(
|
|
2802
|
+
const o = s.with(X).getSkeletonParam(r);
|
|
2482
2803
|
if (!o)
|
|
2483
2804
|
return e(i);
|
|
2484
2805
|
const a = this._drawingManagerService.getDrawingDataForUnit(n), d = a == null ? void 0 : a[t.subUnitId];
|
|
@@ -2486,9 +2807,9 @@ let Ot = class extends ne {
|
|
|
2486
2807
|
return e(i);
|
|
2487
2808
|
const { scaleX: u, scaleY: c } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, g = d.order.map((h) => d.data[h]);
|
|
2488
2809
|
return g.length ? (g.forEach((h) => {
|
|
2489
|
-
if (!h.groupId && h.transform &&
|
|
2490
|
-
const f = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, c, { x: 0, y: 0 }),
|
|
2491
|
-
f.column < l.startColumn && (l.startColumn = f.column), f.row < l.startRow && (l.startRow = f.row), l.endRow <
|
|
2810
|
+
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)) {
|
|
2811
|
+
const f = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, c, { x: 0, y: 0 }), m = o.skeleton.getCellIndexByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, u, c, { x: 0, y: 0 });
|
|
2812
|
+
f.column < l.startColumn && (l.startColumn = f.column), f.row < l.startRow && (l.startRow = f.row), l.endRow < m.row && (l.endRow = m.row), l.endColumn < m.column && (l.endColumn = m.column);
|
|
2492
2813
|
}
|
|
2493
2814
|
}), e(l)) : e(i);
|
|
2494
2815
|
}
|
|
@@ -2506,12 +2827,12 @@ let Ot = class extends ne {
|
|
|
2506
2827
|
if (o) {
|
|
2507
2828
|
const a = o.order.map((u) => {
|
|
2508
2829
|
const c = o.data[u];
|
|
2509
|
-
if (c.drawingType ===
|
|
2830
|
+
if (c.drawingType === x.DRAWING_CHART)
|
|
2510
2831
|
return {
|
|
2511
2832
|
...c,
|
|
2512
|
-
componentKey: this._componetManager.get(
|
|
2833
|
+
componentKey: this._componetManager.get(Mi)
|
|
2513
2834
|
};
|
|
2514
|
-
if (c.drawingType ===
|
|
2835
|
+
if (c.drawingType === x.DRAWING_DOM) {
|
|
2515
2836
|
const l = this._sheetPrintInterceptorService.getPrintComponent(c.componentKey);
|
|
2516
2837
|
return {
|
|
2517
2838
|
...c,
|
|
@@ -2519,12 +2840,12 @@ let Ot = class extends ne {
|
|
|
2519
2840
|
};
|
|
2520
2841
|
}
|
|
2521
2842
|
return null;
|
|
2522
|
-
}).filter(Boolean), d =
|
|
2523
|
-
return
|
|
2524
|
-
/* @__PURE__ */
|
|
2843
|
+
}).filter(Boolean), d = gs(co, this._injector);
|
|
2844
|
+
return Ji(
|
|
2845
|
+
/* @__PURE__ */ L(d, { floatDomInfos: a, scene: t.scene, skeleton: t.skeleton, worksheet: t.worksheet }),
|
|
2525
2846
|
t.root
|
|
2526
2847
|
), i == null || i.add(() => {
|
|
2527
|
-
|
|
2848
|
+
qi(t.root);
|
|
2528
2849
|
}), e(i);
|
|
2529
2850
|
}
|
|
2530
2851
|
}
|
|
@@ -2533,49 +2854,49 @@ let Ot = class extends ne {
|
|
|
2533
2854
|
);
|
|
2534
2855
|
}
|
|
2535
2856
|
};
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
],
|
|
2545
|
-
var
|
|
2546
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2857
|
+
jt = uo([
|
|
2858
|
+
Me(0, A(gi)),
|
|
2859
|
+
Me(1, A(Pr)),
|
|
2860
|
+
Me(2, oe),
|
|
2861
|
+
Me(3, Q),
|
|
2862
|
+
Me(4, A(lt)),
|
|
2863
|
+
Me(5, A(Ur)),
|
|
2864
|
+
Me(6, A(qe))
|
|
2865
|
+
], jt);
|
|
2866
|
+
var ho = Object.getOwnPropertyDescriptor, go = (i, t, e, n) => {
|
|
2867
|
+
for (var r = n > 1 ? void 0 : n ? ho(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
2547
2868
|
(o = i[s]) && (r = o(r) || r);
|
|
2548
2869
|
return r;
|
|
2549
|
-
},
|
|
2550
|
-
const
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
],
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2870
|
+
}, _e = (i, t) => (e, n) => t(e, n, i);
|
|
2871
|
+
const fo = [
|
|
2872
|
+
gr.id,
|
|
2873
|
+
fr.id,
|
|
2874
|
+
mr.id,
|
|
2875
|
+
pr.id,
|
|
2876
|
+
wr.id,
|
|
2877
|
+
_r.id,
|
|
2878
|
+
Sr.id,
|
|
2879
|
+
vr.id,
|
|
2880
|
+
mn.id,
|
|
2881
|
+
pn.id,
|
|
2882
|
+
Ir.id,
|
|
2883
|
+
Cr.id,
|
|
2884
|
+
Rr.id,
|
|
2885
|
+
Dr.id,
|
|
2886
|
+
br.id,
|
|
2887
|
+
Mr.id,
|
|
2888
|
+
yr.id,
|
|
2889
|
+
Er.id,
|
|
2890
|
+
Tr.id
|
|
2891
|
+
], mo = [
|
|
2892
|
+
Vi.id,
|
|
2893
|
+
Hi.id,
|
|
2894
|
+
Yi.id,
|
|
2895
|
+
Gi.id,
|
|
2896
|
+
Xi.id,
|
|
2897
|
+
zi.id
|
|
2577
2898
|
];
|
|
2578
|
-
let
|
|
2899
|
+
let Rn = class extends ee {
|
|
2579
2900
|
constructor(i, t, e, n, r, s, o, a, d) {
|
|
2580
2901
|
super(), this._context = i, this._renderManagerService = t, this._commandService = e, this._selectionRenderService = n, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = a, this._univerInstanceService = d, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
|
|
2581
2902
|
}
|
|
@@ -2584,57 +2905,57 @@ let rn = class extends ne {
|
|
|
2584
2905
|
this._sheetInterceptorService.interceptAfterCommand({
|
|
2585
2906
|
/* eslint-disable-next-line complexity */
|
|
2586
2907
|
getMutations: (i) => {
|
|
2587
|
-
if (!
|
|
2908
|
+
if (!fo.includes(i.id))
|
|
2588
2909
|
return { redos: [], undos: [] };
|
|
2589
2910
|
if (i.params == null)
|
|
2590
2911
|
return { redos: [], undos: [] };
|
|
2591
2912
|
const t = i.id;
|
|
2592
|
-
if (t ===
|
|
2913
|
+
if (t === gr.id)
|
|
2593
2914
|
return this._moveRowInterceptor(i.params, "insert");
|
|
2594
|
-
if ([
|
|
2915
|
+
if ([yr.id, Er.id, Tr.id].includes(t))
|
|
2595
2916
|
return this._moveRangeInterceptor(i.params);
|
|
2596
|
-
if (t ===
|
|
2917
|
+
if (t === fr.id)
|
|
2597
2918
|
return this._moveColInterceptor(i.params, "insert");
|
|
2598
|
-
if (t ===
|
|
2919
|
+
if (t === mr.id)
|
|
2599
2920
|
return this._moveRowInterceptor(i.params, "remove");
|
|
2600
|
-
if (t ===
|
|
2921
|
+
if (t === pr.id)
|
|
2601
2922
|
return this._moveColInterceptor(i.params, "remove");
|
|
2602
|
-
if (t ===
|
|
2923
|
+
if (t === wr.id) {
|
|
2603
2924
|
const { range: e } = i.params;
|
|
2604
2925
|
return this._getRangeMoveUndo(
|
|
2605
2926
|
e,
|
|
2606
2927
|
0
|
|
2607
2928
|
/* deleteLeft */
|
|
2608
2929
|
);
|
|
2609
|
-
} else if (t ===
|
|
2930
|
+
} else if (t === _r.id) {
|
|
2610
2931
|
const { range: e } = i.params;
|
|
2611
2932
|
return this._getRangeMoveUndo(
|
|
2612
2933
|
e,
|
|
2613
2934
|
1
|
|
2614
2935
|
/* deleteUp */
|
|
2615
2936
|
);
|
|
2616
|
-
} else if (t ===
|
|
2937
|
+
} else if (t === Sr.id) {
|
|
2617
2938
|
const { range: e } = i.params;
|
|
2618
2939
|
return this._getRangeMoveUndo(
|
|
2619
2940
|
e,
|
|
2620
2941
|
2
|
|
2621
2942
|
/* insertDown */
|
|
2622
2943
|
);
|
|
2623
|
-
} else if (t ===
|
|
2944
|
+
} else if (t === vr.id) {
|
|
2624
2945
|
const { range: e } = i.params;
|
|
2625
2946
|
return this._getRangeMoveUndo(
|
|
2626
2947
|
e,
|
|
2627
2948
|
3
|
|
2628
2949
|
/* insertRight */
|
|
2629
2950
|
);
|
|
2630
|
-
} else if (t ===
|
|
2951
|
+
} else if (t === Rr.id || t === Dr.id) {
|
|
2631
2952
|
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
|
|
2632
2953
|
return this._getDrawingUndoForRowVisible(n, r, s);
|
|
2633
|
-
} else if (t ===
|
|
2954
|
+
} else if (t === br.id || t === Mr.id) {
|
|
2634
2955
|
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
|
|
2635
2956
|
return this._getDrawingUndoForColVisible(n, r, s);
|
|
2636
|
-
} else if (t ===
|
|
2637
|
-
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t ===
|
|
2957
|
+
} else if (t === mn.id || t === pn.id || t === Ir.id || t === Cr.id) {
|
|
2958
|
+
const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t === mn.id || t === pn.id;
|
|
2638
2959
|
return this._getDrawingUndoForRowAndColSize(n, r, s, o);
|
|
2639
2960
|
}
|
|
2640
2961
|
return { redos: [], undos: [] };
|
|
@@ -2643,7 +2964,7 @@ let rn = class extends ne {
|
|
|
2643
2964
|
);
|
|
2644
2965
|
}
|
|
2645
2966
|
_getRangeMoveUndo(i, t) {
|
|
2646
|
-
const e =
|
|
2967
|
+
const e = ae(this._univerInstanceService);
|
|
2647
2968
|
if (e == null)
|
|
2648
2969
|
return { redos: [], undos: [] };
|
|
2649
2970
|
const n = e.unitId, r = e.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(n, r), d = [], u = [];
|
|
@@ -2660,49 +2981,49 @@ let rn = class extends ne {
|
|
|
2660
2981
|
const c = this._sheetDrawingService.getBatchRemoveOp(u), l = c.undo, g = c.redo, h = c.objects;
|
|
2661
2982
|
s.push({ id: P.id, params: { unitId: n, subUnitId: r, op: g, objects: h, type: U.REMOVE } }), o.push({ id: P.id, params: { unitId: n, subUnitId: r, op: l, objects: h, type: U.INSERT } });
|
|
2662
2983
|
}
|
|
2663
|
-
return s.push({ id:
|
|
2984
|
+
return s.push({ id: V.id, params: [n] }), o.push({ id: V.id, params: [n] }), {
|
|
2664
2985
|
redos: s,
|
|
2665
2986
|
undos: o
|
|
2666
2987
|
};
|
|
2667
2988
|
}
|
|
2668
2989
|
_getUpdateOrDeleteDrawings(i, t, e) {
|
|
2669
|
-
const n = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: a, unitId: d, subUnitId: u, drawingId: c } = e, { from: l, to: g } = s, { row: h, column: f } = l, { row:
|
|
2990
|
+
const n = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: a, unitId: d, subUnitId: u, drawingId: c } = e, { from: l, to: g } = s, { row: h, column: f } = l, { row: m, column: p } = g;
|
|
2670
2991
|
if (s == null || a == null)
|
|
2671
2992
|
return {
|
|
2672
2993
|
updateDrawings: n,
|
|
2673
2994
|
deleteDrawings: r
|
|
2674
2995
|
};
|
|
2675
|
-
const { startRow:
|
|
2676
|
-
let
|
|
2677
|
-
if (t === 0 && h >=
|
|
2678
|
-
if (f >= I &&
|
|
2996
|
+
const { startRow: w, endRow: S, startColumn: I, endColumn: D } = i;
|
|
2997
|
+
let v = null, C = null;
|
|
2998
|
+
if (t === 0 && h >= w && m <= S)
|
|
2999
|
+
if (f >= I && p <= D)
|
|
2679
3000
|
r.push({ unitId: d, subUnitId: u, drawingId: c });
|
|
2680
3001
|
else {
|
|
2681
|
-
const
|
|
2682
|
-
|
|
3002
|
+
const _ = this._shrinkCol(s, a, I, D, o);
|
|
3003
|
+
v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
2683
3004
|
}
|
|
2684
|
-
else if (t === 1 && f >= I &&
|
|
2685
|
-
if (h >=
|
|
3005
|
+
else if (t === 1 && f >= I && p <= D)
|
|
3006
|
+
if (h >= w && m <= S)
|
|
2686
3007
|
r.push({ unitId: d, subUnitId: u, drawingId: c });
|
|
2687
3008
|
else {
|
|
2688
|
-
const
|
|
2689
|
-
|
|
3009
|
+
const _ = this._shrinkRow(s, a, w, S, o);
|
|
3010
|
+
v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
2690
3011
|
}
|
|
2691
3012
|
else if (t === 2) {
|
|
2692
|
-
const
|
|
2693
|
-
|
|
3013
|
+
const _ = this._expandRow(s, a, w, S, o);
|
|
3014
|
+
v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
2694
3015
|
} else if (t === 3) {
|
|
2695
|
-
const
|
|
2696
|
-
|
|
3016
|
+
const _ = this._expandCol(s, a, I, D, o);
|
|
3017
|
+
v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
|
|
2697
3018
|
}
|
|
2698
|
-
if (
|
|
2699
|
-
const
|
|
2700
|
-
n.push({ ...e, sheetTransform:
|
|
3019
|
+
if (v != null && C != null) {
|
|
3020
|
+
const _ = Z(v, this._selectionRenderService, this._skeletonManagerService);
|
|
3021
|
+
n.push({ ...e, sheetTransform: v, transform: _ });
|
|
2701
3022
|
}
|
|
2702
3023
|
return { updateDrawings: n, deleteDrawings: r };
|
|
2703
3024
|
}
|
|
2704
3025
|
_remainDrawingSize(i, t, e) {
|
|
2705
|
-
const n =
|
|
3026
|
+
const n = j({ ...i }, this._selectionRenderService);
|
|
2706
3027
|
n != null && t.push({
|
|
2707
3028
|
...e,
|
|
2708
3029
|
sheetTransform: n
|
|
@@ -2716,31 +3037,31 @@ let rn = class extends ne {
|
|
|
2716
3037
|
if (f === O.None)
|
|
2717
3038
|
this._remainDrawingSize(h, r, l);
|
|
2718
3039
|
else {
|
|
2719
|
-
const { from:
|
|
2720
|
-
for (let
|
|
2721
|
-
const C = e[
|
|
2722
|
-
if (
|
|
3040
|
+
const { from: m, to: p } = g, { row: w, column: S } = m, { row: I, column: D } = p;
|
|
3041
|
+
for (let v = 0; v < e.length; v++) {
|
|
3042
|
+
const C = e[v], { startRow: _, endRow: y, startColumn: R, endColumn: E } = C;
|
|
3043
|
+
if (D < R)
|
|
2723
3044
|
continue;
|
|
2724
3045
|
if (f === O.Position) {
|
|
2725
3046
|
let b = null, N = null;
|
|
2726
|
-
if (
|
|
2727
|
-
const
|
|
2728
|
-
if (
|
|
3047
|
+
if (S >= R && S <= E) {
|
|
3048
|
+
const F = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: E, startRow: m.row, endRow: p.row });
|
|
3049
|
+
if (F == null)
|
|
2729
3050
|
return;
|
|
2730
|
-
N = { ...h, left:
|
|
3051
|
+
N = { ...h, left: F.startX };
|
|
2731
3052
|
}
|
|
2732
|
-
if (N != null && (b =
|
|
3053
|
+
if (N != null && (b = j(N, this._selectionRenderService), b != null && N != null)) {
|
|
2733
3054
|
r.push({ ...l, sheetTransform: b, transform: N });
|
|
2734
3055
|
break;
|
|
2735
3056
|
}
|
|
2736
3057
|
this._remainDrawingSize(h, r, l);
|
|
2737
3058
|
continue;
|
|
2738
3059
|
}
|
|
2739
|
-
if (
|
|
3060
|
+
if (S >= R && D <= E)
|
|
2740
3061
|
continue;
|
|
2741
|
-
let
|
|
2742
|
-
if (
|
|
2743
|
-
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn:
|
|
3062
|
+
let T = null, M = null;
|
|
3063
|
+
if (S >= R && S <= E) {
|
|
3064
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: E, startRow: m.row, endRow: p.row });
|
|
2744
3065
|
if (b == null)
|
|
2745
3066
|
return;
|
|
2746
3067
|
M = {
|
|
@@ -2748,8 +3069,8 @@ let rn = class extends ne {
|
|
|
2748
3069
|
left: (b == null ? void 0 : b.startX) || 0,
|
|
2749
3070
|
width: ((h == null ? void 0 : h.width) || 0) - b.endX + b.startX
|
|
2750
3071
|
};
|
|
2751
|
-
} else if (
|
|
2752
|
-
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn:
|
|
3072
|
+
} else if (D >= R && D <= E) {
|
|
3073
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: R, endColumn: D, startRow: m.row, endRow: p.row });
|
|
2753
3074
|
if (b == null)
|
|
2754
3075
|
return;
|
|
2755
3076
|
M = {
|
|
@@ -2757,19 +3078,19 @@ let rn = class extends ne {
|
|
|
2757
3078
|
left: b.startX - ((h == null ? void 0 : h.width) || 0)
|
|
2758
3079
|
};
|
|
2759
3080
|
} else {
|
|
2760
|
-
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn:
|
|
3081
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: R, endColumn: E, startRow: m.row, endRow: p.row });
|
|
2761
3082
|
if (b == null)
|
|
2762
3083
|
return;
|
|
2763
3084
|
if (M = {
|
|
2764
3085
|
...h,
|
|
2765
3086
|
width: ((h == null ? void 0 : h.width) || 0) - b.endX + b.startX
|
|
2766
|
-
},
|
|
2767
|
-
s.push({ ...l, sheetTransform:
|
|
3087
|
+
}, T = j(M, this._selectionRenderService), T != null && M != null) {
|
|
3088
|
+
s.push({ ...l, sheetTransform: T, transform: M });
|
|
2768
3089
|
break;
|
|
2769
3090
|
}
|
|
2770
3091
|
}
|
|
2771
|
-
if (M != null && (
|
|
2772
|
-
r.push({ ...l, sheetTransform:
|
|
3092
|
+
if (M != null && (T = j(M, this._selectionRenderService)), M != null && T != null) {
|
|
3093
|
+
r.push({ ...l, sheetTransform: T, transform: M });
|
|
2773
3094
|
break;
|
|
2774
3095
|
} else
|
|
2775
3096
|
this._remainDrawingSize(h, r, l);
|
|
@@ -2792,10 +3113,10 @@ let rn = class extends ne {
|
|
|
2792
3113
|
_createUndoAndRedoMutation(i, t, e) {
|
|
2793
3114
|
const n = this._sheetDrawingService.getBatchUpdateOp(e), { undo: r, redo: s, objects: o } = n, a = [
|
|
2794
3115
|
{ id: P.id, params: { unitId: i, subUnitId: t, op: s, objects: o, type: U.UPDATE } },
|
|
2795
|
-
{ id:
|
|
3116
|
+
{ id: V.id, params: [i] }
|
|
2796
3117
|
], d = [
|
|
2797
3118
|
{ id: P.id, params: { unitId: i, subUnitId: t, op: r, objects: o, type: U.UPDATE } },
|
|
2798
|
-
{ id:
|
|
3119
|
+
{ id: V.id, params: [i] }
|
|
2799
3120
|
];
|
|
2800
3121
|
return {
|
|
2801
3122
|
redos: a,
|
|
@@ -2810,31 +3131,31 @@ let rn = class extends ne {
|
|
|
2810
3131
|
if (f === O.None)
|
|
2811
3132
|
this._remainDrawingSize(h, r, l);
|
|
2812
3133
|
else {
|
|
2813
|
-
const { from:
|
|
2814
|
-
for (let
|
|
2815
|
-
const C = e[
|
|
2816
|
-
if (I <
|
|
3134
|
+
const { from: m, to: p } = g, { row: w, column: S } = m, { row: I, column: D } = p;
|
|
3135
|
+
for (let v = 0; v < e.length; v++) {
|
|
3136
|
+
const C = e[v], { startRow: _, endRow: y, startColumn: R, endColumn: E } = C;
|
|
3137
|
+
if (I < _)
|
|
2817
3138
|
continue;
|
|
2818
3139
|
if (f === O.Position) {
|
|
2819
3140
|
let b = null, N = null;
|
|
2820
|
-
if (
|
|
2821
|
-
const
|
|
2822
|
-
if (
|
|
3141
|
+
if (w >= _ && w <= y) {
|
|
3142
|
+
const F = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow: y });
|
|
3143
|
+
if (F == null)
|
|
2823
3144
|
return;
|
|
2824
|
-
N = { ...h, top:
|
|
3145
|
+
N = { ...h, top: F.startY };
|
|
2825
3146
|
}
|
|
2826
|
-
if (N != null && (b =
|
|
3147
|
+
if (N != null && (b = j(N, this._selectionRenderService), b != null && N != null)) {
|
|
2827
3148
|
r.push({ ...l, sheetTransform: b, transform: N });
|
|
2828
3149
|
break;
|
|
2829
3150
|
}
|
|
2830
3151
|
this._remainDrawingSize(h, r, l);
|
|
2831
3152
|
continue;
|
|
2832
3153
|
}
|
|
2833
|
-
if (
|
|
3154
|
+
if (w >= _ && I <= y)
|
|
2834
3155
|
continue;
|
|
2835
|
-
let
|
|
2836
|
-
if (
|
|
2837
|
-
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn:
|
|
3156
|
+
let T = null, M = null;
|
|
3157
|
+
if (w >= _ && w <= y) {
|
|
3158
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow: y });
|
|
2838
3159
|
if (b == null)
|
|
2839
3160
|
return;
|
|
2840
3161
|
M = {
|
|
@@ -2842,8 +3163,8 @@ let rn = class extends ne {
|
|
|
2842
3163
|
top: (b == null ? void 0 : b.startY) || 0,
|
|
2843
3164
|
height: ((h == null ? void 0 : h.height) || 0) - b.endY + b.startY
|
|
2844
3165
|
};
|
|
2845
|
-
} else if (I >=
|
|
2846
|
-
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn:
|
|
3166
|
+
} else if (I >= _ && I <= y) {
|
|
3167
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: _, endRow: I });
|
|
2847
3168
|
if (b == null)
|
|
2848
3169
|
return;
|
|
2849
3170
|
M = {
|
|
@@ -2851,19 +3172,19 @@ let rn = class extends ne {
|
|
|
2851
3172
|
top: b.startY - ((h == null ? void 0 : h.height) || 0)
|
|
2852
3173
|
};
|
|
2853
3174
|
} else {
|
|
2854
|
-
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn:
|
|
3175
|
+
const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: _, endRow: y });
|
|
2855
3176
|
if (b == null)
|
|
2856
3177
|
return;
|
|
2857
3178
|
if (M = {
|
|
2858
3179
|
...h,
|
|
2859
3180
|
height: ((h == null ? void 0 : h.height) || 0) - b.endY + b.startY
|
|
2860
|
-
},
|
|
2861
|
-
s.push({ ...l, sheetTransform:
|
|
3181
|
+
}, T = j(M, this._selectionRenderService), T != null && M != null) {
|
|
3182
|
+
s.push({ ...l, sheetTransform: T, transform: M });
|
|
2862
3183
|
break;
|
|
2863
3184
|
}
|
|
2864
3185
|
}
|
|
2865
|
-
if (M != null && (
|
|
2866
|
-
r.push({ ...l, sheetTransform:
|
|
3186
|
+
if (M != null && (T = j(M, this._selectionRenderService)), M != null && T != null) {
|
|
3187
|
+
r.push({ ...l, sheetTransform: T, transform: M });
|
|
2867
3188
|
break;
|
|
2868
3189
|
} else
|
|
2869
3190
|
this._remainDrawingSize(h, r, l);
|
|
@@ -2890,20 +3211,20 @@ let rn = class extends ne {
|
|
|
2890
3211
|
if (c === O.None)
|
|
2891
3212
|
this._remainDrawingSize(u, s, a);
|
|
2892
3213
|
else {
|
|
2893
|
-
const { from: l, to: g } = d, { row: h, column: f } = l, { row:
|
|
2894
|
-
for (let
|
|
2895
|
-
const
|
|
2896
|
-
if (
|
|
3214
|
+
const { from: l, to: g } = d, { row: h, column: f } = l, { row: m, column: p } = g;
|
|
3215
|
+
for (let w = 0; w < e.length; w++) {
|
|
3216
|
+
const S = e[w], { startRow: I, endRow: D, startColumn: v, endColumn: C } = S;
|
|
3217
|
+
if (m < I || p < v)
|
|
2897
3218
|
continue;
|
|
2898
|
-
if (c === O.Position && (h <= I &&
|
|
3219
|
+
if (c === O.Position && (h <= I && m >= D || f <= v && p >= C)) {
|
|
2899
3220
|
this._remainDrawingSize(u, s, a);
|
|
2900
3221
|
continue;
|
|
2901
3222
|
}
|
|
2902
|
-
const
|
|
2903
|
-
if (
|
|
3223
|
+
const _ = Z({ ...d }, this._selectionRenderService, this._skeletonManagerService);
|
|
3224
|
+
if (_ != null) {
|
|
2904
3225
|
s.push({
|
|
2905
3226
|
...a,
|
|
2906
|
-
transform:
|
|
3227
|
+
transform: _
|
|
2907
3228
|
});
|
|
2908
3229
|
break;
|
|
2909
3230
|
}
|
|
@@ -2916,7 +3237,7 @@ let rn = class extends ne {
|
|
|
2916
3237
|
if (t === "insert")
|
|
2917
3238
|
e = i.unitId, n = i.subUnitId;
|
|
2918
3239
|
else {
|
|
2919
|
-
const r =
|
|
3240
|
+
const r = ae(this._univerInstanceService);
|
|
2920
3241
|
if (r == null)
|
|
2921
3242
|
return;
|
|
2922
3243
|
e = r.unitId, n = r.subUnitId;
|
|
@@ -2924,50 +3245,50 @@ let rn = class extends ne {
|
|
|
2924
3245
|
return { unitId: e, subUnitId: n };
|
|
2925
3246
|
}
|
|
2926
3247
|
_moveRangeInterceptor(i) {
|
|
2927
|
-
var I,
|
|
2928
|
-
const { toRange: t, fromRange: e } = i, n =
|
|
3248
|
+
var I, D;
|
|
3249
|
+
const { toRange: t, fromRange: e } = i, n = ae(this._univerInstanceService);
|
|
2929
3250
|
if (!n)
|
|
2930
3251
|
return { redos: [], undos: [] };
|
|
2931
|
-
const { unitId: r, subUnitId: s } = n, o = (
|
|
3252
|
+
const { unitId: r, subUnitId: s } = n, o = (D = (I = this._renderManagerService.getRenderById(r)) == null ? void 0 : I.with(X)) == null ? void 0 : D.getCurrentSkeleton();
|
|
2932
3253
|
if (!o)
|
|
2933
3254
|
return { redos: [], undos: [] };
|
|
2934
|
-
const a =
|
|
3255
|
+
const a = dr(o, e);
|
|
2935
3256
|
if (!a)
|
|
2936
3257
|
return { redos: [], undos: [] };
|
|
2937
3258
|
const { startX: d, endX: u, startY: c, endY: l } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
|
|
2938
|
-
Object.keys(g).forEach((
|
|
2939
|
-
const C = g[
|
|
3259
|
+
Object.keys(g).forEach((v) => {
|
|
3260
|
+
const C = g[v];
|
|
2940
3261
|
if (C.anchorType !== O.Both)
|
|
2941
3262
|
return;
|
|
2942
|
-
const { transform:
|
|
2943
|
-
if (!
|
|
3263
|
+
const { transform: _ } = C;
|
|
3264
|
+
if (!_)
|
|
2944
3265
|
return;
|
|
2945
|
-
const { left: y = 0, top:
|
|
3266
|
+
const { left: y = 0, top: R = 0, width: E = 0, height: T = 0 } = _, { drawingStartX: M, drawingEndX: b, drawingStartY: N, drawingEndY: F } = {
|
|
2946
3267
|
drawingStartX: y,
|
|
2947
|
-
drawingEndX: y +
|
|
2948
|
-
drawingStartY:
|
|
2949
|
-
drawingEndY:
|
|
3268
|
+
drawingEndX: y + E,
|
|
3269
|
+
drawingStartY: R,
|
|
3270
|
+
drawingEndY: R + T
|
|
2950
3271
|
};
|
|
2951
|
-
d <= M && b <= u && c <= N &&
|
|
3272
|
+
d <= M && b <= u && c <= N && F <= l && h.push(C);
|
|
2952
3273
|
});
|
|
2953
|
-
const f = [],
|
|
2954
|
-
const C =
|
|
2955
|
-
to: { ...C.to, row: C.to.row +
|
|
2956
|
-
from: { ...C.from, row: C.from.row +
|
|
2957
|
-
}, y =
|
|
3274
|
+
const f = [], m = [], p = t.startRow - e.startRow, w = t.startColumn - e.startColumn, S = h.map((v) => {
|
|
3275
|
+
const C = v.sheetTransform, _ = {
|
|
3276
|
+
to: { ...C.to, row: C.to.row + p, column: C.to.column + w },
|
|
3277
|
+
from: { ...C.from, row: C.from.row + p, column: C.from.column + w }
|
|
3278
|
+
}, y = Z(_, this._selectionRenderService, this._skeletonManagerService);
|
|
2958
3279
|
return {
|
|
2959
3280
|
unitId: r,
|
|
2960
3281
|
subUnitId: s,
|
|
2961
|
-
drawingId:
|
|
3282
|
+
drawingId: v.drawingId,
|
|
2962
3283
|
transform: y,
|
|
2963
|
-
sheetTransform:
|
|
3284
|
+
sheetTransform: _
|
|
2964
3285
|
};
|
|
2965
3286
|
});
|
|
2966
|
-
if (
|
|
2967
|
-
const
|
|
2968
|
-
f.push({ id: P.id, params: { unitId: r, subUnitId: s, op:
|
|
3287
|
+
if (S.length) {
|
|
3288
|
+
const v = this._sheetDrawingService.getBatchUpdateOp(S), { undo: C, redo: _, objects: y } = v;
|
|
3289
|
+
f.push({ id: P.id, params: { unitId: r, subUnitId: s, op: _, objects: y, type: U.UPDATE } }), m.push({ id: P.id, params: { unitId: r, subUnitId: s, op: C, objects: y, type: U.UPDATE } });
|
|
2969
3290
|
}
|
|
2970
|
-
return { redos: f, undos:
|
|
3291
|
+
return { redos: f, undos: m };
|
|
2971
3292
|
}
|
|
2972
3293
|
_moveRowInterceptor(i, t) {
|
|
2973
3294
|
const e = this._getUnitIdAndSubUnitId(i, t);
|
|
@@ -2975,37 +3296,37 @@ let rn = class extends ne {
|
|
|
2975
3296
|
return { redos: [], undos: [] };
|
|
2976
3297
|
const { unitId: n, subUnitId: r } = e, { range: s } = i, o = s.startRow, a = s.endRow, d = [], u = [], c = this._sheetDrawingService.getDrawingData(n, r), l = [], g = [];
|
|
2977
3298
|
if (Object.keys(c).forEach((h) => {
|
|
2978
|
-
const f = c[h], { sheetTransform:
|
|
2979
|
-
if (
|
|
3299
|
+
const f = c[h], { sheetTransform: m, transform: p, anchorType: w = O.Position } = f;
|
|
3300
|
+
if (m == null || p == null)
|
|
2980
3301
|
return;
|
|
2981
|
-
let
|
|
3302
|
+
let S, I;
|
|
2982
3303
|
if (t === "insert") {
|
|
2983
|
-
const
|
|
2984
|
-
|
|
3304
|
+
const v = this._expandRow(m, p, o, a, w);
|
|
3305
|
+
S = v == null ? void 0 : v.newSheetTransform, I = v == null ? void 0 : v.newTransform;
|
|
2985
3306
|
} else {
|
|
2986
|
-
const { from:
|
|
2987
|
-
if (
|
|
3307
|
+
const { from: v, to: C } = m, { row: _ } = v, { row: y } = C;
|
|
3308
|
+
if (w === O.Both && _ >= o && y <= a)
|
|
2988
3309
|
g.push({ unitId: n, subUnitId: r, drawingId: h });
|
|
2989
3310
|
else {
|
|
2990
|
-
const
|
|
2991
|
-
|
|
3311
|
+
const R = this._shrinkRow(m, p, o, a, w);
|
|
3312
|
+
S = R == null ? void 0 : R.newSheetTransform, I = R == null ? void 0 : R.newTransform;
|
|
2992
3313
|
}
|
|
2993
3314
|
}
|
|
2994
|
-
if (!
|
|
3315
|
+
if (!S || !I)
|
|
2995
3316
|
return;
|
|
2996
|
-
const
|
|
2997
|
-
l.push(
|
|
3317
|
+
const D = { unitId: n, subUnitId: r, drawingId: h, transform: I, sheetTransform: S };
|
|
3318
|
+
l.push(D);
|
|
2998
3319
|
}), l.length === 0 && g.length === 0)
|
|
2999
3320
|
return { redos: [], undos: [] };
|
|
3000
3321
|
if (l.length > 0) {
|
|
3001
|
-
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo:
|
|
3002
|
-
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op:
|
|
3322
|
+
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: m, objects: p } = h;
|
|
3323
|
+
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: U.UPDATE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: U.UPDATE } });
|
|
3003
3324
|
}
|
|
3004
3325
|
if (g.length > 0) {
|
|
3005
|
-
const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo,
|
|
3006
|
-
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op:
|
|
3326
|
+
const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, m = h.redo, p = h.objects;
|
|
3327
|
+
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: U.REMOVE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: U.INSERT } });
|
|
3007
3328
|
}
|
|
3008
|
-
return d.push({ id:
|
|
3329
|
+
return d.push({ id: V.id, params: [n] }), u.push({ id: V.id, params: [n] }), {
|
|
3009
3330
|
redos: d,
|
|
3010
3331
|
undos: u
|
|
3011
3332
|
};
|
|
@@ -3016,43 +3337,43 @@ let rn = class extends ne {
|
|
|
3016
3337
|
return { redos: [], undos: [] };
|
|
3017
3338
|
const { unitId: n, subUnitId: r } = e, { range: s } = i, o = s.startColumn, a = s.endColumn, d = [], u = [], c = this._sheetDrawingService.getDrawingData(n, r), l = [], g = [];
|
|
3018
3339
|
if (Object.keys(c).forEach((h) => {
|
|
3019
|
-
const f = c[h], { sheetTransform:
|
|
3020
|
-
if (
|
|
3340
|
+
const f = c[h], { sheetTransform: m, transform: p, anchorType: w = O.Position } = f;
|
|
3341
|
+
if (m == null || p == null)
|
|
3021
3342
|
return;
|
|
3022
|
-
let
|
|
3343
|
+
let S, I;
|
|
3023
3344
|
if (t === "insert") {
|
|
3024
|
-
const
|
|
3025
|
-
|
|
3345
|
+
const v = this._expandCol(m, p, o, a, w);
|
|
3346
|
+
S = v == null ? void 0 : v.newSheetTransform, I = v == null ? void 0 : v.newTransform;
|
|
3026
3347
|
} else {
|
|
3027
|
-
const { from:
|
|
3028
|
-
if (
|
|
3348
|
+
const { from: v, to: C } = m, { column: _ } = v, { column: y } = C;
|
|
3349
|
+
if (w === O.Both && _ >= o && y <= a)
|
|
3029
3350
|
g.push({ unitId: n, subUnitId: r, drawingId: h });
|
|
3030
3351
|
else {
|
|
3031
|
-
const
|
|
3032
|
-
|
|
3352
|
+
const R = this._shrinkCol(m, p, o, a, w);
|
|
3353
|
+
S = R == null ? void 0 : R.newSheetTransform, I = R == null ? void 0 : R.newTransform;
|
|
3033
3354
|
}
|
|
3034
3355
|
}
|
|
3035
|
-
if (!
|
|
3356
|
+
if (!S || !I)
|
|
3036
3357
|
return;
|
|
3037
|
-
const
|
|
3038
|
-
l.push(
|
|
3358
|
+
const D = { unitId: n, subUnitId: r, drawingId: h, transform: I, sheetTransform: S };
|
|
3359
|
+
l.push(D);
|
|
3039
3360
|
}), l.length === 0 && g.length === 0)
|
|
3040
3361
|
return { redos: [], undos: [] };
|
|
3041
3362
|
if (l.length > 0) {
|
|
3042
|
-
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo:
|
|
3043
|
-
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op:
|
|
3363
|
+
const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: m, objects: p } = h;
|
|
3364
|
+
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: U.UPDATE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: U.UPDATE } });
|
|
3044
3365
|
}
|
|
3045
3366
|
if (g.length > 0) {
|
|
3046
|
-
const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo,
|
|
3047
|
-
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op:
|
|
3367
|
+
const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, m = h.redo, p = h.objects;
|
|
3368
|
+
d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: U.REMOVE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: U.INSERT } });
|
|
3048
3369
|
}
|
|
3049
|
-
return d.push({ id:
|
|
3370
|
+
return d.push({ id: V.id, params: [n] }), u.push({ id: V.id, params: [n] }), { redos: d, undos: u };
|
|
3050
3371
|
}
|
|
3051
3372
|
_expandCol(i, t, e, n, r = O.Position) {
|
|
3052
3373
|
const s = n - e + 1, { from: o, to: a } = i, { column: d } = o, { column: u } = a;
|
|
3053
3374
|
if (r === O.None)
|
|
3054
3375
|
return {
|
|
3055
|
-
newSheetTransform:
|
|
3376
|
+
newSheetTransform: j({ ...t }, this._selectionRenderService),
|
|
3056
3377
|
newTransform: t
|
|
3057
3378
|
};
|
|
3058
3379
|
let c = null, l = null;
|
|
@@ -3060,16 +3381,16 @@ let rn = class extends ne {
|
|
|
3060
3381
|
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: e, endColumn: n, startRow: o.row, endRow: a.row });
|
|
3061
3382
|
if (g == null)
|
|
3062
3383
|
return;
|
|
3063
|
-
l = { ...t, left: (t.left || 0) + g.endX - g.startX }, c =
|
|
3384
|
+
l = { ...t, left: (t.left || 0) + g.endX - g.startX }, c = j(l, this._selectionRenderService);
|
|
3064
3385
|
} else if (u >= n)
|
|
3065
3386
|
if (r === O.Both)
|
|
3066
3387
|
c = {
|
|
3067
3388
|
from: { ...o },
|
|
3068
3389
|
to: { ...a, column: u + s }
|
|
3069
|
-
}, l =
|
|
3390
|
+
}, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3070
3391
|
else
|
|
3071
3392
|
return {
|
|
3072
|
-
newSheetTransform:
|
|
3393
|
+
newSheetTransform: j({ ...t }, this._selectionRenderService),
|
|
3073
3394
|
newTransform: t
|
|
3074
3395
|
};
|
|
3075
3396
|
return c != null && l != null ? {
|
|
@@ -3081,7 +3402,7 @@ let rn = class extends ne {
|
|
|
3081
3402
|
const s = n - e + 1, { from: o, to: a } = i, { column: d } = o, { column: u } = a;
|
|
3082
3403
|
if (r === O.None)
|
|
3083
3404
|
return {
|
|
3084
|
-
newSheetTransform:
|
|
3405
|
+
newSheetTransform: j({ ...t }, this._selectionRenderService),
|
|
3085
3406
|
newTransform: t
|
|
3086
3407
|
};
|
|
3087
3408
|
let c = null, l = null;
|
|
@@ -3089,7 +3410,7 @@ let rn = class extends ne {
|
|
|
3089
3410
|
c = {
|
|
3090
3411
|
from: { ...o, column: d - s },
|
|
3091
3412
|
to: { ...a, column: u - s }
|
|
3092
|
-
}, l =
|
|
3413
|
+
}, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3093
3414
|
else {
|
|
3094
3415
|
if (d >= e && u <= n)
|
|
3095
3416
|
return null;
|
|
@@ -3098,10 +3419,10 @@ let rn = class extends ne {
|
|
|
3098
3419
|
c = {
|
|
3099
3420
|
from: { ...o },
|
|
3100
3421
|
to: { ...a, column: u - s }
|
|
3101
|
-
}, l =
|
|
3422
|
+
}, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3102
3423
|
else
|
|
3103
3424
|
return {
|
|
3104
|
-
newSheetTransform:
|
|
3425
|
+
newSheetTransform: j({ ...t }, this._selectionRenderService),
|
|
3105
3426
|
newTransform: t
|
|
3106
3427
|
};
|
|
3107
3428
|
else if (d >= e && d <= n) {
|
|
@@ -3113,7 +3434,7 @@ let rn = class extends ne {
|
|
|
3113
3434
|
return;
|
|
3114
3435
|
l = { ...t, left: (t.left || 0) - g.endX + g.startX - i.from.columnOffset };
|
|
3115
3436
|
}
|
|
3116
|
-
c =
|
|
3437
|
+
c = j(l, this._selectionRenderService);
|
|
3117
3438
|
} else if (u >= e && u <= n && r === O.Both) {
|
|
3118
3439
|
const g = this._skeletonManagerService.attachRangeWithCoord({
|
|
3119
3440
|
startColumn: e - 1,
|
|
@@ -3126,7 +3447,7 @@ let rn = class extends ne {
|
|
|
3126
3447
|
c = {
|
|
3127
3448
|
from: { ...o },
|
|
3128
3449
|
to: { ...a, column: e - 1, columnOffset: g.endX - g.startX }
|
|
3129
|
-
}, l =
|
|
3450
|
+
}, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3130
3451
|
}
|
|
3131
3452
|
}
|
|
3132
3453
|
return c != null && l != null ? {
|
|
@@ -3138,7 +3459,7 @@ let rn = class extends ne {
|
|
|
3138
3459
|
const s = n - e + 1, { from: o, to: a } = i, { row: d } = o, { row: u } = a;
|
|
3139
3460
|
if (r === O.None)
|
|
3140
3461
|
return {
|
|
3141
|
-
newSheetTransform:
|
|
3462
|
+
newSheetTransform: j({ ...t }, this._selectionRenderService),
|
|
3142
3463
|
newTransform: t
|
|
3143
3464
|
};
|
|
3144
3465
|
let c = null, l = null;
|
|
@@ -3146,7 +3467,7 @@ let rn = class extends ne {
|
|
|
3146
3467
|
const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: e, endRow: n, startColumn: o.column, endColumn: a.column });
|
|
3147
3468
|
if (g == null)
|
|
3148
3469
|
return;
|
|
3149
|
-
l = { ...t, top: (t.top || 0) + g.endY - g.startY }, c =
|
|
3470
|
+
l = { ...t, top: (t.top || 0) + g.endY - g.startY }, c = j(l, this._selectionRenderService);
|
|
3150
3471
|
} else if (u >= n)
|
|
3151
3472
|
if (r === O.Both)
|
|
3152
3473
|
c = {
|
|
@@ -3155,10 +3476,10 @@ let rn = class extends ne {
|
|
|
3155
3476
|
...a,
|
|
3156
3477
|
row: u + s
|
|
3157
3478
|
}
|
|
3158
|
-
}, l =
|
|
3479
|
+
}, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3159
3480
|
else
|
|
3160
3481
|
return {
|
|
3161
|
-
newSheetTransform:
|
|
3482
|
+
newSheetTransform: j({ ...t }, this._selectionRenderService),
|
|
3162
3483
|
newTransform: t
|
|
3163
3484
|
};
|
|
3164
3485
|
return c != null && l != null ? {
|
|
@@ -3170,7 +3491,7 @@ let rn = class extends ne {
|
|
|
3170
3491
|
const s = n - e + 1, { from: o, to: a } = i, { row: d } = o, { row: u } = a;
|
|
3171
3492
|
if (r === O.None)
|
|
3172
3493
|
return {
|
|
3173
|
-
newSheetTransform:
|
|
3494
|
+
newSheetTransform: j({ ...t }, this._selectionRenderService),
|
|
3174
3495
|
newTransform: t
|
|
3175
3496
|
};
|
|
3176
3497
|
let c = null, l = null;
|
|
@@ -3178,7 +3499,7 @@ let rn = class extends ne {
|
|
|
3178
3499
|
c = {
|
|
3179
3500
|
from: { ...o, row: d - s },
|
|
3180
3501
|
to: { ...a, row: u - s }
|
|
3181
|
-
}, l =
|
|
3502
|
+
}, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3182
3503
|
else {
|
|
3183
3504
|
if (d >= e && u <= n)
|
|
3184
3505
|
return null;
|
|
@@ -3187,10 +3508,10 @@ let rn = class extends ne {
|
|
|
3187
3508
|
c = {
|
|
3188
3509
|
from: { ...o },
|
|
3189
3510
|
to: { ...a, row: u - s }
|
|
3190
|
-
}, l =
|
|
3511
|
+
}, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3191
3512
|
else
|
|
3192
3513
|
return {
|
|
3193
|
-
newSheetTransform:
|
|
3514
|
+
newSheetTransform: j({ ...t }, this._selectionRenderService),
|
|
3194
3515
|
newTransform: t
|
|
3195
3516
|
};
|
|
3196
3517
|
else if (d >= e && d <= n) {
|
|
@@ -3202,7 +3523,7 @@ let rn = class extends ne {
|
|
|
3202
3523
|
return;
|
|
3203
3524
|
l = { ...t, top: (t.top || 0) - g.endY + g.startY - i.from.rowOffset };
|
|
3204
3525
|
}
|
|
3205
|
-
c =
|
|
3526
|
+
c = j(l, this._selectionRenderService);
|
|
3206
3527
|
} else if (u >= e && u <= n && r === O.Both) {
|
|
3207
3528
|
const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: e - 1, endRow: e - 1 });
|
|
3208
3529
|
if (g == null)
|
|
@@ -3210,7 +3531,7 @@ let rn = class extends ne {
|
|
|
3210
3531
|
c = {
|
|
3211
3532
|
from: { ...o },
|
|
3212
3533
|
to: { ...a, row: e - 1, rowOffset: g.endY - g.startY }
|
|
3213
|
-
}, l =
|
|
3534
|
+
}, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
|
|
3214
3535
|
}
|
|
3215
3536
|
}
|
|
3216
3537
|
return c != null && l != null ? {
|
|
@@ -3224,7 +3545,7 @@ let rn = class extends ne {
|
|
|
3224
3545
|
// but the skeleton changes like other render modules. These two signals are not equivalent.
|
|
3225
3546
|
// As a temp solution, I subscribed to activate$ here.
|
|
3226
3547
|
this._commandService.onCommandExecuted((i) => {
|
|
3227
|
-
if (i.id ===
|
|
3548
|
+
if (i.id === Ki.id) {
|
|
3228
3549
|
const { unitId: t, subUnitId: e } = i.params;
|
|
3229
3550
|
this._updateDrawings(t, e);
|
|
3230
3551
|
}
|
|
@@ -3264,7 +3585,7 @@ let rn = class extends ne {
|
|
|
3264
3585
|
d != null && Object.keys(d).forEach((u) => {
|
|
3265
3586
|
if (s === i && a === t) {
|
|
3266
3587
|
const c = d[u];
|
|
3267
|
-
c.transform =
|
|
3588
|
+
c.transform = Z(c.sheetTransform, this._selectionRenderService, this._skeletonManagerService), n.push(d[u]);
|
|
3268
3589
|
} else
|
|
3269
3590
|
r.push(d[u]);
|
|
3270
3591
|
});
|
|
@@ -3275,7 +3596,7 @@ let rn = class extends ne {
|
|
|
3275
3596
|
_sheetRefreshListener() {
|
|
3276
3597
|
this.disposeWithMe(
|
|
3277
3598
|
this._commandService.onCommandExecuted((i) => {
|
|
3278
|
-
|
|
3599
|
+
mo.includes(i.id) && requestIdleCallback(() => {
|
|
3279
3600
|
const t = i.params, { unitId: e, subUnitId: n, ranges: r } = t;
|
|
3280
3601
|
this._refreshDrawingTransform(e, n, r);
|
|
3281
3602
|
});
|
|
@@ -3288,279 +3609,504 @@ let rn = class extends ne {
|
|
|
3288
3609
|
const o = n[s], { sheetTransform: a, transform: d, anchorType: u = O.Position } = o;
|
|
3289
3610
|
if (u === O.None)
|
|
3290
3611
|
return !0;
|
|
3291
|
-
const { from: c, to: l } = a, { row: g, column: h } = c, { row: f, column:
|
|
3292
|
-
for (let
|
|
3293
|
-
const
|
|
3294
|
-
if (
|
|
3612
|
+
const { from: c, to: l } = a, { row: g, column: h } = c, { row: f, column: m } = l;
|
|
3613
|
+
for (let p = 0; p < e.length; p++) {
|
|
3614
|
+
const w = e[p], { startRow: S, endRow: I, startColumn: D, endColumn: v } = w;
|
|
3615
|
+
if (yi.intersects(
|
|
3295
3616
|
{
|
|
3296
|
-
startRow:
|
|
3617
|
+
startRow: S,
|
|
3297
3618
|
endRow: I,
|
|
3298
|
-
startColumn:
|
|
3299
|
-
endColumn:
|
|
3619
|
+
startColumn: D,
|
|
3620
|
+
endColumn: v
|
|
3300
3621
|
},
|
|
3301
3622
|
{
|
|
3302
3623
|
startRow: g,
|
|
3303
3624
|
endRow: f,
|
|
3304
3625
|
startColumn: h,
|
|
3305
|
-
endColumn:
|
|
3626
|
+
endColumn: m
|
|
3306
3627
|
}
|
|
3307
|
-
) || g > I || h >
|
|
3308
|
-
const C = u === O.Position,
|
|
3628
|
+
) || g > I || h > v) {
|
|
3629
|
+
const C = u === O.Position, _ = Z(a, this._selectionRenderService, this._skeletonManagerService);
|
|
3309
3630
|
r.push({
|
|
3310
3631
|
...o,
|
|
3311
3632
|
transform: {
|
|
3312
|
-
...
|
|
3313
|
-
width: C ? d == null ? void 0 : d.width :
|
|
3314
|
-
height: C ? d == null ? void 0 : d.height :
|
|
3633
|
+
..._,
|
|
3634
|
+
width: C ? d == null ? void 0 : d.width : _ == null ? void 0 : _.width,
|
|
3635
|
+
height: C ? d == null ? void 0 : d.height : _ == null ? void 0 : _.height
|
|
3315
3636
|
}
|
|
3316
3637
|
});
|
|
3317
3638
|
break;
|
|
3318
3639
|
}
|
|
3319
3640
|
}
|
|
3320
|
-
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(
|
|
3641
|
+
}), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(V.id, [i]));
|
|
3321
3642
|
}
|
|
3322
3643
|
};
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
],
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3644
|
+
Rn = go([
|
|
3645
|
+
_e(1, Q),
|
|
3646
|
+
_e(2, Y),
|
|
3647
|
+
_e(3, Ze),
|
|
3648
|
+
_e(4, A(X)),
|
|
3649
|
+
_e(5, A(Vt)),
|
|
3650
|
+
_e(6, se),
|
|
3651
|
+
_e(7, oe),
|
|
3652
|
+
_e(8, de)
|
|
3653
|
+
], Rn);
|
|
3654
|
+
function Yr({ ref: i, ...t }) {
|
|
3655
|
+
const { icon: e, id: n, className: r, extend: s, ...o } = t, a = `univerjs-icon univerjs-icon-${n} ${r || ""}`.trim(), d = Es(`_${_o()}`);
|
|
3656
|
+
return Gr(e, `${n}`, {
|
|
3657
|
+
defIds: e.defIds,
|
|
3658
|
+
idSuffix: d.current
|
|
3659
|
+
}, {
|
|
3660
|
+
ref: i,
|
|
3661
|
+
className: a,
|
|
3662
|
+
...o
|
|
3663
|
+
}, s);
|
|
3664
|
+
}
|
|
3665
|
+
function Gr(i, t, e, n, r) {
|
|
3666
|
+
return Ar(i.tag, {
|
|
3667
|
+
key: t,
|
|
3668
|
+
...po(i, e, r),
|
|
3669
|
+
...n
|
|
3670
|
+
}, (wo(i, e).children || []).map((s, o) => Gr(s, `${t}-${i.tag}-${o}`, e, void 0, r)));
|
|
3671
|
+
}
|
|
3672
|
+
function po(i, t, e) {
|
|
3673
|
+
const n = { ...i.attrs };
|
|
3674
|
+
e != null && e.colorChannel1 && n.fill === "colorChannel1" && (n.fill = e.colorChannel1), i.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(([s, o]) => {
|
|
3675
|
+
s === "mask" && typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
3676
|
+
});
|
|
3677
|
+
const { defIds: r } = t;
|
|
3678
|
+
return !r || r.length === 0 || (i.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(([s, o]) => {
|
|
3679
|
+
typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
3680
|
+
})), n;
|
|
3681
|
+
}
|
|
3682
|
+
function wo(i, t) {
|
|
3683
|
+
var n;
|
|
3684
|
+
const { defIds: e } = t;
|
|
3685
|
+
return !e || e.length === 0 ? i : i.tag === "defs" && ((n = i.children) != null && n.length) ? {
|
|
3686
|
+
...i,
|
|
3687
|
+
children: i.children.map((r) => typeof r.attrs.id == "string" && e && e.includes(r.attrs.id) ? {
|
|
3688
|
+
...r,
|
|
3689
|
+
attrs: {
|
|
3690
|
+
...r.attrs,
|
|
3691
|
+
id: r.attrs.id + t.idSuffix
|
|
3692
|
+
}
|
|
3693
|
+
} : r)
|
|
3694
|
+
} : i;
|
|
3695
|
+
}
|
|
3696
|
+
function _o() {
|
|
3697
|
+
return Math.random().toString(36).substring(2, 8);
|
|
3698
|
+
}
|
|
3699
|
+
Yr.displayName = "UniverIcon";
|
|
3700
|
+
const So = {
|
|
3701
|
+
tag: "svg",
|
|
3702
|
+
attrs: {
|
|
3703
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3704
|
+
fill: "none",
|
|
3705
|
+
viewBox: "0 0 17 16",
|
|
3706
|
+
width: "1em",
|
|
3707
|
+
height: "1em"
|
|
3708
|
+
},
|
|
3709
|
+
children: [{
|
|
3710
|
+
tag: "path",
|
|
3711
|
+
attrs: {
|
|
3712
|
+
fill: "currentColor",
|
|
3713
|
+
d: "M2.35381 3.65517C2.35381 2.88198 2.98061 2.25518 3.75381 2.25518H8.10381C8.43518 2.25518 8.70381 1.98655 8.70381 1.65518C8.70381 1.3238 8.43518 1.05518 8.10381 1.05518H3.75381C2.31787 1.05518 1.15381 2.21923 1.15381 3.65517V12.3552C1.15381 13.7911 2.31787 14.9552 3.75381 14.9552H12.4538C13.8897 14.9552 15.0538 13.7911 15.0538 12.3552V8.00518C15.0538 7.6738 14.7852 7.40518 14.4538 7.40518C14.1224 7.40518 13.8538 7.6738 13.8538 8.00518V9.24469L12.3428 8.11143C11.8294 7.72642 11.1111 7.77744 10.6573 8.23119L9.11281 9.77567L6.84342 7.83047C6.34812 7.40592 5.61375 7.41815 5.13289 7.85896L2.35381 10.4064V3.65517ZM2.35381 12.0343V12.3552C2.35381 13.1284 2.98061 13.7552 3.75381 13.7552H12.4538C13.227 13.7552 13.8538 13.1284 13.8538 12.3552V10.7447L11.6228 9.07144C11.5871 9.04469 11.5373 9.04827 11.5058 9.07971L10.0266 10.5589L11.2057 11.5696C11.4573 11.7853 11.4865 12.164 11.2708 12.4156C11.0552 12.6672 10.6764 12.6964 10.4248 12.4807L6.06245 8.74157C6.02809 8.71212 5.97713 8.71296 5.94377 8.74353L2.35381 12.0343Z",
|
|
3714
|
+
fillRule: "evenodd",
|
|
3715
|
+
clipRule: "evenodd"
|
|
3716
|
+
}
|
|
3717
|
+
}, {
|
|
3718
|
+
tag: "path",
|
|
3719
|
+
attrs: {
|
|
3720
|
+
fill: "currentColor",
|
|
3721
|
+
d: "M10.3911 3.84419C10.6254 3.60988 11.0053 3.60988 11.2396 3.84419L11.8818 4.48643V1.93496C11.8818 1.60359 12.1505 1.33496 12.4818 1.33496C12.8132 1.33496 13.0818 1.60359 13.0818 1.93496V4.48676L13.7244 3.84419C13.9587 3.60988 14.3386 3.60988 14.5729 3.84419C14.8072 4.07851 14.8072 4.45841 14.5729 4.69272L12.9063 6.35939C12.6719 6.5937 12.292 6.5937 12.0577 6.35939L10.3911 4.69272C10.1568 4.45841 10.1568 4.07851 10.3911 3.84419Z"
|
|
3722
|
+
}
|
|
3723
|
+
}]
|
|
3724
|
+
}, Xr = Ts(function(t, e) {
|
|
3725
|
+
return Ar(Yr, Object.assign({}, t, {
|
|
3726
|
+
id: "download-image-icon",
|
|
3727
|
+
ref: e,
|
|
3728
|
+
icon: So
|
|
3729
|
+
}));
|
|
3730
|
+
});
|
|
3731
|
+
Xr.displayName = "DownloadImageIcon";
|
|
3732
|
+
function vo() {
|
|
3733
|
+
const i = Ie(Te), t = Ie(bn), e = Ie(yn), [n, r] = Ee([ye.CELL_ADDRESS]), [s, o] = Ee(!1), [a, d] = Ee(null), u = Fe(() => e.getCellImagesInSelection(), [e]), c = Fe(() => e.getDataColumns(), [e]), l = Fe(() => e.getSelectionRowRange(), [e]), g = c.length > 0, h = Fe(() => c.map((C) => ({
|
|
3734
|
+
label: C.label,
|
|
3735
|
+
value: String(C.index)
|
|
3736
|
+
})), [c]), [f, m] = Ee(
|
|
3737
|
+
() => h.length > 0 ? h[0].value : "0"
|
|
3738
|
+
), p = Fe(() => {
|
|
3739
|
+
if (!n.includes(ye.COLUMN_VALUE) || !l)
|
|
3740
|
+
return [];
|
|
3741
|
+
const _ = Number(f);
|
|
3742
|
+
return [{
|
|
3743
|
+
startRow: l.startRow,
|
|
3744
|
+
endRow: l.endRow,
|
|
3745
|
+
startColumn: _,
|
|
3746
|
+
endColumn: _
|
|
3747
|
+
}];
|
|
3748
|
+
}, [n, f, l]);
|
|
3749
|
+
fi(p);
|
|
3750
|
+
const w = Et((C) => {
|
|
3751
|
+
C.length !== 0 && r(C);
|
|
3752
|
+
}, []), S = Et((C) => {
|
|
3753
|
+
m(String(C));
|
|
3754
|
+
}, []), I = Et(() => {
|
|
3755
|
+
t.close(ze);
|
|
3756
|
+
}, [t]), D = Et(async () => {
|
|
3757
|
+
if (u.length !== 0) {
|
|
3758
|
+
o(!0), d(null);
|
|
3759
|
+
try {
|
|
3760
|
+
await e.saveImages(u, {
|
|
3761
|
+
fileNameParts: n,
|
|
3762
|
+
columnIndex: n.includes(ye.COLUMN_VALUE) ? Number(f) : void 0
|
|
3763
|
+
}), t.close(ze);
|
|
3764
|
+
} catch (C) {
|
|
3765
|
+
console.error("Failed to save images:", C), d(i.t("sheetImage.save.error"));
|
|
3766
|
+
} finally {
|
|
3767
|
+
o(!1);
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
}, [e, u, n, f, t, i]), v = n.includes(ye.COLUMN_VALUE);
|
|
3771
|
+
return /* @__PURE__ */ Xe("div", { className: "univer-flex univer-flex-col", children: [
|
|
3772
|
+
/* @__PURE__ */ L(en, { label: i.t("sheetImage.save.imageCount"), children: /* @__PURE__ */ L("div", { className: "univer-text-sm univer-text-gray-600", children: u.length }) }),
|
|
3773
|
+
/* @__PURE__ */ L(en, { label: i.t("sheetImage.save.fileNameConfig"), children: /* @__PURE__ */ Xe(Qi, { value: n, onChange: w, direction: "vertical", children: [
|
|
3774
|
+
/* @__PURE__ */ L(Yn, { value: ye.CELL_ADDRESS, disabled: !g, children: i.t("sheetImage.save.useRowCol") }),
|
|
3775
|
+
g && /* @__PURE__ */ L(Yn, { value: ye.COLUMN_VALUE, children: i.t("sheetImage.save.useColumnValue") })
|
|
3776
|
+
] }) }),
|
|
3777
|
+
v && /* @__PURE__ */ L(en, { label: i.t("sheetImage.save.selectColumn"), children: /* @__PURE__ */ L(
|
|
3778
|
+
es,
|
|
3779
|
+
{
|
|
3780
|
+
value: f,
|
|
3781
|
+
options: h,
|
|
3782
|
+
onChange: S
|
|
3783
|
+
}
|
|
3784
|
+
) }),
|
|
3785
|
+
a && /* @__PURE__ */ L("div", { className: "univer-text-xs univer-text-red-500", children: a }),
|
|
3786
|
+
/* @__PURE__ */ Xe(
|
|
3787
|
+
"div",
|
|
3788
|
+
{
|
|
3789
|
+
className: "univer-flex univer-justify-end univer-gap-2 univer-border-t univer-border-gray-200 univer-pt-3",
|
|
3790
|
+
children: [
|
|
3791
|
+
/* @__PURE__ */ L(Gn, { onClick: I, disabled: s, children: i.t("sheetImage.save.cancel") }),
|
|
3792
|
+
/* @__PURE__ */ L(
|
|
3793
|
+
Gn,
|
|
3794
|
+
{
|
|
3795
|
+
variant: "primary",
|
|
3796
|
+
onClick: D,
|
|
3797
|
+
disabled: s || u.length === 0,
|
|
3798
|
+
children: s ? i.t("sheetImage.save.saving") : i.t("sheetImage.save.confirm")
|
|
3799
|
+
}
|
|
3800
|
+
)
|
|
3801
|
+
]
|
|
3802
|
+
}
|
|
3803
|
+
)
|
|
3804
|
+
] });
|
|
3805
|
+
}
|
|
3806
|
+
const Io = (i) => {
|
|
3807
|
+
var S;
|
|
3808
|
+
const t = Ie(Y), e = Ie(Te), n = Ie(oe), r = Ie(Q), { drawings: s } = i, o = s[0];
|
|
3336
3809
|
if (o == null)
|
|
3337
3810
|
return;
|
|
3338
3811
|
const { unitId: a } = o, d = r.getRenderById(a), u = d == null ? void 0 : d.scene;
|
|
3339
3812
|
if (u == null)
|
|
3340
3813
|
return;
|
|
3341
|
-
const c = u.getTransformerByCreate(), [l, g] =
|
|
3342
|
-
function
|
|
3343
|
-
const
|
|
3814
|
+
const c = u.getTransformerByCreate(), [l, g] = Ee(!0), h = (S = o.anchorType) != null ? S : O.Position, [f, m] = Ee(h);
|
|
3815
|
+
function p(I, D) {
|
|
3816
|
+
const v = [];
|
|
3344
3817
|
return I.forEach((C) => {
|
|
3345
|
-
const { oKey:
|
|
3818
|
+
const { oKey: _ } = C, y = D.getDrawingOKey(_);
|
|
3346
3819
|
if (y == null)
|
|
3347
|
-
return
|
|
3348
|
-
const { unitId:
|
|
3349
|
-
|
|
3350
|
-
unitId:
|
|
3351
|
-
subUnitId:
|
|
3352
|
-
drawingId:
|
|
3820
|
+
return v.push(null), !0;
|
|
3821
|
+
const { unitId: R, subUnitId: E, drawingId: T, drawingType: M, anchorType: b, sheetTransform: N } = y;
|
|
3822
|
+
v.push({
|
|
3823
|
+
unitId: R,
|
|
3824
|
+
subUnitId: E,
|
|
3825
|
+
drawingId: T,
|
|
3353
3826
|
anchorType: b,
|
|
3354
3827
|
sheetTransform: N,
|
|
3355
3828
|
drawingType: M
|
|
3356
3829
|
});
|
|
3357
|
-
}),
|
|
3830
|
+
}), v;
|
|
3358
3831
|
}
|
|
3359
|
-
|
|
3360
|
-
const I = c.clearControl$.subscribe((
|
|
3361
|
-
|
|
3362
|
-
}),
|
|
3832
|
+
Nr(() => {
|
|
3833
|
+
const I = c.clearControl$.subscribe((v) => {
|
|
3834
|
+
v === !0 && g(!1);
|
|
3835
|
+
}), D = c.changeStart$.subscribe((v) => {
|
|
3363
3836
|
var y;
|
|
3364
|
-
const { objects: C } =
|
|
3365
|
-
if (
|
|
3837
|
+
const { objects: C } = v, _ = p(C, n);
|
|
3838
|
+
if (_.length === 0)
|
|
3366
3839
|
g(!1);
|
|
3367
|
-
else if (
|
|
3840
|
+
else if (_.length >= 1) {
|
|
3368
3841
|
g(!0);
|
|
3369
|
-
const
|
|
3370
|
-
|
|
3842
|
+
const R = ((y = _[0]) == null ? void 0 : y.anchorType) || O.Position;
|
|
3843
|
+
m(R);
|
|
3371
3844
|
}
|
|
3372
3845
|
});
|
|
3373
3846
|
return () => {
|
|
3374
|
-
|
|
3847
|
+
D.unsubscribe(), I.unsubscribe();
|
|
3375
3848
|
};
|
|
3376
3849
|
}, []);
|
|
3377
|
-
function
|
|
3378
|
-
|
|
3379
|
-
const
|
|
3380
|
-
if (
|
|
3850
|
+
function w(I) {
|
|
3851
|
+
m(I);
|
|
3852
|
+
const D = n.getFocusDrawings();
|
|
3853
|
+
if (D.length === 0)
|
|
3381
3854
|
return;
|
|
3382
|
-
const
|
|
3855
|
+
const v = D.map((C) => ({
|
|
3383
3856
|
unitId: C.unitId,
|
|
3384
3857
|
subUnitId: C.subUnitId,
|
|
3385
3858
|
drawingId: C.drawingId,
|
|
3386
3859
|
anchorType: I
|
|
3387
3860
|
}));
|
|
3388
|
-
t.executeCommand(
|
|
3389
|
-
unitId:
|
|
3390
|
-
drawings:
|
|
3861
|
+
t.executeCommand(zt.id, {
|
|
3862
|
+
unitId: D[0].unitId,
|
|
3863
|
+
drawings: v
|
|
3391
3864
|
});
|
|
3392
3865
|
}
|
|
3393
|
-
return /* @__PURE__ */
|
|
3866
|
+
return /* @__PURE__ */ Xe(
|
|
3394
3867
|
"div",
|
|
3395
3868
|
{
|
|
3396
|
-
className:
|
|
3869
|
+
className: ts("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
|
|
3397
3870
|
"univer-hidden": !l
|
|
3398
3871
|
}),
|
|
3399
3872
|
children: [
|
|
3400
|
-
/* @__PURE__ */
|
|
3873
|
+
/* @__PURE__ */ L(
|
|
3401
3874
|
"header",
|
|
3402
3875
|
{
|
|
3403
3876
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
3404
|
-
children: /* @__PURE__ */
|
|
3877
|
+
children: /* @__PURE__ */ L("div", { children: e.t("drawing-anchor.title") })
|
|
3405
3878
|
}
|
|
3406
3879
|
),
|
|
3407
|
-
/* @__PURE__ */
|
|
3408
|
-
/* @__PURE__ */
|
|
3409
|
-
/* @__PURE__ */
|
|
3410
|
-
/* @__PURE__ */
|
|
3880
|
+
/* @__PURE__ */ L("div", { children: /* @__PURE__ */ Xe(ns, { value: f, onChange: w, direction: "vertical", children: [
|
|
3881
|
+
/* @__PURE__ */ L(tn, { value: O.Both, children: e.t("drawing-anchor.both") }),
|
|
3882
|
+
/* @__PURE__ */ L(tn, { value: O.Position, children: e.t("drawing-anchor.position") }),
|
|
3883
|
+
/* @__PURE__ */ L(tn, { value: O.None, children: e.t("drawing-anchor.none") })
|
|
3411
3884
|
] }) })
|
|
3412
3885
|
]
|
|
3413
3886
|
}
|
|
3414
3887
|
);
|
|
3415
|
-
},
|
|
3416
|
-
const i =
|
|
3417
|
-
return
|
|
3888
|
+
}, Co = () => {
|
|
3889
|
+
const i = Ie(oe), t = i.getFocusDrawings(), [e, n] = Ee(t);
|
|
3890
|
+
return Nr(() => {
|
|
3418
3891
|
const r = i.focus$.subscribe((s) => {
|
|
3419
3892
|
n(s);
|
|
3420
3893
|
});
|
|
3421
3894
|
return () => {
|
|
3422
3895
|
r.unsubscribe();
|
|
3423
3896
|
};
|
|
3424
|
-
}, []), !!(e != null && e.length) && /* @__PURE__ */
|
|
3425
|
-
/* @__PURE__ */
|
|
3426
|
-
/* @__PURE__ */
|
|
3897
|
+
}, []), !!(e != null && e.length) && /* @__PURE__ */ Xe("div", { className: "univer-text-sm", children: [
|
|
3898
|
+
/* @__PURE__ */ L(Rs, { drawings: e }),
|
|
3899
|
+
/* @__PURE__ */ L(Io, { drawings: e })
|
|
3427
3900
|
] });
|
|
3428
|
-
},
|
|
3429
|
-
function
|
|
3901
|
+
}, zr = "sheet.menu.image";
|
|
3902
|
+
function Ro(i) {
|
|
3430
3903
|
return {
|
|
3431
|
-
id:
|
|
3432
|
-
type:
|
|
3904
|
+
id: zr,
|
|
3905
|
+
type: Gt.SUBITEMS,
|
|
3433
3906
|
icon: "AddImageIcon",
|
|
3434
3907
|
tooltip: "sheetImage.title",
|
|
3435
|
-
hidden$:
|
|
3436
|
-
disabled$:
|
|
3908
|
+
hidden$: Yt(i, $.UNIVER_SHEET),
|
|
3909
|
+
disabled$: mi(i, { workbookTypes: [gn], worksheetTypes: [fn], rangeTypes: [Zi] })
|
|
3437
3910
|
};
|
|
3438
3911
|
}
|
|
3439
|
-
function
|
|
3912
|
+
function Do(i) {
|
|
3440
3913
|
return {
|
|
3441
|
-
id:
|
|
3914
|
+
id: Kt.id,
|
|
3442
3915
|
title: "sheetImage.upload.float",
|
|
3443
|
-
type:
|
|
3444
|
-
hidden$:
|
|
3916
|
+
type: Gt.BUTTON,
|
|
3917
|
+
hidden$: Yt(i, $.UNIVER_SHEET)
|
|
3445
3918
|
};
|
|
3446
3919
|
}
|
|
3447
|
-
function
|
|
3920
|
+
function bo(i) {
|
|
3448
3921
|
return {
|
|
3449
|
-
id:
|
|
3922
|
+
id: Mn.id,
|
|
3450
3923
|
title: "sheetImage.upload.cell",
|
|
3451
|
-
type:
|
|
3452
|
-
hidden$:
|
|
3924
|
+
type: Gt.BUTTON,
|
|
3925
|
+
hidden$: Yt(i, $.UNIVER_SHEET)
|
|
3926
|
+
};
|
|
3927
|
+
}
|
|
3928
|
+
function Mo(i) {
|
|
3929
|
+
var t, e, n, r;
|
|
3930
|
+
return !!((e = (t = i == null ? void 0 : i.p) == null ? void 0 : t.drawingsOrder) != null && e.length && ((r = (n = i == null ? void 0 : i.p) == null ? void 0 : n.drawingsOrder) == null ? void 0 : r.length) > 0);
|
|
3931
|
+
}
|
|
3932
|
+
function yo(i, t) {
|
|
3933
|
+
const e = i.getActiveSheet();
|
|
3934
|
+
if (!e) return !1;
|
|
3935
|
+
const n = e.getCellMatrix(), { startRow: r, endRow: s, startColumn: o, endColumn: a } = t;
|
|
3936
|
+
for (let d = r; d <= s; d++)
|
|
3937
|
+
for (let u = o; u <= a; u++) {
|
|
3938
|
+
const c = n.getValue(d, u);
|
|
3939
|
+
if (Mo(c))
|
|
3940
|
+
return !0;
|
|
3941
|
+
}
|
|
3942
|
+
return !1;
|
|
3943
|
+
}
|
|
3944
|
+
function Eo() {
|
|
3945
|
+
return "showDirectoryPicker" in window;
|
|
3946
|
+
}
|
|
3947
|
+
function dn(i) {
|
|
3948
|
+
const t = i.get(de), e = i.get(ut), n = at([
|
|
3949
|
+
Yt(i, $.UNIVER_SHEET),
|
|
3950
|
+
t.getCurrentTypeOfUnit$($.UNIVER_SHEET).pipe(
|
|
3951
|
+
me((r) => r ? e.selectionMoveEnd$.pipe(
|
|
3952
|
+
pe(() => {
|
|
3953
|
+
if (!Eo())
|
|
3954
|
+
return !0;
|
|
3955
|
+
const s = e.getCurrentSelections();
|
|
3956
|
+
if (!s || s.length === 0)
|
|
3957
|
+
return !0;
|
|
3958
|
+
for (const o of s)
|
|
3959
|
+
if (yo(r, o.range))
|
|
3960
|
+
return !1;
|
|
3961
|
+
return !0;
|
|
3962
|
+
})
|
|
3963
|
+
) : wn(!0))
|
|
3964
|
+
)
|
|
3965
|
+
]).pipe(
|
|
3966
|
+
pe(([r, s]) => r || s)
|
|
3967
|
+
);
|
|
3968
|
+
return {
|
|
3969
|
+
id: ct.id,
|
|
3970
|
+
type: Gt.BUTTON,
|
|
3971
|
+
icon: "DownloadImageIcon",
|
|
3972
|
+
title: "sheetImage.save.menuLabel",
|
|
3973
|
+
hidden$: n
|
|
3453
3974
|
};
|
|
3454
3975
|
}
|
|
3455
|
-
const
|
|
3456
|
-
[
|
|
3457
|
-
[
|
|
3976
|
+
const To = {
|
|
3977
|
+
[fs.MEDIA]: {
|
|
3978
|
+
[zr]: {
|
|
3458
3979
|
order: 0,
|
|
3459
|
-
menuItemFactory:
|
|
3460
|
-
[
|
|
3980
|
+
menuItemFactory: Ro,
|
|
3981
|
+
[Kt.id]: {
|
|
3461
3982
|
order: 0,
|
|
3462
|
-
menuItemFactory:
|
|
3983
|
+
menuItemFactory: Do
|
|
3463
3984
|
},
|
|
3464
|
-
[
|
|
3985
|
+
[Mn.id]: {
|
|
3465
3986
|
order: 1,
|
|
3466
|
-
menuItemFactory:
|
|
3987
|
+
menuItemFactory: bo
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3990
|
+
},
|
|
3991
|
+
[rn.MAIN_AREA]: {
|
|
3992
|
+
[sn.OTHERS]: {
|
|
3993
|
+
[ct.id]: {
|
|
3994
|
+
order: 10,
|
|
3995
|
+
menuItemFactory: dn
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
},
|
|
3999
|
+
[rn.COL_HEADER]: {
|
|
4000
|
+
[sn.OTHERS]: {
|
|
4001
|
+
[ct.id]: {
|
|
4002
|
+
order: 10,
|
|
4003
|
+
menuItemFactory: dn
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
},
|
|
4007
|
+
[rn.ROW_HEADER]: {
|
|
4008
|
+
[sn.OTHERS]: {
|
|
4009
|
+
[ct.id]: {
|
|
4010
|
+
order: 10,
|
|
4011
|
+
menuItemFactory: dn
|
|
3467
4012
|
}
|
|
3468
4013
|
}
|
|
3469
4014
|
}
|
|
3470
4015
|
};
|
|
3471
|
-
function
|
|
3472
|
-
return !i.getContextValue(
|
|
4016
|
+
function ft(i) {
|
|
4017
|
+
return !i.getContextValue(Ei) && !i.getContextValue(Ti) && !i.getContextValue(Oi) && i.getContextValue(Ge);
|
|
3473
4018
|
}
|
|
3474
|
-
const
|
|
3475
|
-
id:
|
|
4019
|
+
const Oo = {
|
|
4020
|
+
id: gt.id,
|
|
3476
4021
|
description: "shortcut.drawing-move-down",
|
|
3477
4022
|
group: "4_drawing-view",
|
|
3478
|
-
binding:
|
|
4023
|
+
binding: Ke.ARROW_DOWN,
|
|
3479
4024
|
priority: 100,
|
|
3480
|
-
preconditions:
|
|
4025
|
+
preconditions: ft,
|
|
3481
4026
|
staticParameters: {
|
|
3482
|
-
direction:
|
|
4027
|
+
direction: ve.DOWN
|
|
3483
4028
|
}
|
|
3484
|
-
},
|
|
3485
|
-
id:
|
|
4029
|
+
}, Uo = {
|
|
4030
|
+
id: gt.id,
|
|
3486
4031
|
description: "shortcut.drawing-move-up",
|
|
3487
4032
|
group: "4_drawing-view",
|
|
3488
|
-
binding:
|
|
4033
|
+
binding: Ke.ARROW_UP,
|
|
3489
4034
|
priority: 100,
|
|
3490
|
-
preconditions:
|
|
4035
|
+
preconditions: ft,
|
|
3491
4036
|
staticParameters: {
|
|
3492
|
-
direction:
|
|
4037
|
+
direction: ve.UP
|
|
3493
4038
|
}
|
|
3494
|
-
},
|
|
3495
|
-
id:
|
|
4039
|
+
}, Po = {
|
|
4040
|
+
id: gt.id,
|
|
3496
4041
|
description: "shortcut.drawing-move-left",
|
|
3497
4042
|
group: "4_drawing-view",
|
|
3498
|
-
binding:
|
|
4043
|
+
binding: Ke.ARROW_LEFT,
|
|
3499
4044
|
priority: 100,
|
|
3500
|
-
preconditions:
|
|
4045
|
+
preconditions: ft,
|
|
3501
4046
|
staticParameters: {
|
|
3502
|
-
direction:
|
|
4047
|
+
direction: ve.LEFT
|
|
3503
4048
|
}
|
|
3504
|
-
},
|
|
3505
|
-
id:
|
|
4049
|
+
}, Ao = {
|
|
4050
|
+
id: gt.id,
|
|
3506
4051
|
description: "shortcut.drawing-move-right",
|
|
3507
4052
|
group: "4_drawing-view",
|
|
3508
|
-
binding:
|
|
4053
|
+
binding: Ke.ARROW_RIGHT,
|
|
3509
4054
|
priority: 100,
|
|
3510
|
-
preconditions:
|
|
4055
|
+
preconditions: ft,
|
|
3511
4056
|
staticParameters: {
|
|
3512
|
-
direction:
|
|
4057
|
+
direction: ve.RIGHT
|
|
3513
4058
|
}
|
|
3514
|
-
},
|
|
3515
|
-
id:
|
|
4059
|
+
}, No = {
|
|
4060
|
+
id: $r.id,
|
|
3516
4061
|
description: "shortcut.drawing-delete",
|
|
3517
4062
|
group: "4_drawing-view",
|
|
3518
4063
|
// when focusing on any other input tag do not trigger this shortcut
|
|
3519
|
-
preconditions:
|
|
3520
|
-
binding:
|
|
3521
|
-
mac:
|
|
4064
|
+
preconditions: ft,
|
|
4065
|
+
binding: Ke.DELETE,
|
|
4066
|
+
mac: Ke.BACKSPACE
|
|
3522
4067
|
};
|
|
3523
|
-
var
|
|
3524
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
4068
|
+
var $o = Object.getOwnPropertyDescriptor, ko = (i, t, e, n) => {
|
|
4069
|
+
for (var r = n > 1 ? void 0 : n ? $o(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
3525
4070
|
(o = i[s]) && (r = o(r) || r);
|
|
3526
4071
|
return r;
|
|
3527
|
-
},
|
|
3528
|
-
let
|
|
4072
|
+
}, Be = (i, t) => (e, n) => t(e, n, i);
|
|
4073
|
+
let Ft = class extends ee {
|
|
3529
4074
|
constructor(i, t, e, n, r, s) {
|
|
3530
4075
|
super(), this._componentManager = i, this._menuManagerService = t, this._commandService = e, this._shortcutService = n, this._drawingManagerService = r, this._sheetsSelectionsService = s, this._init();
|
|
3531
4076
|
}
|
|
3532
4077
|
_initCustomComponents() {
|
|
3533
4078
|
const i = this._componentManager;
|
|
3534
|
-
this.disposeWithMe(i.register(
|
|
4079
|
+
this.disposeWithMe(i.register(Br, Co)), this.disposeWithMe(i.register(ze, vo)), this.disposeWithMe(i.register("DownloadImageIcon", Xr));
|
|
3535
4080
|
}
|
|
3536
4081
|
_initMenus() {
|
|
3537
|
-
this._menuManagerService.mergeMenu(
|
|
4082
|
+
this._menuManagerService.mergeMenu(To);
|
|
3538
4083
|
}
|
|
3539
4084
|
_initCommands() {
|
|
3540
4085
|
[
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
4086
|
+
Kt,
|
|
4087
|
+
Mn,
|
|
4088
|
+
Xt,
|
|
4089
|
+
ht,
|
|
4090
|
+
zt,
|
|
4091
|
+
jr,
|
|
4092
|
+
V,
|
|
4093
|
+
Fr,
|
|
4094
|
+
kr,
|
|
4095
|
+
Wr,
|
|
4096
|
+
gt,
|
|
4097
|
+
$r,
|
|
4098
|
+
xr,
|
|
4099
|
+
ct
|
|
3554
4100
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
3555
4101
|
}
|
|
3556
4102
|
_initShortcuts() {
|
|
3557
4103
|
[
|
|
3558
4104
|
// sheet drawing shortcuts
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
4105
|
+
Oo,
|
|
4106
|
+
Uo,
|
|
4107
|
+
Po,
|
|
4108
|
+
Ao,
|
|
4109
|
+
No
|
|
3564
4110
|
].forEach((i) => {
|
|
3565
4111
|
this.disposeWithMe(this._shortcutService.registerShortcut(i));
|
|
3566
4112
|
});
|
|
@@ -3569,100 +4115,106 @@ let Ut = class extends ne {
|
|
|
3569
4115
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
3570
4116
|
}
|
|
3571
4117
|
};
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
],
|
|
3580
|
-
var
|
|
3581
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
4118
|
+
Ft = ko([
|
|
4119
|
+
Be(0, A(Ur)),
|
|
4120
|
+
Be(1, ms),
|
|
4121
|
+
Be(2, Y),
|
|
4122
|
+
Be(3, ps),
|
|
4123
|
+
Be(4, oe),
|
|
4124
|
+
Be(5, A(ut))
|
|
4125
|
+
], Ft);
|
|
4126
|
+
var xo = Object.defineProperty, Wo = Object.getOwnPropertyDescriptor, Bo = (i, t, e) => t in i ? xo(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, jo = (i, t, e, n) => {
|
|
4127
|
+
for (var r = n > 1 ? void 0 : n ? Wo(t, e) : t, s = i.length - 1, o; s >= 0; s--)
|
|
3582
4128
|
(o = i[s]) && (r = o(r) || r);
|
|
3583
4129
|
return r;
|
|
3584
|
-
},
|
|
3585
|
-
const
|
|
3586
|
-
let
|
|
3587
|
-
constructor(i =
|
|
4130
|
+
}, ln = (i, t) => (e, n) => t(e, n, i), Kr = (i, t, e) => Bo(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4131
|
+
const Fo = "SHEET_IMAGE_UI_PLUGIN";
|
|
4132
|
+
let Lt = class extends Ai {
|
|
4133
|
+
constructor(i = sr, t, e, n) {
|
|
3588
4134
|
super(), this._config = i, this._injector = t, this._renderManagerService = e, this._configService = n;
|
|
3589
|
-
const { menu: r, ...s } =
|
|
4135
|
+
const { menu: r, ...s } = Ni(
|
|
3590
4136
|
{},
|
|
3591
|
-
|
|
4137
|
+
sr,
|
|
3592
4138
|
this._config
|
|
3593
4139
|
);
|
|
3594
|
-
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(
|
|
4140
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Ws, s);
|
|
3595
4141
|
}
|
|
3596
4142
|
onStarting() {
|
|
3597
|
-
|
|
3598
|
-
[
|
|
3599
|
-
[
|
|
3600
|
-
[
|
|
3601
|
-
[
|
|
3602
|
-
[
|
|
3603
|
-
[
|
|
3604
|
-
[
|
|
3605
|
-
[
|
|
3606
|
-
[
|
|
3607
|
-
|
|
3608
|
-
|
|
4143
|
+
$i(this._injector, [
|
|
4144
|
+
[lt],
|
|
4145
|
+
[Ft],
|
|
4146
|
+
[Nt],
|
|
4147
|
+
[jt],
|
|
4148
|
+
[Bt],
|
|
4149
|
+
[Wt],
|
|
4150
|
+
[$t],
|
|
4151
|
+
[kt],
|
|
4152
|
+
[xt],
|
|
4153
|
+
[yn, { useClass: vn }]
|
|
4154
|
+
]), Qt(this._injector, [
|
|
4155
|
+
[lt]
|
|
3609
4156
|
]);
|
|
3610
4157
|
}
|
|
3611
4158
|
onReady() {
|
|
3612
|
-
|
|
3613
|
-
[
|
|
3614
|
-
[
|
|
4159
|
+
Qt(this._injector, [
|
|
4160
|
+
[Wt],
|
|
4161
|
+
[xt]
|
|
3615
4162
|
]);
|
|
3616
4163
|
}
|
|
3617
4164
|
onRendered() {
|
|
3618
|
-
this._registerRenderModules(),
|
|
3619
|
-
[
|
|
3620
|
-
[
|
|
3621
|
-
[
|
|
3622
|
-
[
|
|
3623
|
-
[
|
|
4165
|
+
this._registerRenderModules(), Qt(this._injector, [
|
|
4166
|
+
[Bt],
|
|
4167
|
+
[jt],
|
|
4168
|
+
[Ft],
|
|
4169
|
+
[$t],
|
|
4170
|
+
[kt]
|
|
3624
4171
|
]);
|
|
3625
4172
|
}
|
|
3626
4173
|
onSteady() {
|
|
3627
|
-
this._injector.get(
|
|
4174
|
+
this._injector.get(Nt);
|
|
3628
4175
|
}
|
|
3629
4176
|
_registerRenderModules() {
|
|
3630
4177
|
[
|
|
3631
|
-
[
|
|
3632
|
-
[
|
|
3633
|
-
[
|
|
3634
|
-
[
|
|
4178
|
+
[dt],
|
|
4179
|
+
[Rn],
|
|
4180
|
+
[Cn],
|
|
4181
|
+
[In]
|
|
3635
4182
|
].forEach((i) => {
|
|
3636
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
4183
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule($.UNIVER_SHEET, i));
|
|
3637
4184
|
});
|
|
3638
4185
|
}
|
|
3639
4186
|
};
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
],
|
|
4187
|
+
Kr(Lt, "type", $.UNIVER_SHEET);
|
|
4188
|
+
Kr(Lt, "pluginName", Fo);
|
|
4189
|
+
Lt = jo([
|
|
4190
|
+
Ui(as, _s, Ds, ki),
|
|
4191
|
+
ln(1, A(qe)),
|
|
4192
|
+
ln(2, Q),
|
|
4193
|
+
ln(3, Pi)
|
|
4194
|
+
], Lt);
|
|
3648
4195
|
export {
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
4196
|
+
vn as BatchSaveImagesService,
|
|
4197
|
+
V as ClearSheetDrawingTransformerOperation,
|
|
4198
|
+
$r as DeleteDrawingsCommand,
|
|
4199
|
+
Fr as EditSheetDrawingOperation,
|
|
4200
|
+
ye as FileNamePart,
|
|
4201
|
+
kr as GroupSheetDrawingCommand,
|
|
4202
|
+
yn as IBatchSaveImagesService,
|
|
4203
|
+
Kt as InsertFloatImageCommand,
|
|
4204
|
+
Xt as InsertSheetDrawingCommand,
|
|
4205
|
+
gt as MoveDrawingsCommand,
|
|
4206
|
+
ht as RemoveSheetDrawingCommand,
|
|
4207
|
+
zr as SHEETS_IMAGE_MENU_ID,
|
|
4208
|
+
ao as SHEET_FLOAT_DOM_PREFIX,
|
|
4209
|
+
ct as SaveCellImagesCommand,
|
|
4210
|
+
xr as SetDrawingArrangeCommand,
|
|
4211
|
+
zt as SetSheetDrawingCommand,
|
|
4212
|
+
lt as SheetCanvasFloatDomManagerService,
|
|
4213
|
+
dt as SheetDrawingUpdateController,
|
|
4214
|
+
jr as SidebarSheetDrawingOperation,
|
|
4215
|
+
Wr as UngroupSheetDrawingCommand,
|
|
4216
|
+
Lt as UniverSheetsDrawingUIPlugin,
|
|
4217
|
+
fe as calcSheetFloatDomPosition,
|
|
4218
|
+
Z as drawingPositionToTransform,
|
|
4219
|
+
j as transformToDrawingPosition
|
|
3668
4220
|
};
|