@univerjs/sheets-drawing 0.6.1 → 0.6.2
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/es/index.js +31 -31
- package/lib/umd/index.js +1 -1
- package/package.json +7 -7
package/lib/es/index.js
CHANGED
|
@@ -10,49 +10,49 @@ const F = {
|
|
|
10
10
|
id: "sheet.mutation.set-drawing-apply",
|
|
11
11
|
type: E.MUTATION,
|
|
12
12
|
handler: (e, i) => {
|
|
13
|
-
const
|
|
14
|
-
switch (
|
|
13
|
+
const t = e.get(S), r = e.get(v), { op: n, unitId: a, subUnitId: o, type: m, objects: s } = i;
|
|
14
|
+
switch (t.applyJson1(a, o, n), r.applyJson1(a, o, n), m) {
|
|
15
15
|
case 0:
|
|
16
|
-
|
|
16
|
+
t.addNotification(s), r.addNotification(s);
|
|
17
17
|
break;
|
|
18
18
|
case 1:
|
|
19
|
-
|
|
19
|
+
t.removeNotification(s), r.removeNotification(s);
|
|
20
20
|
break;
|
|
21
21
|
case 2:
|
|
22
|
-
|
|
22
|
+
t.updateNotification(s), r.updateNotification(s);
|
|
23
23
|
break;
|
|
24
24
|
case 3:
|
|
25
|
-
|
|
25
|
+
t.orderNotification(s), r.orderNotification(s);
|
|
26
26
|
break;
|
|
27
27
|
case 4:
|
|
28
|
-
|
|
28
|
+
t.groupUpdateNotification(s);
|
|
29
29
|
break;
|
|
30
30
|
case 5:
|
|
31
|
-
|
|
31
|
+
t.ungroupUpdateNotification(s);
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
return !0;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
var H = Object.getOwnPropertyDescriptor, W = (e, i,
|
|
38
|
-
for (var n =
|
|
37
|
+
var H = Object.getOwnPropertyDescriptor, W = (e, i, t, r) => {
|
|
38
|
+
for (var n = r > 1 ? void 0 : r ? H(i, t) : i, a = e.length - 1, o; a >= 0; a--)
|
|
39
39
|
(o = e[a]) && (n = o(n) || n);
|
|
40
40
|
return n;
|
|
41
|
-
}, c = (e, i) => (
|
|
41
|
+
}, c = (e, i) => (t, r) => i(t, r, e);
|
|
42
42
|
const f = "SHEET_DRAWING_PLUGIN";
|
|
43
43
|
let g = class extends P {
|
|
44
|
-
constructor(e, i,
|
|
45
|
-
super(), this._commandService = e, this._sheetDrawingService = i, this._drawingManagerService =
|
|
44
|
+
constructor(e, i, t, r) {
|
|
45
|
+
super(), this._commandService = e, this._sheetDrawingService = i, this._drawingManagerService = t, this._resourceManagerService = r, this._initSnapshot(), this.disposeWithMe(this._commandService.registerCommand(F));
|
|
46
46
|
}
|
|
47
47
|
_initSnapshot() {
|
|
48
|
-
const e = (
|
|
49
|
-
const n =
|
|
48
|
+
const e = (t, r) => {
|
|
49
|
+
const n = r || this._sheetDrawingService.getDrawingDataForUnit(t);
|
|
50
50
|
return n ? JSON.stringify(n) : "";
|
|
51
|
-
}, i = (
|
|
52
|
-
if (!
|
|
51
|
+
}, i = (t) => {
|
|
52
|
+
if (!t)
|
|
53
53
|
return {};
|
|
54
54
|
try {
|
|
55
|
-
return JSON.parse(
|
|
55
|
+
return JSON.parse(t);
|
|
56
56
|
} catch {
|
|
57
57
|
return {};
|
|
58
58
|
}
|
|
@@ -61,13 +61,13 @@ let g = class extends P {
|
|
|
61
61
|
this._resourceManagerService.registerPluginResource({
|
|
62
62
|
pluginName: f,
|
|
63
63
|
businesses: [h.UNIVER_SHEET],
|
|
64
|
-
toJson: (
|
|
65
|
-
parseJson: (
|
|
66
|
-
onUnLoad: (
|
|
67
|
-
this._sheetDrawingService.removeDrawingDataForUnit(
|
|
64
|
+
toJson: (t, r) => e(t, r),
|
|
65
|
+
parseJson: (t) => i(t),
|
|
66
|
+
onUnLoad: (t) => {
|
|
67
|
+
this._sheetDrawingService.removeDrawingDataForUnit(t), this._drawingManagerService.removeDrawingDataForUnit(t);
|
|
68
68
|
},
|
|
69
|
-
onLoad: (
|
|
70
|
-
this._sheetDrawingService.registerDrawingData(
|
|
69
|
+
onLoad: (t, r) => {
|
|
70
|
+
this._sheetDrawingService.registerDrawingData(t, r), this._drawingManagerService.registerDrawingData(t, r);
|
|
71
71
|
}
|
|
72
72
|
})
|
|
73
73
|
);
|
|
@@ -79,20 +79,20 @@ g = W([
|
|
|
79
79
|
c(2, S),
|
|
80
80
|
c(3, D)
|
|
81
81
|
], g);
|
|
82
|
-
var x = Object.defineProperty, V = Object.getOwnPropertyDescriptor, $ = (e, i,
|
|
83
|
-
for (var n =
|
|
82
|
+
var x = Object.defineProperty, V = Object.getOwnPropertyDescriptor, $ = (e, i, t) => i in e ? x(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t, B = (e, i, t, r) => {
|
|
83
|
+
for (var n = r > 1 ? void 0 : r ? V(i, t) : i, a = e.length - 1, o; a >= 0; a--)
|
|
84
84
|
(o = e[a]) && (n = o(n) || n);
|
|
85
85
|
return n;
|
|
86
|
-
}, u = (e, i) => (
|
|
86
|
+
}, u = (e, i) => (t, r) => i(t, r, e), N = (e, i, t) => $(e, typeof i != "symbol" ? i + "" : i, t);
|
|
87
87
|
let _ = class extends b {
|
|
88
|
-
constructor(e = d, i,
|
|
89
|
-
super(), this._config = e, this._injector = i, this._configService =
|
|
90
|
-
const { ...
|
|
88
|
+
constructor(e = d, i, t) {
|
|
89
|
+
super(), this._config = e, this._injector = i, this._configService = t;
|
|
90
|
+
const { ...r } = M(
|
|
91
91
|
{},
|
|
92
92
|
d,
|
|
93
93
|
this._config
|
|
94
94
|
);
|
|
95
|
-
this._configService.setConfig(C,
|
|
95
|
+
this._configService.setConfig(C, r);
|
|
96
96
|
}
|
|
97
97
|
onStarting() {
|
|
98
98
|
[
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(n,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],a):(n=typeof globalThis<"u"?globalThis:n||self,a(n.UniverSheetsDrawing={},n.UniverCore,n.UniverDrawing))})(this,function(n,a,u){"use strict";const w="sheets-drawing.config",_={};var f=(e=>(e.Position="0",e.Both="1",e.None="2",e))(f||{});class l extends u.UnitDrawingService{}const v=a.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:a.CommandType.MUTATION,handler:(e,
|
|
1
|
+
(function(n,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],a):(n=typeof globalThis<"u"?globalThis:n||self,a(n.UniverSheetsDrawing={},n.UniverCore,n.UniverDrawing))})(this,function(n,a,u){"use strict";const w="sheets-drawing.config",_={};var f=(e=>(e.Position="0",e.Both="1",e.None="2",e))(f||{});class l extends u.UnitDrawingService{}const v=a.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:a.CommandType.MUTATION,handler:(e,t)=>{const i=e.get(u.IDrawingManagerService),r=e.get(v),{op:s,unitId:o,subUnitId:g,type:M,objects:c}=t;switch(i.applyJson1(o,g,s),r.applyJson1(o,g,s),M){case 0:i.addNotification(c),r.addNotification(c);break;case 1:i.removeNotification(c),r.removeNotification(c);break;case 2:i.updateNotification(c),r.updateNotification(c);break;case 3:i.orderNotification(c),r.orderNotification(c);break;case 4:i.groupUpdateNotification(c);break;case 5:i.ungroupUpdateNotification(c);break}return!0}};var m=Object.getOwnPropertyDescriptor,E=(e,t,i,r)=>{for(var s=r>1?void 0:r?m(t,i):t,o=e.length-1,g;o>=0;o--)(g=e[o])&&(s=g(s)||s);return s},h=(e,t)=>(i,r)=>t(i,r,e);const S="SHEET_DRAWING_PLUGIN";let d=class extends a.Disposable{constructor(e,t,i,r){super(),this._commandService=e,this._sheetDrawingService=t,this._drawingManagerService=i,this._resourceManagerService=r,this._initSnapshot(),this.disposeWithMe(this._commandService.registerCommand(D))}_initSnapshot(){const e=(i,r)=>{const s=r||this._sheetDrawingService.getDrawingDataForUnit(i);return s?JSON.stringify(s):""},t=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:S,businesses:[a.UniverInstanceType.UNIVER_SHEET],toJson:(i,r)=>e(i,r),parseJson:i=>t(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,r)=>{this._sheetDrawingService.registerDrawingData(i,r),this._drawingManagerService.registerDrawingData(i,r)}}))}};d=E([h(0,a.ICommandService),h(1,v),h(2,u.IDrawingManagerService),h(3,a.IResourceManagerService)],d);var I=Object.defineProperty,R=Object.getOwnPropertyDescriptor,O=(e,t,i)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,b=(e,t,i,r)=>{for(var s=r>1?void 0:r?R(t,i):t,o=e.length-1,g;o>=0;o--)(g=e[o])&&(s=g(s)||s);return s},N=(e,t)=>(i,r)=>t(i,r,e),P=(e,t,i)=>O(e,typeof t!="symbol"?t+"":t,i);n.UniverSheetsDrawingPlugin=class extends a.Plugin{constructor(t=_,i,r){super(),this._config=t,this._injector=i,this._configService=r;const{...s}=a.merge({},_,this._config);this._configService.setConfig(w,s)}onStarting(){[[d],[v,{useClass:l}]].forEach(t=>this._injector.add(t)),this._injector.get(d)}},P(n.UniverSheetsDrawingPlugin,"pluginName",S),P(n.UniverSheetsDrawingPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),n.UniverSheetsDrawingPlugin=b([a.DependentOn(u.UniverDrawingPlugin),N(1,a.Inject(a.Injector)),N(2,a.IConfigService)],n.UniverSheetsDrawingPlugin),n.DrawingApplyType=U,n.ISheetDrawingService=v,n.SHEET_DRAWING_PLUGIN=S,n.SetDrawingApplyMutation=D,n.SheetDrawingAnchorType=f,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-drawing",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
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.6.
|
|
47
|
-
"@univerjs/drawing": "0.6.
|
|
46
|
+
"@univerjs/core": "0.6.2",
|
|
47
|
+
"@univerjs/drawing": "0.6.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"typescript": "^5.7.3",
|
|
51
|
-
"vite": "^6.
|
|
52
|
-
"vitest": "^3.0.
|
|
53
|
-
"@univerjs-infra/shared": "0.6.
|
|
54
|
-
"@univerjs/sheets": "0.6.
|
|
51
|
+
"vite": "^6.2.0",
|
|
52
|
+
"vitest": "^3.0.7",
|
|
53
|
+
"@univerjs-infra/shared": "0.6.2",
|
|
54
|
+
"@univerjs/sheets": "0.6.2"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"test": "vitest run",
|