@univerjs/sheets-note 0.7.0-nightly.202505121607 → 0.7.0-nightly.202505131607
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 +169 -163
- package/lib/index.js +169 -163
- package/lib/types/const.d.ts +16 -0
- package/lib/types/controllers/config.schema.d.ts +20 -0
- package/lib/types/plugin.d.ts +3 -2
- package/lib/umd/index.js +1 -1
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (i,
|
|
4
|
-
import { Disposable as S, ObjectMatrix as
|
|
5
|
-
import { RefRangeService as
|
|
6
|
-
import { Subject as
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var W = (i, o, e) => o in i ? A(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
|
|
3
|
+
var d = (i, o, e) => W(i, typeof o != "symbol" ? o + "" : o, e);
|
|
4
|
+
import { Disposable as S, ObjectMatrix as L, CommandType as l, Inject as g, ICommandService as p, sequenceExecuteAsync as J, IResourceManagerService as G, IUniverInstanceService as x, UniverInstanceType as U, DependentOn as H, IConfigService as z, Injector as F, Plugin as q, merge as K, touchDependencies as O } from "@univerjs/core";
|
|
5
|
+
import { RefRangeService as Y, SheetsSelectionsService as I, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests as B, getSheetCommandTarget as D, UniverSheetsPlugin as Q } from "@univerjs/sheets";
|
|
6
|
+
import { Subject as X, filter as y, map as $ } from "rxjs";
|
|
7
|
+
const T = "SHEET_NOTE_PLUGIN", Z = "sheets-note.config", b = {};
|
|
7
8
|
class u extends S {
|
|
8
9
|
constructor() {
|
|
9
10
|
super(...arguments);
|
|
10
11
|
d(this, "_noteMatrix", /* @__PURE__ */ new Map());
|
|
11
|
-
d(this, "_change$", new
|
|
12
|
+
d(this, "_change$", new X());
|
|
12
13
|
d(this, "change$", this._change$.asObservable());
|
|
13
14
|
}
|
|
14
15
|
_ensureNoteMatrix(e, n) {
|
|
15
16
|
let t = this._noteMatrix.get(e);
|
|
16
17
|
t || (t = /* @__PURE__ */ new Map(), this._noteMatrix.set(e, t));
|
|
17
18
|
let s = t.get(n);
|
|
18
|
-
return s || (s = new
|
|
19
|
+
return s || (s = new L(), t.set(n, s)), s;
|
|
19
20
|
}
|
|
20
21
|
getSheetShowNotes$(e, n) {
|
|
21
22
|
return this._change$.pipe(
|
|
22
|
-
|
|
23
|
+
y(({ unitId: t, sheetId: s }) => t === e && s === n),
|
|
23
24
|
$(() => {
|
|
24
25
|
const t = this._ensureNoteMatrix(e, n), s = [];
|
|
25
|
-
return t.forValue((
|
|
26
|
-
c.show && s.push({ loc: { row:
|
|
26
|
+
return t.forValue((r, a, c) => {
|
|
27
|
+
c.show && s.push({ loc: { row: r, col: a, unitId: e, subUnitId: n }, note: c });
|
|
27
28
|
}), s;
|
|
28
29
|
})
|
|
29
30
|
);
|
|
30
31
|
}
|
|
31
32
|
getCellNoteChange$(e, n, t, s) {
|
|
32
33
|
return this._change$.pipe(
|
|
33
|
-
|
|
34
|
-
$(({ note:
|
|
34
|
+
y(({ unitId: r, sheetId: a, row: c, col: h }) => r === e && a === n && c === t && h === s),
|
|
35
|
+
$(({ note: r }) => r)
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
|
-
updateNote(e, n, t, s,
|
|
38
|
+
updateNote(e, n, t, s, r, a) {
|
|
38
39
|
const c = this._ensureNoteMatrix(e, n), h = c.getValue(t, s);
|
|
39
|
-
c.setValue(t, s,
|
|
40
|
+
c.setValue(t, s, r), this._change$.next({ unitId: e, sheetId: n, row: t, col: s, type: "update", note: r, oldNote: h, silent: a });
|
|
40
41
|
}
|
|
41
|
-
removeNote(e, n, t, s,
|
|
42
|
+
removeNote(e, n, t, s, r) {
|
|
42
43
|
const a = this._ensureNoteMatrix(e, n), c = a.getValue(t, s);
|
|
43
|
-
a.realDeleteValue(t, s), this._change$.next({ unitId: e, sheetId: n, row: t, col: s, type: "update", note: null, oldNote: c, silent:
|
|
44
|
+
a.realDeleteValue(t, s), this._change$.next({ unitId: e, sheetId: n, row: t, col: s, type: "update", note: null, oldNote: c, silent: r });
|
|
44
45
|
}
|
|
45
|
-
toggleNotePopup(e, n, t, s,
|
|
46
|
+
toggleNotePopup(e, n, t, s, r) {
|
|
46
47
|
const a = this._ensureNoteMatrix(e, n), c = a.getValue(t, s);
|
|
47
48
|
if (c) {
|
|
48
49
|
c.show = !c.show;
|
|
@@ -55,20 +56,20 @@ class u extends S {
|
|
|
55
56
|
type: "update",
|
|
56
57
|
note: h,
|
|
57
58
|
oldNote: c,
|
|
58
|
-
silent:
|
|
59
|
+
silent: r
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
updateNotePosition(e, n, t, s,
|
|
63
|
-
const h = this._ensureNoteMatrix(e, n),
|
|
64
|
-
|
|
63
|
+
updateNotePosition(e, n, t, s, r, a, c) {
|
|
64
|
+
const h = this._ensureNoteMatrix(e, n), _ = h.getValue(t, s);
|
|
65
|
+
_ && (h.realDeleteValue(t, s), h.setValue(r, a, _), this._change$.next({
|
|
65
66
|
unitId: e,
|
|
66
67
|
sheetId: n,
|
|
67
68
|
row: t,
|
|
68
69
|
col: s,
|
|
69
70
|
type: "ref",
|
|
70
|
-
newPosition: { row:
|
|
71
|
-
note:
|
|
71
|
+
newPosition: { row: r, col: a },
|
|
72
|
+
note: _,
|
|
72
73
|
silent: c
|
|
73
74
|
}));
|
|
74
75
|
}
|
|
@@ -90,56 +91,56 @@ class u extends S {
|
|
|
90
91
|
this._noteMatrix.delete(e);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
|
-
const
|
|
94
|
+
const R = {
|
|
94
95
|
id: "sheet.mutation.update-note",
|
|
95
96
|
type: l.MUTATION,
|
|
96
|
-
handler: (i,
|
|
97
|
-
const { unitId: e, sheetId: n, row: t, col: s, note:
|
|
98
|
-
return i.get(u).updateNote(e, n, t, s,
|
|
97
|
+
handler: (i, o) => {
|
|
98
|
+
const { unitId: e, sheetId: n, row: t, col: s, note: r, silent: a } = o;
|
|
99
|
+
return i.get(u).updateNote(e, n, t, s, r, a), !0;
|
|
99
100
|
}
|
|
100
101
|
}, P = {
|
|
101
102
|
id: "sheet.mutation.remove-note",
|
|
102
103
|
type: l.MUTATION,
|
|
103
|
-
handler: (i,
|
|
104
|
-
const { unitId: e, sheetId: n, row: t, col: s, silent:
|
|
105
|
-
return i.get(u).removeNote(e, n, t, s,
|
|
104
|
+
handler: (i, o) => {
|
|
105
|
+
const { unitId: e, sheetId: n, row: t, col: s, silent: r } = o;
|
|
106
|
+
return i.get(u).removeNote(e, n, t, s, r), !0;
|
|
106
107
|
}
|
|
107
|
-
},
|
|
108
|
+
}, V = {
|
|
108
109
|
id: "sheet.mutation.toggle-note-popup",
|
|
109
110
|
type: l.MUTATION,
|
|
110
|
-
handler: (i,
|
|
111
|
-
const { unitId: e, sheetId: n, row: t, col: s, silent:
|
|
112
|
-
return i.get(u).toggleNotePopup(e, n, t, s,
|
|
111
|
+
handler: (i, o) => {
|
|
112
|
+
const { unitId: e, sheetId: n, row: t, col: s, silent: r } = o;
|
|
113
|
+
return i.get(u).toggleNotePopup(e, n, t, s, r), !0;
|
|
113
114
|
}
|
|
114
115
|
}, C = {
|
|
115
116
|
id: "sheet.mutation.update-note-position",
|
|
116
117
|
type: l.MUTATION,
|
|
117
|
-
handler: (i,
|
|
118
|
-
const { unitId: e, sheetId: n, row: t, col: s, newPosition:
|
|
119
|
-
return i.get(u).updateNotePosition(e, n, t, s,
|
|
118
|
+
handler: (i, o) => {
|
|
119
|
+
const { unitId: e, sheetId: n, row: t, col: s, newPosition: r, silent: a } = o;
|
|
120
|
+
return i.get(u).updateNotePosition(e, n, t, s, r.row, r.col, a), !0;
|
|
120
121
|
}
|
|
121
122
|
};
|
|
122
|
-
var
|
|
123
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
124
|
-
(
|
|
123
|
+
var k = Object.getOwnPropertyDescriptor, ee = (i, o, e, n) => {
|
|
124
|
+
for (var t = n > 1 ? void 0 : n ? k(o, e) : o, s = i.length - 1, r; s >= 0; s--)
|
|
125
|
+
(r = i[s]) && (t = r(t) || t);
|
|
125
126
|
return t;
|
|
126
|
-
}, m = (i,
|
|
127
|
+
}, m = (i, o) => (e, n) => o(e, n, i);
|
|
127
128
|
let N = class extends S {
|
|
128
|
-
constructor(
|
|
129
|
+
constructor(o, e, n, t) {
|
|
129
130
|
super();
|
|
130
131
|
d(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
131
132
|
d(this, "_watcherMap", /* @__PURE__ */ new Map());
|
|
132
|
-
d(this, "_handleRangeChange", (
|
|
133
|
+
d(this, "_handleRangeChange", (o, e, n, t, s, r, a) => r ? {
|
|
133
134
|
redos: [{
|
|
134
135
|
id: C.id,
|
|
135
136
|
params: {
|
|
136
|
-
unitId:
|
|
137
|
+
unitId: o,
|
|
137
138
|
sheetId: e,
|
|
138
139
|
row: t,
|
|
139
140
|
col: s,
|
|
140
141
|
newPosition: {
|
|
141
|
-
row:
|
|
142
|
-
col:
|
|
142
|
+
row: r.startRow,
|
|
143
|
+
col: r.startColumn
|
|
143
144
|
},
|
|
144
145
|
silent: a
|
|
145
146
|
}
|
|
@@ -147,10 +148,10 @@ let N = class extends S {
|
|
|
147
148
|
undos: [{
|
|
148
149
|
id: C.id,
|
|
149
150
|
params: {
|
|
150
|
-
unitId:
|
|
151
|
+
unitId: o,
|
|
151
152
|
sheetId: e,
|
|
152
|
-
row:
|
|
153
|
-
col:
|
|
153
|
+
row: r.startRow,
|
|
154
|
+
col: r.startColumn,
|
|
154
155
|
newPosition: {
|
|
155
156
|
row: t,
|
|
156
157
|
col: s
|
|
@@ -163,16 +164,16 @@ let N = class extends S {
|
|
|
163
164
|
redos: [{
|
|
164
165
|
id: P.id,
|
|
165
166
|
params: {
|
|
166
|
-
unitId:
|
|
167
|
+
unitId: o,
|
|
167
168
|
sheetId: e,
|
|
168
169
|
row: t,
|
|
169
170
|
col: s
|
|
170
171
|
}
|
|
171
172
|
}],
|
|
172
173
|
undos: [{
|
|
173
|
-
id:
|
|
174
|
+
id: R.id,
|
|
174
175
|
params: {
|
|
175
|
-
unitId:
|
|
176
|
+
unitId: o,
|
|
176
177
|
sheetId: e,
|
|
177
178
|
row: t,
|
|
178
179
|
col: s,
|
|
@@ -180,72 +181,72 @@ let N = class extends S {
|
|
|
180
181
|
}
|
|
181
182
|
}]
|
|
182
183
|
});
|
|
183
|
-
this._refRangeService =
|
|
184
|
+
this._refRangeService = o, this._sheetsNoteModel = e, this._selectionManagerService = n, this._commandService = t, this._initData(), this._initRefRange();
|
|
184
185
|
}
|
|
185
|
-
_getIdWithUnitId(
|
|
186
|
-
return `${
|
|
186
|
+
_getIdWithUnitId(o, e, n, t) {
|
|
187
|
+
return `${o}-${e}-${n}-${t}`;
|
|
187
188
|
}
|
|
188
|
-
_register(
|
|
189
|
-
const
|
|
189
|
+
_register(o, e, n, t, s) {
|
|
190
|
+
const r = {
|
|
190
191
|
startColumn: s,
|
|
191
192
|
endColumn: s,
|
|
192
193
|
startRow: t,
|
|
193
194
|
endRow: t
|
|
194
195
|
};
|
|
195
196
|
this._disposableMap.set(
|
|
196
|
-
this._getIdWithUnitId(
|
|
197
|
-
this._refRangeService.registerRefRange(
|
|
198
|
-
const c = B(
|
|
199
|
-
return h && h.startColumn ===
|
|
197
|
+
this._getIdWithUnitId(o, e, t, s),
|
|
198
|
+
this._refRangeService.registerRefRange(r, (a) => {
|
|
199
|
+
const c = B(r, a, { selectionManagerService: this._selectionManagerService }), h = Array.isArray(c) ? c[0] : c;
|
|
200
|
+
return h && h.startColumn === r.startColumn && h.startRow === r.startRow ? {
|
|
200
201
|
undos: [],
|
|
201
202
|
redos: []
|
|
202
|
-
} : this._handleRangeChange(
|
|
203
|
-
},
|
|
203
|
+
} : this._handleRangeChange(o, e, n, t, s, h, !1);
|
|
204
|
+
}, o, e)
|
|
204
205
|
);
|
|
205
206
|
}
|
|
206
|
-
_watch(
|
|
207
|
-
const
|
|
207
|
+
_watch(o, e, n, t, s) {
|
|
208
|
+
const r = {
|
|
208
209
|
startColumn: s,
|
|
209
210
|
endColumn: s,
|
|
210
211
|
startRow: t,
|
|
211
212
|
endRow: t
|
|
212
213
|
};
|
|
213
214
|
this._watcherMap.set(
|
|
214
|
-
this._getIdWithUnitId(
|
|
215
|
-
this._refRangeService.watchRange(
|
|
216
|
-
const { redos: h } = this._handleRangeChange(
|
|
217
|
-
|
|
215
|
+
this._getIdWithUnitId(o, e, t, s),
|
|
216
|
+
this._refRangeService.watchRange(o, e, r, (a, c) => {
|
|
217
|
+
const { redos: h } = this._handleRangeChange(o, e, n, a.startRow, a.startColumn, c, !0);
|
|
218
|
+
J(h, this._commandService, { onlyLocal: !0 });
|
|
218
219
|
}, !0)
|
|
219
220
|
);
|
|
220
221
|
}
|
|
221
|
-
_unwatch(
|
|
222
|
-
var
|
|
223
|
-
const s = this._getIdWithUnitId(
|
|
224
|
-
(
|
|
222
|
+
_unwatch(o, e, n, t) {
|
|
223
|
+
var r;
|
|
224
|
+
const s = this._getIdWithUnitId(o, e, n, t);
|
|
225
|
+
(r = this._watcherMap.get(s)) == null || r.dispose(), this._watcherMap.delete(s);
|
|
225
226
|
}
|
|
226
|
-
_unregister(
|
|
227
|
-
var
|
|
228
|
-
const s = this._getIdWithUnitId(
|
|
229
|
-
(
|
|
227
|
+
_unregister(o, e, n, t) {
|
|
228
|
+
var r;
|
|
229
|
+
const s = this._getIdWithUnitId(o, e, n, t);
|
|
230
|
+
(r = this._disposableMap.get(s)) == null || r.dispose(), this._disposableMap.delete(s);
|
|
230
231
|
}
|
|
231
232
|
_initData() {
|
|
232
|
-
const
|
|
233
|
-
for (const [e, n] of
|
|
233
|
+
const o = this._sheetsNoteModel.getNotes();
|
|
234
|
+
for (const [e, n] of o)
|
|
234
235
|
for (const [t, s] of n)
|
|
235
|
-
s.forValue((
|
|
236
|
+
s.forValue((r, a, c) => (c && (this._register(e, t, c, r, a), this._watch(e, t, c, r, a)), !0));
|
|
236
237
|
}
|
|
237
238
|
_initRefRange() {
|
|
238
239
|
this.disposeWithMe(
|
|
239
|
-
this._sheetsNoteModel.change$.subscribe((
|
|
240
|
-
switch (
|
|
240
|
+
this._sheetsNoteModel.change$.subscribe((o) => {
|
|
241
|
+
switch (o.type) {
|
|
241
242
|
case "update": {
|
|
242
|
-
const { unitId: e, sheetId: n, row: t, col: s, note:
|
|
243
|
-
|
|
243
|
+
const { unitId: e, sheetId: n, row: t, col: s, note: r } = o, a = this._getIdWithUnitId(e, n, t, s);
|
|
244
|
+
r ? this._disposableMap.has(a) || (this._register(e, n, r, t, s), this._watch(e, n, r, t, s)) : (this._unregister(e, n, t, s), this._unwatch(e, n, t, s));
|
|
244
245
|
break;
|
|
245
246
|
}
|
|
246
247
|
case "ref": {
|
|
247
|
-
const { unitId: e, sheetId: n, row: t, col: s, newPosition:
|
|
248
|
-
this._unregister(e, n, t, s), c || (this._unwatch(e, n, t, s), this._watch(e, n, a,
|
|
248
|
+
const { unitId: e, sheetId: n, row: t, col: s, newPosition: r, note: a, silent: c } = o;
|
|
249
|
+
this._unregister(e, n, t, s), c || (this._unwatch(e, n, t, s), this._watch(e, n, a, r.row, r.col)), this._register(e, n, a, r.row, r.col);
|
|
249
250
|
break;
|
|
250
251
|
}
|
|
251
252
|
}
|
|
@@ -253,20 +254,20 @@ let N = class extends S {
|
|
|
253
254
|
);
|
|
254
255
|
}
|
|
255
256
|
};
|
|
256
|
-
N =
|
|
257
|
-
m(0,
|
|
258
|
-
m(1,
|
|
259
|
-
m(2,
|
|
260
|
-
m(3,
|
|
257
|
+
N = ee([
|
|
258
|
+
m(0, g(Y)),
|
|
259
|
+
m(1, g(u)),
|
|
260
|
+
m(2, g(I)),
|
|
261
|
+
m(3, p)
|
|
261
262
|
], N);
|
|
262
|
-
var
|
|
263
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
264
|
-
(
|
|
263
|
+
var te = Object.getOwnPropertyDescriptor, se = (i, o, e, n) => {
|
|
264
|
+
for (var t = n > 1 ? void 0 : n ? te(o, e) : o, s = i.length - 1, r; s >= 0; s--)
|
|
265
|
+
(r = i[s]) && (t = r(t) || t);
|
|
265
266
|
return t;
|
|
266
|
-
}, w = (i,
|
|
267
|
-
let
|
|
268
|
-
constructor(i,
|
|
269
|
-
super(), this._resourceManagerService = i, this._univerInstanceService =
|
|
267
|
+
}, w = (i, o) => (e, n) => o(e, n, i);
|
|
268
|
+
let f = class extends S {
|
|
269
|
+
constructor(i, o, e) {
|
|
270
|
+
super(), this._resourceManagerService = i, this._univerInstanceService = o, this._sheetsNoteModel = e, this._initSnapshot();
|
|
270
271
|
}
|
|
271
272
|
_initSnapshot() {
|
|
272
273
|
const i = (e) => {
|
|
@@ -274,13 +275,13 @@ let M = class extends S {
|
|
|
274
275
|
if (!n)
|
|
275
276
|
return "";
|
|
276
277
|
const t = {};
|
|
277
|
-
return n.forEach((s,
|
|
278
|
+
return n.forEach((s, r) => {
|
|
278
279
|
const a = {};
|
|
279
|
-
s.forValue((c, h,
|
|
280
|
-
a[c] || (a[c] = {}), a[c][h] =
|
|
281
|
-
}), Object.keys(a).length > 0 && (t[
|
|
280
|
+
s.forValue((c, h, _) => {
|
|
281
|
+
a[c] || (a[c] = {}), a[c][h] = _;
|
|
282
|
+
}), Object.keys(a).length > 0 && (t[r] = a);
|
|
282
283
|
}), JSON.stringify(t);
|
|
283
|
-
},
|
|
284
|
+
}, o = (e) => {
|
|
284
285
|
if (!e)
|
|
285
286
|
return {};
|
|
286
287
|
try {
|
|
@@ -291,21 +292,21 @@ let M = class extends S {
|
|
|
291
292
|
};
|
|
292
293
|
this.disposeWithMe(
|
|
293
294
|
this._resourceManagerService.registerPluginResource({
|
|
294
|
-
pluginName:
|
|
295
|
+
pluginName: T,
|
|
295
296
|
businesses: [U.UNIVER_SHEET],
|
|
296
297
|
toJson: (e) => i(e),
|
|
297
|
-
parseJson: (e) =>
|
|
298
|
+
parseJson: (e) => o(e),
|
|
298
299
|
onUnLoad: (e) => {
|
|
299
300
|
this._sheetsNoteModel.deleteUnitNotes(e);
|
|
300
301
|
},
|
|
301
302
|
onLoad: (e, n) => {
|
|
302
303
|
Object.entries(n).forEach(([t, s]) => {
|
|
303
|
-
Object.entries(s).forEach(([
|
|
304
|
+
Object.entries(s).forEach(([r, a]) => {
|
|
304
305
|
Object.entries(a).forEach(([c, h]) => {
|
|
305
306
|
this._sheetsNoteModel.updateNote(
|
|
306
307
|
e,
|
|
307
308
|
t,
|
|
308
|
-
Number(
|
|
309
|
+
Number(r),
|
|
309
310
|
Number(c),
|
|
310
311
|
h
|
|
311
312
|
);
|
|
@@ -317,66 +318,66 @@ let M = class extends S {
|
|
|
317
318
|
);
|
|
318
319
|
}
|
|
319
320
|
};
|
|
320
|
-
|
|
321
|
-
w(0,
|
|
321
|
+
f = se([
|
|
322
|
+
w(0, G),
|
|
322
323
|
w(1, x),
|
|
323
|
-
w(2,
|
|
324
|
-
],
|
|
325
|
-
const
|
|
324
|
+
w(2, g(u))
|
|
325
|
+
], f);
|
|
326
|
+
const ne = {
|
|
326
327
|
id: "sheet.command.delete-note",
|
|
327
328
|
type: l.COMMAND,
|
|
328
|
-
handler: (i,
|
|
329
|
+
handler: (i, o) => {
|
|
329
330
|
const e = i.get(x), n = D(e);
|
|
330
331
|
if (!n) return !1;
|
|
331
|
-
const s = i.get(
|
|
332
|
+
const s = i.get(I).getCurrentLastSelection();
|
|
332
333
|
if (!(s != null && s.primary)) return !1;
|
|
333
|
-
const { actualColumn:
|
|
334
|
-
return i.get(
|
|
334
|
+
const { actualColumn: r, actualRow: a } = s.primary;
|
|
335
|
+
return i.get(p).executeCommand(P.id, {
|
|
335
336
|
unitId: n.unitId,
|
|
336
337
|
sheetId: n.subUnitId,
|
|
337
338
|
row: a,
|
|
338
|
-
col:
|
|
339
|
+
col: r
|
|
339
340
|
});
|
|
340
341
|
}
|
|
341
|
-
},
|
|
342
|
+
}, oe = {
|
|
342
343
|
id: "sheet.command.toggle-note-popup",
|
|
343
344
|
type: l.COMMAND,
|
|
344
|
-
handler: (i,
|
|
345
|
+
handler: (i, o) => {
|
|
345
346
|
const e = i.get(x), n = D(e);
|
|
346
347
|
if (!n) return !1;
|
|
347
|
-
const s = i.get(
|
|
348
|
+
const s = i.get(I).getCurrentLastSelection();
|
|
348
349
|
if (!(s != null && s.primary)) return !1;
|
|
349
|
-
const { actualColumn:
|
|
350
|
-
return i.get(
|
|
350
|
+
const { actualColumn: r, actualRow: a } = s.primary;
|
|
351
|
+
return i.get(p).executeCommand(V.id, {
|
|
351
352
|
unitId: n.unitId,
|
|
352
353
|
sheetId: n.subUnitId,
|
|
353
354
|
row: a,
|
|
354
|
-
col:
|
|
355
|
+
col: r
|
|
355
356
|
});
|
|
356
357
|
}
|
|
357
|
-
},
|
|
358
|
+
}, re = {
|
|
358
359
|
id: "sheet.command.update-note",
|
|
359
360
|
type: l.COMMAND,
|
|
360
|
-
handler: (i,
|
|
361
|
+
handler: (i, o) => i.get(p).syncExecuteCommand(R.id, o)
|
|
361
362
|
};
|
|
362
|
-
var
|
|
363
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
364
|
-
(
|
|
363
|
+
var ie = Object.getOwnPropertyDescriptor, ae = (i, o, e, n) => {
|
|
364
|
+
for (var t = n > 1 ? void 0 : n ? ie(o, e) : o, s = i.length - 1, r; s >= 0; s--)
|
|
365
|
+
(r = i[s]) && (t = r(t) || t);
|
|
365
366
|
return t;
|
|
366
|
-
},
|
|
367
|
-
let
|
|
367
|
+
}, ce = (i, o) => (e, n) => o(e, n, i);
|
|
368
|
+
let M = class extends S {
|
|
368
369
|
constructor(i) {
|
|
369
370
|
super(), this._commandService = i, this._initialize();
|
|
370
371
|
}
|
|
371
372
|
_initialize() {
|
|
372
373
|
[
|
|
373
374
|
C,
|
|
374
|
-
|
|
375
|
-
|
|
375
|
+
V,
|
|
376
|
+
R,
|
|
376
377
|
P,
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
ne,
|
|
379
|
+
oe,
|
|
380
|
+
re
|
|
380
381
|
].forEach((i) => {
|
|
381
382
|
this.disposeWithMe(
|
|
382
383
|
this._commandService.registerCommand(i)
|
|
@@ -384,55 +385,60 @@ let f = class extends S {
|
|
|
384
385
|
});
|
|
385
386
|
}
|
|
386
387
|
};
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
],
|
|
390
|
-
var
|
|
391
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
392
|
-
(
|
|
388
|
+
M = ae([
|
|
389
|
+
ce(0, p)
|
|
390
|
+
], M);
|
|
391
|
+
var he = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, de = (i, o, e) => o in i ? he(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e, le = (i, o, e, n) => {
|
|
392
|
+
for (var t = n > 1 ? void 0 : n ? ue(o, e) : o, s = i.length - 1, r; s >= 0; s--)
|
|
393
|
+
(r = i[s]) && (t = r(t) || t);
|
|
393
394
|
return t;
|
|
394
|
-
},
|
|
395
|
-
const V = "SHEET_NOTE_PLUGIN";
|
|
395
|
+
}, E = (i, o) => (e, n) => o(e, n, i), j = (i, o, e) => de(i, typeof o != "symbol" ? o + "" : o, e);
|
|
396
396
|
let v = class extends q {
|
|
397
|
-
constructor(i,
|
|
398
|
-
super(), this.
|
|
397
|
+
constructor(i = b, o, e) {
|
|
398
|
+
super(), this._config = i, this._configService = o, this._injector = e;
|
|
399
|
+
const { ...n } = K(
|
|
400
|
+
{},
|
|
401
|
+
b,
|
|
402
|
+
this._config
|
|
403
|
+
);
|
|
404
|
+
this._configService.setConfig(Z, n);
|
|
399
405
|
}
|
|
400
406
|
onStarting() {
|
|
401
407
|
[
|
|
402
408
|
[u],
|
|
403
|
-
[f],
|
|
404
409
|
[M],
|
|
410
|
+
[f],
|
|
405
411
|
[N]
|
|
406
412
|
].forEach((i) => {
|
|
407
413
|
this._injector.add(i);
|
|
408
|
-
}),
|
|
414
|
+
}), O(this._injector, [
|
|
409
415
|
[u],
|
|
410
|
-
[
|
|
411
|
-
[
|
|
416
|
+
[M],
|
|
417
|
+
[f]
|
|
412
418
|
]);
|
|
413
419
|
}
|
|
414
420
|
onReady() {
|
|
415
|
-
|
|
421
|
+
O(this._injector, [
|
|
416
422
|
[N]
|
|
417
423
|
]);
|
|
418
424
|
}
|
|
419
425
|
};
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
v =
|
|
423
|
-
H(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
+
j(v, "pluginName", T);
|
|
427
|
+
j(v, "type", U.UNIVER_SHEET);
|
|
428
|
+
v = le([
|
|
429
|
+
H(Q),
|
|
430
|
+
E(1, z),
|
|
431
|
+
E(2, g(F))
|
|
426
432
|
], v);
|
|
427
433
|
export {
|
|
428
434
|
P as RemoveNoteMutation,
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
435
|
+
ne as SheetDeleteNoteCommand,
|
|
436
|
+
oe as SheetToggleNotePopupCommand,
|
|
437
|
+
re as SheetUpdateNoteCommand,
|
|
432
438
|
u as SheetsNoteModel,
|
|
433
|
-
|
|
434
|
-
|
|
439
|
+
f as SheetsNoteResourceController,
|
|
440
|
+
V as ToggleNotePopupMutation,
|
|
435
441
|
v as UniverSheetsNotePlugin,
|
|
436
|
-
|
|
442
|
+
R as UpdateNoteMutation,
|
|
437
443
|
C as UpdateNotePositionMutation
|
|
438
444
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PLUGIN_NAME = "SHEET_NOTE_PLUGIN";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SHEETS_NOTE_PLUGIN_CONFIG_KEY = "sheets-note.config";
|
|
17
|
+
export declare const configSymbol: unique symbol;
|
|
18
|
+
export interface IUniverSheetsNoteConfig {
|
|
19
|
+
}
|
|
20
|
+
export declare const defaultPluginConfig: IUniverSheetsNoteConfig;
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { IUniverSheetsNoteConfig } from './controllers/config.schema';
|
|
1
2
|
import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
-
export declare const PLUGIN_NAME = "SHEET_NOTE_PLUGIN";
|
|
3
3
|
export declare class UniverSheetsNotePlugin extends Plugin {
|
|
4
|
+
private readonly _config;
|
|
4
5
|
private readonly _configService;
|
|
5
6
|
protected readonly _injector: Injector;
|
|
6
7
|
static pluginName: string;
|
|
7
8
|
static type: UniverInstanceType;
|
|
8
|
-
constructor(_configService: IConfigService, _injector: Injector);
|
|
9
|
+
constructor(_config: IUniverSheetsNoteConfig | undefined, _configService: IConfigService, _injector: Injector);
|
|
9
10
|
onStarting(): void;
|
|
10
11
|
onReady(): void;
|
|
11
12
|
}
|