@univerjs-pro/sheets-shape-ui 0.15.5 → 0.16.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.
Files changed (78) hide show
  1. package/README.md +30 -0
  2. package/lib/cjs/facade.js +1 -0
  3. package/lib/cjs/index.js +1 -1
  4. package/lib/cjs/locale/ca-ES.js +1 -1
  5. package/lib/cjs/locale/en-US.js +1 -1
  6. package/lib/cjs/locale/es-ES.js +1 -1
  7. package/lib/cjs/locale/fa-IR.js +1 -1
  8. package/lib/cjs/locale/fr-FR.js +1 -1
  9. package/lib/cjs/locale/ja-JP.js +1 -1
  10. package/lib/cjs/locale/ko-KR.js +1 -1
  11. package/lib/cjs/locale/ru-RU.js +1 -1
  12. package/lib/cjs/locale/sk-SK.js +1 -1
  13. package/lib/cjs/locale/vi-VN.js +1 -1
  14. package/lib/cjs/locale/zh-CN.js +1 -1
  15. package/lib/cjs/locale/zh-TW.js +1 -1
  16. package/lib/es/facade.js +1 -0
  17. package/lib/es/index.js +1 -1
  18. package/lib/es/locale/ca-ES.js +1 -1
  19. package/lib/es/locale/en-US.js +1 -1
  20. package/lib/es/locale/es-ES.js +1 -1
  21. package/lib/es/locale/fa-IR.js +1 -1
  22. package/lib/es/locale/fr-FR.js +1 -1
  23. package/lib/es/locale/ja-JP.js +1 -1
  24. package/lib/es/locale/ko-KR.js +1 -1
  25. package/lib/es/locale/ru-RU.js +1 -1
  26. package/lib/es/locale/sk-SK.js +1 -1
  27. package/lib/es/locale/vi-VN.js +1 -1
  28. package/lib/es/locale/zh-CN.js +1 -1
  29. package/lib/es/locale/zh-TW.js +1 -1
  30. package/lib/facade.js +1 -0
  31. package/lib/index.css +1 -0
  32. package/lib/index.js +1 -1
  33. package/lib/locale/ca-ES.js +1 -1
  34. package/lib/locale/en-US.js +1 -1
  35. package/lib/locale/es-ES.js +1 -1
  36. package/lib/locale/fa-IR.js +1 -1
  37. package/lib/locale/fr-FR.js +1 -1
  38. package/lib/locale/ja-JP.js +1 -1
  39. package/lib/locale/ko-KR.js +1 -1
  40. package/lib/locale/ru-RU.js +1 -1
  41. package/lib/locale/sk-SK.js +1 -1
  42. package/lib/locale/vi-VN.js +1 -1
  43. package/lib/locale/zh-CN.js +1 -1
  44. package/lib/locale/zh-TW.js +1 -1
  45. package/lib/types/commands/command/set-shape-drawing-data-command.d.ts +13 -0
  46. package/lib/types/controllers/shape-sheet-change.controller.d.ts +12 -0
  47. package/lib/types/controllers/shape-text-editing.render-controller.d.ts +3 -3
  48. package/lib/types/controllers/shape-update.controller.d.ts +1 -0
  49. package/lib/types/controllers/sheet-basic-shape-connection.controller.d.ts +3 -3
  50. package/lib/types/controllers/sheet-shape-adjust-controller.d.ts +3 -3
  51. package/lib/types/controllers/sheet-shape-clipboard.controller.d.ts +20 -0
  52. package/lib/types/controllers/sheet-shape-command-interceptor.controller.d.ts +3 -3
  53. package/lib/types/controllers/sheet-shape-connector.controller.d.ts +3 -3
  54. package/lib/types/controllers/sheet-shape-render.controller.d.ts +3 -3
  55. package/lib/types/controllers/sheets-shape-ui.controller.d.ts +3 -3
  56. package/lib/types/facade/f-connector-shape.d.ts +180 -0
  57. package/lib/types/facade/f-enum.d.ts +194 -0
  58. package/lib/types/facade/f-shape.d.ts +642 -0
  59. package/lib/types/facade/f-worksheet.d.ts +231 -0
  60. package/lib/types/facade/index.d.ts +13 -0
  61. package/lib/types/index.d.ts +12 -0
  62. package/lib/types/views/shape-text-editor/index.d.ts +1 -2
  63. package/lib/types/views/shape-text-editor/position-wrapper.d.ts +1 -2
  64. package/lib/umd/facade.js +1 -0
  65. package/lib/umd/index.js +1 -1
  66. package/lib/umd/locale/ca-ES.js +1 -1
  67. package/lib/umd/locale/en-US.js +1 -1
  68. package/lib/umd/locale/es-ES.js +1 -1
  69. package/lib/umd/locale/fa-IR.js +1 -1
  70. package/lib/umd/locale/fr-FR.js +1 -1
  71. package/lib/umd/locale/ja-JP.js +1 -1
  72. package/lib/umd/locale/ko-KR.js +1 -1
  73. package/lib/umd/locale/ru-RU.js +1 -1
  74. package/lib/umd/locale/sk-SK.js +1 -1
  75. package/lib/umd/locale/vi-VN.js +1 -1
  76. package/lib/umd/locale/zh-CN.js +1 -1
  77. package/lib/umd/locale/zh-TW.js +1 -1
  78. package/package.json +26 -16
