@ehfuse/mui-virtual-data-table 1.1.29 → 1.1.30
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 +2 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var Ge=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var lt=Object.prototype.hasOwnProperty;var at=(
|
|
1
|
+
"use strict";var Ge=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var lt=Object.prototype.hasOwnProperty;var at=(i,p)=>{for(var m in p)Ge(i,m,{get:p[m],enumerable:!0})},st=(i,p,m,T)=>{if(p&&typeof p=="object"||typeof p=="function")for(let S of it(p))!lt.call(i,S)&&S!==m&&Ge(i,S,{get:()=>p[S],enumerable:!(T=ot(p,S))||T.enumerable});return i};var ct=i=>st(Ge({},"__esModule",{value:!0}),i);var wt={};at(wt,{VirtualDataTable:()=>tt});module.exports=ct(wt);var c=require("react"),d=require("@mui/material"),et=require("react-virtuoso");var ze=require("react/jsx-runtime"),Te=require("react"),Be=require("@mui/material"),Oe=function(){return Oe=Object.assign||function(p){for(var m,T=1,S=arguments.length;T<S;T++){m=arguments[T];for(var k in m)Object.prototype.hasOwnProperty.call(m,k)&&(p[k]=m[k])}return p},Oe.apply(this,arguments)};function Xe(i){var p=i.visible,m=i.onComplete,T=i.fadeoutDuration,S=T===void 0?200:T,k=i.exitDelay,v=k===void 0?0:k,L=i.size,O=L===void 0?40:L,G=i.className,J=i.style,_=i.sx,Q=i.indicator,F=i.background,X=F===void 0?{show:!0,color:"255, 255, 255",opacity:.9}:F,me=(0,Te.useRef)(void 0),u=(0,Te.useRef)(null),U=(0,Te.useState)(p),ge=U[0],be=U[1],q=X.show,Z=q===void 0?!0:q,H=X.color,P=H===void 0?"255, 255, 255":H,ae=X.opacity,se=ae===void 0?.9:ae;if((0,Te.useEffect)(function(){var ce=me.current;if(ce===!0&&p===!1&&u.current){var ue=u.current;ue.style.opacity="0",setTimeout(function(){be(!1),m?.()},S+v)}else p===!0&&(be(!0),u.current&&(u.current.style.opacity="1"));me.current=p},[p,m,S,v]),!ge)return null;var Le=function(){return typeof Q=="string"?(0,ze.jsx)("img",{src:Q,alt:"Loading",style:{width:O,height:O}}):Q||(0,ze.jsx)(Be.CircularProgress,{size:O})},ee=function(){return Z?P.startsWith("rgba")?{backgroundColor:P}:/^\d+,\s*\d+,\s*\d+$/.test(P)?{backgroundColor:"rgba(".concat(P,", ").concat(se,")")}:se!==1?{backgroundColor:P,"&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:P,opacity:se,zIndex:-1}}:{backgroundColor:P}:{backgroundColor:"transparent"}};return(0,ze.jsx)(Be.Box,{ref:u,className:G,style:Oe({},J),sx:Oe(Oe({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(S,"ms ease-out")},ee()),_),children:Le()})}var ke=require("react/jsx-runtime"),ut=`
|
|
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 Ue({size:l=54}){return(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)("style",{children:ut}),(0,ke.jsx)("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:l,height:l}})]})}var n=require("react"),le=require("react/jsx-runtime"),dt=["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"],Ze=(l,p)=>{let m=l.tagName.toLowerCase(),T=["text","password","email","number","search","tel","url","checkbox","radio"];if(m==="input"){let S=l.type;return T.includes(S)}if(["textarea","select","button"].includes(m)||["svg","path","circle","rect","line","polygon","polyline"].includes(m)||l.getAttribute("contenteditable")==="true")return!0;if(p?.excludeSelectors){for(let S of p.excludeSelectors)if(l.matches(S))return!0}return pt(l,p)},pt=(l,p)=>{let m=[...dt,...p?.excludeClasses||[]],T=l,S=0,k=5;for(;T&&S<=k;){if(m.some(v=>T.classList.contains(v)))return!0;if(T.classList.contains("MuiDialogContent-root"))break;T=T.parentElement,S++}return!1},ft={},ht={},mt={},gt={},bt={},xt=(0,n.forwardRef)(({className:l="",style:p={},containerStyle:m={},contentStyle:T={},children:S,onScroll:k,thumb:v=ft,track:L=ht,arrows:O=mt,dragScroll:G=gt,autoHide:J=bt,showScrollbar:_=!0,detectInnerScroll:Q=!1},F)=>{let X=(0,n.useRef)({});(0,n.useEffect)(()=>{X.current={children:S,onScroll:k,showScrollbar:_,thumb:v,track:L,arrows:O,dragScroll:G,autoHide:J}});let me=(0,n.useRef)(null),u=(0,n.useRef)(null),U=(0,n.useRef)(null),ge=(0,n.useRef)(null),be=(0,n.useRef)(null),q=(0,n.useRef)(null),[Z,H]=(0,n.useState)(!1),[P,ae]=(0,n.useState)(!1),[se,Le]=(0,n.useState)(!1),[ee,ce]=(0,n.useState)({y:0,scrollTop:0}),[ue,qe]=(0,n.useState)(0),[Ve,Fe]=(0,n.useState)(0),[Ee,Pe]=(0,n.useState)(!1),[ve,we]=(0,n.useState)(!1),[de,We]=(0,n.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[rt,I]=(0,n.useState)(null),[x,xe]=(0,n.useState)(null),[je,He]=(0,n.useState)(!1),Me=(0,n.useRef)(null),[Ie,Ae]=(0,n.useState)(!1),Ce=(0,n.useRef)(null),ye=(0,n.useRef)(null),pe=(0,n.useRef)(null),j=(0,n.useMemo)(()=>{let t=v.color??"#606060";return{width:v.width??8,minHeight:v.minHeight??50,radius:v.radius??(v.width??8)/2,color:t,opacity:v.opacity??.6,hoverColor:v.hoverColor??t,hoverOpacity:v.hoverOpacity??1}},[v]),C=(0,n.useMemo)(()=>({width:L.width??16,color:L.color??"rgba(128, 128, 128, 0.1)",visible:L.visible??!0,alignment:L.alignment??"center",radius:L.radius??j.radius??4,margin:L.margin??4}),[L,j.radius]),Y=(0,n.useMemo)(()=>{let t=O.color??"#808080";return{visible:O.visible??!1,step:O.step??50,color:t,opacity:O.opacity??.6,hoverColor:O.hoverColor??t,hoverOpacity:O.hoverOpacity??1}},[O]),Se=(0,n.useMemo)(()=>({enabled:G.enabled??!0,excludeClasses:G.excludeClasses??[],excludeSelectors:G.excludeSelectors??[]}),[G]),w=(0,n.useMemo)(()=>({enabled:J.enabled??!0,delay:J.delay??1500,delayOnWheel:J.delayOnWheel??700}),[J]),D=j.width,$e=C.width,fe=j.minHeight,V=Y.visible,he=Y.step,re=(0,n.useCallback)(()=>{if(!u.current)return;let t=document.activeElement;t&&u.current.contains(t)&&t!==u.current||u.current.focus()},[]);(0,n.useImperativeHandle)(F,()=>({getScrollContainer:()=>u.current,scrollTo:t=>{u.current&&u.current.scrollTo(t)},get scrollTop(){return u.current?.scrollTop||0},get scrollHeight(){return u.current?.scrollHeight||0},get clientHeight(){return u.current?.clientHeight||0}}),[]);let R=(0,n.useCallback)(()=>{if(q.current){let o=q.current;if(document.contains(o)&&o.scrollHeight>o.clientHeight+2)return o;q.current=null}if(!u.current)return null;if(U.current&&U.current.scrollHeight>u.current.clientHeight+2)return q.current=u.current,u.current;if(!Q)return null;let t=u.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let o of t){let a=o;if(a!==u.current&&a.classList.contains("overlay-scrollbar-container"))continue;let h=a.parentElement,f=!1;for(;h&&h!==u.current;){if(h.classList.contains("overlay-scrollbar-container")&&h!==u.current){f=!0;break}h=h.parentElement}if(!f&&a.scrollHeight>a.clientHeight+2)return q.current=a,a}return null},[]),ne=(0,n.useCallback)(()=>R()!==null,[R]),A=(0,n.useCallback)(()=>{Ce.current&&(clearTimeout(Ce.current),Ce.current=null)},[]),_e=(0,n.useCallback)(()=>{ye.current&&(clearTimeout(ye.current),ye.current=null)},[]),oe=(0,n.useCallback)(()=>{pe.current&&(clearTimeout(pe.current),pe.current=null)},[]),z=(0,n.useCallback)(t=>{w.enabled&&(A(),Ce.current=setTimeout(()=>{H(!1),Ce.current=null},t))},[A,w.enabled]),E=(0,n.useCallback)(()=>{let t=R();if(!t){H(!1),Pe(!1),A();return}if(Pe(!0),!ge.current)return;w.enabled||(H(!0),A());let o=t.clientHeight,a=t.scrollHeight,h=t.scrollTop,f=0;if(me.current){let Re=window.getComputedStyle(me.current),Ke=parseFloat(Re.paddingTop)||0,nt=parseFloat(Re.paddingBottom)||0;f=Ke+nt}let M=V?D*2+C.margin*4:C.margin*2,$=o-M+f,N=o/a,te=Math.max($*N,fe),ie=a-o,K=$-te,Ne=ie>0?h/ie*K:0;qe(te),Fe(Ne)},[R,A,V,D,fe,w.enabled]),Ye=(0,n.useCallback)(t=>{t.preventDefault(),t.stopPropagation();let o=R();o&&(ae(!0),ce({y:t.clientY,scrollTop:o.scrollTop}),A(),H(!0),re())},[R,A,re]),De=(0,n.useCallback)(t=>{if(!P)return;let o=R();if(!o)return;let a=o.clientHeight,h=o.scrollHeight-a,f=t.clientY-ee.y,M=a-ue,$=f/M*h,N=Math.max(0,Math.min(h,ee.scrollTop+$));o.scrollTop=N,E()},[P,ee,ue,E,R]),i=(0,n.useCallback)(()=>{ae(!1),ne()&&z(w.delay)},[ne,z,w.delay]),r=(0,n.useCallback)(t=>{if(!ge.current)return;let o=ge.current.getBoundingClientRect(),a=t.clientY-o.top,h=R();if(!h)return;let f=h.clientHeight,M=h.scrollHeight,$=a/f*(M-f);h.scrollTop=Math.max(0,Math.min(M-f,$)),E(),H(!0),z(w.delay),re()},[E,z,w.delay,R,re]),g=(0,n.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!u.current)return;let o=Math.max(0,u.current.scrollTop-he);u.current.scrollTop=o,E(),H(!0),z(w.delay),re()},[E,z,he,w.delay,re]),y=(0,n.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!u.current||!U.current)return;let o=u.current,a=U.current.scrollHeight-o.clientHeight,h=Math.min(a,o.scrollTop+he);o.scrollTop=h,E(),H(!0),z(w.delay),re()},[E,z,he,w.delay,re]),b=(0,n.useCallback)(t=>{if(!Se.enabled)return;let o=t.target;if(Ze(o,Se)||t.button!==0)return;let a=R();a&&(a.scrollHeight<=a.clientHeight||(t.preventDefault(),we(!0),We({x:t.clientX,y:t.clientY,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft||0}),A()))},[Se,Ze,R,A]),e=(0,n.useCallback)(t=>{if(!ve)return;let o=R();if(!o)return;let a=de.x-t.clientX,h=de.y-t.clientY;if(Math.abs(h)<3&&Math.abs(a)<3)return;H(!0);let f=Math.max(0,Math.min(o.scrollHeight-o.clientHeight,de.scrollTop+h));o.scrollTop=f,E()},[ve,de,R,E]),B=(0,n.useCallback)(()=>{we(!1),ne()&&z(w.delay)},[ne,z,w.delay]);(0,n.useEffect)(()=>{let t=M=>{E(),A(),H(!0);let $=Ie?w.delayOnWheel:w.delay;z($),k&&k(M)},o=()=>{Ae(!0),Me.current&&clearTimeout(Me.current),Me.current=setTimeout(()=>{Ae(!1)},300),A(),oe(),pe.current=setTimeout(()=>{H(!0),pe.current=null},50)},a=[],h=R();h&&a.push(h);let f=u.current;return f&&!h&&(a.push(f),f.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(M=>{let $=M;if($!==f&&$.classList.contains("overlay-scrollbar-container"))return;let N=$.parentElement;for(;N&&N!==f;){if(N.classList.contains("overlay-scrollbar-container")&&N!==f)return;N=N.parentElement}a.push($)})),a.forEach(M=>{M.addEventListener("scroll",t,{passive:!0}),M.addEventListener("wheel",o,{passive:!0})}),()=>{a.forEach(M=>{M.removeEventListener("scroll",t),M.removeEventListener("wheel",o)}),Me.current&&clearTimeout(Me.current),pe.current&&clearTimeout(pe.current)}},[R,E,k,A,z,w,Ie]),(0,n.useEffect)(()=>{let t=a=>{let h=R();if(!h)return;let{key:f}=a,{scrollTop:M,scrollHeight:$,clientHeight:N}=h,te=$-N,ie=50,K=null;switch(f){case"ArrowUp":a.preventDefault(),K=Math.max(0,M-ie);break;case"ArrowDown":a.preventDefault(),K=Math.min(te,M+ie);break;case"PageUp":a.preventDefault(),K=Math.max(0,M-N);break;case"PageDown":a.preventDefault(),K=Math.min(te,M+N);break;case"Home":a.preventDefault(),K=0;break;case"End":a.preventDefault(),K=te;break;default:return}if(K!==null){let Ne=K/te,Re=V?D*2+C.margin*4:C.margin*2,Ke=(N-Re-ue)*Ne;Fe(Ke),h.scrollTop=K,A(),H(!0),z(w.delay)}},o=u.current;if(o)return o.addEventListener("keydown",t),()=>{o.removeEventListener("keydown",t)}},[R,V,D,C.margin,ue,A,z,w.delay]),(0,n.useEffect)(()=>{if(ve)return document.addEventListener("mousemove",e),document.addEventListener("mouseup",B),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",B)}},[ve,e,B]),(0,n.useEffect)(()=>{if(P)return document.addEventListener("mousemove",De),document.addEventListener("mouseup",i),()=>{document.removeEventListener("mousemove",De),document.removeEventListener("mouseup",i)}},[P,De,i]),(0,n.useEffect)(()=>{E();let t=setTimeout(()=>{E()},100);return()=>clearTimeout(t)},[E]),(0,n.useLayoutEffect)(()=>{He(!0),E(),!w.enabled&&ne()&&H(!0)},[ne,E,w.enabled]),(0,n.useEffect)(()=>{let t=new ResizeObserver(()=>{E()}),o=[];return u.current&&o.push(u.current),U.current&&o.push(U.current),q.current&&document.contains(q.current)&&o.push(q.current),o.forEach(a=>{t.observe(a)}),()=>t.disconnect()},[E]),(0,n.useEffect)(()=>{if(!u.current)return;let t=new MutationObserver(()=>{q.current=null,E()});return t.observe(u.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[E]);let W=Math.max($e,D);return(0,n.useEffect)(()=>{let t="overlay-scrollbar-webkit-hide",o=document.getElementById(t);o&&o.remove();let a=document.createElement("style");return a.id=t,a.textContent=`
|
|
4
|
+
`;function Ue({size:i=54}){return(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)("style",{children:ut}),(0,ke.jsx)("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:i,height:i}})]})}var n=require("react"),le=require("react/jsx-runtime"),dt=["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"],Ze=(i,p)=>{let m=i.tagName.toLowerCase(),T=["text","password","email","number","search","tel","url","checkbox","radio"];if(m==="input"){let S=i.type;return T.includes(S)}if(["textarea","select","button"].includes(m)||["svg","path","circle","rect","line","polygon","polyline"].includes(m)||i.getAttribute("contenteditable")==="true")return!0;if(p?.excludeSelectors){for(let S of p.excludeSelectors)if(i.matches(S))return!0}return pt(i,p)},pt=(i,p)=>{let m=[...dt,...p?.excludeClasses||[]],T=i,S=0,k=5;for(;T&&S<=k;){if(m.some(v=>T.classList.contains(v)))return!0;if(T.classList.contains("MuiDialogContent-root"))break;T=T.parentElement,S++}return!1},ft={},ht={},mt={},gt={},bt={},xt=(0,n.forwardRef)(({className:i="",style:p={},containerStyle:m={},contentStyle:T={},children:S,onScroll:k,thumb:v=ft,track:L=ht,arrows:O=mt,dragScroll:G=gt,autoHide:J=bt,showScrollbar:_=!0,detectInnerScroll:Q=!1},F)=>{let X=(0,n.useRef)({});(0,n.useEffect)(()=>{X.current={children:S,onScroll:k,showScrollbar:_,thumb:v,track:L,arrows:O,dragScroll:G,autoHide:J}});let me=(0,n.useRef)(null),u=(0,n.useRef)(null),U=(0,n.useRef)(null),ge=(0,n.useRef)(null),be=(0,n.useRef)(null),q=(0,n.useRef)(null),[Z,H]=(0,n.useState)(!1),[P,ae]=(0,n.useState)(!1),[se,Le]=(0,n.useState)(!1),[ee,ce]=(0,n.useState)({y:0,scrollTop:0}),[ue,qe]=(0,n.useState)(0),[Ve,Fe]=(0,n.useState)(0),[Ee,Pe]=(0,n.useState)(!1),[ve,we]=(0,n.useState)(!1),[de,We]=(0,n.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[rt,I]=(0,n.useState)(null),[x,xe]=(0,n.useState)(null),[je,He]=(0,n.useState)(!1),Me=(0,n.useRef)(null),[Ie,Ae]=(0,n.useState)(!1),Ce=(0,n.useRef)(null),ye=(0,n.useRef)(null),pe=(0,n.useRef)(null),j=(0,n.useMemo)(()=>{let t=v.color??"#606060";return{width:v.width??8,minHeight:v.minHeight??50,radius:v.radius??(v.width??8)/2,color:t,opacity:v.opacity??.6,hoverColor:v.hoverColor??t,hoverOpacity:v.hoverOpacity??1}},[v]),w=(0,n.useMemo)(()=>({width:L.width??16,color:L.color??"rgba(128, 128, 128, 0.1)",visible:L.visible??!0,alignment:L.alignment??"center",radius:L.radius??j.radius??4,margin:L.margin??4}),[L,j.radius]),Y=(0,n.useMemo)(()=>{let t=O.color??"#808080";return{visible:O.visible??!1,step:O.step??50,color:t,opacity:O.opacity??.6,hoverColor:O.hoverColor??t,hoverOpacity:O.hoverOpacity??1}},[O]),Se=(0,n.useMemo)(()=>({enabled:G.enabled??!0,excludeClasses:G.excludeClasses??[],excludeSelectors:G.excludeSelectors??[]}),[G]),M=(0,n.useMemo)(()=>({enabled:J.enabled??!0,delay:J.delay??1500,delayOnWheel:J.delayOnWheel??700}),[J]),D=j.width,$e=w.width,fe=j.minHeight,V=Y.visible,he=Y.step,re=(0,n.useCallback)(()=>{if(!u.current)return;let t=document.activeElement;t&&u.current.contains(t)&&t!==u.current||u.current.focus()},[]);(0,n.useImperativeHandle)(F,()=>({getScrollContainer:()=>u.current,scrollTo:t=>{u.current&&u.current.scrollTo(t)},get scrollTop(){return u.current?.scrollTop||0},get scrollHeight(){return u.current?.scrollHeight||0},get clientHeight(){return u.current?.clientHeight||0}}),[]);let R=(0,n.useCallback)(()=>{if(q.current){let o=q.current;if(document.contains(o)&&o.scrollHeight>o.clientHeight+2)return o;q.current=null}if(!u.current)return null;if(U.current&&U.current.scrollHeight>u.current.clientHeight+2)return q.current=u.current,u.current;if(!Q)return null;let t=u.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let o of t){let a=o;if(a!==u.current&&a.classList.contains("overlay-scrollbar-container"))continue;let h=a.parentElement,f=!1;for(;h&&h!==u.current;){if(h.classList.contains("overlay-scrollbar-container")&&h!==u.current){f=!0;break}h=h.parentElement}if(!f&&a.scrollHeight>a.clientHeight+2)return q.current=a,a}return null},[]),ne=(0,n.useCallback)(()=>R()!==null,[R]),A=(0,n.useCallback)(()=>{Ce.current&&(clearTimeout(Ce.current),Ce.current=null)},[]),_e=(0,n.useCallback)(()=>{ye.current&&(clearTimeout(ye.current),ye.current=null)},[]),oe=(0,n.useCallback)(()=>{pe.current&&(clearTimeout(pe.current),pe.current=null)},[]),z=(0,n.useCallback)(t=>{M.enabled&&(A(),Ce.current=setTimeout(()=>{H(!1),Ce.current=null},t))},[A,M.enabled]),E=(0,n.useCallback)(()=>{let t=R();if(!t){H(!1),Pe(!1),A();return}if(Pe(!0),!ge.current)return;M.enabled||(H(!0),A());let o=t.clientHeight,a=t.scrollHeight,h=t.scrollTop,f=0;if(me.current){let Re=window.getComputedStyle(me.current),Ke=parseFloat(Re.paddingTop)||0,nt=parseFloat(Re.paddingBottom)||0;f=Ke+nt}let C=V?D*2+w.margin*4:w.margin*2,$=o-C+f,N=o/a,te=Math.max($*N,fe),ie=a-o,K=$-te,Ne=ie>0?h/ie*K:0;qe(te),Fe(Ne)},[R,A,V,D,fe,M.enabled]),Ye=(0,n.useCallback)(t=>{t.preventDefault(),t.stopPropagation();let o=R();o&&(ae(!0),ce({y:t.clientY,scrollTop:o.scrollTop}),A(),H(!0),re())},[R,A,re]),De=(0,n.useCallback)(t=>{if(!P)return;let o=R();if(!o)return;let a=o.clientHeight,h=o.scrollHeight-a,f=t.clientY-ee.y,C=a-ue,$=f/C*h,N=Math.max(0,Math.min(h,ee.scrollTop+$));o.scrollTop=N,E()},[P,ee,ue,E,R]),l=(0,n.useCallback)(()=>{ae(!1),ne()&&z(M.delay)},[ne,z,M.delay]),r=(0,n.useCallback)(t=>{if(!ge.current)return;let o=ge.current.getBoundingClientRect(),a=t.clientY-o.top,h=R();if(!h)return;let f=h.clientHeight,C=h.scrollHeight,$=a/f*(C-f);h.scrollTop=Math.max(0,Math.min(C-f,$)),E(),H(!0),z(M.delay),re()},[E,z,M.delay,R,re]),g=(0,n.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!u.current)return;let o=Math.max(0,u.current.scrollTop-he);u.current.scrollTop=o,E(),H(!0),z(M.delay),re()},[E,z,he,M.delay,re]),y=(0,n.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!u.current||!U.current)return;let o=u.current,a=U.current.scrollHeight-o.clientHeight,h=Math.min(a,o.scrollTop+he);o.scrollTop=h,E(),H(!0),z(M.delay),re()},[E,z,he,M.delay,re]),b=(0,n.useCallback)(t=>{if(!Se.enabled)return;let o=t.target;if(Ze(o,Se)||t.button!==0)return;let a=R();a&&(a.scrollHeight<=a.clientHeight||(t.preventDefault(),we(!0),We({x:t.clientX,y:t.clientY,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft||0}),A()))},[Se,Ze,R,A]),e=(0,n.useCallback)(t=>{if(!ve)return;let o=R();if(!o)return;let a=de.x-t.clientX,h=de.y-t.clientY;if(Math.abs(h)<3&&Math.abs(a)<3)return;H(!0);let f=Math.max(0,Math.min(o.scrollHeight-o.clientHeight,de.scrollTop+h));o.scrollTop=f,E()},[ve,de,R,E]),B=(0,n.useCallback)(()=>{we(!1),ne()&&z(M.delay)},[ne,z,M.delay]);(0,n.useEffect)(()=>{let t=C=>{E(),A(),H(!0);let $=Ie?M.delayOnWheel:M.delay;z($),k&&k(C)},o=()=>{Ae(!0),Me.current&&clearTimeout(Me.current),Me.current=setTimeout(()=>{Ae(!1)},300),A(),oe(),pe.current=setTimeout(()=>{H(!0),pe.current=null},50)},a=[],h=R();h&&a.push(h);let f=u.current;return f&&!h&&(a.push(f),f.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(C=>{let $=C;if($!==f&&$.classList.contains("overlay-scrollbar-container"))return;let N=$.parentElement;for(;N&&N!==f;){if(N.classList.contains("overlay-scrollbar-container")&&N!==f)return;N=N.parentElement}a.push($)})),a.forEach(C=>{C.addEventListener("scroll",t,{passive:!0}),C.addEventListener("wheel",o,{passive:!0})}),()=>{a.forEach(C=>{C.removeEventListener("scroll",t),C.removeEventListener("wheel",o)}),Me.current&&clearTimeout(Me.current),pe.current&&clearTimeout(pe.current)}},[R,E,k,A,z,M,Ie]),(0,n.useEffect)(()=>{let t=a=>{let h=R();if(!h)return;let{key:f}=a,{scrollTop:C,scrollHeight:$,clientHeight:N}=h,te=$-N,ie=50,K=null;switch(f){case"ArrowUp":a.preventDefault(),K=Math.max(0,C-ie);break;case"ArrowDown":a.preventDefault(),K=Math.min(te,C+ie);break;case"PageUp":a.preventDefault(),K=Math.max(0,C-N);break;case"PageDown":a.preventDefault(),K=Math.min(te,C+N);break;case"Home":a.preventDefault(),K=0;break;case"End":a.preventDefault(),K=te;break;default:return}if(K!==null){let Ne=K/te,Re=V?D*2+w.margin*4:w.margin*2,Ke=(N-Re-ue)*Ne;Fe(Ke),h.scrollTop=K,A(),H(!0),z(M.delay)}},o=u.current;if(o)return o.addEventListener("keydown",t),()=>{o.removeEventListener("keydown",t)}},[R,V,D,w.margin,ue,A,z,M.delay]),(0,n.useEffect)(()=>{if(ve)return document.addEventListener("mousemove",e),document.addEventListener("mouseup",B),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",B)}},[ve,e,B]),(0,n.useEffect)(()=>{if(P)return document.addEventListener("mousemove",De),document.addEventListener("mouseup",l),()=>{document.removeEventListener("mousemove",De),document.removeEventListener("mouseup",l)}},[P,De,l]),(0,n.useEffect)(()=>{E();let t=setTimeout(()=>{E()},100);return()=>clearTimeout(t)},[E]),(0,n.useLayoutEffect)(()=>{He(!0),E(),!M.enabled&&ne()&&H(!0)},[ne,E,M.enabled]),(0,n.useEffect)(()=>{let t=new ResizeObserver(()=>{E()}),o=[];return u.current&&o.push(u.current),U.current&&o.push(U.current),q.current&&document.contains(q.current)&&o.push(q.current),o.forEach(a=>{t.observe(a)}),()=>t.disconnect()},[E]),(0,n.useEffect)(()=>{if(!u.current)return;let t=new MutationObserver(()=>{q.current=null,E()});return t.observe(u.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[E]);let W=Math.max($e,D);return(0,n.useEffect)(()=>{let t="overlay-scrollbar-webkit-hide",o=document.getElementById(t);o&&o.remove();let a=document.createElement("style");return a.id=t,a.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(a),()=>{let h=document.getElementById(t);h&&h.remove()}},[]),(0,le.jsxs)("div",{ref:me,className:`overlay-scrollbar-wrapper ${l}`,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",...p},children:[(0,le.jsx)("div",{ref:u,className:"overlay-scrollbar-container",tabIndex:-1,onMouseDown:b,style:{display:"flex",width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",scrollbarWidth:"none",msOverflowStyle:"none",outline:"none",userSelect:ve?"none":"auto",...m},children:(0,le.jsx)("div",{ref:U,className:"overlay-scrollbar-content",style:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",...T},children:S})}),_&&Ee&&(0,le.jsxs)("div",{ref:ge,className:"overlay-scrollbar-track",onMouseEnter:()=>{A(),ye.current=setTimeout(()=>{H(!0),ye.current=null},100)},onMouseLeave:()=>{_e(),P||z(w.delay)},style:{position:"absolute",top:0,right:0,width:`${W}px`,height:"100%",opacity:Z?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[C.visible&&(0,le.jsx)("div",{className:"overlay-scrollbar-track-background",onClick:t=>{t.preventDefault(),t.stopPropagation(),r(t)},style:{position:"absolute",top:V?`${j.width+C.margin*2}px`:`${C.margin}px`,right:C.alignment==="right"?"0px":`${(W-j.width)/2}px`,width:`${j.width}px`,height:V?`calc(100% - ${j.width*2+C.margin*4}px)`:`calc(100% - ${C.margin*2}px)`,backgroundColor:C.color,borderRadius:`${C.radius}px`,cursor:"pointer"}}),(0,le.jsx)("div",{ref:be,className:"overlay-scrollbar-thumb",onMouseDown:Ye,onMouseEnter:()=>Le(!0),onMouseLeave:()=>Le(!1),style:{position:"absolute",top:`${(V?D+C.margin*2:C.margin)+Ve}px`,right:C.alignment==="right"?"0px":`${(W-D)/2}px`,width:`${D}px`,height:`${Math.max(ue,fe)}px`,backgroundColor:se||P?j.hoverColor:j.color,opacity:se||P?j.hoverOpacity:j.opacity,borderRadius:`${j.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),_&&Ee&&V&&(0,le.jsx)("div",{className:"overlay-scrollbar-up-arrow",onClick:g,onMouseEnter:()=>xe("up"),onMouseLeave:()=>xe(null),style:{position:"absolute",top:`${C.margin}px`,right:C.alignment==="right"?"0px":`${(W-D)/2}px`,width:`${D}px`,height:`${D}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(D*.75,8)}px`,color:x==="up"?Y.hoverColor:Y.color,userSelect:"none",zIndex:1001,opacity:Z?x==="up"?Y.hoverOpacity:Y.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),_&&Ee&&V&&(0,le.jsx)("div",{className:"overlay-scrollbar-down-arrow",onClick:y,onMouseEnter:()=>xe("down"),onMouseLeave:()=>xe(null),style:{position:"absolute",bottom:`${C.margin}px`,right:C.alignment==="right"?"0px":`${(W-D)/2}px`,width:`${D}px`,height:`${D}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(D*.75,8)}px`,color:x==="down"?Y.hoverColor:Y.color,userSelect:"none",zIndex:1001,opacity:Z?x==="down"?Y.hoverOpacity:Y.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"})]})}),Je=xt;var s=require("react/jsx-runtime"),yt={alignment:"right",margin:0,radius:0},Qe=5;function vt({data:l,loading:p=!1,columns:m,onRowClick:T,getRowId:S,selectedRowId:k,selectedRowSx:v,rowHeight:L=50,columnHeight:O=56,striped:G,rowDivider:J=!0,onSort:_,onLoadMore:Q,sortBy:F,sortDirection:X,showPaper:me=!0,paddingX:u="1rem",paddingTop:U=0,paddingBottom:ge=0,rowHoverColor:be,rowHoverOpacity:q,viewportBuffer:Z,overscan:H,scrollbars:P,emptyMessage:ae="NO DATA",LoadingComponent:se,showFooter:Le,footerHeight:ee,footerSx:ce}){let ue=Math.max(L*12,480),qe=Math.max(L*12,480),Ve=typeof Z=="number"?Z:Z?.top??ue,Fe=typeof Z=="number"?Z:Z?.bottom??qe,Ee=Math.max(L*8,420),Pe=Math.max(L*10,520),ve=typeof H=="number"?H:{main:H?.main??Ee,reverse:H?.reverse??Pe},we=L+(J?1:0),de=!v||typeof v!="function",We=(0,c.useMemo)(()=>!de||k===null||k===void 0||!v?null:{[`& tbody tr[data-row-id="${String(k).replace(/["\\]/g,"\\$&")}"]`]:v},[de,k,v]),rt=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),[I]=(0,c.useState)(()=>typeof window>"u"?!1:window.localStorage.getItem("vdt-perf-debug")==="1"),x=(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}),xe=(0,c.useCallback)(i=>{if(!I)return;let r=x.current;if(!(r.wheelEvents>0||r.rangeChangedCalls>0||r.rowContentCalls>0||r.cellRenderCalls>0))return;let y=r.rowContentCalls>0?r.rowContentMs/r.rowContentCalls:0,b=r.cellRenderCalls>0?r.cellRenderMs/r.cellRenderCalls:0;console.log("[VDT perf]",{reason:i,wheel:{events:r.wheelEvents,inputPx:Math.round(r.wheelInputPx),handlerMs:Number(r.wheelHandlerMs.toFixed(2)),rafFlushes:r.wheelRafFlushes,rafMs:Number(r.wheelRafMs.toFixed(2))},rangeChanged:{calls:r.rangeChangedCalls,totalMs:Number(r.rangeChangedMs.toFixed(2))},rowContent:{calls:r.rowContentCalls,totalMs:Number(r.rowContentMs.toFixed(2)),avgMs:Number(y.toFixed(3)),maxMs:Number(r.rowContentMaxMs.toFixed(3))},cellRender:{calls:r.cellRenderCalls,totalMs:Number(r.cellRenderMs.toFixed(2)),avgMs:Number(b.toFixed(3)),maxMs:Number(r.cellRenderMaxMs.toFixed(3))}}),x.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}},[I]);(0,c.useEffect)(()=>{if(!I||typeof window>"u")return;console.log("[VDT perf] enabled (localStorage vdt-perf-debug=1)");let i=window.setInterval(()=>{xe("interval")},1500);return()=>{window.clearInterval(i),xe("cleanup")}},[xe,I]);let je=(0,c.useMemo)(()=>(0,c.forwardRef)((i,r)=>{let g=(0,c.useRef)(null),y=(0,c.useRef)(0),b=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let e=g.current;if(!e)return;let B=W=>{let t=I?performance.now():0;W.preventDefault();let o=W.deltaY;W.deltaMode===1?o*=40:W.deltaMode===2&&(o*=e.clientHeight),I&&(x.current.wheelEvents+=1,x.current.wheelInputPx+=o),y.current+=o,b.current===null&&(b.current=requestAnimationFrame(()=>{let a=I?performance.now():0,h=Math.max(e.clientHeight*.4,160),f=Math.max(-h,Math.min(h,y.current));y.current=0,b.current=null,f!==0&&(e.scrollTop+=f),I&&(x.current.wheelRafFlushes+=1,x.current.wheelRafMs+=performance.now()-a)}),I&&(x.current.wheelHandlerMs+=performance.now()-t))};return e.addEventListener("wheel",B,{passive:!1}),()=>{e.removeEventListener("wheel",B),b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),y.current=0}},[]),(0,s.jsx)(Je,{detectInnerScroll:!0,track:yt,...P,children:(0,s.jsx)(d.TableContainer,{component:d.Box,...i,ref:e=>{g.current=e,typeof r=="function"?r(e):r&&(r.current=e)},sx:{userSelect:"auto",WebkitUserSelect:"auto",position:"relative",width:"100%",height:"100%",overflow:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none",msOverflowStyle:"none",transform:"translateZ(0)",backfaceVisibility:"hidden",willChange:"scroll-position","&::-webkit-scrollbar":{display:"none"},"& .MuiTable-root":{paddingRight:u,paddingTop:U,paddingBottom:ge}}})})}),[]),He=(0,c.useMemo)(()=>{if(G===!0)return"#f5f5f5";if(typeof G=="string")return G},[G]),[Me,Ie]=(0,c.useState)(p),[Ae,Ce]=(0,c.useState)(0);(0,c.useEffect)(()=>{p&&Ie(!0)},[p]);let ye=(0,c.useCallback)(()=>{Ie(!1)},[]),pe=Me,j=p&&l.length>0,C=(0,c.useRef)(!1),Y=(0,c.useRef)(-1),Se=(0,c.useRef)(null),w=(0,c.useRef)(T);w.current=T;let D=(0,c.useRef)(S);D.current=S;let $e=!!T,fe=(0,c.useRef)(!1),V=(0,c.useRef)({x:0,y:0});(0,c.useEffect)(()=>{let i=r=>{let g=r.clientX-V.current.x,y=r.clientY-V.current.y;Math.sqrt(g*g+y*y)>Qe&&(fe.current=!0)};return document.addEventListener("mousemove",i),()=>{document.removeEventListener("mousemove",i)}},[]),(0,c.useEffect)(()=>{let i=document.querySelector('[data-testid="virtuoso-scroller"]');i&&i.querySelectorAll(".MuiTableSortLabel-root").forEach(g=>{let y=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});g.dispatchEvent(y)})},[F]);let he=(0,c.useCallback)(i=>{if(!_)return;_(i,F===i&&X==="asc"?"desc":"asc")},[_,F,X]),re=(0,c.useCallback)(i=>{let r=I?performance.now():0;if(!Q){I&&(x.current.rangeChangedCalls+=1,x.current.rangeChangedMs+=performance.now()-r);return}if(p&&l.length===0){I&&(x.current.rangeChangedCalls+=1,x.current.rangeChangedMs+=performance.now()-r);return}let g=l.length>=30,y=i>=l.length-1,b=Y.current===l.length;if(y&&g&&!C.current&&!b){C.current=!0,Y.current=l.length;let e=l.length;Q(e,50)}I&&(x.current.rangeChangedCalls+=1,x.current.rangeChangedMs+=performance.now()-r)},[l.length,p,Q,I]);(0,c.useEffect)(()=>{p||(C.current=!1)},[p]),(0,c.useEffect)(()=>{l.length===0&&Ce(i=>i+1)},[l.length]);let R=(0,c.useRef)(l.length),ne=(0,c.useRef)(void 0);(0,c.useEffect)(()=>{let i=R.current,r=l.length,g=r>0?D.current?D.current(l[0],0):l[0]:void 0,y=ne.current;if(r>i&&i>0){R.current=r,ne.current=g;return}let b=r<i||i>0&&g!==y;Se.current&&r>0&&b&&Se.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),R.current=r,ne.current=g},[l]);let A=(0,c.useCallback)(()=>{let i={},r=[];if(m.forEach(e=>{e.group?(i[e.group]||(i[e.group]=[]),i[e.group].push(e)):r.push(e)}),!(Object.keys(i).length>0))return(0,s.jsx)(d.TableRow,{children:m.map(e=>(0,s.jsx)(d.TableCell,{align:e.align||"left",style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e.sortable?(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,s.jsxs)(d.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>he(String(e.id)),children:[e.text,(0,s.jsx)(d.TableSortLabel,{active:F===e.id,direction:F===e.id?X:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:F===e.id?1:0,transition:"opacity 0.2s ease","& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id)))});let y=[...r.map(e=>(0,s.jsx)(d.TableCell,{rowSpan:2,align:e.align||"left",style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e.sortable&&_?(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,s.jsxs)(d.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>he(String(e.id)),children:[e.text,(0,s.jsx)(d.TableSortLabel,{active:F===e.id,direction:F===e.id?X:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:F===e.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id))),...Object.entries(i).map(([e,B])=>(0,s.jsx)(d.TableCell,{align:"center",colSpan:B.length,style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e},e))],b=[...Object.values(i).flat().map(e=>(0,s.jsx)(d.TableCell,{align:e.align||"left",style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e.sortable&&_?(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,s.jsxs)(d.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>he(String(e.id)),children:[e.text,(0,s.jsx)(d.TableSortLabel,{active:F===e.id,direction:F===e.id?X:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:F===e.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(0deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(180deg)"}}})]})}):e.text},String(e.id)))];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.TableRow,{children:y}),(0,s.jsx)(d.TableRow,{children:b})]})},[m,F,X,he,_,O]),_e=(0,c.useCallback)((i,r)=>{let g=I?performance.now():0;if(!r){if(I){x.current.rowContentCalls+=1;let b=performance.now()-g;x.current.rowContentMs+=b,x.current.rowContentMaxMs=Math.max(x.current.rowContentMaxMs,b)}return null}let y=m.map(b=>{let e=I?performance.now():0,B=b.render?b.render(r,i):String(r[b.id]||"");if(I){let W=performance.now()-e;x.current.cellRenderCalls+=1,x.current.cellRenderMs+=W,x.current.cellRenderMaxMs=Math.max(x.current.cellRenderMaxMs,W)}return(0,s.jsx)(d.TableCell,{align:b.align||"left",style:{width:b.width,minWidth:b.width,...b.style,padding:"8px 16px"},children:B},String(b.id))});if(I){x.current.rowContentCalls+=1;let b=performance.now()-g;x.current.rowContentMs+=b,x.current.rowContentMaxMs=Math.max(x.current.rowContentMaxMs,b)}return(0,s.jsx)(s.Fragment,{children:y})},[m,I]),oe=Le??m.some(i=>typeof i.footer=="function"),z=(0,c.useCallback)(()=>{if(!oe)return null;let i=[];for(let r=0;r<m.length;r+=1){let g=m[r],y=g.footerColSpan&&g.footerColSpan>1?Math.min(g.footerColSpan,m.length-r):1;i.push((0,s.jsx)(d.TableCell,{align:g.align||"left",colSpan:y>1?y:void 0,style:{...y>1?{}:{width:g.width,minWidth:g.width},...g.style,fontWeight:"bold",padding:"16px"},children:g.footer?g.footer(l):null},String(g.id))),r+=y-1}return(0,s.jsx)(d.TableRow,{children:i})},[oe,m,l]),Ye=(0,c.useMemo)(()=>({Scroller:je,Table:i=>(0,s.jsx)(d.Table,{...i,sx:{borderCollapse:"separate",tableLayout:"fixed",marginRight:"16px",...oe?{height:"100%"}:{}}}),TableHead:(0,c.forwardRef)((i,r)=>(0,s.jsx)(d.TableHead,{...i,ref:r,sx:{userSelect:"none","& tr":{height:O,"& th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:i=>{let{item:r,selected:g,"aria-selected":y,className:b,...e}=i,B=e["data-index"]??0,W=B%2===1,t=r&&D.current?D.current(r,B):B,o=!de&&k!==null&&k!==void 0&&t===k,a=o&&v?typeof v=="function"?v(r,B):v:void 0,h=String(b??"").split(/\s+/).filter(f=>f!=="Mui-selected"&&f!=="Mui-focusVisible").join(" ");return(0,s.jsx)(d.TableRow,{...e,"data-row-id":t!=null?String(t):void 0,className:h||void 0,selected:o,onMouseDown:f=>{fe.current=!1,V.current={x:f.clientX,y:f.clientY}},onClick:f=>{let M=f.clientX-V.current.x,$=f.clientY-V.current.y;if(Math.sqrt(M*M+$*$)>Qe||fe.current){f.preventDefault(),f.stopPropagation(),fe.current=!1;return}r&&w.current&&w.current(r,B),fe.current=!1},sx:[{userSelect:"none",height:we,maxHeight:we,boxSizing:"border-box",backgroundColor:W&&He?He:"transparent","& td":{padding:"8px 16px",boxSizing:"border-box",borderBottom:J?"1px solid rgba(224, 224, 224, 1)":"none"},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":$e&&!o?{backgroundColor:f=>{let M=f.palette.mode==="dark",N=be??"#000000",te=q??.06;if(!be)return M?`rgba(255, 255, 255, ${te})`:`rgba(0, 0, 0, ${te})`;let ie=N.replace("#","").trim();if(ie.length!==6)return N;let K=parseInt(ie.substring(0,2),16),Ne=parseInt(ie.substring(2,4),16),Re=parseInt(ie.substring(4,6),16);return`rgba(${K}, ${Ne}, ${Re}, ${te})`}}:void 0,cursor:$e?"pointer":void 0},a]})},TableBody:(0,c.forwardRef)((i,r)=>{let{children:g,...y}=i;return(0,s.jsxs)(d.TableBody,{...y,ref:r,sx:oe?{height:"100%"}:void 0,children:[g,oe&&(0,s.jsx)("tr",{"aria-hidden":!0,style:{height:"100%"},children:(0,s.jsx)("td",{colSpan:m.length,style:{padding:0,border:0}})})]})}),TableFoot:(0,c.forwardRef)((i,r)=>(0,s.jsx)(d.TableFooter,{...i,ref:r,sx:[{"& tr":{height:ee??L,maxHeight:ee??L,boxSizing:"border-box"},"& td":{height:ee??L,boxSizing:"border-box",backgroundColor:g=>g.palette.mode==="dark"?"#1e1e1e":"#ffffff",padding:"0 16px",color:"inherit",fontSize:"0.875rem",border:"none",boxShadow:"inset 0 1px 0 0 #000000"}},...Array.isArray(ce)?ce:ce?[ce]:[]]}))}),[$e,de?null:k,v,L,He,J,O,be,q,je,ee,ce,oe,m]),De=(0,s.jsxs)(d.Box,{sx:{position:"relative",height:"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:i=>i.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"},...We??{}},children:[(0,s.jsx)(et.TableVirtuoso,{ref:Se,data:l,totalCount:Q?l.length+1:l.length,defaultItemHeight:we,fixedItemHeight:we,fixedHeaderContent:A,fixedFooterContent:oe?z:void 0,itemContent:_e,endReached:re,style:{height:"100%"},increaseViewportBy:{top:Ve,bottom:Fe},overscan:ve,followOutput:!1,components:Ye},Ae),l.length===0&&!p&&(0,s.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 ae=="string"?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Box,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),(0,s.jsx)(d.Typography,{variant:"body1",sx:{color:"text.secondary"},children:ae})]}):ae}),pe&&(0,s.jsx)(s.Fragment,{children:se?(0,s.jsx)(se,{visible:p,onComplete:ye}):(0,s.jsx)(Xe,{visible:p,onComplete:ye,size:40,indicator:(0,s.jsx)(Ue,{}),sx:{top:`${m.some(i=>i.group)?O*2:O}px`,bottom:`${oe?ee??L:0}px`},background:{show:l.length===0,opacity:.8}})})]});return me?(0,s.jsx)(d.Paper,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:u,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:De}):(0,s.jsx)(d.Box,{className:"grow",style:{padding:0,paddingLeft:u,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:De})}var tt=(0,c.memo)(vt);
|
|
24
|
+
`,document.head.appendChild(a),()=>{let h=document.getElementById(t);h&&h.remove()}},[]),(0,le.jsxs)("div",{ref:me,className:`overlay-scrollbar-wrapper ${i}`,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",...p},children:[(0,le.jsx)("div",{ref:u,className:"overlay-scrollbar-container",tabIndex:-1,onMouseDown:b,style:{display:"flex",width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",scrollbarWidth:"none",msOverflowStyle:"none",outline:"none",userSelect:ve?"none":"auto",...m},children:(0,le.jsx)("div",{ref:U,className:"overlay-scrollbar-content",style:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",...T},children:S})}),_&&Ee&&(0,le.jsxs)("div",{ref:ge,className:"overlay-scrollbar-track",onMouseEnter:()=>{A(),ye.current=setTimeout(()=>{H(!0),ye.current=null},100)},onMouseLeave:()=>{_e(),P||z(M.delay)},style:{position:"absolute",top:0,right:0,width:`${W}px`,height:"100%",opacity:Z?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[w.visible&&(0,le.jsx)("div",{className:"overlay-scrollbar-track-background",onClick:t=>{t.preventDefault(),t.stopPropagation(),r(t)},style:{position:"absolute",top:V?`${j.width+w.margin*2}px`:`${w.margin}px`,right:w.alignment==="right"?"0px":`${(W-j.width)/2}px`,width:`${j.width}px`,height:V?`calc(100% - ${j.width*2+w.margin*4}px)`:`calc(100% - ${w.margin*2}px)`,backgroundColor:w.color,borderRadius:`${w.radius}px`,cursor:"pointer"}}),(0,le.jsx)("div",{ref:be,className:"overlay-scrollbar-thumb",onMouseDown:Ye,onMouseEnter:()=>Le(!0),onMouseLeave:()=>Le(!1),style:{position:"absolute",top:`${(V?D+w.margin*2:w.margin)+Ve}px`,right:w.alignment==="right"?"0px":`${(W-D)/2}px`,width:`${D}px`,height:`${Math.max(ue,fe)}px`,backgroundColor:se||P?j.hoverColor:j.color,opacity:se||P?j.hoverOpacity:j.opacity,borderRadius:`${j.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),_&&Ee&&V&&(0,le.jsx)("div",{className:"overlay-scrollbar-up-arrow",onClick:g,onMouseEnter:()=>xe("up"),onMouseLeave:()=>xe(null),style:{position:"absolute",top:`${w.margin}px`,right:w.alignment==="right"?"0px":`${(W-D)/2}px`,width:`${D}px`,height:`${D}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(D*.75,8)}px`,color:x==="up"?Y.hoverColor:Y.color,userSelect:"none",zIndex:1001,opacity:Z?x==="up"?Y.hoverOpacity:Y.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),_&&Ee&&V&&(0,le.jsx)("div",{className:"overlay-scrollbar-down-arrow",onClick:y,onMouseEnter:()=>xe("down"),onMouseLeave:()=>xe(null),style:{position:"absolute",bottom:`${w.margin}px`,right:w.alignment==="right"?"0px":`${(W-D)/2}px`,width:`${D}px`,height:`${D}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(D*.75,8)}px`,color:x==="down"?Y.hoverColor:Y.color,userSelect:"none",zIndex:1001,opacity:Z?x==="down"?Y.hoverOpacity:Y.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"})]})}),Je=xt;var s=require("react/jsx-runtime"),yt={alignment:"right",margin:0,radius:0},Qe=5;function vt({data:i,loading:p=!1,columns:m,onRowClick:T,getRowId:S,selectedRowId:k,selectedRowSx:v,rowHeight:L=50,columnHeight:O=56,striped:G,rowDivider:J=!0,onSort:_,onLoadMore:Q,sortBy:F,sortDirection:X,showPaper:me=!0,paddingX:u="1rem",paddingTop:U=0,paddingBottom:ge=0,rowHoverColor:be,rowHoverOpacity:q,viewportBuffer:Z,overscan:H,scrollbars:P,emptyMessage:ae="NO DATA",LoadingComponent:se,showFooter:Le,footerHeight:ee,footerSx:ce}){let ue=Math.max(L*12,480),qe=Math.max(L*12,480),Ve=typeof Z=="number"?Z:Z?.top??ue,Fe=typeof Z=="number"?Z:Z?.bottom??qe,Ee=Math.max(L*8,420),Pe=Math.max(L*10,520),ve=typeof H=="number"?H:{main:H?.main??Ee,reverse:H?.reverse??Pe},we=L+(J?1:0),de=!v||typeof v!="function",We=(0,c.useMemo)(()=>!de||k===null||k===void 0||!v?null:{[`& tbody tr[data-row-id="${String(k).replace(/["\\]/g,"\\$&")}"]`]:v},[de,k,v]),rt=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),[I]=(0,c.useState)(()=>typeof window>"u"?!1:window.localStorage.getItem("vdt-perf-debug")==="1"),x=(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}),xe=(0,c.useCallback)(l=>{if(!I)return;let r=x.current;if(!(r.wheelEvents>0||r.rangeChangedCalls>0||r.rowContentCalls>0||r.cellRenderCalls>0))return;let y=r.rowContentCalls>0?r.rowContentMs/r.rowContentCalls:0,b=r.cellRenderCalls>0?r.cellRenderMs/r.cellRenderCalls:0;console.log("[VDT perf]",{reason:l,wheel:{events:r.wheelEvents,inputPx:Math.round(r.wheelInputPx),handlerMs:Number(r.wheelHandlerMs.toFixed(2)),rafFlushes:r.wheelRafFlushes,rafMs:Number(r.wheelRafMs.toFixed(2))},rangeChanged:{calls:r.rangeChangedCalls,totalMs:Number(r.rangeChangedMs.toFixed(2))},rowContent:{calls:r.rowContentCalls,totalMs:Number(r.rowContentMs.toFixed(2)),avgMs:Number(y.toFixed(3)),maxMs:Number(r.rowContentMaxMs.toFixed(3))},cellRender:{calls:r.cellRenderCalls,totalMs:Number(r.cellRenderMs.toFixed(2)),avgMs:Number(b.toFixed(3)),maxMs:Number(r.cellRenderMaxMs.toFixed(3))}}),x.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}},[I]);(0,c.useEffect)(()=>{if(!I||typeof window>"u")return;console.log("[VDT perf] enabled (localStorage vdt-perf-debug=1)");let l=window.setInterval(()=>{xe("interval")},1500);return()=>{window.clearInterval(l),xe("cleanup")}},[xe,I]);let je=(0,c.useMemo)(()=>(0,c.forwardRef)((l,r)=>{let g=(0,c.useRef)(null),y=(0,c.useRef)(0),b=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let e=g.current;if(!e)return;let B=W=>{let t=I?performance.now():0;W.preventDefault();let o=W.deltaY;W.deltaMode===1?o*=40:W.deltaMode===2&&(o*=e.clientHeight),I&&(x.current.wheelEvents+=1,x.current.wheelInputPx+=o),y.current+=o,b.current===null&&(b.current=requestAnimationFrame(()=>{let a=I?performance.now():0,h=Math.max(e.clientHeight*.4,160),f=Math.max(-h,Math.min(h,y.current));y.current=0,b.current=null,f!==0&&(e.scrollTop+=f),I&&(x.current.wheelRafFlushes+=1,x.current.wheelRafMs+=performance.now()-a)}),I&&(x.current.wheelHandlerMs+=performance.now()-t))};return e.addEventListener("wheel",B,{passive:!1}),()=>{e.removeEventListener("wheel",B),b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),y.current=0}},[]),(0,s.jsx)(Je,{detectInnerScroll:!0,track:yt,...P,children:(0,s.jsx)(d.TableContainer,{component:d.Box,...l,ref:e=>{g.current=e,typeof r=="function"?r(e):r&&(r.current=e)},sx:{userSelect:"auto",WebkitUserSelect:"auto",position:"relative",width:"100%",height:"100%",overflow:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none",msOverflowStyle:"none",transform:"translateZ(0)",backfaceVisibility:"hidden",willChange:"scroll-position","&::-webkit-scrollbar":{display:"none"},"& .MuiTable-root":{paddingRight:u,paddingTop:U,paddingBottom:ge}}})})}),[]),He=(0,c.useMemo)(()=>{if(G===!0)return"#f5f5f5";if(typeof G=="string")return G},[G]),[Me,Ie]=(0,c.useState)(p),[Ae,Ce]=(0,c.useState)(0);(0,c.useEffect)(()=>{p&&Ie(!0)},[p]);let ye=(0,c.useCallback)(()=>{Ie(!1)},[]),pe=Me,j=p&&i.length>0,w=(0,c.useRef)(!1),Y=(0,c.useRef)(-1),Se=(0,c.useRef)(null),M=(0,c.useRef)(T);M.current=T;let D=(0,c.useRef)(S);D.current=S;let $e=!!T,fe=(0,c.useRef)(!1),V=(0,c.useRef)({x:0,y:0});(0,c.useEffect)(()=>{let l=r=>{let g=r.clientX-V.current.x,y=r.clientY-V.current.y;Math.sqrt(g*g+y*y)>Qe&&(fe.current=!0)};return document.addEventListener("mousemove",l),()=>{document.removeEventListener("mousemove",l)}},[]),(0,c.useEffect)(()=>{let l=document.querySelector('[data-testid="virtuoso-scroller"]');l&&l.querySelectorAll(".MuiTableSortLabel-root").forEach(g=>{let y=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});g.dispatchEvent(y)})},[F]);let he=(0,c.useCallback)(l=>{if(!_)return;_(l,F===l&&X==="asc"?"desc":"asc")},[_,F,X]),re=(0,c.useCallback)(l=>{let r=I?performance.now():0;if(!Q){I&&(x.current.rangeChangedCalls+=1,x.current.rangeChangedMs+=performance.now()-r);return}if(p&&i.length===0){I&&(x.current.rangeChangedCalls+=1,x.current.rangeChangedMs+=performance.now()-r);return}let g=i.length>=30,y=l>=i.length-1,b=Y.current===i.length;if(y&&g&&!w.current&&!b){w.current=!0,Y.current=i.length;let e=i.length;Q(e,50)}I&&(x.current.rangeChangedCalls+=1,x.current.rangeChangedMs+=performance.now()-r)},[i.length,p,Q,I]);(0,c.useEffect)(()=>{w.current=!1},[i.length]),(0,c.useEffect)(()=>{p||(w.current=!1)},[p]),(0,c.useEffect)(()=>{i.length===0&&Ce(l=>l+1)},[i.length]);let R=(0,c.useRef)(i.length),ne=(0,c.useRef)(void 0);(0,c.useEffect)(()=>{let l=R.current,r=i.length,g=r>0?D.current?D.current(i[0],0):i[0]:void 0,y=ne.current;if(r>l&&l>0){R.current=r,ne.current=g;return}let b=r<l||l>0&&g!==y;Se.current&&r>0&&b&&Se.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),R.current=r,ne.current=g},[i]);let A=(0,c.useCallback)(()=>{let l={},r=[];if(m.forEach(e=>{e.group?(l[e.group]||(l[e.group]=[]),l[e.group].push(e)):r.push(e)}),!(Object.keys(l).length>0))return(0,s.jsx)(d.TableRow,{children:m.map(e=>(0,s.jsx)(d.TableCell,{align:e.align||"left",style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e.sortable?(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,s.jsxs)(d.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>he(String(e.id)),children:[e.text,(0,s.jsx)(d.TableSortLabel,{active:F===e.id,direction:F===e.id?X:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:F===e.id?1:0,transition:"opacity 0.2s ease","& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id)))});let y=[...r.map(e=>(0,s.jsx)(d.TableCell,{rowSpan:2,align:e.align||"left",style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e.sortable&&_?(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,s.jsxs)(d.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>he(String(e.id)),children:[e.text,(0,s.jsx)(d.TableSortLabel,{active:F===e.id,direction:F===e.id?X:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:F===e.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id))),...Object.entries(l).map(([e,B])=>(0,s.jsx)(d.TableCell,{align:"center",colSpan:B.length,style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e},e))],b=[...Object.values(l).flat().map(e=>(0,s.jsx)(d.TableCell,{align:e.align||"left",style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e.sortable&&_?(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,s.jsxs)(d.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>he(String(e.id)),children:[e.text,(0,s.jsx)(d.TableSortLabel,{active:F===e.id,direction:F===e.id?X:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:F===e.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(0deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(180deg)"}}})]})}):e.text},String(e.id)))];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.TableRow,{children:y}),(0,s.jsx)(d.TableRow,{children:b})]})},[m,F,X,he,_,O]),_e=(0,c.useCallback)((l,r)=>{let g=I?performance.now():0;if(!r){if(I){x.current.rowContentCalls+=1;let b=performance.now()-g;x.current.rowContentMs+=b,x.current.rowContentMaxMs=Math.max(x.current.rowContentMaxMs,b)}return null}let y=m.map(b=>{let e=I?performance.now():0,B=b.render?b.render(r,l):String(r[b.id]||"");if(I){let W=performance.now()-e;x.current.cellRenderCalls+=1,x.current.cellRenderMs+=W,x.current.cellRenderMaxMs=Math.max(x.current.cellRenderMaxMs,W)}return(0,s.jsx)(d.TableCell,{align:b.align||"left",style:{width:b.width,minWidth:b.width,...b.style,padding:"8px 16px"},children:B},String(b.id))});if(I){x.current.rowContentCalls+=1;let b=performance.now()-g;x.current.rowContentMs+=b,x.current.rowContentMaxMs=Math.max(x.current.rowContentMaxMs,b)}return(0,s.jsx)(s.Fragment,{children:y})},[m,I]),oe=Le??m.some(l=>typeof l.footer=="function"),z=(0,c.useCallback)(()=>{if(!oe)return null;let l=[];for(let r=0;r<m.length;r+=1){let g=m[r],y=g.footerColSpan&&g.footerColSpan>1?Math.min(g.footerColSpan,m.length-r):1;l.push((0,s.jsx)(d.TableCell,{align:g.align||"left",colSpan:y>1?y:void 0,style:{...y>1?{}:{width:g.width,minWidth:g.width},...g.style,fontWeight:"bold",padding:"16px"},children:g.footer?g.footer(i):null},String(g.id))),r+=y-1}return(0,s.jsx)(d.TableRow,{children:l})},[oe,m,i]),Ye=(0,c.useMemo)(()=>({Scroller:je,Table:l=>(0,s.jsx)(d.Table,{...l,sx:{borderCollapse:"separate",tableLayout:"fixed",marginRight:"16px",...oe?{height:"100%"}:{}}}),TableHead:(0,c.forwardRef)((l,r)=>(0,s.jsx)(d.TableHead,{...l,ref:r,sx:{userSelect:"none","& tr":{height:O,"& th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:l=>{let{item:r,selected:g,"aria-selected":y,className:b,...e}=l,B=e["data-index"]??0,W=B%2===1,t=r&&D.current?D.current(r,B):B,o=!de&&k!==null&&k!==void 0&&t===k,a=o&&v?typeof v=="function"?v(r,B):v:void 0,h=String(b??"").split(/\s+/).filter(f=>f!=="Mui-selected"&&f!=="Mui-focusVisible").join(" ");return(0,s.jsx)(d.TableRow,{...e,"data-row-id":t!=null?String(t):void 0,className:h||void 0,selected:o,onMouseDown:f=>{fe.current=!1,V.current={x:f.clientX,y:f.clientY}},onClick:f=>{let C=f.clientX-V.current.x,$=f.clientY-V.current.y;if(Math.sqrt(C*C+$*$)>Qe||fe.current){f.preventDefault(),f.stopPropagation(),fe.current=!1;return}r&&M.current&&M.current(r,B),fe.current=!1},sx:[{userSelect:"none",height:we,maxHeight:we,boxSizing:"border-box",backgroundColor:W&&He?He:"transparent","& td":{padding:"8px 16px",boxSizing:"border-box",borderBottom:J?"1px solid rgba(224, 224, 224, 1)":"none"},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":$e&&!o?{backgroundColor:f=>{let C=f.palette.mode==="dark",N=be??"#000000",te=q??.06;if(!be)return C?`rgba(255, 255, 255, ${te})`:`rgba(0, 0, 0, ${te})`;let ie=N.replace("#","").trim();if(ie.length!==6)return N;let K=parseInt(ie.substring(0,2),16),Ne=parseInt(ie.substring(2,4),16),Re=parseInt(ie.substring(4,6),16);return`rgba(${K}, ${Ne}, ${Re}, ${te})`}}:void 0,cursor:$e?"pointer":void 0},a]})},TableBody:(0,c.forwardRef)((l,r)=>{let{children:g,...y}=l;return(0,s.jsxs)(d.TableBody,{...y,ref:r,sx:oe?{height:"100%"}:void 0,children:[g,oe&&(0,s.jsx)("tr",{"aria-hidden":!0,style:{height:"100%"},children:(0,s.jsx)("td",{colSpan:m.length,style:{padding:0,border:0}})})]})}),TableFoot:(0,c.forwardRef)((l,r)=>(0,s.jsx)(d.TableFooter,{...l,ref:r,sx:[{"& tr":{height:ee??L,maxHeight:ee??L,boxSizing:"border-box"},"& td":{height:ee??L,boxSizing:"border-box",backgroundColor:g=>g.palette.mode==="dark"?"#1e1e1e":"#ffffff",padding:"0 16px",color:"inherit",fontSize:"0.875rem",border:"none",boxShadow:"inset 0 1px 0 0 #000000"}},...Array.isArray(ce)?ce:ce?[ce]:[]]}))}),[$e,de?null:k,v,L,He,J,O,be,q,je,ee,ce,oe,m]),De=(0,s.jsxs)(d.Box,{sx:{position:"relative",height:"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:l=>l.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"},...We??{}},children:[(0,s.jsx)(et.TableVirtuoso,{ref:Se,data:i,totalCount:Q?i.length+1:i.length,defaultItemHeight:we,fixedItemHeight:we,fixedHeaderContent:A,fixedFooterContent:oe?z:void 0,itemContent:_e,endReached:re,style:{height:"100%"},increaseViewportBy:{top:Ve,bottom:Fe},overscan:ve,followOutput:!1,components:Ye},Ae),i.length===0&&!p&&(0,s.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 ae=="string"?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Box,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),(0,s.jsx)(d.Typography,{variant:"body1",sx:{color:"text.secondary"},children:ae})]}):ae}),pe&&(0,s.jsx)(s.Fragment,{children:se?(0,s.jsx)(se,{visible:p,onComplete:ye}):(0,s.jsx)(Xe,{visible:p,onComplete:ye,size:40,indicator:(0,s.jsx)(Ue,{}),sx:{top:`${m.some(l=>l.group)?O*2:O}px`,bottom:`${oe?ee??L:0}px`},background:{show:i.length===0,opacity:.8}})})]});return me?(0,s.jsx)(d.Paper,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:u,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:De}):(0,s.jsx)(d.Box,{className:"grow",style:{padding:0,paddingLeft:u,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:De})}var tt=(0,c.memo)(vt);
|
|
25
25
|
/**
|
|
26
26
|
* Virtual Data Table - A high-performance virtual data table component for React
|
|
27
27
|
*
|