@univerjs/sheets-drawing 0.2.4-alpha.0 → 0.2.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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var E=Object.defineProperty;var p=(e,t,i)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var d=(e,t,i)=>p(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),h=require("@wendellhu/redi"),l=require("@univerjs/drawing"),f=require("rxjs/operators");var I=(e=>(e.Position="0",e.Both="1",e.None="2",e))(I||{});class m extends l.UnitDrawingService{}const _=h.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 N={id:"sheet.mutation.set-drawing-apply",type:a.CommandType.MUTATION,handler:(e,t)=>{const i=e.get(l.IDrawingManagerService),r=e.get(_),{op:n,unitId:s,subUnitId:c,type:P,objects:o}=t;switch(i.applyJson1(s,c,n),r.applyJson1(s,c,n),P){case 0:i.addNotification(o),r.addNotification(o);break;case 1:i.removeNotification(o),r.removeNotification(o);break;case 2:i.updateNotification(o),r.updateNotification(o);break;case 3:i.orderNotification(o),r.orderNotification(o);break;case 4:i.groupUpdateNotification(o);break;case 5:i.ungroupUpdateNotification(o);break}return!0}};var O=Object.defineProperty,b=Object.getOwnPropertyDescriptor,w=(e,t,i,r)=>{for(var n=r>1?void 0:r?b(t,i):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(n=(r?c(t,i,n):c(n))||n);return r&&n&&O(t,i,n),n},v=(e,t)=>(i,r)=>t(i,r,e);const D="SHEET_DRAWING_PLUGIN";let S=class extends a.Disposable{constructor(e){super(),this._commandService=e,this.disposeWithMe(this._commandService.registerCommand(N))}};S=w([a.OnLifecycle(a.LifecycleStages.Starting,S),v(0,a.ICommandService)],S);let u=class extends a.Disposable{constructor(e,t,i,r,n){super(),this._sheetDrawingService=e,this._drawingManagerService=t,this._resourceManagerService=i,this._lifecycleService=r,this._univerInstanceService=n,this._init()}_init(){this._initSnapshot(),this._drawingInitializeListener()}_initSnapshot(){const e=i=>{const r=this._sheetDrawingService.getDrawingDataForUnit(i);return r?JSON.stringify(r):""},t=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:D,businesses:[a.UniverInstanceType.UNIVER_SHEET],toJson:i=>e(i),parseJson:i=>t(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,r)=>{this._sheetDrawingService.registerDrawingData(i,r)}}))}_drawingInitializeListener(){this._lifecycleService.lifecycle$.pipe(f.filter(e=>e===a.LifecycleStages.Steady),f.first()).subscribe(()=>{var t;const e=(t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:t.getUnitId();e&&this._sheetDrawingService.initializeNotification(e)})}};u=w([a.OnLifecycle(a.LifecycleStages.Starting,u),v(0,_),v(1,l.IDrawingManagerService),v(2,a.IResourceManagerService),v(3,h.Inject(a.LifecycleService)),v(4,a.IUniverInstanceService)],u);var R=Object.defineProperty,M=Object.getOwnPropertyDescriptor,L=(e,t,i,r)=>{for(var n=r>1?void 0:r?M(t,i):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(n=(r?c(t,i,n):c(n))||n);return r&&n&&R(t,i,n),n},G=(e,t)=>(i,r)=>t(i,r,e),g;exports.UniverSheetsDrawingPlugin=(g=class extends a.Plugin{constructor(t,i){super(),this._config=t,this._injector=i}onStarting(t){[[S],[u],[_,{useClass:m}]].forEach(i=>t.add(i))}},d(g,"pluginName",D),d(g,"type",a.UniverInstanceType.UNIVER_SHEET),g);exports.UniverSheetsDrawingPlugin=L([G(1,h.Inject(h.Injector))],exports.UniverSheetsDrawingPlugin);exports.DrawingApplyType=U;exports.ISheetDrawingService=_;exports.SetDrawingApplyMutation=N;exports.SheetDrawingAnchorType=I;
|
package/lib/es/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
var R = Object.defineProperty;
|
|
2
2
|
var w = (e, i, t) => i in e ? R(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
|
|
3
3
|
var u = (e, i, t) => w(e, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { CommandType as D, OnLifecycle as l, LifecycleStages as g, LifecycleService as O, Disposable as N, ICommandService as p, UniverInstanceType as h, IResourceManagerService as b, IUniverInstanceService as M, Plugin as G } from "@univerjs/core";
|
|
5
|
+
import { createIdentifier as L, Inject as m, Injector as C } from "@wendellhu/redi";
|
|
6
|
+
import { UnitDrawingService as J, IDrawingManagerService as I } from "@univerjs/drawing";
|
|
6
7
|
import { filter as j, first as x } from "rxjs/operators";
|
|
7
8
|
var H = /* @__PURE__ */ ((e) => (e.Position = "0", e.Both = "1", e.None = "2", e))(H || {});
|
|
8
9
|
class V extends J {
|
|
9
10
|
}
|
|
10
|
-
const
|
|
11
|
+
const f = L("sheets-drawing.sheet-drawing.service");
|
|
11
12
|
var $ = /* @__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))($ || {});
|
|
12
13
|
const F = {
|
|
13
14
|
id: "sheet.mutation.set-drawing-apply",
|
|
14
|
-
type:
|
|
15
|
+
type: D.MUTATION,
|
|
15
16
|
handler: (e, i) => {
|
|
16
|
-
const t = e.get(
|
|
17
|
+
const t = e.get(I), r = e.get(f), { op: n, unitId: s, subUnitId: a, type: P, objects: o } = i;
|
|
17
18
|
switch (t.applyJson1(s, a, n), r.applyJson1(s, a, n), P) {
|
|
18
19
|
case 0:
|
|
19
20
|
t.addNotification(o), r.addNotification(o);
|
|
@@ -37,22 +38,22 @@ const F = {
|
|
|
37
38
|
return !0;
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
|
-
var W = Object.defineProperty, z = Object.getOwnPropertyDescriptor,
|
|
41
|
+
var W = Object.defineProperty, z = Object.getOwnPropertyDescriptor, U = (e, i, t, r) => {
|
|
41
42
|
for (var n = r > 1 ? void 0 : r ? z(i, t) : i, s = e.length - 1, a; s >= 0; s--)
|
|
42
43
|
(a = e[s]) && (n = (r ? a(i, t, n) : a(n)) || n);
|
|
43
44
|
return r && n && W(i, t, n), n;
|
|
44
45
|
}, c = (e, i) => (t, r) => i(t, r, e);
|
|
45
46
|
const E = "SHEET_DRAWING_PLUGIN";
|
|
46
|
-
let _ = class extends
|
|
47
|
+
let _ = class extends N {
|
|
47
48
|
constructor(e) {
|
|
48
49
|
super(), this._commandService = e, this.disposeWithMe(this._commandService.registerCommand(F));
|
|
49
50
|
}
|
|
50
51
|
};
|
|
51
|
-
_ =
|
|
52
|
+
_ = U([
|
|
52
53
|
l(g.Starting, _),
|
|
53
54
|
c(0, p)
|
|
54
55
|
], _);
|
|
55
|
-
let S = class extends
|
|
56
|
+
let S = class extends N {
|
|
56
57
|
constructor(e, i, t, r, n) {
|
|
57
58
|
super(), this._sheetDrawingService = e, this._drawingManagerService = i, this._resourceManagerService = t, this._lifecycleService = r, this._univerInstanceService = n, this._init();
|
|
58
59
|
}
|
|
@@ -95,20 +96,20 @@ let S = class extends I {
|
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
};
|
|
98
|
-
S =
|
|
99
|
+
S = U([
|
|
99
100
|
l(g.Starting, S),
|
|
100
|
-
c(0,
|
|
101
|
-
c(1,
|
|
102
|
-
c(2,
|
|
103
|
-
c(3,
|
|
104
|
-
c(4,
|
|
101
|
+
c(0, f),
|
|
102
|
+
c(1, I),
|
|
103
|
+
c(2, b),
|
|
104
|
+
c(3, m(O)),
|
|
105
|
+
c(4, M)
|
|
105
106
|
], S);
|
|
106
107
|
var B = Object.defineProperty, T = Object.getOwnPropertyDescriptor, q = (e, i, t, r) => {
|
|
107
108
|
for (var n = r > 1 ? void 0 : r ? T(i, t) : i, s = e.length - 1, a; s >= 0; s--)
|
|
108
109
|
(a = e[s]) && (n = (r ? a(i, t, n) : a(n)) || n);
|
|
109
110
|
return r && n && B(i, t, n), n;
|
|
110
111
|
}, K = (e, i) => (t, r) => i(t, r, e), v;
|
|
111
|
-
let
|
|
112
|
+
let d = (v = class extends G {
|
|
112
113
|
constructor(e, i) {
|
|
113
114
|
super(), this._config = e, this._injector = i;
|
|
114
115
|
}
|
|
@@ -116,17 +117,17 @@ let f = (v = class extends L {
|
|
|
116
117
|
[
|
|
117
118
|
[_],
|
|
118
119
|
[S],
|
|
119
|
-
[
|
|
120
|
+
[f, { useClass: V }]
|
|
120
121
|
].forEach((i) => e.add(i));
|
|
121
122
|
}
|
|
122
123
|
}, u(v, "pluginName", E), u(v, "type", h.UNIVER_SHEET), v);
|
|
123
|
-
|
|
124
|
-
K(1,
|
|
125
|
-
],
|
|
124
|
+
d = q([
|
|
125
|
+
K(1, m(C))
|
|
126
|
+
], d);
|
|
126
127
|
export {
|
|
127
128
|
$ as DrawingApplyType,
|
|
128
|
-
|
|
129
|
+
f as ISheetDrawingService,
|
|
129
130
|
F as SetDrawingApplyMutation,
|
|
130
131
|
H as SheetDrawingAnchorType,
|
|
131
|
-
|
|
132
|
+
d as UniverSheetsDrawingPlugin
|
|
132
133
|
};
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
+
import { Injector } from '@wendellhu/redi';
|
|
2
3
|
|
|
3
4
|
export declare class UniverSheetsDrawingPlugin extends Plugin {
|
|
4
5
|
private readonly _config;
|
|
@@ -38,5 +38,5 @@ export declare class SheetDrawingService extends UnitDrawingService<ISheetDrawin
|
|
|
38
38
|
}
|
|
39
39
|
export interface ISheetDrawingService extends IUnitDrawingService<ISheetDrawing> {
|
|
40
40
|
}
|
|
41
|
-
export declare const ISheetDrawingService: import('@
|
|
41
|
+
export declare const ISheetDrawingService: import('@wendellhu/redi').IdentifierDecorator<ISheetDrawingService>;
|
|
42
42
|
export {};
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@univerjs/core"),require("@univerjs/drawing"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing","rxjs/operators"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.UniverSheetsDrawing={},s.UniverCore,s.UniverDrawing,s.rxjs.operators))})(this,function(s,t,
|
|
1
|
+
(function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/drawing"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/drawing","rxjs/operators"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.UniverSheetsDrawing={},s.UniverCore,s["@wendellhu/redi"],s.UniverDrawing,s.rxjs.operators))})(this,function(s,t,v,_,U){"use strict";var L=Object.defineProperty;var C=(s,t,v)=>t in s?L(s,t,{enumerable:!0,configurable:!0,writable:!0,value:v}):s[t]=v;var l=(s,t,v)=>C(s,typeof t!="symbol"?t+"":t,v);var f;var I=(e=>(e.Position="0",e.Both="1",e.None="2",e))(I||{});class p extends _.UnitDrawingService{}const h=v.createIdentifier("sheets-drawing.sheet-drawing.service");var w=(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))(w||{});const N={id:"sheet.mutation.set-drawing-apply",type:t.CommandType.MUTATION,handler:(e,n)=>{const i=e.get(_.IDrawingManagerService),r=e.get(h),{op:a,unitId:c,subUnitId:o,type:M,objects:u}=n;switch(i.applyJson1(c,o,a),r.applyJson1(c,o,a),M){case 0:i.addNotification(u),r.addNotification(u);break;case 1:i.removeNotification(u),r.removeNotification(u);break;case 2:i.updateNotification(u),r.updateNotification(u);break;case 3:i.orderNotification(u),r.orderNotification(u);break;case 4:i.groupUpdateNotification(u);break;case 5:i.ungroupUpdateNotification(u);break}return!0}};var E=Object.defineProperty,m=Object.getOwnPropertyDescriptor,D=(e,n,i,r)=>{for(var a=r>1?void 0:r?m(n,i):n,c=e.length-1,o;c>=0;c--)(o=e[c])&&(a=(r?o(n,i,a):o(a))||a);return r&&a&&E(n,i,a),a},S=(e,n)=>(i,r)=>n(i,r,e);const P="SHEET_DRAWING_PLUGIN";let g=class extends t.Disposable{constructor(e){super(),this._commandService=e,this.disposeWithMe(this._commandService.registerCommand(N))}};g=D([t.OnLifecycle(t.LifecycleStages.Starting,g),S(0,t.ICommandService)],g);let d=class extends t.Disposable{constructor(e,n,i,r,a){super(),this._sheetDrawingService=e,this._drawingManagerService=n,this._resourceManagerService=i,this._lifecycleService=r,this._univerInstanceService=a,this._init()}_init(){this._initSnapshot(),this._drawingInitializeListener()}_initSnapshot(){const e=i=>{const r=this._sheetDrawingService.getDrawingDataForUnit(i);return r?JSON.stringify(r):""},n=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:P,businesses:[t.UniverInstanceType.UNIVER_SHEET],toJson:i=>e(i),parseJson:i=>n(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,r)=>{this._sheetDrawingService.registerDrawingData(i,r)}}))}_drawingInitializeListener(){this._lifecycleService.lifecycle$.pipe(U.filter(e=>e===t.LifecycleStages.Steady),U.first()).subscribe(()=>{var n;const e=(n=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getUnitId();e&&this._sheetDrawingService.initializeNotification(e)})}};d=D([t.OnLifecycle(t.LifecycleStages.Starting,d),S(0,h),S(1,_.IDrawingManagerService),S(2,t.IResourceManagerService),S(3,v.Inject(t.LifecycleService)),S(4,t.IUniverInstanceService)],d);var O=Object.defineProperty,R=Object.getOwnPropertyDescriptor,j=(e,n,i,r)=>{for(var a=r>1?void 0:r?R(n,i):n,c=e.length-1,o;c>=0;c--)(o=e[c])&&(a=(r?o(n,i,a):o(a))||a);return r&&a&&O(n,i,a),a},b=(e,n)=>(i,r)=>n(i,r,e);s.UniverSheetsDrawingPlugin=(f=class extends t.Plugin{constructor(n,i){super(),this._config=n,this._injector=i}onStarting(n){[[g],[d],[h,{useClass:p}]].forEach(i=>n.add(i))}},l(f,"pluginName",P),l(f,"type",t.UniverInstanceType.UNIVER_SHEET),f),s.UniverSheetsDrawingPlugin=j([b(1,v.Inject(v.Injector))],s.UniverSheetsDrawingPlugin),s.DrawingApplyType=w,s.ISheetDrawingService=h,s.SetDrawingApplyMutation=N,s.SheetDrawingAnchorType=I,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-drawing",
|
|
3
|
-
"version": "0.2.4
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -44,18 +44,20 @@
|
|
|
44
44
|
"lib"
|
|
45
45
|
],
|
|
46
46
|
"peerDependencies": {
|
|
47
|
+
"@wendellhu/redi": "0.16.0",
|
|
47
48
|
"rxjs": ">=7.0.0",
|
|
48
|
-
"@univerjs/core": "0.2.4
|
|
49
|
-
"@univerjs/drawing": "0.2.4
|
|
49
|
+
"@univerjs/core": "0.2.4",
|
|
50
|
+
"@univerjs/drawing": "0.2.4"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
53
|
+
"@wendellhu/redi": "0.16.0",
|
|
52
54
|
"typescript": "^5.5.3",
|
|
53
55
|
"vite": "^5.3.4",
|
|
54
56
|
"vitest": "^2.0.3",
|
|
55
|
-
"@univerjs/core": "0.2.4
|
|
56
|
-
"@univerjs/shared": "0.2.4
|
|
57
|
-
"@univerjs/
|
|
58
|
-
"@univerjs/
|
|
57
|
+
"@univerjs/core": "0.2.4",
|
|
58
|
+
"@univerjs/shared": "0.2.4",
|
|
59
|
+
"@univerjs/sheets": "0.2.4",
|
|
60
|
+
"@univerjs/drawing": "0.2.4"
|
|
59
61
|
},
|
|
60
62
|
"univerSpace": {
|
|
61
63
|
".": {
|