@univerjs/sheets-drawing-ui 0.2.6 → 0.2.8

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.
Files changed (40) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +164 -140
  3. package/lib/types/basics/transform-position.d.ts +0 -1
  4. package/lib/types/commands/commands/delete-drawings.command.d.ts +0 -1
  5. package/lib/types/commands/commands/group-sheet-drawing.command.d.ts +0 -1
  6. package/lib/types/commands/commands/insert-sheet-drawing.command.d.ts +0 -1
  7. package/lib/types/commands/commands/interfaces.d.ts +0 -1
  8. package/lib/types/commands/commands/move-drawings.command.d.ts +0 -1
  9. package/lib/types/commands/commands/remove-sheet-drawing.command.d.ts +0 -1
  10. package/lib/types/commands/commands/set-drawing-arrange.command.d.ts +0 -1
  11. package/lib/types/commands/commands/set-sheet-drawing.command.d.ts +0 -1
  12. package/lib/types/commands/commands/ungroup-sheet-drawing.command.d.ts +0 -1
  13. package/lib/types/commands/commands/utils.d.ts +0 -1
  14. package/lib/types/commands/operations/clear-drawing-transformer.operation.d.ts +0 -1
  15. package/lib/types/commands/operations/edit-sheet-drawing.operation.d.ts +0 -1
  16. package/lib/types/commands/operations/insert-image.operation.d.ts +0 -1
  17. package/lib/types/commands/operations/open-drawing-panel.operation.d.ts +0 -1
  18. package/lib/types/controllers/drawing-popup-menu.controller.d.ts +0 -1
  19. package/lib/types/controllers/render-controllers/sheet-drawing.render-controller.d.ts +11 -0
  20. package/lib/types/controllers/sheet-drawing-copy-paste.controller.d.ts +0 -1
  21. package/lib/types/controllers/sheet-drawing-permission.controller.d.ts +0 -1
  22. package/lib/types/controllers/sheet-drawing-printing.controller.d.ts +0 -1
  23. package/lib/types/controllers/sheet-drawing-transform-affected.controller.d.ts +0 -1
  24. package/lib/types/controllers/sheet-drawing-update.controller.d.ts +2 -3
  25. package/lib/types/controllers/sheet-drawing.controller.d.ts +0 -1
  26. package/lib/types/controllers/shortcuts/drawing.shortcut.d.ts +0 -1
  27. package/lib/types/index.d.ts +1 -0
  28. package/lib/types/locale/en-US.d.ts +0 -1
  29. package/lib/types/locale/ru-RU.d.ts +0 -1
  30. package/lib/types/locale/vi-VN.d.ts +0 -1
  31. package/lib/types/locale/zh-TW.d.ts +0 -1
  32. package/lib/types/plugin.d.ts +0 -1
  33. package/lib/types/services/canvas-float-dom-manager.service.d.ts +1 -2
  34. package/lib/types/views/menu/image.menu.d.ts +1 -1
  35. package/lib/types/views/sheet-image-panel/SheetDrawingAnchor.d.ts +0 -1
  36. package/lib/types/views/sheet-image-panel/SheetDrawingPanel.d.ts +0 -1
  37. package/lib/types/views/upload-component/UploadFile.d.ts +0 -1
  38. package/lib/types/views/upload-loading/UploadLoading.d.ts +0 -1
  39. package/lib/umd/index.js +1 -1
  40. package/package.json +23 -23
