@univerjs-pro/sheets-shape-ui 0.15.3-insiders.20260131-cbd5fac

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 (119) hide show
  1. package/lib/cjs/index.js +1 -0
  2. package/lib/cjs/locale/ca-ES.js +1 -0
  3. package/lib/cjs/locale/en-US.js +1 -0
  4. package/lib/cjs/locale/es-ES.js +1 -0
  5. package/lib/cjs/locale/fa-IR.js +1 -0
  6. package/lib/cjs/locale/fr-FR.js +1 -0
  7. package/lib/cjs/locale/ja-JP.js +1 -0
  8. package/lib/cjs/locale/ko-KR.js +1 -0
  9. package/lib/cjs/locale/ru-RU.js +1 -0
  10. package/lib/cjs/locale/sk-SK.js +1 -0
  11. package/lib/cjs/locale/vi-VN.js +1 -0
  12. package/lib/cjs/locale/zh-CN.js +1 -0
  13. package/lib/cjs/locale/zh-TW.js +1 -0
  14. package/lib/es/index.js +1 -0
  15. package/lib/es/locale/ca-ES.js +1 -0
  16. package/lib/es/locale/en-US.js +1 -0
  17. package/lib/es/locale/es-ES.js +1 -0
  18. package/lib/es/locale/fa-IR.js +1 -0
  19. package/lib/es/locale/fr-FR.js +1 -0
  20. package/lib/es/locale/ja-JP.js +1 -0
  21. package/lib/es/locale/ko-KR.js +1 -0
  22. package/lib/es/locale/ru-RU.js +1 -0
  23. package/lib/es/locale/sk-SK.js +1 -0
  24. package/lib/es/locale/vi-VN.js +1 -0
  25. package/lib/es/locale/zh-CN.js +1 -0
  26. package/lib/es/locale/zh-TW.js +1 -0
  27. package/lib/index.js +1 -0
  28. package/lib/locale/ca-ES.js +1 -0
  29. package/lib/locale/en-US.js +1 -0
  30. package/lib/locale/es-ES.js +1 -0
  31. package/lib/locale/fa-IR.js +1 -0
  32. package/lib/locale/fr-FR.js +1 -0
  33. package/lib/locale/ja-JP.js +1 -0
  34. package/lib/locale/ko-KR.js +1 -0
  35. package/lib/locale/ru-RU.js +1 -0
  36. package/lib/locale/sk-SK.js +1 -0
  37. package/lib/locale/vi-VN.js +1 -0
  38. package/lib/locale/zh-CN.js +1 -0
  39. package/lib/locale/zh-TW.js +1 -0
  40. package/lib/types/command-util.d.ts +19 -0
  41. package/lib/types/commands/command/add-shape-command.d.ts +9 -0
  42. package/lib/types/commands/command/menu-insert-shape.command.d.ts +27 -0
  43. package/lib/types/commands/command/set-shape-fill.command.d.ts +5 -0
  44. package/lib/types/commands/command/set-shape-flip-command.d.ts +14 -0
  45. package/lib/types/commands/command/set-shape-rotate.command.d.ts +10 -0
  46. package/lib/types/commands/command/set-shape-text-align.command.d.ts +5 -0
  47. package/lib/types/commands/command/set-shape-text-style.command.d.ts +7 -0
  48. package/lib/types/commands/command/set-shape-text-vertical-align.command.d.ts +5 -0
  49. package/lib/types/commands/command/shape-doc-align.command.d.ts +10 -0
  50. package/lib/types/commands/command/test-line.shape.command.d.ts +8 -0
  51. package/lib/types/commands/command/update-connector-relation.command.d.ts +41 -0
  52. package/lib/types/commands/command/update-line-shape-resize.command.d.ts +18 -0
  53. package/lib/types/commands/command/update-shape-data-command.d.ts +13 -0
  54. package/lib/types/commands/menu/shape-doc-format.menu.d.ts +16 -0
  55. package/lib/types/commands/menu/shape-fill.menu.d.ts +3 -0
  56. package/lib/types/commands/menu/shape-font-size.menu.d.ts +5 -0
  57. package/lib/types/commands/menu/shape-text-align.menu.d.ts +8 -0
  58. package/lib/types/commands/menu/shape-vertical-align.menu.d.ts +8 -0
  59. package/lib/types/commands/operations/close-shape-panel.operation.d.ts +7 -0
  60. package/lib/types/commands/operations/open-shape-panel.operation.d.ts +7 -0
  61. package/lib/types/const.d.ts +5 -0
  62. package/lib/types/controllers/config.schema.d.ts +5 -0
  63. package/lib/types/controllers/menu.schema.d.ts +2 -0
  64. package/lib/types/controllers/shape-text-editing.render-controller.d.ts +17 -0
  65. package/lib/types/controllers/shape-update.controller.d.ts +19 -0
  66. package/lib/types/controllers/sheet-basic-shape-connection.controller.d.ts +99 -0
  67. package/lib/types/controllers/sheet-shape-adjust-controller.d.ts +45 -0
  68. package/lib/types/controllers/sheet-shape-command-interceptor.controller.d.ts +31 -0
  69. package/lib/types/controllers/sheet-shape-connector.controller.d.ts +110 -0
  70. package/lib/types/controllers/sheet-shape-render.controller.d.ts +12 -0
  71. package/lib/types/controllers/sheets-shape-ui.controller.d.ts +111 -0
  72. package/lib/types/index.d.ts +3 -0
  73. package/lib/types/locale/ca-ES.d.ts +3 -0
  74. package/lib/types/locale/en-US.d.ts +279 -0
  75. package/lib/types/locale/es-ES.d.ts +3 -0
  76. package/lib/types/locale/fa-IR.d.ts +3 -0
  77. package/lib/types/locale/fr-FR.d.ts +3 -0
  78. package/lib/types/locale/ja-JP.d.ts +3 -0
  79. package/lib/types/locale/ko-KR.d.ts +3 -0
  80. package/lib/types/locale/ru-RU.d.ts +3 -0
  81. package/lib/types/locale/sk-SK.d.ts +3 -0
  82. package/lib/types/locale/vi-VN.d.ts +3 -0
  83. package/lib/types/locale/zh-CN.d.ts +3 -0
  84. package/lib/types/locale/zh-TW.d.ts +3 -0
  85. package/lib/types/plugin.d.ts +18 -0
  86. package/lib/types/services/shape-text-editing.service.d.ts +19 -0
  87. package/lib/types/types.d.ts +14 -0
  88. package/lib/types/view-model/drawing-shape.d.ts +66 -0
  89. package/lib/types/view-model/shape-data-model.d.ts +5 -0
  90. package/lib/types/view-model/sheet-basic-shape-connection-site-object.d.ts +44 -0
  91. package/lib/types/view-model/sheet-shape-adjust-point-object.d.ts +21 -0
  92. package/lib/types/view-model/sheet-shape-connector-handler-object.d.ts +22 -0
  93. package/lib/types/views/ShapeOptions.d.ts +30 -0
  94. package/lib/types/views/ShapePicker.d.ts +2 -0
  95. package/lib/types/views/shape-editor-panel/ShapeEditorPanel.d.ts +12 -0
  96. package/lib/types/views/shape-editor-panel/ShapeFillEditor.d.ts +11 -0
  97. package/lib/types/views/shape-editor-panel/ShapeLineEditor.d.ts +11 -0
  98. package/lib/types/views/shape-editor-panel/ShapePositionEditor.d.ts +1 -0
  99. package/lib/types/views/shape-editor-panel/index.d.ts +1 -0
  100. package/lib/types/views/shape-menu/shape-menu-factory.d.ts +10 -0
  101. package/lib/types/views/shape-text-editor/Editor.d.ts +14 -0
  102. package/lib/types/views/shape-text-editor/hooks/use-shape-position.d.ts +37 -0
  103. package/lib/types/views/shape-text-editor/index.d.ts +6 -0
  104. package/lib/types/views/shape-text-editor/position-wrapper.d.ts +16 -0
  105. package/lib/types/views/shapes.d.ts +58 -0
  106. package/lib/umd/index.js +1 -0
  107. package/lib/umd/locale/ca-ES.js +1 -0
  108. package/lib/umd/locale/en-US.js +1 -0
  109. package/lib/umd/locale/es-ES.js +1 -0
  110. package/lib/umd/locale/fa-IR.js +1 -0
  111. package/lib/umd/locale/fr-FR.js +1 -0
  112. package/lib/umd/locale/ja-JP.js +1 -0
  113. package/lib/umd/locale/ko-KR.js +1 -0
  114. package/lib/umd/locale/ru-RU.js +1 -0
  115. package/lib/umd/locale/sk-SK.js +1 -0
  116. package/lib/umd/locale/vi-VN.js +1 -0
  117. package/lib/umd/locale/zh-CN.js +1 -0
  118. package/lib/umd/locale/zh-TW.js +1 -0
  119. package/package.json +99 -0
