@univerjs/thread-comment-ui 0.5.1 → 0.5.2-nightly.202412291605
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +4 -4
- package/lib/es/index.js +166 -162
- package/lib/index.css +1 -1
- package/lib/umd/index.js +4 -4
- package/package.json +12 -12
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Oe=Object.defineProperty;var Re=(n,e,t)=>e in n?Oe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var W=(n,e,t)=>Re(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),H=require("@univerjs/thread-comment"),V=require("@univerjs/ui"),se=require("rxjs"),m=require("react"),E=require("@univerjs/design"),Me=require("@univerjs/docs"),we=require("@univerjs/docs-ui"),De=require("@univerjs/engine-render");var $e=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,d;s>=0;s--)(d=n[s])&&(i=(r?d(e,t,i):d(i))||i);return r&&i&&$e(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);exports.ThreadCommentPanelService=class extends a.Disposable{constructor(t,r){super();W(this,"_panelVisible",!1);W(this,"_panelVisible$",new se.BehaviorSubject(!1));W(this,"_activeCommentId");W(this,"_activeCommentId$",new se.BehaviorSubject(void 0));W(this,"panelVisible$",this._panelVisible$.asObservable());W(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$(a.UniverInstanceType.UNIVER_SHEET).pipe(se.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}};exports.ThreadCommentPanelService=Ae([ce(0,a.Inject(V.ISidebarService)),ce(1,a.IUniverInstanceService)],exports.ThreadCommentPanelService);const ve="thread-comment-panel",Le="UNIVER_THREAD_COMMENT_UI_PLUGIN",Ce={id:"thread-comment-ui.operation.toggle-panel",type:a.CommandType.OPERATION,handler(n){const e=n.get(V.ISidebarService),t=n.get(exports.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:ve},width:330}),t.setPanelVisible(!0)),!0}},B={id:"thread-comment-ui.operation.set-active-comment",type:a.CommandType.OPERATION,handler(n,e){return n.get(exports.ThreadCommentPanelService).setActiveComment(e),!0}},ke="thread-comment-ui.config",me={};var fe=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,Be=(n,e,t)=>e in n?fe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,qe=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ve(e,t):e,s=n.length-1,d;s>=0;s--)(d=n[s])&&(i=(r?d(e,t,i):d(i))||i);return r&&i&&fe(e,t,i),i},le=(n,e)=>(t,r)=>e(t,r,n),pe=(n,e,t)=>Be(n,typeof e!="symbol"?e+"":e,t);exports.UniverThreadCommentUIPlugin=class extends a.Plugin{constructor(e=me,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:s,...d}=a.merge({},me,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(ke,d)}onStarting(){var e;a.mergeOverrideWithDependencies([[exports.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[Ce,B].forEach(t=>{this._commandService.registerCommand(t)})}};pe(exports.UniverThreadCommentUIPlugin,"pluginName",Le);pe(exports.UniverThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_UNKNOWN);exports.UniverThreadCommentUIPlugin=qe([a.DependentOn(H.UniverThreadCommentPlugin),le(1,a.Inject(a.Injector)),le(2,a.ICommandService),le(3,a.IConfigService)],exports.UniverThreadCommentUIPlugin);var de={exports:{}},ee={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
10
|
-
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},dt=(n,e,t,r,i)=>{var d,v;const s=(d=n.raw)==null?void 0:d.icon;return o.jsxs("div",{className:ae.threadCommentEditorSuggestion,children:[s?o.jsx("img",{className:ae.threadCommentEditorSuggestionIcon,src:s}):null,o.jsx("div",{children:(v=n.display)!=null?v:n.id})]})},
|
|
11
|
-
\r`},personId:(re=O==null?void 0:O.userID)!=null?re:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(Y=c==null?void 0:c.children)!=null?Y:[]],q=m.useRef(null),L=N=>{N.stopPropagation(),D?w.executeCommand(B.id,{unitId:t,subUnitId:r,commentId:e}):w.executeCommand(B.id),w.executeCommand(H.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!D}),M==null||M(!D)},K=N=>{N.stopPropagation(),w.executeCommand(B.id),!(c!=null&&c.root&&(S==null?void 0:S(c.root))===!1)&&(w.executeCommand(H.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),u==null||u())};m.useEffect(()=>y==null?void 0:y(),[]);const k=T((Q=c==null?void 0:c.root.subUnitId)!=null?Q:r),ne=s&&!A&&!D,Z=`${i||(c==null?void 0:c.root.ref)||""}${k?" · ":""}${k}`;return o.jsxs("div",{className:nt(I.threadComment,{[I.threadCommentActive]:!D&&(v||U||C==="cell")}),onClick:d,id:`${C}-${t}-${r}-${e}`,onMouseEnter:()=>{p==null||p(),x(!0)},onMouseLeave:()=>{y==null||y(),x(!1)},children:[!D&&v?o.jsx("div",{className:I.threadCommentHighlight}):null,o.jsxs("div",{className:I.threadCommentTitle,children:[o.jsxs("div",{className:I.threadCommentTitlePosition,children:[o.jsx("div",{className:I.threadCommentTitleHighlight}),o.jsx(E.Tooltip,{showIfEllipsis:!0,title:Z,children:o.jsx("div",{className:I.threadCommentTitlePositionText,children:Z})})]}),c?o.jsxs("div",{className:I.threadCommentIconContainer,children:[o.jsx("div",{onClick:L,className:I.threadCommentIcon,style:{color:D?"rgb(var(--green-500))":""},children:D?o.jsx(
|
|
9
|
+
*/var ue;function Fe(){if(ue)return ee;ue=1;var n=m,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 d(v,u,T){var C,f={},p=null,y=null;T!==void 0&&(p=""+T),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(y=u.ref);for(C in u)r.call(u,C)&&!s.hasOwnProperty(C)&&(f[C]=u[C]);if(v&&v.defaultProps)for(C in u=v.defaultProps,u)f[C]===void 0&&(f[C]=u[C]);return{$$typeof:e,type:v,key:p,ref:y,props:f,_owner:i.current}}return ee.Fragment=t,ee.jsx=d,ee.jsxs=d,ee}var he;function We(){return he||(he=1,de.exports=Fe()),de.exports}var o=We(),R=function(){return R=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},R.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=m.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,s=n.extend,d=ze(n,["icon","id","className","extend"]),v="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),u=m.useRef("_".concat(Ge()));return ge(t,"".concat(r),{defIds:t.defIds,idSuffix:u.current},R({ref:e,className:v},d),s)});function ge(n,e,t,r,i){return m.createElement(n.tag,R(R({key:e},Ze(n,t,i)),r),(Je(n,t).children||[]).map(function(s,d){return ge(s,"".concat(e,"-").concat(n.tag,"-").concat(d),t,void 0,i)}))}function Ze(n,e,t){var r=R({},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 d=s[0],v=s[1];typeof v=="string"&&(r[d]=v.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Je(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)?R(R({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?R(R({},i),{attrs:R(R({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function Ge(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var Ke={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"}}]},Ie=m.forwardRef(function(n,e){return m.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:Ke}))});Ie.displayName="DeleteSingle";var Ye={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"}}]},xe=m.forwardRef(function(n,e){return m.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:Ye}))});xe.displayName="IncreaseSingle";var Qe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},Se=m.forwardRef(function(n,e){return m.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Qe}))});Se.displayName="MoreHorizontalSingle";var Xe={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=m.forwardRef(function(n,e){return m.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:Xe}))});be.displayName="ReplyToCommentSingle";var et={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"}}]},ye=m.forwardRef(function(n,e){return m.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:et}))});ye.displayName="ResolvedSingle";var tt={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=m.forwardRef(function(n,e){return m.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:tt}))});_e.displayName="SolveSingle";function Te(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=Te(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function nt(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Te(n))&&(r&&(r+=" "),r+=e);return r}const rt="univer-thread-comment-editor-buttons",it="univer-thread-comment-editor-suggestion",ot="univer-thread-comment-editor-suggestionActive",st="univer-thread-comment-editor-suggestion-icon",ae={threadCommentEditorButtons:rt,threadCommentEditorSuggestion:it,threadCommentEditorSuggestionActive:ot,threadCommentEditorSuggestionIcon:st},at=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},lt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),je=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let s=0;return t==null||t.forEach(d=>{s<d.startIndex&&i.push({type:"text",content:e.slice(s,d.startIndex)}),i.push({type:"mention",content:{label:e.slice(d.startIndex,d.endIndex).slice(1,-1),id:d.rangeId}}),s=d.endIndex}),i.push({type:"text",content:e.slice(s,r)}),i},Ue=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:a.CustomRangeType.MENTION,startIndex:i,endIndex:s,properties:{}});break}}}),e+=`
|
|
10
|
+
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},dt=(n,e,t,r,i)=>{var d,v;const s=(d=n.raw)==null?void 0:d.icon;return o.jsxs("div",{className:ae.threadCommentEditorSuggestion,children:[s?o.jsx("img",{className:ae.threadCommentEditorSuggestionIcon,src:s}):null,o.jsx("div",{children:(v=n.display)!=null?v:n.id})]})},Ne=m.forwardRef((n,e)=>{var A;const{comment:t,onSave:r,id:i,onCancel:s,autoFocus:d,unitId:v}=n,u=a.useDependency(a.IMentionIOService),T=a.useDependency(a.ICommandService),C=a.useDependency(a.LocaleService),[f,p]=m.useState({...t}),[y,g]=m.useState(!1),S=m.useRef(null),M=a.useDependency(Me.DocSelectionManagerService),U=(A=a.useDependency(De.IRenderManagerService).getCurrentTypeOfRenderer(a.UniverInstanceType.UNIVER_DOC))==null?void 0:A.with(we.DocSelectionRenderService);m.useImperativeHandle(e,()=>({reply(h){var b;p({...t,text:h,attachments:[]}),(b=S.current)==null||b.inputElement.focus()}}));const x=()=>{var h;f.text&&(r==null||r({...f,text:f.text}),g(!1),p({text:void 0}),(h=S.current)==null||h.inputElement.blur())};return o.jsxs("div",{className:ae.threadCommentEditor,onClick:h=>h.preventDefault(),children:[o.jsx(E.Mentions,{ref:S,autoFocus:d,style:{width:"100%"},placeholder:C.t("threadCommentUI.editor.placeholder"),value:f!=null&&f.text?lt(je(f.text)):"",onChange:h=>{h.target.value||p({...t,text:void 0}),p==null||p({...t,text:Ue(at(h.target.value))})},onFocus:()=>{const h=M.getActiveTextRange();h&&h.collapsed&&(U==null||U.removeAllRanges()),U==null||U.blur(),g(!0)},children:o.jsx(E.Mention,{trigger:"@",data:(h,b)=>u.list({search:h,unitId:v}).then(c=>c.list.map(w=>w.mentions.map(_=>({id:_.objectId,display:_.label,raw:_}))).flat()).then(b),displayTransform:(h,b)=>`@${b} `,renderSuggestion:dt},"@")}),y?o.jsxs("div",{className:ae.threadCommentEditorButtons,children:[o.jsx(E.Button,{style:{marginRight:12},onClick:()=>{s==null||s(),g(!1),p({text:void 0}),T.executeCommand(B.id)},children:C.t("threadCommentUI.editor.cancel")}),o.jsx(E.Button,{type:"primary",disabled:!f.text,onClick:x,children:C.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),ct="univer-thread-comment",mt="univer-thread-comment-active",ut="univer-thread-comment-content",ht="univer-thread-comment-highlight",vt="univer-thread-comment-icon-container",Ct="univer-thread-comment-icon",ft="univer-thread-comment-title",pt="univer-thread-comment-title-position",gt="univer-thread-comment-title-highlight",It="univer-thread-comment-title-position-text",xt="univer-thread-comment-username",St="univer-thread-comment-item",bt="univer-thread-comment-item-head",yt="univer-thread-comment-item-title",_t="univer-thread-comment-item-title-position",Tt="univer-thread-comment-item-title-highlight",jt="univer-thread-comment-item-time",Ut="univer-thread-comment-item-content",Nt="univer-thread-comment-item-at",I={threadComment:ct,threadCommentActive:mt,threadCommentContent:ut,threadCommentHighlight:ht,threadCommentIconContainer:vt,threadCommentIcon:Ct,threadCommentTitle:ft,threadCommentTitlePosition:pt,threadCommentTitleHighlight:gt,threadCommentTitlePositionText:It,threadCommentUsername:xt,threadCommentItem:St,threadCommentItemHead:bt,threadCommentItemTitle:yt,threadCommentItemTitlePosition:_t,threadCommentItemTitleHighlight:Tt,threadCommentItemTime:jt,threadCommentItemContent:Ut,threadCommentItemAt:Nt},Pe="__mock__",Pt=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:s,onReply:d,resolved:v,isRoot:u,onClose:T,onDeleteComment:C}=n,f=a.useDependency(a.ICommandService),p=a.useDependency(a.LocaleService),y=a.useDependency(a.UserManagerService),g=y.getUser(e.personId),S=V.useObservable(y.currentUser$),M=(S==null?void 0:S.userID)===e.personId,j=e.id===Pe,[U,x]=m.useState(!1),A=()=>{(C==null?void 0:C(e))!==!1&&(f.executeCommand(u?H.DeleteCommentTreeCommand.id:H.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),u&&(T==null||T()))};return o.jsxs("div",{className:I.threadCommentItem,onMouseLeave:()=>x(!1),onMouseEnter:()=>x(!0),children:[o.jsx("img",{className:I.threadCommentItemHead,src:g==null?void 0:g.avatar}),o.jsxs("div",{className:I.threadCommentItemTitle,children:[o.jsx("div",{className:I.threadCommentUsername,children:(g==null?void 0:g.name)||" "}),o.jsxs("div",{children:[j||v?null:U?o.jsx("div",{className:I.threadCommentIcon,onClick:()=>d(g),children:o.jsx(be,{})}):null,M&&!j&&!v?o.jsx(E.DropdownLegacy,{overlay:o.jsxs(E.Menu,{children:[o.jsx(E.MenuItem,{onClick:()=>s==null?void 0:s(!0),children:p.t("threadCommentUI.item.edit")},"edit"),o.jsx(E.MenuItem,{onClick:A,children:p.t("threadCommentUI.item.delete")},"delete")]}),children:o.jsx("div",{className:I.threadCommentIcon,children:o.jsx(Se,{})})}):null]})]}),o.jsx("div",{className:I.threadCommentItemTime,children:e.dT}),i?o.jsx(Ne,{id:e.id,comment:e,onCancel:()=>s==null?void 0:s(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:h,attachments:b})=>{s==null||s(!1),f.executeCommand(H.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:h,attachments:b}})}}):o.jsx("div",{className:I.threadCommentItemContent,children:je(e.text).map((h,b)=>{switch(h.type){case"mention":return o.jsxs("a",{className:I.threadCommentItemAt,children:["@",h.content.label," "]},b);default:return h.content}})})]})},Ee=n=>{var re,Y,Q;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:s=!0,onClick:d,showHighlight:v,onClose:u,getSubUnitName:T,prefix:C,autoFocus:f,onMouseEnter:p,onMouseLeave:y,onAddComment:g,onDeleteComment:S,onResolve:M}=n,j=a.useDependency(H.ThreadCommentModel),[U,x]=m.useState(!1),[A,h]=m.useState(""),b=m.useMemo(()=>j.commentUpdate$.pipe(se.debounceTime(16)),[j]);V.useObservable(b);const c=e?j.getCommentWithChildren(t,r,e):null,w=a.useDependency(a.ICommandService),_=a.useDependency(a.UserManagerService),D=c==null?void 0:c.root.resolved,O=V.useObservable(_.currentUser$),J=m.useRef(null),G=[...c?[c.root]:[{id:Pe,text:{dataStream:`
|
|
11
|
+
\r`},personId:(re=O==null?void 0:O.userID)!=null?re:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(Y=c==null?void 0:c.children)!=null?Y:[]],q=m.useRef(null),L=N=>{N.stopPropagation(),D?w.executeCommand(B.id,{unitId:t,subUnitId:r,commentId:e}):w.executeCommand(B.id),w.executeCommand(H.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!D}),M==null||M(!D)},K=N=>{N.stopPropagation(),w.executeCommand(B.id),!(c!=null&&c.root&&(S==null?void 0:S(c.root))===!1)&&(w.executeCommand(H.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),u==null||u())};m.useEffect(()=>y==null?void 0:y(),[]);const k=T((Q=c==null?void 0:c.root.subUnitId)!=null?Q:r),ne=s&&!A&&!D,Z=`${i||(c==null?void 0:c.root.ref)||""}${k?" · ":""}${k}`;return o.jsxs("div",{className:nt(I.threadComment,{[I.threadCommentActive]:!D&&(v||U||C==="cell")}),onClick:d,id:`${C}-${t}-${r}-${e}`,onMouseEnter:()=>{p==null||p(),x(!0)},onMouseLeave:()=>{y==null||y(),x(!1)},children:[!D&&v?o.jsx("div",{className:I.threadCommentHighlight}):null,o.jsxs("div",{className:I.threadCommentTitle,children:[o.jsxs("div",{className:I.threadCommentTitlePosition,children:[o.jsx("div",{className:I.threadCommentTitleHighlight}),o.jsx(E.Tooltip,{showIfEllipsis:!0,title:Z,children:o.jsx("div",{className:I.threadCommentTitlePositionText,children:Z})})]}),c?o.jsxs("div",{className:I.threadCommentIconContainer,children:[o.jsx("div",{onClick:L,className:I.threadCommentIcon,style:{color:D?"rgb(var(--green-500))":""},children:D?o.jsx(ye,{}):o.jsx(_e,{})}),(O==null?void 0:O.userID)===c.root.personId?o.jsx("div",{className:I.threadCommentIcon,onClick:K,children:o.jsx(Ie,{})}):null]}):null]}),o.jsx("div",{className:I.threadCommentContent,ref:q,children:G.map(N=>o.jsx(Pt,{onClose:u,unitId:t,subUnitId:r,item:N,isRoot:N.id===(c==null?void 0:c.root.id),editing:A===N.id,resolved:c==null?void 0:c.root.resolved,onEditingChange:$=>{h($?N.id:"")},onReply:$=>{$&&requestAnimationFrame(()=>{var l;(l=J.current)==null||l.reply(Ue([{type:"mention",content:{id:$.userID,label:$.name}}]))})},onAddComment:g,onDeleteComment:S},N.id))}),ne?o.jsx("div",{children:o.jsx(Ne,{ref:J,unitId:t,subUnitId:r,onSave:async({text:N,attachments:$})=>{const l={text:N,attachments:$,dT:H.getDT(),id:a.generateRandomId(),ref:i,personId:O==null?void 0:O.userID,parentId:c==null?void 0:c.root.id,unitId:t,subUnitId:r,threadId:c==null?void 0:c.root.threadId};(g==null?void 0:g(l))!==!1&&(await w.executeCommand(H.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:l}),q.current&&(q.current.scrollTop=q.current.scrollHeight))},autoFocus:f||!c,onCancel:()=>{c||u==null||u()}},`${f}`)}):null]})},Et="univer-thread-comment-panel",Ot="univer-thread-comment",Rt="univer-thread-comment-panel-forms",Mt="univer-select",wt="univer-thread-comment-panel-empty",Dt="univer-thread-comment-panel-add",$t="univer-thread-comment-panel-solved",te={threadCommentPanel:Et,threadComment:Ot,threadCommentPanelForms:Rt,select:Mt,threadCommentPanelEmpty:wt,threadCommentPanelAdd:Dt,threadCommentPanelSolved:$t},Ht=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:s,onResolve:d,sortComments:v,onItemLeave:u,onItemEnter:T,disableAdd:C,tempComment:f,onAddComment:p,onDeleteComment:y,showComments:g}=n,[S,M]=m.useState("all"),[j,U]=m.useState("all"),x=a.useDependency(a.LocaleService),A=a.useDependency(a.UserManagerService),h=a.useDependency(H.ThreadCommentModel),[b,c]=m.useState(()=>h.getUnit(e)),w=a.useDependency(exports.ThreadCommentPanelService),_=V.useObservable(w.activeCommentId$),D=V.useObservable(h.commentUpdate$),O=a.useDependency(a.ICommandService),J=V.useObservable(t),G=m.useRef(!0),q="panel",L=V.useObservable(A.currentUser$),K=m.useMemo(()=>{var oe;const l=S==="all"?b:(oe=b.filter(P=>P.subUnitId===J))!=null?oe:[],X=v!=null?v:P=>P,ie=l.map(P=>{var F;return{...P.root,children:(F=P.children)!=null?F:[],users:P.relativeUsers}});if(g){const P=new Map;return ie.forEach(F=>{P.set(F.id,F)}),[...g,""].map(F=>P.get(F)).filter(Boolean)}else return X(ie)},[g,S,b,v,J]),k=m.useMemo(()=>[...K.filter(l=>!l.resolved),...K.filter(l=>l.resolved)],[K]),ne=m.useMemo(()=>j==="resolved"?k.filter(l=>l.resolved):j==="unsolved"?k.filter(l=>!l.resolved):j==="concern_me"&&L!=null&&L.userID?k.filter(l=>l==null?void 0:l.users.has(L.userID)):k,[k,L==null?void 0:L.userID,j]),Z=f?[f,...ne]:ne,re=Z.filter(l=>!l.resolved),Y=Z.filter(l=>l.resolved),Q=j!=="all"||S!=="all",N=()=>{U("all"),M("all")};m.useEffect(()=>{e&&c(h.getUnit(e))},[e,h,D]),m.useEffect(()=>{var P;if(!_)return;if(!G.current){G.current=!0;return}const{unitId:l,subUnitId:X,commentId:ie}=_,oe=`${q}-${l}-${X}-${ie}`;(P=document.getElementById(oe))==null||P.scrollIntoView({block:"center"})},[_]);const $=l=>o.jsx(Ee,{prefix:q,getSubUnitName:s,id:l.id,unitId:l.unitId,subUnitId:l.subUnitId,refStr:l.ref,type:r,showEdit:(_==null?void 0:_.commentId)===l.id,showHighlight:(_==null?void 0:_.commentId)===l.id,onClick:()=>{G.current=!1,l.resolved?O.executeCommand(B.id):O.executeCommand(B.id,{unitId:l.unitId,subUnitId:l.subUnitId,commentId:l.id,temp:!1})},onMouseEnter:()=>T==null?void 0:T(l),onMouseLeave:()=>u==null?void 0:u(l),onAddComment:p,onDeleteComment:y,onResolve:X=>d==null?void 0:d(l.id,X)},l.id);return o.jsxs("div",{className:te.threadCommentPanel,children:[o.jsxs("div",{className:te.threadCommentPanelForms,children:[r===a.UniverInstanceType.UNIVER_SHEET?o.jsx(E.Select,{borderless:!0,value:S,onChange:l=>M(l),options:[{value:"current",label:x.t("threadCommentUI.filter.sheet.current")},{value:"all",label:x.t("threadCommentUI.filter.sheet.all")}]}):null,o.jsx(E.Select,{borderless:!0,value:j,onChange:l=>U(l),options:[{value:"all",label:x.t("threadCommentUI.filter.status.all")},{value:"resolved",label:x.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:x.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:x.t("threadCommentUI.filter.status.concernMe")}]})]}),re.map($),Y.length?o.jsx("div",{className:te.threadCommentPanelSolved,children:"已解决"}):null,Y.map($),Z.length?null:o.jsxs("div",{className:te.threadCommentPanelEmpty,children:[Q?x.t("threadCommentUI.panel.filterEmpty"):x.t("threadCommentUI.panel.empty"),Q?o.jsx(E.Button,{onClick:N,type:"link",children:x.t("threadCommentUI.panel.reset")}):o.jsxs(E.Button,{id:"thread-comment-add",className:te.threadCommentPanelAdd,type:"primary",onClick:i,disabled:C,children:[o.jsx(xe,{}),x.t("threadCommentUI.panel.addComment")]})]})]})};exports.SetActiveCommentOperation=B;exports.THREAD_COMMENT_PANEL=ve;exports.ThreadCommentPanel=Ht;exports.ThreadCommentTree=Ee;exports.ToggleSheetCommentPanelOperation=Ce;
|
package/lib/es/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var B = (t, e, n) =>
|
|
4
|
-
import { Inject as
|
|
5
|
-
import { UniverThreadCommentPlugin as
|
|
6
|
-
import { ISidebarService as
|
|
7
|
-
import { BehaviorSubject as Ie, filter as
|
|
8
|
-
import
|
|
9
|
-
import { Mentions as
|
|
10
|
-
import { DocSelectionManagerService as
|
|
11
|
-
import { DocSelectionRenderService as
|
|
12
|
-
import { IRenderManagerService as
|
|
13
|
-
var
|
|
14
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
1
|
+
var ze = Object.defineProperty;
|
|
2
|
+
var qe = (t, e, n) => e in t ? ze(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var B = (t, e, n) => qe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { Inject as Ne, Disposable as Ze, UniverInstanceType as he, IUniverInstanceService as Je, CommandType as Te, DependentOn as Ge, Injector as Ke, Plugin as Ye, merge as Qe, mergeOverrideWithDependencies as Xe, ICommandService as ie, IConfigService as et, CustomRangeType as tt, useDependency as _, IMentionIOService as nt, LocaleService as pe, UserManagerService as ge, generateRandomId as rt } from "@univerjs/core";
|
|
5
|
+
import { UniverThreadCommentPlugin as it, ThreadCommentModel as Ee, getDT as ot, AddCommentCommand as st, UpdateCommentCommand as at, ResolveCommentCommand as lt, DeleteCommentTreeCommand as Oe, DeleteCommentCommand as dt } from "@univerjs/thread-comment";
|
|
6
|
+
import { ISidebarService as Ue, useObservable as F } from "@univerjs/ui";
|
|
7
|
+
import { BehaviorSubject as Ie, filter as mt, debounceTime as ct } from "rxjs";
|
|
8
|
+
import ut, { forwardRef as k, useRef as re, createElement as z, useState as A, useImperativeHandle as ht, useMemo as de, useEffect as fe } from "react";
|
|
9
|
+
import { Mentions as vt, Mention as Ct, Button as me, Tooltip as ft, DropdownLegacy as pt, Menu as gt, MenuItem as xe, Select as be } from "@univerjs/design";
|
|
10
|
+
import { DocSelectionManagerService as It } from "@univerjs/docs";
|
|
11
|
+
import { DocSelectionRenderService as xt } from "@univerjs/docs-ui";
|
|
12
|
+
import { IRenderManagerService as bt } from "@univerjs/engine-render";
|
|
13
|
+
var _t = Object.defineProperty, St = Object.getOwnPropertyDescriptor, yt = (t, e, n, r) => {
|
|
14
|
+
for (var i = r > 1 ? void 0 : r ? St(e, n) : e, s = t.length - 1, d; s >= 0; s--)
|
|
15
15
|
(d = t[s]) && (i = (r ? d(e, n, i) : d(i)) || i);
|
|
16
|
-
return r && i &&
|
|
16
|
+
return r && i && _t(e, n, i), i;
|
|
17
17
|
}, _e = (t, e) => (n, r) => e(n, r, t);
|
|
18
|
-
let J = class extends
|
|
18
|
+
let J = class extends Ze {
|
|
19
19
|
constructor(e, n) {
|
|
20
20
|
super();
|
|
21
21
|
B(this, "_panelVisible", !1);
|
|
@@ -34,7 +34,7 @@ let J = class extends qe {
|
|
|
34
34
|
e.visible || this.setPanelVisible(!1);
|
|
35
35
|
})
|
|
36
36
|
), this.disposeWithMe(
|
|
37
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(he.UNIVER_SHEET).pipe(
|
|
37
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(he.UNIVER_SHEET).pipe(mt((e) => !e)).subscribe(() => {
|
|
38
38
|
this._sidebarService.close();
|
|
39
39
|
})
|
|
40
40
|
);
|
|
@@ -52,57 +52,61 @@ let J = class extends qe {
|
|
|
52
52
|
this._activeCommentId = e, this._activeCommentId$.next(e);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
J =
|
|
56
|
-
_e(0,
|
|
57
|
-
_e(1,
|
|
55
|
+
J = yt([
|
|
56
|
+
_e(0, Ne(Ue)),
|
|
57
|
+
_e(1, Je)
|
|
58
58
|
], J);
|
|
59
|
-
const
|
|
59
|
+
const jt = "thread-comment-panel", Nt = "UNIVER_THREAD_COMMENT_UI_PLUGIN", Tt = {
|
|
60
60
|
id: "thread-comment-ui.operation.toggle-panel",
|
|
61
|
-
type:
|
|
61
|
+
type: Te.OPERATION,
|
|
62
62
|
handler(t) {
|
|
63
|
-
const e = t.get(
|
|
63
|
+
const e = t.get(Ue), n = t.get(J);
|
|
64
64
|
return n.panelVisible ? (e.close(), n.setPanelVisible(!1)) : (e.open({
|
|
65
65
|
header: { title: "threadCommentUI.panel.title" },
|
|
66
|
-
children: { label:
|
|
66
|
+
children: { label: jt },
|
|
67
67
|
width: 330
|
|
68
68
|
}), n.setPanelVisible(!0)), !0;
|
|
69
69
|
}
|
|
70
70
|
}, W = {
|
|
71
71
|
id: "thread-comment-ui.operation.set-active-comment",
|
|
72
|
-
type:
|
|
72
|
+
type: Te.OPERATION,
|
|
73
73
|
handler(t, e) {
|
|
74
74
|
return t.get(J).setActiveComment(e), !0;
|
|
75
75
|
}
|
|
76
|
-
},
|
|
77
|
-
var
|
|
78
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
76
|
+
}, Et = "thread-comment-ui.config", Se = {};
|
|
77
|
+
var Pe = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Ut = (t, e, n) => e in t ? Pe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Pt = (t, e, n, r) => {
|
|
78
|
+
for (var i = r > 1 ? void 0 : r ? Ot(e, n) : e, s = t.length - 1, d; s >= 0; s--)
|
|
79
79
|
(d = t[s]) && (i = (r ? d(e, n, i) : d(i)) || i);
|
|
80
|
-
return r && i &&
|
|
81
|
-
}, ve = (t, e) => (n, r) => e(n, r, t),
|
|
82
|
-
let ce = class extends
|
|
83
|
-
constructor(t =
|
|
80
|
+
return r && i && Pe(e, n, i), i;
|
|
81
|
+
}, ve = (t, e) => (n, r) => e(n, r, t), Re = (t, e, n) => Ut(t, typeof e != "symbol" ? e + "" : e, n);
|
|
82
|
+
let ce = class extends Ye {
|
|
83
|
+
constructor(t = Se, e, n, r) {
|
|
84
84
|
super(), this._config = t, this._injector = e, this._commandService = n, this._configService = r;
|
|
85
|
-
const { menu: i, ...s } =
|
|
86
|
-
|
|
85
|
+
const { menu: i, ...s } = Qe(
|
|
86
|
+
{},
|
|
87
|
+
Se,
|
|
88
|
+
this._config
|
|
89
|
+
);
|
|
90
|
+
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Et, s);
|
|
87
91
|
}
|
|
88
92
|
onStarting() {
|
|
89
93
|
var t;
|
|
90
|
-
|
|
94
|
+
Xe([
|
|
91
95
|
[J]
|
|
92
96
|
], (t = this._config) == null ? void 0 : t.overrides).forEach((e) => {
|
|
93
97
|
this._injector.add(e);
|
|
94
|
-
}), [
|
|
98
|
+
}), [Tt, W].forEach((e) => {
|
|
95
99
|
this._commandService.registerCommand(e);
|
|
96
100
|
});
|
|
97
101
|
}
|
|
98
102
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
ce =
|
|
102
|
-
|
|
103
|
-
ve(1,
|
|
103
|
+
Re(ce, "pluginName", Nt);
|
|
104
|
+
Re(ce, "type", he.UNIVER_UNKNOWN);
|
|
105
|
+
ce = Pt([
|
|
106
|
+
Ge(it),
|
|
107
|
+
ve(1, Ne(Ke)),
|
|
104
108
|
ve(2, ie),
|
|
105
|
-
ve(3,
|
|
109
|
+
ve(3, et)
|
|
106
110
|
], ce);
|
|
107
111
|
var Ce = { exports: {} }, te = {};
|
|
108
112
|
/**
|
|
@@ -114,11 +118,11 @@ var Ce = { exports: {} }, te = {};
|
|
|
114
118
|
* This source code is licensed under the MIT license found in the
|
|
115
119
|
* LICENSE file in the root directory of this source tree.
|
|
116
120
|
*/
|
|
117
|
-
var
|
|
118
|
-
function
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
var t =
|
|
121
|
+
var ye;
|
|
122
|
+
function Rt() {
|
|
123
|
+
if (ye) return te;
|
|
124
|
+
ye = 1;
|
|
125
|
+
var t = ut, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
122
126
|
function d(u, m, y) {
|
|
123
127
|
var h, v = {}, C = null, b = null;
|
|
124
128
|
y !== void 0 && (C = "" + y), m.key !== void 0 && (C = "" + m.key), m.ref !== void 0 && (b = m.ref);
|
|
@@ -128,11 +132,11 @@ function Pt() {
|
|
|
128
132
|
}
|
|
129
133
|
return te.Fragment = n, te.jsx = d, te.jsxs = d, te;
|
|
130
134
|
}
|
|
131
|
-
var
|
|
132
|
-
function
|
|
133
|
-
return
|
|
135
|
+
var je;
|
|
136
|
+
function Mt() {
|
|
137
|
+
return je || (je = 1, Ce.exports = Rt()), Ce.exports;
|
|
134
138
|
}
|
|
135
|
-
var o =
|
|
139
|
+
var o = Mt(), U = function() {
|
|
136
140
|
return U = Object.assign || function(t) {
|
|
137
141
|
for (var e, n = 1, r = arguments.length; n < r; n++) {
|
|
138
142
|
e = arguments[n];
|
|
@@ -140,7 +144,7 @@ var o = Rt(), U = function() {
|
|
|
140
144
|
}
|
|
141
145
|
return t;
|
|
142
146
|
}, U.apply(this, arguments);
|
|
143
|
-
},
|
|
147
|
+
}, $t = function(t, e) {
|
|
144
148
|
var n = {};
|
|
145
149
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
146
150
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -148,15 +152,15 @@ var o = Rt(), U = function() {
|
|
|
148
152
|
e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]);
|
|
149
153
|
return n;
|
|
150
154
|
}, q = k(function(t, e) {
|
|
151
|
-
var n = t.icon, r = t.id, i = t.className, s = t.extend, d =
|
|
152
|
-
return
|
|
155
|
+
var n = t.icon, r = t.id, i = t.className, s = t.extend, d = $t(t, ["icon", "id", "className", "extend"]), u = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), m = re("_".concat(Dt()));
|
|
156
|
+
return Me(n, "".concat(r), { defIds: n.defIds, idSuffix: m.current }, U({ ref: e, className: u }, d), s);
|
|
153
157
|
});
|
|
154
|
-
function
|
|
155
|
-
return z(t.tag, U(U({ key: e },
|
|
156
|
-
return
|
|
158
|
+
function Me(t, e, n, r, i) {
|
|
159
|
+
return z(t.tag, U(U({ key: e }, wt(t, n, i)), r), (Ht(t, n).children || []).map(function(s, d) {
|
|
160
|
+
return Me(s, "".concat(e, "-").concat(t.tag, "-").concat(d), n, void 0, i);
|
|
157
161
|
}));
|
|
158
162
|
}
|
|
159
|
-
function
|
|
163
|
+
function wt(t, e, n) {
|
|
160
164
|
var r = U({}, t.attrs);
|
|
161
165
|
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
|
|
162
166
|
var i = e.defIds;
|
|
@@ -165,83 +169,83 @@ function $t(t, e, n) {
|
|
|
165
169
|
typeof u == "string" && (r[d] = u.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
166
170
|
})), r;
|
|
167
171
|
}
|
|
168
|
-
function
|
|
172
|
+
function Ht(t, e) {
|
|
169
173
|
var n, r = e.defIds;
|
|
170
174
|
return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? U(U({}, t), { children: t.children.map(function(i) {
|
|
171
175
|
return typeof i.attrs.id == "string" && r && r.indexOf(i.attrs.id) > -1 ? U(U({}, i), { attrs: U(U({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
|
|
172
176
|
}) }) : t;
|
|
173
177
|
}
|
|
174
|
-
function
|
|
178
|
+
function Dt() {
|
|
175
179
|
return Math.random().toString(36).substring(2, 8);
|
|
176
180
|
}
|
|
177
181
|
q.displayName = "UniverIcon";
|
|
178
|
-
var
|
|
182
|
+
var At = { 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" } }] }, $e = k(function(t, e) {
|
|
179
183
|
return z(q, Object.assign({}, t, {
|
|
180
184
|
id: "delete-single",
|
|
181
185
|
ref: e,
|
|
182
|
-
icon:
|
|
186
|
+
icon: At
|
|
183
187
|
}));
|
|
184
188
|
});
|
|
185
|
-
|
|
186
|
-
var
|
|
189
|
+
$e.displayName = "DeleteSingle";
|
|
190
|
+
var kt = { 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" } }] }, we = k(function(t, e) {
|
|
187
191
|
return z(q, Object.assign({}, t, {
|
|
188
192
|
id: "increase-single",
|
|
189
193
|
ref: e,
|
|
190
|
-
icon:
|
|
194
|
+
icon: kt
|
|
191
195
|
}));
|
|
192
196
|
});
|
|
193
|
-
|
|
194
|
-
var
|
|
197
|
+
we.displayName = "IncreaseSingle";
|
|
198
|
+
var Lt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z" } }] }, He = k(function(t, e) {
|
|
195
199
|
return z(q, Object.assign({}, t, {
|
|
196
200
|
id: "more-horizontal-single",
|
|
197
201
|
ref: e,
|
|
198
|
-
icon:
|
|
202
|
+
icon: Lt
|
|
199
203
|
}));
|
|
200
204
|
});
|
|
201
|
-
|
|
202
|
-
var
|
|
205
|
+
He.displayName = "MoreHorizontalSingle";
|
|
206
|
+
var Vt = { 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 } }] }, De = k(function(t, e) {
|
|
203
207
|
return z(q, Object.assign({}, t, {
|
|
204
208
|
id: "reply-to-comment-single",
|
|
205
209
|
ref: e,
|
|
206
|
-
icon:
|
|
210
|
+
icon: Vt
|
|
207
211
|
}));
|
|
208
212
|
});
|
|
209
|
-
|
|
210
|
-
var
|
|
213
|
+
De.displayName = "ReplyToCommentSingle";
|
|
214
|
+
var Bt = { 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" } }] }, Ae = k(function(t, e) {
|
|
211
215
|
return z(q, Object.assign({}, t, {
|
|
212
216
|
id: "resolved-single",
|
|
213
217
|
ref: e,
|
|
214
|
-
icon:
|
|
218
|
+
icon: Bt
|
|
215
219
|
}));
|
|
216
220
|
});
|
|
217
|
-
|
|
218
|
-
var
|
|
221
|
+
Ae.displayName = "ResolvedSingle";
|
|
222
|
+
var Ft = { 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 } }] }, ke = k(function(t, e) {
|
|
219
223
|
return z(q, Object.assign({}, t, {
|
|
220
224
|
id: "solve-single",
|
|
221
225
|
ref: e,
|
|
222
|
-
icon:
|
|
226
|
+
icon: Ft
|
|
223
227
|
}));
|
|
224
228
|
});
|
|
225
|
-
|
|
226
|
-
function
|
|
229
|
+
ke.displayName = "SolveSingle";
|
|
230
|
+
function Le(t) {
|
|
227
231
|
var e, n, r = "";
|
|
228
232
|
if (typeof t == "string" || typeof t == "number") r += t;
|
|
229
233
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
230
234
|
var i = t.length;
|
|
231
|
-
for (e = 0; e < i; e++) t[e] && (n =
|
|
235
|
+
for (e = 0; e < i; e++) t[e] && (n = Le(t[e])) && (r && (r += " "), r += n);
|
|
232
236
|
} else for (n in t) t[n] && (r && (r += " "), r += n);
|
|
233
237
|
return r;
|
|
234
238
|
}
|
|
235
|
-
function
|
|
236
|
-
for (var t, e, n = 0, r = "", i = arguments.length; n < i; n++) (t = arguments[n]) && (e =
|
|
239
|
+
function Wt() {
|
|
240
|
+
for (var t, e, n = 0, r = "", i = arguments.length; n < i; n++) (t = arguments[n]) && (e = Le(t)) && (r && (r += " "), r += e);
|
|
237
241
|
return r;
|
|
238
242
|
}
|
|
239
|
-
const
|
|
240
|
-
threadCommentEditorButtons:
|
|
241
|
-
threadCommentEditorSuggestion:
|
|
242
|
-
threadCommentEditorSuggestionActive:
|
|
243
|
-
threadCommentEditorSuggestionIcon:
|
|
244
|
-
},
|
|
243
|
+
const zt = "univer-thread-comment-editor-buttons", qt = "univer-thread-comment-editor-suggestion", Zt = "univer-thread-comment-editor-suggestionActive", Jt = "univer-thread-comment-editor-suggestion-icon", ue = {
|
|
244
|
+
threadCommentEditorButtons: zt,
|
|
245
|
+
threadCommentEditorSuggestion: qt,
|
|
246
|
+
threadCommentEditorSuggestionActive: Zt,
|
|
247
|
+
threadCommentEditorSuggestionIcon: Jt
|
|
248
|
+
}, Gt = (t) => {
|
|
245
249
|
const e = /@\[(.*?)\]\((.*?)\)|(\w+)/g;
|
|
246
250
|
let n, r = 0;
|
|
247
251
|
const i = [];
|
|
@@ -263,14 +267,14 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
263
267
|
type: "text",
|
|
264
268
|
content: t.substring(r)
|
|
265
269
|
}), i;
|
|
266
|
-
},
|
|
270
|
+
}, Kt = (t) => t.map((e) => {
|
|
267
271
|
switch (e.type) {
|
|
268
272
|
case "mention":
|
|
269
273
|
return `@[${e.content.label}](${e.content.id})`;
|
|
270
274
|
default:
|
|
271
275
|
return e.content;
|
|
272
276
|
}
|
|
273
|
-
}).join(""),
|
|
277
|
+
}).join(""), Ve = (t) => {
|
|
274
278
|
const { dataStream: e, customRanges: n } = t, r = e.length - 2, i = [];
|
|
275
279
|
let s = 0;
|
|
276
280
|
return n == null || n.forEach((d) => {
|
|
@@ -288,7 +292,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
288
292
|
type: "text",
|
|
289
293
|
content: e.slice(s, r)
|
|
290
294
|
}), i;
|
|
291
|
-
},
|
|
295
|
+
}, Be = (t) => {
|
|
292
296
|
let e = "";
|
|
293
297
|
const n = [];
|
|
294
298
|
return t.forEach((r) => {
|
|
@@ -302,7 +306,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
302
306
|
const s = e.length;
|
|
303
307
|
n.push({
|
|
304
308
|
rangeId: r.content.id,
|
|
305
|
-
rangeType:
|
|
309
|
+
rangeType: tt.MENTION,
|
|
306
310
|
startIndex: i,
|
|
307
311
|
endIndex: s,
|
|
308
312
|
properties: {}
|
|
@@ -327,17 +331,17 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
327
331
|
dataStream: e,
|
|
328
332
|
customRanges: n
|
|
329
333
|
};
|
|
330
|
-
},
|
|
334
|
+
}, Yt = (t, e, n, r, i) => {
|
|
331
335
|
var d, u;
|
|
332
336
|
const s = (d = t.raw) == null ? void 0 : d.icon;
|
|
333
337
|
return /* @__PURE__ */ o.jsxs("div", { className: ue.threadCommentEditorSuggestion, children: [
|
|
334
338
|
s ? /* @__PURE__ */ o.jsx("img", { className: ue.threadCommentEditorSuggestionIcon, src: s }) : null,
|
|
335
339
|
/* @__PURE__ */ o.jsx("div", { children: (u = t.display) != null ? u : t.id })
|
|
336
340
|
] });
|
|
337
|
-
},
|
|
341
|
+
}, Fe = k((t, e) => {
|
|
338
342
|
var w;
|
|
339
|
-
const { comment: n, onSave: r, id: i, onCancel: s, autoFocus: d, unitId: u } = t, m = _(
|
|
340
|
-
|
|
343
|
+
const { comment: n, onSave: r, id: i, onCancel: s, autoFocus: d, unitId: u } = t, m = _(nt), y = _(ie), h = _(pe), [v, C] = A({ ...n }), [b, f] = A(!1), I = re(null), P = _(It), N = (w = _(bt).getCurrentTypeOfRenderer(he.UNIVER_DOC)) == null ? void 0 : w.with(xt);
|
|
344
|
+
ht(e, () => ({
|
|
341
345
|
reply(c) {
|
|
342
346
|
var x;
|
|
343
347
|
C({
|
|
@@ -356,22 +360,22 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
356
360
|
};
|
|
357
361
|
return /* @__PURE__ */ o.jsxs("div", { className: ue.threadCommentEditor, onClick: (c) => c.preventDefault(), children: [
|
|
358
362
|
/* @__PURE__ */ o.jsx(
|
|
359
|
-
|
|
363
|
+
vt,
|
|
360
364
|
{
|
|
361
365
|
ref: I,
|
|
362
366
|
autoFocus: d,
|
|
363
367
|
style: { width: "100%" },
|
|
364
368
|
placeholder: h.t("threadCommentUI.editor.placeholder"),
|
|
365
|
-
value: v != null && v.text ?
|
|
369
|
+
value: v != null && v.text ? Kt(Ve(v.text)) : "",
|
|
366
370
|
onChange: (c) => {
|
|
367
|
-
c.target.value || C({ ...n, text: void 0 }), C == null || C({ ...n, text:
|
|
371
|
+
c.target.value || C({ ...n, text: void 0 }), C == null || C({ ...n, text: Be(Gt(c.target.value)) });
|
|
368
372
|
},
|
|
369
373
|
onFocus: () => {
|
|
370
374
|
const c = P.getActiveTextRange();
|
|
371
375
|
c && c.collapsed && (N == null || N.removeAllRanges()), N == null || N.blur(), f(!0);
|
|
372
376
|
},
|
|
373
377
|
children: /* @__PURE__ */ o.jsx(
|
|
374
|
-
|
|
378
|
+
Ct,
|
|
375
379
|
{
|
|
376
380
|
trigger: "@",
|
|
377
381
|
data: (c, x) => m.list({ search: c, unitId: u }).then((l) => l.list.map(
|
|
@@ -384,7 +388,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
384
388
|
)
|
|
385
389
|
).flat()).then(x),
|
|
386
390
|
displayTransform: (c, x) => `@${x} `,
|
|
387
|
-
renderSuggestion:
|
|
391
|
+
renderSuggestion: Yt
|
|
388
392
|
},
|
|
389
393
|
"@"
|
|
390
394
|
)
|
|
@@ -412,30 +416,30 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
412
416
|
)
|
|
413
417
|
] }) : null
|
|
414
418
|
] });
|
|
415
|
-
}),
|
|
416
|
-
threadComment:
|
|
417
|
-
threadCommentActive:
|
|
418
|
-
threadCommentContent:
|
|
419
|
-
threadCommentHighlight:
|
|
420
|
-
threadCommentIconContainer:
|
|
421
|
-
threadCommentIcon:
|
|
422
|
-
threadCommentTitle:
|
|
423
|
-
threadCommentTitlePosition:
|
|
424
|
-
threadCommentTitleHighlight:
|
|
425
|
-
threadCommentTitlePositionText:
|
|
426
|
-
threadCommentUsername:
|
|
427
|
-
threadCommentItem:
|
|
428
|
-
threadCommentItemHead:
|
|
429
|
-
threadCommentItemTitle:
|
|
430
|
-
threadCommentItemTitlePosition:
|
|
431
|
-
threadCommentItemTitleHighlight:
|
|
432
|
-
threadCommentItemTime:
|
|
433
|
-
threadCommentItemContent:
|
|
434
|
-
threadCommentItemAt:
|
|
435
|
-
},
|
|
436
|
-
const { item: e, unitId: n, subUnitId: r, editing: i, onEditingChange: s, onReply: d, resolved: u, isRoot: m, onClose: y, onDeleteComment: h } = t, v = _(ie), C = _(pe), b = _(ge), f = b.getUser(e.personId), I = F(b.currentUser$), P = (I == null ? void 0 : I.userID) === e.personId, j = e.id ===
|
|
419
|
+
}), Qt = "univer-thread-comment", Xt = "univer-thread-comment-active", en = "univer-thread-comment-content", tn = "univer-thread-comment-highlight", nn = "univer-thread-comment-icon-container", rn = "univer-thread-comment-icon", on = "univer-thread-comment-title", sn = "univer-thread-comment-title-position", an = "univer-thread-comment-title-highlight", ln = "univer-thread-comment-title-position-text", dn = "univer-thread-comment-username", mn = "univer-thread-comment-item", cn = "univer-thread-comment-item-head", un = "univer-thread-comment-item-title", hn = "univer-thread-comment-item-title-position", vn = "univer-thread-comment-item-title-highlight", Cn = "univer-thread-comment-item-time", fn = "univer-thread-comment-item-content", pn = "univer-thread-comment-item-at", p = {
|
|
420
|
+
threadComment: Qt,
|
|
421
|
+
threadCommentActive: Xt,
|
|
422
|
+
threadCommentContent: en,
|
|
423
|
+
threadCommentHighlight: tn,
|
|
424
|
+
threadCommentIconContainer: nn,
|
|
425
|
+
threadCommentIcon: rn,
|
|
426
|
+
threadCommentTitle: on,
|
|
427
|
+
threadCommentTitlePosition: sn,
|
|
428
|
+
threadCommentTitleHighlight: an,
|
|
429
|
+
threadCommentTitlePositionText: ln,
|
|
430
|
+
threadCommentUsername: dn,
|
|
431
|
+
threadCommentItem: mn,
|
|
432
|
+
threadCommentItemHead: cn,
|
|
433
|
+
threadCommentItemTitle: un,
|
|
434
|
+
threadCommentItemTitlePosition: hn,
|
|
435
|
+
threadCommentItemTitleHighlight: vn,
|
|
436
|
+
threadCommentItemTime: Cn,
|
|
437
|
+
threadCommentItemContent: fn,
|
|
438
|
+
threadCommentItemAt: pn
|
|
439
|
+
}, We = "__mock__", gn = (t) => {
|
|
440
|
+
const { item: e, unitId: n, subUnitId: r, editing: i, onEditingChange: s, onReply: d, resolved: u, isRoot: m, onClose: y, onDeleteComment: h } = t, v = _(ie), C = _(pe), b = _(ge), f = b.getUser(e.personId), I = F(b.currentUser$), P = (I == null ? void 0 : I.userID) === e.personId, j = e.id === We, [N, g] = A(!1), w = () => {
|
|
437
441
|
(h == null ? void 0 : h(e)) !== !1 && (v.executeCommand(
|
|
438
|
-
m ?
|
|
442
|
+
m ? Oe.id : dt.id,
|
|
439
443
|
{
|
|
440
444
|
unitId: n,
|
|
441
445
|
subUnitId: r,
|
|
@@ -448,22 +452,22 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
448
452
|
/* @__PURE__ */ o.jsxs("div", { className: p.threadCommentItemTitle, children: [
|
|
449
453
|
/* @__PURE__ */ o.jsx("div", { className: p.threadCommentUsername, children: (f == null ? void 0 : f.name) || " " }),
|
|
450
454
|
/* @__PURE__ */ o.jsxs("div", { children: [
|
|
451
|
-
j || u ? null : N ? /* @__PURE__ */ o.jsx("div", { className: p.threadCommentIcon, onClick: () => d(f), children: /* @__PURE__ */ o.jsx(
|
|
455
|
+
j || u ? null : N ? /* @__PURE__ */ o.jsx("div", { className: p.threadCommentIcon, onClick: () => d(f), children: /* @__PURE__ */ o.jsx(De, {}) }) : null,
|
|
452
456
|
P && !j && !u ? /* @__PURE__ */ o.jsx(
|
|
453
|
-
|
|
457
|
+
pt,
|
|
454
458
|
{
|
|
455
|
-
overlay: /* @__PURE__ */ o.jsxs(
|
|
459
|
+
overlay: /* @__PURE__ */ o.jsxs(gt, { children: [
|
|
456
460
|
/* @__PURE__ */ o.jsx(xe, { onClick: () => s == null ? void 0 : s(!0), children: C.t("threadCommentUI.item.edit") }, "edit"),
|
|
457
461
|
/* @__PURE__ */ o.jsx(xe, { onClick: w, children: C.t("threadCommentUI.item.delete") }, "delete")
|
|
458
462
|
] }),
|
|
459
|
-
children: /* @__PURE__ */ o.jsx("div", { className: p.threadCommentIcon, children: /* @__PURE__ */ o.jsx(
|
|
463
|
+
children: /* @__PURE__ */ o.jsx("div", { className: p.threadCommentIcon, children: /* @__PURE__ */ o.jsx(He, {}) })
|
|
460
464
|
}
|
|
461
465
|
) : null
|
|
462
466
|
] })
|
|
463
467
|
] }),
|
|
464
468
|
/* @__PURE__ */ o.jsx("div", { className: p.threadCommentItemTime, children: e.dT }),
|
|
465
469
|
i ? /* @__PURE__ */ o.jsx(
|
|
466
|
-
|
|
470
|
+
Fe,
|
|
467
471
|
{
|
|
468
472
|
id: e.id,
|
|
469
473
|
comment: e,
|
|
@@ -473,7 +477,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
473
477
|
subUnitId: r,
|
|
474
478
|
onSave: ({ text: c, attachments: x }) => {
|
|
475
479
|
s == null || s(!1), v.executeCommand(
|
|
476
|
-
|
|
480
|
+
at.id,
|
|
477
481
|
{
|
|
478
482
|
unitId: n,
|
|
479
483
|
subUnitId: r,
|
|
@@ -486,7 +490,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
486
490
|
);
|
|
487
491
|
}
|
|
488
492
|
}
|
|
489
|
-
) : /* @__PURE__ */ o.jsx("div", { className: p.threadCommentItemContent, children:
|
|
493
|
+
) : /* @__PURE__ */ o.jsx("div", { className: p.threadCommentItemContent, children: Ve(e.text).map((c, x) => {
|
|
490
494
|
switch (c.type) {
|
|
491
495
|
case "mention":
|
|
492
496
|
return /* @__PURE__ */ o.jsxs("a", { className: p.threadCommentItemAt, children: [
|
|
@@ -499,7 +503,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
499
503
|
}
|
|
500
504
|
}) })
|
|
501
505
|
] });
|
|
502
|
-
},
|
|
506
|
+
}, In = (t) => {
|
|
503
507
|
var se, Q, X;
|
|
504
508
|
const {
|
|
505
509
|
id: e,
|
|
@@ -518,13 +522,13 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
518
522
|
onAddComment: f,
|
|
519
523
|
onDeleteComment: I,
|
|
520
524
|
onResolve: P
|
|
521
|
-
} = t, j = _(
|
|
525
|
+
} = t, j = _(Ee), [N, g] = A(!1), [w, c] = A(""), x = de(() => j.commentUpdate$.pipe(ct(16)), [j]);
|
|
522
526
|
F(x);
|
|
523
527
|
const l = e ? j.getCommentWithChildren(n, r, e) : null, R = _(ie), S = _(ge), M = l == null ? void 0 : l.root.resolved, O = F(S.currentUser$), G = re(null), K = [
|
|
524
528
|
...l ? [l.root] : (
|
|
525
529
|
// mock empty comment
|
|
526
530
|
[{
|
|
527
|
-
id:
|
|
531
|
+
id: We,
|
|
528
532
|
text: {
|
|
529
533
|
dataStream: `
|
|
530
534
|
\r`
|
|
@@ -543,7 +547,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
543
547
|
unitId: n,
|
|
544
548
|
subUnitId: r,
|
|
545
549
|
commentId: e
|
|
546
|
-
}) : R.executeCommand(W.id), R.executeCommand(
|
|
550
|
+
}) : R.executeCommand(W.id), R.executeCommand(lt.id, {
|
|
547
551
|
unitId: n,
|
|
548
552
|
subUnitId: r,
|
|
549
553
|
commentId: e,
|
|
@@ -551,7 +555,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
551
555
|
}), P == null || P(!M);
|
|
552
556
|
}, Y = (T) => {
|
|
553
557
|
T.stopPropagation(), R.executeCommand(W.id), !(l != null && l.root && (I == null ? void 0 : I(l.root)) === !1) && (R.executeCommand(
|
|
554
|
-
|
|
558
|
+
Oe.id,
|
|
555
559
|
{
|
|
556
560
|
unitId: n,
|
|
557
561
|
subUnitId: r,
|
|
@@ -564,7 +568,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
564
568
|
return /* @__PURE__ */ o.jsxs(
|
|
565
569
|
"div",
|
|
566
570
|
{
|
|
567
|
-
className:
|
|
571
|
+
className: Wt(p.threadComment, {
|
|
568
572
|
[p.threadCommentActive]: !M && (u || N || h === "cell")
|
|
569
573
|
}),
|
|
570
574
|
onClick: d,
|
|
@@ -580,7 +584,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
580
584
|
/* @__PURE__ */ o.jsxs("div", { className: p.threadCommentTitle, children: [
|
|
581
585
|
/* @__PURE__ */ o.jsxs("div", { className: p.threadCommentTitlePosition, children: [
|
|
582
586
|
/* @__PURE__ */ o.jsx("div", { className: p.threadCommentTitleHighlight }),
|
|
583
|
-
/* @__PURE__ */ o.jsx(
|
|
587
|
+
/* @__PURE__ */ o.jsx(ft, { showIfEllipsis: !0, title: Z, children: /* @__PURE__ */ o.jsx("div", { className: p.threadCommentTitlePositionText, children: Z }) })
|
|
584
588
|
] }),
|
|
585
589
|
l ? /* @__PURE__ */ o.jsxs("div", { className: p.threadCommentIconContainer, children: [
|
|
586
590
|
/* @__PURE__ */ o.jsx(
|
|
@@ -589,15 +593,15 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
589
593
|
onClick: H,
|
|
590
594
|
className: p.threadCommentIcon,
|
|
591
595
|
style: { color: M ? "rgb(var(--green-500))" : "" },
|
|
592
|
-
children: M ? /* @__PURE__ */ o.jsx(
|
|
596
|
+
children: M ? /* @__PURE__ */ o.jsx(Ae, {}) : /* @__PURE__ */ o.jsx(ke, {})
|
|
593
597
|
}
|
|
594
598
|
),
|
|
595
|
-
(O == null ? void 0 : O.userID) === l.root.personId ? /* @__PURE__ */ o.jsx("div", { className: p.threadCommentIcon, onClick: Y, children: /* @__PURE__ */ o.jsx(
|
|
599
|
+
(O == null ? void 0 : O.userID) === l.root.personId ? /* @__PURE__ */ o.jsx("div", { className: p.threadCommentIcon, onClick: Y, children: /* @__PURE__ */ o.jsx($e, {}) }) : null
|
|
596
600
|
] }) : null
|
|
597
601
|
] }),
|
|
598
602
|
/* @__PURE__ */ o.jsx("div", { className: p.threadCommentContent, ref: L, children: K.map(
|
|
599
603
|
(T) => /* @__PURE__ */ o.jsx(
|
|
600
|
-
|
|
604
|
+
gn,
|
|
601
605
|
{
|
|
602
606
|
onClose: m,
|
|
603
607
|
unitId: n,
|
|
@@ -612,7 +616,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
612
616
|
onReply: ($) => {
|
|
613
617
|
$ && requestAnimationFrame(() => {
|
|
614
618
|
var a;
|
|
615
|
-
(a = G.current) == null || a.reply(
|
|
619
|
+
(a = G.current) == null || a.reply(Be([{
|
|
616
620
|
type: "mention",
|
|
617
621
|
content: {
|
|
618
622
|
id: $.userID,
|
|
@@ -628,7 +632,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
628
632
|
)
|
|
629
633
|
) }),
|
|
630
634
|
oe ? /* @__PURE__ */ o.jsx("div", { children: /* @__PURE__ */ o.jsx(
|
|
631
|
-
|
|
635
|
+
Fe,
|
|
632
636
|
{
|
|
633
637
|
ref: G,
|
|
634
638
|
unitId: n,
|
|
@@ -637,8 +641,8 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
637
641
|
const a = {
|
|
638
642
|
text: T,
|
|
639
643
|
attachments: $,
|
|
640
|
-
dT:
|
|
641
|
-
id:
|
|
644
|
+
dT: ot(),
|
|
645
|
+
id: rt(),
|
|
642
646
|
ref: i,
|
|
643
647
|
personId: O == null ? void 0 : O.userID,
|
|
644
648
|
parentId: l == null ? void 0 : l.root.id,
|
|
@@ -647,7 +651,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
647
651
|
threadId: l == null ? void 0 : l.root.threadId
|
|
648
652
|
};
|
|
649
653
|
(f == null ? void 0 : f(a)) !== !1 && (await R.executeCommand(
|
|
650
|
-
|
|
654
|
+
st.id,
|
|
651
655
|
{
|
|
652
656
|
unitId: n,
|
|
653
657
|
subUnitId: r,
|
|
@@ -665,15 +669,15 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
665
669
|
]
|
|
666
670
|
}
|
|
667
671
|
);
|
|
668
|
-
},
|
|
669
|
-
threadCommentPanel:
|
|
670
|
-
threadComment:
|
|
671
|
-
threadCommentPanelForms:
|
|
672
|
-
select:
|
|
673
|
-
threadCommentPanelEmpty:
|
|
674
|
-
threadCommentPanelAdd:
|
|
675
|
-
threadCommentPanelSolved:
|
|
676
|
-
},
|
|
672
|
+
}, xn = "univer-thread-comment-panel", bn = "univer-thread-comment", _n = "univer-thread-comment-panel-forms", Sn = "univer-select", yn = "univer-thread-comment-panel-empty", jn = "univer-thread-comment-panel-add", Nn = "univer-thread-comment-panel-solved", ne = {
|
|
673
|
+
threadCommentPanel: xn,
|
|
674
|
+
threadComment: bn,
|
|
675
|
+
threadCommentPanelForms: _n,
|
|
676
|
+
select: Sn,
|
|
677
|
+
threadCommentPanelEmpty: yn,
|
|
678
|
+
threadCommentPanelAdd: jn,
|
|
679
|
+
threadCommentPanelSolved: Nn
|
|
680
|
+
}, Dn = (t) => {
|
|
677
681
|
const {
|
|
678
682
|
unitId: e,
|
|
679
683
|
subUnitId$: n,
|
|
@@ -689,7 +693,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
689
693
|
onAddComment: C,
|
|
690
694
|
onDeleteComment: b,
|
|
691
695
|
showComments: f
|
|
692
|
-
} = t, [I, P] = A("all"), [j, N] = A("all"), g = _(pe), w = _(ge), c = _(
|
|
696
|
+
} = t, [I, P] = A("all"), [j, N] = A("all"), g = _(pe), w = _(ge), c = _(Ee), [x, l] = A(() => c.getUnit(e)), R = _(J), S = F(R.activeCommentId$), M = F(c.commentUpdate$), O = _(ie), G = F(n), K = re(!0), L = "panel", H = F(w.currentUser$), Y = de(() => {
|
|
693
697
|
var le;
|
|
694
698
|
const a = I === "all" ? x : (le = x.filter((E) => E.subUnitId === G)) != null ? le : [], ee = u != null ? u : (E) => E, ae = a.map((E) => {
|
|
695
699
|
var V;
|
|
@@ -724,7 +728,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
724
728
|
(E = document.getElementById(le)) == null || E.scrollIntoView({ block: "center" });
|
|
725
729
|
}, [S]);
|
|
726
730
|
const $ = (a) => /* @__PURE__ */ o.jsx(
|
|
727
|
-
|
|
731
|
+
In,
|
|
728
732
|
{
|
|
729
733
|
prefix: L,
|
|
730
734
|
getSubUnitName: s,
|
|
@@ -822,7 +826,7 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
822
826
|
onClick: i,
|
|
823
827
|
disabled: h,
|
|
824
828
|
children: [
|
|
825
|
-
/* @__PURE__ */ o.jsx(
|
|
829
|
+
/* @__PURE__ */ o.jsx(we, {}),
|
|
826
830
|
g.t("threadCommentUI.panel.addComment")
|
|
827
831
|
]
|
|
828
832
|
}
|
|
@@ -832,10 +836,10 @@ const Wt = "univer-thread-comment-editor-buttons", zt = "univer-thread-comment-e
|
|
|
832
836
|
};
|
|
833
837
|
export {
|
|
834
838
|
W as SetActiveCommentOperation,
|
|
835
|
-
|
|
836
|
-
|
|
839
|
+
jt as THREAD_COMMENT_PANEL,
|
|
840
|
+
Dn as ThreadCommentPanel,
|
|
837
841
|
J as ThreadCommentPanelService,
|
|
838
|
-
|
|
839
|
-
|
|
842
|
+
In as ThreadCommentTree,
|
|
843
|
+
Tt as ToggleSheetCommentPanelOperation,
|
|
840
844
|
ce as UniverThreadCommentUIPlugin
|
|
841
845
|
};
|
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-thread-comment-editor-buttons{margin-top:12px;display:flex;flex-direction:row;justify-content:flex-end}.univer-thread-comment-editor-suggestion{display:flex;align-items:center;font-size:13px;color:rgb(var(--color-black))}.univer-thread-comment-editor-suggestionActive{background-color:rgba(var(--grey-50))}.univer-thread-comment-editor-suggestion-icon{width:24px;height:24px;border-radius:12px;margin-right:6px}.univer-thread-comment{padding:16px;background:rgba(var(--color-white));border:1px solid rgba(var(--grey-200));border-radius:8px;box-sizing:border-box;position:relative;width:278px}.univer-thread-comment-active{box-shadow:var(--box-shadow-base)}.univer-thread-comment-content{max-height:300px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin}.univer-thread-comment-highlight{background-color:rgb(var(--gold-400));position:absolute;top:0;left:0;right:0;height:6px;border-top-left-radius:6px;border-top-right-radius:6px}.univer-thread-comment-icon-container{display:flex;flex-direction:row;flex-shrink:0;flex-grow:0}.univer-thread-comment-icon{width:24px;height:24px;border-radius:3px;margin-left:4px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;font-size:16px}.univer-thread-comment-icon:hover{background-color:rgba(var(--grey-50))}.univer-thread-comment-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;margin-bottom:16px;font-size:14px;line-height:20px}.univer-thread-comment-title-position{display:flex;flex-direction:row;align-items:center;flex:1 1 0;overflow:hidden}.univer-thread-comment-title-highlight{width:3px;height:14px;border-radius:1.5px;background-color:rgba(var(--gold-400));margin-right:8px;flex-shrink:0;flex-grow:0}.univer-thread-comment-title-position-text{flex:1 1 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.univer-thread-comment-username{font-size:14px;font-weight:500;line-height:20px}.univer-thread-comment-item{margin-bottom:12px;padding-left:30px;position:relative}.univer-thread-comment-item-head{width:24px;height:24px;border-radius:12px;position:absolute;left:0;top:0}.univer-thread-comment-item-title{display:flex;justify-content:space-between;height:24px;align-items:center;margin-bottom:4px}.univer-thread-comment-item-title-position{color:rgba(var(--color-black));font-size:14px;line-height:20px}.univer-thread-comment-item-title-highlight{width:3px;height:14px;border-radius:2px;margin-right:8px;margin-top:3px;background-color:rgba(var(--gold-400))}.univer-thread-comment-item-time{font-size:12px;line-height:1.5;margin-bottom:4px;color:rgba(var(--grey-600))}.univer-thread-comment-item-content{font-size:13px;line-height:20px;color:rgba(var(--color-black))}.univer-thread-comment-item-at{color:rgba(var(--blue-400))}.univer-thread-comment-panel{min-height:100%;display:flex;flex-direction:column;padding-bottom:12px}.univer-thread-comment-panel .univer-thread-comment{margin-top:12px}.univer-thread-comment-panel-forms{display:flex;flex-direction:row;justify-content:space-between;margin-top:12px}.univer-thread-comment-panel-forms .univer-select{width:120px}.univer-thread-comment-panel-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--grey-600));font-size:13px;flex:1}.univer-thread-comment-panel-add{margin-top:8px;display:flex;flex-direction:row}.univer-thread-comment-panel-add svg{margin-right:6px}.univer-thread-comment-panel-solved{margin-top:12px;font-size:var(--font-size-xs)}
|
|
1
|
+
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(63 131 248 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(63 131 248 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*{scrollbar-color:initial;scrollbar-width:initial}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.univer-thread-comment-editor-buttons{margin-top:12px;display:flex;flex-direction:row;justify-content:flex-end}.univer-thread-comment-editor-suggestion{display:flex;align-items:center;font-size:13px;color:rgb(var(--color-black))}.univer-thread-comment-editor-suggestionActive{background-color:rgba(var(--grey-50))}.univer-thread-comment-editor-suggestion-icon{width:24px;height:24px;border-radius:12px;margin-right:6px}.univer-thread-comment{padding:16px;background:rgba(var(--color-white));border:1px solid rgba(var(--grey-200));border-radius:8px;box-sizing:border-box;position:relative;width:278px}.univer-thread-comment-active{box-shadow:var(--box-shadow-base)}.univer-thread-comment-content{max-height:300px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin}.univer-thread-comment-highlight{background-color:rgb(var(--gold-400));position:absolute;top:0;left:0;right:0;height:6px;border-top-left-radius:6px;border-top-right-radius:6px}.univer-thread-comment-icon-container{display:flex;flex-direction:row;flex-shrink:0;flex-grow:0}.univer-thread-comment-icon{width:24px;height:24px;border-radius:3px;margin-left:4px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;font-size:16px}.univer-thread-comment-icon:hover{background-color:rgba(var(--grey-50))}.univer-thread-comment-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;margin-bottom:16px;font-size:14px;line-height:20px}.univer-thread-comment-title-position{display:flex;flex-direction:row;align-items:center;flex:1 1 0;overflow:hidden}.univer-thread-comment-title-highlight{width:3px;height:14px;border-radius:1.5px;background-color:rgba(var(--gold-400));margin-right:8px;flex-shrink:0;flex-grow:0}.univer-thread-comment-title-position-text{flex:1 1 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.univer-thread-comment-username{font-size:14px;font-weight:500;line-height:20px}.univer-thread-comment-item{margin-bottom:12px;padding-left:30px;position:relative}.univer-thread-comment-item-head{width:24px;height:24px;border-radius:12px;position:absolute;left:0;top:0}.univer-thread-comment-item-title{display:flex;justify-content:space-between;height:24px;align-items:center;margin-bottom:4px}.univer-thread-comment-item-title-position{color:rgba(var(--color-black));font-size:14px;line-height:20px}.univer-thread-comment-item-title-highlight{width:3px;height:14px;border-radius:2px;margin-right:8px;margin-top:3px;background-color:rgba(var(--gold-400))}.univer-thread-comment-item-time{font-size:12px;line-height:1.5;margin-bottom:4px;color:rgba(var(--grey-600))}.univer-thread-comment-item-content{font-size:13px;line-height:20px;color:rgba(var(--color-black))}.univer-thread-comment-item-at{color:rgba(var(--blue-400))}.univer-thread-comment-panel{min-height:100%;display:flex;flex-direction:column;padding-bottom:12px}.univer-thread-comment-panel .univer-thread-comment{margin-top:12px}.univer-thread-comment-panel-forms{display:flex;flex-direction:row;justify-content:space-between;margin-top:12px}.univer-thread-comment-panel-forms .univer-select{width:120px}.univer-thread-comment-panel-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--grey-600));font-size:13px;flex:1}.univer-thread-comment-panel-add{margin-top:8px;display:flex;flex-direction:row}.univer-thread-comment-panel-add svg{margin-right:6px}.univer-thread-comment-panel-solved{margin-top:12px;font-size:var(--font-size-xs)}
|
package/lib/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(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,h,E,
|
|
1
|
+
(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,h,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 he="thread-comment-panel",Le="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={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:he},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)}),[ue,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={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
10
|
-
\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})]})},
|
|
11
|
-
\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=h.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}),u==null||u())};h.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(
|
|
9
|
+
*/var pe;function We(){if(pe)return Y;pe=1;var n=h,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,u,U){var f,p={},I=null,T=null;U!==void 0&&(I=""+U),u.key!==void 0&&(I=""+u.key),u.ref!==void 0&&(T=u.ref);for(f in u)r.call(u,f)&&!s.hasOwnProperty(f)&&(p[f]=u[f]);if(C&&C.defaultProps)for(f in u=C.defaultProps,u)p[f]===void 0&&(p[f]=u[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=h.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(),u=h.useRef("_".concat(Ke()));return Ie(t,"".concat(r),{defIds:t.defIds,idSuffix:u.current},M({ref:e,className:C},l),s)});function Ie(n,e,t,r,i){return h.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=h.forwardRef(function(n,e){return h.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=h.forwardRef(function(n,e){return h.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=h.forwardRef(function(n,e){return h.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=h.forwardRef(function(n,e){return h.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=h.forwardRef(function(n,e){return h.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=h.forwardRef(function(n,e){return h.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+=`
|
|
10
|
+
\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=h.forwardRef((n,e)=>{var V;const{comment:t,onSave:r,id:i,onCancel:s,autoFocus:l,unitId:C}=n,u=o.useDependency(o.IMentionIOService),U=o.useDependency(o.ICommandService),f=o.useDependency(o.LocaleService),[p,I]=h.useState({...t}),[T,x]=h.useState(!1),y=h.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);h.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)=>u.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:u,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]=h.useState(!1),V=()=>{(f==null?void 0:f(e))!==!1&&(p.executeCommand(u?_.DeleteCommentTreeCommand.id:_.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),u&&(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:u,getSubUnitName:U,prefix:f,autoFocus:p,onMouseEnter:I,onMouseLeave:T,onAddComment:x,onDeleteComment:y,onResolve:D}=n,P=o.useDependency(_.ThreadCommentModel),[N,S]=h.useState(!1),[V,v]=h.useState(""),b=h.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=h.useRef(null),q=[...m?[m.root]:[{id:Ne,text:{dataStream:`
|
|
11
|
+
\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=h.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}),u==null||u())};h.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:u,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||u==null||u()}},`${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:u,onItemEnter:U,disableAdd:f,tempComment:p,onAddComment:I,onDeleteComment:T,showComments:x}=n,[y,D]=h.useState("all"),[P,N]=h.useState("all"),S=o.useDependency(o.LocaleService),V=o.useDependency(o.UserManagerService),v=o.useDependency(_.ThreadCommentModel),[b,m]=h.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=h.useRef(!0),Z="panel",B=k.useObservable(V.currentUser$),$=h.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=h.useMemo(()=>[...$.filter(d=>!d.resolved),...$.filter(d=>d.resolved)],[$]),oe=h.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")};h.useEffect(()=>{e&&m(v.getUnit(e))},[e,v,A]),h.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:()=>u==null?void 0:u(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=he,c.ThreadCommentPanel=at,c.ThreadCommentTree=Re,c.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/thread-comment-ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2-nightly.202412291605",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer common thread comment UI plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -54,24 +54,24 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@univerjs/icons": "^0.2.8",
|
|
56
56
|
"clsx": "^2.1.1",
|
|
57
|
-
"@univerjs/core": "0.5.
|
|
58
|
-
"@univerjs/design": "0.5.
|
|
59
|
-
"@univerjs/docs": "0.5.
|
|
60
|
-
"@univerjs/docs-ui": "0.5.
|
|
61
|
-
"@univerjs/engine-render": "0.5.
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/
|
|
57
|
+
"@univerjs/core": "0.5.2-nightly.202412291605",
|
|
58
|
+
"@univerjs/design": "0.5.2-nightly.202412291605",
|
|
59
|
+
"@univerjs/docs": "0.5.2-nightly.202412291605",
|
|
60
|
+
"@univerjs/docs-ui": "0.5.2-nightly.202412291605",
|
|
61
|
+
"@univerjs/engine-render": "0.5.2-nightly.202412291605",
|
|
62
|
+
"@univerjs/thread-comment": "0.5.2-nightly.202412291605",
|
|
63
|
+
"@univerjs/ui": "0.5.2-nightly.202412291605"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"less": "^4.2.1",
|
|
67
67
|
"postcss": "^8.4.49",
|
|
68
68
|
"react": "18.3.1",
|
|
69
69
|
"rxjs": "^7.8.1",
|
|
70
|
-
"tailwindcss": "^3.4.
|
|
70
|
+
"tailwindcss": "^3.4.16",
|
|
71
71
|
"typescript": "^5.7.2",
|
|
72
|
-
"vite": "^6.0.
|
|
73
|
-
"vitest": "^2.1.
|
|
74
|
-
"@univerjs-infra/shared": "0.5.
|
|
72
|
+
"vite": "^6.0.3",
|
|
73
|
+
"vitest": "^2.1.8",
|
|
74
|
+
"@univerjs-infra/shared": "0.5.2"
|
|
75
75
|
},
|
|
76
76
|
"space": {
|
|
77
77
|
".": {
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|