@univerjs/sheets-drawing-ui 0.4.2-nightly.202410291606 → 0.4.2-nightly.202410301606
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/canvas-float-dom-manager.service-DT1kY3QQ.mjs +409 -0
- package/lib/es/facade.js +20 -0
- package/lib/es/index.js +127 -513
- package/lib/locale/en-US.js +44 -0
- package/lib/locale/fa-IR.js +44 -0
- package/lib/locale/ru-RU.js +44 -0
- package/lib/locale/vi-VN.js +44 -0
- package/lib/locale/zh-CN.js +44 -0
- package/lib/locale/zh-TW.js +44 -0
- package/lib/types/facade/f-worksheet.d.ts +22 -0
- package/lib/types/facade/index.d.ts +0 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +9 -1
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +24 -22
- package/lib/cjs/index.js +0 -1
- package/lib/locale/en-US.json +0 -41
- package/lib/locale/fa-IR.json +0 -41
- package/lib/locale/ru-RU.json +0 -41
- package/lib/locale/vi-VN.json +0 -41
- package/lib/locale/zh-CN.json +0 -41
- package/lib/locale/zh-TW.json +0 -41
package/lib/es/index.js
CHANGED
|
@@ -2,47 +2,40 @@ 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, Inject, Injector, IContextService, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, Disposable, Direction, FOCUSING_FX_BAR_EDITOR, EDITOR_ACTIVATED, Tools, UserManagerService, IPermissionService, Rectangle,
|
|
6
|
-
import { IDrawingManagerService, IImageIoService, DrawingTypeEnum, ArrangeTypeEnum, DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_COUNT_LIMIT, ImageUploadStatusType, DRAWING_IMAGE_ALLOW_SIZE, getImageSize, DRAWING_IMAGE_WIDTH_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT,
|
|
5
|
+
import { CommandType, ICommandService, IUndoRedoService, sequenceExecute, LocaleService, IUniverInstanceService, useDependency, Inject, Injector, IContextService, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, Disposable, Direction, FOCUSING_FX_BAR_EDITOR, EDITOR_ACTIVATED, Tools, UserManagerService, IPermissionService, Rectangle, DependentOn, Plugin, registerDependencies, touchDependencies, IConfigService } from "@univerjs/core";
|
|
6
|
+
import { IDrawingManagerService, IImageIoService, DrawingTypeEnum, ArrangeTypeEnum, DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_COUNT_LIMIT, ImageUploadStatusType, DRAWING_IMAGE_ALLOW_SIZE, getImageSize, DRAWING_IMAGE_WIDTH_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, UniverDrawingPlugin } from "@univerjs/drawing";
|
|
7
7
|
import { ImageCropperObject, COMPONENT_IMAGE_POPUP_MENU, OpenImageCropOperation, ImageResetSizeOperation, DrawingCommonPanel, DrawingRenderService, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
|
|
8
|
-
import { IRenderManagerService, precisionTo, getGroupState, transformObjectOutOfGroup, RENDER_CLASS_TYPE
|
|
8
|
+
import { IRenderManagerService, precisionTo, getGroupState, transformObjectOutOfGroup, RENDER_CLASS_TYPE } from "@univerjs/engine-render";
|
|
9
9
|
import { ISheetDrawingService, SetDrawingApplyMutation, DrawingApplyType, SheetDrawingAnchorType, UniverSheetsDrawingPlugin } from "@univerjs/sheets-drawing";
|
|
10
|
-
import { SheetCanvasPopManagerService, attachRangeWithCoord, ISheetSelectionRenderService, SheetSkeletonManagerService, getCurrentRangeDisable$, COPY_TYPE, PREDEFINED_HOOK_NAME, virtualizeDiscreteRanges, ISheetClipboardService, SheetPrintInterceptorService
|
|
11
|
-
import { ISidebarService, IUIPartsService, BuiltInUIPart, ILocalFileService, IMessageService, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, KeyCode, ComponentManager, IMenuManagerService, IShortcutService
|
|
12
|
-
import { takeUntil, combineLatest, map, filter, distinctUntilChanged
|
|
13
|
-
import { getSheetCommandTarget, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, WorkbookViewPermission, WorksheetViewPermission, InsertRowCommand, InsertColCommand, RemoveRowCommand, RemoveColCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, DeltaRowHeightCommand, SetRowHeightCommand, DeltaColumnWidthCommand, SetColWidthCommand, SetRowHiddenCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand, SetColHiddenCommand, MoveColsCommand, MoveRowsCommand, MoveRangeCommand, SetRowVisibleMutation, SetRowHiddenMutation, SetColVisibleMutation, SetColHiddenMutation, SetWorksheetRowHeightMutation, SetWorksheetColWidthMutation,
|
|
10
|
+
import { SheetCanvasPopManagerService, attachRangeWithCoord, ISheetSelectionRenderService, SheetSkeletonManagerService, getCurrentRangeDisable$, COPY_TYPE, PREDEFINED_HOOK_NAME, virtualizeDiscreteRanges, ISheetClipboardService, SheetPrintInterceptorService } from "@univerjs/sheets-ui";
|
|
11
|
+
import { ISidebarService, IUIPartsService, BuiltInUIPart, ILocalFileService, IMessageService, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, KeyCode, ComponentManager, IMenuManagerService, IShortcutService } from "@univerjs/ui";
|
|
12
|
+
import { takeUntil, combineLatest, map, filter, distinctUntilChanged } from "rxjs";
|
|
13
|
+
import { SheetInterceptorService, getSheetCommandTarget, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, WorkbookViewPermission, WorksheetViewPermission, InsertRowCommand, InsertColCommand, RemoveRowCommand, RemoveColCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, DeltaRowHeightCommand, SetRowHeightCommand, DeltaColumnWidthCommand, SetColWidthCommand, SetRowHiddenCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand, SetColHiddenCommand, MoveColsCommand, MoveRowsCommand, MoveRangeCommand, SetRowVisibleMutation, SetRowHiddenMutation, SetColVisibleMutation, SetColHiddenMutation, SetWorksheetRowHeightMutation, SetWorksheetColWidthMutation, SetWorksheetActiveOperation } from "@univerjs/sheets";
|
|
14
|
+
import { C as ClearSheetDrawingTransformerOperation, I as InsertSheetDrawingCommand, S as SheetCanvasFloatDomManagerService } from "../canvas-float-dom-manager.service-DT1kY3QQ.mjs";
|
|
14
15
|
import React, { useEffect, forwardRef, useRef, createElement, useState } from "react";
|
|
15
16
|
import { MessageType, RadioGroup, Radio } from "@univerjs/design";
|
|
16
|
-
const PLUGIN_CONFIG_KEY = "sheets-drawing-ui.config", defaultPluginConfig = {},
|
|
17
|
-
id: "sheet.operation.clear-drawing-transformer",
|
|
18
|
-
type: CommandType.MUTATION,
|
|
19
|
-
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
20
|
-
const renderManagerService = accessor.get(IRenderManagerService);
|
|
21
|
-
return params.forEach((unitId) => {
|
|
22
|
-
var _a11, _b;
|
|
23
|
-
(_b = (_a11 = renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.scene.getTransformer()) == null || _b.debounceRefreshControls();
|
|
24
|
-
}), !0;
|
|
25
|
-
}, "handler")
|
|
26
|
-
}, RemoveSheetDrawingCommand = {
|
|
17
|
+
const PLUGIN_CONFIG_KEY = "sheets-drawing-ui.config", defaultPluginConfig = {}, RemoveSheetDrawingCommand = {
|
|
27
18
|
id: "sheet.command.remove-sheet-image",
|
|
28
19
|
type: CommandType.COMMAND,
|
|
29
20
|
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
30
|
-
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetDrawingService = accessor.get(ISheetDrawingService);
|
|
21
|
+
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetInterceptorService = accessor.get(SheetInterceptorService), sheetDrawingService = accessor.get(ISheetDrawingService);
|
|
31
22
|
if (!params) return !1;
|
|
32
23
|
const { drawings } = params, unitIds = [];
|
|
33
24
|
drawings.forEach((param) => {
|
|
34
25
|
const { unitId: unitId2 } = param;
|
|
35
26
|
unitIds.push(unitId2);
|
|
36
27
|
});
|
|
37
|
-
const jsonOp = sheetDrawingService.getBatchRemoveOp(drawings), { unitId, subUnitId, undo, redo, objects } = jsonOp;
|
|
38
|
-
return
|
|
28
|
+
const jsonOp = sheetDrawingService.getBatchRemoveOp(drawings), { unitId, subUnitId, undo, redo, objects } = jsonOp, intercepted = sheetInterceptorService.onCommandExecute({ id: RemoveSheetDrawingCommand.id, params }), removeMutation = { id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.REMOVE } }, undoRemoveMutation = { id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: undo, objects, type: DrawingApplyType.INSERT } };
|
|
29
|
+
return sequenceExecute([removeMutation, ...intercepted.redos], commandService) ? (undoRedoService.pushUndoRedo({
|
|
39
30
|
unitID: unitId,
|
|
40
31
|
undoMutations: [
|
|
41
|
-
|
|
32
|
+
...intercepted.undos,
|
|
33
|
+
undoRemoveMutation,
|
|
42
34
|
{ id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
|
|
43
35
|
],
|
|
44
36
|
redoMutations: [
|
|
45
|
-
|
|
37
|
+
removeMutation,
|
|
38
|
+
...intercepted.redos,
|
|
46
39
|
{ id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
|
|
47
40
|
]
|
|
48
41
|
}), !0) : !1;
|
|
@@ -95,11 +88,11 @@ const PLUGIN_CONFIG_KEY = "sheets-drawing-ui.config", defaultPluginConfig = {},
|
|
|
95
88
|
};
|
|
96
89
|
}, [imageIoService]), /* @__PURE__ */ React.createElement("div", { style: { display: remain > 0 ? "block" : "none" }, className: styles$1.uploadLoading }, /* @__PURE__ */ React.createElement("div", { className: styles$1.uploadLoadingBody }, /* @__PURE__ */ React.createElement("div", { className: styles$1.uploadLoadingBodyAnimation }), /* @__PURE__ */ React.createElement("div", { className: styles$1.uploadLoadingBodyText }, `${localeService.t("uploadLoading.loading")}: ${remain}`)));
|
|
97
90
|
}, "UploadLoading");
|
|
98
|
-
var __defProp$
|
|
99
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
91
|
+
var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
92
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
100
93
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
101
|
-
return kind && result && __defProp$
|
|
102
|
-
}, "__decorateClass$
|
|
94
|
+
return kind && result && __defProp$8(target, key, result), result;
|
|
95
|
+
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a;
|
|
103
96
|
let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
104
97
|
constructor(_injector, _drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _uiPartsService) {
|
|
105
98
|
super();
|
|
@@ -127,8 +120,8 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
|
127
120
|
return !1;
|
|
128
121
|
}
|
|
129
122
|
_popupMenuListener(unitId) {
|
|
130
|
-
var
|
|
131
|
-
const scene = (
|
|
123
|
+
var _a10;
|
|
124
|
+
const scene = (_a10 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a10.scene;
|
|
132
125
|
if (!scene)
|
|
133
126
|
return;
|
|
134
127
|
const transformer = scene.getTransformerByCreate();
|
|
@@ -209,14 +202,14 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
|
209
202
|
];
|
|
210
203
|
}
|
|
211
204
|
}, __name(_a, "DrawingPopupMenuController"), _a);
|
|
212
|
-
DrawingPopupMenuController = __decorateClass$
|
|
213
|
-
__decorateParam$
|
|
214
|
-
__decorateParam$
|
|
215
|
-
__decorateParam$
|
|
216
|
-
__decorateParam$
|
|
217
|
-
__decorateParam$
|
|
218
|
-
__decorateParam$
|
|
219
|
-
__decorateParam$
|
|
205
|
+
DrawingPopupMenuController = __decorateClass$8([
|
|
206
|
+
__decorateParam$8(0, Inject(Injector)),
|
|
207
|
+
__decorateParam$8(1, IDrawingManagerService),
|
|
208
|
+
__decorateParam$8(2, Inject(SheetCanvasPopManagerService)),
|
|
209
|
+
__decorateParam$8(3, IRenderManagerService),
|
|
210
|
+
__decorateParam$8(4, IUniverInstanceService),
|
|
211
|
+
__decorateParam$8(5, IContextService),
|
|
212
|
+
__decorateParam$8(6, Inject(IUIPartsService))
|
|
220
213
|
], DrawingPopupMenuController);
|
|
221
214
|
function drawingPositionToTransform(position, selectionRenderService, sheetSkeletonManagerService) {
|
|
222
215
|
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, {
|
|
@@ -281,11 +274,11 @@ function transformToDrawingPosition(transform, selectionRenderService) {
|
|
|
281
274
|
};
|
|
282
275
|
}
|
|
283
276
|
__name(transformToDrawingPosition, "transformToDrawingPosition");
|
|
284
|
-
var __defProp$
|
|
285
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
277
|
+
var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
278
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
286
279
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
287
|
-
return kind && result && __defProp$
|
|
288
|
-
}, "__decorateClass$
|
|
280
|
+
return kind && result && __defProp$7(target, key, result), result;
|
|
281
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a2;
|
|
289
282
|
let SheetsDrawingRenderController = (_a2 = class extends Disposable {
|
|
290
283
|
constructor(_context, _sheetDrawingService, _drawingManagerService, _sheetSelectionRenderService, _sheetSkeletonManagerService) {
|
|
291
284
|
super(), this._context = _context, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._sheetSelectionRenderService = _sheetSelectionRenderService, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._init();
|
|
@@ -306,11 +299,11 @@ let SheetsDrawingRenderController = (_a2 = class extends Disposable {
|
|
|
306
299
|
this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
|
|
307
300
|
}
|
|
308
301
|
}, __name(_a2, "SheetsDrawingRenderController"), _a2);
|
|
309
|
-
SheetsDrawingRenderController = __decorateClass$
|
|
310
|
-
__decorateParam$
|
|
311
|
-
__decorateParam$
|
|
312
|
-
__decorateParam$
|
|
313
|
-
__decorateParam$
|
|
302
|
+
SheetsDrawingRenderController = __decorateClass$7([
|
|
303
|
+
__decorateParam$7(1, ISheetDrawingService),
|
|
304
|
+
__decorateParam$7(2, IDrawingManagerService),
|
|
305
|
+
__decorateParam$7(3, Inject(ISheetSelectionRenderService)),
|
|
306
|
+
__decorateParam$7(4, Inject(SheetSkeletonManagerService))
|
|
314
307
|
], SheetsDrawingRenderController);
|
|
315
308
|
var __assign = function() {
|
|
316
309
|
return __assign = Object.assign || function(t) {
|
|
@@ -341,15 +334,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
|
341
334
|
var attrs = __assign({}, node.attrs);
|
|
342
335
|
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
343
336
|
var defIds = runtimeProps.defIds;
|
|
344
|
-
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(
|
|
345
|
-
var key =
|
|
337
|
+
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a10) {
|
|
338
|
+
var key = _a10[0], value = _a10[1];
|
|
346
339
|
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
347
340
|
})), attrs;
|
|
348
341
|
}
|
|
349
342
|
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
350
343
|
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
351
|
-
var
|
|
352
|
-
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((
|
|
344
|
+
var _a10, defIds = runtimeProps.defIds;
|
|
345
|
+
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a10 = node.children) === null || _a10 === void 0) && _a10.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
|
353
346
|
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;
|
|
354
347
|
}) }) : node;
|
|
355
348
|
}
|
|
@@ -476,25 +469,6 @@ const GroupSheetDrawingCommand = {
|
|
|
476
469
|
]
|
|
477
470
|
}), !0) : !1;
|
|
478
471
|
}, "handler")
|
|
479
|
-
}, InsertSheetDrawingCommand = {
|
|
480
|
-
id: "sheet.command.insert-sheet-image",
|
|
481
|
-
type: CommandType.COMMAND,
|
|
482
|
-
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
483
|
-
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetDrawingService = accessor.get(ISheetDrawingService);
|
|
484
|
-
if (!params) return !1;
|
|
485
|
-
const drawings = params.drawings, unitIds = drawings.map((param) => param.unitId), jsonOp = sheetDrawingService.getBatchAddOp(drawings), { unitId, subUnitId, undo, redo, objects } = jsonOp;
|
|
486
|
-
return commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.INSERT }) ? (undoRedoService.pushUndoRedo({
|
|
487
|
-
unitID: unitId,
|
|
488
|
-
undoMutations: [
|
|
489
|
-
{ id: SetDrawingApplyMutation.id, params: { op: undo, unitId, subUnitId, objects, type: DrawingApplyType.REMOVE } },
|
|
490
|
-
{ id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
|
|
491
|
-
],
|
|
492
|
-
redoMutations: [
|
|
493
|
-
{ id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.INSERT } },
|
|
494
|
-
{ id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
|
|
495
|
-
]
|
|
496
|
-
}), !0) : !1;
|
|
497
|
-
}, "handler")
|
|
498
472
|
}, SetDrawingArrangeCommand = {
|
|
499
473
|
id: "sheet.command.set-drawing-arrange",
|
|
500
474
|
type: CommandType.COMMAND,
|
|
@@ -561,11 +535,11 @@ const GroupSheetDrawingCommand = {
|
|
|
561
535
|
}), !0) : !1;
|
|
562
536
|
}, "handler")
|
|
563
537
|
};
|
|
564
|
-
var __defProp$
|
|
565
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
538
|
+
var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
539
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
566
540
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
567
|
-
return kind && result && __defProp$
|
|
568
|
-
}, "__decorateClass$
|
|
541
|
+
return kind && result && __defProp$6(target, key, result), result;
|
|
542
|
+
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a3;
|
|
569
543
|
let SheetDrawingUpdateController = (_a3 = class extends Disposable {
|
|
570
544
|
constructor(_context, _skeletonManagerService, _commandService, _selectionRenderService, _imageIoService, _fileOpenerService, _sheetDrawingService, _drawingManagerService, _contextService, _messageService, _localeService, selectionManagerService) {
|
|
571
545
|
super();
|
|
@@ -724,25 +698,25 @@ let SheetDrawingUpdateController = (_a3 = class extends Disposable {
|
|
|
724
698
|
);
|
|
725
699
|
}
|
|
726
700
|
}, __name(_a3, "SheetDrawingUpdateController"), _a3);
|
|
727
|
-
SheetDrawingUpdateController = __decorateClass$
|
|
728
|
-
__decorateParam$
|
|
729
|
-
__decorateParam$
|
|
730
|
-
__decorateParam$
|
|
731
|
-
__decorateParam$
|
|
732
|
-
__decorateParam$
|
|
733
|
-
__decorateParam$
|
|
734
|
-
__decorateParam$
|
|
735
|
-
__decorateParam$
|
|
736
|
-
__decorateParam$
|
|
737
|
-
__decorateParam$
|
|
738
|
-
__decorateParam$
|
|
701
|
+
SheetDrawingUpdateController = __decorateClass$6([
|
|
702
|
+
__decorateParam$6(1, Inject(SheetSkeletonManagerService)),
|
|
703
|
+
__decorateParam$6(2, ICommandService),
|
|
704
|
+
__decorateParam$6(3, ISheetSelectionRenderService),
|
|
705
|
+
__decorateParam$6(4, IImageIoService),
|
|
706
|
+
__decorateParam$6(5, ILocalFileService),
|
|
707
|
+
__decorateParam$6(6, ISheetDrawingService),
|
|
708
|
+
__decorateParam$6(7, IDrawingManagerService),
|
|
709
|
+
__decorateParam$6(8, IContextService),
|
|
710
|
+
__decorateParam$6(9, IMessageService),
|
|
711
|
+
__decorateParam$6(10, Inject(LocaleService)),
|
|
712
|
+
__decorateParam$6(11, Inject(SheetsSelectionsService))
|
|
739
713
|
], SheetDrawingUpdateController);
|
|
740
714
|
const InsertFloatImageCommand = {
|
|
741
715
|
id: "sheet.command.insert-float-image",
|
|
742
716
|
type: CommandType.COMMAND,
|
|
743
717
|
handler: /* @__PURE__ */ __name((accessor) => {
|
|
744
|
-
var
|
|
745
|
-
return (_b = (
|
|
718
|
+
var _a10, _b;
|
|
719
|
+
return (_b = (_a10 = accessor.get(IRenderManagerService).getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a10.with(SheetDrawingUpdateController).insertFloatImage()) != null ? _b : !1;
|
|
746
720
|
}, "handler")
|
|
747
721
|
}, MoveDrawingsCommand = {
|
|
748
722
|
id: "sheet.command.move-drawing",
|
|
@@ -821,14 +795,14 @@ function clsx() {
|
|
|
821
795
|
}
|
|
822
796
|
__name(clsx, "clsx");
|
|
823
797
|
const SheetDrawingAnchor = /* @__PURE__ */ __name((props) => {
|
|
824
|
-
var
|
|
798
|
+
var _a10;
|
|
825
799
|
const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), drawingManagerService = useDependency(IDrawingManagerService), renderManagerService = useDependency(IRenderManagerService), { drawings } = props, drawingParam = drawings[0];
|
|
826
800
|
if (drawingParam == null)
|
|
827
801
|
return;
|
|
828
802
|
const { unitId } = drawingParam, renderObject = renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
829
803
|
if (scene == null)
|
|
830
804
|
return;
|
|
831
|
-
const transformer = scene.getTransformerByCreate(), [anchorShow, setAnchorShow] = useState(!0), type = (
|
|
805
|
+
const transformer = scene.getTransformerByCreate(), [anchorShow, setAnchorShow] = useState(!0), type = (_a10 = drawingParam.anchorType) != null ? _a10 : SheetDrawingAnchorType.Position, [value, setValue] = useState(type);
|
|
832
806
|
function getUpdateParams(objects, drawingManagerService2) {
|
|
833
807
|
const params = [];
|
|
834
808
|
return objects.forEach((object) => {
|
|
@@ -850,13 +824,13 @@ const SheetDrawingAnchor = /* @__PURE__ */ __name((props) => {
|
|
|
850
824
|
const onClearControlObserver = transformer.clearControl$.subscribe((changeSelf) => {
|
|
851
825
|
changeSelf === !0 && setAnchorShow(!1);
|
|
852
826
|
}), onChangeStartObserver = transformer.changeStart$.subscribe((state) => {
|
|
853
|
-
var
|
|
827
|
+
var _a11;
|
|
854
828
|
const { objects } = state, params = getUpdateParams(objects, drawingManagerService);
|
|
855
829
|
if (params.length === 0)
|
|
856
830
|
setAnchorShow(!1);
|
|
857
831
|
else if (params.length >= 1) {
|
|
858
832
|
setAnchorShow(!0);
|
|
859
|
-
const anchorType = ((
|
|
833
|
+
const anchorType = ((_a11 = params[0]) == null ? void 0 : _a11.anchorType) || SheetDrawingAnchorType.Position;
|
|
860
834
|
setValue(anchorType);
|
|
861
835
|
}
|
|
862
836
|
});
|
|
@@ -958,11 +932,11 @@ const MoveDrawingDownShortcutItem = {
|
|
|
958
932
|
binding: KeyCode.DELETE,
|
|
959
933
|
mac: KeyCode.BACKSPACE
|
|
960
934
|
};
|
|
961
|
-
var __defProp$
|
|
962
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
935
|
+
var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
936
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
963
937
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
964
|
-
return kind && result && __defProp$
|
|
965
|
-
}, "__decorateClass$
|
|
938
|
+
return kind && result && __defProp$5(target, key, result), result;
|
|
939
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a4;
|
|
966
940
|
let SheetDrawingUIController = (_a4 = class extends Disposable {
|
|
967
941
|
constructor(_componentManager, _menuManagerService, _commandService, _shortcutService) {
|
|
968
942
|
super(), this._componentManager = _componentManager, this._menuManagerService = _menuManagerService, this._commandService = _commandService, this._shortcutService = _shortcutService, this._init();
|
|
@@ -1006,17 +980,17 @@ let SheetDrawingUIController = (_a4 = class extends Disposable {
|
|
|
1006
980
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
1007
981
|
}
|
|
1008
982
|
}, __name(_a4, "SheetDrawingUIController"), _a4);
|
|
1009
|
-
SheetDrawingUIController = __decorateClass$
|
|
1010
|
-
__decorateParam$
|
|
1011
|
-
__decorateParam$
|
|
1012
|
-
__decorateParam$
|
|
1013
|
-
__decorateParam$
|
|
983
|
+
SheetDrawingUIController = __decorateClass$5([
|
|
984
|
+
__decorateParam$5(0, Inject(ComponentManager)),
|
|
985
|
+
__decorateParam$5(1, IMenuManagerService),
|
|
986
|
+
__decorateParam$5(2, ICommandService),
|
|
987
|
+
__decorateParam$5(3, IShortcutService)
|
|
1014
988
|
], SheetDrawingUIController);
|
|
1015
|
-
var __defProp$
|
|
1016
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
989
|
+
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
990
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1017
991
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1018
|
-
return kind && result && __defProp$
|
|
1019
|
-
}, "__decorateClass$
|
|
992
|
+
return kind && result && __defProp$4(target, key, result), result;
|
|
993
|
+
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a5;
|
|
1020
994
|
let SheetsDrawingCopyPasteController = (_a5 = class extends Disposable {
|
|
1021
995
|
constructor(_sheetClipboardService, _renderManagerService, _sheetDrawingService) {
|
|
1022
996
|
super();
|
|
@@ -1035,8 +1009,8 @@ let SheetsDrawingCopyPasteController = (_a5 = class extends Disposable {
|
|
|
1035
1009
|
});
|
|
1036
1010
|
}
|
|
1037
1011
|
_collect(unitId, subUnitId, range) {
|
|
1038
|
-
var
|
|
1039
|
-
const skeletonManagerService = (
|
|
1012
|
+
var _a10;
|
|
1013
|
+
const skeletonManagerService = (_a10 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a10.with(SheetSkeletonManagerService);
|
|
1040
1014
|
if (!skeletonManagerService) return;
|
|
1041
1015
|
const selectionRect = skeletonManagerService.attachRangeWithCoord(range);
|
|
1042
1016
|
if (!selectionRect)
|
|
@@ -1061,7 +1035,7 @@ let SheetsDrawingCopyPasteController = (_a5 = class extends Disposable {
|
|
|
1061
1035
|
}
|
|
1062
1036
|
// eslint-disable-next-line max-lines-per-function
|
|
1063
1037
|
_generateMutations(pastedRange, copyInfo) {
|
|
1064
|
-
var
|
|
1038
|
+
var _a10;
|
|
1065
1039
|
if (!this._copyInfo)
|
|
1066
1040
|
return { redos: [], undos: [] };
|
|
1067
1041
|
if ([
|
|
@@ -1076,7 +1050,7 @@ let SheetsDrawingCopyPasteController = (_a5 = class extends Disposable {
|
|
|
1076
1050
|
const { copyRange } = copyInfo;
|
|
1077
1051
|
if (!copyRange)
|
|
1078
1052
|
return { redos: [], undos: [] };
|
|
1079
|
-
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), skeletonManagerService = (
|
|
1053
|
+
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), skeletonManagerService = (_a10 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a10.with(SheetSkeletonManagerService);
|
|
1080
1054
|
if (!skeletonManagerService)
|
|
1081
1055
|
return { redos: [], undos: [] };
|
|
1082
1056
|
const copyRect = skeletonManagerService.attachRangeWithCoord({
|
|
@@ -1143,16 +1117,16 @@ let SheetsDrawingCopyPasteController = (_a5 = class extends Disposable {
|
|
|
1143
1117
|
};
|
|
1144
1118
|
}
|
|
1145
1119
|
}, __name(_a5, "SheetsDrawingCopyPasteController"), _a5);
|
|
1146
|
-
SheetsDrawingCopyPasteController = __decorateClass$
|
|
1147
|
-
__decorateParam$
|
|
1148
|
-
__decorateParam$
|
|
1149
|
-
__decorateParam$
|
|
1120
|
+
SheetsDrawingCopyPasteController = __decorateClass$4([
|
|
1121
|
+
__decorateParam$4(0, ISheetClipboardService),
|
|
1122
|
+
__decorateParam$4(1, IRenderManagerService),
|
|
1123
|
+
__decorateParam$4(2, ISheetDrawingService)
|
|
1150
1124
|
], SheetsDrawingCopyPasteController);
|
|
1151
|
-
var __defProp$
|
|
1152
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1125
|
+
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1126
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1153
1127
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1154
|
-
return kind && result && __defProp$
|
|
1155
|
-
}, "__decorateClass$
|
|
1128
|
+
return kind && result && __defProp$3(target, key, result), result;
|
|
1129
|
+
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a6;
|
|
1156
1130
|
let SheetDrawingPermissionController = (_a6 = class extends Disposable {
|
|
1157
1131
|
constructor(_drawingManagerService, _renderManagerService, _permissionService, _univerInstanceService, _userManagerService) {
|
|
1158
1132
|
super(), this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._univerInstanceService = _univerInstanceService, this._userManagerService = _userManagerService, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
@@ -1220,7 +1194,7 @@ let SheetDrawingPermissionController = (_a6 = class extends Disposable {
|
|
|
1220
1194
|
this.disposeWithMe(
|
|
1221
1195
|
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
1222
1196
|
workbook && workbook.activeSheet$.subscribe((sheet) => {
|
|
1223
|
-
var
|
|
1197
|
+
var _a10;
|
|
1224
1198
|
if (!sheet)
|
|
1225
1199
|
return;
|
|
1226
1200
|
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
@@ -1240,7 +1214,7 @@ let SheetDrawingPermissionController = (_a6 = class extends Disposable {
|
|
|
1240
1214
|
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
|
|
1241
1215
|
}), transformer.clearSelectedObjects());
|
|
1242
1216
|
}, "next")
|
|
1243
|
-
}), (
|
|
1217
|
+
}), (_a10 = this._permissionService.getPermissionPoint$(new WorksheetViewPermission(unitId, subUnitId).id)) == null || _a10.pipe(
|
|
1244
1218
|
filter((permission) => permission.value !== initialViewPermission),
|
|
1245
1219
|
distinctUntilChanged()
|
|
1246
1220
|
).subscribe({
|
|
@@ -1259,7 +1233,7 @@ let SheetDrawingPermissionController = (_a6 = class extends Disposable {
|
|
|
1259
1233
|
this.disposeWithMe(
|
|
1260
1234
|
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
1261
1235
|
workbook && workbook.activeSheet$.subscribe((sheet) => {
|
|
1262
|
-
var
|
|
1236
|
+
var _a10;
|
|
1263
1237
|
if (!sheet)
|
|
1264
1238
|
return;
|
|
1265
1239
|
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
@@ -1281,7 +1255,7 @@ let SheetDrawingPermissionController = (_a6 = class extends Disposable {
|
|
|
1281
1255
|
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.detachTransformerFrom(object);
|
|
1282
1256
|
}), transformer.clearSelectedObjects());
|
|
1283
1257
|
}, "next")
|
|
1284
|
-
}), (
|
|
1258
|
+
}), (_a10 = this._permissionService.getPermissionPoint$(new WorksheetEditPermission(unitId, subUnitId).id)) == null || _a10.pipe(
|
|
1285
1259
|
filter((permission) => permission.value !== initialEditPermission),
|
|
1286
1260
|
distinctUntilChanged()
|
|
1287
1261
|
).subscribe({
|
|
@@ -1300,18 +1274,18 @@ let SheetDrawingPermissionController = (_a6 = class extends Disposable {
|
|
|
1300
1274
|
);
|
|
1301
1275
|
}
|
|
1302
1276
|
}, __name(_a6, "SheetDrawingPermissionController"), _a6);
|
|
1303
|
-
SheetDrawingPermissionController = __decorateClass$
|
|
1304
|
-
__decorateParam$
|
|
1305
|
-
__decorateParam$
|
|
1306
|
-
__decorateParam$
|
|
1307
|
-
__decorateParam$
|
|
1308
|
-
__decorateParam$
|
|
1277
|
+
SheetDrawingPermissionController = __decorateClass$3([
|
|
1278
|
+
__decorateParam$3(0, IDrawingManagerService),
|
|
1279
|
+
__decorateParam$3(1, IRenderManagerService),
|
|
1280
|
+
__decorateParam$3(2, IPermissionService),
|
|
1281
|
+
__decorateParam$3(3, IUniverInstanceService),
|
|
1282
|
+
__decorateParam$3(4, Inject(UserManagerService))
|
|
1309
1283
|
], SheetDrawingPermissionController);
|
|
1310
|
-
var __defProp$
|
|
1311
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1284
|
+
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1285
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1312
1286
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1313
|
-
return kind && result && __defProp$
|
|
1314
|
-
}, "__decorateClass$
|
|
1287
|
+
return kind && result && __defProp$2(target, key, result), result;
|
|
1288
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a7;
|
|
1315
1289
|
let SheetDrawingPrintingController = (_a7 = class extends Disposable {
|
|
1316
1290
|
constructor(_sheetPrintInterceptorService, _drawingRenderService, _drawingManagerService, _renderManagerService) {
|
|
1317
1291
|
super(), this._sheetPrintInterceptorService = _sheetPrintInterceptorService, this._drawingRenderService = _drawingRenderService, this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._initPrinting();
|
|
@@ -1356,17 +1330,17 @@ let SheetDrawingPrintingController = (_a7 = class extends Disposable {
|
|
|
1356
1330
|
);
|
|
1357
1331
|
}
|
|
1358
1332
|
}, __name(_a7, "SheetDrawingPrintingController"), _a7);
|
|
1359
|
-
SheetDrawingPrintingController = __decorateClass$
|
|
1360
|
-
__decorateParam$
|
|
1361
|
-
__decorateParam$
|
|
1362
|
-
__decorateParam$
|
|
1363
|
-
__decorateParam$
|
|
1333
|
+
SheetDrawingPrintingController = __decorateClass$2([
|
|
1334
|
+
__decorateParam$2(0, Inject(SheetPrintInterceptorService)),
|
|
1335
|
+
__decorateParam$2(1, Inject(DrawingRenderService)),
|
|
1336
|
+
__decorateParam$2(2, IDrawingManagerService),
|
|
1337
|
+
__decorateParam$2(3, IRenderManagerService)
|
|
1364
1338
|
], SheetDrawingPrintingController);
|
|
1365
|
-
var __defProp$
|
|
1366
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1339
|
+
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1340
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1367
1341
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1368
|
-
return kind && result && __defProp$
|
|
1369
|
-
}, "__decorateClass$
|
|
1342
|
+
return kind && result && __defProp$1(target, key, result), result;
|
|
1343
|
+
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
|
|
1370
1344
|
const UPDATE_COMMANDS = [
|
|
1371
1345
|
InsertRowCommand.id,
|
|
1372
1346
|
InsertColCommand.id,
|
|
@@ -1748,11 +1722,11 @@ let SheetDrawingTransformAffectedController = (_a8 = class extends Disposable {
|
|
|
1748
1722
|
return { unitId, subUnitId };
|
|
1749
1723
|
}
|
|
1750
1724
|
_moveRangeInterceptor(params) {
|
|
1751
|
-
var
|
|
1725
|
+
var _a10, _b;
|
|
1752
1726
|
const { toRange, fromRange } = params, target = getSheetCommandTarget(this._univerInstanceService);
|
|
1753
1727
|
if (!target)
|
|
1754
1728
|
return { redos: [], undos: [] };
|
|
1755
|
-
const { unitId, subUnitId } = target, skeleton = (_b = (
|
|
1729
|
+
const { unitId, subUnitId } = target, skeleton = (_b = (_a10 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a10.with(SheetSkeletonManagerService)) == null ? void 0 : _b.getCurrentSkeleton();
|
|
1756
1730
|
if (!skeleton)
|
|
1757
1731
|
return { redos: [], undos: [] };
|
|
1758
1732
|
const selectionRect = attachRangeWithCoord(skeleton, fromRange);
|
|
@@ -2112,384 +2086,24 @@ let SheetDrawingTransformAffectedController = (_a8 = class extends Disposable {
|
|
|
2112
2086
|
}), updateDrawings.length !== 0 && (this._drawingManagerService.refreshTransform(updateDrawings), this._commandService.syncExecuteCommand(ClearSheetDrawingTransformerOperation.id, [unitId]));
|
|
2113
2087
|
}
|
|
2114
2088
|
}, __name(_a8, "SheetDrawingTransformAffectedController"), _a8);
|
|
2115
|
-
SheetDrawingTransformAffectedController = __decorateClass$
|
|
2116
|
-
__decorateParam$
|
|
2117
|
-
__decorateParam$
|
|
2118
|
-
__decorateParam$
|
|
2119
|
-
__decorateParam$
|
|
2120
|
-
__decorateParam$
|
|
2121
|
-
__decorateParam$
|
|
2122
|
-
__decorateParam$
|
|
2123
|
-
__decorateParam$
|
|
2089
|
+
SheetDrawingTransformAffectedController = __decorateClass$1([
|
|
2090
|
+
__decorateParam$1(1, IRenderManagerService),
|
|
2091
|
+
__decorateParam$1(2, ICommandService),
|
|
2092
|
+
__decorateParam$1(3, ISheetSelectionRenderService),
|
|
2093
|
+
__decorateParam$1(4, Inject(SheetSkeletonManagerService)),
|
|
2094
|
+
__decorateParam$1(5, Inject(SheetInterceptorService)),
|
|
2095
|
+
__decorateParam$1(6, ISheetDrawingService),
|
|
2096
|
+
__decorateParam$1(7, IDrawingManagerService),
|
|
2097
|
+
__decorateParam$1(8, IUniverInstanceService)
|
|
2124
2098
|
], SheetDrawingTransformAffectedController);
|
|
2125
|
-
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2126
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2127
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2128
|
-
return kind && result && __defProp$1(target, key, result), result;
|
|
2129
|
-
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
|
|
2130
|
-
function transformBound2DOMBound(originBound, scene, skeleton, worksheet) {
|
|
2131
|
-
const { scaleX, scaleY } = scene.getAncestorScale(), viewMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN), absolute = {
|
|
2132
|
-
left: !0,
|
|
2133
|
-
top: !0
|
|
2134
|
-
};
|
|
2135
|
-
if (!viewMain)
|
|
2136
|
-
return {
|
|
2137
|
-
...originBound,
|
|
2138
|
-
absolute
|
|
2139
|
-
};
|
|
2140
|
-
const { left, right, top, bottom } = originBound, freeze = worksheet.getFreeze(), { startColumn, startRow, xSplit, ySplit } = freeze, startSheetView = skeleton.getNoMergeCellPositionByIndexWithNoHeader(startRow - ySplit, startColumn - xSplit), endSheetView = skeleton.getNoMergeCellPositionByIndexWithNoHeader(startRow, startColumn), { rowHeaderWidth, columnHeaderHeight } = skeleton, freezeWidth = endSheetView.startX - startSheetView.startX, freezeHeight = endSheetView.startY - startSheetView.startY, { top: freezeTop, left: freezeLeft, viewportScrollX: actualScrollX, viewportScrollY: actualScrollY } = viewMain;
|
|
2141
|
-
let offsetLeft, offsetRight;
|
|
2142
|
-
left < freezeLeft ? (absolute.left = !0, offsetLeft = (freezeWidth + rowHeaderWidth + (left - freezeLeft)) * scaleX, offsetRight = Math.max(
|
|
2143
|
-
Math.min(
|
|
2144
|
-
(freezeWidth + rowHeaderWidth + (right - freezeLeft)) * scaleX,
|
|
2145
|
-
(freezeWidth + rowHeaderWidth) * scaleX
|
|
2146
|
-
),
|
|
2147
|
-
(right - actualScrollX) * scaleX
|
|
2148
|
-
)) : (absolute.left = !1, offsetLeft = Math.max((left - actualScrollX) * scaleX, (freezeWidth + rowHeaderWidth) * scaleX), offsetRight = Math.max((right - actualScrollX) * scaleX, (freezeWidth + rowHeaderWidth) * scaleX));
|
|
2149
|
-
let offsetTop, offsetBottom;
|
|
2150
|
-
return top < freezeTop ? (absolute.top = !0, offsetTop = (freezeHeight + columnHeaderHeight + (top - freezeTop)) * scaleY, offsetBottom = Math.max(
|
|
2151
|
-
Math.min(
|
|
2152
|
-
(freezeHeight + columnHeaderHeight + (right - freezeTop)) * scaleY,
|
|
2153
|
-
(freezeHeight + columnHeaderHeight) * scaleY
|
|
2154
|
-
),
|
|
2155
|
-
(bottom - actualScrollY) * scaleY
|
|
2156
|
-
)) : (absolute.top = !1, offsetTop = Math.max((top - actualScrollY) * scaleY, (freezeHeight + columnHeaderHeight) * scaleY), offsetBottom = Math.max((bottom - actualScrollY) * scaleY, (freezeHeight + columnHeaderHeight) * scaleY)), {
|
|
2157
|
-
left: offsetLeft,
|
|
2158
|
-
right: offsetRight,
|
|
2159
|
-
top: offsetTop,
|
|
2160
|
-
bottom: offsetBottom,
|
|
2161
|
-
absolute
|
|
2162
|
-
};
|
|
2163
|
-
}
|
|
2164
|
-
__name(transformBound2DOMBound, "transformBound2DOMBound");
|
|
2165
|
-
const calcPosition = /* @__PURE__ */ __name((targetObject, currentRender, skeleton, worksheet) => {
|
|
2166
|
-
const { scene } = currentRender, { left, top, width, height, angle } = targetObject, bound = {
|
|
2167
|
-
left,
|
|
2168
|
-
right: left + width,
|
|
2169
|
-
top,
|
|
2170
|
-
bottom: top + height
|
|
2171
|
-
}, offsetBound = transformBound2DOMBound(bound, scene, skeleton, worksheet), { scaleX, scaleY } = scene.getAncestorScale();
|
|
2172
|
-
return {
|
|
2173
|
-
startX: offsetBound.left,
|
|
2174
|
-
endX: offsetBound.right,
|
|
2175
|
-
startY: offsetBound.top,
|
|
2176
|
-
endY: offsetBound.bottom,
|
|
2177
|
-
rotate: angle,
|
|
2178
|
-
width: width * scaleX,
|
|
2179
|
-
height: height * scaleY,
|
|
2180
|
-
absolute: offsetBound.absolute
|
|
2181
|
-
};
|
|
2182
|
-
}, "calcPosition");
|
|
2183
|
-
var _a9;
|
|
2184
|
-
let SheetCanvasFloatDomManagerService = (_a9 = class extends Disposable {
|
|
2185
|
-
constructor(_renderManagerService, _univerInstanceService, _commandService, _drawingManagerService, _canvasFloatDomService, _sheetDrawingService, _lifecycleService) {
|
|
2186
|
-
super();
|
|
2187
|
-
__publicField(this, "_domLayerMap", /* @__PURE__ */ new Map());
|
|
2188
|
-
__publicField(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
|
|
2189
|
-
__publicField(this, "_transformChange$", new Subject());
|
|
2190
|
-
__publicField(this, "transformChange$", this._transformChange$.asObservable());
|
|
2191
|
-
__publicField(this, "_add$", new Subject());
|
|
2192
|
-
__publicField(this, "add$", this._add$.asObservable());
|
|
2193
|
-
__publicField(this, "_remove$", new Subject());
|
|
2194
|
-
__publicField(this, "remove$", this._remove$.asObservable());
|
|
2195
|
-
__publicField(this, "_hooks", []);
|
|
2196
|
-
this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._commandService = _commandService, this._drawingManagerService = _drawingManagerService, this._canvasFloatDomService = _canvasFloatDomService, this._sheetDrawingService = _sheetDrawingService, this._lifecycleService = _lifecycleService, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
|
|
2197
|
-
}
|
|
2198
|
-
_bindScrollEvent() {
|
|
2199
|
-
this._lifecycleService.lifecycle$.pipe(filter((s) => s === LifecycleStages.Rendered), take(1)).subscribe(() => {
|
|
2200
|
-
this._scrollUpdateListener();
|
|
2201
|
-
});
|
|
2202
|
-
}
|
|
2203
|
-
_ensureMap(unitId, subUnitId) {
|
|
2204
|
-
let unitMap = this._domLayerMap.get(unitId);
|
|
2205
|
-
unitMap || (unitMap = /* @__PURE__ */ new Map(), this._domLayerMap.set(unitId, unitMap));
|
|
2206
|
-
let subUnitMap = unitMap.get(subUnitId);
|
|
2207
|
-
return subUnitMap || (subUnitMap = /* @__PURE__ */ new Map(), unitMap.set(subUnitId, subUnitMap)), subUnitMap;
|
|
2208
|
-
}
|
|
2209
|
-
getFloatDomInfo(id) {
|
|
2210
|
-
return this._domLayerInfoMap.get(id);
|
|
2211
|
-
}
|
|
2212
|
-
_getSceneAndTransformerByDrawingSearch(unitId) {
|
|
2213
|
-
if (unitId == null)
|
|
2214
|
-
return;
|
|
2215
|
-
const renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
2216
|
-
if (renderObject == null || scene == null)
|
|
2217
|
-
return null;
|
|
2218
|
-
const transformer = scene.getTransformerByCreate(), canvas = renderObject.engine.getCanvasElement();
|
|
2219
|
-
return { scene, transformer, renderObject, canvas };
|
|
2220
|
-
}
|
|
2221
|
-
_getFloatDomProps(id) {
|
|
2222
|
-
let props;
|
|
2223
|
-
return this._hooks.forEach((hook) => {
|
|
2224
|
-
props = hook.onGetFloatDomProps(id);
|
|
2225
|
-
}), props;
|
|
2226
|
-
}
|
|
2227
|
-
// eslint-disable-next-line max-lines-per-function
|
|
2228
|
-
_drawingAddListener() {
|
|
2229
|
-
this.disposeWithMe(
|
|
2230
|
-
// eslint-disable-next-line max-lines-per-function
|
|
2231
|
-
this._drawingManagerService.add$.subscribe((params) => {
|
|
2232
|
-
params.forEach((param) => {
|
|
2233
|
-
var _a11, _b, _c;
|
|
2234
|
-
const { unitId, subUnitId, drawingId } = param, target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), floatDomParam = this._drawingManagerService.getDrawingByParam(param);
|
|
2235
|
-
if (!floatDomParam || !target)
|
|
2236
|
-
return;
|
|
2237
|
-
const skeleton = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
|
|
2238
|
-
if (!skeleton)
|
|
2239
|
-
return;
|
|
2240
|
-
const { transform, drawingType, data } = floatDomParam;
|
|
2241
|
-
if (drawingType !== DrawingTypeEnum.DRAWING_DOM && drawingType !== DrawingTypeEnum.DRAWING_CHART)
|
|
2242
|
-
return;
|
|
2243
|
-
const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
|
|
2244
|
-
if (renderObject == null)
|
|
2245
|
-
return;
|
|
2246
|
-
const { scene, canvas } = renderObject;
|
|
2247
|
-
if (transform == null)
|
|
2248
|
-
return !0;
|
|
2249
|
-
const { left, top, width, height, angle, flipX, flipY, skewX, skewY } = transform, rectShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), rectShape = scene.getObject(rectShapeKey);
|
|
2250
|
-
if (rectShape != null) {
|
|
2251
|
-
rectShape.transformByState({ left, top, width, height, angle, flipX, flipY, skewX, skewY });
|
|
2252
|
-
return;
|
|
2253
|
-
}
|
|
2254
|
-
const imageConfig = {
|
|
2255
|
-
left,
|
|
2256
|
-
top,
|
|
2257
|
-
width,
|
|
2258
|
-
height,
|
|
2259
|
-
zIndex: this._drawingManagerService.getDrawingOrder(unitId, subUnitId).length - 1
|
|
2260
|
-
}, isChart = drawingType === DrawingTypeEnum.DRAWING_CHART;
|
|
2261
|
-
isChart && (imageConfig.fill = "white", imageConfig.rotateEnabled = !1, data && data.border && (imageConfig.stroke = data.border), imageConfig.paintFirst = "stroke", imageConfig.strokeWidth = 1, imageConfig.borderEnabled = !1);
|
|
2262
|
-
const rect = new Rect(rectShapeKey, imageConfig);
|
|
2263
|
-
isChart && rect.setObjectType(ObjectType.CHART), scene.addObject(rect, DRAWING_OBJECT_LAYER_INDEX), floatDomParam.allowTransform !== !1 && scene.attachTransformerTo(rect);
|
|
2264
|
-
const map2 = this._ensureMap(unitId, subUnitId), disposableCollection = new DisposableCollection(), initPosition = calcPosition(rect, renderObject.renderObject, skeleton.skeleton, target.worksheet), position$ = new BehaviorSubject(initPosition), info = {
|
|
2265
|
-
dispose: disposableCollection,
|
|
2266
|
-
rect,
|
|
2267
|
-
position$,
|
|
2268
|
-
unitId,
|
|
2269
|
-
subUnitId
|
|
2270
|
-
};
|
|
2271
|
-
this._canvasFloatDomService.addFloatDom({
|
|
2272
|
-
position$,
|
|
2273
|
-
id: drawingId,
|
|
2274
|
-
componentKey: floatDomParam.componentKey,
|
|
2275
|
-
onPointerDown: /* @__PURE__ */ __name((evt) => {
|
|
2276
|
-
canvas.dispatchEvent(new PointerEvent(evt.type, evt));
|
|
2277
|
-
}, "onPointerDown"),
|
|
2278
|
-
onPointerMove: /* @__PURE__ */ __name((evt) => {
|
|
2279
|
-
canvas.dispatchEvent(new PointerEvent(evt.type, evt));
|
|
2280
|
-
}, "onPointerMove"),
|
|
2281
|
-
onPointerUp: /* @__PURE__ */ __name((evt) => {
|
|
2282
|
-
canvas.dispatchEvent(new PointerEvent(evt.type, evt));
|
|
2283
|
-
}, "onPointerUp"),
|
|
2284
|
-
onWheel: /* @__PURE__ */ __name((evt) => {
|
|
2285
|
-
canvas.dispatchEvent(new WheelEvent(evt.type, evt));
|
|
2286
|
-
}, "onWheel"),
|
|
2287
|
-
props: (_c = (_b = map2.get(drawingId)) == null ? void 0 : _b.props) != null ? _c : this._getFloatDomProps(drawingId),
|
|
2288
|
-
data,
|
|
2289
|
-
unitId
|
|
2290
|
-
});
|
|
2291
|
-
const listener = rect.onTransformChange$.subscribeEvent(() => {
|
|
2292
|
-
const newPosition = calcPosition(rect, renderObject.renderObject, skeleton.skeleton, target.worksheet);
|
|
2293
|
-
position$.next(
|
|
2294
|
-
newPosition
|
|
2295
|
-
);
|
|
2296
|
-
});
|
|
2297
|
-
disposableCollection.add(() => {
|
|
2298
|
-
this._canvasFloatDomService.removeFloatDom(drawingId);
|
|
2299
|
-
}), listener && disposableCollection.add(listener), this._domLayerInfoMap.set(drawingId, info), map2.set(drawingId, {
|
|
2300
|
-
...map2.get(drawingId)
|
|
2301
|
-
});
|
|
2302
|
-
});
|
|
2303
|
-
})
|
|
2304
|
-
), this.disposeWithMe(
|
|
2305
|
-
this._drawingManagerService.remove$.subscribe((params) => {
|
|
2306
|
-
params.forEach((param) => {
|
|
2307
|
-
const { unitId, subUnitId, drawingId } = param, rectShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
|
|
2308
|
-
if (renderObject == null)
|
|
2309
|
-
return;
|
|
2310
|
-
const { transformer, scene } = renderObject, rectShape = scene.getObject(rectShapeKey);
|
|
2311
|
-
rectShape != null && rectShape.oKey && transformer.clearControlByIds([rectShape == null ? void 0 : rectShape.oKey]);
|
|
2312
|
-
});
|
|
2313
|
-
})
|
|
2314
|
-
);
|
|
2315
|
-
}
|
|
2316
|
-
_scrollUpdateListener() {
|
|
2317
|
-
const updateSheet = /* @__PURE__ */ __name((unitId, subUnitId) => {
|
|
2318
|
-
var _a11;
|
|
2319
|
-
const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId), map2 = this._ensureMap(unitId, subUnitId), ids = Array.from(map2.keys()), target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), skeleton = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
|
|
2320
|
-
!renderObject || !target || !skeleton || ids.forEach((id) => {
|
|
2321
|
-
const info = this._domLayerInfoMap.get(id);
|
|
2322
|
-
if (info) {
|
|
2323
|
-
const position = calcPosition(info.rect, renderObject.renderObject, skeleton.skeleton, target.worksheet);
|
|
2324
|
-
info.position$.next(position);
|
|
2325
|
-
}
|
|
2326
|
-
});
|
|
2327
|
-
}, "updateSheet");
|
|
2328
|
-
this.disposeWithMe(
|
|
2329
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(
|
|
2330
|
-
filter((sheet) => !!sheet),
|
|
2331
|
-
map((sheet) => {
|
|
2332
|
-
const render2 = this._renderManagerService.getRenderById(sheet.getUnitId());
|
|
2333
|
-
return render2 ? { render: render2, unitId: sheet.getUnitId(), subUnitId: sheet.getActiveSheet().getSheetId() } : null;
|
|
2334
|
-
}),
|
|
2335
|
-
filter((render2) => !!render2),
|
|
2336
|
-
switchMap(
|
|
2337
|
-
(render2) => fromEventSubject(render2.render.scene.getViewport(VIEWPORT_KEY.VIEW_MAIN).onScrollAfter$).pipe(map(() => ({ unitId: render2.unitId, subUnitId: render2.subUnitId })))
|
|
2338
|
-
)
|
|
2339
|
-
).subscribe(({ unitId, subUnitId }) => {
|
|
2340
|
-
updateSheet(unitId, subUnitId);
|
|
2341
|
-
})
|
|
2342
|
-
), this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
2343
|
-
var _a11, _b;
|
|
2344
|
-
if (commandInfo.id === SetZoomRatioOperation.id) {
|
|
2345
|
-
const params = commandInfo.params, { unitId } = params;
|
|
2346
|
-
Array.from((_b = (_a11 = this._domLayerMap.get(unitId)) == null ? void 0 : _a11.keys()) != null ? _b : []).forEach((subUnitId) => {
|
|
2347
|
-
updateSheet(unitId, subUnitId);
|
|
2348
|
-
});
|
|
2349
|
-
} else if (commandInfo.id === SetFrozenMutation.id) {
|
|
2350
|
-
const { unitId, subUnitId } = commandInfo.params;
|
|
2351
|
-
updateSheet(unitId, subUnitId);
|
|
2352
|
-
}
|
|
2353
|
-
}));
|
|
2354
|
-
}
|
|
2355
|
-
_getPosition(position, unitId) {
|
|
2356
|
-
var _a11;
|
|
2357
|
-
const { startX, endX, startY, endY } = position, selectionRenderService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(ISheetSelectionRenderService);
|
|
2358
|
-
if (selectionRenderService == null)
|
|
2359
|
-
return;
|
|
2360
|
-
const start = selectionRenderService.getSelectionCellByPosition(startX, startY);
|
|
2361
|
-
if (start == null)
|
|
2362
|
-
return;
|
|
2363
|
-
const from = {
|
|
2364
|
-
column: start.actualColumn,
|
|
2365
|
-
columnOffset: startX - start.startX,
|
|
2366
|
-
row: start.actualRow,
|
|
2367
|
-
rowOffset: startY - start.startY
|
|
2368
|
-
}, end = selectionRenderService.getSelectionCellByPosition(endX, endY);
|
|
2369
|
-
if (end == null)
|
|
2370
|
-
return;
|
|
2371
|
-
const to = {
|
|
2372
|
-
column: end.actualColumn,
|
|
2373
|
-
columnOffset: endX - end.startX,
|
|
2374
|
-
row: end.actualRow,
|
|
2375
|
-
rowOffset: endY - end.startY
|
|
2376
|
-
};
|
|
2377
|
-
return {
|
|
2378
|
-
from,
|
|
2379
|
-
to
|
|
2380
|
-
};
|
|
2381
|
-
}
|
|
2382
|
-
_featureUpdateListener() {
|
|
2383
|
-
this.disposeWithMe(
|
|
2384
|
-
this._drawingManagerService.update$.subscribe((params) => {
|
|
2385
|
-
params.forEach((data) => {
|
|
2386
|
-
const sheetDrawing = this._drawingManagerService.getDrawingByParam(data);
|
|
2387
|
-
if (!sheetDrawing || sheetDrawing.drawingType !== DrawingTypeEnum.DRAWING_DOM && sheetDrawing.drawingType !== DrawingTypeEnum.DRAWING_CHART)
|
|
2388
|
-
return;
|
|
2389
|
-
const newValue = {
|
|
2390
|
-
...sheetDrawing.transform
|
|
2391
|
-
};
|
|
2392
|
-
this._transformChange$.next({ id: data.drawingId, value: newValue });
|
|
2393
|
-
});
|
|
2394
|
-
})
|
|
2395
|
-
);
|
|
2396
|
-
}
|
|
2397
|
-
_deleteListener() {
|
|
2398
|
-
this.disposeWithMe(
|
|
2399
|
-
this._drawingManagerService.remove$.subscribe((params) => {
|
|
2400
|
-
params.forEach((param) => {
|
|
2401
|
-
this._removeDom(param.drawingId);
|
|
2402
|
-
});
|
|
2403
|
-
})
|
|
2404
|
-
);
|
|
2405
|
-
}
|
|
2406
|
-
updateFloatDomProps(unitId, subUnitId, id, props) {
|
|
2407
|
-
const info = this._domLayerInfoMap.get(id), renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
|
|
2408
|
-
if (info && renderObject) {
|
|
2409
|
-
const { scene } = renderObject, rectShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId: id }), rectShape = scene.getObject(rectShapeKey);
|
|
2410
|
-
rectShape && rectShape instanceof Rect && rectShape.setProps(props);
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
addFloatDomToPosition(layer, propId, executeCommand = !0) {
|
|
2414
|
-
const target = getSheetCommandTarget(this._univerInstanceService, {
|
|
2415
|
-
unitId: layer.unitId,
|
|
2416
|
-
subUnitId: layer.subUnitId
|
|
2417
|
-
});
|
|
2418
|
-
if (!target)
|
|
2419
|
-
throw new Error("cannot find current target!");
|
|
2420
|
-
const { unitId, subUnitId } = target, { initPosition, componentKey, data, allowTransform = !0 } = layer, id = propId != null ? propId : generateRandomId(), sheetTransform = this._getPosition(initPosition, unitId);
|
|
2421
|
-
if (sheetTransform == null)
|
|
2422
|
-
return;
|
|
2423
|
-
this._ensureMap(unitId, subUnitId).set(id, layer);
|
|
2424
|
-
const sheetDrawingParam = {
|
|
2425
|
-
unitId,
|
|
2426
|
-
subUnitId,
|
|
2427
|
-
drawingId: id,
|
|
2428
|
-
drawingType: layer.type || DrawingTypeEnum.DRAWING_DOM,
|
|
2429
|
-
componentKey,
|
|
2430
|
-
sheetTransform,
|
|
2431
|
-
transform: {
|
|
2432
|
-
left: initPosition.startX,
|
|
2433
|
-
top: initPosition.startY,
|
|
2434
|
-
width: initPosition.endX - initPosition.startX,
|
|
2435
|
-
height: initPosition.endY - initPosition.startY
|
|
2436
|
-
},
|
|
2437
|
-
data,
|
|
2438
|
-
allowTransform
|
|
2439
|
-
};
|
|
2440
|
-
return executeCommand && this._commandService.executeCommand(InsertSheetDrawingCommand.id, {
|
|
2441
|
-
unitId,
|
|
2442
|
-
drawings: [sheetDrawingParam]
|
|
2443
|
-
}), this._add$.next({ unitId, subUnitId, id }), {
|
|
2444
|
-
id,
|
|
2445
|
-
dispose: /* @__PURE__ */ __name(() => {
|
|
2446
|
-
this._removeDom(id, !0);
|
|
2447
|
-
}, "dispose"),
|
|
2448
|
-
sheetDrawingParam
|
|
2449
|
-
};
|
|
2450
|
-
}
|
|
2451
|
-
_removeDom(id, removeDrawing = !1) {
|
|
2452
|
-
const info = this._domLayerInfoMap.get(id);
|
|
2453
|
-
if (!info)
|
|
2454
|
-
return;
|
|
2455
|
-
const { unitId, subUnitId } = info;
|
|
2456
|
-
this._domLayerInfoMap.delete(id), info.dispose.dispose();
|
|
2457
|
-
const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
|
|
2458
|
-
if (renderObject && renderObject.scene.removeObject(info.rect), removeDrawing) {
|
|
2459
|
-
this._ensureMap(unitId, subUnitId).delete(id);
|
|
2460
|
-
const param = this._drawingManagerService.getDrawingByParam({ unitId, subUnitId, drawingId: id });
|
|
2461
|
-
if (!param)
|
|
2462
|
-
return;
|
|
2463
|
-
const jsonOp = this._sheetDrawingService.getBatchRemoveOp([param]), { redo, objects } = jsonOp;
|
|
2464
|
-
this._commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.REMOVE });
|
|
2465
|
-
}
|
|
2466
|
-
}
|
|
2467
|
-
addHook(hook) {
|
|
2468
|
-
return this._hooks.push(hook), {
|
|
2469
|
-
dispose: /* @__PURE__ */ __name(() => {
|
|
2470
|
-
const index = this._hooks.findIndex((h) => h === hook);
|
|
2471
|
-
this._hooks.splice(index, 1);
|
|
2472
|
-
}, "dispose")
|
|
2473
|
-
};
|
|
2474
|
-
}
|
|
2475
|
-
}, __name(_a9, "SheetCanvasFloatDomManagerService"), _a9);
|
|
2476
|
-
SheetCanvasFloatDomManagerService = __decorateClass$1([
|
|
2477
|
-
__decorateParam$1(0, Inject(IRenderManagerService)),
|
|
2478
|
-
__decorateParam$1(1, IUniverInstanceService),
|
|
2479
|
-
__decorateParam$1(2, Inject(ICommandService)),
|
|
2480
|
-
__decorateParam$1(3, IDrawingManagerService),
|
|
2481
|
-
__decorateParam$1(4, Inject(CanvasFloatDomService)),
|
|
2482
|
-
__decorateParam$1(5, ISheetDrawingService),
|
|
2483
|
-
__decorateParam$1(6, Inject(LifecycleService))
|
|
2484
|
-
], SheetCanvasFloatDomManagerService);
|
|
2485
2099
|
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) => {
|
|
2486
2100
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2487
2101
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2488
2102
|
return kind && result && __defProp2(target, key, result), result;
|
|
2489
2103
|
}, "__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");
|
|
2490
2104
|
const PLUGIN_NAME = "SHEET_IMAGE_UI_PLUGIN";
|
|
2491
|
-
var
|
|
2492
|
-
let UniverSheetsDrawingUIPlugin = (
|
|
2105
|
+
var _a9;
|
|
2106
|
+
let UniverSheetsDrawingUIPlugin = (_a9 = class extends Plugin {
|
|
2493
2107
|
constructor(_config = defaultPluginConfig, _injector, _renderManagerService, _configService) {
|
|
2494
2108
|
super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService, this._configService = _configService;
|
|
2495
2109
|
const { menu, ...rest } = this._config;
|
|
@@ -2531,7 +2145,7 @@ let UniverSheetsDrawingUIPlugin = (_a10 = class extends Plugin {
|
|
|
2531
2145
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
|
|
2532
2146
|
});
|
|
2533
2147
|
}
|
|
2534
|
-
}, __name(
|
|
2148
|
+
}, __name(_a9, "UniverSheetsDrawingUIPlugin"), _a9);
|
|
2535
2149
|
__publicField2(UniverSheetsDrawingUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
2536
2150
|
__publicField2(UniverSheetsDrawingUIPlugin, "pluginName", PLUGIN_NAME);
|
|
2537
2151
|
UniverSheetsDrawingUIPlugin = __decorateClass([
|