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