mantine-datatable 7.1.2 → 7.1.4

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