@univerjs/sheets-drawing-ui 0.19.0 → 0.20.0

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.
Files changed (30) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +2 -2
  3. package/lib/es/facade.js +1 -1
  4. package/lib/es/index.js +2 -2
  5. package/lib/facade.js +1 -1
  6. package/lib/index.js +2 -2
  7. package/lib/types/controllers/render-controllers/sheet-drawing.render-controller.d.ts +3 -4
  8. package/lib/types/controllers/sheet-drawing-copy-paste.controller.d.ts +3 -1
  9. package/lib/types/controllers/sheet-drawing-group-copy-paste.controller.d.ts +3 -1
  10. package/lib/types/controllers/sheet-drawing-transform-affected.controller.d.ts +5 -6
  11. package/lib/types/controllers/sheet-drawing-update.controller.d.ts +5 -4
  12. package/lib/types/controllers/sheet-drawing.controller.d.ts +1 -5
  13. package/lib/types/facade/f-event.d.ts +24 -261
  14. package/lib/types/facade/f-range.d.ts +3 -3
  15. package/lib/types/facade/f-univer.d.ts +3 -4
  16. package/lib/types/facade/f-worksheet.d.ts +4 -211
  17. package/lib/types/facade/index.d.ts +0 -4
  18. package/lib/types/index.d.ts +0 -7
  19. package/lib/umd/facade.js +1 -1
  20. package/lib/umd/index.js +2 -2
  21. package/package.json +13 -13
  22. package/lib/types/basics/transform-position.d.ts +0 -32
  23. package/lib/types/commands/commands/insert-sheet-drawing.command.d.ts +0 -20
  24. package/lib/types/commands/commands/interfaces.d.ts +0 -35
  25. package/lib/types/commands/commands/remove-sheet-drawing.command.d.ts +0 -20
  26. package/lib/types/commands/commands/set-drawing-arrange.command.d.ts +0 -25
  27. package/lib/types/commands/commands/set-sheet-drawing.command.d.ts +0 -20
  28. package/lib/types/commands/operations/clear-drawing-transformer.operation.d.ts +0 -17
  29. package/lib/types/facade/f-enum.d.ts +0 -38
  30. package/lib/types/facade/f-over-grid-image.d.ts +0 -603
