@univerjs-pro/sheets-shape-ui 1.0.0-rc.0 → 1.0.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 (106) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/cjs/locale/ar-SA.js +1 -1
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/de-DE.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/id-ID.js +1 -1
  10. package/lib/cjs/locale/it-IT.js +1 -1
  11. package/lib/cjs/locale/ja-JP.js +1 -1
  12. package/lib/cjs/locale/ko-KR.js +1 -1
  13. package/lib/cjs/locale/pl-PL.js +1 -1
  14. package/lib/cjs/locale/pt-BR.js +1 -1
  15. package/lib/cjs/locale/ru-RU.js +1 -1
  16. package/lib/cjs/locale/sk-SK.js +1 -1
  17. package/lib/cjs/locale/vi-VN.js +1 -1
  18. package/lib/cjs/locale/zh-CN.js +1 -1
  19. package/lib/cjs/locale/zh-HK.js +1 -1
  20. package/lib/cjs/locale/zh-TW.js +1 -1
  21. package/lib/es/index.js +1 -1
  22. package/lib/es/locale/ar-SA.js +1 -1
  23. package/lib/es/locale/ca-ES.js +1 -1
  24. package/lib/es/locale/de-DE.js +1 -1
  25. package/lib/es/locale/en-US.js +1 -1
  26. package/lib/es/locale/es-ES.js +1 -1
  27. package/lib/es/locale/fa-IR.js +1 -1
  28. package/lib/es/locale/fr-FR.js +1 -1
  29. package/lib/es/locale/id-ID.js +1 -1
  30. package/lib/es/locale/it-IT.js +1 -1
  31. package/lib/es/locale/ja-JP.js +1 -1
  32. package/lib/es/locale/ko-KR.js +1 -1
  33. package/lib/es/locale/pl-PL.js +1 -1
  34. package/lib/es/locale/pt-BR.js +1 -1
  35. package/lib/es/locale/ru-RU.js +1 -1
  36. package/lib/es/locale/sk-SK.js +1 -1
  37. package/lib/es/locale/vi-VN.js +1 -1
  38. package/lib/es/locale/zh-CN.js +1 -1
  39. package/lib/es/locale/zh-HK.js +1 -1
  40. package/lib/es/locale/zh-TW.js +1 -1
  41. package/lib/index.js +1 -1
  42. package/lib/locale/ar-SA.js +1 -1
  43. package/lib/locale/ca-ES.js +1 -1
  44. package/lib/locale/de-DE.js +1 -1
  45. package/lib/locale/en-US.js +1 -1
  46. package/lib/locale/es-ES.js +1 -1
  47. package/lib/locale/fa-IR.js +1 -1
  48. package/lib/locale/fr-FR.js +1 -1
  49. package/lib/locale/id-ID.js +1 -1
  50. package/lib/locale/it-IT.js +1 -1
  51. package/lib/locale/ja-JP.js +1 -1
  52. package/lib/locale/ko-KR.js +1 -1
  53. package/lib/locale/pl-PL.js +1 -1
  54. package/lib/locale/pt-BR.js +1 -1
  55. package/lib/locale/ru-RU.js +1 -1
  56. package/lib/locale/sk-SK.js +1 -1
  57. package/lib/locale/vi-VN.js +1 -1
  58. package/lib/locale/zh-CN.js +1 -1
  59. package/lib/locale/zh-HK.js +1 -1
  60. package/lib/locale/zh-TW.js +1 -1
  61. package/lib/types/commands/command/set-shape-text-align.command.d.ts +5 -0
  62. package/lib/types/commands/command/set-shape-text-style.command.d.ts +7 -0
  63. package/lib/types/commands/command/set-shape-text-vertical-align.command.d.ts +5 -0
  64. package/lib/types/commands/command/shape-doc-align.command.d.ts +10 -0
  65. package/lib/types/commands/menu/shape-doc-format.menu.d.ts +18 -0
  66. package/lib/types/commands/menu/shape-font-size.menu.d.ts +5 -0
  67. package/lib/types/commands/menu/shape-text-align.menu.d.ts +9 -0
  68. package/lib/types/commands/menu/shape-vertical-align.menu.d.ts +9 -0
  69. package/lib/types/commands/operations/actvie-drawing-operation.d.ts +2 -0
  70. package/lib/types/controllers/config.schema.d.ts +5 -0
  71. package/lib/types/controllers/format-painter.controller.d.ts +10 -0
  72. package/lib/types/controllers/menu.schema.d.ts +2 -0
  73. package/lib/types/controllers/mobile/ui.controller.d.ts +21 -6
  74. package/lib/types/controllers/sheets-shape-ui.controller.d.ts +126 -0
  75. package/lib/types/mobile-plugin.d.ts +1 -3
  76. package/lib/types/view-model/shape-data-model.d.ts +6 -0
  77. package/lib/types/views/ShapeOptions.d.ts +30 -0
  78. package/lib/types/views/object-list-panel/MobileSheetDrawingObjectListPanel.d.ts +1 -0
  79. package/lib/types/views/object-list-panel/SheetDrawingObjectListPanel.d.ts +5 -1
  80. package/lib/types/views/shape-editor-panel/ShapeLineEditor.d.ts +11 -0
  81. package/lib/types/views/shape-editor-panel/index.d.ts +1 -0
  82. package/lib/types/views/shape-text-editor/Editor.d.ts +11 -0
  83. package/lib/types/views/shape-text-editor/ShapePositionWrapper.d.ts +15 -0
  84. package/lib/types/views/shape-text-editor/hooks/use-shape-position.d.ts +37 -0
  85. package/lib/types/views/shapes.d.ts +58 -0
  86. package/lib/umd/index.js +1 -1
  87. package/lib/umd/locale/ar-SA.js +1 -1
  88. package/lib/umd/locale/ca-ES.js +1 -1
  89. package/lib/umd/locale/de-DE.js +1 -1
  90. package/lib/umd/locale/en-US.js +1 -1
  91. package/lib/umd/locale/es-ES.js +1 -1
  92. package/lib/umd/locale/fa-IR.js +1 -1
  93. package/lib/umd/locale/fr-FR.js +1 -1
  94. package/lib/umd/locale/id-ID.js +1 -1
  95. package/lib/umd/locale/it-IT.js +1 -1
  96. package/lib/umd/locale/ja-JP.js +1 -1
  97. package/lib/umd/locale/ko-KR.js +1 -1
  98. package/lib/umd/locale/pl-PL.js +1 -1
  99. package/lib/umd/locale/pt-BR.js +1 -1
  100. package/lib/umd/locale/ru-RU.js +1 -1
  101. package/lib/umd/locale/sk-SK.js +1 -1
  102. package/lib/umd/locale/vi-VN.js +1 -1
  103. package/lib/umd/locale/zh-CN.js +1 -1
  104. package/lib/umd/locale/zh-HK.js +1 -1
  105. package/lib/umd/locale/zh-TW.js +1 -1
  106. package/package.json +21 -21
