@univerjs/sheets-thread-comment-ui 0.5.5 → 0.6.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,16 @@
1
- import { default as React } from 'react';
2
- export declare const SheetsThreadCommentCell: () => React.JSX.Element | null;
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare const SheetsThreadCommentCell: () => import("react/jsx-runtime").JSX.Element | null;
@@ -1,2 +1,16 @@
1
- import { default as React } from 'react';
2
- export declare const SheetsThreadCommentPanel: () => React.JSX.Element;
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare const SheetsThreadCommentPanel: () => import("react/jsx-runtime").JSX.Element;
package/lib/umd/index.js CHANGED
@@ -1,9 +1 @@
1
- (function(d,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")):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"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.UniverSheetsThreadCommentUi={},d.UniverCore,d.UniverSheets,d.UniverSheetsThreadComment,d.UniverThreadCommentUi,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverEngineRender,d.UniverEngineFormula,d.UniverThreadComment,d.React))})(this,function(d,s,v,A,g,b,f,x,ie,k,C,E){"use strict";var rt=Object.defineProperty;var it=(d,s,v)=>s in d?rt(d,s,{enumerable:!0,configurable:!0,writable:!0,value:v}):d[s]=v;var N=(d,s,v)=>it(d,typeof s!="symbol"?s+"":s,v);const oe="univer.sheet.thread-comment-modal",K="comment-single",Q="SHEET_THREAD_COMMENT";var _e=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,Ce=(i,t,n,e)=>{for(var r=e>1?void 0:e?fe(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&&_e(t,n,r),r},se=(i,t)=>(n,e)=>t(n,e,i);d.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new x.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var m;const{row:r,col:o,unitId:a,subUnitId:c}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&c===((m=this.activePopup)==null?void 0:m.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const u=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:oe,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const h=new s.DisposableCollection;h.add(u),h.add({dispose:()=>{e==null||e()}}),this._lastPopup=h}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}},d.SheetsThreadCommentPopupService=Ce([se(0,s.Inject(b.SheetCanvasPopManagerService)),se(1,f.IZenZoneService)],d.SheetsThreadCommentPopupService);const $={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var I;const t=i.get(v.SheetsSelectionsService),n=i.get(s.IUniverInstanceService),e=i.get(d.SheetsThreadCommentPopupService),r=i.get(g.ThreadCommentPanelService),o=(I=t.getCurrentLastSelection())==null?void 0:I.primary,a=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const c=v.getSheetCommandTarget(n);if(!c)return!1;const{workbook:u,worksheet:h,unitId:m,subUnitId:l}=c,p={workbook:u,worksheet:h,unitId:m,subUnitId:l,row:o.startRow,col:o.startColumn};e.showPopup(p);const S=a.getByLocation(m,l,o.startRow,o.startColumn);return S&&r.setActiveComment({unitId:m,subUnitId:l,commentId:S,trigger:"context-menu"}),!0}},Ie="sheets-thread-comment.config",ae={};var ge=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Te=(i,t,n,e)=>{for(var r=e>1?void 0:e?Pe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&ge(t,n,r),r},B=(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(v.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(x.debounceTime(16)).subscribe(()=>{i()}))}};W=Te([B(0,s.Inject(v.SheetInterceptorService)),B(1,s.Inject(A.SheetsThreadCommentModel)),B(2,s.IUniverInstanceService),B(3,ie.IRenderManagerService)],W);var be=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,Me=(i,t,n,e)=>{for(var r=e>1?void 0:e?ye(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&be(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);const we=(i,t,n)=>{const e=k.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 k.serializeRange(a)};let F=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:Q,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:a,range:c}=n,u={row:c.rows[0],column:c.cols[0]};if(r.copyType===b.COPY_TYPE.CUT&&this._copyInfo){const{range:h,unitId:m,subUnitId:l}=this._copyInfo,p={row:h.startRow,column:h.startColumn};if(!(o===m&&a===l)){const S=[];s.Range.foreach(h,(w,_)=>{const R=this._sheetsThreadCommentModel.getAllByLocation(m,l,w,_);this._threadCommentDataSourceService.syncUpdateMutationToColla?R.forEach(P=>{S.push(P)}):R.forEach(({children:P,...j})=>{j.parentId||S.push(j)})});const I=[],M=[],V=[],L=[],re=w=>{I.unshift({id:C.DeleteCommentMutation.id,params:{unitId:m,subUnitId:l,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:we(w.ref,p,u),unitId:o,subUnitId:a},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:m,subUnitId:l,comment:w,sync:!0}}),L.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:a,commentId:w.id}})};return S.forEach(w=>{re(w)}),{redos:[...I,...V],undos:[...L,...M]}}}return{redos:[],undos:[]}}}))}};F=Me([X(0,s.Inject(b.ISheetClipboardService)),X(1,s.Inject(A.SheetsThreadCommentModel)),X(2,C.IThreadCommentDataSourceService)],F);var Re=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Re(t,n,r),r},G=(i,t)=>(n,e)=>t(n,e,i);let Z=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(x.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,c=this._sheetsThreadCommentModel.getByLocation(e,r,o,a);if(c){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:a,endRow:o,endColumn:a}]))return;const h=this._sheetsThreadCommentModel.getComment(e,r,c);h&&!h.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:a,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};Z=Oe([G(0,s.Inject(b.HoverManagerService)),G(1,s.Inject(d.SheetsThreadCommentPopupService)),G(2,s.Inject(A.SheetsThreadCommentModel)),G(3,s.Inject(v.SheetPermissionCheckController))],Z);var Ue=Object.defineProperty,je=Object.getOwnPropertyDescriptor,De=(i,t,n,e)=>{for(var r=e>1?void 0:e?je(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ue(t,n,r),r},U=(i,t)=>(n,e)=>t(n,e,i);let z=class extends s.Disposable{constructor(t,n,e,r,o,a,c,u,h,m){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=o,this._sheetPermissionCheckController=a,this._markSelectionService=c,this._sheetSelectionService=u,this._editorBridgeService=h,this._renderManagerService=m,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var p,S,I;const r=(p=t[0])==null?void 0:p.range,o=this._renderManagerService.getRenderById(n),a=(S=o==null?void 0:o.with(b.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:S.skeleton;if(!a||!r)return;const c=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)&&!((c.isMerged||c.isMergedMainCell)&&s.Rectangle.equals(c.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const h=c.actualRow,m=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,h,m)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const l=this._sheetsThreadCommentModel.getByLocation(n,e,h,m);l&&this._commandService.executeCommand(g.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:l})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId: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,c=this._sheetsThreadCommentModel.getComment(e,r,o);if(!c||c.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=u.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(v.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const l=k.singleReferenceToGrid(c.ref),{row:p,column:S}=l;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:S,endRow:p,endColumn:S}]))return;const M=1;if(await this._commandService.executeCommand(b.ScrollToRangeOperation.id,{range:{startRow:Math.max(l.row-M,0),endRow:l.row+M,startColumn:Math.max(l.column-M,0),endColumn:l.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:l.row,col:l.column,commentId:c.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(x.debounceTime(100)).subscribe(t=>{var p,S;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(n,e,r);if(!o)return;const a=k.singleReferenceToGrid(o.ref),{row:c,column:u}=a;if(Number.isNaN(c)||Number.isNaN(u))return null;const h=(p=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getSheetBySheetId(e),m=(S=h==null?void 0:h.getMergedCell(c,u))!=null?S:{startColumn:u,endColumn:u,startRow:c,endRow:c},l=this._markSelectionService.addShape({range:m,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);l&&(this._selectionShapeInfo={...t,shapeId:l})}))}};z=De([U(0,s.ICommandService),U(1,s.Inject(d.SheetsThreadCommentPopupService)),U(2,s.Inject(A.SheetsThreadCommentModel)),U(3,s.Inject(g.ThreadCommentPanelService)),U(4,s.IUniverInstanceService),U(5,s.Inject(v.SheetPermissionCheckController)),U(6,b.IMarkSelectionService),U(7,s.Inject(v.SheetsSelectionsService)),U(8,b.IEditorBridgeService),U(9,ie.IRenderManagerService)],z);var Ne=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,Ve=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ae(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ne(t,n,r),r},q=(i,t)=>(n,e)=>t(n,e,i);let Y=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===v.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),c=Array.from(a.values()).filter(p=>!p.parentId),u=c.map(p=>p.id),h=this._threadCommentDataSourceService.syncUpdateMutationToColla,m=u.map(p=>({id:C.DeleteCommentMutation.id,params:{unitId:r,subUnitId:o,commentId:p}})),l=c.map(({children:p,...S})=>({id:C.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{...S,children:h?p:void 0},sync:!h}}));return{redos:m,undos:l}}return{redos:[],undos:[]}}}))}};Y=Ve([q(0,s.Inject(v.SheetInterceptorService)),q(1,s.IUniverInstanceService),q(2,s.Inject(C.ThreadCommentModel)),q(3,C.IThreadCommentDataSourceService)],Y);var y=function(){return y=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},y.apply(this,arguments)},ke=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},ce=E.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,a=ke(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),u=E.useRef("_".concat(He()));return ue(n,"".concat(e),{defIds:n.defIds,idSuffix:u.current},y({ref:t,className:c},a),o)});function ue(i,t,n,e,r){return E.createElement(i.tag,y(y({key:t},$e(i,n,r)),e),(xe(i,n).children||[]).map(function(o,a){return ue(o,"".concat(t,"-").concat(i.tag,"-").concat(a),n,void 0,r)}))}function $e(i,t,n){var e=y({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],c=o[1];typeof c=="string"&&(e[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function xe(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?y(y({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?y(y({},r),{attrs:y(y({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function He(){return Math.random().toString(36).substring(2,8)}ce.displayName="UniverIcon";var Le={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=E.forwardRef(function(i,t){return E.createElement(ce,Object.assign({},i,{id:"comment-single",ref:t,icon:Le}))});de.displayName="CommentSingle";var ee={exports:{}},H={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var me;function Be(){if(me)return H;me=1;var i=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(c,u,h){var m,l={},p=null,S=null;h!==void 0&&(p=""+h),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(S=u.ref);for(m in u)e.call(u,m)&&!o.hasOwnProperty(m)&&(l[m]=u[m]);if(c&&c.defaultProps)for(m in u=c.defaultProps,u)l[m]===void 0&&(l[m]=u[m]);return{$$typeof:t,type:c,key:p,ref:S,props:l,_owner:r.current}}return H.Fragment=n,H.jsx=a,H.jsxs=a,H}var he;function We(){return he||(he=1,ee.exports=Be()),ee.exports}var le=We();const Fe=()=>{const i=s.useDependency(s.IUniverInstanceService),t=s.useDependency(d.SheetsThreadCommentPopupService),n=f.useObservable(t.activePopup$),e=s.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:a,subUnitId:c,trigger:u}=n,h=e.getByLocation(a,c,r,o),m=`${s.Tools.chatAtABC(o)}${r+1}`,l=()=>{t.hidePopup()},p=S=>{var I,M,V;return(V=(M=(I=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getSheetBySheetId(S))==null?void 0:M.getName())!=null?V:""};return le.jsx(g.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:h,unitId:a,subUnitId:c,type:s.UniverInstanceType.UNIVER_SHEET,refStr:m,onClose:l,getSubUnitName:p,autoFocus:u==="context-menu"})},Ge=()=>{var w;const i=s.useDependency(b.IMarkSelectionService),t=s.useDependency(s.IUniverInstanceService),n=s.useDependency(d.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=s.useDependency(s.ICommandService),a=E.useMemo(()=>e.activeSheet$.pipe(x.map(_=>_==null?void 0:_.getSheetId())),[e.activeSheet$]),c=f.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),h=s.useDependency(g.ThreadCommentPanelService),m=f.useObservable(h.activeCommentId$),l=f.useObservable(h.panelVisible$,h.panelVisible),p=E.useCallback(_=>{const R=e.getSheets(),P={};R.forEach((O,T)=>{P[O.getSheetId()]=T});const j=O=>O.map(T=>{var Se;const D=k.singleReferenceToGrid(T.ref),nt=[(Se=P[T.subUnitId])!=null?Se:0,D.row,D.column];return{...T,p:nt}}).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(_.filter(O=>!O.resolved)),...j(_.filter(O=>O.resolved))]},[e]),S=E.useCallback(_=>{var R;if(_.unitId===r&&_.subUnitId===c&&!_.resolved){const{row:P,column:j}=k.singleReferenceToGrid(_.ref),O=e.getSheetBySheetId(_.subUnitId),T=(R=O==null?void 0:O.getMergedCell(P,j))!=null?R:{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})}},[i,c,r]),I=_=>{var R,P;return(P=(R=e.getSheetBySheetId(_))==null?void 0:R.getName())!=null?P:""},M=()=>{o.executeCommand($.id)},V=_=>{m&&m.unitId===_.unitId&&m.subUnitId===_.subUnitId&&m.commentId===_.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=S(_))},L=()=>{u.current&&(i.removeShape(u.current),u.current=null)},re=(_,R)=>{R&&n.hidePopup()};return E.useEffect(()=>{!l&&u.current&&i.removeShape(u.current)},[i,l]),le.jsx(g.ThreadCommentPanel,{unitId:r,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:I,onResolve:re,sortComments:p,onItemEnter:V,onItemLeave:L,onDeleteComment:()=>(L(),!0)})},Ze=i=>({id:$.id,type:f.MenuItemType.BUTTON,icon:K,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]})}),ze=i=>({id:g.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:K,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET)}),qe={id:$.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:b.whenSheetEditorFocused},Ye={[f.RibbonStartGroup.OTHERS]:{[g.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:ze}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[$.id]:{order:0,menuItemFactory:Ze}}}};var Je=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Qe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Je(t,n,r),r},te=(i,t)=>(n,e)=>t(n,e,i);let J=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(qe)}_initMenu(){this._menuManagerService.mergeMenu(Ye)}_initComponent(){[[oe,Fe],[g.THREAD_COMMENT_PANEL,Ge],[K,de]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};J=Qe([te(0,f.IMenuManagerService),te(1,s.Inject(f.ComponentManager)),te(2,f.IShortcutService)],J);var pe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(i,t,n)=>t in i?pe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,tt=(i,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&pe(t,n,r),r},ne=(i,t)=>(n,e)=>t(n,e,i),ve=(i,t,n)=>et(i,typeof t!="symbol"?t+"":t,n);d.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=ae,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...a}=s.merge({},ae,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ie,a)}onStarting(){[[J],[W],[F],[Z],[Y],[z],[d.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[$].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(J)}onReady(){this._injector.get(W),this._injector.get(Y)}onRendered(){this._injector.get(F),this._injector.get(Z),this._injector.get(z)}},ve(d.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),ve(d.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentUIPlugin=tt([s.DependentOn(g.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),ne(1,s.Inject(s.Injector)),ne(2,s.Inject(s.ICommandService)),ne(3,s.IConfigService)],d.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(d,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>g.UniverThreadCommentUIPlugin}),Object.defineProperty(d,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(d,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(d,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(d,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(d,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(d,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),d.SHEETS_THREAD_COMMENT=Q,d.ShowAddSheetCommentModalOperation=$,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment"),require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","@univerjs/engine-formula","@univerjs/thread-comment","react/jsx-runtime","react"],s):(c=typeof globalThis<"u"?globalThis:c||self,s(c.UniverSheetsThreadCommentUi={},c.UniverCore,c.UniverSheets,c.UniverSheetsThreadComment,c.UniverThreadCommentUi,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverEngineRender,c.UniverEngineFormula,c.UniverThreadComment,c.React,c.React))})(this,function(c,s,p,$,g,b,_,H,ne,V,f,re,U){"use strict";var Je=Object.defineProperty;var Qe=(c,s,p)=>s in c?Je(c,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[s]=p;var N=(c,s,p)=>Qe(c,typeof s!="symbol"?s+"":s,p);const ie="univer.sheet.thread-comment-modal",Y="comment-single",J="SHEET_THREAD_COMMENT";var le=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,ve=(i,t,n,e)=>{for(var r=e>1?void 0:e?pe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&le(t,n,r),r},oe=(i,t)=>(n,e)=>t(n,e,i);c.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new H.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var l;const{row:r,col:o,unitId:a,subUnitId:u}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&u===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const d=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!d)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new s.DisposableCollection;m.add(d),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}},c.SheetsThreadCommentPopupService=ve([oe(0,s.Inject(b.SheetCanvasPopManagerService)),oe(1,_.IZenZoneService)],c.SheetsThreadCommentPopupService);const k={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var I;const t=i.get(p.SheetsSelectionsService),n=i.get(s.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),r=i.get(g.ThreadCommentPanelService),o=(I=t.getCurrentLastSelection())==null?void 0:I.primary,a=i.get($.SheetsThreadCommentModel);if(!o)return!1;const u=p.getSheetCommandTarget(n);if(!u)return!1;const{workbook:d,worksheet:m,unitId:l,subUnitId:h}=u,v={workbook:d,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(v);const C=a.getByLocation(l,h,o.startRow,o.startColumn);return C&&r.setActiveComment({unitId:l,subUnitId:h,commentId:C,trigger:"context-menu"}),!0}},Se="sheets-thread-comment.config",se={};var Ce=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,fe=(i,t,n,e)=>{for(var r=e>1?void 0:e?_e(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ce(t,n,r),r},L=(i,t)=>(n,e)=>t(n,e,i);let W=class extends s.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(i,t,n)=>{const{row:e,col:r,unitId:o,subUnitId:a}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,a,e,r)?n({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):n(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(H.debounceTime(16)).subscribe(()=>{i()}))}};W=fe([L(0,s.Inject(p.SheetInterceptorService)),L(1,s.Inject($.SheetsThreadCommentModel)),L(2,s.IUniverInstanceService),L(3,ne.IRenderManagerService)],W);var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,n,e)=>{for(var r=e>1?void 0:e?ge(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ie(t,n,r),r},Q=(i,t)=>(n,e)=>t(n,e,i);const Te=(i,t,n)=>{const e=V.singleReferenceToGrid(i),r=n.row-t.row,o=n.column-t.column,a={startColumn:e.column+o,startRow:e.row+r,endColumn:e.column+o,endRow:e.row+r};return V.serializeRange(a)};let x=class extends s.Disposable{constructor(t,n,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:J,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:a,range:u}=n,d={row:u.rows[0],column:u.cols[0]};if(r.copyType===b.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,v={row:m.startRow,column:m.startColumn};if(!(o===l&&a===h)){const C=[];s.Range.foreach(m,(w,S)=>{const E=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,S);this._threadCommentDataSourceService.syncUpdateMutationToColla?E.forEach(P=>{C.push(P)}):E.forEach(({children:P,...j})=>{j.parentId||C.push(j)})});const I=[],y=[],A=[],B=[],te=w=>{I.unshift({id:f.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),A.push({id:f.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:Te(w.ref,v,d),unitId:o,subUnitId:a},sync:!0}}),y.push({id:f.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),B.unshift({id:f.DeleteCommentMutation.id,params:{unitId:o,subUnitId:a,commentId:w.id}})};return C.forEach(w=>{te(w)}),{redos:[...I,...A],undos:[...B,...y]}}}return{redos:[],undos:[]}}}))}};x=Pe([Q(0,s.Inject(b.ISheetClipboardService)),Q(1,s.Inject($.SheetsThreadCommentModel)),Q(2,f.IThreadCommentDataSourceService)],x);var be=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,ye=(i,t,n,e)=>{for(var r=e>1?void 0:e?Me(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&be(t,n,r),r},F=(i,t)=>(n,e)=>t(n,e,i);let q=class extends s.Disposable{constructor(i,t,n,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(H.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:n}=i,{unitId:e,subUnitId:r,row:o,col:a}=n,u=this._sheetsThreadCommentModel.getByLocation(e,r,o,a);if(u){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:a,endRow:o,endColumn:a}]))return;const m=this._sheetsThreadCommentModel.getComment(e,r,u);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:a,commentId:u,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=ye([F(0,s.Inject(b.HoverManagerService)),F(1,s.Inject(c.SheetsThreadCommentPopupService)),F(2,s.Inject($.SheetsThreadCommentModel)),F(3,s.Inject(p.SheetPermissionCheckController))],q);var we=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&we(t,n,r),r},R=(i,t)=>(n,e)=>t(n,e,i);let G=class extends s.Disposable{constructor(t,n,e,r,o,a,u,d,m,l){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=o,this._sheetPermissionCheckController=a,this._markSelectionService=u,this._sheetSelectionService=d,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var v,C,I;const r=(v=t[0])==null?void 0:v.range,o=this._renderManagerService.getRenderById(n),a=(C=o==null?void 0:o.with(b.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:C.skeleton;if(!a||!r)return;const u=a.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((I=r.rangeType)!=null?I:s.RANGE_TYPE.NORMAL)!==s.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((u.isMerged||u.isMergedMainCell)&&s.Rectangle.equals(u.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const m=u.actualRow,l=u.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(n,e,m,l);h&&this._commandService.executeCommand(g.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===f.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId:a}=e;n.unitId===r&&n.subUnitId===o&&n.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:o,trigger:a}=t,u=this._sheetsThreadCommentModel.getComment(e,r,o);if(!u||u.resolved)return;const d=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!d||d.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=d.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const h=V.singleReferenceToGrid(u.ref),{row:v,column:C}=h;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:v,startColumn:C,endRow:v,endColumn:C}]))return;const y=1;if(await this._commandService.executeCommand(b.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-y,0),endRow:h.row+y,startColumn:Math.max(h.column-y,0),endColumn:h.column+y}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:h.row,col:h.column,commentId:u.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(H.debounceTime(100)).subscribe(t=>{var v,C;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(n,e,r);if(!o)return;const a=V.singleReferenceToGrid(o.ref),{row:u,column:d}=a;if(Number.isNaN(u)||Number.isNaN(d))return null;const m=(v=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getSheetBySheetId(e),l=(C=m==null?void 0:m.getMergedCell(u,d))!=null?C:{startColumn:d,endColumn:d,startRow:u,endRow:u},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};G=Oe([R(0,s.ICommandService),R(1,s.Inject(c.SheetsThreadCommentPopupService)),R(2,s.Inject($.SheetsThreadCommentModel)),R(3,s.Inject(g.ThreadCommentPanelService)),R(4,s.IUniverInstanceService),R(5,s.Inject(p.SheetPermissionCheckController)),R(6,b.IMarkSelectionService),R(7,s.Inject(p.SheetsSelectionsService)),R(8,b.IEditorBridgeService),R(9,ne.IRenderManagerService)],G);var Ue=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,je=(i,t,n,e)=>{for(var r=e>1?void 0:e?Re(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ue(t,n,r),r},Z=(i,t)=>(n,e)=>t(n,e,i);let z=class extends s.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===p.RemoveSheetCommand.id){const n=i.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const a=this._threadCommentModel.ensureMap(r,o),u=Array.from(a.values()).filter(v=>!v.parentId),d=u.map(v=>v.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=d.map(v=>({id:f.DeleteCommentMutation.id,params:{unitId:r,subUnitId:o,commentId:v}})),h=u.map(({children:v,...C})=>({id:f.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{...C,children:m?v:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};z=je([Z(0,s.Inject(p.SheetInterceptorService)),Z(1,s.IUniverInstanceService),Z(2,s.Inject(f.ThreadCommentModel)),Z(3,f.IThreadCommentDataSourceService)],z);var M=function(){return M=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},M.apply(this,arguments)},De=function(i,t){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(n[e[r]]=i[e[r]]);return n},ae=U.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,a=De(i,["icon","id","className","extend"]),u="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),d=U.useRef("_".concat(Ae()));return ce(n,"".concat(e),{defIds:n.defIds,idSuffix:d.current},M({ref:t,className:u},a),o)});function ce(i,t,n,e,r){return U.createElement(i.tag,M(M({key:t},Ne(i,n,r)),e),($e(i,n).children||[]).map(function(o,a){return ce(o,"".concat(t,"-").concat(i.tag,"-").concat(a),n,void 0,r)}))}function Ne(i,t,n){var e=M({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],u=o[1];typeof u=="string"&&(e[a]=u.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function $e(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?M(M({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?M(M({},r),{attrs:M(M({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function Ae(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var Ve={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ue=U.forwardRef(function(i,t){return U.createElement(ae,Object.assign({},i,{id:"comment-single",ref:t,icon:Ve}))});ue.displayName="CommentSingle";const ke=()=>{const i=s.useDependency(s.IUniverInstanceService),t=s.useDependency(c.SheetsThreadCommentPopupService),n=_.useObservable(t.activePopup$),e=s.useDependency($.SheetsThreadCommentModel);if(_.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:a,subUnitId:u,trigger:d}=n,m=e.getByLocation(a,u,r,o),l=`${s.Tools.chatAtABC(o)}${r+1}`,h=()=>{t.hidePopup()},v=C=>{var I,y,A;return(A=(y=(I=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getSheetBySheetId(C))==null?void 0:y.getName())!=null?A:""};return re.jsx(g.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:a,subUnitId:u,type:s.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:v,autoFocus:d==="context-menu"})},He=()=>{var w;const i=s.useDependency(b.IMarkSelectionService),t=s.useDependency(s.IUniverInstanceService),n=s.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=s.useDependency(s.ICommandService),a=U.useMemo(()=>e.activeSheet$.pipe(H.map(S=>S==null?void 0:S.getSheetId())),[e.activeSheet$]),u=_.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),d=U.useRef(null),m=s.useDependency(g.ThreadCommentPanelService),l=_.useObservable(m.activeCommentId$),h=_.useObservable(m.panelVisible$,m.panelVisible),v=U.useCallback(S=>{const E=e.getSheets(),P={};E.forEach((O,T)=>{P[O.getSheetId()]=T});const j=O=>O.map(T=>{var he;const D=V.singleReferenceToGrid(T.ref),Ye=[(he=P[T.subUnitId])!=null?he:0,D.row,D.column];return{...T,p:Ye}}).sort((T,D)=>T.p[0]===D.p[0]?T.p[1]===D.p[1]?T.p[2]-D.p[2]:T.p[1]-D.p[1]:T.p[0]-D.p[0]);return[...j(S.filter(O=>!O.resolved)),...j(S.filter(O=>O.resolved))]},[e]),C=U.useCallback(S=>{var E;if(S.unitId===r&&S.subUnitId===u&&!S.resolved){const{row:P,column:j}=V.singleReferenceToGrid(S.ref),O=e.getSheetBySheetId(S.subUnitId),T=(E=O==null?void 0:O.getMergedCell(P,j))!=null?E:{startColumn:j,endColumn:j,startRow:P,endRow:P};if(!Number.isNaN(P)&&!Number.isNaN(j))return i.addShape({range:T,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[i,u,r]),I=S=>{var E,P;return(P=(E=e.getSheetBySheetId(S))==null?void 0:E.getName())!=null?P:""},y=()=>{o.executeCommand(k.id)},A=S=>{l&&l.unitId===S.unitId&&l.subUnitId===S.subUnitId&&l.commentId===S.id||(d.current&&(i.removeShape(d.current),d.current=null),d.current=C(S))},B=()=>{d.current&&(i.removeShape(d.current),d.current=null)},te=(S,E)=>{E&&n.hidePopup()};return U.useEffect(()=>{!h&&d.current&&i.removeShape(d.current)},[i,h]),re.jsx(g.ThreadCommentPanel,{unitId:r,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:y,getSubUnitName:I,onResolve:te,sortComments:v,onItemEnter:A,onItemLeave:B,onDeleteComment:()=>(B(),!0)})},Be=i=>({id:k.id,type:_.MenuItemType.BUTTON,icon:Y,title:"sheetThreadComment.menu.addComment",hidden$:_.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),Le=i=>({id:g.ToggleSheetCommentPanelOperation.id,type:_.MenuItemType.BUTTON,icon:Y,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:_.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET)}),We={id:k.id,binding:_.KeyCode.M|_.MetaKeys.CTRL_COMMAND|_.MetaKeys.ALT,preconditions:b.whenSheetEditorFocused},xe={[_.RibbonStartGroup.OTHERS]:{[g.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:Le}},[_.ContextMenuPosition.MAIN_AREA]:{[_.ContextMenuGroup.OTHERS]:{[k.id]:{order:0,menuItemFactory:Be}}}};var Fe=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Ge=(i,t,n,e)=>{for(var r=e>1?void 0:e?qe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Fe(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);let K=class extends s.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(We)}_initMenu(){this._menuManagerService.mergeMenu(xe)}_initComponent(){[[ie,ke],[g.THREAD_COMMENT_PANEL,He],[Y,ue]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};K=Ge([X(0,_.IMenuManagerService),X(1,s.Inject(_.ComponentManager)),X(2,_.IShortcutService)],K);var de=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,ze=(i,t,n)=>t in i?de(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,Ke=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ze(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&de(t,n,r),r},ee=(i,t)=>(n,e)=>t(n,e,i),me=(i,t,n)=>ze(i,typeof t!="symbol"?t+"":t,n);c.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=se,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...a}=s.merge({},se,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Se,a)}onStarting(){[[K],[W],[x],[q],[z],[G],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[k].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(K)}onReady(){this._injector.get(W),this._injector.get(z)}onRendered(){this._injector.get(x),this._injector.get(q),this._injector.get(G)}},me(c.UniverSheetsThreadCommentUIPlugin,"pluginName",J),me(c.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=Ke([s.DependentOn(g.UniverThreadCommentUIPlugin,$.UniverSheetsThreadCommentPlugin),ee(1,s.Inject(s.Injector)),ee(2,s.Inject(s.ICommandService)),ee(3,s.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>g.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>f.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>f.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>f.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>f.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>f.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>f.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=J,c.ShowAddSheetCommentModalOperation=k,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-thread-comment-ui",
3
- "version": "0.5.5",
3
+ "version": "0.6.0-alpha.0",
4
4
  "private": false,
5
5
  "description": "Univer thread comment plugin",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -48,31 +48,31 @@
48
48
  "lib"
49
49
  ],
50
50
  "peerDependencies": {
51
- "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
51
+ "react": ">=16.9.0 || >=17 || >=18 || >=19",
52
52
  "rxjs": ">=7.0.0"
53
53
  },
54
54
  "dependencies": {
55
- "@univerjs/icons": "^0.2.12",
55
+ "@univerjs/icons": "^0.2.14",
56
56
  "clsx": "^2.1.1",
57
- "@univerjs/core": "0.5.5",
58
- "@univerjs/engine-formula": "0.5.5",
59
- "@univerjs/sheets-thread-comment": "0.5.5",
60
- "@univerjs/engine-render": "0.5.5",
61
- "@univerjs/sheets-ui": "0.5.5",
62
- "@univerjs/thread-comment": "0.5.5",
63
- "@univerjs/ui": "0.5.5",
64
- "@univerjs/sheets": "0.5.5",
65
- "@univerjs/thread-comment-ui": "0.5.5"
57
+ "@univerjs/core": "0.6.0-alpha.0",
58
+ "@univerjs/engine-formula": "0.6.0-alpha.0",
59
+ "@univerjs/engine-render": "0.6.0-alpha.0",
60
+ "@univerjs/sheets-thread-comment": "0.6.0-alpha.0",
61
+ "@univerjs/sheets": "0.6.0-alpha.0",
62
+ "@univerjs/sheets-ui": "0.6.0-alpha.0",
63
+ "@univerjs/thread-comment": "0.6.0-alpha.0",
64
+ "@univerjs/thread-comment-ui": "0.6.0-alpha.0",
65
+ "@univerjs/ui": "0.6.0-alpha.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "postcss": "^8.4.49",
69
69
  "react": "18.3.1",
70
70
  "rxjs": "^7.8.1",
71
71
  "tailwindcss": "^3.4.17",
72
- "typescript": "^5.7.2",
72
+ "typescript": "^5.7.3",
73
73
  "vite": "^6.0.7",
74
74
  "vitest": "^2.1.8",
75
- "@univerjs-infra/shared": "0.5.5"
75
+ "@univerjs-infra/shared": "0.6.0-alpha.0"
76
76
  },
77
77
  "scripts": {
78
78
  "test": "vitest run",