mantine-datatable 7.4.1 → 7.4.2

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.mjs CHANGED
@@ -1,2 +1,2 @@
1
- "use client";import{Box as Hr,Table as Or}from"@mantine/core";import{useMergedRef as Ro}from"@mantine/hooks";import ko from"clsx";import{useCallback as ze,useMemo as Wr,useState as Fe}from"react";import{useState as Dt}from"react";import{createSafeContext as Va}from"@mantine/core";var[yt,ve]=Va("useDataTableColumnsContext must be used within DataTableColumnProvider");import{jsx as za}from"react/jsx-runtime";var Ke=e=>{let{children:t,columnsOrder:o,setColumnsOrder:a,columnsToggle:n,setColumnsToggle:l,resetColumnsOrder:i,resetColumnsToggle:r,setColumnWidth:d,resetColumnsWidth:s}=e,[c,u]=Dt(""),[m,f]=Dt("");return za(yt,{value:{sourceColumn:c,setSourceColumn:u,targetColumn:m,setTargetColumn:f,columnsToggle:n,setColumnsToggle:l,swapColumns:()=>{if(!o||!a||!c||!m)return;let g=o.indexOf(c),p=o.indexOf(m);if(g!==-1&&p!==-1){let y=o.splice(g,1)[0];o.splice(p,0,y),a([...o])}},resetColumnsOrder:i,resetColumnsToggle:r,setColumnWidth:d,resetColumnsWidth:s},children:t})};import{jsx as wt}from"react/jsx-runtime";function St(){return wt("tr",{className:"mantine-datatable-empty-row",children:wt("td",{})})}import{Center as _a,Text as Ba}from"@mantine/core";import{jsx as Te,jsxs as Fa}from"react/jsx-runtime";function Pt(){return Fa("svg",{width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Te("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Te("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"}),Te("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"}),Te("path",{d:"M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4"}),Te("path",{d:"M3 3l18 18"})]})}import{Fragment as Ga,jsx as xe,jsxs as Xa}from"react/jsx-runtime";function vt({icon:e,text:t,pt:o,pb:a,active:n,children:l}){return xe(_a,{pt:o,pb:a,className:"mantine-datatable-empty-state","data-active":n||void 0,children:l||Xa(Ga,{children:[e||xe("div",{className:"mantine-datatable-empty-state-icon",children:xe(Pt,{})}),xe(Ba,{size:"sm",c:"dimmed",children:t})]})})}import{TableTfoot as pn,TableTr as fn,rem as bn}from"@mantine/core";import Tn from"clsx";import{forwardRef as gn}from"react";import{TableTh as sn}from"@mantine/core";import dn from"clsx";import{useLocalStorage as Je}from"@mantine/hooks";import{useMemo as Qa}from"react";var Ze=({key:e,columns:t=[]})=>{let o=t&&t.map(p=>p.accessor)||[],a=t&&t.map(p=>({[p.accessor]:p.width??"auto"}))||[],n=t&&t.map(p=>({accessor:p.accessor,defaultToggle:p.defaultToggle||!0,toggleable:p.toggleable,toggled:p.defaultToggle||!0})),[l,i]=Je({key:`${e}-columns-order`,defaultValue:o,getInitialValueInEffect:!0}),[r,d]=Je({key:`${e}-columns-toggle`,defaultValue:n,getInitialValueInEffect:!0}),[s,c]=Je({key:`${e}-columns-width`,defaultValue:a,getInitialValueInEffect:!0}),u=()=>i(o),m=()=>d(n),f=()=>c(a);return{effectiveColumns:Qa(()=>l?l.map(b=>t.find(h=>h.accessor===b)).filter(b=>r.find(h=>h.accessor===b?.accessor)?.toggled).map(b=>({...b,width:s.find(h=>h[b?.accessor])?.[b?.accessor]})):t,[t,l,r,s]),setColumnsOrder:i,columnsOrder:l,resetColumnsOrder:u,columnsToggle:r,setColumnsToggle:d,resetColumnsToggle:m,columnsWidth:s,setColumnsWidth:c,setColumnWidth:(p,y)=>{let b=s.map(h=>h[p]?{[p]:y}:h);c(b)},resetColumnsWidth:f}},tl=Ze;import{useResizeObserver as Ua}from"@mantine/hooks";function ae(){let[e]=Ua(),{width:t,height:o}=e.current?.getBoundingClientRect()||{width:0,height:0};return{ref:e,width:t,height:o}}import{useEffect as $a,useLayoutEffect as Ka}from"react";var xt=typeof window<"u"?Ka:$a;import{useEffect as Ja,useState as Za}from"react";function Mt(e){let[t,o]=Za(null),a=e?.join(":")||"";return Ja(()=>{o(null)},[a]),{lastSelectionChangeIndex:t,setLastSelectionChangeIndex:o}}import{useEffect as Ya,useRef as qa,useState as ja}from"react";function en(e,t){let o=()=>{t(e.map(n=>n.matches))},a=e.map(n=>{try{return n.addEventListener("change",o),()=>n.removeEventListener("change",o)}catch{return n.addListener(o),()=>n.removeListener(o)}});return()=>{a.forEach(n=>n())}}function tn(e,t){return t||(typeof window<"u"&&"matchMedia"in window?e.map(o=>window.matchMedia(o).matches):e.map(()=>!1))}function Rt(e,t,{getInitialValueInEffect:o}={getInitialValueInEffect:!0}){let[a,n]=ja(o?t:tn(e,t)),l=qa();return Ya(()=>{if("matchMedia"in window)return l.current=e.map(i=>window.matchMedia(i)),n(l.current.map(i=>i.matches)),en(l.current,i=>{n(i)})},[e]),a}import{useMantineTheme as on}from"@mantine/core";import{useMemo as kt}from"react";function Et(e){let t=on(),o=kt(()=>e.map(n=>(typeof n=="function"?n(t):n)??""),[e,t]),a=kt(()=>e.map(()=>!0),[e]);return Rt(o,a)}import{useMantineTheme as an}from"@mantine/core";import{useMediaQuery as nn}from"@mantine/hooks";function X(e){let t=an(),o=typeof e=="function"?e(t):e;return nn(o||"",!0)}import{useState as rn}from"react";function Me(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 Nt(e,t,o){return e.filter(a=>!t.map(o).includes(o(a)))}function Re(e,t){return e.filter((o,a,n)=>a===n.findIndex(l=>t(o)===t(l)))}function Ye(e,t){return t?t.match(/([^[.\]])+/g).reduce((a,n)=>a&&a[n],e):void 0}function M(e,t){return typeof t=="string"?Ye(e,t):t(e)}function Lt({rowExpansion:e,records:t,idAccessor:o}){let a=[];if(e&&t){let{trigger:r,allowMultiple:d,initiallyExpanded:s}=e;t&&r==="always"?a=t.map(c=>M(c,o)):s&&(a=t.filter((c,u)=>s({record:c,index:u})).map(c=>M(c,o)),d||(a=[a[0]]))}let n,l,i=rn(a);if(e){let{trigger:r,allowMultiple:d,collapseProps:s,content:c}=e;e.expanded?{recordIds:n,onRecordIdsChange:l}=e.expanded:[n,l]=i;let u=m=>l?.(n.filter(f=>f!==M(m,o)));return{expandOnClick:r!=="always"&&r!=="never",isRowExpanded:m=>r==="always"?!0:n.includes(M(m,o)),expandRow:m=>{let f=M(m,o);l?.(d?[...n,f]:[f])},collapseRow:u,collapseProps:s,content:({record:m,index:f})=>()=>c({record:m,index:f,collapse:()=>u(m)})}}}import{useTimeout as It}from"@mantine/hooks";import{useEffect as ln,useState as Ht}from"react";function Ot(e,t){let[o,a]=Ht(e),[n,l]=Ht(e),i=It(()=>a(!0),0),r=It(()=>l(!1),t||200);return ln(()=>{e?(r.clear(),l(!0),i.start()):(i.clear(),a(!1),r.start())},[i,r,e]),{expanded:o,visible:n}}var se="mantine-datatable-nowrap",de="mantine-datatable-ellipsis",B="mantine-datatable-pointer-cursor",ke="mantine-datatable-context-menu-cursor",Wt="mantine-datatable-text-selection-disabled",Q="mantine-datatable-text-align-left",U="mantine-datatable-text-align-center",$="mantine-datatable-text-align-right";import{jsx as cn}from"react/jsx-runtime";function At({className:e,style:t,visibleMediaQuery:o,title:a,noWrap:n,ellipsis:l,textAlign:i,width:r}){return X(o)?cn(sn,{className:dn({[se]:n||l,[de]:l,[Q]:i==="left",[U]:i==="center",[$]:i==="right"},e),style:[{width:r,minWidth:r,maxWidth:r},t],children:a}):null}import{TableTh as un}from"@mantine/core";import{jsx as mn}from"react/jsx-runtime";function Vt({shadowVisible:e}){return mn(un,{className:"mantine-datatable-footer-selector-placeholder-cell","data-shadow-visible":e||void 0})}import{jsx as qe,jsxs as hn}from"react/jsx-runtime";var zt=gn(function({className:t,style:o,columns:a,defaultColumnProps:n,selectionVisible:l,selectorCellShadowVisible:i,scrollDiff:r},d){let s=r<0;return qe(pn,{ref:d,className:Tn("mantine-datatable-footer",t),style:[{position:s?"relative":"sticky",bottom:bn(s?r:0)},o],children:hn(fn,{children:[l&&qe(Vt,{shadowVisible:i}),a.map(({hidden:c,...u})=>{if(c)return null;let{accessor:m,visibleMediaQuery:f,textAlign:D,width:g,footer:p,footerClassName:y,footerStyle:b,noWrap:h,ellipsis:x}={...n,...u};return qe(At,{className:y,style:b,visibleMediaQuery:f,textAlign:D,width:g,title:p,noWrap:h,ellipsis:x},m)})]})})});import{TableThead as qn,TableTr as no}from"@mantine/core";import jn from"clsx";import{forwardRef as er}from"react";import{TableTh as Cn}from"@mantine/core";import yn from"clsx";import{useMemo as Ft}from"react";import{jsx as Dn}from"react/jsx-runtime";function _t({group:{id:e,columns:t,title:o,textAlign:a,className:n,style:l}}){let i=Ft(()=>t.map(({visibleMediaQuery:s})=>s),[t]),r=Et(i),d=Ft(()=>t.filter(({hidden:s},c)=>!s&&r?.[c]).length,[t,r]);return d>0?Dn(Cn,{colSpan:d,className:yn("mantine-datatable-column-group-header-cell",{[Q]:a==="left",[U]:a==="center",[$]:a==="right"},n),style:l,children:o??Me(e)}):null}import{ActionIcon as qt,Box as Vn,Center as Ie,Checkbox as zn,Flex as Fn,Group as jt,Popover as _n,PopoverDropdown as Bn,PopoverTarget as Gn,Stack as Xn,TableTh as Qn}from"@mantine/core";import He from"clsx";import{useRef as Un,useState as eo}from"react";import{ActionIcon as Pn,Popover as vn,PopoverDropdown as xn,PopoverTarget as Mn}from"@mantine/core";import{useDisclosure as Rn}from"@mantine/hooks";import{jsx as Bt,jsxs as wn}from"react/jsx-runtime";function Gt(){return wn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Bt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Bt("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"})]})}import{jsx as Xt,jsxs as Sn}from"react/jsx-runtime";function Qt(){return Sn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Xt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Xt("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"})]})}import{jsx as Ee,jsxs as kn}from"react/jsx-runtime";function Ut({children:e,isActive:t}){let[o,{close:a,toggle:n}]=Rn(!1);return kn(vn,{withArrow:!0,withinPortal:!0,shadow:"md",opened:o,onClose:a,trapFocus:!0,children:[Ee(Mn,{children:Ee(Pn,{className:"mantine-datatable-header-cell-filter-action-icon","data-active":t||void 0,size:"sm",variant:"default",onClick:i=>{i.preventDefault(),n()},children:Ee(t?Qt:Gt,{})})}),Ee(xn,{onClick:i=>i.stopPropagation(),children:typeof e=="function"?e({close:a}):e})]})}import{rem as En}from"@mantine/core";import{useRef as Nn,useState as Ln}from"react";import{jsx as In}from"react/jsx-runtime";var $t=e=>{let{accessor:t,columnRef:o}=e,a=Nn(null),[n,l]=Ln(0),{setColumnWidth:i}=ve(),r=u=>{u.preventDefault(),u.stopPropagation(),document.addEventListener("mousemove",d),document.addEventListener("mouseup",s),document.body.style.cursor="col-resize"},d=u=>{if(!o.current)return;let m=u.clientX-o.current.getBoundingClientRect().right,D=`${o.current.getBoundingClientRect().width+m}px`;o.current.style.width=D,i(t,o.current.style.width),l(-m)},s=()=>{o.current&&(document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",s),document.body.style.cursor="initial",i(t,o.current.style.width),l(0))};return In("div",{ref:a,onClick:u=>u.stopPropagation(),onMouseDown:r,onDoubleClick:()=>{o.current&&(o.current.style.maxWidth="initial",o.current.style.minWidth="initial",o.current.style.width="initial",i(t,"initial"))},className:"mantine-datatable-header-resizable-handle",style:{right:En(n)}})};import{jsx as Ne,jsxs as Hn}from"react/jsx-runtime";function Kt(){return Hn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Ne("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Ne("path",{d:"M12 5l0 14"}),Ne("path",{d:"M16 9l-4 -4"}),Ne("path",{d:"M8 9l4 -4"})]})}import{jsx as Le,jsxs as On}from"react/jsx-runtime";function Jt(){return On("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Le("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Le("path",{d:"M8 7l4 -4l4 4"}),Le("path",{d:"M8 17l4 4l4 -4"}),Le("path",{d:"M12 3l0 18"})]})}import{jsx as ne,jsxs as Wn}from"react/jsx-runtime";function Zt(){return Wn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[ne("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ne("path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}import{jsx as je,jsxs as An}from"react/jsx-runtime";function Yt(){return An("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[je("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),je("path",{d:"M18 6l-12 12"}),je("path",{d:"M6 6l12 12"})]})}import{Fragment as $n,jsx as v,jsxs as Oe}from"react/jsx-runtime";function to({className:e,style:t,accessor:o,visibleMediaQuery:a,title:n,sortable:l,draggable:i,toggleable:r,resizable:d,sortIcons:s,textAlign:c,width:u,sortStatus:m,onSortStatusChange:f,filter:D,filtering:g}){let{setSourceColumn:p,setTargetColumn:y,swapColumns:b,columnsToggle:h,setColumnsToggle:x}=ve(),[R,P]=eo(!1),L=Un(null),[F,k]=eo(!1);if(!X(a))return null;let w=n??Me(o),N=typeof w=="string"?w:void 0,E=l&&f?C=>{C?.defaultPrevented||f({columnAccessor:o,direction:m?.columnAccessor===o?m.direction==="asc"?"desc":"asc":m?.direction??"asc"})}:void 0,H=C=>{C.stopPropagation(),p(o),P(!1)},_=C=>{C.preventDefault(),y(o),P(!0)},K=()=>{y(o),P(!1),b()},J=()=>{P(!0)},Z=()=>{P(!1)},Y=C=>{C.stopPropagation(),x(O=>O.map(W=>W.accessor===o?{...W,toggled:!1}:W))};return Oe(Qn,{className:He({"mantine-datatable-header-cell-sortable":l,"mantine-datatable-header-cell-toggleable":r,"mantine-datatable-header-cell-resizable":d},e),style:[{width:u,...d?{minWidth:"1px"}:{minWidth:u,maxWidth:u}},t],role:l?"button":void 0,tabIndex:l?0:void 0,onClick:E,onContextMenu:C=>{r&&(C.preventDefault(),k(!0))},onKeyDown:C=>C.key==="Enter"&&E?.(),ref:L,children:[Oe(jt,{className:"mantine-datatable-header-cell-sortable-group",justify:"space-between",wrap:"nowrap",children:[Oe(_n,{width:200,position:"bottom",withArrow:!0,shadow:"md",opened:F,onChange:k,children:[v(Gn,{children:Oe(Fn,{align:"center",w:"100%",className:He({"mantine-datatable-header-cell-draggable":i,"mantine-datatable-header-cell-drag-over":R}),draggable:i,onDragStart:i?H:void 0,onDragEnter:i?J:void 0,onDragOver:i?_:void 0,onDrop:i?K:void 0,onDragLeave:i?Z:void 0,children:[i?v(Ie,{role:"img","aria-label":"Drag column",children:v(qt,{className:"mantine-datatable-header-cell-draggable-action-icon",variant:"subtle",size:"xs",onClick:C=>{C.stopPropagation()},children:v(Zt,{})})}):null,v(Vn,{className:He("mantine-datatable-header-cell-sortable-text",{[Q]:c==="left",[U]:c==="center",[$]:c==="right"},se,de),title:N,children:w})]})}),v(Bn,{children:v(Xn,{children:h.filter(C=>C.toggleable).map(C=>v(jt,{children:v(zn,{size:"xs",label:C.accessor,checked:C.toggled,onChange:O=>{x(h.map(W=>W.accessor===C.accessor?{...W,toggled:O.currentTarget.checked}:W))}})},C.accessor))})})]}),r?v(Ie,{className:"mantine-datatable-header-cell-toggleable-icon",role:"img","aria-label":"Toggle column",children:v(qt,{size:"xs",variant:"light",onClick:Y,children:v(Yt,{})})}):null,l||m?.columnAccessor===o?v($n,{children:m?.columnAccessor===o?v(Ie,{className:He("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:s?.sorted||v(Kt,{})}):v(Ie,{className:"mantine-datatable-header-cell-sortable-unsorted-icon",role:"img","aria-label":"Not sorted",children:s?.unsorted||v(Jt,{})})}):null,D?v(Ut,{isActive:!!g,children:D}):null]}),d?v($t,{accessor:o,columnRef:L}):null]})}import{Checkbox as Kn,TableTh as Jn}from"@mantine/core";import Zn from"clsx";import{forwardRef as Yn}from"react";import{jsx as oo}from"react/jsx-runtime";var ao=Yn(function({className:t,style:o,trigger:a,shadowVisible:n,checked:l,indeterminate:i,checkboxProps:r,onChange:d,rowSpan:s},c){let u=!r.disabled;return oo(Jn,{ref:c,className:Zn("mantine-datatable-header-selector-cell",{[B]:a==="cell"&&u},t),style:o,rowSpan:s,"data-shadow-visible":n||void 0,onClick:a==="cell"&&u?d:void 0,children:oo(Kn,{classNames:u?{input:B}:void 0,checked:l,indeterminate:i,onChange:d,...r,disabled:!(d||r.onChange)||r.disabled})})});import{jsx as et,jsxs as tt}from"react/jsx-runtime";var ro=er(function({selectionColumnHeaderRef:t,className:o,style:a,sortStatus:n,sortIcons:l,onSortStatusChange:i,columns:r,defaultColumnProps:d,groups:s,selectionTrigger:c,selectionVisible:u,selectionChecked:m,selectionIndeterminate:f,onSelectionChange:D,selectionCheckboxProps:g,selectorCellShadowVisible:p,selectionColumnClassName:y,selectionColumnStyle:b},h){let x=u?et(ao,{ref:t,className:y,style:b,trigger:c,shadowVisible:p,checked:m,indeterminate:f,checkboxProps:g,onChange:D,rowSpan:s?2:void 0}):null;return tt(qn,{className:jn("mantine-datatable-header",o),style:a,ref:h,children:[s&&tt(no,{children:[x,s.map(R=>et(_t,{group:R},R.id))]}),tt(no,{children:[!s&&x,r.map(({hidden:R,...P},L)=>{if(R)return null;let{accessor:F,visibleMediaQuery:k,textAlign:w,width:N,title:E,sortable:H,draggable:_,toggleable:K,resizable:J,titleClassName:Z,titleStyle:Y,filter:C,filtering:O}={...d,...P};return et(to,{accessor:F,className:Z,style:Y,visibleMediaQuery:k,textAlign:w,width:N,title:E,sortable:H,draggable:_,toggleable:K,resizable:J&&L<r.length-1,sortStatus:n,sortIcons:l,onSortStatusChange:i,filter:C,filtering:O},F)})]})]})});import{Center as tr,Loader as or}from"@mantine/core";import ar from"clsx";import{jsx as lo}from"react/jsx-runtime";function io({pt:e,pb:t,fetching:o,customContent:a,backgroundBlur:n,size:l,type:i,color:r}){return lo(tr,{pt:e,pb:t,className:ar("mantine-datatable-loader",{"mantine-datatable-loader-fetching":o}),style:[{backdropFilter:n?`blur(${n}px)`:void 0}],children:o&&(a||lo(or,{size:l,type:i,color:r}))})}import{Box as pr,Pagination as fr,Text as br,rem as Tr}from"@mantine/core";import To from"clsx";import{forwardRef as gr}from"react";import{Button as lr,Group as ir,Menu as sr,MenuDropdown as dr,MenuItem as cr,MenuTarget as ur,Text as mo,rem as ge}from"@mantine/core";import mr from"clsx";import{parseThemeColor as nr}from"@mantine/core";function S(e,t,o){return e?nr({color:typeof e=="object"?e[o]:e,theme:t}).value:void 0}function so({theme:e,c:t,backgroundColor:o,borderColor:a,rowBorderColor:n,stripedColor:l,highlightOnHoverColor:i}){return{"--mantine-datatable-color-light":S(t,e,"light"),"--mantine-datatable-color-dark":S(t,e,"dark"),"--mantine-datatable-background-color-light":S(o,e,"light"),"--mantine-datatable-background-color-dark":S(o,e,"dark"),"--mantine-datatable-border-color-light":S(a,e,"light"),"--mantine-datatable-border-color-dark":S(a,e,"dark"),"--mantine-datatable-row-border-color-light":S(n,e,"light"),"--mantine-datatable-row-border-color-dark":S(n,e,"dark"),"--mantine-datatable-striped-color-light":S(l,e,"light"),"--mantine-datatable-striped-color-dark":S(l,e,"dark"),"--mantine-datatable-highlight-on-hover-color-light":S(i,e,"light"),"--mantine-datatable-highlight-on-hover-color-dark":S(i,e,"dark")}}function We({theme:e,paginationActiveTextColor:t,paginationActiveBackgroundColor:o}){return{"--mantine-datatable-pagination-active-text-color-light":S(t,e,"light"),"--mantine-datatable-pagination-active-text-color-dark":S(t,e,"dark"),"--mantine-datatable-pagination-active-background-color-light":S(o,e,"light"),"--mantine-datatable-pagination-active-background-color-dark":S(o,e,"dark")}}function co({theme:e,color:t,backgroundColor:o}){return{"--mantine-datatable-row-color-light":S(t,e,"light"),"--mantine-datatable-row-color-dark":S(t,e,"dark"),"--mantine-datatable-row-background-color-light":S(o,e,"light"),"--mantine-datatable-row-background-color-dark":S(o,e,"dark")}}import{jsx as ot,jsxs as rr}from"react/jsx-runtime";function uo(){return rr("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[ot("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ot("path",{d:"M8 9l4 -4l4 4"}),ot("path",{d:"M16 15l-4 4l-4 -4"})]})}import{jsx as re,jsxs as fo}from"react/jsx-runtime";var po={xs:ge(22),sm:ge(26),md:ge(32),lg:ge(38),xl:ge(44)};function bo({size:e,label:t,values:o,value:a,activeTextColor:n,activeBackgroundColor:l,onChange:i}){return fo(ir,{gap:"xs",children:[re(mo,{size:e,children:t}),fo(sr,{withinPortal:!0,withArrow:!0,children:[re(ur,{children:re(lr,{size:e,variant:"default",classNames:{section:"mantine-datatable-page-size-selector-button-icon"},rightSection:re(uo,{}),style:[{fontWeight:"normal"},r=>({height:po[e],paddingLeft:r.spacing[e],paddingRight:r.spacing[e]})],children:a})}),re(dr,{children:o.map(r=>{let d=r===a;return re(cr,{className:mr({"mantine-datatable-page-size-selector-active":d}),style:[{height:po[e]},d&&(n||l)?s=>We({theme:s,paginationActiveTextColor:n,paginationActiveBackgroundColor:l}):void 0],disabled:d,onClick:()=>i(r),children:re(mo,{size:e,children:r})},r)})})]})]})}import{jsx as at,jsxs as hr}from"react/jsx-runtime";var go=gr(function({className:t,style:o,fetching:a,page:n,onPageChange:l,paginationWithEdges:i,paginationActiveTextColor:r,paginationActiveBackgroundColor:d,paginationSize:s,loadingText:c,noRecordsText:u,paginationText:m,totalRecords:f,recordsPerPage:D,onRecordsPerPageChange:g,recordsPerPageLabel:p,recordsPerPageOptions:y,recordsLength:b,horizontalSpacing:h,paginationWrapBreakpoint:x,getPaginationControlProps:R},P){let L;if(a)L=c;else if(!f)L=u;else{let k=(n-1)*D+1,w=k+b-1;L=m({from:k,to:w,totalRecords:f})}let F=X(({breakpoints:k})=>`(min-width: ${typeof x=="number"?`${Tr(x)}rem`:k[x]||x})`);return hr(pr,{ref:P,px:h??"xs",py:"xs",className:To("mantine-datatable-pagination",t),style:[{flexDirection:F?"row":"column"},o],children:[at(br,{className:"mantine-datatable-pagination-text",size:s,children:L}),y&&at(bo,{activeTextColor:r,activeBackgroundColor:d,size:s,label:p,values:y,value:D,onChange:g}),at(fr,{classNames:{root:To("mantine-datatable-pagination-pages",{"mantine-datatable-pagination-pages-fetching":a||!b}),control:"mantine-datatable-pagination-pages-control"},style:r||d?k=>We({theme:k,paginationActiveTextColor:r,paginationActiveBackgroundColor:d}):void 0,withEdges:i,value:n,onChange:l,size:s,total:Math.ceil(f/D),getControlProps:R})]})});import{TableTr as kr}from"@mantine/core";import Er from"clsx";import{TableTd as Cr}from"@mantine/core";import yr from"clsx";import{jsx as Dr}from"react/jsx-runtime";function ho({className:e,style:t,visibleMediaQuery:o,record:a,index:n,onClick:l,onDoubleClick:i,onContextMenu:r,noWrap:d,ellipsis:s,textAlign:c,width:u,accessor:m,render:f,defaultRender:D,customCellAttributes:g}){return X(o)?Dr(Cr,{className:yr({[se]:d||s,[de]:s,[B]:l||i,[ke]:r,[Q]:c==="left",[U]:c==="center",[$]:c==="right"},e),style:[{width:u,minWidth:u,maxWidth:u},t],onClick:l,onDoubleClick:i,onContextMenu:r,...g?.(a,n),children:f?f(a,n):D?D(a,n,m):Ye(a,m)}):null}import{Collapse as wr,TableTd as Sr,TableTr as Co}from"@mantine/core";import{Fragment as Pr,jsx as he,jsxs as vr}from"react/jsx-runtime";function yo({open:e,colSpan:t,content:o,collapseProps:a}){let{expanded:n,visible:l}=Ot(e,a?.transitionDuration);return l?vr(Pr,{children:[he(Co,{}),he(Co,{children:he(Sr,{className:"mantine-datatable-row-expansion-cell",colSpan:t,children:he(wr,{in:n,...a,children:he("div",{className:"mantine-datatable-row-expansion-cell-content",children:o()})})})})]}):null}import{Checkbox as xr,TableTd as Mr}from"@mantine/core";import Rr from"clsx";import{jsx as Do}from"react/jsx-runtime";function wo({className:e,style:t,record:o,index:a,trigger:n,onChange:l,withRightShadow:i,getCheckboxProps:r,...d}){let s=r(o,a),c=!d.disabled&&!s.disabled,u=m=>{m.stopPropagation(),n==="cell"&&c&&l?.(m)};return Do(Mr,{className:Rr("mantine-datatable-row-selector-cell",{[B]:n==="cell"&&c},e),style:t,"data-shadow-visible":i||void 0,onClick:u,children:Do(xr,{classNames:c?{input:B}:void 0,onChange:l,...d,...s})})}import{Fragment as Nr,jsx as nt,jsxs as So}from"react/jsx-runtime";function Po({record:e,index:t,columns:o,defaultColumnProps:a,defaultColumnRender:n,selectionTrigger:l,selectionVisible:i,selectionChecked:r,onSelectionChange:d,isRecordSelectable:s,getSelectionCheckboxProps:c,onClick:u,onDoubleClick:m,onContextMenu:f,onCellClick:D,onCellDoubleClick:g,onCellContextMenu:p,expansion:y,customAttributes:b,color:h,backgroundColor:x,className:R,style:P,selectorCellShadowVisible:L,selectionColumnClassName:F,selectionColumnStyle:k}){return So(Nr,{children:[So(kr,{className:Er("mantine-datatable-row",{[B]:u||m||y?.expandOnClick},{[ke]:f},typeof R=="function"?R(e,t):R),"data-selected":r||void 0,onClick:w=>{if(y){let{isRowExpanded:N,expandOnClick:E,expandRow:H,collapseRow:_}=y;E&&(N(e)?_(e):H(e))}u?.({event:w,record:e,index:t})},onDoubleClick:m?w=>m({event:w,record:e,index:t}):void 0,onContextMenu:f?w=>f({event:w,record:e,index:t}):void 0,style:[h||x?w=>{let N=h?.(e,t),E=x?.(e,t);return co({theme:w,color:N,backgroundColor:E})}:void 0,P?.(e,t)],...b?.(e,t),children:[i&&nt(wo,{className:F,style:k,record:e,index:t,trigger:l,withRightShadow:L,checked:r,disabled:!d||(s?!s(e,t):!1),onChange:d,getCheckboxProps:c}),o.map(({hidden:w,...N},E)=>{if(w)return null;let{accessor:H,visibleMediaQuery:_,textAlign:K,noWrap:J,ellipsis:Z,width:Y,render:C,cellsClassName:O,cellsStyle:W,customCellAttributes:_e}={...a,...N};return nt(ho,{className:typeof O=="function"?O(e,t):O,style:W?.(e,t),visibleMediaQuery:_,record:e,index:t,onClick:D?q=>D({event:q,record:e,index:t,column:N,columnIndex:E}):void 0,onDoubleClick:g?q=>g({event:q,record:e,index:t,column:N,columnIndex:E}):void 0,onContextMenu:p?q=>p({event:q,record:e,index:t,column:N,columnIndex:E}):void 0,accessor:H,textAlign:K,noWrap:J,ellipsis:Z,width:Y,render:C,defaultRender:n,customCellAttributes:_e},H)})]}),y&&nt(yo,{colSpan:o.filter(({hidden:w})=>!w).length+(i?1:0),open:y.isRowExpanded(e),content:y.content({record:e,index:t}),collapseProps:y.collapseProps})]})}import{Box as vo,ScrollArea as Lr,rem as xo}from"@mantine/core";import Ae from"clsx";import{jsx as Ve,jsxs as Ir}from"react/jsx-runtime";function Mo({topShadowVisible:e,leftShadowVisible:t,leftShadowBehind:o,rightShadowVisible:a,rightShadowBehind:n,bottomShadowVisible:l,headerHeight:i,footerHeight:r,onScrollPositionChange:d,children:s,viewportRef:c,scrollAreaProps:u}){return Ir(Lr,{...u,viewportRef:c,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:d,children:[s,Ve(vo,{className:Ae("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-top-shadow",{"mantine-datatable-scroll-area-shadow-visible":e}),style:{top:i?xo(i):0}}),Ve("div",{className:Ae("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-left-shadow",{"mantine-datatable-scroll-area-shadow-visible":t,"mantine-datatable-scroll-area-shadow-behind":o})}),Ve("div",{className:Ae("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-right-shadow",{"mantine-datatable-scroll-area-shadow-visible":a,"mantine-datatable-scroll-area-shadow-behind":n})}),Ve(vo,{className:Ae("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-bottom-shadow",{"mantine-datatable-scroll-area-shadow-visible":l}),style:{bottom:r?xo(r+1):0}})]})}import{jsx as z,jsxs as Eo}from"react/jsx-runtime";function Ar({withTableBorder:e,borderRadius:t,textSelectionDisabled:o,height:a="100%",minHeight:n,shadow:l,verticalAlign:i="center",fetching:r,columns:d,storeColumnsKey:s,groups:c,pinFirstColumn:u,pinLastColumn:m,defaultColumnProps:f,defaultColumnRender:D,idAccessor:g="id",records:p,selectionTrigger:y="checkbox",selectedRecords:b,onSelectedRecordsChange:h,selectionColumnClassName:x,selectionColumnStyle:R,isRecordSelectable:P,allRecordsSelectionCheckboxProps:L={"aria-label":"Select all records"},getRecordSelectionCheckboxProps:F=(I,j)=>({"aria-label":`Select record ${j+1}`}),sortStatus:k,sortIcons:w,onSortStatusChange:N,horizontalSpacing:E,page:H,onPageChange:_,totalRecords:K,recordsPerPage:J,onRecordsPerPageChange:Z,recordsPerPageOptions:Y,recordsPerPageLabel:C="Records per page",paginationWithEdges:O,paginationActiveTextColor:W,paginationActiveBackgroundColor:_e,paginationSize:q="sm",paginationText:No=({from:I,to:j,totalRecords:ee})=>`${I} - ${j} / ${ee}`,paginationWrapBreakpoint:Lo="sm",getPaginationControlProps:Io=I=>I==="previous"?{"aria-label":"Previous page"}:I==="next"?{"aria-label":"Next page"}:{},loaderBackgroundBlur:Ho,customLoader:Oo,loaderSize:Wo,loaderType:Ao,loaderColor:Vo,loadingText:zo="...",emptyState:Fo,noRecordsText:rt="No records",noRecordsIcon:_o,highlightOnHover:Bo,striped:Go,noHeader:Xo,onRowClick:Qo,onRowDoubleClick:Uo,onRowContextMenu:$o,onCellClick:Ko,onCellDoubleClick:Jo,onCellContextMenu:Zo,onScroll:lt,onScrollToTop:it,onScrollToBottom:st,onScrollToLeft:dt,onScrollToRight:ct,c:Yo,backgroundColor:qo,borderColor:jo,rowBorderColor:ea,stripedColor:ta,highlightOnHoverColor:oa,rowColor:aa,rowBackgroundColor:na,rowExpansion:ra,rowClassName:la,rowStyle:ia,customRowAttributes:sa,scrollViewportRef:da,scrollAreaProps:ca,tableRef:ua,bodyRef:ma,m:pa,my:fa,mx:ba,mt:Ta,mb:ga,ml:ha,mr:Ca,className:ya,classNames:ce,style:Da,styles:ue,...wa}){let{ref:I,width:j,height:ee}=ae(),me=Wr(()=>c?.flatMap(T=>T.columns)??d,[d,c]),ut=Ze({key:s,columns:me}),{ref:Sa,height:Be}=ae(),{ref:Pa,width:Ge,height:pe}=ae(),{ref:va,height:xa}=ae(),{ref:Ma,height:mt}=ae(),{ref:Ra,width:ka}=ae(),Ea=Ro(Pa,ua),[Xe,pt]=Fe(!0),[Qe,ft]=Fe(!0),[fe,bt]=Fe(!0),[Ce,Tt]=Fe(!0),Na=Lt({rowExpansion:ra,records:p,idAccessor:g}),ye=ze(()=>{let T=I.current?.scrollTop||0,G=I.current?.scrollLeft||0;if(r||pe<=ee)pt(!0),ft(!0);else{let A=T===0,V=pe-T-ee<1;pt(A),ft(V),A&&A!==Xe&&it?.(),V&&V!==Qe&&st?.()}if(r||Ge===j)bt(!0),Tt(!0);else{let A=G===0,V=Ge-G-j<1;bt(A),Tt(V),A&&A!==fe&&dt?.(),V&&V!==Ce&&ct?.()}},[r,st,dt,ct,it,ee,I,j,Qe,fe,Ce,Xe,pe,Ge]);xt(ye,[ye]);let La=ze(T=>{lt?.(T),ye()},[ye,lt]),Ia=ze(T=>{I.current?.scrollTo({top:0,left:0}),_(T)},[_,I]),De=p?.length,gt=p?.map(T=>M(T,g)),le=!!b,be=b?.map(T=>M(T,g)),ht=gt!==void 0&&be!==void 0&&be.length>0,Ue=P?p?.filter(P):p,we=Ue?.map(T=>M(T,g)),Se=ht&&we.every(T=>be.includes(T)),Ha=ht&&we.some(T=>be.includes(T)),Oa=ze(()=>{b&&h&&h(Se?b.filter(T=>!we.includes(M(T,g))):Re([...b,...Ue],T=>M(T,g)))},[Se,g,h,we,Ue,b]),{lastSelectionChangeIndex:Pe,setLastSelectionChangeIndex:Wa}=Mt(gt),$e=le&&!fe&&!u;return z(Ke,{...ut,children:Eo(Hr,{...{m:pa,my:fa,mx:ba,mt:Ta,mb:ga,ml:ha,mr:Ca},className:ko("mantine-datatable",{"mantine-datatable-with-border":e},ya,ce?.root),style:[T=>({...so({theme:T,c:Yo,backgroundColor:qo,borderColor:jo,rowBorderColor:ea,stripedColor:ta,highlightOnHoverColor:oa}),borderRadius:T.radius[t]||t,boxShadow:T.shadows[l]||l,height:a,minHeight:n}),Da,ue?.root],children:[z(Mo,{viewportRef:Ro(I,da),topShadowVisible:!Xe,leftShadowVisible:!fe,leftShadowBehind:le||!!u,rightShadowVisible:!Ce,rightShadowBehind:m,bottomShadowVisible:!Qe,headerHeight:Be,footerHeight:xa,onScrollPositionChange:La,scrollAreaProps:ca,children:Eo(Or,{ref:Ea,horizontalSpacing:E,className:ko("mantine-datatable-table",{[Wt]:o,"mantine-datatable-vertical-align-top":i==="top","mantine-datatable-vertical-align-bottom":i==="bottom","mantine-datatable-last-row-border-bottom-visible":pe<ee,"mantine-datatable-pin-last-column":m,"mantine-datatable-pin-last-column-scrolled":!Ce&&m,"mantine-datatable-selection-column-visible":le,"mantine-datatable-pin-first-column":u,"mantine-datatable-pin-first-column-scrolled":!fe&&u},ce?.table),style:{...ue?.table,"--mantine-datatable-selection-column-width":`${ka}px`},"data-striped":De&&Go||void 0,"data-highlight-on-hover":Bo||void 0,...wa,children:[Xo?null:z(Ke,{...ut,children:z(ro,{ref:Sa,selectionColumnHeaderRef:Ra,className:ce?.header,style:ue?.header,columns:me,defaultColumnProps:f,groups:c,sortStatus:k,sortIcons:w,onSortStatusChange:N,selectionTrigger:y,selectionVisible:le,selectionChecked:Se,selectionIndeterminate:Ha&&!Se,onSelectionChange:Oa,selectionCheckboxProps:L,selectorCellShadowVisible:$e,selectionColumnClassName:x,selectionColumnStyle:R})}),z("tbody",{ref:ma,children:De?p.map((T,G)=>{let A=M(T,g),V=be?.includes(A)||!1,Ct;return h&&b&&(Ct=Aa=>{if(Aa.nativeEvent.shiftKey&&Pe!==null){let ie=p.filter(G>Pe?(te,oe)=>oe>=Pe&&oe<=G&&(P?P(te,oe):!0):(te,oe)=>oe>=G&&oe<=Pe&&(P?P(te,oe):!0));h(V?Nt(b,ie,te=>M(te,g)):Re([...b,...ie],te=>M(te,g)))}else h(V?b.filter(ie=>M(ie,g)!==A):Re([...b,T],ie=>M(ie,g)));Wa(G)}),z(Po,{record:T,index:G,columns:me,defaultColumnProps:f,defaultColumnRender:D,selectionTrigger:y,selectionVisible:le,selectionChecked:V,onSelectionChange:Ct,isRecordSelectable:P,getSelectionCheckboxProps:F,onClick:Qo,onDoubleClick:Uo,onCellClick:Ko,onCellDoubleClick:Jo,onContextMenu:$o,onCellContextMenu:Zo,expansion:Na,color:aa,backgroundColor:na,className:la,style:ia,customAttributes:sa,selectorCellShadowVisible:$e,selectionColumnClassName:x,selectionColumnStyle:R},A)}):z(St,{})}),me.some(({footer:T})=>T)&&z(zt,{ref:va,className:ce?.footer,style:ue?.footer,columns:me,defaultColumnProps:f,selectionVisible:le,selectorCellShadowVisible:$e,scrollDiff:pe-ee})]})}),H&&z(go,{ref:Ma,className:ce?.pagination,style:ue?.pagination,horizontalSpacing:E,fetching:r,page:H,onPageChange:Ia,totalRecords:K,recordsPerPage:J,onRecordsPerPageChange:Z,recordsPerPageOptions:Y,recordsPerPageLabel:C,paginationWithEdges:O,paginationActiveTextColor:W,paginationActiveBackgroundColor:_e,paginationSize:q,paginationText:No,paginationWrapBreakpoint:Lo,getPaginationControlProps:Io,noRecordsText:rt,loadingText:zo,recordsLength:De}),z(io,{pt:Be,pb:mt,fetching:r,backgroundBlur:Ho,customContent:Oo,size:Wo,type:Ao,color:Vo}),z(vt,{pt:Be,pb:mt,icon:_o,text:rt,active:!r&&!De,children:Fo})]})})}export{Ar as DataTable,Nt as differenceBy,M as getRecordId,Ye as getValueAtPath,Me as humanize,Re as uniqBy,Ze as useDataTableColumns,tl as useDragToggleColumns};
1
+ "use client";import{Box as Hr,Table as Or}from"@mantine/core";import{useMergedRef as Ma}from"@mantine/hooks";import Ra from"clsx";import{useCallback as ze,useMemo as Wr,useState as Fe}from"react";import{useState as Dt}from"react";import{createSafeContext as Vo}from"@mantine/core";var[yt,xe]=Vo("useDataTableColumnsContext must be used within DataTableColumnProvider");import{jsx as zo}from"react/jsx-runtime";var Ke=e=>{let{children:t,columnsOrder:a,setColumnsOrder:o,columnsToggle:n,setColumnsToggle:l,resetColumnsOrder:i,resetColumnsToggle:r,setColumnWidth:d,resetColumnsWidth:s}=e,[c,u]=Dt(""),[m,f]=Dt("");return zo(yt,{value:{sourceColumn:c,setSourceColumn:u,targetColumn:m,setTargetColumn:f,columnsToggle:n,setColumnsToggle:l,swapColumns:()=>{if(!a||!o||!c||!m)return;let g=a.indexOf(c),p=a.indexOf(m);if(g!==-1&&p!==-1){let y=a.splice(g,1)[0];a.splice(p,0,y),o([...a])}},resetColumnsOrder:i,resetColumnsToggle:r,setColumnWidth:d,resetColumnsWidth:s},children:t})};import{jsx as wt}from"react/jsx-runtime";function St(){return wt("tr",{className:"mantine-datatable-empty-row",children:wt("td",{})})}import{Center as _o,Text as Bo}from"@mantine/core";import{jsx as Te,jsxs as Fo}from"react/jsx-runtime";function Pt(){return Fo("svg",{width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Te("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Te("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"}),Te("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"}),Te("path",{d:"M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4"}),Te("path",{d:"M3 3l18 18"})]})}import{Fragment as Go,jsx as Me,jsxs as Xo}from"react/jsx-runtime";function vt({icon:e,text:t,pt:a,pb:o,active:n,children:l}){return Me(_o,{pt:a,pb:o,className:"mantine-datatable-empty-state","data-active":n||void 0,children:l||Xo(Go,{children:[e||Me("div",{className:"mantine-datatable-empty-state-icon",children:Me(Pt,{})}),Me(Bo,{size:"sm",c:"dimmed",children:t})]})})}import{TableTfoot as pn,TableTr as fn,rem as bn}from"@mantine/core";import Tn from"clsx";import{forwardRef as gn}from"react";import{TableTh as sn}from"@mantine/core";import dn from"clsx";import{useLocalStorage as Je}from"@mantine/hooks";import{useMemo as Qo}from"react";var Ze=({key:e,columns:t=[]})=>{let a=t&&t.map(p=>p.accessor)||[],o=t&&t.map(p=>({[p.accessor]:p.width??"initial"}))||[],n=t&&t.map(p=>({accessor:p.accessor,title:p.title,defaultToggle:p.defaultToggle||!0,toggleable:p.toggleable,toggled:p.defaultToggle===void 0?!0:p.defaultToggle})),[l,i]=Je({key:`${e}-columns-order`,defaultValue:a,getInitialValueInEffect:!0}),[r,d]=Je({key:`${e}-columns-toggle`,defaultValue:n,getInitialValueInEffect:!0}),[s,c]=Je({key:`${e}-columns-width`,defaultValue:o,getInitialValueInEffect:!0}),u=()=>i(a),m=()=>{d(n)},f=()=>c(o);return{effectiveColumns:Qo(()=>l?l.map(b=>t.find(h=>h.accessor===b)).map(b=>({...b,hidden:!r.find(h=>h.accessor===b?.accessor)?.toggled})).map(b=>({...b,width:s.find(h=>h[b?.accessor])?.[b?.accessor]})):t,[t,l,r,s]),setColumnsOrder:i,columnsOrder:l,resetColumnsOrder:u,columnsToggle:r,setColumnsToggle:d,resetColumnsToggle:m,columnsWidth:s,setColumnsWidth:c,setColumnWidth:(p,y)=>{let b=s.map(h=>h[p]?{[p]:y}:h);c(b)},resetColumnsWidth:f}},tl=Ze;import{useResizeObserver as Uo}from"@mantine/hooks";function oe(){let[e]=Uo(),{width:t,height:a}=e.current?.getBoundingClientRect()||{width:0,height:0};return{ref:e,width:t,height:a}}import{useEffect as $o,useLayoutEffect as Ko}from"react";var xt=typeof window<"u"?Ko:$o;import{useEffect as Jo,useState as Zo}from"react";function Mt(e){let[t,a]=Zo(null),o=e?.join(":")||"";return Jo(()=>{a(null)},[o]),{lastSelectionChangeIndex:t,setLastSelectionChangeIndex:a}}import{useEffect as Yo,useRef as qo,useState as jo}from"react";function en(e,t){let a=()=>{t(e.map(n=>n.matches))},o=e.map(n=>{try{return n.addEventListener("change",a),()=>n.removeEventListener("change",a)}catch{return n.addListener(a),()=>n.removeListener(a)}});return()=>{o.forEach(n=>n())}}function tn(e,t){return t||(typeof window<"u"&&"matchMedia"in window?e.map(a=>window.matchMedia(a).matches):e.map(()=>!1))}function Rt(e,t,{getInitialValueInEffect:a}={getInitialValueInEffect:!0}){let[o,n]=jo(a?t:tn(e,t)),l=qo();return Yo(()=>{if("matchMedia"in window)return l.current=e.map(i=>window.matchMedia(i)),n(l.current.map(i=>i.matches)),en(l.current,i=>{n(i)})},[e]),o}import{useMantineTheme as an}from"@mantine/core";import{useMemo as kt}from"react";function Et(e){let t=an(),a=kt(()=>e.map(n=>(typeof n=="function"?n(t):n)??""),[e,t]),o=kt(()=>e.map(()=>!0),[e]);return Rt(a,o)}import{useMantineTheme as on}from"@mantine/core";import{useMediaQuery as nn}from"@mantine/hooks";function X(e){let t=on(),a=typeof e=="function"?e(t):e;return nn(a||"",!0)}import{useState as rn}from"react";function ge(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 Nt(e,t,a){return e.filter(o=>!t.map(a).includes(a(o)))}function Re(e,t){return e.filter((a,o,n)=>o===n.findIndex(l=>t(a)===t(l)))}function Ye(e,t){return t?t.match(/([^[.\]])+/g).reduce((o,n)=>o&&o[n],e):void 0}function M(e,t){return typeof t=="string"?Ye(e,t):t(e)}function Lt({rowExpansion:e,records:t,idAccessor:a}){let o=[];if(e&&t){let{trigger:r,allowMultiple:d,initiallyExpanded:s}=e;t&&r==="always"?o=t.map(c=>M(c,a)):s&&(o=t.filter((c,u)=>s({record:c,index:u})).map(c=>M(c,a)),d||(o=[o[0]]))}let n,l,i=rn(o);if(e){let{trigger:r,allowMultiple:d,collapseProps:s,content:c}=e;e.expanded?{recordIds:n,onRecordIdsChange:l}=e.expanded:[n,l]=i;let u=m=>l?.(n.filter(f=>f!==M(m,a)));return{expandOnClick:r!=="always"&&r!=="never",isRowExpanded:m=>r==="always"?!0:n.includes(M(m,a)),expandRow:m=>{let f=M(m,a);l?.(d?[...n,f]:[f])},collapseRow:u,collapseProps:s,content:({record:m,index:f})=>()=>c({record:m,index:f,collapse:()=>u(m)})}}}import{useTimeout as It}from"@mantine/hooks";import{useEffect as ln,useState as Ht}from"react";function Ot(e,t){let[a,o]=Ht(e),[n,l]=Ht(e),i=It(()=>o(!0),0),r=It(()=>l(!1),t||200);return ln(()=>{e?(r.clear(),l(!0),i.start()):(i.clear(),o(!1),r.start())},[i,r,e]),{expanded:a,visible:n}}var se="mantine-datatable-nowrap",de="mantine-datatable-ellipsis",B="mantine-datatable-pointer-cursor",ke="mantine-datatable-context-menu-cursor",Wt="mantine-datatable-text-selection-disabled",Q="mantine-datatable-text-align-left",U="mantine-datatable-text-align-center",$="mantine-datatable-text-align-right";import{jsx as cn}from"react/jsx-runtime";function At({className:e,style:t,visibleMediaQuery:a,title:o,noWrap:n,ellipsis:l,textAlign:i,width:r}){return X(a)?cn(sn,{className:dn({[se]:n||l,[de]:l,[Q]:i==="left",[U]:i==="center",[$]:i==="right"},e),style:[{width:r,minWidth:r,maxWidth:r},t],children:o}):null}import{TableTh as un}from"@mantine/core";import{jsx as mn}from"react/jsx-runtime";function Vt({shadowVisible:e}){return mn(un,{className:"mantine-datatable-footer-selector-placeholder-cell","data-shadow-visible":e||void 0})}import{jsx as qe,jsxs as hn}from"react/jsx-runtime";var zt=gn(function({className:t,style:a,columns:o,defaultColumnProps:n,selectionVisible:l,selectorCellShadowVisible:i,scrollDiff:r},d){let s=r<0;return qe(pn,{ref:d,className:Tn("mantine-datatable-footer",t),style:[{position:s?"relative":"sticky",bottom:bn(s?r:0)},a],children:hn(fn,{children:[l&&qe(Vt,{shadowVisible:i}),o.map(({hidden:c,...u})=>{if(c)return null;let{accessor:m,visibleMediaQuery:f,textAlign:D,width:g,footer:p,footerClassName:y,footerStyle:b,noWrap:h,ellipsis:x}={...n,...u};return qe(At,{className:y,style:b,visibleMediaQuery:f,textAlign:D,width:g,title:p,noWrap:h,ellipsis:x},m)})]})})});import{TableThead as qn,TableTr as na}from"@mantine/core";import jn from"clsx";import{forwardRef as er}from"react";import{TableTh as Cn}from"@mantine/core";import yn from"clsx";import{useMemo as Ft}from"react";import{jsx as Dn}from"react/jsx-runtime";function _t({group:{id:e,columns:t,title:a,textAlign:o,className:n,style:l}}){let i=Ft(()=>t.map(({visibleMediaQuery:s})=>s),[t]),r=Et(i),d=Ft(()=>t.filter(({hidden:s},c)=>!s&&r?.[c]).length,[t,r]);return d>0?Dn(Cn,{colSpan:d,className:yn("mantine-datatable-column-group-header-cell",{[Q]:o==="left",[U]:o==="center",[$]:o==="right"},n),style:l,children:a??ge(e)}):null}import{ActionIcon as qt,Box as Vn,Center as Ie,Checkbox as zn,Flex as Fn,Group as jt,Popover as _n,PopoverDropdown as Bn,PopoverTarget as Gn,Stack as Xn,TableTh as Qn}from"@mantine/core";import He from"clsx";import{useRef as Un,useState as ea}from"react";import{ActionIcon as Pn,Popover as vn,PopoverDropdown as xn,PopoverTarget as Mn}from"@mantine/core";import{useDisclosure as Rn}from"@mantine/hooks";import{jsx as Bt,jsxs as wn}from"react/jsx-runtime";function Gt(){return wn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Bt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Bt("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"})]})}import{jsx as Xt,jsxs as Sn}from"react/jsx-runtime";function Qt(){return Sn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Xt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Xt("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"})]})}import{jsx as Ee,jsxs as kn}from"react/jsx-runtime";function Ut({children:e,isActive:t}){let[a,{close:o,toggle:n}]=Rn(!1);return kn(vn,{withArrow:!0,withinPortal:!0,shadow:"md",opened:a,onClose:o,trapFocus:!0,children:[Ee(Mn,{children:Ee(Pn,{className:"mantine-datatable-header-cell-filter-action-icon","data-active":t||void 0,size:"sm",variant:"default",onClick:i=>{i.preventDefault(),n()},children:Ee(t?Qt:Gt,{})})}),Ee(xn,{onClick:i=>i.stopPropagation(),children:typeof e=="function"?e({close:o}):e})]})}import{rem as En}from"@mantine/core";import{useRef as Nn,useState as Ln}from"react";import{jsx as In}from"react/jsx-runtime";var $t=e=>{let{accessor:t,columnRef:a}=e,o=Nn(null),[n,l]=Ln(0),{setColumnWidth:i}=xe(),r=u=>{u.preventDefault(),u.stopPropagation(),document.addEventListener("mousemove",d),document.addEventListener("mouseup",s),document.body.style.cursor="col-resize"},d=u=>{if(!a.current)return;let m=u.clientX-a.current.getBoundingClientRect().right,D=`${a.current.getBoundingClientRect().width+m}px`;a.current.style.width=D,i(t,a.current.style.width),l(-m)},s=()=>{a.current&&(document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",s),document.body.style.cursor="initial",i(t,a.current.style.width),l(0))};return In("div",{ref:o,onClick:u=>u.stopPropagation(),onMouseDown:r,onDoubleClick:()=>{a.current&&(a.current.style.maxWidth="initial",a.current.style.minWidth="initial",a.current.style.width="initial",i(t,"initial"))},className:"mantine-datatable-header-resizable-handle",style:{right:En(n)}})};import{jsx as Ne,jsxs as Hn}from"react/jsx-runtime";function Kt(){return Hn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Ne("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Ne("path",{d:"M12 5l0 14"}),Ne("path",{d:"M16 9l-4 -4"}),Ne("path",{d:"M8 9l4 -4"})]})}import{jsx as Le,jsxs as On}from"react/jsx-runtime";function Jt(){return On("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Le("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Le("path",{d:"M8 7l4 -4l4 4"}),Le("path",{d:"M8 17l4 4l4 -4"}),Le("path",{d:"M12 3l0 18"})]})}import{jsx as ne,jsxs as Wn}from"react/jsx-runtime";function Zt(){return Wn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[ne("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ne("path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}import{jsx as je,jsxs as An}from"react/jsx-runtime";function Yt(){return An("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[je("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),je("path",{d:"M18 6l-12 12"}),je("path",{d:"M6 6l12 12"})]})}import{Fragment as $n,jsx as v,jsxs as Oe}from"react/jsx-runtime";function ta({className:e,style:t,accessor:a,visibleMediaQuery:o,title:n,sortable:l,draggable:i,toggleable:r,resizable:d,sortIcons:s,textAlign:c,width:u,sortStatus:m,onSortStatusChange:f,filter:D,filtering:g}){let{setSourceColumn:p,setTargetColumn:y,swapColumns:b,columnsToggle:h,setColumnsToggle:x}=xe(),[R,P]=ea(!1),L=Un(null),[F,k]=ea(!1);if(!X(o))return null;let w=n??ge(a),N=typeof w=="string"?w:void 0,E=l&&f?C=>{C?.defaultPrevented||f({columnAccessor:a,direction:m?.columnAccessor===a?m.direction==="asc"?"desc":"asc":m?.direction??"asc"})}:void 0,H=C=>{C.stopPropagation(),p(a),P(!1)},_=C=>{C.preventDefault(),y(a),P(!0)},K=()=>{y(a),P(!1),b()},J=()=>{P(!0)},Z=()=>{P(!1)},Y=C=>{C.stopPropagation(),x(O=>O.map(W=>W.accessor===a?{...W,toggled:!1}:W))};return Oe(Qn,{className:He({"mantine-datatable-header-cell-sortable":l,"mantine-datatable-header-cell-toggleable":r,"mantine-datatable-header-cell-resizable":d},e),style:[{width:u,...d?{minWidth:"1px"}:{minWidth:u,maxWidth:u}},t],role:l?"button":void 0,tabIndex:l?0:void 0,onClick:E,onContextMenu:C=>{r&&(C.preventDefault(),k(!0))},onKeyDown:C=>C.key==="Enter"&&E?.(),ref:L,children:[Oe(jt,{className:"mantine-datatable-header-cell-sortable-group",justify:"space-between",wrap:"nowrap",children:[Oe(_n,{width:200,position:"bottom",withArrow:!0,shadow:"md",opened:F,onChange:k,children:[v(Gn,{children:Oe(Fn,{align:"center",w:"100%",className:He({"mantine-datatable-header-cell-draggable":i,"mantine-datatable-header-cell-drag-over":R}),draggable:i,onDragStart:i?H:void 0,onDragEnter:i?J:void 0,onDragOver:i?_:void 0,onDrop:i?K:void 0,onDragLeave:i?Z:void 0,children:[i?v(Ie,{role:"img","aria-label":"Drag column",children:v(qt,{className:"mantine-datatable-header-cell-draggable-action-icon",variant:"subtle",size:"xs",onClick:C=>{C.stopPropagation()},children:v(Zt,{})})}):null,v(Vn,{className:He("mantine-datatable-header-cell-sortable-text",{[Q]:c==="left",[U]:c==="center",[$]:c==="right"},se,de),title:N,children:w})]})}),v(Bn,{children:v(Xn,{children:h.filter(C=>C.toggleable).map(C=>v(jt,{children:v(zn,{size:"xs",label:C.title??ge(C.accessor),checked:C.toggled,onChange:O=>{x(h.map(W=>W.accessor===C.accessor?{...W,toggled:O.currentTarget.checked}:W))}})},C.accessor))})})]}),r?v(Ie,{className:"mantine-datatable-header-cell-toggleable-icon",role:"img","aria-label":"Toggle column",children:v(qt,{size:"xs",variant:"light",onClick:Y,children:v(Yt,{})})}):null,l||m?.columnAccessor===a?v($n,{children:m?.columnAccessor===a?v(Ie,{className:He("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:s?.sorted||v(Kt,{})}):v(Ie,{className:"mantine-datatable-header-cell-sortable-unsorted-icon",role:"img","aria-label":"Not sorted",children:s?.unsorted||v(Jt,{})})}):null,D?v(Ut,{isActive:!!g,children:D}):null]}),d?v($t,{accessor:a,columnRef:L}):null]})}import{Checkbox as Kn,TableTh as Jn}from"@mantine/core";import Zn from"clsx";import{forwardRef as Yn}from"react";import{jsx as aa}from"react/jsx-runtime";var oa=Yn(function({className:t,style:a,trigger:o,shadowVisible:n,checked:l,indeterminate:i,checkboxProps:r,onChange:d,rowSpan:s},c){let u=!r.disabled;return aa(Jn,{ref:c,className:Zn("mantine-datatable-header-selector-cell",{[B]:o==="cell"&&u},t),style:a,rowSpan:s,"data-shadow-visible":n||void 0,onClick:o==="cell"&&u?d:void 0,children:aa(Kn,{classNames:u?{input:B}:void 0,checked:l,indeterminate:i,onChange:d,...r,disabled:!(d||r.onChange)||r.disabled})})});import{jsx as et,jsxs as tt}from"react/jsx-runtime";var ra=er(function({selectionColumnHeaderRef:t,className:a,style:o,sortStatus:n,sortIcons:l,onSortStatusChange:i,columns:r,defaultColumnProps:d,groups:s,selectionTrigger:c,selectionVisible:u,selectionChecked:m,selectionIndeterminate:f,onSelectionChange:D,selectionCheckboxProps:g,selectorCellShadowVisible:p,selectionColumnClassName:y,selectionColumnStyle:b},h){let x=u?et(oa,{ref:t,className:y,style:b,trigger:c,shadowVisible:p,checked:m,indeterminate:f,checkboxProps:g,onChange:D,rowSpan:s?2:void 0}):null;return tt(qn,{className:jn("mantine-datatable-header",a),style:o,ref:h,children:[s&&tt(na,{children:[x,s.map(R=>et(_t,{group:R},R.id))]}),tt(na,{children:[!s&&x,r.map(({hidden:R,...P},L)=>{if(R)return null;let{accessor:F,visibleMediaQuery:k,textAlign:w,width:N,title:E,sortable:H,draggable:_,toggleable:K,resizable:J,titleClassName:Z,titleStyle:Y,filter:C,filtering:O}={...d,...P};return et(ta,{accessor:F,className:Z,style:Y,visibleMediaQuery:k,textAlign:w,width:N,title:E,sortable:H,draggable:_,toggleable:K,resizable:J&&L<r.length-1,sortStatus:n,sortIcons:l,onSortStatusChange:i,filter:C,filtering:O},F)})]})]})});import{Center as tr,Loader as ar}from"@mantine/core";import or from"clsx";import{jsx as la}from"react/jsx-runtime";function ia({pt:e,pb:t,fetching:a,customContent:o,backgroundBlur:n,size:l,type:i,color:r}){return la(tr,{pt:e,pb:t,className:or("mantine-datatable-loader",{"mantine-datatable-loader-fetching":a}),style:[{backdropFilter:n?`blur(${n}px)`:void 0}],children:a&&(o||la(ar,{size:l,type:i,color:r}))})}import{Box as pr,Pagination as fr,Text as br,rem as Tr}from"@mantine/core";import ba from"clsx";import{forwardRef as gr}from"react";import{Button as lr,Group as ir,Menu as sr,MenuDropdown as dr,MenuItem as cr,MenuTarget as ur,Text as ua,rem as he}from"@mantine/core";import mr from"clsx";import{parseThemeColor as nr}from"@mantine/core";function S(e,t,a){return e?nr({color:typeof e=="object"?e[a]:e,theme:t}).value:void 0}function sa({theme:e,c:t,backgroundColor:a,borderColor:o,rowBorderColor:n,stripedColor:l,highlightOnHoverColor:i}){return{"--mantine-datatable-color-light":S(t,e,"light"),"--mantine-datatable-color-dark":S(t,e,"dark"),"--mantine-datatable-background-color-light":S(a,e,"light"),"--mantine-datatable-background-color-dark":S(a,e,"dark"),"--mantine-datatable-border-color-light":S(o,e,"light"),"--mantine-datatable-border-color-dark":S(o,e,"dark"),"--mantine-datatable-row-border-color-light":S(n,e,"light"),"--mantine-datatable-row-border-color-dark":S(n,e,"dark"),"--mantine-datatable-striped-color-light":S(l,e,"light"),"--mantine-datatable-striped-color-dark":S(l,e,"dark"),"--mantine-datatable-highlight-on-hover-color-light":S(i,e,"light"),"--mantine-datatable-highlight-on-hover-color-dark":S(i,e,"dark")}}function We({theme:e,paginationActiveTextColor:t,paginationActiveBackgroundColor:a}){return{"--mantine-datatable-pagination-active-text-color-light":S(t,e,"light"),"--mantine-datatable-pagination-active-text-color-dark":S(t,e,"dark"),"--mantine-datatable-pagination-active-background-color-light":S(a,e,"light"),"--mantine-datatable-pagination-active-background-color-dark":S(a,e,"dark")}}function da({theme:e,color:t,backgroundColor:a}){return{"--mantine-datatable-row-color-light":S(t,e,"light"),"--mantine-datatable-row-color-dark":S(t,e,"dark"),"--mantine-datatable-row-background-color-light":S(a,e,"light"),"--mantine-datatable-row-background-color-dark":S(a,e,"dark")}}import{jsx as at,jsxs as rr}from"react/jsx-runtime";function ca(){return rr("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[at("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),at("path",{d:"M8 9l4 -4l4 4"}),at("path",{d:"M16 15l-4 4l-4 -4"})]})}import{jsx as re,jsxs as pa}from"react/jsx-runtime";var ma={xs:he(22),sm:he(26),md:he(32),lg:he(38),xl:he(44)};function fa({size:e,label:t,values:a,value:o,activeTextColor:n,activeBackgroundColor:l,onChange:i}){return pa(ir,{gap:"xs",children:[re(ua,{size:e,children:t}),pa(sr,{withinPortal:!0,withArrow:!0,children:[re(ur,{children:re(lr,{size:e,variant:"default",classNames:{section:"mantine-datatable-page-size-selector-button-icon"},rightSection:re(ca,{}),style:[{fontWeight:"normal"},r=>({height:ma[e],paddingLeft:r.spacing[e],paddingRight:r.spacing[e]})],children:o})}),re(dr,{children:a.map(r=>{let d=r===o;return re(cr,{className:mr({"mantine-datatable-page-size-selector-active":d}),style:[{height:ma[e]},d&&(n||l)?s=>We({theme:s,paginationActiveTextColor:n,paginationActiveBackgroundColor:l}):void 0],disabled:d,onClick:()=>i(r),children:re(ua,{size:e,children:r})},r)})})]})]})}import{jsx as ot,jsxs as hr}from"react/jsx-runtime";var Ta=gr(function({className:t,style:a,fetching:o,page:n,onPageChange:l,paginationWithEdges:i,paginationActiveTextColor:r,paginationActiveBackgroundColor:d,paginationSize:s,loadingText:c,noRecordsText:u,paginationText:m,totalRecords:f,recordsPerPage:D,onRecordsPerPageChange:g,recordsPerPageLabel:p,recordsPerPageOptions:y,recordsLength:b,horizontalSpacing:h,paginationWrapBreakpoint:x,getPaginationControlProps:R},P){let L;if(o)L=c;else if(!f)L=u;else{let k=(n-1)*D+1,w=k+b-1;L=m({from:k,to:w,totalRecords:f})}let F=X(({breakpoints:k})=>`(min-width: ${typeof x=="number"?`${Tr(x)}rem`:k[x]||x})`);return hr(pr,{ref:P,px:h??"xs",py:"xs",className:ba("mantine-datatable-pagination",t),style:[{flexDirection:F?"row":"column"},a],children:[ot(br,{className:"mantine-datatable-pagination-text",size:s,children:L}),y&&ot(fa,{activeTextColor:r,activeBackgroundColor:d,size:s,label:p,values:y,value:D,onChange:g}),ot(fr,{classNames:{root:ba("mantine-datatable-pagination-pages",{"mantine-datatable-pagination-pages-fetching":o||!b}),control:"mantine-datatable-pagination-pages-control"},style:r||d?k=>We({theme:k,paginationActiveTextColor:r,paginationActiveBackgroundColor:d}):void 0,withEdges:i,value:n,onChange:l,size:s,total:Math.ceil(f/D),getControlProps:R})]})});import{TableTr as kr}from"@mantine/core";import Er from"clsx";import{TableTd as Cr}from"@mantine/core";import yr from"clsx";import{jsx as Dr}from"react/jsx-runtime";function ga({className:e,style:t,visibleMediaQuery:a,record:o,index:n,onClick:l,onDoubleClick:i,onContextMenu:r,noWrap:d,ellipsis:s,textAlign:c,width:u,accessor:m,render:f,defaultRender:D,customCellAttributes:g}){return X(a)?Dr(Cr,{className:yr({[se]:d||s,[de]:s,[B]:l||i,[ke]:r,[Q]:c==="left",[U]:c==="center",[$]:c==="right"},e),style:[{width:u,minWidth:u,maxWidth:u},t],onClick:l,onDoubleClick:i,onContextMenu:r,...g?.(o,n),children:f?f(o,n):D?D(o,n,m):Ye(o,m)}):null}import{Collapse as wr,TableTd as Sr,TableTr as ha}from"@mantine/core";import{Fragment as Pr,jsx as Ce,jsxs as vr}from"react/jsx-runtime";function Ca({open:e,colSpan:t,content:a,collapseProps:o}){let{expanded:n,visible:l}=Ot(e,o?.transitionDuration);return l?vr(Pr,{children:[Ce(ha,{}),Ce(ha,{children:Ce(Sr,{className:"mantine-datatable-row-expansion-cell",colSpan:t,children:Ce(wr,{in:n,...o,children:Ce("div",{className:"mantine-datatable-row-expansion-cell-content",children:a()})})})})]}):null}import{Checkbox as xr,TableTd as Mr}from"@mantine/core";import Rr from"clsx";import{jsx as ya}from"react/jsx-runtime";function Da({className:e,style:t,record:a,index:o,trigger:n,onChange:l,withRightShadow:i,getCheckboxProps:r,...d}){let s=r(a,o),c=!d.disabled&&!s.disabled,u=m=>{m.stopPropagation(),n==="cell"&&c&&l?.(m)};return ya(Mr,{className:Rr("mantine-datatable-row-selector-cell",{[B]:n==="cell"&&c},e),style:t,"data-shadow-visible":i||void 0,onClick:u,children:ya(xr,{classNames:c?{input:B}:void 0,onChange:l,...d,...s})})}import{Fragment as Nr,jsx as nt,jsxs as wa}from"react/jsx-runtime";function Sa({record:e,index:t,columns:a,defaultColumnProps:o,defaultColumnRender:n,selectionTrigger:l,selectionVisible:i,selectionChecked:r,onSelectionChange:d,isRecordSelectable:s,getSelectionCheckboxProps:c,onClick:u,onDoubleClick:m,onContextMenu:f,onCellClick:D,onCellDoubleClick:g,onCellContextMenu:p,expansion:y,customAttributes:b,color:h,backgroundColor:x,className:R,style:P,selectorCellShadowVisible:L,selectionColumnClassName:F,selectionColumnStyle:k}){return wa(Nr,{children:[wa(kr,{className:Er("mantine-datatable-row",{[B]:u||m||y?.expandOnClick},{[ke]:f},typeof R=="function"?R(e,t):R),"data-selected":r||void 0,onClick:w=>{if(y){let{isRowExpanded:N,expandOnClick:E,expandRow:H,collapseRow:_}=y;E&&(N(e)?_(e):H(e))}u?.({event:w,record:e,index:t})},onDoubleClick:m?w=>m({event:w,record:e,index:t}):void 0,onContextMenu:f?w=>f({event:w,record:e,index:t}):void 0,style:[h||x?w=>{let N=h?.(e,t),E=x?.(e,t);return da({theme:w,color:N,backgroundColor:E})}:void 0,P?.(e,t)],...b?.(e,t),children:[i&&nt(Da,{className:F,style:k,record:e,index:t,trigger:l,withRightShadow:L,checked:r,disabled:!d||(s?!s(e,t):!1),onChange:d,getCheckboxProps:c}),a.map(({hidden:w,...N},E)=>{if(w)return null;let{accessor:H,visibleMediaQuery:_,textAlign:K,noWrap:J,ellipsis:Z,width:Y,render:C,cellsClassName:O,cellsStyle:W,customCellAttributes:_e}={...o,...N};return nt(ga,{className:typeof O=="function"?O(e,t):O,style:W?.(e,t),visibleMediaQuery:_,record:e,index:t,onClick:D?q=>D({event:q,record:e,index:t,column:N,columnIndex:E}):void 0,onDoubleClick:g?q=>g({event:q,record:e,index:t,column:N,columnIndex:E}):void 0,onContextMenu:p?q=>p({event:q,record:e,index:t,column:N,columnIndex:E}):void 0,accessor:H,textAlign:K,noWrap:J,ellipsis:Z,width:Y,render:C,defaultRender:n,customCellAttributes:_e},H)})]}),y&&nt(Ca,{colSpan:a.filter(({hidden:w})=>!w).length+(i?1:0),open:y.isRowExpanded(e),content:y.content({record:e,index:t}),collapseProps:y.collapseProps})]})}import{Box as Pa,ScrollArea as Lr,rem as va}from"@mantine/core";import Ae from"clsx";import{jsx as Ve,jsxs as Ir}from"react/jsx-runtime";function xa({topShadowVisible:e,leftShadowVisible:t,leftShadowBehind:a,rightShadowVisible:o,rightShadowBehind:n,bottomShadowVisible:l,headerHeight:i,footerHeight:r,onScrollPositionChange:d,children:s,viewportRef:c,scrollAreaProps:u}){return Ir(Lr,{...u,viewportRef:c,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:d,children:[s,Ve(Pa,{className:Ae("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-top-shadow",{"mantine-datatable-scroll-area-shadow-visible":e}),style:{top:i?va(i):0}}),Ve("div",{className:Ae("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-left-shadow",{"mantine-datatable-scroll-area-shadow-visible":t,"mantine-datatable-scroll-area-shadow-behind":a})}),Ve("div",{className:Ae("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-right-shadow",{"mantine-datatable-scroll-area-shadow-visible":o,"mantine-datatable-scroll-area-shadow-behind":n})}),Ve(Pa,{className:Ae("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-bottom-shadow",{"mantine-datatable-scroll-area-shadow-visible":l}),style:{bottom:r?va(r+1):0}})]})}import{jsx as z,jsxs as ka}from"react/jsx-runtime";function Ar({withTableBorder:e,borderRadius:t,textSelectionDisabled:a,height:o="100%",minHeight:n,shadow:l,verticalAlign:i="center",fetching:r,columns:d,storeColumnsKey:s,groups:c,pinFirstColumn:u,pinLastColumn:m,defaultColumnProps:f,defaultColumnRender:D,idAccessor:g="id",records:p,selectionTrigger:y="checkbox",selectedRecords:b,onSelectedRecordsChange:h,selectionColumnClassName:x,selectionColumnStyle:R,isRecordSelectable:P,allRecordsSelectionCheckboxProps:L={"aria-label":"Select all records"},getRecordSelectionCheckboxProps:F=(I,j)=>({"aria-label":`Select record ${j+1}`}),sortStatus:k,sortIcons:w,onSortStatusChange:N,horizontalSpacing:E,page:H,onPageChange:_,totalRecords:K,recordsPerPage:J,onRecordsPerPageChange:Z,recordsPerPageOptions:Y,recordsPerPageLabel:C="Records per page",paginationWithEdges:O,paginationActiveTextColor:W,paginationActiveBackgroundColor:_e,paginationSize:q="sm",paginationText:Ea=({from:I,to:j,totalRecords:ee})=>`${I} - ${j} / ${ee}`,paginationWrapBreakpoint:Na="sm",getPaginationControlProps:La=I=>I==="previous"?{"aria-label":"Previous page"}:I==="next"?{"aria-label":"Next page"}:{},loaderBackgroundBlur:Ia,customLoader:Ha,loaderSize:Oa,loaderType:Wa,loaderColor:Aa,loadingText:Va="...",emptyState:za,noRecordsText:rt="No records",noRecordsIcon:Fa,highlightOnHover:_a,striped:Ba,noHeader:Ga,onRowClick:Xa,onRowDoubleClick:Qa,onRowContextMenu:Ua,onCellClick:$a,onCellDoubleClick:Ka,onCellContextMenu:Ja,onScroll:lt,onScrollToTop:it,onScrollToBottom:st,onScrollToLeft:dt,onScrollToRight:ct,c:Za,backgroundColor:Ya,borderColor:qa,rowBorderColor:ja,stripedColor:eo,highlightOnHoverColor:to,rowColor:ao,rowBackgroundColor:oo,rowExpansion:no,rowClassName:ro,rowStyle:lo,customRowAttributes:io,scrollViewportRef:so,scrollAreaProps:co,tableRef:uo,bodyRef:mo,m:po,my:fo,mx:bo,mt:To,mb:go,ml:ho,mr:Co,className:yo,classNames:ce,style:Do,styles:ue,...wo}){let{ref:I,width:j,height:ee}=oe(),me=Wr(()=>c?.flatMap(T=>T.columns)??d,[d,c]),ut=Ze({key:s,columns:me}),{ref:So,height:Be}=oe(),{ref:Po,width:Ge,height:pe}=oe(),{ref:vo,height:xo}=oe(),{ref:Mo,height:mt}=oe(),{ref:Ro,width:ko}=oe(),Eo=Ma(Po,uo),[Xe,pt]=Fe(!0),[Qe,ft]=Fe(!0),[fe,bt]=Fe(!0),[ye,Tt]=Fe(!0),No=Lt({rowExpansion:no,records:p,idAccessor:g}),De=ze(()=>{let T=I.current?.scrollTop||0,G=I.current?.scrollLeft||0;if(r||pe<=ee)pt(!0),ft(!0);else{let A=T===0,V=pe-T-ee<1;pt(A),ft(V),A&&A!==Xe&&it?.(),V&&V!==Qe&&st?.()}if(r||Ge===j)bt(!0),Tt(!0);else{let A=G===0,V=Ge-G-j<1;bt(A),Tt(V),A&&A!==fe&&dt?.(),V&&V!==ye&&ct?.()}},[r,st,dt,ct,it,ee,I,j,Qe,fe,ye,Xe,pe,Ge]);xt(De,[De]);let Lo=ze(T=>{lt?.(T),De()},[De,lt]),Io=ze(T=>{I.current?.scrollTo({top:0,left:0}),_(T)},[_,I]),we=p?.length,gt=p?.map(T=>M(T,g)),le=!!b,be=b?.map(T=>M(T,g)),ht=gt!==void 0&&be!==void 0&&be.length>0,Ue=P?p?.filter(P):p,Se=Ue?.map(T=>M(T,g)),Pe=ht&&Se.every(T=>be.includes(T)),Ho=ht&&Se.some(T=>be.includes(T)),Oo=ze(()=>{b&&h&&h(Pe?b.filter(T=>!Se.includes(M(T,g))):Re([...b,...Ue],T=>M(T,g)))},[Pe,g,h,Se,Ue,b]),{lastSelectionChangeIndex:ve,setLastSelectionChangeIndex:Wo}=Mt(gt),$e=le&&!fe&&!u;return z(Ke,{...ut,children:ka(Hr,{...{m:po,my:fo,mx:bo,mt:To,mb:go,ml:ho,mr:Co},className:Ra("mantine-datatable",{"mantine-datatable-with-border":e},yo,ce?.root),style:[T=>({...sa({theme:T,c:Za,backgroundColor:Ya,borderColor:qa,rowBorderColor:ja,stripedColor:eo,highlightOnHoverColor:to}),borderRadius:T.radius[t]||t,boxShadow:T.shadows[l]||l,height:o,minHeight:n}),Do,ue?.root],children:[z(xa,{viewportRef:Ma(I,so),topShadowVisible:!Xe,leftShadowVisible:!fe,leftShadowBehind:le||!!u,rightShadowVisible:!ye,rightShadowBehind:m,bottomShadowVisible:!Qe,headerHeight:Be,footerHeight:xo,onScrollPositionChange:Lo,scrollAreaProps:co,children:ka(Or,{ref:Eo,horizontalSpacing:E,className:Ra("mantine-datatable-table",{[Wt]:a,"mantine-datatable-vertical-align-top":i==="top","mantine-datatable-vertical-align-bottom":i==="bottom","mantine-datatable-last-row-border-bottom-visible":pe<ee,"mantine-datatable-pin-last-column":m,"mantine-datatable-pin-last-column-scrolled":!ye&&m,"mantine-datatable-selection-column-visible":le,"mantine-datatable-pin-first-column":u,"mantine-datatable-pin-first-column-scrolled":!fe&&u},ce?.table),style:{...ue?.table,"--mantine-datatable-selection-column-width":`${ko}px`},"data-striped":we&&Ba||void 0,"data-highlight-on-hover":_a||void 0,...wo,children:[Ga?null:z(Ke,{...ut,children:z(ra,{ref:So,selectionColumnHeaderRef:Ro,className:ce?.header,style:ue?.header,columns:me,defaultColumnProps:f,groups:c,sortStatus:k,sortIcons:w,onSortStatusChange:N,selectionTrigger:y,selectionVisible:le,selectionChecked:Pe,selectionIndeterminate:Ho&&!Pe,onSelectionChange:Oo,selectionCheckboxProps:L,selectorCellShadowVisible:$e,selectionColumnClassName:x,selectionColumnStyle:R})}),z("tbody",{ref:mo,children:we?p.map((T,G)=>{let A=M(T,g),V=be?.includes(A)||!1,Ct;return h&&b&&(Ct=Ao=>{if(Ao.nativeEvent.shiftKey&&ve!==null){let ie=p.filter(G>ve?(te,ae)=>ae>=ve&&ae<=G&&(P?P(te,ae):!0):(te,ae)=>ae>=G&&ae<=ve&&(P?P(te,ae):!0));h(V?Nt(b,ie,te=>M(te,g)):Re([...b,...ie],te=>M(te,g)))}else h(V?b.filter(ie=>M(ie,g)!==A):Re([...b,T],ie=>M(ie,g)));Wo(G)}),z(Sa,{record:T,index:G,columns:me,defaultColumnProps:f,defaultColumnRender:D,selectionTrigger:y,selectionVisible:le,selectionChecked:V,onSelectionChange:Ct,isRecordSelectable:P,getSelectionCheckboxProps:F,onClick:Xa,onDoubleClick:Qa,onCellClick:$a,onCellDoubleClick:Ka,onContextMenu:Ua,onCellContextMenu:Ja,expansion:No,color:ao,backgroundColor:oo,className:ro,style:lo,customAttributes:io,selectorCellShadowVisible:$e,selectionColumnClassName:x,selectionColumnStyle:R},A)}):z(St,{})}),me.some(({footer:T})=>T)&&z(zt,{ref:vo,className:ce?.footer,style:ue?.footer,columns:me,defaultColumnProps:f,selectionVisible:le,selectorCellShadowVisible:$e,scrollDiff:pe-ee})]})}),H&&z(Ta,{ref:Mo,className:ce?.pagination,style:ue?.pagination,horizontalSpacing:E,fetching:r,page:H,onPageChange:Io,totalRecords:K,recordsPerPage:J,onRecordsPerPageChange:Z,recordsPerPageOptions:Y,recordsPerPageLabel:C,paginationWithEdges:O,paginationActiveTextColor:W,paginationActiveBackgroundColor:_e,paginationSize:q,paginationText:Ea,paginationWrapBreakpoint:Na,getPaginationControlProps:La,noRecordsText:rt,loadingText:Va,recordsLength:we}),z(ia,{pt:Be,pb:mt,fetching:r,backgroundBlur:Ia,customContent:Ha,size:Oa,type:Wa,color:Aa}),z(vt,{pt:Be,pb:mt,icon:Fa,text:rt,active:!r&&!we,children:za})]})})}export{Ar as DataTable,Nt as differenceBy,M as getRecordId,Ye as getValueAtPath,ge as humanize,Re as uniqBy,Ze as useDataTableColumns,tl as useDragToggleColumns};
2
2
  //# sourceMappingURL=index.mjs.map