@univerjs/sheets-drawing-ui 0.2.2 → 0.2.4-alpha.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.
package/lib/index.css CHANGED
@@ -1 +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}
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-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}
@@ -27,5 +27,15 @@
27
27
  "invalidImageType": "Invalid image type",
28
28
  "exceedMaxCount": "Only {0} images can be uploaded at a time",
29
29
  "invalidImage": "Invalid image"
30
+ },
31
+ "sheet-drawing-view": "Drawing",
32
+ "shortcut": {
33
+ "sheet": {
34
+ "drawing-move-down": "Move Drawing down",
35
+ "drawing-move-up": "Move Drawing up",
36
+ "drawing-move-left": "Move Drawing left",
37
+ "drawing-move-right": "Move Drawing right",
38
+ "drawing-delete": "Delete Drawing"
39
+ }
30
40
  }
31
41
  }
@@ -27,5 +27,15 @@
27
27
  "invalidImageType": "Недопустимый тип изображения",
28
28
  "exceedMaxCount": "За один раз можно загрузить только {0} изображений",
29
29
  "invalidImage": "Недопустимое изображение"
30
+ },
31
+ "sheet-drawing-view": "Drawing",
32
+ "shortcut": {
33
+ "sheet": {
34
+ "drawing-move-down": "Move Drawing down",
35
+ "drawing-move-up": "Move Drawing up",
36
+ "drawing-move-left": "Move Drawing left",
37
+ "drawing-move-right": "Move Drawing right",
38
+ "drawing-delete": "Delete Drawing"
39
+ }
30
40
  }
31
41
  }
@@ -0,0 +1,41 @@
1
+ {
2
+ "sheetImage": {
3
+ "title": "Hình ảnh",
4
+ "upload": {
5
+ "float": "Hình ảnh nổi",
6
+ "cell": "Hình ảnh trong ô"
7
+ },
8
+ "panel": {
9
+ "title": "Chỉnh sửa hình ảnh"
10
+ }
11
+ },
12
+ "image-popup": {
13
+ "replace": "Thay thế",
14
+ "delete": "Xóa",
15
+ "edit": "Chỉnh sửa",
16
+ "crop": "Cắt",
17
+ "reset": "Đặt lại kích thước"
18
+ },
19
+ "drawing-anchor": {
20
+ "title": "Thuộc tính neo",
21
+ "both": "Di chuyển và thay đổi kích thước cùng với ô",
22
+ "position": "Di chuyển nhưng không thay đổi kích thước với ô",
23
+ "none": "Không di chuyển hoặc thay đổi kích thước với ô"
24
+ },
25
+ "update-status": {
26
+ "exceedMaxSize": "Kích thước hình ảnh vượt quá giới hạn, giới hạn là {0}M",
27
+ "invalidImageType": "Loại hình ảnh không hợp lệ",
28
+ "exceedMaxCount": "Chỉ có thể tải lên {0} hình ảnh một lần",
29
+ "invalidImage": "Hình ảnh không hợp lệ"
30
+ },
31
+ "sheet-drawing-view": "Drawing",
32
+ "shortcut": {
33
+ "sheet": {
34
+ "drawing-move-down": "Move Drawing down",
35
+ "drawing-move-up": "Move Drawing up",
36
+ "drawing-move-left": "Move Drawing left",
37
+ "drawing-move-right": "Move Drawing right",
38
+ "drawing-delete": "Delete Drawing"
39
+ }
40
+ }
41
+ }
@@ -27,5 +27,15 @@
27
27
  "invalidImageType": "图片类型错误",
28
28
  "exceedMaxCount": "图片只能一次上传{0}张",
29
29
  "invalidImage": "无效图片"
30
+ },
31
+ "sheet-drawing-view": "绘图",
32
+ "shortcut": {
33
+ "sheet": {
34
+ "drawing-move-down": "下移绘图",
35
+ "drawing-move-up": "上移绘图",
36
+ "drawing-move-left": "左移绘图",
37
+ "drawing-move-right": "下移绘图",
38
+ "drawing-delete": "删除绘图"
39
+ }
30
40
  }
31
41
  }
