@wisdomgarden/mantine-datatable 8.3.1-3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +210 -0
- package/dist/index.d.ts +1069 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +49 -0
- package/dist/styles.layer.css +49 -0
- package/package.json +112 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{Box as el,Table as tl}from"@mantine/core";import{useMergedRef as Qo}from"@mantine/hooks";import Ko from"clsx";import{useCallback as Dt,useEffect as ol,useLayoutEffect as nl,useMemo as al,useRef as xt,useState as rl}from"react";import{useState as kt}from"react";import{createSafeContext as ta}from"@mantine/core";var[Mt,ue]=ta("useDataTableColumnsContext must be used within DataTableColumnProvider");import{jsx as oa}from"react/jsx-runtime";var it=e=>{let{children:t,columnsOrder:o,setColumnsOrder:n,columnsToggle:a,setColumnsToggle:r,resetColumnsOrder:l,resetColumnsToggle:c,setColumnWidth:m,setMultipleColumnWidths:u,resetColumnsWidth:f}=e,[p,d]=kt(""),[s,i]=kt("");return oa(Mt,{value:{sourceColumn:p,setSourceColumn:d,targetColumn:s,setTargetColumn:i,columnsToggle:a,setColumnsToggle:r,swapColumns:()=>{if(!o||!n||!p||!s)return;let h=o.indexOf(p),y=o.indexOf(s);if(h!==-1&&y!==-1){let v=o.splice(h,1)[0];o.splice(y,0,v),n([...o])}},resetColumnsOrder:l,resetColumnsToggle:c,setColumnWidth:m,setMultipleColumnWidths:u,resetColumnsWidth:f},children:t})};import{jsx as Et}from"react/jsx-runtime";function Nt(){return Et("tr",{className:"mantine-datatable-empty-row",children:Et("td",{})})}import{Center as aa,Text as ra}from"@mantine/core";import{jsx as Re,jsxs as na}from"react/jsx-runtime";function Lt(){return na("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 la,jsx as We,jsxs as ia}from"react/jsx-runtime";function Wt({icon:e,text:t,active:o,children:n}){return We(aa,{className:"mantine-datatable-empty-state","data-active":o||void 0,children:n||ia(la,{children:[e||We("div",{className:"mantine-datatable-empty-state-icon",children:We(Lt,{})}),We(ra,{component:"div",size:"sm",c:"dimmed",children:t})]})})}import{TableTfoot as Ia,TableTr as Ha}from"@mantine/core";import Oa from"clsx";import{TableTh as ka}from"@mantine/core";import Ea from"clsx";import{useCallback as Ml,useRef as kl,useState as El}from"react";import{useLocalStorage as sa}from"@mantine/hooks";function It({key:e,columns:t=[],getInitialValueInEffect:o=!0}){function n(p,d){let s=[];return p.forEach(i=>{d.find(g=>g.accessor===i)&&s.push(i)}),d.forEach(i=>{s.includes(i.accessor)||s.push(i.accessor)}),s}let a=t&&t.map(p=>p.accessor)||[],[r,l]=sa({key:e?`${e}-columns-order`:"",defaultValue:e?a:void 0,getInitialValueInEffect:o});function c(p){e&&l(p)}let m=()=>{c(a)};if(!e)return{columnsOrder:r,setColumnsOrder:c,resetColumnsOrder:m};let u=n(r,t),f=JSON.stringify(r);return JSON.stringify(u)!==f&&c(u),{columnsOrder:u,setColumnsOrder:c,resetColumnsOrder:m}}import{useLocalStorage as ca}from"@mantine/hooks";import{useCallback as re,useEffect as st,useMemo as Ie,useRef as Ht,useState as Ot}from"react";function _t({key:e,columns:t=[],getInitialValueInEffect:o=!0,headerRef:n,onFixedLayoutChange:a}){let r=Ht(!1),l=Ht({}),[c,m]=Ot(!0),u=Ie(()=>t.some(b=>b.resizable&&!b.hidden&&b.accessor!=="__selection__"),[t]),f=Ie(()=>t.filter(b=>b.resizable&&!b.hidden&&b.accessor!=="__selection__"),[t]),p=Ie(()=>f.some(b=>b.width===void 0||b.width===""||b.width==="initial"),[f]),d=re(()=>t.filter(b=>b.accessor!=="__selection__").map(b=>({[b.accessor]:b.width??"auto"})),[t]),[s,i]=ca({key:e?`${e}-columns-width`:"",defaultValue:e?d():void 0,getInitialValueInEffect:!1}),[g,h]=Ot(()=>d());st(()=>{m(!1)},[]);let y=re(()=>{if(!n?.current||c)return{};let b=n.current,x=Array.from(b.querySelectorAll("th[data-accessor]")),k={};return x.forEach(E=>{let L=E.getAttribute("data-accessor");if(!L||L==="__selection__")return;let C=f.find(w=>w.accessor===L);if(C&&(C.width===void 0||C.width===""||C.width==="initial")){let w=E.getBoundingClientRect();k[L]=Math.round(w.width)}}),k},[n,f,c]),v=re(b=>{let x=b.filter(E=>E.accessor!=="__selection__"),k=g.map(E=>{let L=Object.keys(E)[0],C=x.find(w=>w.accessor===L);return C?{[L]:C.width}:E});h(k),e&&i(k)},[g,e,i]),M=re(b=>{v(b)},[v]),R=re(()=>{if(!(!n?.current||!a||c))if(p)a(!1),requestAnimationFrame(()=>{requestAnimationFrame(()=>{let b=y();l.current={...l.current,...b};let x=t.filter(k=>k.accessor!=="__selection__").map(k=>{let E=k.accessor,L=s?.find(w=>Object.keys(w)[0]===E);if(L&&L[E]!=="auto")return{[E]:L[E]};let C=b[E];return C?{[E]:`${C}px`}:{[E]:k.width??"auto"}});h(x),setTimeout(()=>{a(!0),r.current=!0},10)})});else{let b=t.filter(x=>x.accessor!=="__selection__").map(x=>({[x.accessor]:x.width??"auto"}));h(b),a(!0),r.current=!0}},[n,a,c,p,y,t,s]),W=R;st(()=>{if(!u||!a||c){a?.(!1);return}r.current=!1;let b=setTimeout(()=>{R()},50);return()=>clearTimeout(b)},[u,a,c,R]),st(()=>{c||!e||!o||s&&s.length>0&&h(s)},[c,e,o,s]);let D=re(()=>{e&&i(d()),l.current={},r.current=!1,a&&(a(!1),setTimeout(()=>{R()},10))},[e,i,d,a,R]),T=re((b,x)=>{v([{accessor:b,width:x}])},[v]),P=Ie(()=>u?g.filter(b=>{let x=Object.keys(b)[0];return f.some(k=>k.accessor===x)}).every(b=>{let x=Object.values(b)[0];return x==="auto"||x==="initial"}):!1,[u,g,f]);return{columnsWidth:g,setColumnsWidth:v,setColumnWidth:T,setMultipleColumnWidths:M,resetColumnsWidth:D,hasResizableColumns:u,allResizableWidthsInitial:P,measureAndSetColumnWidths:W}}import{useMemo as da}from"react";import{useLocalStorage as ua}from"@mantine/hooks";function At({key:e,columns:t=[],getInitialValueInEffect:o=!0}){function n(p,d){let s=[];return p.forEach(i=>{d.find(g=>g.accessor===i.accessor)&&s.push(i)}),d.forEach(i=>{s.find(g=>g.accessor===i.accessor)||s.push({accessor:i.accessor,defaultToggle:i.defaultToggle||!0,toggleable:i.toggleable,toggled:i.defaultToggle===void 0?!0:i.defaultToggle})}),s}let a=t&&t.map(p=>({accessor:p.accessor,defaultToggle:p.defaultToggle||!0,toggleable:p.toggleable,toggled:p.defaultToggle===void 0?!0:p.defaultToggle})),[r,l]=ua({key:e?`${e}-columns-toggle`:"",defaultValue:e?a:void 0,getInitialValueInEffect:o});function c(p){e&&l(p)}let m=()=>{c(a)};if(!e)return{columnsToggle:r,setColumnsToggle:c,resetColumnsToggle:m};let u=n(r,t),f=JSON.stringify(r);return JSON.stringify(u)!==f&&c(u),{columnsToggle:u,setColumnsToggle:c,resetColumnsToggle:m}}var zt=({key:e,columns:t=[],getInitialValueInEffect:o=!0,headerRef:n,scrollViewportRef:a,onFixedLayoutChange:r})=>{let{columnsOrder:l,setColumnsOrder:c,resetColumnsOrder:m}=It({key:e,columns:t,getInitialValueInEffect:o}),{columnsToggle:u,setColumnsToggle:f,resetColumnsToggle:p}=At({key:e,columns:t,getInitialValueInEffect:o}),{columnsWidth:d,setColumnsWidth:s,setColumnWidth:i,setMultipleColumnWidths:g,resetColumnsWidth:h,hasResizableColumns:y,allResizableWidthsInitial:v,measureAndSetColumnWidths:M}=_t({key:e,columns:t,getInitialValueInEffect:o,headerRef:n,scrollViewportRef:a,onFixedLayoutChange:r});return{effectiveColumns:da(()=>l?l.map(T=>t.find(P=>P.accessor===T)).map(T=>({...T,hidden:T?.hidden||!u.find(P=>P.accessor===T?.accessor)?.toggled})).map(T=>T?.accessor==="__selection__"?T:{...T,width:d.find(P=>P[T?.accessor])?.[T?.accessor]}):t,[t,l,u,d]),setColumnsOrder:c,columnsOrder:l,resetColumnsOrder:m,columnsToggle:u,setColumnsToggle:f,resetColumnsToggle:p,columnsWidth:d,setColumnsWidth:s,setColumnWidth:i,setMultipleColumnWidths:g,resetColumnsWidth:h,hasResizableColumns:y,allResizableWidthsInitial:v,measureAndSetColumnWidths:M}};import{rem as ba}from"@mantine/core";import{useCallback as Ta,useEffect as dt,useRef as K}from"react";import{useEffect as ma,useLayoutEffect as pa}from"react";var ct=typeof window<"u"?pa:ma;import{useRef as fa}from"react";function ut(e){let t=fa(e);return t.current=e,t}var Bt="--mantine-datatable-header-height",Vt="--mantine-datatable-footer-height",Gt="--mantine-datatable-selection-column-width",Ft="--mantine-datatable-last-row-border-bottom";function G(e,t,o){e?.style.setProperty(t,o)}function pt(e){let t=e.borderBoxSize?.[0]||e.contentBoxSize?.[0];return t?{width:t.inlineSize,height:t.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}}function mt(e,t,o){if(e){let n=new ResizeObserver(a=>{let r=a[0];r&&t(pt(r))});return n.observe(e),()=>{n.disconnect(),o()}}}function $t({scrollCallbacks:e,withRowBorders:t}){let o={root:K(null),table:K(null),scrollViewport:K(null),header:K(null),footer:K(null),selectionColumnHeader:K(null)},{root:n,table:a,scrollViewport:r,header:l,footer:c,selectionColumnHeader:m}=o,u=ut({withRowBorders:t}),f=ut(e),p=K(()=>{}),d=K(()=>{}),s=Ta(i=>{f.current.onScroll?.(i),p.current()},[]);return dt(()=>mt(l.current,i=>{G(n.current,Bt,`${i.height}px`)},()=>G(n.current,Bt,"0")),[l.current]),dt(()=>mt(c.current,i=>{G(n.current,Vt,`${i.height}px`)},()=>G(n.current,Vt,"0")),[c.current]),dt(()=>mt(m.current,i=>{G(n.current,Gt,`${i.width}px`)},()=>G(n.current,Gt,"0")),[m.current]),ct(()=>{if(typeof window===void 0)return;let i={top:!0,bottom:!0,left:!0,right:!0},g={width:0,height:0},h={width:0,height:0};function y(D,T){let P=i[D];return i[D]=T,G(n.current,`--mantine-datatable-${D}-shadow-opacity`,T?"0":"1"),P}function v(){let D=g.height-h.height,T=D<0;G(n.current,"--mantine-datatable-footer-position",T?"relative":"sticky"),G(n.current,"--mantine-datatable-footer-bottom",T?`${D}px`:"0")}function M(){u.current.withRowBorders&&g.height<h.height?G(n.current,Ft,`${ba("1px")} solid var(--mantine-datatable-border-color)`):G(n.current,Ft,"unset")}d.current=M;function R(){let D=f.current,T=r.current,P=T?.scrollTop??0,b=T?.scrollLeft??0,x=P===0,k=g.height-P-h.height<1,E=y("top",x),L=y("bottom",k);x&&x!==E&&D.onScrollToTop?.(),k&&k!==L&&D.onScrollToBottom?.();let C=T?getComputedStyle(T).direction==="rtl":!1,w=(T?.scrollWidth??0)-h.width,S,I;if(C){let F=Math.abs(b);I=F<1,S=w-F<1}else S=b<1,I=g.width-b-h.width<1;let A=y("left",S),H=y("right",I);S&&S!==A&&D.onScrollToLeft?.(),I&&I!==H&&D.onScrollToRight?.()}p.current=R;let W=new ResizeObserver(D=>{for(let T of D)switch(T.target.tagName){case"TABLE":{g=pt(T);break}case"DIV":{h=pt(T);break}}R(),v(),M()});return W.observe(a.current),W.observe(r.current),()=>{W.disconnect()}},[]),ct(()=>{d.current()},[t]),{refs:o,onScroll:s}}import{useEffect as ga,useState as ha}from"react";function Xt(e){let[t,o]=ha(null),n=e?.join(":")||"";return ga(()=>{o(null)},[n]),{lastSelectionChangeIndex:t,setLastSelectionChangeIndex:o}}import{useEffect as Ca,useRef as ya,useState as Da}from"react";function xa(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 wa(e,t){return t||(typeof window<"u"&&"matchMedia"in window?e.map(o=>window.matchMedia(o).matches):e.map(()=>!1))}function Ut(e,t,{getInitialValueInEffect:o}={getInitialValueInEffect:!0}){let[n,a]=Da(o?t:wa(e,t)),r=ya(null);return Ca(()=>{if("matchMedia"in window)return r.current=e.map(l=>window.matchMedia(l)),a(r.current.map(l=>l.matches)),xa(r.current,l=>{a(l)})},[e]),n}import{useMantineTheme as Sa}from"@mantine/core";import{useMemo as Qt}from"react";function Kt(e){let t=Sa(),o=Qt(()=>e.map(a=>(typeof a=="function"?a(t):a)??""),[e,t]),n=Qt(()=>e.map(()=>!0),[e]);return Ut(o,n)}import{useMantineTheme as Ra}from"@mantine/core";import{useMediaQuery as Pa}from"@mantine/hooks";function J(e){let t=Ra(),o=typeof e=="function"?e(t):e;return Pa(o||"",!0)}import{useState as va}from"react";function de(e){let t=e.replace(/([a-z\d])([A-Z]+)/g,"$1 $2").replace(/\W|_/g," ").trim().toLowerCase();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function Jt(e,t,o){return e.filter(n=>!t.map(o).includes(o(n)))}function He(e,t){return e.filter((o,n,a)=>n===a.findIndex(r=>t(o)===t(r)))}function ft(e,t){return t?t.match(/([^[.\]])+/g).reduce((n,a)=>n&&n[a],e):void 0}function _(e,t){return typeof t=="string"?ft(e,t):t(e)}function ui(e,t){let o=structuredClone(t),n=o[e.source.index];return e.destination&&(o.splice(e.source.index,1),o.splice(e.destination.index,0,n)),o}function di(e,t){let o=structuredClone(t),n=e.destination;if(!n)return o;let a=o[e.source.index],r=o[n.index];return o.splice(n.index,1,a),o.splice(e.source.index,1,r),o}function bt(e){return!e||e.length===0?0:Math.max(...e.map(t=>t.groups&&t.groups.length>0?1+bt(t.groups):1))}function Pe(e){let t=[];for(let o of e)o.columns&&o.columns.length>0?t.push(...o.columns.filter(n=>n!=null)):o.groups&&o.groups.length>0&&t.push(...Pe(o.groups));return t.filter(o=>o!=null)}function Oe(e,t){return e.columns&&e.columns.length>0?e.columns.filter((o,n)=>o.hidden?!1:t?t[n]!==!1:!0).length:e.groups&&e.groups.length>0?e.groups.reduce((o,n)=>o+Oe(n,t),0):0}function Tt(e,t,o=0){if(o===t)return[...e];let n=[];for(let a of e)a.groups&&a.groups.length>0&&n.push(...Tt(a.groups,t,o+1));return n}function jt(e,t,o){return o?!e||t:!1}function Zt({rowExpansion:e,records:t,idAccessor:o}){let n=[];if(e&&t){let{trigger:c,allowMultiple:m,initiallyExpanded:u}=e;t&&c==="always"?n=t.map(f=>_(f,o)):u&&(n=t.filter((f,p)=>u({record:f,index:p})).map(f=>_(f,o)),m||(n=[n[0]]))}let a,r,l=va(n);if(e){let{expandable:c,trigger:m,allowMultiple:u,collapseProps:f,content:p}=e;e.expanded?{recordIds:a,onRecordIdsChange:r}=e.expanded:[a,r]=l;let d=s=>r?.(a.filter(i=>i!==_(s,o)));return{expandOnClick:m!=="always"&&m!=="never",isRowExpanded:s=>m==="always"?!0:a.includes(_(s,o)),isExpandable:({record:s,index:i})=>c?c({record:s,index:i}):!0,expandRow:s=>{let i=_(s,o);r?.(u?[...a,i]:[i])},collapseRow:d,collapseProps:f,content:({record:s,index:i})=>()=>p({record:s,index:i,collapse:()=>d(s)})}}}import{useTimeout as Yt}from"@mantine/hooks";import{useEffect as Ma,useState as qt}from"react";function eo(e,t){let[o,n]=qt(e),[a,r]=qt(e),l=Yt(()=>n(!0),0),c=Yt(()=>r(!1),t||200);return Ma(()=>{e?(c.clear(),r(!0),l.start()):(l.clear(),n(!1),c.start())},[l,c,e]),{expanded:o,visible:a}}var me="mantine-datatable-nowrap",pe="mantine-datatable-ellipsis",X="mantine-datatable-pointer-cursor",_e="mantine-datatable-context-menu-cursor",to="mantine-datatable-text-selection-disabled",j="mantine-datatable-text-align-left",Z="mantine-datatable-text-align-center",Y="mantine-datatable-text-align-right";import{jsx as Na}from"react/jsx-runtime";function oo({className:e,style:t,visibleMediaQuery:o,title:n,noWrap:a,ellipsis:r,textAlign:l,width:c}){return J(o)?Na(ka,{className:Ea({[me]:a||r,[pe]:r,[j]:l==="left",[Z]:l==="center",[Y]:l==="right"},e),style:[{width:c,minWidth:c,maxWidth:c},t],children:n}):null}import{TableTh as La}from"@mantine/core";import{jsx as Wa}from"react/jsx-runtime";function no({shadowVisible:e}){return Wa(La,{className:"mantine-datatable-footer-selector-placeholder-cell","data-shadow-visible":e||void 0})}import{jsx as gt,jsxs as _a}from"react/jsx-runtime";function ao({className:e,style:t,columns:o,defaultColumnProps:n,selectionVisible:a,selectorCellShadowVisible:r,ref:l}){return gt(Ia,{ref:l,className:Oa("mantine-datatable-footer",e),style:t,children:_a(Ha,{children:[a&>(no,{shadowVisible:r}),o.map(({hidden:c,...m})=>{if(c)return null;let{accessor:u,visibleMediaQuery:f,textAlign:p,width:d,footer:s,footerClassName:i,footerStyle:g,noWrap:h,ellipsis:y}={...n,...m};return gt(oo,{className:i,style:g,visibleMediaQuery:f,textAlign:p,width:d,title:s,noWrap:h,ellipsis:y},u)})]})})}import{Checkbox as pr,Group as fr,Popover as br,PopoverDropdown as Tr,PopoverTarget as gr,Stack as hr,TableThead as Cr,TableTr as wo}from"@mantine/core";import yr from"clsx";import{useState as Dr}from"react";import{TableTh as Aa}from"@mantine/core";import za from"clsx";import{useMemo as Ae}from"react";import{jsx as Ba}from"react/jsx-runtime";function ro({group:{id:e,columns:t,groups:o,title:n,textAlign:a,className:r,style:l},maxDepth:c,currentDepth:m,previousGroups:u,isLastGroup:f,withColumnBorders:p=!1,totalTableColumns:d}){let s=Ae(()=>t&&t.length>0?t:o&&o.length>0?Pe([{id:e,columns:t,groups:o}]):[],[t,o,e]),i=Ae(()=>s.map(({visibleMediaQuery:D})=>D),[s]),g=Kt(i),h=Ae(()=>Oe({id:e,columns:t,groups:o},g),[e,t,o,g]),y=Ae(()=>u.reduce((D,T)=>D+Oe(T,g),0),[u,g]),M=o&&o.length>0?1:c-m,R=y+h<d,W=jt(f,R,p);return h>0?Ba(Aa,{colSpan:h,rowSpan:M>1?M:void 0,className:za("mantine-datatable-column-group-header-cell",{[j]:a==="left",[Z]:a==="center",[Y]:a==="right","mantine-datatable-column-group-header-cell--needs-border":W},r),style:l,children:n??de(e)}):null}import{ActionIcon as Co,Box as nr,Center as Ge,Flex as ar,Group as rr,TableTh as lr}from"@mantine/core";import Fe from"clsx";import{useRef as ir,useState as sr}from"react";import{ActionIcon as Fa,Popover as $a,PopoverDropdown as Xa,PopoverTarget as Ua}from"@mantine/core";import{useClickOutside as Qa,useDisclosure as Ka}from"@mantine/hooks";import{jsx as lo,jsxs as Va}from"react/jsx-runtime";function io(){return Va("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[lo("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),lo("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 so,jsxs as Ga}from"react/jsx-runtime";function co(){return Ga("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[so("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),so("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 ze,jsxs as Ja}from"react/jsx-runtime";function uo({children:e,isActive:t,filterPopoverProps:o,filterPopoverDisableClickOutside:n}){let[a,{close:r,toggle:l}]=Ka(!1),c=t?co:io,m=Qa(r);return n&&(m=void 0),Ja($a,{withArrow:!0,shadow:"md",opened:a,onClose:r,trapFocus:!0,...o,children:[ze(Ua,{children:ze(Fa,{className:"mantine-datatable-header-cell-filter-action-icon","data-active":t||void 0,size:"sm",variant:"default",onClick:u=>{u.preventDefault(),l()},onKeyDown:u=>u.stopPropagation(),children:ze(c,{})})}),ze(Xa,{ref:m,onClick:u=>u.stopPropagation(),onKeyDown:u=>u.stopPropagation(),children:typeof e=="function"?e({close:r}):e})]})}import{useDirection as ja}from"@mantine/core";import{useCallback as mo,useRef as po,useState as Za}from"react";import{jsx as Ya}from"react/jsx-runtime";var fo=e=>{let{accessor:t,columnRef:o}=e,[n,a]=Za(!1),r=po(0),l=po({current:0,next:0}),{dir:c}=ja(),m=c==="rtl",{setMultipleColumnWidths:u}=ue(),f=mo(d=>{if(d.preventDefault(),d.stopPropagation(),!o.current)return;let s=o.current,i=s.nextElementSibling;for(;i;){let W=i.getAttribute("data-accessor");if(W&&W!=="__selection__")break;i=i.nextElementSibling}if(!i)return;let g=i.getAttribute("data-accessor");if(!g)return;let h=g==="__selection__";a(!0),r.current=d.clientX;let y=s.offsetWidth,v=i.offsetWidth;l.current={current:y,next:v};let M=W=>{if(!o.current)return;let D=o.current,T=D.nextElementSibling;if(!T)return;let P=W.clientX-r.current;m&&(P=-P);let b=50,x=l.current.current-b,k=l.current.next-b,E=Math.max(-x,Math.min(P,k)),L=l.current.current+E,C=l.current.next-E;D.style.width=`${L}px`,T.style.width=`${C}px`,D.style.minWidth=`${L}px`,D.style.maxWidth=`${L}px`,T.style.minWidth=`${C}px`,T.style.maxWidth=`${C}px`},R=()=>{if(!o.current)return;let W=o.current,D=W.nextElementSibling;a(!1),document.body.style.cursor="initial",document.body.style.userSelect="initial";let T=parseInt(W.style.width)||W.offsetWidth,P=D?parseInt(D.style.width)||D.offsetWidth:0,b=[{accessor:t,width:`${T}px`}];if(D&&!h){let x=D.getAttribute("data-accessor");x&&b.push({accessor:x,width:`${P}px`})}setTimeout(()=>{u(b)},0),document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",R)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",M),document.addEventListener("mouseup",R)},[t,o,m,u]),p=mo(()=>{if(!o.current)return;let d=o.current,s=d.nextElementSibling;d.style.width="",d.style.minWidth="",d.style.maxWidth="";let i=[{accessor:t,width:"auto"}];if(s){s.style.width="",s.style.minWidth="",s.style.maxWidth="";let g=s.getAttribute("data-accessor");g&&g!=="__selection__"&&i.push({accessor:g,width:"auto"})}setTimeout(()=>{u(i)},0)},[t,o,u]);return Ya("div",{className:"mantine-datatable-header-resizable-handle",style:{cursor:n?"col-resize":void 0},onMouseDown:f,onDoubleClick:p,onClick:d=>d.stopPropagation(),title:"Drag to resize column, double-click to reset"})};import{jsx as Be,jsxs as qa}from"react/jsx-runtime";function bo(){return qa("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:"M12 5l0 14"}),Be("path",{d:"M16 9l-4 -4"}),Be("path",{d:"M8 9l4 -4"})]})}import{jsx as Ve,jsxs as er}from"react/jsx-runtime";function To(){return er("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:"M8 7l4 -4l4 4"}),Ve("path",{d:"M8 17l4 4l4 -4"}),Ve("path",{d:"M12 3l0 18"})]})}import{jsx as le,jsxs as tr}from"react/jsx-runtime";function go(){return tr("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[le("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),le("path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}import{jsx as ht,jsxs as or}from"react/jsx-runtime";function ho(){return or("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[ht("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ht("path",{d:"M18 6l-12 12"}),ht("path",{d:"M6 6l12 12"})]})}import{Fragment as cr,jsx as z,jsxs as Ct}from"react/jsx-runtime";function yo({className:e,style:t,accessor:o,visibleMediaQuery:n,title:a,sortable:r,draggable:l,toggleable:c,resizable:m,sortIcons:u,textAlign:f,width:p,sortStatus:d,onSortStatusChange:s,filter:i,filterPopoverProps:g,filterPopoverDisableClickOutside:h,filtering:y,sortKey:v}){let{setSourceColumn:M,setTargetColumn:R,swapColumns:W,setColumnsToggle:D}=ue(),[T,P]=sr(!1),b=ir(null);if(!J(n))return null;let x=a??de(o),k=typeof x=="string"?x:void 0,E=r&&s?H=>{H?.defaultPrevented||s({sortKey:v,columnAccessor:o,direction:d?.columnAccessor===o?d.direction==="asc"?"desc":"asc":d?.direction??"asc"})}:void 0,L=H=>{H.stopPropagation(),M(o),P(!1)},C=H=>{H.preventDefault(),R(o),P(!0)},w=()=>{R(o),P(!1),W()},S=()=>{P(!0)},I=()=>{P(!1)},A=H=>{H.stopPropagation(),D(F=>F.map(U=>U.accessor===o?{...U,toggled:!1}:U))};return Ct(lr,{"data-accessor":o,className:Fe({"mantine-datatable-header-cell-sortable":r,"mantine-datatable-header-cell-toggleable":c,"mantine-datatable-header-cell-resizable":m},e),style:[{width:p,...m?{}:{minWidth:p,maxWidth:p}},t],role:r?"button":void 0,tabIndex:r?0:void 0,onClick:E,onKeyDown:H=>H.key==="Enter"&&E?.(),ref:b,children:[Ct(rr,{className:"mantine-datatable-header-cell-sortable-group",justify:"space-between",wrap:"nowrap",children:[Ct(ar,{align:"center",w:"100%",className:Fe({"mantine-datatable-header-cell-draggable":l,"mantine-datatable-header-cell-drag-over":T}),draggable:l,onDragStart:l?L:void 0,onDragEnter:l?S:void 0,onDragOver:l?C:void 0,onDrop:l?w:void 0,onDragLeave:l?I:void 0,children:[l?z(Ge,{role:"img","aria-label":"Drag column",children:z(Co,{className:"mantine-datatable-header-cell-draggable-action-icon",variant:"subtle",size:"xs",onClick:H=>{H.stopPropagation()},children:z(go,{})})}):null,z(nr,{className:Fe("mantine-datatable-header-cell-sortable-text",{[j]:f==="left",[Z]:f==="center",[Y]:f==="right"},me,pe),title:k,children:x})]}),c?z(Ge,{className:"mantine-datatable-header-cell-toggleable-icon",role:"img","aria-label":"Toggle column",children:z(Co,{size:"xs",variant:"light",onClick:A,children:z(ho,{})})}):null,r||d?.columnAccessor===o?z(cr,{children:d?.columnAccessor===o?z(Ge,{className:Fe("mantine-datatable-header-cell-sortable-icon",{"mantine-datatable-header-cell-sortable-icon-reversed":d.direction==="desc"}),role:"img","aria-label":`Sorted ${d.direction==="desc"?"descending":"ascending"}`,children:u?.sorted||z(bo,{})}):z(Ge,{className:"mantine-datatable-header-cell-sortable-unsorted-icon",role:"img","aria-label":"Not sorted",children:u?.unsorted||z(To,{})})}):null,i?z(uo,{filterPopoverProps:g,isActive:!!y,filterPopoverDisableClickOutside:h,children:i}):null]}),m&&o!=="__selection__"?z(fo,{accessor:o,columnRef:b}):null]})}import{Checkbox as ur,TableTh as dr}from"@mantine/core";import mr from"clsx";import{jsx as Do}from"react/jsx-runtime";function xo({className:e,style:t,trigger:o,shadowVisible:n,checked:a,indeterminate:r,checkboxProps:l,onChange:c,rowSpan:m,ref:u}){let f=!l.disabled;return Do(dr,{ref:u,className:mr("mantine-datatable-header-selector-cell",{[X]:o==="cell"&&f},e),style:t,rowSpan:m,"data-shadow-visible":n||void 0,"data-accessor":"__selection__",onClick:o==="cell"&&f?c:void 0,children:Do(ur,{classNames:f?{input:X}:void 0,checked:a,indeterminate:r,onChange:c,...l,disabled:!(c||l.onChange)||l.disabled})})}import{jsx as q,jsxs as $e}from"react/jsx-runtime";function So({selectionColumnHeaderRef:e,className:t,style:o,sortStatus:n,sortIcons:a,onSortStatusChange:r,columns:l,defaultColumnProps:c,groups:m,selectionTrigger:u,selectionVisible:f,selectionChecked:p,selectionIndeterminate:d,onSelectionChange:s,selectionCheckboxProps:i,selectorCellShadowVisible:g,selectionColumnClassName:h,selectionColumnStyle:y,withColumnBorders:v=!1,ref:M}){let R=m?bt(m):0,W=R>0?R+1:1,D=f?q(xo,{ref:e,className:h,style:y,trigger:u,shadowVisible:g,checked:p,indeterminate:d,checkboxProps:i,onChange:s,rowSpan:m?W:void 0}):null,{columnsToggle:T,setColumnsToggle:P}=ue(),[b,x]=Dr(!1),k=l.some(C=>C.toggleable),E=k?Object.fromEntries(l.map(({accessor:C,title:w})=>[C,w??de(String(C))])):void 0,L=$e(Cr,{className:yr("mantine-datatable-header",t),style:o,ref:M,onContextMenu:k?C=>{C.preventDefault(),x(w=>!w)}:void 0,children:[m&&Array.from({length:R},(C,w)=>{let S=Tt(m,w);return $e(wo,{children:[w===0&&D,S.map((I,A)=>q(ro,{group:I,maxDepth:R,currentDepth:w,previousGroups:S.slice(0,A),isLastGroup:A===S.length-1,withColumnBorders:v,totalTableColumns:l.length},I.id))]},`group-depth-${w}`)}),$e(wo,{children:[!m&&D,l.map(({hidden:C,...w},S)=>{if(C)return null;let{accessor:I,visibleMediaQuery:A,textAlign:H,width:F,title:U,sortable:fe,draggable:be,toggleable:Te,resizable:ge,titleClassName:te,titleStyle:he,filter:Ce,filterPopoverProps:Q,filterPopoverDisableClickOutside:Je,filtering:je,sortKey:Ze}={...c,...w};return q(yo,{accessor:I,className:te,style:he,visibleMediaQuery:A,textAlign:H,width:F,title:U,sortable:fe,draggable:be,toggleable:Te,resizable:ge&&S<l.length-1,sortStatus:n,sortIcons:a,sortKey:Ze,onSortStatusChange:r,filter:Ce,filterPopoverProps:Q,filterPopoverDisableClickOutside:Je,filtering:je},I)})]})]});return k?$e(br,{position:"bottom",withArrow:!0,shadow:"md",opened:b,onChange:x,children:[q(gr,{children:L}),q(Tr,{children:q(hr,{children:T.filter(C=>C.toggleable).map(C=>q(fr,{children:q(pr,{classNames:{label:"mantine-datatable-header-column-toggle-checkbox-label"},size:"xs",label:E[C.accessor],checked:C.toggled,onChange:w=>{P(T.map(S=>S.accessor===C.accessor?{...S,toggled:w.currentTarget.checked}:S))}})},C.accessor))})})]}):L}import{Center as xr,Loader as wr}from"@mantine/core";import Sr from"clsx";import{jsx as Ro}from"react/jsx-runtime";function Po({fetching:e,customContent:t,backgroundBlur:o,size:n,type:a,color:r}){return Ro(xr,{className:Sr("mantine-datatable-loader",{"mantine-datatable-loader-fetching":e}),style:[{backdropFilter:o?`blur(${o}px)`:void 0}],children:e&&(t||Ro(wr,{size:n,type:a,color:r}))})}import{Box as Ir,Pagination as Hr,Text as Or,rem as _r}from"@mantine/core";import Io from"clsx";import{Button as vr,Group as Mr,Menu as kr,MenuDropdown as Er,MenuItem as Nr,MenuTarget as Lr,Text as Eo,rem as ve}from"@mantine/core";import Wr from"clsx";import{parseThemeColor as Rr}from"@mantine/core";function O(e,t,o){return e?Rr({color:typeof e=="object"?e[o]:e,theme:t}).value:void 0}function vo({theme:e,c:t,backgroundColor:o,borderColor:n,rowBorderColor:a,stripedColor:r,highlightOnHoverColor:l}){return{"--mantine-datatable-color-light":O(t,e,"light"),"--mantine-datatable-color-dark":O(t,e,"dark"),"--mantine-datatable-background-color-light":O(o,e,"light"),"--mantine-datatable-background-color-dark":O(o,e,"dark"),"--mantine-datatable-border-color-light":O(n,e,"light"),"--mantine-datatable-border-color-dark":O(n,e,"dark"),"--mantine-datatable-row-border-color-light":O(a,e,"light"),"--mantine-datatable-row-border-color-dark":O(a,e,"dark"),"--mantine-datatable-striped-color-light":O(r,e,"light"),"--mantine-datatable-striped-color-dark":O(r,e,"dark"),"--mantine-datatable-highlight-on-hover-color-light":O(l,e,"light"),"--mantine-datatable-highlight-on-hover-color-dark":O(l,e,"dark")}}function Xe({theme:e,paginationActiveTextColor:t,paginationActiveBackgroundColor:o}){return{"--mantine-datatable-pagination-active-text-color-light":O(t,e,"light"),"--mantine-datatable-pagination-active-text-color-dark":O(t,e,"dark"),"--mantine-datatable-pagination-active-background-color-light":O(o,e,"light"),"--mantine-datatable-pagination-active-background-color-dark":O(o,e,"dark")}}function Mo({theme:e,color:t,backgroundColor:o}){return{"--mantine-datatable-row-color-light":O(t,e,"light"),"--mantine-datatable-row-color-dark":O(t,e,"dark"),"--mantine-datatable-row-background-color-light":O(o,e,"light"),"--mantine-datatable-row-background-color-dark":O(o,e,"dark")}}import{jsx as yt,jsxs as Pr}from"react/jsx-runtime";function ko(){return Pr("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[yt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),yt("path",{d:"M8 9l4 -4l4 4"}),yt("path",{d:"M16 15l-4 4l-4 -4"})]})}import{jsx as ie,jsxs as Lo}from"react/jsx-runtime";var No={xs:ve(22),sm:ve(26),md:ve(32),lg:ve(38),xl:ve(44)};function Wo({size:e,label:t,values:o,value:n,activeTextColor:a,activeBackgroundColor:r,onChange:l}){return Lo(Mr,{gap:"xs",children:[ie(Eo,{component:"div",size:e,children:t}),Lo(kr,{withinPortal:!0,withArrow:!0,offset:2,classNames:{arrow:"mantine-datatable-page-size-selector-menu-arrow"},children:[ie(Lr,{children:ie(vr,{size:e,variant:"default",classNames:{section:"mantine-datatable-page-size-selector-button-icon"},rightSection:ie(ko,{}),style:[{fontWeight:"normal"},c=>({height:No[e],paddingLeft:c.spacing[e],paddingRight:c.spacing[e]})],children:n})}),ie(Er,{children:o.map(c=>{let m=c===n;return ie(Nr,{className:Wr({"mantine-datatable-page-size-selector-active":m}),style:[{height:No[e]},m&&(a||r)?u=>Xe({theme:u,paginationActiveTextColor:a,paginationActiveBackgroundColor:r}):void 0],disabled:m,onClick:()=>l(c),children:ie(Eo,{component:"div",size:e,children:c})},c)})})]})]})}import{Fragment as Ho,jsx as ee,jsxs as Ar}from"react/jsx-runtime";function Oo({className:e,style:t,fetching:o,page:n,onPageChange:a,paginationWithEdges:r,paginationWithControls:l,paginationActiveTextColor:c,paginationActiveBackgroundColor:m,paginationSize:u,loadingText:f,noRecordsText:p,paginationText:d,totalRecords:s,recordsPerPage:i,onRecordsPerPageChange:g,recordsPerPageLabel:h,recordsPerPageOptions:y,recordsLength:v,horizontalSpacing:M,paginationWrapBreakpoint:R,getPaginationControlProps:W,getPaginationItemProps:D,renderPagination:T}){let P;if(s){let S=(n-1)*i+1,I=S+(v||0)-1;P=d({from:S,to:I,totalRecords:s})}else P=o?f:p;let b=s&&i?Math.max(1,Math.ceil(s/i)):1,x=s?(n-1)*(i??0)+1:void 0,k=s?(x??1)+(v??0)-1:void 0,L=!J(({breakpoints:S})=>`(min-width: ${typeof R=="number"?`${_r(R)}rem`:S[R]||R})`),C={Text:S=>ee(Or,{component:"div",className:"mantine-datatable-pagination-text",size:u,...S,children:P}),PageSizeSelector:S=>y?ee(Wo,{activeTextColor:c,activeBackgroundColor:m,size:u,label:h,values:y,value:i,onChange:g,...S}):ee(Ho,{}),Pagination:S=>ee(Hr,{classNames:{root:Io("mantine-datatable-pagination-pages",{"mantine-datatable-pagination-pages-fetching":o||!v}),control:"mantine-datatable-pagination-pages-control"},style:c||m?I=>Xe({theme:I,paginationActiveTextColor:c,paginationActiveBackgroundColor:m}):void 0,withEdges:r,withControls:l,value:n,onChange:a,size:u,total:b,getControlProps:W,getItemProps:D,...S})},w={state:{paginationSize:u,page:n,totalPages:b,totalRecords:s,recordsPerPage:i,recordsLength:v,fetching:o,from:x,to:k,isWrapped:L},actions:{setPage:S=>a?.(S),setRecordsPerPage:g?S=>g(S):void 0},Controls:C};return ee(Ir,{px:M??"xs",py:"xs",className:Io("mantine-datatable-pagination",e),style:[{flexDirection:L?"column":"row"},t],children:typeof T=="function"?T(w):Ar(Ho,{children:[ee(C.Text,{}),ee(C.PageSizeSelector,{}),ee(C.Pagination,{})]})})}import{TableTr as Jr}from"@mantine/core";import jr from"clsx";import{TableTd as zr}from"@mantine/core";import Br from"clsx";import{jsx as Vr}from"react/jsx-runtime";function _o({className:e,style:t,visibleMediaQuery:o,record:n,index:a,onClick:r,onDoubleClick:l,onContextMenu:c,noWrap:m,ellipsis:u,textAlign:f,width:p,accessor:d,render:s,defaultRender:i,customCellAttributes:g}){return J(o)?Vr(zr,{className:Br({[me]:m||u,[pe]:u,[X]:r||l,[_e]:c,[j]:f==="left",[Z]:f==="center",[Y]:f==="right"},e),style:[{width:p,minWidth:p,maxWidth:p},t],onClick:r,onDoubleClick:l,onContextMenu:c,...g?.(n,a),children:s?s(n,a):i?i(n,a,d):ft(n,d)}):null}import{Collapse as Gr,TableTd as Fr,TableTr as Ao}from"@mantine/core";import{Fragment as $r,jsx as Me,jsxs as Xr}from"react/jsx-runtime";function zo({open:e,colSpan:t,content:o,collapseProps:n}){let{expanded:a,visible:r}=eo(e,n?.transitionDuration);return r?Xr($r,{children:[Me(Ao,{}),Me(Ao,{children:Me(Fr,{className:"mantine-datatable-row-expansion-cell",colSpan:t,children:Me(Gr,{in:a,...n,children:Me("div",{className:"mantine-datatable-row-expansion-cell-content",children:o()})})})})]}):null}import{Checkbox as Ur,TableTd as Qr}from"@mantine/core";import Kr from"clsx";import{jsx as Bo}from"react/jsx-runtime";function Vo({className:e,style:t,record:o,index:n,trigger:a,onChange:r,withRightShadow:l,checkboxProps:c,getCheckboxProps:m,...u}){let f={...c,...m(o,n)},p=!u.disabled&&!f.disabled,d=s=>{s.stopPropagation(),a==="cell"&&p&&r?.(s)};return Bo(Qr,{className:Kr("mantine-datatable-row-selector-cell",{[X]:a==="cell"&&p},e),style:t,"data-shadow-visible":l||void 0,onClick:d,children:Bo(Ur,{classNames:p?{input:X}:void 0,onChange:r,...u,...f})})}import{Fragment as Go,jsx as Ue,jsxs as Fo}from"react/jsx-runtime";function $o({record:e,index:t,columns:o,defaultColumnProps:n,defaultColumnRender:a,selectionTrigger:r,selectionVisible:l,selectionChecked:c,onSelectionChange:m,isRecordSelectable:u,selectionCheckboxProps:f,getSelectionCheckboxProps:p,onClick:d,onDoubleClick:s,onContextMenu:i,onCellClick:g,onCellDoubleClick:h,onCellContextMenu:y,expansion:v,customAttributes:M,color:R,backgroundColor:W,className:D,style:T,selectorCellShadowVisible:P,selectionColumnClassName:b,selectionColumnStyle:x,rowFactory:k}){let E=Fo(Go,{children:[l&&Ue(Vo,{className:b,style:x,record:e,index:t,trigger:r,withRightShadow:P,checked:c,disabled:!m||(u?!u(e,t):!1),onChange:m,checkboxProps:f,getCheckboxProps:p}),o.map(({hidden:w,hiddenContent:S,...I},A)=>{if(w||S)return null;let{accessor:H,visibleMediaQuery:F,textAlign:U,noWrap:fe,ellipsis:be,width:Te,render:ge,cellsClassName:te,cellsStyle:he,customCellAttributes:Ce}={...n,...I};return Ue(_o,{className:typeof te=="function"?te(e,t):te,style:he?.(e,t),visibleMediaQuery:F,record:e,index:t,onClick:g?Q=>g({event:Q,record:e,index:t,column:I,columnIndex:A}):void 0,onDoubleClick:h?Q=>h({event:Q,record:e,index:t,column:I,columnIndex:A}):void 0,onContextMenu:y?Q=>y({event:Q,record:e,index:t,column:I,columnIndex:A}):void 0,accessor:H,textAlign:U,noWrap:fe,ellipsis:be,width:Te,render:ge,defaultRender:a,customCellAttributes:Ce},H)})]}),L=v&&Ue(zo,{colSpan:o.filter(({hidden:w})=>!w).length+(l?1:0),open:v.isRowExpanded(e),content:v.content({record:e,index:t}),collapseProps:v.collapseProps}),C=Zr({record:e,index:t,selectionChecked:c,onClick:d,onDoubleClick:s,onContextMenu:i,expansion:v,customAttributes:M,color:R,backgroundColor:W,className:D,style:T});return k?k({record:e,index:t,rowProps:C,children:E,expandedElement:L}):Fo(Go,{children:[Ue(Jr,{...C,children:E}),L]})}function Zr({record:e,index:t,selectionChecked:o,onClick:n,onDoubleClick:a,onContextMenu:r,expansion:l,customAttributes:c,color:m,backgroundColor:u,className:f,style:p}){return{className:jr("mantine-datatable-row",{[X]:n||a||l?.isExpandable({record:e,index:t})&&l?.expandOnClick},{[_e]:r},typeof f=="function"?f(e,t):f),"data-selected":o||void 0,onClick:d=>{if(l){let{isExpandable:s,isRowExpanded:i,expandOnClick:g,expandRow:h,collapseRow:y}=l;s({record:e,index:t})&&g&&(i(e)?y(e):h(e))}n?.({event:d,record:e,index:t})},onDoubleClick:a?d=>a({event:d,record:e,index:t}):void 0,onContextMenu:r?d=>r({event:d,record:e,index:t}):void 0,style:[m||u?d=>{let s=m?.(e,t),i=u?.(e,t);return Mo({theme:d,color:s,backgroundColor:i})}:void 0,p?.(e,t)],...c?.(e,t)??{}}}import{Box as Xo,ScrollArea as Yr}from"@mantine/core";import Qe from"clsx";import{jsx as Ke,jsxs as qr}from"react/jsx-runtime";function Uo({leftShadowBehind:e,rightShadowBehind:t,onScrollPositionChange:o,children:n,viewportRef:a,scrollAreaProps:r}){return qr(Yr,{...r,viewportRef:a,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:o,children:[n,Ke(Xo,{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-top-shadow")}),Ke("div",{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-left-shadow",{"mantine-datatable-scroll-area-shadow-behind":e})}),Ke("div",{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-right-shadow",{"mantine-datatable-scroll-area-shadow-behind":t})}),Ke(Xo,{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-bottom-shadow")})]})}import{jsx as B,jsxs as Jo}from"react/jsx-runtime";function ll({withTableBorder:e,borderRadius:t,textSelectionDisabled:o,height:n="100%",minHeight:a,maxHeight:r,shadow:l,verticalAlign:c="center",fetching:m,columns:u,storeColumnsKey:f,groups:p,pinFirstColumn:d,pinLastColumn:s,defaultColumnProps:i,defaultColumnRender:g,idAccessor:h="id",records:y,selectionTrigger:v="checkbox",selectedRecords:M,onSelectedRecordsChange:R,selectionColumnClassName:W,selectionColumnStyle:D,isRecordSelectable:T,selectionCheckboxProps:P,allRecordsSelectionCheckboxProps:b={"aria-label":"Select all records"},getRecordSelectionCheckboxProps:x=(V,xe)=>({"aria-label":`Select record ${xe+1}`}),sortStatus:k,sortIcons:E,onSortStatusChange:L,horizontalSpacing:C,page:w,onPageChange:S,totalRecords:I,recordsPerPage:A,onRecordsPerPageChange:H,recordsPerPageOptions:F,recordsPerPageLabel:U="Records per page",paginationWithEdges:fe,paginationWithControls:be,paginationActiveTextColor:Te,paginationActiveBackgroundColor:ge,paginationSize:te="sm",paginationText:he=({from:V,to:xe,totalRecords:et})=>`${V} - ${xe} / ${et}`,paginationWrapBreakpoint:Ce="sm",getPaginationControlProps:Q=V=>V==="previous"?{"aria-label":"Previous page"}:V==="next"?{"aria-label":"Next page"}:{},getPaginationItemProps:Je,renderPagination:je,loaderBackgroundBlur:Ze,customLoader:jo,loaderSize:Zo,loaderType:Yo,loaderColor:qo,loadingText:en="...",emptyState:tn,noRecordsText:wt="No records",noRecordsIcon:on,highlightOnHover:nn,striped:an,noHeader:rn,onRowClick:ln,onRowDoubleClick:sn,onRowContextMenu:cn,onCellClick:un,onCellDoubleClick:dn,onCellContextMenu:mn,onScroll:pn,onScrollToTop:fn,onScrollToBottom:bn,onScrollToLeft:Tn,onScrollToRight:gn,c:hn,backgroundColor:Cn,borderColor:yn,rowBorderColor:Dn,stripedColor:xn,highlightOnHoverColor:wn,rowColor:Sn,rowBackgroundColor:Rn,rowExpansion:Pn,rowClassName:vn,rowStyle:Mn,customRowAttributes:kn,scrollViewportRef:En,scrollAreaProps:Nn,tableRef:Ln,bodyRef:Wn,m:In,my:Hn,mx:On,mt:_n,mb:An,ml:zn,mr:Bn,className:Vn,classNames:ye,style:Gn,styles:De,rowFactory:Fn,tableWrapper:Ye,...qe}){let V=al(()=>p?Pe(p):u,[u,p]),[xe,et]=rl(!1),{refs:$,onScroll:$n}=$t({scrollCallbacks:{onScroll:pn,onScrollToTop:fn,onScrollToBottom:bn,onScrollToLeft:Tn,onScrollToRight:gn},withRowBorders:qe.withRowBorders}),tt=zt({key:f,columns:V,headerRef:$.header,scrollViewportRef:$.scrollViewport,onFixedLayoutChange:et}),Xn=Qo($.table,Ln),Un=Qo($.scrollViewport,En),Qn=Zt({rowExpansion:Pn,records:y,idAccessor:h}),ke=xt(!1),St=xt(w),ot=xt(y),Kn=Dt(N=>{ke.current=!0,ot.current=y,S(N)},[S,y]);ol(()=>{St.current!==w&&(ke.current=!0,ot.current=y,St.current=w)},[w,y]);let we=y?.length;nl(()=>{if(!ke.current||m||y===ot.current)return;let N=$.scrollViewport.current;if(!N)return;let oe=requestAnimationFrame(()=>{N.scrollTo({top:0,left:0}),ke.current=!1});return()=>cancelAnimationFrame(oe)},[m,y,$.scrollViewport]);let Rt=y?.map(N=>_(N,h)),se=!!M,Se=M?.map(N=>_(N,h)),Pt=Rt!==void 0&&Se!==void 0&&Se.length>0,nt=T?y?.filter(T):y,Ee=nt?.map(N=>_(N,h)),Ne=Pt&&Ee.every(N=>Se.includes(N)),Jn=Pt&&Ee.some(N=>Se.includes(N)),jn=Dt(()=>{M&&R&&R(Ne?M.filter(N=>!Ee.includes(_(N,h))):He([...M,...nt],N=>_(N,h)))},[Ne,h,R,Ee,nt,M]),{lastSelectionChangeIndex:Le,setLastSelectionChangeIndex:Zn}=Xt(Rt),at=se&&!d,Yn={m:In,my:Hn,mx:On,mt:_n,mb:An,ml:zn,mr:Bn},qn=Dt(({children:N})=>Ye?Ye({children:N}):N,[Ye]);return B(it,{...tt,children:Jo(el,{ref:$.root,...Yn,className:Ko("mantine-datatable",{"mantine-datatable-with-border":e},Vn,ye?.root),style:[N=>({...vo({theme:N,c:hn,backgroundColor:Cn,borderColor:yn,rowBorderColor:Dn,stripedColor:xn,highlightOnHoverColor:wn}),borderRadius:N.radius[t]||t,boxShadow:N.shadows[l]||l,height:n,minHeight:a,maxHeight:r}),Gn,De?.root,{position:"relative"}],children:[B(Uo,{viewportRef:Un,leftShadowBehind:se||!!d,rightShadowBehind:s,onScrollPositionChange:$n,scrollAreaProps:Nn,children:B(qn,{children:Jo(tl,{ref:Xn,horizontalSpacing:C,className:Ko("mantine-datatable-table",{[to]:o,"mantine-datatable-vertical-align-top":c==="top","mantine-datatable-vertical-align-bottom":c==="bottom","mantine-datatable-pin-last-column":s,"mantine-datatable-selection-column-visible":se,"mantine-datatable-pin-first-column":d,"mantine-datatable-resizable-columns":tt.hasResizableColumns&&xe},ye?.table),style:{...De?.table},"data-striped":we&&an||void 0,"data-highlight-on-hover":nn||void 0,...qe,children:[rn?null:B(it,{...tt,children:B(So,{ref:$.header,selectionColumnHeaderRef:$.selectionColumnHeader,className:ye?.header,style:De?.header,columns:V,defaultColumnProps:i,groups:p,sortStatus:k,sortIcons:E,onSortStatusChange:L,selectionTrigger:v,selectionVisible:se,selectionChecked:Ne,selectionIndeterminate:Jn&&!Ne,onSelectionChange:jn,selectionCheckboxProps:{...P,...b},selectorCellShadowVisible:at,selectionColumnClassName:W,selectionColumnStyle:D,withColumnBorders:qe.withColumnBorders})}),B("tbody",{ref:Wn,children:we?y.map((N,oe)=>{let rt=_(N,h),lt=Se?.includes(rt)||!1,vt;return R&&M&&(vt=ea=>{if(ea.nativeEvent.shiftKey&&Le!==null){let ce=y.filter(oe>Le?(ne,ae)=>ae>=Le&&ae<=oe&&(T?T(ne,ae):!0):(ne,ae)=>ae>=oe&&ae<=Le&&(T?T(ne,ae):!0));R(lt?Jt(M,ce,ne=>_(ne,h)):He([...M,...ce],ne=>_(ne,h)))}else R(lt?M.filter(ce=>_(ce,h)!==rt):He([...M,N],ce=>_(ce,h)));Zn(oe)}),B($o,{record:N,index:oe,columns:V,defaultColumnProps:i,defaultColumnRender:g,selectionTrigger:v,selectionVisible:se,selectionChecked:lt,onSelectionChange:vt,isRecordSelectable:T,selectionCheckboxProps:P,getSelectionCheckboxProps:x,onClick:ln,onDoubleClick:sn,onCellClick:un,onCellDoubleClick:dn,onContextMenu:cn,onCellContextMenu:mn,expansion:Qn,color:Sn,backgroundColor:Rn,className:vn,style:Mn,customAttributes:kn,selectorCellShadowVisible:at,selectionColumnClassName:W,selectionColumnStyle:D,idAccessor:h,rowFactory:Fn},rt)}):B(Nt,{})}),V.some(({footer:N})=>N)&&B(ao,{ref:$.footer,className:ye?.footer,style:De?.footer,columns:V,defaultColumnProps:i,selectionVisible:se,selectorCellShadowVisible:at})]})})}),!!(w&&we)&&B(Oo,{className:ye?.pagination,style:De?.pagination,horizontalSpacing:C,fetching:m,page:w,onPageChange:Kn,totalRecords:I,recordsPerPage:A,onRecordsPerPageChange:H,recordsPerPageOptions:F,recordsPerPageLabel:U,paginationWithEdges:fe,paginationWithControls:be,paginationActiveTextColor:Te,paginationActiveBackgroundColor:ge,paginationSize:te,paginationText:he,paginationWrapBreakpoint:Ce,getPaginationControlProps:Q,getPaginationItemProps:Je,noRecordsText:wt,loadingText:en,recordsLength:we,renderPagination:je}),B(Po,{fetching:m,backgroundBlur:Ze,customContent:jo,size:Zo,type:Yo,color:qo}),B(Wt,{icon:on,text:wt,active:!m&&!we,children:tn})]})})}import{TableTr as il}from"@mantine/core";import{useMergedRef as sl}from"@mantine/hooks";import{useEffect as cl,useRef as ul}from"react";import{jsx as ml}from"react/jsx-runtime";function dl({className:e,children:t,isDragging:o,ref:n,...a}){let r=ul(null),l=sl(r,n);return cl(()=>{if(!r.current||!o)return;let f=r.current.parentElement.parentElement.children[0].children[0];for(let p=0;p<f.children.length;p++){let s=f.children[p].getBoundingClientRect(),i=r.current.children[p];i.style.height=s.height+"px",i.style.width=s.width+"px",i.style.minWidth=s.width+"px",i.style.maxWidth=s.width+"px"}},[o,t]),ml(il,{"data-is-dragging":o,ref:l,...a,className:e,children:t})}export{ll as DataTable,dl as DataTableDraggableRow,Oe as calculateColSpan,Jt as differenceBy,Pe as flattenColumns,Tt as getGroupsAtDepth,bt as getMaxGroupDepth,_ as getRecordId,ft as getValueAtPath,de as humanize,jt as needsRightBorder,ui as reorderRecords,di as swapRecords,He as uniqBy,zt as useDataTableColumns};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|