@univerjs/sheets-thread-comment 0.5.4 → 0.5.5-nightly.202501201336
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 +1 -1
- package/lib/es/facade.js +27 -14
- package/lib/types/facade/f-range.d.ts +53 -4
- package/lib/types/facade/f-univer.d.ts +1 -1
- package/lib/types/facade/f-workbook.d.ts +15 -0
- package/lib/umd/facade.js +1 -1
- package/package.json +6 -6
- package/LICENSE +0 -176
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var b=Object.defineProperty;var U=(d,e,t)=>e in d?b(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var T=(d,e,t)=>U(d,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@univerjs/core"),C=require("@univerjs/sheets-thread-comment"),h=require("@univerjs/sheets/facade"),m=require("@univerjs/thread-comment"),v=require("@univerjs/engine-formula"),S=require("rxjs");var x=Object.defineProperty,
|
|
1
|
+
"use strict";var b=Object.defineProperty;var U=(d,e,t)=>e in d?b(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var T=(d,e,t)=>U(d,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@univerjs/core"),C=require("@univerjs/sheets-thread-comment"),h=require("@univerjs/sheets/facade"),m=require("@univerjs/thread-comment"),v=require("@univerjs/engine-formula"),S=require("rxjs");var x=Object.defineProperty,y=Object.getOwnPropertyDescriptor,k=(d,e,t,n)=>{for(var o=n>1?void 0:n?y(e,t):e,i=d.length-1,s;i>=0;i--)(s=d[i])&&(o=(n?s(e,t,o):s(o))||o);return n&&o&&x(e,t,o),o},u=(d,e)=>(t,n)=>e(t,n,d);class p{constructor(e){T(this,"_comment",{id:r.generateRandomId(),ref:"",threadId:"",dT:"",personId:"",text:r.RichTextBuilder.newEmptyData().body,attachments:[],unitId:"",subUnitId:""});e&&(this._comment=e)}static create(e){return new p(e)}get personId(){return this._comment.personId}get dateTime(){return this._comment.dT}get content(){return r.RichTextValue.createByBody(this._comment.text)}get id(){return this._comment.id}get threadId(){return this._comment.threadId}copy(){return g.create(r.Tools.deepClone(this._comment))}}class g extends p{static create(e){return new g(e)}setContent(e){return e instanceof r.RichTextValue?this._comment.text=e.getData().body:this._comment.text=e,this}setPersonId(e){return this._comment.personId=e,this}setDateTime(e){return this._comment.dT=m.getDT(e),this}setId(e){return this._comment.id=e,this}setThreadId(e){return this._comment.threadId=e,this}build(){return this._comment}}exports.FThreadComment=class{constructor(e,t,n,o,i,s,c){this._thread=e,this._parent=t,this._injector=n,this._commandService=o,this._univerInstanceService=i,this._threadCommentModel=s,this._userManagerService=c}_getRef(){var n;const e=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return v.deserializeRangeWithSheet(e).range}getIsRoot(){return!this._parent}getCommentData(){const{children:e,...t}=this._thread;return t}getReplies(){var n;const e=this._getRef(),t=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,e.startRow,e.startColumn);return(n=t==null?void 0:t.children)==null?void 0:n.map(o=>this._injector.createInstance(exports.FThreadComment,o))}getRange(){const e=this._univerInstanceService.getUnit(this._thread.unitId,r.UniverInstanceType.UNIVER_SHEET);if(!e)return null;const t=e.getSheetBySheetId(this._thread.subUnitId);if(!t)return null;const n=this._getRef();return this._injector.createInstance(h.FRange,e,t,n)}getContent(){return this._thread.text}getRichText(){const e=this._thread.text;return r.RichTextValue.create({body:e,documentStyle:{},id:"d"})}deleteAsync(){return this._commandService.executeCommand(this.getIsRoot()?m.DeleteCommentTreeCommand.id:m.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}delete(){return this.deleteAsync()}async update(e){return this.updateAsync(e)}async updateAsync(e){const t=e instanceof r.RichTextValue?e.getData().body:e,n=m.getDT();return await this._commandService.executeCommand(m.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:n}})}resolve(e){return this.resolveAsync(e)}resolveAsync(e){return this._commandService.executeCommand(m.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:e!=null?e:!this._thread.resolved})}async replyAsync(e){var n;const t=e.build();return this._commandService.executeCommand(m.AddCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,comment:{id:r.generateRandomId(),parentId:this._thread.id,threadId:this._thread.threadId,ref:(n=this._parent)==null?void 0:n.ref,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,text:t.text,attachments:t.attachments,dT:t.dT||m.getDT(),personId:t.personId||this._userManagerService.getCurrentUser().userID}})}};exports.FThreadComment=k([u(2,r.Inject(r.Injector)),u(3,r.ICommandService),u(4,r.IUniverInstanceService),u(5,r.Inject(C.SheetsThreadCommentModel)),u(6,r.Inject(r.UserManagerService))],exports.FThreadComment);class D extends h.FRange{getComment(){const t=this._injector.get(C.SheetsThreadCommentModel),n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),i=t.getByLocation(n,o,this._range.startRow,this._range.startColumn);if(!i)return null;const s=t.getComment(n,o,i);return s?this._injector.createInstance(exports.FThreadComment,s):null}getComments(){const t=this._injector.get(C.SheetsThreadCommentModel),n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),i=[];return r.Range.foreach(this._range,(s,c)=>{const l=t.getByLocation(n,o,s,c);if(l){const I=t.getComment(n,o,l);I&&i.push(this._injector.createInstance(exports.FThreadComment,I))}}),i}addComment(e){var f;const t=this._injector,n=(f=this.getComment())==null?void 0:f.getCommentData(),o=t.get(r.ICommandService),i=t.get(r.UserManagerService),s=this._workbook.getUnitId(),c=this._worksheet.getSheetId(),l=`${r.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,I=i.getCurrentUser(),_=e instanceof g?e.build():{text:e};return o.executeCommand(m.AddCommentCommand.id,{unitId:s,subUnitId:c,comment:{text:_.text,dT:_.dT||m.getDT(),attachments:[],id:_.id||r.generateRandomId(),ref:l,personId:_.personId||I.userID,parentId:n==null?void 0:n.id,unitId:s,subUnitId:c,threadId:(n==null?void 0:n.threadId)||r.generateRandomId()}})}clearComment(){var s;const e=this._injector,t=(s=this.getComment())==null?void 0:s.getCommentData(),n=e.get(r.ICommandService),o=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return t?n.executeCommand(m.DeleteCommentTreeCommand.id,{unitId:o,subUnitId:i,threadId:t.threadId,commentId:t.id}):Promise.resolve(!0)}clearComments(){const t=this.getComments().map(n=>n.deleteAsync());return Promise.all(t).then(()=>!0)}addCommentAsync(e){return this.addComment(e)}clearCommentAsync(){return this.clearComment()}clearCommentsAsync(){return this.clearComments()}}h.FRange.extend(D);class R extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(m.ThreadCommentModel)}})}getComments(){return this._threadCommentModel.getUnit(this._workbook.getUnitId()).map(e=>this._injector.createInstance(exports.FThreadComment,e.root))}clearComments(){const t=this.getComments().map(n=>n.deleteAsync());return Promise.all(t).then(()=>!0)}onThreadCommentChange(e){return r.toDisposable(this._threadCommentModel.commentUpdate$.pipe(S.filter(t=>t.unitId===this._workbook.getUnitId())).subscribe(e))}onBeforeAddThreadComment(e){return r.toDisposable(this._commandService.beforeCommandExecuted((t,n)=>{const o=t.params;if(t.id===m.AddCommentCommand.id){if(o.unitId!==this._workbook.getUnitId())return;if(e(o,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(e){return r.toDisposable(this._commandService.beforeCommandExecuted((t,n)=>{const o=t.params;if(t.id===m.UpdateCommentCommand.id){if(o.unitId!==this._workbook.getUnitId())return;if(e(o,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(e){return r.toDisposable(this._commandService.beforeCommandExecuted((t,n)=>{const o=t.params;if(t.id===m.DeleteCommentCommand.id||t.id===m.DeleteCommentTreeCommand.id){if(o.unitId!==this._workbook.getUnitId())return;if(e(o,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}h.FWorkbook.extend(R);class w extends h.FWorksheet{getComments(){return this._injector.get(C.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(exports.FThreadComment,n))}clearComments(){const t=this.getComments().map(n=>n.deleteAsync());return Promise.all(t).then(()=>!0)}onCommented(e){return this._injector.get(r.ICommandService).onCommandExecuted(n=>{if(n.id===m.AddCommentCommand.id){const o=n.params;e(o)}})}getCommentById(e){const n=this._injector.get(C.SheetsThreadCommentModel).getComment(this._workbook.getUnitId(),this._worksheet.getSheetId(),e);if(n)return this._injector.createInstance(exports.FThreadComment,n)}}h.FWorksheet.extend(w);const a={CommentAdded:"CommentAdded",BeforeCommentAdd:"BeforeCommentAdd",CommentUpdated:"CommentUpdated",BeforeCommentUpdate:"BeforeCommentUpdate",CommentDeleted:"CommentDeleted",BeforeCommentDeleted:"BeforeCommentDeleted",CommentResolved:"CommentResolved",BeforeCommentResolve:"BeforeCommentResolve"};class j extends r.FEventName{get CommentAdded(){return a.CommentAdded}get BeforeCommentAdd(){return a.BeforeCommentAdd}get CommentUpdated(){return a.CommentUpdated}get BeforeCommentUpdate(){return a.BeforeCommentUpdate}get CommentDeleted(){return a.CommentDeleted}get BeforeCommentDeleted(){return a.BeforeCommentDeleted}get CommentResolved(){return a.CommentResolved}get BeforeCommentResolve(){return a.BeforeCommentResolve}}r.FEventName.extend(j);
|
package/lib/es/facade.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var E = Object.defineProperty;
|
|
2
2
|
var P = (r, e, t) => e in r ? E(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
-
var
|
|
3
|
+
var w = (r, e, t) => P(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { Inject as v, Injector as F, UserManagerService as S, UniverInstanceType as W, RichTextValue as l, generateRandomId as g, ICommandService as p, IUniverInstanceService as O, RichTextBuilder as $, Tools as B, Range as z, toDisposable as I, FEventName as R } from "@univerjs/core";
|
|
5
5
|
import { SheetsThreadCommentModel as h } from "@univerjs/sheets-thread-comment";
|
|
6
|
-
import { FRange as x, FWorkbook as j, FWorksheet as
|
|
7
|
-
import { DeleteCommentTreeCommand as
|
|
6
|
+
import { FRange as x, FWorkbook as j, FWorksheet as A } from "@univerjs/sheets/facade";
|
|
7
|
+
import { DeleteCommentTreeCommand as y, DeleteCommentCommand as D, getDT as f, UpdateCommentCommand as M, ResolveCommentCommand as L, AddCommentCommand as b, ThreadCommentModel as N } from "@univerjs/thread-comment";
|
|
8
8
|
import { deserializeRangeWithSheet as V } from "@univerjs/engine-formula";
|
|
9
9
|
import { filter as H } from "rxjs";
|
|
10
10
|
var q = Object.defineProperty, G = Object.getOwnPropertyDescriptor, J = (r, e, t, n) => {
|
|
@@ -12,9 +12,9 @@ var q = Object.defineProperty, G = Object.getOwnPropertyDescriptor, J = (r, e, t
|
|
|
12
12
|
(s = r[m]) && (o = (n ? s(e, t, o) : s(o)) || o);
|
|
13
13
|
return n && o && q(e, t, o), o;
|
|
14
14
|
}, a = (r, e) => (t, n) => e(t, n, r);
|
|
15
|
-
class
|
|
15
|
+
class T {
|
|
16
16
|
constructor(e) {
|
|
17
|
-
|
|
17
|
+
w(this, "_comment", {
|
|
18
18
|
id: g(),
|
|
19
19
|
ref: "",
|
|
20
20
|
threadId: "",
|
|
@@ -37,7 +37,7 @@ class k {
|
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
39
|
static create(e) {
|
|
40
|
-
return new
|
|
40
|
+
return new T(e);
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Get the person id of the comment
|
|
@@ -124,7 +124,7 @@ class k {
|
|
|
124
124
|
return U.create(B.deepClone(this._comment));
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
class U extends
|
|
127
|
+
class U extends T {
|
|
128
128
|
static create(e) {
|
|
129
129
|
return new U(e);
|
|
130
130
|
}
|
|
@@ -316,7 +316,7 @@ let i = class {
|
|
|
316
316
|
*/
|
|
317
317
|
deleteAsync() {
|
|
318
318
|
return this._commandService.executeCommand(
|
|
319
|
-
this.getIsRoot() ?
|
|
319
|
+
this.getIsRoot() ? y.id : D.id,
|
|
320
320
|
{
|
|
321
321
|
commentId: this._thread.id,
|
|
322
322
|
unitId: this._thread.unitId,
|
|
@@ -461,8 +461,8 @@ class K extends x {
|
|
|
461
461
|
}), m;
|
|
462
462
|
}
|
|
463
463
|
addComment(e) {
|
|
464
|
-
var
|
|
465
|
-
const t = this._injector, n = (
|
|
464
|
+
var k;
|
|
465
|
+
const t = this._injector, n = (k = this.getComment()) == null ? void 0 : k.getCommentData(), o = t.get(p), m = t.get(S), s = this._workbook.getUnitId(), c = this._worksheet.getSheetId(), u = `${B.chatAtABC(this._range.startColumn)}${this._range.startRow + 1}`, C = m.getCurrentUser(), _ = e instanceof U ? e.build() : { text: e };
|
|
466
466
|
return o.executeCommand(b.id, {
|
|
467
467
|
unitId: s,
|
|
468
468
|
subUnitId: c,
|
|
@@ -483,7 +483,7 @@ class K extends x {
|
|
|
483
483
|
clearComment() {
|
|
484
484
|
var s;
|
|
485
485
|
const e = this._injector, t = (s = this.getComment()) == null ? void 0 : s.getCommentData(), n = e.get(p), o = this._workbook.getUnitId(), m = this._worksheet.getSheetId();
|
|
486
|
-
return t ? n.executeCommand(
|
|
486
|
+
return t ? n.executeCommand(y.id, {
|
|
487
487
|
unitId: o,
|
|
488
488
|
subUnitId: m,
|
|
489
489
|
threadId: t.threadId,
|
|
@@ -494,6 +494,15 @@ class K extends x {
|
|
|
494
494
|
const t = this.getComments().map((n) => n.deleteAsync());
|
|
495
495
|
return Promise.all(t).then(() => !0);
|
|
496
496
|
}
|
|
497
|
+
addCommentAsync(e) {
|
|
498
|
+
return this.addComment(e);
|
|
499
|
+
}
|
|
500
|
+
clearCommentAsync() {
|
|
501
|
+
return this.clearComment();
|
|
502
|
+
}
|
|
503
|
+
clearCommentsAsync() {
|
|
504
|
+
return this.clearComments();
|
|
505
|
+
}
|
|
497
506
|
}
|
|
498
507
|
x.extend(K);
|
|
499
508
|
class Q extends j {
|
|
@@ -512,12 +521,14 @@ class Q extends j {
|
|
|
512
521
|
return Promise.all(t).then(() => !0);
|
|
513
522
|
}
|
|
514
523
|
/**
|
|
524
|
+
* @param callback
|
|
515
525
|
* @deprecated
|
|
516
526
|
*/
|
|
517
527
|
onThreadCommentChange(e) {
|
|
518
528
|
return I(this._threadCommentModel.commentUpdate$.pipe(H((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
|
|
519
529
|
}
|
|
520
530
|
/**
|
|
531
|
+
* @param callback
|
|
521
532
|
* @deprecated
|
|
522
533
|
*/
|
|
523
534
|
onBeforeAddThreadComment(e) {
|
|
@@ -532,6 +543,7 @@ class Q extends j {
|
|
|
532
543
|
}));
|
|
533
544
|
}
|
|
534
545
|
/**
|
|
546
|
+
* @param callback
|
|
535
547
|
* @deprecated
|
|
536
548
|
*/
|
|
537
549
|
onBeforeUpdateThreadComment(e) {
|
|
@@ -546,12 +558,13 @@ class Q extends j {
|
|
|
546
558
|
}));
|
|
547
559
|
}
|
|
548
560
|
/**
|
|
561
|
+
* @param callback
|
|
549
562
|
* @deprecated
|
|
550
563
|
*/
|
|
551
564
|
onBeforeDeleteThreadComment(e) {
|
|
552
565
|
return I(this._commandService.beforeCommandExecuted((t, n) => {
|
|
553
566
|
const o = t.params;
|
|
554
|
-
if (t.id ===
|
|
567
|
+
if (t.id === D.id || t.id === y.id) {
|
|
555
568
|
if (o.unitId !== this._workbook.getUnitId())
|
|
556
569
|
return;
|
|
557
570
|
if (e(o, n) === !1)
|
|
@@ -561,7 +574,7 @@ class Q extends j {
|
|
|
561
574
|
}
|
|
562
575
|
}
|
|
563
576
|
j.extend(Q);
|
|
564
|
-
class X extends
|
|
577
|
+
class X extends A {
|
|
565
578
|
getComments() {
|
|
566
579
|
return this._injector.get(h).getSubUnitAll(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((n) => this._injector.createInstance(i, n));
|
|
567
580
|
}
|
|
@@ -587,7 +600,7 @@ class X extends D {
|
|
|
587
600
|
return this._injector.createInstance(i, n);
|
|
588
601
|
}
|
|
589
602
|
}
|
|
590
|
-
|
|
603
|
+
A.extend(X);
|
|
591
604
|
const d = {
|
|
592
605
|
CommentAdded: "CommentAdded",
|
|
593
606
|
BeforeCommentAdd: "BeforeCommentAdd",
|
|
@@ -4,30 +4,76 @@ import { FTheadCommentBuilder, FThreadComment } from './f-thread-comment';
|
|
|
4
4
|
export interface IFRangeCommentMixin {
|
|
5
5
|
/**
|
|
6
6
|
* Get the comment of the start cell in the current range.
|
|
7
|
-
* @returns The comment of the start cell in the current range. If the cell does not have a comment, return `null`.
|
|
7
|
+
* @returns {FThreadComment | null} The comment of the start cell in the current range. If the cell does not have a comment, return `null`.
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const range = univerAPI.getActiveWorkbook()
|
|
11
|
+
* .getActiveSheet()
|
|
12
|
+
* .getActiveRange();
|
|
13
|
+
* const comment = range.getComment();
|
|
14
|
+
* ```
|
|
8
15
|
*/
|
|
9
16
|
getComment(): Nullable<FThreadComment>;
|
|
10
17
|
/**
|
|
11
18
|
* Get the comments in the current range.
|
|
12
19
|
* @returns {FThreadComment[]} The comments in the current range.
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const range = univerAPI.getActiveWorkbook()
|
|
23
|
+
* .getActiveSheet()
|
|
24
|
+
* .getActiveRange();
|
|
25
|
+
* const comments = range.getComments();
|
|
26
|
+
* comments.forEach((comment) => {
|
|
27
|
+
* console.log(comment.getContent());
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
13
30
|
*/
|
|
14
31
|
getComments(): FThreadComment[];
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated use `addCommentAsync` as instead.
|
|
34
|
+
*/
|
|
35
|
+
addComment(content: IDocumentBody | FTheadCommentBuilder): Promise<boolean>;
|
|
15
36
|
/**
|
|
16
37
|
* Add a comment to the start cell in the current range.
|
|
17
38
|
* @param content The content of the comment.
|
|
18
39
|
* @returns Whether the comment is added successfully.
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const range = univerAPI.getActiveWorkbook()
|
|
43
|
+
* .getActiveSheet()
|
|
44
|
+
* .getActiveRange();
|
|
45
|
+
*
|
|
46
|
+
* const comment = univerAPI.newTheadComment()
|
|
47
|
+
* .setContent(univerAPI.newRichText().insertText('hello zhangsan'));
|
|
48
|
+
* const success = await range.addCommentAsync(comment);
|
|
49
|
+
* ```
|
|
19
50
|
*/
|
|
20
|
-
|
|
51
|
+
addCommentAsync(content: IDocumentBody | FTheadCommentBuilder): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated use `clearCommentAsync` as instead.
|
|
54
|
+
*/
|
|
55
|
+
clearComment(): Promise<boolean>;
|
|
21
56
|
/**
|
|
22
57
|
* Clear the comment of the start cell in the current range.
|
|
23
58
|
* @returns Whether the comment is cleared successfully.
|
|
24
59
|
*/
|
|
25
|
-
|
|
60
|
+
clearCommentAsync(): Promise<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated use `clearComments` as instead.
|
|
63
|
+
*/
|
|
64
|
+
clearComments(): Promise<boolean>;
|
|
26
65
|
/**
|
|
27
66
|
* Clear all of the comments in the current range.
|
|
28
67
|
* @returns Whether the comments are cleared successfully.
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const range = univerAPI.getActiveWorkbook()
|
|
71
|
+
* .getActiveSheet()
|
|
72
|
+
* .getActiveRange();
|
|
73
|
+
* const success = await range.clearCommentsAsync();
|
|
74
|
+
* ```
|
|
29
75
|
*/
|
|
30
|
-
|
|
76
|
+
clearCommentsAsync(): Promise<boolean>;
|
|
31
77
|
}
|
|
32
78
|
export declare class FRangeCommentMixin extends FRange implements IFRangeCommentMixin {
|
|
33
79
|
getComment(): Nullable<FThreadComment>;
|
|
@@ -35,6 +81,9 @@ export declare class FRangeCommentMixin extends FRange implements IFRangeComment
|
|
|
35
81
|
addComment(content: IDocumentBody | FTheadCommentBuilder): Promise<boolean>;
|
|
36
82
|
clearComment(): Promise<boolean>;
|
|
37
83
|
clearComments(): Promise<boolean>;
|
|
84
|
+
addCommentAsync(content: IDocumentBody | FTheadCommentBuilder): Promise<boolean>;
|
|
85
|
+
clearCommentAsync(): Promise<boolean>;
|
|
86
|
+
clearCommentsAsync(): Promise<boolean>;
|
|
38
87
|
}
|
|
39
88
|
declare module '@univerjs/sheets/facade' {
|
|
40
89
|
interface FRange extends IFRangeCommentMixin {
|
|
@@ -21,7 +21,7 @@ export interface IFUniverCommentMixin {
|
|
|
21
21
|
onCommentResolved(callback: (event: ISheetCommentResolveEvent) => void): IDisposable;
|
|
22
22
|
/**
|
|
23
23
|
* create a new thread comment
|
|
24
|
-
* @
|
|
24
|
+
* @returns {FTheadCommentBuilder} thead comment builder
|
|
25
25
|
* @example
|
|
26
26
|
* ```ts
|
|
27
27
|
* const comment = univerAPI.newTheadComment().setContent(univerAPI.newRichText().insertText('hello zhangsan'));
|
|
@@ -7,10 +7,21 @@ export interface IFWorkbookThreadCommentMixin {
|
|
|
7
7
|
/**
|
|
8
8
|
* Get all comments in the current sheet
|
|
9
9
|
* @returns all comments in the current sheet
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
13
|
+
* const comments = workbook.getComments();
|
|
14
|
+
* ```
|
|
10
15
|
*/
|
|
11
16
|
getComments(): FThreadComment[];
|
|
12
17
|
/**
|
|
13
18
|
* Clear all comments in the current sheet
|
|
19
|
+
* @returns Whether the comments are cleared successfully.
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
23
|
+
* const success = await workbook.clearComments();
|
|
24
|
+
* ```
|
|
14
25
|
*/
|
|
15
26
|
clearComments(): Promise<boolean>;
|
|
16
27
|
/**
|
|
@@ -36,18 +47,22 @@ export declare class FWorkbookThreadCommentMixin extends FWorkbook implements IF
|
|
|
36
47
|
getComments(): FThreadComment[];
|
|
37
48
|
clearComments(): Promise<boolean>;
|
|
38
49
|
/**
|
|
50
|
+
* @param callback
|
|
39
51
|
* @deprecated
|
|
40
52
|
*/
|
|
41
53
|
onThreadCommentChange(callback: (commentUpdate: CommentUpdate) => void | false): IDisposable;
|
|
42
54
|
/**
|
|
55
|
+
* @param callback
|
|
43
56
|
* @deprecated
|
|
44
57
|
*/
|
|
45
58
|
onBeforeAddThreadComment(callback: (params: IAddCommentCommandParams, options: IExecutionOptions | undefined) => void | false): IDisposable;
|
|
46
59
|
/**
|
|
60
|
+
* @param callback
|
|
47
61
|
* @deprecated
|
|
48
62
|
*/
|
|
49
63
|
onBeforeUpdateThreadComment(callback: (params: IUpdateCommandParams, options: IExecutionOptions | undefined) => void | false): IDisposable;
|
|
50
64
|
/**
|
|
65
|
+
* @param callback
|
|
51
66
|
* @deprecated
|
|
52
67
|
*/
|
|
53
68
|
onBeforeDeleteThreadComment(callback: (params: IDeleteCommentCommandParams, options: IExecutionOptions | undefined) => void | false): IDisposable;
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(s,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/sheets-thread-comment"),require("@univerjs/sheets/facade"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-thread-comment","@univerjs/sheets/facade","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],r):(s=typeof globalThis<"u"?globalThis:s||self,r(s.UniverSheetsThreadCommentFacade={},s.UniverCore,s.UniverSheetsThreadComment,s.UniverSheetsFacade,s.UniverThreadComment,s.UniverEngineFormula,s.rxjs))})(this,function(s,r,a,u,m,U,b){"use strict";var w=Object.defineProperty;var
|
|
1
|
+
(function(s,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/sheets-thread-comment"),require("@univerjs/sheets/facade"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-thread-comment","@univerjs/sheets/facade","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],r):(s=typeof globalThis<"u"?globalThis:s||self,r(s.UniverSheetsThreadCommentFacade={},s.UniverCore,s.UniverSheetsThreadComment,s.UniverSheetsFacade,s.UniverThreadComment,s.UniverEngineFormula,s.rxjs))})(this,function(s,r,a,u,m,U,b){"use strict";var w=Object.defineProperty;var A=(s,r,a)=>r in s?w(s,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[r]=a;var T=(s,r,a)=>A(s,typeof r!="symbol"?r+"":r,a);var S=Object.defineProperty,j=Object.getOwnPropertyDescriptor,y=(h,e,t,n)=>{for(var o=n>1?void 0:n?j(e,t):e,i=h.length-1,d;i>=0;i--)(d=h[i])&&(o=(n?d(e,t,o):d(o))||o);return n&&o&&S(e,t,o),o},I=(h,e)=>(t,n)=>e(t,n,h);class p{constructor(e){T(this,"_comment",{id:r.generateRandomId(),ref:"",threadId:"",dT:"",personId:"",text:r.RichTextBuilder.newEmptyData().body,attachments:[],unitId:"",subUnitId:""});e&&(this._comment=e)}static create(e){return new p(e)}get personId(){return this._comment.personId}get dateTime(){return this._comment.dT}get content(){return r.RichTextValue.createByBody(this._comment.text)}get id(){return this._comment.id}get threadId(){return this._comment.threadId}copy(){return l.create(r.Tools.deepClone(this._comment))}}class l extends p{static create(e){return new l(e)}setContent(e){return e instanceof r.RichTextValue?this._comment.text=e.getData().body:this._comment.text=e,this}setPersonId(e){return this._comment.personId=e,this}setDateTime(e){return this._comment.dT=m.getDT(e),this}setId(e){return this._comment.id=e,this}setThreadId(e){return this._comment.threadId=e,this}build(){return this._comment}}s.FThreadComment=class{constructor(e,t,n,o,i,d,C){this._thread=e,this._parent=t,this._injector=n,this._commandService=o,this._univerInstanceService=i,this._threadCommentModel=d,this._userManagerService=C}_getRef(){var n;const e=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return U.deserializeRangeWithSheet(e).range}getIsRoot(){return!this._parent}getCommentData(){const{children:e,...t}=this._thread;return t}getReplies(){var n;const e=this._getRef(),t=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,e.startRow,e.startColumn);return(n=t==null?void 0:t.children)==null?void 0:n.map(o=>this._injector.createInstance(s.FThreadComment,o))}getRange(){const e=this._univerInstanceService.getUnit(this._thread.unitId,r.UniverInstanceType.UNIVER_SHEET);if(!e)return null;const t=e.getSheetBySheetId(this._thread.subUnitId);if(!t)return null;const n=this._getRef();return this._injector.createInstance(u.FRange,e,t,n)}getContent(){return this._thread.text}getRichText(){const e=this._thread.text;return r.RichTextValue.create({body:e,documentStyle:{},id:"d"})}deleteAsync(){return this._commandService.executeCommand(this.getIsRoot()?m.DeleteCommentTreeCommand.id:m.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}delete(){return this.deleteAsync()}async update(e){return this.updateAsync(e)}async updateAsync(e){const t=e instanceof r.RichTextValue?e.getData().body:e,n=m.getDT();return await this._commandService.executeCommand(m.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:n}})}resolve(e){return this.resolveAsync(e)}resolveAsync(e){return this._commandService.executeCommand(m.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:e!=null?e:!this._thread.resolved})}async replyAsync(e){var n;const t=e.build();return this._commandService.executeCommand(m.AddCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,comment:{id:r.generateRandomId(),parentId:this._thread.id,threadId:this._thread.threadId,ref:(n=this._parent)==null?void 0:n.ref,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,text:t.text,attachments:t.attachments,dT:t.dT||m.getDT(),personId:t.personId||this._userManagerService.getCurrentUser().userID}})}},s.FThreadComment=y([I(2,r.Inject(r.Injector)),I(3,r.ICommandService),I(4,r.IUniverInstanceService),I(5,r.Inject(a.SheetsThreadCommentModel)),I(6,r.Inject(r.UserManagerService))],s.FThreadComment);class k extends u.FRange{getComment(){const t=this._injector.get(a.SheetsThreadCommentModel),n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),i=t.getByLocation(n,o,this._range.startRow,this._range.startColumn);if(!i)return null;const d=t.getComment(n,o,i);return d?this._injector.createInstance(s.FThreadComment,d):null}getComments(){const t=this._injector.get(a.SheetsThreadCommentModel),n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),i=[];return r.Range.foreach(this._range,(d,C)=>{const _=t.getByLocation(n,o,d,C);if(_){const g=t.getComment(n,o,_);g&&i.push(this._injector.createInstance(s.FThreadComment,g))}}),i}addComment(e){var v;const t=this._injector,n=(v=this.getComment())==null?void 0:v.getCommentData(),o=t.get(r.ICommandService),i=t.get(r.UserManagerService),d=this._workbook.getUnitId(),C=this._worksheet.getSheetId(),_=`${r.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,g=i.getCurrentUser(),f=e instanceof l?e.build():{text:e};return o.executeCommand(m.AddCommentCommand.id,{unitId:d,subUnitId:C,comment:{text:f.text,dT:f.dT||m.getDT(),attachments:[],id:f.id||r.generateRandomId(),ref:_,personId:f.personId||g.userID,parentId:n==null?void 0:n.id,unitId:d,subUnitId:C,threadId:(n==null?void 0:n.threadId)||r.generateRandomId()}})}clearComment(){var d;const e=this._injector,t=(d=this.getComment())==null?void 0:d.getCommentData(),n=e.get(r.ICommandService),o=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return t?n.executeCommand(m.DeleteCommentTreeCommand.id,{unitId:o,subUnitId:i,threadId:t.threadId,commentId:t.id}):Promise.resolve(!0)}clearComments(){const t=this.getComments().map(n=>n.deleteAsync());return Promise.all(t).then(()=>!0)}addCommentAsync(e){return this.addComment(e)}clearCommentAsync(){return this.clearComment()}clearCommentsAsync(){return this.clearComments()}}u.FRange.extend(k);class x extends u.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(m.ThreadCommentModel)}})}getComments(){return this._threadCommentModel.getUnit(this._workbook.getUnitId()).map(e=>this._injector.createInstance(s.FThreadComment,e.root))}clearComments(){const t=this.getComments().map(n=>n.deleteAsync());return Promise.all(t).then(()=>!0)}onThreadCommentChange(e){return r.toDisposable(this._threadCommentModel.commentUpdate$.pipe(b.filter(t=>t.unitId===this._workbook.getUnitId())).subscribe(e))}onBeforeAddThreadComment(e){return r.toDisposable(this._commandService.beforeCommandExecuted((t,n)=>{const o=t.params;if(t.id===m.AddCommentCommand.id){if(o.unitId!==this._workbook.getUnitId())return;if(e(o,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(e){return r.toDisposable(this._commandService.beforeCommandExecuted((t,n)=>{const o=t.params;if(t.id===m.UpdateCommentCommand.id){if(o.unitId!==this._workbook.getUnitId())return;if(e(o,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(e){return r.toDisposable(this._commandService.beforeCommandExecuted((t,n)=>{const o=t.params;if(t.id===m.DeleteCommentCommand.id||t.id===m.DeleteCommentTreeCommand.id){if(o.unitId!==this._workbook.getUnitId())return;if(e(o,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}u.FWorkbook.extend(x);class D extends u.FWorksheet{getComments(){return this._injector.get(a.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(s.FThreadComment,n))}clearComments(){const t=this.getComments().map(n=>n.deleteAsync());return Promise.all(t).then(()=>!0)}onCommented(e){return this._injector.get(r.ICommandService).onCommandExecuted(n=>{if(n.id===m.AddCommentCommand.id){const o=n.params;e(o)}})}getCommentById(e){const n=this._injector.get(a.SheetsThreadCommentModel).getComment(this._workbook.getUnitId(),this._worksheet.getSheetId(),e);if(n)return this._injector.createInstance(s.FThreadComment,n)}}u.FWorksheet.extend(D);const c={CommentAdded:"CommentAdded",BeforeCommentAdd:"BeforeCommentAdd",CommentUpdated:"CommentUpdated",BeforeCommentUpdate:"BeforeCommentUpdate",CommentDeleted:"CommentDeleted",BeforeCommentDeleted:"BeforeCommentDeleted",CommentResolved:"CommentResolved",BeforeCommentResolve:"BeforeCommentResolve"};class R extends r.FEventName{get CommentAdded(){return c.CommentAdded}get BeforeCommentAdd(){return c.BeforeCommentAdd}get CommentUpdated(){return c.CommentUpdated}get BeforeCommentUpdate(){return c.BeforeCommentUpdate}get CommentDeleted(){return c.CommentDeleted}get BeforeCommentDeleted(){return c.BeforeCommentDeleted}get CommentResolved(){return c.CommentResolved}get BeforeCommentResolve(){return c.BeforeCommentResolve}}r.FEventName.extend(R),Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-thread-comment",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5-nightly.202501201336",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer sheets thread comment base plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
"rxjs": ">=7.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@univerjs/
|
|
55
|
-
"@univerjs/
|
|
56
|
-
"@univerjs/thread-comment": "0.5.
|
|
57
|
-
"@univerjs/
|
|
54
|
+
"@univerjs/engine-formula": "0.5.5-nightly.202501201336",
|
|
55
|
+
"@univerjs/core": "0.5.5-nightly.202501201336",
|
|
56
|
+
"@univerjs/thread-comment": "0.5.5-nightly.202501201336",
|
|
57
|
+
"@univerjs/sheets": "0.5.5-nightly.202501201336"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"rxjs": "^7.8.1",
|
|
61
61
|
"typescript": "^5.7.2",
|
|
62
62
|
"vite": "^6.0.7",
|
|
63
63
|
"vitest": "^2.1.8",
|
|
64
|
-
"@univerjs-infra/shared": "0.5.
|
|
64
|
+
"@univerjs-infra/shared": "0.5.5"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"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
|