@ehfuse/mui-virtual-data-table 1.1.35 → 1.2.1
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/README.md +24 -0
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/types.d.ts +55 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ht=Object.create;var xe=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Ot=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty;var Nt=(o,d)=>{for(var l in d)xe(o,l,{get:d[l],enumerable:!0})},Ze=(o,d,l,C)=>{if(d&&typeof d=="object"||typeof d=="function")for(let m of Ot(d))!Bt.call(o,m)&&m!==l&&xe(o,m,{get:()=>d[m],enumerable:!(C=It(d,m))||C.enumerable});return o};var zt=(o,d,l)=>(l=o!=null?Ht(At(o)):{},Ze(d||!o||!o.__esModule?xe(l,"default",{value:o,enumerable:!0}):l,o)),Ft=o=>Ze(xe({},"__esModule",{value:!0}),o);var Yt={};Nt(Yt,{VirtualDataTable:()=>ot});module.exports=Ft(Yt);var a=require("react"),i=require("@mui/material"),nt=require("react-virtuoso");var ye=require("react/jsx-runtime"),j=require("react"),we=require("@mui/material"),re=function(){return re=Object.assign||function(d){for(var l,C=1,m=arguments.length;C<m;C++){l=arguments[C];for(var y in l)Object.prototype.hasOwnProperty.call(l,y)&&(d[y]=l[y])}return d},re.apply(this,arguments)};function Qe(o){var d=o.visible,l=o.onComplete,C=o.fadeoutDuration,m=C===void 0?200:C,y=o.exitDelay,oe=y===void 0?0:y,ae=o.size,G=ae===void 0?40:ae,X=o.className,J=o.style,H=o.sx,D=o.indicator,x=o.background,S=x===void 0?{show:!0,color:"255, 255, 255",opacity:.9}:x,ie=(0,j.useRef)(void 0),B=(0,j.useRef)(null),se=(0,j.useState)(d),Ce=se[0],le=se[1],de=S.show,I=de===void 0?!0:de,N=S.color,E=N===void 0?"255, 255, 255":N,P=S.opacity,v=P===void 0?.9:P;if((0,j.useEffect)(function(){var z=ie.current;if(z===!0&&d===!1&&B.current){var F=B.current;F.style.opacity="0",setTimeout(function(){le(!1),l?.()},m+oe)}else d===!0&&(le(!0),B.current&&(B.current.style.opacity="1"));ie.current=d},[d,l,m,oe]),!Ce)return null;var ce=function(){return typeof D=="string"?(0,ye.jsx)("img",{src:D,alt:"Loading",style:{width:G,height:G}}):D||(0,ye.jsx)(we.CircularProgress,{size:G})},ve=function(){return I?E.startsWith("rgba")?{backgroundColor:E}:/^\d+,\s*\d+,\s*\d+$/.test(E)?{backgroundColor:"rgba(".concat(E,", ").concat(v,")")}:v!==1?{backgroundColor:E,"&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:E,opacity:v,zIndex:-1}}:{backgroundColor:E}:{backgroundColor:"transparent"}};return(0,ye.jsx)(we.Box,{ref:B,className:X,style:re({},J),sx:re(re({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,opacity:d?1:0,transition:"opacity ".concat(m,"ms ease-out")},ve()),H),children:ce()})}var Y=require("react/jsx-runtime"),Vt=`
|
|
2
2
|
.vdt-css-spinner{box-sizing:border-box;border-radius:50%;border:4px solid rgba(28,64,125,0.14);border-top-color:#1c407d;animation:vdt-css-spinner-spin .75s linear infinite}
|
|
3
3
|
@keyframes vdt-css-spinner-spin{to{transform:rotate(360deg)}}
|
|
4
|
-
`;function Fe({size:n=54}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("style",{children:gt}),(0,z.jsx)("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:n,height:n}})]})}var Ve=pt(require("@ehfuse/overlay-scrollbar"),1),o=require("react/jsx-runtime"),ht={alignment:"default",margin:0,radius:0},Pe=5,bt={bg:"#ffffff",border:"#e6e6e3",borderStrong:"#dedddb",headerColor:"#787774",hoverBg:"#f8f8f7"},He="12px",mt={bg:"#1e1e1e",border:"#2c333c",borderStrong:"#3b434e",headerColor:"#a3adbb",hoverBg:"#272d36"};function xt({data:n,loading:l=!1,columns:c,onRowClick:x,getRowId:m,selectedRowId:h,selectedRowSx:y,rowHeight:C=50,columnHeight:B,striped:V,rowDivider:j=!0,onSort:R,onLoadMore:M,sortBy:g,sortDirection:v,showPaper:q=!0,paddingX:E,paddingTop:J=0,paddingBottom:ce=0,rowHoverColor:U,rowHoverOpacity:Z,viewportBuffer:L,overscan:I,scrollbars:T,emptyMessage:W="NO DATA",LoadingComponent:A,showFooter:de,footerHeight:N,footerSx:O,variant:ue="default"}){let F=ue==="notion",P=(0,a.useTheme)().palette.mode==="dark"?mt:bt,_=B??(F?40:56),Q=E??(F?"12px":"1rem"),pe=U??(F?P.hoverBg:void 0),Re=Z??(F?1:void 0),Ae=Math.max(C*12,480),_e=Math.max(C*12,480),$e=typeof L=="number"?L:L?.top??Ae,Be=typeof L=="number"?L:L?.bottom??_e,je=Math.max(C*8,420),Ye=Math.max(C*10,520),Ke=typeof I=="number"?I:{main:I?.main??je,reverse:I?.reverse??Ye},ee=C+(j?1:0),te=!y||typeof y!="function",Ge=(0,i.useMemo)(()=>!te||h===null||h===void 0||!y?null:{[`& tbody tr[data-row-id="${String(h).replace(/["\\]/g,"\\$&")}"]`]:y},[te,h,y]),wt=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),[f]=(0,i.useState)(()=>typeof window>"u"?!1:window.localStorage.getItem("vdt-perf-debug")==="1"),p=(0,i.useRef)({wheelEvents:0,wheelInputPx:0,wheelHandlerMs:0,wheelRafFlushes:0,wheelRafMs:0,rangeChangedCalls:0,rangeChangedMs:0,rowContentCalls:0,rowContentMs:0,rowContentMaxMs:0,cellRenderCalls:0,cellRenderMs:0,cellRenderMaxMs:0}),fe=(0,i.useCallback)(r=>{if(!f)return;let t=p.current;if(!(t.wheelEvents>0||t.rangeChangedCalls>0||t.rowContentCalls>0||t.cellRenderCalls>0))return;let u=t.rowContentCalls>0?t.rowContentMs/t.rowContentCalls:0,d=t.cellRenderCalls>0?t.cellRenderMs/t.cellRenderCalls:0;console.log("[VDT perf]",{reason:r,wheel:{events:t.wheelEvents,inputPx:Math.round(t.wheelInputPx),handlerMs:Number(t.wheelHandlerMs.toFixed(2)),rafFlushes:t.wheelRafFlushes,rafMs:Number(t.wheelRafMs.toFixed(2))},rangeChanged:{calls:t.rangeChangedCalls,totalMs:Number(t.rangeChangedMs.toFixed(2))},rowContent:{calls:t.rowContentCalls,totalMs:Number(t.rowContentMs.toFixed(2)),avgMs:Number(u.toFixed(3)),maxMs:Number(t.rowContentMaxMs.toFixed(3))},cellRender:{calls:t.cellRenderCalls,totalMs:Number(t.cellRenderMs.toFixed(2)),avgMs:Number(d.toFixed(3)),maxMs:Number(t.cellRenderMaxMs.toFixed(3))}}),p.current={wheelEvents:0,wheelInputPx:0,wheelHandlerMs:0,wheelRafFlushes:0,wheelRafMs:0,rangeChangedCalls:0,rangeChangedMs:0,rowContentCalls:0,rowContentMs:0,rowContentMaxMs:0,cellRenderCalls:0,cellRenderMs:0,cellRenderMaxMs:0}},[f]);(0,i.useEffect)(()=>{if(!f||typeof window>"u")return;console.log("[VDT perf] enabled (localStorage vdt-perf-debug=1)");let r=window.setInterval(()=>{fe("interval")},1500);return()=>{window.clearInterval(r),fe("cleanup")}},[fe,f]);let Le=(0,i.useMemo)(()=>(0,i.forwardRef)((r,t)=>{let s=(0,i.useRef)(null),u=(0,i.useRef)(0),d=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=s.current;if(!e)return;let w=S=>{let $=f?performance.now():0;S.preventDefault();let k=S.deltaY;S.deltaMode===1?k*=40:S.deltaMode===2&&(k*=e.clientHeight),f&&(p.current.wheelEvents+=1,p.current.wheelInputPx+=k),u.current+=k,d.current===null&&(d.current=requestAnimationFrame(()=>{let ve=f?performance.now():0,re=Math.max(e.clientHeight*.4,160),b=Math.max(-re,Math.min(re,u.current));u.current=0,d.current=null,b!==0&&(e.scrollTop+=b),f&&(p.current.wheelRafFlushes+=1,p.current.wheelRafMs+=performance.now()-ve)}),f&&(p.current.wheelHandlerMs+=performance.now()-$))};return e.addEventListener("wheel",w,{passive:!1}),()=>{e.removeEventListener("wheel",w),d.current!==null&&(cancelAnimationFrame(d.current),d.current=null),u.current=0}},[]),(0,o.jsx)(Ve.default,{detectInnerScroll:!0,track:ht,...T,children:(0,o.jsx)(a.TableContainer,{component:a.Box,...r,ref:e=>{s.current=e,typeof t=="function"?t(e):t&&(t.current=e)},sx:{userSelect:"auto",WebkitUserSelect:"auto",position:"relative",width:"100%",height:"100%",overflow:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none",msOverflowStyle:"none",transform:"translateZ(0)",backfaceVisibility:"hidden",willChange:"scroll-position","&::-webkit-scrollbar":{display:"none"},"& .MuiTable-root":{paddingRight:F?0:Q,paddingTop:J,paddingBottom:ce}}})})}),[]),ge=(0,i.useMemo)(()=>{if(V===!0)return"#f5f5f5";if(typeof V=="string")return V},[V]),[Xe,De]=(0,i.useState)(l),[qe,Je]=(0,i.useState)(0);(0,i.useEffect)(()=>{l&&De(!0)},[l]);let ke=(0,i.useCallback)(()=>{De(!1)},[]),Ue=Xe,vt=l&&n.length>0,he=(0,i.useRef)(!1),be=(0,i.useRef)(-1),me=(0,i.useRef)(null),xe=(0,i.useRef)(x);xe.current=x;let Y=(0,i.useRef)(m);Y.current=m;let ye=!!x,K=(0,i.useRef)(!1),G=(0,i.useRef)({x:0,y:0});(0,i.useEffect)(()=>{let r=t=>{let s=t.clientX-G.current.x,u=t.clientY-G.current.y;Math.sqrt(s*s+u*u)>Pe&&(K.current=!0)};return document.addEventListener("mousemove",r),()=>{document.removeEventListener("mousemove",r)}},[]),(0,i.useEffect)(()=>{let r=document.querySelector('[data-testid="virtuoso-scroller"]');r&&r.querySelectorAll(".MuiTableSortLabel-root").forEach(s=>{let u=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});s.dispatchEvent(u)})},[g]);let ne=(0,i.useCallback)(r=>{if(!R)return;R(r,g===r&&v==="asc"?"desc":"asc")},[R,g,v]),Ze=(0,i.useCallback)(r=>{let t=f?performance.now():0;if(!M){f&&(p.current.rangeChangedCalls+=1,p.current.rangeChangedMs+=performance.now()-t);return}if(l&&n.length===0){f&&(p.current.rangeChangedCalls+=1,p.current.rangeChangedMs+=performance.now()-t);return}let s=n.length>=30,u=r>=n.length-1,d=be.current===n.length;if(u&&s&&!he.current&&!d){he.current=!0,be.current=n.length;let e=n.length;M(e,50)}f&&(p.current.rangeChangedCalls+=1,p.current.rangeChangedMs+=performance.now()-t)},[n.length,l,M,f]);(0,i.useEffect)(()=>{l||(he.current=!1)},[l]),(0,i.useEffect)(()=>{n.length===0&&Je(r=>r+1)},[n.length]);let Ce=(0,i.useRef)(n.length),we=(0,i.useRef)(void 0);(0,i.useEffect)(()=>{let r=Ce.current,t=n.length,s=t>0?Y.current?Y.current(n[0],0):n[0]:void 0,u=we.current;if(t>r&&r>0){Ce.current=t,we.current=s;return}let d=t<r||r>0&&s!==u;d&&(be.current=-1),me.current&&t>0&&d&&me.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),Ce.current=t,we.current=s},[n]);let Qe=(0,i.useCallback)(()=>{let r={},t=[];if(c.forEach(e=>{e.group?(r[e.group]||(r[e.group]=[]),r[e.group].push(e)):t.push(e)}),!(Object.keys(r).length>0))return(0,o.jsx)(a.TableRow,{children:c.map(e=>(0,o.jsx)(a.TableCell,{align:e.align||"left",style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e.sortable?(0,o.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,o.jsxs)(a.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>ne(String(e.id)),children:[e.text,(0,o.jsx)(a.TableSortLabel,{active:g===e.id,direction:g===e.id?v:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:g===e.id?1:0,transition:"opacity 0.2s ease","& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id)))});let u=[...t.map(e=>(0,o.jsx)(a.TableCell,{rowSpan:2,align:e.align||"left",style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e.sortable&&R?(0,o.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,o.jsxs)(a.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>ne(String(e.id)),children:[e.text,(0,o.jsx)(a.TableSortLabel,{active:g===e.id,direction:g===e.id?v:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:g===e.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id))),...Object.entries(r).map(([e,w])=>(0,o.jsx)(a.TableCell,{align:"center",colSpan:w.length,style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e},e))],d=[...Object.values(r).flat().map(e=>(0,o.jsx)(a.TableCell,{align:e.align||"left",style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e.sortable&&R?(0,o.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,o.jsxs)(a.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>ne(String(e.id)),children:[e.text,(0,o.jsx)(a.TableSortLabel,{active:g===e.id,direction:g===e.id?v:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:g===e.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(0deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(180deg)"}}})]})}):e.text},String(e.id)))];return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.TableRow,{children:u}),(0,o.jsx)(a.TableRow,{children:d})]})},[c,g,v,ne,R,_]),et=(0,i.useCallback)((r,t)=>{let s=f?performance.now():0;if(!t){if(f){p.current.rowContentCalls+=1;let d=performance.now()-s;p.current.rowContentMs+=d,p.current.rowContentMaxMs=Math.max(p.current.rowContentMaxMs,d)}return null}let u=c.map(d=>{let e=f?performance.now():0,w=d.render?d.render(t,r):String(t[d.id]||"");if(f){let S=performance.now()-e;p.current.cellRenderCalls+=1,p.current.cellRenderMs+=S,p.current.cellRenderMaxMs=Math.max(p.current.cellRenderMaxMs,S)}return(0,o.jsx)(a.TableCell,{align:d.align||"left",style:{width:d.width,minWidth:d.width,...d.style,padding:"8px 16px"},children:w},String(d.id))});if(f){p.current.rowContentCalls+=1;let d=performance.now()-s;p.current.rowContentMs+=d,p.current.rowContentMaxMs=Math.max(p.current.rowContentMaxMs,d)}return(0,o.jsx)(o.Fragment,{children:u})},[c,f]),D=de??c.some(r=>typeof r.footer=="function"),tt=(0,i.useCallback)(()=>{if(!D)return null;let r=[];for(let t=0;t<c.length;t+=1){let s=c[t],u=s.footerColSpan&&s.footerColSpan>1?Math.min(s.footerColSpan,c.length-t):1;r.push((0,o.jsx)(a.TableCell,{align:s.align||"left",colSpan:u>1?u:void 0,style:{...u>1?{}:{width:s.width,minWidth:s.width},...s.style,fontWeight:"bold",padding:"16px"},children:s.footer?s.footer(n):null},String(s.id))),t+=u-1}return(0,o.jsx)(a.TableRow,{children:r})},[D,c,n]),nt=(0,i.useMemo)(()=>({Scroller:Le,Table:r=>(0,o.jsx)(a.Table,{...r,sx:{borderCollapse:"separate",tableLayout:"fixed",marginRight:"16px",...D?{height:"100%"}:{}}}),TableHead:(0,i.forwardRef)((r,t)=>(0,o.jsx)(a.TableHead,{...r,ref:t,sx:{userSelect:"none","& tr":{height:_,"& th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:r=>{let{item:t,selected:s,"aria-selected":u,className:d,...e}=r,w=e["data-index"]??0,S=w%2===1,$=t&&Y.current?Y.current(t,w):w,k=!te&&h!==null&&h!==void 0&&$===h,ve=k&&y?typeof y=="function"?y(t,w):y:void 0,re=String(d??"").split(/\s+/).filter(b=>b!=="Mui-selected"&&b!=="Mui-focusVisible").join(" ");return(0,o.jsx)(a.TableRow,{...e,"data-row-id":$!=null?String($):void 0,className:re||void 0,selected:k,onMouseDown:b=>{K.current=!1,G.current={x:b.clientX,y:b.clientY}},onClick:b=>{let oe=b.clientX-G.current.x,Me=b.clientY-G.current.y;if(Math.sqrt(oe*oe+Me*Me)>Pe||K.current){b.preventDefault(),b.stopPropagation(),K.current=!1;return}t&&xe.current&&xe.current(t,w),K.current=!1},sx:[{userSelect:"none",height:ee,maxHeight:ee,boxSizing:"border-box",backgroundColor:S&&ge?ge:"transparent","& td":{padding:"8px 16px",boxSizing:"border-box",borderBottom:j?"1px solid rgba(224, 224, 224, 1)":"none"},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":ye&&!k?{backgroundColor:b=>{let oe=b.palette.mode==="dark",Te=pe??"#000000",Se=Re??.06;if(!pe)return oe?`rgba(255, 255, 255, ${Se})`:`rgba(0, 0, 0, ${Se})`;let ie=Te.replace("#","").trim();if(ie.length!==6)return Te;let rt=parseInt(ie.substring(0,2),16),ot=parseInt(ie.substring(2,4),16),it=parseInt(ie.substring(4,6),16);return`rgba(${rt}, ${ot}, ${it}, ${Se})`}}:void 0,cursor:ye?"pointer":void 0},ve]})},TableBody:(0,i.forwardRef)((r,t)=>{let{children:s,...u}=r;return(0,o.jsxs)(a.TableBody,{...u,ref:t,sx:D?{height:"100%"}:void 0,children:[s,D&&(0,o.jsx)("tr",{"aria-hidden":!0,style:{height:"100%"},children:(0,o.jsx)("td",{colSpan:c.length,style:{padding:0,border:0}})})]})}),TableFoot:(0,i.forwardRef)((r,t)=>(0,o.jsx)(a.TableFooter,{...r,ref:t,sx:[{"& tr":{height:N??C,maxHeight:N??C,boxSizing:"border-box"},"& td":{height:N??C,boxSizing:"border-box",backgroundColor:s=>s.palette.mode==="dark"?"#1e1e1e":"#ffffff",padding:"0 16px",color:"inherit",fontSize:"0.875rem",border:"none",boxShadow:"inset 0 1px 0 0 #000000"}},...Array.isArray(O)?O:O?[O]:[]]}))}),[ye,te?null:h,y,C,ge,j,_,pe,Re,Le,N,O,D,c]),Ee=(0,o.jsxs)(a.Box,{sx:{position:"relative",height:"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:r=>r.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"},...Ge??{},...F?{border:`1px solid ${P.borderStrong}`,borderRadius:"4px",overflow:"hidden","& thead tr th":{height:_,boxSizing:"border-box",padding:"0 14px !important",fontSize:13,fontWeight:"500 !important",color:P.headerColor,backgroundColor:`${P.bg} !important`,borderTop:"none",borderBottom:`1px solid ${P.borderStrong}`,borderRight:`1px solid ${P.border}`,"&:last-of-type":{borderRight:"none"}},"& tbody tr td":{padding:"0 14px !important",fontSize:14,borderBottom:`1px solid ${P.border}`}}:{}},children:[(0,o.jsx)(ze.TableVirtuoso,{ref:me,data:n,totalCount:M?n.length+1:n.length,defaultItemHeight:ee,fixedItemHeight:ee,fixedHeaderContent:Qe,fixedFooterContent:D?tt:void 0,itemContent:et,endReached:Ze,style:{height:"100%"},increaseViewportBy:{top:$e,bottom:Be},overscan:Ke,followOutput:!1,components:nt},qe),n.length===0&&!l&&(0,o.jsx)(a.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2},children:typeof W=="string"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.Box,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),(0,o.jsx)(a.Typography,{variant:"body1",sx:{color:"text.secondary"},children:W})]}):W}),Ue&&(0,o.jsx)(o.Fragment,{children:A?(0,o.jsx)(A,{visible:l,onComplete:ke}):(0,o.jsx)(Oe,{visible:l,onComplete:ke,size:40,indicator:(0,o.jsx)(Fe,{}),sx:{top:`${c.some(r=>r.group)?_*2:_}px`,bottom:`${D?N??C:0}px`},background:{show:n.length===0,opacity:.8}})})]}),Ie=F?{paddingRight:Q,paddingTop:He,paddingBottom:He}:{};return q?(0,o.jsx)(a.Paper,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:Q,...Ie,boxSizing:"border-box",height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:Ee}):(0,o.jsx)(a.Box,{className:"grow",style:{padding:0,paddingLeft:Q,...Ie,boxSizing:"border-box",height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:Ee})}var We=(0,i.memo)(xt);
|
|
4
|
+
`;function et({size:o=54}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)("style",{children:Vt}),(0,Y.jsx)("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:o,height:o}})]})}var rt=zt(require("@ehfuse/overlay-scrollbar"),1),r=require("react/jsx-runtime"),$t={alignment:"default",margin:0,radius:0},Fe=5,_t={bg:"#ffffff",border:"#e6e6e3",borderStrong:"#dedddb",headerColor:"#787774",hoverBg:"#f8f8f7",emptyColor:"#9b9a97",selectedBg:"#dbeafe",selectedBar:"#3b82f6"},tt="12px",Wt={bg:"#1e1e1e",border:"#2c333c",borderStrong:"#3b434e",headerColor:"#a3adbb",hoverBg:"#272d36",emptyColor:"#7d8590",selectedBg:"rgba(59, 130, 246, 0.22)",selectedBar:"#60a5fa"};function jt({data:o,loading:d=!1,columns:l,onRowClick:C,getRowId:m,selectedRowId:y,selectedRowSx:oe,rowHeight:ae,columnHeight:G,striped:X,rowDivider:J=!0,onSort:H,onLoadMore:D,sortBy:x,sortDirection:S,showPaper:ie=!0,paddingX:B,paddingTop:se=0,paddingBottom:Ce=0,rowHoverColor:le,rowHoverOpacity:de,viewportBuffer:I,overscan:N,scrollbars:E,emptyMessage:P="NO DATA",autoHeight:v=!1,LoadingComponent:ce,showFooter:ve,footerHeight:z,footerSx:F,variant:at="default",framed:U=!0,rowHeightMode:it="fixed",tableLayout:Ve="fixed",renderFullWidthRow:Me,fullWidthRowSx:Z,onRowContextMenu:$e}){let f=at==="notion",Te=(0,i.useTheme)(),h=Te.palette.mode==="dark"?Wt:_t,V=G??(f?40:56),R=ae??(f?48:50),ue=U?B??(f?"12px":"1rem"):0,Se=it==="auto",Re=le??(f?h.hoverBg:void 0),_e=de??(f?1:void 0),st=Math.max(R*12,480),lt=Math.max(R*12,480),dt=typeof I=="number"?I:I?.top??st,ct=typeof I=="number"?I:I?.bottom??lt,ut=Math.max(R*8,420),pt=Math.max(R*10,520),ft=typeof N=="number"?N:{main:N?.main??ut,reverse:N?.reverse??pt},Q=R+(J?1:0),gt=(0,a.useMemo)(()=>f?{backgroundColor:h.selectedBg,"& > td:first-of-type":{boxShadow:`inset 3px 0 0 ${h.selectedBar}`},"& > td[data-vdt-pinned]":{backgroundColor:h.selectedBg}}:void 0,[f,h]),k=oe??gt,pe=!k||typeof k!="function",bt=(0,a.useMemo)(()=>!pe||y===null||y===void 0||!k?null:{[`& tbody tr[data-row-id="${String(y).replace(/["\\]/g,"\\$&")}"]`]:k},[pe,y,k]),Xt=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),[g]=(0,a.useState)(()=>typeof window>"u"?!1:window.localStorage.getItem("vdt-perf-debug")==="1"),u=(0,a.useRef)({wheelEvents:0,wheelInputPx:0,wheelHandlerMs:0,wheelRafFlushes:0,wheelRafMs:0,rangeChangedCalls:0,rangeChangedMs:0,rowContentCalls:0,rowContentMs:0,rowContentMaxMs:0,cellRenderCalls:0,cellRenderMs:0,cellRenderMaxMs:0}),ke=(0,a.useCallback)(n=>{if(!g)return;let t=u.current;if(!(t.wheelEvents>0||t.rangeChangedCalls>0||t.rowContentCalls>0||t.cellRenderCalls>0))return;let c=t.rowContentCalls>0?t.rowContentMs/t.rowContentCalls:0,b=t.cellRenderCalls>0?t.cellRenderMs/t.cellRenderCalls:0;console.log("[VDT perf]",{reason:n,wheel:{events:t.wheelEvents,inputPx:Math.round(t.wheelInputPx),handlerMs:Number(t.wheelHandlerMs.toFixed(2)),rafFlushes:t.wheelRafFlushes,rafMs:Number(t.wheelRafMs.toFixed(2))},rangeChanged:{calls:t.rangeChangedCalls,totalMs:Number(t.rangeChangedMs.toFixed(2))},rowContent:{calls:t.rowContentCalls,totalMs:Number(t.rowContentMs.toFixed(2)),avgMs:Number(c.toFixed(3)),maxMs:Number(t.rowContentMaxMs.toFixed(3))},cellRender:{calls:t.cellRenderCalls,totalMs:Number(t.cellRenderMs.toFixed(2)),avgMs:Number(b.toFixed(3)),maxMs:Number(t.cellRenderMaxMs.toFixed(3))}}),u.current={wheelEvents:0,wheelInputPx:0,wheelHandlerMs:0,wheelRafFlushes:0,wheelRafMs:0,rangeChangedCalls:0,rangeChangedMs:0,rowContentCalls:0,rowContentMs:0,rowContentMaxMs:0,cellRenderCalls:0,cellRenderMs:0,cellRenderMaxMs:0}},[g]);(0,a.useEffect)(()=>{if(!g||typeof window>"u")return;console.log("[VDT perf] enabled (localStorage vdt-perf-debug=1)");let n=window.setInterval(()=>{ke("interval")},1500);return()=>{window.clearInterval(n),ke("cleanup")}},[ke,g]);let We=(0,a.useMemo)(()=>(0,a.forwardRef)((n,t)=>{let s=(0,a.useRef)(null),c=(0,a.useRef)(0),b=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=s.current;if(!e)return;let w=M=>{let O=g?performance.now():0;if(M.shiftKey||Math.abs(M.deltaX)>Math.abs(M.deltaY))return;M.preventDefault();let T=M.deltaY;M.deltaMode===1?T*=40:M.deltaMode===2&&(T*=e.clientHeight),g&&(u.current.wheelEvents+=1,u.current.wheelInputPx+=T),c.current+=T,b.current===null&&(b.current=requestAnimationFrame(()=>{let _=g?performance.now():0,A=Math.max(e.clientHeight*.4,160),p=Math.max(-A,Math.min(A,c.current));c.current=0,b.current=null,p!==0&&(e.scrollTop+=p),g&&(u.current.wheelRafFlushes+=1,u.current.wheelRafMs+=performance.now()-_)}),g&&(u.current.wheelHandlerMs+=performance.now()-O))};return e.addEventListener("wheel",w,{passive:!1}),()=>{e.removeEventListener("wheel",w),b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),c.current=0}},[]),(0,r.jsx)(rt.default,{detectInnerScroll:!0,track:$t,...E,children:(0,r.jsx)(i.TableContainer,{component:i.Box,...n,ref:e=>{s.current=e,typeof t=="function"?t(e):t&&(t.current=e)},sx:{userSelect:"auto",WebkitUserSelect:"auto",position:"relative",width:"100%",height:"100%",overflow:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none",msOverflowStyle:"none",transform:"translateZ(0)",backfaceVisibility:"hidden",willChange:"scroll-position","&::-webkit-scrollbar":{display:"none"},"& .MuiTable-root":{paddingRight:f?0:ue,paddingTop:se,paddingBottom:Ce}}})})}),[]),Le=(0,a.useMemo)(()=>{if(X===!0)return"#f5f5f5";if(typeof X=="string")return X},[X]),[ht,je]=(0,a.useState)(d),[mt,xt]=(0,a.useState)(0);(0,a.useEffect)(()=>{d&&je(!0)},[d]);let Ye=(0,a.useCallback)(()=>{je(!1)},[]),yt=ht,Kt=d&&o.length>0,De=(0,a.useRef)(!1),Ee=(0,a.useRef)(-1),Pe=(0,a.useRef)(null),He=(0,a.useRef)(null),[wt,Ct]=(0,a.useState)(!1),fe=(0,a.useCallback)(()=>{let n=He.current;n&&Ct(n.scrollHeight>n.clientHeight+1)},[]);(0,a.useEffect)(()=>{let n=He.current;if(!n||typeof ResizeObserver>"u")return;let t=new ResizeObserver(()=>fe());return t.observe(n),()=>t.disconnect()},[fe,v]);let Ie=(0,a.useRef)(C);Ie.current=C;let ee=(0,a.useRef)(m);ee.current=m;let Oe=(0,a.useRef)($e);Oe.current=$e;let ge=(0,a.useMemo)(()=>{let n=new Map,t=0;return l.forEach(s=>{s.pinned==="left"&&(n.set(String(s.id),t),t+=typeof s.width=="number"?s.width:0)}),n},[l]),K=(0,a.useCallback)((n,t)=>{let s=ge.get(String(n.id));return s===void 0?{}:{position:"sticky",left:s,zIndex:t?3:1}},[ge]),be=!!C,te=(0,a.useRef)(!1),$=(0,a.useRef)({x:0,y:0});(0,a.useEffect)(()=>{let n=t=>{let s=t.clientX-$.current.x,c=t.clientY-$.current.y;Math.sqrt(s*s+c*c)>Fe&&(te.current=!0)};return document.addEventListener("mousemove",n),()=>{document.removeEventListener("mousemove",n)}},[]),(0,a.useEffect)(()=>{let n=document.querySelector('[data-testid="virtuoso-scroller"]');n&&n.querySelectorAll(".MuiTableSortLabel-root").forEach(s=>{let c=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});s.dispatchEvent(c)})},[x]);let he=(0,a.useCallback)(n=>{if(!H)return;H(n,x===n&&S==="asc"?"desc":"asc")},[H,x,S]),vt=(0,a.useCallback)(n=>{let t=g?performance.now():0;if(!D){g&&(u.current.rangeChangedCalls+=1,u.current.rangeChangedMs+=performance.now()-t);return}if(d&&o.length===0){g&&(u.current.rangeChangedCalls+=1,u.current.rangeChangedMs+=performance.now()-t);return}let s=o.length>=30,c=n>=o.length-1,b=Ee.current===o.length;if(c&&s&&!De.current&&!b){De.current=!0,Ee.current=o.length;let e=o.length;D(e,50)}g&&(u.current.rangeChangedCalls+=1,u.current.rangeChangedMs+=performance.now()-t)},[o.length,d,D,g]);(0,a.useEffect)(()=>{d||(De.current=!1)},[d]),(0,a.useEffect)(()=>{o.length===0&&xt(n=>n+1)},[o.length]);let Ae=(0,a.useRef)(o.length),Be=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{let n=Ae.current,t=o.length,s=t>0?ee.current?ee.current(o[0],0):o[0]:void 0,c=Be.current;if(t>n&&n>0){Ae.current=t,Be.current=s;return}let b=t<n||n>0&&s!==c;b&&(Ee.current=-1),Pe.current&&t>0&&b&&Pe.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),Ae.current=t,Be.current=s},[o]);let Xe=(0,a.useCallback)(()=>{let n={},t=[];if(l.forEach(e=>{e.group?(n[e.group]||(n[e.group]=[]),n[e.group].push(e)):t.push(e)}),!(Object.keys(n).length>0))return(0,r.jsx)(i.TableRow,{children:l.map(e=>(0,r.jsx)(i.TableCell,{align:e.align||"left",...e.headerProps,style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...K(e,!0),...e.headerProps?.style},children:e.sortable?(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,r.jsxs)(i.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>he(String(e.id)),children:[e.text,(0,r.jsx)(i.TableSortLabel,{active:x===e.id,direction:x===e.id?S:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:x===e.id?1:0,transition:"opacity 0.2s ease","& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id)))});let c=[...t.map(e=>(0,r.jsx)(i.TableCell,{rowSpan:2,align:e.align||"left",...e.headerProps,style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...K(e,!0),...e.headerProps?.style},children:e.sortable&&H?(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,r.jsxs)(i.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>he(String(e.id)),children:[e.text,(0,r.jsx)(i.TableSortLabel,{active:x===e.id,direction:x===e.id?S:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:x===e.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id))),...Object.entries(n).map(([e,w])=>(0,r.jsx)(i.TableCell,{align:"center",colSpan:w.length,style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e},e))],b=[...Object.values(n).flat().map(e=>(0,r.jsx)(i.TableCell,{align:e.align||"left",...e.headerProps,style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...K(e,!0),...e.headerProps?.style},children:e.sortable&&H?(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,r.jsxs)(i.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>he(String(e.id)),children:[e.text,(0,r.jsx)(i.TableSortLabel,{active:x===e.id,direction:x===e.id?S:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:x===e.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(0deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(180deg)"}}})]})}):e.text},String(e.id)))];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.TableRow,{children:c}),(0,r.jsx)(i.TableRow,{children:b})]})},[l,x,S,he,H,V,K]),Ke=(0,a.useCallback)((n,t)=>{let s=g?performance.now():0;if(!t){if(g){u.current.rowContentCalls+=1;let e=performance.now()-s;u.current.rowContentMs+=e,u.current.rowContentMaxMs=Math.max(u.current.rowContentMaxMs,e)}return null}let c=Me?Me(t,n):null;if(c!=null)return(0,r.jsx)(i.TableCell,{colSpan:l.length,"data-vdt-pad":"",sx:[{padding:f?"0 14px":"8px 16px"},...Array.isArray(Z)?Z:Z?[Z]:[]],children:c});let b=l.map(e=>{let w=g?performance.now():0,M=e.render?e.render(t,n):String(t[e.id]||"");if(g){let p=performance.now()-w;u.current.cellRenderCalls+=1,u.current.cellRenderMs+=p,u.current.cellRenderMaxMs=Math.max(u.current.cellRenderMaxMs,p)}let O=ge.has(String(e.id)),T=e.cellPadding!==void 0,_=e.rowSpan?e.rowSpan(t,n):1;if(_<=0)return null;let A=e.onCellClick;return(0,r.jsx)(i.TableCell,{align:e.align||"left",rowSpan:_>1?_:void 0,"data-vdt-pad":T?"":void 0,"data-vdt-pinned":O?"":void 0,"data-vdt-cell-click":A?"":void 0,onClick:A?p=>{let W=p.clientX-$.current.x,q=p.clientY-$.current.y;p.stopPropagation(),!(Math.sqrt(W*W+q*q)>Fe)&&A(t,n,p)}:void 0,style:{width:e.width,minWidth:e.width,...e.primary?{fontSize:15}:{},...e.style,...e.cellStyle?e.cellStyle(t,n):{},padding:T?e.cellPadding:"8px 16px",...K(e,!1)},children:M},String(e.id))});if(g){u.current.rowContentCalls+=1;let e=performance.now()-s;u.current.rowContentMs+=e,u.current.rowContentMaxMs=Math.max(u.current.rowContentMaxMs,e)}return(0,r.jsx)(r.Fragment,{children:b})},[l,g,Me,Z,f,ge,K]),L=ve??l.some(n=>typeof n.footer=="function"),qe=(0,a.useCallback)(()=>{if(!L)return null;let n=[];for(let t=0;t<l.length;t+=1){let s=l[t],c=s.footerColSpan&&s.footerColSpan>1?Math.min(s.footerColSpan,l.length-t):1;n.push((0,r.jsx)(i.TableCell,{align:s.align||"left",colSpan:c>1?c:void 0,style:{...c>1?{}:{width:s.width,minWidth:s.width},...s.style,fontWeight:"bold",padding:f?"0 14px":"16px"},children:s.footer?s.footer(o):null},String(s.id))),t+=c-1}return(0,r.jsx)(i.TableRow,{children:n})},[L,l,o,f]),Ge=(0,a.useMemo)(()=>({Scroller:We,Table:n=>(0,r.jsx)(i.Table,{...n,sx:{borderCollapse:"separate",tableLayout:Ve,marginRight:U?"16px":0,...L?{height:"100%"}:{}}}),TableHead:(0,a.forwardRef)((n,t)=>(0,r.jsx)(i.TableHead,{...n,ref:t,sx:{userSelect:"none","& tr":{height:V,"& th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:n=>{let{item:t,selected:s,"aria-selected":c,className:b,...e}=n,w=e["data-index"]??0,M=w%2===1,O=t&&ee.current?ee.current(t,w):w,T=!pe&&y!==null&&y!==void 0&&O===y,_=T&&k?typeof k=="function"?k(t,w):k:void 0,A=String(b??"").split(/\s+/).filter(p=>p!=="Mui-selected"&&p!=="Mui-focusVisible").join(" ");return(0,r.jsx)(i.TableRow,{...e,"data-row-id":O!=null?String(O):void 0,className:A||void 0,selected:T,onMouseDown:p=>{te.current=!1,$.current={x:p.clientX,y:p.clientY}},onContextMenu:p=>{t&&Oe.current&&Oe.current(t,w,p)},onClick:p=>{let W=p.clientX-$.current.x,q=p.clientY-$.current.y;if(Math.sqrt(W*W+q*q)>Fe||te.current){p.preventDefault(),p.stopPropagation(),te.current=!1;return}t&&Ie.current&&Ie.current(t,w),te.current=!1},sx:[{userSelect:"none",...Se?{"& > td":{height:Q}}:{height:Q,maxHeight:Q},boxSizing:"border-box",backgroundColor:M&&Le?Le:"transparent","& td:not([data-vdt-pad])":{padding:"8px 16px"},"& td":{boxSizing:"border-box",borderBottom:J?"1px solid rgba(224, 224, 224, 1)":"none"},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":be&&!T?{backgroundColor:p=>{let W=p.palette.mode==="dark",Ne=Re??"#000000",ze=_e??.06;if(!Re)return W?`rgba(255, 255, 255, ${ze})`:`rgba(0, 0, 0, ${ze})`;let me=Ne.replace("#","").trim();if(me.length!==6)return Ne;let Dt=parseInt(me.substring(0,2),16),Et=parseInt(me.substring(2,4),16),Pt=parseInt(me.substring(4,6),16);return`rgba(${Dt}, ${Et}, ${Pt}, ${ze})`}}:void 0,cursor:be?"pointer":void 0},_]})},TableBody:(0,a.forwardRef)((n,t)=>{let{children:s,...c}=n;return(0,r.jsxs)(i.TableBody,{...c,ref:t,sx:L?{height:"100%"}:void 0,children:[s,L&&(0,r.jsx)("tr",{"aria-hidden":!0,style:{height:"100%"},children:(0,r.jsx)("td",{colSpan:l.length,style:{padding:0,border:0}})})]})}),TableFoot:(0,a.forwardRef)((n,t)=>(0,r.jsx)(i.TableFooter,{...n,ref:t,sx:[{"& tr":{height:z??R,maxHeight:z??R,boxSizing:"border-box"},"& td":{height:z??R,boxSizing:"border-box",backgroundColor:s=>s.palette.mode==="dark"?"#1e1e1e":"#ffffff",padding:"0 16px",color:"inherit",fontSize:"0.875rem",border:"none",boxShadow:`inset 0 1px 0 0 ${f?h.borderStrong:"#000000"}`}},...Array.isArray(F)?F:F?[F]:[]]}))}),[be,pe?null:y,k,R,Le,J,V,Re,_e,We,z,F,L,f,h,l,Ve,U,Se]),Mt=Ge,ne=Ge,Tt=ne.Table,St=ne.TableHead,Rt=ne.TableBody,kt=ne.TableRow,Lt=ne.TableFoot,Je=(0,r.jsxs)(i.Box,{sx:{position:"relative",height:v?"auto":"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:n=>n.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"},...bt??{},"& tbody td[data-vdt-pinned]":{backgroundColor:f?h.bg:Te.palette.background.paper},"& tbody td[data-vdt-cell-click]":{cursor:"pointer"},"& tbody td[data-vdt-cell-click]:hover":{backgroundColor:f?h.hoverBg:Te.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"},...f&&be?{"& tbody tr:hover td[data-vdt-pinned]":{backgroundColor:h.hoverBg}}:{},...f?{...U?{border:`1px solid ${h.borderStrong}`,borderRadius:"4px"}:{"& table":{backgroundColor:h.bg}},overflow:"hidden","& thead tr th":{height:V,boxSizing:"border-box",padding:"0 14px !important",fontSize:13,fontWeight:"500 !important",color:h.headerColor,backgroundColor:`${h.bg} !important`,borderTop:"none",borderBottom:`1px solid ${h.borderStrong}`,borderRight:`1px solid ${h.border}`,"&:last-of-type":{borderRight:"none"}},"& tbody tr td:not([data-vdt-pad])":{padding:"0 14px !important"},"& tbody tr td":{fontSize:14,borderBottom:`1px solid ${h.border}`},...o.length>0&&(v||wt||L)?{[`& tbody tr[data-index="${o.length-1}"] td`]:{borderBottom:"none"}}:{}}:{}},children:[v?(0,r.jsx)(i.Box,{sx:{overflowX:"auto",width:"100%"},children:(0,r.jsxs)(Tt,{children:[(0,r.jsx)(St,{children:Xe()}),(0,r.jsx)(Rt,{children:o.map((n,t)=>(0,r.jsx)(kt,{item:n,"data-index":t,children:Ke(t,n)},m?String(m(n,t)):t))}),L?(0,r.jsx)(Lt,{children:qe()}):null]})}):(0,r.jsx)(nt.TableVirtuoso,{ref:Pe,data:o,totalCount:D?o.length+1:o.length,defaultItemHeight:Q,fixedItemHeight:Se?void 0:Q,fixedHeaderContent:Xe,fixedFooterContent:L?qe:void 0,itemContent:Ke,endReached:vt,scrollerRef:n=>{He.current=n instanceof HTMLElement?n:null,fe()},totalListHeightChanged:fe,style:{height:"100%"},increaseViewportBy:{top:dt,bottom:ct},overscan:ft,followOutput:!1,components:Mt},mt),o.length===0&&!d&&f&&typeof P=="string"&&(0,r.jsx)(i.Box,{sx:{position:v?"static":"absolute",top:V,left:0,right:0,py:6,textAlign:"center",fontSize:14,color:h.emptyColor},children:P}),o.length===0&&!d&&!(f&&typeof P=="string")&&(0,r.jsx)(i.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2},children:typeof P=="string"?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Box,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),(0,r.jsx)(i.Typography,{variant:"body1",sx:{color:"text.secondary"},children:P})]}):P}),yt&&(0,r.jsx)(r.Fragment,{children:ce?(0,r.jsx)(ce,{visible:d,onComplete:Ye}):(0,r.jsx)(Qe,{visible:d,onComplete:Ye,size:40,indicator:(0,r.jsx)(et,{}),sx:{top:`${l.some(n=>n.group)?V*2:V}px`,bottom:`${L?z??R:0}px`},background:{show:o.length===0,opacity:.8}})})]}),Ue=f&&U?{paddingRight:ue,paddingTop:tt,paddingBottom:tt}:{};return ie?(0,r.jsx)(i.Paper,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:ue,...Ue,boxSizing:"border-box",height:v?"auto":"100%",minHeight:0,flex:v?"none":1,display:"flex",flexDirection:"column"},children:Je}):(0,r.jsx)(i.Box,{className:"grow",style:{padding:0,paddingLeft:ue,...Ue,boxSizing:"border-box",height:v?"auto":"100%",minHeight:0,flex:v?"none":1,display:"flex",flexDirection:"column"},children:Je})}var ot=(0,a.memo)(jt);
|
|
5
5
|
/**
|
|
6
6
|
* Virtual Data Table - A high-performance virtual data table component for React
|
|
7
7
|
*
|