@@ -0,0 +1,27 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ import { ISheetCommandSharedParams } from '@univerjs/sheets';
3
+ import { ShapeTypeEnum } from '@univerjs-pro/engine-shape';
4
+ interface IEnhanceParams {
5
+ /**
6
+ * whether to show arrow at the end of the line, only work when the shape is a connector
7
+ */
8
+ endArrow?: boolean;
9
+ /**
10
+ * whether to show arrow at the start of the line, only work when the shape is a connector
11
+ */
12
+ startArrow?: boolean;
13
+ /**
14
+ * text box is horizontal text, only work when the shape type is rect
15
+ */
16
+ horizontal?: boolean;
17
+ /**
18
+ * text box is vertical text, only work when the shape type is rect
19
+ */
20
+ vertical?: boolean;
21
+ }
22
+ export interface IInsertShapeCommandParams extends ISheetCommandSharedParams {
23
+ value: ShapeTypeEnum;
24
+ enhanceParams?: IEnhanceParams;
25
+ }
26
+ export declare const MenuInsertShapeCommand: ICommand;
27
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ export interface ISetShapeFillColorCommandParams {
3
+ value: string;
4
+ }
5
+ export declare const SetShapeFillColorCommand: ICommand<ISetShapeFillColorCommandParams>;
@@ -0,0 +1,14 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ import { ISheetCommandSharedParams } from '@univerjs/sheets';
3
+ export interface IUpdateSheetsShapeFlipCommandParams extends ISheetCommandSharedParams {
4
+ shapeId: string;
5
+ /**
6
+ * is toggle horizontal flip
7
+ */
8
+ flipH?: boolean;
9
+ /**
10
+ * is toggle vertical flip
11
+ */
12
+ flipV?: boolean;
13
+ }
14
+ export declare const ToggleSheetsShapeFlipCommand: ICommand;
@@ -0,0 +1,10 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ import { ISheetCommandSharedParams } from '@univerjs/sheets';
3
+ export interface IUpdateSheetsShapeRotateCommandParams extends ISheetCommandSharedParams {
4
+ shapeId: string;
5
+ /**
6
+ * is toggle horizontal flip
7
+ */
8
+ rotate: number;
9
+ }
10
+ export declare const SetSheetsShapeRotateCommand: ICommand;
@@ -0,0 +1,5 @@
1
+ import { HorizontalAlign, ICommand } from '@univerjs/core';
2
+ export interface ISetShapeTextHorizontalAlignCommandParams {
3
+ value: HorizontalAlign;
4
+ }
5
+ export declare const SetShapeTextHorizontalAlignCommand: ICommand<ISetShapeTextHorizontalAlignCommandParams>;
@@ -0,0 +1,7 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ export interface ISetShapeTextFontSizeCommandParams {
3
+ value: number;
4
+ }
5
+ export declare const SetShapeTextFontSizeCommand: ICommand<ISetShapeTextFontSizeCommandParams>;
6
+ export declare const SetShapeTextFontSizeIncreaseCommand: ICommand;
7
+ export declare const SetShapeTextFontSizeDecreaseCommand: ICommand;
@@ -0,0 +1,5 @@
1
+ import { ICommand, VerticalAlign } from '@univerjs/core';
2
+ export interface ISetShapeTextVerticalAlignCommandParams {
3
+ value: VerticalAlign;
4
+ }
5
+ export declare const SetShapeTextVerticalAlignCommand: ICommand<ISetShapeTextVerticalAlignCommandParams>;
@@ -0,0 +1,10 @@
1
+ import { HorizontalAlign, ICommand } from '@univerjs/core';
2
+ export interface IShapeDocAlignCommandParams {
3
+ value: HorizontalAlign;
4
+ }
5
+ /**
6
+ * Wrapper command for shape text horizontal alignment.
7
+ * This command receives the value from the menu selector and forwards it
8
+ * to the Doc's AlignOperationCommand with the correct parameter format.
9
+ */
10
+ export declare const ShapeDocAlignCommand: ICommand<IShapeDocAlignCommandParams>;
@@ -0,0 +1,8 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ import { ISheetCommandSharedParams } from '@univerjs/sheets';
3
+ export interface ITestLineShapeCommandParams extends ISheetCommandSharedParams {
4
+ }
5
+ /**
6
+ * Test command to create two rectangles and a BentConnector3 line connecting them
7
+ */
8
+ export declare const TestLineShapeCommand: ICommand;
@@ -0,0 +1,41 @@
1
+ import { ILineType, IShapeRelation } from '@univerjs-pro/engine-shape';
2
+ import { ICommand } from '@univerjs/core';
3
+ import { ISheetCommandSharedParams } from '@univerjs/sheets';
4
+ export interface IUpdateConnectorRelationCommandParams extends ISheetCommandSharedParams {
5
+ /** The connector shape ID */
6
+ connectorShapeId: string;
7
+ /** New width of the connector */
8
+ width: number;
9
+ /** New height of the connector */
10
+ height: number;
11
+ /** New left position of the connector */
12
+ left: number;
13
+ /** New top position of the connector */
14
+ top: number;
15
+ /** Flip X state */
16
+ flipX: boolean;
17
+ /** Flip Y state */
18
+ flipY: boolean;
19
+ /** Old adjust values for undo */
20
+ oldAdjustValues: Record<string, number>;
21
+ /** New adjust values to set (if provided, uses these instead of clearing) */
22
+ newAdjustValues?: Record<string, number>;
23
+ /** New line type to set (if connector type changed during routing) */
24
+ newLineType?: ILineType;
25
+ oldLineType?: ILineType;
26
+ /** Rotation in degrees (0, 90, 180, 270) for flip + rotation scenarios */
27
+ rotation?: number;
28
+ /** Old relation for undo */
29
+ oldRelation?: IShapeRelation;
30
+ /** New relation to set */
31
+ newRelation?: IShapeRelation;
32
+ }
33
+ /**
34
+ * Command to update a connector's relation (connection to shapes).
35
+ *
36
+ * This command:
37
+ * 1. Updates the connector's transform (position, size, flip)
38
+ * 2. Clears the adjust values (for automatic routing)
39
+ * 3. Updates the relation property to connect to target shapes
40
+ */
41
+ export declare const UpdateConnectorRelationCommand: ICommand;
@@ -0,0 +1,18 @@
1
+ import { ILineType } from '@univerjs-pro/engine-shape';
2
+ import { ICommand } from '@univerjs/core';
3
+ import { ISheetCommandSharedParams } from '@univerjs/sheets';
4
+ export interface IUpdateSheetsShapeResizeCommandParams extends ISheetCommandSharedParams {
5
+ shapeId: string;
6
+ width: number;
7
+ height: number;
8
+ left: number;
9
+ top: number;
10
+ flipX: boolean;
11
+ flipY: boolean;
12
+ angle: number;
13
+ newAdjustValues: Record<string, number>;
14
+ oldAdjustValues: Record<string, number>;
15
+ newLineType: ILineType;
16
+ oldLineType: ILineType;
17
+ }
18
+ export declare const UpdateLineShapeResizeCommand: ICommand;
@@ -0,0 +1,13 @@
1
+ import { IShapeData, ShapeTypeEnum } from '@univerjs-pro/engine-shape';
2
+ import { ICommand } from '@univerjs/core';
3
+ import { ISheetCommandSharedParams } from '@univerjs/sheets';
4
+ export interface IUpdateSheetsShapeDataCommandParams extends ISheetCommandSharedParams {
5
+ shapeId: string;
6
+ shapeType?: ShapeTypeEnum;
7
+ shapeData?: IShapeData;
8
+ oldShapeJSON: {
9
+ oldShapeData?: IShapeData;
10
+ oldShapeType?: ShapeTypeEnum;
11
+ };
12
+ }
13
+ export declare const UpdateShapeDataCommand: ICommand;
@@ -0,0 +1,16 @@
1
+ import { IAccessor, HorizontalAlign } from '@univerjs/core';
2
+ import { IMenuSelectorItem, MenuItemType } from '@univerjs/ui';
3
+ import { Observable } from 'rxjs';
4
+ export declare const SHAPE_HORIZONTAL_ALIGN_CHILDREN: {
5
+ label: string;
6
+ icon: string;
7
+ value: HorizontalAlign;
8
+ }[];
9
+ export declare function ShapeHorizontalAlignMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<HorizontalAlign>;
10
+ export declare function ShapeBackgroundColorSelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string, string | undefined>;
11
+ export declare function ShapeResetBackgroundColorMenuItemFactory(accessor: IAccessor): {
12
+ id: string;
13
+ type: MenuItemType;
14
+ title: string;
15
+ hidden$: Observable<boolean>;
16
+ };
@@ -0,0 +1,3 @@
1
+ import { IAccessor } from '@univerjs/core';
2
+ import { IMenuSelectorItem } from '@univerjs/ui';
3
+ export declare function ShapeFillColorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string, string | undefined>;
@@ -0,0 +1,5 @@
1
+ import { IAccessor } from '@univerjs/core';
2
+ import { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
3
+ export declare function ShapeFontSizeSelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<number>;
4
+ export declare function ShapeFontSizeIncreaseMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
5
+ export declare function ShapeFontSizeDecreaseMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
@@ -0,0 +1,8 @@
1
+ import { IAccessor, HorizontalAlign } from '@univerjs/core';
2
+ import { IMenuSelectorItem } from '@univerjs/ui';
3
+ export declare const SHAPE_HORIZONTAL_ALIGN_CHILDREN: {
4
+ label: string;
5
+ icon: string;
6
+ value: HorizontalAlign;
7
+ }[];
8
+ export declare function ShapeTextHorizontalAlignMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<HorizontalAlign>;
@@ -0,0 +1,8 @@
1
+ import { IAccessor, VerticalAlign } from '@univerjs/core';
2
+ import { IMenuSelectorItem } from '@univerjs/ui';
3
+ export declare const SHAPE_VERTICAL_ALIGN_CHILDREN: {
4
+ label: string;
5
+ icon: string;
6
+ value: VerticalAlign;
7
+ }[];
8
+ export declare function ShapeVerticalAlignMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<VerticalAlign>;
@@ -0,0 +1,7 @@
1
+ import { IOperation } from '@univerjs/core';
2
+ export interface IShapeClosePanelOperationParams {
3
+ unitId: string;
4
+ subUnitId: string;
5
+ drawingId: string;
6
+ }
7
+ export declare const CloseSheetShapeFormatPanelOperation: IOperation<IShapeClosePanelOperationParams>;
@@ -0,0 +1,7 @@
1
+ import { IOperation } from '@univerjs/core';
2
+ export interface IShapeOpenPanelOperationParams {
3
+ unitId: string;
4
+ subUnitId: string;
5
+ drawingId: string;
6
+ }
7
+ export declare const OpenSheetShapeFormatPanelOperation: IOperation<IShapeOpenPanelOperationParams>;
@@ -0,0 +1,5 @@
1
+ export declare const SHEET_SHAPE_EDIT_PANEL_KEY = "sheet.shape.edit.panel";
2
+ export declare const DOCS_SHAPE_EDITOR_UNIT_ID_KEY: string;
3
+ export declare const DEFAULT_SHAPE_WIDTH = 200;
4
+ export declare const DEFAULT_SHAPE_HEIGHT = 200;
5
+ export declare const ShapeTextEditorContainer = "ShapeTextEditorContainer";
@@ -0,0 +1,5 @@
1
+ export declare const SHEETS_SHAPE_UI_PLUGIN_CONFIG_KEY = "sheets-shape.config";
2
+ export declare const configSymbol: unique symbol;
3
+ export interface IUniverSheetsShapeUIConfig {
4
+ }
5
+ export declare const defaultPluginConfig: IUniverSheetsShapeUIConfig;
@@ -0,0 +1,2 @@
1
+ import { MenuSchemaType } from '@univerjs/ui';
2
+ export declare const menuSchema: MenuSchemaType;
@@ -0,0 +1,17 @@
1
+ import { Workbook, Disposable, IContextService } from '@univerjs/core';
2
+ import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
3
+ import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
4
+ import { IDrawingManagerService } from '@univerjs/drawing';
5
+ import { ShapeTextEditingService } from '../services/shape-text-editing.service';
6
+ export declare class ShapeTextEditingRenderController extends Disposable implements IRenderModule {
7
+ private readonly _context;
8
+ private readonly _shapeTextEditingService;
9
+ private readonly _drawingManagerService;
10
+ private readonly _contextService;
11
+ private _sheetsShapeServices;
12
+ private _lastEditingShapeKey;
13
+ constructor(_context: IRenderContext<Workbook>, _shapeTextEditingService: ShapeTextEditingService, _drawingManagerService: IDrawingManagerService, _contextService: IContextService, _sheetsShapeServices: SheetsShapeServices);
14
+ private _initEvents;
15
+ private _initSelection;
16
+ private _initEditingParams;
17
+ }
@@ -0,0 +1,19 @@
1
+ import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
+ import { IDrawingManagerService } from '@univerjs/drawing';
3
+ import { DrawingRenderService } from '@univerjs/drawing-ui';
4
+ import { IRenderManagerService } from '@univerjs/engine-render';
5
+ import { SheetDrawingShapeRenderController } from './sheet-shape-render.controller';
6
+ export declare class ShapeUpdateController extends Disposable {
7
+ private readonly _commandService;
8
+ private readonly _renderManagerService;
9
+ private readonly _drawingManagerService;
10
+ private readonly _currentUniverService;
11
+ private readonly _drawingRenderService;
12
+ private readonly _sheetDrawingShapeRenderController;
13
+ constructor(_commandService: ICommandService, _renderManagerService: IRenderManagerService, _drawingManagerService: IDrawingManagerService, _currentUniverService: IUniverInstanceService, _drawingRenderService: DrawingRenderService, _sheetDrawingShapeRenderController: SheetDrawingShapeRenderController);
14
+ private _initialize;
15
+ private _drawingAddListener;
16
+ private _shapeUpdateListener;
17
+ private _insertShapes;
18
+ private _getSceneAndTransformerByDrawingSearch;
19
+ }
@@ -0,0 +1,99 @@
1
+ import { IShapePoint, IShapeRelationItem } from '@univerjs-pro/engine-shape';
2
+ import { Workbook, Disposable } from '@univerjs/core';
3
+ import { IRenderContext, Scene, IRenderManagerService } from '@univerjs/engine-render';
4
+ import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
5
+ import { IDrawingManagerService } from '@univerjs/drawing';
6
+ /**
7
+ * Information about a potential connection target
8
+ */
9
+ export interface IConnectionTarget {
10
+ /** The target shape's ID */
11
+ shapeId: string;
12
+ /** The connection site index */
13
+ cxnIndex: number;
14
+ /** Unit ID */
15
+ unitId: string;
16
+ /** Sub-unit ID */
17
+ subUnitId: string;
18
+ /** World coordinates of the connection site */
19
+ worldPoint: IShapePoint;
20
+ /** Connection site angle in degrees (0 = right, 90 = down, 180 = left, 270 = up) */
21
+ angle: number;
22
+ }
23
+ /**
24
+ * Controller for managing connection sites on shapes.
25
+ *
26
+ * This controller is responsible for:
27
+ * 1. Detecting when a connector endpoint enters a shape's bounds
28
+ * 2. Displaying connection sites for that shape
29
+ * 3. Highlighting the nearest connection site when the endpoint is close enough
30
+ * 4. Providing connection information when the endpoint is released on a connection site
31
+ */
32
+ export declare class SheetBasicShapeConnectionPointController extends Disposable {
33
+ private readonly _context;
34
+ private readonly _renderManagerService;
35
+ private readonly _drawingManagerService;
36
+ private readonly _sheetsShapeServices;
37
+ /** Currently displayed connection site objects */
38
+ private _connectionSiteObjects;
39
+ /** The shape ID whose connection sites are currently being shown */
40
+ private _activeTargetShapeId;
41
+ /** The currently highlighted connection site (if any) */
42
+ private _highlightedSiteIndex;
43
+ /** Current scene reference */
44
+ private _currentScene;
45
+ /** Current unit/subUnit context */
46
+ private _unitId;
47
+ private _subUnitId;
48
+ /** The connector shape ID that is being dragged (to exclude from target detection) */
49
+ private _draggingConnectorId;
50
+ constructor(_context: IRenderContext<Workbook>, _renderManagerService: IRenderManagerService, _drawingManagerService: IDrawingManagerService, _sheetsShapeServices: SheetsShapeServices);
51
+ /**
52
+ * Called when connector endpoint dragging starts.
53
+ * Sets up the context for connection site detection.
54
+ */
55
+ startConnectionDetection(scene: Scene, unitId: string, subUnitId: string, draggingConnectorId: string): void;
56
+ /**
57
+ * Called during connector endpoint dragging.
58
+ * Detects if the endpoint enters a shape's bounds and shows connection sites.
59
+ *
60
+ * @param worldPoint The current world coordinates of the dragging endpoint
61
+ * @returns The nearest connection target if within hit radius, null otherwise
62
+ */
63
+ updateConnectionDetection(worldPoint: IShapePoint): IConnectionTarget | null;
64
+ /**
65
+ * Called when connector endpoint dragging ends.
66
+ * Cleans up connection site display.
67
+ */
68
+ endConnectionDetection(): void;
69
+ /**
70
+ * Get the connection relation item for the current highlighted connection site.
71
+ * This should be called when the connector endpoint is released.
72
+ */
73
+ getConnectionRelation(): IShapeRelationItem | null;
74
+ /**
75
+ * Find a non-connector shape at the given world point.
76
+ */
77
+ private _findShapeAtPoint;
78
+ /**
79
+ * Show connection sites for the given shape.
80
+ */
81
+ private _showConnectionSites;
82
+ /**
83
+ * Find the nearest connection site to the given world point.
84
+ * Highlights the nearest site if within hit radius.
85
+ */
86
+ private _findNearestConnectionSite;
87
+ /**
88
+ * Get the angle for a connection site, adjusted for shape's flip state.
89
+ * @param shapeId The shape ID
90
+ * @param cxnIndex The connection site index
91
+ * @returns The angle in degrees (0 = right, 90 = down, 180 = left, 270 = up)
92
+ */
93
+ private _getConnectionSiteAngle;
94
+ /**
95
+ * Clear all displayed connection sites.
96
+ */
97
+ private _clearConnectionSites;
98
+ dispose(): void;
99
+ }
@@ -0,0 +1,45 @@
1
+ import { Workbook, Disposable, ICommandService, IContextService, IUniverInstanceService } from '@univerjs/core';
2
+ import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
3
+ import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
4
+ import { IDrawingManagerService } from '@univerjs/drawing';
5
+ import { SheetDrawingShapeRenderController } from './sheet-shape-render.controller';
6
+ export declare class SheetShapeAdjustController extends Disposable implements IRenderModule {
7
+ private readonly _context;
8
+ private readonly _contextService;
9
+ private _drawingManagerService;
10
+ private _sheetsShapeServices;
11
+ private readonly _renderManagerService;
12
+ private readonly _sheetDrawingShapeRenderController;
13
+ private readonly _univerInstanceService;
14
+ private readonly _commandService;
15
+ private _activeShapeId;
16
+ private _unitId;
17
+ private _subUnitId;
18
+ private _activeShapeAdjustPointList;
19
+ private _shapes;
20
+ private _baseShapeLeft;
21
+ private _baseShapeTop;
22
+ private _baseShapeWidth;
23
+ private _baseShapeHeight;
24
+ private _isStartAdjusting;
25
+ private _activeAdjustInfo;
26
+ private _activeShapeModel;
27
+ private _adjHandlerPointerMove;
28
+ private _adjHandlerPointerUp;
29
+ private _isDrawingShapePointDown;
30
+ constructor(_context: IRenderContext<Workbook>, _contextService: IContextService, _drawingManagerService: IDrawingManagerService, _sheetsShapeServices: SheetsShapeServices, _renderManagerService: IRenderManagerService, _sheetDrawingShapeRenderController: SheetDrawingShapeRenderController, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService);
31
+ private _getShapeAdjustPointListById;
32
+ clearAdjustControls(): void;
33
+ refreshAdjustControls(): void;
34
+ private _getShapeAdjustInfosById;
35
+ private _createShapeAdjustControls;
36
+ private _updateShapeAdjustControls;
37
+ private _addShapeAdjustControl;
38
+ private _clearShapeAdjustControls;
39
+ private _updateAdjustControlPositions;
40
+ private _getScrollInfo;
41
+ private _getZoomRatio;
42
+ private _attachAdjustEvent;
43
+ private _registerDrawingMoveHandler;
44
+ private _registerDrawingFocusChangeHandler;
45
+ }
@@ -0,0 +1,31 @@
1
+ import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
2
+ import { Disposable, IUniverInstanceService } from '@univerjs/core';
3
+ import { IDrawingManagerService } from '@univerjs/drawing';
4
+ import { IRenderManagerService } from '@univerjs/engine-render';
5
+ import { SheetInterceptorService } from '@univerjs/sheets';
6
+ import { IMenuManagerService } from '@univerjs/ui';
7
+ export declare class SheetsShapeCmdInterceptorController extends Disposable {
8
+ private readonly _univerInstanceService;
9
+ private readonly _sheetInterceptorService;
10
+ protected readonly _menuManagerService: IMenuManagerService;
11
+ private _sheetsShapeServices;
12
+ private _drawingManagerService;
13
+ private readonly _renderManagerService;
14
+ constructor(_univerInstanceService: IUniverInstanceService, _sheetInterceptorService: SheetInterceptorService, _menuManagerService: IMenuManagerService, _sheetsShapeServices: SheetsShapeServices, _drawingManagerService: IDrawingManagerService, _renderManagerService: IRenderManagerService);
15
+ private _initCommandInterceptor;
16
+ /**
17
+ * Get the IConnectPointInfo for a connected shape based on the relation item.
18
+ * This retrieves the world coordinates, angle, and bounds of the connection point.
19
+ */
20
+ private _getConnectPointInfo;
21
+ /**
22
+ * Add mutations for updating a connector line when it has both ends connected.
23
+ * Re-routes the line based on the connected shapes' positions.
24
+ */
25
+ private _addLineRerouteUpdates;
26
+ /**
27
+ * Add mutations for updating a connector line when only one end is connected.
28
+ * The line follows the connected shape's movement.
29
+ */
30
+ private _addLineFollowShapeUpdates;
31
+ }
@@ -0,0 +1,110 @@
1
+ import { Workbook, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
+ import { IRenderContext, IRenderManagerService } from '@univerjs/engine-render';
3
+ import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
4
+ import { IDrawingManagerService } from '@univerjs/drawing';
5
+ import { SheetBasicShapeConnectionPointController } from './sheet-basic-shape-connection.controller';
6
+ import { SheetShapeAdjustController } from './sheet-shape-adjust-controller';
7
+ export declare class SheetShapeConnectorController extends Disposable {
8
+ private readonly _context;
9
+ private readonly _commandService;
10
+ private readonly _renderManagerService;
11
+ private readonly _drawingManagerService;
12
+ private readonly _univerInstanceService;
13
+ private readonly _sheetsShapeServices;
14
+ private readonly _sheetShapeAdjustController;
15
+ private readonly _sheetBasicShapeConnectionPointController;
16
+ private _activeShapeId;
17
+ private _unitId;
18
+ private _subUnitId;
19
+ private _connectorObjects;
20
+ /**
21
+ * The base drawing rect at the start of a drag operation.
22
+ * Used for coordinate transformations during connector resize.
23
+ */
24
+ private _baseDrawingRect;
25
+ private _activeShapeModel;
26
+ private _isConnecting;
27
+ private _isDrawingShapePointDown;
28
+ private _hasReset;
29
+ private _cxtHandlerPointerMove;
30
+ private _cxtHandlerPointerUp;
31
+ /** Current connection target (if any) during drag */
32
+ private _currentConnectionTarget;
33
+ constructor(_context: IRenderContext<Workbook>, _commandService: ICommandService, _renderManagerService: IRenderManagerService, _drawingManagerService: IDrawingManagerService, _univerInstanceService: IUniverInstanceService, _sheetsShapeServices: SheetsShapeServices, _sheetShapeAdjustController: SheetShapeAdjustController, _sheetBasicShapeConnectionPointController: SheetBasicShapeConnectionPointController);
34
+ private _initialize;
35
+ /**
36
+ * Get the current drawing rect from the drawing manager.
37
+ */
38
+ private _getDrawingRect;
39
+ private _addShapeConnectorHandlerObjects;
40
+ /**
41
+ * Add a connector handler object at the given world coordinates.
42
+ * The worldPoint is already in world coordinates (flip applied).
43
+ */
44
+ private _addShapeConnectorHandlerObject;
45
+ private _getScrollInfo;
46
+ private _getZoomRatio;
47
+ /**
48
+ * Handle the pointer up event during connector dragging.
49
+ * Finalizes the connection and executes the appropriate command.
50
+ */
51
+ private _handleConnectorPointerUp;
52
+ /**
53
+ * Handle pointer up when the fixed endpoint is free (not connected).
54
+ */
55
+ private _handleFreeEndpointPointerUp;
56
+ private _handleConnectedEndpointPointerUp;
57
+ /**
58
+ * Execute the command to update connector relation when connecting to a shape.
59
+ */
60
+ private _executeConnectionCommand;
61
+ /**
62
+ * Execute the command to update connector transform without connection.
63
+ */
64
+ private _executeResizeCommand;
65
+ /**
66
+ * Execute the command to update connector with route layout when connecting to a new shape.
67
+ * This handles the case where the fixed endpoint is already connected and we're connecting the moving endpoint.
68
+ */
69
+ private _executeConnectedRouteConnectionCommand;
70
+ /**
71
+ * Execute the command to update connector with route layout without new connection.
72
+ * This handles the case where the fixed endpoint is connected but we're just resizing.
73
+ */
74
+ private _executeConnectedRouteResizeCommand;
75
+ private _attachConnectorObjectEvent;
76
+ /**
77
+ * Handle connector line shape update when a basic shape is moved.
78
+ * - If the connector has only one end connected to the moving shape, move the connector with the shape.
79
+ * - If the connector has both ends connected, re-route the connector line.
80
+ */
81
+ private _handleBasicShapeUpdateConnectorLineShape;
82
+ private _rerouteConnectorLine;
83
+ /**
84
+ * Move a connector line when only one end is connected to a moving shape.
85
+ * The connector follows the shape movement.
86
+ */
87
+ private _moveConnectorWithShape;
88
+ private _clearShapeConnectorHandlerObjects;
89
+ private _registerDrawingMoveHandler;
90
+ private _registerDrawingFocusChangeHandler;
91
+ private _handleConnectedEndpointMove;
92
+ /**
93
+ * Handle connector endpoint move when the fixed endpoint is a free point (not connected).
94
+ * Uses ConnectorCoordinateTransform for layout calculation.
95
+ */
96
+ private _handleFreeEndpointMove;
97
+ /**
98
+ * Get the IConnectPointInfo for a connected shape based on the relation item.
99
+ * This retrieves the world coordinates, angle, and bounds of the connection point.
100
+ */
101
+ private _getConnectPointInfo;
102
+ /**
103
+ * Calculate the angle for a free endpoint based on the relative position to the connected point.
104
+ * Returns the angle that points away from the connected point.
105
+ * 0 = right, 90 = down, 180 = left, 270 = up
106
+ */
107
+ private _calculateFreeEndpointAngle;
108
+ private _reset;
109
+ dispose(): void;
110
+ }
@@ -0,0 +1,12 @@
1
+ import { Scene } from '@univerjs/engine-render';
2
+ import { IDrawingShapeData, DrawingShape } from '../view-model/drawing-shape';
3
+ import { SheetsShapeServices } from '@univerjs-pro/sheets-shape';
4
+ import { Disposable, LocaleService } from '@univerjs/core';
5
+ import { IDrawingManagerService } from '@univerjs/drawing';
6
+ export declare class SheetDrawingShapeRenderController extends Disposable {
7
+ private readonly _drawingManagerService;
8
+ private readonly _sheetsShapeServices;
9
+ private readonly _localeService;
10
+ constructor(_drawingManagerService: IDrawingManagerService, _sheetsShapeServices: SheetsShapeServices, _localeService: LocaleService);
11
+ renderDrawingShape(drawingShapeParam: IDrawingShapeData, scene: Scene): DrawingShape[] | undefined;
12
+ }