@univerjs/sheets-thread-comment-ui 0.6.0 → 0.6.1
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 +1 -1
- package/lib/es/index.js +182 -179
- package/lib/umd/index.js +1 -1
- package/package.json +15 -15
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ue=Object.defineProperty;var le=(n,t,r)=>t in n?ue(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r;var D=(n,t,r)=>le(n,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),C=require("@univerjs/sheets"),j=require("@univerjs/sheets-thread-comment"),P=require("@univerjs/thread-comment-ui"),w=require("@univerjs/sheets-ui"),l=require("@univerjs/ui"),V=require("rxjs"),oe=require("@univerjs/engine-render"),$=require("@univerjs/engine-formula"),_=require("@univerjs/thread-comment"),ie=require("react/jsx-runtime"),O=require("react"),se="univer.sheet.thread-comment-modal",X="comment-single",ee="SHEET_THREAD_COMMENT";var pe=Object.getOwnPropertyDescriptor,ve=(n,t,r,e)=>{for(var o=e>1?void 0:e?pe(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},ne=(n,t)=>(r,e)=>t(r,e,n);exports.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(r,e){super();D(this,"_lastPopup",null);D(this,"_activePopup");D(this,"_activePopup$",new V.BehaviorSubject(null));D(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var u;const{row:o,col:i,unitId:s,subUnitId:c}=r;if(this._activePopup&&o===this._activePopup.row&&i===this._activePopup.col&&s===this._activePopup.unitId&&c===((u=this.activePopup)==null?void 0:u.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const m=this._canvasPopupManagerService.attachPopupToCell(o,i,{componentKey:se,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 d=new a.DisposableCollection;d.add(m),d.add({dispose:()=>{e==null||e()}}),this._lastPopup=d}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=ve([ne(0,a.Inject(w.SheetCanvasPopManagerService)),ne(1,l.IZenZoneService)],exports.SheetsThreadCommentPopupService);const A={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(n){var g;const t=n.get(C.SheetsSelectionsService),r=n.get(a.IUniverInstanceService),e=n.get(exports.SheetsThreadCommentPopupService),o=n.get(P.ThreadCommentPanelService),i=(g=t.getCurrentLastSelection())==null?void 0:g.primary,s=n.get(j.SheetsThreadCommentModel);if(!i)return!1;const c=C.getSheetCommandTarget(r);if(!c)return!1;const{workbook:m,worksheet:d,unitId:u,subUnitId:h}=c,p={workbook:m,worksheet:d,unitId:u,subUnitId:h,row:i.startRow,col:i.startColumn};e.showPopup(p);const S=s.getByLocation(u,h,i.startRow,i.startColumn);return S&&o.setActiveComment({unitId:u,subUnitId:h,commentId:S,trigger:"context-menu"}),!0}},Ce="sheets-thread-comment.config",re={};var Se=Object.getOwnPropertyDescriptor,_e=(n,t,r,e)=>{for(var o=e>1?void 0:e?Se(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},H=(n,t)=>(r,e)=>t(r,e,n);let W=class extends a.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(C.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(n,t,r)=>{const{row:e,col:o,unitId:i,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(i,s,e,o)?r({...n,markers:{...n==null?void 0:n.markers,tr:{color:"#FFBD37",size:6}}}):r(n)},priority:100}))}_initSkeletonChange(){const n=()=>{var o;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(o=e==null?void 0:e.mainComponent)==null||o.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(V.debounceTime(16)).subscribe(()=>{n()}))}};W=_e([H(0,a.Inject(C.SheetInterceptorService)),H(1,a.Inject(j.SheetsThreadCommentModel)),H(2,a.IUniverInstanceService),H(3,oe.IRenderManagerService)],W);var ge=Object.getOwnPropertyDescriptor,fe=(n,t,r,e)=>{for(var o=e>1?void 0:e?ge(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},Y=(n,t)=>(r,e)=>t(r,e,n);const Ie=(n,t,r)=>{const e=$.singleReferenceToGrid(n),o=r.row-t.row,i=r.column-t.column,s={startColumn:e.column+i,startRow:e.row+o,endColumn:e.column+i,endRow:e.row+o};return $.serializeRange(s)};let F=class extends a.Disposable{constructor(t,r,e){super();D(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:ee,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,o)=>{const{unitId:i,subUnitId:s,range:c}=r,m={row:c.rows[0],column:c.cols[0]};if(o.copyType===w.COPY_TYPE.CUT&&this._copyInfo){const{range:d,unitId:u,subUnitId:h}=this._copyInfo,p={row:d.startRow,column:d.startColumn};if(!(i===u&&s===h)){const S=[];a.Range.foreach(d,(b,v)=>{const y=this._sheetsThreadCommentModel.getAllByLocation(u,h,b,v);this._threadCommentDataSourceService.syncUpdateMutationToColla?y.forEach(f=>{S.push(f)}):y.forEach(({children:f,...E})=>{E.parentId||S.push(E)})});const g=[],T=[],N=[],x=[],K=b=>{g.unshift({id:_.DeleteCommentMutation.id,params:{unitId:u,subUnitId:h,commentId:b.id}}),N.push({id:_.AddCommentMutation.id,params:{unitId:i,subUnitId:s,comment:{...b,ref:Ie(b.ref,p,m),unitId:i,subUnitId:s},sync:!0}}),T.push({id:_.AddCommentMutation.id,params:{unitId:u,subUnitId:h,comment:b,sync:!0}}),x.unshift({id:_.DeleteCommentMutation.id,params:{unitId:i,subUnitId:s,commentId:b.id}})};return S.forEach(b=>{K(b)}),{redos:[...g,...N],undos:[...x,...T]}}}return{redos:[],undos:[]}}}))}};F=fe([Y(0,a.Inject(w.ISheetClipboardService)),Y(1,a.Inject(j.SheetsThreadCommentModel)),Y(2,_.IThreadCommentDataSourceService)],F);var Pe=Object.getOwnPropertyDescriptor,Te=(n,t,r,e)=>{for(var o=e>1?void 0:e?Pe(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},B=(n,t)=>(r,e)=>t(r,e,n);let q=class extends a.Disposable{constructor(n,t,r,e){super(),this._hoverManagerService=n,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(V.debounceTime(100)).subscribe(n=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(n&&(t&&t.temp||!t)){const{location:r}=n,{unitId:e,subUnitId:o,row:i,col:s}=r,c=this._sheetsThreadCommentModel.getByLocation(e,o,i,s);if(c){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]},[{startRow:i,startColumn:s,endRow:i,endColumn:s}]))return;const d=this._sheetsThreadCommentModel.getComment(e,o,c);d&&!d.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:o,row:i,col:s,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=Te([B(0,a.Inject(w.HoverManagerService)),B(1,a.Inject(exports.SheetsThreadCommentPopupService)),B(2,a.Inject(j.SheetsThreadCommentModel)),B(3,a.Inject(C.SheetPermissionCheckController))],q);var be=Object.getOwnPropertyDescriptor,ye=(n,t,r,e)=>{for(var o=e>1?void 0:e?be(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},R=(n,t)=>(r,e)=>t(r,e,n);let G=class extends a.Disposable{constructor(t,r,e,o,i,s,c,m,d,u){super();D(this,"_isSwitchToCommenting",!1);D(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=o,this._univerInstanceService=i,this._sheetPermissionCheckController=s,this._markSelectionService=c,this._sheetSelectionService=m,this._editorBridgeService=d,this._renderManagerService=u,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var p,S,g;const o=(p=t[0])==null?void 0:p.range,i=this._renderManagerService.getRenderById(r),s=(S=i==null?void 0:i.with(w.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:S.skeleton;if(!s||!o)return;const c=s.getCellWithCoordByIndex(o.startRow,o.startColumn);if((((g=o.rangeType)!=null?g:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||o.endColumn-o.startColumn>0||o.endRow-o.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&a.Rectangle.equals(c.mergeInfo,o))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const d=c.actualRow,u=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,d,u)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,d,u);h&&this._commandService.executeCommand(P.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.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 r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:o,subUnitId:i,commentId:s}=e;r.unitId===o&&r.subUnitId===i&&r.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:o,commentId:i,trigger:s}=t,c=this._sheetsThreadCommentModel.getComment(e,o,i);if(!c||c.resolved)return;const m=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!m||m.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=m.getActiveSheet())==null?void 0:r.getSheetId())!==o&&await this._commandService.executeCommand(C.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:o}),this._isSwitchToCommenting=!1;const h=$.singleReferenceToGrid(c.ref),{row:p,column:S}=h;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:S,endRow:p,endColumn:S}]))return;const T=1;if(await this._commandService.executeCommand(w.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-T,0),endRow:h.row+T,startColumn:Math.max(h.column-T,0),endColumn:h.column+T}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:o,row:h.row,col:h.column,commentId:c.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(V.debounceTime(100)).subscribe(t=>{var p,S;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:o}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const i=this._sheetsThreadCommentModel.getComment(r,e,o);if(!i)return;const s=$.singleReferenceToGrid(i.ref),{row:c,column:m}=s;if(Number.isNaN(c)||Number.isNaN(m))return null;const d=(p=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getSheetBySheetId(e),u=(S=d==null?void 0:d.getMergedCell(c,m))!=null?S:{startColumn:m,endColumn:m,startRow:c,endRow:c},h=this._markSelectionService.addShape({range:u,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};G=ye([R(0,a.ICommandService),R(1,a.Inject(exports.SheetsThreadCommentPopupService)),R(2,a.Inject(j.SheetsThreadCommentModel)),R(3,a.Inject(P.ThreadCommentPanelService)),R(4,a.IUniverInstanceService),R(5,a.Inject(C.SheetPermissionCheckController)),R(6,w.IMarkSelectionService),R(7,a.Inject(C.SheetsSelectionsService)),R(8,w.IEditorBridgeService),R(9,oe.IRenderManagerService)],G);var Me=Object.getOwnPropertyDescriptor,we=(n,t,r,e)=>{for(var o=e>1?void 0:e?Me(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},L=(n,t)=>(r,e)=>t(r,e,n);let Z=class extends a.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{var t;if(n.id===C.RemoveSheetCommand.id){const r=n.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const o=e.getUnitId(),i=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!i)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(o,i),c=Array.from(s.values()).filter(p=>!p.parentId),m=c.map(p=>p.id),d=this._threadCommentDataSourceService.syncUpdateMutationToColla,u=m.map(p=>({id:_.DeleteCommentMutation.id,params:{unitId:o,subUnitId:i,commentId:p}})),h=c.map(({children:p,...S})=>({id:_.AddCommentMutation.id,params:{unitId:o,subUnitId:i,comment:{...S,children:d?p:void 0},sync:!d}}));return{redos:u,undos:h}}return{redos:[],undos:[]}}}))}};Z=we([L(0,a.Inject(C.SheetInterceptorService)),L(1,a.IUniverInstanceService),L(2,a.Inject(_.ThreadCommentModel)),L(3,_.IThreadCommentDataSourceService)],Z);var M=function(){return M=Object.assign||function(n){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},M.apply(this,arguments)},Ue=function(n,t){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.indexOf(e)<0&&(r[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,e=Object.getOwnPropertySymbols(n);o<e.length;o++)t.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(n,e[o])&&(r[e[o]]=n[e[o]]);return r},ae=O.forwardRef(function(n,t){var r=n.icon,e=n.id,o=n.className,i=n.extend,s=Ue(n,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(o||"").trim(),m=O.useRef("_".concat(Oe()));return ce(r,"".concat(e),{defIds:r.defIds,idSuffix:m.current},M({ref:t,className:c},s),i)});function ce(n,t,r,e,o){return O.createElement(n.tag,M(M({key:t},Ee(n,r,o)),e),(Re(n,r).children||[]).map(function(i,s){return ce(i,"".concat(t,"-").concat(n.tag,"-").concat(s),r,void 0,o)}))}function Ee(n,t,r){var e=M({},n.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1);var o=t.defIds;return!o||o.length===0||(n.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 Re(n,t){var r,e=t.defIds;return!e||e.length===0?n:n.tag==="defs"&&(!((r=n.children)===null||r===void 0)&&r.length)?M(M({},n),{children:n.children.map(function(o){return typeof o.attrs.id=="string"&&e&&e.indexOf(o.attrs.id)>-1?M(M({},o),{attrs:M(M({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):n}function Oe(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var ke={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"}}]},me=O.forwardRef(function(n,t){return O.createElement(ae,Object.assign({},n,{id:"comment-single",ref:t,icon:ke}))});me.displayName="CommentSingle";const De=()=>{const n=l.useDependency(a.IUniverInstanceService),t=l.useDependency(exports.SheetsThreadCommentPopupService),r=l.useObservable(t.activePopup$),e=l.useDependency(j.SheetsThreadCommentModel);if(l.useObservable(e.commentUpdate$),!r)return null;const{row:o,col:i,unitId:s,subUnitId:c,trigger:m}=r,d=e.getByLocation(s,c,o,i),u=`${a.Tools.chatAtABC(i)}${o+1}`,h=()=>{t.hidePopup()},p=S=>{var g,T,N;return(N=(T=(g=n.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:g.getSheetBySheetId(S))==null?void 0:T.getName())!=null?N:""};return ie.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:d,unitId:s,subUnitId:c,type:a.UniverInstanceType.UNIVER_SHEET,refStr:u,onClose:h,getSubUnitName:p,autoFocus:m==="context-menu"})},Ne=()=>{var b;const n=l.useDependency(w.IMarkSelectionService),t=l.useDependency(a.IUniverInstanceService),r=l.useDependency(exports.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),o=e.getUnitId(),i=l.useDependency(a.ICommandService),s=O.useMemo(()=>e.activeSheet$.pipe(V.map(v=>v==null?void 0:v.getSheetId())),[e.activeSheet$]),c=l.useObservable(s,(b=e.getActiveSheet())==null?void 0:b.getSheetId()),m=O.useRef(null),d=l.useDependency(P.ThreadCommentPanelService),u=l.useObservable(d.activeCommentId$),h=l.useObservable(d.panelVisible$,d.panelVisible),p=O.useCallback(v=>{const y=e.getSheets(),f={};y.forEach((U,I)=>{f[U.getSheetId()]=I});const E=U=>U.map(I=>{var te;const k=$.singleReferenceToGrid(I.ref),he=[(te=f[I.subUnitId])!=null?te:0,k.row,k.column];return{...I,p:he}}).sort((I,k)=>I.p[0]===k.p[0]?I.p[1]===k.p[1]?I.p[2]-k.p[2]:I.p[1]-k.p[1]:I.p[0]-k.p[0]);return[...E(v.filter(U=>!U.resolved)),...E(v.filter(U=>U.resolved))]},[e]),S=O.useCallback(v=>{var y;if(v.unitId===o&&v.subUnitId===c&&!v.resolved){const{row:f,column:E}=$.singleReferenceToGrid(v.ref),U=e.getSheetBySheetId(v.subUnitId),I=(y=U==null?void 0:U.getMergedCell(f,E))!=null?y:{startColumn:E,endColumn:E,startRow:f,endRow:f};if(!Number.isNaN(f)&&!Number.isNaN(E))return n.addShape({range:I,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[n,c,o]),g=v=>{var y,f;return(f=(y=e.getSheetBySheetId(v))==null?void 0:y.getName())!=null?f:""},T=()=>{i.executeCommand(A.id)},N=v=>{u&&u.unitId===v.unitId&&u.subUnitId===v.subUnitId&&u.commentId===v.id||(m.current&&(n.removeShape(m.current),m.current=null),m.current=S(v))},x=()=>{m.current&&(n.removeShape(m.current),m.current=null)},K=(v,y)=>{y&&r.hidePopup()};return O.useEffect(()=>{!h&&m.current&&n.removeShape(m.current)},[n,h]),ie.jsx(P.ThreadCommentPanel,{unitId:o,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:T,getSubUnitName:g,onResolve:K,sortComments:p,onItemEnter:N,onItemLeave:x,onDeleteComment:()=>(x(),!0)})},je=n=>({id:A.id,type:l.MenuItemType.BUTTON,icon:X,title:"sheetThreadComment.menu.addComment",hidden$:l.getMenuHiddenObservable(n,a.UniverInstanceType.UNIVER_SHEET),disabled$:w.getCurrentRangeDisable$(n,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]})}),$e=n=>({id:P.ToggleSheetCommentPanelOperation.id,type:l.MenuItemType.BUTTON,icon:X,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:w.getCurrentRangeDisable$(n,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]}),hidden$:l.getMenuHiddenObservable(n,a.UniverInstanceType.UNIVER_SHEET)}),Ae={id:A.id,binding:l.KeyCode.M|l.MetaKeys.CTRL_COMMAND|l.MetaKeys.ALT,preconditions:w.whenSheetEditorFocused},xe={[l.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:$e}},[l.ContextMenuPosition.MAIN_AREA]:{[l.ContextMenuGroup.OTHERS]:{[A.id]:{order:0,menuItemFactory:je}}}};var Ve=Object.getOwnPropertyDescriptor,He=(n,t,r,e)=>{for(var o=e>1?void 0:e?Ve(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},J=(n,t)=>(r,e)=>t(r,e,n);let z=class extends a.Disposable{constructor(n,t,r){super(),this._menuManagerService=n,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Ae)}_initMenu(){this._menuManagerService.mergeMenu(xe)}_initComponent(){[[se,De],[P.THREAD_COMMENT_PANEL,Ne],[X,me]].forEach(([n,t])=>{this._componentManager.register(n,t)})}};z=He([J(0,l.IMenuManagerService),J(1,a.Inject(l.ComponentManager)),J(2,l.IShortcutService)],z);var Be=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,We=(n,t,r)=>t in n?Be(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,Fe=(n,t,r,e)=>{for(var o=e>1?void 0:e?Le(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},Q=(n,t)=>(r,e)=>t(r,e,n),de=(n,t,r)=>We(n,typeof t!="symbol"?t+"":t,r);exports.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=re,r,e,o){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=o;const{menu:i,...s}=a.merge({},re,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Ce,s)}onStarting(){[[z],[W],[F],[q],[Z],[G],[exports.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[A].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(z)}onReady(){this._injector.get(W),this._injector.get(Z)}onRendered(){this._injector.get(F),this._injector.get(q),this._injector.get(G)}};de(exports.UniverSheetsThreadCommentUIPlugin,"pluginName",ee);de(exports.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsThreadCommentUIPlugin=Fe([a.DependentOn(P.UniverThreadCommentUIPlugin,j.UniverSheetsThreadCommentPlugin),Q(1,a.Inject(a.Injector)),Q(2,a.Inject(a.ICommandService)),Q(3,a.IConfigService)],exports.UniverSheetsThreadCommentUIPlugin);Object.defineProperty(exports,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>P.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=ee;exports.ShowAddSheetCommentModalOperation=A;
|
|
1
|
+
"use strict";var ue=Object.defineProperty;var le=(n,t,r)=>t in n?ue(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r;var D=(n,t,r)=>le(n,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),C=require("@univerjs/sheets"),N=require("@univerjs/sheets-thread-comment"),P=require("@univerjs/thread-comment-ui"),w=require("@univerjs/sheets-ui"),l=require("@univerjs/ui"),V=require("rxjs"),oe=require("@univerjs/engine-render"),$=require("@univerjs/engine-formula"),_=require("@univerjs/thread-comment"),ie=require("react/jsx-runtime"),O=require("react"),se="univer.sheet.thread-comment-modal",X="comment-single",ee="SHEET_THREAD_COMMENT";var pe=Object.getOwnPropertyDescriptor,ve=(n,t,r,e)=>{for(var o=e>1?void 0:e?pe(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},ne=(n,t)=>(r,e)=>t(r,e,n);exports.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(r,e){super();D(this,"_lastPopup",null);D(this,"_activePopup");D(this,"_activePopup$",new V.BehaviorSubject(null));D(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var u;const{row:o,col:i,unitId:s,subUnitId:c}=r;if(this._activePopup&&o===this._activePopup.row&&i===this._activePopup.col&&s===this._activePopup.unitId&&c===((u=this.activePopup)==null?void 0:u.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const m=this._canvasPopupManagerService.attachPopupToCell(o,i,{componentKey:se,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 d=new a.DisposableCollection;d.add(m),d.add({dispose:()=>{e==null||e()}}),this._lastPopup=d}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=ve([ne(0,a.Inject(w.SheetCanvasPopManagerService)),ne(1,l.IZenZoneService)],exports.SheetsThreadCommentPopupService);const x={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(n){var g;const t=n.get(C.SheetsSelectionsService),r=n.get(a.IUniverInstanceService),e=n.get(exports.SheetsThreadCommentPopupService),o=n.get(P.ThreadCommentPanelService),i=(g=t.getCurrentLastSelection())==null?void 0:g.primary,s=n.get(N.SheetsThreadCommentModel);if(!i)return!1;const c=C.getSheetCommandTarget(r);if(!c)return!1;const{workbook:m,worksheet:d,unitId:u,subUnitId:h}=c,p={workbook:m,worksheet:d,unitId:u,subUnitId:h,row:i.startRow,col:i.startColumn};e.showPopup(p);const S=s.getByLocation(u,h,i.startRow,i.startColumn);return S&&o.setActiveComment({unitId:u,subUnitId:h,commentId:S,trigger:"context-menu"}),!0}},Ce="sheets-thread-comment.config",re={};var Se=Object.getOwnPropertyDescriptor,_e=(n,t,r,e)=>{for(var o=e>1?void 0:e?Se(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},H=(n,t)=>(r,e)=>t(r,e,n);let W=class extends a.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(C.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(n,t,r)=>{const{row:e,col:o,unitId:i,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(i,s,e,o)?r({...n,markers:{...n==null?void 0:n.markers,tr:{color:"#FFBD37",size:6}}}):r(n)},priority:100}))}_initSkeletonChange(){const n=()=>{var o;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(o=e==null?void 0:e.mainComponent)==null||o.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(V.debounceTime(16)).subscribe(()=>{n()}))}};W=_e([H(0,a.Inject(C.SheetInterceptorService)),H(1,a.Inject(N.SheetsThreadCommentModel)),H(2,a.IUniverInstanceService),H(3,oe.IRenderManagerService)],W);var ge=Object.getOwnPropertyDescriptor,fe=(n,t,r,e)=>{for(var o=e>1?void 0:e?ge(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},Y=(n,t)=>(r,e)=>t(r,e,n);const Ie=(n,t,r)=>{const e=$.singleReferenceToGrid(n),o=r.row-t.row,i=r.column-t.column,s={startColumn:e.column+i,startRow:e.row+o,endColumn:e.column+i,endRow:e.row+o};return $.serializeRange(s)};let F=class extends a.Disposable{constructor(t,r,e){super();D(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:ee,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,o)=>{const{unitId:i,subUnitId:s,range:c}=r,m={row:c.rows[0],column:c.cols[0]};if(o.copyType===w.COPY_TYPE.CUT&&this._copyInfo){const{range:d,unitId:u,subUnitId:h}=this._copyInfo,p={row:d.startRow,column:d.startColumn};if(!(i===u&&s===h)){const S=[];a.Range.foreach(d,(b,v)=>{const y=this._sheetsThreadCommentModel.getAllByLocation(u,h,b,v);this._threadCommentDataSourceService.syncUpdateMutationToColla?y.forEach(f=>{S.push(f)}):y.forEach(({children:f,...E})=>{E.parentId||S.push(E)})});const g=[],T=[],j=[],A=[],K=b=>{g.unshift({id:_.DeleteCommentMutation.id,params:{unitId:u,subUnitId:h,commentId:b.id}}),j.push({id:_.AddCommentMutation.id,params:{unitId:i,subUnitId:s,comment:{...b,ref:Ie(b.ref,p,m),unitId:i,subUnitId:s},sync:!0}}),T.push({id:_.AddCommentMutation.id,params:{unitId:u,subUnitId:h,comment:b,sync:!0}}),A.unshift({id:_.DeleteCommentMutation.id,params:{unitId:i,subUnitId:s,commentId:b.id}})};return S.forEach(b=>{K(b)}),{redos:[...g,...j],undos:[...A,...T]}}}return{redos:[],undos:[]}}}))}};F=fe([Y(0,a.Inject(w.ISheetClipboardService)),Y(1,a.Inject(N.SheetsThreadCommentModel)),Y(2,_.IThreadCommentDataSourceService)],F);var Pe=Object.getOwnPropertyDescriptor,Te=(n,t,r,e)=>{for(var o=e>1?void 0:e?Pe(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},B=(n,t)=>(r,e)=>t(r,e,n);let q=class extends a.Disposable{constructor(n,t,r,e){super(),this._hoverManagerService=n,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(V.debounceTime(100)).subscribe(n=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(n&&(t&&t.temp||!t)){const{location:r}=n,{unitId:e,subUnitId:o,row:i,col:s}=r,c=this._sheetsThreadCommentModel.getByLocation(e,o,i,s);if(c){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]},[{startRow:i,startColumn:s,endRow:i,endColumn:s}]))return;const d=this._sheetsThreadCommentModel.getComment(e,o,c);d&&!d.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:o,row:i,col:s,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=Te([B(0,a.Inject(w.HoverManagerService)),B(1,a.Inject(exports.SheetsThreadCommentPopupService)),B(2,a.Inject(N.SheetsThreadCommentModel)),B(3,a.Inject(C.SheetPermissionCheckController))],q);var be=Object.getOwnPropertyDescriptor,ye=(n,t,r,e)=>{for(var o=e>1?void 0:e?be(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},R=(n,t)=>(r,e)=>t(r,e,n);let G=class extends a.Disposable{constructor(t,r,e,o,i,s,c,m,d,u){super();D(this,"_isSwitchToCommenting",!1);D(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=o,this._univerInstanceService=i,this._sheetPermissionCheckController=s,this._markSelectionService=c,this._sheetSelectionService=m,this._editorBridgeService=d,this._renderManagerService=u,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var p,S,g;const o=(p=t[0])==null?void 0:p.range,i=this._renderManagerService.getRenderById(r),s=(S=i==null?void 0:i.with(w.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:S.skeleton;if(!s||!o)return;const c=s.getCellWithCoordByIndex(o.startRow,o.startColumn);if((((g=o.rangeType)!=null?g:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||o.endColumn-o.startColumn>0||o.endRow-o.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&a.Rectangle.equals(c.mergeInfo,o))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const d=c.actualRow,u=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,d,u)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,d,u);h&&this._commandService.executeCommand(P.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.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 r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:o,subUnitId:i,commentId:s}=e;r.unitId===o&&r.subUnitId===i&&r.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:o,commentId:i,trigger:s}=t,c=this._sheetsThreadCommentModel.getComment(e,o,i);if(!c||c.resolved)return;const m=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!m||m.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=m.getActiveSheet())==null?void 0:r.getSheetId())!==o&&await this._commandService.executeCommand(C.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:o}),this._isSwitchToCommenting=!1;const h=$.singleReferenceToGrid(c.ref),{row:p,column:S}=h;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:S,endRow:p,endColumn:S}]))return;const T=1;if(await this._commandService.executeCommand(w.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-T,0),endRow:h.row+T,startColumn:Math.max(h.column-T,0),endColumn:h.column+T}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:o,row:h.row,col:h.column,commentId:c.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(V.debounceTime(100)).subscribe(t=>{var p,S;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:o}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const i=this._sheetsThreadCommentModel.getComment(r,e,o);if(!i)return;const s=$.singleReferenceToGrid(i.ref),{row:c,column:m}=s;if(Number.isNaN(c)||Number.isNaN(m))return null;const d=(p=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getSheetBySheetId(e),u=(S=d==null?void 0:d.getMergedCell(c,m))!=null?S:{startColumn:m,endColumn:m,startRow:c,endRow:c},h=this._markSelectionService.addShape({range:u,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};G=ye([R(0,a.ICommandService),R(1,a.Inject(exports.SheetsThreadCommentPopupService)),R(2,a.Inject(N.SheetsThreadCommentModel)),R(3,a.Inject(P.ThreadCommentPanelService)),R(4,a.IUniverInstanceService),R(5,a.Inject(C.SheetPermissionCheckController)),R(6,w.IMarkSelectionService),R(7,a.Inject(C.SheetsSelectionsService)),R(8,w.IEditorBridgeService),R(9,oe.IRenderManagerService)],G);var Me=Object.getOwnPropertyDescriptor,we=(n,t,r,e)=>{for(var o=e>1?void 0:e?Me(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},L=(n,t)=>(r,e)=>t(r,e,n);let Z=class extends a.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{var t;if(n.id===C.RemoveSheetCommand.id){const r=n.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const o=e.getUnitId(),i=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!i)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(o,i),c=Array.from(s.values()).filter(p=>!p.parentId),m=c.map(p=>p.id),d=this._threadCommentDataSourceService.syncUpdateMutationToColla,u=m.map(p=>({id:_.DeleteCommentMutation.id,params:{unitId:o,subUnitId:i,commentId:p}})),h=c.map(({children:p,...S})=>({id:_.AddCommentMutation.id,params:{unitId:o,subUnitId:i,comment:{...S,children:d?p:void 0},sync:!d}}));return{redos:u,undos:h}}return{redos:[],undos:[]}}}))}};Z=we([L(0,a.Inject(C.SheetInterceptorService)),L(1,a.IUniverInstanceService),L(2,a.Inject(_.ThreadCommentModel)),L(3,_.IThreadCommentDataSourceService)],Z);var M=function(){return M=Object.assign||function(n){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},M.apply(this,arguments)},Ue=function(n,t){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.indexOf(e)<0&&(r[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,e=Object.getOwnPropertySymbols(n);o<e.length;o++)t.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(n,e[o])&&(r[e[o]]=n[e[o]]);return r},ae=O.forwardRef(function(n,t){var r=n.icon,e=n.id,o=n.className,i=n.extend,s=Ue(n,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(o||"").trim(),m=O.useRef("_".concat(Oe()));return ce(r,"".concat(e),{defIds:r.defIds,idSuffix:m.current},M({ref:t,className:c},s),i)});function ce(n,t,r,e,o){return O.createElement(n.tag,M(M({key:t},Ee(n,r,o)),e),(Re(n,r).children||[]).map(function(i,s){return ce(i,"".concat(t,"-").concat(n.tag,"-").concat(s),r,void 0,o)}))}function Ee(n,t,r){var e=M({},n.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1),n.tag==="mask"&&e.id&&(e.id=e.id+t.idSuffix),Object.entries(e).forEach(function(i){var s=i[0],c=i[1];s==="mask"&&typeof c=="string"&&(e[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var o=t.defIds;return!o||o.length===0||(n.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 Re(n,t){var r,e=t.defIds;return!e||e.length===0?n:n.tag==="defs"&&(!((r=n.children)===null||r===void 0)&&r.length)?M(M({},n),{children:n.children.map(function(o){return typeof o.attrs.id=="string"&&e&&e.indexOf(o.attrs.id)>-1?M(M({},o),{attrs:M(M({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):n}function Oe(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var ke={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"}}]},me=O.forwardRef(function(n,t){return O.createElement(ae,Object.assign({},n,{id:"comment-single",ref:t,icon:ke}))});me.displayName="CommentSingle";const De=()=>{const n=l.useDependency(a.IUniverInstanceService),t=l.useDependency(exports.SheetsThreadCommentPopupService),r=l.useObservable(t.activePopup$),e=l.useDependency(N.SheetsThreadCommentModel);if(l.useObservable(e.commentUpdate$),!r)return null;const{row:o,col:i,unitId:s,subUnitId:c,trigger:m}=r,d=e.getByLocation(s,c,o,i),u=`${a.Tools.chatAtABC(i)}${o+1}`,h=()=>{t.hidePopup()},p=S=>{var g,T,j;return(j=(T=(g=n.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:g.getSheetBySheetId(S))==null?void 0:T.getName())!=null?j:""};return ie.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:d,unitId:s,subUnitId:c,type:a.UniverInstanceType.UNIVER_SHEET,refStr:u,onClose:h,getSubUnitName:p,autoFocus:m==="context-menu"})},je=()=>{var b;const n=l.useDependency(w.IMarkSelectionService),t=l.useDependency(a.IUniverInstanceService),r=l.useDependency(exports.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),o=e.getUnitId(),i=l.useDependency(a.ICommandService),s=O.useMemo(()=>e.activeSheet$.pipe(V.map(v=>v==null?void 0:v.getSheetId())),[e.activeSheet$]),c=l.useObservable(s,(b=e.getActiveSheet())==null?void 0:b.getSheetId()),m=O.useRef(null),d=l.useDependency(P.ThreadCommentPanelService),u=l.useObservable(d.activeCommentId$),h=l.useObservable(d.panelVisible$,d.panelVisible),p=O.useCallback(v=>{const y=e.getSheets(),f={};y.forEach((U,I)=>{f[U.getSheetId()]=I});const E=U=>U.map(I=>{var te;const k=$.singleReferenceToGrid(I.ref),he=[(te=f[I.subUnitId])!=null?te:0,k.row,k.column];return{...I,p:he}}).sort((I,k)=>I.p[0]===k.p[0]?I.p[1]===k.p[1]?I.p[2]-k.p[2]:I.p[1]-k.p[1]:I.p[0]-k.p[0]);return[...E(v.filter(U=>!U.resolved)),...E(v.filter(U=>U.resolved))]},[e]),S=O.useCallback(v=>{var y;if(v.unitId===o&&v.subUnitId===c&&!v.resolved){const{row:f,column:E}=$.singleReferenceToGrid(v.ref),U=e.getSheetBySheetId(v.subUnitId),I=(y=U==null?void 0:U.getMergedCell(f,E))!=null?y:{startColumn:E,endColumn:E,startRow:f,endRow:f};if(!Number.isNaN(f)&&!Number.isNaN(E))return n.addShape({range:I,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[n,c,o]),g=v=>{var y,f;return(f=(y=e.getSheetBySheetId(v))==null?void 0:y.getName())!=null?f:""},T=()=>{i.executeCommand(x.id)},j=v=>{u&&u.unitId===v.unitId&&u.subUnitId===v.subUnitId&&u.commentId===v.id||(m.current&&(n.removeShape(m.current),m.current=null),m.current=S(v))},A=()=>{m.current&&(n.removeShape(m.current),m.current=null)},K=(v,y)=>{y&&r.hidePopup()};return O.useEffect(()=>{!h&&m.current&&n.removeShape(m.current)},[n,h]),ie.jsx(P.ThreadCommentPanel,{unitId:o,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:T,getSubUnitName:g,onResolve:K,sortComments:p,onItemEnter:j,onItemLeave:A,onDeleteComment:()=>(A(),!0)})},Ne=n=>({id:x.id,type:l.MenuItemType.BUTTON,icon:X,title:"sheetThreadComment.menu.addComment",hidden$:l.getMenuHiddenObservable(n,a.UniverInstanceType.UNIVER_SHEET),disabled$:w.getCurrentRangeDisable$(n,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]})}),$e=n=>({id:P.ToggleSheetCommentPanelOperation.id,type:l.MenuItemType.BUTTON,icon:X,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:w.getCurrentRangeDisable$(n,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]}),hidden$:l.getMenuHiddenObservable(n,a.UniverInstanceType.UNIVER_SHEET)}),xe={id:x.id,binding:l.KeyCode.M|l.MetaKeys.CTRL_COMMAND|l.MetaKeys.ALT,preconditions:w.whenSheetEditorFocused},Ae={[l.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:$e}},[l.ContextMenuPosition.MAIN_AREA]:{[l.ContextMenuGroup.OTHERS]:{[x.id]:{order:0,menuItemFactory:Ne}}}};var Ve=Object.getOwnPropertyDescriptor,He=(n,t,r,e)=>{for(var o=e>1?void 0:e?Ve(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},J=(n,t)=>(r,e)=>t(r,e,n);let z=class extends a.Disposable{constructor(n,t,r){super(),this._menuManagerService=n,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(xe)}_initMenu(){this._menuManagerService.mergeMenu(Ae)}_initComponent(){[[se,De],[P.THREAD_COMMENT_PANEL,je],[X,me]].forEach(([n,t])=>{this._componentManager.register(n,t)})}};z=He([J(0,l.IMenuManagerService),J(1,a.Inject(l.ComponentManager)),J(2,l.IShortcutService)],z);var Be=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,We=(n,t,r)=>t in n?Be(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,Fe=(n,t,r,e)=>{for(var o=e>1?void 0:e?Le(t,r):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=s(o)||o);return o},Q=(n,t)=>(r,e)=>t(r,e,n),de=(n,t,r)=>We(n,typeof t!="symbol"?t+"":t,r);exports.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=re,r,e,o){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=o;const{menu:i,...s}=a.merge({},re,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Ce,s)}onStarting(){[[z],[W],[F],[q],[Z],[G],[exports.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[x].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(z)}onReady(){this._injector.get(W),this._injector.get(Z)}onRendered(){this._injector.get(F),this._injector.get(q),this._injector.get(G)}};de(exports.UniverSheetsThreadCommentUIPlugin,"pluginName",ee);de(exports.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsThreadCommentUIPlugin=Fe([a.DependentOn(P.UniverThreadCommentUIPlugin,N.UniverSheetsThreadCommentPlugin),Q(1,a.Inject(a.Injector)),Q(2,a.Inject(a.ICommandService)),Q(3,a.IConfigService)],exports.UniverSheetsThreadCommentUIPlugin);Object.defineProperty(exports,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>P.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=ee;exports.ShowAddSheetCommentModalOperation=x;
|
package/lib/es/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Ae = (
|
|
3
|
-
var E = (
|
|
4
|
-
import { Inject as v, Disposable as
|
|
1
|
+
var De = Object.defineProperty;
|
|
2
|
+
var Ae = (n, e, r) => e in n ? De(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r;
|
|
3
|
+
var E = (n, e, r) => Ae(n, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { Inject as v, Disposable as k, DisposableCollection as Ve, CommandType as He, IUniverInstanceService as N, InterceptorEffectEnum as je, UniverInstanceType as b, Range as Be, ICommandService as ie, RANGE_TYPE as he, Rectangle as Le, Tools as Fe, DependentOn as We, Injector as Ze, IConfigService as ze, Plugin as Ge, merge as Ke } from "@univerjs/core";
|
|
5
5
|
import { SheetsSelectionsService as ve, getSheetCommandTarget as Ye, SheetInterceptorService as _e, INTERCEPTOR_POINT as qe, SheetPermissionCheckController as Ce, RangeProtectionPermissionViewPoint as q, WorksheetViewPermission as J, WorkbookCommentPermission as Q, SetWorksheetActiveOperation as Je, RemoveSheetCommand as Qe } from "@univerjs/sheets";
|
|
6
6
|
import { SheetsThreadCommentModel as $, UniverSheetsThreadCommentPlugin as Xe } from "@univerjs/sheets-thread-comment";
|
|
7
7
|
import { ThreadCommentPanelService as se, SetActiveCommentOperation as ee, ThreadCommentTree as et, ThreadCommentPanel as tt, ToggleSheetCommentPanelOperation as Se, THREAD_COMMENT_PANEL as nt, UniverThreadCommentUIPlugin as rt } from "@univerjs/thread-comment-ui";
|
|
8
8
|
import { UniverThreadCommentUIPlugin as fn } from "@univerjs/thread-comment-ui";
|
|
9
9
|
import { SheetCanvasPopManagerService as ot, ISheetClipboardService as it, COPY_TYPE as st, HoverManagerService as at, IMarkSelectionService as fe, IEditorBridgeService as ct, SheetSkeletonManagerService as dt, ScrollToRangeOperation as ht, whenSheetEditorFocused as mt, getCurrentRangeDisable$ as ge } from "@univerjs/sheets-ui";
|
|
10
|
-
import { IZenZoneService as ut, useDependency as U, useObservable as
|
|
10
|
+
import { IZenZoneService as ut, useDependency as U, useObservable as D, KeyCode as lt, MetaKeys as me, getMenuHiddenObservable as Ie, MenuItemType as Pe, ContextMenuPosition as pt, ContextMenuGroup as vt, RibbonStartGroup as _t, IMenuManagerService as Ct, ComponentManager as St, IShortcutService as ft } from "@univerjs/ui";
|
|
11
11
|
import { BehaviorSubject as gt, debounceTime as ae, map as It } from "rxjs";
|
|
12
12
|
import { IRenderManagerService as Te } from "@univerjs/engine-render";
|
|
13
13
|
import { singleReferenceToGrid as A, serializeRange as Pt } from "@univerjs/engine-formula";
|
|
@@ -16,12 +16,12 @@ import { AddCommentCommand as In, DeleteCommentCommand as Pn, DeleteCommentTreeC
|
|
|
16
16
|
import { jsx as Me } from "react/jsx-runtime";
|
|
17
17
|
import { forwardRef as we, useRef as ye, createElement as Ee, useMemo as bt, useCallback as ue, useEffect as Mt } from "react";
|
|
18
18
|
const Ue = "univer.sheet.thread-comment-modal", ce = "comment-single", Re = "SHEET_THREAD_COMMENT";
|
|
19
|
-
var wt = Object.getOwnPropertyDescriptor, yt = (
|
|
20
|
-
for (var o =
|
|
21
|
-
(s =
|
|
19
|
+
var wt = Object.getOwnPropertyDescriptor, yt = (n, e, r, t) => {
|
|
20
|
+
for (var o = t > 1 ? void 0 : t ? wt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
|
|
21
|
+
(s = n[i]) && (o = s(o) || o);
|
|
22
22
|
return o;
|
|
23
|
-
}, le = (
|
|
24
|
-
let R = class extends
|
|
23
|
+
}, le = (n, e) => (r, t) => e(r, t, n);
|
|
24
|
+
let R = class extends k {
|
|
25
25
|
constructor(e, r) {
|
|
26
26
|
super();
|
|
27
27
|
E(this, "_lastPopup", null);
|
|
@@ -42,8 +42,8 @@ let R = class extends N {
|
|
|
42
42
|
}
|
|
43
43
|
showPopup(e, r) {
|
|
44
44
|
var d;
|
|
45
|
-
const { row:
|
|
46
|
-
if (this._activePopup &&
|
|
45
|
+
const { row: t, col: o, unitId: i, subUnitId: s } = e;
|
|
46
|
+
if (this._activePopup && t === this._activePopup.row && o === this._activePopup.col && i === this._activePopup.unitId && s === ((d = this.activePopup) == null ? void 0 : d.subUnitId)) {
|
|
47
47
|
this._activePopup = e, this._activePopup$.next(e);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
@@ -51,7 +51,7 @@ let R = class extends N {
|
|
|
51
51
|
return;
|
|
52
52
|
this._activePopup = e, this._activePopup$.next(e);
|
|
53
53
|
const a = this._canvasPopupManagerService.attachPopupToCell(
|
|
54
|
-
|
|
54
|
+
t,
|
|
55
55
|
o,
|
|
56
56
|
{
|
|
57
57
|
componentKey: Ue,
|
|
@@ -91,9 +91,9 @@ R = yt([
|
|
|
91
91
|
const V = {
|
|
92
92
|
type: He.OPERATION,
|
|
93
93
|
id: "sheets.operation.show-comment-modal",
|
|
94
|
-
handler(
|
|
94
|
+
handler(n) {
|
|
95
95
|
var _;
|
|
96
|
-
const e =
|
|
96
|
+
const e = n.get(ve), r = n.get(N), t = n.get(R), o = n.get(se), i = (_ = e.getCurrentLastSelection()) == null ? void 0 : _.primary, s = n.get($);
|
|
97
97
|
if (!i)
|
|
98
98
|
return !1;
|
|
99
99
|
const a = Ye(r);
|
|
@@ -107,7 +107,7 @@ const V = {
|
|
|
107
107
|
row: i.startRow,
|
|
108
108
|
col: i.startColumn
|
|
109
109
|
};
|
|
110
|
-
|
|
110
|
+
t.showPopup(u);
|
|
111
111
|
const p = s.getByLocation(m, h, i.startRow, i.startColumn);
|
|
112
112
|
return p && o.setActiveComment({
|
|
113
113
|
unitId: m,
|
|
@@ -117,14 +117,14 @@ const V = {
|
|
|
117
117
|
}), !0;
|
|
118
118
|
}
|
|
119
119
|
}, Et = "sheets-thread-comment.config", pe = {};
|
|
120
|
-
var Ut = Object.getOwnPropertyDescriptor, Rt = (
|
|
121
|
-
for (var o =
|
|
122
|
-
(s =
|
|
120
|
+
var Ut = Object.getOwnPropertyDescriptor, Rt = (n, e, r, t) => {
|
|
121
|
+
for (var o = t > 1 ? void 0 : t ? Ut(e, r) : e, i = n.length - 1, s; i >= 0; i--)
|
|
122
|
+
(s = n[i]) && (o = s(o) || o);
|
|
123
123
|
return o;
|
|
124
|
-
}, H = (
|
|
125
|
-
let F = class extends
|
|
126
|
-
constructor(
|
|
127
|
-
super(), this._sheetInterceptorService =
|
|
124
|
+
}, H = (n, e) => (r, t) => e(r, t, n);
|
|
125
|
+
let F = class extends k {
|
|
126
|
+
constructor(n, e, r, t) {
|
|
127
|
+
super(), this._sheetInterceptorService = n, this._sheetsThreadCommentModel = e, this._univerInstanceService = r, this._renderManagerService = t, this._initViewModelIntercept(), this._initSkeletonChange();
|
|
128
128
|
}
|
|
129
129
|
_initViewModelIntercept() {
|
|
130
130
|
this.disposeWithMe(
|
|
@@ -132,18 +132,18 @@ let F = class extends N {
|
|
|
132
132
|
qe.CELL_CONTENT,
|
|
133
133
|
{
|
|
134
134
|
effect: je.Style,
|
|
135
|
-
handler: (
|
|
136
|
-
const { row:
|
|
137
|
-
return this._sheetsThreadCommentModel.showCommentMarker(i, s,
|
|
138
|
-
...
|
|
135
|
+
handler: (n, e, r) => {
|
|
136
|
+
const { row: t, col: o, unitId: i, subUnitId: s } = e;
|
|
137
|
+
return this._sheetsThreadCommentModel.showCommentMarker(i, s, t, o) ? r({
|
|
138
|
+
...n,
|
|
139
139
|
markers: {
|
|
140
|
-
...
|
|
140
|
+
...n == null ? void 0 : n.markers,
|
|
141
141
|
tr: {
|
|
142
142
|
color: "#FFBD37",
|
|
143
143
|
size: 6
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
}) : r(
|
|
146
|
+
}) : r(n);
|
|
147
147
|
},
|
|
148
148
|
priority: 100
|
|
149
149
|
}
|
|
@@ -151,58 +151,58 @@ let F = class extends N {
|
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
_initSkeletonChange() {
|
|
154
|
-
const
|
|
154
|
+
const n = () => {
|
|
155
155
|
var o;
|
|
156
156
|
const e = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
157
157
|
if (!e) return;
|
|
158
|
-
const r = e.getUnitId(),
|
|
159
|
-
(o =
|
|
158
|
+
const r = e.getUnitId(), t = this._renderManagerService.getRenderById(r);
|
|
159
|
+
(o = t == null ? void 0 : t.mainComponent) == null || o.makeForceDirty();
|
|
160
160
|
};
|
|
161
161
|
this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(ae(16)).subscribe(() => {
|
|
162
|
-
|
|
162
|
+
n();
|
|
163
163
|
}));
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
166
|
F = Rt([
|
|
167
167
|
H(0, v(_e)),
|
|
168
168
|
H(1, v($)),
|
|
169
|
-
H(2,
|
|
169
|
+
H(2, N),
|
|
170
170
|
H(3, Te)
|
|
171
171
|
], F);
|
|
172
|
-
var Ot = Object.getOwnPropertyDescriptor,
|
|
173
|
-
for (var o =
|
|
174
|
-
(s =
|
|
172
|
+
var Ot = Object.getOwnPropertyDescriptor, kt = (n, e, r, t) => {
|
|
173
|
+
for (var o = t > 1 ? void 0 : t ? Ot(e, r) : e, i = n.length - 1, s; i >= 0; i--)
|
|
174
|
+
(s = n[i]) && (o = s(o) || o);
|
|
175
175
|
return o;
|
|
176
|
-
}, te = (
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
startColumn:
|
|
180
|
-
startRow:
|
|
181
|
-
endColumn:
|
|
182
|
-
endRow:
|
|
176
|
+
}, te = (n, e) => (r, t) => e(r, t, n);
|
|
177
|
+
const Nt = (n, e, r) => {
|
|
178
|
+
const t = A(n), o = r.row - e.row, i = r.column - e.column, s = {
|
|
179
|
+
startColumn: t.column + i,
|
|
180
|
+
startRow: t.row + o,
|
|
181
|
+
endColumn: t.column + i,
|
|
182
|
+
endRow: t.row + o
|
|
183
183
|
};
|
|
184
184
|
return Pt(s);
|
|
185
185
|
};
|
|
186
|
-
let W = class extends
|
|
187
|
-
constructor(e, r,
|
|
186
|
+
let W = class extends k {
|
|
187
|
+
constructor(e, r, t) {
|
|
188
188
|
super();
|
|
189
189
|
E(this, "_copyInfo");
|
|
190
|
-
this._sheetClipboardService = e, this._sheetsThreadCommentModel = r, this._threadCommentDataSourceService =
|
|
190
|
+
this._sheetClipboardService = e, this._sheetsThreadCommentModel = r, this._threadCommentDataSourceService = t, this._initClipboardHook();
|
|
191
191
|
}
|
|
192
192
|
// eslint-disable-next-line max-lines-per-function
|
|
193
193
|
_initClipboardHook() {
|
|
194
194
|
this.disposeWithMe(
|
|
195
195
|
this._sheetClipboardService.addClipboardHook({
|
|
196
196
|
id: Re,
|
|
197
|
-
onBeforeCopy: (e, r,
|
|
197
|
+
onBeforeCopy: (e, r, t) => {
|
|
198
198
|
this._copyInfo = {
|
|
199
199
|
unitId: e,
|
|
200
200
|
subUnitId: r,
|
|
201
|
-
range:
|
|
201
|
+
range: t
|
|
202
202
|
};
|
|
203
203
|
},
|
|
204
204
|
// eslint-disable-next-line max-lines-per-function
|
|
205
|
-
onPasteCells: (e, r,
|
|
205
|
+
onPasteCells: (e, r, t, o) => {
|
|
206
206
|
const { unitId: i, subUnitId: s, range: a } = r, c = {
|
|
207
207
|
row: a.rows[0],
|
|
208
208
|
column: a.cols[0]
|
|
@@ -222,7 +222,7 @@ let W = class extends N {
|
|
|
222
222
|
M.parentId || p.push(M);
|
|
223
223
|
});
|
|
224
224
|
});
|
|
225
|
-
const _ = [], f = [], O = [],
|
|
225
|
+
const _ = [], f = [], O = [], x = [], X = (g) => {
|
|
226
226
|
_.unshift({
|
|
227
227
|
id: L.id,
|
|
228
228
|
params: {
|
|
@@ -237,7 +237,7 @@ let W = class extends N {
|
|
|
237
237
|
subUnitId: s,
|
|
238
238
|
comment: {
|
|
239
239
|
...g,
|
|
240
|
-
ref:
|
|
240
|
+
ref: Nt(g.ref, u, c),
|
|
241
241
|
unitId: i,
|
|
242
242
|
subUnitId: s
|
|
243
243
|
},
|
|
@@ -251,7 +251,7 @@ let W = class extends N {
|
|
|
251
251
|
comment: g,
|
|
252
252
|
sync: !0
|
|
253
253
|
}
|
|
254
|
-
}),
|
|
254
|
+
}), x.unshift({
|
|
255
255
|
id: L.id,
|
|
256
256
|
params: {
|
|
257
257
|
unitId: i,
|
|
@@ -264,7 +264,7 @@ let W = class extends N {
|
|
|
264
264
|
X(g);
|
|
265
265
|
}), {
|
|
266
266
|
redos: [..._, ...O],
|
|
267
|
-
undos: [...
|
|
267
|
+
undos: [...x, ...f]
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
}
|
|
@@ -277,26 +277,26 @@ let W = class extends N {
|
|
|
277
277
|
);
|
|
278
278
|
}
|
|
279
279
|
};
|
|
280
|
-
W =
|
|
280
|
+
W = kt([
|
|
281
281
|
te(0, v(it)),
|
|
282
282
|
te(1, v($)),
|
|
283
283
|
te(2, be)
|
|
284
284
|
], W);
|
|
285
|
-
var $t = Object.getOwnPropertyDescriptor,
|
|
286
|
-
for (var o =
|
|
287
|
-
(s =
|
|
285
|
+
var $t = Object.getOwnPropertyDescriptor, xt = (n, e, r, t) => {
|
|
286
|
+
for (var o = t > 1 ? void 0 : t ? $t(e, r) : e, i = n.length - 1, s; i >= 0; i--)
|
|
287
|
+
(s = n[i]) && (o = s(o) || o);
|
|
288
288
|
return o;
|
|
289
|
-
}, j = (
|
|
290
|
-
let Z = class extends
|
|
291
|
-
constructor(
|
|
292
|
-
super(), this._hoverManagerService =
|
|
289
|
+
}, j = (n, e) => (r, t) => e(r, t, n);
|
|
290
|
+
let Z = class extends k {
|
|
291
|
+
constructor(n, e, r, t) {
|
|
292
|
+
super(), this._hoverManagerService = n, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel = r, this._sheetPermissionCheckController = t, this._initHoverEvent();
|
|
293
293
|
}
|
|
294
294
|
_initHoverEvent() {
|
|
295
295
|
this.disposeWithMe(
|
|
296
|
-
this._hoverManagerService.currentCell$.pipe(ae(100)).subscribe((
|
|
296
|
+
this._hoverManagerService.currentCell$.pipe(ae(100)).subscribe((n) => {
|
|
297
297
|
const e = this._sheetsThreadCommentPopupService.activePopup;
|
|
298
|
-
if (
|
|
299
|
-
const { location: r } =
|
|
298
|
+
if (n && (e && e.temp || !e)) {
|
|
299
|
+
const { location: r } = n, { unitId: t, subUnitId: o, row: i, col: s } = r, a = this._sheetsThreadCommentModel.getByLocation(t, o, i, s);
|
|
300
300
|
if (a) {
|
|
301
301
|
if (!this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
302
302
|
workbookTypes: [Q],
|
|
@@ -304,9 +304,9 @@ let Z = class extends N {
|
|
|
304
304
|
rangeTypes: [q]
|
|
305
305
|
}, [{ startRow: i, startColumn: s, endRow: i, endColumn: s }]))
|
|
306
306
|
return;
|
|
307
|
-
const d = this._sheetsThreadCommentModel.getComment(
|
|
307
|
+
const d = this._sheetsThreadCommentModel.getComment(t, o, a);
|
|
308
308
|
d && !d.resolved && this._sheetsThreadCommentPopupService.showPopup({
|
|
309
|
-
unitId:
|
|
309
|
+
unitId: t,
|
|
310
310
|
subUnitId: o,
|
|
311
311
|
row: i,
|
|
312
312
|
col: s,
|
|
@@ -320,27 +320,27 @@ let Z = class extends N {
|
|
|
320
320
|
);
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
|
-
Z =
|
|
323
|
+
Z = xt([
|
|
324
324
|
j(0, v(at)),
|
|
325
325
|
j(1, v(R)),
|
|
326
326
|
j(2, v($)),
|
|
327
327
|
j(3, v(Ce))
|
|
328
328
|
], Z);
|
|
329
|
-
var
|
|
330
|
-
for (var o =
|
|
331
|
-
(s =
|
|
329
|
+
var Dt = Object.getOwnPropertyDescriptor, At = (n, e, r, t) => {
|
|
330
|
+
for (var o = t > 1 ? void 0 : t ? Dt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
|
|
331
|
+
(s = n[i]) && (o = s(o) || o);
|
|
332
332
|
return o;
|
|
333
|
-
}, w = (
|
|
334
|
-
let z = class extends
|
|
335
|
-
constructor(e, r,
|
|
333
|
+
}, w = (n, e) => (r, t) => e(r, t, n);
|
|
334
|
+
let z = class extends k {
|
|
335
|
+
constructor(e, r, t, o, i, s, a, c, d, m) {
|
|
336
336
|
super();
|
|
337
337
|
E(this, "_isSwitchToCommenting", !1);
|
|
338
338
|
E(this, "_selectionShapeInfo", null);
|
|
339
|
-
this._commandService = e, this._sheetsThreadCommentPopupService = r, this._sheetsThreadCommentModel =
|
|
339
|
+
this._commandService = e, this._sheetsThreadCommentPopupService = r, this._sheetsThreadCommentModel = t, this._threadCommentPanelService = o, this._univerInstanceService = i, this._sheetPermissionCheckController = s, this._markSelectionService = a, this._sheetSelectionService = c, this._editorBridgeService = d, this._renderManagerService = m, this._initCommandListener(), this._initPanelListener(), this._initMarkSelection(), this._initSelectionUpdateListener(), this._initEditorBridge();
|
|
340
340
|
}
|
|
341
|
-
_handleSelectionChange(e, r,
|
|
341
|
+
_handleSelectionChange(e, r, t) {
|
|
342
342
|
var u, p, _;
|
|
343
|
-
const o = (u = e[0]) == null ? void 0 : u.range, i = this._renderManagerService.getRenderById(r), s = (p = i == null ? void 0 : i.with(dt).getSkeletonParam(
|
|
343
|
+
const o = (u = e[0]) == null ? void 0 : u.range, i = this._renderManagerService.getRenderById(r), s = (p = i == null ? void 0 : i.with(dt).getSkeletonParam(t)) == null ? void 0 : p.skeleton;
|
|
344
344
|
if (!s || !o)
|
|
345
345
|
return;
|
|
346
346
|
const a = s.getCellWithCoordByIndex(o.startRow, o.startColumn);
|
|
@@ -349,14 +349,14 @@ let z = class extends N {
|
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
351
|
const d = a.actualRow, m = a.actualColumn;
|
|
352
|
-
if (!this._sheetsThreadCommentModel.showCommentMarker(r,
|
|
352
|
+
if (!this._sheetsThreadCommentModel.showCommentMarker(r, t, d, m)) {
|
|
353
353
|
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(ee.id);
|
|
354
354
|
return;
|
|
355
355
|
}
|
|
356
|
-
const h = this._sheetsThreadCommentModel.getByLocation(r,
|
|
356
|
+
const h = this._sheetsThreadCommentModel.getByLocation(r, t, d, m);
|
|
357
357
|
h && this._commandService.executeCommand(ee.id, {
|
|
358
358
|
unitId: r,
|
|
359
|
-
subUnitId:
|
|
359
|
+
subUnitId: t,
|
|
360
360
|
commentId: h
|
|
361
361
|
});
|
|
362
362
|
}
|
|
@@ -380,10 +380,10 @@ let z = class extends N {
|
|
|
380
380
|
_initCommandListener() {
|
|
381
381
|
this._commandService.onCommandExecuted((e) => {
|
|
382
382
|
if (e.id === L.id) {
|
|
383
|
-
const r = e.params,
|
|
384
|
-
if (!
|
|
383
|
+
const r = e.params, t = this._sheetsThreadCommentPopupService.activePopup;
|
|
384
|
+
if (!t)
|
|
385
385
|
return;
|
|
386
|
-
const { unitId: o, subUnitId: i, commentId: s } =
|
|
386
|
+
const { unitId: o, subUnitId: i, commentId: s } = t;
|
|
387
387
|
r.unitId === o && r.subUnitId === i && r.commentId === s && this._sheetsThreadCommentPopupService.hidePopup();
|
|
388
388
|
}
|
|
389
389
|
});
|
|
@@ -392,14 +392,14 @@ let z = class extends N {
|
|
|
392
392
|
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async (e) => {
|
|
393
393
|
var r;
|
|
394
394
|
if (e) {
|
|
395
|
-
const { unitId:
|
|
395
|
+
const { unitId: t, subUnitId: o, commentId: i, trigger: s } = e, a = this._sheetsThreadCommentModel.getComment(t, o, i);
|
|
396
396
|
if (!a || a.resolved)
|
|
397
397
|
return;
|
|
398
398
|
const c = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
399
|
-
if (!c || c.getUnitId() !==
|
|
399
|
+
if (!c || c.getUnitId() !== t)
|
|
400
400
|
return;
|
|
401
401
|
this._isSwitchToCommenting = !0, ((r = c.getActiveSheet()) == null ? void 0 : r.getSheetId()) !== o && await this._commandService.executeCommand(Je.id, {
|
|
402
|
-
unitId:
|
|
402
|
+
unitId: t,
|
|
403
403
|
subUnitId: o
|
|
404
404
|
}), this._isSwitchToCommenting = !1;
|
|
405
405
|
const h = A(a.ref), { row: u, column: p } = h;
|
|
@@ -420,7 +420,7 @@ let z = class extends N {
|
|
|
420
420
|
}), this._editorBridgeService.isVisible().visible)
|
|
421
421
|
return;
|
|
422
422
|
this._sheetsThreadCommentPopupService.showPopup({
|
|
423
|
-
unitId:
|
|
423
|
+
unitId: t,
|
|
424
424
|
subUnitId: o,
|
|
425
425
|
row: h.row,
|
|
426
426
|
col: h.column,
|
|
@@ -438,15 +438,15 @@ let z = class extends N {
|
|
|
438
438
|
this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
|
|
439
439
|
return;
|
|
440
440
|
}
|
|
441
|
-
const { unitId: r, subUnitId:
|
|
441
|
+
const { unitId: r, subUnitId: t, commentId: o } = e;
|
|
442
442
|
this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
|
|
443
|
-
const i = this._sheetsThreadCommentModel.getComment(r,
|
|
443
|
+
const i = this._sheetsThreadCommentModel.getComment(r, t, o);
|
|
444
444
|
if (!i)
|
|
445
445
|
return;
|
|
446
446
|
const s = A(i.ref), { row: a, column: c } = s;
|
|
447
447
|
if (Number.isNaN(a) || Number.isNaN(c))
|
|
448
448
|
return null;
|
|
449
|
-
const d = (u = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : u.getSheetBySheetId(
|
|
449
|
+
const d = (u = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : u.getSheetBySheetId(t), m = (p = d == null ? void 0 : d.getMergedCell(a, c)) != null ? p : {
|
|
450
450
|
startColumn: c,
|
|
451
451
|
endColumn: c,
|
|
452
452
|
startRow: a,
|
|
@@ -478,32 +478,32 @@ z = At([
|
|
|
478
478
|
w(1, v(R)),
|
|
479
479
|
w(2, v($)),
|
|
480
480
|
w(3, v(se)),
|
|
481
|
-
w(4,
|
|
481
|
+
w(4, N),
|
|
482
482
|
w(5, v(Ce)),
|
|
483
483
|
w(6, fe),
|
|
484
484
|
w(7, v(ve)),
|
|
485
485
|
w(8, ct),
|
|
486
486
|
w(9, Te)
|
|
487
487
|
], z);
|
|
488
|
-
var Vt = Object.getOwnPropertyDescriptor, Ht = (
|
|
489
|
-
for (var o =
|
|
490
|
-
(s =
|
|
488
|
+
var Vt = Object.getOwnPropertyDescriptor, Ht = (n, e, r, t) => {
|
|
489
|
+
for (var o = t > 1 ? void 0 : t ? Vt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
|
|
490
|
+
(s = n[i]) && (o = s(o) || o);
|
|
491
491
|
return o;
|
|
492
|
-
}, B = (
|
|
493
|
-
let G = class extends
|
|
494
|
-
constructor(
|
|
495
|
-
super(), this._sheetInterceptorService =
|
|
492
|
+
}, B = (n, e) => (r, t) => e(r, t, n);
|
|
493
|
+
let G = class extends k {
|
|
494
|
+
constructor(n, e, r, t) {
|
|
495
|
+
super(), this._sheetInterceptorService = n, this._univerInstanceService = e, this._threadCommentModel = r, this._threadCommentDataSourceService = t, this._initSheetChange();
|
|
496
496
|
}
|
|
497
497
|
_initSheetChange() {
|
|
498
498
|
this.disposeWithMe(
|
|
499
499
|
this._sheetInterceptorService.interceptCommand({
|
|
500
|
-
getMutations: (
|
|
500
|
+
getMutations: (n) => {
|
|
501
501
|
var e;
|
|
502
|
-
if (
|
|
503
|
-
const r =
|
|
504
|
-
if (!
|
|
502
|
+
if (n.id === Qe.id) {
|
|
503
|
+
const r = n.params, t = r.unitId ? this._univerInstanceService.getUnit(r.unitId) : this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
504
|
+
if (!t)
|
|
505
505
|
return { redos: [], undos: [] };
|
|
506
|
-
const o =
|
|
506
|
+
const o = t.getUnitId(), i = r.subUnitId || ((e = t.getActiveSheet()) == null ? void 0 : e.getSheetId());
|
|
507
507
|
if (!i)
|
|
508
508
|
return { redos: [], undos: [] };
|
|
509
509
|
const s = this._threadCommentModel.ensureMap(o, i), a = Array.from(s.values()).filter((u) => !u.parentId), c = a.map((u) => u.id), d = this._threadCommentDataSourceService.syncUpdateMutationToColla, m = c.map((u) => ({
|
|
@@ -535,70 +535,73 @@ let G = class extends N {
|
|
|
535
535
|
};
|
|
536
536
|
G = Ht([
|
|
537
537
|
B(0, v(_e)),
|
|
538
|
-
B(1,
|
|
538
|
+
B(1, N),
|
|
539
539
|
B(2, v(Tt)),
|
|
540
540
|
B(3, be)
|
|
541
541
|
], G);
|
|
542
542
|
var P = function() {
|
|
543
|
-
return P = Object.assign || function(
|
|
544
|
-
for (var e, r = 1,
|
|
543
|
+
return P = Object.assign || function(n) {
|
|
544
|
+
for (var e, r = 1, t = arguments.length; r < t; r++) {
|
|
545
545
|
e = arguments[r];
|
|
546
|
-
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (
|
|
546
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (n[o] = e[o]);
|
|
547
547
|
}
|
|
548
|
-
return
|
|
548
|
+
return n;
|
|
549
549
|
}, P.apply(this, arguments);
|
|
550
|
-
}, jt = function(
|
|
550
|
+
}, jt = function(n, e) {
|
|
551
551
|
var r = {};
|
|
552
|
-
for (var
|
|
553
|
-
if (
|
|
554
|
-
for (var o = 0,
|
|
555
|
-
e.indexOf(
|
|
552
|
+
for (var t in n) Object.prototype.hasOwnProperty.call(n, t) && e.indexOf(t) < 0 && (r[t] = n[t]);
|
|
553
|
+
if (n != null && typeof Object.getOwnPropertySymbols == "function")
|
|
554
|
+
for (var o = 0, t = Object.getOwnPropertySymbols(n); o < t.length; o++)
|
|
555
|
+
e.indexOf(t[o]) < 0 && Object.prototype.propertyIsEnumerable.call(n, t[o]) && (r[t[o]] = n[t[o]]);
|
|
556
556
|
return r;
|
|
557
|
-
}, Oe = we(function(
|
|
558
|
-
var r =
|
|
559
|
-
return
|
|
557
|
+
}, Oe = we(function(n, e) {
|
|
558
|
+
var r = n.icon, t = n.id, o = n.className, i = n.extend, s = jt(n, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(o || "").trim(), c = ye("_".concat(Ft()));
|
|
559
|
+
return ke(r, "".concat(t), { defIds: r.defIds, idSuffix: c.current }, P({ ref: e, className: a }, s), i);
|
|
560
560
|
});
|
|
561
|
-
function
|
|
562
|
-
return Ee(
|
|
563
|
-
return
|
|
561
|
+
function ke(n, e, r, t, o) {
|
|
562
|
+
return Ee(n.tag, P(P({ key: e }, Bt(n, r, o)), t), (Lt(n, r).children || []).map(function(i, s) {
|
|
563
|
+
return ke(i, "".concat(e, "-").concat(n.tag, "-").concat(s), r, void 0, o);
|
|
564
564
|
}));
|
|
565
565
|
}
|
|
566
|
-
function Bt(
|
|
567
|
-
var
|
|
568
|
-
r != null && r.colorChannel1 &&
|
|
566
|
+
function Bt(n, e, r) {
|
|
567
|
+
var t = P({}, n.attrs);
|
|
568
|
+
r != null && r.colorChannel1 && t.fill === "colorChannel1" && (t.fill = r.colorChannel1), n.tag === "mask" && t.id && (t.id = t.id + e.idSuffix), Object.entries(t).forEach(function(i) {
|
|
569
|
+
var s = i[0], a = i[1];
|
|
570
|
+
s === "mask" && typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
571
|
+
});
|
|
569
572
|
var o = e.defIds;
|
|
570
|
-
return !o || o.length === 0 || (
|
|
573
|
+
return !o || o.length === 0 || (n.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(i) {
|
|
571
574
|
var s = i[0], a = i[1];
|
|
572
|
-
typeof a == "string" && (
|
|
573
|
-
})),
|
|
575
|
+
typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
576
|
+
})), t;
|
|
574
577
|
}
|
|
575
|
-
function Lt(
|
|
576
|
-
var r,
|
|
577
|
-
return !
|
|
578
|
-
return typeof o.attrs.id == "string" &&
|
|
579
|
-
}) }) :
|
|
578
|
+
function Lt(n, e) {
|
|
579
|
+
var r, t = e.defIds;
|
|
580
|
+
return !t || t.length === 0 ? n : n.tag === "defs" && (!((r = n.children) === null || r === void 0) && r.length) ? P(P({}, n), { children: n.children.map(function(o) {
|
|
581
|
+
return typeof o.attrs.id == "string" && t && t.indexOf(o.attrs.id) > -1 ? P(P({}, o), { attrs: P(P({}, o.attrs), { id: o.attrs.id + e.idSuffix }) }) : o;
|
|
582
|
+
}) }) : n;
|
|
580
583
|
}
|
|
581
584
|
function Ft() {
|
|
582
585
|
return Math.random().toString(36).substring(2, 8);
|
|
583
586
|
}
|
|
584
587
|
Oe.displayName = "UniverIcon";
|
|
585
|
-
var Wt = { 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" } }] },
|
|
586
|
-
return Ee(Oe, Object.assign({},
|
|
588
|
+
var Wt = { 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" } }] }, Ne = we(function(n, e) {
|
|
589
|
+
return Ee(Oe, Object.assign({}, n, {
|
|
587
590
|
id: "comment-single",
|
|
588
591
|
ref: e,
|
|
589
592
|
icon: Wt
|
|
590
593
|
}));
|
|
591
594
|
});
|
|
592
|
-
|
|
595
|
+
Ne.displayName = "CommentSingle";
|
|
593
596
|
const Zt = () => {
|
|
594
|
-
const
|
|
595
|
-
if (
|
|
597
|
+
const n = U(N), e = U(R), r = D(e.activePopup$), t = U($);
|
|
598
|
+
if (D(t.commentUpdate$), !r)
|
|
596
599
|
return null;
|
|
597
|
-
const { row: o, col: i, unitId: s, subUnitId: a, trigger: c } = r, d =
|
|
600
|
+
const { row: o, col: i, unitId: s, subUnitId: a, trigger: c } = r, d = t.getByLocation(s, a, o, i), m = `${Fe.chatAtABC(i)}${o + 1}`, h = () => {
|
|
598
601
|
e.hidePopup();
|
|
599
602
|
}, u = (p) => {
|
|
600
603
|
var _, f, O;
|
|
601
|
-
return (O = (f = (_ =
|
|
604
|
+
return (O = (f = (_ = n.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : _.getSheetBySheetId(p)) == null ? void 0 : f.getName()) != null ? O : "";
|
|
602
605
|
};
|
|
603
606
|
return /* @__PURE__ */ Me(
|
|
604
607
|
et,
|
|
@@ -619,31 +622,31 @@ const Zt = () => {
|
|
|
619
622
|
);
|
|
620
623
|
}, zt = () => {
|
|
621
624
|
var g;
|
|
622
|
-
const
|
|
623
|
-
const I =
|
|
625
|
+
const n = U(fe), e = U(N), r = U(R), t = e.getCurrentUnitForType(b.UNIVER_SHEET), o = t.getUnitId(), i = U(ie), s = bt(() => t.activeSheet$.pipe(It((l) => l == null ? void 0 : l.getSheetId())), [t.activeSheet$]), a = D(s, (g = t.getActiveSheet()) == null ? void 0 : g.getSheetId()), c = ye(null), d = U(se), m = D(d.activeCommentId$), h = D(d.panelVisible$, d.panelVisible), u = ue((l) => {
|
|
626
|
+
const I = t.getSheets(), C = {};
|
|
624
627
|
I.forEach((T, S) => {
|
|
625
628
|
C[T.getSheetId()] = S;
|
|
626
629
|
});
|
|
627
630
|
const M = (T) => T.map((S) => {
|
|
628
631
|
var de;
|
|
629
|
-
const y = A(S.ref),
|
|
630
|
-
return { ...S, p:
|
|
632
|
+
const y = A(S.ref), xe = [(de = C[S.subUnitId]) != null ? de : 0, y.row, y.column];
|
|
633
|
+
return { ...S, p: xe };
|
|
631
634
|
}).sort((S, y) => S.p[0] === y.p[0] ? S.p[1] === y.p[1] ? S.p[2] - y.p[2] : S.p[1] - y.p[1] : S.p[0] - y.p[0]);
|
|
632
635
|
return [
|
|
633
636
|
...M(l.filter((T) => !T.resolved)),
|
|
634
637
|
...M(l.filter((T) => T.resolved))
|
|
635
638
|
];
|
|
636
|
-
}, [
|
|
639
|
+
}, [t]), p = ue((l) => {
|
|
637
640
|
var I;
|
|
638
641
|
if (l.unitId === o && l.subUnitId === a && !l.resolved) {
|
|
639
|
-
const { row: C, column: M } = A(l.ref), T =
|
|
642
|
+
const { row: C, column: M } = A(l.ref), T = t.getSheetBySheetId(l.subUnitId), S = (I = T == null ? void 0 : T.getMergedCell(C, M)) != null ? I : {
|
|
640
643
|
startColumn: M,
|
|
641
644
|
endColumn: M,
|
|
642
645
|
startRow: C,
|
|
643
646
|
endRow: C
|
|
644
647
|
};
|
|
645
648
|
if (!Number.isNaN(C) && !Number.isNaN(M))
|
|
646
|
-
return
|
|
649
|
+
return n.addShape({
|
|
647
650
|
range: S,
|
|
648
651
|
style: {
|
|
649
652
|
// hasAutoFill: false,
|
|
@@ -656,21 +659,21 @@ const Zt = () => {
|
|
|
656
659
|
});
|
|
657
660
|
}
|
|
658
661
|
return null;
|
|
659
|
-
}, [
|
|
662
|
+
}, [n, a, o]), _ = (l) => {
|
|
660
663
|
var I, C;
|
|
661
|
-
return (C = (I =
|
|
664
|
+
return (C = (I = t.getSheetBySheetId(l)) == null ? void 0 : I.getName()) != null ? C : "";
|
|
662
665
|
}, f = () => {
|
|
663
666
|
i.executeCommand(V.id);
|
|
664
667
|
}, O = (l) => {
|
|
665
|
-
m && m.unitId === l.unitId && m.subUnitId === l.subUnitId && m.commentId === l.id || (c.current && (
|
|
666
|
-
},
|
|
667
|
-
c.current && (
|
|
668
|
+
m && m.unitId === l.unitId && m.subUnitId === l.subUnitId && m.commentId === l.id || (c.current && (n.removeShape(c.current), c.current = null), c.current = p(l));
|
|
669
|
+
}, x = () => {
|
|
670
|
+
c.current && (n.removeShape(c.current), c.current = null);
|
|
668
671
|
}, X = (l, I) => {
|
|
669
672
|
I && r.hidePopup();
|
|
670
673
|
};
|
|
671
674
|
return Mt(() => {
|
|
672
|
-
!h && c.current &&
|
|
673
|
-
}, [
|
|
675
|
+
!h && c.current && n.removeShape(c.current);
|
|
676
|
+
}, [n, h]), /* @__PURE__ */ Me(
|
|
674
677
|
tt,
|
|
675
678
|
{
|
|
676
679
|
unitId: o,
|
|
@@ -681,32 +684,32 @@ const Zt = () => {
|
|
|
681
684
|
onResolve: X,
|
|
682
685
|
sortComments: u,
|
|
683
686
|
onItemEnter: O,
|
|
684
|
-
onItemLeave:
|
|
685
|
-
onDeleteComment: () => (
|
|
687
|
+
onItemLeave: x,
|
|
688
|
+
onDeleteComment: () => (x(), !0)
|
|
686
689
|
}
|
|
687
690
|
);
|
|
688
|
-
}, Gt = (
|
|
691
|
+
}, Gt = (n) => ({
|
|
689
692
|
id: V.id,
|
|
690
693
|
type: Pe.BUTTON,
|
|
691
694
|
icon: ce,
|
|
692
695
|
title: "sheetThreadComment.menu.addComment",
|
|
693
|
-
hidden$: Ie(
|
|
694
|
-
disabled$: ge(
|
|
696
|
+
hidden$: Ie(n, b.UNIVER_SHEET),
|
|
697
|
+
disabled$: ge(n, {
|
|
695
698
|
workbookTypes: [Q],
|
|
696
699
|
worksheetTypes: [J],
|
|
697
700
|
rangeTypes: [q]
|
|
698
701
|
})
|
|
699
|
-
}), Kt = (
|
|
702
|
+
}), Kt = (n) => ({
|
|
700
703
|
id: Se.id,
|
|
701
704
|
type: Pe.BUTTON,
|
|
702
705
|
icon: ce,
|
|
703
706
|
tooltip: "sheetThreadComment.menu.commentManagement",
|
|
704
|
-
disabled$: ge(
|
|
707
|
+
disabled$: ge(n, {
|
|
705
708
|
workbookTypes: [Q],
|
|
706
709
|
worksheetTypes: [J],
|
|
707
710
|
rangeTypes: [q]
|
|
708
711
|
}),
|
|
709
|
-
hidden$: Ie(
|
|
712
|
+
hidden$: Ie(n, b.UNIVER_SHEET)
|
|
710
713
|
}), Yt = {
|
|
711
714
|
id: V.id,
|
|
712
715
|
binding: lt.M | me.CTRL_COMMAND | me.ALT,
|
|
@@ -727,14 +730,14 @@ const Zt = () => {
|
|
|
727
730
|
}
|
|
728
731
|
}
|
|
729
732
|
};
|
|
730
|
-
var Jt = Object.getOwnPropertyDescriptor, Qt = (
|
|
731
|
-
for (var o =
|
|
732
|
-
(s =
|
|
733
|
+
var Jt = Object.getOwnPropertyDescriptor, Qt = (n, e, r, t) => {
|
|
734
|
+
for (var o = t > 1 ? void 0 : t ? Jt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
|
|
735
|
+
(s = n[i]) && (o = s(o) || o);
|
|
733
736
|
return o;
|
|
734
|
-
}, ne = (
|
|
735
|
-
let K = class extends
|
|
736
|
-
constructor(
|
|
737
|
-
super(), this._menuManagerService =
|
|
737
|
+
}, ne = (n, e) => (r, t) => e(r, t, n);
|
|
738
|
+
let K = class extends k {
|
|
739
|
+
constructor(n, e, r) {
|
|
740
|
+
super(), this._menuManagerService = n, this._componentManager = e, this._shortcutService = r, this._initMenu(), this._initShortcut(), this._initComponent();
|
|
738
741
|
}
|
|
739
742
|
_initShortcut() {
|
|
740
743
|
this._shortcutService.registerShortcut(Yt);
|
|
@@ -746,9 +749,9 @@ let K = class extends N {
|
|
|
746
749
|
[
|
|
747
750
|
[Ue, Zt],
|
|
748
751
|
[nt, zt],
|
|
749
|
-
[ce,
|
|
750
|
-
].forEach(([
|
|
751
|
-
this._componentManager.register(
|
|
752
|
+
[ce, Ne]
|
|
753
|
+
].forEach(([n, e]) => {
|
|
754
|
+
this._componentManager.register(n, e);
|
|
752
755
|
});
|
|
753
756
|
}
|
|
754
757
|
};
|
|
@@ -757,14 +760,14 @@ K = Qt([
|
|
|
757
760
|
ne(1, v(St)),
|
|
758
761
|
ne(2, ft)
|
|
759
762
|
], K);
|
|
760
|
-
var Xt = Object.defineProperty, en = Object.getOwnPropertyDescriptor, tn = (
|
|
761
|
-
for (var o =
|
|
762
|
-
(s =
|
|
763
|
+
var Xt = Object.defineProperty, en = Object.getOwnPropertyDescriptor, tn = (n, e, r) => e in n ? Xt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r, nn = (n, e, r, t) => {
|
|
764
|
+
for (var o = t > 1 ? void 0 : t ? en(e, r) : e, i = n.length - 1, s; i >= 0; i--)
|
|
765
|
+
(s = n[i]) && (o = s(o) || o);
|
|
763
766
|
return o;
|
|
764
|
-
}, re = (
|
|
767
|
+
}, re = (n, e) => (r, t) => e(r, t, n), $e = (n, e, r) => tn(n, typeof e != "symbol" ? e + "" : e, r);
|
|
765
768
|
let Y = class extends Ge {
|
|
766
|
-
constructor(
|
|
767
|
-
super(), this._config =
|
|
769
|
+
constructor(n = pe, e, r, t) {
|
|
770
|
+
super(), this._config = n, this._injector = e, this._commandService = r, this._configService = t;
|
|
768
771
|
const { menu: o, ...i } = Ke(
|
|
769
772
|
{},
|
|
770
773
|
pe,
|
|
@@ -781,10 +784,10 @@ let Y = class extends Ge {
|
|
|
781
784
|
[G],
|
|
782
785
|
[z],
|
|
783
786
|
[R]
|
|
784
|
-
].forEach((
|
|
785
|
-
this._injector.add(
|
|
786
|
-
}), [V].forEach((
|
|
787
|
-
this._commandService.registerCommand(
|
|
787
|
+
].forEach((n) => {
|
|
788
|
+
this._injector.add(n);
|
|
789
|
+
}), [V].forEach((n) => {
|
|
790
|
+
this._commandService.registerCommand(n);
|
|
788
791
|
}), this._injector.get(K);
|
|
789
792
|
}
|
|
790
793
|
onReady() {
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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,N,g,b,v,H,ne,A,f,re,R){"use strict";var Fe=Object.defineProperty;var qe=(c,s,p)=>s in c?Fe(c,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[s]=p;var D=(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 he=Object.getOwnPropertyDescriptor,le=(n,t,r,e)=>{for(var i=e>1?void 0:e?he(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},oe=(n,t)=>(r,e)=>t(r,e,n);c.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(r,e){super();D(this,"_lastPopup",null);D(this,"_activePopup");D(this,"_activePopup$",new H.BehaviorSubject(null));D(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:i,col:o,unitId:a,subUnitId:d}=r;if(this._activePopup&&i===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._canvasPopupManagerService.attachPopupToCell(i,o,{componentKey:ie,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 m=new s.DisposableCollection;m.add(u),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=le([oe(0,s.Inject(b.SheetCanvasPopManagerService)),oe(1,v.IZenZoneService)],c.SheetsThreadCommentPopupService);const V={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(n){var I;const t=n.get(p.SheetsSelectionsService),r=n.get(s.IUniverInstanceService),e=n.get(c.SheetsThreadCommentPopupService),i=n.get(g.ThreadCommentPanelService),o=(I=t.getCurrentLastSelection())==null?void 0:I.primary,a=n.get(N.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(r);if(!d)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=d,S={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(S);const _=a.getByLocation(l,h,o.startRow,o.startColumn);return _&&i.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},pe="sheets-thread-comment.config",se={};var ve=Object.getOwnPropertyDescriptor,Se=(n,t,r,e)=>{for(var i=e>1?void 0:e?ve(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},L=(n,t)=>(r,e)=>t(r,e,n);let W=class extends s.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(n,t,r)=>{const{row:e,col:i,unitId:o,subUnitId:a}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,a,e,i)?r({...n,markers:{...n==null?void 0:n.markers,tr:{color:"#FFBD37",size:6}}}):r(n)},priority:100}))}_initSkeletonChange(){const n=()=>{var i;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(i=e==null?void 0:e.mainComponent)==null||i.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(H.debounceTime(16)).subscribe(()=>{n()}))}};W=Se([L(0,s.Inject(p.SheetInterceptorService)),L(1,s.Inject(N.SheetsThreadCommentModel)),L(2,s.IUniverInstanceService),L(3,ne.IRenderManagerService)],W);var Ce=Object.getOwnPropertyDescriptor,_e=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ce(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},Q=(n,t)=>(r,e)=>t(r,e,n);const fe=(n,t,r)=>{const e=A.singleReferenceToGrid(n),i=r.row-t.row,o=r.column-t.column,a={startColumn:e.column+o,startRow:e.row+i,endColumn:e.column+o,endRow:e.row+i};return A.serializeRange(a)};let x=class extends s.Disposable{constructor(t,r,e){super();D(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:J,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,i)=>{const{unitId:o,subUnitId:a,range:d}=r,u={row:d.rows[0],column:d.cols[0]};if(i.copyType===b.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,S={row:m.startRow,column:m.startColumn};if(!(o===l&&a===h)){const _=[];s.Range.foreach(m,(w,C)=>{const E=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,C);this._threadCommentDataSourceService.syncUpdateMutationToColla?E.forEach(P=>{_.push(P)}):E.forEach(({children:P,...j})=>{j.parentId||_.push(j)})});const I=[],M=[],$=[],B=[],te=w=>{I.unshift({id:f.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),$.push({id:f.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:fe(w.ref,S,u),unitId:o,subUnitId:a},sync:!0}}),M.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 _.forEach(w=>{te(w)}),{redos:[...I,...$],undos:[...B,...M]}}}return{redos:[],undos:[]}}}))}};x=_e([Q(0,s.Inject(b.ISheetClipboardService)),Q(1,s.Inject(N.SheetsThreadCommentModel)),Q(2,f.IThreadCommentDataSourceService)],x);var Ie=Object.getOwnPropertyDescriptor,ge=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ie(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},F=(n,t)=>(r,e)=>t(r,e,n);let q=class extends s.Disposable{constructor(n,t,r,e){super(),this._hoverManagerService=n,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(H.debounceTime(100)).subscribe(n=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(n&&(t&&t.temp||!t)){const{location:r}=n,{unitId:e,subUnitId:i,row:o,col:a}=r,d=this._sheetsThreadCommentModel.getByLocation(e,i,o,a);if(d){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,i,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:i,row:o,col:a,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=ge([F(0,s.Inject(b.HoverManagerService)),F(1,s.Inject(c.SheetsThreadCommentPopupService)),F(2,s.Inject(N.SheetsThreadCommentModel)),F(3,s.Inject(p.SheetPermissionCheckController))],q);var Pe=Object.getOwnPropertyDescriptor,Te=(n,t,r,e)=>{for(var i=e>1?void 0:e?Pe(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},O=(n,t)=>(r,e)=>t(r,e,n);let G=class extends s.Disposable{constructor(t,r,e,i,o,a,d,u,m,l){super();D(this,"_isSwitchToCommenting",!1);D(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=i,this._univerInstanceService=o,this._sheetPermissionCheckController=a,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var S,_,I;const i=(S=t[0])==null?void 0:S.range,o=this._renderManagerService.getRenderById(r),a=(_=o==null?void 0:o.with(b.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:_.skeleton;if(!a||!i)return;const d=a.getCellWithCoordByIndex(i.startRow,i.startColumn);if((((I=i.rangeType)!=null?I:s.RANGE_TYPE.NORMAL)!==s.RANGE_TYPE.NORMAL||i.endColumn-i.startColumn>0||i.endRow-i.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&s.Rectangle.equals(d.mergeInfo,i))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(g.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.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 r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:i,subUnitId:o,commentId:a}=e;r.unitId===i&&r.subUnitId===o&&r.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:i,commentId:o,trigger:a}=t,d=this._sheetsThreadCommentModel.getComment(e,i,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==i&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:i}),this._isSwitchToCommenting=!1;const h=A.singleReferenceToGrid(d.ref),{row:S,column:_}=h;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:S,startColumn:_,endRow:S,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(b.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:i,row:h.row,col:h.column,commentId:d.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(H.debounceTime(100)).subscribe(t=>{var S,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:i}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,i);if(!o)return;const a=A.singleReferenceToGrid(o.ref),{row:d,column:u}=a;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(S=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(d,u))!=null?_:{startColumn:u,endColumn:u,startRow:d,endRow:d},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=Te([O(0,s.ICommandService),O(1,s.Inject(c.SheetsThreadCommentPopupService)),O(2,s.Inject(N.SheetsThreadCommentModel)),O(3,s.Inject(g.ThreadCommentPanelService)),O(4,s.IUniverInstanceService),O(5,s.Inject(p.SheetPermissionCheckController)),O(6,b.IMarkSelectionService),O(7,s.Inject(p.SheetsSelectionsService)),O(8,b.IEditorBridgeService),O(9,ne.IRenderManagerService)],G);var be=Object.getOwnPropertyDescriptor,ye=(n,t,r,e)=>{for(var i=e>1?void 0:e?be(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},Z=(n,t)=>(r,e)=>t(r,e,n);let z=class extends s.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{var t;if(n.id===p.RemoveSheetCommand.id){const r=n.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const i=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const a=this._threadCommentModel.ensureMap(i,o),d=Array.from(a.values()).filter(S=>!S.parentId),u=d.map(S=>S.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(S=>({id:f.DeleteCommentMutation.id,params:{unitId:i,subUnitId:o,commentId:S}})),h=d.map(({children:S,..._})=>({id:f.AddCommentMutation.id,params:{unitId:i,subUnitId:o,comment:{..._,children:m?S:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};z=ye([Z(0,s.Inject(p.SheetInterceptorService)),Z(1,s.IUniverInstanceService),Z(2,s.Inject(f.ThreadCommentModel)),Z(3,f.IThreadCommentDataSourceService)],z);var y=function(){return y=Object.assign||function(n){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},y.apply(this,arguments)},Me=function(n,t){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.indexOf(e)<0&&(r[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,e=Object.getOwnPropertySymbols(n);i<e.length;i++)t.indexOf(e[i])<0&&Object.prototype.propertyIsEnumerable.call(n,e[i])&&(r[e[i]]=n[e[i]]);return r},ae=R.forwardRef(function(n,t){var r=n.icon,e=n.id,i=n.className,o=n.extend,a=Me(n,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(i||"").trim(),u=R.useRef("_".concat(Ue()));return ce(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:d},a),o)});function ce(n,t,r,e,i){return R.createElement(n.tag,y(y({key:t},we(n,r,i)),e),(Ee(n,r).children||[]).map(function(o,a){return ce(o,"".concat(t,"-").concat(n.tag,"-").concat(a),r,void 0,i)}))}function we(n,t,r){var e=y({},n.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1);var i=t.defIds;return!i||i.length===0||(n.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],d=o[1];typeof d=="string"&&(e[a]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function Ee(n,t){var r,e=t.defIds;return!e||e.length===0?n:n.tag==="defs"&&(!((r=n.children)===null||r===void 0)&&r.length)?y(y({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&e&&e.indexOf(i.attrs.id)>-1?y(y({},i),{attrs:y(y({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):n}function Ue(){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"}}]},de=R.forwardRef(function(n,t){return R.createElement(ae,Object.assign({},n,{id:"comment-single",ref:t,icon:Re}))});de.displayName="CommentSingle";const Oe=()=>{const n=v.useDependency(s.IUniverInstanceService),t=v.useDependency(c.SheetsThreadCommentPopupService),r=v.useObservable(t.activePopup$),e=v.useDependency(N.SheetsThreadCommentModel);if(v.useObservable(e.commentUpdate$),!r)return null;const{row:i,col:o,unitId:a,subUnitId:d,trigger:u}=r,m=e.getByLocation(a,d,i,o),l=`${s.Tools.chatAtABC(o)}${i+1}`,h=()=>{t.hidePopup()},S=_=>{var I,M,$;return($=(M=(I=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getSheetBySheetId(_))==null?void 0:M.getName())!=null?$:""};return re.jsx(g.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:a,subUnitId:d,type:s.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:S,autoFocus:u==="context-menu"})},je=()=>{var w;const n=v.useDependency(b.IMarkSelectionService),t=v.useDependency(s.IUniverInstanceService),r=v.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),i=e.getUnitId(),o=v.useDependency(s.ICommandService),a=R.useMemo(()=>e.activeSheet$.pipe(H.map(C=>C==null?void 0:C.getSheetId())),[e.activeSheet$]),d=v.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=R.useRef(null),m=v.useDependency(g.ThreadCommentPanelService),l=v.useObservable(m.activeCommentId$),h=v.useObservable(m.panelVisible$,m.panelVisible),S=R.useCallback(C=>{const E=e.getSheets(),P={};E.forEach((U,T)=>{P[U.getSheetId()]=T});const j=U=>U.map(T=>{var me;const k=A.singleReferenceToGrid(T.ref),xe=[(me=P[T.subUnitId])!=null?me:0,k.row,k.column];return{...T,p:xe}}).sort((T,k)=>T.p[0]===k.p[0]?T.p[1]===k.p[1]?T.p[2]-k.p[2]:T.p[1]-k.p[1]:T.p[0]-k.p[0]);return[...j(C.filter(U=>!U.resolved)),...j(C.filter(U=>U.resolved))]},[e]),_=R.useCallback(C=>{var E;if(C.unitId===i&&C.subUnitId===d&&!C.resolved){const{row:P,column:j}=A.singleReferenceToGrid(C.ref),U=e.getSheetBySheetId(C.subUnitId),T=(E=U==null?void 0:U.getMergedCell(P,j))!=null?E:{startColumn:j,endColumn:j,startRow:P,endRow:P};if(!Number.isNaN(P)&&!Number.isNaN(j))return n.addShape({range:T,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[n,d,i]),I=C=>{var E,P;return(P=(E=e.getSheetBySheetId(C))==null?void 0:E.getName())!=null?P:""},M=()=>{o.executeCommand(V.id)},$=C=>{l&&l.unitId===C.unitId&&l.subUnitId===C.subUnitId&&l.commentId===C.id||(u.current&&(n.removeShape(u.current),u.current=null),u.current=_(C))},B=()=>{u.current&&(n.removeShape(u.current),u.current=null)},te=(C,E)=>{E&&r.hidePopup()};return R.useEffect(()=>{!h&&u.current&&n.removeShape(u.current)},[n,h]),re.jsx(g.ThreadCommentPanel,{unitId:i,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:I,onResolve:te,sortComments:S,onItemEnter:$,onItemLeave:B,onDeleteComment:()=>(B(),!0)})},ke=n=>({id:V.id,type:v.MenuItemType.BUTTON,icon:Y,title:"sheetThreadComment.menu.addComment",hidden$:v.getMenuHiddenObservable(n,s.UniverInstanceType.UNIVER_SHEET),disabled$:b.getCurrentRangeDisable$(n,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),De=n=>({id:g.ToggleSheetCommentPanelOperation.id,type:v.MenuItemType.BUTTON,icon:Y,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:b.getCurrentRangeDisable$(n,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:v.getMenuHiddenObservable(n,s.UniverInstanceType.UNIVER_SHEET)}),Ne={id:V.id,binding:v.KeyCode.M|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.ALT,preconditions:b.whenSheetEditorFocused},$e={[v.RibbonStartGroup.OTHERS]:{[g.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:De}},[v.ContextMenuPosition.MAIN_AREA]:{[v.ContextMenuGroup.OTHERS]:{[V.id]:{order:0,menuItemFactory:ke}}}};var Ae=Object.getOwnPropertyDescriptor,Ve=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ae(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},X=(n,t)=>(r,e)=>t(r,e,n);let K=class extends s.Disposable{constructor(n,t,r){super(),this._menuManagerService=n,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Ne)}_initMenu(){this._menuManagerService.mergeMenu($e)}_initComponent(){[[ie,Oe],[g.THREAD_COMMENT_PANEL,je],[Y,de]].forEach(([n,t])=>{this._componentManager.register(n,t)})}};K=Ve([X(0,v.IMenuManagerService),X(1,s.Inject(v.ComponentManager)),X(2,v.IShortcutService)],K);var He=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Le=(n,t,r)=>t in n?He(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,We=(n,t,r,e)=>{for(var i=e>1?void 0:e?Be(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},ee=(n,t)=>(r,e)=>t(r,e,n),ue=(n,t,r)=>Le(n,typeof t!="symbol"?t+"":t,r);c.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=se,r,e,i){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=i;const{menu:o,...a}=s.merge({},se,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(pe,a)}onStarting(){[[K],[W],[x],[q],[z],[G],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[V].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)}},ue(c.UniverSheetsThreadCommentUIPlugin,"pluginName",J),ue(c.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=We([s.DependentOn(g.UniverThreadCommentUIPlugin,N.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=V,Object.defineProperty(c,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,N,g,b,v,H,ne,A,f,re,O){"use strict";var Fe=Object.defineProperty;var qe=(c,s,p)=>s in c?Fe(c,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[s]=p;var D=(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 he=Object.getOwnPropertyDescriptor,le=(n,t,r,e)=>{for(var i=e>1?void 0:e?he(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},oe=(n,t)=>(r,e)=>t(r,e,n);c.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(r,e){super();D(this,"_lastPopup",null);D(this,"_activePopup");D(this,"_activePopup$",new H.BehaviorSubject(null));D(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:i,col:o,unitId:a,subUnitId:d}=r;if(this._activePopup&&i===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._canvasPopupManagerService.attachPopupToCell(i,o,{componentKey:ie,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 m=new s.DisposableCollection;m.add(u),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=le([oe(0,s.Inject(b.SheetCanvasPopManagerService)),oe(1,v.IZenZoneService)],c.SheetsThreadCommentPopupService);const V={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(n){var I;const t=n.get(p.SheetsSelectionsService),r=n.get(s.IUniverInstanceService),e=n.get(c.SheetsThreadCommentPopupService),i=n.get(g.ThreadCommentPanelService),o=(I=t.getCurrentLastSelection())==null?void 0:I.primary,a=n.get(N.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(r);if(!d)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=d,S={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(S);const _=a.getByLocation(l,h,o.startRow,o.startColumn);return _&&i.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},pe="sheets-thread-comment.config",se={};var ve=Object.getOwnPropertyDescriptor,Se=(n,t,r,e)=>{for(var i=e>1?void 0:e?ve(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},L=(n,t)=>(r,e)=>t(r,e,n);let W=class extends s.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(n,t,r)=>{const{row:e,col:i,unitId:o,subUnitId:a}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,a,e,i)?r({...n,markers:{...n==null?void 0:n.markers,tr:{color:"#FFBD37",size:6}}}):r(n)},priority:100}))}_initSkeletonChange(){const n=()=>{var i;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(i=e==null?void 0:e.mainComponent)==null||i.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(H.debounceTime(16)).subscribe(()=>{n()}))}};W=Se([L(0,s.Inject(p.SheetInterceptorService)),L(1,s.Inject(N.SheetsThreadCommentModel)),L(2,s.IUniverInstanceService),L(3,ne.IRenderManagerService)],W);var Ce=Object.getOwnPropertyDescriptor,_e=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ce(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},Q=(n,t)=>(r,e)=>t(r,e,n);const fe=(n,t,r)=>{const e=A.singleReferenceToGrid(n),i=r.row-t.row,o=r.column-t.column,a={startColumn:e.column+o,startRow:e.row+i,endColumn:e.column+o,endRow:e.row+i};return A.serializeRange(a)};let x=class extends s.Disposable{constructor(t,r,e){super();D(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:J,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,i)=>{const{unitId:o,subUnitId:a,range:d}=r,u={row:d.rows[0],column:d.cols[0]};if(i.copyType===b.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,S={row:m.startRow,column:m.startColumn};if(!(o===l&&a===h)){const _=[];s.Range.foreach(m,(w,C)=>{const E=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,C);this._threadCommentDataSourceService.syncUpdateMutationToColla?E.forEach(P=>{_.push(P)}):E.forEach(({children:P,...j})=>{j.parentId||_.push(j)})});const I=[],M=[],$=[],B=[],te=w=>{I.unshift({id:f.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),$.push({id:f.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:fe(w.ref,S,u),unitId:o,subUnitId:a},sync:!0}}),M.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 _.forEach(w=>{te(w)}),{redos:[...I,...$],undos:[...B,...M]}}}return{redos:[],undos:[]}}}))}};x=_e([Q(0,s.Inject(b.ISheetClipboardService)),Q(1,s.Inject(N.SheetsThreadCommentModel)),Q(2,f.IThreadCommentDataSourceService)],x);var Ie=Object.getOwnPropertyDescriptor,ge=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ie(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},F=(n,t)=>(r,e)=>t(r,e,n);let q=class extends s.Disposable{constructor(n,t,r,e){super(),this._hoverManagerService=n,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(H.debounceTime(100)).subscribe(n=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(n&&(t&&t.temp||!t)){const{location:r}=n,{unitId:e,subUnitId:i,row:o,col:a}=r,d=this._sheetsThreadCommentModel.getByLocation(e,i,o,a);if(d){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,i,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:i,row:o,col:a,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=ge([F(0,s.Inject(b.HoverManagerService)),F(1,s.Inject(c.SheetsThreadCommentPopupService)),F(2,s.Inject(N.SheetsThreadCommentModel)),F(3,s.Inject(p.SheetPermissionCheckController))],q);var Pe=Object.getOwnPropertyDescriptor,Te=(n,t,r,e)=>{for(var i=e>1?void 0:e?Pe(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},R=(n,t)=>(r,e)=>t(r,e,n);let G=class extends s.Disposable{constructor(t,r,e,i,o,a,d,u,m,l){super();D(this,"_isSwitchToCommenting",!1);D(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=i,this._univerInstanceService=o,this._sheetPermissionCheckController=a,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var S,_,I;const i=(S=t[0])==null?void 0:S.range,o=this._renderManagerService.getRenderById(r),a=(_=o==null?void 0:o.with(b.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:_.skeleton;if(!a||!i)return;const d=a.getCellWithCoordByIndex(i.startRow,i.startColumn);if((((I=i.rangeType)!=null?I:s.RANGE_TYPE.NORMAL)!==s.RANGE_TYPE.NORMAL||i.endColumn-i.startColumn>0||i.endRow-i.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&s.Rectangle.equals(d.mergeInfo,i))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(g.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.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 r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:i,subUnitId:o,commentId:a}=e;r.unitId===i&&r.subUnitId===o&&r.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:i,commentId:o,trigger:a}=t,d=this._sheetsThreadCommentModel.getComment(e,i,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==i&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:i}),this._isSwitchToCommenting=!1;const h=A.singleReferenceToGrid(d.ref),{row:S,column:_}=h;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:S,startColumn:_,endRow:S,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(b.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:i,row:h.row,col:h.column,commentId:d.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(H.debounceTime(100)).subscribe(t=>{var S,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:i}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,i);if(!o)return;const a=A.singleReferenceToGrid(o.ref),{row:d,column:u}=a;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(S=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(d,u))!=null?_:{startColumn:u,endColumn:u,startRow:d,endRow:d},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=Te([R(0,s.ICommandService),R(1,s.Inject(c.SheetsThreadCommentPopupService)),R(2,s.Inject(N.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 be=Object.getOwnPropertyDescriptor,ye=(n,t,r,e)=>{for(var i=e>1?void 0:e?be(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},Z=(n,t)=>(r,e)=>t(r,e,n);let z=class extends s.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{var t;if(n.id===p.RemoveSheetCommand.id){const r=n.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const i=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const a=this._threadCommentModel.ensureMap(i,o),d=Array.from(a.values()).filter(S=>!S.parentId),u=d.map(S=>S.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(S=>({id:f.DeleteCommentMutation.id,params:{unitId:i,subUnitId:o,commentId:S}})),h=d.map(({children:S,..._})=>({id:f.AddCommentMutation.id,params:{unitId:i,subUnitId:o,comment:{..._,children:m?S:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};z=ye([Z(0,s.Inject(p.SheetInterceptorService)),Z(1,s.IUniverInstanceService),Z(2,s.Inject(f.ThreadCommentModel)),Z(3,f.IThreadCommentDataSourceService)],z);var y=function(){return y=Object.assign||function(n){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},y.apply(this,arguments)},Me=function(n,t){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.indexOf(e)<0&&(r[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,e=Object.getOwnPropertySymbols(n);i<e.length;i++)t.indexOf(e[i])<0&&Object.prototype.propertyIsEnumerable.call(n,e[i])&&(r[e[i]]=n[e[i]]);return r},ae=O.forwardRef(function(n,t){var r=n.icon,e=n.id,i=n.className,o=n.extend,a=Me(n,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(i||"").trim(),u=O.useRef("_".concat(Ue()));return ce(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:d},a),o)});function ce(n,t,r,e,i){return O.createElement(n.tag,y(y({key:t},we(n,r,i)),e),(Ee(n,r).children||[]).map(function(o,a){return ce(o,"".concat(t,"-").concat(n.tag,"-").concat(a),r,void 0,i)}))}function we(n,t,r){var e=y({},n.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1),n.tag==="mask"&&e.id&&(e.id=e.id+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],d=o[1];a==="mask"&&typeof d=="string"&&(e[a]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var i=t.defIds;return!i||i.length===0||(n.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],d=o[1];typeof d=="string"&&(e[a]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function Ee(n,t){var r,e=t.defIds;return!e||e.length===0?n:n.tag==="defs"&&(!((r=n.children)===null||r===void 0)&&r.length)?y(y({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&e&&e.indexOf(i.attrs.id)>-1?y(y({},i),{attrs:y(y({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):n}function Ue(){return Math.random().toString(36).substring(2,8)}ae.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"}}]},de=O.forwardRef(function(n,t){return O.createElement(ae,Object.assign({},n,{id:"comment-single",ref:t,icon:Oe}))});de.displayName="CommentSingle";const Re=()=>{const n=v.useDependency(s.IUniverInstanceService),t=v.useDependency(c.SheetsThreadCommentPopupService),r=v.useObservable(t.activePopup$),e=v.useDependency(N.SheetsThreadCommentModel);if(v.useObservable(e.commentUpdate$),!r)return null;const{row:i,col:o,unitId:a,subUnitId:d,trigger:u}=r,m=e.getByLocation(a,d,i,o),l=`${s.Tools.chatAtABC(o)}${i+1}`,h=()=>{t.hidePopup()},S=_=>{var I,M,$;return($=(M=(I=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getSheetBySheetId(_))==null?void 0:M.getName())!=null?$:""};return re.jsx(g.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:a,subUnitId:d,type:s.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:S,autoFocus:u==="context-menu"})},je=()=>{var w;const n=v.useDependency(b.IMarkSelectionService),t=v.useDependency(s.IUniverInstanceService),r=v.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),i=e.getUnitId(),o=v.useDependency(s.ICommandService),a=O.useMemo(()=>e.activeSheet$.pipe(H.map(C=>C==null?void 0:C.getSheetId())),[e.activeSheet$]),d=v.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=O.useRef(null),m=v.useDependency(g.ThreadCommentPanelService),l=v.useObservable(m.activeCommentId$),h=v.useObservable(m.panelVisible$,m.panelVisible),S=O.useCallback(C=>{const E=e.getSheets(),P={};E.forEach((U,T)=>{P[U.getSheetId()]=T});const j=U=>U.map(T=>{var me;const k=A.singleReferenceToGrid(T.ref),xe=[(me=P[T.subUnitId])!=null?me:0,k.row,k.column];return{...T,p:xe}}).sort((T,k)=>T.p[0]===k.p[0]?T.p[1]===k.p[1]?T.p[2]-k.p[2]:T.p[1]-k.p[1]:T.p[0]-k.p[0]);return[...j(C.filter(U=>!U.resolved)),...j(C.filter(U=>U.resolved))]},[e]),_=O.useCallback(C=>{var E;if(C.unitId===i&&C.subUnitId===d&&!C.resolved){const{row:P,column:j}=A.singleReferenceToGrid(C.ref),U=e.getSheetBySheetId(C.subUnitId),T=(E=U==null?void 0:U.getMergedCell(P,j))!=null?E:{startColumn:j,endColumn:j,startRow:P,endRow:P};if(!Number.isNaN(P)&&!Number.isNaN(j))return n.addShape({range:T,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[n,d,i]),I=C=>{var E,P;return(P=(E=e.getSheetBySheetId(C))==null?void 0:E.getName())!=null?P:""},M=()=>{o.executeCommand(V.id)},$=C=>{l&&l.unitId===C.unitId&&l.subUnitId===C.subUnitId&&l.commentId===C.id||(u.current&&(n.removeShape(u.current),u.current=null),u.current=_(C))},B=()=>{u.current&&(n.removeShape(u.current),u.current=null)},te=(C,E)=>{E&&r.hidePopup()};return O.useEffect(()=>{!h&&u.current&&n.removeShape(u.current)},[n,h]),re.jsx(g.ThreadCommentPanel,{unitId:i,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:I,onResolve:te,sortComments:S,onItemEnter:$,onItemLeave:B,onDeleteComment:()=>(B(),!0)})},ke=n=>({id:V.id,type:v.MenuItemType.BUTTON,icon:Y,title:"sheetThreadComment.menu.addComment",hidden$:v.getMenuHiddenObservable(n,s.UniverInstanceType.UNIVER_SHEET),disabled$:b.getCurrentRangeDisable$(n,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),De=n=>({id:g.ToggleSheetCommentPanelOperation.id,type:v.MenuItemType.BUTTON,icon:Y,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:b.getCurrentRangeDisable$(n,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:v.getMenuHiddenObservable(n,s.UniverInstanceType.UNIVER_SHEET)}),Ne={id:V.id,binding:v.KeyCode.M|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.ALT,preconditions:b.whenSheetEditorFocused},$e={[v.RibbonStartGroup.OTHERS]:{[g.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:De}},[v.ContextMenuPosition.MAIN_AREA]:{[v.ContextMenuGroup.OTHERS]:{[V.id]:{order:0,menuItemFactory:ke}}}};var Ae=Object.getOwnPropertyDescriptor,Ve=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ae(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},X=(n,t)=>(r,e)=>t(r,e,n);let K=class extends s.Disposable{constructor(n,t,r){super(),this._menuManagerService=n,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Ne)}_initMenu(){this._menuManagerService.mergeMenu($e)}_initComponent(){[[ie,Re],[g.THREAD_COMMENT_PANEL,je],[Y,de]].forEach(([n,t])=>{this._componentManager.register(n,t)})}};K=Ve([X(0,v.IMenuManagerService),X(1,s.Inject(v.ComponentManager)),X(2,v.IShortcutService)],K);var He=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Le=(n,t,r)=>t in n?He(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,We=(n,t,r,e)=>{for(var i=e>1?void 0:e?Be(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},ee=(n,t)=>(r,e)=>t(r,e,n),ue=(n,t,r)=>Le(n,typeof t!="symbol"?t+"":t,r);c.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=se,r,e,i){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=i;const{menu:o,...a}=s.merge({},se,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(pe,a)}onStarting(){[[K],[W],[x],[q],[z],[G],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[V].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)}},ue(c.UniverSheetsThreadCommentUIPlugin,"pluginName",J),ue(c.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=We([s.DependentOn(g.UniverThreadCommentUIPlugin,N.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=V,Object.defineProperty(c,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.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer thread comment plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -52,27 +52,27 @@
|
|
|
52
52
|
"rxjs": ">=7.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@univerjs/icons": "^0.2.
|
|
55
|
+
"@univerjs/icons": "^0.2.20",
|
|
56
56
|
"clsx": "^2.1.1",
|
|
57
|
-
"@univerjs/core": "0.6.
|
|
58
|
-
"@univerjs/engine-
|
|
59
|
-
"@univerjs/sheets-thread-comment": "0.6.
|
|
60
|
-
"@univerjs/
|
|
61
|
-
"@univerjs/
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/
|
|
64
|
-
"@univerjs/thread-comment-ui": "0.6.
|
|
65
|
-
"@univerjs/ui": "0.6.
|
|
57
|
+
"@univerjs/core": "0.6.1",
|
|
58
|
+
"@univerjs/engine-formula": "0.6.1",
|
|
59
|
+
"@univerjs/sheets-thread-comment": "0.6.1",
|
|
60
|
+
"@univerjs/engine-render": "0.6.1",
|
|
61
|
+
"@univerjs/sheets": "0.6.1",
|
|
62
|
+
"@univerjs/thread-comment": "0.6.1",
|
|
63
|
+
"@univerjs/sheets-ui": "0.6.1",
|
|
64
|
+
"@univerjs/thread-comment-ui": "0.6.1",
|
|
65
|
+
"@univerjs/ui": "0.6.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"postcss": "^8.5.
|
|
68
|
+
"postcss": "^8.5.3",
|
|
69
69
|
"react": "18.3.1",
|
|
70
70
|
"rxjs": "^7.8.1",
|
|
71
71
|
"tailwindcss": "^3.4.17",
|
|
72
72
|
"typescript": "^5.7.3",
|
|
73
|
-
"vite": "^6.1.
|
|
74
|
-
"vitest": "^3.0.
|
|
75
|
-
"@univerjs-infra/shared": "0.6.
|
|
73
|
+
"vite": "^6.1.1",
|
|
74
|
+
"vitest": "^3.0.6",
|
|
75
|
+
"@univerjs-infra/shared": "0.6.1"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"test": "vitest run",
|