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