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