@@ -0,0 +1,126 @@
1
+ import { SheetsShapeService } from '@univerjs-pro/sheets-shape';
2
+ import { Disposable, DrawingTypeEnum, ICommandService, IContextService, IUniverInstanceService, LocaleService } from '@univerjs/core';
3
+ import { IDrawingManagerService } from '@univerjs/drawing';
4
+ import { SheetInterceptorService } from '@univerjs/sheets';
5
+ import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
6
+ import { ComponentManager, IMenuManagerService, ISidebarService } from '@univerjs/ui';
7
+ export declare class SheetsShapeUIController extends Disposable {
8
+ private readonly _univerInstanceService;
9
+ private readonly _sheetInterceptorService;
10
+ private _sidebarService;
11
+ protected readonly _menuManagerService: IMenuManagerService;
12
+ private _sheetsShapeService;
13
+ private readonly _localeService;
14
+ private _componentManager;
15
+ private readonly _commandService;
16
+ private _drawingManagerService;
17
+ private readonly _sheetCanvasPopManagerService;
18
+ private readonly _contextService;
19
+ private _sidebarDisposable;
20
+ private _activeShapeInfo;
21
+ private _isOpenedShapeEditPanel;
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
+ private _initMenu;
24
+ private _registerShapeMenu;
25
+ getShapePopupMenus(unitId: string, subUnitId: string, drawingId: string, drawingType: DrawingTypeEnum): ({
26
+ label: string;
27
+ index: number;
28
+ commandId: string;
29
+ commandParams: {
30
+ unitId: string;
31
+ subUnitId: string;
32
+ drawingId: string;
33
+ drawings?: undefined;
34
+ shapeId?: undefined;
35
+ flipH?: undefined;
36
+ flipV?: undefined;
37
+ rotate?: undefined;
38
+ };
39
+ disable: boolean;
40
+ } | {
41
+ label: string;
42
+ index: number;
43
+ commandId: string;
44
+ commandParams: {
45
+ unitId: string;
46
+ drawings: {
47
+ unitId: string;
48
+ subUnitId: string;
49
+ drawingId: string;
50
+ drawingType: DrawingTypeEnum;
51
+ }[];
52
+ subUnitId?: undefined;
53
+ drawingId?: undefined;
54
+ shapeId?: undefined;
55
+ flipH?: undefined;
56
+ flipV?: undefined;
57
+ rotate?: undefined;
58
+ };
59
+ disable: boolean;
60
+ } | {
61
+ label: string;
62
+ index: number;
63
+ commandId: string;
64
+ commandParams: {
65
+ unitId: string;
66
+ subUnitId: string;
67
+ shapeId: string;
68
+ flipH: boolean;
69
+ drawingId?: undefined;
70
+ drawings?: undefined;
71
+ flipV?: undefined;
72
+ rotate?: undefined;
73
+ };
74
+ disable: boolean;
75
+ } | {
76
+ label: string;
77
+ index: number;
78
+ commandId: string;
79
+ commandParams: {
80
+ unitId: string;
81
+ subUnitId: string;
82
+ shapeId: string;
83
+ flipV: boolean;
84
+ drawingId?: undefined;
85
+ drawings?: undefined;
86
+ flipH?: undefined;
87
+ rotate?: undefined;
88
+ };
89
+ disable: boolean;
90
+ } | {
91
+ label: string;
92
+ index: number;
93
+ commandId: string;
94
+ commandParams: {
95
+ unitId: string;
96
+ subUnitId: string;
97
+ shapeId: string;
98
+ rotate: number;
99
+ drawingId?: undefined;
100
+ drawings?: undefined;
101
+ flipH?: undefined;
102
+ flipV?: undefined;
103
+ };
104
+ disable: boolean;
105
+ } | {
106
+ label: string;
107
+ index: number;
108
+ commandId: string;
109
+ commandParams: {
110
+ unitId: string;
111
+ subUnitId: string;
112
+ shapeId: string;
113
+ drawingId?: undefined;
114
+ drawings?: undefined;
115
+ flipH?: undefined;
116
+ flipV?: undefined;
117
+ rotate?: undefined;
118
+ };
119
+ disable: boolean;
120
+ })[];
121
+ private _getShapeInfo;
122
+ private _registerOperations;
123
+ private _registerComponent;
124
+ private _openShapeEditPanel;
125
+ private _closeShapeEditPanel;
126
+ }
@@ -1,19 +1,17 @@
1
1
  import type { IUniverSheetsShapeUIConfig } from './config/config';
