@univerjs/sheets-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 +51 -47
- package/lib/types/index.d.ts +1 -1
- package/lib/types/services/sheet-drawing.service.d.ts +2 -9
- 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"),u=require("@univerjs/drawing"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),u=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 u.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(u.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 v=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)}}))}};v=p([g(0,a.ICommandService),g(1,_),g(2,u.IDrawingManagerService),g(3,a.IResourceManagerService)],v);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(){[[v],[_,{useClass:E}]].forEach(i=>this._injector.add(i)),this._injector.get(v)}};U(exports.UniverSheetsDrawingPlugin,"pluginName",S);U(exports.UniverSheetsDrawingPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsDrawingPlugin=b([a.DependentOn(u.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,17 +1,17 @@
|
|
|
1
|
-
import { createIdentifier as
|
|
2
|
-
import { UnitDrawingService as
|
|
3
|
-
const
|
|
4
|
-
var
|
|
5
|
-
class
|
|
1
|
+
import { createIdentifier as U, CommandType as E, Disposable as l, UniverInstanceType as f, 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
|
+
import { UnitDrawingService as G, IDrawingManagerService as d, UniverDrawingPlugin as C } from "@univerjs/drawing";
|
|
3
|
+
const J = "sheets-drawing.config", u = {};
|
|
4
|
+
var j = /* @__PURE__ */ ((e) => (e.Position = "0", e.Both = "1", e.None = "2", e))(j || {});
|
|
5
|
+
class L extends G {
|
|
6
6
|
}
|
|
7
|
-
const v =
|
|
8
|
-
var
|
|
9
|
-
const
|
|
7
|
+
const v = U("sheets-drawing.sheet-drawing.service");
|
|
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
|
+
const H = {
|
|
10
10
|
id: "sheet.mutation.set-drawing-apply",
|
|
11
|
-
type:
|
|
11
|
+
type: E.MUTATION,
|
|
12
12
|
handler: (e, i) => {
|
|
13
|
-
const r = e.get(
|
|
14
|
-
switch (r.applyJson1(a, s, n), t.applyJson1(a, s, n),
|
|
13
|
+
const r = e.get(d), t = e.get(v), { op: n, unitId: a, subUnitId: s, type: P, objects: o } = i;
|
|
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);
|
|
17
17
|
break;
|
|
@@ -34,15 +34,15 @@ const F = {
|
|
|
34
34
|
return !0;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
var
|
|
38
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
37
|
+
var W = Object.defineProperty, x = Object.getOwnPropertyDescriptor, V = (e, i, r, t) => {
|
|
38
|
+
for (var n = t > 1 ? void 0 : t ? x(i, r) : i, a = e.length - 1, s; a >= 0; a--)
|
|
39
39
|
(s = e[a]) && (n = (t ? s(i, r, n) : s(n)) || n);
|
|
40
|
-
return t && n &&
|
|
40
|
+
return t && n && W(i, r, n), n;
|
|
41
41
|
}, c = (e, i) => (r, t) => i(r, t, e);
|
|
42
|
-
const
|
|
43
|
-
let
|
|
42
|
+
const S = "SHEET_DRAWING_PLUGIN";
|
|
43
|
+
let g = class extends l {
|
|
44
44
|
constructor(e, i, r, t) {
|
|
45
|
-
super(), this._commandService = e, this._sheetDrawingService = i, this._drawingManagerService = r, this._resourceManagerService = t, this._initSnapshot(), this.disposeWithMe(this._commandService.registerCommand(
|
|
45
|
+
super(), this._commandService = e, this._sheetDrawingService = i, this._drawingManagerService = r, this._resourceManagerService = t, this._initSnapshot(), this.disposeWithMe(this._commandService.registerCommand(H));
|
|
46
46
|
}
|
|
47
47
|
_initSnapshot() {
|
|
48
48
|
const e = (r, t) => {
|
|
@@ -59,8 +59,8 @@ let _ = class extends E {
|
|
|
59
59
|
};
|
|
60
60
|
this.disposeWithMe(
|
|
61
61
|
this._resourceManagerService.registerPluginResource({
|
|
62
|
-
pluginName:
|
|
63
|
-
businesses: [
|
|
62
|
+
pluginName: S,
|
|
63
|
+
businesses: [f.UNIVER_SHEET],
|
|
64
64
|
toJson: (r, t) => e(r, t),
|
|
65
65
|
parseJson: (r) => i(r),
|
|
66
66
|
onUnLoad: (r) => {
|
|
@@ -73,42 +73,46 @@ let _ = class extends E {
|
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
|
|
77
|
-
c(0,
|
|
76
|
+
g = V([
|
|
77
|
+
c(0, D),
|
|
78
78
|
c(1, v),
|
|
79
|
-
c(2,
|
|
80
|
-
c(3,
|
|
81
|
-
],
|
|
82
|
-
var
|
|
83
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
79
|
+
c(2, d),
|
|
80
|
+
c(3, I)
|
|
81
|
+
], g);
|
|
82
|
+
var N = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, B = (e, i, r) => i in e ? N(e, i, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[i] = r, K = (e, i, r, t) => {
|
|
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
|
-
return t && n &&
|
|
86
|
-
},
|
|
87
|
-
let
|
|
88
|
-
constructor(e =
|
|
85
|
+
return t && n && N(i, r, n), n;
|
|
86
|
+
}, h = (e, i) => (r, t) => i(r, t, e), m = (e, i, r) => B(e, typeof i != "symbol" ? i + "" : i, r);
|
|
87
|
+
let _ = class extends b {
|
|
88
|
+
constructor(e = u, i, r) {
|
|
89
89
|
super(), this._config = e, this._injector = i, this._configService = r;
|
|
90
|
-
const { ...t } =
|
|
91
|
-
|
|
90
|
+
const { ...t } = p(
|
|
91
|
+
{},
|
|
92
|
+
u,
|
|
93
|
+
this._config
|
|
94
|
+
);
|
|
95
|
+
this._configService.setConfig(J, t);
|
|
92
96
|
}
|
|
93
97
|
onStarting() {
|
|
94
98
|
[
|
|
95
|
-
[
|
|
96
|
-
[v, { useClass:
|
|
97
|
-
].forEach((e) => this._injector.add(e)), this._injector.get(
|
|
99
|
+
[g],
|
|
100
|
+
[v, { useClass: L }]
|
|
101
|
+
].forEach((e) => this._injector.add(e)), this._injector.get(g);
|
|
98
102
|
}
|
|
99
103
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
],
|
|
104
|
+
m(_, "pluginName", S);
|
|
105
|
+
m(_, "type", f.UNIVER_SHEET);
|
|
106
|
+
_ = K([
|
|
107
|
+
w(C),
|
|
108
|
+
h(1, O(R)),
|
|
109
|
+
h(2, M)
|
|
110
|
+
], _);
|
|
107
111
|
export {
|
|
108
|
-
|
|
112
|
+
F as DrawingApplyType,
|
|
109
113
|
v as ISheetDrawingService,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
S as SHEET_DRAWING_PLUGIN,
|
|
115
|
+
H as SetDrawingApplyMutation,
|
|
116
|
+
j as SheetDrawingAnchorType,
|
|
117
|
+
_ as UniverSheetsDrawingPlugin
|
|
114
118
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
export { UniverSheetsDrawingPlugin } from './plugin';
|
|
17
17
|
export { ISheetDrawingService, SheetDrawingAnchorType } from './services/sheet-drawing.service';
|
|
18
18
|
export { SHEET_DRAWING_PLUGIN } from './controllers/sheet-drawing.controller';
|
|
19
|
-
export type { IFloatDomData, ISheetDrawing, ISheetDrawingPosition, ISheetFloatDom } from './services/sheet-drawing.service';
|
|
19
|
+
export type { IFloatDomData, ISheetDrawing, ISheetDrawingPosition, ISheetFloatDom, ISheetImage } from './services/sheet-drawing.service';
|
|
20
20
|
export { DrawingApplyType, type ISetDrawingApplyMutationParams, SetDrawingApplyMutation } from './commands/mutations/set-drawing-apply.mutation';
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { IDrawingParam, IRotationSkewFlipTransform, Serializable } from '@univerjs/core';
|
|
2
|
+
import { ISheetOverGridPosition } from '@univerjs/sheets';
|
|
2
3
|
import { IImageData, IUnitDrawingService, UnitDrawingService } from '@univerjs/drawing';
|
|
3
|
-
interface ICellPosition {
|
|
4
|
-
column: number;
|
|
5
|
-
columnOffset: number;
|
|
6
|
-
row: number;
|
|
7
|
-
rowOffset: number;
|
|
8
|
-
}
|
|
9
4
|
export declare enum SheetDrawingAnchorType {
|
|
10
5
|
Position = "0",
|
|
11
6
|
Both = "1",
|
|
12
7
|
None = "2"
|
|
13
8
|
}
|
|
14
|
-
export interface ISheetDrawingPosition extends IRotationSkewFlipTransform {
|
|
15
|
-
from: ICellPosition;
|
|
16
|
-
to: ICellPosition;
|
|
9
|
+
export interface ISheetDrawingPosition extends IRotationSkewFlipTransform, ISheetOverGridPosition {
|
|
17
10
|
}
|
|
18
11
|
export interface ISheetDrawingBase {
|
|
19
12
|
sheetTransform: ISheetDrawingPosition;
|
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
|
|
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,r)=>{const i=e.get(u.IDrawingManagerService),n=e.get(v),{op:t,unitId:o,subUnitId:c,type:M,objects:g}=r;switch(i.applyJson1(o,c,t),n.applyJson1(o,c,t),M){case 0:i.addNotification(g),n.addNotification(g);break;case 1:i.removeNotification(g),n.removeNotification(g);break;case 2:i.updateNotification(g),n.updateNotification(g);break;case 3:i.orderNotification(g),n.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,r,i,n)=>{for(var t=n>1?void 0:n?I(r,i):r,o=e.length-1,c;o>=0;o--)(c=e[o])&&(t=(n?c(r,i,t):c(t))||t);return n&&t&&E(r,i,t),t},h=(e,r)=>(i,n)=>r(i,n,e);const _="SHEET_DRAWING_PLUGIN";let S=class extends s.Disposable{constructor(e,r,i,n){super(),this._commandService=e,this._sheetDrawingService=r,this._drawingManagerService=i,this._resourceManagerService=n,this._initSnapshot(),this.disposeWithMe(this._commandService.registerCommand(D))}_initSnapshot(){const e=(i,n)=>{const t=n||this._sheetDrawingService.getDrawingDataForUnit(i);return t?JSON.stringify(t):""},r=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:_,businesses:[s.UniverInstanceType.UNIVER_SHEET],toJson:(i,n)=>e(i,n),parseJson:i=>r(i),onUnLoad:i=>{this._sheetDrawingService.removeDrawingDataForUnit(i),this._drawingManagerService.removeDrawingDataForUnit(i)},onLoad:(i,n)=>{this._sheetDrawingService.registerDrawingData(i,n),this._drawingManagerService.registerDrawingData(i,n)}}))}};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,r,i)=>r in e?N(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i,p=(e,r,i,n)=>{for(var t=n>1?void 0:n?R(r,i):r,o=e.length-1,c;o>=0;o--)(c=e[o])&&(t=(n?c(r,i,t):c(t))||t);return n&&t&&N(r,i,t),t},P=(e,r)=>(i,n)=>r(i,n,e),w=(e,r,i)=>b(e,typeof r!="symbol"?r+"":r,i);a.UniverSheetsDrawingPlugin=class extends s.Plugin{constructor(r=f,i,n){super(),this._config=r,this._injector=i,this._configService=n;const{...t}=s.merge({},f,this._config);this._configService.setConfig(l,t)}onStarting(){[[S],[v,{useClass:m}]].forEach(r=>this._injector.add(r)),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.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/core": "0.5.
|
|
47
|
-
"@univerjs/drawing": "0.5.
|
|
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
|
".": {
|