@univerjs/thread-comment-ui 0.2.3 → 0.2.4

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/index.css CHANGED
@@ -1 +1 @@
1
- .univer-thread-comment-editor-buttons{margin-top:12px;display:flex;flex-direction:row;justify-content:flex-end}.univer-thread-comment-editor-suggestion{display:flex;align-items:center;font-size:13px;color:rgb(var(--color-black))}.univer-thread-comment-editor-suggestionActive{background-color:rgba(var(--grey-50))}.univer-thread-comment-editor-suggestion-icon{width:24px;height:24px;border-radius:12px;margin-right:6px}.univer-thread-comment{padding:16px;background:rgba(var(--color-white));border:1px solid rgba(var(--grey-200));width:279px;border-radius:8px;box-sizing:border-box;position:relative}.univer-thread-comment-active{box-shadow:var(--box-shadow-base)}.univer-thread-comment-content{max-height:300px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin}.univer-thread-comment-highlight{background-color:rgb(var(--gold-400));position:absolute;top:0;left:0;right:0;height:6px;border-top-left-radius:6px;border-top-right-radius:6px}.univer-thread-comment-icon-container{display:flex;flex-direction:row;flex-shrink:0;flex-grow:0}.univer-thread-comment-icon{width:24px;height:24px;border-radius:3px;margin-left:4px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;font-size:16px}.univer-thread-comment-icon:hover{background-color:rgba(var(--grey-50))}.univer-thread-comment-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;margin-bottom:16px;font-size:14px;line-height:20px}.univer-thread-comment-title-position{display:flex;flex-direction:row;align-items:center;flex:1 1 0;overflow:hidden}.univer-thread-comment-title-highlight{width:3px;height:14px;border-radius:1.5px;background-color:rgba(var(--gold-400));margin-right:8px;flex-shrink:0;flex-grow:0}.univer-thread-comment-title-position-text{flex:1 1 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.univer-thread-comment-username{font-size:14px;font-weight:500;line-height:20px}.univer-thread-comment-item{margin-bottom:12px;padding-left:30px;position:relative}.univer-thread-comment-item-head{width:24px;height:24px;border-radius:12px;position:absolute;left:0;top:0}.univer-thread-comment-item-title{display:flex;justify-content:space-between;height:24px;align-items:center;margin-bottom:4px}.univer-thread-comment-item-title-position{color:rgba(var(--color-black));font-size:14px;line-height:20px}.univer-thread-comment-item-title-highlight{width:3px;height:14px;border-radius:2px;margin-right:8px;margin-top:3px;background-color:rgba(var(--gold-400))}.univer-thread-comment-item-time{font-size:12px;line-height:1.5;margin-bottom:4px;color:rgba(var(--grey-600))}.univer-thread-comment-item-content{font-size:13px;line-height:20px;word-break:break-all;color:rgba(var(--color-black))}.univer-thread-comment-item-at{color:rgba(var(--blue-400))}.univer-thread-comment-panel{min-height:100%;display:flex;flex-direction:column}.univer-thread-comment-panel .univer-thread-comment{margin-top:12px}.univer-thread-comment-panel-forms{display:flex;flex-direction:row;justify-content:space-between;margin-top:12px}.univer-thread-comment-panel-forms .univer-select{width:120px}.univer-thread-comment-panel-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--grey-600));font-size:13px;flex:1}.univer-thread-comment-panel-add{margin-top:8px;display:flex;flex-direction:row}.univer-thread-comment-panel-add svg{margin-right:6px}
1
+ .univer-thread-comment-editor-buttons{margin-top:12px;display:flex;flex-direction:row;justify-content:flex-end}.univer-thread-comment-editor-suggestion{display:flex;align-items:center;font-size:13px;color:rgb(var(--color-black))}.univer-thread-comment-editor-suggestionActive{background-color:rgba(var(--grey-50))}.univer-thread-comment-editor-suggestion-icon{width:24px;height:24px;border-radius:12px;margin-right:6px}.univer-thread-comment{padding:16px;background:rgba(var(--color-white));border:1px solid rgba(var(--grey-200));width:279px;border-radius:8px;box-sizing:border-box;position:relative}.univer-thread-comment-active{box-shadow:var(--box-shadow-base)}.univer-thread-comment-content{max-height:300px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin}.univer-thread-comment-highlight{background-color:rgb(var(--gold-400));position:absolute;top:0;left:0;right:0;height:6px;border-top-left-radius:6px;border-top-right-radius:6px}.univer-thread-comment-icon-container{display:flex;flex-direction:row;flex-shrink:0;flex-grow:0}.univer-thread-comment-icon{width:24px;height:24px;border-radius:3px;margin-left:4px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;font-size:16px}.univer-thread-comment-icon:hover{background-color:rgba(var(--grey-50))}.univer-thread-comment-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;margin-bottom:16px;font-size:14px;line-height:20px}.univer-thread-comment-title-position{display:flex;flex-direction:row;align-items:center;flex:1 1 0;overflow:hidden}.univer-thread-comment-title-highlight{width:3px;height:14px;border-radius:1.5px;background-color:rgba(var(--gold-400));margin-right:8px;flex-shrink:0;flex-grow:0}.univer-thread-comment-title-position-text{flex:1 1 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.univer-thread-comment-username{font-size:14px;font-weight:500;line-height:20px}.univer-thread-comment-item{margin-bottom:12px;padding-left:30px;position:relative}.univer-thread-comment-item-head{width:24px;height:24px;border-radius:12px;position:absolute;left:0;top:0}.univer-thread-comment-item-title{display:flex;justify-content:space-between;height:24px;align-items:center;margin-bottom:4px}.univer-thread-comment-item-title-position{color:rgba(var(--color-black));font-size:14px;line-height:20px}.univer-thread-comment-item-title-highlight{width:3px;height:14px;border-radius:2px;margin-right:8px;margin-top:3px;background-color:rgba(var(--gold-400))}.univer-thread-comment-item-time{font-size:12px;line-height:1.5;margin-bottom:4px;color:rgba(var(--grey-600))}.univer-thread-comment-item-content{font-size:13px;line-height:20px;word-break:break-all;color:rgba(var(--color-black))}.univer-thread-comment-item-at{color:rgba(var(--blue-400))}.univer-thread-comment-panel{min-height:100%;display:flex;flex-direction:column;padding-bottom:12px}.univer-thread-comment-panel .univer-thread-comment{margin-top:12px}.univer-thread-comment-panel-forms{display:flex;flex-direction:row;justify-content:space-between;margin-top:12px}.univer-thread-comment-panel-forms .univer-select{width:120px}.univer-thread-comment-panel-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--grey-600));font-size:13px;flex:1}.univer-thread-comment-panel-add{margin-top:8px;display:flex;flex-direction:row}.univer-thread-comment-panel-add svg{margin-right:6px}.univer-thread-comment-panel-solved{margin-top:12px;font-size:var(--font-size-xs)}
package/lib/umd/index.js CHANGED
@@ -1,3 +1,3 @@
1
- (function(s,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("dayjs"),require("@univerjs/thread-comment"),require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@wendellhu/redi/react-bindings"),require("@univerjs/design"),require("clsx"),require("@univerjs/engine-render"),require("@univerjs/docs")):typeof define=="function"&&define.amd?define(["exports","dayjs","@univerjs/thread-comment","@univerjs/core","@wendellhu/redi","@univerjs/ui","rxjs","react","@wendellhu/redi/react-bindings","@univerjs/design","clsx","@univerjs/engine-render","@univerjs/docs"],P):(s=typeof globalThis<"u"?globalThis:s||self,P(s.UniverThreadCommentUi={},s.dayjs,s.UniverThreadComment,s.UniverCore,s["@wendellhu/redi"],s.UniverUi,s.rxjs,s.React,s["@wendellhu/redi/react-bindings"],s.UniverDesign,s.clsx,s.UniverEngineRender,s.UniverDocs))})(this,function(s,P,_,c,B,k,me,i,b,M,Me,Ne,Oe){"use strict";var at=Object.defineProperty;var mt=(s,P,_)=>P in s?at(s,P,{enumerable:!0,configurable:!0,writable:!0,value:_}):s[P]=_;var L=(s,P,_)=>mt(s,typeof P!="symbol"?P+"":P,_);function de(){return P().format("YYYY/MM/DD HH:mm")}const ce="thread-comment-panel",De="THREAD_COMMENT_UI_PLUGIN";var we=Object.defineProperty,He=Object.getOwnPropertyDescriptor,je=(n,e,t,r)=>{for(var o=r>1?void 0:r?He(e,t):e,m=n.length-1,d;m>=0;m--)(d=n[m])&&(o=(r?d(e,t,o):d(o))||o);return r&&o&&we(e,t,o),o},ue=(n,e)=>(t,r)=>e(t,r,n);s.ThreadCommentPanelService=class extends c.Disposable{constructor(t,r){super();L(this,"_panelVisible",!1);L(this,"_panelVisible$",new me.BehaviorSubject(!1));L(this,"_activeCommentId");L(this,"_activeCommentId$",new me.BehaviorSubject(void 0));L(this,"panelVisible$",this._panelVisible$.asObservable());L(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init()}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(c.UniverInstanceType.UNIVER_SHEET).pipe(me.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},s.ThreadCommentPanelService=je([ue(0,B.Inject(k.ISidebarService)),ue(1,c.IUniverInstanceService)],s.ThreadCommentPanelService);const he={id:"thread-comment-ui.operation.toggle-panel",type:c.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(s.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:ce},width:320}),t.setPanelVisible(!0)),!0}},V={id:"thread-comment-ui.operation.set-active-comment",type:c.CommandType.OPERATION,handler(n,e){return n.get(s.ThreadCommentPanelService).setActiveComment(e),!0}};var $e=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,Le=(n,e,t,r)=>{for(var o=r>1?void 0:r?Ae(e,t):e,m=n.length-1,d;m>=0;m--)(d=n[m])&&(o=(r?d(e,t,o):d(o))||o);return r&&o&&$e(e,t,o),o},ke=(n,e)=>(t,r)=>e(t,r,n);let R=class extends c.Disposable{constructor(n){super(),this._localeService=n}};R=Le([c.OnLifecycle(c.LifecycleStages.Starting,R),ke(0,B.Inject(c.LocaleService))],R);class Ve{constructor(){L(this,"dataSource");L(this,"renderSuggestion");L(this,"trigger","@")}async getMentions(e,t,r){return this.dataSource?this.dataSource.getMentions(e,t,r):[]}}const le=B.createIdentifier("thread-comment.mention-data.service");var ve=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Fe=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,We=(n,e,t,r)=>{for(var o=r>1?void 0:r?qe(e,t):e,m=n.length-1,d;m>=0;m--)(d=n[m])&&(o=(r?d(e,t,o):d(o))||o);return r&&o&&ve(e,t,o),o},Ce=(n,e)=>(t,r)=>e(t,r,n),fe=(n,e,t)=>Fe(n,typeof e!="symbol"?e+"":e,t);s.UniverThreadCommentUIPlugin=class extends c.Plugin{constructor(e,t,r){super(),this._config=e,this._injector=t,this._commandService=r}onStarting(e){var t;c.mergeOverrideWithDependencies([[R],[s.ThreadCommentPanelService],[le,{useClass:Ve}]],(t=this._config)==null?void 0:t.overrides).forEach(r=>{e.add(r)}),[he,V].forEach(r=>{this._commandService.registerCommand(r)})}},fe(s.UniverThreadCommentUIPlugin,"pluginName",De),fe(s.UniverThreadCommentUIPlugin,"type",c.UniverInstanceType.UNIVER_UNKNOWN),s.UniverThreadCommentUIPlugin=We([c.DependentOn(_.UniverThreadCommentPlugin),Ce(1,B.Inject(B.Injector)),Ce(2,c.ICommandService)],s.UniverThreadCommentUIPlugin);var N=function(){return N=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n},N.apply(this,arguments)},ze=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(n);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(t[r[o]]=n[r[o]]);return t},z=i.forwardRef(function(n,e){var t=n.icon,r=n.id,o=n.className,m=n.extend,d=ze(n,["icon","id","className","extend"]),v="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),p=i.useRef("_".concat(Ye()));return ge(t,"".concat(r),{defIds:t.defIds,idSuffix:p.current},N({ref:e,className:v},d),m)});function ge(n,e,t,r,o){return i.createElement(n.tag,N(N({key:e},Be(n,t,o)),r),(Ze(n,t).children||[]).map(function(m,d){return ge(m,"".concat(e,"-").concat(n.tag,"-").concat(d),t,void 0,o)}))}function Be(n,e,t){var r=N({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var o=e.defIds;return!o||o.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(m){var d=m[0],v=m[1];typeof v=="string"&&(r[d]=v.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Ze(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?N(N({},n),{children:n.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?N(N({},o),{attrs:N(N({},o.attrs),{id:o.attrs.id+e.idSuffix})}):o})}):n}function Ye(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var Ge={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},pe=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:Ge}))});pe.displayName="DeleteSingle";var Ke={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Ie=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:Ke}))});Ie.displayName="IncreaseSingle";var Je={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},Se=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Je}))});Se.displayName="MoreHorizontalSingle";var Qe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},ye=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:Qe}))});ye.displayName="ReplyToCommentSingle";var Xe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ee=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:Xe}))});Ee.displayName="ResolvedSingle";var Re={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},be=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:Re}))});be.displayName="SolveSingle";const ee={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},et=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const o=[];for(;(t=e.exec(n))!==null;)t.index>r&&o.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?o.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&o.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&o.push({type:"text",content:n.substring(r)}),o},tt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),Te=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,o=[];let m=0;return t==null||t.forEach(d=>{m<d.startIndex&&o.push({type:"text",content:e.slice(m,d.startIndex)}),o.push({type:"mention",content:{label:e.slice(d.startIndex,d.endIndex).slice(1,-1),id:d.rangeId}}),m=d.endIndex}),o.push({type:"text",content:e.slice(m,r)}),o},_e=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const o=e.length;e+=`${r.content.label}`;const m=e.length;t.push({rangeId:r.content.id,rangeType:c.CustomRangeType.MENTION,startIndex:o,endIndex:m});break}}}),e+=`
2
- \r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},nt=n=>({display:n.label,id:`${n.id}`,raw:n}),rt=(n,e,t,r,o)=>{var d,v;const m=(d=n.raw)==null?void 0:d.icon;return i.createElement("div",{className:ee.threadCommentEditorSuggestion},m?i.createElement("img",{className:ee.threadCommentEditorSuggestionIcon,src:m}):null,i.createElement("div",null,(v=n.display)!=null?v:n.id))},Ue=i.forwardRef((n,e)=>{var f;const{comment:t,onSave:r,id:o,onCancel:m,autoFocus:d,unitId:v,subUnitId:p}=n,U=b.useDependency(le),j=b.useDependency(c.ICommandService),O=b.useDependency(c.LocaleService),[y,C]=i.useState({...t}),[I,E]=i.useState(!1),D=i.useRef(null),T=b.useDependency(Ne.ITextSelectionRenderManager),q=b.useDependency(Oe.TextSelectionManagerService);return i.useImperativeHandle(e,()=>({reply(g){var u;C({...t,text:g,attachments:[]}),(u=D.current)==null||u.inputElement.focus()}})),i.createElement("div",{className:ee.threadCommentEditor,onClick:g=>g.preventDefault()},i.createElement(M.Mentions,{ref:D,autoFocus:d,style:{width:"100%"},placeholder:O.t("threadCommentUI.editor.placeholder"),value:y!=null&&y.text?tt(Te(y.text)):"",onChange:g=>{g.target.value||C({...t,text:void 0}),C==null||C({...t,text:_e(et(g.target.value))})},onFocus:()=>{const g=q.getActiveRange();g&&g.collapsed&&T.removeAllTextRanges(),T.blur(),E(!0)}},i.createElement(M.Mention,{key:U.trigger,trigger:U.trigger,data:(g,u)=>U.getMentions(g,v,p).then(l=>l.map(nt)).then(u),displayTransform:(g,u)=>`@${u} `,renderSuggestion:(f=U.renderSuggestion)!=null?f:rt})),I?i.createElement("div",{className:ee.threadCommentEditorButtons},i.createElement(M.Button,{style:{marginRight:12},onClick:()=>{m==null||m(),E(!1),C({text:void 0}),j.executeCommand(V.id)}},O.t("threadCommentUI.editor.cancel")),i.createElement(M.Button,{type:"primary",disabled:!y.text,onClick:()=>{y.text&&(r==null||r({...y,text:y.text}),E(!1),C({text:void 0}))}},O.t(o?"threadCommentUI.editor.save":"threadCommentUI.editor.reply"))):null)}),h={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Pe="__mock__",it=n=>{const{item:e,unitId:t,subUnitId:r,editing:o,onEditingChange:m,onReply:d,resolved:v,isRoot:p,onClose:U,onDeleteComment:j}=n,O=b.useDependency(c.ICommandService),y=b.useDependency(c.LocaleService),C=b.useDependency(c.UserManagerService),I=C.getUser(e.personId),E=k.useObservable(C.currentUser$),D=(E==null?void 0:E.userID)===e.personId,T=e.id===Pe,[q,f]=i.useState(!1),g=()=>{(j==null?void 0:j(e))!==!1&&(O.executeCommand(p?_.DeleteCommentTreeCommand.id:_.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),p&&(U==null||U()))};return i.createElement("div",{className:h.threadCommentItem,onMouseLeave:()=>f(!1),onMouseEnter:()=>f(!0)},i.createElement("img",{className:h.threadCommentItemHead,src:I==null?void 0:I.avatar}),i.createElement("div",{className:h.threadCommentItemTitle},i.createElement("div",{className:h.threadCommentUsername},(I==null?void 0:I.name)||" "),i.createElement("div",null,T||v?null:q?i.createElement("div",{className:h.threadCommentIcon,onClick:()=>d(I)},i.createElement(ye,null)):null,D&&!T&&!v?i.createElement(M.Dropdown,{overlay:i.createElement(M.Menu,null,i.createElement(M.MenuItem,{key:"edit",onClick:()=>m==null?void 0:m(!0)},y.t("threadCommentUI.item.edit")),i.createElement(M.MenuItem,{key:"delete",onClick:g},y.t("threadCommentUI.item.delete")))},i.createElement("div",{className:h.threadCommentIcon},i.createElement(Se,null))):null)),i.createElement("div",{className:h.threadCommentItemTime},e.dT),o?i.createElement(Ue,{id:e.id,comment:e,onCancel:()=>m==null?void 0:m(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:u,attachments:l})=>{m==null||m(!1),O.executeCommand(_.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:u,attachments:l}})}}):i.createElement("div",{className:h.threadCommentItemContent},Te(e.text).map((u,l)=>{switch(u.type){case"mention":return i.createElement("a",{className:h.threadCommentItemAt,key:l},"@",u.content.label," ");default:return u.content}})))},xe=n=>{var K,J,Q;const{id:e,unitId:t,subUnitId:r,refStr:o,showEdit:m=!0,onClick:d,showHighlight:v,onClose:p,getSubUnitName:U,prefix:j,autoFocus:O,onMouseEnter:y,onMouseLeave:C,onAddComment:I,onDeleteComment:E,onResolve:D}=n,T=b.useDependency(_.ThreadCommentModel),[q,f]=i.useState(!1),[g,u]=i.useState("");k.useObservable(T.commentMap$);const l=e?T.getCommentWithChildren(t,r,e):null,F=b.useDependency(c.ICommandService),se=b.useDependency(c.UserManagerService),S=l==null?void 0:l.root.resolved,w=k.useObservable(se.currentUser$),Z=i.useRef(null),ne=[...l?[l.root]:[{id:Pe,text:{dataStream:`
3
- \r`},personId:(K=w==null?void 0:w.userID)!=null?K:"",ref:o!=null?o:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(J=l==null?void 0:l.children)!=null?J:[]],Y=x=>{x.stopPropagation(),S?F.executeCommand(V.id,{unitId:t,subUnitId:r,commentId:e}):F.executeCommand(V.id),F.executeCommand(_.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!S}),D==null||D(!S)},re=x=>{x.stopPropagation(),F.executeCommand(V.id),!(l!=null&&l.root&&(E==null?void 0:E(l.root))===!1)&&(F.executeCommand(_.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),p==null||p())};i.useEffect(()=>C==null?void 0:C(),[]);const $=U((Q=l==null?void 0:l.root.subUnitId)!=null?Q:r),G=m&&!g&&!S,W=`${o||(l==null?void 0:l.root.ref)}${$?" · ":""}${$}`;return i.createElement("div",{className:Me(h.threadComment,{[h.threadCommentActive]:!S&&(v||q||j==="cell")}),onClick:d,id:`${j}-${t}-${r}-${e}`,onMouseEnter:()=>{y==null||y(),f(!0)},onMouseLeave:()=>{C==null||C(),f(!1)}},!S&&v?i.createElement("div",{className:h.threadCommentHighlight}):null,i.createElement("div",{className:h.threadCommentTitle},i.createElement("div",{className:h.threadCommentTitlePosition},i.createElement("div",{className:h.threadCommentTitleHighlight}),i.createElement("div",{className:h.threadCommentTitlePositionText},W)),l?i.createElement("div",{className:h.threadCommentIconContainer},i.createElement("div",{onClick:Y,className:h.threadCommentIcon,style:{color:S?"rgb(var(--green-500))":""}},S?i.createElement(Ee,null):i.createElement(be,null)),(w==null?void 0:w.userID)===l.root.personId?i.createElement("div",{className:h.threadCommentIcon,onClick:re},i.createElement(pe,null)):null):null),i.createElement("div",{className:h.threadCommentContent},ne.map(x=>i.createElement(it,{onClose:p,unitId:t,subUnitId:r,item:x,key:x.id,isRoot:x.id===(l==null?void 0:l.root.id),editing:g===x.id,resolved:l==null?void 0:l.root.resolved,onEditingChange:a=>{u(a?x.id:"")},onReply:a=>{a&&requestAnimationFrame(()=>{var H;(H=Z.current)==null||H.reply(_e([{type:"mention",content:{id:a.userID,label:a.name}}]))})},onAddComment:I,onDeleteComment:E}))),G?i.createElement("div",null,i.createElement(Ue,{key:`${O}`,ref:Z,unitId:t,subUnitId:r,onSave:({text:x,attachments:a})=>{const H={text:x,attachments:a,dT:de(),id:c.Tools.generateRandomId(),ref:o,personId:w==null?void 0:w.userID,parentId:l==null?void 0:l.root.id,unitId:t,subUnitId:r,threadId:l==null?void 0:l.root.threadId};(I==null?void 0:I(H))!==!1&&F.executeCommand(_.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:H})},autoFocus:O||!l,onCancel:()=>{l||p==null||p()}})):null)},te={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add"},ot=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:o,getSubUnitName:m,onResolve:d,sortComments:v,onItemLeave:p,onItemEnter:U,disableAdd:j,tempComment:O,onAddComment:y,onDeleteComment:C,showComments:I}=n,[E,D]=i.useState("all"),[T,q]=i.useState("all"),f=b.useDependency(c.LocaleService),g=b.useDependency(c.UserManagerService),u=b.useDependency(_.ThreadCommentModel),[l,F]=i.useState(()=>u.getUnit(e)),se=b.useDependency(s.ThreadCommentPanelService),S=k.useObservable(se.activeCommentId$),w=k.useObservable(u.commentUpdate$),Z=b.useDependency(c.ICommandService),ne=k.useObservable(t),Y=i.useRef(!0),re="panel",$=k.useObservable(g.currentUser$),G=i.useMemo(()=>{var oe,X;const a=(E==="all"?l.map(A=>A[1]).flat():(X=(oe=l.find(A=>A[0]===ne))==null?void 0:oe[1])!=null?X:[]).filter(A=>!A.parentId),H=v!=null?v:A=>A,ie=a;if(I){const A=new Map;return ie.forEach(ae=>{A.set(ae.id,ae)}),[...I,""].map(ae=>A.get(ae)).filter(Boolean)}else return H(ie)},[I,E,l,v,ne]),W=i.useMemo(()=>[...G.filter(a=>!a.resolved),...G.filter(a=>a.resolved)],[G]),K=i.useMemo(()=>T==="resolved"?W.filter(a=>a.resolved):T==="unsolved"?W.filter(a=>!a.resolved):T==="concern_me"&&$!=null&&$.userID?W.map(a=>u.getCommentWithChildren(a.unitId,a.subUnitId,a.id)).map(a=>a!=null&&a.relativeUsers.has($.userID)?a.root:null).filter(Boolean):W,[W,$==null?void 0:$.userID,T,u]),J=O?[O,...K]:K,Q=T!=="all"||E!=="all",x=()=>{q("all"),D("all")};return i.useEffect(()=>{e&&F(u.getUnit(e))},[e,u,w]),i.useEffect(()=>{var X;if(!S)return;if(!Y.current){Y.current=!0;return}const{unitId:a,subUnitId:H,commentId:ie}=S,oe=`${re}-${a}-${H}-${ie}`;(X=document.getElementById(oe))==null||X.scrollIntoView({block:"center"})},[S]),i.createElement("div",{className:te.threadCommentPanel},i.createElement("div",{className:te.threadCommentPanelForms},r===c.UniverInstanceType.UNIVER_SHEET?i.createElement(M.Select,{borderless:!0,value:E,onChange:a=>D(a),options:[{value:"current",label:f.t("threadCommentUI.filter.sheet.current")},{value:"all",label:f.t("threadCommentUI.filter.sheet.all")}]}):null,i.createElement(M.Select,{borderless:!0,value:T,onChange:a=>q(a),options:[{value:"all",label:f.t("threadCommentUI.filter.status.all")},{value:"resolved",label:f.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:f.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:f.t("threadCommentUI.filter.status.concernMe")}]})),J.map(a=>i.createElement(xe,{prefix:re,getSubUnitName:m,key:a.id,id:a.id,unitId:a.unitId,subUnitId:a.subUnitId,refStr:a.ref,type:r,showEdit:(S==null?void 0:S.commentId)===a.id,showHighlight:(S==null?void 0:S.commentId)===a.id,onClick:()=>{Y.current=!1,a.resolved?Z.executeCommand(V.id):Z.executeCommand(V.id,{unitId:a.unitId,subUnitId:a.subUnitId,commentId:a.id,temp:!1})},onMouseEnter:()=>U==null?void 0:U(a),onMouseLeave:()=>p==null?void 0:p(a),onAddComment:y,onDeleteComment:C,onResolve:H=>d==null?void 0:d(a.id,H)})),J.length?null:i.createElement("div",{className:te.threadCommentPanelEmpty},Q?f.t("threadCommentUI.panel.filterEmpty"):f.t("threadCommentUI.panel.empty"),Q?i.createElement(M.Button,{onClick:x,type:"link"},f.t("threadCommentUI.panel.reset")):i.createElement(M.Button,{id:"thread-comment-add",className:te.threadCommentPanelAdd,type:"primary",onClick:o,disabled:j},i.createElement(Ie,null),f.t("threadCommentUI.panel.addComment"))))};s.IThreadCommentMentionDataService=le,s.SetActiveCommentOperation=V,s.THREAD_COMMENT_PANEL=ce,s.ThreadCommentPanel=ot,s.ThreadCommentTree=xe,s.ToggleSheetCommentPanelOperation=he,s.getDT=de,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
1
+ (function(s,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("dayjs"),require("@univerjs/thread-comment"),require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@wendellhu/redi/react-bindings"),require("@univerjs/design"),require("clsx"),require("@univerjs/engine-render"),require("@univerjs/docs")):typeof define=="function"&&define.amd?define(["exports","dayjs","@univerjs/thread-comment","@univerjs/core","@wendellhu/redi","@univerjs/ui","rxjs","react","@wendellhu/redi/react-bindings","@univerjs/design","clsx","@univerjs/engine-render","@univerjs/docs"],x):(s=typeof globalThis<"u"?globalThis:s||self,x(s.UniverThreadCommentUi={},s.dayjs,s.UniverThreadComment,s.UniverCore,s["@wendellhu/redi"],s.UniverUi,s.rxjs,s.React,s["@wendellhu/redi/react-bindings"],s.UniverDesign,s.clsx,s.UniverEngineRender,s.UniverDocs))})(this,function(s,x,_,c,Y,k,se,i,b,M,De,we,He){"use strict";var st=Object.defineProperty;var dt=(s,x,_)=>x in s?st(s,x,{enumerable:!0,configurable:!0,writable:!0,value:_}):s[x]=_;var L=(s,x,_)=>dt(s,typeof x!="symbol"?x+"":x,_);function ue(){return x().format("YYYY/MM/DD HH:mm")}const he="thread-comment-panel",je="THREAD_COMMENT_UI_PLUGIN";var $e=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,Le=(n,e,t,r)=>{for(var o=r>1?void 0:r?Ae(e,t):e,a=n.length-1,d;a>=0;a--)(d=n[a])&&(o=(r?d(e,t,o):d(o))||o);return r&&o&&$e(e,t,o),o},ve=(n,e)=>(t,r)=>e(t,r,n);s.ThreadCommentPanelService=class extends c.Disposable{constructor(t,r){super();L(this,"_panelVisible",!1);L(this,"_panelVisible$",new se.BehaviorSubject(!1));L(this,"_activeCommentId");L(this,"_activeCommentId$",new se.BehaviorSubject(void 0));L(this,"panelVisible$",this._panelVisible$.asObservable());L(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(c.UniverInstanceType.UNIVER_SHEET).pipe(se.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},s.ThreadCommentPanelService=Le([ve(0,Y.Inject(k.ISidebarService)),ve(1,c.IUniverInstanceService)],s.ThreadCommentPanelService);const Ce={id:"thread-comment-ui.operation.toggle-panel",type:c.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(s.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:he},width:320}),t.setPanelVisible(!0)),!0}},V={id:"thread-comment-ui.operation.set-active-comment",type:c.CommandType.OPERATION,handler(n,e){return n.get(s.ThreadCommentPanelService).setActiveComment(e),!0}};var ke=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,qe=(n,e,t,r)=>{for(var o=r>1?void 0:r?Ve(e,t):e,a=n.length-1,d;a>=0;a--)(d=n[a])&&(o=(r?d(e,t,o):d(o))||o);return r&&o&&ke(e,t,o),o},Fe=(n,e)=>(t,r)=>e(t,r,n);let te=class extends c.Disposable{constructor(n){super(),this._localeService=n}};te=qe([c.OnLifecycle(c.LifecycleStages.Starting,te),Fe(0,Y.Inject(c.LocaleService))],te);class We{constructor(){L(this,"dataSource");L(this,"renderSuggestion");L(this,"trigger","@")}async getMentions(e,t,r){return this.dataSource?this.dataSource.getMentions(e,t,r):[]}}const de=Y.createIdentifier("thread-comment.mention-data.service");var fe=Object.defineProperty,ze=Object.getOwnPropertyDescriptor,Be=(n,e,t)=>e in n?fe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ze=(n,e,t,r)=>{for(var o=r>1?void 0:r?ze(e,t):e,a=n.length-1,d;a>=0;a--)(d=n[a])&&(o=(r?d(e,t,o):d(o))||o);return r&&o&&fe(e,t,o),o},pe=(n,e)=>(t,r)=>e(t,r,n),ge=(n,e,t)=>Be(n,typeof e!="symbol"?e+"":e,t);s.UniverThreadCommentUIPlugin=class extends c.Plugin{constructor(e,t,r){super(),this._config=e,this._injector=t,this._commandService=r}onStarting(e){var t;c.mergeOverrideWithDependencies([[te],[s.ThreadCommentPanelService],[de,{useClass:We}]],(t=this._config)==null?void 0:t.overrides).forEach(r=>{e.add(r)}),[Ce,V].forEach(r=>{this._commandService.registerCommand(r)})}},ge(s.UniverThreadCommentUIPlugin,"pluginName",je),ge(s.UniverThreadCommentUIPlugin,"type",c.UniverInstanceType.UNIVER_UNKNOWN),s.UniverThreadCommentUIPlugin=Ze([c.DependentOn(_.UniverThreadCommentPlugin),pe(1,Y.Inject(Y.Injector)),pe(2,c.ICommandService)],s.UniverThreadCommentUIPlugin);var N=function(){return N=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n},N.apply(this,arguments)},Ye=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(n);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(t[r[o]]=n[r[o]]);return t},z=i.forwardRef(function(n,e){var t=n.icon,r=n.id,o=n.className,a=n.extend,d=Ye(n,["icon","id","className","extend"]),v="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),g=i.useRef("_".concat(Je()));return Ie(t,"".concat(r),{defIds:t.defIds,idSuffix:g.current},N({ref:e,className:v},d),a)});function Ie(n,e,t,r,o){return i.createElement(n.tag,N(N({key:e},Ge(n,t,o)),r),(Ke(n,t).children||[]).map(function(a,d){return Ie(a,"".concat(e,"-").concat(n.tag,"-").concat(d),t,void 0,o)}))}function Ge(n,e,t){var r=N({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var o=e.defIds;return!o||o.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(a){var d=a[0],v=a[1];typeof v=="string"&&(r[d]=v.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Ke(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?N(N({},n),{children:n.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?N(N({},o),{attrs:N(N({},o.attrs),{id:o.attrs.id+e.idSuffix})}):o})}):n}function Je(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var Qe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Se=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:Qe}))});Se.displayName="DeleteSingle";var Xe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},ye=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:Xe}))});ye.displayName="IncreaseSingle";var Re={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},Ee=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Re}))});Ee.displayName="MoreHorizontalSingle";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},be=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:et}))});be.displayName="ReplyToCommentSingle";var tt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Te=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:tt}))});Te.displayName="ResolvedSingle";var nt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},_e=i.forwardRef(function(n,e){return i.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:nt}))});_e.displayName="SolveSingle";const ne={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},rt=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const o=[];for(;(t=e.exec(n))!==null;)t.index>r&&o.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?o.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&o.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&o.push({type:"text",content:n.substring(r)}),o},it=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),Pe=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,o=[];let a=0;return t==null||t.forEach(d=>{a<d.startIndex&&o.push({type:"text",content:e.slice(a,d.startIndex)}),o.push({type:"mention",content:{label:e.slice(d.startIndex,d.endIndex).slice(1,-1),id:d.rangeId}}),a=d.endIndex}),o.push({type:"text",content:e.slice(a,r)}),o},Ue=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const o=e.length;e+=`${r.content.label}`;const a=e.length;t.push({rangeId:r.content.id,rangeType:c.CustomRangeType.MENTION,startIndex:o,endIndex:a});break}}}),e+=`
2
+ \r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},ot=n=>({display:n.label,id:`${n.id}`,raw:n}),at=(n,e,t,r,o)=>{var d,v;const a=(d=n.raw)==null?void 0:d.icon;return i.createElement("div",{className:ne.threadCommentEditorSuggestion},a?i.createElement("img",{className:ne.threadCommentEditorSuggestionIcon,src:a}):null,i.createElement("div",null,(v=n.display)!=null?v:n.id))},xe=i.forwardRef((n,e)=>{var f;const{comment:t,onSave:r,id:o,onCancel:a,autoFocus:d,unitId:v,subUnitId:g}=n,P=b.useDependency(de),H=b.useDependency(c.ICommandService),O=b.useDependency(c.LocaleService),[y,C]=i.useState({...t}),[I,E]=i.useState(!1),D=i.useRef(null),T=b.useDependency(we.ITextSelectionRenderManager),q=b.useDependency(He.TextSelectionManagerService);return i.useImperativeHandle(e,()=>({reply(p){var u;C({...t,text:p,attachments:[]}),(u=D.current)==null||u.inputElement.focus()}})),i.createElement("div",{className:ne.threadCommentEditor,onClick:p=>p.preventDefault()},i.createElement(M.Mentions,{ref:D,autoFocus:d,style:{width:"100%"},placeholder:O.t("threadCommentUI.editor.placeholder"),value:y!=null&&y.text?it(Pe(y.text)):"",onChange:p=>{p.target.value||C({...t,text:void 0}),C==null||C({...t,text:Ue(rt(p.target.value))})},onFocus:()=>{const p=q.getActiveRange();p&&p.collapsed&&T.removeAllTextRanges(),T.blur(),E(!0)}},i.createElement(M.Mention,{key:P.trigger,trigger:P.trigger,data:(p,u)=>P.getMentions(p,v,g).then(m=>m.map(ot)).then(u),displayTransform:(p,u)=>`@${u} `,renderSuggestion:(f=P.renderSuggestion)!=null?f:at})),I?i.createElement("div",{className:ne.threadCommentEditorButtons},i.createElement(M.Button,{style:{marginRight:12},onClick:()=>{a==null||a(),E(!1),C({text:void 0}),H.executeCommand(V.id)}},O.t("threadCommentUI.editor.cancel")),i.createElement(M.Button,{type:"primary",disabled:!y.text,onClick:()=>{y.text&&(r==null||r({...y,text:y.text}),E(!1),C({text:void 0}))}},O.t(o?"threadCommentUI.editor.save":"threadCommentUI.editor.reply"))):null)}),h={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Me="__mock__",mt=n=>{const{item:e,unitId:t,subUnitId:r,editing:o,onEditingChange:a,onReply:d,resolved:v,isRoot:g,onClose:P,onDeleteComment:H}=n,O=b.useDependency(c.ICommandService),y=b.useDependency(c.LocaleService),C=b.useDependency(c.UserManagerService),I=C.getUser(e.personId),E=k.useObservable(C.currentUser$),D=(E==null?void 0:E.userID)===e.personId,T=e.id===Me,[q,f]=i.useState(!1),p=()=>{(H==null?void 0:H(e))!==!1&&(O.executeCommand(g?_.DeleteCommentTreeCommand.id:_.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),g&&(P==null||P()))};return i.createElement("div",{className:h.threadCommentItem,onMouseLeave:()=>f(!1),onMouseEnter:()=>f(!0)},i.createElement("img",{className:h.threadCommentItemHead,src:I==null?void 0:I.avatar}),i.createElement("div",{className:h.threadCommentItemTitle},i.createElement("div",{className:h.threadCommentUsername},(I==null?void 0:I.name)||" "),i.createElement("div",null,T||v?null:q?i.createElement("div",{className:h.threadCommentIcon,onClick:()=>d(I)},i.createElement(be,null)):null,D&&!T&&!v?i.createElement(M.Dropdown,{overlay:i.createElement(M.Menu,null,i.createElement(M.MenuItem,{key:"edit",onClick:()=>a==null?void 0:a(!0)},y.t("threadCommentUI.item.edit")),i.createElement(M.MenuItem,{key:"delete",onClick:p},y.t("threadCommentUI.item.delete")))},i.createElement("div",{className:h.threadCommentIcon},i.createElement(Ee,null))):null)),i.createElement("div",{className:h.threadCommentItemTime},e.dT),o?i.createElement(xe,{id:e.id,comment:e,onCancel:()=>a==null?void 0:a(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:u,attachments:m})=>{a==null||a(!1),O.executeCommand(_.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:u,attachments:m}})}}):i.createElement("div",{className:h.threadCommentItemContent},Pe(e.text).map((u,m)=>{switch(u.type){case"mention":return i.createElement("a",{className:h.threadCommentItemAt,key:m},"@",u.content.label," ");default:return u.content}})))},Ne=n=>{var X,Z,oe;const{id:e,unitId:t,subUnitId:r,refStr:o,showEdit:a=!0,onClick:d,showHighlight:v,onClose:g,getSubUnitName:P,prefix:H,autoFocus:O,onMouseEnter:y,onMouseLeave:C,onAddComment:I,onDeleteComment:E,onResolve:D}=n,T=b.useDependency(_.ThreadCommentModel),[q,f]=i.useState(!1),[p,u]=i.useState("");k.useObservable(T.commentMap$);const m=e?T.getCommentWithChildren(t,r,e):null,F=b.useDependency(c.ICommandService),ce=b.useDependency(c.UserManagerService),S=m==null?void 0:m.root.resolved,w=k.useObservable(ce.currentUser$),K=i.useRef(null),re=[...m?[m.root]:[{id:Me,text:{dataStream:`
3
+ \r`},personId:(X=w==null?void 0:w.userID)!=null?X:"",ref:o!=null?o:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(Z=m==null?void 0:m.children)!=null?Z:[]],J=U=>{U.stopPropagation(),S?F.executeCommand(V.id,{unitId:t,subUnitId:r,commentId:e}):F.executeCommand(V.id),F.executeCommand(_.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!S}),D==null||D(!S)},ie=U=>{U.stopPropagation(),F.executeCommand(V.id),!(m!=null&&m.root&&(E==null?void 0:E(m.root))===!1)&&(F.executeCommand(_.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),g==null||g())};i.useEffect(()=>C==null?void 0:C(),[]);const j=P((oe=m==null?void 0:m.root.subUnitId)!=null?oe:r),Q=a&&!p&&!S,W=`${o||(m==null?void 0:m.root.ref)||""}${j?" · ":""}${j}`;return i.createElement("div",{className:De(h.threadComment,{[h.threadCommentActive]:!S&&(v||q||H==="cell")}),onClick:d,id:`${H}-${t}-${r}-${e}`,onMouseEnter:()=>{y==null||y(),f(!0)},onMouseLeave:()=>{C==null||C(),f(!1)}},!S&&v?i.createElement("div",{className:h.threadCommentHighlight}):null,i.createElement("div",{className:h.threadCommentTitle},i.createElement("div",{className:h.threadCommentTitlePosition},i.createElement("div",{className:h.threadCommentTitleHighlight}),i.createElement("div",{className:h.threadCommentTitlePositionText},W)),m?i.createElement("div",{className:h.threadCommentIconContainer},i.createElement("div",{onClick:J,className:h.threadCommentIcon,style:{color:S?"rgb(var(--green-500))":""}},S?i.createElement(Te,null):i.createElement(_e,null)),(w==null?void 0:w.userID)===m.root.personId?i.createElement("div",{className:h.threadCommentIcon,onClick:ie},i.createElement(Se,null)):null):null),i.createElement("div",{className:h.threadCommentContent},re.map(U=>i.createElement(mt,{onClose:g,unitId:t,subUnitId:r,item:U,key:U.id,isRoot:U.id===(m==null?void 0:m.root.id),editing:p===U.id,resolved:m==null?void 0:m.root.resolved,onEditingChange:$=>{u($?U.id:"")},onReply:$=>{$&&requestAnimationFrame(()=>{var B;(B=K.current)==null||B.reply(Ue([{type:"mention",content:{id:$.userID,label:$.name}}]))})},onAddComment:I,onDeleteComment:E}))),Q?i.createElement("div",null,i.createElement(xe,{key:`${O}`,ref:K,unitId:t,subUnitId:r,onSave:({text:U,attachments:$})=>{const B={text:U,attachments:$,dT:ue(),id:c.Tools.generateRandomId(),ref:o,personId:w==null?void 0:w.userID,parentId:m==null?void 0:m.root.id,unitId:t,subUnitId:r,threadId:m==null?void 0:m.root.threadId};(I==null?void 0:I(B))!==!1&&F.executeCommand(_.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:B})},autoFocus:O||!m,onCancel:()=>{m||g==null||g()}})):null)},G={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},lt=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:o,getSubUnitName:a,onResolve:d,sortComments:v,onItemLeave:g,onItemEnter:P,disableAdd:H,tempComment:O,onAddComment:y,onDeleteComment:C,showComments:I}=n,[E,D]=i.useState("all"),[T,q]=i.useState("all"),f=b.useDependency(c.LocaleService),p=b.useDependency(c.UserManagerService),u=b.useDependency(_.ThreadCommentModel),[m,F]=i.useState(()=>u.getUnit(e)),ce=b.useDependency(s.ThreadCommentPanelService),S=k.useObservable(ce.activeCommentId$),w=k.useObservable(u.commentUpdate$),K=b.useDependency(c.ICommandService),re=k.useObservable(t),J=i.useRef(!0),ie="panel",j=k.useObservable(p.currentUser$),Q=i.useMemo(()=>{var me,ee;const l=(E==="all"?m.map(A=>A[1]).flat():(ee=(me=m.find(A=>A[0]===re))==null?void 0:me[1])!=null?ee:[]).filter(A=>!A.parentId),R=v!=null?v:A=>A,ae=l;if(I){const A=new Map;return ae.forEach(le=>{A.set(le.id,le)}),[...I,""].map(le=>A.get(le)).filter(Boolean)}else return R(ae)},[I,E,m,v,re]),W=i.useMemo(()=>[...Q.filter(l=>!l.resolved),...Q.filter(l=>l.resolved)],[Q]),X=i.useMemo(()=>T==="resolved"?W.filter(l=>l.resolved):T==="unsolved"?W.filter(l=>!l.resolved):T==="concern_me"&&j!=null&&j.userID?W.map(l=>u.getCommentWithChildren(l.unitId,l.subUnitId,l.id)).map(l=>l!=null&&l.relativeUsers.has(j.userID)?l.root:null).filter(Boolean):W,[W,j==null?void 0:j.userID,T,u]),Z=O?[O,...X]:X,oe=Z.filter(l=>!l.resolved),U=Z.filter(l=>l.resolved),$=T!=="all"||E!=="all",B=()=>{q("all"),D("all")};i.useEffect(()=>{e&&F(u.getUnit(e))},[e,u,w]),i.useEffect(()=>{var ee;if(!S)return;if(!J.current){J.current=!0;return}const{unitId:l,subUnitId:R,commentId:ae}=S,me=`${ie}-${l}-${R}-${ae}`;(ee=document.getElementById(me))==null||ee.scrollIntoView({block:"center"})},[S]);const Oe=l=>i.createElement(Ne,{prefix:ie,getSubUnitName:a,key:l.id,id:l.id,unitId:l.unitId,subUnitId:l.subUnitId,refStr:l.ref,type:r,showEdit:(S==null?void 0:S.commentId)===l.id,showHighlight:(S==null?void 0:S.commentId)===l.id,onClick:()=>{J.current=!1,l.resolved?K.executeCommand(V.id):K.executeCommand(V.id,{unitId:l.unitId,subUnitId:l.subUnitId,commentId:l.id,temp:!1})},onMouseEnter:()=>P==null?void 0:P(l),onMouseLeave:()=>g==null?void 0:g(l),onAddComment:y,onDeleteComment:C,onResolve:R=>d==null?void 0:d(l.id,R)});return i.createElement("div",{className:G.threadCommentPanel},i.createElement("div",{className:G.threadCommentPanelForms},r===c.UniverInstanceType.UNIVER_SHEET?i.createElement(M.Select,{borderless:!0,value:E,onChange:l=>D(l),options:[{value:"current",label:f.t("threadCommentUI.filter.sheet.current")},{value:"all",label:f.t("threadCommentUI.filter.sheet.all")}]}):null,i.createElement(M.Select,{borderless:!0,value:T,onChange:l=>q(l),options:[{value:"all",label:f.t("threadCommentUI.filter.status.all")},{value:"resolved",label:f.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:f.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:f.t("threadCommentUI.filter.status.concernMe")}]})),oe.map(Oe),U.length?i.createElement("div",{className:G.threadCommentPanelSolved},"已解决"):null,U.map(Oe),Z.length?null:i.createElement("div",{className:G.threadCommentPanelEmpty},$?f.t("threadCommentUI.panel.filterEmpty"):f.t("threadCommentUI.panel.empty"),$?i.createElement(M.Button,{onClick:B,type:"link"},f.t("threadCommentUI.panel.reset")):i.createElement(M.Button,{id:"thread-comment-add",className:G.threadCommentPanelAdd,type:"primary",onClick:o,disabled:H},i.createElement(ye,null),f.t("threadCommentUI.panel.addComment"))))};s.IThreadCommentMentionDataService=de,s.SetActiveCommentOperation=V,s.THREAD_COMMENT_PANEL=he,s.ThreadCommentPanel=lt,s.ThreadCommentTree=Ne,s.ToggleSheetCommentPanelOperation=Ce,s.getDT=ue,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/thread-comment-ui",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "description": "Univer common thread comment UI plugin",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -48,39 +48,39 @@
48
48
  "lib"
