@univerjs/docs-drawing-ui 0.2.2 → 0.2.3

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/index.css CHANGED
@@ -1 +1 @@
1
- .univer-upload-file-menu{position:absolute;height:100%;width:100%;text-align:center}.univer-upload-file-menu-input{display:none}.univer-image-common-panel{text-align:center;padding:var(--padding-sm);font-size:var(--font-size-sm)}.univer-image-common-panel-grid{position:relative;width:100%}.univer-image-common-panel-border{border-top:1px solid rgb(var(--border-color));margin-top:20px}.univer-image-common-panel-title{color:rgb(var(--text-color-secondary));text-align:left}.univer-image-common-panel-row{position:relative;display:flex;justify-content:flex-start;align-items:flex-start;height:100%;margin-top:10px}.univer-image-common-panel-row-vertical{justify-content:center;align-items:center;height:36px}.univer-image-common-panel-column{width:100%}.univer-image-common-panel-column-center{display:flex;justify-content:center;align-items:center}.univer-image-common-panel-inline{display:flex;align-items:center;gap:var(--margin-xxs)}.univer-image-common-panel-span2{width:50%}.univer-image-common-panel-span3{width:33.33333333%}.univer-image-common-panel-input{width:90%}.univer-sheet-image-menu{position:absolute;height:100%;width:100%;text-align:center}.univer-sheet-image-menu-input{display:none}
1
+ .univer-upload-file-menu{position:absolute;height:100%;width:100%;text-align:center}.univer-upload-file-menu-input{display:none}.univer-image-common-panel{text-align:center;padding:var(--padding-sm);font-size:var(--font-size-sm)}.univer-image-common-panel-grid{position:relative;width:100%}.univer-image-common-panel-border{border-top:1px solid rgb(var(--border-color));margin-top:20px}.univer-image-common-panel-title{color:rgb(var(--text-color-secondary));text-align:left}.univer-image-common-panel-subtitle{color:rgb(var(--text-color-primary));text-align:left}.univer-image-common-panel-row{position:relative;display:flex;justify-content:flex-start;align-items:flex-start;height:100%;margin-top:10px}.univer-image-common-panel-row-vertical{justify-content:center;align-items:center;height:36px}.univer-image-common-panel-column{width:100%}.univer-image-common-panel-column-center{display:flex;justify-content:center;align-items:center}.univer-image-common-panel-inline{display:flex;align-items:center;gap:var(--margin-xxs)}.univer-image-common-panel-span2{width:50%}.univer-image-common-panel-span3{width:33.33333333%}.univer-image-common-panel-input{width:90%}.univer-sheet-image-menu{position:absolute;height:100%;width:100%;text-align:center}.univer-sheet-image-menu-input{display:none}
@@ -15,6 +15,41 @@
15
15
  "crop": "Crop",
16
16
  "reset": "Reset Size"
17
17
  },
18
+ "image-text-wrap": {
19
+ "title": "Text Wrapping",
20
+ "wrappingStyle": "Wrapping Style",
21
+ "square": "Square",
22
+ "topAndBottom": "Top and Bottom",
23
+ "inline": "In line with text",
24
+ "behindText": "Behind text",
25
+ "inFrontText": "In front of text",
26
+ "wrapText": "Wrap text",
27
+ "bothSide": "Both sides",
28
+ "leftOnly": "Left only",
29
+ "rightOnly": "Right only",
30
+ "distanceFromText": "Distance from text",
31
+ "top": "Top(px)",
32
+ "left": "Left(px)",
33
+ "bottom": "Bottom(px)",
34
+ "right": "Right(px)"
35
+ },
36
+ "image-position": {
37
+ "title": "Position",
38
+ "horizontal": "Horizontal",
39
+ "vertical": "Vertical",
40
+ "absolutePosition": "Absolute Position(px)",
41
+ "relativePosition": "Relative Position",
42
+ "toTheRightOf": "to the right of",
43
+ "relativeTo": "relative to",
44
+ "bellow": "bellow",
45
+ "options": "Options",
46
+ "moveObjectWithText": "Move object with text",
47
+ "column": "Column",
48
+ "margin": "Margin",
49
+ "page": "Page",
50
+ "line": "Line",
51
+ "paragraph": "Paragraph"
52
+ },
18
53
  "update-status": {
19
54
  "exceedMaxSize": "Image size exceeds limit, limit is {0}M",
20
55
  "invalidImageType": "Invalid image type",
@@ -15,6 +15,41 @@
15
15
  "crop": "Обрезать",
16
16
  "reset": "Сбросить размер"
17
17
  },
