@ehfuse/mui-virtual-data-table 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -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 +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -153,6 +153,7 @@ function App() {
|
|
|
153
153
|
onEndReached={() => void} // Fired every time the end is reached (no minimum / no same-length latch)
|
|
154
154
|
colorMode={"light" | "dark"} // notion colors independent of the MUI palette mode
|
|
155
155
|
mobile={boolean | { query?, renderRow? }} // 1.6.0 card list on narrow screens (see "Mobile list")
|
|
156
|
+
scrollParent={HTMLElement | null} // 1.7.0 virtualize against an outer (page) scroller
|
|
156
157
|
|
|
157
158
|
// Optional - 1.4.0 header context menu (right-click on th never shows the browser menu)
|
|
158
159
|
onSortClear={() => void} // adds "정렬 풀기" to the header menu (and re-picking the active direction clears)
|
|
@@ -236,6 +237,12 @@ Pinned rows example (1.3.0):
|
|
|
236
237
|
notion defaults (1.2.0): rowHeight 48, header text 13px, selected row (`selectedRowId`) = `#dbeafe` + 3px `#3b82f6` left bar (dark values included),
|
|
237
238
|
string `emptyMessage` = one light grey line under the header, footer cells use the body padding.
|
|
238
239
|
|
|
240
|
+
### Page scroll (1.7.0)
|
|
241
|
+
|
|
242
|
+
`scrollParent={element}` virtualizes against an outer scroller (react-virtuoso `customScrollParent`) — the table has no scroller of its own
|
|
243
|
+
and grows with the page, so things bound to the page scroller (collapsing app bar, scroll-to-top, pull-to-refresh) keep working.
|
|
244
|
+
Pass `null` while the element is not known yet (nothing is drawn until then). Works with `mobile` and `onEndReached`.
|
|
245
|
+
|
|
239
246
|
### Mobile list (1.6.0)
|
|
240
247
|
|
|
241
248
|
`mobile` turns the table into a card list on narrow screens (default query `(max-width:599.95px)`): no header row, one card per row,
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{forwardRef as
|
|
1
|
+
import{forwardRef as Oe,useCallback as P,useMemo as te,useRef as S,useEffect as G,memo as qn,useState as Ae}from"react";import{Box as y,Table as Gn,TableBody as Qt,TableCell as ne,TableContainer as Zn,TableHead as Qn,TableFooter as Jn,TableRow as Pe,TableSortLabel as Mt,Paper as er,Typography as tr,useTheme as nr,useMediaQuery as rr}from"@mui/material";import{TableVirtuoso as or}from"react-virtuoso";import{jsx as gt}from"react/jsx-runtime";import{useRef as jt,useState as An,useEffect as Pn}from"react";import{Box as Nn,CircularProgress as On}from"@mui/material";var Ie=function(){return Ie=Object.assign||function(c){for(var i,C=1,g=arguments.length;C<g;C++){i=arguments[C];for(var d in i)Object.prototype.hasOwnProperty.call(i,d)&&(c[d]=i[d])}return c},Ie.apply(this,arguments)};function Kt(a){var c=a.visible,i=a.onComplete,C=a.fadeoutDuration,g=C===void 0?200:C,d=a.exitDelay,N=d===void 0?0:d,j=a.size,re=j===void 0?40:j,Z=a.className,Q=a.style,L=a.sx,O=a.indicator,B=a.background,A=B===void 0?{show:!0,color:"255, 255, 255",opacity:.9}:B,M=jt(void 0),k=jt(null),oe=An(c),F=oe[0],T=oe[1],me=A.show,u=me===void 0?!0:me,R=A.color,E=R===void 0?"255, 255, 255":R,K=A.opacity,ae=K===void 0?.9:K;if(Pn(function(){var ze=M.current;if(ze===!0&&c===!1&&k.current){var Ge=k.current;Ge.style.opacity="0",setTimeout(function(){T(!1),i?.()},g+N)}else c===!0&&(T(!0),k.current&&(k.current.style.opacity="1"));M.current=c},[c,i,g,N]),!F)return null;var J=function(){return typeof O=="string"?gt("img",{src:O,alt:"Loading",style:{width:re,height:re}}):O||gt(On,{size:re})},xe=function(){return u?E.startsWith("rgba")?{backgroundColor:E}:/^\d+,\s*\d+,\s*\d+$/.test(E)?{backgroundColor:"rgba(".concat(E,", ").concat(ae,")")}:ae!==1?{backgroundColor:E,"&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:E,opacity:ae,zIndex:-1}}:{backgroundColor:E}:{backgroundColor:"transparent"}};return gt(Nn,{ref:k,className:Z,style:Ie({},Q),sx:Ie(Ie({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,opacity:c?1:0,transition:"opacity ".concat(g,"ms ease-out")},xe()),L),children:J()})}import{Fragment as _n,jsx as qt,jsxs as Wn}from"react/jsx-runtime";var zn=`
|
|
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 jt({size:a=54}){return Nn(An,{children:[Ut("style",{children:Pn}),Ut("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:a,height:a}})]})}import Xe,{useMemo as On,useState as zn}from"react";import{Box as De,Divider as _n,InputBase as Wn,Menu as Fn,MenuItem as Vn,SvgIcon as $n}from"@mui/material";import{jsx as h,jsxs as Ue}from"react/jsx-runtime";var ft=14,ht=18,gt=34,j={asc:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z",desc:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z",checked:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",unchecked:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z",radioOn:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",radioOff:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",filter:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z",search:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"};function be({d:a,size:u=ht,color:i}){return h($n,{sx:{fontSize:u,flexShrink:0,color:i},children:h("path",{d:a})})}function bt({size:a=14,active:u,color:i}){let C={stroke:"currentColor",strokeWidth:1.8,strokeMiterlimit:10,strokeLinecap:"round",strokeLinejoin:"round"};return Ue(De,{component:"svg",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,sx:{width:a,height:a,flexShrink:0,color:u?"primary.main":i??"currentColor",verticalAlign:"middle"},children:[h("path",{d:"M2 17.5H7",...C}),h("path",{d:"M22 6.5H17",...C}),h("path",{d:"M13 17.5H22",...C}),h("path",{d:"M11 6.5H2",...C}),h("path",{d:"M10 20.3999C8.34315 20.3999 7 19.0568 7 17.3999C7 15.743 8.34315 14.3999 10 14.3999C11.6569 14.3999 13 15.743 13 17.3999C13 19.0568 11.6569 20.3999 10 20.3999Z",...C}),h("path",{d:"M14 9.3999C15.6569 9.3999 17 8.05676 17 6.3999C17 4.74305 15.6569 3.3999 14 3.3999C12.3431 3.3999 11 4.74305 11 6.3999C11 8.05676 12.3431 9.3999 14 9.3999Z",...C})]})}var Kt={gap:1,fontSize:ft,lineHeight:"20px",minHeight:gt,py:"7px",px:1.5};function G({icon:a,iconSpace:u,selected:i,disabled:C,muted:g,onClick:d,sx:N,children:K}){return Ue(Vn,{selected:i,disabled:C,onClick:d,sx:[Kt,g?{color:"text.secondary"}:{},...Array.isArray(N)?N:N?[N]:[]],children:[a??(u?h(De,{component:"span",sx:{width:ht,flexShrink:0}}):null),K]})}function Ye(){return h(_n,{sx:{my:"4px !important"}})}function Xn(a,u){let i=a.getBoundingClientRect();return{left:u??i.left,top:i.bottom}}function mt({open:a,anchorPosition:u,anchorEl:i,onClose:C,sort:g,filter:d,header:N,children:K,minWidth:oe=180,maxHeight:Q=420}){let[J,L]=zn(""),O=d?.multiple!==!1,B=d?.value??[],P=On(()=>{if(!d)return[];let c=d.options;return d.emptyLabel&&!c.some(R=>R.value==="")?[...c,{value:"",label:d.emptyLabel}]:c},[d]),M=!!d&&(d?.searchable??P.length>10),k=J.trim().toLowerCase(),ae=k?P.filter(c=>c.label.toLowerCase().includes(k)):P,V=()=>{L(""),C()},T=[];if(N&&T.push(...Xe.Children.toArray(N).map((c,R)=>Xe.isValidElement(c)?Xe.cloneElement(c,{key:`h${R}`}):c)),g){let c=R=>{V(),g.onChange(g.active===R&&g.clearable!==!1?null:R)};T.push(h(G,{selected:g.active==="asc",onClick:()=>c("asc"),icon:h(be,{d:j.asc,color:"text.secondary"}),children:"\uC624\uB984\uCC28\uC21C \uC815\uB82C"},"sort-asc"),h(G,{selected:g.active==="desc",onClick:()=>c("desc"),icon:h(be,{d:j.desc,color:"text.secondary"}),children:"\uB0B4\uB9BC\uCC28\uC21C \uC815\uB82C"},"sort-desc")),g.active&&g.clearable!==!1&&T.push(h(G,{muted:!0,iconSpace:!0,onClick:()=>{V(),g.onChange(null)},children:"\uC815\uB82C \uD480\uAE30"},"sort-clear"))}return g&&d&&T.push(h(Ye,{},"div-sort")),d&&(M&&T.push(Ue(De,{onKeyDown:c=>c.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1,px:1.5,pb:.5,minHeight:gt},children:[h(be,{d:j.search,color:"text.secondary"}),h(Wn,{autoFocus:!0,value:J,onChange:c=>L(c.target.value),placeholder:d.searchPlaceholder??"\uCC3E\uAE30",sx:{flex:1,fontSize:ft}})]},"search")),!O&&d.allLabel&&T.push(h(G,{selected:B.length===0,onClick:()=>{V(),d.onChange([])},icon:h(be,{d:B.length===0?j.radioOn:j.radioOff,color:B.length===0?"primary.main":"text.disabled"}),children:d.allLabel},"f-all")),P.length===0&&T.push(h(G,{disabled:!0,iconSpace:!0,children:d.emptyText??"\uACE0\uB97C \uAC12\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},"f-none")),ae.forEach(c=>{let R=B.includes(c.value),E=()=>{if(O){d.onChange(R?B.filter(ie=>ie!==c.value):[...B,c.value]);return}V(),d.onChange(R?[]:[c.value])},q=O?R?j.checked:j.unchecked:R?j.radioOn:j.radioOff;T.push(Ue(G,{selected:!O&&R,onClick:E,icon:h(be,{d:q,color:R?"primary.main":"text.disabled"}),children:[c.icon,h(De,{component:"span",sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.render??c.label}),typeof c.count=="number"?h(De,{component:"span",sx:{color:"text.secondary",ml:1,fontVariantNumeric:"tabular-nums"},children:c.count}):null]},`f:${c.value||"(empty)"}`))}),M&&k&&ae.length===0&&T.push(h(G,{disabled:!0,iconSpace:!0,children:"\uCC3E\uB294 \uAC12\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},"f-nohit")),B.length>0&&T.push(h(Ye,{},"div-filter"),h(G,{muted:!0,iconSpace:!0,onClick:()=>{V(),d.onChange([])},children:d.clearLabel??"\uAC70\uB974\uAE30 \uD480\uAE30"},"f-clear"))),K&&(T.length>0&&T.push(h(Ye,{},"div-children")),T.push(...Xe.Children.toArray(K))),h(Fn,{open:a&&(!!u||!!i),...!u&&!!i?{anchorEl:i}:{anchorReference:"anchorPosition",anchorPosition:u??void 0},onClose:V,transitionDuration:0,disableAutoFocusItem:M,onContextMenu:c=>c.preventDefault(),onClick:c=>c.stopPropagation(),slotProps:{paper:{sx:{maxHeight:Q,minWidth:oe}},list:{sx:{py:.5}}},children:T})}import tr from"@ehfuse/overlay-scrollbar";import{Fragment as Pe,jsx as o,jsxs as I}from"react/jsx-runtime";var nr={alignment:"default",margin:0,radius:0},yt=5,rr={bg:"#ffffff",border:"#e6e6e3",borderStrong:"#dedddb",headerColor:"#787774",hoverBg:"#f8f8f7",emptyColor:"#9b9a97",selectedBg:"#dbeafe",selectedBar:"#3b82f6"},Gt="12px",or={bg:"#1e1e1e",border:"#2c333c",borderStrong:"#3b434e",headerColor:"#a3adbb",hoverBg:"#272d36",emptyColor:"#7d8590",selectedBg:"rgba(59, 130, 246, 0.22)",selectedBar:"#60a5fa"},ar="(max-width:599.95px)";function Ct(a){return!!(a.filterOptions&&a.onFilterChange)}function ir({data:a,loading:u=!1,columns:i,onRowClick:C,getRowId:g,selectedRowId:d,selectedRowSx:N,rowHeight:K,columnHeight:oe,striped:Q,rowDivider:J=!0,onSort:L,onSortClear:O,onHeaderContextMenu:B,onLoadMore:P,sortBy:M,sortDirection:k,showPaper:ae=!0,paddingX:V,paddingTop:T=0,paddingBottom:me=0,rowHoverColor:c,rowHoverOpacity:R,viewportBuffer:E,overscan:q,scrollbars:ie,emptyMessage:ee="NO DATA",autoHeight:z=!1,LoadingComponent:Ae,showFooter:Ke,footerHeight:xe,footerSx:ye,variant:Zt="default",framed:pe=!0,headerTopBorder:Qt=!1,rowHeightMode:Jt="fixed",tableLayout:Ne="fixed",renderFullWidthRow:qe,fullWidthRowSx:Ce,onRowContextMenu:Mt,pinnedRows:Me,pinnedRowsMaxHeight:Ge,pinnedRowsSx:ve,resetScrollOnDataChange:vt=!0,rowKeyFromId:en=!1,onEndReached:wt,colorMode:tn,mobile:St}){let x=Zt==="notion",Ze=Qn(),b=(tn??Ze.palette.mode)==="dark"?or:rr,Tt=(Me?.length??0)>0,le=oe??(x?40:56),$=K??(x?48:50),Oe=pe?V??(x?"12px":"1rem"):0,we=St===!0?{}:St||null,nn=Jn(we?.query??ar,{noSsr:!0}),X=!!we&&nn,Qe=Jt==="auto"||X,Je=c??(x?b.hoverBg:void 0),Rt=R??(x?1:void 0),rn=Math.max($*12,480),on=Math.max($*12,480),an=typeof E=="number"?E:E?.top??rn,ln=typeof E=="number"?E:E?.bottom??on,sn=Math.max($*8,420),dn=Math.max($*10,520),cn=typeof q=="number"?q:{main:q?.main??sn,reverse:q?.reverse??dn},Se=$+(J?1:0),un=ne(()=>x?{backgroundColor:b.selectedBg,"& > td:first-of-type":{boxShadow:`inset 3px 0 0 ${b.selectedBar}`},"& > td[data-vdt-pinned]":{backgroundColor:b.selectedBg}}:void 0,[x,b]),Y=N??un,ze=!Y||typeof Y!="function",pn=ne(()=>!ze||d===null||d===void 0||!Y?null:{[`& tbody tr[data-row-id="${String(d).replace(/["\\]/g,"\\$&")}"]`]:Y},[ze,d,Y]),sr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),[v]=Ie(()=>typeof window>"u"?!1:window.localStorage.getItem("vdt-perf-debug")==="1"),m=S({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}),et=A(t=>{if(!v)return;let e=m.current;if(!(e.wheelEvents>0||e.rangeChangedCalls>0||e.rowContentCalls>0||e.cellRenderCalls>0))return;let s=e.rowContentCalls>0?e.rowContentMs/e.rowContentCalls:0,f=e.cellRenderCalls>0?e.cellRenderMs/e.cellRenderCalls:0;console.log("[VDT perf]",{reason:t,wheel:{events:e.wheelEvents,inputPx:Math.round(e.wheelInputPx),handlerMs:Number(e.wheelHandlerMs.toFixed(2)),rafFlushes:e.wheelRafFlushes,rafMs:Number(e.wheelRafMs.toFixed(2))},rangeChanged:{calls:e.rangeChangedCalls,totalMs:Number(e.rangeChangedMs.toFixed(2))},rowContent:{calls:e.rowContentCalls,totalMs:Number(e.rowContentMs.toFixed(2)),avgMs:Number(s.toFixed(3)),maxMs:Number(e.rowContentMaxMs.toFixed(3))},cellRender:{calls:e.cellRenderCalls,totalMs:Number(e.cellRenderMs.toFixed(2)),avgMs:Number(f.toFixed(3)),maxMs:Number(e.cellRenderMaxMs.toFixed(3))}}),m.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}},[v]);Z(()=>{if(!v||typeof window>"u")return;console.log("[VDT perf] enabled (localStorage vdt-perf-debug=1)");let t=window.setInterval(()=>{et("interval")},1500);return()=>{window.clearInterval(t),et("cleanup")}},[et,v]);let Ht=ne(()=>je((t,e)=>{let r=S(null),s=S(0),f=S(null);return Z(()=>{let n=r.current;if(!n)return;let l=H=>{let p=v?performance.now():0;if(H.shiftKey||Math.abs(H.deltaX)>Math.abs(H.deltaY))return;let D=H.target?.closest?.("[data-vdt-inner-scroll]");if(D&&n.contains(D)&&(H.deltaY<0?D.scrollTop>0:D.scrollTop+D.clientHeight<D.scrollHeight-1))return;H.preventDefault();let te=H.deltaY;H.deltaMode===1?te*=40:H.deltaMode===2&&(te*=n.clientHeight),v&&(m.current.wheelEvents+=1,m.current.wheelInputPx+=te),s.current+=te,f.current===null&&(f.current=requestAnimationFrame(()=>{let he=v?performance.now():0,w=Math.max(n.clientHeight*.4,160),W=Math.max(-w,Math.min(w,s.current));s.current=0,f.current=null,W!==0&&(n.scrollTop+=W),v&&(m.current.wheelRafFlushes+=1,m.current.wheelRafMs+=performance.now()-he)}),v&&(m.current.wheelHandlerMs+=performance.now()-p))};return n.addEventListener("wheel",l,{passive:!1}),()=>{n.removeEventListener("wheel",l),f.current!==null&&(cancelAnimationFrame(f.current),f.current=null),s.current=0}},[]),o(tr,{detectInnerScroll:!0,track:nr,...ie,children:o(jn,{component:y,...t,ref:n=>{r.current=n,typeof e=="function"?e(n):e&&(e.current=n)},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:x?0:Oe,paddingTop:T,paddingBottom:me}}})})}),[]),tt=ne(()=>{if(Q===!0)return"#f5f5f5";if(typeof Q=="string")return Q},[Q]),[fn,kt]=Ie(u),[hn,gn]=Ie(0);Z(()=>{u&&kt(!0)},[u]);let Et=A(()=>{kt(!1)},[]),bn=fn,dr=u&&a.length>0,nt=S(!1),rt=S(-1),ot=S(null),at=S(null),[mn,xn]=Ie(!1),_e=A(()=>{let t=at.current;t&&xn(t.scrollHeight>t.clientHeight+1)},[]);Z(()=>{let t=at.current;if(!t||typeof ResizeObserver>"u")return;let e=new ResizeObserver(()=>_e());return e.observe(t),()=>e.disconnect()},[_e,z]);let it=S(C);it.current=C;let Te=S(g);Te.current=g;let lt=S(Mt);lt.current=Mt;let Lt=S(wt);Lt.current=wt;let Dt=S(null),We=ne(()=>{let t=new Map,e=0;return i.forEach(r=>{r.pinned==="left"&&(t.set(String(r.id),e),e+=typeof r.width=="number"?r.width:0)}),t},[i]),st=ne(()=>{if(i.some(t=>typeof t.minWidth=="number"))return i.reduce((t,e)=>t+(typeof e.width=="number"?e.width:typeof e.minWidth=="number"?e.minWidth:0),0)},[i]),fe=A((t,e)=>{let r=We.get(String(t.id));return r===void 0?{}:{position:"sticky",left:r,zIndex:e?3:1}},[We]),Fe=!!C,Re=S(!1),se=S({x:0,y:0});Z(()=>{let t=e=>{let r=e.clientX-se.current.x,s=e.clientY-se.current.y;Math.sqrt(r*r+s*s)>yt&&(Re.current=!0)};return document.addEventListener("mousemove",t),()=>{document.removeEventListener("mousemove",t)}},[]),Z(()=>{let t=document.querySelector('[data-testid="virtuoso-scroller"]');t&&t.querySelectorAll(".MuiTableSortLabel-root").forEach(r=>{let s=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});r.dispatchEvent(s)})},[M]);let Ve=A(t=>{if(!L)return;L(t,M===t&&k==="asc"?"desc":"asc")},[L,M,k]),[He,It]=Ie(null),Bt=S(B);Bt.current=B;let Pt=S(L);Pt.current=L;let ke=A((t,e)=>{if(!t){e.preventDefault();return}t.headerProps?.onContextMenu?.(e);let r=e.defaultPrevented;if(r||(r=Bt.current?.(t,e)===!0||e.defaultPrevented),e.preventDefault(),r||t.headerMenu===!1||!!!((t.sortMenu??t.sortable)&&Pt.current)&&!Ct(t))return;let f=e.currentTarget.getBoundingClientRect();It({colId:String(t.id),x:e.clientX,y:f.bottom})},[]),de=A(t=>{if(!Ct(t))return t.text;let e=!!(t.filterValues&&t.filterValues.length>0);return I(y,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5,maxWidth:"100%",color:e?"primary.main":void 0,fontWeight:e?600:void 0,verticalAlign:"middle"},children:[o(y,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.text}),o(bt,{active:e})]})},[]),yn=A(t=>{let e=v?performance.now():0;if(Lt.current?.(),!P){v&&(m.current.rangeChangedCalls+=1,m.current.rangeChangedMs+=performance.now()-e);return}if(u&&a.length===0){v&&(m.current.rangeChangedCalls+=1,m.current.rangeChangedMs+=performance.now()-e);return}let r=a.length>=30,s=t>=a.length-1,f=rt.current===a.length;if(s&&r&&!nt.current&&!f){nt.current=!0,rt.current=a.length;let n=a.length;P(n,50)}v&&(m.current.rangeChangedCalls+=1,m.current.rangeChangedMs+=performance.now()-e)},[a.length,u,P,v]);Z(()=>{u||(nt.current=!1)},[u]),Z(()=>{a.length===0&&gn(t=>t+1)},[a.length]);let At=S(vt);At.current=vt;let dt=S(a.length),ct=S(void 0);Z(()=>{let t=dt.current,e=a.length,r=e>0?Te.current?Te.current(a[0],0):a[0]:void 0,s=ct.current;if(e>t&&t>0){dt.current=e,ct.current=r;return}let f=e<t||t>0&&r!==s;f&&(rt.current=-1),ot.current&&e>0&&f&&At.current&&ot.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),dt.current=e,ct.current=r},[a]);let Nt=A(()=>{let t={},e=[];if(i.forEach(n=>{n.group?(t[n.group]||(t[n.group]=[]),t[n.group].push(n)):e.push(n)}),!(Object.keys(t).length>0))return o(Be,{children:i.map(n=>o(re,{align:n.align||"left",title:typeof n.text=="string"?n.text:void 0,...n.headerProps,onContextMenu:l=>ke(n,l),style:{width:n.width,minWidth:n.width??n.minWidth,...n.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...fe(n,!0),...n.headerProps?.style},children:n.sortable?o("div",{style:{display:"flex",alignItems:"center",justifyContent:n.align==="center"?"center":n.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:I(y,{className:"vdt-sort-box",sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>Ve(String(n.id)),children:[de(n),o(xt,{active:M===n.id,direction:M===n.id?k:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:M===n.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)"}}})]})}):de(n)},String(n.id)))});let s=[...e.map(n=>o(re,{rowSpan:2,align:n.align||"left",title:typeof n.text=="string"?n.text:void 0,...n.headerProps,onContextMenu:l=>ke(n,l),style:{width:n.width,minWidth:n.width,...n.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...fe(n,!0),...n.headerProps?.style},children:n.sortable&&L?o("div",{style:{display:"flex",alignItems:"center",justifyContent:n.align==="center"?"center":n.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:I(y,{className:"vdt-sort-box",sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>Ve(String(n.id)),children:[de(n),o(xt,{active:M===n.id,direction:M===n.id?k:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:M===n.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)"}}})]})}):de(n)},String(n.id))),...Object.entries(t).map(([n,l])=>o(re,{align:"center",colSpan:l.length,onContextMenu:H=>ke(null,H),style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:n},n))],f=[...Object.values(t).flat().map(n=>o(re,{align:n.align||"left",title:typeof n.text=="string"?n.text:void 0,...n.headerProps,onContextMenu:l=>ke(n,l),style:{width:n.width,minWidth:n.width,...n.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...fe(n,!0),...n.headerProps?.style},children:n.sortable&&L?o("div",{style:{display:"flex",alignItems:"center",justifyContent:n.align==="center"?"center":n.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:I(y,{className:"vdt-sort-box",sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>Ve(String(n.id)),children:[de(n),o(xt,{active:M===n.id,direction:M===n.id?k:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:M===n.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)"}}})]})}):de(n)},String(n.id)))];return I(Pe,{children:[o(Be,{children:s}),o(Be,{children:f})]})},[i,M,k,Ve,L,le,fe,ke,de]),Ot=ne(()=>{let t=i.filter(r=>r.mobile!==!1),e=t.find(r=>r.mobile==="title")??t.find(r=>!r.mobile);return{title:e,thumb:t.filter(r=>r.mobile==="thumb"),badge:t.filter(r=>r.mobile==="badge"),sub:t.filter(r=>r.mobile==="sub"),meta:t.filter(r=>r!==e&&(!r.mobile||r.mobile==="meta"))}},[i]),zt=A((t,e)=>{if(we?.renderRow)return we.renderRow(t,e);let r=p=>p.render?p.render(t,e):String(t[p.id]??""),{title:s,thumb:f,badge:n,sub:l,meta:H}=Ot;return I(y,{sx:{display:"flex",gap:"12px",alignItems:"flex-start",py:"12px",px:"14px",minWidth:0},children:[f.map(p=>o(y,{sx:{flexShrink:0},children:r(p)},String(p.id))),I(y,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:"4px"},children:[(s||n.length>0)&&I(y,{sx:{display:"flex",alignItems:"flex-start",gap:"8px",minWidth:0},children:[o(y,{sx:{flex:1,minWidth:0,fontSize:15,fontWeight:500,overflowWrap:"anywhere"},children:s?r(s):null}),n.map(p=>o(y,{sx:{flexShrink:0},children:r(p)},String(p.id)))]}),l.map(p=>o(y,{sx:{fontSize:13,color:b.headerColor,minWidth:0},children:r(p)},String(p.id))),H.length>0&&o(y,{sx:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:13,minWidth:0},children:H.map(p=>{let D=p.mobileLabel===!1?null:p.mobileLabel??(typeof p.text=="string"?p.text:null);return I(y,{sx:{display:"inline-flex",alignItems:"center",gap:"4px",minWidth:0,maxWidth:"100%"},children:[D?o(y,{component:"span",sx:{color:b.headerColor,flexShrink:0},children:D}):null,o(y,{component:"span",sx:{minWidth:0,"& > *":{width:"auto !important",textAlign:"left !important"}},children:r(p)})]},String(p.id))})})]})]})},[we,Ot,b]),$e=A((t,e)=>{let r=v?performance.now():0;if(!e){if(v){m.current.rowContentCalls+=1;let l=performance.now()-r;m.current.rowContentMs+=l,m.current.rowContentMaxMs=Math.max(m.current.rowContentMaxMs,l)}return null}if(X)return o(re,{colSpan:i.length,"data-vdt-pad":"",sx:{padding:0},children:zt(e,t)});let s=qe?qe(e,t):null;if(s!=null)return o(re,{colSpan:i.length,"data-vdt-pad":"",sx:[{padding:x?"0 14px":"8px 16px"},...Array.isArray(Ce)?Ce:Ce?[Ce]:[]],children:s});let f=0,n=i.map((l,H)=>{if(f>0)return f-=1,null;let p=l.colSpan?Math.max(1,Math.min(l.colSpan(e,t),i.length-H)):1;f=p-1;let D=v?performance.now():0,te=l.render?l.render(e,t):String(e[l.id]||"");if(v){let F=performance.now()-D;m.current.cellRenderCalls+=1,m.current.cellRenderMs+=F,m.current.cellRenderMaxMs=Math.max(m.current.cellRenderMaxMs,F)}let he=We.has(String(l.id)),w=l.cellPadding!==void 0,W=l.rowSpan?l.rowSpan(e,t):1;if(W<=0)return null;let ce=l.onCellClick;return o(re,{align:l.align||"left",rowSpan:W>1?W:void 0,colSpan:p>1?p:void 0,"data-vdt-pad":w?"":void 0,"data-vdt-pinned":he?"":void 0,"data-vdt-cell-click":ce?"":void 0,onClick:ce?F=>{let ge=F.clientX-se.current.x,ue=F.clientY-se.current.y;F.stopPropagation(),!(Math.sqrt(ge*ge+ue*ue)>yt)&&ce(e,t,F)}:void 0,style:{...p>1?{}:{width:l.width,minWidth:l.width??l.minWidth},...l.primary?{fontSize:15}:{},...l.style,...l.cellStyle?l.cellStyle(e,t):{},padding:w?l.cellPadding:"8px 16px",...fe(l,!1)},children:te},String(l.id))});if(v){m.current.rowContentCalls+=1;let l=performance.now()-r;m.current.rowContentMs+=l,m.current.rowContentMaxMs=Math.max(m.current.rowContentMaxMs,l)}return o(Pe,{children:n})},[i,v,qe,Ce,x,We,fe,X,zt]),_t=A(()=>{let t=Nt();if(!Me||Me.length===0)return t;let e=Dt.current;return I(Pe,{children:[t,o("tr",{"data-vdt-pinned-area":"",children:o("td",{colSpan:i.length,style:{padding:0,border:0},children:o(y,{"data-vdt-inner-scroll":"",sx:[{maxHeight:Ge,overflowY:Ge?"auto":"visible",overflowX:"hidden",scrollbarWidth:"thin",borderBottom:`1px solid ${x?b.borderStrong:"rgba(224, 224, 224, 1)"}`,"& tbody tr:last-of-type > td":{borderBottom:"none"}},...Array.isArray(ve)?ve:ve?[ve]:[]],children:I("table",{style:{width:"100%",tableLayout:Ne,borderCollapse:"separate",borderSpacing:0},children:[o("colgroup",{children:i.map(r=>o("col",{style:{width:r.width,minWidth:r.width??r.minWidth}},String(r.id)))}),o(qt,{children:Me.map((r,s)=>e?o(e,{item:r,"data-index":s,"data-vdt-pinned-row":"",children:$e(s,r)},g?String(g(r,s)):`p${s}`):null)})]})})})})]})},[Nt,Me,Ge,ve,i,$e,Ne,g,x,b]),U=Ke??i.some(t=>typeof t.footer=="function"),Wt=A(()=>{if(!U)return null;let t=[];for(let e=0;e<i.length;e+=1){let r=i[e],s=r.footerColSpan&&r.footerColSpan>1?Math.min(r.footerColSpan,i.length-e):1;t.push(o(re,{align:r.align||"left",colSpan:s>1?s:void 0,style:{...s>1?{}:{width:r.width,minWidth:r.width},...r.style,fontWeight:"bold",padding:x?"0 14px":"16px"},children:r.footer?r.footer(a):null},String(r.id))),e+=s-1}return o(Be,{children:t})},[U,i,a,x]),ut=ne(()=>({Scroller:Ht,Table:t=>o(Un,{...t,sx:{borderCollapse:"separate",tableLayout:Ne,...st&&!X?{minWidth:st}:{},marginRight:pe?"16px":0,...U?{height:"100%"}:{}}}),TableHead:je((t,e)=>o(Kn,{...t,ref:e,sx:{userSelect:"none","& > tr":{height:le,"& > th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:t=>{let{item:e,selected:r,"aria-selected":s,className:f,...n}=t,l=n["data-index"]??0,H=l%2===1,p=e&&Te.current?Te.current(e,l):l,D=!ze&&d!==null&&d!==void 0&&p===d,te=D&&Y?typeof Y=="function"?Y(e,l):Y:void 0,he=String(f??"").split(/\s+/).filter(w=>w!=="Mui-selected"&&w!=="Mui-focusVisible").join(" ");return o(Be,{...n,"data-row-id":p!=null?String(p):void 0,className:he||void 0,selected:D,onMouseDown:w=>{Re.current=!1,se.current={x:w.clientX,y:w.clientY}},onContextMenu:w=>{e&<.current&<.current(e,l,w)},onClick:w=>{let W=w.clientX-se.current.x,ce=w.clientY-se.current.y;if(Math.sqrt(W*W+ce*ce)>yt||Re.current){w.preventDefault(),w.stopPropagation(),Re.current=!1;return}e&&it.current&&it.current(e,l),Re.current=!1},sx:[{userSelect:"none",...Qe?{"& > td":{height:Se}}:{height:Se,maxHeight:Se},boxSizing:"border-box",backgroundColor:H&&tt?tt:"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":Fe&&!D?{backgroundColor:w=>{let W=w.palette.mode==="dark",F=Je??"#000000",ge=Rt??.06;if(!Je)return W?`rgba(255, 255, 255, ${ge})`:`rgba(0, 0, 0, ${ge})`;let ue=F.replace("#","").trim();if(ue.length!==6)return F;let Hn=parseInt(ue.substring(0,2),16),kn=parseInt(ue.substring(2,4),16),En=parseInt(ue.substring(4,6),16);return`rgba(${Hn}, ${kn}, ${En}, ${ge})`}}:void 0,cursor:Fe?"pointer":void 0},te]})},TableBody:je((t,e)=>{let{children:r,...s}=t;return I(qt,{...s,ref:e,sx:U?{height:"100%"}:void 0,children:[r,U&&o("tr",{"aria-hidden":!0,style:{height:"100%"},children:o("td",{colSpan:i.length,style:{padding:0,border:0}})})]})}),TableFoot:je((t,e)=>o(qn,{...t,ref:e,sx:[{"& tr":{height:xe??$,maxHeight:xe??$,boxSizing:"border-box"},"& td":{height:xe??$,boxSizing:"border-box",backgroundColor:r=>r.palette.mode==="dark"?"#1e1e1e":"#ffffff",padding:"0 16px",color:"inherit",fontSize:"0.875rem",border:"none",boxShadow:`inset 0 1px 0 0 ${x?b.borderStrong:"#000000"}`}},...Array.isArray(ye)?ye:ye?[ye]:[]]}))}),[Fe,ze?null:d,Y,$,tt,J,le,Je,Rt,Ht,xe,ye,U,x,b,i,Ne,pe,Qe,st,X]);Dt.current=ut.TableRow;let Cn=ut,Ee=ut,Mn=Ee.Table,vn=Ee.TableHead,wn=Ee.TableBody,Sn=Ee.TableRow,Tn=Ee.TableFoot,_=He?i.find(t=>String(t.id)===He.colId):void 0,Rn=()=>It(null),Ft=null;if(He&&_){let t=String(_.id),e=!!((_.sortMenu??_.sortable)&&L),r=Ct(_),s=M===t?k:void 0;Ft=o(mt,{open:!0,anchorPosition:{left:He.x,top:He.y},onClose:Rn,sort:e?{active:s??null,clearable:!!O,onChange:f=>{f?L?.(t,f):O?.()}}:void 0,filter:r?{options:_.filterOptions??[],value:_.filterValues??[],onChange:f=>_.onFilterChange?.(f),multiple:_.filterMultiple!==!1,emptyLabel:_.filterEmptyLabel,searchable:_.filterSearchable}:void 0})}let Vt=I(y,{sx:{position:"relative",height:z?"auto":"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:t=>x?`${b.bg} !important`:t.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"},...pn??{},"& tbody td[data-vdt-pinned]":{backgroundColor:x?b.bg:Ze.palette.background.paper},"& tbody td[data-vdt-cell-click]":{cursor:"pointer"},"& tbody td[data-vdt-cell-click]:hover":{backgroundColor:x?b.hoverBg:Ze.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"},...x&&Fe?{"& tbody tr:hover td[data-vdt-pinned]":{backgroundColor:b.hoverBg}}:{},...x?{...pe?{border:`1px solid ${b.borderStrong}`,borderRadius:"4px"}:{"& table":{backgroundColor:b.bg}},overflow:"hidden","& thead tr th > *":{verticalAlign:"middle"},"& thead > tr > th":{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},"& thead > tr > th > *":{maxWidth:"100%"},"& thead .vdt-sort-box":{paddingRight:"20px"},"& thead .vdt-sort-box > .MuiTableSortLabel-root":{left:"auto !important",right:0,marginLeft:"0 !important"},"& thead tr th":{height:le,boxSizing:"border-box",padding:"0 14px !important",fontSize:13,fontWeight:"500 !important",color:b.headerColor,backgroundColor:`${b.bg} !important`,borderTop:!pe&&Qt?`1px solid ${b.borderStrong}`:"none",borderBottom:`1px solid ${b.borderStrong}`,borderRight:`1px solid ${b.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 ${b.border}`},...a.length>0&&(z||mn||U)?{[`& tbody tr[data-index="${a.length-1}"]:not([data-vdt-pinned-row]) td`]:{borderBottom:"none"}}:{}}:{}},children:[z?o(y,{sx:{overflowX:"auto",width:"100%"},children:I(Mn,{children:[X?null:o(vn,{children:_t()}),o(wn,{children:a.map((t,e)=>o(Sn,{item:t,"data-index":e,children:$e(e,t)},g?String(g(t,e)):e))}),U&&!X?o(Tn,{children:Wt()}):null]})}):o(er,{ref:ot,data:a,totalCount:P?a.length+1:a.length,defaultItemHeight:Se,fixedItemHeight:Qe?void 0:Se,fixedHeaderContent:X?void 0:_t,fixedFooterContent:U&&!X?Wt:void 0,itemContent:$e,...en&&g?{computeItemKey:(t,e)=>e?g(e,t):`vdt-${t}`}:{},endReached:yn,scrollerRef:t=>{at.current=t instanceof HTMLElement?t:null,_e()},totalListHeightChanged:_e,style:{height:"100%"},increaseViewportBy:{top:an,bottom:ln},overscan:cn,followOutput:!1,components:Cn},hn),a.length===0&&!u&&!Tt&&x&&typeof ee=="string"&&o(y,{sx:{position:z?"static":"absolute",top:X?0:le,left:0,right:0,py:6,textAlign:"center",fontSize:14,color:b.emptyColor,pointerEvents:"none"},children:ee}),a.length===0&&!u&&!Tt&&!(x&&typeof ee=="string")&&o(y,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,pointerEvents:"none","& > *":{pointerEvents:"auto"}},children:typeof ee=="string"?I(Pe,{children:[o(y,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),o(Zn,{variant:"body1",sx:{color:"text.secondary"},children:ee})]}):ee}),Ft,bn&&o(Pe,{children:Ae?o(Ae,{visible:u,onComplete:Et}):o(Yt,{visible:u,onComplete:Et,size:40,indicator:o(jt,{}),sx:{top:`${i.some(t=>t.group)?le*2:le}px`,bottom:`${U?xe??$:0}px`},background:{show:a.length===0,opacity:.8}})})]}),$t=x&&pe?{paddingRight:Oe,paddingTop:Gt,paddingBottom:Gt}:{};return ae?o(Gn,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:Oe,...$t,boxSizing:"border-box",height:z?"auto":"100%",minHeight:0,flex:z?"none":1,display:"flex",flexDirection:"column"},children:Vt}):o(y,{className:"grow",style:{padding:0,paddingLeft:Oe,...$t,boxSizing:"border-box",height:z?"auto":"100%",minHeight:0,flex:z?"none":1,display:"flex",flexDirection:"column"},children:Vt})}var lr=Yn(ir);export{ft as HEADER_MENU_FONT_SIZE,j as HEADER_MENU_ICON_PATHS,ht as HEADER_MENU_ICON_SIZE,gt as HEADER_MENU_ITEM_HEIGHT,Kt as HEADER_MENU_ITEM_SX,bt as HeaderFilterIcon,mt as HeaderMenu,Ye as HeaderMenuDivider,be as HeaderMenuIcon,G as HeaderMenuItem,lr as VirtualDataTable,Xn as headerMenuAnchor};
|
|
4
|
+
`;function Gt({size:a=54}){return Wn(_n,{children:[qt("style",{children:zn}),qt("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:a,height:a}})]})}import je,{useMemo as Fn,useState as Vn}from"react";import{Box as Be,Divider as $n,InputBase as Xn,Menu as Yn,MenuItem as Un,SvgIcon as jn}from"@mui/material";import{jsx as h,jsxs as qe}from"react/jsx-runtime";var bt=14,mt=18,xt=34,U={asc:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z",desc:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z",checked:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",unchecked:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z",radioOn:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",radioOff:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",filter:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z",search:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"};function be({d:a,size:c=mt,color:i}){return h(jn,{sx:{fontSize:c,flexShrink:0,color:i},children:h("path",{d:a})})}function yt({size:a=14,active:c,color:i}){let C={stroke:"currentColor",strokeWidth:1.8,strokeMiterlimit:10,strokeLinecap:"round",strokeLinejoin:"round"};return qe(Be,{component:"svg",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,sx:{width:a,height:a,flexShrink:0,color:c?"primary.main":i??"currentColor",verticalAlign:"middle"},children:[h("path",{d:"M2 17.5H7",...C}),h("path",{d:"M22 6.5H17",...C}),h("path",{d:"M13 17.5H22",...C}),h("path",{d:"M11 6.5H2",...C}),h("path",{d:"M10 20.3999C8.34315 20.3999 7 19.0568 7 17.3999C7 15.743 8.34315 14.3999 10 14.3999C11.6569 14.3999 13 15.743 13 17.3999C13 19.0568 11.6569 20.3999 10 20.3999Z",...C}),h("path",{d:"M14 9.3999C15.6569 9.3999 17 8.05676 17 6.3999C17 4.74305 15.6569 3.3999 14 3.3999C12.3431 3.3999 11 4.74305 11 6.3999C11 8.05676 12.3431 9.3999 14 9.3999Z",...C})]})}var Zt={gap:1,fontSize:bt,lineHeight:"20px",minHeight:xt,py:"7px",px:1.5};function q({icon:a,iconSpace:c,selected:i,disabled:C,muted:g,onClick:d,sx:N,children:j}){return qe(Un,{selected:i,disabled:C,onClick:d,sx:[Zt,g?{color:"text.secondary"}:{},...Array.isArray(N)?N:N?[N]:[]],children:[a??(c?h(Be,{component:"span",sx:{width:mt,flexShrink:0}}):null),j]})}function Ke(){return h($n,{sx:{my:"4px !important"}})}function Kn(a,c){let i=a.getBoundingClientRect();return{left:c??i.left,top:i.bottom}}function Ct({open:a,anchorPosition:c,anchorEl:i,onClose:C,sort:g,filter:d,header:N,children:j,minWidth:re=180,maxHeight:Z=420}){let[Q,L]=Vn(""),O=d?.multiple!==!1,B=d?.value??[],A=Fn(()=>{if(!d)return[];let u=d.options;return d.emptyLabel&&!u.some(R=>R.value==="")?[...u,{value:"",label:d.emptyLabel}]:u},[d]),M=!!d&&(d?.searchable??A.length>10),k=Q.trim().toLowerCase(),oe=k?A.filter(u=>u.label.toLowerCase().includes(k)):A,F=()=>{L(""),C()},T=[];if(N&&T.push(...je.Children.toArray(N).map((u,R)=>je.isValidElement(u)?je.cloneElement(u,{key:`h${R}`}):u)),g){let u=R=>{F(),g.onChange(g.active===R&&g.clearable!==!1?null:R)};T.push(h(q,{selected:g.active==="asc",onClick:()=>u("asc"),icon:h(be,{d:U.asc,color:"text.secondary"}),children:"\uC624\uB984\uCC28\uC21C \uC815\uB82C"},"sort-asc"),h(q,{selected:g.active==="desc",onClick:()=>u("desc"),icon:h(be,{d:U.desc,color:"text.secondary"}),children:"\uB0B4\uB9BC\uCC28\uC21C \uC815\uB82C"},"sort-desc")),g.active&&g.clearable!==!1&&T.push(h(q,{muted:!0,iconSpace:!0,onClick:()=>{F(),g.onChange(null)},children:"\uC815\uB82C \uD480\uAE30"},"sort-clear"))}return g&&d&&T.push(h(Ke,{},"div-sort")),d&&(M&&T.push(qe(Be,{onKeyDown:u=>u.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1,px:1.5,pb:.5,minHeight:xt},children:[h(be,{d:U.search,color:"text.secondary"}),h(Xn,{autoFocus:!0,value:Q,onChange:u=>L(u.target.value),placeholder:d.searchPlaceholder??"\uCC3E\uAE30",sx:{flex:1,fontSize:bt}})]},"search")),!O&&d.allLabel&&T.push(h(q,{selected:B.length===0,onClick:()=>{F(),d.onChange([])},icon:h(be,{d:B.length===0?U.radioOn:U.radioOff,color:B.length===0?"primary.main":"text.disabled"}),children:d.allLabel},"f-all")),A.length===0&&T.push(h(q,{disabled:!0,iconSpace:!0,children:d.emptyText??"\uACE0\uB97C \uAC12\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},"f-none")),oe.forEach(u=>{let R=B.includes(u.value),E=()=>{if(O){d.onChange(R?B.filter(ae=>ae!==u.value):[...B,u.value]);return}F(),d.onChange(R?[]:[u.value])},K=O?R?U.checked:U.unchecked:R?U.radioOn:U.radioOff;T.push(qe(q,{selected:!O&&R,onClick:E,icon:h(be,{d:K,color:R?"primary.main":"text.disabled"}),children:[u.icon,h(Be,{component:"span",sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.render??u.label}),typeof u.count=="number"?h(Be,{component:"span",sx:{color:"text.secondary",ml:1,fontVariantNumeric:"tabular-nums"},children:u.count}):null]},`f:${u.value||"(empty)"}`))}),M&&k&&oe.length===0&&T.push(h(q,{disabled:!0,iconSpace:!0,children:"\uCC3E\uB294 \uAC12\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},"f-nohit")),B.length>0&&T.push(h(Ke,{},"div-filter"),h(q,{muted:!0,iconSpace:!0,onClick:()=>{F(),d.onChange([])},children:d.clearLabel??"\uAC70\uB974\uAE30 \uD480\uAE30"},"f-clear"))),j&&(T.length>0&&T.push(h(Ke,{},"div-children")),T.push(...je.Children.toArray(j))),h(Yn,{open:a&&(!!c||!!i),...!c&&!!i?{anchorEl:i}:{anchorReference:"anchorPosition",anchorPosition:c??void 0},onClose:F,transitionDuration:0,disableAutoFocusItem:M,onContextMenu:u=>u.preventDefault(),onClick:u=>u.stopPropagation(),slotProps:{paper:{sx:{maxHeight:Z,minWidth:re}},list:{sx:{py:.5}}},children:T})}import ar from"@ehfuse/overlay-scrollbar";import{Fragment as Ne,jsx as o,jsxs as I}from"react/jsx-runtime";var ir={alignment:"default",margin:0,radius:0},vt=5,lr={bg:"#ffffff",border:"#e6e6e3",borderStrong:"#dedddb",headerColor:"#787774",hoverBg:"#f8f8f7",emptyColor:"#9b9a97",selectedBg:"#dbeafe",selectedBar:"#3b82f6"},Jt="12px",sr={bg:"#1e1e1e",border:"#2c333c",borderStrong:"#3b434e",headerColor:"#a3adbb",hoverBg:"#272d36",emptyColor:"#7d8590",selectedBg:"rgba(59, 130, 246, 0.22)",selectedBar:"#60a5fa"},en=Oe((a,c)=>o("div",{...a,ref:c}));en.displayName="VdtPlainScroller";var dr="(max-width:599.95px)";function wt(a){return!!(a.filterOptions&&a.onFilterChange)}function cr({data:a,loading:c=!1,columns:i,onRowClick:C,getRowId:g,selectedRowId:d,selectedRowSx:N,rowHeight:j,columnHeight:re,striped:Z,rowDivider:Q=!0,onSort:L,onSortClear:O,onHeaderContextMenu:B,onLoadMore:A,sortBy:M,sortDirection:k,showPaper:oe=!0,paddingX:F,paddingTop:T=0,paddingBottom:me=0,rowHoverColor:u,rowHoverOpacity:R,viewportBuffer:E,overscan:K,scrollbars:ae,emptyMessage:J="NO DATA",autoHeight:xe=!1,LoadingComponent:ze,showFooter:Ge,footerHeight:ye,footerSx:Ce,variant:tn="default",framed:pe=!0,headerTopBorder:nn=!1,rowHeightMode:rn="fixed",tableLayout:_e="fixed",renderFullWidthRow:Ze,fullWidthRowSx:Me,onRowContextMenu:St,pinnedRows:ve,pinnedRowsMaxHeight:Qe,pinnedRowsSx:we,resetScrollOnDataChange:Tt=!0,rowKeyFromId:on=!1,onEndReached:Rt,colorMode:an,mobile:Ht,scrollParent:Je}){let x=tn==="notion",et=nr(),b=(an??et.palette.mode)==="dark"?sr:lr,kt=(ve?.length??0)>0,ie=re??(x?40:56),V=j??(x?48:50),We=pe?F??(x?"12px":"1rem"):0,Se=Ht===!0?{}:Ht||null,ln=rr(Se?.query??dr,{noSsr:!0}),$=!!Se&&ln,Te=!!Je,le=xe||Te,tt=rn==="auto"||$,nt=u??(x?b.hoverBg:void 0),Et=R??(x?1:void 0),sn=Math.max(V*12,480),dn=Math.max(V*12,480),cn=typeof E=="number"?E:E?.top??sn,un=typeof E=="number"?E:E?.bottom??dn,pn=Math.max(V*8,420),fn=Math.max(V*10,520),hn=typeof K=="number"?K:{main:K?.main??pn,reverse:K?.reverse??fn},Re=V+(Q?1:0),gn=te(()=>x?{backgroundColor:b.selectedBg,"& > td:first-of-type":{boxShadow:`inset 3px 0 0 ${b.selectedBar}`},"& > td[data-vdt-pinned]":{backgroundColor:b.selectedBg}}:void 0,[x,b]),X=N??gn,Fe=!X||typeof X!="function",bn=te(()=>!Fe||d===null||d===void 0||!X?null:{[`& tbody tr[data-row-id="${String(d).replace(/["\\]/g,"\\$&")}"]`]:X},[Fe,d,X]),pr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),[v]=Ae(()=>typeof window>"u"?!1:window.localStorage.getItem("vdt-perf-debug")==="1"),m=S({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}),rt=P(t=>{if(!v)return;let e=m.current;if(!(e.wheelEvents>0||e.rangeChangedCalls>0||e.rowContentCalls>0||e.cellRenderCalls>0))return;let s=e.rowContentCalls>0?e.rowContentMs/e.rowContentCalls:0,f=e.cellRenderCalls>0?e.cellRenderMs/e.cellRenderCalls:0;console.log("[VDT perf]",{reason:t,wheel:{events:e.wheelEvents,inputPx:Math.round(e.wheelInputPx),handlerMs:Number(e.wheelHandlerMs.toFixed(2)),rafFlushes:e.wheelRafFlushes,rafMs:Number(e.wheelRafMs.toFixed(2))},rangeChanged:{calls:e.rangeChangedCalls,totalMs:Number(e.rangeChangedMs.toFixed(2))},rowContent:{calls:e.rowContentCalls,totalMs:Number(e.rowContentMs.toFixed(2)),avgMs:Number(s.toFixed(3)),maxMs:Number(e.rowContentMaxMs.toFixed(3))},cellRender:{calls:e.cellRenderCalls,totalMs:Number(e.cellRenderMs.toFixed(2)),avgMs:Number(f.toFixed(3)),maxMs:Number(e.cellRenderMaxMs.toFixed(3))}}),m.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}},[v]);G(()=>{if(!v||typeof window>"u")return;console.log("[VDT perf] enabled (localStorage vdt-perf-debug=1)");let t=window.setInterval(()=>{rt("interval")},1500);return()=>{window.clearInterval(t),rt("cleanup")}},[rt,v]);let Lt=te(()=>Oe((t,e)=>{let r=S(null),s=S(0),f=S(null);return G(()=>{let n=r.current;if(!n)return;let l=H=>{let p=v?performance.now():0;if(H.shiftKey||Math.abs(H.deltaX)>Math.abs(H.deltaY))return;let D=H.target?.closest?.("[data-vdt-inner-scroll]");if(D&&n.contains(D)&&(H.deltaY<0?D.scrollTop>0:D.scrollTop+D.clientHeight<D.scrollHeight-1))return;H.preventDefault();let ee=H.deltaY;H.deltaMode===1?ee*=40:H.deltaMode===2&&(ee*=n.clientHeight),v&&(m.current.wheelEvents+=1,m.current.wheelInputPx+=ee),s.current+=ee,f.current===null&&(f.current=requestAnimationFrame(()=>{let he=v?performance.now():0,w=Math.max(n.clientHeight*.4,160),_=Math.max(-w,Math.min(w,s.current));s.current=0,f.current=null,_!==0&&(n.scrollTop+=_),v&&(m.current.wheelRafFlushes+=1,m.current.wheelRafMs+=performance.now()-he)}),v&&(m.current.wheelHandlerMs+=performance.now()-p))};return n.addEventListener("wheel",l,{passive:!1}),()=>{n.removeEventListener("wheel",l),f.current!==null&&(cancelAnimationFrame(f.current),f.current=null),s.current=0}},[]),o(ar,{detectInnerScroll:!0,track:ir,...ae,children:o(Zn,{component:y,...t,ref:n=>{r.current=n,typeof e=="function"?e(n):e&&(e.current=n)},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:x?0:We,paddingTop:T,paddingBottom:me}}})})}),[]),ot=te(()=>{if(Z===!0)return"#f5f5f5";if(typeof Z=="string")return Z},[Z]),[mn,Dt]=Ae(c),[xn,yn]=Ae(0);G(()=>{c&&Dt(!0)},[c]);let It=P(()=>{Dt(!1)},[]),Cn=mn,fr=c&&a.length>0,at=S(!1),it=S(-1),lt=S(null),st=S(null),[Mn,vn]=Ae(!1),Ve=P(()=>{let t=st.current;t&&vn(t.scrollHeight>t.clientHeight+1)},[]);G(()=>{let t=st.current;if(!t||typeof ResizeObserver>"u")return;let e=new ResizeObserver(()=>Ve());return e.observe(t),()=>e.disconnect()},[Ve,xe]);let dt=S(C);dt.current=C;let He=S(g);He.current=g;let ct=S(St);ct.current=St;let Bt=S(Rt);Bt.current=Rt;let At=S(null),$e=te(()=>{let t=new Map,e=0;return i.forEach(r=>{r.pinned==="left"&&(t.set(String(r.id),e),e+=typeof r.width=="number"?r.width:0)}),t},[i]),ut=te(()=>{if(i.some(t=>typeof t.minWidth=="number"))return i.reduce((t,e)=>t+(typeof e.width=="number"?e.width:typeof e.minWidth=="number"?e.minWidth:0),0)},[i]),fe=P((t,e)=>{let r=$e.get(String(t.id));return r===void 0?{}:{position:"sticky",left:r,zIndex:e?3:1}},[$e]),Xe=!!C,ke=S(!1),se=S({x:0,y:0});G(()=>{let t=e=>{let r=e.clientX-se.current.x,s=e.clientY-se.current.y;Math.sqrt(r*r+s*s)>vt&&(ke.current=!0)};return document.addEventListener("mousemove",t),()=>{document.removeEventListener("mousemove",t)}},[]),G(()=>{let t=document.querySelector('[data-testid="virtuoso-scroller"]');t&&t.querySelectorAll(".MuiTableSortLabel-root").forEach(r=>{let s=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});r.dispatchEvent(s)})},[M]);let Ye=P(t=>{if(!L)return;L(t,M===t&&k==="asc"?"desc":"asc")},[L,M,k]),[Ee,Pt]=Ae(null),Nt=S(B);Nt.current=B;let Ot=S(L);Ot.current=L;let Le=P((t,e)=>{if(!t){e.preventDefault();return}t.headerProps?.onContextMenu?.(e);let r=e.defaultPrevented;if(r||(r=Nt.current?.(t,e)===!0||e.defaultPrevented),e.preventDefault(),r||t.headerMenu===!1||!!!((t.sortMenu??t.sortable)&&Ot.current)&&!wt(t))return;let f=e.currentTarget.getBoundingClientRect();Pt({colId:String(t.id),x:e.clientX,y:f.bottom})},[]),de=P(t=>{if(!wt(t))return t.text;let e=!!(t.filterValues&&t.filterValues.length>0);return I(y,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5,maxWidth:"100%",color:e?"primary.main":void 0,fontWeight:e?600:void 0,verticalAlign:"middle"},children:[o(y,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.text}),o(yt,{active:e})]})},[]),wn=P(t=>{let e=v?performance.now():0;if(Bt.current?.(),!A){v&&(m.current.rangeChangedCalls+=1,m.current.rangeChangedMs+=performance.now()-e);return}if(c&&a.length===0){v&&(m.current.rangeChangedCalls+=1,m.current.rangeChangedMs+=performance.now()-e);return}let r=a.length>=30,s=t>=a.length-1,f=it.current===a.length;if(s&&r&&!at.current&&!f){at.current=!0,it.current=a.length;let n=a.length;A(n,50)}v&&(m.current.rangeChangedCalls+=1,m.current.rangeChangedMs+=performance.now()-e)},[a.length,c,A,v]);G(()=>{c||(at.current=!1)},[c]),G(()=>{a.length===0&&yn(t=>t+1)},[a.length]);let zt=S(Tt);zt.current=Tt;let pt=S(a.length),ft=S(void 0);G(()=>{let t=pt.current,e=a.length,r=e>0?He.current?He.current(a[0],0):a[0]:void 0,s=ft.current;if(e>t&&t>0){pt.current=e,ft.current=r;return}let f=e<t||t>0&&r!==s;f&&(it.current=-1),lt.current&&e>0&&f&&zt.current&<.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),pt.current=e,ft.current=r},[a]);let _t=P(()=>{let t={},e=[];if(i.forEach(n=>{n.group?(t[n.group]||(t[n.group]=[]),t[n.group].push(n)):e.push(n)}),!(Object.keys(t).length>0))return o(Pe,{children:i.map(n=>o(ne,{align:n.align||"left",title:typeof n.text=="string"?n.text:void 0,...n.headerProps,onContextMenu:l=>Le(n,l),style:{width:n.width,minWidth:n.width??n.minWidth,...n.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...fe(n,!0),...n.headerProps?.style},children:n.sortable?o("div",{style:{display:"flex",alignItems:"center",justifyContent:n.align==="center"?"center":n.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:I(y,{className:"vdt-sort-box",sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>Ye(String(n.id)),children:[de(n),o(Mt,{active:M===n.id,direction:M===n.id?k:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:M===n.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)"}}})]})}):de(n)},String(n.id)))});let s=[...e.map(n=>o(ne,{rowSpan:2,align:n.align||"left",title:typeof n.text=="string"?n.text:void 0,...n.headerProps,onContextMenu:l=>Le(n,l),style:{width:n.width,minWidth:n.width,...n.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...fe(n,!0),...n.headerProps?.style},children:n.sortable&&L?o("div",{style:{display:"flex",alignItems:"center",justifyContent:n.align==="center"?"center":n.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:I(y,{className:"vdt-sort-box",sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>Ye(String(n.id)),children:[de(n),o(Mt,{active:M===n.id,direction:M===n.id?k:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:M===n.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)"}}})]})}):de(n)},String(n.id))),...Object.entries(t).map(([n,l])=>o(ne,{align:"center",colSpan:l.length,onContextMenu:H=>Le(null,H),style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:n},n))],f=[...Object.values(t).flat().map(n=>o(ne,{align:n.align||"left",title:typeof n.text=="string"?n.text:void 0,...n.headerProps,onContextMenu:l=>Le(n,l),style:{width:n.width,minWidth:n.width,...n.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...fe(n,!0),...n.headerProps?.style},children:n.sortable&&L?o("div",{style:{display:"flex",alignItems:"center",justifyContent:n.align==="center"?"center":n.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:I(y,{className:"vdt-sort-box",sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>Ye(String(n.id)),children:[de(n),o(Mt,{active:M===n.id,direction:M===n.id?k:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:M===n.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)"}}})]})}):de(n)},String(n.id)))];return I(Ne,{children:[o(Pe,{children:s}),o(Pe,{children:f})]})},[i,M,k,Ye,L,ie,fe,Le,de]),Wt=te(()=>{let t=i.filter(r=>r.mobile!==!1),e=t.find(r=>r.mobile==="title")??t.find(r=>!r.mobile);return{title:e,thumb:t.filter(r=>r.mobile==="thumb"),badge:t.filter(r=>r.mobile==="badge"),sub:t.filter(r=>r.mobile==="sub"),meta:t.filter(r=>r!==e&&(!r.mobile||r.mobile==="meta"))}},[i]),Ft=P((t,e)=>{if(Se?.renderRow)return Se.renderRow(t,e);let r=p=>p.render?p.render(t,e):String(t[p.id]??""),{title:s,thumb:f,badge:n,sub:l,meta:H}=Wt;return I(y,{sx:{display:"flex",gap:"12px",alignItems:"flex-start",py:"12px",px:"14px",minWidth:0},children:[f.map(p=>o(y,{sx:{flexShrink:0},children:r(p)},String(p.id))),I(y,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:"4px"},children:[(s||n.length>0)&&I(y,{sx:{display:"flex",alignItems:"flex-start",gap:"8px",minWidth:0},children:[o(y,{sx:{flex:1,minWidth:0,fontSize:15,fontWeight:500,overflowWrap:"anywhere"},children:s?r(s):null}),n.map(p=>o(y,{sx:{flexShrink:0},children:r(p)},String(p.id)))]}),l.map(p=>o(y,{sx:{fontSize:13,color:b.headerColor,minWidth:0},children:r(p)},String(p.id))),H.length>0&&o(y,{sx:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:13,minWidth:0},children:H.map(p=>{let D=p.mobileLabel===!1?null:p.mobileLabel??(typeof p.text=="string"?p.text:null);return I(y,{sx:{display:"inline-flex",alignItems:"center",gap:"4px",minWidth:0,maxWidth:"100%"},children:[D?o(y,{component:"span",sx:{color:b.headerColor,flexShrink:0},children:D}):null,o(y,{component:"span",sx:{minWidth:0,"& > *":{width:"auto !important",textAlign:"left !important"}},children:r(p)})]},String(p.id))})})]})]})},[Se,Wt,b]),Ue=P((t,e)=>{let r=v?performance.now():0;if(!e){if(v){m.current.rowContentCalls+=1;let l=performance.now()-r;m.current.rowContentMs+=l,m.current.rowContentMaxMs=Math.max(m.current.rowContentMaxMs,l)}return null}if($)return o(ne,{colSpan:i.length,"data-vdt-pad":"",sx:{padding:0},children:Ft(e,t)});let s=Ze?Ze(e,t):null;if(s!=null)return o(ne,{colSpan:i.length,"data-vdt-pad":"",sx:[{padding:x?"0 14px":"8px 16px"},...Array.isArray(Me)?Me:Me?[Me]:[]],children:s});let f=0,n=i.map((l,H)=>{if(f>0)return f-=1,null;let p=l.colSpan?Math.max(1,Math.min(l.colSpan(e,t),i.length-H)):1;f=p-1;let D=v?performance.now():0,ee=l.render?l.render(e,t):String(e[l.id]||"");if(v){let W=performance.now()-D;m.current.cellRenderCalls+=1,m.current.cellRenderMs+=W,m.current.cellRenderMaxMs=Math.max(m.current.cellRenderMaxMs,W)}let he=$e.has(String(l.id)),w=l.cellPadding!==void 0,_=l.rowSpan?l.rowSpan(e,t):1;if(_<=0)return null;let ce=l.onCellClick;return o(ne,{align:l.align||"left",rowSpan:_>1?_:void 0,colSpan:p>1?p:void 0,"data-vdt-pad":w?"":void 0,"data-vdt-pinned":he?"":void 0,"data-vdt-cell-click":ce?"":void 0,onClick:ce?W=>{let ge=W.clientX-se.current.x,ue=W.clientY-se.current.y;W.stopPropagation(),!(Math.sqrt(ge*ge+ue*ue)>vt)&&ce(e,t,W)}:void 0,style:{...p>1?{}:{width:l.width,minWidth:l.width??l.minWidth},...l.primary?{fontSize:15}:{},...l.style,...l.cellStyle?l.cellStyle(e,t):{},padding:w?l.cellPadding:"8px 16px",...fe(l,!1)},children:ee},String(l.id))});if(v){m.current.rowContentCalls+=1;let l=performance.now()-r;m.current.rowContentMs+=l,m.current.rowContentMaxMs=Math.max(m.current.rowContentMaxMs,l)}return o(Ne,{children:n})},[i,v,Ze,Me,x,$e,fe,$,Ft]),Vt=P(()=>{let t=_t();if(!ve||ve.length===0)return t;let e=At.current;return I(Ne,{children:[t,o("tr",{"data-vdt-pinned-area":"",children:o("td",{colSpan:i.length,style:{padding:0,border:0},children:o(y,{"data-vdt-inner-scroll":"",sx:[{maxHeight:Qe,overflowY:Qe?"auto":"visible",overflowX:"hidden",scrollbarWidth:"thin",borderBottom:`1px solid ${x?b.borderStrong:"rgba(224, 224, 224, 1)"}`,"& tbody tr:last-of-type > td":{borderBottom:"none"}},...Array.isArray(we)?we:we?[we]:[]],children:I("table",{style:{width:"100%",tableLayout:_e,borderCollapse:"separate",borderSpacing:0},children:[o("colgroup",{children:i.map(r=>o("col",{style:{width:r.width,minWidth:r.width??r.minWidth}},String(r.id)))}),o(Qt,{children:ve.map((r,s)=>e?o(e,{item:r,"data-index":s,"data-vdt-pinned-row":"",children:Ue(s,r)},g?String(g(r,s)):`p${s}`):null)})]})})})})]})},[_t,ve,Qe,we,i,Ue,_e,g,x,b]),Y=Ge??i.some(t=>typeof t.footer=="function"),$t=P(()=>{if(!Y)return null;let t=[];for(let e=0;e<i.length;e+=1){let r=i[e],s=r.footerColSpan&&r.footerColSpan>1?Math.min(r.footerColSpan,i.length-e):1;t.push(o(ne,{align:r.align||"left",colSpan:s>1?s:void 0,style:{...s>1?{}:{width:r.width,minWidth:r.width},...r.style,fontWeight:"bold",padding:x?"0 14px":"16px"},children:r.footer?r.footer(a):null},String(r.id))),e+=s-1}return o(Pe,{children:t})},[Y,i,a,x]),ht=te(()=>({Scroller:Te?en:Lt,Table:t=>o(Gn,{...t,sx:{borderCollapse:"separate",tableLayout:_e,...ut&&!$?{minWidth:ut}:{},marginRight:pe?"16px":0,...Y?{height:"100%"}:{}}}),TableHead:Oe((t,e)=>o(Qn,{...t,ref:e,sx:{userSelect:"none","& > tr":{height:ie,"& > th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:t=>{let{item:e,selected:r,"aria-selected":s,className:f,...n}=t,l=n["data-index"]??0,H=l%2===1,p=e&&He.current?He.current(e,l):l,D=!Fe&&d!==null&&d!==void 0&&p===d,ee=D&&X?typeof X=="function"?X(e,l):X:void 0,he=String(f??"").split(/\s+/).filter(w=>w!=="Mui-selected"&&w!=="Mui-focusVisible").join(" ");return o(Pe,{...n,"data-row-id":p!=null?String(p):void 0,className:he||void 0,selected:D,onMouseDown:w=>{ke.current=!1,se.current={x:w.clientX,y:w.clientY}},onContextMenu:w=>{e&&ct.current&&ct.current(e,l,w)},onClick:w=>{let _=w.clientX-se.current.x,ce=w.clientY-se.current.y;if(Math.sqrt(_*_+ce*ce)>vt||ke.current){w.preventDefault(),w.stopPropagation(),ke.current=!1;return}e&&dt.current&&dt.current(e,l),ke.current=!1},sx:[{userSelect:"none",...tt?{"& > td":{height:Re}}:{height:Re,maxHeight:Re},boxSizing:"border-box",backgroundColor:H&&ot?ot:"transparent","& td:not([data-vdt-pad])":{padding:"8px 16px"},"& td":{boxSizing:"border-box",borderBottom:Q?"1px solid rgba(224, 224, 224, 1)":"none"},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":Xe&&!D?{backgroundColor:w=>{let _=w.palette.mode==="dark",W=nt??"#000000",ge=Et??.06;if(!nt)return _?`rgba(255, 255, 255, ${ge})`:`rgba(0, 0, 0, ${ge})`;let ue=W.replace("#","").trim();if(ue.length!==6)return W;let Dn=parseInt(ue.substring(0,2),16),In=parseInt(ue.substring(2,4),16),Bn=parseInt(ue.substring(4,6),16);return`rgba(${Dn}, ${In}, ${Bn}, ${ge})`}}:void 0,cursor:Xe?"pointer":void 0},ee]})},TableBody:Oe((t,e)=>{let{children:r,...s}=t;return I(Qt,{...s,ref:e,sx:Y?{height:"100%"}:void 0,children:[r,Y&&o("tr",{"aria-hidden":!0,style:{height:"100%"},children:o("td",{colSpan:i.length,style:{padding:0,border:0}})})]})}),TableFoot:Oe((t,e)=>o(Jn,{...t,ref:e,sx:[{"& tr":{height:ye??V,maxHeight:ye??V,boxSizing:"border-box"},"& td":{height:ye??V,boxSizing:"border-box",backgroundColor:r=>r.palette.mode==="dark"?"#1e1e1e":"#ffffff",padding:"0 16px",color:"inherit",fontSize:"0.875rem",border:"none",boxShadow:`inset 0 1px 0 0 ${x?b.borderStrong:"#000000"}`}},...Array.isArray(Ce)?Ce:Ce?[Ce]:[]]}))}),[Xe,Fe?null:d,X,V,ot,Q,ie,nt,Et,Lt,ye,Ce,Y,x,b,i,_e,pe,tt,ut,$,Te]);At.current=ht.TableRow;let Sn=ht,De=ht,Tn=De.Table,Rn=De.TableHead,Hn=De.TableBody,kn=De.TableRow,En=De.TableFoot,z=Ee?i.find(t=>String(t.id)===Ee.colId):void 0,Ln=()=>Pt(null),Xt=null;if(Ee&&z){let t=String(z.id),e=!!((z.sortMenu??z.sortable)&&L),r=wt(z),s=M===t?k:void 0;Xt=o(Ct,{open:!0,anchorPosition:{left:Ee.x,top:Ee.y},onClose:Ln,sort:e?{active:s??null,clearable:!!O,onChange:f=>{f?L?.(t,f):O?.()}}:void 0,filter:r?{options:z.filterOptions??[],value:z.filterValues??[],onChange:f=>z.onFilterChange?.(f),multiple:z.filterMultiple!==!1,emptyLabel:z.filterEmptyLabel,searchable:z.filterSearchable}:void 0})}let Yt=I(y,{sx:{position:"relative",height:le?"auto":"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:t=>x?`${b.bg} !important`:t.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"},...bn??{},"& tbody td[data-vdt-pinned]":{backgroundColor:x?b.bg:et.palette.background.paper},"& tbody td[data-vdt-cell-click]":{cursor:"pointer"},"& tbody td[data-vdt-cell-click]:hover":{backgroundColor:x?b.hoverBg:et.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"},...x&&Xe?{"& tbody tr:hover td[data-vdt-pinned]":{backgroundColor:b.hoverBg}}:{},...x?{...pe?{border:`1px solid ${b.borderStrong}`,borderRadius:"4px"}:{"& table":{backgroundColor:b.bg}},overflow:"hidden","& thead tr th > *":{verticalAlign:"middle"},"& thead > tr > th":{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},"& thead > tr > th > *":{maxWidth:"100%"},"& thead .vdt-sort-box":{paddingRight:"20px"},"& thead .vdt-sort-box > .MuiTableSortLabel-root":{left:"auto !important",right:0,marginLeft:"0 !important"},"& thead tr th":{height:ie,boxSizing:"border-box",padding:"0 14px !important",fontSize:13,fontWeight:"500 !important",color:b.headerColor,backgroundColor:`${b.bg} !important`,borderTop:!pe&&nn?`1px solid ${b.borderStrong}`:"none",borderBottom:`1px solid ${b.borderStrong}`,borderRight:`1px solid ${b.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 ${b.border}`},...a.length>0&&(le||Mn||Y)?{[`& tbody tr[data-index="${a.length-1}"]:not([data-vdt-pinned-row]) td`]:{borderBottom:"none"}}:{}}:{}},children:[xe?o(y,{sx:{overflowX:"auto",width:"100%"},children:I(Tn,{children:[$?null:o(Rn,{children:Vt()}),o(Hn,{children:a.map((t,e)=>o(kn,{item:t,"data-index":e,children:Ue(e,t)},g?String(g(t,e)):e))}),Y&&!$?o(En,{children:$t()}):null]})}):Je===null?null:o(or,{ref:lt,data:a,totalCount:A?a.length+1:a.length,defaultItemHeight:Re,fixedItemHeight:tt?void 0:Re,fixedHeaderContent:$?void 0:Vt,fixedFooterContent:Y&&!$?$t:void 0,itemContent:Ue,...on&&g?{computeItemKey:(t,e)=>e?g(e,t):`vdt-${t}`}:{},endReached:wn,scrollerRef:t=>{st.current=t instanceof HTMLElement?t:null,Ve()},totalListHeightChanged:Ve,style:Te?void 0:{height:"100%"},...Te?{customScrollParent:Je}:{},increaseViewportBy:{top:cn,bottom:un},overscan:hn,followOutput:!1,components:Sn},xn),a.length===0&&!c&&!kt&&x&&typeof J=="string"&&o(y,{sx:{position:le?"static":"absolute",top:$?0:ie,left:0,right:0,py:6,px:2,textAlign:"center",fontSize:14,color:b.emptyColor,pointerEvents:"none"},children:J}),a.length===0&&!c&&!kt&&!(x&&typeof J=="string")&&o(y,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,px:2,textAlign:"center",pointerEvents:"none","& > *":{pointerEvents:"auto"}},children:typeof J=="string"?I(Ne,{children:[o(y,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),o(tr,{variant:"body1",sx:{color:"text.secondary"},children:J})]}):J}),Xt,Cn&&o(Ne,{children:ze?o(ze,{visible:c,onComplete:It}):o(Kt,{visible:c,onComplete:It,size:40,indicator:o(Gt,{}),sx:{top:`${i.some(t=>t.group)?ie*2:ie}px`,bottom:`${Y?ye??V:0}px`},background:{show:a.length===0,opacity:.8}})})]}),Ut=x&&pe?{paddingRight:We,paddingTop:Jt,paddingBottom:Jt}:{};return oe?o(er,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:We,...Ut,boxSizing:"border-box",height:le?"auto":"100%",minHeight:0,flex:le?"none":1,display:"flex",flexDirection:"column"},children:Yt}):o(y,{className:"grow",style:{padding:0,paddingLeft:We,...Ut,boxSizing:"border-box",height:le?"auto":"100%",minHeight:0,flex:le?"none":1,display:"flex",flexDirection:"column"},children:Yt})}var ur=qn(cr);export{bt as HEADER_MENU_FONT_SIZE,U as HEADER_MENU_ICON_PATHS,mt as HEADER_MENU_ICON_SIZE,xt as HEADER_MENU_ITEM_HEIGHT,Zt as HEADER_MENU_ITEM_SX,yt as HeaderFilterIcon,Ct as HeaderMenu,Ke as HeaderMenuDivider,be as HeaderMenuIcon,q as HeaderMenuItem,ur as VirtualDataTable,Kn as headerMenuAnchor};
|
|
5
5
|
/**
|
|
6
6
|
* Virtual Data Table - A high-performance virtual data table component for React
|
|
7
7
|
*
|