@univerjs/sheets-thread-comment-ui 0.6.0-nightly.202502101606 → 0.6.0-nightly.202502121606
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 +2 -2
- package/lib/types/index.d.ts +1 -1
- package/lib/types/locale/en-US.d.ts +1 -1
- package/lib/types/locale/fa-IR.d.ts +1 -1
- package/lib/types/locale/fr-FR.d.ts +1 -1
- package/lib/types/locale/ru-RU.d.ts +1 -1
- package/lib/types/locale/vi-VN.d.ts +1 -1
- package/lib/types/locale/zh-CN.d.ts +1 -1
- package/lib/types/locale/zh-TW.d.ts +1 -1
- package/lib/types/types/const.d.ts +1 -1
- package/lib/types/views/sheets-thread-comment-cell/index.d.ts +1 -1
- package/lib/types/views/sheets-thread-comment-panel/index.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var le=Object.defineProperty;var pe=(o,t,n)=>t in o?le(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n;var j=(o,t,n)=>pe(o,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),v=require("@univerjs/sheets"),$=require("@univerjs/sheets-thread-comment"),P=require("@univerjs/thread-comment-ui"),w=require("@univerjs/sheets-ui"),S=require("@univerjs/ui"),k=require("rxjs"),oe=require("@univerjs/engine-render"),A=require("@univerjs/engine-formula"),_=require("@univerjs/thread-comment"),ie=require("react/jsx-runtime"),R=require("react"),se="univer.sheet.thread-comment-modal",X="comment-single",ee="SHEET_THREAD_COMMENT";var ve=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,Se=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ce(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&ve(t,n,r),r},ne=(o,t)=>(n,e)=>t(n,e,o);exports.SheetsThreadCommentPopupService=class extends c.Disposable{constructor(n,e){super();j(this,"_lastPopup",null);j(this,"_activePopup");j(this,"_activePopup$",new k.BehaviorSubject(null));j(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var h;const{row:r,col:i,unitId:s,subUnitId:a}=n;if(this._activePopup&&r===this._activePopup.row&&i===this._activePopup.col&&s===this._activePopup.unitId&&a===((h=this.activePopup)==null?void 0:h.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const m=this._canvasPopupManagerService.attachPopupToCell(r,i,{componentKey: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 c.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=Se([ne(0,c.Inject(w.SheetCanvasPopManagerService)),ne(1,S.IZenZoneService)],exports.SheetsThreadCommentPopupService);const x={type:c.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(o){var f;const t=o.get(v.SheetsSelectionsService),n=o.get(c.IUniverInstanceService),e=o.get(exports.SheetsThreadCommentPopupService),r=o.get(P.ThreadCommentPanelService),i=(f=t.getCurrentLastSelection())==null?void 0:f.primary,s=o.get($.SheetsThreadCommentModel);if(!i)return!1;const a=v.getSheetCommandTarget(n);if(!a)return!1;const{workbook:m,worksheet:d,unitId:h,subUnitId:u}=a,l={workbook:m,worksheet:d,unitId:h,subUnitId:u,row:i.startRow,col:i.startColumn};e.showPopup(l);const C=s.getByLocation(h,u,i.startRow,i.startColumn);return C&&r.setActiveComment({unitId:h,subUnitId:u,commentId:C,trigger:"context-menu"}),!0}},_e="sheets-thread-comment.config",re={};var fe=Object.defineProperty,Ie=Object.getOwnPropertyDescriptor,ge=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ie(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&fe(t,n,r),r},H=(o,t)=>(n,e)=>t(n,e,o);let W=class extends c.Disposable{constructor(o,t,n,e){super(),this._sheetInterceptorService=o,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(v.INTERCEPTOR_POINT.CELL_CONTENT,{effect:c.InterceptorEffectEnum.Style,handler:(o,t,n)=>{const{row:e,col:r,unitId:i,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(i,s,e,r)?n({...o,markers:{...o==null?void 0:o.markers,tr:{color:"#FFBD37",size:6}}}):n(o)},priority:100}))}_initSkeletonChange(){const o=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{o()}))}};W=ge([H(0,c.Inject(v.SheetInterceptorService)),H(1,c.Inject($.SheetsThreadCommentModel)),H(2,c.IUniverInstanceService),H(3,oe.IRenderManagerService)],W);var Pe=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,be=(o,t,n,e)=>{for(var r=e>1?void 0:e?Te(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Pe(t,n,r),r},Y=(o,t)=>(n,e)=>t(n,e,o);const Me=(o,t,n)=>{const e=A.singleReferenceToGrid(o),r=n.row-t.row,i=n.column-t.column,s={startColumn:e.column+i,startRow:e.row+r,endColumn:e.column+i,endRow:e.row+r};return A.serializeRange(s)};let F=class extends c.Disposable{constructor(t,n,e){super();j(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:ee,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:i,subUnitId:s,range:a}=n,m={row:a.rows[0],column:a.cols[0]};if(r.copyType===w.COPY_TYPE.CUT&&this._copyInfo){const{range:d,unitId:h,subUnitId:u}=this._copyInfo,l={row:d.startRow,column:d.startColumn};if(!(i===h&&s===u)){const C=[];c.Range.foreach(d,(b,p)=>{const M=this._sheetsThreadCommentModel.getAllByLocation(h,u,b,p);this._threadCommentDataSourceService.syncUpdateMutationToColla?M.forEach(I=>{C.push(I)}):M.forEach(({children:I,...O})=>{O.parentId||C.push(O)})});const f=[],T=[],N=[],V=[],K=b=>{f.unshift({id:_.DeleteCommentMutation.id,params:{unitId:h,subUnitId:u,commentId:b.id}}),N.push({id:_.AddCommentMutation.id,params:{unitId:i,subUnitId:s,comment:{...b,ref:Me(b.ref,l,m),unitId:i,subUnitId:s},sync:!0}}),T.push({id:_.AddCommentMutation.id,params:{unitId:h,subUnitId:u,comment:b,sync:!0}}),V.unshift({id:_.DeleteCommentMutation.id,params:{unitId:i,subUnitId:s,commentId:b.id}})};return C.forEach(b=>{K(b)}),{redos:[...f,...N],undos:[...V,...T]}}}return{redos:[],undos:[]}}}))}};F=be([Y(0,c.Inject(w.ISheetClipboardService)),Y(1,c.Inject($.SheetsThreadCommentModel)),Y(2,_.IThreadCommentDataSourceService)],F);var ye=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Ue=(o,t,n,e)=>{for(var r=e>1?void 0:e?we(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&ye(t,n,r),r},B=(o,t)=>(n,e)=>t(n,e,o);let q=class extends c.Disposable{constructor(o,t,n,e){super(),this._hoverManagerService=o,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(o=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(o&&(t&&t.temp||!t)){const{location:n}=o,{unitId:e,subUnitId:r,row:i,col:s}=n,a=this._sheetsThreadCommentModel.getByLocation(e,r,i,s);if(a){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:i,startColumn:s,endRow:i,endColumn:s}]))return;const d=this._sheetsThreadCommentModel.getComment(e,r,a);d&&!d.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:i,col:s,commentId:a,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=Ue([B(0,c.Inject(w.HoverManagerService)),B(1,c.Inject(exports.SheetsThreadCommentPopupService)),B(2,c.Inject($.SheetsThreadCommentModel)),B(3,c.Inject(v.SheetPermissionCheckController))],q);var Oe=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Re=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Oe(t,n,r),r},E=(o,t)=>(n,e)=>t(n,e,o);let G=class extends c.Disposable{constructor(t,n,e,r,i,s,a,m,d,h){super();j(this,"_isSwitchToCommenting",!1);j(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=i,this._sheetPermissionCheckController=s,this._markSelectionService=a,this._sheetSelectionService=m,this._editorBridgeService=d,this._renderManagerService=h,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var l,C,f;const r=(l=t[0])==null?void 0:l.range,i=this._renderManagerService.getRenderById(n),s=(C=i==null?void 0:i.with(w.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:C.skeleton;if(!s||!r)return;const a=s.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((f=r.rangeType)!=null?f:c.RANGE_TYPE.NORMAL)!==c.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((a.isMerged||a.isMergedMainCell)&&c.Rectangle.equals(a.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const d=a.actualRow,h=a.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,d,h)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const u=this._sheetsThreadCommentModel.getByLocation(n,e,d,h);u&&this._commandService.executeCommand(P.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:u})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===_.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:i,commentId:s}=e;n.unitId===r&&n.subUnitId===i&&n.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:i,trigger:s}=t,a=this._sheetsThreadCommentModel.getComment(e,r,i);if(!a||a.resolved)return;const m=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(!m||m.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=m.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(v.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const u=A.singleReferenceToGrid(a.ref),{row:l,column:C}=u;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:l,startColumn:C,endRow:l,endColumn:C}]))return;const T=1;if(await this._commandService.executeCommand(w.ScrollToRangeOperation.id,{range:{startRow:Math.max(u.row-T,0),endRow:u.row+T,startColumn:Math.max(u.column-T,0),endColumn:u.column+T}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:u.row,col:u.column,commentId:a.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var l,C;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const i=this._sheetsThreadCommentModel.getComment(n,e,r);if(!i)return;const s=A.singleReferenceToGrid(i.ref),{row:a,column:m}=s;if(Number.isNaN(a)||Number.isNaN(m))return null;const d=(l=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET))==null?void 0:l.getSheetBySheetId(e),h=(C=d==null?void 0:d.getMergedCell(a,m))!=null?C:{startColumn:m,endColumn:m,startRow:a,endRow:a},u=this._markSelectionService.addShape({range:h,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);u&&(this._selectionShapeInfo={...t,shapeId:u})}))}};G=Re([E(0,c.ICommandService),E(1,c.Inject(exports.SheetsThreadCommentPopupService)),E(2,c.Inject($.SheetsThreadCommentModel)),E(3,c.Inject(P.ThreadCommentPanelService)),E(4,c.IUniverInstanceService),E(5,c.Inject(v.SheetPermissionCheckController)),E(6,w.IMarkSelectionService),E(7,c.Inject(v.SheetsSelectionsService)),E(8,w.IEditorBridgeService),E(9,oe.IRenderManagerService)],G);var De=Object.defineProperty,je=Object.getOwnPropertyDescriptor,Ne=(o,t,n,e)=>{for(var r=e>1?void 0:e?je(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&De(t,n,r),r},L=(o,t)=>(n,e)=>t(n,e,o);let Z=class extends c.Disposable{constructor(o,t,n,e){super(),this._sheetInterceptorService=o,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:o=>{var t;if(o.id===v.RemoveSheetCommand.id){const n=o.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),i=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!i)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(r,i),a=Array.from(s.values()).filter(l=>!l.parentId),m=a.map(l=>l.id),d=this._threadCommentDataSourceService.syncUpdateMutationToColla,h=m.map(l=>({id:_.DeleteCommentMutation.id,params:{unitId:r,subUnitId:i,commentId:l}})),u=a.map(({children:l,...C})=>({id:_.AddCommentMutation.id,params:{unitId:r,subUnitId:i,comment:{...C,children:d?l:void 0},sync:!d}}));return{redos:h,undos:u}}return{redos:[],undos:[]}}}))}};Z=Ne([L(0,c.Inject(v.SheetInterceptorService)),L(1,c.IUniverInstanceService),L(2,c.Inject(_.ThreadCommentModel)),L(3,_.IThreadCommentDataSourceService)],Z);var y=function(){return y=Object.assign||function(o){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(o[r]=t[r])}return o},y.apply(this,arguments)},$e=function(o,t){var n={};for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&t.indexOf(e)<0&&(n[e]=o[e]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(o);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(o,e[r])&&(n[e[r]]=o[e[r]]);return n},ce=R.forwardRef(function(o,t){var n=o.icon,e=o.id,r=o.className,i=o.extend,s=$e(o,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),m=R.useRef("_".concat(Ve()));return ae(n,"".concat(e),{defIds:n.defIds,idSuffix:m.current},y({ref:t,className:a},s),i)});function ae(o,t,n,e,r){return R.createElement(o.tag,y(y({key:t},Ae(o,n,r)),e),(xe(o,n).children||[]).map(function(i,s){return ae(i,"".concat(t,"-").concat(o.tag,"-").concat(s),n,void 0,r)}))}function Ae(o,t,n){var e=y({},o.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(o.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(i){var s=i[0],a=i[1];typeof a=="string"&&(e[s]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function xe(o,t){var n,e=t.defIds;return!e||e.length===0?o:o.tag==="defs"&&(!((n=o.children)===null||n===void 0)&&n.length)?y(y({},o),{children:o.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?y(y({},r),{attrs:y(y({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):o}function Ve(){return Math.random().toString(36).substring(2,8)}ce.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=R.forwardRef(function(o,t){return R.createElement(ce,Object.assign({},o,{id:"comment-single",ref:t,icon:ke}))});me.displayName="CommentSingle";const He=()=>{const o=c.useDependency(c.IUniverInstanceService),t=c.useDependency(exports.SheetsThreadCommentPopupService),n=S.useObservable(t.activePopup$),e=c.useDependency($.SheetsThreadCommentModel);if(S.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:i,unitId:s,subUnitId:a,trigger:m}=n,d=e.getByLocation(s,a,r,i),h=`${c.Tools.chatAtABC(i)}${r+1}`,u=()=>{t.hidePopup()},l=C=>{var f,T,N;return(N=(T=(f=o.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET))==null?void 0:f.getSheetBySheetId(C))==null?void 0:T.getName())!=null?N:""};return ie.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:d,unitId:s,subUnitId:a,type:c.UniverInstanceType.UNIVER_SHEET,refStr:h,onClose:u,getSubUnitName:l,autoFocus:m==="context-menu"})},Be=()=>{var b;const o=c.useDependency(w.IMarkSelectionService),t=c.useDependency(c.IUniverInstanceService),n=c.useDependency(exports.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),i=c.useDependency(c.ICommandService),s=R.useMemo(()=>e.activeSheet$.pipe(k.map(p=>p==null?void 0:p.getSheetId())),[e.activeSheet$]),a=S.useObservable(s,(b=e.getActiveSheet())==null?void 0:b.getSheetId()),m=R.useRef(null),d=c.useDependency(P.ThreadCommentPanelService),h=S.useObservable(d.activeCommentId$),u=S.useObservable(d.panelVisible$,d.panelVisible),l=R.useCallback(p=>{const M=e.getSheets(),I={};M.forEach((U,g)=>{I[U.getSheetId()]=g});const O=U=>U.map(g=>{var te;const D=A.singleReferenceToGrid(g.ref),he=[(te=I[g.subUnitId])!=null?te:0,D.row,D.column];return{...g,p:he}}).sort((g,D)=>g.p[0]===D.p[0]?g.p[1]===D.p[1]?g.p[2]-D.p[2]:g.p[1]-D.p[1]:g.p[0]-D.p[0]);return[...O(p.filter(U=>!U.resolved)),...O(p.filter(U=>U.resolved))]},[e]),C=R.useCallback(p=>{var M;if(p.unitId===r&&p.subUnitId===a&&!p.resolved){const{row:I,column:O}=A.singleReferenceToGrid(p.ref),U=e.getSheetBySheetId(p.subUnitId),g=(M=U==null?void 0:U.getMergedCell(I,O))!=null?M:{startColumn:O,endColumn:O,startRow:I,endRow:I};if(!Number.isNaN(I)&&!Number.isNaN(O))return o.addShape({range:g,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[o,a,r]),f=p=>{var M,I;return(I=(M=e.getSheetBySheetId(p))==null?void 0:M.getName())!=null?I:""},T=()=>{i.executeCommand(x.id)},N=p=>{h&&h.unitId===p.unitId&&h.subUnitId===p.subUnitId&&h.commentId===p.id||(m.current&&(o.removeShape(m.current),m.current=null),m.current=C(p))},V=()=>{m.current&&(o.removeShape(m.current),m.current=null)},K=(p,M)=>{M&&n.hidePopup()};return R.useEffect(()=>{!u&&m.current&&o.removeShape(m.current)},[o,u]),ie.jsx(P.ThreadCommentPanel,{unitId:r,subUnitId$:s,type:c.UniverInstanceType.UNIVER_SHEET,onAdd:T,getSubUnitName:f,onResolve:K,sortComments:l,onItemEnter:N,onItemLeave:V,onDeleteComment:()=>(V(),!0)})},Le=o=>({id:x.id,type:S.MenuItemType.BUTTON,icon:X,title:"sheetThreadComment.menu.addComment",hidden$:S.getMenuHiddenObservable(o,c.UniverInstanceType.UNIVER_SHEET),disabled$:w.getCurrentRangeDisable$(o,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]})}),We=o=>({id:P.ToggleSheetCommentPanelOperation.id,type:S.MenuItemType.BUTTON,icon:X,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:w.getCurrentRangeDisable$(o,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]}),hidden$:S.getMenuHiddenObservable(o,c.UniverInstanceType.UNIVER_SHEET)}),Fe={id:x.id,binding:S.KeyCode.M|S.MetaKeys.CTRL_COMMAND|S.MetaKeys.ALT,preconditions:w.whenSheetEditorFocused},qe={[S.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:We}},[S.ContextMenuPosition.MAIN_AREA]:{[S.ContextMenuGroup.OTHERS]:{[x.id]:{order:0,menuItemFactory:Le}}}};var Ge=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,ze=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ze(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ge(t,n,r),r},J=(o,t)=>(n,e)=>t(n,e,o);let z=class extends c.Disposable{constructor(o,t,n){super(),this._menuManagerService=o,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Fe)}_initMenu(){this._menuManagerService.mergeMenu(qe)}_initComponent(){[[se,He],[P.THREAD_COMMENT_PANEL,Be],[X,me]].forEach(([o,t])=>{this._componentManager.register(o,t)})}};z=ze([J(0,S.IMenuManagerService),J(1,c.Inject(S.ComponentManager)),J(2,S.IShortcutService)],z);var de=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Ye=(o,t,n)=>t in o?de(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Je=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&de(t,n,r),r},Q=(o,t)=>(n,e)=>t(n,e,o),ue=(o,t,n)=>Ye(o,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsThreadCommentUIPlugin=class extends c.Plugin{constructor(t=re,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:i,...s}=c.merge({},re,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(_e,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)}};ue(exports.UniverSheetsThreadCommentUIPlugin,"pluginName",ee);ue(exports.UniverSheetsThreadCommentUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsThreadCommentUIPlugin=Je([c.DependentOn(P.UniverThreadCommentUIPlugin,$.UniverSheetsThreadCommentPlugin),Q(1,c.Inject(c.Injector)),Q(2,c.Inject(c.ICommandService)),Q(3,c.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;
|
|
1
|
+
"use strict";var le=Object.defineProperty;var pe=(o,t,n)=>t in o?le(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n;var j=(o,t,n)=>pe(o,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),C=require("@univerjs/sheets"),$=require("@univerjs/sheets-thread-comment"),P=require("@univerjs/thread-comment-ui"),w=require("@univerjs/sheets-ui"),l=require("@univerjs/ui"),k=require("rxjs"),oe=require("@univerjs/engine-render"),A=require("@univerjs/engine-formula"),_=require("@univerjs/thread-comment"),ie=require("react/jsx-runtime"),R=require("react"),se="univer.sheet.thread-comment-modal",X="comment-single",ee="SHEET_THREAD_COMMENT";var ve=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,Se=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ce(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&ve(t,n,r),r},ne=(o,t)=>(n,e)=>t(n,e,o);exports.SheetsThreadCommentPopupService=class extends c.Disposable{constructor(n,e){super();j(this,"_lastPopup",null);j(this,"_activePopup");j(this,"_activePopup$",new k.BehaviorSubject(null));j(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var h;const{row:r,col:i,unitId:s,subUnitId:a}=n;if(this._activePopup&&r===this._activePopup.row&&i===this._activePopup.col&&s===this._activePopup.unitId&&a===((h=this.activePopup)==null?void 0:h.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const m=this._canvasPopupManagerService.attachPopupToCell(r,i,{componentKey: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 c.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=Se([ne(0,c.Inject(w.SheetCanvasPopManagerService)),ne(1,l.IZenZoneService)],exports.SheetsThreadCommentPopupService);const x={type:c.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(o){var f;const t=o.get(C.SheetsSelectionsService),n=o.get(c.IUniverInstanceService),e=o.get(exports.SheetsThreadCommentPopupService),r=o.get(P.ThreadCommentPanelService),i=(f=t.getCurrentLastSelection())==null?void 0:f.primary,s=o.get($.SheetsThreadCommentModel);if(!i)return!1;const a=C.getSheetCommandTarget(n);if(!a)return!1;const{workbook:m,worksheet:d,unitId:h,subUnitId:u}=a,p={workbook:m,worksheet:d,unitId:h,subUnitId:u,row:i.startRow,col:i.startColumn};e.showPopup(p);const S=s.getByLocation(h,u,i.startRow,i.startColumn);return S&&r.setActiveComment({unitId:h,subUnitId:u,commentId:S,trigger:"context-menu"}),!0}},_e="sheets-thread-comment.config",re={};var fe=Object.defineProperty,Ie=Object.getOwnPropertyDescriptor,ge=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ie(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&fe(t,n,r),r},H=(o,t)=>(n,e)=>t(n,e,o);let W=class extends c.Disposable{constructor(o,t,n,e){super(),this._sheetInterceptorService=o,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(C.INTERCEPTOR_POINT.CELL_CONTENT,{effect:c.InterceptorEffectEnum.Style,handler:(o,t,n)=>{const{row:e,col:r,unitId:i,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(i,s,e,r)?n({...o,markers:{...o==null?void 0:o.markers,tr:{color:"#FFBD37",size:6}}}):n(o)},priority:100}))}_initSkeletonChange(){const o=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{o()}))}};W=ge([H(0,c.Inject(C.SheetInterceptorService)),H(1,c.Inject($.SheetsThreadCommentModel)),H(2,c.IUniverInstanceService),H(3,oe.IRenderManagerService)],W);var Pe=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,be=(o,t,n,e)=>{for(var r=e>1?void 0:e?Te(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Pe(t,n,r),r},Y=(o,t)=>(n,e)=>t(n,e,o);const Me=(o,t,n)=>{const e=A.singleReferenceToGrid(o),r=n.row-t.row,i=n.column-t.column,s={startColumn:e.column+i,startRow:e.row+r,endColumn:e.column+i,endRow:e.row+r};return A.serializeRange(s)};let F=class extends c.Disposable{constructor(t,n,e){super();j(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:ee,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:i,subUnitId:s,range:a}=n,m={row:a.rows[0],column:a.cols[0]};if(r.copyType===w.COPY_TYPE.CUT&&this._copyInfo){const{range:d,unitId:h,subUnitId:u}=this._copyInfo,p={row:d.startRow,column:d.startColumn};if(!(i===h&&s===u)){const S=[];c.Range.foreach(d,(b,v)=>{const M=this._sheetsThreadCommentModel.getAllByLocation(h,u,b,v);this._threadCommentDataSourceService.syncUpdateMutationToColla?M.forEach(I=>{S.push(I)}):M.forEach(({children:I,...O})=>{O.parentId||S.push(O)})});const f=[],T=[],N=[],V=[],K=b=>{f.unshift({id:_.DeleteCommentMutation.id,params:{unitId:h,subUnitId:u,commentId:b.id}}),N.push({id:_.AddCommentMutation.id,params:{unitId:i,subUnitId:s,comment:{...b,ref:Me(b.ref,p,m),unitId:i,subUnitId:s},sync:!0}}),T.push({id:_.AddCommentMutation.id,params:{unitId:h,subUnitId:u,comment:b,sync:!0}}),V.unshift({id:_.DeleteCommentMutation.id,params:{unitId:i,subUnitId:s,commentId:b.id}})};return S.forEach(b=>{K(b)}),{redos:[...f,...N],undos:[...V,...T]}}}return{redos:[],undos:[]}}}))}};F=be([Y(0,c.Inject(w.ISheetClipboardService)),Y(1,c.Inject($.SheetsThreadCommentModel)),Y(2,_.IThreadCommentDataSourceService)],F);var ye=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Ue=(o,t,n,e)=>{for(var r=e>1?void 0:e?we(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&ye(t,n,r),r},B=(o,t)=>(n,e)=>t(n,e,o);let q=class extends c.Disposable{constructor(o,t,n,e){super(),this._hoverManagerService=o,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(o=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(o&&(t&&t.temp||!t)){const{location:n}=o,{unitId:e,subUnitId:r,row:i,col:s}=n,a=this._sheetsThreadCommentModel.getByLocation(e,r,i,s);if(a){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,r,a);d&&!d.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:i,col:s,commentId:a,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=Ue([B(0,c.Inject(w.HoverManagerService)),B(1,c.Inject(exports.SheetsThreadCommentPopupService)),B(2,c.Inject($.SheetsThreadCommentModel)),B(3,c.Inject(C.SheetPermissionCheckController))],q);var Oe=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Re=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Oe(t,n,r),r},E=(o,t)=>(n,e)=>t(n,e,o);let G=class extends c.Disposable{constructor(t,n,e,r,i,s,a,m,d,h){super();j(this,"_isSwitchToCommenting",!1);j(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=i,this._sheetPermissionCheckController=s,this._markSelectionService=a,this._sheetSelectionService=m,this._editorBridgeService=d,this._renderManagerService=h,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var p,S,f;const r=(p=t[0])==null?void 0:p.range,i=this._renderManagerService.getRenderById(n),s=(S=i==null?void 0:i.with(w.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:S.skeleton;if(!s||!r)return;const a=s.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((f=r.rangeType)!=null?f:c.RANGE_TYPE.NORMAL)!==c.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((a.isMerged||a.isMergedMainCell)&&c.Rectangle.equals(a.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const d=a.actualRow,h=a.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,d,h)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const u=this._sheetsThreadCommentModel.getByLocation(n,e,d,h);u&&this._commandService.executeCommand(P.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:u})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===_.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:i,commentId:s}=e;n.unitId===r&&n.subUnitId===i&&n.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:i,trigger:s}=t,a=this._sheetsThreadCommentModel.getComment(e,r,i);if(!a||a.resolved)return;const m=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(!m||m.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=m.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(C.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const u=A.singleReferenceToGrid(a.ref),{row:p,column:S}=u;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(u.row-T,0),endRow:u.row+T,startColumn:Math.max(u.column-T,0),endColumn:u.column+T}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:u.row,col:u.column,commentId:a.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var p,S;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const i=this._sheetsThreadCommentModel.getComment(n,e,r);if(!i)return;const s=A.singleReferenceToGrid(i.ref),{row:a,column:m}=s;if(Number.isNaN(a)||Number.isNaN(m))return null;const d=(p=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getSheetBySheetId(e),h=(S=d==null?void 0:d.getMergedCell(a,m))!=null?S:{startColumn:m,endColumn:m,startRow:a,endRow:a},u=this._markSelectionService.addShape({range:h,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);u&&(this._selectionShapeInfo={...t,shapeId:u})}))}};G=Re([E(0,c.ICommandService),E(1,c.Inject(exports.SheetsThreadCommentPopupService)),E(2,c.Inject($.SheetsThreadCommentModel)),E(3,c.Inject(P.ThreadCommentPanelService)),E(4,c.IUniverInstanceService),E(5,c.Inject(C.SheetPermissionCheckController)),E(6,w.IMarkSelectionService),E(7,c.Inject(C.SheetsSelectionsService)),E(8,w.IEditorBridgeService),E(9,oe.IRenderManagerService)],G);var De=Object.defineProperty,je=Object.getOwnPropertyDescriptor,Ne=(o,t,n,e)=>{for(var r=e>1?void 0:e?je(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&De(t,n,r),r},L=(o,t)=>(n,e)=>t(n,e,o);let Z=class extends c.Disposable{constructor(o,t,n,e){super(),this._sheetInterceptorService=o,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:o=>{var t;if(o.id===C.RemoveSheetCommand.id){const n=o.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),i=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!i)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(r,i),a=Array.from(s.values()).filter(p=>!p.parentId),m=a.map(p=>p.id),d=this._threadCommentDataSourceService.syncUpdateMutationToColla,h=m.map(p=>({id:_.DeleteCommentMutation.id,params:{unitId:r,subUnitId:i,commentId:p}})),u=a.map(({children:p,...S})=>({id:_.AddCommentMutation.id,params:{unitId:r,subUnitId:i,comment:{...S,children:d?p:void 0},sync:!d}}));return{redos:h,undos:u}}return{redos:[],undos:[]}}}))}};Z=Ne([L(0,c.Inject(C.SheetInterceptorService)),L(1,c.IUniverInstanceService),L(2,c.Inject(_.ThreadCommentModel)),L(3,_.IThreadCommentDataSourceService)],Z);var y=function(){return y=Object.assign||function(o){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(o[r]=t[r])}return o},y.apply(this,arguments)},$e=function(o,t){var n={};for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&t.indexOf(e)<0&&(n[e]=o[e]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(o);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(o,e[r])&&(n[e[r]]=o[e[r]]);return n},ce=R.forwardRef(function(o,t){var n=o.icon,e=o.id,r=o.className,i=o.extend,s=$e(o,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),m=R.useRef("_".concat(Ve()));return ae(n,"".concat(e),{defIds:n.defIds,idSuffix:m.current},y({ref:t,className:a},s),i)});function ae(o,t,n,e,r){return R.createElement(o.tag,y(y({key:t},Ae(o,n,r)),e),(xe(o,n).children||[]).map(function(i,s){return ae(i,"".concat(t,"-").concat(o.tag,"-").concat(s),n,void 0,r)}))}function Ae(o,t,n){var e=y({},o.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(o.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(i){var s=i[0],a=i[1];typeof a=="string"&&(e[s]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function xe(o,t){var n,e=t.defIds;return!e||e.length===0?o:o.tag==="defs"&&(!((n=o.children)===null||n===void 0)&&n.length)?y(y({},o),{children:o.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?y(y({},r),{attrs:y(y({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):o}function Ve(){return Math.random().toString(36).substring(2,8)}ce.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=R.forwardRef(function(o,t){return R.createElement(ce,Object.assign({},o,{id:"comment-single",ref:t,icon:ke}))});me.displayName="CommentSingle";const He=()=>{const o=l.useDependency(c.IUniverInstanceService),t=l.useDependency(exports.SheetsThreadCommentPopupService),n=l.useObservable(t.activePopup$),e=l.useDependency($.SheetsThreadCommentModel);if(l.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:i,unitId:s,subUnitId:a,trigger:m}=n,d=e.getByLocation(s,a,r,i),h=`${c.Tools.chatAtABC(i)}${r+1}`,u=()=>{t.hidePopup()},p=S=>{var f,T,N;return(N=(T=(f=o.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET))==null?void 0:f.getSheetBySheetId(S))==null?void 0:T.getName())!=null?N:""};return ie.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:d,unitId:s,subUnitId:a,type:c.UniverInstanceType.UNIVER_SHEET,refStr:h,onClose:u,getSubUnitName:p,autoFocus:m==="context-menu"})},Be=()=>{var b;const o=l.useDependency(w.IMarkSelectionService),t=l.useDependency(c.IUniverInstanceService),n=l.useDependency(exports.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),i=l.useDependency(c.ICommandService),s=R.useMemo(()=>e.activeSheet$.pipe(k.map(v=>v==null?void 0:v.getSheetId())),[e.activeSheet$]),a=l.useObservable(s,(b=e.getActiveSheet())==null?void 0:b.getSheetId()),m=R.useRef(null),d=l.useDependency(P.ThreadCommentPanelService),h=l.useObservable(d.activeCommentId$),u=l.useObservable(d.panelVisible$,d.panelVisible),p=R.useCallback(v=>{const M=e.getSheets(),I={};M.forEach((U,g)=>{I[U.getSheetId()]=g});const O=U=>U.map(g=>{var te;const D=A.singleReferenceToGrid(g.ref),he=[(te=I[g.subUnitId])!=null?te:0,D.row,D.column];return{...g,p:he}}).sort((g,D)=>g.p[0]===D.p[0]?g.p[1]===D.p[1]?g.p[2]-D.p[2]:g.p[1]-D.p[1]:g.p[0]-D.p[0]);return[...O(v.filter(U=>!U.resolved)),...O(v.filter(U=>U.resolved))]},[e]),S=R.useCallback(v=>{var M;if(v.unitId===r&&v.subUnitId===a&&!v.resolved){const{row:I,column:O}=A.singleReferenceToGrid(v.ref),U=e.getSheetBySheetId(v.subUnitId),g=(M=U==null?void 0:U.getMergedCell(I,O))!=null?M:{startColumn:O,endColumn:O,startRow:I,endRow:I};if(!Number.isNaN(I)&&!Number.isNaN(O))return o.addShape({range:g,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[o,a,r]),f=v=>{var M,I;return(I=(M=e.getSheetBySheetId(v))==null?void 0:M.getName())!=null?I:""},T=()=>{i.executeCommand(x.id)},N=v=>{h&&h.unitId===v.unitId&&h.subUnitId===v.subUnitId&&h.commentId===v.id||(m.current&&(o.removeShape(m.current),m.current=null),m.current=S(v))},V=()=>{m.current&&(o.removeShape(m.current),m.current=null)},K=(v,M)=>{M&&n.hidePopup()};return R.useEffect(()=>{!u&&m.current&&o.removeShape(m.current)},[o,u]),ie.jsx(P.ThreadCommentPanel,{unitId:r,subUnitId$:s,type:c.UniverInstanceType.UNIVER_SHEET,onAdd:T,getSubUnitName:f,onResolve:K,sortComments:p,onItemEnter:N,onItemLeave:V,onDeleteComment:()=>(V(),!0)})},Le=o=>({id:x.id,type:l.MenuItemType.BUTTON,icon:X,title:"sheetThreadComment.menu.addComment",hidden$:l.getMenuHiddenObservable(o,c.UniverInstanceType.UNIVER_SHEET),disabled$:w.getCurrentRangeDisable$(o,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]})}),We=o=>({id:P.ToggleSheetCommentPanelOperation.id,type:l.MenuItemType.BUTTON,icon:X,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:w.getCurrentRangeDisable$(o,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]}),hidden$:l.getMenuHiddenObservable(o,c.UniverInstanceType.UNIVER_SHEET)}),Fe={id:x.id,binding:l.KeyCode.M|l.MetaKeys.CTRL_COMMAND|l.MetaKeys.ALT,preconditions:w.whenSheetEditorFocused},qe={[l.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:We}},[l.ContextMenuPosition.MAIN_AREA]:{[l.ContextMenuGroup.OTHERS]:{[x.id]:{order:0,menuItemFactory:Le}}}};var Ge=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,ze=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ze(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ge(t,n,r),r},J=(o,t)=>(n,e)=>t(n,e,o);let z=class extends c.Disposable{constructor(o,t,n){super(),this._menuManagerService=o,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Fe)}_initMenu(){this._menuManagerService.mergeMenu(qe)}_initComponent(){[[se,He],[P.THREAD_COMMENT_PANEL,Be],[X,me]].forEach(([o,t])=>{this._componentManager.register(o,t)})}};z=ze([J(0,l.IMenuManagerService),J(1,c.Inject(l.ComponentManager)),J(2,l.IShortcutService)],z);var de=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Ye=(o,t,n)=>t in o?de(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Je=(o,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&de(t,n,r),r},Q=(o,t)=>(n,e)=>t(n,e,o),ue=(o,t,n)=>Ye(o,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsThreadCommentUIPlugin=class extends c.Plugin{constructor(t=re,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:i,...s}=c.merge({},re,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(_e,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)}};ue(exports.UniverSheetsThreadCommentUIPlugin,"pluginName",ee);ue(exports.UniverSheetsThreadCommentUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsThreadCommentUIPlugin=Je([c.DependentOn(P.UniverThreadCommentUIPlugin,$.UniverSheetsThreadCommentPlugin),Q(1,c.Inject(c.Injector)),Q(2,c.Inject(c.ICommandService)),Q(3,c.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
1
|
var Ae = Object.defineProperty;
|
|
2
2
|
var Ve = (o, e, n) => e in o ? Ae(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
|
|
3
3
|
var E = (o, e, n) => Ve(o, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { Inject as _, Disposable as N, DisposableCollection as He, CommandType as Be, IUniverInstanceService as $, InterceptorEffectEnum as Le, UniverInstanceType as b, Range as ke, ICommandService as ie, RANGE_TYPE as he, Rectangle as Fe,
|
|
4
|
+
import { Inject as _, Disposable as N, DisposableCollection as He, CommandType as Be, IUniverInstanceService as $, InterceptorEffectEnum as Le, UniverInstanceType as b, Range as ke, ICommandService as ie, RANGE_TYPE as he, Rectangle as Fe, Tools as We, DependentOn as Ze, Injector as ze, Plugin as Ge, merge as Ke, IConfigService as Ye } from "@univerjs/core";
|
|
5
5
|
import { SheetsSelectionsService as _e, getSheetCommandTarget as qe, SheetInterceptorService as ve, INTERCEPTOR_POINT as Je, SheetPermissionCheckController as fe, WorkbookCommentPermission as q, WorksheetViewPermission as J, RangeProtectionPermissionViewPoint as Q, SetWorksheetActiveOperation as Qe, RemoveSheetCommand as Xe } from "@univerjs/sheets";
|
|
6
6
|
import { SheetsThreadCommentModel as D, UniverSheetsThreadCommentPlugin as et } from "@univerjs/sheets-thread-comment";
|
|
7
7
|
import { ThreadCommentPanelService as se, SetActiveCommentOperation as ee, ThreadCommentTree as tt, ThreadCommentPanel as nt, ToggleSheetCommentPanelOperation as Ce, THREAD_COMMENT_PANEL as rt, UniverThreadCommentUIPlugin as ot } from "@univerjs/thread-comment-ui";
|
|
8
8
|
import { UniverThreadCommentUIPlugin as wn } from "@univerjs/thread-comment-ui";
|
|
9
9
|
import { SheetCanvasPopManagerService as it, ISheetClipboardService as st, COPY_TYPE as at, HoverManagerService as ct, IMarkSelectionService as Se, IEditorBridgeService as dt, SheetSkeletonManagerService as ht, ScrollToRangeOperation as mt, whenSheetEditorFocused as ut, getCurrentRangeDisable$ as ge } from "@univerjs/sheets-ui";
|
|
10
|
-
import { IZenZoneService as lt, useObservable as j, KeyCode as pt, MetaKeys as me, MenuItemType as Ie, getMenuHiddenObservable as Pe, RibbonStartGroup as _t, ContextMenuPosition as vt, ContextMenuGroup as ft, ComponentManager as Ct, IMenuManagerService as St, IShortcutService as gt } from "@univerjs/ui";
|
|
10
|
+
import { IZenZoneService as lt, useDependency as O, useObservable as j, KeyCode as pt, MetaKeys as me, MenuItemType as Ie, getMenuHiddenObservable as Pe, RibbonStartGroup as _t, ContextMenuPosition as vt, ContextMenuGroup as ft, ComponentManager as Ct, IMenuManagerService as St, IShortcutService as gt } from "@univerjs/ui";
|
|
11
11
|
import { BehaviorSubject as It, debounceTime as ae, map as Pt } from "rxjs";
|
|
12
12
|
import { IRenderManagerService as Te } from "@univerjs/engine-render";
|
|
13
13
|
import { singleReferenceToGrid as A, serializeRange as Tt } from "@univerjs/engine-formula";
|
package/lib/types/index.d.ts
CHANGED
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,$,g,b,_,H,ne,V,f,re,U){"use strict";var Je=Object.defineProperty;var Qe=(c,s,p)=>s in c?Je(c,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[s]=p;var N=(c,s,p)=>Qe(c,typeof s!="symbol"?s+"":s,p);const ie="univer.sheet.thread-comment-modal",Y="comment-single",J="SHEET_THREAD_COMMENT";var le=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,ve=(i,t,n,e)=>{for(var r=e>1?void 0:e?pe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&le(t,n,r),r},oe=(i,t)=>(n,e)=>t(n,e,i);c.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new H.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var l;const{row:r,col:o,unitId:a,subUnitId:u}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&u===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const d=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!d)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new s.DisposableCollection;m.add(d),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}},c.SheetsThreadCommentPopupService=ve([oe(0,s.Inject(b.SheetCanvasPopManagerService)),oe(1,_.IZenZoneService)],c.SheetsThreadCommentPopupService);const k={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var I;const t=i.get(p.SheetsSelectionsService),n=i.get(s.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),r=i.get(g.ThreadCommentPanelService),o=(I=t.getCurrentLastSelection())==null?void 0:I.primary,a=i.get($.SheetsThreadCommentModel);if(!o)return!1;const u=p.getSheetCommandTarget(n);if(!u)return!1;const{workbook:d,worksheet:m,unitId:l,subUnitId:h}=u,v={workbook:d,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(v);const C=a.getByLocation(l,h,o.startRow,o.startColumn);return C&&r.setActiveComment({unitId:l,subUnitId:h,commentId:C,trigger:"context-menu"}),!0}},Se="sheets-thread-comment.config",se={};var Ce=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,fe=(i,t,n,e)=>{for(var r=e>1?void 0:e?_e(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ce(t,n,r),r},L=(i,t)=>(n,e)=>t(n,e,i);let W=class extends s.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(i,t,n)=>{const{row:e,col:r,unitId:o,subUnitId:a}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,a,e,r)?n({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):n(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(H.debounceTime(16)).subscribe(()=>{i()}))}};W=fe([L(0,s.Inject(p.SheetInterceptorService)),L(1,s.Inject($.SheetsThreadCommentModel)),L(2,s.IUniverInstanceService),L(3,ne.IRenderManagerService)],W);var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,n,e)=>{for(var r=e>1?void 0:e?ge(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ie(t,n,r),r},Q=(i,t)=>(n,e)=>t(n,e,i);const Te=(i,t,n)=>{const e=V.singleReferenceToGrid(i),r=n.row-t.row,o=n.column-t.column,a={startColumn:e.column+o,startRow:e.row+r,endColumn:e.column+o,endRow:e.row+r};return V.serializeRange(a)};let x=class extends s.Disposable{constructor(t,n,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:J,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:a,range:u}=n,d={row:u.rows[0],column:u.cols[0]};if(r.copyType===b.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,v={row:m.startRow,column:m.startColumn};if(!(o===l&&a===h)){const C=[];s.Range.foreach(m,(w,S)=>{const E=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,S);this._threadCommentDataSourceService.syncUpdateMutationToColla?E.forEach(P=>{C.push(P)}):E.forEach(({children:P,...j})=>{j.parentId||C.push(j)})});const I=[],y=[],A=[],B=[],te=w=>{I.unshift({id:f.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),A.push({id:f.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:Te(w.ref,v,d),unitId:o,subUnitId:a},sync:!0}}),y.push({id:f.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),B.unshift({id:f.DeleteCommentMutation.id,params:{unitId:o,subUnitId:a,commentId:w.id}})};return C.forEach(w=>{te(w)}),{redos:[...I,...A],undos:[...B,...y]}}}return{redos:[],undos:[]}}}))}};x=Pe([Q(0,s.Inject(b.ISheetClipboardService)),Q(1,s.Inject($.SheetsThreadCommentModel)),Q(2,f.IThreadCommentDataSourceService)],x);var be=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,ye=(i,t,n,e)=>{for(var r=e>1?void 0:e?Me(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&be(t,n,r),r},F=(i,t)=>(n,e)=>t(n,e,i);let q=class extends s.Disposable{constructor(i,t,n,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(H.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:n}=i,{unitId:e,subUnitId:r,row:o,col:a}=n,u=this._sheetsThreadCommentModel.getByLocation(e,r,o,a);if(u){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:a,endRow:o,endColumn:a}]))return;const m=this._sheetsThreadCommentModel.getComment(e,r,u);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:a,commentId:u,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=ye([F(0,s.Inject(b.HoverManagerService)),F(1,s.Inject(c.SheetsThreadCommentPopupService)),F(2,s.Inject($.SheetsThreadCommentModel)),F(3,s.Inject(p.SheetPermissionCheckController))],q);var we=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&we(t,n,r),r},R=(i,t)=>(n,e)=>t(n,e,i);let G=class extends s.Disposable{constructor(t,n,e,r,o,a,u,d,m,l){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=o,this._sheetPermissionCheckController=a,this._markSelectionService=u,this._sheetSelectionService=d,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var v,C,I;const r=(v=t[0])==null?void 0:v.range,o=this._renderManagerService.getRenderById(n),a=(C=o==null?void 0:o.with(b.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:C.skeleton;if(!a||!r)return;const u=a.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((I=r.rangeType)!=null?I:s.RANGE_TYPE.NORMAL)!==s.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((u.isMerged||u.isMergedMainCell)&&s.Rectangle.equals(u.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const m=u.actualRow,l=u.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(n,e,m,l);h&&this._commandService.executeCommand(g.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===f.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId:a}=e;n.unitId===r&&n.subUnitId===o&&n.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:o,trigger:a}=t,u=this._sheetsThreadCommentModel.getComment(e,r,o);if(!u||u.resolved)return;const d=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!d||d.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=d.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const h=V.singleReferenceToGrid(u.ref),{row:v,column:C}=h;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:v,startColumn:C,endRow:v,endColumn:C}]))return;const y=1;if(await this._commandService.executeCommand(b.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-y,0),endRow:h.row+y,startColumn:Math.max(h.column-y,0),endColumn:h.column+y}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:h.row,col:h.column,commentId:u.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(H.debounceTime(100)).subscribe(t=>{var v,C;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(n,e,r);if(!o)return;const a=V.singleReferenceToGrid(o.ref),{row:u,column:d}=a;if(Number.isNaN(u)||Number.isNaN(d))return null;const m=(v=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getSheetBySheetId(e),l=(C=m==null?void 0:m.getMergedCell(u,d))!=null?C:{startColumn:d,endColumn:d,startRow:u,endRow:u},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};G=Oe([R(0,s.ICommandService),R(1,s.Inject(c.SheetsThreadCommentPopupService)),R(2,s.Inject($.SheetsThreadCommentModel)),R(3,s.Inject(g.ThreadCommentPanelService)),R(4,s.IUniverInstanceService),R(5,s.Inject(p.SheetPermissionCheckController)),R(6,b.IMarkSelectionService),R(7,s.Inject(p.SheetsSelectionsService)),R(8,b.IEditorBridgeService),R(9,ne.IRenderManagerService)],G);var Ue=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,je=(i,t,n,e)=>{for(var r=e>1?void 0:e?Re(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ue(t,n,r),r},Z=(i,t)=>(n,e)=>t(n,e,i);let z=class extends s.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===p.RemoveSheetCommand.id){const n=i.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const a=this._threadCommentModel.ensureMap(r,o),u=Array.from(a.values()).filter(v=>!v.parentId),d=u.map(v=>v.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=d.map(v=>({id:f.DeleteCommentMutation.id,params:{unitId:r,subUnitId:o,commentId:v}})),h=u.map(({children:v,...C})=>({id:f.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{...C,children:m?v:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};z=je([Z(0,s.Inject(p.SheetInterceptorService)),Z(1,s.IUniverInstanceService),Z(2,s.Inject(f.ThreadCommentModel)),Z(3,f.IThreadCommentDataSourceService)],z);var M=function(){return M=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},M.apply(this,arguments)},De=function(i,t){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(n[e[r]]=i[e[r]]);return n},ae=U.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,a=De(i,["icon","id","className","extend"]),u="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),d=U.useRef("_".concat(Ae()));return ce(n,"".concat(e),{defIds:n.defIds,idSuffix:d.current},M({ref:t,className:u},a),o)});function ce(i,t,n,e,r){return U.createElement(i.tag,M(M({key:t},Ne(i,n,r)),e),($e(i,n).children||[]).map(function(o,a){return ce(o,"".concat(t,"-").concat(i.tag,"-").concat(a),n,void 0,r)}))}function Ne(i,t,n){var e=M({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],u=o[1];typeof u=="string"&&(e[a]=u.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function $e(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?M(M({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?M(M({},r),{attrs:M(M({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function Ae(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var Ve={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ue=U.forwardRef(function(i,t){return U.createElement(ae,Object.assign({},i,{id:"comment-single",ref:t,icon:Ve}))});ue.displayName="CommentSingle";const ke=()=>{const i=s.useDependency(s.IUniverInstanceService),t=s.useDependency(c.SheetsThreadCommentPopupService),n=_.useObservable(t.activePopup$),e=s.useDependency($.SheetsThreadCommentModel);if(_.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:a,subUnitId:u,trigger:d}=n,m=e.getByLocation(a,u,r,o),l=`${s.Tools.chatAtABC(o)}${r+1}`,h=()=>{t.hidePopup()},v=C=>{var I,y,A;return(A=(y=(I=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getSheetBySheetId(C))==null?void 0:y.getName())!=null?A:""};return re.jsx(g.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:a,subUnitId:u,type:s.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:v,autoFocus:d==="context-menu"})},He=()=>{var w;const i=s.useDependency(b.IMarkSelectionService),t=s.useDependency(s.IUniverInstanceService),n=s.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=s.useDependency(s.ICommandService),a=U.useMemo(()=>e.activeSheet$.pipe(H.map(S=>S==null?void 0:S.getSheetId())),[e.activeSheet$]),u=_.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),d=U.useRef(null),m=s.useDependency(g.ThreadCommentPanelService),l=_.useObservable(m.activeCommentId$),h=_.useObservable(m.panelVisible$,m.panelVisible),v=U.useCallback(S=>{const E=e.getSheets(),P={};E.forEach((O,T)=>{P[O.getSheetId()]=T});const j=O=>O.map(T=>{var he;const D=V.singleReferenceToGrid(T.ref),Ye=[(he=P[T.subUnitId])!=null?he:0,D.row,D.column];return{...T,p:Ye}}).sort((T,D)=>T.p[0]===D.p[0]?T.p[1]===D.p[1]?T.p[2]-D.p[2]:T.p[1]-D.p[1]:T.p[0]-D.p[0]);return[...j(S.filter(O=>!O.resolved)),...j(S.filter(O=>O.resolved))]},[e]),C=U.useCallback(S=>{var E;if(S.unitId===r&&S.subUnitId===u&&!S.resolved){const{row:P,column:j}=V.singleReferenceToGrid(S.ref),O=e.getSheetBySheetId(S.subUnitId),T=(E=O==null?void 0:O.getMergedCell(P,j))!=null?E:{startColumn:j,endColumn:j,startRow:P,endRow:P};if(!Number.isNaN(P)&&!Number.isNaN(j))return i.addShape({range:T,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[i,u,r]),I=S=>{var E,P;return(P=(E=e.getSheetBySheetId(S))==null?void 0:E.getName())!=null?P:""},y=()=>{o.executeCommand(k.id)},A=S=>{l&&l.unitId===S.unitId&&l.subUnitId===S.subUnitId&&l.commentId===S.id||(d.current&&(i.removeShape(d.current),d.current=null),d.current=C(S))},B=()=>{d.current&&(i.removeShape(d.current),d.current=null)},te=(S,E)=>{E&&n.hidePopup()};return U.useEffect(()=>{!h&&d.current&&i.removeShape(d.current)},[i,h]),re.jsx(g.ThreadCommentPanel,{unitId:r,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:y,getSubUnitName:I,onResolve:te,sortComments:v,onItemEnter:A,onItemLeave:B,onDeleteComment:()=>(B(),!0)})},Be=i=>({id:k.id,type:_.MenuItemType.BUTTON,icon:Y,title:"sheetThreadComment.menu.addComment",hidden$:_.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),Le=i=>({id:g.ToggleSheetCommentPanelOperation.id,type:_.MenuItemType.BUTTON,icon:Y,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:_.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET)}),We={id:k.id,binding:_.KeyCode.M|_.MetaKeys.CTRL_COMMAND|_.MetaKeys.ALT,preconditions:b.whenSheetEditorFocused},xe={[_.RibbonStartGroup.OTHERS]:{[g.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:Le}},[_.ContextMenuPosition.MAIN_AREA]:{[_.ContextMenuGroup.OTHERS]:{[k.id]:{order:0,menuItemFactory:Be}}}};var Fe=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Ge=(i,t,n,e)=>{for(var r=e>1?void 0:e?qe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Fe(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);let K=class extends s.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(We)}_initMenu(){this._menuManagerService.mergeMenu(xe)}_initComponent(){[[ie,ke],[g.THREAD_COMMENT_PANEL,He],[Y,ue]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};K=Ge([X(0,_.IMenuManagerService),X(1,s.Inject(_.ComponentManager)),X(2,_.IShortcutService)],K);var de=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,ze=(i,t,n)=>t in i?de(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,Ke=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ze(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&de(t,n,r),r},ee=(i,t)=>(n,e)=>t(n,e,i),me=(i,t,n)=>ze(i,typeof t!="symbol"?t+"":t,n);c.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=se,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...a}=s.merge({},se,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Se,a)}onStarting(){[[K],[W],[x],[q],[z],[G],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[k].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(K)}onReady(){this._injector.get(W),this._injector.get(z)}onRendered(){this._injector.get(x),this._injector.get(q),this._injector.get(G)}},me(c.UniverSheetsThreadCommentUIPlugin,"pluginName",J),me(c.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=Ke([s.DependentOn(g.UniverThreadCommentUIPlugin,$.UniverSheetsThreadCommentPlugin),ee(1,s.Inject(s.Injector)),ee(2,s.Inject(s.ICommandService)),ee(3,s.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>g.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>f.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>f.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>f.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>f.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>f.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>f.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=J,c.ShowAddSheetCommentModalOperation=k,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment"),require("react/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"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(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,a,p,$,g,b,v,H,ne,V,f,re,U){"use strict";var Je=Object.defineProperty;var Qe=(c,a,p)=>a in c?Je(c,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[a]=p;var N=(c,a,p)=>Qe(c,typeof a!="symbol"?a+"":a,p);const ie="univer.sheet.thread-comment-modal",Y="comment-single",J="SHEET_THREAD_COMMENT";var le=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,ve=(i,t,n,e)=>{for(var r=e>1?void 0:e?pe(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&le(t,n,r),r},oe=(i,t)=>(n,e)=>t(n,e,i);c.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new H.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var l;const{row:r,col:o,unitId:s,subUnitId:d}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const u=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new a.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=ve([oe(0,a.Inject(b.SheetCanvasPopManagerService)),oe(1,v.IZenZoneService)],c.SheetsThreadCommentPopupService);const k={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var I;const t=i.get(p.SheetsSelectionsService),n=i.get(a.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),r=i.get(g.ThreadCommentPanelService),o=(I=t.getCurrentLastSelection())==null?void 0:I.primary,s=i.get($.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(n);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 _=s.getByLocation(l,h,o.startRow,o.startColumn);return _&&r.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},Se="sheets-thread-comment.config",se={};var Ce=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,fe=(i,t,n,e)=>{for(var r=e>1?void 0:e?_e(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ce(t,n,r),r},L=(i,t)=>(n,e)=>t(n,e,i);let W=class extends a.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,n)=>{const{row:e,col:r,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,r)?n({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):n(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(H.debounceTime(16)).subscribe(()=>{i()}))}};W=fe([L(0,a.Inject(p.SheetInterceptorService)),L(1,a.Inject($.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,ne.IRenderManagerService)],W);var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,n,e)=>{for(var r=e>1?void 0:e?ge(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ie(t,n,r),r},Q=(i,t)=>(n,e)=>t(n,e,i);const Te=(i,t,n)=>{const e=V.singleReferenceToGrid(i),r=n.row-t.row,o=n.column-t.column,s={startColumn:e.column+o,startRow:e.row+r,endColumn:e.column+o,endRow:e.row+r};return V.serializeRange(s)};let x=class extends a.Disposable{constructor(t,n,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:J,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:s,range:d}=n,u={row:d.rows[0],column:d.cols[0]};if(r.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&&s===h)){const _=[];a.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=[],y=[],A=[],B=[],te=w=>{I.unshift({id:f.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),A.push({id:f.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:Te(w.ref,S,u),unitId:o,subUnitId:s},sync:!0}}),y.push({id:f.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),B.unshift({id:f.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return _.forEach(w=>{te(w)}),{redos:[...I,...A],undos:[...B,...y]}}}return{redos:[],undos:[]}}}))}};x=Pe([Q(0,a.Inject(b.ISheetClipboardService)),Q(1,a.Inject($.SheetsThreadCommentModel)),Q(2,f.IThreadCommentDataSourceService)],x);var be=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,ye=(i,t,n,e)=>{for(var r=e>1?void 0:e?Me(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&be(t,n,r),r},F=(i,t)=>(n,e)=>t(n,e,i);let q=class extends a.Disposable{constructor(i,t,n,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(H.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:n}=i,{unitId:e,subUnitId:r,row:o,col:s}=n,d=this._sheetsThreadCommentModel.getByLocation(e,r,o,s);if(d){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const m=this._sheetsThreadCommentModel.getComment(e,r,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:s,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=ye([F(0,a.Inject(b.HoverManagerService)),F(1,a.Inject(c.SheetsThreadCommentPopupService)),F(2,a.Inject($.SheetsThreadCommentModel)),F(3,a.Inject(p.SheetPermissionCheckController))],q);var we=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&we(t,n,r),r},R=(i,t)=>(n,e)=>t(n,e,i);let G=class extends a.Disposable{constructor(t,n,e,r,o,s,d,u,m,l){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=o,this._sheetPermissionCheckController=s,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var S,_,I;const r=(S=t[0])==null?void 0:S.range,o=this._renderManagerService.getRenderById(n),s=(_=o==null?void 0:o.with(b.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:_.skeleton;if(!s||!r)return;const d=s.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((I=r.rangeType)!=null?I:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&a.Rectangle.equals(d.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(n,e,m,l);h&&this._commandService.executeCommand(g.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===f.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId:s}=e;n.unitId===r&&n.subUnitId===o&&n.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:o,trigger:s}=t,d=this._sheetsThreadCommentModel.getComment(e,r,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=u.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const h=V.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 y=1;if(await this._commandService.executeCommand(b.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-y,0),endRow:h.row+y,startColumn:Math.max(h.column-y,0),endColumn:h.column+y}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:h.row,col:h.column,commentId:d.id,trigger:s})}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:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(n,e,r);if(!o)return;const s=V.singleReferenceToGrid(o.ref),{row:d,column:u}=s;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(S=this._univerInstanceService.getCurrentUnitForType(a.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=Oe([R(0,a.ICommandService),R(1,a.Inject(c.SheetsThreadCommentPopupService)),R(2,a.Inject($.SheetsThreadCommentModel)),R(3,a.Inject(g.ThreadCommentPanelService)),R(4,a.IUniverInstanceService),R(5,a.Inject(p.SheetPermissionCheckController)),R(6,b.IMarkSelectionService),R(7,a.Inject(p.SheetsSelectionsService)),R(8,b.IEditorBridgeService),R(9,ne.IRenderManagerService)],G);var Ue=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,je=(i,t,n,e)=>{for(var r=e>1?void 0:e?Re(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ue(t,n,r),r},Z=(i,t)=>(n,e)=>t(n,e,i);let z=class extends a.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===p.RemoveSheetCommand.id){const n=i.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(r,o),d=Array.from(s.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:r,subUnitId:o,commentId:S}})),h=d.map(({children:S,..._})=>({id:f.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{..._,children:m?S:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};z=je([Z(0,a.Inject(p.SheetInterceptorService)),Z(1,a.IUniverInstanceService),Z(2,a.Inject(f.ThreadCommentModel)),Z(3,f.IThreadCommentDataSourceService)],z);var M=function(){return M=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},M.apply(this,arguments)},De=function(i,t){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(n[e[r]]=i[e[r]]);return n},ae=U.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,s=De(i,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),u=U.useRef("_".concat(Ae()));return ce(n,"".concat(e),{defIds:n.defIds,idSuffix:u.current},M({ref:t,className:d},s),o)});function ce(i,t,n,e,r){return U.createElement(i.tag,M(M({key:t},Ne(i,n,r)),e),($e(i,n).children||[]).map(function(o,s){return ce(o,"".concat(t,"-").concat(i.tag,"-").concat(s),n,void 0,r)}))}function Ne(i,t,n){var e=M({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],d=o[1];typeof d=="string"&&(e[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function $e(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?M(M({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?M(M({},r),{attrs:M(M({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function Ae(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var Ve={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},de=U.forwardRef(function(i,t){return U.createElement(ae,Object.assign({},i,{id:"comment-single",ref:t,icon:Ve}))});de.displayName="CommentSingle";const ke=()=>{const i=v.useDependency(a.IUniverInstanceService),t=v.useDependency(c.SheetsThreadCommentPopupService),n=v.useObservable(t.activePopup$),e=v.useDependency($.SheetsThreadCommentModel);if(v.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:s,subUnitId:d,trigger:u}=n,m=e.getByLocation(s,d,r,o),l=`${a.Tools.chatAtABC(o)}${r+1}`,h=()=>{t.hidePopup()},S=_=>{var I,y,A;return(A=(y=(I=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getSheetBySheetId(_))==null?void 0:y.getName())!=null?A:""};return re.jsx(g.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:s,subUnitId:d,type:a.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:S,autoFocus:u==="context-menu"})},He=()=>{var w;const i=v.useDependency(b.IMarkSelectionService),t=v.useDependency(a.IUniverInstanceService),n=v.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=v.useDependency(a.ICommandService),s=U.useMemo(()=>e.activeSheet$.pipe(H.map(C=>C==null?void 0:C.getSheetId())),[e.activeSheet$]),d=v.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=U.useRef(null),m=v.useDependency(g.ThreadCommentPanelService),l=v.useObservable(m.activeCommentId$),h=v.useObservable(m.panelVisible$,m.panelVisible),S=U.useCallback(C=>{const E=e.getSheets(),P={};E.forEach((O,T)=>{P[O.getSheetId()]=T});const j=O=>O.map(T=>{var he;const D=V.singleReferenceToGrid(T.ref),Ye=[(he=P[T.subUnitId])!=null?he:0,D.row,D.column];return{...T,p:Ye}}).sort((T,D)=>T.p[0]===D.p[0]?T.p[1]===D.p[1]?T.p[2]-D.p[2]:T.p[1]-D.p[1]:T.p[0]-D.p[0]);return[...j(C.filter(O=>!O.resolved)),...j(C.filter(O=>O.resolved))]},[e]),_=U.useCallback(C=>{var E;if(C.unitId===r&&C.subUnitId===d&&!C.resolved){const{row:P,column:j}=V.singleReferenceToGrid(C.ref),O=e.getSheetBySheetId(C.subUnitId),T=(E=O==null?void 0:O.getMergedCell(P,j))!=null?E:{startColumn:j,endColumn:j,startRow:P,endRow:P};if(!Number.isNaN(P)&&!Number.isNaN(j))return i.addShape({range:T,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[i,d,r]),I=C=>{var E,P;return(P=(E=e.getSheetBySheetId(C))==null?void 0:E.getName())!=null?P:""},y=()=>{o.executeCommand(k.id)},A=C=>{l&&l.unitId===C.unitId&&l.subUnitId===C.subUnitId&&l.commentId===C.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=_(C))},B=()=>{u.current&&(i.removeShape(u.current),u.current=null)},te=(C,E)=>{E&&n.hidePopup()};return U.useEffect(()=>{!h&&u.current&&i.removeShape(u.current)},[i,h]),re.jsx(g.ThreadCommentPanel,{unitId:r,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:y,getSubUnitName:I,onResolve:te,sortComments:S,onItemEnter:A,onItemLeave:B,onDeleteComment:()=>(B(),!0)})},Be=i=>({id:k.id,type:v.MenuItemType.BUTTON,icon:Y,title:"sheetThreadComment.menu.addComment",hidden$:v.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),Le=i=>({id:g.ToggleSheetCommentPanelOperation.id,type:v.MenuItemType.BUTTON,icon:Y,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:v.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),We={id:k.id,binding:v.KeyCode.M|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.ALT,preconditions:b.whenSheetEditorFocused},xe={[v.RibbonStartGroup.OTHERS]:{[g.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:Le}},[v.ContextMenuPosition.MAIN_AREA]:{[v.ContextMenuGroup.OTHERS]:{[k.id]:{order:0,menuItemFactory:Be}}}};var Fe=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Ge=(i,t,n,e)=>{for(var r=e>1?void 0:e?qe(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Fe(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);let K=class extends a.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(We)}_initMenu(){this._menuManagerService.mergeMenu(xe)}_initComponent(){[[ie,ke],[g.THREAD_COMMENT_PANEL,He],[Y,de]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};K=Ge([X(0,v.IMenuManagerService),X(1,a.Inject(v.ComponentManager)),X(2,v.IShortcutService)],K);var ue=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,ze=(i,t,n)=>t in i?ue(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,Ke=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ze(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&ue(t,n,r),r},ee=(i,t)=>(n,e)=>t(n,e,i),me=(i,t,n)=>ze(i,typeof t!="symbol"?t+"":t,n);c.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=se,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...s}=a.merge({},se,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Se,s)}onStarting(){[[K],[W],[x],[q],[z],[G],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[k].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(K)}onReady(){this._injector.get(W),this._injector.get(z)}onRendered(){this._injector.get(x),this._injector.get(q),this._injector.get(G)}},me(c.UniverSheetsThreadCommentUIPlugin,"pluginName",J),me(c.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=Ke([a.DependentOn(g.UniverThreadCommentUIPlugin,$.UniverSheetsThreadCommentPlugin),ee(1,a.Inject(a.Injector)),ee(2,a.Inject(a.ICommandService)),ee(3,a.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>g.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>f.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>f.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>f.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>f.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>f.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>f.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=J,c.ShowAddSheetCommentModalOperation=k,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-thread-comment-ui",
|
|
3
|
-
"version": "0.6.0-nightly.
|
|
3
|
+
"version": "0.6.0-nightly.202502121606",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer thread comment plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@univerjs/icons": "^0.2.14",
|
|
56
56
|
"clsx": "^2.1.1",
|
|
57
|
-
"@univerjs/core": "0.6.0-nightly.
|
|
58
|
-
"@univerjs/engine-
|
|
59
|
-
"@univerjs/sheets": "0.6.0-nightly.
|
|
60
|
-
"@univerjs/sheets-thread-comment": "0.6.0-nightly.
|
|
61
|
-
"@univerjs/
|
|
62
|
-
"@univerjs/sheets-ui": "0.6.0-nightly.
|
|
63
|
-
"@univerjs/
|
|
64
|
-
"@univerjs/ui": "0.6.0-nightly.
|
|
65
|
-
"@univerjs/
|
|
57
|
+
"@univerjs/core": "0.6.0-nightly.202502121606",
|
|
58
|
+
"@univerjs/engine-formula": "0.6.0-nightly.202502121606",
|
|
59
|
+
"@univerjs/sheets": "0.6.0-nightly.202502121606",
|
|
60
|
+
"@univerjs/sheets-thread-comment": "0.6.0-nightly.202502121606",
|
|
61
|
+
"@univerjs/thread-comment": "0.6.0-nightly.202502121606",
|
|
62
|
+
"@univerjs/sheets-ui": "0.6.0-nightly.202502121606",
|
|
63
|
+
"@univerjs/ui": "0.6.0-nightly.202502121606",
|
|
64
|
+
"@univerjs/thread-comment-ui": "0.6.0-nightly.202502121606",
|
|
65
|
+
"@univerjs/engine-render": "0.6.0-nightly.202502121606"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"postcss": "^8.5.1",
|