49
49
  ],
50
50
  "peerDependencies": {
51
- "@wendellhu/redi": "0.15.5",
51
+ "@wendellhu/redi": "0.16.0",
52
52
  "clsx": ">=2.0.0",
53
53
  "dayjs": ">=1.11.0",
54
54
  "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
55
55
  "rxjs": ">=7.0.0",
56
- "@univerjs/core": "0.2.3",
57
- "@univerjs/docs": "0.2.3",
58
- "@univerjs/design": "0.2.3",
59
- "@univerjs/thread-comment": "0.2.3",
60
- "@univerjs/ui": "0.2.3",
61
- "@univerjs/engine-render": "0.2.3"
56
+ "@univerjs/core": "0.2.4",
57
+ "@univerjs/design": "0.2.4",
58
+ "@univerjs/engine-render": "0.2.4",
59
+ "@univerjs/thread-comment": "0.2.4",
60
+ "@univerjs/docs": "0.2.4",
61
+ "@univerjs/ui": "0.2.4"
62
62
  },
63
63
  "dependencies": {
64
- "@univerjs/icons": "^0.1.58",
65
- "@univerjs/protocol": "0.1.38-alpha.18"
64
+ "@univerjs/icons": "^0.1.65",
65
+ "@univerjs/protocol": "0.1.38-alpha.23"
66
66
  },
