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