@univerjs/sheets-drawing-ui 0.1.15 → 0.1.17

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