67
67
  "devDependencies": {
68
- "@wendellhu/redi": "0.15.5",
68
+ "@wendellhu/redi": "0.16.0",
69
69
  "clsx": "^2.1.1",
70
70
  "dayjs": "^1.11.11",
71
71
  "less": "^4.2.0",
72
72
  "react": "18.3.1",
73
73
  "rxjs": "^7.8.1",
74
74
  "typescript": "^5.5.3",
75
- "vite": "^5.3.3",
76
- "vitest": "^1.6.0",
77
- "@univerjs/core": "0.2.3",
78
- "@univerjs/design": "0.2.3",
79
- "@univerjs/engine-render": "0.2.3",
80
- "@univerjs/shared": "0.2.3",
81
- "@univerjs/docs": "0.2.3",
82
- "@univerjs/thread-comment": "0.2.3",
83
- "@univerjs/ui": "0.2.3"
75
+ "vite": "^5.3.4",
76
+ "vitest": "^2.0.3",
77
+ "@univerjs/design": "0.2.4",
78
+ "@univerjs/docs": "0.2.4",
79
+ "@univerjs/core": "0.2.4",
80
+ "@univerjs/engine-render": "0.2.4",
81
+ "@univerjs/shared": "0.2.4",
82
+ "@univerjs/thread-comment": "0.2.4",
83
+ "@univerjs/ui": "0.2.4"
84
84
  },
85
85
  "univerSpace": {
86
86
  ".": {