@univerjs/sheets-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 +2054 -0
- package/lib/index.css +1 -0
- package/lib/locale/en-US.json +31 -0
- package/lib/locale/ru-RU.json +31 -0
- package/lib/locale/zh-CN.json +31 -0
- package/lib/types/basics/transform-position.d.ts +6 -0
- package/lib/types/commands/commands/delete-drawings.command.d.ts +3 -0
- package/lib/types/commands/commands/group-sheet-drawing.command.d.ts +6 -0
- package/lib/types/commands/commands/insert-sheet-drawing.command.d.ts +6 -0
- package/lib/types/commands/commands/interfaces.d.ts +21 -0
- package/lib/types/commands/commands/move-drawings.command.d.ts +6 -0
- package/lib/types/commands/commands/remove-sheet-drawing.command.d.ts +6 -0
- package/lib/types/commands/commands/set-drawing-arrange.command.d.ts +10 -0
- package/lib/types/commands/commands/set-sheet-drawing.command.d.ts +6 -0
- package/lib/types/commands/commands/ungroup-sheet-drawing.command.d.ts +6 -0
- package/lib/types/commands/commands/utils.d.ts +4 -0
- package/lib/types/commands/operations/clear-drawing-transformer.operation.d.ts +3 -0
- package/lib/types/commands/operations/edit-sheet-drawing.operation.d.ts +4 -0
- package/lib/types/commands/operations/insert-image.operation.d.ts +7 -0
- package/lib/types/commands/operations/open-drawing-panel.operation.d.ts +6 -0
- package/lib/types/controllers/drawing-popup-menu.controller.d.ts +24 -0
- package/lib/types/controllers/sheet-drawing-transform-affected.controller.d.ts +34 -0
- package/lib/types/controllers/sheet-drawing-update.controller.d.ts +35 -0
- package/lib/types/controllers/sheet-drawing.controller.d.ts +23 -0
- package/lib/types/controllers/shortcuts/drawing.shortcut.d.ts +10 -0
- package/lib/types/index.d.ts +17 -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 +47 -0
- package/lib/types/plugin.d.ts +14 -0
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +60 -0
- package/lib/types/views/menu/image.menu.d.ts +7 -0
- package/lib/types/views/sheet-image-panel/SheetDrawingAnchor.d.ts +7 -0
- package/lib/types/views/sheet-image-panel/SheetDrawingPanel.d.ts +3 -0
- package/lib/types/views/sheet-image-panel/component-name.d.ts +16 -0
- package/lib/types/views/upload-component/UploadFile.d.ts +9 -0
- package/lib/types/views/upload-component/component-name.d.ts +20 -0
- package/lib/types/views/upload-loading/UploadLoading.d.ts +3 -0
- package/lib/umd/index.js +1 -0
- package/package.json +99 -0
package/lib/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.univer-upload-loading{position:absolute;height:100%;width:100%;text-align:center;background-color:rgba(var(--color-black),.5);z-index:1000;user-select:none}.univer-upload-loading-body{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background-color:rgb(var(--color-white));padding:20px 40px;display:flex;align-items:center;justify-items:center;border-radius:var(--border-radius-lg)}.univer-upload-loading-body-animation{width:30px;height:30px;border:2px solid rgb(var(--color-black));border-top-color:transparent;border-radius:100%;animation:univer-UniverCircleAnimation infinite .75s linear}.univer-upload-loading-body-text{font-size:var(--font-size-xs);color:var(--color-black);padding:10px}@keyframes univer-UniverCircleAnimation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.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}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sheetImage": {
|
|
3
|
+
"title": "Image",
|
|
4
|
+
"upload": {
|
|
5
|
+
"float": "Float Image",
|
|
6
|
+
"cell": "Cell Image"
|
|
7
|
+
},
|
|
8
|
+
"panel": {
|
|
9
|
+
"title": "Edit Image"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"image-popup": {
|
|
13
|
+
"replace": "Replace",
|
|
14
|
+
"delete": "Delete",
|
|
15
|
+
"edit": "Edit",
|
|
16
|
+
"crop": "Crop",
|
|
17
|
+
"reset": "Reset Size"
|
|
18
|
+
},
|
|
19
|
+
"drawing-anchor": {
|
|
20
|
+
"title": "Anchor Properties",
|
|
21
|
+
"both": "Move and size with cells",
|
|
22
|
+
"position": "Move but don't size with cells",
|
|
23
|
+
"none": "Don't move or size with cells"
|
|
24
|
+
},
|
|
25
|
+
"update-status": {
|
|
26
|
+
"exceedMaxSize": "Image size exceeds limit, limit is {0}M",
|
|
27
|
+
"invalidImageType": "Invalid image type",
|
|
28
|
+
"exceedMaxCount": "Only {0} images can be uploaded at a time",
|
|
29
|
+
"invalidImage": "Invalid image"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sheetImage": {
|
|
3
|
+
"title": "Изображение",
|
|
4
|
+
"upload": {
|
|
5
|
+
"float": "Плавающее изображение",
|
|
6
|
+
"cell": "Изображение в ячейке"
|
|
7
|
+
},
|
|
8
|
+
"panel": {
|
|
9
|
+
"title": "Редактировать изображение"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"image-popup": {
|
|
13
|
+
"replace": "Заменить",
|
|
14
|
+
"delete": "Удалить",
|
|
15
|
+
"edit": "Редактировать",
|
|
16
|
+
"crop": "Обрезать",
|
|
17
|
+
"reset": "Сбросить размер"
|
|
18
|
+
},
|
|
19
|
+
"drawing-anchor": {
|
|
20
|
+
"title": "Свойства привязки",
|
|
21
|
+
"both": "Перемещать и изменять размер с ячейками",
|
|
22
|
+
"position": "Перемещать, но не изменять размер с ячейками",
|
|
23
|
+
"none": "Не перемещать и не изменять размер с ячейками"
|
|
24
|
+
},
|
|
25
|
+
"update-status": {
|
|
26
|
+
"exceedMaxSize": "Размер изображения превышает лимит, лимит составляет {0}М",
|
|
27
|
+
"invalidImageType": "Недопустимый тип изображения",
|
|
28
|
+
"exceedMaxCount": "За один раз можно загрузить только {0} изображений",
|
|
29
|
+
"invalidImage": "Недопустимое изображение"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sheetImage": {
|
|
3
|
+
"title": "图片",
|
|
4
|
+
"upload": {
|
|
5
|
+
"float": "浮动图片",
|
|
6
|
+
"cell": "单元格图片"
|
|
7
|
+
},
|
|
8
|
+
"panel": {
|
|
9
|
+
"title": "编辑图片"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"image-popup": {
|
|
13
|
+
"replace": "替换",
|
|
14
|
+
"delete": "删除",
|
|
15
|
+
"edit": "编辑",
|
|
16
|
+
"crop": "裁剪",
|
|
17
|
+
"reset": "重置大小"
|
|
18
|
+
},
|
|
19
|
+
"drawing-anchor": {
|
|
20
|
+
"title": "锚点属性",
|
|
21
|
+
"both": "与单元格一起移动和调整大小",
|
|
22
|
+
"position": "移动但不调整大小与单元格",
|
|
23
|
+
"none": "不要移动或调整大小与单元格"
|
|
24
|
+
},
|
|
25
|
+
"update-status": {
|
|
26
|
+
"exceedMaxSize": "图片大小超过限制, 限制为{0}M",
|
|
27
|
+
"invalidImageType": "图片类型错误",
|
|
28
|
+
"exceedMaxCount": "图片只能一次上传{0}张",
|
|
29
|
+
"invalidImage": "无效图片"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ITransformState, Nullable } from '@univerjs/core';
|
|
2
|
+
import { ISheetDrawingPosition } from '@univerjs/sheets-drawing';
|
|
3
|
+
import { ISelectionRenderService } from '@univerjs/sheets-ui';
|
|
4
|
+
|
|
5
|
+
export declare function drawingPositionToTransform(position: ISheetDrawingPosition, selectionRenderService: ISelectionRenderService): Nullable<ITransformState>;
|
|
6
|
+
export declare function transformToDrawingPosition(transform: ITransformState, selectionRenderService: ISelectionRenderService): Nullable<ISheetDrawingPosition>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DrawingTypeEnum } from '@univerjs/core';
|
|
2
|
+
import { ISheetDrawing } from '@univerjs/sheets-drawing';
|
|
3
|
+
|
|
4
|
+
export interface IInsertDrawingCommandParams {
|
|
5
|
+
unitId: string;
|
|
6
|
+
drawings: ISheetDrawing[];
|
|
7
|
+
}
|
|
8
|
+
export interface IDeleteDrawingCommandParam {
|
|
9
|
+
unitId: string;
|
|
10
|
+
subUnitId: string;
|
|
11
|
+
drawingId: string;
|
|
12
|
+
drawingType: DrawingTypeEnum;
|
|
13
|
+
}
|
|
14
|
+
export interface IDeleteDrawingCommandParams {
|
|
15
|
+
unitId: string;
|
|
16
|
+
drawings: IDeleteDrawingCommandParam[];
|
|
17
|
+
}
|
|
18
|
+
export interface ISetDrawingCommandParams {
|
|
19
|
+
unitId: string;
|
|
20
|
+
drawings: Partial<ISheetDrawing>[];
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
import { IDrawingOrderMapParam, ArrangeTypeEnum } from '@univerjs/drawing';
|
|
3
|
+
|
|
4
|
+
export interface ISetDrawingArrangeCommandParams extends IDrawingOrderMapParam {
|
|
5
|
+
arrangeType: ArrangeTypeEnum;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The command to insert new defined name
|
|
9
|
+
*/
|
|
10
|
+
export declare const SetDrawingArrangeCommand: ICommand;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IDrawingGroupUpdateParam } from '@univerjs/drawing';
|
|
2
|
+
|
|
3
|
+
export declare function ungroupToGroup(ungroupParams: IDrawingGroupUpdateParam[]): IDrawingGroupUpdateParam[];
|
|
4
|
+
export declare function groupToUngroup(groupParams: IDrawingGroupUpdateParam[]): IDrawingGroupUpdateParam[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IOperation, Nullable } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export interface IInsertImageOperationParams {
|
|
4
|
+
files: Nullable<File[]>;
|
|
5
|
+
}
|
|
6
|
+
export declare const InsertFloatImageOperation: IOperation<IInsertImageOperationParams>;
|
|
7
|
+
export declare const InsertCellImageOperation: IOperation<IInsertImageOperationParams>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IContextService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
2
|
+
import { Injector } from '@wendellhu/redi';
|
|
3
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
|
+
import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
|
|
5
|
+
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
6
|
+
import { IUIPartsService } from '@univerjs/ui';
|
|
7
|
+
|
|
8
|
+
export declare class DrawingPopupMenuController extends RxDisposable {
|
|
9
|
+
private _injector;
|
|
10
|
+
private readonly _drawingManagerService;
|
|
11
|
+
private readonly _canvasPopManagerService;
|
|
12
|
+
private readonly _renderManagerService;
|
|
13
|
+
private readonly _univerInstanceService;
|
|
14
|
+
private readonly _contextService;
|
|
15
|
+
private readonly _uiPartsService;
|
|
16
|
+
private _initImagePopupMenu;
|
|
17
|
+
constructor(_injector: Injector, _drawingManagerService: IDrawingManagerService, _canvasPopManagerService: SheetCanvasPopManagerService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _contextService: IContextService, _uiPartsService: IUIPartsService);
|
|
18
|
+
private _init;
|
|
19
|
+
private _dispose;
|
|
20
|
+
private _create;
|
|
21
|
+
private _hasCropObject;
|
|
22
|
+
private _popupMenuListener;
|
|
23
|
+
private _getImageMenuItems;
|
|
24
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { ISelectionRenderService } from '@univerjs/sheets-ui';
|
|
3
|
+
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
4
|
+
import { SheetInterceptorService } from '@univerjs/sheets';
|
|
5
|
+
import { ISheetDrawingService } from '@univerjs/sheets-drawing';
|
|
6
|
+
|
|
7
|
+
export declare class SheetDrawingTransformAffectedController extends Disposable {
|
|
8
|
+
private readonly _commandService;
|
|
9
|
+
private readonly _sheetInterceptorService;
|
|
10
|
+
private readonly _sheetDrawingService;
|
|
11
|
+
private readonly _drawingManagerService;
|
|
12
|
+
private readonly _selectionRenderService;
|
|
13
|
+
private readonly _univerInstanceService;
|
|
14
|
+
constructor(_commandService: ICommandService, _sheetInterceptorService: SheetInterceptorService, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _selectionRenderService: ISelectionRenderService, _univerInstanceService: IUniverInstanceService);
|
|
15
|
+
private _init;
|
|
16
|
+
private _sheetInterceptorListener;
|
|
17
|
+
private _getRangeMoveUndo;
|
|
18
|
+
private _getUpdateOrDeleteDrawings;
|
|
19
|
+
private _remainDrawingSize;
|
|
20
|
+
private _getDrawingUndoForColVisible;
|
|
21
|
+
private _createUndoAndRedoMutation;
|
|
22
|
+
private _getDrawingUndoForRowVisible;
|
|
23
|
+
private _getDrawingUndoForRowAndColSize;
|
|
24
|
+
private _getUnitIdAndSubUnitId;
|
|
25
|
+
private _moveRowInterceptor;
|
|
26
|
+
private _moveColInterceptor;
|
|
27
|
+
private _expandCol;
|
|
28
|
+
private _shrinkCol;
|
|
29
|
+
private _expandRow;
|
|
30
|
+
private _shrinkRow;
|
|
31
|
+
private _commandListener;
|
|
32
|
+
private _sheetRefreshListener;
|
|
33
|
+
private _refreshDrawingTransform;
|
|
34
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Disposable, ICommandService, IContextService, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
2
|
+
import { IDrawingManagerService, IImageIoService } from '@univerjs/drawing';
|
|
3
|
+
import { ISheetDrawingService } from '@univerjs/sheets-drawing';
|
|
4
|
+
import { SelectionManagerService } from '@univerjs/sheets';
|
|
5
|
+
import { ISelectionRenderService } from '@univerjs/sheets-ui';
|
|
6
|
+
import { IMessageService } from '@univerjs/ui';
|
|
7
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
8
|
+
|
|
9
|
+
export declare class SheetDrawingUpdateController extends Disposable {
|
|
10
|
+
private readonly _commandService;
|
|
11
|
+
private readonly _univerInstanceService;
|
|
12
|
+
private readonly _selectionManagerService;
|
|
13
|
+
private readonly _selectionRenderService;
|
|
14
|
+
private readonly _imageIoService;
|
|
15
|
+
private readonly _sheetDrawingService;
|
|
16
|
+
private readonly _drawingManagerService;
|
|
17
|
+
private readonly _contextService;
|
|
18
|
+
private readonly _messageService;
|
|
19
|
+
private readonly _localeService;
|
|
20
|
+
private readonly _renderManagerService;
|
|
21
|
+
constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _selectionManagerService: SelectionManagerService, _selectionRenderService: ISelectionRenderService, _imageIoService: IImageIoService, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _contextService: IContextService, _messageService: IMessageService, _localeService: LocaleService, _renderManagerService: IRenderManagerService);
|
|
22
|
+
private _init;
|
|
23
|
+
/**
|
|
24
|
+
* Upload image to cell or float image
|
|
25
|
+
*/
|
|
26
|
+
private _initCommandListeners;
|
|
27
|
+
private _insertCellImage;
|
|
28
|
+
private _insertFloatImage;
|
|
29
|
+
private _getUnitInfo;
|
|
30
|
+
private _getImagePosition;
|
|
31
|
+
private _updateOrderListener;
|
|
32
|
+
private _updateImageListener;
|
|
33
|
+
private _groupDrawingListener;
|
|
34
|
+
private _focusDrawingListener;
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DependencyOverride, Disposable, ICommandService } from '@univerjs/core';
|
|
2
|
+
import { MenuConfig, ComponentManager, IMenuService, IShortcutService } from '@univerjs/ui';
|
|
3
|
+
import { Injector } from '@wendellhu/redi';
|
|
4
|
+
|
|
5
|
+
export interface IUniverSheetsDrawingConfig {
|
|
6
|
+
menu?: MenuConfig;
|
|
7
|
+
overrides?: DependencyOverride;
|
|
8
|
+
}
|
|
9
|
+
export declare const DefaultSheetsDrawingConfig: IUniverSheetsDrawingConfig;
|
|
10
|
+
export declare class SheetDrawingUIController extends Disposable {
|
|
11
|
+
private readonly _config;
|
|
12
|
+
private readonly _injector;
|
|
13
|
+
private readonly _componentManager;
|
|
14
|
+
private readonly _menuService;
|
|
15
|
+
private readonly _commandService;
|
|
16
|
+
private readonly _shortcutService;
|
|
17
|
+
constructor(_config: Partial<IUniverSheetsDrawingConfig>, _injector: Injector, _componentManager: ComponentManager, _menuService: IMenuService, _commandService: ICommandService, _shortcutService: IShortcutService);
|
|
18
|
+
private _initCustomComponents;
|
|
19
|
+
private _initMenus;
|
|
20
|
+
private _initCommands;
|
|
21
|
+
private _initShortcuts;
|
|
22
|
+
private _init;
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IContextService } from '@univerjs/core';
|
|
2
|
+
import { IShortcutItem } from '@univerjs/ui';
|
|
3
|
+
import { IMoveDrawingsCommandParams } from '../../commands/commands/move-drawings.command';
|
|
4
|
+
|
|
5
|
+
export declare function whenSheetDrawingFocused(contextService: IContextService): boolean;
|
|
6
|
+
export declare const MoveDrawingDownShortcutItem: IShortcutItem<IMoveDrawingsCommandParams>;
|
|
7
|
+
export declare const MoveDrawingUpShortcutItem: IShortcutItem<IMoveDrawingsCommandParams>;
|
|
8
|
+
export declare const MoveDrawingLeftShortcutItem: IShortcutItem<IMoveDrawingsCommandParams>;
|
|
9
|
+
export declare const MoveDrawingRightShortcutItem: IShortcutItem<IMoveDrawingsCommandParams>;
|
|
10
|
+
export declare const DeleteDrawingsShortcutItem: IShortcutItem;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { UniverSheetsDrawingUIPlugin } from './plugin';
|
|
17
|
+
export { SheetCanvasFloatDomManagerService, type ICanvasFloatDom } from './services/canvas-float-dom-manager.service';
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
sheetImage: {
|
|
18
|
+
title: string;
|
|
19
|
+
upload: {
|
|
20
|
+
float: string;
|
|
21
|
+
cell: string;
|
|
22
|
+
};
|
|
23
|
+
panel: {
|
|
24
|
+
title: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
'image-popup': {
|
|
28
|
+
replace: string;
|
|
29
|
+
delete: string;
|
|
30
|
+
edit: string;
|
|
31
|
+
crop: string;
|
|
32
|
+
reset: string;
|
|
33
|
+
};
|
|
34
|
+
'drawing-anchor': {
|
|
35
|
+
title: string;
|
|
36
|
+
both: string;
|
|
37
|
+
position: string;
|
|
38
|
+
none: string;
|
|
39
|
+
};
|
|
40
|
+
'update-status': {
|
|
41
|
+
exceedMaxSize: string;
|
|
42
|
+
invalidImageType: string;
|
|
43
|
+
exceedMaxCount: string;
|
|
44
|
+
invalidImage: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export default locale;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
+
import { Injector } from '@wendellhu/redi';
|
|
3
|
+
import { IUniverSheetsDrawingConfig } from './controllers/sheet-drawing.controller';
|
|
4
|
+
|
|
5
|
+
export declare class UniverSheetsDrawingUIPlugin extends Plugin {
|
|
6
|
+
protected _injector: Injector;
|
|
7
|
+
private readonly _localeService;
|
|
8
|
+
static type: UniverInstanceType;
|
|
9
|
+
static pluginName: string;
|
|
10
|
+
private _pluginConfig;
|
|
11
|
+
constructor(config: Partial<IUniverSheetsDrawingConfig> | undefined, _injector: Injector, _localeService: LocaleService);
|
|
12
|
+
onStarting(_injector: Injector): void;
|
|
13
|
+
private _initDependencies;
|
|
14
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IPosition, ITransformState, Worksheet, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { IBoundRectNoAngle, Scene, SpreadsheetSkeleton, IRenderManagerService } from '@univerjs/engine-render';
|
|
3
|
+
import { CanvasFloatDomService } from '@univerjs/ui';
|
|
4
|
+
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
5
|
+
import { ISelectionRenderService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
|
6
|
+
import { ISheetDrawingService } from '@univerjs/sheets-drawing';
|
|
7
|
+
|
|
8
|
+
export interface ICanvasFloatDom {
|
|
9
|
+
allowTransform: boolean;
|
|
10
|
+
initPosition: IPosition;
|
|
11
|
+
componentKey: string;
|
|
12
|
+
unitId?: string;
|
|
13
|
+
subUnitId?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function transformBound2DOMBound(originBound: IBoundRectNoAngle, scene: Scene, skeleton: SpreadsheetSkeleton, worksheet: Worksheet): {
|
|
16
|
+
absolute: {
|
|
17
|
+
left: boolean;
|
|
18
|
+
top: boolean;
|
|
19
|
+
};
|
|
20
|
+
left: number;
|
|
21
|
+
top: number;
|
|
22
|
+
right: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
};
|
|
25
|
+
export declare class SheetCanvasFloatDomManagerService extends Disposable {
|
|
26
|
+
private _renderManagerService;
|
|
27
|
+
private _univerInstanceService;
|
|
28
|
+
private _sheetSkeletonManagerService;
|
|
29
|
+
private _commandService;
|
|
30
|
+
private _drawingManagerService;
|
|
31
|
+
private readonly _selectionRenderService;
|
|
32
|
+
private readonly _canvasFloatDomService;
|
|
33
|
+
private readonly _sheetDrawingService;
|
|
34
|
+
private _domLayerMap;
|
|
35
|
+
private _domLayerInfoMap;
|
|
36
|
+
private _transformChange$;
|
|
37
|
+
transformChange$: import('rxjs').Observable<{
|
|
38
|
+
id: string;
|
|
39
|
+
value: ITransformState;
|
|
40
|
+
}>;
|
|
41
|
+
private _remove$;
|
|
42
|
+
remove$: import('rxjs').Observable<{
|
|
43
|
+
unitId: string;
|
|
44
|
+
subUnitId: string;
|
|
45
|
+
id: string;
|
|
46
|
+
}>;
|
|
47
|
+
constructor(_renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _selectionRenderService: ISelectionRenderService, _canvasFloatDomService: CanvasFloatDomService, _sheetDrawingService: ISheetDrawingService);
|
|
48
|
+
private _ensureMap;
|
|
49
|
+
private _getSceneAndTransformerByDrawingSearch;
|
|
50
|
+
private _drawingAddListener;
|
|
51
|
+
private _scrollUpdateListener;
|
|
52
|
+
private _getPosition;
|
|
53
|
+
private _featureUpdateListener;
|
|
54
|
+
private _deleteListener;
|
|
55
|
+
addFloatDomToPosition(layer: ICanvasFloatDom): {
|
|
56
|
+
id: string;
|
|
57
|
+
dispose: () => void;
|
|
58
|
+
} | undefined;
|
|
59
|
+
private _removeDom;
|
|
60
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IMenuItem } from '@univerjs/ui';
|
|
2
|
+
import { IAccessor } from '@wendellhu/redi';
|
|
3
|
+
|
|
4
|
+
export declare const IMAGE_UPLOAD_ICON = "addition-and-subtraction-single";
|
|
5
|
+
export declare function ImageMenuFactory(accessor: IAccessor): IMenuItem;
|
|
6
|
+
export declare function UploadFloatImageMenuFactory(_accessor: IAccessor): IMenuItem;
|
|
7
|
+
export declare function UploadCellImageMenuFactory(_accessor: IAccessor): IMenuItem;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IDrawingParam } from '@univerjs/drawing';
|
|
3
|
+
|
|
4
|
+
export interface ISheetDrawingAnchorProps {
|
|
5
|
+
drawings: IDrawingParam[];
|
|
6
|
+
}
|
|
7
|
+
export declare const SheetDrawingAnchor: (props: ISheetDrawingAnchorProps) => React.JSX.Element | undefined;
|
|
@@ -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_SHEET_DRAWING_PANEL = "COMPONENT_SHEET_DRAWING_PANEL";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { ICustomComponentProps } from '@univerjs/ui';
|
|
4
|
+
import { UploadFileType } from './component-name';
|
|
5
|
+
|
|
6
|
+
export interface IUploadFileProps extends ICustomComponentProps<Nullable<File>> {
|
|
7
|
+
type: UploadFileType;
|
|
8
|
+
}
|
|
9
|
+
export declare const UploadFileMenu: (props: IUploadFileProps) => React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
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_UPLOAD_FILE_MENU = "COMPONENT_UPLOAD_FILE_MENU";
|
|
17
|
+
export declare enum UploadFileType {
|
|
18
|
+
cellImage = 0,
|
|
19
|
+
floatImage = 1
|
|
20
|
+
}
|