@univerjs/docs-drawing 0.5.1 → 0.5.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/cjs/index.js +1 -1
- package/lib/es/index.js +45 -41
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var f=Object.defineProperty;var p=(i,e,t)=>e in i?f(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var _=(i,e,t)=>p(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),h=require("@univerjs/drawing"),U="docs-drawing.config",u={};class v extends h.UnitDrawingService{}const l=o.createIdentifier("univer.doc.plugin.doc-drawing.service");var I=Object.defineProperty,O=Object.getOwnPropertyDescriptor,P=(i,e,t,r)=>{for(var n=r>1?void 0:r?O(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&I(e,t,n),n},g=(i,e)=>(t,r)=>e(t,r,i);const d="DOC_DRAWING_PLUGIN";exports.DocDrawingController=class extends o.Disposable{constructor(e,t,r,n){super(),this._docDrawingService=e,this._drawingManagerService=t,this._resourceManagerService=r,this._univerInstanceService=n,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const e=r=>{const n=this._univerInstanceService.getUnit(r,o.UniverInstanceType.UNIVER_DOC);if(n){const a=n.getSnapshot().drawings,s=n.getSnapshot().drawingsOrder,c={data:a!=null?a:{},order:s!=null?s:[]};return JSON.stringify(c)}return""},t=r=>{if(!r)return{data:{},order:[]};try{return JSON.parse(r)}catch{return{data:{},order:[]}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:d,businesses:[o.UniverInstanceType.UNIVER_DOC],toJson:r=>e(r),parseJson:r=>t(r),onUnLoad:r=>{this._setDrawingDataForUnit(r,{data:{},order:[]})},onLoad:(r,n)=>{var a,s;this._setDrawingDataForUnit(r,{data:(a=n.data)!=null?a:{},order:(s=n.order)!=null?s:[]})}}))}_setDrawingDataForUnit(e,t){const r=this._univerInstanceService.getUnit(e);r!=null&&(r.resetDrawing(t.data,t.order),this.loadDrawingDataForUnit(e))}loadDrawingDataForUnit(e){const t=this._univerInstanceService.getUnit(e,o.UniverInstanceType.UNIVER_DOC);if(!t)return!1;const r=e,n=t.getDrawings(),a=t.getDrawingsOrder();if(!n||!a)return!1;Object.keys(n).forEach(c=>{const S=n[c];n[c]={...S}});const s={[r]:{unitId:e,subUnitId:r,data:n,order:a}};return this._docDrawingService.registerDrawingData(e,s),this._drawingManagerService.registerDrawingData(e,s),!0}};exports.DocDrawingController=P([g(0,l),g(1,h.IDrawingManagerService),g(2,o.IResourceManagerService),g(3,o.IUniverInstanceService)],exports.DocDrawingController);var C=Object.defineProperty,N=Object.getOwnPropertyDescriptor,M=(i,e,t,r)=>{for(var n=r>1?void 0:r?N(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&C(e,t,n),n},w=(i,e)=>(t,r)=>e(t,r,i),D;exports.UniverDocsDrawingPlugin=(D=class extends o.Plugin{constructor(e=u,t,r){super(),this._config=e,this._injector=t,this._configService=r;const{...n}=o.merge({},u,this._config);this._configService.setConfig(U,n)}onStarting(){[[exports.DocDrawingController],[v],[l,{useClass:v}]].forEach(e=>this._injector.add(e)),o.touchDependencies(this._injector,[[exports.DocDrawingController]])}},_(D,"pluginName",d),_(D,"type",o.UniverInstanceType.UNIVER_DOC),D);exports.UniverDocsDrawingPlugin=M([w(1,o.Inject(o.Injector)),w(2,o.IConfigService)],exports.UniverDocsDrawingPlugin);exports.DOCS_DRAWING_PLUGIN=d;exports.DocDrawingService=v;exports.IDocDrawingService=l;
|
package/lib/es/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var D = (t, r, e) =>
|
|
4
|
-
import { createIdentifier as
|
|
5
|
-
import { UnitDrawingService as
|
|
6
|
-
const
|
|
7
|
-
class
|
|
1
|
+
var w = Object.defineProperty;
|
|
2
|
+
var S = (t, r, e) => r in t ? w(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
+
var D = (t, r, e) => S(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { createIdentifier as O, Disposable as U, UniverInstanceType as g, IResourceManagerService as I, IUniverInstanceService as P, Plugin as C, merge as N, touchDependencies as M, Inject as b, Injector as j, IConfigService as m } from "@univerjs/core";
|
|
5
|
+
import { UnitDrawingService as R, IDrawingManagerService as E } from "@univerjs/drawing";
|
|
6
|
+
const G = "docs-drawing.config", d = {};
|
|
7
|
+
class v extends R {
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
var
|
|
11
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
9
|
+
const l = O("univer.doc.plugin.doc-drawing.service");
|
|
10
|
+
var F = Object.defineProperty, J = Object.getOwnPropertyDescriptor, y = (t, r, e, n) => {
|
|
11
|
+
for (var i = n > 1 ? void 0 : n ? J(r, e) : r, a = t.length - 1, s; a >= 0; a--)
|
|
12
12
|
(s = t[a]) && (i = (n ? s(r, e, i) : s(i)) || i);
|
|
13
|
-
return n && i &&
|
|
13
|
+
return n && i && F(r, e, i), i;
|
|
14
14
|
}, o = (t, r) => (e, n) => r(e, n, t);
|
|
15
|
-
const
|
|
16
|
-
let _ = class extends
|
|
15
|
+
const f = "DOC_DRAWING_PLUGIN";
|
|
16
|
+
let _ = class extends U {
|
|
17
17
|
constructor(t, r, e, n) {
|
|
18
18
|
super(), this._docDrawingService = t, this._drawingManagerService = r, this._resourceManagerService = e, this._univerInstanceService = n, this._init();
|
|
19
19
|
}
|
|
@@ -42,7 +42,7 @@ let _ = class extends O {
|
|
|
42
42
|
};
|
|
43
43
|
this.disposeWithMe(
|
|
44
44
|
this._resourceManagerService.registerPluginResource({
|
|
45
|
-
pluginName:
|
|
45
|
+
pluginName: f,
|
|
46
46
|
businesses: [g.UNIVER_DOC],
|
|
47
47
|
toJson: (e) => t(e),
|
|
48
48
|
parseJson: (e) => r(e),
|
|
@@ -68,8 +68,8 @@ let _ = class extends O {
|
|
|
68
68
|
if (!n || !i)
|
|
69
69
|
return !1;
|
|
70
70
|
Object.keys(n).forEach((s) => {
|
|
71
|
-
const
|
|
72
|
-
n[s] = { ...
|
|
71
|
+
const p = n[s];
|
|
72
|
+
n[s] = { ...p };
|
|
73
73
|
});
|
|
74
74
|
const a = {
|
|
75
75
|
[e]: {
|
|
@@ -82,41 +82,45 @@ let _ = class extends O {
|
|
|
82
82
|
return this._docDrawingService.registerDrawingData(t, a), this._drawingManagerService.registerDrawingData(t, a), !0;
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
|
-
_ =
|
|
86
|
-
o(0,
|
|
87
|
-
o(1,
|
|
88
|
-
o(2,
|
|
89
|
-
o(3,
|
|
85
|
+
_ = y([
|
|
86
|
+
o(0, l),
|
|
87
|
+
o(1, E),
|
|
88
|
+
o(2, I),
|
|
89
|
+
o(3, P)
|
|
90
90
|
], _);
|
|
91
|
-
var
|
|
92
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
91
|
+
var L = Object.defineProperty, x = Object.getOwnPropertyDescriptor, V = (t, r, e, n) => {
|
|
92
|
+
for (var i = n > 1 ? void 0 : n ? x(r, e) : r, a = t.length - 1, s; a >= 0; a--)
|
|
93
93
|
(s = t[a]) && (i = (n ? s(r, e, i) : s(i)) || i);
|
|
94
|
-
return n && i &&
|
|
95
|
-
},
|
|
96
|
-
let
|
|
97
|
-
constructor(t =
|
|
94
|
+
return n && i && L(r, e, i), i;
|
|
95
|
+
}, u = (t, r) => (e, n) => r(e, n, t), c;
|
|
96
|
+
let h = (c = class extends C {
|
|
97
|
+
constructor(t = d, r, e) {
|
|
98
98
|
super(), this._config = t, this._injector = r, this._configService = e;
|
|
99
|
-
const { ...n } =
|
|
100
|
-
|
|
99
|
+
const { ...n } = N(
|
|
100
|
+
{},
|
|
101
|
+
d,
|
|
102
|
+
this._config
|
|
103
|
+
);
|
|
104
|
+
this._configService.setConfig(G, n);
|
|
101
105
|
}
|
|
102
106
|
onStarting() {
|
|
103
107
|
[
|
|
104
108
|
[_],
|
|
105
|
-
[
|
|
106
|
-
[
|
|
107
|
-
].forEach((t) => this._injector.add(t)),
|
|
109
|
+
[v],
|
|
110
|
+
[l, { useClass: v }]
|
|
111
|
+
].forEach((t) => this._injector.add(t)), M(this._injector, [
|
|
108
112
|
[_]
|
|
109
113
|
]);
|
|
110
114
|
}
|
|
111
|
-
}, D(c, "pluginName",
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
],
|
|
115
|
+
}, D(c, "pluginName", f), D(c, "type", g.UNIVER_DOC), c);
|
|
116
|
+
h = V([
|
|
117
|
+
u(1, b(j)),
|
|
118
|
+
u(2, m)
|
|
119
|
+
], h);
|
|
116
120
|
export {
|
|
117
|
-
|
|
121
|
+
f as DOCS_DRAWING_PLUGIN,
|
|
118
122
|
_ as DocDrawingController,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
v as DocDrawingService,
|
|
124
|
+
l as IDocDrawingService,
|
|
125
|
+
h as UniverDocsDrawingPlugin
|
|
122
126
|
};
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],i):(t=typeof globalThis<"u"?globalThis:t||self,i(t.UniverDocsDrawing={},t.UniverCore,t.UniverDrawing))})(this,function(t,i,
|
|
1
|
+
(function(t,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],i):(t=typeof globalThis<"u"?globalThis:t||self,i(t.UniverDocsDrawing={},t.UniverCore,t.UniverDrawing))})(this,function(t,i,g){"use strict";var j=Object.defineProperty;var y=(t,i,g)=>i in t?j(t,i,{enumerable:!0,configurable:!0,writable:!0,value:g}):t[i]=g;var f=(t,i,g)=>y(t,typeof i!="symbol"?i+"":i,g);var v;const S="docs-drawing.config",w={};class u extends g.UnitDrawingService{}const _=i.createIdentifier("univer.doc.plugin.doc-drawing.service");var U=Object.defineProperty,p=Object.getOwnPropertyDescriptor,I=(c,n,a,e)=>{for(var r=e>1?void 0:e?p(n,a):n,s=c.length-1,o;s>=0;s--)(o=c[s])&&(r=(e?o(n,a,r):o(r))||r);return e&&r&&U(n,a,r),r},D=(c,n)=>(a,e)=>n(a,e,c);const l="DOC_DRAWING_PLUGIN";t.DocDrawingController=class extends i.Disposable{constructor(n,a,e,r){super(),this._docDrawingService=n,this._drawingManagerService=a,this._resourceManagerService=e,this._univerInstanceService=r,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const n=e=>{const r=this._univerInstanceService.getUnit(e,i.UniverInstanceType.UNIVER_DOC);if(r){const s=r.getSnapshot().drawings,o=r.getSnapshot().drawingsOrder,d={data:s!=null?s:{},order:o!=null?o:[]};return JSON.stringify(d)}return""},a=e=>{if(!e)return{data:{},order:[]};try{return JSON.parse(e)}catch{return{data:{},order:[]}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:l,businesses:[i.UniverInstanceType.UNIVER_DOC],toJson:e=>n(e),parseJson:e=>a(e),onUnLoad:e=>{this._setDrawingDataForUnit(e,{data:{},order:[]})},onLoad:(e,r)=>{var s,o;this._setDrawingDataForUnit(e,{data:(s=r.data)!=null?s:{},order:(o=r.order)!=null?o:[]})}}))}_setDrawingDataForUnit(n,a){const e=this._univerInstanceService.getUnit(n);e!=null&&(e.resetDrawing(a.data,a.order),this.loadDrawingDataForUnit(n))}loadDrawingDataForUnit(n){const a=this._univerInstanceService.getUnit(n,i.UniverInstanceType.UNIVER_DOC);if(!a)return!1;const e=n,r=a.getDrawings(),s=a.getDrawingsOrder();if(!r||!s)return!1;Object.keys(r).forEach(d=>{const N=r[d];r[d]={...N}});const o={[e]:{unitId:n,subUnitId:e,data:r,order:s}};return this._docDrawingService.registerDrawingData(n,o),this._drawingManagerService.registerDrawingData(n,o),!0}},t.DocDrawingController=I([D(0,_),D(1,g.IDrawingManagerService),D(2,i.IResourceManagerService),D(3,i.IUniverInstanceService)],t.DocDrawingController);var O=Object.defineProperty,C=Object.getOwnPropertyDescriptor,P=(c,n,a,e)=>{for(var r=e>1?void 0:e?C(n,a):n,s=c.length-1,o;s>=0;s--)(o=c[s])&&(r=(e?o(n,a,r):o(r))||r);return e&&r&&O(n,a,r),r},h=(c,n)=>(a,e)=>n(a,e,c);t.UniverDocsDrawingPlugin=(v=class extends i.Plugin{constructor(n=w,a,e){super(),this._config=n,this._injector=a,this._configService=e;const{...r}=i.merge({},w,this._config);this._configService.setConfig(S,r)}onStarting(){[[t.DocDrawingController],[u],[_,{useClass:u}]].forEach(n=>this._injector.add(n)),i.touchDependencies(this._injector,[[t.DocDrawingController]])}},f(v,"pluginName",l),f(v,"type",i.UniverInstanceType.UNIVER_DOC),v),t.UniverDocsDrawingPlugin=P([h(1,i.Inject(i.Injector)),h(2,i.IConfigService)],t.UniverDocsDrawingPlugin),t.DOCS_DRAWING_PLUGIN=l,t.DocDrawingService=u,t.IDocDrawingService=_,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/docs-drawing",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"lib"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@univerjs/
|
|
47
|
-
"@univerjs/
|
|
46
|
+
"@univerjs/core": "0.5.2",
|
|
47
|
+
"@univerjs/drawing": "0.5.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"typescript": "^5.7.2",
|
|
51
|
-
"vite": "^6.0.
|
|
52
|
-
"vitest": "^2.1.
|
|
53
|
-
"@univerjs-infra/shared": "0.5.
|
|
51
|
+
"vite": "^6.0.3",
|
|
52
|
+
"vitest": "^2.1.8",
|
|
53
|
+
"@univerjs-infra/shared": "0.5.2"
|
|
54
54
|
},
|
|
55
55
|
"space": {
|
|
56
56
|
".": {
|