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