@univerjs/sheets-thread-comment 0.16.1 → 0.17.0
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/facade.js +0 -4
- package/lib/es/index.js +192 -187
- package/lib/facade.js +0 -4
- package/lib/index.js +192 -187
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.d.ts +3 -1
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
package/lib/index.js
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var _ = (a, e,
|
|
4
|
-
import { Inject as h, IUniverInstanceService as
|
|
5
|
-
import { singleReferenceToGrid as
|
|
6
|
-
import { RefRangeService as
|
|
7
|
-
import { ThreadCommentModel as
|
|
8
|
-
import { Subject as
|
|
9
|
-
var
|
|
10
|
-
for (var
|
|
11
|
-
(o = a[s]) && (
|
|
12
|
-
return
|
|
13
|
-
},
|
|
14
|
-
let
|
|
15
|
-
constructor(e,
|
|
1
|
+
var W = Object.defineProperty;
|
|
2
|
+
var j = (a, e, n) => e in a ? W(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
|
|
3
|
+
var _ = (a, e, n) => j(a, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { Inject as h, IUniverInstanceService as O, Disposable as R, ObjectMatrix as N, UniverInstanceType as C, ICommandService as P, sequenceExecuteAsync as L, toDisposable as V, generateRandomId as T, DependentOn as B, Injector as H, Plugin as k, touchDependencies as F } from "@univerjs/core";
|
|
5
|
+
import { singleReferenceToGrid as g, serializeRange as E } from "@univerjs/engine-formula";
|
|
6
|
+
import { RefRangeService as z, SheetsSelectionsService as G, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests as q, SheetInterceptorService as J, RemoveSheetCommand as K, CopySheetCommand as Q } from "@univerjs/sheets";
|
|
7
|
+
import { ThreadCommentModel as U, AddCommentMutation as I, DeleteCommentMutation as y, UpdateCommentRefMutation as x, IThreadCommentDataSourceService as X, UniverThreadCommentPlugin as Y } from "@univerjs/thread-comment";
|
|
8
|
+
import { Subject as Z } from "rxjs";
|
|
9
|
+
var ee = Object.getOwnPropertyDescriptor, te = (a, e, n, t) => {
|
|
10
|
+
for (var r = t > 1 ? void 0 : t ? ee(e, n) : e, s = a.length - 1, o; s >= 0; s--)
|
|
11
|
+
(o = a[s]) && (r = o(r) || r);
|
|
12
|
+
return r;
|
|
13
|
+
}, D = (a, e) => (n, t) => e(n, t, a);
|
|
14
|
+
let M = class extends R {
|
|
15
|
+
constructor(e, n) {
|
|
16
16
|
super();
|
|
17
17
|
_(this, "_matrixMap", /* @__PURE__ */ new Map());
|
|
18
18
|
_(this, "_locationMap", /* @__PURE__ */ new Map());
|
|
19
|
-
_(this, "_commentUpdate$", new
|
|
19
|
+
_(this, "_commentUpdate$", new Z());
|
|
20
20
|
_(this, "commentUpdate$", this._commentUpdate$.asObservable());
|
|
21
|
-
this._threadCommentModel = e, this._univerInstanceService =
|
|
21
|
+
this._threadCommentModel = e, this._univerInstanceService = n, this._init(), this.disposeWithMe(() => {
|
|
22
22
|
this._commentUpdate$.complete();
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
_init() {
|
|
26
26
|
this._initData(), this._initUpdateTransform();
|
|
27
27
|
}
|
|
28
|
-
_ensureCommentMatrix(e,
|
|
28
|
+
_ensureCommentMatrix(e, n) {
|
|
29
29
|
let t = this._matrixMap.get(e);
|
|
30
30
|
t || (t = /* @__PURE__ */ new Map(), this._matrixMap.set(e, t));
|
|
31
|
-
let
|
|
32
|
-
return
|
|
31
|
+
let r = t.get(n);
|
|
32
|
+
return r || (r = new N(), t.set(n, r)), r;
|
|
33
33
|
}
|
|
34
|
-
_ensureCommentLocationMap(e,
|
|
34
|
+
_ensureCommentLocationMap(e, n) {
|
|
35
35
|
let t = this._locationMap.get(e);
|
|
36
36
|
t || (t = /* @__PURE__ */ new Map(), this._locationMap.set(e, t));
|
|
37
|
-
let
|
|
38
|
-
return
|
|
37
|
+
let r = t.get(n);
|
|
38
|
+
return r || (r = /* @__PURE__ */ new Map(), t.set(n, r)), r;
|
|
39
39
|
}
|
|
40
|
-
_addCommentToMatrix(e,
|
|
40
|
+
_addCommentToMatrix(e, n, t, r) {
|
|
41
41
|
var o;
|
|
42
|
-
const s = (o = e.getValue(
|
|
43
|
-
s.add(
|
|
42
|
+
const s = (o = e.getValue(n, t)) != null ? o : /* @__PURE__ */ new Set();
|
|
43
|
+
s.add(r), e.setValue(n, t, s);
|
|
44
44
|
}
|
|
45
|
-
_deleteCommentFromMatrix(e,
|
|
46
|
-
if (
|
|
47
|
-
const s = e.getValue(
|
|
48
|
-
s && s.has(
|
|
45
|
+
_deleteCommentFromMatrix(e, n, t, r) {
|
|
46
|
+
if (n >= 0 && t >= 0) {
|
|
47
|
+
const s = e.getValue(n, t);
|
|
48
|
+
s && s.has(r) && (s.delete(r), s.size === 0 && e.realDeleteValue(n, t));
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
_ensure(e,
|
|
52
|
-
const t = this._ensureCommentMatrix(e,
|
|
53
|
-
return { matrix: t, locationMap:
|
|
51
|
+
_ensure(e, n) {
|
|
52
|
+
const t = this._ensureCommentMatrix(e, n), r = this._ensureCommentLocationMap(e, n);
|
|
53
|
+
return { matrix: t, locationMap: r };
|
|
54
54
|
}
|
|
55
55
|
_initData() {
|
|
56
56
|
const e = this._threadCommentModel.getAll();
|
|
57
|
-
for (const
|
|
58
|
-
for (const t of
|
|
59
|
-
const { unitId:
|
|
60
|
-
this._addComment(
|
|
57
|
+
for (const n of e)
|
|
58
|
+
for (const t of n.threads) {
|
|
59
|
+
const { unitId: r, subUnitId: s, root: o } = t;
|
|
60
|
+
this._addComment(r, s, o);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
_addComment(e,
|
|
64
|
-
const
|
|
63
|
+
_addComment(e, n, t) {
|
|
64
|
+
const r = g(t.ref), s = t.parentId, { row: o, column: i } = r, c = t.id, { matrix: m, locationMap: d } = this._ensure(e, n);
|
|
65
65
|
!s && o >= 0 && i >= 0 && (this._addCommentToMatrix(m, o, i, c), d.set(c, { row: o, column: i })), s || this._commentUpdate$.next({
|
|
66
66
|
unitId: e,
|
|
67
|
-
subUnitId:
|
|
67
|
+
subUnitId: n,
|
|
68
68
|
payload: t,
|
|
69
69
|
type: "add",
|
|
70
70
|
isRoot: !s,
|
|
71
|
-
...
|
|
71
|
+
...r
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
// eslint-disable-next-line max-lines-per-function
|
|
75
75
|
_initUpdateTransform() {
|
|
76
76
|
this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe((e) => {
|
|
77
|
-
const { unitId:
|
|
77
|
+
const { unitId: n, subUnitId: t } = e;
|
|
78
78
|
try {
|
|
79
|
-
if (this._univerInstanceService.getUnitType(
|
|
79
|
+
if (this._univerInstanceService.getUnitType(n) !== C.UNIVER_SHEET)
|
|
80
80
|
return;
|
|
81
81
|
} catch {
|
|
82
82
|
}
|
|
83
|
-
const { matrix:
|
|
83
|
+
const { matrix: r, locationMap: s } = this._ensure(n, t);
|
|
84
84
|
switch (e.type) {
|
|
85
85
|
case "add": {
|
|
86
86
|
this._addComment(e.unitId, e.subUnitId, e.payload);
|
|
@@ -89,8 +89,8 @@ let C = class extends y {
|
|
|
89
89
|
case "delete": {
|
|
90
90
|
const { isRoot: o, comment: i } = e.payload;
|
|
91
91
|
if (o) {
|
|
92
|
-
const c =
|
|
93
|
-
this._deleteCommentFromMatrix(
|
|
92
|
+
const c = g(i.ref), { row: m, column: d } = c;
|
|
93
|
+
this._deleteCommentFromMatrix(r, m, d, i.id), this._commentUpdate$.next({
|
|
94
94
|
...e,
|
|
95
95
|
...c
|
|
96
96
|
});
|
|
@@ -98,10 +98,10 @@ let C = class extends y {
|
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
case "update": {
|
|
101
|
-
const { commentId: o } = e.payload, i = this._threadCommentModel.getComment(
|
|
101
|
+
const { commentId: o } = e.payload, i = this._threadCommentModel.getComment(n, t, o);
|
|
102
102
|
if (!i)
|
|
103
103
|
return;
|
|
104
|
-
const c =
|
|
104
|
+
const c = g(i.ref);
|
|
105
105
|
this._commentUpdate$.next({
|
|
106
106
|
...e,
|
|
107
107
|
...c
|
|
@@ -109,11 +109,11 @@ let C = class extends y {
|
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
111
111
|
case "updateRef": {
|
|
112
|
-
const o =
|
|
112
|
+
const o = g(e.payload.ref), { commentId: i } = e.payload, c = s.get(i);
|
|
113
113
|
if (!c)
|
|
114
114
|
return;
|
|
115
115
|
const { row: m, column: d } = c;
|
|
116
|
-
this._deleteCommentFromMatrix(
|
|
116
|
+
this._deleteCommentFromMatrix(r, m, d, i), s.delete(i), o.row >= 0 && o.column >= 0 && (this._addCommentToMatrix(r, o.row, o.column, i), s.set(i, { row: o.row, column: o.column })), this._commentUpdate$.next({
|
|
117
117
|
...e,
|
|
118
118
|
...o
|
|
119
119
|
});
|
|
@@ -130,77 +130,77 @@ let C = class extends y {
|
|
|
130
130
|
}
|
|
131
131
|
}));
|
|
132
132
|
}
|
|
133
|
-
getByLocation(e,
|
|
133
|
+
getByLocation(e, n, t, r) {
|
|
134
134
|
var i;
|
|
135
|
-
return (i = this.getAllByLocation(e,
|
|
135
|
+
return (i = this.getAllByLocation(e, n, t, r).filter((c) => !c.resolved)[0]) == null ? void 0 : i.id;
|
|
136
136
|
}
|
|
137
|
-
getAllByLocation(e,
|
|
138
|
-
const o = this._ensureCommentMatrix(e,
|
|
139
|
-
return o ? Array.from(o).map((i) => this.getComment(e,
|
|
137
|
+
getAllByLocation(e, n, t, r) {
|
|
138
|
+
const o = this._ensureCommentMatrix(e, n).getValue(t, r);
|
|
139
|
+
return o ? Array.from(o).map((i) => this.getComment(e, n, i)).filter(Boolean) : [];
|
|
140
140
|
}
|
|
141
|
-
getComment(e,
|
|
142
|
-
return this._threadCommentModel.getComment(e,
|
|
141
|
+
getComment(e, n, t) {
|
|
142
|
+
return this._threadCommentModel.getComment(e, n, t);
|
|
143
143
|
}
|
|
144
|
-
getCommentWithChildren(e,
|
|
145
|
-
const s = this.getByLocation(e,
|
|
144
|
+
getCommentWithChildren(e, n, t, r) {
|
|
145
|
+
const s = this.getByLocation(e, n, t, r);
|
|
146
146
|
if (!s)
|
|
147
147
|
return;
|
|
148
|
-
const o = this.getComment(e,
|
|
148
|
+
const o = this.getComment(e, n, s);
|
|
149
149
|
if (o)
|
|
150
|
-
return this._threadCommentModel.getThread(e,
|
|
150
|
+
return this._threadCommentModel.getThread(e, n, o.threadId);
|
|
151
151
|
}
|
|
152
|
-
showCommentMarker(e,
|
|
153
|
-
const s = this.getByLocation(e,
|
|
152
|
+
showCommentMarker(e, n, t, r) {
|
|
153
|
+
const s = this.getByLocation(e, n, t, r);
|
|
154
154
|
if (!s)
|
|
155
155
|
return !1;
|
|
156
|
-
const o = this.getComment(e,
|
|
156
|
+
const o = this.getComment(e, n, s);
|
|
157
157
|
return !!(o && !o.resolved);
|
|
158
158
|
}
|
|
159
|
-
getSubUnitAll(e,
|
|
160
|
-
return this._threadCommentModel.getUnit(e).filter((t) => t.subUnitId ===
|
|
159
|
+
getSubUnitAll(e, n) {
|
|
160
|
+
return this._threadCommentModel.getUnit(e).filter((t) => t.subUnitId === n).map((t) => t.root);
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
],
|
|
167
|
-
var
|
|
168
|
-
for (var
|
|
169
|
-
(o = a[s]) && (
|
|
170
|
-
return
|
|
171
|
-
},
|
|
172
|
-
let
|
|
173
|
-
constructor(e,
|
|
163
|
+
M = te([
|
|
164
|
+
D(0, h(U)),
|
|
165
|
+
D(1, O)
|
|
166
|
+
], M);
|
|
167
|
+
var ne = Object.getOwnPropertyDescriptor, re = (a, e, n, t) => {
|
|
168
|
+
for (var r = t > 1 ? void 0 : t ? ne(e, n) : e, s = a.length - 1, o; s >= 0; s--)
|
|
169
|
+
(o = a[s]) && (r = o(r) || r);
|
|
170
|
+
return r;
|
|
171
|
+
}, p = (a, e) => (n, t) => e(n, t, a);
|
|
172
|
+
let v = class extends R {
|
|
173
|
+
constructor(e, n, t, r, s) {
|
|
174
174
|
super();
|
|
175
175
|
_(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
176
176
|
_(this, "_watcherMap", /* @__PURE__ */ new Map());
|
|
177
|
-
_(this, "_handleRangeChange", (e,
|
|
177
|
+
_(this, "_handleRangeChange", (e, n, t, r, s) => {
|
|
178
178
|
const o = t.id, i = {
|
|
179
179
|
startColumn: t.column,
|
|
180
180
|
endColumn: t.column,
|
|
181
181
|
startRow: t.row,
|
|
182
182
|
endRow: t.row
|
|
183
183
|
};
|
|
184
|
-
return
|
|
184
|
+
return r ? {
|
|
185
185
|
redos: [{
|
|
186
|
-
id:
|
|
186
|
+
id: x.id,
|
|
187
187
|
params: {
|
|
188
188
|
unitId: e,
|
|
189
|
-
subUnitId:
|
|
189
|
+
subUnitId: n,
|
|
190
190
|
payload: {
|
|
191
|
-
ref:
|
|
191
|
+
ref: E(r),
|
|
192
192
|
commentId: o
|
|
193
193
|
},
|
|
194
194
|
silent: s
|
|
195
195
|
}
|
|
196
196
|
}],
|
|
197
197
|
undos: [{
|
|
198
|
-
id:
|
|
198
|
+
id: x.id,
|
|
199
199
|
params: {
|
|
200
200
|
unitId: e,
|
|
201
|
-
subUnitId:
|
|
201
|
+
subUnitId: n,
|
|
202
202
|
payload: {
|
|
203
|
-
ref:
|
|
203
|
+
ref: E(i),
|
|
204
204
|
commentId: o
|
|
205
205
|
},
|
|
206
206
|
silent: s
|
|
@@ -208,141 +208,144 @@ let M = class extends y {
|
|
|
208
208
|
}]
|
|
209
209
|
} : {
|
|
210
210
|
redos: [{
|
|
211
|
-
id:
|
|
211
|
+
id: y.id,
|
|
212
212
|
params: {
|
|
213
213
|
unitId: e,
|
|
214
|
-
subUnitId:
|
|
214
|
+
subUnitId: n,
|
|
215
215
|
commentId: o
|
|
216
216
|
}
|
|
217
217
|
}],
|
|
218
218
|
undos: [{
|
|
219
|
-
id:
|
|
219
|
+
id: I.id,
|
|
220
220
|
params: {
|
|
221
221
|
unitId: e,
|
|
222
|
-
subUnitId:
|
|
222
|
+
subUnitId: n,
|
|
223
223
|
comment: t,
|
|
224
224
|
sync: !0
|
|
225
225
|
}
|
|
226
226
|
}]
|
|
227
227
|
};
|
|
228
228
|
});
|
|
229
|
-
this._refRangeService = e, this._sheetsThreadCommentModel =
|
|
229
|
+
this._refRangeService = e, this._sheetsThreadCommentModel = n, this._threadCommentModel = t, this._selectionManagerService = r, this._commandService = s, this._initData(), this._initRefRange();
|
|
230
230
|
}
|
|
231
|
-
_getIdWithUnitId(e,
|
|
232
|
-
return `${e}-${
|
|
231
|
+
_getIdWithUnitId(e, n, t) {
|
|
232
|
+
return `${e}-${n}-${t}`;
|
|
233
233
|
}
|
|
234
|
-
_register(e,
|
|
235
|
-
const
|
|
234
|
+
_register(e, n, t) {
|
|
235
|
+
const r = t.id, s = {
|
|
236
236
|
startColumn: t.column,
|
|
237
237
|
endColumn: t.column,
|
|
238
238
|
startRow: t.row,
|
|
239
239
|
endRow: t.row
|
|
240
240
|
};
|
|
241
241
|
this._disposableMap.set(
|
|
242
|
-
this._getIdWithUnitId(e,
|
|
242
|
+
this._getIdWithUnitId(e, n, r),
|
|
243
243
|
this._refRangeService.registerRefRange(s, (o) => {
|
|
244
|
-
const i =
|
|
244
|
+
const i = q(s, o, { selectionManagerService: this._selectionManagerService }), c = Array.isArray(i) ? i[0] : i;
|
|
245
245
|
return c && c.startColumn === s.startColumn && c.startRow === s.startRow ? {
|
|
246
246
|
undos: [],
|
|
247
247
|
redos: []
|
|
248
|
-
} : this._handleRangeChange(e,
|
|
249
|
-
}, e,
|
|
248
|
+
} : this._handleRangeChange(e, n, t, c, !1);
|
|
249
|
+
}, e, n)
|
|
250
250
|
);
|
|
251
251
|
}
|
|
252
|
-
_watch(e,
|
|
253
|
-
const
|
|
252
|
+
_watch(e, n, t) {
|
|
253
|
+
const r = t.id, s = {
|
|
254
254
|
startColumn: t.column,
|
|
255
255
|
endColumn: t.column,
|
|
256
256
|
startRow: t.row,
|
|
257
257
|
endRow: t.row
|
|
258
258
|
};
|
|
259
259
|
this._watcherMap.set(
|
|
260
|
-
this._getIdWithUnitId(e,
|
|
261
|
-
this._refRangeService.watchRange(e,
|
|
262
|
-
const { redos: c } = this._handleRangeChange(e,
|
|
260
|
+
this._getIdWithUnitId(e, n, r),
|
|
261
|
+
this._refRangeService.watchRange(e, n, s, (o, i) => {
|
|
262
|
+
const { redos: c } = this._handleRangeChange(e, n, t, i, !0);
|
|
263
263
|
L(c, this._commandService, { onlyLocal: !0 });
|
|
264
264
|
}, !0)
|
|
265
265
|
);
|
|
266
266
|
}
|
|
267
|
-
_unwatch(e,
|
|
267
|
+
_unwatch(e, n, t) {
|
|
268
268
|
var s;
|
|
269
|
-
const
|
|
270
|
-
(s = this._watcherMap.get(
|
|
269
|
+
const r = this._getIdWithUnitId(e, n, t);
|
|
270
|
+
(s = this._watcherMap.get(r)) == null || s.dispose(), this._watcherMap.delete(r);
|
|
271
271
|
}
|
|
272
|
-
_unregister(e,
|
|
272
|
+
_unregister(e, n, t) {
|
|
273
273
|
var s;
|
|
274
|
-
const
|
|
275
|
-
(s = this._disposableMap.get(
|
|
274
|
+
const r = this._getIdWithUnitId(e, n, t);
|
|
275
|
+
(s = this._disposableMap.get(r)) == null || s.dispose(), this._disposableMap.delete(r);
|
|
276
276
|
}
|
|
277
277
|
_initData() {
|
|
278
278
|
const e = this._threadCommentModel.getAll();
|
|
279
|
-
for (const
|
|
280
|
-
for (const t of
|
|
281
|
-
const { unitId:
|
|
279
|
+
for (const n of e)
|
|
280
|
+
for (const t of n.threads) {
|
|
281
|
+
const { unitId: r, subUnitId: s, root: o } = t, i = g(o.ref), c = {
|
|
282
282
|
...o,
|
|
283
283
|
...i
|
|
284
284
|
};
|
|
285
|
-
this._register(
|
|
285
|
+
this._register(r, s, c), this._watch(r, s, c);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
_initRefRange() {
|
|
289
289
|
this.disposeWithMe(
|
|
290
290
|
this._sheetsThreadCommentModel.commentUpdate$.subscribe((e) => {
|
|
291
|
-
const { unitId:
|
|
291
|
+
const { unitId: n, subUnitId: t } = e;
|
|
292
292
|
switch (e.type) {
|
|
293
293
|
case "add": {
|
|
294
294
|
if (e.payload.parentId)
|
|
295
295
|
return;
|
|
296
|
-
const
|
|
296
|
+
const r = {
|
|
297
297
|
...e.payload,
|
|
298
298
|
row: e.row,
|
|
299
299
|
column: e.column
|
|
300
300
|
};
|
|
301
|
-
this._register(e.unitId, e.subUnitId,
|
|
301
|
+
this._register(e.unitId, e.subUnitId, r), this._watch(e.unitId, e.subUnitId, r);
|
|
302
302
|
break;
|
|
303
303
|
}
|
|
304
304
|
case "delete": {
|
|
305
|
-
this._unregister(
|
|
305
|
+
this._unregister(n, t, e.payload.commentId), this._unwatch(n, t, e.payload.commentId);
|
|
306
306
|
break;
|
|
307
307
|
}
|
|
308
308
|
case "updateRef": {
|
|
309
|
-
const
|
|
310
|
-
if (!
|
|
309
|
+
const r = this._sheetsThreadCommentModel.getComment(n, t, e.payload.commentId);
|
|
310
|
+
if (!r)
|
|
311
311
|
return;
|
|
312
|
-
this._unregister(
|
|
312
|
+
this._unregister(n, t, e.payload.commentId);
|
|
313
313
|
const s = {
|
|
314
|
-
...
|
|
314
|
+
...r,
|
|
315
315
|
row: e.row,
|
|
316
316
|
column: e.column
|
|
317
317
|
};
|
|
318
|
-
e.silent || (this._unwatch(
|
|
318
|
+
e.silent || (this._unwatch(n, t, e.payload.commentId), this._watch(n, t, s)), this._register(e.unitId, e.subUnitId, s);
|
|
319
319
|
break;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
})
|
|
323
|
-
), this.disposeWithMe(
|
|
323
|
+
), this.disposeWithMe(V(() => {
|
|
324
324
|
this._disposableMap.forEach((e) => {
|
|
325
325
|
e.dispose();
|
|
326
326
|
}), this._disposableMap.clear();
|
|
327
327
|
}));
|
|
328
328
|
}
|
|
329
329
|
};
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
],
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
330
|
+
v = re([
|
|
331
|
+
p(0, h(z)),
|
|
332
|
+
p(1, h(M)),
|
|
333
|
+
p(2, h(U)),
|
|
334
|
+
p(3, h(G)),
|
|
335
|
+
p(4, P)
|
|
336
|
+
], v);
|
|
337
|
+
const se = "@univerjs/sheets-thread-comment", oe = "0.17.0", A = {
|
|
338
|
+
name: se,
|
|
339
|
+
version: oe
|
|
340
|
+
}, ae = {};
|
|
341
|
+
var ie = Object.getOwnPropertyDescriptor, ce = (a, e, n, t) => {
|
|
342
|
+
for (var r = t > 1 ? void 0 : t ? ie(e, n) : e, s = a.length - 1, o; s >= 0; s--)
|
|
343
|
+
(o = a[s]) && (r = o(r) || r);
|
|
344
|
+
return r;
|
|
345
|
+
}, f = (a, e) => (n, t) => e(n, t, a);
|
|
346
|
+
let S = class extends R {
|
|
347
|
+
constructor(a, e, n, t) {
|
|
348
|
+
super(), this._univerInstanceService = a, this._sheetInterceptorService = e, this._threadCommentModel = n, this._threadCommentDataSourceService = t, this._initSheetChange();
|
|
346
349
|
}
|
|
347
350
|
// eslint-disable-next-line max-lines-per-function
|
|
348
351
|
_initSheetChange() {
|
|
@@ -351,24 +354,24 @@ let v = class extends y {
|
|
|
351
354
|
// eslint-disable-next-line max-lines-per-function
|
|
352
355
|
getMutations: (a) => {
|
|
353
356
|
var e;
|
|
354
|
-
if (a.id ===
|
|
355
|
-
const
|
|
356
|
-
if (!t || !
|
|
357
|
+
if (a.id === K.id) {
|
|
358
|
+
const n = a.params, t = n.unitId || this._univerInstanceService.getCurrentUnitOfType(C.UNIVER_SHEET).getUnitId(), r = n.subUnitId || ((e = this._univerInstanceService.getCurrentUnitOfType(C.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : e.getSheetId());
|
|
359
|
+
if (!t || !r)
|
|
357
360
|
return { redos: [], undos: [] };
|
|
358
|
-
const s = this._threadCommentModel.ensureMap(t,
|
|
361
|
+
const s = this._threadCommentModel.ensureMap(t, r), o = Array.from(s.values()).filter((d) => !d.parentId), i = this._threadCommentDataSourceService.syncUpdateMutationToColla, c = [], m = [];
|
|
359
362
|
return o.forEach(({ children: d, ...l }) => {
|
|
360
363
|
c.push({
|
|
361
|
-
id:
|
|
364
|
+
id: y.id,
|
|
362
365
|
params: {
|
|
363
366
|
unitId: t,
|
|
364
|
-
subUnitId:
|
|
367
|
+
subUnitId: r,
|
|
365
368
|
commentId: l.id
|
|
366
369
|
}
|
|
367
370
|
}), m.push({
|
|
368
|
-
id:
|
|
371
|
+
id: I.id,
|
|
369
372
|
params: {
|
|
370
373
|
unitId: t,
|
|
371
|
-
subUnitId:
|
|
374
|
+
subUnitId: r,
|
|
372
375
|
comment: {
|
|
373
376
|
...l,
|
|
374
377
|
children: i ? d : void 0
|
|
@@ -377,34 +380,34 @@ let v = class extends y {
|
|
|
377
380
|
}
|
|
378
381
|
});
|
|
379
382
|
}), { redos: c, undos: m };
|
|
380
|
-
} else if (a.id ===
|
|
381
|
-
const
|
|
382
|
-
if (!t || !
|
|
383
|
+
} else if (a.id === Q.id) {
|
|
384
|
+
const n = a.params, { unitId: t, subUnitId: r, targetSubUnitId: s } = n;
|
|
385
|
+
if (!t || !r || !s)
|
|
383
386
|
return { redos: [], undos: [] };
|
|
384
|
-
const o = this._threadCommentModel.ensureMap(t,
|
|
387
|
+
const o = this._threadCommentModel.ensureMap(t, r), i = Array.from(o.values()).map((l) => ({
|
|
385
388
|
...l,
|
|
386
389
|
subUnitId: s,
|
|
387
|
-
id:
|
|
388
|
-
threadId:
|
|
390
|
+
id: T(),
|
|
391
|
+
threadId: T()
|
|
389
392
|
})).filter((l) => !l.parentId), c = this._threadCommentDataSourceService.syncUpdateMutationToColla, m = [], d = [];
|
|
390
|
-
return i.forEach(({ children: l, ...
|
|
393
|
+
return i.forEach(({ children: l, ...b }) => {
|
|
391
394
|
m.push({
|
|
392
|
-
id:
|
|
395
|
+
id: I.id,
|
|
393
396
|
params: {
|
|
394
397
|
unitId: t,
|
|
395
398
|
subUnitId: s,
|
|
396
399
|
comment: {
|
|
397
|
-
...
|
|
400
|
+
...b,
|
|
398
401
|
children: c ? l : void 0
|
|
399
402
|
},
|
|
400
403
|
sync: !c
|
|
401
404
|
}
|
|
402
405
|
}), d.push({
|
|
403
|
-
id:
|
|
406
|
+
id: y.id,
|
|
404
407
|
params: {
|
|
405
408
|
unitId: t,
|
|
406
409
|
subUnitId: s,
|
|
407
|
-
commentId:
|
|
410
|
+
commentId: b.id
|
|
408
411
|
}
|
|
409
412
|
});
|
|
410
413
|
}), { redos: m, undos: d };
|
|
@@ -415,44 +418,46 @@ let v = class extends y {
|
|
|
415
418
|
);
|
|
416
419
|
}
|
|
417
420
|
};
|
|
418
|
-
|
|
419
|
-
f(0,
|
|
420
|
-
f(1, h(
|
|
421
|
-
f(2, h(
|
|
422
|
-
f(3,
|
|
423
|
-
],
|
|
424
|
-
const
|
|
425
|
-
var
|
|
426
|
-
for (var
|
|
427
|
-
(o = a[s]) && (
|
|
428
|
-
return
|
|
429
|
-
},
|
|
430
|
-
let
|
|
431
|
-
constructor(a =
|
|
432
|
-
super(), this._config = a, this._injector = e, this._commandService =
|
|
421
|
+
S = ce([
|
|
422
|
+
f(0, O),
|
|
423
|
+
f(1, h(J)),
|
|
424
|
+
f(2, h(U)),
|
|
425
|
+
f(3, X)
|
|
426
|
+
], S);
|
|
427
|
+
const de = "SHEET_THREAD_COMMENT_BASE_PLUGIN";
|
|
428
|
+
var me = Object.defineProperty, he = Object.getOwnPropertyDescriptor, le = (a, e, n) => e in a ? me(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, _e = (a, e, n, t) => {
|
|
429
|
+
for (var r = t > 1 ? void 0 : t ? he(e, n) : e, s = a.length - 1, o; s >= 0; s--)
|
|
430
|
+
(o = a[s]) && (r = o(r) || r);
|
|
431
|
+
return r;
|
|
432
|
+
}, $ = (a, e) => (n, t) => e(n, t, a), w = (a, e, n) => le(a, typeof e != "symbol" ? e + "" : e, n);
|
|
433
|
+
let u = class extends k {
|
|
434
|
+
constructor(a = ae, e, n) {
|
|
435
|
+
super(), this._config = a, this._injector = e, this._commandService = n;
|
|
433
436
|
}
|
|
434
437
|
onStarting() {
|
|
435
438
|
[
|
|
436
|
-
[C],
|
|
437
439
|
[M],
|
|
438
|
-
[v]
|
|
440
|
+
[v],
|
|
441
|
+
[S]
|
|
439
442
|
].forEach((a) => {
|
|
440
443
|
this._injector.add(a);
|
|
441
444
|
}), F(this._injector, [
|
|
442
|
-
[
|
|
443
|
-
[
|
|
445
|
+
[v],
|
|
446
|
+
[S]
|
|
444
447
|
]);
|
|
445
448
|
}
|
|
446
449
|
};
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
450
|
+
w(u, "pluginName", de);
|
|
451
|
+
w(u, "packageName", A.name);
|
|
452
|
+
w(u, "version", A.version);
|
|
453
|
+
w(u, "type", C.UNIVER_SHEET);
|
|
454
|
+
u = _e([
|
|
455
|
+
B(Y),
|
|
456
|
+
$(1, h(H)),
|
|
457
|
+
$(2, h(P))
|
|
458
|
+
], u);
|
|
454
459
|
export {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
460
|
+
M as SheetsThreadCommentModel,
|
|
461
|
+
v as SheetsThreadCommentRefRangeController,
|
|
462
|
+
u as UniverSheetsThreadCommentPlugin
|
|
458
463
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export type { IUniverSheetsThreadCommentConfig } from './
|
|
16
|
+
export type { IUniverSheetsThreadCommentConfig } from './config/config';
|
|
17
17
|
export { SheetsThreadCommentRefRangeController } from './controllers/sheets-thread-comment-ref-range.controller';
|
|
18
18
|
export { SheetsThreadCommentModel } from './models/sheets-thread-comment.model';
|
|
19
19
|
export { UniverSheetsThreadCommentPlugin } from './plugin';
|