@univerjs/sheets-drawing-ui 0.1.17 → 0.2.1

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/es/index.js CHANGED
@@ -1,65 +1,65 @@
1
- var kt = Object.defineProperty;
2
- var Jt = (r, e, n) => e in r ? kt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
- var K = (r, e, n) => Jt(r, typeof e != "symbol" ? e + "" : e, n);
4
- import { CommandType as G, ICommandService as B, IUndoRedoService as ae, LocaleService as pe, IUniverInstanceService as ce, RxDisposable as Zt, UniverInstanceType as Y, toDisposable as qt, FOCUSING_COMMON_DRAWINGS as fe, OnLifecycle as de, LifecycleStages as le, IContextService as gt, Disposable as ue, Direction as J, FOCUSING_FORMULA_EDITOR as Qt, EDITOR_ACTIVATED as en, Rectangle as tn, DrawingTypeEnum as Ve, DisposableCollection as nn, Tools as ie, UserManagerService as rn, IPermissionService as sn, Plugin as on, DependentOn as an } from "@univerjs/core";
5
- import { Inject as $, Injector as Ze } from "@wendellhu/redi";
6
- import { ImageCropperObject as cn, COMPONENT_IMAGE_POPUP_MENU as dn, OpenImageCropOperation as ln, ImageResetSizeOperation as un, DrawingCommonPanel as mn, DrawingRenderService as gn, UniverDrawingUIPlugin as hn } from "@univerjs/drawing-ui";
7
- import { ISheetDrawingService as X, SetDrawingApplyMutation as O, DrawingApplyType as P, SheetDrawingAnchorType as b, UniverSheetsDrawingPlugin as fn } from "@univerjs/sheets-drawing";
8
- import { IDrawingManagerService as H, IImageIoService as ht, ArrangeTypeEnum as ve, DrawingTypeEnum as Le, DRAWING_IMAGE_COUNT_LIMIT as it, ImageUploadStatusType as Ge, DRAWING_IMAGE_ALLOW_SIZE as pn, getImageSize as wn, DRAWING_IMAGE_WIDTH_LIMIT as st, DRAWING_IMAGE_HEIGHT_LIMIT as ot, DRAWING_IMAGE_ALLOW_IMAGE_LIST as _n, getDrawingShapeKeyByDrawingSearch as vn, UniverDrawingPlugin as Sn } from "@univerjs/drawing";
9
- import { IRenderManagerService as te, getGroupState as Cn, transformObjectOutOfGroup as In, precisionTo as Z, Rect as Rn, DRAWING_OBJECT_LAYER_INDEX as Dn, SHEET_VIEWPORT_KEY as Mn, RENDER_CLASS_TYPE as ne } from "@univerjs/engine-render";
10
- import { SheetCanvasPopManagerService as bn, ISelectionRenderService as $e, getCurrentRangeDisable$ as On, SheetSkeletonManagerService as Xe, SetScrollOperation as Pn, SetZoomRatioOperation as En, SheetPrintInterceptorService as yn } from "@univerjs/sheets-ui";
11
- import { takeUntil as at, Subject as ct, BehaviorSubject as Tn, combineLatest as Se, map as dt, filter as Ce, distinctUntilChanged as Ie } from "rxjs";
12
- import { ISidebarService as Un, BuiltInUIPart as An, IUIPartsService as Nn, IMessageService as jn, MenuItemType as ft, MenuPosition as Ln, MenuGroup as $n, getMenuHiddenObservable as pt, KeyCode as oe, ComponentManager as Bn, IMenuService as Wn, IShortcutService as Vn, CanvasFloatDomService as Gn } from "@univerjs/ui";
13
- import { useDependency as q, connectInjector as xn } from "@wendellhu/redi/react-bindings";
14
- import { getSheetCommandTarget as se, SelectionManagerService as Fn, WorkbookEditablePermission as He, WorksheetEditPermission as Oe, RangeProtectionPermissionEditPoint as Yn, InsertRowCommand as wt, InsertColCommand as _t, RemoveRowCommand as vt, RemoveColCommand as St, DeleteRangeMoveLeftCommand as Ct, DeleteRangeMoveUpCommand as It, InsertRangeMoveDownCommand as Rt, InsertRangeMoveRightCommand as Dt, DeltaRowHeightCommand as ze, SetRowHeightCommand as Ke, DeltaColumnWidthCommand as Mt, SetColWidthCommand as bt, SetRowHiddenCommand as Ot, SetSpecificRowsVisibleCommand as Pt, SetSpecificColsVisibleCommand as Et, SetColHiddenCommand as yt, SetRowVisibleMutation as Xn, SetRowHiddenMutation as Hn, SetColVisibleMutation as zn, SetColHiddenMutation as Kn, SetWorksheetRowHeightMutation as kn, SetWorksheetColWidthMutation as Jn, SetWorksheetActiveOperation as Zn, SheetInterceptorService as qn, SetFrozenMutation as Qn, WorkbookViewPermission as lt, WorksheetViewPermission as xe } from "@univerjs/sheets";
15
- import L, { useEffect as qe, forwardRef as Tt, useRef as Ut, createElement as At, useState as ke } from "react";
16
- import { MessageType as Re, RadioGroup as er, Radio as Fe } from "@univerjs/design";
17
- import De from "clsx";
1
+ var tn = Object.defineProperty;
2
+ var nn = (i, e, n) => e in i ? tn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
3
+ var K = (i, e, n) => nn(i, typeof e != "symbol" ? e + "" : e, n);
4
+ import { CommandType as G, ICommandService as Y, IUndoRedoService as he, LocaleService as ve, IUniverInstanceService as ge, RxDisposable as rn, UniverInstanceType as F, toDisposable as sn, FOCUSING_COMMON_DRAWINGS as we, OnLifecycle as ae, LifecycleStages as ce, IContextService as wt, Disposable as de, Direction as q, FOCUSING_FORMULA_EDITOR as on, EDITOR_ACTIVATED as an, Rectangle as cn, DrawingTypeEnum as ze, DisposableCollection as dn, Tools as se, UserManagerService as ln, IPermissionService as un, Plugin as hn, DependentOn as gn } from "@univerjs/core";
5
+ import { Inject as W, Injector as xe } from "@wendellhu/redi";
6
+ import { ImageCropperObject as mn, COMPONENT_IMAGE_POPUP_MENU as fn, OpenImageCropOperation as pn, ImageResetSizeOperation as wn, DrawingCommonPanel as _n, DrawingRenderService as vn, UniverDrawingUIPlugin as Sn } from "@univerjs/drawing-ui";
7
+ import { ISheetDrawingService as H, SetDrawingApplyMutation as y, DrawingApplyType as T, SheetDrawingAnchorType as E, UniverSheetsDrawingPlugin as Cn } from "@univerjs/sheets-drawing";
8
+ import { IDrawingManagerService as J, IImageIoService as _t, ArrangeTypeEnum as De, DrawingTypeEnum as Fe, DRAWING_IMAGE_COUNT_LIMIT as ct, ImageUploadStatusType as Ke, DRAWING_IMAGE_ALLOW_SIZE as Rn, getImageSize as In, DRAWING_IMAGE_WIDTH_LIMIT as dt, DRAWING_IMAGE_HEIGHT_LIMIT as lt, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Dn, getDrawingShapeKeyByDrawingSearch as Mn, UniverDrawingPlugin as bn } from "@univerjs/drawing";
9
+ import { IRenderManagerService as te, getGroupState as On, transformObjectOutOfGroup as En, precisionTo as Q, Rect as yn, DRAWING_OBJECT_LAYER_INDEX as Tn, SHEET_VIEWPORT_KEY as Pn, RENDER_CLASS_TYPE as le } from "@univerjs/engine-render";
10
+ import { SheetCanvasPopManagerService as Un, SheetSkeletonManagerService as _e, ISelectionRenderService as Se, getCurrentRangeDisable$ as An, SetScrollOperation as Nn, SetZoomRatioOperation as jn, SheetPrintInterceptorService as Ln, COPY_TYPE as ut, PREDEFINED_HOOK_NAME as Me, virtualizeDiscreteRanges as Wn, ISheetClipboardService as Bn } from "@univerjs/sheets-ui";
11
+ import { takeUntil as ht, Subject as gt, BehaviorSubject as $n, combineLatest as be, map as mt, filter as Oe, distinctUntilChanged as Ee } from "rxjs";
12
+ import { ISidebarService as Vn, BuiltInUIPart as Yn, IUIPartsService as Gn, IMessageService as Xn, MenuItemType as vt, MenuPosition as xn, MenuGroup as Fn, getMenuHiddenObservable as St, KeyCode as ue, ComponentManager as Hn, IMenuService as kn, IShortcutService as zn, CanvasFloatDomService as Kn } from "@univerjs/ui";
13
+ import { useDependency as ee, connectInjector as Jn } from "@wendellhu/redi/react-bindings";
14
+ import { getSheetCommandTarget as oe, SelectionManagerService as Zn, WorkbookEditablePermission as et, WorksheetEditPermission as Ne, RangeProtectionPermissionEditPoint as qn, InsertRowCommand as Ct, InsertColCommand as Rt, RemoveRowCommand as It, RemoveColCommand as Dt, DeleteRangeMoveLeftCommand as Mt, DeleteRangeMoveUpCommand as bt, InsertRangeMoveDownCommand as Ot, InsertRangeMoveRightCommand as Et, DeltaRowHeightCommand as tt, SetRowHeightCommand as nt, DeltaColumnWidthCommand as yt, SetColWidthCommand as Tt, SetRowHiddenCommand as Pt, SetSpecificRowsVisibleCommand as Ut, SetSpecificColsVisibleCommand as At, SetColHiddenCommand as Nt, MoveRangeCommand as jt, SetRowVisibleMutation as Qn, SetRowHiddenMutation as er, SetColVisibleMutation as tr, SetColHiddenMutation as nr, SetWorksheetRowHeightMutation as rr, SetWorksheetColWidthMutation as ir, SetWorksheetActiveOperation as sr, SheetInterceptorService as or, SetFrozenMutation as ar, WorkbookViewPermission as ft, WorksheetViewPermission as Je } from "@univerjs/sheets";
15
+ import L, { useEffect as st, forwardRef as Lt, useRef as Wt, createElement as Bt, useState as rt } from "react";
16
+ import { MessageType as ye, RadioGroup as cr, Radio as Ze } from "@univerjs/design";
17
+ import Te from "clsx";
18
18
  const j = {
19
19
  id: "sheet.operation.clear-drawing-transformer",
20
20
  type: G.MUTATION,
21
- handler: (r, e) => {
22
- const n = r.get(te);
21
+ handler: (i, e) => {
22
+ const n = i.get(te);
23
23
  return e.forEach((t) => {
24
- var i, s;
25
- (s = (i = n.getRenderById(t)) == null ? void 0 : i.scene.getTransformer()) == null || s.debounceRefreshControls();
24
+ var r, s;
25
+ (s = (r = n.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
26
26
  }), !0;
27
27
  }
28
- }, Qe = {
28
+ }, ot = {
29
29
  id: "sheet.command.remove-sheet-image",
30
30
  type: G.COMMAND,
31
- handler: (r, e) => {
32
- const n = r.get(B), t = r.get(ae), i = r.get(X);
31
+ handler: (i, e) => {
32
+ const n = i.get(Y), t = i.get(he), r = i.get(H);
33
33
  if (!e) return !1;
34
34
  const { drawings: s } = e, o = [];
35
35
  s.forEach((f) => {
36
- const { unitId: h } = f;
37
- o.push(h);
36
+ const { unitId: m } = f;
37
+ o.push(m);
38
38
  });
39
- const a = i.getBatchRemoveOp(s), { unitId: c, subUnitId: g, undo: l, redo: d, objects: m } = a;
40
- return n.syncExecuteCommand(O.id, { unitId: c, subUnitId: g, op: d, objects: m, type: P.REMOVE }) ? (t.pushUndoRedo({
41
- unitID: c,
39
+ const a = r.getBatchRemoveOp(s), { unitId: d, subUnitId: g, undo: l, redo: c, objects: u } = a;
40
+ return n.syncExecuteCommand(y.id, { unitId: d, subUnitId: g, op: c, objects: u, type: T.REMOVE }) ? (t.pushUndoRedo({
41
+ unitID: d,
42
42
  undoMutations: [
43
- { id: O.id, params: { unitId: c, subUnitId: g, op: l, objects: m, type: P.INSERT } },
43
+ { id: y.id, params: { unitId: d, subUnitId: g, op: l, objects: u, type: T.INSERT } },
44
44
  { id: j.id, params: o }
45
45
  ],
46
46
  redoMutations: [
47
- { id: O.id, params: { unitId: c, subUnitId: g, op: d, objects: m, type: P.REMOVE } },
47
+ { id: y.id, params: { unitId: d, subUnitId: g, op: c, objects: u, type: T.REMOVE } },
48
48
  { id: j.id, params: o }
49
49
  ]
50
50
  }), !0) : !1;
51
51
  }
52
- }, Nt = "COMPONENT_SHEET_DRAWING_PANEL", jt = {
52
+ }, $t = "COMPONENT_SHEET_DRAWING_PANEL", Vt = {
53
53
  id: "sidebar.operation.sheet-image",
54
54
  type: G.COMMAND,
55
- handler: async (r, e) => {
56
- const n = r.get(Un), t = r.get(pe), i = r.get(ce), s = r.get(H);
57
- if (!se(i)) return !1;
55
+ handler: async (i, e) => {
56
+ const n = i.get(Vn), t = i.get(ve), r = i.get(ge), s = i.get(J);
57
+ if (!oe(r)) return !1;
58
58
  switch (e.value) {
59
59
  case "open":
60
60
  n.open({
61
61
  header: { title: t.t("sheetImage.panel.title") },
62
- children: { label: Nt },
62
+ children: { label: $t },
63
63
  onClose: () => {
64
64
  s.focusDrawing(null);
65
65
  },
@@ -73,43 +73,43 @@ const j = {
73
73
  }
74
74
  return !0;
75
75
  }
76
- }, Lt = {
76
+ }, Yt = {
77
77
  id: "sheet.operation.edit-sheet-image",
78
78
  type: G.OPERATION,
79
- handler: (r, e) => {
80
- const n = r.get(H), t = r.get(B);
81
- return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(jt.id, { value: "open" }), !0);
82
- }
83
- }, tr = "univer-upload-loading", nr = "univer-upload-loading-body", rr = "univer-upload-loading-body-animation", ir = "univer-UniverCircleAnimation", sr = "univer-upload-loading-body-text", Me = {
84
- uploadLoading: tr,
85
- uploadLoadingBody: nr,
86
- uploadLoadingBodyAnimation: rr,
87
- univerCircleAnimation: ir,
88
- uploadLoadingBodyText: sr
89
- }, or = () => {
90
- const r = q(ht), e = q(pe), [n, t] = L.useState(0);
91
- return qe(() => {
92
- const i = r.change$.subscribe((s) => {
79
+ handler: (i, e) => {
80
+ const n = i.get(J), t = i.get(Y);
81
+ return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(Vt.id, { value: "open" }), !0);
82
+ }
83
+ }, dr = "univer-upload-loading", lr = "univer-upload-loading-body", ur = "univer-upload-loading-body-animation", hr = "univer-UniverCircleAnimation", gr = "univer-upload-loading-body-text", Pe = {
84
+ uploadLoading: dr,
85
+ uploadLoadingBody: lr,
86
+ uploadLoadingBodyAnimation: ur,
87
+ univerCircleAnimation: hr,
88
+ uploadLoadingBodyText: gr
89
+ }, mr = () => {
90
+ const i = ee(_t), e = ee(ve), [n, t] = L.useState(0);
91
+ return st(() => {
92
+ const r = i.change$.subscribe((s) => {
93
93
  t(s);
94
94
  });
95
95
  return () => {
96
- i.unsubscribe();
96
+ r.unsubscribe();
97
97
  };
98
- }, [r]), /* @__PURE__ */ L.createElement("div", { style: { display: n > 0 ? "block" : "none" }, className: Me.uploadLoading }, /* @__PURE__ */ L.createElement("div", { className: Me.uploadLoadingBody }, /* @__PURE__ */ L.createElement("div", { className: Me.uploadLoadingBodyAnimation }), /* @__PURE__ */ L.createElement("div", { className: Me.uploadLoadingBodyText }, `${e.t("uploadLoading.loading")}: ${n}`)));
98
+ }, [i]), /* @__PURE__ */ L.createElement("div", { style: { display: n > 0 ? "block" : "none" }, className: Pe.uploadLoading }, /* @__PURE__ */ L.createElement("div", { className: Pe.uploadLoadingBody }, /* @__PURE__ */ L.createElement("div", { className: Pe.uploadLoadingBodyAnimation }), /* @__PURE__ */ L.createElement("div", { className: Pe.uploadLoadingBodyText }, `${e.t("uploadLoading.loading")}: ${n}`)));
99
99
  };
100
- var ar = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, dr = (r, e, n, t) => {
101
- for (var i = t > 1 ? void 0 : t ? cr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
102
- (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
103
- return t && i && ar(e, n, i), i;
104
- }, Q = (r, e) => (n, t) => e(n, t, r);
105
- let Pe = class extends Zt {
106
- constructor(e, n, t, i, s, o, a) {
100
+ var fr = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, wr = (i, e, n, t) => {
101
+ for (var r = t > 1 ? void 0 : t ? pr(e, n) : e, s = i.length - 1, o; s >= 0; s--)
102
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
103
+ return t && r && fr(e, n, r), r;
104
+ }, ne = (i, e) => (n, t) => e(n, t, i);
105
+ let je = class extends rn {
106
+ constructor(e, n, t, r, s, o, a) {
107
107
  super();
108
108
  K(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
109
- this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = i, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._init();
109
+ this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._init();
110
110
  }
111
111
  _init() {
112
- this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET).pipe(at(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(Y.UNIVER_SHEET).pipe(at(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(Y.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(An.CONTENT, () => xn(or, this._injector));
112
+ this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(ht(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(F.UNIVER_SHEET).pipe(ht(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(F.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(Yn.CONTENT, () => Jn(mr, this._injector));
113
113
  }
114
114
  _dispose(e) {
115
115
  const n = e.getUnitId();
@@ -124,7 +124,7 @@ let Pe = class extends Zt {
124
124
  _hasCropObject(e) {
125
125
  const n = e.getAllObjects();
126
126
  for (const t of n)
127
- if (t instanceof cn)
127
+ if (t instanceof mn)
128
128
  return !0;
129
129
  return !1;
130
130
  }
@@ -136,45 +136,45 @@ let Pe = class extends Zt {
136
136
  const t = n.getTransformerByCreate();
137
137
  if (!t)
138
138
  return;
139
- const i = [];
139
+ let r;
140
140
  this.disposeWithMe(
141
- qt(
141
+ sn(
142
142
  t.createControl$.subscribe(() => {
143
- if (this._contextService.setContextValue(fe, !0), this._hasCropObject(n))
143
+ if (this._contextService.setContextValue(we, !0), this._hasCropObject(n))
144
144
  return;
145
145
  const o = t.getSelectedObjectMap();
146
146
  if (o.size > 1) {
147
- i.forEach((u) => u.dispose());
147
+ r == null || r.dispose();
148
148
  return;
149
149
  }
150
150
  const a = o.values().next().value;
151
151
  if (!a)
152
152
  return;
153
- const c = a.oKey, g = this._drawingManagerService.getDrawingOKey(c);
153
+ const d = a.oKey, g = this._drawingManagerService.getDrawingOKey(d);
154
154
  if (!g)
155
155
  return;
156
- const { unitId: l, subUnitId: d, drawingId: m } = g;
157
- i.push(this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
158
- componentKey: dn,
156
+ const { unitId: l, subUnitId: c, drawingId: u } = g;
157
+ r == null || r.dispose(), r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
158
+ componentKey: fn,
159
159
  direction: "horizontal",
160
160
  offset: [2, 0],
161
161
  extraProps: {
162
- menuItems: this._getImageMenuItems(l, d, m)
162
+ menuItems: this._getImageMenuItems(l, c, u)
163
163
  }
164
- }))), this._drawingManagerService.focusDrawing([{
164
+ })), this._drawingManagerService.focusDrawing([{
165
165
  unitId: l,
166
- subUnitId: d,
167
- drawingId: m
166
+ subUnitId: c,
167
+ drawingId: u
168
168
  }]);
169
169
  })
170
170
  )
171
171
  ), this.disposeWithMe(
172
172
  t.clearControl$.subscribe(() => {
173
- i.forEach((o) => o.dispose()), this._contextService.setContextValue(fe, !1), this._drawingManagerService.focusDrawing(null);
173
+ r == null || r.dispose(), this._contextService.setContextValue(we, !1), this._drawingManagerService.focusDrawing(null);
174
174
  })
175
175
  ), this.disposeWithMe(
176
176
  t.changing$.subscribe(() => {
177
- i.forEach((o) => o.dispose());
177
+ r == null || r.dispose();
178
178
  })
179
179
  );
180
180
  }
@@ -183,125 +183,125 @@ let Pe = class extends Zt {
183
183
  {
184
184
  label: "image-popup.edit",
185
185
  index: 0,
186
- commandId: Lt.id,
186
+ commandId: Yt.id,
187
187
  commandParams: { unitId: e, subUnitId: n, drawingId: t },
188
188
  disable: !1
189
189
  },
190
190
  {
191
191
  label: "image-popup.delete",
192
192
  index: 1,
193
- commandId: Qe.id,
193
+ commandId: ot.id,
194
194
  commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
195
195
  disable: !1
196
196
  },
197
197
  {
198
198
  label: "image-popup.crop",
199
199
  index: 2,
200
- commandId: ln.id,
200
+ commandId: pn.id,
201
201
  commandParams: { unitId: e, subUnitId: n, drawingId: t },
202
202
  disable: !1
203
203
  },
204
204
  {
205
205
  label: "image-popup.reset",
206
206
  index: 3,
207
- commandId: un.id,
207
+ commandId: wn.id,
208
208
  commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
209
209
  disable: !1
210
210
  }
211
211
  ];
212
212
  }
213
213
  };
214
- Pe = dr([
215
- de(le.Steady, Pe),
216
- Q(0, $(Ze)),
217
- Q(1, H),
218
- Q(2, $(bn)),
219
- Q(3, te),
220
- Q(4, ce),
221
- Q(5, gt),
222
- Q(6, $(Nn))
223
- ], Pe);
224
- const Be = {
214
+ je = wr([
215
+ ae(ce.Steady, je),
216
+ ne(0, W(xe)),
217
+ ne(1, J),
218
+ ne(2, W(Un)),
219
+ ne(3, te),
220
+ ne(4, ge),
221
+ ne(5, wt),
222
+ ne(6, W(Gn))
223
+ ], je);
224
+ const He = {
225
225
  id: "sheet.operation.insert-float-image",
226
226
  type: G.OPERATION,
227
- handler: (r, e) => !0
228
- }, Ae = {
227
+ handler: (i, e) => !0
228
+ }, Ye = {
229
229
  id: "sheet.operation.insert-cell-image",
230
230
  type: G.OPERATION,
231
- handler: (r, e) => !0
232
- }, et = {
231
+ handler: (i, e) => !0
232
+ }, at = {
233
233
  id: "sheet.command.insert-sheet-image",
234
234
  type: G.COMMAND,
235
- handler: (r, e) => {
236
- const n = r.get(B), t = r.get(ae), i = r.get(X);
235
+ handler: (i, e) => {
236
+ const n = i.get(Y), t = i.get(he), r = i.get(H);
237
237
  if (!e) return !1;
238
- const s = e.drawings, o = s.map((f) => f.unitId), a = i.getBatchAddOp(s), { unitId: c, subUnitId: g, undo: l, redo: d, objects: m } = a;
239
- return n.syncExecuteCommand(O.id, { op: d, unitId: c, subUnitId: g, objects: m, type: P.INSERT }) ? (t.pushUndoRedo({
240
- unitID: c,
238
+ const s = e.drawings, o = s.map((f) => f.unitId), a = r.getBatchAddOp(s), { unitId: d, subUnitId: g, undo: l, redo: c, objects: u } = a;
239
+ return n.syncExecuteCommand(y.id, { op: c, unitId: d, subUnitId: g, objects: u, type: T.INSERT }) ? (t.pushUndoRedo({
240
+ unitID: d,
241
241
  undoMutations: [
242
- { id: O.id, params: { op: l, unitId: c, subUnitId: g, objects: m, type: P.REMOVE } },
242
+ { id: y.id, params: { op: l, unitId: d, subUnitId: g, objects: u, type: T.REMOVE } },
243
243
  { id: j.id, params: o }
244
244
  ],
245
245
  redoMutations: [
246
- { id: O.id, params: { op: d, unitId: c, subUnitId: g, objects: m, type: P.INSERT } },
246
+ { id: y.id, params: { op: c, unitId: d, subUnitId: g, objects: u, type: T.INSERT } },
247
247
  { id: j.id, params: o }
248
248
  ]
249
249
  }), !0) : !1;
250
250
  }
251
- }, We = {
251
+ }, ke = {
252
252
  id: "sheet.command.set-sheet-image",
253
253
  type: G.COMMAND,
254
- handler: (r, e) => {
255
- const n = r.get(B), t = r.get(ae), i = r.get(X);
254
+ handler: (i, e) => {
255
+ const n = i.get(Y), t = i.get(he), r = i.get(H);
256
256
  if (!e) return !1;
257
- const { drawings: s } = e, o = i.getBatchUpdateOp(s), { unitId: a, subUnitId: c, undo: g, redo: l, objects: d } = o;
258
- return n.syncExecuteCommand(O.id, { unitId: a, subUnitId: c, op: l, objects: d, type: P.UPDATE }) ? (t.pushUndoRedo({
257
+ const { drawings: s } = e, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: d, undo: g, redo: l, objects: c } = o;
258
+ return n.syncExecuteCommand(y.id, { unitId: a, subUnitId: d, op: l, objects: c, type: T.UPDATE }) ? (t.pushUndoRedo({
259
259
  unitID: a,
260
260
  undoMutations: [
261
- { id: O.id, params: { unitId: a, subUnitId: c, op: g, objects: d, type: P.UPDATE } },
261
+ { id: y.id, params: { unitId: a, subUnitId: d, op: g, objects: c, type: T.UPDATE } },
262
262
  { id: j.id, params: [a] }
263
263
  ],
264
264
  redoMutations: [
265
- { id: O.id, params: { unitId: a, subUnitId: c, op: l, objects: d, type: P.UPDATE } },
265
+ { id: y.id, params: { unitId: a, subUnitId: d, op: l, objects: c, type: T.UPDATE } },
266
266
  { id: j.id, params: [a] }
267
267
  ]
268
268
  }), !0) : !1;
269
269
  }
270
- }, $t = {
270
+ }, Gt = {
271
271
  id: "sheet.command.set-drawing-arrange",
272
272
  type: G.COMMAND,
273
- handler: (r, e) => {
274
- const n = r.get(B), t = r.get(ae);
273
+ handler: (i, e) => {
274
+ const n = i.get(Y), t = i.get(he);
275
275
  if (!e) return !1;
276
- const i = r.get(X), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: c } = e, g = { unitId: s, subUnitId: o, drawingIds: a };
276
+ const r = i.get(H), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: d } = e, g = { unitId: s, subUnitId: o, drawingIds: a };
277
277
  let l;
278
- if (c === ve.forward ? l = i.getForwardDrawingsOp(g) : c === ve.backward ? l = i.getBackwardDrawingOp(g) : c === ve.front ? l = i.getFrontDrawingsOp(g) : c === ve.back && (l = i.getBackDrawingsOp(g)), l == null)
278
+ if (d === De.forward ? l = r.getForwardDrawingsOp(g) : d === De.backward ? l = r.getBackwardDrawingOp(g) : d === De.front ? l = r.getFrontDrawingsOp(g) : d === De.back && (l = r.getBackDrawingsOp(g)), l == null)
279
279
  return !1;
280
- const { objects: d, redo: m, undo: u } = l;
281
- return n.syncExecuteCommand(O.id, { op: m, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE }) ? (t.pushUndoRedo({
280
+ const { objects: c, redo: u, undo: h } = l;
281
+ return n.syncExecuteCommand(y.id, { op: u, unitId: s, subUnitId: o, objects: c, type: T.ARRANGE }) ? (t.pushUndoRedo({
282
282
  unitID: s,
283
283
  undoMutations: [
284
- { id: O.id, params: { op: u, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE } }
284
+ { id: y.id, params: { op: h, unitId: s, subUnitId: o, objects: c, type: T.ARRANGE } }
285
285
  ],
286
286
  redoMutations: [
287
- { id: O.id, params: { op: m, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE } }
287
+ { id: y.id, params: { op: u, unitId: s, subUnitId: o, objects: c, type: T.ARRANGE } }
288
288
  ]
289
289
  }), !0) : !1;
290
290
  }
291
291
  };
292
- function lr(r) {
292
+ function _r(i) {
293
293
  const e = [];
294
- return r.forEach((n) => {
295
- const { parent: t, children: i } = n, { unitId: s, subUnitId: o, drawingId: a } = t, c = Cn(0, 0, i.map((d) => d.transform || {})), g = i.map((d) => {
296
- const m = d.transform || { left: 0, top: 0 }, { unitId: u, subUnitId: f, drawingId: h } = d;
294
+ return i.forEach((n) => {
295
+ const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a } = t, d = On(0, 0, r.map((c) => c.transform || {})), g = r.map((c) => {
296
+ const u = c.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: m } = c;
297
297
  return {
298
- unitId: u,
298
+ unitId: h,
299
299
  subUnitId: f,
300
- drawingId: h,
300
+ drawingId: m,
301
301
  transform: {
302
- ...m,
303
- left: m.left - c.left,
304
- top: m.top - c.top
302
+ ...u,
303
+ left: u.left - d.left,
304
+ top: u.top - d.top
305
305
  },
306
306
  groupId: a
307
307
  };
@@ -309,8 +309,8 @@ function lr(r) {
309
309
  unitId: s,
310
310
  subUnitId: o,
311
311
  drawingId: a,
312
- drawingType: Le.DRAWING_GROUP,
313
- transform: c
312
+ drawingType: Fe.DRAWING_GROUP,
313
+ transform: d
314
314
  };
315
315
  e.push({
316
316
  parent: l,
@@ -318,18 +318,18 @@ function lr(r) {
318
318
  });
319
319
  }), e;
320
320
  }
321
- function ur(r) {
321
+ function vr(i) {
322
322
  const e = [];
323
- return r.forEach((n) => {
324
- const { parent: t, children: i } = n, { unitId: s, subUnitId: o, drawingId: a, transform: c = { width: 0, height: 0 } } = t;
325
- if (c == null)
323
+ return i.forEach((n) => {
324
+ const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: a, transform: d = { width: 0, height: 0 } } = t;
325
+ if (d == null)
326
326
  return;
327
- const g = i.map((d) => {
328
- const { transform: m } = d, { unitId: u, subUnitId: f, drawingId: h } = d, p = In(m || {}, c, c.width || 0, c.height || 0);
327
+ const g = r.map((c) => {
328
+ const { transform: u } = c, { unitId: h, subUnitId: f, drawingId: m } = c, p = En(u || {}, d, d.width || 0, d.height || 0);
329
329
  return {
330
- unitId: u,
330
+ unitId: h,
331
331
  subUnitId: f,
332
- drawingId: h,
332
+ drawingId: m,
333
333
  transform: p,
334
334
  groupId: void 0
335
335
  };
@@ -337,7 +337,7 @@ function ur(r) {
337
337
  unitId: s,
338
338
  subUnitId: o,
339
339
  drawingId: a,
340
- drawingType: Le.DRAWING_GROUP,
340
+ drawingType: Fe.DRAWING_GROUP,
341
341
  transform: {
342
342
  left: 0,
343
343
  top: 0
@@ -349,137 +349,149 @@ function ur(r) {
349
349
  });
350
350
  }), e;
351
351
  }
352
- const Bt = {
352
+ const Xt = {
353
353
  id: "sheet.command.group-sheet-image",
354
354
  type: G.COMMAND,
355
- handler: (r, e) => {
356
- const n = r.get(B), t = r.get(ae), i = r.get(X);
355
+ handler: (i, e) => {
356
+ const n = i.get(Y), t = i.get(he), r = i.get(H);
357
357
  if (!e) return !1;
358
358
  const s = [];
359
- e.forEach(({ parent: u, children: f }) => {
360
- s.push(u.unitId), f.forEach((h) => {
361
- s.push(h.unitId);
359
+ e.forEach(({ parent: h, children: f }) => {
360
+ s.push(h.unitId), f.forEach((m) => {
361
+ s.push(m.unitId);
362
362
  });
363
363
  });
364
- const o = i.getGroupDrawingOp(e), { unitId: a, subUnitId: c, undo: g, redo: l, objects: d } = o;
365
- return n.syncExecuteCommand(O.id, { op: l, unitId: a, subUnitId: c, objects: d, type: P.GROUP }) ? (t.pushUndoRedo({
364
+ const o = r.getGroupDrawingOp(e), { unitId: a, subUnitId: d, undo: g, redo: l, objects: c } = o;
365
+ return n.syncExecuteCommand(y.id, { op: l, unitId: a, subUnitId: d, objects: c, type: T.GROUP }) ? (t.pushUndoRedo({
366
366
  unitID: a,
367
367
  undoMutations: [
368
- { id: O.id, params: { op: g, unitId: a, subUnitId: c, objects: ur(d), type: P.UNGROUP } },
368
+ { id: y.id, params: { op: g, unitId: a, subUnitId: d, objects: vr(c), type: T.UNGROUP } },
369
369
  { id: j.id, params: s }
370
370
  ],
371
371
  redoMutations: [
372
- { id: O.id, params: { op: l, unitId: a, subUnitId: c, objects: d, type: P.GROUP } },
372
+ { id: y.id, params: { op: l, unitId: a, subUnitId: d, objects: c, type: T.GROUP } },
373
373
  { id: j.id, params: s }
374
374
  ]
375
375
  }), !0) : !1;
376
376
  }
377
- }, Wt = {
377
+ }, xt = {
378
378
  id: "sheet.command.ungroup-sheet-image",
379
379
  type: G.COMMAND,
380
- handler: (r, e) => {
381
- const n = r.get(B), t = r.get(ae), i = r.get(X);
380
+ handler: (i, e) => {
381
+ const n = i.get(Y), t = i.get(he), r = i.get(H);
382
382
  if (!e) return !1;
383
383
  const s = [];
384
- e.forEach(({ parent: u, children: f }) => {
385
- s.push(u.unitId), f.forEach((h) => {
386
- s.push(h.unitId);
384
+ e.forEach(({ parent: h, children: f }) => {
385
+ s.push(h.unitId), f.forEach((m) => {
386
+ s.push(m.unitId);
387
387
  });
388
388
  });
389
- const o = i.getUngroupDrawingOp(e), { unitId: a, subUnitId: c, undo: g, redo: l, objects: d } = o;
390
- return n.syncExecuteCommand(O.id, { op: l, unitId: a, subUnitId: c, objects: d, type: P.UNGROUP }) ? (t.pushUndoRedo({
389
+ const o = r.getUngroupDrawingOp(e), { unitId: a, subUnitId: d, undo: g, redo: l, objects: c } = o;
390
+ return n.syncExecuteCommand(y.id, { op: l, unitId: a, subUnitId: d, objects: c, type: T.UNGROUP }) ? (t.pushUndoRedo({
391
391
  unitID: a,
392
392
  undoMutations: [
393
- { id: O.id, params: { op: g, unitId: a, subUnitId: c, objects: lr(d), type: P.GROUP } },
393
+ { id: y.id, params: { op: g, unitId: a, subUnitId: d, objects: _r(c), type: T.GROUP } },
394
394
  { id: j.id, params: s }
395
395
  ],
396
396
  redoMutations: [
397
- { id: O.id, params: { op: l, unitId: a, subUnitId: c, objects: d, type: P.UNGROUP } },
397
+ { id: y.id, params: { op: l, unitId: a, subUnitId: d, objects: c, type: T.UNGROUP } },
398
398
  { id: j.id, params: s }
399
399
  ]
400
400
  }), !0) : !1;
401
401
  }
402
402
  };
403
- function V(r, e) {
404
- const { from: n, to: t } = r, { column: i, columnOffset: s, row: o, rowOffset: a } = n, { column: c, columnOffset: g, row: l, rowOffset: d } = t, m = e.attachRangeWithCoord({
405
- startColumn: i,
406
- endColumn: i,
407
- startRow: o,
408
- endRow: o
403
+ function V(i, e, n) {
404
+ const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY: g = 0 } = i, { column: l, columnOffset: c, row: u, rowOffset: h } = t, { column: f, columnOffset: m, row: p, rowOffset: v } = r, R = e.attachRangeWithCoord({
405
+ startColumn: l,
406
+ endColumn: l,
407
+ startRow: u,
408
+ endRow: u
409
409
  });
410
- if (m == null)
410
+ if (R == null)
411
411
  return;
412
- const u = e.attachRangeWithCoord({
413
- startColumn: c,
414
- endColumn: c,
415
- startRow: l,
416
- endRow: l
412
+ const S = e.attachRangeWithCoord({
413
+ startColumn: f,
414
+ endColumn: f,
415
+ startRow: p,
416
+ endRow: p
417
417
  });
418
- if (u == null)
418
+ if (S == null)
419
419
  return;
420
- const { startX: f, startY: h } = m, { startX: p, startY: S } = u, C = Z(f + s, 1), v = Z(h + a, 1);
421
- let R = Z(p + g - C, 1), _ = Z(S + d - v, 1);
422
- return m.startX === u.endX && (R = 0), m.startY === u.endY && (_ = 0), {
423
- left: C,
424
- top: v,
425
- width: R,
426
- height: _
420
+ const { startX: D, startY: _ } = R, { startX: b, startY: w } = S;
421
+ let U = Q(D + c, 1), O = Q(_ + h, 1), I = Q(b + m - U, 1), P = Q(w + v - O, 1);
422
+ R.startX === S.endX && (I = 0), R.startY === S.endY && (P = 0);
423
+ const M = n.getCurrentSkeleton(), C = M.rowHeaderWidth + M.columnTotalWidth, A = M.columnHeaderHeight + M.rowTotalHeight;
424
+ return U + I > C && (U = C - I), O + P > A && (O = A - P), {
425
+ flipY: s,
426
+ flipX: o,
427
+ angle: a,
428
+ skewX: d,
429
+ skewY: g,
430
+ left: U,
431
+ top: O,
432
+ width: I,
433
+ height: P
427
434
  };
428
435
  }
429
- function N(r, e) {
430
- const { left: n = 0, top: t = 0, width: i = 0, height: s = 0 } = r, o = e.getSelectionCellByPosition(n, t);
431
- if (o == null)
432
- return;
433
- const a = {
434
- column: o.actualColumn,
435
- columnOffset: Z(n - o.startX, 1),
436
- row: o.actualRow,
437
- rowOffset: Z(t - o.startY, 1)
438
- }, c = e.getSelectionCellByPosition(n + i, t + s);
436
+ function N(i, e) {
437
+ const { left: n = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: d = 0, skewX: g = 0, skewY: l = 0 } = i, c = e.getSelectionCellByPosition(n, t);
439
438
  if (c == null)
440
439
  return;
441
- const g = {
440
+ const u = {
442
441
  column: c.actualColumn,
443
- columnOffset: Z(n + i - c.startX, 1),
442
+ columnOffset: Q(n - c.startX, 1),
444
443
  row: c.actualRow,
445
- rowOffset: Z(t + s - c.startY, 1)
444
+ rowOffset: Q(t - c.startY, 1)
445
+ }, h = e.getSelectionCellByPosition(n + r, t + s);
446
+ if (h == null)
447
+ return;
448
+ const f = {
449
+ column: h.actualColumn,
450
+ columnOffset: Q(n + r - h.startX, 1),
451
+ row: h.actualRow,
452
+ rowOffset: Q(t + s - h.startY, 1)
446
453
  };
447
454
  return {
448
- from: a,
449
- to: g
455
+ flipY: o,
456
+ flipX: a,
457
+ angle: d,
458
+ skewX: g,
459
+ skewY: l,
460
+ from: u,
461
+ to: f
450
462
  };
451
463
  }
452
- var mr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, hr = (r, e, n, t) => {
453
- for (var i = t > 1 ? void 0 : t ? gr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
454
- (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
455
- return t && i && mr(e, n, i), i;
456
- }, F = (r, e) => (n, t) => e(n, t, r);
457
- let Ee = class extends ue {
458
- constructor(r, e, n, t, i, s, o, a, c, g, l) {
459
- super(), this._commandService = r, this._univerInstanceService = e, this._selectionManagerService = n, this._selectionRenderService = t, this._imageIoService = i, this._sheetDrawingService = s, this._drawingManagerService = o, this._contextService = a, this._messageService = c, this._localeService = g, this._renderManagerService = l, this._init();
464
+ var Sr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Rr = (i, e, n, t) => {
465
+ for (var r = t > 1 ? void 0 : t ? Cr(e, n) : e, s = i.length - 1, o; s >= 0; s--)
466
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
467
+ return t && r && Sr(e, n, r), r;
468
+ }, X = (i, e) => (n, t) => e(n, t, i);
469
+ let Le = class extends de {
470
+ constructor(i, e, n, t, r, s, o, a, d, g, l, c, u) {
471
+ super(), this._context = i, this._commandService = e, this._univerInstanceService = n, this._selectionManagerService = t, this._selectionRenderService = r, this._imageIoService = s, this._sheetDrawingService = o, this._drawingManagerService = a, this._contextService = d, this._messageService = g, this._localeService = l, this._renderManagerService = c, this._sheetSkeletonManagerService = u, this._init();
460
472
  }
461
473
  _init() {
462
- this._initCommandListeners(), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
474
+ this._initCommandListeners(), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._drawingAddListener();
463
475
  }
464
476
  /**
465
477
  * Upload image to cell or float image
466
478
  */
467
479
  _initCommandListeners() {
468
480
  this.disposeWithMe(
469
- this._commandService.onCommandExecuted(async (r) => {
470
- if (r.id === Ae.id || r.id === Be.id) {
471
- const e = r.params;
481
+ this._commandService.onCommandExecuted(async (i) => {
482
+ if (i.id === Ye.id || i.id === He.id) {
483
+ const e = i.params;
472
484
  if (e.files == null)
473
485
  return;
474
486
  const n = e.files.length;
475
- if (n > it) {
487
+ if (n > ct) {
476
488
  this._messageService.show({
477
- type: Re.Error,
478
- content: this._localeService.t("update-status.exceedMaxCount", String(it))
489
+ type: ye.Error,
490
+ content: this._localeService.t("update-status.exceedMaxCount", String(ct))
479
491
  });
480
492
  return;
481
493
  }
482
- this._imageIoService.setWaitCount(n), r.id === Ae.id ? e.files.forEach(async (t) => {
494
+ this._imageIoService.setWaitCount(n), i.id === Ye.id ? e.files.forEach(async (t) => {
483
495
  await this._insertCellImage(t);
484
496
  }) : e.files.forEach(async (t) => {
485
497
  await this._insertFloatImage(t);
@@ -488,22 +500,22 @@ let Ee = class extends ue {
488
500
  })
489
501
  );
490
502
  }
491
- async _insertCellImage(r) {
503
+ async _insertCellImage(i) {
492
504
  }
493
- async _insertFloatImage(r) {
505
+ async _insertFloatImage(i) {
494
506
  let e;
495
507
  try {
496
- e = await this._imageIoService.saveImage(r);
497
- } catch (C) {
498
- const v = C.message;
499
- v === Ge.ERROR_EXCEED_SIZE ? this._messageService.show({
500
- type: Re.Error,
501
- content: this._localeService.t("update-status.exceedMaxSize", String(pn / (1024 * 1024)))
502
- }) : v === Ge.ERROR_IMAGE_TYPE ? this._messageService.show({
503
- type: Re.Error,
508
+ e = await this._imageIoService.saveImage(i);
509
+ } catch (R) {
510
+ const S = R.message;
511
+ S === Ke.ERROR_EXCEED_SIZE ? this._messageService.show({
512
+ type: ye.Error,
513
+ content: this._localeService.t("update-status.exceedMaxSize", String(Rn / (1024 * 1024)))
514
+ }) : S === Ke.ERROR_IMAGE_TYPE ? this._messageService.show({
515
+ type: ye.Error,
504
516
  content: this._localeService.t("update-status.invalidImageType")
505
- }) : v === Ge.ERROR_IMAGE && this._messageService.show({
506
- type: Re.Error,
517
+ }) : S === Ke.ERROR_IMAGE && this._messageService.show({
518
+ type: ye.Error,
507
519
  content: this._localeService.t("update-status.invalidImage")
508
520
  });
509
521
  }
@@ -512,540 +524,560 @@ let Ee = class extends ue {
512
524
  const n = this._getUnitInfo();
513
525
  if (n == null)
514
526
  return;
515
- const { unitId: t, subUnitId: i } = n, { imageId: s, imageSourceType: o, source: a, base64Cache: c } = e, { width: g, height: l, image: d } = await wn(c || ""), m = this._renderManagerService.getRenderById(t);
516
- if (m == null)
527
+ const { unitId: t, subUnitId: r } = n, { imageId: s, imageSourceType: o, source: a, base64Cache: d } = e, { width: g, height: l, image: c } = await In(d || ""), u = this._renderManagerService.getRenderById(t);
528
+ if (u == null)
517
529
  return;
518
- const { width: u, height: f } = m.scene;
519
- this._imageIoService.addImageSourceCache(a, o, d);
520
- let h = 1;
521
- if (g > st || l > ot) {
522
- const C = st / g, v = ot / l;
523
- h = Math.max(C, v);
530
+ const { width: h, height: f } = u.scene;
531
+ this._imageIoService.addImageSourceCache(a, o, c);
532
+ let m = 1;
533
+ if (g > dt || l > lt) {
534
+ const R = dt / g, S = lt / l;
535
+ m = Math.max(R, S);
524
536
  }
525
- const p = this._getImagePosition(g * h, l * h, u, f);
537
+ const p = this._getImagePosition(g * m, l * m, h, f);
526
538
  if (p == null)
527
539
  return;
528
- const S = {
540
+ const v = {
529
541
  unitId: t,
530
- subUnitId: i,
542
+ subUnitId: r,
531
543
  drawingId: s,
532
- drawingType: Le.DRAWING_IMAGE,
544
+ drawingType: Fe.DRAWING_IMAGE,
533
545
  imageSourceType: o,
534
546
  source: a,
535
- transform: V(p, this._selectionRenderService),
547
+ transform: V(p, this._selectionRenderService, this._sheetSkeletonManagerService),
536
548
  sheetTransform: p
537
549
  };
538
- this._commandService.executeCommand(et.id, {
550
+ this._commandService.executeCommand(at.id, {
539
551
  unitId: t,
540
- drawings: [S]
552
+ drawings: [v]
541
553
  });
542
554
  }
543
555
  _getUnitInfo() {
544
- const r = this._univerInstanceService.getCurrentUnitForType(Y.UNIVER_SHEET);
545
- if (r == null)
556
+ const i = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET);
557
+ if (i == null)
546
558
  return;
547
- const e = r.getActiveSheet();
559
+ const e = i.getActiveSheet();
548
560
  if (e == null)
549
561
  return;
550
- const n = r.getUnitId(), t = e.getSheetId();
562
+ const n = i.getUnitId(), t = e.getSheetId();
551
563
  return {
552
564
  unitId: n,
553
565
  subUnitId: t
554
566
  };
555
567
  }
556
- _getImagePosition(r, e, n, t) {
557
- const i = this._selectionManagerService.getSelections();
568
+ _getImagePosition(i, e, n, t) {
569
+ const r = this._selectionManagerService.getSelections();
558
570
  let s = {
559
571
  startRow: 0,
560
572
  endRow: 0,
561
573
  startColumn: 0,
562
574
  endColumn: 0
563
575
  };
564
- i && i.length > 0 && (s = i[i.length - 1].range);
576
+ r && r.length > 0 && (s = r[r.length - 1].range);
565
577
  const o = this._selectionRenderService.attachRangeWithCoord(s);
566
578
  if (o == null)
567
579
  return;
568
- let { startColumn: a, startRow: c, startX: g, startY: l } = o, d = !1;
569
- if (g + r > n && (g = n - r, g < 0 && (g = 0, r = n), d = !0), l + e > t && (l = t - e, l < 0 && (l = 0, e = t), d = !0), d) {
570
- const h = this._selectionRenderService.getSelectionCellByPosition(g, l);
571
- if (h == null)
580
+ let { startColumn: a, startRow: d, startX: g, startY: l } = o, c = !1;
581
+ if (g + i > n && (g = n - i, g < 0 && (g = 0, i = n), c = !0), l + e > t && (l = t - e, l < 0 && (l = 0, e = t), c = !0), c) {
582
+ const m = this._selectionRenderService.getSelectionCellByPosition(g, l);
583
+ if (m == null)
572
584
  return;
573
- g = h.startX, l = h.startY, a = h.actualColumn, c = h.actualRow;
585
+ g = m.startX, l = m.startY, a = m.actualColumn, d = m.actualRow;
574
586
  }
575
- const m = {
587
+ const u = {
576
588
  column: a,
577
589
  columnOffset: 0,
578
- row: c,
590
+ row: d,
579
591
  rowOffset: 0
580
- }, u = this._selectionRenderService.getSelectionCellByPosition(g + r, l + e);
581
- if (u == null)
592
+ }, h = this._selectionRenderService.getSelectionCellByPosition(g + i, l + e);
593
+ if (h == null)
582
594
  return;
583
595
  const f = {
584
- column: u.actualColumn,
585
- columnOffset: g + r - u.startX,
586
- row: u.actualRow,
587
- rowOffset: l + e - u.startY
596
+ column: h.actualColumn,
597
+ columnOffset: g + i - h.startX,
598
+ row: h.actualRow,
599
+ rowOffset: l + e - h.startY
588
600
  };
589
601
  return {
590
- from: m,
602
+ from: u,
591
603
  to: f
592
604
  };
593
605
  }
594
606
  _updateOrderListener() {
595
- this._drawingManagerService.featurePluginOrderUpdate$.subscribe((r) => {
596
- const { unitId: e, subUnitId: n, drawingIds: t, arrangeType: i } = r;
597
- this._commandService.executeCommand($t.id, {
607
+ this._drawingManagerService.featurePluginOrderUpdate$.subscribe((i) => {
608
+ const { unitId: e, subUnitId: n, drawingIds: t, arrangeType: r } = i;
609
+ this._commandService.executeCommand(Gt.id, {
598
610
  unitId: e,
599
611
  subUnitId: n,
600
612
  drawingIds: t,
601
- arrangeType: i
613
+ arrangeType: r
602
614
  });
603
615
  });
604
616
  }
605
617
  _updateImageListener() {
606
- this._drawingManagerService.featurePluginUpdate$.subscribe((r) => {
618
+ this._drawingManagerService.featurePluginUpdate$.subscribe((i) => {
607
619
  const e = [];
608
- r.length !== 0 && (r.forEach((n) => {
609
- const { unitId: t, subUnitId: i, drawingId: s, drawingType: o, transform: a } = n;
620
+ i.length !== 0 && (i.forEach((n) => {
621
+ const { unitId: t, subUnitId: r, drawingId: s, drawingType: o, transform: a } = n;
610
622
  if (a == null)
611
623
  return;
612
- const c = this._sheetDrawingService.getDrawingByParam({ unitId: t, subUnitId: i, drawingId: s });
613
- if (c == null)
624
+ const d = this._sheetDrawingService.getDrawingByParam({ unitId: t, subUnitId: r, drawingId: s });
625
+ if (d == null)
614
626
  return;
615
- const g = N({ ...c.transform, ...a }, this._selectionRenderService);
627
+ const g = N({ ...d.transform, ...a }, this._selectionRenderService);
616
628
  if (g == null)
617
629
  return;
618
630
  const l = {
619
631
  ...n,
620
- transform: { ...c.transform, ...a, ...V(g, this._selectionRenderService) },
632
+ transform: { ...d.transform, ...a, ...V(g, this._selectionRenderService, this._sheetSkeletonManagerService) },
621
633
  sheetTransform: { ...g }
622
634
  };
623
635
  e.push(l);
624
- }), e.length > 0 && this._commandService.executeCommand(We.id, {
625
- unitId: r[0].unitId,
636
+ }), e.length > 0 && this._commandService.executeCommand(ke.id, {
637
+ unitId: i[0].unitId,
626
638
  drawings: e
627
639
  }));
628
640
  });
629
641
  }
630
642
  _groupDrawingListener() {
631
- this._drawingManagerService.featurePluginGroupUpdate$.subscribe((r) => {
632
- this._commandService.executeCommand(Bt.id, r);
633
- const { unitId: e, subUnitId: n, drawingId: t } = r[0].parent;
643
+ this._drawingManagerService.featurePluginGroupUpdate$.subscribe((i) => {
644
+ this._commandService.executeCommand(Xt.id, i);
645
+ const { unitId: e, subUnitId: n, drawingId: t } = i[0].parent;
634
646
  this._drawingManagerService.focusDrawing([{ unitId: e, subUnitId: n, drawingId: t }]);
635
- }), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((r) => {
636
- this._commandService.executeCommand(Wt.id, r);
647
+ }), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((i) => {
648
+ this._commandService.executeCommand(xt.id, i);
637
649
  });
638
650
  }
639
651
  _focusDrawingListener() {
640
652
  this.disposeWithMe(
641
- this._drawingManagerService.focus$.subscribe((r) => {
642
- r == null || r.length === 0 ? (this._contextService.setContextValue(fe, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(fe, !0), this._sheetDrawingService.focusDrawing(r));
653
+ this._drawingManagerService.focus$.subscribe((i) => {
654
+ i == null || i.length === 0 ? (this._contextService.setContextValue(we, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(we, !0), this._sheetDrawingService.focusDrawing(i));
643
655
  })
644
656
  );
645
657
  }
658
+ _drawingAddListener() {
659
+ this.disposeWithMe(
660
+ this._sheetDrawingService.add$.subscribe((i) => {
661
+ this._registerDrawing(i);
662
+ })
663
+ );
664
+ }
665
+ _registerDrawing(i) {
666
+ i.forEach((n) => {
667
+ const t = this._sheetDrawingService.getDrawingByParam(n);
668
+ if (t == null)
669
+ return;
670
+ const { sheetTransform: r } = t;
671
+ t.transform = V(r, this._selectionRenderService, this._sheetSkeletonManagerService);
672
+ });
673
+ const e = i[0].unitId;
674
+ this._drawingManagerService.registerDrawingData(e, this._sheetDrawingService.getDrawingDataForUnit(e)), this._drawingManagerService.initializeNotification(e);
675
+ }
646
676
  };
647
- Ee = hr([
648
- de(le.Rendered, Ee),
649
- F(0, B),
650
- F(1, ce),
651
- F(2, $(Fn)),
652
- F(3, $e),
653
- F(4, ht),
654
- F(5, X),
655
- F(6, H),
656
- F(7, gt),
657
- F(8, jn),
658
- F(9, $(pe)),
659
- F(10, te)
660
- ], Ee);
677
+ Le = Rr([
678
+ ae(ce.Rendered, Le),
679
+ X(1, Y),
680
+ X(2, ge),
681
+ X(3, W(Zn)),
682
+ X(4, Se),
683
+ X(5, _t),
684
+ X(6, H),
685
+ X(7, J),
686
+ X(8, wt),
687
+ X(9, Xn),
688
+ X(10, W(ve)),
689
+ X(11, te),
690
+ X(12, W(_e))
691
+ ], Le);
661
692
  var x = function() {
662
- return x = Object.assign || function(r) {
693
+ return x = Object.assign || function(i) {
663
694
  for (var e, n = 1, t = arguments.length; n < t; n++) {
664
695
  e = arguments[n];
665
- for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (r[i] = e[i]);
696
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (i[r] = e[r]);
666
697
  }
667
- return r;
698
+ return i;
668
699
  }, x.apply(this, arguments);
669
- }, fr = function(r, e) {
700
+ }, Ir = function(i, e) {
670
701
  var n = {};
671
- for (var t in r) Object.prototype.hasOwnProperty.call(r, t) && e.indexOf(t) < 0 && (n[t] = r[t]);
672
- if (r != null && typeof Object.getOwnPropertySymbols == "function")
673
- for (var i = 0, t = Object.getOwnPropertySymbols(r); i < t.length; i++)
674
- e.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(r, t[i]) && (n[t[i]] = r[t[i]]);
702
+ for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
703
+ if (i != null && typeof Object.getOwnPropertySymbols == "function")
704
+ for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
705
+ e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
675
706
  return n;
676
- }, Vt = Tt(function(r, e) {
677
- var n = r.icon, t = r.id, i = r.className, s = r.extend, o = fr(r, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(i || "").trim(), c = Ut("_".concat(_r()));
678
- return Gt(n, "".concat(t), { defIds: n.defIds, idSuffix: c.current }, x({ ref: e, className: a }, o), s);
707
+ }, Ft = Lt(function(i, e) {
708
+ var n = i.icon, t = i.id, r = i.className, s = i.extend, o = Ir(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = Wt("_".concat(br()));
709
+ return Ht(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, x({ ref: e, className: a }, o), s);
679
710
  });
680
- function Gt(r, e, n, t, i) {
681
- return At(r.tag, x(x({ key: e }, pr(r, n, i)), t), (wr(r, n).children || []).map(function(s, o) {
682
- return Gt(s, "".concat(e, "-").concat(r.tag, "-").concat(o), n, void 0, i);
711
+ function Ht(i, e, n, t, r) {
712
+ return Bt(i.tag, x(x({ key: e }, Dr(i, n, r)), t), (Mr(i, n).children || []).map(function(s, o) {
713
+ return Ht(s, "".concat(e, "-").concat(i.tag, "-").concat(o), n, void 0, r);
683
714
  }));
684
715
  }
685
- function pr(r, e, n) {
686
- var t = x({}, r.attrs);
716
+ function Dr(i, e, n) {
717
+ var t = x({}, i.attrs);
687
718
  n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
688
- var i = e.defIds;
689
- return !i || i.length === 0 || (r.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(s) {
719
+ var r = e.defIds;
720
+ return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(s) {
690
721
  var o = s[0], a = s[1];
691
722
  typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
692
723
  })), t;
693
724
  }
694
- function wr(r, e) {
725
+ function Mr(i, e) {
695
726
  var n, t = e.defIds;
696
- return !t || t.length === 0 ? r : r.tag === "defs" && (!((n = r.children) === null || n === void 0) && n.length) ? x(x({}, r), { children: r.children.map(function(i) {
697
- return typeof i.attrs.id == "string" && t && t.indexOf(i.attrs.id) > -1 ? x(x({}, i), { attrs: x(x({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
698
- }) }) : r;
727
+ return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? x(x({}, i), { children: i.children.map(function(r) {
728
+ return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? x(x({}, r), { attrs: x(x({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
729
+ }) }) : i;
699
730
  }
700
- function _r() {
731
+ function br() {
701
732
  return Math.random().toString(36).substring(2, 8);
702
733
  }
703
- Vt.displayName = "UniverIcon";
704
- var vr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, xt = Tt(function(r, e) {
705
- return At(Vt, Object.assign({}, r, {
734
+ Ft.displayName = "UniverIcon";
735
+ var Or = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, kt = Lt(function(i, e) {
736
+ return Bt(Ft, Object.assign({}, i, {
706
737
  id: "add-image-single",
707
738
  ref: e,
708
- icon: vr
739
+ icon: Or
709
740
  }));
710
741
  });
711
- xt.displayName = "AddImageSingle";
712
- const Sr = "univer-upload-file-menu", Cr = "univer-upload-file-menu-input", ut = {
713
- uploadFileMenu: Sr,
714
- uploadFileMenuInput: Cr
715
- }, Ft = "COMPONENT_UPLOAD_FILE_MENU";
716
- var Ne = /* @__PURE__ */ ((r) => (r[r.cellImage = 0] = "cellImage", r[r.floatImage = 1] = "floatImage", r))(Ne || {});
717
- const Ir = (r) => {
718
- const { type: e } = r, n = q(B), t = Ut(null), i = () => {
742
+ kt.displayName = "AddImageSingle";
743
+ const Er = "univer-upload-file-menu", yr = "univer-upload-file-menu-input", pt = {
744
+ uploadFileMenu: Er,
745
+ uploadFileMenuInput: yr
746
+ }, zt = "COMPONENT_UPLOAD_FILE_MENU";
747
+ var Ge = /* @__PURE__ */ ((i) => (i[i.cellImage = 0] = "cellImage", i[i.floatImage = 1] = "floatImage", i))(Ge || {});
748
+ const Tr = (i) => {
749
+ const { type: e } = i, n = ee(Y), t = Wt(null), r = () => {
719
750
  var a;
720
751
  (a = t.current) == null || a.click();
721
- }, s = _n.map((a) => `.${a.replace("image/", "")}`).join(","), o = (a) => {
722
- const c = a.target.files;
723
- if (c == null)
752
+ }, s = Dn.map((a) => `.${a.replace("image/", "")}`).join(","), o = (a) => {
753
+ const d = a.target.files;
754
+ if (d == null)
724
755
  return;
725
- const g = Array.from(c);
726
- e === Ne.floatImage ? n.executeCommand(Be.id, { files: g }) : e === Ne.cellImage && n.executeCommand(Ae.id, { files: g }), t.current && (t.current.value = "");
756
+ const g = Array.from(d);
757
+ e === Ge.floatImage ? n.executeCommand(He.id, { files: g }) : e === Ge.cellImage && n.executeCommand(Ye.id, { files: g }), t.current && (t.current.value = "");
727
758
  };
728
- return /* @__PURE__ */ L.createElement("div", { onClick: i, className: ut.uploadFileMenu }, /* @__PURE__ */ L.createElement(
759
+ return /* @__PURE__ */ L.createElement("div", { onClick: r, className: pt.uploadFileMenu }, /* @__PURE__ */ L.createElement(
729
760
  "input",
730
761
  {
731
762
  type: "file",
732
- className: ut.uploadFileMenuInput,
763
+ className: pt.uploadFileMenuInput,
733
764
  ref: t,
734
765
  onChange: o,
735
766
  accept: s,
736
767
  multiple: !0
737
768
  }
738
769
  ));
739
- }, Yt = "addition-and-subtraction-single", Xt = "sheet.menu.image";
740
- function Rr(r) {
770
+ }, Kt = "addition-and-subtraction-single", Jt = "sheet.menu.image";
771
+ function Pr(i) {
741
772
  return {
742
- id: Xt,
743
- type: ft.SUBITEMS,
744
- positions: [Ln.TOOLBAR_START],
745
- group: $n.TOOLBAR_FORMULAS_INSERT,
746
- icon: Yt,
773
+ id: Jt,
774
+ type: vt.SUBITEMS,
775
+ positions: [xn.TOOLBAR_START],
776
+ group: Fn.TOOLBAR_FORMULAS_INSERT,
777
+ icon: Kt,
747
778
  tooltip: "sheetImage.title",
748
- hidden$: pt(r, Y.UNIVER_SHEET),
749
- disabled$: On(r, { workbookTypes: [He], worksheetTypes: [Oe], rangeTypes: [Yn] })
779
+ hidden$: St(i, F.UNIVER_SHEET),
780
+ disabled$: An(i, { workbookTypes: [et], worksheetTypes: [Ne], rangeTypes: [qn] })
750
781
  };
751
782
  }
752
- function Dr(r) {
783
+ function Ur(i) {
753
784
  return {
754
- id: Be.id,
785
+ id: He.id,
755
786
  title: "sheetImage.upload.float",
756
- type: ft.SELECTOR,
787
+ type: vt.SELECTOR,
757
788
  label: {
758
- name: Ft,
789
+ name: zt,
759
790
  props: {
760
- type: Ne.floatImage
791
+ type: Ge.floatImage
761
792
  }
762
793
  },
763
- positions: [Xt],
764
- hidden$: pt(r, Y.UNIVER_SHEET)
794
+ positions: [Jt],
795
+ hidden$: St(i, F.UNIVER_SHEET)
765
796
  };
766
797
  }
767
- const Mr = "univer-image-common-panel", br = "univer-image-common-panel-grid", Or = "univer-image-common-panel-border", Pr = "univer-image-common-panel-title", Er = "univer-image-common-panel-row", yr = "univer-image-common-panel-row-vertical", Tr = "univer-image-common-panel-column", Ur = "univer-image-common-panel-column-center", Ar = "univer-image-common-panel-inline", Nr = "univer-image-common-panel-span2", jr = "univer-image-common-panel-span3", Lr = "univer-image-common-panel-input", $r = "univer-sheet-image-menu", Br = "univer-sheet-image-menu-input", k = {
768
- imageCommonPanel: Mr,
769
- imageCommonPanelGrid: br,
770
- imageCommonPanelBorder: Or,
771
- imageCommonPanelTitle: Pr,
772
- imageCommonPanelRow: Er,
773
- imageCommonPanelRowVertical: yr,
774
- imageCommonPanelColumn: Tr,
775
- imageCommonPanelColumnCenter: Ur,
776
- imageCommonPanelInline: Ar,
777
- imageCommonPanelSpan2: Nr,
778
- imageCommonPanelSpan3: jr,
779
- imageCommonPanelInput: Lr,
780
- sheetImageMenu: $r,
781
- sheetImageMenuInput: Br
782
- }, Wr = (r) => {
783
- var v;
784
- const e = q(B), n = q(pe), t = q(H), i = q(te), { drawings: s } = r, o = s[0];
798
+ const Ar = "univer-image-common-panel", Nr = "univer-image-common-panel-grid", jr = "univer-image-common-panel-border", Lr = "univer-image-common-panel-title", Wr = "univer-image-common-panel-row", Br = "univer-image-common-panel-row-vertical", $r = "univer-image-common-panel-column", Vr = "univer-image-common-panel-column-center", Yr = "univer-image-common-panel-inline", Gr = "univer-image-common-panel-span2", Xr = "univer-image-common-panel-span3", xr = "univer-image-common-panel-input", Fr = "univer-sheet-image-menu", Hr = "univer-sheet-image-menu-input", Z = {
799
+ imageCommonPanel: Ar,
800
+ imageCommonPanelGrid: Nr,
801
+ imageCommonPanelBorder: jr,
802
+ imageCommonPanelTitle: Lr,
803
+ imageCommonPanelRow: Wr,
804
+ imageCommonPanelRowVertical: Br,
805
+ imageCommonPanelColumn: $r,
806
+ imageCommonPanelColumnCenter: Vr,
807
+ imageCommonPanelInline: Yr,
808
+ imageCommonPanelSpan2: Gr,
809
+ imageCommonPanelSpan3: Xr,
810
+ imageCommonPanelInput: xr,
811
+ sheetImageMenu: Fr,
812
+ sheetImageMenuInput: Hr
813
+ }, kr = (i) => {
814
+ var S;
815
+ const e = ee(Y), n = ee(ve), t = ee(J), r = ee(te), { drawings: s } = i, o = s[0];
785
816
  if (o == null)
786
817
  return;
787
- const { unitId: a } = o, c = i.getRenderById(a), g = c == null ? void 0 : c.scene;
818
+ const { unitId: a } = o, d = r.getRenderById(a), g = d == null ? void 0 : d.scene;
788
819
  if (g == null)
789
820
  return;
790
- const l = g.getTransformerByCreate(), [d, m] = ke(!0), u = (v = o.anchorType) != null ? v : b.Position, [f, h] = ke(u);
791
- function p(R, _) {
792
- const M = [];
793
- return R.forEach((w) => {
794
- const { oKey: y } = w, D = _.getDrawingOKey(y);
795
- if (D == null)
796
- return M.push(null), !0;
797
- const { unitId: T, subUnitId: U, drawingId: E, drawingType: I, anchorType: A, sheetTransform: z } = D;
798
- M.push({
799
- unitId: T,
800
- subUnitId: U,
801
- drawingId: E,
821
+ const l = g.getTransformerByCreate(), [c, u] = rt(!0), h = (S = o.anchorType) != null ? S : E.Position, [f, m] = rt(h);
822
+ function p(D, _) {
823
+ const b = [];
824
+ return D.forEach((w) => {
825
+ const { oKey: U } = w, O = _.getDrawingOKey(U);
826
+ if (O == null)
827
+ return b.push(null), !0;
828
+ const { unitId: I, subUnitId: P, drawingId: M, drawingType: C, anchorType: A, sheetTransform: $ } = O;
829
+ b.push({
830
+ unitId: I,
831
+ subUnitId: P,
832
+ drawingId: M,
802
833
  anchorType: A,
803
- sheetTransform: z,
804
- drawingType: I
834
+ sheetTransform: $,
835
+ drawingType: C
805
836
  });
806
- }), M;
807
- }
808
- qe(() => {
809
- const R = l.clearControl$.subscribe((M) => {
810
- M === !0 && m(!1);
811
- }), _ = l.changeStart$.subscribe((M) => {
812
- var D;
813
- const { objects: w } = M, y = p(w, t);
814
- if (y.length === 0)
815
- m(!1);
816
- else if (y.length >= 1) {
817
- m(!0);
818
- const T = ((D = y[0]) == null ? void 0 : D.anchorType) || b.Position;
819
- h(T);
837
+ }), b;
838
+ }
839
+ st(() => {
840
+ const D = l.clearControl$.subscribe((b) => {
841
+ b === !0 && u(!1);
842
+ }), _ = l.changeStart$.subscribe((b) => {
843
+ var O;
844
+ const { objects: w } = b, U = p(w, t);
845
+ if (U.length === 0)
846
+ u(!1);
847
+ else if (U.length >= 1) {
848
+ u(!0);
849
+ const I = ((O = U[0]) == null ? void 0 : O.anchorType) || E.Position;
850
+ m(I);
820
851
  }
821
852
  });
822
853
  return () => {
823
- _.unsubscribe(), R.unsubscribe();
854
+ _.unsubscribe(), D.unsubscribe();
824
855
  };
825
856
  }, []);
826
- function S(R) {
827
- h(R);
857
+ function v(D) {
858
+ m(D);
828
859
  const _ = t.getFocusDrawings();
829
860
  if (_.length === 0)
830
861
  return;
831
- const M = _.map((w) => ({
862
+ const b = _.map((w) => ({
832
863
  unitId: w.unitId,
833
864
  subUnitId: w.subUnitId,
834
865
  drawingId: w.drawingId,
835
- anchorType: R
866
+ anchorType: D
836
867
  }));
837
- e.executeCommand(We.id, {
868
+ e.executeCommand(ke.id, {
838
869
  unitId: _[0].unitId,
839
- drawings: M
870
+ drawings: b
840
871
  });
841
872
  }
842
- const C = (R) => R ? "block" : "none";
843
- return /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelGrid, k.imageCommonPanelBorder), style: { display: C(d) } }, /* @__PURE__ */ L.createElement("div", { className: k.imageCommonPanelRow }, /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelColumn, k.imageCommonPanelTitle) }, /* @__PURE__ */ L.createElement("div", null, n.t("drawing-anchor.title")))), /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelRow) }, /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelColumn) }, /* @__PURE__ */ L.createElement(er, { value: f, onChange: S, direction: "vertical" }, /* @__PURE__ */ L.createElement(Fe, { value: b.Both }, n.t("drawing-anchor.both")), /* @__PURE__ */ L.createElement(Fe, { value: b.Position }, n.t("drawing-anchor.position")), /* @__PURE__ */ L.createElement(Fe, { value: b.None }, n.t("drawing-anchor.none"))))));
844
- }, Vr = () => {
845
- const r = q(H), e = r.getFocusDrawings(), [n, t] = ke(e);
846
- return qe(() => {
847
- const i = r.focus$.subscribe((s) => {
873
+ const R = (D) => D ? "block" : "none";
874
+ return /* @__PURE__ */ L.createElement("div", { className: Te(Z.imageCommonPanelGrid, Z.imageCommonPanelBorder), style: { display: R(c) } }, /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanelRow }, /* @__PURE__ */ L.createElement("div", { className: Te(Z.imageCommonPanelColumn, Z.imageCommonPanelTitle) }, /* @__PURE__ */ L.createElement("div", null, n.t("drawing-anchor.title")))), /* @__PURE__ */ L.createElement("div", { className: Te(Z.imageCommonPanelRow) }, /* @__PURE__ */ L.createElement("div", { className: Te(Z.imageCommonPanelColumn) }, /* @__PURE__ */ L.createElement(cr, { value: f, onChange: v, direction: "vertical" }, /* @__PURE__ */ L.createElement(Ze, { value: E.Both }, n.t("drawing-anchor.both")), /* @__PURE__ */ L.createElement(Ze, { value: E.Position }, n.t("drawing-anchor.position")), /* @__PURE__ */ L.createElement(Ze, { value: E.None }, n.t("drawing-anchor.none"))))));
875
+ }, zr = () => {
876
+ const i = ee(J), e = i.getFocusDrawings(), [n, t] = rt(e);
877
+ return st(() => {
878
+ const r = i.focus$.subscribe((s) => {
848
879
  t(s);
849
880
  });
850
881
  return () => {
851
- i.unsubscribe();
882
+ r.unsubscribe();
852
883
  };
853
- }, []), !!(n != null && n.length) && /* @__PURE__ */ L.createElement("div", { className: k.imageCommonPanel }, /* @__PURE__ */ L.createElement(mn, { drawings: n }), /* @__PURE__ */ L.createElement(Wr, { drawings: n }));
854
- }, we = {
884
+ }, []), !!(n != null && n.length) && /* @__PURE__ */ L.createElement("div", { className: Z.imageCommonPanel }, /* @__PURE__ */ L.createElement(_n, { drawings: n }), /* @__PURE__ */ L.createElement(kr, { drawings: n }));
885
+ }, Ce = {
855
886
  id: "sheet.command.move-drawing",
856
887
  type: G.COMMAND,
857
- handler: (r, e) => {
858
- const n = r.get(B), t = r.get(X), i = r.get($e), { direction: s } = e, o = t.getFocusDrawings();
888
+ handler: (i, e) => {
889
+ const n = i.get(Y), t = i.get(H), r = i.get(Se), { direction: s } = e, o = t.getFocusDrawings();
859
890
  if (o.length === 0)
860
891
  return !1;
861
- const a = o[0].unitId, c = o.map((l) => {
862
- const { transform: d } = l;
863
- if (d == null)
892
+ const a = o[0].unitId, d = o.map((l) => {
893
+ const { transform: c } = l;
894
+ if (c == null)
864
895
  return null;
865
- const m = { ...d }, { left: u = 0, top: f = 0 } = d;
866
- return s === J.UP ? m.top = f - 1 : s === J.DOWN ? m.top = f + 1 : s === J.LEFT ? m.left = u - 1 : s === J.RIGHT && (m.left = u + 1), {
896
+ const u = { ...c }, { left: h = 0, top: f = 0 } = c;
897
+ return s === q.UP ? u.top = f - 1 : s === q.DOWN ? u.top = f + 1 : s === q.LEFT ? u.left = h - 1 : s === q.RIGHT && (u.left = h + 1), {
867
898
  ...l,
868
- transform: m,
869
- sheetTransform: N(m, i)
899
+ transform: u,
900
+ sheetTransform: N(u, r)
870
901
  };
871
902
  }).filter((l) => l != null);
872
- return n.syncExecuteCommand(We.id, {
903
+ return n.syncExecuteCommand(ke.id, {
873
904
  unitId: a,
874
- drawings: c
905
+ drawings: d
875
906
  }) ? (n.syncExecuteCommand(j.id, [a]), !0) : !1;
876
907
  }
877
- }, Ht = {
908
+ }, Zt = {
878
909
  id: "sheet.command.delete-drawing",
879
910
  type: G.COMMAND,
880
- handler: (r) => {
881
- const e = r.get(B), t = r.get(X).getFocusDrawings();
911
+ handler: (i) => {
912
+ const e = i.get(Y), t = i.get(H).getFocusDrawings();
882
913
  if (t.length === 0)
883
914
  return !1;
884
- const i = t[0].unitId, s = t.map((o) => {
885
- const { unitId: a, subUnitId: c, drawingId: g, drawingType: l } = o;
915
+ const r = t[0].unitId, s = t.map((o) => {
916
+ const { unitId: a, subUnitId: d, drawingId: g, drawingType: l } = o;
886
917
  return {
887
918
  unitId: a,
888
- subUnitId: c,
919
+ subUnitId: d,
889
920
  drawingId: g,
890
921
  drawingType: l
891
922
  };
892
923
  });
893
- return e.executeCommand(Qe.id, {
894
- unitId: i,
924
+ return e.executeCommand(ot.id, {
925
+ unitId: r,
895
926
  drawings: s
896
927
  });
897
928
  }
898
929
  };
899
- function _e(r) {
900
- return !r.getContextValue(Qt) && !r.getContextValue(en) && r.getContextValue(fe);
930
+ function Re(i) {
931
+ return !i.getContextValue(on) && !i.getContextValue(an) && i.getContextValue(we);
901
932
  }
902
- const Gr = {
903
- id: we.id,
933
+ const Kr = {
934
+ id: Ce.id,
904
935
  description: "shortcut.sheet.drawing-move-down",
905
936
  group: "4_sheet-drawing-view",
906
- binding: oe.ARROW_DOWN,
937
+ binding: ue.ARROW_DOWN,
907
938
  priority: 100,
908
- preconditions: _e,
939
+ preconditions: Re,
909
940
  staticParameters: {
910
- direction: J.DOWN
941
+ direction: q.DOWN
911
942
  }
912
- }, xr = {
913
- id: we.id,
943
+ }, Jr = {
944
+ id: Ce.id,
914
945
  description: "shortcut.sheet.drawing-move-up",
915
946
  group: "4_sheet-drawing-view",
916
- binding: oe.ARROW_UP,
947
+ binding: ue.ARROW_UP,
917
948
  priority: 100,
918
- preconditions: _e,
949
+ preconditions: Re,
919
950
  staticParameters: {
920
- direction: J.UP
951
+ direction: q.UP
921
952
  }
922
- }, Fr = {
923
- id: we.id,
953
+ }, Zr = {
954
+ id: Ce.id,
924
955
  description: "shortcut.sheet.drawing-move-left",
925
956
  group: "4_sheet-drawing-view",
926
- binding: oe.ARROW_LEFT,
957
+ binding: ue.ARROW_LEFT,
927
958
  priority: 100,
928
- preconditions: _e,
959
+ preconditions: Re,
929
960
  staticParameters: {
930
- direction: J.LEFT
961
+ direction: q.LEFT
931
962
  }
932
- }, Yr = {
933
- id: we.id,
963
+ }, qr = {
964
+ id: Ce.id,
934
965
  description: "shortcut.sheet.drawing-move-right",
935
966
  group: "4_sheet-drawing-view",
936
- binding: oe.ARROW_RIGHT,
967
+ binding: ue.ARROW_RIGHT,
937
968
  priority: 100,
938
- preconditions: _e,
969
+ preconditions: Re,
939
970
  staticParameters: {
940
- direction: J.RIGHT
971
+ direction: q.RIGHT
941
972
  }
942
- }, Xr = {
943
- id: Ht.id,
973
+ }, Qr = {
974
+ id: Zt.id,
944
975
  description: "shortcut.sheet.drawing-delete",
945
976
  group: "4_sheet-drawing-view",
946
977
  // when focusing on any other input tag do not trigger this shortcut
947
- preconditions: _e,
948
- binding: oe.DELETE,
949
- mac: oe.BACKSPACE
978
+ preconditions: Re,
979
+ binding: ue.DELETE,
980
+ mac: ue.BACKSPACE
950
981
  };
951
- var Hr = Object.defineProperty, zr = Object.getOwnPropertyDescriptor, Kr = (r, e, n, t) => {
952
- for (var i = t > 1 ? void 0 : t ? zr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
953
- (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
954
- return t && i && Hr(e, n, i), i;
955
- }, me = (r, e) => (n, t) => e(n, t, r);
956
- const kr = {};
957
- let he = class extends ue {
958
- constructor(r, e, n, t, i, s) {
959
- super(), this._config = r, this._injector = e, this._componentManager = n, this._menuService = t, this._commandService = i, this._shortcutService = s, this._init();
982
+ var ei = Object.defineProperty, ti = Object.getOwnPropertyDescriptor, ni = (i, e, n, t) => {
983
+ for (var r = t > 1 ? void 0 : t ? ti(e, n) : e, s = i.length - 1, o; s >= 0; s--)
984
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
985
+ return t && r && ei(e, n, r), r;
986
+ }, me = (i, e) => (n, t) => e(n, t, i);
987
+ const ri = {};
988
+ let pe = class extends de {
989
+ constructor(i, e, n, t, r, s) {
990
+ super(), this._config = i, this._injector = e, this._componentManager = n, this._menuService = t, this._commandService = r, this._shortcutService = s, this._init();
960
991
  }
961
992
  _initCustomComponents() {
962
- const r = this._componentManager;
963
- this.disposeWithMe(r.register(Yt, xt)), this.disposeWithMe(r.register(Ft, Ir)), this.disposeWithMe(r.register(Nt, Vr));
993
+ const i = this._componentManager;
994
+ this.disposeWithMe(i.register(Kt, kt)), this.disposeWithMe(i.register(zt, Tr)), this.disposeWithMe(i.register($t, zr));
964
995
  }
965
996
  _initMenus() {
966
- const { menu: r = {} } = this._config;
997
+ const { menu: i = {} } = this._config;
967
998
  [
968
- Rr,
969
- Dr
999
+ Pr,
1000
+ Ur
970
1001
  // UploadCellImageMenuFactory,
971
1002
  ].forEach((e) => {
972
- this._menuService.addMenuItem(e(this._injector), r);
1003
+ this._menuService.addMenuItem(e(this._injector), i);
973
1004
  });
974
1005
  }
975
1006
  _initCommands() {
976
1007
  [
977
- Be,
978
- Ae,
979
- et,
980
- Qe,
981
- We,
982
- jt,
1008
+ He,
1009
+ Ye,
1010
+ at,
1011
+ ot,
1012
+ ke,
1013
+ Vt,
983
1014
  j,
984
- Lt,
985
- Bt,
986
- Wt,
987
- we,
988
- Ht,
989
- $t
990
- ].forEach((r) => this.disposeWithMe(this._commandService.registerCommand(r)));
1015
+ Yt,
1016
+ Xt,
1017
+ xt,
1018
+ Ce,
1019
+ Zt,
1020
+ Gt
1021
+ ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
991
1022
  }
992
1023
  _initShortcuts() {
993
1024
  [
994
1025
  // sheet drawing shortcuts
995
- Gr,
996
- xr,
997
- Fr,
998
- Yr,
999
- Xr
1000
- ].forEach((r) => {
1001
- this.disposeWithMe(this._shortcutService.registerShortcut(r));
1026
+ Kr,
1027
+ Jr,
1028
+ Zr,
1029
+ qr,
1030
+ Qr
1031
+ ].forEach((i) => {
1032
+ this.disposeWithMe(this._shortcutService.registerShortcut(i));
1002
1033
  });
1003
1034
  }
1004
1035
  _init() {
1005
1036
  this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
1006
1037
  }
1007
1038
  };
1008
- he = Kr([
1009
- de(le.Rendered, he),
1010
- me(1, $(Ze)),
1011
- me(2, $(Bn)),
1012
- me(3, Wn),
1013
- me(4, B),
1014
- me(5, Vn)
1015
- ], he);
1016
- var Jr = Object.defineProperty, Zr = Object.getOwnPropertyDescriptor, qr = (r, e, n, t) => {
1017
- for (var i = t > 1 ? void 0 : t ? Zr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
1018
- (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
1019
- return t && i && Jr(e, n, i), i;
1020
- }, re = (r, e) => (n, t) => e(n, t, r);
1021
- const Qr = [
1022
- wt.id,
1023
- _t.id,
1024
- vt.id,
1025
- St.id,
1039
+ pe = ni([
1040
+ ae(ce.Rendered, pe),
1041
+ me(1, W(xe)),
1042
+ me(2, W(Hn)),
1043
+ me(3, kn),
1044
+ me(4, Y),
1045
+ me(5, zn)
1046
+ ], pe);
1047
+ var ii = Object.defineProperty, si = Object.getOwnPropertyDescriptor, oi = (i, e, n, t) => {
1048
+ for (var r = t > 1 ? void 0 : t ? si(e, n) : e, s = i.length - 1, o; s >= 0; s--)
1049
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
1050
+ return t && r && ii(e, n, r), r;
1051
+ }, re = (i, e) => (n, t) => e(n, t, i);
1052
+ const ai = [
1026
1053
  Ct.id,
1027
- It.id,
1028
1054
  Rt.id,
1055
+ It.id,
1029
1056
  Dt.id,
1030
- ze.id,
1031
- Ke.id,
1032
1057
  Mt.id,
1033
1058
  bt.id,
1034
1059
  Ot.id,
1035
- Pt.id,
1036
1060
  Et.id,
1037
- yt.id
1038
- ], ei = [
1039
- Xn.id,
1040
- Hn.id,
1041
- zn.id,
1042
- Kn.id,
1043
- kn.id,
1044
- Jn.id
1061
+ tt.id,
1062
+ nt.id,
1063
+ yt.id,
1064
+ Tt.id,
1065
+ Pt.id,
1066
+ Ut.id,
1067
+ At.id,
1068
+ Nt.id,
1069
+ jt.id
1070
+ ], ci = [
1071
+ Qn.id,
1072
+ er.id,
1073
+ tr.id,
1074
+ nr.id,
1075
+ rr.id,
1076
+ ir.id
1045
1077
  ];
1046
- let ye = class extends ue {
1047
- constructor(r, e, n, t, i, s) {
1048
- super(), this._commandService = r, this._sheetInterceptorService = e, this._sheetDrawingService = n, this._drawingManagerService = t, this._selectionRenderService = i, this._univerInstanceService = s, this._init();
1078
+ let We = class extends de {
1079
+ constructor(i, e, n, t, r, s, o, a) {
1080
+ super(), this._context = i, this._commandService = e, this._sheetInterceptorService = n, this._sheetDrawingService = t, this._drawingManagerService = r, this._selectionRenderService = s, this._univerInstanceService = o, this._sheetSkeletonManagerService = a, this._init();
1049
1081
  }
1050
1082
  _init() {
1051
1083
  this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
@@ -1053,321 +1085,323 @@ let ye = class extends ue {
1053
1085
  _sheetInterceptorListener() {
1054
1086
  this.disposeWithMe(
1055
1087
  this._sheetInterceptorService.interceptCommand({
1056
- getMutations: (r) => {
1057
- if (!Qr.includes(r.id))
1088
+ getMutations: (i) => {
1089
+ if (!ai.includes(i.id))
1058
1090
  return { redos: [], undos: [] };
1059
- if (r.params == null)
1091
+ if (i.params == null)
1060
1092
  return { redos: [], undos: [] };
1061
- const e = r.id;
1062
- if (e === wt.id)
1063
- return this._moveRowInterceptor(r.params, "insert");
1064
- if (e === _t.id)
1065
- return this._moveColInterceptor(r.params, "insert");
1066
- if (e === vt.id)
1067
- return this._moveRowInterceptor(r.params, "remove");
1068
- if (e === St.id)
1069
- return this._moveColInterceptor(r.params, "remove");
1070
- if (e === Ct.id) {
1071
- const { range: n } = r.params;
1093
+ const e = i.id;
1094
+ if (e === Ct.id)
1095
+ return this._moveRowInterceptor(i.params, "insert");
1096
+ if (e === Rt.id)
1097
+ return this._moveColInterceptor(i.params, "insert");
1098
+ if (e === It.id)
1099
+ return this._moveRowInterceptor(i.params, "remove");
1100
+ if (e === Dt.id)
1101
+ return this._moveColInterceptor(i.params, "remove");
1102
+ if (e === jt.id)
1103
+ return this._moveRangeInterceptor(i.params);
1104
+ if (e === Mt.id) {
1105
+ const { range: n } = i.params;
1072
1106
  return this._getRangeMoveUndo(
1073
1107
  n,
1074
1108
  0
1075
1109
  /* deleteLeft */
1076
1110
  );
1077
- } else if (e === It.id) {
1078
- const { range: n } = r.params;
1111
+ } else if (e === bt.id) {
1112
+ const { range: n } = i.params;
1079
1113
  return this._getRangeMoveUndo(
1080
1114
  n,
1081
1115
  1
1082
1116
  /* deleteUp */
1083
1117
  );
1084
- } else if (e === Rt.id) {
1085
- const { range: n } = r.params;
1118
+ } else if (e === Ot.id) {
1119
+ const { range: n } = i.params;
1086
1120
  return this._getRangeMoveUndo(
1087
1121
  n,
1088
1122
  2
1089
1123
  /* insertDown */
1090
1124
  );
1091
- } else if (e === Dt.id) {
1092
- const { range: n } = r.params;
1125
+ } else if (e === Et.id) {
1126
+ const { range: n } = i.params;
1093
1127
  return this._getRangeMoveUndo(
1094
1128
  n,
1095
1129
  3
1096
1130
  /* insertRight */
1097
1131
  );
1098
- } else if (e === Ot.id || e === Pt.id) {
1099
- const n = r.params, { unitId: t, subUnitId: i, ranges: s } = n;
1100
- return this._getDrawingUndoForRowVisible(t, i, s);
1101
- } else if (e === Et.id || e === yt.id) {
1102
- const n = r.params, { unitId: t, subUnitId: i, ranges: s } = n;
1103
- return this._getDrawingUndoForColVisible(t, i, s);
1104
- } else if (e === ze.id || e === Ke.id || e === Mt.id || e === bt.id) {
1105
- const n = r.params, { unitId: t, subUnitId: i, ranges: s } = n, o = e === ze.id || e === Ke.id;
1106
- return this._getDrawingUndoForRowAndColSize(t, i, s, o);
1132
+ } else if (e === Pt.id || e === Ut.id) {
1133
+ const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
1134
+ return this._getDrawingUndoForRowVisible(t, r, s);
1135
+ } else if (e === At.id || e === Nt.id) {
1136
+ const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
1137
+ return this._getDrawingUndoForColVisible(t, r, s);
1138
+ } else if (e === tt.id || e === nt.id || e === yt.id || e === Tt.id) {
1139
+ const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e === tt.id || e === nt.id;
1140
+ return this._getDrawingUndoForRowAndColSize(t, r, s, o);
1107
1141
  }
1108
1142
  return { redos: [], undos: [] };
1109
1143
  }
1110
1144
  })
1111
1145
  );
1112
1146
  }
1113
- _getRangeMoveUndo(r, e) {
1114
- const n = se(this._univerInstanceService);
1147
+ _getRangeMoveUndo(i, e) {
1148
+ const n = oe(this._univerInstanceService);
1115
1149
  if (n == null)
1116
1150
  return { redos: [], undos: [] };
1117
- const t = n.unitId, i = n.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(t, i), c = [], g = [];
1151
+ const t = n.unitId, r = n.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(t, r), d = [], g = [];
1118
1152
  if (Object.keys(a).forEach((l) => {
1119
- const d = a[l], { updateDrawings: m, deleteDrawings: u } = this._getUpdateOrDeleteDrawings(r, e, d);
1120
- c.push(...m), g.push(...u);
1121
- }), c.length === 0 && g.length === 0)
1153
+ const c = a[l], { updateDrawings: u, deleteDrawings: h } = this._getUpdateOrDeleteDrawings(i, e, c);
1154
+ d.push(...u), g.push(...h);
1155
+ }), d.length === 0 && g.length === 0)
1122
1156
  return { redos: [], undos: [] };
1123
- if (c.length > 0) {
1124
- const l = this._sheetDrawingService.getBatchUpdateOp(c), { undo: d, redo: m, objects: u } = l;
1125
- s.push({ id: O.id, params: { unitId: t, subUnitId: i, op: m, objects: u, type: P.UPDATE } }), o.push({ id: O.id, params: { unitId: t, subUnitId: i, op: d, objects: u, type: P.UPDATE } });
1157
+ if (d.length > 0) {
1158
+ const l = this._sheetDrawingService.getBatchUpdateOp(d), { undo: c, redo: u, objects: h } = l;
1159
+ s.push({ id: y.id, params: { unitId: t, subUnitId: r, op: u, objects: h, type: T.UPDATE } }), o.push({ id: y.id, params: { unitId: t, subUnitId: r, op: c, objects: h, type: T.UPDATE } });
1126
1160
  }
1127
1161
  if (g.length > 0) {
1128
- const l = this._sheetDrawingService.getBatchRemoveOp(g), d = l.undo, m = l.redo, u = l.objects;
1129
- s.push({ id: O.id, params: { unitId: t, subUnitId: i, op: m, objects: u, type: P.REMOVE } }), o.push({ id: O.id, params: { unitId: t, subUnitId: i, op: d, objects: u, type: P.INSERT } });
1162
+ const l = this._sheetDrawingService.getBatchRemoveOp(g), c = l.undo, u = l.redo, h = l.objects;
1163
+ s.push({ id: y.id, params: { unitId: t, subUnitId: r, op: u, objects: h, type: T.REMOVE } }), o.push({ id: y.id, params: { unitId: t, subUnitId: r, op: c, objects: h, type: T.INSERT } });
1130
1164
  }
1131
1165
  return s.push({ id: j.id, params: [t] }), o.push({ id: j.id, params: [t] }), {
1132
1166
  redos: s,
1133
1167
  undos: o
1134
1168
  };
1135
1169
  }
1136
- _getUpdateOrDeleteDrawings(r, e, n) {
1137
- const t = [], i = [], { sheetTransform: s, anchorType: o = b.Position, transform: a, unitId: c, subUnitId: g, drawingId: l } = n, { from: d, to: m } = s, { row: u, column: f } = d, { row: h, column: p } = m;
1170
+ _getUpdateOrDeleteDrawings(i, e, n) {
1171
+ const t = [], r = [], { sheetTransform: s, anchorType: o = E.Position, transform: a, unitId: d, subUnitId: g, drawingId: l } = n, { from: c, to: u } = s, { row: h, column: f } = c, { row: m, column: p } = u;
1138
1172
  if (s == null || a == null)
1139
1173
  return {
1140
1174
  updateDrawings: t,
1141
- deleteDrawings: i
1175
+ deleteDrawings: r
1142
1176
  };
1143
- const { startRow: S, endRow: C, startColumn: v, endColumn: R } = r;
1144
- let _ = null, M = null;
1145
- if (e === 0 && u >= S && h <= C)
1146
- if (f >= v && p <= R)
1147
- i.push({ unitId: c, subUnitId: g, drawingId: l });
1177
+ const { startRow: v, endRow: R, startColumn: S, endColumn: D } = i;
1178
+ let _ = null, b = null;
1179
+ if (e === 0 && h >= v && m <= R)
1180
+ if (f >= S && p <= D)
1181
+ r.push({ unitId: d, subUnitId: g, drawingId: l });
1148
1182
  else {
1149
- const w = this._shrinkCol(s, a, v, R, o);
1150
- _ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
1183
+ const w = this._shrinkCol(s, a, S, D, o);
1184
+ _ = w == null ? void 0 : w.newSheetTransform, b = w == null ? void 0 : w.newTransform;
1151
1185
  }
1152
- else if (e === 1 && f >= v && p <= R)
1153
- if (u >= S && h <= C)
1154
- i.push({ unitId: c, subUnitId: g, drawingId: l });
1186
+ else if (e === 1 && f >= S && p <= D)
1187
+ if (h >= v && m <= R)
1188
+ r.push({ unitId: d, subUnitId: g, drawingId: l });
1155
1189
  else {
1156
- const w = this._shrinkRow(s, a, S, C, o);
1157
- _ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
1190
+ const w = this._shrinkRow(s, a, v, R, o);
1191
+ _ = w == null ? void 0 : w.newSheetTransform, b = w == null ? void 0 : w.newTransform;
1158
1192
  }
1159
1193
  else if (e === 2) {
1160
- const w = this._expandRow(s, a, S, C, o);
1161
- _ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
1194
+ const w = this._expandRow(s, a, v, R, o);
1195
+ _ = w == null ? void 0 : w.newSheetTransform, b = w == null ? void 0 : w.newTransform;
1162
1196
  } else if (e === 3) {
1163
- const w = this._expandCol(s, a, v, R, o);
1164
- _ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
1197
+ const w = this._expandCol(s, a, S, D, o);
1198
+ _ = w == null ? void 0 : w.newSheetTransform, b = w == null ? void 0 : w.newTransform;
1165
1199
  }
1166
- if (_ != null && M != null) {
1167
- const w = V(_, this._selectionRenderService);
1200
+ if (_ != null && b != null) {
1201
+ const w = V(_, this._selectionRenderService, this._sheetSkeletonManagerService);
1168
1202
  t.push({ ...n, sheetTransform: _, transform: w });
1169
1203
  }
1170
- return { updateDrawings: t, deleteDrawings: i };
1204
+ return { updateDrawings: t, deleteDrawings: r };
1171
1205
  }
1172
- _remainDrawingSize(r, e, n) {
1173
- const t = N({ ...r }, this._selectionRenderService);
1206
+ _remainDrawingSize(i, e, n) {
1207
+ const t = N({ ...i }, this._selectionRenderService);
1174
1208
  t != null && e.push({
1175
1209
  ...n,
1176
1210
  sheetTransform: t
1177
1211
  });
1178
1212
  }
1179
1213
  // eslint-disable-next-line max-lines-per-function
1180
- _getDrawingUndoForColVisible(r, e, n) {
1181
- const t = this._drawingManagerService.getDrawingData(r, e), i = [], s = [];
1214
+ _getDrawingUndoForColVisible(i, e, n) {
1215
+ const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
1182
1216
  if (Object.keys(t).forEach((l) => {
1183
- const d = t[l], { sheetTransform: m, transform: u, anchorType: f = b.Position } = d;
1184
- if (f === b.None)
1185
- this._remainDrawingSize(u, i, d);
1217
+ const c = t[l], { sheetTransform: u, transform: h, anchorType: f = E.Position } = c;
1218
+ if (f === E.None)
1219
+ this._remainDrawingSize(h, r, c);
1186
1220
  else {
1187
- const { from: h, to: p } = m, { row: S, column: C } = h, { row: v, column: R } = p;
1221
+ const { from: m, to: p } = u, { row: v, column: R } = m, { row: S, column: D } = p;
1188
1222
  for (let _ = 0; _ < n.length; _++) {
1189
- const M = n[_], { startRow: w, endRow: y, startColumn: D, endColumn: T } = M;
1190
- if (R < D)
1223
+ const b = n[_], { startRow: w, endRow: U, startColumn: O, endColumn: I } = b;
1224
+ if (D < O)
1191
1225
  continue;
1192
- if (f === b.Position) {
1193
- let I = null, A = null;
1194
- if (C >= D && C <= T) {
1195
- const z = this._selectionRenderService.attachRangeWithCoord({ startColumn: C, endColumn: T, startRow: h.row, endRow: p.row });
1196
- if (z == null)
1226
+ if (f === E.Position) {
1227
+ let C = null, A = null;
1228
+ if (R >= O && R <= I) {
1229
+ const $ = this._selectionRenderService.attachRangeWithCoord({ startColumn: R, endColumn: I, startRow: m.row, endRow: p.row });
1230
+ if ($ == null)
1197
1231
  return;
1198
- A = { ...u, left: z.startX };
1232
+ A = { ...h, left: $.startX };
1199
1233
  }
1200
- if (A != null && (I = N(A, this._selectionRenderService), I != null && A != null)) {
1201
- i.push({ ...d, sheetTransform: I, transform: A });
1234
+ if (A != null && (C = N(A, this._selectionRenderService), C != null && A != null)) {
1235
+ r.push({ ...c, sheetTransform: C, transform: A });
1202
1236
  break;
1203
1237
  }
1204
- this._remainDrawingSize(u, i, d);
1238
+ this._remainDrawingSize(h, r, c);
1205
1239
  continue;
1206
1240
  }
1207
- if (C >= D && R <= T)
1241
+ if (R >= O && D <= I)
1208
1242
  continue;
1209
- let U = null, E = null;
1210
- if (C >= D && C <= T) {
1211
- const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: C, endColumn: T, startRow: h.row, endRow: p.row });
1212
- if (I == null)
1243
+ let P = null, M = null;
1244
+ if (R >= O && R <= I) {
1245
+ const C = this._selectionRenderService.attachRangeWithCoord({ startColumn: R, endColumn: I, startRow: m.row, endRow: p.row });
1246
+ if (C == null)
1213
1247
  return;
1214
- E = {
1215
- ...u,
1216
- left: (I == null ? void 0 : I.startX) || 0,
1217
- width: ((u == null ? void 0 : u.width) || 0) - I.endX + I.startX
1248
+ M = {
1249
+ ...h,
1250
+ left: (C == null ? void 0 : C.startX) || 0,
1251
+ width: ((h == null ? void 0 : h.width) || 0) - C.endX + C.startX
1218
1252
  };
1219
- } else if (R >= D && R <= T) {
1220
- const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: D, endColumn: R, startRow: h.row, endRow: p.row });
1221
- if (I == null)
1253
+ } else if (D >= O && D <= I) {
1254
+ const C = this._selectionRenderService.attachRangeWithCoord({ startColumn: O, endColumn: D, startRow: m.row, endRow: p.row });
1255
+ if (C == null)
1222
1256
  return;
1223
- E = {
1224
- ...u,
1225
- left: I.startX - ((u == null ? void 0 : u.width) || 0)
1257
+ M = {
1258
+ ...h,
1259
+ left: C.startX - ((h == null ? void 0 : h.width) || 0)
1226
1260
  };
1227
1261
  } else {
1228
- const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: D, endColumn: T, startRow: h.row, endRow: p.row });
1229
- if (I == null)
1262
+ const C = this._selectionRenderService.attachRangeWithCoord({ startColumn: O, endColumn: I, startRow: m.row, endRow: p.row });
1263
+ if (C == null)
1230
1264
  return;
1231
- if (E = {
1232
- ...u,
1233
- width: ((u == null ? void 0 : u.width) || 0) - I.endX + I.startX
1234
- }, U = N(E, this._selectionRenderService), U != null && E != null) {
1235
- s.push({ ...d, sheetTransform: U, transform: E });
1265
+ if (M = {
1266
+ ...h,
1267
+ width: ((h == null ? void 0 : h.width) || 0) - C.endX + C.startX
1268
+ }, P = N(M, this._selectionRenderService), P != null && M != null) {
1269
+ s.push({ ...c, sheetTransform: P, transform: M });
1236
1270
  break;
1237
1271
  }
1238
1272
  }
1239
- if (E != null && (U = N(E, this._selectionRenderService)), E != null && U != null) {
1240
- i.push({ ...d, sheetTransform: U, transform: E });
1273
+ if (M != null && (P = N(M, this._selectionRenderService)), M != null && P != null) {
1274
+ r.push({ ...c, sheetTransform: P, transform: M });
1241
1275
  break;
1242
1276
  } else
1243
- this._remainDrawingSize(u, i, d);
1277
+ this._remainDrawingSize(h, r, c);
1244
1278
  }
1245
1279
  }
1246
- }), i.length === 0 && s.length === 0)
1280
+ }), r.length === 0 && s.length === 0)
1247
1281
  return { redos: [], undos: [] };
1248
- const { redos: o, undos: a } = this._createUndoAndRedoMutation(r, e, i), c = [], g = [];
1282
+ const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, e, r), d = [], g = [];
1249
1283
  if (s.length > 0) {
1250
- const { redos: l, undos: d } = this._createUndoAndRedoMutation(r, e, s);
1251
- c.push(...l), g.push(...d);
1284
+ const { redos: l, undos: c } = this._createUndoAndRedoMutation(i, e, s);
1285
+ d.push(...l), g.push(...c);
1252
1286
  }
1253
1287
  return {
1254
1288
  redos: o,
1255
1289
  undos: a,
1256
- preRedos: c,
1290
+ preRedos: d,
1257
1291
  preUndos: g
1258
1292
  };
1259
1293
  }
1260
- _createUndoAndRedoMutation(r, e, n) {
1261
- const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: i, redo: s, objects: o } = t, a = [
1262
- { id: O.id, params: { unitId: r, subUnitId: e, op: s, objects: o, type: P.UPDATE } },
1263
- { id: j.id, params: [r] }
1264
- ], c = [
1265
- { id: O.id, params: { unitId: r, subUnitId: e, op: i, objects: o, type: P.UPDATE } },
1266
- { id: j.id, params: [r] }
1294
+ _createUndoAndRedoMutation(i, e, n) {
1295
+ const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: r, redo: s, objects: o } = t, a = [
1296
+ { id: y.id, params: { unitId: i, subUnitId: e, op: s, objects: o, type: T.UPDATE } },
1297
+ { id: j.id, params: [i] }
1298
+ ], d = [
1299
+ { id: y.id, params: { unitId: i, subUnitId: e, op: r, objects: o, type: T.UPDATE } },
1300
+ { id: j.id, params: [i] }
1267
1301
  ];
1268
1302
  return {
1269
1303
  redos: a,
1270
- undos: c
1304
+ undos: d
1271
1305
  };
1272
1306
  }
1273
1307
  // eslint-disable-next-line max-lines-per-function
1274
- _getDrawingUndoForRowVisible(r, e, n) {
1275
- const t = this._drawingManagerService.getDrawingData(r, e), i = [], s = [];
1308
+ _getDrawingUndoForRowVisible(i, e, n) {
1309
+ const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
1276
1310
  if (Object.keys(t).forEach((l) => {
1277
- const d = t[l], { sheetTransform: m, transform: u, anchorType: f = b.Position } = d;
1278
- if (f === b.None)
1279
- this._remainDrawingSize(u, i, d);
1311
+ const c = t[l], { sheetTransform: u, transform: h, anchorType: f = E.Position } = c;
1312
+ if (f === E.None)
1313
+ this._remainDrawingSize(h, r, c);
1280
1314
  else {
1281
- const { from: h, to: p } = m, { row: S, column: C } = h, { row: v, column: R } = p;
1315
+ const { from: m, to: p } = u, { row: v, column: R } = m, { row: S, column: D } = p;
1282
1316
  for (let _ = 0; _ < n.length; _++) {
1283
- const M = n[_], { startRow: w, endRow: y, startColumn: D, endColumn: T } = M;
1284
- if (v < w)
1317
+ const b = n[_], { startRow: w, endRow: U, startColumn: O, endColumn: I } = b;
1318
+ if (S < w)
1285
1319
  continue;
1286
- if (f === b.Position) {
1287
- let I = null, A = null;
1288
- if (S >= w && S <= y) {
1289
- const z = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: S, endRow: y });
1290
- if (z == null)
1320
+ if (f === E.Position) {
1321
+ let C = null, A = null;
1322
+ if (v >= w && v <= U) {
1323
+ const $ = this._selectionRenderService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: v, endRow: U });
1324
+ if ($ == null)
1291
1325
  return;
1292
- A = { ...u, top: z.startY };
1326
+ A = { ...h, top: $.startY };
1293
1327
  }
1294
- if (A != null && (I = N(A, this._selectionRenderService), I != null && A != null)) {
1295
- i.push({ ...d, sheetTransform: I, transform: A });
1328
+ if (A != null && (C = N(A, this._selectionRenderService), C != null && A != null)) {
1329
+ r.push({ ...c, sheetTransform: C, transform: A });
1296
1330
  break;
1297
1331
  }
1298
- this._remainDrawingSize(u, i, d);
1332
+ this._remainDrawingSize(h, r, c);
1299
1333
  continue;
1300
1334
  }
1301
- if (S >= w && v <= y)
1335
+ if (v >= w && S <= U)
1302
1336
  continue;
1303
- let U = null, E = null;
1304
- if (S >= w && S <= y) {
1305
- const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: S, endRow: y });
1306
- if (I == null)
1337
+ let P = null, M = null;
1338
+ if (v >= w && v <= U) {
1339
+ const C = this._selectionRenderService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: v, endRow: U });
1340
+ if (C == null)
1307
1341
  return;
1308
- E = {
1309
- ...u,
1310
- top: (I == null ? void 0 : I.startY) || 0,
1311
- height: ((u == null ? void 0 : u.height) || 0) - I.endY + I.startY
1342
+ M = {
1343
+ ...h,
1344
+ top: (C == null ? void 0 : C.startY) || 0,
1345
+ height: ((h == null ? void 0 : h.height) || 0) - C.endY + C.startY
1312
1346
  };
1313
- } else if (v >= w && v <= y) {
1314
- const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: w, endRow: v });
1315
- if (I == null)
1347
+ } else if (S >= w && S <= U) {
1348
+ const C = this._selectionRenderService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow: S });
1349
+ if (C == null)
1316
1350
  return;
1317
- E = {
1318
- ...u,
1319
- top: I.startY - ((u == null ? void 0 : u.height) || 0)
1351
+ M = {
1352
+ ...h,
1353
+ top: C.startY - ((h == null ? void 0 : h.height) || 0)
1320
1354
  };
1321
1355
  } else {
1322
- const I = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: w, endRow: y });
1323
- if (I == null)
1356
+ const C = this._selectionRenderService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow: U });
1357
+ if (C == null)
1324
1358
  return;
1325
- if (E = {
1326
- ...u,
1327
- height: ((u == null ? void 0 : u.height) || 0) - I.endY + I.startY
1328
- }, U = N(E, this._selectionRenderService), U != null && E != null) {
1329
- s.push({ ...d, sheetTransform: U, transform: E });
1359
+ if (M = {
1360
+ ...h,
1361
+ height: ((h == null ? void 0 : h.height) || 0) - C.endY + C.startY
1362
+ }, P = N(M, this._selectionRenderService), P != null && M != null) {
1363
+ s.push({ ...c, sheetTransform: P, transform: M });
1330
1364
  break;
1331
1365
  }
1332
1366
  }
1333
- if (E != null && (U = N(E, this._selectionRenderService)), E != null && U != null) {
1334
- i.push({ ...d, sheetTransform: U, transform: E });
1367
+ if (M != null && (P = N(M, this._selectionRenderService)), M != null && P != null) {
1368
+ r.push({ ...c, sheetTransform: P, transform: M });
1335
1369
  break;
1336
1370
  } else
1337
- this._remainDrawingSize(u, i, d);
1371
+ this._remainDrawingSize(h, r, c);
1338
1372
  }
1339
1373
  }
1340
- }), i.length === 0 && s.length === 0)
1374
+ }), r.length === 0 && s.length === 0)
1341
1375
  return { redos: [], undos: [] };
1342
- const { redos: o, undos: a } = this._createUndoAndRedoMutation(r, e, i), c = [], g = [];
1376
+ const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, e, r), d = [], g = [];
1343
1377
  if (s.length > 0) {
1344
- const { redos: l, undos: d } = this._createUndoAndRedoMutation(r, e, s);
1345
- c.push(...l), g.push(...d);
1378
+ const { redos: l, undos: c } = this._createUndoAndRedoMutation(i, e, s);
1379
+ d.push(...l), g.push(...c);
1346
1380
  }
1347
1381
  return {
1348
1382
  redos: o,
1349
1383
  undos: a,
1350
- preRedos: c,
1384
+ preRedos: d,
1351
1385
  preUndos: g
1352
1386
  };
1353
1387
  }
1354
- _getDrawingUndoForRowAndColSize(r, e, n, t) {
1355
- const i = this._drawingManagerService.getDrawingData(r, e), s = [];
1356
- return Object.keys(i).forEach((o) => {
1357
- const a = i[o], { sheetTransform: c, transform: g, anchorType: l = b.Position } = a;
1358
- if (l === b.None)
1388
+ _getDrawingUndoForRowAndColSize(i, e, n, t) {
1389
+ const r = this._drawingManagerService.getDrawingData(i, e), s = [];
1390
+ return Object.keys(r).forEach((o) => {
1391
+ const a = r[o], { sheetTransform: d, transform: g, anchorType: l = E.Position } = a;
1392
+ if (l === E.None)
1359
1393
  this._remainDrawingSize(g, s, a);
1360
1394
  else {
1361
- const { from: d, to: m } = c, { row: u, column: f } = d, { row: h, column: p } = m;
1362
- for (let S = 0; S < n.length; S++) {
1363
- const C = n[S], { startRow: v, endRow: R, startColumn: _, endColumn: M } = C;
1364
- if (h < v || p < _)
1395
+ const { from: c, to: u } = d, { row: h, column: f } = c, { row: m, column: p } = u;
1396
+ for (let v = 0; v < n.length; v++) {
1397
+ const R = n[v], { startRow: S, endRow: D, startColumn: _, endColumn: b } = R;
1398
+ if (m < S || p < _)
1365
1399
  continue;
1366
- if (l === b.Position && (u <= v && h >= R || f <= _ && p >= M)) {
1400
+ if (l === E.Position && (h <= S && m >= D || f <= _ && p >= b)) {
1367
1401
  this._remainDrawingSize(g, s, a);
1368
1402
  continue;
1369
1403
  }
1370
- const w = V({ ...c }, this._selectionRenderService);
1404
+ const w = V({ ...d }, this._selectionRenderService, this._sheetSkeletonManagerService);
1371
1405
  if (w != null) {
1372
1406
  s.push({
1373
1407
  ...a,
@@ -1377,412 +1411,497 @@ let ye = class extends ue {
1377
1411
  }
1378
1412
  }
1379
1413
  }
1380
- }), s.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(r, e, s);
1414
+ }), s.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(i, e, s);
1381
1415
  }
1382
- _getUnitIdAndSubUnitId(r, e) {
1416
+ _getUnitIdAndSubUnitId(i, e) {
1383
1417
  let n, t;
1384
1418
  if (e === "insert")
1385
- n = r.unitId, t = r.subUnitId;
1419
+ n = i.unitId, t = i.subUnitId;
1386
1420
  else {
1387
- const i = se(this._univerInstanceService);
1388
- if (i == null)
1421
+ const r = oe(this._univerInstanceService);
1422
+ if (r == null)
1389
1423
  return;
1390
- n = i.unitId, t = i.subUnitId;
1424
+ n = r.unitId, t = r.subUnitId;
1391
1425
  }
1392
1426
  return { unitId: n, subUnitId: t };
1393
1427
  }
1394
- _moveRowInterceptor(r, e) {
1395
- const n = this._getUnitIdAndSubUnitId(r, e);
1428
+ _moveRowInterceptor(i, e) {
1429
+ const n = this._getUnitIdAndSubUnitId(i, e);
1396
1430
  if (n == null)
1397
1431
  return { redos: [], undos: [] };
1398
- const { unitId: t, subUnitId: i } = n, { range: s } = r, o = s.startRow, a = s.endRow, c = [], g = [], l = this._sheetDrawingService.getDrawingData(t, i), d = [], m = [];
1399
- if (Object.keys(l).forEach((u) => {
1400
- const f = l[u], { sheetTransform: h, transform: p, anchorType: S = b.Position } = f;
1401
- if (h == null || p == null)
1432
+ const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, a = s.endRow, d = [], g = [], l = this._sheetDrawingService.getDrawingData(t, r), c = [], u = [];
1433
+ if (Object.keys(l).forEach((h) => {
1434
+ const f = l[h], { sheetTransform: m, transform: p, anchorType: v = E.Position } = f;
1435
+ if (m == null || p == null)
1402
1436
  return;
1403
- let C, v;
1437
+ let R, S;
1404
1438
  if (e === "insert") {
1405
- const _ = this._expandRow(h, p, o, a, S);
1406
- C = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
1439
+ const _ = this._expandRow(m, p, o, a, v);
1440
+ R = _ == null ? void 0 : _.newSheetTransform, S = _ == null ? void 0 : _.newTransform;
1407
1441
  } else {
1408
- const { from: _, to: M } = h, { row: w } = _, { row: y } = M;
1409
- if (w >= o && y <= a)
1410
- m.push({ unitId: t, subUnitId: i, drawingId: u });
1442
+ const { from: _, to: b } = m, { row: w } = _, { row: U } = b;
1443
+ if (v === E.Both && w >= o && U <= a)
1444
+ u.push({ unitId: t, subUnitId: r, drawingId: h });
1411
1445
  else {
1412
- const D = this._shrinkRow(h, p, o, a, S);
1413
- C = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
1446
+ const O = this._shrinkRow(m, p, o, a, v);
1447
+ R = O == null ? void 0 : O.newSheetTransform, S = O == null ? void 0 : O.newTransform;
1414
1448
  }
1415
1449
  }
1416
- if (!C || !v)
1450
+ if (!R || !S)
1417
1451
  return;
1418
- const R = { unitId: t, subUnitId: i, drawingId: u, transform: v, sheetTransform: C };
1419
- d.push(R);
1420
- }), d.length === 0 && m.length === 0)
1452
+ const D = { unitId: t, subUnitId: r, drawingId: h, transform: S, sheetTransform: R };
1453
+ c.push(D);
1454
+ }), c.length === 0 && u.length === 0)
1421
1455
  return { redos: [], undos: [] };
1422
- if (d.length > 0) {
1423
- const u = this._sheetDrawingService.getBatchUpdateOp(d), { undo: f, redo: h, objects: p } = u;
1424
- c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.UPDATE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.UPDATE } });
1456
+ if (c.length > 0) {
1457
+ const h = this._sheetDrawingService.getBatchUpdateOp(c), { undo: f, redo: m, objects: p } = h;
1458
+ d.push({ id: y.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: T.UPDATE } }), g.push({ id: y.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: T.UPDATE } });
1425
1459
  }
1426
- if (m.length > 0) {
1427
- const u = this._sheetDrawingService.getBatchRemoveOp(m), f = u.undo, h = u.redo, p = u.objects;
1428
- c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.REMOVE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.INSERT } });
1460
+ if (u.length > 0) {
1461
+ const h = this._sheetDrawingService.getBatchRemoveOp(u), f = h.undo, m = h.redo, p = h.objects;
1462
+ d.push({ id: y.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: T.REMOVE } }), g.push({ id: y.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: T.INSERT } });
1429
1463
  }
1430
- return c.push({ id: j.id, params: [t] }), g.push({ id: j.id, params: [t] }), {
1431
- redos: c,
1464
+ return d.push({ id: j.id, params: [t] }), g.push({ id: j.id, params: [t] }), {
1465
+ redos: d,
1432
1466
  undos: g
1433
1467
  };
1434
1468
  }
1435
- _moveColInterceptor(r, e) {
1436
- const n = this._getUnitIdAndSubUnitId(r, e);
1469
+ _moveRangeInterceptor(i) {
1470
+ const { fromRange: e, toRange: n } = i, t = oe(this._univerInstanceService);
1471
+ if (!t)
1472
+ return { redos: [], undos: [] };
1473
+ const { unitId: r, subUnitId: s } = t, o = this._sheetDrawingService.getDrawingData(r, s), a = [], d = this._selectionRenderService.attachRangeWithCoord(e), g = this._selectionRenderService.attachRangeWithCoord(n);
1474
+ if (!d || !g)
1475
+ return { redos: [], undos: [] };
1476
+ Object.keys(o).forEach((u) => {
1477
+ const h = o[u], { sheetTransform: f, transform: m, anchorType: p = E.Position } = h;
1478
+ if (!f || !m || p === E.None)
1479
+ return;
1480
+ const { left: v = 0, top: R = 0, width: S = 0, height: D = 0 } = m, { drawingStartX: _, drawingEndX: b, drawingStartY: w, drawingEndY: U } = {
1481
+ drawingStartX: v,
1482
+ drawingEndX: v + S,
1483
+ drawingStartY: R,
1484
+ drawingEndY: R + D
1485
+ };
1486
+ if (!(d.startX <= _ && b <= d.endX && d.startY <= U && w <= d.endY))
1487
+ return;
1488
+ const { to: I, from: P } = f, M = n.startRow - e.startRow, C = n.startColumn - e.startColumn;
1489
+ let A, $;
1490
+ if (p === E.Both) {
1491
+ const k = this._selectionRenderService.attachRangeWithCoord({
1492
+ startRow: I.row,
1493
+ endRow: P.row,
1494
+ startColumn: I.column,
1495
+ endColumn: P.column
1496
+ }), z = this._selectionRenderService.attachRangeWithCoord({
1497
+ startRow: I.row + M,
1498
+ endRow: P.row + M,
1499
+ startColumn: I.column + C,
1500
+ endColumn: P.column + C
1501
+ });
1502
+ if (!z || !k)
1503
+ return;
1504
+ const B = z.endX - z.startX - (k.endX - k.startX), en = z.endY - z.startY - (k.endY - k.startY);
1505
+ A = {
1506
+ to: { ...I, row: I.row + M, column: I.column + C, columnOffset: I.columnOffset + B },
1507
+ from: { ...P, row: P.row + M, column: P.column + C, columnOffset: I.columnOffset + B, rowOffset: I.rowOffset + en }
1508
+ }, $ = V(A, this._selectionRenderService, this._sheetSkeletonManagerService);
1509
+ } else {
1510
+ const k = g.startX - d.startX, z = g.startY - d.startY;
1511
+ $ = {
1512
+ ...m,
1513
+ left: v + k,
1514
+ top: R + z
1515
+ }, A = N($, this._selectionRenderService);
1516
+ }
1517
+ if (!A || !$)
1518
+ return;
1519
+ const Ie = { unitId: r, subUnitId: s, drawingId: u, transform: $, sheetTransform: A };
1520
+ a.push(Ie);
1521
+ });
1522
+ const l = [], c = [];
1523
+ if (a.length > 0) {
1524
+ const u = this._sheetDrawingService.getBatchUpdateOp(a), { undo: h, redo: f, objects: m } = u;
1525
+ l.push({ id: y.id, params: { unitId: r, subUnitId: s, op: f, objects: m, type: T.UPDATE } }), c.push({ id: y.id, params: { unitId: r, subUnitId: s, op: h, objects: m, type: T.UPDATE } });
1526
+ }
1527
+ return { redos: l, undos: c };
1528
+ }
1529
+ _moveColInterceptor(i, e) {
1530
+ const n = this._getUnitIdAndSubUnitId(i, e);
1437
1531
  if (n == null)
1438
1532
  return { redos: [], undos: [] };
1439
- const { unitId: t, subUnitId: i } = n, { range: s } = r, o = s.startColumn, a = s.endColumn, c = [], g = [], l = this._sheetDrawingService.getDrawingData(t, i), d = [], m = [];
1440
- if (Object.keys(l).forEach((u) => {
1441
- const f = l[u], { sheetTransform: h, transform: p, anchorType: S = b.Position } = f;
1442
- if (h == null || p == null)
1533
+ const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, a = s.endColumn, d = [], g = [], l = this._sheetDrawingService.getDrawingData(t, r), c = [], u = [];
1534
+ if (Object.keys(l).forEach((h) => {
1535
+ const f = l[h], { sheetTransform: m, transform: p, anchorType: v = E.Position } = f;
1536
+ if (m == null || p == null)
1443
1537
  return;
1444
- let C, v;
1538
+ let R, S;
1445
1539
  if (e === "insert") {
1446
- const _ = this._expandCol(h, p, o, a, S);
1447
- C = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
1540
+ const _ = this._expandCol(m, p, o, a, v);
1541
+ R = _ == null ? void 0 : _.newSheetTransform, S = _ == null ? void 0 : _.newTransform;
1448
1542
  } else {
1449
- const { from: _, to: M } = h, { column: w } = _, { column: y } = M;
1450
- if (w >= o && y <= a)
1451
- m.push({ unitId: t, subUnitId: i, drawingId: u });
1543
+ const { from: _, to: b } = m, { column: w } = _, { column: U } = b;
1544
+ if (w >= o && U <= a && v === E.Both)
1545
+ u.push({ unitId: t, subUnitId: r, drawingId: h });
1452
1546
  else {
1453
- const D = this._shrinkCol(h, p, o, a, S);
1454
- C = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
1547
+ const I = this._shrinkCol(m, p, o, a, v);
1548
+ R = I == null ? void 0 : I.newSheetTransform, S = I == null ? void 0 : I.newTransform;
1455
1549
  }
1456
1550
  }
1457
- if (!C || !v)
1551
+ if (!R || !S)
1458
1552
  return;
1459
- const R = { unitId: t, subUnitId: i, drawingId: u, transform: v, sheetTransform: C };
1460
- d.push(R);
1461
- }), d.length === 0 && m.length === 0)
1553
+ const D = { unitId: t, subUnitId: r, drawingId: h, transform: S, sheetTransform: R };
1554
+ c.push(D);
1555
+ }), c.length === 0 && u.length === 0)
1462
1556
  return { redos: [], undos: [] };
1463
- if (d.length > 0) {
1464
- const u = this._sheetDrawingService.getBatchUpdateOp(d), { undo: f, redo: h, objects: p } = u;
1465
- c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.UPDATE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.UPDATE } });
1557
+ if (c.length > 0) {
1558
+ const h = this._sheetDrawingService.getBatchUpdateOp(c), { undo: f, redo: m, objects: p } = h;
1559
+ d.push({ id: y.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: T.UPDATE } }), g.push({ id: y.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: T.UPDATE } });
1466
1560
  }
1467
- if (m.length > 0) {
1468
- const u = this._sheetDrawingService.getBatchRemoveOp(m), f = u.undo, h = u.redo, p = u.objects;
1469
- c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.REMOVE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.INSERT } });
1561
+ if (u.length > 0) {
1562
+ const h = this._sheetDrawingService.getBatchRemoveOp(u), f = h.undo, m = h.redo, p = h.objects;
1563
+ d.push({ id: y.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: T.REMOVE } }), g.push({ id: y.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: T.INSERT } });
1470
1564
  }
1471
- return c.push({ id: j.id, params: [t] }), g.push({ id: j.id, params: [t] }), { redos: c, undos: g };
1565
+ return d.push({ id: j.id, params: [t] }), g.push({ id: j.id, params: [t] }), { redos: d, undos: g };
1472
1566
  }
1473
- _expandCol(r, e, n, t, i = b.Position) {
1474
- const s = t - n + 1, { from: o, to: a } = r, { column: c } = o, { column: g } = a;
1475
- if (i === b.None)
1567
+ _expandCol(i, e, n, t, r = E.Position) {
1568
+ const s = t - n + 1, { from: o, to: a } = i, { column: d } = o, { column: g } = a;
1569
+ if (r === E.None)
1476
1570
  return {
1477
1571
  newSheetTransform: N({ ...e }, this._selectionRenderService),
1478
1572
  newTransform: e
1479
1573
  };
1480
- let l = null, d = null;
1481
- if (c >= n) {
1482
- const m = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: a.row });
1483
- if (m == null)
1574
+ let l = null, c = null;
1575
+ if (d >= n) {
1576
+ const u = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: a.row });
1577
+ if (u == null)
1484
1578
  return;
1485
- d = { ...e, left: (e.left || 0) + m.endX - m.startX }, l = N(d, this._selectionRenderService);
1579
+ c = { ...e, left: (e.left || 0) + u.endX - u.startX }, l = N(c, this._selectionRenderService);
1486
1580
  } else if (g >= t)
1487
- if (i === b.Both)
1581
+ if (r === E.Both)
1488
1582
  l = {
1489
1583
  from: { ...o },
1490
1584
  to: { ...a, column: g + s }
1491
- }, d = V(l, this._selectionRenderService);
1585
+ }, c = V(l, this._selectionRenderService, this._sheetSkeletonManagerService);
1492
1586
  else
1493
1587
  return {
1494
1588
  newSheetTransform: N({ ...e }, this._selectionRenderService),
1495
1589
  newTransform: e
1496
1590
  };
1497
- return l != null && d != null ? {
1591
+ return l != null && c != null ? {
1498
1592
  newSheetTransform: l,
1499
- newTransform: d
1593
+ newTransform: c
1500
1594
  } : null;
1501
1595
  }
1502
- _shrinkCol(r, e, n, t, i = b.Position) {
1503
- const s = t - n + 1, { from: o, to: a } = r, { column: c } = o, { column: g } = a;
1504
- if (i === b.None)
1596
+ _shrinkCol(i, e, n, t, r = E.Position) {
1597
+ const s = t - n + 1, { from: o, to: a } = i, { column: d } = o, { column: g } = a;
1598
+ if (r === E.None)
1505
1599
  return {
1506
1600
  newSheetTransform: N({ ...e }, this._selectionRenderService),
1507
1601
  newTransform: e
1508
1602
  };
1509
- let l = null, d = null;
1510
- if (c > t)
1603
+ let l = null, c = null;
1604
+ if (d > t) {
1605
+ const u = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: a.row });
1606
+ if (u == null)
1607
+ return;
1608
+ c = { ...e, left: (e.left || 0) - (u.endX - u.startX) }, l = N(c, this._selectionRenderService);
1609
+ } else if (d >= n && g <= t) {
1610
+ const u = this._selectionRenderService.attachRangeWithCoord({
1611
+ startColumn: n,
1612
+ endColumn: t,
1613
+ startRow: 0,
1614
+ endRow: 0
1615
+ });
1511
1616
  l = {
1512
- from: { ...o, column: c - s },
1513
- to: { ...a, column: g - s }
1514
- }, d = V(l, this._selectionRenderService);
1515
- else {
1516
- if (c >= n && g <= t)
1517
- return null;
1518
- if (c < n && g > t)
1519
- if (i === b.Both)
1520
- l = {
1521
- from: { ...o },
1522
- to: { ...a, column: g - s }
1523
- }, d = V(l, this._selectionRenderService);
1524
- else
1525
- return {
1526
- newSheetTransform: N({ ...e }, this._selectionRenderService),
1527
- newTransform: e
1528
- };
1529
- else if (c >= n && c <= t) {
1530
- if (c === n)
1531
- d = { ...e, left: (e.left || 0) - r.from.columnOffset };
1532
- else {
1533
- const m = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: c - 1, startRow: o.row, endRow: a.row });
1534
- if (m == null)
1535
- return;
1536
- d = { ...e, left: (e.left || 0) - m.endX + m.startX - r.from.columnOffset };
1537
- }
1538
- l = N(d, this._selectionRenderService);
1539
- } else if (g >= n && g <= t && i === b.Both) {
1540
- const m = this._selectionRenderService.attachRangeWithCoord({
1541
- startColumn: n - 1,
1542
- endColumn: n - 1,
1543
- startRow: o.row,
1544
- endRow: a.row
1545
- });
1546
- if (m == null)
1547
- return;
1617
+ from: { ...o, columnOffset: 0 },
1618
+ to: { ...a, columnOffset: a.columnOffset - o.columnOffset }
1619
+ }, c = {
1620
+ ...e,
1621
+ left: u == null ? void 0 : u.startX
1622
+ };
1623
+ } else if (d < n && g > t)
1624
+ if (r === E.Both)
1548
1625
  l = {
1549
1626
  from: { ...o },
1550
- to: { ...a, column: n - 1, columnOffset: m.endX - m.startX }
1551
- }, d = V(l, this._selectionRenderService);
1627
+ to: { ...a, column: g - s }
1628
+ }, c = V(l, this._selectionRenderService, this._sheetSkeletonManagerService);
1629
+ else
1630
+ return {
1631
+ newSheetTransform: N({ ...e }, this._selectionRenderService),
1632
+ newTransform: e
1633
+ };
1634
+ else if (d >= n && d <= t) {
1635
+ if (d === n)
1636
+ c = { ...e, left: (e.left || 0) - i.from.columnOffset };
1637
+ else {
1638
+ const u = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: d - 1, startRow: o.row, endRow: a.row });
1639
+ if (u == null)
1640
+ return;
1641
+ c = { ...e, left: (e.left || 0) - u.endX + u.startX - i.from.columnOffset };
1552
1642
  }
1643
+ l = N(c, this._selectionRenderService);
1644
+ } else if (g >= n && g <= t && r === E.Both) {
1645
+ const u = this._selectionRenderService.attachRangeWithCoord({
1646
+ startColumn: n - 1,
1647
+ endColumn: n - 1,
1648
+ startRow: o.row,
1649
+ endRow: a.row
1650
+ });
1651
+ if (u == null)
1652
+ return;
1653
+ l = {
1654
+ from: { ...o },
1655
+ to: { ...a, column: n - 1, columnOffset: u.endX - u.startX }
1656
+ }, c = V(l, this._selectionRenderService, this._sheetSkeletonManagerService);
1553
1657
  }
1554
- return l != null && d != null ? {
1658
+ return l != null && c != null ? {
1555
1659
  newSheetTransform: l,
1556
- newTransform: d
1660
+ newTransform: c
1557
1661
  } : null;
1558
1662
  }
1559
- _expandRow(r, e, n, t, i = b.Position) {
1560
- const s = t - n + 1, { from: o, to: a } = r, { row: c } = o, { row: g } = a;
1561
- if (i === b.None)
1663
+ _expandRow(i, e, n, t, r = E.Position) {
1664
+ const s = t - n + 1, { from: o, to: a } = i, { row: d } = o, { row: g } = a;
1665
+ if (r === E.None)
1562
1666
  return {
1563
1667
  newSheetTransform: N({ ...e }, this._selectionRenderService),
1564
1668
  newTransform: e
1565
1669
  };
1566
- let l = null, d = null;
1567
- if (c >= n) {
1568
- const m = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: a.column });
1569
- if (m == null)
1670
+ let l = null, c = null;
1671
+ if (d >= n) {
1672
+ const u = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: a.column });
1673
+ if (u == null)
1570
1674
  return;
1571
- d = { ...e, top: (e.top || 0) + m.endY - m.startY }, l = N(d, this._selectionRenderService);
1675
+ c = { ...e, top: (e.top || 0) + u.endY - u.startY }, l = N(c, this._selectionRenderService);
1572
1676
  } else if (g >= t)
1573
- if (i === b.Both)
1677
+ if (r === E.Both)
1574
1678
  l = {
1575
1679
  from: { ...o },
1576
1680
  to: {
1577
1681
  ...a,
1578
1682
  row: g + s
1579
1683
  }
1580
- }, d = V(l, this._selectionRenderService);
1684
+ }, c = V(l, this._selectionRenderService, this._sheetSkeletonManagerService);
1581
1685
  else
1582
1686
  return {
1583
1687
  newSheetTransform: N({ ...e }, this._selectionRenderService),
1584
1688
  newTransform: e
1585
1689
  };
1586
- return l != null && d != null ? {
1690
+ return l != null && c != null ? {
1587
1691
  newSheetTransform: l,
1588
- newTransform: d
1692
+ newTransform: c
1589
1693
  } : null;
1590
1694
  }
1591
- _shrinkRow(r, e, n, t, i = b.Position) {
1592
- const s = t - n + 1, { from: o, to: a } = r, { row: c } = o, { row: g } = a;
1593
- if (i === b.None)
1695
+ _shrinkRow(i, e, n, t, r = E.Position) {
1696
+ const s = t - n + 1, { from: o, to: a } = i, { row: d } = o, { row: g } = a;
1697
+ if (r === E.None)
1594
1698
  return {
1595
1699
  newSheetTransform: N({ ...e }, this._selectionRenderService),
1596
1700
  newTransform: e
1597
1701
  };
1598
- let l = null, d = null;
1599
- if (c > t)
1702
+ let l = null, c = null;
1703
+ if (d > t)
1600
1704
  l = {
1601
- from: { ...o, row: c - s },
1705
+ from: { ...o, row: d - s },
1602
1706
  to: { ...a, row: g - s }
1603
- }, d = V(l, this._selectionRenderService);
1604
- else {
1605
- if (c >= n && g <= t)
1606
- return null;
1607
- if (c < n && g > t)
1608
- if (i === b.Both)
1609
- l = {
1610
- from: { ...o },
1611
- to: { ...a, row: g - s }
1612
- }, d = V(l, this._selectionRenderService);
1613
- else
1614
- return {
1615
- newSheetTransform: N({ ...e }, this._selectionRenderService),
1616
- newTransform: e
1617
- };
1618
- else if (c >= n && c <= t) {
1619
- if (c === n)
1620
- d = { ...e, top: (e.top || 0) - r.from.rowOffset };
1621
- else {
1622
- const m = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: c - 1, startColumn: o.column, endColumn: a.column });
1623
- if (m == null)
1624
- return;
1625
- d = { ...e, top: (e.top || 0) - m.endY + m.startY - r.from.rowOffset };
1626
- }
1627
- l = N(d, this._selectionRenderService);
1628
- } else if (g >= n && g <= t && i === b.Both) {
1629
- const m = this._selectionRenderService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
1630
- if (m == null)
1631
- return;
1707
+ }, c = V(l, this._selectionRenderService, this._sheetSkeletonManagerService);
1708
+ else if (d >= n && g <= t) {
1709
+ const u = this._selectionRenderService.attachRangeWithCoord({
1710
+ startColumn: 0,
1711
+ endColumn: 0,
1712
+ startRow: n,
1713
+ endRow: t
1714
+ });
1715
+ l = {
1716
+ from: { ...o, rowOffset: 0 },
1717
+ to: { ...a, rowOffset: a.rowOffset - o.rowOffset }
1718
+ }, c = {
1719
+ ...e,
1720
+ top: u == null ? void 0 : u.startY
1721
+ };
1722
+ } else if (d < n && g > t)
1723
+ if (r === E.Both)
1632
1724
  l = {
1633
1725
  from: { ...o },
1634
- to: { ...a, row: n - 1, rowOffset: m.endY - m.startY }
1635
- }, d = V(l, this._selectionRenderService);
1726
+ to: { ...a, row: g - s }
1727
+ }, c = V(l, this._selectionRenderService, this._sheetSkeletonManagerService);
1728
+ else
1729
+ return {
1730
+ newSheetTransform: N({ ...e }, this._selectionRenderService),
1731
+ newTransform: e
1732
+ };
1733
+ else if (d >= n && d <= t) {
1734
+ if (d === n)
1735
+ c = { ...e, top: (e.top || 0) - i.from.rowOffset };
1736
+ else {
1737
+ const u = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: d - 1, startColumn: o.column, endColumn: a.column });
1738
+ if (u == null)
1739
+ return;
1740
+ c = { ...e, top: (e.top || 0) - u.endY + u.startY - i.from.rowOffset };
1636
1741
  }
1742
+ l = N(c, this._selectionRenderService);
1743
+ } else if (g >= n && g <= t && r === E.Both) {
1744
+ const u = this._selectionRenderService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
1745
+ if (u == null)
1746
+ return;
1747
+ l = {
1748
+ from: { ...o },
1749
+ to: { ...a, row: n - 1, rowOffset: u.endY - u.startY }
1750
+ }, c = V(l, this._selectionRenderService, this._sheetSkeletonManagerService);
1637
1751
  }
1638
- return l != null && d != null ? {
1752
+ return l != null && c != null ? {
1639
1753
  newSheetTransform: l,
1640
- newTransform: d
1754
+ newTransform: c
1641
1755
  } : null;
1642
1756
  }
1643
1757
  _commandListener() {
1644
1758
  this.disposeWithMe(
1645
- this._commandService.onCommandExecuted((r) => {
1646
- if (r.id === Zn.id) {
1647
- const e = r.params, { unitId: n, subUnitId: t } = e, i = this._drawingManagerService.drawingManagerData, s = [], o = [];
1648
- Object.keys(i).forEach((a) => {
1649
- const c = i[a];
1650
- Object.keys(c).forEach((g) => {
1651
- const l = c[g].data;
1652
- l != null && Object.keys(l).forEach((d) => {
1653
- a === n && g === t ? s.push(l[d]) : o.push(l[d]);
1759
+ this._commandService.onCommandExecuted((i) => {
1760
+ i.id === sr.id && setTimeout(() => {
1761
+ const e = i.params, { unitId: n, subUnitId: t } = e, r = this._drawingManagerService.drawingManagerData, s = [], o = [];
1762
+ Object.keys(r).forEach((a) => {
1763
+ const d = r[a];
1764
+ Object.keys(d).forEach((g) => {
1765
+ const l = d[g].data;
1766
+ l != null && Object.keys(l).forEach((c) => {
1767
+ if (a === n && g === t) {
1768
+ const u = l[c];
1769
+ u.transform = V(u.sheetTransform, this._selectionRenderService, this._sheetSkeletonManagerService), s.push(l[c]);
1770
+ } else
1771
+ o.push(l[c]);
1654
1772
  });
1655
1773
  });
1656
1774
  }), this._drawingManagerService.removeNotification(o), this._drawingManagerService.addNotification(s);
1657
- }
1775
+ }, 0);
1658
1776
  })
1659
1777
  );
1660
1778
  }
1661
1779
  _sheetRefreshListener() {
1662
1780
  this.disposeWithMe(
1663
- this._commandService.onCommandExecuted((r) => {
1664
- ei.includes(r.id) && requestIdleCallback(() => {
1665
- const e = r.params, { unitId: n, subUnitId: t, ranges: i } = e;
1666
- this._refreshDrawingTransform(n, t, i);
1781
+ this._commandService.onCommandExecuted((i) => {
1782
+ ci.includes(i.id) && requestIdleCallback(() => {
1783
+ const e = i.params, { unitId: n, subUnitId: t, ranges: r } = e;
1784
+ this._refreshDrawingTransform(n, t, r);
1667
1785
  });
1668
1786
  })
1669
1787
  );
1670
1788
  }
1671
- _refreshDrawingTransform(r, e, n) {
1672
- const t = this._drawingManagerService.getDrawingData(r, e), i = [];
1789
+ _refreshDrawingTransform(i, e, n) {
1790
+ const t = this._drawingManagerService.getDrawingData(i, e), r = [];
1673
1791
  Object.keys(t).forEach((s) => {
1674
- const o = t[s], { sheetTransform: a, anchorType: c = b.Position } = o;
1675
- if (c === b.None)
1792
+ const o = t[s], { sheetTransform: a, anchorType: d = E.Position } = o;
1793
+ if (d === E.None)
1676
1794
  return !0;
1677
- const { from: g, to: l } = a, { row: d, column: m } = g, { row: u, column: f } = l;
1678
- for (let h = 0; h < n.length; h++) {
1679
- const p = n[h], { startRow: S, endRow: C, startColumn: v, endColumn: R } = p;
1680
- if (tn.intersects(
1795
+ const { from: g, to: l } = a, { row: c, column: u } = g, { row: h, column: f } = l;
1796
+ for (let m = 0; m < n.length; m++) {
1797
+ const p = n[m], { startRow: v, endRow: R, startColumn: S, endColumn: D } = p;
1798
+ if (cn.intersects(
1681
1799
  {
1682
- startRow: S,
1683
- endRow: C,
1684
- startColumn: v,
1685
- endColumn: R
1800
+ startRow: v,
1801
+ endRow: R,
1802
+ startColumn: S,
1803
+ endColumn: D
1686
1804
  },
1687
1805
  {
1688
- startRow: d,
1689
- endRow: u,
1690
- startColumn: m,
1806
+ startRow: c,
1807
+ endRow: h,
1808
+ startColumn: u,
1691
1809
  endColumn: f
1692
1810
  }
1693
- ) || d > C || m > R) {
1694
- i.push({
1811
+ ) || c > R || u > D) {
1812
+ r.push({
1695
1813
  ...o,
1696
- transform: V(a, this._selectionRenderService)
1814
+ transform: V(a, this._selectionRenderService, this._sheetSkeletonManagerService)
1697
1815
  });
1698
1816
  break;
1699
1817
  }
1700
1818
  }
1701
- }), i.length !== 0 && (this._drawingManagerService.refreshTransform(i), this._commandService.syncExecuteCommand(j.id, [r]));
1819
+ }), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(j.id, [i]));
1702
1820
  }
1703
1821
  };
1704
- ye = qr([
1705
- de(le.Rendered, ye),
1706
- re(0, B),
1707
- re(1, $(qn)),
1708
- re(2, X),
1822
+ We = oi([
1823
+ ae(ce.Rendered, We),
1824
+ re(1, Y),
1825
+ re(2, W(or)),
1709
1826
  re(3, H),
1710
- re(4, $e),
1711
- re(5, ce)
1712
- ], ye);
1713
- var ti = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, ri = (r, e, n, t) => {
1714
- for (var i = t > 1 ? void 0 : t ? ni(e, n) : e, s = r.length - 1, o; s >= 0; s--)
1715
- (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
1716
- return t && i && ti(e, n, i), i;
1717
- }, ee = (r, e) => (n, t) => e(n, t, r);
1718
- function ii(r, e, n, t) {
1719
- const { scaleX: i, scaleY: s } = e.getAncestorScale(), o = e.getViewport(Mn.VIEW_MAIN), a = {
1827
+ re(4, J),
1828
+ re(5, Se),
1829
+ re(6, ge),
1830
+ re(7, W(_e))
1831
+ ], We);
1832
+ var di = Object.defineProperty, li = Object.getOwnPropertyDescriptor, ui = (i, e, n, t) => {
1833
+ for (var r = t > 1 ? void 0 : t ? li(e, n) : e, s = i.length - 1, o; s >= 0; s--)
1834
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
1835
+ return t && r && di(e, n, r), r;
1836
+ }, ie = (i, e) => (n, t) => e(n, t, i);
1837
+ function hi(i, e, n, t) {
1838
+ const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(Pn.VIEW_MAIN), a = {
1720
1839
  left: !0,
1721
1840
  top: !0
1722
1841
  };
1723
1842
  if (!o)
1724
1843
  return {
1725
- ...r,
1844
+ ...i,
1726
1845
  absolute: a
1727
1846
  };
1728
- const { left: c, right: g, top: l, bottom: d } = r, m = t.getFreeze(), { startColumn: u, startRow: f, xSplit: h, ySplit: p } = m, S = n.getNoMergeCellPositionByIndexWithNoHeader(f - p, u - h), C = n.getNoMergeCellPositionByIndexWithNoHeader(f, u), { rowHeaderWidth: v, columnHeaderHeight: R } = n, _ = C.startX - S.startX, M = C.startY - S.startY, { top: w, left: y, viewportScrollX: D, viewportScrollY: T } = o;
1729
- let U, E;
1730
- c < y ? (a.left = !0, U = (_ + v + (c - y)) * i, E = Math.max(
1847
+ const { left: d, right: g, top: l, bottom: c } = i, u = t.getFreeze(), { startColumn: h, startRow: f, xSplit: m, ySplit: p } = u, v = n.getNoMergeCellPositionByIndexWithNoHeader(f - p, h - m), R = n.getNoMergeCellPositionByIndexWithNoHeader(f, h), { rowHeaderWidth: S, columnHeaderHeight: D } = n, _ = R.startX - v.startX, b = R.startY - v.startY, { top: w, left: U, viewportScrollX: O, viewportScrollY: I } = o;
1848
+ let P, M;
1849
+ d < U ? (a.left = !0, P = (_ + S + (d - U)) * r, M = Math.max(
1731
1850
  Math.min(
1732
- (_ + v + (g - y)) * i,
1733
- (_ + v) * i
1851
+ (_ + S + (g - U)) * r,
1852
+ (_ + S) * r
1734
1853
  ),
1735
- (g - D) * i
1736
- )) : (a.left = !1, U = Math.max((c - D) * i, (_ + v) * i), E = Math.max((g - D) * i, (_ + v) * i));
1737
- let I, A;
1738
- return l < w ? (a.top = !0, I = (M + R + (l - w)) * s, A = Math.max(
1854
+ (g - O) * r
1855
+ )) : (a.left = !1, P = Math.max((d - O) * r, (_ + S) * r), M = Math.max((g - O) * r, (_ + S) * r));
1856
+ let C, A;
1857
+ return l < w ? (a.top = !0, C = (b + D + (l - w)) * s, A = Math.max(
1739
1858
  Math.min(
1740
- (M + R + (g - w)) * s,
1741
- (M + R) * s
1859
+ (b + D + (g - w)) * s,
1860
+ (b + D) * s
1742
1861
  ),
1743
- (d - T) * s
1744
- )) : (a.top = !1, I = Math.max((l - T) * s, (M + R) * s), A = Math.max((d - T) * s, (M + R) * s)), {
1745
- left: U,
1746
- right: E,
1747
- top: I,
1862
+ (c - I) * s
1863
+ )) : (a.top = !1, C = Math.max((l - I) * s, (b + D) * s), A = Math.max((c - I) * s, (b + D) * s)), {
1864
+ left: P,
1865
+ right: M,
1866
+ top: C,
1748
1867
  bottom: A,
1749
1868
  absolute: a
1750
1869
  };
1751
1870
  }
1752
- const Ye = (r, e, n, t) => {
1753
- const { scene: i } = e, { left: s, top: o, width: a, height: c, angle: g } = r, l = {
1871
+ const qe = (i, e, n, t) => {
1872
+ const { scene: r } = e, { left: s, top: o, width: a, height: d, angle: g } = i, l = {
1754
1873
  left: s,
1755
1874
  right: s + a,
1756
1875
  top: o,
1757
- bottom: o + c
1758
- }, d = ii(l, i, n, t);
1876
+ bottom: o + d
1877
+ }, c = hi(l, r, n, t);
1759
1878
  return {
1760
- startX: d.left,
1761
- endX: d.right,
1762
- startY: d.top,
1763
- endY: d.bottom,
1879
+ startX: c.left,
1880
+ endX: c.right,
1881
+ startY: c.top,
1882
+ endY: c.bottom,
1764
1883
  rotate: g,
1765
1884
  width: a,
1766
- height: c,
1767
- absolute: d.absolute
1885
+ height: d,
1886
+ absolute: c.absolute
1768
1887
  };
1769
1888
  };
1770
- let Je = class extends ue {
1771
- constructor(e, n, t, i, s, o, a) {
1889
+ let it = class extends de {
1890
+ constructor(e, n, t, r, s, o, a) {
1772
1891
  super();
1773
1892
  K(this, "_domLayerMap", /* @__PURE__ */ new Map());
1774
1893
  K(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
1775
- K(this, "_transformChange$", new ct());
1894
+ K(this, "_transformChange$", new gt());
1776
1895
  K(this, "transformChange$", this._transformChange$.asObservable());
1777
- K(this, "_remove$", new ct());
1896
+ K(this, "_remove$", new gt());
1778
1897
  K(this, "remove$", this._remove$.asObservable());
1779
- this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = i, this._selectionRenderService = s, this._canvasFloatDomService = o, this._sheetDrawingService = a, this._drawingAddListener(), this._scrollUpdateListener(), this._featureUpdateListener(), this._deleteListener();
1898
+ this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = r, this._selectionRenderService = s, this._canvasFloatDomService = o, this._sheetDrawingService = a, this._drawingAddListener(), this._scrollUpdateListener(), this._featureUpdateListener(), this._deleteListener();
1780
1899
  }
1781
1900
  _ensureMap(e, n) {
1782
1901
  let t = this._domLayerMap.get(e);
1783
1902
  t || (t = /* @__PURE__ */ new Map(), this._domLayerMap.set(e, t));
1784
- let i = t.get(n);
1785
- return i || (i = /* @__PURE__ */ new Map(), t.set(n, i)), i;
1903
+ let r = t.get(n);
1904
+ return r || (r = /* @__PURE__ */ new Map(), t.set(n, r)), r;
1786
1905
  }
1787
1906
  _getSceneAndTransformerByDrawingSearch(e) {
1788
1907
  if (e == null)
@@ -1790,8 +1909,8 @@ let Je = class extends ue {
1790
1909
  const n = this._renderManagerService.getRenderById(e), t = n == null ? void 0 : n.scene;
1791
1910
  if (n == null || t == null)
1792
1911
  return null;
1793
- const i = t.getTransformerByCreate(), s = n.engine.getCanvasElement();
1794
- return { scene: t, transformer: i, renderObject: n, canvas: s };
1912
+ const r = t.getTransformerByCreate(), s = n.engine.getCanvasElement();
1913
+ return { scene: t, transformer: r, renderObject: n, canvas: s };
1795
1914
  }
1796
1915
  // eslint-disable-next-line max-lines-per-function
1797
1916
  _drawingAddListener() {
@@ -1799,115 +1918,115 @@ let Je = class extends ue {
1799
1918
  // eslint-disable-next-line max-lines-per-function
1800
1919
  this._drawingManagerService.add$.subscribe((e) => {
1801
1920
  e.forEach((n) => {
1802
- var nt, rt;
1803
- const { unitId: t, subUnitId: i, drawingId: s } = n, o = se(this._univerInstanceService, { unitId: t, subUnitId: i }), a = this._drawingManagerService.getDrawingByParam(n), c = (nt = this._renderManagerService.getRenderById(t)) == null ? void 0 : nt.with(Xe).getUnitSkeleton(t, i);
1804
- if (a == null || o == null || c == null)
1921
+ var k, z;
1922
+ const { unitId: t, subUnitId: r, drawingId: s } = n, o = oe(this._univerInstanceService, { unitId: t, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(n), d = (k = this._renderManagerService.getRenderById(t)) == null ? void 0 : k.with(_e).getUnitSkeleton(t, r);
1923
+ if (a == null || o == null || d == null)
1805
1924
  return;
1806
1925
  const { transform: g, drawingType: l } = a;
1807
- if (l !== Ve.DRAWING_DOM)
1926
+ if (l !== ze.DRAWING_DOM)
1808
1927
  return;
1809
- const d = this._getSceneAndTransformerByDrawingSearch(t);
1810
- if (d == null)
1928
+ const c = this._getSceneAndTransformerByDrawingSearch(t);
1929
+ if (c == null)
1811
1930
  return;
1812
- const { scene: m, canvas: u } = d;
1931
+ const { scene: u, canvas: h } = c;
1813
1932
  if (g == null)
1814
1933
  return !0;
1815
- const { left: f, top: h, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: M } = g, w = vn({ unitId: t, subUnitId: i, drawingId: s }), y = m.getObject(w);
1816
- if (y != null) {
1817
- y.transformByState({ left: f, top: h, width: p, height: S, angle: C, flipX: v, flipY: R, skewX: _, skewY: M });
1934
+ const { left: f, top: m, width: p, height: v, angle: R, flipX: S, flipY: D, skewX: _, skewY: b } = g, w = Mn({ unitId: t, subUnitId: r, drawingId: s }), U = u.getObject(w);
1935
+ if (U != null) {
1936
+ U.transformByState({ left: f, top: m, width: p, height: v, angle: R, flipX: S, flipY: D, skewX: _, skewY: b });
1818
1937
  return;
1819
1938
  }
1820
- const D = {
1939
+ const O = {
1821
1940
  left: f,
1822
- top: h,
1941
+ top: m,
1823
1942
  width: p,
1824
- height: S,
1825
- zIndex: this._drawingManagerService.getDrawingOrder(t, i).length - 1
1826
- }, T = new Rn(w, D);
1827
- m.addObject(T, Dn).attachTransformerTo(T);
1828
- const U = this._ensureMap(t, i), E = new nn(), I = Ye(T, d.renderObject, c.skeleton, o.worksheet), A = new Tn(I), z = {
1829
- dispose: E,
1830
- rect: T,
1943
+ height: v,
1944
+ zIndex: this._drawingManagerService.getDrawingOrder(t, r).length - 1
1945
+ }, I = new yn(w, O);
1946
+ u.addObject(I, Tn).attachTransformerTo(I);
1947
+ const P = this._ensureMap(t, r), M = new dn(), C = qe(I, c.renderObject, d.skeleton, o.worksheet), A = new $n(C), $ = {
1948
+ dispose: M,
1949
+ rect: I,
1831
1950
  position$: A,
1832
1951
  unitId: t,
1833
- subUnitId: i
1952
+ subUnitId: r
1834
1953
  };
1835
1954
  this._canvasFloatDomService.addFloatDom({
1836
1955
  position$: A,
1837
1956
  id: s,
1838
1957
  componentKey: a.componentKey,
1839
- onPointerDown: (W) => {
1840
- u.dispatchEvent(new PointerEvent(W.type, W));
1958
+ onPointerDown: (B) => {
1959
+ h.dispatchEvent(new PointerEvent(B.type, B));
1841
1960
  },
1842
- onPointerMove: (W) => {
1843
- u.dispatchEvent(new PointerEvent(W.type, W));
1961
+ onPointerMove: (B) => {
1962
+ h.dispatchEvent(new PointerEvent(B.type, B));
1844
1963
  },
1845
- onPointerUp: (W) => {
1846
- u.dispatchEvent(new PointerEvent(W.type, W));
1964
+ onPointerUp: (B) => {
1965
+ h.dispatchEvent(new PointerEvent(B.type, B));
1847
1966
  },
1848
- onWheel: (W) => {
1849
- u.dispatchEvent(new WheelEvent(W.type, W));
1967
+ onWheel: (B) => {
1968
+ h.dispatchEvent(new WheelEvent(B.type, B));
1850
1969
  },
1851
- props: (rt = U.get(s)) == null ? void 0 : rt.props
1970
+ props: (z = P.get(s)) == null ? void 0 : z.props
1852
1971
  });
1853
- const tt = T.onTransformChange$.subscribeEvent(() => {
1854
- const W = Ye(T, d.renderObject, c.skeleton, o.worksheet);
1972
+ const Ie = I.onTransformChange$.subscribeEvent(() => {
1973
+ const B = qe(I, c.renderObject, d.skeleton, o.worksheet);
1855
1974
  A.next(
1856
- W
1975
+ B
1857
1976
  );
1858
1977
  });
1859
- E.add(() => {
1978
+ M.add(() => {
1860
1979
  this._canvasFloatDomService.removeFloatDom(s);
1861
- }), tt && E.add(tt), this._domLayerInfoMap.set(s, z);
1980
+ }), Ie && M.add(Ie), this._domLayerInfoMap.set(s, $);
1862
1981
  });
1863
1982
  })
1864
1983
  );
1865
1984
  }
1866
1985
  _scrollUpdateListener() {
1867
1986
  this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
1868
- var t, i;
1987
+ var t, r;
1869
1988
  const n = (s, o) => {
1870
- var m;
1871
- const a = this._getSceneAndTransformerByDrawingSearch(s), c = this._ensureMap(s, o), g = Array.from(c.keys()), l = se(this._univerInstanceService, { unitId: s, subUnitId: o }), d = (m = this._renderManagerService.getRenderById(s)) == null ? void 0 : m.with(Xe).getUnitSkeleton(s, o);
1872
- !a || !l || !d || g.forEach((u) => {
1873
- const f = this._domLayerInfoMap.get(u);
1989
+ var u;
1990
+ const a = this._getSceneAndTransformerByDrawingSearch(s), d = this._ensureMap(s, o), g = Array.from(d.keys()), l = oe(this._univerInstanceService, { unitId: s, subUnitId: o }), c = (u = this._renderManagerService.getRenderById(s)) == null ? void 0 : u.with(_e).getUnitSkeleton(s, o);
1991
+ !a || !l || !c || g.forEach((h) => {
1992
+ const f = this._domLayerInfoMap.get(h);
1874
1993
  if (f) {
1875
- const h = Ye(f.rect, a.renderObject, d.skeleton, l.worksheet);
1876
- f.position$.next(h);
1994
+ const m = qe(f.rect, a.renderObject, c.skeleton, l.worksheet);
1995
+ f.position$.next(m);
1877
1996
  }
1878
1997
  });
1879
1998
  };
1880
- if (e.id === Pn.id) {
1999
+ if (e.id === Nn.id) {
1881
2000
  const s = e.params, { unitId: o, sheetId: a } = s;
1882
2001
  n(o, a);
1883
- } else if (e.id === En.id) {
2002
+ } else if (e.id === jn.id) {
1884
2003
  const s = e.params, { unitId: o } = s;
1885
- Array.from((i = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? i : []).forEach((c) => {
1886
- n(o, c);
2004
+ Array.from((r = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? r : []).forEach((d) => {
2005
+ n(o, d);
1887
2006
  });
1888
- } else if (e.id === Qn.id) {
2007
+ } else if (e.id === ar.id) {
1889
2008
  const { unitId: s, subUnitId: o } = e.params;
1890
2009
  n(s, o);
1891
2010
  }
1892
2011
  }));
1893
2012
  }
1894
2013
  _getPosition(e) {
1895
- const { startX: n, endX: t, startY: i, endY: s } = e, o = this._selectionRenderService.getSelectionCellByPosition(n, i);
2014
+ const { startX: n, endX: t, startY: r, endY: s } = e, o = this._selectionRenderService.getSelectionCellByPosition(n, r);
1896
2015
  if (o == null)
1897
2016
  return;
1898
2017
  const a = {
1899
2018
  column: o.actualColumn,
1900
2019
  columnOffset: n - o.startX,
1901
2020
  row: o.actualRow,
1902
- rowOffset: i - o.startY
1903
- }, c = this._selectionRenderService.getSelectionCellByPosition(t, s);
1904
- if (c == null)
2021
+ rowOffset: r - o.startY
2022
+ }, d = this._selectionRenderService.getSelectionCellByPosition(t, s);
2023
+ if (d == null)
1905
2024
  return;
1906
2025
  const g = {
1907
- column: c.actualColumn,
1908
- columnOffset: t - c.startX,
1909
- row: c.actualRow,
1910
- rowOffset: s - c.startY
2026
+ column: d.actualColumn,
2027
+ columnOffset: t - d.startX,
2028
+ row: d.actualRow,
2029
+ rowOffset: s - d.startY
1911
2030
  };
1912
2031
  return {
1913
2032
  from: a,
@@ -1919,12 +2038,12 @@ let Je = class extends ue {
1919
2038
  this._drawingManagerService.update$.subscribe((e) => {
1920
2039
  e.forEach((n) => {
1921
2040
  const t = this._drawingManagerService.getDrawingByParam(n);
1922
- if (!t || t.drawingType !== Ve.DRAWING_DOM)
2041
+ if (!t || t.drawingType !== ze.DRAWING_DOM)
1923
2042
  return;
1924
- const i = {
2043
+ const r = {
1925
2044
  ...t.transform
1926
2045
  };
1927
- this._transformChange$.next({ id: n.drawingId, value: i });
2046
+ this._transformChange$.next({ id: n.drawingId, value: r });
1928
2047
  });
1929
2048
  })
1930
2049
  );
@@ -1939,23 +2058,23 @@ let Je = class extends ue {
1939
2058
  );
1940
2059
  }
1941
2060
  addFloatDomToPosition(e) {
1942
- const n = se(this._univerInstanceService, {
2061
+ const n = oe(this._univerInstanceService, {
1943
2062
  unitId: e.unitId,
1944
2063
  subUnitId: e.subUnitId
1945
2064
  });
1946
2065
  if (!n)
1947
2066
  throw new Error("cannot find current target!");
1948
- const { unitId: t, subUnitId: i } = n, { initPosition: s, componentKey: o } = e, a = ie.generateRandomId(), c = this._getPosition(s);
1949
- if (c == null)
2067
+ const { unitId: t, subUnitId: r } = n, { initPosition: s, componentKey: o } = e, a = se.generateRandomId(), d = this._getPosition(s);
2068
+ if (d == null)
1950
2069
  return;
1951
- this._ensureMap(t, i).set(a, e);
2070
+ this._ensureMap(t, r).set(a, e);
1952
2071
  const l = {
1953
2072
  unitId: t,
1954
- subUnitId: i,
2073
+ subUnitId: r,
1955
2074
  drawingId: a,
1956
- drawingType: Ve.DRAWING_DOM,
2075
+ drawingType: ze.DRAWING_DOM,
1957
2076
  componentKey: o,
1958
- sheetTransform: c,
2077
+ sheetTransform: d,
1959
2078
  transform: {
1960
2079
  left: s.startX,
1961
2080
  top: s.startY,
@@ -1963,7 +2082,7 @@ let Je = class extends ue {
1963
2082
  height: s.endY - s.startY
1964
2083
  }
1965
2084
  };
1966
- return this._commandService.executeCommand(et.id, {
2085
+ return this._commandService.executeCommand(at.id, {
1967
2086
  unitId: t,
1968
2087
  drawings: [l]
1969
2088
  }), {
@@ -1977,46 +2096,46 @@ let Je = class extends ue {
1977
2096
  const t = this._domLayerInfoMap.get(e);
1978
2097
  if (!t)
1979
2098
  return;
1980
- const { unitId: i, subUnitId: s } = t;
2099
+ const { unitId: r, subUnitId: s } = t;
1981
2100
  this._domLayerInfoMap.delete(e), t.dispose.dispose();
1982
- const o = this._getSceneAndTransformerByDrawingSearch(i);
2101
+ const o = this._getSceneAndTransformerByDrawingSearch(r);
1983
2102
  if (o && o.scene.removeObject(t.rect), n) {
1984
- this._ensureMap(i, s).delete(e);
1985
- const c = this._drawingManagerService.getDrawingByParam({ unitId: i, subUnitId: s, drawingId: e });
1986
- if (!c)
2103
+ this._ensureMap(r, s).delete(e);
2104
+ const d = this._drawingManagerService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: e });
2105
+ if (!d)
1987
2106
  return;
1988
- const g = this._sheetDrawingService.getBatchRemoveOp([c]), { redo: l, objects: d } = g;
1989
- this._commandService.syncExecuteCommand(O.id, { unitId: i, subUnitId: s, op: l, objects: d, type: P.REMOVE });
2107
+ const g = this._sheetDrawingService.getBatchRemoveOp([d]), { redo: l, objects: c } = g;
2108
+ this._commandService.syncExecuteCommand(y.id, { unitId: r, subUnitId: s, op: l, objects: c, type: T.REMOVE });
1990
2109
  }
1991
2110
  }
1992
2111
  };
1993
- Je = ri([
1994
- ee(0, $(te)),
1995
- ee(1, ce),
1996
- ee(2, $(B)),
1997
- ee(3, H),
1998
- ee(4, $e),
1999
- ee(5, $(Gn)),
2000
- ee(6, X)
2001
- ], Je);
2002
- var si = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, ai = (r, e, n, t) => {
2003
- for (var i = t > 1 ? void 0 : t ? oi(e, n) : e, s = r.length - 1, o; s >= 0; s--)
2004
- (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
2005
- return t && i && si(e, n, i), i;
2006
- }, be = (r, e) => (n, t) => e(n, t, r);
2007
- let Te = class extends ue {
2008
- constructor(r, e, n, t) {
2009
- super(), this._sheetPrintInterceptorService = r, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting();
2112
+ it = ui([
2113
+ ie(0, W(te)),
2114
+ ie(1, ge),
2115
+ ie(2, W(Y)),
2116
+ ie(3, J),
2117
+ ie(4, Se),
2118
+ ie(5, W(Kn)),
2119
+ ie(6, H)
2120
+ ], it);
2121
+ var gi = Object.defineProperty, mi = Object.getOwnPropertyDescriptor, fi = (i, e, n, t) => {
2122
+ for (var r = t > 1 ? void 0 : t ? mi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
2123
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
2124
+ return t && r && gi(e, n, r), r;
2125
+ }, Ue = (i, e) => (n, t) => e(n, t, i);
2126
+ let Be = class extends de {
2127
+ constructor(i, e, n, t) {
2128
+ super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting();
2010
2129
  }
2011
2130
  _initPrinting() {
2012
2131
  this.disposeWithMe(
2013
2132
  this._sheetPrintInterceptorService.interceptor.intercept(
2014
2133
  this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
2015
2134
  {
2016
- handler: (r, e, n) => {
2017
- const { unitId: t, scene: i, subUnitId: s } = e, o = this._drawingManagerService.getDrawingDataForUnit(t), a = o == null ? void 0 : o[s];
2018
- return a && a.order.forEach((c) => {
2019
- this._drawingRenderService.renderDrawing(a.data[c], i);
2135
+ handler: (i, e, n) => {
2136
+ const { unitId: t, scene: r, subUnitId: s } = e, o = this._drawingManagerService.getDrawingDataForUnit(t), a = o == null ? void 0 : o[s];
2137
+ return a && a.order.forEach((d) => {
2138
+ this._drawingRenderService.renderDrawing(a.data[d], r);
2020
2139
  }), n();
2021
2140
  }
2022
2141
  }
@@ -2025,49 +2144,49 @@ let Te = class extends ue {
2025
2144
  this._sheetPrintInterceptorService.interceptor.intercept(
2026
2145
  this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,
2027
2146
  {
2028
- handler: (r, e, n) => {
2029
- const { unitId: t, subUnitId: i } = e, s = this._renderManagerService.getRenderById(t);
2147
+ handler: (i, e, n) => {
2148
+ const { unitId: t, subUnitId: r } = e, s = this._renderManagerService.getRenderById(t);
2030
2149
  if (!s)
2031
- return n(r);
2032
- const o = s.with(Xe).getUnitSkeleton(t, i);
2150
+ return n(i);
2151
+ const o = s.with(_e).getUnitSkeleton(t, r);
2033
2152
  if (!o)
2034
- return n(r);
2035
- const a = this._drawingManagerService.getDrawingDataForUnit(t), c = a == null ? void 0 : a[e.subUnitId];
2036
- if (!c)
2037
- return n(r);
2038
- const { scaleX: g, scaleY: l } = s.scene, d = r ? { ...r } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, m = c.order.map((u) => c.data[u]).filter((u) => u.drawingType !== Le.DRAWING_DOM);
2039
- return m.length ? (m.forEach((u) => {
2040
- if (!u.groupId && u.transform && ie.isDefine(u.transform.left) && ie.isDefine(u.transform.top) && ie.isDefine(u.transform.width) && ie.isDefine(u.transform.height)) {
2041
- const f = o.skeleton.getCellPositionByOffset(u.transform.left, u.transform.top, g, l, { x: 0, y: 0 }), h = o.skeleton.getCellPositionByOffset(u.transform.left + u.transform.width, u.transform.top + u.transform.height, g, l, { x: 0, y: 0 });
2042
- f.column < d.startColumn && (d.startColumn = f.column), f.row < d.startRow && (d.startRow = f.row), d.endRow < h.row && (d.endRow = h.row), d.endColumn < h.column && (d.endColumn = h.column);
2153
+ return n(i);
2154
+ const a = this._drawingManagerService.getDrawingDataForUnit(t), d = a == null ? void 0 : a[e.subUnitId];
2155
+ if (!d)
2156
+ return n(i);
2157
+ const { scaleX: g, scaleY: l } = s.scene, c = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, u = d.order.map((h) => d.data[h]).filter((h) => h.drawingType !== Fe.DRAWING_DOM);
2158
+ return u.length ? (u.forEach((h) => {
2159
+ if (!h.groupId && h.transform && se.isDefine(h.transform.left) && se.isDefine(h.transform.top) && se.isDefine(h.transform.width) && se.isDefine(h.transform.height)) {
2160
+ const f = o.skeleton.getCellPositionByOffset(h.transform.left, h.transform.top, g, l, { x: 0, y: 0 }), m = o.skeleton.getCellPositionByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, g, l, { x: 0, y: 0 });
2161
+ f.column < c.startColumn && (c.startColumn = f.column), f.row < c.startRow && (c.startRow = f.row), c.endRow < m.row && (c.endRow = m.row), c.endColumn < m.column && (c.endColumn = m.column);
2043
2162
  }
2044
- }), n(d)) : n(r);
2163
+ }), n(c)) : n(i);
2045
2164
  }
2046
2165
  }
2047
2166
  )
2048
2167
  );
2049
2168
  }
2050
2169
  };
2051
- Te = ai([
2052
- de(le.Rendered, Te),
2053
- be(0, $(yn)),
2054
- be(1, $(gn)),
2055
- be(2, H),
2056
- be(3, te)
2057
- ], Te);
2058
- var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, li = (r, e, n, t) => {
2059
- for (var i = t > 1 ? void 0 : t ? di(e, n) : e, s = r.length - 1, o; s >= 0; s--)
2060
- (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
2061
- return t && i && ci(e, n, i), i;
2062
- }, ge = (r, e) => (n, t) => e(n, t, r);
2063
- let Ue = class extends ue {
2064
- constructor(r, e, n, t, i) {
2065
- super(), this._drawingManagerService = r, this._renderManagerService = e, this._permissionService = n, this._univerInstanceService = t, this._userManagerService = i, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
2170
+ Be = fi([
2171
+ ae(ce.Rendered, Be),
2172
+ Ue(0, W(Ln)),
2173
+ Ue(1, W(vn)),
2174
+ Ue(2, J),
2175
+ Ue(3, te)
2176
+ ], Be);
2177
+ var pi = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, _i = (i, e, n, t) => {
2178
+ for (var r = t > 1 ? void 0 : t ? wi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
2179
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
2180
+ return t && r && pi(e, n, r), r;
2181
+ }, fe = (i, e) => (n, t) => e(n, t, i);
2182
+ let $e = class extends de {
2183
+ constructor(i, e, n, t, r) {
2184
+ super(), this._drawingManagerService = i, this._renderManagerService = e, this._permissionService = n, this._univerInstanceService = t, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
2066
2185
  }
2067
2186
  _initDrawingVisible() {
2068
- const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
2187
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET);
2069
2188
  this.disposeWithMe(
2070
- Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2189
+ be([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2071
2190
  if (!e) {
2072
2191
  this._drawingManagerService.setDrawingVisible(!1);
2073
2192
  return;
@@ -2077,16 +2196,16 @@ let Ue = class extends ue {
2077
2196
  this._drawingManagerService.setDrawingVisible(!1);
2078
2197
  return;
2079
2198
  }
2080
- const i = e.getUnitId(), s = t.getSheetId();
2081
- if (this._permissionService.composePermission([new lt(i).id, new xe(i, s).id]).every((a) => a.value))
2199
+ const r = e.getUnitId(), s = t.getSheetId();
2200
+ if (this._permissionService.composePermission([new ft(r).id, new Je(r, s).id]).every((a) => a.value))
2082
2201
  this._drawingManagerService.setDrawingVisible(!0);
2083
2202
  else {
2084
2203
  this._drawingManagerService.setDrawingVisible(!1);
2085
- const a = e.getUnitId(), c = t.getSheetId(), g = this._drawingManagerService.getDrawingData(a, c), l = Object.values(g), d = this._renderManagerService.getRenderById(a), m = d == null ? void 0 : d.scene;
2086
- if (m == null)
2204
+ const a = e.getUnitId(), d = t.getSheetId(), g = this._drawingManagerService.getDrawingData(a, d), l = Object.values(g), c = this._renderManagerService.getRenderById(a), u = c == null ? void 0 : c.scene;
2205
+ if (u == null)
2087
2206
  return;
2088
- m.getAllObjects().forEach((f) => {
2089
- f.classType === ne.IMAGE && l.some((h) => f.oKey.includes(h.drawingId)) && m.removeObject(f);
2207
+ u.getAllObjects().forEach((f) => {
2208
+ f.classType === le.IMAGE && l.some((m) => f.oKey.includes(m.drawingId)) && u.removeObject(f);
2090
2209
  });
2091
2210
  }
2092
2211
  });
@@ -2094,9 +2213,9 @@ let Ue = class extends ue {
2094
2213
  );
2095
2214
  }
2096
2215
  _initDrawingEditable() {
2097
- const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
2216
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET);
2098
2217
  this.disposeWithMe(
2099
- Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2218
+ be([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2100
2219
  if (!e) {
2101
2220
  this._drawingManagerService.setDrawingEditable(!1);
2102
2221
  return;
@@ -2106,16 +2225,16 @@ let Ue = class extends ue {
2106
2225
  this._drawingManagerService.setDrawingEditable(!1);
2107
2226
  return;
2108
2227
  }
2109
- const i = e.getUnitId(), s = t.getSheetId();
2110
- if (this._permissionService.composePermission([new He(i).id, new Oe(i, s).id]).every((a) => a.value))
2228
+ const r = e.getUnitId(), s = t.getSheetId();
2229
+ if (this._permissionService.composePermission([new et(r).id, new Ne(r, s).id]).every((a) => a.value))
2111
2230
  this._drawingManagerService.setDrawingEditable(!0);
2112
2231
  else {
2113
2232
  this._drawingManagerService.setDrawingEditable(!1);
2114
- const a = e.getUnitId(), c = t.getSheetId(), g = this._drawingManagerService.getDrawingData(a, c), l = Object.values(g), d = this._renderManagerService.getRenderById(a), m = d == null ? void 0 : d.scene;
2115
- if (m == null)
2233
+ const a = e.getUnitId(), d = t.getSheetId(), g = this._drawingManagerService.getDrawingData(a, d), l = Object.values(g), c = this._renderManagerService.getRenderById(a), u = c == null ? void 0 : c.scene;
2234
+ if (u == null)
2116
2235
  return;
2117
- m.getAllObjects().forEach((f) => {
2118
- f.classType === ne.IMAGE && l.some((h) => f.oKey.includes(h.drawingId)) && m.detachTransformerFrom(f);
2236
+ u.getAllObjects().forEach((f) => {
2237
+ f.classType === le.IMAGE && l.some((m) => f.oKey.includes(m.drawingId)) && u.detachTransformerFrom(f);
2119
2238
  });
2120
2239
  }
2121
2240
  });
@@ -2123,38 +2242,38 @@ let Ue = class extends ue {
2123
2242
  );
2124
2243
  }
2125
2244
  _initViewPermissionChange() {
2126
- const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
2245
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET);
2127
2246
  this.disposeWithMe(
2128
- Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2247
+ be([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2129
2248
  e && e.activeSheet$.subscribe((t) => {
2130
- var d;
2249
+ var c;
2131
2250
  if (!t)
2132
2251
  return;
2133
- const i = e.getUnitId(), s = t.getSheetId();
2252
+ const r = e.getUnitId(), s = t.getSheetId();
2134
2253
  let o = !0;
2135
- const a = this._renderManagerService.getRenderById(i), c = a == null ? void 0 : a.scene;
2136
- if (c == null)
2254
+ const a = this._renderManagerService.getRenderById(r), d = a == null ? void 0 : a.scene;
2255
+ if (d == null)
2137
2256
  return;
2138
- const g = c.getTransformerByCreate(), l = this._permissionService.composePermission$([new lt(i).id, new xe(i, s).id]).pipe(dt((m) => m.every((u) => u.value)));
2257
+ const g = d.getTransformerByCreate(), l = this._permissionService.composePermission$([new ft(r).id, new Je(r, s).id]).pipe(mt((u) => u.every((h) => h.value)));
2139
2258
  l == null || l.pipe(
2140
- Ce((m) => m !== o),
2141
- Ie()
2259
+ Oe((u) => u !== o),
2260
+ Ee()
2142
2261
  ).subscribe({
2143
- next: (m) => {
2144
- o = m, this._drawingManagerService.setDrawingVisible(m);
2145
- const u = c.getAllObjects(), f = this._drawingManagerService.getDrawingData(i, s), h = Object.values(f);
2146
- m ? this._drawingManagerService.addNotification(h) : (u.forEach((p) => {
2147
- p.classType === ne.IMAGE && h.some((S) => p.oKey.includes(S.drawingId)) && c.removeObject(p);
2262
+ next: (u) => {
2263
+ o = u, this._drawingManagerService.setDrawingVisible(u);
2264
+ const h = d.getAllObjects(), f = this._drawingManagerService.getDrawingData(r, s), m = Object.values(f);
2265
+ u ? this._drawingManagerService.addNotification(m) : (h.forEach((p) => {
2266
+ p.classType === le.IMAGE && m.some((v) => p.oKey.includes(v.drawingId)) && d.removeObject(p);
2148
2267
  }), g.clearSelectedObjects());
2149
2268
  }
2150
- }), (d = this._permissionService.getPermissionPoint$(new xe(i, s).id)) == null || d.pipe(
2151
- Ce((m) => m.value !== o),
2152
- Ie()
2269
+ }), (c = this._permissionService.getPermissionPoint$(new Je(r, s).id)) == null || c.pipe(
2270
+ Oe((u) => u.value !== o),
2271
+ Ee()
2153
2272
  ).subscribe({
2154
2273
  complete: () => {
2155
2274
  o = !0, this._drawingManagerService.setDrawingVisible(!0);
2156
- const m = this._drawingManagerService.getDrawingData(i, s), u = Object.values(m);
2157
- this._drawingManagerService.addNotification(u);
2275
+ const u = this._drawingManagerService.getDrawingData(r, s), h = Object.values(u);
2276
+ this._drawingManagerService.addNotification(h);
2158
2277
  }
2159
2278
  });
2160
2279
  });
@@ -2162,43 +2281,43 @@ let Ue = class extends ue {
2162
2281
  );
2163
2282
  }
2164
2283
  _initEditPermissionChange() {
2165
- const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
2284
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET);
2166
2285
  this.disposeWithMe(
2167
- Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2286
+ be([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2168
2287
  e && e.activeSheet$.subscribe((t) => {
2169
- var d;
2288
+ var c;
2170
2289
  if (!t)
2171
2290
  return;
2172
- const i = e.getUnitId(), s = t.getSheetId();
2291
+ const r = e.getUnitId(), s = t.getSheetId();
2173
2292
  let o = !0;
2174
- const a = this._renderManagerService.getRenderById(i), c = a == null ? void 0 : a.scene;
2175
- if (c == null)
2293
+ const a = this._renderManagerService.getRenderById(r), d = a == null ? void 0 : a.scene;
2294
+ if (d == null)
2176
2295
  return;
2177
- const g = c.getTransformerByCreate(), l = this._permissionService.composePermission$([new He(i).id, new Oe(i, s).id]).pipe(dt((m) => m.every((u) => u.value)));
2296
+ const g = d.getTransformerByCreate(), l = this._permissionService.composePermission$([new et(r).id, new Ne(r, s).id]).pipe(mt((u) => u.every((h) => h.value)));
2178
2297
  l == null || l.pipe(
2179
- Ce((m) => m !== o),
2180
- Ie()
2298
+ Oe((u) => u !== o),
2299
+ Ee()
2181
2300
  ).subscribe({
2182
- next: (m) => {
2183
- o = m, this._drawingManagerService.setDrawingEditable(m);
2184
- const u = c.getAllObjects(), f = this._drawingManagerService.getDrawingData(i, s), h = Object.values(f);
2185
- m ? (u.forEach((p) => {
2186
- p.classType === ne.IMAGE && h.some((S) => p.oKey.includes(S.drawingId)) && c.attachTransformerTo(p);
2187
- }), this._drawingManagerService.addNotification(h)) : (u.forEach((p) => {
2188
- p.classType === ne.IMAGE && h.some((S) => p.oKey.includes(S.drawingId)) && c.detachTransformerFrom(p);
2301
+ next: (u) => {
2302
+ o = u, this._drawingManagerService.setDrawingEditable(u);
2303
+ const h = d.getAllObjects(), f = this._drawingManagerService.getDrawingData(r, s), m = Object.values(f);
2304
+ u ? (h.forEach((p) => {
2305
+ p.classType === le.IMAGE && m.some((v) => p.oKey.includes(v.drawingId)) && d.attachTransformerTo(p);
2306
+ }), this._drawingManagerService.addNotification(m)) : (h.forEach((p) => {
2307
+ p.classType === le.IMAGE && m.some((v) => p.oKey.includes(v.drawingId)) && d.detachTransformerFrom(p);
2189
2308
  }), g.clearSelectedObjects());
2190
2309
  }
2191
- }), (d = this._permissionService.getPermissionPoint$(new Oe(i, s).id)) == null || d.pipe(
2192
- Ce((m) => m.value !== o),
2193
- Ie()
2310
+ }), (c = this._permissionService.getPermissionPoint$(new Ne(r, s).id)) == null || c.pipe(
2311
+ Oe((u) => u.value !== o),
2312
+ Ee()
2194
2313
  ).subscribe({
2195
2314
  complete: () => {
2196
2315
  o = !0;
2197
- const m = e.getUnitId(), u = t.getSheetId(), f = this._drawingManagerService.getDrawingData(m, u), h = Object.values(f), p = this._renderManagerService.getRenderById(m), S = p == null ? void 0 : p.scene;
2198
- if (S == null)
2316
+ const u = e.getUnitId(), h = t.getSheetId(), f = this._drawingManagerService.getDrawingData(u, h), m = Object.values(f), p = this._renderManagerService.getRenderById(u), v = p == null ? void 0 : p.scene;
2317
+ if (v == null)
2199
2318
  return;
2200
- this._drawingManagerService.setDrawingEditable(!0), S.getAllObjects().forEach((v) => {
2201
- v.classType === ne.IMAGE && h.some((R) => v.oKey.includes(R.drawingId)) && S.detachTransformerFrom(v);
2319
+ this._drawingManagerService.setDrawingEditable(!0), v.getAllObjects().forEach((S) => {
2320
+ S.classType === le.IMAGE && m.some((D) => S.oKey.includes(D.drawingId)) && v.detachTransformerFrom(S);
2202
2321
  });
2203
2322
  }
2204
2323
  });
@@ -2207,56 +2326,204 @@ let Ue = class extends ue {
2207
2326
  );
2208
2327
  }
2209
2328
  };
2210
- Ue = li([
2211
- de(le.Rendered, Ue),
2212
- ge(0, H),
2213
- ge(1, te),
2214
- ge(2, sn),
2215
- ge(3, ce),
2216
- ge(4, $(rn))
2217
- ], Ue);
2218
- var zt = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, mi = (r, e, n) => e in r ? zt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n, gi = (r, e, n, t) => {
2219
- for (var i = t > 1 ? void 0 : t ? ui(e, n) : e, s = r.length - 1, o; s >= 0; s--)
2220
- (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
2221
- return t && i && zt(e, n, i), i;
2222
- }, mt = (r, e) => (n, t) => e(n, t, r), Kt = (r, e, n) => mi(r, typeof e != "symbol" ? e + "" : e, n);
2223
- const hi = "SHEET_IMAGE_UI_PLUGIN";
2224
- let je = class extends on {
2225
- constructor(e = {}, n, t) {
2329
+ $e = _i([
2330
+ ae(ce.Rendered, $e),
2331
+ fe(0, J),
2332
+ fe(1, te),
2333
+ fe(2, un),
2334
+ fe(3, ge),
2335
+ fe(4, W(ln))
2336
+ ], $e);
2337
+ var vi = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, Ci = (i, e, n, t) => {
2338
+ for (var r = t > 1 ? void 0 : t ? Si(e, n) : e, s = i.length - 1, o; s >= 0; s--)
2339
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
2340
+ return t && r && vi(e, n, r), r;
2341
+ }, Ae = (i, e) => (n, t) => e(n, t, i);
2342
+ let Ve = class extends de {
2343
+ constructor(e, n, t, r) {
2344
+ super();
2345
+ K(this, "_copyInfo");
2346
+ this._sheetClipboardService = e, this._selectionRenderService = n, this._sheetDrawingService = t, this._injector = r, this._initCopyPaste();
2347
+ }
2348
+ _initCopyPaste() {
2349
+ this._sheetClipboardService.addClipboardHook({
2350
+ id: "SHEET_IMAGE_UI_PLUGIN",
2351
+ onBeforeCopy: (e, n, t) => this._collect(e, n, t),
2352
+ onPasteCells: (e, n, t, r) => {
2353
+ const { copyType: s = ut.COPY, pasteType: o } = r, { range: a } = e || {}, { range: d, unitId: g, subUnitId: l } = n;
2354
+ return this._generateMutations(d, { copyType: s, pasteType: o, copyRange: a, unitId: g, subUnitId: l });
2355
+ },
2356
+ onPastePlainText: (e, n) => ({ undos: [], redos: [] })
2357
+ });
2358
+ }
2359
+ _collect(e, n, t) {
2360
+ const r = this._selectionRenderService.attachRangeWithCoord(t);
2361
+ if (!r)
2362
+ return;
2363
+ const { startX: s, endX: o, startY: a, endY: d } = r, g = this._sheetDrawingService.getDrawingData(e, n), l = [];
2364
+ Object.keys(g).forEach((c) => {
2365
+ const u = g[c], { transform: h } = u;
2366
+ if (u.anchorType !== E.Both || !h)
2367
+ return;
2368
+ const { left: f = 0, top: m = 0, width: p = 0, height: v = 0 } = h, { drawingStartX: R, drawingEndX: S, drawingStartY: D, drawingEndY: _ } = {
2369
+ drawingStartX: f,
2370
+ drawingEndX: f + p,
2371
+ drawingStartY: m,
2372
+ drawingEndY: m + v
2373
+ };
2374
+ s <= R && S <= o && a <= D && _ <= d && l.push(u);
2375
+ }), l.length && (this._copyInfo = {
2376
+ drawings: l,
2377
+ unitId: e,
2378
+ subUnitId: n
2379
+ });
2380
+ }
2381
+ // eslint-disable-next-line max-lines-per-function
2382
+ _generateMutations(e, n) {
2383
+ if (!this._copyInfo)
2384
+ return { redos: [], undos: [] };
2385
+ if ([
2386
+ Me.SPECIAL_PASTE_COL_WIDTH,
2387
+ Me.SPECIAL_PASTE_VALUE,
2388
+ Me.SPECIAL_PASTE_FORMAT,
2389
+ Me.SPECIAL_PASTE_FORMULA
2390
+ ].includes(
2391
+ n.pasteType
2392
+ ))
2393
+ return { redos: [], undos: [] };
2394
+ const { copyRange: t } = n;
2395
+ if (!t)
2396
+ return { redos: [], undos: [] };
2397
+ const { drawings: r, unitId: s, subUnitId: o } = this._copyInfo, { ranges: [a, d], mapFunc: g } = Wn([t, e]), { row: l, col: c } = g(a.startRow, a.startColumn), { row: u, col: h } = g(d.startRow, d.startColumn), f = this._selectionRenderService.attachRangeWithCoord({
2398
+ startRow: l,
2399
+ endRow: l,
2400
+ startColumn: c,
2401
+ endColumn: c
2402
+ }), m = this._selectionRenderService.attachRangeWithCoord({
2403
+ startRow: u,
2404
+ endRow: u,
2405
+ startColumn: h,
2406
+ endColumn: h
2407
+ });
2408
+ if (!f || !m)
2409
+ return { redos: [], undos: [] };
2410
+ const p = [], v = [], R = m.startX - f.startX, S = m.startY - f.startY, D = u - l, _ = h - c, b = n.copyType === ut.CUT, { _sheetDrawingService: w } = this;
2411
+ return r.forEach((U) => {
2412
+ const { transform: O, sheetTransform: I } = U;
2413
+ if (!O)
2414
+ return;
2415
+ const P = {
2416
+ ...U,
2417
+ unitId: s,
2418
+ subUnitId: o,
2419
+ drawingId: b ? U.drawingId : se.generateRandomId(),
2420
+ transform: {
2421
+ ...O,
2422
+ left: O.left + R,
2423
+ top: O.top + S
2424
+ },
2425
+ sheetTransform: {
2426
+ to: { ...I.to, row: I.to.row + D, column: I.to.column + _ },
2427
+ from: { ...I.from, row: I.from.row + D, column: I.from.column + _ }
2428
+ }
2429
+ };
2430
+ if (b) {
2431
+ const { undo: M, redo: C, objects: A } = w.getBatchUpdateOp([P]);
2432
+ p.push({
2433
+ id: y.id,
2434
+ params: {
2435
+ unitId: s,
2436
+ subUnitId: o,
2437
+ type: T.UPDATE,
2438
+ op: C,
2439
+ objects: A
2440
+ }
2441
+ }), v.push({
2442
+ id: y.id,
2443
+ params: {
2444
+ unitId: s,
2445
+ subUnitId: o,
2446
+ type: T.UPDATE,
2447
+ op: M,
2448
+ objects: A
2449
+ }
2450
+ });
2451
+ } else {
2452
+ const { undo: M, redo: C, objects: A } = w.getBatchAddOp([P]);
2453
+ p.push({ id: y.id, params: { op: C, unitId: s, subUnitId: o, objects: A, type: T.INSERT } }), v.push({ id: y.id, params: { op: M, unitId: s, subUnitId: o, objects: A, type: T.REMOVE } });
2454
+ }
2455
+ }), {
2456
+ redos: p,
2457
+ undos: v
2458
+ };
2459
+ }
2460
+ };
2461
+ Ve = Ci([
2462
+ ae(ce.Ready, Ve),
2463
+ Ae(0, Bn),
2464
+ Ae(1, Se),
2465
+ Ae(2, H),
2466
+ Ae(3, W(xe))
2467
+ ], Ve);
2468
+ var qt = Object.defineProperty, Ri = Object.getOwnPropertyDescriptor, Ii = (i, e, n) => e in i ? qt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, Di = (i, e, n, t) => {
2469
+ for (var r = t > 1 ? void 0 : t ? Ri(e, n) : e, s = i.length - 1, o; s >= 0; s--)
2470
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
2471
+ return t && r && qt(e, n, r), r;
2472
+ }, Qe = (i, e) => (n, t) => e(n, t, i), Qt = (i, e, n) => Ii(i, typeof e != "symbol" ? e + "" : e, n);
2473
+ const Mi = "SHEET_IMAGE_UI_PLUGIN";
2474
+ let Xe = class extends hn {
2475
+ constructor(e = {}, n, t, r) {
2226
2476
  super();
2227
2477
  K(this, "_pluginConfig");
2228
- this._injector = n, this._localeService = t, this._pluginConfig = ie.deepMerge({}, kr, e);
2478
+ this._injector = n, this._localeService = t, this._renderManagerService = r, this._pluginConfig = se.deepMerge({}, ri, e);
2229
2479
  }
2230
2480
  onStarting(e) {
2231
2481
  super.onStarting(e), this._initDependencies(e);
2232
2482
  }
2233
2483
  _initDependencies(e) {
2234
- [
2484
+ const n = [
2235
2485
  // services
2236
- [Je],
2486
+ [it],
2237
2487
  // controllers
2238
2488
  [
2239
- he,
2489
+ pe,
2240
2490
  {
2241
- useFactory: () => this._injector.createInstance(he, this._pluginConfig)
2491
+ useFactory: () => this._injector.createInstance(pe, this._pluginConfig)
2242
2492
  }
2243
2493
  ],
2244
- [Ee],
2245
- [Pe],
2246
- [ye],
2247
- [Te],
2248
- [Ue]
2249
- ].forEach((t) => e.add(t));
2494
+ [je],
2495
+ [Be],
2496
+ [$e],
2497
+ [Ve]
2498
+ ], t = [
2499
+ Le,
2500
+ We
2501
+ ];
2502
+ n.forEach((r) => e.add(r)), t.forEach((r) => this._renderManagerService.registerRenderModule(F.UNIVER_SHEET, r));
2250
2503
  }
2251
2504
  };
2252
- Kt(je, "type", Y.UNIVER_SHEET);
2253
- Kt(je, "pluginName", hi);
2254
- je = gi([
2255
- an(Sn, hn, fn),
2256
- mt(1, $(Ze)),
2257
- mt(2, $(pe))
2258
- ], je);
2505
+ Qt(Xe, "type", F.UNIVER_SHEET);
2506
+ Qt(Xe, "pluginName", Mi);
2507
+ Xe = Di([
2508
+ gn(bn, Sn, Cn),
2509
+ Qe(1, W(xe)),
2510
+ Qe(2, W(ve)),
2511
+ Qe(3, te)
2512
+ ], Xe);
2259
2513
  export {
2260
- Je as SheetCanvasFloatDomManagerService,
2261
- je as UniverSheetsDrawingUIPlugin
2514
+ j as ClearSheetDrawingTransformerOperation,
2515
+ Zt as DeleteDrawingsCommand,
2516
+ Yt as EditSheetDrawingOperation,
2517
+ Xt as GroupSheetDrawingCommand,
2518
+ Ye as InsertCellImageOperation,
2519
+ He as InsertFloatImageOperation,
2520
+ at as InsertSheetDrawingCommand,
2521
+ Ce as MoveDrawingsCommand,
2522
+ ot as RemoveSheetDrawingCommand,
2523
+ Gt as SetDrawingArrangeCommand,
2524
+ ke as SetSheetDrawingCommand,
2525
+ it as SheetCanvasFloatDomManagerService,
2526
+ Vt as SidebarSheetDrawingOperation,
2527
+ xt as UngroupSheetDrawingCommand,
2528
+ Xe as UniverSheetsDrawingUIPlugin
2262
2529
  };