@univerjs/sheets-drawing-ui 0.2.11 → 0.2.13
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 +302 -290
- package/lib/index.css +1 -1
- package/lib/types/commands/commands/insert-image.command.d.ts +5 -0
- package/lib/types/controllers/config.schema.d.ts +9 -0
- package/lib/types/controllers/drawing-popup-menu.controller.d.ts +1 -1
- package/lib/types/controllers/menu.schema.d.ts +2 -0
- package/lib/types/controllers/render-controllers/sheet-drawing.render-controller.d.ts +4 -1
- package/lib/types/controllers/sheet-drawing-transform-affected.controller.d.ts +4 -2
- package/lib/types/controllers/sheet-drawing-update.controller.d.ts +6 -9
- package/lib/types/controllers/sheet-drawing.controller.d.ts +4 -10
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.d.ts +5 -5
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +1 -1
- package/lib/types/views/menu/image.menu.d.ts +0 -1
- package/lib/types/views/upload-component/component-name.d.ts +0 -1
- package/lib/umd/index.js +1 -1
- package/package.json +24 -24
- package/lib/types/commands/operations/insert-image.operation.d.ts +0 -6
- package/lib/types/views/upload-component/UploadFile.d.ts +0 -8
package/lib/es/index.js
CHANGED
|
@@ -2,15 +2,15 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { CommandType, ICommandService, IUndoRedoService, LocaleService, IUniverInstanceService, useDependency, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, OnLifecycle, LifecycleStages, Inject, Injector, IContextService, Disposable, Direction, FOCUSING_FX_BAR_EDITOR, EDITOR_ACTIVATED, Rectangle, DrawingTypeEnum as DrawingTypeEnum$1, DisposableCollection, generateRandomId, Tools, UserManagerService, IPermissionService, LifecycleService, Plugin, DependentOn } from "@univerjs/core";
|
|
5
|
+
import { CommandType, ICommandService, IUndoRedoService, LocaleService, IUniverInstanceService, useDependency, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, OnLifecycle, LifecycleStages, Inject, Injector, IContextService, Disposable, Direction, FOCUSING_FX_BAR_EDITOR, EDITOR_ACTIVATED, Rectangle, DrawingTypeEnum as DrawingTypeEnum$1, DisposableCollection, generateRandomId, Tools, UserManagerService, IPermissionService, LifecycleService, Plugin, DependentOn, IConfigService } from "@univerjs/core";
|
|
6
6
|
import { ImageCropperObject, COMPONENT_IMAGE_POPUP_MENU, OpenImageCropOperation, ImageResetSizeOperation, DrawingCommonPanel, DrawingRenderService, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
|
|
7
7
|
import { ISheetDrawingService, SetDrawingApplyMutation, DrawingApplyType, SheetDrawingAnchorType, UniverSheetsDrawingPlugin } from "@univerjs/sheets-drawing";
|
|
8
|
-
import { IDrawingManagerService, IImageIoService, ArrangeTypeEnum,
|
|
9
|
-
import { IRenderManagerService, getGroupState, transformObjectOutOfGroup,
|
|
8
|
+
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";
|
|
9
|
+
import { IRenderManagerService, precisionTo, getGroupState, transformObjectOutOfGroup, Rect, DRAWING_OBJECT_LAYER_INDEX, SHEET_VIEWPORT_KEY, RENDER_CLASS_TYPE } from "@univerjs/engine-render";
|
|
10
10
|
import { SheetCanvasPopManagerService, attachRangeWithCoord, SheetSkeletonManagerService, ISheetSelectionRenderService, getCurrentRangeDisable$, SetScrollOperation, SetZoomRatioOperation, SheetPrintInterceptorService, COPY_TYPE, PREDEFINED_HOOK_NAME, virtualizeDiscreteRanges, ISheetClipboardService } from "@univerjs/sheets-ui";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { getSheetCommandTarget, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, InsertRowCommand, InsertColCommand, RemoveRowCommand, RemoveColCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, DeltaRowHeightCommand, SetRowHeightCommand, DeltaColumnWidthCommand, SetColWidthCommand, SetRowHiddenCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand, SetColHiddenCommand, SetRowVisibleMutation, SetRowHiddenMutation, SetColVisibleMutation, SetColHiddenMutation, SetWorksheetRowHeightMutation, SetWorksheetColWidthMutation, SetWorksheetActiveOperation, SheetInterceptorService, SetFrozenMutation, WorkbookViewPermission, WorksheetViewPermission } from "@univerjs/sheets";
|
|
11
|
+
import { ISidebarService, BuiltInUIPart, IUIPartsService, ILocalFileService, IMessageService, MenuItemType, getMenuHiddenObservable, KeyCode, RibbonStartGroup, ComponentManager, IMenuManagerService, IShortcutService, CanvasFloatDomService } from "@univerjs/ui";
|
|
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, SetWorksheetActiveOperation, SheetInterceptorService, SetFrozenMutation, WorkbookViewPermission, WorksheetViewPermission } from "@univerjs/sheets";
|
|
14
14
|
import React, { useEffect, forwardRef, useRef, createElement, useState } from "react";
|
|
15
15
|
import { MessageType, RadioGroup, Radio } from "@univerjs/design";
|
|
16
16
|
import clsx from "clsx";
|
|
@@ -79,7 +79,7 @@ const ClearSheetDrawingTransformerOperation = {
|
|
|
79
79
|
const drawingManagerService = accessor.get(IDrawingManagerService), commandService = accessor.get(ICommandService);
|
|
80
80
|
return params == null ? !1 : (drawingManagerService.focusDrawing([params]), commandService.executeCommand(SidebarSheetDrawingOperation.id, { value: "open" }), !0);
|
|
81
81
|
}, "handler")
|
|
82
|
-
}, uploadLoading = "univer-upload-loading", uploadLoadingBody = "univer-upload-loading-body", uploadLoadingBodyAnimation = "univer-upload-loading-body-animation", univerCircleAnimation = "univer-UniverCircleAnimation", uploadLoadingBodyText = "univer-upload-loading-body-text", styles$
|
|
82
|
+
}, uploadLoading = "univer-upload-loading", uploadLoadingBody = "univer-upload-loading-body", uploadLoadingBodyAnimation = "univer-upload-loading-body-animation", univerCircleAnimation = "univer-UniverCircleAnimation", uploadLoadingBodyText = "univer-upload-loading-body-text", styles$1 = {
|
|
83
83
|
uploadLoading,
|
|
84
84
|
uploadLoadingBody,
|
|
85
85
|
uploadLoadingBodyAnimation,
|
|
@@ -94,7 +94,7 @@ const ClearSheetDrawingTransformerOperation = {
|
|
|
94
94
|
return () => {
|
|
95
95
|
sub.unsubscribe();
|
|
96
96
|
};
|
|
97
|
-
}, [imageIoService]), /* @__PURE__ */ React.createElement("div", { style: { display: remain > 0 ? "block" : "none" }, className: styles$
|
|
97
|
+
}, [imageIoService]), /* @__PURE__ */ React.createElement("div", { style: { display: remain > 0 ? "block" : "none" }, className: styles$1.uploadLoading }, /* @__PURE__ */ React.createElement("div", { className: styles$1.uploadLoadingBody }, /* @__PURE__ */ React.createElement("div", { className: styles$1.uploadLoadingBodyAnimation }), /* @__PURE__ */ React.createElement("div", { className: styles$1.uploadLoadingBodyText }, `${localeService.t("uploadLoading.loading")}: ${remain}`)));
|
|
98
98
|
}, "UploadLoading");
|
|
99
99
|
var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
100
100
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -152,13 +152,13 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
|
152
152
|
const oKey = object.oKey, drawingParam = this._drawingManagerService.getDrawingOKey(oKey);
|
|
153
153
|
if (!drawingParam)
|
|
154
154
|
return;
|
|
155
|
-
const { unitId: unitId2, subUnitId, drawingId } = drawingParam;
|
|
155
|
+
const { unitId: unitId2, subUnitId, drawingId, drawingType } = drawingParam;
|
|
156
156
|
singletonPopupDisposer == null || singletonPopupDisposer.dispose(), singletonPopupDisposer = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(object, {
|
|
157
157
|
componentKey: COMPONENT_IMAGE_POPUP_MENU,
|
|
158
158
|
direction: "horizontal",
|
|
159
159
|
offset: [2, 0],
|
|
160
160
|
extraProps: {
|
|
161
|
-
menuItems: this._getImageMenuItems(unitId2, subUnitId, drawingId)
|
|
161
|
+
menuItems: this._getImageMenuItems(unitId2, subUnitId, drawingId, drawingType)
|
|
162
162
|
}
|
|
163
163
|
})), this._drawingManagerService.focusDrawing([{
|
|
164
164
|
unitId: unitId2,
|
|
@@ -177,14 +177,14 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
|
177
177
|
})
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
|
-
_getImageMenuItems(unitId, subUnitId, drawingId) {
|
|
180
|
+
_getImageMenuItems(unitId, subUnitId, drawingId, drawingType) {
|
|
181
181
|
return [
|
|
182
182
|
{
|
|
183
183
|
label: "image-popup.edit",
|
|
184
184
|
index: 0,
|
|
185
185
|
commandId: EditSheetDrawingOperation.id,
|
|
186
186
|
commandParams: { unitId, subUnitId, drawingId },
|
|
187
|
-
disable:
|
|
187
|
+
disable: drawingType === DrawingTypeEnum.DRAWING_DOM
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
label: "image-popup.delete",
|
|
@@ -198,14 +198,14 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
|
198
198
|
index: 2,
|
|
199
199
|
commandId: OpenImageCropOperation.id,
|
|
200
200
|
commandParams: { unitId, subUnitId, drawingId },
|
|
201
|
-
disable:
|
|
201
|
+
disable: drawingType === DrawingTypeEnum.DRAWING_DOM
|
|
202
202
|
},
|
|
203
203
|
{
|
|
204
204
|
label: "image-popup.reset",
|
|
205
205
|
index: 3,
|
|
206
206
|
commandId: ImageResetSizeOperation.id,
|
|
207
207
|
commandParams: [{ unitId, subUnitId, drawingId }],
|
|
208
|
-
disable:
|
|
208
|
+
disable: drawingType === DrawingTypeEnum.DRAWING_DOM
|
|
209
209
|
}
|
|
210
210
|
];
|
|
211
211
|
}
|
|
@@ -220,74 +220,69 @@ DrawingPopupMenuController = __decorateClass$9([
|
|
|
220
220
|
__decorateParam$9(5, IContextService),
|
|
221
221
|
__decorateParam$9(6, Inject(IUIPartsService))
|
|
222
222
|
], DrawingPopupMenuController);
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
{ id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.ARRANGE } }
|
|
287
|
-
]
|
|
288
|
-
}), !0) : !1;
|
|
289
|
-
}, "handler")
|
|
290
|
-
};
|
|
223
|
+
function drawingPositionToTransform(position, selectionRenderService, sheetSkeletonManagerService) {
|
|
224
|
+
const { from, to, flipY = !1, flipX = !1, angle = 0, skewX = 0, skewY = 0 } = position, { column: fromColumn, columnOffset: fromColumnOffset, row: fromRow, rowOffset: fromRowOffset } = from, { column: toColumn, columnOffset: toColumnOffset, row: toRow, rowOffset: toRowOffset } = to, skeleton = sheetSkeletonManagerService.getCurrentSkeleton(), startSelectionCell = attachRangeWithCoord(skeleton, {
|
|
225
|
+
startColumn: fromColumn,
|
|
226
|
+
endColumn: fromColumn,
|
|
227
|
+
startRow: fromRow,
|
|
228
|
+
endRow: fromRow
|
|
229
|
+
});
|
|
230
|
+
if (startSelectionCell == null)
|
|
231
|
+
return;
|
|
232
|
+
const endSelectionCell = attachRangeWithCoord(skeleton, {
|
|
233
|
+
startColumn: toColumn,
|
|
234
|
+
endColumn: toColumn,
|
|
235
|
+
startRow: toRow,
|
|
236
|
+
endRow: toRow
|
|
237
|
+
});
|
|
238
|
+
if (endSelectionCell == null)
|
|
239
|
+
return;
|
|
240
|
+
const { startX: startSelectionX, startY: startSelectionY } = startSelectionCell, { startX: endSelectionX, startY: endSelectionY } = endSelectionCell;
|
|
241
|
+
let left = precisionTo(startSelectionX + fromColumnOffset, 1), top = precisionTo(startSelectionY + fromRowOffset, 1), width = precisionTo(endSelectionX + toColumnOffset - left, 1), height = precisionTo(endSelectionY + toRowOffset - top, 1);
|
|
242
|
+
startSelectionCell.startX === endSelectionCell.endX && (width = 0), startSelectionCell.startY === endSelectionCell.endY && (height = 0);
|
|
243
|
+
const sheetWidth = skeleton.rowHeaderWidth + skeleton.columnTotalWidth, sheetHeight = skeleton.columnHeaderHeight + skeleton.rowTotalHeight;
|
|
244
|
+
return left + width > sheetWidth && (left = sheetWidth - width), top + height > sheetHeight && (top = sheetHeight - height), {
|
|
245
|
+
flipY,
|
|
246
|
+
flipX,
|
|
247
|
+
angle,
|
|
248
|
+
skewX,
|
|
249
|
+
skewY,
|
|
250
|
+
left,
|
|
251
|
+
top,
|
|
252
|
+
width,
|
|
253
|
+
height
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
__name(drawingPositionToTransform, "drawingPositionToTransform");
|
|
257
|
+
function transformToDrawingPosition(transform, selectionRenderService) {
|
|
258
|
+
const { left = 0, top = 0, width = 0, height = 0, flipY = !1, flipX = !1, angle = 0, skewX = 0, skewY = 0 } = transform, startSelectionCell = selectionRenderService.getSelectionCellByPosition(left, top);
|
|
259
|
+
if (startSelectionCell == null)
|
|
260
|
+
return;
|
|
261
|
+
const from = {
|
|
262
|
+
column: startSelectionCell.actualColumn,
|
|
263
|
+
columnOffset: precisionTo(left - startSelectionCell.startX, 1),
|
|
264
|
+
row: startSelectionCell.actualRow,
|
|
265
|
+
rowOffset: precisionTo(top - startSelectionCell.startY, 1)
|
|
266
|
+
}, endSelectionCell = selectionRenderService.getSelectionCellByPosition(left + width, top + height);
|
|
267
|
+
if (endSelectionCell == null)
|
|
268
|
+
return;
|
|
269
|
+
const to = {
|
|
270
|
+
column: endSelectionCell.actualColumn,
|
|
271
|
+
columnOffset: precisionTo(left + width - endSelectionCell.startX, 1),
|
|
272
|
+
row: endSelectionCell.actualRow,
|
|
273
|
+
rowOffset: precisionTo(top + height - endSelectionCell.startY, 1)
|
|
274
|
+
};
|
|
275
|
+
return {
|
|
276
|
+
flipY,
|
|
277
|
+
flipX,
|
|
278
|
+
angle,
|
|
279
|
+
skewX,
|
|
280
|
+
skewY,
|
|
281
|
+
from,
|
|
282
|
+
to
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
__name(transformToDrawingPosition, "transformToDrawingPosition");
|
|
291
286
|
function ungroupToGroup(ungroupParams) {
|
|
292
287
|
const newGroupParams = [];
|
|
293
288
|
return ungroupParams.forEach((ungroupParam) => {
|
|
@@ -375,6 +370,65 @@ const GroupSheetDrawingCommand = {
|
|
|
375
370
|
]
|
|
376
371
|
}), !0) : !1;
|
|
377
372
|
}, "handler")
|
|
373
|
+
}, InsertSheetDrawingCommand = {
|
|
374
|
+
id: "sheet.command.insert-sheet-image",
|
|
375
|
+
type: CommandType.COMMAND,
|
|
376
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
377
|
+
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetDrawingService = accessor.get(ISheetDrawingService);
|
|
378
|
+
if (!params) return !1;
|
|
379
|
+
const drawings = params.drawings, unitIds = drawings.map((param) => param.unitId), jsonOp = sheetDrawingService.getBatchAddOp(drawings), { unitId, subUnitId, undo, redo, objects } = jsonOp;
|
|
380
|
+
return commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.INSERT }) ? (undoRedoService.pushUndoRedo({
|
|
381
|
+
unitID: unitId,
|
|
382
|
+
undoMutations: [
|
|
383
|
+
{ id: SetDrawingApplyMutation.id, params: { op: undo, unitId, subUnitId, objects, type: DrawingApplyType.REMOVE } },
|
|
384
|
+
{ id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
|
|
385
|
+
],
|
|
386
|
+
redoMutations: [
|
|
387
|
+
{ id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.INSERT } },
|
|
388
|
+
{ id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
|
|
389
|
+
]
|
|
390
|
+
}), !0) : !1;
|
|
391
|
+
}, "handler")
|
|
392
|
+
}, SetDrawingArrangeCommand = {
|
|
393
|
+
id: "sheet.command.set-drawing-arrange",
|
|
394
|
+
type: CommandType.COMMAND,
|
|
395
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
396
|
+
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService);
|
|
397
|
+
if (!params) return !1;
|
|
398
|
+
const sheetDrawingService = accessor.get(ISheetDrawingService), { unitId, subUnitId, drawingIds, arrangeType } = params, drawingOrderMapParam = { unitId, subUnitId, drawingIds };
|
|
399
|
+
let jsonOp;
|
|
400
|
+
if (arrangeType === ArrangeTypeEnum.forward ? jsonOp = sheetDrawingService.getForwardDrawingsOp(drawingOrderMapParam) : arrangeType === ArrangeTypeEnum.backward ? jsonOp = sheetDrawingService.getBackwardDrawingOp(drawingOrderMapParam) : arrangeType === ArrangeTypeEnum.front ? jsonOp = sheetDrawingService.getFrontDrawingsOp(drawingOrderMapParam) : arrangeType === ArrangeTypeEnum.back && (jsonOp = sheetDrawingService.getBackDrawingsOp(drawingOrderMapParam)), jsonOp == null)
|
|
401
|
+
return !1;
|
|
402
|
+
const { objects, redo, undo } = jsonOp;
|
|
403
|
+
return commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.ARRANGE }) ? (undoRedoService.pushUndoRedo({
|
|
404
|
+
unitID: unitId,
|
|
405
|
+
undoMutations: [
|
|
406
|
+
{ id: SetDrawingApplyMutation.id, params: { op: undo, unitId, subUnitId, objects, type: DrawingApplyType.ARRANGE } }
|
|
407
|
+
],
|
|
408
|
+
redoMutations: [
|
|
409
|
+
{ id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.ARRANGE } }
|
|
410
|
+
]
|
|
411
|
+
}), !0) : !1;
|
|
412
|
+
}, "handler")
|
|
413
|
+
}, SetSheetDrawingCommand = {
|
|
414
|
+
id: "sheet.command.set-sheet-image",
|
|
415
|
+
type: CommandType.COMMAND,
|
|
416
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
417
|
+
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetDrawingService = accessor.get(ISheetDrawingService);
|
|
418
|
+
if (!params) return !1;
|
|
419
|
+
const { drawings } = params, jsonOp = sheetDrawingService.getBatchUpdateOp(drawings), { unitId, subUnitId, undo, redo, objects } = jsonOp;
|
|
420
|
+
return commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.UPDATE }) ? (undoRedoService.pushUndoRedo({
|
|
421
|
+
unitID: unitId,
|
|
422
|
+
undoMutations: [
|
|
423
|
+
{ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: undo, objects, type: DrawingApplyType.UPDATE } },
|
|
424
|
+
{ id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }
|
|
425
|
+
],
|
|
426
|
+
redoMutations: [
|
|
427
|
+
{ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.UPDATE } },
|
|
428
|
+
{ id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }
|
|
429
|
+
]
|
|
430
|
+
}), !0) : !1;
|
|
431
|
+
}, "handler")
|
|
378
432
|
}, UngroupSheetDrawingCommand = {
|
|
379
433
|
id: "sheet.command.ungroup-sheet-image",
|
|
380
434
|
type: CommandType.COMMAND,
|
|
@@ -401,108 +455,26 @@ const GroupSheetDrawingCommand = {
|
|
|
401
455
|
}), !0) : !1;
|
|
402
456
|
}, "handler")
|
|
403
457
|
};
|
|
404
|
-
function drawingPositionToTransform(position, selectionRenderService, sheetSkeletonManagerService) {
|
|
405
|
-
const { from, to, flipY = !1, flipX = !1, angle = 0, skewX = 0, skewY = 0 } = position, { column: fromColumn, columnOffset: fromColumnOffset, row: fromRow, rowOffset: fromRowOffset } = from, { column: toColumn, columnOffset: toColumnOffset, row: toRow, rowOffset: toRowOffset } = to, skeleton = sheetSkeletonManagerService.getCurrentSkeleton(), startSelectionCell = attachRangeWithCoord(skeleton, {
|
|
406
|
-
startColumn: fromColumn,
|
|
407
|
-
endColumn: fromColumn,
|
|
408
|
-
startRow: fromRow,
|
|
409
|
-
endRow: fromRow
|
|
410
|
-
});
|
|
411
|
-
if (startSelectionCell == null)
|
|
412
|
-
return;
|
|
413
|
-
const endSelectionCell = attachRangeWithCoord(skeleton, {
|
|
414
|
-
startColumn: toColumn,
|
|
415
|
-
endColumn: toColumn,
|
|
416
|
-
startRow: toRow,
|
|
417
|
-
endRow: toRow
|
|
418
|
-
});
|
|
419
|
-
if (endSelectionCell == null)
|
|
420
|
-
return;
|
|
421
|
-
const { startX: startSelectionX, startY: startSelectionY } = startSelectionCell, { startX: endSelectionX, startY: endSelectionY } = endSelectionCell;
|
|
422
|
-
let left = precisionTo(startSelectionX + fromColumnOffset, 1), top = precisionTo(startSelectionY + fromRowOffset, 1), width = precisionTo(endSelectionX + toColumnOffset - left, 1), height = precisionTo(endSelectionY + toRowOffset - top, 1);
|
|
423
|
-
startSelectionCell.startX === endSelectionCell.endX && (width = 0), startSelectionCell.startY === endSelectionCell.endY && (height = 0);
|
|
424
|
-
const sheetWidth = skeleton.rowHeaderWidth + skeleton.columnTotalWidth, sheetHeight = skeleton.columnHeaderHeight + skeleton.rowTotalHeight;
|
|
425
|
-
return left + width > sheetWidth && (left = sheetWidth - width), top + height > sheetHeight && (top = sheetHeight - height), {
|
|
426
|
-
flipY,
|
|
427
|
-
flipX,
|
|
428
|
-
angle,
|
|
429
|
-
skewX,
|
|
430
|
-
skewY,
|
|
431
|
-
left,
|
|
432
|
-
top,
|
|
433
|
-
width,
|
|
434
|
-
height
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
__name(drawingPositionToTransform, "drawingPositionToTransform");
|
|
438
|
-
function transformToDrawingPosition(transform, selectionRenderService) {
|
|
439
|
-
const { left = 0, top = 0, width = 0, height = 0, flipY = !1, flipX = !1, angle = 0, skewX = 0, skewY = 0 } = transform, startSelectionCell = selectionRenderService.getSelectionCellByPosition(left, top);
|
|
440
|
-
if (startSelectionCell == null)
|
|
441
|
-
return;
|
|
442
|
-
const from = {
|
|
443
|
-
column: startSelectionCell.actualColumn,
|
|
444
|
-
columnOffset: precisionTo(left - startSelectionCell.startX, 1),
|
|
445
|
-
row: startSelectionCell.actualRow,
|
|
446
|
-
rowOffset: precisionTo(top - startSelectionCell.startY, 1)
|
|
447
|
-
}, endSelectionCell = selectionRenderService.getSelectionCellByPosition(left + width, top + height);
|
|
448
|
-
if (endSelectionCell == null)
|
|
449
|
-
return;
|
|
450
|
-
const to = {
|
|
451
|
-
column: endSelectionCell.actualColumn,
|
|
452
|
-
columnOffset: precisionTo(left + width - endSelectionCell.startX, 1),
|
|
453
|
-
row: endSelectionCell.actualRow,
|
|
454
|
-
rowOffset: precisionTo(top + height - endSelectionCell.startY, 1)
|
|
455
|
-
};
|
|
456
|
-
return {
|
|
457
|
-
flipY,
|
|
458
|
-
flipX,
|
|
459
|
-
angle,
|
|
460
|
-
skewX,
|
|
461
|
-
skewY,
|
|
462
|
-
from,
|
|
463
|
-
to
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
__name(transformToDrawingPosition, "transformToDrawingPosition");
|
|
467
458
|
var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
468
459
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
469
460
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
470
461
|
return kind && result && __defProp$8(target, key, result), result;
|
|
471
462
|
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a2;
|
|
472
463
|
let SheetDrawingUpdateController = (_a2 = class extends Disposable {
|
|
473
|
-
constructor(_context, _skeletonManagerService, _commandService, _selectionRenderService, _imageIoService, _sheetDrawingService, _drawingManagerService, _contextService, _messageService, _localeService, selectionManagerService) {
|
|
464
|
+
constructor(_context, _skeletonManagerService, _commandService, _selectionRenderService, _imageIoService, _fileOpenerService, _sheetDrawingService, _drawingManagerService, _contextService, _messageService, _localeService, selectionManagerService) {
|
|
474
465
|
super();
|
|
475
466
|
__publicField(this, "_workbookSelections");
|
|
476
|
-
this._context = _context, this._skeletonManagerService = _skeletonManagerService, this._commandService = _commandService, this._selectionRenderService = _selectionRenderService, this._imageIoService = _imageIoService, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._contextService = _contextService, this._messageService = _messageService, this._localeService = _localeService, this._workbookSelections = selectionManagerService.getWorkbookSelections(this._context.unitId), this.
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
return;
|
|
488
|
-
const fileLength = params.files.length;
|
|
489
|
-
if (fileLength > DRAWING_IMAGE_COUNT_LIMIT) {
|
|
490
|
-
this._messageService.show({
|
|
491
|
-
type: MessageType.Error,
|
|
492
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(DRAWING_IMAGE_COUNT_LIMIT))
|
|
493
|
-
});
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
this._imageIoService.setWaitCount(fileLength), command.id === InsertCellImageOperation.id ? params.files.forEach(async (file) => {
|
|
497
|
-
await this._insertCellImage(file);
|
|
498
|
-
}) : params.files.forEach(async (file) => {
|
|
499
|
-
await this._insertFloatImage(file);
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
})
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
|
-
async _insertCellImage(file) {
|
|
467
|
+
this._context = _context, this._skeletonManagerService = _skeletonManagerService, this._commandService = _commandService, this._selectionRenderService = _selectionRenderService, this._imageIoService = _imageIoService, this._fileOpenerService = _fileOpenerService, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._contextService = _contextService, this._messageService = _messageService, this._localeService = _localeService, this._workbookSelections = selectionManagerService.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
|
|
468
|
+
}
|
|
469
|
+
async insertFloatImage() {
|
|
470
|
+
const files = await this._fileOpenerService.openFile({
|
|
471
|
+
multiple: !0,
|
|
472
|
+
accept: DRAWING_IMAGE_ALLOW_IMAGE_LIST.map((image) => `.${image.replace("image/", "")}`).join(",")
|
|
473
|
+
}), fileLength = files.length;
|
|
474
|
+
return fileLength > DRAWING_IMAGE_COUNT_LIMIT ? (this._messageService.show({
|
|
475
|
+
type: MessageType.Error,
|
|
476
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(DRAWING_IMAGE_COUNT_LIMIT))
|
|
477
|
+
}), !1) : fileLength === 0 ? !1 : (files.forEach(async (file) => await this._insertFloatImage(file)), !0);
|
|
506
478
|
}
|
|
507
479
|
async _insertFloatImage(file) {
|
|
508
480
|
let imageParam;
|
|
@@ -523,10 +495,7 @@ let SheetDrawingUpdateController = (_a2 = class extends Disposable {
|
|
|
523
495
|
}
|
|
524
496
|
if (imageParam == null)
|
|
525
497
|
return;
|
|
526
|
-
const info = this._getUnitInfo();
|
|
527
|
-
if (info == null)
|
|
528
|
-
return;
|
|
529
|
-
const { unitId, subUnitId } = info, { imageId, imageSourceType, source, base64Cache } = imageParam, { width, height, image } = await getImageSize(base64Cache || ""), { width: sceneWidth, height: sceneHeight } = this._context.scene;
|
|
498
|
+
const info = this._getUnitInfo(), { unitId, subUnitId } = info, { imageId, imageSourceType, source, base64Cache } = imageParam, { width, height, image } = await getImageSize(base64Cache || ""), { width: sceneWidth, height: sceneHeight } = this._context.scene;
|
|
530
499
|
this._imageIoService.addImageSourceCache(source, imageSourceType, image);
|
|
531
500
|
let scale = 1;
|
|
532
501
|
if (width > DRAWING_IMAGE_WIDTH_LIMIT || height > DRAWING_IMAGE_HEIGHT_LIMIT) {
|
|
@@ -654,12 +623,13 @@ SheetDrawingUpdateController = __decorateClass$8([
|
|
|
654
623
|
__decorateParam$8(2, ICommandService),
|
|
655
624
|
__decorateParam$8(3, ISheetSelectionRenderService),
|
|
656
625
|
__decorateParam$8(4, IImageIoService),
|
|
657
|
-
__decorateParam$8(5,
|
|
658
|
-
__decorateParam$8(6,
|
|
659
|
-
__decorateParam$8(7,
|
|
660
|
-
__decorateParam$8(8,
|
|
661
|
-
__decorateParam$8(9,
|
|
662
|
-
__decorateParam$8(10, Inject(
|
|
626
|
+
__decorateParam$8(5, ILocalFileService),
|
|
627
|
+
__decorateParam$8(6, ISheetDrawingService),
|
|
628
|
+
__decorateParam$8(7, IDrawingManagerService),
|
|
629
|
+
__decorateParam$8(8, IContextService),
|
|
630
|
+
__decorateParam$8(9, IMessageService),
|
|
631
|
+
__decorateParam$8(10, Inject(LocaleService)),
|
|
632
|
+
__decorateParam$8(11, Inject(SheetsSelectionsService))
|
|
663
633
|
], SheetDrawingUpdateController);
|
|
664
634
|
var __assign = function() {
|
|
665
635
|
return __assign = Object.assign || function(t) {
|
|
@@ -716,40 +686,18 @@ var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width:
|
|
|
716
686
|
}));
|
|
717
687
|
});
|
|
718
688
|
AddImageSingle.displayName = "AddImageSingle";
|
|
719
|
-
const
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
var
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
(_a11 = fileInputRef.current) == null || _a11.click();
|
|
728
|
-
}, "handleButtonClick"), imageAccept = DRAWING_IMAGE_ALLOW_IMAGE_LIST.map((image) => `.${image.replace("image/", "")}`).join(","), handleFileChange = /* @__PURE__ */ __name((event) => {
|
|
729
|
-
const fileList = event.target.files;
|
|
730
|
-
if (fileList == null)
|
|
731
|
-
return;
|
|
732
|
-
const files = Array.from(fileList);
|
|
733
|
-
type === UploadFileType.floatImage ? commandService.executeCommand(InsertFloatImageOperation.id, { files }) : type === UploadFileType.cellImage && commandService.executeCommand(InsertCellImageOperation.id, { files }), fileInputRef.current && (fileInputRef.current.value = "");
|
|
734
|
-
}, "handleFileChange");
|
|
735
|
-
return /* @__PURE__ */ React.createElement("div", { onClick: handleButtonClick, className: styles$1.uploadFileMenu }, /* @__PURE__ */ React.createElement(
|
|
736
|
-
"input",
|
|
737
|
-
{
|
|
738
|
-
type: "file",
|
|
739
|
-
className: styles$1.uploadFileMenuInput,
|
|
740
|
-
ref: fileInputRef,
|
|
741
|
-
onChange: handleFileChange,
|
|
742
|
-
accept: imageAccept,
|
|
743
|
-
multiple: !0
|
|
744
|
-
}
|
|
745
|
-
));
|
|
746
|
-
}, "UploadFileMenu"), IMAGE_UPLOAD_ICON = "addition-and-subtraction-single", IMAGE_MENU_ID = "sheet.menu.image";
|
|
689
|
+
const InsertFloatImageCommand = {
|
|
690
|
+
id: "sheet.command.insert-float-image",
|
|
691
|
+
type: CommandType.COMMAND,
|
|
692
|
+
handler: /* @__PURE__ */ __name((accessor) => {
|
|
693
|
+
var _a11, _b;
|
|
694
|
+
return (_b = (_a11 = accessor.get(IRenderManagerService).getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a11.with(SheetDrawingUpdateController).insertFloatImage()) != null ? _b : !1;
|
|
695
|
+
}, "handler")
|
|
696
|
+
}, IMAGE_UPLOAD_ICON = "addition-and-subtraction-single", IMAGE_MENU_ID = "sheet.menu.image";
|
|
747
697
|
function ImageMenuFactory(accessor) {
|
|
748
698
|
return {
|
|
749
699
|
id: IMAGE_MENU_ID,
|
|
750
700
|
type: MenuItemType.SUBITEMS,
|
|
751
|
-
positions: [MenuPosition.TOOLBAR_START],
|
|
752
|
-
group: MenuGroup.TOOLBAR_FORMULAS_INSERT,
|
|
753
701
|
icon: IMAGE_UPLOAD_ICON,
|
|
754
702
|
tooltip: "sheetImage.title",
|
|
755
703
|
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
@@ -759,16 +707,9 @@ function ImageMenuFactory(accessor) {
|
|
|
759
707
|
__name(ImageMenuFactory, "ImageMenuFactory");
|
|
760
708
|
function UploadFloatImageMenuFactory(_accessor) {
|
|
761
709
|
return {
|
|
762
|
-
id:
|
|
710
|
+
id: InsertFloatImageCommand.id,
|
|
763
711
|
title: "sheetImage.upload.float",
|
|
764
|
-
type: MenuItemType.
|
|
765
|
-
label: {
|
|
766
|
-
name: COMPONENT_UPLOAD_FILE_MENU,
|
|
767
|
-
props: {
|
|
768
|
-
type: UploadFileType.floatImage
|
|
769
|
-
}
|
|
770
|
-
},
|
|
771
|
-
positions: [IMAGE_MENU_ID],
|
|
712
|
+
type: MenuItemType.BUTTON,
|
|
772
713
|
hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_SHEET)
|
|
773
714
|
};
|
|
774
715
|
}
|
|
@@ -959,36 +900,37 @@ const MoveDrawingDownShortcutItem = {
|
|
|
959
900
|
preconditions: whenSheetDrawingFocused,
|
|
960
901
|
binding: KeyCode.DELETE,
|
|
961
902
|
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
|
+
}
|
|
962
914
|
};
|
|
963
915
|
var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
964
916
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
965
917
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
966
918
|
return kind && result && __defProp$7(target, key, result), result;
|
|
967
|
-
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7");
|
|
968
|
-
const DefaultSheetsDrawingConfig = {};
|
|
969
|
-
var _a3;
|
|
919
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a3;
|
|
970
920
|
let SheetDrawingUIController = (_a3 = class extends Disposable {
|
|
971
|
-
constructor(
|
|
972
|
-
super(), this.
|
|
921
|
+
constructor(_injector, _componentManager, _menuManagerService, _commandService, _shortcutService) {
|
|
922
|
+
super(), this._injector = _injector, this._componentManager = _componentManager, this._menuManagerService = _menuManagerService, this._commandService = _commandService, this._shortcutService = _shortcutService, this._init();
|
|
973
923
|
}
|
|
974
924
|
_initCustomComponents() {
|
|
975
925
|
const componentManager = this._componentManager;
|
|
976
|
-
this.disposeWithMe(componentManager.register(IMAGE_UPLOAD_ICON, AddImageSingle)), this.disposeWithMe(componentManager.register(
|
|
926
|
+
this.disposeWithMe(componentManager.register(IMAGE_UPLOAD_ICON, AddImageSingle)), this.disposeWithMe(componentManager.register(COMPONENT_SHEET_DRAWING_PANEL, SheetDrawingPanel));
|
|
977
927
|
}
|
|
978
928
|
_initMenus() {
|
|
979
|
-
|
|
980
|
-
[
|
|
981
|
-
ImageMenuFactory,
|
|
982
|
-
UploadFloatImageMenuFactory
|
|
983
|
-
// UploadCellImageMenuFactory,
|
|
984
|
-
].forEach((menuFactory) => {
|
|
985
|
-
this._menuService.addMenuItem(menuFactory(this._injector), menu);
|
|
986
|
-
});
|
|
929
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
987
930
|
}
|
|
988
931
|
_initCommands() {
|
|
989
932
|
[
|
|
990
|
-
|
|
991
|
-
InsertCellImageOperation,
|
|
933
|
+
InsertFloatImageCommand,
|
|
992
934
|
InsertSheetDrawingCommand,
|
|
993
935
|
RemoveSheetDrawingCommand,
|
|
994
936
|
SetSheetDrawingCommand,
|
|
@@ -1020,11 +962,11 @@ let SheetDrawingUIController = (_a3 = class extends Disposable {
|
|
|
1020
962
|
}, __name(_a3, "SheetDrawingUIController"), _a3);
|
|
1021
963
|
SheetDrawingUIController = __decorateClass$7([
|
|
1022
964
|
OnLifecycle(LifecycleStages.Rendered, SheetDrawingUIController),
|
|
1023
|
-
__decorateParam$7(
|
|
1024
|
-
__decorateParam$7(
|
|
1025
|
-
__decorateParam$7(
|
|
1026
|
-
__decorateParam$7(
|
|
1027
|
-
__decorateParam$7(
|
|
965
|
+
__decorateParam$7(0, Inject(Injector)),
|
|
966
|
+
__decorateParam$7(1, Inject(ComponentManager)),
|
|
967
|
+
__decorateParam$7(2, IMenuManagerService),
|
|
968
|
+
__decorateParam$7(3, ICommandService),
|
|
969
|
+
__decorateParam$7(4, IShortcutService)
|
|
1028
970
|
], SheetDrawingUIController);
|
|
1029
971
|
var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1030
972
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -1047,7 +989,10 @@ const UPDATE_COMMANDS = [
|
|
|
1047
989
|
SetRowHiddenCommand.id,
|
|
1048
990
|
SetSpecificRowsVisibleCommand.id,
|
|
1049
991
|
SetSpecificColsVisibleCommand.id,
|
|
1050
|
-
SetColHiddenCommand.id
|
|
992
|
+
SetColHiddenCommand.id,
|
|
993
|
+
MoveColsCommand.id,
|
|
994
|
+
MoveRowsCommand.id,
|
|
995
|
+
MoveRangeCommand.id
|
|
1051
996
|
], REFRESH_MUTATIONS = [
|
|
1052
997
|
SetRowVisibleMutation.id,
|
|
1053
998
|
SetRowHiddenMutation.id,
|
|
@@ -1058,8 +1003,8 @@ const UPDATE_COMMANDS = [
|
|
|
1058
1003
|
];
|
|
1059
1004
|
var _a4;
|
|
1060
1005
|
let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
1061
|
-
constructor(_context, _commandService, _selectionRenderService, _skeletonManagerService, _sheetInterceptorService, _sheetDrawingService, _drawingManagerService, _univerInstanceService) {
|
|
1062
|
-
super(), this._context = _context, 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();
|
|
1006
|
+
constructor(_context, _renderManagerService, _commandService, _selectionRenderService, _skeletonManagerService, _sheetInterceptorService, _sheetDrawingService, _drawingManagerService, _univerInstanceService) {
|
|
1007
|
+
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();
|
|
1063
1008
|
}
|
|
1064
1009
|
_sheetInterceptorListener() {
|
|
1065
1010
|
this.disposeWithMe(
|
|
@@ -1072,6 +1017,8 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
|
1072
1017
|
const cId = commandInfo.id;
|
|
1073
1018
|
if (cId === InsertRowCommand.id)
|
|
1074
1019
|
return this._moveRowInterceptor(commandInfo.params, "insert");
|
|
1020
|
+
if ([MoveColsCommand.id, MoveRowsCommand.id, MoveRangeCommand.id].includes(cId))
|
|
1021
|
+
return this._moveRangeInterceptor(commandInfo.params);
|
|
1075
1022
|
if (cId === InsertColCommand.id)
|
|
1076
1023
|
return this._moveColInterceptor(commandInfo.params, "insert");
|
|
1077
1024
|
if (cId === RemoveRowCommand.id)
|
|
@@ -1406,6 +1353,52 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
|
1406
1353
|
}
|
|
1407
1354
|
return { unitId, subUnitId };
|
|
1408
1355
|
}
|
|
1356
|
+
_moveRangeInterceptor(params) {
|
|
1357
|
+
var _a11, _b;
|
|
1358
|
+
const { toRange, fromRange } = params, target = getSheetCommandTarget(this._univerInstanceService);
|
|
1359
|
+
if (!target)
|
|
1360
|
+
return { redos: [], undos: [] };
|
|
1361
|
+
const { unitId, subUnitId } = target, skeleton = (_b = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService)) == null ? void 0 : _b.getCurrentSkeleton();
|
|
1362
|
+
if (!skeleton)
|
|
1363
|
+
return { redos: [], undos: [] };
|
|
1364
|
+
const selectionRect = attachRangeWithCoord(skeleton, fromRange);
|
|
1365
|
+
if (!selectionRect)
|
|
1366
|
+
return { redos: [], undos: [] };
|
|
1367
|
+
const { startX, endX, startY, endY } = selectionRect, drawings = this._sheetDrawingService.getDrawingData(unitId, subUnitId), containedDrawings = [];
|
|
1368
|
+
Object.keys(drawings).forEach((drawingId) => {
|
|
1369
|
+
const drawing = drawings[drawingId];
|
|
1370
|
+
if (drawing.anchorType !== SheetDrawingAnchorType.Both)
|
|
1371
|
+
return;
|
|
1372
|
+
const { transform } = drawing;
|
|
1373
|
+
if (!transform)
|
|
1374
|
+
return;
|
|
1375
|
+
const { left = 0, top = 0, width = 0, height = 0 } = transform, { drawingStartX, drawingEndX, drawingStartY, drawingEndY } = {
|
|
1376
|
+
drawingStartX: left,
|
|
1377
|
+
drawingEndX: left + width,
|
|
1378
|
+
drawingStartY: top,
|
|
1379
|
+
drawingEndY: top + height
|
|
1380
|
+
};
|
|
1381
|
+
startX <= drawingStartX && drawingEndX <= endX && startY <= drawingStartY && drawingEndY <= endY && containedDrawings.push(drawing);
|
|
1382
|
+
});
|
|
1383
|
+
const redos = [], undos = [], rowOffset = toRange.startRow - fromRange.startRow, colOffset = toRange.startColumn - fromRange.startColumn, updateDrawings = containedDrawings.map((drawing) => {
|
|
1384
|
+
const oldSheetTransform = drawing.sheetTransform, sheetTransform = {
|
|
1385
|
+
to: { ...oldSheetTransform.to, row: oldSheetTransform.to.row + rowOffset, column: oldSheetTransform.to.column + colOffset },
|
|
1386
|
+
from: { ...oldSheetTransform.from, row: oldSheetTransform.from.row + rowOffset, column: oldSheetTransform.from.column + colOffset }
|
|
1387
|
+
}, transform = drawingPositionToTransform(sheetTransform, this._selectionRenderService, this._skeletonManagerService);
|
|
1388
|
+
return {
|
|
1389
|
+
unitId,
|
|
1390
|
+
subUnitId,
|
|
1391
|
+
drawingId: drawing.drawingId,
|
|
1392
|
+
transform,
|
|
1393
|
+
sheetTransform
|
|
1394
|
+
};
|
|
1395
|
+
});
|
|
1396
|
+
if (updateDrawings.length) {
|
|
1397
|
+
const updateJsonOp = this._sheetDrawingService.getBatchUpdateOp(updateDrawings), { undo, redo, objects } = updateJsonOp;
|
|
1398
|
+
redos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.UPDATE } }), undos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: undo, objects, type: DrawingApplyType.UPDATE } });
|
|
1399
|
+
}
|
|
1400
|
+
return { redos, undos };
|
|
1401
|
+
}
|
|
1409
1402
|
_moveRowInterceptor(params, type) {
|
|
1410
1403
|
const ids = this._getUnitIdAndSubUnitId(params, type);
|
|
1411
1404
|
if (ids == null)
|
|
@@ -1421,7 +1414,7 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
|
1421
1414
|
newSheetTransform = param == null ? void 0 : param.newSheetTransform, newTransform = param == null ? void 0 : param.newTransform;
|
|
1422
1415
|
} else {
|
|
1423
1416
|
const { from, to } = sheetTransform, { row: fromRow } = from, { row: toRow } = to;
|
|
1424
|
-
if (fromRow >= rowStartIndex && toRow <= rowEndIndex)
|
|
1417
|
+
if (anchorType === SheetDrawingAnchorType.Both && fromRow >= rowStartIndex && toRow <= rowEndIndex)
|
|
1425
1418
|
deleteDrawings.push({ unitId, subUnitId, drawingId });
|
|
1426
1419
|
else {
|
|
1427
1420
|
const param = this._shrinkRow(sheetTransform, transform, rowStartIndex, rowEndIndex, anchorType);
|
|
@@ -1462,7 +1455,7 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
|
1462
1455
|
newSheetTransform = param == null ? void 0 : param.newSheetTransform, newTransform = param == null ? void 0 : param.newTransform;
|
|
1463
1456
|
} else {
|
|
1464
1457
|
const { from, to } = sheetTransform, { column: fromColumn } = from, { column: toColumn } = to;
|
|
1465
|
-
if (fromColumn >= colStartIndex && toColumn <= colEndIndex)
|
|
1458
|
+
if (anchorType === SheetDrawingAnchorType.Both && fromColumn >= colStartIndex && toColumn <= colEndIndex)
|
|
1466
1459
|
deleteDrawings.push({ unitId, subUnitId, drawingId });
|
|
1467
1460
|
else {
|
|
1468
1461
|
const param = this._shrinkCol(sheetTransform, transform, colStartIndex, colEndIndex, anchorType);
|
|
@@ -1662,7 +1655,7 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
|
1662
1655
|
const params = command.params, { unitId: showUnitId, subUnitId: showSubunitId } = params, drawingMap = this._drawingManagerService.drawingManagerData, insertDrawings = [], removeDrawings = [];
|
|
1663
1656
|
Object.keys(drawingMap).forEach((unitId) => {
|
|
1664
1657
|
const subUnitMap = drawingMap[unitId];
|
|
1665
|
-
Object.keys(subUnitMap).forEach((subUnitId) => {
|
|
1658
|
+
subUnitMap != null && Object.keys(subUnitMap).forEach((subUnitId) => {
|
|
1666
1659
|
const drawingData = subUnitMap[subUnitId].data;
|
|
1667
1660
|
drawingData != null && Object.keys(drawingData).forEach((drawingId) => {
|
|
1668
1661
|
if (unitId === showUnitId && subUnitId === showSubunitId) {
|
|
@@ -1690,7 +1683,7 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
|
1690
1683
|
_refreshDrawingTransform(unitId, subUnitId, ranges) {
|
|
1691
1684
|
const drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), updateDrawings = [];
|
|
1692
1685
|
Object.keys(drawingData).forEach((drawingId) => {
|
|
1693
|
-
const drawing = drawingData[drawingId], { sheetTransform, anchorType = SheetDrawingAnchorType.Position } = drawing;
|
|
1686
|
+
const drawing = drawingData[drawingId], { sheetTransform, transform, anchorType = SheetDrawingAnchorType.Position } = drawing;
|
|
1694
1687
|
if (anchorType === SheetDrawingAnchorType.None)
|
|
1695
1688
|
return !0;
|
|
1696
1689
|
const { from, to } = sheetTransform, { row: fromRow, column: fromColumn } = from, { row: toRow, column: toColumn } = to;
|
|
@@ -1710,9 +1703,14 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
|
1710
1703
|
endColumn: toColumn
|
|
1711
1704
|
}
|
|
1712
1705
|
) || fromRow > endRow || fromColumn > endColumn) {
|
|
1706
|
+
const isPositionAnchor = anchorType === SheetDrawingAnchorType.Position, newTransform = drawingPositionToTransform(sheetTransform, this._selectionRenderService, this._skeletonManagerService);
|
|
1713
1707
|
updateDrawings.push({
|
|
1714
1708
|
...drawing,
|
|
1715
|
-
transform:
|
|
1709
|
+
transform: {
|
|
1710
|
+
...newTransform,
|
|
1711
|
+
width: isPositionAnchor ? transform == null ? void 0 : transform.width : newTransform == null ? void 0 : newTransform.width,
|
|
1712
|
+
height: isPositionAnchor ? transform == null ? void 0 : transform.height : newTransform == null ? void 0 : newTransform.height
|
|
1713
|
+
}
|
|
1716
1714
|
});
|
|
1717
1715
|
break;
|
|
1718
1716
|
}
|
|
@@ -1721,13 +1719,14 @@ let SheetDrawingTransformAffectedController = (_a4 = class extends Disposable {
|
|
|
1721
1719
|
}
|
|
1722
1720
|
}, __name(_a4, "SheetDrawingTransformAffectedController"), _a4);
|
|
1723
1721
|
SheetDrawingTransformAffectedController = __decorateClass$6([
|
|
1724
|
-
__decorateParam$6(1,
|
|
1725
|
-
__decorateParam$6(2,
|
|
1726
|
-
__decorateParam$6(3,
|
|
1727
|
-
__decorateParam$6(4, Inject(
|
|
1728
|
-
__decorateParam$6(5,
|
|
1729
|
-
__decorateParam$6(6,
|
|
1730
|
-
__decorateParam$6(7,
|
|
1722
|
+
__decorateParam$6(1, IRenderManagerService),
|
|
1723
|
+
__decorateParam$6(2, ICommandService),
|
|
1724
|
+
__decorateParam$6(3, ISheetSelectionRenderService),
|
|
1725
|
+
__decorateParam$6(4, Inject(SheetSkeletonManagerService)),
|
|
1726
|
+
__decorateParam$6(5, Inject(SheetInterceptorService)),
|
|
1727
|
+
__decorateParam$6(6, ISheetDrawingService),
|
|
1728
|
+
__decorateParam$6(7, IDrawingManagerService),
|
|
1729
|
+
__decorateParam$6(8, IUniverInstanceService)
|
|
1731
1730
|
], SheetDrawingTransformAffectedController);
|
|
1732
1731
|
var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1733
1732
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -1828,8 +1827,11 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1828
1827
|
this._drawingManagerService.add$.subscribe((params) => {
|
|
1829
1828
|
params.forEach((param) => {
|
|
1830
1829
|
var _a11, _b, _c;
|
|
1831
|
-
const { unitId, subUnitId, drawingId } = param, target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), floatDomParam = this._drawingManagerService.getDrawingByParam(param)
|
|
1832
|
-
if (floatDomParam
|
|
1830
|
+
const { unitId, subUnitId, drawingId } = param, target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), floatDomParam = this._drawingManagerService.getDrawingByParam(param);
|
|
1831
|
+
if (!floatDomParam || !target)
|
|
1832
|
+
return;
|
|
1833
|
+
const skeleton = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
|
|
1834
|
+
if (!skeleton)
|
|
1833
1835
|
return;
|
|
1834
1836
|
const { transform, drawingType, data } = floatDomParam;
|
|
1835
1837
|
if (drawingType !== DrawingTypeEnum$1.DRAWING_DOM)
|
|
@@ -1852,7 +1854,7 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1852
1854
|
height,
|
|
1853
1855
|
zIndex: this._drawingManagerService.getDrawingOrder(unitId, subUnitId).length - 1
|
|
1854
1856
|
}, rect = new Rect(rectShapeKey, imageConfig);
|
|
1855
|
-
scene.addObject(rect, DRAWING_OBJECT_LAYER_INDEX).attachTransformerTo(rect);
|
|
1857
|
+
scene.addObject(rect, DRAWING_OBJECT_LAYER_INDEX), floatDomParam.allowTransform !== !1 && scene.attachTransformerTo(rect);
|
|
1856
1858
|
const map2 = this._ensureMap(unitId, subUnitId), disposableCollection = new DisposableCollection(), initPosition = calcPosition(rect, renderObject.renderObject, skeleton.skeleton, target.worksheet), position$ = new BehaviorSubject(initPosition), info = {
|
|
1857
1859
|
dispose: disposableCollection,
|
|
1858
1860
|
rect,
|
|
@@ -1981,7 +1983,7 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1981
1983
|
});
|
|
1982
1984
|
if (!target)
|
|
1983
1985
|
throw new Error("cannot find current target!");
|
|
1984
|
-
const { unitId, subUnitId } = target, { initPosition, componentKey, data } = layer, id = propId != null ? propId : generateRandomId(), sheetTransform = this._getPosition(initPosition, unitId);
|
|
1986
|
+
const { unitId, subUnitId } = target, { initPosition, componentKey, data, allowTransform = !0 } = layer, id = propId != null ? propId : generateRandomId(), sheetTransform = this._getPosition(initPosition, unitId);
|
|
1985
1987
|
if (sheetTransform == null)
|
|
1986
1988
|
return;
|
|
1987
1989
|
this._ensureMap(unitId, subUnitId).set(id, layer);
|
|
@@ -1998,7 +2000,8 @@ let SheetCanvasFloatDomManagerService = (_a5 = class extends Disposable {
|
|
|
1998
2000
|
width: initPosition.endX - initPosition.startX,
|
|
1999
2001
|
height: initPosition.endY - initPosition.startY
|
|
2000
2002
|
},
|
|
2001
|
-
data
|
|
2003
|
+
data,
|
|
2004
|
+
allowTransform
|
|
2002
2005
|
};
|
|
2003
2006
|
return this._commandService.executeCommand(InsertSheetDrawingCommand.id, {
|
|
2004
2007
|
unitId,
|
|
@@ -2284,9 +2287,9 @@ let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
|
|
|
2284
2287
|
}
|
|
2285
2288
|
_collect(unitId, subUnitId, range) {
|
|
2286
2289
|
var _a11;
|
|
2287
|
-
const
|
|
2288
|
-
if (!
|
|
2289
|
-
const selectionRect =
|
|
2290
|
+
const skeletonManagerService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService);
|
|
2291
|
+
if (!skeletonManagerService) return;
|
|
2292
|
+
const selectionRect = skeletonManagerService.attachRangeWithCoord(range);
|
|
2290
2293
|
if (!selectionRect)
|
|
2291
2294
|
return;
|
|
2292
2295
|
const { startX, endX, startY, endY } = selectionRect, drawings = this._sheetDrawingService.getDrawingData(unitId, subUnitId), containedDrawings = [];
|
|
@@ -2324,15 +2327,15 @@ let SheetsDrawingCopyPasteController = (_a8 = class extends Disposable {
|
|
|
2324
2327
|
const { copyRange } = copyInfo;
|
|
2325
2328
|
if (!copyRange)
|
|
2326
2329
|
return { redos: [], undos: [] };
|
|
2327
|
-
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),
|
|
2328
|
-
if (!
|
|
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)
|
|
2329
2332
|
return { redos: [], undos: [] };
|
|
2330
|
-
const copyRect =
|
|
2333
|
+
const copyRect = skeletonManagerService.attachRangeWithCoord({
|
|
2331
2334
|
startRow: copyRow,
|
|
2332
2335
|
endRow: copyRow,
|
|
2333
2336
|
startColumn: copyCol,
|
|
2334
2337
|
endColumn: copyCol
|
|
2335
|
-
}), pasteRect =
|
|
2338
|
+
}), pasteRect = skeletonManagerService.attachRangeWithCoord({
|
|
2336
2339
|
startRow: pasteRow,
|
|
2337
2340
|
endRow: pasteRow,
|
|
2338
2341
|
startColumn: pasteCol,
|
|
@@ -2403,23 +2406,35 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
2403
2406
|
return kind && result && __defProp$1(target, key, result), result;
|
|
2404
2407
|
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a9;
|
|
2405
2408
|
let SheetsDrawingRenderController = (_a9 = class extends Disposable {
|
|
2406
|
-
constructor(_context, _sheetDrawingService, _drawingManagerService, _lifecycleService) {
|
|
2407
|
-
super(), this._context = _context, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._lifecycleService = _lifecycleService, this._init();
|
|
2409
|
+
constructor(_context, _sheetDrawingService, _drawingManagerService, _lifecycleService, _sheetSelectionRenderService, _sheetSkeletonManagerService) {
|
|
2410
|
+
super(), this._context = _context, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._lifecycleService = _lifecycleService, this._sheetSelectionRenderService = _sheetSelectionRenderService, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._init();
|
|
2408
2411
|
}
|
|
2409
2412
|
_init() {
|
|
2410
2413
|
this._drawingInitializeListener();
|
|
2411
2414
|
}
|
|
2412
2415
|
_drawingInitializeListener() {
|
|
2413
|
-
this.
|
|
2414
|
-
this.
|
|
2415
|
-
|
|
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);
|
|
2427
|
+
}
|
|
2416
2428
|
}
|
|
2417
2429
|
}, __name(_a9, "SheetsDrawingRenderController"), _a9);
|
|
2418
2430
|
SheetsDrawingRenderController = __decorateClass$1([
|
|
2419
2431
|
__decorateParam$1(1, ISheetDrawingService),
|
|
2420
2432
|
__decorateParam$1(2, IDrawingManagerService),
|
|
2421
|
-
__decorateParam$1(3, Inject(LifecycleService))
|
|
2433
|
+
__decorateParam$1(3, Inject(LifecycleService)),
|
|
2434
|
+
__decorateParam$1(4, Inject(ISheetSelectionRenderService)),
|
|
2435
|
+
__decorateParam$1(5, Inject(SheetSkeletonManagerService))
|
|
2422
2436
|
], SheetsDrawingRenderController);
|
|
2437
|
+
const PLUGIN_CONFIG_KEY = "sheets-drawing-ui.config", defaultPluginConfig = {};
|
|
2423
2438
|
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) => {
|
|
2424
2439
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2425
2440
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -2428,10 +2443,10 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
|
|
|
2428
2443
|
const PLUGIN_NAME = "SHEET_IMAGE_UI_PLUGIN";
|
|
2429
2444
|
var _a10;
|
|
2430
2445
|
let UniverSheetsDrawingUIPlugin = (_a10 = class extends Plugin {
|
|
2431
|
-
constructor(
|
|
2432
|
-
super();
|
|
2433
|
-
|
|
2434
|
-
|
|
2446
|
+
constructor(_config = defaultPluginConfig, _injector, _renderManagerService, _configService) {
|
|
2447
|
+
super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService, this._configService = _configService;
|
|
2448
|
+
const { menu, ...rest } = this._config;
|
|
2449
|
+
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
|
|
2435
2450
|
}
|
|
2436
2451
|
onStarting() {
|
|
2437
2452
|
this._initDependencies();
|
|
@@ -2442,9 +2457,7 @@ let UniverSheetsDrawingUIPlugin = (_a10 = class extends Plugin {
|
|
|
2442
2457
|
_initDependencies() {
|
|
2443
2458
|
[
|
|
2444
2459
|
[SheetCanvasFloatDomManagerService],
|
|
2445
|
-
[SheetDrawingUIController,
|
|
2446
|
-
useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetDrawingUIController, this._pluginConfig), "useFactory")
|
|
2447
|
-
}],
|
|
2460
|
+
[SheetDrawingUIController],
|
|
2448
2461
|
[DrawingPopupMenuController],
|
|
2449
2462
|
[SheetDrawingPrintingController],
|
|
2450
2463
|
[SheetDrawingPermissionController],
|
|
@@ -2466,8 +2479,8 @@ __publicField2(UniverSheetsDrawingUIPlugin, "pluginName", PLUGIN_NAME);
|
|
|
2466
2479
|
UniverSheetsDrawingUIPlugin = __decorateClass([
|
|
2467
2480
|
DependentOn(UniverDrawingPlugin, UniverDrawingUIPlugin, UniverSheetsDrawingPlugin),
|
|
2468
2481
|
__decorateParam(1, Inject(Injector)),
|
|
2469
|
-
__decorateParam(2,
|
|
2470
|
-
__decorateParam(3,
|
|
2482
|
+
__decorateParam(2, IRenderManagerService),
|
|
2483
|
+
__decorateParam(3, IConfigService)
|
|
2471
2484
|
], UniverSheetsDrawingUIPlugin);
|
|
2472
2485
|
export {
|
|
2473
2486
|
ClearSheetDrawingTransformerOperation,
|
|
@@ -2475,8 +2488,7 @@ export {
|
|
|
2475
2488
|
EditSheetDrawingOperation,
|
|
2476
2489
|
GroupSheetDrawingCommand,
|
|
2477
2490
|
IMAGE_MENU_ID,
|
|
2478
|
-
|
|
2479
|
-
InsertFloatImageOperation,
|
|
2491
|
+
InsertFloatImageCommand,
|
|
2480
2492
|
InsertSheetDrawingCommand,
|
|
2481
2493
|
MoveDrawingsCommand,
|
|
2482
2494
|
RemoveSheetDrawingCommand,
|