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