@univerjs/thread-comment-ui 0.7.0-beta.0 → 0.7.0-nightly.202504291607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +16 -14
- package/lib/es/index.js +67 -65
- package/lib/index.css +1 -1
- package/lib/index.js +67 -65
- package/lib/umd/index.js +8 -6
- package/package.json +6 -6
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
"use strict";var Se=Object.defineProperty;var ye=(n,e,t)=>e in n?Se(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var K=(n,e,t)=>ye(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@univerjs/core"),V=require("@univerjs/thread-comment"),f=require("@univerjs/ui"),re=require("rxjs"),s=require("react/jsx-runtime"),B=require("@univerjs/design"),l=require("react"),ie=require("@univerjs/docs-ui");var je=Object.getOwnPropertyDescriptor,_e=(n,e,t,r)=>{for(var i=r>1?void 0:r?je(e,t):e,a=n.length-1,c;a>=0;a--)(c=n[a])&&(i=c(i)||i);return i},ae=(n,e)=>(t,r)=>e(t,r,n);exports.ThreadCommentPanelService=class extends u.Disposable{constructor(t,r){super();K(this,"_panelVisible",!1);K(this,"_panelVisible$",new re.BehaviorSubject(!1));K(this,"_activeCommentId");K(this,"_activeCommentId$",new re.BehaviorSubject(void 0));K(this,"panelVisible$",this._panelVisible$.asObservable());K(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$(u.UniverInstanceType.UNIVER_SHEET).pipe(re.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)}};exports.ThreadCommentPanelService=_e([ae(0,u.Inject(f.ISidebarService)),ae(1,u.IUniverInstanceService)],exports.ThreadCommentPanelService);const de="thread-comment-panel",Ne="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:u.CommandType.OPERATION,handler(n){const e=n.get(f.ISidebarService),t=n.get(exports.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:de},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:u.CommandType.OPERATION,handler(n,e){return n.get(exports.ThreadCommentPanelService).setActiveComment(e),!0}},Te="thread-comment-ui.config",oe={};var we=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,Oe=(n,e,t)=>e in n?we(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ee=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ue(e,t):e,a=n.length-1,c;a>=0;a--)(c=n[a])&&(i=c(i)||i);return i},se=(n,e)=>(t,r)=>e(t,r,n),ce=(n,e,t)=>Oe(n,typeof e!="symbol"?e+"":e,t);exports.UniverThreadCommentUIPlugin=class extends u.Plugin{constructor(e=oe,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:a,...c}=u.merge({},oe,this._config);a&&this._configService.setConfig("menu",a,{merge:!0}),this._configService.setConfig(Te,c)}onStarting(){var e;u.mergeOverrideWithDependencies([[exports.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,F].forEach(t=>{this._commandService.registerCommand(t)})}};ce(exports.UniverThreadCommentUIPlugin,"pluginName",Ne);ce(exports.UniverThreadCommentUIPlugin,"type",u.UniverInstanceType.UNIVER_UNKNOWN);exports.UniverThreadCommentUIPlugin=Ee([u.DependentOn(V.UniverThreadCommentPlugin),se(1,u.Inject(u.Injector)),se(2,u.ICommandService),se(3,u.IConfigService)],exports.UniverThreadCommentUIPlugin);var k=function(){return k=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},k.apply(this,arguments)},De=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 i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},G=l.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,a=n.extend,c=De(n,["icon","id","className","extend"]),g="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),x=l.useRef("_".concat(ke()));return ve(t,"".concat(r),{defIds:t.defIds,idSuffix:x.current},k({ref:e,className:g},c),a)});function ve(n,e,t,r,i){return l.createElement(n.tag,k(k({key:e},Re(n,t,i)),r),(Me(n,t).children||[]).map(function(a,c){return ve(a,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,i)}))}function Re(n,e,t){var r=k({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1),n.tag==="mask"&&r.id&&(r.id=r.id+e.idSuffix),Object.entries(r).forEach(function(a){var c=a[0],g=a[1];c==="mask"&&typeof g=="string"&&(r[c]=g.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(a){var c=a[0],g=a[1];typeof g=="string"&&(r[c]=g.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Me(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)?k(k({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?k(k({},i),{attrs:k(k({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function ke(){return Math.random().toString(36).substring(2,8)}G.displayName="UniverIcon";var Pe={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"}}]},me=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"delete-single",ref:e,icon:Pe}))});me.displayName="DeleteSingle";var $e={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"}}]},fe=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"increase-single",ref:e,icon:$e}))});fe.displayName="IncreaseSingle";var He={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"}}]},he=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:He}))});he.displayName="MoreHorizontalSingle";var Le={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}}]},pe=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:Le}))});pe.displayName="ReplyToCommentSingle";var Ve={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"}}]},ge=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"resolved-single",ref:e,icon:Ve}))});ge.displayName="ResolvedSingle";var Be={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}}]},xe=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"solve-single",ref:e,icon:Be}))});xe.displayName="SolveSingle";function le(n){return{id:"d",body:n,documentStyle:{}}}const Ce=l.forwardRef((n,e)=>{var P;const{comment:t,onSave:r,id:i,onCancel:a,autoFocus:c,unitId:g,type:x}=n,T=f.useDependency(u.ICommandService),U=f.useDependency(u.LocaleService),[A,O]=l.useState(!1),y=f.useDependency(ie.IEditorService),m=l.useRef(null),h=x===u.UniverInstanceType.UNIVER_SHEET?u.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:g,[E,j]=l.useState(()=>{var v,p,C;return u.BuildTextUtils.transform.getPlainText((C=(p=(v=m.current)==null?void 0:v.getDocumentData().body)==null?void 0:p.dataStream)!=null?C:"")});l.useEffect(()=>{var p,C,_,I;j(u.BuildTextUtils.transform.getPlainText((_=(C=(p=m.current)==null?void 0:p.getDocumentData().body)==null?void 0:C.dataStream)!=null?_:""));const v=(I=m.current)==null?void 0:I.selectionChange$.subscribe(()=>{var o,N,q;j(u.BuildTextUtils.transform.getPlainText((q=(N=(o=m.current)==null?void 0:o.getDocumentData().body)==null?void 0:N.dataStream)!=null?q:""))});return()=>v==null?void 0:v.unsubscribe()},[(P=m.current)==null?void 0:P.selectionChange$]);const W=l.useMemo(()=>({keyCodes:[{keyCode:f.KeyCode.ENTER}],handler:v=>{v===f.KeyCode.ENTER&&T.executeCommand(ie.BreakLineCommand.id)}}),[T]);l.useImperativeHandle(e,()=>({reply(v){var C,_;if(!m.current)return;y.focus((C=m.current.getEditorId())!=null?C:"");const p=le(v);(_=m.current)==null||_.setDocumentData(p,[{startOffset:p.body.dataStream.length-2,endOffset:p.body.dataStream.length-2,collapsed:!0}])}}));const S=()=>{if(m.current){const v=u.Tools.deepClone(m.current.getDocumentData().body);O(!1),r==null||r({...t,text:v}),m.current.replaceText(""),setTimeout(()=>{var p,C;(p=m.current)==null||p.setSelectionRanges([]),(C=m.current)==null||C.blur()},10)}};return s.jsxs("div",{onClick:v=>v.preventDefault(),children:[s.jsx(ie.RichTextEditor,{className:"univer-w-full",editorRef:m,autoFocus:c,keyboardEventConfig:W,placeholder:U.t("threadCommentUI.editor.placeholder"),initialValue:(t==null?void 0:t.text)&&le(t.text),onFocusChange:v=>v&&O(v),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{y.focus(h)},30)}}),A?s.jsxs("div",{className:"univer-mt-3 univer-flex univer-flex-row univer-justify-end",children:[s.jsx(B.Button,{style:{marginRight:12},onClick:()=>{var v;a==null||a(),O(!1),(v=m.current)==null||v.replaceText("",!0),T.executeCommand(F.id)},children:U.t("threadCommentUI.editor.cancel")}),s.jsx(B.Button,{variant:"primary",disabled:!E,onClick:S,children:U.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),Ae=n=>{const{dataStream:e,customRanges:t}=n,r=e.endsWith(`\r
|
|
1
|
+
"use strict";var ye=Object.defineProperty;var Se=(n,e,t)=>e in n?ye(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var K=(n,e,t)=>Se(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@univerjs/core"),V=require("@univerjs/thread-comment"),f=require("@univerjs/ui"),re=require("rxjs"),s=require("react/jsx-runtime"),B=require("@univerjs/design"),l=require("react"),ie=require("@univerjs/docs-ui");var _e=Object.getOwnPropertyDescriptor,je=(n,e,t,r)=>{for(var i=r>1?void 0:r?_e(e,t):e,a=n.length-1,c;a>=0;a--)(c=n[a])&&(i=c(i)||i);return i},ae=(n,e)=>(t,r)=>e(t,r,n);exports.ThreadCommentPanelService=class extends u.Disposable{constructor(t,r){super();K(this,"_panelVisible",!1);K(this,"_panelVisible$",new re.BehaviorSubject(!1));K(this,"_activeCommentId");K(this,"_activeCommentId$",new re.BehaviorSubject(void 0));K(this,"panelVisible$",this._panelVisible$.asObservable());K(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$(u.UniverInstanceType.UNIVER_SHEET).pipe(re.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)}};exports.ThreadCommentPanelService=je([ae(0,u.Inject(f.ISidebarService)),ae(1,u.IUniverInstanceService)],exports.ThreadCommentPanelService);const de="thread-comment-panel",Ne="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:u.CommandType.OPERATION,handler(n){const e=n.get(f.ISidebarService),t=n.get(exports.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:de},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:u.CommandType.OPERATION,handler(n,e){return n.get(exports.ThreadCommentPanelService).setActiveComment(e),!0}},Te="thread-comment-ui.config",oe={};var we=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,Oe=(n,e,t)=>e in n?we(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ee=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ue(e,t):e,a=n.length-1,c;a>=0;a--)(c=n[a])&&(i=c(i)||i);return i},se=(n,e)=>(t,r)=>e(t,r,n),ce=(n,e,t)=>Oe(n,typeof e!="symbol"?e+"":e,t);exports.UniverThreadCommentUIPlugin=class extends u.Plugin{constructor(e=oe,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:a,...c}=u.merge({},oe,this._config);a&&this._configService.setConfig("menu",a,{merge:!0}),this._configService.setConfig(Te,c)}onStarting(){var e;u.mergeOverrideWithDependencies([[exports.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,F].forEach(t=>{this._commandService.registerCommand(t)})}};ce(exports.UniverThreadCommentUIPlugin,"pluginName",Ne);ce(exports.UniverThreadCommentUIPlugin,"type",u.UniverInstanceType.UNIVER_UNKNOWN);exports.UniverThreadCommentUIPlugin=Ee([u.DependentOn(V.UniverThreadCommentPlugin),se(1,u.Inject(u.Injector)),se(2,u.ICommandService),se(3,u.IConfigService)],exports.UniverThreadCommentUIPlugin);var k=function(){return k=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},k.apply(this,arguments)},De=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 i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},G=l.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,a=n.extend,c=De(n,["icon","id","className","extend"]),g="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),x=l.useRef("_".concat(ke()));return ve(t,"".concat(r),{defIds:t.defIds,idSuffix:x.current},k({ref:e,className:g},c),a)});function ve(n,e,t,r,i){return l.createElement(n.tag,k(k({key:e},Re(n,t,i)),r),(Me(n,t).children||[]).map(function(a,c){return ve(a,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,i)}))}function Re(n,e,t){var r=k({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1),n.tag==="mask"&&r.id&&(r.id=r.id+e.idSuffix),Object.entries(r).forEach(function(a){var c=a[0],g=a[1];c==="mask"&&typeof g=="string"&&(r[c]=g.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(a){var c=a[0],g=a[1];typeof g=="string"&&(r[c]=g.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Me(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)?k(k({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?k(k({},i),{attrs:k(k({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function ke(){return Math.random().toString(36).substring(2,8)}G.displayName="UniverIcon";var Pe={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"}}]},me=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"delete-single",ref:e,icon:Pe}))});me.displayName="DeleteSingle";var $e={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"}}]},fe=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"increase-single",ref:e,icon:$e}))});fe.displayName="IncreaseSingle";var He={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"}}]},he=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:He}))});he.displayName="MoreHorizontalSingle";var Le={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}}]},pe=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:Le}))});pe.displayName="ReplyToCommentSingle";var Ve={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"}}]},ge=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"resolved-single",ref:e,icon:Ve}))});ge.displayName="ResolvedSingle";var Be={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}}]},xe=l.forwardRef(function(n,e){return l.createElement(G,Object.assign({},n,{id:"solve-single",ref:e,icon:Be}))});xe.displayName="SolveSingle";function le(n){return{id:"d",body:n,documentStyle:{}}}const Ce=l.forwardRef((n,e)=>{var P;const{comment:t,onSave:r,id:i,onCancel:a,autoFocus:c,unitId:g,type:x}=n,T=f.useDependency(u.ICommandService),U=f.useDependency(u.LocaleService),[A,O]=l.useState(!1),S=f.useDependency(ie.IEditorService),m=l.useRef(null),h=x===u.UniverInstanceType.UNIVER_SHEET?u.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:g,[E,_]=l.useState(()=>{var v,p,C;return u.BuildTextUtils.transform.getPlainText((C=(p=(v=m.current)==null?void 0:v.getDocumentData().body)==null?void 0:p.dataStream)!=null?C:"")});l.useEffect(()=>{var p,C,j,I;_(u.BuildTextUtils.transform.getPlainText((j=(C=(p=m.current)==null?void 0:p.getDocumentData().body)==null?void 0:C.dataStream)!=null?j:""));const v=(I=m.current)==null?void 0:I.selectionChange$.subscribe(()=>{var o,N,q;_(u.BuildTextUtils.transform.getPlainText((q=(N=(o=m.current)==null?void 0:o.getDocumentData().body)==null?void 0:N.dataStream)!=null?q:""))});return()=>v==null?void 0:v.unsubscribe()},[(P=m.current)==null?void 0:P.selectionChange$]);const W=l.useMemo(()=>({keyCodes:[{keyCode:f.KeyCode.ENTER}],handler:v=>{v===f.KeyCode.ENTER&&T.executeCommand(ie.BreakLineCommand.id)}}),[T]);l.useImperativeHandle(e,()=>({reply(v){var C,j;if(!m.current)return;S.focus((C=m.current.getEditorId())!=null?C:"");const p=le(v);(j=m.current)==null||j.setDocumentData(p,[{startOffset:p.body.dataStream.length-2,endOffset:p.body.dataStream.length-2,collapsed:!0}])}}));const y=()=>{if(m.current){const v=u.Tools.deepClone(m.current.getDocumentData().body);O(!1),r==null||r({...t,text:v}),m.current.replaceText(""),setTimeout(()=>{var p,C;(p=m.current)==null||p.setSelectionRanges([]),(C=m.current)==null||C.blur()},10)}};return s.jsxs("div",{onClick:v=>v.preventDefault(),children:[s.jsx(ie.RichTextEditor,{className:"univer-w-full",editorRef:m,autoFocus:c,keyboardEventConfig:W,placeholder:U.t("threadCommentUI.editor.placeholder"),initialValue:(t==null?void 0:t.text)&&le(t.text),onFocusChange:v=>v&&O(v),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{S.focus(h)},30)}}),A?s.jsxs("div",{className:"univer-mt-3 univer-flex univer-flex-row univer-justify-end",children:[s.jsx(B.Button,{style:{marginRight:12},onClick:()=>{var v;a==null||a(),O(!1),(v=m.current)==null||v.replaceText("",!0),T.executeCommand(F.id)},children:U.t("threadCommentUI.editor.cancel")}),s.jsx(B.Button,{variant:"primary",disabled:!E,onClick:y,children:U.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),Ae=n=>{const{dataStream:e,customRanges:t}=n,r=e.endsWith(`\r
|
|
2
2
|
`)?e.length-2:e.length,i=[];let a=0;return t==null||t.forEach(c=>{a<c.startIndex&&i.push({type:"text",content:e.slice(a,c.startIndex)}),i.push({type:"mention",content:{label:e.slice(c.startIndex,c.endIndex+1),id:c.rangeId}}),a=c.endIndex+1}),i.push({type:"text",content:e.slice(a,r)}),i},We=n=>{const{paragraphs:e=[]}=n;let t=0;return e.map(r=>{const i=u.getBodySlice(n,t,r.startIndex);return t=r.startIndex+1,Ae(i)})},Fe=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=r.content.label;const a=e.length-1;t.push({rangeId:r.content.id,rangeType:u.CustomRangeType.MENTION,startIndex:i,endIndex:a,properties:{},wholeEntity:!0});break}}}),e+=`\r
|
|
3
|
-
`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},Ie="__mock__",qe=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:a,onReply:c,resolved:g,isRoot:x,onClose:T,onDeleteComment:U,type:A}=n,O=f.useDependency(u.ICommandService),
|
|
3
|
+
`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},Ie="__mock__",qe=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:a,onReply:c,resolved:g,isRoot:x,onClose:T,onDeleteComment:U,type:A}=n,O=f.useDependency(u.ICommandService),S=f.useDependency(u.LocaleService),m=f.useDependency(u.UserManagerService),h=m.getUser(e.personId),E=f.useObservable(m.currentUser$),_=(E==null?void 0:E.userID)===e.personId,W=e.id===Ie,[y,P]=l.useState(!1),v=f.useConfigValue(f.UI_PLUGIN_CONFIG_KEY),p=v==null?void 0:v.avatarFallback,C=()=>{(U==null?void 0:U(e))!==!1&&(O.executeCommand(x?V.DeleteCommentTreeCommand.id:V.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),x&&(T==null||T()))};return s.jsxs("div",{className:"univer-relative univer-mb-3 univer-pl-[30px]",onMouseLeave:()=>P(!1),onMouseEnter:()=>P(!0),children:[s.jsx("div",{className:`
|
|
4
4
|
univer-absolute univer-left-0 univer-top-0 univer-h-6 univer-w-6 univer-rounded-full univer-bg-cover
|
|
5
5
|
univer-bg-center univer-bg-no-repeat
|
|
6
|
-
`,style:{backgroundImage:`url(${(h==null?void 0:h.avatar)||p})`}}),h?s.jsxs("div",{className:"univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between",children:[s.jsx("div",{className:"univer-text-sm univer-font-medium univer-leading-5",children:(h==null?void 0:h.name)||" "}),s.jsxs("div",{children:[W||g?null:
|
|
6
|
+
`,style:{backgroundImage:`url(${(h==null?void 0:h.avatar)||p})`}}),h?s.jsxs("div",{className:"univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between",children:[s.jsx("div",{className:"univer-text-sm univer-font-medium univer-leading-5",children:(h==null?void 0:h.name)||" "}),s.jsxs("div",{children:[W||g?null:y&&h?s.jsx("div",{className:`
|
|
7
7
|
univer-ml-1 univer-inline-flex univer-h-6 univer-w-6
|
|
8
8
|
univer-cursor-pointer univer-items-center univer-justify-center
|
|
9
9
|
univer-rounded-sm univer-text-base
|
|
10
10
|
hover:univer-bg-gray-50
|
|
11
|
-
`,onClick:()=>c(h),children:s.jsx(pe,{})}):null,
|
|
12
|
-
univer-m-0 univer-
|
|
13
|
-
univer-text-sm
|
|
14
|
-
[&_a]:univer-
|
|
15
|
-
|
|
11
|
+
`,onClick:()=>c(h),children:s.jsx(pe,{})}):null,_&&!W&&!g?s.jsx(B.Dropdown,{overlay:s.jsx("div",{className:"univer-rounded-lg",children:s.jsxs("ul",{className:`
|
|
12
|
+
univer-m-0 univer-box-border univer-grid univer-list-none
|
|
13
|
+
univer-p-1.5 univer-text-[13px] univer-text-sm
|
|
14
|
+
[&_a]:univer-block [&_a]:univer-cursor-pointer
|
|
15
|
+
[&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5
|
|
16
|
+
[&_a]:univer-transition-colors
|
|
17
|
+
`,children:[s.jsx("li",{children:s.jsx("a",{className:"hover:univer-bg-gray-200",onClick:()=>a==null?void 0:a(!0),children:S.t("threadCommentUI.item.edit")})}),s.jsx("li",{children:s.jsx("a",{className:"hover:univer-bg-gray-200",onClick:C,children:S.t("threadCommentUI.item.delete")})})]})}),children:s.jsx("div",{className:`
|
|
16
18
|
univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer
|
|
17
|
-
univer-items-center univer-justify-center univer-rounded-
|
|
19
|
+
univer-items-center univer-justify-center univer-rounded-sm
|
|
18
20
|
univer-text-base
|
|
19
21
|
hover:univer-bg-gray-50
|
|
20
|
-
`,children:s.jsx(he,{})})}):null]})]}):null,s.jsx("div",{className:"univer-mb-1 univer-text-xs univer-
|
|
21
|
-
\r`},personId:(ne=R==null?void 0:R.userID)!=null?ne:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(J=o==null?void 0:o.children)!=null?J:[]],$=l.useRef(null),Q=b=>{b.stopPropagation(),D?N.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):N.executeCommand(F.id),N.executeCommand(V.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!D}),E==null||E(!D)},Y=b=>{b.stopPropagation(),N.executeCommand(F.id),!(o!=null&&o.root&&(h==null?void 0:h(o.root))===!1)&&(N.executeCommand(V.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),x==null||x())};l.useEffect(()=>
|
|
22
|
+
`,children:s.jsx(he,{})})}):null]})]}):null,s.jsx("div",{className:"univer-mb-1 univer-text-xs/normal univer-text-gray-600",children:e.dT}),i?s.jsx(Ce,{type:A,id:e.id,comment:e,onCancel:()=>a==null?void 0:a(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:j,attachments:I})=>{a==null||a(!1),O.executeCommand(V.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:j,attachments:I}})}}):s.jsx("div",{className:"univer-text-[13px]/normal univer-text-gray-900",children:We(e.text).map((j,I)=>s.jsx("div",{className:"univer-break-words",children:j.map((o,N)=>{switch(o.type){case"mention":return s.jsxs("a",{className:"univer-text-primary-600",children:[o.content.label," "]},N);default:return o.content}})},I))})]})},be=n=>{var ne,J,d;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:a=!0,onClick:c,showHighlight:g,onClose:x,getSubUnitName:T,prefix:U,autoFocus:A,onMouseEnter:O,onMouseLeave:S,onAddComment:m,onDeleteComment:h,onResolve:E,type:_,style:W,full:y}=n,P=f.useDependency(V.ThreadCommentModel),[v,p]=l.useState(!1),[C,j]=l.useState(""),I=l.useMemo(()=>P.commentUpdate$.pipe(re.debounceTime(16)),[P]);f.useObservable(I);const o=e?P.getCommentWithChildren(t,r,e):null,N=f.useDependency(u.ICommandService),q=f.useDependency(u.UserManagerService),D=o==null?void 0:o.root.resolved,R=f.useObservable(q.currentUser$),H=l.useRef(null),Z=[...o?[o.root]:[{id:Ie,text:{dataStream:`
|
|
23
|
+
\r`},personId:(ne=R==null?void 0:R.userID)!=null?ne:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(J=o==null?void 0:o.children)!=null?J:[]],$=l.useRef(null),Q=b=>{b.stopPropagation(),D?N.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):N.executeCommand(F.id),N.executeCommand(V.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!D}),E==null||E(!D)},Y=b=>{b.stopPropagation(),N.executeCommand(F.id),!(o!=null&&o.root&&(h==null?void 0:h(o.root))===!1)&&(N.executeCommand(V.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),x==null||x())};l.useEffect(()=>S==null?void 0:S(),[]);const X=T((d=o==null?void 0:o.root.subUnitId)!=null?d:r),ee=a&&!C&&!D,te=`${i||(o==null?void 0:o.root.ref)||""}${X?" · ":""}${X}`;return s.jsxs("div",{className:B.clsx(`
|
|
22
24
|
univer-relative univer-box-border univer-rounded-lg univer-border univer-border-solid
|
|
23
25
|
univer-border-gray-200 univer-bg-white univer-p-4
|
|
24
|
-
`,
|
|
26
|
+
`,y?"univer-w-full":"univer-w-[278px]",{"univer-shadow":!D&&(g||v||U==="cell")}),style:W,onClick:c,id:`${U}-${t}-${r}-${e}`,onMouseEnter:()=>{O==null||O(),p(!0)},onMouseLeave:()=>{S==null||S(),p(!1)},children:[!D&&g?s.jsx("div",{className:`
|
|
25
27
|
univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-1.5 univer-rounded-t-md
|
|
26
28
|
univer-bg-yellow-400
|
|
27
29
|
`}):null,s.jsxs("div",{className:`
|
|
@@ -41,7 +43,7 @@
|
|
|
41
43
|
univer-items-center univer-justify-center univer-rounded-[3px]
|
|
42
44
|
univer-text-base
|
|
43
45
|
hover:univer-bg-gray-50
|
|
44
|
-
`,onClick:Y,children:s.jsx(me,{})}):null]}):null]}),s.jsx("div",{ref:$,className:"univer-max-h-[300px] univer-overflow-y-auto univer-overflow-x-hidden",children:Z.map(b=>s.jsx(qe,{onClose:x,unitId:t,subUnitId:r,item:b,isRoot:b.id===(o==null?void 0:o.root.id),editing:C===b.id,resolved:o==null?void 0:o.root.resolved,type:
|
|
46
|
+
`,onClick:Y,children:s.jsx(me,{})}):null]}):null]}),s.jsx("div",{ref:$,className:"univer-max-h-[300px] univer-overflow-y-auto univer-overflow-x-hidden",children:Z.map(b=>s.jsx(qe,{onClose:x,unitId:t,subUnitId:r,item:b,isRoot:b.id===(o==null?void 0:o.root.id),editing:C===b.id,resolved:o==null?void 0:o.root.resolved,type:_,onEditingChange:M=>{j(M?b.id:"")},onReply:M=>{M&&requestAnimationFrame(()=>{var L;(L=H.current)==null||L.reply(Fe([{type:"mention",content:{id:M.userID,label:`@${M.name}`}},{type:"text",content:" "}]))})},onAddComment:m,onDeleteComment:h},b.id))}),ee?s.jsx("div",{children:s.jsx(Ce,{ref:H,type:_,unitId:t,subUnitId:r,onSave:async({text:b,attachments:M})=>{const L={text:b,attachments:M,dT:V.getDT(),id:u.generateRandomId(),ref:i,personId:R==null?void 0:R.userID,parentId:o==null?void 0:o.root.id,unitId:t,subUnitId:r,threadId:o==null?void 0:o.root.threadId};(m==null?void 0:m(L))!==!1&&(await N.executeCommand(V.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:L}),$.current&&($.current.scrollTop=$.current.scrollHeight))},autoFocus:A||!o,onCancel:()=>{o||x==null||x()}},`${A}`)}):null]})},ze=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:a,onResolve:c,sortComments:g,onItemLeave:x,onItemEnter:T,disableAdd:U,tempComment:A,onAddComment:O,onDeleteComment:S,showComments:m}=n,[h,E]=l.useState("all"),[_,W]=l.useState("all"),y=f.useDependency(u.LocaleService),P=f.useDependency(u.UserManagerService),v=f.useDependency(V.ThreadCommentModel),[p,C]=l.useState(()=>v.getUnit(e)),j=f.useDependency(exports.ThreadCommentPanelService),I=f.useObservable(j.activeCommentId$),o=f.useObservable(v.commentUpdate$),N=f.useDependency(u.ICommandService),q=f.useObservable(t),D=l.useRef(!0),R="panel",H=f.useObservable(P.currentUser$),Z=l.useMemo(()=>{var L;const d=h==="all"?p:(L=p.filter(w=>w.subUnitId===q))!=null?L:[],b=g!=null?g:w=>w,M=d.map(w=>{var z;return{...w.root,children:(z=w.children)!=null?z:[],users:w.relativeUsers}});if(m){const w=new Map;return M.forEach(z=>{w.set(z.id,z)}),[...m,""].map(z=>w.get(z)).filter(Boolean)}else return b(M)},[m,h,p,g,q]),$=l.useMemo(()=>[...Z.filter(d=>!d.resolved),...Z.filter(d=>d.resolved)],[Z]),Q=l.useMemo(()=>_==="resolved"?$.filter(d=>d.resolved):_==="unsolved"?$.filter(d=>!d.resolved):_==="concern_me"&&H!=null&&H.userID?$.filter(d=>d==null?void 0:d.users.has(H.userID)):$,[$,H==null?void 0:H.userID,_]),Y=A?[A,...Q]:Q,X=Y.filter(d=>!d.resolved),ee=Y.filter(d=>d.resolved),te=_!=="all"||h!=="all",ne=()=>{W("all"),E("all")};l.useEffect(()=>{e&&C(v.getUnit(e))},[e,v,o]),l.useEffect(()=>{var w;if(!I)return;if(!D.current){D.current=!0;return}const{unitId:d,subUnitId:b,commentId:M}=I,L=`${R}-${d}-${b}-${M}`;(w=document.getElementById(L))==null||w.scrollIntoView({block:"center"})},[I]);const J=d=>s.jsx(be,{full:!0,prefix:R,getSubUnitName:a,id:d.id,unitId:d.unitId,subUnitId:d.subUnitId,refStr:d.ref,type:r,showEdit:(I==null?void 0:I.commentId)===d.id,showHighlight:(I==null?void 0:I.commentId)===d.id,onClick:()=>{D.current=!1,d.resolved?N.executeCommand(F.id):N.executeCommand(F.id,{unitId:d.unitId,subUnitId:d.subUnitId,commentId:d.id,temp:!1})},onMouseEnter:()=>T==null?void 0:T(d),onMouseLeave:()=>x==null?void 0:x(d),onAddComment:O,onDeleteComment:S,onResolve:b=>c==null?void 0:c(d.id,b)},d.id);return s.jsxs("div",{className:"univer-flex univer-min-h-full univer-flex-col univer-pb-3",children:[s.jsxs("div",{className:"univer-mt-3 univer-flex univer-flex-row univer-justify-between",children:[r===u.UniverInstanceType.UNIVER_SHEET?s.jsx(B.Select,{borderless:!0,value:h,options:[{value:"current",label:y.t("threadCommentUI.filter.sheet.current")},{value:"all",label:y.t("threadCommentUI.filter.sheet.all")}],onChange:E}):null,s.jsx(B.Select,{borderless:!0,value:_,options:[{value:"all",label:y.t("threadCommentUI.filter.status.all")},{value:"resolved",label:y.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:y.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:y.t("threadCommentUI.filter.status.concernMe")}],onChange:W})]}),Y.length===0?s.jsxs("div",{className:`
|
|
45
47
|
univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center
|
|
46
48
|
univer-text-[13px] univer-text-gray-600
|
|
47
|
-
`,children:[
|
|
49
|
+
`,children:[y.t("threadCommentUI.panel.empty"),te?s.jsx("div",{className:"univer-mt-2 univer-flex univer-flex-row",children:s.jsx(B.Button,{onClick:ne,children:y.t("threadCommentUI.panel.reset")})}):U?null:s.jsx("div",{className:"univer-mt-2 univer-flex univer-flex-row",children:s.jsxs(B.Button,{onClick:i,children:[s.jsx(fe,{className:"univer-mr-1.5"}),y.t("threadCommentUI.panel.add")]})})]}):s.jsxs("div",{className:"univer-mt-3 univer-flex univer-flex-col univer-gap-3",children:[X.map(J),ee.length>0&&s.jsx("div",{className:"univer-text-xs",children:y.t("threadCommentUI.panel.solved")}),ee.map(J)]})]})};exports.SetActiveCommentOperation=F;exports.THREAD_COMMENT_PANEL=de;exports.ThreadCommentPanel=ze;exports.ThreadCommentTree=be;exports.ToggleSheetCommentPanelOperation=ue;
|
package/lib/es/index.js
CHANGED
|
@@ -3,15 +3,15 @@ var Pe = (t, e, n) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var z = (t, e, n) => Pe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
import { Inject as Se, IUniverInstanceService as Ve, Disposable as Ae, UniverInstanceType as ce, CommandType as _e, DependentOn as Be, Injector as We, ICommandService as ne, IConfigService as Fe, Plugin as ze, merge as Ge, mergeOverrideWithDependencies as Ke, LocaleService as fe, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ze, BuildTextUtils as ve, Tools as Ye, CustomRangeType as qe, getBodySlice as Je, UserManagerService as he, generateRandomId as Qe } from "@univerjs/core";
|
|
5
5
|
import { UniverThreadCommentPlugin as Xe, ThreadCommentModel as Ne, getDT as et, AddCommentCommand as tt, ResolveCommentCommand as nt, DeleteCommentTreeCommand as we, UpdateCommentCommand as rt, DeleteCommentCommand as it } from "@univerjs/thread-comment";
|
|
6
|
-
import { ISidebarService as Ue, useDependency as N, KeyCode as pe, useObservable as G, useConfigValue as
|
|
6
|
+
import { ISidebarService as Ue, useDependency as N, KeyCode as pe, useObservable as G, useConfigValue as ot, UI_PLUGIN_CONFIG_KEY as lt } from "@univerjs/ui";
|
|
7
7
|
import { BehaviorSubject as ge, filter as at, debounceTime as st } from "rxjs";
|
|
8
8
|
import { jsxs as x, jsx as a } from "react/jsx-runtime";
|
|
9
9
|
import { Button as se, clsx as Ce, Tooltip as dt, Dropdown as ut, Select as Ie } from "@univerjs/design";
|
|
10
10
|
import { forwardRef as B, useRef as te, createElement as Z, useState as A, useEffect as de, useMemo as ee, useImperativeHandle as ct } from "react";
|
|
11
11
|
import { IEditorService as vt, BreakLineCommand as mt, RichTextEditor as ft } from "@univerjs/docs-ui";
|
|
12
12
|
var ht = Object.getOwnPropertyDescriptor, pt = (t, e, n, r) => {
|
|
13
|
-
for (var i = r > 1 ? void 0 : r ? ht(e, n) : e,
|
|
14
|
-
(d = t[
|
|
13
|
+
for (var i = r > 1 ? void 0 : r ? ht(e, n) : e, o = t.length - 1, d; o >= 0; o--)
|
|
14
|
+
(d = t[o]) && (i = d(i) || i);
|
|
15
15
|
return i;
|
|
16
16
|
}, xe = (t, e) => (n, r) => e(n, r, t);
|
|
17
17
|
let q = class extends Ae {
|
|
@@ -74,19 +74,19 @@ const gt = "thread-comment-panel", Ct = "UNIVER_THREAD_COMMENT_UI_PLUGIN", It =
|
|
|
74
74
|
}
|
|
75
75
|
}, xt = "thread-comment-ui.config", be = {};
|
|
76
76
|
var bt = Object.defineProperty, yt = Object.getOwnPropertyDescriptor, St = (t, e, n) => e in t ? bt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, _t = (t, e, n, r) => {
|
|
77
|
-
for (var i = r > 1 ? void 0 : r ? yt(e, n) : e,
|
|
78
|
-
(d = t[
|
|
77
|
+
for (var i = r > 1 ? void 0 : r ? yt(e, n) : e, o = t.length - 1, d; o >= 0; o--)
|
|
78
|
+
(d = t[o]) && (i = d(i) || i);
|
|
79
79
|
return i;
|
|
80
80
|
}, me = (t, e) => (n, r) => e(n, r, t), Oe = (t, e, n) => St(t, typeof e != "symbol" ? e + "" : e, n);
|
|
81
81
|
let ue = class extends ze {
|
|
82
82
|
constructor(t = be, e, n, r) {
|
|
83
83
|
super(), this._config = t, this._injector = e, this._commandService = n, this._configService = r;
|
|
84
|
-
const { menu: i, ...
|
|
84
|
+
const { menu: i, ...o } = Ge(
|
|
85
85
|
{},
|
|
86
86
|
be,
|
|
87
87
|
this._config
|
|
88
88
|
);
|
|
89
|
-
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(xt,
|
|
89
|
+
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(xt, o);
|
|
90
90
|
}
|
|
91
91
|
onStarting() {
|
|
92
92
|
var t;
|
|
@@ -123,23 +123,23 @@ var M = function() {
|
|
|
123
123
|
e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]);
|
|
124
124
|
return n;
|
|
125
125
|
}, Y = B(function(t, e) {
|
|
126
|
-
var n = t.icon, r = t.id, i = t.className,
|
|
127
|
-
return Te(n, "".concat(r), { defIds: n.defIds, idSuffix: h.current }, M({ ref: e, className: f }, d),
|
|
126
|
+
var n = t.icon, r = t.id, i = t.className, o = t.extend, d = Nt(t, ["icon", "id", "className", "extend"]), f = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), h = te("_".concat(Ot()));
|
|
127
|
+
return Te(n, "".concat(r), { defIds: n.defIds, idSuffix: h.current }, M({ ref: e, className: f }, d), o);
|
|
128
128
|
});
|
|
129
129
|
function Te(t, e, n, r, i) {
|
|
130
|
-
return Z(t.tag, M(M({ key: e }, wt(t, n, i)), r), (Ut(t, n).children || []).map(function(
|
|
131
|
-
return Te(
|
|
130
|
+
return Z(t.tag, M(M({ key: e }, wt(t, n, i)), r), (Ut(t, n).children || []).map(function(o, d) {
|
|
131
|
+
return Te(o, "".concat(e, "-").concat(t.tag, "-").concat(d), n, void 0, i);
|
|
132
132
|
}));
|
|
133
133
|
}
|
|
134
134
|
function wt(t, e, n) {
|
|
135
135
|
var r = M({}, t.attrs);
|
|
136
|
-
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1), t.tag === "mask" && r.id && (r.id = r.id + e.idSuffix), Object.entries(r).forEach(function(
|
|
137
|
-
var d =
|
|
136
|
+
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1), t.tag === "mask" && r.id && (r.id = r.id + e.idSuffix), Object.entries(r).forEach(function(o) {
|
|
137
|
+
var d = o[0], f = o[1];
|
|
138
138
|
d === "mask" && typeof f == "string" && (r[d] = f.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
139
139
|
});
|
|
140
140
|
var i = e.defIds;
|
|
141
|
-
return !i || i.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(
|
|
142
|
-
var d =
|
|
141
|
+
return !i || i.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(o) {
|
|
142
|
+
var d = o[0], f = o[1];
|
|
143
143
|
typeof f == "string" && (r[d] = f.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
144
144
|
})), r;
|
|
145
145
|
}
|
|
@@ -210,7 +210,7 @@ function ye(t) {
|
|
|
210
210
|
}
|
|
211
211
|
const je = B((t, e) => {
|
|
212
212
|
var R;
|
|
213
|
-
const { comment: n, onSave: r, id: i, onCancel:
|
|
213
|
+
const { comment: n, onSave: r, id: i, onCancel: o, autoFocus: d, unitId: f, type: h } = t, w = N(ne), O = N(fe), [P, T] = A(!1), b = N(vt), c = te(null), v = h === ce.UNIVER_SHEET ? Ze : f, [E, y] = A(() => {
|
|
214
214
|
var u, m, p;
|
|
215
215
|
return ve.transform.getPlainText((p = (m = (u = c.current) == null ? void 0 : u.getDocumentData().body) == null ? void 0 : m.dataStream) != null ? p : "");
|
|
216
216
|
});
|
|
@@ -218,8 +218,8 @@ const je = B((t, e) => {
|
|
|
218
218
|
var m, p, S, g;
|
|
219
219
|
y(ve.transform.getPlainText((S = (p = (m = c.current) == null ? void 0 : m.getDocumentData().body) == null ? void 0 : p.dataStream) != null ? S : ""));
|
|
220
220
|
const u = (g = c.current) == null ? void 0 : g.selectionChange$.subscribe(() => {
|
|
221
|
-
var
|
|
222
|
-
y(ve.transform.getPlainText((W = (_ = (
|
|
221
|
+
var l, _, W;
|
|
222
|
+
y(ve.transform.getPlainText((W = (_ = (l = c.current) == null ? void 0 : l.getDocumentData().body) == null ? void 0 : _.dataStream) != null ? W : ""));
|
|
223
223
|
});
|
|
224
224
|
return () => u == null ? void 0 : u.unsubscribe();
|
|
225
225
|
}, [(R = c.current) == null ? void 0 : R.selectionChange$]);
|
|
@@ -284,7 +284,7 @@ const je = B((t, e) => {
|
|
|
284
284
|
style: { marginRight: 12 },
|
|
285
285
|
onClick: () => {
|
|
286
286
|
var u;
|
|
287
|
-
|
|
287
|
+
o == null || o(), T(!1), (u = c.current) == null || u.replaceText("", !0), w.executeCommand(K.id);
|
|
288
288
|
},
|
|
289
289
|
children: O.t("threadCommentUI.editor.cancel")
|
|
290
290
|
}
|
|
@@ -303,21 +303,21 @@ const je = B((t, e) => {
|
|
|
303
303
|
}), Rt = (t) => {
|
|
304
304
|
const { dataStream: e, customRanges: n } = t, r = e.endsWith(`\r
|
|
305
305
|
`) ? e.length - 2 : e.length, i = [];
|
|
306
|
-
let
|
|
306
|
+
let o = 0;
|
|
307
307
|
return n == null || n.forEach((d) => {
|
|
308
|
-
|
|
308
|
+
o < d.startIndex && i.push({
|
|
309
309
|
type: "text",
|
|
310
|
-
content: e.slice(
|
|
310
|
+
content: e.slice(o, d.startIndex)
|
|
311
311
|
}), i.push({
|
|
312
312
|
type: "mention",
|
|
313
313
|
content: {
|
|
314
314
|
label: e.slice(d.startIndex, d.endIndex + 1),
|
|
315
315
|
id: d.rangeId
|
|
316
316
|
}
|
|
317
|
-
}),
|
|
317
|
+
}), o = d.endIndex + 1;
|
|
318
318
|
}), i.push({
|
|
319
319
|
type: "text",
|
|
320
|
-
content: e.slice(
|
|
320
|
+
content: e.slice(o, r)
|
|
321
321
|
}), i;
|
|
322
322
|
}, jt = (t) => {
|
|
323
323
|
const { paragraphs: e = [] } = t;
|
|
@@ -337,12 +337,12 @@ const je = B((t, e) => {
|
|
|
337
337
|
case "mention": {
|
|
338
338
|
const i = e.length;
|
|
339
339
|
e += r.content.label;
|
|
340
|
-
const
|
|
340
|
+
const o = e.length - 1;
|
|
341
341
|
n.push({
|
|
342
342
|
rangeId: r.content.id,
|
|
343
343
|
rangeType: qe.MENTION,
|
|
344
344
|
startIndex: i,
|
|
345
|
-
endIndex:
|
|
345
|
+
endIndex: o,
|
|
346
346
|
properties: {},
|
|
347
347
|
wholeEntity: !0
|
|
348
348
|
});
|
|
@@ -367,7 +367,7 @@ const je = B((t, e) => {
|
|
|
367
367
|
customRanges: n
|
|
368
368
|
};
|
|
369
369
|
}, He = "__mock__", Lt = (t) => {
|
|
370
|
-
const { item: e, unitId: n, subUnitId: r, editing: i, onEditingChange:
|
|
370
|
+
const { item: e, unitId: n, subUnitId: r, editing: i, onEditingChange: o, onReply: d, resolved: f, isRoot: h, onClose: w, onDeleteComment: O, type: P } = t, T = N(ne), b = N(fe), c = N(he), v = c.getUser(e.personId), E = G(c.currentUser$), y = (E == null ? void 0 : E.userID) === e.personId, V = e.id === He, [I, R] = A(!1), u = ot(lt), m = u == null ? void 0 : u.avatarFallback, p = () => {
|
|
371
371
|
(O == null ? void 0 : O(e)) !== !1 && (T.executeCommand(
|
|
372
372
|
h ? we.id : it.id,
|
|
373
373
|
{
|
|
@@ -409,20 +409,22 @@ const je = B((t, e) => {
|
|
|
409
409
|
y && !V && !f ? /* @__PURE__ */ a(
|
|
410
410
|
ut,
|
|
411
411
|
{
|
|
412
|
-
overlay: /* @__PURE__ */ a("div", { className: "univer-rounded-lg
|
|
412
|
+
overlay: /* @__PURE__ */ a("div", { className: "univer-rounded-lg", children: /* @__PURE__ */ x(
|
|
413
413
|
"ul",
|
|
414
414
|
{
|
|
415
415
|
className: `
|
|
416
|
-
univer-m-0 univer-
|
|
417
|
-
univer-text-sm
|
|
418
|
-
[&_a]:univer-
|
|
416
|
+
univer-m-0 univer-box-border univer-grid univer-list-none
|
|
417
|
+
univer-p-1.5 univer-text-[13px] univer-text-sm
|
|
418
|
+
[&_a]:univer-block [&_a]:univer-cursor-pointer
|
|
419
|
+
[&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5
|
|
420
|
+
[&_a]:univer-transition-colors
|
|
419
421
|
`,
|
|
420
422
|
children: [
|
|
421
423
|
/* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
422
424
|
"a",
|
|
423
425
|
{
|
|
424
426
|
className: "hover:univer-bg-gray-200",
|
|
425
|
-
onClick: () =>
|
|
427
|
+
onClick: () => o == null ? void 0 : o(!0),
|
|
426
428
|
children: b.t("threadCommentUI.item.edit")
|
|
427
429
|
}
|
|
428
430
|
) }),
|
|
@@ -442,7 +444,7 @@ const je = B((t, e) => {
|
|
|
442
444
|
{
|
|
443
445
|
className: `
|
|
444
446
|
univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer
|
|
445
|
-
univer-items-center univer-justify-center univer-rounded-
|
|
447
|
+
univer-items-center univer-justify-center univer-rounded-sm
|
|
446
448
|
univer-text-base
|
|
447
449
|
hover:univer-bg-gray-50
|
|
448
450
|
`,
|
|
@@ -453,19 +455,19 @@ const je = B((t, e) => {
|
|
|
453
455
|
) : null
|
|
454
456
|
] })
|
|
455
457
|
] }) : null,
|
|
456
|
-
/* @__PURE__ */ a("div", { className: "univer-mb-1 univer-text-xs univer-
|
|
458
|
+
/* @__PURE__ */ a("div", { className: "univer-mb-1 univer-text-xs/normal univer-text-gray-600", children: e.dT }),
|
|
457
459
|
i ? /* @__PURE__ */ a(
|
|
458
460
|
je,
|
|
459
461
|
{
|
|
460
462
|
type: P,
|
|
461
463
|
id: e.id,
|
|
462
464
|
comment: e,
|
|
463
|
-
onCancel: () =>
|
|
465
|
+
onCancel: () => o == null ? void 0 : o(!1),
|
|
464
466
|
autoFocus: !0,
|
|
465
467
|
unitId: n,
|
|
466
468
|
subUnitId: r,
|
|
467
469
|
onSave: ({ text: S, attachments: g }) => {
|
|
468
|
-
|
|
470
|
+
o == null || o(!1), T.executeCommand(
|
|
469
471
|
rt.id,
|
|
470
472
|
{
|
|
471
473
|
unitId: n,
|
|
@@ -479,15 +481,15 @@ const je = B((t, e) => {
|
|
|
479
481
|
);
|
|
480
482
|
}
|
|
481
483
|
}
|
|
482
|
-
) : /* @__PURE__ */ a("div", { className: "univer-text-[13px] univer-
|
|
483
|
-
switch (
|
|
484
|
+
) : /* @__PURE__ */ a("div", { className: "univer-text-[13px]/normal univer-text-gray-900", children: jt(e.text).map((S, g) => /* @__PURE__ */ a("div", { className: "univer-break-words", children: S.map((l, _) => {
|
|
485
|
+
switch (l.type) {
|
|
484
486
|
case "mention":
|
|
485
487
|
return /* @__PURE__ */ x("a", { className: "univer-text-primary-600", children: [
|
|
486
|
-
|
|
488
|
+
l.content.label,
|
|
487
489
|
" "
|
|
488
490
|
] }, _);
|
|
489
491
|
default:
|
|
490
|
-
return
|
|
492
|
+
return l.content;
|
|
491
493
|
}
|
|
492
494
|
}) }, g)) })
|
|
493
495
|
] });
|
|
@@ -498,7 +500,7 @@ const je = B((t, e) => {
|
|
|
498
500
|
unitId: n,
|
|
499
501
|
subUnitId: r,
|
|
500
502
|
refStr: i,
|
|
501
|
-
showEdit:
|
|
503
|
+
showEdit: o = !0,
|
|
502
504
|
onClick: d,
|
|
503
505
|
showHighlight: f,
|
|
504
506
|
onClose: h,
|
|
@@ -515,8 +517,8 @@ const je = B((t, e) => {
|
|
|
515
517
|
full: I
|
|
516
518
|
} = t, R = N(Ne), [u, m] = A(!1), [p, S] = A(""), g = ee(() => R.commentUpdate$.pipe(st(16)), [R]);
|
|
517
519
|
G(g);
|
|
518
|
-
const
|
|
519
|
-
...
|
|
520
|
+
const l = e ? R.getCommentWithChildren(n, r, e) : null, _ = N(ne), W = N(he), k = l == null ? void 0 : l.root.resolved, D = G(W.currentUser$), H = te(null), J = [
|
|
521
|
+
...l ? [l.root] : (
|
|
520
522
|
// mock empty comment
|
|
521
523
|
[{
|
|
522
524
|
id: He,
|
|
@@ -532,7 +534,7 @@ const je = B((t, e) => {
|
|
|
532
534
|
threadId: ""
|
|
533
535
|
}]
|
|
534
536
|
),
|
|
535
|
-
...(X =
|
|
537
|
+
...(X = l == null ? void 0 : l.children) != null ? X : []
|
|
536
538
|
], j = te(null), re = (C) => {
|
|
537
539
|
C.stopPropagation(), k ? _.executeCommand(K.id, {
|
|
538
540
|
unitId: n,
|
|
@@ -545,7 +547,7 @@ const je = B((t, e) => {
|
|
|
545
547
|
resolved: !k
|
|
546
548
|
}), E == null || E(!k);
|
|
547
549
|
}, Q = (C) => {
|
|
548
|
-
C.stopPropagation(), _.executeCommand(K.id), !(
|
|
550
|
+
C.stopPropagation(), _.executeCommand(K.id), !(l != null && l.root && (v == null ? void 0 : v(l.root)) === !1) && (_.executeCommand(
|
|
549
551
|
we.id,
|
|
550
552
|
{
|
|
551
553
|
unitId: n,
|
|
@@ -555,7 +557,7 @@ const je = B((t, e) => {
|
|
|
555
557
|
), h == null || h());
|
|
556
558
|
};
|
|
557
559
|
de(() => b == null ? void 0 : b(), []);
|
|
558
|
-
const ie = w((s =
|
|
560
|
+
const ie = w((s = l == null ? void 0 : l.root.subUnitId) != null ? s : r), oe = o && !p && !k, le = `${i || (l == null ? void 0 : l.root.ref) || ""}${ie ? " · " : ""}${ie}`;
|
|
559
561
|
return /* @__PURE__ */ x(
|
|
560
562
|
"div",
|
|
561
563
|
{
|
|
@@ -606,17 +608,17 @@ const je = B((t, e) => {
|
|
|
606
608
|
`
|
|
607
609
|
}
|
|
608
610
|
),
|
|
609
|
-
/* @__PURE__ */ a(dt, { showIfEllipsis: !0, title:
|
|
611
|
+
/* @__PURE__ */ a(dt, { showIfEllipsis: !0, title: le, children: /* @__PURE__ */ a(
|
|
610
612
|
"div",
|
|
611
613
|
{
|
|
612
614
|
className: `
|
|
613
615
|
univer-flex-1 univer-overflow-hidden univer-text-ellipsis univer-whitespace-nowrap
|
|
614
616
|
`,
|
|
615
|
-
children:
|
|
617
|
+
children: le
|
|
616
618
|
}
|
|
617
619
|
) })
|
|
618
620
|
] }),
|
|
619
|
-
|
|
621
|
+
l ? /* @__PURE__ */ x("div", { className: "univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row", children: [
|
|
620
622
|
/* @__PURE__ */ a(
|
|
621
623
|
"div",
|
|
622
624
|
{
|
|
@@ -634,7 +636,7 @@ const je = B((t, e) => {
|
|
|
634
636
|
children: k ? /* @__PURE__ */ a(Me, {}) : /* @__PURE__ */ a(Re, {})
|
|
635
637
|
}
|
|
636
638
|
),
|
|
637
|
-
(D == null ? void 0 : D.userID) ===
|
|
639
|
+
(D == null ? void 0 : D.userID) === l.root.personId ? /* @__PURE__ */ a(
|
|
638
640
|
"div",
|
|
639
641
|
{
|
|
640
642
|
className: `
|
|
@@ -664,9 +666,9 @@ const je = B((t, e) => {
|
|
|
664
666
|
unitId: n,
|
|
665
667
|
subUnitId: r,
|
|
666
668
|
item: C,
|
|
667
|
-
isRoot: C.id === (
|
|
669
|
+
isRoot: C.id === (l == null ? void 0 : l.root.id),
|
|
668
670
|
editing: p === C.id,
|
|
669
|
-
resolved:
|
|
671
|
+
resolved: l == null ? void 0 : l.root.resolved,
|
|
670
672
|
type: y,
|
|
671
673
|
onEditingChange: ($) => {
|
|
672
674
|
S($ ? C.id : "");
|
|
@@ -697,7 +699,7 @@ const je = B((t, e) => {
|
|
|
697
699
|
)
|
|
698
700
|
}
|
|
699
701
|
),
|
|
700
|
-
|
|
702
|
+
oe ? /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
701
703
|
je,
|
|
702
704
|
{
|
|
703
705
|
ref: H,
|
|
@@ -712,10 +714,10 @@ const je = B((t, e) => {
|
|
|
712
714
|
id: Qe(),
|
|
713
715
|
ref: i,
|
|
714
716
|
personId: D == null ? void 0 : D.userID,
|
|
715
|
-
parentId:
|
|
717
|
+
parentId: l == null ? void 0 : l.root.id,
|
|
716
718
|
unitId: n,
|
|
717
719
|
subUnitId: r,
|
|
718
|
-
threadId:
|
|
720
|
+
threadId: l == null ? void 0 : l.root.threadId
|
|
719
721
|
};
|
|
720
722
|
(c == null ? void 0 : c(L)) !== !1 && (await _.executeCommand(
|
|
721
723
|
tt.id,
|
|
@@ -726,9 +728,9 @@ const je = B((t, e) => {
|
|
|
726
728
|
}
|
|
727
729
|
), j.current && (j.current.scrollTop = j.current.scrollHeight));
|
|
728
730
|
},
|
|
729
|
-
autoFocus: P || !
|
|
731
|
+
autoFocus: P || !l,
|
|
730
732
|
onCancel: () => {
|
|
731
|
-
|
|
733
|
+
l || h == null || h();
|
|
732
734
|
}
|
|
733
735
|
},
|
|
734
736
|
`${P}`
|
|
@@ -742,7 +744,7 @@ const je = B((t, e) => {
|
|
|
742
744
|
subUnitId$: n,
|
|
743
745
|
type: r,
|
|
744
746
|
onAdd: i,
|
|
745
|
-
getSubUnitName:
|
|
747
|
+
getSubUnitName: o,
|
|
746
748
|
onResolve: d,
|
|
747
749
|
sortComments: f,
|
|
748
750
|
onItemLeave: h,
|
|
@@ -752,7 +754,7 @@ const je = B((t, e) => {
|
|
|
752
754
|
onAddComment: T,
|
|
753
755
|
onDeleteComment: b,
|
|
754
756
|
showComments: c
|
|
755
|
-
} = t, [v, E] = A("all"), [y, V] = A("all"), I = N(fe), R = N(he), u = N(Ne), [m, p] = A(() => u.getUnit(e)), S = N(q), g = G(S.activeCommentId$),
|
|
757
|
+
} = t, [v, E] = A("all"), [y, V] = A("all"), I = N(fe), R = N(he), u = N(Ne), [m, p] = A(() => u.getUnit(e)), S = N(q), g = G(S.activeCommentId$), l = G(u.commentUpdate$), _ = N(ne), W = G(n), k = te(!0), D = "panel", H = G(R.currentUser$), J = ee(() => {
|
|
756
758
|
var L;
|
|
757
759
|
const s = v === "all" ? m : (L = m.filter((U) => U.subUnitId === W)) != null ? L : [], C = f != null ? f : (U) => U, $ = s.map((U) => {
|
|
758
760
|
var F;
|
|
@@ -768,14 +770,14 @@ const je = B((t, e) => {
|
|
|
768
770
|
}, [c, v, m, f, W]), j = ee(() => [
|
|
769
771
|
...J.filter((s) => !s.resolved),
|
|
770
772
|
...J.filter((s) => s.resolved)
|
|
771
|
-
], [J]), re = ee(() => y === "resolved" ? j.filter((s) => s.resolved) : y === "unsolved" ? j.filter((s) => !s.resolved) : y === "concern_me" && H != null && H.userID ? j.filter((s) => s == null ? void 0 : s.users.has(H.userID)) : j, [j, H == null ? void 0 : H.userID, y]), Q = P ? [P, ...re] : re, ie = Q.filter((s) => !s.resolved),
|
|
773
|
+
], [J]), re = ee(() => y === "resolved" ? j.filter((s) => s.resolved) : y === "unsolved" ? j.filter((s) => !s.resolved) : y === "concern_me" && H != null && H.userID ? j.filter((s) => s == null ? void 0 : s.users.has(H.userID)) : j, [j, H == null ? void 0 : H.userID, y]), Q = P ? [P, ...re] : re, ie = Q.filter((s) => !s.resolved), oe = Q.filter((s) => s.resolved), le = y !== "all" || v !== "all", ae = () => {
|
|
772
774
|
V("all"), E("all");
|
|
773
775
|
};
|
|
774
776
|
de(() => {
|
|
775
777
|
e && p(
|
|
776
778
|
u.getUnit(e)
|
|
777
779
|
);
|
|
778
|
-
}, [e, u,
|
|
780
|
+
}, [e, u, l]), de(() => {
|
|
779
781
|
var U;
|
|
780
782
|
if (!g)
|
|
781
783
|
return;
|
|
@@ -791,7 +793,7 @@ const je = B((t, e) => {
|
|
|
791
793
|
{
|
|
792
794
|
full: !0,
|
|
793
795
|
prefix: D,
|
|
794
|
-
getSubUnitName:
|
|
796
|
+
getSubUnitName: o,
|
|
795
797
|
id: s.id,
|
|
796
798
|
unitId: s.unitId,
|
|
797
799
|
subUnitId: s.subUnitId,
|
|
@@ -874,7 +876,7 @@ const je = B((t, e) => {
|
|
|
874
876
|
`,
|
|
875
877
|
children: [
|
|
876
878
|
I.t("threadCommentUI.panel.empty"),
|
|
877
|
-
|
|
879
|
+
le ? /* @__PURE__ */ a("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ a(se, { onClick: ae, children: I.t("threadCommentUI.panel.reset") }) }) : O ? null : /* @__PURE__ */ a("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ x(se, { onClick: i, children: [
|
|
878
880
|
/* @__PURE__ */ a(ke, { className: "univer-mr-1.5" }),
|
|
879
881
|
I.t("threadCommentUI.panel.add")
|
|
880
882
|
] }) })
|
|
@@ -882,8 +884,8 @@ const je = B((t, e) => {
|
|
|
882
884
|
}
|
|
883
885
|
) : /* @__PURE__ */ x("div", { className: "univer-mt-3 univer-flex univer-flex-col univer-gap-3", children: [
|
|
884
886
|
ie.map(X),
|
|
885
|
-
|
|
886
|
-
|
|
887
|
+
oe.length > 0 && /* @__PURE__ */ a("div", { className: "univer-text-xs", children: I.t("threadCommentUI.panel.solved") }),
|
|
888
|
+
oe.map(X)
|
|
887
889
|
] })
|
|
888
890
|
] });
|
|
889
891
|
};
|
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-left-0{left:0}.univer-right-0{right:0}.univer-top-0{top:0}.univer-m-0{margin:0}.univer-mb-1{margin-bottom:4px}.univer-mb-3{margin-bottom:12px}.univer-mb-4{margin-bottom:16px}.univer-ml-1{margin-left:4px}.univer-mr-1\.5{margin-right:6px}.univer-mr-2{margin-right:8px}.univer-mt-2{margin-top:8px}.univer-mt-3{margin-top:12px}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-h-1\.5{height:6px}.univer-h-3\.5{height:14px}.univer-h-6{height:24px}.univer-max-h-\[300px\]{max-height:300px}.univer-min-h-full{min-height:100%}.univer-w-6{width:24px}.univer-w-\[278px\]{width:278px}.univer-w-\[3px\]{width:3px}.univer-w-full{width:100%}.univer-flex-1{flex:1 1 0%}.univer-flex-shrink-0{flex-shrink:0}.univer-flex-grow-0{flex-grow:0}.univer-cursor-pointer{cursor:pointer}.univer-list-none{list-style-type:none}.univer-flex-row{flex-direction:row}.univer-flex-col{flex-direction:column}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-
|
|
1
|
+
.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-left-0{left:0}.univer-right-0{right:0}.univer-top-0{top:0}.univer-m-0{margin:0}.univer-mb-1{margin-bottom:4px}.univer-mb-3{margin-bottom:12px}.univer-mb-4{margin-bottom:16px}.univer-ml-1{margin-left:4px}.univer-mr-1\.5{margin-right:6px}.univer-mr-2{margin-right:8px}.univer-mt-2{margin-top:8px}.univer-mt-3{margin-top:12px}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-h-1\.5{height:6px}.univer-h-3\.5{height:14px}.univer-h-6{height:24px}.univer-max-h-\[300px\]{max-height:300px}.univer-min-h-full{min-height:100%}.univer-w-6{width:24px}.univer-w-\[278px\]{width:278px}.univer-w-\[3px\]{width:3px}.univer-w-full{width:100%}.univer-flex-1{flex:1 1 0%}.univer-flex-shrink-0{flex-shrink:0}.univer-flex-grow-0{flex-grow:0}.univer-cursor-pointer{cursor:pointer}.univer-list-none{list-style-type:none}.univer-flex-row{flex-direction:row}.univer-flex-col{flex-direction:column}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-3{gap:12px}.univer-overflow-hidden{overflow:hidden}.univer-overflow-y-auto{overflow-y:auto}.univer-overflow-x-hidden{overflow-x:hidden}.univer-text-ellipsis{text-overflow:ellipsis}.univer-whitespace-nowrap{white-space:nowrap}.univer-break-words{word-wrap:break-word}.univer-rounded-\[3px\]{border-radius:3px}.univer-rounded-full{border-radius:9999px}.univer-rounded-lg{border-radius:8px}.univer-rounded-sm{border-radius:2px}.univer-rounded-t-md{border-top-left-radius:6px;border-top-right-radius:6px}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-gray-200{--tw-border-opacity: 1;border-color:#e3e5ea;border-color:rgba(227,229,234,var(--tw-border-opacity, 1))}.univer-bg-gray-50{--tw-bg-opacity: 1;background-color:#f9fafb;background-color:rgba(249,250,251,var(--tw-bg-opacity, 1))}.univer-bg-white{--tw-bg-opacity: 1;background-color:#fff;background-color:rgba(255,255,255,var(--tw-bg-opacity, 1))}.univer-bg-yellow-400{--tw-bg-opacity: 1;background-color:#f1b312;background-color:rgba(241,179,18,var(--tw-bg-opacity, 1))}.univer-bg-cover{background-size:cover}.univer-bg-center{background-position:center}.univer-bg-no-repeat{background-repeat:no-repeat}.univer-p-1\.5{padding:6px}.univer-p-4{padding:16px}.univer-pb-3{padding-bottom:12px}.univer-pl-\[30px\]{padding-left:30px}.univer-text-\[13px\]{font-size:13px}.univer-text-\[13px\]\/normal{font-size:13px;line-height:1.5}.univer-text-base{font-size:16px;line-height:24px}.univer-text-sm{font-size:14px;line-height:20px}.univer-text-xs{font-size:12px;line-height:16px}.univer-text-xs\/normal{font-size:12px;line-height:1.5}.univer-font-medium{font-weight:500}.univer-leading-5{line-height:20px}.univer-text-gray-600{--tw-text-opacity: 1;color:#31363f;color:rgba(49,54,63,var(--tw-text-opacity, 1))}.univer-text-gray-900{--tw-text-opacity: 1;color:#1b1c1f;color:rgba(27,28,31,var(--tw-text-opacity, 1))}.univer-text-green-500{--tw-text-opacity: 1;color:#0da471;color:rgba(13,164,113,var(--tw-text-opacity, 1))}.univer-text-primary-600{--tw-text-opacity: 1;color:#2c53f1;color:rgba(44,83,241,var(--tw-text-opacity, 1))}.univer-shadow{--tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 3px #0000001a,0 1px 2px -1px #0000001a;box-shadow:var(--tw-ring-offset-shadow, 0 0 rgba(0,0,0,0)),var(--tw-ring-shadow, 0 0 rgba(0,0,0,0)),var(--tw-shadow)}.hover\:univer-bg-gray-200:hover{--tw-bg-opacity: 1;background-color:#e3e5ea;background-color:rgba(227,229,234,var(--tw-bg-opacity, 1))}.hover\:univer-bg-gray-50:hover{--tw-bg-opacity: 1;background-color:#f9fafb;background-color:rgba(249,250,251,var(--tw-bg-opacity, 1))}.\[\&_a\]\:univer-block a{display:block}.\[\&_a\]\:univer-cursor-pointer a{cursor:pointer}.\[\&_a\]\:univer-rounded a{border-radius:4px}.\[\&_a\]\:univer-px-2 a{padding-left:8px;padding-right:8px}.\[\&_a\]\:univer-py-1\.5 a{padding-top:6px;padding-bottom:6px}.\[\&_a\]\:univer-transition-colors a{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}
|
package/lib/index.js
CHANGED
|
@@ -3,15 +3,15 @@ var Pe = (t, e, n) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var z = (t, e, n) => Pe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
import { Inject as Se, IUniverInstanceService as Ve, Disposable as Ae, UniverInstanceType as ce, CommandType as _e, DependentOn as Be, Injector as We, ICommandService as ne, IConfigService as Fe, Plugin as ze, merge as Ge, mergeOverrideWithDependencies as Ke, LocaleService as fe, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ze, BuildTextUtils as ve, Tools as Ye, CustomRangeType as qe, getBodySlice as Je, UserManagerService as he, generateRandomId as Qe } from "@univerjs/core";
|
|
5
5
|
import { UniverThreadCommentPlugin as Xe, ThreadCommentModel as Ne, getDT as et, AddCommentCommand as tt, ResolveCommentCommand as nt, DeleteCommentTreeCommand as we, UpdateCommentCommand as rt, DeleteCommentCommand as it } from "@univerjs/thread-comment";
|
|
6
|
-
import { ISidebarService as Ue, useDependency as N, KeyCode as pe, useObservable as G, useConfigValue as
|
|
6
|
+
import { ISidebarService as Ue, useDependency as N, KeyCode as pe, useObservable as G, useConfigValue as ot, UI_PLUGIN_CONFIG_KEY as lt } from "@univerjs/ui";
|
|
7
7
|
import { BehaviorSubject as ge, filter as at, debounceTime as st } from "rxjs";
|
|
8
8
|
import { jsxs as x, jsx as a } from "react/jsx-runtime";
|
|
9
9
|
import { Button as se, clsx as Ce, Tooltip as dt, Dropdown as ut, Select as Ie } from "@univerjs/design";
|
|
10
10
|
import { forwardRef as B, useRef as te, createElement as Z, useState as A, useEffect as de, useMemo as ee, useImperativeHandle as ct } from "react";
|
|
11
11
|
import { IEditorService as vt, BreakLineCommand as mt, RichTextEditor as ft } from "@univerjs/docs-ui";
|
|
12
12
|
var ht = Object.getOwnPropertyDescriptor, pt = (t, e, n, r) => {
|
|
13
|
-
for (var i = r > 1 ? void 0 : r ? ht(e, n) : e,
|
|
14
|
-
(d = t[
|
|
13
|
+
for (var i = r > 1 ? void 0 : r ? ht(e, n) : e, o = t.length - 1, d; o >= 0; o--)
|
|
14
|
+
(d = t[o]) && (i = d(i) || i);
|
|
15
15
|
return i;
|
|
16
16
|
}, xe = (t, e) => (n, r) => e(n, r, t);
|
|
17
17
|
let q = class extends Ae {
|
|
@@ -74,19 +74,19 @@ const gt = "thread-comment-panel", Ct = "UNIVER_THREAD_COMMENT_UI_PLUGIN", It =
|
|
|
74
74
|
}
|
|
75
75
|
}, xt = "thread-comment-ui.config", be = {};
|
|
76
76
|
var bt = Object.defineProperty, yt = Object.getOwnPropertyDescriptor, St = (t, e, n) => e in t ? bt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, _t = (t, e, n, r) => {
|
|
77
|
-
for (var i = r > 1 ? void 0 : r ? yt(e, n) : e,
|
|
78
|
-
(d = t[
|
|
77
|
+
for (var i = r > 1 ? void 0 : r ? yt(e, n) : e, o = t.length - 1, d; o >= 0; o--)
|
|
78
|
+
(d = t[o]) && (i = d(i) || i);
|
|
79
79
|
return i;
|
|
80
80
|
}, me = (t, e) => (n, r) => e(n, r, t), Oe = (t, e, n) => St(t, typeof e != "symbol" ? e + "" : e, n);
|
|
81
81
|
let ue = class extends ze {
|
|
82
82
|
constructor(t = be, e, n, r) {
|
|
83
83
|
super(), this._config = t, this._injector = e, this._commandService = n, this._configService = r;
|
|
84
|
-
const { menu: i, ...
|
|
84
|
+
const { menu: i, ...o } = Ge(
|
|
85
85
|
{},
|
|
86
86
|
be,
|
|
87
87
|
this._config
|
|
88
88
|
);
|
|
89
|
-
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(xt,
|
|
89
|
+
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(xt, o);
|
|
90
90
|
}
|
|
91
91
|
onStarting() {
|
|
92
92
|
var t;
|
|
@@ -123,23 +123,23 @@ var M = function() {
|
|
|
123
123
|
e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]);
|
|
124
124
|
return n;
|
|
125
125
|
}, Y = B(function(t, e) {
|
|
126
|
-
var n = t.icon, r = t.id, i = t.className,
|
|
127
|
-
return Te(n, "".concat(r), { defIds: n.defIds, idSuffix: h.current }, M({ ref: e, className: f }, d),
|
|
126
|
+
var n = t.icon, r = t.id, i = t.className, o = t.extend, d = Nt(t, ["icon", "id", "className", "extend"]), f = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), h = te("_".concat(Ot()));
|
|
127
|
+
return Te(n, "".concat(r), { defIds: n.defIds, idSuffix: h.current }, M({ ref: e, className: f }, d), o);
|
|
128
128
|
});
|
|
129
129
|
function Te(t, e, n, r, i) {
|
|
130
|
-
return Z(t.tag, M(M({ key: e }, wt(t, n, i)), r), (Ut(t, n).children || []).map(function(
|
|
131
|
-
return Te(
|
|
130
|
+
return Z(t.tag, M(M({ key: e }, wt(t, n, i)), r), (Ut(t, n).children || []).map(function(o, d) {
|
|
131
|
+
return Te(o, "".concat(e, "-").concat(t.tag, "-").concat(d), n, void 0, i);
|
|
132
132
|
}));
|
|
133
133
|
}
|
|
134
134
|
function wt(t, e, n) {
|
|
135
135
|
var r = M({}, t.attrs);
|
|
136
|
-
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1), t.tag === "mask" && r.id && (r.id = r.id + e.idSuffix), Object.entries(r).forEach(function(
|
|
137
|
-
var d =
|
|
136
|
+
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1), t.tag === "mask" && r.id && (r.id = r.id + e.idSuffix), Object.entries(r).forEach(function(o) {
|
|
137
|
+
var d = o[0], f = o[1];
|
|
138
138
|
d === "mask" && typeof f == "string" && (r[d] = f.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
139
139
|
});
|
|
140
140
|
var i = e.defIds;
|
|
141
|
-
return !i || i.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(
|
|
142
|
-
var d =
|
|
141
|
+
return !i || i.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(o) {
|
|
142
|
+
var d = o[0], f = o[1];
|
|
143
143
|
typeof f == "string" && (r[d] = f.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
144
144
|
})), r;
|
|
145
145
|
}
|
|
@@ -210,7 +210,7 @@ function ye(t) {
|
|
|
210
210
|
}
|
|
211
211
|
const je = B((t, e) => {
|
|
212
212
|
var R;
|
|
213
|
-
const { comment: n, onSave: r, id: i, onCancel:
|
|
213
|
+
const { comment: n, onSave: r, id: i, onCancel: o, autoFocus: d, unitId: f, type: h } = t, w = N(ne), O = N(fe), [P, T] = A(!1), b = N(vt), c = te(null), v = h === ce.UNIVER_SHEET ? Ze : f, [E, y] = A(() => {
|
|
214
214
|
var u, m, p;
|
|
215
215
|
return ve.transform.getPlainText((p = (m = (u = c.current) == null ? void 0 : u.getDocumentData().body) == null ? void 0 : m.dataStream) != null ? p : "");
|
|
216
216
|
});
|
|
@@ -218,8 +218,8 @@ const je = B((t, e) => {
|
|
|
218
218
|
var m, p, S, g;
|
|
219
219
|
y(ve.transform.getPlainText((S = (p = (m = c.current) == null ? void 0 : m.getDocumentData().body) == null ? void 0 : p.dataStream) != null ? S : ""));
|
|
220
220
|
const u = (g = c.current) == null ? void 0 : g.selectionChange$.subscribe(() => {
|
|
221
|
-
var
|
|
222
|
-
y(ve.transform.getPlainText((W = (_ = (
|
|
221
|
+
var l, _, W;
|
|
222
|
+
y(ve.transform.getPlainText((W = (_ = (l = c.current) == null ? void 0 : l.getDocumentData().body) == null ? void 0 : _.dataStream) != null ? W : ""));
|
|
223
223
|
});
|
|
224
224
|
return () => u == null ? void 0 : u.unsubscribe();
|
|
225
225
|
}, [(R = c.current) == null ? void 0 : R.selectionChange$]);
|
|
@@ -284,7 +284,7 @@ const je = B((t, e) => {
|
|
|
284
284
|
style: { marginRight: 12 },
|
|
285
285
|
onClick: () => {
|
|
286
286
|
var u;
|
|
287
|
-
|
|
287
|
+
o == null || o(), T(!1), (u = c.current) == null || u.replaceText("", !0), w.executeCommand(K.id);
|
|
288
288
|
},
|
|
289
289
|
children: O.t("threadCommentUI.editor.cancel")
|
|
290
290
|
}
|
|
@@ -303,21 +303,21 @@ const je = B((t, e) => {
|
|
|
303
303
|
}), Rt = (t) => {
|
|
304
304
|
const { dataStream: e, customRanges: n } = t, r = e.endsWith(`\r
|
|
305
305
|
`) ? e.length - 2 : e.length, i = [];
|
|
306
|
-
let
|
|
306
|
+
let o = 0;
|
|
307
307
|
return n == null || n.forEach((d) => {
|
|
308
|
-
|
|
308
|
+
o < d.startIndex && i.push({
|
|
309
309
|
type: "text",
|
|
310
|
-
content: e.slice(
|
|
310
|
+
content: e.slice(o, d.startIndex)
|
|
311
311
|
}), i.push({
|
|
312
312
|
type: "mention",
|
|
313
313
|
content: {
|
|
314
314
|
label: e.slice(d.startIndex, d.endIndex + 1),
|
|
315
315
|
id: d.rangeId
|
|
316
316
|
}
|
|
317
|
-
}),
|
|
317
|
+
}), o = d.endIndex + 1;
|
|
318
318
|
}), i.push({
|
|
319
319
|
type: "text",
|
|
320
|
-
content: e.slice(
|
|
320
|
+
content: e.slice(o, r)
|
|
321
321
|
}), i;
|
|
322
322
|
}, jt = (t) => {
|
|
323
323
|
const { paragraphs: e = [] } = t;
|
|
@@ -337,12 +337,12 @@ const je = B((t, e) => {
|
|
|
337
337
|
case "mention": {
|
|
338
338
|
const i = e.length;
|
|
339
339
|
e += r.content.label;
|
|
340
|
-
const
|
|
340
|
+
const o = e.length - 1;
|
|
341
341
|
n.push({
|
|
342
342
|
rangeId: r.content.id,
|
|
343
343
|
rangeType: qe.MENTION,
|
|
344
344
|
startIndex: i,
|
|
345
|
-
endIndex:
|
|
345
|
+
endIndex: o,
|
|
346
346
|
properties: {},
|
|
347
347
|
wholeEntity: !0
|
|
348
348
|
});
|
|
@@ -367,7 +367,7 @@ const je = B((t, e) => {
|
|
|
367
367
|
customRanges: n
|
|
368
368
|
};
|
|
369
369
|
}, He = "__mock__", Lt = (t) => {
|
|
370
|
-
const { item: e, unitId: n, subUnitId: r, editing: i, onEditingChange:
|
|
370
|
+
const { item: e, unitId: n, subUnitId: r, editing: i, onEditingChange: o, onReply: d, resolved: f, isRoot: h, onClose: w, onDeleteComment: O, type: P } = t, T = N(ne), b = N(fe), c = N(he), v = c.getUser(e.personId), E = G(c.currentUser$), y = (E == null ? void 0 : E.userID) === e.personId, V = e.id === He, [I, R] = A(!1), u = ot(lt), m = u == null ? void 0 : u.avatarFallback, p = () => {
|
|
371
371
|
(O == null ? void 0 : O(e)) !== !1 && (T.executeCommand(
|
|
372
372
|
h ? we.id : it.id,
|
|
373
373
|
{
|
|
@@ -409,20 +409,22 @@ const je = B((t, e) => {
|
|
|
409
409
|
y && !V && !f ? /* @__PURE__ */ a(
|
|
410
410
|
ut,
|
|
411
411
|
{
|
|
412
|
-
overlay: /* @__PURE__ */ a("div", { className: "univer-rounded-lg
|
|
412
|
+
overlay: /* @__PURE__ */ a("div", { className: "univer-rounded-lg", children: /* @__PURE__ */ x(
|
|
413
413
|
"ul",
|
|
414
414
|
{
|
|
415
415
|
className: `
|
|
416
|
-
univer-m-0 univer-
|
|
417
|
-
univer-text-sm
|
|
418
|
-
[&_a]:univer-
|
|
416
|
+
univer-m-0 univer-box-border univer-grid univer-list-none
|
|
417
|
+
univer-p-1.5 univer-text-[13px] univer-text-sm
|
|
418
|
+
[&_a]:univer-block [&_a]:univer-cursor-pointer
|
|
419
|
+
[&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5
|
|
420
|
+
[&_a]:univer-transition-colors
|
|
419
421
|
`,
|
|
420
422
|
children: [
|
|
421
423
|
/* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
422
424
|
"a",
|
|
423
425
|
{
|
|
424
426
|
className: "hover:univer-bg-gray-200",
|
|
425
|
-
onClick: () =>
|
|
427
|
+
onClick: () => o == null ? void 0 : o(!0),
|
|
426
428
|
children: b.t("threadCommentUI.item.edit")
|
|
427
429
|
}
|
|
428
430
|
) }),
|
|
@@ -442,7 +444,7 @@ const je = B((t, e) => {
|
|
|
442
444
|
{
|
|
443
445
|
className: `
|
|
444
446
|
univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer
|
|
445
|
-
univer-items-center univer-justify-center univer-rounded-
|
|
447
|
+
univer-items-center univer-justify-center univer-rounded-sm
|
|
446
448
|
univer-text-base
|
|
447
449
|
hover:univer-bg-gray-50
|
|
448
450
|
`,
|
|
@@ -453,19 +455,19 @@ const je = B((t, e) => {
|
|
|
453
455
|
) : null
|
|
454
456
|
] })
|
|
455
457
|
] }) : null,
|
|
456
|
-
/* @__PURE__ */ a("div", { className: "univer-mb-1 univer-text-xs univer-
|
|
458
|
+
/* @__PURE__ */ a("div", { className: "univer-mb-1 univer-text-xs/normal univer-text-gray-600", children: e.dT }),
|
|
457
459
|
i ? /* @__PURE__ */ a(
|
|
458
460
|
je,
|
|
459
461
|
{
|
|
460
462
|
type: P,
|
|
461
463
|
id: e.id,
|
|
462
464
|
comment: e,
|
|
463
|
-
onCancel: () =>
|
|
465
|
+
onCancel: () => o == null ? void 0 : o(!1),
|
|
464
466
|
autoFocus: !0,
|
|
465
467
|
unitId: n,
|
|
466
468
|
subUnitId: r,
|
|
467
469
|
onSave: ({ text: S, attachments: g }) => {
|
|
468
|
-
|
|
470
|
+
o == null || o(!1), T.executeCommand(
|
|
469
471
|
rt.id,
|
|
470
472
|
{
|
|
471
473
|
unitId: n,
|
|
@@ -479,15 +481,15 @@ const je = B((t, e) => {
|
|
|
479
481
|
);
|
|
480
482
|
}
|
|
481
483
|
}
|
|
482
|
-
) : /* @__PURE__ */ a("div", { className: "univer-text-[13px] univer-
|
|
483
|
-
switch (
|
|
484
|
+
) : /* @__PURE__ */ a("div", { className: "univer-text-[13px]/normal univer-text-gray-900", children: jt(e.text).map((S, g) => /* @__PURE__ */ a("div", { className: "univer-break-words", children: S.map((l, _) => {
|
|
485
|
+
switch (l.type) {
|
|
484
486
|
case "mention":
|
|
485
487
|
return /* @__PURE__ */ x("a", { className: "univer-text-primary-600", children: [
|
|
486
|
-
|
|
488
|
+
l.content.label,
|
|
487
489
|
" "
|
|
488
490
|
] }, _);
|
|
489
491
|
default:
|
|
490
|
-
return
|
|
492
|
+
return l.content;
|
|
491
493
|
}
|
|
492
494
|
}) }, g)) })
|
|
493
495
|
] });
|
|
@@ -498,7 +500,7 @@ const je = B((t, e) => {
|
|
|
498
500
|
unitId: n,
|
|
499
501
|
subUnitId: r,
|
|
500
502
|
refStr: i,
|
|
501
|
-
showEdit:
|
|
503
|
+
showEdit: o = !0,
|
|
502
504
|
onClick: d,
|
|
503
505
|
showHighlight: f,
|
|
504
506
|
onClose: h,
|
|
@@ -515,8 +517,8 @@ const je = B((t, e) => {
|
|
|
515
517
|
full: I
|
|
516
518
|
} = t, R = N(Ne), [u, m] = A(!1), [p, S] = A(""), g = ee(() => R.commentUpdate$.pipe(st(16)), [R]);
|
|
517
519
|
G(g);
|
|
518
|
-
const
|
|
519
|
-
...
|
|
520
|
+
const l = e ? R.getCommentWithChildren(n, r, e) : null, _ = N(ne), W = N(he), k = l == null ? void 0 : l.root.resolved, D = G(W.currentUser$), H = te(null), J = [
|
|
521
|
+
...l ? [l.root] : (
|
|
520
522
|
// mock empty comment
|
|
521
523
|
[{
|
|
522
524
|
id: He,
|
|
@@ -532,7 +534,7 @@ const je = B((t, e) => {
|
|
|
532
534
|
threadId: ""
|
|
533
535
|
}]
|
|
534
536
|
),
|
|
535
|
-
...(X =
|
|
537
|
+
...(X = l == null ? void 0 : l.children) != null ? X : []
|
|
536
538
|
], j = te(null), re = (C) => {
|
|
537
539
|
C.stopPropagation(), k ? _.executeCommand(K.id, {
|
|
538
540
|
unitId: n,
|
|
@@ -545,7 +547,7 @@ const je = B((t, e) => {
|
|
|
545
547
|
resolved: !k
|
|
546
548
|
}), E == null || E(!k);
|
|
547
549
|
}, Q = (C) => {
|
|
548
|
-
C.stopPropagation(), _.executeCommand(K.id), !(
|
|
550
|
+
C.stopPropagation(), _.executeCommand(K.id), !(l != null && l.root && (v == null ? void 0 : v(l.root)) === !1) && (_.executeCommand(
|
|
549
551
|
we.id,
|
|
550
552
|
{
|
|
551
553
|
unitId: n,
|
|
@@ -555,7 +557,7 @@ const je = B((t, e) => {
|
|
|
555
557
|
), h == null || h());
|
|
556
558
|
};
|
|
557
559
|
de(() => b == null ? void 0 : b(), []);
|
|
558
|
-
const ie = w((s =
|
|
560
|
+
const ie = w((s = l == null ? void 0 : l.root.subUnitId) != null ? s : r), oe = o && !p && !k, le = `${i || (l == null ? void 0 : l.root.ref) || ""}${ie ? " · " : ""}${ie}`;
|
|
559
561
|
return /* @__PURE__ */ x(
|
|
560
562
|
"div",
|
|
561
563
|
{
|
|
@@ -606,17 +608,17 @@ const je = B((t, e) => {
|
|
|
606
608
|
`
|
|
607
609
|
}
|
|
608
610
|
),
|
|
609
|
-
/* @__PURE__ */ a(dt, { showIfEllipsis: !0, title:
|
|
611
|
+
/* @__PURE__ */ a(dt, { showIfEllipsis: !0, title: le, children: /* @__PURE__ */ a(
|
|
610
612
|
"div",
|
|
611
613
|
{
|
|
612
614
|
className: `
|
|
613
615
|
univer-flex-1 univer-overflow-hidden univer-text-ellipsis univer-whitespace-nowrap
|
|
614
616
|
`,
|
|
615
|
-
children:
|
|
617
|
+
children: le
|
|
616
618
|
}
|
|
617
619
|
) })
|
|
618
620
|
] }),
|
|
619
|
-
|
|
621
|
+
l ? /* @__PURE__ */ x("div", { className: "univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row", children: [
|
|
620
622
|
/* @__PURE__ */ a(
|
|
621
623
|
"div",
|
|
622
624
|
{
|
|
@@ -634,7 +636,7 @@ const je = B((t, e) => {
|
|
|
634
636
|
children: k ? /* @__PURE__ */ a(Me, {}) : /* @__PURE__ */ a(Re, {})
|
|
635
637
|
}
|
|
636
638
|
),
|
|
637
|
-
(D == null ? void 0 : D.userID) ===
|
|
639
|
+
(D == null ? void 0 : D.userID) === l.root.personId ? /* @__PURE__ */ a(
|
|
638
640
|
"div",
|
|
639
641
|
{
|
|
640
642
|
className: `
|
|
@@ -664,9 +666,9 @@ const je = B((t, e) => {
|
|
|
664
666
|
unitId: n,
|
|
665
667
|
subUnitId: r,
|
|
666
668
|
item: C,
|
|
667
|
-
isRoot: C.id === (
|
|
669
|
+
isRoot: C.id === (l == null ? void 0 : l.root.id),
|
|
668
670
|
editing: p === C.id,
|
|
669
|
-
resolved:
|
|
671
|
+
resolved: l == null ? void 0 : l.root.resolved,
|
|
670
672
|
type: y,
|
|
671
673
|
onEditingChange: ($) => {
|
|
672
674
|
S($ ? C.id : "");
|
|
@@ -697,7 +699,7 @@ const je = B((t, e) => {
|
|
|
697
699
|
)
|
|
698
700
|
}
|
|
699
701
|
),
|
|
700
|
-
|
|
702
|
+
oe ? /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
701
703
|
je,
|
|
702
704
|
{
|
|
703
705
|
ref: H,
|
|
@@ -712,10 +714,10 @@ const je = B((t, e) => {
|
|
|
712
714
|
id: Qe(),
|
|
713
715
|
ref: i,
|
|
714
716
|
personId: D == null ? void 0 : D.userID,
|
|
715
|
-
parentId:
|
|
717
|
+
parentId: l == null ? void 0 : l.root.id,
|
|
716
718
|
unitId: n,
|
|
717
719
|
subUnitId: r,
|
|
718
|
-
threadId:
|
|
720
|
+
threadId: l == null ? void 0 : l.root.threadId
|
|
719
721
|
};
|
|
720
722
|
(c == null ? void 0 : c(L)) !== !1 && (await _.executeCommand(
|
|
721
723
|
tt.id,
|
|
@@ -726,9 +728,9 @@ const je = B((t, e) => {
|
|
|
726
728
|
}
|
|
727
729
|
), j.current && (j.current.scrollTop = j.current.scrollHeight));
|
|
728
730
|
},
|
|
729
|
-
autoFocus: P || !
|
|
731
|
+
autoFocus: P || !l,
|
|
730
732
|
onCancel: () => {
|
|
731
|
-
|
|
733
|
+
l || h == null || h();
|
|
732
734
|
}
|
|
733
735
|
},
|
|
734
736
|
`${P}`
|
|
@@ -742,7 +744,7 @@ const je = B((t, e) => {
|
|
|
742
744
|
subUnitId$: n,
|
|
743
745
|
type: r,
|
|
744
746
|
onAdd: i,
|
|
745
|
-
getSubUnitName:
|
|
747
|
+
getSubUnitName: o,
|
|
746
748
|
onResolve: d,
|
|
747
749
|
sortComments: f,
|
|
748
750
|
onItemLeave: h,
|
|
@@ -752,7 +754,7 @@ const je = B((t, e) => {
|
|
|
752
754
|
onAddComment: T,
|
|
753
755
|
onDeleteComment: b,
|
|
754
756
|
showComments: c
|
|
755
|
-
} = t, [v, E] = A("all"), [y, V] = A("all"), I = N(fe), R = N(he), u = N(Ne), [m, p] = A(() => u.getUnit(e)), S = N(q), g = G(S.activeCommentId$),
|
|
757
|
+
} = t, [v, E] = A("all"), [y, V] = A("all"), I = N(fe), R = N(he), u = N(Ne), [m, p] = A(() => u.getUnit(e)), S = N(q), g = G(S.activeCommentId$), l = G(u.commentUpdate$), _ = N(ne), W = G(n), k = te(!0), D = "panel", H = G(R.currentUser$), J = ee(() => {
|
|
756
758
|
var L;
|
|
757
759
|
const s = v === "all" ? m : (L = m.filter((U) => U.subUnitId === W)) != null ? L : [], C = f != null ? f : (U) => U, $ = s.map((U) => {
|
|
758
760
|
var F;
|
|
@@ -768,14 +770,14 @@ const je = B((t, e) => {
|
|
|
768
770
|
}, [c, v, m, f, W]), j = ee(() => [
|
|
769
771
|
...J.filter((s) => !s.resolved),
|
|
770
772
|
...J.filter((s) => s.resolved)
|
|
771
|
-
], [J]), re = ee(() => y === "resolved" ? j.filter((s) => s.resolved) : y === "unsolved" ? j.filter((s) => !s.resolved) : y === "concern_me" && H != null && H.userID ? j.filter((s) => s == null ? void 0 : s.users.has(H.userID)) : j, [j, H == null ? void 0 : H.userID, y]), Q = P ? [P, ...re] : re, ie = Q.filter((s) => !s.resolved),
|
|
773
|
+
], [J]), re = ee(() => y === "resolved" ? j.filter((s) => s.resolved) : y === "unsolved" ? j.filter((s) => !s.resolved) : y === "concern_me" && H != null && H.userID ? j.filter((s) => s == null ? void 0 : s.users.has(H.userID)) : j, [j, H == null ? void 0 : H.userID, y]), Q = P ? [P, ...re] : re, ie = Q.filter((s) => !s.resolved), oe = Q.filter((s) => s.resolved), le = y !== "all" || v !== "all", ae = () => {
|
|
772
774
|
V("all"), E("all");
|
|
773
775
|
};
|
|
774
776
|
de(() => {
|
|
775
777
|
e && p(
|
|
776
778
|
u.getUnit(e)
|
|
777
779
|
);
|
|
778
|
-
}, [e, u,
|
|
780
|
+
}, [e, u, l]), de(() => {
|
|
779
781
|
var U;
|
|
780
782
|
if (!g)
|
|
781
783
|
return;
|
|
@@ -791,7 +793,7 @@ const je = B((t, e) => {
|
|
|
791
793
|
{
|
|
792
794
|
full: !0,
|
|
793
795
|
prefix: D,
|
|
794
|
-
getSubUnitName:
|
|
796
|
+
getSubUnitName: o,
|
|
795
797
|
id: s.id,
|
|
796
798
|
unitId: s.unitId,
|
|
797
799
|
subUnitId: s.subUnitId,
|
|
@@ -874,7 +876,7 @@ const je = B((t, e) => {
|
|
|
874
876
|
`,
|
|
875
877
|
children: [
|
|
876
878
|
I.t("threadCommentUI.panel.empty"),
|
|
877
|
-
|
|
879
|
+
le ? /* @__PURE__ */ a("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ a(se, { onClick: ae, children: I.t("threadCommentUI.panel.reset") }) }) : O ? null : /* @__PURE__ */ a("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ x(se, { onClick: i, children: [
|
|
878
880
|
/* @__PURE__ */ a(ke, { className: "univer-mr-1.5" }),
|
|
879
881
|
I.t("threadCommentUI.panel.add")
|
|
880
882
|
] }) })
|
|
@@ -882,8 +884,8 @@ const je = B((t, e) => {
|
|
|
882
884
|
}
|
|
883
885
|
) : /* @__PURE__ */ x("div", { className: "univer-mt-3 univer-flex univer-flex-col univer-gap-3", children: [
|
|
884
886
|
ie.map(X),
|
|
885
|
-
|
|
886
|
-
|
|
887
|
+
oe.length > 0 && /* @__PURE__ */ a("div", { className: "univer-text-xs", children: I.t("threadCommentUI.panel.solved") }),
|
|
888
|
+
oe.map(X)
|
|
887
889
|
] })
|
|
888
890
|
] });
|
|
889
891
|
};
|
package/lib/umd/index.js
CHANGED
|
@@ -8,16 +8,18 @@
|
|
|
8
8
|
univer-cursor-pointer univer-items-center univer-justify-center
|
|
9
9
|
univer-rounded-sm univer-text-base
|
|
10
10
|
hover:univer-bg-gray-50
|
|
11
|
-
`,onClick:()=>v(p),children:s.jsx(pe,{})}):null,N&&!q&&!C?s.jsx(B.Dropdown,{overlay:s.jsx("div",{className:"univer-rounded-lg
|
|
12
|
-
univer-m-0 univer-
|
|
13
|
-
univer-text-sm
|
|
14
|
-
[&_a]:univer-
|
|
11
|
+
`,onClick:()=>v(p),children:s.jsx(pe,{})}):null,N&&!q&&!C?s.jsx(B.Dropdown,{overlay:s.jsx("div",{className:"univer-rounded-lg",children:s.jsxs("ul",{className:`
|
|
12
|
+
univer-m-0 univer-box-border univer-grid univer-list-none
|
|
13
|
+
univer-p-1.5 univer-text-[13px] univer-text-sm
|
|
14
|
+
[&_a]:univer-block [&_a]:univer-cursor-pointer
|
|
15
|
+
[&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5
|
|
16
|
+
[&_a]:univer-transition-colors
|
|
15
17
|
`,children:[s.jsx("li",{children:s.jsx("a",{className:"hover:univer-bg-gray-200",onClick:()=>a==null?void 0:a(!0),children:T.t("threadCommentUI.item.edit")})}),s.jsx("li",{children:s.jsx("a",{className:"hover:univer-bg-gray-200",onClick:b,children:T.t("threadCommentUI.item.delete")})})]})}),children:s.jsx("div",{className:`
|
|
16
18
|
univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer
|
|
17
|
-
univer-items-center univer-justify-center univer-rounded-
|
|
19
|
+
univer-items-center univer-justify-center univer-rounded-sm
|
|
18
20
|
univer-text-base
|
|
19
21
|
hover:univer-bg-gray-50
|
|
20
|
-
`,children:s.jsx(he,{})})}):null]})]}):null,s.jsx("div",{className:"univer-mb-1 univer-text-xs univer-
|
|
22
|
+
`,children:s.jsx(he,{})})}):null]})]}):null,s.jsx("div",{className:"univer-mb-1 univer-text-xs/normal univer-text-gray-600",children:e.dT}),i?s.jsx(be,{type:F,id:e.id,comment:e,onCancel:()=>a==null?void 0:a(!1),autoFocus:!0,unitId:n,subUnitId:r,onSave:({text:U,attachments:x})=>{a==null||a(!1),j.executeCommand(_.UpdateCommentCommand.id,{unitId:n,subUnitId:r,payload:{commentId:e.id,text:U,attachments:x}})}}):s.jsx("div",{className:"univer-text-[13px]/normal univer-text-gray-900",children:We(e.text).map((U,x)=>s.jsx("div",{className:"univer-break-words",children:U.map((o,w)=>{switch(o.type){case"mention":return s.jsxs("a",{className:"univer-text-primary-600",children:[o.content.label," "]},w);default:return o.content}})},x))})]})},ye=t=>{var ie,Q,u;const{id:e,unitId:n,subUnitId:r,refStr:i,showEdit:a=!0,onClick:v,showHighlight:C,onClose:I,getSubUnitName:O,prefix:M,autoFocus:F,onMouseEnter:j,onMouseLeave:T,onAddComment:h,onDeleteComment:p,onResolve:k,type:N,style:q,full:S}=t,L=f.useDependency(_.ThreadCommentModel),[m,g]=d.useState(!1),[b,U]=d.useState(""),x=d.useMemo(()=>L.commentUpdate$.pipe(X.debounceTime(16)),[L]);f.useObservable(x);const o=e?L.getCommentWithChildren(n,r,e):null,w=f.useDependency(l.ICommandService),G=f.useDependency(l.UserManagerService),P=o==null?void 0:o.root.resolved,$=f.useObservable(G.currentUser$),A=d.useRef(null),R=[...o?[o.root]:[{id:xe,text:{dataStream:`
|
|
21
23
|
\r`},personId:(ie=$==null?void 0:$.userID)!=null?ie:"",ref:i!=null?i:"",dT:"",unitId:n,subUnitId:r,threadId:""}],...(Q=o==null?void 0:o.children)!=null?Q:[]],V=d.useRef(null),ee=y=>{y.stopPropagation(),P?w.executeCommand(z.id,{unitId:n,subUnitId:r,commentId:e}):w.executeCommand(z.id),w.executeCommand(_.ResolveCommentCommand.id,{unitId:n,subUnitId:r,commentId:e,resolved:!P}),k==null||k(!P)},J=y=>{y.stopPropagation(),w.executeCommand(z.id),!(o!=null&&o.root&&(p==null?void 0:p(o.root))===!1)&&(w.executeCommand(_.DeleteCommentTreeCommand.id,{unitId:n,subUnitId:r,commentId:e}),I==null||I())};d.useEffect(()=>T==null?void 0:T(),[]);const ne=O((u=o==null?void 0:o.root.subUnitId)!=null?u:r),te=a&&!b&&!P,re=`${i||(o==null?void 0:o.root.ref)||""}${ne?" · ":""}${ne}`;return s.jsxs("div",{className:B.clsx(`
|
|
22
24
|
univer-relative univer-box-border univer-rounded-lg univer-border univer-border-solid
|
|
23
25
|
univer-border-gray-200 univer-bg-white univer-p-4
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/thread-comment-ui",
|
|
3
|
-
"version": "0.7.0-
|
|
3
|
+
"version": "0.7.0-nightly.202504291607",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer common thread comment UI plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@univerjs/icons": "^0.3.22",
|
|
56
|
-
"@univerjs/
|
|
57
|
-
"@univerjs/
|
|
58
|
-
"@univerjs/docs-ui": "0.7.0-
|
|
59
|
-
"@univerjs/ui": "0.7.0-
|
|
60
|
-
"@univerjs/thread-comment": "0.7.0-
|
|
56
|
+
"@univerjs/design": "0.7.0-nightly.202504291607",
|
|
57
|
+
"@univerjs/core": "0.7.0-nightly.202504291607",
|
|
58
|
+
"@univerjs/docs-ui": "0.7.0-nightly.202504291607",
|
|
59
|
+
"@univerjs/ui": "0.7.0-nightly.202504291607",
|
|
60
|
+
"@univerjs/thread-comment": "0.7.0-nightly.202504291607"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"less": "^4.3.0",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|