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