@univerjs/sheets-drawing-ui 0.2.7 → 0.2.9
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/cjs/index.js +1 -1
- package/lib/es/index.js +161 -137
- package/lib/types/basics/transform-position.d.ts +0 -1
- package/lib/types/commands/commands/delete-drawings.command.d.ts +0 -1
- package/lib/types/commands/commands/group-sheet-drawing.command.d.ts +0 -1
- package/lib/types/commands/commands/insert-sheet-drawing.command.d.ts +0 -1
- package/lib/types/commands/commands/interfaces.d.ts +0 -1
- package/lib/types/commands/commands/move-drawings.command.d.ts +0 -1
- package/lib/types/commands/commands/remove-sheet-drawing.command.d.ts +0 -1
- package/lib/types/commands/commands/set-drawing-arrange.command.d.ts +0 -1
- package/lib/types/commands/commands/set-sheet-drawing.command.d.ts +0 -1
- package/lib/types/commands/commands/ungroup-sheet-drawing.command.d.ts +0 -1
- package/lib/types/commands/commands/utils.d.ts +0 -1
- package/lib/types/commands/operations/clear-drawing-transformer.operation.d.ts +0 -1
- package/lib/types/commands/operations/edit-sheet-drawing.operation.d.ts +0 -1
- package/lib/types/commands/operations/insert-image.operation.d.ts +0 -1
- package/lib/types/commands/operations/open-drawing-panel.operation.d.ts +0 -1
- package/lib/types/controllers/drawing-popup-menu.controller.d.ts +0 -1
- package/lib/types/controllers/render-controllers/sheet-drawing.render-controller.d.ts +11 -0
- package/lib/types/controllers/sheet-drawing-copy-paste.controller.d.ts +0 -1
- package/lib/types/controllers/sheet-drawing-permission.controller.d.ts +0 -1
- package/lib/types/controllers/sheet-drawing-printing.controller.d.ts +0 -1
- package/lib/types/controllers/sheet-drawing-transform-affected.controller.d.ts +0 -1
- package/lib/types/controllers/sheet-drawing-update.controller.d.ts +2 -3
- package/lib/types/controllers/sheet-drawing.controller.d.ts +0 -1
- package/lib/types/controllers/shortcuts/drawing.shortcut.d.ts +0 -1
- package/lib/types/locale/en-US.d.ts +0 -1
- package/lib/types/locale/ru-RU.d.ts +0 -1
- package/lib/types/locale/vi-VN.d.ts +0 -1
- package/lib/types/locale/zh-TW.d.ts +0 -1
- package/lib/types/plugin.d.ts +0 -1
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +0 -1
- package/lib/types/views/menu/image.menu.d.ts +0 -1
- package/lib/types/views/sheet-image-panel/SheetDrawingAnchor.d.ts +0 -1
- package/lib/types/views/sheet-image-panel/SheetDrawingPanel.d.ts +0 -1
- package/lib/types/views/upload-component/UploadFile.d.ts +0 -1
- package/lib/types/views/upload-loading/UploadLoading.d.ts +0 -1
- package/lib/umd/index.js +1 -1
- package/package.json +22 -22
package/lib/es/index.js
CHANGED
|
@@ -2,13 +2,13 @@ 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, FOCUSING_FX_BAR_EDITOR, EDITOR_ACTIVATED, Rectangle, DrawingTypeEnum as DrawingTypeEnum$1, DisposableCollection, generateRandomId, Tools, UserManagerService, IPermissionService, Plugin, DependentOn } from "@univerjs/core";
|
|
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, LifecycleService, 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,
|
|
9
|
+
import { IRenderManagerService, getGroupState, transformObjectOutOfGroup, precisionTo, Rect, DRAWING_OBJECT_LAYER_INDEX, 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
|
-
import { takeUntil, Subject, BehaviorSubject, combineLatest, map, filter, distinctUntilChanged } from "rxjs";
|
|
11
|
+
import { takeUntil, Subject, BehaviorSubject, combineLatest, map, filter, distinctUntilChanged, first } from "rxjs";
|
|
12
12
|
import { ISidebarService, BuiltInUIPart, IUIPartsService, IMessageService, MenuItemType, MenuPosition, MenuGroup, getMenuHiddenObservable, KeyCode, ComponentManager, IMenuService, IShortcutService, CanvasFloatDomService } from "@univerjs/ui";
|
|
13
13
|
import { getSheetCommandTarget, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, InsertRowCommand, InsertColCommand, RemoveRowCommand, RemoveColCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, DeltaRowHeightCommand, SetRowHeightCommand, DeltaColumnWidthCommand, SetColWidthCommand, SetRowHiddenCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand, SetColHiddenCommand, SetRowVisibleMutation, SetRowHiddenMutation, SetColVisibleMutation, SetColHiddenMutation, SetWorksheetRowHeightMutation, SetWorksheetColWidthMutation, SetWorksheetActiveOperation, SheetInterceptorService, SetFrozenMutation, WorkbookViewPermission, WorksheetViewPermission } from "@univerjs/sheets";
|
|
14
14
|
import React, { useEffect, forwardRef, useRef, createElement, useState } from "react";
|
|
@@ -20,8 +20,8 @@ const ClearSheetDrawingTransformerOperation = {
|
|
|
20
20
|
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
21
21
|
const renderManagerService = accessor.get(IRenderManagerService);
|
|
22
22
|
return params.forEach((unitId) => {
|
|
23
|
-
var
|
|
24
|
-
(_b = (
|
|
23
|
+
var _a11, _b;
|
|
24
|
+
(_b = (_a11 = renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.scene.getTransformer()) == null || _b.debounceRefreshControls();
|
|
25
25
|
}), !0;
|
|
26
26
|
}, "handler")
|
|
27
27
|
}, RemoveSheetDrawingCommand = {
|
|
@@ -96,11 +96,11 @@ const ClearSheetDrawingTransformerOperation = {
|
|
|
96
96
|
};
|
|
97
97
|
}, [imageIoService]), /* @__PURE__ */ React.createElement("div", { style: { display: remain > 0 ? "block" : "none" }, className: styles$2.uploadLoading }, /* @__PURE__ */ React.createElement("div", { className: styles$2.uploadLoadingBody }, /* @__PURE__ */ React.createElement("div", { className: styles$2.uploadLoadingBodyAnimation }), /* @__PURE__ */ React.createElement("div", { className: styles$2.uploadLoadingBodyText }, `${localeService.t("uploadLoading.loading")}: ${remain}`)));
|
|
98
98
|
}, "UploadLoading");
|
|
99
|
-
var __defProp$
|
|
100
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
99
|
+
var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
100
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
101
101
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
102
|
-
return kind && result && __defProp$
|
|
103
|
-
}, "__decorateClass$
|
|
102
|
+
return kind && result && __defProp$9(target, key, result), result;
|
|
103
|
+
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a;
|
|
104
104
|
let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
105
105
|
constructor(_injector, _drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _uiPartsService) {
|
|
106
106
|
super();
|
|
@@ -128,8 +128,8 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
|
128
128
|
return !1;
|
|
129
129
|
}
|
|
130
130
|
_popupMenuListener(unitId) {
|
|
131
|
-
var
|
|
132
|
-
const scene = (
|
|
131
|
+
var _a11;
|
|
132
|
+
const scene = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.scene;
|
|
133
133
|
if (!scene)
|
|
134
134
|
return;
|
|
135
135
|
const transformer = scene.getTransformerByCreate();
|
|
@@ -210,15 +210,15 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
|
210
210
|
];
|
|
211
211
|
}
|
|
212
212
|
}, __name(_a, "DrawingPopupMenuController"), _a);
|
|
213
|
-
DrawingPopupMenuController = __decorateClass$
|
|
213
|
+
DrawingPopupMenuController = __decorateClass$9([
|
|
214
214
|
OnLifecycle(LifecycleStages.Steady, DrawingPopupMenuController),
|
|
215
|
-
__decorateParam$
|
|
216
|
-
__decorateParam$
|
|
217
|
-
__decorateParam$
|
|
218
|
-
__decorateParam$
|
|
219
|
-
__decorateParam$
|
|
220
|
-
__decorateParam$
|
|
221
|
-
__decorateParam$
|
|
215
|
+
__decorateParam$9(0, Inject(Injector)),
|
|
216
|
+
__decorateParam$9(1, IDrawingManagerService),
|
|
217
|
+
__decorateParam$9(2, Inject(SheetCanvasPopManagerService)),
|
|
218
|
+
__decorateParam$9(3, IRenderManagerService),
|
|
219
|
+
__decorateParam$9(4, IUniverInstanceService),
|
|
220
|
+
__decorateParam$9(5, IContextService),
|
|
221
|
+
__decorateParam$9(6, Inject(IUIPartsService))
|
|
222
222
|
], DrawingPopupMenuController);
|
|
223
223
|
const InsertFloatImageOperation = {
|
|
224
224
|
id: "sheet.operation.insert-float-image",
|
|
@@ -402,7 +402,7 @@ const GroupSheetDrawingCommand = {
|
|
|
402
402
|
}, "handler")
|
|
403
403
|
};
|
|
404
404
|
function drawingPositionToTransform(position, selectionRenderService, sheetSkeletonManagerService) {
|
|
405
|
-
const { from, to, flipY = !1, flipX = !1, angle = 0, skewX = 0, skewY = 0 } = position, { column: fromColumn, columnOffset: fromColumnOffset, row: fromRow, rowOffset: fromRowOffset } = from, { column: toColumn, columnOffset: toColumnOffset, row: toRow, rowOffset: toRowOffset } = to,
|
|
405
|
+
const { from, to, flipY = !1, flipX = !1, angle = 0, skewX = 0, skewY = 0 } = position, { column: fromColumn, columnOffset: fromColumnOffset, row: fromRow, rowOffset: fromRowOffset } = from, { column: toColumn, columnOffset: toColumnOffset, row: toRow, rowOffset: toRowOffset } = to, skeleton = sheetSkeletonManagerService.getCurrentSkeleton(), startSelectionCell = attachRangeWithCoord(skeleton, {
|
|
406
406
|
startColumn: fromColumn,
|
|
407
407
|
endColumn: fromColumn,
|
|
408
408
|
startRow: fromRow,
|
|
@@ -410,7 +410,7 @@ function drawingPositionToTransform(position, selectionRenderService, sheetSkele
|
|
|
410
410
|
});
|
|
411
411
|
if (startSelectionCell == null)
|
|
412
412
|
return;
|
|
413
|
-
const endSelectionCell =
|
|
413
|
+
const endSelectionCell = attachRangeWithCoord(skeleton, {
|
|
414
414
|
startColumn: toColumn,
|
|
415
415
|
endColumn: toColumn,
|
|
416
416
|
startRow: toRow,
|
|
@@ -421,7 +421,7 @@ function drawingPositionToTransform(position, selectionRenderService, sheetSkele
|
|
|
421
421
|
const { startX: startSelectionX, startY: startSelectionY } = startSelectionCell, { startX: endSelectionX, startY: endSelectionY } = endSelectionCell;
|
|
422
422
|
let left = precisionTo(startSelectionX + fromColumnOffset, 1), top = precisionTo(startSelectionY + fromRowOffset, 1), width = precisionTo(endSelectionX + toColumnOffset - left, 1), height = precisionTo(endSelectionY + toRowOffset - top, 1);
|
|
423
423
|
startSelectionCell.startX === endSelectionCell.endX && (width = 0), startSelectionCell.startY === endSelectionCell.endY && (height = 0);
|
|
424
|
-
const
|
|
424
|
+
const sheetWidth = skeleton.rowHeaderWidth + skeleton.columnTotalWidth, sheetHeight = skeleton.columnHeaderHeight + skeleton.rowTotalHeight;
|
|
425
425
|
return left + width > sheetWidth && (left = sheetWidth - width), top + height > sheetHeight && (top = sheetHeight - height), {
|
|
426
426
|
flipY,
|
|
427
427
|
flipX,
|
|
@@ -464,11 +464,11 @@ function transformToDrawingPosition(transform, selectionRenderService) {
|
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
466
|
__name(transformToDrawingPosition, "transformToDrawingPosition");
|
|
467
|
-
var __defProp$
|
|
468
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
467
|
+
var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
468
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
469
469
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
470
|
-
return kind && result && __defProp$
|
|
471
|
-
}, "__decorateClass$
|
|
470
|
+
return kind && result && __defProp$8(target, key, result), result;
|
|
471
|
+
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a2;
|
|
472
472
|
let SheetDrawingUpdateController = (_a2 = class extends Disposable {
|
|
473
473
|
constructor(_context, _skeletonManagerService, _commandService, _selectionRenderService, _imageIoService, _sheetDrawingService, _drawingManagerService, _contextService, _messageService, _localeService, selectionManagerService) {
|
|
474
474
|
super();
|
|
@@ -615,7 +615,7 @@ let SheetDrawingUpdateController = (_a2 = class extends Disposable {
|
|
|
615
615
|
if (transform == null)
|
|
616
616
|
return;
|
|
617
617
|
const sheetDrawing = this._sheetDrawingService.getDrawingByParam({ unitId, subUnitId, drawingId });
|
|
618
|
-
if (sheetDrawing == null)
|
|
618
|
+
if (sheetDrawing == null || sheetDrawing.unitId !== this._context.unitId)
|
|
619
619
|
return;
|
|
620
620
|
const sheetTransform = transformToDrawingPosition({ ...sheetDrawing.transform, ...transform }, this._selectionRenderService);
|
|
621
621
|
if (sheetTransform == null)
|
|
@@ -658,7 +658,7 @@ let SheetDrawingUpdateController = (_a2 = class extends Disposable {
|
|
|
658
658
|
_registerDrawing(params) {
|
|
659
659
|
params.forEach((param) => {
|
|
660
660
|
const drawingParam = this._sheetDrawingService.getDrawingByParam(param);
|
|
661
|
-
if (drawingParam == null)
|
|
661
|
+
if (drawingParam == null || drawingParam.unitId !== this._context.unitId)
|
|
662
662
|
return;
|
|
663
663
|
const { sheetTransform } = drawingParam;
|
|
664
664
|
drawingParam.transform = drawingPositionToTransform(sheetTransform, this._selectionRenderService, this._skeletonManagerService);
|
|
@@ -667,17 +667,17 @@ let SheetDrawingUpdateController = (_a2 = class extends Disposable {
|
|
|
667
667
|
this._drawingManagerService.registerDrawingData(unitId, this._sheetDrawingService.getDrawingDataForUnit(unitId)), this._drawingManagerService.initializeNotification(unitId);
|
|
668
668
|
}
|
|
669
669
|
}, __name(_a2, "SheetDrawingUpdateController"), _a2);
|
|
670
|
-
SheetDrawingUpdateController = __decorateClass$
|
|
671
|
-
__decorateParam$
|
|
672
|
-
__decorateParam$
|
|
673
|
-
__decorateParam$
|
|
674
|
-
__decorateParam$
|
|
675
|
-
__decorateParam$
|
|
676
|
-
__decorateParam$
|
|
677
|
-
__decorateParam$
|
|
678
|
-
__decorateParam$
|
|
679
|
-
__decorateParam$
|
|
680
|
-
__decorateParam$
|
|
670
|
+
SheetDrawingUpdateController = __decorateClass$8([
|
|
671
|
+
__decorateParam$8(1, Inject(SheetSkeletonManagerService)),
|
|
672
|
+
__decorateParam$8(2, ICommandService),
|
|
673
|
+
__decorateParam$8(3, ISheetSelectionRenderService),
|
|
674
|
+
__decorateParam$8(4, IImageIoService),
|
|
675
|
+
__decorateParam$8(5, ISheetDrawingService),
|
|
676
|
+
__decorateParam$8(6, IDrawingManagerService),
|
|
677
|
+
__decorateParam$8(7, IContextService),
|
|
678
|
+
__decorateParam$8(8, IMessageService),
|
|
679
|
+
__decorateParam$8(9, Inject(LocaleService)),
|
|
680
|
+
__decorateParam$8(10, Inject(SheetsSelectionsService))
|
|
681
681
|
], SheetDrawingUpdateController);
|
|
682
682
|
var __assign = function() {
|
|
683
683
|
return __assign = Object.assign || function(t) {
|
|
@@ -708,15 +708,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
|
708
708
|
var attrs = __assign({}, node.attrs);
|
|
709
709
|
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
710
710
|
var defIds = runtimeProps.defIds;
|
|
711
|
-
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(
|
|
712
|
-
var key =
|
|
711
|
+
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a11) {
|
|
712
|
+
var key = _a11[0], value = _a11[1];
|
|
713
713
|
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
714
714
|
})), attrs;
|
|
715
715
|
}
|
|
716
716
|
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
717
717
|
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
718
|
-
var
|
|
719
|
-
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((
|
|
718
|
+
var _a11, defIds = runtimeProps.defIds;
|
|
719
|
+
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a11 = node.children) === null || _a11 === void 0) && _a11.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
|
720
720
|
return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
|
|
721
721
|
}) }) : node;
|
|
722
722
|
}
|
|
@@ -741,8 +741,8 @@ const uploadFileMenu = "univer-upload-file-menu", uploadFileMenuInput = "univer-
|
|
|
741
741
|
var UploadFileType = /* @__PURE__ */ ((UploadFileType2) => (UploadFileType2[UploadFileType2.cellImage = 0] = "cellImage", UploadFileType2[UploadFileType2.floatImage = 1] = "floatImage", UploadFileType2))(UploadFileType || {});
|
|
742
742
|
const UploadFileMenu = /* @__PURE__ */ __name((props) => {
|
|
743
743
|
const { type } = props, commandService = useDependency(ICommandService), fileInputRef = useRef(null), handleButtonClick = /* @__PURE__ */ __name(() => {
|
|
744
|
-
var
|
|
745
|
-
(
|
|
744
|
+
var _a11;
|
|
745
|
+
(_a11 = fileInputRef.current) == null || _a11.click();
|
|
746
746
|
}, "handleButtonClick"), imageAccept = DRAWING_IMAGE_ALLOW_IMAGE_LIST.map((image) => `.${image.replace("image/", "")}`).join(","), handleFileChange = /* @__PURE__ */ __name((event) => {
|
|
747
747
|
const fileList = event.target.files;
|
|
748
748
|
if (fileList == null)
|
|
@@ -808,14 +808,14 @@ const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "un
|
|
|
808
808
|
sheetImageMenu,
|
|
809
809
|
sheetImageMenuInput
|
|
810
810
|
}, SheetDrawingAnchor = /* @__PURE__ */ __name((props) => {
|
|
811
|
-
var
|
|
811
|
+
var _a11;
|
|
812
812
|
const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), drawingManagerService = useDependency(IDrawingManagerService), renderManagerService = useDependency(IRenderManagerService), { drawings } = props, drawingParam = drawings[0];
|
|
813
813
|
if (drawingParam == null)
|
|
814
814
|
return;
|
|
815
815
|
const { unitId } = drawingParam, renderObject = renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
816
816
|
if (scene == null)
|
|
817
817
|
return;
|
|
818
|
-
const transformer = scene.getTransformerByCreate(), [anchorShow, setAnchorShow] = useState(!0), type = (
|
|
818
|
+
const transformer = scene.getTransformerByCreate(), [anchorShow, setAnchorShow] = useState(!0), type = (_a11 = drawingParam.anchorType) != null ? _a11 : SheetDrawingAnchorType.Position, [value, setValue] = useState(type);
|
|
819
819
|
function getUpdateParams(objects, drawingManagerService2) {
|
|
820
820
|
const params = [];
|
|
821
821
|
return objects.forEach((object) => {
|
|
@@ -837,13 +837,13 @@ const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "un
|
|
|
837
837
|
const onClearControlObserver = transformer.clearControl$.subscribe((changeSelf) => {
|
|
838
838
|
changeSelf === !0 && setAnchorShow(!1);
|
|
839
839
|
}), onChangeStartObserver = transformer.changeStart$.subscribe((state) => {
|
|
840
|
-
var
|
|
840
|
+
var _a12;
|
|
841
841
|
const { objects } = state, params = getUpdateParams(objects, drawingManagerService);
|
|
842
842
|
if (params.length === 0)
|
|
843
843
|
setAnchorShow(!1);
|
|
844
844
|
else if (params.length >= 1) {
|
|
845
845
|
setAnchorShow(!0);
|
|
846
|
-
const anchorType = ((
|
|
846
|
+
const anchorType = ((_a12 = params[0]) == null ? void 0 : _a12.anchorType) || SheetDrawingAnchorType.Position;
|
|
847
847
|
setValue(anchorType);
|
|
848
848
|
}
|
|
849
849
|
});
|
|
@@ -978,11 +978,11 @@ const MoveDrawingDownShortcutItem = {
|
|
|
978
978
|
binding: KeyCode.DELETE,
|
|
979
979
|
mac: KeyCode.BACKSPACE
|
|
980
980
|
};
|
|
981
|
-
var __defProp$
|
|
982
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
981
|
+
var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
982
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
983
983
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
984
|
-
return kind && result && __defProp$
|
|
985
|
-
}, "__decorateClass$
|
|
984
|
+
return kind && result && __defProp$7(target, key, result), result;
|
|
985
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7");
|
|
986
986
|
const DefaultSheetsDrawingConfig = {};
|
|
987
987
|
var _a3;
|
|
988
988
|
let SheetDrawingUIController = (_a3 = class extends Disposable {
|
|
@@ -1036,19 +1036,19 @@ let SheetDrawingUIController = (_a3 = class extends Disposable {
|
|
|
1036
1036
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
1037
1037
|
}
|
|
1038
1038
|
}, __name(_a3, "SheetDrawingUIController"), _a3);
|
|
1039
|
-
SheetDrawingUIController = __decorateClass$
|
|
1039
|
+
SheetDrawingUIController = __decorateClass$7([
|
|
1040
1040
|
OnLifecycle(LifecycleStages.Rendered, SheetDrawingUIController),
|
|
1041
|
-
__decorateParam$
|
|
1042
|
-
__decorateParam$
|
|
1043
|
-
__decorateParam$
|
|
1044
|
-
__decorateParam$
|
|
1045
|
-
__decorateParam$
|
|
1041
|
+
__decorateParam$7(1, Inject(Injector)),
|
|
1042
|
+
__decorateParam$7(2, Inject(ComponentManager)),
|
|
1043
|
+
__decorateParam$7(3, IMenuService),
|
|
1044
|
+
__decorateParam$7(4, ICommandService),
|
|
1045
|
+
__decorateParam$7(5, IShortcutService)
|
|
1046
1046
|
], SheetDrawingUIController);
|
|
1047
|
-
var __defProp$
|
|
1048
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1047
|
+
var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1048
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1049
1049
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1050
|
-
return kind && result && __defProp$
|
|
1051
|
-
}, "__decorateClass$
|
|
1050
|
+
return kind && result && __defProp$6(target, key, result), result;
|
|
1051
|
+
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6");
|
|
1052
1052
|
const UPDATE_COMMANDS = [
|
|
1053
1053
|
InsertRowCommand.id,
|
|
1054
1054
|
InsertColCommand.id,
|
|
@@ -1738,20 +1738,20 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
|
1738
1738
|
}), updateDrawings.length !== 0 && (this._drawingManagerService.refreshTransform(updateDrawings), this._commandService.syncExecuteCommand(ClearSheetDrawingTransformerOperation.id, [unitId]));
|
|
1739
1739
|
}
|
|
1740
1740
|
}, __name(_a4, "SheetDrawingTransformAffectedController"), _a4);
|
|
1741
|
-
SheetDrawingTransformAffectedController = __decorateClass$
|
|
1742
|
-
__decorateParam$
|
|
1743
|
-
__decorateParam$
|
|
1744
|
-
__decorateParam$
|
|
1745
|
-
__decorateParam$
|
|
1746
|
-
__decorateParam$
|
|
1747
|
-
__decorateParam$
|
|
1748
|
-
__decorateParam$
|
|
1741
|
+
SheetDrawingTransformAffectedController = __decorateClass$6([
|
|
1742
|
+
__decorateParam$6(1, ICommandService),
|
|
1743
|
+
__decorateParam$6(2, ISheetSelectionRenderService),
|
|
1744
|
+
__decorateParam$6(3, Inject(SheetSkeletonManagerService)),
|
|
1745
|
+
__decorateParam$6(4, Inject(SheetInterceptorService)),
|
|
1746
|
+
__decorateParam$6(5, ISheetDrawingService),
|
|
1747
|
+
__decorateParam$6(6, IDrawingManagerService),
|
|
1748
|
+
__decorateParam$6(7, IUniverInstanceService)
|
|
1749
1749
|
], SheetDrawingTransformAffectedController);
|
|
1750
|
-
var __defProp$
|
|
1751
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1750
|
+
var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1751
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1752
1752
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1753
|
-
return kind && result && __defProp$
|
|
1754
|
-
}, "__decorateClass$
|
|
1753
|
+
return kind && result && __defProp$5(target, key, result), result;
|
|
1754
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5");
|
|
1755
1755
|
function transformBound2DOMBound(originBound, scene, skeleton, worksheet) {
|
|
1756
1756
|
const { scaleX, scaleY } = scene.getAncestorScale(), viewMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN), absolute = {
|
|
1757
1757
|
left: !0,
|
|
@@ -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
|
|
1791
|
+
const { scene } = currentRender, { left, top, width, height, angle } = targetObject, 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,
|
|
1799
|
+
endX: offsetBound.right,
|
|
1800
|
+
startY: offsetBound.top,
|
|
1801
|
+
endY: offsetBound.bottom,
|
|
1802
1802
|
rotate: angle,
|
|
1803
|
-
width
|
|
1804
|
-
height
|
|
1803
|
+
width,
|
|
1804
|
+
height,
|
|
1805
1805
|
absolute: offsetBound.absolute
|
|
1806
1806
|
};
|
|
1807
1807
|
}, "calcPosition");
|
|
@@ -1845,8 +1845,8 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1845
1845
|
// eslint-disable-next-line max-lines-per-function
|
|
1846
1846
|
this._drawingManagerService.add$.subscribe((params) => {
|
|
1847
1847
|
params.forEach((param) => {
|
|
1848
|
-
var
|
|
1849
|
-
const { unitId, subUnitId, drawingId } = param, target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), floatDomParam = this._drawingManagerService.getDrawingByParam(param), skeleton = (
|
|
1848
|
+
var _a11, _b, _c;
|
|
1849
|
+
const { unitId, subUnitId, drawingId } = param, target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), floatDomParam = this._drawingManagerService.getDrawingByParam(param), skeleton = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
|
|
1850
1850
|
if (floatDomParam == null || target == null || skeleton == null)
|
|
1851
1851
|
return;
|
|
1852
1852
|
const { transform, drawingType, data } = floatDomParam;
|
|
@@ -1895,7 +1895,8 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1895
1895
|
canvas.dispatchEvent(new WheelEvent(evt.type, evt));
|
|
1896
1896
|
}, "onWheel"),
|
|
1897
1897
|
props: (_c = (_b = map2.get(drawingId)) == null ? void 0 : _b.props) != null ? _c : this._getFloatDomProps(drawingId),
|
|
1898
|
-
data
|
|
1898
|
+
data,
|
|
1899
|
+
unitId
|
|
1899
1900
|
});
|
|
1900
1901
|
const listener = rect.onTransformChange$.subscribeEvent(() => {
|
|
1901
1902
|
const newPosition = calcPosition(rect, renderObject.renderObject, skeleton.skeleton, target.worksheet);
|
|
@@ -1914,10 +1915,10 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1914
1915
|
}
|
|
1915
1916
|
_scrollUpdateListener() {
|
|
1916
1917
|
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
1917
|
-
var
|
|
1918
|
+
var _a11, _b;
|
|
1918
1919
|
const updateSheet = /* @__PURE__ */ __name((unitId, subUnitId) => {
|
|
1919
|
-
var
|
|
1920
|
-
const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId), map2 = this._ensureMap(unitId, subUnitId), ids = Array.from(map2.keys()), target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), skeleton = (
|
|
1920
|
+
var _a12;
|
|
1921
|
+
const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId), map2 = this._ensureMap(unitId, subUnitId), ids = Array.from(map2.keys()), target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), skeleton = (_a12 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a12.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
|
|
1921
1922
|
!renderObject || !target || !skeleton || ids.forEach((id) => {
|
|
1922
1923
|
const info = this._domLayerInfoMap.get(id);
|
|
1923
1924
|
if (info) {
|
|
@@ -1931,7 +1932,7 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1931
1932
|
updateSheet(unitId, sheetId);
|
|
1932
1933
|
} else if (commandInfo.id === SetZoomRatioOperation.id) {
|
|
1933
1934
|
const params = commandInfo.params, { unitId } = params;
|
|
1934
|
-
Array.from((_b = (
|
|
1935
|
+
Array.from((_b = (_a11 = this._domLayerMap.get(unitId)) == null ? void 0 : _a11.keys()) != null ? _b : []).forEach((subUnitId) => {
|
|
1935
1936
|
updateSheet(unitId, subUnitId);
|
|
1936
1937
|
});
|
|
1937
1938
|
} else if (commandInfo.id === SetFrozenMutation.id) {
|
|
@@ -1941,8 +1942,8 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1941
1942
|
}));
|
|
1942
1943
|
}
|
|
1943
1944
|
_getPosition(position, unitId) {
|
|
1944
|
-
var
|
|
1945
|
-
const { startX, endX, startY, endY } = position, selectionRenderService = (
|
|
1945
|
+
var _a11;
|
|
1946
|
+
const { startX, endX, startY, endY } = position, selectionRenderService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(ISheetSelectionRenderService);
|
|
1946
1947
|
if (selectionRenderService == null)
|
|
1947
1948
|
return;
|
|
1948
1949
|
const start = selectionRenderService.getSelectionCellByPosition(startX, startY);
|
|
@@ -2052,20 +2053,20 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
2052
2053
|
};
|
|
2053
2054
|
}
|
|
2054
2055
|
}, __name(_a5, "SheetCanvasFloatDomManagerService"), _a5);
|
|
2055
|
-
SheetCanvasFloatDomManagerService = __decorateClass$
|
|
2056
|
+
SheetCanvasFloatDomManagerService = __decorateClass$5([
|
|
2056
2057
|
OnLifecycle(LifecycleStages.Starting, SheetCanvasFloatDomManagerService),
|
|
2057
|
-
__decorateParam$
|
|
2058
|
-
__decorateParam$
|
|
2059
|
-
__decorateParam$
|
|
2060
|
-
__decorateParam$
|
|
2061
|
-
__decorateParam$
|
|
2062
|
-
__decorateParam$
|
|
2058
|
+
__decorateParam$5(0, Inject(IRenderManagerService)),
|
|
2059
|
+
__decorateParam$5(1, IUniverInstanceService),
|
|
2060
|
+
__decorateParam$5(2, Inject(ICommandService)),
|
|
2061
|
+
__decorateParam$5(3, IDrawingManagerService),
|
|
2062
|
+
__decorateParam$5(4, Inject(CanvasFloatDomService)),
|
|
2063
|
+
__decorateParam$5(5, ISheetDrawingService)
|
|
2063
2064
|
], SheetCanvasFloatDomManagerService);
|
|
2064
|
-
var __defProp$
|
|
2065
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
2065
|
+
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2066
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2066
2067
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2067
|
-
return kind && result && __defProp$
|
|
2068
|
-
}, "__decorateClass$
|
|
2068
|
+
return kind && result && __defProp$4(target, key, result), result;
|
|
2069
|
+
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a6;
|
|
2069
2070
|
let SheetDrawingPrintingController = (_a6 = class extends Disposable {
|
|
2070
2071
|
constructor(_sheetPrintInterceptorService, _drawingRenderService, _drawingManagerService, _renderManagerService) {
|
|
2071
2072
|
super(), this._sheetPrintInterceptorService = _sheetPrintInterceptorService, this._drawingRenderService = _drawingRenderService, this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._initPrinting();
|
|
@@ -2110,18 +2111,18 @@ let SheetDrawingPrintingController = (_a6 = class extends Disposable {
|
|
|
2110
2111
|
);
|
|
2111
2112
|
}
|
|
2112
2113
|
}, __name(_a6, "SheetDrawingPrintingController"), _a6);
|
|
2113
|
-
SheetDrawingPrintingController = __decorateClass$
|
|
2114
|
+
SheetDrawingPrintingController = __decorateClass$4([
|
|
2114
2115
|
OnLifecycle(LifecycleStages.Rendered, SheetDrawingPrintingController),
|
|
2115
|
-
__decorateParam$
|
|
2116
|
-
__decorateParam$
|
|
2117
|
-
__decorateParam$
|
|
2118
|
-
__decorateParam$
|
|
2116
|
+
__decorateParam$4(0, Inject(SheetPrintInterceptorService)),
|
|
2117
|
+
__decorateParam$4(1, Inject(DrawingRenderService)),
|
|
2118
|
+
__decorateParam$4(2, IDrawingManagerService),
|
|
2119
|
+
__decorateParam$4(3, IRenderManagerService)
|
|
2119
2120
|
], SheetDrawingPrintingController);
|
|
2120
|
-
var __defProp$
|
|
2121
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
2121
|
+
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2122
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2122
2123
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2123
|
-
return kind && result && __defProp$
|
|
2124
|
-
}, "__decorateClass$
|
|
2124
|
+
return kind && result && __defProp$3(target, key, result), result;
|
|
2125
|
+
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a7;
|
|
2125
2126
|
let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
2126
2127
|
constructor(_drawingManagerService, _renderManagerService, _permissionService, _univerInstanceService, _userManagerService) {
|
|
2127
2128
|
super(), this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._univerInstanceService = _univerInstanceService, this._userManagerService = _userManagerService, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
@@ -2189,7 +2190,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
|
2189
2190
|
this.disposeWithMe(
|
|
2190
2191
|
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
2191
2192
|
workbook && workbook.activeSheet$.subscribe((sheet) => {
|
|
2192
|
-
var
|
|
2193
|
+
var _a11;
|
|
2193
2194
|
if (!sheet)
|
|
2194
2195
|
return;
|
|
2195
2196
|
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
@@ -2209,7 +2210,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
|
2209
2210
|
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
|
|
2210
2211
|
}), transformer.clearSelectedObjects());
|
|
2211
2212
|
}, "next")
|
|
2212
|
-
}), (
|
|
2213
|
+
}), (_a11 = this._permissionService.getPermissionPoint$(new WorksheetViewPermission(unitId, subUnitId).id)) == null || _a11.pipe(
|
|
2213
2214
|
filter((permission) => permission.value !== initialViewPermission),
|
|
2214
2215
|
distinctUntilChanged()
|
|
2215
2216
|
).subscribe({
|
|
@@ -2228,7 +2229,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
|
2228
2229
|
this.disposeWithMe(
|
|
2229
2230
|
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
2230
2231
|
workbook && workbook.activeSheet$.subscribe((sheet) => {
|
|
2231
|
-
var
|
|
2232
|
+
var _a11;
|
|
2232
2233
|
if (!sheet)
|
|
2233
2234
|
return;
|
|
2234
2235
|
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
@@ -2250,7 +2251,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
|
2250
2251
|
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.detachTransformerFrom(object);
|
|
2251
2252
|
}), transformer.clearSelectedObjects());
|
|
2252
2253
|
}, "next")
|
|
2253
|
-
}), (
|
|
2254
|
+
}), (_a11 = this._permissionService.getPermissionPoint$(new WorksheetEditPermission(unitId, subUnitId).id)) == null || _a11.pipe(
|
|
2254
2255
|
filter((permission) => permission.value !== initialEditPermission),
|
|
2255
2256
|
distinctUntilChanged()
|
|
2256
2257
|
).subscribe({
|
|
@@ -2269,19 +2270,19 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
|
2269
2270
|
);
|
|
2270
2271
|
}
|
|
2271
2272
|
}, __name(_a7, "SheetDrawingPermissionController"), _a7);
|
|
2272
|
-
SheetDrawingPermissionController = __decorateClass$
|
|
2273
|
+
SheetDrawingPermissionController = __decorateClass$3([
|
|
2273
2274
|
OnLifecycle(LifecycleStages.Rendered, SheetDrawingPermissionController),
|
|
2274
|
-
__decorateParam$
|
|
2275
|
-
__decorateParam$
|
|
2276
|
-
__decorateParam$
|
|
2277
|
-
__decorateParam$
|
|
2278
|
-
__decorateParam$
|
|
2275
|
+
__decorateParam$3(0, IDrawingManagerService),
|
|
2276
|
+
__decorateParam$3(1, IRenderManagerService),
|
|
2277
|
+
__decorateParam$3(2, IPermissionService),
|
|
2278
|
+
__decorateParam$3(3, IUniverInstanceService),
|
|
2279
|
+
__decorateParam$3(4, Inject(UserManagerService))
|
|
2279
2280
|
], SheetDrawingPermissionController);
|
|
2280
|
-
var __defProp$
|
|
2281
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
2281
|
+
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2282
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2282
2283
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2283
|
-
return kind && result && __defProp$
|
|
2284
|
-
}, "__decorateClass$
|
|
2284
|
+
return kind && result && __defProp$2(target, key, result), result;
|
|
2285
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a8;
|
|
2285
2286
|
let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
|
|
2286
2287
|
constructor(_sheetClipboardService, _renderManagerService, _sheetDrawingService) {
|
|
2287
2288
|
super();
|
|
@@ -2300,8 +2301,8 @@ let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
|
|
|
2300
2301
|
});
|
|
2301
2302
|
}
|
|
2302
2303
|
_collect(unitId, subUnitId, range) {
|
|
2303
|
-
var
|
|
2304
|
-
const skeletonManagetService = (
|
|
2304
|
+
var _a11;
|
|
2305
|
+
const skeletonManagetService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService);
|
|
2305
2306
|
if (!skeletonManagetService) return;
|
|
2306
2307
|
const selectionRect = skeletonManagetService.attachRangeWithCoord(range);
|
|
2307
2308
|
if (!selectionRect)
|
|
@@ -2326,7 +2327,7 @@ let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
|
|
|
2326
2327
|
}
|
|
2327
2328
|
// eslint-disable-next-line max-lines-per-function
|
|
2328
2329
|
_generateMutations(pastedRange, copyInfo) {
|
|
2329
|
-
var
|
|
2330
|
+
var _a11;
|
|
2330
2331
|
if (!this._copyInfo)
|
|
2331
2332
|
return { redos: [], undos: [] };
|
|
2332
2333
|
if ([
|
|
@@ -2341,7 +2342,7 @@ let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
|
|
|
2341
2342
|
const { copyRange } = copyInfo;
|
|
2342
2343
|
if (!copyRange)
|
|
2343
2344
|
return { redos: [], undos: [] };
|
|
2344
|
-
const { drawings, unitId, subUnitId } = this._copyInfo, { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyRange, pastedRange]), { row: copyRow, col: copyCol } = mapFunc(vCopyRange.startRow, vCopyRange.startColumn), { row: pasteRow, col: pasteCol } = mapFunc(vPastedRange.startRow, vPastedRange.startColumn), skeletonManagetService = (
|
|
2345
|
+
const { drawings, unitId, subUnitId } = this._copyInfo, { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyRange, pastedRange]), { row: copyRow, col: copyCol } = mapFunc(vCopyRange.startRow, vCopyRange.startColumn), { row: pasteRow, col: pasteCol } = mapFunc(vPastedRange.startRow, vPastedRange.startColumn), skeletonManagetService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService);
|
|
2345
2346
|
if (!skeletonManagetService)
|
|
2346
2347
|
return { redos: [], undos: [] };
|
|
2347
2348
|
const copyRect = skeletonManagetService.attachRangeWithCoord({
|
|
@@ -2408,20 +2409,42 @@ let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
|
|
|
2408
2409
|
};
|
|
2409
2410
|
}
|
|
2410
2411
|
}, __name(_a8, "SheetsDrawingCopyPasteController"), _a8);
|
|
2411
|
-
SheetsDrawingCopyPasteController = __decorateClass$
|
|
2412
|
+
SheetsDrawingCopyPasteController = __decorateClass$2([
|
|
2412
2413
|
OnLifecycle(LifecycleStages.Ready, SheetsDrawingCopyPasteController),
|
|
2413
|
-
__decorateParam$
|
|
2414
|
-
__decorateParam$
|
|
2415
|
-
__decorateParam$
|
|
2414
|
+
__decorateParam$2(0, ISheetClipboardService),
|
|
2415
|
+
__decorateParam$2(1, IRenderManagerService),
|
|
2416
|
+
__decorateParam$2(2, ISheetDrawingService)
|
|
2416
2417
|
], SheetsDrawingCopyPasteController);
|
|
2418
|
+
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2419
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2420
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2421
|
+
return kind && result && __defProp$1(target, key, result), result;
|
|
2422
|
+
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a9;
|
|
2423
|
+
let SheetsDrawingRenderController = (_a9 = class extends Disposable {
|
|
2424
|
+
constructor(_context, _sheetDrawingService, _lifecycleService) {
|
|
2425
|
+
super(), this._context = _context, this._sheetDrawingService = _sheetDrawingService, this._lifecycleService = _lifecycleService, this._init();
|
|
2426
|
+
}
|
|
2427
|
+
_init() {
|
|
2428
|
+
this._drawingInitializeListener();
|
|
2429
|
+
}
|
|
2430
|
+
_drawingInitializeListener() {
|
|
2431
|
+
this._lifecycleService.lifecycle$.pipe(filter((e) => e === LifecycleStages.Steady), first()).subscribe(() => {
|
|
2432
|
+
this._context.type === UniverInstanceType.UNIVER_SHEET && this._sheetDrawingService.initializeNotification(this._context.unitId);
|
|
2433
|
+
});
|
|
2434
|
+
}
|
|
2435
|
+
}, __name(_a9, "SheetsDrawingRenderController"), _a9);
|
|
2436
|
+
SheetsDrawingRenderController = __decorateClass$1([
|
|
2437
|
+
__decorateParam$1(1, ISheetDrawingService),
|
|
2438
|
+
__decorateParam$1(2, Inject(LifecycleService))
|
|
2439
|
+
], SheetsDrawingRenderController);
|
|
2417
2440
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2418
2441
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2419
2442
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2420
2443
|
return kind && result && __defProp2(target, key, result), result;
|
|
2421
2444
|
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField");
|
|
2422
2445
|
const PLUGIN_NAME = "SHEET_IMAGE_UI_PLUGIN";
|
|
2423
|
-
var
|
|
2424
|
-
let UniverSheetsDrawingUIPlugin = (
|
|
2446
|
+
var _a10;
|
|
2447
|
+
let UniverSheetsDrawingUIPlugin = (_a10 = class extends Plugin {
|
|
2425
2448
|
constructor(config = {}, _injector, _localeService, _renderManagerService) {
|
|
2426
2449
|
super();
|
|
2427
2450
|
__publicField(this, "_pluginConfig");
|
|
@@ -2448,12 +2471,13 @@ let UniverSheetsDrawingUIPlugin = (_a9 = class extends Plugin {
|
|
|
2448
2471
|
_registerRenderModules() {
|
|
2449
2472
|
[
|
|
2450
2473
|
[SheetDrawingUpdateController],
|
|
2451
|
-
[SheetDrawingTransformAffectedController]
|
|
2474
|
+
[SheetDrawingTransformAffectedController],
|
|
2475
|
+
[SheetsDrawingRenderController]
|
|
2452
2476
|
].forEach((m) => {
|
|
2453
2477
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
|
|
2454
2478
|
});
|
|
2455
2479
|
}
|
|
2456
|
-
}, __name(
|
|
2480
|
+
}, __name(_a10, "UniverSheetsDrawingUIPlugin"), _a10);
|
|
2457
2481
|
__publicField2(UniverSheetsDrawingUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
2458
2482
|
__publicField2(UniverSheetsDrawingUIPlugin, "pluginName", PLUGIN_NAME);
|
|
2459
2483
|
UniverSheetsDrawingUIPlugin = __decorateClass([
|