@univerjs/sheets-drawing 1.3.1 → 1.5.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/facade.js CHANGED
@@ -6,7 +6,7 @@ import { DrawingApplyType, ISheetDrawingService, InsertSheetDrawingCommand, Remo
6
6
  import { getGroupState, transformObjectOutOfGroup } from "@univerjs/engine-render";
7
7
  import { FWorksheet } from "@univerjs/sheets/facade";
8
8
 
9
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
9
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
10
10
  function _typeof(o) {
11
11
  "@babel/helpers - typeof";
12
12
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -16,28 +16,25 @@ function _typeof(o) {
16
16
  }, _typeof(o);
17
17
  }
18
18
 
19
- //#endregion
20
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
21
- function toPrimitive(t, r) {
19
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
20
+ function toPrimitive(t, e) {
22
21
  if ("object" != _typeof(t) || !t) return t;
23
- var e = t[Symbol.toPrimitive];
24
- if (void 0 !== e) {
25
- var i = e.call(t, r || "default");
22
+ var r;
23
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
24
+ var i = r.call(t, e || "default");
26
25
  if ("object" != _typeof(i)) return i;
27
26
  throw new TypeError("@@toPrimitive must return a primitive value.");
28
27
  }
29
- return ("string" === r ? String : Number)(t);
28
+ return ("string" === e ? String : Number)(t);
30
29
  }
31
30
 
32
- //#endregion
33
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
31
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
34
32
  function toPropertyKey(t) {
35
33
  var i = toPrimitive(t, "string");
36
34
  return "symbol" == _typeof(i) ? i : i + "";
37
35
  }
38
36
 
39
- //#endregion
40
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
37
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
41
38
  function _defineProperty(e, r, t) {
42
39
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
43
40
  value: t,
@@ -47,16 +44,14 @@ function _defineProperty(e, r, t) {
47
44
  }) : e[r] = t, e;
48
45
  }
49
46
 
50
- //#endregion
51
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
47
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
52
48
  function __decorateParam(paramIndex, decorator) {
53
49
  return function(target, key) {
54
50
  decorator(target, key, paramIndex);
55
51
  };
56
52
  }
57
53
 
58
- //#endregion
59
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
54
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
60
55
  function __decorate(decorators, target, key, desc) {
61
56
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
62
57
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -64,8 +59,7 @@ function __decorate(decorators, target, key, desc) {
64
59
  return c > 3 && r && Object.defineProperty(target, key, r), r;
65
60
  }
66
61
 
67
- //#endregion
68
- //#region src/facade/f-over-grid-image.ts
62
+ // src/facade/f-over-grid-image.ts
69
63
  /**
70
64
  * Convert the image parameter to a FOverGridImage
71
65
  * @param {ISheetImage} sheetImage The image parameter
@@ -915,6 +909,10 @@ let FOverGridImage = class FOverGridImage extends FBase {
915
909
  }
916
910
  /**
917
911
  * Remove the image from the sheet
912
+ *
913
+ * For multiple images on the same worksheet, prefer {@link FWorksheet.deleteImages} with the image
914
+ * handles instead of calling this method on each image.
915
+ *
918
916
  * @returns {boolean} true if the image is removed successfully, otherwise false
919
917
  * @example
920
918
  * ```ts
@@ -1155,8 +1153,7 @@ function validateImageOpacity(opacity) {
1155
1153
  if (!Number.isFinite(opacity) || opacity < 0 || opacity > 1) throw new RangeError("Sheet image opacity must be between 0 and 1.");
1156
1154
  }
1157
1155
 
1158
- //#endregion
1159
- //#region src/facade/f-worksheet.ts
1156
+ // src/facade/f-worksheet.ts
1160
1157
  var FWorksheetDrawingMixin = class extends FWorksheet {
1161
1158
  get _sheetDrawingService() {
1162
1159
  return this._injector.get(ISheetDrawingService);
@@ -1550,8 +1547,7 @@ function getDrawingBounds(drawing) {
1550
1547
  }
1551
1548
  FWorksheet.extend(FWorksheetDrawingMixin);
1552
1549
 
1553
- //#endregion
1554
- //#region src/facade/f-enum.ts
1550
+ // src/facade/f-enum.ts
1555
1551
  /**
1556
1552
  * Copyright 2023-present DreamNum Co., Ltd.
1557
1553
  *
@@ -1577,8 +1573,7 @@ var FSheetsDrawingEnumMixin = class extends FEnum {
1577
1573
  };
1578
1574
  FEnum.extend(FSheetsDrawingEnumMixin);
1579
1575
 
1580
- //#endregion
1581
- //#region src/facade/f-event.ts
1576
+ // src/facade/f-event.ts
1582
1577
  var FSheetsDrawingEventNameMixin = class extends FEventName {
1583
1578
  get BeforeFloatDomAdd() {
1584
1579
  return "BeforeFloatDomAdd";
@@ -1625,8 +1620,7 @@ var FSheetsDrawingEventNameMixin = class extends FEventName {
1625
1620
  };
1626
1621
  FEventName.extend(FSheetsDrawingEventNameMixin);
1627
1622
 
1628
- //#endregion
1629
- //#region src/facade/f-univer.ts
1623
+ // src/facade/f-univer.ts
1630
1624
  /**
1631
1625
  * @ignore
1632
1626
  */
@@ -1773,5 +1767,4 @@ var FUniverSheetsDrawingMixin = class extends FUniver {
1773
1767
  };
1774
1768
  FUniver.extend(FUniverSheetsDrawingMixin);
1775
1769
 
1776
- //#endregion
1777
1770
  export { FOverGridImage };
package/lib/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeltaColumnWidthCommand, DeltaRowHeightCommand, InsertColCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowCommand, MoveColsCommand, MoveRangeCommand, MoveRowsCommand, RemoveColCommand, RemoveRowCommand, RemoveSheetCommand, SetColHiddenCommand, SetColHiddenMutation, SetColVisibleMutation, SetColWidthCommand, SetRowHeightCommand, SetRowHiddenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetWorksheetColWidthMutation, SetWorksheetRowAutoHeightMutation, SetWorksheetRowHeightMutation, SetWorksheetRowIsAutoHeightMutation, SheetInterceptorService, SheetSkeletonService, UniverSheetsPlugin, attachRangeWithCoord, convertPositionCellToSheetOverGrid, convertPositionSheetOverGridToAbsolute, getSheetCommandTarget } from "@univerjs/sheets";
2
- import { ArrangeTypeEnum, CommandType, DependentOn, Disposable, DrawingTypeEnum, ICommandService, IConfigService, ILogService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, Plugin, Rectangle, UniverInstanceType, createIdentifier, merge, sequenceExecute, toDisposable } from "@univerjs/core";
2
+ import { ArrangeTypeEnum, CommandType, CustomCommandExecutionError, DependentOn, Disposable, DrawingTypeEnum, ICommandService, IConfigService, ILogService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, Plugin, Rectangle, UniverInstanceType, createIdentifier, merge, sequenceExecute, toDisposable } from "@univerjs/core";
3
3
  import { IDrawingManagerService, UnitDrawingService, UniverDrawingPlugin, getOrCreateDrawingCopyPlan, resolveDrawingRotateEnabled } from "@univerjs/drawing";
4
- import { IRenderManagerService } from "@univerjs/engine-render";
4
+ import { IRenderManagerService, Transform, Vector2, getGroupState } from "@univerjs/engine-render";
5
5
 
6
- //#region src/basics/transform-position.ts
6
+ // src/basics/transform-position.ts
7
7
  function drawingPositionToTransform(position, sheetSkeletonParam) {
8
8
  if (!sheetSkeletonParam) return;
9
9
  const { unitId, sheetId, skeleton } = sheetSkeletonParam;
@@ -68,8 +68,7 @@ function transformToAxisAlignPosition(transform, skeleton) {
68
68
  }, skeleton);
69
69
  }
