@univerjs/docs-drawing-ui 0.2.7 → 0.2.8

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.
Files changed (36) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +10 -10
  3. package/lib/types/commands/commands/delete-doc-drawing.command.d.ts +0 -1
  4. package/lib/types/commands/commands/group-doc-drawing.command.d.ts +0 -1
  5. package/lib/types/commands/commands/insert-doc-drawing.command.d.ts +0 -1
  6. package/lib/types/commands/commands/interfaces.d.ts +0 -1
  7. package/lib/types/commands/commands/move-drawings.command.d.ts +0 -1
  8. package/lib/types/commands/commands/remove-doc-drawing.command.d.ts +0 -1
  9. package/lib/types/commands/commands/set-drawing-arrange.command.d.ts +0 -1
  10. package/lib/types/commands/commands/ungroup-doc-drawing.command.d.ts +0 -1
  11. package/lib/types/commands/commands/update-doc-drawing.command.d.ts +0 -1
  12. package/lib/types/commands/commands/utils.d.ts +0 -1
  13. package/lib/types/commands/operations/clear-drawing-transformer.operation.d.ts +0 -1
  14. package/lib/types/commands/operations/edit-doc-drawing.operation.d.ts +0 -1
  15. package/lib/types/commands/operations/insert-image.operation.d.ts +0 -1
  16. package/lib/types/commands/operations/open-drawing-panel.operation.d.ts +0 -1
  17. package/lib/types/controllers/doc-drawing-notification.controller.d.ts +0 -1
  18. package/lib/types/controllers/doc-drawing-transformer-update.controller.d.ts +0 -1
  19. package/lib/types/controllers/doc-drawing.controller.d.ts +0 -1
  20. package/lib/types/controllers/drawing-popup-menu.controller.d.ts +0 -1
  21. package/lib/types/controllers/render-controllers/doc-drawing-transform-update.controller.d.ts +0 -1
  22. package/lib/types/controllers/render-controllers/doc-drawing-update.render-controller.d.ts +0 -1
  23. package/lib/types/controllers/shortcuts/drawing.shortcut.d.ts +0 -1
  24. package/lib/types/locale/en-US.d.ts +0 -1
  25. package/lib/types/locale/ru-RU.d.ts +0 -1
  26. package/lib/types/locale/vi-VN.d.ts +0 -1
  27. package/lib/types/locale/zh-TW.d.ts +0 -1
  28. package/lib/types/plugin.d.ts +0 -1
  29. package/lib/types/services/doc-refresh-drawings.service.d.ts +0 -1
  30. package/lib/types/views/doc-image-panel/DocDrawingPanel.d.ts +0 -1
  31. package/lib/types/views/doc-image-panel/DocDrawingPosition.d.ts +0 -1
  32. package/lib/types/views/doc-image-panel/DocDrawingTextWrap.d.ts +0 -1
  33. package/lib/types/views/menu/image.menu.d.ts +0 -1
  34. package/lib/types/views/upload-component/UploadFile.d.ts +0 -1
  35. package/lib/umd/index.js +1 -1
  36. package/package.json +22 -22
package/lib/es/index.js CHANGED
@@ -7,7 +7,7 @@ import { ImageCropperObject, COMPONENT_IMAGE_POPUP_MENU, OpenImageCropOperation,
7
7
  import { IDrawingManagerService, DRAWING_IMAGE_ALLOW_IMAGE_LIST, ArrangeTypeEnum, DRAWING_IMAGE_COUNT_LIMIT, ImageUploadStatusType, DRAWING_IMAGE_ALLOW_SIZE, getImageSize, DrawingTypeEnum, getDrawingShapeKeyByDrawingSearch, DRAWING_IMAGE_WIDTH_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, IImageIoService, UniverDrawingPlugin } from "@univerjs/drawing";
8
8
  import { IDocDrawingService, UniverDocsDrawingPlugin } from "@univerjs/docs-drawing";
9
9
  import { ITextSelectionRenderManager, IRenderManagerService, DocumentEditArea, Liquid, TRANSFORM_CHANGE_OBSERVABLE_TYPE, PageLayoutType, NodePositionConvertToCursor, getOneTextSelectionRange, DocumentSkeletonPageType, Vector2, getAnchorBounding, Rect, getColor, TEXT_RANGE_LAYER_INDEX } from "@univerjs/engine-render";
10
- import { takeUntil, Observable, BehaviorSubject, filter, debounceTime, first } from "rxjs";
10
+ import { takeUntil, Observable, BehaviorSubject, filter, debounceTime } from "rxjs";
11
11
  import { DocCanvasPopManagerService, docDrawingPositionToTransform } from "@univerjs/docs-ui";
12
12
  import { RichTextEditingMutation, getRichTextEditPath, TextSelectionManagerService, DocSkeletonManagerService, getRetainAndDeleteFromReplace, SetDocZoomRatioOperation, getDocObject } from "@univerjs/docs";
13
13
  import { ISidebarService, MenuItemType, MenuPosition, MenuGroup, getMenuHiddenObservable, KeyCode, ComponentManager, IMenuService, IShortcutService, IMessageService, IEditorService } from "@univerjs/ui";
@@ -1813,14 +1813,13 @@ let DocDrawingTransformUpdateController = (_a4 = class extends Disposable {
1813
1813
  });
1814
1814
  }
