@ehfuse/mui-virtual-data-table 1.1.32 → 1.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ue=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var ft=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var mt=(l,p)=>{for(var h in p)Ue(l,h,{get:p[h],enumerable:!0})},gt=(l,p,h,C)=>{if(p&&typeof p=="object"||typeof p=="function")for(let w of ft(p))!ht.call(l,w)&&w!==h&&Ue(l,w,{get:()=>p[w],enumerable:!(C=pt(p,w))||C.enumerable});return l};var bt=l=>gt(Ue({},"__esModule",{value:!0}),l);var Ht={};mt(Ht,{VirtualDataTable:()=>st});module.exports=bt(Ht);var u=require("react"),d=require("@mui/material"),at=require("react-virtuoso");var ze=require("react/jsx-runtime"),ve=require("react"),Ae=require("@mui/material"),Ne=function(){return Ne=Object.assign||function(p){for(var h,C=1,w=arguments.length;C<w;C++){h=arguments[C];for(var T in h)Object.prototype.hasOwnProperty.call(h,T)&&(p[T]=h[T])}return p},Ne.apply(this,arguments)};function tt(l){var p=l.visible,h=l.onComplete,C=l.fadeoutDuration,w=C===void 0?200:C,T=l.exitDelay,b=T===void 0?0:T,S=l.size,F=S===void 0?40:S,A=l.className,X=l.style,z=l.sx,K=l.indicator,I=l.background,W=I===void 0?{show:!0,color:"255, 255, 255",opacity:.9}:I,de=(0,ve.useRef)(void 0),f=(0,ve.useRef)(null),q=(0,ve.useState)(p),pe=q[0],Me=q[1],B=W.show,V=B===void 0?!0:B,L=W.color,N=L===void 0?"255, 255, 255":L,oe=W.opacity,ie=oe===void 0?.9:oe;if((0,ve.useEffect)(function(){var le=de.current;if(le===!0&&p===!1&&f.current){var ae=f.current;ae.style.opacity="0",setTimeout(function(){Me(!1),h?.()},w+b)}else p===!0&&(Me(!0),f.current&&(f.current.style.opacity="1"));de.current=p},[p,h,w,b]),!pe)return null;var Ce=function(){return typeof K=="string"?(0,ze.jsx)("img",{src:K,alt:"Loading",style:{width:F,height:F}}):K||(0,ze.jsx)(Ae.CircularProgress,{size:F})},G=function(){return V?N.startsWith("rgba")?{backgroundColor:N}:/^\d+,\s*\d+,\s*\d+$/.test(N)?{backgroundColor:"rgba(".concat(N,", ").concat(ie,")")}:ie!==1?{backgroundColor:N,"&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:N,opacity:ie,zIndex:-1}}:{backgroundColor:N}:{backgroundColor:"transparent"}};return(0,ze.jsx)(Ae.Box,{ref:f,className:A,style:Ne({},X),sx:Ne(Ne({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,opacity:p?1:0,transition:"opacity ".concat(w,"ms ease-out")},G()),z),children:Ce()})}var we=require("react/jsx-runtime"),xt=`
|
|
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 tt({size:l=54}){return(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)("style",{children:gt}),(0,ve.jsx)("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:l,height:l}})]})}var o=require("react"),ne=require("react/jsx-runtime"),bt=["editor","textarea","input","select","textfield","form-control","contenteditable","MuiInputBase-input","MuiSelect-select","MuiOutlinedInput-input","MuiFilledInput-input","MuiInput-input","MuiFormControl-root","MuiTextField-root","MuiSelect-root","MuiOutlinedInput-root","MuiFilledInput-root","MuiInput-root","MuiAutocomplete-input","MuiDatePicker-input","MuiSlider-thumb","MuiSlider-rail","MuiSlider-track","MuiSlider-mark","MuiSlider-markLabel","MuiSlider-root","MuiSlider-colorPrimary","MuiSlider-sizeMedium","MuiIconButton-root","MuiButton-root","MuiButtonBase-root","MuiTouchRipple-root","MuiCheckbox-root","MuiRadio-root","MuiSwitch-root","PrivateSwitchBase-root","ant-input","ant-input-affix-wrapper","ant-input-group-addon","ant-input-number","ant-input-number-handler","ant-select","ant-select-selector","ant-select-selection-search","ant-select-dropdown","ant-cascader","ant-cascader-input","ant-picker","ant-picker-input","ant-time-picker","ant-calendar-picker","ant-slider","ant-slider-track","ant-slider-handle","ant-switch","ant-checkbox","ant-checkbox-wrapper","ant-radio","ant-radio-wrapper","ant-rate","ant-upload","ant-upload-drag","ant-form-item","ant-form-item-control","ant-btn","ant-dropdown","ant-dropdown-trigger","ant-menu","ant-menu-item","ant-tooltip","ant-popover","ant-modal","ant-drawer","ant-tree-select","ant-auto-complete","ant-mentions","ant-transfer","ui-input","ui-textarea","ui-select","ui-select-trigger","ui-select-content","ui-select-item","ui-button","ui-checkbox","ui-radio-group","ui-switch","ui-slider","ui-range-slider","ui-calendar","ui-date-picker","ui-combobox","ui-command","ui-command-input","ui-popover","ui-dialog","ui-sheet","ui-dropdown-menu","ui-context-menu","ui-menubar","ui-navigation-menu","ui-form","ui-form-control","ui-form-item","ui-form-field","ui-label","radix-ui","radix-select","radix-dropdown","radix-dialog","radix-popover","radix-accordion","radix-tabs","radix-slider","radix-switch","radix-checkbox","radix-radio","ql-editor","ql-container","ql-toolbar","ql-picker","ql-picker-label","ql-picker-options","ql-formats","ql-snow","ql-bubble","quill","quilleditor","monaco-editor","monaco-editor-background","view-lines","decorationsOverviewRuler","monaco-scrollable-element","CodeMirror","CodeMirror-code","CodeMirror-lines","CodeMirror-scroll","CodeMirror-sizer","cm-editor","cm-focused","cm-content","tox-editor-container","tox-editor-header","tox-edit-area","tox-tinymce","mce-content-body","ck-editor","ck-content","ck-toolbar","ck-editor__editable","ck-widget","slate-editor","slate-content","DraftEditor-root","DraftEditor-editorContainer","public-DraftEditor-content","ehfuse-editor","ehfuse-editor-wrapper","ehfuse-editor-content","ehfuse-toolbar","ehfuse-toolbar-group","ehfuse-cursor","text-editor","rich-text-editor","wysiwyg","ace_editor","ace_content"],rt=(l,d)=>{let f=l.tagName.toLowerCase(),C=["text","password","email","number","search","tel","url","checkbox","radio"];if(f==="input"){let w=l.type;return C.includes(w)}if(["textarea","select","button"].includes(f)||["svg","path","circle","rect","line","polygon","polyline"].includes(f)||l.getAttribute("contenteditable")==="true")return!0;if(d?.excludeSelectors){for(let w of d.excludeSelectors)if(l.matches(w))return!0}return xt(l,d)},xt=(l,d)=>{let f=[...bt,...d?.excludeClasses||[]],C=l,w=0,T=5;for(;C&&w<=T;){if(f.some(g=>C.classList.contains(g)))return!0;if(C.classList.contains("MuiDialogContent-root"))break;C=C.parentElement,w++}return!1},yt={},vt={},wt={},Mt={},Ct={},Tt=(0,o.forwardRef)(({className:l="",style:d={},containerStyle:f={},contentStyle:C={},children:w,onScroll:T,thumb:g=yt,track:S=vt,arrows:F=wt,dragScroll:W=Mt,autoHide:X=Ct,showScrollbar:z=!0,detectInnerScroll:K=!1},H)=>{let q=(0,o.useRef)({});(0,o.useEffect)(()=>{q.current={children:w,onScroll:T,showScrollbar:z,thumb:g,track:S,arrows:F,dragScroll:W,autoHide:X}});let ce=(0,o.useRef)(null),p=(0,o.useRef)(null),V=(0,o.useRef)(null),ue=(0,o.useRef)(null),we=(0,o.useRef)(null),P=(0,o.useRef)(null),[j,L]=(0,o.useState)(!1),[O,oe]=(0,o.useState)(!1),[ie,Me]=(0,o.useState)(!1),[G,le]=(0,o.useState)({y:0,scrollTop:0}),[ae,me]=(0,o.useState)(0),[Ue,Z]=(0,o.useState)(0),[J,Ce]=(0,o.useState)(!1),[se,De]=(0,o.useState)(!1),[Te,We]=(0,o.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[Ze,Je]=(0,o.useState)(null),[Se,ke]=(0,o.useState)(null),[Qe,Le]=(0,o.useState)(!1),Q=(0,o.useRef)(null),[Ne,qe]=(0,o.useState)(!1),b=(0,o.useRef)(null),h=(0,o.useRef)(null),U=(0,o.useRef)(null),$=(0,o.useMemo)(()=>{let e=g.color??"#606060";return{width:g.width??8,minHeight:g.minHeight??50,radius:g.radius??(g.width??8)/2,color:e,opacity:g.opacity??.6,hoverColor:g.hoverColor??e,hoverOpacity:g.hoverOpacity??1}},[g]),y=(0,o.useMemo)(()=>({width:S.width??16,color:S.color??"rgba(128, 128, 128, 0.1)",visible:S.visible??!0,alignment:S.alignment??"center",radius:S.radius??$.radius??4,margin:S.margin??4}),[S,$.radius]),_=(0,o.useMemo)(()=>{let e=F.color??"#808080";return{visible:F.visible??!1,step:F.step??50,color:e,opacity:F.opacity??.6,hoverColor:F.hoverColor??e,hoverOpacity:F.hoverOpacity??1}},[F]),Re=(0,o.useMemo)(()=>({enabled:W.enabled??!0,excludeClasses:W.excludeClasses??[],excludeSelectors:W.excludeSelectors??[]}),[W]),M=(0,o.useMemo)(()=>({enabled:X.enabled??!0,delay:X.delay??1500,delayOnWheel:X.delayOnWheel??700}),[X]),I=$.width,Fe=y.width,Ee=$.minHeight,ee=_.visible,de=_.step,Y=(0,o.useCallback)(()=>{if(!p.current)return;let e=document.activeElement;e&&p.current.contains(e)&&e!==p.current||p.current.focus()},[]);(0,o.useImperativeHandle)(H,()=>({getScrollContainer:()=>p.current,scrollTo:e=>{p.current&&p.current.scrollTo(e)},get scrollTop(){return p.current?.scrollTop||0},get scrollHeight(){return p.current?.scrollHeight||0},get clientHeight(){return p.current?.clientHeight||0}}),[]);let k=(0,o.useCallback)(()=>{if(P.current){let t=P.current;if(document.contains(t)&&t.scrollHeight>t.clientHeight+2)return t;P.current=null}if(!p.current)return null;if(V.current&&V.current.scrollHeight>p.current.clientHeight+2)return P.current=p.current,p.current;if(!K)return null;let e=p.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let t of e){let n=t;if(n!==p.current&&n.classList.contains("overlay-scrollbar-container"))continue;let i=n.parentElement,a=!1;for(;i&&i!==p.current;){if(i.classList.contains("overlay-scrollbar-container")&&i!==p.current){a=!0;break}i=i.parentElement}if(!a&&n.scrollHeight>n.clientHeight+2)return P.current=n,n}return null},[]),te=(0,o.useCallback)(()=>k()!==null,[k]),R=(0,o.useCallback)(()=>{b.current&&(clearTimeout(b.current),b.current=null)},[]),He=(0,o.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),ge=(0,o.useCallback)(()=>{U.current&&(clearTimeout(U.current),U.current=null)},[]),D=(0,o.useCallback)(e=>{M.enabled&&(R(),b.current=setTimeout(()=>{L(!1),b.current=null},e))},[R,M.enabled]),x=(0,o.useCallback)(()=>{let e=k();if(!e){L(!1),Ce(!1),R();return}if(Ce(!0),!ue.current)return;M.enabled||(L(!0),R());let t=e.clientHeight,n=e.scrollHeight,i=e.scrollTop,a=0;if(ce.current){let E=window.getComputedStyle(ce.current),he=parseFloat(E.paddingTop)||0,Oe=parseFloat(E.paddingBottom)||0;a=he+Oe}let r=ee?I*2+y.margin*4:y.margin*2,m=t-r+a,v=t/n,B=Math.max(m*v,Ee),A=n-t,N=m-B,fe=A>0?i/A*N:0;me(B),Z(fe)},[k,R,ee,I,Ee,M.enabled]),Ve=(0,o.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=k();t&&(oe(!0),le({y:e.clientY,scrollTop:t.scrollTop}),R(),L(!0),Y())},[k,R,Y]),be=(0,o.useCallback)(e=>{if(!O)return;let t=k();if(!t)return;let n=t.clientHeight,i=t.scrollHeight-n,a=e.clientY-G.y,r=n-ae,m=a/r*i,v=Math.max(0,Math.min(i,G.scrollTop+m));t.scrollTop=v,x()},[O,G,ae,x,k]),xe=(0,o.useCallback)(()=>{oe(!1),te()&&D(M.delay)},[te,D,M.delay]),je=(0,o.useCallback)(e=>{if(!ue.current)return;let t=ue.current.getBoundingClientRect(),n=e.clientY-t.top,i=k();if(!i)return;let a=i.clientHeight,r=i.scrollHeight,m=n/a*(r-a);i.scrollTop=Math.max(0,Math.min(r-a,m)),x(),L(!0),D(M.delay),Y()},[x,D,M.delay,k,Y]),_e=(0,o.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!p.current)return;let t=Math.max(0,p.current.scrollTop-de);p.current.scrollTop=t,x(),L(!0),D(M.delay),Y()},[x,D,de,M.delay,Y]),re=(0,o.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!p.current||!V.current)return;let t=p.current,n=V.current.scrollHeight-t.clientHeight,i=Math.min(n,t.scrollTop+de);t.scrollTop=i,x(),L(!0),D(M.delay),Y()},[x,D,de,M.delay,Y]),Ye=(0,o.useCallback)(e=>{if(!Re.enabled)return;let t=e.target;if(rt(t,Re)||e.button!==0)return;let n=k();n&&(n.scrollHeight<=n.clientHeight||(e.preventDefault(),De(!0),We({x:e.clientX,y:e.clientY,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft||0}),R()))},[Re,rt,k,R]),Pe=(0,o.useCallback)(e=>{if(!se)return;let t=k();if(!t)return;let n=Te.x-e.clientX,i=Te.y-e.clientY;if(Math.abs(i)<3&&Math.abs(n)<3)return;L(!0);let a=Math.max(0,Math.min(t.scrollHeight-t.clientHeight,Te.scrollTop+i));t.scrollTop=a,x()},[se,Te,k,x]),Ie=(0,o.useCallback)(()=>{De(!1),te()&&D(M.delay)},[te,D,M.delay]);(0,o.useEffect)(()=>{let e=r=>{x(),R(),L(!0);let m=Ne?M.delayOnWheel:M.delay;D(m),T&&T(r)},t=()=>{qe(!0),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{qe(!1)},300),R(),ge(),U.current=setTimeout(()=>{L(!0),U.current=null},50)},n=[],i=k();i&&n.push(i);let a=p.current;return a&&!i&&(n.push(a),a.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(r=>{let m=r;if(m!==a&&m.classList.contains("overlay-scrollbar-container"))return;let v=m.parentElement;for(;v&&v!==a;){if(v.classList.contains("overlay-scrollbar-container")&&v!==a)return;v=v.parentElement}n.push(m)})),n.forEach(r=>{r.addEventListener("scroll",e,{passive:!0}),r.addEventListener("wheel",t,{passive:!0})}),()=>{n.forEach(r=>{r.removeEventListener("scroll",e),r.removeEventListener("wheel",t)}),Q.current&&clearTimeout(Q.current),U.current&&clearTimeout(U.current)}},[k,x,T,R,D,M,Ne]),(0,o.useEffect)(()=>{let e=n=>{let i=k();if(!i)return;let{key:a}=n,{scrollTop:r,scrollHeight:m,clientHeight:v}=i,B=m-v,A=50,N=null;switch(a){case"ArrowUp":n.preventDefault(),N=Math.max(0,r-A);break;case"ArrowDown":n.preventDefault(),N=Math.min(B,r+A);break;case"PageUp":n.preventDefault(),N=Math.max(0,r-v);break;case"PageDown":n.preventDefault(),N=Math.min(B,r+v);break;case"Home":n.preventDefault(),N=0;break;case"End":n.preventDefault(),N=B;break;default:return}if(N!==null){let fe=N/B,E=ee?I*2+y.margin*4:y.margin*2,he=(v-E-ae)*fe;Z(he),i.scrollTop=N,R(),L(!0),D(M.delay)}},t=p.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[k,ee,I,y.margin,ae,R,D,M.delay]),(0,o.useEffect)(()=>{if(se)return document.addEventListener("mousemove",Pe),document.addEventListener("mouseup",Ie),()=>{document.removeEventListener("mousemove",Pe),document.removeEventListener("mouseup",Ie)}},[se,Pe,Ie]),(0,o.useEffect)(()=>{if(O)return document.addEventListener("mousemove",be),document.addEventListener("mouseup",xe),()=>{document.removeEventListener("mousemove",be),document.removeEventListener("mouseup",xe)}},[O,be,xe]),(0,o.useEffect)(()=>{x();let e=setTimeout(()=>{x()},100);return()=>clearTimeout(e)},[x]),(0,o.useLayoutEffect)(()=>{Le(!0),x(),!M.enabled&&te()&&L(!0)},[te,x,M.enabled]),(0,o.useEffect)(()=>{let e=new ResizeObserver(()=>{x()}),t=[];return p.current&&t.push(p.current),V.current&&t.push(V.current),P.current&&document.contains(P.current)&&t.push(P.current),t.forEach(n=>{e.observe(n)}),()=>e.disconnect()},[x]),(0,o.useEffect)(()=>{if(!p.current)return;let e=new MutationObserver(()=>{P.current=null,x()});return e.observe(p.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>e.disconnect()},[x]);let pe=Math.max(Fe,I);return(0,o.useEffect)(()=>{let e="overlay-scrollbar-webkit-hide",t=document.getElementById(e);t&&t.remove();let n=document.createElement("style");return n.id=e,n.textContent=`
|
|
4
|
+
`;function rt({size:l=54}){return(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)("style",{children:xt}),(0,we.jsx)("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:l,height:l}})]})}var i=require("react"),ne=require("react/jsx-runtime"),yt=["editor","textarea","input","select","textfield","form-control","contenteditable","MuiInputBase-input","MuiSelect-select","MuiOutlinedInput-input","MuiFilledInput-input","MuiInput-input","MuiFormControl-root","MuiTextField-root","MuiSelect-root","MuiOutlinedInput-root","MuiFilledInput-root","MuiInput-root","MuiAutocomplete-input","MuiDatePicker-input","MuiSlider-thumb","MuiSlider-rail","MuiSlider-track","MuiSlider-mark","MuiSlider-markLabel","MuiSlider-root","MuiSlider-colorPrimary","MuiSlider-sizeMedium","MuiIconButton-root","MuiButton-root","MuiButtonBase-root","MuiTouchRipple-root","MuiCheckbox-root","MuiRadio-root","MuiSwitch-root","PrivateSwitchBase-root","ant-input","ant-input-affix-wrapper","ant-input-group-addon","ant-input-number","ant-input-number-handler","ant-select","ant-select-selector","ant-select-selection-search","ant-select-dropdown","ant-cascader","ant-cascader-input","ant-picker","ant-picker-input","ant-time-picker","ant-calendar-picker","ant-slider","ant-slider-track","ant-slider-handle","ant-switch","ant-checkbox","ant-checkbox-wrapper","ant-radio","ant-radio-wrapper","ant-rate","ant-upload","ant-upload-drag","ant-form-item","ant-form-item-control","ant-btn","ant-dropdown","ant-dropdown-trigger","ant-menu","ant-menu-item","ant-tooltip","ant-popover","ant-modal","ant-drawer","ant-tree-select","ant-auto-complete","ant-mentions","ant-transfer","ui-input","ui-textarea","ui-select","ui-select-trigger","ui-select-content","ui-select-item","ui-button","ui-checkbox","ui-radio-group","ui-switch","ui-slider","ui-range-slider","ui-calendar","ui-date-picker","ui-combobox","ui-command","ui-command-input","ui-popover","ui-dialog","ui-sheet","ui-dropdown-menu","ui-context-menu","ui-menubar","ui-navigation-menu","ui-form","ui-form-control","ui-form-item","ui-form-field","ui-label","radix-ui","radix-select","radix-dropdown","radix-dialog","radix-popover","radix-accordion","radix-tabs","radix-slider","radix-switch","radix-checkbox","radix-radio","ql-editor","ql-container","ql-toolbar","ql-picker","ql-picker-label","ql-picker-options","ql-formats","ql-snow","ql-bubble","quill","quilleditor","monaco-editor","monaco-editor-background","view-lines","decorationsOverviewRuler","monaco-scrollable-element","CodeMirror","CodeMirror-code","CodeMirror-lines","CodeMirror-scroll","CodeMirror-sizer","cm-editor","cm-focused","cm-content","tox-editor-container","tox-editor-header","tox-edit-area","tox-tinymce","mce-content-body","ck-editor","ck-content","ck-toolbar","ck-editor__editable","ck-widget","slate-editor","slate-content","DraftEditor-root","DraftEditor-editorContainer","public-DraftEditor-content","ehfuse-editor","ehfuse-editor-wrapper","ehfuse-editor-content","ehfuse-toolbar","ehfuse-toolbar-group","ehfuse-cursor","text-editor","rich-text-editor","wysiwyg","ace_editor","ace_content"],nt=(l,p)=>{let h=l.tagName.toLowerCase(),C=["text","password","email","number","search","tel","url","checkbox","radio"];if(h==="input"){let w=l.type;return C.includes(w)}if(["textarea","select","button"].includes(h)||["svg","path","circle","rect","line","polygon","polyline"].includes(h)||l.getAttribute("contenteditable")==="true")return!0;if(p?.excludeSelectors){for(let w of p.excludeSelectors)if(l.matches(w))return!0}return vt(l,p)},vt=(l,p)=>{let h=[...yt,...p?.excludeClasses||[]],C=l,w=0,T=5;for(;C&&w<=T;){if(h.some(b=>C.classList.contains(b)))return!0;if(C.classList.contains("MuiDialogContent-root"))break;C=C.parentElement,w++}return!1},wt={},Mt={},Ct={},Tt={},St={},kt=(0,i.forwardRef)(({className:l="",style:p={},containerStyle:h={},contentStyle:C={},children:w,onScroll:T,thumb:b=wt,track:S=Mt,arrows:F=Ct,dragScroll:A=Tt,autoHide:X=St,showScrollbar:z=!0,detectInnerScroll:K=!1},I)=>{let W=(0,i.useRef)({});(0,i.useEffect)(()=>{W.current={children:w,onScroll:T,showScrollbar:z,thumb:b,track:S,arrows:F,dragScroll:A,autoHide:X}});let de=(0,i.useRef)(null),f=(0,i.useRef)(null),q=(0,i.useRef)(null),pe=(0,i.useRef)(null),Me=(0,i.useRef)(null),B=(0,i.useRef)(null),[V,L]=(0,i.useState)(!1),[N,oe]=(0,i.useState)(!1),[ie,Ce]=(0,i.useState)(!1),[G,le]=(0,i.useState)({y:0,scrollTop:0}),[ae,se]=(0,i.useState)(0),[Ze,Z]=(0,i.useState)(0),[J,me]=(0,i.useState)(!1),[ce,Ee]=(0,i.useState)(!1),[Te,We]=(0,i.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[Je,Qe]=(0,i.useState)(null),[Se,ke]=(0,i.useState)(null),[et,Le]=(0,i.useState)(!1),Q=(0,i.useRef)(null),[$e,qe]=(0,i.useState)(!1),x=(0,i.useRef)(null),m=(0,i.useRef)(null),U=(0,i.useRef)(null),P=(0,i.useMemo)(()=>{let n=b.color??"#606060";return{width:b.width??8,minHeight:b.minHeight??50,radius:b.radius??(b.width??8)/2,color:n,opacity:b.opacity??.6,hoverColor:b.hoverColor??n,hoverOpacity:b.hoverOpacity??1}},[b]),v=(0,i.useMemo)(()=>({width:S.width??16,color:S.color??"rgba(128, 128, 128, 0.1)",visible:S.visible??!0,alignment:S.alignment??"center",radius:S.radius??P.radius??4,margin:S.margin??4}),[S,P.radius]),_=(0,i.useMemo)(()=>{let n=F.color??"#808080";return{visible:F.visible??!1,step:F.step??50,color:n,opacity:F.opacity??.6,hoverColor:F.hoverColor??n,hoverOpacity:F.hoverOpacity??1}},[F]),Re=(0,i.useMemo)(()=>({enabled:A.enabled??!0,excludeClasses:A.excludeClasses??[],excludeSelectors:A.excludeSelectors??[]}),[A]),M=(0,i.useMemo)(()=>({enabled:X.enabled??!0,delay:X.delay??1500,delayOnWheel:X.delayOnWheel??700}),[X]),O=P.width,Pe=v.width,He=P.minHeight,ee=_.visible,fe=_.step,j=(0,i.useCallback)(()=>{if(!f.current)return;let n=document.activeElement;n&&f.current.contains(n)&&n!==f.current||f.current.focus()},[]);(0,i.useImperativeHandle)(I,()=>({getScrollContainer:()=>f.current,scrollTo:n=>{f.current&&f.current.scrollTo(n)},get scrollTop(){return f.current?.scrollTop||0},get scrollHeight(){return f.current?.scrollHeight||0},get clientHeight(){return f.current?.clientHeight||0}}),[]);let k=(0,i.useCallback)(()=>{if(B.current){let t=B.current;if(document.contains(t)&&t.scrollHeight>t.clientHeight+2)return t;B.current=null}if(!f.current)return null;if(q.current&&q.current.scrollHeight>f.current.clientHeight+2)return B.current=f.current,f.current;if(!K)return null;let n=f.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let t of n){let e=t;if(e!==f.current&&e.classList.contains("overlay-scrollbar-container"))continue;let o=e.parentElement,s=!1;for(;o&&o!==f.current;){if(o.classList.contains("overlay-scrollbar-container")&&o!==f.current){s=!0;break}o=o.parentElement}if(!s&&e.scrollHeight>e.clientHeight+2)return B.current=e,e}return null},[]),te=(0,i.useCallback)(()=>k()!==null,[k]),R=(0,i.useCallback)(()=>{x.current&&(clearTimeout(x.current),x.current=null)},[]),Ie=(0,i.useCallback)(()=>{m.current&&(clearTimeout(m.current),m.current=null)},[]),ge=(0,i.useCallback)(()=>{U.current&&(clearTimeout(U.current),U.current=null)},[]),D=(0,i.useCallback)(n=>{M.enabled&&(R(),x.current=setTimeout(()=>{L(!1),x.current=null},n))},[R,M.enabled]),y=(0,i.useCallback)(()=>{let n=k();if(!n){L(!1),me(!1),R();return}if(me(!0),!pe.current)return;M.enabled||(L(!0),R());let t=n.clientHeight,e=n.scrollHeight,o=n.scrollTop,s=0;if(de.current){let ue=window.getComputedStyle(de.current),H=parseFloat(ue.paddingTop)||0,De=parseFloat(ue.paddingBottom)||0;s=H+De}let a=ee?O*2+v.margin*4:v.margin*2,r=t-a+s,g=t/e,$=Math.max(r*g,He),Y=e-t,E=r-$,ye=Y>0?o/Y*E:0;se($),Z(ye)},[k,R,ee,O,He,M.enabled]),Ve=(0,i.useCallback)(n=>{n.preventDefault(),n.stopPropagation();let t=k();t&&(oe(!0),le({y:n.clientY,scrollTop:t.scrollTop}),R(),L(!0),j())},[k,R,j]),be=(0,i.useCallback)(n=>{if(!N)return;let t=k();if(!t)return;let e=t.clientHeight,o=t.scrollHeight-e,s=n.clientY-G.y,a=e-ae,r=s/a*o,g=Math.max(0,Math.min(o,G.scrollTop+r));t.scrollTop=g,y()},[N,G,ae,y,k]),xe=(0,i.useCallback)(()=>{oe(!1),te()&&D(M.delay)},[te,D,M.delay]),_e=(0,i.useCallback)(n=>{if(!pe.current)return;let t=pe.current.getBoundingClientRect(),e=n.clientY-t.top,o=k();if(!o)return;let s=o.clientHeight,a=o.scrollHeight,r=e/s*(a-s);o.scrollTop=Math.max(0,Math.min(a-s,r)),y(),L(!0),D(M.delay),j()},[y,D,M.delay,k,j]),je=(0,i.useCallback)(n=>{if(n.preventDefault(),n.stopPropagation(),!f.current)return;let t=Math.max(0,f.current.scrollTop-fe);f.current.scrollTop=t,y(),L(!0),D(M.delay),j()},[y,D,fe,M.delay,j]),re=(0,i.useCallback)(n=>{if(n.preventDefault(),n.stopPropagation(),!f.current||!q.current)return;let t=f.current,e=q.current.scrollHeight-t.clientHeight,o=Math.min(e,t.scrollTop+fe);t.scrollTop=o,y(),L(!0),D(M.delay),j()},[y,D,fe,M.delay,j]),Ye=(0,i.useCallback)(n=>{if(!Re.enabled)return;let t=n.target;if(nt(t,Re)||n.button!==0)return;let e=k();e&&(e.scrollHeight<=e.clientHeight||(n.preventDefault(),Ee(!0),We({x:n.clientX,y:n.clientY,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft||0}),R()))},[Re,nt,k,R]),Fe=(0,i.useCallback)(n=>{if(!ce)return;let t=k();if(!t)return;let e=Te.x-n.clientX,o=Te.y-n.clientY;if(Math.abs(o)<3&&Math.abs(e)<3)return;L(!0);let s=Math.max(0,Math.min(t.scrollHeight-t.clientHeight,Te.scrollTop+o));t.scrollTop=s,y()},[ce,Te,k,y]),Oe=(0,i.useCallback)(()=>{Ee(!1),te()&&D(M.delay)},[te,D,M.delay]);(0,i.useEffect)(()=>{let n=a=>{y(),R(),L(!0);let r=$e?M.delayOnWheel:M.delay;D(r),T&&T(a)},t=()=>{qe(!0),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{qe(!1)},300),R(),ge(),U.current=setTimeout(()=>{L(!0),U.current=null},50)},e=[],o=k();o&&e.push(o);let s=f.current;return s&&!o&&(e.push(s),s.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(a=>{let r=a;if(r!==s&&r.classList.contains("overlay-scrollbar-container"))return;let g=r.parentElement;for(;g&&g!==s;){if(g.classList.contains("overlay-scrollbar-container")&&g!==s)return;g=g.parentElement}e.push(r)})),e.forEach(a=>{a.addEventListener("scroll",n,{passive:!0}),a.addEventListener("wheel",t,{passive:!0})}),()=>{e.forEach(a=>{a.removeEventListener("scroll",n),a.removeEventListener("wheel",t)}),Q.current&&clearTimeout(Q.current),U.current&&clearTimeout(U.current)}},[k,y,T,R,D,M,$e]),(0,i.useEffect)(()=>{let n=e=>{let o=k();if(!o)return;let{key:s}=e,{scrollTop:a,scrollHeight:r,clientHeight:g}=o,$=r-g,Y=50,E=null;switch(s){case"ArrowUp":e.preventDefault(),E=Math.max(0,a-Y);break;case"ArrowDown":e.preventDefault(),E=Math.min($,a+Y);break;case"PageUp":e.preventDefault(),E=Math.max(0,a-g);break;case"PageDown":e.preventDefault(),E=Math.min($,a+g);break;case"Home":e.preventDefault(),E=0;break;case"End":e.preventDefault(),E=$;break;default:return}if(E!==null){let ye=E/$,ue=ee?O*2+v.margin*4:v.margin*2,H=(g-ue-ae)*ye;Z(H),o.scrollTop=E,R(),L(!0),D(M.delay)}},t=f.current;if(t)return t.addEventListener("keydown",n),()=>{t.removeEventListener("keydown",n)}},[k,ee,O,v.margin,ae,R,D,M.delay]),(0,i.useEffect)(()=>{if(ce)return document.addEventListener("mousemove",Fe),document.addEventListener("mouseup",Oe),()=>{document.removeEventListener("mousemove",Fe),document.removeEventListener("mouseup",Oe)}},[ce,Fe,Oe]),(0,i.useEffect)(()=>{if(N)return document.addEventListener("mousemove",be),document.addEventListener("mouseup",xe),()=>{document.removeEventListener("mousemove",be),document.removeEventListener("mouseup",xe)}},[N,be,xe]),(0,i.useEffect)(()=>{y();let n=setTimeout(()=>{y()},100);return()=>clearTimeout(n)},[y]),(0,i.useLayoutEffect)(()=>{Le(!0),y(),!M.enabled&&te()&&L(!0)},[te,y,M.enabled]),(0,i.useEffect)(()=>{let n=new ResizeObserver(()=>{y()}),t=[];return f.current&&t.push(f.current),q.current&&t.push(q.current),B.current&&document.contains(B.current)&&t.push(B.current),t.forEach(e=>{n.observe(e)}),()=>n.disconnect()},[y]),(0,i.useEffect)(()=>{if(!f.current)return;let n=new MutationObserver(()=>{B.current=null,y()});return n.observe(f.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>n.disconnect()},[y]);let he=Math.max(Pe,O);return(0,i.useEffect)(()=>{let n="overlay-scrollbar-webkit-hide",t=document.getElementById(n);t&&t.remove();let e=document.createElement("style");return e.id=n,e.textContent=`
|
|
5
5
|
.overlay-scrollbar-container::-webkit-scrollbar {
|
|
6
6
|
display: none !important;
|
|
7
7
|
width: 0 !important;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
outline: 2px solid rgba(0, 123, 255, 0.5);
|
|
22
22
|
outline-offset: -2px;
|
|
23
23
|
}
|
|
24
|
-
`,document.head.appendChild(n),()=>{let i=document.getElementById(e);i&&i.remove()}},[]),(0,ne.jsxs)("div",{ref:ce,className:`overlay-scrollbar-wrapper ${l}`,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",...d},children:[(0,ne.jsx)("div",{ref:p,className:"overlay-scrollbar-container",tabIndex:-1,onMouseDown:Ye,style:{display:"flex",width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",scrollbarWidth:"none",msOverflowStyle:"none",outline:"none",userSelect:se?"none":"auto",...f},children:(0,ne.jsx)("div",{ref:V,className:"overlay-scrollbar-content",style:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",...C},children:w})}),z&&J&&(0,ne.jsxs)("div",{ref:ue,className:"overlay-scrollbar-track",onMouseEnter:()=>{R(),h.current=setTimeout(()=>{L(!0),h.current=null},100)},onMouseLeave:()=>{He(),O||D(M.delay)},style:{position:"absolute",top:0,right:0,width:`${pe}px`,height:"100%",opacity:j?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[y.visible&&(0,ne.jsx)("div",{className:"overlay-scrollbar-track-background",onClick:e=>{e.preventDefault(),e.stopPropagation(),je(e)},style:{position:"absolute",top:ee?`${$.width+y.margin*2}px`:`${y.margin}px`,right:y.alignment==="right"?"0px":`${(pe-$.width)/2}px`,width:`${$.width}px`,height:ee?`calc(100% - ${$.width*2+y.margin*4}px)`:`calc(100% - ${y.margin*2}px)`,backgroundColor:y.color,borderRadius:`${y.radius}px`,cursor:"pointer"}}),(0,ne.jsx)("div",{ref:we,className:"overlay-scrollbar-thumb",onMouseDown:Ve,onMouseEnter:()=>Me(!0),onMouseLeave:()=>Me(!1),style:{position:"absolute",top:`${(ee?I+y.margin*2:y.margin)+Ue}px`,right:y.alignment==="right"?"0px":`${(pe-I)/2}px`,width:`${I}px`,height:`${Math.max(ae,Ee)}px`,backgroundColor:ie||O?$.hoverColor:$.color,opacity:ie||O?$.hoverOpacity:$.opacity,borderRadius:`${$.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),z&&J&&ee&&(0,ne.jsx)("div",{className:"overlay-scrollbar-up-arrow",onClick:_e,onMouseEnter:()=>ke("up"),onMouseLeave:()=>ke(null),style:{position:"absolute",top:`${y.margin}px`,right:y.alignment==="right"?"0px":`${(pe-I)/2}px`,width:`${I}px`,height:`${I}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(I*.75,8)}px`,color:Se==="up"?_.hoverColor:_.color,userSelect:"none",zIndex:1001,opacity:j?Se==="up"?_.hoverOpacity:_.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),z&&J&&ee&&(0,ne.jsx)("div",{className:"overlay-scrollbar-down-arrow",onClick:re,onMouseEnter:()=>ke("down"),onMouseLeave:()=>ke(null),style:{position:"absolute",bottom:`${y.margin}px`,right:y.alignment==="right"?"0px":`${(pe-I)/2}px`,width:`${I}px`,height:`${I}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(I*.75,8)}px`,color:Se==="down"?_.hoverColor:_.color,userSelect:"none",zIndex:1001,opacity:j?Se==="down"?_.hoverOpacity:_.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"})]})}),nt=Tt;var s=require("react/jsx-runtime"),St={alignment:"right",margin:0,radius:0},ot=5,kt={bg:"#ffffff",border:"#e6e6e3",borderStrong:"#dedddb",headerColor:"#787774",hoverBg:"#f8f8f7"},Lt={bg:"#1e1e1e",border:"#2c333c",borderStrong:"#3b434e",headerColor:"#a3adbb",hoverBg:"#272d36"};function Rt({data:l,loading:d=!1,columns:f,onRowClick:C,getRowId:w,selectedRowId:T,selectedRowSx:g,rowHeight:S=50,columnHeight:F,striped:W,rowDivider:X=!0,onSort:z,onLoadMore:K,sortBy:H,sortDirection:q,showPaper:ce=!0,paddingX:p,paddingTop:V=0,paddingBottom:ue=0,rowHoverColor:we,rowHoverOpacity:P,viewportBuffer:j,overscan:L,scrollbars:O,emptyMessage:oe="NO DATA",LoadingComponent:ie,showFooter:Me,footerHeight:G,footerSx:le,variant:ae="default"}){let me=ae==="notion",Z=(0,u.useTheme)().palette.mode==="dark"?Lt:kt,J=F??(me?40:56),Ce=p??(me?"12px":"1rem"),se=we??(me?Z.hoverBg:void 0),De=P??(me?1:void 0),Te=Math.max(S*12,480),We=Math.max(S*12,480),Ze=typeof j=="number"?j:j?.top??Te,Je=typeof j=="number"?j:j?.bottom??We,Se=Math.max(S*8,420),ke=Math.max(S*10,520),Qe=typeof L=="number"?L:{main:L?.main??Se,reverse:L?.reverse??ke},Le=S+(X?1:0),Q=!g||typeof g!="function",Ne=(0,c.useMemo)(()=>!Q||T===null||T===void 0||!g?null:{[`& tbody tr[data-row-id="${String(T).replace(/["\\]/g,"\\$&")}"]`]:g},[Q,T,g]),qe=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),[b]=(0,c.useState)(()=>typeof window>"u"?!1:window.localStorage.getItem("vdt-perf-debug")==="1"),h=(0,c.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}),U=(0,c.useCallback)(e=>{if(!b)return;let t=h.current;if(!(t.wheelEvents>0||t.rangeChangedCalls>0||t.rowContentCalls>0||t.cellRenderCalls>0))return;let i=t.rowContentCalls>0?t.rowContentMs/t.rowContentCalls:0,a=t.cellRenderCalls>0?t.cellRenderMs/t.cellRenderCalls:0;console.log("[VDT perf]",{reason:e,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(i.toFixed(3)),maxMs:Number(t.rowContentMaxMs.toFixed(3))},cellRender:{calls:t.cellRenderCalls,totalMs:Number(t.cellRenderMs.toFixed(2)),avgMs:Number(a.toFixed(3)),maxMs:Number(t.cellRenderMaxMs.toFixed(3))}}),h.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}},[b]);(0,c.useEffect)(()=>{if(!b||typeof window>"u")return;console.log("[VDT perf] enabled (localStorage vdt-perf-debug=1)");let e=window.setInterval(()=>{U("interval")},1500);return()=>{window.clearInterval(e),U("cleanup")}},[U,b]);let $=(0,c.useMemo)(()=>(0,c.forwardRef)((e,t)=>{let n=(0,c.useRef)(null),i=(0,c.useRef)(0),a=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let r=n.current;if(!r)return;let m=v=>{let B=b?performance.now():0;v.preventDefault();let A=v.deltaY;v.deltaMode===1?A*=40:v.deltaMode===2&&(A*=r.clientHeight),b&&(h.current.wheelEvents+=1,h.current.wheelInputPx+=A),i.current+=A,a.current===null&&(a.current=requestAnimationFrame(()=>{let N=b?performance.now():0,fe=Math.max(r.clientHeight*.4,160),E=Math.max(-fe,Math.min(fe,i.current));i.current=0,a.current=null,E!==0&&(r.scrollTop+=E),b&&(h.current.wheelRafFlushes+=1,h.current.wheelRafMs+=performance.now()-N)}),b&&(h.current.wheelHandlerMs+=performance.now()-B))};return r.addEventListener("wheel",m,{passive:!1}),()=>{r.removeEventListener("wheel",m),a.current!==null&&(cancelAnimationFrame(a.current),a.current=null),i.current=0}},[]),(0,s.jsx)(nt,{detectInnerScroll:!0,track:St,...O,children:(0,s.jsx)(u.TableContainer,{component:u.Box,...e,ref:r=>{n.current=r,typeof t=="function"?t(r):t&&(t.current=r)},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:Ce,paddingTop:V,paddingBottom:ue}}})})}),[]),y=(0,c.useMemo)(()=>{if(W===!0)return"#f5f5f5";if(typeof W=="string")return W},[W]),[_,Re]=(0,c.useState)(d),[M,I]=(0,c.useState)(0);(0,c.useEffect)(()=>{d&&Re(!0)},[d]);let Fe=(0,c.useCallback)(()=>{Re(!1)},[]),Ee=_,ee=d&&l.length>0,de=(0,c.useRef)(!1),Y=(0,c.useRef)(-1),k=(0,c.useRef)(null),te=(0,c.useRef)(C);te.current=C;let R=(0,c.useRef)(w);R.current=w;let He=!!C,ge=(0,c.useRef)(!1),D=(0,c.useRef)({x:0,y:0});(0,c.useEffect)(()=>{let e=t=>{let n=t.clientX-D.current.x,i=t.clientY-D.current.y;Math.sqrt(n*n+i*i)>ot&&(ge.current=!0)};return document.addEventListener("mousemove",e),()=>{document.removeEventListener("mousemove",e)}},[]),(0,c.useEffect)(()=>{let e=document.querySelector('[data-testid="virtuoso-scroller"]');e&&e.querySelectorAll(".MuiTableSortLabel-root").forEach(n=>{let i=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});n.dispatchEvent(i)})},[H]);let x=(0,c.useCallback)(e=>{if(!z)return;z(e,H===e&&q==="asc"?"desc":"asc")},[z,H,q]),Ve=(0,c.useCallback)(e=>{let t=b?performance.now():0;if(!K){b&&(h.current.rangeChangedCalls+=1,h.current.rangeChangedMs+=performance.now()-t);return}if(d&&l.length===0){b&&(h.current.rangeChangedCalls+=1,h.current.rangeChangedMs+=performance.now()-t);return}let n=l.length>=30,i=e>=l.length-1,a=Y.current===l.length;if(i&&n&&!de.current&&!a){de.current=!0,Y.current=l.length;let r=l.length;K(r,50)}b&&(h.current.rangeChangedCalls+=1,h.current.rangeChangedMs+=performance.now()-t)},[l.length,d,K,b]);(0,c.useEffect)(()=>{d||(de.current=!1)},[d]),(0,c.useEffect)(()=>{l.length===0&&I(e=>e+1)},[l.length]);let be=(0,c.useRef)(l.length),xe=(0,c.useRef)(void 0);(0,c.useEffect)(()=>{let e=be.current,t=l.length,n=t>0?R.current?R.current(l[0],0):l[0]:void 0,i=xe.current;if(t>e&&e>0){be.current=t,xe.current=n;return}let a=t<e||e>0&&n!==i;a&&(Y.current=-1),k.current&&t>0&&a&&k.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),be.current=t,xe.current=n},[l]);let je=(0,c.useCallback)(()=>{let e={},t=[];if(f.forEach(r=>{r.group?(e[r.group]||(e[r.group]=[]),e[r.group].push(r)):t.push(r)}),!(Object.keys(e).length>0))return(0,s.jsx)(u.TableRow,{children:f.map(r=>(0,s.jsx)(u.TableCell,{align:r.align||"left",style:{width:r.width,minWidth:r.width,...r.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:r.sortable?(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:r.align==="center"?"center":r.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,s.jsxs)(u.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>x(String(r.id)),children:[r.text,(0,s.jsx)(u.TableSortLabel,{active:H===r.id,direction:H===r.id?q:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:H===r.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)"}}})]})}):r.text},String(r.id)))});let i=[...t.map(r=>(0,s.jsx)(u.TableCell,{rowSpan:2,align:r.align||"left",style:{width:r.width,minWidth:r.width,...r.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:r.sortable&&z?(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:r.align==="center"?"center":r.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,s.jsxs)(u.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>x(String(r.id)),children:[r.text,(0,s.jsx)(u.TableSortLabel,{active:H===r.id,direction:H===r.id?q:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:H===r.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)"}}})]})}):r.text},String(r.id))),...Object.entries(e).map(([r,m])=>(0,s.jsx)(u.TableCell,{align:"center",colSpan:m.length,style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:r},r))],a=[...Object.values(e).flat().map(r=>(0,s.jsx)(u.TableCell,{align:r.align||"left",style:{width:r.width,minWidth:r.width,...r.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:r.sortable&&z?(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:r.align==="center"?"center":r.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,s.jsxs)(u.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>x(String(r.id)),children:[r.text,(0,s.jsx)(u.TableSortLabel,{active:H===r.id,direction:H===r.id?q:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:H===r.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)"}}})]})}):r.text},String(r.id)))];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.TableRow,{children:i}),(0,s.jsx)(u.TableRow,{children:a})]})},[f,H,q,x,z,J]),_e=(0,c.useCallback)((e,t)=>{let n=b?performance.now():0;if(!t){if(b){h.current.rowContentCalls+=1;let a=performance.now()-n;h.current.rowContentMs+=a,h.current.rowContentMaxMs=Math.max(h.current.rowContentMaxMs,a)}return null}let i=f.map(a=>{let r=b?performance.now():0,m=a.render?a.render(t,e):String(t[a.id]||"");if(b){let v=performance.now()-r;h.current.cellRenderCalls+=1,h.current.cellRenderMs+=v,h.current.cellRenderMaxMs=Math.max(h.current.cellRenderMaxMs,v)}return(0,s.jsx)(u.TableCell,{align:a.align||"left",style:{width:a.width,minWidth:a.width,...a.style,padding:"8px 16px"},children:m},String(a.id))});if(b){h.current.rowContentCalls+=1;let a=performance.now()-n;h.current.rowContentMs+=a,h.current.rowContentMaxMs=Math.max(h.current.rowContentMaxMs,a)}return(0,s.jsx)(s.Fragment,{children:i})},[f,b]),re=Me??f.some(e=>typeof e.footer=="function"),Ye=(0,c.useCallback)(()=>{if(!re)return null;let e=[];for(let t=0;t<f.length;t+=1){let n=f[t],i=n.footerColSpan&&n.footerColSpan>1?Math.min(n.footerColSpan,f.length-t):1;e.push((0,s.jsx)(u.TableCell,{align:n.align||"left",colSpan:i>1?i:void 0,style:{...i>1?{}:{width:n.width,minWidth:n.width},...n.style,fontWeight:"bold",padding:"16px"},children:n.footer?n.footer(l):null},String(n.id))),t+=i-1}return(0,s.jsx)(u.TableRow,{children:e})},[re,f,l]),Ie=(0,c.useMemo)(()=>({Scroller:$,Table:e=>(0,s.jsx)(u.Table,{...e,sx:{borderCollapse:"separate",tableLayout:"fixed",marginRight:"16px",...re?{height:"100%"}:{}}}),TableHead:(0,c.forwardRef)((e,t)=>(0,s.jsx)(u.TableHead,{...e,ref:t,sx:{userSelect:"none","& tr":{height:J,"& th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:e=>{let{item:t,selected:n,"aria-selected":i,className:a,...r}=e,m=r["data-index"]??0,v=m%2===1,B=t&&R.current?R.current(t,m):m,A=!Q&&T!==null&&T!==void 0&&B===T,N=A&&g?typeof g=="function"?g(t,m):g:void 0,fe=String(a??"").split(/\s+/).filter(E=>E!=="Mui-selected"&&E!=="Mui-focusVisible").join(" ");return(0,s.jsx)(u.TableRow,{...r,"data-row-id":B!=null?String(B):void 0,className:fe||void 0,selected:A,onMouseDown:E=>{ge.current=!1,D.current={x:E.clientX,y:E.clientY}},onClick:E=>{let he=E.clientX-D.current.x,Oe=E.clientY-D.current.y;if(Math.sqrt(he*he+Oe*Oe)>ot||ge.current){E.preventDefault(),E.stopPropagation(),ge.current=!1;return}t&&te.current&&te.current(t,m),ge.current=!1},sx:[{userSelect:"none",height:Le,maxHeight:Le,boxSizing:"border-box",backgroundColor:v&&y?y:"transparent","& td":{padding:"8px 16px",boxSizing:"border-box",borderBottom:X?"1px solid rgba(224, 224, 224, 1)":"none"},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":He&&!A?{backgroundColor:E=>{let he=E.palette.mode==="dark",Xe=se??"#000000",Ke=De??.06;if(!se)return he?`rgba(255, 255, 255, ${Ke})`:`rgba(0, 0, 0, ${Ke})`;let Be=Xe.replace("#","").trim();if(Be.length!==6)return Xe;let at=parseInt(Be.substring(0,2),16),st=parseInt(Be.substring(2,4),16),ct=parseInt(Be.substring(4,6),16);return`rgba(${at}, ${st}, ${ct}, ${Ke})`}}:void 0,cursor:He?"pointer":void 0},N]})},TableBody:(0,c.forwardRef)((e,t)=>{let{children:n,...i}=e;return(0,s.jsxs)(u.TableBody,{...i,ref:t,sx:re?{height:"100%"}:void 0,children:[n,re&&(0,s.jsx)("tr",{"aria-hidden":!0,style:{height:"100%"},children:(0,s.jsx)("td",{colSpan:f.length,style:{padding:0,border:0}})})]})}),TableFoot:(0,c.forwardRef)((e,t)=>(0,s.jsx)(u.TableFooter,{...e,ref:t,sx:[{"& tr":{height:G??S,maxHeight:G??S,boxSizing:"border-box"},"& td":{height:G??S,boxSizing:"border-box",backgroundColor:n=>n.palette.mode==="dark"?"#1e1e1e":"#ffffff",padding:"0 16px",color:"inherit",fontSize:"0.875rem",border:"none",boxShadow:"inset 0 1px 0 0 #000000"}},...Array.isArray(le)?le:le?[le]:[]]}))}),[He,Q?null:T,g,S,y,X,J,se,De,$,G,le,re,f]),pe=(0,s.jsxs)(u.Box,{sx:{position:"relative",height:"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:e=>e.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"},...Ne??{},...me?{"& thead tr th":{height:J,boxSizing:"border-box",padding:"0 14px !important",fontSize:13,fontWeight:"500 !important",color:Z.headerColor,backgroundColor:`${Z.bg} !important`,borderTop:`1px solid ${Z.borderStrong}`,borderBottom:`1px solid ${Z.borderStrong}`,borderRight:`1px solid ${Z.border}`,"&:last-of-type":{borderRight:"none"}},"& tbody tr td":{padding:"0 14px !important",fontSize:14,borderBottom:`1px solid ${Z.border}`}}:{}},children:[(0,s.jsx)(it.TableVirtuoso,{ref:k,data:l,totalCount:K?l.length+1:l.length,defaultItemHeight:Le,fixedItemHeight:Le,fixedHeaderContent:je,fixedFooterContent:re?Ye:void 0,itemContent:_e,endReached:Ve,style:{height:"100%"},increaseViewportBy:{top:Ze,bottom:Je},overscan:Qe,followOutput:!1,components:Ie},M),l.length===0&&!d&&(0,s.jsx)(u.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2},children:typeof oe=="string"?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.Box,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),(0,s.jsx)(u.Typography,{variant:"body1",sx:{color:"text.secondary"},children:oe})]}):oe}),Ee&&(0,s.jsx)(s.Fragment,{children:ie?(0,s.jsx)(ie,{visible:d,onComplete:Fe}):(0,s.jsx)(et,{visible:d,onComplete:Fe,size:40,indicator:(0,s.jsx)(tt,{}),sx:{top:`${f.some(e=>e.group)?J*2:J}px`,bottom:`${re?G??S:0}px`},background:{show:l.length===0,opacity:.8}})})]});return ce?(0,s.jsx)(u.Paper,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:Ce,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:pe}):(0,s.jsx)(u.Box,{className:"grow",style:{padding:0,paddingLeft:Ce,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:pe})}var lt=(0,c.memo)(Rt);
|
|
24
|
+
`,document.head.appendChild(e),()=>{let o=document.getElementById(n);o&&o.remove()}},[]),(0,ne.jsxs)("div",{ref:de,className:`overlay-scrollbar-wrapper ${l}`,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",...p},children:[(0,ne.jsx)("div",{ref:f,className:"overlay-scrollbar-container",tabIndex:-1,onMouseDown:Ye,style:{display:"flex",width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",scrollbarWidth:"none",msOverflowStyle:"none",outline:"none",userSelect:ce?"none":"auto",...h},children:(0,ne.jsx)("div",{ref:q,className:"overlay-scrollbar-content",style:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",...C},children:w})}),z&&J&&(0,ne.jsxs)("div",{ref:pe,className:"overlay-scrollbar-track",onMouseEnter:()=>{R(),m.current=setTimeout(()=>{L(!0),m.current=null},100)},onMouseLeave:()=>{Ie(),N||D(M.delay)},style:{position:"absolute",top:0,right:0,width:`${he}px`,height:"100%",opacity:V?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[v.visible&&(0,ne.jsx)("div",{className:"overlay-scrollbar-track-background",onClick:n=>{n.preventDefault(),n.stopPropagation(),_e(n)},style:{position:"absolute",top:ee?`${P.width+v.margin*2}px`:`${v.margin}px`,right:v.alignment==="right"?"0px":`${(he-P.width)/2}px`,width:`${P.width}px`,height:ee?`calc(100% - ${P.width*2+v.margin*4}px)`:`calc(100% - ${v.margin*2}px)`,backgroundColor:v.color,borderRadius:`${v.radius}px`,cursor:"pointer"}}),(0,ne.jsx)("div",{ref:Me,className:"overlay-scrollbar-thumb",onMouseDown:Ve,onMouseEnter:()=>Ce(!0),onMouseLeave:()=>Ce(!1),style:{position:"absolute",top:`${(ee?O+v.margin*2:v.margin)+Ze}px`,right:v.alignment==="right"?"0px":`${(he-O)/2}px`,width:`${O}px`,height:`${Math.max(ae,He)}px`,backgroundColor:ie||N?P.hoverColor:P.color,opacity:ie||N?P.hoverOpacity:P.opacity,borderRadius:`${P.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),z&&J&&ee&&(0,ne.jsx)("div",{className:"overlay-scrollbar-up-arrow",onClick:je,onMouseEnter:()=>ke("up"),onMouseLeave:()=>ke(null),style:{position:"absolute",top:`${v.margin}px`,right:v.alignment==="right"?"0px":`${(he-O)/2}px`,width:`${O}px`,height:`${O}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(O*.75,8)}px`,color:Se==="up"?_.hoverColor:_.color,userSelect:"none",zIndex:1001,opacity:V?Se==="up"?_.hoverOpacity:_.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),z&&J&&ee&&(0,ne.jsx)("div",{className:"overlay-scrollbar-down-arrow",onClick:re,onMouseEnter:()=>ke("down"),onMouseLeave:()=>ke(null),style:{position:"absolute",bottom:`${v.margin}px`,right:v.alignment==="right"?"0px":`${(he-O)/2}px`,width:`${O}px`,height:`${O}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(O*.75,8)}px`,color:Se==="down"?_.hoverColor:_.color,userSelect:"none",zIndex:1001,opacity:V?Se==="down"?_.hoverOpacity:_.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"})]})}),ot=kt;var c=require("react/jsx-runtime"),Lt={alignment:"right",margin:0,radius:0},it=5,Rt={bg:"#ffffff",border:"#e6e6e3",borderStrong:"#dedddb",headerColor:"#787774",hoverBg:"#f8f8f7"},lt="12px",Dt={bg:"#1e1e1e",border:"#2c333c",borderStrong:"#3b434e",headerColor:"#a3adbb",hoverBg:"#272d36"};function Et({data:l,loading:p=!1,columns:h,onRowClick:C,getRowId:w,selectedRowId:T,selectedRowSx:b,rowHeight:S=50,columnHeight:F,striped:A,rowDivider:X=!0,onSort:z,onLoadMore:K,sortBy:I,sortDirection:W,showPaper:de=!0,paddingX:f,paddingTop:q=0,paddingBottom:pe=0,rowHoverColor:Me,rowHoverOpacity:B,viewportBuffer:V,overscan:L,scrollbars:N,emptyMessage:oe="NO DATA",LoadingComponent:ie,showFooter:Ce,footerHeight:G,footerSx:le,variant:ae="default"}){let se=ae==="notion",Z=(0,d.useTheme)().palette.mode==="dark"?Dt:Rt,J=F??(se?40:56),me=f??(se?"12px":"1rem"),ce=Me??(se?Z.hoverBg:void 0),Ee=B??(se?1:void 0),Te=Math.max(S*12,480),We=Math.max(S*12,480),Je=typeof V=="number"?V:V?.top??Te,Qe=typeof V=="number"?V:V?.bottom??We,Se=Math.max(S*8,420),ke=Math.max(S*10,520),et=typeof L=="number"?L:{main:L?.main??Se,reverse:L?.reverse??ke},Le=S+(X?1:0),Q=!b||typeof b!="function",$e=(0,u.useMemo)(()=>!Q||T===null||T===void 0||!b?null:{[`& tbody tr[data-row-id="${String(T).replace(/["\\]/g,"\\$&")}"]`]:b},[Q,T,b]),qe=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),[x]=(0,u.useState)(()=>typeof window>"u"?!1:window.localStorage.getItem("vdt-perf-debug")==="1"),m=(0,u.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}),U=(0,u.useCallback)(t=>{if(!x)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,a=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(a.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}},[x]);(0,u.useEffect)(()=>{if(!x||typeof window>"u")return;console.log("[VDT perf] enabled (localStorage vdt-perf-debug=1)");let t=window.setInterval(()=>{U("interval")},1500);return()=>{window.clearInterval(t),U("cleanup")}},[U,x]);let P=(0,u.useMemo)(()=>(0,u.forwardRef)((t,e)=>{let o=(0,u.useRef)(null),s=(0,u.useRef)(0),a=(0,u.useRef)(null);return(0,u.useEffect)(()=>{let r=o.current;if(!r)return;let g=$=>{let Y=x?performance.now():0;$.preventDefault();let E=$.deltaY;$.deltaMode===1?E*=40:$.deltaMode===2&&(E*=r.clientHeight),x&&(m.current.wheelEvents+=1,m.current.wheelInputPx+=E),s.current+=E,a.current===null&&(a.current=requestAnimationFrame(()=>{let ye=x?performance.now():0,ue=Math.max(r.clientHeight*.4,160),H=Math.max(-ue,Math.min(ue,s.current));s.current=0,a.current=null,H!==0&&(r.scrollTop+=H),x&&(m.current.wheelRafFlushes+=1,m.current.wheelRafMs+=performance.now()-ye)}),x&&(m.current.wheelHandlerMs+=performance.now()-Y))};return r.addEventListener("wheel",g,{passive:!1}),()=>{r.removeEventListener("wheel",g),a.current!==null&&(cancelAnimationFrame(a.current),a.current=null),s.current=0}},[]),(0,c.jsx)(ot,{detectInnerScroll:!0,track:Lt,...N,children:(0,c.jsx)(d.TableContainer,{component:d.Box,...t,ref:r=>{o.current=r,typeof e=="function"?e(r):e&&(e.current=r)},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:se?0:me,paddingTop:q,paddingBottom:pe}}})})}),[]),v=(0,u.useMemo)(()=>{if(A===!0)return"#f5f5f5";if(typeof A=="string")return A},[A]),[_,Re]=(0,u.useState)(p),[M,O]=(0,u.useState)(0);(0,u.useEffect)(()=>{p&&Re(!0)},[p]);let Pe=(0,u.useCallback)(()=>{Re(!1)},[]),He=_,ee=p&&l.length>0,fe=(0,u.useRef)(!1),j=(0,u.useRef)(-1),k=(0,u.useRef)(null),te=(0,u.useRef)(C);te.current=C;let R=(0,u.useRef)(w);R.current=w;let Ie=!!C,ge=(0,u.useRef)(!1),D=(0,u.useRef)({x:0,y:0});(0,u.useEffect)(()=>{let t=e=>{let o=e.clientX-D.current.x,s=e.clientY-D.current.y;Math.sqrt(o*o+s*s)>it&&(ge.current=!0)};return document.addEventListener("mousemove",t),()=>{document.removeEventListener("mousemove",t)}},[]),(0,u.useEffect)(()=>{let t=document.querySelector('[data-testid="virtuoso-scroller"]');t&&t.querySelectorAll(".MuiTableSortLabel-root").forEach(o=>{let s=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});o.dispatchEvent(s)})},[I]);let y=(0,u.useCallback)(t=>{if(!z)return;z(t,I===t&&W==="asc"?"desc":"asc")},[z,I,W]),Ve=(0,u.useCallback)(t=>{let e=x?performance.now():0;if(!K){x&&(m.current.rangeChangedCalls+=1,m.current.rangeChangedMs+=performance.now()-e);return}if(p&&l.length===0){x&&(m.current.rangeChangedCalls+=1,m.current.rangeChangedMs+=performance.now()-e);return}let o=l.length>=30,s=t>=l.length-1,a=j.current===l.length;if(s&&o&&!fe.current&&!a){fe.current=!0,j.current=l.length;let r=l.length;K(r,50)}x&&(m.current.rangeChangedCalls+=1,m.current.rangeChangedMs+=performance.now()-e)},[l.length,p,K,x]);(0,u.useEffect)(()=>{p||(fe.current=!1)},[p]),(0,u.useEffect)(()=>{l.length===0&&O(t=>t+1)},[l.length]);let be=(0,u.useRef)(l.length),xe=(0,u.useRef)(void 0);(0,u.useEffect)(()=>{let t=be.current,e=l.length,o=e>0?R.current?R.current(l[0],0):l[0]:void 0,s=xe.current;if(e>t&&t>0){be.current=e,xe.current=o;return}let a=e<t||t>0&&o!==s;a&&(j.current=-1),k.current&&e>0&&a&&k.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),be.current=e,xe.current=o},[l]);let _e=(0,u.useCallback)(()=>{let t={},e=[];if(h.forEach(r=>{r.group?(t[r.group]||(t[r.group]=[]),t[r.group].push(r)):e.push(r)}),!(Object.keys(t).length>0))return(0,c.jsx)(d.TableRow,{children:h.map(r=>(0,c.jsx)(d.TableCell,{align:r.align||"left",style:{width:r.width,minWidth:r.width,...r.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:r.sortable?(0,c.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:r.align==="center"?"center":r.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,c.jsxs)(d.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>y(String(r.id)),children:[r.text,(0,c.jsx)(d.TableSortLabel,{active:I===r.id,direction:I===r.id?W:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:I===r.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)"}}})]})}):r.text},String(r.id)))});let s=[...e.map(r=>(0,c.jsx)(d.TableCell,{rowSpan:2,align:r.align||"left",style:{width:r.width,minWidth:r.width,...r.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:r.sortable&&z?(0,c.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:r.align==="center"?"center":r.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,c.jsxs)(d.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>y(String(r.id)),children:[r.text,(0,c.jsx)(d.TableSortLabel,{active:I===r.id,direction:I===r.id?W:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:I===r.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)"}}})]})}):r.text},String(r.id))),...Object.entries(t).map(([r,g])=>(0,c.jsx)(d.TableCell,{align:"center",colSpan:g.length,style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:r},r))],a=[...Object.values(t).flat().map(r=>(0,c.jsx)(d.TableCell,{align:r.align||"left",style:{width:r.width,minWidth:r.width,...r.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:r.sortable&&z?(0,c.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:r.align==="center"?"center":r.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,c.jsxs)(d.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>y(String(r.id)),children:[r.text,(0,c.jsx)(d.TableSortLabel,{active:I===r.id,direction:I===r.id?W:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:I===r.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)"}}})]})}):r.text},String(r.id)))];return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(d.TableRow,{children:s}),(0,c.jsx)(d.TableRow,{children:a})]})},[h,I,W,y,z,J]),je=(0,u.useCallback)((t,e)=>{let o=x?performance.now():0;if(!e){if(x){m.current.rowContentCalls+=1;let a=performance.now()-o;m.current.rowContentMs+=a,m.current.rowContentMaxMs=Math.max(m.current.rowContentMaxMs,a)}return null}let s=h.map(a=>{let r=x?performance.now():0,g=a.render?a.render(e,t):String(e[a.id]||"");if(x){let $=performance.now()-r;m.current.cellRenderCalls+=1,m.current.cellRenderMs+=$,m.current.cellRenderMaxMs=Math.max(m.current.cellRenderMaxMs,$)}return(0,c.jsx)(d.TableCell,{align:a.align||"left",style:{width:a.width,minWidth:a.width,...a.style,padding:"8px 16px"},children:g},String(a.id))});if(x){m.current.rowContentCalls+=1;let a=performance.now()-o;m.current.rowContentMs+=a,m.current.rowContentMaxMs=Math.max(m.current.rowContentMaxMs,a)}return(0,c.jsx)(c.Fragment,{children:s})},[h,x]),re=Ce??h.some(t=>typeof t.footer=="function"),Ye=(0,u.useCallback)(()=>{if(!re)return null;let t=[];for(let e=0;e<h.length;e+=1){let o=h[e],s=o.footerColSpan&&o.footerColSpan>1?Math.min(o.footerColSpan,h.length-e):1;t.push((0,c.jsx)(d.TableCell,{align:o.align||"left",colSpan:s>1?s:void 0,style:{...s>1?{}:{width:o.width,minWidth:o.width},...o.style,fontWeight:"bold",padding:"16px"},children:o.footer?o.footer(l):null},String(o.id))),e+=s-1}return(0,c.jsx)(d.TableRow,{children:t})},[re,h,l]),Oe=(0,u.useMemo)(()=>({Scroller:P,Table:t=>(0,c.jsx)(d.Table,{...t,sx:{borderCollapse:"separate",tableLayout:"fixed",marginRight:"16px",...re?{height:"100%"}:{}}}),TableHead:(0,u.forwardRef)((t,e)=>(0,c.jsx)(d.TableHead,{...t,ref:e,sx:{userSelect:"none","& tr":{height:J,"& th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:t=>{let{item:e,selected:o,"aria-selected":s,className:a,...r}=t,g=r["data-index"]??0,$=g%2===1,Y=e&&R.current?R.current(e,g):g,E=!Q&&T!==null&&T!==void 0&&Y===T,ye=E&&b?typeof b=="function"?b(e,g):b:void 0,ue=String(a??"").split(/\s+/).filter(H=>H!=="Mui-selected"&&H!=="Mui-focusVisible").join(" ");return(0,c.jsx)(d.TableRow,{...r,"data-row-id":Y!=null?String(Y):void 0,className:ue||void 0,selected:E,onMouseDown:H=>{ge.current=!1,D.current={x:H.clientX,y:H.clientY}},onClick:H=>{let De=H.clientX-D.current.x,Xe=H.clientY-D.current.y;if(Math.sqrt(De*De+Xe*Xe)>it||ge.current){H.preventDefault(),H.stopPropagation(),ge.current=!1;return}e&&te.current&&te.current(e,g),ge.current=!1},sx:[{userSelect:"none",height:Le,maxHeight:Le,boxSizing:"border-box",backgroundColor:$&&v?v:"transparent","& td":{padding:"8px 16px",boxSizing:"border-box",borderBottom:X?"1px solid rgba(224, 224, 224, 1)":"none"},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":Ie&&!E?{backgroundColor:H=>{let De=H.palette.mode==="dark",Ke=ce??"#000000",Ge=Ee??.06;if(!ce)return De?`rgba(255, 255, 255, ${Ge})`:`rgba(0, 0, 0, ${Ge})`;let Be=Ke.replace("#","").trim();if(Be.length!==6)return Ke;let ct=parseInt(Be.substring(0,2),16),ut=parseInt(Be.substring(2,4),16),dt=parseInt(Be.substring(4,6),16);return`rgba(${ct}, ${ut}, ${dt}, ${Ge})`}}:void 0,cursor:Ie?"pointer":void 0},ye]})},TableBody:(0,u.forwardRef)((t,e)=>{let{children:o,...s}=t;return(0,c.jsxs)(d.TableBody,{...s,ref:e,sx:re?{height:"100%"}:void 0,children:[o,re&&(0,c.jsx)("tr",{"aria-hidden":!0,style:{height:"100%"},children:(0,c.jsx)("td",{colSpan:h.length,style:{padding:0,border:0}})})]})}),TableFoot:(0,u.forwardRef)((t,e)=>(0,c.jsx)(d.TableFooter,{...t,ref:e,sx:[{"& tr":{height:G??S,maxHeight:G??S,boxSizing:"border-box"},"& td":{height:G??S,boxSizing:"border-box",backgroundColor:o=>o.palette.mode==="dark"?"#1e1e1e":"#ffffff",padding:"0 16px",color:"inherit",fontSize:"0.875rem",border:"none",boxShadow:"inset 0 1px 0 0 #000000"}},...Array.isArray(le)?le:le?[le]:[]]}))}),[Ie,Q?null:T,b,S,v,X,J,ce,Ee,P,G,le,re,h]),he=(0,c.jsxs)(d.Box,{sx:{position:"relative",height:"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:t=>t.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"},...$e??{},...se?{border:`1px solid ${Z.borderStrong}`,borderRadius:"4px",overflow:"hidden","& thead tr th":{height:J,boxSizing:"border-box",padding:"0 14px !important",fontSize:13,fontWeight:"500 !important",color:Z.headerColor,backgroundColor:`${Z.bg} !important`,borderTop:"none",borderBottom:`1px solid ${Z.borderStrong}`,borderRight:`1px solid ${Z.border}`,"&:last-of-type":{borderRight:"none"}},"& tbody tr td":{padding:"0 14px !important",fontSize:14,borderBottom:`1px solid ${Z.border}`}}:{}},children:[(0,c.jsx)(at.TableVirtuoso,{ref:k,data:l,totalCount:K?l.length+1:l.length,defaultItemHeight:Le,fixedItemHeight:Le,fixedHeaderContent:_e,fixedFooterContent:re?Ye:void 0,itemContent:je,endReached:Ve,style:{height:"100%"},increaseViewportBy:{top:Je,bottom:Qe},overscan:et,followOutput:!1,components:Oe},M),l.length===0&&!p&&(0,c.jsx)(d.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2},children:typeof oe=="string"?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(d.Box,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),(0,c.jsx)(d.Typography,{variant:"body1",sx:{color:"text.secondary"},children:oe})]}):oe}),He&&(0,c.jsx)(c.Fragment,{children:ie?(0,c.jsx)(ie,{visible:p,onComplete:Pe}):(0,c.jsx)(tt,{visible:p,onComplete:Pe,size:40,indicator:(0,c.jsx)(rt,{}),sx:{top:`${h.some(t=>t.group)?J*2:J}px`,bottom:`${re?G??S:0}px`},background:{show:l.length===0,opacity:.8}})})]}),n=se?{paddingRight:me,paddingTop:lt,paddingBottom:lt}:{};return de?(0,c.jsx)(d.Paper,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:me,...n,boxSizing:"border-box",height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:he}):(0,c.jsx)(d.Box,{className:"grow",style:{padding:0,paddingLeft:me,...n,boxSizing:"border-box",height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:he})}var st=(0,u.memo)(Et);
|
|
25
25
|
/**
|
|
26
26
|
* Virtual Data Table - A high-performance virtual data table component for React
|
|
27
27
|
*
|