@univerjs/preset-sheets-thread-comment 0.6.0-nightly.202502140800 → 0.6.0
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/umd/index.js +1 -1
- package/package.json +7 -7
package/lib/umd/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// @univerjs/sheets-thread-comment/facade
|
|
10
|
-
(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"),require("@univerjs/core/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-thread-comment","@univerjs/sheets/facade","@univerjs/thread-comment","@univerjs/engine-formula","rxjs","@univerjs/core/facade"],r):(s=typeof globalThis<"u"?globalThis:s||self,r(s.UniverSheetsThreadCommentFacade={},s.UniverCore,s.UniverSheetsThreadComment,s.UniverSheetsFacade,s.UniverThreadComment,s.UniverEngineFormula,s.rxjs,s.UniverCoreFacade))})(this,function(s,r,a,u,m,b,S,v){"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 U=(s,r,a)=>A(s,typeof r!="symbol"?r+"":r,a);var j=Object.getOwnPropertyDescriptor,k=(h,e,t,n)=>{for(var o=n>1?void 0:n?j(e,t):e,d=h.length-1,i;d>=0;d--)(i=h[d])&&(o=i(o)||o);return o},I=(h,e)=>(t,n)=>e(t,n,h);class p{constructor(e){U(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,d,i,C){this._thread=e,this._parent=t,this._injector=n,this._commandService=o,this._univerInstanceService=d,this._threadCommentModel=i,this._userManagerService=C}_getRef(){var n;const e=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return b.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=k([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 y extends u.FRange{getComment(){const t=this._injector.get(a.SheetsThreadCommentModel),n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),d=t.getByLocation(n,o,this._range.startRow,this._range.startColumn);if(!d)return null;const i=t.getComment(n,o,d);return i?this._injector.createInstance(s.FThreadComment,i):null}getComments(){const t=this._injector.get(a.SheetsThreadCommentModel),n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),d=[];return r.Range.foreach(this._range,(i,C)=>{const _=t.getByLocation(n,o,i,C);if(_){const g=t.getComment(n,o,_);g&&d.push(this._injector.createInstance(s.FThreadComment,g))}}),d}addComment(e){var T;const t=this._injector,n=(T=this.getComment())==null?void 0:T.getCommentData(),o=t.get(r.ICommandService),d=t.get(r.UserManagerService),i=this._workbook.getUnitId(),C=this._worksheet.getSheetId(),_=`${r.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,g=d.getCurrentUser(),f=e instanceof l?e.build():{text:e};return o.executeCommand(m.AddCommentCommand.id,{unitId:i,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:i,subUnitId:C,threadId:(n==null?void 0:n.threadId)||r.generateRandomId()}})}clearComment(){var i;const e=this._injector,t=(i=this.getComment())==null?void 0:i.getCommentData(),n=e.get(r.ICommandService),o=this._workbook.getUnitId(),d=this._worksheet.getSheetId();return t?n.executeCommand(m.DeleteCommentTreeCommand.id,{unitId:o,subUnitId:d,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(y);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(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")}}))}}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 v.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}}v.FEventName.extend(R),Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
|
10
|
+
(function(a,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets-thread-comment"),require("@univerjs/sheets/facade"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs"),require("@univerjs/core/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-thread-comment","@univerjs/sheets/facade","@univerjs/thread-comment","@univerjs/engine-formula","rxjs","@univerjs/core/facade"],s):(a=typeof globalThis<"u"?globalThis:a||self,s(a.UniverSheetsThreadCommentFacade={},a.UniverCore,a.UniverSheetsThreadComment,a.UniverSheetsFacade,a.UniverThreadComment,a.UniverEngineFormula,a.rxjs,a.UniverCoreFacade))})(this,function(a,s,I,p,h,E,y,b){"use strict";var P=Object.defineProperty;var W=(a,s,I)=>s in a?P(a,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):a[s]=I;var T=(a,s,I)=>W(a,typeof s!="symbol"?s+"":s,I);var A=Object.getOwnPropertyDescriptor,B=(f,t,r,e)=>{for(var n=e>1?void 0:e?A(t,r):t,o=f.length-1,i;o>=0;o--)(i=f[o])&&(n=i(n)||n);return n},U=(f,t)=>(r,e)=>t(r,e,f);class w{constructor(t){T(this,"_comment",{id:s.generateRandomId(),ref:"",threadId:"",dT:"",personId:"",text:s.RichTextBuilder.newEmptyData().body,attachments:[],unitId:"",subUnitId:""});t&&(this._comment=t)}static create(t){return new w(t)}get personId(){return this._comment.personId}get dateTime(){return this._comment.dT}get content(){return s.RichTextValue.createByBody(this._comment.text)}get id(){return this._comment.id}get threadId(){return this._comment.threadId}copy(){return k.create(s.Tools.deepClone(this._comment))}}class k extends w{static create(t){return new k(t)}setContent(t){return t instanceof s.RichTextValue?this._comment.text=t.getData().body:this._comment.text=t,this}setPersonId(t){return this._comment.personId=t,this}setDateTime(t){return this._comment.dT=h.getDT(t),this}setId(t){return this._comment.id=t,this}setThreadId(t){return this._comment.threadId=t,this}build(){return this._comment}}a.FThreadComment=class{constructor(t,r,e,n,o,i,u){this._thread=t,this._parent=r,this._injector=e,this._commandService=n,this._univerInstanceService=o,this._threadCommentModel=i,this._userManagerService=u}_getRef(){var e;const t=((e=this._parent)==null?void 0:e.ref)||this._thread.ref;return E.deserializeRangeWithSheet(t).range}getIsRoot(){return!this._parent}getCommentData(){const{children:t,...r}=this._thread;return r}getReplies(){var e;const t=this._getRef(),r=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return(e=r==null?void 0:r.children)==null?void 0:e.map(n=>this._injector.createInstance(a.FThreadComment,n))}getRange(){const t=this._univerInstanceService.getUnit(this._thread.unitId,s.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const r=t.getSheetBySheetId(this._thread.subUnitId);if(!r)return null;const e=this._getRef();return this._injector.createInstance(p.FRange,t,r,e)}getContent(){return this._thread.text}getRichText(){const t=this._thread.text;return s.RichTextValue.create({body:t,documentStyle:{},id:"d"})}deleteAsync(){return this._commandService.executeCommand(this.getIsRoot()?h.DeleteCommentTreeCommand.id:h.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}delete(){return this.deleteAsync()}async update(t){return this.updateAsync(t)}async updateAsync(t){const r=t instanceof s.RichTextValue?t.getData().body:t,e=h.getDT();return await this._commandService.executeCommand(h.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:r,updated:!0,updateT:e}})}resolve(t){return this.resolveAsync(t)}resolveAsync(t){return this._commandService.executeCommand(h.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}async replyAsync(t){var e;const r=t.build();return this._commandService.executeCommand(h.AddCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,comment:{id:s.generateRandomId(),parentId:this._thread.id,threadId:this._thread.threadId,ref:(e=this._parent)==null?void 0:e.ref,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,text:r.text,attachments:r.attachments,dT:r.dT||h.getDT(),personId:r.personId||this._userManagerService.getCurrentUser().userID}})}},a.FThreadComment=B([U(2,s.Inject(s.Injector)),U(3,s.ICommandService),U(4,s.IUniverInstanceService),U(5,s.Inject(I.SheetsThreadCommentModel)),U(6,s.Inject(s.UserManagerService))],a.FThreadComment);class x extends p.FRange{getComment(){const r=this._injector.get(I.SheetsThreadCommentModel),e=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=r.getByLocation(e,n,this._range.startRow,this._range.startColumn);if(!o)return null;const i=r.getComment(e,n,o);return i?this._injector.createInstance(a.FThreadComment,i):null}getComments(){const r=this._injector.get(I.SheetsThreadCommentModel),e=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=[];return s.Range.foreach(this._range,(i,u)=>{const C=r.getByLocation(e,n,i,u);if(C){const m=r.getComment(e,n,C);m&&o.push(this._injector.createInstance(a.FThreadComment,m))}}),o}addComment(t){var c;const r=this._injector,e=(c=this.getComment())==null?void 0:c.getCommentData(),n=r.get(s.ICommandService),o=r.get(s.UserManagerService),i=this._workbook.getUnitId(),u=this._worksheet.getSheetId(),C=`${s.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,m=o.getCurrentUser(),d=t instanceof k?t.build():{text:t};return n.executeCommand(h.AddCommentCommand.id,{unitId:i,subUnitId:u,comment:{text:d.text,dT:d.dT||h.getDT(),attachments:[],id:d.id||s.generateRandomId(),ref:C,personId:d.personId||m.userID,parentId:e==null?void 0:e.id,unitId:i,subUnitId:u,threadId:(e==null?void 0:e.threadId)||s.generateRandomId()}})}clearComment(){var i;const t=this._injector,r=(i=this.getComment())==null?void 0:i.getCommentData(),e=t.get(s.ICommandService),n=this._workbook.getUnitId(),o=this._worksheet.getSheetId();return r?e.executeCommand(h.DeleteCommentTreeCommand.id,{unitId:n,subUnitId:o,threadId:r.threadId,commentId:r.id}):Promise.resolve(!0)}clearComments(){const r=this.getComments().map(e=>e.deleteAsync());return Promise.all(r).then(()=>!0)}addCommentAsync(t){return this.addComment(t)}clearCommentAsync(){return this.clearComment()}clearCommentsAsync(){return this.clearComments()}}p.FRange.extend(x);class D extends p.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(h.ThreadCommentModel)}})}getComments(){return this._threadCommentModel.getUnit(this._workbook.getUnitId()).map(t=>this._injector.createInstance(a.FThreadComment,t.root))}clearComments(){const r=this.getComments().map(e=>e.deleteAsync());return Promise.all(r).then(()=>!0)}onThreadCommentChange(t){return s.toDisposable(this._threadCommentModel.commentUpdate$.pipe(y.filter(r=>r.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddThreadComment(t){return s.toDisposable(this._commandService.beforeCommandExecuted((r,e)=>{const n=r.params;if(r.id===h.AddCommentCommand.id){if(n.unitId!==this._workbook.getUnitId())return;if(t(n,e)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(t){return s.toDisposable(this._commandService.beforeCommandExecuted((r,e)=>{const n=r.params;if(r.id===h.UpdateCommentCommand.id){if(n.unitId!==this._workbook.getUnitId())return;if(t(n,e)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(t){return s.toDisposable(this._commandService.beforeCommandExecuted((r,e)=>{const n=r.params;if(r.id===h.DeleteCommentCommand.id||r.id===h.DeleteCommentTreeCommand.id){if(n.unitId!==this._workbook.getUnitId())return;if(t(n,e)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}p.FWorkbook.extend(D);class j extends p.FWorksheet{getComments(){return this._injector.get(I.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(e=>this._injector.createInstance(a.FThreadComment,e))}clearComments(){const r=this.getComments().map(e=>e.deleteAsync());return Promise.all(r).then(()=>!0)}onCommented(t){return this._injector.get(s.ICommandService).onCommandExecuted(e=>{if(e.id===h.AddCommentCommand.id){const n=e.params;t(n)}})}getCommentById(t){const e=this._injector.get(I.SheetsThreadCommentModel).getComment(this._workbook.getUnitId(),this._worksheet.getSheetId(),t);if(e)return this._injector.createInstance(a.FThreadComment,e)}}p.FWorksheet.extend(j);const _={CommentAdded:"CommentAdded",BeforeCommentAdd:"BeforeCommentAdd",CommentUpdated:"CommentUpdated",BeforeCommentUpdate:"BeforeCommentUpdate",CommentDeleted:"CommentDeleted",BeforeCommentDeleted:"BeforeCommentDeleted",CommentResolved:"CommentResolved",BeforeCommentResolve:"BeforeCommentResolve"};class F extends b.FEventName{get CommentAdded(){return _.CommentAdded}get BeforeCommentAdd(){return _.BeforeCommentAdd}get CommentUpdated(){return _.CommentUpdated}get BeforeCommentUpdate(){return _.BeforeCommentUpdate}get CommentDeleted(){return _.CommentDeleted}get BeforeCommentDeleted(){return _.BeforeCommentDeleted}get CommentResolved(){return _.CommentResolved}get BeforeCommentResolve(){return _.BeforeCommentResolve}}b.FEventName.extend(F);class M extends b.FUniver{_initialize(t){const r=t.get(s.ICommandService);this.registerEventHandler(this.Event.CommentAdded,()=>r.onCommandExecuted(e=>{var d,c,g,l,v;if(e.id!==h.AddCommentCommand.id)return;const n=e.params;if(!n)return;const o=n.unitId?this.getUniverSheet(n.unitId):(d=this.getActiveWorkbook)==null?void 0:d.call(this);if(!o)return;const i=o.getSheetBySheetId(n.subUnitId||n.sheetId)||o.getActiveSheet();if(!i)return;const u=e.params,{comment:C}=u,m=i.getRange(C.ref).getComment();m&&this.fireEvent(this.Event.CommentAdded,{workbook:o,worksheet:i,row:(g=(c=m.getRange())==null?void 0:c.getRow())!=null?g:0,col:(v=(l=m.getRange())==null?void 0:l.getColumn())!=null?v:0,comment:m})})),this.registerEventHandler(this.Event.CommentUpdated,()=>r.onCommandExecuted(e=>{var d,c,g,l,v;if(e.id!==h.UpdateCommentCommand.id)return;const n=e.params;if(!n)return;const o=n.unitId?this.getUniverSheet(n.unitId):(d=this.getActiveWorkbook)==null?void 0:d.call(this);if(!o)return;const i=o.getSheetBySheetId(n.subUnitId||n.sheetId)||o.getActiveSheet();if(!i)return;const u=e.params,{commentId:C}=u.payload,m=i.getCommentById(C);m&&this.fireEvent(this.Event.CommentUpdated,{workbook:o,worksheet:i,row:(g=(c=m.getRange())==null?void 0:c.getRow())!=null?g:0,col:(v=(l=m.getRange())==null?void 0:l.getColumn())!=null?v:0,comment:m})})),this.registerEventHandler(this.Event.CommentDeleted,()=>r.onCommandExecuted(e=>{var m;if(e.id!==h.DeleteCommentCommand.id&&e.id!==h.DeleteCommentTreeCommand.id)return;const n=e.params;if(!n)return;const o=n.unitId?this.getUniverSheet(n.unitId):(m=this.getActiveWorkbook)==null?void 0:m.call(this);if(!o)return;const i=o.getSheetBySheetId(n.subUnitId||n.sheetId)||o.getActiveSheet();if(!i)return;const u=e.params,{commentId:C}=u;this.fireEvent(this.Event.CommentDeleted,{workbook:o,worksheet:i,commentId:C})})),this.registerEventHandler(this.Event.CommentResolved,()=>r.onCommandExecuted(e=>{var c,g,l;if(e.id!==h.ResolveCommentCommand.id)return;const n=e.params;if(!n)return;const o=n.unitId?this.getUniverSheet(n.unitId):(c=this.getActiveWorkbook)==null?void 0:c.call(this);if(!o)return;const i=o.getSheetBySheetId(n.subUnitId||n.sheetId)||o.getActiveSheet();if(!i)return;const u=e.params,{commentId:C,resolved:m}=u,d=i.getComments().find(v=>v.getCommentData().id===C);d&&this.fireEvent(this.Event.CommentResolved,{workbook:o,worksheet:i,row:(g=d.getRange().getRow())!=null?g:0,col:(l=d.getRange().getColumn())!=null?l:0,comment:d,resolved:m})})),this.registerEventHandler(this.Event.BeforeCommentAdd,()=>r.beforeCommandExecuted(e=>{var c,g,l;if(e.id!==h.AddCommentCommand.id)return;const n=e.params;if(!n)return;const o=n.unitId?this.getUniverSheet(n.unitId):(c=this.getActiveWorkbook)==null?void 0:c.call(this);if(!o)return;const i=o.getSheetBySheetId(n.subUnitId||n.sheetId)||o.getActiveSheet();if(!i)return;const u=e.params,{comment:C}=u,m=i.getActiveRange();if(!m)return;const d={workbook:o,worksheet:i,row:(g=m.getRow())!=null?g:0,col:(l=m.getColumn())!=null?l:0,comment:w.create(C)};if(this.fireEvent(this.Event.BeforeCommentAdd,d),d.cancel)throw new s.CanceledError})),this.registerEventHandler(this.Event.BeforeCommentUpdate,()=>r.beforeCommandExecuted(e=>{var c,g,l,v,S;if(e.id!==h.UpdateCommentCommand.id)return;const n=e.params;if(!n)return;const o=n.unitId?this.getUniverSheet(n.unitId):(c=this.getActiveWorkbook)==null?void 0:c.call(this);if(!o)return;const i=o.getSheetBySheetId(n.subUnitId||n.sheetId)||o.getActiveSheet();if(!i)return;const u=e.params,{commentId:C,text:m}=u.payload,d=i.getCommentById(C);if(d){const R={workbook:o,worksheet:i,row:(l=(g=d.getRange())==null?void 0:g.getRow())!=null?l:0,col:(S=(v=d.getRange())==null?void 0:v.getColumn())!=null?S:0,comment:d,newContent:s.RichTextValue.createByBody(m)};if(this.fireEvent(this.Event.BeforeCommentUpdate,R),R.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeCommentDeleted,()=>r.beforeCommandExecuted(e=>{var d,c,g,l,v;if(e.id!==h.DeleteCommentCommand.id&&e.id!==h.DeleteCommentTreeCommand.id)return;const n=e.params;if(!n)return;const o=n.unitId?this.getUniverSheet(n.unitId):(d=this.getActiveWorkbook)==null?void 0:d.call(this);if(!o)return;const i=o.getSheetBySheetId(n.subUnitId||n.sheetId)||o.getActiveSheet();if(!i)return;const u=e.params,{commentId:C}=u,m=i.getCommentById(C);if(m){const S={workbook:o,worksheet:i,row:(g=(c=m.getRange())==null?void 0:c.getRow())!=null?g:0,col:(v=(l=m.getRange())==null?void 0:l.getColumn())!=null?v:0,comment:m};if(this.fireEvent(this.Event.BeforeCommentDeleted,S),S.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeCommentResolve,()=>r.beforeCommandExecuted(e=>{var c,g,l;if(e.id!==h.ResolveCommentCommand.id)return;const n=e.params;if(!n)return;const o=n.unitId?this.getUniverSheet(n.unitId):(c=this.getActiveWorkbook)==null?void 0:c.call(this);if(!o)return;const i=o.getSheetBySheetId(n.subUnitId||n.sheetId)||o.getActiveSheet();if(!i)return;const u=e.params,{commentId:C,resolved:m}=u,d=i.getComments().find(v=>v.getCommentData().id===C);if(d){const v={workbook:o,worksheet:i,row:(g=d.getRange().getRow())!=null?g:0,col:(l=d.getRange().getColumn())!=null?l:0,comment:d,resolved:m};if(this.fireEvent(this.Event.BeforeCommentResolve,v),v.cancel)throw new s.CanceledError}}))}newTheadComment(t){return new k(t)}}b.FUniver.extend(M),Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
// @univerjs/thread-comment-ui/index
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/preset-sheets-thread-comment",
|
|
3
|
-
"version": "0.6.0
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -57,15 +57,15 @@
|
|
|
57
57
|
"rxjs": ">=7.0.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@univerjs/sheets-thread-comment": "0.6.0
|
|
61
|
-
"@univerjs/sheets-thread-comment-ui": "0.6.0
|
|
62
|
-
"@univerjs/thread-comment": "0.6.0
|
|
63
|
-
"@univerjs/thread-comment-ui": "0.6.0
|
|
60
|
+
"@univerjs/sheets-thread-comment": "0.6.0",
|
|
61
|
+
"@univerjs/sheets-thread-comment-ui": "0.6.0",
|
|
62
|
+
"@univerjs/thread-comment": "0.6.0",
|
|
63
|
+
"@univerjs/thread-comment-ui": "0.6.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@univerjs/core": "0.6.0
|
|
66
|
+
"@univerjs/core": "0.6.0",
|
|
67
67
|
"typescript": "^5.7.2",
|
|
68
|
-
"@univerjs-infra/shared": "0.6.0
|
|
68
|
+
"@univerjs-infra/shared": "0.6.0"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"prebuild:preset": "tsx prepare.ts",
|