1815
1815
  _drawingInitializeListener() {
1816
- this._lifecycleService.lifecycle$.pipe(filter((stage) => stage === LifecycleStages.Steady), first()).subscribe((stage) => {
1817
- var _a8;
1818
- const unitId = (_a8 = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC)) == null ? void 0 : _a8.getUnitId();
1819
- if (!unitId)
1820
- return;
1816
+ const init = /* @__PURE__ */ __name(() => {
1821
1817
  const skeleton = this._docSkeletonManagerService.getSkeleton();
1822
- skeleton != null && (this._refreshDrawing(skeleton), this._drawingManagerService.initializeNotification(unitId));
1823
- });
1818
+ skeleton != null && (this._refreshDrawing(skeleton), this._drawingManagerService.initializeNotification(this._context.unitId));
1819
+ }, "init");
1820
+ this._lifecycleService.stage === LifecycleStages.Steady ? setTimeout(() => {
1821
+ init();
1822
+ }, 1e3) : this._lifecycleService.lifecycle$.pipe(filter((stage) => stage === LifecycleStages.Steady)).subscribe(init);
1824
1823
  }
1825
1824
  }, __name(_a4, "DocDrawingTransformUpdateController"), _a4);
1826
1825
  DocDrawingTransformUpdateController = __decorateClass$3([
@@ -2029,7 +2028,7 @@ let DocDrawingTransformerController = (_a6 = class extends Disposable {
2029
2028
  throttleMultipleDrawingUpdate(objects);
2030
2029
  else if (objects.size === 1) {
2031
2030
  const drawingCache = this._transformerCache.values().next().value, object = objects.values().next().value, { width, height, top, left, angle } = object;
2032
- if (width === drawingCache.width && height === drawingCache.height && top === drawingCache.top && left === drawingCache.left && angle === drawingCache.angle)
2031
+ if (drawingCache && width === drawingCache.width && height === drawingCache.height && top === drawingCache.top && left === drawingCache.left && angle === drawingCache.angle)
2033
2032
  return;
2034
2033
  drawingCache && (drawingCache.drawing.layoutType, PositionedObjectLayoutType.INLINE), drawingCache && drawingCache.drawing.layoutType === PositionedObjectLayoutType.INLINE && offsetX != null && offsetY != null && this._updateInlineDrawingAnchor(drawingCache.drawing, offsetX, offsetY);
2035
2034
  }
@@ -2037,6 +2036,7 @@ let DocDrawingTransformerController = (_a6 = class extends Disposable {
2037
2036
  )
2038
2037
  ), this.disposeWithMe(
2039
2038
  toDisposable(
2039
+ // eslint-disable-next-line complexity
2040
2040
  transformer.changeEnd$.subscribe((state) => {
2041
2041
  const { objects, offsetX, offsetY } = state;
2042
2042
  for (const object of objects.values()) {
@@ -2050,7 +2050,7 @@ let DocDrawingTransformerController = (_a6 = class extends Disposable {
2050
2050
  this._updateMultipleDrawingDocTransform(objects);
2051
2051
  else if (objects.size === 1) {
2052
2052
  const drawingCache = this._transformerCache.values().next().value, object = objects.values().next().value, { width, height, top, left, angle } = object;
2053
- if (width === drawingCache.width && height === drawingCache.height && top === drawingCache.top && left === drawingCache.left && angle === drawingCache.angle)
2053
+ if (drawingCache && width === drawingCache.width && height === drawingCache.height && top === drawingCache.top && left === drawingCache.left && angle === drawingCache.angle)
2054
2054
  return;
2055
2055
  drawingCache && drawingCache.drawing.layoutType === PositionedObjectLayoutType.INLINE ? width !== drawingCache.width || height !== drawingCache.height || angle !== drawingCache.angle ? this._updateDrawingSize(drawingCache, object) : offsetX != null && offsetY != null && this._moveInlineDrawing(drawingCache.drawing, offsetX, offsetY) : drawingCache && this._nonInlineDrawingTransform(drawingCache.drawing, object);
2056
2056
  }
@@ -1,3 +1,2 @@
1
1
  import { ICommand } from '@univerjs/core';
2
-
3
2
  export declare const DeleteDocDrawingsCommand: ICommand;
@@ -1,5 +1,4 @@
1
1
  import { ICommand } from '@univerjs/core';
2
-
3
2
  /**
4
3
  * The command to insert new defined name
5
4
  */
@@ -1,5 +1,4 @@
1
1
  import { ICommand } from '@univerjs/core';
2
-
3
2
  /**
4
3
  * The command to insert new drawings
5
4
  */
@@ -1,6 +1,5 @@
1
1
  import { DrawingTypeEnum } from '@univerjs/core';
2
2
  import { IDocDrawing } from '@univerjs/docs-drawing';
3
-
4
3
  export interface IInsertDrawingCommandParams {
5
4
  unitId: string;
6
5
  drawings: IDocDrawing[];
@@ -1,5 +1,4 @@
1
1
  import { ICommand, Direction } from '@univerjs/core';
2
-
3
2
  export interface IMoveDrawingsCommandParams {
4
3
  direction: Direction;
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { ICommand } from '@univerjs/core';
2
-
3
2
  /**
4
3
  * The command to remove new sheet image
5
4
  */
@@ -1,6 +1,5 @@
1
1
  import { ICommand } from '@univerjs/core';
2
2
  import { IDrawingOrderMapParam, ArrangeTypeEnum } from '@univerjs/drawing';
3
-
4
3
  export interface ISetDrawingArrangeCommandParams extends IDrawingOrderMapParam {
5
4
  arrangeType: ArrangeTypeEnum;
6
5
  }
@@ -1,5 +1,4 @@
1
1
  import { ICommand } from '@univerjs/core';
2
-
3
2
  /**
4
3
  * The command to insert new defined name
5
4
  */
@@ -1,5 +1,4 @@
1
1
  import { ICommand, IDocDrawingBase, IDocDrawingPosition, IObjectPositionH, IObjectPositionV, ISize } from '@univerjs/core';
2
-
3
2
  export declare enum TextWrappingStyle {
4
3
  INLINE = "inline",
5
4
  BEHIND_TEXT = "behindText",
@@ -1,4 +1,3 @@
1
1
  import { IDrawingGroupUpdateParam } from '@univerjs/drawing';
2
-
3
2
  export declare function ungroupToGroup(ungroupParams: IDrawingGroupUpdateParam[]): IDrawingGroupUpdateParam[];
4
3
  export declare function groupToUngroup(groupParams: IDrawingGroupUpdateParam[]): IDrawingGroupUpdateParam[];
@@ -1,3 +1,2 @@
1
1
  import { IMutation } from '@univerjs/core';
2
-
3
2
  export declare const ClearDocDrawingTransformerOperation: IMutation<string[]>;
@@ -1,4 +1,3 @@
1
1
  import { IOperation } from '@univerjs/core';
2
2
  import { IDrawingSearch } from '@univerjs/drawing';
3
-
4
3
  export declare const EditDocDrawingOperation: IOperation<IDrawingSearch>;
@@ -1,5 +1,4 @@
1
1
  import { IOperation, Nullable } from '@univerjs/core';
2
-
3
2
  export interface IInsertImageOperationParams {
4
3
  files: Nullable<File[]>;
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { ICommand } from '@univerjs/core';
2
-
3
2
  export interface IUIComponentCommandParams {
4
3
  value: string;
5
4
  }
@@ -2,7 +2,6 @@ import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/c
2
2
  import { IDocDrawingService } from '@univerjs/docs-drawing';
3
3
  import { IDrawingManagerService } from '@univerjs/drawing';
4
4
  import { IRenderManagerService } from '@univerjs/engine-render';
5
-
6
5
  export declare class DocDrawingAddRemoveController extends Disposable {
7
6
  private readonly _univerInstanceService;
8
7
  private readonly _commandService;
@@ -1,7 +1,6 @@
1
1
  import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { IDrawingManagerService } from '@univerjs/drawing';
3
3
  import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
4
-
5
4
  export declare class DocDrawingTransformerController extends Disposable {
6
5
  private readonly _commandService;
7
6
  private readonly _univerInstanceService;
@@ -1,6 +1,5 @@
1
1
  import { Disposable, ICommandService, Injector } from '@univerjs/core';
2
2
  import { ComponentManager, IMenuService, IShortcutService } from '@univerjs/ui';
3
-
4
3
  export declare class DocDrawingUIController extends Disposable {
5
4
  private readonly _injector;
6
5
  private readonly _componentManager;
@@ -2,7 +2,6 @@ import { IContextService, IUniverInstanceService, RxDisposable } from '@univerjs
2
2
  import { IRenderManagerService } from '@univerjs/engine-render';
3
3
  import { DocCanvasPopManagerService } from '@univerjs/docs-ui';
4
4
  import { IDrawingManagerService } from '@univerjs/drawing';
5
-
6
5
  export declare class DocDrawingPopupMenuController extends RxDisposable {
7
6
  private readonly _drawingManagerService;
8
7
  private readonly _canvasPopManagerService;
@@ -4,7 +4,6 @@ import { IDrawingManagerService } from '@univerjs/drawing';
4
4
  import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
5
5
  import { IEditorService } from '@univerjs/ui';
6
6
  import { DocRefreshDrawingsService } from '../../services/doc-refresh-drawings.service';
7
-
8
7
  export declare class DocDrawingTransformUpdateController extends Disposable implements IRenderModule {
9
8
  private readonly _context;
10
9
  private readonly _docSkeletonManagerService;
@@ -5,7 +5,6 @@ import { IDocDrawingService } from '@univerjs/docs-drawing';
5
5
  import { TextSelectionManagerService } from '@univerjs/docs';
6
6
  import { IRenderContext, IRenderModule, IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
7
7
  import { DocRefreshDrawingsService } from '../../services/doc-refresh-drawings.service';
8
-
9
8
  export declare class DocDrawingUpdateRenderController extends Disposable implements IRenderModule {
10
9
  private readonly _context;
11
10
  private readonly _commandService;
@@ -1,7 +1,6 @@
1
1
  import { IContextService } from '@univerjs/core';
2
2
  import { IShortcutItem } from '@univerjs/ui';
3
3
  import { IMoveDrawingsCommandParams } from '../../commands/commands/move-drawings.command';
4
-
5
4
  export declare function whenDocDrawingFocused(contextService: IContextService): boolean;
6
5
  export declare const MoveDrawingDownShortcutItem: IShortcutItem<IMoveDrawingsCommandParams>;
7
6
  export declare const MoveDrawingUpShortcutItem: IShortcutItem<IMoveDrawingsCommandParams>;
@@ -1,4 +1,3 @@
1
1
  import { default as zhCN } from './zh-CN';
2
-
3
2
  declare const locale: typeof zhCN;
4
3
  export default locale;
@@ -1,4 +1,3 @@
1
1
  import { default as zhCN } from './zh-CN';
2
-
3
2
  declare const locale: typeof zhCN;
4
3
  export default locale;
@@ -1,4 +1,3 @@
1
1
  import { default as zhCN } from './zh-CN';
2
-
3
2
  declare const locale: typeof zhCN;
4
3
  export default locale;
@@ -1,4 +1,3 @@
1
1
  import { default as zhCN } from './zh-CN';
2
-
3
2
  declare const locale: typeof zhCN;
4
3
  export default locale;
@@ -1,6 +1,5 @@
1
1
  import { Injector, Plugin, UniverInstanceType } from '@univerjs/core';
2
2
  import { IRenderManagerService } from '@univerjs/engine-render';
3
-
4
3
  export declare class UniverDocsDrawingUIPlugin extends Plugin {
5
4
  protected _injector: Injector;
6
5
  private readonly _renderManagerSrv;
@@ -1,6 +1,5 @@
1
1
  import { Nullable } from '@univerjs/core';
2
2
  import { DocumentSkeleton } from '@univerjs/engine-render';
3
-
4
3
  export declare class DocRefreshDrawingsService {
5
4
  private readonly _refreshDrawings$;
6
5
  readonly refreshDrawings$: import('rxjs').Observable<Nullable<DocumentSkeleton>>;
@@ -1,3 +1,2 @@
1
1
  import { default as React } from 'react';
2
-
3
2
  export declare const DocDrawingPanel: () => false | React.JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import { default as React } from 'react';
2
2
  import { IDrawingParam } from '@univerjs/drawing';
3
-
4
3
  export interface IDocDrawingPositionProps {
5
4
  drawings: IDrawingParam[];
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as React } from 'react';
2
2
  import { IDrawingParam } from '@univerjs/drawing';
3
-
4
3
  export interface IDocDrawingTextWrapProps {
5
4
  drawings: IDrawingParam[];
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { IMenuItem } from '@univerjs/ui';
2
2
  import { IAccessor } from '@univerjs/core';
3
-
4
3
  export declare const ImageUploadIcon = "addition-and-subtraction-single";
5
4
  export declare const IMAGE_MENU_ID = "doc.menu.image";
6
5
  export declare function ImageMenuFactory(accessor: IAccessor): IMenuItem;
@@ -1,3 +1,2 @@
1
1
  import { default as React } from 'react';
2
-
3
2
  export declare const UploadFileMenu: () => React.JSX.Element;