@univerjs/sheets-thread-comment 0.5.4 → 0.5.5-experimental.20250123-34738ff

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
@@ -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,k=Object.getOwnPropertyDescriptor,y=(d,e,t,n)=>{for(var o=n>1?void 0:n?k(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=y([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)}}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);
1
+ "use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),sheetsThreadComment=require("@univerjs/sheets-thread-comment"),facade=require("@univerjs/sheets/facade"),threadComment=require("@univerjs/thread-comment"),engineFormula=require("@univerjs/engine-formula"),rxjs=require("rxjs");var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam");const _FTheadCommentItem=class _FTheadCommentItem{constructor(comment){__publicField(this,"_comment",{id:core.generateRandomId(),ref:"",threadId:"",dT:"",personId:"",text:core.RichTextBuilder.newEmptyData().body,attachments:[],unitId:"",subUnitId:""});comment&&(this._comment=comment)}static create(comment){return new _FTheadCommentItem(comment)}get personId(){return this._comment.personId}get dateTime(){return this._comment.dT}get content(){return core.RichTextValue.createByBody(this._comment.text)}get id(){return this._comment.id}get threadId(){return this._comment.threadId}copy(){return FTheadCommentBuilder.create(core.Tools.deepClone(this._comment))}};__name(_FTheadCommentItem,"FTheadCommentItem");let FTheadCommentItem=_FTheadCommentItem;const _FTheadCommentBuilder=class _FTheadCommentBuilder extends FTheadCommentItem{static create(comment){return new _FTheadCommentBuilder(comment)}setContent(content){return content instanceof core.RichTextValue?this._comment.text=content.getData().body:this._comment.text=content,this}setPersonId(userId){return this._comment.personId=userId,this}setDateTime(date){return this._comment.dT=threadComment.getDT(date),this}setId(id){return this._comment.id=id,this}setThreadId(threadId){return this._comment.threadId=threadId,this}build(){return this._comment}};__name(_FTheadCommentBuilder,"FTheadCommentBuilder");let FTheadCommentBuilder=_FTheadCommentBuilder;var _a;exports.FThreadComment=(_a=class{constructor(_thread,_parent,_injector,_commandService,_univerInstanceService,_threadCommentModel,_userManagerService){this._thread=_thread,this._parent=_parent,this._injector=_injector,this._commandService=_commandService,this._univerInstanceService=_univerInstanceService,this._threadCommentModel=_threadCommentModel,this._userManagerService=_userManagerService}_getRef(){var _a2;const ref=((_a2=this._parent)==null?void 0:_a2.ref)||this._thread.ref;return engineFormula.deserializeRangeWithSheet(ref).range}getIsRoot(){return!this._parent}getCommentData(){const{children,...comment}=this._thread;return comment}getReplies(){var _a2;const range=this._getRef(),comments=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,range.startRow,range.startColumn);return(_a2=comments==null?void 0:comments.children)==null?void 0:_a2.map(child=>this._injector.createInstance(exports.FThreadComment,child))}getRange(){const workbook=this._univerInstanceService.getUnit(this._thread.unitId,core.UniverInstanceType.UNIVER_SHEET);if(!workbook)return null;const worksheet=workbook.getSheetBySheetId(this._thread.subUnitId);if(!worksheet)return null;const range=this._getRef();return this._injector.createInstance(facade.FRange,workbook,worksheet,range)}getContent(){return this._thread.text}getRichText(){const body=this._thread.text;return core.RichTextValue.create({body,documentStyle:{},id:"d"})}deleteAsync(){return this._commandService.executeCommand(this.getIsRoot()?threadComment.DeleteCommentTreeCommand.id:threadComment.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}delete(){return this.deleteAsync()}async update(content){return this.updateAsync(content)}async updateAsync(content){const body=content instanceof core.RichTextValue?content.getData().body:content,dt=threadComment.getDT();return await this._commandService.executeCommand(threadComment.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:body,updated:!0,updateT:dt}})}resolve(resolved){return this.resolveAsync(resolved)}resolveAsync(resolved){return this._commandService.executeCommand(threadComment.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:resolved!=null?resolved:!this._thread.resolved})}async replyAsync(comment){var _a2;const commentData=comment.build();return this._commandService.executeCommand(threadComment.AddCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,comment:{id:core.generateRandomId(),parentId:this._thread.id,threadId:this._thread.threadId,ref:(_a2=this._parent)==null?void 0:_a2.ref,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,text:commentData.text,attachments:commentData.attachments,dT:commentData.dT||threadComment.getDT(),personId:commentData.personId||this._userManagerService.getCurrentUser().userID}})}},__name(_a,"FThreadComment"),_a);exports.FThreadComment=__decorateClass([__decorateParam(2,core.Inject(core.Injector)),__decorateParam(3,core.ICommandService),__decorateParam(4,core.IUniverInstanceService),__decorateParam(5,core.Inject(sheetsThreadComment.SheetsThreadCommentModel)),__decorateParam(6,core.Inject(core.UserManagerService))],exports.FThreadComment);const _FRangeCommentMixin=class _FRangeCommentMixin extends facade.FRange{getComment(){const sheetsTheadCommentModel=this._injector.get(sheetsThreadComment.SheetsThreadCommentModel),unitId=this._workbook.getUnitId(),sheetId=this._worksheet.getSheetId(),commentId=sheetsTheadCommentModel.getByLocation(unitId,sheetId,this._range.startRow,this._range.startColumn);if(!commentId)return null;const comment=sheetsTheadCommentModel.getComment(unitId,sheetId,commentId);return comment?this._injector.createInstance(exports.FThreadComment,comment):null}getComments(){const sheetsTheadCommentModel=this._injector.get(sheetsThreadComment.SheetsThreadCommentModel),unitId=this._workbook.getUnitId(),sheetId=this._worksheet.getSheetId(),comments=[];return core.Range.foreach(this._range,(row,col)=>{const commentId=sheetsTheadCommentModel.getByLocation(unitId,sheetId,row,col);if(commentId){const comment=sheetsTheadCommentModel.getComment(unitId,sheetId,commentId);comment&&comments.push(this._injector.createInstance(exports.FThreadComment,comment))}}),comments}addComment(content){var _a2;const injector=this._injector,currentComment=(_a2=this.getComment())==null?void 0:_a2.getCommentData(),commentService=injector.get(core.ICommandService),userService=injector.get(core.UserManagerService),unitId=this._workbook.getUnitId(),sheetId=this._worksheet.getSheetId(),refStr=`${core.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,currentUser=userService.getCurrentUser(),commentData=content instanceof FTheadCommentBuilder?content.build():{text:content};return commentService.executeCommand(threadComment.AddCommentCommand.id,{unitId,subUnitId:sheetId,comment:{text:commentData.text,dT:commentData.dT||threadComment.getDT(),attachments:[],id:commentData.id||core.generateRandomId(),ref:refStr,personId:commentData.personId||currentUser.userID,parentId:currentComment==null?void 0:currentComment.id,unitId,subUnitId:sheetId,threadId:(currentComment==null?void 0:currentComment.threadId)||core.generateRandomId()}})}clearComment(){var _a2;const injector=this._injector,currentComment=(_a2=this.getComment())==null?void 0:_a2.getCommentData(),commentService=injector.get(core.ICommandService),unitId=this._workbook.getUnitId(),sheetId=this._worksheet.getSheetId();return currentComment?commentService.executeCommand(threadComment.DeleteCommentTreeCommand.id,{unitId,subUnitId:sheetId,threadId:currentComment.threadId,commentId:currentComment.id}):Promise.resolve(!0)}clearComments(){const promises=this.getComments().map(comment=>comment.deleteAsync());return Promise.all(promises).then(()=>!0)}addCommentAsync(content){return this.addComment(content)}clearCommentAsync(){return this.clearComment()}clearCommentsAsync(){return this.clearComments()}};__name(_FRangeCommentMixin,"FRangeCommentMixin");let FRangeCommentMixin=_FRangeCommentMixin;facade.FRange.extend(FRangeCommentMixin);const _FWorkbookThreadCommentMixin=class _FWorkbookThreadCommentMixin extends facade.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(threadComment.ThreadCommentModel)}})}getComments(){return this._threadCommentModel.getUnit(this._workbook.getUnitId()).map(i=>this._injector.createInstance(exports.FThreadComment,i.root))}clearComments(){const promises=this.getComments().map(comment=>comment.deleteAsync());return Promise.all(promises).then(()=>!0)}onThreadCommentChange(callback){return core.toDisposable(this._threadCommentModel.commentUpdate$.pipe(rxjs.filter(change=>change.unitId===this._workbook.getUnitId())).subscribe(callback))}onBeforeAddThreadComment(callback){return core.toDisposable(this._commandService.beforeCommandExecuted((commandInfo,options)=>{const params=commandInfo.params;if(commandInfo.id===threadComment.AddCommentCommand.id){if(params.unitId!==this._workbook.getUnitId())return;if(callback(params,options)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(callback){return core.toDisposable(this._commandService.beforeCommandExecuted((commandInfo,options)=>{const params=commandInfo.params;if(commandInfo.id===threadComment.UpdateCommentCommand.id){if(params.unitId!==this._workbook.getUnitId())return;if(callback(params,options)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(callback){return core.toDisposable(this._commandService.beforeCommandExecuted((commandInfo,options)=>{const params=commandInfo.params;if(commandInfo.id===threadComment.DeleteCommentCommand.id||commandInfo.id===threadComment.DeleteCommentTreeCommand.id){if(params.unitId!==this._workbook.getUnitId())return;if(callback(params,options)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}};__name(_FWorkbookThreadCommentMixin,"FWorkbookThreadCommentMixin");let FWorkbookThreadCommentMixin=_FWorkbookThreadCommentMixin;facade.FWorkbook.extend(FWorkbookThreadCommentMixin);const _FWorksheetCommentMixin=class _FWorksheetCommentMixin extends facade.FWorksheet{getComments(){return this._injector.get(sheetsThreadComment.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(comment=>this._injector.createInstance(exports.FThreadComment,comment))}clearComments(){const promises=this.getComments().map(comment=>comment.deleteAsync());return Promise.all(promises).then(()=>!0)}onCommented(callback){return this._injector.get(core.ICommandService).onCommandExecuted(command=>{if(command.id===threadComment.AddCommentCommand.id){const params=command.params;callback(params)}})}getCommentById(commentId){const comment=this._injector.get(sheetsThreadComment.SheetsThreadCommentModel).getComment(this._workbook.getUnitId(),this._worksheet.getSheetId(),commentId);if(comment)return this._injector.createInstance(exports.FThreadComment,comment)}};__name(_FWorksheetCommentMixin,"FWorksheetCommentMixin");let FWorksheetCommentMixin=_FWorksheetCommentMixin;facade.FWorksheet.extend(FWorksheetCommentMixin);const CommentEvent={CommentAdded:"CommentAdded",BeforeCommentAdd:"BeforeCommentAdd",CommentUpdated:"CommentUpdated",BeforeCommentUpdate:"BeforeCommentUpdate",CommentDeleted:"CommentDeleted",BeforeCommentDeleted:"BeforeCommentDeleted",CommentResolved:"CommentResolved",BeforeCommentResolve:"BeforeCommentResolve"},_FCommentEvent=class _FCommentEvent extends core.FEventName{get CommentAdded(){return CommentEvent.CommentAdded}get BeforeCommentAdd(){return CommentEvent.BeforeCommentAdd}get CommentUpdated(){return CommentEvent.CommentUpdated}get BeforeCommentUpdate(){return CommentEvent.BeforeCommentUpdate}get CommentDeleted(){return CommentEvent.CommentDeleted}get BeforeCommentDeleted(){return CommentEvent.BeforeCommentDeleted}get CommentResolved(){return CommentEvent.CommentResolved}get BeforeCommentResolve(){return CommentEvent.BeforeCommentResolve}};__name(_FCommentEvent,"FCommentEvent");let FCommentEvent=_FCommentEvent;core.FEventName.extend(FCommentEvent);
package/lib/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var w=Object.defineProperty;var S=(c,a,e)=>a in c?w(c,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[a]=e;var _=(c,a,e)=>S(c,typeof a!="symbol"?a+"":a,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@univerjs/core"),u=require("@univerjs/engine-formula"),g=require("@univerjs/sheets"),f=require("@univerjs/thread-comment"),T=require("rxjs");var I=Object.defineProperty,y=Object.getOwnPropertyDescriptor,b=(c,a,e,n)=>{for(var t=n>1?void 0:n?y(a,e):a,r=c.length-1,o;r>=0;r--)(o=c[r])&&(t=(n?o(a,e,t):o(t))||t);return n&&t&&I(a,e,t),t},C=(c,a)=>(e,n)=>a(e,n,c);exports.SheetsThreadCommentModel=class extends d.Disposable{constructor(e,n){super();_(this,"_matrixMap",new Map);_(this,"_locationMap",new Map);_(this,"_commentUpdate$",new T.Subject);_(this,"commentUpdate$",this._commentUpdate$.asObservable());this._threadCommentModel=e,this._univerInstanceService=n,this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let t=this._matrixMap.get(e);t||(t=new Map,this._matrixMap.set(e,t));let r=t.get(n);return r||(r=new d.ObjectMatrix,t.set(n,r)),r}_ensureCommentLocationMap(e,n){let t=this._locationMap.get(e);t||(t=new Map,this._locationMap.set(e,t));let r=t.get(n);return r||(r=new Map,t.set(n,r)),r}_addCommentToMatrix(e,n,t,r){var s;const o=(s=e.getValue(n,t))!=null?s:new Set;o.add(r),e.setValue(n,t,o)}_deleteCommentFromMatrix(e,n,t,r){if(n>=0&&t>=0){const o=e.getValue(n,t);o&&o.has(r)&&(o.delete(r),o.size===0&&e.realDeleteValue(n,t))}}_ensure(e,n){const t=this._ensureCommentMatrix(e,n),r=this._ensureCommentLocationMap(e,n);return{matrix:t,locationMap:r}}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:o,root:s}=t;this._addComment(r,o,s)}}_addComment(e,n,t){const r=u.singleReferenceToGrid(t.ref),o=t.parentId,{row:s,column:i}=r,m=t.id,{matrix:h,locationMap:l}=this._ensure(e,n);!o&&s>=0&&i>=0&&(this._addCommentToMatrix(h,s,i,m),l.set(m,{row:s,column:i})),o||this._commentUpdate$.next({unitId:e,subUnitId:n,payload:t,type:"add",isRoot:!o,...r})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;try{if(this._univerInstanceService.getUnitType(n)!==d.UniverInstanceType.UNIVER_SHEET)return}catch{}const{matrix:r,locationMap:o}=this._ensure(n,t);switch(e.type){case"add":{this._addComment(e.unitId,e.subUnitId,e.payload);break}case"delete":{const{isRoot:s,comment:i}=e.payload;if(s){const m=u.singleReferenceToGrid(i.ref),{row:h,column:l}=m;this._deleteCommentFromMatrix(r,h,l,i.id),this._commentUpdate$.next({...e,...m})}break}case"update":{const{commentId:s}=e.payload,i=this._threadCommentModel.getComment(n,t,s);if(!i)return;const m=u.singleReferenceToGrid(i.ref);this._commentUpdate$.next({...e,...m});break}case"updateRef":{const s=u.singleReferenceToGrid(e.payload.ref),{commentId:i}=e.payload,m=o.get(i);if(!m)return;const{row:h,column:l}=m;this._deleteCommentFromMatrix(r,h,l,i),o.delete(i),s.row>=0&&s.column>=0&&(this._addCommentToMatrix(r,s.row,s.column,i),o.set(i,{row:s.row,column:s.column})),this._commentUpdate$.next({...e,...s});break}case"resolve":{const{unitId:s,subUnitId:i,payload:m}=e,{locationMap:h}=this._ensure(s,i),l=h.get(m.commentId);l&&this._commentUpdate$.next({...e,...l});break}}}))}getByLocation(e,n,t,r){var i;return(i=this.getAllByLocation(e,n,t,r).filter(m=>!m.resolved)[0])==null?void 0:i.id}getAllByLocation(e,n,t,r){const s=this._ensureCommentMatrix(e,n).getValue(t,r);return s?Array.from(s).map(i=>this.getComment(e,n,i)).filter(Boolean):[]}getComment(e,n,t){return this._threadCommentModel.getComment(e,n,t)}getCommentWithChildren(e,n,t,r){const o=this.getByLocation(e,n,t,r);if(!o)return;const s=this.getComment(e,n,o);if(s)return this._threadCommentModel.getThread(e,n,s.threadId)}showCommentMarker(e,n,t,r){const o=this.getByLocation(e,n,t,r);if(!o)return!1;const s=this.getComment(e,n,o);return!!(s&&!s.resolved)}getSubUnitAll(e,n){return this._threadCommentModel.getUnit(e).filter(t=>t.subUnitId===n).map(t=>t.root)}};exports.SheetsThreadCommentModel=b([C(0,d.Inject(f.ThreadCommentModel)),C(1,d.IUniverInstanceService)],exports.SheetsThreadCommentModel);var U=Object.defineProperty,x=Object.getOwnPropertyDescriptor,P=(c,a,e,n)=>{for(var t=n>1?void 0:n?x(a,e):a,r=c.length-1,o;r>=0;r--)(o=c[r])&&(t=(n?o(a,e,t):o(t))||t);return n&&t&&U(a,e,t),t},p=(c,a)=>(e,n)=>a(e,n,c);exports.SheetsThreadCommentRefRangeController=class extends d.Disposable{constructor(e,n,t,r,o){super();_(this,"_disposableMap",new Map);_(this,"_watcherMap",new Map);_(this,"_handleRangeChange",(e,n,t,r,o)=>{const s=t.id,i={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};return r?{redos:[{id:f.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:u.serializeRange(r),commentId:s},silent:o}}],undos:[{id:f.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:u.serializeRange(i),commentId:s},silent:o}}]}:{redos:[{id:f.DeleteCommentMutation.id,params:{unitId:e,subUnitId:n,commentId:s}}],undos:[{id:f.AddCommentMutation.id,params:{unitId:e,subUnitId:n,comment:t,sync:!0}}]}});this._refRangeService=e,this._sheetsThreadCommentModel=n,this._threadCommentModel=t,this._selectionManagerService=r,this._commandService=o,this._initData(),this._initRefRange()}_getIdWithUnitId(e,n,t){return`${e}-${n}-${t}`}_register(e,n,t){const r=t.id,o={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._disposableMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.registerRefRange(o,s=>{const i=g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(o,s,{selectionManagerService:this._selectionManagerService}),m=Array.isArray(i)?i[0]:i;return m&&m.startColumn===o.startColumn&&m.startRow===o.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,n,t,m,!1)},e,n))}_watch(e,n,t){const r=t.id,o={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._watcherMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.watchRange(e,n,o,(s,i)=>{const{redos:m}=this._handleRangeChange(e,n,t,i,!0);d.sequenceExecuteAsync(m,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,n,t){var o;const r=this._getIdWithUnitId(e,n,t);(o=this._watcherMap.get(r))==null||o.dispose(),this._watcherMap.delete(r)}_unregister(e,n,t){var o;const r=this._getIdWithUnitId(e,n,t);(o=this._disposableMap.get(r))==null||o.dispose(),this._disposableMap.delete(r)}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:o,root:s}=t,i=u.singleReferenceToGrid(s.ref),m={...s,...i};this._register(r,o,m),this._watch(r,o,m)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;switch(e.type){case"add":{if(e.payload.parentId)return;const r={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,r),this._watch(e.unitId,e.subUnitId,r);break}case"delete":{this._unregister(n,t,e.payload.commentId),this._unwatch(n,t,e.payload.commentId);break}case"updateRef":{const r=this._sheetsThreadCommentModel.getComment(n,t,e.payload.commentId);if(!r)return;this._unregister(n,t,e.payload.commentId);const o={...r,row:e.row,column:e.column};e.silent||(this._unwatch(n,t,e.payload.commentId),this._watch(n,t,o)),this._register(e.unitId,e.subUnitId,o);break}}})),this.disposeWithMe(d.toDisposable(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}};exports.SheetsThreadCommentRefRangeController=P([p(0,d.Inject(g.RefRangeService)),p(1,d.Inject(exports.SheetsThreadCommentModel)),p(2,d.Inject(f.ThreadCommentModel)),p(3,d.Inject(g.SheetsSelectionsService)),p(4,d.ICommandService)],exports.SheetsThreadCommentRefRangeController);const $="SHEET_THREAD_COMMENT_BASE_PLUGIN";var R=Object.defineProperty,E=Object.getOwnPropertyDescriptor,j=(c,a,e)=>a in c?R(c,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[a]=e,D=(c,a,e,n)=>{for(var t=n>1?void 0:n?E(a,e):a,r=c.length-1,o;r>=0;r--)(o=c[r])&&(t=(n?o(a,e,t):o(t))||t);return n&&t&&R(a,e,t),t},M=(c,a)=>(e,n)=>a(e,n,c),v=(c,a,e)=>j(c,typeof a!="symbol"?a+"":a,e);exports.UniverSheetsThreadCommentPlugin=class extends d.Plugin{constructor(a,e,n){super(),this._injector=e,this._commandService=n}onStarting(){[[exports.SheetsThreadCommentModel],[exports.SheetsThreadCommentRefRangeController]].forEach(a=>{this._injector.add(a)}),this._injector.get(exports.SheetsThreadCommentRefRangeController)}};v(exports.UniverSheetsThreadCommentPlugin,"pluginName",$);v(exports.UniverSheetsThreadCommentPlugin,"type",d.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsThreadCommentPlugin=D([d.DependentOn(f.UniverThreadCommentPlugin),M(1,d.Inject(d.Injector)),M(2,d.Inject(d.ICommandService))],exports.UniverSheetsThreadCommentPlugin);
1
+ "use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),engineFormula=require("@univerjs/engine-formula"),sheets=require("@univerjs/sheets"),threadComment=require("@univerjs/thread-comment"),rxjs=require("rxjs");var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2"),_a;exports.SheetsThreadCommentModel=(_a=class extends core.Disposable{constructor(_threadCommentModel,_univerInstanceService){super();__publicField(this,"_matrixMap",new Map);__publicField(this,"_locationMap",new Map);__publicField(this,"_commentUpdate$",new rxjs.Subject);__publicField(this,"commentUpdate$",this._commentUpdate$.asObservable());this._threadCommentModel=_threadCommentModel,this._univerInstanceService=_univerInstanceService,this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(unitId,subUnitId){let unitMap=this._matrixMap.get(unitId);unitMap||(unitMap=new Map,this._matrixMap.set(unitId,unitMap));let subUnitMap=unitMap.get(subUnitId);return subUnitMap||(subUnitMap=new core.ObjectMatrix,unitMap.set(subUnitId,subUnitMap)),subUnitMap}_ensureCommentLocationMap(unitId,subUnitId){let unitMap=this._locationMap.get(unitId);unitMap||(unitMap=new Map,this._locationMap.set(unitId,unitMap));let subUnitMap=unitMap.get(subUnitId);return subUnitMap||(subUnitMap=new Map,unitMap.set(subUnitId,subUnitMap)),subUnitMap}_addCommentToMatrix(matrix,row,column,commentId){var _a4;const current=(_a4=matrix.getValue(row,column))!=null?_a4:new Set;current.add(commentId),matrix.setValue(row,column,current)}_deleteCommentFromMatrix(matrix,row,column,commentId){if(row>=0&&column>=0){const current=matrix.getValue(row,column);current&&current.has(commentId)&&(current.delete(commentId),current.size===0&&matrix.realDeleteValue(row,column))}}_ensure(unitId,subUnitId){const matrix=this._ensureCommentMatrix(unitId,subUnitId),locationMap=this._ensureCommentLocationMap(unitId,subUnitId);return{matrix,locationMap}}_initData(){const datas=this._threadCommentModel.getAll();for(const data of datas)for(const thread of data.threads){const{unitId,subUnitId,root}=thread;this._addComment(unitId,subUnitId,root)}}_addComment(unitId,subUnitId,comment){const location=engineFormula.singleReferenceToGrid(comment.ref),parentId=comment.parentId,{row,column}=location,commentId=comment.id,{matrix,locationMap}=this._ensure(unitId,subUnitId);!parentId&&row>=0&&column>=0&&(this._addCommentToMatrix(matrix,row,column,commentId),locationMap.set(commentId,{row,column})),parentId||this._commentUpdate$.next({unitId,subUnitId,payload:comment,type:"add",isRoot:!parentId,...location})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(update=>{const{unitId,subUnitId}=update;try{if(this._univerInstanceService.getUnitType(unitId)!==core.UniverInstanceType.UNIVER_SHEET)return}catch{}const{matrix,locationMap}=this._ensure(unitId,subUnitId);switch(update.type){case"add":{this._addComment(update.unitId,update.subUnitId,update.payload);break}case"delete":{const{isRoot,comment}=update.payload;if(isRoot){const location=engineFormula.singleReferenceToGrid(comment.ref),{row,column}=location;this._deleteCommentFromMatrix(matrix,row,column,comment.id),this._commentUpdate$.next({...update,...location})}break}case"update":{const{commentId}=update.payload,comment=this._threadCommentModel.getComment(unitId,subUnitId,commentId);if(!comment)return;const location=engineFormula.singleReferenceToGrid(comment.ref);this._commentUpdate$.next({...update,...location});break}case"updateRef":{const location=engineFormula.singleReferenceToGrid(update.payload.ref),{commentId}=update.payload,currentLoc=locationMap.get(commentId);if(!currentLoc)return;const{row,column}=currentLoc;this._deleteCommentFromMatrix(matrix,row,column,commentId),locationMap.delete(commentId),location.row>=0&&location.column>=0&&(this._addCommentToMatrix(matrix,location.row,location.column,commentId),locationMap.set(commentId,{row:location.row,column:location.column})),this._commentUpdate$.next({...update,...location});break}case"resolve":{const{unitId:unitId2,subUnitId:subUnitId2,payload}=update,{locationMap:locationMap2}=this._ensure(unitId2,subUnitId2),location=locationMap2.get(payload.commentId);location&&this._commentUpdate$.next({...update,...location});break}}}))}getByLocation(unitId,subUnitId,row,column){var _a4;return(_a4=this.getAllByLocation(unitId,subUnitId,row,column).filter(comment=>!comment.resolved)[0])==null?void 0:_a4.id}getAllByLocation(unitId,subUnitId,row,column){const current=this._ensureCommentMatrix(unitId,subUnitId).getValue(row,column);return current?Array.from(current).map(id=>this.getComment(unitId,subUnitId,id)).filter(Boolean):[]}getComment(unitId,subUnitId,commentId){return this._threadCommentModel.getComment(unitId,subUnitId,commentId)}getCommentWithChildren(unitId,subUnitId,row,column){const commentId=this.getByLocation(unitId,subUnitId,row,column);if(!commentId)return;const comment=this.getComment(unitId,subUnitId,commentId);if(comment)return this._threadCommentModel.getThread(unitId,subUnitId,comment.threadId)}showCommentMarker(unitId,subUnitId,row,column){const commentId=this.getByLocation(unitId,subUnitId,row,column);if(!commentId)return!1;const comment=this.getComment(unitId,subUnitId,commentId);return!!(comment&&!comment.resolved)}getSubUnitAll(unitId,subUnitId){return this._threadCommentModel.getUnit(unitId).filter(i=>i.subUnitId===subUnitId).map(i=>i.root)}},__name(_a,"SheetsThreadCommentModel"),_a);exports.SheetsThreadCommentModel=__decorateClass$2([__decorateParam$2(0,core.Inject(threadComment.ThreadCommentModel)),__decorateParam$2(1,core.IUniverInstanceService)],exports.SheetsThreadCommentModel);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1"),_a2;exports.SheetsThreadCommentRefRangeController=(_a2=class extends core.Disposable{constructor(_refRangeService,_sheetsThreadCommentModel,_threadCommentModel,_selectionManagerService,_commandService){super();__publicField(this,"_disposableMap",new Map);__publicField(this,"_watcherMap",new Map);__publicField(this,"_handleRangeChange",__name((unitId,subUnitId,comment,resultRange,silent)=>{const commentId=comment.id,oldRange={startColumn:comment.column,endColumn:comment.column,startRow:comment.row,endRow:comment.row};return resultRange?{redos:[{id:threadComment.UpdateCommentRefMutation.id,params:{unitId,subUnitId,payload:{ref:engineFormula.serializeRange(resultRange),commentId},silent}}],undos:[{id:threadComment.UpdateCommentRefMutation.id,params:{unitId,subUnitId,payload:{ref:engineFormula.serializeRange(oldRange),commentId},silent}}]}:{redos:[{id:threadComment.DeleteCommentMutation.id,params:{unitId,subUnitId,commentId}}],undos:[{id:threadComment.AddCommentMutation.id,params:{unitId,subUnitId,comment,sync:!0}}]}},"_handleRangeChange"));this._refRangeService=_refRangeService,this._sheetsThreadCommentModel=_sheetsThreadCommentModel,this._threadCommentModel=_threadCommentModel,this._selectionManagerService=_selectionManagerService,this._commandService=_commandService,this._initData(),this._initRefRange()}_getIdWithUnitId(unitId,subUnitId,id){return`${unitId}-${subUnitId}-${id}`}_register(unitId,subUnitId,comment){const commentId=comment.id,oldRange={startColumn:comment.column,endColumn:comment.column,startRow:comment.row,endRow:comment.row};this._disposableMap.set(this._getIdWithUnitId(unitId,subUnitId,commentId),this._refRangeService.registerRefRange(oldRange,commandInfo=>{const resultRanges=sheets.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(oldRange,commandInfo,{selectionManagerService:this._selectionManagerService}),resultRange=Array.isArray(resultRanges)?resultRanges[0]:resultRanges;return resultRange&&resultRange.startColumn===oldRange.startColumn&&resultRange.startRow===oldRange.startRow?{undos:[],redos:[]}:this._handleRangeChange(unitId,subUnitId,comment,resultRange,!1)},unitId,subUnitId))}_watch(unitId,subUnitId,comment){const commentId=comment.id,oldRange={startColumn:comment.column,endColumn:comment.column,startRow:comment.row,endRow:comment.row};this._watcherMap.set(this._getIdWithUnitId(unitId,subUnitId,commentId),this._refRangeService.watchRange(unitId,subUnitId,oldRange,(before,after)=>{const{redos}=this._handleRangeChange(unitId,subUnitId,comment,after,!0);core.sequenceExecuteAsync(redos,this._commandService,{onlyLocal:!0})},!0))}_unwatch(unitId,subUnitId,commentId){var _a4;const id=this._getIdWithUnitId(unitId,subUnitId,commentId);(_a4=this._watcherMap.get(id))==null||_a4.dispose(),this._watcherMap.delete(id)}_unregister(unitId,subUnitId,commentId){var _a4;const id=this._getIdWithUnitId(unitId,subUnitId,commentId);(_a4=this._disposableMap.get(id))==null||_a4.dispose(),this._disposableMap.delete(id)}_initData(){const datas=this._threadCommentModel.getAll();for(const data of datas)for(const thread of data.threads){const{unitId,subUnitId,root}=thread,pos=engineFormula.singleReferenceToGrid(root.ref),sheetComment={...root,...pos};this._register(unitId,subUnitId,sheetComment),this._watch(unitId,subUnitId,sheetComment)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(option=>{const{unitId,subUnitId}=option;switch(option.type){case"add":{if(option.payload.parentId)return;const comment={...option.payload,row:option.row,column:option.column};this._register(option.unitId,option.subUnitId,comment),this._watch(option.unitId,option.subUnitId,comment);break}case"delete":{this._unregister(unitId,subUnitId,option.payload.commentId),this._unwatch(unitId,subUnitId,option.payload.commentId);break}case"updateRef":{const comment=this._sheetsThreadCommentModel.getComment(unitId,subUnitId,option.payload.commentId);if(!comment)return;this._unregister(unitId,subUnitId,option.payload.commentId);const sheetComment={...comment,row:option.row,column:option.column};option.silent||(this._unwatch(unitId,subUnitId,option.payload.commentId),this._watch(unitId,subUnitId,sheetComment)),this._register(option.unitId,option.subUnitId,sheetComment);break}}})),this.disposeWithMe(core.toDisposable(()=>{this._disposableMap.forEach(item=>{item.dispose()}),this._disposableMap.clear()}))}},__name(_a2,"SheetsThreadCommentRefRangeController"),_a2);exports.SheetsThreadCommentRefRangeController=__decorateClass$1([__decorateParam$1(0,core.Inject(sheets.RefRangeService)),__decorateParam$1(1,core.Inject(exports.SheetsThreadCommentModel)),__decorateParam$1(2,core.Inject(threadComment.ThreadCommentModel)),__decorateParam$1(3,core.Inject(sheets.SheetsSelectionsService)),__decorateParam$1(4,core.ICommandService)],exports.SheetsThreadCommentRefRangeController);const SHEET_THREAD_COMMENT_BASE="SHEET_THREAD_COMMENT_BASE_PLUGIN";var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField"),_a3;exports.UniverSheetsThreadCommentPlugin=(_a3=class extends core.Plugin{constructor(config,_injector,_commandService){super(),this._injector=_injector,this._commandService=_commandService}onStarting(){[[exports.SheetsThreadCommentModel],[exports.SheetsThreadCommentRefRangeController]].forEach(dep=>{this._injector.add(dep)}),this._injector.get(exports.SheetsThreadCommentRefRangeController)}},__name(_a3,"UniverSheetsThreadCommentPlugin"),_a3);__publicField2(exports.UniverSheetsThreadCommentPlugin,"pluginName",SHEET_THREAD_COMMENT_BASE);__publicField2(exports.UniverSheetsThreadCommentPlugin,"type",core.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsThreadCommentPlugin=__decorateClass([core.DependentOn(threadComment.UniverThreadCommentPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.Inject(core.ICommandService))],exports.UniverSheetsThreadCommentPlugin);