2
2
  import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
3
  import { IRenderManagerService } from '@univerjs/engine-render';
4
- import { IUIPartsService } from '@univerjs/ui';
5
4
  export declare class UniverSheetsShapeMobileUIPlugin extends Plugin {
6
5
  private readonly _config;
7
6
  protected readonly _injector: Injector;
8
7
  private readonly _commandService;
9
8
  private readonly _configService;
10
9
  private readonly _renderManagerService;
11
- private readonly _uiPartsService;
12
10
  static type: UniverInstanceType;
13
11
  static pluginName: string;
14
12
  static packageName: string;
15
13
  static version: string;
16
- constructor(_config: IUniverSheetsShapeUIConfig | undefined, _injector: Injector, _commandService: ICommandService, _configService: IConfigService, _renderManagerService: IRenderManagerService, _uiPartsService: IUIPartsService);
14
+ constructor(_config: IUniverSheetsShapeUIConfig | undefined, _injector: Injector, _commandService: ICommandService, _configService: IConfigService, _renderManagerService: IRenderManagerService);
17
15
  onStarting(): void;
18
16
  onReady(): void;
19
17
  onRendered(): void;
@@ -0,0 +1,6 @@
1
+ import type { HorizontalAlign, IDocumentData, VerticalAlign } from '@univerjs/core';
2
+ export interface IShapeTextModel {
3
+ va: VerticalAlign;
4
+ ha: HorizontalAlign;
5
+ doc: IDocumentData;
6
+ }
@@ -0,0 +1,30 @@
1
+ import { ShapeFillEnum, ShapeTypeEnum } from '@univerjs-pro/engine-shape';
2
+ export declare const shapeFillOptions: {
3
+ label: string;
4
+ value: ShapeFillEnum;
5
+ }[];
6
+ export declare const shapeTypeOptions: (ShapeTypeEnum | {
7
+ type: ShapeTypeEnum;
8
+ endArrow: boolean;
9
+ startArrow?: undefined;
10
+ horizontal?: undefined;
11
+ vertical?: undefined;
12
+ } | {
13
+ type: ShapeTypeEnum;
14
+ endArrow: boolean;
15
+ startArrow: boolean;
16
+ horizontal?: undefined;
17
+ vertical?: undefined;
18
+ } | {
19
+ type: ShapeTypeEnum;
20
+ horizontal: boolean;
21
+ endArrow?: undefined;
22
+ startArrow?: undefined;
23
+ vertical?: undefined;
24
+ } | {
25
+ type: ShapeTypeEnum;
26
+ vertical: boolean;
27
+ endArrow?: undefined;
28
+ startArrow?: undefined;
29
+ horizontal?: undefined;
30
+ })[];
@@ -0,0 +1 @@
1
+ export declare function MobileSheetDrawingObjectListPanel(): import("react").JSX.Element;
@@ -1 +1,5 @@
1
- export declare function SheetDrawingObjectListPanel(): import("react").JSX.Element;
1
+ import type { IObjectListPanelBaseProps } from '@univerjs/drawing-ui';
2
+ import type { ComponentType } from 'react';
3
+ export declare function SheetDrawingObjectListPanel({ PanelComponent }: {
4
+ PanelComponent?: ComponentType<IObjectListPanelBaseProps>;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { IShapeData } from '@univerjs-pro/engine-shape';
2
+ interface IShapeLineProps {
3
+ unitId: string;
4
+ subUnitId: string;
5
+ shapeId: string;
6
+ shapeData: IShapeData;
7
+ isLineShape: boolean;
8
+ disableShapeOption: boolean;
9
+ }
10
+ export declare function ShapeLineEditor(props: IShapeLineProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1 @@
1
+ export { ShapeEditPanel } from './ShapeEditorPanel';
@@ -0,0 +1,11 @@
1
+ export interface IShapeEditorProps {
2
+ containerWidth: number;
3
+ containerHeight: number;
4
+ scaleX: number;
5
+ scaleY: number;
6
+ }
7
+ /**
8
+ * Shape editor component - second layer DOM.
9
+ * Handles document editing, content height tracking, and vertical alignment.
10
+ */
11
+ export declare const ShapeEditor: (props: IShapeEditorProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface IShapePositionWrapperProps {
3
+ children: ReactNode;
4
+ onPositionUpdate?: (position: {
5
+ width: number;
6
+ height: number;
7
+ scaleX: number;
8
+ scaleY: number;
9
+ }) => void;
10
+ }
11
+ /**
12
+ * Position wrapper component that handles shape positioning in DOM.
13
+ * This is the first layer DOM that tracks shape position with scroll.
14
+ */
15
+ export declare const ShapePositionWrapper: import("react").MemoExoticComponent<(props: IShapePositionWrapperProps) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,37 @@
1
+ import type { IEditingParams } from '../../../services/shape-text-editing.service';
2
+ import type { Nullable } from '@univerjs/core';
3
+ import type { Scene, SpreadsheetSkeleton } from '@univerjs/engine-render';
4
+ export interface IShapePosition {
5
+ left: number;
6
+ top: number;
7
+ width: number;
8
+ height: number;
9
+ angle: number;
10
+ scaleX: number;
11
+ scaleY: number;
12
+ }
13
+ export interface IShapePositionResult {
14
+ position: IShapePosition;
15
+ updatePosition: () => void;
16
+ }
17
+ /**
18
+ * Calculate shape position in DOM coordinates.
19
+ */
20
+ export declare function calcShapePosition(shapeLeft: number, shapeTop: number, shapeWidth: number, shapeHeight: number, shapeAngle: number, scene: Scene, skeleton: SpreadsheetSkeleton): IShapePosition;
21
+ export interface IUseShapePositionOptions {
22
+ editingParams: Nullable<IEditingParams>;
23
+ scene: Nullable<Scene>;
24
+ skeleton: Nullable<SpreadsheetSkeleton>;
25
+ getShapeTransform: () => Nullable<{
26
+ left: number;
27
+ top: number;
28
+ width: number;
29
+ height: number;
30
+ angle: number;
31
+ }>;
32
+ }
33
+ /**
34
+ * Hook to calculate and track shape position in DOM coordinates.
35
+ * Handles freeze zones and scroll updates.
36
+ */
37
+ export declare function useShapePosition(options: IUseShapePositionOptions): IShapePositionResult;
@@ -0,0 +1,58 @@
1
+ import { ShapeTypeEnum } from '@univerjs-pro/engine-shape';
2
+ export declare enum ShapeGroupEnum {
3
+ Line = "line",
4
+ Rectangle = "rectangle",
5
+ BasicShape = "basicShape",
6
+ BlockArrow = "blockArrow",
7
+ EquationShape = "equationShape",
8
+ Flowchart = "flowchart",
9
+ StarAndBanner = "starAndBanner",
10
+ Callout = "callout",
11
+ Other = "other"
12
+ }
13
+ export declare const shapeTypeOptions: ({
14
+ group: ShapeGroupEnum;
15
+ type: ShapeTypeEnum;
16
+ icon: string;
17
+ name: string;
18
+ endArrow?: undefined;
19
+ startArrow?: undefined;
20
+ horizontal?: undefined;
21
+ vertical?: undefined;
22
+ } | {
23
+ group: ShapeGroupEnum;
24
+ type: ShapeTypeEnum;
25
+ icon: string;
26
+ name: string;
27
+ endArrow: boolean;
28
+ startArrow?: undefined;
29
+ horizontal?: undefined;
30
+ vertical?: undefined;
31
+ } | {
32
+ group: ShapeGroupEnum;
33
+ type: ShapeTypeEnum;
34
+ icon: string;
35
+ name: string;
36
+ endArrow: boolean;
37
+ startArrow: boolean;
38
+ horizontal?: undefined;
39
+ vertical?: undefined;
40
+ } | {
41
+ group: ShapeGroupEnum;
42
+ type: ShapeTypeEnum;
43
+ icon: string;
44
+ name: string;
45
+ horizontal: boolean;
46
+ endArrow?: undefined;
47
+ startArrow?: undefined;
48
+ vertical?: undefined;
49
+ } | {
50
+ group: ShapeGroupEnum;
51
+ type: ShapeTypeEnum;
52
+ icon: string;
53
+ name: string;
54
+ vertical: boolean;
55
+ endArrow?: undefined;
56
+ startArrow?: undefined;
57
+ horizontal?: undefined;
58
+ })[];