@univerjs/sheets-drawing-ui 0.6.4 → 0.6.5-nightly.202503131607
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 +1203 -1243
- package/lib/types/controllers/sheet-cell-image.controller.d.ts +2 -5
- package/lib/types/facade/f-worksheet.d.ts +39 -26
- package/lib/umd/index.js +1 -1
- package/package.json +17 -17
- package/LICENSE +0 -176
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellData, Nullable, Disposable, ICommandService, Injector
|
|
1
|
+
import { ICellData, Nullable, Disposable, ICommandService, Injector } from '@univerjs/core';
|
|
2
2
|
import { ISheetLocationBase, SheetInterceptorService } from '@univerjs/sheets';
|
|
3
3
|
import { DocDrawingController } from '@univerjs/docs-drawing';
|
|
4
4
|
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
@@ -7,15 +7,12 @@ export declare function resizeImageByCell(injector: Injector, location: ISheetLo
|
|
|
7
7
|
export declare class SheetCellImageController extends Disposable {
|
|
8
8
|
private readonly _commandService;
|
|
9
9
|
private readonly _sheetInterceptorService;
|
|
10
|
-
private readonly _univerInstanceService;
|
|
11
10
|
private readonly _injector;
|
|
12
11
|
private readonly _drawingManagerService;
|
|
13
12
|
private readonly _docDrawingController;
|
|
14
13
|
private readonly _editorBridgeService;
|
|
15
|
-
constructor(_commandService: ICommandService, _sheetInterceptorService: SheetInterceptorService,
|
|
14
|
+
constructor(_commandService: ICommandService, _sheetInterceptorService: SheetInterceptorService, _injector: Injector, _drawingManagerService: IDrawingManagerService, _docDrawingController: DocDrawingController, _editorBridgeService: IEditorBridgeService);
|
|
16
15
|
private _initDisableEdit;
|
|
17
|
-
private _initHandleResize;
|
|
18
16
|
private _handleInitEditor;
|
|
19
|
-
private _handleWriteCell;
|
|
20
17
|
private _initCellContentInterceptor;
|
|
21
18
|
}
|
|
@@ -17,7 +17,7 @@ export interface IFWorksheetLegacy {
|
|
|
17
17
|
* @param {string} [id] - The float dom id, if not given will be auto generated.
|
|
18
18
|
* @returns float dom id and dispose function
|
|
19
19
|
* @example
|
|
20
|
-
* ```
|
|
20
|
+
* ```tsx
|
|
21
21
|
* const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
22
22
|
*
|
|
23
23
|
* // You should register components at an appropriate time (e.g., when Univer is loaded)
|
|
@@ -50,7 +50,7 @@ export interface IFWorksheetLegacy {
|
|
|
50
50
|
* },
|
|
51
51
|
* });
|
|
52
52
|
*
|
|
53
|
-
* // Remove the floating DOM
|
|
53
|
+
* // Remove the floating DOM after 2 seconds
|
|
54
54
|
* setTimeout(() => {
|
|
55
55
|
* disposeable?.dispose();
|
|
56
56
|
* }, 2000);
|
|
@@ -68,7 +68,7 @@ export interface IFWorksheetLegacy {
|
|
|
68
68
|
* @param {string} [id] - The float dom id, if not given will be auto generated
|
|
69
69
|
* @returns float dom id and dispose function
|
|
70
70
|
* @example
|
|
71
|
-
* ```
|
|
71
|
+
* ```tsx
|
|
72
72
|
* const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
73
73
|
*
|
|
74
74
|
* // Register a range loading component
|
|
@@ -95,9 +95,10 @@ export interface IFWorksheetLegacy {
|
|
|
95
95
|
* univerAPI.registerComponent('RangeLoading', RangeLoading);
|
|
96
96
|
*
|
|
97
97
|
* // Add the range loading component covering the range A1:C3
|
|
98
|
-
* const
|
|
99
|
-
* const disposeable = fWorksheet.addFloatDomToRange(
|
|
98
|
+
* const fRange = fWorksheet.getRange('A1:C3');
|
|
99
|
+
* const disposeable = fWorksheet.addFloatDomToRange(fRange, { componentKey: 'RangeLoading' }, {}, 'myRangeLoading');
|
|
100
100
|
*
|
|
101
|
+
* // Remove the floating DOM after 2 seconds
|
|
101
102
|
* setTimeout(() => {
|
|
102
103
|
* disposeable?.dispose();
|
|
103
104
|
* }, 2000);
|
|
@@ -131,15 +132,20 @@ export interface IFWorksheetLegacy {
|
|
|
131
132
|
* univerAPI.registerComponent('FloatButton', FloatButton);
|
|
132
133
|
*
|
|
133
134
|
* // Add the float button to the range A5:C7, position is start from A5 cell, and width is 100px, height is 30px, margin is 100% of range width and height
|
|
134
|
-
* const
|
|
135
|
-
* const disposeable2 = fWorksheet.addFloatDomToRange(
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
135
|
+
* const fRange2 = fWorksheet.getRange('A5:C7');
|
|
136
|
+
* const disposeable2 = fWorksheet.addFloatDomToRange(
|
|
137
|
+
* fRange2,
|
|
138
|
+
* {
|
|
139
|
+
* componentKey: 'FloatButton',
|
|
140
|
+
* },
|
|
141
|
+
* {
|
|
142
|
+
* width: 100,
|
|
143
|
+
* height: 30,
|
|
144
|
+
* marginX: '100%', // margin percent to range width, or pixel
|
|
145
|
+
* marginY: '100%'
|
|
146
|
+
* },
|
|
147
|
+
* 'myFloatButton'
|
|
148
|
+
* );
|
|
143
149
|
* ```
|
|
144
150
|
*/
|
|
145
151
|
addFloatDomToRange(range: FRange, layer: Partial<IFICanvasFloatDom>, domLayout: Partial<IDOMAnchor>, id?: string): Nullable<{
|
|
@@ -185,18 +191,23 @@ export interface IFWorksheetLegacy {
|
|
|
185
191
|
* univerAPI.registerComponent('FloatButton', FloatButton);
|
|
186
192
|
*
|
|
187
193
|
* // Add the float button to the column D header, position is right align, width is 100px, height is 30px, margin is 0
|
|
188
|
-
* const disposeable = fWorksheet.addFloatDomToColumnHeader(
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
194
|
+
* const disposeable = fWorksheet.addFloatDomToColumnHeader(
|
|
195
|
+
* 3,
|
|
196
|
+
* {
|
|
197
|
+
* componentKey: 'FloatButton',
|
|
198
|
+
* allowTransform: false,
|
|
199
|
+
* },
|
|
200
|
+
* {
|
|
201
|
+
* width: 100,
|
|
202
|
+
* height: 30,
|
|
203
|
+
* marginX: 0,
|
|
204
|
+
* marginY: 0,
|
|
205
|
+
* horizonOffsetAlign: 'right',
|
|
206
|
+
* },
|
|
207
|
+
* 'myFloatButton'
|
|
208
|
+
* );
|
|
198
209
|
*
|
|
199
|
-
* // Remove the float button
|
|
210
|
+
* // Remove the float button after 2 seconds
|
|
200
211
|
* setTimeout(() => {
|
|
201
212
|
* disposeable?.dispose();
|
|
202
213
|
* }, 2000);
|
|
@@ -314,6 +325,8 @@ export interface IFWorksheetLegacy {
|
|
|
314
325
|
* ```ts
|
|
315
326
|
* const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
316
327
|
* const image = fWorksheet.getImages()[0];
|
|
328
|
+
*
|
|
329
|
+
* // Delete the first image of the sheet
|
|
317
330
|
* fWorksheet.deleteImages([image]);
|
|
318
331
|
* ```
|
|
319
332
|
*/
|
|
@@ -337,7 +350,7 @@ export interface IFWorksheetLegacy {
|
|
|
337
350
|
* .buildAsync();
|
|
338
351
|
* fWorksheet.insertImages([image]);
|
|
339
352
|
*
|
|
340
|
-
* // update the image width to 100px and height to 50px
|
|
353
|
+
* // update the image width to 100px and height to 50px after 4 seconds
|
|
341
354
|
* setTimeout(async () => {
|
|
342
355
|
* const imageBuilder = fWorksheet.getImageById(image.drawingId).toBuilder();
|
|
343
356
|
* const newImage = await imageBuilder.setWidth(100).setHeight(50).buildAsync();
|