@univerjs/sheets-thread-comment 0.5.5 → 0.6.0-alpha.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/es/facade.js +58 -50
- package/lib/types/facade/f-event.d.ts +9 -0
- package/lib/types/facade/f-range.d.ts +6 -0
- package/lib/types/facade/f-thread-comment.d.ts +61 -50
- package/lib/types/facade/f-univer.d.ts +9 -0
- package/lib/types/facade/f-workbook.d.ts +9 -0
- package/lib/types/facade/f-worksheet.d.ts +6 -0
- package/package.json +7 -7
package/lib/es/facade.js
CHANGED
|
@@ -45,8 +45,8 @@ class T {
|
|
|
45
45
|
* @example
|
|
46
46
|
* ```ts
|
|
47
47
|
* const comment = univerAPI.getActiveWorkbook()
|
|
48
|
-
*
|
|
49
|
-
*
|
|
48
|
+
* .getSheetById(sheetId)
|
|
49
|
+
* .getCommentById(commentId);
|
|
50
50
|
* const personId = comment.personId;
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
@@ -59,8 +59,8 @@ class T {
|
|
|
59
59
|
* @example
|
|
60
60
|
* ```ts
|
|
61
61
|
* const comment = univerAPI.getActiveWorkbook()
|
|
62
|
-
*
|
|
63
|
-
*
|
|
62
|
+
* .getSheetById(sheetId)
|
|
63
|
+
* .getCommentById(commentId);
|
|
64
64
|
* const dateTime = comment.dateTime;
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
@@ -73,8 +73,8 @@ class T {
|
|
|
73
73
|
* @example
|
|
74
74
|
* ```ts
|
|
75
75
|
* const comment = univerAPI.getActiveWorkbook()
|
|
76
|
-
*
|
|
77
|
-
*
|
|
76
|
+
* .getSheetById(sheetId)
|
|
77
|
+
* .getCommentById(commentId);
|
|
78
78
|
* const content = comment.content;
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
@@ -87,8 +87,8 @@ class T {
|
|
|
87
87
|
* @example
|
|
88
88
|
* ```ts
|
|
89
89
|
* const comment = univerAPI.getActiveWorkbook()
|
|
90
|
-
*
|
|
91
|
-
*
|
|
90
|
+
* .getSheetById(sheetId)
|
|
91
|
+
* .getCommentById(commentId);
|
|
92
92
|
* const id = comment.id;
|
|
93
93
|
* ```
|
|
94
94
|
*/
|
|
@@ -101,8 +101,8 @@ class T {
|
|
|
101
101
|
* @example
|
|
102
102
|
* ```ts
|
|
103
103
|
* const comment = univerAPI.getActiveWorkbook()
|
|
104
|
-
*
|
|
105
|
-
*
|
|
104
|
+
* .getSheetById(sheetId)
|
|
105
|
+
* .getCommentById(commentId);
|
|
106
106
|
* const threadId = comment.threadId;
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
@@ -115,8 +115,8 @@ class T {
|
|
|
115
115
|
* @example
|
|
116
116
|
* ```ts
|
|
117
117
|
* const comment = univerAPI.getActiveWorkbook()
|
|
118
|
-
*
|
|
119
|
-
*
|
|
118
|
+
* .getSheetById(sheetId)
|
|
119
|
+
* .getCommentById(commentId);
|
|
120
120
|
* const newComment = comment.copy();
|
|
121
121
|
* ```
|
|
122
122
|
*/
|
|
@@ -135,7 +135,7 @@ class U extends T {
|
|
|
135
135
|
* @example
|
|
136
136
|
* ```ts
|
|
137
137
|
* const comment = univerAPI.newTheadComment()
|
|
138
|
-
*
|
|
138
|
+
* .setContent(univerAPI.newRichText().insertText('hello zhangsan'));
|
|
139
139
|
* ```
|
|
140
140
|
*/
|
|
141
141
|
setContent(e) {
|
|
@@ -148,7 +148,7 @@ class U extends T {
|
|
|
148
148
|
* @example
|
|
149
149
|
* ```ts
|
|
150
150
|
* const comment = univerAPI.newTheadComment()
|
|
151
|
-
*
|
|
151
|
+
* .setPersonId('123');
|
|
152
152
|
* ```
|
|
153
153
|
*/
|
|
154
154
|
setPersonId(e) {
|
|
@@ -161,7 +161,7 @@ class U extends T {
|
|
|
161
161
|
* @example
|
|
162
162
|
* ```ts
|
|
163
163
|
* const comment = univerAPI.newTheadComment()
|
|
164
|
-
*
|
|
164
|
+
* .setDateTime(new Date());
|
|
165
165
|
* ```
|
|
166
166
|
*/
|
|
167
167
|
setDateTime(e) {
|
|
@@ -174,7 +174,7 @@ class U extends T {
|
|
|
174
174
|
* @example
|
|
175
175
|
* ```ts
|
|
176
176
|
* const comment = univerAPI.newTheadComment()
|
|
177
|
-
*
|
|
177
|
+
* .setId('123');
|
|
178
178
|
* ```
|
|
179
179
|
*/
|
|
180
180
|
setId(e) {
|
|
@@ -187,7 +187,7 @@ class U extends T {
|
|
|
187
187
|
* @example
|
|
188
188
|
* ```ts
|
|
189
189
|
* const comment = univerAPI.newTheadComment()
|
|
190
|
-
*
|
|
190
|
+
* .setThreadId('123');
|
|
191
191
|
* ```
|
|
192
192
|
*/
|
|
193
193
|
setThreadId(e) {
|
|
@@ -199,8 +199,8 @@ class U extends T {
|
|
|
199
199
|
* @example
|
|
200
200
|
* ```ts
|
|
201
201
|
* const comment = univerAPI.newTheadComment()
|
|
202
|
-
*
|
|
203
|
-
*
|
|
202
|
+
* .setContent(univerAPI.newRichText().insertText('hello zhangsan'))
|
|
203
|
+
* .build();
|
|
204
204
|
* ```
|
|
205
205
|
*/
|
|
206
206
|
build() {
|
|
@@ -208,6 +208,9 @@ class U extends T {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
let i = class {
|
|
211
|
+
/**
|
|
212
|
+
* @ignore
|
|
213
|
+
*/
|
|
211
214
|
constructor(r, e, t, n, o, m, s) {
|
|
212
215
|
this._thread = r, this._parent = e, this._injector = t, this._commandService = n, this._univerInstanceService = o, this._threadCommentModel = m, this._userManagerService = s;
|
|
213
216
|
}
|
|
@@ -218,12 +221,12 @@ let i = class {
|
|
|
218
221
|
}
|
|
219
222
|
/**
|
|
220
223
|
* Whether the comment is a root comment
|
|
221
|
-
* @returns Whether the comment is a root comment
|
|
224
|
+
* @returns {boolean} Whether the comment is a root comment
|
|
222
225
|
* @example
|
|
223
226
|
* ```ts
|
|
224
227
|
* const comment = univerAPI.getActiveWorkbook()
|
|
225
|
-
*
|
|
226
|
-
*
|
|
228
|
+
* .getSheetById(sheetId)
|
|
229
|
+
* .getCommentById(commentId);
|
|
227
230
|
* const isRoot = comment.getIsRoot();
|
|
228
231
|
* ```
|
|
229
232
|
*/
|
|
@@ -232,12 +235,12 @@ let i = class {
|
|
|
232
235
|
}
|
|
233
236
|
/**
|
|
234
237
|
* Get the comment data
|
|
235
|
-
* @returns The comment data
|
|
238
|
+
* @returns {IBaseComment} The comment data
|
|
236
239
|
* @example
|
|
237
240
|
* ```ts
|
|
238
241
|
* const comment = univerAPI.getActiveWorkbook()
|
|
239
|
-
*
|
|
240
|
-
*
|
|
242
|
+
* .getSheetById(sheetId)
|
|
243
|
+
* .getCommentById(commentId);
|
|
241
244
|
* const commentData = comment.getCommentData();
|
|
242
245
|
* ```
|
|
243
246
|
*/
|
|
@@ -247,12 +250,12 @@ let i = class {
|
|
|
247
250
|
}
|
|
248
251
|
/**
|
|
249
252
|
* Get the replies of the comment
|
|
250
|
-
* @returns the replies of the comment
|
|
253
|
+
* @returns {FThreadComment[]} the replies of the comment
|
|
251
254
|
* @example
|
|
252
255
|
* ```ts
|
|
253
256
|
* const comment = univerAPI.getActiveWorkbook()
|
|
254
|
-
*
|
|
255
|
-
*
|
|
257
|
+
* .getSheetById(sheetId)
|
|
258
|
+
* .getCommentById(commentId);
|
|
256
259
|
* const replies = comment.getReplies();
|
|
257
260
|
* ```
|
|
258
261
|
*/
|
|
@@ -263,12 +266,12 @@ let i = class {
|
|
|
263
266
|
}
|
|
264
267
|
/**
|
|
265
268
|
* Get the range of the comment
|
|
266
|
-
* @returns The range of the comment
|
|
269
|
+
* @returns {FRange | null} The range of the comment
|
|
267
270
|
* @example
|
|
268
271
|
* ```ts
|
|
269
272
|
* const comment = univerAPI.getActiveWorkbook()
|
|
270
|
-
*
|
|
271
|
-
*
|
|
273
|
+
* .getSheetById(sheetId)
|
|
274
|
+
* .getCommentById(commentId);
|
|
272
275
|
* const range = comment.getRange();
|
|
273
276
|
* ```
|
|
274
277
|
*/
|
|
@@ -282,6 +285,7 @@ let i = class {
|
|
|
282
285
|
const t = this._getRef();
|
|
283
286
|
return this._injector.createInstance(x, r, e, t);
|
|
284
287
|
}
|
|
288
|
+
// eslint-disable-next-line
|
|
285
289
|
/**
|
|
286
290
|
* @deprecated use `getRichText` as instead
|
|
287
291
|
*/
|
|
@@ -294,8 +298,8 @@ let i = class {
|
|
|
294
298
|
* @example
|
|
295
299
|
* ```ts
|
|
296
300
|
* const comment = univerAPI.getActiveWorkbook()
|
|
297
|
-
*
|
|
298
|
-
*
|
|
301
|
+
* .getSheetById(sheetId)
|
|
302
|
+
* .getCommentById(commentId);
|
|
299
303
|
* const richText = comment.getRichText();
|
|
300
304
|
* ```
|
|
301
305
|
*/
|
|
@@ -309,8 +313,8 @@ let i = class {
|
|
|
309
313
|
* @example
|
|
310
314
|
* ```ts
|
|
311
315
|
* const comment = univerAPI.getActiveWorkbook()
|
|
312
|
-
*
|
|
313
|
-
*
|
|
316
|
+
* .getSheetById(sheetId)
|
|
317
|
+
* .getCommentById(commentId);
|
|
314
318
|
* const success = await comment.deleteAsync();
|
|
315
319
|
* ```
|
|
316
320
|
*/
|
|
@@ -324,14 +328,15 @@ let i = class {
|
|
|
324
328
|
}
|
|
325
329
|
);
|
|
326
330
|
}
|
|
331
|
+
// eslint-disable-next-line
|
|
327
332
|
/**
|
|
328
333
|
* @deprecated use `deleteAsync` as instead.
|
|
329
334
|
*/
|
|
330
335
|
delete() {
|
|
331
336
|
return this.deleteAsync();
|
|
332
337
|
}
|
|
338
|
+
// eslint-disable-next-line
|
|
333
339
|
/**
|
|
334
|
-
* @param content
|
|
335
340
|
* @deprecated use `updateAsync` as instead
|
|
336
341
|
*/
|
|
337
342
|
async update(r) {
|
|
@@ -339,13 +344,13 @@ let i = class {
|
|
|
339
344
|
}
|
|
340
345
|
/**
|
|
341
346
|
* Update the comment content
|
|
342
|
-
* @param content The new content of the comment
|
|
343
|
-
* @returns success or not
|
|
347
|
+
* @param {IDocumentBody | RichTextValue} content The new content of the comment
|
|
348
|
+
* @returns {Promise<boolean>} success or not
|
|
344
349
|
* @example
|
|
345
350
|
* ```ts
|
|
346
351
|
* const comment = univerAPI.getActiveWorkbook()
|
|
347
|
-
*
|
|
348
|
-
*
|
|
352
|
+
* .getSheetById(sheetId)
|
|
353
|
+
* .getCommentById(commentId);
|
|
349
354
|
* const success = await comment.updateAsync(univerAPI.newRichText().insertText('hello zhangsan'));
|
|
350
355
|
* ```
|
|
351
356
|
*/
|
|
@@ -365,8 +370,8 @@ let i = class {
|
|
|
365
370
|
}
|
|
366
371
|
);
|
|
367
372
|
}
|
|
373
|
+
// eslint-disable-next-line
|
|
368
374
|
/**
|
|
369
|
-
* @param resolved
|
|
370
375
|
* @deprecated use `resolveAsync` as instead
|
|
371
376
|
*/
|
|
372
377
|
resolve(r) {
|
|
@@ -374,13 +379,13 @@ let i = class {
|
|
|
374
379
|
}
|
|
375
380
|
/**
|
|
376
381
|
* Resolve the comment
|
|
377
|
-
* @param resolved Whether the comment is resolved
|
|
378
|
-
* @returns success or not
|
|
382
|
+
* @param {boolean} resolved Whether the comment is resolved
|
|
383
|
+
* @returns {Promise<boolean>} success or not
|
|
379
384
|
* @example
|
|
380
385
|
* ```ts
|
|
381
386
|
* const comment = univerAPI.getActiveWorkbook()
|
|
382
|
-
*
|
|
383
|
-
*
|
|
387
|
+
* .getSheetById(sheetId)
|
|
388
|
+
* .getCommentById(commentId);
|
|
384
389
|
* const success = await comment.resolveAsync(true);
|
|
385
390
|
* ```
|
|
386
391
|
*/
|
|
@@ -397,16 +402,16 @@ let i = class {
|
|
|
397
402
|
}
|
|
398
403
|
/**
|
|
399
404
|
* Reply to the comment
|
|
400
|
-
* @param comment The comment to reply to
|
|
401
|
-
* @returns success or not
|
|
405
|
+
* @param {FTheadCommentBuilder} comment The comment to reply to
|
|
406
|
+
* @returns {Promise<boolean>} success or not
|
|
402
407
|
* @example
|
|
403
408
|
* ```ts
|
|
404
409
|
* const comment = univerAPI.getActiveWorkbook()
|
|
405
|
-
*
|
|
406
|
-
*
|
|
410
|
+
* .getSheetById(sheetId)
|
|
411
|
+
* .getCommentById(commentId);
|
|
407
412
|
*
|
|
408
413
|
* const reply = univerAPI.newTheadComment()
|
|
409
|
-
*
|
|
414
|
+
* .setContent(univerAPI.newRichText().insertText('hello zhangsan'));
|
|
410
415
|
*
|
|
411
416
|
* const success = await comment.replyAsync(reply);
|
|
412
417
|
* ```
|
|
@@ -506,6 +511,9 @@ class K extends x {
|
|
|
506
511
|
}
|
|
507
512
|
x.extend(K);
|
|
508
513
|
class Q extends j {
|
|
514
|
+
/**
|
|
515
|
+
* @ignore
|
|
516
|
+
*/
|
|
509
517
|
_initialize() {
|
|
510
518
|
Object.defineProperty(this, "_threadCommentModel", {
|
|
511
519
|
get() {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { IEventBase, RichTextValue, FEventName } from '@univerjs/core';
|
|
2
2
|
import { FWorkbook, FWorksheet } from '@univerjs/sheets/facade';
|
|
3
3
|
import { FTheadCommentItem, FThreadComment } from './f-thread-comment';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
4
7
|
interface ICommentEventMixin {
|
|
5
8
|
/**
|
|
6
9
|
* Event fired after comment added
|
|
@@ -99,6 +102,9 @@ interface ICommentEventMixin {
|
|
|
99
102
|
*/
|
|
100
103
|
readonly BeforeCommentResolve: 'BeforeCommentResolve';
|
|
101
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* @ignore
|
|
107
|
+
*/
|
|
102
108
|
export declare class FCommentEvent extends FEventName {
|
|
103
109
|
get CommentAdded(): 'CommentAdded';
|
|
104
110
|
get BeforeCommentAdd(): 'BeforeCommentAdd';
|
|
@@ -228,6 +234,9 @@ export interface ISheetCommentResolveEvent extends IEventBase {
|
|
|
228
234
|
/** The new resolve status */
|
|
229
235
|
resolved: boolean;
|
|
230
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* @ignore
|
|
239
|
+
*/
|
|
231
240
|
export interface ISheetCommentEventConfig {
|
|
232
241
|
BeforeCommentAdd: IBeforeSheetCommentAddEvent;
|
|
233
242
|
CommentAdded: ISheetCommentAddEvent;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { IDocumentBody, Nullable } from '@univerjs/core';
|
|
2
2
|
import { FRange } from '@univerjs/sheets/facade';
|
|
3
3
|
import { FTheadCommentBuilder, FThreadComment } from './f-thread-comment';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
4
7
|
export interface IFRangeCommentMixin {
|
|
5
8
|
/**
|
|
6
9
|
* Get the comment of the start cell in the current range.
|
|
@@ -75,6 +78,9 @@ export interface IFRangeCommentMixin {
|
|
|
75
78
|
*/
|
|
76
79
|
clearCommentsAsync(): Promise<boolean>;
|
|
77
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* @ignore
|
|
83
|
+
*/
|
|
78
84
|
export declare class FRangeCommentMixin extends FRange implements IFRangeCommentMixin {
|
|
79
85
|
getComment(): Nullable<FThreadComment>;
|
|
80
86
|
getComments(): FThreadComment[];
|
|
@@ -2,6 +2,10 @@ import { IDocumentBody, ICommandService, Injector, IUniverInstanceService, RichT
|
|
|
2
2
|
import { IBaseComment, IThreadComment } from '@univerjs/thread-comment';
|
|
3
3
|
import { SheetsThreadCommentModel } from '@univerjs/sheets-thread-comment';
|
|
4
4
|
import { FRange } from '@univerjs/sheets/facade';
|
|
5
|
+
/**
|
|
6
|
+
* An readonly class that represents a comment.
|
|
7
|
+
* @ignore
|
|
8
|
+
*/
|
|
5
9
|
export declare class FTheadCommentItem {
|
|
6
10
|
protected _comment: IThreadComment;
|
|
7
11
|
/**
|
|
@@ -21,8 +25,8 @@ export declare class FTheadCommentItem {
|
|
|
21
25
|
* @example
|
|
22
26
|
* ```ts
|
|
23
27
|
* const comment = univerAPI.getActiveWorkbook()
|
|
24
|
-
*
|
|
25
|
-
*
|
|
28
|
+
* .getSheetById(sheetId)
|
|
29
|
+
* .getCommentById(commentId);
|
|
26
30
|
* const personId = comment.personId;
|
|
27
31
|
* ```
|
|
28
32
|
*/
|
|
@@ -33,8 +37,8 @@ export declare class FTheadCommentItem {
|
|
|
33
37
|
* @example
|
|
34
38
|
* ```ts
|
|
35
39
|
* const comment = univerAPI.getActiveWorkbook()
|
|
36
|
-
*
|
|
37
|
-
*
|
|
40
|
+
* .getSheetById(sheetId)
|
|
41
|
+
* .getCommentById(commentId);
|
|
38
42
|
* const dateTime = comment.dateTime;
|
|
39
43
|
* ```
|
|
40
44
|
*/
|
|
@@ -45,8 +49,8 @@ export declare class FTheadCommentItem {
|
|
|
45
49
|
* @example
|
|
46
50
|
* ```ts
|
|
47
51
|
* const comment = univerAPI.getActiveWorkbook()
|
|
48
|
-
*
|
|
49
|
-
*
|
|
52
|
+
* .getSheetById(sheetId)
|
|
53
|
+
* .getCommentById(commentId);
|
|
50
54
|
* const content = comment.content;
|
|
51
55
|
* ```
|
|
52
56
|
*/
|
|
@@ -57,8 +61,8 @@ export declare class FTheadCommentItem {
|
|
|
57
61
|
* @example
|
|
58
62
|
* ```ts
|
|
59
63
|
* const comment = univerAPI.getActiveWorkbook()
|
|
60
|
-
*
|
|
61
|
-
*
|
|
64
|
+
* .getSheetById(sheetId)
|
|
65
|
+
* .getCommentById(commentId);
|
|
62
66
|
* const id = comment.id;
|
|
63
67
|
* ```
|
|
64
68
|
*/
|
|
@@ -69,8 +73,8 @@ export declare class FTheadCommentItem {
|
|
|
69
73
|
* @example
|
|
70
74
|
* ```ts
|
|
71
75
|
* const comment = univerAPI.getActiveWorkbook()
|
|
72
|
-
*
|
|
73
|
-
*
|
|
76
|
+
* .getSheetById(sheetId)
|
|
77
|
+
* .getCommentById(commentId);
|
|
74
78
|
* const threadId = comment.threadId;
|
|
75
79
|
* ```
|
|
76
80
|
*/
|
|
@@ -81,13 +85,16 @@ export declare class FTheadCommentItem {
|
|
|
81
85
|
* @example
|
|
82
86
|
* ```ts
|
|
83
87
|
* const comment = univerAPI.getActiveWorkbook()
|
|
84
|
-
*
|
|
85
|
-
*
|
|
88
|
+
* .getSheetById(sheetId)
|
|
89
|
+
* .getCommentById(commentId);
|
|
86
90
|
* const newComment = comment.copy();
|
|
87
91
|
* ```
|
|
88
92
|
*/
|
|
89
93
|
copy(): FTheadCommentBuilder;
|
|
90
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* A builder for thread comment. use {@link FUniver} `univerAPI.newTheadComment()` to create a new builder.
|
|
97
|
+
*/
|
|
91
98
|
export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
92
99
|
static create(comment?: IThreadComment): FTheadCommentBuilder;
|
|
93
100
|
/**
|
|
@@ -97,7 +104,7 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
97
104
|
* @example
|
|
98
105
|
* ```ts
|
|
99
106
|
* const comment = univerAPI.newTheadComment()
|
|
100
|
-
*
|
|
107
|
+
* .setContent(univerAPI.newRichText().insertText('hello zhangsan'));
|
|
101
108
|
* ```
|
|
102
109
|
*/
|
|
103
110
|
setContent(content: IDocumentBody | RichTextValue): FTheadCommentBuilder;
|
|
@@ -108,7 +115,7 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
108
115
|
* @example
|
|
109
116
|
* ```ts
|
|
110
117
|
* const comment = univerAPI.newTheadComment()
|
|
111
|
-
*
|
|
118
|
+
* .setPersonId('123');
|
|
112
119
|
* ```
|
|
113
120
|
*/
|
|
114
121
|
setPersonId(userId: string): FTheadCommentBuilder;
|
|
@@ -119,7 +126,7 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
119
126
|
* @example
|
|
120
127
|
* ```ts
|
|
121
128
|
* const comment = univerAPI.newTheadComment()
|
|
122
|
-
*
|
|
129
|
+
* .setDateTime(new Date());
|
|
123
130
|
* ```
|
|
124
131
|
*/
|
|
125
132
|
setDateTime(date: Date): FTheadCommentBuilder;
|
|
@@ -130,7 +137,7 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
130
137
|
* @example
|
|
131
138
|
* ```ts
|
|
132
139
|
* const comment = univerAPI.newTheadComment()
|
|
133
|
-
*
|
|
140
|
+
* .setId('123');
|
|
134
141
|
* ```
|
|
135
142
|
*/
|
|
136
143
|
setId(id: string): FTheadCommentBuilder;
|
|
@@ -141,7 +148,7 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
141
148
|
* @example
|
|
142
149
|
* ```ts
|
|
143
150
|
* const comment = univerAPI.newTheadComment()
|
|
144
|
-
*
|
|
151
|
+
* .setThreadId('123');
|
|
145
152
|
* ```
|
|
146
153
|
*/
|
|
147
154
|
setThreadId(threadId: string): FTheadCommentBuilder;
|
|
@@ -151,12 +158,15 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
151
158
|
* @example
|
|
152
159
|
* ```ts
|
|
153
160
|
* const comment = univerAPI.newTheadComment()
|
|
154
|
-
*
|
|
155
|
-
*
|
|
161
|
+
* .setContent(univerAPI.newRichText().insertText('hello zhangsan'))
|
|
162
|
+
* .build();
|
|
156
163
|
* ```
|
|
157
164
|
*/
|
|
158
165
|
build(): IThreadComment;
|
|
159
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* A class that represents a thread comment already in the sheet.
|
|
169
|
+
*/
|
|
160
170
|
export declare class FThreadComment {
|
|
161
171
|
private readonly _thread;
|
|
162
172
|
private readonly _parent;
|
|
@@ -165,52 +175,55 @@ export declare class FThreadComment {
|
|
|
165
175
|
private readonly _univerInstanceService;
|
|
166
176
|
private readonly _threadCommentModel;
|
|
167
177
|
private readonly _userManagerService;
|
|
178
|
+
/**
|
|
179
|
+
* @ignore
|
|
180
|
+
*/
|
|
168
181
|
constructor(_thread: IThreadComment | IBaseComment, _parent: IThreadComment | undefined, _injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _threadCommentModel: SheetsThreadCommentModel, _userManagerService: UserManagerService);
|
|
169
182
|
private _getRef;
|
|
170
183
|
/**
|
|
171
184
|
* Whether the comment is a root comment
|
|
172
|
-
* @returns Whether the comment is a root comment
|
|
185
|
+
* @returns {boolean} Whether the comment is a root comment
|
|
173
186
|
* @example
|
|
174
187
|
* ```ts
|
|
175
188
|
* const comment = univerAPI.getActiveWorkbook()
|
|
176
|
-
*
|
|
177
|
-
*
|
|
189
|
+
* .getSheetById(sheetId)
|
|
190
|
+
* .getCommentById(commentId);
|
|
178
191
|
* const isRoot = comment.getIsRoot();
|
|
179
192
|
* ```
|
|
180
193
|
*/
|
|
181
194
|
getIsRoot(): boolean;
|
|
182
195
|
/**
|
|
183
196
|
* Get the comment data
|
|
184
|
-
* @returns The comment data
|
|
197
|
+
* @returns {IBaseComment} The comment data
|
|
185
198
|
* @example
|
|
186
199
|
* ```ts
|
|
187
200
|
* const comment = univerAPI.getActiveWorkbook()
|
|
188
|
-
*
|
|
189
|
-
*
|
|
201
|
+
* .getSheetById(sheetId)
|
|
202
|
+
* .getCommentById(commentId);
|
|
190
203
|
* const commentData = comment.getCommentData();
|
|
191
204
|
* ```
|
|
192
205
|
*/
|
|
193
206
|
getCommentData(): IBaseComment;
|
|
194
207
|
/**
|
|
195
208
|
* Get the replies of the comment
|
|
196
|
-
* @returns the replies of the comment
|
|
209
|
+
* @returns {FThreadComment[]} the replies of the comment
|
|
197
210
|
* @example
|
|
198
211
|
* ```ts
|
|
199
212
|
* const comment = univerAPI.getActiveWorkbook()
|
|
200
|
-
*
|
|
201
|
-
*
|
|
213
|
+
* .getSheetById(sheetId)
|
|
214
|
+
* .getCommentById(commentId);
|
|
202
215
|
* const replies = comment.getReplies();
|
|
203
216
|
* ```
|
|
204
217
|
*/
|
|
205
218
|
getReplies(): FThreadComment[] | undefined;
|
|
206
219
|
/**
|
|
207
220
|
* Get the range of the comment
|
|
208
|
-
* @returns The range of the comment
|
|
221
|
+
* @returns {FRange | null} The range of the comment
|
|
209
222
|
* @example
|
|
210
223
|
* ```ts
|
|
211
224
|
* const comment = univerAPI.getActiveWorkbook()
|
|
212
|
-
*
|
|
213
|
-
*
|
|
225
|
+
* .getSheetById(sheetId)
|
|
226
|
+
* .getCommentById(commentId);
|
|
214
227
|
* const range = comment.getRange();
|
|
215
228
|
* ```
|
|
216
229
|
*/
|
|
@@ -225,8 +238,8 @@ export declare class FThreadComment {
|
|
|
225
238
|
* @example
|
|
226
239
|
* ```ts
|
|
227
240
|
* const comment = univerAPI.getActiveWorkbook()
|
|
228
|
-
*
|
|
229
|
-
*
|
|
241
|
+
* .getSheetById(sheetId)
|
|
242
|
+
* .getCommentById(commentId);
|
|
230
243
|
* const richText = comment.getRichText();
|
|
231
244
|
* ```
|
|
232
245
|
*/
|
|
@@ -237,8 +250,8 @@ export declare class FThreadComment {
|
|
|
237
250
|
* @example
|
|
238
251
|
* ```ts
|
|
239
252
|
* const comment = univerAPI.getActiveWorkbook()
|
|
240
|
-
*
|
|
241
|
-
*
|
|
253
|
+
* .getSheetById(sheetId)
|
|
254
|
+
* .getCommentById(commentId);
|
|
242
255
|
* const success = await comment.deleteAsync();
|
|
243
256
|
* ```
|
|
244
257
|
*/
|
|
@@ -248,53 +261,51 @@ export declare class FThreadComment {
|
|
|
248
261
|
*/
|
|
249
262
|
delete(): Promise<boolean>;
|
|
250
263
|
/**
|
|
251
|
-
* @param content
|
|
252
264
|
* @deprecated use `updateAsync` as instead
|
|
253
265
|
*/
|
|
254
266
|
update(content: IDocumentBody): Promise<boolean>;
|
|
255
267
|
/**
|
|
256
268
|
* Update the comment content
|
|
257
|
-
* @param content The new content of the comment
|
|
258
|
-
* @returns success or not
|
|
269
|
+
* @param {IDocumentBody | RichTextValue} content The new content of the comment
|
|
270
|
+
* @returns {Promise<boolean>} success or not
|
|
259
271
|
* @example
|
|
260
272
|
* ```ts
|
|
261
273
|
* const comment = univerAPI.getActiveWorkbook()
|
|
262
|
-
*
|
|
263
|
-
*
|
|
274
|
+
* .getSheetById(sheetId)
|
|
275
|
+
* .getCommentById(commentId);
|
|
264
276
|
* const success = await comment.updateAsync(univerAPI.newRichText().insertText('hello zhangsan'));
|
|
265
277
|
* ```
|
|
266
278
|
*/
|
|
267
279
|
updateAsync(content: IDocumentBody | RichTextValue): Promise<boolean>;
|
|
268
280
|
/**
|
|
269
|
-
* @param resolved
|
|
270
281
|
* @deprecated use `resolveAsync` as instead
|
|
271
282
|
*/
|
|
272
283
|
resolve(resolved?: boolean): Promise<boolean>;
|
|
273
284
|
/**
|
|
274
285
|
* Resolve the comment
|
|
275
|
-
* @param resolved Whether the comment is resolved
|
|
276
|
-
* @returns success or not
|
|
286
|
+
* @param {boolean} resolved Whether the comment is resolved
|
|
287
|
+
* @returns {Promise<boolean>} success or not
|
|
277
288
|
* @example
|
|
278
289
|
* ```ts
|
|
279
290
|
* const comment = univerAPI.getActiveWorkbook()
|
|
280
|
-
*
|
|
281
|
-
*
|
|
291
|
+
* .getSheetById(sheetId)
|
|
292
|
+
* .getCommentById(commentId);
|
|
282
293
|
* const success = await comment.resolveAsync(true);
|
|
283
294
|
* ```
|
|
284
295
|
*/
|
|
285
296
|
resolveAsync(resolved?: boolean): Promise<boolean>;
|
|
286
297
|
/**
|
|
287
298
|
* Reply to the comment
|
|
288
|
-
* @param comment The comment to reply to
|
|
289
|
-
* @returns success or not
|
|
299
|
+
* @param {FTheadCommentBuilder} comment The comment to reply to
|
|
300
|
+
* @returns {Promise<boolean>} success or not
|
|
290
301
|
* @example
|
|
291
302
|
* ```ts
|
|
292
303
|
* const comment = univerAPI.getActiveWorkbook()
|
|
293
|
-
*
|
|
294
|
-
*
|
|
304
|
+
* .getSheetById(sheetId)
|
|
305
|
+
* .getCommentById(commentId);
|
|
295
306
|
*
|
|
296
307
|
* const reply = univerAPI.newTheadComment()
|
|
297
|
-
*
|
|
308
|
+
* .setContent(univerAPI.newRichText().insertText('hello zhangsan'));
|
|
298
309
|
*
|
|
299
310
|
* const success = await comment.replyAsync(reply);
|
|
300
311
|
* ```
|
|
@@ -2,6 +2,9 @@ import { IDisposable, Injector, FUniver } from '@univerjs/core';
|
|
|
2
2
|
import { IThreadComment } from '@univerjs/thread-comment';
|
|
3
3
|
import { ISheetCommentAddEvent, ISheetCommentDeleteEvent, ISheetCommentResolveEvent, ISheetCommentUpdateEvent } from './f-event';
|
|
4
4
|
import { FTheadCommentBuilder } from './f-thread-comment';
|
|
5
|
+
/**
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
5
8
|
export interface IFUniverCommentMixin {
|
|
6
9
|
/**
|
|
7
10
|
* @deprecated use `univerAPI.addEvent(univerAPI.event.CommentAdded, () => {})` as instead
|
|
@@ -29,9 +32,15 @@ export interface IFUniverCommentMixin {
|
|
|
29
32
|
*/
|
|
30
33
|
newTheadComment(): FTheadCommentBuilder;
|
|
31
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* @ignore
|
|
37
|
+
*/
|
|
32
38
|
export declare class FUniverCommentMixin extends FUniver implements IFUniverCommentMixin {
|
|
33
39
|
private _handleCommentCommand;
|
|
34
40
|
private _handleBeforeCommentCommand;
|
|
41
|
+
/**
|
|
42
|
+
* @ignore
|
|
43
|
+
*/
|
|
35
44
|
_initialize(injector: Injector): void;
|
|
36
45
|
newTheadComment(comment?: IThreadComment): FTheadCommentBuilder;
|
|
37
46
|
}
|
|
@@ -3,6 +3,9 @@ import { CommentUpdate, IAddCommentCommandParams, IDeleteCommentCommandParams, T
|
|
|
3
3
|
import { FWorkbook } from '@univerjs/sheets/facade';
|
|
4
4
|
import { FThreadComment } from './f-thread-comment';
|
|
5
5
|
type IUpdateCommandParams = any;
|
|
6
|
+
/**
|
|
7
|
+
* @ignore
|
|
8
|
+
*/
|
|
6
9
|
export interface IFWorkbookThreadCommentMixin {
|
|
7
10
|
/**
|
|
8
11
|
* Get all comments in the current sheet
|
|
@@ -41,8 +44,14 @@ export interface IFWorkbookThreadCommentMixin {
|
|
|
41
44
|
*/
|
|
42
45
|
onBeforeDeleteThreadComment(this: FWorkbook, callback: (params: IDeleteCommentCommandParams, options: IExecutionOptions | undefined) => void | false): IDisposable;
|
|
43
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* @ignore
|
|
49
|
+
*/
|
|
44
50
|
export declare class FWorkbookThreadCommentMixin extends FWorkbook implements IFWorkbookThreadCommentMixin {
|
|
45
51
|
_threadCommentModel: ThreadCommentModel;
|
|
52
|
+
/**
|
|
53
|
+
* @ignore
|
|
54
|
+
*/
|
|
46
55
|
_initialize(): void;
|
|
47
56
|
getComments(): FThreadComment[];
|
|
48
57
|
clearComments(): Promise<boolean>;
|
|
@@ -2,6 +2,9 @@ import { IDisposable } from '@univerjs/core';
|
|
|
2
2
|
import { IAddCommentCommandParams } from '@univerjs/thread-comment';
|
|
3
3
|
import { FWorksheet } from '@univerjs/sheets/facade';
|
|
4
4
|
import { FThreadComment } from './f-thread-comment';
|
|
5
|
+
/**
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
5
8
|
export interface IFWorksheetCommentMixin {
|
|
6
9
|
/**
|
|
7
10
|
* Get all comments in the current sheet
|
|
@@ -33,6 +36,9 @@ export interface IFWorksheetCommentMixin {
|
|
|
33
36
|
*/
|
|
34
37
|
getCommentById(commentId: string): FThreadComment | undefined;
|
|
35
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* @ignore
|
|
41
|
+
*/
|
|
36
42
|
export declare class FWorksheetCommentMixin extends FWorksheet implements IFWorksheetCommentMixin {
|
|
37
43
|
getComments(): FThreadComment[];
|
|
38
44
|
clearComments(): Promise<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-thread-comment",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer sheets thread comment base plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
"rxjs": ">=7.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@univerjs/core": "0.
|
|
55
|
-
"@univerjs/
|
|
56
|
-
"@univerjs/
|
|
57
|
-
"@univerjs/
|
|
54
|
+
"@univerjs/core": "0.6.0-alpha.0",
|
|
55
|
+
"@univerjs/engine-formula": "0.6.0-alpha.0",
|
|
56
|
+
"@univerjs/sheets": "0.6.0-alpha.0",
|
|
57
|
+
"@univerjs/thread-comment": "0.6.0-alpha.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"rxjs": "^7.8.1",
|
|
61
|
-
"typescript": "^5.7.
|
|
61
|
+
"typescript": "^5.7.3",
|
|
62
62
|
"vite": "^6.0.7",
|
|
63
63
|
"vitest": "^2.1.8",
|
|
64
|
-
"@univerjs-infra/shared": "0.
|
|
64
|
+
"@univerjs-infra/shared": "0.6.0-alpha.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"test": "vitest run",
|