@univerjs/sheets-thread-comment-ui 0.5.5-nightly.202501241606 → 0.6.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +558 -564
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +11 -11
package/lib/es/locale/en-US.js
CHANGED
package/lib/es/locale/fa-IR.js
CHANGED
package/lib/es/locale/fr-FR.js
CHANGED
package/lib/es/locale/ru-RU.js
CHANGED
package/lib/es/locale/vi-VN.js
CHANGED
package/lib/es/locale/zh-CN.js
CHANGED
package/lib/es/locale/zh-TW.js
CHANGED
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(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/jsx-runtime"),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/jsx-runtime","react"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverSheetsThreadCommentUi={},global.UniverCore,global.UniverSheets,global.UniverSheetsThreadComment,global.UniverThreadCommentUi,global.UniverSheetsUi,global.UniverUi,global.rxjs,global.UniverEngineRender,global.UniverEngineFormula,global.UniverThreadComment,global.React,global.React))})(this,function(exports2,core,sheets,sheetsThreadComment,threadCommentUi,sheetsUi,ui,rxjs,engineRender,engineFormula,threadComment,jsxRuntime,react){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b,_c,_d,_e,_f,_g,_h;const SHEETS_THREAD_COMMENT_MODAL="univer.sheet.thread-comment-modal",COMMENT_SINGLE_ICON="comment-single",SHEETS_THREAD_COMMENT="SHEET_THREAD_COMMENT";var __defProp$7=Object.defineProperty,__getOwnPropDesc$7=Object.getOwnPropertyDescriptor,__decorateClass$7=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$7(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$7(target,key,result),result},"__decorateClass$7"),__decorateParam$7=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$7");exports2.SheetsThreadCommentPopupService=(_a=class extends core.Disposable{constructor(_canvasPopupManagerService,_zenZoneService){super();__publicField(this,"_lastPopup",null);__publicField(this,"_activePopup");__publicField(this,"_activePopup$",new rxjs.BehaviorSubject(null));__publicField(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=_canvasPopupManagerService,this._zenZoneService=_zenZoneService,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(visible=>{visible&&this.hidePopup()}))}showPopup(location,onHide){var _a2;const{row,col,unitId,subUnitId}=location;if(this._activePopup&&row===this._activePopup.row&&col===this._activePopup.col&&unitId===this._activePopup.unitId&&subUnitId===((_a2=this.activePopup)==null?void 0:_a2.subUnitId)){this._activePopup=location,this._activePopup$.next(location);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=location,this._activePopup$.next(location);const popupDisposable=this._canvasPopupManagerService.attachPopupToCell(row,col,{componentKey:SHEETS_THREAD_COMMENT_MODAL,onClickOutside:__name(()=>{this.hidePopup()},"onClickOutside"),direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!popupDisposable)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const disposableCollection=new core.DisposableCollection;disposableCollection.add(popupDisposable),disposableCollection.add({dispose:__name(()=>{onHide==null||onHide()},"dispose")}),this._lastPopup=disposableCollection}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))}},__name(_a,"SheetsThreadCommentPopupService"),_a),exports2.SheetsThreadCommentPopupService=__decorateClass$7([__decorateParam$7(0,core.Inject(sheetsUi.SheetCanvasPopManagerService)),__decorateParam$7(1,ui.IZenZoneService)],exports2.SheetsThreadCommentPopupService);const ShowAddSheetCommentModalOperation={type:core.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(accessor){var _a2;const selectionManagerService=accessor.get(sheets.SheetsSelectionsService),univerInstanceService=accessor.get(core.IUniverInstanceService),sheetsThreadCommentPopupService=accessor.get(exports2.SheetsThreadCommentPopupService),threadCommentPanelService=accessor.get(threadCommentUi.ThreadCommentPanelService),activeCell=(_a2=selectionManagerService.getCurrentLastSelection())==null?void 0:_a2.primary,model=accessor.get(sheetsThreadComment.SheetsThreadCommentModel);if(!activeCell)return!1;const result=sheets.getSheetCommandTarget(univerInstanceService);if(!result)return!1;const{workbook,worksheet,unitId,subUnitId}=result,location={workbook,worksheet,unitId,subUnitId,row:activeCell.startRow,col:activeCell.startColumn};sheetsThreadCommentPopupService.showPopup(location);const rootId=model.getByLocation(unitId,subUnitId,activeCell.startRow,activeCell.startColumn);return rootId&&threadCommentPanelService.setActiveComment({unitId,subUnitId,commentId:rootId,trigger:"context-menu"}),!0}},SHEETS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY="sheets-thread-comment.config",defaultPluginConfig={};var __defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__decorateClass$6=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$6(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$6(target,key,result),result},"__decorateClass$6"),__decorateParam$6=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$6");let SheetsThreadCommentRenderController=(_b=class extends core.Disposable{constructor(_sheetInterceptorService,_sheetsThreadCommentModel,_univerInstanceService,_renderManagerService){super(),this._sheetInterceptorService=_sheetInterceptorService,this._sheetsThreadCommentModel=_sheetsThreadCommentModel,this._univerInstanceService=_univerInstanceService,this._renderManagerService=_renderManagerService,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(sheets.INTERCEPTOR_POINT.CELL_CONTENT,{effect:core.InterceptorEffectEnum.Style,handler:__name((cell,pos,next)=>{const{row,col,unitId,subUnitId}=pos;return this._sheetsThreadCommentModel.showCommentMarker(unitId,subUnitId,row,col)?next({...cell,markers:{...cell==null?void 0:cell.markers,tr:{color:"#FFBD37",size:6}}}):next(cell)},"handler"),priority:100}))}_initSkeletonChange(){const markSkeletonDirty=__name(()=>{var _a2;const workbook=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(!workbook)return;const unitId=workbook.getUnitId(),currentRender=this._renderManagerService.getRenderById(unitId);(_a2=currentRender==null?void 0:currentRender.mainComponent)==null||_a2.makeForceDirty()},"markSkeletonDirty");this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(rxjs.debounceTime(16)).subscribe(()=>{markSkeletonDirty()}))}},__name(_b,"SheetsThreadCommentRenderController"),_b);SheetsThreadCommentRenderController=__decorateClass$6([__decorateParam$6(0,core.Inject(sheets.SheetInterceptorService)),__decorateParam$6(1,core.Inject(sheetsThreadComment.SheetsThreadCommentModel)),__decorateParam$6(2,core.IUniverInstanceService),__decorateParam$6(3,engineRender.IRenderManagerService)],SheetsThreadCommentRenderController);var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$5(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$5(target,key,result),result},"__decorateClass$5"),__decorateParam$5=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$5");const transformRef=__name((ref,source,target)=>{const refObj=engineFormula.singleReferenceToGrid(ref),offsetRow=target.row-source.row,offsetCol=target.column-source.column,targetRange={startColumn:refObj.column+offsetCol,startRow:refObj.row+offsetRow,endColumn:refObj.column+offsetCol,endRow:refObj.row+offsetRow};return engineFormula.serializeRange(targetRange)},"transformRef");let SheetsThreadCommentCopyPasteController=(_c=class extends core.Disposable{constructor(_sheetClipboardService,_sheetsThreadCommentModel,_threadCommentDataSourceService){super();__publicField(this,"_copyInfo");this._sheetClipboardService=_sheetClipboardService,this._sheetsThreadCommentModel=_sheetsThreadCommentModel,this._threadCommentDataSourceService=_threadCommentDataSourceService,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:SHEETS_THREAD_COMMENT,onBeforeCopy:__name((unitId,subUnitId,range)=>{this._copyInfo={unitId,subUnitId,range}},"onBeforeCopy"),onPasteCells:__name((_pasteFrom,pasteTo,_data,payload)=>{const{unitId:targetUnitId,subUnitId:targetSubUnitId,range}=pasteTo,targetPos={row:range.rows[0],column:range.cols[0]};if(payload.copyType===sheetsUi.COPY_TYPE.CUT&&this._copyInfo){const{range:range2,unitId:sourceUnitId,subUnitId:sourceSubUnitId}=this._copyInfo,sourcePos={row:range2.startRow,column:range2.startColumn};if(!(targetUnitId===sourceUnitId&&targetSubUnitId===sourceSubUnitId)){const roots=[];core.Range.foreach(range2,(row,col)=>{const comments=this._sheetsThreadCommentModel.getAllByLocation(sourceUnitId,sourceSubUnitId,row,col);this._threadCommentDataSourceService.syncUpdateMutationToColla?comments.forEach(comment=>{roots.push(comment)}):comments.forEach(({children,...comment})=>{comment.parentId||roots.push(comment)})});const sourceRedos=[],sourceUndos=[],targetRedos=[],targetUndos=[],handleCommentItem=__name(item=>{sourceRedos.unshift({id:threadComment.DeleteCommentMutation.id,params:{unitId:sourceUnitId,subUnitId:sourceSubUnitId,commentId:item.id}}),targetRedos.push({id:threadComment.AddCommentMutation.id,params:{unitId:targetUnitId,subUnitId:targetSubUnitId,comment:{...item,ref:transformRef(item.ref,sourcePos,targetPos),unitId:targetUnitId,subUnitId:targetSubUnitId},sync:!0}}),sourceUndos.push({id:threadComment.AddCommentMutation.id,params:{unitId:sourceUnitId,subUnitId:sourceSubUnitId,comment:item,sync:!0}}),targetUndos.unshift({id:threadComment.DeleteCommentMutation.id,params:{unitId:targetUnitId,subUnitId:targetSubUnitId,commentId:item.id}})},"handleCommentItem");return roots.forEach(root=>{handleCommentItem(root)}),{redos:[...sourceRedos,...targetRedos],undos:[...targetUndos,...sourceUndos]}}}return{redos:[],undos:[]}},"onPasteCells")}))}},__name(_c,"SheetsThreadCommentCopyPasteController"),_c);SheetsThreadCommentCopyPasteController=__decorateClass$5([__decorateParam$5(0,core.Inject(sheetsUi.ISheetClipboardService)),__decorateParam$5(1,core.Inject(sheetsThreadComment.SheetsThreadCommentModel)),__decorateParam$5(2,threadComment.IThreadCommentDataSourceService)],SheetsThreadCommentCopyPasteController);var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4");let SheetsThreadCommentHoverController=(_d=class extends core.Disposable{constructor(_hoverManagerService,_sheetsThreadCommentPopupService,_sheetsThreadCommentModel,_sheetPermissionCheckController){super(),this._hoverManagerService=_hoverManagerService,this._sheetsThreadCommentPopupService=_sheetsThreadCommentPopupService,this._sheetsThreadCommentModel=_sheetsThreadCommentModel,this._sheetPermissionCheckController=_sheetPermissionCheckController,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(rxjs.debounceTime(100)).subscribe(cell=>{const currentPopup=this._sheetsThreadCommentPopupService.activePopup;if(cell&&(currentPopup&¤tPopup.temp||!currentPopup)){const{location}=cell,{unitId,subUnitId,row,col}=location,commentId=this._sheetsThreadCommentModel.getByLocation(unitId,subUnitId,row,col);if(commentId){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[sheets.WorkbookCommentPermission],worksheetTypes:[sheets.WorksheetViewPermission],rangeTypes:[sheets.RangeProtectionPermissionViewPoint]},[{startRow:row,startColumn:col,endRow:row,endColumn:col}]))return;const comment=this._sheetsThreadCommentModel.getComment(unitId,subUnitId,commentId);comment&&!comment.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId,subUnitId,row,col,commentId,temp:!0})}else currentPopup&&this._sheetsThreadCommentPopupService.hidePopup()}}))}},__name(_d,"SheetsThreadCommentHoverController"),_d);SheetsThreadCommentHoverController=__decorateClass$4([__decorateParam$4(0,core.Inject(sheetsUi.HoverManagerService)),__decorateParam$4(1,core.Inject(exports2.SheetsThreadCommentPopupService)),__decorateParam$4(2,core.Inject(sheetsThreadComment.SheetsThreadCommentModel)),__decorateParam$4(3,core.Inject(sheets.SheetPermissionCheckController))],SheetsThreadCommentHoverController);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3");let SheetsThreadCommentPopupController=(_e=class extends core.Disposable{constructor(_commandService,_sheetsThreadCommentPopupService,_sheetsThreadCommentModel,_threadCommentPanelService,_univerInstanceService,_sheetPermissionCheckController,_markSelectionService,_sheetSelectionService,_editorBridgeService,_renderManagerService){super();__publicField(this,"_isSwitchToCommenting",!1);__publicField(this,"_selectionShapeInfo",null);this._commandService=_commandService,this._sheetsThreadCommentPopupService=_sheetsThreadCommentPopupService,this._sheetsThreadCommentModel=_sheetsThreadCommentModel,this._threadCommentPanelService=_threadCommentPanelService,this._univerInstanceService=_univerInstanceService,this._sheetPermissionCheckController=_sheetPermissionCheckController,this._markSelectionService=_markSelectionService,this._sheetSelectionService=_sheetSelectionService,this._editorBridgeService=_editorBridgeService,this._renderManagerService=_renderManagerService,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(selections,unitId,subUnitId){var _a2,_b2,_c2;const range=(_a2=selections[0])==null?void 0:_a2.range,render2=this._renderManagerService.getRenderById(unitId),skeleton=(_b2=render2==null?void 0:render2.with(sheetsUi.SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId))==null?void 0:_b2.skeleton;if(!skeleton||!range)return;const actualCell=skeleton.getCellWithCoordByIndex(range.startRow,range.startColumn);if((((_c2=range.rangeType)!=null?_c2:core.RANGE_TYPE.NORMAL)!==core.RANGE_TYPE.NORMAL||range.endColumn-range.startColumn>0||range.endRow-range.startRow>0)&&!((actualCell.isMerged||actualCell.isMergedMainCell)&&core.Rectangle.equals(actualCell.mergeInfo,range))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(threadCommentUi.SetActiveCommentOperation.id);return}const row=actualCell.actualRow,col=actualCell.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(unitId,subUnitId,row,col)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(threadCommentUi.SetActiveCommentOperation.id);return}const commentId=this._sheetsThreadCommentModel.getByLocation(unitId,subUnitId,row,col);commentId&&this._commandService.executeCommand(threadCommentUi.SetActiveCommentOperation.id,{unitId,subUnitId,commentId})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(selections=>{if(this._isSwitchToCommenting)return;const current=this._sheetSelectionService.currentSelectionParam;current&&this._handleSelectionChange(selections,current.unitId,current.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(visible=>{visible.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(commandInfo=>{if(commandInfo.id===threadComment.DeleteCommentMutation.id){const params=commandInfo.params,active=this._sheetsThreadCommentPopupService.activePopup;if(!active)return;const{unitId,subUnitId,commentId}=active;params.unitId===unitId&¶ms.subUnitId===subUnitId&¶ms.commentId===commentId&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async commentInfo=>{var _a2;if(commentInfo){const{unitId,subUnitId,commentId,trigger}=commentInfo,comment=this._sheetsThreadCommentModel.getComment(unitId,subUnitId,commentId);if(!comment||comment.resolved)return;const currentUnit=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(!currentUnit||currentUnit.getUnitId()!==unitId)return;this._isSwitchToCommenting=!0,((_a2=currentUnit.getActiveSheet())==null?void 0:_a2.getSheetId())!==subUnitId&&await this._commandService.executeCommand(sheets.SetWorksheetActiveOperation.id,{unitId,subUnitId}),this._isSwitchToCommenting=!1;const location=engineFormula.singleReferenceToGrid(comment.ref),{row,column:col}=location;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[sheets.WorkbookCommentPermission],worksheetTypes:[sheets.WorksheetViewPermission],rangeTypes:[sheets.RangeProtectionPermissionViewPoint]},[{startRow:row,startColumn:col,endRow:row,endColumn:col}]))return;const GAP=1;if(await this._commandService.executeCommand(sheetsUi.ScrollToRangeOperation.id,{range:{startRow:Math.max(location.row-GAP,0),endRow:location.row+GAP,startColumn:Math.max(location.column-GAP,0),endColumn:location.column+GAP}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId,subUnitId,row:location.row,col:location.column,commentId:comment.id,trigger})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(rxjs.debounceTime(100)).subscribe(activeComment=>{var _a2,_b2;if(!activeComment){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId,subUnitId,commentId}=activeComment;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const comment=this._sheetsThreadCommentModel.getComment(unitId,subUnitId,commentId);if(!comment)return;const location=engineFormula.singleReferenceToGrid(comment.ref),{row,column}=location;if(Number.isNaN(row)||Number.isNaN(column))return null;const worksheet=(_a2=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET))==null?void 0:_a2.getSheetBySheetId(subUnitId),mergeInfo=(_b2=worksheet==null?void 0:worksheet.getMergedCell(row,column))!=null?_b2:{startColumn:column,endColumn:column,startRow:row,endRow:row},shapeId=this._markSelectionService.addShape({range:mergeInfo,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);shapeId&&(this._selectionShapeInfo={...activeComment,shapeId})}))}},__name(_e,"SheetsThreadCommentPopupController"),_e);SheetsThreadCommentPopupController=__decorateClass$3([__decorateParam$3(0,core.ICommandService),__decorateParam$3(1,core.Inject(exports2.SheetsThreadCommentPopupService)),__decorateParam$3(2,core.Inject(sheetsThreadComment.SheetsThreadCommentModel)),__decorateParam$3(3,core.Inject(threadCommentUi.ThreadCommentPanelService)),__decorateParam$3(4,core.IUniverInstanceService),__decorateParam$3(5,core.Inject(sheets.SheetPermissionCheckController)),__decorateParam$3(6,sheetsUi.IMarkSelectionService),__decorateParam$3(7,core.Inject(sheets.SheetsSelectionsService)),__decorateParam$3(8,sheetsUi.IEditorBridgeService),__decorateParam$3(9,engineRender.IRenderManagerService)],SheetsThreadCommentPopupController);var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");let ThreadCommentRemoveSheetsController=(_f=class extends core.Disposable{constructor(_sheetInterceptorService,_univerInstanceService,_threadCommentModel,_threadCommentDataSourceService){super(),this._sheetInterceptorService=_sheetInterceptorService,this._univerInstanceService=_univerInstanceService,this._threadCommentModel=_threadCommentModel,this._threadCommentDataSourceService=_threadCommentDataSourceService,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:__name(commandInfo=>{var _a2;if(commandInfo.id===sheets.RemoveSheetCommand.id){const params=commandInfo.params,workbook=params.unitId?this._univerInstanceService.getUnit(params.unitId):this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(!workbook)return{redos:[],undos:[]};const unitId=workbook.getUnitId(),subUnitId=params.subUnitId||((_a2=workbook.getActiveSheet())==null?void 0:_a2.getSheetId());if(!subUnitId)return{redos:[],undos:[]};const commentMap=this._threadCommentModel.ensureMap(unitId,subUnitId),comments=Array.from(commentMap.values()).filter(comment=>!comment.parentId),ids=comments.map(comment=>comment.id),shouldSync=this._threadCommentDataSourceService.syncUpdateMutationToColla,redos=ids.map(id=>({id:threadComment.DeleteCommentMutation.id,params:{unitId,subUnitId,commentId:id}})),undos=comments.map(({children,...comment})=>({id:threadComment.AddCommentMutation.id,params:{unitId,subUnitId,comment:{...comment,children:shouldSync?children:void 0},sync:!shouldSync}}));return{redos,undos}}return{redos:[],undos:[]}},"getMutations")}))}},__name(_f,"ThreadCommentRemoveSheetsController"),_f);ThreadCommentRemoveSheetsController=__decorateClass$2([__decorateParam$2(0,core.Inject(sheets.SheetInterceptorService)),__decorateParam$2(1,core.IUniverInstanceService),__decorateParam$2(2,core.Inject(threadComment.ThreadCommentModel)),__decorateParam$2(3,threadComment.IThreadCommentDataSourceService)],ThreadCommentRemoveSheetsController);var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=react.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=react.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return react.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a2){var key=_a2[0],value=_a2[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a2,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a2=node.children)===null||_a2===void 0)&&_a2.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid"),IconBase.displayName="UniverIcon";var element={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"}}]},CommentSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"comment-single",ref,icon:element}))});CommentSingle.displayName="CommentSingle";const SheetsThreadCommentCell=__name(()=>{const univerInstanceService=core.useDependency(core.IUniverInstanceService),sheetsThreadCommentPopupService=core.useDependency(exports2.SheetsThreadCommentPopupService),activePopup=ui.useObservable(sheetsThreadCommentPopupService.activePopup$),sheetThreadCommentModel=core.useDependency(sheetsThreadComment.SheetsThreadCommentModel);if(ui.useObservable(sheetThreadCommentModel.commentUpdate$),!activePopup)return null;const{row,col,unitId,subUnitId,trigger}=activePopup,rootId=sheetThreadCommentModel.getByLocation(unitId,subUnitId,row,col),ref=`${core.Tools.chatAtABC(col)}${row+1}`,onClose=__name(()=>{sheetsThreadCommentPopupService.hidePopup()},"onClose"),getSubUnitName=__name(id=>{var _a2,_b2,_c2;return(_c2=(_b2=(_a2=univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET))==null?void 0:_a2.getSheetBySheetId(id))==null?void 0:_b2.getName())!=null?_c2:""},"getSubUnitName");return jsxRuntime.jsx(threadCommentUi.ThreadCommentTree,{onClick:__name(()=>{sheetsThreadCommentPopupService.persistPopup()},"onClick"),prefix:"cell",id:rootId,unitId,subUnitId,type:core.UniverInstanceType.UNIVER_SHEET,refStr:ref,onClose,getSubUnitName,autoFocus:trigger==="context-menu"})},"SheetsThreadCommentCell"),SheetsThreadCommentPanel=__name(()=>{var _a2;const markSelectionService=core.useDependency(sheetsUi.IMarkSelectionService),univerInstanceService=core.useDependency(core.IUniverInstanceService),sheetsThreadCommentPopupService=core.useDependency(exports2.SheetsThreadCommentPopupService),workbook=univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET),unitId=workbook.getUnitId(),commandService=core.useDependency(core.ICommandService),subUnitId$=react.useMemo(()=>workbook.activeSheet$.pipe(rxjs.map(i=>i==null?void 0:i.getSheetId())),[workbook.activeSheet$]),subUnitId=ui.useObservable(subUnitId$,(_a2=workbook.getActiveSheet())==null?void 0:_a2.getSheetId()),hoverShapeId=react.useRef(null),panelService=core.useDependency(threadCommentUi.ThreadCommentPanelService),activeCommentId=ui.useObservable(panelService.activeCommentId$),panelVisible=ui.useObservable(panelService.panelVisible$,panelService.panelVisible),sortComments=react.useCallback(comments=>{const worksheets=workbook.getSheets(),sheetIndex={};worksheets.forEach((sheet,i)=>{sheetIndex[sheet.getSheetId()]=i});const sort=__name(comments2=>comments2.map(comment=>{var _a3;const ref=engineFormula.singleReferenceToGrid(comment.ref),p=[(_a3=sheetIndex[comment.subUnitId])!=null?_a3:0,ref.row,ref.column];return{...comment,p}}).sort((pre,aft)=>pre.p[0]===aft.p[0]?pre.p[1]===aft.p[1]?pre.p[2]-aft.p[2]:pre.p[1]-aft.p[1]:pre.p[0]-aft.p[0]),"sort");return[...sort(comments.filter(comment=>!comment.resolved)),...sort(comments.filter(comment=>comment.resolved))]},[workbook]),showShape=react.useCallback(comment=>{var _a3;if(comment.unitId===unitId&&comment.subUnitId===subUnitId&&!comment.resolved){const{row,column}=engineFormula.singleReferenceToGrid(comment.ref),worksheet=workbook.getSheetBySheetId(comment.subUnitId),mergeInfo=(_a3=worksheet==null?void 0:worksheet.getMergedCell(row,column))!=null?_a3:{startColumn:column,endColumn:column,startRow:row,endRow:row};if(!Number.isNaN(row)&&!Number.isNaN(column))return markSelectionService.addShape({range:mergeInfo,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[markSelectionService,subUnitId,unitId]),getSubUnitName=__name(id=>{var _a3,_b2;return(_b2=(_a3=workbook.getSheetBySheetId(id))==null?void 0:_a3.getName())!=null?_b2:""},"getSubUnitName"),handleAdd=__name(()=>{commandService.executeCommand(ShowAddSheetCommentModalOperation.id)},"handleAdd"),handleHover=__name(comment=>{activeCommentId&&activeCommentId.unitId===comment.unitId&&activeCommentId.subUnitId===comment.subUnitId&&activeCommentId.commentId===comment.id||(hoverShapeId.current&&(markSelectionService.removeShape(hoverShapeId.current),hoverShapeId.current=null),hoverShapeId.current=showShape(comment))},"handleHover"),handleLeave=__name(()=>{hoverShapeId.current&&(markSelectionService.removeShape(hoverShapeId.current),hoverShapeId.current=null)},"handleLeave"),handleResolve=__name((id,resolved)=>{resolved&&sheetsThreadCommentPopupService.hidePopup()},"handleResolve");return react.useEffect(()=>{!panelVisible&&hoverShapeId.current&&markSelectionService.removeShape(hoverShapeId.current)},[markSelectionService,panelVisible]),jsxRuntime.jsx(threadCommentUi.ThreadCommentPanel,{unitId,subUnitId$,type:core.UniverInstanceType.UNIVER_SHEET,onAdd:handleAdd,getSubUnitName,onResolve:handleResolve,sortComments,onItemEnter:handleHover,onItemLeave:handleLeave,onDeleteComment:__name(()=>(handleLeave(),!0),"onDeleteComment")})},"SheetsThreadCommentPanel"),threadCommentMenuFactory=__name(accessor=>({id:ShowAddSheetCommentModalOperation.id,type:ui.MenuItemType.BUTTON,icon:COMMENT_SINGLE_ICON,title:"sheetThreadComment.menu.addComment",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookCommentPermission],worksheetTypes:[sheets.WorksheetViewPermission],rangeTypes:[sheets.RangeProtectionPermissionViewPoint]})}),"threadCommentMenuFactory"),threadPanelMenuFactory=__name(accessor=>({id:threadCommentUi.ToggleSheetCommentPanelOperation.id,type:ui.MenuItemType.BUTTON,icon:COMMENT_SINGLE_ICON,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookCommentPermission],worksheetTypes:[sheets.WorksheetViewPermission],rangeTypes:[sheets.RangeProtectionPermissionViewPoint]}),hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET)}),"threadPanelMenuFactory"),AddCommentShortcut={id:ShowAddSheetCommentModalOperation.id,binding:ui.KeyCode.M|ui.MetaKeys.CTRL_COMMAND|ui.MetaKeys.ALT,preconditions:sheetsUi.whenSheetEditorFocused},menuSchema={[ui.RibbonStartGroup.OTHERS]:{[threadCommentUi.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:threadPanelMenuFactory}},[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.OTHERS]:{[ShowAddSheetCommentModalOperation.id]:{order:0,menuItemFactory:threadCommentMenuFactory}}}};var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");let SheetsThreadCommentController=(_g=class extends core.Disposable{constructor(_menuManagerService,_componentManager,_shortcutService){super(),this._menuManagerService=_menuManagerService,this._componentManager=_componentManager,this._shortcutService=_shortcutService,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(AddCommentShortcut)}_initMenu(){this._menuManagerService.mergeMenu(menuSchema)}_initComponent(){[[SHEETS_THREAD_COMMENT_MODAL,SheetsThreadCommentCell],[threadCommentUi.THREAD_COMMENT_PANEL,SheetsThreadCommentPanel],[COMMENT_SINGLE_ICON,CommentSingle]].forEach(([key,comp])=>{this._componentManager.register(key,comp)})}},__name(_g,"SheetsThreadCommentController"),_g);SheetsThreadCommentController=__decorateClass$1([__decorateParam$1(0,ui.IMenuManagerService),__decorateParam$1(1,core.Inject(ui.ComponentManager)),__decorateParam$1(2,ui.IShortcutService)],SheetsThreadCommentController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField");exports2.UniverSheetsThreadCommentUIPlugin=(_h=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_commandService,_configService){super(),this._config=_config,this._injector=_injector,this._commandService=_commandService,this._configService=_configService;const{menu,...rest}=core.merge({},defaultPluginConfig,this._config);menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(SHEETS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY,rest)}onStarting(){[[SheetsThreadCommentController],[SheetsThreadCommentRenderController],[SheetsThreadCommentCopyPasteController],[SheetsThreadCommentHoverController],[ThreadCommentRemoveSheetsController],[SheetsThreadCommentPopupController],[exports2.SheetsThreadCommentPopupService]].forEach(dep=>{this._injector.add(dep)}),[ShowAddSheetCommentModalOperation].forEach(command=>{this._commandService.registerCommand(command)}),this._injector.get(SheetsThreadCommentController)}onReady(){this._injector.get(SheetsThreadCommentRenderController),this._injector.get(ThreadCommentRemoveSheetsController)}onRendered(){this._injector.get(SheetsThreadCommentCopyPasteController),this._injector.get(SheetsThreadCommentHoverController),this._injector.get(SheetsThreadCommentPopupController)}},__name(_h,"UniverSheetsThreadCommentUIPlugin"),_h),__publicField2(exports2.UniverSheetsThreadCommentUIPlugin,"pluginName",SHEETS_THREAD_COMMENT),__publicField2(exports2.UniverSheetsThreadCommentUIPlugin,"type",core.UniverInstanceType.UNIVER_SHEET),exports2.UniverSheetsThreadCommentUIPlugin=__decorateClass([core.DependentOn(threadCommentUi.UniverThreadCommentUIPlugin,sheetsThreadComment.UniverSheetsThreadCommentPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.Inject(core.ICommandService)),__decorateParam(3,core.IConfigService)],exports2.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(exports2,"UniverThreadCommentUIPlugin",{enumerable:!0,get:__name(()=>threadCommentUi.UniverThreadCommentUIPlugin,"get")}),Object.defineProperty(exports2,"AddCommentCommand",{enumerable:!0,get:__name(()=>threadComment.AddCommentCommand,"get")}),Object.defineProperty(exports2,"DeleteCommentCommand",{enumerable:!0,get:__name(()=>threadComment.DeleteCommentCommand,"get")}),Object.defineProperty(exports2,"DeleteCommentTreeCommand",{enumerable:!0,get:__name(()=>threadComment.DeleteCommentTreeCommand,"get")}),Object.defineProperty(exports2,"IThreadCommentDataSourceService",{enumerable:!0,get:__name(()=>threadComment.IThreadCommentDataSourceService,"get")}),Object.defineProperty(exports2,"ResolveCommentCommand",{enumerable:!0,get:__name(()=>threadComment.ResolveCommentCommand,"get")}),Object.defineProperty(exports2,"UpdateCommentCommand",{enumerable:!0,get:__name(()=>threadComment.UpdateCommentCommand,"get")}),exports2.SHEETS_THREAD_COMMENT=SHEETS_THREAD_COMMENT,exports2.ShowAddSheetCommentModalOperation=ShowAddSheetCommentModalOperation,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(c,s){typeof exports=="object"&&typeof module<"u"?s(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/jsx-runtime"),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/jsx-runtime","react"],s):(c=typeof globalThis<"u"?globalThis:c||self,s(c.UniverSheetsThreadCommentUi={},c.UniverCore,c.UniverSheets,c.UniverSheetsThreadComment,c.UniverThreadCommentUi,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverEngineRender,c.UniverEngineFormula,c.UniverThreadComment,c.React,c.React))})(this,function(c,s,p,$,g,b,_,H,ne,V,f,re,U){"use strict";var Je=Object.defineProperty;var Qe=(c,s,p)=>s in c?Je(c,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[s]=p;var N=(c,s,p)=>Qe(c,typeof s!="symbol"?s+"":s,p);const ie="univer.sheet.thread-comment-modal",Y="comment-single",J="SHEET_THREAD_COMMENT";var le=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,ve=(i,t,n,e)=>{for(var r=e>1?void 0:e?pe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&le(t,n,r),r},oe=(i,t)=>(n,e)=>t(n,e,i);c.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new H.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 l;const{row:r,col:o,unitId:a,subUnitId:u}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&u===((l=this.activePopup)==null?void 0:l.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 d=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!d)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new s.DisposableCollection;m.add(d),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}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))}},c.SheetsThreadCommentPopupService=ve([oe(0,s.Inject(b.SheetCanvasPopManagerService)),oe(1,_.IZenZoneService)],c.SheetsThreadCommentPopupService);const k={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var I;const t=i.get(p.SheetsSelectionsService),n=i.get(s.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),r=i.get(g.ThreadCommentPanelService),o=(I=t.getCurrentLastSelection())==null?void 0:I.primary,a=i.get($.SheetsThreadCommentModel);if(!o)return!1;const u=p.getSheetCommandTarget(n);if(!u)return!1;const{workbook:d,worksheet:m,unitId:l,subUnitId:h}=u,v={workbook:d,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(v);const C=a.getByLocation(l,h,o.startRow,o.startColumn);return C&&r.setActiveComment({unitId:l,subUnitId:h,commentId:C,trigger:"context-menu"}),!0}},Se="sheets-thread-comment.config",se={};var Ce=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,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ce(t,n,r),r},L=(i,t)=>(n,e)=>t(n,e,i);let W=class extends s.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(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(i,t,n)=>{const{row:e,col:r,unitId:o,subUnitId:a}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,a,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(s.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(H.debounceTime(16)).subscribe(()=>{i()}))}};W=fe([L(0,s.Inject(p.SheetInterceptorService)),L(1,s.Inject($.SheetsThreadCommentModel)),L(2,s.IUniverInstanceService),L(3,ne.IRenderManagerService)],W);var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,n,e)=>{for(var r=e>1?void 0:e?ge(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ie(t,n,r),r},Q=(i,t)=>(n,e)=>t(n,e,i);const Te=(i,t,n)=>{const e=V.singleReferenceToGrid(i),r=n.row-t.row,o=n.column-t.column,a={startColumn:e.column+o,startRow:e.row+r,endColumn:e.column+o,endRow:e.row+r};return V.serializeRange(a)};let x=class extends s.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:J,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:a,range:u}=n,d={row:u.rows[0],column:u.cols[0]};if(r.copyType===b.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,v={row:m.startRow,column:m.startColumn};if(!(o===l&&a===h)){const C=[];s.Range.foreach(m,(w,S)=>{const E=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,S);this._threadCommentDataSourceService.syncUpdateMutationToColla?E.forEach(P=>{C.push(P)}):E.forEach(({children:P,...j})=>{j.parentId||C.push(j)})});const I=[],y=[],A=[],B=[],te=w=>{I.unshift({id:f.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),A.push({id:f.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:Te(w.ref,v,d),unitId:o,subUnitId:a},sync:!0}}),y.push({id:f.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),B.unshift({id:f.DeleteCommentMutation.id,params:{unitId:o,subUnitId:a,commentId:w.id}})};return C.forEach(w=>{te(w)}),{redos:[...I,...A],undos:[...B,...y]}}}return{redos:[],undos:[]}}}))}};x=Pe([Q(0,s.Inject(b.ISheetClipboardService)),Q(1,s.Inject($.SheetsThreadCommentModel)),Q(2,f.IThreadCommentDataSourceService)],x);var be=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,ye=(i,t,n,e)=>{for(var r=e>1?void 0:e?Me(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&be(t,n,r),r},F=(i,t)=>(n,e)=>t(n,e,i);let q=class extends s.Disposable{constructor(i,t,n,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(H.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:a}=n,u=this._sheetsThreadCommentModel.getByLocation(e,r,o,a);if(u){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:a,endRow:o,endColumn:a}]))return;const m=this._sheetsThreadCommentModel.getComment(e,r,u);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:a,commentId:u,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=ye([F(0,s.Inject(b.HoverManagerService)),F(1,s.Inject(c.SheetsThreadCommentPopupService)),F(2,s.Inject($.SheetsThreadCommentModel)),F(3,s.Inject(p.SheetPermissionCheckController))],q);var we=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,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&we(t,n,r),r},R=(i,t)=>(n,e)=>t(n,e,i);let G=class extends s.Disposable{constructor(t,n,e,r,o,a,u,d,m,l){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._sheetPermissionCheckController=a,this._markSelectionService=u,this._sheetSelectionService=d,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var v,C,I;const r=(v=t[0])==null?void 0:v.range,o=this._renderManagerService.getRenderById(n),a=(C=o==null?void 0:o.with(b.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:C.skeleton;if(!a||!r)return;const u=a.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((I=r.rangeType)!=null?I:s.RANGE_TYPE.NORMAL)!==s.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((u.isMerged||u.isMergedMainCell)&&s.Rectangle.equals(u.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const m=u.actualRow,l=u.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(n,e,m,l);h&&this._commandService.executeCommand(g.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===f.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId:a}=e;n.unitId===r&&n.subUnitId===o&&n.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:o,trigger:a}=t,u=this._sheetsThreadCommentModel.getComment(e,r,o);if(!u||u.resolved)return;const d=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!d||d.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=d.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const h=V.singleReferenceToGrid(u.ref),{row:v,column:C}=h;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:v,startColumn:C,endRow:v,endColumn:C}]))return;const y=1;if(await this._commandService.executeCommand(b.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-y,0),endRow:h.row+y,startColumn:Math.max(h.column-y,0),endColumn:h.column+y}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:h.row,col:h.column,commentId:u.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(H.debounceTime(100)).subscribe(t=>{var v,C;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 a=V.singleReferenceToGrid(o.ref),{row:u,column:d}=a;if(Number.isNaN(u)||Number.isNaN(d))return null;const m=(v=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getSheetBySheetId(e),l=(C=m==null?void 0:m.getMergedCell(u,d))!=null?C:{startColumn:d,endColumn:d,startRow:u,endRow:u},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};G=Oe([R(0,s.ICommandService),R(1,s.Inject(c.SheetsThreadCommentPopupService)),R(2,s.Inject($.SheetsThreadCommentModel)),R(3,s.Inject(g.ThreadCommentPanelService)),R(4,s.IUniverInstanceService),R(5,s.Inject(p.SheetPermissionCheckController)),R(6,b.IMarkSelectionService),R(7,s.Inject(p.SheetsSelectionsService)),R(8,b.IEditorBridgeService),R(9,ne.IRenderManagerService)],G);var Ue=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,je=(i,t,n,e)=>{for(var r=e>1?void 0:e?Re(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ue(t,n,r),r},Z=(i,t)=>(n,e)=>t(n,e,i);let z=class extends s.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===p.RemoveSheetCommand.id){const n=i.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(s.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 a=this._threadCommentModel.ensureMap(r,o),u=Array.from(a.values()).filter(v=>!v.parentId),d=u.map(v=>v.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=d.map(v=>({id:f.DeleteCommentMutation.id,params:{unitId:r,subUnitId:o,commentId:v}})),h=u.map(({children:v,...C})=>({id:f.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{...C,children:m?v:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};z=je([Z(0,s.Inject(p.SheetInterceptorService)),Z(1,s.IUniverInstanceService),Z(2,s.Inject(f.ThreadCommentModel)),Z(3,f.IThreadCommentDataSourceService)],z);var M=function(){return M=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},M.apply(this,arguments)},De=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=U.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,a=De(i,["icon","id","className","extend"]),u="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),d=U.useRef("_".concat(Ae()));return ce(n,"".concat(e),{defIds:n.defIds,idSuffix:d.current},M({ref:t,className:u},a),o)});function ce(i,t,n,e,r){return U.createElement(i.tag,M(M({key:t},Ne(i,n,r)),e),($e(i,n).children||[]).map(function(o,a){return ce(o,"".concat(t,"-").concat(i.tag,"-").concat(a),n,void 0,r)}))}function Ne(i,t,n){var e=M({},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 a=o[0],u=o[1];typeof u=="string"&&(e[a]=u.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function $e(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)?M(M({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?M(M({},r),{attrs:M(M({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function Ae(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var Ve={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=U.forwardRef(function(i,t){return U.createElement(ae,Object.assign({},i,{id:"comment-single",ref:t,icon:Ve}))});ue.displayName="CommentSingle";const ke=()=>{const i=s.useDependency(s.IUniverInstanceService),t=s.useDependency(c.SheetsThreadCommentPopupService),n=_.useObservable(t.activePopup$),e=s.useDependency($.SheetsThreadCommentModel);if(_.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:a,subUnitId:u,trigger:d}=n,m=e.getByLocation(a,u,r,o),l=`${s.Tools.chatAtABC(o)}${r+1}`,h=()=>{t.hidePopup()},v=C=>{var I,y,A;return(A=(y=(I=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getSheetBySheetId(C))==null?void 0:y.getName())!=null?A:""};return re.jsx(g.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:a,subUnitId:u,type:s.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:v,autoFocus:d==="context-menu"})},He=()=>{var w;const i=s.useDependency(b.IMarkSelectionService),t=s.useDependency(s.IUniverInstanceService),n=s.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=s.useDependency(s.ICommandService),a=U.useMemo(()=>e.activeSheet$.pipe(H.map(S=>S==null?void 0:S.getSheetId())),[e.activeSheet$]),u=_.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),d=U.useRef(null),m=s.useDependency(g.ThreadCommentPanelService),l=_.useObservable(m.activeCommentId$),h=_.useObservable(m.panelVisible$,m.panelVisible),v=U.useCallback(S=>{const E=e.getSheets(),P={};E.forEach((O,T)=>{P[O.getSheetId()]=T});const j=O=>O.map(T=>{var he;const D=V.singleReferenceToGrid(T.ref),Ye=[(he=P[T.subUnitId])!=null?he:0,D.row,D.column];return{...T,p:Ye}}).sort((T,D)=>T.p[0]===D.p[0]?T.p[1]===D.p[1]?T.p[2]-D.p[2]:T.p[1]-D.p[1]:T.p[0]-D.p[0]);return[...j(S.filter(O=>!O.resolved)),...j(S.filter(O=>O.resolved))]},[e]),C=U.useCallback(S=>{var E;if(S.unitId===r&&S.subUnitId===u&&!S.resolved){const{row:P,column:j}=V.singleReferenceToGrid(S.ref),O=e.getSheetBySheetId(S.subUnitId),T=(E=O==null?void 0:O.getMergedCell(P,j))!=null?E:{startColumn:j,endColumn:j,startRow:P,endRow:P};if(!Number.isNaN(P)&&!Number.isNaN(j))return i.addShape({range:T,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[i,u,r]),I=S=>{var E,P;return(P=(E=e.getSheetBySheetId(S))==null?void 0:E.getName())!=null?P:""},y=()=>{o.executeCommand(k.id)},A=S=>{l&&l.unitId===S.unitId&&l.subUnitId===S.subUnitId&&l.commentId===S.id||(d.current&&(i.removeShape(d.current),d.current=null),d.current=C(S))},B=()=>{d.current&&(i.removeShape(d.current),d.current=null)},te=(S,E)=>{E&&n.hidePopup()};return U.useEffect(()=>{!h&&d.current&&i.removeShape(d.current)},[i,h]),re.jsx(g.ThreadCommentPanel,{unitId:r,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:y,getSubUnitName:I,onResolve:te,sortComments:v,onItemEnter:A,onItemLeave:B,onDeleteComment:()=>(B(),!0)})},Be=i=>({id:k.id,type:_.MenuItemType.BUTTON,icon:Y,title:"sheetThreadComment.menu.addComment",hidden$:_.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),Le=i=>({id:g.ToggleSheetCommentPanelOperation.id,type:_.MenuItemType.BUTTON,icon:Y,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:_.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET)}),We={id:k.id,binding:_.KeyCode.M|_.MetaKeys.CTRL_COMMAND|_.MetaKeys.ALT,preconditions:b.whenSheetEditorFocused},xe={[_.RibbonStartGroup.OTHERS]:{[g.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:Le}},[_.ContextMenuPosition.MAIN_AREA]:{[_.ContextMenuGroup.OTHERS]:{[k.id]:{order:0,menuItemFactory:Be}}}};var Fe=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Ge=(i,t,n,e)=>{for(var r=e>1?void 0:e?qe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Fe(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);let K=class extends s.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(We)}_initMenu(){this._menuManagerService.mergeMenu(xe)}_initComponent(){[[ie,ke],[g.THREAD_COMMENT_PANEL,He],[Y,ue]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};K=Ge([X(0,_.IMenuManagerService),X(1,s.Inject(_.ComponentManager)),X(2,_.IShortcutService)],K);var de=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,ze=(i,t,n)=>t in i?de(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,Ke=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ze(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&de(t,n,r),r},ee=(i,t)=>(n,e)=>t(n,e,i),me=(i,t,n)=>ze(i,typeof t!="symbol"?t+"":t,n);c.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=se,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...a}=s.merge({},se,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Se,a)}onStarting(){[[K],[W],[x],[q],[z],[G],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[k].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(K)}onReady(){this._injector.get(W),this._injector.get(z)}onRendered(){this._injector.get(x),this._injector.get(q),this._injector.get(G)}},me(c.UniverSheetsThreadCommentUIPlugin,"pluginName",J),me(c.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=Ke([s.DependentOn(g.UniverThreadCommentUIPlugin,$.UniverSheetsThreadCommentPlugin),ee(1,s.Inject(s.Injector)),ee(2,s.Inject(s.ICommandService)),ee(3,s.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>g.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>f.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>f.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>f.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>f.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>f.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>f.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=J,c.ShowAddSheetCommentModalOperation=k,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
package/lib/umd/locale/en-US.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsThreadCommentUiEnUS=n())})(this,function(){"use strict";return{sheetThreadComment:{menu:{addComment:"Add Comment",commentManagement:"Comment Management"}}}});
|
package/lib/umd/locale/fa-IR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsThreadCommentUiFaIR=n())})(this,function(){"use strict";return{sheetThreadComment:{menu:{addComment:"افزودن نظر",commentManagement:"مدیریت نظر"}}}});
|
package/lib/umd/locale/fr-FR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsThreadCommentUiFrFR=n())})(this,function(){"use strict";return{sheetThreadComment:{menu:{addComment:"Ajouter un commentaire",commentManagement:"Gestion des commentaires"}}}});
|
package/lib/umd/locale/ru-RU.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsThreadCommentUiRuRU=n())})(this,function(){"use strict";return{sheetThreadComment:{menu:{addComment:"Add Comment",commentManagement:"Comment Management"}}}});
|
package/lib/umd/locale/vi-VN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsThreadCommentUiViVN=n())})(this,function(){"use strict";return{sheetThreadComment:{menu:{addComment:"Thêm bình luận",commentManagement:"Quản lý bình luận"}}}});
|
package/lib/umd/locale/zh-CN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsThreadCommentUiZhCN=n())})(this,function(){"use strict";return{sheetThreadComment:{menu:{addComment:"添加评论",commentManagement:"评论管理"}}}});
|
package/lib/umd/locale/zh-TW.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsThreadCommentUiZhTW=n())})(this,function(){"use strict";return{sheetThreadComment:{menu:{addComment:"新增評論",commentManagement:"評論管理"}}}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-thread-comment-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-alpha.0",
|
|
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.14",
|
|
56
56
|
"clsx": "^2.1.1",
|
|
57
|
-
"@univerjs/core": "0.
|
|
58
|
-
"@univerjs/
|
|
59
|
-
"@univerjs/engine-
|
|
60
|
-
"@univerjs/
|
|
61
|
-
"@univerjs/
|
|
62
|
-
"@univerjs/sheets": "0.
|
|
63
|
-
"@univerjs/
|
|
64
|
-
"@univerjs/thread-comment": "0.
|
|
65
|
-
"@univerjs/ui": "0.
|
|
57
|
+
"@univerjs/core": "0.6.0-alpha.0",
|
|
58
|
+
"@univerjs/engine-formula": "0.6.0-alpha.0",
|
|
59
|
+
"@univerjs/engine-render": "0.6.0-alpha.0",
|
|
60
|
+
"@univerjs/sheets-thread-comment": "0.6.0-alpha.0",
|
|
61
|
+
"@univerjs/sheets": "0.6.0-alpha.0",
|
|
62
|
+
"@univerjs/sheets-ui": "0.6.0-alpha.0",
|
|
63
|
+
"@univerjs/thread-comment": "0.6.0-alpha.0",
|
|
64
|
+
"@univerjs/thread-comment-ui": "0.6.0-alpha.0",
|
|
65
|
+
"@univerjs/ui": "0.6.0-alpha.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"postcss": "^8.4.49",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"typescript": "^5.7.3",
|
|
73
73
|
"vite": "^6.0.7",
|
|
74
74
|
"vitest": "^2.1.8",
|
|
75
|
-
"@univerjs-infra/shared": "0.
|
|
75
|
+
"@univerjs-infra/shared": "0.6.0-alpha.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"test": "vitest run",
|