@univerjs/sheets-note 0.10.11 → 0.10.12-nightly.202510251119
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 +304 -234
- package/lib/index.js +304 -234
- package/lib/types/controllers/sheets-note-resource.controller.d.ts +4 -1
- package/lib/umd/index.js +1 -1
- package/package.json +4 -4
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Disposable as
|
|
5
|
-
import { getSheetCommandTarget as
|
|
6
|
-
import { Subject as
|
|
7
|
-
class u extends
|
|
1
|
+
var W = Object.defineProperty;
|
|
2
|
+
var L = (i, r, e) => r in i ? W(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
|
|
3
|
+
var l = (i, r, e) => L(i, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { Disposable as x, ObjectMatrix as H, CommandType as p, IUniverInstanceService as P, ICommandService as N, IResourceManagerService as J, Inject as g, UniverInstanceType as v, sequenceExecuteAsync as G, DependentOn as z, IConfigService as F, Injector as q, Plugin as K, merge as Y, touchDependencies as O } from "@univerjs/core";
|
|
5
|
+
import { getSheetCommandTarget as T, SheetsSelectionsService as y, SheetInterceptorService as B, RemoveSheetCommand as Q, CopySheetCommand as X, RefRangeService as Z, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests as k, UniverSheetsPlugin as ee } from "@univerjs/sheets";
|
|
6
|
+
import { Subject as te, filter as U, map as E } from "rxjs";
|
|
7
|
+
class u extends x {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
l(this, "_noteMatrix", /* @__PURE__ */ new Map());
|
|
11
|
+
l(this, "_change$", new te());
|
|
12
|
+
l(this, "change$", this._change$.asObservable());
|
|
13
13
|
}
|
|
14
|
-
_ensureNoteMatrix(e,
|
|
14
|
+
_ensureNoteMatrix(e, s) {
|
|
15
15
|
let t = this._noteMatrix.get(e);
|
|
16
16
|
t || (t = /* @__PURE__ */ new Map(), this._noteMatrix.set(e, t));
|
|
17
|
-
let
|
|
18
|
-
return
|
|
17
|
+
let n = t.get(s);
|
|
18
|
+
return n || (n = new H(), t.set(s, n)), n;
|
|
19
19
|
}
|
|
20
|
-
getSheetShowNotes$(e,
|
|
20
|
+
getSheetShowNotes$(e, s) {
|
|
21
21
|
return this._change$.pipe(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const t = this._ensureNoteMatrix(e,
|
|
25
|
-
return t.forValue((
|
|
26
|
-
c.show &&
|
|
27
|
-
}),
|
|
22
|
+
U(({ unitId: t, sheetId: n }) => t === e && n === s),
|
|
23
|
+
E(() => {
|
|
24
|
+
const t = this._ensureNoteMatrix(e, s), n = [];
|
|
25
|
+
return t.forValue((o, a, c) => {
|
|
26
|
+
c.show && n.push({ loc: { row: o, col: a, unitId: e, subUnitId: s }, note: c });
|
|
27
|
+
}), n;
|
|
28
28
|
})
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
|
-
getCellNoteChange$(e,
|
|
31
|
+
getCellNoteChange$(e, s, t, n) {
|
|
32
32
|
return this._change$.pipe(
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
U(({ unitId: o, sheetId: a, row: c, col: h }) => o === e && a === s && c === t && h === n),
|
|
34
|
+
E(({ note: o }) => o)
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
|
-
updateNote(e,
|
|
38
|
-
const c = this._ensureNoteMatrix(e,
|
|
39
|
-
c.setValue(t,
|
|
37
|
+
updateNote(e, s, t, n, o, a) {
|
|
38
|
+
const c = this._ensureNoteMatrix(e, s), h = c.getValue(t, n);
|
|
39
|
+
c.setValue(t, n, o), this._change$.next({ unitId: e, sheetId: s, row: t, col: n, type: "update", note: o, oldNote: h, silent: a });
|
|
40
40
|
}
|
|
41
|
-
removeNote(e,
|
|
42
|
-
const a = this._ensureNoteMatrix(e,
|
|
43
|
-
a.realDeleteValue(t,
|
|
41
|
+
removeNote(e, s, t, n, o) {
|
|
42
|
+
const a = this._ensureNoteMatrix(e, s), c = a.getValue(t, n);
|
|
43
|
+
a.realDeleteValue(t, n), this._change$.next({ unitId: e, sheetId: s, row: t, col: n, type: "update", note: null, oldNote: c, silent: o });
|
|
44
44
|
}
|
|
45
|
-
toggleNotePopup(e,
|
|
46
|
-
const a = this._ensureNoteMatrix(e,
|
|
45
|
+
toggleNotePopup(e, s, t, n, o) {
|
|
46
|
+
const a = this._ensureNoteMatrix(e, s), c = a.getValue(t, n);
|
|
47
47
|
if (c) {
|
|
48
48
|
c.show = !c.show;
|
|
49
49
|
const h = { ...c, show: c.show };
|
|
50
|
-
a.setValue(t,
|
|
50
|
+
a.setValue(t, n, h), this._change$.next({
|
|
51
51
|
unitId: e,
|
|
52
|
-
sheetId:
|
|
52
|
+
sheetId: s,
|
|
53
53
|
row: t,
|
|
54
|
-
col:
|
|
54
|
+
col: n,
|
|
55
55
|
type: "update",
|
|
56
56
|
note: h,
|
|
57
57
|
oldNote: c,
|
|
58
|
-
silent:
|
|
58
|
+
silent: o
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
updateNotePosition(e,
|
|
63
|
-
const h = this._ensureNoteMatrix(e,
|
|
64
|
-
|
|
62
|
+
updateNotePosition(e, s, t, n, o, a, c) {
|
|
63
|
+
const h = this._ensureNoteMatrix(e, s), d = h.getValue(t, n);
|
|
64
|
+
d && (h.realDeleteValue(t, n), h.setValue(o, a, d), this._change$.next({
|
|
65
65
|
unitId: e,
|
|
66
|
-
sheetId:
|
|
66
|
+
sheetId: s,
|
|
67
67
|
row: t,
|
|
68
|
-
col:
|
|
68
|
+
col: n,
|
|
69
69
|
type: "ref",
|
|
70
|
-
newPosition: { row:
|
|
71
|
-
note:
|
|
70
|
+
newPosition: { row: o, col: a },
|
|
71
|
+
note: d,
|
|
72
72
|
silent: c
|
|
73
73
|
}));
|
|
74
74
|
}
|
|
75
|
-
getNote(e,
|
|
76
|
-
return this._ensureNoteMatrix(e,
|
|
75
|
+
getNote(e, s, t, n) {
|
|
76
|
+
return this._ensureNoteMatrix(e, s).getValue(t, n);
|
|
77
77
|
}
|
|
78
78
|
getUnitNotes(e) {
|
|
79
79
|
return this._noteMatrix.get(e);
|
|
80
80
|
}
|
|
81
|
-
getSheetNotes(e,
|
|
81
|
+
getSheetNotes(e, s) {
|
|
82
82
|
const t = this._noteMatrix.get(e);
|
|
83
83
|
if (t)
|
|
84
|
-
return t.get(
|
|
84
|
+
return t.get(s);
|
|
85
85
|
}
|
|
86
86
|
getNotes() {
|
|
87
87
|
return this._noteMatrix;
|
|
@@ -90,93 +90,93 @@ class u extends S {
|
|
|
90
90
|
this._noteMatrix.delete(e);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
const
|
|
93
|
+
const _ = {
|
|
94
94
|
id: "sheet.mutation.update-note",
|
|
95
|
-
type:
|
|
96
|
-
handler: (i,
|
|
97
|
-
const { unitId: e, sheetId:
|
|
98
|
-
return i.get(u).updateNote(e,
|
|
95
|
+
type: p.MUTATION,
|
|
96
|
+
handler: (i, r) => {
|
|
97
|
+
const { unitId: e, sheetId: s, row: t, col: n, note: o, silent: a } = r;
|
|
98
|
+
return i.get(u).updateNote(e, s, t, n, o, a), !0;
|
|
99
99
|
}
|
|
100
|
-
},
|
|
100
|
+
}, m = {
|
|
101
101
|
id: "sheet.mutation.remove-note",
|
|
102
|
-
type:
|
|
103
|
-
handler: (i,
|
|
104
|
-
const { unitId: e, sheetId:
|
|
105
|
-
return i.get(u).removeNote(e,
|
|
102
|
+
type: p.MUTATION,
|
|
103
|
+
handler: (i, r) => {
|
|
104
|
+
const { unitId: e, sheetId: s, row: t, col: n, silent: o } = r;
|
|
105
|
+
return i.get(u).removeNote(e, s, t, n, o), !0;
|
|
106
106
|
}
|
|
107
|
-
},
|
|
107
|
+
}, D = {
|
|
108
108
|
id: "sheet.mutation.toggle-note-popup",
|
|
109
|
-
type:
|
|
110
|
-
handler: (i,
|
|
111
|
-
const { unitId: e, sheetId:
|
|
112
|
-
return i.get(u).toggleNotePopup(e,
|
|
109
|
+
type: p.MUTATION,
|
|
110
|
+
handler: (i, r) => {
|
|
111
|
+
const { unitId: e, sheetId: s, row: t, col: n, silent: o } = r;
|
|
112
|
+
return i.get(u).toggleNotePopup(e, s, t, n, o), !0;
|
|
113
113
|
}
|
|
114
|
-
},
|
|
114
|
+
}, R = {
|
|
115
115
|
id: "sheet.mutation.update-note-position",
|
|
116
|
-
type:
|
|
117
|
-
handler: (i,
|
|
118
|
-
const { unitId: e, sheetId:
|
|
119
|
-
return i.get(u).updateNotePosition(e,
|
|
116
|
+
type: p.MUTATION,
|
|
117
|
+
handler: (i, r) => {
|
|
118
|
+
const { unitId: e, sheetId: s, row: t, col: n, newPosition: o, silent: a } = r;
|
|
119
|
+
return i.get(u).updateNotePosition(e, s, t, n, o.row, o.col, a), !0;
|
|
120
120
|
}
|
|
121
|
-
},
|
|
121
|
+
}, se = {
|
|
122
122
|
id: "sheet.command.delete-note",
|
|
123
|
-
type:
|
|
124
|
-
handler: (i,
|
|
125
|
-
const e = i.get(
|
|
126
|
-
if (!
|
|
127
|
-
const
|
|
128
|
-
if (!(
|
|
129
|
-
const { actualColumn:
|
|
130
|
-
return i.get(
|
|
131
|
-
unitId:
|
|
132
|
-
sheetId:
|
|
123
|
+
type: p.COMMAND,
|
|
124
|
+
handler: (i, r) => {
|
|
125
|
+
const e = i.get(P), s = T(e);
|
|
126
|
+
if (!s) return !1;
|
|
127
|
+
const n = i.get(y).getCurrentLastSelection();
|
|
128
|
+
if (!(n != null && n.primary)) return !1;
|
|
129
|
+
const { actualColumn: o, actualRow: a } = n.primary;
|
|
130
|
+
return i.get(N).executeCommand(m.id, {
|
|
131
|
+
unitId: s.unitId,
|
|
132
|
+
sheetId: s.subUnitId,
|
|
133
133
|
row: a,
|
|
134
|
-
col:
|
|
134
|
+
col: o
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
},
|
|
137
|
+
}, ne = {
|
|
138
138
|
id: "sheet.command.toggle-note-popup",
|
|
139
|
-
type:
|
|
140
|
-
handler: (i,
|
|
141
|
-
const e = i.get(
|
|
142
|
-
if (!
|
|
143
|
-
const
|
|
144
|
-
if (!(
|
|
145
|
-
const { actualColumn:
|
|
146
|
-
return i.get(
|
|
147
|
-
unitId:
|
|
148
|
-
sheetId:
|
|
139
|
+
type: p.COMMAND,
|
|
140
|
+
handler: (i, r) => {
|
|
141
|
+
const e = i.get(P), s = T(e);
|
|
142
|
+
if (!s) return !1;
|
|
143
|
+
const n = i.get(y).getCurrentLastSelection();
|
|
144
|
+
if (!(n != null && n.primary)) return !1;
|
|
145
|
+
const { actualColumn: o, actualRow: a } = n.primary;
|
|
146
|
+
return i.get(N).executeCommand(D.id, {
|
|
147
|
+
unitId: s.unitId,
|
|
148
|
+
sheetId: s.subUnitId,
|
|
149
149
|
row: a,
|
|
150
|
-
col:
|
|
150
|
+
col: o
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
},
|
|
153
|
+
}, re = {
|
|
154
154
|
id: "sheet.command.update-note",
|
|
155
|
-
type:
|
|
156
|
-
handler: (i,
|
|
155
|
+
type: p.COMMAND,
|
|
156
|
+
handler: (i, r) => i.get(N).syncExecuteCommand(_.id, r)
|
|
157
157
|
}, V = "SHEET_NOTE_PLUGIN";
|
|
158
|
-
var
|
|
159
|
-
for (var t =
|
|
160
|
-
(
|
|
158
|
+
var oe = Object.getOwnPropertyDescriptor, ie = (i, r, e, s) => {
|
|
159
|
+
for (var t = s > 1 ? void 0 : s ? oe(r, e) : r, n = i.length - 1, o; n >= 0; n--)
|
|
160
|
+
(o = i[n]) && (t = o(t) || t);
|
|
161
161
|
return t;
|
|
162
|
-
},
|
|
163
|
-
let
|
|
164
|
-
constructor(i,
|
|
165
|
-
super(), this._resourceManagerService = i, this._univerInstanceService =
|
|
162
|
+
}, f = (i, r) => (e, s) => r(e, s, i);
|
|
163
|
+
let M = class extends x {
|
|
164
|
+
constructor(i, r, e, s) {
|
|
165
|
+
super(), this._resourceManagerService = i, this._univerInstanceService = r, this._sheetInterceptorService = e, this._sheetsNoteModel = s, this._initSnapshot(), this._initSheetChange();
|
|
166
166
|
}
|
|
167
167
|
_initSnapshot() {
|
|
168
168
|
const i = (e) => {
|
|
169
|
-
const
|
|
170
|
-
if (!
|
|
169
|
+
const s = this._sheetsNoteModel.getUnitNotes(e);
|
|
170
|
+
if (!s)
|
|
171
171
|
return "";
|
|
172
172
|
const t = {};
|
|
173
|
-
return
|
|
173
|
+
return s.forEach((n, o) => {
|
|
174
174
|
const a = {};
|
|
175
|
-
|
|
176
|
-
a[c] || (a[c] = {}), a[c][h] =
|
|
177
|
-
}), Object.keys(a).length > 0 && (t[
|
|
175
|
+
n.forValue((c, h, d) => {
|
|
176
|
+
a[c] || (a[c] = {}), a[c][h] = d;
|
|
177
|
+
}), Object.keys(a).length > 0 && (t[o] = a);
|
|
178
178
|
}), JSON.stringify(t);
|
|
179
|
-
},
|
|
179
|
+
}, r = (e) => {
|
|
180
180
|
if (!e)
|
|
181
181
|
return {};
|
|
182
182
|
try {
|
|
@@ -188,20 +188,20 @@ let N = class extends S {
|
|
|
188
188
|
this.disposeWithMe(
|
|
189
189
|
this._resourceManagerService.registerPluginResource({
|
|
190
190
|
pluginName: V,
|
|
191
|
-
businesses: [
|
|
191
|
+
businesses: [v.UNIVER_SHEET],
|
|
192
192
|
toJson: (e) => i(e),
|
|
193
|
-
parseJson: (e) =>
|
|
193
|
+
parseJson: (e) => r(e),
|
|
194
194
|
onUnLoad: (e) => {
|
|
195
195
|
this._sheetsNoteModel.deleteUnitNotes(e);
|
|
196
196
|
},
|
|
197
|
-
onLoad: (e,
|
|
198
|
-
Object.entries(
|
|
199
|
-
Object.entries(
|
|
197
|
+
onLoad: (e, s) => {
|
|
198
|
+
Object.entries(s).forEach(([t, n]) => {
|
|
199
|
+
Object.entries(n).forEach(([o, a]) => {
|
|
200
200
|
Object.entries(a).forEach(([c, h]) => {
|
|
201
201
|
this._sheetsNoteModel.updateNote(
|
|
202
202
|
e,
|
|
203
203
|
t,
|
|
204
|
-
Number(
|
|
204
|
+
Number(o),
|
|
205
205
|
Number(c),
|
|
206
206
|
h
|
|
207
207
|
);
|
|
@@ -212,140 +212,210 @@ let N = class extends S {
|
|
|
212
212
|
})
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
|
+
// eslint-disable-next-line max-lines-per-function
|
|
216
|
+
_initSheetChange() {
|
|
217
|
+
this.disposeWithMe(
|
|
218
|
+
this._sheetInterceptorService.interceptCommand({
|
|
219
|
+
// eslint-disable-next-line max-lines-per-function
|
|
220
|
+
getMutations: (i) => {
|
|
221
|
+
var r;
|
|
222
|
+
if (i.id === Q.id) {
|
|
223
|
+
const e = i.params, s = e.unitId || this._univerInstanceService.getCurrentUnitOfType(v.UNIVER_SHEET).getUnitId(), t = e.subUnitId || ((r = this._univerInstanceService.getCurrentUnitOfType(v.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : r.getSheetId());
|
|
224
|
+
if (!s || !t)
|
|
225
|
+
return { redos: [], undos: [] };
|
|
226
|
+
const n = this._sheetsNoteModel.getSheetNotes(s, t);
|
|
227
|
+
if (!n)
|
|
228
|
+
return { redos: [], undos: [] };
|
|
229
|
+
const o = [], a = [];
|
|
230
|
+
return n.forValue((c, h, d) => {
|
|
231
|
+
o.push({
|
|
232
|
+
id: m.id,
|
|
233
|
+
params: {
|
|
234
|
+
unitId: s,
|
|
235
|
+
sheetId: t,
|
|
236
|
+
row: c,
|
|
237
|
+
col: h
|
|
238
|
+
}
|
|
239
|
+
}), a.push({
|
|
240
|
+
id: _.id,
|
|
241
|
+
params: {
|
|
242
|
+
unitId: s,
|
|
243
|
+
sheetId: t,
|
|
244
|
+
row: c,
|
|
245
|
+
col: h,
|
|
246
|
+
note: d
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}), { redos: o, undos: a };
|
|
250
|
+
} else if (i.id === X.id) {
|
|
251
|
+
const e = i.params, { unitId: s, subUnitId: t, targetSubUnitId: n } = e;
|
|
252
|
+
if (!s || !t || !n)
|
|
253
|
+
return { redos: [], undos: [] };
|
|
254
|
+
const o = this._sheetsNoteModel.getSheetNotes(s, t);
|
|
255
|
+
if (!o)
|
|
256
|
+
return { redos: [], undos: [] };
|
|
257
|
+
const a = [], c = [];
|
|
258
|
+
return o.forValue((h, d, A) => {
|
|
259
|
+
a.push({
|
|
260
|
+
id: _.id,
|
|
261
|
+
params: {
|
|
262
|
+
unitId: s,
|
|
263
|
+
sheetId: n,
|
|
264
|
+
row: h,
|
|
265
|
+
col: d,
|
|
266
|
+
note: A
|
|
267
|
+
}
|
|
268
|
+
}), c.push({
|
|
269
|
+
id: m.id,
|
|
270
|
+
params: {
|
|
271
|
+
unitId: s,
|
|
272
|
+
sheetId: n,
|
|
273
|
+
row: h,
|
|
274
|
+
col: d
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}), { redos: a, undos: c };
|
|
278
|
+
}
|
|
279
|
+
return { redos: [], undos: [] };
|
|
280
|
+
}
|
|
281
|
+
})
|
|
282
|
+
);
|
|
283
|
+
}
|
|
215
284
|
};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
285
|
+
M = ie([
|
|
286
|
+
f(0, J),
|
|
287
|
+
f(1, P),
|
|
288
|
+
f(2, g(B)),
|
|
289
|
+
f(3, g(u))
|
|
290
|
+
], M);
|
|
291
|
+
const ae = "sheets-note.config", b = {};
|
|
292
|
+
var ce = Object.getOwnPropertyDescriptor, he = (i, r, e, s) => {
|
|
293
|
+
for (var t = s > 1 ? void 0 : s ? ce(r, e) : r, n = i.length - 1, o; n >= 0; n--)
|
|
294
|
+
(o = i[n]) && (t = o(t) || t);
|
|
225
295
|
return t;
|
|
226
|
-
},
|
|
227
|
-
let
|
|
228
|
-
constructor(
|
|
296
|
+
}, S = (i, r) => (e, s) => r(e, s, i);
|
|
297
|
+
let I = class extends x {
|
|
298
|
+
constructor(r, e, s, t) {
|
|
229
299
|
super();
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
300
|
+
l(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
301
|
+
l(this, "_watcherMap", /* @__PURE__ */ new Map());
|
|
302
|
+
l(this, "_handleRangeChange", (r, e, s, t, n, o, a) => o ? {
|
|
233
303
|
redos: [{
|
|
234
|
-
id:
|
|
304
|
+
id: R.id,
|
|
235
305
|
params: {
|
|
236
|
-
unitId:
|
|
306
|
+
unitId: r,
|
|
237
307
|
sheetId: e,
|
|
238
308
|
row: t,
|
|
239
|
-
col:
|
|
309
|
+
col: n,
|
|
240
310
|
newPosition: {
|
|
241
|
-
row:
|
|
242
|
-
col:
|
|
311
|
+
row: o.startRow,
|
|
312
|
+
col: o.startColumn
|
|
243
313
|
},
|
|
244
314
|
silent: a
|
|
245
315
|
}
|
|
246
316
|
}],
|
|
247
317
|
undos: [{
|
|
248
|
-
id:
|
|
318
|
+
id: R.id,
|
|
249
319
|
params: {
|
|
250
|
-
unitId:
|
|
320
|
+
unitId: r,
|
|
251
321
|
sheetId: e,
|
|
252
|
-
row:
|
|
253
|
-
col:
|
|
322
|
+
row: o.startRow,
|
|
323
|
+
col: o.startColumn,
|
|
254
324
|
newPosition: {
|
|
255
325
|
row: t,
|
|
256
|
-
col:
|
|
326
|
+
col: n
|
|
257
327
|
},
|
|
258
|
-
note:
|
|
328
|
+
note: s,
|
|
259
329
|
silent: a
|
|
260
330
|
}
|
|
261
331
|
}]
|
|
262
332
|
} : {
|
|
263
333
|
redos: [{
|
|
264
|
-
id:
|
|
334
|
+
id: m.id,
|
|
265
335
|
params: {
|
|
266
|
-
unitId:
|
|
336
|
+
unitId: r,
|
|
267
337
|
sheetId: e,
|
|
268
338
|
row: t,
|
|
269
|
-
col:
|
|
339
|
+
col: n
|
|
270
340
|
}
|
|
271
341
|
}],
|
|
272
342
|
undos: [{
|
|
273
|
-
id:
|
|
343
|
+
id: _.id,
|
|
274
344
|
params: {
|
|
275
|
-
unitId:
|
|
345
|
+
unitId: r,
|
|
276
346
|
sheetId: e,
|
|
277
347
|
row: t,
|
|
278
|
-
col:
|
|
279
|
-
note:
|
|
348
|
+
col: n,
|
|
349
|
+
note: s
|
|
280
350
|
}
|
|
281
351
|
}]
|
|
282
352
|
});
|
|
283
|
-
this._refRangeService =
|
|
353
|
+
this._refRangeService = r, this._sheetsNoteModel = e, this._selectionManagerService = s, this._commandService = t, this._initData(), this._initRefRange();
|
|
284
354
|
}
|
|
285
|
-
_getIdWithUnitId(
|
|
286
|
-
return `${
|
|
355
|
+
_getIdWithUnitId(r, e, s, t) {
|
|
356
|
+
return `${r}-${e}-${s}-${t}`;
|
|
287
357
|
}
|
|
288
|
-
_register(
|
|
289
|
-
const
|
|
290
|
-
startColumn:
|
|
291
|
-
endColumn:
|
|
358
|
+
_register(r, e, s, t, n) {
|
|
359
|
+
const o = {
|
|
360
|
+
startColumn: n,
|
|
361
|
+
endColumn: n,
|
|
292
362
|
startRow: t,
|
|
293
363
|
endRow: t
|
|
294
364
|
};
|
|
295
365
|
this._disposableMap.set(
|
|
296
|
-
this._getIdWithUnitId(
|
|
297
|
-
this._refRangeService.registerRefRange(
|
|
298
|
-
const c =
|
|
299
|
-
return h && h.startColumn ===
|
|
366
|
+
this._getIdWithUnitId(r, e, t, n),
|
|
367
|
+
this._refRangeService.registerRefRange(o, (a) => {
|
|
368
|
+
const c = k(o, a, { selectionManagerService: this._selectionManagerService }), h = Array.isArray(c) ? c[0] : c;
|
|
369
|
+
return h && h.startColumn === o.startColumn && h.startRow === o.startRow ? {
|
|
300
370
|
undos: [],
|
|
301
371
|
redos: []
|
|
302
|
-
} : this._handleRangeChange(
|
|
303
|
-
},
|
|
372
|
+
} : this._handleRangeChange(r, e, s, t, n, h, !1);
|
|
373
|
+
}, r, e)
|
|
304
374
|
);
|
|
305
375
|
}
|
|
306
|
-
_watch(
|
|
307
|
-
const
|
|
308
|
-
startColumn:
|
|
309
|
-
endColumn:
|
|
376
|
+
_watch(r, e, s, t, n) {
|
|
377
|
+
const o = {
|
|
378
|
+
startColumn: n,
|
|
379
|
+
endColumn: n,
|
|
310
380
|
startRow: t,
|
|
311
381
|
endRow: t
|
|
312
382
|
};
|
|
313
383
|
this._watcherMap.set(
|
|
314
|
-
this._getIdWithUnitId(
|
|
315
|
-
this._refRangeService.watchRange(
|
|
316
|
-
const { redos: h } = this._handleRangeChange(
|
|
384
|
+
this._getIdWithUnitId(r, e, t, n),
|
|
385
|
+
this._refRangeService.watchRange(r, e, o, (a, c) => {
|
|
386
|
+
const { redos: h } = this._handleRangeChange(r, e, s, a.startRow, a.startColumn, c, !0);
|
|
317
387
|
G(h, this._commandService, { onlyLocal: !0 });
|
|
318
388
|
}, !0)
|
|
319
389
|
);
|
|
320
390
|
}
|
|
321
|
-
_unwatch(
|
|
322
|
-
var
|
|
323
|
-
const
|
|
324
|
-
(
|
|
391
|
+
_unwatch(r, e, s, t) {
|
|
392
|
+
var o;
|
|
393
|
+
const n = this._getIdWithUnitId(r, e, s, t);
|
|
394
|
+
(o = this._watcherMap.get(n)) == null || o.dispose(), this._watcherMap.delete(n);
|
|
325
395
|
}
|
|
326
|
-
_unregister(
|
|
327
|
-
var
|
|
328
|
-
const
|
|
329
|
-
(
|
|
396
|
+
_unregister(r, e, s, t) {
|
|
397
|
+
var o;
|
|
398
|
+
const n = this._getIdWithUnitId(r, e, s, t);
|
|
399
|
+
(o = this._disposableMap.get(n)) == null || o.dispose(), this._disposableMap.delete(n);
|
|
330
400
|
}
|
|
331
401
|
_initData() {
|
|
332
|
-
const
|
|
333
|
-
for (const [e,
|
|
334
|
-
for (const [t,
|
|
335
|
-
|
|
402
|
+
const r = this._sheetsNoteModel.getNotes();
|
|
403
|
+
for (const [e, s] of r)
|
|
404
|
+
for (const [t, n] of s)
|
|
405
|
+
n.forValue((o, a, c) => (c && (this._register(e, t, c, o, a), this._watch(e, t, c, o, a)), !0));
|
|
336
406
|
}
|
|
337
407
|
_initRefRange() {
|
|
338
408
|
this.disposeWithMe(
|
|
339
|
-
this._sheetsNoteModel.change$.subscribe((
|
|
340
|
-
switch (
|
|
409
|
+
this._sheetsNoteModel.change$.subscribe((r) => {
|
|
410
|
+
switch (r.type) {
|
|
341
411
|
case "update": {
|
|
342
|
-
const { unitId: e, sheetId:
|
|
343
|
-
|
|
412
|
+
const { unitId: e, sheetId: s, row: t, col: n, note: o } = r, a = this._getIdWithUnitId(e, s, t, n);
|
|
413
|
+
o ? this._disposableMap.has(a) || (this._register(e, s, o, t, n), this._watch(e, s, o, t, n)) : (this._unregister(e, s, t, n), this._unwatch(e, s, t, n));
|
|
344
414
|
break;
|
|
345
415
|
}
|
|
346
416
|
case "ref": {
|
|
347
|
-
const { unitId: e, sheetId:
|
|
348
|
-
this._unregister(e,
|
|
417
|
+
const { unitId: e, sheetId: s, row: t, col: n, newPosition: o, note: a, silent: c } = r;
|
|
418
|
+
this._unregister(e, s, t, n), c || (this._unwatch(e, s, t, n), this._watch(e, s, a, o.row, o.col)), this._register(e, s, a, o.row, o.col);
|
|
349
419
|
break;
|
|
350
420
|
}
|
|
351
421
|
}
|
|
@@ -353,30 +423,30 @@ let f = class extends S {
|
|
|
353
423
|
);
|
|
354
424
|
}
|
|
355
425
|
};
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
],
|
|
362
|
-
var
|
|
363
|
-
for (var t =
|
|
364
|
-
(
|
|
426
|
+
I = he([
|
|
427
|
+
S(0, g(Z)),
|
|
428
|
+
S(1, g(u)),
|
|
429
|
+
S(2, g(y)),
|
|
430
|
+
S(3, N)
|
|
431
|
+
], I);
|
|
432
|
+
var de = Object.getOwnPropertyDescriptor, ue = (i, r, e, s) => {
|
|
433
|
+
for (var t = s > 1 ? void 0 : s ? de(r, e) : r, n = i.length - 1, o; n >= 0; n--)
|
|
434
|
+
(o = i[n]) && (t = o(t) || t);
|
|
365
435
|
return t;
|
|
366
|
-
},
|
|
367
|
-
let
|
|
436
|
+
}, le = (i, r) => (e, s) => r(e, s, i);
|
|
437
|
+
let C = class extends x {
|
|
368
438
|
constructor(i) {
|
|
369
439
|
super(), this._commandService = i, this._initialize();
|
|
370
440
|
}
|
|
371
441
|
_initialize() {
|
|
372
442
|
[
|
|
373
|
-
C,
|
|
374
|
-
T,
|
|
375
443
|
R,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
444
|
+
D,
|
|
445
|
+
_,
|
|
446
|
+
m,
|
|
447
|
+
se,
|
|
448
|
+
ne,
|
|
449
|
+
re
|
|
380
450
|
].forEach((i) => {
|
|
381
451
|
this.disposeWithMe(
|
|
382
452
|
this._commandService.registerCommand(i)
|
|
@@ -384,60 +454,60 @@ let M = class extends S {
|
|
|
384
454
|
});
|
|
385
455
|
}
|
|
386
456
|
};
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
],
|
|
390
|
-
var
|
|
391
|
-
for (var t =
|
|
392
|
-
(
|
|
457
|
+
C = ue([
|
|
458
|
+
le(0, N)
|
|
459
|
+
], C);
|
|
460
|
+
var pe = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, _e = (i, r, e) => r in i ? pe(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e, me = (i, r, e, s) => {
|
|
461
|
+
for (var t = s > 1 ? void 0 : s ? ge(r, e) : r, n = i.length - 1, o; n >= 0; n--)
|
|
462
|
+
(o = i[n]) && (t = o(t) || t);
|
|
393
463
|
return t;
|
|
394
|
-
},
|
|
395
|
-
let
|
|
396
|
-
constructor(i = b,
|
|
397
|
-
super(), this._config = i, this._configService =
|
|
398
|
-
const { ...
|
|
464
|
+
}, $ = (i, r) => (e, s) => r(e, s, i), j = (i, r, e) => _e(i, typeof r != "symbol" ? r + "" : r, e);
|
|
465
|
+
let w = class extends K {
|
|
466
|
+
constructor(i = b, r, e) {
|
|
467
|
+
super(), this._config = i, this._configService = r, this._injector = e;
|
|
468
|
+
const { ...s } = Y(
|
|
399
469
|
{},
|
|
400
470
|
b,
|
|
401
471
|
this._config
|
|
402
472
|
);
|
|
403
|
-
this._configService.setConfig(
|
|
473
|
+
this._configService.setConfig(ae, s);
|
|
404
474
|
}
|
|
405
475
|
onStarting() {
|
|
406
476
|
[
|
|
407
477
|
[u],
|
|
478
|
+
[C],
|
|
408
479
|
[M],
|
|
409
|
-
[
|
|
410
|
-
[f]
|
|
480
|
+
[I]
|
|
411
481
|
].forEach((i) => {
|
|
412
482
|
this._injector.add(i);
|
|
413
483
|
}), O(this._injector, [
|
|
414
484
|
[u],
|
|
415
|
-
[
|
|
416
|
-
[
|
|
485
|
+
[C],
|
|
486
|
+
[M]
|
|
417
487
|
]);
|
|
418
488
|
}
|
|
419
489
|
onReady() {
|
|
420
490
|
O(this._injector, [
|
|
421
|
-
[
|
|
491
|
+
[I]
|
|
422
492
|
]);
|
|
423
493
|
}
|
|
424
494
|
};
|
|
425
|
-
j(
|
|
426
|
-
j(
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
],
|
|
495
|
+
j(w, "pluginName", V);
|
|
496
|
+
j(w, "type", v.UNIVER_SHEET);
|
|
497
|
+
w = me([
|
|
498
|
+
z(ee),
|
|
499
|
+
$(1, F),
|
|
500
|
+
$(2, g(q))
|
|
501
|
+
], w);
|
|
432
502
|
export {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
503
|
+
m as RemoveNoteMutation,
|
|
504
|
+
se as SheetDeleteNoteCommand,
|
|
505
|
+
ne as SheetToggleNotePopupCommand,
|
|
506
|
+
re as SheetUpdateNoteCommand,
|
|
437
507
|
u as SheetsNoteModel,
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
508
|
+
M as SheetsNoteResourceController,
|
|
509
|
+
D as ToggleNotePopupMutation,
|
|
510
|
+
w as UniverSheetsNotePlugin,
|
|
511
|
+
_ as UpdateNoteMutation,
|
|
512
|
+
R as UpdateNotePositionMutation
|
|
443
513
|
};
|