@univerjs/drawing-ui 0.1.13
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/LICENSE +176 -0
- package/README.md +16 -0
- package/lib/cjs/index.js +1 -0
- package/lib/es/index.js +1778 -0
- package/lib/index.css +1 -0
- package/lib/locale/en-US.json +54 -0
- package/lib/locale/ru-RU.json +54 -0
- package/lib/locale/zh-CN.json +54 -0
- package/lib/types/commands/operations/drawing-align.operation.d.ts +17 -0
- package/lib/types/commands/operations/image-crop.operation.d.ts +22 -0
- package/lib/types/commands/operations/image-reset-size.operation.d.ts +3 -0
- package/lib/types/controllers/drawing-ui.controller.d.ts +16 -0
- package/lib/types/controllers/drawing-update.controller.d.ts +35 -0
- package/lib/types/controllers/image-cropper.controller.d.ts +27 -0
- package/lib/types/controllers/image-update.controller.d.ts +26 -0
- package/lib/types/controllers/utils.d.ts +9 -0
- package/lib/types/index.d.ts +23 -0
- package/lib/types/locale/en-US.d.ts +4 -0
- package/lib/types/locale/ru-RU.d.ts +4 -0
- package/lib/types/locale/zh-CN.d.ts +70 -0
- package/lib/types/plugin.d.ts +11 -0
- package/lib/types/utils/config.d.ts +18 -0
- package/lib/types/utils/get-update-params.d.ts +5 -0
- package/lib/types/views/crop/image-cropper-object.d.ts +34 -0
- package/lib/types/views/image-popup-menu/ImagePopupMenu.d.ts +19 -0
- package/lib/types/views/image-popup-menu/component-name.d.ts +16 -0
- package/lib/types/views/image-viewer/ImageViewer.d.ts +7 -0
- package/lib/types/views/image-viewer/component-name.d.ts +16 -0
- package/lib/types/views/panel/DrawingAlign.d.ts +8 -0
- package/lib/types/views/panel/DrawingArrange.d.ts +8 -0
- package/lib/types/views/panel/DrawingCommonPanel.d.ts +12 -0
- package/lib/types/views/panel/DrawingGroup.d.ts +8 -0
- package/lib/types/views/panel/DrawingTransform.d.ts +8 -0
- package/lib/types/views/panel/ImageCropper.d.ts +8 -0
- package/lib/umd/index.js +1 -0
- package/package.json +86 -0
package/lib/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.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-image-popup-menu{display:grid;gap:var(--margin-xxs);align-items:center;box-sizing:border-box;margin-top:0;margin-bottom:0;padding:var(--padding-sm);font-size:var(--font-size-base);background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);box-shadow:var(--box-shadow-lg)}.univer-image-popup-menu li{list-style:none}.univer-image-popup-menu-item{cursor:pointer;position:relative;display:flex;align-items:center;box-sizing:border-box;height:28px;font-size:var(--font-size-base);font-style:normal;line-height:20px;text-align:left;border-radius:4px;border-radius:var(--border-radius-base);transition:background .2s}.univer-image-popup-menu-item:hover{background-color:rgb(var(--bg-color-hover))}.univer-image-popup-menu-item-icon{position:absolute;top:50%;left:var(--padding-xs);transform:translateY(-50%);display:flex;align-items:center;justify-content:center}.univer-image-popup-menu-item-title{padding:var(--padding-xs) var(--padding-xs) var(--padding-xs) 0;vertical-align:middle}.univer-image-popup-menu-item-hide{color:rgb(var(--text-color-secondary))}.univer-image-popup-menu-item:hover{background:rgb(var(--grey-100))}.univer-btn-container{display:flex;align-items:center;justify-content:center;padding:3px;background:#fff;border:1px solid rgb(var(--grey-200, #e5e5e5));border-radius:4px}.univer-btn-container:hover,.univer-btn-container.univer-btn-container-expand{background:rgb(var(--grey-100, #f5f5f5))}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"image-popup": {
|
|
3
|
+
"replace": "Replace",
|
|
4
|
+
"delete": "Delete",
|
|
5
|
+
"edit": "Edit",
|
|
6
|
+
"crop": "Crop",
|
|
7
|
+
"reset": "Reset Size"
|
|
8
|
+
},
|
|
9
|
+
"image-cropper": {
|
|
10
|
+
"error": "Cannot crop non-image objects."
|
|
11
|
+
},
|
|
12
|
+
"image-panel": {
|
|
13
|
+
"arrange": {
|
|
14
|
+
"title": "Arrange",
|
|
15
|
+
"forward": "Bring Forward",
|
|
16
|
+
"backward": "Send Backward",
|
|
17
|
+
"front": "Bring to Front",
|
|
18
|
+
"back": "Send to Back"
|
|
19
|
+
},
|
|
20
|
+
"transform": {
|
|
21
|
+
"title": "Transform",
|
|
22
|
+
"rotate": "Rotate (°)",
|
|
23
|
+
"x": "X (px)",
|
|
24
|
+
"y": "Y (px)",
|
|
25
|
+
"width": "Width (px)",
|
|
26
|
+
"height": "Height (px)",
|
|
27
|
+
"lock": "Lock Ratio (%)"
|
|
28
|
+
},
|
|
29
|
+
"crop": {
|
|
30
|
+
"title": "Crop",
|
|
31
|
+
"start": "Start Crop",
|
|
32
|
+
"mode": "Free"
|
|
33
|
+
},
|
|
34
|
+
"group": {
|
|
35
|
+
"title": "Group",
|
|
36
|
+
"group": "Group",
|
|
37
|
+
"reGroup": "Regroup",
|
|
38
|
+
"unGroup": "Ungroup"
|
|
39
|
+
},
|
|
40
|
+
"align": {
|
|
41
|
+
"title": "Align",
|
|
42
|
+
"default": "Select Align Type",
|
|
43
|
+
"left": "Align Left",
|
|
44
|
+
"center": "Align Center",
|
|
45
|
+
"right": "Align Right",
|
|
46
|
+
"top": "Align Top",
|
|
47
|
+
"middle": "Align Middle",
|
|
48
|
+
"bottom": "Align Bottom",
|
|
49
|
+
"horizon": "Distribute Horizontally ",
|
|
50
|
+
"vertical": "Distribute Vertically "
|
|
51
|
+
},
|
|
52
|
+
"null": "No Object Selection"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"image-popup": {
|
|
3
|
+
"replace": "Заменить",
|
|
4
|
+
"delete": "Удалить",
|
|
5
|
+
"edit": "Редактировать",
|
|
6
|
+
"crop": "Обрезать",
|
|
7
|
+
"reset": "Сбросить размер"
|
|
8
|
+
},
|
|
9
|
+
"image-cropper": {
|
|
10
|
+
"error": "Невозможно обрезать не изображения."
|
|
11
|
+
},
|
|
12
|
+
"image-panel": {
|
|
13
|
+
"arrange": {
|
|
14
|
+
"title": "Расположение",
|
|
15
|
+
"forward": "Переместить вперёд",
|
|
16
|
+
"backward": "Переместить назад",
|
|
17
|
+
"front": "На передний план",
|
|
18
|
+
"back": "На задний план"
|
|
19
|
+
},
|
|
20
|
+
"transform": {
|
|
21
|
+
"title": "Трансформация",
|
|
22
|
+
"rotate": "Повернуть (°)",
|
|
23
|
+
"x": "X (пкс)",
|
|
24
|
+
"y": "Y (пкс)",
|
|
25
|
+
"width": "Ширина (пкс)",
|
|
26
|
+
"height": "Высота (пкс)",
|
|
27
|
+
"lock": "Заблокировать пропорции (%)"
|
|
28
|
+
},
|
|
29
|
+
"crop": {
|
|
30
|
+
"title": "Обрезка",
|
|
31
|
+
"start": "Начать обрезку",
|
|
32
|
+
"mode": "Свободный"
|
|
33
|
+
},
|
|
34
|
+
"group": {
|
|
35
|
+
"title": "Группировка",
|
|
36
|
+
"group": "Сгруппировать",
|
|
37
|
+
"reGroup": "Перегруппировать",
|
|
38
|
+
"unGroup": "Разгруппировать"
|
|
39
|
+
},
|
|
40
|
+
"align": {
|
|
41
|
+
"title": "Выравнивание",
|
|
42
|
+
"default": "Выберите тип выравнивания",
|
|
43
|
+
"left": "Выровнять по левому краю",
|
|
44
|
+
"center": "Выровнять по центру",
|
|
45
|
+
"right": "Выровнять по правому краю",
|
|
46
|
+
"top": "Выровнять по верхнему краю",
|
|
47
|
+
"middle": "Выровнять посередине",
|
|
48
|
+
"bottom": "Выровнять по нижнему краю",
|
|
49
|
+
"horizon": "Распределить горизонтально",
|
|
50
|
+
"vertical": "Распределить вертикально"
|
|
51
|
+
},
|
|
52
|
+
"null": "Нет выбранных объектов"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"image-popup": {
|
|
3
|
+
"replace": "替换",
|
|
4
|
+
"delete": "删除",
|
|
5
|
+
"edit": "编辑",
|
|
6
|
+
"crop": "裁剪",
|
|
7
|
+
"reset": "重置大小"
|
|
8
|
+
},
|
|
9
|
+
"image-cropper": {
|
|
10
|
+
"error": "无法裁剪非图片元素"
|
|
11
|
+
},
|
|
12
|
+
"image-panel": {
|
|
13
|
+
"arrange": {
|
|
14
|
+
"title": "排列",
|
|
15
|
+
"forward": "上移一层",
|
|
16
|
+
"backward": "下移一层",
|
|
17
|
+
"front": "置于顶层",
|
|
18
|
+
"back": "置于底层"
|
|
19
|
+
},
|
|
20
|
+
"transform": {
|
|
21
|
+
"title": "变换",
|
|
22
|
+
"rotate": "旋转 (°)",
|
|
23
|
+
"x": "X (px)",
|
|
24
|
+
"y": "Y (px)",
|
|
25
|
+
"width": "宽度 (px)",
|
|
26
|
+
"height": "高度 (px)",
|
|
27
|
+
"lock": "锁定比例 (%)"
|
|
28
|
+
},
|
|
29
|
+
"crop": {
|
|
30
|
+
"title": "裁剪",
|
|
31
|
+
"start": "开始裁剪",
|
|
32
|
+
"mode": "自由比例裁剪"
|
|
33
|
+
},
|
|
34
|
+
"group": {
|
|
35
|
+
"title": "组合",
|
|
36
|
+
"group": "组合",
|
|
37
|
+
"reGroup": "重新组合",
|
|
38
|
+
"unGroup": "取消组合"
|
|
39
|
+
},
|
|
40
|
+
"align": {
|
|
41
|
+
"title": "对齐方式",
|
|
42
|
+
"default": "选择对齐方式",
|
|
43
|
+
"left": "左对齐",
|
|
44
|
+
"center": "水平居中",
|
|
45
|
+
"right": "右对齐",
|
|
46
|
+
"top": "顶部对齐",
|
|
47
|
+
"middle": "垂直居中",
|
|
48
|
+
"bottom": "底部对齐",
|
|
49
|
+
"horizon": "水平分布",
|
|
50
|
+
"vertical": "垂直分布"
|
|
51
|
+
},
|
|
52
|
+
"null": "未选中任何对象"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IOperation } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export declare enum AlignType {
|
|
4
|
+
default = "0",
|
|
5
|
+
left = "1",
|
|
6
|
+
center = "2",
|
|
7
|
+
right = "3",
|
|
8
|
+
top = "4",
|
|
9
|
+
middle = "5",
|
|
10
|
+
bottom = "6",
|
|
11
|
+
horizon = "7",
|
|
12
|
+
vertical = "8"
|
|
13
|
+
}
|
|
14
|
+
export interface ISetDrawingAlignOperationParams {
|
|
15
|
+
alignType: AlignType;
|
|
16
|
+
}
|
|
17
|
+
export declare const SetDrawingAlignOperation: IOperation<ISetDrawingAlignOperationParams>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IDrawingSearch, IOperation } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export declare const OpenImageCropOperation: IOperation<IDrawingSearch>;
|
|
4
|
+
export declare const CloseImageCropOperation: IOperation<{
|
|
5
|
+
isAuto?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export declare enum CropType {
|
|
8
|
+
FREE = "0",
|
|
9
|
+
R1_1 = "1",
|
|
10
|
+
R16_9 = "2",
|
|
11
|
+
R9_16 = "3",
|
|
12
|
+
R5_4 = "4",
|
|
13
|
+
R4_5 = "5",
|
|
14
|
+
R4_3 = "6",
|
|
15
|
+
R3_4 = "7",
|
|
16
|
+
R3_2 = "8",
|
|
17
|
+
R2_3 = "9"
|
|
18
|
+
}
|
|
19
|
+
export interface IOpenImageCropOperationBySrcRectParams {
|
|
20
|
+
cropType: CropType;
|
|
21
|
+
}
|
|
22
|
+
export declare const AutoImageCropOperation: IOperation<IOpenImageCropOperationBySrcRectParams>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Disposable, ICommandService, LocaleService } from '@univerjs/core';
|
|
2
|
+
import { ComponentManager, IMenuService } from '@univerjs/ui';
|
|
3
|
+
import { Injector } from '@wendellhu/redi';
|
|
4
|
+
|
|
5
|
+
export declare class DrawingUIController extends Disposable {
|
|
6
|
+
private readonly _injector;
|
|
7
|
+
private readonly _componentManager;
|
|
8
|
+
private readonly _menuService;
|
|
9
|
+
private readonly _commandService;
|
|
10
|
+
private readonly _localeService;
|
|
11
|
+
constructor(_injector: Injector, _componentManager: ComponentManager, _menuService: IMenuService, _commandService: ICommandService, _localeService: LocaleService);
|
|
12
|
+
private _initCustomComponents;
|
|
13
|
+
private _initMenus;
|
|
14
|
+
private _initCommands;
|
|
15
|
+
private _init;
|
|
16
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
3
|
+
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
4
|
+
|
|
5
|
+
export declare class DrawingUpdateController extends Disposable {
|
|
6
|
+
private readonly _currentUniverService;
|
|
7
|
+
private readonly _commandService;
|
|
8
|
+
private readonly _renderManagerService;
|
|
9
|
+
private readonly _drawingManagerService;
|
|
10
|
+
constructor(_currentUniverService: IUniverInstanceService, _commandService: ICommandService, _renderManagerService: IRenderManagerService, _drawingManagerService: IDrawingManagerService);
|
|
11
|
+
dispose(): void;
|
|
12
|
+
private _initialize;
|
|
13
|
+
private _recoveryImages;
|
|
14
|
+
private _commandExecutedListener;
|
|
15
|
+
private _drawingGroupListener;
|
|
16
|
+
private _getSceneAndTransformerByDrawingSearch;
|
|
17
|
+
private _groupDrawings;
|
|
18
|
+
private _groupDrawing;
|
|
19
|
+
private _ungroupDrawings;
|
|
20
|
+
private _ungroupDrawing;
|
|
21
|
+
private _drawingAlign;
|
|
22
|
+
private _applyAlignType;
|
|
23
|
+
private _sortDrawingTransform;
|
|
24
|
+
private _drawingArrangeListener;
|
|
25
|
+
private _drawingArrange;
|
|
26
|
+
private _sceneListenerOnDrawingMap;
|
|
27
|
+
private _drawingAddListener;
|
|
28
|
+
private _insertDrawing;
|
|
29
|
+
private _drawingRemoveListener;
|
|
30
|
+
private _drawingUpdateListener;
|
|
31
|
+
private _drawingRefreshListener;
|
|
32
|
+
private _drawingVisibleListener;
|
|
33
|
+
private _filterUpdateParams;
|
|
34
|
+
private _addListenerOnDrawing;
|
|
35
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Disposable, ICommandService, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
2
|
+
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
3
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
|
+
import { IMessageService } from '@univerjs/ui';
|
|
5
|
+
|
|
6
|
+
export declare class ImageCropperController extends Disposable {
|
|
7
|
+
private readonly _commandService;
|
|
8
|
+
private readonly _drawingManagerService;
|
|
9
|
+
private readonly _renderManagerService;
|
|
10
|
+
private _univerInstanceService;
|
|
11
|
+
private readonly _messageService;
|
|
12
|
+
private readonly _localeService;
|
|
13
|
+
private _sceneListenerOnImageMap;
|
|
14
|
+
constructor(_commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _messageService: IMessageService, _localeService: LocaleService);
|
|
15
|
+
private _init;
|
|
16
|
+
private _initAutoCrop;
|
|
17
|
+
private _calculateSrcRectByRatio;
|
|
18
|
+
private _updateCropperObject;
|
|
19
|
+
private _initOpenCrop;
|
|
20
|
+
private _searchCropObject;
|
|
21
|
+
private _initCloseCrop;
|
|
22
|
+
private _getApplyObjectByCropObject;
|
|
23
|
+
private _addListenerOnImage;
|
|
24
|
+
private _addHoverForImageCopper;
|
|
25
|
+
private _endCropListener;
|
|
26
|
+
private _getSrcRectByTransformState;
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
3
|
+
import { IDrawingManagerService, IImageIoService } from '@univerjs/drawing';
|
|
4
|
+
import { IDialogService } from '@univerjs/ui';
|
|
5
|
+
|
|
6
|
+
export declare class ImageUpdateController extends Disposable {
|
|
7
|
+
private readonly _commandService;
|
|
8
|
+
private readonly _renderManagerService;
|
|
9
|
+
private readonly _drawingManagerService;
|
|
10
|
+
private readonly _dialogService;
|
|
11
|
+
private readonly _imageIoService;
|
|
12
|
+
private readonly _currentUniverService;
|
|
13
|
+
constructor(_commandService: ICommandService, _renderManagerService: IRenderManagerService, _drawingManagerService: IDrawingManagerService, _dialogService: IDialogService, _imageIoService: IImageIoService, _currentUniverService: IUniverInstanceService);
|
|
14
|
+
dispose(): void;
|
|
15
|
+
private _initialize;
|
|
16
|
+
private _recoveryImages;
|
|
17
|
+
private _commandExecutedListener;
|
|
18
|
+
private _getSceneAndTransformerByDrawingSearch;
|
|
19
|
+
private _resetImageSize;
|
|
20
|
+
private _drawingAddListener;
|
|
21
|
+
private _insertImages;
|
|
22
|
+
private _imageUpdateListener;
|
|
23
|
+
private _addHoverForImage;
|
|
24
|
+
private _addDialogForImage;
|
|
25
|
+
private _adjustImageSize;
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IUniverInstanceService, Nullable } from '@univerjs/core';
|
|
2
|
+
import { IDrawingManagerService, IDrawingSearch } from '@univerjs/drawing';
|
|
3
|
+
import { BaseObject, Scene } from '@univerjs/engine-render';
|
|
4
|
+
|
|
5
|
+
export declare function insertGroupObject(objectParam: IDrawingSearch, object: BaseObject, scene: Scene, drawingManagerService: IDrawingManagerService): void;
|
|
6
|
+
export declare function getCurrentUnitInfo(currentUniverService: IUniverInstanceService): {
|
|
7
|
+
unitId: string;
|
|
8
|
+
subUnitId: Nullable<string>;
|
|
9
|
+
} | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { getUpdateParams } from './utils/get-update-params';
|
|
17
|
+
export { ImageResetSizeOperation } from './commands/operations/image-reset-size.operation';
|
|
18
|
+
export { CloseImageCropOperation, OpenImageCropOperation } from './commands/operations/image-crop.operation';
|
|
19
|
+
export { DrawingCommonPanel } from './views/panel/DrawingCommonPanel';
|
|
20
|
+
export { ImagePopupMenu } from './views/image-popup-menu/ImagePopupMenu';
|
|
21
|
+
export { COMPONENT_IMAGE_POPUP_MENU } from './views/image-popup-menu/component-name';
|
|
22
|
+
export { UniverDrawingUIPlugin } from './plugin';
|
|
23
|
+
export { ImageCropperObject } from './views/crop/image-cropper-object';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
declare const locale: {
|
|
17
|
+
'image-popup': {
|
|
18
|
+
replace: string;
|
|
19
|
+
delete: string;
|
|
20
|
+
edit: string;
|
|
21
|
+
crop: string;
|
|
22
|
+
reset: string;
|
|
23
|
+
};
|
|
24
|
+
'image-cropper': {
|
|
25
|
+
error: string;
|
|
26
|
+
};
|
|
27
|
+
'image-panel': {
|
|
28
|
+
arrange: {
|
|
29
|
+
title: string;
|
|
30
|
+
forward: string;
|
|
31
|
+
backward: string;
|
|
32
|
+
front: string;
|
|
33
|
+
back: string;
|
|
34
|
+
};
|
|
35
|
+
transform: {
|
|
36
|
+
title: string;
|
|
37
|
+
rotate: string;
|
|
38
|
+
x: string;
|
|
39
|
+
y: string;
|
|
40
|
+
width: string;
|
|
41
|
+
height: string;
|
|
42
|
+
lock: string;
|
|
43
|
+
};
|
|
44
|
+
crop: {
|
|
45
|
+
title: string;
|
|
46
|
+
start: string;
|
|
47
|
+
mode: string;
|
|
48
|
+
};
|
|
49
|
+
group: {
|
|
50
|
+
title: string;
|
|
51
|
+
group: string;
|
|
52
|
+
reGroup: string;
|
|
53
|
+
unGroup: string;
|
|
54
|
+
};
|
|
55
|
+
align: {
|
|
56
|
+
title: string;
|
|
57
|
+
default: string;
|
|
58
|
+
left: string;
|
|
59
|
+
center: string;
|
|
60
|
+
right: string;
|
|
61
|
+
top: string;
|
|
62
|
+
middle: string;
|
|
63
|
+
bottom: string;
|
|
64
|
+
horizon: string;
|
|
65
|
+
vertical: string;
|
|
66
|
+
};
|
|
67
|
+
null: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export default locale;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LocaleService, Plugin } from '@univerjs/core';
|
|
2
|
+
import { Injector } from '@wendellhu/redi';
|
|
3
|
+
|
|
4
|
+
export declare class UniverDrawingUIPlugin extends Plugin {
|
|
5
|
+
protected _injector: Injector;
|
|
6
|
+
private readonly _localeService;
|
|
7
|
+
static pluginName: string;
|
|
8
|
+
constructor(config: undefined, _injector: Injector, _localeService: LocaleService);
|
|
9
|
+
onStarting(_injector: Injector): void;
|
|
10
|
+
private _initDependencies;
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MIN_DRAWING_WIDTH_LIMIT = 20;
|
|
17
|
+
export declare const MIN_DRAWING_HEIGHT_LIMIT = 20;
|
|
18
|
+
export declare const RANGE_DRAWING_ROTATION_LIMIT: number[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
2
|
+
import { IDrawingManagerService, IDrawingParam } from '@univerjs/drawing';
|
|
3
|
+
import { BaseObject } from '@univerjs/engine-render';
|
|
4
|
+
|
|
5
|
+
export declare function getUpdateParams(objects: Map<string, BaseObject>, drawingManagerService: IDrawingManagerService): Nullable<IDrawingParam>[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ISrcRect, ITransformState, Nullable, PresetGeometryType } from '@univerjs/core';
|
|
2
|
+
import { IShapeProps, IViewportInfo, UniverRenderingContext, Vector2, Shape } from '@univerjs/engine-render';
|
|
3
|
+
|
|
4
|
+
export interface IImageCropperObjectProps extends IShapeProps {
|
|
5
|
+
/**
|
|
6
|
+
* 20.1.8.55 srcRect (Source Rectangle)
|
|
7
|
+
*/
|
|
8
|
+
srcRect?: Nullable<ISrcRect>;
|
|
9
|
+
/**
|
|
10
|
+
* 20.1.9.18 prstGeom (Preset geometry)
|
|
11
|
+
*/
|
|
12
|
+
prstGeom?: Nullable<PresetGeometryType>;
|
|
13
|
+
applyTransform?: ITransformState;
|
|
14
|
+
dragPadding?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class ImageCropperObject<T extends IImageCropperObjectProps = IImageCropperObjectProps> extends Shape<T> {
|
|
17
|
+
private _srcRect;
|
|
18
|
+
private _prstGeom;
|
|
19
|
+
private _applyTransform;
|
|
20
|
+
private _dragPadding;
|
|
21
|
+
private _cacheCanvas;
|
|
22
|
+
constructor(key?: string, props?: T);
|
|
23
|
+
refreshSrcRect(value: Nullable<ISrcRect>, transform: Nullable<ITransformState>): void;
|
|
24
|
+
get srcRect(): Nullable<ISrcRect>;
|
|
25
|
+
dispose(): void;
|
|
26
|
+
isHit(coord: Vector2): boolean;
|
|
27
|
+
private _inSurround;
|
|
28
|
+
render(mainCtx: UniverRenderingContext, bounds?: IViewportInfo): this;
|
|
29
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
30
|
+
private _clipForApplyObject;
|
|
31
|
+
private _applyProps;
|
|
32
|
+
private _applyCache;
|
|
33
|
+
private _initialCacheCanvas;
|
|
34
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IDrawingSearch } from '@univerjs/core';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface IImagePopupMenuItem {
|
|
5
|
+
label: string;
|
|
6
|
+
index: number;
|
|
7
|
+
commandId: string;
|
|
8
|
+
commandParams?: IDrawingSearch[];
|
|
9
|
+
disable: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface IImagePopupMenuExtraProps {
|
|
12
|
+
menuItems: IImagePopupMenuItem[];
|
|
13
|
+
}
|
|
14
|
+
export interface IImagePopupMenuProps {
|
|
15
|
+
popup: {
|
|
16
|
+
extraProps?: IImagePopupMenuExtraProps;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare const ImagePopupMenu: React.FC<IImagePopupMenuProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const COMPONENT_IMAGE_POPUP_MENU = "COMPONENT_IMAGE_POPUP_MENU";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const COMPONENT_IMAGE_VIEWER = "COMPONENT_IMAGE_VIEWER";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IDrawingParam } from '@univerjs/core';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface IDrawingAlignProps {
|
|
5
|
+
drawings: IDrawingParam[];
|
|
6
|
+
alignShow: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const DrawingAlign: (props: IDrawingAlignProps) => React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IDrawingParam } from '@univerjs/drawing';
|
|
3
|
+
|
|
4
|
+
export interface IDrawingArrangeProps {
|
|
5
|
+
arrangeShow: boolean;
|
|
6
|
+
drawings: IDrawingParam[];
|
|
7
|
+
}
|
|
8
|
+
export declare const DrawingArrange: (props: IDrawingArrangeProps) => React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IDrawingParam } from '@univerjs/drawing';
|
|
3
|
+
|
|
4
|
+
export interface IDrawingCommonPanelProps {
|
|
5
|
+
drawings: IDrawingParam[];
|
|
6
|
+
hasArrange?: boolean;
|
|
7
|
+
hasTransform?: boolean;
|
|
8
|
+
hasAlign?: boolean;
|
|
9
|
+
hasCropper?: boolean;
|
|
10
|
+
hasGroup?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const DrawingCommonPanel: (props: IDrawingCommonPanelProps) => React.JSX.Element | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IDrawingParam } from '@univerjs/drawing';
|
|
3
|
+
|
|
4
|
+
export interface IDrawingGroupProps {
|
|
5
|
+
drawings: IDrawingParam[];
|
|
6
|
+
hasGroup: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const DrawingGroup: (props: IDrawingGroupProps) => React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IDrawingParam } from '@univerjs/drawing';
|
|
3
|
+
|
|
4
|
+
export interface IDrawingTransformProps {
|
|
5
|
+
transformShow: boolean;
|
|
6
|
+
drawings: IDrawingParam[];
|
|
7
|
+
}
|
|
8
|
+
export declare const DrawingTransform: (props: IDrawingTransformProps) => React.JSX.Element | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IDrawingParam } from '@univerjs/core';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface IImageCropperProps {
|
|
5
|
+
drawings: IDrawingParam[];
|
|
6
|
+
cropperShow: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const ImageCropper: (props: IImageCropperProps) => React.JSX.Element | undefined;
|