@univerjs/sheets-thread-comment-ui 0.5.0-nightly.202411281606 → 0.5.0-nightly.202411291606

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ce=Object.defineProperty;var Se=(o,t,n)=>t in o?Ce(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n;var D=(o,t,n)=>Se(o,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),C=require("@univerjs/sheets"),N=require("@univerjs/sheets-thread-comment"),T=require("@univerjs/thread-comment-ui"),I=require("@univerjs/sheets-ui"),S=require("@univerjs/ui"),k=require("rxjs"),ae=require("@univerjs/engine-render"),R=require("react"),x=require("@univerjs/engine-formula"),_=require("@univerjs/thread-comment"),ce="univer.sheet.thread-comment-modal",te="comment-single",ne="SHEET_THREAD_COMMENT";var _e=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,Ie=(o,t,n,e)=>{for(var r=e>1?void 0:e?fe(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&_e(t,n,r),r},oe=(o,t)=>(n,e)=>t(n,e,o);exports.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(n,e){super();D(this,"_lastPopup",null);D(this,"_activePopup");D(this,"_activePopup$",new k.BehaviorSubject(null));D(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var d;const{row:r,col:i,unitId:s,subUnitId:c}=n;if(this._activePopup&&r===this._activePopup.row&&i===this._activePopup.col&&s===this._activePopup.unitId&&c===((d=this.activePopup)==null?void 0:d.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const m=this._canvasPopupManagerService.attachPopupToCell(r,i,{componentKey:ce,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!m)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const u=new a.DisposableCollection;u.add(m),u.add({dispose:()=>{e==null||e()}}),this._lastPopup=u}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}};exports.SheetsThreadCommentPopupService=Ie([oe(0,a.Inject(I.SheetCanvasPopManagerService)),oe(1,S.IZenZoneService)],exports.SheetsThreadCommentPopupService);const A={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(o){var f;const t=o.get(C.SheetsSelectionsService),n=o.get(a.IUniverInstanceService),e=o.get(exports.SheetsThreadCommentPopupService),r=o.get(T.ThreadCommentPanelService),i=(f=t.getCurrentLastSelection())==null?void 0:f.primary,s=o.get(N.SheetsThreadCommentModel);if(!i)return!1;const c=C.getSheetCommandTarget(n);if(!c)return!1;const{workbook:m,worksheet:u,unitId:d,subUnitId:h}=c,l={workbook:m,worksheet:u,unitId:d,subUnitId:h,row:i.startRow,col:i.startColumn};e.showPopup(l);const p=s.getByLocation(d,h,i.startRow,i.startColumn);return p&&r.setActiveComment({unitId:d,subUnitId:h,commentId:p,trigger:"context-menu"}),!0}},ge="sheets-thread-comment.config",Pe={};var Te=Object.defineProperty,be=Object.getOwnPropertyDescriptor,ye=(o,t,n,e)=>{for(var r=e>1?void 0:e?be(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Te(t,n,r),r},H=(o,t)=>(n,e)=>t(n,e,o);let F=class extends a.Disposable{constructor(o,t,n,e){super(),this._sheetInterceptorService=o,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(C.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(o,t,n)=>{const{row:e,col:r,unitId:i,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(i,s,e,r)?n({...o,markers:{...o==null?void 0:o.markers,tr:{color:"#FFBD37",size:6}}}):n(o)},priority:100}))}_initSkeletonChange(){const o=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{o()}))}};F=ye([H(0,a.Inject(C.SheetInterceptorService)),H(1,a.Inject(N.SheetsThreadCommentModel)),H(2,a.IUniverInstanceService),H(3,ae.IRenderManagerService)],F);var w=function(){return w=Object.assign||function(o){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(o[r]=t[r])}return o},w.apply(this,arguments)},Me=function(o,t){var n={};for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&t.indexOf(e)<0&&(n[e]=o[e]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(o);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(o,e[r])&&(n[e[r]]=o[e[r]]);return n},me=R.forwardRef(function(o,t){var n=o.icon,e=o.id,r=o.className,i=o.extend,s=Me(o,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),m=R.useRef("_".concat(Re()));return de(n,"".concat(e),{defIds:n.defIds,idSuffix:m.current},w({ref:t,className:c},s),i)});function de(o,t,n,e,r){return R.createElement(o.tag,w(w({key:t},we(o,n,r)),e),(Ue(o,n).children||[]).map(function(i,s){return de(i,"".concat(t,"-").concat(o.tag,"-").concat(s),n,void 0,r)}))}function we(o,t,n){var e=w({},o.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(o.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(i){var s=i[0],c=i[1];typeof c=="string"&&(e[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function Ue(o,t){var n,e=t.defIds;return!e||e.length===0?o:o.tag==="defs"&&(!((n=o.children)===null||n===void 0)&&n.length)?w(w({},o),{children:o.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?w(w({},r),{attrs:w(w({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):o}function Re(){return Math.random().toString(36).substring(2,8)}me.displayName="UniverIcon";var Oe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ue=R.forwardRef(function(o,t){return R.createElement(me,Object.assign({},o,{id:"comment-single",ref:t,icon:Oe}))});ue.displayName="CommentSingle";var K={exports:{}},B={};/**
1
+ "use strict";var Ce=Object.defineProperty;var Se=(o,t,n)=>t in o?Ce(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n;var D=(o,t,n)=>Se(o,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),C=require("@univerjs/sheets"),$=require("@univerjs/sheets-thread-comment"),T=require("@univerjs/thread-comment-ui"),I=require("@univerjs/sheets-ui"),S=require("@univerjs/ui"),k=require("rxjs"),ae=require("@univerjs/engine-render"),x=require("@univerjs/engine-formula"),_=require("@univerjs/thread-comment"),R=require("react"),ce="univer.sheet.thread-comment-modal",te="comment-single",ne="SHEET_THREAD_COMMENT";var _e=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,Ie=(o,t,n,e)=>{for(var r=e>1?void 0:e?fe(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&_e(t,n,r),r},oe=(o,t)=>(n,e)=>t(n,e,o);exports.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(n,e){super();D(this,"_lastPopup",null);D(this,"_activePopup");D(this,"_activePopup$",new k.BehaviorSubject(null));D(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var d;const{row:r,col:i,unitId:s,subUnitId:c}=n;if(this._activePopup&&r===this._activePopup.row&&i===this._activePopup.col&&s===this._activePopup.unitId&&c===((d=this.activePopup)==null?void 0:d.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const m=this._canvasPopupManagerService.attachPopupToCell(r,i,{componentKey:ce,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!m)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const u=new a.DisposableCollection;u.add(m),u.add({dispose:()=>{e==null||e()}}),this._lastPopup=u}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}};exports.SheetsThreadCommentPopupService=Ie([oe(0,a.Inject(I.SheetCanvasPopManagerService)),oe(1,S.IZenZoneService)],exports.SheetsThreadCommentPopupService);const A={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(o){var f;const t=o.get(C.SheetsSelectionsService),n=o.get(a.IUniverInstanceService),e=o.get(exports.SheetsThreadCommentPopupService),r=o.get(T.ThreadCommentPanelService),i=(f=t.getCurrentLastSelection())==null?void 0:f.primary,s=o.get($.SheetsThreadCommentModel);if(!i)return!1;const c=C.getSheetCommandTarget(n);if(!c)return!1;const{workbook:m,worksheet:u,unitId:d,subUnitId:h}=c,l={workbook:m,worksheet:u,unitId:d,subUnitId:h,row:i.startRow,col:i.startColumn};e.showPopup(l);const p=s.getByLocation(d,h,i.startRow,i.startColumn);return p&&r.setActiveComment({unitId:d,subUnitId:h,commentId:p,trigger:"context-menu"}),!0}},ge="sheets-thread-comment.config",Pe={};var Te=Object.defineProperty,be=Object.getOwnPropertyDescriptor,ye=(o,t,n,e)=>{for(var r=e>1?void 0:e?be(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Te(t,n,r),r},H=(o,t)=>(n,e)=>t(n,e,o);let F=class extends a.Disposable{constructor(o,t,n,e){super(),this._sheetInterceptorService=o,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(C.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(o,t,n)=>{const{row:e,col:r,unitId:i,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(i,s,e,r)?n({...o,markers:{...o==null?void 0:o.markers,tr:{color:"#FFBD37",size:6}}}):n(o)},priority:100}))}_initSkeletonChange(){const o=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{o()}))}};F=ye([H(0,a.Inject(C.SheetInterceptorService)),H(1,a.Inject($.SheetsThreadCommentModel)),H(2,a.IUniverInstanceService),H(3,ae.IRenderManagerService)],F);var Me=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Ue=(o,t,n,e)=>{for(var r=e>1?void 0:e?we(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Me(t,n,r),r},K=(o,t)=>(n,e)=>t(n,e,o);const Re=(o,t,n)=>{const e=x.singleReferenceToGrid(o),r=n.row-t.row,i=n.column-t.column,s={startColumn:e.column+i,startRow:e.row+r,endColumn:e.column+i,endRow:e.row+r};return x.serializeRange(s)};let q=class extends a.Disposable{constructor(t,n,e){super();D(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:ne,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:i,subUnitId:s,range:c}=n,m={row:c.rows[0],column:c.cols[0]};if(r.copyType===I.COPY_TYPE.CUT&&this._copyInfo){const{range:u,unitId:d,subUnitId:h}=this._copyInfo,l={row:u.startRow,column:u.startColumn};if(!(i===d&&s===h)){const p=[];a.Range.foreach(u,(y,v)=>{const M=this._sheetsThreadCommentModel.getAllByLocation(d,h,y,v);this._threadCommentDataSourceService.syncUpdateMutationToColla?M.forEach(g=>{p.push(g)}):M.forEach(({children:g,...O})=>{O.parentId||p.push(O)})});const f=[],b=[],N=[],V=[],J=y=>{f.unshift({id:_.DeleteCommentMutation.id,params:{unitId:d,subUnitId:h,commentId:y.id}}),N.push({id:_.AddCommentMutation.id,params:{unitId:i,subUnitId:s,comment:{...y,ref:Re(y.ref,l,m),unitId:i,subUnitId:s},sync:!0}}),b.push({id:_.AddCommentMutation.id,params:{unitId:d,subUnitId:h,comment:y,sync:!0}}),V.unshift({id:_.DeleteCommentMutation.id,params:{unitId:i,subUnitId:s,commentId:y.id}})};return p.forEach(y=>{J(y)}),{redos:[...f,...N],undos:[...V,...b]}}}return{redos:[],undos:[]}}}))}};q=Ue([K(0,a.Inject(I.ISheetClipboardService)),K(1,a.Inject($.SheetsThreadCommentModel)),K(2,_.IThreadCommentDataSourceService)],q);var Oe=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,je=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Oe(t,n,r),r},L=(o,t)=>(n,e)=>t(n,e,o);let G=class extends a.Disposable{constructor(o,t,n,e){super(),this._hoverManagerService=o,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(o=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(o&&(t&&t.temp||!t)){const{location:n}=o,{unitId:e,subUnitId:r,row:i,col:s}=n,c=this._sheetsThreadCommentModel.getByLocation(e,r,i,s);if(c){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]},[{startRow:i,startColumn:s,endRow:i,endColumn:s}]))return;const u=this._sheetsThreadCommentModel.getComment(e,r,c);u&&!u.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:i,col:s,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};G=je([L(0,a.Inject(I.HoverManagerService)),L(1,a.Inject(exports.SheetsThreadCommentPopupService)),L(2,a.Inject($.SheetsThreadCommentModel)),L(3,a.Inject(I.SheetPermissionInterceptorBaseController))],G);var De=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,$e=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ne(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&De(t,n,r),r},E=(o,t)=>(n,e)=>t(n,e,o);let Z=class extends a.Disposable{constructor(t,n,e,r,i,s,c,m,u,d){super();D(this,"_isSwitchToCommenting",!1);D(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=i,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=c,this._sheetSelectionService=m,this._editorBridgeService=u,this._renderManagerService=d,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var l,p,f;const r=(l=t[0])==null?void 0:l.range,i=this._renderManagerService.getRenderById(n),s=(p=i==null?void 0:i.with(I.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:p.skeleton;if(!s||!r)return;const c=s.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((f=r.rangeType)!=null?f:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&a.Rectangle.equals(c.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(T.SetActiveCommentOperation.id);return}const u=c.actualRow,d=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,u,d)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(T.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(n,e,u,d);h&&this._commandService.executeCommand(T.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===_.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:i,commentId:s}=e;n.unitId===r&&n.subUnitId===i&&n.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:i,trigger:s}=t,c=this._sheetsThreadCommentModel.getComment(e,r,i);if(!c||c.resolved)return;const m=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!m||m.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=m.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(C.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const h=x.singleReferenceToGrid(c.ref),{row:l,column:p}=h;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]},[{startRow:l,startColumn:p,endRow:l,endColumn:p}]))return;const b=1;if(await this._commandService.executeCommand(I.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-b,0),endRow:h.row+b,startColumn:Math.max(h.column-b,0),endColumn:h.column+b}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:h.row,col:h.column,commentId:c.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var l,p;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const i=this._sheetsThreadCommentModel.getComment(n,e,r);if(!i)return;const s=x.singleReferenceToGrid(i.ref),{row:c,column:m}=s;if(Number.isNaN(c)||Number.isNaN(m))return null;const u=(l=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:l.getSheetBySheetId(e),d=(p=u==null?void 0:u.getMergedCell(c,m))!=null?p:{startColumn:m,endColumn:m,startRow:c,endRow:c},h=this._markSelectionService.addShape({range:d,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};Z=$e([E(0,a.ICommandService),E(1,a.Inject(exports.SheetsThreadCommentPopupService)),E(2,a.Inject($.SheetsThreadCommentModel)),E(3,a.Inject(T.ThreadCommentPanelService)),E(4,a.IUniverInstanceService),E(5,a.Inject(I.SheetPermissionInterceptorBaseController)),E(6,I.IMarkSelectionService),E(7,a.Inject(C.SheetsSelectionsService)),E(8,I.IEditorBridgeService),E(9,ae.IRenderManagerService)],Z);var xe=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,Ve=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ae(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&xe(t,n,r),r},W=(o,t)=>(n,e)=>t(n,e,o);let z=class extends a.Disposable{constructor(o,t,n,e){super(),this._sheetInterceptorService=o,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:o=>{var t;if(o.id===C.RemoveSheetCommand.id){const n=o.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),i=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!i)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(r,i),c=Array.from(s.values()).filter(l=>!l.parentId),m=c.map(l=>l.id),u=this._threadCommentDataSourceService.syncUpdateMutationToColla,d=m.map(l=>({id:_.DeleteCommentMutation.id,params:{unitId:r,subUnitId:i,commentId:l}})),h=c.map(({children:l,...p})=>({id:_.AddCommentMutation.id,params:{unitId:r,subUnitId:i,comment:{...p,children:u?l:void 0},sync:!u}}));return{redos:d,undos:h}}return{redos:[],undos:[]}}}))}};z=Ve([W(0,a.Inject(C.SheetInterceptorService)),W(1,a.IUniverInstanceService),W(2,a.Inject(_.ThreadCommentModel)),W(3,_.IThreadCommentDataSourceService)],z);var w=function(){return w=Object.assign||function(o){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(o[r]=t[r])}return o},w.apply(this,arguments)},Be=function(o,t){var n={};for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&t.indexOf(e)<0&&(n[e]=o[e]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(o);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(o,e[r])&&(n[e[r]]=o[e[r]]);return n},me=R.forwardRef(function(o,t){var n=o.icon,e=o.id,r=o.className,i=o.extend,s=Be(o,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),m=R.useRef("_".concat(Le()));return de(n,"".concat(e),{defIds:n.defIds,idSuffix:m.current},w({ref:t,className:c},s),i)});function de(o,t,n,e,r){return R.createElement(o.tag,w(w({key:t},ke(o,n,r)),e),(He(o,n).children||[]).map(function(i,s){return de(i,"".concat(t,"-").concat(o.tag,"-").concat(s),n,void 0,r)}))}function ke(o,t,n){var e=w({},o.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(o.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(i){var s=i[0],c=i[1];typeof c=="string"&&(e[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function He(o,t){var n,e=t.defIds;return!e||e.length===0?o:o.tag==="defs"&&(!((n=o.children)===null||n===void 0)&&n.length)?w(w({},o),{children:o.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?w(w({},r),{attrs:w(w({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):o}function Le(){return Math.random().toString(36).substring(2,8)}me.displayName="UniverIcon";var We={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ue=R.forwardRef(function(o,t){return R.createElement(me,Object.assign({},o,{id:"comment-single",ref:t,icon:We}))});ue.displayName="CommentSingle";var Q={exports:{}},B={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ie;function Ee(){if(ie)return B;ie=1;var o=R,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(c,m,u){var d,h={},l=null,p=null;u!==void 0&&(l=""+u),m.key!==void 0&&(l=""+m.key),m.ref!==void 0&&(p=m.ref);for(d in m)e.call(m,d)&&!i.hasOwnProperty(d)&&(h[d]=m[d]);if(c&&c.defaultProps)for(d in m=c.defaultProps,m)h[d]===void 0&&(h[d]=m[d]);return{$$typeof:t,type:c,key:l,ref:p,props:h,_owner:r.current}}return B.Fragment=n,B.jsx=s,B.jsxs=s,B}var se;function je(){return se||(se=1,K.exports=Ee()),K.exports}var he=je();const De=()=>{const o=a.useDependency(a.IUniverInstanceService),t=a.useDependency(exports.SheetsThreadCommentPopupService),n=S.useObservable(t.activePopup$),e=a.useDependency(N.SheetsThreadCommentModel);if(S.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:i,unitId:s,subUnitId:c,trigger:m}=n,u=e.getByLocation(s,c,r,i),d=`${a.Tools.chatAtABC(i)}${r+1}`,h=()=>{t.hidePopup()},l=p=>{var f,b,$;return($=(b=(f=o.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:f.getSheetBySheetId(p))==null?void 0:b.getName())!=null?$:""};return he.jsx(T.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:u,unitId:s,subUnitId:c,type:a.UniverInstanceType.UNIVER_SHEET,refStr:d,onClose:h,getSubUnitName:l,autoFocus:m==="context-menu"})},$e=()=>{var y;const o=a.useDependency(I.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),n=a.useDependency(exports.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),i=a.useDependency(a.ICommandService),s=R.useMemo(()=>e.activeSheet$.pipe(k.map(v=>v==null?void 0:v.getSheetId())),[e.activeSheet$]),c=S.useObservable(s,(y=e.getActiveSheet())==null?void 0:y.getSheetId()),m=R.useRef(),u=a.useDependency(T.ThreadCommentPanelService),d=S.useObservable(u.activeCommentId$),h=S.useObservable(u.panelVisible$,u.panelVisible),l=R.useCallback(v=>{const M=e.getSheets(),g={};M.forEach((U,P)=>{g[U.getSheetId()]=P});const O=U=>U.map(P=>{var re;const j=x.singleReferenceToGrid(P.ref),ve=[(re=g[P.subUnitId])!=null?re:0,j.row,j.column];return{...P,p:ve}}).sort((P,j)=>P.p[0]===j.p[0]?P.p[1]===j.p[1]?P.p[2]-j.p[2]:P.p[1]-j.p[1]:P.p[0]-j.p[0]);return[...O(v.filter(U=>!U.resolved)),...O(v.filter(U=>U.resolved))]},[e]),p=R.useCallback(v=>{var M;if(v.unitId===r&&v.subUnitId===c&&!v.resolved){const{row:g,column:O}=x.singleReferenceToGrid(v.ref),U=e.getSheetBySheetId(v.subUnitId),P=(M=U==null?void 0:U.getMergedCell(g,O))!=null?M:{startColumn:O,endColumn:O,startRow:g,endRow:g};if(!Number.isNaN(g)&&!Number.isNaN(O))return o.addShape({range:P,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[o,c,r]),f=v=>{var M,g;return(g=(M=e.getSheetBySheetId(v))==null?void 0:M.getName())!=null?g:""},b=()=>{i.executeCommand(A.id)},$=v=>{d&&d.unitId===v.unitId&&d.subUnitId===v.subUnitId&&d.commentId===v.id||(m.current&&(o.removeShape(m.current),m.current=null),m.current=p(v))},V=()=>{m.current&&(o.removeShape(m.current),m.current=null)},J=(v,M)=>{M&&n.hidePopup()};return R.useEffect(()=>{!h&&m.current&&o.removeShape(m.current)},[o,h]),he.jsx(T.ThreadCommentPanel,{unitId:r,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:b,getSubUnitName:f,onResolve:J,sortComments:l,onItemEnter:$,onItemLeave:V,onDeleteComment:()=>(V(),!0)})},Ne=o=>({id:A.id,type:S.MenuItemType.BUTTON,icon:te,title:"sheetThreadComment.menu.addComment",hidden$:S.getMenuHiddenObservable(o,a.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(o,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]})}),xe=o=>({id:T.ToggleSheetCommentPanelOperation.id,type:S.MenuItemType.BUTTON,icon:te,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(o,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]}),hidden$:S.getMenuHiddenObservable(o,a.UniverInstanceType.UNIVER_SHEET)}),Ae={id:A.id,binding:S.KeyCode.M|S.MetaKeys.CTRL_COMMAND|S.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ve={[S.RibbonStartGroup.OTHERS]:{[T.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:xe}},[S.ContextMenuPosition.MAIN_AREA]:{[S.ContextMenuGroup.OTHERS]:{[A.id]:{order:0,menuItemFactory:Ne}}}};var Be=Object.defineProperty,ke=Object.getOwnPropertyDescriptor,He=(o,t,n,e)=>{for(var r=e>1?void 0:e?ke(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Be(t,n,r),r},Q=(o,t)=>(n,e)=>t(n,e,o);let q=class extends a.Disposable{constructor(o,t,n){super(),this._menuManagerService=o,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Ae)}_initMenu(){this._menuManagerService.mergeMenu(Ve)}_initComponent(){[[ce,De],[T.THREAD_COMMENT_PANEL,$e],[te,ue]].forEach(([o,t])=>{this._componentManager.register(o,t)})}};q=He([Q(0,S.IMenuManagerService),Q(1,a.Inject(S.ComponentManager)),Q(2,S.IShortcutService)],q);var Le=Object.defineProperty,We=Object.getOwnPropertyDescriptor,Fe=(o,t,n,e)=>{for(var r=e>1?void 0:e?We(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Le(t,n,r),r},X=(o,t)=>(n,e)=>t(n,e,o);const qe=(o,t,n)=>{const e=x.singleReferenceToGrid(o),r=n.row-t.row,i=n.column-t.column,s={startColumn:e.column+i,startRow:e.row+r,endColumn:e.column+i,endRow:e.row+r};return x.serializeRange(s)};let G=class extends a.Disposable{constructor(t,n,e){super();D(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:ne,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:i,subUnitId:s,range:c}=n,m={row:c.rows[0],column:c.cols[0]};if(r.copyType===I.COPY_TYPE.CUT&&this._copyInfo){const{range:u,unitId:d,subUnitId:h}=this._copyInfo,l={row:u.startRow,column:u.startColumn};if(!(i===d&&s===h)){const p=[];a.Range.foreach(u,(y,v)=>{const M=this._sheetsThreadCommentModel.getAllByLocation(d,h,y,v);this._threadCommentDataSourceService.syncUpdateMutationToColla?M.forEach(g=>{p.push(g)}):M.forEach(({children:g,...O})=>{O.parentId||p.push(O)})});const f=[],b=[],$=[],V=[],J=y=>{f.unshift({id:_.DeleteCommentMutation.id,params:{unitId:d,subUnitId:h,commentId:y.id}}),$.push({id:_.AddCommentMutation.id,params:{unitId:i,subUnitId:s,comment:{...y,ref:qe(y.ref,l,m),unitId:i,subUnitId:s},sync:!0}}),b.push({id:_.AddCommentMutation.id,params:{unitId:d,subUnitId:h,comment:y,sync:!0}}),V.unshift({id:_.DeleteCommentMutation.id,params:{unitId:i,subUnitId:s,commentId:y.id}})};return p.forEach(y=>{J(y)}),{redos:[...f,...$],undos:[...V,...b]}}}return{redos:[],undos:[]}}}))}};G=Fe([X(0,a.Inject(I.ISheetClipboardService)),X(1,a.Inject(N.SheetsThreadCommentModel)),X(2,_.IThreadCommentDataSourceService)],G);var Ge=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,ze=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ze(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ge(t,n,r),r},L=(o,t)=>(n,e)=>t(n,e,o);let Z=class extends a.Disposable{constructor(o,t,n,e){super(),this._hoverManagerService=o,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(o=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(o&&(t&&t.temp||!t)){const{location:n}=o,{unitId:e,subUnitId:r,row:i,col:s}=n,c=this._sheetsThreadCommentModel.getByLocation(e,r,i,s);if(c){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]},[{startRow:i,startColumn:s,endRow:i,endColumn:s}]))return;const u=this._sheetsThreadCommentModel.getComment(e,r,c);u&&!u.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:i,col:s,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};Z=ze([L(0,a.Inject(I.HoverManagerService)),L(1,a.Inject(exports.SheetsThreadCommentPopupService)),L(2,a.Inject(N.SheetsThreadCommentModel)),L(3,a.Inject(I.SheetPermissionInterceptorBaseController))],Z);var Ye=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Ke=(o,t,n,e)=>{for(var r=e>1?void 0:e?Je(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ye(t,n,r),r},E=(o,t)=>(n,e)=>t(n,e,o);let z=class extends a.Disposable{constructor(t,n,e,r,i,s,c,m,u,d){super();D(this,"_isSwitchToCommenting",!1);D(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=i,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=c,this._sheetSelectionService=m,this._editorBridgeService=u,this._renderManagerService=d,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var l,p,f;const r=(l=t[0])==null?void 0:l.range,i=this._renderManagerService.getRenderById(n),s=(p=i==null?void 0:i.with(I.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:p.skeleton;if(!s||!r)return;const c=s.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((f=r.rangeType)!=null?f:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&a.Rectangle.equals(c.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(T.SetActiveCommentOperation.id);return}const u=c.actualRow,d=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,u,d)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(T.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(n,e,u,d);h&&this._commandService.executeCommand(T.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===_.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:i,commentId:s}=e;n.unitId===r&&n.subUnitId===i&&n.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:i,trigger:s}=t,c=this._sheetsThreadCommentModel.getComment(e,r,i);if(!c||c.resolved)return;const m=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!m||m.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=m.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(C.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const h=x.singleReferenceToGrid(c.ref),{row:l,column:p}=h;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]},[{startRow:l,startColumn:p,endRow:l,endColumn:p}]))return;const b=1;if(await this._commandService.executeCommand(I.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-b,0),endRow:h.row+b,startColumn:Math.max(h.column-b,0),endColumn:h.column+b}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:h.row,col:h.column,commentId:c.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var l,p;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const i=this._sheetsThreadCommentModel.getComment(n,e,r);if(!i)return;const s=x.singleReferenceToGrid(i.ref),{row:c,column:m}=s;if(Number.isNaN(c)||Number.isNaN(m))return null;const u=(l=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:l.getSheetBySheetId(e),d=(p=u==null?void 0:u.getMergedCell(c,m))!=null?p:{startColumn:m,endColumn:m,startRow:c,endRow:c},h=this._markSelectionService.addShape({range:d,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};z=Ke([E(0,a.ICommandService),E(1,a.Inject(exports.SheetsThreadCommentPopupService)),E(2,a.Inject(N.SheetsThreadCommentModel)),E(3,a.Inject(T.ThreadCommentPanelService)),E(4,a.IUniverInstanceService),E(5,a.Inject(I.SheetPermissionInterceptorBaseController)),E(6,I.IMarkSelectionService),E(7,a.Inject(C.SheetsSelectionsService)),E(8,I.IEditorBridgeService),E(9,ae.IRenderManagerService)],z);var Qe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(o,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Qe(t,n,r),r},W=(o,t)=>(n,e)=>t(n,e,o);let Y=class extends a.Disposable{constructor(o,t,n,e){super(),this._sheetInterceptorService=o,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:o=>{var t;if(o.id===C.RemoveSheetCommand.id){const n=o.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),i=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!i)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(r,i),c=Array.from(s.values()).filter(l=>!l.parentId),m=c.map(l=>l.id),u=this._threadCommentDataSourceService.syncUpdateMutationToColla,d=m.map(l=>({id:_.DeleteCommentMutation.id,params:{unitId:r,subUnitId:i,commentId:l}})),h=c.map(({children:l,...p})=>({id:_.AddCommentMutation.id,params:{unitId:r,subUnitId:i,comment:{...p,children:u?l:void 0},sync:!u}}));return{redos:d,undos:h}}return{redos:[],undos:[]}}}))}};Y=et([W(0,a.Inject(C.SheetInterceptorService)),W(1,a.IUniverInstanceService),W(2,a.Inject(_.ThreadCommentModel)),W(3,_.IThreadCommentDataSourceService)],Y);var le=Object.defineProperty,tt=Object.getOwnPropertyDescriptor,nt=(o,t,n)=>t in o?le(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,rt=(o,t,n,e)=>{for(var r=e>1?void 0:e?tt(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&le(t,n,r),r},ee=(o,t)=>(n,e)=>t(n,e,o),pe=(o,t,n)=>nt(o,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Pe,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:i,...s}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(ge,s)}onStarting(){[[q],[F],[G],[Z],[Y],[z],[exports.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[A].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(q)}onReady(){this._injector.get(F),this._injector.get(Y)}onRendered(){this._injector.get(G),this._injector.get(Z),this._injector.get(z)}};pe(exports.UniverSheetsThreadCommentUIPlugin,"pluginName",ne);pe(exports.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsThreadCommentUIPlugin=rt([a.DependentOn(T.UniverThreadCommentUIPlugin,N.UniverSheetsThreadCommentPlugin),ee(1,a.Inject(a.Injector)),ee(2,a.Inject(a.ICommandService)),ee(3,a.IConfigService)],exports.UniverSheetsThreadCommentUIPlugin);Object.defineProperty(exports,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>T.UniverThreadCommentUIPlugin});Object.defineProperty(exports,"AddCommentCommand",{enumerable:!0,get:()=>_.AddCommentCommand});Object.defineProperty(exports,"DeleteCommentCommand",{enumerable:!0,get:()=>_.DeleteCommentCommand});Object.defineProperty(exports,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>_.DeleteCommentTreeCommand});Object.defineProperty(exports,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>_.IThreadCommentDataSourceService});Object.defineProperty(exports,"ResolveCommentCommand",{enumerable:!0,get:()=>_.ResolveCommentCommand});Object.defineProperty(exports,"UpdateCommentCommand",{enumerable:!0,get:()=>_.UpdateCommentCommand});exports.SHEETS_THREAD_COMMENT=ne;exports.ShowAddSheetCommentModalOperation=A;
9
+ */var ie;function Fe(){if(ie)return B;ie=1;var o=R,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(c,m,u){var d,h={},l=null,p=null;u!==void 0&&(l=""+u),m.key!==void 0&&(l=""+m.key),m.ref!==void 0&&(p=m.ref);for(d in m)e.call(m,d)&&!i.hasOwnProperty(d)&&(h[d]=m[d]);if(c&&c.defaultProps)for(d in m=c.defaultProps,m)h[d]===void 0&&(h[d]=m[d]);return{$$typeof:t,type:c,key:l,ref:p,props:h,_owner:r.current}}return B.Fragment=n,B.jsx=s,B.jsxs=s,B}var se;function qe(){return se||(se=1,Q.exports=Fe()),Q.exports}var he=qe();const Ge=()=>{const o=a.useDependency(a.IUniverInstanceService),t=a.useDependency(exports.SheetsThreadCommentPopupService),n=S.useObservable(t.activePopup$),e=a.useDependency($.SheetsThreadCommentModel);if(S.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:i,unitId:s,subUnitId:c,trigger:m}=n,u=e.getByLocation(s,c,r,i),d=`${a.Tools.chatAtABC(i)}${r+1}`,h=()=>{t.hidePopup()},l=p=>{var f,b,N;return(N=(b=(f=o.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:f.getSheetBySheetId(p))==null?void 0:b.getName())!=null?N:""};return he.jsx(T.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:u,unitId:s,subUnitId:c,type:a.UniverInstanceType.UNIVER_SHEET,refStr:d,onClose:h,getSubUnitName:l,autoFocus:m==="context-menu"})},Ze=()=>{var y;const o=a.useDependency(I.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),n=a.useDependency(exports.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),i=a.useDependency(a.ICommandService),s=R.useMemo(()=>e.activeSheet$.pipe(k.map(v=>v==null?void 0:v.getSheetId())),[e.activeSheet$]),c=S.useObservable(s,(y=e.getActiveSheet())==null?void 0:y.getSheetId()),m=R.useRef(),u=a.useDependency(T.ThreadCommentPanelService),d=S.useObservable(u.activeCommentId$),h=S.useObservable(u.panelVisible$,u.panelVisible),l=R.useCallback(v=>{const M=e.getSheets(),g={};M.forEach((U,P)=>{g[U.getSheetId()]=P});const O=U=>U.map(P=>{var re;const j=x.singleReferenceToGrid(P.ref),ve=[(re=g[P.subUnitId])!=null?re:0,j.row,j.column];return{...P,p:ve}}).sort((P,j)=>P.p[0]===j.p[0]?P.p[1]===j.p[1]?P.p[2]-j.p[2]:P.p[1]-j.p[1]:P.p[0]-j.p[0]);return[...O(v.filter(U=>!U.resolved)),...O(v.filter(U=>U.resolved))]},[e]),p=R.useCallback(v=>{var M;if(v.unitId===r&&v.subUnitId===c&&!v.resolved){const{row:g,column:O}=x.singleReferenceToGrid(v.ref),U=e.getSheetBySheetId(v.subUnitId),P=(M=U==null?void 0:U.getMergedCell(g,O))!=null?M:{startColumn:O,endColumn:O,startRow:g,endRow:g};if(!Number.isNaN(g)&&!Number.isNaN(O))return o.addShape({range:P,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[o,c,r]),f=v=>{var M,g;return(g=(M=e.getSheetBySheetId(v))==null?void 0:M.getName())!=null?g:""},b=()=>{i.executeCommand(A.id)},N=v=>{d&&d.unitId===v.unitId&&d.subUnitId===v.subUnitId&&d.commentId===v.id||(m.current&&(o.removeShape(m.current),m.current=null),m.current=p(v))},V=()=>{m.current&&(o.removeShape(m.current),m.current=null)},J=(v,M)=>{M&&n.hidePopup()};return R.useEffect(()=>{!h&&m.current&&o.removeShape(m.current)},[o,h]),he.jsx(T.ThreadCommentPanel,{unitId:r,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:b,getSubUnitName:f,onResolve:J,sortComments:l,onItemEnter:N,onItemLeave:V,onDeleteComment:()=>(V(),!0)})},ze=o=>({id:A.id,type:S.MenuItemType.BUTTON,icon:te,title:"sheetThreadComment.menu.addComment",hidden$:S.getMenuHiddenObservable(o,a.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(o,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]})}),Ye=o=>({id:T.ToggleSheetCommentPanelOperation.id,type:S.MenuItemType.BUTTON,icon:te,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(o,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]}),hidden$:S.getMenuHiddenObservable(o,a.UniverInstanceType.UNIVER_SHEET)}),Je={id:A.id,binding:S.KeyCode.M|S.MetaKeys.CTRL_COMMAND|S.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ke={[S.RibbonStartGroup.OTHERS]:{[T.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:Ye}},[S.ContextMenuPosition.MAIN_AREA]:{[S.ContextMenuGroup.OTHERS]:{[A.id]:{order:0,menuItemFactory:ze}}}};var Qe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(o,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Qe(t,n,r),r},X=(o,t)=>(n,e)=>t(n,e,o);let Y=class extends a.Disposable{constructor(o,t,n){super(),this._menuManagerService=o,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Je)}_initMenu(){this._menuManagerService.mergeMenu(Ke)}_initComponent(){[[ce,Ge],[T.THREAD_COMMENT_PANEL,Ze],[te,ue]].forEach(([o,t])=>{this._componentManager.register(o,t)})}};Y=et([X(0,S.IMenuManagerService),X(1,a.Inject(S.ComponentManager)),X(2,S.IShortcutService)],Y);var le=Object.defineProperty,tt=Object.getOwnPropertyDescriptor,nt=(o,t,n)=>t in o?le(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,rt=(o,t,n,e)=>{for(var r=e>1?void 0:e?tt(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&le(t,n,r),r},ee=(o,t)=>(n,e)=>t(n,e,o),pe=(o,t,n)=>nt(o,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Pe,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:i,...s}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(ge,s)}onStarting(){[[Y],[F],[q],[G],[z],[Z],[exports.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[A].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(Y)}onReady(){this._injector.get(F),this._injector.get(z)}onRendered(){this._injector.get(q),this._injector.get(G),this._injector.get(Z)}};pe(exports.UniverSheetsThreadCommentUIPlugin,"pluginName",ne);pe(exports.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsThreadCommentUIPlugin=rt([a.DependentOn(T.UniverThreadCommentUIPlugin,$.UniverSheetsThreadCommentPlugin),ee(1,a.Inject(a.Injector)),ee(2,a.Inject(a.ICommandService)),ee(3,a.IConfigService)],exports.UniverSheetsThreadCommentUIPlugin);Object.defineProperty(exports,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>T.UniverThreadCommentUIPlugin});Object.defineProperty(exports,"AddCommentCommand",{enumerable:!0,get:()=>_.AddCommentCommand});Object.defineProperty(exports,"DeleteCommentCommand",{enumerable:!0,get:()=>_.DeleteCommentCommand});Object.defineProperty(exports,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>_.DeleteCommentTreeCommand});Object.defineProperty(exports,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>_.IThreadCommentDataSourceService});Object.defineProperty(exports,"ResolveCommentCommand",{enumerable:!0,get:()=>_.ResolveCommentCommand});Object.defineProperty(exports,"UpdateCommentCommand",{enumerable:!0,get:()=>_.UpdateCommentCommand});exports.SHEETS_THREAD_COMMENT=ne;exports.ShowAddSheetCommentModalOperation=A;
package/lib/es/index.js CHANGED
@@ -1,19 +1,19 @@
1
- var Le = Object.defineProperty;
2
- var He = (o, e, n) => e in o ? Le(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
- var E = (o, e, n) => He(o, typeof e != "symbol" ? e + "" : e, n);
4
- import { Inject as _, Disposable as $, DisposableCollection as ke, CommandType as Fe, IUniverInstanceService as N, InterceptorEffectEnum as We, UniverInstanceType as b, useDependency as R, Tools as Ze, ICommandService as ae, Range as ze, RANGE_TYPE as he, Rectangle as qe, DependentOn as Ge, Injector as Je, Plugin as Ye, IConfigService as Ke } from "@univerjs/core";
1
+ var He = Object.defineProperty;
2
+ var Le = (o, e, n) => e in o ? He(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
+ var E = (o, e, n) => Le(o, typeof e != "symbol" ? e + "" : e, n);
4
+ import { Inject as _, Disposable as $, DisposableCollection as ke, CommandType as Fe, IUniverInstanceService as N, InterceptorEffectEnum as We, UniverInstanceType as b, Range as Ze, ICommandService as ae, RANGE_TYPE as he, Rectangle as ze, useDependency as R, Tools as qe, DependentOn as Ge, Injector as Je, Plugin as Ye, IConfigService as Ke } from "@univerjs/core";
5
5
  import { SheetsSelectionsService as Ce, getSheetCommandTarget as Qe, SheetInterceptorService as Se, INTERCEPTOR_POINT as Xe, WorkbookCommentPermission as K, WorksheetViewPermission as Q, RangeProtectionPermissionViewPoint as X, SetWorksheetActiveOperation as et, RemoveSheetCommand as tt } from "@univerjs/sheets";
6
6
  import { SheetsThreadCommentModel as x, UniverSheetsThreadCommentPlugin as nt } from "@univerjs/sheets-thread-comment";
7
- import { ThreadCommentPanelService as ce, ThreadCommentTree as rt, ThreadCommentPanel as ot, ToggleSheetCommentPanelOperation as ge, THREAD_COMMENT_PANEL as it, SetActiveCommentOperation as te, UniverThreadCommentUIPlugin as st } from "@univerjs/thread-comment-ui";
7
+ import { ThreadCommentPanelService as ce, SetActiveCommentOperation as te, ThreadCommentTree as rt, ThreadCommentPanel as ot, ToggleSheetCommentPanelOperation as ge, THREAD_COMMENT_PANEL as it, UniverThreadCommentUIPlugin as st } from "@univerjs/thread-comment-ui";
8
8
  import { UniverThreadCommentUIPlugin as Un } from "@univerjs/thread-comment-ui";
9
- import { SheetCanvasPopManagerService as at, IMarkSelectionService as Ie, whenSheetEditorFocused as ct, getCurrentRangeDisable$ as Pe, ISheetClipboardService as ut, COPY_TYPE as mt, HoverManagerService as dt, SheetPermissionInterceptorBaseController as Te, IEditorBridgeService as ht, SheetSkeletonManagerService as lt, ScrollToRangeOperation as pt } from "@univerjs/sheets-ui";
10
- import { IZenZoneService as _t, useObservable as A, KeyCode as vt, MetaKeys as le, MenuItemType as be, getMenuHiddenObservable as we, RibbonStartGroup as ft, ContextMenuPosition as Ct, ContextMenuGroup as St, ComponentManager as gt, IMenuManagerService as It, IShortcutService as Pt } from "@univerjs/ui";
9
+ import { SheetCanvasPopManagerService as at, ISheetClipboardService as ct, COPY_TYPE as ut, HoverManagerService as mt, SheetPermissionInterceptorBaseController as Ie, IMarkSelectionService as Pe, IEditorBridgeService as dt, SheetSkeletonManagerService as ht, ScrollToRangeOperation as lt, whenSheetEditorFocused as pt, getCurrentRangeDisable$ as Te } from "@univerjs/sheets-ui";
10
+ import { IZenZoneService as _t, useObservable as A, KeyCode as vt, MetaKeys as le, MenuItemType as be, getMenuHiddenObservable as Me, RibbonStartGroup as ft, ContextMenuPosition as Ct, ContextMenuGroup as St, ComponentManager as gt, IMenuManagerService as It, IShortcutService as Pt } from "@univerjs/ui";
11
11
  import { BehaviorSubject as Tt, debounceTime as ue, map as bt } from "rxjs";
12
- import { IRenderManagerService as Me } from "@univerjs/engine-render";
13
- import wt, { forwardRef as ye, useRef as Ee, createElement as Re, useMemo as Mt, useCallback as pe, useEffect as yt } from "react";
14
- import { singleReferenceToGrid as V, serializeRange as Et } from "@univerjs/engine-formula";
15
- import { IThreadCommentDataSourceService as Oe, DeleteCommentMutation as F, AddCommentMutation as se, ThreadCommentModel as Rt } from "@univerjs/thread-comment";
12
+ import { IRenderManagerService as we } from "@univerjs/engine-render";
13
+ import { singleReferenceToGrid as V, serializeRange as Mt } from "@univerjs/engine-formula";
14
+ import { IThreadCommentDataSourceService as ye, DeleteCommentMutation as F, AddCommentMutation as se, ThreadCommentModel as wt } from "@univerjs/thread-comment";
16
15
  import { AddCommentCommand as Nn, DeleteCommentCommand as xn, DeleteCommentTreeCommand as Dn, IThreadCommentDataSourceService as jn, ResolveCommentCommand as An, UpdateCommentCommand as Vn } from "@univerjs/thread-comment";
16
+ import yt, { forwardRef as Ee, useRef as Re, createElement as Oe, useMemo as Et, useCallback as pe, useEffect as Rt } from "react";
17
17
  const Ue = "univer.sheet.thread-comment-modal", me = "comment-single", $e = "SHEET_THREAD_COMMENT";
18
18
  var Ot = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, $t = (o, e, n, t) => {
19
19
  for (var r = t > 1 ? void 0 : t ? Ut(e, n) : e, i = o.length - 1, s; i >= 0; i--)
@@ -120,7 +120,7 @@ var Dt = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, At = (o, e
120
120
  for (var r = t > 1 ? void 0 : t ? jt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
121
121
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
122
122
  return t && r && Dt(e, n, r), r;
123
- }, L = (o, e) => (n, t) => e(n, t, o);
123
+ }, H = (o, e) => (n, t) => e(n, t, o);
124
124
  let W = class extends $ {
125
125
  constructor(o, e, n, t) {
126
126
  super(), this._sheetInterceptorService = o, this._sheetsThreadCommentModel = e, this._univerInstanceService = n, this._renderManagerService = t, this._initViewModelIntercept(), this._initSkeletonChange();
@@ -163,272 +163,26 @@ let W = class extends $ {
163
163
  }
164
164
  };
165
165
  W = At([
166
- L(0, _(Se)),
167
- L(1, _(x)),
168
- L(2, N),
169
- L(3, Me)
166
+ H(0, _(Se)),
167
+ H(1, _(x)),
168
+ H(2, N),
169
+ H(3, we)
170
170
  ], W);
171
- var P = function() {
172
- return P = Object.assign || function(o) {
173
- for (var e, n = 1, t = arguments.length; n < t; n++) {
174
- e = arguments[n];
175
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (o[r] = e[r]);
176
- }
177
- return o;
178
- }, P.apply(this, arguments);
179
- }, Vt = function(o, e) {
180
- var n = {};
181
- for (var t in o) Object.prototype.hasOwnProperty.call(o, t) && e.indexOf(t) < 0 && (n[t] = o[t]);
182
- if (o != null && typeof Object.getOwnPropertySymbols == "function")
183
- for (var r = 0, t = Object.getOwnPropertySymbols(o); r < t.length; r++)
184
- e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, t[r]) && (n[t[r]] = o[t[r]]);
185
- return n;
186
- }, Ne = ye(function(o, e) {
187
- var n = o.icon, t = o.id, r = o.className, i = o.extend, s = Vt(o, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), c = Ee("_".concat(Ht()));
188
- return xe(n, "".concat(t), { defIds: n.defIds, idSuffix: c.current }, P({ ref: e, className: a }, s), i);
189
- });
190
- function xe(o, e, n, t, r) {
191
- return Re(o.tag, P(P({ key: e }, Bt(o, n, r)), t), (Lt(o, n).children || []).map(function(i, s) {
192
- return xe(i, "".concat(e, "-").concat(o.tag, "-").concat(s), n, void 0, r);
193
- }));
194
- }
195
- function Bt(o, e, n) {
196
- var t = P({}, o.attrs);
197
- n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
198
- var r = e.defIds;
199
- return !r || r.length === 0 || (o.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(i) {
200
- var s = i[0], a = i[1];
201
- typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
202
- })), t;
203
- }
204
- function Lt(o, e) {
205
- var n, t = e.defIds;
206
- return !t || t.length === 0 ? o : o.tag === "defs" && (!((n = o.children) === null || n === void 0) && n.length) ? P(P({}, o), { children: o.children.map(function(r) {
207
- return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? P(P({}, r), { attrs: P(P({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
208
- }) }) : o;
209
- }
210
- function Ht() {
211
- return Math.random().toString(36).substring(2, 8);
212
- }
213
- Ne.displayName = "UniverIcon";
214
- var kt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, De = ye(function(o, e) {
215
- return Re(Ne, Object.assign({}, o, {
216
- id: "comment-single",
217
- ref: e,
218
- icon: kt
219
- }));
220
- });
221
- De.displayName = "CommentSingle";
222
- var ne = { exports: {} }, j = {};
223
- /**
224
- * @license React
225
- * react-jsx-runtime.production.min.js
226
- *
227
- * Copyright (c) Facebook, Inc. and its affiliates.
228
- *
229
- * This source code is licensed under the MIT license found in the
230
- * LICENSE file in the root directory of this source tree.
231
- */
232
- var ve;
233
- function Ft() {
234
- if (ve) return j;
235
- ve = 1;
236
- var o = wt, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, r = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
237
- function s(a, c, d) {
238
- var u, m = {}, h = null, l = null;
239
- d !== void 0 && (h = "" + d), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (l = c.ref);
240
- for (u in c) t.call(c, u) && !i.hasOwnProperty(u) && (m[u] = c[u]);
241
- if (a && a.defaultProps) for (u in c = a.defaultProps, c) m[u] === void 0 && (m[u] = c[u]);
242
- return { $$typeof: e, type: a, key: h, ref: l, props: m, _owner: r.current };
243
- }
244
- return j.Fragment = n, j.jsx = s, j.jsxs = s, j;
245
- }
246
- var fe;
247
- function Wt() {
248
- return fe || (fe = 1, ne.exports = Ft()), ne.exports;
249
- }
250
- var je = Wt();
251
- const Zt = () => {
252
- const o = R(N), e = R(O), n = A(e.activePopup$), t = R(x);
253
- if (A(t.commentUpdate$), !n)
254
- return null;
255
- const { row: r, col: i, unitId: s, subUnitId: a, trigger: c } = n, d = t.getByLocation(s, a, r, i), u = `${Ze.chatAtABC(i)}${r + 1}`, m = () => {
256
- e.hidePopup();
257
- }, h = (l) => {
258
- var v, S, U;
259
- return (U = (S = (v = o.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : v.getSheetBySheetId(l)) == null ? void 0 : S.getName()) != null ? U : "";
260
- };
261
- return /* @__PURE__ */ je.jsx(
262
- rt,
263
- {
264
- onClick: () => {
265
- e.persistPopup();
266
- },
267
- prefix: "cell",
268
- id: d,
269
- unitId: s,
270
- subUnitId: a,
271
- type: b.UNIVER_SHEET,
272
- refStr: u,
273
- onClose: m,
274
- getSubUnitName: h,
275
- autoFocus: c === "context-menu"
276
- }
277
- );
278
- }, zt = () => {
279
- var g;
280
- const o = R(Ie), e = R(N), n = R(O), t = e.getCurrentUnitForType(b.UNIVER_SHEET), r = t.getUnitId(), i = R(ae), s = Mt(() => t.activeSheet$.pipe(bt((p) => p == null ? void 0 : p.getSheetId())), [t.activeSheet$]), a = A(s, (g = t.getActiveSheet()) == null ? void 0 : g.getSheetId()), c = Ee(), d = R(ce), u = A(d.activeCommentId$), m = A(d.panelVisible$, d.panelVisible), h = pe((p) => {
281
- const I = t.getSheets(), f = {};
282
- I.forEach((T, C) => {
283
- f[T.getSheetId()] = C;
284
- });
285
- const w = (T) => T.map((C) => {
286
- var de;
287
- const y = V(C.ref), Be = [(de = f[C.subUnitId]) != null ? de : 0, y.row, y.column];
288
- return { ...C, p: Be };
289
- }).sort((C, y) => C.p[0] === y.p[0] ? C.p[1] === y.p[1] ? C.p[2] - y.p[2] : C.p[1] - y.p[1] : C.p[0] - y.p[0]);
290
- return [
291
- ...w(p.filter((T) => !T.resolved)),
292
- ...w(p.filter((T) => T.resolved))
293
- ];
294
- }, [t]), l = pe((p) => {
295
- var I;
296
- if (p.unitId === r && p.subUnitId === a && !p.resolved) {
297
- const { row: f, column: w } = V(p.ref), T = t.getSheetBySheetId(p.subUnitId), C = (I = T == null ? void 0 : T.getMergedCell(f, w)) != null ? I : {
298
- startColumn: w,
299
- endColumn: w,
300
- startRow: f,
301
- endRow: f
302
- };
303
- if (!Number.isNaN(f) && !Number.isNaN(w))
304
- return o.addShape({
305
- range: C,
306
- style: {
307
- // hasAutoFill: false,
308
- fill: "rgb(255, 189, 55, 0.35)",
309
- strokeWidth: 1,
310
- stroke: "#FFBD37",
311
- widgets: {}
312
- },
313
- primary: null
314
- });
315
- }
316
- }, [o, a, r]), v = (p) => {
317
- var I, f;
318
- return (f = (I = t.getSheetBySheetId(p)) == null ? void 0 : I.getName()) != null ? f : "";
319
- }, S = () => {
320
- i.executeCommand(B.id);
321
- }, U = (p) => {
322
- u && u.unitId === p.unitId && u.subUnitId === p.subUnitId && u.commentId === p.id || (c.current && (o.removeShape(c.current), c.current = null), c.current = l(p));
323
- }, D = () => {
324
- c.current && (o.removeShape(c.current), c.current = null);
325
- }, ee = (p, I) => {
326
- I && n.hidePopup();
327
- };
328
- return yt(() => {
329
- !m && c.current && o.removeShape(c.current);
330
- }, [o, m]), /* @__PURE__ */ je.jsx(
331
- ot,
332
- {
333
- unitId: r,
334
- subUnitId$: s,
335
- type: b.UNIVER_SHEET,
336
- onAdd: S,
337
- getSubUnitName: v,
338
- onResolve: ee,
339
- sortComments: h,
340
- onItemEnter: U,
341
- onItemLeave: D,
342
- onDeleteComment: () => (D(), !0)
343
- }
344
- );
345
- }, qt = (o) => ({
346
- id: B.id,
347
- type: be.BUTTON,
348
- icon: me,
349
- title: "sheetThreadComment.menu.addComment",
350
- hidden$: we(o, b.UNIVER_SHEET),
351
- disabled$: Pe(o, {
352
- workbookTypes: [K],
353
- worksheetTypes: [Q],
354
- rangeTypes: [X]
355
- })
356
- }), Gt = (o) => ({
357
- id: ge.id,
358
- type: be.BUTTON,
359
- icon: me,
360
- tooltip: "sheetThreadComment.menu.commentManagement",
361
- disabled$: Pe(o, {
362
- workbookTypes: [K],
363
- worksheetTypes: [Q],
364
- rangeTypes: [X]
365
- }),
366
- hidden$: we(o, b.UNIVER_SHEET)
367
- }), Jt = {
368
- id: B.id,
369
- binding: vt.M | le.CTRL_COMMAND | le.ALT,
370
- preconditions: ct
371
- }, Yt = {
372
- [ft.OTHERS]: {
373
- [ge.id]: {
374
- order: 1,
375
- menuItemFactory: Gt
376
- }
377
- },
378
- [Ct.MAIN_AREA]: {
379
- [St.OTHERS]: {
380
- [B.id]: {
381
- order: 0,
382
- menuItemFactory: qt
383
- }
384
- }
385
- }
386
- };
387
- var Kt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, Xt = (o, e, n, t) => {
388
- for (var r = t > 1 ? void 0 : t ? Qt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
171
+ var Vt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, Ht = (o, e, n, t) => {
172
+ for (var r = t > 1 ? void 0 : t ? Bt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
389
173
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
390
- return t && r && Kt(e, n, r), r;
391
- }, re = (o, e) => (n, t) => e(n, t, o);
392
- let Z = class extends $ {
393
- constructor(o, e, n) {
394
- super(), this._menuManagerService = o, this._componentManager = e, this._shortcutService = n, this._initMenu(), this._initShortcut(), this._initComponent();
395
- }
396
- _initShortcut() {
397
- this._shortcutService.registerShortcut(Jt);
398
- }
399
- _initMenu() {
400
- this._menuManagerService.mergeMenu(Yt);
401
- }
402
- _initComponent() {
403
- [
404
- [Ue, Zt],
405
- [it, zt],
406
- [me, De]
407
- ].forEach(([o, e]) => {
408
- this._componentManager.register(o, e);
409
- });
410
- }
411
- };
412
- Z = Xt([
413
- re(0, It),
414
- re(1, _(gt)),
415
- re(2, Pt)
416
- ], Z);
417
- var en = Object.defineProperty, tn = Object.getOwnPropertyDescriptor, nn = (o, e, n, t) => {
418
- for (var r = t > 1 ? void 0 : t ? tn(e, n) : e, i = o.length - 1, s; i >= 0; i--)
419
- (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
420
- return t && r && en(e, n, r), r;
421
- }, oe = (o, e) => (n, t) => e(n, t, o);
422
- const rn = (o, e, n) => {
174
+ return t && r && Vt(e, n, r), r;
175
+ }, ne = (o, e) => (n, t) => e(n, t, o);
176
+ const Lt = (o, e, n) => {
423
177
  const t = V(o), r = n.row - e.row, i = n.column - e.column, s = {
424
178
  startColumn: t.column + i,
425
179
  startRow: t.row + r,
426
180
  endColumn: t.column + i,
427
181
  endRow: t.row + r
428
182
  };
429
- return Et(s);
183
+ return Mt(s);
430
184
  };
431
- let z = class extends $ {
185
+ let Z = class extends $ {
432
186
  constructor(e, n, t) {
433
187
  super();
434
188
  E(this, "_copyInfo");
@@ -452,19 +206,19 @@ let z = class extends $ {
452
206
  row: a.rows[0],
453
207
  column: a.cols[0]
454
208
  };
455
- if (r.copyType === mt.CUT && this._copyInfo) {
209
+ if (r.copyType === ut.CUT && this._copyInfo) {
456
210
  const { range: d, unitId: u, subUnitId: m } = this._copyInfo, h = {
457
211
  row: d.startRow,
458
212
  column: d.startColumn
459
213
  };
460
214
  if (!(i === u && s === m)) {
461
215
  const l = [];
462
- ze.foreach(d, (g, p) => {
216
+ Ze.foreach(d, (g, p) => {
463
217
  const I = this._sheetsThreadCommentModel.getAllByLocation(u, m, g, p);
464
218
  this._threadCommentDataSourceService.syncUpdateMutationToColla ? I.forEach((f) => {
465
219
  l.push(f);
466
- }) : I.forEach(({ children: f, ...w }) => {
467
- w.parentId || l.push(w);
220
+ }) : I.forEach(({ children: f, ...M }) => {
221
+ M.parentId || l.push(M);
468
222
  });
469
223
  });
470
224
  const v = [], S = [], U = [], D = [], ee = (g) => {
@@ -482,7 +236,7 @@ let z = class extends $ {
482
236
  subUnitId: s,
483
237
  comment: {
484
238
  ...g,
485
- ref: rn(g.ref, h, c),
239
+ ref: Lt(g.ref, h, c),
486
240
  unitId: i,
487
241
  subUnitId: s
488
242
  },
@@ -522,17 +276,17 @@ let z = class extends $ {
522
276
  );
523
277
  }
524
278
  };
525
- z = nn([
526
- oe(0, _(ut)),
527
- oe(1, _(x)),
528
- oe(2, Oe)
529
- ], z);
530
- var on = Object.defineProperty, sn = Object.getOwnPropertyDescriptor, an = (o, e, n, t) => {
531
- for (var r = t > 1 ? void 0 : t ? sn(e, n) : e, i = o.length - 1, s; i >= 0; i--)
279
+ Z = Ht([
280
+ ne(0, _(ct)),
281
+ ne(1, _(x)),
282
+ ne(2, ye)
283
+ ], Z);
284
+ var kt = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, Wt = (o, e, n, t) => {
285
+ for (var r = t > 1 ? void 0 : t ? Ft(e, n) : e, i = o.length - 1, s; i >= 0; i--)
532
286
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
533
- return t && r && on(e, n, r), r;
534
- }, H = (o, e) => (n, t) => e(n, t, o);
535
- let q = class extends $ {
287
+ return t && r && kt(e, n, r), r;
288
+ }, L = (o, e) => (n, t) => e(n, t, o);
289
+ let z = class extends $ {
536
290
  constructor(o, e, n, t) {
537
291
  super(), this._hoverManagerService = o, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel = n, this._sheetPermissionInterceptorBaseController = t, this._initHoverEvent();
538
292
  }
@@ -565,18 +319,18 @@ let q = class extends $ {
565
319
  );
566
320
  }
567
321
  };
568
- q = an([
569
- H(0, _(dt)),
570
- H(1, _(O)),
571
- H(2, _(x)),
572
- H(3, _(Te))
573
- ], q);
574
- var cn = Object.defineProperty, un = Object.getOwnPropertyDescriptor, mn = (o, e, n, t) => {
575
- for (var r = t > 1 ? void 0 : t ? un(e, n) : e, i = o.length - 1, s; i >= 0; i--)
322
+ z = Wt([
323
+ L(0, _(mt)),
324
+ L(1, _(O)),
325
+ L(2, _(x)),
326
+ L(3, _(Ie))
327
+ ], z);
328
+ var Zt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, qt = (o, e, n, t) => {
329
+ for (var r = t > 1 ? void 0 : t ? zt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
576
330
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
577
- return t && r && cn(e, n, r), r;
578
- }, M = (o, e) => (n, t) => e(n, t, o);
579
- let G = class extends $ {
331
+ return t && r && Zt(e, n, r), r;
332
+ }, w = (o, e) => (n, t) => e(n, t, o);
333
+ let q = class extends $ {
580
334
  constructor(e, n, t, r, i, s, a, c, d, u) {
581
335
  super();
582
336
  E(this, "_isSwitchToCommenting", !1);
@@ -585,11 +339,11 @@ let G = class extends $ {
585
339
  }
586
340
  _handleSelectionChange(e, n, t) {
587
341
  var h, l, v;
588
- const r = (h = e[0]) == null ? void 0 : h.range, i = this._renderManagerService.getRenderById(n), s = (l = i == null ? void 0 : i.with(lt).getWorksheetSkeleton(t)) == null ? void 0 : l.skeleton;
342
+ const r = (h = e[0]) == null ? void 0 : h.range, i = this._renderManagerService.getRenderById(n), s = (l = i == null ? void 0 : i.with(ht).getWorksheetSkeleton(t)) == null ? void 0 : l.skeleton;
589
343
  if (!s || !r)
590
344
  return;
591
345
  const a = s.getCellWithCoordByIndex(r.startRow, r.startColumn);
592
- if ((((v = r.rangeType) != null ? v : he.NORMAL) !== he.NORMAL || r.endColumn - r.startColumn > 0 || r.endRow - r.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && qe.equals(a.mergeInfo, r))) {
346
+ if ((((v = r.rangeType) != null ? v : he.NORMAL) !== he.NORMAL || r.endColumn - r.startColumn > 0 || r.endRow - r.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && ze.equals(a.mergeInfo, r))) {
593
347
  this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(te.id);
594
348
  return;
595
349
  }
@@ -655,7 +409,7 @@ let G = class extends $ {
655
409
  }, [{ startRow: h, startColumn: l, endRow: h, endColumn: l }]))
656
410
  return;
657
411
  const S = 1;
658
- if (await this._commandService.executeCommand(pt.id, {
412
+ if (await this._commandService.executeCommand(lt.id, {
659
413
  range: {
660
414
  startRow: Math.max(m.row - S, 0),
661
415
  endRow: m.row + S,
@@ -718,24 +472,24 @@ let G = class extends $ {
718
472
  }));
719
473
  }
720
474
  };
721
- G = mn([
722
- M(0, ae),
723
- M(1, _(O)),
724
- M(2, _(x)),
725
- M(3, _(ce)),
726
- M(4, N),
727
- M(5, _(Te)),
728
- M(6, Ie),
729
- M(7, _(Ce)),
730
- M(8, ht),
731
- M(9, Me)
732
- ], G);
733
- var dn = Object.defineProperty, hn = Object.getOwnPropertyDescriptor, ln = (o, e, n, t) => {
734
- for (var r = t > 1 ? void 0 : t ? hn(e, n) : e, i = o.length - 1, s; i >= 0; i--)
475
+ q = qt([
476
+ w(0, ae),
477
+ w(1, _(O)),
478
+ w(2, _(x)),
479
+ w(3, _(ce)),
480
+ w(4, N),
481
+ w(5, _(Ie)),
482
+ w(6, Pe),
483
+ w(7, _(Ce)),
484
+ w(8, dt),
485
+ w(9, we)
486
+ ], q);
487
+ var Gt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, Yt = (o, e, n, t) => {
488
+ for (var r = t > 1 ? void 0 : t ? Jt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
735
489
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
736
- return t && r && dn(e, n, r), r;
490
+ return t && r && Gt(e, n, r), r;
737
491
  }, k = (o, e) => (n, t) => e(n, t, o);
738
- let J = class extends $ {
492
+ let G = class extends $ {
739
493
  constructor(o, e, n, t) {
740
494
  super(), this._sheetInterceptorService = o, this._univerInstanceService = e, this._threadCommentModel = n, this._threadCommentDataSourceService = t, this._initSheetChange();
741
495
  }
@@ -778,11 +532,257 @@ let J = class extends $ {
778
532
  );
779
533
  }
780
534
  };
781
- J = ln([
535
+ G = Yt([
782
536
  k(0, _(Se)),
783
537
  k(1, N),
784
- k(2, _(Rt)),
785
- k(3, Oe)
538
+ k(2, _(wt)),
539
+ k(3, ye)
540
+ ], G);
541
+ var P = function() {
542
+ return P = Object.assign || function(o) {
543
+ for (var e, n = 1, t = arguments.length; n < t; n++) {
544
+ e = arguments[n];
545
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (o[r] = e[r]);
546
+ }
547
+ return o;
548
+ }, P.apply(this, arguments);
549
+ }, Kt = function(o, e) {
550
+ var n = {};
551
+ for (var t in o) Object.prototype.hasOwnProperty.call(o, t) && e.indexOf(t) < 0 && (n[t] = o[t]);
552
+ if (o != null && typeof Object.getOwnPropertySymbols == "function")
553
+ for (var r = 0, t = Object.getOwnPropertySymbols(o); r < t.length; r++)
554
+ e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, t[r]) && (n[t[r]] = o[t[r]]);
555
+ return n;
556
+ }, Ne = Ee(function(o, e) {
557
+ var n = o.icon, t = o.id, r = o.className, i = o.extend, s = Kt(o, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), c = Re("_".concat(en()));
558
+ return xe(n, "".concat(t), { defIds: n.defIds, idSuffix: c.current }, P({ ref: e, className: a }, s), i);
559
+ });
560
+ function xe(o, e, n, t, r) {
561
+ return Oe(o.tag, P(P({ key: e }, Qt(o, n, r)), t), (Xt(o, n).children || []).map(function(i, s) {
562
+ return xe(i, "".concat(e, "-").concat(o.tag, "-").concat(s), n, void 0, r);
563
+ }));
564
+ }
565
+ function Qt(o, e, n) {
566
+ var t = P({}, o.attrs);
567
+ n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
568
+ var r = e.defIds;
569
+ return !r || r.length === 0 || (o.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(i) {
570
+ var s = i[0], a = i[1];
571
+ typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
572
+ })), t;
573
+ }
574
+ function Xt(o, e) {
575
+ var n, t = e.defIds;
576
+ return !t || t.length === 0 ? o : o.tag === "defs" && (!((n = o.children) === null || n === void 0) && n.length) ? P(P({}, o), { children: o.children.map(function(r) {
577
+ return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? P(P({}, r), { attrs: P(P({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
578
+ }) }) : o;
579
+ }
580
+ function en() {
581
+ return Math.random().toString(36).substring(2, 8);
582
+ }
583
+ Ne.displayName = "UniverIcon";
584
+ var tn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, De = Ee(function(o, e) {
585
+ return Oe(Ne, Object.assign({}, o, {
586
+ id: "comment-single",
587
+ ref: e,
588
+ icon: tn
589
+ }));
590
+ });
591
+ De.displayName = "CommentSingle";
592
+ var re = { exports: {} }, j = {};
593
+ /**
594
+ * @license React
595
+ * react-jsx-runtime.production.min.js
596
+ *
597
+ * Copyright (c) Facebook, Inc. and its affiliates.
598
+ *
599
+ * This source code is licensed under the MIT license found in the
600
+ * LICENSE file in the root directory of this source tree.
601
+ */
602
+ var ve;
603
+ function nn() {
604
+ if (ve) return j;
605
+ ve = 1;
606
+ var o = yt, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, r = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
607
+ function s(a, c, d) {
608
+ var u, m = {}, h = null, l = null;
609
+ d !== void 0 && (h = "" + d), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (l = c.ref);
610
+ for (u in c) t.call(c, u) && !i.hasOwnProperty(u) && (m[u] = c[u]);
611
+ if (a && a.defaultProps) for (u in c = a.defaultProps, c) m[u] === void 0 && (m[u] = c[u]);
612
+ return { $$typeof: e, type: a, key: h, ref: l, props: m, _owner: r.current };
613
+ }
614
+ return j.Fragment = n, j.jsx = s, j.jsxs = s, j;
615
+ }
616
+ var fe;
617
+ function rn() {
618
+ return fe || (fe = 1, re.exports = nn()), re.exports;
619
+ }
620
+ var je = rn();
621
+ const on = () => {
622
+ const o = R(N), e = R(O), n = A(e.activePopup$), t = R(x);
623
+ if (A(t.commentUpdate$), !n)
624
+ return null;
625
+ const { row: r, col: i, unitId: s, subUnitId: a, trigger: c } = n, d = t.getByLocation(s, a, r, i), u = `${qe.chatAtABC(i)}${r + 1}`, m = () => {
626
+ e.hidePopup();
627
+ }, h = (l) => {
628
+ var v, S, U;
629
+ return (U = (S = (v = o.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : v.getSheetBySheetId(l)) == null ? void 0 : S.getName()) != null ? U : "";
630
+ };
631
+ return /* @__PURE__ */ je.jsx(
632
+ rt,
633
+ {
634
+ onClick: () => {
635
+ e.persistPopup();
636
+ },
637
+ prefix: "cell",
638
+ id: d,
639
+ unitId: s,
640
+ subUnitId: a,
641
+ type: b.UNIVER_SHEET,
642
+ refStr: u,
643
+ onClose: m,
644
+ getSubUnitName: h,
645
+ autoFocus: c === "context-menu"
646
+ }
647
+ );
648
+ }, sn = () => {
649
+ var g;
650
+ const o = R(Pe), e = R(N), n = R(O), t = e.getCurrentUnitForType(b.UNIVER_SHEET), r = t.getUnitId(), i = R(ae), s = Et(() => t.activeSheet$.pipe(bt((p) => p == null ? void 0 : p.getSheetId())), [t.activeSheet$]), a = A(s, (g = t.getActiveSheet()) == null ? void 0 : g.getSheetId()), c = Re(), d = R(ce), u = A(d.activeCommentId$), m = A(d.panelVisible$, d.panelVisible), h = pe((p) => {
651
+ const I = t.getSheets(), f = {};
652
+ I.forEach((T, C) => {
653
+ f[T.getSheetId()] = C;
654
+ });
655
+ const M = (T) => T.map((C) => {
656
+ var de;
657
+ const y = V(C.ref), Be = [(de = f[C.subUnitId]) != null ? de : 0, y.row, y.column];
658
+ return { ...C, p: Be };
659
+ }).sort((C, y) => C.p[0] === y.p[0] ? C.p[1] === y.p[1] ? C.p[2] - y.p[2] : C.p[1] - y.p[1] : C.p[0] - y.p[0]);
660
+ return [
661
+ ...M(p.filter((T) => !T.resolved)),
662
+ ...M(p.filter((T) => T.resolved))
663
+ ];
664
+ }, [t]), l = pe((p) => {
665
+ var I;
666
+ if (p.unitId === r && p.subUnitId === a && !p.resolved) {
667
+ const { row: f, column: M } = V(p.ref), T = t.getSheetBySheetId(p.subUnitId), C = (I = T == null ? void 0 : T.getMergedCell(f, M)) != null ? I : {
668
+ startColumn: M,
669
+ endColumn: M,
670
+ startRow: f,
671
+ endRow: f
672
+ };
673
+ if (!Number.isNaN(f) && !Number.isNaN(M))
674
+ return o.addShape({
675
+ range: C,
676
+ style: {
677
+ // hasAutoFill: false,
678
+ fill: "rgb(255, 189, 55, 0.35)",
679
+ strokeWidth: 1,
680
+ stroke: "#FFBD37",
681
+ widgets: {}
682
+ },
683
+ primary: null
684
+ });
685
+ }
686
+ }, [o, a, r]), v = (p) => {
687
+ var I, f;
688
+ return (f = (I = t.getSheetBySheetId(p)) == null ? void 0 : I.getName()) != null ? f : "";
689
+ }, S = () => {
690
+ i.executeCommand(B.id);
691
+ }, U = (p) => {
692
+ u && u.unitId === p.unitId && u.subUnitId === p.subUnitId && u.commentId === p.id || (c.current && (o.removeShape(c.current), c.current = null), c.current = l(p));
693
+ }, D = () => {
694
+ c.current && (o.removeShape(c.current), c.current = null);
695
+ }, ee = (p, I) => {
696
+ I && n.hidePopup();
697
+ };
698
+ return Rt(() => {
699
+ !m && c.current && o.removeShape(c.current);
700
+ }, [o, m]), /* @__PURE__ */ je.jsx(
701
+ ot,
702
+ {
703
+ unitId: r,
704
+ subUnitId$: s,
705
+ type: b.UNIVER_SHEET,
706
+ onAdd: S,
707
+ getSubUnitName: v,
708
+ onResolve: ee,
709
+ sortComments: h,
710
+ onItemEnter: U,
711
+ onItemLeave: D,
712
+ onDeleteComment: () => (D(), !0)
713
+ }
714
+ );
715
+ }, an = (o) => ({
716
+ id: B.id,
717
+ type: be.BUTTON,
718
+ icon: me,
719
+ title: "sheetThreadComment.menu.addComment",
720
+ hidden$: Me(o, b.UNIVER_SHEET),
721
+ disabled$: Te(o, {
722
+ workbookTypes: [K],
723
+ worksheetTypes: [Q],
724
+ rangeTypes: [X]
725
+ })
726
+ }), cn = (o) => ({
727
+ id: ge.id,
728
+ type: be.BUTTON,
729
+ icon: me,
730
+ tooltip: "sheetThreadComment.menu.commentManagement",
731
+ disabled$: Te(o, {
732
+ workbookTypes: [K],
733
+ worksheetTypes: [Q],
734
+ rangeTypes: [X]
735
+ }),
736
+ hidden$: Me(o, b.UNIVER_SHEET)
737
+ }), un = {
738
+ id: B.id,
739
+ binding: vt.M | le.CTRL_COMMAND | le.ALT,
740
+ preconditions: pt
741
+ }, mn = {
742
+ [ft.OTHERS]: {
743
+ [ge.id]: {
744
+ order: 1,
745
+ menuItemFactory: cn
746
+ }
747
+ },
748
+ [Ct.MAIN_AREA]: {
749
+ [St.OTHERS]: {
750
+ [B.id]: {
751
+ order: 0,
752
+ menuItemFactory: an
753
+ }
754
+ }
755
+ }
756
+ };
757
+ var dn = Object.defineProperty, hn = Object.getOwnPropertyDescriptor, ln = (o, e, n, t) => {
758
+ for (var r = t > 1 ? void 0 : t ? hn(e, n) : e, i = o.length - 1, s; i >= 0; i--)
759
+ (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
760
+ return t && r && dn(e, n, r), r;
761
+ }, oe = (o, e) => (n, t) => e(n, t, o);
762
+ let J = class extends $ {
763
+ constructor(o, e, n) {
764
+ super(), this._menuManagerService = o, this._componentManager = e, this._shortcutService = n, this._initMenu(), this._initShortcut(), this._initComponent();
765
+ }
766
+ _initShortcut() {
767
+ this._shortcutService.registerShortcut(un);
768
+ }
769
+ _initMenu() {
770
+ this._menuManagerService.mergeMenu(mn);
771
+ }
772
+ _initComponent() {
773
+ [
774
+ [Ue, on],
775
+ [it, sn],
776
+ [me, De]
777
+ ].forEach(([o, e]) => {
778
+ this._componentManager.register(o, e);
779
+ });
780
+ }
781
+ };
782
+ J = ln([
783
+ oe(0, It),
784
+ oe(1, _(gt)),
785
+ oe(2, Pt)
786
786
  ], J);
787
787
  var Ae = Object.defineProperty, pn = Object.getOwnPropertyDescriptor, _n = (o, e, n) => e in o ? Ae(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n, vn = (o, e, n, t) => {
788
788
  for (var r = t > 1 ? void 0 : t ? pn(e, n) : e, i = o.length - 1, s; i >= 0; i--)
@@ -797,24 +797,24 @@ let Y = class extends Ye {
797
797
  }
798
798
  onStarting() {
799
799
  [
800
- [Z],
800
+ [J],
801
801
  [W],
802
+ [Z],
802
803
  [z],
803
- [q],
804
- [J],
805
804
  [G],
805
+ [q],
806
806
  [O]
807
807
  ].forEach((o) => {
808
808
  this._injector.add(o);
809
809
  }), [B].forEach((o) => {
810
810
  this._commandService.registerCommand(o);
811
- }), this._injector.get(Z);
811
+ }), this._injector.get(J);
812
812
  }
813
813
  onReady() {
814
- this._injector.get(W), this._injector.get(J);
814
+ this._injector.get(W), this._injector.get(G);
815
815
  }
816
816
  onRendered() {
817
- this._injector.get(z), this._injector.get(q), this._injector.get(G);
817
+ this._injector.get(Z), this._injector.get(z), this._injector.get(q);
818
818
  }
819
819
  };
820
820
  Ve(Y, "pluginName", $e);
@@ -1,6 +1,6 @@
1
1
  import { DependencyOverride } from '@univerjs/core';
2
2
  import { MenuConfig } from '@univerjs/ui';
3
- export declare const PLUGIN_CONFIG_KEY = "sheets-thread-comment.config";
3
+ export declare const SHEETS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY = "sheets-thread-comment.config";
4
4
  export declare const configSymbol: unique symbol;
5
5
  export interface IUniverSheetsThreadCommentUIConfig {
6
6
  menu?: MenuConfig;
package/lib/umd/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(d,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("react"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","react","@univerjs/engine-formula","@univerjs/thread-comment"],a):(d=typeof globalThis<"u"?globalThis:d||self,a(d.UniverSheetsThreadCommentUi={},d.UniverCore,d.UniverSheets,d.UniverSheetsThreadComment,d.UniverThreadCommentUi,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverEngineRender,d.React,d.UniverEngineFormula,d.UniverThreadComment))})(this,function(d,a,v,A,P,I,f,k,ie,O,$,C){"use strict";var rt=Object.defineProperty;var it=(d,a,v)=>a in d?rt(d,a,{enumerable:!0,configurable:!0,writable:!0,value:v}):d[a]=v;var N=(d,a,v)=>it(d,typeof a!="symbol"?a+"":a,v);const oe="univer.sheet.thread-comment-modal",K="comment-single",Q="SHEET_THREAD_COMMENT";var Se=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,fe=(i,t,n,e)=>{for(var r=e>1?void 0:e?_e(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Se(t,n,r),r},se=(i,t)=>(n,e)=>t(n,e,i);d.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var m;const{row:r,col:o,unitId:s,subUnitId:c}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&c===((m=this.activePopup)==null?void 0:m.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const u=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:oe,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const h=new a.DisposableCollection;h.add(u),h.add({dispose:()=>{e==null||e()}}),this._lastPopup=h}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}},d.SheetsThreadCommentPopupService=fe([se(0,a.Inject(I.SheetCanvasPopManagerService)),se(1,f.IZenZoneService)],d.SheetsThreadCommentPopupService);const B={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var g;const t=i.get(v.SheetsSelectionsService),n=i.get(a.IUniverInstanceService),e=i.get(d.SheetsThreadCommentPopupService),r=i.get(P.ThreadCommentPanelService),o=(g=t.getCurrentLastSelection())==null?void 0:g.primary,s=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const c=v.getSheetCommandTarget(n);if(!c)return!1;const{workbook:u,worksheet:h,unitId:m,subUnitId:l}=c,p={workbook:u,worksheet:h,unitId:m,subUnitId:l,row:o.startRow,col:o.startColumn};e.showPopup(p);const S=s.getByLocation(m,l,o.startRow,o.startColumn);return S&&r.setActiveComment({unitId:m,subUnitId:l,commentId:S,trigger:"context-menu"}),!0}},Ce="sheets-thread-comment.config",Ie={};var ge=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Te=(i,t,n,e)=>{for(var r=e>1?void 0:e?Pe(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&ge(t,n,r),r},L=(i,t)=>(n,e)=>t(n,e,i);let W=class extends a.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(v.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,n)=>{const{row:e,col:r,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,r)?n({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):n(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};W=Te([L(0,a.Inject(v.SheetInterceptorService)),L(1,a.Inject(A.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,ie.IRenderManagerService)],W);var y=function(){return y=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},y.apply(this,arguments)},be=function(i,t){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(n[e[r]]=i[e[r]]);return n},ae=O.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,s=be(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),u=O.useRef("_".concat(we()));return ce(n,"".concat(e),{defIds:n.defIds,idSuffix:u.current},y({ref:t,className:c},s),o)});function ce(i,t,n,e,r){return O.createElement(i.tag,y(y({key:t},ye(i,n,r)),e),(Me(i,n).children||[]).map(function(o,s){return ce(o,"".concat(t,"-").concat(i.tag,"-").concat(s),n,void 0,r)}))}function ye(i,t,n){var e=y({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(e[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function Me(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?y(y({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?y(y({},r),{attrs:y(y({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function we(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var Re={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ue=O.forwardRef(function(i,t){return O.createElement(ae,Object.assign({},i,{id:"comment-single",ref:t,icon:Re}))});ue.displayName="CommentSingle";var X={exports:{}},x={};/**
1
+ (function(d,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","@univerjs/engine-formula","@univerjs/thread-comment","react"],a):(d=typeof globalThis<"u"?globalThis:d||self,a(d.UniverSheetsThreadCommentUi={},d.UniverCore,d.UniverSheets,d.UniverSheetsThreadComment,d.UniverThreadCommentUi,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverEngineRender,d.UniverEngineFormula,d.UniverThreadComment,d.React))})(this,function(d,a,v,A,P,I,f,k,ie,$,C,E){"use strict";var rt=Object.defineProperty;var it=(d,a,v)=>a in d?rt(d,a,{enumerable:!0,configurable:!0,writable:!0,value:v}):d[a]=v;var N=(d,a,v)=>it(d,typeof a!="symbol"?a+"":a,v);const oe="univer.sheet.thread-comment-modal",K="comment-single",Q="SHEET_THREAD_COMMENT";var Se=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,fe=(i,t,n,e)=>{for(var r=e>1?void 0:e?_e(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Se(t,n,r),r},se=(i,t)=>(n,e)=>t(n,e,i);d.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var m;const{row:r,col:o,unitId:s,subUnitId:c}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&c===((m=this.activePopup)==null?void 0:m.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const u=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:oe,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const h=new a.DisposableCollection;h.add(u),h.add({dispose:()=>{e==null||e()}}),this._lastPopup=h}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}},d.SheetsThreadCommentPopupService=fe([se(0,a.Inject(I.SheetCanvasPopManagerService)),se(1,f.IZenZoneService)],d.SheetsThreadCommentPopupService);const B={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var g;const t=i.get(v.SheetsSelectionsService),n=i.get(a.IUniverInstanceService),e=i.get(d.SheetsThreadCommentPopupService),r=i.get(P.ThreadCommentPanelService),o=(g=t.getCurrentLastSelection())==null?void 0:g.primary,s=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const c=v.getSheetCommandTarget(n);if(!c)return!1;const{workbook:u,worksheet:h,unitId:m,subUnitId:l}=c,p={workbook:u,worksheet:h,unitId:m,subUnitId:l,row:o.startRow,col:o.startColumn};e.showPopup(p);const S=s.getByLocation(m,l,o.startRow,o.startColumn);return S&&r.setActiveComment({unitId:m,subUnitId:l,commentId:S,trigger:"context-menu"}),!0}},Ce="sheets-thread-comment.config",Ie={};var ge=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Te=(i,t,n,e)=>{for(var r=e>1?void 0:e?Pe(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&ge(t,n,r),r},L=(i,t)=>(n,e)=>t(n,e,i);let W=class extends a.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(v.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,n)=>{const{row:e,col:r,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,r)?n({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):n(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};W=Te([L(0,a.Inject(v.SheetInterceptorService)),L(1,a.Inject(A.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,ie.IRenderManagerService)],W);var be=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,Me=(i,t,n,e)=>{for(var r=e>1?void 0:e?ye(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&be(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);const we=(i,t,n)=>{const e=$.singleReferenceToGrid(i),r=n.row-t.row,o=n.column-t.column,s={startColumn:e.column+o,startRow:e.row+r,endColumn:e.column+o,endRow:e.row+r};return $.serializeRange(s)};let F=class extends a.Disposable{constructor(t,n,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:s,range:c}=n,u={row:c.rows[0],column:c.cols[0]};if(r.copyType===I.COPY_TYPE.CUT&&this._copyInfo){const{range:h,unitId:m,subUnitId:l}=this._copyInfo,p={row:h.startRow,column:h.startColumn};if(!(o===m&&s===l)){const S=[];a.Range.foreach(h,(w,_)=>{const R=this._sheetsThreadCommentModel.getAllByLocation(m,l,w,_);this._threadCommentDataSourceService.syncUpdateMutationToColla?R.forEach(T=>{S.push(T)}):R.forEach(({children:T,...j})=>{j.parentId||S.push(j)})});const g=[],M=[],V=[],H=[],re=w=>{g.unshift({id:C.DeleteCommentMutation.id,params:{unitId:m,subUnitId:l,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:we(w.ref,p,u),unitId:o,subUnitId:s},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:m,subUnitId:l,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return S.forEach(w=>{re(w)}),{redos:[...g,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};F=Me([X(0,a.Inject(I.ISheetClipboardService)),X(1,a.Inject(A.SheetsThreadCommentModel)),X(2,C.IThreadCommentDataSourceService)],F);var Re=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Re(t,n,r),r},G=(i,t)=>(n,e)=>t(n,e,i);let Z=class extends a.Disposable{constructor(i,t,n,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:n}=i,{unitId:e,subUnitId:r,row:o,col:s}=n,c=this._sheetsThreadCommentModel.getByLocation(e,r,o,s);if(c){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const h=this._sheetsThreadCommentModel.getComment(e,r,c);h&&!h.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:s,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};Z=Oe([G(0,a.Inject(I.HoverManagerService)),G(1,a.Inject(d.SheetsThreadCommentPopupService)),G(2,a.Inject(A.SheetsThreadCommentModel)),G(3,a.Inject(I.SheetPermissionInterceptorBaseController))],Z);var Ue=Object.defineProperty,je=Object.getOwnPropertyDescriptor,De=(i,t,n,e)=>{for(var r=e>1?void 0:e?je(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ue(t,n,r),r},U=(i,t)=>(n,e)=>t(n,e,i);let z=class extends a.Disposable{constructor(t,n,e,r,o,s,c,u,h,m){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=c,this._sheetSelectionService=u,this._editorBridgeService=h,this._renderManagerService=m,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var p,S,g;const r=(p=t[0])==null?void 0:p.range,o=this._renderManagerService.getRenderById(n),s=(S=o==null?void 0:o.with(I.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:S.skeleton;if(!s||!r)return;const c=s.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((g=r.rangeType)!=null?g:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&a.Rectangle.equals(c.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const h=c.actualRow,m=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,h,m)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const l=this._sheetsThreadCommentModel.getByLocation(n,e,h,m);l&&this._commandService.executeCommand(P.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:l})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId:s}=e;n.unitId===r&&n.subUnitId===o&&n.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:o,trigger:s}=t,c=this._sheetsThreadCommentModel.getComment(e,r,o);if(!c||c.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=u.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(v.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const l=$.singleReferenceToGrid(c.ref),{row:p,column:S}=l;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:S,endRow:p,endColumn:S}]))return;const M=1;if(await this._commandService.executeCommand(I.ScrollToRangeOperation.id,{range:{startRow:Math.max(l.row-M,0),endRow:l.row+M,startColumn:Math.max(l.column-M,0),endColumn:l.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:l.row,col:l.column,commentId:c.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var p,S;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(n,e,r);if(!o)return;const s=$.singleReferenceToGrid(o.ref),{row:c,column:u}=s;if(Number.isNaN(c)||Number.isNaN(u))return null;const h=(p=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getSheetBySheetId(e),m=(S=h==null?void 0:h.getMergedCell(c,u))!=null?S:{startColumn:u,endColumn:u,startRow:c,endRow:c},l=this._markSelectionService.addShape({range:m,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);l&&(this._selectionShapeInfo={...t,shapeId:l})}))}};z=De([U(0,a.ICommandService),U(1,a.Inject(d.SheetsThreadCommentPopupService)),U(2,a.Inject(A.SheetsThreadCommentModel)),U(3,a.Inject(P.ThreadCommentPanelService)),U(4,a.IUniverInstanceService),U(5,a.Inject(I.SheetPermissionInterceptorBaseController)),U(6,I.IMarkSelectionService),U(7,a.Inject(v.SheetsSelectionsService)),U(8,I.IEditorBridgeService),U(9,ie.IRenderManagerService)],z);var Ne=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,Ve=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ae(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ne(t,n,r),r},q=(i,t)=>(n,e)=>t(n,e,i);let Y=class extends a.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===v.RemoveSheetCommand.id){const n=i.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(r,o),c=Array.from(s.values()).filter(p=>!p.parentId),u=c.map(p=>p.id),h=this._threadCommentDataSourceService.syncUpdateMutationToColla,m=u.map(p=>({id:C.DeleteCommentMutation.id,params:{unitId:r,subUnitId:o,commentId:p}})),l=c.map(({children:p,...S})=>({id:C.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{...S,children:h?p:void 0},sync:!h}}));return{redos:m,undos:l}}return{redos:[],undos:[]}}}))}};Y=Ve([q(0,a.Inject(v.SheetInterceptorService)),q(1,a.IUniverInstanceService),q(2,a.Inject(C.ThreadCommentModel)),q(3,C.IThreadCommentDataSourceService)],Y);var y=function(){return y=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},y.apply(this,arguments)},$e=function(i,t){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(n[e[r]]=i[e[r]]);return n},ae=E.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,s=$e(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),u=E.useRef("_".concat(xe()));return ce(n,"".concat(e),{defIds:n.defIds,idSuffix:u.current},y({ref:t,className:c},s),o)});function ce(i,t,n,e,r){return E.createElement(i.tag,y(y({key:t},Be(i,n,r)),e),(ke(i,n).children||[]).map(function(o,s){return ce(o,"".concat(t,"-").concat(i.tag,"-").concat(s),n,void 0,r)}))}function Be(i,t,n){var e=y({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(e[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ke(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?y(y({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?y(y({},r),{attrs:y(y({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function xe(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var He={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ue=E.forwardRef(function(i,t){return E.createElement(ae,Object.assign({},i,{id:"comment-single",ref:t,icon:He}))});ue.displayName="CommentSingle";var ee={exports:{}},x={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var de;function Oe(){if(de)return x;de=1;var i=O,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(c,u,h){var m,l={},p=null,S=null;h!==void 0&&(p=""+h),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(S=u.ref);for(m in u)e.call(u,m)&&!o.hasOwnProperty(m)&&(l[m]=u[m]);if(c&&c.defaultProps)for(m in u=c.defaultProps,u)l[m]===void 0&&(l[m]=u[m]);return{$$typeof:t,type:c,key:p,ref:S,props:l,_owner:r.current}}return x.Fragment=n,x.jsx=s,x.jsxs=s,x}var me;function Ee(){return me||(me=1,X.exports=Oe()),X.exports}var he=Ee();const Ue=()=>{const i=a.useDependency(a.IUniverInstanceService),t=a.useDependency(d.SheetsThreadCommentPopupService),n=f.useObservable(t.activePopup$),e=a.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:s,subUnitId:c,trigger:u}=n,h=e.getByLocation(s,c,r,o),m=`${a.Tools.chatAtABC(o)}${r+1}`,l=()=>{t.hidePopup()},p=S=>{var g,M,V;return(V=(M=(g=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:g.getSheetBySheetId(S))==null?void 0:M.getName())!=null?V:""};return he.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:h,unitId:s,subUnitId:c,type:a.UniverInstanceType.UNIVER_SHEET,refStr:m,onClose:l,getSubUnitName:p,autoFocus:u==="context-menu"})},je=()=>{var w;const i=a.useDependency(I.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),n=a.useDependency(d.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=a.useDependency(a.ICommandService),s=O.useMemo(()=>e.activeSheet$.pipe(k.map(_=>_==null?void 0:_.getSheetId())),[e.activeSheet$]),c=f.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=O.useRef(),h=a.useDependency(P.ThreadCommentPanelService),m=f.useObservable(h.activeCommentId$),l=f.useObservable(h.panelVisible$,h.panelVisible),p=O.useCallback(_=>{const R=e.getSheets(),T={};R.forEach((E,b)=>{T[E.getSheetId()]=b});const j=E=>E.map(b=>{var ve;const D=$.singleReferenceToGrid(b.ref),nt=[(ve=T[b.subUnitId])!=null?ve:0,D.row,D.column];return{...b,p:nt}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(_.filter(E=>!E.resolved)),...j(_.filter(E=>E.resolved))]},[e]),S=O.useCallback(_=>{var R;if(_.unitId===r&&_.subUnitId===c&&!_.resolved){const{row:T,column:j}=$.singleReferenceToGrid(_.ref),E=e.getSheetBySheetId(_.subUnitId),b=(R=E==null?void 0:E.getMergedCell(T,j))!=null?R:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,c,r]),g=_=>{var R,T;return(T=(R=e.getSheetBySheetId(_))==null?void 0:R.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=_=>{m&&m.unitId===_.unitId&&m.subUnitId===_.subUnitId&&m.commentId===_.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=S(_))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},re=(_,R)=>{R&&n.hidePopup()};return O.useEffect(()=>{!l&&u.current&&i.removeShape(u.current)},[i,l]),he.jsx(P.ThreadCommentPanel,{unitId:r,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:g,onResolve:re,sortComments:p,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},De=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:K,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]})}),Ne=i=>({id:P.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:K,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),Ae={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ve={[f.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:Ne}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:De}}}};var $e=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,ke=(i,t,n,e)=>{for(var r=e>1?void 0:e?Be(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&$e(t,n,r),r},ee=(i,t)=>(n,e)=>t(n,e,i);let F=class extends a.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Ae)}_initMenu(){this._menuManagerService.mergeMenu(Ve)}_initComponent(){[[oe,Ue],[P.THREAD_COMMENT_PANEL,je],[K,ue]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};F=ke([ee(0,f.IMenuManagerService),ee(1,a.Inject(f.ComponentManager)),ee(2,f.IShortcutService)],F);var xe=Object.defineProperty,He=Object.getOwnPropertyDescriptor,Le=(i,t,n,e)=>{for(var r=e>1?void 0:e?He(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&xe(t,n,r),r},te=(i,t)=>(n,e)=>t(n,e,i);const We=(i,t,n)=>{const e=$.singleReferenceToGrid(i),r=n.row-t.row,o=n.column-t.column,s={startColumn:e.column+o,startRow:e.row+r,endColumn:e.column+o,endRow:e.row+r};return $.serializeRange(s)};let G=class extends a.Disposable{constructor(t,n,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:s,range:c}=n,u={row:c.rows[0],column:c.cols[0]};if(r.copyType===I.COPY_TYPE.CUT&&this._copyInfo){const{range:h,unitId:m,subUnitId:l}=this._copyInfo,p={row:h.startRow,column:h.startColumn};if(!(o===m&&s===l)){const S=[];a.Range.foreach(h,(w,_)=>{const R=this._sheetsThreadCommentModel.getAllByLocation(m,l,w,_);this._threadCommentDataSourceService.syncUpdateMutationToColla?R.forEach(T=>{S.push(T)}):R.forEach(({children:T,...j})=>{j.parentId||S.push(j)})});const g=[],M=[],V=[],H=[],re=w=>{g.unshift({id:C.DeleteCommentMutation.id,params:{unitId:m,subUnitId:l,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:We(w.ref,p,u),unitId:o,subUnitId:s},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:m,subUnitId:l,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return S.forEach(w=>{re(w)}),{redos:[...g,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};G=Le([te(0,a.Inject(I.ISheetClipboardService)),te(1,a.Inject(A.SheetsThreadCommentModel)),te(2,C.IThreadCommentDataSourceService)],G);var Fe=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,Ze=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ge(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Fe(t,n,r),r},Z=(i,t)=>(n,e)=>t(n,e,i);let z=class extends a.Disposable{constructor(i,t,n,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:n}=i,{unitId:e,subUnitId:r,row:o,col:s}=n,c=this._sheetsThreadCommentModel.getByLocation(e,r,o,s);if(c){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const h=this._sheetsThreadCommentModel.getComment(e,r,c);h&&!h.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:s,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};z=Ze([Z(0,a.Inject(I.HoverManagerService)),Z(1,a.Inject(d.SheetsThreadCommentPopupService)),Z(2,a.Inject(A.SheetsThreadCommentModel)),Z(3,a.Inject(I.SheetPermissionInterceptorBaseController))],z);var ze=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Ye=(i,t,n,e)=>{for(var r=e>1?void 0:e?qe(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&ze(t,n,r),r},U=(i,t)=>(n,e)=>t(n,e,i);let q=class extends a.Disposable{constructor(t,n,e,r,o,s,c,u,h,m){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=c,this._sheetSelectionService=u,this._editorBridgeService=h,this._renderManagerService=m,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var p,S,g;const r=(p=t[0])==null?void 0:p.range,o=this._renderManagerService.getRenderById(n),s=(S=o==null?void 0:o.with(I.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:S.skeleton;if(!s||!r)return;const c=s.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((g=r.rangeType)!=null?g:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&a.Rectangle.equals(c.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const h=c.actualRow,m=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,h,m)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const l=this._sheetsThreadCommentModel.getByLocation(n,e,h,m);l&&this._commandService.executeCommand(P.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:l})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId:s}=e;n.unitId===r&&n.subUnitId===o&&n.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:o,trigger:s}=t,c=this._sheetsThreadCommentModel.getComment(e,r,o);if(!c||c.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=u.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(v.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const l=$.singleReferenceToGrid(c.ref),{row:p,column:S}=l;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:S,endRow:p,endColumn:S}]))return;const M=1;if(await this._commandService.executeCommand(I.ScrollToRangeOperation.id,{range:{startRow:Math.max(l.row-M,0),endRow:l.row+M,startColumn:Math.max(l.column-M,0),endColumn:l.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:l.row,col:l.column,commentId:c.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var p,S;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(n,e,r);if(!o)return;const s=$.singleReferenceToGrid(o.ref),{row:c,column:u}=s;if(Number.isNaN(c)||Number.isNaN(u))return null;const h=(p=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getSheetBySheetId(e),m=(S=h==null?void 0:h.getMergedCell(c,u))!=null?S:{startColumn:u,endColumn:u,startRow:c,endRow:c},l=this._markSelectionService.addShape({range:m,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);l&&(this._selectionShapeInfo={...t,shapeId:l})}))}};q=Ye([U(0,a.ICommandService),U(1,a.Inject(d.SheetsThreadCommentPopupService)),U(2,a.Inject(A.SheetsThreadCommentModel)),U(3,a.Inject(P.ThreadCommentPanelService)),U(4,a.IUniverInstanceService),U(5,a.Inject(I.SheetPermissionInterceptorBaseController)),U(6,I.IMarkSelectionService),U(7,a.Inject(v.SheetsSelectionsService)),U(8,I.IEditorBridgeService),U(9,ie.IRenderManagerService)],q);var Je=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Qe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Je(t,n,r),r},Y=(i,t)=>(n,e)=>t(n,e,i);let J=class extends a.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===v.RemoveSheetCommand.id){const n=i.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(r,o),c=Array.from(s.values()).filter(p=>!p.parentId),u=c.map(p=>p.id),h=this._threadCommentDataSourceService.syncUpdateMutationToColla,m=u.map(p=>({id:C.DeleteCommentMutation.id,params:{unitId:r,subUnitId:o,commentId:p}})),l=c.map(({children:p,...S})=>({id:C.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{...S,children:h?p:void 0},sync:!h}}));return{redos:m,undos:l}}return{redos:[],undos:[]}}}))}};J=Qe([Y(0,a.Inject(v.SheetInterceptorService)),Y(1,a.IUniverInstanceService),Y(2,a.Inject(C.ThreadCommentModel)),Y(3,C.IThreadCommentDataSourceService)],J);var le=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(i,t,n)=>t in i?le(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,tt=(i,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&le(t,n,r),r},ne=(i,t)=>(n,e)=>t(n,e,i),pe=(i,t,n)=>et(i,typeof t!="symbol"?t+"":t,n);d.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Ie,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ce,s)}onStarting(){[[F],[W],[G],[z],[J],[q],[d.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(F)}onReady(){this._injector.get(W),this._injector.get(J)}onRendered(){this._injector.get(G),this._injector.get(z),this._injector.get(q)}},pe(d.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),pe(d.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentUIPlugin=tt([a.DependentOn(P.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),ne(1,a.Inject(a.Injector)),ne(2,a.Inject(a.ICommandService)),ne(3,a.IConfigService)],d.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(d,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>P.UniverThreadCommentUIPlugin}),Object.defineProperty(d,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(d,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(d,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(d,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(d,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(d,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),d.SHEETS_THREAD_COMMENT=Q,d.ShowAddSheetCommentModalOperation=B,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
9
+ */var de;function Le(){if(de)return x;de=1;var i=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(c,u,h){var m,l={},p=null,S=null;h!==void 0&&(p=""+h),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(S=u.ref);for(m in u)e.call(u,m)&&!o.hasOwnProperty(m)&&(l[m]=u[m]);if(c&&c.defaultProps)for(m in u=c.defaultProps,u)l[m]===void 0&&(l[m]=u[m]);return{$$typeof:t,type:c,key:p,ref:S,props:l,_owner:r.current}}return x.Fragment=n,x.jsx=s,x.jsxs=s,x}var me;function We(){return me||(me=1,ee.exports=Le()),ee.exports}var he=We();const Fe=()=>{const i=a.useDependency(a.IUniverInstanceService),t=a.useDependency(d.SheetsThreadCommentPopupService),n=f.useObservable(t.activePopup$),e=a.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:s,subUnitId:c,trigger:u}=n,h=e.getByLocation(s,c,r,o),m=`${a.Tools.chatAtABC(o)}${r+1}`,l=()=>{t.hidePopup()},p=S=>{var g,M,V;return(V=(M=(g=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:g.getSheetBySheetId(S))==null?void 0:M.getName())!=null?V:""};return he.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:h,unitId:s,subUnitId:c,type:a.UniverInstanceType.UNIVER_SHEET,refStr:m,onClose:l,getSubUnitName:p,autoFocus:u==="context-menu"})},Ge=()=>{var w;const i=a.useDependency(I.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),n=a.useDependency(d.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=a.useDependency(a.ICommandService),s=E.useMemo(()=>e.activeSheet$.pipe(k.map(_=>_==null?void 0:_.getSheetId())),[e.activeSheet$]),c=f.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),h=a.useDependency(P.ThreadCommentPanelService),m=f.useObservable(h.activeCommentId$),l=f.useObservable(h.panelVisible$,h.panelVisible),p=E.useCallback(_=>{const R=e.getSheets(),T={};R.forEach((O,b)=>{T[O.getSheetId()]=b});const j=O=>O.map(b=>{var ve;const D=$.singleReferenceToGrid(b.ref),nt=[(ve=T[b.subUnitId])!=null?ve:0,D.row,D.column];return{...b,p:nt}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(_.filter(O=>!O.resolved)),...j(_.filter(O=>O.resolved))]},[e]),S=E.useCallback(_=>{var R;if(_.unitId===r&&_.subUnitId===c&&!_.resolved){const{row:T,column:j}=$.singleReferenceToGrid(_.ref),O=e.getSheetBySheetId(_.subUnitId),b=(R=O==null?void 0:O.getMergedCell(T,j))!=null?R:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,c,r]),g=_=>{var R,T;return(T=(R=e.getSheetBySheetId(_))==null?void 0:R.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=_=>{m&&m.unitId===_.unitId&&m.subUnitId===_.subUnitId&&m.commentId===_.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=S(_))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},re=(_,R)=>{R&&n.hidePopup()};return E.useEffect(()=>{!l&&u.current&&i.removeShape(u.current)},[i,l]),he.jsx(P.ThreadCommentPanel,{unitId:r,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:g,onResolve:re,sortComments:p,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ze=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:K,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]})}),ze=i=>({id:P.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:K,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),qe={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ye={[f.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:ze}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ze}}}};var Je=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Qe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Je(t,n,r),r},te=(i,t)=>(n,e)=>t(n,e,i);let J=class extends a.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(qe)}_initMenu(){this._menuManagerService.mergeMenu(Ye)}_initComponent(){[[oe,Fe],[P.THREAD_COMMENT_PANEL,Ge],[K,ue]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};J=Qe([te(0,f.IMenuManagerService),te(1,a.Inject(f.ComponentManager)),te(2,f.IShortcutService)],J);var le=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(i,t,n)=>t in i?le(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,tt=(i,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&le(t,n,r),r},ne=(i,t)=>(n,e)=>t(n,e,i),pe=(i,t,n)=>et(i,typeof t!="symbol"?t+"":t,n);d.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Ie,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ce,s)}onStarting(){[[J],[W],[F],[Z],[Y],[z],[d.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(J)}onReady(){this._injector.get(W),this._injector.get(Y)}onRendered(){this._injector.get(F),this._injector.get(Z),this._injector.get(z)}},pe(d.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),pe(d.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentUIPlugin=tt([a.DependentOn(P.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),ne(1,a.Inject(a.Injector)),ne(2,a.Inject(a.ICommandService)),ne(3,a.IConfigService)],d.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(d,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>P.UniverThreadCommentUIPlugin}),Object.defineProperty(d,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(d,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(d,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(d,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(d,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(d,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),d.SHEETS_THREAD_COMMENT=Q,d.ShowAddSheetCommentModalOperation=B,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-thread-comment-ui",
3
- "version": "0.5.0-nightly.202411281606",
3
+ "version": "0.5.0-nightly.202411291606",
4
4
  "private": false,
5
5
  "description": "Univer thread comment plugin",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -54,15 +54,15 @@
54
54
  "dependencies": {
55
55
  "@univerjs/icons": "^0.2.7",
56
56
  "clsx": "^2.1.1",
57
- "@univerjs/core": "0.5.0-nightly.202411281606",
58
- "@univerjs/engine-formula": "0.5.0-nightly.202411281606",
59
- "@univerjs/sheets-thread-comment": "0.5.0-nightly.202411281606",
60
- "@univerjs/sheets-ui": "0.5.0-nightly.202411281606",
61
- "@univerjs/sheets": "0.5.0-nightly.202411281606",
62
- "@univerjs/engine-render": "0.5.0-nightly.202411281606",
63
- "@univerjs/thread-comment": "0.5.0-nightly.202411281606",
64
- "@univerjs/thread-comment-ui": "0.5.0-nightly.202411281606",
65
- "@univerjs/ui": "0.5.0-nightly.202411281606"
57
+ "@univerjs/core": "0.5.0-nightly.202411291606",
58
+ "@univerjs/engine-formula": "0.5.0-nightly.202411291606",
59
+ "@univerjs/engine-render": "0.5.0-nightly.202411291606",
60
+ "@univerjs/sheets-thread-comment": "0.5.0-nightly.202411291606",
61
+ "@univerjs/sheets": "0.5.0-nightly.202411291606",
62
+ "@univerjs/thread-comment": "0.5.0-nightly.202411291606",
63
+ "@univerjs/sheets-ui": "0.5.0-nightly.202411291606",
64
+ "@univerjs/ui": "0.5.0-nightly.202411291606",
65
+ "@univerjs/thread-comment-ui": "0.5.0-nightly.202411291606"
66
66
  },
67
67
  "devDependencies": {
68
68
  "postcss": "^8.4.49",