@@ -0,0 +1,13 @@
1
+ import { IShapeData, ShapeTypeEnum } from '@univerjs-pro/engine-shape';
2
+ import { ICommand, ITransformState } from '@univerjs/core';
3
+ import { ISheetCommandSharedParams } from '@univerjs/sheets';
4
+ import { ISheetDrawingPosition } from '@univerjs/sheets-drawing';
5
+ export interface ISetShapeDrawingDataCommandParams extends ISheetCommandSharedParams {
6
+ shapeId: string;
7
+ shapeType: ShapeTypeEnum;
8
+ shapeData?: IShapeData;
9
+ transform: ITransformState;
10
+ sheetTransform: ISheetDrawingPosition;
11
+ axisAlignSheetTransform: ISheetDrawingPosition;
12
+ }
13
+ export declare const SetShapeDrawingDataCommand: ICommand;
@@ -0,0 +1,12 @@
1
+ import { SheetsShapeService } from '@univerjs-pro/sheets-shape';
2
+ import { Disposable, IUniverInstanceService } from '@univerjs/core';
3
+ import { SheetInterceptorService } from '@univerjs/sheets';
4
+ import { ISheetDrawingService } from '@univerjs/sheets-drawing';
5
+ export declare class ShapeSheetChangeController extends Disposable {
6
+ private _univerInstanceService;
7
+ private readonly _sheetInterceptorService;
8
+ private readonly _sheetDrawingService;
9
+ private readonly _sheetsShapeService;
10
+ constructor(_univerInstanceService: IUniverInstanceService, _sheetInterceptorService: SheetInterceptorService, _sheetDrawingService: ISheetDrawingService, _sheetsShapeService: SheetsShapeService);
11
+ private _initSheetChange;
12
+ }
@@ -1,6 +1,6 @@
1
1
  import { Workbook, Disposable, IContextService } from '@univerjs/core';
2
2
  import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
3
- import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
3
+ import { SheetsShapeService } from '@univerjs-pro/sheets-shape';
4
4
  import { IDrawingManagerService } from '@univerjs/drawing';
5
5
  import { ShapeTextEditingService } from '../services/shape-text-editing.service';