18
+ "image-text-wrap": {
19
+ "title": "Text Wrapping",
20
+ "wrappingStyle": "Wrapping Style",
21
+ "square": "Square",
22
+ "topAndBottom": "Top and Bottom",
23
+ "inline": "In line with text",
24
+ "behindText": "Behind text",
25
+ "inFrontText": "In front of text",
26
+ "wrapText": "Wrap text",
27
+ "bothSide": "Both sides",
28
+ "leftOnly": "Left only",
29
+ "rightOnly": "Right only",
30
+ "distanceFromText": "Distance from text",
31
+ "top": "Top(px)",
32
+ "left": "Left(px)",
33
+ "bottom": "Bottom(px)",
34
+ "right": "Right(px)"
35
+ },
36
+ "image-position": {
37
+ "title": "Position",
38
+ "horizontal": "Horizontal",
39
+ "vertical": "Vertical",
40
+ "absolutePosition": "Absolute Position(px)",
41
+ "relativePosition": "Relative Position",
42
+ "toTheRightOf": "to the right of",
43
+ "relativeTo": "relative to",
44
+ "bellow": "bellow",
45
+ "options": "Options",
46
+ "moveObjectWithText": "Move object with text",
47
+ "column": "Column",
48
+ "margin": "Margin",
49
+ "page": "Page",
50
+ "line": "Line",
51
+ "paragraph": "Paragraph"
52
+ },
18
53
  "update-status": {
19
54
  "exceedMaxSize": "Размер изображения превышает лимит, лимит составляет {0}М",
20
55
  "invalidImageType": "Недопустимый тип изображения",
@@ -0,0 +1,59 @@
1
+ {
2
+ "docImage": {
3
+ "title": "Hình ảnh",
4
+ "upload": {
5
+ "float": "Chèn hình ảnh"
6
+ },
7
+ "panel": {
8
+ "title": "Chỉnh sửa hình ảnh"
9
+ }
10
+ },
11
+ "image-popup": {
12
+ "replace": "Thay thế",
13
+ "delete": "Xóa",
14
+ "edit": "Chỉnh sửa",
15
+ "crop": "Cắt",
16
+ "reset": "Đặt lại kích thước"
17
+ },
18
+ "image-text-wrap": {
19
+ "title": "Text Wrapping",
20
+ "wrappingStyle": "Wrapping Style",
21
+ "square": "Square",
22
+ "topAndBottom": "Top and Bottom",
23
+ "inline": "In line with text",
24
+ "behindText": "Behind text",
25
+ "inFrontText": "In front of text",
26
+ "wrapText": "Wrap text",
27
+ "bothSide": "Both sides",
28
+ "leftOnly": "Left only",
29
+ "rightOnly": "Right only",
30
+ "distanceFromText": "Distance from text",
31
+ "top": "Top(px)",
32
+ "left": "Left(px)",
33
+ "bottom": "Bottom(px)",
34
+ "right": "Right(px)"
35
+ },
36
+ "image-position": {
37
+ "title": "Position",
38
+ "horizontal": "Horizontal",
39
+ "vertical": "Vertical",
40
+ "absolutePosition": "Absolute Position(px)",
41
+ "relativePosition": "Relative Position",
42
+ "toTheRightOf": "to the right of",
43
+ "relativeTo": "relative to",
44
+ "bellow": "bellow",
45
+ "options": "Options",
46
+ "moveObjectWithText": "Move object with text",
47
+ "column": "Column",
48
+ "margin": "Margin",
49
+ "page": "Page",
50
+ "line": "Line",
51
+ "paragraph": "Paragraph"
52
+ },
53
+ "update-status": {
54
+ "exceedMaxSize": "Kích thước hình ảnh vượt quá giới hạn, giới hạn là {0}M",
55
+ "invalidImageType": "Loại hình ảnh không hợp lệ",
56
+ "exceedMaxCount": "Chỉ có thể tải lên tối đa {0} hình ảnh một lần",
57
+ "invalidImage": "Hình ảnh không hợp lệ"
58
+ }
59
+ }
@@ -15,6 +15,41 @@
15
15
  "crop": "裁剪",
16
16
  "reset": "重置大小"
17
17
  },
