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