@univerjs/preset-docs-thread-comment 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.css +1 -1
- package/lib/umd/index.js +58 -10
- package/lib/umd/locales/ca-ES.js +1 -2
- package/lib/umd/locales/en-US.js +1 -2
- package/lib/umd/locales/es-ES.js +1 -2
- package/lib/umd/locales/fa-IR.js +1 -2
- package/lib/umd/locales/fr-FR.js +1 -2
- package/lib/umd/locales/ja-JP.js +1 -2
- package/lib/umd/locales/ko-KR.js +1 -2
- package/lib/umd/locales/ru-RU.js +1 -2
- package/lib/umd/locales/sk-SK.js +1 -2
- package/lib/umd/locales/vi-VN.js +1 -2
- package/lib/umd/locales/zh-CN.js +1 -2
- package/lib/umd/locales/zh-TW.js +1 -2
- package/package.json +6 -6
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-left-0{left:0}.univer-right-0{right:0}.univer-top-0{top:0}.univer-m-0{margin:0}.univer-mb-1{margin-bottom:.25rem}.univer-mb-3{margin-bottom:.75rem}.univer-mb-4{margin-bottom:1rem}.univer-ml-1{margin-left:.25rem}.univer-mr-1\.5{margin-right:.375rem}.univer-mr-2{margin-right:.5rem}.univer-mt-2{margin-top:.5rem}.univer-mt-3{margin-top:.75rem}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-size-6{width:1.5rem;height:1.5rem}.univer-h-1\.5{height:.375rem}.univer-h-3\.5{height:.875rem}.univer-h-6{height:1.5rem}.univer-max-h-80{max-height:20rem}.univer-min-h-full{min-height:100%}.univer-w-\[278px\]{width:278px}.univer-w-\[3px\]{width:3px}.univer-w-full{width:100%}.univer-flex-1{flex:1
|
|
1
|
+
.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-left-0{left:0}.univer-right-0{right:0}.univer-top-0{top:0}.univer-m-0{margin:0}.univer-mb-1{margin-bottom:.25rem}.univer-mb-3{margin-bottom:.75rem}.univer-mb-4{margin-bottom:1rem}.univer-ml-1{margin-left:.25rem}.univer-mr-1\.5{margin-right:.375rem}.univer-mr-2{margin-right:.5rem}.univer-mt-2{margin-top:.5rem}.univer-mt-3{margin-top:.75rem}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-size-6{width:1.5rem;height:1.5rem}.univer-h-1\.5{height:.375rem}.univer-h-3\.5{height:.875rem}.univer-h-6{height:1.5rem}.univer-max-h-80{max-height:20rem}.univer-min-h-full{min-height:100%}.univer-w-\[278px\]{width:278px}.univer-w-\[3px\]{width:3px}.univer-w-full{width:100%}.univer-flex-1{flex:1}.univer-flex-shrink-0{flex-shrink:0}.univer-flex-grow-0{flex-grow:0}.univer-cursor-pointer{cursor:pointer}.univer-list-none{list-style-type:none}.univer-flex-row{flex-direction:row}.univer-flex-col{flex-direction:column}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-2{gap:.5rem}.univer-gap-3{gap:.75rem}.univer-overflow-hidden{overflow:hidden}.univer-overflow-y-auto{overflow-y:auto}.univer-overflow-x-hidden{overflow-x:hidden}.univer-truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.univer-break-words{word-wrap:break-word}.univer-rounded-\[3px\]{border-radius:3px}.univer-rounded-full{border-radius:9999px}.univer-rounded-lg{border-radius:.5rem}.univer-rounded-md{border-radius:.375rem}.univer-rounded-sm{border-radius:.125rem}.univer-rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.\!univer-bg-gray-900{background-color:var(--univer-gray-900)!important}.univer-bg-gray-50{background-color:var(--univer-gray-50)}.univer-bg-white{background-color:var(--univer-white)}.univer-bg-yellow-400{background-color:var(--univer-yellow-400)}.univer-bg-yellow-500{background-color:var(--univer-yellow-500)}.univer-bg-cover{background-size:cover}.univer-bg-center{background-position:center}.univer-bg-no-repeat{background-repeat:no-repeat}.univer-p-1\.5{padding:.375rem}.univer-p-4{padding:1rem}.univer-pb-3{padding-bottom:.75rem}.univer-pl-\[30px\]{padding-left:30px}.univer-text-base{font-size:1rem;line-height:1.5rem}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-text-xs\/normal{font-size:.75rem;line-height:1.5}.univer-font-medium{font-weight:500}.univer-leading-5{line-height:1.25rem}.univer-text-gray-600{color:var(--univer-gray-600)}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-green-500{color:var(--univer-green-500)}.univer-text-primary-600{color:var(--univer-primary-600)}.univer-shadow{--univer-tw-shadow: 0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a;--univer-tw-shadow-colored: 0 1px 3px 0 var(--univer-tw-shadow-color), 0 1px 2px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 3px #0000001a,0 1px 2px -1px #0000001a;box-shadow:var(--univer-tw-ring-offset-shadow, 0 0 #0000),var(--univer-tw-ring-shadow, 0 0 #0000),var(--univer-tw-shadow)}.hover\:univer-bg-gray-200:hover{background-color:var(--univer-gray-200)}.hover\:univer-bg-gray-50:hover{background-color:var(--univer-gray-50)}.dark\:\!univer-bg-gray-900:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-900)!important}.dark\:\!univer-text-gray-200:where(.univer-dark,.univer-dark *){color:var(--univer-gray-200)!important}.dark\:\!univer-text-white:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.dark\:hover\:\!univer-bg-gray-800:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-800)!important}.\[\&_a\]\:univer-block a{display:block}.\[\&_a\]\:univer-cursor-pointer a{cursor:pointer}.\[\&_a\]\:univer-rounded a{border-radius:.25rem}.\[\&_a\]\:univer-px-2 a{padding-left:.5rem;padding-right:.5rem}.\[\&_a\]\:univer-py-1\.5 a{padding-top:.375rem;padding-bottom:.375rem}.\[\&_a\]\:univer-transition-colors a{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}
|
package/lib/umd/index.js
CHANGED
|
@@ -1,18 +1,66 @@
|
|
|
1
1
|
// @univerjs/thread-comment/index
|
|
2
|
-
(function(s,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("@univerjs/core"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs"],d):(s=typeof globalThis<"u"?globalThis:s||self,d(s.UniverThreadComment={},s.UniverCore,s.rxjs))})(this,(function(s,d,M){"use strict";var q=Object.defineProperty;var K=(s,d,M)=>d in s?q(s,d,{enumerable:!0,configurable:!0,writable:!0,value:M}):s[d]=M;var u=(s,d,M)=>K(s,typeof d!="symbol"?d+"":d,M);var _;class I extends d.Disposable{constructor(){super();u(this,"_dataSource",null);u(this,"syncUpdateMutationToColla",!0)}set dataSource(e){this._dataSource=e}get dataSource(){return this._dataSource}async getThreadComment(e,t,n){return this._dataSource?(await this._dataSource.listComments(e,t,[n]))[0]:null}async addComment(e){var t;return this._dataSource?this._dataSource.addComment(e):{...e,threadId:(t=e.threadId)!=null?t:e.id}}async updateComment(e){return this._dataSource?this._dataSource.updateComment(e):!0}async resolveComment(e){return this._dataSource?this._dataSource.resolveComment(e):!0}async deleteComment(e,t,n,o){return this._dataSource?this._dataSource.deleteComment(e,t,n,o):!0}async listThreadComments(e,t,n){return this.dataSource?this.dataSource.listComments(e,t,n):!1}saveToSnapshot(e,t){if(this._dataSource){const n={};return Object.keys(e).forEach(o=>{const a=e[o];n[o]=a.map(this.dataSource.saveCommentToSnapshot)}),n}return e}}const C=d.createIdentifier("univer.thread-comment.data-source-service");var W=Object.getOwnPropertyDescriptor,G=(c,m,e,t)=>{for(var n=t>1?void 0:t?W(m,e):m,o=c.length-1,a;o>=0;o--)(a=c[o])&&(n=a(n)||n);return n},N=(c,m)=>(e,t)=>m(e,t,c);s.ThreadCommentModel=class extends d.Disposable{constructor(e,t){super();u(this,"_commentsMap",new Map);u(this,"_threadMap",new Map);u(this,"_commentUpdate$",new M.Subject);u(this,"commentUpdate$",this._commentUpdate$.asObservable());u(this,"_tasks",[]);this._dataSourceService=e,this._lifecycleService=t,this.disposeWithMe(()=>{this._commentUpdate$.complete()}),this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe(n=>{const o=new Map;n===d.LifecycleStages.Rendered&&(this._tasks.forEach(({unitId:a,subUnitId:r,threadIds:i})=>{let h=o.get(a);h||(h=new Map,o.set(a,h));let l=h.get(r);l||(l=new Set,h.set(r,l));for(const p of i)l.add(p)}),this._tasks=[],o.forEach((a,r)=>{a.forEach((i,h)=>{this.syncThreadComments(r,h,Array.from(i))})}))}))}_ensureCommentMap(e,t){let n=this._commentsMap.get(e);n||(n=new Map,this._commentsMap.set(e,n));let o=n.get(t);return o||(o=new Map,n.set(t,o)),o}ensureMap(e,t){return this._ensureCommentMap(e,t)}_ensureThreadMap(e,t){let n=this._threadMap.get(e);n||(n=new Map,this._threadMap.set(e,n));let o=n.get(t);return o||(o=new Map,n.set(t,o)),o}_replaceComment(e,t,n){const o=this._ensureCommentMap(e,t),a=o.get(n.id);if(a){const{children:r,...i}=n,h={...i,ref:a.ref};o.set(n.id,h),r==null||r.forEach(l=>{o.set(l.id,{...l,ref:""})}),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"syncUpdate",payload:h}),!!n.resolved!=!!a.resolved&&this._commentUpdate$.next({unitId:e,subUnitId:t,type:"resolve",payload:{commentId:n.id,resolved:!!n.resolved}})}}async syncThreadComments(e,t,n){if(this._lifecycleService.stage<d.LifecycleStages.Rendered){this._tasks.push({unitId:e,subUnitId:t,threadIds:n});return}const o=this._ensureThreadMap(e,t),a=this._ensureCommentMap(e,t),r=await this._dataSourceService.listThreadComments(e,t,n);if(!r)return;const i=new Set(n);r.forEach(h=>{this._replaceComment(e,t,h),i.delete(h.threadId)}),i.forEach(h=>{o.delete(h),a.forEach((l,p)=>{l.threadId===h&&a.delete(p)})})}addComment(e,t,n,o){const a=this._ensureCommentMap(e,t),{parentId:r,children:i=[],...h}=n,l={...h,parentId:r===n.id?void 0:r};l.threadId||(l.threadId=l.parentId||l.id);const p=f=>{a.set(f.id,f),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"add",payload:f,isRoot:!f.parentId})};p(l);const H=this._ensureThreadMap(e,t);if(!l.parentId){H.set(l.threadId,l);for(const f of i)p(f)}return o&&this.syncThreadComments(e,t,[l.threadId]),!0}updateComment(e,t,n,o){const r=this._ensureCommentMap(e,t).get(n.commentId);return r&&(r.updated=!0,r.text=n.text,r.attachments=n.attachments,r.updateT=n.updateT,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"update",payload:n,silent:o})),!0}updateCommentRef(e,t,n,o){const r=this._ensureCommentMap(e,t).get(n.commentId);return r?(r.ref=n.ref,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"updateRef",payload:n,silent:o,threadId:r.threadId}),!0):!1}resolveComment(e,t,n,o){const r=this._ensureCommentMap(e,t).get(n);return r?(r.resolved=o,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"resolve",payload:{commentId:n,resolved:o}}),!0):!1}getComment(e,t,n){return this._ensureCommentMap(e,t).get(n)}getRootComment(e,t,n){return this._ensureThreadMap(e,t).get(n)}getThread(e,t,n){const o=this._ensureCommentMap(e,t),a=Array.from(o.values()).filter(l=>l.threadId===n);let r;const i=[],h=new Set;for(const l of a)l.parentId?i.push(l):r=l,h.add(l.personId);if(r)return{root:r,children:i,relativeUsers:h,unitId:e,subUnitId:t,threadId:n}}getCommentWithChildren(e,t,n){const o=this.getComment(e,t,n);if(o)return this.getThread(e,t,o.threadId)}_deleteComment(e,t,n){const o=this._ensureCommentMap(e,t),a=o.get(n);a&&(o.delete(n),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"delete",payload:{commentId:n,isRoot:!a.parentId,comment:a}}))}deleteThread(e,t,n){this._ensureThreadMap(e,t).delete(n),this._ensureCommentMap(e,t).forEach(r=>{r.threadId===n&&this._deleteComment(e,t,r.id)})}deleteComment(e,t,n){const a=this._ensureCommentMap(e,t).get(n);return a&&(a.parentId?this._deleteComment(e,t,n):this.deleteThread(e,t,a.threadId)),!0}deleteUnit(e){const t=this._commentsMap.get(e);t&&t.forEach((n,o)=>{n.forEach(a=>{this.deleteComment(e,o,a.id)})})}getUnit(e){const t=this._threadMap.get(e);if(!t)return[];const n=[];return t.forEach((o,a)=>{o.forEach((r,i)=>{const h=this.getThread(e,a,i);h&&n.push(h)})}),n}getAll(){const e=[];return this._commentsMap.forEach((t,n)=>{e.push({unitId:n,threads:this.getUnit(n)})}),e}},s.ThreadCommentModel=G([N(0,d.Inject(C)),N(1,d.Inject(d.LifecycleService))],s.ThreadCommentModel);const v={id:"thread-comment.mutation.add-comment",type:d.CommandType.MUTATION,handler(c,m,e){if(!m)return!1;const t=c.get(s.ThreadCommentModel),{unitId:n,subUnitId:o,comment:a,sync:r}=m,i=r||(e==null?void 0:e.fromChangeset)&&!a.parentId;return t.addComment(n,o,a,i)}},g={id:"thread-comment.mutation.update-comment",type:d.CommandType.MUTATION,handler(c,m){if(!m)return!1;const e=c.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,payload:o,silent:a}=m;return e.updateComment(t,n,o,a)}},D={id:"thread-comment.mutation.update-comment-ref",type:d.CommandType.MUTATION,handler(c,m){if(!m)return!1;const e=c.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,payload:o,silent:a}=m;return e.updateCommentRef(t,n,o,a)}},S={id:"thread-comment.mutation.resolve-comment",type:d.CommandType.MUTATION,handler(c,m){if(!m)return!1;const e=c.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,resolved:o,commentId:a}=m;return e.resolveComment(t,n,a,o)}},T={id:"thread-comment.mutation.delete-comment",type:d.CommandType.MUTATION,handler(c,m){if(!m)return!1;const e=c.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,commentId:o}=m;return e.deleteComment(t,n,o)}},O={id:"thread-comment.command.add-comment",type:d.CommandType.COMMAND,async handler(c,m){if(!m)return!1;const e=c.get(d.ICommandService),t=c.get(C),{comment:n}=m,o=await t.addComment(n),a=t.syncUpdateMutationToColla,r=!n.parentId,i={id:v.id,params:{...m,comment:o}};return r?await e.executeCommand(i.id,i.params):e.executeCommand(i.id,i.params,{onlyLocal:!a})}},R={id:"thread-comment.command.update-comment",type:d.CommandType.COMMAND,async handler(c,m){if(!m)return!1;const{unitId:e,subUnitId:t,payload:n}=m,o=c.get(d.ICommandService),a=c.get(s.ThreadCommentModel),r=c.get(C),i=r.syncUpdateMutationToColla,h=a.getComment(e,t,n.commentId);if(!h)return!1;const{children:l,...p}=h;if(!await r.updateComment({...p,...n}))return!1;const f={id:g.id,params:m};return o.executeCommand(f.id,f.params,{onlyLocal:!i}),!0}},w={id:"thread-comment.command.resolve-comment",type:d.CommandType.COMMAND,async handler(c,m){if(!m)return!1;const{unitId:e,subUnitId:t,resolved:n,commentId:o}=m,a=c.get(C),i=c.get(s.ThreadCommentModel).getComment(e,t,o),h=a.syncUpdateMutationToColla;return!i||!await a.resolveComment({...i,resolved:n})?!1:c.get(d.ICommandService).executeCommand(S.id,m,{onlyLocal:!h})}},A={id:"thread-comment.command.delete-comment",type:d.CommandType.COMMAND,async handler(c,m){if(!m)return!1;const e=c.get(s.ThreadCommentModel),t=c.get(C),n=c.get(d.ICommandService),{unitId:o,subUnitId:a,commentId:r}=m,i=t.syncUpdateMutationToColla,h=e.getComment(o,a,r);if(!h||!await t.deleteComment(o,a,h.threadId,r))return!1;const l={id:T.id,params:m};return n.executeCommand(l.id,l.params,{onlyLocal:!i})}},P={id:"thread-comment.command.delete-comment-tree",type:d.CommandType.COMMAND,async handler(c,m){if(!m)return!1;const e=c.get(s.ThreadCommentModel),t=c.get(d.ICommandService),n=c.get(C),{unitId:o,subUnitId:a,commentId:r}=m,i=e.getCommentWithChildren(o,a,r);return!i||!await n.deleteComment(o,a,i.root.threadId,r)?!1:await t.executeCommand(T.id,{unitId:o,subUnitId:a,commentId:i.root.id})}};function k(c){return d.dayjs(c).format("YYYY/MM/DD HH:mm")}const y="UNIVER_THREAD_COMMENT_PLUGIN";var J=Object.getOwnPropertyDescriptor,V=(c,m,e,t)=>{for(var n=t>1?void 0:t?J(m,e):m,o=c.length-1,a;o>=0;o--)(a=c[o])&&(n=a(n)||n);return n},U=(c,m)=>(e,t)=>m(e,t,c);const j=`SHEET_${y}`;s.ThreadCommentResourceController=class extends d.Disposable{constructor(m,e,t){super(),this._resourceManagerService=m,this._threadCommentModel=e,this._threadCommentDataSourceService=t,this._initSnapshot()}_initSnapshot(){const m=t=>{const n=this._threadCommentModel.getUnit(t),o={};return n?(n.forEach(a=>{var i;const r=(i=o[a.subUnitId])!=null?i:[];r.push({...a.root,children:a.children}),o[a.subUnitId]=r}),JSON.stringify(this._threadCommentDataSourceService.saveToSnapshot(o,t))):""},e=t=>{if(!t)return{};try{return JSON.parse(t)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:j,businesses:[d.UniverInstanceType.UNIVER_SHEET,d.UniverInstanceType.UNIVER_DOC],toJson:t=>m(t),parseJson:t=>e(t),onUnLoad:t=>{this._threadCommentModel.deleteUnit(t)},onLoad:async(t,n)=>{Object.keys(n).forEach(o=>{const a=n[o];a.forEach(r=>{this._threadCommentModel.addComment(t,o,r)}),this._threadCommentModel.syncThreadComments(t,o,a.map(r=>r.threadId))})}}))}},s.ThreadCommentResourceController=V([U(0,d.IResourceManagerService),U(1,d.Inject(s.ThreadCommentModel)),U(2,C)],s.ThreadCommentResourceController);const $={name:"@univerjs/thread-comment",version:"0.17.0"},b="thread-comment.config",L={};var Y=Object.getOwnPropertyDescriptor,B=(c,m,e,t)=>{for(var n=t>1?void 0:t?Y(m,e):m,o=c.length-1,a;o>=0;o--)(a=c[o])&&(n=a(n)||n);return n},E=(c,m)=>(e,t)=>m(e,t,c);s.UniverThreadCommentPlugin=(_=class extends d.Plugin{constructor(m=L,e,t,n){super(),this._config=m,this._injector=e,this._commandService=t,this._configService=n;const{...o}=d.merge({},L,this._config);this._configService.setConfig(b,o)}onStarting(){var m;d.mergeOverrideWithDependencies([[C,{useClass:I}],[s.ThreadCommentModel],[s.ThreadCommentResourceController]],(m=this._config)==null?void 0:m.overrides).forEach(e=>{this._injector.add(e)}),[O,R,A,w,P,v,g,D,T,S].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(s.ThreadCommentResourceController)}},u(_,"pluginName",y),u(_,"packageName",$.name),u(_,"version",$.version),u(_,"type",d.UniverInstanceType.UNIVER_UNKNOWN),_),s.UniverThreadCommentPlugin=B([E(1,d.Inject(d.Injector)),E(2,d.ICommandService),E(3,d.IConfigService)],s.UniverThreadCommentPlugin),s.AddCommentCommand=O,s.AddCommentMutation=v,s.DeleteCommentCommand=A,s.DeleteCommentMutation=T,s.DeleteCommentTreeCommand=P,s.IThreadCommentDataSourceService=C,s.ResolveCommentCommand=w,s.ResolveCommentMutation=S,s.SHEET_UNIVER_THREAD_COMMENT_PLUGIN=j,s.TC_PLUGIN_NAME=y,s.ThreadCommentDataSourceService=I,s.UpdateCommentCommand=R,s.UpdateCommentMutation=g,s.UpdateCommentRefMutation=D,s.getDT=k,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`rxjs`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverThreadComment={},e.UniverCore,e.rxjs))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function r(e){"@babel/helpers - typeof";return r=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},r(e)}function i(e,t){if(r(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t||`default`);if(r(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function a(e){var t=i(e,`string`);return r(t)==`symbol`?t:t+``}function o(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=class extends t.Disposable{set dataSource(e){this._dataSource=e}get dataSource(){return this._dataSource}constructor(){super(),o(this,`_dataSource`,null),o(this,`syncUpdateMutationToColla`,!0)}async getThreadComment(e,t,n){return this._dataSource?(await this._dataSource.listComments(e,t,[n]))[0]:null}async addComment(e){var t;return this._dataSource?this._dataSource.addComment(e):{...e,threadId:(t=e.threadId)==null?e.id:t}}async updateComment(e){return this._dataSource?this._dataSource.updateComment(e):!0}async resolveComment(e){return this._dataSource?this._dataSource.resolveComment(e):!0}async deleteComment(e,t,n,r){return this._dataSource?this._dataSource.deleteComment(e,t,n,r):!0}async listThreadComments(e,t,n){return this.dataSource?this.dataSource.listComments(e,t,n):!1}saveToSnapshot(e,t){if(this._dataSource){let t={};return Object.keys(e).forEach(n=>{t[n]=e[n].map(this.dataSource.saveCommentToSnapshot)}),t}return e}};let c=(0,t.createIdentifier)(`univer.thread-comment.data-source-service`);function l(e,t){return function(n,r){t(n,r,e)}}function u(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let d=class extends t.Disposable{constructor(e,r){super(),this._dataSourceService=e,this._lifecycleService=r,o(this,`_commentsMap`,new Map),o(this,`_threadMap`,new Map),o(this,`_commentUpdate$`,new n.Subject),o(this,`commentUpdate$`,this._commentUpdate$.asObservable()),o(this,`_tasks`,[]),this.disposeWithMe(()=>{this._commentUpdate$.complete()}),this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe(e=>{let n=new Map;e===t.LifecycleStages.Rendered&&(this._tasks.forEach(({unitId:e,subUnitId:t,threadIds:r})=>{let i=n.get(e);i||(i=new Map,n.set(e,i));let a=i.get(t);a||(a=new Set,i.set(t,a));for(let e of r)a.add(e)}),this._tasks=[],n.forEach((e,t)=>{e.forEach((e,n)=>{this.syncThreadComments(t,n,Array.from(e))})}))}))}_ensureCommentMap(e,t){let n=this._commentsMap.get(e);n||(n=new Map,this._commentsMap.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}ensureMap(e,t){return this._ensureCommentMap(e,t)}_ensureThreadMap(e,t){let n=this._threadMap.get(e);n||(n=new Map,this._threadMap.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_replaceComment(e,t,n){let r=this._ensureCommentMap(e,t),i=r.get(n.id);if(i){let{children:a,...o}=n,s={...o,ref:i.ref};r.set(n.id,s),a==null||a.forEach(e=>{r.set(e.id,{...e,ref:``})}),this._commentUpdate$.next({unitId:e,subUnitId:t,type:`syncUpdate`,payload:s}),!!n.resolved!=!!i.resolved&&this._commentUpdate$.next({unitId:e,subUnitId:t,type:`resolve`,payload:{commentId:n.id,resolved:!!n.resolved}})}}async syncThreadComments(e,n,r){if(this._lifecycleService.stage<t.LifecycleStages.Rendered){this._tasks.push({unitId:e,subUnitId:n,threadIds:r});return}let i=this._ensureThreadMap(e,n),a=this._ensureCommentMap(e,n),o=await this._dataSourceService.listThreadComments(e,n,r);if(!o)return;let s=new Set(r);o.forEach(t=>{this._replaceComment(e,n,t),s.delete(t.threadId)}),s.forEach(e=>{i.delete(e),a.forEach((t,n)=>{t.threadId===e&&a.delete(n)})})}addComment(e,t,n,r){let i=this._ensureCommentMap(e,t),{parentId:a,children:o=[],...s}=n,c={...s,parentId:a===n.id?void 0:a};c.threadId||(c.threadId=c.parentId||c.id);let l=n=>{i.set(n.id,n),this._commentUpdate$.next({unitId:e,subUnitId:t,type:`add`,payload:n,isRoot:!n.parentId})};l(c);let u=this._ensureThreadMap(e,t);if(!c.parentId){u.set(c.threadId,c);for(let e of o)l(e)}return r&&this.syncThreadComments(e,t,[c.threadId]),!0}updateComment(e,t,n,r){let i=this._ensureCommentMap(e,t).get(n.commentId);return i?(i.updated=!0,i.text=n.text,i.attachments=n.attachments,i.updateT=n.updateT,this._commentUpdate$.next({unitId:e,subUnitId:t,type:`update`,payload:n,silent:r}),!0):!0}updateCommentRef(e,t,n,r){let i=this._ensureCommentMap(e,t).get(n.commentId);return i?(i.ref=n.ref,this._commentUpdate$.next({unitId:e,subUnitId:t,type:`updateRef`,payload:n,silent:r,threadId:i.threadId}),!0):!1}resolveComment(e,t,n,r){let i=this._ensureCommentMap(e,t).get(n);return i?(i.resolved=r,this._commentUpdate$.next({unitId:e,subUnitId:t,type:`resolve`,payload:{commentId:n,resolved:r}}),!0):!1}getComment(e,t,n){return this._ensureCommentMap(e,t).get(n)}getRootComment(e,t,n){return this._ensureThreadMap(e,t).get(n)}getThread(e,t,n){let r=this._ensureCommentMap(e,t),i=Array.from(r.values()).filter(e=>e.threadId===n),a,o=[],s=new Set;for(let e of i)e.parentId?o.push(e):a=e,s.add(e.personId);if(a)return{root:a,children:o,relativeUsers:s,unitId:e,subUnitId:t,threadId:n}}getCommentWithChildren(e,t,n){let r=this.getComment(e,t,n);if(r)return this.getThread(e,t,r.threadId)}_deleteComment(e,t,n){let r=this._ensureCommentMap(e,t),i=r.get(n);i&&(r.delete(n),this._commentUpdate$.next({unitId:e,subUnitId:t,type:`delete`,payload:{commentId:n,isRoot:!i.parentId,comment:i}}))}deleteThread(e,t,n){this._ensureThreadMap(e,t).delete(n),this._ensureCommentMap(e,t).forEach(r=>{r.threadId===n&&this._deleteComment(e,t,r.id)})}deleteComment(e,t,n){let r=this._ensureCommentMap(e,t).get(n);return r&&(r.parentId?this._deleteComment(e,t,n):this.deleteThread(e,t,r.threadId)),!0}deleteUnit(e){let t=this._commentsMap.get(e);t&&t.forEach((t,n)=>{t.forEach(t=>{this.deleteComment(e,n,t.id)})})}getUnit(e){let t=this._threadMap.get(e);if(!t)return[];let n=[];return t.forEach((t,r)=>{t.forEach((t,i)=>{let a=this.getThread(e,r,i);a&&n.push(a)})}),n}getAll(){let e=[];return this._commentsMap.forEach((t,n)=>{e.push({unitId:n,threads:this.getUnit(n)})}),e}};d=u([l(0,(0,t.Inject)(c)),l(1,(0,t.Inject)(t.LifecycleService))],d);let f={id:`thread-comment.mutation.add-comment`,type:t.CommandType.MUTATION,handler(e,t,n){if(!t)return!1;let r=e.get(d),{unitId:i,subUnitId:a,comment:o,sync:s}=t,c=s||(n==null?void 0:n.fromChangeset)&&!o.parentId;return r.addComment(i,a,o,c)}},p={id:`thread-comment.mutation.update-comment`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,payload:a,silent:o}=t;return n.updateComment(r,i,a,o)}},m={id:`thread-comment.mutation.update-comment-ref`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,payload:a,silent:o}=t;return n.updateCommentRef(r,i,a,o)}},h={id:`thread-comment.mutation.resolve-comment`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,resolved:a,commentId:o}=t;return n.resolveComment(r,i,o,a)}},g={id:`thread-comment.mutation.delete-comment`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,commentId:a}=t;return n.deleteComment(r,i,a)}},_={id:`thread-comment.command.add-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let r=e.get(t.ICommandService),i=e.get(c),{comment:a}=n,o=await i.addComment(a),s=i.syncUpdateMutationToColla,l=!a.parentId,u={id:f.id,params:{...n,comment:o}};return l?await r.executeCommand(u.id,u.params):r.executeCommand(u.id,u.params,{onlyLocal:!s})}},v={id:`thread-comment.command.update-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let{unitId:r,subUnitId:i,payload:a}=n,o=e.get(t.ICommandService),s=e.get(d),l=e.get(c),u=l.syncUpdateMutationToColla,f=s.getComment(r,i,a.commentId);if(!f)return!1;let{children:m,...h}=f;if(!await l.updateComment({...h,...a}))return!1;let g={id:p.id,params:n};return o.executeCommand(g.id,g.params,{onlyLocal:!u}),!0}},y={id:`thread-comment.command.resolve-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let{unitId:r,subUnitId:i,resolved:a,commentId:o}=n,s=e.get(c),l=e.get(d).getComment(r,i,o),u=s.syncUpdateMutationToColla;return!l||!await s.resolveComment({...l,resolved:a})?!1:e.get(t.ICommandService).executeCommand(h.id,n,{onlyLocal:!u})}},b={id:`thread-comment.command.delete-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let r=e.get(d),i=e.get(c),a=e.get(t.ICommandService),{unitId:o,subUnitId:s,commentId:l}=n,u=i.syncUpdateMutationToColla,f=r.getComment(o,s,l);if(!f||!await i.deleteComment(o,s,f.threadId,l))return!1;let p={id:g.id,params:n};return a.executeCommand(p.id,p.params,{onlyLocal:!u})}},x={id:`thread-comment.command.delete-comment-tree`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let r=e.get(d),i=e.get(t.ICommandService),a=e.get(c),{unitId:o,subUnitId:s,commentId:l}=n,u=r.getCommentWithChildren(o,s,l);return!u||!await a.deleteComment(o,s,u.root.threadId,l)?!1:await i.executeCommand(g.id,{unitId:o,subUnitId:s,commentId:u.root.id})}};function S(e){return(0,t.dayjs)(e).format(`YYYY/MM/DD HH:mm`)}let C=`UNIVER_THREAD_COMMENT_PLUGIN`,w=`SHEET_${C}`,T=class extends t.Disposable{constructor(e,t,n){super(),this._resourceManagerService=e,this._threadCommentModel=t,this._threadCommentDataSourceService=n,this._initSnapshot()}_initSnapshot(){let e=e=>{let t=this._threadCommentModel.getUnit(e),n={};return t?(t.forEach(e=>{var t;let r=(t=n[e.subUnitId])==null?[]:t;r.push({...e.root,children:e.children}),n[e.subUnitId]=r}),JSON.stringify(this._threadCommentDataSourceService.saveToSnapshot(n,e))):``},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:w,businesses:[t.UniverInstanceType.UNIVER_SHEET,t.UniverInstanceType.UNIVER_DOC],toJson:t=>e(t),parseJson:e=>n(e),onUnLoad:e=>{this._threadCommentModel.deleteUnit(e)},onLoad:async(e,t)=>{Object.keys(t).forEach(n=>{let r=t[n];r.forEach(t=>{this._threadCommentModel.addComment(e,n,t)}),this._threadCommentModel.syncThreadComments(e,n,r.map(e=>e.threadId))})}}))}};T=u([l(0,t.IResourceManagerService),l(1,(0,t.Inject)(d)),l(2,c)],T);var E=`@univerjs/thread-comment`,D=`0.18.0`;let O=`thread-comment.config`;Symbol(O);let k={},A=class extends t.Plugin{constructor(e=k,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{...a}=(0,t.merge)({},k,this._config);this._configService.setConfig(O,a)}onStarting(){var e;(0,t.mergeOverrideWithDependencies)([[c,{useClass:s}],[d],[T]],(e=this._config)==null?void 0:e.overrides).forEach(e=>{this._injector.add(e)}),[_,v,b,y,x,f,p,m,g,h].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(T)}};o(A,`pluginName`,C),o(A,`packageName`,E),o(A,`version`,D),o(A,`type`,t.UniverInstanceType.UNIVER_UNKNOWN),A=u([l(1,(0,t.Inject)(t.Injector)),l(2,t.ICommandService),l(3,t.IConfigService)],A),e.AddCommentCommand=_,e.AddCommentMutation=f,e.DeleteCommentCommand=b,e.DeleteCommentMutation=g,e.DeleteCommentTreeCommand=x,e.IThreadCommentDataSourceService=c,e.ResolveCommentCommand=y,e.ResolveCommentMutation=h,e.SHEET_UNIVER_THREAD_COMMENT_PLUGIN=w,e.TC_PLUGIN_NAME=C,e.ThreadCommentDataSourceService=s,Object.defineProperty(e,`ThreadCommentModel`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,`ThreadCommentResourceController`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,`UniverThreadCommentPlugin`,{enumerable:!0,get:function(){return A}}),e.UpdateCommentCommand=v,e.UpdateCommentMutation=p,e.UpdateCommentRefMutation=m,e.getDT=S});
|
|
4
3
|
|
|
5
4
|
// @univerjs/thread-comment-ui/index
|
|
6
|
-
(function(d,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/thread-comment"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("@univerjs/docs-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/ui","rxjs","@univerjs/thread-comment","react/jsx-runtime","@univerjs/design","react","@univerjs/docs-ui"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.UniverThreadCommentUi={},d.UniverCore,d.UniverUi,d.rxjs,d.UniverThreadComment,d.React,d.UniverDesign,d.React,d.UniverDocsUi))})(this,(function(d,s,m,Q,V,i,N,c,se){"use strict";var qe=Object.defineProperty;var ze=(d,s,m)=>s in d?qe(d,s,{enumerable:!0,configurable:!0,writable:!0,value:m}):d[s]=m;var G=(d,s,m)=>ze(d,typeof s!="symbol"?s+"":s,m);var Se=Object.getOwnPropertyDescriptor,_e=(r,e,t,n)=>{for(var o=n>1?void 0:n?Se(e,t):e,a=r.length-1,v;a>=0;a--)(v=r[a])&&(o=v(o)||o);return o},ae=(r,e)=>(t,n)=>e(t,n,r);d.ThreadCommentPanelService=class extends s.Disposable{constructor(t,n){super();G(this,"_panelVisible",!1);G(this,"_panelVisible$",new Q.BehaviorSubject(!1));G(this,"_activeCommentId");G(this,"_activeCommentId$",new Q.BehaviorSubject(void 0));G(this,"panelVisible$",this._panelVisible$.asObservable());G(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=n,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$(s.UniverInstanceType.UNIVER_SHEET).pipe(Q.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)}},d.ThreadCommentPanelService=_e([ae(0,s.Inject(m.ISidebarService)),ae(1,s.IUniverInstanceService)],d.ThreadCommentPanelService);const le="thread-comment-panel",we="UNIVER_THREAD_COMMENT_UI_PLUGIN",de={id:"thread-comment-ui.operation.toggle-panel",type:s.CommandType.OPERATION,handler(r){const e=r.get(m.ISidebarService),t=r.get(d.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:le},width:360}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:s.CommandType.OPERATION,handler(r,e){return r.get(d.ThreadCommentPanelService).setActiveComment(e),!0}},ce={name:"@univerjs/thread-comment-ui",version:"0.17.0"},Te="thread-comment-ui.config",ue={};var Ue=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,De=(r,e,t)=>e in r?Ue(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ee=(r,e,t,n)=>{for(var o=n>1?void 0:n?Ne(e,t):e,a=r.length-1,v;a>=0;a--)(v=r[a])&&(o=v(o)||o);return o},oe=(r,e)=>(t,n)=>e(t,n,r),X=(r,e,t)=>De(r,typeof e!="symbol"?e+"":e,t);d.UniverThreadCommentUIPlugin=class extends s.Plugin{constructor(e=ue,t,n,o){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=o;const{menu:a,...v}=s.merge({},ue,this._config);a&&this._configService.setConfig("menu",a,{merge:!0}),this._configService.setConfig(Te,v)}onStarting(){var e;s.mergeOverrideWithDependencies([[d.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[de,F].forEach(t=>{this._commandService.registerCommand(t)})}},X(d.UniverThreadCommentUIPlugin,"pluginName",we),X(d.UniverThreadCommentUIPlugin,"packageName",ce.name),X(d.UniverThreadCommentUIPlugin,"version",ce.version),X(d.UniverThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_UNKNOWN),d.UniverThreadCommentUIPlugin=Ee([s.DependentOn(V.UniverThreadCommentPlugin),oe(1,s.Inject(s.Injector)),oe(2,s.ICommandService),oe(3,s.IConfigService)],d.UniverThreadCommentUIPlugin);function q({ref:r,...e}){const{icon:t,id:n,className:o,extend:a,...v}=e,S=`univerjs-icon univerjs-icon-${n} ${o||""}`.trim(),g=c.useRef(`_${Me()}`);return ve(t,`${n}`,{defIds:t.defIds,idSuffix:g.current},{ref:r,className:S,...v},a)}function ve(r,e,t,n,o){return c.createElement(r.tag,{key:e,...ke(r,t,o),...n},($e(r,t).children||[]).map((a,v)=>ve(a,`${e}-${r.tag}-${v}`,t,void 0,o)))}function ke(r,e,t){const n={...r.attrs};t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1),r.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(([a,v])=>{a==="mask"&&typeof v=="string"&&(n[a]=v.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))});const{defIds:o}=e;return!o||o.length===0||(r.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(([a,v])=>{typeof v=="string"&&(n[a]=v.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))})),n}function $e(r,e){var n;const{defIds:t}=e;return!t||t.length===0?r:r.tag==="defs"&&((n=r.children)!=null&&n.length)?{...r,children:r.children.map(o=>typeof o.attrs.id=="string"&&t&&t.includes(o.attrs.id)?{...o,attrs:{...o.attrs,id:o.attrs.id+e.idSuffix}}:o)}:r}function Me(){return Math.random().toString(36).substring(2,8)}q.displayName="UniverIcon";const Oe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},me=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"delete-icon",ref:t,icon:Oe}))});me.displayName="DeleteIcon";const je={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},he=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"increase-icon",ref:t,icon:je}))});he.displayName="IncreaseIcon";const Pe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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 8C4 7.44772 3.55228 7 3 7C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M13 9C13.5523 9 14 8.55228 14 8C14 7.44772 13.5523 7 13 7C12.4477 7 12 7.44772 12 8C12 8.55228 12.4477 9 13 9Z"}}]},fe=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"more-horizontal-icon",ref:t,icon:Pe}))});fe.displayName="MoreHorizontalIcon";const Le={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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.76813",strokeLinecap:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M8.91626 6.1311H9.27424",strokeLinecap:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},Ce=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"reply-to-comment-icon",ref:t,icon:Le}))});Ce.displayName="ReplyToCommentIcon";const He={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},pe=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"resolved-icon",ref:t,icon:He}))});pe.displayName="ResolvedIcon";const Ve={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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}}]},ge=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"solve-icon",ref:t,icon:Ve}))});ge.displayName="SolveIcon";function Ie(r){return{id:"d",body:r,documentStyle:{}}}const be=c.forwardRef((r,e)=>{var L;const{comment:t,onSave:n,id:o,onCancel:a,autoFocus:v,unitId:S,type:g}=r,D=m.useDependency(s.ICommandService),k=m.useDependency(s.LocaleService),[W,$]=c.useState(!1),_=m.useDependency(se.IEditorService),f=c.useRef(null),C=g===s.UniverInstanceType.UNIVER_DOC?s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:S,[M,w]=c.useState(()=>{var h,p,I;return s.BuildTextUtils.transform.getPlainText((I=(p=(h=f.current)==null?void 0:h.getDocumentData().body)==null?void 0:p.dataStream)!=null?I:"")});c.useEffect(()=>{var p,I,T,b;w(s.BuildTextUtils.transform.getPlainText((T=(I=(p=f.current)==null?void 0:p.getDocumentData().body)==null?void 0:I.dataStream)!=null?T:""));const h=(b=f.current)==null?void 0:b.selectionChange$.subscribe(()=>{var l,U,z;w(s.BuildTextUtils.transform.getPlainText((z=(U=(l=f.current)==null?void 0:l.getDocumentData().body)==null?void 0:U.dataStream)!=null?z:""))});return()=>h==null?void 0:h.unsubscribe()},[(L=f.current)==null?void 0:L.selectionChange$]);const Z=c.useMemo(()=>({keyCodes:[{keyCode:m.KeyCode.ENTER}],handler:h=>{h===m.KeyCode.ENTER&&D.executeCommand(se.BreakLineCommand.id)}}),[D]);c.useImperativeHandle(e,()=>({reply(h){var I,T;if(!f.current)return;_.focus((I=f.current.getEditorId())!=null?I:"");const p=Ie(h);(T=f.current)==null||T.setDocumentData(p,[{startOffset:p.body.dataStream.length-2,endOffset:p.body.dataStream.length-2,collapsed:!0}])}}));const x=()=>{if(f.current){const h=s.Tools.deepClone(f.current.getDocumentData().body);$(!1),n==null||n({...t,text:h}),f.current.replaceText(""),setTimeout(()=>{var p,I;(p=f.current)==null||p.setSelectionRanges([]),(I=f.current)==null||I.blur()},10)}};return i.jsxs("div",{onClick:h=>h.preventDefault(),children:[i.jsx(se.RichTextEditor,{className:"univer-w-full",editorRef:f,editorId:s.DOCS_COMMENT_EDITOR_UNIT_ID_KEY,autoFocus:v,keyboardEventConfig:Z,placeholder:k.t("threadCommentUI.editor.placeholder"),initialValue:(t==null?void 0:t.text)&&Ie(t.text),onFocusChange:h=>h&&$(h),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{_.focus(C)},30)}}),W?i.jsxs("div",{className:"univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2",children:[i.jsx(N.Button,{onClick:()=>{var h;a==null||a(),$(!1),(h=f.current)==null||h.replaceText("",!0),D.executeCommand(F.id)},children:k.t("threadCommentUI.editor.cancel")}),i.jsx(N.Button,{variant:"primary",disabled:!M,onClick:x,children:k.t(o?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),Be=r=>{const{dataStream:e,customRanges:t}=r,n=e.endsWith(`\r
|
|
7
|
-
`)?
|
|
8
|
-
`,{textRuns:[],paragraphs:[{startIndex:
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/ui`),require(`rxjs`),require(`@univerjs/thread-comment`),require(`@univerjs/design`),require(`react`),require(`@univerjs/docs-ui`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/ui`,`rxjs`,`@univerjs/thread-comment`,`@univerjs/design`,`react`,`@univerjs/docs-ui`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverThreadCommentUi={},e.UniverCore,e.UniverUi,e.rxjs,e.UniverThreadComment,e.UniverDesign,e.React,e.UniverDocsUi,e.React))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function l(e){"@babel/helpers - typeof";return l=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},l(e)}function u(e,t){if(l(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(l(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function d(e){var t=u(e,`string`);return l(t)==`symbol`?t:t+``}function f(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){return function(n,r){t(n,r,e)}}function m(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let h=class extends t.Disposable{constructor(e,t){super(),this._sidebarService=e,this._univerInstanceService=t,f(this,`_panelVisible`,!1),f(this,`_panelVisible$`,new r.BehaviorSubject(!1)),f(this,`_activeCommentId`,void 0),f(this,`_activeCommentId$`,new r.BehaviorSubject(void 0)),f(this,`panelVisible$`,this._panelVisible$.asObservable()),f(this,`activeCommentId$`,this._activeCommentId$.asObservable()),this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).pipe((0,r.filter)(e=>!e)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(e){this._panelVisible=e,this._panelVisible$.next(e)}setActiveComment(e){this._activeCommentId=e,this._activeCommentId$.next(e)}};h=m([p(0,(0,t.Inject)(n.ISidebarService)),p(1,t.IUniverInstanceService)],h);let g=`thread-comment-panel`,_={id:`thread-comment-ui.operation.toggle-panel`,type:t.CommandType.OPERATION,handler(e){let t=e.get(n.ISidebarService),r=e.get(h);return r.panelVisible?(t.close(),r.setPanelVisible(!1)):(t.open({header:{title:`threadCommentUI.panel.title`},children:{label:g},width:360}),r.setPanelVisible(!0)),!0}},v={id:`thread-comment-ui.operation.set-active-comment`,type:t.CommandType.OPERATION,handler(e,t){return e.get(h).setActiveComment(t),!0}};var y=`@univerjs/thread-comment-ui`,b=`0.18.0`;let x=`thread-comment-ui.config`;Symbol(x);let S={},C=class extends t.Plugin{constructor(e=S,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},S,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(x,o)}onStarting(){var e;(0,t.mergeOverrideWithDependencies)([[h]],(e=this._config)==null?void 0:e.overrides).forEach(e=>{this._injector.add(e)}),[_,v].forEach(e=>{this._commandService.registerCommand(e)})}};f(C,`pluginName`,`UNIVER_THREAD_COMMENT_UI_PLUGIN`),f(C,`packageName`,y),f(C,`version`,b),f(C,`type`,t.UniverInstanceType.UNIVER_UNKNOWN),C=m([(0,t.DependentOn)(i.UniverThreadCommentPlugin),p(1,(0,t.Inject)(t.Injector)),p(2,t.ICommandService),p(3,t.IConfigService)],C);function w({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...s}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,o.useRef)(`_${O()}`);return T(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...s},a)}function T(e,t,n,r,i){return(0,o.createElement)(e.tag,{key:t,...E(e,n,i),...r},(D(e,n).children||[]).map((r,a)=>T(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function E(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function D(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function O(){return Math.random().toString(36).substring(2,8)}w.displayName=`UniverIcon`;let k={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.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`}}]},A=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`delete-icon`,ref:t,icon:k}))});A.displayName=`DeleteIcon`;let j={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},M=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`increase-icon`,ref:t,icon:j}))});M.displayName=`IncreaseIcon`;let N={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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 8C4 7.44772 3.55228 7 3 7C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M13 9C13.5523 9 14 8.55228 14 8C14 7.44772 13.5523 7 13 7C12.4477 7 12 7.44772 12 8C12 8.55228 12.4477 9 13 9Z`}}]},P=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`more-horizontal-icon`,ref:t,icon:N}))});P.displayName=`MoreHorizontalIcon`;let F={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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.76813`,strokeLinecap:`round`,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M8.91626 6.1311H9.27424`,strokeLinecap:`round`,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M3.90454 6.1311H4.26252`,strokeLinecap:`round`,strokeWidth:1.2}}]},I=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`reply-to-comment-icon`,ref:t,icon:F}))});I.displayName=`ReplyToCommentIcon`;let L={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},R=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`resolved-icon`,ref:t,icon:L}))});R.displayName=`ResolvedIcon`;let z={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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}}]},B=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`solve-icon`,ref:t,icon:z}))});B.displayName=`SolveIcon`;function V(e){return{id:`d`,body:e,documentStyle:{}}}let H=(0,o.forwardRef)((e,r)=>{var i;let{comment:l,onSave:u,id:d,onCancel:f,autoFocus:p,unitId:m,type:h}=e,g=(0,n.useDependency)(t.ICommandService),_=(0,n.useDependency)(t.LocaleService),[y,b]=(0,o.useState)(!1),x=(0,n.useDependency)(s.IEditorService),S=(0,o.useRef)(null),C=h===t.UniverInstanceType.UNIVER_DOC?t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:m,[w,T]=(0,o.useState)(()=>{var e,n;return t.BuildTextUtils.transform.getPlainText((e=(n=S.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e)});(0,o.useEffect)(()=>{var e,n,r;T(t.BuildTextUtils.transform.getPlainText((e=(n=S.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e));let i=(r=S.current)==null?void 0:r.selectionChange$.subscribe(()=>{var e,n;T(t.BuildTextUtils.transform.getPlainText((e=(n=S.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e))});return()=>i==null?void 0:i.unsubscribe()},[(i=S.current)==null?void 0:i.selectionChange$]);let E=(0,o.useMemo)(()=>({keyCodes:[{keyCode:n.KeyCode.ENTER}],handler:e=>{e===n.KeyCode.ENTER&&g.executeCommand(s.BreakLineCommand.id)}}),[g]);return(0,o.useImperativeHandle)(r,()=>({reply(e){var t,n;if(!S.current)return;x.focus((t=S.current.getEditorId())==null?``:t);let r=V(e);(n=S.current)==null||n.setDocumentData(r,[{startOffset:r.body.dataStream.length-2,endOffset:r.body.dataStream.length-2,collapsed:!0}])}})),(0,c.jsxs)(`div`,{onClick:e=>e.preventDefault(),children:[(0,c.jsx)(s.RichTextEditor,{className:`univer-w-full`,editorRef:S,editorId:t.DOCS_COMMENT_EDITOR_UNIT_ID_KEY,autoFocus:p,keyboardEventConfig:E,placeholder:_.t(`threadCommentUI.editor.placeholder`),initialValue:(l==null?void 0:l.text)&&V(l.text),onFocusChange:e=>e&&b(e),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{x.focus(C)},30)}}),y?(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2`,children:[(0,c.jsx)(a.Button,{onClick:()=>{var e;f==null||f(),b(!1),(e=S.current)==null||e.replaceText(``,!0),g.executeCommand(v.id)},children:_.t(`threadCommentUI.editor.cancel`)}),(0,c.jsx)(a.Button,{variant:`primary`,disabled:!w,onClick:()=>{if(S.current){let e=t.Tools.deepClone(S.current.getDocumentData().body);b(!1),u==null||u({...l,text:e}),S.current.replaceText(``),setTimeout(()=>{var e,t;(e=S.current)==null||e.setSelectionRanges([]),(t=S.current)==null||t.blur()},10)}},children:_.t(d?`threadCommentUI.editor.save`:`threadCommentUI.editor.reply`)})]}):null]})}),U=e=>{let{dataStream:t,customRanges:n}=e,r=t.endsWith(`\r
|
|
6
|
+
`)?t.length-2:t.length,i=[],a=0;return n==null||n.forEach(e=>{a<e.startIndex&&i.push({type:`text`,content:t.slice(a,e.startIndex)}),i.push({type:`mention`,content:{label:t.slice(e.startIndex,e.endIndex+1),id:e.rangeId}}),a=e.endIndex+1}),i.push({type:`text`,content:t.slice(a,r)}),i},W=e=>{if(!e)return[];let{paragraphs:n=[]}=e;return n.map((r,i)=>U((0,t.getBodySlice)(e,i===0?0:n[i-1].startIndex+1,r.startIndex)))},G=e=>{let n=``,r=[];return e.forEach(e=>{switch(e.type){case`text`:n+=e.content;break;case`mention`:{let i=n.length;n+=e.content.label;let a=n.length-1;r.push({rangeId:e.content.id,rangeType:t.CustomRangeType.MENTION,startIndex:i,endIndex:a,properties:{},wholeEntity:!0});break}default:break}}),n+=`\r
|
|
7
|
+
`,{textRuns:[],paragraphs:[{startIndex:n.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:n.length-1}],dataStream:n,customRanges:r}},K=`__mock__`,q=e=>{let{item:r,unitId:s,subUnitId:l,editing:u,onEditingChange:d,onReply:f,resolved:p,isRoot:m,onClose:h,onDeleteComment:g,type:_}=e,v=(0,n.useDependency)(t.ICommandService),y=(0,n.useDependency)(t.LocaleService),b=(0,n.useDependency)(t.UserManagerService),x=b.getUser(r.personId),S=(0,n.useObservable)(b.currentUser$),C=(S==null?void 0:S.userID)===r.personId,w=r.id===K,[T,E]=(0,o.useState)(!1),D=(0,n.useConfigValue)(n.UI_PLUGIN_CONFIG_KEY),O=D==null?void 0:D.avatarFallback;return(0,c.jsxs)(`div`,{className:`univer-relative univer-mb-3 univer-pl-[30px]`,onMouseLeave:()=>E(!1),onMouseEnter:()=>E(!0),children:[(0,c.jsx)(`div`,{className:`
|
|
8
|
+
univer-absolute univer-left-0 univer-top-0 univer-size-6 univer-rounded-full univer-bg-cover
|
|
9
|
+
univer-bg-center univer-bg-no-repeat
|
|
10
|
+
`,style:{backgroundImage:`url(${(x==null?void 0:x.avatar)||O})`}}),x?(0,c.jsxs)(`div`,{className:`univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between`,children:[(0,c.jsx)(`div`,{className:`univer-text-sm univer-font-medium univer-leading-5`,children:(x==null?void 0:x.name)||` `}),(0,c.jsxs)(`div`,{children:[w||p?null:T&&x?(0,c.jsx)(`div`,{className:`
|
|
11
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer
|
|
12
|
+
univer-items-center univer-justify-center univer-rounded-sm
|
|
13
|
+
univer-text-base
|
|
14
|
+
hover:univer-bg-gray-50
|
|
15
|
+
`,onClick:()=>f(x),children:(0,c.jsx)(I,{})}):null,C&&!w&&!p?(0,c.jsx)(a.Dropdown,{overlay:(0,c.jsx)(`div`,{className:`univer-rounded-lg`,children:(0,c.jsxs)(`ul`,{className:`
|
|
16
|
+
univer-m-0 univer-box-border univer-grid univer-list-none
|
|
17
|
+
univer-p-1.5 univer-text-sm
|
|
18
|
+
[&_a]:univer-block [&_a]:univer-cursor-pointer
|
|
19
|
+
[&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5
|
|
20
|
+
[&_a]:univer-transition-colors
|
|
21
|
+
`,children:[(0,c.jsx)(`li`,{children:(0,c.jsx)(`a`,{className:`hover:univer-bg-gray-200`,onClick:()=>d==null?void 0:d(!0),children:y.t(`threadCommentUI.item.edit`)})}),(0,c.jsx)(`li`,{children:(0,c.jsx)(`a`,{className:`hover:univer-bg-gray-200`,onClick:()=>{(g==null?void 0:g(r))!==!1&&(v.executeCommand(m?i.DeleteCommentTreeCommand.id:i.DeleteCommentCommand.id,{unitId:s,subUnitId:l,commentId:r.id}),m&&(h==null||h()))},children:y.t(`threadCommentUI.item.delete`)})})]})}),children:(0,c.jsx)(`div`,{className:`
|
|
22
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer
|
|
23
|
+
univer-items-center univer-justify-center univer-rounded-sm
|
|
24
|
+
univer-text-base
|
|
25
|
+
hover:univer-bg-gray-50
|
|
26
|
+
`,children:(0,c.jsx)(P,{})})}):null]})]}):null,(0,c.jsx)(`time`,{className:`
|
|
27
|
+
univer-mb-1 univer-text-xs/normal univer-text-gray-600
|
|
28
|
+
dark:!univer-text-gray-200
|
|
29
|
+
`,children:r.dT}),u?(0,c.jsx)(H,{type:_,id:r.id,comment:r,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:s,subUnitId:l,onSave:({text:e,attachments:t})=>{d==null||d(!1),v.executeCommand(i.UpdateCommentCommand.id,{unitId:s,subUnitId:l,payload:{commentId:r.id,text:e,attachments:t}})}}):(0,c.jsx)(`div`,{className:`
|
|
30
|
+
univer-text-sm univer-text-gray-900
|
|
31
|
+
dark:!univer-text-white
|
|
32
|
+
`,children:W(r.text).map((e,t)=>(0,c.jsx)(`div`,{className:`univer-break-words`,children:e.map((e,t)=>{switch(e.type){case`mention`:return(0,c.jsxs)(`a`,{className:`univer-text-primary-600`,children:[e.content.label,` `]},t);default:return e.content}})},t))})]})},J=e=>{var s,l,u;let{id:d,unitId:f,subUnitId:p,refStr:m,showEdit:h=!0,onClick:g,showHighlight:_,onClose:y,getSubUnitName:b,prefix:x,autoFocus:S,onMouseEnter:C,onMouseLeave:w,onAddComment:T,onDeleteComment:E,onResolve:D,type:O,style:k,full:j}=e,M=(0,n.useDependency)(i.ThreadCommentModel),[N,P]=(0,o.useState)(!1),[F,I]=(0,o.useState)(``);(0,n.useObservable)((0,o.useMemo)(()=>M.commentUpdate$.pipe((0,r.debounceTime)(16)),[M]));let L=d?M.getCommentWithChildren(f,p,d):null,z=(0,n.useDependency)(t.ICommandService),V=(0,n.useDependency)(t.UserManagerService),U=L==null?void 0:L.root.resolved,W=(0,n.useObservable)(V.currentUser$),J=(0,o.useRef)(null),Y=[...L?[L.root]:[{id:K,text:{dataStream:`
|
|
33
|
+
\r`},personId:(s=W==null?void 0:W.userID)==null?``:s,ref:m==null?``:m,dT:``,unitId:f,subUnitId:p,threadId:``}],...(l=L==null?void 0:L.children)==null?[]:l],X=(0,o.useRef)(null),Z=e=>{e.stopPropagation(),U?z.executeCommand(v.id,{unitId:f,subUnitId:p,commentId:d}):z.executeCommand(v.id),z.executeCommand(i.ResolveCommentCommand.id,{unitId:f,subUnitId:p,commentId:d,resolved:!U}),D==null||D(!U)},ee=e=>{e.stopPropagation(),z.executeCommand(v.id),!(L!=null&&L.root&&(E==null?void 0:E(L.root))===!1)&&(z.executeCommand(i.DeleteCommentTreeCommand.id,{unitId:f,subUnitId:p,commentId:d}),y==null||y())};(0,o.useEffect)(()=>w==null?void 0:w(),[]);let Q=b((u=L==null?void 0:L.root.subUnitId)==null?p:u),te=h&&!F&&!U,$=`${m||(L==null?void 0:L.root.ref)||``}${Q?` · `:``}${Q}`;return(0,c.jsxs)(`div`,{id:`${x}-${f}-${p}-${d}`,className:(0,a.clsx)(`
|
|
34
|
+
univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4
|
|
35
|
+
dark:!univer-bg-gray-900 dark:!univer-text-white
|
|
36
|
+
`,a.borderClassName,{"univer-w-[278px]":!j,"univer-w-full":j,"univer-shadow":!U&&(_||N||x===`cell`)}),style:k,onClick:g,onMouseEnter:()=>{C==null||C(),P(!0)},onMouseLeave:()=>{w==null||w(),P(!1)},children:[!U&&_&&(0,c.jsx)(`div`,{className:`
|
|
37
|
+
univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-1.5 univer-rounded-t-md
|
|
38
|
+
univer-bg-yellow-400
|
|
39
|
+
`}),(0,c.jsxs)(`div`,{className:`
|
|
40
|
+
univer-mb-4 univer-flex univer-flex-row univer-items-center univer-justify-between univer-text-sm
|
|
41
|
+
univer-leading-5
|
|
42
|
+
`,children:[(0,c.jsxs)(`div`,{className:`univer-flex univer-flex-1 univer-flex-row univer-items-center univer-overflow-hidden`,children:[(0,c.jsx)(`div`,{className:`
|
|
43
|
+
univer-mr-2 univer-h-3.5 univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0
|
|
44
|
+
univer-rounded-sm univer-bg-yellow-500
|
|
45
|
+
`}),(0,c.jsx)(a.Tooltip,{showIfEllipsis:!0,title:$,children:(0,c.jsx)(`span`,{className:`univer-flex-1 univer-truncate`,children:$})})]}),!!L&&(0,c.jsxs)(`div`,{className:`univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row`,children:[(0,c.jsx)(`div`,{className:(0,a.clsx)(`
|
|
46
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center
|
|
47
|
+
univer-justify-center univer-rounded-[3px] univer-text-base
|
|
48
|
+
hover:univer-bg-gray-50
|
|
49
|
+
dark:hover:!univer-bg-gray-800
|
|
50
|
+
`,{"univer-text-green-500":U}),onClick:Z,children:U?(0,c.jsx)(R,{}):(0,c.jsx)(B,{})}),(W==null?void 0:W.userID)===L.root.personId?(0,c.jsx)(`div`,{className:`
|
|
51
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer
|
|
52
|
+
univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base
|
|
53
|
+
hover:univer-bg-gray-50
|
|
54
|
+
dark:hover:!univer-bg-gray-800
|
|
55
|
+
`,onClick:ee,children:(0,c.jsx)(A,{})}):null]})]}),(0,c.jsx)(`div`,{ref:X,className:(0,a.clsx)(`univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden`,a.scrollbarClassName),children:Y.map(e=>(0,c.jsx)(q,{unitId:f,subUnitId:p,item:e,isRoot:e.id===(L==null?void 0:L.root.id),editing:F===e.id,resolved:L==null?void 0:L.root.resolved,type:O,onClose:y,onEditingChange:t=>{I(t?e.id:``)},onReply:e=>{e&&requestAnimationFrame(()=>{var t;(t=J.current)==null||t.reply(G([{type:`mention`,content:{id:e.userID,label:`@${e.name}`}},{type:`text`,content:` `}]))})},onAddComment:T,onDeleteComment:E},e.id))}),te&&(0,c.jsx)(`div`,{children:(0,c.jsx)(H,{ref:J,type:O,unitId:f,subUnitId:p,onSave:async({text:e,attachments:n})=>{if(!(W!=null&&W.userID)||!(L!=null&&L.root))throw Error(`[ThreadCommentTree] No current user or root comment found`);let r={text:e,attachments:n,dT:(0,i.getDT)(),id:(0,t.generateRandomId)(),ref:m,personId:W==null?void 0:W.userID,parentId:L==null?void 0:L.root.id,unitId:f,subUnitId:p,threadId:L==null?void 0:L.root.threadId};(T==null?void 0:T(r))!==!1&&(await z.executeCommand(i.AddCommentCommand.id,{unitId:f,subUnitId:p,comment:r}),X.current&&(X.current.scrollTop=X.current.scrollHeight))},autoFocus:S||!L,onCancel:()=>{L||y==null||y()}},`${S}`)})]})};e.SetActiveCommentOperation=v,e.THREAD_COMMENT_PANEL=g,e.ThreadCommentPanel=e=>{let{unitId:r,subUnitId$:s,type:l,onAdd:u,getSubUnitName:d,onResolve:f,sortComments:p,onItemLeave:m,onItemEnter:g,disableAdd:_,tempComment:y,onAddComment:b,onDeleteComment:x,showComments:S}=e,[C,w]=(0,o.useState)(`all`),[T,E]=(0,o.useState)(`all`),D=(0,n.useDependency)(t.LocaleService),O=(0,n.useDependency)(t.UserManagerService),k=(0,n.useDependency)(i.ThreadCommentModel),[A,j]=(0,o.useState)(()=>k.getUnit(r)),N=(0,n.useObservable)((0,n.useDependency)(h).activeCommentId$),P=(0,n.useObservable)(k.commentUpdate$),F=(0,n.useDependency)(t.ICommandService),I=(0,n.useObservable)(s),L=(0,o.useRef)(!0),R=`panel`,z=(0,n.useObservable)(O.currentUser$),B=(0,o.useMemo)(()=>{var e;let t=C===`all`?A:(e=A.filter(e=>e.subUnitId===I))==null?[]:e,n=p==null?(e=>e):p,r=t.map(e=>{var t;return{...e.root,children:(t=e.children)==null?[]:t,users:e.relativeUsers}});if(S){let e=new Map;return r.forEach(t=>{e.set(t.id,t)}),[...S,``].map(t=>e.get(t)).filter(Boolean)}else return n(r)},[S,C,A,p,I]),V=(0,o.useMemo)(()=>[...B.filter(e=>!e.resolved),...B.filter(e=>e.resolved)],[B]),H=(0,o.useMemo)(()=>T===`resolved`?V.filter(e=>e.resolved):T===`unsolved`?V.filter(e=>!e.resolved):T===`concern_me`&&z!=null&&z.userID?V.filter(e=>e==null?void 0:e.users.has(z.userID)):V,[V,z==null?void 0:z.userID,T]),U=y?[y,...H]:H,W=U.filter(e=>!e.resolved),G=U.filter(e=>e.resolved),K=T!==`all`||C!==`all`,q=()=>{E(`all`),w(`all`)};(0,o.useEffect)(()=>{r&&j(k.getUnit(r))},[r,k,P]),(0,o.useEffect)(()=>{var e;if(!N)return;if(!L.current){L.current=!0;return}let{unitId:t,subUnitId:n,commentId:r}=N,i=`${R}-${t}-${n}-${r}`;(e=document.getElementById(i))==null||e.scrollIntoView({block:`center`})},[N]);let Y=e=>(0,c.jsx)(J,{prefix:R,getSubUnitName:d,id:e.id,unitId:e.unitId,subUnitId:e.subUnitId,refStr:e.ref,type:l,showEdit:(N==null?void 0:N.commentId)===e.id,showHighlight:(N==null?void 0:N.commentId)===e.id,onClick:()=>{L.current=!1,e.resolved?F.executeCommand(v.id):F.executeCommand(v.id,{unitId:e.unitId,subUnitId:e.subUnitId,commentId:e.id,temp:!1})},onMouseEnter:()=>g==null?void 0:g(e),onMouseLeave:()=>m==null?void 0:m(e),onAddComment:b,onDeleteComment:x,onResolve:t=>f==null?void 0:f(e.id,t)},e.id);return(0,c.jsxs)(`div`,{className:`univer-flex univer-min-h-full univer-flex-col univer-pb-3`,children:[(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-row univer-justify-between`,children:[l===t.UniverInstanceType.UNIVER_SHEET?(0,c.jsx)(a.Select,{borderless:!0,value:C,options:[{value:`current`,label:D.t(`threadCommentUI.filter.sheet.current`)},{value:`all`,label:D.t(`threadCommentUI.filter.sheet.all`)}],onChange:w}):null,(0,c.jsx)(a.Select,{borderless:!0,value:T,options:[{value:`all`,label:D.t(`threadCommentUI.filter.status.all`)},{value:`resolved`,label:D.t(`threadCommentUI.filter.status.resolved`)},{value:`unsolved`,label:D.t(`threadCommentUI.filter.status.unsolved`)},{value:`concern_me`,label:D.t(`threadCommentUI.filter.status.concernMe`)}],onChange:E})]}),U.length===0?(0,c.jsxs)(`div`,{className:`
|
|
56
|
+
univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center
|
|
57
|
+
univer-text-sm univer-text-gray-600
|
|
58
|
+
dark:!univer-text-gray-200
|
|
59
|
+
`,children:[D.t(`threadCommentUI.panel.empty`),K?(0,c.jsx)(`div`,{className:`univer-mt-2 univer-flex univer-flex-row`,children:(0,c.jsx)(a.Button,{onClick:q,children:D.t(`threadCommentUI.panel.reset`)})}):_?null:(0,c.jsx)(`div`,{className:`univer-mt-2 univer-flex univer-flex-row`,children:(0,c.jsxs)(a.Button,{onClick:u,children:[(0,c.jsx)(M,{className:`univer-mr-1.5`}),D.t(`threadCommentUI.panel.addComment`)]})})]}):(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-col univer-gap-3`,children:[W.map(Y),G.length>0&&(0,c.jsx)(`div`,{className:`univer-text-xs`,children:D.t(`threadCommentUI.panel.solved`)}),G.map(Y)]})]})},Object.defineProperty(e,`ThreadCommentPanelService`,{enumerable:!0,get:function(){return h}}),e.ThreadCommentTree=J,e.ToggleSheetCommentPanelOperation=_,Object.defineProperty(e,`UniverThreadCommentUIPlugin`,{enumerable:!0,get:function(){return C}})});
|
|
11
60
|
|
|
12
61
|
// @univerjs/docs-thread-comment-ui/index
|
|
13
|
-
(function(
|
|
14
|
-
`},startOffset:l.startOffset,endOffset:l.endOffset,collapsed:!0,threadId:O};return I==null||I.blur(),a.startAdd(A),t.setActiveComment({unitId:p,subUnitId:C,commentId:O}),!0}},Q={name:"@univerjs/docs-thread-comment-ui",version:"0.17.0"},ce="docs-thread-comment-ui.config",X={};var me=Object.getOwnPropertyDescriptor,le=(e,t,i,n)=>{for(var r=n>1?void 0:n?me(t,i):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(r=d(r)||r);return r},P=(e,t)=>(i,n)=>t(i,n,e);let V=class extends o.Disposable{constructor(e,t,i,n,r,s){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=i,this._docThreadCommentService=n,this._renderManagerService=r,this._threadCommentModel=s,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var i,n,r,s;if(t.id===T.SetTextSelectionsOperation.id){const d=t.params,{unitId:a,ranges:h}=d;if(o.isInternalEditorID(a))return;const f=this._univerInstanceService.getUnit(a,o.UniverInstanceType.UNIVER_DOC),l=h[0];if((e==null?void 0:e.startOffset)===(l==null?void 0:l.startOffset)&&(e==null?void 0:e.endOffset)===(l==null?void 0:l.endOffset))return;if(e=l,l&&f){const{startOffset:I,endOffset:p,collapsed:g}=l;let m;if(g?m=(n=(i=f.getBody())==null?void 0:i.customDecorations)==null?void 0:n.find(C=>C.startIndex<=I&&C.endIndex>=p-1):m=(s=(r=f.getBody())==null?void 0:r.customDecorations)==null?void 0:s.find(C=>C.startIndex<=I&&C.endIndex>=p-1),m){const C=this._threadCommentModel.getComment(a,M,m.id);C&&!C.resolved&&this._commandService.executeCommand($.id,{activeComment:{unitId:a,subUnitId:M,commentId:m.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;this._commandService.executeCommand(_.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var t,i,n,r;if(e){const s=this._univerInstanceService.getUnit(e.unitId);if(s){const d=(t=this._renderManagerService.getRenderById(e.unitId))==null?void 0:t.with(S.DocBackScrollRenderController),a=(n=(i=s.getBody())==null?void 0:i.customDecorations)==null?void 0:n.find(h=>h.id===e.commentId);a&&d&&d.scrollToRange({startOffset:a.startIndex,endOffset:a.endIndex,collapsed:!1})}}(!e||e.commentId!==((r=this._docThreadCommentService.addingComment)==null?void 0:r.id))&&this._docThreadCommentService.endAdd()}))}};V=le([P(0,o.Inject(_.ThreadCommentPanelService)),P(1,o.IUniverInstanceService),P(2,o.ICommandService),P(3,o.Inject(R)),P(4,y.IRenderManagerService),P(5,o.Inject(j.ThreadCommentModel))],V);function ee({ref:e,...t}){const{icon:i,id:n,className:r,extend:s,...d}=t,a=`univerjs-icon univerjs-icon-${n} ${r||""}`.trim(),h=D.useRef(`_${he()}`);return te(i,`${n}`,{defIds:i.defIds,idSuffix:h.current},{ref:e,className:a,...d},s)}function te(e,t,i,n,r){return D.createElement(e.tag,{key:t,...ue(e,i,r),...n},(Ce(e,i).children||[]).map((s,d)=>te(s,`${t}-${e.tag}-${d}`,i,void 0,r)))}function ue(e,t,i){const n={...e.attrs};i!=null&&i.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=i.colorChannel1),e.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(([s,d])=>{s==="mask"&&typeof d=="string"&&(n[s]=d.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});const{defIds:r}=t;return!r||r.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(([s,d])=>{typeof d=="string"&&(n[s]=d.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))})),n}function Ce(e,t){var n;const{defIds:i}=t;return!i||i.length===0?e:e.tag==="defs"&&((n=e.children)!=null&&n.length)?{...e,children:e.children.map(r=>typeof r.attrs.id=="string"&&i&&i.includes(r.attrs.id)?{...r,attrs:{...r.attrs,id:r.attrs.id+t.idSuffix}}:r)}:e}function he(){return Math.random().toString(36).substring(2,8)}ee.displayName="UniverIcon";const ve={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ne=D.forwardRef(function(t,i){return D.createElement(ee,Object.assign({},t,{id:"comment-icon",ref:i,icon:ve}))});ne.displayName="CommentIcon";const fe={[u.RibbonInsertGroup.MEDIA]:{[W.id]:{order:3,menuItemFactory:ae}},[u.ContextMenuPosition.MAIN_AREA]:{[u.ContextMenuGroup.DATA]:{[w.id]:{order:1,menuItemFactory:de}}}};var Ie=Object.getOwnPropertyDescriptor,ge=(e,t,i,n)=>{for(var r=n>1?void 0:n?Ie(t,i):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(r=d(r)||r);return r},Z=(e,t)=>(i,n)=>t(i,n,e);let B=class extends o.Disposable{constructor(e,t,i){super(),this._commandService=e,this._menuManagerService=t,this._componentManager=i,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[H,L,$,w,W].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(fe)}_initComponents(){[[b.componentKey,b],["CommentIcon",ne]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}};B=ge([Z(0,o.ICommandService),Z(1,u.IMenuManagerService),Z(2,o.Inject(u.ComponentManager))],B);var pe=Object.getOwnPropertyDescriptor,Se=(e,t,i,n)=>{for(var r=n>1?void 0:n?pe(t,i):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(r=d(r)||r);return r},x=(e,t)=>(i,n)=>t(i,n,e);let K=class extends o.Disposable{constructor(e,t,i,n,r,s,d){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=i,this._docRenderController=n,this._univerInstanceService=r,this._threadCommentModel=s,this._commandService=d,this._interceptorViewModel(),this._initReRender(),this._initSyncComments()}_initReRender(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var i;if(e){this._docRenderController.reRender(e.unitId);return}const t=(i=this._univerInstanceService.getCurrentUnitForType(o.UniverInstanceType.UNIVER_DOC))==null?void 0:i.getUnitId();t&&this._docRenderController.reRender(t)})),this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{e.type==="resolve"&&this._docRenderController.reRender(e.unitId)}))}_interceptorViewModel(){this._docInterceptorService.intercept(T.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,i)=>{if(!e)return i(e);const{unitId:n,index:r,customDecorations:s}=t,d=this._threadCommentPanelService.activeCommentId,{commentId:a,unitId:h}=d||{},f=s.find(g=>g.id===a),l=this._threadCommentModel.getComment(n,M,e.id);if(!l)return i({...e,show:!1});const I=f&&r>=f.startIndex&&r<=f.endIndex,p=h===n&&e.id===a;return i({...e,active:p||I,show:!l.resolved})}})}_initSyncComments(){var r,s,d;const e=this._context.unit.getUnitId(),t=M,i=(d=(s=(r=this._context.unit.getBody())==null?void 0:r.customDecorations)==null?void 0:s.filter(a=>a.type===o.CustomDecorationType.COMMENT).map(a=>a.id))!=null?d:[];i.forEach(a=>{this._threadCommentModel.getComment(e,t,a)||this._threadCommentModel.addComment(e,t,{id:a,threadId:a,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),i.length&&this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(),M,i);let n=i.sort();this.disposeWithMe(this._commandService.onCommandExecuted(a=>{var h,f,l;if(a.id===T.RichTextEditingMutation.id){if(a.params.unitId!==this._context.unit.getUnitId())return;const p=(l=(f=(h=this._context.unit.getBody())==null?void 0:h.customDecorations)==null?void 0:f.filter(m=>m.type===o.CustomDecorationType.COMMENT).map(m=>m.id))!=null?l:[],g=p.sort();if(JSON.stringify(n)!==JSON.stringify(g)){const m=new Set(n),C=new Set(g),O=new Set,A=new Set;p.forEach(v=>{m.has(v)||O.add(v)}),n.forEach(v=>{C.has(v)||A.add(v)}),n=g,O.forEach(v=>{this._threadCommentModel.getComment(e,t,v)||this._threadCommentModel.addComment(e,t,{id:v,threadId:v,ref:"",dT:"",personId:"",text:{dataStream:""},unitId:e,subUnitId:t})}),this._threadCommentModel.syncThreadComments(e,t,[...O])}}}))}};K=Se([x(1,o.Inject(T.DocInterceptorService)),x(2,o.Inject(_.ThreadCommentPanelService)),x(3,o.Inject(S.DocRenderController)),x(4,o.IUniverInstanceService),x(5,o.Inject(j.ThreadCommentModel)),x(6,o.ICommandService)],K);var _e=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,De=(e,t,i)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Me=(e,t,i,n)=>{for(var r=n>1?void 0:n?Te(t,i):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(r=d(r)||r);return r},G=(e,t)=>(i,n)=>t(i,n,e),q=(e,t,i)=>De(e,typeof t!="symbol"?t+"":t,i);c.UniverDocsThreadCommentUIPlugin=class extends o.Plugin{constructor(t=X,i,n,r){super(),this._config=t,this._injector=i,this._renderManagerSrv=n,this._configService=r;const{menu:s,...d}=o.merge({},X,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(ce,d)}onStarting(){[[B],[V],[R]].forEach(t=>{this._injector.add(t)})}onRendered(){this._initRenderModule(),this._injector.get(V),this._injector.get(B)}_initRenderModule(){[K].forEach(t=>{this._renderManagerSrv.registerRenderModule(o.UniverInstanceType.UNIVER_DOC,t)})}},q(c.UniverDocsThreadCommentUIPlugin,"pluginName",re),q(c.UniverDocsThreadCommentUIPlugin,"packageName",Q.name),q(c.UniverDocsThreadCommentUIPlugin,"version",Q.version),q(c.UniverDocsThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_DOC),c.UniverDocsThreadCommentUIPlugin=Me([o.DependentOn(_.UniverThreadCommentUIPlugin),G(1,o.Inject(o.Injector)),G(2,y.IRenderManagerService),G(3,o.IConfigService)],c.UniverDocsThreadCommentUIPlugin),c.AddDocCommentComment=H,c.DeleteDocCommentComment=L,c.ShowCommentPanelOperation=$,c.StartAddCommentOperation=w,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
|
|
15
|
-
|
|
62
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/docs-ui`),require(`@univerjs/thread-comment`),require(`@univerjs/thread-comment-ui`),require(`@univerjs/docs`),require(`@univerjs/engine-render`),require(`@univerjs/ui`),require(`rxjs`),require(`react`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/docs-ui`,`@univerjs/thread-comment`,`@univerjs/thread-comment-ui`,`@univerjs/docs`,`@univerjs/engine-render`,`@univerjs/ui`,`rxjs`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsThreadCommentUi={},e.UniverCore,e.UniverDocsUi,e.UniverThreadComment,e.UniverThreadCommentUi,e.UniverDocs,e.UniverEngineRender,e.UniverUi,e.rxjs,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let d=`default_doc`,f={id:`docs.command.add-comment`,type:t.CommandType.COMMAND,async handler(e,a){if(!a)return!1;let{comment:o,unitId:s}=a,c=await e.get(r.IThreadCommentDataSourceService).addComment(o),l=e.get(t.ICommandService),u=(0,n.addCustomDecorationBySelectionFactory)(e,{id:c.threadId,type:t.CustomDecorationType.COMMENT,unitId:s});return u?(await(0,t.sequenceExecute)([{id:r.AddCommentMutation.id,params:{unitId:s,subUnitId:d,comment:c}},u,{id:i.SetActiveCommentOperation.id,params:{unitId:s,subUnitId:d,commentId:c.id}}],l)).result:!1}},p={id:`docs.command.delete-comment`,type:t.CommandType.COMMAND,async handler(e,r){if(!r)return!1;let{commentId:i,unitId:a}=r,o=e.get(t.ICommandService),s=(0,n.deleteCustomDecorationFactory)(e,{id:i,unitId:a});return s?(await(0,t.sequenceExecute)([s],o)).result:!1}};function m(e){"@babel/helpers - typeof";return m=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},m(e)}function h(e,t){if(m(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(m(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function g(e){var t=h(e,`string`);return m(t)==`symbol`?t:t+``}function _(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e,t){return function(n,r){t(n,r,e)}}function y(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let b=class extends t.Disposable{get addingComment(){return this._addingComment$.getValue()}constructor(e,t){super(),this._sidebarService=e,this._threadCommentPanelService=t,_(this,`_addingComment$`,new c.BehaviorSubject(void 0)),_(this,`addingComment$`,this._addingComment$.asObservable()),this.disposeWithMe(()=>{this._addingComment$.complete()})}startAdd(e){this._addingComment$.next(e)}endAdd(){this._addingComment$.next(void 0)}};b=y([v(0,s.ISidebarService),v(1,(0,t.Inject)(i.ThreadCommentPanelService))],b);let x=e=>{var n;let r=e.get(o.IRenderManagerService),i=e.get(a.DocSelectionManagerService),s=(n=(0,o.withCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_DOC,a.DocSkeletonManagerService,e.get(t.IUniverInstanceService),r))==null?void 0:n.getSkeleton(),c=s==null?void 0:s.getViewModel().getEditArea();if(c===o.DocumentEditArea.FOOTER||c===o.DocumentEditArea.HEADER)return!0;let l=i.getActiveTextRange();return!!(l==null||l.collapsed)};function S(e){return{id:D.id,type:s.MenuItemType.BUTTON,icon:`CommentIcon`,title:`threadCommentUI.panel.addComment`,tooltip:`threadCommentUI.panel.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_DOC,void 0,t.SHEET_EDITOR_UNITS),disabled$:new c.Observable(function(t){let n=e.get(a.DocSelectionManagerService).textSelection$.pipe((0,c.debounceTime)(16)).subscribe(()=>{t.next(x(e))});return()=>{n.unsubscribe()}})}}function C(e){return{id:E.id,type:s.MenuItemType.BUTTON,icon:`CommentIcon`,title:`threadCommentUI.panel.addComment`,tooltip:`threadCommentUI.panel.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_DOC)}}let w=()=>{let e=(0,s.useDependency)(t.IUniverInstanceService),n=(0,s.useDependency)(t.Injector),r=(0,s.useObservable)((0,l.useMemo)(()=>e.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_DOC).pipe((0,c.filter)(e=>!!e&&!(0,t.isInternalEditorID)(e.getUnitId()))),[e])),o=(0,l.useMemo)(()=>new c.Observable(e=>e.next(d)),[]),m=(0,s.useDependency)(a.DocSelectionManagerService);(0,s.useObservable)((0,l.useMemo)(()=>m.textSelection$.pipe((0,c.debounceTime)(16)),[m.textSelection$]));let h=(0,s.useDependency)(t.ICommandService),g=(0,s.useDependency)(b),_=(0,s.useObservable)(g.addingComment$),[v,y]=(0,l.useState)([]);if((0,l.useEffect)(()=>{var e;let t=new Set,n=r==null?void 0:r.getCustomDecorations();y((e=n==null?void 0:n.map(e=>e.id).filter(e=>{let n=t.has(e);return t.add(e),!n}))==null?[]:e);let i=h.onCommandExecuted(e=>{if(e.id===a.RichTextEditingMutation.id){var t;let e=new Set,n=r==null?void 0:r.getCustomDecorations();y((t=n==null?void 0:n.map(e=>e.id).filter(t=>{let n=e.has(t);return e.add(t),!n}))==null?[]:t)}});return()=>{i.dispose()}},[h,r]),!r)return null;let S=x(n),C=r.getUnitId();return(0,u.jsx)(i.ThreadCommentPanel,{unitId:C,subUnitId$:o,type:t.UniverInstanceType.UNIVER_DOC,onAdd:()=>{h.executeCommand(D.id)},getSubUnitName:()=>``,disableAdd:S,tempComment:_,onAddComment:e=>{if(!e.parentId){let t={unitId:C,range:_,comment:e};return h.executeCommand(f.id,t),g.endAdd(),!1}return!0},onDeleteComment:e=>{if(!e.parentId){let t={unitId:C,commentId:e.id};return h.executeCommand(p.id,t),!1}return!0},showComments:v})};w.componentKey=`univer.doc.thread-comment-panel`;let T={id:`docs.operation.show-comment-panel`,type:t.CommandType.OPERATION,handler(e,t){var n;let r=e.get(i.ThreadCommentPanelService),a=e.get(s.ISidebarService);return(!r.panelVisible||((n=a.options.children)==null?void 0:n.label)!==w.componentKey)&&(a.open({header:{title:`threadCommentUI.panel.title`},children:{label:w.componentKey},width:320,onClose:()=>r.setPanelVisible(!1)}),r.setPanelVisible(!0)),t&&r.setActiveComment(t==null?void 0:t.activeComment),!0}},E={id:`docs.operation.toggle-comment-panel`,type:t.CommandType.OPERATION,handler(e){var t;let n=e.get(i.ThreadCommentPanelService),r=e.get(s.ISidebarService);return!n.panelVisible||((t=r.options.children)==null?void 0:t.label)!==w.componentKey?(r.open({header:{title:`threadCommentUI.panel.title`},children:{label:w.componentKey},width:320,onClose:()=>n.setPanelVisible(!1)}),n.setPanelVisible(!0)):(r.close(),n.setPanelVisible(!1),n.setActiveComment(null)),!0}},D={id:`docs.operation.start-add-comment`,type:t.CommandType.OPERATION,handler(e){var c,l,u;let f=e.get(i.ThreadCommentPanelService),p=e.get(t.IUniverInstanceService).getCurrentUnitForType(t.UniverInstanceType.UNIVER_DOC),m=e.get(a.DocSelectionManagerService),h=e.get(o.IRenderManagerService),g=e.get(t.UserManagerService),_=e.get(b),v=e.get(t.ICommandService),y=e.get(s.ISidebarService),x=m.getActiveTextRange();if(!p||!x)return!1;let S=(c=h.getRenderById(p.getUnitId()))==null?void 0:c.with(n.DocSelectionRenderService);if(S==null||S.setReserveRangesStatus(!0),x.collapsed)return f.panelVisible?(f.setPanelVisible(!1),y.close()):v.executeCommand(T.id),!0;v.executeCommand(T.id);let C=p.getUnitId(),w=((l=(u=p.getBody())==null?void 0:u.dataStream)==null?``:l).slice(x.startOffset,x.endOffset),E=t.BuildTextUtils.transform.getPlainText(w),D=d,O={unitId:C,subUnitId:D,id:``,ref:E,dT:(0,r.getDT)(),personId:g.getCurrentUser().userID,text:{dataStream:`\r
|
|
63
|
+
`},startOffset:x.startOffset,endOffset:x.endOffset,collapsed:!0,threadId:``};return S==null||S.blur(),_.startAdd(O),f.setActiveComment({unitId:C,subUnitId:D,commentId:``}),!0}};var O=`@univerjs/docs-thread-comment-ui`,k=`0.18.0`;let A=`docs-thread-comment-ui.config`;Symbol(A);let j={},M=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=n,this._docThreadCommentService=r,this._renderManagerService=i,this._threadCommentModel=a,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===a.SetTextSelectionsOperation.id){let{unitId:a,ranges:s}=n.params;if((0,t.isInternalEditorID)(a))return;let c=this._univerInstanceService.getUnit(a,t.UniverInstanceType.UNIVER_DOC),l=s[0];if((e==null?void 0:e.startOffset)===(l==null?void 0:l.startOffset)&&(e==null?void 0:e.endOffset)===(l==null?void 0:l.endOffset))return;if(e=l,l&&c){let{startOffset:e,endOffset:t,collapsed:n}=l,i;if(n){var r;i=(r=c.getBody())==null||(r=r.customDecorations)==null?void 0:r.find(n=>n.startIndex<=e&&n.endIndex>=t-1)}else{var o;i=(o=c.getBody())==null||(o=o.customDecorations)==null?void 0:o.find(n=>n.startIndex<=e&&n.endIndex>=t-1)}if(i){let e=this._threadCommentModel.getComment(a,d,i.id);e&&!e.resolved&&this._commandService.executeCommand(T.id,{activeComment:{unitId:a,subUnitId:d,commentId:i.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;this._commandService.executeCommand(i.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var t;if(e){let t=this._univerInstanceService.getUnit(e.unitId);if(t){var r,i;let a=(r=this._renderManagerService.getRenderById(e.unitId))==null?void 0:r.with(n.DocBackScrollRenderController),o=(i=t.getBody())==null||(i=i.customDecorations)==null?void 0:i.find(t=>t.id===e.commentId);o&&a&&a.scrollToRange({startOffset:o.startIndex,endOffset:o.endIndex,collapsed:!1})}}(!e||e.commentId!==((t=this._docThreadCommentService.addingComment)==null?void 0:t.id))&&this._docThreadCommentService.endAdd()}))}};M=y([v(0,(0,t.Inject)(i.ThreadCommentPanelService)),v(1,t.IUniverInstanceService),v(2,t.ICommandService),v(3,(0,t.Inject)(b)),v(4,o.IRenderManagerService),v(5,(0,t.Inject)(r.ThreadCommentModel))],M);function N({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,s=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),c=(0,l.useRef)(`_${L()}`);return P(n,`${r}`,{defIds:n.defIds,idSuffix:c.current},{ref:e,className:s,...o},a)}function P(e,t,n,r,i){return(0,l.createElement)(e.tag,{key:t,...F(e,n,i),...r},(I(e,n).children||[]).map((r,a)=>P(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function F(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function I(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function L(){return Math.random().toString(36).substring(2,8)}N.displayName=`UniverIcon`;let R={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 17`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},z=(0,l.forwardRef)(function(e,t){return(0,l.createElement)(N,Object.assign({},e,{id:`comment-icon`,ref:t,icon:R}))});z.displayName=`CommentIcon`;let B={[s.RibbonInsertGroup.MEDIA]:{[E.id]:{order:3,menuItemFactory:C}},[s.ContextMenuPosition.MAIN_AREA]:{[s.ContextMenuGroup.DATA]:{[D.id]:{order:1,menuItemFactory:S}}}},V=class extends t.Disposable{constructor(e,t,n){super(),this._commandService=e,this._menuManagerService=t,this._componentManager=n,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[f,p,T,D,E].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(B)}_initComponents(){[[w.componentKey,w],[`CommentIcon`,z]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}};V=y([v(0,t.ICommandService),v(1,s.IMenuManagerService),v(2,(0,t.Inject)(s.ComponentManager))],V);let H=class extends t.Disposable{constructor(e,t,n,r,i,a,o){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=n,this._docRenderController=r,this._univerInstanceService=i,this._threadCommentModel=a,this._commandService=o,this._interceptorViewModel(),this._initReRender(),this._initSyncComments()}_initReRender(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var n;if(e){this._docRenderController.reRender(e.unitId);return}let r=(n=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_DOC))==null?void 0:n.getUnitId();r&&this._docRenderController.reRender(r)})),this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{e.type===`resolve`&&this._docRenderController.reRender(e.unitId)}))}_interceptorViewModel(){this._docInterceptorService.intercept(a.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,n)=>{if(!e)return n(e);let{unitId:r,index:i,customDecorations:a}=t,{commentId:o,unitId:s}=this._threadCommentPanelService.activeCommentId||{},c=a.find(e=>e.id===o),l=this._threadCommentModel.getComment(r,d,e.id);if(!l)return n({...e,show:!1});let u=c&&i>=c.startIndex&&i<=c.endIndex,f=s===r&&e.id===o;return n({...e,active:f||u,show:!l.resolved})}})}_initSyncComments(){var e,n;let r=this._context.unit.getUnitId(),i=d,o=(e=(n=this._context.unit.getBody())==null||(n=n.customDecorations)==null?void 0:n.filter(e=>e.type===t.CustomDecorationType.COMMENT).map(e=>e.id))==null?[]:e;o.forEach(e=>{this._threadCommentModel.getComment(r,i,e)||this._threadCommentModel.addComment(r,i,{id:e,threadId:e,ref:``,dT:``,personId:``,text:{dataStream:``},unitId:r,subUnitId:i})}),o.length&&this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(),`default_doc`,o);let s=o.sort();this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id===a.RichTextEditingMutation.id){var n,o;if(e.params.unitId!==this._context.unit.getUnitId())return;let a=(n=(o=this._context.unit.getBody())==null||(o=o.customDecorations)==null?void 0:o.filter(e=>e.type===t.CustomDecorationType.COMMENT).map(e=>e.id))==null?[]:n,c=a.sort();if(JSON.stringify(s)!==JSON.stringify(c)){let e=new Set(s),t=new Set(c),n=new Set,o=new Set;a.forEach(t=>{e.has(t)||n.add(t)}),s.forEach(e=>{t.has(e)||o.add(e)}),s=c,n.forEach(e=>{this._threadCommentModel.getComment(r,i,e)||this._threadCommentModel.addComment(r,i,{id:e,threadId:e,ref:``,dT:``,personId:``,text:{dataStream:``},unitId:r,subUnitId:i})}),this._threadCommentModel.syncThreadComments(r,i,[...n])}}}))}};H=y([v(1,(0,t.Inject)(a.DocInterceptorService)),v(2,(0,t.Inject)(i.ThreadCommentPanelService)),v(3,(0,t.Inject)(n.DocRenderController)),v(4,t.IUniverInstanceService),v(5,(0,t.Inject)(r.ThreadCommentModel)),v(6,t.ICommandService)],H);let U=class extends t.Plugin{constructor(e=j,n,r,i){super(),this._config=e,this._injector=n,this._renderManagerSrv=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},j,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(A,o)}onStarting(){[[V],[M],[b]].forEach(e=>{this._injector.add(e)})}onRendered(){this._initRenderModule(),this._injector.get(M),this._injector.get(V)}_initRenderModule(){[H].forEach(e=>{this._renderManagerSrv.registerRenderModule(t.UniverInstanceType.UNIVER_DOC,e)})}};_(U,`pluginName`,`DOC_THREAD_COMMENT_UI_PLUGIN`),_(U,`packageName`,O),_(U,`version`,k),_(U,`type`,t.UniverInstanceType.UNIVER_DOC),U=y([(0,t.DependentOn)(i.UniverThreadCommentUIPlugin),v(1,(0,t.Inject)(t.Injector)),v(2,o.IRenderManagerService),v(3,t.IConfigService)],U),e.AddDocCommentComment=f,e.DeleteDocCommentComment=p,e.ShowCommentPanelOperation=T,e.StartAddCommentOperation=D,Object.defineProperty(e,`UniverDocsThreadCommentUIPlugin`,{enumerable:!0,get:function(){return U}})});
|
|
16
64
|
|
|
17
65
|
// index
|
|
18
66
|
(function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@univerjs/docs-thread-comment-ui"),require("@univerjs/thread-comment-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/docs-thread-comment-ui","@univerjs/thread-comment-ui"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e.UniverPresetDocsThreadComment={},e.UniverDocsThreadCommentUi,e.UniverThreadCommentUi))})(this,(function(e,n,i){"use strict";function t(r={}){return{plugins:[i.UniverThreadCommentUIPlugin,n.UniverDocsThreadCommentUIPlugin]}}e.UniverDocsThreadCommentPreset=t,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
package/lib/umd/locales/ca-ES.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/ca-ES
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiCaES=t())})(this,function(){return{threadCommentUI:{panel:{title:`Gestió de comentaris`,empty:`Encara no hi ha comentaris`,filterEmpty:`Cap resultat coincident`,reset:`Restableix el filtre`,addComment:`Afegeix un comentari`,solved:`Resolut`},editor:{placeholder:`Respon o afegeix altres amb @`,reply:`Comenta`,cancel:`Cancel·la`,save:`Desa`},item:{edit:`Edita`,delete:`Elimina aquest comentari`},filter:{sheet:{all:`Tots els fulls`,current:`Full actual`},status:{all:`Tots els comentaris`,resolved:`Resolts`,unsolved:`No resolts`,concernMe:`Em concerneix`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/ca-ES
|
|
6
5
|
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/ca-ES")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/ca-ES"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentCaES=n(e.UniverCore,e.UniverThreadCommentUiCaES))})(this,(function(e,n){"use strict";return e.mergeLocales(n)}));
|
package/lib/umd/locales/en-US.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/en-US
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiEnUS=t())})(this,function(){return{threadCommentUI:{panel:{title:`Comment Management`,empty:`No comments yet`,filterEmpty:`No match result`,reset:`Reset Filter`,addComment:`Add Comment`,solved:`Solved`},editor:{placeholder:`Reply or add others with @`,reply:`Comment`,cancel:`Cancel`,save:`Save`},item:{edit:`Edit`,delete:`Delete This Comment`},filter:{sheet:{all:`All sheet`,current:`Current sheet`},status:{all:`All comments`,resolved:`Resolved`,unsolved:`Not resolved`,concernMe:`Concern me`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/en-US
|
|
6
5
|
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/en-US")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/en-US"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentEnUS=n(e.UniverCore,e.UniverThreadCommentUiEnUS))})(this,(function(e,n){"use strict";return e.mergeLocales(n)}));
|
package/lib/umd/locales/es-ES.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/es-ES
|
|
2
|
-
(function(e,
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiEsES=t())})(this,function(){return{threadCommentUI:{panel:{title:`Gestión de comentarios`,empty:`Aún no hay comentarios`,filterEmpty:`Sin resultados coincidentes`,reset:`Restablecer filtro`,addComment:`Añadir comentario`,solved:`Resuelto`},editor:{placeholder:`Responde o añade a otros con @`,reply:`Comentar`,cancel:`Cancelar`,save:`Guardar`},item:{edit:`Editar`,delete:`Eliminar este comentario`},filter:{sheet:{all:`Todas las hojas`,current:`Hoja actual`},status:{all:`Todos los comentarios`,resolved:`Resueltos`,unsolved:`No resueltos`,concernMe:`Me concierne`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/es-ES
|
|
6
5
|
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/es-ES")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/es-ES"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentEsES=n(e.UniverCore,e.UniverThreadCommentUiEsES))})(this,(function(e,n){"use strict";return e.mergeLocales(n)}));
|
package/lib/umd/locales/fa-IR.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/fa-IR
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiFaIR=t())})(this,function(){return{threadCommentUI:{panel:{title:`مدیریت نظرات`,empty:`هنوز نظری وجود ندارد`,filterEmpty:`نتیجه ای یافت نشد`,reset:`بازنشانی فیلتر`,addComment:`افزودن نظر`,solved:`حل شده`},editor:{placeholder:`پاسخ یا اضافه کردن دیگران با @`,reply:`نظر`,cancel:`انصراف`,save:`ذخیره`},item:{edit:`ویرایش`,delete:`حذف این نظر`},filter:{sheet:{all:`همه برگهها`,current:`برگه فعلی`},status:{all:`همه نظرات`,resolved:`حل شده`,unsolved:`حل نشده`,concernMe:`موضوع مربوط به من`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/fa-IR
|
|
6
5
|
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/fa-IR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/fa-IR"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentFaIR=n(e.UniverCore,e.UniverThreadCommentUiFaIR))})(this,(function(e,n){"use strict";return e.mergeLocales(n)}));
|
package/lib/umd/locales/fr-FR.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/fr-FR
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiFrFR=t())})(this,function(){return{threadCommentUI:{panel:{title:`Gestion des commentaires`,empty:`Pas encore de commentaires`,filterEmpty:`Aucun résultat correspondant`,reset:`Réinitialiser le filtre`,addComment:`Ajouter un commentaire`,solved:`Résolu`},editor:{placeholder:`Répondre ou ajouter d'autres avec @`,reply:`Commenter`,cancel:`Annuler`,save:`Enregistrer`},item:{edit:`Modifier`,delete:`Supprimer ce commentaire`},filter:{sheet:{all:`Toutes les feuilles`,current:`Feuille actuelle`},status:{all:`Tous les commentaires`,resolved:`Résolu`,unsolved:`Non résolu`,concernMe:`Me concerne`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/fr-FR
|
|
6
5
|
(function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/fr-FR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/fr-FR"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentFrFR=r(e.UniverCore,e.UniverThreadCommentUiFrFR))})(this,(function(e,r){"use strict";return e.mergeLocales(r)}));
|
package/lib/umd/locales/ja-JP.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/ja-JP
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiJaJP=t())})(this,function(){return{threadCommentUI:{panel:{title:`コメント管理`,empty:`まだコメントはありません`,filterEmpty:`一致する結果がありません`,reset:`フィルタをリセット`,addComment:`コメントを追加`,solved:`解決済み`},editor:{placeholder:`返信または@で他のユーザーを追加`,reply:`返信`,cancel:`キャンセル`,save:`保存`},item:{edit:`編集`,delete:`コメントを削除`},filter:{sheet:{all:`すべてのシート`,current:`現在のシート`},status:{all:`すべてのコメント`,resolved:`解決済み`,unsolved:`未解決`,concernMe:`自分に関連`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/ja-JP
|
|
6
5
|
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/ja-JP")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/ja-JP"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentJaJP=n(e.UniverCore,e.UniverThreadCommentUiJaJP))})(this,(function(e,n){"use strict";return e.mergeLocales(n)}));
|
package/lib/umd/locales/ko-KR.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/ko-KR
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiKoKR=t())})(this,function(){return{threadCommentUI:{panel:{title:`댓글 관리`,empty:`아직 댓글이 없습니다`,filterEmpty:`일치하는 결과가 없습니다`,reset:`필터 초기화`,addComment:`댓글 추가`,solved:`해결됨`},editor:{placeholder:`답변 또는 @로 다른 사람 추가`,reply:`댓글`,cancel:`취소`,save:`저장`},item:{edit:`편집`,delete:`댓글 삭제`},filter:{sheet:{all:`모든 시트`,current:`현재 시트`},status:{all:`모든 댓글`,resolved:`해결됨`,unsolved:`해결되지 않음`,concernMe:`나에게 관련됨`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/ko-KR
|
|
6
5
|
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/ko-KR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/ko-KR"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentKoKR=n(e.UniverCore,e.UniverThreadCommentUiKoKR))})(this,(function(e,n){"use strict";return e.mergeLocales(n)}));
|
package/lib/umd/locales/ru-RU.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/ru-RU
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiRuRU=t())})(this,function(){return{threadCommentUI:{panel:{title:`Управление комментариями`,empty:`Комментариев пока нет`,filterEmpty:`Нет совпадений`,reset:`Сбросить фильтр`,addComment:`Добавить комментарий`,solved:`Решено`},editor:{placeholder:`Отметьте пользователей через @`,reply:`Добавить комментарий`,cancel:`Отмена`,save:`Сохранить`},item:{edit:`Редактировать`,delete:`Удалить`},filter:{sheet:{all:`Все листы`,current:`Текущий лист`},status:{all:`Все комментарии`,resolved:`Решено`,unsolved:`Не решено`,concernMe:`Относящиеся ко мне`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/ru-RU
|
|
6
5
|
(function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/ru-RU")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/ru-RU"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentRuRU=r(e.UniverCore,e.UniverThreadCommentUiRuRU))})(this,(function(e,r){"use strict";return e.mergeLocales(r)}));
|
package/lib/umd/locales/sk-SK.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/sk-SK
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiSkSK=t())})(this,function(){return{threadCommentUI:{panel:{title:`Správa komentárov`,empty:`Zatiaľ žiadne komentáre`,filterEmpty:`Žiadne zodpovedajúce výsledky`,reset:`Obnoviť filter`,addComment:`Pridať komentár`,solved:`Vyriešené`},editor:{placeholder:`Odpovedzte alebo pridajte ostatných pomocou @`,reply:`Komentovať`,cancel:`Zrušiť`,save:`Uložiť`},item:{edit:`Upraviť`,delete:`Odstrániť tento komentár`},filter:{sheet:{all:`Všetky hárky`,current:`Aktuálny hárok`},status:{all:`Všetky komentáre`,resolved:`Vyriešené`,unsolved:`Nevyriešené`,concernMe:`Týka sa ma`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/sk-SK
|
|
6
5
|
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/sk-SK")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/sk-SK"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentSkSK=n(e.UniverCore,e.UniverThreadCommentUiSkSK))})(this,(function(e,n){"use strict";return e.mergeLocales(n)}));
|
package/lib/umd/locales/vi-VN.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/vi-VN
|
|
2
|
-
(function(e,
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiViVN=t())})(this,function(){return{threadCommentUI:{panel:{title:`Quản lý Bình luận`,empty:`Chưa có bình luận`,filterEmpty:`Không có kết quả phù hợp`,reset:`Đặt lại`,addComment:`Thêm bình luận`,solved:`Đã giải quyết`},editor:{placeholder:`Phản hồi`,reply:`Phản hồi`,cancel:`Hủy`,save:`Lưu`},item:{edit:`Chỉnh sửa`,delete:`Xóa`},filter:{sheet:{all:`Tất cả bảng`,current:`Bảng hiện tại`},status:{all:`Tất cả bình luận`,resolved:`Đã giải quyết`,unsolved:`Chưa giải quyết`,concernMe:`Liên quan đến tôi`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/vi-VN
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/vi-VN")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/vi-VN"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentViVN=i(e.UniverCore,e.UniverThreadCommentUiViVN))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/zh-CN.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/zh-CN
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiZhCN=t())})(this,function(){return{threadCommentUI:{panel:{title:`评论管理`,empty:`暂无评论`,filterEmpty:`没有匹配的结果`,reset:`重置`,addComment:`添加评论`,solved:`已解决`},editor:{placeholder:`回复`,reply:`回复`,cancel:`取消`,save:`保存`},item:{edit:`编辑`,delete:`删除`},filter:{sheet:{all:`所有表格`,current:`当前表格`},status:{all:`所有评论`,resolved:`已解决`,unsolved:`未解决`,concernMe:`与我有关`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/zh-CN
|
|
6
5
|
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/zh-CN")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/zh-CN"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentZhCN=n(e.UniverCore,e.UniverThreadCommentUiZhCN))})(this,(function(e,n){"use strict";return e.mergeLocales(n)}));
|
package/lib/umd/locales/zh-TW.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/thread-comment-ui/locale/zh-TW
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiZhTW=t())})(this,function(){return{threadCommentUI:{panel:{title:`評論管理`,empty:`暫無評論`,filterEmpty:`沒有符合的結果`,reset:`重置`,addComment:`新增評論`,solved:`已解決`},editor:{placeholder:`回覆`,reply:`回覆`,cancel:`取消`,save:`儲存`},item:{edit:`編輯`,delete:`刪除`},filter:{sheet:{all:`所有表格`,current:`當前表格`},status:{all:`所有評論`,resolved:`已解決`,unsolved:`未解決`,concernMe:`與我有關`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/zh-TW
|
|
6
5
|
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/thread-comment-ui/locale/zh-TW")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/thread-comment-ui/locale/zh-TW"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsThreadCommentZhTW=n(e.UniverCore,e.UniverThreadCommentUiZhTW))})(this,(function(e,n){"use strict";return e.mergeLocales(n)}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/preset-docs-thread-comment",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -58,17 +58,17 @@
|
|
|
58
58
|
"rxjs": ">=7.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@univerjs/docs-thread-comment-ui": "0.
|
|
62
|
-
"@univerjs/thread-comment": "0.
|
|
63
|
-
"@univerjs/thread-comment-ui": "0.
|
|
61
|
+
"@univerjs/docs-thread-comment-ui": "0.18.0",
|
|
62
|
+
"@univerjs/thread-comment": "0.18.0",
|
|
63
|
+
"@univerjs/thread-comment-ui": "0.18.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@univerjs/core": "0.
|
|
66
|
+
"@univerjs/core": "0.18.0",
|
|
67
67
|
"react": "18.3.1",
|
|
68
68
|
"react-dom": "18.3.1",
|
|
69
69
|
"rxjs": "7.8.2",
|
|
70
70
|
"typescript": "^5.9.3",
|
|
71
|
-
"@univerjs-infra/shared": "0.
|
|
71
|
+
"@univerjs-infra/shared": "0.18.0"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"prebuild:preset": "tsx prepare.ts",
|