@univerjs/sheets-drawing-ui 0.2.9 → 0.2.11
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 +12 -29
- package/lib/types/controllers/render-controllers/sheet-drawing.render-controller.d.ts +3 -1
- package/lib/types/controllers/sheet-drawing-update.controller.d.ts +0 -2
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +12 -0
- package/lib/umd/index.js +1 -1
- package/package.json +21 -21
package/lib/es/index.js
CHANGED
|
@@ -121,7 +121,7 @@ let DrawingPopupMenuController = (_a = class extends RxDisposable {
|
|
|
121
121
|
this._renderManagerService.has(unitId) && !this._initImagePopupMenu.has(unitId) && (this._popupMenuListener(unitId), this._initImagePopupMenu.add(unitId));
|
|
122
122
|
}
|
|
123
123
|
_hasCropObject(scene) {
|
|
124
|
-
const objects = scene.
|
|
124
|
+
const objects = scene.getAllObjectsByOrder();
|
|
125
125
|
for (const object of objects)
|
|
126
126
|
if (object instanceof ImageCropperObject)
|
|
127
127
|
return !0;
|
|
@@ -473,7 +473,7 @@ let SheetDrawingUpdateController = (_a2 = class extends Disposable {
|
|
|
473
473
|
constructor(_context, _skeletonManagerService, _commandService, _selectionRenderService, _imageIoService, _sheetDrawingService, _drawingManagerService, _contextService, _messageService, _localeService, selectionManagerService) {
|
|
474
474
|
super();
|
|
475
475
|
__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._initCommandListeners(), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener()
|
|
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._initCommandListeners(), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
|
|
477
477
|
}
|
|
478
478
|
/**
|
|
479
479
|
* Upload image to cell or float image
|
|
@@ -648,24 +648,6 @@ let SheetDrawingUpdateController = (_a2 = class extends Disposable {
|
|
|
648
648
|
})
|
|
649
649
|
);
|
|
650
650
|
}
|
|
651
|
-
_drawingAddListener() {
|
|
652
|
-
this.disposeWithMe(
|
|
653
|
-
this._sheetDrawingService.add$.subscribe((params) => {
|
|
654
|
-
this._registerDrawing(params);
|
|
655
|
-
})
|
|
656
|
-
);
|
|
657
|
-
}
|
|
658
|
-
_registerDrawing(params) {
|
|
659
|
-
params.forEach((param) => {
|
|
660
|
-
const drawingParam = this._sheetDrawingService.getDrawingByParam(param);
|
|
661
|
-
if (drawingParam == null || drawingParam.unitId !== this._context.unitId)
|
|
662
|
-
return;
|
|
663
|
-
const { sheetTransform } = drawingParam;
|
|
664
|
-
drawingParam.transform = drawingPositionToTransform(sheetTransform, this._selectionRenderService, this._skeletonManagerService);
|
|
665
|
-
});
|
|
666
|
-
const unitId = params[0].unitId;
|
|
667
|
-
this._drawingManagerService.registerDrawingData(unitId, this._sheetDrawingService.getDrawingDataForUnit(unitId)), this._drawingManagerService.initializeNotification(unitId);
|
|
668
|
-
}
|
|
669
651
|
}, __name(_a2, "SheetDrawingUpdateController"), _a2);
|
|
670
652
|
SheetDrawingUpdateController = __decorateClass$8([
|
|
671
653
|
__decorateParam$8(1, Inject(SheetSkeletonManagerService)),
|
|
@@ -2148,7 +2130,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
|
2148
2130
|
const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject = this._renderManagerService.getRenderById(unitId2), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
2149
2131
|
if (scene == null)
|
|
2150
2132
|
return;
|
|
2151
|
-
scene.
|
|
2133
|
+
scene.getAllObjectsByOrder().forEach((object) => {
|
|
2152
2134
|
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
|
|
2153
2135
|
});
|
|
2154
2136
|
}
|
|
@@ -2177,7 +2159,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
|
2177
2159
|
const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject = this._renderManagerService.getRenderById(unitId2), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
2178
2160
|
if (scene == null)
|
|
2179
2161
|
return;
|
|
2180
|
-
scene.
|
|
2162
|
+
scene.getAllObjectsByOrder().forEach((object) => {
|
|
2181
2163
|
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.detachTransformerFrom(object);
|
|
2182
2164
|
});
|
|
2183
2165
|
}
|
|
@@ -2205,7 +2187,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
|
2205
2187
|
).subscribe({
|
|
2206
2188
|
next: /* @__PURE__ */ __name((permission) => {
|
|
2207
2189
|
initialViewPermission = permission, this._drawingManagerService.setDrawingVisible(permission);
|
|
2208
|
-
const objects = scene.
|
|
2190
|
+
const objects = scene.getAllObjectsByOrder(), drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
|
|
2209
2191
|
permission ? this._drawingManagerService.addNotification(drawingDataValues) : (objects.forEach((object) => {
|
|
2210
2192
|
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
|
|
2211
2193
|
}), transformer.clearSelectedObjects());
|
|
@@ -2244,7 +2226,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
|
2244
2226
|
).subscribe({
|
|
2245
2227
|
next: /* @__PURE__ */ __name((permission) => {
|
|
2246
2228
|
initialEditPermission = permission, this._drawingManagerService.setDrawingEditable(permission);
|
|
2247
|
-
const objects = scene.
|
|
2229
|
+
const objects = scene.getAllObjectsByOrder(), drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
|
|
2248
2230
|
permission ? (objects.forEach((object) => {
|
|
2249
2231
|
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.attachTransformerTo(object);
|
|
2250
2232
|
}), this._drawingManagerService.addNotification(drawingDataValues)) : (objects.forEach((object) => {
|
|
@@ -2260,7 +2242,7 @@ let SheetDrawingPermissionController = (_a7 = class extends Disposable {
|
|
|
2260
2242
|
const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject2 = this._renderManagerService.getRenderById(unitId2), scene2 = renderObject2 == null ? void 0 : renderObject2.scene;
|
|
2261
2243
|
if (scene2 == null)
|
|
2262
2244
|
return;
|
|
2263
|
-
this._drawingManagerService.setDrawingEditable(!0), scene2.
|
|
2245
|
+
this._drawingManagerService.setDrawingEditable(!0), scene2.getAllObjectsByOrder().forEach((object) => {
|
|
2264
2246
|
object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene2.detachTransformerFrom(object);
|
|
2265
2247
|
});
|
|
2266
2248
|
}, "complete")
|
|
@@ -2421,21 +2403,22 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
2421
2403
|
return kind && result && __defProp$1(target, key, result), result;
|
|
2422
2404
|
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a9;
|
|
2423
2405
|
let SheetsDrawingRenderController = (_a9 = class extends Disposable {
|
|
2424
|
-
constructor(_context, _sheetDrawingService, _lifecycleService) {
|
|
2425
|
-
super(), this._context = _context, this._sheetDrawingService = _sheetDrawingService, this._lifecycleService = _lifecycleService, this._init();
|
|
2406
|
+
constructor(_context, _sheetDrawingService, _drawingManagerService, _lifecycleService) {
|
|
2407
|
+
super(), this._context = _context, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._lifecycleService = _lifecycleService, this._init();
|
|
2426
2408
|
}
|
|
2427
2409
|
_init() {
|
|
2428
2410
|
this._drawingInitializeListener();
|
|
2429
2411
|
}
|
|
2430
2412
|
_drawingInitializeListener() {
|
|
2431
2413
|
this._lifecycleService.lifecycle$.pipe(filter((e) => e === LifecycleStages.Steady), first()).subscribe(() => {
|
|
2432
|
-
this._context.type === UniverInstanceType.UNIVER_SHEET && this._sheetDrawingService.initializeNotification(this._context.unitId);
|
|
2414
|
+
this._context.type === UniverInstanceType.UNIVER_SHEET && (this._sheetDrawingService.initializeNotification(this._context.unitId), this._drawingManagerService.initializeNotification(this._context.unitId));
|
|
2433
2415
|
});
|
|
2434
2416
|
}
|
|
2435
2417
|
}, __name(_a9, "SheetsDrawingRenderController"), _a9);
|
|
2436
2418
|
SheetsDrawingRenderController = __decorateClass$1([
|
|
2437
2419
|
__decorateParam$1(1, ISheetDrawingService),
|
|
2438
|
-
__decorateParam$1(2,
|
|
2420
|
+
__decorateParam$1(2, IDrawingManagerService),
|
|
2421
|
+
__decorateParam$1(3, Inject(LifecycleService))
|
|
2439
2422
|
], SheetsDrawingRenderController);
|
|
2440
2423
|
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) => {
|
|
2441
2424
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Disposable, LifecycleService } from '@univerjs/core';
|
|
2
|
+
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
2
3
|
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
3
4
|
import { ISheetDrawingService } from '@univerjs/sheets-drawing';
|
|
4
5
|
export declare class SheetsDrawingRenderController extends Disposable implements IRenderModule {
|
|
5
6
|
private _context;
|
|
6
7
|
private readonly _sheetDrawingService;
|
|
8
|
+
private readonly _drawingManagerService;
|
|
7
9
|
private _lifecycleService;
|
|
8
|
-
constructor(_context: IRenderContext, _sheetDrawingService: ISheetDrawingService, _lifecycleService: LifecycleService);
|
|
10
|
+
constructor(_context: IRenderContext, _sheetDrawingService: ISheetDrawingService, _drawingManagerService: IDrawingManagerService, _lifecycleService: LifecycleService);
|
|
9
11
|
private _init;
|
|
10
12
|
private _drawingInitializeListener;
|
|
11
13
|
}
|
|
@@ -4,10 +4,22 @@ import { IBoundRectNoAngle, Scene, SpreadsheetSkeleton, IRenderManagerService }
|
|
|
4
4
|
import { ISheetDrawingService } from '@univerjs/sheets-drawing';
|
|
5
5
|
import { CanvasFloatDomService } from '@univerjs/ui';
|
|
6
6
|
export interface ICanvasFloatDom {
|
|
7
|
+
/**
|
|
8
|
+
* whether allow transform float-dom
|
|
9
|
+
*/
|
|
7
10
|
allowTransform: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* initial position of float-dom
|
|
13
|
+
*/
|
|
8
14
|
initPosition: IPosition;
|
|
9
15
|
componentKey: string;
|
|
16
|
+
/**
|
|
17
|
+
* unitId of workbook, if not set, will use current workbook
|
|
18
|
+
*/
|
|
10
19
|
unitId?: string;
|
|
20
|
+
/**
|
|
21
|
+
* subUnitId of worksheet, if not set, will use current worksheet
|
|
22
|
+
*/
|
|
11
23
|
subUnitId?: string;
|
|
12
24
|
/**
|
|
13
25
|
* @deprecated Please use `data`. for saving to disk, everything add to float-dom must be serializable.
|