@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/es/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.129.0/helpers/typeof.js
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.129.0/helpers/toPrimitive.js
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.129.0/helpers/toPropertyKey.js
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.129.0/helpers/defineProperty.js
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.129.0/helpers/decorateParam.js
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.129.0/helpers/decorate.js
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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 target = this._getTargetSheet(commandInfo.params);
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 } = commandInfo.params;
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 target = this._getTargetSheet(commandInfo.params);
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 } = commandInfo.params;
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 target = this._getTargetSheet(commandInfo.params);
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 } = commandInfo.params;
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 target = this._getTargetSheet(commandInfo.params);
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 } = commandInfo.params;
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 target = this._getTargetSheet(commandInfo.params);
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 } = commandInfo.params;
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 target = this._getTargetSheet(commandInfo.params);
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 } = commandInfo.params;
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 target = this._getTargetSheet(commandInfo.params);
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 } = commandInfo.params;
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 target = this._getTargetSheet(commandInfo.params);
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 } = commandInfo.params;
1000
+ const { commentId, resolved } = params;
990
1001
  const threadComment = worksheet.getCommentById(commentId);
991
1002
  if (!threadComment) return;
992
1003
  const eventParams = {
package/lib/es/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.129.0/helpers/typeof.js
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.129.0/helpers/toPrimitive.js
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.129.0/helpers/toPropertyKey.js
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.129.0/helpers/defineProperty.js
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.129.0/helpers/decorateParam.js
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.129.0/helpers/decorate.js
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.24.0";
452
+ var version = "0.25.0-insiders.20260608-e4336f7";
453
453
 
454
454
  //#endregion
455
455
  //#region src/config/config.ts