@univerjs/sheets-thread-comment 0.24.0 → 0.25.0-insiders.20260608-e4336f7
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/facade.js +58 -47
- package/lib/cjs/index.js +7 -7
- package/lib/es/facade.js +58 -47
- package/lib/es/index.js +7 -7
- package/lib/facade.js +58 -47
- package/lib/index.js +7 -7
- package/lib/types/facade/f-range.d.ts +11 -10
- package/lib/types/facade/f-thread-comment.d.ts +28 -14
- package/lib/types/facade/f-univer.d.ts +2 -2
- package/lib/types/facade/f-workbook.d.ts +3 -5
- package/lib/types/facade/f-worksheet.d.ts +6 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -7
- package/LICENSE +0 -176
package/lib/facade.js
CHANGED
|
@@ -6,7 +6,7 @@ import { deserializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
|
6
6
|
import { filter } from "rxjs";
|
|
7
7
|
import { FEventName, FUniver } from "@univerjs/core/facade";
|
|
8
8
|
|
|
9
|
-
//#region \0@oxc-project+runtime@0.
|
|
9
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
|
|
10
10
|
function _typeof(o) {
|
|
11
11
|
"@babel/helpers - typeof";
|
|
12
12
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -17,7 +17,7 @@ function _typeof(o) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
|
-
//#region \0@oxc-project+runtime@0.
|
|
20
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
|
|
21
21
|
function toPrimitive(t, r) {
|
|
22
22
|
if ("object" != _typeof(t) || !t) return t;
|
|
23
23
|
var e = t[Symbol.toPrimitive];
|
|
@@ -30,14 +30,14 @@ function toPrimitive(t, r) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
33
|
-
//#region \0@oxc-project+runtime@0.
|
|
33
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
|
|
34
34
|
function toPropertyKey(t) {
|
|
35
35
|
var i = toPrimitive(t, "string");
|
|
36
36
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
//#endregion
|
|
40
|
-
//#region \0@oxc-project+runtime@0.
|
|
40
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
|
|
41
41
|
function _defineProperty(e, r, t) {
|
|
42
42
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
43
43
|
value: t,
|
|
@@ -48,7 +48,7 @@ function _defineProperty(e, r, t) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
//#endregion
|
|
51
|
-
//#region \0@oxc-project+runtime@0.
|
|
51
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorateParam.js
|
|
52
52
|
function __decorateParam(paramIndex, decorator) {
|
|
53
53
|
return function(target, key) {
|
|
54
54
|
decorator(target, key, paramIndex);
|
|
@@ -56,7 +56,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
//#endregion
|
|
59
|
-
//#region \0@oxc-project+runtime@0.
|
|
59
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorate.js
|
|
60
60
|
function __decorate(decorators, target, key, desc) {
|
|
61
61
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
62
62
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -194,7 +194,8 @@ var FTheadCommentBuilder = class FTheadCommentBuilder extends FTheadCommentItem
|
|
|
194
194
|
*
|
|
195
195
|
* // Add the comment to the cell A1
|
|
196
196
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
197
|
-
* const fWorksheet = fWorkbook.
|
|
197
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
198
|
+
* if (!fWorksheet) return;
|
|
198
199
|
* const cell = fWorksheet.getRange('A1');
|
|
199
200
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
200
201
|
* console.log(result);
|
|
@@ -220,7 +221,8 @@ var FTheadCommentBuilder = class FTheadCommentBuilder extends FTheadCommentItem
|
|
|
220
221
|
*
|
|
221
222
|
* // Add the comment to the cell A1
|
|
222
223
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
223
|
-
* const fWorksheet = fWorkbook.
|
|
224
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
225
|
+
* if (!fWorksheet) return;
|
|
224
226
|
* const cell = fWorksheet.getRange('A1');
|
|
225
227
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
226
228
|
* console.log(result);
|
|
@@ -245,7 +247,8 @@ var FTheadCommentBuilder = class FTheadCommentBuilder extends FTheadCommentItem
|
|
|
245
247
|
*
|
|
246
248
|
* // Add the comment to the cell A1
|
|
247
249
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
248
|
-
* const fWorksheet = fWorkbook.
|
|
250
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
251
|
+
* if (!fWorksheet) return;
|
|
249
252
|
* const cell = fWorksheet.getRange('A1');
|
|
250
253
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
251
254
|
* console.log(result);
|
|
@@ -270,7 +273,8 @@ var FTheadCommentBuilder = class FTheadCommentBuilder extends FTheadCommentItem
|
|
|
270
273
|
*
|
|
271
274
|
* // Add the comment to the cell A1
|
|
272
275
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
273
|
-
* const fWorksheet = fWorkbook.
|
|
276
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
277
|
+
* if (!fWorksheet) return;
|
|
274
278
|
* const cell = fWorksheet.getRange('A1');
|
|
275
279
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
276
280
|
* console.log(result);
|
|
@@ -295,7 +299,8 @@ var FTheadCommentBuilder = class FTheadCommentBuilder extends FTheadCommentItem
|
|
|
295
299
|
*
|
|
296
300
|
* // Add the comment to the cell A1
|
|
297
301
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
298
|
-
* const fWorksheet = fWorkbook.
|
|
302
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
303
|
+
* if (!fWorksheet) return;
|
|
299
304
|
* const cell = fWorksheet.getRange('A1');
|
|
300
305
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
301
306
|
* console.log(result);
|
|
@@ -348,7 +353,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
|
|
|
348
353
|
* @example
|
|
349
354
|
* ```ts
|
|
350
355
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
351
|
-
* const fWorksheet = fWorkbook.
|
|
356
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
357
|
+
* if (!fWorksheet) return;
|
|
352
358
|
* const comments = fWorksheet.getComments();
|
|
353
359
|
* comments.forEach((comment) => {
|
|
354
360
|
* console.log(comment.getIsRoot());
|
|
@@ -364,7 +370,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
|
|
|
364
370
|
* @example
|
|
365
371
|
* ```ts
|
|
366
372
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
367
|
-
* const fWorksheet = fWorkbook.
|
|
373
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
374
|
+
* if (!fWorksheet) return;
|
|
368
375
|
* const comments = fWorksheet.getComments();
|
|
369
376
|
* comments.forEach((comment) => {
|
|
370
377
|
* console.log(comment.getCommentData());
|
|
@@ -381,7 +388,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
|
|
|
381
388
|
* @example
|
|
382
389
|
* ```ts
|
|
383
390
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
384
|
-
* const fWorksheet = fWorkbook.
|
|
391
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
392
|
+
* if (!fWorksheet) return;
|
|
385
393
|
* const comments = fWorksheet.getComments();
|
|
386
394
|
* comments.forEach((comment) => {
|
|
387
395
|
* if (comment.getIsRoot()) {
|
|
@@ -405,7 +413,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
|
|
|
405
413
|
* @example
|
|
406
414
|
* ```ts
|
|
407
415
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
408
|
-
* const fWorksheet = fWorkbook.
|
|
416
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
417
|
+
* if (!fWorksheet) return;
|
|
409
418
|
* const comments = fWorksheet.getComments();
|
|
410
419
|
* comments.forEach((comment) => {
|
|
411
420
|
* console.log(comment.getRange().getA1Notation());
|
|
@@ -432,7 +441,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
|
|
|
432
441
|
* @example
|
|
433
442
|
* ```ts
|
|
434
443
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
435
|
-
* const fWorksheet = fWorkbook.
|
|
444
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
445
|
+
* if (!fWorksheet) return;
|
|
436
446
|
* const comments = fWorksheet.getComments();
|
|
437
447
|
* comments.forEach((comment) => {
|
|
438
448
|
* console.log(comment.getRichText());
|
|
@@ -453,7 +463,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
|
|
|
453
463
|
* @example
|
|
454
464
|
* ```ts
|
|
455
465
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
456
|
-
* const fWorksheet = fWorkbook.
|
|
466
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
467
|
+
* if (!fWorksheet) return;
|
|
457
468
|
* const comments = fWorksheet.getComments();
|
|
458
469
|
*
|
|
459
470
|
* // Delete the first comment
|
|
@@ -487,7 +498,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
|
|
|
487
498
|
* @example
|
|
488
499
|
* ```ts
|
|
489
500
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
490
|
-
* const fWorksheet = fWorkbook.
|
|
501
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
502
|
+
* if (!fWorksheet) return;
|
|
491
503
|
*
|
|
492
504
|
* // Create a new comment
|
|
493
505
|
* const richText = univerAPI.newRichText().insertText('hello univer');
|
|
@@ -533,7 +545,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
|
|
|
533
545
|
* @example
|
|
534
546
|
* ```ts
|
|
535
547
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
536
|
-
* const fWorksheet = fWorkbook.
|
|
548
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
549
|
+
* if (!fWorksheet) return;
|
|
537
550
|
*
|
|
538
551
|
* // Create a new comment
|
|
539
552
|
* const richText = univerAPI.newRichText().insertText('hello univer');
|
|
@@ -566,7 +579,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
|
|
|
566
579
|
* @example
|
|
567
580
|
* ```ts
|
|
568
581
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
569
|
-
* const fWorksheet = fWorkbook.
|
|
582
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
583
|
+
* if (!fWorksheet) return;
|
|
570
584
|
*
|
|
571
585
|
* // Create a new comment
|
|
572
586
|
* const richText = univerAPI.newRichText().insertText('hello univer');
|
|
@@ -843,26 +857,16 @@ FEventName.extend(FSheetsThreadCommentEventNameMixin);
|
|
|
843
857
|
* @ignore
|
|
844
858
|
*/
|
|
845
859
|
var FUniverSheetsThreadCommentMixin = class extends FUniver {
|
|
846
|
-
_getTargetSheet(params = {}) {
|
|
847
|
-
var _this$getActiveWorkbo;
|
|
848
|
-
const workbook = params.unitId ? this.getUniverSheet(params.unitId) : (_this$getActiveWorkbo = this.getActiveWorkbook) === null || _this$getActiveWorkbo === void 0 ? void 0 : _this$getActiveWorkbo.call(this);
|
|
849
|
-
if (!workbook) return null;
|
|
850
|
-
const worksheet = params.subUnitId ? workbook.getSheetBySheetId(params.subUnitId) : workbook.getActiveSheet();
|
|
851
|
-
if (!worksheet) return null;
|
|
852
|
-
return {
|
|
853
|
-
workbook,
|
|
854
|
-
worksheet
|
|
855
|
-
};
|
|
856
|
-
}
|
|
857
860
|
_initialize(injector) {
|
|
858
861
|
const commandService = injector.get(ICommandService);
|
|
859
862
|
this.disposeWithMe(this.registerEventHandler(this.Event.CommentAdded, () => commandService.onCommandExecuted((commandInfo) => {
|
|
860
863
|
var _threadComment$getRan, _threadComment$getRan2, _threadComment$getRan3, _threadComment$getRan4;
|
|
861
864
|
if (commandInfo.id !== AddCommentCommand.id) return;
|
|
862
|
-
const
|
|
865
|
+
const params = commandInfo.params;
|
|
866
|
+
const target = this.getSheetCommandTarget(params);
|
|
863
867
|
if (!target) return;
|
|
864
868
|
const { workbook, worksheet } = target;
|
|
865
|
-
const { comment } =
|
|
869
|
+
const { comment } = params;
|
|
866
870
|
const threadComment = worksheet.getCommentById(comment.id);
|
|
867
871
|
if (!threadComment) return;
|
|
868
872
|
const eventParams = {
|
|
@@ -877,10 +881,11 @@ var FUniverSheetsThreadCommentMixin = class extends FUniver {
|
|
|
877
881
|
this.disposeWithMe(this.registerEventHandler(this.Event.CommentUpdated, () => commandService.onCommandExecuted((commandInfo) => {
|
|
878
882
|
var _threadComment$getRan5, _threadComment$getRan6, _threadComment$getRan7, _threadComment$getRan8;
|
|
879
883
|
if (commandInfo.id !== UpdateCommentCommand.id) return;
|
|
880
|
-
const
|
|
884
|
+
const params = commandInfo.params;
|
|
885
|
+
const target = this.getSheetCommandTarget(params);
|
|
881
886
|
if (!target) return;
|
|
882
887
|
const { workbook, worksheet } = target;
|
|
883
|
-
const { payload } =
|
|
888
|
+
const { payload } = params;
|
|
884
889
|
const threadComment = worksheet.getCommentById(payload.commentId);
|
|
885
890
|
if (!threadComment) return;
|
|
886
891
|
const eventParams = {
|
|
@@ -894,10 +899,11 @@ var FUniverSheetsThreadCommentMixin = class extends FUniver {
|
|
|
894
899
|
})));
|
|
895
900
|
this.disposeWithMe(this.registerEventHandler(this.Event.CommentDeleted, () => commandService.onCommandExecuted((commandInfo) => {
|
|
896
901
|
if (commandInfo.id !== DeleteCommentCommand.id && commandInfo.id !== DeleteCommentTreeCommand.id) return;
|
|
897
|
-
const
|
|
902
|
+
const params = commandInfo.params;
|
|
903
|
+
const target = this.getSheetCommandTarget(params);
|
|
898
904
|
if (!target) return;
|
|
899
905
|
const { workbook, worksheet } = target;
|
|
900
|
-
const { commentId } =
|
|
906
|
+
const { commentId } = params;
|
|
901
907
|
const eventParams = {
|
|
902
908
|
workbook,
|
|
903
909
|
worksheet,
|
|
@@ -908,10 +914,11 @@ var FUniverSheetsThreadCommentMixin = class extends FUniver {
|
|
|
908
914
|
this.disposeWithMe(this.registerEventHandler(this.Event.CommentResolved, () => commandService.onCommandExecuted((commandInfo) => {
|
|
909
915
|
var _threadComment$getRan9, _threadComment$getRan10, _threadComment$getRan11, _threadComment$getRan12;
|
|
910
916
|
if (commandInfo.id !== ResolveCommentCommand.id) return;
|
|
911
|
-
const
|
|
917
|
+
const params = commandInfo.params;
|
|
918
|
+
const target = this.getSheetCommandTarget(params);
|
|
912
919
|
if (!target) return;
|
|
913
920
|
const { workbook, worksheet } = target;
|
|
914
|
-
const { commentId, resolved } =
|
|
921
|
+
const { commentId, resolved } = params;
|
|
915
922
|
const threadComment = worksheet.getCommentById(commentId);
|
|
916
923
|
if (!threadComment) return;
|
|
917
924
|
const eventParams = {
|
|
@@ -926,10 +933,11 @@ var FUniverSheetsThreadCommentMixin = class extends FUniver {
|
|
|
926
933
|
})));
|
|
927
934
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentAdd, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
928
935
|
if (commandInfo.id !== AddCommentCommand.id) return;
|
|
929
|
-
const
|
|
936
|
+
const params = commandInfo.params;
|
|
937
|
+
const target = this.getSheetCommandTarget(params);
|
|
930
938
|
if (!target) return;
|
|
931
939
|
const { workbook, worksheet } = target;
|
|
932
|
-
const { comment } =
|
|
940
|
+
const { comment } = params;
|
|
933
941
|
const { range } = deserializeRangeWithSheet(comment.ref);
|
|
934
942
|
const eventParams = {
|
|
935
943
|
workbook,
|
|
@@ -944,10 +952,11 @@ var FUniverSheetsThreadCommentMixin = class extends FUniver {
|
|
|
944
952
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentUpdate, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
945
953
|
var _threadComment$getRan13, _threadComment$getRan14, _threadComment$getRan15, _threadComment$getRan16;
|
|
946
954
|
if (commandInfo.id !== UpdateCommentCommand.id) return;
|
|
947
|
-
const
|
|
955
|
+
const params = commandInfo.params;
|
|
956
|
+
const target = this.getSheetCommandTarget(params);
|
|
948
957
|
if (!target) return;
|
|
949
958
|
const { workbook, worksheet } = target;
|
|
950
|
-
const { payload } =
|
|
959
|
+
const { payload } = params;
|
|
951
960
|
const threadComment = worksheet.getCommentById(payload.commentId);
|
|
952
961
|
if (!threadComment) return;
|
|
953
962
|
const eventParams = {
|
|
@@ -964,10 +973,11 @@ var FUniverSheetsThreadCommentMixin = class extends FUniver {
|
|
|
964
973
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentDelete, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
965
974
|
var _threadComment$getRan17, _threadComment$getRan18, _threadComment$getRan19, _threadComment$getRan20;
|
|
966
975
|
if (commandInfo.id !== DeleteCommentCommand.id && commandInfo.id !== DeleteCommentTreeCommand.id) return;
|
|
967
|
-
const
|
|
976
|
+
const params = commandInfo.params;
|
|
977
|
+
const target = this.getSheetCommandTarget(params);
|
|
968
978
|
if (!target) return;
|
|
969
979
|
const { workbook, worksheet } = target;
|
|
970
|
-
const { commentId } =
|
|
980
|
+
const { commentId } = params;
|
|
971
981
|
const threadComment = worksheet.getCommentById(commentId);
|
|
972
982
|
if (!threadComment) return;
|
|
973
983
|
const eventParams = {
|
|
@@ -983,10 +993,11 @@ var FUniverSheetsThreadCommentMixin = class extends FUniver {
|
|
|
983
993
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentResolve, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
984
994
|
var _getRow, _getColumn;
|
|
985
995
|
if (commandInfo.id !== ResolveCommentCommand.id) return;
|
|
986
|
-
const
|
|
996
|
+
const params = commandInfo.params;
|
|
997
|
+
const target = this.getSheetCommandTarget(params);
|
|
987
998
|
if (!target) return;
|
|
988
999
|
const { workbook, worksheet } = target;
|
|
989
|
-
const { commentId, resolved } =
|
|
1000
|
+
const { commentId, resolved } = params;
|
|
990
1001
|
const threadComment = worksheet.getCommentById(commentId);
|
|
991
1002
|
if (!threadComment) return;
|
|
992
1003
|
const eventParams = {
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { CopySheetCommand, RefRangeService, RemoveSheetCommand, SheetInterceptor
|
|
|
4
4
|
import { AddCommentMutation, DeleteCommentMutation, IThreadCommentDataSourceService, ThreadCommentModel, UniverThreadCommentPlugin, UpdateCommentRefMutation } from "@univerjs/thread-comment";
|
|
5
5
|
import { Subject } from "rxjs";
|
|
6
6
|
|
|
7
|
-
//#region \0@oxc-project+runtime@0.
|
|
7
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
|
|
8
8
|
function _typeof(o) {
|
|
9
9
|
"@babel/helpers - typeof";
|
|
10
10
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -15,7 +15,7 @@ function _typeof(o) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
|
-
//#region \0@oxc-project+runtime@0.
|
|
18
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
|
|
19
19
|
function toPrimitive(t, r) {
|
|
20
20
|
if ("object" != _typeof(t) || !t) return t;
|
|
21
21
|
var e = t[Symbol.toPrimitive];
|
|
@@ -28,14 +28,14 @@ function toPrimitive(t, r) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
//#endregion
|
|
31
|
-
//#region \0@oxc-project+runtime@0.
|
|
31
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
|
|
32
32
|
function toPropertyKey(t) {
|
|
33
33
|
var i = toPrimitive(t, "string");
|
|
34
34
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
//#endregion
|
|
38
|
-
//#region \0@oxc-project+runtime@0.
|
|
38
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
|
|
39
39
|
function _defineProperty(e, r, t) {
|
|
40
40
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
41
41
|
value: t,
|
|
@@ -46,7 +46,7 @@ function _defineProperty(e, r, t) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
49
|
-
//#region \0@oxc-project+runtime@0.
|
|
49
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorateParam.js
|
|
50
50
|
function __decorateParam(paramIndex, decorator) {
|
|
51
51
|
return function(target, key) {
|
|
52
52
|
decorator(target, key, paramIndex);
|
|
@@ -54,7 +54,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
//#endregion
|
|
57
|
-
//#region \0@oxc-project+runtime@0.
|
|
57
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorate.js
|
|
58
58
|
function __decorate(decorators, target, key, desc) {
|
|
59
59
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
60
60
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -449,7 +449,7 @@ SheetsThreadCommentRefRangeController = __decorate([
|
|
|
449
449
|
//#endregion
|
|
450
450
|
//#region package.json
|
|
451
451
|
var name = "@univerjs/sheets-thread-comment";
|
|
452
|
-
var version = "0.
|
|
452
|
+
var version = "0.25.0-insiders.20260608-e4336f7";
|
|
453
453
|
|
|
454
454
|
//#endregion
|
|
455
455
|
//#region src/config/config.ts
|
|
@@ -25,9 +25,9 @@ export interface IFRangeSheetsThreadCommentMixin {
|
|
|
25
25
|
* @returns {FThreadComment | null} The comment of the start cell in the current range. If the cell does not have a comment, return `null`.
|
|
26
26
|
* @example
|
|
27
27
|
* ```ts
|
|
28
|
-
* const
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
29
|
+
* if (!fWorksheet) return;
|
|
30
|
+
* const range = fWorksheet.getActiveRange();
|
|
31
31
|
* const comment = range.getComment();
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
@@ -37,9 +37,9 @@ export interface IFRangeSheetsThreadCommentMixin {
|
|
|
37
37
|
* @returns {FThreadComment[]} The comments in the current range.
|
|
38
38
|
* @example
|
|
39
39
|
* ```ts
|
|
40
|
-
* const
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
41
|
+
* if (!fWorksheet) return;
|
|
42
|
+
* const range = fWorksheet.getActiveRange();
|
|
43
43
|
* const comments = range.getComments();
|
|
44
44
|
* comments.forEach((comment) => {
|
|
45
45
|
* console.log(comment.getContent());
|
|
@@ -65,7 +65,8 @@ export interface IFRangeSheetsThreadCommentMixin {
|
|
|
65
65
|
*
|
|
66
66
|
* // Add the comment to the cell A1
|
|
67
67
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
68
|
-
* const fWorksheet = fWorkbook.
|
|
68
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
69
|
+
* if (!fWorksheet) return;
|
|
69
70
|
* const cell = fWorksheet.getRange('A1');
|
|
70
71
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
71
72
|
* console.log(result);
|
|
@@ -90,9 +91,9 @@ export interface IFRangeSheetsThreadCommentMixin {
|
|
|
90
91
|
* @returns Whether the comments are cleared successfully.
|
|
91
92
|
* @example
|
|
92
93
|
* ```ts
|
|
93
|
-
* const
|
|
94
|
-
*
|
|
95
|
-
*
|
|
94
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
95
|
+
* if (!fWorksheet) return;
|
|
96
|
+
* const range = fWorksheet.getActiveRange();
|
|
96
97
|
* const success = await range.clearCommentsAsync();
|
|
97
98
|
* ```
|
|
98
99
|
*/
|
|
@@ -117,7 +117,8 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
117
117
|
*
|
|
118
118
|
* // Add the comment to the cell A1
|
|
119
119
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
120
|
-
* const fWorksheet = fWorkbook.
|
|
120
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
121
|
+
* if (!fWorksheet) return;
|
|
121
122
|
* const cell = fWorksheet.getRange('A1');
|
|
122
123
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
123
124
|
* console.log(result);
|
|
@@ -139,7 +140,8 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
139
140
|
*
|
|
140
141
|
* // Add the comment to the cell A1
|
|
141
142
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
142
|
-
* const fWorksheet = fWorkbook.
|
|
143
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
144
|
+
* if (!fWorksheet) return;
|
|
143
145
|
* const cell = fWorksheet.getRange('A1');
|
|
144
146
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
145
147
|
* console.log(result);
|
|
@@ -161,7 +163,8 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
161
163
|
*
|
|
162
164
|
* // Add the comment to the cell A1
|
|
163
165
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
164
|
-
* const fWorksheet = fWorkbook.
|
|
166
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
167
|
+
* if (!fWorksheet) return;
|
|
165
168
|
* const cell = fWorksheet.getRange('A1');
|
|
166
169
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
167
170
|
* console.log(result);
|
|
@@ -183,7 +186,8 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
183
186
|
*
|
|
184
187
|
* // Add the comment to the cell A1
|
|
185
188
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
186
|
-
* const fWorksheet = fWorkbook.
|
|
189
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
190
|
+
* if (!fWorksheet) return;
|
|
187
191
|
* const cell = fWorksheet.getRange('A1');
|
|
188
192
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
189
193
|
* console.log(result);
|
|
@@ -205,7 +209,8 @@ export declare class FTheadCommentBuilder extends FTheadCommentItem {
|
|
|
205
209
|
*
|
|
206
210
|
* // Add the comment to the cell A1
|
|
207
211
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
208
|
-
* const fWorksheet = fWorkbook.
|
|
212
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
213
|
+
* if (!fWorksheet) return;
|
|
209
214
|
* const cell = fWorksheet.getRange('A1');
|
|
210
215
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
211
216
|
* console.log(result);
|
|
@@ -252,7 +257,8 @@ export declare class FThreadComment {
|
|
|
252
257
|
* @example
|
|
253
258
|
* ```ts
|
|
254
259
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
255
|
-
* const fWorksheet = fWorkbook.
|
|
260
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
261
|
+
* if (!fWorksheet) return;
|
|
256
262
|
* const comments = fWorksheet.getComments();
|
|
257
263
|
* comments.forEach((comment) => {
|
|
258
264
|
* console.log(comment.getIsRoot());
|
|
@@ -266,7 +272,8 @@ export declare class FThreadComment {
|
|
|
266
272
|
* @example
|
|
267
273
|
* ```ts
|
|
268
274
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
269
|
-
* const fWorksheet = fWorkbook.
|
|
275
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
276
|
+
* if (!fWorksheet) return;
|
|
270
277
|
* const comments = fWorksheet.getComments();
|
|
271
278
|
* comments.forEach((comment) => {
|
|
272
279
|
* console.log(comment.getCommentData());
|
|
@@ -280,7 +287,8 @@ export declare class FThreadComment {
|
|
|
280
287
|
* @example
|
|
281
288
|
* ```ts
|
|
282
289
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
283
|
-
* const fWorksheet = fWorkbook.
|
|
290
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
291
|
+
* if (!fWorksheet) return;
|
|
284
292
|
* const comments = fWorksheet.getComments();
|
|
285
293
|
* comments.forEach((comment) => {
|
|
286
294
|
* if (comment.getIsRoot()) {
|
|
@@ -299,7 +307,8 @@ export declare class FThreadComment {
|
|
|
299
307
|
* @example
|
|
300
308
|
* ```ts
|
|
301
309
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
302
|
-
* const fWorksheet = fWorkbook.
|
|
310
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
311
|
+
* if (!fWorksheet) return;
|
|
303
312
|
* const comments = fWorksheet.getComments();
|
|
304
313
|
* comments.forEach((comment) => {
|
|
305
314
|
* console.log(comment.getRange().getA1Notation());
|
|
@@ -317,7 +326,8 @@ export declare class FThreadComment {
|
|
|
317
326
|
* @example
|
|
318
327
|
* ```ts
|
|
319
328
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
320
|
-
* const fWorksheet = fWorkbook.
|
|
329
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
330
|
+
* if (!fWorksheet) return;
|
|
321
331
|
* const comments = fWorksheet.getComments();
|
|
322
332
|
* comments.forEach((comment) => {
|
|
323
333
|
* console.log(comment.getRichText());
|
|
@@ -331,7 +341,8 @@ export declare class FThreadComment {
|
|
|
331
341
|
* @example
|
|
332
342
|
* ```ts
|
|
333
343
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
334
|
-
* const fWorksheet = fWorkbook.
|
|
344
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
345
|
+
* if (!fWorksheet) return;
|
|
335
346
|
* const comments = fWorksheet.getComments();
|
|
336
347
|
*
|
|
337
348
|
* // Delete the first comment
|
|
@@ -355,7 +366,8 @@ export declare class FThreadComment {
|
|
|
355
366
|
* @example
|
|
356
367
|
* ```ts
|
|
357
368
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
358
|
-
* const fWorksheet = fWorkbook.
|
|
369
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
370
|
+
* if (!fWorksheet) return;
|
|
359
371
|
*
|
|
360
372
|
* // Create a new comment
|
|
361
373
|
* const richText = univerAPI.newRichText().insertText('hello univer');
|
|
@@ -386,7 +398,8 @@ export declare class FThreadComment {
|
|
|
386
398
|
* @example
|
|
387
399
|
* ```ts
|
|
388
400
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
389
|
-
* const fWorksheet = fWorkbook.
|
|
401
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
402
|
+
* if (!fWorksheet) return;
|
|
390
403
|
*
|
|
391
404
|
* // Create a new comment
|
|
392
405
|
* const richText = univerAPI.newRichText().insertText('hello univer');
|
|
@@ -412,7 +425,8 @@ export declare class FThreadComment {
|
|
|
412
425
|
* @example
|
|
413
426
|
* ```ts
|
|
414
427
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
415
|
-
* const fWorksheet = fWorkbook.
|
|
428
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
429
|
+
* if (!fWorksheet) return;
|
|
416
430
|
*
|
|
417
431
|
* // Create a new comment
|
|
418
432
|
* const richText = univerAPI.newRichText().insertText('hello univer');
|
|
@@ -37,7 +37,8 @@ export interface IFUniverSheetsThreadCommentMixin {
|
|
|
37
37
|
*
|
|
38
38
|
* // Add the comment to the cell A1
|
|
39
39
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
40
|
-
* const fWorksheet = fWorkbook.
|
|
40
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
41
|
+
* if (!fWorksheet) return;
|
|
41
42
|
* const cell = fWorksheet.getRange('A1');
|
|
42
43
|
* const result = await cell.addCommentAsync(commentBuilder);
|
|
43
44
|
* console.log(result);
|
|
@@ -49,7 +50,6 @@ export interface IFUniverSheetsThreadCommentMixin {
|
|
|
49
50
|
* @ignore
|
|
50
51
|
*/
|
|
51
52
|
export declare class FUniverSheetsThreadCommentMixin extends FUniver implements IFUniverSheetsThreadCommentMixin {
|
|
52
|
-
private _getTargetSheet;
|
|
53
53
|
_initialize(injector: Injector): void;
|
|
54
54
|
/**
|
|
55
55
|
* @ignore
|
|
@@ -14,11 +14,10 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IDisposable, IExecutionOptions } from '@univerjs/core';
|
|
17
|
-
import type { CommentUpdate, IAddCommentCommandParams, IDeleteCommentCommandParams } from '@univerjs/thread-comment';
|
|
17
|
+
import type { CommentUpdate, IAddCommentCommandParams, IDeleteCommentCommandParams, IUpdateCommentCommandParams } from '@univerjs/thread-comment';
|
|
18
18
|
import { FWorkbook } from '@univerjs/sheets/facade';
|
|
19
19
|
import { ThreadCommentModel } from '@univerjs/thread-comment';
|
|
20
20
|
import { FThreadComment } from './f-thread-comment';
|
|
21
|
-
type IUpdateCommandParams = any;
|
|
22
21
|
/**
|
|
23
22
|
* @ignore
|
|
24
23
|
*/
|
|
@@ -67,7 +66,7 @@ export interface IFWorkbookSheetsThreadCommentMixin {
|
|
|
67
66
|
/**
|
|
68
67
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeCommentUpdate, (params) => {})` as instead
|
|
69
68
|
*/
|
|
70
|
-
onBeforeUpdateThreadComment(this: FWorkbook, callback: (params:
|
|
69
|
+
onBeforeUpdateThreadComment(this: FWorkbook, callback: (params: IUpdateCommentCommandParams, options: IExecutionOptions | undefined) => void | false): IDisposable;
|
|
71
70
|
/**
|
|
72
71
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeCommentDelete, (params) => {})` as instead
|
|
73
72
|
*/
|
|
@@ -98,7 +97,7 @@ export declare class FWorkbookSheetsThreadCommentMixin extends FWorkbook impleme
|
|
|
98
97
|
* @param callback
|
|
99
98
|
* @deprecated
|
|
100
99
|
*/
|
|
101
|
-
onBeforeUpdateThreadComment(callback: (params:
|
|
100
|
+
onBeforeUpdateThreadComment(callback: (params: IUpdateCommentCommandParams, options: IExecutionOptions | undefined) => void | false): IDisposable;
|
|
102
101
|
/**
|
|
103
102
|
* @param callback
|
|
104
103
|
* @deprecated
|
|
@@ -109,4 +108,3 @@ declare module '@univerjs/sheets/facade' {
|
|
|
109
108
|
interface FWorkbook extends IFWorkbookSheetsThreadCommentMixin {
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
|
-
export {};
|
|
@@ -27,7 +27,8 @@ export interface IFWorksheetCommentMixin {
|
|
|
27
27
|
* @example
|
|
28
28
|
* ```ts
|
|
29
29
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
30
|
-
* const fWorksheet = fWorkbook.
|
|
30
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
31
|
+
* if (!fWorksheet) return;
|
|
31
32
|
* const comments = fWorksheet.getComments();
|
|
32
33
|
* comments.forEach((comment) => {
|
|
33
34
|
* const isRoot = comment.getIsRoot();
|
|
@@ -50,7 +51,8 @@ export interface IFWorksheetCommentMixin {
|
|
|
50
51
|
* @example
|
|
51
52
|
* ```ts
|
|
52
53
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
53
|
-
* const fWorksheet = fWorkbook.
|
|
54
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
55
|
+
* if (!fWorksheet) return;
|
|
54
56
|
* const result = await fWorksheet.clearComments();
|
|
55
57
|
* console.log(result);
|
|
56
58
|
* ```
|
|
@@ -61,7 +63,8 @@ export interface IFWorksheetCommentMixin {
|
|
|
61
63
|
* @param {string} commentId comment id
|
|
62
64
|
* ```ts
|
|
63
65
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
64
|
-
* const fWorksheet = fWorkbook.
|
|
66
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
67
|
+
* if (!fWorksheet) return;
|
|
65
68
|
*
|
|
66
69
|
* // Create a new comment
|
|
67
70
|
* const richText = univerAPI.newRichText().insertText('hello univer');
|