@ehfuse/mui-virtual-data-table 1.1.13 → 1.1.16
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 +3 -3
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 b in p)Ue(l,b,{get:p[b],enumerable:!0})},it=(l,p,b,x)=>{if(p&&typeof p=="object"||typeof p=="function")for(let M of rt(p))!nt.call(l,M)&&M!==b&&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"),m=require("@mui/material"),Qe=require("react-virtuoso");var We=require("react/jsx-runtime"),Te=require("react"),Ye=require("@mui/material"),Be=function(){return Be=Object.assign||function(p){for(var b,x=1,M=arguments.length;x<M;x++){b=arguments[x];for(var O in b)Object.prototype.hasOwnProperty.call(b,O)&&(p[O]=b[O])}return p},Be.apply(this,arguments)};function Ke(l){var p=l.visible,b=l.onComplete,x=l.fadeoutDuration,M=x===void 0?200:x,O=l.exitDelay,S=O===void 0?0:O,I=l.size,$=I===void 0?40:I,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,de=(0,Te.useRef)(void 0),d=(0,Te.useRef)(null),U=(0,Te.useState)(p),pe=U[0],be=U[1],A=G.show,X=A===void 0?!0:A,C=G.color,B=C===void 0?"255, 255, 255":C,ie=G.opacity,le=ie===void 0?.9:ie;if((0,Te.useEffect)(function(){var Ee=de.current;if(Ee===!0&&p===!1&&d.current){var ae=d.current;ae.style.opacity="0",setTimeout(function(){be(!1),b?.()},M+S)}else p===!0&&(be(!0),d.current&&(d.current.style.opacity="1"));de.current=p},[p,b,M,S]),!pe)return null;var Se=function(){return typeof _=="string"?(0,We.jsx)("img",{src:_,alt:"Loading",style:{width:$,height:$}}):_||(0,We.jsx)(Ye.CircularProgress,{size:$})},ye=function(){return X?B.startsWith("rgba")?{backgroundColor:B}:/^\d+,\s*\d+,\s*\d+$/.test(B)?{backgroundColor:"rgba(".concat(B,", ").concat(le,")")}:le!==1?{backgroundColor:B,"&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:B,opacity:le,zIndex:-1}}:{backgroundColor:B}:{backgroundColor:"transparent"}};return(0,We.jsx)(Ye.Box,{ref:d,className:F,style:Be({},J),sx:Be(Be({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")},ye()),q),children:Se()})}var r=require("react"),oe=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 b=l.tagName.toLowerCase(),x=["text","password","email","number","search","tel","url","checkbox","radio"];if(b==="input"){let M=l.type;return x.includes(M)}if(["textarea","select","button"].includes(b)||["svg","path","circle","rect","line","polygon","polyline"].includes(b)||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 b=[...at,...p?.excludeClasses||[]],x=l,M=0,O=5;for(;x&&M<=O;){if(b.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:b={},contentStyle:x={},children:M,onScroll:O,thumb:S=ct,track:I=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:I,arrows:$,dragScroll:F,autoHide:J}});let de=(0,r.useRef)(null),d=(0,r.useRef)(null),U=(0,r.useRef)(null),pe=(0,r.useRef)(null),be=(0,r.useRef)(null),A=(0,r.useRef)(null),[X,C]=(0,r.useState)(!1),[B,ie]=(0,r.useState)(!1),[le,Se]=(0,r.useState)(!1),[ye,Ee]=(0,r.useState)({y:0,scrollTop:0}),[ae,qe]=(0,r.useState)(0),[Ve,je]=(0,r.useState)(0),[He,Re]=(0,r.useState)(!1),[se,Ae]=(0,r.useState)(!1),[ve,Fe]=(0,r.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[Xe,_e]=(0,r.useState)(null),[Ce,Ie]=(0,r.useState)(null),[ze,Oe]=(0,r.useState)(!1),z=(0,r.useRef)(null),[ce,$e]=(0,r.useState)(!1),fe=(0,r.useRef)(null),me=(0,r.useRef)(null),K=(0,r.useRef)(null),P=(0,r.useMemo)(()=>{let t=S.color??"#606060";return{width:S.width??8,minHeight:S.minHeight??50,radius:S.radius??(S.width??8)/2,color:t,opacity:S.opacity??.6,hoverColor:S.hoverColor??t,hoverOpacity:S.hoverOpacity??1}},[S]),w=(0,r.useMemo)(()=>({width:I.width??16,color:I.color??"rgba(128, 128, 128, 0.1)",visible:I.visible??!0,alignment:I.alignment??"center",radius:I.radius??P.radius??4,margin:I.margin??4}),[I,P.radius]),Z=(0,r.useMemo)(()=>{let t=$.color??"#808080";return{visible:$.visible??!1,step:$.step??50,color:t,opacity:$.opacity??.6,hoverColor:$.hoverColor??t,hoverOpacity:$.hoverOpacity??1}},[$]),Ne=(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,ke=w.width,Pe=P.minHeight,V=Z.visible,Le=Z.step,ne=(0,r.useCallback)(()=>{if(!d.current)return;let t=document.activeElement;t&&d.current.contains(t)&&t!==d.current||d.current.focus()},[]);(0,r.useImperativeHandle)(N,()=>({getScrollContainer:()=>d.current,scrollTo:t=>{d.current&&d.current.scrollTo(t)},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(A.current){let o=A.current;if(document.contains(o)&&o.scrollHeight>o.clientHeight+2)return o;A.current=null}if(!d.current)return null;if(U.current&&U.current.scrollHeight>d.current.clientHeight+2)return A.current=d.current,d.current;if(!_)return null;let t=d.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let o of t){let i=o;if(i!==d.current&&i.classList.contains("overlay-scrollbar-container"))continue;let u=i.parentElement,h=!1;for(;u&&u!==d.current;){if(u.classList.contains("overlay-scrollbar-container")&&u!==d.current){h=!0;break}u=u.parentElement}if(!h&&i.scrollHeight>i.clientHeight+2)return A.current=i,i}return null},[]),ue=(0,r.useCallback)(()=>H()!==null,[H]),n=(0,r.useCallback)(()=>{fe.current&&(clearTimeout(fe.current),fe.current=null)},[]),c=(0,r.useCallback)(()=>{me.current&&(clearTimeout(me.current),me.current=null)},[]),R=(0,r.useCallback)(()=>{K.current&&(clearTimeout(K.current),K.current=null)},[]),y=(0,r.useCallback)(t=>{v.enabled&&(n(),fe.current=setTimeout(()=>{C(!1),fe.current=null},t))},[n,v.enabled]),f=(0,r.useCallback)(()=>{let t=H();if(!t){C(!1),Re(!1),n();return}if(Re(!0),!pe.current)return;v.enabled||(C(!0),n());let o=t.clientHeight,i=t.scrollHeight,u=t.scrollTop,h=0;if(de.current){let D=window.getComputedStyle(de.current),te=parseFloat(D.paddingTop)||0,re=parseFloat(D.paddingBottom)||0;h=te+re}let g=V?E*2+w.margin*4:w.margin*2,T=o-g+h,k=o/i,Y=Math.max(T*k,Pe),ee=i-o,L=T-Y,we=ee>0?u/ee*L:0;qe(Y),je(we)},[H,n,V,E,Pe,v.enabled]),e=(0,r.useCallback)(t=>{t.preventDefault(),t.stopPropagation();let o=H();o&&(ie(!0),Ee({y:t.clientY,scrollTop:o.scrollTop}),n(),C(!0),ne())},[H,n,ne]),j=(0,r.useCallback)(t=>{if(!B)return;let o=H();if(!o)return;let i=o.clientHeight,u=o.scrollHeight-i,h=t.clientY-ye.y,g=i-ae,T=h/g*u,k=Math.max(0,Math.min(u,ye.scrollTop+T));o.scrollTop=k,f()},[B,ye,ae,f,H]),Q=(0,r.useCallback)(()=>{ie(!1),ue()&&y(v.delay)},[ue,y,v.delay]),xe=(0,r.useCallback)(t=>{if(!pe.current)return;let o=pe.current.getBoundingClientRect(),i=t.clientY-o.top,u=H();if(!u)return;let h=u.clientHeight,g=u.scrollHeight,T=i/h*(g-h);u.scrollTop=Math.max(0,Math.min(g-h,T)),f(),C(!0),y(v.delay),ne()},[f,y,v.delay,H,ne]),he=(0,r.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!d.current)return;let o=Math.max(0,d.current.scrollTop-Le);d.current.scrollTop=o,f(),C(!0),y(v.delay),ne()},[f,y,Le,v.delay,ne]),De=(0,r.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!d.current||!U.current)return;let o=d.current,i=U.current.scrollHeight-o.clientHeight,u=Math.min(i,o.scrollTop+Le);o.scrollTop=u,f(),C(!0),y(v.delay),ne()},[f,y,Le,v.delay,ne]),Ge=(0,r.useCallback)(t=>{if(!Ne.enabled)return;let o=t.target;if(Je(o,Ne)||t.button!==0)return;let i=H();i&&(i.scrollHeight<=i.clientHeight||(t.preventDefault(),Ae(!0),Fe({x:t.clientX,y:t.clientY,scrollTop:i.scrollTop,scrollLeft:i.scrollLeft||0}),n()))},[Ne,Je,H,n]),W=(0,r.useCallback)(t=>{if(!se)return;let o=H();if(!o)return;let i=ve.x-t.clientX,u=ve.y-t.clientY;if(Math.abs(u)<3&&Math.abs(i)<3)return;C(!0);let h=Math.max(0,Math.min(o.scrollHeight-o.clientHeight,ve.scrollTop+u));o.scrollTop=h,f()},[se,ve,H,f]),Me=(0,r.useCallback)(()=>{Ae(!1),ue()&&y(v.delay)},[ue,y,v.delay]);(0,r.useEffect)(()=>{let t=g=>{f(),n(),C(!0);let T=ce?v.delayOnWheel:v.delay;y(T),O&&O(g)},o=()=>{$e(!0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{$e(!1)},300),n(),R(),K.current=setTimeout(()=>{C(!0),K.current=null},50)},i=[],u=H();u&&i.push(u);let h=d.current;return h&&!u&&(i.push(h),h.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(g=>{let T=g;if(T!==h&&T.classList.contains("overlay-scrollbar-container"))return;let k=T.parentElement;for(;k&&k!==h;){if(k.classList.contains("overlay-scrollbar-container")&&k!==h)return;k=k.parentElement}i.push(T)})),i.forEach(g=>{g.addEventListener("scroll",t,{passive:!0}),g.addEventListener("wheel",o,{passive:!0})}),()=>{i.forEach(g=>{g.removeEventListener("scroll",t),g.removeEventListener("wheel",o)}),z.current&&clearTimeout(z.current),K.current&&clearTimeout(K.current)}},[H,f,O,n,y,v,ce]),(0,r.useEffect)(()=>{let t=i=>{let u=H();if(!u)return;let{key:h}=i,{scrollTop:g,scrollHeight:T,clientHeight:k}=u,Y=T-k,ee=50,L=null;switch(h){case"ArrowUp":i.preventDefault(),L=Math.max(0,g-ee);break;case"ArrowDown":i.preventDefault(),L=Math.min(Y,g+ee);break;case"PageUp":i.preventDefault(),L=Math.max(0,g-k);break;case"PageDown":i.preventDefault(),L=Math.min(Y,g+k);break;case"Home":i.preventDefault(),L=0;break;case"End":i.preventDefault(),L=Y;break;default:return}if(L!==null){let we=L/Y,D=V?E*2+w.margin*4:w.margin*2,te=(k-D-ae)*we;je(te),u.scrollTop=L,n(),C(!0),y(v.delay)}},o=d.current;if(o)return o.addEventListener("keydown",t),()=>{o.removeEventListener("keydown",t)}},[H,V,E,w.margin,ae,n,y,v.delay]),(0,r.useEffect)(()=>{if(se)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",Me),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",Me)}},[se,W,Me]),(0,r.useEffect)(()=>{if(B)return document.addEventListener("mousemove",j),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",Q)}},[B,j,Q]),(0,r.useEffect)(()=>{f();let t=setTimeout(()=>{f()},100);return()=>clearTimeout(t)},[f]),(0,r.useLayoutEffect)(()=>{Oe(!0),f(),!v.enabled&&ue()&&C(!0)},[ue,f,v.enabled]),(0,r.useEffect)(()=>{let t=new ResizeObserver(()=>{f()}),o=[];return d.current&&o.push(d.current),U.current&&o.push(U.current),A.current&&document.contains(A.current)&&o.push(A.current),o.forEach(i=>{t.observe(i)}),()=>t.disconnect()},[f]),(0,r.useEffect)(()=>{if(!d.current)return;let t=new MutationObserver(()=>{A.current=null,f()});return t.observe(d.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[f]);let ge=Math.max(ke,E);return(0,r.useEffect)(()=>{let t="overlay-scrollbar-webkit-hide",o=document.getElementById(t);o&&o.remove();let i=document.createElement("style");return i.id=t,i.textContent=`
|
|
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=`
|
|
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(t);u&&u.remove()}},[]),(0,oe.jsxs)("div",{ref:de,className:`overlay-scrollbar-wrapper ${l}`,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",...p},children:[(0,oe.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:se?"none":"auto",...b},children:(0,oe.jsx)("div",{ref:U,className:"overlay-scrollbar-content",style:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",...x},children:M})}),q&&He&&(0,oe.jsxs)("div",{ref:pe,className:"overlay-scrollbar-track",onMouseEnter:()=>{n(),me.current=setTimeout(()=>{C(!0),me.current=null},100)},onMouseLeave:()=>{c(),B||y(v.delay)},style:{position:"absolute",top:0,right:0,width:`${ge}px`,height:"100%",opacity:X?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[w.visible&&(0,oe.jsx)("div",{className:"overlay-scrollbar-track-background",onClick:t=>{t.preventDefault(),t.stopPropagation(),xe(t)},style:{position:"absolute",top:V?`${P.width+w.margin*2}px`:`${w.margin}px`,right:w.alignment==="right"?"0px":`${(ge-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,oe.jsx)("div",{ref:be,className:"overlay-scrollbar-thumb",onMouseDown:e,onMouseEnter:()=>Se(!0),onMouseLeave:()=>Se(!1),style:{position:"absolute",top:`${(V?E+w.margin*2:w.margin)+Ve}px`,right:w.alignment==="right"?"0px":`${(ge-E)/2}px`,width:`${E}px`,height:`${Math.max(ae,Pe)}px`,backgroundColor:le||B?P.hoverColor:P.color,opacity:le||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&&He&&V&&(0,oe.jsx)("div",{className:"overlay-scrollbar-up-arrow",onClick:he,onMouseEnter:()=>Ie("up"),onMouseLeave:()=>Ie(null),style:{position:"absolute",top:`${w.margin}px`,right:w.alignment==="right"?"0px":`${(ge-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:Ce==="up"?Z.hoverColor:Z.color,userSelect:"none",zIndex:1001,opacity:X?Ce==="up"?Z.hoverOpacity:Z.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),q&&He&&V&&(0,oe.jsx)("div",{className:"overlay-scrollbar-down-arrow",onClick:De,onMouseEnter:()=>Ie("down"),onMouseLeave:()=>Ie(null),style:{position:"absolute",bottom:`${w.margin}px`,right:w.alignment==="right"?"0px":`${(ge-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:Ce==="down"?Z.hoverColor:Z.color,userSelect:"none",zIndex:1001,opacity:X?Ce==="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:b,onRowClick:x,getRowId:M,selectedRowId:O,selectedRowSx:S,rowHeight:I=50,columnHeight:$=56,striped:F,rowDivider:J=!0,onSort:q,onLoadMore:_,sortBy:N,sortDirection:G,showPaper:de=!0,paddingX:d="1rem",paddingTop:U=0,paddingBottom:pe=0,rowHoverColor:be,rowHoverOpacity:A,viewportBuffer:X,overscan:C,scrollbars:B,emptyMessage:ie="NO DATA",LoadingComponent:le}){let Se=Math.max(I*12,480),ye=Math.max(I*12,480),Ee=typeof X=="number"?X:X?.top??Se,ae=typeof X=="number"?X:X?.bottom??ye,qe=Math.max(I*8,420),Ve=Math.max(I*10,520),je=typeof C=="number"?C:{main:C?.main??qe,reverse:C?.reverse??Ve},He=I+(J?1:0),Re=(0,a.useMemo)(()=>(0,a.forwardRef)((n,c)=>{let R=(0,a.useRef)(null),y=(0,a.useRef)(0),f=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=R.current;if(!e)return;let j=Q=>{Q.preventDefault();let xe=Q.deltaY;Q.deltaMode===1?xe*=40:Q.deltaMode===2&&(xe*=e.clientHeight),y.current+=xe,f.current===null&&(f.current=requestAnimationFrame(()=>{let he=Math.max(e.clientHeight*.8,240),De=Math.max(-he,Math.min(he,y.current));y.current=0,f.current=null,De!==0&&(e.scrollTop+=De)}))};return e.addEventListener("wheel",j,{passive:!1}),()=>{e.removeEventListener("wheel",j),f.current!==null&&(cancelAnimationFrame(f.current),f.current=null),y.current=0}},[]),(0,s.jsx)(Ze,{detectInnerScroll:!0,track:ht,...B,children:(0,s.jsx)(m.TableContainer,{component:m.Box,...n,ref:e=>{R.current=e,typeof c=="function"?c(e):c&&(c.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:U,paddingBottom:pe}}})})}),[]),se=(0,a.useMemo)(()=>{if(F===!0)return"#f5f5f5";if(typeof F=="string")return F},[F]),[Ae,ve]=(0,a.useState)(p),[Fe,Xe]=(0,a.useState)(0);(0,a.useEffect)(()=>{p&&ve(!0)},[p]);let _e=(0,a.useCallback)(()=>{ve(!1)},[]),Ce=Ae,Ie=p&&l.length>0,ze=(0,a.useRef)(!1),Oe=(0,a.useRef)(null),z=(0,a.useRef)(null),ce=(0,a.useRef)(!1),$e=(0,a.useRef)({x:0,y:0,scrollTop:0}),fe=(0,a.useRef)(!1),me=(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),Ne=(0,a.useCallback)(n=>{},[]),v=(0,a.useCallback)(n=>{if(!fe.current||!z.current)return;let c=n.clientY-$e.current.y;if(!ce.current&&Math.abs(c)>5&&(ce.current=!0,z.current&&(z.current.style.userSelect="none")),ce.current){let y=c*2;K.current+=-y;let f=z.current,e=Math.max(0,me.current+K.current);f.scrollTop=e,$e.current.y=n.clientY,n.preventDefault()}},[]),E=(0,a.useCallback)(()=>{if(fe.current=!1,ce.current&&z.current){let n=Math.max(0,me.current+K.current),c=()=>{z.current&&(z.current.scrollTop=n)};c(),setTimeout(c,1),setTimeout(c,5),setTimeout(c,10)}ce.current=!1,K.current=0,z.current&&(z.current.style.userSelect="auto")},[]);(0,a.useEffect)(()=>{let n=document.querySelector('[data-testid="virtuoso-scroller"]');n&&n.querySelectorAll(".MuiTableSortLabel-root").forEach(R=>{let y=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});R.dispatchEvent(y)})},[N]);let ke=(0,a.useCallback)(n=>{if(!q)return;q(n,N===n&&G==="asc"?"desc":"asc")},[q,N,G]),Pe=(0,a.useCallback)(n=>{if(!_||p&&l.length===0)return;let c=Date.now(),R=window.lastRangeChangeTime||0;if(c-R<100)return;window.lastRangeChangeTime=c;let y=Math.max(10,Math.floor(l.length*.1)),f=n.endIndex>=l.length-y,e=l.length>=30;if(f&&e&&_&&!ze.current){ze.current=!0;let j=l.length;_(j,50)}},[l.length,p,_]);(0,a.useEffect)(()=>{p||(ze.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}Oe.current&&c>0&&c<=n&&Oe.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 Le=(0,a.useCallback)(()=>{let n={},c=[];if(b.forEach(e=>{e.group?(n[e.group]||(n[e.group]=[]),n[e.group].push(e)):c.push(e)}),!(Object.keys(n).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:()=>ke(String(e.id)),children:[e.text,(0,s.jsx)(m.TableSortLabel,{active:N===e.id,direction:N===e.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===e.id?1:0,transition:"opacity 0.2s ease","& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id)))});let y=[...c.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&&q?(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:()=>ke(String(e.id)),children:[e.text,(0,s.jsx)(m.TableSortLabel,{active:N===e.id,direction:N===e.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===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(n).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(n).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&&q?(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:()=>ke(String(e.id)),children:[e.text,(0,s.jsx)(m.TableSortLabel,{active:N===e.id,direction:N===e.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===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:y}),(0,s.jsx)(m.TableRow,{children:f})]})},[b,N,G,ke,q,$]),ne=(0,a.useCallback)((n,c)=>c?(0,s.jsx)(s.Fragment,{children:b.map(R=>(0,s.jsx)(m.TableCell,{align:R.align||"left",style:{width:R.width,minWidth:R.width,...R.style,padding:"8px 16px"},children:R.render?R.render(c,n):String(c[R.id]||"")},String(R.id)))}):(console.log("rowContent - \uC544\uC774\uD15C \uC5C6\uC74C, \uC778\uB371\uC2A4:",n),null),[b]),H=(0,a.useMemo)(()=>({Scroller:Re,Table:n=>(0,s.jsx)(m.Table,{...n,sx:{borderCollapse:"separate",tableLayout:"fixed",marginRight:"16px"}}),TableHead:(0,a.forwardRef)((n,c)=>(0,s.jsx)(m.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:R,"aria-selected":y,className:f,...e}=n,j=e["data-index"]??0,Q=j%2===1,xe=c&&M?M(c,j):j,he=O!=null&&xe===O,De=he&&S?typeof S=="function"?S(c,j):S:void 0,Ge=String(f??"").split(/\s+/).filter(W=>W!=="Mui-selected"&&W!=="Mui-focusVisible").join(" ");return(0,s.jsx)(m.TableRow,{...e,className:Ge||void 0,selected:he,onMouseDown:W=>{P.current=!1,w.current={x:W.clientX,y:W.clientY}},onMouseMove:W=>{let Me=Math.abs(W.clientX-w.current.x),ge=Math.abs(W.clientY-w.current.y),t=5;(Me>t||ge>t)&&(P.current=!0)},onClick:()=>{!P.current&&!ce.current&&c&&x&&x(c,j),P.current=!1},sx:[{userSelect:"none",height:I,backgroundColor:Q&&se?se:"transparent","& td":{padding:"8px 16px",borderBottom:J?"1px solid rgba(224, 224, 224, 1)":"none"},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":x&&!he?{backgroundColor:W=>{let Me=W.palette.mode==="dark",t=be??"#000000",o=A??.06,i=t.replace("#",""),u=parseInt(i.substring(0,2),16)/255,h=parseInt(i.substring(2,4),16)/255,g=parseInt(i.substring(4,6),16)/255;if(Me){let T=Math.max(u,h,g),k=Math.min(u,h,g),Y=0,ee=0,L=(T+k)/2;if(T!==k){let D=T-k;switch(ee=L>.5?D/(2-T-k):D/(T+k),T){case u:Y=((h-g)/D+(h<g?6:0))/6;break;case h:Y=((g-u)/D+2)/6;break;case g:Y=((u-h)/D+4)/6;break}}L=1-L;let we=(D,te,re)=>(re<0&&(re+=1),re>1&&(re-=1),re<1/6?D+(te-D)*6*re:re<1/2?te:re<2/3?D+(te-D)*(2/3-re)*6:D);if(ee===0)u=h=g=L;else{let D=L<.5?L*(1+ee):L+ee-L*ee,te=2*L-D;u=we(te,D,Y+1/3),h=we(te,D,Y),g=we(te,D,Y-1/3)}}return`rgba(${Math.round(u*255)}, ${Math.round(h*255)}, ${Math.round(g*255)}, ${o})`}}:void 0,cursor:x?"pointer":void 0},De]})},TableBody:(0,a.forwardRef)((n,c)=>(0,s.jsx)(m.TableBody,{...n,ref:c}))}),[x,M,O,S,I,Ne,se,J,$,be,A,Re]),ue=(0,s.jsxs)(m.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:Oe,data:l,totalCount:_?l.length+1:l.length,defaultItemHeight:He,fixedHeaderContent:Le,itemContent:ne,rangeChanged:Pe,components:H,style:{height:"100%"},increaseViewportBy:{top:Ee,bottom:ae},overscan:je,followOutput:!1},Fe),l.length===0&&!p&&(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 ie=="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:ie})]}):ie}),Ce&&(0,s.jsx)(s.Fragment,{children:le?(0,s.jsx)(le,{visible:p,onComplete:_e}):(0,s.jsx)(Ke,{visible:p,onComplete:_e,size:40,sx:{top:`${b.some(n=>n.group)?$*2:$}px`},background:{show:l.length===0,opacity:.8}})})]});return de?(0,s.jsx)(m.Paper,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:d,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:ue}):(0,s.jsx)(m.Box,{className:"grow",style:{padding:0,paddingLeft:d,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:ue})}var et=(0,a.memo)(gt);
|
|
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);
|
|
22
22
|
/**
|
|
23
23
|
* Virtual Data Table - A high-performance virtual data table component for React
|
|
24
24
|
*
|