@univerjs/sheets-drawing 0.5.3 → 0.5.4
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 +14 -14
- package/lib/types/services/sheet-drawing.service.d.ts +9 -0
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),v=require("@univerjs/drawing"),w="sheets-drawing.config",h={};var f=(e=>(e.Position="0",e.Both="1",e.None="2",e))(f||{});class E extends v.UnitDrawingService{}const _=a.createIdentifier("sheets-drawing.sheet-drawing.service");var N=(e=>(e[e.INSERT=0]="INSERT",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE",e[e.ARRANGE=3]="ARRANGE",e[e.GROUP=4]="GROUP",e[e.UNGROUP=5]="UNGROUP",e))(N||{});const P={id:"sheet.mutation.set-drawing-apply",type:a.CommandType.MUTATION,handler:(e,i)=>{const r=e.get(v.IDrawingManagerService),t=e.get(_),{op:n,unitId:s,subUnitId:o,type:l,objects:c}=i;switch(r.applyJson1(s,o,n),t.applyJson1(s,o,n),l){case 0:r.addNotification(c),t.addNotification(c);break;case 1:r.removeNotification(c),t.removeNotification(c);break;case 2:r.updateNotification(c),t.updateNotification(c);break;case 3:r.orderNotification(c),t.orderNotification(c);break;case 4:r.groupUpdateNotification(c);break;case 5:r.ungroupUpdateNotification(c);break}return!0}};var I=Object.defineProperty,m=Object.getOwnPropertyDescriptor,p=(e,i,r,t)=>{for(var n=t>1?void 0:t?m(i,r):i,s=e.length-1,o;s>=0;s--)(o=e[s])&&(n=(t?o(i,r,n):o(n))||n);return t&&n&&I(i,r,n),n},g=(e,i)=>(r,t)=>i(r,t,e);const S="SHEET_DRAWING_PLUGIN";let u=class extends a.Disposable{constructor(e,i,r,t){super(),this._commandService=e,this._sheetDrawingService=i,this._drawingManagerService=r,this._resourceManagerService=t,this._initSnapshot(),this.disposeWithMe(this._commandService.registerCommand(P))}_initSnapshot(){const e=(r,t)=>{const n=t||this._sheetDrawingService.getDrawingDataForUnit(r);return n?JSON.stringify(n):""},i=r=>{if(!r)return{};try{return JSON.parse(r)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:S,businesses:[a.UniverInstanceType.UNIVER_SHEET],toJson:(r,t)=>e(r,t),parseJson:r=>i(r),onUnLoad:r=>{this._sheetDrawingService.removeDrawingDataForUnit(r),this._drawingManagerService.removeDrawingDataForUnit(r)},onLoad:(r,t)=>{this._sheetDrawingService.registerDrawingData(r,t),this._drawingManagerService.registerDrawingData(r,t)}}))}};u=p([g(0,a.ICommandService),g(1,_),g(2,v.IDrawingManagerService),g(3,a.IResourceManagerService)],u);var D=Object.defineProperty,O=Object.getOwnPropertyDescriptor,R=(e,i,r)=>i in e?D(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,b=(e,i,r,t)=>{for(var n=t>1?void 0:t?O(i,r):i,s=e.length-1,o;s>=0;s--)(o=e[s])&&(n=(t?o(i,r,n):o(n))||n);return t&&n&&D(i,r,n),n},d=(e,i)=>(r,t)=>i(r,t,e),U=(e,i,r)=>R(e,typeof i!="symbol"?i+"":i,r);exports.UniverSheetsDrawingPlugin=class extends a.Plugin{constructor(i=h,r,t){super(),this._config=i,this._injector=r,this._configService=t;const{...n}=a.merge({},h,this._config);this._configService.setConfig(w,n)}onStarting(){[[u],[_,{useClass:E}]].forEach(i=>this._injector.add(i)),this._injector.get(u)}};U(exports.UniverSheetsDrawingPlugin,"pluginName",S);U(exports.UniverSheetsDrawingPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsDrawingPlugin=b([a.DependentOn(v.UniverDrawingPlugin),d(1,a.Inject(a.Injector)),d(2,a.IConfigService)],exports.UniverSheetsDrawingPlugin);exports.DrawingApplyType=N;exports.ISheetDrawingService=_;exports.SHEET_DRAWING_PLUGIN=S;exports.SetDrawingApplyMutation=P;exports.SheetDrawingAnchorType=f;
|
package/lib/es/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { createIdentifier as U, CommandType as E, Disposable as l, UniverInstanceType as
|
|
1
|
+
import { createIdentifier as U, CommandType as E, Disposable as l, UniverInstanceType as h, ICommandService as D, IResourceManagerService as I, DependentOn as w, Inject as O, Injector as R, Plugin as b, merge as p, IConfigService as M } from "@univerjs/core";
|
|
2
2
|
import { UnitDrawingService as G, IDrawingManagerService as d, UniverDrawingPlugin as C } from "@univerjs/drawing";
|
|
3
|
-
const J = "sheets-drawing.config",
|
|
3
|
+
const J = "sheets-drawing.config", v = {};
|
|
4
4
|
var j = /* @__PURE__ */ ((e) => (e.Position = "0", e.Both = "1", e.None = "2", e))(j || {});
|
|
5
5
|
class L extends G {
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const u = U("sheets-drawing.sheet-drawing.service");
|
|
8
8
|
var F = /* @__PURE__ */ ((e) => (e[e.INSERT = 0] = "INSERT", e[e.REMOVE = 1] = "REMOVE", e[e.UPDATE = 2] = "UPDATE", e[e.ARRANGE = 3] = "ARRANGE", e[e.GROUP = 4] = "GROUP", e[e.UNGROUP = 5] = "UNGROUP", e))(F || {});
|
|
9
9
|
const H = {
|
|
10
10
|
id: "sheet.mutation.set-drawing-apply",
|
|
11
11
|
type: E.MUTATION,
|
|
12
12
|
handler: (e, i) => {
|
|
13
|
-
const r = e.get(d), t = e.get(
|
|
13
|
+
const r = e.get(d), t = e.get(u), { op: n, unitId: a, subUnitId: s, type: P, objects: o } = i;
|
|
14
14
|
switch (r.applyJson1(a, s, n), t.applyJson1(a, s, n), P) {
|
|
15
15
|
case 0:
|
|
16
16
|
r.addNotification(o), t.addNotification(o);
|
|
@@ -60,7 +60,7 @@ let g = class extends l {
|
|
|
60
60
|
this.disposeWithMe(
|
|
61
61
|
this._resourceManagerService.registerPluginResource({
|
|
62
62
|
pluginName: S,
|
|
63
|
-
businesses: [
|
|
63
|
+
businesses: [h.UNIVER_SHEET],
|
|
64
64
|
toJson: (r, t) => e(r, t),
|
|
65
65
|
parseJson: (r) => i(r),
|
|
66
66
|
onUnLoad: (r) => {
|
|
@@ -75,7 +75,7 @@ let g = class extends l {
|
|
|
75
75
|
};
|
|
76
76
|
g = V([
|
|
77
77
|
c(0, D),
|
|
78
|
-
c(1,
|
|
78
|
+
c(1, u),
|
|
79
79
|
c(2, d),
|
|
80
80
|
c(3, I)
|
|
81
81
|
], g);
|
|
@@ -83,13 +83,13 @@ var N = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, B = (e, i, r
|
|
|
83
83
|
for (var n = t > 1 ? void 0 : t ? $(i, r) : i, a = e.length - 1, s; a >= 0; a--)
|
|
84
84
|
(s = e[a]) && (n = (t ? s(i, r, n) : s(n)) || n);
|
|
85
85
|
return t && n && N(i, r, n), n;
|
|
86
|
-
},
|
|
86
|
+
}, f = (e, i) => (r, t) => i(r, t, e), m = (e, i, r) => B(e, typeof i != "symbol" ? i + "" : i, r);
|
|
87
87
|
let _ = class extends b {
|
|
88
|
-
constructor(e =
|
|
88
|
+
constructor(e = v, i, r) {
|
|
89
89
|
super(), this._config = e, this._injector = i, this._configService = r;
|
|
90
90
|
const { ...t } = p(
|
|
91
91
|
{},
|
|
92
|
-
|
|
92
|
+
v,
|
|
93
93
|
this._config
|
|
94
94
|
);
|
|
95
95
|
this._configService.setConfig(J, t);
|
|
@@ -97,20 +97,20 @@ let _ = class extends b {
|
|
|
97
97
|
onStarting() {
|
|
98
98
|
[
|
|
99
99
|
[g],
|
|
100
|
-
[
|
|
100
|
+
[u, { useClass: L }]
|
|
101
101
|
].forEach((e) => this._injector.add(e)), this._injector.get(g);
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
m(_, "pluginName", S);
|
|
105
|
-
m(_, "type",
|
|
105
|
+
m(_, "type", h.UNIVER_SHEET);
|
|
106
106
|
_ = K([
|
|
107
107
|
w(C),
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
f(1, O(R)),
|
|
109
|
+
f(2, M)
|
|
110
110
|
], _);
|
|
111
111
|
export {
|
|
112
112
|
F as DrawingApplyType,
|
|
113
|
-
|
|
113
|
+
u as ISheetDrawingService,
|
|
114
114
|
S as SHEET_DRAWING_PLUGIN,
|
|
115
115
|
H as SetDrawingApplyMutation,
|
|
116
116
|
j as SheetDrawingAnchorType,
|
|
@@ -2,8 +2,17 @@ import { IDrawingParam, IRotationSkewFlipTransform, Serializable } from '@univer
|
|
|
2
2
|
import { ISheetOverGridPosition } from '@univerjs/sheets';
|
|
3
3
|
import { IImageData, IUnitDrawingService, UnitDrawingService } from '@univerjs/drawing';
|
|
4
4
|
export declare enum SheetDrawingAnchorType {
|
|
5
|
+
/**
|
|
6
|
+
* 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.
|
|
7
|
+
*/
|
|
5
8
|
Position = "0",
|
|
9
|
+
/**
|
|
10
|
+
* 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.
|
|
11
|
+
*/
|
|
6
12
|
Both = "1",
|
|
13
|
+
/**
|
|
14
|
+
* 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.
|
|
15
|
+
*/
|
|
7
16
|
None = "2"
|
|
8
17
|
}
|
|
9
18
|
export interface ISheetDrawingPosition extends IRotationSkewFlipTransform, ISheetOverGridPosition {
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(a,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],s):(a=typeof globalThis<"u"?globalThis:a||self,s(a.UniverSheetsDrawing={},a.UniverCore,a.UniverDrawing))})(this,function(a,s,u){"use strict";const l="sheets-drawing.config",f={};var d=(e=>(e.Position="0",e.Both="1",e.None="2",e))(d||{});class m extends u.UnitDrawingService{}const v=s.createIdentifier("sheets-drawing.sheet-drawing.service");var U=(e=>(e[e.INSERT=0]="INSERT",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE",e[e.ARRANGE=3]="ARRANGE",e[e.GROUP=4]="GROUP",e[e.UNGROUP=5]="UNGROUP",e))(U||{});const D={id:"sheet.mutation.set-drawing-apply",type:s.CommandType.MUTATION,handler:(e,
|
|
1
|
+
(function(a,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],s):(a=typeof globalThis<"u"?globalThis:a||self,s(a.UniverSheetsDrawing={},a.UniverCore,a.UniverDrawing))})(this,function(a,s,u){"use strict";const l="sheets-drawing.config",f={};var d=(e=>(e.Position="0",e.Both="1",e.None="2",e))(d||{});class m extends u.UnitDrawingService{}const v=s.createIdentifier("sheets-drawing.sheet-drawing.service");var U=(e=>(e[e.INSERT=0]="INSERT",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE",e[e.ARRANGE=3]="ARRANGE",e[e.GROUP=4]="GROUP",e[e.UNGROUP=5]="UNGROUP",e))(U||{});const D={id:"sheet.mutation.set-drawing-apply",type:s.CommandType.MUTATION,handler:(e,n)=>{const i=e.get(u.IDrawingManagerService),r=e.get(v),{op:t,unitId:o,subUnitId:c,type:M,objects:g}=n;switch(i.applyJson1(o,c,t),r.applyJson1(o,c,t),M){case 0:i.addNotification(g),r.addNotification(g);break;case 1:i.removeNotification(g),r.removeNotification(g);break;case 2:i.updateNotification(g),r.updateNotification(g);break;case 3:i.orderNotification(g),r.orderNotification(g);break;case 4:i.groupUpdateNotification(g);break;case 5:i.ungroupUpdateNotification(g);break}return!0}};var E=Object.defineProperty,I=Object.getOwnPropertyDescriptor,O=(e,n,i,r)=>{for(var t=r>1?void 0:r?I(n,i):n,o=e.length-1,c;o>=0;o--)(c=e[o])&&(t=(r?c(n,i,t):c(t))||t);return r&&t&&E(n,i,t),t},h=(e,n)=>(i,r)=>n(i,r,e);const _="SHEET_DRAWING_PLUGIN";let S=class extends s.Disposable{constructor(e,n,i,r){super(),this._commandService=e,this._sheetDrawingService=n,this._drawingManagerService=i,this._resourceManagerService=r,this._initSnapshot(),this.disposeWithMe(this._commandService.registerCommand(D))}_initSnapshot(){const e=(i,r)=>{const t=r||this._sheetDrawingService.getDrawingDataForUnit(i);return t?JSON.stringify(t):""},n=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:_,businesses:[s.UniverInstanceType.UNIVER_SHEET],toJson:(i,r)=>e(i,r),parseJson:i=>n(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,r)=>{this._sheetDrawingService.registerDrawingData(i,r),this._drawingManagerService.registerDrawingData(i,r)}}))}};S=O([h(0,s.ICommandService),h(1,v),h(2,u.IDrawingManagerService),h(3,s.IResourceManagerService)],S);var N=Object.defineProperty,R=Object.getOwnPropertyDescriptor,b=(e,n,i)=>n in e?N(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i,p=(e,n,i,r)=>{for(var t=r>1?void 0:r?R(n,i):n,o=e.length-1,c;o>=0;o--)(c=e[o])&&(t=(r?c(n,i,t):c(t))||t);return r&&t&&N(n,i,t),t},P=(e,n)=>(i,r)=>n(i,r,e),w=(e,n,i)=>b(e,typeof n!="symbol"?n+"":n,i);a.UniverSheetsDrawingPlugin=class extends s.Plugin{constructor(n=f,i,r){super(),this._config=n,this._injector=i,this._configService=r;const{...t}=s.merge({},f,this._config);this._configService.setConfig(l,t)}onStarting(){[[S],[v,{useClass:m}]].forEach(n=>this._injector.add(n)),this._injector.get(S)}},w(a.UniverSheetsDrawingPlugin,"pluginName",_),w(a.UniverSheetsDrawingPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),a.UniverSheetsDrawingPlugin=p([s.DependentOn(u.UniverDrawingPlugin),P(1,s.Inject(s.Injector)),P(2,s.IConfigService)],a.UniverSheetsDrawingPlugin),a.DrawingApplyType=U,a.ISheetDrawingService=v,a.SHEET_DRAWING_PLUGIN=_,a.SetDrawingApplyMutation=D,a.SheetDrawingAnchorType=d,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-drawing",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"lib"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@univerjs/core": "0.5.
|
|
47
|
-
"@univerjs/drawing": "0.5.
|
|
46
|
+
"@univerjs/core": "0.5.4",
|
|
47
|
+
"@univerjs/drawing": "0.5.4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"typescript": "^5.7.2",
|
|
51
|
-
"vite": "^6.0.
|
|
51
|
+
"vite": "^6.0.7",
|
|
52
52
|
"vitest": "^2.1.8",
|
|
53
|
-
"@univerjs-infra/shared": "0.5.
|
|
54
|
-
"@univerjs/sheets": "0.5.
|
|
53
|
+
"@univerjs-infra/shared": "0.5.4",
|
|
54
|
+
"@univerjs/sheets": "0.5.4"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"test": "vitest run",
|