@ehfuse/taskbox 0.11.37 → 0.11.38
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/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -8,7 +8,7 @@ import{a as Ua,b as Jp,c as Em,d as dA,e as pA,f as fA,g as gA,h as xA}from"./ch
|
|
|
8
8
|
|
|
9
9
|
`).trim()}function va(e){return Sa(e)?Pl(e):e}function Ml(e){let t=BR(qc(e)).trim(),o=Pl(t);return o.trim()?/<(?!\/?(p|br|span)(\s|>|\/))[a-z]/i.test(t)||/<span[^>]*style=/i.test(t)?t:o:""}var vR=new Set(["P","DIV","UL","OL","H1","H2","H3","H4","BLOCKQUOTE","PRE"]);function BR(e){if(typeof DOMParser>"u")return e;let t=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html"),o=t.body.firstElementChild;if(!o)return e;let i=null;for(let r of Array.from(o.childNodes)){if(r.nodeType===Node.ELEMENT_NODE&&vR.has(r.tagName)){i=null;continue}i||(i=t.createElement("p"),o.insertBefore(i,r)),i.appendChild(r)}for(let r of Array.from(o.querySelectorAll(":scope > p")))!r.textContent?.replace(/\u00a0/g," ").trim()&&!r.querySelector("br, img")&&r.remove();return o.innerHTML}function Qd(e){let t=i=>i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return e.split(`
|
|
10
10
|
`).map(i=>`<p>${i?t(i):"<br>"}</p>`).join("")}import{jsx as ep,jsxs as ER}from"react/jsx-runtime";var DR={left:[["heading"],["bold","italic","strike","underline"],["link","bgcolor","code"],["bulletList","numberList"]],right:[]},Jd="<p><br></p>",zc=_R(function({defaultHtml:t="",placeholder:o,alwaysExpanded:i=!1,autoFocus:r=!1,minHeight:a=44,maxHeight:l=280,onChange:s,onSubmit:c,onFiles:u,footer:m,variant:d="bare",mentionCandidates:p,slashCommands:f},g){let x=Nc(null),b=Nc(null),D=Nc(null),[h,B]=Db(!1),[T,A]=Db(()=>!!Pl(t).trim()),y=wb(p,f),_=i||h||T;IR(g,()=>({getComment:()=>Ml(x.current?.getHtml()??""),clear:()=>{x.current?.setHtml(Jd),A(!1)},focus:()=>x.current?.focus(),insertText:N=>{let R=b.current?.querySelector(".ehfuse-editor-content");if(!R)return;R.focus();let C=window.getSelection(),S=D.current;if(!S||!R.contains(S.startContainer)){S=document.createRange();let w=R.lastElementChild??R;S.selectNodeContents(w),S.collapse(!1)}C?.removeAllRanges(),C?.addRange(S),document.execCommand("insertText",!1,N)}})),Eb(()=>{if(!r)return;let N=requestAnimationFrame(()=>x.current?.focus());return()=>cancelAnimationFrame(N)},[r]);let I=N=>{let R=Array.from(N??[]);return R.length===0||!u?!1:(u(R),!0)};return ER(Zd,{...y.handlers,onKeyDownCapture:N=>{y.handlers.onKeyDownCapture(N),!N.defaultPrevented&&N.key==="Enter"&&(N.ctrlKey||N.metaKey)&&!N.nativeEvent.isComposing&&(N.preventDefault(),N.stopPropagation(),c?.())},onFocusCapture:()=>B(!0),ref:b,onBlurCapture:N=>{let R=window.getSelection();R&&R.rangeCount>0&&N.currentTarget.contains(R.anchorNode)&&(D.current=R.getRangeAt(0).cloneRange()),!N.currentTarget.contains(N.relatedTarget)&&(B(!1),Ml(x.current?.getHtml()??"")||(x.current?.setHtml(Jd),D.current=null))},onPasteCapture:N=>{I(N.clipboardData?.files)&&(N.preventDefault(),N.stopPropagation())},onDropCapture:N=>{I(N.dataTransfer?.files)&&(N.preventDefault(),N.stopPropagation())},sx:{position:"relative",bgcolor:"#ffffff",...d==="boxed"?{border:"1px solid",borderColor:h?"primary.main":ne,boxShadow:h?N=>`0 0 0 1px ${N.palette.primary.main}`:"none",borderRadius:"8px",transition:"border-color 120ms"}:{},"& .ehfuse-editor, & .ehfuse-editor-wrapper, & .ehfuse-editor-container":{border:"none !important",boxShadow:"none !important",borderRadius:0},"& .ehfuse-toolbar":{display:_?void 0:"none !important",background:"transparent",borderBottom:`1px solid ${ne}`},"& .ehfuse-editor-content":{maxHeight:l,overflowY:"auto",fontSize:15,lineHeight:1.6},"& .ehfuse-editor-content > p:first-of-type":{mt:0},"& .ehfuse-editor-content > p:last-of-type":{mb:0},"& .ehfuse-editor-content.ehfuse-editor-empty::before":d==="boxed"?{top:"10px",left:"12px"}:{top:"12px",left:"16px"}},children:[ep(wR,{ref:x,defaultValue:t||Jd,autoHeight:!0,autoHeightTailLines:0,showToolbar:!0,toolbarOptions:DR,locale:ki(),minHeight:_?Math.max(a,64):a,placeholder:o,contentStyle:{padding:d==="boxed"?"10px 12px":"12px 16px"},onChange:N=>{let R=Ml(N);A(!!R),s?.(R)}}),y.popper,m?ep(Zd,{sx:{display:"flex",alignItems:"center",px:1,pb:.75},children:m}):null]})});function tp({html:e}){let{openExternalUrl:t,mentionCandidates:o}=ce(),i=Nc(null),r=qc(e),a=(o??[]).map(l=>l.name).filter(l=>l.trim().length>=2);return Eb(()=>{let l=i.current;if(!l)return;l.innerHTML=r;let s=[...new Set(a)].sort((p,f)=>f.length-p.length);if(s.length===0||!r.includes("@"))return;let c=p=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=new RegExp(`(^|[^A-Za-z0-9._%+-])(@(?:${s.map(c).join("|")}))`,"g"),m=document.createTreeWalker(l,NodeFilter.SHOW_TEXT),d=[];for(;m.nextNode();){let p=m.currentNode;p.data.includes("@")&&!p.parentElement?.closest("a, code")&&d.push(p)}for(let p of d){let f=p.data,g=document.createDocumentFragment(),x=0;for(let b of f.matchAll(u)){let D=(b.index??0)+b[1].length;D>x&&g.append(f.slice(x,D));let h=document.createElement("span");h.className="taskbox-mention",h.textContent=b[2],g.append(h),x=D+b[2].length}x!==0&&(x<f.length&&g.append(f.slice(x)),p.replaceWith(g))}},[r,a.join("|")]),ep(Zd,{ref:i,onClickCapture:l=>{let s=l.target?.closest?.("a[href]");s&&(l.preventDefault(),l.stopPropagation(),t?t(s.href):window.open(s.href,"_blank","noopener,noreferrer"))},sx:{fontSize:15,lineHeight:1.6,wordBreak:"break-word","& p":{m:0},"& ul, & ol":{pl:"1.5em",my:.25},"& li > p":{m:0},"& h1, & h2, & h3, & h4":{fontSize:"1.05em",fontWeight:700,m:0},"& blockquote":{m:0,pl:1.5,borderLeft:`3px solid ${ne}`,color:"text.secondary"},"& code":{fontFamily:"monospace",fontSize:"0.9em",bgcolor:"#f1f5f9",px:.5,borderRadius:.5},"& pre":{m:0,p:1,bgcolor:"#f1f5f9",borderRadius:1,overflowX:"auto"},"& a[href]":{color:"#2563eb",textDecoration:"none",cursor:"pointer","&:hover":{textDecoration:"underline"}},"& .taskbox-mention":{color:"#2563eb",fontWeight:600}}})}import{ConfirmActionPopper as HR}from"@ehfuse/mui-confirm-action";import{Fragment as Fc,jsx as te,jsxs as Je}from"react/jsx-runtime";var WR=5;function Ob({kind:e,reactions:t,myAccountSeq:o,onToggle:i}){M();let r=t??[],a=o>0&&r.some(u=>u.account_seq===o),l=e==="like"?n("section.reactLike"):n("section.reactAck"),s=r.length===0?l:te(ye,{sx:{whiteSpace:"pre-line",fontSize:12},children:r.map(u=>`${u.name} \xB7 ${u.time}`).join(`
|
|
11
|
-
`)}),c=e==="like"?"#e5484d":"#2f80ed";return te(Lb,{title:s,arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Je(ye,{sx:{display:"inline-flex",alignItems:"center"},children:[te(Qo,{size:"small","aria-label":n("section.commentReaction",{label:l}),onClick:i,sx:{color:a?c:"#c9c8c5",p:.5,"&:hover":{color:a?c:"#787774"}},children:e==="like"?a?te(LR,{sx:{fontSize:16}}):te(AR,{sx:{fontSize:16}}):a?te(qR,{sx:{fontSize:16}}):te(NR,{sx:{fontSize:16}})}),r.length>0?te(ye,{component:"span",sx:{fontSize:12,color:a?c:"#9a9a97",ml:-.25},children:r.length}):null]})})}function Ab({taskSeq:e,comments:t,currentUserName:o="",myAccountSeq:i=0,avatarSrcByName:r,onUpdate:a,onRemove:l,onToggleReaction:s,onPreview:c,onDownload:u}){M();let[m,d]=Dr(null),p=Hc(null),[f,g]=Dr(null),x=Ve(),[b,D]=Dr(null),h=($,V)=>{navigator.clipboard.writeText(V).then(()=>{D($),setTimeout(()=>D(k=>k===$?null:k),1500)})},[B,T]=Dr(!1),A=Math.max(0,t.length-WR),y=A>0&&!B,_=m?Math.min(m.index,A):A,I=t.map(($,V)=>({comment:$,index:V})).slice(y?_:0),N=ja(),R=($,V)=>{if(c){c($,V&&V.length>1?V:void 0);return}window.open(N($.uuid??""),"_blank","noopener,noreferrer")},C=$=>{if(u){u($);return}window.open(N($.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},S=ce(),w=S.slots?.avatar,v=S.commentInput?.richEditor===!0,L=Sd();return Je(ye,{className:"taskbox-comments",sx:{px:2,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[Je(ye,{sx:{display:"flex",alignItems:"center",gap:1},children:[L.showIcon?te(Jr,{sx:{fontSize:18,display:"block",color:L.color}}):null,Je(ye,{sx:{fontSize:Cd,fontWeight:L.fontWeight,color:L.color},children:[n("section.comments"),t.length>0?` (${t.length})`:""]}),A>0&&(!y||_>0)?te(ye,{role:"button",tabIndex:0,onClick:()=>T($=>!$),onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),T(V=>!V))},sx:{ml:"auto",flexShrink:0,cursor:"pointer",fontSize:14.5,color:"#5b87d6","&:hover":{textDecoration:"underline"}},children:y?n("section.showOlder",{keepFrom:_}):n("section.hideOlder")}):null]}),t.length===0?te(ye,{sx:{mt:1,fontSize:14.5,color:"#9a9a97"},children:n("section.noComments")}):null,te(ye,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:I.map(({comment:$,index:V})=>{let k=!!o&&$.author===o,E=te(ye,{component:"span",sx:{fontSize:14.5,fontWeight:700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:$.author}),U=$.external?te(ye,{component:"span",sx:{flexShrink:0,px:.6,fontSize:11.5,fontWeight:500,lineHeight:"18px",color:"#d9730d",bgcolor:"#fdf0e6",borderRadius:"4px",whiteSpace:"nowrap"},children:n("section.merchant")}):null;return Je(ye,{sx:{display:"flex",gap:1.5,alignItems:"flex-start","&:hover .taskbox-comment-actions":{opacity:1,pointerEvents:"auto"},"&:not(:last-child)":{borderBottom:"1px dashed #e0dfdc",pb:1}},children:[(()=>{let H=r?.get($.author)??"";return w?te(ye,{sx:{display:"inline-flex",flexShrink:0},children:te(w,{name:$.author,src:H||void 0,size:44})}):te(ye,{sx:{display:"inline-flex",flexShrink:0},children:te(fo,{src:H,name:$.author,avatarSx:{width:44,height:44,fontSize:20,borderRadius:"50%",...Xr[0]},iconFontSize:24})})})(),Je(ye,{sx:{flex:1,minWidth:0},children:[x?Je(ye,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[E,U]}):null,Je(ye,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,position:"relative"},children:[x?null:E,x?null:U,te(ye,{component:"span",sx:{fontSize:12.5,color:"#9a9a97",flexShrink:0,whiteSpace:"nowrap"},children:$.time}),k?te(ye,{sx:{ml:"auto"}}):Je(ye,{sx:{display:"flex",alignItems:"center",gap:.25,ml:"auto",flexShrink:0},children:[te(Qo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>h(V,va($.text)),sx:{color:b===V?"#2f9e5b":"#9a9a97",p:.5,"&:hover":{color:"#37352f"}},children:b===V?te(Mb,{sx:{fontSize:15}}):te(Pb,{sx:{fontSize:15}})}),te(Ob,{kind:"like",reactions:$.likes,myAccountSeq:i,onToggle:()=>s?.(e,V,"like")}),te(Ob,{kind:"ack",reactions:$.acks,myAccountSeq:i,onToggle:()=>s?.(e,V,"ack")})]}),k?Je(ye,{className:"taskbox-comment-actions",sx:{display:"flex",alignItems:"center",gap:.25,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",pointerEvents:x?"auto":"none",backgroundColor:"var(--taskbox-comment-bg, #fff)",opacity:x?1:0,transition:"opacity 0.15s"},children:[te(Qo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>h(V,va($.text)),sx:{color:b===V?"#2f9e5b":"#9a9a97","&:hover":{color:"#37352f"}},children:b===V?te(Mb,{sx:{fontSize:15}}):te(Pb,{sx:{fontSize:15}})}),te(Qo,{size:"small","aria-label":n("section.editComment"),onClick:()=>d({index:V,text:$.text,attachments:[...$.attachments??[]],files:[]}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:te(OR,{sx:{fontSize:15}})}),te(Qo,{size:"small","aria-label":n("section.deleteComment"),onClick:H=>g({anchorEl:H.currentTarget,index:V}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:te($c,{sx:{fontSize:15}})})]}):null]}),m?.index===V?Je(ye,{sx:{mt:.5},children:[v||Sa($.text)?te(zc,{defaultHtml:Sa($.text)?$.text:Qd($.text),alwaysExpanded:!0,autoFocus:!0,variant:"boxed",minHeight:56,onChange:H=>d(J=>J&&{...J,text:H})}):te(ye,{component:"textarea",autoFocus:!0,spellCheck:!1,value:m.text,onChange:H=>d({...m,text:H.target.value}),sx:{width:"100%",minHeight:56,border:`1px solid ${ne}`,borderRadius:1,outline:"none",font:"inherit",fontSize:14,p:1,resize:"vertical",boxSizing:"border-box"}}),Je(ye,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75,mt:.75},children:[m.attachments.map((H,J)=>{let oe=()=>d({...m,attachments:m.attachments.filter((ue,K)=>K!==J)});return Ol(H.name)&&H.uuid?Je(ye,{sx:{position:"relative"},children:[te(ye,{component:"img",src:N(H.uuid,{thumb:"md"}),alt:H.name,title:H.name,loading:"lazy",sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${ne}`,display:"block"}}),te(Qo,{size:"small","aria-label":n("section.removeAttachment"),onClick:oe,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${ne}`,"&:hover":{bgcolor:"#f1f5f9"}},children:te($c,{sx:{fontSize:14}})})]},`kept-${H.uuid}-${J}`):te(Wc,{size:"small",icon:te(Ba,{sx:{fontSize:14}}),label:H.name,onDelete:oe,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`kept-${H.uuid??H.name}-${J}`)}),m.files.map((H,J)=>{let oe=()=>d({...m,files:m.files.filter((ue,K)=>K!==J)});return Ol(H.name)?Je(ye,{sx:{position:"relative"},children:[te(ye,{component:"img",src:URL.createObjectURL(H),alt:H.name,title:n("section.newFile",{name:H.name}),onLoad:ue=>URL.revokeObjectURL(ue.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"2px solid #2f80ed",display:"block"}}),te(Qo,{size:"small","aria-label":n("section.removeAttachment"),onClick:oe,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${ne}`,"&:hover":{bgcolor:"#f1f5f9"}},children:te($c,{sx:{fontSize:14}})})]},`new-${H.name}-${J}`):te(Wc,{size:"small",icon:te(Ba,{sx:{fontSize:14}}),label:n("section.newFile",{name:H.name}),onDelete:oe,sx:{fontSize:14,height:26,bgcolor:"#eef4ff"}},`new-${H.name}-${J}`)}),te(Lb,{title:n("section.addAttachment"),arrow:!0,children:te(Qo,{size:"small","aria-label":n("section.addAttachment"),onClick:()=>p.current?.click(),sx:{ml:"auto",color:"#2f80ed"},children:te(zR,{sx:{fontSize:20}})})})]}),Je(ye,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.75,mt:.5},children:[te(Rb,{size:"small",color:"inherit",onClick:()=>d(null),children:n("common.cancel")}),te(Rb,{size:"small",variant:"contained",disabled:!m.text.trim()&&m.attachments.length===0&&m.files.length===0,onClick:()=>{a(e,V,m.text,{attachments:m.attachments,files:m.files}),d(null)},children:n("common.save")})]}),te(ye,{component:"input",type:"file",multiple:!0,ref:p,sx:{display:"none"},onChange:H=>{let J=Array.from(H.target.files??[]);J.length>0&&d({...m,files:[...m.files,...J].slice(0,10)}),H.target.value=""}})]}):Je(ye,{children:[$.text?Sa($.text)?te(tp,{html:$.text}):te(ye,{sx:{fontSize:15,whiteSpace:"pre-wrap"},children:te(Nx,{text:$.text})}):null,($.attachments??[]).length>0?te(ye,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mt:.75},children:($.attachments??[]).map((H,J)=>{let oe=!!H.uuid,ue=Ol(H.name),K=($.attachments??[]).filter(W=>!!W.uuid&&Ol(W.name));if(ue&&oe)return te(ye,{component:"img",src:N(H.uuid??"",{thumb:"md"}),alt:H.name,title:n("section.viewLarge",{name:H.name}),loading:"lazy",onClick:()=>R(H,K),sx:{width:96,height:96,objectFit:"cover",borderRadius:1,border:`1px solid ${ne}`,cursor:"pointer",bgcolor:"#f8fafc"}},`${H.name}-${J}`);let Z=wc(H.name);return te(Wc,{size:"small",icon:te(Ba,{sx:{fontSize:14}}),label:`${H.name} (${$d(H.size)})`,clickable:oe,onClick:oe?()=>Z?R(H):C(H):void 0,title:oe?n("section.fileAction",{name:H.name,value:Z?n("section.preview"):n("section.download")}):H.name,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${H.name}-${J}`)})}):null]})]})]},`${$.time}-${V}`)})}),te(HR,{open:!!f,anchorEl:f?.anchorEl??null,title:n("section.deleteCommentConfirm"),confirmText:n("common.delete"),onCancel:()=>g(null),onConfirm:()=>{f&&(l(e,f.index),d(null)),g(null)}})]})}function Ol(e){return/\.(png|jpe?g|gif|webp|bmp|svg|heic|heif)$/i.test(String(e??"").trim())}function $R(e){let{commentInput:t,mentionCandidates:o}=ce(),r=((e?.mentionCandidates??o)?.length??0)>0,a=e?.placeholder??t?.placeholder,l=e?.placeholderShort??t?.placeholderShort,s=a??n(r?"section.commentPlaceholder":"section.commentPlaceholderPlain"),c=l??a??n(r?"section.commentPlaceholderShort":"section.commentPlaceholderPlain");return{wide:s,short:c}}function VR(){return Je("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[te("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),te("path",{d:"M8.5 14.5c.9 1.2 2.1 1.8 3.5 1.8s2.6-.6 3.5-1.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),te("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),te("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"})]})}function qb({onSubmit:e,rows:t=2,placeholder:o,placeholderShort:i,richEditor:r,mentionCandidates:a,slashCommands:l,attachments:s=!0,emojiPicker:c,disabled:u=!1}){M();let[m,d]=Dr(""),p=Tb({value:m,setValue:d,candidates:a,slashCommands:l}),[f,g]=Dr([]),[x,b]=Dr(!1),D=Hc(null),h=Hc(null),B=Ve(),T=B||t===1,A=ce(),y=$R({placeholder:o,placeholderShort:i,mentionCandidates:a}),_=!B&&(r??A.commentInput?.richEditor)===!0,I=E=>{if(!s)return;let U=Array.from(E??[]);U.length!==0&&g(H=>[...H,...U].slice(0,10))},N=Hc(null),[R,C]=Dr(""),S=()=>{if(u)return;let E=_?(N.current?.getComment()??"").trim():m.trim();!E&&f.length===0||(e(E,f.length>0?f:void 0),d(""),N.current?.clear(),C(""),g([]))},w=c??A.slots?.emojiPicker,[v,L]=Dr(null),$=E=>{_?N.current?.insertText(E):d(U=>`${U}${E}`),L(null)},V=E=>te(Qo,{size:"small","aria-label":n("section.postComment"),disabled:E||u,onClick:S,sx:{width:34,height:34,flexShrink:0,bgcolor:"primary.main",color:"#ffffff",transition:"background-color 160ms ease","&:hover":{bgcolor:"primary.dark"},"&.Mui-disabled":{bgcolor:"#e2e8f0",color:"#94a3b8"}},children:te(PR,{sx:{fontSize:22}})}),k=Je(Fc,{children:[s?Je(Fc,{children:[te(Qo,{size:"small","aria-label":n("section.attachFile"),onClick:()=>D.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:te(Ba,{sx:{fontSize:20}})}),te(Qo,{size:"small","aria-label":n("section.attachImage"),onClick:()=>h.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:te(FR,{sx:{fontSize:20}})})]}):null,te(Qo,{size:"small","aria-label":n("section.emoji"),onMouseDown:E=>E.preventDefault(),onClick:E=>L(E.currentTarget),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:te(VR,{})}),te(RR,{open:!!v,anchorEl:v,onClose:()=>L(null),anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},disableRestoreFocus:!0,slotProps:{paper:{sx:{width:340,maxWidth:"calc(100vw - 32px)",overflow:"hidden"}}},children:w?te(w,{onPick:$}):te(Ib,{onPick:$})})]});return Je(ye,{children:[f.length>0?te(ye,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1.5,px:2,pt:2},children:f.map((E,U)=>Ol(E.name)?Je(ye,{sx:{position:"relative"},children:[te(ye,{component:"img",src:URL.createObjectURL(E),alt:E.name,title:E.name,onLoad:H=>URL.revokeObjectURL(H.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${ne}`,display:"block"}}),te(Qo,{size:"small","aria-label":n("section.removeAttachment"),onClick:()=>g(H=>H.filter((J,oe)=>oe!==U)),sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${ne}`,"&:hover":{bgcolor:"#f1f5f9"}},children:te($c,{sx:{fontSize:14}})})]},`${E.name}-${U}`):te(Wc,{size:"small",icon:te(Ba,{sx:{fontSize:14}}),label:`${E.name} (${$d(E.size)})`,onDelete:()=>g(H=>H.filter((J,oe)=>oe!==U)),sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${E.name}-${U}`))}):null,Je(ye,{sx:{position:"relative",display:"flex"},onDragOver:E=>{!s||!Array.from(E.dataTransfer?.types??[]).includes("Files")||(E.preventDefault(),b(!0))},onDragLeave:E=>{E.currentTarget.contains(E.relatedTarget)||b(!1)},onDrop:E=>{!s||!Array.from(E.dataTransfer?.types??[]).includes("Files")||(E.preventDefault(),b(!1),I(E.dataTransfer?.files??null))},children:[x?Je(ye,{sx:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",gap:.75,borderRadius:1,border:"2px dashed #2f80ed",bgcolor:"rgba(47,128,237,0.08)",color:"#2f80ed",fontSize:14,fontWeight:600,pointerEvents:"none"},children:[te(Ba,{sx:{fontSize:18}}),n("section.dropToAttach")]}):null,_?te(ye,{sx:{flex:1,minWidth:0},children:te(zc,{ref:N,placeholder:y.wide,mentionCandidates:a,slashCommands:l,alwaysExpanded:f.length>0,onChange:C,onSubmit:S,onFiles:E=>{s&&g(U=>[...U,...E].slice(0,10))},footer:Je(Fc,{children:[k,te(ye,{sx:{flex:1}}),V(!R&&f.length===0)]})})}):Je(Fc,{children:[te(MR,{value:m,placeholder:T?y.short:y.wide,onChange:E=>d(E.target.value),inputRef:p.inputRef,onSelect:p.onSelectionChange,onKeyDown:E=>{p.onKeyDown(E)},onPaste:E=>{let U=Array.from(E.clipboardData?.files??[]);!s||U.length===0||(E.preventDefault(),I(E.clipboardData.files))},fullWidth:!0,multiline:!0,minRows:T?1:t,maxRows:3,sx:{"& .MuiInputBase-root":{pl:2,pr:T?15:6.5,pb:T?void 0:5,borderRadius:0},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}}),p.popper,T?Je(ye,{sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:.25},children:[k,V(!m.trim()&&f.length===0)]}):Je(ye,{sx:{position:"absolute",left:0,right:0,bottom:0,display:"flex",alignItems:"center",px:1,pb:.75},children:[k,te(ye,{sx:{flex:1}}),V(!m.trim()&&f.length===0)]})]})]}),te(ye,{component:"input",ref:D,type:"file",multiple:!0,onChange:E=>{I(E.target.files),E.target.value=""},sx:{display:"none"}}),te(ye,{component:"input",ref:h,type:"file",accept:"image/*",multiple:!0,onChange:E=>{I(E.target.files),E.target.value=""},sx:{display:"none"}})]})}import{useState as Wi}from"react";import{Box as Jo,Button as Hb,ButtonBase as oP,Divider as nP,IconButton as ni,ListItemIcon as Uc,ListItemText as Gc,Menu as rP,MenuItem as jc,Tooltip as ri}from"@mui/material";import iP from"@mui/icons-material/MoreVert";import Wb from"@mui/icons-material/Close";import aP from"@mui/icons-material/ArrowBack";import $b from"@mui/icons-material/ContentCopyOutlined";import Vb from"@mui/icons-material/ShareOutlined";import Kb from"@mui/icons-material/HistoryOutlined";import Ub from"@mui/icons-material/Print";import{ConfirmActionPopper as lP}from"@ehfuse/mui-confirm-action";import{Box as Er,Button as GR,CircularProgress as jR}from"@mui/material";import{FormDialog as YR}from"@ehfuse/mui-form-dialog";import{OverlayScrollbar as XR}from"@ehfuse/overlay-scrollbar";import{useEffect as KR}from"react";import{useModal as UR}from"@ehfuse/forma";function Ll({taskSeq:e,items:t,loading:o,onLoad:i}){let r={activity:UR({modalId:De("taskbox-task-activity")})},a=r.activity.isOpen;return KR(()=>{a&&e>0&&!t&&i?.(e)},[a,e,t,i]),{modals:r,items:t,loading:o,openDialog:()=>r.activity.open()}}import{jsx as Rr,jsxs as Vc}from"react/jsx-runtime";var QR={get created(){return n("activity.created")},get completed(){return n("activity.completed")},get uncompleted(){return n("activity.uncompleted")},get returned(){return n("activity.returned")},get confirm_requested(){return n("activity.confirmRequested")},get acked(){return n("activity.acked")},get claimed(){return n("activity.claimed")},get bug_verified(){return n("activity.bugVerified")},get bug_reopened(){return n("activity.bugReopened")}};function Nb(e){return String(e??"").trim()||n("common.none")}function JR(e){if(e.kind!=="field")return QR[String(e.kind)]??n("activity.changed");let t=String(e.field_label??e.field??"").trim()||n("activity.field"),o=String(e.old_value??"").trim(),i=String(e.new_value??"").trim();return!o&&i?n("activity.fieldSet",{label:t,after:i}):o&&!i?n("activity.fieldCleared",{label:t}):n("activity.fieldChanged",{label:t,value:Nb(o),value2:Nb(i)})}function Kc({controller:e}){M();let t=Ve(),{items:o,loading:i}=e,r=e.modals.activity,a=Rr(Er,{sx:{height:t?"100%":420,minHeight:0},children:Rr(XR,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:Vc(Er,{sx:{px:2,pt:2,display:"flex",flexDirection:"column",gap:1,"&::after":{content:'""',flexShrink:0,height:16}},children:[i&&!o?Vc(Er,{sx:{display:"flex",alignItems:"center",gap:1,color:"#9a9a97",fontSize:14.5},children:[Rr(jR,{size:14,thickness:5,sx:{color:"#9a9a97"}}),n("common.loading")]}):null,o&&o.length===0?Rr(Er,{sx:{fontSize:14.5,color:"#9a9a97"},children:n("activity.empty")}):null,(o??[]).map(l=>Vc(Er,{sx:{display:"flex",flexDirection:t?"column":"row",gap:t?.25:1,alignItems:t?"stretch":"baseline",minWidth:0,flexShrink:0,...t?{pb:1,borderBottom:`1px solid ${ne}`,"&:last-of-type":{borderBottom:"none",pb:0}}:{}},children:[Rr(Er,{sx:{flexShrink:0,...t?{}:{width:"10.5em"},whiteSpace:"nowrap",fontSize:13.5,color:"#9a9a97",lineHeight:1.5},children:Ao(l.acted_time)}),Vc(Er,{sx:{minWidth:0,fontSize:14.5,color:"#37352f",lineHeight:1.5},children:[Rr(Er,{component:"span",sx:{fontWeight:500},children:String(l.actor_name??"").trim()||n("dialog.noName")}),Rr(Er,{component:"span",sx:{ml:.5},children:JR(l)})]})]},l.seq))]})})});return Rr(YR,{open:r.isOpen,onClose:r.close,maxWidth:"sm",fullScreen:t,mobilePresentation:t?"slide":"dialog",contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sx:t?{DialogContent:{pb:0,"& .os-content > div":{height:"100%",boxSizing:"border-box",paddingBottom:0,marginBottom:0},"& .FormSection-content, & .section-content":{height:"100%",paddingBottom:0,marginBottom:0}}}:void 0,title:o&&o.length>0?n("activity.titleWithCount",{count:o.length}):n("activity.title"),locale:Be(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-activity",sections:[{id:"task-activity",showTitle:!1,children:a}],scrollPastLastSection:!1,actions:{showCancelButton:!1,right:Rr(GR,{variant:"contained",onClick:r.close,children:n("common.close")})}})}import{InfoAlert as ZR,SuccessAlert as eP}from"@ehfuse/alerts";var zb=e=>e?e.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<br\s*\/?>/gi,`
|
|
11
|
+
`)}),c=e==="like"?"#e5484d":"#2f80ed";return te(Lb,{title:s,arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:Je(ye,{sx:{display:"inline-flex",alignItems:"center"},children:[te(Qo,{size:"small","aria-label":n("section.commentReaction",{label:l}),onClick:i,sx:{color:a?c:"#c9c8c5",p:.5,"&:hover":{color:a?c:"#787774"}},children:e==="like"?a?te(LR,{sx:{fontSize:16}}):te(AR,{sx:{fontSize:16}}):a?te(qR,{sx:{fontSize:16}}):te(NR,{sx:{fontSize:16}})}),r.length>0?te(ye,{component:"span",sx:{fontSize:12,color:a?c:"#9a9a97",ml:-.25},children:r.length}):null]})})}function Ab({taskSeq:e,comments:t,currentUserName:o="",myAccountSeq:i=0,avatarSrcByName:r,onUpdate:a,onRemove:l,onToggleReaction:s,onPreview:c,onDownload:u}){M();let[m,d]=Dr(null),p=Hc(null),[f,g]=Dr(null),x=Ve(),[b,D]=Dr(null),h=($,V)=>{navigator.clipboard.writeText(V).then(()=>{D($),setTimeout(()=>D(k=>k===$?null:k),1500)})},[B,T]=Dr(!1),A=Math.max(0,t.length-WR),y=A>0&&!B,_=m?Math.min(m.index,A):A,I=t.map(($,V)=>({comment:$,index:V})).slice(y?_:0),N=ja(),R=($,V)=>{if(c){c($,V&&V.length>1?V:void 0);return}window.open(N($.uuid??""),"_blank","noopener,noreferrer")},C=$=>{if(u){u($);return}window.open(N($.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},S=ce(),w=S.slots?.avatar,v=S.commentInput?.richEditor===!0,L=Sd();return Je(ye,{className:"taskbox-comments",sx:{px:2,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[Je(ye,{sx:{display:"flex",alignItems:"center",gap:1},children:[L.showIcon?te(Jr,{sx:{fontSize:18,display:"block",color:L.color}}):null,Je(ye,{sx:{fontSize:Cd,fontWeight:L.fontWeight,color:L.color},children:[n("section.comments"),t.length>0?` (${t.length})`:""]}),A>0&&(!y||_>0)?te(ye,{role:"button",tabIndex:0,onClick:()=>T($=>!$),onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),T(V=>!V))},sx:{ml:"auto",flexShrink:0,cursor:"pointer",fontSize:14.5,color:"#5b87d6","&:hover":{textDecoration:"underline"}},children:y?n("section.showOlder",{keepFrom:_}):n("section.hideOlder")}):null]}),t.length===0?te(ye,{sx:{mt:1,fontSize:14.5,color:"#9a9a97"},children:n("section.noComments")}):null,te(ye,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:I.map(({comment:$,index:V})=>{let k=!!o&&$.author===o,E=te(ye,{component:"span",sx:{fontSize:14.5,fontWeight:700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:$.author}),U=$.external?te(ye,{component:"span",sx:{flexShrink:0,px:.6,fontSize:11.5,fontWeight:500,lineHeight:"18px",color:"#d9730d",bgcolor:"#fdf0e6",borderRadius:"4px",whiteSpace:"nowrap"},children:n("section.merchant")}):null;return Je(ye,{sx:{display:"flex",gap:1.5,alignItems:"flex-start","&:hover .taskbox-comment-actions":{opacity:1,pointerEvents:"auto"},"&:not(:last-child)":{borderBottom:"1px dashed #e0dfdc",pb:1}},children:[(()=>{let H=r?.get($.author)??"";return w?te(ye,{sx:{display:"inline-flex",flexShrink:0},children:te(w,{name:$.author,src:H||void 0,size:44})}):te(ye,{sx:{display:"inline-flex",flexShrink:0},children:te(fo,{src:H,name:$.author,avatarSx:{width:44,height:44,fontSize:20,borderRadius:"50%",...Xr[0]},iconFontSize:24})})})(),Je(ye,{sx:{flex:1,minWidth:0},children:[x?Je(ye,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[E,U]}):null,Je(ye,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,position:"relative"},children:[x?null:E,x?null:U,te(ye,{component:"span",sx:{fontSize:12.5,color:"#9a9a97",flexShrink:0,whiteSpace:"nowrap"},children:$.time}),k?te(ye,{sx:{ml:"auto"}}):Je(ye,{sx:{display:"flex",alignItems:"center",gap:.25,ml:"auto",flexShrink:0},children:[te(Qo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>h(V,va($.text)),sx:{color:b===V?"#2f9e5b":"#9a9a97",p:.5,"&:hover":{color:"#37352f"}},children:b===V?te(Mb,{sx:{fontSize:15}}):te(Pb,{sx:{fontSize:15}})}),te(Ob,{kind:"like",reactions:$.likes,myAccountSeq:i,onToggle:()=>s?.(e,V,"like")}),te(Ob,{kind:"ack",reactions:$.acks,myAccountSeq:i,onToggle:()=>s?.(e,V,"ack")})]}),k?Je(ye,{className:"taskbox-comment-actions",sx:{display:"flex",alignItems:"center",gap:.25,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",pointerEvents:x?"auto":"none",backgroundColor:"var(--taskbox-comment-bg, #fff)",opacity:x?1:0,transition:"opacity 0.15s"},children:[te(Qo,{size:"small","aria-label":n("section.copyComment"),onClick:()=>h(V,va($.text)),sx:{color:b===V?"#2f9e5b":"#9a9a97","&:hover":{color:"#37352f"}},children:b===V?te(Mb,{sx:{fontSize:15}}):te(Pb,{sx:{fontSize:15}})}),te(Qo,{size:"small","aria-label":n("section.editComment"),onClick:()=>d({index:V,text:$.text,attachments:[...$.attachments??[]],files:[]}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:te(OR,{sx:{fontSize:15}})}),te(Qo,{size:"small","aria-label":n("section.deleteComment"),onClick:H=>g({anchorEl:H.currentTarget,index:V}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:te($c,{sx:{fontSize:15}})})]}):null]}),m?.index===V?Je(ye,{sx:{mt:.5},children:[v||Sa($.text)?te(zc,{defaultHtml:Sa($.text)?$.text:Qd($.text),alwaysExpanded:!0,autoFocus:!0,variant:"boxed",minHeight:56,onChange:H=>d(J=>J&&{...J,text:H})}):te(ye,{component:"textarea",autoFocus:!0,spellCheck:!1,value:m.text,onChange:H=>d({...m,text:H.target.value}),sx:{width:"100%",minHeight:56,border:`1px solid ${ne}`,borderRadius:1,outline:"none",font:"inherit",fontSize:14,p:1,resize:"vertical",boxSizing:"border-box"}}),Je(ye,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75,mt:.75},children:[m.attachments.map((H,J)=>{let oe=()=>d({...m,attachments:m.attachments.filter((ue,K)=>K!==J)});return Ol(H.name)&&H.uuid?Je(ye,{sx:{position:"relative"},children:[te(ye,{component:"img",src:N(H.uuid,{thumb:"md"}),alt:H.name,title:H.name,loading:"lazy",sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${ne}`,display:"block"}}),te(Qo,{size:"small","aria-label":n("section.removeAttachment"),onClick:oe,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${ne}`,"&:hover":{bgcolor:"#f1f5f9"}},children:te($c,{sx:{fontSize:14}})})]},`kept-${H.uuid}-${J}`):te(Wc,{size:"small",icon:te(Ba,{sx:{fontSize:14}}),label:H.name,onDelete:oe,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`kept-${H.uuid??H.name}-${J}`)}),m.files.map((H,J)=>{let oe=()=>d({...m,files:m.files.filter((ue,K)=>K!==J)});return Ol(H.name)?Je(ye,{sx:{position:"relative"},children:[te(ye,{component:"img",src:URL.createObjectURL(H),alt:H.name,title:n("section.newFile",{name:H.name}),onLoad:ue=>URL.revokeObjectURL(ue.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"2px solid #2f80ed",display:"block"}}),te(Qo,{size:"small","aria-label":n("section.removeAttachment"),onClick:oe,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${ne}`,"&:hover":{bgcolor:"#f1f5f9"}},children:te($c,{sx:{fontSize:14}})})]},`new-${H.name}-${J}`):te(Wc,{size:"small",icon:te(Ba,{sx:{fontSize:14}}),label:n("section.newFile",{name:H.name}),onDelete:oe,sx:{fontSize:14,height:26,bgcolor:"#eef4ff"}},`new-${H.name}-${J}`)}),te(Lb,{title:n("section.addAttachment"),arrow:!0,children:te(Qo,{size:"small","aria-label":n("section.addAttachment"),onClick:()=>p.current?.click(),sx:{ml:"auto",color:"#2f80ed"},children:te(zR,{sx:{fontSize:20}})})})]}),Je(ye,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.75,mt:.5},children:[te(Rb,{size:"small",color:"inherit",onClick:()=>d(null),children:n("common.cancel")}),te(Rb,{size:"small",variant:"contained",disabled:!m.text.trim()&&m.attachments.length===0&&m.files.length===0,onClick:()=>{a(e,V,m.text,{attachments:m.attachments,files:m.files}),d(null)},children:n("common.save")})]}),te(ye,{component:"input",type:"file",multiple:!0,ref:p,sx:{display:"none"},onChange:H=>{let J=Array.from(H.target.files??[]);J.length>0&&d({...m,files:[...m.files,...J].slice(0,10)}),H.target.value=""}})]}):Je(ye,{children:[$.text?Sa($.text)?te(tp,{html:$.text}):te(ye,{sx:{fontSize:15,whiteSpace:"pre-wrap"},children:te(Nx,{text:$.text})}):null,($.attachments??[]).length>0?te(ye,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mt:.75},children:($.attachments??[]).map((H,J)=>{let oe=!!H.uuid,ue=Ol(H.name),K=($.attachments??[]).filter(W=>!!W.uuid&&Ol(W.name));if(ue&&oe)return te(ye,{component:"img",src:N(H.uuid??"",{thumb:"md"}),alt:H.name,title:n("section.viewLarge",{name:H.name}),loading:"lazy",onClick:()=>R(H,K),sx:{width:96,height:96,objectFit:"cover",borderRadius:1,border:`1px solid ${ne}`,cursor:"pointer",bgcolor:"#f8fafc"}},`${H.name}-${J}`);let Z=wc(H.name);return te(Wc,{size:"small",icon:te(Ba,{sx:{fontSize:14}}),label:`${H.name} (${$d(H.size)})`,clickable:oe,onClick:oe?()=>Z?R(H):C(H):void 0,title:oe?n("section.fileAction",{name:H.name,value:Z?n("section.preview"):n("section.download")}):H.name,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${H.name}-${J}`)})}):null]})]})]},`${$.time}-${V}`)})}),te(HR,{open:!!f,anchorEl:f?.anchorEl??null,title:n("section.deleteCommentConfirm"),confirmText:n("common.delete"),onCancel:()=>g(null),onConfirm:()=>{f&&(l(e,f.index),d(null)),g(null)}})]})}function Ol(e){return/\.(png|jpe?g|gif|webp|bmp|svg|heic|heif)$/i.test(String(e??"").trim())}function $R(e){let{commentInput:t,mentionCandidates:o}=ce(),r=((e?.mentionCandidates??o)?.length??0)>0,a=e?.placeholder??t?.placeholder,l=e?.placeholderShort??t?.placeholderShort,s=a??n(r?"section.commentPlaceholder":"section.commentPlaceholderPlain"),c=l??a??n(r?"section.commentPlaceholderShort":"section.commentPlaceholderPlain");return{wide:s,short:c}}function VR(){return Je("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[te("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),te("path",{d:"M8.5 14.5c.9 1.2 2.1 1.8 3.5 1.8s2.6-.6 3.5-1.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),te("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),te("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"})]})}function qb({onSubmit:e,rows:t=2,placeholder:o,placeholderShort:i,richEditor:r,mentionCandidates:a,slashCommands:l,attachments:s=!0,emojiPicker:c,disabled:u=!1}){M();let[m,d]=Dr(""),p=Tb({value:m,setValue:d,candidates:a,slashCommands:l}),[f,g]=Dr([]),[x,b]=Dr(!1),D=Hc(null),h=Hc(null),B=Ve(),T=B||t===1,A=ce(),y=$R({placeholder:o,placeholderShort:i,mentionCandidates:a}),_=!B&&(r??A.commentInput?.richEditor)===!0,I=E=>{if(!s)return;let U=Array.from(E??[]);U.length!==0&&g(H=>[...H,...U].slice(0,10))},N=Hc(null),[R,C]=Dr(""),S=()=>{if(u)return;let E=_?(N.current?.getComment()??"").trim():m.trim();!E&&f.length===0||(e(E,f.length>0?f:void 0),d(""),N.current?.clear(),C(""),g([]))},w=c??A.slots?.emojiPicker,[v,L]=Dr(null),$=E=>{_?N.current?.insertText(E):d(U=>`${U}${E}`),L(null)},V=E=>te(Qo,{size:"small","aria-label":n("section.postComment"),disabled:E||u,onClick:S,sx:{width:34,height:34,flexShrink:0,bgcolor:"primary.main",color:"#ffffff",transition:"background-color 160ms ease","&:hover":{bgcolor:"primary.dark"},"&.Mui-disabled":{bgcolor:"#e2e8f0",color:"#94a3b8"}},children:te(PR,{sx:{fontSize:22}})}),k=Je(Fc,{children:[s?Je(Fc,{children:[te(Qo,{size:"small","aria-label":n("section.attachFile"),onClick:()=>D.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:te(Ba,{sx:{fontSize:20}})}),te(Qo,{size:"small","aria-label":n("section.attachImage"),onClick:()=>h.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:te(FR,{sx:{fontSize:20}})})]}):null,te(Qo,{size:"small","aria-label":n("section.emoji"),onMouseDown:E=>E.preventDefault(),onClick:E=>L(E.currentTarget),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:te(VR,{})}),te(RR,{open:!!v,anchorEl:v,onClose:()=>L(null),anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},disableRestoreFocus:!0,slotProps:{paper:{sx:{width:340,maxWidth:"calc(100vw - 32px)",overflow:"hidden"}}},children:w?te(w,{onPick:$}):te(Ib,{onPick:$})})]});return Je(ye,{children:[f.length>0?te(ye,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1.5,px:2,pt:2},children:f.map((E,U)=>Ol(E.name)?Je(ye,{sx:{position:"relative"},children:[te(ye,{component:"img",src:URL.createObjectURL(E),alt:E.name,title:E.name,onLoad:H=>URL.revokeObjectURL(H.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${ne}`,display:"block"}}),te(Qo,{size:"small","aria-label":n("section.removeAttachment"),onClick:()=>g(H=>H.filter((J,oe)=>oe!==U)),sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${ne}`,"&:hover":{bgcolor:"#f1f5f9"}},children:te($c,{sx:{fontSize:14}})})]},`${E.name}-${U}`):te(Wc,{size:"small",icon:te(Ba,{sx:{fontSize:14}}),label:`${E.name} (${$d(E.size)})`,onDelete:()=>g(H=>H.filter((J,oe)=>oe!==U)),sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${E.name}-${U}`))}):null,Je(ye,{sx:{position:"relative",display:"flex"},onDragOver:E=>{!s||!Array.from(E.dataTransfer?.types??[]).includes("Files")||(E.preventDefault(),b(!0))},onDragLeave:E=>{E.currentTarget.contains(E.relatedTarget)||b(!1)},onDrop:E=>{!s||!Array.from(E.dataTransfer?.types??[]).includes("Files")||(E.preventDefault(),b(!1),I(E.dataTransfer?.files??null))},children:[x?Je(ye,{sx:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",gap:.75,borderRadius:1,border:"2px dashed #2f80ed",bgcolor:"rgba(47,128,237,0.08)",color:"#2f80ed",fontSize:14,fontWeight:600,pointerEvents:"none"},children:[te(Ba,{sx:{fontSize:18}}),n("section.dropToAttach")]}):null,_?te(ye,{sx:{flex:1,minWidth:0},children:te(zc,{ref:N,placeholder:y.wide,mentionCandidates:a,slashCommands:l,alwaysExpanded:f.length>0,onChange:C,onSubmit:S,onFiles:E=>{s&&g(U=>[...U,...E].slice(0,10))},footer:Je(Fc,{children:[k,te(ye,{sx:{flex:1}}),V(!R&&f.length===0)]})})}):Je(Fc,{children:[te(MR,{value:m,placeholder:T?y.short:y.wide,onChange:E=>d(E.target.value),inputRef:p.inputRef,onSelect:p.onSelectionChange,onKeyDown:E=>{p.onKeyDown(E)},onPaste:E=>{let U=Array.from(E.clipboardData?.files??[]);!s||U.length===0||(E.preventDefault(),I(E.clipboardData.files))},fullWidth:!0,multiline:!0,minRows:T?1:t,maxRows:3,sx:{"& .MuiInputBase-root":{pl:2,pr:T?15:6.5,pb:T?void 0:5,borderRadius:0},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}}),p.popper,T?Je(ye,{sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:.25},children:[k,V(!m.trim()&&f.length===0)]}):Je(ye,{sx:{position:"absolute",left:0,right:0,bottom:0,display:"flex",alignItems:"center",px:1,pb:.75},children:[k,te(ye,{sx:{flex:1}}),V(!m.trim()&&f.length===0)]})]})]}),te(ye,{component:"input",ref:D,type:"file",multiple:!0,onChange:E=>{I(E.target.files),E.target.value=""},sx:{display:"none"}}),te(ye,{component:"input",ref:h,type:"file",accept:"image/*",multiple:!0,onChange:E=>{I(E.target.files),E.target.value=""},sx:{display:"none"}})]})}import{useState as Wi}from"react";import{Box as Jo,Button as Hb,ButtonBase as oP,Divider as nP,IconButton as ni,ListItemIcon as Uc,ListItemText as Gc,Menu as rP,MenuItem as jc,Tooltip as ri}from"@mui/material";import iP from"@mui/icons-material/MoreHoriz";import Wb from"@mui/icons-material/Close";import aP from"@mui/icons-material/ArrowBack";import $b from"@mui/icons-material/ContentCopyOutlined";import Vb from"@mui/icons-material/ShareOutlined";import Kb from"@mui/icons-material/HistoryOutlined";import Ub from"@mui/icons-material/Print";import{ConfirmActionPopper as lP}from"@ehfuse/mui-confirm-action";import{Box as Er,Button as GR,CircularProgress as jR}from"@mui/material";import{FormDialog as YR}from"@ehfuse/mui-form-dialog";import{OverlayScrollbar as XR}from"@ehfuse/overlay-scrollbar";import{useEffect as KR}from"react";import{useModal as UR}from"@ehfuse/forma";function Ll({taskSeq:e,items:t,loading:o,onLoad:i}){let r={activity:UR({modalId:De("taskbox-task-activity")})},a=r.activity.isOpen;return KR(()=>{a&&e>0&&!t&&i?.(e)},[a,e,t,i]),{modals:r,items:t,loading:o,openDialog:()=>r.activity.open()}}import{jsx as Rr,jsxs as Vc}from"react/jsx-runtime";var QR={get created(){return n("activity.created")},get completed(){return n("activity.completed")},get uncompleted(){return n("activity.uncompleted")},get returned(){return n("activity.returned")},get confirm_requested(){return n("activity.confirmRequested")},get acked(){return n("activity.acked")},get claimed(){return n("activity.claimed")},get bug_verified(){return n("activity.bugVerified")},get bug_reopened(){return n("activity.bugReopened")}};function Nb(e){return String(e??"").trim()||n("common.none")}function JR(e){if(e.kind!=="field")return QR[String(e.kind)]??n("activity.changed");let t=String(e.field_label??e.field??"").trim()||n("activity.field"),o=String(e.old_value??"").trim(),i=String(e.new_value??"").trim();return!o&&i?n("activity.fieldSet",{label:t,after:i}):o&&!i?n("activity.fieldCleared",{label:t}):n("activity.fieldChanged",{label:t,value:Nb(o),value2:Nb(i)})}function Kc({controller:e}){M();let t=Ve(),{items:o,loading:i}=e,r=e.modals.activity,a=Rr(Er,{sx:{height:t?"100%":420,minHeight:0},children:Rr(XR,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:Vc(Er,{sx:{px:2,pt:2,display:"flex",flexDirection:"column",gap:1,"&::after":{content:'""',flexShrink:0,height:16}},children:[i&&!o?Vc(Er,{sx:{display:"flex",alignItems:"center",gap:1,color:"#9a9a97",fontSize:14.5},children:[Rr(jR,{size:14,thickness:5,sx:{color:"#9a9a97"}}),n("common.loading")]}):null,o&&o.length===0?Rr(Er,{sx:{fontSize:14.5,color:"#9a9a97"},children:n("activity.empty")}):null,(o??[]).map(l=>Vc(Er,{sx:{display:"flex",flexDirection:t?"column":"row",gap:t?.25:1,alignItems:t?"stretch":"baseline",minWidth:0,flexShrink:0,...t?{pb:1,borderBottom:`1px solid ${ne}`,"&:last-of-type":{borderBottom:"none",pb:0}}:{}},children:[Rr(Er,{sx:{flexShrink:0,...t?{}:{width:"10.5em"},whiteSpace:"nowrap",fontSize:13.5,color:"#9a9a97",lineHeight:1.5},children:Ao(l.acted_time)}),Vc(Er,{sx:{minWidth:0,fontSize:14.5,color:"#37352f",lineHeight:1.5},children:[Rr(Er,{component:"span",sx:{fontWeight:500},children:String(l.actor_name??"").trim()||n("dialog.noName")}),Rr(Er,{component:"span",sx:{ml:.5},children:JR(l)})]})]},l.seq))]})})});return Rr(YR,{open:r.isOpen,onClose:r.close,maxWidth:"sm",fullScreen:t,mobilePresentation:t?"slide":"dialog",contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sx:t?{DialogContent:{pb:0,"& .os-content > div":{height:"100%",boxSizing:"border-box",paddingBottom:0,marginBottom:0},"& .FormSection-content, & .section-content":{height:"100%",paddingBottom:0,marginBottom:0}}}:void 0,title:o&&o.length>0?n("activity.titleWithCount",{count:o.length}):n("activity.title"),locale:Be(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-activity",sections:[{id:"task-activity",showTitle:!1,children:a}],scrollPastLastSection:!1,actions:{showCancelButton:!1,right:Rr(GR,{variant:"contained",onClick:r.close,children:n("common.close")})}})}import{InfoAlert as ZR,SuccessAlert as eP}from"@ehfuse/alerts";var zb=e=>e?e.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<br\s*\/?>/gi,`
|
|
12
12
|
`).replace(/<\/(p|div|li|h[1-6]|tr)>/gi,`
|
|
13
13
|
`).replace(/<[^>]+>/g,"").replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&").replace(/\n{3,}/g,`
|
|
14
14
|
|