@univerjs/sheets-drawing-ui 0.5.2-nightly.202501031606 → 0.5.3-experimental.20250106-e3b7a39
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/facade.js +1 -1
- package/lib/es/facade.js +85 -85
- package/lib/types/facade/f-worksheet.d.ts +53 -22
- package/lib/umd/facade.js +1 -1
- package/package.json +13 -13
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var j=Object.defineProperty;var T=(e,t,i)=>t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var R=(e,t,i)=>T(e,typeof t!="symbol"?t+"":t,i);const a=require("@univerjs/core"),B=require("@univerjs/drawing"),C=require("@univerjs/engine-render"),c=require("@univerjs/sheets-drawing-ui"),w=require("@univerjs/sheets-ui"),u=require("@univerjs/sheets-drawing"),U=require("@univerjs/sheets-ui/facade"),y=require("@univerjs/sheets/facade"),E=require("@univerjs/ui");var P=Object.defineProperty,W=Object.getOwnPropertyDescriptor,O=(e,t,i,n)=>{for(var r=n>1?void 0:n?W(t,i):t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(r=(n?s(t,i,r):s(r))||r);return n&&r&&P(t,i,r),r},p=(e,t)=>(i,n)=>t(i,n,e);function x(e,t){const{from:i,to:n,flipY:r=!1,flipX:o=!1,angle:s=0,skewX:d=0,skewY:
|
|
1
|
+
"use strict";var j=Object.defineProperty;var T=(e,t,i)=>t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var R=(e,t,i)=>T(e,typeof t!="symbol"?t+"":t,i);const a=require("@univerjs/core"),B=require("@univerjs/drawing"),C=require("@univerjs/engine-render"),c=require("@univerjs/sheets-drawing-ui"),w=require("@univerjs/sheets-ui"),u=require("@univerjs/sheets-drawing"),U=require("@univerjs/sheets-ui/facade"),y=require("@univerjs/sheets/facade"),E=require("@univerjs/ui");var P=Object.defineProperty,W=Object.getOwnPropertyDescriptor,O=(e,t,i,n)=>{for(var r=n>1?void 0:n?W(t,i):t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(r=(n?s(t,i,r):s(r))||r);return n&&r&&P(t,i,r),r},p=(e,t)=>(i,n)=>t(i,n,e);function x(e,t){const{from:i,to:n,flipY:r=!1,flipX:o=!1,angle:s=0,skewX:d=0,skewY:h=0}=e.sheetTransform,{column:m,columnOffset:l,row:I,rowOffset:f}=i,S=w.convertPositionSheetOverGridToAbsolute(e.unitId,e.subUnitId,{from:i,to:n},t),{left:b,top:D,width:v,height:k}=S;return{...e,column:m,columnOffset:l,row:I,rowOffset:f,width:v,height:k,flipY:r,flipX:o,angle:s,skewX:d,skewY:h}}function M(e,t,i){const{column:n,columnOffset:r,row:o,rowOffset:s,flipY:d=!1,flipX:h=!1,angle:m=0,skewX:l=0,skewY:I=0,width:f,height:S}=e,b=w.convertPositionCellToSheetOverGrid(e.unitId,e.subUnitId,{column:n,columnOffset:r,row:o,rowOffset:s},f,S,t,i),{sheetTransform:D,transform:v}=b;return{...e,sheetTransform:{...D,flipY:d,flipX:h,angle:m,skewX:l,skewY:I},transform:{...v,flipY:d,flipX:h,angle:m,skewX:l,skewY:I}}}let _=class{constructor(e,t,i){R(this,"_image");this._injector=i,this._image={drawingId:a.generateRandomId(6),drawingType:a.DrawingTypeEnum.DRAWING_IMAGE,imageSourceType:a.ImageSourceType.BASE64,source:"",unitId:e,subUnitId:t,column:0,columnOffset:0,row:0,rowOffset:0,width:0,height:0}}setImage(e){const i=this._injector.get(C.IRenderManagerService).getRenderById(e.unitId);if(!i)throw new Error(`Render Unit with unitId ${e.unitId} not found`);const n=i.with(w.SheetSkeletonManagerService);return this._image=x(e,n),this}setSource(e,t){const i=t!=null?t:a.ImageSourceType.URL;return this._image.source=e,this._image.imageSourceType=i,this}getsource(){return this._image.source}getSourceType(){return this._image.imageSourceType}setColumn(e){return this._image.column=e,this}setRow(e){return this._image.row=e,this}setColumnOffset(e){return this._image.columnOffset=e,this}setRowOffset(e){return this._image.rowOffset=e,this}setWidth(e){return this._image.width=e,this}setHeight(e){return this._image.height=e,this}setAnchorType(e){return this._image.anchorType=e,this}setCropTop(e){return this._initializeSrcRect(),this._image.srcRect.top=e,this}setCropLeft(e){return this._initializeSrcRect(),this._image.srcRect.left=e,this}setCropBottom(e){return this._initializeSrcRect(),this._image.srcRect.bottom=e,this}setCropRight(e){return this._initializeSrcRect(),this._image.srcRect.right=e,this}_initializeSrcRect(){this._image.srcRect==null&&(this._image.srcRect={top:0,left:0,bottom:0,right:0})}setRotate(e){return this._image.angle=e,this}setUnitId(e){return this._image.unitId=e,this}setSubUnitId(e){return this._image.subUnitId=e,this}async build(){const t=this._injector.get(C.IRenderManagerService).getRenderById(this._image.unitId);if(!t)throw new Error(`Render Unit with unitId ${this._image.unitId} not found`);const i=t.with(w.ISheetSelectionRenderService),n=t.with(w.SheetSkeletonManagerService);if(this._image.width===0||this._image.height===0){const r=await B.getImageSize(this._image.source),o=r.width,s=r.height;this._image.width===0&&(this._image.width=o),this._image.height===0&&(this._image.height=s)}return M(this._image,i,n)}};_=O([p(2,a.Inject(a.Injector))],_);let g=class extends a.FBase{constructor(e,t,i){super(),this._image=e,this._commandService=t,this._injector=i}getId(){return this._image.drawingId}getType(){return this._image.drawingType}remove(){return this._commandService.syncExecuteCommand(c.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[this._image]})}toBuilder(){const e=this._injector.createInstance(_);return e.setImage(this._image),e}setSource(e,t){const i=t!=null?t:a.ImageSourceType.URL;return this._image.source=e,this._image.imageSourceType=i,this._commandService.syncExecuteCommand(c.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[this._image]})}setPosition(e,t,i,n){const r=this.toBuilder();return r.setColumn(t),r.setRow(e),i!=null&&r.setRowOffset(i),n!=null&&r.setColumnOffset(n),this._commandService.syncExecuteCommand(c.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[r.build()]})}setSize(e,t){const i=this.toBuilder();return i.setWidth(e),i.setHeight(t),this._commandService.syncExecuteCommand(c.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[i.build()]})}setCrop(e,t,i,n){return this._image.srcRect==null&&(this._image.srcRect={top:0,left:0,bottom:0,right:0}),e!=null&&(this._image.srcRect.top=e),t!=null&&(this._image.srcRect.left=t),i!=null&&(this._image.srcRect.bottom=i),n!=null&&(this._image.srcRect.right=n),this._commandService.syncExecuteCommand(c.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[this._image]})}setRotate(e){return this._image.sheetTransform.angle=e,this._commandService.syncExecuteCommand(c.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[this._image]})}};g=O([p(1,a.ICommandService),p(2,a.Inject(a.Injector))],g);class F extends y.FWorksheet{addFloatDomToPosition(t,i){const n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),{key:o,disposableCollection:s}=U.transformComponentKey(t,this._injector.get(E.ComponentManager)),h=this._injector.get(c.SheetCanvasFloatDomManagerService).addFloatDomToPosition({...t,componentKey:o,unitId:n,subUnitId:r},i);return h?(s.add(h.dispose),{id:h.id,dispose:()=>{s.dispose(),h.dispose()}}):(s.dispose(),null)}async insertImage(t,i,n,r,o){const s=this.newOverGridImage();if(typeof t=="string")s.setSource(t);else{const m=await t.getBlob().getDataAsString();s.setSource(m,a.ImageSourceType.BASE64)}i!==void 0?s.setColumn(i):s.setColumn(0),n!==void 0?s.setRow(n):s.setRow(0),r!==void 0?s.setColumnOffset(r):s.setColumnOffset(0),o!==void 0?s.setRowOffset(o):s.setRowOffset(0);const d=await s.build();return this._commandService.syncExecuteCommand(c.InsertSheetDrawingCommand.id,{unitId:this._fWorkbook.getId(),drawings:[d]})}insertImages(t){const i=t.map(n=>(n.unitId=this._fWorkbook.getId(),n.subUnitId=this.getSheetId(),n));return this._commandService.syncExecuteCommand(c.InsertSheetDrawingCommand.id,{unitId:this._fWorkbook.getId(),drawings:i}),this}deleteImages(t){const i=t.map(n=>({unitId:this._fWorkbook.getId(),drawingId:n.getId(),subUnitId:this.getSheetId(),drawingType:n.getType()}));return this._commandService.syncExecuteCommand(c.RemoveSheetDrawingCommand.id,{unitId:this._fWorkbook.getId(),drawings:i}),this}getImages(){const i=this._injector.get(u.ISheetDrawingService).getDrawingData(this._fWorkbook.getId(),this.getSheetId()),n=[];for(const r in i){const o=i[r];n.push(this._injector.createInstance(g,o))}return n}getImageById(t){const n=this._injector.get(u.ISheetDrawingService).getDrawingByParam({unitId:this._fWorkbook.getId(),subUnitId:this.getSheetId(),drawingId:t});return n?this._injector.createInstance(g,n):null}getActiveImages(){const i=this._injector.get(u.ISheetDrawingService).getFocusDrawings(),n=[];for(const r in i){const o=i[r];n.push(this._injector.createInstance(g,o))}return n}updateImages(t){return this._commandService.syncExecuteCommand(c.SetSheetDrawingCommand.id,{unitId:this._fWorkbook.getId(),drawings:t}),this}onImageInserted(t){const i=this._injector.get(u.ISheetDrawingService);return a.toDisposable(i.add$.subscribe(n=>{const r=n.map(o=>this._injector.createInstance(g,i.getDrawingByParam(o)));t(r)}))}onImageDeleted(t){const i=this._injector.get(u.ISheetDrawingService);return a.toDisposable(i.remove$.subscribe(n=>{const r=n.map(o=>this._injector.createInstance(g,i.getDrawingByParam(o)));t(r)}))}onImageChanged(t){const i=this._injector.get(u.ISheetDrawingService);return a.toDisposable(i.update$.subscribe(n=>{const r=n.map(o=>this._injector.createInstance(g,i.getDrawingByParam(o)));t(r)}))}newOverGridImage(){const t=this._fWorkbook.getId(),i=this.getSheetId();return this._injector.createInstance(_,t,i)}}y.FWorksheet.extend(F);
|
package/lib/es/facade.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Inject as
|
|
5
|
-
import { getImageSize as
|
|
6
|
-
import { IRenderManagerService as
|
|
7
|
-
import { SetSheetDrawingCommand as h, SheetCanvasFloatDomManagerService as
|
|
8
|
-
import { SheetSkeletonManagerService as
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var U = (e, t, i) => t in e ? P(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
+
var C = (e, t, i) => U(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
import { Inject as k, Injector as j, ICommandService as W, generateRandomId as x, DrawingTypeEnum as F, ImageSourceType as _, FBase as M, toDisposable as v } from "@univerjs/core";
|
|
5
|
+
import { getImageSize as z } from "@univerjs/drawing";
|
|
6
|
+
import { IRenderManagerService as D } from "@univerjs/engine-render";
|
|
7
|
+
import { SetSheetDrawingCommand as h, SheetCanvasFloatDomManagerService as A, InsertSheetDrawingCommand as y, RemoveSheetDrawingCommand as G } from "@univerjs/sheets-drawing-ui";
|
|
8
|
+
import { SheetSkeletonManagerService as O, ISheetSelectionRenderService as $, convertPositionSheetOverGridToAbsolute as L, convertPositionCellToSheetOverGrid as X } from "@univerjs/sheets-ui";
|
|
9
9
|
import { ISheetDrawingService as g } from "@univerjs/sheets-drawing";
|
|
10
|
-
import { transformComponentKey as
|
|
11
|
-
import { FWorksheet as
|
|
12
|
-
import { ComponentManager as
|
|
13
|
-
var
|
|
14
|
-
for (var n =
|
|
15
|
-
(
|
|
16
|
-
return
|
|
17
|
-
},
|
|
18
|
-
function
|
|
19
|
-
const { from: i, to:
|
|
10
|
+
import { transformComponentKey as Y } from "@univerjs/sheets-ui/facade";
|
|
11
|
+
import { FWorksheet as T } from "@univerjs/sheets/facade";
|
|
12
|
+
import { ComponentManager as H } from "@univerjs/ui";
|
|
13
|
+
var K = Object.defineProperty, V = Object.getOwnPropertyDescriptor, B = (e, t, i, r) => {
|
|
14
|
+
for (var n = r > 1 ? void 0 : r ? V(t, i) : t, o = e.length - 1, s; o >= 0; o--)
|
|
15
|
+
(s = e[o]) && (n = (r ? s(t, i, n) : s(n)) || n);
|
|
16
|
+
return r && n && K(t, i, n), n;
|
|
17
|
+
}, p = (e, t) => (i, r) => t(i, r, e);
|
|
18
|
+
function N(e, t) {
|
|
19
|
+
const { from: i, to: r, flipY: n = !1, flipX: o = !1, angle: s = 0, skewX: m = 0, skewY: a = 0 } = e.sheetTransform, { column: d, columnOffset: u, row: f, rowOffset: I } = i, w = L(
|
|
20
20
|
e.unitId,
|
|
21
21
|
e.subUnitId,
|
|
22
|
-
{ from: i, to:
|
|
22
|
+
{ from: i, to: r },
|
|
23
23
|
t
|
|
24
|
-
), { left:
|
|
24
|
+
), { left: b, top: R, width: S, height: E } = w;
|
|
25
25
|
return {
|
|
26
26
|
...e,
|
|
27
27
|
column: d,
|
|
@@ -29,28 +29,28 @@ function V(e, t) {
|
|
|
29
29
|
row: f,
|
|
30
30
|
rowOffset: I,
|
|
31
31
|
width: S,
|
|
32
|
-
height:
|
|
32
|
+
height: E,
|
|
33
33
|
flipY: n,
|
|
34
34
|
flipX: o,
|
|
35
|
-
angle:
|
|
35
|
+
angle: s,
|
|
36
36
|
skewX: m,
|
|
37
37
|
skewY: a
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
const { column:
|
|
40
|
+
function q(e, t, i) {
|
|
41
|
+
const { column: r, columnOffset: n, row: o, rowOffset: s, flipY: m = !1, flipX: a = !1, angle: d = 0, skewX: u = 0, skewY: f = 0, width: I, height: w } = e, b = X(
|
|
42
42
|
e.unitId,
|
|
43
43
|
e.subUnitId,
|
|
44
|
-
{ column:
|
|
44
|
+
{ column: r, columnOffset: n, row: o, rowOffset: s },
|
|
45
45
|
I,
|
|
46
46
|
w,
|
|
47
47
|
t,
|
|
48
48
|
i
|
|
49
|
-
), { sheetTransform:
|
|
49
|
+
), { sheetTransform: R, transform: S } = b;
|
|
50
50
|
return {
|
|
51
51
|
...e,
|
|
52
52
|
sheetTransform: {
|
|
53
|
-
...
|
|
53
|
+
...R,
|
|
54
54
|
flipY: m,
|
|
55
55
|
flipX: a,
|
|
56
56
|
angle: d,
|
|
@@ -69,10 +69,10 @@ function N(e, t, i) {
|
|
|
69
69
|
}
|
|
70
70
|
let l = class {
|
|
71
71
|
constructor(e, t, i) {
|
|
72
|
-
|
|
72
|
+
C(this, "_image");
|
|
73
73
|
this._injector = i, this._image = {
|
|
74
|
-
drawingId:
|
|
75
|
-
drawingType:
|
|
74
|
+
drawingId: x(6),
|
|
75
|
+
drawingType: F.DRAWING_IMAGE,
|
|
76
76
|
imageSourceType: _.BASE64,
|
|
77
77
|
source: "",
|
|
78
78
|
unitId: e,
|
|
@@ -86,11 +86,11 @@ let l = class {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
setImage(e) {
|
|
89
|
-
const i = this._injector.get(
|
|
89
|
+
const i = this._injector.get(D).getRenderById(e.unitId);
|
|
90
90
|
if (!i)
|
|
91
91
|
throw new Error(`Render Unit with unitId ${e.unitId} not found`);
|
|
92
|
-
const
|
|
93
|
-
return this._image =
|
|
92
|
+
const r = i.with(O);
|
|
93
|
+
return this._image = N(e, r), this;
|
|
94
94
|
}
|
|
95
95
|
setSource(e, t) {
|
|
96
96
|
const i = t != null ? t : _.URL;
|
|
@@ -162,21 +162,21 @@ let l = class {
|
|
|
162
162
|
return this._image.subUnitId = e, this;
|
|
163
163
|
}
|
|
164
164
|
async build() {
|
|
165
|
-
const t = this._injector.get(
|
|
165
|
+
const t = this._injector.get(D).getRenderById(this._image.unitId);
|
|
166
166
|
if (!t)
|
|
167
167
|
throw new Error(`Render Unit with unitId ${this._image.unitId} not found`);
|
|
168
|
-
const i = t.with(
|
|
168
|
+
const i = t.with($), r = t.with(O);
|
|
169
169
|
if (this._image.width === 0 || this._image.height === 0) {
|
|
170
|
-
const n = await
|
|
171
|
-
this._image.width === 0 && (this._image.width = o), this._image.height === 0 && (this._image.height =
|
|
170
|
+
const n = await z(this._image.source), o = n.width, s = n.height;
|
|
171
|
+
this._image.width === 0 && (this._image.width = o), this._image.height === 0 && (this._image.height = s);
|
|
172
172
|
}
|
|
173
|
-
return
|
|
173
|
+
return q(this._image, i, r);
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
|
-
l =
|
|
177
|
-
|
|
176
|
+
l = B([
|
|
177
|
+
p(2, k(j))
|
|
178
178
|
], l);
|
|
179
|
-
let c = class extends
|
|
179
|
+
let c = class extends M {
|
|
180
180
|
constructor(e, t, i) {
|
|
181
181
|
super(), this._image = e, this._commandService = t, this._injector = i;
|
|
182
182
|
}
|
|
@@ -223,9 +223,9 @@ let c = class extends F {
|
|
|
223
223
|
const i = t != null ? t : _.URL;
|
|
224
224
|
return this._image.source = e, this._image.imageSourceType = i, this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
225
225
|
}
|
|
226
|
-
setPosition(e, t, i,
|
|
226
|
+
setPosition(e, t, i, r) {
|
|
227
227
|
const n = this.toBuilder();
|
|
228
|
-
return n.setColumn(t), n.setRow(e), i != null && n.setRowOffset(i),
|
|
228
|
+
return n.setColumn(t), n.setRow(e), i != null && n.setRowOffset(i), r != null && n.setColumnOffset(r), this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [n.build()] });
|
|
229
229
|
}
|
|
230
230
|
/**
|
|
231
231
|
* Set the size of the image
|
|
@@ -253,13 +253,13 @@ let c = class extends F {
|
|
|
253
253
|
* console.log('Set crop state is ', image.setCrop(0, 0, 0, 0));
|
|
254
254
|
* ```
|
|
255
255
|
*/
|
|
256
|
-
setCrop(e, t, i,
|
|
256
|
+
setCrop(e, t, i, r) {
|
|
257
257
|
return this._image.srcRect == null && (this._image.srcRect = {
|
|
258
258
|
top: 0,
|
|
259
259
|
left: 0,
|
|
260
260
|
bottom: 0,
|
|
261
261
|
right: 0
|
|
262
|
-
}), e != null && (this._image.srcRect.top = e), t != null && (this._image.srcRect.left = t), i != null && (this._image.srcRect.bottom = i),
|
|
262
|
+
}), e != null && (this._image.srcRect.top = e), t != null && (this._image.srcRect.left = t), i != null && (this._image.srcRect.bottom = i), r != null && (this._image.srcRect.right = r), this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
263
263
|
}
|
|
264
264
|
// setPresetGeometry(prstGeom: PresetGeometryType): boolean {
|
|
265
265
|
// this._image.prstGeom = prstGeom;
|
|
@@ -274,98 +274,98 @@ let c = class extends F {
|
|
|
274
274
|
return this._image.sheetTransform.angle = e, this._commandService.syncExecuteCommand(h.id, { unitId: this._image.unitId, drawings: [this._image] });
|
|
275
275
|
}
|
|
276
276
|
};
|
|
277
|
-
c =
|
|
278
|
-
|
|
279
|
-
|
|
277
|
+
c = B([
|
|
278
|
+
p(1, W),
|
|
279
|
+
p(2, k(j))
|
|
280
280
|
], c);
|
|
281
|
-
class
|
|
281
|
+
class J extends T {
|
|
282
282
|
addFloatDomToPosition(t, i) {
|
|
283
|
-
const
|
|
284
|
-
return a ? (
|
|
283
|
+
const r = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), { key: o, disposableCollection: s } = Y(t, this._injector.get(H)), a = this._injector.get(A).addFloatDomToPosition({ ...t, componentKey: o, unitId: r, subUnitId: n }, i);
|
|
284
|
+
return a ? (s.add(a.dispose), {
|
|
285
285
|
id: a.id,
|
|
286
286
|
dispose: () => {
|
|
287
|
-
|
|
287
|
+
s.dispose(), a.dispose();
|
|
288
288
|
}
|
|
289
|
-
}) : (
|
|
289
|
+
}) : (s.dispose(), null);
|
|
290
290
|
}
|
|
291
|
-
async insertImage(t, i,
|
|
292
|
-
const
|
|
291
|
+
async insertImage(t, i, r, n, o) {
|
|
292
|
+
const s = this.newOverGridImage();
|
|
293
293
|
if (typeof t == "string")
|
|
294
|
-
|
|
294
|
+
s.setSource(t);
|
|
295
295
|
else {
|
|
296
296
|
const d = await t.getBlob().getDataAsString();
|
|
297
|
-
|
|
297
|
+
s.setSource(d, _.BASE64);
|
|
298
298
|
}
|
|
299
|
-
i !== void 0 ?
|
|
300
|
-
const m = await
|
|
301
|
-
return this._commandService.syncExecuteCommand(
|
|
299
|
+
i !== void 0 ? s.setColumn(i) : s.setColumn(0), r !== void 0 ? s.setRow(r) : s.setRow(0), n !== void 0 ? s.setColumnOffset(n) : s.setColumnOffset(0), o !== void 0 ? s.setRowOffset(o) : s.setRowOffset(0);
|
|
300
|
+
const m = await s.build();
|
|
301
|
+
return this._commandService.syncExecuteCommand(y.id, { unitId: this._fWorkbook.getId(), drawings: [m] });
|
|
302
302
|
}
|
|
303
303
|
insertImages(t) {
|
|
304
|
-
const i = t.map((
|
|
305
|
-
this._commandService.syncExecuteCommand(
|
|
304
|
+
const i = t.map((r) => (r.unitId = this._fWorkbook.getId(), r.subUnitId = this.getSheetId(), r));
|
|
305
|
+
return this._commandService.syncExecuteCommand(y.id, { unitId: this._fWorkbook.getId(), drawings: i }), this;
|
|
306
306
|
}
|
|
307
307
|
deleteImages(t) {
|
|
308
|
-
const i = t.map((
|
|
308
|
+
const i = t.map((r) => ({
|
|
309
309
|
unitId: this._fWorkbook.getId(),
|
|
310
|
-
drawingId:
|
|
310
|
+
drawingId: r.getId(),
|
|
311
311
|
subUnitId: this.getSheetId(),
|
|
312
|
-
drawingType:
|
|
312
|
+
drawingType: r.getType()
|
|
313
313
|
}));
|
|
314
|
-
this._commandService.syncExecuteCommand(
|
|
314
|
+
return this._commandService.syncExecuteCommand(G.id, { unitId: this._fWorkbook.getId(), drawings: i }), this;
|
|
315
315
|
}
|
|
316
316
|
getImages() {
|
|
317
|
-
const i = this._injector.get(g).getDrawingData(this._fWorkbook.getId(), this.getSheetId()),
|
|
317
|
+
const i = this._injector.get(g).getDrawingData(this._fWorkbook.getId(), this.getSheetId()), r = [];
|
|
318
318
|
for (const n in i) {
|
|
319
319
|
const o = i[n];
|
|
320
|
-
|
|
320
|
+
r.push(this._injector.createInstance(c, o));
|
|
321
321
|
}
|
|
322
|
-
return
|
|
322
|
+
return r;
|
|
323
323
|
}
|
|
324
324
|
getImageById(t) {
|
|
325
|
-
const
|
|
326
|
-
return
|
|
325
|
+
const r = this._injector.get(g).getDrawingByParam({ unitId: this._fWorkbook.getId(), subUnitId: this.getSheetId(), drawingId: t });
|
|
326
|
+
return r ? this._injector.createInstance(c, r) : null;
|
|
327
327
|
}
|
|
328
328
|
getActiveImages() {
|
|
329
|
-
const i = this._injector.get(g).getFocusDrawings(),
|
|
329
|
+
const i = this._injector.get(g).getFocusDrawings(), r = [];
|
|
330
330
|
for (const n in i) {
|
|
331
331
|
const o = i[n];
|
|
332
|
-
|
|
332
|
+
r.push(this._injector.createInstance(c, o));
|
|
333
333
|
}
|
|
334
|
-
return
|
|
334
|
+
return r;
|
|
335
335
|
}
|
|
336
336
|
updateImages(t) {
|
|
337
|
-
this._commandService.syncExecuteCommand(h.id, { unitId: this._fWorkbook.getId(), drawings: t });
|
|
337
|
+
return this._commandService.syncExecuteCommand(h.id, { unitId: this._fWorkbook.getId(), drawings: t }), this;
|
|
338
338
|
}
|
|
339
339
|
onImageInserted(t) {
|
|
340
340
|
const i = this._injector.get(g);
|
|
341
|
-
i.add$.subscribe((
|
|
342
|
-
const n =
|
|
341
|
+
return v(i.add$.subscribe((r) => {
|
|
342
|
+
const n = r.map(
|
|
343
343
|
(o) => this._injector.createInstance(c, i.getDrawingByParam(o))
|
|
344
344
|
);
|
|
345
345
|
t(n);
|
|
346
|
-
});
|
|
346
|
+
}));
|
|
347
347
|
}
|
|
348
348
|
onImageDeleted(t) {
|
|
349
349
|
const i = this._injector.get(g);
|
|
350
|
-
i.remove$.subscribe((
|
|
351
|
-
const n =
|
|
350
|
+
return v(i.remove$.subscribe((r) => {
|
|
351
|
+
const n = r.map(
|
|
352
352
|
(o) => this._injector.createInstance(c, i.getDrawingByParam(o))
|
|
353
353
|
);
|
|
354
354
|
t(n);
|
|
355
|
-
});
|
|
355
|
+
}));
|
|
356
356
|
}
|
|
357
357
|
onImageChanged(t) {
|
|
358
358
|
const i = this._injector.get(g);
|
|
359
|
-
i.update$.subscribe((
|
|
360
|
-
const n =
|
|
359
|
+
return v(i.update$.subscribe((r) => {
|
|
360
|
+
const n = r.map(
|
|
361
361
|
(o) => this._injector.createInstance(c, i.getDrawingByParam(o))
|
|
362
362
|
);
|
|
363
363
|
t(n);
|
|
364
|
-
});
|
|
364
|
+
}));
|
|
365
365
|
}
|
|
366
366
|
newOverGridImage() {
|
|
367
367
|
const t = this._fWorkbook.getId(), i = this.getSheetId();
|
|
368
368
|
return this._injector.createInstance(l, t, i);
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
|
|
371
|
+
T.extend(J);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IFBlobSource, Nullable } from '@univerjs/core';
|
|
1
|
+
import { IDisposable, IFBlobSource, Nullable } from '@univerjs/core';
|
|
2
2
|
import { ISheetImage } from '@univerjs/sheets-drawing';
|
|
3
3
|
import { ICanvasFloatDom } from '@univerjs/sheets-drawing-ui';
|
|
4
4
|
import { IFComponentKey } from '@univerjs/sheets-ui/facade';
|
|
@@ -8,7 +8,7 @@ export interface IFICanvasFloatDom extends Omit<ICanvasFloatDom, 'componentKey'
|
|
|
8
8
|
}
|
|
9
9
|
export interface IFWorksheetLegacy {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Add a float dom to position.
|
|
12
12
|
* @param layer float dom config
|
|
13
13
|
* @param id float dom id, if not given will be auto generated
|
|
14
14
|
* @returns float dom id and dispose function
|
|
@@ -50,21 +50,35 @@ export interface IFWorksheetLegacy {
|
|
|
50
50
|
* const imageBuilder = activeSheet.newOverGridImage();
|
|
51
51
|
* const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setWidth(500).setHeight(300).build();
|
|
52
52
|
* activeSheet.insertImages([param]);
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
53
|
* const image = activeSheet.getImageById(param.drawingId);
|
|
56
54
|
* console.log(image);
|
|
57
|
-
|
|
58
55
|
* setTimeout(async ()=>{
|
|
59
56
|
* const builder = image.toBuilder();
|
|
60
57
|
* const param = await builder.setHeight(50).setWidth(100).build();
|
|
61
58
|
* activeSheet.updateImages([param]);
|
|
62
59
|
* }, 4000);
|
|
63
60
|
*/
|
|
64
|
-
insertImages(sheetImages: ISheetImage[]):
|
|
61
|
+
insertImages(sheetImages: ISheetImage[]): FWorksheet;
|
|
62
|
+
/**
|
|
63
|
+
* Get all images in current sheet.
|
|
64
|
+
* @returns FOverGridImage[]
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* univerAPI.getActiveWorkbook().getActiveSheet().getImages();
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
65
70
|
getImages(): FOverGridImage[];
|
|
71
|
+
/**
|
|
72
|
+
* Get image by drawing id
|
|
73
|
+
* @param id - The drawing id of the image
|
|
74
|
+
* @returns FOverGridImage | null
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* univerAPI.getActiveWorkbook().getActiveSheet().getImageById('xxxx');
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
66
80
|
getImageById(id: string): FOverGridImage | null;
|
|
67
|
-
deleteImages(sheetImages: FOverGridImage[]):
|
|
81
|
+
deleteImages(sheetImages: FOverGridImage[]): FWorksheet;
|
|
68
82
|
/**
|
|
69
83
|
* Update images to the sheet
|
|
70
84
|
* @param sheetImages The images to insert
|
|
@@ -76,29 +90,46 @@ export interface IFWorksheetLegacy {
|
|
|
76
90
|
* const imageBuilder = activeSheet.newOverGridImage();
|
|
77
91
|
* const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setWidth(500).setHeight(300).build();
|
|
78
92
|
* activeSheet.insertImages([param]);
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
93
|
* const image = activeSheet.getImageById(param.drawingId);
|
|
82
94
|
* console.log(image);
|
|
83
|
-
|
|
84
95
|
* setTimeout(async ()=>{
|
|
85
96
|
* const builder = image.toBuilder();
|
|
86
97
|
* const param = await builder.setHeight(50).setWidth(100).build();
|
|
87
98
|
* activeSheet.updateImages([param]);
|
|
88
99
|
* }, 4000);
|
|
89
100
|
*/
|
|
90
|
-
updateImages(sheetImages: ISheetImage[]):
|
|
101
|
+
updateImages(sheetImages: ISheetImage[]): FWorksheet;
|
|
102
|
+
/**
|
|
103
|
+
* Get all images in current sheet.
|
|
104
|
+
* @returns FOverGridImage[]
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* univerAPI.getActiveWorkbook().getActiveSheet().getImages();
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
91
110
|
getActiveImages(): FOverGridImage[];
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Hook when a image is inserted.
|
|
113
|
+
* @param {function(FOverGridImage[]: void)} callback - The callback function when a image is inserted.
|
|
114
|
+
*/
|
|
115
|
+
onImageInserted(callback: (images: FOverGridImage[]) => void): IDisposable;
|
|
116
|
+
/**
|
|
117
|
+
* Hook when a image is deleted.
|
|
118
|
+
* @param {function(FOverGridImage[]: void)} callback - The callback function when a image is deleted.
|
|
119
|
+
*/
|
|
120
|
+
onImageDeleted(callback: (images: FOverGridImage[]) => void): IDisposable;
|
|
121
|
+
/**
|
|
122
|
+
* Hook when a image is changed.
|
|
123
|
+
* @param {function(FOverGridImage[]: void)} callback - The callback function when a image is changed.
|
|
124
|
+
*/
|
|
125
|
+
onImageChanged(callback: (images: FOverGridImage[]) => void): IDisposable;
|
|
95
126
|
/**
|
|
96
127
|
* Create a new over grid image builder.
|
|
97
|
-
* @returns The builder
|
|
128
|
+
* @returns {FOverGridImageBuilder} The builder
|
|
98
129
|
* @example
|
|
99
130
|
* ```ts
|
|
100
131
|
* // create a new over grid image builder.
|
|
101
|
-
* const builder =
|
|
132
|
+
* const builder = univerAPI.newOverGridImage();
|
|
102
133
|
* ```
|
|
103
134
|
*/
|
|
104
135
|
newOverGridImage(): FOverGridImageBuilder;
|
|
@@ -109,15 +140,15 @@ export declare class FWorksheetLegacy extends FWorksheet implements IFWorksheetL
|
|
|
109
140
|
dispose: () => void;
|
|
110
141
|
}>;
|
|
111
142
|
insertImage(url: IFBlobSource | string, column?: number, row?: number, offsetX?: number, offsetY?: number): Promise<boolean>;
|
|
112
|
-
insertImages(sheetImages: ISheetImage[]):
|
|
113
|
-
deleteImages(sheetImages: FOverGridImage[]):
|
|
143
|
+
insertImages(sheetImages: ISheetImage[]): FWorksheet;
|
|
144
|
+
deleteImages(sheetImages: FOverGridImage[]): FWorksheet;
|
|
114
145
|
getImages(): FOverGridImage[];
|
|
115
146
|
getImageById(id: string): FOverGridImage | null;
|
|
116
147
|
getActiveImages(): FOverGridImage[];
|
|
117
|
-
updateImages(sheetImages: ISheetImage[]):
|
|
118
|
-
onImageInserted(callback: (images: FOverGridImage[]) => void):
|
|
119
|
-
onImageDeleted(callback: (images: FOverGridImage[]) => void):
|
|
120
|
-
onImageChanged(callback: (images: FOverGridImage[]) => void):
|
|
148
|
+
updateImages(sheetImages: ISheetImage[]): FWorksheet;
|
|
149
|
+
onImageInserted(callback: (images: FOverGridImage[]) => void): IDisposable;
|
|
150
|
+
onImageDeleted(callback: (images: FOverGridImage[]) => void): IDisposable;
|
|
151
|
+
onImageChanged(callback: (images: FOverGridImage[]) => void): IDisposable;
|
|
121
152
|
newOverGridImage(): FOverGridImageBuilder;
|
|
122
153
|
}
|
|
123
154
|
declare module '@univerjs/sheets/facade' {
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(s,c){typeof exports=="object"&&typeof module<"u"?c(require("@univerjs/core"),require("@univerjs/drawing"),require("@univerjs/engine-render"),require("@univerjs/sheets-drawing-ui"),require("@univerjs/sheets-ui"),require("@univerjs/sheets-drawing"),require("@univerjs/sheets-ui/facade"),require("@univerjs/sheets/facade"),require("@univerjs/ui")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/drawing","@univerjs/engine-render","@univerjs/sheets-drawing-ui","@univerjs/sheets-ui","@univerjs/sheets-drawing","@univerjs/sheets-ui/facade","@univerjs/sheets/facade","@univerjs/ui"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.UniverCore,s.UniverDrawing,s.UniverEngineRender,s.UniverSheetsDrawingUi,s.UniverSheetsUi,s.UniverSheetsDrawing,s.UniverSheetsUiFacade,s.UniverSheetsFacade,s.UniverUi))})(this,function(s,c,
|
|
1
|
+
(function(s,c){typeof exports=="object"&&typeof module<"u"?c(require("@univerjs/core"),require("@univerjs/drawing"),require("@univerjs/engine-render"),require("@univerjs/sheets-drawing-ui"),require("@univerjs/sheets-ui"),require("@univerjs/sheets-drawing"),require("@univerjs/sheets-ui/facade"),require("@univerjs/sheets/facade"),require("@univerjs/ui")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/drawing","@univerjs/engine-render","@univerjs/sheets-drawing-ui","@univerjs/sheets-ui","@univerjs/sheets-drawing","@univerjs/sheets-ui/facade","@univerjs/sheets/facade","@univerjs/ui"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.UniverCore,s.UniverDrawing,s.UniverEngineRender,s.UniverSheetsDrawingUi,s.UniverSheetsUi,s.UniverSheetsDrawing,s.UniverSheetsUiFacade,s.UniverSheetsFacade,s.UniverUi))})(this,function(s,c,m,d,S,f,k,R,T){"use strict";var U=Object.defineProperty;var M=(s,c,m)=>c in s?U(s,c,{enumerable:!0,configurable:!0,writable:!0,value:m}):s[c]=m;var O=(s,c,m)=>M(s,typeof c!="symbol"?c+"":c,m);var B=Object.defineProperty,E=Object.getOwnPropertyDescriptor,b=(e,i,t,n)=>{for(var r=n>1?void 0:n?E(i,t):i,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(n?o(i,t,r):o(r))||r);return n&&r&&B(i,t,r),r},v=(e,i)=>(t,n)=>i(t,n,e);function P(e,i){const{from:t,to:n,flipY:r=!1,flipX:a=!1,angle:o=0,skewX:g=0,skewY:h=0}=e.sheetTransform,{column:I,columnOffset:w,row:l,rowOffset:p}=t,C=S.convertPositionSheetOverGridToAbsolute(e.unitId,e.subUnitId,{from:t,to:n},i),{left:y,top:D,width:j,height:F}=C;return{...e,column:I,columnOffset:w,row:l,rowOffset:p,width:j,height:F,flipY:r,flipX:a,angle:o,skewX:g,skewY:h}}function W(e,i,t){const{column:n,columnOffset:r,row:a,rowOffset:o,flipY:g=!1,flipX:h=!1,angle:I=0,skewX:w=0,skewY:l=0,width:p,height:C}=e,y=S.convertPositionCellToSheetOverGrid(e.unitId,e.subUnitId,{column:n,columnOffset:r,row:a,rowOffset:o},p,C,i,t),{sheetTransform:D,transform:j}=y;return{...e,sheetTransform:{...D,flipY:g,flipX:h,angle:I,skewX:w,skewY:l},transform:{...j,flipY:g,flipX:h,angle:I,skewX:w,skewY:l}}}let _=class{constructor(e,i,t){O(this,"_image");this._injector=t,this._image={drawingId:s.generateRandomId(6),drawingType:s.DrawingTypeEnum.DRAWING_IMAGE,imageSourceType:s.ImageSourceType.BASE64,source:"",unitId:e,subUnitId:i,column:0,columnOffset:0,row:0,rowOffset:0,width:0,height:0}}setImage(e){const t=this._injector.get(m.IRenderManagerService).getRenderById(e.unitId);if(!t)throw new Error(`Render Unit with unitId ${e.unitId} not found`);const n=t.with(S.SheetSkeletonManagerService);return this._image=P(e,n),this}setSource(e,i){const t=i!=null?i:s.ImageSourceType.URL;return this._image.source=e,this._image.imageSourceType=t,this}getsource(){return this._image.source}getSourceType(){return this._image.imageSourceType}setColumn(e){return this._image.column=e,this}setRow(e){return this._image.row=e,this}setColumnOffset(e){return this._image.columnOffset=e,this}setRowOffset(e){return this._image.rowOffset=e,this}setWidth(e){return this._image.width=e,this}setHeight(e){return this._image.height=e,this}setAnchorType(e){return this._image.anchorType=e,this}setCropTop(e){return this._initializeSrcRect(),this._image.srcRect.top=e,this}setCropLeft(e){return this._initializeSrcRect(),this._image.srcRect.left=e,this}setCropBottom(e){return this._initializeSrcRect(),this._image.srcRect.bottom=e,this}setCropRight(e){return this._initializeSrcRect(),this._image.srcRect.right=e,this}_initializeSrcRect(){this._image.srcRect==null&&(this._image.srcRect={top:0,left:0,bottom:0,right:0})}setRotate(e){return this._image.angle=e,this}setUnitId(e){return this._image.unitId=e,this}setSubUnitId(e){return this._image.subUnitId=e,this}async build(){const i=this._injector.get(m.IRenderManagerService).getRenderById(this._image.unitId);if(!i)throw new Error(`Render Unit with unitId ${this._image.unitId} not found`);const t=i.with(S.ISheetSelectionRenderService),n=i.with(S.SheetSkeletonManagerService);if(this._image.width===0||this._image.height===0){const r=await c.getImageSize(this._image.source),a=r.width,o=r.height;this._image.width===0&&(this._image.width=a),this._image.height===0&&(this._image.height=o)}return W(this._image,t,n)}};_=b([v(2,s.Inject(s.Injector))],_);let u=class extends s.FBase{constructor(e,i,t){super(),this._image=e,this._commandService=i,this._injector=t}getId(){return this._image.drawingId}getType(){return this._image.drawingType}remove(){return this._commandService.syncExecuteCommand(d.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[this._image]})}toBuilder(){const e=this._injector.createInstance(_);return e.setImage(this._image),e}setSource(e,i){const t=i!=null?i:s.ImageSourceType.URL;return this._image.source=e,this._image.imageSourceType=t,this._commandService.syncExecuteCommand(d.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[this._image]})}setPosition(e,i,t,n){const r=this.toBuilder();return r.setColumn(i),r.setRow(e),t!=null&&r.setRowOffset(t),n!=null&&r.setColumnOffset(n),this._commandService.syncExecuteCommand(d.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[r.build()]})}setSize(e,i){const t=this.toBuilder();return t.setWidth(e),t.setHeight(i),this._commandService.syncExecuteCommand(d.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[t.build()]})}setCrop(e,i,t,n){return this._image.srcRect==null&&(this._image.srcRect={top:0,left:0,bottom:0,right:0}),e!=null&&(this._image.srcRect.top=e),i!=null&&(this._image.srcRect.left=i),t!=null&&(this._image.srcRect.bottom=t),n!=null&&(this._image.srcRect.right=n),this._commandService.syncExecuteCommand(d.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[this._image]})}setRotate(e){return this._image.sheetTransform.angle=e,this._commandService.syncExecuteCommand(d.SetSheetDrawingCommand.id,{unitId:this._image.unitId,drawings:[this._image]})}};u=b([v(1,s.ICommandService),v(2,s.Inject(s.Injector))],u);class x extends R.FWorksheet{addFloatDomToPosition(i,t){const n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),{key:a,disposableCollection:o}=k.transformComponentKey(i,this._injector.get(T.ComponentManager)),h=this._injector.get(d.SheetCanvasFloatDomManagerService).addFloatDomToPosition({...i,componentKey:a,unitId:n,subUnitId:r},t);return h?(o.add(h.dispose),{id:h.id,dispose:()=>{o.dispose(),h.dispose()}}):(o.dispose(),null)}async insertImage(i,t,n,r,a){const o=this.newOverGridImage();if(typeof i=="string")o.setSource(i);else{const I=await i.getBlob().getDataAsString();o.setSource(I,s.ImageSourceType.BASE64)}t!==void 0?o.setColumn(t):o.setColumn(0),n!==void 0?o.setRow(n):o.setRow(0),r!==void 0?o.setColumnOffset(r):o.setColumnOffset(0),a!==void 0?o.setRowOffset(a):o.setRowOffset(0);const g=await o.build();return this._commandService.syncExecuteCommand(d.InsertSheetDrawingCommand.id,{unitId:this._fWorkbook.getId(),drawings:[g]})}insertImages(i){const t=i.map(n=>(n.unitId=this._fWorkbook.getId(),n.subUnitId=this.getSheetId(),n));return this._commandService.syncExecuteCommand(d.InsertSheetDrawingCommand.id,{unitId:this._fWorkbook.getId(),drawings:t}),this}deleteImages(i){const t=i.map(n=>({unitId:this._fWorkbook.getId(),drawingId:n.getId(),subUnitId:this.getSheetId(),drawingType:n.getType()}));return this._commandService.syncExecuteCommand(d.RemoveSheetDrawingCommand.id,{unitId:this._fWorkbook.getId(),drawings:t}),this}getImages(){const t=this._injector.get(f.ISheetDrawingService).getDrawingData(this._fWorkbook.getId(),this.getSheetId()),n=[];for(const r in t){const a=t[r];n.push(this._injector.createInstance(u,a))}return n}getImageById(i){const n=this._injector.get(f.ISheetDrawingService).getDrawingByParam({unitId:this._fWorkbook.getId(),subUnitId:this.getSheetId(),drawingId:i});return n?this._injector.createInstance(u,n):null}getActiveImages(){const t=this._injector.get(f.ISheetDrawingService).getFocusDrawings(),n=[];for(const r in t){const a=t[r];n.push(this._injector.createInstance(u,a))}return n}updateImages(i){return this._commandService.syncExecuteCommand(d.SetSheetDrawingCommand.id,{unitId:this._fWorkbook.getId(),drawings:i}),this}onImageInserted(i){const t=this._injector.get(f.ISheetDrawingService);return s.toDisposable(t.add$.subscribe(n=>{const r=n.map(a=>this._injector.createInstance(u,t.getDrawingByParam(a)));i(r)}))}onImageDeleted(i){const t=this._injector.get(f.ISheetDrawingService);return s.toDisposable(t.remove$.subscribe(n=>{const r=n.map(a=>this._injector.createInstance(u,t.getDrawingByParam(a)));i(r)}))}onImageChanged(i){const t=this._injector.get(f.ISheetDrawingService);return s.toDisposable(t.update$.subscribe(n=>{const r=n.map(a=>this._injector.createInstance(u,t.getDrawingByParam(a)));i(r)}))}newOverGridImage(){const i=this._fWorkbook.getId(),t=this.getSheetId();return this._injector.createInstance(_,i,t)}}R.FWorksheet.extend(x)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-drawing-ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3-experimental.20250106-e3b7a39",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -59,17 +59,17 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@univerjs/icons": "^0.2.10",
|
|
61
61
|
"clsx": "^2.1.1",
|
|
62
|
-
"@univerjs/core": "0.5.
|
|
63
|
-
"@univerjs/
|
|
64
|
-
"@univerjs/
|
|
65
|
-
"@univerjs/drawing
|
|
66
|
-
"@univerjs/
|
|
67
|
-
"@univerjs/engine-render": "0.5.
|
|
68
|
-
"@univerjs/drawing": "0.5.
|
|
69
|
-
"@univerjs/sheets
|
|
70
|
-
"@univerjs/
|
|
71
|
-
"@univerjs/sheets-
|
|
72
|
-
"@univerjs/ui": "0.5.
|
|
62
|
+
"@univerjs/core": "0.5.3-experimental.20250106-e3b7a39",
|
|
63
|
+
"@univerjs/design": "0.5.3-experimental.20250106-e3b7a39",
|
|
64
|
+
"@univerjs/docs-ui": "0.5.3-experimental.20250106-e3b7a39",
|
|
65
|
+
"@univerjs/docs-drawing": "0.5.3-experimental.20250106-e3b7a39",
|
|
66
|
+
"@univerjs/drawing": "0.5.3-experimental.20250106-e3b7a39",
|
|
67
|
+
"@univerjs/engine-render": "0.5.3-experimental.20250106-e3b7a39",
|
|
68
|
+
"@univerjs/drawing-ui": "0.5.3-experimental.20250106-e3b7a39",
|
|
69
|
+
"@univerjs/sheets": "0.5.3-experimental.20250106-e3b7a39",
|
|
70
|
+
"@univerjs/ui": "0.5.3-experimental.20250106-e3b7a39",
|
|
71
|
+
"@univerjs/sheets-drawing": "0.5.3-experimental.20250106-e3b7a39",
|
|
72
|
+
"@univerjs/sheets-ui": "0.5.3-experimental.20250106-e3b7a39"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"less": "^4.2.1",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"typescript": "^5.7.2",
|
|
80
80
|
"vite": "^6.0.6",
|
|
81
81
|
"vitest": "^2.1.8",
|
|
82
|
-
"@univerjs-infra/shared": "0.5.
|
|
82
|
+
"@univerjs-infra/shared": "0.5.3"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"test": "vitest run",
|