package/lib/es/index.js CHANGED
@@ -2,13 +2,13 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { CommandType, ICommandService, IUndoRedoService, LocaleService, IUniverInstanceService, useDependency, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, OnLifecycle, LifecycleStages, Inject, Injector, IContextService, Disposable, Direction, FOCUSING_FORMULA_EDITOR, EDITOR_ACTIVATED, Rectangle, DrawingTypeEnum as DrawingTypeEnum$1, DisposableCollection, Tools, UserManagerService, IPermissionService, Plugin, DependentOn } from "@univerjs/core";
5
+ import { CommandType, ICommandService, IUndoRedoService, LocaleService, IUniverInstanceService, useDependency, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, OnLifecycle, LifecycleStages, Inject, Injector, IContextService, Disposable, Direction, FOCUSING_FX_BAR_EDITOR, EDITOR_ACTIVATED, Rectangle, DrawingTypeEnum as DrawingTypeEnum$1, DisposableCollection, generateRandomId, Tools, UserManagerService, IPermissionService, LifecycleService, Plugin, DependentOn } from "@univerjs/core";
6
6
  import { ImageCropperObject, COMPONENT_IMAGE_POPUP_MENU, OpenImageCropOperation, ImageResetSizeOperation, DrawingCommonPanel, DrawingRenderService, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
7
7
  import { ISheetDrawingService, SetDrawingApplyMutation, DrawingApplyType, SheetDrawingAnchorType, UniverSheetsDrawingPlugin } from "@univerjs/sheets-drawing";
8
8
  import { IDrawingManagerService, IImageIoService, ArrangeTypeEnum, DrawingTypeEnum, DRAWING_IMAGE_COUNT_LIMIT, ImageUploadStatusType, DRAWING_IMAGE_ALLOW_SIZE, getImageSize, DRAWING_IMAGE_WIDTH_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_ALLOW_IMAGE_LIST, getDrawingShapeKeyByDrawingSearch, UniverDrawingPlugin } from "@univerjs/drawing";
9
- import { IRenderManagerService, getGroupState, transformObjectOutOfGroup, precisionTo, Rect, DRAWING_OBJECT_LAYER_INDEX, SHEET_VIEWPORT_KEY, RENDER_CLASS_TYPE } from "@univerjs/engine-render";
9
+ import { IRenderManagerService, getGroupState, transformObjectOutOfGroup, precisionTo, Rect, DRAWING_OBJECT_LAYER_INDEX, pxToNum, SHEET_VIEWPORT_KEY, RENDER_CLASS_TYPE } from "@univerjs/engine-render";
10
10
  import { SheetCanvasPopManagerService, attachRangeWithCoord, SheetSkeletonManagerService, ISheetSelectionRenderService, getCurrentRangeDisable$, SetScrollOperation, SetZoomRatioOperation, SheetPrintInterceptorService, COPY_TYPE, PREDEFINED_HOOK_NAME, virtualizeDiscreteRanges, ISheetClipboardService } from "@univerjs/sheets-ui";
11
- import { takeUntil, Subject, BehaviorSubject, combineLatest, map, filter, distinctUntilChanged } from "rxjs";
11
+ import { takeUntil, Subject, BehaviorSubject, combineLatest, map, filter, distinctUntilChanged, first } from "rxjs";
12
12
  import { ISidebarService, BuiltInUIPart, IUIPartsService, IMessageService, MenuItemType, MenuPosition, MenuGroup, getMenuHiddenObservable, KeyCode, ComponentManager, IMenuService, IShortcutService, CanvasFloatDomService } from "@univerjs/ui";
13
13
  import { getSheetCommandTarget, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, InsertRowCommand, InsertColCommand, RemoveRowCommand, RemoveColCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, DeltaRowHeightCommand, SetRowHeightCommand, DeltaColumnWidthCommand, SetColWidthCommand, SetRowHiddenCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand, SetColHiddenCommand, SetRowVisibleMutation, SetRowHiddenMutation, SetColVisibleMutation, SetColHiddenMutation, SetWorksheetRowHeightMutation, SetWorksheetColWidthMutation, SetWorksheetActiveOperation, SheetInterceptorService, SetFrozenMutation, WorkbookViewPermission, WorksheetViewPermission } from "@univerjs/sheets";
14
14
  import React, { useEffect, forwardRef, useRef, createElement, useState } from "react";
@@ -20,8 +20,8 @@ const ClearSheetDrawingTransformerOperation = {
20
20
  handler: /* @__PURE__ */ __name((accessor, params) => {
21
21
  const renderManagerService = accessor.get(IRenderManagerService);
22
22
  return params.forEach((unitId) => {
23
- var _a10, _b;
24
- (_b = (_a10 = renderManagerService.getRenderById(unitId)) == null ? void 0 : _a10.scene.getTransformer()) == null || _b.debounceRefreshControls();
23
+ var _a11, _b;
24
+ (_b = (_a11 = renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.scene.getTransformer()) == null || _b.debounceRefreshControls();
25
25
  }), !0;
26
26
  }, "handler")
27
27
  }, RemoveSheetDrawingCommand = {
@@ -96,11 +96,11 @@ const ClearSheetDrawingTransformerOperation = {
96
96
  };
97
97
  }, [imageIoService]), /* @__PURE__ */ React.createElement("div", { style: { display: remain > 0 ? "block" : "none" }, className: styles$2.uploadLoading }, /* @__PURE__ */ React.createElement("div", { className: styles$2.uploadLoadingBody }, /* @__PURE__ */ React.createElement("div", { className: styles$2.uploadLoadingBodyAnimation }), /* @__PURE__ */ React.createElement("div", { className: styles$2.uploadLoadingBodyText }, `${localeService.t("uploadLoading.loading")}: ${remain}`)));
98
98
  }, "UploadLoading");
99
- var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
100
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
99
+ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
100
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
101
101
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
102
- return kind && result && __defProp$8(target, key, result), result;
103
- }, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a;
102
+ return kind && result && __defProp$9(target, key, result), result;
103
+ }, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a;
104
104
  let DrawingPopupMenuController = (_a = class extends RxDisposable {
105
105
  constructor(_injector, _drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _uiPartsService) {
106
106
  super();
@@ -128,8 +128,8 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
128
128
  return !1;
129
129
  }
130
130
  _popupMenuListener(unitId) {
131
- var _a10;
132
- const scene = (_a10 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a10.scene;
131
+ var _a11;
132
+ const scene = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.scene;
133
133
  if (!scene)
134
134
  return;
135
135
  const transformer = scene.getTransformerByCreate();
@@ -210,15 +210,15 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
210
210
  ];
211
211
  }
212
212
  }, __name(_a, "DrawingPopupMenuController"), _a);
