@univerjs/sheets-drawing-ui 0.3.0 → 0.4.0-alpha.1
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 +667 -651
- package/lib/locale/fa-IR.json +41 -0
- package/lib/types/controllers/render-controllers/sheet-drawing.render-controller.d.ts +3 -4
- package/lib/types/controllers/sheet-drawing.controller.d.ts +2 -3
- package/lib/types/locale/fa-IR.d.ts +3 -0
- package/lib/types/plugin.d.ts +3 -2
- package/lib/umd/index.js +1 -1
- package/package.json +16 -27
package/lib/es/index.js
CHANGED
|
@@ -2,19 +2,18 @@ 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,
|
|
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, DrawingTypeEnum as DrawingTypeEnum$1, DisposableCollection, generateRandomId, 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, getDrawingShapeKeyByDrawingSearch, UniverDrawingPlugin } from "@univerjs/drawing";
|
|
6
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, Rect, DRAWING_OBJECT_LAYER_INDEX, SHEET_VIEWPORT_KEY } from "@univerjs/engine-render";
|
|
7
9
|
import { ISheetDrawingService, SetDrawingApplyMutation, DrawingApplyType, SheetDrawingAnchorType, UniverSheetsDrawingPlugin } from "@univerjs/sheets-drawing";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { takeUntil, Subject, BehaviorSubject, combineLatest, map, filter, distinctUntilChanged } from "rxjs";
|
|
13
|
-
import { getSheetCommandTarget, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, 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, SheetInterceptorService, SetWorksheetActiveOperation, SetFrozenMutation, WorkbookViewPermission, WorksheetViewPermission } from "@univerjs/sheets";
|
|
10
|
+
import { SheetCanvasPopManagerService, attachRangeWithCoord, ISheetSelectionRenderService, SheetSkeletonManagerService, getCurrentRangeDisable$, COPY_TYPE, PREDEFINED_HOOK_NAME, virtualizeDiscreteRanges, ISheetClipboardService, SheetPrintInterceptorService, SetScrollOperation, SetZoomRatioOperation } from "@univerjs/sheets-ui";
|
|
11
|
+
import { ISidebarService, IUIPartsService, BuiltInUIPart, ILocalFileService, IMessageService, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, KeyCode, ComponentManager, IMenuManagerService, IShortcutService, CanvasFloatDomService } from "@univerjs/ui";
|
|
12
|
+
import { takeUntil, combineLatest, map, filter, distinctUntilChanged, Subject, BehaviorSubject } from "rxjs";
|
|
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, SheetInterceptorService, SetWorksheetActiveOperation, SetFrozenMutation } from "@univerjs/sheets";
|
|
14
14
|
import React, { useEffect, forwardRef, useRef, createElement, useState } from "react";
|
|
15
15
|
import { MessageType, RadioGroup, Radio } from "@univerjs/design";
|
|
16
|
-
|
|
17
|
-
const ClearSheetDrawingTransformerOperation = {
|
|
16
|
+
const PLUGIN_CONFIG_KEY = "sheets-drawing-ui.config", defaultPluginConfig = {}, ClearSheetDrawingTransformerOperation = {
|
|
18
17
|
id: "sheet.operation.clear-drawing-transformer",
|
|
19
18
|
type: CommandType.MUTATION,
|
|
20
19
|
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
@@ -211,7 +210,6 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
|
211
210
|
}
|
|
212
211
|
}, __name(_a, "DrawingPopupMenuController"), _a);
|
|
213
212
|
DrawingPopupMenuController = __decorateClass$9([
|
|
214
|
-
OnLifecycle(LifecycleStages.Steady, DrawingPopupMenuController),
|
|
215
213
|
__decorateParam$9(0, Inject(Injector)),
|
|
216
214
|
__decorateParam$9(1, IDrawingManagerService),
|
|
217
215
|
__decorateParam$9(2, Inject(SheetCanvasPopManagerService)),
|
|
@@ -283,6 +281,114 @@ function transformToDrawingPosition(transform, selectionRenderService) {
|
|
|
283
281
|
};
|
|
284
282
|
}
|
|
285
283
|
__name(transformToDrawingPosition, "transformToDrawingPosition");
|
|
284
|
+
var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
285
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
286
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
287
|
+
return kind && result && __defProp$8(target, key, result), result;
|
|
288
|
+
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a2;
|
|
289
|
+
let SheetsDrawingRenderController = (_a2 = class extends Disposable {
|
|
290
|
+
constructor(_context, _sheetDrawingService, _drawingManagerService, _sheetSelectionRenderService, _sheetSkeletonManagerService) {
|
|
291
|
+
super(), this._context = _context, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._sheetSelectionRenderService = _sheetSelectionRenderService, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._init();
|
|
292
|
+
}
|
|
293
|
+
_init() {
|
|
294
|
+
this._drawingInitializeListener();
|
|
295
|
+
}
|
|
296
|
+
_drawingInitializeListener() {
|
|
297
|
+
this._sheetDrawingService.initializeNotification(this._context.unitId);
|
|
298
|
+
const data = this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);
|
|
299
|
+
for (const subUnit in data) {
|
|
300
|
+
const subUnitData = data[subUnit];
|
|
301
|
+
for (const drawingId in subUnitData.data) {
|
|
302
|
+
const drawingData = subUnitData.data[drawingId];
|
|
303
|
+
drawingData.transform = drawingPositionToTransform(drawingData.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
|
|
307
|
+
}
|
|
308
|
+
}, __name(_a2, "SheetsDrawingRenderController"), _a2);
|
|
309
|
+
SheetsDrawingRenderController = __decorateClass$8([
|
|
310
|
+
__decorateParam$8(1, ISheetDrawingService),
|
|
311
|
+
__decorateParam$8(2, IDrawingManagerService),
|
|
312
|
+
__decorateParam$8(3, Inject(ISheetSelectionRenderService)),
|
|
313
|
+
__decorateParam$8(4, Inject(SheetSkeletonManagerService))
|
|
314
|
+
], SheetsDrawingRenderController);
|
|
315
|
+
var __assign = function() {
|
|
316
|
+
return __assign = Object.assign || function(t) {
|
|
317
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
318
|
+
s = arguments[i];
|
|
319
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
|
|
320
|
+
}
|
|
321
|
+
return t;
|
|
322
|
+
}, __assign.apply(this, arguments);
|
|
323
|
+
}, __rest = function(s, e) {
|
|
324
|
+
var t = {};
|
|
325
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
326
|
+
if (s != null && typeof Object.getOwnPropertySymbols == "function")
|
|
327
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
|
328
|
+
e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
|
|
329
|
+
return t;
|
|
330
|
+
}, IconBase = forwardRef(function(props, ref) {
|
|
331
|
+
var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
|
|
332
|
+
return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
|
|
333
|
+
});
|
|
334
|
+
function render(node, id, runtimeProps, rootProps, extend) {
|
|
335
|
+
return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
|
|
336
|
+
return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
|
|
337
|
+
}));
|
|
338
|
+
}
|
|
339
|
+
__name(render, "render");
|
|
340
|
+
function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
341
|
+
var attrs = __assign({}, node.attrs);
|
|
342
|
+
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
343
|
+
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(_a11) {
|
|
345
|
+
var key = _a11[0], value = _a11[1];
|
|
346
|
+
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
347
|
+
})), attrs;
|
|
348
|
+
}
|
|
349
|
+
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
350
|
+
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
351
|
+
var _a11, defIds = runtimeProps.defIds;
|
|
352
|
+
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) {
|
|
353
|
+
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
|
+
}) }) : node;
|
|
355
|
+
}
|
|
356
|
+
__name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
|
|
357
|
+
function generateShortUuid() {
|
|
358
|
+
return Math.random().toString(36).substring(2, 8);
|
|
359
|
+
}
|
|
360
|
+
__name(generateShortUuid, "generateShortUuid");
|
|
361
|
+
IconBase.displayName = "UniverIcon";
|
|
362
|
+
var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, AddImageSingle = forwardRef(function(props, ref) {
|
|
363
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
364
|
+
id: "add-image-single",
|
|
365
|
+
ref,
|
|
366
|
+
icon: element
|
|
367
|
+
}));
|
|
368
|
+
});
|
|
369
|
+
AddImageSingle.displayName = "AddImageSingle";
|
|
370
|
+
const DeleteDrawingsCommand = {
|
|
371
|
+
id: "sheet.command.delete-drawing",
|
|
372
|
+
type: CommandType.COMMAND,
|
|
373
|
+
handler: /* @__PURE__ */ __name((accessor) => {
|
|
374
|
+
const commandService = accessor.get(ICommandService), drawings = accessor.get(ISheetDrawingService).getFocusDrawings();
|
|
375
|
+
if (drawings.length === 0)
|
|
376
|
+
return !1;
|
|
377
|
+
const unitId = drawings[0].unitId, newDrawings = drawings.map((drawing) => {
|
|
378
|
+
const { unitId: unitId2, subUnitId, drawingId, drawingType } = drawing;
|
|
379
|
+
return {
|
|
380
|
+
unitId: unitId2,
|
|
381
|
+
subUnitId,
|
|
382
|
+
drawingId,
|
|
383
|
+
drawingType
|
|
384
|
+
};
|
|
385
|
+
});
|
|
386
|
+
return commandService.executeCommand(RemoveSheetDrawingCommand.id, {
|
|
387
|
+
unitId,
|
|
388
|
+
drawings: newDrawings
|
|
389
|
+
});
|
|
390
|
+
}, "handler")
|
|
391
|
+
};
|
|
286
392
|
function ungroupToGroup(ungroupParams) {
|
|
287
393
|
const newGroupParams = [];
|
|
288
394
|
return ungroupParams.forEach((ungroupParam) => {
|
|
@@ -455,12 +561,12 @@ const GroupSheetDrawingCommand = {
|
|
|
455
561
|
}), !0) : !1;
|
|
456
562
|
}, "handler")
|
|
457
563
|
};
|
|
458
|
-
var __defProp$
|
|
459
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
564
|
+
var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
565
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
460
566
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
461
|
-
return kind && result && __defProp$
|
|
462
|
-
}, "__decorateClass$
|
|
463
|
-
let SheetDrawingUpdateController = (
|
|
567
|
+
return kind && result && __defProp$7(target, key, result), result;
|
|
568
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a3;
|
|
569
|
+
let SheetDrawingUpdateController = (_a3 = class extends Disposable {
|
|
464
570
|
constructor(_context, _skeletonManagerService, _commandService, _selectionRenderService, _imageIoService, _fileOpenerService, _sheetDrawingService, _drawingManagerService, _contextService, _messageService, _localeService, selectionManagerService) {
|
|
465
571
|
super();
|
|
466
572
|
__publicField(this, "_workbookSelections");
|
|
@@ -617,75 +723,20 @@ let SheetDrawingUpdateController = (_a2 = class extends Disposable {
|
|
|
617
723
|
})
|
|
618
724
|
);
|
|
619
725
|
}
|
|
620
|
-
}, __name(
|
|
621
|
-
SheetDrawingUpdateController = __decorateClass$
|
|
622
|
-
__decorateParam$
|
|
623
|
-
__decorateParam$
|
|
624
|
-
__decorateParam$
|
|
625
|
-
__decorateParam$
|
|
626
|
-
__decorateParam$
|
|
627
|
-
__decorateParam$
|
|
628
|
-
__decorateParam$
|
|
629
|
-
__decorateParam$
|
|
630
|
-
__decorateParam$
|
|
631
|
-
__decorateParam$
|
|
632
|
-
__decorateParam$
|
|
726
|
+
}, __name(_a3, "SheetDrawingUpdateController"), _a3);
|
|
727
|
+
SheetDrawingUpdateController = __decorateClass$7([
|
|
728
|
+
__decorateParam$7(1, Inject(SheetSkeletonManagerService)),
|
|
729
|
+
__decorateParam$7(2, ICommandService),
|
|
730
|
+
__decorateParam$7(3, ISheetSelectionRenderService),
|
|
731
|
+
__decorateParam$7(4, IImageIoService),
|
|
732
|
+
__decorateParam$7(5, ILocalFileService),
|
|
733
|
+
__decorateParam$7(6, ISheetDrawingService),
|
|
734
|
+
__decorateParam$7(7, IDrawingManagerService),
|
|
735
|
+
__decorateParam$7(8, IContextService),
|
|
736
|
+
__decorateParam$7(9, IMessageService),
|
|
737
|
+
__decorateParam$7(10, Inject(LocaleService)),
|
|
738
|
+
__decorateParam$7(11, Inject(SheetsSelectionsService))
|
|
633
739
|
], SheetDrawingUpdateController);
|
|
634
|
-
var __assign = function() {
|
|
635
|
-
return __assign = Object.assign || function(t) {
|
|
636
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
637
|
-
s = arguments[i];
|
|
638
|
-
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
|
|
639
|
-
}
|
|
640
|
-
return t;
|
|
641
|
-
}, __assign.apply(this, arguments);
|
|
642
|
-
}, __rest = function(s, e) {
|
|
643
|
-
var t = {};
|
|
644
|
-
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
645
|
-
if (s != null && typeof Object.getOwnPropertySymbols == "function")
|
|
646
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
|
647
|
-
e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
|
|
648
|
-
return t;
|
|
649
|
-
}, IconBase = forwardRef(function(props, ref) {
|
|
650
|
-
var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
|
|
651
|
-
return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
|
|
652
|
-
});
|
|
653
|
-
function render(node, id, runtimeProps, rootProps, extend) {
|
|
654
|
-
return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
|
|
655
|
-
return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
|
|
656
|
-
}));
|
|
657
|
-
}
|
|
658
|
-
__name(render, "render");
|
|
659
|
-
function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
660
|
-
var attrs = __assign({}, node.attrs);
|
|
661
|
-
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
662
|
-
var defIds = runtimeProps.defIds;
|
|
663
|
-
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) {
|
|
664
|
-
var key = _a11[0], value = _a11[1];
|
|
665
|
-
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
666
|
-
})), attrs;
|
|
667
|
-
}
|
|
668
|
-
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
669
|
-
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
670
|
-
var _a11, defIds = runtimeProps.defIds;
|
|
671
|
-
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) {
|
|
672
|
-
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;
|
|
673
|
-
}) }) : node;
|
|
674
|
-
}
|
|
675
|
-
__name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
|
|
676
|
-
function generateShortUuid() {
|
|
677
|
-
return Math.random().toString(36).substring(2, 8);
|
|
678
|
-
}
|
|
679
|
-
__name(generateShortUuid, "generateShortUuid");
|
|
680
|
-
IconBase.displayName = "UniverIcon";
|
|
681
|
-
var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, AddImageSingle = forwardRef(function(props, ref) {
|
|
682
|
-
return createElement(IconBase, Object.assign({}, props, {
|
|
683
|
-
id: "add-image-single",
|
|
684
|
-
ref,
|
|
685
|
-
icon: element
|
|
686
|
-
}));
|
|
687
|
-
});
|
|
688
|
-
AddImageSingle.displayName = "AddImageSingle";
|
|
689
740
|
const InsertFloatImageCommand = {
|
|
690
741
|
id: "sheet.command.insert-float-image",
|
|
691
742
|
type: CommandType.COMMAND,
|
|
@@ -693,6 +744,29 @@ const InsertFloatImageCommand = {
|
|
|
693
744
|
var _a11, _b;
|
|
694
745
|
return (_b = (_a11 = accessor.get(IRenderManagerService).getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a11.with(SheetDrawingUpdateController).insertFloatImage()) != null ? _b : !1;
|
|
695
746
|
}, "handler")
|
|
747
|
+
}, MoveDrawingsCommand = {
|
|
748
|
+
id: "sheet.command.move-drawing",
|
|
749
|
+
type: CommandType.COMMAND,
|
|
750
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
751
|
+
const commandService = accessor.get(ICommandService), drawingManagerService = accessor.get(ISheetDrawingService), selectionRenderService = accessor.get(ISheetSelectionRenderService), { direction } = params, drawings = drawingManagerService.getFocusDrawings();
|
|
752
|
+
if (drawings.length === 0)
|
|
753
|
+
return !1;
|
|
754
|
+
const unitId = drawings[0].unitId, newDrawings = drawings.map((drawing) => {
|
|
755
|
+
const { transform } = drawing;
|
|
756
|
+
if (transform == null)
|
|
757
|
+
return null;
|
|
758
|
+
const newTransform = { ...transform }, { left = 0, top = 0 } = transform;
|
|
759
|
+
return direction === Direction.UP ? newTransform.top = top - 1 : direction === Direction.DOWN ? newTransform.top = top + 1 : direction === Direction.LEFT ? newTransform.left = left - 1 : direction === Direction.RIGHT && (newTransform.left = left + 1), {
|
|
760
|
+
...drawing,
|
|
761
|
+
transform: newTransform,
|
|
762
|
+
sheetTransform: transformToDrawingPosition(newTransform, selectionRenderService)
|
|
763
|
+
};
|
|
764
|
+
}).filter((drawing) => drawing != null);
|
|
765
|
+
return commandService.syncExecuteCommand(SetSheetDrawingCommand.id, {
|
|
766
|
+
unitId,
|
|
767
|
+
drawings: newDrawings
|
|
768
|
+
}) ? (commandService.syncExecuteCommand(ClearSheetDrawingTransformerOperation.id, [unitId]), !0) : !1;
|
|
769
|
+
}, "handler")
|
|
696
770
|
}, IMAGE_UPLOAD_ICON = "addition-and-subtraction-single", IMAGE_MENU_ID = "sheet.menu.image";
|
|
697
771
|
function ImageMenuFactory(accessor) {
|
|
698
772
|
return {
|
|
@@ -730,7 +804,23 @@ const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "un
|
|
|
730
804
|
imageCommonPanelInput,
|
|
731
805
|
sheetImageMenu,
|
|
732
806
|
sheetImageMenuInput
|
|
733
|
-
}
|
|
807
|
+
};
|
|
808
|
+
function r(e) {
|
|
809
|
+
var t, f, n = "";
|
|
810
|
+
if (typeof e == "string" || typeof e == "number") n += e;
|
|
811
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
812
|
+
var o = e.length;
|
|
813
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
814
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
815
|
+
return n;
|
|
816
|
+
}
|
|
817
|
+
__name(r, "r");
|
|
818
|
+
function clsx() {
|
|
819
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
820
|
+
return n;
|
|
821
|
+
}
|
|
822
|
+
__name(clsx, "clsx");
|
|
823
|
+
const SheetDrawingAnchor = /* @__PURE__ */ __name((props) => {
|
|
734
824
|
var _a11;
|
|
735
825
|
const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), drawingManagerService = useDependency(IDrawingManagerService), renderManagerService = useDependency(IRenderManagerService), { drawings } = props, drawingParam = drawings[0];
|
|
736
826
|
if (drawingParam == null)
|
|
@@ -803,50 +893,17 @@ const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "un
|
|
|
803
893
|
focusDispose.unsubscribe();
|
|
804
894
|
};
|
|
805
895
|
}, []), !!(drawings != null && drawings.length) && /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanel }, /* @__PURE__ */ React.createElement(DrawingCommonPanel, { drawings }), /* @__PURE__ */ React.createElement(SheetDrawingAnchor, { drawings }));
|
|
806
|
-
}, "SheetDrawingPanel"),
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
const newTransform = { ...transform }, { left = 0, top = 0 } = transform;
|
|
818
|
-
return direction === Direction.UP ? newTransform.top = top - 1 : direction === Direction.DOWN ? newTransform.top = top + 1 : direction === Direction.LEFT ? newTransform.left = left - 1 : direction === Direction.RIGHT && (newTransform.left = left + 1), {
|
|
819
|
-
...drawing,
|
|
820
|
-
transform: newTransform,
|
|
821
|
-
sheetTransform: transformToDrawingPosition(newTransform, selectionRenderService)
|
|
822
|
-
};
|
|
823
|
-
}).filter((drawing) => drawing != null);
|
|
824
|
-
return commandService.syncExecuteCommand(SetSheetDrawingCommand.id, {
|
|
825
|
-
unitId,
|
|
826
|
-
drawings: newDrawings
|
|
827
|
-
}) ? (commandService.syncExecuteCommand(ClearSheetDrawingTransformerOperation.id, [unitId]), !0) : !1;
|
|
828
|
-
}, "handler")
|
|
829
|
-
}, DeleteDrawingsCommand = {
|
|
830
|
-
id: "sheet.command.delete-drawing",
|
|
831
|
-
type: CommandType.COMMAND,
|
|
832
|
-
handler: /* @__PURE__ */ __name((accessor) => {
|
|
833
|
-
const commandService = accessor.get(ICommandService), drawings = accessor.get(ISheetDrawingService).getFocusDrawings();
|
|
834
|
-
if (drawings.length === 0)
|
|
835
|
-
return !1;
|
|
836
|
-
const unitId = drawings[0].unitId, newDrawings = drawings.map((drawing) => {
|
|
837
|
-
const { unitId: unitId2, subUnitId, drawingId, drawingType } = drawing;
|
|
838
|
-
return {
|
|
839
|
-
unitId: unitId2,
|
|
840
|
-
subUnitId,
|
|
841
|
-
drawingId,
|
|
842
|
-
drawingType
|
|
843
|
-
};
|
|
844
|
-
});
|
|
845
|
-
return commandService.executeCommand(RemoveSheetDrawingCommand.id, {
|
|
846
|
-
unitId,
|
|
847
|
-
drawings: newDrawings
|
|
848
|
-
});
|
|
849
|
-
}, "handler")
|
|
896
|
+
}, "SheetDrawingPanel"), menuSchema = {
|
|
897
|
+
[RibbonStartGroup.FORMULAS_INSERT]: {
|
|
898
|
+
[IMAGE_MENU_ID]: {
|
|
899
|
+
order: 3,
|
|
900
|
+
menuItemFactory: ImageMenuFactory,
|
|
901
|
+
[InsertFloatImageCommand.id]: {
|
|
902
|
+
order: 0,
|
|
903
|
+
menuItemFactory: UploadFloatImageMenuFactory
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
850
907
|
};
|
|
851
908
|
function whenSheetDrawingFocused(contextService) {
|
|
852
909
|
return !contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) && !contextService.getContextValue(EDITOR_ACTIVATED) && contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);
|
|
@@ -900,26 +957,15 @@ const MoveDrawingDownShortcutItem = {
|
|
|
900
957
|
preconditions: whenSheetDrawingFocused,
|
|
901
958
|
binding: KeyCode.DELETE,
|
|
902
959
|
mac: KeyCode.BACKSPACE
|
|
903
|
-
}, menuSchema = {
|
|
904
|
-
[RibbonStartGroup.FORMULAS_INSERT]: {
|
|
905
|
-
[IMAGE_MENU_ID]: {
|
|
906
|
-
order: 3,
|
|
907
|
-
menuItemFactory: ImageMenuFactory,
|
|
908
|
-
[InsertFloatImageCommand.id]: {
|
|
909
|
-
order: 0,
|
|
910
|
-
menuItemFactory: UploadFloatImageMenuFactory
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
960
|
};
|
|
915
|
-
var __defProp$
|
|
916
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
961
|
+
var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
962
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
917
963
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
918
|
-
return kind && result && __defProp$
|
|
919
|
-
}, "__decorateClass$
|
|
920
|
-
let SheetDrawingUIController = (
|
|
921
|
-
constructor(
|
|
922
|
-
super(), this.
|
|
964
|
+
return kind && result && __defProp$6(target, key, result), result;
|
|
965
|
+
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a4;
|
|
966
|
+
let SheetDrawingUIController = (_a4 = class extends Disposable {
|
|
967
|
+
constructor(_componentManager, _menuManagerService, _commandService, _shortcutService) {
|
|
968
|
+
super(), this._componentManager = _componentManager, this._menuManagerService = _menuManagerService, this._commandService = _commandService, this._shortcutService = _shortcutService, this._init();
|
|
923
969
|
}
|
|
924
970
|
_initCustomComponents() {
|
|
925
971
|
const componentManager = this._componentManager;
|
|
@@ -959,22 +1005,370 @@ let SheetDrawingUIController = (_a3 = class extends Disposable {
|
|
|
959
1005
|
_init() {
|
|
960
1006
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
961
1007
|
}
|
|
962
|
-
}, __name(
|
|
963
|
-
SheetDrawingUIController = __decorateClass$
|
|
964
|
-
|
|
965
|
-
__decorateParam$
|
|
966
|
-
__decorateParam$
|
|
967
|
-
__decorateParam$
|
|
968
|
-
__decorateParam$7(3, ICommandService),
|
|
969
|
-
__decorateParam$7(4, IShortcutService)
|
|
1008
|
+
}, __name(_a4, "SheetDrawingUIController"), _a4);
|
|
1009
|
+
SheetDrawingUIController = __decorateClass$6([
|
|
1010
|
+
__decorateParam$6(0, Inject(ComponentManager)),
|
|
1011
|
+
__decorateParam$6(1, IMenuManagerService),
|
|
1012
|
+
__decorateParam$6(2, ICommandService),
|
|
1013
|
+
__decorateParam$6(3, IShortcutService)
|
|
970
1014
|
], SheetDrawingUIController);
|
|
971
|
-
var __defProp$
|
|
972
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1015
|
+
var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1016
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
973
1017
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
974
|
-
return kind && result && __defProp$
|
|
975
|
-
}, "__decorateClass$
|
|
976
|
-
|
|
977
|
-
|
|
1018
|
+
return kind && result && __defProp$5(target, key, result), result;
|
|
1019
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a5;
|
|
1020
|
+
let SheetsDrawingCopyPasteController = (_a5 = class extends Disposable {
|
|
1021
|
+
constructor(_sheetClipboardService, _renderManagerService, _sheetDrawingService) {
|
|
1022
|
+
super();
|
|
1023
|
+
__publicField(this, "_copyInfo");
|
|
1024
|
+
this._sheetClipboardService = _sheetClipboardService, this._renderManagerService = _renderManagerService, this._sheetDrawingService = _sheetDrawingService, this._initCopyPaste();
|
|
1025
|
+
}
|
|
1026
|
+
_initCopyPaste() {
|
|
1027
|
+
this._sheetClipboardService.addClipboardHook({
|
|
1028
|
+
id: "SHEET_IMAGE_UI_PLUGIN",
|
|
1029
|
+
onBeforeCopy: /* @__PURE__ */ __name((unitId, subUnitId, range) => this._collect(unitId, subUnitId, range), "onBeforeCopy"),
|
|
1030
|
+
onPasteCells: /* @__PURE__ */ __name((pasteFrom, pasteTo, data, payload) => {
|
|
1031
|
+
const { copyType = COPY_TYPE.COPY, pasteType } = payload, { range: copyRange } = pasteFrom || {}, { range: pastedRange, unitId, subUnitId } = pasteTo;
|
|
1032
|
+
return this._generateMutations(pastedRange, { copyType, pasteType, copyRange, unitId, subUnitId });
|
|
1033
|
+
}, "onPasteCells"),
|
|
1034
|
+
onPastePlainText: /* @__PURE__ */ __name((pasteTo, clipText) => ({ undos: [], redos: [] }), "onPastePlainText")
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
_collect(unitId, subUnitId, range) {
|
|
1038
|
+
var _a11;
|
|
1039
|
+
const skeletonManagerService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService);
|
|
1040
|
+
if (!skeletonManagerService) return;
|
|
1041
|
+
const selectionRect = skeletonManagerService.attachRangeWithCoord(range);
|
|
1042
|
+
if (!selectionRect)
|
|
1043
|
+
return;
|
|
1044
|
+
const { startX, endX, startY, endY } = selectionRect, drawings = this._sheetDrawingService.getDrawingData(unitId, subUnitId), containedDrawings = [];
|
|
1045
|
+
Object.keys(drawings).forEach((drawingId) => {
|
|
1046
|
+
const drawing = drawings[drawingId], { transform } = drawing;
|
|
1047
|
+
if (drawing.anchorType !== SheetDrawingAnchorType.Both || !transform)
|
|
1048
|
+
return;
|
|
1049
|
+
const { left = 0, top = 0, width = 0, height = 0 } = transform, { drawingStartX, drawingEndX, drawingStartY, drawingEndY } = {
|
|
1050
|
+
drawingStartX: left,
|
|
1051
|
+
drawingEndX: left + width,
|
|
1052
|
+
drawingStartY: top,
|
|
1053
|
+
drawingEndY: top + height
|
|
1054
|
+
};
|
|
1055
|
+
startX <= drawingStartX && drawingEndX <= endX && startY <= drawingStartY && drawingEndY <= endY && containedDrawings.push(drawing);
|
|
1056
|
+
}), containedDrawings.length && (this._copyInfo = {
|
|
1057
|
+
drawings: containedDrawings,
|
|
1058
|
+
unitId,
|
|
1059
|
+
subUnitId
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1063
|
+
_generateMutations(pastedRange, copyInfo) {
|
|
1064
|
+
var _a11;
|
|
1065
|
+
if (!this._copyInfo)
|
|
1066
|
+
return { redos: [], undos: [] };
|
|
1067
|
+
if ([
|
|
1068
|
+
PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,
|
|
1069
|
+
PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,
|
|
1070
|
+
PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,
|
|
1071
|
+
PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA
|
|
1072
|
+
].includes(
|
|
1073
|
+
copyInfo.pasteType
|
|
1074
|
+
))
|
|
1075
|
+
return { redos: [], undos: [] };
|
|
1076
|
+
const { copyRange } = copyInfo;
|
|
1077
|
+
if (!copyRange)
|
|
1078
|
+
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 = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService);
|
|
1080
|
+
if (!skeletonManagerService)
|
|
1081
|
+
return { redos: [], undos: [] };
|
|
1082
|
+
const copyRect = skeletonManagerService.attachRangeWithCoord({
|
|
1083
|
+
startRow: copyRow,
|
|
1084
|
+
endRow: copyRow,
|
|
1085
|
+
startColumn: copyCol,
|
|
1086
|
+
endColumn: copyCol
|
|
1087
|
+
}), pasteRect = skeletonManagerService.attachRangeWithCoord({
|
|
1088
|
+
startRow: pasteRow,
|
|
1089
|
+
endRow: pasteRow,
|
|
1090
|
+
startColumn: pasteCol,
|
|
1091
|
+
endColumn: pasteCol
|
|
1092
|
+
});
|
|
1093
|
+
if (!copyRect || !pasteRect)
|
|
1094
|
+
return { redos: [], undos: [] };
|
|
1095
|
+
const redos = [], undos = [], leftOffset = pasteRect.startX - copyRect.startX, topOffset = pasteRect.startY - copyRect.startY, rowOffset = pasteRow - copyRow, columnOffset = pasteCol - copyCol, isCut = copyInfo.copyType === COPY_TYPE.CUT, { _sheetDrawingService } = this;
|
|
1096
|
+
return drawings.forEach((drawing) => {
|
|
1097
|
+
const { transform, sheetTransform } = drawing;
|
|
1098
|
+
if (!transform)
|
|
1099
|
+
return;
|
|
1100
|
+
const drawingObject = {
|
|
1101
|
+
...drawing,
|
|
1102
|
+
unitId,
|
|
1103
|
+
subUnitId,
|
|
1104
|
+
drawingId: isCut ? drawing.drawingId : Tools.generateRandomId(),
|
|
1105
|
+
transform: {
|
|
1106
|
+
...transform,
|
|
1107
|
+
left: transform.left + leftOffset,
|
|
1108
|
+
top: transform.top + topOffset
|
|
1109
|
+
},
|
|
1110
|
+
sheetTransform: {
|
|
1111
|
+
to: { ...sheetTransform.to, row: sheetTransform.to.row + rowOffset, column: sheetTransform.to.column + columnOffset },
|
|
1112
|
+
from: { ...sheetTransform.from, row: sheetTransform.from.row + rowOffset, column: sheetTransform.from.column + columnOffset }
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
if (isCut) {
|
|
1116
|
+
const { undo, redo, objects } = _sheetDrawingService.getBatchUpdateOp([drawingObject]);
|
|
1117
|
+
redos.push({
|
|
1118
|
+
id: SetDrawingApplyMutation.id,
|
|
1119
|
+
params: {
|
|
1120
|
+
unitId,
|
|
1121
|
+
subUnitId,
|
|
1122
|
+
type: DrawingApplyType.UPDATE,
|
|
1123
|
+
op: redo,
|
|
1124
|
+
objects
|
|
1125
|
+
}
|
|
1126
|
+
}), undos.push({
|
|
1127
|
+
id: SetDrawingApplyMutation.id,
|
|
1128
|
+
params: {
|
|
1129
|
+
unitId,
|
|
1130
|
+
subUnitId,
|
|
1131
|
+
type: DrawingApplyType.UPDATE,
|
|
1132
|
+
op: undo,
|
|
1133
|
+
objects
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
} else {
|
|
1137
|
+
const { undo, redo, objects } = _sheetDrawingService.getBatchAddOp([drawingObject]);
|
|
1138
|
+
redos.push({ id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.INSERT } }), undos.push({ id: SetDrawingApplyMutation.id, params: { op: undo, unitId, subUnitId, objects, type: DrawingApplyType.REMOVE } });
|
|
1139
|
+
}
|
|
1140
|
+
}), {
|
|
1141
|
+
redos,
|
|
1142
|
+
undos
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
}, __name(_a5, "SheetsDrawingCopyPasteController"), _a5);
|
|
1146
|
+
SheetsDrawingCopyPasteController = __decorateClass$5([
|
|
1147
|
+
__decorateParam$5(0, ISheetClipboardService),
|
|
1148
|
+
__decorateParam$5(1, IRenderManagerService),
|
|
1149
|
+
__decorateParam$5(2, ISheetDrawingService)
|
|
1150
|
+
], SheetsDrawingCopyPasteController);
|
|
1151
|
+
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1152
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1153
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1154
|
+
return kind && result && __defProp$4(target, key, result), result;
|
|
1155
|
+
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a6;
|
|
1156
|
+
let SheetDrawingPermissionController = (_a6 = class extends Disposable {
|
|
1157
|
+
constructor(_drawingManagerService, _renderManagerService, _permissionService, _univerInstanceService, _userManagerService) {
|
|
1158
|
+
super(), this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._univerInstanceService = _univerInstanceService, this._userManagerService = _userManagerService, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
1159
|
+
}
|
|
1160
|
+
_initDrawingVisible() {
|
|
1161
|
+
const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
1162
|
+
this.disposeWithMe(
|
|
1163
|
+
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
1164
|
+
if (!workbook) {
|
|
1165
|
+
this._drawingManagerService.setDrawingVisible(!1);
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
workbook.activeSheet$.subscribe((sheet) => {
|
|
1169
|
+
if (!sheet) {
|
|
1170
|
+
this._drawingManagerService.setDrawingVisible(!1);
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
1174
|
+
if (this._permissionService.composePermission([new WorkbookViewPermission(unitId).id, new WorksheetViewPermission(unitId, subUnitId).id]).every((permission) => permission.value))
|
|
1175
|
+
this._drawingManagerService.setDrawingVisible(!0);
|
|
1176
|
+
else {
|
|
1177
|
+
this._drawingManagerService.setDrawingVisible(!1);
|
|
1178
|
+
const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject = this._renderManagerService.getRenderById(unitId2), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
1179
|
+
if (scene == null)
|
|
1180
|
+
return;
|
|
1181
|
+
scene.getAllObjectsByOrder().forEach((object) => {
|
|
1182
|
+
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
})
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
_initDrawingEditable() {
|
|
1190
|
+
const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
1191
|
+
this.disposeWithMe(
|
|
1192
|
+
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
1193
|
+
if (!workbook) {
|
|
1194
|
+
this._drawingManagerService.setDrawingEditable(!1);
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
workbook.activeSheet$.subscribe((sheet) => {
|
|
1198
|
+
if (!sheet) {
|
|
1199
|
+
this._drawingManagerService.setDrawingEditable(!1);
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
1203
|
+
if (this._permissionService.composePermission([new WorkbookEditablePermission(unitId).id, new WorksheetEditPermission(unitId, subUnitId).id]).every((permission) => permission.value))
|
|
1204
|
+
this._drawingManagerService.setDrawingEditable(!0);
|
|
1205
|
+
else {
|
|
1206
|
+
this._drawingManagerService.setDrawingEditable(!1);
|
|
1207
|
+
const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject = this._renderManagerService.getRenderById(unitId2), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
1208
|
+
if (scene == null)
|
|
1209
|
+
return;
|
|
1210
|
+
scene.getAllObjectsByOrder().forEach((object) => {
|
|
1211
|
+
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.detachTransformerFrom(object);
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
});
|
|
1215
|
+
})
|
|
1216
|
+
);
|
|
1217
|
+
}
|
|
1218
|
+
_initViewPermissionChange() {
|
|
1219
|
+
const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
1220
|
+
this.disposeWithMe(
|
|
1221
|
+
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
1222
|
+
workbook && workbook.activeSheet$.subscribe((sheet) => {
|
|
1223
|
+
var _a11;
|
|
1224
|
+
if (!sheet)
|
|
1225
|
+
return;
|
|
1226
|
+
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
1227
|
+
let initialViewPermission = !0;
|
|
1228
|
+
const renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
1229
|
+
if (scene == null)
|
|
1230
|
+
return;
|
|
1231
|
+
const transformer = scene.getTransformerByCreate(), worksheetViewPermission$ = this._permissionService.composePermission$([new WorkbookViewPermission(unitId).id, new WorksheetViewPermission(unitId, subUnitId).id]).pipe(map((permissions) => permissions.every((item) => item.value)));
|
|
1232
|
+
worksheetViewPermission$ == null || worksheetViewPermission$.pipe(
|
|
1233
|
+
filter((permission) => permission !== initialViewPermission),
|
|
1234
|
+
distinctUntilChanged()
|
|
1235
|
+
).subscribe({
|
|
1236
|
+
next: /* @__PURE__ */ __name((permission) => {
|
|
1237
|
+
initialViewPermission = permission, this._drawingManagerService.setDrawingVisible(permission);
|
|
1238
|
+
const objects = scene.getAllObjectsByOrder(), drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
|
|
1239
|
+
permission ? this._drawingManagerService.addNotification(drawingDataValues) : (objects.forEach((object) => {
|
|
1240
|
+
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
|
|
1241
|
+
}), transformer.clearSelectedObjects());
|
|
1242
|
+
}, "next")
|
|
1243
|
+
}), (_a11 = this._permissionService.getPermissionPoint$(new WorksheetViewPermission(unitId, subUnitId).id)) == null || _a11.pipe(
|
|
1244
|
+
filter((permission) => permission.value !== initialViewPermission),
|
|
1245
|
+
distinctUntilChanged()
|
|
1246
|
+
).subscribe({
|
|
1247
|
+
complete: /* @__PURE__ */ __name(() => {
|
|
1248
|
+
initialViewPermission = !0, this._drawingManagerService.setDrawingVisible(!0);
|
|
1249
|
+
const drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
|
|
1250
|
+
this._drawingManagerService.addNotification(drawingDataValues);
|
|
1251
|
+
}, "complete")
|
|
1252
|
+
});
|
|
1253
|
+
});
|
|
1254
|
+
})
|
|
1255
|
+
);
|
|
1256
|
+
}
|
|
1257
|
+
_initEditPermissionChange() {
|
|
1258
|
+
const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
1259
|
+
this.disposeWithMe(
|
|
1260
|
+
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
1261
|
+
workbook && workbook.activeSheet$.subscribe((sheet) => {
|
|
1262
|
+
var _a11;
|
|
1263
|
+
if (!sheet)
|
|
1264
|
+
return;
|
|
1265
|
+
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
1266
|
+
let initialEditPermission = !0;
|
|
1267
|
+
const renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
1268
|
+
if (scene == null)
|
|
1269
|
+
return;
|
|
1270
|
+
const transformer = scene.getTransformerByCreate(), composeWorksheetEditPermission = this._permissionService.composePermission$([new WorkbookEditablePermission(unitId).id, new WorksheetEditPermission(unitId, subUnitId).id]).pipe(map((permissions) => permissions.every((item) => item.value)));
|
|
1271
|
+
composeWorksheetEditPermission == null || composeWorksheetEditPermission.pipe(
|
|
1272
|
+
filter((permission) => permission !== initialEditPermission),
|
|
1273
|
+
distinctUntilChanged()
|
|
1274
|
+
).subscribe({
|
|
1275
|
+
next: /* @__PURE__ */ __name((permission) => {
|
|
1276
|
+
initialEditPermission = permission, this._drawingManagerService.setDrawingEditable(permission);
|
|
1277
|
+
const objects = scene.getAllObjectsByOrder(), drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
|
|
1278
|
+
permission ? (objects.forEach((object) => {
|
|
1279
|
+
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.attachTransformerTo(object);
|
|
1280
|
+
}), this._drawingManagerService.addNotification(drawingDataValues)) : (objects.forEach((object) => {
|
|
1281
|
+
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.detachTransformerFrom(object);
|
|
1282
|
+
}), transformer.clearSelectedObjects());
|
|
1283
|
+
}, "next")
|
|
1284
|
+
}), (_a11 = this._permissionService.getPermissionPoint$(new WorksheetEditPermission(unitId, subUnitId).id)) == null || _a11.pipe(
|
|
1285
|
+
filter((permission) => permission.value !== initialEditPermission),
|
|
1286
|
+
distinctUntilChanged()
|
|
1287
|
+
).subscribe({
|
|
1288
|
+
complete: /* @__PURE__ */ __name(() => {
|
|
1289
|
+
initialEditPermission = !0;
|
|
1290
|
+
const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject2 = this._renderManagerService.getRenderById(unitId2), scene2 = renderObject2 == null ? void 0 : renderObject2.scene;
|
|
1291
|
+
if (scene2 == null)
|
|
1292
|
+
return;
|
|
1293
|
+
this._drawingManagerService.setDrawingEditable(!0), scene2.getAllObjectsByOrder().forEach((object) => {
|
|
1294
|
+
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene2.detachTransformerFrom(object);
|
|
1295
|
+
});
|
|
1296
|
+
}, "complete")
|
|
1297
|
+
});
|
|
1298
|
+
});
|
|
1299
|
+
})
|
|
1300
|
+
);
|
|
1301
|
+
}
|
|
1302
|
+
}, __name(_a6, "SheetDrawingPermissionController"), _a6);
|
|
1303
|
+
SheetDrawingPermissionController = __decorateClass$4([
|
|
1304
|
+
__decorateParam$4(0, IDrawingManagerService),
|
|
1305
|
+
__decorateParam$4(1, IRenderManagerService),
|
|
1306
|
+
__decorateParam$4(2, IPermissionService),
|
|
1307
|
+
__decorateParam$4(3, IUniverInstanceService),
|
|
1308
|
+
__decorateParam$4(4, Inject(UserManagerService))
|
|
1309
|
+
], SheetDrawingPermissionController);
|
|
1310
|
+
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1311
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1312
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1313
|
+
return kind && result && __defProp$3(target, key, result), result;
|
|
1314
|
+
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a7;
|
|
1315
|
+
let SheetDrawingPrintingController = (_a7 = class extends Disposable {
|
|
1316
|
+
constructor(_sheetPrintInterceptorService, _drawingRenderService, _drawingManagerService, _renderManagerService) {
|
|
1317
|
+
super(), this._sheetPrintInterceptorService = _sheetPrintInterceptorService, this._drawingRenderService = _drawingRenderService, this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._initPrinting();
|
|
1318
|
+
}
|
|
1319
|
+
_initPrinting() {
|
|
1320
|
+
this.disposeWithMe(
|
|
1321
|
+
this._sheetPrintInterceptorService.interceptor.intercept(
|
|
1322
|
+
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
|
|
1323
|
+
{
|
|
1324
|
+
handler: /* @__PURE__ */ __name((_param, pos, next) => {
|
|
1325
|
+
const { unitId, scene, subUnitId } = pos, unitData = this._drawingManagerService.getDrawingDataForUnit(unitId), subUnitData = unitData == null ? void 0 : unitData[subUnitId];
|
|
1326
|
+
return subUnitData && subUnitData.order.forEach((id) => {
|
|
1327
|
+
this._drawingRenderService.renderDrawing(subUnitData.data[id], scene);
|
|
1328
|
+
}), next();
|
|
1329
|
+
}, "handler")
|
|
1330
|
+
}
|
|
1331
|
+
)
|
|
1332
|
+
), this.disposeWithMe(
|
|
1333
|
+
this._sheetPrintInterceptorService.interceptor.intercept(
|
|
1334
|
+
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,
|
|
1335
|
+
{
|
|
1336
|
+
handler: /* @__PURE__ */ __name((range, pos, next) => {
|
|
1337
|
+
const { unitId, subUnitId } = pos, renderer = this._renderManagerService.getRenderById(unitId);
|
|
1338
|
+
if (!renderer)
|
|
1339
|
+
return next(range);
|
|
1340
|
+
const skeleton = renderer.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
|
|
1341
|
+
if (!skeleton)
|
|
1342
|
+
return next(range);
|
|
1343
|
+
const unitData = this._drawingManagerService.getDrawingDataForUnit(unitId), subUnitData = unitData == null ? void 0 : unitData[pos.subUnitId];
|
|
1344
|
+
if (!subUnitData)
|
|
1345
|
+
return next(range);
|
|
1346
|
+
const { scaleX, scaleY } = renderer.scene, newRange = range ? { ...range } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, data = subUnitData.order.map((key) => subUnitData.data[key]).filter((item) => item.drawingType !== DrawingTypeEnum.DRAWING_DOM);
|
|
1347
|
+
return data.length ? (data.forEach((param) => {
|
|
1348
|
+
if (!param.groupId && param.transform && Tools.isDefine(param.transform.left) && Tools.isDefine(param.transform.top) && Tools.isDefine(param.transform.width) && Tools.isDefine(param.transform.height)) {
|
|
1349
|
+
const start = skeleton.skeleton.getCellPositionByOffset(param.transform.left, param.transform.top, scaleX, scaleY, { x: 0, y: 0 }), end = skeleton.skeleton.getCellPositionByOffset(param.transform.left + param.transform.width, param.transform.top + param.transform.height, scaleX, scaleY, { x: 0, y: 0 });
|
|
1350
|
+
start.column < newRange.startColumn && (newRange.startColumn = start.column), start.row < newRange.startRow && (newRange.startRow = start.row), newRange.endRow < end.row && (newRange.endRow = end.row), newRange.endColumn < end.column && (newRange.endColumn = end.column);
|
|
1351
|
+
}
|
|
1352
|
+
}), next(newRange)) : next(range);
|
|
1353
|
+
}, "handler")
|
|
1354
|
+
}
|
|
1355
|
+
)
|
|
1356
|
+
);
|
|
1357
|
+
}
|
|
1358
|
+
}, __name(_a7, "SheetDrawingPrintingController"), _a7);
|
|
1359
|
+
SheetDrawingPrintingController = __decorateClass$3([
|
|
1360
|
+
__decorateParam$3(0, Inject(SheetPrintInterceptorService)),
|
|
1361
|
+
__decorateParam$3(1, Inject(DrawingRenderService)),
|
|
1362
|
+
__decorateParam$3(2, IDrawingManagerService),
|
|
1363
|
+
__decorateParam$3(3, IRenderManagerService)
|
|
1364
|
+
], SheetDrawingPrintingController);
|
|
1365
|
+
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1366
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1367
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1368
|
+
return kind && result && __defProp$2(target, key, result), result;
|
|
1369
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2");
|
|
1370
|
+
const UPDATE_COMMANDS = [
|
|
1371
|
+
InsertRowCommand.id,
|
|
978
1372
|
InsertColCommand.id,
|
|
979
1373
|
RemoveRowCommand.id,
|
|
980
1374
|
RemoveColCommand.id,
|
|
@@ -1001,8 +1395,8 @@ const UPDATE_COMMANDS = [
|
|
|
1001
1395
|
SetWorksheetRowHeightMutation.id,
|
|
1002
1396
|
SetWorksheetColWidthMutation.id
|
|
1003
1397
|
];
|
|
1004
|
-
var
|
|
1005
|
-
let SheetDrawingTransformAffectedController = (
|
|
1398
|
+
var _a8;
|
|
1399
|
+
let SheetDrawingTransformAffectedController = (_a8 = class extends Disposable {
|
|
1006
1400
|
constructor(_context, _renderManagerService, _commandService, _selectionRenderService, _skeletonManagerService, _sheetInterceptorService, _sheetDrawingService, _drawingManagerService, _univerInstanceService) {
|
|
1007
1401
|
super(), this._context = _context, this._renderManagerService = _renderManagerService, this._commandService = _commandService, this._selectionRenderService = _selectionRenderService, this._skeletonManagerService = _skeletonManagerService, this._sheetInterceptorService = _sheetInterceptorService, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._univerInstanceService = _univerInstanceService, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
|
|
1008
1402
|
}
|
|
@@ -1717,22 +2111,22 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
|
1717
2111
|
}
|
|
1718
2112
|
}), updateDrawings.length !== 0 && (this._drawingManagerService.refreshTransform(updateDrawings), this._commandService.syncExecuteCommand(ClearSheetDrawingTransformerOperation.id, [unitId]));
|
|
1719
2113
|
}
|
|
1720
|
-
}, __name(
|
|
1721
|
-
SheetDrawingTransformAffectedController = __decorateClass$
|
|
1722
|
-
__decorateParam$
|
|
1723
|
-
__decorateParam$
|
|
1724
|
-
__decorateParam$
|
|
1725
|
-
__decorateParam$
|
|
1726
|
-
__decorateParam$
|
|
1727
|
-
__decorateParam$
|
|
1728
|
-
__decorateParam$
|
|
1729
|
-
__decorateParam$
|
|
2114
|
+
}, __name(_a8, "SheetDrawingTransformAffectedController"), _a8);
|
|
2115
|
+
SheetDrawingTransformAffectedController = __decorateClass$2([
|
|
2116
|
+
__decorateParam$2(1, IRenderManagerService),
|
|
2117
|
+
__decorateParam$2(2, ICommandService),
|
|
2118
|
+
__decorateParam$2(3, ISheetSelectionRenderService),
|
|
2119
|
+
__decorateParam$2(4, Inject(SheetSkeletonManagerService)),
|
|
2120
|
+
__decorateParam$2(5, Inject(SheetInterceptorService)),
|
|
2121
|
+
__decorateParam$2(6, ISheetDrawingService),
|
|
2122
|
+
__decorateParam$2(7, IDrawingManagerService),
|
|
2123
|
+
__decorateParam$2(8, IUniverInstanceService)
|
|
1730
2124
|
], SheetDrawingTransformAffectedController);
|
|
1731
|
-
var __defProp$
|
|
1732
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
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--)
|
|
1733
2127
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1734
|
-
return kind && result && __defProp$
|
|
1735
|
-
}, "__decorateClass$
|
|
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");
|
|
1736
2130
|
function transformBound2DOMBound(originBound, scene, skeleton, worksheet) {
|
|
1737
2131
|
const { scaleX, scaleY } = scene.getAncestorScale(), viewMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN), absolute = {
|
|
1738
2132
|
left: !0,
|
|
@@ -1786,8 +2180,8 @@ const calcPosition = /* @__PURE__ */ __name((targetObject, currentRender, skelet
|
|
|
1786
2180
|
absolute: offsetBound.absolute
|
|
1787
2181
|
};
|
|
1788
2182
|
}, "calcPosition");
|
|
1789
|
-
var
|
|
1790
|
-
let SheetCanvasFloatDomManagerService = (
|
|
2183
|
+
var _a9;
|
|
2184
|
+
let SheetCanvasFloatDomManagerService = (_a9 = class extends Disposable {
|
|
1791
2185
|
constructor(_renderManagerService, _univerInstanceService, _commandService, _drawingManagerService, _canvasFloatDomService, _sheetDrawingService) {
|
|
1792
2186
|
super();
|
|
1793
2187
|
__publicField(this, "_domLayerMap", /* @__PURE__ */ new Map());
|
|
@@ -1953,488 +2347,99 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1953
2347
|
};
|
|
1954
2348
|
}
|
|
1955
2349
|
_featureUpdateListener() {
|
|
1956
|
-
this.disposeWithMe(
|
|
1957
|
-
this._drawingManagerService.update$.subscribe((params) => {
|
|
1958
|
-
params.forEach((data) => {
|
|
1959
|
-
const sheetDrawing = this._drawingManagerService.getDrawingByParam(data);
|
|
1960
|
-
if (!sheetDrawing || sheetDrawing.drawingType !== DrawingTypeEnum$1.DRAWING_DOM)
|
|
1961
|
-
return;
|
|
1962
|
-
const newValue = {
|
|
1963
|
-
...sheetDrawing.transform
|
|
1964
|
-
};
|
|
1965
|
-
this._transformChange$.next({ id: data.drawingId, value: newValue });
|
|
1966
|
-
});
|
|
1967
|
-
})
|
|
1968
|
-
);
|
|
1969
|
-
}
|
|
1970
|
-
_deleteListener() {
|
|
1971
|
-
this.disposeWithMe(
|
|
1972
|
-
this._drawingManagerService.remove$.subscribe((params) => {
|
|
1973
|
-
params.forEach((param) => {
|
|
1974
|
-
this._removeDom(param.drawingId);
|
|
1975
|
-
});
|
|
1976
|
-
})
|
|
1977
|
-
);
|
|
1978
|
-
}
|
|
1979
|
-
addFloatDomToPosition(layer, propId) {
|
|
1980
|
-
const target = getSheetCommandTarget(this._univerInstanceService, {
|
|
1981
|
-
unitId: layer.unitId,
|
|
1982
|
-
subUnitId: layer.subUnitId
|
|
1983
|
-
});
|
|
1984
|
-
if (!target)
|
|
1985
|
-
throw new Error("cannot find current target!");
|
|
1986
|
-
const { unitId, subUnitId } = target, { initPosition, componentKey, data, allowTransform = !0 } = layer, id = propId != null ? propId : generateRandomId(), sheetTransform = this._getPosition(initPosition, unitId);
|
|
1987
|
-
if (sheetTransform == null)
|
|
1988
|
-
return;
|
|
1989
|
-
this._ensureMap(unitId, subUnitId).set(id, layer);
|
|
1990
|
-
const sheetDrawingParam = {
|
|
1991
|
-
unitId,
|
|
1992
|
-
subUnitId,
|
|
1993
|
-
drawingId: id,
|
|
1994
|
-
drawingType: DrawingTypeEnum$1.DRAWING_DOM,
|
|
1995
|
-
componentKey,
|
|
1996
|
-
sheetTransform,
|
|
1997
|
-
transform: {
|
|
1998
|
-
left: initPosition.startX,
|
|
1999
|
-
top: initPosition.startY,
|
|
2000
|
-
width: initPosition.endX - initPosition.startX,
|
|
2001
|
-
height: initPosition.endY - initPosition.startY
|
|
2002
|
-
},
|
|
2003
|
-
data,
|
|
2004
|
-
allowTransform
|
|
2005
|
-
};
|
|
2006
|
-
return this._commandService.executeCommand(InsertSheetDrawingCommand.id, {
|
|
2007
|
-
unitId,
|
|
2008
|
-
drawings: [sheetDrawingParam]
|
|
2009
|
-
}), {
|
|
2010
|
-
id,
|
|
2011
|
-
dispose: /* @__PURE__ */ __name(() => {
|
|
2012
|
-
this._removeDom(id, !0);
|
|
2013
|
-
}, "dispose")
|
|
2014
|
-
};
|
|
2015
|
-
}
|
|
2016
|
-
_removeDom(id, removeDrawing = !1) {
|
|
2017
|
-
const info = this._domLayerInfoMap.get(id);
|
|
2018
|
-
if (!info)
|
|
2019
|
-
return;
|
|
2020
|
-
const { unitId, subUnitId } = info;
|
|
2021
|
-
this._domLayerInfoMap.delete(id), info.dispose.dispose();
|
|
2022
|
-
const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
|
|
2023
|
-
if (renderObject && renderObject.scene.removeObject(info.rect), removeDrawing) {
|
|
2024
|
-
this._ensureMap(unitId, subUnitId).delete(id);
|
|
2025
|
-
const param = this._drawingManagerService.getDrawingByParam({ unitId, subUnitId, drawingId: id });
|
|
2026
|
-
if (!param)
|
|
2027
|
-
return;
|
|
2028
|
-
const jsonOp = this._sheetDrawingService.getBatchRemoveOp([param]), { redo, objects } = jsonOp;
|
|
2029
|
-
this._commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.REMOVE });
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
addHook(hook) {
|
|
2033
|
-
return this._hooks.push(hook), {
|
|
2034
|
-
dispose: /* @__PURE__ */ __name(() => {
|
|
2035
|
-
const index = this._hooks.findIndex((h) => h === hook);
|
|
2036
|
-
this._hooks.splice(index, 1);
|
|
2037
|
-
}, "dispose")
|
|
2038
|
-
};
|
|
2039
|
-
}
|
|
2040
|
-
}, __name(_a5, "SheetCanvasFloatDomManagerService"), _a5);
|
|
2041
|
-
SheetCanvasFloatDomManagerService = __decorateClass$5([
|
|
2042
|
-
OnLifecycle(LifecycleStages.Starting, SheetCanvasFloatDomManagerService),
|
|
2043
|
-
__decorateParam$5(0, Inject(IRenderManagerService)),
|
|
2044
|
-
__decorateParam$5(1, IUniverInstanceService),
|
|
2045
|
-
__decorateParam$5(2, Inject(ICommandService)),
|
|
2046
|
-
__decorateParam$5(3, IDrawingManagerService),
|
|
2047
|
-
__decorateParam$5(4, Inject(CanvasFloatDomService)),
|
|
2048
|
-
__decorateParam$5(5, ISheetDrawingService)
|
|
2049
|
-
], SheetCanvasFloatDomManagerService);
|
|
2050
|
-
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2051
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2052
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2053
|
-
return kind && result && __defProp$4(target, key, result), result;
|
|
2054
|
-
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a6;
|
|
2055
|
-
let SheetDrawingPrintingController = (_a6 = class extends Disposable {
|
|
2056
|
-
constructor(_sheetPrintInterceptorService, _drawingRenderService, _drawingManagerService, _renderManagerService) {
|
|
2057
|
-
super(), this._sheetPrintInterceptorService = _sheetPrintInterceptorService, this._drawingRenderService = _drawingRenderService, this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._initPrinting();
|
|
2058
|
-
}
|
|
2059
|
-
_initPrinting() {
|
|
2060
|
-
this.disposeWithMe(
|
|
2061
|
-
this._sheetPrintInterceptorService.interceptor.intercept(
|
|
2062
|
-
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
|
|
2063
|
-
{
|
|
2064
|
-
handler: /* @__PURE__ */ __name((_param, pos, next) => {
|
|
2065
|
-
const { unitId, scene, subUnitId } = pos, unitData = this._drawingManagerService.getDrawingDataForUnit(unitId), subUnitData = unitData == null ? void 0 : unitData[subUnitId];
|
|
2066
|
-
return subUnitData && subUnitData.order.forEach((id) => {
|
|
2067
|
-
this._drawingRenderService.renderDrawing(subUnitData.data[id], scene);
|
|
2068
|
-
}), next();
|
|
2069
|
-
}, "handler")
|
|
2070
|
-
}
|
|
2071
|
-
)
|
|
2072
|
-
), this.disposeWithMe(
|
|
2073
|
-
this._sheetPrintInterceptorService.interceptor.intercept(
|
|
2074
|
-
this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,
|
|
2075
|
-
{
|
|
2076
|
-
handler: /* @__PURE__ */ __name((range, pos, next) => {
|
|
2077
|
-
const { unitId, subUnitId } = pos, renderer = this._renderManagerService.getRenderById(unitId);
|
|
2078
|
-
if (!renderer)
|
|
2079
|
-
return next(range);
|
|
2080
|
-
const skeleton = renderer.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
|
|
2081
|
-
if (!skeleton)
|
|
2082
|
-
return next(range);
|
|
2083
|
-
const unitData = this._drawingManagerService.getDrawingDataForUnit(unitId), subUnitData = unitData == null ? void 0 : unitData[pos.subUnitId];
|
|
2084
|
-
if (!subUnitData)
|
|
2085
|
-
return next(range);
|
|
2086
|
-
const { scaleX, scaleY } = renderer.scene, newRange = range ? { ...range } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, data = subUnitData.order.map((key) => subUnitData.data[key]).filter((item) => item.drawingType !== DrawingTypeEnum.DRAWING_DOM);
|
|
2087
|
-
return data.length ? (data.forEach((param) => {
|
|
2088
|
-
if (!param.groupId && param.transform && Tools.isDefine(param.transform.left) && Tools.isDefine(param.transform.top) && Tools.isDefine(param.transform.width) && Tools.isDefine(param.transform.height)) {
|
|
2089
|
-
const start = skeleton.skeleton.getCellPositionByOffset(param.transform.left, param.transform.top, scaleX, scaleY, { x: 0, y: 0 }), end = skeleton.skeleton.getCellPositionByOffset(param.transform.left + param.transform.width, param.transform.top + param.transform.height, scaleX, scaleY, { x: 0, y: 0 });
|
|
2090
|
-
start.column < newRange.startColumn && (newRange.startColumn = start.column), start.row < newRange.startRow && (newRange.startRow = start.row), newRange.endRow < end.row && (newRange.endRow = end.row), newRange.endColumn < end.column && (newRange.endColumn = end.column);
|
|
2091
|
-
}
|
|
2092
|
-
}), next(newRange)) : next(range);
|
|
2093
|
-
}, "handler")
|
|
2094
|
-
}
|
|
2095
|
-
)
|
|
2096
|
-
);
|
|
2097
|
-
}
|
|
2098
|
-
}, __name(_a6, "SheetDrawingPrintingController"), _a6);
|
|
2099
|
-
SheetDrawingPrintingController = __decorateClass$4([
|
|
2100
|
-
OnLifecycle(LifecycleStages.Rendered, SheetDrawingPrintingController),
|
|
2101
|
-
__decorateParam$4(0, Inject(SheetPrintInterceptorService)),
|
|
2102
|
-
__decorateParam$4(1, Inject(DrawingRenderService)),
|
|
2103
|
-
__decorateParam$4(2, IDrawingManagerService),
|
|
2104
|
-
__decorateParam$4(3, IRenderManagerService)
|
|
2105
|
-
], SheetDrawingPrintingController);
|
|
2106
|
-
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2107
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2108
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2109
|
-
return kind && result && __defProp$3(target, key, result), result;
|
|
2110
|
-
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a7;
|
|
2111
|
-
let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
2112
|
-
constructor(_drawingManagerService, _renderManagerService, _permissionService, _univerInstanceService, _userManagerService) {
|
|
2113
|
-
super(), this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._univerInstanceService = _univerInstanceService, this._userManagerService = _userManagerService, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
|
|
2114
|
-
}
|
|
2115
|
-
_initDrawingVisible() {
|
|
2116
|
-
const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
2117
|
-
this.disposeWithMe(
|
|
2118
|
-
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
2119
|
-
if (!workbook) {
|
|
2120
|
-
this._drawingManagerService.setDrawingVisible(!1);
|
|
2121
|
-
return;
|
|
2122
|
-
}
|
|
2123
|
-
workbook.activeSheet$.subscribe((sheet) => {
|
|
2124
|
-
if (!sheet) {
|
|
2125
|
-
this._drawingManagerService.setDrawingVisible(!1);
|
|
2126
|
-
return;
|
|
2127
|
-
}
|
|
2128
|
-
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
2129
|
-
if (this._permissionService.composePermission([new WorkbookViewPermission(unitId).id, new WorksheetViewPermission(unitId, subUnitId).id]).every((permission) => permission.value))
|
|
2130
|
-
this._drawingManagerService.setDrawingVisible(!0);
|
|
2131
|
-
else {
|
|
2132
|
-
this._drawingManagerService.setDrawingVisible(!1);
|
|
2133
|
-
const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject = this._renderManagerService.getRenderById(unitId2), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
2134
|
-
if (scene == null)
|
|
2135
|
-
return;
|
|
2136
|
-
scene.getAllObjectsByOrder().forEach((object) => {
|
|
2137
|
-
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
|
|
2138
|
-
});
|
|
2139
|
-
}
|
|
2140
|
-
});
|
|
2141
|
-
})
|
|
2142
|
-
);
|
|
2143
|
-
}
|
|
2144
|
-
_initDrawingEditable() {
|
|
2145
|
-
const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
2146
|
-
this.disposeWithMe(
|
|
2147
|
-
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
2148
|
-
if (!workbook) {
|
|
2149
|
-
this._drawingManagerService.setDrawingEditable(!1);
|
|
2150
|
-
return;
|
|
2151
|
-
}
|
|
2152
|
-
workbook.activeSheet$.subscribe((sheet) => {
|
|
2153
|
-
if (!sheet) {
|
|
2154
|
-
this._drawingManagerService.setDrawingEditable(!1);
|
|
2155
|
-
return;
|
|
2156
|
-
}
|
|
2157
|
-
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
2158
|
-
if (this._permissionService.composePermission([new WorkbookEditablePermission(unitId).id, new WorksheetEditPermission(unitId, subUnitId).id]).every((permission) => permission.value))
|
|
2159
|
-
this._drawingManagerService.setDrawingEditable(!0);
|
|
2160
|
-
else {
|
|
2161
|
-
this._drawingManagerService.setDrawingEditable(!1);
|
|
2162
|
-
const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject = this._renderManagerService.getRenderById(unitId2), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
2163
|
-
if (scene == null)
|
|
2164
|
-
return;
|
|
2165
|
-
scene.getAllObjectsByOrder().forEach((object) => {
|
|
2166
|
-
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.detachTransformerFrom(object);
|
|
2167
|
-
});
|
|
2168
|
-
}
|
|
2169
|
-
});
|
|
2170
|
-
})
|
|
2171
|
-
);
|
|
2172
|
-
}
|
|
2173
|
-
_initViewPermissionChange() {
|
|
2174
|
-
const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
2175
|
-
this.disposeWithMe(
|
|
2176
|
-
combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
|
|
2177
|
-
workbook && workbook.activeSheet$.subscribe((sheet) => {
|
|
2178
|
-
var _a11;
|
|
2179
|
-
if (!sheet)
|
|
2180
|
-
return;
|
|
2181
|
-
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
2182
|
-
let initialViewPermission = !0;
|
|
2183
|
-
const renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
2184
|
-
if (scene == null)
|
|
2185
|
-
return;
|
|
2186
|
-
const transformer = scene.getTransformerByCreate(), worksheetViewPermission$ = this._permissionService.composePermission$([new WorkbookViewPermission(unitId).id, new WorksheetViewPermission(unitId, subUnitId).id]).pipe(map((permissions) => permissions.every((item) => item.value)));
|
|
2187
|
-
worksheetViewPermission$ == null || worksheetViewPermission$.pipe(
|
|
2188
|
-
filter((permission) => permission !== initialViewPermission),
|
|
2189
|
-
distinctUntilChanged()
|
|
2190
|
-
).subscribe({
|
|
2191
|
-
next: /* @__PURE__ */ __name((permission) => {
|
|
2192
|
-
initialViewPermission = permission, this._drawingManagerService.setDrawingVisible(permission);
|
|
2193
|
-
const objects = scene.getAllObjectsByOrder(), drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
|
|
2194
|
-
permission ? this._drawingManagerService.addNotification(drawingDataValues) : (objects.forEach((object) => {
|
|
2195
|
-
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
|
|
2196
|
-
}), transformer.clearSelectedObjects());
|
|
2197
|
-
}, "next")
|
|
2198
|
-
}), (_a11 = this._permissionService.getPermissionPoint$(new WorksheetViewPermission(unitId, subUnitId).id)) == null || _a11.pipe(
|
|
2199
|
-
filter((permission) => permission.value !== initialViewPermission),
|
|
2200
|
-
distinctUntilChanged()
|
|
2201
|
-
).subscribe({
|
|
2202
|
-
complete: /* @__PURE__ */ __name(() => {
|
|
2203
|
-
initialViewPermission = !0, this._drawingManagerService.setDrawingVisible(!0);
|
|
2204
|
-
const drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
|
|
2205
|
-
this._drawingManagerService.addNotification(drawingDataValues);
|
|
2206
|
-
}, "complete")
|
|
2207
|
-
});
|
|
2350
|
+
this.disposeWithMe(
|
|
2351
|
+
this._drawingManagerService.update$.subscribe((params) => {
|
|
2352
|
+
params.forEach((data) => {
|
|
2353
|
+
const sheetDrawing = this._drawingManagerService.getDrawingByParam(data);
|
|
2354
|
+
if (!sheetDrawing || sheetDrawing.drawingType !== DrawingTypeEnum$1.DRAWING_DOM)
|
|
2355
|
+
return;
|
|
2356
|
+
const newValue = {
|
|
2357
|
+
...sheetDrawing.transform
|
|
2358
|
+
};
|
|
2359
|
+
this._transformChange$.next({ id: data.drawingId, value: newValue });
|
|
2208
2360
|
});
|
|
2209
2361
|
})
|
|
2210
2362
|
);
|
|
2211
2363
|
}
|
|
2212
|
-
|
|
2213
|
-
const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
2364
|
+
_deleteListener() {
|
|
2214
2365
|
this.disposeWithMe(
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
if (!sheet)
|
|
2219
|
-
return;
|
|
2220
|
-
const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
|
|
2221
|
-
let initialEditPermission = !0;
|
|
2222
|
-
const renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
2223
|
-
if (scene == null)
|
|
2224
|
-
return;
|
|
2225
|
-
const transformer = scene.getTransformerByCreate(), composeWorksheetEditPermission = this._permissionService.composePermission$([new WorkbookEditablePermission(unitId).id, new WorksheetEditPermission(unitId, subUnitId).id]).pipe(map((permissions) => permissions.every((item) => item.value)));
|
|
2226
|
-
composeWorksheetEditPermission == null || composeWorksheetEditPermission.pipe(
|
|
2227
|
-
filter((permission) => permission !== initialEditPermission),
|
|
2228
|
-
distinctUntilChanged()
|
|
2229
|
-
).subscribe({
|
|
2230
|
-
next: /* @__PURE__ */ __name((permission) => {
|
|
2231
|
-
initialEditPermission = permission, this._drawingManagerService.setDrawingEditable(permission);
|
|
2232
|
-
const objects = scene.getAllObjectsByOrder(), drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
|
|
2233
|
-
permission ? (objects.forEach((object) => {
|
|
2234
|
-
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.attachTransformerTo(object);
|
|
2235
|
-
}), this._drawingManagerService.addNotification(drawingDataValues)) : (objects.forEach((object) => {
|
|
2236
|
-
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.detachTransformerFrom(object);
|
|
2237
|
-
}), transformer.clearSelectedObjects());
|
|
2238
|
-
}, "next")
|
|
2239
|
-
}), (_a11 = this._permissionService.getPermissionPoint$(new WorksheetEditPermission(unitId, subUnitId).id)) == null || _a11.pipe(
|
|
2240
|
-
filter((permission) => permission.value !== initialEditPermission),
|
|
2241
|
-
distinctUntilChanged()
|
|
2242
|
-
).subscribe({
|
|
2243
|
-
complete: /* @__PURE__ */ __name(() => {
|
|
2244
|
-
initialEditPermission = !0;
|
|
2245
|
-
const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject2 = this._renderManagerService.getRenderById(unitId2), scene2 = renderObject2 == null ? void 0 : renderObject2.scene;
|
|
2246
|
-
if (scene2 == null)
|
|
2247
|
-
return;
|
|
2248
|
-
this._drawingManagerService.setDrawingEditable(!0), scene2.getAllObjectsByOrder().forEach((object) => {
|
|
2249
|
-
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene2.detachTransformerFrom(object);
|
|
2250
|
-
});
|
|
2251
|
-
}, "complete")
|
|
2252
|
-
});
|
|
2366
|
+
this._drawingManagerService.remove$.subscribe((params) => {
|
|
2367
|
+
params.forEach((param) => {
|
|
2368
|
+
this._removeDom(param.drawingId);
|
|
2253
2369
|
});
|
|
2254
2370
|
})
|
|
2255
2371
|
);
|
|
2256
2372
|
}
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
__decorateParam$3(1, IRenderManagerService),
|
|
2262
|
-
__decorateParam$3(2, IPermissionService),
|
|
2263
|
-
__decorateParam$3(3, IUniverInstanceService),
|
|
2264
|
-
__decorateParam$3(4, Inject(UserManagerService))
|
|
2265
|
-
], SheetDrawingPermissionController);
|
|
2266
|
-
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2267
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2268
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2269
|
-
return kind && result && __defProp$2(target, key, result), result;
|
|
2270
|
-
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a8;
|
|
2271
|
-
let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
|
|
2272
|
-
constructor(_sheetClipboardService, _renderManagerService, _sheetDrawingService) {
|
|
2273
|
-
super();
|
|
2274
|
-
__publicField(this, "_copyInfo");
|
|
2275
|
-
this._sheetClipboardService = _sheetClipboardService, this._renderManagerService = _renderManagerService, this._sheetDrawingService = _sheetDrawingService, this._initCopyPaste();
|
|
2276
|
-
}
|
|
2277
|
-
_initCopyPaste() {
|
|
2278
|
-
this._sheetClipboardService.addClipboardHook({
|
|
2279
|
-
id: "SHEET_IMAGE_UI_PLUGIN",
|
|
2280
|
-
onBeforeCopy: /* @__PURE__ */ __name((unitId, subUnitId, range) => this._collect(unitId, subUnitId, range), "onBeforeCopy"),
|
|
2281
|
-
onPasteCells: /* @__PURE__ */ __name((pasteFrom, pasteTo, data, payload) => {
|
|
2282
|
-
const { copyType = COPY_TYPE.COPY, pasteType } = payload, { range: copyRange } = pasteFrom || {}, { range: pastedRange, unitId, subUnitId } = pasteTo;
|
|
2283
|
-
return this._generateMutations(pastedRange, { copyType, pasteType, copyRange, unitId, subUnitId });
|
|
2284
|
-
}, "onPasteCells"),
|
|
2285
|
-
onPastePlainText: /* @__PURE__ */ __name((pasteTo, clipText) => ({ undos: [], redos: [] }), "onPastePlainText")
|
|
2373
|
+
addFloatDomToPosition(layer, propId) {
|
|
2374
|
+
const target = getSheetCommandTarget(this._univerInstanceService, {
|
|
2375
|
+
unitId: layer.unitId,
|
|
2376
|
+
subUnitId: layer.subUnitId
|
|
2286
2377
|
});
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
if (!skeletonManagerService) return;
|
|
2292
|
-
const selectionRect = skeletonManagerService.attachRangeWithCoord(range);
|
|
2293
|
-
if (!selectionRect)
|
|
2378
|
+
if (!target)
|
|
2379
|
+
throw new Error("cannot find current target!");
|
|
2380
|
+
const { unitId, subUnitId } = target, { initPosition, componentKey, data, allowTransform = !0 } = layer, id = propId != null ? propId : generateRandomId(), sheetTransform = this._getPosition(initPosition, unitId);
|
|
2381
|
+
if (sheetTransform == null)
|
|
2294
2382
|
return;
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
const drawing = drawings[drawingId], { transform } = drawing;
|
|
2298
|
-
if (drawing.anchorType !== SheetDrawingAnchorType.Both || !transform)
|
|
2299
|
-
return;
|
|
2300
|
-
const { left = 0, top = 0, width = 0, height = 0 } = transform, { drawingStartX, drawingEndX, drawingStartY, drawingEndY } = {
|
|
2301
|
-
drawingStartX: left,
|
|
2302
|
-
drawingEndX: left + width,
|
|
2303
|
-
drawingStartY: top,
|
|
2304
|
-
drawingEndY: top + height
|
|
2305
|
-
};
|
|
2306
|
-
startX <= drawingStartX && drawingEndX <= endX && startY <= drawingStartY && drawingEndY <= endY && containedDrawings.push(drawing);
|
|
2307
|
-
}), containedDrawings.length && (this._copyInfo = {
|
|
2308
|
-
drawings: containedDrawings,
|
|
2383
|
+
this._ensureMap(unitId, subUnitId).set(id, layer);
|
|
2384
|
+
const sheetDrawingParam = {
|
|
2309
2385
|
unitId,
|
|
2310
|
-
subUnitId
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
const { copyRange } = copyInfo;
|
|
2328
|
-
if (!copyRange)
|
|
2329
|
-
return { redos: [], undos: [] };
|
|
2330
|
-
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 = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService);
|
|
2331
|
-
if (!skeletonManagerService)
|
|
2332
|
-
return { redos: [], undos: [] };
|
|
2333
|
-
const copyRect = skeletonManagerService.attachRangeWithCoord({
|
|
2334
|
-
startRow: copyRow,
|
|
2335
|
-
endRow: copyRow,
|
|
2336
|
-
startColumn: copyCol,
|
|
2337
|
-
endColumn: copyCol
|
|
2338
|
-
}), pasteRect = skeletonManagerService.attachRangeWithCoord({
|
|
2339
|
-
startRow: pasteRow,
|
|
2340
|
-
endRow: pasteRow,
|
|
2341
|
-
startColumn: pasteCol,
|
|
2342
|
-
endColumn: pasteCol
|
|
2343
|
-
});
|
|
2344
|
-
if (!copyRect || !pasteRect)
|
|
2345
|
-
return { redos: [], undos: [] };
|
|
2346
|
-
const redos = [], undos = [], leftOffset = pasteRect.startX - copyRect.startX, topOffset = pasteRect.startY - copyRect.startY, rowOffset = pasteRow - copyRow, columnOffset = pasteCol - copyCol, isCut = copyInfo.copyType === COPY_TYPE.CUT, { _sheetDrawingService } = this;
|
|
2347
|
-
return drawings.forEach((drawing) => {
|
|
2348
|
-
const { transform, sheetTransform } = drawing;
|
|
2349
|
-
if (!transform)
|
|
2350
|
-
return;
|
|
2351
|
-
const drawingObject = {
|
|
2352
|
-
...drawing,
|
|
2353
|
-
unitId,
|
|
2354
|
-
subUnitId,
|
|
2355
|
-
drawingId: isCut ? drawing.drawingId : Tools.generateRandomId(),
|
|
2356
|
-
transform: {
|
|
2357
|
-
...transform,
|
|
2358
|
-
left: transform.left + leftOffset,
|
|
2359
|
-
top: transform.top + topOffset
|
|
2360
|
-
},
|
|
2361
|
-
sheetTransform: {
|
|
2362
|
-
to: { ...sheetTransform.to, row: sheetTransform.to.row + rowOffset, column: sheetTransform.to.column + columnOffset },
|
|
2363
|
-
from: { ...sheetTransform.from, row: sheetTransform.from.row + rowOffset, column: sheetTransform.from.column + columnOffset }
|
|
2364
|
-
}
|
|
2365
|
-
};
|
|
2366
|
-
if (isCut) {
|
|
2367
|
-
const { undo, redo, objects } = _sheetDrawingService.getBatchUpdateOp([drawingObject]);
|
|
2368
|
-
redos.push({
|
|
2369
|
-
id: SetDrawingApplyMutation.id,
|
|
2370
|
-
params: {
|
|
2371
|
-
unitId,
|
|
2372
|
-
subUnitId,
|
|
2373
|
-
type: DrawingApplyType.UPDATE,
|
|
2374
|
-
op: redo,
|
|
2375
|
-
objects
|
|
2376
|
-
}
|
|
2377
|
-
}), undos.push({
|
|
2378
|
-
id: SetDrawingApplyMutation.id,
|
|
2379
|
-
params: {
|
|
2380
|
-
unitId,
|
|
2381
|
-
subUnitId,
|
|
2382
|
-
type: DrawingApplyType.UPDATE,
|
|
2383
|
-
op: undo,
|
|
2384
|
-
objects
|
|
2385
|
-
}
|
|
2386
|
-
});
|
|
2387
|
-
} else {
|
|
2388
|
-
const { undo, redo, objects } = _sheetDrawingService.getBatchAddOp([drawingObject]);
|
|
2389
|
-
redos.push({ id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.INSERT } }), undos.push({ id: SetDrawingApplyMutation.id, params: { op: undo, unitId, subUnitId, objects, type: DrawingApplyType.REMOVE } });
|
|
2390
|
-
}
|
|
2386
|
+
subUnitId,
|
|
2387
|
+
drawingId: id,
|
|
2388
|
+
drawingType: DrawingTypeEnum$1.DRAWING_DOM,
|
|
2389
|
+
componentKey,
|
|
2390
|
+
sheetTransform,
|
|
2391
|
+
transform: {
|
|
2392
|
+
left: initPosition.startX,
|
|
2393
|
+
top: initPosition.startY,
|
|
2394
|
+
width: initPosition.endX - initPosition.startX,
|
|
2395
|
+
height: initPosition.endY - initPosition.startY
|
|
2396
|
+
},
|
|
2397
|
+
data,
|
|
2398
|
+
allowTransform
|
|
2399
|
+
};
|
|
2400
|
+
return this._commandService.executeCommand(InsertSheetDrawingCommand.id, {
|
|
2401
|
+
unitId,
|
|
2402
|
+
drawings: [sheetDrawingParam]
|
|
2391
2403
|
}), {
|
|
2392
|
-
|
|
2393
|
-
|
|
2404
|
+
id,
|
|
2405
|
+
dispose: /* @__PURE__ */ __name(() => {
|
|
2406
|
+
this._removeDom(id, !0);
|
|
2407
|
+
}, "dispose")
|
|
2394
2408
|
};
|
|
2395
2409
|
}
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
super(), this._context = _context, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._lifecycleService = _lifecycleService, this._sheetSelectionRenderService = _sheetSelectionRenderService, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._init();
|
|
2411
|
-
}
|
|
2412
|
-
_init() {
|
|
2413
|
-
this._drawingInitializeListener();
|
|
2414
|
-
}
|
|
2415
|
-
_drawingInitializeListener() {
|
|
2416
|
-
if (this._context.type === UniverInstanceType.UNIVER_SHEET) {
|
|
2417
|
-
this._sheetDrawingService.initializeNotification(this._context.unitId);
|
|
2418
|
-
const data = this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);
|
|
2419
|
-
for (const subUnit in data) {
|
|
2420
|
-
const subUnitData = data[subUnit];
|
|
2421
|
-
for (const drawingId in subUnitData.data) {
|
|
2422
|
-
const drawingData = subUnitData.data[drawingId];
|
|
2423
|
-
drawingData.transform = drawingPositionToTransform(drawingData.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
|
|
2410
|
+
_removeDom(id, removeDrawing = !1) {
|
|
2411
|
+
const info = this._domLayerInfoMap.get(id);
|
|
2412
|
+
if (!info)
|
|
2413
|
+
return;
|
|
2414
|
+
const { unitId, subUnitId } = info;
|
|
2415
|
+
this._domLayerInfoMap.delete(id), info.dispose.dispose();
|
|
2416
|
+
const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
|
|
2417
|
+
if (renderObject && renderObject.scene.removeObject(info.rect), removeDrawing) {
|
|
2418
|
+
this._ensureMap(unitId, subUnitId).delete(id);
|
|
2419
|
+
const param = this._drawingManagerService.getDrawingByParam({ unitId, subUnitId, drawingId: id });
|
|
2420
|
+
if (!param)
|
|
2421
|
+
return;
|
|
2422
|
+
const jsonOp = this._sheetDrawingService.getBatchRemoveOp([param]), { redo, objects } = jsonOp;
|
|
2423
|
+
this._commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.REMOVE });
|
|
2427
2424
|
}
|
|
2428
2425
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2426
|
+
addHook(hook) {
|
|
2427
|
+
return this._hooks.push(hook), {
|
|
2428
|
+
dispose: /* @__PURE__ */ __name(() => {
|
|
2429
|
+
const index = this._hooks.findIndex((h) => h === hook);
|
|
2430
|
+
this._hooks.splice(index, 1);
|
|
2431
|
+
}, "dispose")
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
}, __name(_a9, "SheetCanvasFloatDomManagerService"), _a9);
|
|
2435
|
+
SheetCanvasFloatDomManagerService = __decorateClass$1([
|
|
2436
|
+
__decorateParam$1(0, Inject(IRenderManagerService)),
|
|
2437
|
+
__decorateParam$1(1, IUniverInstanceService),
|
|
2438
|
+
__decorateParam$1(2, Inject(ICommandService)),
|
|
2439
|
+
__decorateParam$1(3, IDrawingManagerService),
|
|
2440
|
+
__decorateParam$1(4, Inject(CanvasFloatDomService)),
|
|
2441
|
+
__decorateParam$1(5, ISheetDrawingService)
|
|
2442
|
+
], SheetCanvasFloatDomManagerService);
|
|
2438
2443
|
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) => {
|
|
2439
2444
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2440
2445
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -2449,20 +2454,31 @@ let UniverSheetsDrawingUIPlugin = (_a10 = class extends Plugin {
|
|
|
2449
2454
|
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
|
|
2450
2455
|
}
|
|
2451
2456
|
onStarting() {
|
|
2452
|
-
this.
|
|
2453
|
-
}
|
|
2454
|
-
onRendered() {
|
|
2455
|
-
this._registerRenderModules();
|
|
2456
|
-
}
|
|
2457
|
-
_initDependencies() {
|
|
2458
|
-
[
|
|
2457
|
+
registerDependencies(this._injector, [
|
|
2459
2458
|
[SheetCanvasFloatDomManagerService],
|
|
2460
2459
|
[SheetDrawingUIController],
|
|
2461
2460
|
[DrawingPopupMenuController],
|
|
2462
2461
|
[SheetDrawingPrintingController],
|
|
2463
2462
|
[SheetDrawingPermissionController],
|
|
2464
2463
|
[SheetsDrawingCopyPasteController]
|
|
2465
|
-
]
|
|
2464
|
+
]), touchDependencies(this._injector, [
|
|
2465
|
+
[SheetCanvasFloatDomManagerService]
|
|
2466
|
+
]);
|
|
2467
|
+
}
|
|
2468
|
+
onReady() {
|
|
2469
|
+
touchDependencies(this._injector, [
|
|
2470
|
+
[SheetsDrawingCopyPasteController]
|
|
2471
|
+
]);
|
|
2472
|
+
}
|
|
2473
|
+
onRendered() {
|
|
2474
|
+
this._registerRenderModules(), touchDependencies(this._injector, [
|
|
2475
|
+
[SheetDrawingPermissionController],
|
|
2476
|
+
[SheetDrawingPrintingController],
|
|
2477
|
+
[SheetDrawingUIController]
|
|
2478
|
+
]);
|
|
2479
|
+
}
|
|
2480
|
+
onSteady() {
|
|
2481
|
+
this._injector.get(DrawingPopupMenuController);
|
|
2466
2482
|
}
|
|
2467
2483
|
_registerRenderModules() {
|
|
2468
2484
|
[
|