@@ -0,0 +1,41 @@
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
+ "sheet-drawing-view": "繪圖",
32
+ "shortcut": {
33
+ "sheet": {
34
+ "drawing-move-down": "下移繪圖",
35
+ "drawing-move-up": "上移繪圖",
36
+ "drawing-move-left": "左移繪圖",
37
+ "drawing-move-right": "下移繪圖",
38
+ "drawing-delete": "刪除繪圖"
39
+ }
40
+ }
41
+ }
@@ -1,7 +1,7 @@
1
1
  import { Nullable } from '@univerjs/core';
2
2
  import { ITransformState } from '@univerjs/drawing';
3
3
  import { ISheetDrawingPosition } from '@univerjs/sheets-drawing';
4
- import { ISelectionRenderService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
4
+ import { ISheetSelectionRenderService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
5
5
 
6
- export declare function drawingPositionToTransform(position: ISheetDrawingPosition, selectionRenderService: ISelectionRenderService, sheetSkeletonManagerService: SheetSkeletonManagerService): Nullable<ITransformState>;
7
- export declare function transformToDrawingPosition(transform: ITransformState, selectionRenderService: ISelectionRenderService): Nullable<ISheetDrawingPosition>;
6
+ export declare function drawingPositionToTransform(position: ISheetDrawingPosition, selectionRenderService: ISheetSelectionRenderService, sheetSkeletonManagerService: SheetSkeletonManagerService): Nullable<ITransformState>;
7
+ export declare function transformToDrawingPosition(transform: ITransformState, selectionRenderService: ISheetSelectionRenderService): Nullable<ISheetDrawingPosition>;
@@ -1,5 +1,4 @@
1
- import { IContextService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
2
- import { Injector } from '@wendellhu/redi';
1
+ import { IContextService, Injector, IUniverInstanceService, RxDisposable } from '@univerjs/core';
3
2
  import { IRenderManagerService } from '@univerjs/engine-render';
4
3
  import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
5
4
  import { IDrawingManagerService } from '@univerjs/drawing';
@@ -1,15 +1,14 @@
1
1
  import { Disposable } from '@univerjs/core';
2
- import { ISelectionRenderService, ISheetClipboardService } from '@univerjs/sheets-ui';
3
- import { Injector } from '@wendellhu/redi';
2
+ import { IRenderManagerService } from '@univerjs/engine-render';
4
3
  import { ISheetDrawingService } from '@univerjs/sheets-drawing';
4
+ import { ISheetClipboardService } from '@univerjs/sheets-ui';
5
5
 
6
6
  export declare class SheetsDrawingCopyPasteController extends Disposable {
7
7
  private _sheetClipboardService;
8
- private readonly _selectionRenderService;
8
+ private readonly _renderManagerService;
9
9
  private readonly _sheetDrawingService;
10
- private _injector;
11
10
  private _copyInfo;
12
- constructor(_sheetClipboardService: ISheetClipboardService, _selectionRenderService: ISelectionRenderService, _sheetDrawingService: ISheetDrawingService, _injector: Injector);
11
+ constructor(_sheetClipboardService: ISheetClipboardService, _renderManagerService: IRenderManagerService, _sheetDrawingService: ISheetDrawingService);
13
12
  private _initCopyPaste;
14
13
  private _collect;
15
14
  private _generateMutations;
@@ -1,20 +1,19 @@
1
- import { Workbook, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
- import { ISelectionRenderService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
1
+ import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
3
2
  import { IDrawingManagerService } from '@univerjs/drawing';
4
3
  import { SheetInterceptorService } from '@univerjs/sheets';
5
4
  import { ISheetDrawingService } from '@univerjs/sheets-drawing';
6
- import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
5
+ import { IRenderManagerService } from '@univerjs/engine-render';
7
6
 
8
- export declare class SheetDrawingTransformAffectedController extends Disposable implements IRenderModule {
9
- private readonly _context;
7
+ export declare class SheetDrawingTransformAffectedController extends Disposable {
10
8
  private readonly _commandService;
11
9
  private readonly _sheetInterceptorService;
10
+ private readonly _renderManagerService;
12
11
  private readonly _sheetDrawingService;
13
12
  private readonly _drawingManagerService;
14
- private readonly _selectionRenderService;
15
13
  private readonly _univerInstanceService;
16
- private readonly _sheetSkeletonManagerService;
17
- constructor(_context: IRenderContext<Workbook>, _commandService: ICommandService, _sheetInterceptorService: SheetInterceptorService, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _selectionRenderService: ISelectionRenderService, _univerInstanceService: IUniverInstanceService, _sheetSkeletonManagerService: SheetSkeletonManagerService);
14
+ private get _selectionRenderService();
15
+ private get _skeletonManagerService();
16
+ constructor(_commandService: ICommandService, _sheetInterceptorService: SheetInterceptorService, _renderManagerService: IRenderManagerService, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _univerInstanceService: IUniverInstanceService);
18
17
  private _init;
19
18
  private _sheetInterceptorListener;
20
19
  private _getRangeMoveUndo;
@@ -26,7 +25,6 @@ export declare class SheetDrawingTransformAffectedController extends Disposable
26
25
  private _getDrawingUndoForRowAndColSize;
27
26
  private _getUnitIdAndSubUnitId;
28
27
  private _moveRowInterceptor;
29
- private _moveRangeInterceptor;
30
28
  private _moveColInterceptor;
31
29
  private _expandCol;
32
30
  private _shrinkCol;
@@ -1,17 +1,14 @@
1
- import { Workbook, Disposable, ICommandService, IContextService, IUniverInstanceService, LocaleService } from '@univerjs/core';
1
+ import { Disposable, ICommandService, IContextService, IUniverInstanceService, LocaleService } from '@univerjs/core';
2
2
  import { IDrawingManagerService, IImageIoService } from '@univerjs/drawing';
3
3
  import { ISheetDrawingService } from '@univerjs/sheets-drawing';
4
- import { SelectionManagerService } from '@univerjs/sheets';
5
- import { ISelectionRenderService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
4
+ import { SheetsSelectionsService } from '@univerjs/sheets';
6
5
  import { IMessageService } from '@univerjs/ui';
7
- import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
6
+ import { IRenderManagerService } from '@univerjs/engine-render';
8
7
 
9
- export declare class SheetDrawingUpdateController extends Disposable implements IRenderModule {
10
- private readonly _context;
8
+ export declare class SheetDrawingUpdateController extends Disposable {
11
9
  private readonly _commandService;
12
10
  private readonly _univerInstanceService;
13
11
  private readonly _selectionManagerService;
14
- private readonly _selectionRenderService;
15
12
  private readonly _imageIoService;
16
13
  private readonly _sheetDrawingService;
17
14
  private readonly _drawingManagerService;
@@ -19,8 +16,9 @@ export declare class SheetDrawingUpdateController extends Disposable implements
19
16
  private readonly _messageService;
20
17
  private readonly _localeService;
21
18
  private readonly _renderManagerService;
22
- private readonly _sheetSkeletonManagerService;
23
- constructor(_context: IRenderContext<Workbook>, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _selectionManagerService: SelectionManagerService, _selectionRenderService: ISelectionRenderService, _imageIoService: IImageIoService, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _contextService: IContextService, _messageService: IMessageService, _localeService: LocaleService, _renderManagerService: IRenderManagerService, _sheetSkeletonManagerService: SheetSkeletonManagerService);
19
+ private get _selectionRenderService();
20
+ private get _skeletonManagerService();
21
+ constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _selectionManagerService: SheetsSelectionsService, _imageIoService: IImageIoService, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _contextService: IContextService, _messageService: IMessageService, _localeService: LocaleService, _renderManagerService: IRenderManagerService);
24
22
  private _init;
25
23
  /**
26
24
  * Upload image to cell or float image
@@ -1,6 +1,5 @@
1
- import { DependencyOverride, Disposable, ICommandService } from '@univerjs/core';
1
+ import { DependencyOverride, Disposable, ICommandService, Injector } from '@univerjs/core';
2
2
  import { MenuConfig, ComponentManager, IMenuService, IShortcutService } from '@univerjs/ui';
3
- import { Injector } from '@wendellhu/redi';
4
3
 
5
4
  export interface IUniverSheetsDrawingConfig {
6
5
  menu?: MenuConfig;
@@ -0,0 +1,4 @@
1
+ import { default as zhCN } from './zh-CN';
2
+
3
+ declare const locale: typeof zhCN;
4
+ export default locale;
@@ -43,5 +43,15 @@ declare const locale: {
43
43
  exceedMaxCount: string;
44
44
  invalidImage: string;
45
45
  };
46
+ 'sheet-drawing-view': string;
47
+ shortcut: {
48
+ sheet: {
49
+ 'drawing-move-down': string;
50
+ 'drawing-move-up': string;
51
+ 'drawing-move-left': string;
52
+ 'drawing-move-right': string;
53
+ 'drawing-delete': string;
54
+ };
55
+ };
46
56
  };
47
57
  export default locale;
@@ -0,0 +1,4 @@
1
+ import { default as zhCN } from './zh-CN';
2
+
3
+ declare const locale: typeof zhCN;
4
+ export default locale;
@@ -1,5 +1,4 @@
1
- import { LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';
2
- import { Injector } from '@wendellhu/redi';
1
+ import { Injector, LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';
3
2
  import { IRenderManagerService } from '@univerjs/engine-render';
4
3
  import { IUniverSheetsDrawingConfig } from './controllers/sheet-drawing.controller';
5
4
 
@@ -12,5 +11,7 @@ export declare class UniverSheetsDrawingUIPlugin extends Plugin {
12
11
  private _pluginConfig;
13
12
  constructor(config: Partial<IUniverSheetsDrawingConfig> | undefined, _injector: Injector, _localeService: LocaleService, _renderManagerService: IRenderManagerService);
14
13
  onStarting(_injector: Injector): void;
14
+ onRendered(): void;
15
15
  private _initDependencies;
16
+ private _registerRenderModules;
16
17
  }
@@ -1,8 +1,7 @@
1
- import { IPosition, ITransformState, Worksheet, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
1
+ import { IDisposable, IPosition, ITransformState, Worksheet, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { IDrawingManagerService } from '@univerjs/drawing';
3
3
  import { IBoundRectNoAngle, Scene, SpreadsheetSkeleton, IRenderManagerService } from '@univerjs/engine-render';
4
4
  import { ISheetDrawingService } from '@univerjs/sheets-drawing';
5
- import { ISelectionRenderService } from '@univerjs/sheets-ui';
6
5
  import { CanvasFloatDomService } from '@univerjs/ui';
7
6
 
8
7
  export interface ICanvasFloatDom {
@@ -23,12 +22,14 @@ export declare function transformBound2DOMBound(originBound: IBoundRectNoAngle,
23
22
  right: number;
24
23
  bottom: number;
25
24
  };
25
+ export interface ISheetCanvasFloatDomHook {
26
+ onGetFloatDomProps: (id: string) => Record<string, any>;
27
+ }
26
28
  export declare class SheetCanvasFloatDomManagerService extends Disposable {
27
29
  private _renderManagerService;
28
30
  private _univerInstanceService;
29
31
  private _commandService;
30
32
  private _drawingManagerService;
31
- private readonly _selectionRenderService;
32
33
  private readonly _canvasFloatDomService;
33
34
  private readonly _sheetDrawingService;
34
35
  private _domLayerMap;
@@ -44,9 +45,11 @@ export declare class SheetCanvasFloatDomManagerService extends Disposable {
44
45
  subUnitId: string;
45
46
  id: string;
46
47
  }>;
47
- constructor(_renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _selectionRenderService: ISelectionRenderService, _canvasFloatDomService: CanvasFloatDomService, _sheetDrawingService: ISheetDrawingService);
48
+ private _hooks;
49
+ constructor(_renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _canvasFloatDomService: CanvasFloatDomService, _sheetDrawingService: ISheetDrawingService);
48
50
  private _ensureMap;
49
51
  private _getSceneAndTransformerByDrawingSearch;
52
+ private _getFloatDomProps;
50
53
  private _drawingAddListener;
51
54
  private _scrollUpdateListener;
52
55
  private _getPosition;
@@ -57,4 +60,5 @@ export declare class SheetCanvasFloatDomManagerService extends Disposable {
57
60
  dispose: () => void;
58
61
  } | undefined;
59
62
  private _removeDom;
63
+ addHook(hook: ISheetCanvasFloatDomHook): IDisposable;
60
64
  }
@@ -1,5 +1,5 @@
1
1
  import { IMenuItem } from '@univerjs/ui';
2
- import { IAccessor } from '@wendellhu/redi';
2
+ import { IAccessor } from '@univerjs/core';
3
3
 
4
4
  export declare const IMAGE_UPLOAD_ICON = "addition-and-subtraction-single";
5
5
  export declare function ImageMenuFactory(accessor: IAccessor): IMenuItem;