213
- DrawingPopupMenuController = __decorateClass$8([
213
+ DrawingPopupMenuController = __decorateClass$9([
214
214
  OnLifecycle(LifecycleStages.Steady, DrawingPopupMenuController),
215
- __decorateParam$8(0, Inject(Injector)),
216
- __decorateParam$8(1, IDrawingManagerService),
217
- __decorateParam$8(2, Inject(SheetCanvasPopManagerService)),
218
- __decorateParam$8(3, IRenderManagerService),
219
- __decorateParam$8(4, IUniverInstanceService),
220
- __decorateParam$8(5, IContextService),
221
- __decorateParam$8(6, Inject(IUIPartsService))
215
+ __decorateParam$9(0, Inject(Injector)),
216
+ __decorateParam$9(1, IDrawingManagerService),
217
+ __decorateParam$9(2, Inject(SheetCanvasPopManagerService)),
218
+ __decorateParam$9(3, IRenderManagerService),
219
+ __decorateParam$9(4, IUniverInstanceService),
220
+ __decorateParam$9(5, IContextService),
221
+ __decorateParam$9(6, Inject(IUIPartsService))
222
222
  ], DrawingPopupMenuController);
223
223
  const InsertFloatImageOperation = {
224
224
  id: "sheet.operation.insert-float-image",
@@ -402,7 +402,7 @@ const GroupSheetDrawingCommand = {
402
402
  }, "handler")
403
403
  };
404
404
  function drawingPositionToTransform(position, selectionRenderService, sheetSkeletonManagerService) {
405
- const { from, to, flipY = !1, flipX = !1, angle = 0, skewX = 0, skewY = 0 } = position, { column: fromColumn, columnOffset: fromColumnOffset, row: fromRow, rowOffset: fromRowOffset } = from, { column: toColumn, columnOffset: toColumnOffset, row: toRow, rowOffset: toRowOffset } = to, startSelectionCell = sheetSkeletonManagerService.attachRangeWithCoord({
405
+ const { from, to, flipY = !1, flipX = !1, angle = 0, skewX = 0, skewY = 0 } = position, { column: fromColumn, columnOffset: fromColumnOffset, row: fromRow, rowOffset: fromRowOffset } = from, { column: toColumn, columnOffset: toColumnOffset, row: toRow, rowOffset: toRowOffset } = to, skeleton = sheetSkeletonManagerService.getCurrentSkeleton(), startSelectionCell = attachRangeWithCoord(skeleton, {
406
406
  startColumn: fromColumn,
407
407
  endColumn: fromColumn,
408
408
  startRow: fromRow,
@@ -410,7 +410,7 @@ function drawingPositionToTransform(position, selectionRenderService, sheetSkele
410
410
  });
411
411
  if (startSelectionCell == null)
412
412
  return;
413
- const endSelectionCell = sheetSkeletonManagerService.attachRangeWithCoord({
413
+ const endSelectionCell = attachRangeWithCoord(skeleton, {
414
414
  startColumn: toColumn,
415
415
  endColumn: toColumn,
416
416
  startRow: toRow,
@@ -421,7 +421,7 @@ function drawingPositionToTransform(position, selectionRenderService, sheetSkele
421
421
  const { startX: startSelectionX, startY: startSelectionY } = startSelectionCell, { startX: endSelectionX, startY: endSelectionY } = endSelectionCell;
422
422
  let left = precisionTo(startSelectionX + fromColumnOffset, 1), top = precisionTo(startSelectionY + fromRowOffset, 1), width = precisionTo(endSelectionX + toColumnOffset - left, 1), height = precisionTo(endSelectionY + toRowOffset - top, 1);
423
423
  startSelectionCell.startX === endSelectionCell.endX && (width = 0), startSelectionCell.startY === endSelectionCell.endY && (height = 0);
424
- const skeleton = sheetSkeletonManagerService.getCurrentSkeleton(), sheetWidth = skeleton.rowHeaderWidth + skeleton.columnTotalWidth, sheetHeight = skeleton.columnHeaderHeight + skeleton.rowTotalHeight;
424
+ const sheetWidth = skeleton.rowHeaderWidth + skeleton.columnTotalWidth, sheetHeight = skeleton.columnHeaderHeight + skeleton.rowTotalHeight;
425
425
  return left + width > sheetWidth && (left = sheetWidth - width), top + height > sheetHeight && (top = sheetHeight - height), {
426
426
  flipY,
427
427
  flipX,
@@ -464,11 +464,11 @@ function transformToDrawingPosition(transform, selectionRenderService) {
464
464
  };
465
465
  }
466
466
  __name(transformToDrawingPosition, "transformToDrawingPosition");
467
- var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
468
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
467
+ var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
468
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
469
469
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
470
- return kind && result && __defProp$7(target, key, result), result;
471
- }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a2;
470
+ return kind && result && __defProp$8(target, key, result), result;
471
+ }, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a2;
472
472
  let SheetDrawingUpdateController = (_a2 = class extends Disposable {
473
473
  constructor(_context, _skeletonManagerService, _commandService, _selectionRenderService, _imageIoService, _sheetDrawingService, _drawingManagerService, _contextService, _messageService, _localeService, selectionManagerService) {
474
474
  super();
@@ -615,7 +615,7 @@ let SheetDrawingUpdateController = (_a2 = class extends Disposable {
615
615
  if (transform == null)
616
616
  return;
617
617
  const sheetDrawing = this._sheetDrawingService.getDrawingByParam({ unitId, subUnitId, drawingId });
618
- if (sheetDrawing == null)
618
+ if (sheetDrawing == null || sheetDrawing.unitId !== this._context.unitId)
619
619
  return;
620
620
  const sheetTransform = transformToDrawingPosition({ ...sheetDrawing.transform, ...transform }, this._selectionRenderService);
621
621
  if (sheetTransform == null)
@@ -658,7 +658,7 @@ let SheetDrawingUpdateController = (_a2 = class extends Disposable {
658
658
  _registerDrawing(params) {
659
659
  params.forEach((param) => {
660
660
  const drawingParam = this._sheetDrawingService.getDrawingByParam(param);
661
- if (drawingParam == null)
661
+ if (drawingParam == null || drawingParam.unitId !== this._context.unitId)
662
662
  return;
663
663
  const { sheetTransform } = drawingParam;
664
664
  drawingParam.transform = drawingPositionToTransform(sheetTransform, this._selectionRenderService, this._skeletonManagerService);
@@ -667,17 +667,17 @@ let SheetDrawingUpdateController = (_a2 = class extends Disposable {
667
667
  this._drawingManagerService.registerDrawingData(unitId, this._sheetDrawingService.getDrawingDataForUnit(unitId)), this._drawingManagerService.initializeNotification(unitId);
668
668
  }
669
669
  }, __name(_a2, "SheetDrawingUpdateController"), _a2);
670
- SheetDrawingUpdateController = __decorateClass$7([
671
- __decorateParam$7(1, Inject(SheetSkeletonManagerService)),
672
- __decorateParam$7(2, ICommandService),
673
- __decorateParam$7(3, ISheetSelectionRenderService),
674
- __decorateParam$7(4, IImageIoService),
675
- __decorateParam$7(5, ISheetDrawingService),
676
- __decorateParam$7(6, IDrawingManagerService),
677
- __decorateParam$7(7, IContextService),
678
- __decorateParam$7(8, IMessageService),
679
- __decorateParam$7(9, Inject(LocaleService)),
680
- __decorateParam$7(10, Inject(SheetsSelectionsService))
670
+ SheetDrawingUpdateController = __decorateClass$8([
671
+ __decorateParam$8(1, Inject(SheetSkeletonManagerService)),
672
+ __decorateParam$8(2, ICommandService),
673
+ __decorateParam$8(3, ISheetSelectionRenderService),
674
+ __decorateParam$8(4, IImageIoService),
675
+ __decorateParam$8(5, ISheetDrawingService),
676
+ __decorateParam$8(6, IDrawingManagerService),
677
+ __decorateParam$8(7, IContextService),
678
+ __decorateParam$8(8, IMessageService),
679
+ __decorateParam$8(9, Inject(LocaleService)),
680
+ __decorateParam$8(10, Inject(SheetsSelectionsService))
681
681
  ], SheetDrawingUpdateController);
682
682
  var __assign = function() {
683
683
  return __assign = Object.assign || function(t) {
@@ -708,15 +708,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
708
708
  var attrs = __assign({}, node.attrs);
709
709
  extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
710
710
  var defIds = runtimeProps.defIds;
711
- return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a10) {
712
- var key = _a10[0], value = _a10[1];
711
+ return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a11) {
712
+ var key = _a11[0], value = _a11[1];
713
713
  typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
714
714
  })), attrs;
715
715
  }
716
716
  __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
717
717
  function replaceRuntimeIdsInDefs(node, runtimeProps) {
718
- var _a10, defIds = runtimeProps.defIds;
719
- return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a10 = node.children) === null || _a10 === void 0) && _a10.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
718
+ var _a11, defIds = runtimeProps.defIds;
719
+ return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a11 = node.children) === null || _a11 === void 0) && _a11.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
720
720
  return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
721
721
  }) }) : node;
722
722
  }
@@ -741,8 +741,8 @@ const uploadFileMenu = "univer-upload-file-menu", uploadFileMenuInput = "univer-
741
741
  var UploadFileType = /* @__PURE__ */ ((UploadFileType2) => (UploadFileType2[UploadFileType2.cellImage = 0] = "cellImage", UploadFileType2[UploadFileType2.floatImage = 1] = "floatImage", UploadFileType2))(UploadFileType || {});
742
742
  const UploadFileMenu = /* @__PURE__ */ __name((props) => {
743
743
  const { type } = props, commandService = useDependency(ICommandService), fileInputRef = useRef(null), handleButtonClick = /* @__PURE__ */ __name(() => {
744
- var _a10;
745
- (_a10 = fileInputRef.current) == null || _a10.click();
744
+ var _a11;
745
+ (_a11 = fileInputRef.current) == null || _a11.click();
746
746
  }, "handleButtonClick"), imageAccept = DRAWING_IMAGE_ALLOW_IMAGE_LIST.map((image) => `.${image.replace("image/", "")}`).join(","), handleFileChange = /* @__PURE__ */ __name((event) => {
747
747
  const fileList = event.target.files;
748
748
  if (fileList == null)
@@ -808,14 +808,14 @@ const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "un
808
808
  sheetImageMenu,
809
809
  sheetImageMenuInput
810
810
  }, SheetDrawingAnchor = /* @__PURE__ */ __name((props) => {
811
- var _a10;
811
+ var _a11;
812
812
  const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), drawingManagerService = useDependency(IDrawingManagerService), renderManagerService = useDependency(IRenderManagerService), { drawings } = props, drawingParam = drawings[0];
813
813
  if (drawingParam == null)
814
814
  return;
815
815
  const { unitId } = drawingParam, renderObject = renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
816
816
  if (scene == null)
817
817
  return;
818
- const transformer = scene.getTransformerByCreate(), [anchorShow, setAnchorShow] = useState(!0), type = (_a10 = drawingParam.anchorType) != null ? _a10 : SheetDrawingAnchorType.Position, [value, setValue] = useState(type);
818
+ const transformer = scene.getTransformerByCreate(), [anchorShow, setAnchorShow] = useState(!0), type = (_a11 = drawingParam.anchorType) != null ? _a11 : SheetDrawingAnchorType.Position, [value, setValue] = useState(type);
819
819
  function getUpdateParams(objects, drawingManagerService2) {
820
820
  const params = [];
821
821
  return objects.forEach((object) => {
@@ -837,13 +837,13 @@ const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "un
837
837
  const onClearControlObserver = transformer.clearControl$.subscribe((changeSelf) => {
838
838
  changeSelf === !0 && setAnchorShow(!1);
839
839
  }), onChangeStartObserver = transformer.changeStart$.subscribe((state) => {
840
- var _a11;
840
+ var _a12;
841
841
  const { objects } = state, params = getUpdateParams(objects, drawingManagerService);
842
842
  if (params.length === 0)
843
843
  setAnchorShow(!1);
844
844
  else if (params.length >= 1) {
845
845
  setAnchorShow(!0);
846
- const anchorType = ((_a11 = params[0]) == null ? void 0 : _a11.anchorType) || SheetDrawingAnchorType.Position;
846
+ const anchorType = ((_a12 = params[0]) == null ? void 0 : _a12.anchorType) || SheetDrawingAnchorType.Position;
847
847
  setValue(anchorType);
848
848
  }
849
849
  });
@@ -926,7 +926,7 @@ const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "un
926
926
  }, "handler")
927
927
  };
928
928
  function whenSheetDrawingFocused(contextService) {
929
- return !contextService.getContextValue(FOCUSING_FORMULA_EDITOR) && !contextService.getContextValue(EDITOR_ACTIVATED) && contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);
929
+ return !contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) && !contextService.getContextValue(EDITOR_ACTIVATED) && contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);
930
930
  }
931
931
  __name(whenSheetDrawingFocused, "whenSheetDrawingFocused");
932
932
  const MoveDrawingDownShortcutItem = {
@@ -978,11 +978,11 @@ const MoveDrawingDownShortcutItem = {
978
978
  binding: KeyCode.DELETE,
979
979
  mac: KeyCode.BACKSPACE
980
980
  };
981
- var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
982
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
981
+ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
982
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
983
983
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
984
- return kind && result && __defProp$6(target, key, result), result;
985
- }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6");
984
+ return kind && result && __defProp$7(target, key, result), result;
985
+ }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7");
986
986
  const DefaultSheetsDrawingConfig = {};
987
987
  var _a3;
988
988
  let SheetDrawingUIController = (_a3 = class extends Disposable {
@@ -1036,19 +1036,19 @@ let SheetDrawingUIController = (_a3 = class extends Disposable {
1036
1036
  this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
1037
1037
  }
1038
1038
  }, __name(_a3, "SheetDrawingUIController"), _a3);
1039
- SheetDrawingUIController = __decorateClass$6([
1039
+ SheetDrawingUIController = __decorateClass$7([
1040
1040
  OnLifecycle(LifecycleStages.Rendered, SheetDrawingUIController),
1041
- __decorateParam$6(1, Inject(Injector)),
1042
- __decorateParam$6(2, Inject(ComponentManager)),
1043
- __decorateParam$6(3, IMenuService),
1044
- __decorateParam$6(4, ICommandService),
1045
- __decorateParam$6(5, IShortcutService)
1041
+ __decorateParam$7(1, Inject(Injector)),
1042
+ __decorateParam$7(2, Inject(ComponentManager)),
1043
+ __decorateParam$7(3, IMenuService),
1044
+ __decorateParam$7(4, ICommandService),
1045
+ __decorateParam$7(5, IShortcutService)
1046
1046
  ], SheetDrawingUIController);
1047
- var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1048
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1047
+ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1048
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1049
1049
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1050
- return kind && result && __defProp$5(target, key, result), result;
1051
- }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5");
1050
+ return kind && result && __defProp$6(target, key, result), result;
1051
+ }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6");
1052
1052
  const UPDATE_COMMANDS = [
1053
1053
  InsertRowCommand.id,
1054
1054
  InsertColCommand.id,
@@ -1738,20 +1738,20 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
1738
1738
  }), updateDrawings.length !== 0 && (this._drawingManagerService.refreshTransform(updateDrawings), this._commandService.syncExecuteCommand(ClearSheetDrawingTransformerOperation.id, [unitId]));
1739
1739
  }
1740
1740
  }, __name(_a4, "SheetDrawingTransformAffectedController"), _a4);
1741
- SheetDrawingTransformAffectedController = __decorateClass$5([
1742
- __decorateParam$5(1, ICommandService),
1743
- __decorateParam$5(2, ISheetSelectionRenderService),
1744
- __decorateParam$5(3, Inject(SheetSkeletonManagerService)),
1745
- __decorateParam$5(4, Inject(SheetInterceptorService)),
1746
- __decorateParam$5(5, ISheetDrawingService),
1747
- __decorateParam$5(6, IDrawingManagerService),
1748
- __decorateParam$5(7, IUniverInstanceService)
1741
+ SheetDrawingTransformAffectedController = __decorateClass$6([
1742
+ __decorateParam$6(1, ICommandService),
1743
+ __decorateParam$6(2, ISheetSelectionRenderService),
1744
+ __decorateParam$6(3, Inject(SheetSkeletonManagerService)),
1745
+ __decorateParam$6(4, Inject(SheetInterceptorService)),
1746
+ __decorateParam$6(5, ISheetDrawingService),
1747
+ __decorateParam$6(6, IDrawingManagerService),
1748
+ __decorateParam$6(7, IUniverInstanceService)
1749
1749
  ], SheetDrawingTransformAffectedController);
1750
- var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1751
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1750
+ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1751
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1752
1752
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1753
- return kind && result && __defProp$4(target, key, result), result;
1754
- }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4");
1753
+ return kind && result && __defProp$5(target, key, result), result;
1754
+ }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5");
1755
1755
  function transformBound2DOMBound(originBound, scene, skeleton, worksheet) {
1756
1756
  const { scaleX, scaleY } = scene.getAncestorScale(), viewMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN), absolute = {
1757
1757
  left: !0,
@@ -1788,20 +1788,20 @@ function transformBound2DOMBound(originBound, scene, skeleton, worksheet) {
1788
1788
  }
1789
1789
  __name(transformBound2DOMBound, "transformBound2DOMBound");
1790
1790
  const calcPosition = /* @__PURE__ */ __name((targetObject, currentRender, skeleton, worksheet) => {
1791
- const { scene } = currentRender, { left, top, width, height, angle } = targetObject, bound = {
1791
+ const { scene, engine } = currentRender, { left, top, width, height, angle } = targetObject, canvasElement = engine.getCanvasElement(), canvasClientRect = canvasElement.getBoundingClientRect(), widthOfCanvas = pxToNum(canvasElement.style.width), { top: topOffset, left: leftOffset, width: domWidth } = canvasClientRect, scaleAdjust = domWidth / widthOfCanvas, bound = {
1792
1792
  left,
1793
1793
  right: left + width,
1794
1794
  top,
1795
1795
  bottom: top + height
1796
1796
  }, offsetBound = transformBound2DOMBound(bound, scene, skeleton, worksheet);
1797
1797
  return {
1798
- startX: offsetBound.left,
1799
- endX: offsetBound.right,
1800
- startY: offsetBound.top,
1801
- endY: offsetBound.bottom,
1798
+ startX: offsetBound.left * scaleAdjust + leftOffset,
1799
+ endX: offsetBound.right * scaleAdjust + leftOffset,
1800
+ startY: offsetBound.top * scaleAdjust + topOffset,
1801
+ endY: offsetBound.bottom * scaleAdjust + topOffset,
1802
1802
  rotate: angle,
1803
- width,
1804
- height,
1803
+ width: width * scaleAdjust,
1804
+ height: height * scaleAdjust,
1805
1805
  absolute: offsetBound.absolute
1806
1806
  };
1807
1807
  }, "calcPosition");
@@ -1845,8 +1845,8 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
1845
1845
  // eslint-disable-next-line max-lines-per-function
1846
1846
  this._drawingManagerService.add$.subscribe((params) => {
1847
1847
  params.forEach((param) => {
1848
- var _a10, _b, _c;
1849
- const { unitId, subUnitId, drawingId } = param, target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), floatDomParam = this._drawingManagerService.getDrawingByParam(param), skeleton = (_a10 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a10.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
1848
+ var _a11, _b, _c;
1849
+ const { unitId, subUnitId, drawingId } = param, target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), floatDomParam = this._drawingManagerService.getDrawingByParam(param), skeleton = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
1850
1850
  if (floatDomParam == null || target == null || skeleton == null)
1851
1851
  return;
1852
1852
  const { transform, drawingType, data } = floatDomParam;
@@ -1914,10 +1914,10 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
1914
1914
  }
1915
1915
  _scrollUpdateListener() {
1916
1916
  this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
1917
- var _a10, _b;
1917
+ var _a11, _b;
1918
1918
  const updateSheet = /* @__PURE__ */ __name((unitId, subUnitId) => {
1919
- var _a11;
1920
- const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId), map2 = this._ensureMap(unitId, subUnitId), ids = Array.from(map2.keys()), target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), skeleton = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
1919
+ var _a12;
1920
+ const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId), map2 = this._ensureMap(unitId, subUnitId), ids = Array.from(map2.keys()), target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), skeleton = (_a12 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a12.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
1921
1921
  !renderObject || !target || !skeleton || ids.forEach((id) => {
1922
1922
  const info = this._domLayerInfoMap.get(id);
1923
1923
  if (info) {
@@ -1931,7 +1931,7 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
1931
1931
  updateSheet(unitId, sheetId);
1932
1932
  } else if (commandInfo.id === SetZoomRatioOperation.id) {
1933
1933
  const params = commandInfo.params, { unitId } = params;
1934
- Array.from((_b = (_a10 = this._domLayerMap.get(unitId)) == null ? void 0 : _a10.keys()) != null ? _b : []).forEach((subUnitId) => {
1934
+ Array.from((_b = (_a11 = this._domLayerMap.get(unitId)) == null ? void 0 : _a11.keys()) != null ? _b : []).forEach((subUnitId) => {
1935
1935
  updateSheet(unitId, subUnitId);
1936
1936
  });
1937
1937
  } else if (commandInfo.id === SetFrozenMutation.id) {
@@ -1941,8 +1941,8 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
1941
1941
  }));
1942
1942
  }
1943
1943
  _getPosition(position, unitId) {
1944
- var _a10;
1945
- const { startX, endX, startY, endY } = position, selectionRenderService = (_a10 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a10.with(ISheetSelectionRenderService);
1944
+ var _a11;
1945
+ const { startX, endX, startY, endY } = position, selectionRenderService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(ISheetSelectionRenderService);
1946
1946
  if (selectionRenderService == null)
1947
1947
  return;
1948
1948
  const start = selectionRenderService.getSelectionCellByPosition(startX, startY);
@@ -1991,14 +1991,14 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
1991
1991
  })
1992
1992
  );
1993
1993
  }
1994
- addFloatDomToPosition(layer) {
1994
+ addFloatDomToPosition(layer, propId) {
1995
1995
  const target = getSheetCommandTarget(this._univerInstanceService, {
1996
1996
  unitId: layer.unitId,
1997
1997
  subUnitId: layer.subUnitId
1998
1998
  });
1999
1999
  if (!target)
2000
2000
  throw new Error("cannot find current target!");
2001
- const { unitId, subUnitId } = target, { initPosition, componentKey, data } = layer, id = Tools.generateRandomId(), sheetTransform = this._getPosition(initPosition, unitId);
2001
+ const { unitId, subUnitId } = target, { initPosition, componentKey, data } = layer, id = propId != null ? propId : generateRandomId(), sheetTransform = this._getPosition(initPosition, unitId);
2002
2002
  if (sheetTransform == null)
2003
2003
  return;
2004
2004
  this._ensureMap(unitId, subUnitId).set(id, layer);
@@ -2052,20 +2052,20 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
2052
2052
  };
2053
2053
  }
2054
2054
  }, __name(_a5, "SheetCanvasFloatDomManagerService"), _a5);
2055
- SheetCanvasFloatDomManagerService = __decorateClass$4([
2055
+ SheetCanvasFloatDomManagerService = __decorateClass$5([
2056
2056
  OnLifecycle(LifecycleStages.Starting, SheetCanvasFloatDomManagerService),
2057
- __decorateParam$4(0, Inject(IRenderManagerService)),
2058
- __decorateParam$4(1, IUniverInstanceService),
2059
- __decorateParam$4(2, Inject(ICommandService)),
2060
- __decorateParam$4(3, IDrawingManagerService),
2061
- __decorateParam$4(4, Inject(CanvasFloatDomService)),
2062
- __decorateParam$4(5, ISheetDrawingService)
2057
+ __decorateParam$5(0, Inject(IRenderManagerService)),
2058
+ __decorateParam$5(1, IUniverInstanceService),
2059
+ __decorateParam$5(2, Inject(ICommandService)),
2060
+ __decorateParam$5(3, IDrawingManagerService),
2061
+ __decorateParam$5(4, Inject(CanvasFloatDomService)),
2062
+ __decorateParam$5(5, ISheetDrawingService)
2063
2063
  ], SheetCanvasFloatDomManagerService);
2064
- var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2065
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2064
+ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2065
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2066
2066
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2067
- return kind && result && __defProp$3(target, key, result), result;
2068
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a6;
2067
+ return kind && result && __defProp$4(target, key, result), result;
2068
+ }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a6;
2069
2069
  let SheetDrawingPrintingController = (_a6 = class extends Disposable {
2070
2070
  constructor(_sheetPrintInterceptorService, _drawingRenderService, _drawingManagerService, _renderManagerService) {
2071
2071
  super(), this._sheetPrintInterceptorService = _sheetPrintInterceptorService, this._drawingRenderService = _drawingRenderService, this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._initPrinting();
@@ -2110,18 +2110,18 @@ let SheetDrawingPrintingController = (_a6 = class extends Disposable {
2110
2110
  );
2111
2111
  }
2112
2112
  }, __name(_a6, "SheetDrawingPrintingController"), _a6);
2113
- SheetDrawingPrintingController = __decorateClass$3([
2113
+ SheetDrawingPrintingController = __decorateClass$4([
2114
2114
  OnLifecycle(LifecycleStages.Rendered, SheetDrawingPrintingController),
2115
- __decorateParam$3(0, Inject(SheetPrintInterceptorService)),
2116
- __decorateParam$3(1, Inject(DrawingRenderService)),
2117
- __decorateParam$3(2, IDrawingManagerService),
2118
- __decorateParam$3(3, IRenderManagerService)
2115
+ __decorateParam$4(0, Inject(SheetPrintInterceptorService)),
2116
+ __decorateParam$4(1, Inject(DrawingRenderService)),
2117
+ __decorateParam$4(2, IDrawingManagerService),
2118
+ __decorateParam$4(3, IRenderManagerService)
2119
2119
  ], SheetDrawingPrintingController);
2120
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2121
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2120
+ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2121
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2122
2122
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2123
- return kind && result && __defProp$2(target, key, result), result;
2124
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a7;
2123
+ return kind && result && __defProp$3(target, key, result), result;
2124
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a7;
2125
2125
  let SheetDrawingPermissionController = (_a7 = class extends Disposable {
2126
2126
  constructor(_drawingManagerService, _renderManagerService, _permissionService, _univerInstanceService, _userManagerService) {
2127
2127
  super(), this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._univerInstanceService = _univerInstanceService, this._userManagerService = _userManagerService, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
@@ -2189,7 +2189,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
2189
2189
  this.disposeWithMe(
2190
2190
  combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
2191
2191
  workbook && workbook.activeSheet$.subscribe((sheet) => {
2192
- var _a10;
2192
+ var _a11;
2193
2193
  if (!sheet)
2194
2194
  return;
2195
2195
  const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
@@ -2209,7 +2209,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
2209
2209
  object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
2210
2210
  }), transformer.clearSelectedObjects());
2211
2211
  }, "next")
2212
- }), (_a10 = this._permissionService.getPermissionPoint$(new WorksheetViewPermission(unitId, subUnitId).id)) == null || _a10.pipe(
2212
+ }), (_a11 = this._permissionService.getPermissionPoint$(new WorksheetViewPermission(unitId, subUnitId).id)) == null || _a11.pipe(
2213
2213
  filter((permission) => permission.value !== initialViewPermission),
2214
2214
  distinctUntilChanged()
2215
2215
  ).subscribe({
@@ -2228,7 +2228,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
2228
2228
  this.disposeWithMe(
2229
2229
  combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
2230
2230
  workbook && workbook.activeSheet$.subscribe((sheet) => {
2231
- var _a10;
2231
+ var _a11;
2232
2232
  if (!sheet)
2233
2233
  return;
2234
2234
  const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
@@ -2250,7 +2250,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
2250
2250
  object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.detachTransformerFrom(object);
2251
2251
  }), transformer.clearSelectedObjects());
2252
2252
  }, "next")
2253
- }), (_a10 = this._permissionService.getPermissionPoint$(new WorksheetEditPermission(unitId, subUnitId).id)) == null || _a10.pipe(
2253
+ }), (_a11 = this._permissionService.getPermissionPoint$(new WorksheetEditPermission(unitId, subUnitId).id)) == null || _a11.pipe(
2254
2254
  filter((permission) => permission.value !== initialEditPermission),
2255
2255
  distinctUntilChanged()
2256
2256
  ).subscribe({
@@ -2269,19 +2269,19 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
2269
2269
  );
2270
2270
  }
2271
2271
  }, __name(_a7, "SheetDrawingPermissionController"), _a7);
2272
- SheetDrawingPermissionController = __decorateClass$2([
2272
+ SheetDrawingPermissionController = __decorateClass$3([
2273
2273
  OnLifecycle(LifecycleStages.Rendered, SheetDrawingPermissionController),
2274
- __decorateParam$2(0, IDrawingManagerService),
2275
- __decorateParam$2(1, IRenderManagerService),
2276
- __decorateParam$2(2, IPermissionService),
2277
- __decorateParam$2(3, IUniverInstanceService),
2278
- __decorateParam$2(4, Inject(UserManagerService))
2274
+ __decorateParam$3(0, IDrawingManagerService),
2275
+ __decorateParam$3(1, IRenderManagerService),
2276
+ __decorateParam$3(2, IPermissionService),
2277
+ __decorateParam$3(3, IUniverInstanceService),
2278
+ __decorateParam$3(4, Inject(UserManagerService))
2279
2279
  ], SheetDrawingPermissionController);
2280
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2281
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2280
+ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2281
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2282
2282
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2283
- return kind && result && __defProp$1(target, key, result), result;
2284
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a8;
2283
+ return kind && result && __defProp$2(target, key, result), result;
2284
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a8;
2285
2285
  let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
2286
2286
  constructor(_sheetClipboardService, _renderManagerService, _sheetDrawingService) {
2287
2287
  super();
@@ -2300,8 +2300,8 @@ let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
2300
2300
  });
2301
2301
  }
2302
2302
  _collect(unitId, subUnitId, range) {
2303
- var _a10;
2304
- const skeletonManagetService = (_a10 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a10.with(SheetSkeletonManagerService);
2303
+ var _a11;
2304
+ const skeletonManagetService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService);
2305
2305
  if (!skeletonManagetService) return;
2306
2306
  const selectionRect = skeletonManagetService.attachRangeWithCoord(range);
2307
2307
  if (!selectionRect)
@@ -2326,7 +2326,7 @@ let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
2326
2326
  }
2327
2327
  // eslint-disable-next-line max-lines-per-function
2328
2328
  _generateMutations(pastedRange, copyInfo) {
2329
- var _a10;
2329
+ var _a11;
2330
2330
  if (!this._copyInfo)
2331
2331
  return { redos: [], undos: [] };
2332
2332
  if ([
@@ -2341,7 +2341,7 @@ let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
2341
2341
  const { copyRange } = copyInfo;
2342
2342
  if (!copyRange)
2343
2343
  return { redos: [], undos: [] };
2344
- const { drawings, unitId, subUnitId } = this._copyInfo, { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyRange, pastedRange]), { row: copyRow, col: copyCol } = mapFunc(vCopyRange.startRow, vCopyRange.startColumn), { row: pasteRow, col: pasteCol } = mapFunc(vPastedRange.startRow, vPastedRange.startColumn), skeletonManagetService = (_a10 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a10.with(SheetSkeletonManagerService);
2344
+ const { drawings, unitId, subUnitId } = this._copyInfo, { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyRange, pastedRange]), { row: copyRow, col: copyCol } = mapFunc(vCopyRange.startRow, vCopyRange.startColumn), { row: pasteRow, col: pasteCol } = mapFunc(vPastedRange.startRow, vPastedRange.startColumn), skeletonManagetService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService);
2345
2345
  if (!skeletonManagetService)
2346
2346
  return { redos: [], undos: [] };
2347
2347
  const copyRect = skeletonManagetService.attachRangeWithCoord({
@@ -2408,20 +2408,42 @@ let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
2408
2408
  };
2409
2409
  }
2410
2410
  }, __name(_a8, "SheetsDrawingCopyPasteController"), _a8);
2411
- SheetsDrawingCopyPasteController = __decorateClass$1([
2411
+ SheetsDrawingCopyPasteController = __decorateClass$2([
2412
2412
  OnLifecycle(LifecycleStages.Ready, SheetsDrawingCopyPasteController),
2413
- __decorateParam$1(0, ISheetClipboardService),
2414
- __decorateParam$1(1, IRenderManagerService),
2415
- __decorateParam$1(2, ISheetDrawingService)
2413
+ __decorateParam$2(0, ISheetClipboardService),
2414
+ __decorateParam$2(1, IRenderManagerService),
2415
+ __decorateParam$2(2, ISheetDrawingService)
2416
2416
  ], SheetsDrawingCopyPasteController);
2417
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2418
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2419
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2420
+ return kind && result && __defProp$1(target, key, result), result;
2421
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a9;
2422
+ let SheetsDrawingRenderController = (_a9 = class extends Disposable {
2423
+ constructor(_context, _sheetDrawingService, _lifecycleService) {
2424
+ super(), this._context = _context, this._sheetDrawingService = _sheetDrawingService, this._lifecycleService = _lifecycleService, this._init();
2425
+ }
2426
+ _init() {
2427
+ this._drawingInitializeListener();
2428
+ }
2429
+ _drawingInitializeListener() {
2430
+ this._lifecycleService.lifecycle$.pipe(filter((e) => e === LifecycleStages.Steady), first()).subscribe(() => {
2431
+ this._context.type === UniverInstanceType.UNIVER_SHEET && this._sheetDrawingService.initializeNotification(this._context.unitId);
2432
+ });
2433
+ }
2434
+ }, __name(_a9, "SheetsDrawingRenderController"), _a9);
2435
+ SheetsDrawingRenderController = __decorateClass$1([
2436
+ __decorateParam$1(1, ISheetDrawingService),
2437
+ __decorateParam$1(2, Inject(LifecycleService))
2438
+ ], SheetsDrawingRenderController);
2417
2439
  var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2418
2440
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2419
2441
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2420
2442
  return kind && result && __defProp2(target, key, result), result;
2421
2443
  }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField");
2422
2444
  const PLUGIN_NAME = "SHEET_IMAGE_UI_PLUGIN";
2423
- var _a9;
2424
- let UniverSheetsDrawingUIPlugin = (_a9 = class extends Plugin {
2445
+ var _a10;
2446
+ let UniverSheetsDrawingUIPlugin = (_a10 = class extends Plugin {
2425
2447
  constructor(config = {}, _injector, _localeService, _renderManagerService) {
2426
2448
  super();
2427
2449
  __publicField(this, "_pluginConfig");
@@ -2441,19 +2463,20 @@ let UniverSheetsDrawingUIPlugin = (_a9 = class extends Plugin {
2441
2463
  }],
2442
2464
  [DrawingPopupMenuController],
2443
2465
  [SheetDrawingPrintingController],
2444
- [SheetDrawingPermissionController]
2466
+ [SheetDrawingPermissionController],
2467
+ [SheetsDrawingCopyPasteController]
2445
2468
  ].forEach((dependency) => this._injector.add(dependency));
2446
2469
  }
2447
2470
  _registerRenderModules() {
2448
2471
  [
2449
2472
  [SheetDrawingUpdateController],
2450
2473
  [SheetDrawingTransformAffectedController],
2451
- [SheetsDrawingCopyPasteController]
2474
+ [SheetsDrawingRenderController]
2452
2475
  ].forEach((m) => {
2453
2476
  this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
2454
2477
  });
2455
2478
  }
2456
- }, __name(_a9, "UniverSheetsDrawingUIPlugin"), _a9);
2479
+ }, __name(_a10, "UniverSheetsDrawingUIPlugin"), _a10);
2457
2480
  __publicField2(UniverSheetsDrawingUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
2458
2481
  __publicField2(UniverSheetsDrawingUIPlugin, "pluginName", PLUGIN_NAME);
2459
2482
  UniverSheetsDrawingUIPlugin = __decorateClass([
@@ -2467,6 +2490,7 @@ export {
2467
2490
  DeleteDrawingsCommand,
2468
2491
  EditSheetDrawingOperation,
2469
2492
  GroupSheetDrawingCommand,
2493
+ IMAGE_MENU_ID,
2470
2494
  InsertCellImageOperation,
2471
2495
  InsertFloatImageOperation,
2472
2496
  InsertSheetDrawingCommand,