@univerjs/drawing-ui 0.14.0 → 0.15.0

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/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  var Ot = Object.defineProperty;
2
2
  var Dt = (i, r, e) => r in i ? Ot(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
3
3
  var J = (i, r, e) => Dt(i, typeof r != "symbol" ? r + "" : r, e);
4
- import { CommandType as me, ICommandService as ce, LocaleService as te, Inject as Ae, Disposable as He, DrawingTypeEnum as q, UniverInstanceType as Oe, checkIfMove as at, toDisposable as fe, IUniverInstanceService as Fe, ImageSourceType as Ye, Injector as Tt, IConfigService as Et, Plugin as Pt, merge as Nt, ArrangeTypeEnum as _e, generateRandomId as Bt, debounce as Ce } from "@univerjs/core";
5
- import { useDependency as A, ComponentManager as xt, IMessageService as Ut, IGalleryService as jt, IDialogService as At } from "@univerjs/ui";
6
- import { jsx as v, jsxs as P, Fragment as Ht } from "react/jsx-runtime";
7
- import { DropdownMenu as Lt, clsx as Q, borderClassName as kt, MessageType as Xe, Select as st, Button as se, InputNumber as he, Checkbox as $t } from "@univerjs/design";
8
- import { useRef as ot, createElement as F, forwardRef as ee, useState as j, useEffect as we } from "react";
9
- import { getDrawingShapeKeyByDrawingSearch as L, SetDrawingSelectedOperation as De, IDrawingManagerService as re, ImageSourceType as Vt, IImageIoService as ct } from "@univerjs/drawing";
10
- import { Group as pe, DRAWING_OBJECT_LAYER_INDEX as Te, RENDER_CLASS_TYPE as Je, IRenderManagerService as ue, Shape as Gt, Rect as lt, Canvas as Wt, Image as We, precisionTo as Se, CURSOR_TYPE as Ee, Vector2 as $e, degToRad as qe, getGroupState as Zt, transformObjectOutOfGroup as Ft } from "@univerjs/engine-render";
4
+ import { CommandType as me, UniverInstanceType as Oe, ICommandService as ce, LocaleService as te, Inject as Ae, Disposable as He, DrawingTypeEnum as q, checkIfMove as at, toDisposable as fe, IUniverInstanceService as Fe, ImageSourceType as Ye, Injector as Tt, IConfigService as Et, Plugin as Pt, merge as Nt, ArrangeTypeEnum as _e, generateRandomId as Bt, debounce as Ce } from "@univerjs/core";
5
+ import { getDrawingShapeKeyByDrawingSearch as L, SetDrawingSelectedOperation as De, IDrawingManagerService as re, ImageSourceType as xt, IImageIoService as st } from "@univerjs/drawing";
6
+ import { Group as pe, DRAWING_OBJECT_LAYER_INDEX as Te, RENDER_CLASS_TYPE as Xe, IRenderManagerService as ue, Shape as Ut, Rect as ot, Canvas as jt, Image as We, precisionTo as Se, CURSOR_TYPE as Ee, Vector2 as $e, degToRad as Je, getGroupState as At, transformObjectOutOfGroup as Ht } from "@univerjs/engine-render";
7
+ import { useDependency as A, ComponentManager as Lt, IMessageService as kt, IGalleryService as $t, IDialogService as Vt } from "@univerjs/ui";
8
+ import { jsx as v, jsxs as P, Fragment as Gt } from "react/jsx-runtime";
9
+ import { DropdownMenu as Wt, clsx as Q, borderClassName as Zt, MessageType as qe, Select as ct, Button as se, InputNumber as he, Checkbox as Ft } from "@univerjs/design";
10
+ import { useRef as lt, createElement as F, forwardRef as ee, useState as j, useEffect as we } from "react";
11
11
  import { switchMap as zt, of as Kt } from "rxjs";
12
12
  var D = /* @__PURE__ */ ((i) => (i.default = "0", i.left = "1", i.center = "2", i.right = "3", i.top = "4", i.middle = "5", i.bottom = "6", i.horizon = "7", i.vertical = "8", i))(D || {});
13
13
  const ze = {
@@ -32,10 +32,42 @@ const Pe = {
32
32
  id: "sheet.operation.image-reset-size",
33
33
  type: me.OPERATION,
34
34
  handler: (i, r) => !0
35
- }, Yt = "drawing-ui.config", Qe = {}, Xt = "COMPONENT_IMAGE_POPUP_MENU";
35
+ };
36
+ function Qe(i, r, e, t) {
37
+ const n = t.getDrawingByParam(i);
38
+ if (n == null)
39
+ return;
40
+ const s = L(i), a = e.getObject(s);
41
+ if (a && !(a instanceof pe))
42
+ return;
43
+ if (a != null) {
44
+ a.addObject(r);
45
+ return;
46
+ }
47
+ const o = new pe(s);
48
+ e.addObject(o, Te).attachTransformerTo(o), o.addObject(r);
49
+ const { transform: c } = n;
50
+ c && o.transformByState(
51
+ {
52
+ left: c.left,
53
+ top: c.top,
54
+ angle: c.angle
55
+ }
56
+ );
57
+ }
58
+ function gt(i, r) {
59
+ var s;
60
+ const e = r ? i.getUnit(r) : i.getFocusedUnit();
61
+ if (e == null)
62
+ return;
63
+ const t = e.getUnitId();
64
+ let n;
65
+ return e.type === Oe.UNIVER_SHEET ? n = (s = e.getActiveSheet()) == null ? void 0 : s.getSheetId() : (e.type === Oe.UNIVER_DOC || e.type === Oe.UNIVER_SLIDE) && (n = t), { unitId: t, subUnitId: n, current: e };
66
+ }
67
+ const Yt = "drawing-ui.config", et = {}, Xt = "COMPONENT_IMAGE_POPUP_MENU";
36
68
  function z({ ref: i, ...r }) {
37
- const { icon: e, id: t, className: n, extend: s, ...a } = r, o = `univerjs-icon univerjs-icon-${t} ${n || ""}`.trim(), c = ot(`_${Qt()}`);
38
- return gt(e, `${t}`, {
69
+ const { icon: e, id: t, className: n, extend: s, ...a } = r, o = `univerjs-icon univerjs-icon-${t} ${n || ""}`.trim(), c = lt(`_${Qt()}`);
70
+ return dt(e, `${t}`, {
39
71
  defIds: e.defIds,
40
72
  idSuffix: c.current
41
73
  }, {
@@ -44,12 +76,12 @@ function z({ ref: i, ...r }) {
44
76
  ...a
45
77
  }, s);
46
78
  }
47
- function gt(i, r, e, t, n) {
79
+ function dt(i, r, e, t, n) {
48
80
  return F(i.tag, {
49
81
  key: r,
50
82
  ...Jt(i, e, n),
51
83
  ...t
52
- }, (qt(i, e).children || []).map((s, a) => gt(s, `${r}-${i.tag}-${a}`, e, void 0, n)));
84
+ }, (qt(i, e).children || []).map((s, a) => dt(s, `${r}-${i.tag}-${a}`, e, void 0, n)));
53
85
  }
54
86
  function Jt(i, r, e) {
55
87
  const t = { ...i.attrs };
@@ -122,14 +154,14 @@ const er = {
122
154
  }
123
155
  }
124
156
  ]
125
- }, dt = ee(function(r, e) {
157
+ }, ht = ee(function(r, e) {
126
158
  return F(z, Object.assign({}, r, {
127
159
  id: "bottom-icon",
128
160
  ref: e,
129
161
  icon: er
130
162
  }));
131
163
  });
132
- dt.displayName = "BottomIcon";
164
+ ht.displayName = "BottomIcon";
133
165
  const tr = {
134
166
  tag: "svg",
135
167
  attrs: {
@@ -171,14 +203,14 @@ const tr = {
171
203
  }
172
204
  }
173
205
  ]
174
- }, ht = ee(function(r, e) {
206
+ }, ft = ee(function(r, e) {
175
207
  return F(z, Object.assign({}, r, {
176
208
  id: "create-copy-icon",
177
209
  ref: e,
178
210
  icon: tr
179
211
  }));
180
212
  });
181
- ht.displayName = "CreateCopyIcon";
213
+ ft.displayName = "CreateCopyIcon";
182
214
  const rr = {
183
215
  tag: "svg",
184
216
  attrs: {
@@ -197,14 +229,14 @@ const rr = {
197
229
  clipRule: "evenodd"
198
230
  }
199
231
  }]
200
- }, ft = ee(function(r, e) {
232
+ }, pt = ee(function(r, e) {
201
233
  return F(z, Object.assign({}, r, {
202
234
  id: "group-icon",
203
235
  ref: e,
204
236
  icon: rr
205
237
  }));
206
238
  });
207
- ft.displayName = "GroupIcon";
239
+ pt.displayName = "GroupIcon";
208
240
  const nr = {
209
241
  tag: "svg",
210
242
  attrs: {
@@ -223,14 +255,14 @@ const nr = {
223
255
  clipRule: "evenodd"
224
256
  }
225
257
  }]
226
- }, pt = ee(function(r, e) {
258
+ }, mt = ee(function(r, e) {
227
259
  return F(z, Object.assign({}, r, {
228
260
  id: "more-down-icon",
229
261
  ref: e,
230
262
  icon: nr
231
263
  }));
232
264
  });
233
- pt.displayName = "MoreDownIcon";
265
+ mt.displayName = "MoreDownIcon";
234
266
  const ir = {
235
267
  tag: "svg",
236
268
  attrs: {
@@ -255,14 +287,14 @@ const ir = {
255
287
  d: "M5.57564 11.6118C5.80995 11.3774 6.18985 11.3774 6.42417 11.6118L7.3999 12.5875V6.36951C7.3999 6.03814 7.66853 5.76951 7.9999 5.76951C8.33127 5.76951 8.5999 6.03814 8.5999 6.36951V12.5875L9.57564 11.6118C9.80995 11.3774 10.1899 11.3774 10.4242 11.6118C10.6585 11.8461 10.6585 12.226 10.4242 12.4603L8.4324 14.452C8.32324 14.5655 8.16982 14.6362 7.9999 14.6362C7.82998 14.6362 7.67655 14.5655 7.56739 14.452L5.57564 12.4603C5.34132 12.226 5.34132 11.8461 5.57564 11.6118Z"
256
288
  }
257
289
  }]
258
- }, mt = ee(function(r, e) {
290
+ }, wt = ee(function(r, e) {
259
291
  return F(z, Object.assign({}, r, {
260
292
  id: "move-down-icon",
261
293
  ref: e,
262
294
  icon: ir
263
295
  }));
264
296
  });
265
- mt.displayName = "MoveDownIcon";
297
+ wt.displayName = "MoveDownIcon";
266
298
  const ar = {
267
299
  tag: "svg",
268
300
  attrs: {
@@ -287,14 +319,14 @@ const ar = {
287
319
  d: "M5.57564 4.38825C5.80995 4.62256 6.18985 4.62256 6.42417 4.38825L7.3999 3.41251V9.63049C7.3999 9.96186 7.66853 10.2305 7.9999 10.2305C8.33127 10.2305 8.5999 9.96186 8.5999 9.63049V3.41251L9.57564 4.38825C9.80995 4.62256 10.1899 4.62256 10.4242 4.38825C10.6585 4.15393 10.6585 3.77403 10.4242 3.53972L8.4324 1.54796C8.32324 1.43445 8.16982 1.36382 7.9999 1.36382C7.82998 1.36382 7.67655 1.43446 7.56739 1.54797L5.57564 3.53972C5.34132 3.77403 5.34132 4.15393 5.57564 4.38825Z"
288
320
  }
289
321
  }]
290
- }, wt = ee(function(r, e) {
322
+ }, vt = ee(function(r, e) {
291
323
  return F(z, Object.assign({}, r, {
292
324
  id: "move-up-icon",
293
325
  ref: e,
294
326
  icon: ar
295
327
  }));
296
328
  });
297
- wt.displayName = "MoveUpIcon";
329
+ vt.displayName = "MoveUpIcon";
298
330
  const sr = {
299
331
  tag: "svg",
300
332
  attrs: {
@@ -331,14 +363,14 @@ const sr = {
331
363
  }
332
364
  }
333
365
  ]
334
- }, vt = ee(function(r, e) {
366
+ }, _t = ee(function(r, e) {
335
367
  return F(z, Object.assign({}, r, {
336
368
  id: "topmost-icon",
337
369
  ref: e,
338
370
  icon: sr
339
371
  }));
340
372
  });
341
- vt.displayName = "TopmostIcon";
373
+ _t.displayName = "TopmostIcon";
342
374
  const or = {
343
375
  tag: "svg",
344
376
  attrs: {
@@ -363,14 +395,14 @@ const or = {
363
395
  clipRule: "evenodd"
364
396
  }
365
397
  }]
366
- }, _t = ee(function(r, e) {
398
+ }, Ct = ee(function(r, e) {
367
399
  return F(z, Object.assign({}, r, {
368
400
  id: "ungroup-icon",
369
401
  ref: e,
370
402
  icon: or
371
403
  }));
372
404
  });
373
- _t.displayName = "UngroupIcon";
405
+ Ct.displayName = "UngroupIcon";
374
406
  const cr = {
375
407
  tag: "svg",
376
408
  attrs: {
@@ -416,14 +448,14 @@ const cr = {
416
448
  }
417
449
  }
418
450
  ]
419
- }, Ct = ee(function(r, e) {
451
+ }, St = ee(function(r, e) {
420
452
  return F(z, Object.assign({}, r, {
421
453
  id: "autofill-double-icon",
422
454
  ref: e,
423
455
  icon: cr
424
456
  }));
425
457
  });
426
- Ct.displayName = "AutofillDoubleIcon";
458
+ St.displayName = "AutofillDoubleIcon";
427
459
  function lr(i) {
428
460
  var h;
429
461
  const { popup: r } = i, e = (h = r == null ? void 0 : r.extraProps) == null ? void 0 : h.menuItems;
@@ -443,7 +475,7 @@ function lr(i) {
443
475
  onMouseEnter: u,
444
476
  onMouseLeave: l,
445
477
  children: /* @__PURE__ */ v(
446
- Lt,
478
+ Wt,
447
479
  {
448
480
  align: "start",
449
481
  items: w.map((p) => ({
@@ -456,18 +488,18 @@ function lr(i) {
456
488
  children: /* @__PURE__ */ P(
457
489
  "div",
458
490
  {
459
- className: Q("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", kt, {
491
+ className: Q("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", Zt, {
460
492
  "univer-bg-gray-100 dark:!univer-bg-gray-800": s,
461
493
  "univer-bg-white dark:!univer-bg-gray-900": !s
462
494
  }),
463
495
  children: [
464
496
  /* @__PURE__ */ v(
465
- Ct,
497
+ St,
466
498
  {
467
499
  className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white"
468
500
  }
469
501
  ),
470
- f && /* @__PURE__ */ v(pt, { className: "dark:!univer-text-white" })
502
+ f && /* @__PURE__ */ v(mt, { className: "dark:!univer-text-white" })
471
503
  ]
472
504
  }
473
505
  )
@@ -480,7 +512,7 @@ var ur = Object.getOwnPropertyDescriptor, gr = (i, r, e, t) => {
480
512
  for (var n = t > 1 ? void 0 : t ? ur(r, e) : r, s = i.length - 1, a; s >= 0; s--)
481
513
  (a = i[s]) && (n = a(n) || n);
482
514
  return n;
483
- }, et = (i, r) => (e, t) => r(e, t, i);
515
+ }, tt = (i, r) => (e, t) => r(e, t, i);
484
516
  let Ne = class extends He {
485
517
  constructor(i, r) {
486
518
  super(), this._componentManager = i, this._commandService = r, this._init();
@@ -503,8 +535,8 @@ let Ne = class extends He {
503
535
  }
504
536
  };
505
537
  Ne = gr([
506
- et(0, Ae(xt)),
507
- et(1, ce)
538
+ tt(0, Ae(Lt)),
539
+ tt(1, ce)
508
540
  ], Ne);
509
541
  function Le(i, r) {
510
542
  const e = [];
@@ -528,37 +560,6 @@ function Le(i, r) {
528
560
  w === q.DRAWING_IMAGE && (h.srcRect = t.srcRect), e.push(h);
529
561
  }), e;
530
562
  }
531
- function tt(i, r, e, t) {
532
- const n = t.getDrawingByParam(i);
533
- if (n == null)
534
- return;
535
- const s = L(i), a = e.getObject(s);
536
- if (a && !(a instanceof pe))
537
- return;
538
- if (a != null) {
539
- a.addObject(r);
540
- return;
541
- }
542
- const o = new pe(s);
543
- e.addObject(o, Te).attachTransformerTo(o), o.addObject(r);
544
- const { transform: c } = n;
545
- c && o.transformByState(
546
- {
547
- left: c.left,
548
- top: c.top,
549
- angle: c.angle
550
- }
551
- );
552
- }
553
- function St(i, r) {
554
- var s;
555
- const e = r ? i.getUnit(r) : i.getFocusedUnit();
556
- if (e == null)
557
- return;
558
- const t = e.getUnitId();
559
- let n;
560
- return e.type === Oe.UNIVER_SHEET ? n = (s = e.getActiveSheet()) == null ? void 0 : s.getSheetId() : (e.type === Oe.UNIVER_DOC || e.type === Oe.UNIVER_SLIDE) && (n = t), { unitId: t, subUnitId: n, current: e };
561
- }
562
563
  var dr = Object.getOwnPropertyDescriptor, hr = (i, r, e, t) => {
563
564
  for (var n = t > 1 ? void 0 : t ? dr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
564
565
  (a = i[s]) && (n = a(n) || n);
@@ -577,7 +578,7 @@ let Be = class extends He {
577
578
  this._recoveryImages(), this._drawingAddListener(), this._drawingRemoveListener(), this._drawingUpdateListener(), this._commandExecutedListener(), this._drawingArrangeListener(), this._drawingGroupListener(), this._drawingRefreshListener(), this._drawingVisibleListener();
578
579
  }
579
580
  _recoveryImages() {
580
- const r = this._drawingManagerService.drawingManagerData, e = St(this._currentUniverService);
581
+ const r = this._drawingManagerService.drawingManagerData, e = gt(this._currentUniverService);
581
582
  if (e == null)
582
583
  return;
583
584
  const { unitId: t, subUnitId: n } = e;
@@ -660,7 +661,7 @@ let Be = class extends He {
660
661
  return;
661
662
  l.push(h);
662
663
  const { transform: p } = f;
663
- p != null && (h.classType === Je.GROUP ? h.transformByState({ left: p.left, top: p.top }) : h.transformByState(p));
664
+ p != null && (h.classType === Xe.GROUP ? h.transformByState({ left: p.left, top: p.top }) : h.transformByState(p));
664
665
  }), l.length === 0)
665
666
  return;
666
667
  const g = L({ unitId: n, subUnitId: s, drawingId: a }), d = new pe(g);
@@ -717,7 +718,7 @@ let Be = class extends He {
717
718
  if (f == null)
718
719
  return;
719
720
  const { transform: w } = g;
720
- w != null && (f.classType === Je.GROUP ? f.transformByState({ left: w.left, top: w.top }) : f.transformByState(w));
721
+ w != null && (f.classType === Xe.GROUP ? f.transformByState({ left: w.left, top: w.top }) : f.transformByState(w));
721
722
  });
722
723
  const o = L(e), c = s.getObject(o), { width: u, height: l } = c;
723
724
  c.getObjects().forEach((g) => {
@@ -1012,7 +1013,7 @@ Be = hr([
1012
1013
  be(2, ue),
1013
1014
  be(3, re)
1014
1015
  ], Be);
1015
- class Ie extends Gt {
1016
+ class Ie extends Ut {
1016
1017
  constructor(e, t) {
1017
1018
  t == null && (t = {}), t.transformerConfig = {
1018
1019
  keepRatio: !1,
@@ -1055,7 +1056,7 @@ class Ie extends Gt {
1055
1056
  const n = this.getScene().getEngine(), { width: s, height: a } = n;
1056
1057
  this._initialCacheCanvas(), (c = this._cacheCanvas) == null || c.clear();
1057
1058
  const o = (u = this._cacheCanvas) == null ? void 0 : u.getContext();
1058
- o != null && (o.save(), lt.drawWith(o, {
1059
+ o != null && (o.save(), ot.drawWith(o, {
1059
1060
  left: 0,
1060
1061
  top: 0,
1061
1062
  width: s,
@@ -1099,7 +1100,7 @@ class Ie extends Gt {
1099
1100
  return;
1100
1101
  const e = this.getScene();
1101
1102
  if (e == null) return;
1102
- this._cacheCanvas = new Wt();
1103
+ this._cacheCanvas = new jt();
1103
1104
  const t = e.getEngine();
1104
1105
  this._cacheCanvas.setSize(t.width, t.height), t.onTransformChange$.subscribeEvent(() => {
1105
1106
  var n;
@@ -1139,7 +1140,7 @@ let xe = class extends He {
1139
1140
  const d = L({ unitId: a, subUnitId: o, drawingId: c }), f = l.getObject(d);
1140
1141
  if (!(f instanceof We)) {
1141
1142
  this._messageService.show({
1142
- type: Xe.Error,
1143
+ type: qe.Error,
1143
1144
  content: this._localeService.t("image-cropper.error")
1144
1145
  });
1145
1146
  return;
@@ -1222,7 +1223,7 @@ let xe = class extends He {
1222
1223
  return;
1223
1224
  if (!(l instanceof We)) {
1224
1225
  this._messageService.show({
1225
- type: Xe.Error,
1226
+ type: qe.Error,
1226
1227
  content: this._localeService.t("image-cropper.error")
1227
1228
  });
1228
1229
  return;
@@ -1349,9 +1350,9 @@ let xe = class extends He {
1349
1350
  }, _ = { ...C };
1350
1351
  if (f !== 0) {
1351
1352
  const b = t + a / 2, R = n + s / 2, T = new $e(b, R), S = g / 2 + u, I = d / 2 + l, y = new $e(S, I), O = new $e(u, l);
1352
- O.rotateByPoint(qe(f), y);
1353
+ O.rotateByPoint(Je(f), y);
1353
1354
  const M = O.clone();
1354
- M.rotateByPoint(qe(-f), T);
1355
+ M.rotateByPoint(Je(-f), T);
1355
1356
  const N = t - M.x, B = n - M.y;
1356
1357
  _.left = N, _.top = B, _.right = g - N - a, _.bottom = d - B - s;
1357
1358
  }
@@ -1366,7 +1367,7 @@ xe = pr([
1366
1367
  le(1, re),
1367
1368
  le(2, ue),
1368
1369
  le(3, Fe),
1369
- le(4, Ut),
1370
+ le(4, kt),
1370
1371
  le(5, Ae(te))
1371
1372
  ], xe);
1372
1373
  var mr = Object.getOwnPropertyDescriptor, wr = (i, r, e, t) => {
@@ -1408,7 +1409,7 @@ let Ue = class {
1408
1409
  if (ve != null)
1409
1410
  Y.image = ve;
1410
1411
  else {
1411
- if (s === Vt.UUID)
1412
+ if (s === xt.UUID)
1412
1413
  try {
1413
1414
  Y.url = await this._imageIoService.getImage(n);
1414
1415
  } catch (ke) {
@@ -1423,7 +1424,7 @@ let Ue = class {
1423
1424
  continue;
1424
1425
  Y.printable = !0;
1425
1426
  const $ = new We(N, Y);
1426
- ne && this._imageIoService.addImageSourceCache(n, s, $.getNative()), this._drawingManagerService.getDrawingVisible() && (r.addObject($, Te), this._drawingManagerService.getDrawingEditable() && r.attachTransformerTo($), c && tt({ drawingId: c, unitId: u, subUnitId: l }, $, r, this._drawingManagerService), o != null && $.setPrstGeom(o), a != null && $.setSrcRect(a), h.push($));
1427
+ ne && this._imageIoService.addImageSourceCache(n, s, $.getNative()), this._drawingManagerService.getDrawingVisible() && (r.addObject($, Te), this._drawingManagerService.getDrawingEditable() && r.attachTransformerTo($), c && Qe({ drawingId: c, unitId: u, subUnitId: l }, $, r, this._drawingManagerService), o != null && $.setPrstGeom(o), a != null && $.setSrcRect(a), h.push($));
1427
1428
  }
1428
1429
  return h;
1429
1430
  }
@@ -1451,18 +1452,15 @@ let Ue = class {
1451
1452
  if (r.getObject(I))
1452
1453
  continue;
1453
1454
  N.printable = !1;
1454
- const B = new lt(I, N);
1455
- this._drawingManagerService.getDrawingVisible() && (r.addObject(B, Te), this._drawingManagerService.getDrawingEditable() && i.allowTransform !== !1 && r.attachTransformerTo(B), n && tt({ drawingId: n, unitId: s, subUnitId: a }, B, r, this._drawingManagerService), g.push(B));
1455
+ const B = new ot(I, N);
1456
+ this._drawingManagerService.getDrawingVisible() && (r.addObject(B, Te), this._drawingManagerService.getDrawingEditable() && i.allowTransform !== !1 && r.attachTransformerTo(B), n && Qe({ drawingId: n, unitId: s, subUnitId: a }, B, r, this._drawingManagerService), g.push(B));
1456
1457
  }
1457
1458
  return g;
1458
1459
  }
1459
1460
  renderDrawing(i, r) {
1460
1461
  const e = this._drawingManagerService.getDrawingByParam(i);
1461
- if (e != null)
1462
- switch (e.drawingType) {
1463
- case q.DRAWING_IMAGE:
1464
- return this.renderImages(e, r);
1465
- }
1462
+ if (e != null && e.drawingType === q.DRAWING_IMAGE)
1463
+ return this.renderImages(e, r);
1466
1464
  }
1467
1465
  previewImage(i, r, e, t) {
1468
1466
  this._galleryService.open({
@@ -1487,8 +1485,8 @@ let Ue = class {
1487
1485
  };
1488
1486
  Ue = wr([
1489
1487
  Ve(0, re),
1490
- Ve(1, ct),
1491
- Ve(2, jt)
1488
+ Ve(1, st),
1489
+ Ve(2, $t)
1492
1490
  ], Ue);
1493
1491
  var vr = Object.getOwnPropertyDescriptor, _r = (i, r, e, t) => {
1494
1492
  for (var n = t > 1 ? void 0 : t ? vr(r, e) : r, s = i.length - 1, a; s >= 0; s--)
@@ -1567,7 +1565,7 @@ let je = class extends He {
1567
1565
  _insertImages(i) {
1568
1566
  i.forEach(async (r) => {
1569
1567
  var c;
1570
- const { unitId: e, subUnitId: t } = r, n = this._getSceneAndTransformerByDrawingSearch(e), s = (c = St(this._currentUniverService, e)) == null ? void 0 : c.subUnitId;
1568
+ const { unitId: e, subUnitId: t } = r, n = this._getSceneAndTransformerByDrawingSearch(e), s = (c = gt(this._currentUniverService, e)) == null ? void 0 : c.subUnitId;
1571
1569
  if (n == null || s !== t)
1572
1570
  return;
1573
1571
  const a = this._drawingManagerService.getDrawingByParam(r);
@@ -1633,8 +1631,8 @@ je = _r([
1633
1631
  ae(0, ce),
1634
1632
  ae(1, ue),
1635
1633
  ae(2, re),
1636
- ae(3, At),
1637
- ae(4, ct),
1634
+ ae(3, Vt),
1635
+ ae(4, st),
1638
1636
  ae(5, Fe),
1639
1637
  ae(6, Ae(Ue))
1640
1638
  ], je);
@@ -1646,11 +1644,11 @@ var Cr = Object.getOwnPropertyDescriptor, Sr = (i, r, e, t) => {
1646
1644
  const br = "UNIVER_DRAWING_UI_PLUGIN";
1647
1645
  var Ge;
1648
1646
  let nt = (Ge = class extends Pt {
1649
- constructor(i = Qe, r, e) {
1647
+ constructor(i = et, r, e) {
1650
1648
  super(), this._config = i, this._injector = r, this._configService = e;
1651
1649
  const { menu: t, ...n } = Nt(
1652
1650
  {},
1653
- Qe,
1651
+ et,
1654
1652
  this._config
1655
1653
  );
1656
1654
  t && this._configService.setConfig("menu", t, { merge: !0 }), this._configService.setConfig(Yt, n);
@@ -1749,7 +1747,7 @@ const Ir = (i) => {
1749
1747
  "div",
1750
1748
  {
1751
1749
  className: "univer-w-full univer-text-gray-900 dark:!univer-text-white",
1752
- children: /* @__PURE__ */ v(st, { value: n, options: a, onChange: o })
1750
+ children: /* @__PURE__ */ v(ct, { value: n, options: a, onChange: o })
1753
1751
  }
1754
1752
  ) })
1755
1753
  ]
@@ -1787,25 +1785,25 @@ const Ir = (i) => {
1787
1785
  /* @__PURE__ */ P(se, { onClick: () => {
1788
1786
  o(_e.forward);
1789
1787
  }, children: [
1790
- /* @__PURE__ */ v(wt, {}),
1788
+ /* @__PURE__ */ v(vt, {}),
1791
1789
  t.t("image-panel.arrange.forward")
1792
1790
  ] }),
1793
1791
  /* @__PURE__ */ P(se, { onClick: () => {
1794
1792
  o(_e.backward);
1795
1793
  }, children: [
1796
- /* @__PURE__ */ v(mt, {}),
1794
+ /* @__PURE__ */ v(wt, {}),
1797
1795
  t.t("image-panel.arrange.backward")
1798
1796
  ] }),
1799
1797
  /* @__PURE__ */ P(se, { onClick: () => {
1800
1798
  o(_e.front);
1801
1799
  }, children: [
1802
- /* @__PURE__ */ v(vt, {}),
1800
+ /* @__PURE__ */ v(_t, {}),
1803
1801
  t.t("image-panel.arrange.front")
1804
1802
  ] }),
1805
1803
  /* @__PURE__ */ P(se, { onClick: () => {
1806
1804
  o(_e.back);
1807
1805
  }, children: [
1808
- /* @__PURE__ */ v(dt, {}),
1806
+ /* @__PURE__ */ v(ht, {}),
1809
1807
  t.t("image-panel.arrange.back")
1810
1808
  ] })
1811
1809
  ] })
@@ -1814,7 +1812,7 @@ const Ir = (i) => {
1814
1812
  );
1815
1813
  }, Mr = (i) => {
1816
1814
  const r = A(te), e = A(ue), t = A(re), { hasGroup: n, drawings: s } = i, [a, o] = j(!1), [c, u] = j(!0), [l, g] = j(!0), d = () => {
1817
- const h = t.getFocusDrawings(), { unitId: p, subUnitId: C } = h[0], _ = Bt(10), b = Zt(0, 0, h.map((S) => S.transform || {})), R = {
1815
+ const h = t.getFocusDrawings(), { unitId: p, subUnitId: C } = h[0], _ = Bt(10), b = At(0, 0, h.map((S) => S.transform || {})), R = {
1818
1816
  unitId: p,
1819
1817
  subUnitId: C,
1820
1818
  drawingId: _,
@@ -1848,7 +1846,7 @@ const Ir = (i) => {
1848
1846
  if (R.length === 0)
1849
1847
  return;
1850
1848
  const T = R.map((S) => {
1851
- const { transform: I } = S, { unitId: y, subUnitId: O, drawingId: M } = S, N = Ft(I || {}, b, b.width || 0, b.height || 0);
1849
+ const { transform: I } = S, { unitId: y, subUnitId: O, drawingId: M } = S, N = Ht(I || {}, b, b.width || 0, b.height || 0);
1852
1850
  return {
1853
1851
  unitId: y,
1854
1852
  subUnitId: O,
@@ -1910,7 +1908,7 @@ const Ir = (i) => {
1910
1908
  }),
1911
1909
  onClick: d,
1912
1910
  children: [
1913
- /* @__PURE__ */ v(ft, {}),
1911
+ /* @__PURE__ */ v(pt, {}),
1914
1912
  r.t("image-panel.group.group")
1915
1913
  ]
1916
1914
  }
@@ -1923,7 +1921,7 @@ const Ir = (i) => {
1923
1921
  }),
1924
1922
  onClick: w,
1925
1923
  children: [
1926
- /* @__PURE__ */ v(_t, {}),
1924
+ /* @__PURE__ */ v(Ct, {}),
1927
1925
  r.t("image-panel.group.unGroup")
1928
1926
  ]
1929
1927
  }
@@ -2111,7 +2109,7 @@ const Ir = (i) => {
2111
2109
  ] }),
2112
2110
  /* @__PURE__ */ P("div", { children: [
2113
2111
  /* @__PURE__ */ v("span", { children: r.t("image-panel.transform.lock") }),
2114
- /* @__PURE__ */ v("div", { className: "univer-text-center", children: /* @__PURE__ */ v($t, { checked: Y, onChange: Rt }) })
2112
+ /* @__PURE__ */ v("div", { className: "univer-text-center", children: /* @__PURE__ */ v(Ft, { checked: Y, onChange: Rt }) })
2115
2113
  ] })
2116
2114
  ]
2117
2115
  }
@@ -2156,7 +2154,7 @@ const Ir = (i) => {
2156
2154
  const r = A(ce), e = A(te), { drawings: t, cropperShow: n } = i;
2157
2155
  if (t[0] == null)
2158
2156
  return;
2159
- const [a, o] = j(x.FREE), c = ot(!1), u = [
2157
+ const [a, o] = j(x.FREE), c = lt(!1), u = [
2160
2158
  {
2161
2159
  label: e.t("image-panel.crop.mode"),
2162
2160
  value: x.FREE
@@ -2237,10 +2235,10 @@ const Ir = (i) => {
2237
2235
  /* @__PURE__ */ P(se, { onClick: () => {
2238
2236
  g(a);
2239
2237
  }, children: [
2240
- /* @__PURE__ */ v(ht, {}),
2238
+ /* @__PURE__ */ v(ft, {}),
2241
2239
  e.t("image-panel.crop.start")
2242
2240
  ] }),
2243
- /* @__PURE__ */ v(st, { value: a, options: u, onChange: l })
2241
+ /* @__PURE__ */ v(ct, { value: a, options: u, onChange: l })
2244
2242
  ] })
2245
2243
  ]
2246
2244
  }
@@ -2265,7 +2263,7 @@ const Ir = (i) => {
2265
2263
  return () => {
2266
2264
  M.unsubscribe(), O.unsubscribe(), N.unsubscribe();
2267
2265
  };
2268
- }, []), /* @__PURE__ */ P(Ht, { children: [
2266
+ }, []), /* @__PURE__ */ P(Gt, { children: [
2269
2267
  /* @__PURE__ */ v(
2270
2268
  "div",
2271
2269
  {
@@ -2294,5 +2292,7 @@ export {
2294
2292
  Ze as OpenImageCropOperation,
2295
2293
  ze as SetDrawingAlignOperation,
2296
2294
  nt as UniverDrawingUIPlugin,
2297
- Le as getUpdateParams
2295
+ gt as getCurrentUnitInfo,
2296
+ Le as getUpdateParams,
2297
+ Qe as insertGroupObject
2298
2298
  };
@@ -18,6 +18,7 @@ export { SetDrawingAlignOperation } from './commands/operations/drawing-align.op
18
18
  export { AutoImageCropOperation, CloseImageCropOperation, OpenImageCropOperation } from './commands/operations/image-crop.operation';
19
19
  export { ImageResetSizeOperation } from './commands/operations/image-reset-size.operation';
20
20
  export type { IUniverDrawingUIConfig } from './controllers/config.schema';
21
+ export { getCurrentUnitInfo, insertGroupObject } from './controllers/utils';
21
22
  export { UniverDrawingUIPlugin } from './plugin';
22
23
  export { DrawingRenderService } from './services/drawing-render.service';
23
24
  export { getUpdateParams } from './utils/get-update-params';