@univerjs/preset-docs-thread-comment 0.5.4 → 0.6.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/umd/index.js +6 -21
- package/package.json +5 -5
package/lib/umd/index.js
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/index
|
|
2
|
-
(function(c,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react","@univerjs/design","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverThreadCommentUi={},c.UniverCore,c.UniverThreadComment,c.UniverUi,c.rxjs,c.React,c.UniverDesign,c.UniverDocs,c.UniverDocsUi,c.UniverEngineRender))})(this,function(c,o,_,k,re,u,E,Oe,Me,we){"use strict";var st=Object.defineProperty;var dt=(c,o,_)=>o in c?st(c,o,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[o]=_;var G=(c,o,_)=>dt(c,typeof o!="symbol"?o+"":o,_);var De=Object.defineProperty,He=Object.getOwnPropertyDescriptor,Ae=(n,e,t,r)=>{for(var i=r>1?void 0:r?He(e,t):e,s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=(r?l(e,t,i):l(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);c.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();G(this,"_panelVisible",!1);G(this,"_panelVisible$",new re.BehaviorSubject(!1));G(this,"_activeCommentId");G(this,"_activeCommentId$",new re.BehaviorSubject(void 0));G(this,"panelVisible$",this._panelVisible$.asObservable());G(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$(o.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)}},c.ThreadCommentPanelService=Ae([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],c.ThreadCommentPanelService);const ue="thread-comment-panel",Le="UNIVER_THREAD_COMMENT_UI_PLUGIN",he={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(c.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:ue},width:330}),t.setPanelVisible(!0)),!0}},W={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(c.ThreadCommentPanelService).setActiveComment(e),!0}},ke="thread-comment-ui.config",ve={};var Ce=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,Be=(n,e,t)=>e in n?Ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Fe=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ve(e,t):e,s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=(r?l(e,t,i):l(i))||i);return r&&i&&Ce(e,t,i),i},le=(n,e)=>(t,r)=>e(t,r,n),fe=(n,e,t)=>Be(n,typeof e!="symbol"?e+"":e,t);c.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ve,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:s,...l}=o.merge({},ve,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(ke,l)}onStarting(){var e;o.mergeOverrideWithDependencies([[c.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[he,W].forEach(t=>{this._commandService.registerCommand(t)})}},fe(c.UniverThreadCommentUIPlugin,"pluginName",Le),fe(c.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),c.UniverThreadCommentUIPlugin=Fe([o.DependentOn(_.UniverThreadCommentPlugin),le(1,o.Inject(o.Injector)),le(2,o.ICommandService),le(3,o.IConfigService)],c.UniverThreadCommentUIPlugin);var me={exports:{}},Y={};/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var pe;function We(){if(pe)return Y;pe=1;var n=u,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(C,h,U){var f,p={},I=null,T=null;U!==void 0&&(I=""+U),h.key!==void 0&&(I=""+h.key),h.ref!==void 0&&(T=h.ref);for(f in h)r.call(h,f)&&!s.hasOwnProperty(f)&&(p[f]=h[f]);if(C&&C.defaultProps)for(f in h=C.defaultProps,h)p[f]===void 0&&(p[f]=h[f]);return{$$typeof:e,type:C,key:I,ref:T,props:p,_owner:i.current}}return Y.Fragment=t,Y.jsx=l,Y.jsxs=l,Y}var ge;function ze(){return ge||(ge=1,me.exports=We()),me.exports}var a=ze(),M=function(){return M=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},M.apply(this,arguments)},Ze=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var 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},z=u.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,s=n.extend,l=Ze(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),h=u.useRef("_".concat(Ke()));return Ie(t,"".concat(r),{defIds:t.defIds,idSuffix:h.current},M({ref:e,className:C},l),s)});function Ie(n,e,t,r,i){return u.createElement(n.tag,M(M({key:e},Je(n,t,i)),r),(Ge(n,t).children||[]).map(function(s,l){return Ie(s,"".concat(e,"-").concat(n.tag,"-").concat(l),t,void 0,i)}))}function Je(n,e,t){var r=M({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);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(s){var l=s[0],C=s[1];typeof C=="string"&&(r[l]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Ge(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)?M(M({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?M(M({},i),{attrs:M(M({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function Ke(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var Ye={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"}}]},xe=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:Ye}))});xe.displayName="DeleteSingle";var Qe={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"}}]},Se=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:Qe}))});Se.displayName="IncreaseSingle";var Xe={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"}}]},ye=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Xe}))});ye.displayName="MoreHorizontalSingle";var qe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},be=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:qe}))});be.displayName="ReplyToCommentSingle";var $e={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Te=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:$e}))});Te.displayName="ResolvedSingle";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},_e=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:et}))});_e.displayName="SolveSingle";function je(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=je(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function tt(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=je(n))&&(r&&(r+=" "),r+=e);return r}const ie={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},nt=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const i=[];for(;(t=e.exec(n))!==null;)t.index>r&&i.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?i.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&i.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&i.push({type:"text",content:n.substring(r)}),i},rt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),Ue=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let s=0;return t==null||t.forEach(l=>{s<l.startIndex&&i.push({type:"text",content:e.slice(s,l.startIndex)}),i.push({type:"mention",content:{label:e.slice(l.startIndex,l.endIndex).slice(1,-1),id:l.rangeId}}),s=l.endIndex}),i.push({type:"text",content:e.slice(s,r)}),i},Pe=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 s=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:s,properties:{}});break}}}),e+=`
|
|
11
|
-
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},it=(n,e,t,r,i)=>{var l,C;const s=(l=n.raw)==null?void 0:l.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[s?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:s}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Ee=u.forwardRef((n,e)=>{var V;const{comment:t,onSave:r,id:i,onCancel:s,autoFocus:l,unitId:C}=n,h=o.useDependency(o.IMentionIOService),U=o.useDependency(o.ICommandService),f=o.useDependency(o.LocaleService),[p,I]=u.useState({...t}),[T,x]=u.useState(!1),y=u.useRef(null),D=o.useDependency(Oe.DocSelectionManagerService),N=(V=o.useDependency(we.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:V.with(Me.DocSelectionRenderService);u.useImperativeHandle(e,()=>({reply(v){var b;I({...t,text:v,attachments:[]}),(b=y.current)==null||b.inputElement.focus()}}));const S=()=>{var v;p.text&&(r==null||r({...p,text:p.text}),x(!1),I({text:void 0}),(v=y.current)==null||v.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:v=>v.preventDefault(),children:[a.jsx(E.Mentions,{ref:y,autoFocus:l,style:{width:"100%"},placeholder:f.t("threadCommentUI.editor.placeholder"),value:p!=null&&p.text?rt(Ue(p.text)):"",onChange:v=>{v.target.value||I({...t,text:void 0}),I==null||I({...t,text:Pe(nt(v.target.value))})},onFocus:()=>{const v=D.getActiveTextRange();v&&v.collapsed&&(N==null||N.removeAllRanges()),N==null||N.blur(),x(!0)},children:a.jsx(E.Mention,{trigger:"@",data:(v,b)=>h.list({search:v,unitId:C}).then(m=>m.list.map(H=>H.mentions.map(j=>({id:j.objectId,display:j.label,raw:j}))).flat()).then(b),displayTransform:(v,b)=>`@${b} `,renderSuggestion:it},"@")}),T?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(E.Button,{style:{marginRight:12},onClick:()=>{s==null||s(),x(!1),I({text:void 0}),U.executeCommand(W.id)},children:f.t("threadCommentUI.editor.cancel")}),a.jsx(E.Button,{type:"primary",disabled:!p.text,onClick:S,children:f.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),g={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Ne="__mock__",ot=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:s,onReply:l,resolved:C,isRoot:h,onClose:U,onDeleteComment:f}=n,p=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),T=o.useDependency(o.UserManagerService),x=T.getUser(e.personId),y=k.useObservable(T.currentUser$),D=(y==null?void 0:y.userID)===e.personId,P=e.id===Ne,[N,S]=u.useState(!1),V=()=>{(f==null?void 0:f(e))!==!1&&(p.executeCommand(h?_.DeleteCommentTreeCommand.id:_.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),h&&(U==null||U()))};return a.jsxs("div",{className:g.threadCommentItem,onMouseLeave:()=>S(!1),onMouseEnter:()=>S(!0),children:[a.jsx("img",{className:g.threadCommentItemHead,src:x==null?void 0:x.avatar}),a.jsxs("div",{className:g.threadCommentItemTitle,children:[a.jsx("div",{className:g.threadCommentUsername,children:(x==null?void 0:x.name)||" "}),a.jsxs("div",{children:[P||C?null:N?a.jsx("div",{className:g.threadCommentIcon,onClick:()=>l(x),children:a.jsx(be,{})}):null,D&&!P&&!C?a.jsx(E.DropdownLegacy,{overlay:a.jsxs(E.Menu,{children:[a.jsx(E.MenuItem,{onClick:()=>s==null?void 0:s(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(E.MenuItem,{onClick:V,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:g.threadCommentIcon,children:a.jsx(ye,{})})}):null]})]}),a.jsx("div",{className:g.threadCommentItemTime,children:e.dT}),i?a.jsx(Ee,{id:e.id,comment:e,onCancel:()=>s==null?void 0:s(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:v,attachments:b})=>{s==null||s(!1),p.executeCommand(_.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:v,attachments:b}})}}):a.jsx("div",{className:g.threadCommentItemContent,children:Ue(e.text).map((v,b)=>{switch(v.type){case"mention":return a.jsxs("a",{className:g.threadCommentItemAt,children:["@",v.content.label," "]},b);default:return v.content}})})]})},Re=n=>{var ae,ee,te;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:s=!0,onClick:l,showHighlight:C,onClose:h,getSubUnitName:U,prefix:f,autoFocus:p,onMouseEnter:I,onMouseLeave:T,onAddComment:x,onDeleteComment:y,onResolve:D}=n,P=o.useDependency(_.ThreadCommentModel),[N,S]=u.useState(!1),[V,v]=u.useState(""),b=u.useMemo(()=>P.commentUpdate$.pipe(re.debounceTime(16)),[P]);k.useObservable(b);const m=e?P.getCommentWithChildren(t,r,e):null,H=o.useDependency(o.ICommandService),j=o.useDependency(o.UserManagerService),A=m==null?void 0:m.root.resolved,w=k.useObservable(j.currentUser$),X=u.useRef(null),q=[...m?[m.root]:[{id:Ne,text:{dataStream:`
|
|
12
|
-
\r`},personId:(ae=w==null?void 0:w.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(ee=m==null?void 0:m.children)!=null?ee:[]],Z=u.useRef(null),B=R=>{R.stopPropagation(),A?H.executeCommand(W.id,{unitId:t,subUnitId:r,commentId:e}):H.executeCommand(W.id),H.executeCommand(_.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!A}),D==null||D(!A)},$=R=>{R.stopPropagation(),H.executeCommand(W.id),!(m!=null&&m.root&&(y==null?void 0:y(m.root))===!1)&&(H.executeCommand(_.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),h==null||h())};u.useEffect(()=>T==null?void 0:T(),[]);const F=U((te=m==null?void 0:m.root.subUnitId)!=null?te:r),oe=s&&!V&&!A,K=`${i||(m==null?void 0:m.root.ref)||""}${F?" · ":""}${F}`;return a.jsxs("div",{className:tt(g.threadComment,{[g.threadCommentActive]:!A&&(C||N||f==="cell")}),onClick:l,id:`${f}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),S(!0)},onMouseLeave:()=>{T==null||T(),S(!1)},children:[!A&&C?a.jsx("div",{className:g.threadCommentHighlight}):null,a.jsxs("div",{className:g.threadCommentTitle,children:[a.jsxs("div",{className:g.threadCommentTitlePosition,children:[a.jsx("div",{className:g.threadCommentTitleHighlight}),a.jsx(E.Tooltip,{showIfEllipsis:!0,title:K,children:a.jsx("div",{className:g.threadCommentTitlePositionText,children:K})})]}),m?a.jsxs("div",{className:g.threadCommentIconContainer,children:[a.jsx("div",{onClick:B,className:g.threadCommentIcon,style:{color:A?"rgb(var(--green-500))":""},children:A?a.jsx(Te,{}):a.jsx(_e,{})}),(w==null?void 0:w.userID)===m.root.personId?a.jsx("div",{className:g.threadCommentIcon,onClick:$,children:a.jsx(xe,{})}):null]}):null]}),a.jsx("div",{className:g.threadCommentContent,ref:Z,children:q.map(R=>a.jsx(ot,{onClose:h,unitId:t,subUnitId:r,item:R,isRoot:R.id===(m==null?void 0:m.root.id),editing:V===R.id,resolved:m==null?void 0:m.root.resolved,onEditingChange:L=>{v(L?R.id:"")},onReply:L=>{L&&requestAnimationFrame(()=>{var d;(d=X.current)==null||d.reply(Pe([{type:"mention",content:{id:L.userID,label:L.name}}]))})},onAddComment:x,onDeleteComment:y},R.id))}),oe?a.jsx("div",{children:a.jsx(Ee,{ref:X,unitId:t,subUnitId:r,onSave:async({text:R,attachments:L})=>{const d={text:R,attachments:L,dT:_.getDT(),id:o.generateRandomId(),ref:i,personId:w==null?void 0:w.userID,parentId:m==null?void 0:m.root.id,unitId:t,subUnitId:r,threadId:m==null?void 0:m.root.threadId};(x==null?void 0:x(d))!==!1&&(await H.executeCommand(_.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:d}),Z.current&&(Z.current.scrollTop=Z.current.scrollHeight))},autoFocus:p||!m,onCancel:()=>{m||h==null||h()}},`${p}`)}):null]})},Q={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},at=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:s,onResolve:l,sortComments:C,onItemLeave:h,onItemEnter:U,disableAdd:f,tempComment:p,onAddComment:I,onDeleteComment:T,showComments:x}=n,[y,D]=u.useState("all"),[P,N]=u.useState("all"),S=o.useDependency(o.LocaleService),V=o.useDependency(o.UserManagerService),v=o.useDependency(_.ThreadCommentModel),[b,m]=u.useState(()=>v.getUnit(e)),H=o.useDependency(c.ThreadCommentPanelService),j=k.useObservable(H.activeCommentId$),A=k.useObservable(v.commentUpdate$),w=o.useDependency(o.ICommandService),X=k.useObservable(t),q=u.useRef(!0),Z="panel",B=k.useObservable(V.currentUser$),$=u.useMemo(()=>{var de;const d=y==="all"?b:(de=b.filter(O=>O.subUnitId===X))!=null?de:[],ne=C!=null?C:O=>O,se=d.map(O=>{var J;return{...O.root,children:(J=O.children)!=null?J:[],users:O.relativeUsers}});if(x){const O=new Map;return se.forEach(J=>{O.set(J.id,J)}),[...x,""].map(J=>O.get(J)).filter(Boolean)}else return ne(se)},[x,y,b,C,X]),F=u.useMemo(()=>[...$.filter(d=>!d.resolved),...$.filter(d=>d.resolved)],[$]),oe=u.useMemo(()=>P==="resolved"?F.filter(d=>d.resolved):P==="unsolved"?F.filter(d=>!d.resolved):P==="concern_me"&&B!=null&&B.userID?F.filter(d=>d==null?void 0:d.users.has(B.userID)):F,[F,B==null?void 0:B.userID,P]),K=p?[p,...oe]:oe,ae=K.filter(d=>!d.resolved),ee=K.filter(d=>d.resolved),te=P!=="all"||y!=="all",R=()=>{N("all"),D("all")};u.useEffect(()=>{e&&m(v.getUnit(e))},[e,v,A]),u.useEffect(()=>{var O;if(!j)return;if(!q.current){q.current=!0;return}const{unitId:d,subUnitId:ne,commentId:se}=j,de=`${Z}-${d}-${ne}-${se}`;(O=document.getElementById(de))==null||O.scrollIntoView({block:"center"})},[j]);const L=d=>a.jsx(Re,{prefix:Z,getSubUnitName:s,id:d.id,unitId:d.unitId,subUnitId:d.subUnitId,refStr:d.ref,type:r,showEdit:(j==null?void 0:j.commentId)===d.id,showHighlight:(j==null?void 0:j.commentId)===d.id,onClick:()=>{q.current=!1,d.resolved?w.executeCommand(W.id):w.executeCommand(W.id,{unitId:d.unitId,subUnitId:d.subUnitId,commentId:d.id,temp:!1})},onMouseEnter:()=>U==null?void 0:U(d),onMouseLeave:()=>h==null?void 0:h(d),onAddComment:I,onDeleteComment:T,onResolve:ne=>l==null?void 0:l(d.id,ne)},d.id);return a.jsxs("div",{className:Q.threadCommentPanel,children:[a.jsxs("div",{className:Q.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(E.Select,{borderless:!0,value:y,onChange:d=>D(d),options:[{value:"current",label:S.t("threadCommentUI.filter.sheet.current")},{value:"all",label:S.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(E.Select,{borderless:!0,value:P,onChange:d=>N(d),options:[{value:"all",label:S.t("threadCommentUI.filter.status.all")},{value:"resolved",label:S.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:S.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:S.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(L),ee.length?a.jsx("div",{className:Q.threadCommentPanelSolved,children:"已解决"}):null,ee.map(L),K.length?null:a.jsxs("div",{className:Q.threadCommentPanelEmpty,children:[te?S.t("threadCommentUI.panel.filterEmpty"):S.t("threadCommentUI.panel.empty"),te?a.jsx(E.Button,{onClick:R,type:"link",children:S.t("threadCommentUI.panel.reset")}):a.jsxs(E.Button,{id:"thread-comment-add",className:Q.threadCommentPanelAdd,type:"primary",onClick:i,disabled:f,children:[a.jsx(Se,{}),S.t("threadCommentUI.panel.addComment")]})]})]})};c.SetActiveCommentOperation=W,c.THREAD_COMMENT_PANEL=ue,c.ThreadCommentPanel=at,c.ThreadCommentTree=Re,c.ToggleSheetCommentPanelOperation=he,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
(function(c,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("@univerjs/docs-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react/jsx-runtime","@univerjs/design","react","@univerjs/docs-ui"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverThreadCommentUi={},c.UniverCore,c.UniverThreadComment,c.UniverUi,c.rxjs,c.React,c.UniverDesign,c.React,c.UniverDocsUi))})(this,function(c,o,y,$,te,a,A,m,se){"use strict";var Qe=Object.defineProperty;var Xe=(c,o,y)=>o in c?Qe(c,o,{enumerable:!0,configurable:!0,writable:!0,value:y}):c[o]=y;var R=(c,o,y)=>Xe(c,typeof o!="symbol"?o+"":o,y);var Ne=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,De=(n,e,t,r)=>{for(var i=r>1?void 0:r?xe(e,t):e,l=n.length-1,h;l>=0;l--)(h=n[l])&&(i=(r?h(e,t,i):h(i))||i);return r&&i&&Ne(e,t,i),i},le=(n,e)=>(t,r)=>e(t,r,n);c.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();R(this,"_panelVisible",!1);R(this,"_panelVisible$",new te.BehaviorSubject(!1));R(this,"_activeCommentId");R(this,"_activeCommentId$",new te.BehaviorSubject(void 0));R(this,"panelVisible$",this._panelVisible$.asObservable());R(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$(o.UniverInstanceType.UNIVER_SHEET).pipe(te.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)}},c.ThreadCommentPanelService=De([le(0,o.Inject($.ISidebarService)),le(1,o.IUniverInstanceService)],c.ThreadCommentPanelService);const me="thread-comment-panel",Oe="UNIVER_THREAD_COMMENT_UI_PLUGIN",ce={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get($.ISidebarService),t=n.get(c.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:me},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(c.ThreadCommentPanelService).setActiveComment(e),!0}},Me="thread-comment-ui.config",he={};var ue=Object.defineProperty,He=Object.getOwnPropertyDescriptor,we=(n,e,t)=>e in n?ue(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,je=(n,e,t,r)=>{for(var i=r>1?void 0:r?He(e,t):e,l=n.length-1,h;l>=0;l--)(h=n[l])&&(i=(r?h(e,t,i):h(i))||i);return r&&i&&ue(e,t,i),i},de=(n,e)=>(t,r)=>e(t,r,n),Ce=(n,e,t)=>we(n,typeof e!="symbol"?e+"":e,t);c.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=he,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:l,...h}=o.merge({},he,this._config);l&&this._configService.setConfig("menu",l,{merge:!0}),this._configService.setConfig(Me,h)}onStarting(){var e;o.mergeOverrideWithDependencies([[c.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ce,F].forEach(t=>{this._commandService.registerCommand(t)})}},Ce(c.UniverThreadCommentUIPlugin,"pluginName",Oe),Ce(c.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),c.UniverThreadCommentUIPlugin=je([o.DependentOn(y.UniverThreadCommentPlugin),de(1,o.Inject(o.Injector)),de(2,o.ICommandService),de(3,o.IConfigService)],c.UniverThreadCommentUIPlugin);var O=function(){return O=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},O.apply(this,arguments)},$e=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},q=m.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,l=n.extend,h=$e(n,["icon","id","className","extend"]),T="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),S=m.useRef("_".concat(ke()));return ve(t,"".concat(r),{defIds:t.defIds,idSuffix:S.current},O({ref:e,className:T},h),l)});function ve(n,e,t,r,i){return m.createElement(n.tag,O(O({key:e},Ae(n,t,i)),r),(Le(n,t).children||[]).map(function(l,h){return ve(l,"".concat(e,"-").concat(n.tag,"-").concat(h),t,void 0,i)}))}function Ae(n,e,t){var r=O({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);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(l){var h=l[0],T=l[1];typeof T=="string"&&(r[h]=T.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Le(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)?O(O({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?O(O({},i),{attrs:O(O({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function ke(){return Math.random().toString(36).substring(2,8)}q.displayName="UniverIcon";var Ve={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"}}]},fe=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"delete-single",ref:e,icon:Ve}))});fe.displayName="DeleteSingle";var Be={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"}}]},ge=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"increase-single",ref:e,icon:Be}))});ge.displayName="IncreaseSingle";var Fe={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"}}]},pe=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Fe}))});pe.displayName="MoreHorizontalSingle";var We={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}}]},Ie=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:We}))});Ie.displayName="ReplyToCommentSingle";var qe={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"}}]},Se=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"resolved-single",ref:e,icon:qe}))});Se.displayName="ResolvedSingle";var ze={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}}]},Te=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"solve-single",ref:e,icon:ze}))});Te.displayName="SolveSingle";function be(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=be(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Re(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=be(n))&&(r&&(r+=" "),r+=e);return r}const ye={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"};function _e(n){return{id:"d",body:n,documentStyle:{}}}const Ue=m.forwardRef((n,e)=>{var V;const{comment:t,onSave:r,id:i,onCancel:l,autoFocus:h,unitId:T,type:S}=n,N=o.useDependency(o.ICommandService),M=o.useDependency(o.LocaleService),[B,H]=m.useState(!1),x=o.useDependency(se.IEditorService),C=m.useRef(null),p=S===o.UniverInstanceType.UNIVER_SHEET?o.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:T,[w,U]=m.useState(()=>{var u,v,I;return o.BuildTextUtils.transform.getPlainText((I=(v=(u=C.current)==null?void 0:u.getDocumentData().body)==null?void 0:v.dataStream)!=null?I:"")});m.useEffect(()=>{var v,I,d,f;U(o.BuildTextUtils.transform.getPlainText((d=(I=(v=C.current)==null?void 0:v.getDocumentData().body)==null?void 0:I.dataStream)!=null?d:""));const u=(f=C.current)==null?void 0:f.selectionChange$.subscribe(()=>{var K,P,_;U(o.BuildTextUtils.transform.getPlainText((_=(P=(K=C.current)==null?void 0:K.getDocumentData().body)==null?void 0:P.dataStream)!=null?_:""))});return()=>u==null?void 0:u.unsubscribe()},[(V=C.current)==null?void 0:V.selectionChange$]);const L=m.useMemo(()=>({keyCodes:[{keyCode:$.KeyCode.ENTER}],handler:u=>{u===$.KeyCode.ENTER&&N.executeCommand(se.BreakLineCommand.id)}}),[N]);m.useImperativeHandle(e,()=>({reply(u){var v,I;(v=C.current)==null||v.focus(),(I=C.current)==null||I.setDocumentData(_e(u))}}));const b=()=>{if(C.current){const u=o.Tools.deepClone(C.current.getDocumentData().body);H(!1),r==null||r({...t,text:u}),C.current.replaceText(""),setTimeout(()=>{var v,I;(v=C.current)==null||v.setSelectionRanges([]),(I=C.current)==null||I.blur()},10)}};return a.jsxs("div",{className:ye.threadCommentEditor,onClick:u=>u.preventDefault(),children:[a.jsx(se.RichTextEditor,{ref:C,autoFocus:h,style:{width:"100%"},keyboardEventConfig:L,placeholder:M.t("threadCommentUI.editor.placeholder"),initialValue:(t==null?void 0:t.text)&&_e(t.text),onFocusChange:u=>u&&H(u),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{x.focus(p)},30)}}),B?a.jsxs("div",{className:ye.threadCommentEditorButtons,children:[a.jsx(A.Button,{style:{marginRight:12},onClick:()=>{var u;l==null||l(),H(!1),(u=C.current)==null||u.replaceText("",!0),N.executeCommand(F.id)},children:M.t("threadCommentUI.editor.cancel")}),a.jsx(A.Button,{type:"primary",disabled:!w,onClick:b,children:M.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),Ke=n=>{const{dataStream:e,customRanges:t}=n,r=e.endsWith(`\r
|
|
3
|
+
`)?e.length-2:e.length,i=[];let l=0;return t==null||t.forEach(h=>{l<h.startIndex&&i.push({type:"text",content:e.slice(l,h.startIndex)}),i.push({type:"mention",content:{label:e.slice(h.startIndex,h.endIndex+1),id:h.rangeId}}),l=h.endIndex+1}),i.push({type:"text",content:e.slice(l,r)}),i},Ze=n=>{const{paragraphs:e=[]}=n;let t=0;return e.map(r=>{const i=o.getBodySlice(n,t,r.startIndex);return t=r.startIndex+1,Ke(i)})},Ge=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 l=e.length-1;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:l,properties:{}});break}}}),e+=`
|
|
4
|
+
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},g={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Pe="__mock__",Ye=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:l,onReply:h,resolved:T,isRoot:S,onClose:N,onDeleteComment:M,type:B}=n,H=o.useDependency(o.ICommandService),x=o.useDependency(o.LocaleService),C=o.useDependency(o.UserManagerService),p=C.getUser(e.personId),w=$.useObservable(C.currentUser$),U=(w==null?void 0:w.userID)===e.personId,L=e.id===Pe,[b,V]=m.useState(!1),u=()=>{(M==null?void 0:M(e))!==!1&&(H.executeCommand(S?y.DeleteCommentTreeCommand.id:y.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),S&&(N==null||N()))};return a.jsxs("div",{className:g.threadCommentItem,onMouseLeave:()=>V(!1),onMouseEnter:()=>V(!0),children:[a.jsx("img",{className:g.threadCommentItemHead,src:p==null?void 0:p.avatar}),a.jsxs("div",{className:g.threadCommentItemTitle,children:[a.jsx("div",{className:g.threadCommentUsername,children:(p==null?void 0:p.name)||" "}),a.jsxs("div",{children:[L||T?null:b?a.jsx("div",{className:g.threadCommentIcon,onClick:()=>h(p),children:a.jsx(Ie,{})}):null,U&&!L&&!T?a.jsx(A.DropdownLegacy,{overlay:a.jsxs(A.Menu,{children:[a.jsx(A.MenuItem,{onClick:()=>l==null?void 0:l(!0),children:x.t("threadCommentUI.item.edit")},"edit"),a.jsx(A.MenuItem,{onClick:u,children:x.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:g.threadCommentIcon,children:a.jsx(pe,{})})}):null]})]}),a.jsx("div",{className:g.threadCommentItemTime,children:e.dT}),i?a.jsx(Ue,{type:B,id:e.id,comment:e,onCancel:()=>l==null?void 0:l(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:v,attachments:I})=>{l==null||l(!1),H.executeCommand(y.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:v,attachments:I}})}}):a.jsx("div",{className:g.threadCommentItemContent,children:Ze(e.text).map((v,I)=>a.jsx("div",{children:v.map((d,f)=>{switch(d.type){case"mention":return a.jsxs("a",{className:g.threadCommentItemAt,children:[d.content.label," "]},f);default:return d.content}})},I))})]})},Ee=n=>{var X,ee,ie;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:l=!0,onClick:h,showHighlight:T,onClose:S,getSubUnitName:N,prefix:M,autoFocus:B,onMouseEnter:H,onMouseLeave:x,onAddComment:C,onDeleteComment:p,onResolve:w,type:U}=n,L=o.useDependency(y.ThreadCommentModel),[b,V]=m.useState(!1),[u,v]=m.useState(""),I=m.useMemo(()=>L.commentUpdate$.pipe(te.debounceTime(16)),[L]);$.useObservable(I);const d=e?L.getCommentWithChildren(t,r,e):null,f=o.useDependency(o.ICommandService),K=o.useDependency(o.UserManagerService),P=d==null?void 0:d.root.resolved,_=$.useObservable(K.currentUser$),Z=m.useRef(null),ne=[...d?[d.root]:[{id:Pe,text:{dataStream:`
|
|
5
|
+
\r`},personId:(X=_==null?void 0:_.userID)!=null?X:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(ee=d==null?void 0:d.children)!=null?ee:[]],j=m.useRef(null),Y=E=>{E.stopPropagation(),P?f.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):f.executeCommand(F.id),f.executeCommand(y.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!P}),w==null||w(!P)},W=E=>{E.stopPropagation(),f.executeCommand(F.id),!(d!=null&&d.root&&(p==null?void 0:p(d.root))===!1)&&(f.executeCommand(y.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),S==null||S())};m.useEffect(()=>x==null?void 0:x(),[]);const J=N((ie=d==null?void 0:d.root.subUnitId)!=null?ie:r),Q=l&&!u&&!P,re=`${i||(d==null?void 0:d.root.ref)||""}${J?" · ":""}${J}`;return a.jsxs("div",{className:Re(g.threadComment,{[g.threadCommentActive]:!P&&(T||b||M==="cell")}),onClick:h,id:`${M}-${t}-${r}-${e}`,onMouseEnter:()=>{H==null||H(),V(!0)},onMouseLeave:()=>{x==null||x(),V(!1)},children:[!P&&T?a.jsx("div",{className:g.threadCommentHighlight}):null,a.jsxs("div",{className:g.threadCommentTitle,children:[a.jsxs("div",{className:g.threadCommentTitlePosition,children:[a.jsx("div",{className:g.threadCommentTitleHighlight}),a.jsx(A.Tooltip,{showIfEllipsis:!0,title:re,children:a.jsx("div",{className:g.threadCommentTitlePositionText,children:re})})]}),d?a.jsxs("div",{className:g.threadCommentIconContainer,children:[a.jsx("div",{onClick:Y,className:g.threadCommentIcon,style:{color:P?"rgb(var(--green-500))":""},children:P?a.jsx(Se,{}):a.jsx(Te,{})}),(_==null?void 0:_.userID)===d.root.personId?a.jsx("div",{className:g.threadCommentIcon,onClick:W,children:a.jsx(fe,{})}):null]}):null]}),a.jsx("div",{className:g.threadCommentContent,ref:j,children:ne.map(E=>a.jsx(Ye,{onClose:S,unitId:t,subUnitId:r,item:E,isRoot:E.id===(d==null?void 0:d.root.id),editing:u===E.id,resolved:d==null?void 0:d.root.resolved,type:U,onEditingChange:s=>{v(s?E.id:"")},onReply:s=>{s&&requestAnimationFrame(()=>{var k;(k=Z.current)==null||k.reply(Ge([{type:"mention",content:{id:s.userID,label:s.name}}]))})},onAddComment:C,onDeleteComment:p},E.id))}),Q?a.jsx("div",{children:a.jsx(Ue,{ref:Z,type:U,unitId:t,subUnitId:r,onSave:async({text:E,attachments:s})=>{const k={text:E,attachments:s,dT:y.getDT(),id:o.generateRandomId(),ref:i,personId:_==null?void 0:_.userID,parentId:d==null?void 0:d.root.id,unitId:t,subUnitId:r,threadId:d==null?void 0:d.root.threadId};(C==null?void 0:C(k))!==!1&&(await f.executeCommand(y.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:k}),j.current&&(j.current.scrollTop=j.current.scrollHeight))},autoFocus:B||!d,onCancel:()=>{d||S==null||S()}},`${B}`)}):null]})},G={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},Je=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:l,onResolve:h,sortComments:T,onItemLeave:S,onItemEnter:N,disableAdd:M,tempComment:B,onAddComment:H,onDeleteComment:x,showComments:C}=n,[p,w]=m.useState("all"),[U,L]=m.useState("all"),b=o.useDependency(o.LocaleService),V=o.useDependency(o.UserManagerService),u=o.useDependency(y.ThreadCommentModel),[v,I]=m.useState(()=>u.getUnit(e)),d=o.useDependency(c.ThreadCommentPanelService),f=$.useObservable(d.activeCommentId$),K=$.useObservable(u.commentUpdate$),P=o.useDependency(o.ICommandService),_=$.useObservable(t),Z=m.useRef(!0),ne="panel",j=$.useObservable(V.currentUser$),Y=m.useMemo(()=>{var ae;const s=p==="all"?v:(ae=v.filter(D=>D.subUnitId===_))!=null?ae:[],k=T!=null?T:D=>D,oe=s.map(D=>{var z;return{...D.root,children:(z=D.children)!=null?z:[],users:D.relativeUsers}});if(C){const D=new Map;return oe.forEach(z=>{D.set(z.id,z)}),[...C,""].map(z=>D.get(z)).filter(Boolean)}else return k(oe)},[C,p,v,T,_]),W=m.useMemo(()=>[...Y.filter(s=>!s.resolved),...Y.filter(s=>s.resolved)],[Y]),J=m.useMemo(()=>U==="resolved"?W.filter(s=>s.resolved):U==="unsolved"?W.filter(s=>!s.resolved):U==="concern_me"&&j!=null&&j.userID?W.filter(s=>s==null?void 0:s.users.has(j.userID)):W,[W,j==null?void 0:j.userID,U]),Q=B?[B,...J]:J,re=Q.filter(s=>!s.resolved),X=Q.filter(s=>s.resolved),ee=U!=="all"||p!=="all",ie=()=>{L("all"),w("all")};m.useEffect(()=>{e&&I(u.getUnit(e))},[e,u,K]),m.useEffect(()=>{var D;if(!f)return;if(!Z.current){Z.current=!0;return}const{unitId:s,subUnitId:k,commentId:oe}=f,ae=`${ne}-${s}-${k}-${oe}`;(D=document.getElementById(ae))==null||D.scrollIntoView({block:"center"})},[f]);const E=s=>a.jsx(Ee,{prefix:ne,getSubUnitName:l,id:s.id,unitId:s.unitId,subUnitId:s.subUnitId,refStr:s.ref,type:r,showEdit:(f==null?void 0:f.commentId)===s.id,showHighlight:(f==null?void 0:f.commentId)===s.id,onClick:()=>{Z.current=!1,s.resolved?P.executeCommand(F.id):P.executeCommand(F.id,{unitId:s.unitId,subUnitId:s.subUnitId,commentId:s.id,temp:!1})},onMouseEnter:()=>N==null?void 0:N(s),onMouseLeave:()=>S==null?void 0:S(s),onAddComment:H,onDeleteComment:x,onResolve:k=>h==null?void 0:h(s.id,k)},s.id);return a.jsxs("div",{className:G.threadCommentPanel,children:[a.jsxs("div",{className:G.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(A.Select,{borderless:!0,value:p,onChange:s=>w(s),options:[{value:"current",label:b.t("threadCommentUI.filter.sheet.current")},{value:"all",label:b.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(A.Select,{borderless:!0,value:U,onChange:s=>L(s),options:[{value:"all",label:b.t("threadCommentUI.filter.status.all")},{value:"resolved",label:b.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:b.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:b.t("threadCommentUI.filter.status.concernMe")}]})]}),re.map(E),X.length?a.jsx("div",{className:G.threadCommentPanelSolved,children:"已解决"}):null,X.map(E),Q.length?null:a.jsxs("div",{className:G.threadCommentPanelEmpty,children:[ee?b.t("threadCommentUI.panel.filterEmpty"):b.t("threadCommentUI.panel.empty"),ee?a.jsx(A.Button,{onClick:ie,type:"link",children:b.t("threadCommentUI.panel.reset")}):a.jsxs(A.Button,{id:"thread-comment-add",className:G.threadCommentPanelAdd,type:"primary",onClick:i,disabled:M,children:[a.jsx(ge,{}),b.t("threadCommentUI.panel.addComment")]})]})]})};c.SetActiveCommentOperation=F,c.THREAD_COMMENT_PANEL=me,c.ThreadCommentPanel=Je,c.ThreadCommentTree=Ee,c.ToggleSheetCommentPanelOperation=ce,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
13
6
|
|
|
14
7
|
|
|
15
8
|
// @univerjs/docs-thread-comment-ui/index
|
|
16
|
-
(function(
|
|
17
|
-
* @license React
|
|
18
|
-
* react-jsx-runtime.production.min.js
|
|
19
|
-
*
|
|
20
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the MIT license found in the
|
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*/var ee;function fe(){if(ee)return N;ee=1;var e=O,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(a,m,v){var c,C={},p=null,_=null;v!==void 0&&(p=""+v),m.key!==void 0&&(p=""+m.key),m.ref!==void 0&&(_=m.ref);for(c in m)n.call(m,c)&&!s.hasOwnProperty(c)&&(C[c]=m[c]);if(a&&a.defaultProps)for(c in m=a.defaultProps,m)C[c]===void 0&&(C[c]=m[c]);return{$$typeof:t,type:a,key:p,ref:_,props:C,_owner:i.current}}return N.Fragment=r,N.jsx=d,N.jsxs=d,N}var te;function ve(){return te||(te=1,W.exports=fe()),W.exports}var he=ve();const J={id:"docs.command.add-comment",type:o.CommandType.COMMAND,async handler(e,t){if(!t)return!1;const{comment:r,unitId:n}=t,s=await e.get(w.IThreadCommentDataSourceService).addComment(r),d=e.get(o.ICommandService),a=j.addCustomDecorationBySelectionFactory(e,{id:s.threadId,type:o.CustomDecorationType.COMMENT});if(a){const m={id:w.AddCommentMutation.id,params:{unitId:n,subUnitId:D,comment:s}},v={id:T.SetActiveCommentOperation.id,params:{unitId:n,subUnitId:D,commentId:s.id}};return(await o.sequenceExecute([m,a,v],d)).result}return!1}},K={id:"docs.command.delete-comment",type:o.CommandType.COMMAND,async handler(e,t){if(!t)return!1;const{commentId:r,unitId:n}=t,i=e.get(o.ICommandService),s=j.deleteCustomDecorationFactory(e,{id:r,unitId:n});return s?(await o.sequenceExecute([s],i)).result:!1}},ne=e=>{const t=e.get(g.IRenderManagerService),r=e.get(M.DocSelectionManagerService),n=t.getCurrent(),i=n==null?void 0:n.with(M.DocSkeletonManagerService).getSkeleton(),s=i==null?void 0:i.getViewModel().getEditArea();if(s===g.DocumentEditArea.FOOTER||s===g.DocumentEditArea.HEADER)return!0;const d=r.getActiveTextRange();return!!(d==null||d.collapsed)};function Ce(e){return{id:$.id,type:I.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:I.getMenuHiddenObservable(e,o.UniverInstanceType.UNIVER_DOC,void 0,o.SHEET_EDITOR_UNITS),disabled$:new A.Observable(function(t){const n=e.get(M.DocSelectionManagerService).textSelection$.pipe(A.debounceTime(16)).subscribe(()=>{t.next(ne(e))});return()=>{n.unsubscribe()}})}}function pe(e){return{id:q.id,type:I.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:I.getMenuHiddenObservable(e,o.UniverInstanceType.UNIVER_DOC)}}const R=()=>{const e=o.useDependency(o.IUniverInstanceService),t=o.useDependency(o.Injector),r=O.useMemo(()=>e.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_DOC),[e]),n=o.useObservable(r),i=O.useMemo(()=>new A.Observable(l=>l.next(D)),[]),s=o.useDependency(M.DocSelectionManagerService),d=O.useMemo(()=>s.textSelection$.pipe(A.debounceTime(16)),[s.textSelection$]);o.useObservable(d);const a=o.useDependency(o.ICommandService),m=o.useDependency(U),v=o.useObservable(m.addingComment$),[c,C]=O.useState([]);if(O.useEffect(()=>{var E;const l=new Set,f=n==null?void 0:n.getCustomDecorations();C((E=f==null?void 0:f.map(h=>h.id).filter(h=>{const b=l.has(h);return l.add(h),!b}))!=null?E:[]);const y=a.onCommandExecuted(h=>{var b;if(h.id===M.RichTextEditingMutation.id){const B=new Set,Y=n==null?void 0:n.getCustomDecorations();C((b=Y==null?void 0:Y.map(L=>L.id).filter(L=>{const Ne=B.has(L);return B.add(L),!Ne}))!=null?b:[])}});return()=>{y.dispose()}},[a,n]),!n)return null;const p=ne(t),_=n.getUnitId();return he.jsx(T.ThreadCommentPanel,{unitId:_,subUnitId$:i,type:o.UniverInstanceType.UNIVER_DOC,onAdd:()=>{a.executeCommand($.id)},getSubUnitName:()=>"",disableAdd:p,tempComment:v,onAddComment:l=>{if(!l.parentId){const f={unitId:_,range:v,comment:l};return a.executeCommand(J.id,f),m.endAdd(),!1}return!0},onDeleteComment:l=>{if(!l.parentId){const f={unitId:_,commentId:l.id};return a.executeCommand(K.id,f),!1}return!0},showComments:c})};R.componentKey="univer.doc.thread-comment-panel";const V={id:"docs.operation.show-comment-panel",type:o.CommandType.OPERATION,handler(e,t){var i;const r=e.get(T.ThreadCommentPanelService),n=e.get(I.ISidebarService);return(!r.panelVisible||((i=n.options.children)==null?void 0:i.label)!==R.componentKey)&&(n.open({header:{title:"threadCommentUI.panel.title"},children:{label:R.componentKey},width:320,onClose:()=>r.setPanelVisible(!1)}),r.setPanelVisible(!0)),t&&r.setActiveComment(t==null?void 0:t.activeComment),!0}},q={id:"docs.operation.toggle-comment-panel",type:o.CommandType.OPERATION,handler(e){var n;const t=e.get(T.ThreadCommentPanelService),r=e.get(I.ISidebarService);return!t.panelVisible||((n=r.options.children)==null?void 0:n.label)!==R.componentKey?(r.open({header:{title:"threadCommentUI.panel.title"},children:{label:R.componentKey},width:320,onClose:()=>t.setPanelVisible(!1)}),t.setPanelVisible(!0)):(r.close(),t.setPanelVisible(!1),t.setActiveComment(null)),!0}},$={id:"docs.operation.start-add-comment",type:o.CommandType.OPERATION,handler(e){var h,b,B;const t=e.get(T.ThreadCommentPanelService),n=e.get(o.IUniverInstanceService).getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC),i=e.get(M.DocSelectionManagerService),s=e.get(g.IRenderManagerService),d=e.get(o.UserManagerService),a=e.get(U),m=e.get(o.ICommandService),v=e.get(I.ISidebarService),c=i.getActiveTextRange();if(!n||!c)return!1;const C=(h=s.getRenderById(n.getUnitId()))==null?void 0:h.with(j.DocSelectionRenderService);if(c.collapsed)return t.panelVisible?(t.setPanelVisible(!1),v.close()):m.executeCommand(V.id),!0;m.executeCommand(V.id);const p=n.getUnitId(),_=((B=(b=n.getBody())==null?void 0:b.dataStream)!=null?B:"").slice(c.startOffset,c.endOffset),l=o.BuildTextUtils.transform.getPlainText(_),f=D,y="",E={unitId:p,subUnitId:f,id:y,ref:l,dT:w.getDT(),personId:d.getCurrentUser().userID,text:{dataStream:`\r
|
|
25
|
-
`},startOffset:c.startOffset,endOffset:c.endOffset,collapsed:!0,threadId:y};return C==null||C.blurEditor(),a.startAdd(E),t.setActiveComment({unitId:p,subUnitId:f,commentId:y}),!0}};var _e=Object.defineProperty,Ie=Object.getOwnPropertyDescriptor,Se=(e,t,r,n)=>{for(var i=n>1?void 0:n?Ie(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&_e(t,r,i),i},x=(e,t)=>(r,n)=>t(r,n,e);let F=class extends o.Disposable{constructor(e,t,r,n,i,s){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=r,this._docThreadCommentService=n,this._renderManagerService=i,this._threadCommentModel=s,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var r,n,i,s;if(t.id===M.SetTextSelectionsOperation.id){const d=t.params,{unitId:a,ranges:m}=d,v=this._univerInstanceService.getUnit(a,o.UniverInstanceType.UNIVER_DOC),c=m[0];if((e==null?void 0:e.startOffset)===(c==null?void 0:c.startOffset)&&(e==null?void 0:e.endOffset)===(c==null?void 0:c.endOffset))return;if(e=c,c&&v){const{startOffset:C,endOffset:p,collapsed:_}=c;let l;if(_?l=(n=(r=v.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(f=>f.startIndex<=C&&f.endIndex>=p-1):l=(s=(i=v.getBody())==null?void 0:i.customDecorations)==null?void 0:s.find(f=>f.startIndex<=C&&f.endIndex>=p-1),l){const f=this._threadCommentModel.getComment(a,D,l.id);f&&!f.resolved&&this._commandService.executeCommand(V.id,{activeComment:{unitId:a,subUnitId:D,commentId:l.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;this._commandService.executeCommand(T.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var t,r,n,i;if(e){const s=this._univerInstanceService.getUnit(e.unitId);if(s){const d=(t=this._renderManagerService.getRenderById(e.unitId))==null?void 0:t.with(j.DocBackScrollRenderController),a=(n=(r=s.getBody())==null?void 0:r.customDecorations)==null?void 0:n.find(m=>m.id===e.commentId);a&&d&&d.scrollToRange({startOffset:a.startIndex,endOffset:a.endIndex,collapsed:!1})}}(!e||e.commentId!==((i=this._docThreadCommentService.addingComment)==null?void 0:i.id))&&this._docThreadCommentService.endAdd()}))}};F=Se([x(0,o.Inject(T.ThreadCommentPanelService)),x(1,o.IUniverInstanceService),x(2,o.ICommandService),x(3,o.Inject(U)),x(4,g.IRenderManagerService),x(5,o.Inject(w.ThreadCommentModel))],F);var S=function(){return S=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},S.apply(this,arguments)},ge=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},re=O.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,s=e.extend,d=ge(e,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),m=O.useRef("_".concat(Me()));return ie(r,"".concat(n),{defIds:r.defIds,idSuffix:m.current},S({ref:t,className:a},d),s)});function ie(e,t,r,n,i){return O.createElement(e.tag,S(S({key:t},Oe(e,r,i)),n),(Te(e,r).children||[]).map(function(s,d){return ie(s,"".concat(t,"-").concat(e.tag,"-").concat(d),r,void 0,i)}))}function Oe(e,t,r){var n=S({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var i=t.defIds;return!i||i.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(s){var d=s[0],a=s[1];typeof a=="string"&&(n[d]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?S(S({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?S(S({},i),{attrs:S(S({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):e}function Me(){return Math.random().toString(36).substring(2,8)}re.displayName="UniverIcon";var De={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},oe=O.forwardRef(function(e,t){return O.createElement(re,Object.assign({},e,{id:"comment-single",ref:t,icon:De}))});oe.displayName="CommentSingle";const ye={[I.RibbonStartGroup.OTHERS]:{[q.id]:{order:1,menuItemFactory:pe}},[I.ContextMenuPosition.MAIN_AREA]:{[I.ContextMenuGroup.DATA]:{[$.id]:{order:1,menuItemFactory:Ce}}}};var be=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,Re=(e,t,r,n)=>{for(var i=n>1?void 0:n?Ue(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&be(t,r,i),i},G=(e,t)=>(r,n)=>t(r,n,e);let H=class extends o.Disposable{constructor(e,t,r){super(),this._commandService=e,this._menuManagerService=t,this._componentManager=r,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[J,K,V,$,q].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(ye)}_initComponents(){[R].forEach(e=>{this.disposeWithMe(this._componentManager.register(e.componentKey,e))}),this.disposeWithMe(this._componentManager.register("CommentSingle",oe))}};H=Re([G(0,o.ICommandService),G(1,I.IMenuManagerService),G(2,o.Inject(I.ComponentManager))],H);var xe=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Ee=(e,t,r,n)=>{for(var i=n>1?void 0:n?Pe(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&xe(t,r,i),i},P=(e,t)=>(r,n)=>t(r,n,e);let Z=class extends o.Disposable{constructor(e,t,r,n,i,s,d){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=r,this._docRenderController=n,this._univerInstanceService=i,this._threadCommentModel=s,this._commandService=d,this._interceptorViewModel(),this._initReRender(),this._initSyncComments()}_initReRender(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var r;if(e){this._docRenderController.reRender(e.unitId);return}const t=(r=this._univerInstanceService.getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC))==null?void 0:r.getUnitId();t&&this._docRenderController.reRender(t)})),this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{e.type==="resolve"&&this._docRenderController.reRender(e.unitId)}))}_interceptorViewModel(){this._docInterceptorService.intercept(M.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,r)=>{if(!e)return r(e);const{unitId:n,index:i,customDecorations:s}=t,d=this._threadCommentPanelService.activeCommentId,{commentId:a,unitId:m}=d||{},v=s.find(_=>_.id===a),c=this._threadCommentModel.getComment(n,D,e.id);if(!c)return r({...e,show:!1});const C=v&&i>=v.startIndex&&i<=v.endIndex,p=m===n&&e.id===a;return r({...e,active:p||C,show:!c.resolved})}})}_initSyncComments(){var i,s,d;const e=this._context.unit.getUnitId(),t=D,r=(d=(s=(i=this._context.unit.getBody())==null?void 0:i.customDecorations)==null?void 0:s.filter(a=>a.type===o.CustomDecorationType.COMMENT).map(a=>a.id))!=null?d:[];r.forEach(a=>{this._threadCommentModel.getComment(e,t,a)||this._threadCommentModel.addComment(e,t,{id:a,threadId:a,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),r.length&&this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(),D,r);let n=r.sort();this.disposeWithMe(this._commandService.onCommandExecuted(a=>{var m,v,c;if(a.id===M.RichTextEditingMutation.id){if(a.params.unitId!==this._context.unit.getUnitId())return;const p=(c=(v=(m=this._context.unit.getBody())==null?void 0:m.customDecorations)==null?void 0:v.filter(l=>l.type===o.CustomDecorationType.COMMENT).map(l=>l.id))!=null?c:[],_=p.sort();if(JSON.stringify(n)!==JSON.stringify(_)){const l=new Set(n),f=new Set(_),y=new Set,E=new Set;p.forEach(h=>{l.has(h)||y.add(h)}),n.forEach(h=>{f.has(h)||E.add(h)}),n=_,y.forEach(h=>{this._threadCommentModel.getComment(e,t,h)||this._threadCommentModel.addComment(e,t,{id:h,threadId:h,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),this._threadCommentModel.syncThreadComments(e,t,[...y])}}}))}};Z=Ee([P(1,o.Inject(M.DocInterceptorService)),P(2,o.Inject(T.ThreadCommentPanelService)),P(3,o.Inject(j.DocRenderController)),P(4,o.IUniverInstanceService),P(5,o.Inject(w.ThreadCommentModel)),P(6,o.ICommandService)],Z);var se=Object.defineProperty,je=Object.getOwnPropertyDescriptor,we=(e,t,r)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ae=(e,t,r,n)=>{for(var i=n>1?void 0:n?je(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&se(t,r,i),i},z=(e,t)=>(r,n)=>t(r,n,e),de=(e,t,r)=>we(e,typeof t!="symbol"?t+"":t,r);u.UniverDocsThreadCommentUIPlugin=class extends o.Plugin{constructor(t=X,r,n,i){super(),this._config=t,this._injector=r,this._renderManagerSrv=n,this._configService=i;const{menu:s,...d}=o.merge({},X,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(ce,d)}onStarting(){[[H],[F],[U]].forEach(t=>{this._injector.add(t)})}onRendered(){this._initRenderModule(),this._injector.get(F),this._injector.get(H)}_initRenderModule(){[Z].forEach(t=>{this._renderManagerSrv.registerRenderModule(o.UniverInstanceType.UNIVER_DOC,t)})}},de(u.UniverDocsThreadCommentUIPlugin,"pluginName",ae),de(u.UniverDocsThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_DOC),u.UniverDocsThreadCommentUIPlugin=Ae([o.DependentOn(T.UniverThreadCommentUIPlugin),z(1,o.Inject(o.Injector)),z(2,g.IRenderManagerService),z(3,o.IConfigService)],u.UniverDocsThreadCommentUIPlugin),u.AddDocCommentComment=J,u.DeleteDocCommentComment=K,u.ShowCommentPanelOperation=V,u.StartAddCommentOperation=$,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
(function(c,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("@univerjs/thread-comment-ui"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","@univerjs/thread-comment-ui","@univerjs/docs","@univerjs/docs-ui","@univerjs/thread-comment","@univerjs/ui","rxjs","react/jsx-runtime","react"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverDocsThreadCommentUi={},c.UniverCore,c.UniverEngineRender,c.UniverThreadCommentUi,c.UniverDocs,c.UniverDocsUi,c.UniverThreadComment,c.UniverUi,c.rxjs,c.React,c.React))})(this,function(c,o,_,O,T,A,w,I,U,re,D){"use strict";var xe=Object.defineProperty;var Ee=(c,o,_)=>o in c?xe(c,o,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[o]=_;var J=(c,o,_)=>Ee(c,typeof o!="symbol"?o+"":o,_);const oe="DOC_THREAD_COMMENT_UI_PLUGIN",M="default_doc",se="docs-thread-comment-ui.config",Y={};var de=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,ce=(e,t,i,n)=>{for(var r=n>1?void 0:n?ae(t,i):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(r=(n?d(t,i,r):d(r))||r);return n&&r&&de(t,i,r),r},Q=(e,t)=>(i,n)=>t(i,n,e);let P=class extends o.Disposable{constructor(t,i){super();J(this,"_addingComment$",new U.BehaviorSubject(void 0));J(this,"addingComment$",this._addingComment$.asObservable());this._sidebarService=t,this._threadCommentPanelService=i,this.disposeWithMe(()=>{this._addingComment$.complete()})}get addingComment(){return this._addingComment$.getValue()}startAdd(t){this._addingComment$.next(t)}endAdd(){this._addingComment$.next(void 0)}};P=ce([Q(0,I.ISidebarService),Q(1,o.Inject(O.ThreadCommentPanelService))],P);const H={id:"docs.command.add-comment",type:o.CommandType.COMMAND,async handler(e,t){if(!t)return!1;const{comment:i,unitId:n}=t,s=await e.get(w.IThreadCommentDataSourceService).addComment(i),d=e.get(o.ICommandService),a=A.addCustomDecorationBySelectionFactory(e,{id:s.threadId,type:o.CustomDecorationType.COMMENT,unitId:n});if(a){const f={id:w.AddCommentMutation.id,params:{unitId:n,subUnitId:M,comment:s}},C={id:O.SetActiveCommentOperation.id,params:{unitId:n,subUnitId:M,commentId:s.id}};return(await o.sequenceExecute([f,a,C],d)).result}return!1}},L={id:"docs.command.delete-comment",type:o.CommandType.COMMAND,async handler(e,t){if(!t)return!1;const{commentId:i,unitId:n}=t,r=e.get(o.ICommandService),s=A.deleteCustomDecorationFactory(e,{id:i,unitId:n});return s?(await o.sequenceExecute([s],r)).result:!1}},X=e=>{const t=e.get(_.IRenderManagerService),i=e.get(T.DocSelectionManagerService),n=t.getCurrent(),r=n==null?void 0:n.with(T.DocSkeletonManagerService).getSkeleton(),s=r==null?void 0:r.getViewModel().getEditArea();if(s===_.DocumentEditArea.FOOTER||s===_.DocumentEditArea.HEADER)return!0;const d=i.getActiveTextRange();return!!(d==null||d.collapsed)};function me(e){return{id:V.id,type:I.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:I.getMenuHiddenObservable(e,o.UniverInstanceType.UNIVER_DOC,void 0,o.SHEET_EDITOR_UNITS),disabled$:new U.Observable(function(t){const n=e.get(T.DocSelectionManagerService).textSelection$.pipe(U.debounceTime(16)).subscribe(()=>{t.next(X(e))});return()=>{n.unsubscribe()}})}}function ue(e){return{id:W.id,type:I.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:I.getMenuHiddenObservable(e,o.UniverInstanceType.UNIVER_DOC)}}const R=()=>{const e=o.useDependency(o.IUniverInstanceService),t=o.useDependency(o.Injector),i=D.useMemo(()=>e.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_DOC).pipe(U.filter(m=>!!m&&!o.isInternalEditorID(m.getUnitId()))),[e]),n=o.useObservable(i),r=D.useMemo(()=>new U.Observable(m=>m.next(M)),[]),s=o.useDependency(T.DocSelectionManagerService),d=D.useMemo(()=>s.textSelection$.pipe(U.debounceTime(16)),[s.textSelection$]);o.useObservable(d);const a=o.useDependency(o.ICommandService),f=o.useDependency(P),C=o.useObservable(f.addingComment$),[u,h]=D.useState([]);if(D.useEffect(()=>{var j;const m=new Set,l=n==null?void 0:n.getCustomDecorations();h((j=l==null?void 0:l.map(v=>v.id).filter(v=>{const y=m.has(v);return m.add(v),!y}))!=null?j:[]);const b=a.onCommandExecuted(v=>{var y;if(v.id===T.RichTextEditingMutation.id){const $=new Set,z=n==null?void 0:n.getCustomDecorations();h((y=z==null?void 0:z.map(F=>F.id).filter(F=>{const Re=$.has(F);return $.add(F),!Re}))!=null?y:[])}});return()=>{b.dispose()}},[a,n]),!n)return null;const g=X(t),p=n.getUnitId();return re.jsx(O.ThreadCommentPanel,{unitId:p,subUnitId$:r,type:o.UniverInstanceType.UNIVER_DOC,onAdd:()=>{a.executeCommand(V.id)},getSubUnitName:()=>"",disableAdd:g,tempComment:C,onAddComment:m=>{if(!m.parentId){const l={unitId:p,range:C,comment:m};return a.executeCommand(H.id,l),f.endAdd(),!1}return!0},onDeleteComment:m=>{if(!m.parentId){const l={unitId:p,commentId:m.id};return a.executeCommand(L.id,l),!1}return!0},showComments:u})};R.componentKey="univer.doc.thread-comment-panel";const N={id:"docs.operation.show-comment-panel",type:o.CommandType.OPERATION,handler(e,t){var r;const i=e.get(O.ThreadCommentPanelService),n=e.get(I.ISidebarService);return(!i.panelVisible||((r=n.options.children)==null?void 0:r.label)!==R.componentKey)&&(n.open({header:{title:"threadCommentUI.panel.title"},children:{label:R.componentKey},width:320,onClose:()=>i.setPanelVisible(!1)}),i.setPanelVisible(!0)),t&&i.setActiveComment(t==null?void 0:t.activeComment),!0}},W={id:"docs.operation.toggle-comment-panel",type:o.CommandType.OPERATION,handler(e){var n;const t=e.get(O.ThreadCommentPanelService),i=e.get(I.ISidebarService);return!t.panelVisible||((n=i.options.children)==null?void 0:n.label)!==R.componentKey?(i.open({header:{title:"threadCommentUI.panel.title"},children:{label:R.componentKey},width:320,onClose:()=>t.setPanelVisible(!1)}),t.setPanelVisible(!0)):(i.close(),t.setPanelVisible(!1),t.setActiveComment(null)),!0}},V={id:"docs.operation.start-add-comment",type:o.CommandType.OPERATION,handler(e){var v,y,$;const t=e.get(O.ThreadCommentPanelService),n=e.get(o.IUniverInstanceService).getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC),r=e.get(T.DocSelectionManagerService),s=e.get(_.IRenderManagerService),d=e.get(o.UserManagerService),a=e.get(P),f=e.get(o.ICommandService),C=e.get(I.ISidebarService),u=r.getActiveTextRange();if(!n||!u)return!1;const h=(v=s.getRenderById(n.getUnitId()))==null?void 0:v.with(A.DocSelectionRenderService);if(h==null||h.setReserveRangesStatus(!0),u.collapsed)return t.panelVisible?(t.setPanelVisible(!1),C.close()):f.executeCommand(N.id),!0;f.executeCommand(N.id);const g=n.getUnitId(),p=(($=(y=n.getBody())==null?void 0:y.dataStream)!=null?$:"").slice(u.startOffset,u.endOffset),m=o.BuildTextUtils.transform.getPlainText(p),l=M,b="",j={unitId:g,subUnitId:l,id:b,ref:m,dT:w.getDT(),personId:d.getCurrentUser().userID,text:{dataStream:`\r
|
|
10
|
+
`},startOffset:u.startOffset,endOffset:u.endOffset,collapsed:!0,threadId:b};return h==null||h.blur(),a.startAdd(j),t.setActiveComment({unitId:g,subUnitId:l,commentId:b}),!0}};var le=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,ve=(e,t,i,n)=>{for(var r=n>1?void 0:n?fe(t,i):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(r=(n?d(t,i,r):d(r))||r);return n&&r&&le(t,i,r),r},x=(e,t)=>(i,n)=>t(i,n,e);let B=class extends o.Disposable{constructor(e,t,i,n,r,s){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=i,this._docThreadCommentService=n,this._renderManagerService=r,this._threadCommentModel=s,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var i,n,r,s;if(t.id===T.SetTextSelectionsOperation.id){const d=t.params,{unitId:a,ranges:f}=d;if(o.isInternalEditorID(a))return;const C=this._univerInstanceService.getUnit(a,o.UniverInstanceType.UNIVER_DOC),u=f[0];if((e==null?void 0:e.startOffset)===(u==null?void 0:u.startOffset)&&(e==null?void 0:e.endOffset)===(u==null?void 0:u.endOffset))return;if(e=u,u&&C){const{startOffset:h,endOffset:g,collapsed:p}=u;let m;if(p?m=(n=(i=C.getBody())==null?void 0:i.customDecorations)==null?void 0:n.find(l=>l.startIndex<=h&&l.endIndex>=g-1):m=(s=(r=C.getBody())==null?void 0:r.customDecorations)==null?void 0:s.find(l=>l.startIndex<=h&&l.endIndex>=g-1),m){const l=this._threadCommentModel.getComment(a,M,m.id);l&&!l.resolved&&this._commandService.executeCommand(N.id,{activeComment:{unitId:a,subUnitId:M,commentId:m.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;this._commandService.executeCommand(O.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var t,i,n,r;if(e){const s=this._univerInstanceService.getUnit(e.unitId);if(s){const d=(t=this._renderManagerService.getRenderById(e.unitId))==null?void 0:t.with(A.DocBackScrollRenderController),a=(n=(i=s.getBody())==null?void 0:i.customDecorations)==null?void 0:n.find(f=>f.id===e.commentId);a&&d&&d.scrollToRange({startOffset:a.startIndex,endOffset:a.endIndex,collapsed:!1})}}(!e||e.commentId!==((r=this._docThreadCommentService.addingComment)==null?void 0:r.id))&&this._docThreadCommentService.endAdd()}))}};B=ve([x(0,o.Inject(O.ThreadCommentPanelService)),x(1,o.IUniverInstanceService),x(2,o.ICommandService),x(3,o.Inject(P)),x(4,_.IRenderManagerService),x(5,o.Inject(w.ThreadCommentModel))],B);var S=function(){return S=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},S.apply(this,arguments)},Ce=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]]);return i},k=D.forwardRef(function(e,t){var i=e.icon,n=e.id,r=e.className,s=e.extend,d=Ce(e,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),f=D.useRef("_".concat(pe()));return ee(i,"".concat(n),{defIds:i.defIds,idSuffix:f.current},S({ref:t,className:a},d),s)});function ee(e,t,i,n,r){return D.createElement(e.tag,S(S({key:t},he(e,i,r)),n),(Ie(e,i).children||[]).map(function(s,d){return ee(s,"".concat(t,"-").concat(e.tag,"-").concat(d),i,void 0,r)}))}function he(e,t,i){var n=S({},e.attrs);i!=null&&i.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=i.colorChannel1);var r=t.defIds;return!r||r.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(s){var d=s[0],a=s[1];typeof a=="string"&&(n[d]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Ie(e,t){var i,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((i=e.children)===null||i===void 0)&&i.length)?S(S({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?S(S({},r),{attrs:S(S({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function pe(){return Math.random().toString(36).substring(2,8)}k.displayName="UniverIcon";var Se={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},te=D.forwardRef(function(e,t){return D.createElement(k,Object.assign({},e,{id:"comment-single",ref:t,icon:Se}))});te.displayName="CommentSingle";const ge={[I.RibbonStartGroup.OTHERS]:{[W.id]:{order:1,menuItemFactory:ue}},[I.ContextMenuPosition.MAIN_AREA]:{[I.ContextMenuGroup.DATA]:{[V.id]:{order:1,menuItemFactory:me}}}};var _e=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,Te=(e,t,i,n)=>{for(var r=n>1?void 0:n?Oe(t,i):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(r=(n?d(t,i,r):d(r))||r);return n&&r&&_e(t,i,r),r},K=(e,t)=>(i,n)=>t(i,n,e);let q=class extends o.Disposable{constructor(e,t,i){super(),this._commandService=e,this._menuManagerService=t,this._componentManager=i,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[H,L,N,V,W].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(ge)}_initComponents(){[R].forEach(e=>{this.disposeWithMe(this._componentManager.register(e.componentKey,e))}),this.disposeWithMe(this._componentManager.register("CommentSingle",te))}};q=Te([K(0,o.ICommandService),K(1,I.IMenuManagerService),K(2,o.Inject(I.ComponentManager))],q);var De=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,be=(e,t,i,n)=>{for(var r=n>1?void 0:n?Me(t,i):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(r=(n?d(t,i,r):d(r))||r);return n&&r&&De(t,i,r),r},E=(e,t)=>(i,n)=>t(i,n,e);let G=class extends o.Disposable{constructor(e,t,i,n,r,s,d){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=i,this._docRenderController=n,this._univerInstanceService=r,this._threadCommentModel=s,this._commandService=d,this._interceptorViewModel(),this._initReRender(),this._initSyncComments()}_initReRender(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var i;if(e){this._docRenderController.reRender(e.unitId);return}const t=(i=this._univerInstanceService.getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC))==null?void 0:i.getUnitId();t&&this._docRenderController.reRender(t)})),this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{e.type==="resolve"&&this._docRenderController.reRender(e.unitId)}))}_interceptorViewModel(){this._docInterceptorService.intercept(T.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,i)=>{if(!e)return i(e);const{unitId:n,index:r,customDecorations:s}=t,d=this._threadCommentPanelService.activeCommentId,{commentId:a,unitId:f}=d||{},C=s.find(p=>p.id===a),u=this._threadCommentModel.getComment(n,M,e.id);if(!u)return i({...e,show:!1});const h=C&&r>=C.startIndex&&r<=C.endIndex,g=f===n&&e.id===a;return i({...e,active:g||h,show:!u.resolved})}})}_initSyncComments(){var r,s,d;const e=this._context.unit.getUnitId(),t=M,i=(d=(s=(r=this._context.unit.getBody())==null?void 0:r.customDecorations)==null?void 0:s.filter(a=>a.type===o.CustomDecorationType.COMMENT).map(a=>a.id))!=null?d:[];i.forEach(a=>{this._threadCommentModel.getComment(e,t,a)||this._threadCommentModel.addComment(e,t,{id:a,threadId:a,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),i.length&&this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(),M,i);let n=i.sort();this.disposeWithMe(this._commandService.onCommandExecuted(a=>{var f,C,u;if(a.id===T.RichTextEditingMutation.id){if(a.params.unitId!==this._context.unit.getUnitId())return;const g=(u=(C=(f=this._context.unit.getBody())==null?void 0:f.customDecorations)==null?void 0:C.filter(m=>m.type===o.CustomDecorationType.COMMENT).map(m=>m.id))!=null?u:[],p=g.sort();if(JSON.stringify(n)!==JSON.stringify(p)){const m=new Set(n),l=new Set(p),b=new Set,j=new Set;g.forEach(v=>{m.has(v)||b.add(v)}),n.forEach(v=>{l.has(v)||j.add(v)}),n=p,b.forEach(v=>{this._threadCommentModel.getComment(e,t,v)||this._threadCommentModel.addComment(e,t,{id:v,threadId:v,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),this._threadCommentModel.syncThreadComments(e,t,[...b])}}}))}};G=be([E(1,o.Inject(T.DocInterceptorService)),E(2,o.Inject(O.ThreadCommentPanelService)),E(3,o.Inject(A.DocRenderController)),E(4,o.IUniverInstanceService),E(5,o.Inject(w.ThreadCommentModel)),E(6,o.ICommandService)],G);var ne=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,Ue=(e,t,i)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Pe=(e,t,i,n)=>{for(var r=n>1?void 0:n?ye(t,i):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(r=(n?d(t,i,r):d(r))||r);return n&&r&&ne(t,i,r),r},Z=(e,t)=>(i,n)=>t(i,n,e),ie=(e,t,i)=>Ue(e,typeof t!="symbol"?t+"":t,i);c.UniverDocsThreadCommentUIPlugin=class extends o.Plugin{constructor(t=Y,i,n,r){super(),this._config=t,this._injector=i,this._renderManagerSrv=n,this._configService=r;const{menu:s,...d}=o.merge({},Y,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(se,d)}onStarting(){[[q],[B],[P]].forEach(t=>{this._injector.add(t)})}onRendered(){this._initRenderModule(),this._injector.get(B),this._injector.get(q)}_initRenderModule(){[G].forEach(t=>{this._renderManagerSrv.registerRenderModule(o.UniverInstanceType.UNIVER_DOC,t)})}},ie(c.UniverDocsThreadCommentUIPlugin,"pluginName",oe),ie(c.UniverDocsThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_DOC),c.UniverDocsThreadCommentUIPlugin=Pe([o.DependentOn(O.UniverThreadCommentUIPlugin),Z(1,o.Inject(o.Injector)),Z(2,_.IRenderManagerService),Z(3,o.IConfigService)],c.UniverDocsThreadCommentUIPlugin),c.AddDocCommentComment=H,c.DeleteDocCommentComment=L,c.ShowCommentPanelOperation=N,c.StartAddCommentOperation=V,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
26
11
|
|
|
27
12
|
|
|
28
13
|
// index
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/preset-docs-thread-comment",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
"rxjs": ">=7.0.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@univerjs/docs-thread-comment-ui": "0.
|
|
61
|
-
"@univerjs/thread-comment-ui": "0.
|
|
60
|
+
"@univerjs/docs-thread-comment-ui": "0.6.0-alpha.0",
|
|
61
|
+
"@univerjs/thread-comment-ui": "0.6.0-alpha.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@univerjs/core": "0.
|
|
64
|
+
"@univerjs/core": "0.6.0-alpha.0",
|
|
65
65
|
"typescript": "^5.7.2",
|
|
66
|
-
"@univerjs-infra/shared": "0.
|
|
66
|
+
"@univerjs-infra/shared": "0.6.0-alpha.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"prebuild:preset": "tsx prepare.ts",
|