@univerjs/sheets-thread-comment 0.24.0 → 0.25.0-insiders.20260604-29ebbff

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 CHANGED
@@ -7,7 +7,7 @@ let _univerjs_engine_formula = require("@univerjs/engine-formula");
7
7
  let rxjs = require("rxjs");
8
8
  let _univerjs_core_facade = require("@univerjs/core/facade");
9
9
 
10
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
10
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
11
11
  function _typeof(o) {
12
12
  "@babel/helpers - typeof";
13
13
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -18,7 +18,7 @@ function _typeof(o) {
18
18
  }
19
19
 
20
20
  //#endregion
21
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
21
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
22
22
  function toPrimitive(t, r) {
23
23
  if ("object" != _typeof(t) || !t) return t;
24
24
  var e = t[Symbol.toPrimitive];
@@ -31,14 +31,14 @@ function toPrimitive(t, r) {
31
31
  }
32
32
 
33
33
  //#endregion
34
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
34
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
35
35
  function toPropertyKey(t) {
36
36
  var i = toPrimitive(t, "string");
37
37
  return "symbol" == _typeof(i) ? i : i + "";
38
38
  }
39
39
 
40
40
  //#endregion
41
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
41
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
42
42
  function _defineProperty(e, r, t) {
43
43
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
44
44
  value: t,
@@ -49,7 +49,7 @@ function _defineProperty(e, r, t) {
49
49
  }
50
50
 
51
51
  //#endregion
52
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
52
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
53
53
  function __decorateParam(paramIndex, decorator) {
54
54
  return function(target, key) {
55
55
  decorator(target, key, paramIndex);
@@ -57,7 +57,7 @@ function __decorateParam(paramIndex, decorator) {
57
57
  }
58
58
 
59
59
  //#endregion
60
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
60
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
61
61
  function __decorate(decorators, target, key, desc) {
62
62
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
63
63
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -195,7 +195,8 @@ var FTheadCommentBuilder = class FTheadCommentBuilder extends FTheadCommentItem
195
195
  *
196
196
  * // Add the comment to the cell A1
197
197
  * const fWorkbook = univerAPI.getActiveWorkbook();
198
- * const fWorksheet = fWorkbook.getActiveSheet();
198
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
199
+ * if (!fWorksheet) return;
199
200
  * const cell = fWorksheet.getRange('A1');
200
201
  * const result = await cell.addCommentAsync(commentBuilder);
201
202
  * console.log(result);
@@ -221,7 +222,8 @@ var FTheadCommentBuilder = class FTheadCommentBuilder extends FTheadCommentItem
221
222
  *
222
223
  * // Add the comment to the cell A1
223
224
  * const fWorkbook = univerAPI.getActiveWorkbook();
224
- * const fWorksheet = fWorkbook.getActiveSheet();
225
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
226
+ * if (!fWorksheet) return;
225
227
  * const cell = fWorksheet.getRange('A1');
226
228
  * const result = await cell.addCommentAsync(commentBuilder);
227
229
  * console.log(result);
@@ -246,7 +248,8 @@ var FTheadCommentBuilder = class FTheadCommentBuilder extends FTheadCommentItem
246
248
  *
247
249
  * // Add the comment to the cell A1
248
250
  * const fWorkbook = univerAPI.getActiveWorkbook();
249
- * const fWorksheet = fWorkbook.getActiveSheet();
251
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
252
+ * if (!fWorksheet) return;
250
253
  * const cell = fWorksheet.getRange('A1');
251
254
  * const result = await cell.addCommentAsync(commentBuilder);
252
255
  * console.log(result);
@@ -271,7 +274,8 @@ var FTheadCommentBuilder = class FTheadCommentBuilder extends FTheadCommentItem
271
274
  *
272
275
  * // Add the comment to the cell A1
273
276
  * const fWorkbook = univerAPI.getActiveWorkbook();
274
- * const fWorksheet = fWorkbook.getActiveSheet();
277
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
278
+ * if (!fWorksheet) return;
275
279
  * const cell = fWorksheet.getRange('A1');
276
280
  * const result = await cell.addCommentAsync(commentBuilder);
277
281
  * console.log(result);
@@ -296,7 +300,8 @@ var FTheadCommentBuilder = class FTheadCommentBuilder extends FTheadCommentItem
296
300
  *
297
301
  * // Add the comment to the cell A1
298
302
  * const fWorkbook = univerAPI.getActiveWorkbook();
299
- * const fWorksheet = fWorkbook.getActiveSheet();
303
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
304
+ * if (!fWorksheet) return;
300
305
  * const cell = fWorksheet.getRange('A1');
301
306
  * const result = await cell.addCommentAsync(commentBuilder);
302
307
  * console.log(result);
@@ -349,7 +354,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
349
354
  * @example
350
355
  * ```ts
351
356
  * const fWorkbook = univerAPI.getActiveWorkbook();
352
- * const fWorksheet = fWorkbook.getActiveSheet();
357
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
358
+ * if (!fWorksheet) return;
353
359
  * const comments = fWorksheet.getComments();
354
360
  * comments.forEach((comment) => {
355
361
  * console.log(comment.getIsRoot());
@@ -365,7 +371,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
365
371
  * @example
366
372
  * ```ts
367
373
  * const fWorkbook = univerAPI.getActiveWorkbook();
368
- * const fWorksheet = fWorkbook.getActiveSheet();
374
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
375
+ * if (!fWorksheet) return;
369
376
  * const comments = fWorksheet.getComments();
370
377
  * comments.forEach((comment) => {
371
378
  * console.log(comment.getCommentData());
@@ -382,7 +389,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
382
389
  * @example
383
390
  * ```ts
384
391
  * const fWorkbook = univerAPI.getActiveWorkbook();
385
- * const fWorksheet = fWorkbook.getActiveSheet();
392
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
393
+ * if (!fWorksheet) return;
386
394
  * const comments = fWorksheet.getComments();
387
395
  * comments.forEach((comment) => {
388
396
  * if (comment.getIsRoot()) {
@@ -406,7 +414,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
406
414
  * @example
407
415
  * ```ts
408
416
  * const fWorkbook = univerAPI.getActiveWorkbook();
409
- * const fWorksheet = fWorkbook.getActiveSheet();
417
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
418
+ * if (!fWorksheet) return;
410
419
  * const comments = fWorksheet.getComments();
411
420
  * comments.forEach((comment) => {
412
421
  * console.log(comment.getRange().getA1Notation());
@@ -433,7 +442,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
433
442
  * @example
434
443
  * ```ts
435
444
  * const fWorkbook = univerAPI.getActiveWorkbook();
436
- * const fWorksheet = fWorkbook.getActiveSheet();
445
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
446
+ * if (!fWorksheet) return;
437
447
  * const comments = fWorksheet.getComments();
438
448
  * comments.forEach((comment) => {
439
449
  * console.log(comment.getRichText());
@@ -454,7 +464,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
454
464
  * @example
455
465
  * ```ts
456
466
  * const fWorkbook = univerAPI.getActiveWorkbook();
457
- * const fWorksheet = fWorkbook.getActiveSheet();
467
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
468
+ * if (!fWorksheet) return;
458
469
  * const comments = fWorksheet.getComments();
459
470
  *
460
471
  * // Delete the first comment
@@ -488,7 +499,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
488
499
  * @example
489
500
  * ```ts
490
501
  * const fWorkbook = univerAPI.getActiveWorkbook();
491
- * const fWorksheet = fWorkbook.getActiveSheet();
502
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
503
+ * if (!fWorksheet) return;
492
504
  *
493
505
  * // Create a new comment
494
506
  * const richText = univerAPI.newRichText().insertText('hello univer');
@@ -534,7 +546,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
534
546
  * @example
535
547
  * ```ts
536
548
  * const fWorkbook = univerAPI.getActiveWorkbook();
537
- * const fWorksheet = fWorkbook.getActiveSheet();
549
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
550
+ * if (!fWorksheet) return;
538
551
  *
539
552
  * // Create a new comment
540
553
  * const richText = univerAPI.newRichText().insertText('hello univer');
@@ -567,7 +580,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
567
580
  * @example
568
581
  * ```ts
569
582
  * const fWorkbook = univerAPI.getActiveWorkbook();
570
- * const fWorksheet = fWorkbook.getActiveSheet();
583
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
584
+ * if (!fWorksheet) return;
571
585
  *
572
586
  * // Create a new comment
573
587
  * const richText = univerAPI.newRichText().insertText('hello univer');
@@ -844,26 +858,16 @@ _univerjs_core_facade.FEventName.extend(FSheetsThreadCommentEventNameMixin);
844
858
  * @ignore
845
859
  */
846
860
  var FUniverSheetsThreadCommentMixin = class extends _univerjs_core_facade.FUniver {
847
- _getTargetSheet(params = {}) {
848
- var _this$getActiveWorkbo;
849
- const workbook = params.unitId ? this.getUniverSheet(params.unitId) : (_this$getActiveWorkbo = this.getActiveWorkbook) === null || _this$getActiveWorkbo === void 0 ? void 0 : _this$getActiveWorkbo.call(this);
850
- if (!workbook) return null;
851
- const worksheet = params.subUnitId ? workbook.getSheetBySheetId(params.subUnitId) : workbook.getActiveSheet();
852
- if (!worksheet) return null;
853
- return {
854
- workbook,
855
- worksheet
856
- };
857
- }
858
861
  _initialize(injector) {
859
862
  const commandService = injector.get(_univerjs_core.ICommandService);
860
863
  this.disposeWithMe(this.registerEventHandler(this.Event.CommentAdded, () => commandService.onCommandExecuted((commandInfo) => {
861
864
  var _threadComment$getRan, _threadComment$getRan2, _threadComment$getRan3, _threadComment$getRan4;
862
865
  if (commandInfo.id !== _univerjs_thread_comment.AddCommentCommand.id) return;
863
- const target = this._getTargetSheet(commandInfo.params);
866
+ const params = commandInfo.params;
867
+ const target = this.getSheetCommandTarget(params);
864
868
  if (!target) return;
865
869
  const { workbook, worksheet } = target;
866
- const { comment } = commandInfo.params;
870
+ const { comment } = params;
867
871
  const threadComment = worksheet.getCommentById(comment.id);
868
872
  if (!threadComment) return;
869
873
  const eventParams = {
@@ -878,10 +882,11 @@ var FUniverSheetsThreadCommentMixin = class extends _univerjs_core_facade.FUnive
878
882
  this.disposeWithMe(this.registerEventHandler(this.Event.CommentUpdated, () => commandService.onCommandExecuted((commandInfo) => {
879
883
  var _threadComment$getRan5, _threadComment$getRan6, _threadComment$getRan7, _threadComment$getRan8;
880
884
  if (commandInfo.id !== _univerjs_thread_comment.UpdateCommentCommand.id) return;
881
- const target = this._getTargetSheet(commandInfo.params);
885
+ const params = commandInfo.params;
886
+ const target = this.getSheetCommandTarget(params);
882
887
  if (!target) return;
883
888
  const { workbook, worksheet } = target;
884
- const { payload } = commandInfo.params;
889
+ const { payload } = params;
885
890
  const threadComment = worksheet.getCommentById(payload.commentId);
886
891
  if (!threadComment) return;
887
892
  const eventParams = {
@@ -895,10 +900,11 @@ var FUniverSheetsThreadCommentMixin = class extends _univerjs_core_facade.FUnive
895
900
  })));
896
901
  this.disposeWithMe(this.registerEventHandler(this.Event.CommentDeleted, () => commandService.onCommandExecuted((commandInfo) => {
897
902
  if (commandInfo.id !== _univerjs_thread_comment.DeleteCommentCommand.id && commandInfo.id !== _univerjs_thread_comment.DeleteCommentTreeCommand.id) return;
898
- const target = this._getTargetSheet(commandInfo.params);
903
+ const params = commandInfo.params;
904
+ const target = this.getSheetCommandTarget(params);
899
905
  if (!target) return;
900
906
  const { workbook, worksheet } = target;
901
- const { commentId } = commandInfo.params;
907
+ const { commentId } = params;
902
908
  const eventParams = {
903
909
  workbook,
904
910
  worksheet,
@@ -909,10 +915,11 @@ var FUniverSheetsThreadCommentMixin = class extends _univerjs_core_facade.FUnive
909
915
  this.disposeWithMe(this.registerEventHandler(this.Event.CommentResolved, () => commandService.onCommandExecuted((commandInfo) => {
910
916
  var _threadComment$getRan9, _threadComment$getRan10, _threadComment$getRan11, _threadComment$getRan12;
911
917
  if (commandInfo.id !== _univerjs_thread_comment.ResolveCommentCommand.id) return;
912
- const target = this._getTargetSheet(commandInfo.params);
918
+ const params = commandInfo.params;
919
+ const target = this.getSheetCommandTarget(params);
913
920
  if (!target) return;
914
921
  const { workbook, worksheet } = target;
915
- const { commentId, resolved } = commandInfo.params;
922
+ const { commentId, resolved } = params;
916
923
  const threadComment = worksheet.getCommentById(commentId);
917
924
  if (!threadComment) return;
918
925
  const eventParams = {
@@ -927,10 +934,11 @@ var FUniverSheetsThreadCommentMixin = class extends _univerjs_core_facade.FUnive
927
934
  })));
928
935
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentAdd, () => commandService.beforeCommandExecuted((commandInfo) => {
929
936
  if (commandInfo.id !== _univerjs_thread_comment.AddCommentCommand.id) return;
930
- const target = this._getTargetSheet(commandInfo.params);
937
+ const params = commandInfo.params;
938
+ const target = this.getSheetCommandTarget(params);
931
939
  if (!target) return;
932
940
  const { workbook, worksheet } = target;
933
- const { comment } = commandInfo.params;
941
+ const { comment } = params;
934
942
  const { range } = (0, _univerjs_engine_formula.deserializeRangeWithSheet)(comment.ref);
935
943
  const eventParams = {
936
944
  workbook,
@@ -945,10 +953,11 @@ var FUniverSheetsThreadCommentMixin = class extends _univerjs_core_facade.FUnive
945
953
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentUpdate, () => commandService.beforeCommandExecuted((commandInfo) => {
946
954
  var _threadComment$getRan13, _threadComment$getRan14, _threadComment$getRan15, _threadComment$getRan16;
947
955
  if (commandInfo.id !== _univerjs_thread_comment.UpdateCommentCommand.id) return;
948
- const target = this._getTargetSheet(commandInfo.params);
956
+ const params = commandInfo.params;
957
+ const target = this.getSheetCommandTarget(params);
949
958
  if (!target) return;
950
959
  const { workbook, worksheet } = target;
951
- const { payload } = commandInfo.params;
960
+ const { payload } = params;
952
961
  const threadComment = worksheet.getCommentById(payload.commentId);
953
962
  if (!threadComment) return;
954
963
  const eventParams = {
@@ -965,10 +974,11 @@ var FUniverSheetsThreadCommentMixin = class extends _univerjs_core_facade.FUnive
965
974
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentDelete, () => commandService.beforeCommandExecuted((commandInfo) => {
966
975
  var _threadComment$getRan17, _threadComment$getRan18, _threadComment$getRan19, _threadComment$getRan20;
967
976
  if (commandInfo.id !== _univerjs_thread_comment.DeleteCommentCommand.id && commandInfo.id !== _univerjs_thread_comment.DeleteCommentTreeCommand.id) return;
968
- const target = this._getTargetSheet(commandInfo.params);
977
+ const params = commandInfo.params;
978
+ const target = this.getSheetCommandTarget(params);
969
979
  if (!target) return;
970
980
  const { workbook, worksheet } = target;
971
- const { commentId } = commandInfo.params;
981
+ const { commentId } = params;
972
982
  const threadComment = worksheet.getCommentById(commentId);
973
983
  if (!threadComment) return;
974
984
  const eventParams = {
@@ -984,10 +994,11 @@ var FUniverSheetsThreadCommentMixin = class extends _univerjs_core_facade.FUnive
984
994
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentResolve, () => commandService.beforeCommandExecuted((commandInfo) => {
985
995
  var _getRow, _getColumn;
986
996
  if (commandInfo.id !== _univerjs_thread_comment.ResolveCommentCommand.id) return;
987
- const target = this._getTargetSheet(commandInfo.params);
997
+ const params = commandInfo.params;
998
+ const target = this.getSheetCommandTarget(params);
988
999
  if (!target) return;
989
1000
  const { workbook, worksheet } = target;
990
- const { commentId, resolved } = commandInfo.params;
1001
+ const { commentId, resolved } = params;
991
1002
  const threadComment = worksheet.getCommentById(commentId);
992
1003
  if (!threadComment) return;
993
1004
  const eventParams = {
package/lib/cjs/index.js CHANGED
@@ -5,7 +5,7 @@ let _univerjs_sheets = require("@univerjs/sheets");
5
5
  let _univerjs_thread_comment = require("@univerjs/thread-comment");
6
6
  let rxjs = require("rxjs");
7
7
 
8
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
8
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
9
9
  function _typeof(o) {
10
10
  "@babel/helpers - typeof";
11
11
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -16,7 +16,7 @@ function _typeof(o) {
16
16
  }
17
17
 
18
18
  //#endregion
19
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
19
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
20
20
  function toPrimitive(t, r) {
21
21
  if ("object" != _typeof(t) || !t) return t;
22
22
  var e = t[Symbol.toPrimitive];
@@ -29,14 +29,14 @@ function toPrimitive(t, r) {
29
29
  }
30
30
 
31
31
  //#endregion
32
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
32
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
33
33
  function toPropertyKey(t) {
34
34
  var i = toPrimitive(t, "string");
35
35
  return "symbol" == _typeof(i) ? i : i + "";
36
36
  }
37
37
 
38
38
  //#endregion
39
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
39
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
40
40
  function _defineProperty(e, r, t) {
41
41
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
42
42
  value: t,
@@ -47,7 +47,7 @@ function _defineProperty(e, r, t) {
47
47
  }
48
48
 
49
49
  //#endregion
50
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
50
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
51
51
  function __decorateParam(paramIndex, decorator) {
52
52
  return function(target, key) {
53
53
  decorator(target, key, paramIndex);
@@ -55,7 +55,7 @@ function __decorateParam(paramIndex, decorator) {
55
55
  }
56
56
 
57
57
  //#endregion
58
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
58
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
59
59
  function __decorate(decorators, target, key, desc) {
60
60
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
61
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -450,7 +450,7 @@ SheetsThreadCommentRefRangeController = __decorate([
450
450
  //#endregion
451
451
  //#region package.json
452
452
  var name = "@univerjs/sheets-thread-comment";
453
- var version = "0.24.0";
453
+ var version = "0.25.0-insiders.20260604-29ebbff";
454
454
 
455
455
  //#endregion
456
456
  //#region src/config/config.ts