@univerjs/sheets-drawing-ui 0.2.6 → 0.2.7
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/es/index.js
CHANGED
|
@@ -2,11 +2,11 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { CommandType, ICommandService, IUndoRedoService, LocaleService, IUniverInstanceService, useDependency, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, OnLifecycle, LifecycleStages, Inject, Injector, IContextService, Disposable, Direction,
|
|
5
|
+
import { CommandType, ICommandService, IUndoRedoService, LocaleService, IUniverInstanceService, useDependency, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, OnLifecycle, LifecycleStages, Inject, Injector, IContextService, Disposable, Direction, FOCUSING_FX_BAR_EDITOR, EDITOR_ACTIVATED, Rectangle, DrawingTypeEnum as DrawingTypeEnum$1, DisposableCollection, generateRandomId, Tools, UserManagerService, IPermissionService, Plugin, DependentOn } from "@univerjs/core";
|
|
6
6
|
import { ImageCropperObject, COMPONENT_IMAGE_POPUP_MENU, OpenImageCropOperation, ImageResetSizeOperation, DrawingCommonPanel, DrawingRenderService, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
|
|
7
7
|
import { ISheetDrawingService, SetDrawingApplyMutation, DrawingApplyType, SheetDrawingAnchorType, UniverSheetsDrawingPlugin } from "@univerjs/sheets-drawing";
|
|
8
8
|
import { IDrawingManagerService, IImageIoService, ArrangeTypeEnum, DrawingTypeEnum, DRAWING_IMAGE_COUNT_LIMIT, ImageUploadStatusType, DRAWING_IMAGE_ALLOW_SIZE, getImageSize, DRAWING_IMAGE_WIDTH_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_ALLOW_IMAGE_LIST, getDrawingShapeKeyByDrawingSearch, UniverDrawingPlugin } from "@univerjs/drawing";
|
|
9
|
-
import { IRenderManagerService, getGroupState, transformObjectOutOfGroup, precisionTo, Rect, DRAWING_OBJECT_LAYER_INDEX, SHEET_VIEWPORT_KEY, RENDER_CLASS_TYPE } from "@univerjs/engine-render";
|
|
9
|
+
import { IRenderManagerService, getGroupState, transformObjectOutOfGroup, precisionTo, Rect, DRAWING_OBJECT_LAYER_INDEX, pxToNum, SHEET_VIEWPORT_KEY, RENDER_CLASS_TYPE } from "@univerjs/engine-render";
|
|
10
10
|
import { SheetCanvasPopManagerService, attachRangeWithCoord, SheetSkeletonManagerService, ISheetSelectionRenderService, getCurrentRangeDisable$, SetScrollOperation, SetZoomRatioOperation, SheetPrintInterceptorService, COPY_TYPE, PREDEFINED_HOOK_NAME, virtualizeDiscreteRanges, ISheetClipboardService } from "@univerjs/sheets-ui";
|
|
11
11
|
import { takeUntil, Subject, BehaviorSubject, combineLatest, map, filter, distinctUntilChanged } from "rxjs";
|
|
12
12
|
import { ISidebarService, BuiltInUIPart, IUIPartsService, IMessageService, MenuItemType, MenuPosition, MenuGroup, getMenuHiddenObservable, KeyCode, ComponentManager, IMenuService, IShortcutService, CanvasFloatDomService } from "@univerjs/ui";
|
|
@@ -926,7 +926,7 @@ const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "un
|
|
|
926
926
|
}, "handler")
|
|
927
927
|
};
|
|
928
928
|
function whenSheetDrawingFocused(contextService) {
|
|
929
|
-
return !contextService.getContextValue(
|
|
929
|
+
return !contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) && !contextService.getContextValue(EDITOR_ACTIVATED) && contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);
|
|
930
930
|
}
|
|
931
931
|
__name(whenSheetDrawingFocused, "whenSheetDrawingFocused");
|
|
932
932
|
const MoveDrawingDownShortcutItem = {
|
|
@@ -1788,20 +1788,20 @@ function transformBound2DOMBound(originBound, scene, skeleton, worksheet) {
|
|
|
1788
1788
|
}
|
|
1789
1789
|
__name(transformBound2DOMBound, "transformBound2DOMBound");
|
|
1790
1790
|
const calcPosition = /* @__PURE__ */ __name((targetObject, currentRender, skeleton, worksheet) => {
|
|
1791
|
-
const { scene } = currentRender, { left, top, width, height, angle } = targetObject, bound = {
|
|
1791
|
+
const { scene, engine } = currentRender, { left, top, width, height, angle } = targetObject, canvasElement = engine.getCanvasElement(), canvasClientRect = canvasElement.getBoundingClientRect(), widthOfCanvas = pxToNum(canvasElement.style.width), { top: topOffset, left: leftOffset, width: domWidth } = canvasClientRect, scaleAdjust = domWidth / widthOfCanvas, bound = {
|
|
1792
1792
|
left,
|
|
1793
1793
|
right: left + width,
|
|
1794
1794
|
top,
|
|
1795
1795
|
bottom: top + height
|
|
1796
1796
|
}, offsetBound = transformBound2DOMBound(bound, scene, skeleton, worksheet);
|
|
1797
1797
|
return {
|
|
1798
|
-
startX: offsetBound.left,
|
|
1799
|
-
endX: offsetBound.right,
|
|
1800
|
-
startY: offsetBound.top,
|
|
1801
|
-
endY: offsetBound.bottom,
|
|
1798
|
+
startX: offsetBound.left * scaleAdjust + leftOffset,
|
|
1799
|
+
endX: offsetBound.right * scaleAdjust + leftOffset,
|
|
1800
|
+
startY: offsetBound.top * scaleAdjust + topOffset,
|
|
1801
|
+
endY: offsetBound.bottom * scaleAdjust + topOffset,
|
|
1802
1802
|
rotate: angle,
|
|
1803
|
-
width,
|
|
1804
|
-
height,
|
|
1803
|
+
width: width * scaleAdjust,
|
|
1804
|
+
height: height * scaleAdjust,
|
|
1805
1805
|
absolute: offsetBound.absolute
|
|
1806
1806
|
};
|
|
1807
1807
|
}, "calcPosition");
|
|
@@ -1991,14 +1991,14 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1991
1991
|
})
|
|
1992
1992
|
);
|
|
1993
1993
|
}
|
|
1994
|
-
addFloatDomToPosition(layer) {
|
|
1994
|
+
addFloatDomToPosition(layer, propId) {
|
|
1995
1995
|
const target = getSheetCommandTarget(this._univerInstanceService, {
|
|
1996
1996
|
unitId: layer.unitId,
|
|
1997
1997
|
subUnitId: layer.subUnitId
|
|
1998
1998
|
});
|
|
1999
1999
|
if (!target)
|
|
2000
2000
|
throw new Error("cannot find current target!");
|
|
2001
|
-
const { unitId, subUnitId } = target, { initPosition, componentKey, data } = layer, id =
|
|
2001
|
+
const { unitId, subUnitId } = target, { initPosition, componentKey, data } = layer, id = propId != null ? propId : generateRandomId(), sheetTransform = this._getPosition(initPosition, unitId);
|
|
2002
2002
|
if (sheetTransform == null)
|
|
2003
2003
|
return;
|
|
2004
2004
|
this._ensureMap(unitId, subUnitId).set(id, layer);
|
|
@@ -2441,14 +2441,14 @@ let UniverSheetsDrawingUIPlugin = (_a9 = class extends Plugin {
|
|
|
2441
2441
|
}],
|
|
2442
2442
|
[DrawingPopupMenuController],
|
|
2443
2443
|
[SheetDrawingPrintingController],
|
|
2444
|
-
[SheetDrawingPermissionController]
|
|
2444
|
+
[SheetDrawingPermissionController],
|
|
2445
|
+
[SheetsDrawingCopyPasteController]
|
|
2445
2446
|
].forEach((dependency) => this._injector.add(dependency));
|
|
2446
2447
|
}
|
|
2447
2448
|
_registerRenderModules() {
|
|
2448
2449
|
[
|
|
2449
2450
|
[SheetDrawingUpdateController],
|
|
2450
|
-
[SheetDrawingTransformAffectedController]
|
|
2451
|
-
[SheetsDrawingCopyPasteController]
|
|
2451
|
+
[SheetDrawingTransformAffectedController]
|
|
2452
2452
|
].forEach((m) => {
|
|
2453
2453
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
|
|
2454
2454
|
});
|
|
@@ -2467,6 +2467,7 @@ export {
|
|
|
2467
2467
|
DeleteDrawingsCommand,
|
|
2468
2468
|
EditSheetDrawingOperation,
|
|
2469
2469
|
GroupSheetDrawingCommand,
|
|
2470
|
+
IMAGE_MENU_ID,
|
|
2470
2471
|
InsertCellImageOperation,
|
|
2471
2472
|
InsertFloatImageOperation,
|
|
2472
2473
|
InsertSheetDrawingCommand,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -27,3 +27,4 @@ export { ClearSheetDrawingTransformerOperation } from './commands/operations/cle
|
|
|
27
27
|
export { EditSheetDrawingOperation } from './commands/operations/edit-sheet-drawing.operation';
|
|
28
28
|
export { InsertFloatImageOperation, InsertCellImageOperation } from './commands/operations/insert-image.operation';
|
|
29
29
|
export { SidebarSheetDrawingOperation } from './commands/operations/open-drawing-panel.operation';
|
|
30
|
+
export { IMAGE_MENU_ID } from './views/menu/image.menu';
|
|
@@ -62,7 +62,7 @@ export declare class SheetCanvasFloatDomManagerService extends Disposable {
|
|
|
62
62
|
private _getPosition;
|
|
63
63
|
private _featureUpdateListener;
|
|
64
64
|
private _deleteListener;
|
|
65
|
-
addFloatDomToPosition(layer: ICanvasFloatDom): {
|
|
65
|
+
addFloatDomToPosition(layer: ICanvasFloatDom, propId?: string): {
|
|
66
66
|
id: string;
|
|
67
67
|
dispose: () => void;
|
|
68
68
|
} | undefined;
|
|
@@ -2,6 +2,7 @@ import { IMenuItem } from '@univerjs/ui';
|
|
|
2
2
|
import { IAccessor } from '@univerjs/core';
|
|
3
3
|
|
|
4
4
|
export declare const IMAGE_UPLOAD_ICON = "addition-and-subtraction-single";
|
|
5
|
+
export declare const IMAGE_MENU_ID = "sheet.menu.image";
|
|
5
6
|
export declare function ImageMenuFactory(accessor: IAccessor): IMenuItem;
|
|
6
7
|
export declare function UploadFloatImageMenuFactory(_accessor: IAccessor): IMenuItem;
|
|
7
8
|
export declare function UploadCellImageMenuFactory(_accessor: IAccessor): IMenuItem;
|