@univerjs/sheets-thread-comment 0.23.0 → 0.24.0-insiders.20260528-29f582d

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
@@ -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');
package/lib/cjs/index.js CHANGED
@@ -236,7 +236,12 @@ let SheetsThreadCommentModel = class SheetsThreadCommentModel extends _univerjs_
236
236
  getAllByLocation(unitId, subUnitId, row, column) {
237
237
  const current = this._ensureCommentMatrix(unitId, subUnitId).getValue(row, column);
238
238
  if (!current) return [];
239
- return Array.from(current).map((id) => this.getComment(unitId, subUnitId, id)).filter(Boolean);
239
+ const comments = [];
240
+ for (const id of current) {
241
+ const comment = this.getComment(unitId, subUnitId, id);
242
+ if (comment) comments.push(comment);
243
+ }
244
+ return comments;
240
245
  }
241
246
  getComment(unitId, subUnitId, commentId) {
242
247
  return this._threadCommentModel.getComment(unitId, subUnitId, commentId);
@@ -445,7 +450,7 @@ SheetsThreadCommentRefRangeController = __decorate([
445
450
  //#endregion
446
451
  //#region package.json
447
452
  var name = "@univerjs/sheets-thread-comment";
448
- var version = "0.23.0";
453
+ var version = "0.24.0-insiders.20260528-29f582d";
449
454
 
450
455
  //#endregion
451
456
  //#region src/config/config.ts
package/lib/es/facade.js CHANGED
@@ -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');
package/lib/es/index.js CHANGED
@@ -235,7 +235,12 @@ let SheetsThreadCommentModel = class SheetsThreadCommentModel extends Disposable
235
235
  getAllByLocation(unitId, subUnitId, row, column) {
236
236
  const current = this._ensureCommentMatrix(unitId, subUnitId).getValue(row, column);
237
237
  if (!current) return [];
238
- return Array.from(current).map((id) => this.getComment(unitId, subUnitId, id)).filter(Boolean);
238
+ const comments = [];
239
+ for (const id of current) {
240
+ const comment = this.getComment(unitId, subUnitId, id);
241
+ if (comment) comments.push(comment);
242
+ }
243
+ return comments;
239
244
  }
240
245
  getComment(unitId, subUnitId, commentId) {
241
246
  return this._threadCommentModel.getComment(unitId, subUnitId, commentId);
@@ -444,7 +449,7 @@ SheetsThreadCommentRefRangeController = __decorate([
444
449
  //#endregion
445
450
  //#region package.json
446
451
  var name = "@univerjs/sheets-thread-comment";
447
- var version = "0.23.0";
452
+ var version = "0.24.0-insiders.20260528-29f582d";
448
453
 
449
454
  //#endregion
450
455
  //#region src/config/config.ts
package/lib/facade.js CHANGED
@@ -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');
package/lib/index.js CHANGED
@@ -235,7 +235,12 @@ let SheetsThreadCommentModel = class SheetsThreadCommentModel extends Disposable
235
235
  getAllByLocation(unitId, subUnitId, row, column) {
236
236
  const current = this._ensureCommentMatrix(unitId, subUnitId).getValue(row, column);
237
237
  if (!current) return [];
238
- return Array.from(current).map((id) => this.getComment(unitId, subUnitId, id)).filter(Boolean);
238
+ const comments = [];
239
+ for (const id of current) {
240
+ const comment = this.getComment(unitId, subUnitId, id);
241
+ if (comment) comments.push(comment);
242
+ }
243
+ return comments;
239
244
  }
240
245
  getComment(unitId, subUnitId, commentId) {
241
246
  return this._threadCommentModel.getComment(unitId, subUnitId, commentId);
@@ -444,7 +449,7 @@ SheetsThreadCommentRefRangeController = __decorate([
444
449
  //#endregion
445
450
  //#region package.json
446
451
  var name = "@univerjs/sheets-thread-comment";
447
- var version = "0.23.0";
452
+ var version = "0.24.0-insiders.20260528-29f582d";
448
453
 
449
454
  //#endregion
450
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 range = univerAPI.getActiveWorkbook()
29
- * .getActiveSheet()
30
- * .getActiveRange();
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 range = univerAPI.getActiveWorkbook()
41
- * .getActiveSheet()
42
- * .getActiveRange();
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.getActiveSheet();
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 range = univerAPI.getActiveWorkbook()
94
- * .getActiveSheet()
95
- * .getActiveRange();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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);
@@ -27,7 +27,8 @@ export interface IFWorksheetCommentMixin {
27
27
  * @example
28
28
  * ```ts
29
29
  * const fWorkbook = univerAPI.getActiveWorkbook();
30
- * const fWorksheet = fWorkbook.getActiveSheet();
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.getActiveSheet();
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.getActiveSheet();
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');
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/engine-formula`),require(`@univerjs/sheets`),require(`@univerjs/thread-comment`),require(`rxjs`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/engine-formula`,`@univerjs/sheets`,`@univerjs/thread-comment`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsThreadComment={},e.UniverCore,e.UniverEngineFormula,e.UniverSheets,e.UniverThreadComment,e.rxjs))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function o(e){"@babel/helpers - typeof";return o=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},o(e)}function s(e,t){if(o(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(o(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function c(e){var t=s(e,`string`);return o(t)==`symbol`?t:t+``}function l(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){return function(n,r){t(n,r,e)}}function d(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let f=class extends t.Disposable{constructor(e,t){super(),this._threadCommentModel=e,this._univerInstanceService=t,l(this,`_matrixMap`,new Map),l(this,`_locationMap`,new Map),l(this,`_commentUpdate$`,new a.Subject),l(this,`commentUpdate$`,this._commentUpdate$.asObservable()),this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let r=this._matrixMap.get(e);r||(r=new Map,this._matrixMap.set(e,r));let i=r.get(n);return i||(i=new t.ObjectMatrix,r.set(n,i)),i}_ensureCommentLocationMap(e,t){let n=this._locationMap.get(e);n||(n=new Map,this._locationMap.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_addCommentToMatrix(e,t,n,r){var i;let a=(i=e.getValue(t,n))==null?new Set:i;a.add(r),e.setValue(t,n,a)}_deleteCommentFromMatrix(e,t,n,r){if(t>=0&&n>=0){let i=e.getValue(t,n);i&&i.has(r)&&(i.delete(r),i.size===0&&e.realDeleteValue(t,n))}}_ensure(e,t){return{matrix:this._ensureCommentMatrix(e,t),locationMap:this._ensureCommentLocationMap(e,t)}}_initData(){let e=this._threadCommentModel.getAll();for(let t of e)for(let e of t.threads){let{unitId:t,subUnitId:n,root:r}=e;this._addComment(t,n,r)}}_addComment(e,t,r){let i=(0,n.singleReferenceToGrid)(r.ref),a=r.parentId,{row:o,column:s}=i,c=r.id,{matrix:l,locationMap:u}=this._ensure(e,t);!a&&o>=0&&s>=0&&(this._addCommentToMatrix(l,o,s,c),u.set(c,{row:o,column:s})),a||this._commentUpdate$.next({unitId:e,subUnitId:t,payload:r,type:`add`,isRoot:!a,...i})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{let{unitId:r,subUnitId:i}=e;try{if(this._univerInstanceService.getUnitType(r)!==t.UniverInstanceType.UNIVER_SHEET)return}catch{}let{matrix:a,locationMap:o}=this._ensure(r,i);switch(e.type){case`add`:this._addComment(e.unitId,e.subUnitId,e.payload);break;case`delete`:{let{isRoot:t,comment:r}=e.payload;if(t){let t=(0,n.singleReferenceToGrid)(r.ref),{row:i,column:o}=t;this._deleteCommentFromMatrix(a,i,o,r.id),this._commentUpdate$.next({...e,...t})}break}case`update`:{let{commentId:t}=e.payload,a=this._threadCommentModel.getComment(r,i,t);if(!a)return;let o=(0,n.singleReferenceToGrid)(a.ref);this._commentUpdate$.next({...e,...o});break}case`updateRef`:{let t=(0,n.singleReferenceToGrid)(e.payload.ref),{commentId:r}=e.payload,i=o.get(r);if(!i)return;let{row:s,column:c}=i;this._deleteCommentFromMatrix(a,s,c,r),o.delete(r),t.row>=0&&t.column>=0&&(this._addCommentToMatrix(a,t.row,t.column,r),o.set(r,{row:t.row,column:t.column})),this._commentUpdate$.next({...e,...t});break}case`resolve`:{let{unitId:t,subUnitId:n,payload:r}=e,{locationMap:i}=this._ensure(t,n),a=i.get(r.commentId);a&&this._commentUpdate$.next({...e,...a});break}default:break}}))}getByLocation(e,t,n,r){var i;return(i=this.getAllByLocation(e,t,n,r).filter(e=>!e.resolved)[0])==null?void 0:i.id}getAllByLocation(e,t,n,r){let i=this._ensureCommentMatrix(e,t).getValue(n,r);return i?Array.from(i).map(n=>this.getComment(e,t,n)).filter(Boolean):[]}getComment(e,t,n){return this._threadCommentModel.getComment(e,t,n)}getCommentWithChildren(e,t,n,r){let i=this.getByLocation(e,t,n,r);if(!i)return;let a=this.getComment(e,t,i);if(a)return this._threadCommentModel.getThread(e,t,a.threadId)}showCommentMarker(e,t,n,r){let i=this.getByLocation(e,t,n,r);if(!i)return!1;let a=this.getComment(e,t,i);return!!(a&&!a.resolved)}getSubUnitAll(e,t){return this._threadCommentModel.getUnit(e).filter(e=>e.subUnitId===t).map(e=>e.root)}};f=d([u(0,(0,t.Inject)(i.ThreadCommentModel)),u(1,t.IUniverInstanceService)],f);let p=class extends t.Disposable{constructor(e,t,r,a,o){super(),this._refRangeService=e,this._sheetsThreadCommentModel=t,this._threadCommentModel=r,this._selectionManagerService=a,this._commandService=o,l(this,`_disposableMap`,new Map),l(this,`_watcherMap`,new Map),l(this,`_handleRangeChange`,(e,t,r,a,o)=>{let s=r.id,c={startColumn:r.column,endColumn:r.column,startRow:r.row,endRow:r.row};return a?{redos:[{id:i.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:t,payload:{ref:(0,n.serializeRange)(a),commentId:s},silent:o}}],undos:[{id:i.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:t,payload:{ref:(0,n.serializeRange)(c),commentId:s},silent:o}}]}:{redos:[{id:i.DeleteCommentMutation.id,params:{unitId:e,subUnitId:t,commentId:s}}],undos:[{id:i.AddCommentMutation.id,params:{unitId:e,subUnitId:t,comment:r,sync:!0}}]}}),this._initData(),this._initRefRange()}_getIdWithUnitId(e,t,n){return`${e}-${t}-${n}`}_register(e,t,n){let i=n.id,a={startColumn:n.column,endColumn:n.column,startRow:n.row,endRow:n.row};this._disposableMap.set(this._getIdWithUnitId(e,t,i),this._refRangeService.registerRefRange(a,i=>{let o=(0,r.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests)(a,i,{selectionManagerService:this._selectionManagerService}),s=Array.isArray(o)?o[0]:o;return s&&s.startColumn===a.startColumn&&s.startRow===a.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,t,n,s,!1)},e,t))}_watch(e,n,r){let i=r.id,a={startColumn:r.column,endColumn:r.column,startRow:r.row,endRow:r.row};this._watcherMap.set(this._getIdWithUnitId(e,n,i),this._refRangeService.watchRange(e,n,a,(i,a)=>{let{redos:o}=this._handleRangeChange(e,n,r,a,!0);(0,t.sequenceExecuteAsync)(o,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,t,n){var r;let i=this._getIdWithUnitId(e,t,n);(r=this._watcherMap.get(i))==null||r.dispose(),this._watcherMap.delete(i)}_unregister(e,t,n){var r;let i=this._getIdWithUnitId(e,t,n);(r=this._disposableMap.get(i))==null||r.dispose(),this._disposableMap.delete(i)}_initData(){let e=this._threadCommentModel.getAll();for(let t of e)for(let e of t.threads){let{unitId:t,subUnitId:r,root:i}=e,a=(0,n.singleReferenceToGrid)(i.ref),o={...i,...a};this._register(t,r,o),this._watch(t,r,o)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{let{unitId:t,subUnitId:n}=e;switch(e.type){case`add`:{if(e.payload.parentId)return;let t={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,t),this._watch(e.unitId,e.subUnitId,t);break}case`delete`:this._unregister(t,n,e.payload.commentId),this._unwatch(t,n,e.payload.commentId);break;case`updateRef`:{let r=this._sheetsThreadCommentModel.getComment(t,n,e.payload.commentId);if(!r)return;this._unregister(t,n,e.payload.commentId);let i={...r,row:e.row,column:e.column};e.silent||(this._unwatch(t,n,e.payload.commentId),this._watch(t,n,i)),this._register(e.unitId,e.subUnitId,i);break}}})),this.disposeWithMe((0,t.toDisposable)(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}};p=d([u(0,(0,t.Inject)(r.RefRangeService)),u(1,(0,t.Inject)(f)),u(2,(0,t.Inject)(i.ThreadCommentModel)),u(3,(0,t.Inject)(r.SheetsSelectionsService)),u(4,t.ICommandService)],p);var m=`@univerjs/sheets-thread-comment`,h=`0.23.0`;let g={},_=class extends t.Disposable{constructor(e,t,n,r){super(),this._univerInstanceService=e,this._sheetInterceptorService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=r,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===r.RemoveSheetCommand.id){var n;let r=e.params,a=r.unitId||this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),o=r.subUnitId||((n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId());if(!a||!o)return{redos:[],undos:[]};let s=this._threadCommentModel.ensureMap(a,o),c=Array.from(s.values()).filter(e=>!e.parentId),l=this._threadCommentDataSourceService.syncUpdateMutationToColla,u=[],d=[];return c.forEach(({children:e,...t})=>{u.push({id:i.DeleteCommentMutation.id,params:{unitId:a,subUnitId:o,commentId:t.id}}),d.push({id:i.AddCommentMutation.id,params:{unitId:a,subUnitId:o,comment:{...t,children:l?e:void 0},sync:!l}})}),{redos:u,undos:d}}else if(e.id===r.CopySheetCommand.id){let{unitId:n,subUnitId:r,targetSubUnitId:a}=e.params;if(!n||!r||!a)return{redos:[],undos:[]};let o=this._threadCommentModel.ensureMap(n,r),s=Array.from(o.values()).map(e=>({...e,subUnitId:a,id:(0,t.generateRandomId)(),threadId:(0,t.generateRandomId)()})).filter(e=>!e.parentId),c=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=[],u=[];return s.forEach(({children:e,...t})=>{l.push({id:i.AddCommentMutation.id,params:{unitId:n,subUnitId:a,comment:{...t,children:c?e:void 0},sync:!c}}),u.push({id:i.DeleteCommentMutation.id,params:{unitId:n,subUnitId:a,commentId:t.id}})}),{redos:l,undos:u}}return{redos:[],undos:[]}}}))}};_=d([u(0,t.IUniverInstanceService),u(1,(0,t.Inject)(r.SheetInterceptorService)),u(2,(0,t.Inject)(i.ThreadCommentModel)),u(3,i.IThreadCommentDataSourceService)],_);let v=class extends t.Plugin{constructor(e=g,t,n){super(),this._config=e,this._injector=t,this._commandService=n}onStarting(){[[f],[p],[_]].forEach(e=>{this._injector.add(e)}),(0,t.touchDependencies)(this._injector,[[p],[_]])}};l(v,`pluginName`,`SHEET_THREAD_COMMENT_BASE_PLUGIN`),l(v,`packageName`,m),l(v,`version`,h),l(v,`type`,t.UniverInstanceType.UNIVER_SHEET),v=d([(0,t.DependentOn)(i.UniverThreadCommentPlugin),u(1,(0,t.Inject)(t.Injector)),u(2,(0,t.Inject)(t.ICommandService))],v),Object.defineProperty(e,`SheetsThreadCommentModel`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,`SheetsThreadCommentRefRangeController`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,`UniverSheetsThreadCommentPlugin`,{enumerable:!0,get:function(){return v}})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/engine-formula`),require(`@univerjs/sheets`),require(`@univerjs/thread-comment`),require(`rxjs`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/engine-formula`,`@univerjs/sheets`,`@univerjs/thread-comment`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsThreadComment={},e.UniverCore,e.UniverEngineFormula,e.UniverSheets,e.UniverThreadComment,e.rxjs))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function o(e){"@babel/helpers - typeof";return o=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},o(e)}function s(e,t){if(o(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(o(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function c(e){var t=s(e,`string`);return o(t)==`symbol`?t:t+``}function l(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){return function(n,r){t(n,r,e)}}function d(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let f=class extends t.Disposable{constructor(e,t){super(),this._threadCommentModel=e,this._univerInstanceService=t,l(this,`_matrixMap`,new Map),l(this,`_locationMap`,new Map),l(this,`_commentUpdate$`,new a.Subject),l(this,`commentUpdate$`,this._commentUpdate$.asObservable()),this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let r=this._matrixMap.get(e);r||(r=new Map,this._matrixMap.set(e,r));let i=r.get(n);return i||(i=new t.ObjectMatrix,r.set(n,i)),i}_ensureCommentLocationMap(e,t){let n=this._locationMap.get(e);n||(n=new Map,this._locationMap.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_addCommentToMatrix(e,t,n,r){var i;let a=(i=e.getValue(t,n))==null?new Set:i;a.add(r),e.setValue(t,n,a)}_deleteCommentFromMatrix(e,t,n,r){if(t>=0&&n>=0){let i=e.getValue(t,n);i&&i.has(r)&&(i.delete(r),i.size===0&&e.realDeleteValue(t,n))}}_ensure(e,t){return{matrix:this._ensureCommentMatrix(e,t),locationMap:this._ensureCommentLocationMap(e,t)}}_initData(){let e=this._threadCommentModel.getAll();for(let t of e)for(let e of t.threads){let{unitId:t,subUnitId:n,root:r}=e;this._addComment(t,n,r)}}_addComment(e,t,r){let i=(0,n.singleReferenceToGrid)(r.ref),a=r.parentId,{row:o,column:s}=i,c=r.id,{matrix:l,locationMap:u}=this._ensure(e,t);!a&&o>=0&&s>=0&&(this._addCommentToMatrix(l,o,s,c),u.set(c,{row:o,column:s})),a||this._commentUpdate$.next({unitId:e,subUnitId:t,payload:r,type:`add`,isRoot:!a,...i})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{let{unitId:r,subUnitId:i}=e;try{if(this._univerInstanceService.getUnitType(r)!==t.UniverInstanceType.UNIVER_SHEET)return}catch{}let{matrix:a,locationMap:o}=this._ensure(r,i);switch(e.type){case`add`:this._addComment(e.unitId,e.subUnitId,e.payload);break;case`delete`:{let{isRoot:t,comment:r}=e.payload;if(t){let t=(0,n.singleReferenceToGrid)(r.ref),{row:i,column:o}=t;this._deleteCommentFromMatrix(a,i,o,r.id),this._commentUpdate$.next({...e,...t})}break}case`update`:{let{commentId:t}=e.payload,a=this._threadCommentModel.getComment(r,i,t);if(!a)return;let o=(0,n.singleReferenceToGrid)(a.ref);this._commentUpdate$.next({...e,...o});break}case`updateRef`:{let t=(0,n.singleReferenceToGrid)(e.payload.ref),{commentId:r}=e.payload,i=o.get(r);if(!i)return;let{row:s,column:c}=i;this._deleteCommentFromMatrix(a,s,c,r),o.delete(r),t.row>=0&&t.column>=0&&(this._addCommentToMatrix(a,t.row,t.column,r),o.set(r,{row:t.row,column:t.column})),this._commentUpdate$.next({...e,...t});break}case`resolve`:{let{unitId:t,subUnitId:n,payload:r}=e,{locationMap:i}=this._ensure(t,n),a=i.get(r.commentId);a&&this._commentUpdate$.next({...e,...a});break}default:break}}))}getByLocation(e,t,n,r){var i;return(i=this.getAllByLocation(e,t,n,r).filter(e=>!e.resolved)[0])==null?void 0:i.id}getAllByLocation(e,t,n,r){let i=this._ensureCommentMatrix(e,t).getValue(n,r);if(!i)return[];let a=[];for(let n of i){let r=this.getComment(e,t,n);r&&a.push(r)}return a}getComment(e,t,n){return this._threadCommentModel.getComment(e,t,n)}getCommentWithChildren(e,t,n,r){let i=this.getByLocation(e,t,n,r);if(!i)return;let a=this.getComment(e,t,i);if(a)return this._threadCommentModel.getThread(e,t,a.threadId)}showCommentMarker(e,t,n,r){let i=this.getByLocation(e,t,n,r);if(!i)return!1;let a=this.getComment(e,t,i);return!!(a&&!a.resolved)}getSubUnitAll(e,t){return this._threadCommentModel.getUnit(e).filter(e=>e.subUnitId===t).map(e=>e.root)}};f=d([u(0,(0,t.Inject)(i.ThreadCommentModel)),u(1,t.IUniverInstanceService)],f);let p=class extends t.Disposable{constructor(e,t,r,a,o){super(),this._refRangeService=e,this._sheetsThreadCommentModel=t,this._threadCommentModel=r,this._selectionManagerService=a,this._commandService=o,l(this,`_disposableMap`,new Map),l(this,`_watcherMap`,new Map),l(this,`_handleRangeChange`,(e,t,r,a,o)=>{let s=r.id,c={startColumn:r.column,endColumn:r.column,startRow:r.row,endRow:r.row};return a?{redos:[{id:i.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:t,payload:{ref:(0,n.serializeRange)(a),commentId:s},silent:o}}],undos:[{id:i.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:t,payload:{ref:(0,n.serializeRange)(c),commentId:s},silent:o}}]}:{redos:[{id:i.DeleteCommentMutation.id,params:{unitId:e,subUnitId:t,commentId:s}}],undos:[{id:i.AddCommentMutation.id,params:{unitId:e,subUnitId:t,comment:r,sync:!0}}]}}),this._initData(),this._initRefRange()}_getIdWithUnitId(e,t,n){return`${e}-${t}-${n}`}_register(e,t,n){let i=n.id,a={startColumn:n.column,endColumn:n.column,startRow:n.row,endRow:n.row};this._disposableMap.set(this._getIdWithUnitId(e,t,i),this._refRangeService.registerRefRange(a,i=>{let o=(0,r.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests)(a,i,{selectionManagerService:this._selectionManagerService}),s=Array.isArray(o)?o[0]:o;return s&&s.startColumn===a.startColumn&&s.startRow===a.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,t,n,s,!1)},e,t))}_watch(e,n,r){let i=r.id,a={startColumn:r.column,endColumn:r.column,startRow:r.row,endRow:r.row};this._watcherMap.set(this._getIdWithUnitId(e,n,i),this._refRangeService.watchRange(e,n,a,(i,a)=>{let{redos:o}=this._handleRangeChange(e,n,r,a,!0);(0,t.sequenceExecuteAsync)(o,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,t,n){var r;let i=this._getIdWithUnitId(e,t,n);(r=this._watcherMap.get(i))==null||r.dispose(),this._watcherMap.delete(i)}_unregister(e,t,n){var r;let i=this._getIdWithUnitId(e,t,n);(r=this._disposableMap.get(i))==null||r.dispose(),this._disposableMap.delete(i)}_initData(){let e=this._threadCommentModel.getAll();for(let t of e)for(let e of t.threads){let{unitId:t,subUnitId:r,root:i}=e,a=(0,n.singleReferenceToGrid)(i.ref),o={...i,...a};this._register(t,r,o),this._watch(t,r,o)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{let{unitId:t,subUnitId:n}=e;switch(e.type){case`add`:{if(e.payload.parentId)return;let t={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,t),this._watch(e.unitId,e.subUnitId,t);break}case`delete`:this._unregister(t,n,e.payload.commentId),this._unwatch(t,n,e.payload.commentId);break;case`updateRef`:{let r=this._sheetsThreadCommentModel.getComment(t,n,e.payload.commentId);if(!r)return;this._unregister(t,n,e.payload.commentId);let i={...r,row:e.row,column:e.column};e.silent||(this._unwatch(t,n,e.payload.commentId),this._watch(t,n,i)),this._register(e.unitId,e.subUnitId,i);break}}})),this.disposeWithMe((0,t.toDisposable)(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}};p=d([u(0,(0,t.Inject)(r.RefRangeService)),u(1,(0,t.Inject)(f)),u(2,(0,t.Inject)(i.ThreadCommentModel)),u(3,(0,t.Inject)(r.SheetsSelectionsService)),u(4,t.ICommandService)],p);var m=`@univerjs/sheets-thread-comment`,h=`0.24.0-insiders.20260528-29f582d`;let g={},_=class extends t.Disposable{constructor(e,t,n,r){super(),this._univerInstanceService=e,this._sheetInterceptorService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=r,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===r.RemoveSheetCommand.id){var n;let r=e.params,a=r.unitId||this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),o=r.subUnitId||((n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId());if(!a||!o)return{redos:[],undos:[]};let s=this._threadCommentModel.ensureMap(a,o),c=Array.from(s.values()).filter(e=>!e.parentId),l=this._threadCommentDataSourceService.syncUpdateMutationToColla,u=[],d=[];return c.forEach(({children:e,...t})=>{u.push({id:i.DeleteCommentMutation.id,params:{unitId:a,subUnitId:o,commentId:t.id}}),d.push({id:i.AddCommentMutation.id,params:{unitId:a,subUnitId:o,comment:{...t,children:l?e:void 0},sync:!l}})}),{redos:u,undos:d}}else if(e.id===r.CopySheetCommand.id){let{unitId:n,subUnitId:r,targetSubUnitId:a}=e.params;if(!n||!r||!a)return{redos:[],undos:[]};let o=this._threadCommentModel.ensureMap(n,r),s=Array.from(o.values()).map(e=>({...e,subUnitId:a,id:(0,t.generateRandomId)(),threadId:(0,t.generateRandomId)()})).filter(e=>!e.parentId),c=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=[],u=[];return s.forEach(({children:e,...t})=>{l.push({id:i.AddCommentMutation.id,params:{unitId:n,subUnitId:a,comment:{...t,children:c?e:void 0},sync:!c}}),u.push({id:i.DeleteCommentMutation.id,params:{unitId:n,subUnitId:a,commentId:t.id}})}),{redos:l,undos:u}}return{redos:[],undos:[]}}}))}};_=d([u(0,t.IUniverInstanceService),u(1,(0,t.Inject)(r.SheetInterceptorService)),u(2,(0,t.Inject)(i.ThreadCommentModel)),u(3,i.IThreadCommentDataSourceService)],_);let v=class extends t.Plugin{constructor(e=g,t,n){super(),this._config=e,this._injector=t,this._commandService=n}onStarting(){[[f],[p],[_]].forEach(e=>{this._injector.add(e)}),(0,t.touchDependencies)(this._injector,[[p],[_]])}};l(v,`pluginName`,`SHEET_THREAD_COMMENT_BASE_PLUGIN`),l(v,`packageName`,m),l(v,`version`,h),l(v,`type`,t.UniverInstanceType.UNIVER_SHEET),v=d([(0,t.DependentOn)(i.UniverThreadCommentPlugin),u(1,(0,t.Inject)(t.Injector)),u(2,(0,t.Inject)(t.ICommandService))],v),Object.defineProperty(e,`SheetsThreadCommentModel`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,`SheetsThreadCommentRefRangeController`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,`UniverSheetsThreadCommentPlugin`,{enumerable:!0,get:function(){return v}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-thread-comment",
3
- "version": "0.23.0",
3
+ "version": "0.24.0-insiders.20260528-29f582d",
4
4
  "private": false,
5
5
  "description": "Thread comment integration for Univer Sheets.",
6
6
  "author": "DreamNum Co., Ltd. <developer@univer.ai>",
@@ -62,16 +62,16 @@
62
62
  "rxjs": ">=7.0.0"
63
63
  },
64
64
  "dependencies": {
65
- "@univerjs/core": "0.23.0",
66
- "@univerjs/engine-formula": "0.23.0",
67
- "@univerjs/thread-comment": "0.23.0",
68
- "@univerjs/sheets": "0.23.0"
65
+ "@univerjs/core": "0.24.0-insiders.20260528-29f582d",
66
+ "@univerjs/engine-formula": "0.24.0-insiders.20260528-29f582d",
67
+ "@univerjs/sheets": "0.24.0-insiders.20260528-29f582d",
68
+ "@univerjs/thread-comment": "0.24.0-insiders.20260528-29f582d"
69
69
  },
70
70
  "devDependencies": {
71
71
  "rxjs": "^7.8.2",
72
72
  "typescript": "^6.0.3",
73
73
  "vitest": "^4.1.5",
74
- "@univerjs-infra/shared": "0.23.0"
74
+ "@univerjs-infra/shared": "0.24.0"
75
75
  },
76
76
  "scripts": {
77
77
  "test": "vitest run",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS