UNPKG

mantine-datatable

Version:

The lightweight, dependency-free, dark-theme aware table component for your Mantine UI data-rich applications, featuring asynchronous data loading support, pagination, intuitive Gmail-style additive batch rows selection, column sorting, custom cell data r

2 lines 43.1 kB
"use strict";"use client";var Ra=Object.create;var ot=Object.defineProperty;var Pa=Object.getOwnPropertyDescriptor;var va=Object.getOwnPropertyNames;var Ma=Object.getPrototypeOf,ka=Object.prototype.hasOwnProperty;var Ea=(e,t)=>{for(var o in t)ot(e,o,{get:t[o],enumerable:!0})},Ut=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of va(t))!ka.call(e,a)&&a!==o&&ot(e,a,{get:()=>t[a],enumerable:!(n=Pa(t,a))||n.enumerable});return e};var B=(e,t,o)=>(o=e!=null?Ra(Ma(e)):{},Ut(t||!e||!e.__esModule?ot(o,"default",{value:e,enumerable:!0}):o,e)),Na=e=>Ut(ot({},"__esModule",{value:!0}),e);var Aa={};Ea(Aa,{DataTable:()=>bn,DataTableDraggableRow:()=>hn,differenceBy:()=>Wt,getRecordId:()=>H,getValueAtPath:()=>it,humanize:()=>Te,reorderRecords:()=>Ia,swapRecords:()=>Ha,uniqBy:()=>$e,useDataTableColumns:()=>vt});module.exports=Na(Aa);var Tt=require("@mantine/core"),Vt=require("@mantine/hooks"),Bt=B(require("clsx")),De=require("react");var wt=require("react");var Kt=require("@mantine/core"),[Jt,Re]=(0,Kt.createSafeContext)("useDataTableColumnsContext must be used within DataTableColumnProvider");var Zt=require("react/jsx-runtime"),St=e=>{let{children:t,columnsOrder:o,setColumnsOrder:n,columnsToggle:a,setColumnsToggle:r,resetColumnsOrder:l,resetColumnsToggle:c,setColumnWidth:f,setMultipleColumnWidths:b,resetColumnsWidth:d}=e,[g,m]=(0,wt.useState)(""),[p,T]=(0,wt.useState)("");return(0,Zt.jsx)(Jt,{value:{sourceColumn:g,setSourceColumn:m,targetColumn:p,setTargetColumn:T,columnsToggle:a,setColumnsToggle:r,swapColumns:()=>{if(!o||!n||!g||!p)return;let h=o.indexOf(g),y=o.indexOf(p);if(h!==-1&&y!==-1){let k=o.splice(h,1)[0];o.splice(y,0,k),n([...o])}},resetColumnsOrder:l,resetColumnsToggle:c,setColumnWidth:f,setMultipleColumnWidths:b,resetColumnsWidth:d},children:t})};var Rt=require("react/jsx-runtime");function Yt(){return(0,Rt.jsx)("tr",{className:"mantine-datatable-empty-row",children:(0,Rt.jsx)("td",{})})}var nt=require("@mantine/core");var ae=require("react/jsx-runtime");function qt(){return(0,ae.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ae.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,ae.jsx)("path",{d:"M12.983 8.978c3.955 -.182 7.017 -1.446 7.017 -2.978c0 -1.657 -3.582 -3 -8 -3c-1.661 0 -3.204 .19 -4.483 .515m-2.783 1.228c-.471 .382 -.734 .808 -.734 1.257c0 1.22 1.944 2.271 4.734 2.74"}),(0,ae.jsx)("path",{d:"M4 6v6c0 1.657 3.582 3 8 3c.986 0 1.93 -.067 2.802 -.19m3.187 -.82c1.251 -.53 2.011 -1.228 2.011 -1.99v-6"}),(0,ae.jsx)("path",{d:"M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4"}),(0,ae.jsx)("path",{d:"M3 3l18 18"})]})}var oe=require("react/jsx-runtime");function jt({icon:e,text:t,active:o,children:n}){return(0,oe.jsx)(nt.Center,{className:"mantine-datatable-empty-state","data-active":o||void 0,children:n||(0,oe.jsxs)(oe.Fragment,{children:[e||(0,oe.jsx)("div",{className:"mantine-datatable-empty-state-icon",children:(0,oe.jsx)(qt,{})}),(0,oe.jsx)(nt.Text,{component:"div",size:"sm",c:"dimmed",children:t})]})})}var ct=require("@mantine/core"),Po=B(require("clsx"));var Co=require("@mantine/core"),yo=B(require("clsx"));var Pt=require("react");var at=require("@mantine/hooks"),eo=require("react"),vt=({key:e,columns:t=[],getInitialValueInEffect:o=!0})=>{function n(s,D){let u=[];return s.forEach(i=>{D.find(C=>C.accessor===i)&&u.push(i)}),D.forEach(i=>{u.includes(i.accessor)||u.push(i.accessor)}),u}function a(s,D){let u=[];return s.forEach(i=>{D.find(C=>C.accessor===i.accessor)&&u.push(i)}),D.forEach(i=>{u.find(C=>C.accessor===i.accessor)||u.push({accessor:i.accessor,defaultToggle:i.defaultToggle||!0,toggleable:i.toggleable,toggled:i.defaultToggle===void 0?!0:i.defaultToggle})}),u}function r(s,D){let u=[];return s.forEach(i=>{let C=Object.keys(i)[0];D.find(v=>v.accessor===C)&&u.push(i)}),D.forEach(i=>{let C=i.accessor;if(!u.find(v=>Object.keys(v)[0]===C)){let v={};v[C]="",u.push(v)}}),u}function l(){let[s,D]=(0,at.useLocalStorage)({key:e?`${e}-columns-order`:"",defaultValue:e?b:void 0,getInitialValueInEffect:o});function u(v){e&&D(v)}if(!e)return[s,u];let i=n(s,t),C=JSON.stringify(s);return JSON.stringify(i)!==C&&u(i),[i,u]}function c(){let[s,D]=(0,at.useLocalStorage)({key:e?`${e}-columns-toggle`:"",defaultValue:e?g:void 0,getInitialValueInEffect:o});function u(v){e&&D(v)}if(!e)return[s,u];let i=a(s,t),C=JSON.stringify(s);return JSON.stringify(i)!==C&&u(i),[a(s,t),u]}function f(){let[s,D]=(0,at.useLocalStorage)({key:e?`${e}-columns-width`:"",defaultValue:e?d:void 0,getInitialValueInEffect:o});function u(v){e&&D(v)}if(!e)return[s,u];let i=r(s,t),C=JSON.stringify(s);return JSON.stringify(i)!==C&&u(i),[r(s,t),u]}let b=t&&t.map(s=>s.accessor)||[],d=t&&t.map(s=>({[s.accessor]:s.width??"initial"}))||[],g=t&&t.map(s=>({accessor:s.accessor,defaultToggle:s.defaultToggle||!0,toggleable:s.toggleable,toggled:s.defaultToggle===void 0?!0:s.defaultToggle})),[m,p]=l(),[T,M]=c(),[h,y]=f(),k=()=>p(b),S=()=>{M(g)},w=()=>y(d);return{effectiveColumns:(0,eo.useMemo)(()=>m?m.map(u=>t.find(i=>i.accessor===u)).map(u=>({...u,hidden:u?.hidden||!T.find(i=>i.accessor===u?.accessor)?.toggled})).map(u=>({...u,width:h.find(i=>i[u?.accessor])?.[u?.accessor]})):t,[t,m,T,h]),setColumnsOrder:p,columnsOrder:m,resetColumnsOrder:k,columnsToggle:T,setColumnsToggle:M,resetColumnsToggle:S,columnsWidth:h,setColumnsWidth:y,setColumnWidth:(s,D)=>{let u=h.map(i=>i[s]?{[s]:D}:i);y(u)},setMultipleColumnWidths:s=>{let D=h.map(u=>{let i=Object.keys(u)[0],C=s.find(v=>v.accessor===i);return C?{[i]:C.width}:u});y(D)},resetColumnsWidth:w}};var lo=require("@mantine/core"),z=require("react");var rt=require("react"),Mt=typeof window<"u"?rt.useLayoutEffect:rt.useEffect;var to=require("react");function kt(e){let t=(0,to.useRef)(e);return t.current=e,t}var oo="--mantine-datatable-header-height",no="--mantine-datatable-footer-height",ao="--mantine-datatable-selection-column-width",ro="--mantine-datatable-last-row-border-bottom";function X(e,t,o){e?.style.setProperty(t,o)}function Nt(e){let t=e.borderBoxSize?.[0]||e.contentBoxSize?.[0];return t?{width:t.inlineSize,height:t.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}}function Et(e,t,o){if(e){let n=new ResizeObserver(a=>{let r=a[0];r&&t(Nt(r))});return n.observe(e),()=>{n.disconnect(),o()}}}function io({scrollCallbacks:e,withRowBorders:t}){let o={root:(0,z.useRef)(null),table:(0,z.useRef)(null),scrollViewport:(0,z.useRef)(null),header:(0,z.useRef)(null),footer:(0,z.useRef)(null),selectionColumnHeader:(0,z.useRef)(null)},{root:n,table:a,scrollViewport:r,header:l,footer:c,selectionColumnHeader:f}=o,b=kt({withRowBorders:t}),d=kt(e),g=(0,z.useRef)(()=>{}),m=(0,z.useRef)(()=>{}),p=(0,z.useCallback)(T=>{d.current.onScroll?.(T),g.current()},[]);return(0,z.useEffect)(()=>Et(l.current,T=>{X(n.current,oo,`${T.height}px`)},()=>X(n.current,oo,"0")),[l.current]),(0,z.useEffect)(()=>Et(c.current,T=>{X(n.current,no,`${T.height}px`)},()=>X(n.current,no,"0")),[c.current]),(0,z.useEffect)(()=>Et(f.current,T=>{X(n.current,ao,`${T.width}px`)},()=>X(n.current,ao,"0")),[f.current]),Mt(()=>{if(typeof window===void 0)return;let T={top:!0,bottom:!0,left:!0,right:!0},M={width:0,height:0},h={width:0,height:0};function y(P,x){let s=T[P];return T[P]=x,X(n.current,`--mantine-datatable-${P}-shadow-opacity`,x?"0":"1"),s}function k(){let P=M.height-h.height,x=P<0;X(n.current,"--mantine-datatable-footer-position",x?"relative":"sticky"),X(n.current,"--mantine-datatable-footer-bottom",x?`${P}px`:"0")}function S(){b.current.withRowBorders&&M.height<h.height?X(n.current,ro,`${(0,lo.rem)("1px")} solid var(--mantine-datatable-border-color)`):X(n.current,ro,"unset")}m.current=S;function w(){let P=d.current,x=r.current?.scrollTop??0,s=r.current?.scrollLeft??0,D=x===0,u=M.height-x-h.height<1,i=y("top",D),C=y("bottom",u);D&&D!==i&&P.onScrollToTop?.(),u&&u!==C&&P.onScrollToBottom?.();let v=s===0,V=M.width-s-h.width<1,$=y("left",v),K=y("right",V);v&&v!==$&&P.onScrollToLeft?.(),V&&V!==K&&P.onScrollToRight?.()}g.current=w;let E=new ResizeObserver(P=>{for(let x of P)switch(x.target.tagName){case"TABLE":{M=Nt(x);break}case"DIV":{h=Nt(x);break}}w(),k(),S()});return E.observe(a.current),E.observe(r.current),()=>{E.disconnect()}},[]),Mt(()=>{m.current()},[t]),{refs:o,onScroll:p}}var lt=require("react");function so(e){let[t,o]=(0,lt.useState)(null),n=e?.join(":")||"";return(0,lt.useEffect)(()=>{o(null)},[n]),{lastSelectionChangeIndex:t,setLastSelectionChangeIndex:o}}var Pe=require("react");function La(e,t){let o=()=>{t(e.map(a=>a.matches))},n=e.map(a=>{try{return a.addEventListener("change",o),()=>a.removeEventListener("change",o)}catch{return a.addListener(o),()=>a.removeListener(o)}});return()=>{n.forEach(a=>a())}}function Wa(e,t){return t||(typeof window<"u"&&"matchMedia"in window?e.map(o=>window.matchMedia(o).matches):e.map(()=>!1))}function co(e,t,{getInitialValueInEffect:o}={getInitialValueInEffect:!0}){let[n,a]=(0,Pe.useState)(o?t:Wa(e,t)),r=(0,Pe.useRef)(null);return(0,Pe.useEffect)(()=>{if("matchMedia"in window)return r.current=e.map(l=>window.matchMedia(l)),a(r.current.map(l=>l.matches)),La(r.current,l=>{a(l)})},[e]),n}var uo=require("@mantine/core"),Lt=require("react");function mo(e){let t=(0,uo.useMantineTheme)(),o=(0,Lt.useMemo)(()=>e.map(a=>(typeof a=="function"?a(t):a)??""),[e,t]),n=(0,Lt.useMemo)(()=>e.map(()=>!0),[e]);return co(o,n)}var po=require("@mantine/core"),fo=require("@mantine/hooks");function re(e){let t=(0,po.useMantineTheme)(),o=typeof e=="function"?e(t):e;return(0,fo.useMediaQuery)(o||"",!0)}var bo=require("react");function Te(e){let t=e.replace(/([a-z\d])([A-Z]+)/g,"$1 $2").replace(/\W|_/g," ").trim().toLowerCase();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function Wt(e,t,o){return e.filter(n=>!t.map(o).includes(o(n)))}function $e(e,t){return e.filter((o,n,a)=>n===a.findIndex(r=>t(o)===t(r)))}function it(e,t){return t?t.match(/([^[.\]])+/g).reduce((n,a)=>n&&n[a],e):void 0}function H(e,t){return typeof t=="string"?it(e,t):t(e)}function Ia(e,t){let o=structuredClone(t),n=o[e.source.index];return e.destination&&(o.splice(e.source.index,1),o.splice(e.destination.index,0,n)),o}function Ha(e,t){let o=structuredClone(t),n=e.destination;if(!n)return o;let a=o[e.source.index],r=o[n.index];return o.splice(n.index,1,a),o.splice(e.source.index,1,r),o}function To({rowExpansion:e,records:t,idAccessor:o}){let n=[];if(e&&t){let{trigger:c,allowMultiple:f,initiallyExpanded:b}=e;t&&c==="always"?n=t.map(d=>H(d,o)):b&&(n=t.filter((d,g)=>b({record:d,index:g})).map(d=>H(d,o)),f||(n=[n[0]]))}let a,r,l=(0,bo.useState)(n);if(e){let{expandable:c,trigger:f,allowMultiple:b,collapseProps:d,content:g}=e;e.expanded?{recordIds:a,onRecordIdsChange:r}=e.expanded:[a,r]=l;let m=p=>r?.(a.filter(T=>T!==H(p,o)));return{expandOnClick:f!=="always"&&f!=="never",isRowExpanded:p=>f==="always"?!0:a.includes(H(p,o)),isExpandable:({record:p,index:T})=>c?c({record:p,index:T}):!0,expandRow:p=>{let T=H(p,o);r?.(b?[...a,T]:[T])},collapseRow:m,collapseProps:d,content:({record:p,index:T})=>()=>g({record:p,index:T,collapse:()=>m(p)})}}}var It=require("@mantine/hooks"),Xe=require("react");function go(e,t){let[o,n]=(0,Xe.useState)(e),[a,r]=(0,Xe.useState)(e),l=(0,It.useTimeout)(()=>n(!0),0),c=(0,It.useTimeout)(()=>r(!1),t||200);return(0,Xe.useEffect)(()=>{e?(c.clear(),r(!0),l.start()):(l.clear(),n(!1),c.start())},[l,c,e]),{expanded:o,visible:a}}var ve="mantine-datatable-nowrap",Me="mantine-datatable-ellipsis",Z="mantine-datatable-pointer-cursor",st="mantine-datatable-context-menu-cursor",ho="mantine-datatable-text-selection-disabled",le="mantine-datatable-text-align-left",ie="mantine-datatable-text-align-center",se="mantine-datatable-text-align-right";var Do=require("react/jsx-runtime");function xo({className:e,style:t,visibleMediaQuery:o,title:n,noWrap:a,ellipsis:r,textAlign:l,width:c}){return re(o)?(0,Do.jsx)(Co.TableTh,{className:(0,yo.default)({[ve]:a||r,[Me]:r,[le]:l==="left",[ie]:l==="center",[se]:l==="right"},e),style:[{width:c,minWidth:c,maxWidth:c},t],children:n}):null}var wo=require("@mantine/core"),Ro=require("react/jsx-runtime");function So({shadowVisible:e}){return(0,Ro.jsx)(wo.TableTh,{className:"mantine-datatable-footer-selector-placeholder-cell","data-shadow-visible":e||void 0})}var ke=require("react/jsx-runtime");function vo({className:e,style:t,columns:o,defaultColumnProps:n,selectionVisible:a,selectorCellShadowVisible:r,ref:l}){return(0,ke.jsx)(ct.TableTfoot,{ref:l,className:(0,Po.default)("mantine-datatable-footer",e),style:t,children:(0,ke.jsxs)(ct.TableTr,{children:[a&&(0,ke.jsx)(So,{shadowVisible:r}),o.map(({hidden:c,...f})=>{if(c)return null;let{accessor:b,visibleMediaQuery:d,textAlign:g,width:m,footer:p,footerClassName:T,footerStyle:M,noWrap:h,ellipsis:y}={...n,...f};return(0,ke.jsx)(xo,{className:T,style:M,visibleMediaQuery:d,textAlign:g,width:m,title:p,noWrap:h,ellipsis:y},b)})]})})}var O=require("@mantine/core"),$o=B(require("clsx")),Xo=require("react");var Mo=require("@mantine/core"),ko=B(require("clsx")),Ht=require("react");var No=require("react/jsx-runtime");function Eo({group:{id:e,columns:t,title:o,textAlign:n,className:a,style:r}}){let l=(0,Ht.useMemo)(()=>t.map(({visibleMediaQuery:b})=>b),[t]),c=mo(l),f=(0,Ht.useMemo)(()=>t.filter(({hidden:b},d)=>!b&&c?.[d]).length,[t,c]);return f>0?(0,No.jsx)(Mo.TableTh,{colSpan:f,className:(0,ko.default)("mantine-datatable-column-group-header-cell",{[le]:n==="left",[ie]:n==="center",[se]:n==="right"},a),style:r,children:o??Te(e)}):null}var A=require("@mantine/core"),Ke=B(require("clsx")),ut=require("react");var ce=require("@mantine/core"),dt=require("@mantine/hooks");var Qe=require("react/jsx-runtime");function Lo(){return(0,Qe.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Qe.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,Qe.jsx)("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"})]})}var Ue=require("react/jsx-runtime");function Wo(){return(0,Ue.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ue.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,Ue.jsx)("path",{d:"M20 3h-16a1 1 0 0 0 -1 1v2.227l.008 .223a3 3 0 0 0 .772 1.795l4.22 4.641v8.114a1 1 0 0 0 1.316 .949l6 -2l.108 -.043a1 1 0 0 0 .576 -.906v-6.586l4.121 -4.12a3 3 0 0 0 .879 -2.123v-2.171a1 1 0 0 0 -1 -1z",strokeWidth:"0",fill:"currentColor"})]})}var ge=require("react/jsx-runtime");function Io({children:e,isActive:t,filterPopoverProps:o,filterPopoverDisableClickOutside:n}){let[a,{close:r,toggle:l}]=(0,dt.useDisclosure)(!1),c=t?Wo:Lo,f=(0,dt.useClickOutside)(r);return n&&(f=void 0),(0,ge.jsxs)(ce.Popover,{withArrow:!0,shadow:"md",opened:a,onClose:r,trapFocus:!0,...o,children:[(0,ge.jsx)(ce.PopoverTarget,{children:(0,ge.jsx)(ce.ActionIcon,{className:"mantine-datatable-header-cell-filter-action-icon","data-active":t||void 0,size:"sm",variant:"default",onClick:b=>{b.preventDefault(),l()},onKeyDown:b=>b.stopPropagation(),children:(0,ge.jsx)(c,{})})}),(0,ge.jsx)(ce.PopoverDropdown,{ref:f,onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),children:typeof e=="function"?e({close:r}):e})]})}var de=require("react");var Oo=require("react/jsx-runtime"),Ho=e=>{let{accessor:t,columnRef:o}=e,[n,a]=(0,de.useState)(!1),r=(0,de.useRef)(0),l=(0,de.useRef)({current:0,next:0}),{setMultipleColumnWidths:c}=Re(),f=(0,de.useCallback)(d=>{if(d.preventDefault(),d.stopPropagation(),!o.current)return;let g=o.current,m=g.nextElementSibling;for(;m;){let S=m.getAttribute("data-accessor");if(S&&S!=="__selection__")break;m=m.nextElementSibling}if(!m)return;let p=m.getAttribute("data-accessor");if(!p)return;let T=p==="__selection__";a(!0),r.current=d.clientX;let M=g.offsetWidth,h=m.offsetWidth;l.current={current:M,next:h};let y=S=>{if(!o.current)return;let w=o.current,E=w.nextElementSibling;if(!E)return;let P=S.clientX-r.current,x=50,s=l.current.current-x,D=l.current.next-x,u=Math.max(-s,Math.min(P,D)),i=l.current.current+u,C=l.current.next-u;w.style.width=`${i}px`,E.style.width=`${C}px`,w.style.minWidth=`${i}px`,w.style.maxWidth=`${i}px`,E.style.minWidth=`${C}px`,E.style.maxWidth=`${C}px`},k=()=>{if(!o.current)return;let S=o.current,w=S.nextElementSibling;a(!1),document.body.style.cursor="initial",document.body.style.userSelect="initial";let E=parseInt(S.style.width)||S.offsetWidth,P=w?parseInt(w.style.width)||w.offsetWidth:0,x=[{accessor:t,width:`${E}px`}];if(w&&!T){let s=w.getAttribute("data-accessor");s&&x.push({accessor:s,width:`${P}px`})}setTimeout(()=>{c(x)},0),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",k)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",y),document.addEventListener("mouseup",k)},[t,c]),b=(0,de.useCallback)(()=>{if(!o.current)return;let d=o.current,g=d.nextElementSibling;d.style.width="",d.style.minWidth="",d.style.maxWidth="";let m=[{accessor:t,width:"initial"}];if(g){g.style.width="",g.style.minWidth="",g.style.maxWidth="";let p=g.getAttribute("data-accessor");p&&p!=="__selection__"&&m.push({accessor:p,width:"initial"})}setTimeout(()=>{c(m)},0)},[t,c]);return(0,Oo.jsx)("div",{className:"mantine-datatable-header-resizable-handle",style:{cursor:n?"col-resize":void 0},onMouseDown:f,onDoubleClick:b,onClick:d=>d.stopPropagation(),title:"Drag to resize column, double-click to reset"})};var he=require("react/jsx-runtime");function Ao(){return(0,he.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,he.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,he.jsx)("path",{d:"M12 5l0 14"}),(0,he.jsx)("path",{d:"M16 9l-4 -4"}),(0,he.jsx)("path",{d:"M8 9l4 -4"})]})}var Ce=require("react/jsx-runtime");function _o(){return(0,Ce.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ce.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,Ce.jsx)("path",{d:"M8 7l4 -4l4 4"}),(0,Ce.jsx)("path",{d:"M8 17l4 4l4 -4"}),(0,Ce.jsx)("path",{d:"M12 3l0 18"})]})}var Y=require("react/jsx-runtime");function zo(){return(0,Y.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Y.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,Y.jsx)("path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),(0,Y.jsx)("path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),(0,Y.jsx)("path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),(0,Y.jsx)("path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),(0,Y.jsx)("path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),(0,Y.jsx)("path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}var Ee=require("react/jsx-runtime");function Vo(){return(0,Ee.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ee.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,Ee.jsx)("path",{d:"M18 6l-12 12"}),(0,Ee.jsx)("path",{d:"M6 6l12 12"})]})}var N=require("react/jsx-runtime");function Bo({className:e,style:t,accessor:o,visibleMediaQuery:n,title:a,sortable:r,draggable:l,toggleable:c,resizable:f,sortIcons:b,textAlign:d,width:g,sortStatus:m,onSortStatusChange:p,filter:T,filterPopoverProps:M,filterPopoverDisableClickOutside:h,filtering:y,sortKey:k}){let{setSourceColumn:S,setTargetColumn:w,swapColumns:E,setColumnsToggle:P}=Re(),[x,s]=(0,ut.useState)(!1),D=(0,ut.useRef)(null);if(!re(n))return null;let u=a??Te(o),i=typeof u=="string"?u:void 0,C=r&&p?I=>{I?.defaultPrevented||p({sortKey:k,columnAccessor:o,direction:m?.columnAccessor===o?m.direction==="asc"?"desc":"asc":m?.direction??"asc"})}:void 0,v=I=>{I.stopPropagation(),S(o),s(!1)},V=I=>{I.preventDefault(),w(o),s(!0)},$=()=>{w(o),s(!1),E()},K=()=>{s(!0)},J=()=>{s(!1)},j=I=>{I.stopPropagation(),P(me=>me.map(ee=>ee.accessor===o?{...ee,toggled:!1}:ee))};return(0,N.jsxs)(A.TableTh,{"data-accessor":o,className:(0,Ke.default)({"mantine-datatable-header-cell-sortable":r,"mantine-datatable-header-cell-toggleable":c,"mantine-datatable-header-cell-resizable":f},e),style:[{width:g,...f?{minWidth:"1px"}:{minWidth:g,maxWidth:g}},t],role:r?"button":void 0,tabIndex:r?0:void 0,onClick:C,onKeyDown:I=>I.key==="Enter"&&C?.(),ref:D,children:[(0,N.jsxs)(A.Group,{className:"mantine-datatable-header-cell-sortable-group",justify:"space-between",wrap:"nowrap",children:[(0,N.jsxs)(A.Flex,{align:"center",w:"100%",className:(0,Ke.default)({"mantine-datatable-header-cell-draggable":l,"mantine-datatable-header-cell-drag-over":x}),draggable:l,onDragStart:l?v:void 0,onDragEnter:l?K:void 0,onDragOver:l?V:void 0,onDrop:l?$:void 0,onDragLeave:l?J:void 0,children:[l?(0,N.jsx)(A.Center,{role:"img","aria-label":"Drag column",children:(0,N.jsx)(A.ActionIcon,{className:"mantine-datatable-header-cell-draggable-action-icon",variant:"subtle",size:"xs",onClick:I=>{I.stopPropagation()},children:(0,N.jsx)(zo,{})})}):null,(0,N.jsx)(A.Box,{className:(0,Ke.default)("mantine-datatable-header-cell-sortable-text",{[le]:d==="left",[ie]:d==="center",[se]:d==="right"},ve,Me),title:i,children:u})]}),c?(0,N.jsx)(A.Center,{className:"mantine-datatable-header-cell-toggleable-icon",role:"img","aria-label":"Toggle column",children:(0,N.jsx)(A.ActionIcon,{size:"xs",variant:"light",onClick:j,children:(0,N.jsx)(Vo,{})})}):null,r||m?.columnAccessor===o?(0,N.jsx)(N.Fragment,{children:m?.columnAccessor===o?(0,N.jsx)(A.Center,{className:(0,Ke.default)("mantine-datatable-header-cell-sortable-icon",{"mantine-datatable-header-cell-sortable-icon-reversed":m.direction==="desc"}),role:"img","aria-label":`Sorted ${m.direction==="desc"?"descending":"ascending"}`,children:b?.sorted||(0,N.jsx)(Ao,{})}):(0,N.jsx)(A.Center,{className:"mantine-datatable-header-cell-sortable-unsorted-icon",role:"img","aria-label":"Not sorted",children:b?.unsorted||(0,N.jsx)(_o,{})})}):null,T?(0,N.jsx)(Io,{filterPopoverProps:M,isActive:!!y,filterPopoverDisableClickOutside:h,children:T}):null]}),f&&o!=="__selection__"?(0,N.jsx)(Ho,{accessor:o,columnRef:D}):null]})}var mt=require("@mantine/core"),Fo=B(require("clsx"));var Ot=require("react/jsx-runtime");function Go({className:e,style:t,trigger:o,shadowVisible:n,checked:a,indeterminate:r,checkboxProps:l,onChange:c,rowSpan:f,ref:b}){let d=!l.disabled;return(0,Ot.jsx)(mt.TableTh,{ref:b,className:(0,Fo.default)("mantine-datatable-header-selector-cell",{[Z]:o==="cell"&&d},e),style:t,rowSpan:f,"data-shadow-visible":n||void 0,"data-accessor":"__selection__",onClick:o==="cell"&&d?c:void 0,children:(0,Ot.jsx)(mt.Checkbox,{classNames:d?{input:Z}:void 0,checked:a,indeterminate:r,onChange:c,...l,disabled:!(c||l.onChange)||l.disabled})})}var F=require("react/jsx-runtime");function Qo({selectionColumnHeaderRef:e,className:t,style:o,sortStatus:n,sortIcons:a,onSortStatusChange:r,columns:l,defaultColumnProps:c,groups:f,selectionTrigger:b,selectionVisible:d,selectionChecked:g,selectionIndeterminate:m,onSelectionChange:p,selectionCheckboxProps:T,selectorCellShadowVisible:M,selectionColumnClassName:h,selectionColumnStyle:y,ref:k}){let S=d?(0,F.jsx)(Go,{ref:e,className:h,style:y,trigger:b,shadowVisible:M,checked:g,indeterminate:m,checkboxProps:T,onChange:p,rowSpan:f?2:void 0}):null,{columnsToggle:w,setColumnsToggle:E}=Re(),[P,x]=(0,Xo.useState)(!1),s=l.some(i=>i.toggleable),D=s?Object.fromEntries(l.map(({accessor:i,title:C})=>[i,C??Te(String(i))])):void 0,u=(0,F.jsxs)(O.TableThead,{className:(0,$o.default)("mantine-datatable-header",t),style:o,ref:k,onContextMenu:s?i=>{i.preventDefault(),x(C=>!C)}:void 0,children:[f&&(0,F.jsxs)(O.TableTr,{children:[S,f.map(i=>(0,F.jsx)(Eo,{group:i},i.id))]}),(0,F.jsxs)(O.TableTr,{children:[!f&&S,l.map(({hidden:i,...C},v)=>{if(i)return null;let{accessor:V,visibleMediaQuery:$,textAlign:K,width:J,title:j,sortable:I,draggable:me,toggleable:ee,resizable:We,titleClassName:Ie,titleStyle:He,filter:Oe,filterPopoverProps:pe,filterPopoverDisableClickOutside:Ae,filtering:_e,sortKey:te}={...c,...C};return(0,F.jsx)(Bo,{accessor:V,className:Ie,style:He,visibleMediaQuery:$,textAlign:K,width:J,title:j,sortable:I,draggable:me,toggleable:ee,resizable:We&&v<l.length-1,sortStatus:n,sortIcons:a,sortKey:te,onSortStatusChange:r,filter:Oe,filterPopoverProps:pe,filterPopoverDisableClickOutside:Ae,filtering:_e},V)})]})]});return s?(0,F.jsxs)(O.Popover,{position:"bottom",withArrow:!0,shadow:"md",opened:P,onChange:x,children:[(0,F.jsx)(O.PopoverTarget,{children:u}),(0,F.jsx)(O.PopoverDropdown,{children:(0,F.jsx)(O.Stack,{children:w.filter(i=>i.toggleable).map(i=>(0,F.jsx)(O.Group,{children:(0,F.jsx)(O.Checkbox,{classNames:{label:"mantine-datatable-header-column-toggle-checkbox-label"},size:"xs",label:D[i.accessor],checked:i.toggled,onChange:C=>{E(w.map(v=>v.accessor===i.accessor?{...v,toggled:C.currentTarget.checked}:v))}})},i.accessor))})})]}):u}var pt=require("@mantine/core"),Uo=B(require("clsx")),At=require("react/jsx-runtime");function Ko({fetching:e,customContent:t,backgroundBlur:o,size:n,type:a,color:r}){return(0,At.jsx)(pt.Center,{className:(0,Uo.default)("mantine-datatable-loader",{"mantine-datatable-loader-fetching":e}),style:[{backdropFilter:o?`blur(${o}px)`:void 0}],children:e&&(t||(0,At.jsx)(pt.Loader,{size:n,type:a,color:r}))})}var ue=require("@mantine/core"),_t=B(require("clsx"));var L=require("@mantine/core"),en=B(require("clsx"));var Jo=require("@mantine/core");function W(e,t,o){return e?(0,Jo.parseThemeColor)({color:typeof e=="object"?e[o]:e,theme:t}).value:void 0}function Zo({theme:e,c:t,backgroundColor:o,borderColor:n,rowBorderColor:a,stripedColor:r,highlightOnHoverColor:l}){return{"--mantine-datatable-color-light":W(t,e,"light"),"--mantine-datatable-color-dark":W(t,e,"dark"),"--mantine-datatable-background-color-light":W(o,e,"light"),"--mantine-datatable-background-color-dark":W(o,e,"dark"),"--mantine-datatable-border-color-light":W(n,e,"light"),"--mantine-datatable-border-color-dark":W(n,e,"dark"),"--mantine-datatable-row-border-color-light":W(a,e,"light"),"--mantine-datatable-row-border-color-dark":W(a,e,"dark"),"--mantine-datatable-striped-color-light":W(r,e,"light"),"--mantine-datatable-striped-color-dark":W(r,e,"dark"),"--mantine-datatable-highlight-on-hover-color-light":W(l,e,"light"),"--mantine-datatable-highlight-on-hover-color-dark":W(l,e,"dark")}}function ft({theme:e,paginationActiveTextColor:t,paginationActiveBackgroundColor:o}){return{"--mantine-datatable-pagination-active-text-color-light":W(t,e,"light"),"--mantine-datatable-pagination-active-text-color-dark":W(t,e,"dark"),"--mantine-datatable-pagination-active-background-color-light":W(o,e,"light"),"--mantine-datatable-pagination-active-background-color-dark":W(o,e,"dark")}}function Yo({theme:e,color:t,backgroundColor:o}){return{"--mantine-datatable-row-color-light":W(t,e,"light"),"--mantine-datatable-row-color-dark":W(t,e,"dark"),"--mantine-datatable-row-background-color-light":W(o,e,"light"),"--mantine-datatable-row-background-color-dark":W(o,e,"dark")}}var Ne=require("react/jsx-runtime");function qo(){return(0,Ne.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ne.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,Ne.jsx)("path",{d:"M8 9l4 -4l4 4"}),(0,Ne.jsx)("path",{d:"M16 15l-4 4l-4 -4"})]})}var Q=require("react/jsx-runtime"),jo={xs:(0,L.rem)(22),sm:(0,L.rem)(26),md:(0,L.rem)(32),lg:(0,L.rem)(38),xl:(0,L.rem)(44)};function tn({size:e,label:t,values:o,value:n,activeTextColor:a,activeBackgroundColor:r,onChange:l}){return(0,Q.jsxs)(L.Group,{gap:"xs",children:[(0,Q.jsx)(L.Text,{component:"div",size:e,children:t}),(0,Q.jsxs)(L.Menu,{withinPortal:!0,withArrow:!0,offset:2,classNames:{arrow:"mantine-datatable-page-size-selector-menu-arrow"},children:[(0,Q.jsx)(L.MenuTarget,{children:(0,Q.jsx)(L.Button,{size:e,variant:"default",classNames:{section:"mantine-datatable-page-size-selector-button-icon"},rightSection:(0,Q.jsx)(qo,{}),style:[{fontWeight:"normal"},c=>({height:jo[e],paddingLeft:c.spacing[e],paddingRight:c.spacing[e]})],children:n})}),(0,Q.jsx)(L.MenuDropdown,{children:o.map(c=>{let f=c===n;return(0,Q.jsx)(L.MenuItem,{className:(0,en.default)({"mantine-datatable-page-size-selector-active":f}),style:[{height:jo[e]},f&&(a||r)?b=>ft({theme:b,paginationActiveTextColor:a,paginationActiveBackgroundColor:r}):void 0],disabled:f,onClick:()=>l(c),children:(0,Q.jsx)(L.Text,{component:"div",size:e,children:c})},c)})})]})]})}var Le=require("react/jsx-runtime");function on({className:e,style:t,fetching:o,page:n,onPageChange:a,paginationWithEdges:r,paginationWithControls:l,paginationActiveTextColor:c,paginationActiveBackgroundColor:f,paginationSize:b,loadingText:d,noRecordsText:g,paginationText:m,totalRecords:p,recordsPerPage:T,onRecordsPerPageChange:M,recordsPerPageLabel:h,recordsPerPageOptions:y,recordsLength:k,horizontalSpacing:S,paginationWrapBreakpoint:w,getPaginationControlProps:E}){let P;if(p){let s=(n-1)*T+1,D=s+(k||0)-1;P=m({from:s,to:D,totalRecords:p})}else P=o?d:g;let x=re(({breakpoints:s})=>`(min-width: ${typeof w=="number"?`${(0,ue.rem)(w)}rem`:s[w]||w})`);return(0,Le.jsxs)(ue.Box,{px:S??"xs",py:"xs",className:(0,_t.default)("mantine-datatable-pagination",e),style:[{flexDirection:x?"row":"column"},t],children:[(0,Le.jsx)(ue.Text,{component:"div",className:"mantine-datatable-pagination-text",size:b,children:P}),y&&(0,Le.jsx)(tn,{activeTextColor:c,activeBackgroundColor:f,size:b,label:h,values:y,value:T,onChange:M}),(0,Le.jsx)(ue.Pagination,{classNames:{root:(0,_t.default)("mantine-datatable-pagination-pages",{"mantine-datatable-pagination-pages-fetching":o||!k}),control:"mantine-datatable-pagination-pages-control"},style:c||f?s=>ft({theme:s,paginationActiveTextColor:c,paginationActiveBackgroundColor:f}):void 0,withEdges:r,withControls:l,value:n,onChange:a,size:b,total:Math.ceil(p/T),getControlProps:E})]})}var un=require("@mantine/core"),mn=B(require("clsx"));var nn=require("@mantine/core"),an=B(require("clsx"));var ln=require("react/jsx-runtime");function rn({className:e,style:t,visibleMediaQuery:o,record:n,index:a,onClick:r,onDoubleClick:l,onContextMenu:c,noWrap:f,ellipsis:b,textAlign:d,width:g,accessor:m,render:p,defaultRender:T,customCellAttributes:M}){return re(o)?(0,ln.jsx)(nn.TableTd,{className:(0,an.default)({[ve]:f||b,[Me]:b,[Z]:r||l,[st]:c,[le]:d==="left",[ie]:d==="center",[se]:d==="right"},e),style:[{width:g,minWidth:g,maxWidth:g},t],onClick:r,onDoubleClick:l,onContextMenu:c,...M?.(n,a),children:p?p(n,a):T?T(n,a,m):it(n,m)}):null}var ye=require("@mantine/core");var q=require("react/jsx-runtime");function sn({open:e,colSpan:t,content:o,collapseProps:n}){let{expanded:a,visible:r}=go(e,n?.transitionDuration);return r?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ye.TableTr,{}),(0,q.jsx)(ye.TableTr,{children:(0,q.jsx)(ye.TableTd,{className:"mantine-datatable-row-expansion-cell",colSpan:t,children:(0,q.jsx)(ye.Collapse,{in:a,...n,children:(0,q.jsx)("div",{className:"mantine-datatable-row-expansion-cell-content",children:o()})})})})]}):null}var bt=require("@mantine/core"),cn=B(require("clsx"));var zt=require("react/jsx-runtime");function dn({className:e,style:t,record:o,index:n,trigger:a,onChange:r,withRightShadow:l,checkboxProps:c,getCheckboxProps:f,...b}){let d={...c,...f(o,n)},g=!b.disabled&&!d.disabled,m=p=>{p.stopPropagation(),a==="cell"&&g&&r?.(p)};return(0,zt.jsx)(bt.TableTd,{className:(0,cn.default)("mantine-datatable-row-selector-cell",{[Z]:a==="cell"&&g},e),style:t,"data-shadow-visible":l||void 0,onClick:m,children:(0,zt.jsx)(bt.Checkbox,{classNames:g?{input:Z}:void 0,onChange:r,...b,...d})})}var U=require("react/jsx-runtime");function pn({record:e,index:t,columns:o,defaultColumnProps:n,defaultColumnRender:a,selectionTrigger:r,selectionVisible:l,selectionChecked:c,onSelectionChange:f,isRecordSelectable:b,selectionCheckboxProps:d,getSelectionCheckboxProps:g,onClick:m,onDoubleClick:p,onContextMenu:T,onCellClick:M,onCellDoubleClick:h,onCellContextMenu:y,expansion:k,customAttributes:S,color:w,backgroundColor:E,className:P,style:x,selectorCellShadowVisible:s,selectionColumnClassName:D,selectionColumnStyle:u,rowFactory:i}){let C=(0,U.jsxs)(U.Fragment,{children:[l&&(0,U.jsx)(dn,{className:D,style:u,record:e,index:t,trigger:r,withRightShadow:s,checked:c,disabled:!f||(b?!b(e,t):!1),onChange:f,checkboxProps:d,getCheckboxProps:g}),o.map(({hidden:$,hiddenContent:K,...J},j)=>{if($||K)return null;let{accessor:I,visibleMediaQuery:me,textAlign:ee,noWrap:We,ellipsis:Ie,width:He,render:Oe,cellsClassName:pe,cellsStyle:Ae,customCellAttributes:_e}={...n,...J};return(0,U.jsx)(rn,{className:typeof pe=="function"?pe(e,t):pe,style:Ae?.(e,t),visibleMediaQuery:me,record:e,index:t,onClick:M?te=>M({event:te,record:e,index:t,column:J,columnIndex:j}):void 0,onDoubleClick:h?te=>h({event:te,record:e,index:t,column:J,columnIndex:j}):void 0,onContextMenu:y?te=>y({event:te,record:e,index:t,column:J,columnIndex:j}):void 0,accessor:I,textAlign:ee,noWrap:We,ellipsis:Ie,width:He,render:Oe,defaultRender:a,customCellAttributes:_e},I)})]}),v=k&&(0,U.jsx)(sn,{colSpan:o.filter(({hidden:$})=>!$).length+(l?1:0),open:k.isRowExpanded(e),content:k.content({record:e,index:t}),collapseProps:k.collapseProps}),V=Oa({record:e,index:t,selectionChecked:c,onClick:m,onDoubleClick:p,onContextMenu:T,expansion:k,customAttributes:S,color:w,backgroundColor:E,className:P,style:x});return i?i({record:e,index:t,rowProps:V,children:C,expandedElement:v}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(un.TableTr,{...V,children:C}),v]})}function Oa({record:e,index:t,selectionChecked:o,onClick:n,onDoubleClick:a,onContextMenu:r,expansion:l,customAttributes:c,color:f,backgroundColor:b,className:d,style:g}){return{className:(0,mn.default)("mantine-datatable-row",{[Z]:n||a||l?.isExpandable({record:e,index:t})&&l?.expandOnClick},{[st]:r},typeof d=="function"?d(e,t):d),"data-selected":o||void 0,onClick:m=>{if(l){let{isExpandable:p,isRowExpanded:T,expandOnClick:M,expandRow:h,collapseRow:y}=l;p({record:e,index:t})&&M&&(T(e)?y(e):h(e))}n?.({event:m,record:e,index:t})},onDoubleClick:a?m=>a({event:m,record:e,index:t}):void 0,onContextMenu:r?m=>r({event:m,record:e,index:t}):void 0,style:[f||b?m=>{let p=f?.(e,t),T=b?.(e,t);return Yo({theme:m,color:p,backgroundColor:T})}:void 0,g?.(e,t)],...c?.(e,t)??{}}}var Ze=require("@mantine/core"),Je=B(require("clsx")),xe=require("react/jsx-runtime");function fn({leftShadowBehind:e,rightShadowBehind:t,onScrollPositionChange:o,children:n,viewportRef:a,scrollAreaProps:r}){return(0,xe.jsxs)(Ze.ScrollArea,{...r,viewportRef:a,classNames:{root:"mantine-datatable-scroll-area",scrollbar:"mantine-datatable-scroll-area-scrollbar",thumb:"mantine-datatable-scroll-area-thumb",corner:"mantine-datatable-scroll-area-corner"},onScrollPositionChange:o,children:[n,(0,xe.jsx)(Ze.Box,{className:(0,Je.default)("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-top-shadow")}),(0,xe.jsx)("div",{className:(0,Je.default)("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-left-shadow",{"mantine-datatable-scroll-area-shadow-behind":e})}),(0,xe.jsx)("div",{className:(0,Je.default)("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-right-shadow",{"mantine-datatable-scroll-area-shadow-behind":t})}),(0,xe.jsx)(Ze.Box,{className:(0,Je.default)("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-bottom-shadow")})]})}var _=require("react/jsx-runtime");function bn({withTableBorder:e,borderRadius:t,textSelectionDisabled:o,height:n="100%",minHeight:a,maxHeight:r,shadow:l,verticalAlign:c="center",fetching:f,columns:b,storeColumnsKey:d,groups:g,pinFirstColumn:m,pinLastColumn:p,defaultColumnProps:T,defaultColumnRender:M,idAccessor:h="id",records:y,selectionTrigger:k="checkbox",selectedRecords:S,onSelectedRecordsChange:w,selectionColumnClassName:E,selectionColumnStyle:P,isRecordSelectable:x,selectionCheckboxProps:s,allRecordsSelectionCheckboxProps:D={"aria-label":"Select all records"},getRecordSelectionCheckboxProps:u=(G,Be)=>({"aria-label":`Select record ${Be+1}`}),sortStatus:i,sortIcons:C,onSortStatusChange:v,horizontalSpacing:V,page:$,onPageChange:K,totalRecords:J,recordsPerPage:j,onRecordsPerPageChange:I,recordsPerPageOptions:me,recordsPerPageLabel:ee="Records per page",paginationWithEdges:We,paginationWithControls:Ie,paginationActiveTextColor:He,paginationActiveBackgroundColor:Oe,paginationSize:pe="sm",paginationText:Ae=({from:G,to:Be,totalRecords:Ye})=>`${G} - ${Be} / ${Ye}`,paginationWrapBreakpoint:_e="sm",getPaginationControlProps:te=G=>G==="previous"?{"aria-label":"Previous page"}:G==="next"?{"aria-label":"Next page"}:{},loaderBackgroundBlur:yn,customLoader:xn,loaderSize:Dn,loaderType:wn,loaderColor:Sn,loadingText:Rn="...",emptyState:Pn,noRecordsText:Ft="No records",noRecordsIcon:vn,highlightOnHover:Mn,striped:kn,noHeader:En,onRowClick:Nn,onRowDoubleClick:Ln,onRowContextMenu:Wn,onCellClick:In,onCellDoubleClick:Hn,onCellContextMenu:On,onScroll:An,onScrollToTop:_n,onScrollToBottom:zn,onScrollToLeft:Vn,onScrollToRight:Bn,c:Fn,backgroundColor:Gn,borderColor:$n,rowBorderColor:Xn,stripedColor:Qn,highlightOnHoverColor:Un,rowColor:Kn,rowBackgroundColor:Jn,rowExpansion:Zn,rowClassName:Yn,rowStyle:qn,customRowAttributes:jn,scrollViewportRef:ea,scrollAreaProps:ta,tableRef:oa,bodyRef:na,m:aa,my:ra,mx:la,mt:ia,mb:sa,ml:ca,mr:da,className:ua,classNames:ze,style:ma,styles:Ve,rowFactory:pa,tableWrapper:ht,...Gt}){let G=(0,De.useMemo)(()=>g?.flatMap(R=>R.columns)??b,[b,g]),Be=(0,De.useMemo)(()=>G.some(R=>R.resizable),[G]),Ye=vt({key:d,columns:G}),{refs:ne,onScroll:fa}=io({scrollCallbacks:{onScroll:An,onScrollToTop:_n,onScrollToBottom:zn,onScrollToLeft:Vn,onScrollToRight:Bn},withRowBorders:Gt.withRowBorders}),ba=(0,Vt.useMergedRef)(ne.table,oa),Ta=(0,Vt.useMergedRef)(ne.scrollViewport,ea),ga=To({rowExpansion:Zn,records:y,idAccessor:h}),ha=(0,De.useCallback)(R=>{ne.scrollViewport.current?.scrollTo({top:0,left:0}),K(R)},[K,ne.scrollViewport]),qe=y?.length,$t=y?.map(R=>H(R,h)),we=!!S,Fe=S?.map(R=>H(R,h)),Xt=$t!==void 0&&Fe!==void 0&&Fe.length>0,Ct=x?y?.filter(x):y,je=Ct?.map(R=>H(R,h)),et=Xt&&je.every(R=>Fe.includes(R)),Ca=Xt&&je.some(R=>Fe.includes(R)),ya=(0,De.useCallback)(()=>{S&&w&&w(et?S.filter(R=>!je.includes(H(R,h))):$e([...S,...Ct],R=>H(R,h)))},[et,h,w,je,Ct,S]),{lastSelectionChangeIndex:tt,setLastSelectionChangeIndex:xa}=so($t),yt=we&&!m,Da={m:aa,my:ra,mx:la,mt:ia,mb:sa,ml:ca,mr:da},wa=(0,De.useCallback)(({children:R})=>ht?ht({children:R}):R,[ht]);return(0,_.jsx)(St,{...Ye,children:(0,_.jsxs)(Tt.Box,{ref:ne.root,...Da,className:(0,Bt.default)("mantine-datatable",{"mantine-datatable-with-border":e},ua,ze?.root),style:[R=>({...Zo({theme:R,c:Fn,backgroundColor:Gn,borderColor:$n,rowBorderColor:Xn,stripedColor:Qn,highlightOnHoverColor:Un}),borderRadius:R.radius[t]||t,boxShadow:R.shadows[l]||l,height:n,minHeight:a,maxHeight:r}),ma,Ve?.root,{position:"relative"}],children:[(0,_.jsx)(fn,{viewportRef:Ta,leftShadowBehind:we||!!m,rightShadowBehind:p,onScrollPositionChange:fa,scrollAreaProps:ta,children:(0,_.jsx)(wa,{children:(0,_.jsxs)(Tt.Table,{ref:ba,horizontalSpacing:V,className:(0,Bt.default)("mantine-datatable-table",{[ho]:o,"mantine-datatable-vertical-align-top":c==="top","mantine-datatable-vertical-align-bottom":c==="bottom","mantine-datatable-pin-last-column":p,"mantine-datatable-selection-column-visible":we,"mantine-datatable-pin-first-column":m,"mantine-datatable-resizable-columns":Be},ze?.table),style:{...Ve?.table},"data-striped":qe&&kn||void 0,"data-highlight-on-hover":Mn||void 0,...Gt,children:[En?null:(0,_.jsx)(St,{...Ye,children:(0,_.jsx)(Qo,{ref:ne.header,selectionColumnHeaderRef:ne.selectionColumnHeader,className:ze?.header,style:Ve?.header,columns:G,defaultColumnProps:T,groups:g,sortStatus:i,sortIcons:C,onSortStatusChange:v,selectionTrigger:k,selectionVisible:we,selectionChecked:et,selectionIndeterminate:Ca&&!et,onSelectionChange:ya,selectionCheckboxProps:{...s,...D},selectorCellShadowVisible:yt,selectionColumnClassName:E,selectionColumnStyle:P})}),(0,_.jsx)("tbody",{ref:na,children:qe?y.map((R,Ge)=>{let xt=H(R,h),Dt=Fe?.includes(xt)||!1,Qt;return w&&S&&(Qt=Sa=>{if(Sa.nativeEvent.shiftKey&&tt!==null){let Se=y.filter(Ge>tt?(fe,be)=>be>=tt&&be<=Ge&&(x?x(fe,be):!0):(fe,be)=>be>=Ge&&be<=tt&&(x?x(fe,be):!0));w(Dt?Wt(S,Se,fe=>H(fe,h)):$e([...S,...Se],fe=>H(fe,h)))}else w(Dt?S.filter(Se=>H(Se,h)!==xt):$e([...S,R],Se=>H(Se,h)));xa(Ge)}),(0,_.jsx)(pn,{record:R,index:Ge,columns:G,defaultColumnProps:T,defaultColumnRender:M,selectionTrigger:k,selectionVisible:we,selectionChecked:Dt,onSelectionChange:Qt,isRecordSelectable:x,selectionCheckboxProps:s,getSelectionCheckboxProps:u,onClick:Nn,onDoubleClick:Ln,onCellClick:In,onCellDoubleClick:Hn,onContextMenu:Wn,onCellContextMenu:On,expansion:ga,color:Kn,backgroundColor:Jn,className:Yn,style:qn,customAttributes:jn,selectorCellShadowVisible:yt,selectionColumnClassName:E,selectionColumnStyle:P,idAccessor:h,rowFactory:pa},xt)}):(0,_.jsx)(Yt,{})}),G.some(({footer:R})=>R)&&(0,_.jsx)(vo,{ref:ne.footer,className:ze?.footer,style:Ve?.footer,columns:G,defaultColumnProps:T,selectionVisible:we,selectorCellShadowVisible:yt})]})})}),$&&(0,_.jsx)(on,{className:ze?.pagination,style:Ve?.pagination,horizontalSpacing:V,fetching:f,page:$,onPageChange:ha,totalRecords:J,recordsPerPage:j,onRecordsPerPageChange:I,recordsPerPageOptions:me,recordsPerPageLabel:ee,paginationWithEdges:We,paginationWithControls:Ie,paginationActiveTextColor:He,paginationActiveBackgroundColor:Oe,paginationSize:pe,paginationText:Ae,paginationWrapBreakpoint:_e,getPaginationControlProps:te,noRecordsText:Ft,loadingText:Rn,recordsLength:qe}),(0,_.jsx)(Ko,{fetching:f,backgroundBlur:yn,customContent:xn,size:Dn,type:wn,color:Sn}),(0,_.jsx)(jt,{icon:vn,text:Ft,active:!f&&!qe,children:Pn})]})})}var Tn=require("@mantine/core"),gn=require("@mantine/hooks"),gt=require("react"),Cn=require("react/jsx-runtime");function hn({className:e,children:t,isDragging:o,ref:n,...a}){let r=(0,gt.useRef)(null),l=(0,gn.useMergedRef)(r,n);return(0,gt.useEffect)(()=>{if(!r.current||!o)return;let d=r.current.parentElement.parentElement.children[0].children[0];for(let g=0;g<d.children.length;g++){let p=d.children[g].getBoundingClientRect(),T=r.current.children[g];T.style.height=p.height+"px",T.style.width=p.width+"px",T.style.minWidth=p.width+"px",T.style.maxWidth=p.width+"px"}},[o,t]),(0,Cn.jsx)(Tn.TableTr,{"data-is-dragging":o,ref:l,...a,className:e,children:t})}0&&(module.exports={DataTable,DataTableDraggableRow,differenceBy,getRecordId,getValueAtPath,humanize,reorderRecords,swapRecords,uniqBy,useDataTableColumns}); //# sourceMappingURL=index.js.map