@univerjs/sheets-drawing-ui 0.2.12 → 0.2.14
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 +168 -226
- package/lib/index.css +1 -1
- package/lib/types/commands/commands/insert-image.command.d.ts +5 -0
- package/lib/types/controllers/drawing-popup-menu.controller.d.ts +1 -1
- package/lib/types/controllers/sheet-drawing-update.controller.d.ts +6 -9
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.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
|
@@ -5,11 +5,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "sym
|
|
|
5
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, DrawingTypeEnum, ArrangeTypeEnum, DRAWING_IMAGE_COUNT_LIMIT, ImageUploadStatusType, DRAWING_IMAGE_ALLOW_SIZE, getImageSize, DRAWING_IMAGE_WIDTH_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT,
|
|
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 { ISidebarService, BuiltInUIPart, IUIPartsService, ILocalFileService, IMessageService, MenuItemType, getMenuHiddenObservable, KeyCode, RibbonStartGroup, ComponentManager, IMenuManagerService, IShortcutService, CanvasFloatDomService } from "@univerjs/ui";
|
|
11
12
|
import { takeUntil, Subject, BehaviorSubject, combineLatest, map, filter, distinctUntilChanged } from "rxjs";
|
|
12
|
-
import { ISidebarService, BuiltInUIPart, IUIPartsService, IMessageService, MenuItemType, getMenuHiddenObservable, KeyCode, RibbonStartGroup, ComponentManager, IMenuManagerService, IShortcutService, CanvasFloatDomService } from "@univerjs/ui";
|
|
13
13
|
import { getSheetCommandTarget, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, InsertRowCommand, InsertColCommand, RemoveRowCommand, RemoveColCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, DeltaRowHeightCommand, SetRowHeightCommand, DeltaColumnWidthCommand, SetColWidthCommand, SetRowHiddenCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand, SetColHiddenCommand, 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";
|
|
@@ -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--)
|
|
@@ -153,18 +153,18 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
|
153
153
|
if (!drawingParam)
|
|
154
154
|
return;
|
|
155
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,
|
|
165
165
|
subUnitId,
|
|
166
166
|
drawingId
|
|
167
|
-
}])
|
|
167
|
+
}]);
|
|
168
168
|
})
|
|
169
169
|
)
|
|
170
170
|
), this.disposeWithMe(
|
|
@@ -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,34 +686,14 @@ 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,
|
|
@@ -757,15 +707,9 @@ function ImageMenuFactory(accessor) {
|
|
|
757
707
|
__name(ImageMenuFactory, "ImageMenuFactory");
|
|
758
708
|
function UploadFloatImageMenuFactory(_accessor) {
|
|
759
709
|
return {
|
|
760
|
-
id:
|
|
710
|
+
id: InsertFloatImageCommand.id,
|
|
761
711
|
title: "sheetImage.upload.float",
|
|
762
|
-
type: MenuItemType.
|
|
763
|
-
label: {
|
|
764
|
-
name: COMPONENT_UPLOAD_FILE_MENU,
|
|
765
|
-
props: {
|
|
766
|
-
type: UploadFileType.floatImage
|
|
767
|
-
}
|
|
768
|
-
},
|
|
712
|
+
type: MenuItemType.BUTTON,
|
|
769
713
|
hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_SHEET)
|
|
770
714
|
};
|
|
771
715
|
}
|
|
@@ -961,7 +905,7 @@ const MoveDrawingDownShortcutItem = {
|
|
|
961
905
|
[IMAGE_MENU_ID]: {
|
|
962
906
|
order: 3,
|
|
963
907
|
menuItemFactory: ImageMenuFactory,
|
|
964
|
-
[
|
|
908
|
+
[InsertFloatImageCommand.id]: {
|
|
965
909
|
order: 0,
|
|
966
910
|
menuItemFactory: UploadFloatImageMenuFactory
|
|
967
911
|
}
|
|
@@ -979,15 +923,14 @@ let SheetDrawingUIController = (_a3 = class extends Disposable {
|
|
|
979
923
|
}
|
|
980
924
|
_initCustomComponents() {
|
|
981
925
|
const componentManager = this._componentManager;
|
|
982
|
-
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));
|
|
983
927
|
}
|
|
984
928
|
_initMenus() {
|
|
985
929
|
this._menuManagerService.mergeMenu(menuSchema);
|
|
986
930
|
}
|
|
987
931
|
_initCommands() {
|
|
988
932
|
[
|
|
989
|
-
|
|
990
|
-
InsertCellImageOperation,
|
|
933
|
+
InsertFloatImageCommand,
|
|
991
934
|
InsertSheetDrawingCommand,
|
|
992
935
|
RemoveSheetDrawingCommand,
|
|
993
936
|
SetSheetDrawingCommand,
|
|
@@ -2545,8 +2488,7 @@ export {
|
|
|
2545
2488
|
EditSheetDrawingOperation,
|
|
2546
2489
|
GroupSheetDrawingCommand,
|
|
2547
2490
|
IMAGE_MENU_ID,
|
|
2548
|
-
|
|
2549
|
-
InsertFloatImageOperation,
|
|
2491
|
+
InsertFloatImageCommand,
|
|
2550
2492
|
InsertSheetDrawingCommand,
|
|
2551
2493
|
MoveDrawingsCommand,
|
|
2552
2494
|
RemoveSheetDrawingCommand,
|
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-upload-loading{position:absolute;height:100%;width:100%;text-align:center;background-color:rgba(var(--color-black),.5);z-index:1000;user-select:none}.univer-upload-loading-body{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background-color:rgb(var(--color-white));padding:20px 40px;display:flex;align-items:center;justify-items:center;border-radius:var(--border-radius-lg)}.univer-upload-loading-body-animation{width:30px;height:30px;border:2px solid rgb(var(--color-black));border-top-color:transparent;border-radius:100%;animation:univer-UniverCircleAnimation infinite .75s linear}.univer-upload-loading-body-text{font-size:var(--font-size-xs);color:var(--color-black);padding:10px}@keyframes univer-UniverCircleAnimation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.univer-
|
|
1
|
+
.univer-upload-loading{position:absolute;height:100%;width:100%;text-align:center;background-color:rgba(var(--color-black),.5);z-index:1000;user-select:none}.univer-upload-loading-body{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background-color:rgb(var(--color-white));padding:20px 40px;display:flex;align-items:center;justify-items:center;border-radius:var(--border-radius-lg)}.univer-upload-loading-body-animation{width:30px;height:30px;border:2px solid rgb(var(--color-black));border-top-color:transparent;border-radius:100%;animation:univer-UniverCircleAnimation infinite .75s linear}.univer-upload-loading-body-text{font-size:var(--font-size-xs);color:var(--color-black);padding:10px}@keyframes univer-UniverCircleAnimation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.univer-image-common-panel{text-align:center;padding:var(--padding-sm);font-size:var(--font-size-sm)}.univer-image-common-panel-grid{position:relative;width:100%}.univer-image-common-panel-border{border-top:1px solid rgb(var(--border-color));margin-top:20px}.univer-image-common-panel-title{color:rgb(var(--text-color-secondary));text-align:left}.univer-image-common-panel-subtitle{color:rgb(var(--text-color-primary));text-align:left}.univer-image-common-panel-row{position:relative;display:flex;justify-content:flex-start;align-items:flex-start;height:100%;margin-top:10px}.univer-image-common-panel-row-vertical{justify-content:center;align-items:center;height:36px}.univer-image-common-panel-column{width:100%}.univer-image-common-panel-column-center{display:flex;justify-content:center;align-items:center}.univer-image-common-panel-inline{display:flex;align-items:center;gap:var(--margin-xxs)}.univer-image-common-panel-span2{width:50%}.univer-image-common-panel-span3{width:33.33333333%}.univer-image-common-panel-input{width:90%}.univer-sheet-image-menu{position:absolute;height:100%;width:100%;text-align:center}.univer-sheet-image-menu-input{display:none}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IContextService, Injector, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
2
|
+
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
2
3
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
3
4
|
import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
|
|
4
|
-
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
5
5
|
import { IUIPartsService } from '@univerjs/ui';
|
|
6
6
|
export declare class DrawingPopupMenuController extends RxDisposable {
|
|
7
7
|
private _injector;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Disposable, ICommandService, IContextService, LocaleService, Workbook } from '@univerjs/core';
|
|
2
2
|
import { IDrawingManagerService, IImageIoService } from '@univerjs/drawing';
|
|
3
|
-
import { ISheetDrawingService } from '@univerjs/sheets-drawing';
|
|
4
3
|
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
4
|
+
import { ISheetDrawingService } from '@univerjs/sheets-drawing';
|
|
5
5
|
import { ISheetSelectionRenderService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
|
6
|
-
import { IMessageService } from '@univerjs/ui';
|
|
6
|
+
import { ILocalFileService, IMessageService } from '@univerjs/ui';
|
|
7
7
|
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
8
8
|
export declare class SheetDrawingUpdateController extends Disposable implements IRenderModule {
|
|
9
9
|
private readonly _context;
|
|
@@ -11,18 +11,15 @@ export declare class SheetDrawingUpdateController extends Disposable implements
|
|
|
11
11
|
private readonly _commandService;
|
|
12
12
|
private readonly _selectionRenderService;
|
|
13
13
|
private readonly _imageIoService;
|
|
14
|
+
private readonly _fileOpenerService;
|
|
14
15
|
private readonly _sheetDrawingService;
|
|
15
16
|
private readonly _drawingManagerService;
|
|
16
17
|
private readonly _contextService;
|
|
17
18
|
private readonly _messageService;
|
|
18
19
|
private readonly _localeService;
|
|
19
20
|
private readonly _workbookSelections;
|
|
20
|
-
constructor(_context: IRenderContext<Workbook>, _skeletonManagerService: SheetSkeletonManagerService, _commandService: ICommandService, _selectionRenderService: ISheetSelectionRenderService, _imageIoService: IImageIoService, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _contextService: IContextService, _messageService: IMessageService, _localeService: LocaleService, selectionManagerService: SheetsSelectionsService);
|
|
21
|
-
|
|
22
|
-
* Upload image to cell or float image
|
|
23
|
-
*/
|
|
24
|
-
private _initCommandListeners;
|
|
25
|
-
private _insertCellImage;
|
|
21
|
+
constructor(_context: IRenderContext<Workbook>, _skeletonManagerService: SheetSkeletonManagerService, _commandService: ICommandService, _selectionRenderService: ISheetSelectionRenderService, _imageIoService: IImageIoService, _fileOpenerService: ILocalFileService, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _contextService: IContextService, _messageService: IMessageService, _localeService: LocaleService, selectionManagerService: SheetsSelectionsService);
|
|
22
|
+
insertFloatImage(): Promise<boolean>;
|
|
26
23
|
private _insertFloatImage;
|
|
27
24
|
private _getUnitInfo;
|
|
28
25
|
private _getImagePosition;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -25,6 +25,6 @@ export { SetSheetDrawingCommand } from './commands/commands/set-sheet-drawing.co
|
|
|
25
25
|
export { UngroupSheetDrawingCommand } from './commands/commands/ungroup-sheet-drawing.command';
|
|
26
26
|
export { ClearSheetDrawingTransformerOperation } from './commands/operations/clear-drawing-transformer.operation';
|
|
27
27
|
export { EditSheetDrawingOperation } from './commands/operations/edit-sheet-drawing.operation';
|
|
28
|
-
export {
|
|
28
|
+
export { InsertFloatImageCommand, type IInsertImageCommandParams } from './commands/commands/insert-image.command';
|
|
29
29
|
export { SidebarSheetDrawingOperation } from './commands/operations/open-drawing-panel.operation';
|
|
30
30
|
export { IMAGE_MENU_ID } from './views/menu/image.menu';
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class UniverSheetsDrawingUIPlugin extends Plugin {
|
|
|
8
8
|
private readonly _configService;
|
|
9
9
|
static type: UniverInstanceType;
|
|
10
10
|
static pluginName: string;
|
|
11
|
-
constructor(_config: Partial<IUniverSheetsDrawingUIConfig
|
|
11
|
+
constructor(_config: Partial<IUniverSheetsDrawingUIConfig> | undefined, _injector: Injector, _renderManagerService: IRenderManagerService, _configService: IConfigService);
|
|
12
12
|
onStarting(): void;
|
|
13
13
|
onRendered(): void;
|
|
14
14
|
private _initDependencies;
|