@ehfuse/taskbox 0.11.31 → 0.11.32
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 +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ use chrome, FireFox or Internet Explorer 11`)}var r=e("safe-buffer"),t=e("random
|
|
|
75
75
|
`).replace(/<li[^>]*>/gi,"\u2022 ");return(new DOMParser().parseFromString(u,"text/html").body.textContent??"").replace(/\n{3,}/g,`
|
|
76
76
|
|
|
77
77
|
`).trim()}function ys(e){return bs(e)?pl(e):e}function gl(e){let u=OU(Vc(e)).trim(),c=pl(u);return c.trim()?/<(?!\/?(p|br|span)(\s|>|\/))[a-z]/i.test(u)||/<span[^>]*style=/i.test(u)?u:c:""}var BU=new Set(["P","DIV","UL","OL","H1","H2","H3","H4","BLOCKQUOTE","PRE"]);function OU(e){if(typeof DOMParser>"u")return e;let u=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html"),c=u.body.firstElementChild;if(!c)return e;let l=null;for(let n of Array.from(c.childNodes)){if(n.nodeType===Node.ELEMENT_NODE&&BU.has(n.tagName)){l=null;continue}l||(l=u.createElement("p"),c.insertBefore(l,n)),l.appendChild(n)}for(let n of Array.from(c.querySelectorAll(":scope > p")))!n.textContent?.replace(/\u00a0/g," ").trim()&&!n.querySelector("br, img")&&n.remove();return c.innerHTML}function am(e){let u=l=>l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return e.split(`
|
|
78
|
-
`).map(l=>`<p>${l?u(l):"<br>"}</p>`).join("")}var bl=require("react/jsx-runtime"),AU={left:[["heading"],["bold","italic","strike","underline"],["link","bgcolor","code"],["bulletList","numberList"]],right:[]},np="<p><br></p>",Gc=(0,yo.forwardRef)(function({defaultHtml:u="",placeholder:c,alwaysExpanded:l=!1,autoFocus:n=!1,minHeight:a=44,maxHeight:r=280,onChange:t,onSubmit:o,onFiles:d,footer:i,variant:s="bare",mentionCandidates:h,slashCommands:f},m){let b=(0,yo.useRef)(null),g=(0,yo.useRef)(null),w=(0,yo.useRef)(null),[S,O]=(0,yo.useState)(!1),[M,j]=(0,yo.useState)(()=>!!pl(u).trim()),P=Uz(h,f),D=l||S||M;(0,yo.useImperativeHandle)(m,()=>({getComment:()=>gl(b.current?.getHtml()??""),clear:()=>{b.current?.setHtml(np),j(!1)},focus:()=>b.current?.focus(),insertText:W=>{let F=g.current?.querySelector(".ehfuse-editor-content");if(!F)return;F.focus();let C=window.getSelection(),B=w.current;if(!B||!F.contains(B.startContainer)){B=document.createRange();let R=F.lastElementChild??F;B.selectNodeContents(R),B.collapse(!1)}C?.removeAllRanges(),C?.addRange(B),document.execCommand("insertText",!1,W)}})),(0,yo.useLayoutEffect)(()=>{if(!n)return;let W=requestAnimationFrame(()=>b.current?.focus());return()=>cancelAnimationFrame(W)},[n]);let z=W=>{let F=Array.from(W??[]);return F.length===0||!d?!1:(d(F),!0)};return(0,bl.jsxs)(sm.Box,{...P.handlers,onKeyDownCapture:W=>{P.handlers.onKeyDownCapture(W),!W.defaultPrevented&&W.key==="Enter"&&(W.ctrlKey||W.metaKey)&&!W.nativeEvent.isComposing&&(W.preventDefault(),W.stopPropagation(),o?.())},onFocusCapture:()=>O(!0),ref:g,onBlurCapture:W=>{let F=window.getSelection();F&&F.rangeCount>0&&W.currentTarget.contains(F.anchorNode)&&(w.current=F.getRangeAt(0).cloneRange()),!W.currentTarget.contains(W.relatedTarget)&&(O(!1),gl(b.current?.getHtml()??"")||(b.current?.setHtml(np),w.current=null))},onPasteCapture:W=>{z(W.clipboardData?.files)&&(W.preventDefault(),W.stopPropagation())},onDropCapture:W=>{z(W.dataTransfer?.files)&&(W.preventDefault(),W.stopPropagation())},sx:{position:"relative",bgcolor:"#ffffff",...s==="boxed"?{border:"1px solid",borderColor:S?"primary.main":De.NOTION_LINE_COLOR,boxShadow:S?W=>`0 0 0 1px ${W.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:D?void 0:"none !important",background:"transparent",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`},"& .ehfuse-editor-content":{maxHeight:r,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":s==="boxed"?{top:"10px",left:"12px"}:{top:"12px",left:"16px"}},children:[(0,bl.jsx)(Kz.EhfuseEditor,{ref:b,defaultValue:u||np,autoHeight:!0,showToolbar:!0,toolbarOptions:AU,locale:ya(),minHeight:D?Math.max(a,64):a,placeholder:c,contentStyle:{padding:s==="boxed"?"10px 12px":"12px 16px"},onChange:W=>{let F=gl(W);j(!!F),t?.(F)}}),P.popper,i?(0,bl.jsx)(sm.Box,{sx:{display:"flex",alignItems:"center",px:1,pb:.75},children:i}):null]})});function lm({html:e}){let{openExternalUrl:u,mentionCandidates:c}=ot(),l=(0,yo.useRef)(null),n=Vc(e),a=(c??[]).map(r=>r.name).filter(r=>r.trim().length>=2);return(0,yo.useLayoutEffect)(()=>{let r=l.current;if(!r)return;r.innerHTML=n;let t=[...new Set(a)].sort((h,f)=>f.length-h.length);if(t.length===0||!n.includes("@"))return;let o=h=>h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`(^|[^A-Za-z0-9._%+-])(@(?:${t.map(o).join("|")}))`,"g"),i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),s=[];for(;i.nextNode();){let h=i.currentNode;h.data.includes("@")&&!h.parentElement?.closest("a, code")&&s.push(h)}for(let h of s){let f=h.data,m=document.createDocumentFragment(),b=0;for(let g of f.matchAll(d)){let w=(g.index??0)+g[1].length;w>b&&m.append(f.slice(b,w));let S=document.createElement("span");S.className="taskbox-mention",S.textContent=g[2],m.append(S),b=w+g[2].length}b!==0&&(b<f.length&&m.append(f.slice(b)),h.replaceWith(m))}},[n,a.join("|")]),(0,bl.jsx)(sm.Box,{ref:l,onClickCapture:r=>{let t=r.target?.closest?.("a[href]");t&&(r.preventDefault(),r.stopPropagation(),u?u(t.href):window.open(t.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 ${De.NOTION_LINE_COLOR}`,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}}})}var iF=require("@ehfuse/mui-confirm-action");_e();var Te=require("react/jsx-runtime"),EU=5;function Xz({kind:e,reactions:u,myAccountSeq:c,onToggle:l}){ue();let n=u??[],a=c>0&&n.some(d=>d.account_seq===c),r=e==="like"?I("section.reactLike"):I("section.reactAck"),t=n.length===0?r:(0,Te.jsx)(Xe.Box,{sx:{whiteSpace:"pre-line",fontSize:12},children:n.map(d=>`${d.name} \xB7 ${d.time}`).join(`
|
|
78
|
+
`).map(l=>`<p>${l?u(l):"<br>"}</p>`).join("")}var bl=require("react/jsx-runtime"),AU={left:[["heading"],["bold","italic","strike","underline"],["link","bgcolor","code"],["bulletList","numberList"]],right:[]},np="<p><br></p>",Gc=(0,yo.forwardRef)(function({defaultHtml:u="",placeholder:c,alwaysExpanded:l=!1,autoFocus:n=!1,minHeight:a=44,maxHeight:r=280,onChange:t,onSubmit:o,onFiles:d,footer:i,variant:s="bare",mentionCandidates:h,slashCommands:f},m){let b=(0,yo.useRef)(null),g=(0,yo.useRef)(null),w=(0,yo.useRef)(null),[S,O]=(0,yo.useState)(!1),[M,j]=(0,yo.useState)(()=>!!pl(u).trim()),P=Uz(h,f),D=l||S||M;(0,yo.useImperativeHandle)(m,()=>({getComment:()=>gl(b.current?.getHtml()??""),clear:()=>{b.current?.setHtml(np),j(!1)},focus:()=>b.current?.focus(),insertText:W=>{let F=g.current?.querySelector(".ehfuse-editor-content");if(!F)return;F.focus();let C=window.getSelection(),B=w.current;if(!B||!F.contains(B.startContainer)){B=document.createRange();let R=F.lastElementChild??F;B.selectNodeContents(R),B.collapse(!1)}C?.removeAllRanges(),C?.addRange(B),document.execCommand("insertText",!1,W)}})),(0,yo.useLayoutEffect)(()=>{if(!n)return;let W=requestAnimationFrame(()=>b.current?.focus());return()=>cancelAnimationFrame(W)},[n]);let z=W=>{let F=Array.from(W??[]);return F.length===0||!d?!1:(d(F),!0)};return(0,bl.jsxs)(sm.Box,{...P.handlers,onKeyDownCapture:W=>{P.handlers.onKeyDownCapture(W),!W.defaultPrevented&&W.key==="Enter"&&(W.ctrlKey||W.metaKey)&&!W.nativeEvent.isComposing&&(W.preventDefault(),W.stopPropagation(),o?.())},onFocusCapture:()=>O(!0),ref:g,onBlurCapture:W=>{let F=window.getSelection();F&&F.rangeCount>0&&W.currentTarget.contains(F.anchorNode)&&(w.current=F.getRangeAt(0).cloneRange()),!W.currentTarget.contains(W.relatedTarget)&&(O(!1),gl(b.current?.getHtml()??"")||(b.current?.setHtml(np),w.current=null))},onPasteCapture:W=>{z(W.clipboardData?.files)&&(W.preventDefault(),W.stopPropagation())},onDropCapture:W=>{z(W.dataTransfer?.files)&&(W.preventDefault(),W.stopPropagation())},sx:{position:"relative",bgcolor:"#ffffff",...s==="boxed"?{border:"1px solid",borderColor:S?"primary.main":De.NOTION_LINE_COLOR,boxShadow:S?W=>`0 0 0 1px ${W.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:D?void 0:"none !important",background:"transparent",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`},"& .ehfuse-editor-content":{maxHeight:r,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":s==="boxed"?{top:"10px",left:"12px"}:{top:"12px",left:"16px"}},children:[(0,bl.jsx)(Kz.EhfuseEditor,{ref:b,defaultValue:u||np,autoHeight:!0,autoHeightTailLines:0,showToolbar:!0,toolbarOptions:AU,locale:ya(),minHeight:D?Math.max(a,64):a,placeholder:c,contentStyle:{padding:s==="boxed"?"10px 12px":"12px 16px"},onChange:W=>{let F=gl(W);j(!!F),t?.(F)}}),P.popper,i?(0,bl.jsx)(sm.Box,{sx:{display:"flex",alignItems:"center",px:1,pb:.75},children:i}):null]})});function lm({html:e}){let{openExternalUrl:u,mentionCandidates:c}=ot(),l=(0,yo.useRef)(null),n=Vc(e),a=(c??[]).map(r=>r.name).filter(r=>r.trim().length>=2);return(0,yo.useLayoutEffect)(()=>{let r=l.current;if(!r)return;r.innerHTML=n;let t=[...new Set(a)].sort((h,f)=>f.length-h.length);if(t.length===0||!n.includes("@"))return;let o=h=>h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`(^|[^A-Za-z0-9._%+-])(@(?:${t.map(o).join("|")}))`,"g"),i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),s=[];for(;i.nextNode();){let h=i.currentNode;h.data.includes("@")&&!h.parentElement?.closest("a, code")&&s.push(h)}for(let h of s){let f=h.data,m=document.createDocumentFragment(),b=0;for(let g of f.matchAll(d)){let w=(g.index??0)+g[1].length;w>b&&m.append(f.slice(b,w));let S=document.createElement("span");S.className="taskbox-mention",S.textContent=g[2],m.append(S),b=w+g[2].length}b!==0&&(b<f.length&&m.append(f.slice(b)),h.replaceWith(m))}},[n,a.join("|")]),(0,bl.jsx)(sm.Box,{ref:l,onClickCapture:r=>{let t=r.target?.closest?.("a[href]");t&&(r.preventDefault(),r.stopPropagation(),u?u(t.href):window.open(t.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 ${De.NOTION_LINE_COLOR}`,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}}})}var iF=require("@ehfuse/mui-confirm-action");_e();var Te=require("react/jsx-runtime"),EU=5;function Xz({kind:e,reactions:u,myAccountSeq:c,onToggle:l}){ue();let n=u??[],a=c>0&&n.some(d=>d.account_seq===c),r=e==="like"?I("section.reactLike"):I("section.reactAck"),t=n.length===0?r:(0,Te.jsx)(Xe.Box,{sx:{whiteSpace:"pre-line",fontSize:12},children:n.map(d=>`${d.name} \xB7 ${d.time}`).join(`
|
|
79
79
|
`)}),o=e==="like"?"#e5484d":"#2f80ed";return(0,Te.jsx)(Xe.Tooltip,{title:t,arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:(0,Te.jsxs)(Xe.Box,{sx:{display:"inline-flex",alignItems:"center"},children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.commentReaction",{label:r}),onClick:l,sx:{color:a?o:"#c9c8c5",p:.5,"&:hover":{color:a?o:"#787774"}},children:e==="like"?a?(0,Te.jsx)(Jz.default,{sx:{fontSize:16}}):(0,Te.jsx)(eF.default,{sx:{fontSize:16}}):a?(0,Te.jsx)(tF.default,{sx:{fontSize:16}}):(0,Te.jsx)(nF.default,{sx:{fontSize:16}})}),n.length>0?(0,Te.jsx)(Xe.Box,{component:"span",sx:{fontSize:12,color:a?o:"#9a9a97",ml:-.25},children:n.length}):null]})})}function ip({taskSeq:e,comments:u,currentUserName:c="",myAccountSeq:l=0,avatarSrcByName:n,onUpdate:a,onRemove:r,onToggleReaction:t,onPreview:o,onDownload:d}){ue();let[i,s]=(0,vo.useState)(null),h=(0,vo.useRef)(null),[f,m]=(0,vo.useState)(null),b=Sn(),[g,w]=(0,vo.useState)(null),S=(k,x)=>{navigator.clipboard.writeText(x).then(()=>{w(k),setTimeout(()=>w(T=>T===k?null:T),1500)})},[O,M]=(0,vo.useState)(!1),j=Math.max(0,u.length-EU),P=j>0&&!O,D=i?Math.min(i.index,j):j,z=u.map((k,x)=>({comment:k,index:x})).slice(P?D:0),W=Ns(),F=(k,x)=>{if(o){o(k,x&&x.length>1?x:void 0);return}window.open(W(k.uuid??""),"_blank","noopener,noreferrer")},C=k=>{if(d){d(k);return}window.open(W(k.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},B=ot(),R=B.slots?.avatar,p=B.commentInput?.richEditor===!0,y=Wd();return(0,Te.jsxs)(Xe.Box,{className:"taskbox-comments",sx:{px:2,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[y.showIcon?(0,Te.jsx)(ta,{sx:{fontSize:18,display:"block",color:y.color}}):null,(0,Te.jsxs)(Xe.Box,{sx:{fontSize:Hd,fontWeight:y.fontWeight,color:y.color},children:[I("section.comments"),u.length>0?` (${u.length})`:""]}),j>0&&(!P||D>0)?(0,Te.jsx)(Xe.Box,{role:"button",tabIndex:0,onClick:()=>M(k=>!k),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),M(x=>!x))},sx:{ml:"auto",flexShrink:0,cursor:"pointer",fontSize:14.5,color:"#5b87d6","&:hover":{textDecoration:"underline"}},children:P?I("section.showOlder",{keepFrom:D}):I("section.hideOlder")}):null]}),u.length===0?(0,Te.jsx)(Xe.Box,{sx:{mt:1,fontSize:14.5,color:"#9a9a97"},children:I("section.noComments")}):null,(0,Te.jsx)(Xe.Box,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:z.map(({comment:k,index:x})=>{let T=!!c&&k.author===c,_=(0,Te.jsx)(Xe.Box,{component:"span",sx:{fontSize:14.5,fontWeight:700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.author}),N=k.external?(0,Te.jsx)(Xe.Box,{component:"span",sx:{flexShrink:0,px:.6,fontSize:11.5,fontWeight:500,lineHeight:"18px",color:"#d9730d",bgcolor:"#fdf0e6",borderRadius:"4px",whiteSpace:"nowrap"},children:I("section.merchant")}):null;return(0,Te.jsxs)(Xe.Box,{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=n?.get(k.author)??"";return R?(0,Te.jsx)(Xe.Box,{sx:{display:"inline-flex",flexShrink:0},children:(0,Te.jsx)(R,{name:k.author,src:H||void 0,size:44})}):(0,Te.jsx)(Xe.Box,{sx:{display:"inline-flex",flexShrink:0},children:(0,Te.jsx)(Jr,{src:H,name:k.author,avatarSx:{width:44,height:44,fontSize:20,borderRadius:"50%",...Ji[0]},iconFontSize:24})})})(),(0,Te.jsxs)(Xe.Box,{sx:{flex:1,minWidth:0},children:[b?(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[_,N]}):null,(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,position:"relative"},children:[b?null:_,b?null:N,(0,Te.jsx)(Xe.Box,{component:"span",sx:{fontSize:12.5,color:"#9a9a97",flexShrink:0,whiteSpace:"nowrap"},children:k.time}),T?(0,Te.jsx)(Xe.Box,{sx:{ml:"auto"}}):(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:.25,ml:"auto",flexShrink:0},children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.copyComment"),onClick:()=>S(x,ys(k.text)),sx:{color:g===x?"#2f9e5b":"#9a9a97",p:.5,"&:hover":{color:"#37352f"}},children:g===x?(0,Te.jsx)(op.default,{sx:{fontSize:15}}):(0,Te.jsx)(rp.default,{sx:{fontSize:15}})}),(0,Te.jsx)(Xz,{kind:"like",reactions:k.likes,myAccountSeq:l,onToggle:()=>t?.(e,x,"like")}),(0,Te.jsx)(Xz,{kind:"ack",reactions:k.acks,myAccountSeq:l,onToggle:()=>t?.(e,x,"ack")})]}),T?(0,Te.jsxs)(Xe.Box,{className:"taskbox-comment-actions",sx:{display:"flex",alignItems:"center",gap:.25,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",pointerEvents:b?"auto":"none",backgroundColor:"var(--taskbox-comment-bg, #fff)",opacity:b?1:0,transition:"opacity 0.15s"},children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.copyComment"),onClick:()=>S(x,ys(k.text)),sx:{color:g===x?"#2f9e5b":"#9a9a97","&:hover":{color:"#37352f"}},children:g===x?(0,Te.jsx)(op.default,{sx:{fontSize:15}}):(0,Te.jsx)(rp.default,{sx:{fontSize:15}})}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.editComment"),onClick:()=>s({index:x,text:k.text,attachments:[...k.attachments??[]],files:[]}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(Qz.default,{sx:{fontSize:15}})}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.deleteComment"),onClick:H=>m({anchorEl:H.currentTarget,index:x}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)($c.default,{sx:{fontSize:15}})})]}):null]}),i?.index===x?(0,Te.jsxs)(Xe.Box,{sx:{mt:.5},children:[p||bs(k.text)?(0,Te.jsx)(Gc,{defaultHtml:bs(k.text)?k.text:am(k.text),alwaysExpanded:!0,autoFocus:!0,variant:"boxed",minHeight:56,onChange:H=>s(V=>V&&{...V,text:H})}):(0,Te.jsx)(Xe.Box,{component:"textarea",autoFocus:!0,spellCheck:!1,value:i.text,onChange:H=>s({...i,text:H.target.value}),sx:{width:"100%",minHeight:56,border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,outline:"none",font:"inherit",fontSize:14,p:1,resize:"vertical",boxSizing:"border-box"}}),(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75,mt:.75},children:[i.attachments.map((H,V)=>{let U=()=>s({...i,attachments:i.attachments.filter((L,G)=>G!==V)});return Uc(H.name)&&H.uuid?(0,Te.jsxs)(Xe.Box,{sx:{position:"relative"},children:[(0,Te.jsx)(Xe.Box,{component:"img",src:W(H.uuid,{thumb:"md"}),alt:H.name,title:H.name,loading:"lazy",sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${De.NOTION_LINE_COLOR}`,display:"block"}}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.removeAttachment"),onClick:U,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${De.NOTION_LINE_COLOR}`,"&:hover":{bgcolor:"#f1f5f9"}},children:(0,Te.jsx)($c.default,{sx:{fontSize:14}})})]},`kept-${H.uuid}-${V}`):(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(vs.default,{sx:{fontSize:14}}),label:H.name,onDelete:U,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`kept-${H.uuid??H.name}-${V}`)}),i.files.map((H,V)=>{let U=()=>s({...i,files:i.files.filter((L,G)=>G!==V)});return Uc(H.name)?(0,Te.jsxs)(Xe.Box,{sx:{position:"relative"},children:[(0,Te.jsx)(Xe.Box,{component:"img",src:URL.createObjectURL(H),alt:H.name,title:I("section.newFile",{name:H.name}),onLoad:L=>URL.revokeObjectURL(L.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"2px solid #2f80ed",display:"block"}}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.removeAttachment"),onClick:U,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${De.NOTION_LINE_COLOR}`,"&:hover":{bgcolor:"#f1f5f9"}},children:(0,Te.jsx)($c.default,{sx:{fontSize:14}})})]},`new-${H.name}-${V}`):(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(vs.default,{sx:{fontSize:14}}),label:I("section.newFile",{name:H.name}),onDelete:U,sx:{fontSize:14,height:26,bgcolor:"#eef4ff"}},`new-${H.name}-${V}`)}),(0,Te.jsx)(Xe.Tooltip,{title:I("section.addAttachment"),arrow:!0,children:(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.addAttachment"),onClick:()=>h.current?.click(),sx:{ml:"auto",color:"#2f80ed"},children:(0,Te.jsx)(rF.default,{sx:{fontSize:20}})})})]}),(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.75,mt:.5},children:[(0,Te.jsx)(Xe.Button,{size:"small",color:"inherit",onClick:()=>s(null),children:I("common.cancel")}),(0,Te.jsx)(Xe.Button,{size:"small",variant:"contained",disabled:!i.text.trim()&&i.attachments.length===0&&i.files.length===0,onClick:()=>{a(e,x,i.text,{attachments:i.attachments,files:i.files}),s(null)},children:I("common.save")})]}),(0,Te.jsx)(Xe.Box,{component:"input",type:"file",multiple:!0,ref:h,sx:{display:"none"},onChange:H=>{let V=Array.from(H.target.files??[]);V.length>0&&s({...i,files:[...i.files,...V].slice(0,10)}),H.target.value=""}})]}):(0,Te.jsxs)(Xe.Box,{children:[k.text?bs(k.text)?(0,Te.jsx)(lm,{html:k.text}):(0,Te.jsx)(Xe.Box,{sx:{fontSize:15,whiteSpace:"pre-wrap"},children:(0,Te.jsx)(Ff,{text:k.text})}):null,(k.attachments??[]).length>0?(0,Te.jsx)(Xe.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mt:.75},children:(k.attachments??[]).map((H,V)=>{let U=!!H.uuid,L=Uc(H.name),G=(k.attachments??[]).filter(A=>!!A.uuid&&Uc(A.name));if(L&&U)return(0,Te.jsx)(Xe.Box,{component:"img",src:W(H.uuid??"",{thumb:"md"}),alt:H.name,title:I("section.viewLarge",{name:H.name}),loading:"lazy",onClick:()=>F(H,G),sx:{width:96,height:96,objectFit:"cover",borderRadius:1,border:`1px solid ${De.NOTION_LINE_COLOR}`,cursor:"pointer",bgcolor:"#f8fafc"}},`${H.name}-${V}`);let E=Yd(H.name);return(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(vs.default,{sx:{fontSize:14}}),label:`${H.name} (${ep(H.size)})`,clickable:U,onClick:U?()=>E?F(H):C(H):void 0,title:U?I("section.fileAction",{name:H.name,value:E?I("section.preview"):I("section.download")}):H.name,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${H.name}-${V}`)})}):null]})]})]},`${k.time}-${x}`)})}),(0,Te.jsx)(iF.ConfirmActionPopper,{open:!!f,anchorEl:f?.anchorEl??null,title:I("section.deleteCommentConfirm"),confirmText:I("common.delete"),onCancel:()=>m(null),onConfirm:()=>{f&&(r(e,f.index),s(null)),m(null)}})]})}function Uc(e){return/\.(png|jpe?g|gif|webp|bmp|svg|heic|heif)$/i.test(String(e??"").trim())}function PU(e){let{commentInput:u,mentionCandidates:c}=ot(),n=((e?.mentionCandidates??c)?.length??0)>0,a=e?.placeholder??u?.placeholder,r=e?.placeholderShort??u?.placeholderShort,t=a??I(n?"section.commentPlaceholder":"section.commentPlaceholderPlain"),o=r??a??I(n?"section.commentPlaceholderShort":"section.commentPlaceholderPlain");return{wide:t,short:o}}function MU(){return(0,Te.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[(0,Te.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),(0,Te.jsx)("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"}),(0,Te.jsx)("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),(0,Te.jsx)("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"})]})}function ap({onSubmit:e,rows:u=2,placeholder:c,placeholderShort:l,richEditor:n,mentionCandidates:a,slashCommands:r,attachments:t=!0,emojiPicker:o,disabled:d=!1}){ue();let[i,s]=(0,vo.useState)(""),h=tp({value:i,setValue:s,candidates:a,slashCommands:r}),[f,m]=(0,vo.useState)([]),[b,g]=(0,vo.useState)(!1),w=(0,vo.useRef)(null),S=(0,vo.useRef)(null),O=Sn(),M=O||u===1,j=ot(),P=PU({placeholder:c,placeholderShort:l,mentionCandidates:a}),D=!O&&(n??j.commentInput?.richEditor)===!0,z=_=>{if(!t)return;let N=Array.from(_??[]);N.length!==0&&m(H=>[...H,...N].slice(0,10))},W=(0,vo.useRef)(null),[F,C]=(0,vo.useState)(""),B=()=>{if(d)return;let _=D?(W.current?.getComment()??"").trim():i.trim();!_&&f.length===0||(e(_,f.length>0?f:void 0),s(""),W.current?.clear(),C(""),m([]))},R=o??j.slots?.emojiPicker,[p,y]=(0,vo.useState)(null),k=_=>{D?W.current?.insertText(_):s(N=>`${N}${_}`),y(null)},x=_=>(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.postComment"),disabled:_||d,onClick:B,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:(0,Te.jsx)(Yz.default,{sx:{fontSize:22}})}),T=(0,Te.jsxs)(Te.Fragment,{children:[t?(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.attachFile"),onClick:()=>w.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(vs.default,{sx:{fontSize:20}})}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.attachImage"),onClick:()=>S.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(oF.default,{sx:{fontSize:20}})})]}):null,(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.emoji"),onMouseDown:_=>_.preventDefault(),onClick:_=>y(_.currentTarget),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(MU,{})}),(0,Te.jsx)(Xe.Popover,{open:!!p,anchorEl:p,onClose:()=>y(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:R?(0,Te.jsx)(R,{onPick:k}):(0,Te.jsx)(Gz,{onPick:k})})]});return(0,Te.jsxs)(Xe.Box,{children:[f.length>0?(0,Te.jsx)(Xe.Box,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1.5,px:2,pt:2},children:f.map((_,N)=>Uc(_.name)?(0,Te.jsxs)(Xe.Box,{sx:{position:"relative"},children:[(0,Te.jsx)(Xe.Box,{component:"img",src:URL.createObjectURL(_),alt:_.name,title:_.name,onLoad:H=>URL.revokeObjectURL(H.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${De.NOTION_LINE_COLOR}`,display:"block"}}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.removeAttachment"),onClick:()=>m(H=>H.filter((V,U)=>U!==N)),sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${De.NOTION_LINE_COLOR}`,"&:hover":{bgcolor:"#f1f5f9"}},children:(0,Te.jsx)($c.default,{sx:{fontSize:14}})})]},`${_.name}-${N}`):(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(vs.default,{sx:{fontSize:14}}),label:`${_.name} (${ep(_.size)})`,onDelete:()=>m(H=>H.filter((V,U)=>U!==N)),sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${_.name}-${N}`))}):null,(0,Te.jsxs)(Xe.Box,{sx:{position:"relative",display:"flex"},onDragOver:_=>{!t||!Array.from(_.dataTransfer?.types??[]).includes("Files")||(_.preventDefault(),g(!0))},onDragLeave:_=>{_.currentTarget.contains(_.relatedTarget)||g(!1)},onDrop:_=>{!t||!Array.from(_.dataTransfer?.types??[]).includes("Files")||(_.preventDefault(),g(!1),z(_.dataTransfer?.files??null))},children:[b?(0,Te.jsxs)(Xe.Box,{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:[(0,Te.jsx)(vs.default,{sx:{fontSize:18}}),I("section.dropToAttach")]}):null,D?(0,Te.jsx)(Xe.Box,{sx:{flex:1,minWidth:0},children:(0,Te.jsx)(Gc,{ref:W,placeholder:P.wide,mentionCandidates:a,slashCommands:r,alwaysExpanded:f.length>0,onChange:C,onSubmit:B,onFiles:_=>{t&&m(N=>[...N,..._].slice(0,10))},footer:(0,Te.jsxs)(Te.Fragment,{children:[T,(0,Te.jsx)(Xe.Box,{sx:{flex:1}}),x(!F&&f.length===0)]})})}):(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(Zz.TextField,{value:i,placeholder:M?P.short:P.wide,onChange:_=>s(_.target.value),inputRef:h.inputRef,onSelect:h.onSelectionChange,onKeyDown:_=>{h.onKeyDown(_)},onPaste:_=>{let N=Array.from(_.clipboardData?.files??[]);!t||N.length===0||(_.preventDefault(),z(_.clipboardData.files))},fullWidth:!0,multiline:!0,minRows:M?1:u,maxRows:3,sx:{"& .MuiInputBase-root":{pl:2,pr:M?15:6.5,pb:M?void 0:5,borderRadius:0},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}}),h.popper,M?(0,Te.jsxs)(Xe.Box,{sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:.25},children:[T,x(!i.trim()&&f.length===0)]}):(0,Te.jsxs)(Xe.Box,{sx:{position:"absolute",left:0,right:0,bottom:0,display:"flex",alignItems:"center",px:1,pb:.75},children:[T,(0,Te.jsx)(Xe.Box,{sx:{flex:1}}),x(!i.trim()&&f.length===0)]})]})]}),(0,Te.jsx)(Xe.Box,{component:"input",ref:w,type:"file",multiple:!0,onChange:_=>{z(_.target.files),_.target.value=""},sx:{display:"none"}}),(0,Te.jsx)(Xe.Box,{component:"input",ref:S,type:"file",accept:"image/*",multiple:!0,onChange:_=>{z(_.target.files),_.target.value=""},sx:{display:"none"}})]})}var vl=require("react"),An=require("@mui/material"),fF=v(require("@mui/icons-material/Close"),1),pF=v(require("@mui/icons-material/ArrowBack"),1),gF=v(require("@mui/icons-material/ContentCopyOutlined"),1),bF=v(require("@mui/icons-material/ShareOutlined"),1),yF=v(require("@mui/icons-material/HistoryOutlined"),1),vF=v(require("@mui/icons-material/Print"),1);var kF=require("@ehfuse/mui-confirm-action");pn();var Do=require("@mui/material"),cF=require("@ehfuse/mui-form-dialog"),uF=require("@ehfuse/overlay-scrollbar");_e();var aF=require("react"),sF=require("@ehfuse/forma");function yl({taskSeq:e,items:u,loading:c,onLoad:l}){let n={activity:(0,sF.useModal)({modalId:Nt("taskbox-task-activity")})},a=n.activity.isOpen;return(0,aF.useEffect)(()=>{a&&e>0&&!u&&l?.(e)},[a,e,u,l]),{modals:n,items:u,loading:c,openDialog:()=>n.activity.open()}}var ko=require("react/jsx-runtime"),RU={get created(){return I("activity.created")},get completed(){return I("activity.completed")},get uncompleted(){return I("activity.uncompleted")},get returned(){return I("activity.returned")},get confirm_requested(){return I("activity.confirmRequested")},get acked(){return I("activity.acked")},get claimed(){return I("activity.claimed")},get bug_verified(){return I("activity.bugVerified")},get bug_reopened(){return I("activity.bugReopened")}};function lF(e){return String(e??"").trim()||I("common.none")}function DU(e){if(e.kind!=="field")return RU[String(e.kind)]??I("activity.changed");let u=String(e.field_label??e.field??"").trim()||I("activity.field"),c=String(e.old_value??"").trim(),l=String(e.new_value??"").trim();return!c&&l?I("activity.fieldSet",{label:u,after:l}):c&&!l?I("activity.fieldCleared",{label:u}):I("activity.fieldChanged",{label:u,value:lF(c),value2:lF(l)})}function Kc({controller:e}){ue();let u=Sn(),{items:c,loading:l}=e,n=e.modals.activity,a=(0,ko.jsx)(Do.Box,{sx:{height:u?"100%":420,minHeight:0},children:(0,ko.jsx)(uF.OverlayScrollbar,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:(0,ko.jsxs)(Do.Box,{sx:{px:2,pt:2,display:"flex",flexDirection:"column",gap:1,"&::after":{content:'""',flexShrink:0,height:16}},children:[l&&!c?(0,ko.jsxs)(Do.Box,{sx:{display:"flex",alignItems:"center",gap:1,color:"#9a9a97",fontSize:14.5},children:[(0,ko.jsx)(Do.CircularProgress,{size:14,thickness:5,sx:{color:"#9a9a97"}}),I("common.loading")]}):null,c&&c.length===0?(0,ko.jsx)(Do.Box,{sx:{fontSize:14.5,color:"#9a9a97"},children:I("activity.empty")}):null,(c??[]).map(r=>(0,ko.jsxs)(Do.Box,{sx:{display:"flex",flexDirection:u?"column":"row",gap:u?.25:1,alignItems:u?"stretch":"baseline",minWidth:0,flexShrink:0,...u?{pb:1,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,"&:last-of-type":{borderBottom:"none",pb:0}}:{}},children:[(0,ko.jsx)(Do.Box,{sx:{flexShrink:0,...u?{}:{width:"10.5em"},whiteSpace:"nowrap",fontSize:13.5,color:"#9a9a97",lineHeight:1.5},children:Io(r.acted_time)}),(0,ko.jsxs)(Do.Box,{sx:{minWidth:0,fontSize:14.5,color:"#37352f",lineHeight:1.5},children:[(0,ko.jsx)(Do.Box,{component:"span",sx:{fontWeight:500},children:String(r.actor_name??"").trim()||I("dialog.noName")}),(0,ko.jsx)(Do.Box,{component:"span",sx:{ml:.5},children:DU(r)})]})]},r.seq))]})})});return(0,ko.jsx)(cF.FormDialog,{open:n.isOpen,onClose:n.close,maxWidth:"sm",fullScreen:u,mobilePresentation:u?"slide":"dialog",contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sx:u?{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:c&&c.length>0?I("activity.titleWithCount",{count:c.length}):I("activity.title"),locale:At(),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:(0,ko.jsx)(Do.Button,{variant:"contained",onClick:n.close,children:I("common.close")})}})}var cm=require("@ehfuse/alerts");var dF=e=>e?e.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<br\s*\/?>/gi,`
|
|
80
80
|
`).replace(/<\/(p|div|li|h[1-6]|tr)>/gi,`
|
|
81
81
|
`).replace(/<[^>]+>/g,"").replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&").replace(/\n{3,}/g,`
|