@univerjs/docs-drawing-ui 1.0.0-alpha.2 → 1.0.0-alpha.4

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.
@@ -13,25 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { ICommand, IDocDrawingBase, IDocDrawingPosition, IObjectPositionH, IObjectPositionV, ISize } from '@univerjs/core';
17
- import type { IDocumentSkeletonDrawing, IDocumentSkeletonHeaderFooter, IDocumentSkeletonPage } from '@univerjs/engine-render';
18
- export declare enum TextWrappingStyle {
19
- INLINE = "inline",
20
- BEHIND_TEXT = "behindText",
21
- IN_FRONT_OF_TEXT = "inFrontOfText",
22
- WRAP_SQUARE = "wrapSquare",
23
- WRAP_TOP_AND_BOTTOM = "wrapTopAndBottom"
24
- }
25
- interface IDrawingAnchorInPage {
26
- skeDrawing: IDocumentSkeletonDrawing;
27
- pageMarginTop: number;
28
- pageMarginLeft: number;
29
- }
30
- export declare function findDrawingAnchorInPage(page: IDocumentSkeletonPage | IDocumentSkeletonHeaderFooter, drawingId: string, pageMarginTop: number, pageMarginLeft: number): IDrawingAnchorInPage | null;
31
- /**
32
- * The command to update drawing wrapping style.
33
- */
34
- export declare const UpdateDocDrawingWrappingStyleCommand: ICommand;
16
+ import type { ICommand, IDocDrawingBase, IDocDrawingPosition } from '@univerjs/core';
35
17
  /**
36
18
  * The command to update drawing wrap text.
37
19
  */
@@ -40,20 +22,6 @@ export declare const UpdateDocDrawingDistanceCommand: ICommand;
40
22
  * The command to update drawing wrap text.
41
23
  */
42
24
  export declare const UpdateDocDrawingWrapTextCommand: ICommand;