70
70
 
71
- //#endregion
72
- //#region src/services/sheet-drawing.service.ts
71
+ // src/services/sheet-drawing.service.ts
73
72
  let SheetDrawingAnchorType = /* @__PURE__ */ function(SheetDrawingAnchorType) {
74
73
  /**
75
74
  * Only the position of the drawing follows the cell changes. When rows or columns are inserted or deleted, the position of the drawing changes, but the size remains the same.
@@ -88,8 +87,7 @@ let SheetDrawingAnchorType = /* @__PURE__ */ function(SheetDrawingAnchorType) {
88
87
  var SheetDrawingService = class extends UnitDrawingService {};
89
88
  const ISheetDrawingService = createIdentifier("sheets-drawing.sheet-drawing.service");
90
89
 
91
- //#endregion
92
- //#region src/commands/mutations/set-drawing-apply.mutation.ts
90
+ // src/commands/mutations/set-drawing-apply.mutation.ts
93
91
  let DrawingApplyType = /* @__PURE__ */ function(DrawingApplyType) {
94
92
  DrawingApplyType[DrawingApplyType["INSERT"] = 0] = "INSERT";
95
93
  DrawingApplyType[DrawingApplyType["REMOVE"] = 1] = "REMOVE";
@@ -137,8 +135,7 @@ const SetDrawingApplyMutation = {
137
135
  }
138
136
  };
139
137
 
140
- //#endregion
141
- //#region src/commands/operations/clear-drawing-transformer.operation.ts
138
+ // src/commands/operations/clear-drawing-transformer.operation.ts
142
139
  const ClearSheetDrawingTransformerOperation = {
143
140
  id: "sheet.operation.clear-drawing-transformer",
144
141
  type: CommandType.MUTATION,
@@ -152,8 +149,7 @@ const ClearSheetDrawingTransformerOperation = {
152
149
  }
153
150
  };
154
151
 
155
- //#endregion
156
- //#region src/commands/commands/insert-sheet-drawing.command.ts
152
+ // src/commands/commands/insert-sheet-drawing.command.ts
157
153
  const InsertSheetDrawingCommand = {
158
154
  id: "sheet.command.insert-sheet-image",
159
155
  type: CommandType.COMMAND,
@@ -217,8 +213,33 @@ const InsertSheetDrawingCommand = {
217
213
  }
218
214
  };
219
215
 
220
- //#endregion
221
- //#region src/commands/commands/remove-sheet-drawing.command.ts
216
+ // src/commands/commands/remove-sheet-drawing.command.ts
217
+ function expandDrawingRemovalParams(service, requested) {
218
+ const drawings = [];
219
+ const visit = (search, ancestors) => {
220
+ if (ancestors.has(search.drawingId)) throw new CustomCommandExecutionError(RemoveSheetDrawingCommand.id);
221
+ if (drawings.some((drawing) => drawing.unitId === search.unitId && drawing.subUnitId === search.subUnitId && drawing.drawingId === search.drawingId)) return;
222
+ const current = service.getDrawingByParam(search);
223
+ drawings.push({
224
+ unitId: search.unitId,
225
+ subUnitId: search.subUnitId,
226
+ drawingId: search.drawingId,
227
+ drawingType: (current === null || current === void 0 ? void 0 : current.drawingType) ?? search.drawingType
228
+ });
229
+ if (!current) return;
230
+ const children = Object.values(service.getDrawingData(search.unitId, search.subUnitId)).filter((drawing) => current.drawingType === DrawingTypeEnum.DRAWING_GROUP && drawing.groupId === search.drawingId);
231
+ const nextAncestors = new Set(ancestors);
232
+ nextAncestors.add(search.drawingId);
233
+ children.forEach((drawing) => visit({
234
+ unitId: search.unitId,
235
+ subUnitId: search.subUnitId,
236
+ drawingId: drawing.drawingId,
237
+ drawingType: drawing.drawingType
238
+ }, nextAncestors));
239
+ };
240
+ requested.forEach((drawing) => visit(drawing, /* @__PURE__ */ new Set()));
241
+ return drawings;
242
+ }
222
243
  const RemoveSheetDrawingCommand = {
223
244
  id: "sheet.command.remove-sheet-image",
224
245
  type: CommandType.COMMAND,
@@ -228,13 +249,20 @@ const RemoveSheetDrawingCommand = {
228
249
  const undoRedoService = accessor.get(IUndoRedoService);
229
250
  const sheetInterceptorService = accessor.get(SheetInterceptorService);
230
251
  const sheetDrawingService = accessor.get(ISheetDrawingService);
231
- const { drawings } = params;
232
- const { unitId, subUnitId, undo, redo, objects } = sheetDrawingService.getBatchRemoveOp(drawings);
233
- if (Array.isArray(objects) && objects.length === 0) return false;
252
+ const normalizedParams = {
253
+ ...params,
254
+ drawings: expandDrawingRemovalParams(sheetDrawingService, params.drawings)
255
+ };
256
+ if (!accessor.get(IDrawingManagerService).canExecuteCommand({
257
+ id: RemoveSheetDrawingCommand.id,
258
+ params: normalizedParams
259
+ })) return false;
234
260
  const intercepted = sheetInterceptorService.onCommandExecute({
235
261
  id: RemoveSheetDrawingCommand.id,
236
- params
262
+ params: normalizedParams
237
263
  });
264
+ const { unitId, subUnitId, undo, redo, objects } = sheetDrawingService.getBatchRemoveOp(normalizedParams.drawings);
265
+ if (Array.isArray(objects) && objects.length === 0) return false;
238
266
  const redoMutations = [
239
267
  ...intercepted.preRedos ?? [],
240
268
  {
@@ -283,8 +311,7 @@ const RemoveSheetDrawingCommand = {
283
311
  }
284
312
  };
285
313
 
286
- //#endregion
287
- //#region src/commands/commands/set-drawing-arrange.command.ts
314
+ // src/commands/commands/set-drawing-arrange.command.ts
288
315
  const SetDrawingArrangeCommand = {
289
316
  id: "sheet.command.set-drawing-arrange",
290
317
  type: CommandType.COMMAND,
@@ -343,8 +370,7 @@ const SetDrawingArrangeCommand = {
343
370
  }
344
371
  };
345
372
 
346
- //#endregion
347
- //#region src/services/sheet-drawing-placement.ts
373
+ // src/services/sheet-drawing-placement.ts
348
374
  const PLACEMENT_ERROR = {
349
375
  CELL_INVALID: "SHEET_DRAWING_PLACEMENT_CELL_INVALID",
350
376
  EXTENT_INVALID: "SHEET_DRAWING_PLACEMENT_EXTENT_INVALID",
@@ -379,6 +405,47 @@ function getSheetDrawingPlacement(drawing) {
379
405
  function applySheetDrawingPlacement(drawing, input, skeleton) {
380
406
  return resolveSheetDrawingPlacement(drawing, normalizePlacement(input, skeleton, requiresDrawingArea(drawing)), skeleton);
381
407
  }
408
+ /** Place a batch at the logical start corner of a Chart Sheet, preserving its relative geometry. */
409
+ function transformDrawingsToChartSheet(drawings, chartSheetBounds, rightToLeft) {
410
+ if (validateBounds(chartSheetBounds, true)) return null;
411
+ if (!drawings.length) return [];
412
+ const bounds = [];
413
+ for (const drawing of drawings) {
414
+ const state = drawing.transform;
415
+ if (!state || validateBounds(state, requiresDrawingArea(drawing)) || [
416
+ state.angle,
417
+ state.skewX,
418
+ state.skewY,
419
+ state.scaleX,
420
+ state.scaleY
421
+ ].some((value) => value !== void 0 && !Number.isFinite(value))) return null;
422
+ const { width = 0, height = 0, angle = 0 } = state;
423
+ const matrix = Transform.create().composeMatrix(state);
424
+ if (angle) matrix.rotate(-angle).translate(width / 2, height / 2).rotate(angle).translate(-width / 2, -height / 2);
425
+ const box = matrix.makeBoundingBoxFromPoints([
426
+ new Vector2(0, 0),
427
+ new Vector2(width, 0),
428
+ new Vector2(width, height),
429
+ new Vector2(0, height)
430
+ ]);
431
+ bounds.push({
432
+ left: box.left,
433
+ top: box.top,
434
+ width: box.width,
435
+ height: box.height
436
+ });
437
+ }
438
+ const group = getGroupState(0, 0, bounds);
439
+ const scale = Math.min(1, group.width ? chartSheetBounds.width / group.width : 1, group.height ? chartSheetBounds.height / group.height : 1);
440
+ const left = rightToLeft ? chartSheetBounds.left + chartSheetBounds.width - group.width * scale : chartSheetBounds.left;
441
+ return drawings.map((drawing) => applySheetDrawingPlacement(drawing, {
442
+ kind: "2",
443
+ left: left + (drawing.transform.left - group.left) * scale,
444
+ top: chartSheetBounds.top + (drawing.transform.top - group.top) * scale,
445
+ width: drawing.transform.width * scale,
446
+ height: drawing.transform.height * scale
447
+ }));
448
+ }
382
449
  /** Refresh layout-derived geometry without changing the drawing's anchor semantics. */
383
450
  function refreshSheetDrawingPlacement(drawing, skeleton) {
384
451
  const result = tryRefreshSheetDrawingPlacement(drawing, skeleton);
@@ -596,15 +663,17 @@ function createPlacementError(failure) {
596
663
  return Object.assign(error, failure.details);
597
664
  }
598
665
 
599
- //#endregion
600
- //#region src/commands/commands/set-sheet-drawing-placement.command.ts
666
+ // src/commands/commands/set-sheet-drawing-placement.command.ts
601
667
  const SetSheetDrawingPlacementCommand = {
602
668
  id: "sheet.command.set-drawing-placement",
603
669
  type: CommandType.COMMAND,
604
670
  handler: (accessor, params) => {
605
671
  if (!(params === null || params === void 0 ? void 0 : params.drawings.length)) return false;
672
+ if (!accessor.get(IDrawingManagerService).canExecuteCommand({
673
+ id: SetSheetDrawingPlacementCommand.id,
674
+ params
675
+ })) return false;
606
676
  const commandService = accessor.get(ICommandService);
607
- const undoRedoService = accessor.get(IUndoRedoService);
608
677
  const drawingService = accessor.get(ISheetDrawingService);
609
678
  const skeleton = params.drawings.every(({ placement }) => placement.kind === "2") ? void 0 : accessor.get(SheetSkeletonService).ensureSkeleton(params.unitId, params.subUnitId);
610
679
  const updatedDrawings = [];
@@ -617,45 +686,58 @@ const SetSheetDrawingPlacementCommand = {
617
686
  if (!drawing) return false;
618
687
  updatedDrawings.push(applySheetDrawingPlacement(drawing, placement, skeleton));
619
688
  }
689
+ const intercepted = accessor.get(SheetInterceptorService).onCommandExecute({
690
+ id: SetSheetDrawingPlacementCommand.id,
691
+ params
692
+ });
620
693
  const { unitId, subUnitId, undo, redo, objects } = drawingService.getBatchUpdateOp(updatedDrawings);
621
- const redoMutations = [{
622
- id: SetDrawingApplyMutation.id,
623
- params: {
624
- unitId,
625
- subUnitId,
626
- op: redo,
627
- objects,
628
- type: 2
629
- }
630
- }, {
631
- id: ClearSheetDrawingTransformerOperation.id,
632
- params: [unitId]
633
- }];
634
- const undoMutations = [{
635
- id: SetDrawingApplyMutation.id,
636
- params: {
637
- unitId,
638
- subUnitId,
639
- op: undo,
640
- objects,
641
- type: 2
642
- }
643
- }, {
644
- id: ClearSheetDrawingTransformerOperation.id,
645
- params: [unitId]
646
- }];
694
+ const redoMutations = [
695
+ ...intercepted.preRedos ?? [],
696
+ {
697
+ id: SetDrawingApplyMutation.id,
698
+ params: {
699
+ unitId,
700
+ subUnitId,
701
+ op: redo,
702
+ objects,
703
+ type: 2
704
+ }
705
+ },
706
+ {
707
+ id: ClearSheetDrawingTransformerOperation.id,
708
+ params: [unitId]
709
+ },
710
+ ...intercepted.redos
711
+ ];
712
+ const undoMutations = [
713
+ ...intercepted.preUndos ?? [],
714
+ {
715
+ id: SetDrawingApplyMutation.id,
716
+ params: {
717
+ unitId,
718
+ subUnitId,
719
+ op: undo,
720
+ objects,
721
+ type: 2
722
+ }
723
+ },
724
+ {
725
+ id: ClearSheetDrawingTransformerOperation.id,
726
+ params: [unitId]
727
+ },
728
+ ...intercepted.undos
729
+ ];
647
730
  if (!sequenceExecute(redoMutations, commandService).result) return false;
648
- undoRedoService.pushUndoRedo({
731
+ accessor.get(IUndoRedoService).pushUndoRedo({
649
732
  unitID: unitId,
650
- undoMutations,
651
- redoMutations
733
+ redoMutations,
734
+ undoMutations
652
735
  });
653
736
  return true;
654
737
  }
655
738
  };
656
739
 
657
- //#endregion
658
- //#region src/common/rotate-enabled.ts
740
+ // src/common/rotate-enabled.ts
659
741
  function isKnownSheetNonRotatableDrawingType(drawingType) {
660
742
  return drawingType === DrawingTypeEnum.DRAWING_CHART;
661
743
  }
@@ -666,8 +748,7 @@ function resolveSheetDrawingRotateEnabled(drawing, drawingService, getChildren)
666
748
  });
667
749
  }
668
750
 
669
- //#endregion
670
- //#region src/commands/commands/set-sheet-drawing.command.ts
751
+ // src/commands/commands/set-sheet-drawing.command.ts
671
752
  function hasIncomingAngle(drawing) {
672
753
  var _drawing$transform, _drawing$sheetTransfo, _drawing$axisAlignShe;
673
754
  return ((_drawing$transform = drawing.transform) === null || _drawing$transform === void 0 ? void 0 : _drawing$transform.angle) !== void 0 || ((_drawing$sheetTransfo = drawing.sheetTransform) === null || _drawing$sheetTransfo === void 0 ? void 0 : _drawing$sheetTransfo.angle) !== void 0 || ((_drawing$axisAlignShe = drawing.axisAlignSheetTransform) === null || _drawing$axisAlignShe === void 0 ? void 0 : _drawing$axisAlignShe.angle) !== void 0;
@@ -722,6 +803,10 @@ const SetSheetDrawingCommand = {
722
803
  ...params,
723
804
  drawings: normalizedDrawings
724
805
  };
806
+ if (!accessor.get(IDrawingManagerService).canExecuteCommand({
807
+ id: SetSheetDrawingCommand.id,
808
+ params: normalizedParams
809
+ })) return false;
725
810
  const { unitId, subUnitId, undo, redo, objects } = sheetDrawingService.getBatchUpdateOp(normalizedDrawings);
726
811
  const intercepted = sheetInterceptorService.onCommandExecute({
727
812
  id: SetSheetDrawingCommand.id,
@@ -775,8 +860,7 @@ const SetSheetDrawingCommand = {
775
860
  }
776
861
  };
777
862
 
778
- //#endregion
779
- //#region src/commands/mutations/set-worksheet-background-image.mutation.ts
863
+ // src/commands/mutations/set-worksheet-background-image.mutation.ts
780
864
  const SetWorksheetBackgroundImageMutation = {
781
865
  id: "sheet.mutation.set-worksheet-background-image",
782
866
  type: CommandType.MUTATION,
@@ -790,8 +874,7 @@ const SetWorksheetBackgroundImageMutation = {
790
874
  }
791
875
  };
792
876
 
793
- //#endregion
794
- //#region src/commands/commands/set-worksheet-background-image.command.ts
877
+ // src/commands/commands/set-worksheet-background-image.command.ts
795
878
  const SetWorksheetBackgroundImageCommand = {
796
879
  id: "sheet.command.set-worksheet-background-image",
797
880
  type: CommandType.COMMAND,
@@ -831,16 +914,14 @@ const SetWorksheetBackgroundImageCommand = {
831
914
  }
832
915
  };
833
916
 
834
- //#endregion
835
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
917
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
836
918
  function __decorateParam(paramIndex, decorator) {
837
919
  return function(target, key) {
838
920
  decorator(target, key, paramIndex);
839
921
  };
840
922
  }
841
923
 
842
- //#endregion
843
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
924
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
844
925
  function __decorate(decorators, target, key, desc) {
845
926
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
846
927
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -848,8 +929,7 @@ function __decorate(decorators, target, key, desc) {
848
929
  return c > 3 && r && Object.defineProperty(target, key, r), r;
849
930
  }
850
931
 
851
- //#endregion
852
- //#region src/controllers/sheet-drawing.controller.ts
932
+ // src/controllers/sheet-drawing.controller.ts
853
933
  const SHEET_DRAWING_PLUGIN = "SHEET_DRAWING_PLUGIN";
854
934
  function getDrawingsInOrder(drawingData, drawingOrder) {
855
935
  const visited = /* @__PURE__ */ new Set();
@@ -1021,13 +1101,11 @@ SheetsDrawingLoadController = __decorate([
1021
1101
  __decorateParam(5, IResourceManagerService)
1022
1102
  ], SheetsDrawingLoadController);
1023
1103
 
1024
- //#endregion
1025
- //#region package.json
1104
+ // package.json
1026
1105
  var name = "@univerjs/sheets-drawing";
1027
- var version = "1.3.1";
1106
+ var version = "1.5.0";
1028
1107
 
1029
- //#endregion
1030
- //#region src/config/config.ts
1108
+ // src/config/config.ts
1031
1109
  /**
1032
1110
  * Copyright 2023-present DreamNum Co., Ltd.
1033
1111
  *
@@ -1047,8 +1125,7 @@ const SHEETS_DRAWING_PLUGIN_CONFIG_KEY = "sheets-drawing.config";
1047
1125
  const configSymbol = Symbol(SHEETS_DRAWING_PLUGIN_CONFIG_KEY);
1048
1126
  const defaultPluginConfig = {};
1049
1127
 
1050
- //#endregion
1051
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
1128
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
1052
1129
  function _typeof(o) {
1053
1130
  "@babel/helpers - typeof";
1054
1131
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -1058,28 +1135,25 @@ function _typeof(o) {
1058
1135
  }, _typeof(o);
1059
1136
  }
1060
1137
 
1061
- //#endregion
1062
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
1063
- function toPrimitive(t, r) {
1138
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
1139
+ function toPrimitive(t, e) {
1064
1140
  if ("object" != _typeof(t) || !t) return t;
1065
- var e = t[Symbol.toPrimitive];
1066
- if (void 0 !== e) {
1067
- var i = e.call(t, r || "default");
1141
+ var r;
1142
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
1143
+ var i = r.call(t, e || "default");
1068
1144
  if ("object" != _typeof(i)) return i;
1069
1145
  throw new TypeError("@@toPrimitive must return a primitive value.");
1070
1146
  }
1071
- return ("string" === r ? String : Number)(t);
1147
+ return ("string" === e ? String : Number)(t);
1072
1148
  }
1073
1149
 
1074
- //#endregion
1075
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
1150
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
1076
1151
  function toPropertyKey(t) {
1077
1152
  var i = toPrimitive(t, "string");
1078
1153
  return "symbol" == _typeof(i) ? i : i + "";
1079
1154
  }
1080
1155
 
1081
- //#endregion
1082
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
1156
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
1083
1157
  function _defineProperty(e, r, t) {
1084
1158
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1085
1159
  value: t,
@@ -1089,8 +1163,7 @@ function _defineProperty(e, r, t) {
1089
1163
  }) : e[r] = t, e;
1090
1164
  }
1091
1165
 
1092
- //#endregion
1093
- //#region src/services/sheet-drawing-transform-plan.service.ts
1166
+ // src/services/sheet-drawing-transform-plan.service.ts
1094
1167
  function createEmptyResult() {
1095
1168
  return {
1096
1169
  preRedos: [],
@@ -1124,8 +1197,7 @@ var SheetDrawingTransformPlanService = class {
1124
1197
  }
1125
1198
  };
1126
1199
 
1127
- //#endregion
1128
- //#region src/controllers/sheet-drawing-transform-affected.controller.ts
1200
+ // src/controllers/sheet-drawing-transform-affected.controller.ts
1129
1201
  const UPDATE_COMMANDS = [
1130
1202
  InsertRowCommand.id,
1131
1203
  InsertColCommand.id,
@@ -2070,8 +2142,7 @@ SheetDrawingTransformAffectedController = __decorate([
2070
2142
  __decorateParam(7, ILogService)
2071
2143
  ], SheetDrawingTransformAffectedController);
2072
2144
 
2073
- //#endregion
2074
- //#region src/plugin.ts
2145
+ // src/plugin.ts
2075
2146
  let UniverSheetsDrawingPlugin = class UniverSheetsDrawingPlugin extends Plugin {
2076
2147
  constructor(_config = defaultPluginConfig, _injector, _configService) {
2077
2148
  super();
@@ -2102,5 +2173,4 @@ UniverSheetsDrawingPlugin = __decorate([
2102
2173
  __decorateParam(2, IConfigService)
2103
2174
  ], UniverSheetsDrawingPlugin);
2104
2175
 
2105
- //#endregion
2106
- export { ClearSheetDrawingTransformerOperation, DrawingApplyType, ISheetDrawingService, InsertSheetDrawingCommand, RemoveSheetDrawingCommand, SHEET_DRAWING_PLUGIN, SetDrawingApplyMutation, SetDrawingArrangeCommand, SetSheetDrawingCommand, SetSheetDrawingPlacementCommand, SetWorksheetBackgroundImageCommand, SetWorksheetBackgroundImageMutation, SheetDrawingAnchorType, SheetDrawingService, SheetDrawingTransformPlanService, UniverSheetsDrawingPlugin, applySheetDrawingPlacement, drawingPositionToTransform, getSheetDrawingPlacement, isKnownSheetNonRotatableDrawingType, normalizeSheetDrawingPlacement, refreshSheetDrawingPlacement, resolveSheetDrawingRotateEnabled, transformToAxisAlignPosition, transformToDrawingPosition };
2176
+ export { ClearSheetDrawingTransformerOperation, DrawingApplyType, ISheetDrawingService, InsertSheetDrawingCommand, RemoveSheetDrawingCommand, SHEET_DRAWING_PLUGIN, SetDrawingApplyMutation, SetDrawingArrangeCommand, SetSheetDrawingCommand, SetSheetDrawingPlacementCommand, SetWorksheetBackgroundImageCommand, SetWorksheetBackgroundImageMutation, SheetDrawingAnchorType, SheetDrawingService, SheetDrawingTransformPlanService, UniverSheetsDrawingPlugin, applySheetDrawingPlacement, drawingPositionToTransform, getSheetDrawingPlacement, isKnownSheetNonRotatableDrawingType, normalizeSheetDrawingPlacement, refreshSheetDrawingPlacement, resolveSheetDrawingRotateEnabled, transformDrawingsToChartSheet, transformToAxisAlignPosition, transformToDrawingPosition };
@@ -13,7 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { DrawingTypeEnum, ICommand } from '@univerjs/core';
16
+ import type { ICommand } from '@univerjs/core';
17
+ import { DrawingTypeEnum } from '@univerjs/core';
17
18
  export interface IRemoveSheetDrawingCommandParam {
18
19
  unitId: string;
19
20
  subUnitId: string;
@@ -611,6 +611,10 @@ export declare class FOverGridImage extends FBase {
611
611
  setPlacement(placement: ISheetDrawingPlacementInput): boolean;
612
612
  /**
613
613
  * Remove the image from the sheet
614
+ *
615
+ * For multiple images on the same worksheet, prefer {@link FWorksheet.deleteImages} with the image
616
+ * handles instead of calling this method on each image.
617
+ *
614
618
  * @returns {boolean} true if the image is removed successfully, otherwise false
615
619
  * @example
616
620
  * ```ts
@@ -57,6 +57,11 @@ export interface IFWorksheetDrawingMixin {
57
57
  deleteBackgroundImage(): this;
58
58
  /**
59
59
  * Insert an image to the sheet
60
+ *
61
+ * For multiple images, prefer {@link FWorksheet.insertImages} instead of repeated insertions.
62
+ * Prepare each ISheetImage with {@link FWorksheet.newOverGridImage} and `buildAsync()`, then pass
63
+ * the complete array to `insertImages()`; it accepts image data, not URLs or blobs.
64
+ *
60
65
  * @param {string} url - The image url
61
66
  * @returns {Promise<boolean>} true if the image is inserted successfully
62
67
  * @example
@@ -70,6 +75,10 @@ export interface IFWorksheetDrawingMixin {
70
75
  */
71
76
  insertImage(url: string): Promise<boolean>;
72
77
  /**
78
+ * For multiple images, prefer {@link FWorksheet.insertImages} instead of repeated insertions.
79
+ * Prepare each ISheetImage with {@link FWorksheet.newOverGridImage} and `buildAsync()`, then pass
80
+ * the complete array to `insertImages()`; it accepts image data, not URLs or blobs.
81
+ *
73
82
  * @param {string} url - The image url
74
83
  * @param {number} column - The column index to insert the image
75
84
  * @param {number} row - The row index to insert the image
@@ -85,6 +94,10 @@ export interface IFWorksheetDrawingMixin {
85
94
  */
86
95
  insertImage(url: string, column: number, row: number): Promise<boolean>;
87
96
  /**
97
+ * For multiple images, prefer {@link FWorksheet.insertImages} instead of repeated insertions.
98
+ * Prepare each ISheetImage with {@link FWorksheet.newOverGridImage} and `buildAsync()`, then pass
99
+ * the complete array to `insertImages()`; it accepts image data, not URLs or blobs.
100
+ *
88
101
  * @param {string} url - The image url
89
102
  * @param {number} column - The column index to insert the image
90
103
  * @param {number} row - The row index to insert the image
@@ -35,7 +35,7 @@ export { isKnownSheetNonRotatableDrawingType, resolveSheetDrawingRotateEnabled }
35
35
  export type { IUniverSheetsDrawingConfig } from './config/config';
36
36
  export { SHEET_DRAWING_PLUGIN } from './controllers/sheet-drawing.controller';
37
37
  export { UniverSheetsDrawingPlugin } from './plugin';
38
- export { applySheetDrawingPlacement, getSheetDrawingPlacement, normalizeSheetDrawingPlacement, refreshSheetDrawingPlacement, } from './services/sheet-drawing-placement';
38
+ export { applySheetDrawingPlacement, getSheetDrawingPlacement, normalizeSheetDrawingPlacement, refreshSheetDrawingPlacement, transformDrawingsToChartSheet, } from './services/sheet-drawing-placement';
39
39
  export type { ISheetDrawingAbsolutePlacement, ISheetDrawingOneCellPlacement, ISheetDrawingPlacement, ISheetDrawingPlacementByBounds, ISheetDrawingPlacementInput, ISheetDrawingTwoCellPlacement, } from './services/sheet-drawing-placement';
40
40
  export { SheetDrawingTransformPlanService } from './services/sheet-drawing-transform-plan.service';
41
41
  export type { ISheetDrawingTransformExtension, ISheetDrawingTransformExtensionResult, ISheetDrawingTransformPlan, } from './services/sheet-drawing-transform-plan.service';