18
+ "image-text-wrap": {
19
+ "title": "文字环绕",
20
+ "wrappingStyle": "环绕方式",
21
+ "square": "四周型",
22
+ "topAndBottom": "上下型",
23
+ "inline": "嵌入型",
24
+ "behindText": "衬于文字下方",
25
+ "inFrontText": "浮于文字上方",
26
+ "wrapText": "自动换行",
27
+ "bothSide": "两侧",
28
+ "leftOnly": "左侧",
29
+ "rightOnly": "右侧",
30
+ "distanceFromText": "距正文",
31
+ "top": "上(px)",
32
+ "left": "左(px)",
33
+ "bottom": "下(px)",
34
+ "right": "右(px)"
35
+ },
36
+ "image-position": {
37
+ "title": "位置",
38
+ "horizontal": "水平",
39
+ "vertical": "垂直",
40
+ "absolutePosition": "绝对位置(px)",
41
+ "relativePosition": "相对位置",
42
+ "toTheRightOf": "右侧",
43
+ "relativeTo": "相对于",
44
+ "bellow": "下方",
45
+ "options": "选项",
46
+ "moveObjectWithText": "对象随文字移动",
47
+ "column": "栏",
48
+ "margin": "页边距",
49
+ "page": "页面",
50
+ "line": "行",
51
+ "paragraph": "段落"
52
+ },
18
53
  "update-status": {
19
54
  "exceedMaxSize": "图片大小超过限制, 限制为{0}M",
20
55
  "invalidImageType": "图片类型错误",
@@ -0,0 +1,59 @@
1
+ {
2
+ "docImage": {
3
+ "title": "圖片",
4
+ "upload": {
5
+ "float": "插入圖片"
6
+ },
7
+ "panel": {
8
+ "title": "編圖"
9
+ }
10
+ },
11
+ "image-popup": {
12
+ "replace": "替換",
13
+ "delete": "刪除",
14
+ "edit": "編輯",
15
+ "crop": "裁切",
16
+ "reset": "重置大小"
17
+ },
18
+ "image-text-wrap": {
19
+ "title": "文字环绕",
20
+ "wrappingStyle": "环绕方式",
21
+ "square": "四周型",
22
+ "topAndBottom": "上下型",
23
+ "inline": "嵌入型",
24
+ "behindText": "衬于文字下方",
25
+ "inFrontText": "浮于文字上方",
26
+ "wrapText": "自动换行",
27
+ "bothSide": "两侧",
28
+ "leftOnly": "左侧",
29
+ "rightOnly": "右侧",
30
+ "distanceFromText": "距正文",
31
+ "top": "上(px)",
32
+ "left": "左(px)",
33
+ "bottom": "下(px)",
34
+ "right": "右(px)"
35
+ },
36
+ "image-position": {
37
+ "title": "位置",
38
+ "horizontal": "水平",
39
+ "vertical": "垂直",
40
+ "absolutePosition": "绝对位置(px)",
41
+ "relativePosition": "相对位置",
42
+ "toTheRightOf": "右侧",
43
+ "relativeTo": "相对于",
44
+ "bellow": "下方",
45
+ "options": "选项",
46
+ "moveObjectWithText": "对象随文字移动",
47
+ "column": "栏",
48
+ "margin": "页边距",
49
+ "page": "页面",
50
+ "line": "行",
51
+ "paragraph": "段落"
52
+ },
53
+ "update-status": {
54
+ "exceedMaxSize": "圖片大小超過限制, 限制為{0}M",
55
+ "invalidImageType": "圖片類型錯誤",
56
+ "exceedMaxCount": "圖片只能一次上傳{0}張",
57
+ "invalidImage": "無效圖片"
58
+ }
59
+ }
@@ -1,6 +1,6 @@
1
1
  import { ICommand } from '@univerjs/core';
2
2
 
3
3
  /**
4
- * The command to insert new defined name
4
+ * The command to insert new drawings
5
5
  */
6
6
  export declare const InsertDocDrawingCommand: ICommand;
@@ -5,6 +5,6 @@ export interface ISetDrawingArrangeCommandParams extends IDrawingOrderMapParam {
5
5
  arrangeType: ArrangeTypeEnum;
6
6
  }
7
7
  /**
8
- * The command to insert new defined name
8
+ * The command to arrange drawings.
9
9
  */
10
10
  export declare const SetDocDrawingArrangeCommand: ICommand;
@@ -0,0 +1,56 @@
1
+ import { ICommand, IDocDrawingBase, IDocDrawingPosition, IObjectPositionH, IObjectPositionV, ISize } from '@univerjs/core';
2
+
3
+ export declare enum TextWrappingStyle {
4
+ INLINE = "inline",
5
+ BEHIND_TEXT = "behindText",
6
+ IN_FRONT_OF_TEXT = "inFrontOfText",
7
+ WRAP_SQUARE = "wrapSquare",
8
+ WRAP_TOP_AND_BOTTOM = "wrapTopAndBottom"
9
+ }
10
+ /**
11
+ * The command to update drawing wrapping style.
12
+ */
13
+ export declare const UpdateDocDrawingWrappingStyleCommand: ICommand;
14
+ /**
15
+ * The command to update drawing wrap text.
16
+ */
17
+ export declare const UpdateDocDrawingDistanceCommand: ICommand;
18
+ /**
19
+ * The command to update drawing wrap text.
20
+ */
21
+ export declare const UpdateDocDrawingWrapTextCommand: ICommand;
22
+ export interface IDrawingDocTransform {
23
+ drawingId: string;
24
+ key: 'size' | 'angle' | 'positionH' | 'positionV';
25
+ value: ISize | number | IObjectPositionH | IObjectPositionV;
26
+ }
27
+ export interface IUpdateDrawingDocTransformParams {
28
+ unitId: string;
29
+ subUnitId: string;
30
+ drawings: IDrawingDocTransform[];
31
+ }
32
+ /**
33
+ * The command to update drawing position.
34
+ */
35
+ export declare const UpdateDrawingDocTransformCommand: ICommand;
36
+ export interface IMoveInlineDrawingParams {
37
+ unitId: string;
38
+ subUnitId: string;
39
+ drawing: IDocDrawingBase;
40
+ offset: number;
41
+ }
42
+ /**
43
+ * The command to move inline drawing.
44
+ */
45
+ export declare const IMoveInlineDrawingCommand: ICommand;
46
+ export interface ITransformNonInlineDrawingParams {
47
+ unitId: string;
48
+ subUnitId: string;
49
+ drawing: IDocDrawingBase;
50
+ offset: number;
51
+ docTransform: IDocDrawingPosition;
52
+ }
53
+ /**
54
+ * The command to transform non-inline drawing.
55
+ */
56
+ export declare const ITransformNonInlineDrawingCommand: ICommand;
@@ -0,0 +1,18 @@
1
+ import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
+ import { IDocDrawingService } from '@univerjs/docs-drawing';
3
+ import { IDrawingManagerService } from '@univerjs/drawing';
4
+ import { IRenderManagerService } from '@univerjs/engine-render';
5
+
6
+ export declare class DocDrawingAddRemoveController extends Disposable {
7
+ private readonly _univerInstanceService;
8
+ private readonly _commandService;
9
+ private readonly _drawingManagerService;
10
+ private readonly _docDrawingService;
11
+ private readonly _renderManagerService;
12
+ constructor(_univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _docDrawingService: IDocDrawingService, _renderManagerService: IRenderManagerService);
13
+ private _initialize;
14
+ private _commandExecutedListener;
15
+ private _addDrawings;
16
+ private _removeDrawings;
17
+ private _updateDrawingsOrder;
18
+ }
@@ -0,0 +1,32 @@
1
+ import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
+ import { IDrawingManagerService } from '@univerjs/drawing';
3
+ import { IRenderManagerService } from '@univerjs/engine-render';
4
+
5
+ export declare class DocDrawingTransformerController extends Disposable {
6
+ private readonly _commandService;
7
+ private readonly _univerInstanceService;
8
+ private readonly _drawingManagerService;
9
+ private readonly _renderManagerService;
10
+ private _liquid;
11
+ private _listenerOnImageMap;
12
+ private _transformerCache;
13
+ private _anchorShape;
14
+ constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _drawingManagerService: IDrawingManagerService, _renderManagerService: IRenderManagerService);
15
+ private _init;
16
+ private _listenDrawingFocus;
17
+ private _listenTransformerChange;
18
+ private _updateMultipleDrawingDocTransform;
19
+ private _updateDrawingAnchor;
20
+ private _updateInlineDrawingAnchor;
21
+ private _getInlineDrawingAnchor;
22
+ private _getDrawingAnchor;
23
+ private _updateDrawingSize;
24
+ private _moveInlineDrawing;
25
+ private _limitDrawingInPage;
26
+ private _nonInlineDrawingTransform;
27
+ private _getSceneAndTransformerByDrawingSearch;
28
+ private _getTransformCoordForDocumentOffset;
29
+ private _createOrUpdateInlineAnchor;
30
+ private _getDocObject;
31
+ private _getPageContentSize;
32
+ }
@@ -0,0 +1,20 @@
1
+ import { DocumentDataModel, Disposable, ICommandService } from '@univerjs/core';
2
+ import { DocSkeletonManagerService } from '@univerjs/docs';
3
+ import { IDrawingManagerService } from '@univerjs/drawing';
4
+ import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
5
+ import { IEditorService } from '@univerjs/ui';
6
+
7
+ export declare class DocDrawingTransformUpdateController extends Disposable implements IRenderModule {
8
+ private readonly _context;
9
+ private readonly _docSkeletonManagerService;
10
+ private readonly _commandService;
11
+ private readonly _editorService;
12
+ private readonly _drawingManagerService;
13
+ private _liquid;
14
+ constructor(_context: IRenderContext<DocumentDataModel>, _docSkeletonManagerService: DocSkeletonManagerService, _commandService: ICommandService, _editorService: IEditorService, _drawingManagerService: IDrawingManagerService);
15
+ private _initialize;
16
+ private _initialRenderRefresh;
17
+ private _commandExecutedListener;
18
+ private _refreshDrawing;
19
+ private _calculateDrawingPosition;
20
+ }
@@ -2,30 +2,33 @@ import { DocumentDataModel, Disposable, ICommandService, IContextService, Locale
2
2
  import { IDrawingManagerService, IImageIoService } from '@univerjs/drawing';
3
3
  import { IMessageService } from '@univerjs/ui';
4
4
  import { IDocDrawingService } from '@univerjs/docs-drawing';
5
- import { DocSkeletonManagerService, TextSelectionManagerService } from '@univerjs/docs';
6
- import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
5
+ import { TextSelectionManagerService } from '@univerjs/docs';
6
+ import { IRenderContext, IRenderManagerService, IRenderModule, ITextSelectionRenderManager } from '@univerjs/engine-render';
7
7
 
8
8
  export declare class DocDrawingUpdateRenderController extends Disposable implements IRenderModule {
9
9
  private readonly _context;
10
10
  private readonly _commandService;
11
11
  private readonly _textSelectionManagerService;
12
- private readonly _docSkeletonManagerService;
13
- private readonly _sheetDrawingService;
12
+ private readonly _renderManagerSrv;
14
13
  private readonly _imageIoService;
14
+ private readonly _docDrawingService;
15
15
  private readonly _drawingManagerService;
16
16
  private readonly _contextService;
17
17
  private readonly _messageService;
18
18
  private readonly _localeService;
19
- constructor(_context: IRenderContext<DocumentDataModel>, _commandService: ICommandService, _textSelectionManagerService: TextSelectionManagerService, _docSkeletonManagerService: DocSkeletonManagerService, _sheetDrawingService: IDocDrawingService, _imageIoService: IImageIoService, _drawingManagerService: IDrawingManagerService, _contextService: IContextService, _messageService: IMessageService, _localeService: LocaleService);
19
+ private readonly _textSelectionManager;
20
+ private readonly _textSelectionRenderManager;
21
+ constructor(_context: IRenderContext<DocumentDataModel>, _commandService: ICommandService, _textSelectionManagerService: TextSelectionManagerService, _renderManagerSrv: IRenderManagerService, _imageIoService: IImageIoService, _docDrawingService: IDocDrawingService, _drawingManagerService: IDrawingManagerService, _contextService: IContextService, _messageService: IMessageService, _localeService: LocaleService, _textSelectionManager: TextSelectionManagerService, _textSelectionRenderManager: ITextSelectionRenderManager);
20
22
  /**
21
23
  * Upload image to cell or float image
22
24
  */
23
25
  private _initCommandListeners;
24
- private _insertFloatImage;
26
+ private _insertFloatImages;
25
27
  private _getImagePosition;
26
28
  private _updateOrderListener;
27
29
  private _updateDrawingListener;
28
30
  private _refreshDocSkeleton;
29
31
  private _groupDrawingListener;
32
+ private _getCurrentSceneAndTransformer;
30
33
  private _focusDrawingListener;
31
34
  }
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export { UniverDocsDrawingUIPlugin } from './plugin';
17
- export { DeleteDocDrawingsCommand } from './commands/commands/delete-drawings.command';
17
+ export { DeleteDocDrawingsCommand } from './commands/commands/delete-doc-drawing.command';
18
18
  export { GroupDocDrawingCommand } from './commands/commands/group-doc-drawing.command';
19
19
  export { InsertDocDrawingCommand } from './commands/commands/insert-doc-drawing.command';
20
20
  export { MoveDocDrawingsCommand } from './commands/commands/move-drawings.command';
@@ -0,0 +1,4 @@
1
+ import { default as zhCN } from './zh-CN';
2
+
3
+ declare const locale: typeof zhCN;
4
+ export default locale;
@@ -30,6 +30,41 @@ declare const locale: {
30
30
  crop: string;
31
31
  reset: string;
32
32
  };
33
+ 'image-text-wrap': {
34
+ title: string;
35
+ wrappingStyle: string;
36
+ square: string;
37
+ topAndBottom: string;
38
+ inline: string;
39
+ behindText: string;
40
+ inFrontText: string;
41
+ wrapText: string;
42
+ bothSide: string;
43
+ leftOnly: string;
44
+ rightOnly: string;
45
+ distanceFromText: string;
46
+ top: string;
47
+ left: string;
48
+ bottom: string;
49
+ right: string;
50
+ };
51
+ 'image-position': {
52
+ title: string;
53
+ horizontal: string;
54
+ vertical: string;
55
+ absolutePosition: string;
56
+ relativePosition: string;
57
+ toTheRightOf: string;
58
+ relativeTo: string;
59
+ bellow: string;
60
+ options: string;
61
+ moveObjectWithText: string;
62
+ column: string;
63
+ margin: string;
64
+ page: string;
65
+ line: string;
66
+ paragraph: string;
67
+ };
33
68
  'update-status': {
34
69
  exceedMaxSize: string;
35
70
  invalidImageType: string;
@@ -0,0 +1,4 @@
1
+ import { default as zhCN } from './zh-CN';
2
+
3
+ declare const locale: typeof zhCN;
4
+ export default locale;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { IDrawingParam } from '@univerjs/drawing';
3
+
4
+ export interface IDocDrawingPositionProps {
5
+ drawings: IDrawingParam[];
6
+ }
7
+ export declare const DocDrawingPosition: (props: IDocDrawingPositionProps) => React.JSX.Element | undefined;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { IDrawingParam } from '@univerjs/drawing';
3
+
4
+ export interface IDocDrawingTextWrapProps {
5
+ drawings: IDrawingParam[];
6
+ }
7
+ export declare const DocDrawingTextWrap: (props: IDocDrawingTextWrapProps) => React.JSX.Element | null;