@univerjs/sheets-drawing 0.6.7 → 0.6.9

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.
Files changed (2) hide show
  1. package/lib/index.js +118 -0
  2. package/package.json +5 -5
package/lib/index.js ADDED
@@ -0,0 +1,118 @@
1
+ import { createIdentifier as U, CommandType as E, Disposable as P, UniverInstanceType as h, ICommandService as l, IResourceManagerService as D, DependentOn as I, Inject as w, Injector as R, IConfigService as O, Plugin as b, merge as M } from "@univerjs/core";
2
+ import { UnitDrawingService as p, IDrawingManagerService as S, UniverDrawingPlugin as G } from "@univerjs/drawing";
3
+ const C = "sheets-drawing.config", d = {};
4
+ var J = /* @__PURE__ */ ((e) => (e.Position = "0", e.Both = "1", e.None = "2", e))(J || {});
5
+ class j extends p {
6
+ }
7
+ const v = U("sheets-drawing.sheet-drawing.service");
8
+ var L = /* @__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))(L || {});
9
+ const F = {
10
+ id: "sheet.mutation.set-drawing-apply",
11
+ type: E.MUTATION,
12
+ handler: (e, i) => {
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
+ case 0:
16
+ t.addNotification(s), r.addNotification(s);
17
+ break;
18
+ case 1:
19
+ t.removeNotification(s), r.removeNotification(s);
20
+ break;
21
+ case 2:
22
+ t.updateNotification(s), r.updateNotification(s);
23
+ break;
24
+ case 3:
25
+ t.orderNotification(s), r.orderNotification(s);
26
+ break;
27
+ case 4:
28
+ t.groupUpdateNotification(s);
29
+ break;
30
+ case 5:
31
+ t.ungroupUpdateNotification(s);
32
+ break;
33
+ }
34
+ return !0;
35
+ }
36
+ };
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
+ (o = e[a]) && (n = o(n) || n);
40
+ return n;
41
+ }, c = (e, i) => (t, r) => i(t, r, e);
42
+ const f = "SHEET_DRAWING_PLUGIN";
43
+ let g = class extends P {
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
+ }
47
+ _initSnapshot() {
48
+ const e = (t, r) => {
49
+ const n = r || this._sheetDrawingService.getDrawingDataForUnit(t);
50
+ return n ? JSON.stringify(n) : "";
51
+ }, i = (t) => {
52
+ if (!t)
53
+ return {};
54
+ try {
55
+ return JSON.parse(t);
56
+ } catch {
57
+ return {};
58
+ }
59
+ };
60
+ this.disposeWithMe(
61
+ this._resourceManagerService.registerPluginResource({
62
+ pluginName: f,
63
+ businesses: [h.UNIVER_SHEET],
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
+ },
69
+ onLoad: (t, r) => {
70
+ this._sheetDrawingService.registerDrawingData(t, r), this._drawingManagerService.registerDrawingData(t, r);
71
+ }
72
+ })
73
+ );
74
+ }
75
+ };
76
+ g = W([
77
+ c(0, l),
78
+ c(1, v),
79
+ c(2, S),
80
+ c(3, D)
81
+ ], g);
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
+ (o = e[a]) && (n = o(n) || n);
85
+ return n;
86
+ }, u = (e, i) => (t, r) => i(t, r, e), N = (e, i, t) => $(e, typeof i != "symbol" ? i + "" : i, t);
87
+ let _ = class extends b {
88
+ constructor(e = d, i, t) {
89
+ super(), this._config = e, this._injector = i, this._configService = t;
90
+ const { ...r } = M(
91
+ {},
92
+ d,
93
+ this._config
94
+ );
95
+ this._configService.setConfig(C, r);
96
+ }
97
+ onStarting() {
98
+ [
99
+ [g],
100
+ [v, { useClass: j }]
101
+ ].forEach((e) => this._injector.add(e)), this._injector.get(g);
102
+ }
103
+ };
104
+ N(_, "pluginName", f);
105
+ N(_, "type", h.UNIVER_SHEET);
106
+ _ = B([
107
+ I(G),
108
+ u(1, w(R)),
109
+ u(2, O)
110
+ ], _);
111
+ export {
112
+ L as DrawingApplyType,
113
+ v as ISheetDrawingService,
114
+ f as SHEET_DRAWING_PLUGIN,
115
+ F as SetDrawingApplyMutation,
116
+ J as SheetDrawingAnchorType,
117
+ _ as UniverSheetsDrawingPlugin
118
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-drawing",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
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.7",
47
- "@univerjs/drawing": "0.6.7"
46
+ "@univerjs/core": "0.6.9",
47
+ "@univerjs/drawing": "0.6.9"
48
48
  },
49
49
  "devDependencies": {
50
50
  "typescript": "^5.8.2",
51
51
  "vite": "^6.2.3",
52
52
  "vitest": "^3.0.9",
53
- "@univerjs-infra/shared": "0.6.7",
54
- "@univerjs/sheets": "0.6.7"
53
+ "@univerjs-infra/shared": "0.6.9",
54
+ "@univerjs/sheets": "0.6.9"
55
55
  },
56
56
  "scripts": {
57
57
  "test": "vitest run",