@ehfuse/mui-virtual-data-table 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{forwardRef as et,useCallback as ge,useMemo as tt,useRef as W,useEffect as He,memo as Lt,useState as ut}from"react";import{Box as be,Table as Dt,TableBody as Et,TableCell as Ve,TableContainer as Ht,TableHead as Rt,TableRow as Ue,TableSortLabel as rt,Paper as It,Typography as $t}from"@mui/material";import{TableVirtuoso as Ot}from"react-virtuoso";import{jsx as Qe}from"react/jsx-runtime";import{useRef as it,useState as pt,useEffect as ft}from"react";import{Box as mt,CircularProgress as ht}from"@mui/material";var Ye=function(){return Ye=Object.assign||function(f){for(var h,y=1,M=arguments.length;y<M;y++){h=arguments[y];for(var S in h)Object.prototype.hasOwnProperty.call(h,S)&&(f[S]=h[S])}return f},Ye.apply(this,arguments)};function lt(a){var f=a.visible,h=a.onComplete,y=a.fadeoutDuration,M=y===void 0?200:y,S=a.exitDelay,C=S===void 0?0:S,H=a.size,R=H===void 0?40:H,Q=a.className,N=a.style,Y=a.sx,w=a.indicator,G=a.background,ye=G===void 0?{show:!0,color:"255, 255, 255",opacity:.9}:G,ee=it(void 0),s=it(null),q=pt(f),ne=q[0],xe=q[1],j=ye.show,ie=j===void 0?!0:j,T=ye.color,k=T===void 0?"255, 255, 255":T,le=ye.opacity,fe=le===void 0?.9:le;if(ft(function(){var Ie=ee.current;if(Ie===!0&&f===!1&&s.current){var te=s.current;te.style.opacity="0",setTimeout(function(){xe(!1),h?.()},M+C)}else f===!0&&(xe(!0),s.current&&(s.current.style.opacity="1"));ee.current=f},[f,h,M,C]),!ne)return null;var ve=function(){return typeof w=="string"?Qe("img",{src:w,alt:"Loading",style:{width:R,height:R}}):w||Qe(ht,{size:R})},we=function(){return ie?k.startsWith("rgba")?{backgroundColor:k}:/^\d+,\s*\d+,\s*\d+$/.test(k)?{backgroundColor:"rgba(".concat(k,", ").concat(fe,")")}:fe!==1?{backgroundColor:k,"&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:k,opacity:fe,zIndex:-1}}:{backgroundColor:k}:{backgroundColor:"transparent"}};return Qe(mt,{ref:s,className:Q,style:Ye({},N),sx:Ye(Ye({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,opacity:f?1:0,transition:"opacity ".concat(M,"ms ease-out")},we()),Y),children:ve()})}import{useRef as Z,useEffect as pe,useState as A,useCallback as $,useMemo as qe,forwardRef as gt,useImperativeHandle as bt,useLayoutEffect as yt}from"react";import{jsx as Ee,jsxs as st}from"react/jsx-runtime";var xt=["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"],at=(a,f)=>{let h=a.tagName.toLowerCase(),y=["text","password","email","number","search","tel","url","checkbox","radio"];if(h==="input"){let M=a.type;return y.includes(M)}if(["textarea","select","button"].includes(h)||["svg","path","circle","rect","line","polygon","polyline"].includes(h)||a.getAttribute("contenteditable")==="true")return!0;if(f?.excludeSelectors){for(let M of f.excludeSelectors)if(a.matches(M))return!0}return vt(a,f)},vt=(a,f)=>{let h=[...xt,...f?.excludeClasses||[]],y=a,M=0,S=5;for(;y&&M<=S;){if(h.some(C=>y.classList.contains(C)))return!0;if(y.classList.contains("MuiDialogContent-root"))break;y=y.parentElement,M++}return!1},wt={},Mt={},Tt={},St={},Ct={},kt=gt(({className:a="",style:f={},containerStyle:h={},contentStyle:y={},children:M,onScroll:S,thumb:C=wt,track:H=Mt,arrows:R=Tt,dragScroll:Q=St,autoHide:N=Ct,showScrollbar:Y=!0,detectInnerScroll:w=!1},G)=>{let ye=Z({});pe(()=>{ye.current={children:M,onScroll:S,showScrollbar:Y,thumb:C,track:H,arrows:R,dragScroll:Q,autoHide:N}});let ee=Z(null),s=Z(null),q=Z(null),ne=Z(null),xe=Z(null),j=Z(null),[ie,T]=A(!1),[k,le]=A(!1),[fe,ve]=A(!1),[we,Ie]=A({y:0,scrollTop:0}),[te,Ke]=A(0),[ot,De]=A(0),[Me,V]=A(!1),[F,$e]=A(!1),[Te,Fe]=A({x:0,y:0,scrollTop:0,scrollLeft:0}),[Oe,Pe]=A(null),[me,Be]=A(null),[nt,Ne]=A(!1),ae=Z(null),[Se,_e]=A(!1),se=Z(null),Ce=Z(null),ce=Z(null),O=qe(()=>{let e=C.color??"#606060";return{width:C.width??8,minHeight:C.minHeight??50,radius:C.radius??(C.width??8)/2,color:e,opacity:C.opacity??.6,hoverColor:C.hoverColor??e,hoverOpacity:C.hoverOpacity??1}},[C]),g=qe(()=>({width:H.width??16,color:H.color??"rgba(128, 128, 128, 0.1)",visible:H.visible??!0,alignment:H.alignment??"center",radius:H.radius??O.radius??4,margin:H.margin??4}),[H,O.radius]),r=qe(()=>{let e=R.color??"#808080";return{visible:R.visible??!1,step:R.step??50,color:e,opacity:R.opacity??.6,hoverColor:R.hoverColor??e,hoverOpacity:R.hoverOpacity??1}},[R]),i=qe(()=>({enabled:Q.enabled??!0,excludeClasses:Q.excludeClasses??[],excludeSelectors:Q.excludeSelectors??[]}),[Q]),l=qe(()=>({enabled:N.enabled??!0,delay:N.delay??1500,delayOnWheel:N.delayOnWheel??700}),[N]),c=O.width,ue=g.width,t=O.minHeight,L=r.visible,D=r.step,_=$(()=>{if(!s.current)return;let e=document.activeElement;e&&s.current.contains(e)&&e!==s.current||s.current.focus()},[]);bt(G,()=>({getScrollContainer:()=>s.current,scrollTo:e=>{s.current&&s.current.scrollTo(e)},get scrollTop(){return s.current?.scrollTop||0},get scrollHeight(){return s.current?.scrollHeight||0},get clientHeight(){return s.current?.clientHeight||0}}),[]);let x=$(()=>{if(j.current){let o=j.current;if(document.contains(o)&&o.scrollHeight>o.clientHeight+2)return o;j.current=null}if(!s.current)return null;if(q.current&&q.current.scrollHeight>s.current.clientHeight+2)return j.current=s.current,s.current;if(!w)return null;let e=s.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let o of e){let n=o;if(n!==s.current&&n.classList.contains("overlay-scrollbar-container"))continue;let u=n.parentElement,b=!1;for(;u&&u!==s.current;){if(u.classList.contains("overlay-scrollbar-container")&&u!==s.current){b=!0;break}u=u.parentElement}if(!b&&n.scrollHeight>n.clientHeight+2)return j.current=n,n}return null},[]),U=$(()=>x()!==null,[x]),I=$(()=>{se.current&&(clearTimeout(se.current),se.current=null)},[]),je=$(()=>{Ce.current&&(clearTimeout(Ce.current),Ce.current=null)},[]),re=$(()=>{ce.current&&(clearTimeout(ce.current),ce.current=null)},[]),m=$(e=>{l.enabled&&(I(),se.current=setTimeout(()=>{T(!1),se.current=null},e))},[I,l.enabled]),d=$(()=>{let e=x();if(!e){T(!1),V(!1),I();return}if(V(!0),!ne.current)return;l.enabled||(T(!0),I());let o=e.clientHeight,n=e.scrollHeight,u=e.scrollTop,b=0;if(ee.current){let Ge=window.getComputedStyle(ee.current),Ze=parseFloat(Ge.paddingTop)||0,dt=parseFloat(Ge.paddingBottom)||0;b=Ze+dt}let v=L?c*2+g.margin*4:g.margin*2,P=o-v+b,B=o/n,Le=Math.max(P*B,t),We=n-o,J=P-Le,Je=We>0?u/We*J:0;Ke(Le),De(Je)},[x,I,L,c,t,l.enabled]),he=$(e=>{e.preventDefault(),e.stopPropagation();let o=x();o&&(le(!0),Ie({y:e.clientY,scrollTop:o.scrollTop}),I(),T(!0),_())},[x,I,_]),de=$(e=>{if(!k)return;let o=x();if(!o)return;let n=o.clientHeight,u=o.scrollHeight-n,b=e.clientY-we.y,v=n-te,P=b/v*u,B=Math.max(0,Math.min(u,we.scrollTop+P));o.scrollTop=B,d()},[k,we,te,d,x]),oe=$(()=>{le(!1),U()&&m(l.delay)},[U,m,l.delay]),ke=$(e=>{if(!ne.current)return;let o=ne.current.getBoundingClientRect(),n=e.clientY-o.top,u=x();if(!u)return;let b=u.clientHeight,v=u.scrollHeight,P=n/b*(v-b);u.scrollTop=Math.max(0,Math.min(v-b,P)),d(),T(!0),m(l.delay),_()},[d,m,l.delay,x,_]),X=$(e=>{if(e.preventDefault(),e.stopPropagation(),!s.current)return;let o=Math.max(0,s.current.scrollTop-D);s.current.scrollTop=o,d(),T(!0),m(l.delay),_()},[d,m,D,l.delay,_]),ze=$(e=>{if(e.preventDefault(),e.stopPropagation(),!s.current||!q.current)return;let o=s.current,n=q.current.scrollHeight-o.clientHeight,u=Math.min(n,o.scrollTop+D);o.scrollTop=u,d(),T(!0),m(l.delay),_()},[d,m,D,l.delay,_]),E=$(e=>{if(!i.enabled)return;let o=e.target;if(at(o,i)||e.button!==0)return;let n=x();n&&(n.scrollHeight<=n.clientHeight||(e.preventDefault(),$e(!0),Fe({x:e.clientX,y:e.clientY,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft||0}),I()))},[i,at,x,I]),K=$(e=>{if(!F)return;let o=x();if(!o)return;let n=Te.x-e.clientX,u=Te.y-e.clientY;if(Math.abs(u)<3&&Math.abs(n)<3)return;T(!0);let b=Math.max(0,Math.min(o.scrollHeight-o.clientHeight,Te.scrollTop+u));o.scrollTop=b,d()},[F,Te,x,d]),z=$(()=>{$e(!1),U()&&m(l.delay)},[U,m,l.delay]);pe(()=>{let e=v=>{d(),I(),T(!0);let P=Se?l.delayOnWheel:l.delay;m(P),S&&S(v)},o=()=>{_e(!0),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{_e(!1)},300),I(),re(),ce.current=setTimeout(()=>{T(!0),ce.current=null},50)},n=[],u=x();u&&n.push(u);let b=s.current;return b&&!u&&(n.push(b),b.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(v=>{let P=v;if(P!==b&&P.classList.contains("overlay-scrollbar-container"))return;let B=P.parentElement;for(;B&&B!==b;){if(B.classList.contains("overlay-scrollbar-container")&&B!==b)return;B=B.parentElement}n.push(P)})),n.forEach(v=>{v.addEventListener("scroll",e,{passive:!0}),v.addEventListener("wheel",o,{passive:!0})}),()=>{n.forEach(v=>{v.removeEventListener("scroll",e),v.removeEventListener("wheel",o)}),ae.current&&clearTimeout(ae.current),ce.current&&clearTimeout(ce.current)}},[x,d,S,I,m,l,Se]),pe(()=>{let e=n=>{let u=x();if(!u)return;let{key:b}=n,{scrollTop:v,scrollHeight:P,clientHeight:B}=u,Le=P-B,We=50,J=null;switch(b){case"ArrowUp":n.preventDefault(),J=Math.max(0,v-We);break;case"ArrowDown":n.preventDefault(),J=Math.min(Le,v+We);break;case"PageUp":n.preventDefault(),J=Math.max(0,v-B);break;case"PageDown":n.preventDefault(),J=Math.min(Le,v+B);break;case"Home":n.preventDefault(),J=0;break;case"End":n.preventDefault(),J=Le;break;default:return}if(J!==null){let Je=J/Le,Ge=L?c*2+g.margin*4:g.margin*2,Ze=(B-Ge-te)*Je;De(Ze),u.scrollTop=J,I(),T(!0),m(l.delay)}},o=s.current;if(o)return o.addEventListener("keydown",e),()=>{o.removeEventListener("keydown",e)}},[x,L,c,g.margin,te,I,m,l.delay]),pe(()=>{if(F)return document.addEventListener("mousemove",K),document.addEventListener("mouseup",z),()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",z)}},[F,K,z]),pe(()=>{if(k)return document.addEventListener("mousemove",de),document.addEventListener("mouseup",oe),()=>{document.removeEventListener("mousemove",de),document.removeEventListener("mouseup",oe)}},[k,de,oe]),pe(()=>{d();let e=setTimeout(()=>{d()},100);return()=>clearTimeout(e)},[d]),yt(()=>{Ne(!0),d(),!l.enabled&&U()&&T(!0)},[U,d,l.enabled]),pe(()=>{let e=new ResizeObserver(()=>{d()}),o=[];return s.current&&o.push(s.current),q.current&&o.push(q.current),j.current&&document.contains(j.current)&&o.push(j.current),o.forEach(n=>{e.observe(n)}),()=>e.disconnect()},[d]),pe(()=>{if(!s.current)return;let e=new MutationObserver(()=>{j.current=null,d()});return e.observe(s.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>e.disconnect()},[d]);let Ae=Math.max(ue,c);return pe(()=>{let e="overlay-scrollbar-webkit-hide",o=document.getElementById(e);o&&o.remove();let n=document.createElement("style");return n.id=e,n.textContent=`
|
|
1
|
+
import{forwardRef as rt,useCallback as be,useMemo as nt,useRef as V,useEffect as ye,memo as Lt,useState as ot}from"react";import{Box as xe,Table as Dt,TableBody as Et,TableCell as Ye,TableContainer as Ht,TableHead as It,TableRow as _e,TableSortLabel as it,Paper as Rt,Typography as $t}from"@mui/material";import{TableVirtuoso as Ot}from"react-virtuoso";import{jsx as tt}from"react/jsx-runtime";import{useRef as lt,useState as pt,useEffect as ft}from"react";import{Box as mt,CircularProgress as ht}from"@mui/material";var Ae=function(){return Ae=Object.assign||function(u){for(var g,x=1,T=arguments.length;x<T;x++){g=arguments[x];for(var E in g)Object.prototype.hasOwnProperty.call(g,E)&&(u[E]=g[E])}return u},Ae.apply(this,arguments)};function at(a){var u=a.visible,g=a.onComplete,x=a.fadeoutDuration,T=x===void 0?200:x,E=a.exitDelay,d=E===void 0?0:E,N=a.size,k=N===void 0?40:N,F=a.className,ee=a.style,z=a.sx,_=a.indicator,L=a.background,G=L===void 0?{show:!0,color:"255, 255, 255",opacity:.9}:L,ue=lt(void 0),l=lt(null),U=pt(u),de=U[0],ve=U[1],O=G.show,we=O===void 0?!0:O,S=G.color,D=S===void 0?"255, 255, 255":S,pe=G.opacity,te=pe===void 0?.9:pe;if(ft(function(){var re=ue.current;if(re===!0&&u===!1&&l.current){var X=l.current;X.style.opacity="0",setTimeout(function(){ve(!1),g?.()},T+d)}else u===!0&&(ve(!0),l.current&&(l.current.style.opacity="1"));ue.current=u},[u,g,T,d]),!de)return null;var Le=function(){return typeof _=="string"?tt("img",{src:_,alt:"Loading",style:{width:k,height:k}}):_||tt(ht,{size:k})},fe=function(){return we?D.startsWith("rgba")?{backgroundColor:D}:/^\d+,\s*\d+,\s*\d+$/.test(D)?{backgroundColor:"rgba(".concat(D,", ").concat(te,")")}:te!==1?{backgroundColor:D,"&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:D,opacity:te,zIndex:-1}}:{backgroundColor:D}:{backgroundColor:"transparent"}};return tt(mt,{ref:l,className:F,style:Ae({},ee),sx:Ae(Ae({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,opacity:u?1:0,transition:"opacity ".concat(T,"ms ease-out")},fe()),z),children:Le()})}import{useRef as Q,useEffect as ce,useState as q,useCallback as R,useMemo as We,forwardRef as gt,useImperativeHandle as bt,useLayoutEffect as yt}from"react";import{jsx as Re,jsxs as ct}from"react/jsx-runtime";var xt=["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"],st=(a,u)=>{let g=a.tagName.toLowerCase(),x=["text","password","email","number","search","tel","url","checkbox","radio"];if(g==="input"){let T=a.type;return x.includes(T)}if(["textarea","select","button"].includes(g)||["svg","path","circle","rect","line","polygon","polyline"].includes(g)||a.getAttribute("contenteditable")==="true")return!0;if(u?.excludeSelectors){for(let T of u.excludeSelectors)if(a.matches(T))return!0}return vt(a,u)},vt=(a,u)=>{let g=[...xt,...u?.excludeClasses||[]],x=a,T=0,E=5;for(;x&&T<=E;){if(g.some(d=>x.classList.contains(d)))return!0;if(x.classList.contains("MuiDialogContent-root"))break;x=x.parentElement,T++}return!1},wt={},Mt={},Tt={},St={},Ct={},kt=gt(({className:a="",style:u={},containerStyle:g={},contentStyle:x={},children:T,onScroll:E,thumb:d=wt,track:N=Mt,arrows:k=Tt,dragScroll:F=St,autoHide:ee=Ct,showScrollbar:z=!0,detectInnerScroll:_=!1},L)=>{let G=Q({});ce(()=>{G.current={children:T,onScroll:E,showScrollbar:z,thumb:d,track:N,arrows:k,dragScroll:F,autoHide:ee}});let ue=Q(null),l=Q(null),U=Q(null),de=Q(null),ve=Q(null),O=Q(null),[we,S]=q(!1),[D,pe]=q(!1),[te,Le]=q(!1),[fe,re]=q({y:0,scrollTop:0}),[X,Ue]=q(0),[Xe,Oe]=q(0),[Pe,Ke]=q(!1),[ie,De]=q(!1),[j,me]=q({x:0,y:0,scrollTop:0,scrollLeft:0}),[Je,Ze]=q(null),[Me,le]=q(null),[Be,Ne]=q(!1),Ee=Q(null),[qe,He]=q(!1),ae=Q(null),ne=Q(null),se=Q(null),H=We(()=>{let t=d.color??"#606060";return{width:d.width??8,minHeight:d.minHeight??50,radius:d.radius??(d.width??8)/2,color:t,opacity:d.opacity??.6,hoverColor:d.hoverColor??t,hoverOpacity:d.hoverOpacity??1}},[d]),b=We(()=>({width:N.width??16,color:N.color??"rgba(128, 128, 128, 0.1)",visible:N.visible??!0,alignment:N.alignment??"center",radius:N.radius??H.radius??4,margin:N.margin??4}),[N,H.radius]),K=We(()=>{let t=k.color??"#808080";return{visible:k.visible??!1,step:k.step??50,color:t,opacity:k.opacity??.6,hoverColor:k.hoverColor??t,hoverOpacity:k.hoverOpacity??1}},[k]),je=We(()=>({enabled:F.enabled??!0,excludeClasses:F.excludeClasses??[],excludeSelectors:F.excludeSelectors??[]}),[F]),m=We(()=>({enabled:ee.enabled??!0,delay:ee.delay??1500,delayOnWheel:ee.delayOnWheel??700}),[ee]),r=H.width,i=b.width,y=H.minHeight,p=K.visible,J=K.step,e=R(()=>{if(!l.current)return;let t=document.activeElement;t&&l.current.contains(t)&&t!==l.current||l.current.focus()},[]);bt(L,()=>({getScrollContainer:()=>l.current,scrollTo:t=>{l.current&&l.current.scrollTo(t)},get scrollTop(){return l.current?.scrollTop||0},get scrollHeight(){return l.current?.scrollHeight||0},get clientHeight(){return l.current?.clientHeight||0}}),[]);let f=R(()=>{if(O.current){let n=O.current;if(document.contains(n)&&n.scrollHeight>n.clientHeight+2)return n;O.current=null}if(!l.current)return null;if(U.current&&U.current.scrollHeight>l.current.clientHeight+2)return O.current=l.current,l.current;if(!_)return null;let t=l.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let n of t){let o=n;if(o!==l.current&&o.classList.contains("overlay-scrollbar-container"))continue;let s=o.parentElement,w=!1;for(;s&&s!==l.current;){if(s.classList.contains("overlay-scrollbar-container")&&s!==l.current){w=!0;break}s=s.parentElement}if(!w&&o.scrollHeight>o.clientHeight+2)return O.current=o,o}return null},[]),$=R(()=>f()!==null,[f]),C=R(()=>{ae.current&&(clearTimeout(ae.current),ae.current=null)},[]),Ve=R(()=>{ne.current&&(clearTimeout(ne.current),ne.current=null)},[]),Ie=R(()=>{se.current&&(clearTimeout(se.current),se.current=null)},[]),I=R(t=>{m.enabled&&(C(),ae.current=setTimeout(()=>{S(!1),ae.current=null},t))},[C,m.enabled]),h=R(()=>{let t=f();if(!t){S(!1),Ke(!1),C();return}if(Ke(!0),!de.current)return;m.enabled||(S(!0),C());let n=t.clientHeight,o=t.scrollHeight,s=t.scrollTop,w=0;if(ue.current){let Fe=window.getComputedStyle(ue.current),et=parseFloat(Fe.paddingTop)||0,dt=parseFloat(Fe.paddingBottom)||0;w=et+dt}let M=p?r*2+b.margin*4:b.margin*2,P=n-M+w,B=n/o,ke=Math.max(P*B,y),ze=o-n,Z=P-ke,Qe=ze>0?s/ze*Z:0;Ue(ke),Oe(Qe)},[f,C,p,r,y,m.enabled]),oe=R(t=>{t.preventDefault(),t.stopPropagation();let n=f();n&&(pe(!0),re({y:t.clientY,scrollTop:n.scrollTop}),C(),S(!0),e())},[f,C,e]),A=R(t=>{if(!D)return;let n=f();if(!n)return;let o=n.clientHeight,s=n.scrollHeight-o,w=t.clientY-fe.y,M=o-X,P=w/M*s,B=Math.max(0,Math.min(s,fe.scrollTop+P));n.scrollTop=B,h()},[D,fe,X,h,f]),W=R(()=>{pe(!1),$()&&I(m.delay)},[$,I,m.delay]),he=R(t=>{if(!de.current)return;let n=de.current.getBoundingClientRect(),o=t.clientY-n.top,s=f();if(!s)return;let w=s.clientHeight,M=s.scrollHeight,P=o/w*(M-w);s.scrollTop=Math.max(0,Math.min(M-w,P)),h(),S(!0),I(m.delay),e()},[h,I,m.delay,f,e]),Te=R(t=>{if(t.preventDefault(),t.stopPropagation(),!l.current)return;let n=Math.max(0,l.current.scrollTop-J);l.current.scrollTop=n,h(),S(!0),I(m.delay),e()},[h,I,J,m.delay,e]),ge=R(t=>{if(t.preventDefault(),t.stopPropagation(),!l.current||!U.current)return;let n=l.current,o=U.current.scrollHeight-n.clientHeight,s=Math.min(o,n.scrollTop+J);n.scrollTop=s,h(),S(!0),I(m.delay),e()},[h,I,J,m.delay,e]),Se=R(t=>{if(!je.enabled)return;let n=t.target;if(st(n,je)||t.button!==0)return;let o=f();o&&(o.scrollHeight<=o.clientHeight||(t.preventDefault(),De(!0),me({x:t.clientX,y:t.clientY,scrollTop:o.scrollTop,scrollLeft:o.scrollLeft||0}),C()))},[je,st,f,C]),Y=R(t=>{if(!ie)return;let n=f();if(!n)return;let o=j.x-t.clientX,s=j.y-t.clientY;if(Math.abs(s)<3&&Math.abs(o)<3)return;S(!0);let w=Math.max(0,Math.min(n.scrollHeight-n.clientHeight,j.scrollTop+s));n.scrollTop=w,h()},[ie,j,f,h]),Ce=R(()=>{De(!1),$()&&I(m.delay)},[$,I,m.delay]);ce(()=>{let t=M=>{h(),C(),S(!0);let P=qe?m.delayOnWheel:m.delay;I(P),E&&E(M)},n=()=>{He(!0),Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(()=>{He(!1)},300),C(),Ie(),se.current=setTimeout(()=>{S(!0),se.current=null},50)},o=[],s=f();s&&o.push(s);let w=l.current;return w&&!s&&(o.push(w),w.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(M=>{let P=M;if(P!==w&&P.classList.contains("overlay-scrollbar-container"))return;let B=P.parentElement;for(;B&&B!==w;){if(B.classList.contains("overlay-scrollbar-container")&&B!==w)return;B=B.parentElement}o.push(P)})),o.forEach(M=>{M.addEventListener("scroll",t,{passive:!0}),M.addEventListener("wheel",n,{passive:!0})}),()=>{o.forEach(M=>{M.removeEventListener("scroll",t),M.removeEventListener("wheel",n)}),Ee.current&&clearTimeout(Ee.current),se.current&&clearTimeout(se.current)}},[f,h,E,C,I,m,qe]),ce(()=>{let t=o=>{let s=f();if(!s)return;let{key:w}=o,{scrollTop:M,scrollHeight:P,clientHeight:B}=s,ke=P-B,ze=50,Z=null;switch(w){case"ArrowUp":o.preventDefault(),Z=Math.max(0,M-ze);break;case"ArrowDown":o.preventDefault(),Z=Math.min(ke,M+ze);break;case"PageUp":o.preventDefault(),Z=Math.max(0,M-B);break;case"PageDown":o.preventDefault(),Z=Math.min(ke,M+B);break;case"Home":o.preventDefault(),Z=0;break;case"End":o.preventDefault(),Z=ke;break;default:return}if(Z!==null){let Qe=Z/ke,Fe=p?r*2+b.margin*4:b.margin*2,et=(B-Fe-X)*Qe;Oe(et),s.scrollTop=Z,C(),S(!0),I(m.delay)}},n=l.current;if(n)return n.addEventListener("keydown",t),()=>{n.removeEventListener("keydown",t)}},[f,p,r,b.margin,X,C,I,m.delay]),ce(()=>{if(ie)return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",Ce),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",Ce)}},[ie,Y,Ce]),ce(()=>{if(D)return document.addEventListener("mousemove",A),document.addEventListener("mouseup",W),()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",W)}},[D,A,W]),ce(()=>{h();let t=setTimeout(()=>{h()},100);return()=>clearTimeout(t)},[h]),yt(()=>{Ne(!0),h(),!m.enabled&&$()&&S(!0)},[$,h,m.enabled]),ce(()=>{let t=new ResizeObserver(()=>{h()}),n=[];return l.current&&n.push(l.current),U.current&&n.push(U.current),O.current&&document.contains(O.current)&&n.push(O.current),n.forEach(o=>{t.observe(o)}),()=>t.disconnect()},[h]),ce(()=>{if(!l.current)return;let t=new MutationObserver(()=>{O.current=null,h()});return t.observe(l.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[h]);let v=Math.max(i,r);return ce(()=>{let t="overlay-scrollbar-webkit-hide",n=document.getElementById(t);n&&n.remove();let o=document.createElement("style");return o.id=t,o.textContent=`
|
|
2
2
|
.overlay-scrollbar-container::-webkit-scrollbar {
|
|
3
3
|
display: none !important;
|
|
4
4
|
width: 0 !important;
|
|
@@ -18,7 +18,7 @@ import{forwardRef as et,useCallback as ge,useMemo as tt,useRef as W,useEffect as
|
|
|
18
18
|
outline: 2px solid rgba(0, 123, 255, 0.5);
|
|
19
19
|
outline-offset: -2px;
|
|
20
20
|
}
|
|
21
|
-
`,document.head.appendChild(n),()=>{let u=document.getElementById(e);u&&u.remove()}},[]),st("div",{ref:ee,className:`overlay-scrollbar-wrapper ${a}`,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",...f},children:[Ee("div",{ref:s,className:"overlay-scrollbar-container",tabIndex:-1,onMouseDown:E,style:{display:"flex",width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",scrollbarWidth:"none",msOverflowStyle:"none",outline:"none",userSelect:F?"none":"auto",...h},children:Ee("div",{ref:q,className:"overlay-scrollbar-content",style:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",...y},children:M})}),Y&&Me&&st("div",{ref:ne,className:"overlay-scrollbar-track",onMouseEnter:()=>{I(),Ce.current=setTimeout(()=>{T(!0),Ce.current=null},100)},onMouseLeave:()=>{je(),k||m(l.delay)},style:{position:"absolute",top:0,right:0,width:`${Ae}px`,height:"100%",opacity:ie?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[g.visible&&Ee("div",{className:"overlay-scrollbar-track-background",onClick:e=>{e.preventDefault(),e.stopPropagation(),ke(e)},style:{position:"absolute",top:L?`${O.width+g.margin*2}px`:`${g.margin}px`,right:g.alignment==="right"?"0px":`${(Ae-O.width)/2}px`,width:`${O.width}px`,height:L?`calc(100% - ${O.width*2+g.margin*4}px)`:`calc(100% - ${g.margin*2}px)`,backgroundColor:g.color,borderRadius:`${g.radius}px`,cursor:"pointer"}}),Ee("div",{ref:xe,className:"overlay-scrollbar-thumb",onMouseDown:he,onMouseEnter:()=>ve(!0),onMouseLeave:()=>ve(!1),style:{position:"absolute",top:`${(L?c+g.margin*2:g.margin)+ot}px`,right:g.alignment==="right"?"0px":`${(Ae-c)/2}px`,width:`${c}px`,height:`${Math.max(te,t)}px`,backgroundColor:fe||k?O.hoverColor:O.color,opacity:fe||k?O.hoverOpacity:O.opacity,borderRadius:`${O.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),Y&&Me&&L&&Ee("div",{className:"overlay-scrollbar-up-arrow",onClick:X,onMouseEnter:()=>Be("up"),onMouseLeave:()=>Be(null),style:{position:"absolute",top:`${g.margin}px`,right:g.alignment==="right"?"0px":`${(Ae-c)/2}px`,width:`${c}px`,height:`${c}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(c*.75,8)}px`,color:me==="up"?r.hoverColor:r.color,userSelect:"none",zIndex:1001,opacity:ie?me==="up"?r.hoverOpacity:r.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),Y&&Me&&L&&Ee("div",{className:"overlay-scrollbar-down-arrow",onClick:ze,onMouseEnter:()=>Be("down"),onMouseLeave:()=>Be(null),style:{position:"absolute",bottom:`${g.margin}px`,right:g.alignment==="right"?"0px":`${(Ae-c)/2}px`,width:`${c}px`,height:`${c}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(c*.75,8)}px`,color:me==="down"?r.hoverColor:r.color,userSelect:"none",zIndex:1001,opacity:ie?me==="down"?r.hoverOpacity:r.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"})]})}),ct=kt;import{Fragment as Xe,jsx as p,jsxs as Re}from"react/jsx-runtime";var Pt={alignment:"right",margin:0,radius:0};function Bt({data:a,loading:f=!1,columns:h,onRowClick:y,getRowId:M,selectedRowId:S,rowHeight:C=50,columnHeight:H=56,striped:R,rowDivider:Q=!0,onSort:N,onLoadMore:Y,sortBy:w,sortDirection:G,showPaper:ye=!0,paddingX:ee="1rem",paddingTop:s=0,paddingBottom:q=0,rowHoverColor:ne,rowHoverOpacity:xe,scrollbars:j,emptyMessage:ie="NO DATA",LoadingComponent:T}){let k=tt(()=>et((r,i)=>{let l=W(null);return p(ct,{detectInnerScroll:!0,track:Pt,...j,children:p(Ht,{component:be,...r,ref:c=>{l.current=c,typeof i=="function"?i(c):i&&(i.current=c)},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:ee,paddingTop:s,paddingBottom:q}}})})}),[]),le=tt(()=>{if(R===!0)return"#f5f5f5";if(typeof R=="string")return R},[R]),[fe,ve]=ut(f),[we,Ie]=ut(0);He(()=>{f&&ve(!0)},[f]);let te=ge(()=>{ve(!1)},[]),Ke=fe,ot=f&&a.length>0,De=W(!1),Me=W(null),V=W(null),F=W(!1),$e=W({x:0,y:0,scrollTop:0}),Te=W(!1),Fe=W(0),Oe=W(0),Pe=W(!1),me=W({x:0,y:0}),Be=W(null),nt=ge(r=>{},[]),Ne=ge(r=>{if(!Te.current||!V.current)return;let i=r.clientY-$e.current.y;if(!F.current&&Math.abs(i)>5&&(F.current=!0,V.current&&(V.current.style.userSelect="none")),F.current){let c=i*2;Oe.current+=-c;let ue=V.current,t=Math.max(0,Fe.current+Oe.current);ue.scrollTop=t,$e.current.y=r.clientY,r.preventDefault()}},[]),ae=ge(()=>{if(Te.current=!1,F.current&&V.current){let r=Math.max(0,Fe.current+Oe.current),i=()=>{V.current&&(V.current.scrollTop=r)};i(),setTimeout(i,1),setTimeout(i,5),setTimeout(i,10)}F.current=!1,Oe.current=0,V.current&&(V.current.style.userSelect="auto")},[]);He(()=>{let r=document.querySelector('[data-testid="virtuoso-scroller"]');r&&r.querySelectorAll(".MuiTableSortLabel-root").forEach(l=>{let c=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});l.dispatchEvent(c)})},[w]);let Se=ge(r=>{if(!N)return;N(r,w===r&&G==="asc"?"desc":"asc")},[N,w,G]),_e=ge(r=>{if(!Y||f&&a.length===0)return;let i=Date.now(),l=window.lastRangeChangeTime||0;if(i-l<100)return;window.lastRangeChangeTime=i;let c=Math.max(10,Math.floor(a.length*.1)),ue=r.endIndex>=a.length-c,t=a.length>=30;if(ue&&t&&Y&&!De.current){De.current=!0;let L=a.length;Y(L,50)}},[a.length,f,Y]);He(()=>{f||(De.current=!1)},[f]),He(()=>{a.length===0&&Ie(r=>r+1)},[a.length]);let se=W(a.length);He(()=>{let r=se.current,i=a.length;if(i>r&&r>0){se.current=i;return}Me.current&&i>0&&i<=r&&Me.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),se.current=i},[a]),He(()=>(document.addEventListener("mousemove",Ne),document.addEventListener("mouseup",ae),()=>{document.removeEventListener("mousemove",Ne),document.removeEventListener("mouseup",ae)}),[Ne,ae]);let Ce=ge(()=>{let r={},i=[];if(h.forEach(t=>{t.group?(r[t.group]||(r[t.group]=[]),r[t.group].push(t)):i.push(t)}),!(Object.keys(r).length>0))return p(Ue,{children:h.map(t=>p(Ve,{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?p("div",{style:{display:"flex",alignItems:"center",justifyContent:t.align==="center"?"center":t.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:Re(be,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>Se(String(t.id)),children:[t.text,p(rt,{active:w===t.id,direction:w===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:w===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 c=[...i.map(t=>p(Ve,{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&&N?p("div",{style:{display:"flex",alignItems:"center",justifyContent:t.align==="center"?"center":t.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:Re(be,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>Se(String(t.id)),children:[t.text,p(rt,{active:w===t.id,direction:w===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:w===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(r).map(([t,L])=>p(Ve,{align:"center",colSpan:L.length,style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:t},t))],ue=[...Object.values(r).flat().map(t=>p(Ve,{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&&N?p("div",{style:{display:"flex",alignItems:"center",justifyContent:t.align==="center"?"center":t.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:Re(be,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>Se(String(t.id)),children:[t.text,p(rt,{active:w===t.id,direction:w===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:w===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 Re(Xe,{children:[p(Ue,{children:c}),p(Ue,{children:ue})]})},[h,w,G,Se,N,H]),ce=ge((r,i)=>i?p(Xe,{children:h.map(l=>p(Ve,{align:l.align||"left",style:{width:l.width,minWidth:l.width,...l.style,padding:"8px 16px"},children:l.render?l.render(i,r):String(i[l.id]||"")},String(l.id)))}):(console.log("rowContent - \uC544\uC774\uD15C \uC5C6\uC74C, \uC778\uB371\uC2A4:",r),null),[h]),O=tt(()=>({Scroller:k,Table:r=>p(Dt,{...r,sx:{borderCollapse:"separate",tableLayout:"fixed",marginRight:"16px"}}),TableHead:et((r,i)=>p(Rt,{...r,ref:i,sx:{userSelect:"none","& tr":{height:H,"& th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:r=>{let{item:i,...l}=r,c=l["data-index"]??0,ue=c%2===1,t=i&&M?M(i,c):c,L=S!=null&&t===S;return p(Ue,{...l,onMouseDown:D=>{Pe.current=!1,me.current={x:D.clientX,y:D.clientY}},onMouseMove:D=>{let _=Math.abs(D.clientX-me.current.x),x=Math.abs(D.clientY-me.current.y),U=5;(_>U||x>U)&&(Pe.current=!0)},onClick:()=>{!Pe.current&&!F.current&&i&&y&&y(i,c),Pe.current=!1},sx:{userSelect:"none",height:C,backgroundColor:L?D=>D.palette.action.selected:ue&&le?le:"transparent",boxShadow:L?D=>`inset 3px 0 0 ${D.palette.primary.main}`:"none","& td":{padding:"8px 16px",borderBottom:Q?"1px solid rgba(224, 224, 224, 1)":"none",fontWeight:L?600:void 0},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":y?{backgroundColor:D=>{if(L)return D.palette.action.selected;let _=D.palette.mode==="dark",U=ne??"#000000",I=xe??.06,je=U.replace("#",""),re=parseInt(je.substring(0,2),16)/255,m=parseInt(je.substring(2,4),16)/255,d=parseInt(je.substring(4,6),16)/255;if(_){let he=Math.max(re,m,d),de=Math.min(re,m,d),oe=0,ke=0,X=(he+de)/2;if(he!==de){let E=he-de;switch(ke=X>.5?E/(2-he-de):E/(he+de),he){case re:oe=((m-d)/E+(m<d?6:0))/6;break;case m:oe=((d-re)/E+2)/6;break;case d:oe=((re-m)/E+4)/6;break}}X=1-X;let ze=(E,K,z)=>(z<0&&(z+=1),z>1&&(z-=1),z<1/6?E+(K-E)*6*z:z<1/2?K:z<2/3?E+(K-E)*(2/3-z)*6:E);if(ke===0)re=m=d=X;else{let E=X<.5?X*(1+ke):X+ke-X*ke,K=2*X-E;re=ze(K,E,oe+1/3),m=ze(K,E,oe),d=ze(K,E,oe-1/3)}}return`rgba(${Math.round(re*255)}, ${Math.round(m*255)}, ${Math.round(d*255)}, ${I})`},transition:"background-color 0.2s ease"}:{}}})},TableBody:et((r,i)=>p(Et,{...r,ref:i}))}),[y,M,S,C,nt,le,Q,H,ne,xe,k]),g=Re(be,{sx:{position:"relative",height:"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:r=>r.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"}},children:[p(Ot,{ref:Me,data:a,totalCount:Y?a.length+1:a.length,fixedHeaderContent:Ce,itemContent:ce,rangeChanged:_e,components:O,style:{height:"100%"},increaseViewportBy:{top:100,bottom:300},overscan:5,followOutput:!1},we),a.length===0&&!f&&p(be,{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"?Re(Xe,{children:[p(be,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),p($t,{variant:"body1",sx:{color:"text.secondary"},children:ie})]}):ie}),Ke&&p(Xe,{children:T?p(T,{visible:f,onComplete:te}):p(lt,{visible:f,onComplete:te,size:40,sx:{top:`${h.some(r=>r.group)?H*2:H}px`},background:{show:a.length===0,opacity:.8}})})]});return ye?p(It,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:ee,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:g}):p(be,{className:"grow",style:{padding:0,paddingLeft:ee,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:g})}var Nt=Lt(Bt);export{Nt as VirtualDataTable};
|
|
21
|
+
`,document.head.appendChild(o),()=>{let s=document.getElementById(t);s&&s.remove()}},[]),ct("div",{ref:ue,className:`overlay-scrollbar-wrapper ${a}`,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",...u},children:[Re("div",{ref:l,className:"overlay-scrollbar-container",tabIndex:-1,onMouseDown:Se,style:{display:"flex",width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",scrollbarWidth:"none",msOverflowStyle:"none",outline:"none",userSelect:ie?"none":"auto",...g},children:Re("div",{ref:U,className:"overlay-scrollbar-content",style:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",...x},children:T})}),z&&Pe&&ct("div",{ref:de,className:"overlay-scrollbar-track",onMouseEnter:()=>{C(),ne.current=setTimeout(()=>{S(!0),ne.current=null},100)},onMouseLeave:()=>{Ve(),D||I(m.delay)},style:{position:"absolute",top:0,right:0,width:`${v}px`,height:"100%",opacity:we?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[b.visible&&Re("div",{className:"overlay-scrollbar-track-background",onClick:t=>{t.preventDefault(),t.stopPropagation(),he(t)},style:{position:"absolute",top:p?`${H.width+b.margin*2}px`:`${b.margin}px`,right:b.alignment==="right"?"0px":`${(v-H.width)/2}px`,width:`${H.width}px`,height:p?`calc(100% - ${H.width*2+b.margin*4}px)`:`calc(100% - ${b.margin*2}px)`,backgroundColor:b.color,borderRadius:`${b.radius}px`,cursor:"pointer"}}),Re("div",{ref:ve,className:"overlay-scrollbar-thumb",onMouseDown:oe,onMouseEnter:()=>Le(!0),onMouseLeave:()=>Le(!1),style:{position:"absolute",top:`${(p?r+b.margin*2:b.margin)+Xe}px`,right:b.alignment==="right"?"0px":`${(v-r)/2}px`,width:`${r}px`,height:`${Math.max(X,y)}px`,backgroundColor:te||D?H.hoverColor:H.color,opacity:te||D?H.hoverOpacity:H.opacity,borderRadius:`${H.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),z&&Pe&&p&&Re("div",{className:"overlay-scrollbar-up-arrow",onClick:Te,onMouseEnter:()=>le("up"),onMouseLeave:()=>le(null),style:{position:"absolute",top:`${b.margin}px`,right:b.alignment==="right"?"0px":`${(v-r)/2}px`,width:`${r}px`,height:`${r}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(r*.75,8)}px`,color:Me==="up"?K.hoverColor:K.color,userSelect:"none",zIndex:1001,opacity:we?Me==="up"?K.hoverOpacity:K.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),z&&Pe&&p&&Re("div",{className:"overlay-scrollbar-down-arrow",onClick:ge,onMouseEnter:()=>le("down"),onMouseLeave:()=>le(null),style:{position:"absolute",bottom:`${b.margin}px`,right:b.alignment==="right"?"0px":`${(v-r)/2}px`,width:`${r}px`,height:`${r}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(r*.75,8)}px`,color:Me==="down"?K.hoverColor:K.color,userSelect:"none",zIndex:1001,opacity:we?Me==="down"?K.hoverOpacity:K.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"})]})}),ut=kt;import{Fragment as Ge,jsx as c,jsxs as $e}from"react/jsx-runtime";var Pt={alignment:"right",margin:0,radius:0};function Bt({data:a,loading:u=!1,columns:g,onRowClick:x,onRowMouseDown:T,getRowId:E,selectedRowId:d,rowHeight:N=50,columnHeight:k=56,striped:F,rowDivider:ee=!0,onSort:z,onLoadMore:_,sortBy:L,sortDirection:G,showPaper:ue=!0,paddingX:l="1rem",paddingTop:U=0,paddingBottom:de=0,rowHoverColor:ve,rowHoverOpacity:O,scrollbars:we,emptyMessage:S="NO DATA",LoadingComponent:D}){let pe=nt(()=>rt((r,i)=>{let y=V(null);return c(ut,{detectInnerScroll:!0,track:Pt,...we,children:c(Ht,{component:xe,...r,ref:p=>{y.current=p,typeof i=="function"?i(p):i&&(i.current=p)},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:l,paddingTop:U,paddingBottom:de}}})})}),[]),te=nt(()=>{if(F===!0)return"#f5f5f5";if(typeof F=="string")return F},[F]),[Le,fe]=ot(u),[re,X]=ot(null),[Ue,Xe]=ot(0);ye(()=>{u&&fe(!0)},[u]),ye(()=>{re!==null&&re===d&&X(null)},[re,d]),ye(()=>{d==null&&X(null)},[d]);let Oe=be(()=>{fe(!1)},[]),Pe=Le,Ke=u&&a.length>0,ie=V(!1),De=V(null),j=V(null),me=V(!1),Je=V({x:0,y:0,scrollTop:0}),Ze=V(!1),Me=V(0),le=V(0),Be=V(!1),Ne=V({x:0,y:0}),Ee=V(null),qe=be(r=>{},[]),He=be(r=>{if(!Ze.current||!j.current)return;let i=r.clientY-Je.current.y;if(!me.current&&Math.abs(i)>5&&(me.current=!0,j.current&&(j.current.style.userSelect="none")),me.current){let p=i*2;le.current+=-p;let J=j.current,e=Math.max(0,Me.current+le.current);J.scrollTop=e,Je.current.y=r.clientY,r.preventDefault()}},[]),ae=be(()=>{if(Ze.current=!1,me.current&&j.current){let r=Math.max(0,Me.current+le.current),i=()=>{j.current&&(j.current.scrollTop=r)};i(),setTimeout(i,1),setTimeout(i,5),setTimeout(i,10)}me.current=!1,le.current=0,j.current&&(j.current.style.userSelect="auto")},[]);ye(()=>{let r=document.querySelector('[data-testid="virtuoso-scroller"]');r&&r.querySelectorAll(".MuiTableSortLabel-root").forEach(y=>{let p=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});y.dispatchEvent(p)})},[L]);let ne=be(r=>{if(!z)return;z(r,L===r&&G==="asc"?"desc":"asc")},[z,L,G]),se=be(r=>{if(!_||u&&a.length===0)return;let i=Date.now(),y=window.lastRangeChangeTime||0;if(i-y<100)return;window.lastRangeChangeTime=i;let p=Math.max(10,Math.floor(a.length*.1)),J=r.endIndex>=a.length-p,e=a.length>=30;if(J&&e&&_&&!ie.current){ie.current=!0;let f=a.length;_(f,50)}},[a.length,u,_]);ye(()=>{u||(ie.current=!1)},[u]),ye(()=>{a.length===0&&Xe(r=>r+1)},[a.length]);let H=V(a.length);ye(()=>{let r=H.current,i=a.length;if(i>r&&r>0){H.current=i;return}De.current&&i>0&&i<=r&&De.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),H.current=i},[a]),ye(()=>(document.addEventListener("mousemove",He),document.addEventListener("mouseup",ae),()=>{document.removeEventListener("mousemove",He),document.removeEventListener("mouseup",ae)}),[He,ae]);let b=be(()=>{let r={},i=[];if(g.forEach(e=>{e.group?(r[e.group]||(r[e.group]=[]),r[e.group].push(e)):i.push(e)}),!(Object.keys(r).length>0))return c(_e,{children:g.map(e=>c(Ye,{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?c("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:$e(xe,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>ne(String(e.id)),children:[e.text,c(it,{active:L===e.id,direction:L===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:L===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=[...i.map(e=>c(Ye,{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&&z?c("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:$e(xe,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>ne(String(e.id)),children:[e.text,c(it,{active:L===e.id,direction:L===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:L===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(r).map(([e,f])=>c(Ye,{align:"center",colSpan:f.length,style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e},e))],J=[...Object.values(r).flat().map(e=>c(Ye,{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&&z?c("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:$e(xe,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>ne(String(e.id)),children:[e.text,c(it,{active:L===e.id,direction:L===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:L===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 $e(Ge,{children:[c(_e,{children:p}),c(_e,{children:J})]})},[g,L,G,ne,z,k]),K=be((r,i)=>i?c(Ge,{children:g.map(y=>c(Ye,{align:y.align||"left",style:{width:y.width,minWidth:y.width,...y.style,padding:"8px 16px"},children:y.render?y.render(i,r):String(i[y.id]||"")},String(y.id)))}):(console.log("rowContent - \uC544\uC774\uD15C \uC5C6\uC74C, \uC778\uB371\uC2A4:",r),null),[g]),je=nt(()=>({Scroller:pe,Table:r=>c(Dt,{...r,sx:{borderCollapse:"separate",tableLayout:"fixed",marginRight:"16px"}}),TableHead:rt((r,i)=>c(It,{...r,ref:i,sx:{userSelect:"none","& tr":{height:k,"& th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:r=>{let{item:i,...y}=r,p=y["data-index"]??0,J=p%2===1,e=i&&E?E(i,p):p,f=d!=null&&e===d||re!==null&&e===re;return c(_e,{...y,onMouseDown:$=>{Be.current=!1,Ne.current={x:$.clientX,y:$.clientY},$.button===0&&(i&&(x||T)&&e!==d&&X(e),i&&T&&T(i,p))},onMouseMove:$=>{let C=Math.abs($.clientX-Ne.current.x),Ve=Math.abs($.clientY-Ne.current.y),Ie=5;(C>Ie||Ve>Ie)&&(Be.current=!0)},onClick:()=>{!Be.current&&!me.current&&i&&x&&(e!==d&&X(e),x(i,p)),Be.current=!1},sx:{userSelect:"none",height:N,backgroundColor:f?"#dbeafe":J&&te?te:"transparent",boxShadow:f?"inset 3px 0 0 #3b82f6":"none","& td":{padding:"8px 16px",borderBottom:ee?"1px solid rgba(224, 224, 224, 1)":"none",fontWeight:f?600:void 0},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":x||T?{backgroundColor:$=>{if(f)return"#dbeafe";let C=$.palette.mode==="dark",Ie=ve??"#000000",I=O??.06,h=Ie.replace("#",""),oe=parseInt(h.substring(0,2),16)/255,A=parseInt(h.substring(2,4),16)/255,W=parseInt(h.substring(4,6),16)/255;if(C){let he=Math.max(oe,A,W),Te=Math.min(oe,A,W),ge=0,Se=0,Y=(he+Te)/2;if(he!==Te){let v=he-Te;switch(Se=Y>.5?v/(2-he-Te):v/(he+Te),he){case oe:ge=((A-W)/v+(A<W?6:0))/6;break;case A:ge=((W-oe)/v+2)/6;break;case W:ge=((oe-A)/v+4)/6;break}}Y=1-Y;let Ce=(v,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?v+(t-v)*6*n:n<1/2?t:n<2/3?v+(t-v)*(2/3-n)*6:v);if(Se===0)oe=A=W=Y;else{let v=Y<.5?Y*(1+Se):Y+Se-Y*Se,t=2*Y-v;oe=Ce(t,v,ge+1/3),A=Ce(t,v,ge),W=Ce(t,v,ge-1/3)}}return`rgba(${Math.round(oe*255)}, ${Math.round(A*255)}, ${Math.round(W*255)}, ${I})`},transition:"background-color 0.2s ease"}:{}}})},TableBody:rt((r,i)=>c(Et,{...r,ref:i}))}),[x,E,d,re,N,qe,te,ee,k,ve,O,pe]),m=$e(xe,{sx:{position:"relative",height:"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:r=>r.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"}},children:[c(Ot,{ref:De,data:a,totalCount:_?a.length+1:a.length,fixedHeaderContent:b,itemContent:K,rangeChanged:se,components:je,style:{height:"100%"},increaseViewportBy:{top:100,bottom:300},overscan:5,followOutput:!1},Ue),a.length===0&&!u&&c(xe,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2},children:typeof S=="string"?$e(Ge,{children:[c(xe,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),c($t,{variant:"body1",sx:{color:"text.secondary"},children:S})]}):S}),Pe&&c(Ge,{children:D?c(D,{visible:u,onComplete:Oe}):c(at,{visible:u,onComplete:Oe,size:40,sx:{top:`${g.some(r=>r.group)?k*2:k}px`},background:{show:a.length===0,opacity:.8}})})]});return ue?c(Rt,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:l,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:m}):c(xe,{className:"grow",style:{padding:0,paddingLeft:l,height:"100%",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:m})}var Nt=Lt(Bt);export{Nt as VirtualDataTable};
|
|
22
22
|
/**
|
|
23
23
|
* Virtual Data Table - A high-performance virtual data table component for React
|
|
24
24
|
*
|