mantine-datatable 7.4.5 → 7.4.6

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