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