43
- export interface IDrawingDocTransform {
44
- drawingId: string;
45
- key: 'size' | 'angle' | 'positionH' | 'positionV';
46
- value: ISize | number | IObjectPositionH | IObjectPositionV;
47
- }
48
- export interface IUpdateDrawingDocTransformParams {
49
- unitId: string;
50
- subUnitId: string;
51
- drawings: IDrawingDocTransform[];
52
- }
53
- /**
54
- * The command to update drawing position.
55
- */
56
- export declare const UpdateDrawingDocTransformCommand: ICommand;
57
25
  export interface IMoveInlineDrawingParams {
58
26
  unitId: string;
59
27
  subUnitId: string;
@@ -80,4 +48,3 @@ export interface ITransformNonInlineDrawingParams {
80
48
  * The command to transform non-inline drawing.
81
49
  */
82
50
  export declare const ITransformNonInlineDrawingCommand: ICommand;
83
- export {};
@@ -17,16 +17,20 @@ import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/c
17
17
  import { IDocDrawingService } from '@univerjs/docs-drawing';
18
18
  import { IDrawingManagerService } from '@univerjs/drawing';
19
19
  import { IRenderManagerService } from '@univerjs/engine-render';
20
+ import { DocRefreshDrawingsService } from '../services/doc-refresh-drawings.service';
20
21
  export declare class DocDrawingAddRemoveController extends Disposable {
21
22
  private readonly _univerInstanceService;
22
23
  private readonly _commandService;
23
24
  private readonly _drawingManagerService;
24
25
  private readonly _docDrawingService;
25
26
  private readonly _renderManagerService;
26
- constructor(_univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _docDrawingService: IDocDrawingService, _renderManagerService: IRenderManagerService);
27
+ private readonly _docRefreshDrawingsService;
28
+ constructor(_univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _drawingManagerService: IDrawingManagerService, _docDrawingService: IDocDrawingService, _renderManagerService: IRenderManagerService, _docRefreshDrawingsService: DocRefreshDrawingsService);
27
29
  private _initialize;
28
30
  private _commandExecutedListener;
31
+ private _preserveWrappingStylePosition;
29
32
  private _addDrawings;
30
33
  private _removeDrawings;
31
34
  private _updateDrawingsOrder;
35
+ private _syncDrawingDataFromSnapshot;
32
36
  }
@@ -13,8 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { ITransformState } from '@univerjs/core';
17
+ import type { IDocFloatDom } from '@univerjs/docs-drawing';
16
18
  import type { IDocFloatDomDataBase } from '@univerjs/drawing';
17
- import type { IBoundRectNoAngle, Scene } from '@univerjs/engine-render';
19
+ import type { IBoundRectNoAngle, IDocsCustomBlockRenderViewport, Scene } from '@univerjs/engine-render';
18
20
  import type { IFloatDomLayout } from '@univerjs/ui';
19
21
  import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
20
22
  import { IDrawingManagerService } from '@univerjs/drawing';
@@ -24,6 +26,13 @@ import { CanvasFloatDomService } from '@univerjs/ui';
24
26
  export declare function calcDocFloatDomPositionByRect(rect: IBoundRectNoAngle, scene: Scene, opacity?: number, angle?: number): IFloatDomLayout;
25
27
  interface IDocFloatDomParams extends IDocFloatDomDataBase {
26
28
  }
29
+ type IDocFloatDomRuntimeViewport = Partial<Pick<IDocsCustomBlockRenderViewport, 'bleedLeft' | 'bleedWidth' | 'contentHeight' | 'contentWidth' | 'height' | 'viewportHeight'>>;
30
+ interface IDocFloatDomRuntimeParam extends IDocFloatDom {
31
+ customBlockRenderViewport?: IDocFloatDomRuntimeViewport;
32
+ transform?: Partial<ITransformState>;
33
+ transforms?: Array<Partial<ITransformState>>;
34
+ }
35
+ export declare function mergeDocFloatDomRuntimeProps(existingProps: Record<string, unknown> | undefined, param: IDocFloatDomRuntimeParam): Record<string, unknown> | undefined;
27
36
  export declare class DocFloatDomController extends Disposable {
28
37
  private readonly _renderManagerService;
29
38
  private readonly _drawingManagerService;
@@ -38,6 +47,7 @@ export declare class DocFloatDomController extends Disposable {
38
47
  private _getSceneAndTransformerByDrawingSearch;
39
48
  private _drawingAddRemoveListener;
40
49
  private _insertRects;
50
+ private _drawingRuntimePropsListener;
41
51
  private _addHoverForRect;
42
52
  private _removeDom;
43
53
  private _initScrollAndZoomEvent;
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { DocumentDataModel, ITransformState } from '@univerjs/core';
17
- import type { IDocumentSkeletonHeaderFooter, IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonTable, IRenderContext, IRenderModule } from '@univerjs/engine-render';
17
+ import type { IDocsCustomBlockRenderViewport, IDocumentSkeletonHeaderFooter, IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonTable, IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
18
  import { AlignTypeH, AlignTypeV, BooleanNumber, Disposable, ICommandService, IUniverInstanceService, LifecycleService, ObjectRelativeFromH, ObjectRelativeFromV, PositionedObjectLayoutType } from '@univerjs/core';
19
19
  import { DocSkeletonManagerService } from '@univerjs/docs';
20
20
  import { IEditorService } from '@univerjs/docs-ui';
@@ -28,6 +28,7 @@ interface IDrawingParamsWithBehindText {
28
28
  hidden?: boolean;
29
29
  transform: ITransformState;
30
30
  transforms: ITransformState[];
31
+ customBlockRenderViewport?: Partial<Pick<IDocsCustomBlockRenderViewport, 'bleedLeft' | 'bleedWidth' | 'contentHeight' | 'contentWidth' | 'height' | 'viewportHeight'>>;
31
32
  isMultiTransform: BooleanNumber;
32
33
  }
33
34
  interface IDrawingClipBounds {
@@ -15,11 +15,11 @@
15
15
  */
16
16
  import type { DocumentDataModel } from '@univerjs/core';
17
17
  import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
- import { Disposable, ICommandService, IContextService, LocaleService } from '@univerjs/core';
18
+ import { Disposable, ICommandService, IContextService, IImageIoService, LocaleService } from '@univerjs/core';
19
19
  import { DocSelectionManagerService } from '@univerjs/docs';
20
20
  import { IDocDrawingService } from '@univerjs/docs-drawing';
21
21
  import { DocSelectionRenderService } from '@univerjs/docs-ui';
22
- import { IDrawingManagerService, IImageIoService } from '@univerjs/drawing';
22
+ import { IDrawingManagerService } from '@univerjs/drawing';
23
23
  import { IRenderManagerService } from '@univerjs/engine-render';
24
24
  import { ILocalFileService, IMessageService } from '@univerjs/ui';
25
25
  import { DocRefreshDrawingsService } from '../../services/doc-refresh-drawings.service';
@@ -16,20 +16,20 @@
16
16
  import './global.css';
17
17
  export { DeleteDocDrawingsCommand } from './commands/commands/delete-doc-drawing.command';
18
18
  export { GroupDocDrawingCommand } from './commands/commands/group-doc-drawing.command';
19
- export { InsertDocDrawingCommand } from './commands/commands/insert-doc-drawing.command';
20
19
  export { InsertDocImageCommand } from './commands/commands/insert-image.command';
21
20
  export { InsertDocEllipseShapeCommand, InsertDocRectangleShapeCommand } from './commands/commands/insert-shape.command';
22
21
  export { MoveDocDrawingsCommand } from './commands/commands/move-drawings.command';
23
- export { RemoveDocDrawingCommand } from './commands/commands/remove-doc-drawing.command';
24
- export { SetDocDrawingArrangeCommand } from './commands/commands/set-drawing-arrange.command';
25
22
  export { UngroupDocDrawingCommand } from './commands/commands/ungroup-doc-drawing.command';
26
23
  export { ClearDocDrawingTransformerOperation } from './commands/operations/clear-drawing-transformer.operation';
27
24
  export { EditDocDrawingOperation } from './commands/operations/edit-doc-drawing.operation';
28
25
  export { SidebarDocDrawingOperation } from './commands/operations/open-drawing-panel.operation';
29
- export { type IUniverDocsDrawingUIConfig } from './config/config';
26
+ export type { IUniverDocsDrawingUIConfig } from './config/config';
30
27
  export { DocFloatDomController } from './controllers/doc-float-dom.controller';
31
28
  export { DOCS_IMAGE_MENU_ID } from './menu/image.menu';
29
+ export { menuSchema as DocsDrawingUIMenuSchema } from './menu/schema';
32
30
  export { DOCS_SHAPE_BELOW_MENU_ID, DOCS_SHAPE_MENU_ID } from './menu/shape.menu';
33
31
  export { UniverDocsDrawingUIPlugin } from './plugin';
32
+ export { DocDrawingFloatingToolbarAdapterService } from './services/doc-drawing-floating-toolbar-adapter.service';
33
+ export type { IDocDrawingFloatingToolbarAdapter, IDocDrawingFloatingToolbarButtonItem, IDocDrawingFloatingToolbarItem, IDocDrawingFloatingToolbarOption, IDocDrawingFloatingToolbarParams, IDocDrawingFloatingToolbarSelectItem, } from './services/doc-drawing-floating-toolbar-adapter.service';
34
34
  export { DocDrawingPosition } from './views/doc-image-panel/DocDrawingPosition';
35
35
  export { DocDrawingTextWrap } from './views/doc-image-panel/DocDrawingTextWrap';
@@ -14,25 +14,29 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ICommandService, IContextService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
17
+ import { IDocDrawingAdapterService } from '@univerjs/docs-drawing';
17
18
  import { DocCanvasPopManagerService } from '@univerjs/docs-ui';
18
19
  import { IDrawingManagerService } from '@univerjs/drawing';
19
20
  import { IRenderManagerService } from '@univerjs/engine-render';
21
+ import { DocDrawingFloatingToolbarAdapterService } from '../services/doc-drawing-floating-toolbar-adapter.service';
20
22
  export declare class DocDrawingPopupMenuController extends RxDisposable {
21
23
  private readonly _drawingManagerService;
22
24
  private readonly _canvasPopManagerService;
23
25
  private readonly _renderManagerService;
24
26
  private readonly _univerInstanceService;
25
27
  private readonly _contextService;
28
+ private readonly _drawingAdapterService;
29
+ private readonly _floatingToolbarAdapterService;
26
30
  private readonly _commandService;
27
31
  private _initImagePopupMenu;
28
32
  private _disposePopups;
29
33
  private _isDrawingPanelOpen;
30
- constructor(_drawingManagerService: IDrawingManagerService, _canvasPopManagerService: DocCanvasPopManagerService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _contextService: IContextService, _commandService: ICommandService);
34
+ constructor(_drawingManagerService: IDrawingManagerService, _canvasPopManagerService: DocCanvasPopManagerService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _contextService: IContextService, _drawingAdapterService: IDocDrawingAdapterService, _floatingToolbarAdapterService: DocDrawingFloatingToolbarAdapterService, _commandService: ICommandService);
31
35
  private _init;
32
36
  private _dispose;
33
37
  private _clearPopups;
34
38
  private _create;
35
39
  private _hasCropObject;
36
40
  private _popupMenuListener;
37
- private _getImageMenuItems;
41
+ private _getDrawingPopupMenuItems;
38
42
  }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { IDisposable } from '@univerjs/core';
17
+ import type { IDocDrawing } from '@univerjs/docs-drawing';
18
+ export interface IDocDrawingFloatingToolbarParams {
19
+ unitId: string;
20
+ subUnitId: string;
21
+ drawing: IDocDrawing;
22
+ }
23
+ export interface IDocDrawingFloatingToolbarOption {
24
+ label: unknown;
25
+ value: string;
26
+ }
27
+ interface IDocDrawingFloatingToolbarBaseItem {
28
+ label: string;
29
+ index: number;
30
+ commandId: string;
31
+ commandParams?: object;
32
+ disable: boolean;
33
+ hideOnClick?: boolean;
34
+ icon?: string;
35
+ }
36
+ export interface IDocDrawingFloatingToolbarButtonItem extends IDocDrawingFloatingToolbarBaseItem {
37
+ type?: 'button';
38
+ }
39
+ export interface IDocDrawingFloatingToolbarSelectItem extends IDocDrawingFloatingToolbarBaseItem {
40
+ type: 'select';
41
+ value: string;
42
+ options: IDocDrawingFloatingToolbarOption[];
43
+ commandParamsFactory: (value: string) => object;
44
+ }
45
+ export type IDocDrawingFloatingToolbarItem = IDocDrawingFloatingToolbarButtonItem | IDocDrawingFloatingToolbarSelectItem;
46
+ export interface IDocDrawingFloatingToolbarAdapter {
47
+ getItems: (params: IDocDrawingFloatingToolbarParams) => readonly IDocDrawingFloatingToolbarItem[] | null | undefined;
48
+ }
49
+ export declare class DocDrawingFloatingToolbarAdapterService {
50
+ private readonly _adapters;
51
+ registerAdapter(adapter: IDocDrawingFloatingToolbarAdapter): IDisposable;
52
+ getItems(params: IDocDrawingFloatingToolbarParams): IDocDrawingFloatingToolbarItem[] | null;
53
+ }
54
+ export {};
@@ -17,4 +17,4 @@ import type { IDrawingParam } from '@univerjs/core';
17
17
  export interface IDocDrawingPositionProps {
18
18
  drawings: IDrawingParam[];
19
19
  }
20
- export declare const DocDrawingPosition: (props: IDocDrawingPositionProps) => import("react").JSX.Element | undefined;
20
+ export declare const DocDrawingPosition: (props: IDocDrawingPositionProps) => import("react").JSX.Element | null;