6
6
  export declare class ShapeTextEditingRenderController extends Disposable implements IRenderModule {
@@ -8,9 +8,9 @@ export declare class ShapeTextEditingRenderController extends Disposable impleme
8
8
  private readonly _shapeTextEditingService;
9
9
  private readonly _drawingManagerService;
10
10
  private readonly _contextService;
11
- private _sheetsShapeServices;
11
+ private _sheetsShapeService;
12
12
  private _lastEditingShapeKey;
13
- constructor(_context: IRenderContext<Workbook>, _shapeTextEditingService: ShapeTextEditingService, _drawingManagerService: IDrawingManagerService, _contextService: IContextService, _sheetsShapeServices: SheetsShapeServices);
13
+ constructor(_context: IRenderContext<Workbook>, _shapeTextEditingService: ShapeTextEditingService, _drawingManagerService: IDrawingManagerService, _contextService: IContextService, _sheetsShapeService: SheetsShapeService);
14
14
  private _initEvents;
15
15
  private _initSelection;
16
16
  private _initEditingParams;
@@ -13,6 +13,7 @@ export declare class ShapeUpdateController extends Disposable {
13
13
  constructor(_commandService: ICommandService, _renderManagerService: IRenderManagerService, _drawingManagerService: IDrawingManagerService, _currentUniverService: IUniverInstanceService, _drawingRenderService: DrawingRenderService, _sheetDrawingShapeRenderController: SheetDrawingShapeRenderController);
14
14
  private _initialize;
15
15
  private _drawingAddListener;
16
+ private _commandExecutedListener;
16
17
  private _shapeUpdateListener;
17
18
  private _insertShapes;
18
19
  private _getSceneAndTransformerByDrawingSearch;
@@ -1,7 +1,7 @@
1
1
  import { IShapePoint, IShapeRelationItem } from '@univerjs-pro/engine-shape';
2
2
  import { Workbook, Disposable } from '@univerjs/core';
3
3
  import { IRenderContext, Scene, IRenderManagerService } from '@univerjs/engine-render';
4
- import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
4
+ import { SheetsShapeService } from '@univerjs-pro/sheets-shape';
5
5
  import { IDrawingManagerService } from '@univerjs/drawing';
6
6
  /**
7
7
  * Information about a potential connection target
@@ -33,7 +33,7 @@ export declare class SheetBasicShapeConnectionPointController extends Disposable
33
33
  private readonly _context;
34
34
  private readonly _renderManagerService;
35
35
  private readonly _drawingManagerService;
36
- private readonly _sheetsShapeServices;
36
+ private readonly _sheetsShapeService;
37
37
  /** Currently displayed connection site objects */
38
38
  private _connectionSiteObjects;
39
39
  /** The shape ID whose connection sites are currently being shown */
@@ -47,7 +47,7 @@ export declare class SheetBasicShapeConnectionPointController extends Disposable
47
47
  private _subUnitId;
48
48
  /** The connector shape ID that is being dragged (to exclude from target detection) */
49
49
  private _draggingConnectorId;
50
- constructor(_context: IRenderContext<Workbook>, _renderManagerService: IRenderManagerService, _drawingManagerService: IDrawingManagerService, _sheetsShapeServices: SheetsShapeServices);
50
+ constructor(_context: IRenderContext<Workbook>, _renderManagerService: IRenderManagerService, _drawingManagerService: IDrawingManagerService, _sheetsShapeService: SheetsShapeService);
51
51
  /**
52
52
  * Called when connector endpoint dragging starts.
53
53
  * Sets up the context for connection site detection.
@@ -1,13 +1,13 @@
1
1
  import { Workbook, Disposable, ICommandService, IContextService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
3
- import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
3
+ import { SheetsShapeService } from '@univerjs-pro/sheets-shape';
4
4
  import { IDrawingManagerService } from '@univerjs/drawing';
5
5
  import { SheetDrawingShapeRenderController } from './sheet-shape-render.controller';
6
6
  export declare class SheetShapeAdjustController extends Disposable implements IRenderModule {
7
7
  private readonly _context;
8
8
  private readonly _contextService;
9
9
  private _drawingManagerService;
10
- private _sheetsShapeServices;
10
+ private _sheetsShapeService;
11
11
  private readonly _renderManagerService;
12
12
  private readonly _sheetDrawingShapeRenderController;
13
13
  private readonly _univerInstanceService;
@@ -27,7 +27,7 @@ export declare class SheetShapeAdjustController extends Disposable implements IR
27
27
  private _adjHandlerPointerMove;
28
28
  private _adjHandlerPointerUp;
29
29
  private _isDrawingShapePointDown;
30
- constructor(_context: IRenderContext<Workbook>, _contextService: IContextService, _drawingManagerService: IDrawingManagerService, _sheetsShapeServices: SheetsShapeServices, _renderManagerService: IRenderManagerService, _sheetDrawingShapeRenderController: SheetDrawingShapeRenderController, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService);
30
+ constructor(_context: IRenderContext<Workbook>, _contextService: IContextService, _drawingManagerService: IDrawingManagerService, _sheetsShapeService: SheetsShapeService, _renderManagerService: IRenderManagerService, _sheetDrawingShapeRenderController: SheetDrawingShapeRenderController, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService);
31
31
  private _getShapeAdjustPointListById;
32
32
  clearAdjustControls(): void;
33
33
  refreshAdjustControls(): void;
@@ -0,0 +1,20 @@
1
+ import { SheetsShapeService } from '@univerjs-pro/sheets-shape';
2
+ import { Disposable } from '@univerjs/core';
3
+ import { IRenderManagerService } from '@univerjs/engine-render';
4
+ import { ISheetDrawingService } from '@univerjs/sheets-drawing';
5
+ import { ISheetClipboardService } from '@univerjs/sheets-ui';
6
+ export declare class SheetShapeClipboardController extends Disposable {
7
+ private readonly _renderManagerService;
8
+ private _sheetClipboardService;
9
+ private readonly _sheetDrawingService;
10
+ private readonly _shapeService;
11
+ private _copyInfo;
12
+ constructor(_renderManagerService: IRenderManagerService, _sheetClipboardService: ISheetClipboardService, _sheetDrawingService: ISheetDrawingService, _shapeService: SheetsShapeService);
13
+ private get _focusedDrawings();
14
+ private _initCopyPaste;
15
+ private _createCopyInfoByRange;
16
+ private _generatePasteMutations;
17
+ private _generateCutPasteMutations;
18
+ private _generateCopyPasteMutations;
19
+ private _updateTransform;
20
+ }
@@ -1,4 +1,4 @@
1
- import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
1
+ import { SheetsShapeService } from '@univerjs-pro/sheets-shape';
2
2
  import { Disposable, IUniverInstanceService } from '@univerjs/core';
3
3
  import { IDrawingManagerService } from '@univerjs/drawing';
4
4
  import { IRenderManagerService } from '@univerjs/engine-render';
@@ -8,10 +8,10 @@ export declare class SheetsShapeCmdInterceptorController extends Disposable {
8
8
  private readonly _univerInstanceService;
9
9
  private readonly _sheetInterceptorService;
10
10
  protected readonly _menuManagerService: IMenuManagerService;
11
- private _sheetsShapeServices;
11
+ private _sheetsShapeService;
12
12
  private _drawingManagerService;
13
13
  private readonly _renderManagerService;
14
- constructor(_univerInstanceService: IUniverInstanceService, _sheetInterceptorService: SheetInterceptorService, _menuManagerService: IMenuManagerService, _sheetsShapeServices: SheetsShapeServices, _drawingManagerService: IDrawingManagerService, _renderManagerService: IRenderManagerService);
14
+ constructor(_univerInstanceService: IUniverInstanceService, _sheetInterceptorService: SheetInterceptorService, _menuManagerService: IMenuManagerService, _sheetsShapeService: SheetsShapeService, _drawingManagerService: IDrawingManagerService, _renderManagerService: IRenderManagerService);
15
15
  private _initCommandInterceptor;
16
16
  /**
17
17
  * Get the IConnectPointInfo for a connected shape based on the relation item.
@@ -1,6 +1,6 @@
1
1
  import { Workbook, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { IRenderContext, IRenderManagerService } from '@univerjs/engine-render';
3
- import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
3
+ import { SheetsShapeService } from '@univerjs-pro/sheets-shape';
4
4
  import { IDrawingManagerService } from '@univerjs/drawing';
5
5
  import { SheetBasicShapeConnectionPointController } from './sheet-basic-shape-connection.controller';
6
6
  import { SheetShapeAdjustController } from './sheet-shape-adjust-controller';
@@ -10,7 +10,7 @@ export declare class SheetShapeConnectorController extends Disposable {
10
10
  private readonly _renderManagerService;
11
11
  private readonly _drawingManagerService;
12
12
  private readonly _univerInstanceService;
13
- private readonly _sheetsShapeServices;
13
+ private readonly _sheetsShapeService;
14
14
  private readonly _sheetShapeAdjustController;
15
15
  private readonly _sheetBasicShapeConnectionPointController;
16
16
  private _activeShapeId;
@@ -30,7 +30,7 @@ export declare class SheetShapeConnectorController extends Disposable {
30
30
  private _cxtHandlerPointerUp;
31
31
  /** Current connection target (if any) during drag */
32
32
  private _currentConnectionTarget;
33
- constructor(_context: IRenderContext<Workbook>, _commandService: ICommandService, _renderManagerService: IRenderManagerService, _drawingManagerService: IDrawingManagerService, _univerInstanceService: IUniverInstanceService, _sheetsShapeServices: SheetsShapeServices, _sheetShapeAdjustController: SheetShapeAdjustController, _sheetBasicShapeConnectionPointController: SheetBasicShapeConnectionPointController);
33
+ constructor(_context: IRenderContext<Workbook>, _commandService: ICommandService, _renderManagerService: IRenderManagerService, _drawingManagerService: IDrawingManagerService, _univerInstanceService: IUniverInstanceService, _sheetsShapeService: SheetsShapeService, _sheetShapeAdjustController: SheetShapeAdjustController, _sheetBasicShapeConnectionPointController: SheetBasicShapeConnectionPointController);
34
34
  private _initialize;
35
35
  /**
36
36
  * Get the current drawing rect from the drawing manager.
@@ -1,12 +1,12 @@
1
1
  import { Scene } from '@univerjs/engine-render';
2
2
  import { IDrawingShapeData, DrawingShape } from '../view-model/drawing-shape';
3
- import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
3
+ import { SheetsShapeService } from '@univerjs-pro/sheets-shape';
4
4
  import { Disposable, LocaleService } from '@univerjs/core';
5
5
  import { IDrawingManagerService } from '@univerjs/drawing';
6
6
  export declare class SheetDrawingShapeRenderController extends Disposable {
7
7
  private readonly _drawingManagerService;
8
- private readonly _sheetsShapeServices;
8
+ private readonly _sheetsShapeService;
9
9
  private readonly _localeService;
10
- constructor(_drawingManagerService: IDrawingManagerService, _sheetsShapeServices: SheetsShapeServices, _localeService: LocaleService);
10
+ constructor(_drawingManagerService: IDrawingManagerService, _sheetsShapeService: SheetsShapeService, _localeService: LocaleService);
11
11
  renderDrawingShape(drawingShapeParam: IDrawingShapeData, scene: Scene): DrawingShape[] | undefined;
12
12
  }
@@ -1,4 +1,4 @@
1
- import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
1
+ import { SheetsShapeService } from '@univerjs-pro/sheets-shape';
2
2
  import { Disposable, DrawingTypeEnum, ICommandService, IContextService, IUniverInstanceService, LocaleService } from '@univerjs/core';
3
3
  import { IDrawingManagerService } from '@univerjs/drawing';
4
4
  import { SheetInterceptorService } from '@univerjs/sheets';
@@ -9,7 +9,7 @@ export declare class SheetsShapeUIController extends Disposable {
9
9
  private readonly _sheetInterceptorService;
10
10
  private _sidebarService;
11
11
  protected readonly _menuManagerService: IMenuManagerService;
12
- private _sheetsShapeServices;
12
+ private _sheetsShapeService;
13
13
  private readonly _localeService;
14
14
  private _componentManager;
15
15
  private readonly _commandService;
@@ -19,7 +19,7 @@ export declare class SheetsShapeUIController extends Disposable {
19
19
  private _sidebarDisposable;
20
20
  private _activeShapeInfo;
21
21
  private _isOpenedShapeEditPanel;
22
- constructor(_univerInstanceService: IUniverInstanceService, _sheetInterceptorService: SheetInterceptorService, _sidebarService: ISidebarService, _menuManagerService: IMenuManagerService, _sheetsShapeServices: SheetsShapeServices, _localeService: LocaleService, _componentManager: ComponentManager, _commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _sheetCanvasPopManagerService: SheetCanvasPopManagerService, _contextService: IContextService);
22
+ constructor(_univerInstanceService: IUniverInstanceService, _sheetInterceptorService: SheetInterceptorService, _sidebarService: ISidebarService, _menuManagerService: IMenuManagerService, _sheetsShapeService: SheetsShapeService, _localeService: LocaleService, _componentManager: ComponentManager, _commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _sheetCanvasPopManagerService: SheetCanvasPopManagerService, _contextService: IContextService);
23
23
  private _initMenu;
24
24
  private _registerShapeMenu;
25
25
  getShapePopupMenus(unitId: string, subUnitId: string, drawingId: string, drawingType: DrawingTypeEnum): ({
@@ -0,0 +1,180 @@
1
+ import { ICxnShapeData, IShapeRelationItem, ShapeArrowSizeEnum, ShapeArrowTypeEnum, ShapeTypeEnum } from '@univerjs-pro/engine-shape';
2
+ import { Injector } from '@univerjs/core';
3
+ import { IShapeBuilderInfo, FShape } from './f-shape';
4
+ /**
5
+ * The connector shape builder. It extends `FShape` and adds connector-specific properties
6
+ * such as start/end arrow types and sizes. Use `fWorksheet.newConnector()` to create a new connector builder.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const fWorkbook = univerAPI.getActiveWorkbook();
11
+ * const fWorksheet = fWorkbook.getActiveSheet();
12
+ *
13
+ * // Create a straight connector with arrows
14
+ * const connectorInfo = fWorksheet.newConnector()
15
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.StraightConnector1)
16
+ * .setPosition(1, 1, 0, 0)
17
+ * .setWidth(200)
18
+ * .setHeight(100)
19
+ * .setStartArrowType(univerAPI.Enum.ShapeArrowTypeEnum.Arrow)
20
+ * .setEndArrowType(univerAPI.Enum.ShapeArrowTypeEnum.Arrow)
21
+ * .setStrokeColor('#000000')
22
+ * .setStrokeWidth(2)
23
+ * .build();
24
+ * await fWorksheet.insertShape(connectorInfo);
25
+ * ```
26
+ */
27
+ export declare class FConnectorShape extends FShape {
28
+ /**
29
+ * @property {ICxnShapeData} shapeData The connector shape data containing line styles, arrow settings, and connection info.
30
+ */
31
+ shapeData: ICxnShapeData;
32
+ constructor(unitId: string, subUnitId: string, drawingId: string, injector: Injector);
33
+ setShapeType(shapeType: ShapeTypeEnum): this;
34
+ /**
35
+ * Sets the start arrow type of the connector line.
36
+ * @param {ShapeArrowTypeEnum} arrowType The arrow type for the start point. Which can be found from `univerAPI.Enum.ShapeArrowTypeEnum`.
37
+ * @returns {FConnectorShape} this builder, for chaining.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const fWorkbook = univerAPI.getActiveWorkbook();
42
+ * const fWorksheet = fWorkbook.getActiveSheet();
43
+ *
44
+ * const connectorInfo = fWorksheet.newConnector()
45
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.StraightConnector1)
46
+ * .setStartArrowType(univerAPI.Enum.ShapeArrowTypeEnum.Arrow)
47
+ * .setPosition(1, 1, 0, 0)
48
+ * .build();
49
+ * await fWorksheet.insertShape(connectorInfo);
50
+ * ```
51
+ */
52
+ setStartArrowType(arrowType: ShapeArrowTypeEnum): this;
53
+ /**
54
+ * Sets the end arrow type of the connector line.
55
+ * @param {ShapeArrowTypeEnum} arrowType The arrow type for the end point. Which can be found from `univerAPI.Enum.ShapeArrowTypeEnum`.
56
+ * @returns {FConnectorShape} this builder, for chaining.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const fWorkbook = univerAPI.getActiveWorkbook();
61
+ * const fWorksheet = fWorkbook.getActiveSheet();
62
+ *
63
+ * const connectorInfo = fWorksheet.newConnector()
64
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.StraightConnector1)
65
+ * .setEndArrowType(univerAPI.Enum.ShapeArrowTypeEnum.StealthArrow)
66
+ * .setPosition(1, 1, 0, 0)
67
+ * .build();
68
+ * await fWorksheet.insertShape(connectorInfo);
69
+ * ```
70
+ */
71
+ setEndArrowType(arrowType: ShapeArrowTypeEnum): this;
72
+ /**
73
+ * Sets the start arrow size of the connector line.
74
+ * @param {ShapeArrowSizeEnum} arrowSize The arrow size for the start point.
75
+ * @returns {FConnectorShape} this builder, for chaining.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const fWorkbook = univerAPI.getActiveWorkbook();
80
+ * const fWorksheet = fWorkbook.getActiveSheet();
81
+ *
82
+ * const connectorInfo = fWorksheet.newConnector()
83
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.StraightConnector1)
84
+ * .setStartArrowType(univerAPI.Enum.ShapeArrowTypeEnum.OvalArrow)
85
+ * .setStartArrowSize(univerAPI.Enum.ShapeArrowSizeEnum.Large)
86
+ * .setPosition(1, 1, 0, 0)
87
+ * .setWidth(200)
88
+ * .build();
89
+ * await fWorksheet.insertShape(connectorInfo);
90
+ * ```
91
+ */
92
+ setStartArrowSize(arrowSize: ShapeArrowSizeEnum): this;
93
+ /**
94
+ * Sets the end arrow size of the connector line.
95
+ * @param {ShapeArrowSizeEnum} arrowSize The arrow size for the end point.
96
+ * @returns {FConnectorShape} this builder, for chaining.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const fWorkbook = univerAPI.getActiveWorkbook();
101
+ * const fWorksheet = fWorkbook.getActiveSheet();
102
+ *
103
+ * const connectorInfo = fWorksheet.newConnector()
104
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.StraightConnector1)
105
+ * .setEndArrowType(univerAPI.Enum.ShapeArrowTypeEnum.Arrow)
106
+ * .setEndArrowSize(univerAPI.Enum.ShapeArrowSizeEnum.Large)
107
+ * .setStrokeWidth(3)
108
+ * .setPosition(1, 1, 0, 0)
109
+ * .build();
110
+ * await fWorksheet.insertShape(connectorInfo);
111
+ * ```
112
+ */
113
+ setEndArrowSize(arrowSize: ShapeArrowSizeEnum): this;
114
+ /**
115
+ * Builds the connector shape builder info. This method does not automatically draw the connector on top of the spreadsheet.
116
+ * A new connector must be inserted via `fWorksheet.insertShape(shapeInfo)`.
117
+ * @returns {IShapeBuilderInfo} The shape builder info containing all the accumulated properties.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * const fWorkbook = univerAPI.getActiveWorkbook();
122
+ * const fWorksheet = fWorkbook.getActiveSheet();
123
+ *
124
+ * const connectorInfo = fWorksheet.newConnector()
125
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.StraightConnector1)
126
+ * .setPosition(1, 1, 0, 0)
127
+ * .setWidth(200)
128
+ * .setHeight(100)
129
+ * .setStartArrowType(univerAPI.Enum.ShapeArrowTypeEnum.Arrow)
130
+ * .setEndArrowType(univerAPI.Enum.ShapeArrowTypeEnum.Arrow)
131
+ * .setStrokeColor('#000000')
132
+ * .setStrokeWidth(2)
133
+ * .build();
134
+ * await fWorksheet.insertShape(connectorInfo);
135
+ * ```
136
+ */
137
+ build(): IShapeBuilderInfo;
138
+ /**
139
+ * Returns the end connection info for this connector shape.
140
+ * If this connector's end point is connected to a basic shape, returns the target shape id and connection site index.
141
+ * @returns {IShapeRelationItem | null} The end connection info, or `null` if not connected.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const fWorkbook = univerAPI.getActiveWorkbook();
146
+ * const fWorksheet = fWorkbook.getActiveSheet();
147
+ * const shapes = fWorksheet.getShapes();
148
+ * const connector = shapes.find((s) => s.isLineShape());
149
+ *
150
+ * if (connector) {
151
+ * const endInfo = connector.getEndConnectInfo();
152
+ * if (endInfo) {
153
+ * console.log(`End connected to shape ${endInfo.shapeId} at site ${endInfo.cxnIndex}`);
154
+ * }
155
+ * }
156
+ * ```
157
+ */
158
+ getEndConnectInfo(): IShapeRelationItem | null;
159
+ /**
160
+ * Returns the start connection info for this connector shape.
161
+ * If this connector's start point is connected to a basic shape, returns the target shape id and connection site index.
162
+ * @returns {IShapeRelationItem | null} The start connection info, or `null` if not connected.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * const fWorkbook = univerAPI.getActiveWorkbook();
167
+ * const fWorksheet = fWorkbook.getActiveSheet();
168
+ * const shapes = fWorksheet.getShapes();
169
+ * const connector = shapes.find((s) => s.isLineShape());
170
+ *
171
+ * if (connector) {
172
+ * const startInfo = connector.getStartConnectInfo();
173
+ * if (startInfo) {
174
+ * console.log(`Start connected to shape ${startInfo.shapeId} at site ${startInfo.cxnIndex}`);
175
+ * }
176
+ * }
177
+ * ```
178
+ */
179
+ getStartConnectInfo(): IShapeRelationItem | null;
180
+ }
@@ -0,0 +1,194 @@
1
+ import { ShapeArrowSizeEnum, ShapeArrowTypeEnum, ShapeFillEnum, ShapeGradientTypeEnum, ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum, ShapeLineTypeEnum, ShapeTypeEnum } from '@univerjs-pro/engine-shape';
2
+ /**
3
+ * @ignore
4
+ */
5
+ export interface IShapeEnumMixin {
6
+ /**
7
+ * Represents the type of the shape. {@link ShapeTypeEnum}
8
+ * @description This enum defines almost all Excel supported shape types, including basic shapes, block arrows, flowchart shapes, callouts, stars and banners, symbols, and lines.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const fWorkbook = univerAPI.getActiveWorkbook();
13
+ * const fWorksheet = fWorkbook.getActiveSheet();
14
+ *
15
+ * // Create a rectangle shape.
16
+ * const shapeInfo = fWorksheet.newShape()
17
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.Diamond)
18
+ * .setPosition(1, 1, 0, 0)
19
+ * .build();
20
+ * await fWorksheet.insertShape(shapeInfo);
21
+ * ```
22
+ */
23
+ ShapeTypeEnum: typeof ShapeTypeEnum;
24
+ /**
25
+ * Represents the fill type of the shape. {@link ShapeFillEnum}
26
+ * The possible values are: NoFill, SolidFil, GradientFill, PatternFill, PictureFill.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const fWorkbook = univerAPI.getActiveWorkbook();
31
+ * const fWorksheet = fWorkbook.getActiveSheet();
32
+ *
33
+ * // Create a rectangle shape with solid fill.
34
+ * const shapeInfo = fWorksheet.newShape()
35
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.Rect)
36
+ * .setShapeSolidFill('#ff0000')
37
+ * .setPosition(1, 1, 0, 0)
38
+ * .build();
39
+ * await fWorksheet.insertShape(shapeInfo);
40
+ * ```
41
+ */
42
+ ShapeFillEnum: typeof ShapeFillEnum;
43
+ /**
44
+ * Represents the gradient type of the shape fill. {@link ShapeGradientTypeEnum}
45
+ * The possible values are: Linear, Radial, Angular, Diamond.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const fWorkbook = univerAPI.getActiveWorkbook();
50
+ * const fWorksheet = fWorkbook.getActiveSheet();
51
+ *
52
+ * // Create a rectangle shape with linear gradient fill.
53
+ * const shapeInfo = fWorksheet.newShape()
54
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.Rect)
55
+ * .setShapeGradientFill(univerAPI.Enum.ShapeGradientTypeEnum.Linear, [{
56
+ * position: 0,
57
+ * color: '#ff0000'
58
+ * }, {
59
+ * position: 0.5,
60
+ * color: '#00ff00'
61
+ * }, {
62
+ * position: 1,
63
+ * color: '#0000ff'
64
+ * }], 90 )
65
+ * .setPosition(1, 1, 0, 0)
66
+ * .build();
67
+ * await fWorksheet.insertShape(shapeInfo);
68
+ * ```
69
+ */
70
+ ShapeGradientTypeEnum: typeof ShapeGradientTypeEnum;
71
+ /**
72
+ * Represents the line fill type of the shape stroke. {@link ShapeLineTypeEnum}
73
+ * The possible values are: NoLine, SolidLine, GradientLine.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const fWorkbook = univerAPI.getActiveWorkbook();
78
+ * const fWorksheet = fWorkbook.getActiveSheet();
79
+ *
80
+ * // Create a rectangle shape with solid line stroke type.
81
+ * const shapeInfo = fWorksheet.newShape()
82
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.Rect)
83
+ * .setStrokeLineType(univerAPI.Enum.ShapeLineTypeEnum.SolidLine)
84
+ * .setStrokeColor('#000000')
85
+ * .setPosition(1, 1, 0, 0)
86
+ * .build();
87
+ * await fWorksheet.insertShape(shapeInfo);
88
+ * ```
89
+ */
90
+ ShapeLineTypeEnum: typeof ShapeLineTypeEnum;
91
+ /**
92
+ * Represents the line dash type of the shape stroke. {@link ShapeLineDashEnum}
93
+ * The possible values are: Solid, RoundDot, SquareDot, Dash, DashDot, LongDash, LongDashDot, LongDashDotDot.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const fWorkbook = univerAPI.getActiveWorkbook();
98
+ * const fWorksheet = fWorkbook.getActiveSheet();
99
+ *
100
+ * // Create a rectangle shape with dashed stroke.
101
+ * const shapeInfo = fWorksheet.newShape()
102
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.Rect)
103
+ * .setStrokeLineDashType(univerAPI.Enum.ShapeLineDashEnum.Dash)
104
+ * .setPosition(1, 1, 0, 0)
105
+ * .build();
106
+ * await fWorksheet.insertShape(shapeInfo);
107
+ * ```
108
+ */
109
+ ShapeLineDashEnum: typeof ShapeLineDashEnum;
110
+ /**
111
+ * Represents the line cap type of the shape stroke. {@link ShapeLineCapEnum}
112
+ * The possible values are: Flat, Round, Square.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const fWorkbook = univerAPI.getActiveWorkbook();
117
+ * const fWorksheet = fWorkbook.getActiveSheet();
118
+ *
119
+ * // Create a rectangle shape with round line cap.
120
+ * const shapeInfo = fWorksheet.newShape()
121
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.Rect)
122
+ * .setStrokeLineCapType(univerAPI.Enum.ShapeLineCapEnum.Round)
123
+ * .setPosition(1, 1, 0, 0)
124
+ * .build();
125
+ * await fWorksheet.insertShape(shapeInfo);
126
+ * ```
127
+ */
128
+ ShapeLineCapEnum: typeof ShapeLineCapEnum;
129
+ /**
130
+ * Represents the line join type of the shape stroke. {@link ShapeLineJoinEnum}
131
+ * The possible values are: Miter, Round, Bevel.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * const fWorkbook = univerAPI.getActiveWorkbook();
136
+ * const fWorksheet = fWorkbook.getActiveSheet();
137
+ *
138
+ * // Create a rectangle shape with round line join.
139
+ * const shapeInfo = fWorksheet.newShape()
140
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.Rect)
141
+ * .setStrokeLineJoinType(univerAPI.Enum.ShapeLineJoinEnum.Round)
142
+ * .setPosition(1, 1, 0, 0)
143
+ * .build();
144
+ * await fWorksheet.insertShape(shapeInfo);
145
+ * ```
146
+ */
147
+ ShapeLineJoinEnum: typeof ShapeLineJoinEnum;
148
+ /**
149
+ * Represents the arrow type of connector line shape. {@link ShapeArrowTypeEnum}
150
+ * The possible values are: None, Arrow, OpenArrow, DiamondArrow, StealthArrow, OvalArrow.
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * const fWorkbook = univerAPI.getActiveWorkbook();
155
+ * const fWorksheet = fWorkbook.getActiveSheet();
156
+ *
157
+ * // Create a line shape with arrow type.
158
+ * const shapeInfo = fWorksheet.newConnector()
159
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.StraightConnector1)
160
+ * .setPosition(1, 1, 0, 0)
161
+ * .setStartArrowType(univerAPI.Enum.ShapeArrowTypeEnum.Arrow)
162
+ * .setStrokeWidth(3)
163
+ * .build();
164
+ * await fWorksheet.insertShape(shapeInfo);
165
+ * ```
166
+ */
167
+ ShapeArrowTypeEnum: typeof ShapeArrowTypeEnum;
168
+ /**
169
+ * Represents the arrow size of connector line shape. {@link ShapeArrowSizeEnum}
170
+ * The possible values are:Small, Medium, Large.
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * const fWorkbook = univerAPI.getActiveWorkbook();
175
+ * const fWorksheet = fWorkbook.getActiveSheet();
176
+ * // Create a line shape with arrow size.
177
+ * const shapeInfo = fWorksheet.newConnector()
178
+ * .setShapeType(univerAPI.Enum.ShapeTypeEnum.BentConnector3)
179
+ * .setPosition(1, 1, 0, 0)
180
+ * .setStartArrowSize(univerAPI.Enum.ShapeArrowSizeEnum.Medium)
181
+ * .setStrokeWidth(3)
182
+ * .build();
183
+ * await fWorksheet.insertShape(shapeInfo);
184
+ * ```
185
+ */
186
+ ShapeArrowSizeEnum: typeof ShapeArrowSizeEnum;
187
+ }
188
+ /**
189
+ * @ignore
190
+ */
191
+ declare module '@univerjs/core/facade' {
192
+ interface FEnum extends IShapeEnumMixin {
193
+ }
194
+ }