@@ -1,603 +0,0 @@
1
- /**
2
- * Copyright 2023-present DreamNum Co., Ltd.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { IRotationSkewFlipTransform, ISize } from '@univerjs/core';
17
- import type { ICellOverGridPosition } from '@univerjs/sheets';
18
- import type { ISheetImage, SheetDrawingAnchorType } from '@univerjs/sheets-drawing';
19
- import { DrawingTypeEnum, ICommandService, ImageSourceType, Injector } from '@univerjs/core';
20
- import { FBase } from '@univerjs/core/facade';
21
- export interface IFOverGridImage extends Omit<ISheetImage, 'sheetTransform' | 'transform'>, ICellOverGridPosition, IRotationSkewFlipTransform, Required<ISize> {
22
- }
23
- /**
24
- * @hideconstructor
25
- */
26
- export declare class FOverGridImageBuilder {
27
- protected readonly _injector: Injector;
28
- private _image;
29
- constructor(unitId: string, subUnitId: string, _injector: Injector);
30
- /**
31
- * Set the initial image configuration for the image builder.
32
- * @param {ISheetImage} image - The image configuration
33
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
34
- * @example
35
- * ```ts
36
- * // create a new image builder and set initial image configuration.
37
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell.
38
- * const fWorkbook = univerAPI.getActiveWorkbook();
39
- * const fWorksheet = fWorkbook.getActiveSheet();
40
- * const image = await fWorksheet.newOverGridImage()
41
- * .setImage({
42
- * drawingId: '123456',
43
- * drawingType: univerAPI.Enum.DrawingType.DRAWING_IMAGE,
44
- * imageSourceType: univerAPI.Enum.ImageSourceType.BASE64,
45
- * source: 'https://avatars.githubusercontent.com/u/61444807?s=48&v=4',
46
- * unitId: fWorkbook.getId(),
47
- * subUnitId: fWorksheet.getSheetId(),
48
- * })
49
- * .setColumn(5)
50
- * .setRow(5)
51
- * .buildAsync();
52
- * fWorksheet.insertImages([image]);
53
- * ```
54
- */
55
- setImage(image: ISheetImage): FOverGridImageBuilder;
56
- /**
57
- * Set the source of the image.
58
- * @param {string} source - The source of the image
59
- * @param {ImageSourceType} [sourceType] - The source type of the image, default is URL
60
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
61
- * @example
62
- * ```ts
63
- * // create a new image builder and set image source.
64
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell.
65
- * const fWorkbook = univerAPI.getActiveWorkbook();
66
- * const fWorksheet = fWorkbook.getActiveSheet();
67
- * const image = await fWorksheet.newOverGridImage()
68
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
69
- * .setColumn(5)
70
- * .setRow(5)
71
- * .buildAsync();
72
- * fWorksheet.insertImages([image]);
73
- * ```
74
- */
75
- setSource(source: string): FOverGridImageBuilder;
76
- setSource(source: string, sourceType?: ImageSourceType): FOverGridImageBuilder;
77
- /**
78
- * Get the source of the image
79
- * @returns {string} The source of the image
80
- * @example
81
- * ```ts
82
- * const fWorkbook = univerAPI.getActiveWorkbook();
83
- * const fWorksheet = fWorkbook.getActiveSheet();
84
- * const images = fWorksheet.getImages();
85
- * images.forEach((image) => {
86
- * console.log(image, image.toBuilder().getSource());
87
- * });
88
- * ```
89
- */
90
- getSource(): string;
91
- /**
92
- * Get the source type of the image
93
- * @returns {ImageSourceType} The source type of the image
94
- * @example
95
- * ```ts
96
- * const fWorkbook = univerAPI.getActiveWorkbook();
97
- * const fWorksheet = fWorkbook.getActiveSheet();
98
- * const images = fWorksheet.getImages();
99
- * images.forEach((image) => {
100
- * console.log(image, image.toBuilder().getSourceType());
101
- * });
102
- * ```
103
- */
104
- getSourceType(): ImageSourceType;
105
- /**
106
- * Set the horizontal position of the image
107
- * @param {number} column - The column index of the image start position, start at 0
108
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
109
- * @example
110
- * ```ts
111
- * // create a new image builder and set image source.
112
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell.
113
- * const fWorkbook = univerAPI.getActiveWorkbook();
114
- * const fWorksheet = fWorkbook.getActiveSheet();
115
- * const image = await fWorksheet.newOverGridImage()
116
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
117
- * .setColumn(5)
118
- * .setRow(5)
119
- * .buildAsync();
120
- * fWorksheet.insertImages([image]);
121
- * ```
122
- */
123
- setColumn(column: number): FOverGridImageBuilder;
124
- /**
125
- * Set the vertical position of the image
126
- * @param {number} row - The row index of the image start position, start at 0
127
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
128
- * @example
129
- * ```ts
130
- * // create a new image builder and set image source.
131
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell.
132
- * const fWorkbook = univerAPI.getActiveWorkbook();
133
- * const fWorksheet = fWorkbook.getActiveSheet();
134
- * const image = await fWorksheet.newOverGridImage()
135
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
136
- * .setColumn(5)
137
- * .setRow(5)
138
- * .buildAsync();
139
- * fWorksheet.insertImages([image]);
140
- * ```
141
- */
142
- setRow(row: number): FOverGridImageBuilder;
143
- /**
144
- * Set the horizontal offset of the image
145
- * @param {number} offset - The column offset of the image start position, pixel unit
146
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
147
- * @example
148
- * ```ts
149
- * // create a new image builder and set image source.
150
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell and horizontal offset is 10px.
151
- * const fWorkbook = univerAPI.getActiveWorkbook();
152
- * const fWorksheet = fWorkbook.getActiveSheet();
153
- * const image = await fWorksheet.newOverGridImage()
154
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
155
- * .setColumn(5)
156
- * .setRow(5)
157
- * .setColumnOffset(10)
158
- * .buildAsync();
159
- * fWorksheet.insertImages([image]);
160
- * ```
161
- */
162
- setColumnOffset(offset: number): FOverGridImageBuilder;
163
- /**
164
- * Set the vertical offset of the image
165
- * @param {number} offset - The row offset of the image start position, pixel unit
166
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
167
- * @example
168
- * ```ts
169
- * // create a new image builder and set image source.
170
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell and vertical offset is 10px.
171
- * const fWorkbook = univerAPI.getActiveWorkbook();
172
- * const fWorksheet = fWorkbook.getActiveSheet();
173
- * const image = await fWorksheet.newOverGridImage()
174
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
175
- * .setColumn(5)
176
- * .setRow(5)
177
- * .setRowOffset(10)
178
- * .buildAsync();
179
- * fWorksheet.insertImages([image]);
180
- * ```
181
- */
182
- setRowOffset(offset: number): FOverGridImageBuilder;
183
- /**
184
- * Set the width of the image
185
- * @param {number} width - The width of the image, pixel unit
186
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
187
- * @example
188
- * ```ts
189
- * // create a new image builder and set image source.
190
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell, width is 120px and height is 50px.
191
- * const fWorkbook = univerAPI.getActiveWorkbook();
192
- * const fWorksheet = fWorkbook.getActiveSheet();
193
- * const image = await fWorksheet.newOverGridImage()
194
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
195
- * .setColumn(5)
196
- * .setRow(5)
197
- * .setWidth(120)
198
- * .setHeight(50)
199
- * .buildAsync();
200
- * fWorksheet.insertImages([image]);
201
- * ```
202
- */
203
- setWidth(width: number): FOverGridImageBuilder;
204
- /**
205
- * Set the height of the image
206
- * @param {number} height - The height of the image, pixel unit
207
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
208
- * @example
209
- * ```ts
210
- * // create a new image builder and set image source.
211
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell, width is 120px and height is 50px.
212
- * const fWorkbook = univerAPI.getActiveWorkbook();
213
- * const fWorksheet = fWorkbook.getActiveSheet();
214
- * const image = await fWorksheet.newOverGridImage()
215
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
216
- * .setColumn(5)
217
- * .setRow(5)
218
- * .setWidth(120)
219
- * .setHeight(50)
220
- * .buildAsync();
221
- * fWorksheet.insertImages([image]);
222
- * ```
223
- */
224
- setHeight(height: number): FOverGridImageBuilder;
225
- /**
226
- * Set the anchor type of the image, whether the position and size change with the cell
227
- * @param {SheetDrawingAnchorType} anchorType - The anchor type of the image
228
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
229
- * @example
230
- * ```ts
231
- * const fWorkbook = univerAPI.getActiveWorkbook();
232
- * const fWorksheet = fWorkbook.getActiveSheet();
233
- *
234
- * // image1 position is start from A6 cell, anchor type is Position.
235
- * // Only the position of the drawing follows the cell changes. When rows or columns are inserted or deleted, the position of the drawing changes, but the size remains the same.
236
- * const image1 = await fWorksheet.newOverGridImage()
237
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
238
- * .setColumn(0)
239
- * .setRow(5)
240
- * .setAnchorType(univerAPI.Enum.SheetDrawingAnchorType.Position)
241
- * .buildAsync();
242
- *
243
- * // image2 position is start from C6 cell, anchor type is Both.
244
- * // The size and position of the drawing follow the cell changes. When rows or columns are inserted or deleted, the size and position of the drawing change accordingly.
245
- * const image2 = await fWorksheet.newOverGridImage()
246
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
247
- * .setColumn(2)
248
- * .setRow(5)
249
- * .setAnchorType(univerAPI.Enum.SheetDrawingAnchorType.Both)
250
- * .buildAsync();
251
- *
252
- * // image3 position is start from E6 cell, anchor type is None.
253
- * // The size and position of the drawing do not follow the cell changes. When rows or columns are inserted or deleted, the position and size of the drawing remain unchanged.
254
- * const image3 = await fWorksheet.newOverGridImage()
255
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
256
- * .setColumn(4)
257
- * .setRow(5)
258
- * .setAnchorType(univerAPI.Enum.SheetDrawingAnchorType.None)
259
- * .buildAsync();
260
- *
261
- * // insert images into the sheet
262
- * fWorksheet.insertImages([image1, image2, image3]);
263
- *
264
- * // after 2 seconds, set the row height of the 5th row to 100px and insert a row before the 5th row.
265
- * // then observe the position and size changes of the images.
266
- * setTimeout(() => {
267
- * fWorksheet.setRowHeight(5, 100).insertRowBefore(5);
268
- * }, 2000);
269
- * ```
270
- */
271
- setAnchorType(anchorType: SheetDrawingAnchorType): FOverGridImageBuilder;
272
- /**
273
- * Set the cropping region of the image by defining the top edges, thereby displaying the specific part of the image you want.
274
- * @param {number} top - The number of pixels to crop from the top of the image
275
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
276
- * @example
277
- * ```ts
278
- * // create a new image builder and set image source.
279
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell, top crop is 10px.
280
- * const fWorkbook = univerAPI.getActiveWorkbook();
281
- * const fWorksheet = fWorkbook.getActiveSheet();
282
- * const image = await fWorksheet.newOverGridImage()
283
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
284
- * .setColumn(5)
285
- * .setRow(5)
286
- * .setCropTop(10)
287
- * .buildAsync();
288
- * fWorksheet.insertImages([image]);
289
- * ```
290
- */
291
- setCropTop(top: number): FOverGridImageBuilder;
292
- /**
293
- * Set the cropping region of the image by defining the left edges, thereby displaying the specific part of the image you want.
294
- * @param {number} left - The number of pixels to crop from the left side of the image
295
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
296
- * @example
297
- * ```ts
298
- * // create a new image builder and set image source.
299
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell, left crop is 10px.
300
- * const fWorkbook = univerAPI.getActiveWorkbook();
301
- * const fWorksheet = fWorkbook.getActiveSheet();
302
- * const image = await fWorksheet.newOverGridImage()
303
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
304
- * .setColumn(5)
305
- * .setRow(5)
306
- * .setCropLeft(10)
307
- * .buildAsync();
308
- * fWorksheet.insertImages([image]);
309
- * ```
310
- */
311
- setCropLeft(left: number): FOverGridImageBuilder;
312
- /**
313
- * Set the cropping region of the image by defining the bottom edges, thereby displaying the specific part of the image you want.
314
- * @param {number} bottom - The number of pixels to crop from the bottom of the image
315
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
316
- * @example
317
- * ```ts
318
- * // create a new image builder and set image source.
319
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell, bottom crop is 10px.
320
- * const fWorkbook = univerAPI.getActiveWorkbook();
321
- * const fWorksheet = fWorkbook.getActiveSheet();
322
- * const image = await fWorksheet.newOverGridImage()
323
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
324
- * .setColumn(5)
325
- * .setRow(5)
326
- * .setCropBottom(10)
327
- * .buildAsync();
328
- * fWorksheet.insertImages([image]);
329
- * ```
330
- */
331
- setCropBottom(bottom: number): FOverGridImageBuilder;
332
- /**
333
- * Set the cropping region of the image by defining the right edges, thereby displaying the specific part of the image you want.
334
- * @param {number} right - The number of pixels to crop from the right side of the image
335
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
336
- * @example
337
- * ```ts
338
- * // create a new image builder and set image source.
339
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell, right crop is 10px.
340
- * const fWorkbook = univerAPI.getActiveWorkbook();
341
- * const fWorksheet = fWorkbook.getActiveSheet();
342
- * const image = await fWorksheet.newOverGridImage()
343
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
344
- * .setColumn(5)
345
- * .setRow(5)
346
- * .setCropRight(10)
347
- * .buildAsync();
348
- * fWorksheet.insertImages([image]);
349
- * ```
350
- */
351
- setCropRight(right: number): FOverGridImageBuilder;
352
- private _initializeSrcRect;
353
- /**
354
- * Set the rotation angle of the image
355
- * @param {number} angle - Degree of rotation of the image, for example, 90, 180, 270, etc.
356
- * @returns {FOverGridImageBuilder} The `FOverGridImageBuilder` for chaining
357
- * @example
358
- * ```ts
359
- * // create a new image builder and set image source.
360
- * // then build `ISheetImage` and insert it into the sheet, position is start from F6 cell, rotate 90 degrees.
361
- * const fWorkbook = univerAPI.getActiveWorkbook();
362
- * const fWorksheet = fWorkbook.getActiveSheet();
363
- * const image = await fWorksheet.newOverGridImage()
364
- * .setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL)
365
- * .setColumn(5)
366
- * .setRow(5)
367
- * .setRotate(90)
368
- * .buildAsync();
369
- * fWorksheet.insertImages([image]);
370
- * ```
371
- */
372
- setRotate(angle: number): FOverGridImageBuilder;
373
- setUnitId(unitId: string): FOverGridImageBuilder;
374
- setSubUnitId(subUnitId: string): FOverGridImageBuilder;
375
- buildAsync(): Promise<ISheetImage>;
376
- }
377
- /**
378
- * @hideconstructor
379
- */
380
- export declare class FOverGridImage extends FBase {
381
- private _image;
382
- protected readonly _commandService: ICommandService;
383
- protected readonly _injector: Injector;
384
- constructor(_image: ISheetImage, _commandService: ICommandService, _injector: Injector);
385
- /**
386
- * Get the id of the image
387
- * @returns {string} The id of the image
388
- * @example
389
- * ```ts
390
- * const fWorkbook = univerAPI.getActiveWorkbook();
391
- * const fWorksheet = fWorkbook.getActiveSheet();
392
- * const images = fWorksheet.getImages();
393
- * images.forEach((image) => {
394
- * console.log(image, image.getId());
395
- * });
396
- * ```
397
- */
398
- getId(): string;
399
- /**
400
- * Get the drawing type of the image
401
- * @returns {DrawingTypeEnum} The drawing type of the image
402
- * @example
403
- * ```ts
404
- * const fWorkbook = univerAPI.getActiveWorkbook();
405
- * const fWorksheet = fWorkbook.getActiveSheet();
406
- * const images = fWorksheet.getImages();
407
- * images.forEach((image) => {
408
- * console.log(image, image.getType());
409
- * });
410
- * ```
411
- */
412
- getType(): DrawingTypeEnum;
413
- /**
414
- * Remove the image from the sheet
415
- * @returns {boolean} true if the image is removed successfully, otherwise false
416
- * @example
417
- * ```ts
418
- * const fWorkbook = univerAPI.getActiveWorkbook();
419
- * const fWorksheet = fWorkbook.getActiveSheet();
420
- * const image = fWorksheet.getImages()[0];
421
- * const result = image?.remove();
422
- * console.log(result);
423
- * ```
424
- */
425
- remove(): boolean;
426
- /**
427
- * Convert the image to a FOverGridImageBuilder
428
- * @returns {FOverGridImageBuilder} The builder FOverGridImageBuilder
429
- * @example
430
- * ```ts
431
- * const fWorkbook = univerAPI.getActiveWorkbook();
432
- * const fWorksheet = fWorkbook.getActiveSheet();
433
- * const images = fWorksheet.getImages();
434
- * images.forEach((image) => {
435
- * console.log(image, image.toBuilder().getSource());
436
- * });
437
- * ```
438
- */
439
- toBuilder(): FOverGridImageBuilder;
440
- /**
441
- * Set the source of the image
442
- * @param {string} source - The source of the image
443
- * @returns {boolean} true if the source is set successfully, otherwise false
444
- * @example
445
- * ```ts
446
- * const fWorkbook = univerAPI.getActiveWorkbook();
447
- * const fWorksheet = fWorkbook.getActiveSheet();
448
- * const image = fWorksheet.getImages()[0];
449
- * const result = image?.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4');
450
- * console.log(result);
451
- * ```
452
- */
453
- setSource(source: string): boolean;
454
- /**
455
- * Set the source of the image, change image display.
456
- * @param {string} source - The source of the image
457
- * @param {ImageSourceType} [sourceType] - The source type of the image, default is URL
458
- * @returns {boolean} true if the source is set successfully, otherwise false
459
- * @example
460
- * ```ts
461
- * const fWorkbook = univerAPI.getActiveWorkbook();
462
- * const fWorksheet = fWorkbook.getActiveSheet();
463
- * const image = fWorksheet.getImages()[0];
464
- * const result = image?.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4', univerAPI.Enum.ImageSourceType.URL);
465
- * console.log(result);
466
- * ```
467
- */
468
- setSource(source: string, sourceType?: ImageSourceType): boolean;
469
- /**
470
- * Set the position of the image
471
- * @param {number} row - The row index of the image start position
472
- * @param {number} column - The column index of the image start position
473
- * @returns {boolean} true if the position is set successfully, otherwise false
474
- * @example
475
- * ```ts
476
- * // set the position of the image, the start position is F6 cell.
477
- * const fWorkbook = univerAPI.getActiveWorkbook();
478
- * const fWorksheet = fWorkbook.getActiveSheet();
479
- * const image = fWorksheet.getImages()[0];
480
- * const result = image?.setPositionAsync(5, 5);
481
- * console.log(result);
482
- * ```
483
- */
484
- setPositionAsync(row: number, column: number): Promise<boolean>;
485
- /**
486
- * @param {number} row - The row index of the image start position
487
- * @param {number} column - The column index of the image start position
488
- * @param {number} rowOffset - The row offset of the image start position, pixel unit
489
- * @param {number} columnOffset - The column offset of the image start position, pixel unit
490
- * @returns {boolean} true if the position is set successfully, otherwise false
491
- * @example
492
- * ```ts
493
- * // set the position of the image, the start position is F6 cell, and the offset is 10px.
494
- * const fWorkbook = univerAPI.getActiveWorkbook();
495
- * const fWorksheet = fWorkbook.getActiveSheet();
496
- * const image = fWorksheet.getImages()[0];
497
- * const result = image?.setPositionAsync(5, 5, 10, 10);
498
- * console.log(result);
499
- * ```
500
- */
501
- setPositionAsync(row: number, column: number, rowOffset?: number, columnOffset?: number): Promise<boolean>;
502
- /**
503
- * Set the size of the image
504
- * @param {number} width - The width of the image, pixel unit
505
- * @param {number} height - The height of the image, pixel unit
506
- * @returns {boolean} true if the size is set successfully, otherwise false
507
- * @example
508
- * ```ts
509
- * // set the image width 120px and height 50px
510
- * const fWorkbook = univerAPI.getActiveWorkbook();
511
- * const fWorksheet = fWorkbook.getActiveSheet();
512
- * const image = fWorksheet.getImages()[0];
513
- * const result = image?.setSizeAsync(120, 50);
514
- * console.log(result);
515
- * ```
516
- */
517
- setSizeAsync(width: number, height: number): Promise<boolean>;
518
- /**
519
- * Set the cropping region of the image by defining the top, bottom, left, and right edges, thereby displaying the specific part of the image you want.
520
- * @param {number} top - The number of pixels to crop from the top of the image
521
- * @param {number} left - The number of pixels to crop from the left side of the image
522
- * @param {number} bottom - The number of pixels to crop from the bottom of the image
523
- * @param {number} right - The number of pixels to crop from the right side of the image
524
- * @returns {boolean} true if the crop is set successfully, otherwise false
525
- * @example
526
- * ```ts
527
- * // set the crop of the image, top 10px, left 10px, bottom 10px, right 10px.
528
- * const fWorkbook = univerAPI.getActiveWorkbook();
529
- * const fWorksheet = fWorkbook.getActiveSheet();
530
- * const image = fWorksheet.getImages()[0];
531
- * const result = image?.setCrop(10, 10, 10, 10);
532
- * console.log(result);
533
- * ```
534
- */
535
- setCrop(top?: number, left?: number, bottom?: number, right?: number): boolean;
536
- /**
537
- * Set the rotation angle of the image
538
- * @param {number} angle - Degree of rotation of the image, for example, 90, 180, 270, etc.
539
- * @returns {boolean} true if the rotation is set successfully, otherwise false
540
- * @example
541
- * ```ts
542
- * // set 90 degrees rotation of the image
543
- * const fWorkbook = univerAPI.getActiveWorkbook();
544
- * const fWorksheet = fWorkbook.getActiveSheet();
545
- * const image = fWorksheet.getImages()[0];
546
- * const result = image?.setRotate(90);
547
- * console.log(result);
548
- * ```
549
- */
550
- setRotate(angle: number): boolean;
551
- /**
552
- * Move the image layer forward by one level
553
- * @returns {boolean} true if the image is moved forward successfully, otherwise false
554
- * @example
555
- * ```ts
556
- * const fWorkbook = univerAPI.getActiveWorkbook();
557
- * const fWorksheet = fWorkbook.getActiveSheet();
558
- * const image = fWorksheet.getImages()[0];
559
- * const result = image?.setForward();
560
- * console.log(result);
561
- * ```
562
- */
563
- setForward(): boolean;
564
- /**
565
- * Move the image layer backward by one level
566
- * @returns {boolean} true if the image is moved backward successfully, otherwise false
567
- * @example
568
- * ```ts
569
- * const fWorkbook = univerAPI.getActiveWorkbook();
570
- * const fWorksheet = fWorkbook.getActiveSheet();
571
- * const image = fWorksheet.getImages()[0];
572
- * const result = image?.setBackward();
573
- * console.log(result);
574
- * ```
575
- */
576
- setBackward(): boolean;
577
- /**
578
- * Move the image layer to the bottom layer
579
- * @returns {boolean} true if the image is moved to the bottom layer successfully, otherwise false
580
- * @example
581
- * ```ts
582
- * const fWorkbook = univerAPI.getActiveWorkbook();
583
- * const fWorksheet = fWorkbook.getActiveSheet();
584
- * const image = fWorksheet.getImages()[0];
585
- * const result = image?.setBack();
586
- * console.log(result);
587
- * ```
588
- */
589
- setBack(): boolean;
590
- /**
591
- * Move the image layer to the top layer
592
- * @returns {boolean} true if the image is moved to the top layer successfully, otherwise false
593
- * @example
594
- * ```ts
595
- * const fWorkbook = univerAPI.getActiveWorkbook();
596
- * const fWorksheet = fWorkbook.getActiveSheet();
597
- * const image = fWorksheet.getImages()[0];
598
- * const result = image?.setFront();
599
- * console.log(result);
600
- * ```
601
- */
602
- setFront(): boolean;
603
- }